@nivaro/react 0.3.56 → 0.3.58

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 (55) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +9 -2
  4. package/dist/shared/components/CollectionBrowserView.js +2827 -2750
  5. package/dist/shared/components/DataTable.js +247 -236
  6. package/dist/shared/components/ItemEditForm.js +1693 -1668
  7. package/dist/shared/components/ProfileView.js +716 -715
  8. package/dist/shared/components/RecordReadView.js +367 -364
  9. package/dist/shared/components/ReportView.js +64 -39
  10. package/dist/shared/components/alerts/AlertManagerView.js +284 -271
  11. package/dist/shared/components/cbv/row-focus.js +19 -0
  12. package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
  13. package/dist/shared/components/integrations/console/SignalCard.js +59 -59
  14. package/dist/shared/components/integrations/console/tone.js +52 -30
  15. package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
  16. package/dist/shared/components/item-edit/FieldRow.js +175 -173
  17. package/dist/shared/components/item-edit/InlineTableField.js +407 -402
  18. package/dist/shared/components/item-edit/M2MCombobox.js +313 -291
  19. package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
  20. package/dist/shared/components/item-edit/PlanGrid.js +826 -803
  21. package/dist/shared/components/item-edit/QuickCreateButton.js +115 -79
  22. package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
  23. package/dist/shared/components/item-edit/RelationCombobox.js +412 -328
  24. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +147 -125
  25. package/dist/shared/components/item-edit/SummaryPanel.js +406 -392
  26. package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
  27. package/dist/shared/components/item-edit/related-missing.js +45 -0
  28. package/dist/shared/components/item-edit/save-outcome.js +5 -5
  29. package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
  30. package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
  31. package/dist/shared/components/panels/ItemLockBanner.js +2 -3
  32. package/dist/shared/components/panels/PipelinePanel.js +1027 -978
  33. package/dist/shared/components/panels/RevisionsPanel.js +4 -1
  34. package/dist/shared/components/panels/TaskPanel.js +265 -249
  35. package/dist/shared/components/panels/landing-state.js +27 -0
  36. package/dist/shared/components/pipeline/PipelineEditorView.js +86 -78
  37. package/dist/shared/components/profile/AiMemoryCard.js +12 -10
  38. package/dist/shared/components/queue/OwnerAvatars.js +80 -41
  39. package/dist/shared/components/queue/QueueItemSheet.js +111 -111
  40. package/dist/shared/components/queue/QueueQuickFilters.js +48 -48
  41. package/dist/shared/components/queue/QueueWorklist.js +975 -964
  42. package/dist/shared/components/queue/group-sums.js +27 -0
  43. package/dist/shared/components/queue/live-state-aspect.js +7 -3
  44. package/dist/shared/components/queue/path-label.js +14 -0
  45. package/dist/shared/components/widgets/ReviewListWidget.js +186 -168
  46. package/dist/shared/lib/back-closes.js +25 -0
  47. package/dist/shared/lib/cbv-page-warm.js +36 -0
  48. package/dist/shared/lib/form-usage-beacon.js +7 -7
  49. package/dist/shared/lib/list-page-memory.js +41 -0
  50. package/dist/shared/lib/live.js +44 -44
  51. package/dist/shared/lib/own-writes.js +76 -28
  52. package/dist/shared/lib/record-ref.js +78 -53
  53. package/dist/shared/lib/request-gate.js +110 -109
  54. package/dist/shared/lib/validation-rules.js +34 -19
  55. package/package.json +1 -1
@@ -1,42 +1,42 @@
1
1
  import { jsxs as n, jsx as t, Fragment as Ae } from "react/jsx-runtime";
2
- import { useQueryClient as Fe, useQuery as q, useMutation as K } from "@tanstack/react-query";
3
- import { ClipboardList as De, ChevronDown as de, X as Z, Plus as Ee, Bot as Ie, Users as Le, History as We, Pencil as Oe, RotateCcw as je, ChevronsUpDown as ge, Check as Ue } from "lucide-react";
4
- import { useState as w, useRef as Ke, useEffect as xe, useMemo as Re } from "react";
5
- import { toast as v } from "sonner";
6
- import { useNivaroClient as O, useItemEditAuth as Me } from "../../context.js";
7
- import { get as P, post as Q, patch as He, del as Be } from "../../lib/commands.js";
8
- import { OPEN_TASK_STATUSES as ce, invalidateRecordTasks as ze } from "../../lib/record-tasks.js";
9
- import { formatDate as Y, cn as R, formatRelative as fe } from "../../lib/utils.js";
10
- import { TaskDoButton as Ve } from "../ai/TaskDo.js";
2
+ import { useQueryClient as Fe, useQuery as T, useMutation as K } from "@tanstack/react-query";
3
+ import { ClipboardList as De, ChevronDown as ce, X as ee, Plus as Ee, Bot as Ie, Users as Le, History as We, Pencil as je, RotateCcw as Oe, ChevronsUpDown as xe, Check as Ke } from "lucide-react";
4
+ import { useState as C, useRef as Ue, useEffect as te, useMemo as Re } from "react";
5
+ import { toast as w } from "sonner";
6
+ import { useNivaroClient as j, useItemEditAuth as Me } from "../../context.js";
7
+ import { get as A, post as Y, patch as He, del as Be } from "../../lib/commands.js";
8
+ import { OPEN_TASK_STATUSES as me, invalidateRecordTasks as Ve } from "../../lib/record-tasks.js";
9
+ import { formatDate as Z, cn as U, formatRelative as fe } from "../../lib/utils.js";
10
+ import { TaskDoButton as ze } from "../ai/TaskDo.js";
11
11
  import { Button as z } from "../ui/button.js";
12
- import { Checkbox as me } from "../ui/checkbox.js";
13
- import { Command as be, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as ee, CommandItem as ve } from "../ui/command.js";
14
- import { Input as te } from "../ui/input.js";
12
+ import { Checkbox as ue } from "../ui/checkbox.js";
13
+ import { Command as be, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as ae, CommandItem as ve } from "../ui/command.js";
14
+ import { Input as ne } from "../ui/input.js";
15
15
  import { Label as W } from "../ui/label.js";
16
16
  import { Popover as _e, PopoverTrigger as we, PopoverContent as Ce } from "../ui/popover.js";
17
- import { SimpleSelect as G } from "../ui/SimpleSelect.js";
17
+ import { SimpleSelect as J } from "../ui/SimpleSelect.js";
18
18
  import { Textarea as Ge } from "../ui/textarea.js";
19
19
  const Je = "id,first_name,last_name,email,is_out_of_office,ooo_end,delegate_id";
20
- function V(a) {
20
+ function G(a) {
21
21
  return a && ([a.first_name, a.last_name].filter(Boolean).join(" ") || a.email) || "Unknown";
22
22
  }
23
- const $ = (a, i) => a != null && i != null && String(a).toUpperCase() === String(i).toUpperCase();
23
+ const q = (a, o) => a != null && o != null && String(a).toUpperCase() === String(o).toUpperCase();
24
24
  function Se(a) {
25
25
  if (!a) return [];
26
26
  try {
27
- const i = JSON.parse(a);
28
- return Array.isArray(i) ? i : [];
27
+ const o = JSON.parse(a);
28
+ return Array.isArray(o) ? o : [];
29
29
  } catch {
30
30
  return [];
31
31
  }
32
32
  }
33
- function Xe(a, i) {
33
+ function Xe(a, o) {
34
34
  return a.map((d) => {
35
- const c = i.get(d.field) ?? d.field.replace(/_/g, " ");
35
+ const c = o.get(d.field) ?? d.field.replace(/_/g, " ");
36
36
  return d.op === "nnull" ? `${c} is filled in` : d.op === "eq" ? `${c} is ${String(d.value ?? "")}` : d.op === "null" ? `${c} is empty` : `${c} ${d.op} ${String(d.value ?? "")}`.trim();
37
37
  }).join(" and ");
38
38
  }
39
- function ue({ priority: a }) {
39
+ function pe({ priority: a }) {
40
40
  return !a || a === "normal" ? null : /* @__PURE__ */ t(
41
41
  "span",
42
42
  {
@@ -47,25 +47,25 @@ function ue({ priority: a }) {
47
47
  }
48
48
  function Qe({
49
49
  collection: a,
50
- item: i,
50
+ item: o,
51
51
  value: d,
52
52
  valueLabel: c,
53
- onChange: r
53
+ onChange: i
54
54
  }) {
55
- const u = O(), [x, m] = w(!1), [h, o] = w(""), [f, b] = w("");
56
- xe(() => {
55
+ const u = j(), [x, m] = C(!1), [h, r] = C(""), [f, b] = C("");
56
+ te(() => {
57
57
  const s = setTimeout(() => b(h.trim()), 250);
58
58
  return () => clearTimeout(s);
59
59
  }, [h]);
60
- const T = q({
61
- queryKey: ["task-people", a, i],
62
- queryFn: () => u.request(P("/tasks/people", { collection: a, item: i })).then((s) => s.data).catch(() => []),
63
- enabled: x && !!i && i !== "new",
60
+ const F = T({
61
+ queryKey: ["task-people", a, o],
62
+ queryFn: () => u.request(A("/tasks/people", { collection: a, item: o })).then((s) => s.data).catch(() => []),
63
+ enabled: x && !!o && o !== "new",
64
64
  staleTime: 6e4
65
- }), A = q({
65
+ }), D = T({
66
66
  queryKey: ["task-people-search", f],
67
67
  queryFn: () => u.request(
68
- P("/users", {
68
+ A("/users", {
69
69
  limit: 25,
70
70
  people: 1,
71
71
  fields: Je,
@@ -74,44 +74,48 @@ function Qe({
74
74
  ).then((s) => s.data).catch(() => []),
75
75
  enabled: x,
76
76
  staleTime: 6e4
77
- }), _ = T.data ?? [], y = new Set(_.map((s) => String(s.id).toUpperCase())), C = f.toLowerCase(), l = _.filter(
78
- (s) => !C || `${V(s)} ${s.email ?? ""}`.toLowerCase().includes(C)
79
- ), g = (A.data ?? []).filter((s) => !y.has(String(s.id).toUpperCase())), N = [...l, ...g].map((s) => s.id), { data: E } = q({
80
- queryKey: ["task-open-counts", N.join(",")],
77
+ }), N = F.data ?? [], _ = new Set(N.map((s) => String(s.id).toUpperCase())), P = f.toLowerCase(), l = N.filter(
78
+ (s) => !P || `${G(s)} ${s.email ?? ""}`.toLowerCase().includes(P)
79
+ ), g = (D.data ?? []).filter((s) => !_.has(String(s.id).toUpperCase())), k = [...l, ...g].map((s) => s.id), [R, M] = C(""), y = k.join(",");
80
+ te(() => {
81
+ M((s) => k.includes(s) ? s : k[0] ?? "");
82
+ }, [y]);
83
+ const { data: L } = T({
84
+ queryKey: ["task-open-counts", k.join(",")],
81
85
  queryFn: () => u.request(
82
- P("/tasks/open-counts", { ids: N.join(",") })
86
+ A("/tasks/open-counts", { ids: k.join(",") })
83
87
  ).then((s) => s.data).catch(() => ({})),
84
- enabled: x && N.length > 0,
88
+ enabled: x && k.length > 0,
85
89
  staleTime: 6e4
86
- }), M = (s, F) => {
87
- const I = (E == null ? void 0 : E[String(s.id).toUpperCase()]) ?? 0;
90
+ }), H = (s, S) => {
91
+ const E = (L == null ? void 0 : L[String(s.id).toUpperCase()]) ?? 0;
88
92
  return /* @__PURE__ */ n(
89
93
  ve,
90
94
  {
91
95
  value: s.id,
92
96
  onSelect: () => {
93
- r($(s.id, d) ? null : s.id, $(s.id, d) ? null : s), m(!1);
97
+ i(q(s.id, d) ? null : s.id, q(s.id, d) ? null : s), m(!1);
94
98
  },
95
99
  className: "text-[12px]",
96
100
  "data-task-person": s.id,
97
101
  children: [
98
102
  /* @__PURE__ */ t(
99
- Ue,
103
+ Ke,
100
104
  {
101
- className: R("mr-2 h-3.5 w-3.5", $(d, s.id) ? "opacity-100" : "opacity-0")
105
+ className: U("mr-2 h-3.5 w-3.5", q(d, s.id) ? "opacity-100" : "opacity-0")
102
106
  }
103
107
  ),
104
108
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: [
105
- V(s),
106
- F != null && F.length ? /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10.5px] text-muted-foreground", children: F.join(", ") }) : null
109
+ G(s),
110
+ S != null && S.length ? /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10.5px] text-muted-foreground", children: S.join(", ") }) : null
107
111
  ] }),
108
112
  s.is_out_of_office ? /* @__PURE__ */ t("span", { className: "ml-2 shrink-0 text-[10px] text-amber-600 dark:text-amber-400", children: "out" }) : null,
109
- I > 0 && /* @__PURE__ */ t(
113
+ E > 0 && /* @__PURE__ */ t(
110
114
  "span",
111
115
  {
112
116
  className: "ml-2 shrink-0 rounded-full bg-slate-100 px-1.5 text-[10px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400",
113
- title: `${I} open task${I === 1 ? "" : "s"} already assigned`,
114
- children: I
117
+ title: `${E} open task${E === 1 ? "" : "s"} already assigned`,
118
+ children: E
115
119
  }
116
120
  )
117
121
  ]
@@ -129,48 +133,48 @@ function Qe({
129
133
  "data-task-assignee-picker": !0,
130
134
  className: "h-8 w-full justify-between px-2.5 text-[12px] font-normal",
131
135
  children: [
132
- /* @__PURE__ */ t("span", { className: R("truncate", !d && "text-muted-foreground"), children: d ? c ?? "Selected" : "Assign to…" }),
133
- /* @__PURE__ */ t(ge, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
136
+ /* @__PURE__ */ t("span", { className: U("truncate", !d && "text-muted-foreground"), children: d ? c ?? "Selected" : "Assign to…" }),
137
+ /* @__PURE__ */ t(xe, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
134
138
  ]
135
139
  }
136
140
  ) }),
137
- /* @__PURE__ */ t(Ce, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ n(be, { shouldFilter: !1, children: [
141
+ /* @__PURE__ */ t(Ce, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ n(be, { shouldFilter: !1, value: R, onValueChange: M, children: [
138
142
  /* @__PURE__ */ t(
139
143
  ke,
140
144
  {
141
145
  placeholder: "Search people…",
142
146
  className: "h-8 text-[12px]",
143
147
  value: h,
144
- onValueChange: o
148
+ onValueChange: r
145
149
  }
146
150
  ),
147
151
  /* @__PURE__ */ n(ye, { children: [
148
- /* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: A.isFetching ? "Searching…" : "No one matches" }),
149
- l.length > 0 && /* @__PURE__ */ t(ee, { heading: "On this record", children: l.map((s) => M(s, s.reasons)) }),
150
- g.length > 0 && /* @__PURE__ */ t(ee, { heading: f ? "Everyone" : "Everyone (type to search)", children: g.map((s) => M(s)) })
152
+ /* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: D.isFetching ? "Searching…" : "No one matches" }),
153
+ l.length > 0 && /* @__PURE__ */ t(ae, { heading: "On this record", children: l.map((s) => H(s, s.reasons)) }),
154
+ g.length > 0 && /* @__PURE__ */ t(ae, { heading: f ? "Everyone" : "Everyone (type to search)", children: g.map((s) => H(s)) })
151
155
  ] })
152
156
  ] }) })
153
157
  ] });
154
158
  }
155
159
  function Ye(a) {
156
- const i = O();
157
- return q({
160
+ const o = j();
161
+ return T({
158
162
  queryKey: ["task-agents"],
159
- queryFn: () => i.request(P("/tasks/agents")).then((d) => d.data ?? []).catch(() => []),
163
+ queryFn: () => o.request(A("/tasks/agents")).then((d) => d.data ?? []).catch(() => []),
160
164
  enabled: a,
161
165
  staleTime: 5 * 6e4
162
166
  });
163
167
  }
164
168
  function Ze({
165
169
  agents: a,
166
- value: i,
170
+ value: o,
167
171
  onChange: d
168
172
  }) {
169
173
  return /* @__PURE__ */ t(
170
- G,
174
+ J,
171
175
  {
172
- value: i ?? "",
173
- onChange: (c) => d(a.find((r) => r.conn === c) ?? null),
176
+ value: o ?? "",
177
+ onChange: (c) => d(a.find((i) => i.conn === c) ?? null),
174
178
  ariaLabel: "Agent",
175
179
  options: [
176
180
  { value: "", label: a.length ? "Choose an agent…" : "No agents connected" },
@@ -184,51 +188,51 @@ function Ze({
184
188
  }
185
189
  function et({
186
190
  value: a,
187
- onChange: i
191
+ onChange: o
188
192
  }) {
189
- const d = O(), { data: c = [] } = q({
193
+ const d = j(), { data: c = [] } = T({
190
194
  queryKey: ["user-groups", "task-picker"],
191
- queryFn: () => d.request(P("/user-groups")).then((r) => r.data).catch(() => []),
195
+ queryFn: () => d.request(A("/user-groups")).then((i) => i.data).catch(() => []),
192
196
  staleTime: 5 * 6e4
193
197
  });
194
198
  return /* @__PURE__ */ t(
195
- G,
199
+ J,
196
200
  {
197
201
  value: a == null ? "" : String(a),
198
- onChange: (r) => {
199
- const u = c.find((x) => String(x.id) === r) ?? null;
200
- i(u ? u.id : null, u);
202
+ onChange: (i) => {
203
+ const u = c.find((x) => String(x.id) === i) ?? null;
204
+ o(u ? u.id : null, u);
201
205
  },
202
206
  ariaLabel: "Team",
203
207
  options: [
204
208
  { value: "", label: c.length ? "Choose a team…" : "No teams yet" },
205
- ...c.map((r) => ({
206
- value: String(r.id),
207
- label: `${r.name}${r.member_count ? ` · ${r.member_count}` : ""}`
209
+ ...c.map((i) => ({
210
+ value: String(i.id),
211
+ label: `${i.name}${i.member_count ? ` · ${i.member_count}` : ""}`
208
212
  }))
209
213
  ]
210
214
  }
211
215
  );
212
216
  }
213
- function $e(a) {
214
- const i = O(), { data: d } = q({
217
+ function Pe(a) {
218
+ const o = j(), { data: d } = T({
215
219
  queryKey: ["task-field-labels", a],
216
- queryFn: () => i.request(P(`/collections/${a}`)).then((u) => u.data.fields ?? []).catch(() => []),
220
+ queryFn: () => o.request(A(`/collections/${a}`)).then((u) => u.data.fields ?? []).catch(() => []),
217
221
  staleTime: 10 * 6e4
218
222
  }), c = (d ?? []).filter(
219
223
  (u) => !u.hidden && u.field !== "id" && u.type !== "alias" && !u.field.startsWith("__")
220
- ), r = Re(
224
+ ), i = Re(
221
225
  () => new Map(c.map((u) => [u.field, u.label || u.field.replace(/_/g, " ")])),
222
226
  [c]
223
227
  );
224
- return { fields: c, labels: r };
228
+ return { fields: c, labels: i };
225
229
  }
226
230
  function tt({
227
231
  collection: a,
228
- value: i,
232
+ value: o,
229
233
  onChange: d
230
234
  }) {
231
- const { fields: c, labels: r } = $e(a), [u, x] = w(!1), m = i[0] ?? null;
235
+ const { fields: c, labels: i } = Pe(a), [u, x] = C(!1), m = o[0] ?? null;
232
236
  return /* @__PURE__ */ n("div", { className: "space-y-1.5", "data-task-done-when": !0, children: [
233
237
  /* @__PURE__ */ t(W, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
234
238
  /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: [
@@ -239,8 +243,8 @@ function tt({
239
243
  variant: "outline",
240
244
  className: "h-8 max-w-[220px] justify-between px-2.5 text-[12px] font-normal",
241
245
  children: [
242
- /* @__PURE__ */ t("span", { className: R("truncate", !m && "text-muted-foreground"), children: m ? r.get(m.field) ?? m.field : "A field on this record…" }),
243
- /* @__PURE__ */ t(ge, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
246
+ /* @__PURE__ */ t("span", { className: U("truncate", !m && "text-muted-foreground"), children: m ? i.get(m.field) ?? m.field : "A field on this record…" }),
247
+ /* @__PURE__ */ t(xe, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
244
248
  ]
245
249
  }
246
250
  ) }),
@@ -248,17 +252,17 @@ function tt({
248
252
  /* @__PURE__ */ t(ke, { placeholder: "Search fields…", className: "h-8 text-[12px]" }),
249
253
  /* @__PURE__ */ n(ye, { children: [
250
254
  /* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No field" }),
251
- /* @__PURE__ */ t(ee, { children: c.map((h) => /* @__PURE__ */ t(
255
+ /* @__PURE__ */ t(ae, { children: c.map((h) => /* @__PURE__ */ t(
252
256
  ve,
253
257
  {
254
- value: `${r.get(h.field)} ${h.field}`,
258
+ value: `${i.get(h.field)} ${h.field}`,
255
259
  onSelect: () => {
256
260
  d([
257
261
  { field: h.field, op: (m == null ? void 0 : m.op) ?? "nnull", value: (m == null ? void 0 : m.value) ?? null }
258
262
  ]), x(!1);
259
263
  },
260
264
  className: "text-[12px]",
261
- children: r.get(h.field)
265
+ children: i.get(h.field)
262
266
  },
263
267
  h.field
264
268
  )) })
@@ -267,7 +271,7 @@ function tt({
267
271
  ] }),
268
272
  m && /* @__PURE__ */ n(Ae, { children: [
269
273
  /* @__PURE__ */ t("div", { className: "w-[130px]", children: /* @__PURE__ */ t(
270
- G,
274
+ J,
271
275
  {
272
276
  value: m.op,
273
277
  onChange: (h) => d([{ ...m, op: h, value: h === "eq" ? m.value ?? "" : null }]),
@@ -278,7 +282,7 @@ function tt({
278
282
  }
279
283
  ) }),
280
284
  m.op === "eq" && /* @__PURE__ */ t(
281
- te,
285
+ ne,
282
286
  {
283
287
  value: String(m.value ?? ""),
284
288
  onChange: (h) => d([{ ...m, value: h.target.value }]),
@@ -293,7 +297,7 @@ function tt({
293
297
  onClick: () => d([]),
294
298
  className: "rounded p-1 text-slate-400 hover:text-slate-600",
295
299
  "aria-label": "Remove condition",
296
- children: /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" })
300
+ children: /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" })
297
301
  }
298
302
  )
299
303
  ] })
@@ -332,19 +336,19 @@ function nt(a) {
332
336
  doneWhen: Se(a.done_when)
333
337
  };
334
338
  }
335
- function pe({
339
+ function he({
336
340
  collection: a,
337
- item: i,
341
+ item: o,
338
342
  initial: d,
339
343
  submitLabel: c,
340
- busy: r,
344
+ busy: i,
341
345
  allowTeam: u,
342
346
  allowAgent: x = !1,
343
347
  onSubmit: m,
344
348
  onCancel: h
345
349
  }) {
346
- var C;
347
- const [o, f] = w(d), b = (l, g) => f((N) => ({ ...N, [l]: g })), T = Ye(x).data ?? [], A = x && (T.length > 0 || o.mode === "agent"), _ = o.mode === "team" ? o.teamId != null : o.mode === "agent" ? !!o.agent : !!o.assignee, y = o.mode === "person" && ((C = o.assigneePerson) != null && C.is_out_of_office) ? o.assigneePerson : null;
350
+ var P;
351
+ const [r, f] = C(d), b = (l, g) => f((k) => ({ ...k, [l]: g })), F = Ye(x).data ?? [], D = x && (F.length > 0 || r.mode === "agent"), N = r.mode === "team" ? r.teamId != null : r.mode === "agent" ? !!r.agent : !!r.assignee, _ = r.mode === "person" && ((P = r.assigneePerson) != null && P.is_out_of_office) ? r.assigneePerson : null;
348
352
  return /* @__PURE__ */ n(
349
353
  "div",
350
354
  {
@@ -354,9 +358,9 @@ function pe({
354
358
  /* @__PURE__ */ n("div", { children: [
355
359
  /* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Title" }),
356
360
  /* @__PURE__ */ t(
357
- te,
361
+ ne,
358
362
  {
359
- value: o.title,
363
+ value: r.title,
360
364
  onChange: (l) => b("title", l.target.value),
361
365
  className: "h-8 bg-white text-[12px] dark:bg-background",
362
366
  placeholder: "What needs to be done?",
@@ -370,7 +374,7 @@ function pe({
370
374
  /* @__PURE__ */ t(
371
375
  Ge,
372
376
  {
373
- value: o.description,
377
+ value: r.description,
374
378
  onChange: (l) => b("description", l.target.value),
375
379
  className: "min-h-[56px] bg-white text-[12px] dark:bg-background",
376
380
  placeholder: "Anything the person needs to know",
@@ -383,11 +387,11 @@ function pe({
383
387
  /* @__PURE__ */ n("div", { className: "col-span-2 sm:col-span-1", children: [
384
388
  /* @__PURE__ */ n("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
385
389
  /* @__PURE__ */ n(W, { className: "text-[11px]", children: [
386
- o.mode === "team" ? "Team" : o.mode === "agent" ? "Agent" : "Assignee",
390
+ r.mode === "team" ? "Team" : r.mode === "agent" ? "Agent" : "Assignee",
387
391
  /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "ml-0.5 text-red-500", "data-task-required": !0, children: "*" })
388
392
  ] }),
389
393
  /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: ["person", "team", "agent"].filter(
390
- (l) => l !== o.mode && (l !== "team" || u) && (l !== "agent" || A)
394
+ (l) => l !== r.mode && (l !== "team" || u) && (l !== "agent" || D)
391
395
  ).map((l) => /* @__PURE__ */ t(
392
396
  "button",
393
397
  {
@@ -400,50 +404,50 @@ function pe({
400
404
  l
401
405
  )) })
402
406
  ] }),
403
- o.mode === "agent" ? /* @__PURE__ */ t(
407
+ r.mode === "agent" ? /* @__PURE__ */ t(
404
408
  Ze,
405
409
  {
406
- agents: T,
407
- value: o.agent,
410
+ agents: F,
411
+ value: r.agent,
408
412
  onChange: (l) => f((g) => ({ ...g, agent: (l == null ? void 0 : l.conn) ?? null, agentName: (l == null ? void 0 : l.name) ?? null }))
409
413
  }
410
- ) : o.mode === "team" ? /* @__PURE__ */ t(
414
+ ) : r.mode === "team" ? /* @__PURE__ */ t(
411
415
  et,
412
416
  {
413
- value: o.teamId,
414
- onChange: (l, g) => f((N) => ({ ...N, teamId: l, teamName: (g == null ? void 0 : g.name) ?? null }))
417
+ value: r.teamId,
418
+ onChange: (l, g) => f((k) => ({ ...k, teamId: l, teamName: (g == null ? void 0 : g.name) ?? null }))
415
419
  }
416
420
  ) : /* @__PURE__ */ t(
417
421
  Qe,
418
422
  {
419
423
  collection: a,
420
- item: i,
421
- value: o.assignee,
422
- valueLabel: o.assigneeName,
423
- onChange: (l, g) => f((N) => ({
424
- ...N,
424
+ item: o,
425
+ value: r.assignee,
426
+ valueLabel: r.assigneeName,
427
+ onChange: (l, g) => f((k) => ({
428
+ ...k,
425
429
  assignee: l,
426
- assigneeName: g ? V(g) : null,
430
+ assigneeName: g ? G(g) : null,
427
431
  assigneePerson: g
428
432
  }))
429
433
  }
430
434
  ),
431
- y && /* @__PURE__ */ n("p", { className: "mt-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 dark:bg-amber-400/10 dark:text-amber-400", children: [
432
- V(y),
435
+ _ && /* @__PURE__ */ n("p", { className: "mt-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 dark:bg-amber-400/10 dark:text-amber-400", children: [
436
+ G(_),
433
437
  " is out of office",
434
- y.ooo_end ? ` until ${String(y.ooo_end).slice(0, 10)}` : "",
438
+ _.ooo_end ? ` until ${String(_.ooo_end).slice(0, 10)}` : "",
435
439
  " — the task goes to their delegate if one is set."
436
440
  ] }),
437
- o.mode === "team" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Waits with the team until one of them picks it up." }),
438
- o.mode === "agent" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "The assistant picks it up through My Work and acts as the person it is connected for." })
441
+ r.mode === "team" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Waits with the team until one of them picks it up." }),
442
+ r.mode === "agent" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "The assistant picks it up through My Work and acts as the person it is connected for." })
439
443
  ] }),
440
444
  /* @__PURE__ */ n("div", { children: [
441
445
  /* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Due date" }),
442
446
  /* @__PURE__ */ t(
443
- te,
447
+ ne,
444
448
  {
445
449
  type: "date",
446
- value: o.due,
450
+ value: r.due,
447
451
  onChange: (l) => b("due", l.target.value),
448
452
  className: "h-8 bg-white text-[12px] dark:bg-background",
449
453
  "data-task-due": !0
@@ -453,9 +457,9 @@ function pe({
453
457
  /* @__PURE__ */ n("div", { children: [
454
458
  /* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Priority" }),
455
459
  /* @__PURE__ */ t(
456
- G,
460
+ J,
457
461
  {
458
- value: o.priority,
462
+ value: r.priority,
459
463
  onChange: (l) => b("priority", l),
460
464
  options: [
461
465
  { value: "low", label: "Low" },
@@ -470,7 +474,7 @@ function pe({
470
474
  tt,
471
475
  {
472
476
  collection: a,
473
- value: o.doneWhen,
477
+ value: r.doneWhen,
474
478
  onChange: (l) => b("doneWhen", l)
475
479
  }
476
480
  ),
@@ -486,23 +490,35 @@ function pe({
486
490
  children: "Cancel"
487
491
  }
488
492
  ),
489
- /* @__PURE__ */ t(
493
+ /* @__PURE__ */ n(
490
494
  "span",
491
495
  {
492
496
  className: "inline-flex",
493
- "data-tip": r ? void 0 : o.title.trim() ? _ ? void 0 : o.mode === "team" ? "Pick a team first" : o.mode === "agent" ? "Pick an agent first" : "Pick an assignee first" : "Write what needs to be done first",
494
- children: /* @__PURE__ */ t(
495
- z,
496
- {
497
- type: "button",
498
- size: "sm",
499
- className: "h-7 text-[12px]",
500
- disabled: !o.title.trim() || !_ || r,
501
- onClick: () => m(o),
502
- "data-task-submit": !0,
503
- children: r ? "Saving…" : c
504
- }
505
- )
497
+ "data-tip": i ? void 0 : r.title.trim() ? N ? void 0 : r.mode === "team" ? "Pick a team first" : r.mode === "agent" ? "Pick an agent first" : "Pick an assignee first" : "Write what needs to be done first",
498
+ children: [
499
+ /* @__PURE__ */ t(
500
+ z,
501
+ {
502
+ type: "button",
503
+ size: "sm",
504
+ className: "h-7 text-[12px]",
505
+ disabled: !r.title.trim() || !N || i,
506
+ "aria-describedby": !i && r.title.trim() && !N ? "task-submit-why" : void 0,
507
+ onClick: () => m(r),
508
+ "data-task-submit": !0,
509
+ children: i ? "Saving…" : c
510
+ }
511
+ ),
512
+ !i && r.title.trim() && !N && /* @__PURE__ */ t(
513
+ "span",
514
+ {
515
+ id: "task-submit-why",
516
+ className: "ml-2 text-[11.5px] text-slate-500 dark:text-slate-400",
517
+ "data-task-submit-why": !0,
518
+ children: r.mode === "team" ? "Pick a team first" : r.mode === "agent" ? "Pick an agent first" : "Pick an assignee first"
519
+ }
520
+ )
521
+ ]
506
522
  }
507
523
  )
508
524
  ] })
@@ -510,10 +526,10 @@ function pe({
510
526
  }
511
527
  );
512
528
  }
513
- function he({ taskId: a }) {
514
- const i = O(), { data: d = [], isLoading: c } = q({
529
+ function ge({ taskId: a }) {
530
+ const o = j(), { data: d = [], isLoading: c } = T({
515
531
  queryKey: ["task-history", a],
516
- queryFn: () => i.request(P(`/tasks/${a}/history`)).then((r) => r.data),
532
+ queryFn: () => o.request(A(`/tasks/${a}/history`)).then((i) => i.data),
517
533
  staleTime: 3e4
518
534
  });
519
535
  return c ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Loading history…" }) : d.length ? /* @__PURE__ */ t(
@@ -521,41 +537,41 @@ function he({ taskId: a }) {
521
537
  {
522
538
  className: "mt-1.5 space-y-1 border-l border-slate-200 pl-3 dark:border-border",
523
539
  "data-task-history": !0,
524
- children: d.map((r) => /* @__PURE__ */ n("li", { className: "text-[11px] text-slate-600 dark:text-slate-400", children: [
525
- /* @__PURE__ */ t("span", { className: "text-slate-800 dark:text-slate-200", children: r.text }),
540
+ children: d.map((i) => /* @__PURE__ */ n("li", { className: "text-[11px] text-slate-600 dark:text-slate-400", children: [
541
+ /* @__PURE__ */ t("span", { className: "text-slate-800 dark:text-slate-200", children: i.text }),
526
542
  /* @__PURE__ */ n("span", { className: "text-slate-400", children: [
527
543
  " ",
528
544
  "· ",
529
- r.user_name ? `${r.user_name}, ` : "",
530
- /* @__PURE__ */ t("span", { title: new Date(r.at).toLocaleString(), children: fe(r.at) })
545
+ i.user_name ? `${i.user_name}, ` : "",
546
+ /* @__PURE__ */ t("span", { title: new Date(i.at).toLocaleString(), children: fe(i.at) })
531
547
  ] })
532
- ] }, r.id))
548
+ ] }, i.id))
533
549
  }
534
550
  ) : /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "No history yet." });
535
551
  }
536
552
  function vt({
537
553
  collection: a,
538
- item: i,
554
+ item: o,
539
555
  title: d,
540
556
  defaultExpanded: c,
541
- queuedTasks: r,
557
+ queuedTasks: i,
542
558
  onQueueTask: u,
543
559
  onRemoveQueuedTask: x
544
560
  }) {
545
- const m = O(), h = Fe(), { isAdmin: o, userId: f } = Me(), [b, T] = w(!1), A = Ke(!1);
546
- xe(() => {
547
- !A.current && c !== void 0 && (A.current = !0, T(c));
561
+ const m = j(), h = Fe(), { isAdmin: r, userId: f } = Me(), [b, F] = C(!1), D = Ue(!1);
562
+ te(() => {
563
+ !D.current && c !== void 0 && (D.current = !0, F(c));
548
564
  }, [c]);
549
- const [_, y] = w(!1), [C, l] = w(null), [g, N] = w(null), [E, M] = w(!1), s = !i || i === "new", { data: F = [] } = q({
550
- queryKey: ["tasks", a, i],
551
- queryFn: () => m.request(P("/tasks", { collection: a, item: i })).then((e) => e.data),
552
- enabled: !!a && !s
553
- }), { labels: I } = $e(a), L = () => {
554
- ze(h, a, i), h.invalidateQueries({ queryKey: ["task-history"] });
555
- }, j = (e, p) => {
556
- var D;
557
- return ((D = e == null ? void 0 : e.response) == null ? void 0 : D.error) ?? (e instanceof Error && e.message ? e.message : p);
558
- }, ae = (e) => ({
565
+ const [N, _] = C(!1), [P, l] = C(null), [g, k] = C(null), [R, M] = C(!1), y = !o || o === "new", { data: L = [] } = T({
566
+ queryKey: ["tasks", a, o],
567
+ queryFn: () => m.request(A("/tasks", { collection: a, item: o })).then((e) => e.data),
568
+ enabled: !!a && !y
569
+ }), { labels: H } = Pe(a), s = () => {
570
+ Ve(h, a, o), h.invalidateQueries({ queryKey: ["task-history"] });
571
+ }, S = (e, p) => {
572
+ var I;
573
+ return ((I = e == null ? void 0 : e.response) == null ? void 0 : I.error) ?? (e instanceof Error && e.message ? e.message : p);
574
+ }, E = (e) => ({
559
575
  title: e.title.trim(),
560
576
  description: e.description.trim() || null,
561
577
  assignee: e.mode === "person" ? e.assignee : null,
@@ -564,44 +580,44 @@ function vt({
564
580
  due_date: e.due || null,
565
581
  priority: e.priority,
566
582
  done_when: e.doneWhen.length ? e.doneWhen : null
567
- }), ne = K({
583
+ }), se = K({
568
584
  mutationFn: (e) => m.request(
569
- Q("/tasks", { collection: a, item: i, ...ae(e) })
585
+ Y("/tasks", { collection: a, item: o, ...E(e) })
570
586
  ),
571
587
  onSuccess: (e) => {
572
588
  var p;
573
- L(), y(!1), v.success(
589
+ s(), _(!1), w.success(
574
590
  (p = e == null ? void 0 : e.data) != null && p.delegated_from ? "Task created — it went to their delegate" : "Task created"
575
591
  );
576
592
  },
577
- onError: (e) => v.error(j(e, "Could not create the task"))
578
- }), H = K({
593
+ onError: (e) => w.error(S(e, "Could not create the task"))
594
+ }), B = K({
579
595
  mutationFn: ({ id: e, body: p }) => m.request(He(`/tasks/${e}`, p)),
580
596
  onSuccess: (e, p) => {
581
- L(), l(null), p.body.status === "open" ? v.success("Task reopened") : v.success("Task updated");
597
+ s(), l(null), p.body.status === "open" ? w.success("Task reopened") : w.success("Task updated");
582
598
  },
583
- onError: (e) => v.error(j(e, "Could not update the task"))
584
- }), se = K({
585
- mutationFn: (e) => m.request(Q(`/tasks/${e}/complete`, {})),
599
+ onError: (e) => w.error(S(e, "Could not update the task"))
600
+ }), le = K({
601
+ mutationFn: (e) => m.request(Y(`/tasks/${e}/complete`, {})),
586
602
  onSuccess: () => {
587
- L(), v.success("Task completed");
603
+ s(), w.success("Task completed");
588
604
  },
589
- onError: (e) => v.error(j(e, "Could not complete the task"))
590
- }), le = K({
591
- mutationFn: (e) => m.request(Q(`/tasks/${e}/claim`, {})),
605
+ onError: (e) => w.error(S(e, "Could not complete the task"))
606
+ }), ie = K({
607
+ mutationFn: (e) => m.request(Y(`/tasks/${e}/claim`, {})),
592
608
  onSuccess: () => {
593
- L(), v.success("It’s yours");
609
+ s(), w.success("It’s yours");
594
610
  },
595
- onError: (e) => v.error(j(e, "Could not pick it up"))
611
+ onError: (e) => w.error(S(e, "Could not pick it up"))
596
612
  }), re = K({
597
613
  mutationFn: (e) => m.request(Be(`/tasks/${e}`)),
598
614
  onSuccess: () => {
599
- L(), v.success("Task deleted");
615
+ s(), w.success("Task deleted");
600
616
  },
601
- onError: (e) => v.error(j(e, "Could not delete the task"))
617
+ onError: (e) => w.error(S(e, "Could not delete the task"))
602
618
  });
603
619
  if (!a) return null;
604
- const k = F.filter((e) => ce.has(e.status)), J = F.filter((e) => !ce.has(e.status)), qe = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), X = (e) => o || $(e.assignee, f) || $(e.created_by, f), Pe = (e) => o || $(e.created_by, f);
620
+ const v = L.filter((e) => me.has(e.status)), X = L.filter((e) => !me.has(e.status)), $e = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), Q = (e) => r || q(e.assignee, f) || q(e.created_by, f), qe = (e) => r || q(e.created_by, f);
605
621
  function Te(e) {
606
622
  u == null || u({
607
623
  title: e.title.trim(),
@@ -612,12 +628,12 @@ function vt({
612
628
  team_name: e.mode === "team" ? e.teamName : null,
613
629
  due_date: e.due,
614
630
  priority: e.priority
615
- }), y(!1);
631
+ }), _(!1);
616
632
  }
617
- const ie = (e, p) => {
618
- const D = !p && !!e.due_date && String(e.due_date).slice(0, 10) < qe;
633
+ const oe = (e, p) => {
634
+ const I = !p && !!e.due_date && String(e.due_date).slice(0, 10) < $e;
619
635
  return /* @__PURE__ */ n("div", { className: "mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-slate-400", children: [
620
- /* @__PURE__ */ t(ue, { priority: e.priority }),
636
+ /* @__PURE__ */ t(pe, { priority: e.priority }),
621
637
  e.agent_assignee ? /* @__PURE__ */ n(
622
638
  "span",
623
639
  {
@@ -637,28 +653,28 @@ function vt({
637
653
  "Waiting for ",
638
654
  e.team_name ?? "the team"
639
655
  ] }) : null,
640
- !p && e.due_date && /* @__PURE__ */ n("span", { className: R(D && "font-medium text-red-500"), children: [
656
+ !p && e.due_date && /* @__PURE__ */ n("span", { className: U(I && "font-medium text-red-500"), children: [
641
657
  "Due ",
642
- Y(e.due_date),
643
- D && " (overdue)"
658
+ Z(e.due_date),
659
+ I && " (overdue)"
644
660
  ] }),
645
661
  p && e.completed_at && /* @__PURE__ */ n("span", { "data-task-completed-by": !0, children: [
646
662
  e.status === "cancelled" ? "Cancelled" : `Done${e.completed_by_name ? ` by ${e.completed_by_name}` : ""}`,
647
663
  " ",
648
664
  /* @__PURE__ */ t("span", { title: new Date(e.completed_at).toLocaleString(), children: fe(e.completed_at) })
649
665
  ] }),
650
- e.created_by_name && !$(e.created_by, e.assignee) && /* @__PURE__ */ n("span", { children: [
666
+ e.created_by_name && !q(e.created_by, e.assignee) && /* @__PURE__ */ n("span", { children: [
651
667
  "Asked by ",
652
668
  e.created_by_name
653
669
  ] })
654
670
  ] });
655
- }, oe = (e, p) => /* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
656
- !p && /* @__PURE__ */ t(Ve, { task: e, compact: !0, onTaskChanged: L }),
671
+ }, de = (e, p) => /* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
672
+ !p && /* @__PURE__ */ t(ze, { task: e, compact: !0, onTaskChanged: s }),
657
673
  /* @__PURE__ */ t(
658
674
  "button",
659
675
  {
660
676
  type: "button",
661
- onClick: () => N(g === e.id ? null : e.id),
677
+ onClick: () => k(g === e.id ? null : e.id),
662
678
  className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
663
679
  "aria-label": `History of ${e.title}`,
664
680
  title: "History",
@@ -666,33 +682,33 @@ function vt({
666
682
  children: /* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" })
667
683
  }
668
684
  ),
669
- !p && X(e) && /* @__PURE__ */ t(
685
+ !p && Q(e) && /* @__PURE__ */ t(
670
686
  "button",
671
687
  {
672
688
  type: "button",
673
- onClick: () => l(C === e.id ? null : e.id),
689
+ onClick: () => l(P === e.id ? null : e.id),
674
690
  className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
675
691
  "aria-label": `Edit ${e.title}`,
676
692
  title: "Edit",
677
693
  "data-task-edit": e.id,
678
- children: /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" })
694
+ children: /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" })
679
695
  }
680
696
  ),
681
- p && X(e) && /* @__PURE__ */ n(
697
+ p && Q(e) && /* @__PURE__ */ n(
682
698
  "button",
683
699
  {
684
700
  type: "button",
685
- onClick: () => H.mutate({ id: e.id, body: { status: "open" } }),
686
- disabled: H.isPending,
701
+ onClick: () => B.mutate({ id: e.id, body: { status: "open" } }),
702
+ disabled: B.isPending,
687
703
  className: "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 dark:hover:text-slate-200",
688
704
  "data-task-reopen": e.id,
689
705
  children: [
690
- /* @__PURE__ */ t(je, { className: "h-3 w-3" }),
706
+ /* @__PURE__ */ t(Oe, { className: "h-3 w-3" }),
691
707
  "Reopen"
692
708
  ]
693
709
  }
694
710
  ),
695
- Pe(e) && /* @__PURE__ */ t(
711
+ qe(e) && /* @__PURE__ */ t(
696
712
  "button",
697
713
  {
698
714
  type: "button",
@@ -701,7 +717,7 @@ function vt({
701
717
  className: "rounded p-1 text-slate-300 transition-colors hover:bg-red-50 hover:text-red-400 disabled:opacity-40 dark:hover:bg-red-500/10",
702
718
  "aria-label": `Delete ${e.title}`,
703
719
  title: "Delete",
704
- children: /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" })
720
+ children: /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" })
705
721
  }
706
722
  )
707
723
  ] });
@@ -710,7 +726,7 @@ function vt({
710
726
  "button",
711
727
  {
712
728
  type: "button",
713
- onClick: () => T((e) => !e),
729
+ onClick: () => F((e) => !e),
714
730
  "aria-expanded": b,
715
731
  "data-task-panel-toggle": b ? "open" : "closed",
716
732
  className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
@@ -718,34 +734,34 @@ function vt({
718
734
  /* @__PURE__ */ n("span", { className: "flex w-full items-center gap-2.5", children: [
719
735
  /* @__PURE__ */ t(De, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
720
736
  /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Tasks" }),
721
- (s ? (r ?? []).length : k.length) > 0 && /* @__PURE__ */ t("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: s ? `${(r ?? []).length} queued` : `${k.length} open` }),
737
+ (y ? (i ?? []).length : v.length) > 0 && /* @__PURE__ */ t("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: y ? `${(i ?? []).length} queued` : `${v.length} open` }),
722
738
  /* @__PURE__ */ t(
723
- de,
739
+ ce,
724
740
  {
725
741
  className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${b ? " rotate-180" : ""}`
726
742
  }
727
743
  )
728
744
  ] }),
729
- !b && k.length > 0 && /* @__PURE__ */ n("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
730
- k[k.length - 1].title,
731
- k[k.length - 1].due_date && /* @__PURE__ */ n("span", { className: "text-slate-400/80", children: [
745
+ !b && v.length > 0 && /* @__PURE__ */ n("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
746
+ v[v.length - 1].title,
747
+ v[v.length - 1].due_date && /* @__PURE__ */ n("span", { className: "text-slate-400/80", children: [
732
748
  " ",
733
749
  "· due ",
734
- Y(k[k.length - 1].due_date)
750
+ Z(v[v.length - 1].due_date)
735
751
  ] })
736
752
  ] })
737
753
  ]
738
754
  }
739
755
  ),
740
756
  b && /* @__PURE__ */ t("div", { className: "border-t border-slate-100 dark:border-border/60", children: /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-3", children: [
741
- s && (r ?? []).length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (r ?? []).map((e, p) => (
757
+ y && (i ?? []).length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (i ?? []).map((e, p) => (
742
758
  // biome-ignore lint/suspicious/noArrayIndexKey: queued rows have no id yet
743
759
  /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5 py-2", children: [
744
760
  /* @__PURE__ */ t("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
745
761
  /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
746
762
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: e.title }),
747
763
  /* @__PURE__ */ n("div", { className: "mt-0.5 flex items-center gap-3 text-[11px] text-slate-400", children: [
748
- /* @__PURE__ */ t(ue, { priority: e.priority }),
764
+ /* @__PURE__ */ t(pe, { priority: e.priority }),
749
765
  e.assignee_name && /* @__PURE__ */ t("span", { children: e.assignee_name }),
750
766
  e.team_name && /* @__PURE__ */ n("span", { children: [
751
767
  "Team: ",
@@ -753,7 +769,7 @@ function vt({
753
769
  ] }),
754
770
  e.due_date && /* @__PURE__ */ n("span", { children: [
755
771
  "Due ",
756
- Y(e.due_date)
772
+ Z(e.due_date)
757
773
  ] })
758
774
  ] })
759
775
  ] }),
@@ -764,80 +780,80 @@ function vt({
764
780
  onClick: () => x(p),
765
781
  className: "shrink-0 rounded p-1 text-slate-300 hover:text-red-400",
766
782
  "aria-label": `Remove ${e.title}`,
767
- children: /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" })
783
+ children: /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" })
768
784
  }
769
785
  )
770
786
  ] }, p)
771
787
  )) }),
772
- s && (r ?? []).length === 0 && !_ && /* @__PURE__ */ t("p", { className: "py-1 text-[12px] text-slate-400", children: "Tasks are created once the record is saved." }),
773
- !s && k.length === 0 && !_ && /* @__PURE__ */ t("p", { className: "py-1 text-[13px] text-slate-400", children: "No open tasks" }),
774
- !s && k.length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: k.map((e) => {
775
- const p = Se(e.done_when), D = !e.assignee && e.team_id != null;
788
+ y && (i ?? []).length === 0 && !N && /* @__PURE__ */ t("p", { className: "py-1 text-[12px] text-slate-400", children: "Tasks are created once the record is saved." }),
789
+ !y && v.length === 0 && !N && /* @__PURE__ */ t("p", { className: "py-1 text-[13px] text-slate-400", children: "No open tasks" }),
790
+ !y && v.length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: v.map((e) => {
791
+ const p = Se(e.done_when), I = !e.assignee && e.team_id != null;
776
792
  return /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
777
793
  /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5", children: [
778
794
  /* @__PURE__ */ t(
779
- me,
795
+ ue,
780
796
  {
781
797
  className: "mt-0.5",
782
798
  checked: !1,
783
- onCheckedChange: () => se.mutate(e.id),
784
- disabled: se.isPending || !X(e),
799
+ onCheckedChange: () => le.mutate(e.id),
800
+ disabled: le.isPending || !Q(e),
785
801
  "aria-label": `Complete task: ${e.title}`
786
802
  }
787
803
  ),
788
804
  /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
789
805
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: e.title }),
790
806
  e.description && /* @__PURE__ */ t("p", { className: "mt-0.5 line-clamp-2 whitespace-pre-line text-[12px] text-slate-500", children: e.description }),
791
- ie(e, !1),
807
+ oe(e, !1),
792
808
  p.length > 0 && /* @__PURE__ */ n("p", { className: "mt-0.5 text-[11px] text-slate-500", "data-task-rule": !0, children: [
793
809
  "Closes itself when ",
794
- Xe(p, I)
810
+ Xe(p, H)
795
811
  ] }),
796
- D && /* @__PURE__ */ t(
812
+ I && /* @__PURE__ */ t(
797
813
  "button",
798
814
  {
799
815
  type: "button",
800
- onClick: () => le.mutate(e.id),
801
- disabled: le.isPending,
816
+ onClick: () => ie.mutate(e.id),
817
+ disabled: ie.isPending,
802
818
  className: "mt-1 rounded border border-slate-200 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-muted dark:border-border dark:text-slate-300",
803
819
  "data-task-claim": e.id,
804
820
  children: "Pick it up"
805
821
  }
806
822
  )
807
823
  ] }),
808
- oe(e, !1)
824
+ de(e, !1)
809
825
  ] }),
810
- C === e.id && /* @__PURE__ */ t("div", { className: "mt-2 pl-6", children: /* @__PURE__ */ t(
811
- pe,
826
+ P === e.id && /* @__PURE__ */ t("div", { className: "mt-2 pl-6", children: /* @__PURE__ */ t(
827
+ he,
812
828
  {
813
829
  collection: a,
814
- item: i,
830
+ item: o,
815
831
  initial: nt(e),
816
832
  submitLabel: "Save changes",
817
- busy: H.isPending,
833
+ busy: B.isPending,
818
834
  allowTeam: !1,
819
835
  allowAgent: !0,
820
836
  onCancel: () => l(null),
821
- onSubmit: (S) => {
822
- const U = ae(S), B = {
823
- title: U.title,
824
- description: U.description,
825
- due_date: U.due_date,
826
- priority: U.priority,
827
- done_when: U.done_when
837
+ onSubmit: ($) => {
838
+ const O = E($), V = {
839
+ title: O.title,
840
+ description: O.description,
841
+ due_date: O.due_date,
842
+ priority: O.priority,
843
+ done_when: O.done_when
828
844
  };
829
- S.mode === "agent" ? S.agent && S.agent !== e.agent_assignee && (B.agent = S.agent) : S.mode === "person" && ($(S.assignee, e.assignee) ? e.agent_assignee && (B.agent = null) : B.assignee = S.assignee), H.mutate({ id: e.id, body: B });
845
+ $.mode === "agent" ? $.agent && $.agent !== e.agent_assignee && (V.agent = $.agent) : $.mode === "person" && (q($.assignee, e.assignee) ? e.agent_assignee && (V.agent = null) : V.assignee = $.assignee), B.mutate({ id: e.id, body: V });
830
846
  }
831
847
  }
832
848
  ) }),
833
- g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(he, { taskId: e.id }) })
849
+ g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(ge, { taskId: e.id }) })
834
850
  ] }, e.id);
835
851
  }) }),
836
- !_ && /* @__PURE__ */ n(
852
+ !N && /* @__PURE__ */ n(
837
853
  "button",
838
854
  {
839
855
  type: "button",
840
- onClick: () => y(!0),
856
+ onClick: () => _(!0),
841
857
  className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-nvr-cyan",
842
858
  "data-task-add": !0,
843
859
  children: [
@@ -846,21 +862,21 @@ function vt({
846
862
  ]
847
863
  }
848
864
  ),
849
- _ && /* @__PURE__ */ t(
850
- pe,
865
+ N && /* @__PURE__ */ t(
866
+ he,
851
867
  {
852
868
  collection: a,
853
- item: i,
869
+ item: o,
854
870
  initial: at(),
855
- submitLabel: s ? "Queue task" : "Create task",
856
- busy: ne.isPending,
871
+ submitLabel: y ? "Queue task" : "Create task",
872
+ busy: se.isPending,
857
873
  allowTeam: !0,
858
- allowAgent: !s,
859
- onCancel: () => y(!1),
860
- onSubmit: (e) => s ? Te(e) : ne.mutate(e)
874
+ allowAgent: !y,
875
+ onCancel: () => _(!1),
876
+ onSubmit: (e) => y ? Te(e) : se.mutate(e)
861
877
  }
862
878
  ),
863
- !s && J.length > 0 && /* @__PURE__ */ n("div", { children: [
879
+ !y && X.length > 0 && /* @__PURE__ */ n("div", { children: [
864
880
  /* @__PURE__ */ n(
865
881
  "button",
866
882
  {
@@ -869,24 +885,24 @@ function vt({
869
885
  className: "flex items-center gap-1 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
870
886
  children: [
871
887
  /* @__PURE__ */ t(
872
- de,
888
+ ce,
873
889
  {
874
- className: R(
890
+ className: U(
875
891
  "h-3.5 w-3.5 transition-transform",
876
- E && "rotate-180"
892
+ R && "rotate-180"
877
893
  )
878
894
  }
879
895
  ),
880
896
  "Completed (",
881
- J.length,
897
+ X.length,
882
898
  ")"
883
899
  ]
884
900
  }
885
901
  ),
886
- E && /* @__PURE__ */ t("div", { className: "mt-1 divide-y divide-slate-100 dark:divide-border/60", children: J.map((e) => /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
902
+ R && /* @__PURE__ */ t("div", { className: "mt-1 divide-y divide-slate-100 dark:divide-border/60", children: X.map((e) => /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
887
903
  /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5", children: [
888
904
  /* @__PURE__ */ t(
889
- me,
905
+ ue,
890
906
  {
891
907
  className: "mt-0.5 opacity-60",
892
908
  checked: !0,
@@ -896,11 +912,11 @@ function vt({
896
912
  ),
897
913
  /* @__PURE__ */ n("div", { className: "min-w-0 flex-1 opacity-70", children: [
898
914
  /* @__PURE__ */ t("p", { className: "text-[13px] text-slate-600 line-through dark:text-slate-400", children: e.title }),
899
- ie(e, !0)
915
+ oe(e, !0)
900
916
  ] }),
901
- oe(e, !0)
917
+ de(e, !0)
902
918
  ] }),
903
- g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(he, { taskId: e.id }) })
919
+ g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(ge, { taskId: e.id }) })
904
920
  ] }, e.id)) })
905
921
  ] })
906
922
  ] }) })