@nivaro/react 0.3.138 → 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 (88) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +36 -2
  5. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  6. package/dist/shared/components/BroadcastView.js +213 -211
  7. package/dist/shared/components/CollectionBrowserView.js +2677 -2658
  8. package/dist/shared/components/ConfigHistory.js +45 -45
  9. package/dist/shared/components/ConformanceView.js +110 -110
  10. package/dist/shared/components/DataTable.js +51 -51
  11. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  12. package/dist/shared/components/ItemEditForm.js +3038 -3027
  13. package/dist/shared/components/LiveCount.js +27 -23
  14. package/dist/shared/components/LiveTraceView.js +62 -61
  15. package/dist/shared/components/PageRenderer.js +422 -410
  16. package/dist/shared/components/ProfileView.js +199 -199
  17. package/dist/shared/components/QualityRulesView.js +70 -70
  18. package/dist/shared/components/QueryTable.js +131 -130
  19. package/dist/shared/components/RecordGraph.js +98 -98
  20. package/dist/shared/components/RecordReadView.js +287 -288
  21. package/dist/shared/components/ReportView.js +1279 -1259
  22. package/dist/shared/components/SlaRulesView.js +73 -74
  23. package/dist/shared/components/WidgetSlot.js +73 -73
  24. package/dist/shared/components/ai/AiChart.js +36 -32
  25. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  26. package/dist/shared/components/ai/TaskDo.js +87 -87
  27. package/dist/shared/components/ai/answer-formats.js +37 -30
  28. package/dist/shared/components/ai/call-log/format.js +17 -16
  29. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  30. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  31. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  32. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  33. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  34. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  35. package/dist/shared/components/cbv/column-totals.js +53 -51
  36. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  37. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  38. package/dist/shared/components/command-center/announce.js +7 -6
  39. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  40. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  41. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  42. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  43. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  44. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  45. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  46. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  47. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  48. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  49. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  50. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  51. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  52. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  53. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  54. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  55. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  56. package/dist/shared/components/item-edit/InlineTableField.js +1167 -1153
  57. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  58. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  59. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  60. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  61. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  62. package/dist/shared/components/ops-report/format.js +37 -36
  63. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  64. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  65. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  66. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  67. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  68. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  69. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  70. package/dist/shared/components/profile/DelegationCard.js +13 -12
  71. package/dist/shared/components/profile/PersonActivity.js +48 -48
  72. package/dist/shared/components/profile/PersonExtras.js +107 -107
  73. package/dist/shared/components/profile/PersonWeek.js +9 -9
  74. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  75. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  76. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  77. package/dist/shared/components/queue/QueueWorklist.js +671 -670
  78. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  79. package/dist/shared/components/support/RequestList.js +121 -121
  80. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  81. package/dist/shared/lib/activity-sentence.js +316 -278
  82. package/dist/shared/lib/format-value.js +5 -4
  83. package/dist/shared/lib/number-format.js +87 -0
  84. package/dist/shared/lib/number-kind.js +133 -0
  85. package/dist/shared/lib/utils.js +24 -20
  86. package/dist/shared/lib/watch-list.js +1 -1
  87. package/dist/shared/lib/widget-value-format.js +26 -12
  88. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
1
  function M(e) {
2
- const n = i(e.collection_label) || "related rows", t = i(e.row_label), r = t ? `${n} · ${t}` : n;
2
+ const n = s(e.collection_label) || "related rows", t = s(e.row_label), r = t ? `${n} · ${t}` : n;
3
3
  if (e.verb === "added") return `added ${r}`;
4
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) || "—"}`);
5
+ const o = (e.changes ?? []).filter((i) => i && s(i.label)).map((i) => `${s(i.label)} ${s(i.from) || "—"} → ${s(i.to) || "—"}`);
6
6
  return o.length ? `changed ${r}: ${o.join(", ")}` : `changed ${r}`;
7
7
  }
8
- function Ce(e) {
9
- return (e.totals ?? []).filter((n) => n && i(n.label) && Number.isFinite(n.delta) && n.delta !== 0).map(
10
- (n) => `${i(n.label)} ${n.delta > 0 ? "+" : "−"}${Math.abs(n.delta).toLocaleString("en-US", { maximumFractionDigits: 2 })}`
8
+ function Te(e) {
9
+ return (e.totals ?? []).filter((n) => n && s(n.label) && Number.isFinite(n.delta) && n.delta !== 0).map(
10
+ (n) => `${s(n.label)} ${n.delta > 0 ? "+" : "−"}${Math.abs(n.delta).toLocaleString("en-US", { maximumFractionDigits: 2 })}`
11
11
  ).join(", ");
12
12
  }
13
- const k = "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, W = {
13
+ const k = "a record you can't see", U = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, F = {
14
14
  ai: "AI",
15
15
  api: "API",
16
16
  csv: "CSV",
@@ -31,36 +31,36 @@ const k = "a record you can't see", z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0
31
31
  url: "URL",
32
32
  xlsx: "Excel"
33
33
  };
34
- function i(e) {
34
+ function s(e) {
35
35
  return e == null ? "" : String(e).trim();
36
36
  }
37
- function ie(e) {
38
- return i(e).toUpperCase();
37
+ function se(e) {
38
+ return s(e).toUpperCase();
39
39
  }
40
- function F(e) {
40
+ function W(e) {
41
41
  return e.split(/[\s_.:-]+/).map((n) => n.trim()).filter(Boolean);
42
42
  }
43
- function U(e) {
43
+ function z(e) {
44
44
  const n = e.toLowerCase();
45
- return W[n] ?? n;
45
+ return F[n] ?? n;
46
46
  }
47
- function G(e) {
48
- const n = F(e).map(U).join(" ");
47
+ function X(e) {
48
+ const n = W(e).map(z).join(" ");
49
49
  return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
50
50
  }
51
51
  function q(e) {
52
- return F(e).map((n) => W[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
52
+ return W(e).map((n) => F[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
53
53
  }
54
- function Q(e) {
54
+ function V(e) {
55
55
  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;
56
56
  }
57
- function D(e) {
57
+ function O(e) {
58
58
  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`;
59
59
  }
60
60
  function g(e) {
61
61
  return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
62
62
  }
63
- const se = {
63
+ const ae = {
64
64
  nivaro_activity: "Activity entry",
65
65
  nivaro_activity_views: "Activity view",
66
66
  nivaro_addendums: "Addendum",
@@ -126,45 +126,45 @@ const se = {
126
126
  nivaro_workflow_states: "Pipeline state",
127
127
  nivaro_workflow_templates: "Pipeline",
128
128
  nivaro_workflow_transitions: "Pipeline move"
129
- }, ae = /^(nivaro|directus)_/i;
130
- function C(e) {
129
+ }, ce = /^(nivaro|directus)_/i;
130
+ function N(e) {
131
131
  const n = g(e);
132
132
  return `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}`;
133
133
  }
134
- function N(e, n) {
134
+ function I(e, n) {
135
135
  var l;
136
- const t = i(e);
136
+ const t = s(e);
137
137
  if (!t) return { singular: "Record", plural: "Records" };
138
- const r = (l = n == null ? void 0 : n.collections) == null ? void 0 : l[t], o = typeof r == "string" ? { plural: r } : r ?? {}, s = i(o.plural), a = i(o.singular);
139
- if (a || s) {
140
- const f = a || y(s, Q), $ = s && s !== f ? s : y(f, D);
141
- return { singular: f, plural: $ };
138
+ const r = (l = n == null ? void 0 : n.collections) == null ? void 0 : l[t], o = typeof r == "string" ? { plural: r } : r ?? {}, i = s(o.plural), a = s(o.singular);
139
+ if (a || i) {
140
+ const p = a || x(i, V), $ = i && i !== p ? i : x(p, O);
141
+ return { singular: p, plural: $ };
142
142
  }
143
- const c = se[t];
144
- if (c) return { singular: c, plural: c === "Settings" ? c : y(c, D) };
145
- const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = y(u, Q);
146
- return { singular: d, plural: y(d, D) };
143
+ const c = ae[t];
144
+ if (c) return { singular: c, plural: c === "Settings" ? c : x(c, O) };
145
+ const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = x(u, V);
146
+ return { singular: d, plural: x(d, O) };
147
147
  }
148
- function y(e, n) {
148
+ function x(e, n) {
149
149
  const t = e.split(" ");
150
150
  return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
151
151
  }
152
152
  function L(e, n, t) {
153
- const { singular: r, plural: o } = N(n, t);
153
+ const { singular: r, plural: o } = I(n, t);
154
154
  return `${e} ${g(e === 1 ? r : o)}`;
155
155
  }
156
- function ce(e, n) {
157
- const t = e.user ?? e.user_id ?? null, r = t ? T(t, n) : null;
156
+ function ue(e, n) {
157
+ const t = e.user ?? e.user_id ?? null, r = t ? P(t, n) : null;
158
158
  if (r) return r;
159
- const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
160
- return o || (i(e.user_email) ? i(e.user_email) : null);
159
+ const o = [s(e.first_name), s(e.last_name)].filter(Boolean).join(" ");
160
+ return o || (s(e.user_email) ? s(e.user_email) : null);
161
161
  }
162
- function T(e, n) {
162
+ function P(e, n) {
163
163
  if (!e || !(n != null && n.users)) return null;
164
164
  const t = n.users;
165
- return i(t[e] ?? t[ie(e)] ?? t[i(e).toLowerCase()]) || null;
165
+ return s(t[e] ?? t[se(e)] ?? t[s(e).toLowerCase()]) || null;
166
166
  }
167
- const ue = /* @__PURE__ */ new Set([
167
+ const de = /* @__PURE__ */ new Set([
168
168
  "person",
169
169
  "view_as",
170
170
  "api_key",
@@ -174,7 +174,7 @@ const ue = /* @__PURE__ */ new Set([
174
174
  "cron",
175
175
  "system"
176
176
  ]);
177
- function de(e) {
177
+ function le(e) {
178
178
  if (e == null || e === "") return null;
179
179
  let n = e;
180
180
  if (typeof e == "string")
@@ -184,95 +184,111 @@ function de(e) {
184
184
  return null;
185
185
  }
186
186
  if (!n || typeof n != "object") return null;
187
- const t = n, r = i(t.kind);
188
- return ue.has(r) ? {
187
+ const t = n, r = s(t.kind);
188
+ return de.has(r) ? {
189
189
  kind: r,
190
190
  id: t.id == null ? null : String(t.id),
191
191
  name: t.name == null ? null : String(t.name),
192
192
  on_behalf_of: t.on_behalf_of == null ? null : String(t.on_behalf_of)
193
193
  } : null;
194
194
  }
195
- function Y(e) {
196
- const n = de(e.actor);
195
+ function Z(e) {
196
+ const n = le(e.actor);
197
197
  if (n) return n;
198
198
  const t = e.user ?? e.user_id ?? null;
199
- if (i(e.mcp_conn) || i(e.via_app) || i(e.via_agent))
199
+ if (s(e.mcp_conn) || s(e.via_app) || s(e.via_agent))
200
200
  return {
201
201
  kind: "mcp",
202
- id: i(e.mcp_conn) || null,
203
- name: i(e.via_app) || i(e.via_agent) || null,
202
+ id: s(e.mcp_conn) || null,
203
+ name: s(e.via_app) || s(e.via_agent) || null,
204
204
  on_behalf_of: t
205
205
  };
206
- const r = i(e.auth_method);
206
+ const r = s(e.auth_method);
207
207
  if (r === "masquerade") return { kind: "view_as", id: null, name: null, on_behalf_of: t };
208
208
  if ((r === "api_key" || r === "key_sim") && e.api_key_id != null)
209
209
  return {
210
210
  kind: "api_key",
211
211
  id: String(e.api_key_id),
212
- name: i(e.api_key_name) || null,
212
+ name: s(e.api_key_name) || null,
213
213
  on_behalf_of: t
214
214
  };
215
- const o = i(e.chain_parent), s = /^(cron|import_run|flow_run):(.+)$/.exec(o);
216
- if (s) {
217
- const c = s[1] === "cron" ? "cron" : s[1] === "import_run" ? "import" : "flow";
218
- return { kind: c, id: s[2], name: c === "cron" ? s[2] : null, on_behalf_of: t };
215
+ const o = s(e.chain_parent), i = /^(cron|import_run|flow_run):(.+)$/.exec(o);
216
+ if (i) {
217
+ const c = i[1] === "cron" ? "cron" : i[1] === "import_run" ? "import" : "flow";
218
+ return { kind: c, id: i[2], name: c === "cron" ? i[2] : null, on_behalf_of: t };
219
219
  }
220
- const a = /^import:([^:]+)/i.exec(i(e.comment));
221
- return a ? { kind: "import", id: a[1], name: a[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 } : {
220
+ const a = /^import:([^:]+)/i.exec(s(e.comment));
221
+ return a ? { kind: "import", id: a[1], name: a[1], on_behalf_of: t } : s(e.origin) === "import" ? { kind: "import", id: null, name: null, on_behalf_of: t } : t ? { kind: "person", id: t, name: null, on_behalf_of: null } : {
222
222
  kind: "system",
223
223
  id: null,
224
- name: i(e.origin) === "integration" ? "An integration" : null
224
+ name: s(e.origin) === "integration" ? "An integration" : null
225
225
  };
226
226
  }
227
- function H(e, n) {
228
- const t = Y(e), r = ce(e, n), o = T(t.on_behalf_of, n) ?? r;
227
+ function ee(e, n) {
228
+ const t = Z(e), r = ue(e, n), o = P(t.on_behalf_of, n) ?? r;
229
229
  switch (t.kind) {
230
230
  case "person":
231
231
  return r ?? "Someone";
232
232
  case "view_as":
233
- return `${(T(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
233
+ return `${(P(t.id, n) ?? s(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
234
234
  case "api_key":
235
- return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
235
+ return `API key “${s(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
236
236
  case "mcp": {
237
- const s = i(t.name).replace(/^via\s+/i, "") || "An assistant";
238
- return o ? `${s} for ${o}` : s;
237
+ const i = s(t.name).replace(/^via\s+/i, "") || "An assistant";
238
+ return o ? `${i} for ${o}` : i;
239
239
  }
240
240
  case "import":
241
- return i(t.name) ? `Import “${i(t.name)}”` : "An import";
241
+ return s(t.name) ? `Import “${s(t.name)}”` : "An import";
242
242
  case "flow":
243
- return i(t.name) ? `Flow “${i(t.name)}”` : "A flow";
243
+ return s(t.name) ? `Flow “${s(t.name)}”` : "A flow";
244
244
  case "cron":
245
- return i(t.name || t.id) ? `Scheduled job “${i(t.name || t.id)}”` : "A scheduled job";
245
+ return s(t.name || t.id) ? `Scheduled job “${s(t.name || t.id)}”` : "A scheduled job";
246
246
  default:
247
- return i(t.name) || "System";
247
+ return s(t.name) || "System";
248
248
  }
249
249
  }
250
- function I(e, n, t) {
251
- const r = i(n);
252
- if (!r || !i(e)) return null;
253
- const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: a } = N(e, t), c = ae.test(i(e));
254
- if (s && o in s) {
255
- const u = s[o];
256
- if (u == null) return c ? C(a) : k;
257
- const d = i(u);
258
- return d ? c && (d === r || z.test(d)) ? C(a) : d.toLowerCase().startsWith(a.toLowerCase()) ? d : `${a} ${d}` : c ? C(a) : a;
250
+ function T(e, n, t) {
251
+ var i;
252
+ const r = s(n);
253
+ if (!r || !s(e)) return null;
254
+ const o = (i = t == null ? void 0 : t.junctions) == null ? void 0 : i[`${e}:${r}`];
255
+ return o ? fe(o, t) : Y(e, r, t);
256
+ }
257
+ function pe(e, n) {
258
+ const t = s(e.parent_id);
259
+ if (!t) return !1;
260
+ const r = Y(e.parent_collection, t, n);
261
+ return !!r && r !== k;
262
+ }
263
+ function fe(e, n) {
264
+ const t = G(e, n), r = s(e.value);
265
+ return r ? `${e.noun} ${r} on ${t}` : pe(e, n) ? `${t} · ${e.noun}` : `${Q(e.noun)} on ${t}`;
266
+ }
267
+ function Y(e, n, t) {
268
+ if (!n || !s(e)) return null;
269
+ const r = `${e}:${n}`, o = t == null ? void 0 : t.records, { singular: i } = I(e, t), a = ce.test(s(e));
270
+ if (o && r in o) {
271
+ const c = o[r];
272
+ if (c == null) return a ? N(i) : k;
273
+ const u = s(c);
274
+ return u ? a && (u === n || U.test(u)) ? N(i) : u.toLowerCase().startsWith(i.toLowerCase()) ? u : `${i} ${u}` : a ? N(i) : i;
259
275
  }
260
- return c || z.test(r) ? C(a) : `${a} ${r}`;
276
+ return a || U.test(n) ? N(i) : `${i} ${n}`;
261
277
  }
262
- function Z(e, n, t) {
278
+ function B(e, n, t) {
263
279
  var o;
264
280
  const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
265
- return i(r) || q(n);
281
+ return s(r) || q(n);
266
282
  }
267
- function P(e, n, t) {
268
- const r = [...new Set(n)].map((o) => Z(e, o, t));
283
+ function j(e, n, t) {
284
+ const r = [...new Set(n)].map((o) => B(e, o, t));
269
285
  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`;
270
286
  }
271
- function le(e) {
287
+ function me(e) {
272
288
  const n = String(e ?? "");
273
289
  return n.startsWith("$t:") ? q(n.slice(3).replace(/-/g, "_")) : n;
274
290
  }
275
- const pe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, fe = /^\d{4}-\d{2}-\d{2}$/, me = /<\/?[a-z][a-z0-9]*(\s[^>]*)?\/?>/i, $e = {
291
+ const $e = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, _e = /^\d{4}-\d{2}-\d{2}$/, ve = /<\/?[a-z][a-z0-9]*(\s[^>]*)?\/?>/i, he = {
276
292
  "&nbsp;": " ",
277
293
  "&amp;": "&",
278
294
  "&lt;": "<",
@@ -280,64 +296,86 @@ const pe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, fe = /^\d{4}-\d{2}-\d{2}$/, me = /<
280
296
  "&quot;": '"',
281
297
  "&#39;": "'"
282
298
  };
283
- function _e(e) {
284
- return e.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&(nbsp|amp|lt|gt|quot|#39);/g, (n) => $e[n] ?? n).replace(/\s+/g, " ").trim();
299
+ function ge(e) {
300
+ return e.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&(nbsp|amp|lt|gt|quot|#39);/g, (n) => he[n] ?? n).replace(/\s+/g, " ").trim();
285
301
  }
286
- function V(e, n, t, r) {
287
- var c, u;
302
+ function ne(e, n, t, r) {
303
+ var u, d, l;
288
304
  if (t == null || t === "") return "empty";
289
305
  if (typeof t == "boolean") return t ? "Yes" : "No";
290
306
  if (typeof t == "object")
291
307
  return Array.isArray(t) ? `${t.length} items` : "a new value";
292
- const o = String(t), s = me.test(o) ? _e(o) : o;
293
- if (!s) return "empty";
294
- const a = (u = (c = r == null ? void 0 : r.choices) == null ? void 0 : c[`${e ?? ""}.${n}`]) == null ? void 0 : u[s];
295
- if (a) return le(a);
296
- if (fe.test(s)) return s;
297
- if (pe.test(s)) {
298
- const d = new Date(s);
299
- if (!Number.isNaN(d.getTime()))
308
+ const o = String(t), i = ve.test(o) ? ge(o) : o;
309
+ if (!i) return "empty";
310
+ const a = (d = (u = r == null ? void 0 : r.choices) == null ? void 0 : u[`${e ?? ""}.${n}`]) == null ? void 0 : d[i];
311
+ if (a) return me(a);
312
+ const c = (l = r == null ? void 0 : r.numbers) == null ? void 0 : l[`${e ?? ""}.${n}`];
313
+ if (c && /^-?\d+(\.\d+)?$/.test(i.trim())) return ke(Number(i.trim()), c);
314
+ if (_e.test(i)) return i;
315
+ if ($e.test(i)) {
316
+ const p = new Date(i);
317
+ if (!Number.isNaN(p.getTime()))
300
318
  try {
301
- return d.toLocaleString(void 0, {
319
+ return p.toLocaleString(void 0, {
302
320
  dateStyle: "medium",
303
321
  timeStyle: "short",
304
322
  ...r != null && r.timeZone ? { timeZone: r.timeZone } : {}
305
323
  });
306
324
  } catch {
307
- return d.toLocaleString();
325
+ return p.toLocaleString();
308
326
  }
309
327
  }
310
- return s.length > 60 ? `${s.slice(0, 57)}…` : s;
328
+ return i.length > 60 ? `${i.slice(0, 57)}…` : i;
311
329
  }
312
- function X(e, n, t, r) {
313
- var s;
330
+ function ke(e, n) {
331
+ const t = Math.min(Math.max(Math.trunc(Number(n.decimals ?? 2)) || 0, 0), 10);
332
+ if (n.kind === "money") {
333
+ const o = /^[A-Z]{3}$/.test(String(n.currency ?? "")) ? String(n.currency) : "USD";
334
+ try {
335
+ return e.toLocaleString(void 0, {
336
+ style: "currency",
337
+ currency: o,
338
+ minimumFractionDigits: t,
339
+ maximumFractionDigits: t
340
+ });
341
+ } catch {
342
+ return e.toLocaleString(void 0, { style: "currency", currency: "USD" });
343
+ }
344
+ }
345
+ const r = e.toLocaleString(void 0, {
346
+ maximumFractionDigits: n.kind === "count" && Number.isInteger(e) ? 0 : t
347
+ });
348
+ return !n.unit || n.unit === "$" ? r : n.unit === "%" ? `${r}%` : `${r} ${n.unit}`;
349
+ }
350
+ function te(e, n, t, r) {
351
+ var i;
314
352
  const o = `${e ?? ""}.${n}`;
315
- return !(!(r != null && r.fields) || !(o in r.fields) || (s = r.links) != null && s[o] || t != null && typeof t == "object");
353
+ return !(!(r != null && r.fields) || !(o in r.fields) || (i = r.links) != null && i[o] || t != null && typeof t == "object");
316
354
  }
317
- function B(e) {
355
+ function K(e) {
318
356
  var n, t;
319
357
  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) : [];
320
358
  }
321
359
  function J(e) {
322
360
  const n = { from: null, to: null, via: null, note: null, auto: !1 };
323
- let t = i(e);
361
+ let t = s(e);
324
362
  if (!t) return n;
325
363
  const r = /^auto(?:-transition)?:?\s*"?([^"]*)"?$/i.exec(t);
326
364
  if (r)
327
- return n.auto = !0, n.via = i(r[1]) || null, n;
365
+ return n.auto = !0, n.via = s(r[1]) || null, n;
328
366
  const o = /\s+—\s+"([\s\S]*)"\s*$/.exec(t);
329
367
  o && (n.note = o[1], t = t.slice(0, o.index)), t = t.replace(/\s*\(bulk:[^)]*\)\s*$/i, "");
330
- const s = /^bulk:\s*(.+?)\s*→\s*(.+)$/i.exec(t);
331
- if (s)
332
- return n.via = s[1], n.to = s[2], n;
368
+ const i = /^bulk:\s*(.+?)\s*→\s*(.+)$/i.exec(t);
369
+ if (i)
370
+ return n.via = i[1], n.to = i[2], n;
333
371
  const a = /^(.*?)\s*→\s*(.+?)(?:\s+via\s+(.+))?$/.exec(t);
334
372
  if (a) {
335
- const c = i(a[1]);
336
- n.from = c && c !== "Start" ? c : null, n.to = i(a[2]) || null, n.via = i(a[3]) || null;
373
+ const c = s(a[1]);
374
+ n.from = c && c !== "Start" ? c : null, n.to = s(a[2]) || null, n.via = s(a[3]) || null;
337
375
  }
338
376
  return n;
339
377
  }
340
- const x = {
378
+ const b = {
341
379
  ack: "acknowledged",
342
380
  acknowledge: "acknowledged",
343
381
  acquire: "took",
@@ -458,7 +496,7 @@ const x = {
458
496
  updated: "updated",
459
497
  upload: "uploaded",
460
498
  view: "viewed"
461
- }, ve = /* @__PURE__ */ new Set([
499
+ }, we = /* @__PURE__ */ new Set([
462
500
  "add",
463
501
  "build",
464
502
  "create",
@@ -473,111 +511,111 @@ const x = {
473
511
  "schedule",
474
512
  "upload"
475
513
  ]);
476
- function ee(e) {
477
- const n = F(e).map((a) => a.toLowerCase());
514
+ function re(e) {
515
+ const n = W(e).map((a) => a.toLowerCase());
478
516
  if (n.length === 0) return { verb: null, past: null, noun: "" };
479
517
  const t = n[n.length - 1];
480
518
  let r = -1;
481
- if (x[t]) r = n.length - 1;
482
- else if (x[n[0]]) r = 0;
483
- else for (let a = n.length - 1; a >= 0; a--) x[n[a]] && (r = a);
484
- if (r < 0) return { verb: null, past: null, noun: n.map(U).join(" ") };
485
- const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
486
- return { verb: o, past: x[o], noun: s.map(U).join(" ") };
519
+ if (b[t]) r = n.length - 1;
520
+ else if (b[n[0]]) r = 0;
521
+ else for (let a = n.length - 1; a >= 0; a--) b[n[a]] && (r = a);
522
+ if (r < 0) return { verb: null, past: null, noun: n.map(z).join(" ") };
523
+ const o = n[r], i = [...n.slice(0, r), ...n.slice(r + 1)];
524
+ return { verb: o, past: b[o], noun: i.map(z).join(" ") };
487
525
  }
488
- function he(e, n) {
489
- return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && ve.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
526
+ function Se(e, n) {
527
+ return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && we.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
490
528
  }
491
- function ge(e) {
529
+ function ye(e) {
492
530
  const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
493
531
  return {
494
532
  rows: n ? Number(n[1].replace(/,/g, "")) : null,
495
- format: t ? W[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
533
+ format: t ? F[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
496
534
  };
497
535
  }
498
536
  function S(e, n) {
499
537
  var r;
500
- const t = `${i(e.collection)}:${i(e.item)}`;
538
+ const t = `${s(e.collection)}:${s(e.item)}`;
501
539
  return ((r = n == null ? void 0 : n.junctions) == null ? void 0 : r[t]) ?? null;
502
540
  }
503
- function ne(e) {
541
+ function Q(e) {
504
542
  return `${/^[aeiou]/i.test(e) ? "an" : "a"} ${e}`;
505
543
  }
506
- function te(e, n) {
507
- const t = g(N(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
508
- if (!i(e.parent_id)) return r;
509
- const o = I(e.parent_collection, e.parent_id, n);
544
+ function G(e, n) {
545
+ const t = g(I(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
546
+ if (!s(e.parent_id)) return r;
547
+ const o = Y(e.parent_collection, s(e.parent_id), n);
510
548
  return !o || o === k ? r : o;
511
549
  }
512
550
  function E(e) {
513
- const n = i(e.value);
514
- return n ? `${e.noun} ${n}` : ne(e.noun);
551
+ const n = s(e.value);
552
+ return n ? `${e.noun} ${n}` : Q(e.noun);
515
553
  }
516
- function re(e, n, t) {
517
- const r = te(n, t);
554
+ function oe(e, n, t) {
555
+ const r = G(n, t);
518
556
  return e === "create" ? `added ${E(n)} to ${r}` : e === "delete" ? `removed ${E(n)} from ${r}` : `updated ${E(n)} on ${r}`;
519
557
  }
520
- function ke(e, n) {
558
+ function xe(e, n) {
521
559
  var l;
522
- const t = e.map((f) => ({ e: f, j: S(f, n) }));
523
- if (t.length === 0 || t.some((f) => !f.j)) return null;
524
- const r = new Set(t.map((f) => i(f.j.parent_id)).filter(Boolean)), o = new Set(t.map((f) => f.j.parent_collection));
560
+ const t = e.map((p) => ({ e: p, j: S(p, n) }));
561
+ if (t.length === 0 || t.some((p) => !p.j)) return null;
562
+ const r = new Set(t.map((p) => s(p.j.parent_id)).filter(Boolean)), o = new Set(t.map((p) => p.j.parent_collection));
525
563
  if (r.size > 1 || o.size > 1) return null;
526
- const s = ((l = t.find((f) => i(f.j.parent_id))) == null ? void 0 : l.j) ?? t[0].j, a = /* @__PURE__ */ new Map();
527
- for (const { e: f, j: $ } of [...t].reverse()) {
528
- const _ = a.get($.noun) ?? { removed: [], added: [], updated: [] }, h = i($.value), v = i(f.action);
564
+ const i = ((l = t.find((p) => s(p.j.parent_id))) == null ? void 0 : l.j) ?? t[0].j, a = /* @__PURE__ */ new Map();
565
+ for (const { e: p, j: $ } of [...t].reverse()) {
566
+ const _ = a.get($.noun) ?? { removed: [], added: [], updated: [] }, h = s($.value), v = s(p.action);
529
567
  v === "delete" ? _.removed.push(h) : v === "create" ? _.added.push(h) : _.updated.push(h), a.set($.noun, _);
530
568
  }
531
- const c = (f, $) => $ ? `${f} ${$}` : ne(f), u = [], d = [];
532
- for (const [f, $] of a) {
569
+ const c = (p, $) => $ ? `${p} ${$}` : Q(p), u = [], d = [];
570
+ for (const [p, $] of a) {
533
571
  if ($.removed.length === 1 && $.added.length === 1 && $.updated.length === 0) {
534
- u.push({ noun: f, from: $.removed[0], to: $.added[0] });
572
+ u.push({ noun: p, from: $.removed[0], to: $.added[0] });
535
573
  continue;
536
574
  }
537
- for (const _ of $.removed) d.push(`removed ${c(f, _)}`);
538
- for (const _ of $.added) d.push(`added ${c(f, _)}`);
539
- for (const _ of $.updated) d.push(`updated ${c(f, _)}`);
575
+ for (const _ of $.removed) d.push(`removed ${c(p, _)}`);
576
+ for (const _ of $.added) d.push(`added ${c(p, _)}`);
577
+ for (const _ of $.updated) d.push(`updated ${c(p, _)}`);
540
578
  }
541
- return { parent: te(s, n), pairs: u, rest: d };
579
+ return { parent: G(i, n), pairs: u, rest: d };
542
580
  }
543
- function we(e) {
581
+ function Ae(e) {
544
582
  return e.from && e.to ? `${e.noun} ${e.from} → ${e.to}` : e.to ? `${e.noun} set to ${e.to}` : `changed ${e.noun}`;
545
583
  }
546
- function Se(e, n) {
547
- const t = ke(e, n);
584
+ function be(e, n) {
585
+ const t = xe(e, n);
548
586
  if (!t) return null;
549
- const { parent: r, pairs: o, rest: s } = t;
550
- if (s.length === 0 && o.length === 1) {
587
+ const { parent: r, pairs: o, rest: i } = t;
588
+ if (i.length === 0 && o.length === 1) {
551
589
  const a = o[0];
552
590
  return a.from && a.to ? `changed ${a.noun} on ${r}: ${a.from} → ${a.to}` : a.to ? `changed ${a.noun} on ${r} to ${a.to}` : `changed ${a.noun} on ${r}`;
553
591
  }
554
- if (o.length === 0 && s.length === 1) {
592
+ if (o.length === 0 && i.length === 1) {
555
593
  const a = e[0];
556
- return re(i(a.action), S(a, n), n);
594
+ return oe(s(a.action), S(a, n), n);
557
595
  }
558
- return `changed ${r}: ${[...o.map(we), ...s].join("; ")}`;
596
+ return `changed ${r}: ${[...o.map(Ae), ...i].join("; ")}`;
559
597
  }
560
- const K = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
598
+ const H = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
561
599
  function je(e) {
562
- const n = i(e).toLowerCase();
600
+ const n = s(e).toLowerCase();
563
601
  return /approv/.test(n) ? "Approved" : /reject/.test(n) ? "Rejected" : /declin/.test(n) ? "Declined" : /send.?back|return/.test(n) ? "Sent back" : /submit/.test(n) ? "Submitted" : /cancel/.test(n) ? "Cancelled" : "Moved";
564
602
  }
565
- function be(e, n) {
566
- var $, _, h, v, b;
567
- const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s = N(r, n), a = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, c = i(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
603
+ function Ie(e, n) {
604
+ var $, _, h, v, y;
605
+ const t = s(e.action), r = e.collection ?? null, o = T(r, e.item, n), i = I(r, n), a = `${/^[aeiou]/i.test(i.singular) ? "an" : "a"} ${g(i.singular)}`, c = s(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
568
606
  if (d && (t === "create" || t === "delete" || t === "update"))
569
- return re(t, d, n);
607
+ return oe(t, d, n);
570
608
  if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
571
- const p = i(e.event.to_label);
572
- return `started ${o ?? "the pipeline"}${p ? ` in ${p}` : ""}`;
609
+ const f = s(e.event.to_label);
610
+ return `started ${o ?? "the pipeline"}${f ? ` in ${f}` : ""}`;
573
611
  }
574
- if (((_ = e.event) == null ? void 0 : _.kind) === "transition" || K.has(t)) {
575
- const p = e.event ? {
576
- from: i(e.event.from_label) || null,
577
- to: i(e.event.to_label) || null,
578
- via: i(e.event.transition_label) || null
579
- } : J(c), m = (h = e.event) != null && h.addendum ? `Addendum “${i(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
580
- return p.from && p.to ? `moved ${m} from ${p.from} to ${p.to}` : p.to ? `moved ${m} to ${p.to}` : p.via ? `ran “${p.via}” on ${m}` : `moved ${m}`;
612
+ if (((_ = e.event) == null ? void 0 : _.kind) === "transition" || H.has(t)) {
613
+ const f = e.event ? {
614
+ from: s(e.event.from_label) || null,
615
+ to: s(e.event.to_label) || null,
616
+ via: s(e.event.transition_label) || null
617
+ } : J(c), m = (h = e.event) != null && h.addendum ? `Addendum “${s(e.event.addendum.title) || "Untitled"}”` : o ?? "a record";
618
+ return f.from && f.to ? `moved ${m} from ${f.from} to ${f.to}` : f.to ? `moved ${m} to ${f.to}` : f.via ? `ran “${f.via}” on ${m}` : `moved ${m}`;
581
619
  }
582
620
  switch (t) {
583
621
  case "create":
@@ -587,16 +625,16 @@ function be(e, n) {
587
625
  case "o2m-update": {
588
626
  if (t === "o2m-update")
589
627
  return e.o2m ? `${M(e.o2m)}${u}` : `changed related rows${u}`;
590
- const p = B(e);
628
+ const f = K(e);
591
629
  if (r === "nivaro_settings")
592
- return p.length ? `changed the ${P(r, p, n)} setting${p.length === 1 ? "" : "s"}` : "changed the settings";
630
+ return f.length ? `changed the ${j(r, f, n)} setting${f.length === 1 ? "" : "s"}` : "changed the settings";
593
631
  if (r === "nivaro_approval_instances" && ((v = e.why) != null && v.approval)) {
594
- const m = e.why.approval, w = I(m.collection, m.item, n);
595
- return `${(x[i(m.decision).toLowerCase()] ?? i(m.decision).toLowerCase()) || "decided on"} ${w ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
632
+ const m = e.why.approval, w = T(m.collection, m.item, n);
633
+ return `${(b[s(m.decision).toLowerCase()] ?? s(m.decision).toLowerCase()) || "decided on"} ${w ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
596
634
  }
597
- if (p.length) {
598
- const m = ((b = e.changes) == null ? void 0 : b.length) === 1 ? e.changes[0] : null;
599
- return m && "value" in m && X(r, m.field, m.value, n) ? `set ${Z(r, m.field, n)} to ${V(r, m.field, m.value, n)}${u}` : `changed ${P(r, p, n)}${u}`;
635
+ if (f.length) {
636
+ const m = ((y = e.changes) == null ? void 0 : y.length) === 1 ? e.changes[0] : null;
637
+ return m && "value" in m && te(r, m.field, m.value, n) ? `set ${B(r, m.field, n)} to ${ne(r, m.field, m.value, n)}${u}` : `changed ${j(r, f, n)}${u}`;
600
638
  }
601
639
  return `updated ${o ?? a}`;
602
640
  }
@@ -606,8 +644,8 @@ function be(e, n) {
606
644
  case "restore":
607
645
  return `restored ${o ?? a}`;
608
646
  case "pipeline-start": {
609
- const p = /initial state:\s*(.+)$/i.exec(c);
610
- return `started ${o ?? "the pipeline"}${p ? ` in ${p[1]}` : ""}`;
647
+ const f = /initial state:\s*(.+)$/i.exec(c);
648
+ return `started ${o ?? "the pipeline"}${f ? ` in ${f[1]}` : ""}`;
611
649
  }
612
650
  case "login":
613
651
  return "signed in";
@@ -618,8 +656,8 @@ function be(e, n) {
618
656
  case "sign-in-failed":
619
657
  return o && o !== k ? `had a sign-in as ${o} fail` : "had a sign-in fail";
620
658
  case "export": {
621
- const p = ge(c);
622
- return `exported ${p.rows != null ? L(p.rows, r, n) : g(s.plural)}${p.format ? ` to ${p.format}` : ""}`;
659
+ const f = ye(c);
660
+ return `exported ${f.rows != null ? L(f.rows, r, n) : g(i.plural)}${f.format ? ` to ${f.format}` : ""}`;
623
661
  }
624
662
  case "masquerade-start":
625
663
  return `started viewing as ${A(e, n, c)}`;
@@ -641,36 +679,36 @@ function be(e, n) {
641
679
  return `changed the role of ${A(e, n, "")}`;
642
680
  case "bulk-write":
643
681
  case "bulk-action-execute": {
644
- const p = /(\d+)\s+(?:item|row)/i.exec(c), m = p ? L(Number(p[1]), r, n) : g(s.plural), w = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
682
+ const f = /(\d+)\s+(?:item|row)/i.exec(c), m = f ? L(Number(f[1]), r, n) : g(i.plural), w = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
645
683
  return w ? `ran “${w[1]}” on ${m}` : `changed ${m} in bulk`;
646
684
  }
647
685
  case "import-create":
648
686
  case "import-queue":
649
- return `started an import into ${g(s.plural)}`;
687
+ return `started an import into ${g(i.plural)}`;
650
688
  case "import-complete":
651
- return `finished an import into ${g(s.plural)}${c ? ` (${c})` : ""}`;
689
+ return `finished an import into ${g(i.plural)}${c ? ` (${c})` : ""}`;
652
690
  case "import-failed":
653
- return `had an import into ${g(s.plural)} fail`;
691
+ return `had an import into ${g(i.plural)} fail`;
654
692
  case "comment":
655
693
  return `commented${u}`;
656
694
  case "file-download": {
657
- let p = "", m = !1;
695
+ let f = "", m = !1;
658
696
  try {
659
- const O = JSON.parse(c);
660
- p = typeof O.name == "string" ? O.name : "", m = O.kind === "open";
697
+ const D = JSON.parse(c);
698
+ f = typeof D.name == "string" ? D.name : "", m = D.kind === "open";
661
699
  } catch {
662
700
  }
663
- const w = p ? `“${p}”` : "a file";
701
+ const w = f ? `“${f}”` : "a file";
664
702
  return `${m ? "opened" : "downloaded"} ${w}${r === "nivaro_files" ? "" : u}`;
665
703
  }
666
704
  case "split-out":
667
705
  case "split-in": {
668
- let p = 0;
706
+ let f = 0;
669
707
  try {
670
- p = Number(JSON.parse(c).lines) || 0;
708
+ f = Number(JSON.parse(c).lines) || 0;
671
709
  } catch {
672
710
  }
673
- const m = p > 0 ? `${p} ${p === 1 ? "line" : "lines"}` : "lines";
711
+ const m = f > 0 ? `${f} ${f === 1 ? "line" : "lines"}` : "lines";
674
712
  return t === "split-out" ? `moved ${m}${o ? ` of ${o}` : ""} to a new record` : `created ${o ?? a} from ${m} of another record`;
675
713
  }
676
714
  case "picker-exclude":
@@ -687,124 +725,124 @@ function be(e, n) {
687
725
  return "downloaded a configuration snapshot";
688
726
  }
689
727
  if (!t) return `did something${u}`;
690
- const l = ee(t);
691
- return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(s.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${he(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${G(t)}”${u}`;
728
+ const l = re(t);
729
+ return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(i.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${Se(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${X(t)}”${u}`;
692
730
  }
693
731
  function A(e, n, t) {
694
- const r = i(e.item), o = T(r, n) ?? (t || null);
732
+ const r = s(e.item), o = P(r, n) ?? (t || null);
695
733
  if (o) return o;
696
- const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
697
- return s && !z.test(r) ? s : "someone";
734
+ const i = e.collection === "nivaro_users" ? T(e.collection, e.item, n) : null;
735
+ return i && !U.test(r) ? i : "someone";
698
736
  }
699
- function ye(e, n) {
700
- return `${H(e, n)} ${be(e, n)}`;
737
+ function Ne(e, n) {
738
+ return `${ee(e, n)} ${Ie(e, n)}`;
701
739
  }
702
- function Re(e) {
740
+ function qe(e) {
703
741
  var c, u, d, l;
704
- const n = i(e.action), t = i(e.comment);
705
- let r = i((c = e.why) == null ? void 0 : c.reason) || null, o = i((u = e.why) == null ? void 0 : u.note) || null;
706
- !o && K.has(n) && !e.event && (o = J(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);
707
- const s = (l = e.why) == null ? void 0 : l.approval, a = s ? `${q(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
742
+ const n = s(e.action), t = s(e.comment);
743
+ let r = s((c = e.why) == null ? void 0 : c.reason) || null, o = s((u = e.why) == null ? void 0 : u.note) || null;
744
+ !o && H.has(n) && !e.event && (o = J(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);
745
+ const i = (l = e.why) == null ? void 0 : l.approval, a = i ? `${q(s(i.decision)) || "Decided"}${i.chain ? ` · ${i.chain}` : ""}${i.step != null && i.step !== "" ? ` · step ${i.step}` : ""}${s(i.comment) ? ` — “${s(i.comment)}”` : ""}` : null;
708
746
  return { reason: r, note: o, approval: a };
709
747
  }
710
- const Ae = 6e4, xe = 5e3;
711
- function j(e) {
748
+ const Ce = 6e4, Re = 5e3;
749
+ function C(e) {
712
750
  return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
713
751
  }
714
752
  function R(e) {
715
- const n = Y(e);
716
- return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
753
+ const n = Z(e);
754
+ return `${n.kind}|${s(n.id)}|${s(e.user ?? e.user_id).toUpperCase()}`;
717
755
  }
718
- function Ie(e) {
719
- const n = i(e.action);
720
- return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
756
+ function Le(e) {
757
+ const n = s(e.action);
758
+ return !s(e.item) && (n.startsWith("bulk-") || n === "import-complete");
721
759
  }
722
- function Le(e, n = {}) {
723
- const t = n.windowMs ?? Ae, r = [], o = (s, a) => s.parent_collection === a.parent_collection && (!i(s.parent_id) || !i(a.parent_id) || i(s.parent_id) === i(a.parent_id));
724
- for (const s of e) {
725
- const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = i(s.group_key);
760
+ function De(e, n = {}) {
761
+ const t = n.windowMs ?? Ce, r = [], o = (i, a) => i.parent_collection === a.parent_collection && (!s(i.parent_id) || !s(a.parent_id) || s(i.parent_id) === s(a.parent_id));
762
+ for (const i of e) {
763
+ const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = s(i.group_key);
726
764
  if (a && c && n.labels) {
727
- const d = S(s, n.labels), l = S(c, n.labels);
728
- if (d && l && a.entries.every((f) => S(f, n.labels)) && o(d, l) && R(s) === R(c) && Math.abs(j(c) - j(s)) <= xe) {
729
- a.entries.push(s), a.by !== "group_key" && (a.by = "time");
765
+ const d = S(i, n.labels), l = S(c, n.labels);
766
+ if (d && l && a.entries.every((p) => S(p, n.labels)) && o(d, l) && R(i) === R(c) && Math.abs(C(c) - C(i)) <= Re) {
767
+ a.entries.push(i), a.by !== "group_key" && (a.by = "time");
730
768
  continue;
731
769
  }
732
770
  }
733
771
  if (a && c) {
734
- const d = i(c.group_key);
772
+ const d = s(c.group_key);
735
773
  if (u && u === d) {
736
- a.entries.push(s), a.by = "group_key";
774
+ a.entries.push(i), a.by = "group_key";
737
775
  continue;
738
776
  }
739
- if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" && R(s) === R(c) && Math.abs(j(c) - j(s)) <= t) {
740
- a.entries.push(s), a.by = "time";
777
+ if (!u && !d && a.by !== "group_key" && s(i.action) === s(c.action) && s(i.collection) === s(c.collection) && s(i.collection) !== "" && R(i) === R(c) && Math.abs(C(c) - C(i)) <= t) {
778
+ a.entries.push(i), a.by = "time";
741
779
  continue;
742
780
  }
743
781
  }
744
- r.push({ key: `${u || "e"}:${s.id ?? r.length}`, entries: [s], by: null });
782
+ r.push({ key: `${u || "e"}:${i.id ?? r.length}`, entries: [i], by: null });
745
783
  }
746
784
  return r;
747
785
  }
748
- function Te(e, n) {
786
+ function Me(e, n) {
749
787
  if (e.length === 0) return "";
750
- const t = e.filter((v) => !Ie(v)), r = t[0] ?? e[0];
751
- if (t.length <= 1) return ye(r, n);
752
- const o = H(r, n), s = Se(t, n);
753
- if (s) return `${o} ${s}`;
754
- const c = new Set(t.map((v) => i(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => i(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && i(r.item) ? I(c, r.item, n) ?? L(d, c, n) : L(d, c, n) : `${d} records`, f = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
755
- t.map((v) => K.has(i(v.action)) ? "transition" : i(v.action))
788
+ const t = e.filter((v) => !Le(v)), r = t[0] ?? e[0];
789
+ if (t.length <= 1) return Ne(r, n);
790
+ const o = ee(r, n), i = be(t, n);
791
+ if (i) return `${o} ${i}`;
792
+ const c = new Set(t.map((v) => s(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => s(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && s(r.item) ? T(c, r.item, n) ?? L(d, c, n) : L(d, c, n) : `${d} records`, p = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
793
+ t.map((v) => H.has(s(v.action)) ? "transition" : s(v.action))
756
794
  );
757
795
  if ($.size !== 1) return `${o} made ${t.length} changes to ${l}`;
758
796
  const _ = [...$][0];
759
797
  if (_ === "transition") {
760
798
  const v = new Set(
761
- t.map((p) => {
799
+ t.map((f) => {
762
800
  var m;
763
- return i(((m = p.event) == null ? void 0 : m.to_label) ?? J(p.comment).to);
801
+ return s(((m = f.event) == null ? void 0 : m.to_label) ?? J(f.comment).to);
764
802
  })
765
- ), b = v.size === 1 ? [...v][0] : "";
766
- return `${o} moved ${l}${b ? ` to ${b}` : ""}${f}`;
803
+ ), y = v.size === 1 ? [...v][0] : "";
804
+ return `${o} moved ${l}${y ? ` to ${y}` : ""}${p}`;
767
805
  }
768
806
  if (_ === "update") {
769
- const v = Ne(t, c, n);
770
- return `${o} updated ${l}${f}${v ? `: ${v}` : ""}`;
807
+ const v = Pe(t, c, n);
808
+ return `${o} updated ${l}${p}${v ? `: ${v}` : ""}`;
771
809
  }
772
810
  if (_ === "create") return `${o} created ${l}`;
773
811
  if (_ === "delete") return `${o} deleted ${l}`;
774
- if (_ === "picker-exclude") return `${o} hid ${l} from pickers${f}`;
775
- if (_ === "picker-include") return `${o} showed ${l} in pickers again${f}`;
776
- const h = ee(_);
777
- return h.past ? `${o} ${h.past} ${l}${h.noun && !g(N(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${f}` : `${o} recorded “${G(_)}” on ${l}`;
812
+ if (_ === "picker-exclude") return `${o} hid ${l} from pickers${p}`;
813
+ if (_ === "picker-include") return `${o} showed ${l} in pickers again${p}`;
814
+ const h = re(_);
815
+ return h.past ? `${o} ${h.past} ${l}${h.noun && !g(I(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${p}` : `${o} recorded “${X(_)}” on ${l}`;
778
816
  }
779
- function Ne(e, n, t) {
817
+ function Pe(e, n, t) {
780
818
  var c;
781
819
  const r = ((c = e[0]) == null ? void 0 : c.changes) ?? null;
782
820
  if (!(r != null && r.length)) {
783
- const u = e.map((d) => B(d).sort().join(","));
784
- return u[0] && u.every((d) => d === u[0]) ? P(n, u[0].split(","), t) : "";
821
+ const u = e.map((d) => K(d).sort().join(","));
822
+ return u[0] && u.every((d) => d === u[0]) ? j(n, u[0].split(","), t) : "";
785
823
  }
786
824
  const o = (u) => JSON.stringify((u.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
787
- if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => X(n, u.field, u.value, t)))
825
+ if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => te(n, u.field, u.value, t)))
788
826
  return r.map(
789
- (u) => `${Z(n, u.field, t)} → ${V(n, u.field, u.value, t)}`
827
+ (u) => `${B(n, u.field, t)} → ${ne(n, u.field, u.value, t)}`
790
828
  ).join(", ");
791
829
  const a = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
792
- return P(n, [...a], t);
830
+ return j(n, [...a], t);
793
831
  }
794
- function Pe(e) {
832
+ function Oe(e) {
795
833
  var a;
796
- const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (c, u) => {
797
- const d = i(c), l = i(u);
834
+ const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), i = (c, u) => {
835
+ const d = s(c), l = s(u);
798
836
  !d || !l || (o.add(d), d === "nivaro_users" && t.add(l), n.set(`${d}:${l}`, { collection: d, id: l }));
799
837
  };
800
838
  for (const c of e) {
801
- const u = i(c.user ?? c.user_id);
839
+ const u = s(c.user ?? c.user_id);
802
840
  u && t.add(u);
803
- const d = Y(c);
804
- d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), i(c.collection) && o.add(i(c.collection)), s(c.collection, c.item), (a = c.why) != null && a.approval && s(c.why.approval.collection, c.why.approval.item);
805
- for (const l of B(c)) {
806
- const f = i(c.collection);
807
- f && r.set(`${f}.${l}`, { collection: f, field: l });
841
+ const d = Z(c);
842
+ d.kind === "view_as" && d.id && t.add(d.id), d.on_behalf_of && t.add(d.on_behalf_of), s(c.collection) && o.add(s(c.collection)), i(c.collection, c.item), (a = c.why) != null && a.approval && i(c.why.approval.collection, c.why.approval.item);
843
+ for (const l of K(c)) {
844
+ const p = s(c.collection);
845
+ p && r.set(`${p}.${l}`, { collection: p, field: l });
808
846
  }
809
847
  }
810
848
  return {
@@ -815,34 +853,34 @@ function Pe(e) {
815
853
  };
816
854
  }
817
855
  export {
818
- Ae as BURST_WINDOW_MS,
856
+ Ce as BURST_WINDOW_MS,
819
857
  k as HIDDEN_RECORD,
820
- xe as LINK_WRITE_WINDOW_MS,
821
- ee as actionParts,
822
- Pe as activityLabelRefs,
823
- be as activityPredicate,
824
- Re as activityWhy,
825
- H as actorName,
826
- Y as actorOf,
827
- le as choiceText,
828
- N as collectionNouns,
858
+ Re as LINK_WRITE_WINDOW_MS,
859
+ re as actionParts,
860
+ Oe as activityLabelRefs,
861
+ Ie as activityPredicate,
862
+ qe as activityWhy,
863
+ ee as actorName,
864
+ Z as actorOf,
865
+ me as choiceText,
866
+ I as collectionNouns,
829
867
  L as countNoun,
830
- Z as fieldLabel,
831
- P as fieldList,
832
- Le as groupActivity,
868
+ B as fieldLabel,
869
+ j as fieldList,
870
+ De as groupActivity,
833
871
  S as junctionOf,
834
- ke as linkChanges,
835
- Se as linkGroupPredicate,
836
- we as linkPairText,
872
+ xe as linkChanges,
873
+ be as linkGroupPredicate,
874
+ Ae as linkPairText,
837
875
  M as o2mSentence,
838
- Ce as o2mTotalsText,
839
- de as parseActor,
876
+ Te as o2mTotalsText,
877
+ le as parseActor,
840
878
  J as parseTransitionComment,
841
- G as readableTitle,
842
- I as recordPhrase,
843
- Te as renderActivityGroupSentence,
844
- ye as renderActivitySentence,
879
+ X as readableTitle,
880
+ T as recordPhrase,
881
+ Me as renderActivityGroupSentence,
882
+ Ne as renderActivitySentence,
845
883
  je as transitionVerb,
846
- X as valueShowable,
847
- V as valueText
884
+ te as valueShowable,
885
+ ne as valueText
848
886
  };