@nivaro/react 0.3.52 → 0.3.53

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 (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +3851 -3821
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +600 -549
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  14. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  15. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  16. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  17. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  18. package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
  19. package/dist/shared/components/item-edit/line-qty.js +115 -53
  20. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  21. package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
  22. package/dist/shared/components/panels/CommentPanel.js +204 -197
  23. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  24. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  25. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  26. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  27. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  28. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  29. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  30. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  31. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  32. package/dist/shared/lib/activity-sentence.js +236 -227
  33. package/dist/shared/lib/record-ref.js +43 -34
  34. package/package.json +1 -1
@@ -1,4 +1,11 @@
1
- const S = "a record you can't see", F = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, q = {
1
+ function L(e) {
2
+ const n = i(e.collection_label) || "related rows", t = i(e.row_label), r = t ? `${n} · ${t}` : n;
3
+ if (e.verb === "added") return `added ${r}`;
4
+ if (e.verb === "removed") return `removed ${r}`;
5
+ const o = (e.changes ?? []).filter((s) => s && i(s.label)).map((s) => `${i(s.label)} ${i(s.from) || "—"} → ${i(s.to) || "—"}`);
6
+ return o.length ? `changed ${r}: ${o.join(", ")}` : `changed ${r}`;
7
+ }
8
+ const S = "a record you can't see", Z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, P = {
2
9
  ai: "AI",
3
10
  api: "API",
4
11
  csv: "CSV",
@@ -22,33 +29,33 @@ const S = "a record you can't see", F = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0
22
29
  function i(e) {
23
30
  return e == null ? "" : String(e).trim();
24
31
  }
25
- function V(e) {
32
+ function G(e) {
26
33
  return i(e).toUpperCase();
27
34
  }
28
- function P(e) {
35
+ function O(e) {
29
36
  return e.split(/[\s_.:-]+/).map((n) => n.trim()).filter(Boolean);
30
37
  }
31
- function R(e) {
38
+ function q(e) {
32
39
  const n = e.toLowerCase();
33
- return q[n] ?? n;
40
+ return P[n] ?? n;
34
41
  }
35
- function Z(e) {
36
- const n = P(e).map(R).join(" ");
42
+ function Y(e) {
43
+ const n = O(e).map(q).join(" ");
37
44
  return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
38
45
  }
39
46
  function j(e) {
40
- return P(e).map((n) => q[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
47
+ return O(e).map((n) => P[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
41
48
  }
42
- function z(e) {
49
+ function E(e) {
43
50
  return /ies$/i.test(e) ? e.replace(/ies$/i, (n) => n === "IES" ? "Y" : "y") : /(ss|us|is)$/i.test(e) ? e : /(x|ch|sh|ss|us)es$/i.test(e) ? e.replace(/es$/i, "") : /s$/i.test(e) && e.length > 1 ? e.slice(0, -1) : e;
44
51
  }
45
- function L(e) {
52
+ function R(e) {
46
53
  return /[^aeiou]y$/i.test(e) ? e.replace(/y$/i, (n) => n === "Y" ? "IES" : "ies") : /(s|x|z|ch|sh)$/i.test(e) && !/^[A-Z0-9]+$/.test(e) ? `${e}es` : `${e}s`;
47
54
  }
48
55
  function g(e) {
49
56
  return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
50
57
  }
51
- const G = {
58
+ const H = {
52
59
  nivaro_activity: "Activity entry",
53
60
  nivaro_api_keys: "API key",
54
61
  nivaro_approval_chains: "Approval chain",
@@ -73,40 +80,40 @@ const G = {
73
80
  nivaro_webhooks: "Webhook",
74
81
  nivaro_workflow_templates: "Pipeline"
75
82
  };
76
- function b(e, n) {
83
+ function N(e, n) {
77
84
  var f;
78
85
  const t = i(e);
79
86
  if (!t) return { singular: "Record", plural: "Records" };
80
- const o = (f = n == null ? void 0 : n.collections) == null ? void 0 : f[t], r = typeof o == "string" ? { plural: o } : o ?? {}, s = i(r.plural), c = i(r.singular);
81
- if (c || s) {
82
- const $ = c || k(s, z), h = s && s !== $ ? s : k($, L);
87
+ const r = (f = n == null ? void 0 : n.collections) == null ? void 0 : f[t], o = typeof r == "string" ? { plural: r } : r ?? {}, s = i(o.plural), u = i(o.singular);
88
+ if (u || s) {
89
+ const $ = u || k(s, E), h = s && s !== $ ? s : k($, R);
83
90
  return { singular: $, plural: h };
84
91
  }
85
- const a = G[t];
86
- if (a) return { singular: a, plural: a === "Settings" ? a : k(a, L) };
87
- const u = j(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = k(u, z);
88
- return { singular: d, plural: k(d, L) };
92
+ const a = H[t];
93
+ if (a) return { singular: a, plural: a === "Settings" ? a : k(a, R) };
94
+ const c = j(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = k(c, E);
95
+ return { singular: d, plural: k(d, R) };
89
96
  }
90
97
  function k(e, n) {
91
98
  const t = e.split(" ");
92
99
  return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
93
100
  }
94
- function y(e, n, t) {
95
- const { singular: o, plural: r } = b(n, t);
96
- return `${e} ${g(e === 1 ? o : r)}`;
101
+ function b(e, n, t) {
102
+ const { singular: r, plural: o } = N(n, t);
103
+ return `${e} ${g(e === 1 ? r : o)}`;
97
104
  }
98
- function H(e, n) {
99
- const t = e.user ?? e.user_id ?? null, o = t ? C(t, n) : null;
100
- if (o) return o;
101
- const r = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
102
- return r || (i(e.user_email) ? i(e.user_email) : null);
105
+ function Q(e, n) {
106
+ const t = e.user ?? e.user_id ?? null, r = t ? C(t, n) : null;
107
+ if (r) return r;
108
+ const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
109
+ return o || (i(e.user_email) ? i(e.user_email) : null);
103
110
  }
104
111
  function C(e, n) {
105
112
  if (!e || !(n != null && n.users)) return null;
106
113
  const t = n.users;
107
- return i(t[e] ?? t[V(e)] ?? t[i(e).toLowerCase()]) || null;
114
+ return i(t[e] ?? t[G(e)] ?? t[i(e).toLowerCase()]) || null;
108
115
  }
109
- const Q = /* @__PURE__ */ new Set([
116
+ const X = /* @__PURE__ */ new Set([
110
117
  "person",
111
118
  "view_as",
112
119
  "api_key",
@@ -116,7 +123,7 @@ const Q = /* @__PURE__ */ new Set([
116
123
  "cron",
117
124
  "system"
118
125
  ]);
119
- function X(e) {
126
+ function ee(e) {
120
127
  if (e == null || e === "") return null;
121
128
  let n = e;
122
129
  if (typeof e == "string")
@@ -126,16 +133,16 @@ function X(e) {
126
133
  return null;
127
134
  }
128
135
  if (!n || typeof n != "object") return null;
129
- const t = n, o = i(t.kind);
130
- return Q.has(o) ? {
131
- kind: o,
136
+ const t = n, r = i(t.kind);
137
+ return X.has(r) ? {
138
+ kind: r,
132
139
  id: t.id == null ? null : String(t.id),
133
140
  name: t.name == null ? null : String(t.name),
134
141
  on_behalf_of: t.on_behalf_of == null ? null : String(t.on_behalf_of)
135
142
  } : null;
136
143
  }
137
- function O(e) {
138
- const n = X(e.actor);
144
+ function T(e) {
145
+ const n = ee(e.actor);
139
146
  if (n) return n;
140
147
  const t = e.user ?? e.user_id ?? null;
141
148
  if (i(e.mcp_conn) || i(e.via_app) || i(e.via_agent))
@@ -145,39 +152,39 @@ function O(e) {
145
152
  name: i(e.via_app) || i(e.via_agent) || null,
146
153
  on_behalf_of: t
147
154
  };
148
- const o = i(e.auth_method);
149
- if (o === "masquerade") return { kind: "view_as", id: null, name: null, on_behalf_of: t };
150
- if ((o === "api_key" || o === "key_sim") && e.api_key_id != null)
155
+ const r = i(e.auth_method);
156
+ if (r === "masquerade") return { kind: "view_as", id: null, name: null, on_behalf_of: t };
157
+ if ((r === "api_key" || r === "key_sim") && e.api_key_id != null)
151
158
  return {
152
159
  kind: "api_key",
153
160
  id: String(e.api_key_id),
154
161
  name: i(e.api_key_name) || null,
155
162
  on_behalf_of: t
156
163
  };
157
- const r = i(e.chain_parent), s = /^(cron|import_run|flow_run):(.+)$/.exec(r);
164
+ const o = i(e.chain_parent), s = /^(cron|import_run|flow_run):(.+)$/.exec(o);
158
165
  if (s) {
159
166
  const a = s[1] === "cron" ? "cron" : s[1] === "import_run" ? "import" : "flow";
160
167
  return { kind: a, id: s[2], name: a === "cron" ? s[2] : null, on_behalf_of: t };
161
168
  }
162
- const c = /^import:([^:]+)/i.exec(i(e.comment));
163
- return c ? { kind: "import", id: c[1], name: c[1], on_behalf_of: t } : i(e.origin) === "import" ? { kind: "import", id: null, name: null, on_behalf_of: t } : t ? { kind: "person", id: t, name: null, on_behalf_of: null } : {
169
+ const u = /^import:([^:]+)/i.exec(i(e.comment));
170
+ return u ? { kind: "import", id: u[1], name: u[1], on_behalf_of: t } : i(e.origin) === "import" ? { kind: "import", id: null, name: null, on_behalf_of: t } : t ? { kind: "person", id: t, name: null, on_behalf_of: null } : {
164
171
  kind: "system",
165
172
  id: null,
166
173
  name: i(e.origin) === "integration" ? "An integration" : null
167
174
  };
168
175
  }
169
- function Y(e, n) {
170
- const t = O(e), o = H(e, n), r = C(t.on_behalf_of, n) ?? o;
176
+ function B(e, n) {
177
+ const t = T(e), r = Q(e, n), o = C(t.on_behalf_of, n) ?? r;
171
178
  switch (t.kind) {
172
179
  case "person":
173
- return o ?? "Someone";
180
+ return r ?? "Someone";
174
181
  case "view_as":
175
- return `${(C(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${r ?? "someone"}`;
182
+ return `${(C(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
176
183
  case "api_key":
177
184
  return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
178
185
  case "mcp": {
179
186
  const s = i(t.name).replace(/^via\s+/i, "") || "An assistant";
180
- return r ? `${s} for ${r}` : s;
187
+ return o ? `${s} for ${o}` : s;
181
188
  }
182
189
  case "import":
183
190
  return i(t.name) ? `Import “${i(t.name)}”` : "An import";
@@ -190,80 +197,80 @@ function Y(e, n) {
190
197
  }
191
198
  }
192
199
  function I(e, n, t) {
193
- const o = i(n);
194
- if (!o || !i(e)) return null;
195
- const r = `${e}:${o}`, s = t == null ? void 0 : t.records, { singular: c } = b(e, t);
196
- if (s && r in s) {
197
- const a = s[r];
200
+ const r = i(n);
201
+ if (!r || !i(e)) return null;
202
+ const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: u } = N(e, t);
203
+ if (s && o in s) {
204
+ const a = s[o];
198
205
  if (a == null) return S;
199
- const u = i(a);
200
- return u ? u.toLowerCase().startsWith(c.toLowerCase()) ? u : `${c} ${u}` : c;
206
+ const c = i(a);
207
+ return c ? c.toLowerCase().startsWith(u.toLowerCase()) ? c : `${u} ${c}` : u;
201
208
  }
202
- return F.test(o) ? `a ${g(c)}` : `${c} ${o}`;
209
+ return Z.test(r) ? `a ${g(u)}` : `${u} ${r}`;
203
210
  }
204
- function T(e, n, t) {
205
- var r;
206
- const o = (r = t == null ? void 0 : t.fields) == null ? void 0 : r[`${e ?? ""}.${n}`];
207
- return i(o) || j(n);
211
+ function D(e, n, t) {
212
+ var o;
213
+ const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
214
+ return i(r) || j(n);
208
215
  }
209
- function N(e, n, t) {
210
- const o = [...new Set(n)].map((r) => T(e, r, t));
211
- return o.length === 0 ? "" : o.length === 1 ? o[0] : o.length <= 3 ? `${o.slice(0, -1).join(", ")} and ${o[o.length - 1]}` : `${o.slice(0, 2).join(", ")} and ${o.length - 2} other fields`;
216
+ function y(e, n, t) {
217
+ const r = [...new Set(n)].map((o) => D(e, o, t));
218
+ return r.length === 0 ? "" : r.length === 1 ? r[0] : r.length <= 3 ? `${r.slice(0, -1).join(", ")} and ${r[r.length - 1]}` : `${r.slice(0, 2).join(", ")} and ${r.length - 2} other fields`;
212
219
  }
213
- function ee(e) {
220
+ function ne(e) {
214
221
  const n = String(e ?? "");
215
222
  return n.startsWith("$t:") ? j(n.slice(3).replace(/-/g, "_")) : n;
216
223
  }
217
- const ne = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, te = /^\d{4}-\d{2}-\d{2}$/;
218
- function B(e, n, t, o) {
219
- var c, a;
224
+ const te = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, re = /^\d{4}-\d{2}-\d{2}$/;
225
+ function K(e, n, t, r) {
226
+ var u, a;
220
227
  if (t == null || t === "") return "empty";
221
228
  if (typeof t == "boolean") return t ? "Yes" : "No";
222
229
  if (typeof t == "object")
223
230
  return Array.isArray(t) ? `${t.length} items` : "a new value";
224
- const r = String(t), s = (a = (c = o == null ? void 0 : o.choices) == null ? void 0 : c[`${e ?? ""}.${n}`]) == null ? void 0 : a[r];
225
- if (s) return ee(s);
226
- if (te.test(r)) return r;
227
- if (ne.test(r)) {
228
- const u = new Date(r);
229
- if (!Number.isNaN(u.getTime()))
231
+ const o = String(t), s = (a = (u = r == null ? void 0 : r.choices) == null ? void 0 : u[`${e ?? ""}.${n}`]) == null ? void 0 : a[o];
232
+ if (s) return ne(s);
233
+ if (re.test(o)) return o;
234
+ if (te.test(o)) {
235
+ const c = new Date(o);
236
+ if (!Number.isNaN(c.getTime()))
230
237
  try {
231
- return u.toLocaleString(void 0, {
238
+ return c.toLocaleString(void 0, {
232
239
  dateStyle: "medium",
233
240
  timeStyle: "short",
234
- ...o != null && o.timeZone ? { timeZone: o.timeZone } : {}
241
+ ...r != null && r.timeZone ? { timeZone: r.timeZone } : {}
235
242
  });
236
243
  } catch {
237
- return u.toLocaleString();
244
+ return c.toLocaleString();
238
245
  }
239
246
  }
240
- return r.length > 60 ? `${r.slice(0, 57)}…` : r;
247
+ return o.length > 60 ? `${o.slice(0, 57)}…` : o;
241
248
  }
242
- function K(e, n, t, o) {
249
+ function J(e, n, t, r) {
243
250
  var s;
244
- const r = `${e ?? ""}.${n}`;
245
- return !(!(o != null && o.fields) || !(r in o.fields) || (s = o.links) != null && s[r] || t != null && typeof t == "object");
251
+ const o = `${e ?? ""}.${n}`;
252
+ return !(!(r != null && r.fields) || !(o in r.fields) || (s = r.links) != null && s[o] || t != null && typeof t == "object");
246
253
  }
247
- function D(e) {
254
+ function M(e) {
248
255
  var n, t;
249
- return (n = e.changes) != null && n.length ? e.changes.map((o) => o.field) : (t = e.changed_fields) != null && t.length ? e.changed_fields : e.delta && typeof e.delta == "object" ? Object.keys(e.delta) : [];
256
+ return (n = e.changes) != null && n.length ? e.changes.map((r) => r.field) : (t = e.changed_fields) != null && t.length ? e.changed_fields : e.delta && typeof e.delta == "object" ? Object.keys(e.delta) : [];
250
257
  }
251
- function M(e) {
258
+ function U(e) {
252
259
  const n = { from: null, to: null, via: null, note: null, auto: !1 };
253
260
  let t = i(e);
254
261
  if (!t) return n;
255
- const o = /^auto(?:-transition)?:?\s*"?([^"]*)"?$/i.exec(t);
256
- if (o)
257
- return n.auto = !0, n.via = i(o[1]) || null, n;
258
- const r = /\s+—\s+"([\s\S]*)"\s*$/.exec(t);
259
- r && (n.note = r[1], t = t.slice(0, r.index)), t = t.replace(/\s*\(bulk:[^)]*\)\s*$/i, "");
262
+ const r = /^auto(?:-transition)?:?\s*"?([^"]*)"?$/i.exec(t);
263
+ if (r)
264
+ return n.auto = !0, n.via = i(r[1]) || null, n;
265
+ const o = /\s+—\s+"([\s\S]*)"\s*$/.exec(t);
266
+ o && (n.note = o[1], t = t.slice(0, o.index)), t = t.replace(/\s*\(bulk:[^)]*\)\s*$/i, "");
260
267
  const s = /^bulk:\s*(.+?)\s*→\s*(.+)$/i.exec(t);
261
268
  if (s)
262
269
  return n.via = s[1], n.to = s[2], n;
263
- const c = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
264
- if (c) {
265
- const a = i(c[1]);
266
- n.from = a && a !== "Start" ? a : null, n.to = i(c[2]) || null, n.via = i(c[3]) || null;
270
+ const u = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
271
+ if (u) {
272
+ const a = i(u[1]);
273
+ n.from = a && a !== "Start" ? a : null, n.to = i(u[2]) || null, n.via = i(u[3]) || null;
267
274
  }
268
275
  return n;
269
276
  }
@@ -388,7 +395,7 @@ const x = {
388
395
  updated: "updated",
389
396
  upload: "uploaded",
390
397
  view: "viewed"
391
- }, re = /* @__PURE__ */ new Set([
398
+ }, oe = /* @__PURE__ */ new Set([
392
399
  "add",
393
400
  "build",
394
401
  "create",
@@ -403,72 +410,73 @@ const x = {
403
410
  "schedule",
404
411
  "upload"
405
412
  ]);
406
- function J(e) {
407
- const n = P(e).map((c) => c.toLowerCase());
413
+ function V(e) {
414
+ const n = O(e).map((u) => u.toLowerCase());
408
415
  if (n.length === 0) return { verb: null, past: null, noun: "" };
409
416
  const t = n[n.length - 1];
410
- let o = -1;
411
- if (x[t]) o = n.length - 1;
412
- else if (x[n[0]]) o = 0;
413
- else for (let c = n.length - 1; c >= 0; c--) x[n[c]] && (o = c);
414
- if (o < 0) return { verb: null, past: null, noun: n.map(R).join(" ") };
415
- const r = n[o], s = [...n.slice(0, o), ...n.slice(o + 1)];
416
- return { verb: r, past: x[r], noun: s.map(R).join(" ") };
417
- }
418
- function oe(e, n) {
419
- return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && re.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
420
- }
421
- function ie(e) {
417
+ let r = -1;
418
+ if (x[t]) r = n.length - 1;
419
+ else if (x[n[0]]) r = 0;
420
+ else for (let u = n.length - 1; u >= 0; u--) x[n[u]] && (r = u);
421
+ if (r < 0) return { verb: null, past: null, noun: n.map(q).join(" ") };
422
+ const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
423
+ return { verb: o, past: x[o], noun: s.map(q).join(" ") };
424
+ }
425
+ function ie(e, n) {
426
+ return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && oe.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
427
+ }
428
+ function se(e) {
422
429
  const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
423
430
  return {
424
431
  rows: n ? Number(n[1].replace(/,/g, "")) : null,
425
- format: t ? q[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
432
+ format: t ? P[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
426
433
  };
427
434
  }
428
- const U = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
429
- function se(e, n) {
435
+ const z = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
436
+ function ae(e, n) {
430
437
  var $, h, v, m, _;
431
- const t = i(e.action), o = e.collection ?? null, r = I(o, e.item, n), s = b(o, n), c = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, a = i(e.comment), u = r ? ` on ${r}` : "";
438
+ const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s = N(r, n), u = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, a = i(e.comment), c = o ? ` on ${o}` : "";
432
439
  if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
433
440
  const l = i(e.event.to_label);
434
- return `started ${r ?? "the pipeline"}${l ? ` in ${l}` : ""}`;
441
+ return `started ${o ?? "the pipeline"}${l ? ` in ${l}` : ""}`;
435
442
  }
436
- if (((h = e.event) == null ? void 0 : h.kind) === "transition" || U.has(t)) {
443
+ if (((h = e.event) == null ? void 0 : h.kind) === "transition" || z.has(t)) {
437
444
  const l = e.event ? {
438
445
  from: i(e.event.from_label) || null,
439
446
  to: i(e.event.to_label) || null,
440
447
  via: i(e.event.transition_label) || null
441
- } : M(a), p = (v = e.event) != null && v.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : r ?? "a record";
448
+ } : U(a), p = (v = e.event) != null && v.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
442
449
  return l.from && l.to ? `moved ${p} from ${l.from} to ${l.to}` : l.to ? `moved ${p} to ${l.to}` : l.via ? `ran “${l.via}” on ${p}` : `moved ${p}`;
443
450
  }
444
451
  switch (t) {
445
452
  case "create":
446
453
  case "o2m-create":
447
- return t === "o2m-create" ? `added related rows${u}` : o === "nivaro_settings" ? "saved the settings" : `created ${r ?? c}`;
454
+ return t === "o2m-create" ? e.o2m ? `${L(e.o2m)}${c}` : `added related rows${c}` : r === "nivaro_settings" ? "saved the settings" : `created ${o ?? u}`;
448
455
  case "update":
449
456
  case "o2m-update": {
450
- if (t === "o2m-update") return `changed related rows${u}`;
451
- const l = D(e);
452
- if (o === "nivaro_settings")
453
- return l.length ? `changed the ${N(o, l, n)} setting${l.length === 1 ? "" : "s"}` : "changed the settings";
454
- if (o === "nivaro_approval_instances" && ((m = e.why) != null && m.approval)) {
457
+ if (t === "o2m-update")
458
+ return e.o2m ? `${L(e.o2m)}${c}` : `changed related rows${c}`;
459
+ const l = M(e);
460
+ if (r === "nivaro_settings")
461
+ return l.length ? `changed the ${y(r, l, n)} setting${l.length === 1 ? "" : "s"}` : "changed the settings";
462
+ if (r === "nivaro_approval_instances" && ((m = e.why) != null && m.approval)) {
455
463
  const p = e.why.approval, A = I(p.collection, p.item, n);
456
- return `${(x[i(p.decision).toLowerCase()] ?? i(p.decision).toLowerCase()) || "decided on"} ${A ?? r ?? "an approval"}${p.chain ? ` (${p.chain})` : ""}`;
464
+ return `${(x[i(p.decision).toLowerCase()] ?? i(p.decision).toLowerCase()) || "decided on"} ${A ?? o ?? "an approval"}${p.chain ? ` (${p.chain})` : ""}`;
457
465
  }
458
466
  if (l.length) {
459
467
  const p = ((_ = e.changes) == null ? void 0 : _.length) === 1 ? e.changes[0] : null;
460
- return p && "value" in p && K(o, p.field, p.value, n) ? `set ${T(o, p.field, n)} to ${B(o, p.field, p.value, n)}${u}` : `changed ${N(o, l, n)}${u}`;
468
+ return p && "value" in p && J(r, p.field, p.value, n) ? `set ${D(r, p.field, n)} to ${K(r, p.field, p.value, n)}${c}` : `changed ${y(r, l, n)}${c}`;
461
469
  }
462
- return `updated ${r ?? c}`;
470
+ return `updated ${o ?? u}`;
463
471
  }
464
472
  case "delete":
465
473
  case "o2m-delete":
466
- return t === "o2m-delete" ? `removed related rows${u}` : `deleted ${r ?? c}`;
474
+ return t === "o2m-delete" ? e.o2m ? `${L(e.o2m)}${c}` : `removed related rows${c}` : `deleted ${o ?? u}`;
467
475
  case "restore":
468
- return `restored ${r ?? c}`;
476
+ return `restored ${o ?? u}`;
469
477
  case "pipeline-start": {
470
478
  const l = /initial state:\s*(.+)$/i.exec(a);
471
- return `started ${r ?? "the pipeline"}${l ? ` in ${l[1]}` : ""}`;
479
+ return `started ${o ?? "the pipeline"}${l ? ` in ${l[1]}` : ""}`;
472
480
  }
473
481
  case "login":
474
482
  return "signed in";
@@ -477,8 +485,8 @@ function se(e, n) {
477
485
  case "login-refused":
478
486
  return "was refused sign-in";
479
487
  case "export": {
480
- const l = ie(a);
481
- return `exported ${l.rows != null ? y(l.rows, o, n) : g(s.plural)}${l.format ? ` to ${l.format}` : ""}`;
488
+ const l = se(a);
489
+ return `exported ${l.rows != null ? b(l.rows, r, n) : g(s.plural)}${l.format ? ` to ${l.format}` : ""}`;
482
490
  }
483
491
  case "masquerade-start":
484
492
  return `started viewing as ${w(e, n, a)}`;
@@ -489,18 +497,18 @@ function se(e, n) {
489
497
  case "token.revoke":
490
498
  return `revoked the static token of ${w(e, n, "")}`;
491
499
  case "api_key_created":
492
- return `created ${r && r !== S ? r : "an API key"}`;
500
+ return `created ${o && o !== S ? o : "an API key"}`;
493
501
  case "api_key_revoked":
494
- return `revoked ${r && r !== S ? r : "an API key"}`;
502
+ return `revoked ${o && o !== S ? o : "an API key"}`;
495
503
  case "api_key_deleted":
496
- return `deleted ${r && r !== S ? r : "an API key"}`;
504
+ return `deleted ${o && o !== S ? o : "an API key"}`;
497
505
  case "api_key_simulate":
498
- return `tested requests as ${r && r !== S ? r : "an API key"}`;
506
+ return `tested requests as ${o && o !== S ? o : "an API key"}`;
499
507
  case "set_role":
500
508
  return `changed the role of ${w(e, n, "")}`;
501
509
  case "bulk-write":
502
510
  case "bulk-action-execute": {
503
- const l = /(\d+)\s+(?:item|row)/i.exec(a), p = l ? y(Number(l[1]), o, n) : g(s.plural), A = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(a) : null;
511
+ const l = /(\d+)\s+(?:item|row)/i.exec(a), p = l ? b(Number(l[1]), r, n) : g(s.plural), A = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(a) : null;
504
512
  return A ? `ran “${A[1]}” on ${p}` : `changed ${p} in bulk`;
505
513
  }
506
514
  case "import-create":
@@ -511,11 +519,11 @@ function se(e, n) {
511
519
  case "import-failed":
512
520
  return `had an import into ${g(s.plural)} fail`;
513
521
  case "comment":
514
- return `commented${u}`;
522
+ return `commented${c}`;
515
523
  case "picker-exclude":
516
- return `hid ${r ?? c} from pickers`;
524
+ return `hid ${o ?? u} from pickers`;
517
525
  case "picker-include":
518
- return `showed ${r ?? c} in pickers again`;
526
+ return `showed ${o ?? u} in pickers again`;
519
527
  case "ai-brief":
520
528
  return "asked the assistant for a brief";
521
529
  case "config-epoch":
@@ -525,146 +533,147 @@ function se(e, n) {
525
533
  case "config-snapshot-export":
526
534
  return "downloaded a configuration snapshot";
527
535
  }
528
- if (!t) return `did something${u}`;
529
- const d = J(t);
530
- return /settings$/.test(d.noun) && !d.verb ? `changed the ${d.noun}` : d.past ? r && d.noun && g(s.singular).toLowerCase().includes(d.noun.toLowerCase()) ? `${d.past} ${r}` : d.noun ? `${d.past} ${oe(d.verb, d.noun)}${u}` : `${d.past} ${r ?? "something"}` : `recorded “${Z(t)}”${u}`;
536
+ if (!t) return `did something${c}`;
537
+ const d = V(t);
538
+ return /settings$/.test(d.noun) && !d.verb ? `changed the ${d.noun}` : d.past ? o && d.noun && g(s.singular).toLowerCase().includes(d.noun.toLowerCase()) ? `${d.past} ${o}` : d.noun ? `${d.past} ${ie(d.verb, d.noun)}${c}` : `${d.past} ${o ?? "something"}` : `recorded “${Y(t)}”${c}`;
531
539
  }
532
540
  function w(e, n, t) {
533
- const o = i(e.item), r = C(o, n) ?? (t || null);
534
- if (r) return r;
541
+ const r = i(e.item), o = C(r, n) ?? (t || null);
542
+ if (o) return o;
535
543
  const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
536
- return s && !F.test(o) ? s : "someone";
544
+ return s && !Z.test(r) ? s : "someone";
537
545
  }
538
- function ae(e, n) {
539
- return `${Y(e, n)} ${se(e, n)}`;
546
+ function ce(e, n) {
547
+ return `${B(e, n)} ${ae(e, n)}`;
540
548
  }
541
- function pe(e) {
542
- var a, u, d, f;
549
+ function fe(e) {
550
+ var a, c, d, f;
543
551
  const n = i(e.action), t = i(e.comment);
544
- let o = i((a = e.why) == null ? void 0 : a.reason) || null, r = i((u = e.why) == null ? void 0 : u.note) || null;
545
- !r && U.has(n) && !e.event && (r = M(t).note), !r && ((d = e.event) == null ? void 0 : d.kind) === "transition" && t && (r = t), !o && (n === "create" || n === "update" || n === "delete") && t && !/^import:/i.test(t) && (o = t);
546
- const s = (f = e.why) == null ? void 0 : f.approval, c = s ? `${j(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
547
- return { reason: o, note: r, approval: c };
552
+ let r = i((a = e.why) == null ? void 0 : a.reason) || null, o = i((c = e.why) == null ? void 0 : c.note) || null;
553
+ !o && z.has(n) && !e.event && (o = U(t).note), !o && ((d = e.event) == null ? void 0 : d.kind) === "transition" && t && (o = t), !r && (n === "create" || n === "update" || n === "delete") && t && !/^import:/i.test(t) && (r = t);
554
+ const s = (f = e.why) == null ? void 0 : f.approval, u = s ? `${j(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
555
+ return { reason: r, note: o, approval: u };
548
556
  }
549
- const ce = 6e4;
550
- function E(e) {
557
+ const ue = 6e4;
558
+ function W(e) {
551
559
  return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
552
560
  }
553
- function W(e) {
554
- const n = O(e);
561
+ function F(e) {
562
+ const n = T(e);
555
563
  return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
556
564
  }
557
- function ue(e) {
565
+ function de(e) {
558
566
  const n = i(e.action);
559
567
  return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
560
568
  }
561
- function fe(e, n = {}) {
562
- const t = n.windowMs ?? ce, o = [];
563
- for (const r of e) {
564
- const s = o[o.length - 1], c = s == null ? void 0 : s.entries[s.entries.length - 1], a = i(r.group_key);
565
- if (s && c) {
566
- const u = i(c.group_key);
567
- if (a && a === u) {
568
- s.entries.push(r), s.by = "group_key";
569
+ function me(e, n = {}) {
570
+ const t = n.windowMs ?? ue, r = [];
571
+ for (const o of e) {
572
+ const s = r[r.length - 1], u = s == null ? void 0 : s.entries[s.entries.length - 1], a = i(o.group_key);
573
+ if (s && u) {
574
+ const c = i(u.group_key);
575
+ if (a && a === c) {
576
+ s.entries.push(o), s.by = "group_key";
569
577
  continue;
570
578
  }
571
- if (!a && !u && s.by !== "group_key" && i(r.action) === i(c.action) && i(r.collection) === i(c.collection) && i(r.collection) !== "" && W(r) === W(c) && Math.abs(E(c) - E(r)) <= t) {
572
- s.entries.push(r), s.by = "time";
579
+ if (!a && !c && s.by !== "group_key" && i(o.action) === i(u.action) && i(o.collection) === i(u.collection) && i(o.collection) !== "" && F(o) === F(u) && Math.abs(W(u) - W(o)) <= t) {
580
+ s.entries.push(o), s.by = "time";
573
581
  continue;
574
582
  }
575
583
  }
576
- o.push({ key: `${a || "e"}:${r.id ?? o.length}`, entries: [r], by: null });
584
+ r.push({ key: `${a || "e"}:${o.id ?? r.length}`, entries: [o], by: null });
577
585
  }
578
- return o;
586
+ return r;
579
587
  }
580
- function me(e, n) {
588
+ function $e(e, n) {
581
589
  if (e.length === 0) return "";
582
- const t = e.filter((m) => !ue(m)), o = t[0] ?? e[0];
583
- if (t.length <= 1) return ae(o, n);
584
- const r = Y(o, n), c = new Set(t.map((m) => i(m.collection))).size === 1 ? o.collection ?? null : null, a = new Set(t.map((m) => i(m.item))), u = a.size > 1 ? a.size : t.length, d = c ? a.size === 1 && i(o.item) ? I(c, o.item, n) ?? y(u, c, n) : y(u, c, n) : `${u} records`, f = a.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
585
- t.map((m) => U.has(i(m.action)) ? "transition" : i(m.action))
590
+ const t = e.filter((m) => !de(m)), r = t[0] ?? e[0];
591
+ if (t.length <= 1) return ce(r, n);
592
+ const o = B(r, n), u = new Set(t.map((m) => i(m.collection))).size === 1 ? r.collection ?? null : null, a = new Set(t.map((m) => i(m.item))), c = a.size > 1 ? a.size : t.length, d = u ? a.size === 1 && i(r.item) ? I(u, r.item, n) ?? b(c, u, n) : b(c, u, n) : `${c} records`, f = a.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
593
+ t.map((m) => z.has(i(m.action)) ? "transition" : i(m.action))
586
594
  );
587
- if ($.size !== 1) return `${r} made ${t.length} changes to ${d}`;
595
+ if ($.size !== 1) return `${o} made ${t.length} changes to ${d}`;
588
596
  const h = [...$][0];
589
597
  if (h === "transition") {
590
598
  const m = new Set(
591
599
  t.map((l) => {
592
600
  var p;
593
- return i(((p = l.event) == null ? void 0 : p.to_label) ?? M(l.comment).to);
601
+ return i(((p = l.event) == null ? void 0 : p.to_label) ?? U(l.comment).to);
594
602
  })
595
603
  ), _ = m.size === 1 ? [...m][0] : "";
596
- return `${r} moved ${d}${_ ? ` to ${_}` : ""}${f}`;
604
+ return `${o} moved ${d}${_ ? ` to ${_}` : ""}${f}`;
597
605
  }
598
606
  if (h === "update") {
599
- const m = de(t, c, n);
600
- return `${r} updated ${d}${f}${m ? `: ${m}` : ""}`;
607
+ const m = le(t, u, n);
608
+ return `${o} updated ${d}${f}${m ? `: ${m}` : ""}`;
601
609
  }
602
- if (h === "create") return `${r} created ${d}`;
603
- if (h === "delete") return `${r} deleted ${d}`;
604
- if (h === "picker-exclude") return `${r} hid ${d} from pickers${f}`;
605
- if (h === "picker-include") return `${r} showed ${d} in pickers again${f}`;
606
- const v = J(h);
607
- return v.past ? `${r} ${v.past} ${d}${v.noun && !g(b(c, n).plural).toLowerCase().includes(v.noun) ? ` (${v.noun})` : ""}${f}` : `${r} recorded “${Z(h)}” on ${d}`;
608
- }
609
- function de(e, n, t) {
610
+ if (h === "create") return `${o} created ${d}`;
611
+ if (h === "delete") return `${o} deleted ${d}`;
612
+ if (h === "picker-exclude") return `${o} hid ${d} from pickers${f}`;
613
+ if (h === "picker-include") return `${o} showed ${d} in pickers again${f}`;
614
+ const v = V(h);
615
+ return v.past ? `${o} ${v.past} ${d}${v.noun && !g(N(u, n).plural).toLowerCase().includes(v.noun) ? ` (${v.noun})` : ""}${f}` : `${o} recorded “${Y(h)}” on ${d}`;
616
+ }
617
+ function le(e, n, t) {
610
618
  var a;
611
- const o = ((a = e[0]) == null ? void 0 : a.changes) ?? null;
612
- if (!(o != null && o.length)) {
613
- const u = e.map((d) => D(d).sort().join(","));
614
- return u[0] && u.every((d) => d === u[0]) ? N(n, u[0].split(","), t) : "";
619
+ const r = ((a = e[0]) == null ? void 0 : a.changes) ?? null;
620
+ if (!(r != null && r.length)) {
621
+ const c = e.map((d) => M(d).sort().join(","));
622
+ return c[0] && c.every((d) => d === c[0]) ? y(n, c[0].split(","), t) : "";
615
623
  }
616
- const r = (u) => JSON.stringify((u.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
617
- if (e.every((u) => r(u) === r(e[0])) && o.length <= 2 && o.every((u) => K(n, u.field, u.value, t)))
618
- return o.map(
619
- (u) => `${T(n, u.field, t)} → ${B(n, u.field, u.value, t)}`
624
+ const o = (c) => JSON.stringify((c.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
625
+ if (e.every((c) => o(c) === o(e[0])) && r.length <= 2 && r.every((c) => J(n, c.field, c.value, t)))
626
+ return r.map(
627
+ (c) => `${D(n, c.field, t)} → ${K(n, c.field, c.value, t)}`
620
628
  ).join(", ");
621
- const c = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
622
- return N(n, [...c], t);
623
- }
624
- function $e(e) {
625
- var c;
626
- const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), s = (a, u) => {
627
- const d = i(a), f = i(u);
628
- !d || !f || (r.add(d), d === "nivaro_users" && t.add(f), n.set(`${d}:${f}`, { collection: d, id: f }));
629
+ const u = new Set(e.flatMap((c) => (c.changes ?? []).map((d) => d.field)));
630
+ return y(n, [...u], t);
631
+ }
632
+ function he(e) {
633
+ var u;
634
+ const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (a, c) => {
635
+ const d = i(a), f = i(c);
636
+ !d || !f || (o.add(d), d === "nivaro_users" && t.add(f), n.set(`${d}:${f}`, { collection: d, id: f }));
629
637
  };
630
638
  for (const a of e) {
631
- const u = i(a.user ?? a.user_id);
632
- u && t.add(u);
633
- const d = O(a);
634
- d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(a.collection) && r.add(i(a.collection)), s(a.collection, a.item), (c = a.why) != null && c.approval && s(a.why.approval.collection, a.why.approval.item);
635
- for (const f of D(a)) {
639
+ const c = i(a.user ?? a.user_id);
640
+ c && t.add(c);
641
+ const d = T(a);
642
+ d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(a.collection) && o.add(i(a.collection)), s(a.collection, a.item), (u = a.why) != null && u.approval && s(a.why.approval.collection, a.why.approval.item);
643
+ for (const f of M(a)) {
636
644
  const $ = i(a.collection);
637
- $ && o.set(`${$}.${f}`, { collection: $, field: f });
645
+ $ && r.set(`${$}.${f}`, { collection: $, field: f });
638
646
  }
639
647
  }
640
648
  return {
641
649
  refs: [...n.values()],
642
650
  users: [...t],
643
- fields: [...o.values()],
644
- collections: [...r]
651
+ fields: [...r.values()],
652
+ collections: [...o]
645
653
  };
646
654
  }
647
655
  export {
648
- ce as BURST_WINDOW_MS,
656
+ ue as BURST_WINDOW_MS,
649
657
  S as HIDDEN_RECORD,
650
- J as actionParts,
651
- $e as activityLabelRefs,
652
- se as activityPredicate,
653
- pe as activityWhy,
654
- Y as actorName,
655
- O as actorOf,
656
- ee as choiceText,
657
- b as collectionNouns,
658
- y as countNoun,
659
- T as fieldLabel,
660
- N as fieldList,
661
- fe as groupActivity,
662
- X as parseActor,
663
- M as parseTransitionComment,
664
- Z as readableTitle,
658
+ V as actionParts,
659
+ he as activityLabelRefs,
660
+ ae as activityPredicate,
661
+ fe as activityWhy,
662
+ B as actorName,
663
+ T as actorOf,
664
+ ne as choiceText,
665
+ N as collectionNouns,
666
+ b as countNoun,
667
+ D as fieldLabel,
668
+ y as fieldList,
669
+ me as groupActivity,
670
+ L as o2mSentence,
671
+ ee as parseActor,
672
+ U as parseTransitionComment,
673
+ Y as readableTitle,
665
674
  I as recordPhrase,
666
- me as renderActivityGroupSentence,
667
- ae as renderActivitySentence,
668
- K as valueShowable,
669
- B as valueText
675
+ $e as renderActivityGroupSentence,
676
+ ce as renderActivitySentence,
677
+ J as valueShowable,
678
+ K as valueText
670
679
  };