@nivaro/react 0.3.40 → 0.3.42

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 (99) hide show
  1. package/dist/components/LayoutForm.js +100 -98
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +645 -16
  5. package/dist/index.js +814 -775
  6. package/dist/shared/components/ActivityEntry.js +154 -0
  7. package/dist/shared/components/AudienceConfirmPanel.js +98 -0
  8. package/dist/shared/components/BackgroundRunOffer.js +43 -31
  9. package/dist/shared/components/BroadcastView.js +225 -204
  10. package/dist/shared/components/CollectionBrowserView.js +3924 -3584
  11. package/dist/shared/components/ConfigHistory.js +153 -0
  12. package/dist/shared/components/ConfigReadBack.js +65 -0
  13. package/dist/shared/components/DataTable.js +379 -346
  14. package/dist/shared/components/ForceReloadBanner.js +47 -40
  15. package/dist/shared/components/IdleReloadWatcher.js +69 -0
  16. package/dist/shared/components/ItemEditForm.js +4041 -3853
  17. package/dist/shared/components/MyWorkView.js +278 -213
  18. package/dist/shared/components/NotificationBell.js +130 -121
  19. package/dist/shared/components/PickerExcludedRows.js +3 -3
  20. package/dist/shared/components/ProfileView.js +776 -1003
  21. package/dist/shared/components/RecentRecordsRail.js +34 -16
  22. package/dist/shared/components/RecordReadView.js +500 -477
  23. package/dist/shared/components/Skeletons.js +199 -0
  24. package/dist/shared/components/SlowNotice.js +63 -0
  25. package/dist/shared/components/Term.js +23 -0
  26. package/dist/shared/components/WidgetSlot.js +350 -353
  27. package/dist/shared/components/access/PermissionSummary.js +106 -0
  28. package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
  29. package/dist/shared/components/chat/ChatPanel.js +902 -886
  30. package/dist/shared/components/chat/MemberPaging.js +70 -0
  31. package/dist/shared/components/chat/RoomParts.js +147 -117
  32. package/dist/shared/components/chat/ScreenClip.js +73 -69
  33. package/dist/shared/components/chat/chat-core.js +449 -396
  34. package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
  35. package/dist/shared/components/help-videos/api.js +2 -5
  36. package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
  37. package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
  38. package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
  39. package/dist/shared/components/imports/RunDetailSheet.js +222 -227
  40. package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
  41. package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
  42. package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
  43. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
  44. package/dist/shared/components/item-edit/FieldComments.js +212 -0
  45. package/dist/shared/components/item-edit/FieldRow.js +340 -336
  46. package/dist/shared/components/item-edit/RecordGrantTools.js +28 -28
  47. package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
  48. package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
  49. package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
  50. package/dist/shared/components/item-edit/field-comments-context.js +6 -0
  51. package/dist/shared/components/item-edit/field-sources.js +33 -0
  52. package/dist/shared/components/item-edit/rule-hidden.js +30 -0
  53. package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
  54. package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
  55. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
  56. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
  57. package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
  58. package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
  59. package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
  60. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  61. package/dist/shared/components/layout-editor/settings/settings-registry.js +1 -1
  62. package/dist/shared/components/list/CopyListLinkButton.js +41 -0
  63. package/dist/shared/components/list/InlineEdit.js +363 -0
  64. package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
  65. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
  66. package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
  67. package/dist/shared/components/notifications/TestMyRules.js +137 -0
  68. package/dist/shared/components/notifications/changes-lines.js +24 -0
  69. package/dist/shared/components/notifications/why-lines.js +64 -0
  70. package/dist/shared/components/panels/CommentPanel.js +316 -281
  71. package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
  72. package/dist/shared/components/panels/PipelinePanel.js +201 -196
  73. package/dist/shared/components/panels/RevisionsPanel.js +496 -479
  74. package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
  75. package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
  76. package/dist/shared/components/profile/PersonDidPanel.js +188 -0
  77. package/dist/shared/components/profile/PersonProfile.js +57 -52
  78. package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
  79. package/dist/shared/hooks/useSlowReason.js +39 -0
  80. package/dist/shared/lib/activity-sentence.js +670 -0
  81. package/dist/shared/lib/config-sentences.js +418 -0
  82. package/dist/shared/lib/core-glossary.js +229 -0
  83. package/dist/shared/lib/error-hints.js +159 -0
  84. package/dist/shared/lib/error-message.js +105 -0
  85. package/dist/shared/lib/error-toast.js +22 -0
  86. package/dist/shared/lib/field-comments.js +25 -0
  87. package/dist/shared/lib/filter-sentence.js +261 -0
  88. package/dist/shared/lib/glossary.js +55 -48
  89. package/dist/shared/lib/idle-reload.js +138 -0
  90. package/dist/shared/lib/layout-resolve.js +42 -29
  91. package/dist/shared/lib/list-inline-edit.js +190 -0
  92. package/dist/shared/lib/list-link.js +147 -0
  93. package/dist/shared/lib/prefetch.js +259 -106
  94. package/dist/shared/lib/record-ref.js +72 -0
  95. package/dist/shared/lib/reload-holds.js +25 -0
  96. package/dist/shared/lib/safe-error.js +52 -24
  97. package/dist/shared/lib/skeleton-shapes.js +72 -0
  98. package/dist/shared/lib/slow-reason.js +63 -0
  99. package/package.json +1 -1
@@ -0,0 +1,670 @@
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 = {
2
+ ai: "AI",
3
+ api: "API",
4
+ csv: "CSV",
5
+ db: "database",
6
+ erp: "ERP",
7
+ id: "ID",
8
+ ip: "IP",
9
+ mcp: "MCP",
10
+ oauth: "OAuth",
11
+ o2m: "related rows",
12
+ pdf: "PDF",
13
+ scim: "SCIM",
14
+ sla: "SLA",
15
+ sql: "SQL",
16
+ sso: "SSO",
17
+ totp: "two-step sign-in",
18
+ ui: "UI",
19
+ url: "URL",
20
+ xlsx: "Excel"
21
+ };
22
+ function i(e) {
23
+ return e == null ? "" : String(e).trim();
24
+ }
25
+ function V(e) {
26
+ return i(e).toUpperCase();
27
+ }
28
+ function P(e) {
29
+ return e.split(/[\s_.:-]+/).map((n) => n.trim()).filter(Boolean);
30
+ }
31
+ function R(e) {
32
+ const n = e.toLowerCase();
33
+ return q[n] ?? n;
34
+ }
35
+ function Z(e) {
36
+ const n = P(e).map(R).join(" ");
37
+ return n ? n.charAt(0).toUpperCase() + n.slice(1) : "";
38
+ }
39
+ function j(e) {
40
+ return P(e).map((n) => q[n.toLowerCase()] ?? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
41
+ }
42
+ function z(e) {
43
+ 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
+ }
45
+ function L(e) {
46
+ 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
+ }
48
+ function g(e) {
49
+ return e.split(" ").map((n) => /[A-Z][^ ]*[A-Z]/.test(n) ? n : n.toLowerCase()).join(" ");
50
+ }
51
+ const G = {
52
+ nivaro_activity: "Activity entry",
53
+ nivaro_api_keys: "API key",
54
+ nivaro_approval_chains: "Approval chain",
55
+ nivaro_approval_instances: "Approval",
56
+ nivaro_collections: "Collection",
57
+ nivaro_comments: "Comment",
58
+ nivaro_custom_queries: "Custom query",
59
+ nivaro_dashboards: "Dashboard",
60
+ nivaro_external_apis: "External API",
61
+ nivaro_fields: "Field",
62
+ nivaro_files: "File",
63
+ nivaro_flows: "Flow",
64
+ nivaro_import_definitions: "Import definition",
65
+ nivaro_import_queue: "Import run",
66
+ nivaro_permissions: "Permission",
67
+ nivaro_policies: "Policy",
68
+ nivaro_relations: "Relation",
69
+ nivaro_roles: "Role",
70
+ nivaro_settings: "Settings",
71
+ nivaro_tasks: "Task",
72
+ nivaro_users: "User",
73
+ nivaro_webhooks: "Webhook",
74
+ nivaro_workflow_templates: "Pipeline"
75
+ };
76
+ function b(e, n) {
77
+ var f;
78
+ const t = i(e);
79
+ 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);
83
+ return { singular: $, plural: h };
84
+ }
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) };
89
+ }
90
+ function k(e, n) {
91
+ const t = e.split(" ");
92
+ return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
93
+ }
94
+ function y(e, n, t) {
95
+ const { singular: o, plural: r } = b(n, t);
96
+ return `${e} ${g(e === 1 ? o : r)}`;
97
+ }
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);
103
+ }
104
+ function C(e, n) {
105
+ if (!e || !(n != null && n.users)) return null;
106
+ const t = n.users;
107
+ return i(t[e] ?? t[V(e)] ?? t[i(e).toLowerCase()]) || null;
108
+ }
109
+ const Q = /* @__PURE__ */ new Set([
110
+ "person",
111
+ "view_as",
112
+ "api_key",
113
+ "mcp",
114
+ "import",
115
+ "flow",
116
+ "cron",
117
+ "system"
118
+ ]);
119
+ function X(e) {
120
+ if (e == null || e === "") return null;
121
+ let n = e;
122
+ if (typeof e == "string")
123
+ try {
124
+ n = JSON.parse(e);
125
+ } catch {
126
+ return null;
127
+ }
128
+ if (!n || typeof n != "object") return null;
129
+ const t = n, o = i(t.kind);
130
+ return Q.has(o) ? {
131
+ kind: o,
132
+ id: t.id == null ? null : String(t.id),
133
+ name: t.name == null ? null : String(t.name),
134
+ on_behalf_of: t.on_behalf_of == null ? null : String(t.on_behalf_of)
135
+ } : null;
136
+ }
137
+ function O(e) {
138
+ const n = X(e.actor);
139
+ if (n) return n;
140
+ const t = e.user ?? e.user_id ?? null;
141
+ if (i(e.mcp_conn) || i(e.via_app) || i(e.via_agent))
142
+ return {
143
+ kind: "mcp",
144
+ id: i(e.mcp_conn) || null,
145
+ name: i(e.via_app) || i(e.via_agent) || null,
146
+ on_behalf_of: t
147
+ };
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)
151
+ return {
152
+ kind: "api_key",
153
+ id: String(e.api_key_id),
154
+ name: i(e.api_key_name) || null,
155
+ on_behalf_of: t
156
+ };
157
+ const r = i(e.chain_parent), s = /^(cron|import_run|flow_run):(.+)$/.exec(r);
158
+ if (s) {
159
+ const a = s[1] === "cron" ? "cron" : s[1] === "import_run" ? "import" : "flow";
160
+ return { kind: a, id: s[2], name: a === "cron" ? s[2] : null, on_behalf_of: t };
161
+ }
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 } : {
164
+ kind: "system",
165
+ id: null,
166
+ name: i(e.origin) === "integration" ? "An integration" : null
167
+ };
168
+ }
169
+ function Y(e, n) {
170
+ const t = O(e), o = H(e, n), r = C(t.on_behalf_of, n) ?? o;
171
+ switch (t.kind) {
172
+ case "person":
173
+ return o ?? "Someone";
174
+ case "view_as":
175
+ return `${(C(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${r ?? "someone"}`;
176
+ case "api_key":
177
+ return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
178
+ case "mcp": {
179
+ const s = i(t.name).replace(/^via\s+/i, "") || "An assistant";
180
+ return r ? `${s} for ${r}` : s;
181
+ }
182
+ case "import":
183
+ return i(t.name) ? `Import “${i(t.name)}”` : "An import";
184
+ case "flow":
185
+ return i(t.name) ? `Flow “${i(t.name)}”` : "A flow";
186
+ case "cron":
187
+ return i(t.name || t.id) ? `Scheduled job “${i(t.name || t.id)}”` : "A scheduled job";
188
+ default:
189
+ return i(t.name) || "System";
190
+ }
191
+ }
192
+ 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];
198
+ if (a == null) return S;
199
+ const u = i(a);
200
+ return u ? u.toLowerCase().startsWith(c.toLowerCase()) ? u : `${c} ${u}` : c;
201
+ }
202
+ return F.test(o) ? `a ${g(c)}` : `${c} ${o}`;
203
+ }
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);
208
+ }
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`;
212
+ }
213
+ function ee(e) {
214
+ const n = String(e ?? "");
215
+ return n.startsWith("$t:") ? j(n.slice(3).replace(/-/g, "_")) : n;
216
+ }
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;
220
+ if (t == null || t === "") return "empty";
221
+ if (typeof t == "boolean") return t ? "Yes" : "No";
222
+ if (typeof t == "object")
223
+ 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()))
230
+ try {
231
+ return u.toLocaleString(void 0, {
232
+ dateStyle: "medium",
233
+ timeStyle: "short",
234
+ ...o != null && o.timeZone ? { timeZone: o.timeZone } : {}
235
+ });
236
+ } catch {
237
+ return u.toLocaleString();
238
+ }
239
+ }
240
+ return r.length > 60 ? `${r.slice(0, 57)}…` : r;
241
+ }
242
+ function K(e, n, t, o) {
243
+ 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");
246
+ }
247
+ function D(e) {
248
+ 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) : [];
250
+ }
251
+ function M(e) {
252
+ const n = { from: null, to: null, via: null, note: null, auto: !1 };
253
+ let t = i(e);
254
+ 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, "");
260
+ const s = /^bulk:\s*(.+?)\s*→\s*(.+)$/i.exec(t);
261
+ if (s)
262
+ 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;
267
+ }
268
+ return n;
269
+ }
270
+ const x = {
271
+ ack: "acknowledged",
272
+ acknowledge: "acknowledged",
273
+ acquire: "took",
274
+ add: "added",
275
+ adopt: "adopted",
276
+ apply: "applied",
277
+ approve: "approved",
278
+ approved: "approved",
279
+ archive: "archived",
280
+ arm: "armed",
281
+ assign: "assigned",
282
+ build: "built",
283
+ bump: "bumped",
284
+ cancel: "cancelled",
285
+ change: "changed",
286
+ cleanup: "cleaned up",
287
+ clear: "cleared",
288
+ clone: "cloned",
289
+ complete: "completed",
290
+ copy: "copied",
291
+ create: "created",
292
+ created: "created",
293
+ decline: "declined",
294
+ declined: "declined",
295
+ delete: "deleted",
296
+ deploy: "deployed",
297
+ deprovision: "deprovisioned",
298
+ disable: "disabled",
299
+ disarm: "disarmed",
300
+ dismiss: "dismissed",
301
+ download: "downloaded",
302
+ draft: "drafted",
303
+ drop: "dropped",
304
+ edit: "edited",
305
+ enable: "enabled",
306
+ end: "ended",
307
+ execute: "ran",
308
+ export: "exported",
309
+ fail: "failed",
310
+ failed: "failed",
311
+ fix: "fixed",
312
+ generate: "generated",
313
+ grant: "granted",
314
+ granted: "granted",
315
+ hold: "put on hold",
316
+ import: "imported",
317
+ install: "installed",
318
+ issue: "issued",
319
+ join: "joined",
320
+ kill: "stopped",
321
+ link: "linked",
322
+ merge: "merged",
323
+ move: "moved",
324
+ name: "named",
325
+ nullify: "cleared",
326
+ offboard: "offboarded",
327
+ open: "opened",
328
+ override: "overrode",
329
+ pause: "paused",
330
+ place: "placed",
331
+ preview: "previewed",
332
+ promote: "promoted",
333
+ provision: "provisioned",
334
+ prune: "pruned",
335
+ publish: "published",
336
+ purge: "purged",
337
+ queue: "queued",
338
+ read: "read",
339
+ reassign: "reassigned",
340
+ recalc: "recalculated",
341
+ redact: "redacted",
342
+ regenerate: "regenerated",
343
+ rehearse: "rehearsed",
344
+ reject: "rejected",
345
+ rejected: "rejected",
346
+ release: "released",
347
+ remediate: "fixed",
348
+ remove: "removed",
349
+ rename: "renamed",
350
+ render: "rendered",
351
+ reorder: "reordered",
352
+ replay: "replayed",
353
+ reply: "replied to",
354
+ request: "requested",
355
+ requeue: "requeued",
356
+ rerun: "re-ran",
357
+ resend: "resent",
358
+ reset: "reset",
359
+ resolve: "resolved",
360
+ restore: "restored",
361
+ resume: "resumed",
362
+ retry: "retried",
363
+ revert: "reverted",
364
+ review: "reviewed",
365
+ revoke: "revoked",
366
+ rollback: "rolled back",
367
+ run: "ran",
368
+ save: "saved",
369
+ schedule: "scheduled",
370
+ send: "sent",
371
+ set: "set",
372
+ share: "shared",
373
+ skip: "skipped",
374
+ snooze: "snoozed",
375
+ split: "split",
376
+ start: "started",
377
+ stop: "stopped",
378
+ subscribe: "subscribed to",
379
+ suspend: "suspended",
380
+ swap: "swapped",
381
+ sync: "synced",
382
+ toggle: "toggled",
383
+ undo: "undid",
384
+ uninstall: "uninstalled",
385
+ unpublish: "unpublished",
386
+ unsubscribe: "unsubscribed from",
387
+ update: "updated",
388
+ updated: "updated",
389
+ upload: "uploaded",
390
+ view: "viewed"
391
+ }, re = /* @__PURE__ */ new Set([
392
+ "add",
393
+ "build",
394
+ "create",
395
+ "created",
396
+ "draft",
397
+ "generate",
398
+ "issue",
399
+ "place",
400
+ "queue",
401
+ "request",
402
+ "save",
403
+ "schedule",
404
+ "upload"
405
+ ]);
406
+ function J(e) {
407
+ const n = P(e).map((c) => c.toLowerCase());
408
+ if (n.length === 0) return { verb: null, past: null, noun: "" };
409
+ 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) {
422
+ const n = /(\d[\d,]*)\s+rows?/i.exec(e), t = /^\s*(csv|xlsx|json|pdf|xml)\b/i.exec(e);
423
+ return {
424
+ rows: n ? Number(n[1].replace(/,/g, "")) : null,
425
+ format: t ? q[t[1].toLowerCase()] ?? t[1].toUpperCase() : null
426
+ };
427
+ }
428
+ const U = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
429
+ function se(e, n) {
430
+ 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}` : "";
432
+ if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
433
+ const l = i(e.event.to_label);
434
+ return `started ${r ?? "the pipeline"}${l ? ` in ${l}` : ""}`;
435
+ }
436
+ if (((h = e.event) == null ? void 0 : h.kind) === "transition" || U.has(t)) {
437
+ const l = e.event ? {
438
+ from: i(e.event.from_label) || null,
439
+ to: i(e.event.to_label) || null,
440
+ 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";
442
+ 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
+ }
444
+ switch (t) {
445
+ case "create":
446
+ case "o2m-create":
447
+ return t === "o2m-create" ? `added related rows${u}` : o === "nivaro_settings" ? "saved the settings" : `created ${r ?? c}`;
448
+ case "update":
449
+ 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)) {
455
+ 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})` : ""}`;
457
+ }
458
+ if (l.length) {
459
+ 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}`;
461
+ }
462
+ return `updated ${r ?? c}`;
463
+ }
464
+ case "delete":
465
+ case "o2m-delete":
466
+ return t === "o2m-delete" ? `removed related rows${u}` : `deleted ${r ?? c}`;
467
+ case "restore":
468
+ return `restored ${r ?? c}`;
469
+ case "pipeline-start": {
470
+ const l = /initial state:\s*(.+)$/i.exec(a);
471
+ return `started ${r ?? "the pipeline"}${l ? ` in ${l[1]}` : ""}`;
472
+ }
473
+ case "login":
474
+ return "signed in";
475
+ case "logout":
476
+ return "signed out";
477
+ case "login-refused":
478
+ return "was refused sign-in";
479
+ 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}` : ""}`;
482
+ }
483
+ case "masquerade-start":
484
+ return `started viewing as ${w(e, n, a)}`;
485
+ case "masquerade-stop":
486
+ return `stopped viewing as ${w(e, n, a)}`;
487
+ case "token.generate":
488
+ return `generated a static token for ${w(e, n, "")}`;
489
+ case "token.revoke":
490
+ return `revoked the static token of ${w(e, n, "")}`;
491
+ case "api_key_created":
492
+ return `created ${r && r !== S ? r : "an API key"}`;
493
+ case "api_key_revoked":
494
+ return `revoked ${r && r !== S ? r : "an API key"}`;
495
+ case "api_key_deleted":
496
+ return `deleted ${r && r !== S ? r : "an API key"}`;
497
+ case "api_key_simulate":
498
+ return `tested requests as ${r && r !== S ? r : "an API key"}`;
499
+ case "set_role":
500
+ return `changed the role of ${w(e, n, "")}`;
501
+ case "bulk-write":
502
+ 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;
504
+ return A ? `ran “${A[1]}” on ${p}` : `changed ${p} in bulk`;
505
+ }
506
+ case "import-create":
507
+ case "import-queue":
508
+ return `started an import into ${g(s.plural)}`;
509
+ case "import-complete":
510
+ return `finished an import into ${g(s.plural)}${a ? ` (${a})` : ""}`;
511
+ case "import-failed":
512
+ return `had an import into ${g(s.plural)} fail`;
513
+ case "comment":
514
+ return `commented${u}`;
515
+ case "picker-exclude":
516
+ return `hid ${r ?? c} from pickers`;
517
+ case "picker-include":
518
+ return `showed ${r ?? c} in pickers again`;
519
+ case "ai-brief":
520
+ return "asked the assistant for a brief";
521
+ case "config-epoch":
522
+ return "changed the configuration";
523
+ case "config-snapshot-store":
524
+ return "saved a configuration restore point";
525
+ case "config-snapshot-export":
526
+ return "downloaded a configuration snapshot";
527
+ }
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}`;
531
+ }
532
+ function w(e, n, t) {
533
+ const o = i(e.item), r = C(o, n) ?? (t || null);
534
+ if (r) return r;
535
+ const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
536
+ return s && !F.test(o) ? s : "someone";
537
+ }
538
+ function ae(e, n) {
539
+ return `${Y(e, n)} ${se(e, n)}`;
540
+ }
541
+ function pe(e) {
542
+ var a, u, d, f;
543
+ 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 };
548
+ }
549
+ const ce = 6e4;
550
+ function E(e) {
551
+ return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
552
+ }
553
+ function W(e) {
554
+ const n = O(e);
555
+ return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
556
+ }
557
+ function ue(e) {
558
+ const n = i(e.action);
559
+ return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
560
+ }
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
+ continue;
570
+ }
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";
573
+ continue;
574
+ }
575
+ }
576
+ o.push({ key: `${a || "e"}:${r.id ?? o.length}`, entries: [r], by: null });
577
+ }
578
+ return o;
579
+ }
580
+ function me(e, n) {
581
+ 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))
586
+ );
587
+ if ($.size !== 1) return `${r} made ${t.length} changes to ${d}`;
588
+ const h = [...$][0];
589
+ if (h === "transition") {
590
+ const m = new Set(
591
+ t.map((l) => {
592
+ var p;
593
+ return i(((p = l.event) == null ? void 0 : p.to_label) ?? M(l.comment).to);
594
+ })
595
+ ), _ = m.size === 1 ? [...m][0] : "";
596
+ return `${r} moved ${d}${_ ? ` to ${_}` : ""}${f}`;
597
+ }
598
+ if (h === "update") {
599
+ const m = de(t, c, n);
600
+ return `${r} updated ${d}${f}${m ? `: ${m}` : ""}`;
601
+ }
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
+ 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) : "";
615
+ }
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)}`
620
+ ).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
+ };
630
+ 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)) {
636
+ const $ = i(a.collection);
637
+ $ && o.set(`${$}.${f}`, { collection: $, field: f });
638
+ }
639
+ }
640
+ return {
641
+ refs: [...n.values()],
642
+ users: [...t],
643
+ fields: [...o.values()],
644
+ collections: [...r]
645
+ };
646
+ }
647
+ export {
648
+ ce as BURST_WINDOW_MS,
649
+ 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,
665
+ I as recordPhrase,
666
+ me as renderActivityGroupSentence,
667
+ ae as renderActivitySentence,
668
+ K as valueShowable,
669
+ B as valueText
670
+ };