@feedmepos/mf-hrm-portal 2.3.0-dev.5 → 2.3.0-dev.6

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 (37) hide show
  1. package/dist/{ApprovalCodeList-DIqLkR-n.js → ApprovalCodeList-Cf1l-ult.js} +2 -2
  2. package/dist/AuditLogList-D1sMrERs.js +1951 -0
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-DtIAcKaZ.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BdbfGDI_.js} +2 -2
  4. package/dist/{EmployeeList-BcommHHe.js → EmployeeList-sc773luN.js} +4 -4
  5. package/dist/{GrantUserList-zYXWPBy8.js → GrantUserList-2XTroUF8.js} +3 -3
  6. package/dist/{Main-D8Uz1Mlf.js → Main-BIo4YcWF.js} +2 -2
  7. package/dist/{Main-BbLYXl-C.js → Main-BNCfG0Sg.js} +5 -5
  8. package/dist/{Main-D1Rc3l1L.js → Main-CCGYrZsD.js} +9 -9
  9. package/dist/{PermissionSetList-DB27fd5Q.js → PermissionSetList-7Ut1F99N.js} +5 -5
  10. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-B1l2xUpn.js +4167 -0
  11. package/dist/{RoleList-DqH-J2Di.js → RoleList-DMKdy74J.js} +7 -7
  12. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-Dk5KTJmM.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-CI94gSkp.js} +1 -1
  13. package/dist/{ScheduleGeneralPage-C6fHvARq.js → ScheduleGeneralPage-DGdnq7oV.js} +4 -4
  14. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-B-rR81nv.js → ScheduleModal.vue_vue_type_script_setup_true_lang-Cq-zMPW_.js} +1 -1
  15. package/dist/{SchedulePage-CqpoSfUn.js → SchedulePage-B7M5fPIA.js} +6 -6
  16. package/dist/{SchedulePositionPage-NMdwzGfm.js → SchedulePositionPage-DeorKiCc.js} +3 -3
  17. package/dist/{TeamMemberList-CX0qHVRT.js → TeamMemberList-CQswHBEk.js} +6 -6
  18. package/dist/{TimesheetList-DUK2sUEN.js → TimesheetList-lWsJuha_.js} +5 -5
  19. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-m8Ml-b47.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-CLgmz6LT.js} +2 -2
  20. package/dist/{app-CLTLqZhG.js → app-MTWSOw4U.js} +452 -216
  21. package/dist/app.js +1 -1
  22. package/dist/{dayjs.min-BFtQINpX.js → dayjs.min-9rM_szda.js} +1 -1
  23. package/dist/{employee-CWjZhmcu.js → employee-BvtW9sI6.js} +3 -3
  24. package/dist/{iteration-NQ4DY9De.js → iteration-Byna7hj1.js} +1 -1
  25. package/dist/{lodash-OAOy_WpD.js → lodash-CnwRhwQm.js} +1 -1
  26. package/dist/{role-DSSFv8cl.js → role-N_-ZZfhy.js} +1 -1
  27. package/dist/{rule-DY7yg9_a.js → rule-B9-ryqfq.js} +2 -2
  28. package/dist/src/api/audit-log/index.d.ts +4 -0
  29. package/dist/src/views/audit-log/constants.d.ts +9 -30
  30. package/dist/src/views/audit-log/locales/index.d.ts +236 -0
  31. package/dist/src/views/audit-log/pos-row.d.ts +27 -0
  32. package/dist/style.css +1 -1
  33. package/dist/tsconfig.app.tsbuildinfo +1 -1
  34. package/dist/{useReportPermissions-BRs-yhSQ.js → useReportPermissions-BSOsfpnM.js} +3 -3
  35. package/package.json +1 -1
  36. package/dist/AuditLogList-DOrq5WAM.js +0 -1779
  37. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DtVJW54V.js +0 -4167
@@ -0,0 +1,1951 @@
1
+ import { defineComponent as Vt, ref as S, computed as I, onMounted as Eo, onBeforeUnmount as No, watch as ie, resolveComponent as N, createElementBlock as v, openBlock as f, createBlock as Oe, createCommentVNode as F, createElementVNode as a, Fragment as z, renderList as ce, withCtx as Y, createVNode as g, toDisplayString as l, unref as u, nextTick as Ro, onUnmounted as Uo, createTextVNode as Ae, normalizeClass as Ko } from "vue";
2
+ import { d as O } from "./dayjs.min-9rM_szda.js";
3
+ import { defineStore as Bo, storeToRefs as Yo } from "pinia";
4
+ import { useI18n as $t, useCoreStore as zo } from "@feedmepos/mf-common";
5
+ import { B as Ft, _ as qo } from "./app-MTWSOw4U.js";
6
+ import { components as ve } from "@feedmepos/ui-library";
7
+ import { g as st, b as at, u as Jo } from "./restaurant-D7PEQjPY.js";
8
+ import { S as Fe } from "./SelectFilter-CG13h83-.js";
9
+ import { _ as Ho } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
10
+ import { _ as Wo } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
11
+ import { t as Go, p as Mt } from "./rule-B9-ryqfq.js";
12
+ import { u as Xo } from "./useDebounce-B8ZPVS5C.js";
13
+ import { n as Qo } from "./string-VNuQNweN.js";
14
+ import { _ as Zo } from "./_plugin-vue_export-helper-CHgC5LLL.js";
15
+ const es = {
16
+ order: "Order",
17
+ refund: "Refund",
18
+ drawer: "Cash drawer",
19
+ menu: "Menu",
20
+ inventory: "Inventory",
21
+ deposit: "Deposit",
22
+ delivery: "Delivery",
23
+ counterRecord: "Counter",
24
+ counter: "Counter",
25
+ restaurantSetting: "Restaurant settings",
26
+ display: "Display",
27
+ printer: "Printer",
28
+ table: "Table",
29
+ employee: "Employee",
30
+ system: "System",
31
+ tax: "Tax",
32
+ paymentType: "Payment type",
33
+ faceId: "Face ID",
34
+ mallIntegration: "Mall integration",
35
+ report: "Report"
36
+ }, Me = [
37
+ { key: "all", label: "All", subjectPrefixes: [] },
38
+ { key: "inventory", label: "Inventory", subjectPrefixes: ["business::inventory", "inventory"], sources: ["portal"] },
39
+ { key: "report", label: "Report", subjectPrefixes: ["business::report", "report"], sources: ["portal"] },
40
+ { key: "hrm", label: "HRM", subjectPrefixes: ["business::hrm", "hrm"], sources: ["portal"] },
41
+ { key: "payment", label: "Payment", subjectPrefixes: ["business::payment", "payment"], sources: ["portal"] },
42
+ { key: "menu", label: "Menu", subjectPrefixes: ["business::menu", "menu"], sources: ["portal"] },
43
+ { key: "crm", label: "CRM", subjectPrefixes: ["business::crm", "crm"], sources: ["portal"] },
44
+ { key: "pos", label: "POS", subjectPrefixes: [], sources: ["pos-v8", "hrm-validate"] }
45
+ ], nt = "/audit-logs", Ke = {
46
+ async count(t) {
47
+ var r, d, h, b, y, A, C, i, V;
48
+ const o = {
49
+ ...t != null && t.from ? { from: t.from } : {},
50
+ ...t != null && t.to ? { to: t.to } : {},
51
+ ...(r = t == null ? void 0 : t.userIds) != null && r.length ? { userIds: t.userIds } : {},
52
+ ...(d = t == null ? void 0 : t.subjects) != null && d.length ? { subjects: t.subjects } : {},
53
+ ...(h = t == null ? void 0 : t.subjectPrefixes) != null && h.length ? { subjectPrefixes: t.subjectPrefixes } : {},
54
+ ...(b = t == null ? void 0 : t.actions) != null && b.length ? { actions: t.actions } : {},
55
+ ...(y = t == null ? void 0 : t.outcomes) != null && y.length ? { outcomes: t.outcomes } : {},
56
+ ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
57
+ ...t != null && t.search ? { search: t.search } : {},
58
+ ...(A = t == null ? void 0 : t.searchUserIds) != null && A.length ? { searchUserIds: t.searchUserIds } : {},
59
+ ...(C = t == null ? void 0 : t.searchSubjects) != null && C.length ? { searchSubjects: t.searchSubjects } : {},
60
+ ...(i = t == null ? void 0 : t.sources) != null && i.length ? { sources: t.sources } : {},
61
+ ...(V = t == null ? void 0 : t.restaurantIds) != null && V.length ? { restaurantIds: t.restaurantIds } : {}
62
+ };
63
+ return (await st(
64
+ await at().get(`${nt}/count`, {
65
+ params: o,
66
+ paramsSerializer: (R) => {
67
+ const m = new URLSearchParams();
68
+ for (const [w, j] of Object.entries(R))
69
+ if (Array.isArray(j))
70
+ for (const T of j) m.append(w, String(T));
71
+ else j != null && m.append(w, String(j));
72
+ return m.toString();
73
+ }
74
+ })
75
+ )).total;
76
+ },
77
+ async read(t) {
78
+ var n, r, d, h, b, y, A, C, i;
79
+ const o = {
80
+ limit: (t == null ? void 0 : t.limit) ?? 100,
81
+ offset: (t == null ? void 0 : t.offset) ?? 0,
82
+ ...t != null && t.from ? { from: t.from } : {},
83
+ ...t != null && t.to ? { to: t.to } : {},
84
+ ...(n = t == null ? void 0 : t.userIds) != null && n.length ? { userIds: t.userIds } : {},
85
+ ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
86
+ ...(r = t == null ? void 0 : t.subjects) != null && r.length ? { subjects: t.subjects } : {},
87
+ ...(d = t == null ? void 0 : t.subjectPrefixes) != null && d.length ? { subjectPrefixes: t.subjectPrefixes } : {},
88
+ ...(h = t == null ? void 0 : t.actions) != null && h.length ? { actions: t.actions } : {},
89
+ ...(b = t == null ? void 0 : t.outcomes) != null && b.length ? { outcomes: t.outcomes } : {},
90
+ ...t != null && t.search ? { search: t.search } : {},
91
+ ...(y = t == null ? void 0 : t.searchUserIds) != null && y.length ? { searchUserIds: t.searchUserIds } : {},
92
+ ...(A = t == null ? void 0 : t.searchSubjects) != null && A.length ? { searchSubjects: t.searchSubjects } : {},
93
+ ...(C = t == null ? void 0 : t.sources) != null && C.length ? { sources: t.sources } : {},
94
+ ...(i = t == null ? void 0 : t.restaurantIds) != null && i.length ? { restaurantIds: t.restaurantIds } : {}
95
+ };
96
+ return st(
97
+ await at().get(nt, {
98
+ params: o,
99
+ // Serialize arrays as repeated params: key=val1&key=val2
100
+ // (NestJS @Query expects this; axios default adds brackets which break matching)
101
+ paramsSerializer: (V) => {
102
+ const R = new URLSearchParams();
103
+ for (const [m, w] of Object.entries(V))
104
+ if (Array.isArray(w))
105
+ for (const j of w) R.append(m, String(j));
106
+ else w != null && R.append(m, String(w));
107
+ return R.toString();
108
+ }
109
+ })
110
+ );
111
+ },
112
+ /**
113
+ * FeedMe-admin options for the User filter. `actors` is the named admin list (internal
114
+ * viewers only; empty for merchants). `showFeedmeAdminFilter` indicates whether to offer
115
+ * the "FeedMe Admin" catch-all (only when the business has relevant admin activity).
116
+ */
117
+ async getFeedmeAdminFilter(t) {
118
+ const o = {
119
+ ...t != null && t.from ? { from: t.from } : {},
120
+ ...t != null && t.to ? { to: t.to } : {}
121
+ };
122
+ return st(
123
+ await at().get(`${nt}/actors`, { params: o })
124
+ );
125
+ }
126
+ }, ts = { class: "flex h-[46px] items-center gap-8 rounded-sm px-16 hover:bg-fm-color-opacity-sm" }, os = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ss = {
127
+ "data-more-measure": "",
128
+ class: "flex h-[46px] items-center gap-8 rounded-sm px-16"
129
+ }, as = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ns = /* @__PURE__ */ Vt({
130
+ __name: "AuditLogModuleTabs",
131
+ props: {
132
+ modelValue: {},
133
+ items: {}
134
+ },
135
+ emits: ["update:modelValue"],
136
+ setup(t, { emit: o }) {
137
+ const n = t, r = o, { t: d } = $t(), h = S(!1), b = S(null), y = S(null), A = S([]), C = S(0), i = S(0);
138
+ let V = null;
139
+ async function R() {
140
+ if (await Ro(), !y.value) return;
141
+ const _ = y.value.querySelectorAll("[data-tab-measure]");
142
+ A.value = Array.from(_).map((B) => B.offsetWidth);
143
+ const D = y.value.querySelector("[data-more-measure]");
144
+ C.value = (D == null ? void 0 : D.offsetWidth) ?? 0;
145
+ }
146
+ const m = I(() => {
147
+ const _ = n.items.length;
148
+ if (_ === 0) return 0;
149
+ if (!i.value || A.value.length !== _) return _;
150
+ const D = A.value;
151
+ if (D.reduce((k, X) => k + X, 0) <= i.value) return _;
152
+ const P = C.value;
153
+ let H = 0, U = 0;
154
+ for (let k = 0; k < _ && !(H + D[k] + P > i.value); k++)
155
+ H += D[k], U++;
156
+ return U;
157
+ }), w = I(() => {
158
+ const _ = m.value, D = n.items.length;
159
+ if (_ >= D) return [...n.items];
160
+ const B = n.items.slice(0, _), P = n.items.find((W) => W.value === n.modelValue);
161
+ if (!P || B.some((W) => W.value === P.value)) return B;
162
+ if (_ === 0) return [P];
163
+ const H = n.items.findIndex((W) => W.value === P.value), U = A.value, k = C.value, X = U[H] ?? 0;
164
+ let ue = _, je = U.slice(0, ue - 1).reduce((W, _e) => W + _e, 0);
165
+ for (; ue > 1 && je + X + k > i.value; )
166
+ ue--, je = U.slice(0, ue - 1).reduce((W, _e) => W + _e, 0);
167
+ return [...n.items.slice(0, Math.max(ue - 1, 0)), P];
168
+ }), j = I(() => {
169
+ const _ = new Set(w.value.map((D) => D.value));
170
+ return n.items.filter((D) => !_.has(D.value));
171
+ });
172
+ function T(_) {
173
+ h.value = !1, r("update:modelValue", _);
174
+ }
175
+ return Eo(async () => {
176
+ await R(), b.value && (i.value = b.value.clientWidth, V = new ResizeObserver(() => {
177
+ b.value && (i.value = b.value.clientWidth);
178
+ }), V.observe(b.value));
179
+ }), No(() => {
180
+ V == null || V.disconnect(), V = null;
181
+ }), ie(
182
+ () => n.items,
183
+ () => {
184
+ R();
185
+ },
186
+ { deep: !0 }
187
+ ), (_, D) => {
188
+ const B = N("FmTab"), P = N("FmIcon"), H = N("FmMenuItem"), U = N("FmMenu");
189
+ return f(), v("div", {
190
+ ref_key: "containerRef",
191
+ ref: b,
192
+ class: "relative flex w-full flex-row items-center"
193
+ }, [
194
+ (f(!0), v(z, null, ce(w.value, (k) => (f(), Oe(B, {
195
+ key: k.value,
196
+ "model-value": t.modelValue,
197
+ label: k.label,
198
+ badge: k.badge,
199
+ disabled: k.disabled,
200
+ value: k.value,
201
+ "onUpdate:modelValue": T
202
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"]))), 128)),
203
+ j.value.length > 0 ? (f(), Oe(U, {
204
+ key: 0,
205
+ "show-menu": h.value,
206
+ class: "max-w-[360px] min-w-[90px] rounded-sm",
207
+ placement: "bottom-start",
208
+ onMenuChanged: D[0] || (D[0] = (k) => h.value = k)
209
+ }, {
210
+ "menu-button": Y(() => [
211
+ a("div", ts, [
212
+ g(P, { name: "more_vert" }),
213
+ a("span", os, l(u(d)("auditLog.modules.more")), 1)
214
+ ])
215
+ ]),
216
+ default: Y(() => [
217
+ (f(!0), v(z, null, ce(j.value, (k) => (f(), Oe(H, {
218
+ key: k.value,
219
+ "model-value": t.modelValue === k.value,
220
+ label: k.label,
221
+ disabled: k.disabled,
222
+ onClick: (X) => T(k.value)
223
+ }, null, 8, ["model-value", "label", "disabled", "onClick"]))), 128))
224
+ ]),
225
+ _: 1
226
+ }, 8, ["show-menu"])) : F("", !0),
227
+ a("div", {
228
+ ref_key: "measurerRef",
229
+ ref: y,
230
+ "aria-hidden": "true",
231
+ class: "pointer-events-none invisible absolute -left-[9999px] -top-[9999px] flex flex-row items-center"
232
+ }, [
233
+ (f(!0), v(z, null, ce(t.items, (k) => (f(), v("div", {
234
+ key: `measure-${k.value}`,
235
+ "data-tab-measure": ""
236
+ }, [
237
+ g(B, {
238
+ "model-value": t.modelValue,
239
+ label: k.label,
240
+ badge: k.badge,
241
+ disabled: k.disabled,
242
+ value: k.value
243
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"])
244
+ ]))), 128)),
245
+ a("div", ss, [
246
+ g(P, { name: "more_vert" }),
247
+ a("span", as, l(u(d)("auditLog.modules.more")), 1)
248
+ ])
249
+ ], 512)
250
+ ], 512);
251
+ };
252
+ }
253
+ }), ls = Bo("team", () => {
254
+ const t = S([]), o = S(!1), n = S(!1), r = I(
255
+ () => Object.fromEntries(t.value.map((y) => [y.doc.userId, y.name]))
256
+ ), d = I(
257
+ () => Object.fromEntries(t.value.map((y) => [y.doc.userId, y.email]))
258
+ ), h = I(
259
+ () => Object.fromEntries(t.value.map((y) => [y.doc.userId, y.phoneNumber]))
260
+ );
261
+ async function b({ force: y = !1 } = {}) {
262
+ if (!(!y && t.value.length > 0))
263
+ try {
264
+ o.value = !0;
265
+ const A = await Go.readTeamMembers();
266
+ t.value = A.sort((C, i) => C.doc.isOwner ? -1 : C.name.localeCompare(i.name)), n.value = !0;
267
+ } finally {
268
+ o.value = !1;
269
+ }
270
+ }
271
+ return {
272
+ members: t,
273
+ isLoading: o,
274
+ hasLoaded: n,
275
+ userIdToName: r,
276
+ userIdToEmail: d,
277
+ userIdToPhone: h,
278
+ readTeamMembers: b
279
+ };
280
+ });
281
+ function rs(t) {
282
+ const o = t.indexOf(".");
283
+ return o <= 0 || o === t.length - 1 ? null : { entity: t.slice(0, o), verb: t.slice(o + 1) };
284
+ }
285
+ function Dt(t) {
286
+ const o = t.split("-").join(" ");
287
+ return o.charAt(0).toUpperCase() + o.slice(1);
288
+ }
289
+ function is(t, o, n) {
290
+ const r = t(o, n);
291
+ return r === o ? null : r;
292
+ }
293
+ function ut(t, o) {
294
+ const { eventKey: n, params: r, operationLabel: d } = o;
295
+ if (n) {
296
+ const h = is(t, `auditLog.event.sentence.${n}`, r);
297
+ if (h) return h;
298
+ const b = rs(n);
299
+ if (b) {
300
+ const y = `${Dt(b.verb)} ${Dt(b.entity)}`, A = (r == null ? void 0 : r.label) ?? (r == null ? void 0 : r.name);
301
+ return A !== void 0 && A !== "" ? `${y} — ${A}` : y;
302
+ }
303
+ }
304
+ return d ?? "";
305
+ }
306
+ function be(t) {
307
+ return typeof t == "object" && t !== null && !Array.isArray(t);
308
+ }
309
+ function Ce(t) {
310
+ return Array.isArray(t);
311
+ }
312
+ function Be(t) {
313
+ if (t === null) return "null";
314
+ if (typeof t == "object")
315
+ try {
316
+ return JSON.stringify(t);
317
+ } catch {
318
+ return String(t);
319
+ }
320
+ return String(t);
321
+ }
322
+ function us(t, o) {
323
+ return t ? `${t}.${o}` : o;
324
+ }
325
+ function Ot(t) {
326
+ if (typeof t != "string") return { ok: !1, value: void 0 };
327
+ const o = t.trim();
328
+ if (!o.startsWith("{") && !o.startsWith("[")) return { ok: !1, value: void 0 };
329
+ try {
330
+ const n = JSON.parse(o);
331
+ return be(n) || Ce(n) ? { ok: !0, value: n } : { ok: !1, value: void 0 };
332
+ } catch {
333
+ return { ok: !1, value: void 0 };
334
+ }
335
+ }
336
+ const ds = ["_id", "id", "subject", "key", "name"];
337
+ function cs(t, o) {
338
+ if (t.length === 0 || o.length === 0) return null;
339
+ const n = (d, h) => d.every((b) => be(b) && b[h] !== void 0), r = (d, h) => {
340
+ const b = d.map((y) => y[h]);
341
+ return b.length === new Set(b).size;
342
+ };
343
+ for (const d of ds)
344
+ if (n(t, d) && n(o, d) && r(t, d) && r(o, d))
345
+ return d;
346
+ return null;
347
+ }
348
+ function Pt(t, o, n) {
349
+ n.push({ path: t, type: "added", before: null, after: Be(o) });
350
+ }
351
+ function Et(t, o, n) {
352
+ n.push({ path: t, type: "removed", before: Be(o), after: null });
353
+ }
354
+ function fs(t, o, n, r) {
355
+ const d = /* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(n)]);
356
+ for (const h of Array.from(d)) {
357
+ const b = Object.prototype.hasOwnProperty.call(o, h), y = Object.prototype.hasOwnProperty.call(n, h);
358
+ Ye(us(t, h), o[h], b, n[h], y, r);
359
+ }
360
+ }
361
+ function ms(t, o, n, r) {
362
+ const d = cs(o, n);
363
+ if (d) {
364
+ const m = new Map(
365
+ o.map((_) => [_[d], _])
366
+ ), w = new Map(
367
+ n.map((_) => [_[d], _])
368
+ ), j = Array.from(m.keys()).concat(Array.from(w.keys())), T = Array.from(new Set(j));
369
+ for (const _ of T) {
370
+ const D = m.has(_), B = w.has(_), P = `${t}[${String(_)}]`;
371
+ Ye(
372
+ P,
373
+ m.get(_),
374
+ D,
375
+ w.get(_),
376
+ B,
377
+ r
378
+ );
379
+ }
380
+ return;
381
+ }
382
+ const h = o.map((m, w) => ({ sig: JSON.stringify(m), idx: w, item: m })), b = n.map((m, w) => ({ sig: JSON.stringify(m), idx: w, item: m })), y = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
383
+ for (const m of h)
384
+ y.has(m.sig) || y.set(m.sig, []), y.get(m.sig).push(m);
385
+ for (const m of b)
386
+ A.has(m.sig) || A.set(m.sig, []), A.get(m.sig).push(m);
387
+ const C = [], i = [], V = Array.from(y.keys()).concat(Array.from(A.keys())), R = Array.from(new Set(V));
388
+ for (const m of R) {
389
+ const w = y.get(m) || [], j = A.get(m) || [], T = Math.min(w.length, j.length);
390
+ for (let _ = T; _ < w.length; _++)
391
+ C.push({ idx: w[_].idx, item: w[_].item });
392
+ for (let _ = T; _ < j.length; _++)
393
+ i.push({ idx: j[_].idx, item: j[_].item });
394
+ }
395
+ for (const { idx: m, item: w } of C)
396
+ Et(`${t}[${m}]`, w, r);
397
+ for (const { idx: m, item: w } of i)
398
+ Pt(`${t}[${m}]`, w, r);
399
+ }
400
+ function Ye(t, o, n, r, d, h) {
401
+ if (!n && !d) return;
402
+ if (n && !d) {
403
+ Et(t, o, h);
404
+ return;
405
+ }
406
+ if (!n && d) {
407
+ Pt(t, r, h);
408
+ return;
409
+ }
410
+ if (JSON.stringify(o) === JSON.stringify(r)) return;
411
+ if (be(o) && be(r)) {
412
+ fs(t, o, r, h);
413
+ return;
414
+ }
415
+ if (Ce(o) && Ce(r)) {
416
+ ms(t, o, r, h);
417
+ return;
418
+ }
419
+ const b = Ot(o), y = Ot(r);
420
+ if (b.ok && y.ok) {
421
+ Ye(t, b.value, !0, y.value, !0, h);
422
+ return;
423
+ }
424
+ h.push({
425
+ path: t,
426
+ type: "changed",
427
+ before: Be(o),
428
+ after: Be(r)
429
+ });
430
+ }
431
+ function vs(t, o) {
432
+ if (JSON.stringify(t) === JSON.stringify(o)) return [];
433
+ const n = t == null, r = o == null;
434
+ let d = t;
435
+ n && (be(o) ? d = {} : Ce(o) && (d = []));
436
+ let h = o;
437
+ r && (be(t) ? h = {} : Ce(t) && (h = []));
438
+ const b = [];
439
+ return Ye("", d, !0, h, !0, b), b;
440
+ }
441
+ function Ct(t) {
442
+ const o = t.operations;
443
+ return !o || o.length === 0 ? !1 : o.some((n) => n.status === "failed");
444
+ }
445
+ function lt(t, o) {
446
+ var d, h;
447
+ if (t.source === "hrm-validate") return o("auditLog.pos.device.posV7");
448
+ const n = (h = (d = t.metadata) == null ? void 0 : d.pos) == null ? void 0 : h.posMode, r = t.deviceId || "-";
449
+ return n ? `${r} · ${o(`auditLog.pos.mode.${n}`)}` : r;
450
+ }
451
+ function ps(t, o) {
452
+ var r;
453
+ const n = t.actorName || t.userId || "-";
454
+ return ((r = t.metadata) == null ? void 0 : r.actorKnown) === !1 ? `${n} (${o("auditLog.pos.unverified")})` : n;
455
+ }
456
+ function jt(t, o) {
457
+ var d;
458
+ const n = t.approverName || t.approverId;
459
+ if (!n)
460
+ return t.source === "hrm-validate" ? o("auditLog.pos.viaCode") : "-";
461
+ const r = ((d = t.metadata) == null ? void 0 : d.approverKnown) === !1 ? `${n} (${o("auditLog.pos.unverified")})` : n;
462
+ return t.source === "hrm-validate" ? `${r} · ${o("auditLog.pos.viaCode")}` : r;
463
+ }
464
+ function gs(t, o) {
465
+ const n = t.approverName || t.approverId;
466
+ return n ? ` · ${o("auditLog.pos.approverInline", { name: n })}` : "";
467
+ }
468
+ function hs(t, o, n) {
469
+ return o || !(t != null && t.length) ? { userIds: [], feedmeAdminActors: !1 } : {
470
+ userIds: t.filter((r) => r !== n),
471
+ feedmeAdminActors: t.includes(n)
472
+ };
473
+ }
474
+ function ye(t) {
475
+ return t === void 0 ? "—" : Array.isArray(t) ? t.length > 0 ? t.join(", ") : "—" : t || "—";
476
+ }
477
+ function ys(t) {
478
+ return {
479
+ label: t.label,
480
+ labelKey: t.labelKey,
481
+ type: t.type,
482
+ beforeDisplay: ye(t.before),
483
+ afterDisplay: ye(t.after)
484
+ };
485
+ }
486
+ function bs(t) {
487
+ return Array.isArray(t) && t.length > 0;
488
+ }
489
+ function Nt(t, o, n) {
490
+ return n.labelKey && o(n.labelKey) ? t(n.labelKey) : n.label;
491
+ }
492
+ function Rt(t, o) {
493
+ return ut(t, o) || t("auditLog.operation.unlabeled");
494
+ }
495
+ function _s(t, o) {
496
+ return !o || o.length === 0 ? "" : o.map((n) => {
497
+ const r = Rt(t, n), d = t(`auditLog.outcome.${n.status}`);
498
+ let h = `${r}: ${d}`;
499
+ return n.status === "failed" && n.errorMessage && (h += ` — ${n.errorMessage}`), h;
500
+ }).join(`
501
+ `);
502
+ }
503
+ function xs(t, o, n) {
504
+ const r = Nt(t, o, n);
505
+ return n.type === "add" ? `${r}: + ${ye(n.after)}` : n.type === "remove" ? `${r}: - ${ye(n.before)}` : `${r}: ${ye(n.before)} → ${ye(n.after)}`;
506
+ }
507
+ function Ls(t, o, n) {
508
+ if (!n || n.length === 0) return "";
509
+ const r = n.filter((b) => b.changeNodes && b.changeNodes.length > 0);
510
+ if (r.length === 0) return "";
511
+ const d = r.length > 1;
512
+ return r.map((b) => {
513
+ const y = (b.changeNodes ?? []).map((A) => xs(t, o, A));
514
+ return d ? [`[${Rt(t, b)}]`, ...y].join(`
515
+ `) : y.join(`
516
+ `);
517
+ }).join(`
518
+ `);
519
+ }
520
+ const Ss = {
521
+ class: "flex flex-col gap-4 p-12 w-[260px]"
522
+ }, ks = {
523
+ class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
524
+ }, ws = {
525
+ class: "flex min-h-0 flex-1 flex-col gap-16"
526
+ }, Is = {
527
+ class: "space-y-16"
528
+ }, As = {
529
+ class: "flex flex-wrap items-center gap-8"
530
+ }, Fs = {
531
+ key: 0,
532
+ class: "w-fit"
533
+ }, Ms = {
534
+ key: 1,
535
+ class: "w-fit"
536
+ }, Ds = {
537
+ class: "w-fit"
538
+ }, Os = {
539
+ class: "w-fit"
540
+ }, Cs = {
541
+ key: 2,
542
+ class: "w-fit"
543
+ }, js = {
544
+ class: "flex h-full flex-col overflow-auto"
545
+ }, Ts = {
546
+ key: 0,
547
+ class: "space-y-12 p-4 text-sm"
548
+ }, Vs = {
549
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
550
+ }, $s = {
551
+ class: "min-w-0 flex-1"
552
+ }, Ps = {
553
+ class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
554
+ }, Es = {
555
+ key: 0,
556
+ class: "mt-4 break-all font-mono text-xs text-fm-color-typo-secondary"
557
+ }, Ns = {
558
+ key: 1,
559
+ class: "mt-2 break-all font-mono text-xs text-fm-color-typo-secondary"
560
+ }, Rs = {
561
+ class: "flex items-center gap-4"
562
+ }, Us = {
563
+ class: "rounded-lg border border-fm-color-border-default p-12"
564
+ }, Ks = {
565
+ class: "space-y-12"
566
+ }, Bs = {
567
+ class: "text-xs text-fm-color-typo-secondary"
568
+ }, Ys = {
569
+ class: "font-semibold"
570
+ }, zs = {
571
+ class: "text-xs text-fm-color-typo-secondary"
572
+ }, qs = {
573
+ class: "font-semibold"
574
+ }, Js = {
575
+ class: "text-xs text-fm-color-typo-secondary"
576
+ }, Hs = {
577
+ class: "break-all font-semibold"
578
+ }, Ws = {
579
+ key: 0
580
+ }, Gs = {
581
+ class: "text-xs text-fm-color-typo-secondary"
582
+ }, Xs = {
583
+ class: "break-all font-mono text-xs font-semibold"
584
+ }, Qs = {
585
+ class: "text-xs text-fm-color-typo-secondary"
586
+ }, Zs = {
587
+ class: "break-all font-mono text-xs font-semibold"
588
+ }, ea = {
589
+ class: "text-xs text-fm-color-typo-secondary"
590
+ }, ta = {
591
+ class: "font-semibold"
592
+ }, oa = {
593
+ class: "rounded-lg border border-fm-color-border-default"
594
+ }, sa = {
595
+ class: "p-12"
596
+ }, aa = {
597
+ class: "text-base font-bold text-fm-color-typo-primary"
598
+ }, na = {
599
+ class: "space-y-12 p-12"
600
+ }, la = {
601
+ class: "text-xs text-fm-color-typo-secondary"
602
+ }, ra = {
603
+ class: "font-semibold"
604
+ }, ia = {
605
+ class: "rounded-lg border border-fm-color-border-default"
606
+ }, ua = {
607
+ class: "p-12"
608
+ }, da = {
609
+ class: "text-base font-bold text-fm-color-typo-primary"
610
+ }, ca = {
611
+ class: "space-y-12 p-12"
612
+ }, fa = {
613
+ class: "text-xs text-fm-color-typo-secondary"
614
+ }, ma = {
615
+ class: "font-semibold"
616
+ }, va = {
617
+ key: 0
618
+ }, pa = {
619
+ class: "text-xs text-fm-color-typo-secondary"
620
+ }, ga = {
621
+ key: 0,
622
+ class: "font-semibold"
623
+ }, ha = {
624
+ key: 1,
625
+ class: "break-all font-mono text-xs text-fm-color-typo-secondary"
626
+ }, ya = {
627
+ key: 1
628
+ }, ba = {
629
+ class: "text-xs text-fm-color-typo-secondary"
630
+ }, _a = {
631
+ class: "font-semibold whitespace-pre-line"
632
+ }, xa = {
633
+ class: "text-xs text-fm-color-typo-secondary"
634
+ }, La = {
635
+ class: "font-semibold"
636
+ }, Sa = {
637
+ class: "text-xs text-fm-color-typo-secondary"
638
+ }, ka = {
639
+ class: "break-all font-mono text-xs font-semibold"
640
+ }, wa = {
641
+ class: "text-xs text-fm-color-typo-secondary"
642
+ }, Ia = {
643
+ class: "break-all font-mono text-xs font-semibold"
644
+ }, Aa = {
645
+ class: "text-xs text-fm-color-typo-secondary"
646
+ }, Fa = {
647
+ class: "font-semibold"
648
+ }, Ma = {
649
+ key: 0,
650
+ class: "break-all font-mono text-xs"
651
+ }, Da = {
652
+ key: 0
653
+ }, Oa = {
654
+ class: "text-xs text-fm-color-typo-secondary"
655
+ }, Ca = {
656
+ class: "font-semibold"
657
+ }, ja = {
658
+ class: "text-xs text-fm-color-typo-secondary"
659
+ }, Ta = {
660
+ class: "font-semibold"
661
+ }, Va = {
662
+ class: "text-xs text-fm-color-typo-secondary"
663
+ }, $a = {
664
+ class: "font-semibold"
665
+ }, Pa = {
666
+ key: 0
667
+ }, Ea = {
668
+ key: 1
669
+ }, Na = {
670
+ class: "text-xs text-fm-color-typo-secondary"
671
+ }, Ra = {
672
+ class: "whitespace-pre-wrap break-all font-mono text-xs"
673
+ }, Ua = {
674
+ key: 3
675
+ }, Ka = {
676
+ class: "text-xs text-fm-color-typo-secondary"
677
+ }, Ba = {
678
+ class: "mt-4 space-y-4"
679
+ }, Ya = {
680
+ class: "flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-fm-color-primary-default text-xs font-bold text-white"
681
+ }, za = {
682
+ class: "text-xs font-semibold"
683
+ }, qa = {
684
+ key: 0,
685
+ class: "text-fm-color-typo-secondary"
686
+ }, Ja = {
687
+ key: 4
688
+ }, Ha = {
689
+ class: "text-xs text-fm-color-typo-secondary"
690
+ }, Wa = {
691
+ class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
692
+ }, Ga = {
693
+ key: 0,
694
+ class: "space-y-12 p-4 text-sm"
695
+ }, Xa = {
696
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
697
+ }, Qa = {
698
+ class: "min-w-0 flex-1"
699
+ }, Za = {
700
+ class: "text-base font-bold leading-snug text-fm-color-typo-primary"
701
+ }, en = {
702
+ key: 0,
703
+ class: "text-xs text-fm-color-typo-secondary"
704
+ }, tn = {
705
+ class: "rounded-lg border border-fm-color-border-default p-12"
706
+ }, on = {
707
+ class: "space-y-12"
708
+ }, sn = {
709
+ class: "text-xs text-fm-color-typo-secondary"
710
+ }, an = {
711
+ class: "font-semibold"
712
+ }, nn = {
713
+ key: 0
714
+ }, ln = {
715
+ class: "text-xs text-fm-color-typo-secondary"
716
+ }, rn = {
717
+ class: "font-semibold"
718
+ }, un = {
719
+ key: 1
720
+ }, dn = {
721
+ class: "text-xs text-fm-color-typo-secondary"
722
+ }, cn = {
723
+ class: "font-semibold"
724
+ }, fn = {
725
+ key: 0,
726
+ class: "rounded-lg border border-fm-color-border-default p-12"
727
+ }, mn = {
728
+ class: "text-xs text-fm-color-typo-secondary"
729
+ }, vn = {
730
+ class: "whitespace-pre-line font-semibold text-fm-color-typo-error"
731
+ }, pn = {
732
+ class: "rounded-lg border border-fm-color-border-default"
733
+ }, gn = {
734
+ class: "p-12"
735
+ }, hn = {
736
+ class: "text-base font-bold text-fm-color-typo-primary"
737
+ }, yn = {
738
+ class: "p-12"
739
+ }, bn = {
740
+ key: 0,
741
+ class: "divide-y divide-fm-color-border-default"
742
+ }, _n = {
743
+ class: "flex flex-wrap items-center gap-8"
744
+ }, xn = {
745
+ class: "break-all text-xs"
746
+ }, Ln = {
747
+ class: "break-all font-mono text-xs"
748
+ }, Sn = {
749
+ key: 0,
750
+ class: "text-fm-color-typo-success"
751
+ }, kn = {
752
+ key: 1,
753
+ class: "text-fm-color-typo-error"
754
+ }, wn = {
755
+ class: "text-fm-color-typo-error"
756
+ }, In = {
757
+ class: "text-fm-color-typo-success"
758
+ }, An = {
759
+ key: 1,
760
+ class: "divide-y divide-fm-color-border-default"
761
+ }, Fn = {
762
+ class: "flex flex-wrap items-center gap-8"
763
+ }, Mn = {
764
+ class: "break-all font-mono text-xs"
765
+ }, Dn = {
766
+ class: "space-y-4"
767
+ }, On = {
768
+ key: 0,
769
+ class: "text-fm-color-typo-success"
770
+ }, Cn = {
771
+ key: 1,
772
+ class: "text-fm-color-typo-error"
773
+ }, jn = {
774
+ class: "text-fm-color-typo-error"
775
+ }, Tn = {
776
+ class: "text-fm-color-typo-success"
777
+ }, Vn = {
778
+ key: 2,
779
+ class: "text-fm-color-typo-secondary"
780
+ }, $n = {
781
+ key: 1,
782
+ class: "rounded-lg border border-fm-color-border-default"
783
+ }, Pn = {
784
+ class: "text-base font-bold text-fm-color-typo-primary"
785
+ }, En = {
786
+ class: "space-y-12 p-12"
787
+ }, Nn = {
788
+ key: 0
789
+ }, Rn = {
790
+ class: "text-xs text-fm-color-typo-secondary"
791
+ }, Un = {
792
+ class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
793
+ }, Kn = {
794
+ key: 1
795
+ }, Bn = {
796
+ class: "text-xs text-fm-color-typo-secondary"
797
+ }, Yn = {
798
+ class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
799
+ }, De = 100, rt = 1e3, it = "__feedmeAdmin__", zn = "D MMM YYYY h:mm A", qn = "YYYY-MM-DD HH:mm", K = "YYYY-MM-DD", Tt = "audit-log-export-fields-v3", Jn = /* @__PURE__ */ Vt({
800
+ __name: "AuditLogList",
801
+ setup(t) {
802
+ const {
803
+ t: o,
804
+ te: n
805
+ } = $t(), r = zo(), d = ls(), h = Jo(), {
806
+ restaurants: b
807
+ } = Yo(h), y = S(!1), A = S(!1), C = S([]), i = S(null), V = S(!1), R = S({}), m = S(null), w = S(!1);
808
+ async function j(e) {
809
+ const s = Uint8Array.from(atob(e), (L) => L.charCodeAt(0)), c = new DecompressionStream("gzip"), x = c.writable.getWriter();
810
+ return await x.write(s), await x.close(), new Response(c.readable).text();
811
+ }
812
+ const T = S("");
813
+ let _ = 0;
814
+ ie(() => {
815
+ var e, s;
816
+ return (s = (e = i.value) == null ? void 0 : e.metadata) == null ? void 0 : s.requestBody;
817
+ }, async (e) => {
818
+ const s = ++_;
819
+ if (!e) {
820
+ T.value = "";
821
+ return;
822
+ }
823
+ if (typeof e == "object") {
824
+ T.value = JSON.stringify(e, null, 2);
825
+ return;
826
+ }
827
+ if (e.startsWith("gzip:")) {
828
+ try {
829
+ const c = await j(e.slice(5));
830
+ if (s !== _) return;
831
+ T.value = JSON.stringify(JSON.parse(c), null, 2);
832
+ } catch {
833
+ if (s !== _) return;
834
+ T.value = e;
835
+ }
836
+ return;
837
+ }
838
+ try {
839
+ T.value = JSON.stringify(JSON.parse(e), null, 2);
840
+ } catch {
841
+ T.value = e;
842
+ }
843
+ }, {
844
+ immediate: !0
845
+ });
846
+ async function D(e) {
847
+ if (!e) return;
848
+ let s = e;
849
+ if (e.startsWith("gzip:"))
850
+ try {
851
+ s = await j(e.slice(5));
852
+ } catch {
853
+ return e;
854
+ }
855
+ try {
856
+ return JSON.parse(s);
857
+ } catch {
858
+ return s;
859
+ }
860
+ }
861
+ function B(e) {
862
+ if (e === void 0) return "";
863
+ if (typeof e == "object" && e !== null)
864
+ try {
865
+ return JSON.stringify(e, null, 2);
866
+ } catch {
867
+ return String(e);
868
+ }
869
+ return String(e);
870
+ }
871
+ const P = S([]), H = S([]), U = S(""), k = S(""), X = S(!1);
872
+ let ue = 0;
873
+ ie(m, async (e) => {
874
+ const s = ++ue;
875
+ if (P.value = [], H.value = [], U.value = "", k.value = "", X.value = !1, !e) return;
876
+ const [c, x] = await Promise.all([D(e.before), D(e.after)]);
877
+ s === ue && (bs(e.changeNodes) ? H.value = e.changeNodes.map(ys) : P.value = vs(c, x), U.value = B(c), k.value = B(x));
878
+ });
879
+ function je(e) {
880
+ return e === "added" ? "success" : e === "removed" ? "critical" : "warning";
881
+ }
882
+ function dt(e) {
883
+ return o(e === "added" ? "auditLog.operation.added" : e === "removed" ? "auditLog.operation.removed" : "auditLog.operation.updated");
884
+ }
885
+ function W(e) {
886
+ return e.replace(/\[[^\]]*\]/g, "");
887
+ }
888
+ function _e(e) {
889
+ return e === "add" ? "success" : e === "remove" ? "critical" : "warning";
890
+ }
891
+ function Ut(e) {
892
+ return o(e === "add" ? "auditLog.operation.added" : e === "remove" ? "auditLog.operation.removed" : "auditLog.operation.updated");
893
+ }
894
+ function Kt(e) {
895
+ return Nt(o, n, e);
896
+ }
897
+ const ct = I(() => {
898
+ const e = [], s = /* @__PURE__ */ new Map();
899
+ for (const c of P.value) {
900
+ const x = W(c.path), L = `${c.type}::${x}`;
901
+ let M = s.get(L);
902
+ M || (M = {
903
+ groupKey: L,
904
+ displayKey: x,
905
+ type: c.type,
906
+ rows: []
907
+ }, s.set(L, M), e.push(M)), M.rows.push(c);
908
+ }
909
+ return e;
910
+ }), Te = S(1), Bt = S(!1), ze = S(0), ft = I(() => Math.max(1, Math.ceil(ze.value / De))), mt = O().format("YYYY-MM-DD"), oe = S({
911
+ startDate: `${mt} 00:00`,
912
+ endDate: `${mt} 23:59`
913
+ }), fe = S(), Q = S(), se = S(), ae = S(), ne = S("all");
914
+ function Yt(e) {
915
+ return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((s) => typeof s == "string") : [];
916
+ }
917
+ const vt = Me.filter((e) => e.key !== "all").map((e) => e.key);
918
+ function Ve(e) {
919
+ const s = Me.find((c) => c.key !== "all" && c.subjectPrefixes.some((x) => e.startsWith(x)));
920
+ return (s == null ? void 0 : s.key) ?? "other";
921
+ }
922
+ function pt(e) {
923
+ const s = vt.indexOf(e);
924
+ return s === -1 ? vt.length : s;
925
+ }
926
+ const zt = I(() => Me.map(({
927
+ key: e
928
+ }) => ({
929
+ label: o(`auditLog.modules.${e}`),
930
+ value: e
931
+ }))), $e = I(() => Me.find((e) => e.key === ne.value) ?? Me[0]), qt = I(() => ne.value === "all"), q = I(() => ne.value === "pos"), pe = I(() => $e.value.sources ?? []);
932
+ ie(q, (e) => {
933
+ e && h.readRestaurants();
934
+ }, {
935
+ immediate: !0
936
+ });
937
+ const Z = S([]), Jt = I(() => b.value.map((e) => ({
938
+ label: e.profile.name,
939
+ value: String(e._id)
940
+ }))), Ht = I(() => Object.fromEntries(b.value.map((e) => [String(e._id), e.profile.name])));
941
+ ie(ne, () => {
942
+ Z.value = [];
943
+ });
944
+ const xe = S([]), Pe = S(!1), Wt = I(() => [...Pe.value ? [{
945
+ label: o("auditLog.user.feedmeAdmin"),
946
+ value: it
947
+ }] : [], ...d.members.map((e) => ({
948
+ label: e.name,
949
+ value: e.doc.userId
950
+ })), ...xe.value.map((e) => ({
951
+ label: `${e.name} (${o("auditLog.user.feedmeAdmin")})`,
952
+ value: e.userId
953
+ }))]), le = I(() => hs(fe.value, q.value, it)), qe = S(""), ee = S(""), Gt = Xo(qe, (e) => {
954
+ ee.value = e.trim();
955
+ });
956
+ Uo(Gt);
957
+ const me = I(() => {
958
+ const e = ee.value.toLowerCase();
959
+ if (!e) return [];
960
+ const s = /* @__PURE__ */ new Set();
961
+ for (const c of d.members) {
962
+ const x = c.doc.userId;
963
+ ((d.userIdToName[x] ?? "").toLowerCase().includes(e) || (d.userIdToEmail[x] ?? "").toLowerCase().includes(e) || (d.userIdToPhone[x] ?? "").toLowerCase().includes(e)) && s.add(x);
964
+ }
965
+ for (const c of xe.value)
966
+ c.name.toLowerCase().includes(e) && s.add(c.userId);
967
+ return [...s];
968
+ }), Je = I(() => {
969
+ const e = Mt.flatMap((L) => Yt(L.subject).map((M) => ({
970
+ label: L.label,
971
+ value: M
972
+ }))), s = Object.entries(Ft).map(([L, M]) => ({
973
+ label: M,
974
+ value: L
975
+ })), c = /* @__PURE__ */ new Set(), x = [];
976
+ for (const L of [...e, ...s])
977
+ if (!c.has(L.value)) {
978
+ c.add(L.value);
979
+ const M = Ve(L.value);
980
+ x.push({
981
+ ...L,
982
+ group: o(`auditLog.modules.${M}`)
983
+ });
984
+ }
985
+ return x.sort((L, M) => pt(Ve(L.value)) - pt(Ve(M.value)));
986
+ }), ge = I(() => {
987
+ const e = ee.value.toLowerCase();
988
+ if (!e) return [];
989
+ const s = /* @__PURE__ */ new Set();
990
+ for (const c of Je.value)
991
+ c.label.toLowerCase().includes(e) && s.add(c.value);
992
+ return [...s];
993
+ }), Xt = I(() => qt.value ? Je.value : Je.value.filter((e) => Ve(e.value) === ne.value));
994
+ function Qt(e, s) {
995
+ const c = s.toLowerCase();
996
+ return e.label.toLowerCase().includes(c) || e.value.replace(/^business::/, "").toLowerCase().includes(c) ? !0 : e.value.toLowerCase().includes(c);
997
+ }
998
+ const G = I(() => ({
999
+ manage: o("auditLog.action.manage"),
1000
+ create: o("auditLog.action.create"),
1001
+ read: o("auditLog.action.read"),
1002
+ update: o("auditLog.action.update"),
1003
+ delete: o("auditLog.action.delete")
1004
+ })), Zt = I(() => [{
1005
+ label: G.value.manage,
1006
+ value: "manage"
1007
+ }, {
1008
+ label: G.value.create,
1009
+ value: "create"
1010
+ }, {
1011
+ label: G.value.read,
1012
+ value: "read"
1013
+ }, {
1014
+ label: G.value.update,
1015
+ value: "update"
1016
+ }, {
1017
+ label: G.value.delete,
1018
+ value: "delete"
1019
+ }]), Ee = I(() => ({
1020
+ allowed: o("auditLog.outcome.success"),
1021
+ denied: o("auditLog.outcome.failed"),
1022
+ skipped: o("auditLog.outcome.skipped")
1023
+ })), He = I(() => {
1024
+ var e;
1025
+ return ((e = r.sessionUser.value) == null ? void 0 : e.isInternal) ?? !1;
1026
+ });
1027
+ function gt(e) {
1028
+ return !He.value && e === "skipped" ? "allowed" : e;
1029
+ }
1030
+ function We(e) {
1031
+ return !(e != null && e.length) || He.value ? e : e.includes("allowed") ? [.../* @__PURE__ */ new Set([...e, "skipped"])] : e;
1032
+ }
1033
+ const eo = I(() => [{
1034
+ label: Ee.value.allowed,
1035
+ value: "allowed"
1036
+ }, {
1037
+ label: Ee.value.denied,
1038
+ value: "denied"
1039
+ }, ...He.value ? [{
1040
+ label: Ee.value.skipped,
1041
+ value: "skipped"
1042
+ }] : []]), to = I(() => ({
1043
+ admin: o("auditLog.detail.resolvedFromValue.admin"),
1044
+ staff: o("auditLog.detail.resolvedFromValue.staff"),
1045
+ permissionSet: o("auditLog.detail.resolvedFromValue.permissionSet"),
1046
+ systemPermissionSet: o("auditLog.detail.resolvedFromValue.systemPermissionSet"),
1047
+ custom: o("auditLog.detail.resolvedFromValue.custom"),
1048
+ "no-match": o("auditLog.detail.resolvedFromValue.noMatch"),
1049
+ unknown: o("auditLog.detail.resolvedFromValue.unknown")
1050
+ })), oo = I(() => ({
1051
+ GET: G.value.read,
1052
+ POST: G.value.create,
1053
+ PUT: G.value.update,
1054
+ PATCH: G.value.update,
1055
+ DELETE: G.value.delete
1056
+ })), so = {
1057
+ allowed: "success",
1058
+ denied: "critical",
1059
+ skipped: "warning"
1060
+ };
1061
+ function Ne(e) {
1062
+ return O(e).format(zn);
1063
+ }
1064
+ const ao = I(() => {
1065
+ const {
1066
+ startDate: e,
1067
+ endDate: s
1068
+ } = oe.value;
1069
+ return e && s ? `${Ne(e)} – ${Ne(s)}` : e ? Ne(e) : s ? Ne(s) : o("auditLog.dateRange.placeholder");
1070
+ }), no = I(() => [{
1071
+ label: o("date.predefinedRanges.today"),
1072
+ value: {
1073
+ startDate: O().format(K),
1074
+ endDate: O().format(K)
1075
+ }
1076
+ }, {
1077
+ label: o("date.predefinedRanges.yesterday"),
1078
+ value: {
1079
+ startDate: O().subtract(1, "day").format(K),
1080
+ endDate: O().subtract(1, "day").format(K)
1081
+ }
1082
+ }, {
1083
+ label: o("date.predefinedRanges.thisWeek"),
1084
+ value: {
1085
+ startDate: O().startOf("week").format(K),
1086
+ endDate: O().endOf("week").format(K)
1087
+ }
1088
+ }, {
1089
+ label: o("date.predefinedRanges.lastWeek"),
1090
+ value: {
1091
+ startDate: O().subtract(1, "week").startOf("week").format(K),
1092
+ endDate: O().subtract(1, "week").endOf("week").format(K)
1093
+ }
1094
+ }, {
1095
+ label: o("date.predefinedRanges.last7Days"),
1096
+ value: {
1097
+ startDate: O().subtract(7, "day").format(K),
1098
+ endDate: O().subtract(1, "day").format(K)
1099
+ }
1100
+ }, {
1101
+ label: o("date.predefinedRanges.thisMonth"),
1102
+ value: {
1103
+ startDate: O().startOf("month").format(K),
1104
+ endDate: O().endOf("month").format(K)
1105
+ }
1106
+ }, {
1107
+ label: o("date.predefinedRanges.lastMonth"),
1108
+ value: {
1109
+ startDate: O().subtract(1, "month").startOf("month").format(K),
1110
+ endDate: O().subtract(1, "month").endOf("month").format(K)
1111
+ }
1112
+ }]);
1113
+ function Ge(e) {
1114
+ var s;
1115
+ return ((s = Mt.find((c) => c.subject === e)) == null ? void 0 : s.label) ?? Ft[e] ?? es[e];
1116
+ }
1117
+ function Le(e) {
1118
+ var c, x;
1119
+ if (e.actorType === "posUser")
1120
+ return ps(e, o);
1121
+ if (e.actorType === "portalUser")
1122
+ return e.actorName ?? e.userId;
1123
+ if (e.actorType === "feedmeAdmin")
1124
+ return (c = r.sessionUser.value) != null && c.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin");
1125
+ const s = d.userIdToName[e.userId];
1126
+ return s || (d.hasLoaded ? (x = r.sessionUser.value) != null && x.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin") : e.userId);
1127
+ }
1128
+ function ht(e) {
1129
+ return e.actorType === "posUser" ? q.value ? "" : lt(e, o) : d.userIdToPhone[e.userId] || "-";
1130
+ }
1131
+ function lo(e) {
1132
+ return d.userIdToEmail[e.userId] || "-";
1133
+ }
1134
+ function yt(e) {
1135
+ return O(e).format("DD MMM YYYY, HH:mm");
1136
+ }
1137
+ function Xe(e) {
1138
+ return O(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
1139
+ }
1140
+ function bt(e) {
1141
+ return G.value[e] ?? e;
1142
+ }
1143
+ function _t(e) {
1144
+ const s = ut(o, {
1145
+ eventKey: e.eventKey,
1146
+ params: e.params,
1147
+ operationLabel: e.metadata.operationLabel ?? bt(e.action)
1148
+ });
1149
+ return e.actorType === "posUser" && !q.value ? s + gs(e, o) : s;
1150
+ }
1151
+ function xt(e) {
1152
+ return ut(o, e) || o("auditLog.operation.unlabeled");
1153
+ }
1154
+ function ro(e) {
1155
+ return Ge(e.subject) ?? e.subject;
1156
+ }
1157
+ function Qe(e) {
1158
+ return Ee.value[gt(e)];
1159
+ }
1160
+ function Lt(e) {
1161
+ return so[gt(e)] ?? "neutral";
1162
+ }
1163
+ function io(e) {
1164
+ return to.value[e] ?? e;
1165
+ }
1166
+ function uo(e) {
1167
+ return e.metadata.requestMethod ? oo.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : bt(e.action);
1168
+ }
1169
+ function St(e) {
1170
+ const s = String(e ?? "");
1171
+ return `"${(/^[=+\-@\t\r]/.test(s) ? `'${s}` : s).replace(/"/g, '""')}"`;
1172
+ }
1173
+ const Ze = [{
1174
+ key: "timestamp",
1175
+ labelKey: "auditLog.exportFields.timestamp",
1176
+ getValue: (e) => yt(e.timestamp),
1177
+ defaultSelected: !0
1178
+ }, {
1179
+ key: "userName",
1180
+ labelKey: "auditLog.exportFields.userName",
1181
+ getValue: (e) => Le(e),
1182
+ defaultSelected: !0
1183
+ }, {
1184
+ key: "userPhone",
1185
+ labelKey: "auditLog.exportFields.userPhone",
1186
+ getValue: (e) => ht(e),
1187
+ defaultSelected: !0
1188
+ }, {
1189
+ key: "subject",
1190
+ labelKey: "auditLog.exportFields.subject",
1191
+ getValue: (e) => Ge(e.subject) ?? e.subject,
1192
+ defaultSelected: !0
1193
+ }, {
1194
+ key: "action",
1195
+ labelKey: "auditLog.exportFields.action",
1196
+ getValue: (e) => e.action,
1197
+ defaultSelected: !0
1198
+ }, {
1199
+ key: "operation",
1200
+ labelKey: "auditLog.exportFields.operation",
1201
+ getValue: (e) => _t(e),
1202
+ defaultSelected: !0
1203
+ }, {
1204
+ key: "outcome",
1205
+ labelKey: "auditLog.exportFields.outcome",
1206
+ getValue: (e) => Qe(e.outcome),
1207
+ defaultSelected: !0
1208
+ }, {
1209
+ key: "operationEvents",
1210
+ labelKey: "auditLog.exportFields.operationEvents",
1211
+ getValue: (e) => _s(o, e.operations),
1212
+ defaultSelected: !0
1213
+ }, {
1214
+ key: "changes",
1215
+ labelKey: "auditLog.exportFields.changes",
1216
+ getValue: (e) => Ls(o, n, e.operations),
1217
+ defaultSelected: !1
1218
+ }, {
1219
+ key: "businessId",
1220
+ labelKey: "auditLog.exportFields.businessId",
1221
+ getValue: (e) => e.businessId,
1222
+ defaultSelected: !1
1223
+ }, {
1224
+ key: "restaurantId",
1225
+ labelKey: "auditLog.exportFields.restaurantId",
1226
+ getValue: (e) => e.restaurantId,
1227
+ defaultSelected: !1
1228
+ }, {
1229
+ key: "country",
1230
+ labelKey: "auditLog.exportFields.country",
1231
+ getValue: (e) => e.country,
1232
+ defaultSelected: !1
1233
+ }, {
1234
+ key: "resolvedFrom",
1235
+ labelKey: "auditLog.exportFields.resolvedFrom",
1236
+ getValue: (e) => {
1237
+ var s;
1238
+ return (s = e.metadata) == null ? void 0 : s.resolvedFrom;
1239
+ },
1240
+ defaultSelected: !1
1241
+ }, {
1242
+ key: "requestMethod",
1243
+ labelKey: "auditLog.exportFields.requestMethod",
1244
+ getValue: (e) => {
1245
+ var s;
1246
+ return (s = e.metadata) == null ? void 0 : s.requestMethod;
1247
+ },
1248
+ defaultSelected: !1
1249
+ }, {
1250
+ key: "requestPath",
1251
+ labelKey: "auditLog.exportFields.requestPath",
1252
+ getValue: (e) => {
1253
+ var s;
1254
+ return (s = e.metadata) == null ? void 0 : s.requestPath;
1255
+ },
1256
+ defaultSelected: !1
1257
+ }, {
1258
+ key: "traceId",
1259
+ labelKey: "auditLog.exportFields.traceId",
1260
+ getValue: (e) => e.traceId ?? "",
1261
+ defaultSelected: !1
1262
+ }];
1263
+ function co() {
1264
+ try {
1265
+ const e = localStorage.getItem(Tt);
1266
+ if (e) {
1267
+ const s = JSON.parse(e);
1268
+ if (Array.isArray(s) && s.length > 0) return new Set(s);
1269
+ }
1270
+ } catch {
1271
+ }
1272
+ return new Set(Ze.filter((e) => e.defaultSelected).map((e) => e.key));
1273
+ }
1274
+ const he = S(co());
1275
+ function fo(e) {
1276
+ const s = new Set(he.value);
1277
+ if (s.has(e)) {
1278
+ if (s.size <= 1) return;
1279
+ s.delete(e);
1280
+ } else
1281
+ s.add(e);
1282
+ he.value = s;
1283
+ try {
1284
+ localStorage.setItem(Tt, JSON.stringify([...s]));
1285
+ } catch {
1286
+ }
1287
+ }
1288
+ async function mo() {
1289
+ var e, s, c, x, L;
1290
+ if (!A.value) {
1291
+ A.value = !0;
1292
+ try {
1293
+ const {
1294
+ startDate: M,
1295
+ endDate: E
1296
+ } = oe.value, re = $e.value.subjectPrefixes, Re = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), ke = E ? de(E) : null, Ue = ke && ke < Re ? ke : Re, tt = {
1297
+ ...M ? {
1298
+ from: de(M)
1299
+ } : {},
1300
+ to: Ue,
1301
+ ...le.value.userIds.length ? {
1302
+ userIds: le.value.userIds
1303
+ } : {},
1304
+ ...le.value.feedmeAdminActors ? {
1305
+ feedmeAdminActors: !0
1306
+ } : {},
1307
+ ...(e = Q.value) != null && e.length ? {
1308
+ subjects: Q.value
1309
+ } : {},
1310
+ ...re.length ? {
1311
+ subjectPrefixes: [...re]
1312
+ } : {},
1313
+ ...pe.value.length ? {
1314
+ sources: [...pe.value]
1315
+ } : {},
1316
+ ...q.value && Z.value.length ? {
1317
+ restaurantIds: [...Z.value]
1318
+ } : {},
1319
+ ...(s = ae.value) != null && s.length ? {
1320
+ actions: ae.value
1321
+ } : {},
1322
+ ...(c = se.value) != null && c.length ? {
1323
+ outcomes: We(se.value)
1324
+ } : {},
1325
+ ...ee.value ? {
1326
+ search: ee.value
1327
+ } : {},
1328
+ ...me.value.length ? {
1329
+ searchUserIds: me.value
1330
+ } : {},
1331
+ ...ge.value.length ? {
1332
+ searchSubjects: ge.value
1333
+ } : {}
1334
+ }, we = [];
1335
+ let p = 0;
1336
+ for (; ; ) {
1337
+ const J = await Ke.read({
1338
+ ...tt,
1339
+ limit: rt,
1340
+ offset: p
1341
+ });
1342
+ if (we.push(...J), J.length < rt) break;
1343
+ p += rt;
1344
+ }
1345
+ const $ = Ze.filter((J) => he.value.has(J.key)), Ao = $.map((J) => o(J.labelKey)), Fo = we.map((J) => $.map((Po) => Po.getValue(J) ?? "")), ot = -(/* @__PURE__ */ new Date()).getTimezoneOffset(), Mo = ot >= 0 ? "+" : "-", Do = String(Math.floor(Math.abs(ot) / 60)).padStart(2, "0"), Oo = String(Math.abs(ot) % 60).padStart(2, "0"), Co = `UTC${Mo}${Do}:${Oo}`, It = ((x = r.currentBusiness.value) == null ? void 0 : x.name) || "", jo = [M, E].filter(Boolean).join(" – "), To = [...[[o("auditLog.title")], [`${o("auditLog.frontMatter.date")}: ${jo}`], ...It ? [[`${o("auditLog.frontMatter.business")}: ${It}`]] : [], [`${o("auditLog.frontMatter.generatedBy")}: ${O().format("DD MMM YYYY, HH:mm")} (${Co})`], []].map((J) => J.map(St).join(",")), ...[Ao, ...Fo].map((J) => J.map(St).join(","))].join(`
1346
+ `), Vo = `audit-log_${(((L = r.currentBusiness.value) == null ? void 0 : L.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${O().format("YYYYMMDD_HHmmss")}.csv`, $o = new Blob([`\uFEFF${To}`], {
1347
+ type: "text/csv;charset=utf-8;"
1348
+ }), At = window.URL.createObjectURL($o), Ie = document.createElement("a");
1349
+ Ie.href = At, Ie.download = Vo, document.body.appendChild(Ie), Ie.click(), Ie.remove(), window.URL.revokeObjectURL(At);
1350
+ } finally {
1351
+ A.value = !1;
1352
+ }
1353
+ }
1354
+ }
1355
+ function te(e) {
1356
+ return "status" in e;
1357
+ }
1358
+ function vo(e) {
1359
+ return Ct(e) ? g(ve.FmTooltip, {
1360
+ variant: "plain",
1361
+ placement: "top"
1362
+ }, {
1363
+ default: () => g(ve.FmIcon, {
1364
+ name: "error",
1365
+ size: "sm",
1366
+ class: "cursor-help text-fm-color-typo-error"
1367
+ }, null),
1368
+ content: () => o("auditLog.operation.partialFailure")
1369
+ }) : null;
1370
+ }
1371
+ function po(e) {
1372
+ var c;
1373
+ const s = e.original;
1374
+ return e.depth === 0 && !te(s) && !!((c = s.operations) != null && c.length);
1375
+ }
1376
+ function go(e) {
1377
+ return te(e) ? void 0 : e.operations;
1378
+ }
1379
+ const Se = [{
1380
+ accessorKey: "timestamp",
1381
+ header: () => o("auditLog.columns.timestamp"),
1382
+ cell(e) {
1383
+ return yt(e.row.original.timestamp);
1384
+ }
1385
+ }, {
1386
+ accessorKey: "userId",
1387
+ header: () => o("auditLog.columns.user"),
1388
+ enableSorting: !1,
1389
+ size: 220,
1390
+ cell(e) {
1391
+ const s = e.row.original;
1392
+ return te(s) ? null : g("div", {
1393
+ class: "flex items-center gap-8"
1394
+ }, [g(ve.FmAvatar, {
1395
+ name: Le(s),
1396
+ initials: Qo(Le(s)),
1397
+ size: "sm",
1398
+ class: "shrink-0"
1399
+ }, null), g("div", {
1400
+ class: "min-w-0"
1401
+ }, [g("p", {
1402
+ class: "truncate font-semibold"
1403
+ }, [Le(s)]), g("p", {
1404
+ class: "truncate text-fm-color-typo-secondary"
1405
+ }, [ht(s)])])]);
1406
+ }
1407
+ }, {
1408
+ accessorKey: "subject",
1409
+ header: () => o("auditLog.columns.subject"),
1410
+ cell(e) {
1411
+ const s = e.row.original;
1412
+ return te(s) ? g("span", {
1413
+ class: "text-fm-color-typo-secondary"
1414
+ }, [o("auditLog.operation.rowHint")]) : Ge(s.subject) ?? s.subject;
1415
+ }
1416
+ }, {
1417
+ accessorKey: "action",
1418
+ header: () => o("auditLog.columns.action"),
1419
+ enableSorting: !1,
1420
+ size: 280,
1421
+ meta: {
1422
+ cellSpanClass: "audit-log-action-label"
1423
+ },
1424
+ cell(e) {
1425
+ var E;
1426
+ const s = e.row.original;
1427
+ if (te(s))
1428
+ return g("span", {
1429
+ class: "audit-op-marker flex flex-wrap items-baseline gap-4"
1430
+ }, [g("span", {
1431
+ class: "text-fm-color-typo-secondary"
1432
+ }, [Ae("↳")]), g("span", {
1433
+ class: "font-semibold"
1434
+ }, [xt(s)]), s.entityId ? g("span", {
1435
+ class: "text-fm-color-typo-secondary"
1436
+ }, [Ae("· "), s.entityId]) : null, s.status === "failed" && s.errorMessage ? g("span", {
1437
+ class: "text-fm-color-typo-error"
1438
+ }, [Ae("· "), s.errorMessage]) : null]);
1439
+ const c = ((E = s.operations) == null ? void 0 : E.length) ?? 0, x = (re) => {
1440
+ re.stopPropagation(), e.row.getToggleExpandedHandler()();
1441
+ }, L = {
1442
+ variant: "tertiary",
1443
+ icon: e.row.getIsExpanded() ? "keyboard_arrow_up" : "keyboard_arrow_down",
1444
+ "aria-label": o("auditLog.operation.toggle"),
1445
+ class: "ml-auto shrink-0",
1446
+ onClick: x
1447
+ }, M = ve.FmButton;
1448
+ return g("span", {
1449
+ class: "flex items-center gap-8"
1450
+ }, [g("span", null, [_t(s)]), c > 0 ? g("span", {
1451
+ class: "cursor-pointer",
1452
+ onClick: x
1453
+ }, [g(ve.FmChip, {
1454
+ variant: "neutral",
1455
+ compact: !0,
1456
+ label: o("auditLog.operation.badge", {
1457
+ count: c
1458
+ })
1459
+ }, null)]) : null, e.row.getCanExpand() ? g(M, L, null) : null]);
1460
+ }
1461
+ }, {
1462
+ accessorKey: "outcome",
1463
+ header: () => o("auditLog.columns.outcome"),
1464
+ enableSorting: !1,
1465
+ cell(e) {
1466
+ const s = e.row.original;
1467
+ return te(s) ? g(ve.FmChip, {
1468
+ variant: s.status === "failed" ? "critical" : "success",
1469
+ label: s.status === "failed" ? o("auditLog.outcome.failed") : o("auditLog.outcome.success"),
1470
+ compact: !0
1471
+ }, null) : g("span", {
1472
+ class: "flex items-center gap-4"
1473
+ }, [g(ve.FmChip, {
1474
+ variant: Lt(s.outcome),
1475
+ label: Qe(s.outcome),
1476
+ compact: !0
1477
+ }, null), vo(s)]);
1478
+ }
1479
+ }], ho = [
1480
+ Se[0],
1481
+ // timestamp: Date
1482
+ Se.find((e) => e.accessorKey === "userId"),
1483
+ // User: getUserName -> posActorLabel for posUser rows
1484
+ {
1485
+ accessorKey: "restaurantId",
1486
+ header: () => o("auditLog.columns.restaurant"),
1487
+ enableSorting: !1,
1488
+ cell(e) {
1489
+ const s = e.row.original;
1490
+ return te(s) ? null : s.restaurantId && Ht.value[s.restaurantId] || s.restaurantId || "-";
1491
+ }
1492
+ },
1493
+ {
1494
+ accessorKey: "deviceId",
1495
+ header: () => o("auditLog.columns.device"),
1496
+ enableSorting: !1,
1497
+ cell(e) {
1498
+ const s = e.row.original;
1499
+ return te(s) ? null : lt(s, o);
1500
+ }
1501
+ },
1502
+ {
1503
+ accessorKey: "approverName",
1504
+ header: () => o("auditLog.columns.approver"),
1505
+ enableSorting: !1,
1506
+ cell(e) {
1507
+ const s = e.row.original;
1508
+ return te(s) ? null : jt(s, o);
1509
+ }
1510
+ },
1511
+ Se.find((e) => e.accessorKey === "action"),
1512
+ // Action Description: event line
1513
+ Se.find((e) => e.accessorKey === "outcome")
1514
+ // Status
1515
+ ], yo = I(() => q.value ? ho : Se);
1516
+ function de(e) {
1517
+ const s = O(e, qn);
1518
+ return new Date(s.year(), s.month(), s.date(), s.hour(), s.minute(), 0).toISOString().slice(0, 19).replace("T", " ");
1519
+ }
1520
+ async function kt() {
1521
+ var e, s, c;
1522
+ y.value = !0;
1523
+ try {
1524
+ const {
1525
+ startDate: x,
1526
+ endDate: L
1527
+ } = oe.value, M = (Te.value - 1) * De, E = $e.value.subjectPrefixes, re = await Ke.read({
1528
+ limit: De,
1529
+ offset: M,
1530
+ ...x ? {
1531
+ from: de(x)
1532
+ } : {},
1533
+ ...L ? {
1534
+ to: de(L)
1535
+ } : {},
1536
+ ...le.value.userIds.length ? {
1537
+ userIds: le.value.userIds
1538
+ } : {},
1539
+ ...le.value.feedmeAdminActors ? {
1540
+ feedmeAdminActors: !0
1541
+ } : {},
1542
+ ...(e = Q.value) != null && e.length ? {
1543
+ subjects: Q.value
1544
+ } : {},
1545
+ ...E.length ? {
1546
+ subjectPrefixes: [...E]
1547
+ } : {},
1548
+ ...pe.value.length ? {
1549
+ sources: [...pe.value]
1550
+ } : {},
1551
+ ...q.value && Z.value.length ? {
1552
+ restaurantIds: [...Z.value]
1553
+ } : {},
1554
+ ...(s = ae.value) != null && s.length ? {
1555
+ actions: ae.value
1556
+ } : {},
1557
+ ...(c = se.value) != null && c.length ? {
1558
+ outcomes: We(se.value)
1559
+ } : {},
1560
+ ...ee.value ? {
1561
+ search: ee.value
1562
+ } : {},
1563
+ ...me.value.length ? {
1564
+ searchUserIds: me.value
1565
+ } : {},
1566
+ ...ge.value.length ? {
1567
+ searchSubjects: ge.value
1568
+ } : {}
1569
+ });
1570
+ C.value = re, Bt.value = re.length === De, R.value = {};
1571
+ } finally {
1572
+ y.value = !1;
1573
+ }
1574
+ }
1575
+ const wt = I(() => {
1576
+ var e;
1577
+ return JSON.stringify({
1578
+ businessId: ((e = r.currentBusiness.value) == null ? void 0 : e._id) ?? "",
1579
+ dateRange: oe.value,
1580
+ users: [...fe.value ?? []].sort(),
1581
+ subjects: [...Q.value ?? []].sort(),
1582
+ outcomes: [...se.value ?? []].sort(),
1583
+ actions: [...ae.value ?? []].sort(),
1584
+ moduleKey: ne.value,
1585
+ restaurantIds: [...Z.value].sort(),
1586
+ search: ee.value,
1587
+ // Member/feedme-admin-actor lists resolve asynchronously (and actors refetch on
1588
+ // every date-range change), so searchUserIds can change after the key above is
1589
+ // computed — include it explicitly or a late-arriving match never refetches.
1590
+ searchUserIds: [...me.value].sort()
1591
+ });
1592
+ });
1593
+ async function bo() {
1594
+ var x, L, M;
1595
+ const {
1596
+ startDate: e,
1597
+ endDate: s
1598
+ } = oe.value, c = $e.value.subjectPrefixes;
1599
+ ze.value = await Ke.count({
1600
+ ...e ? {
1601
+ from: de(e)
1602
+ } : {},
1603
+ ...s ? {
1604
+ to: de(s)
1605
+ } : {},
1606
+ ...le.value.userIds.length ? {
1607
+ userIds: le.value.userIds
1608
+ } : {},
1609
+ ...le.value.feedmeAdminActors ? {
1610
+ feedmeAdminActors: !0
1611
+ } : {},
1612
+ ...(x = Q.value) != null && x.length ? {
1613
+ subjects: Q.value
1614
+ } : {},
1615
+ ...c.length ? {
1616
+ subjectPrefixes: [...c]
1617
+ } : {},
1618
+ ...pe.value.length ? {
1619
+ sources: [...pe.value]
1620
+ } : {},
1621
+ ...q.value && Z.value.length ? {
1622
+ restaurantIds: [...Z.value]
1623
+ } : {},
1624
+ ...(L = ae.value) != null && L.length ? {
1625
+ actions: ae.value
1626
+ } : {},
1627
+ ...(M = se.value) != null && M.length ? {
1628
+ outcomes: We(se.value)
1629
+ } : {},
1630
+ ...ee.value ? {
1631
+ search: ee.value
1632
+ } : {},
1633
+ ...me.value.length ? {
1634
+ searchUserIds: me.value
1635
+ } : {},
1636
+ ...ge.value.length ? {
1637
+ searchSubjects: ge.value
1638
+ } : {}
1639
+ });
1640
+ }
1641
+ ie(wt, async () => {
1642
+ var e;
1643
+ Te.value = 1, (e = r.currentBusiness.value) != null && e._id && await Promise.all([bo(), kt()]);
1644
+ }, {
1645
+ immediate: !0
1646
+ }), ie(ne, () => {
1647
+ Q.value = void 0, q.value && (fe.value = void 0);
1648
+ });
1649
+ let et = !1;
1650
+ async function _o({
1651
+ pageIndex: e
1652
+ }) {
1653
+ var s;
1654
+ if ((s = r.currentBusiness.value) != null && s._id && !(e === 0 && Te.value === 1) && !et) {
1655
+ et = !0, Te.value = e + 1;
1656
+ try {
1657
+ await kt();
1658
+ } finally {
1659
+ et = !1;
1660
+ }
1661
+ }
1662
+ }
1663
+ function xo(e) {
1664
+ if (te(e)) {
1665
+ So(e);
1666
+ return;
1667
+ }
1668
+ i.value = e, V.value = !0;
1669
+ }
1670
+ function Lo() {
1671
+ V.value = !1, i.value = null;
1672
+ }
1673
+ function So(e) {
1674
+ m.value = e, w.value = !0;
1675
+ }
1676
+ function ko() {
1677
+ w.value = !1, m.value = null;
1678
+ }
1679
+ ie(r.currentBusiness, (e) => {
1680
+ e && d.readTeamMembers();
1681
+ }, {
1682
+ immediate: !0
1683
+ });
1684
+ function wo() {
1685
+ const e = fe.value;
1686
+ if (!(e != null && e.length)) return;
1687
+ const s = new Set(xe.value.map((L) => L.userId)), c = new Set(d.members.map((L) => L.doc.userId)), x = e.filter((L) => L === it ? Pe.value : d.hasLoaded ? c.has(L) || s.has(L) : !0);
1688
+ x.length !== e.length && (fe.value = x.length ? x : void 0);
1689
+ }
1690
+ async function Io() {
1691
+ var c;
1692
+ if (!((c = r.currentBusiness.value) != null && c._id)) return;
1693
+ const {
1694
+ startDate: e,
1695
+ endDate: s
1696
+ } = oe.value;
1697
+ try {
1698
+ const {
1699
+ actors: x,
1700
+ showFeedmeAdminFilter: L
1701
+ } = await Ke.getFeedmeAdminFilter({
1702
+ ...e ? {
1703
+ from: de(e)
1704
+ } : {},
1705
+ ...s ? {
1706
+ to: de(s)
1707
+ } : {}
1708
+ });
1709
+ xe.value = x, Pe.value = L;
1710
+ } catch {
1711
+ xe.value = [], Pe.value = !1;
1712
+ }
1713
+ wo();
1714
+ }
1715
+ return ie(() => {
1716
+ var e;
1717
+ return {
1718
+ businessId: (e = r.currentBusiness.value) == null ? void 0 : e._id,
1719
+ range: oe.value
1720
+ };
1721
+ }, () => Io(), {
1722
+ immediate: !0,
1723
+ deep: !0
1724
+ }), (e, s) => {
1725
+ const c = N("FmSpacer"), x = N("FmButton"), L = N("FmMenuItem"), M = N("FmMenu"), E = N("FmChip"), re = N("FmDateRangePicker"), Re = N("FmSearch"), ke = N("FmTable"), Ue = N("FmIcon"), tt = N("FmTooltip"), we = N("FmSideSheet");
1726
+ return f(), v(z, null, [g(Ho, {
1727
+ heading: u(o)("auditLog.title")
1728
+ }, {
1729
+ "append-heading": Y(() => [g(c), g(x, {
1730
+ variant: "primary",
1731
+ "prepend-icon": "upload",
1732
+ label: u(o)("auditLog.export"),
1733
+ disabled: C.value.length === 0 || A.value || u(d).isLoading || u(d).members.length === 0,
1734
+ loading: A.value,
1735
+ onClick: mo
1736
+ }, null, 8, ["label", "disabled", "loading"]), g(M, {
1737
+ "close-on-click": !1,
1738
+ "z-index": 50
1739
+ }, {
1740
+ "menu-button": Y(() => [g(x, {
1741
+ variant: "tertiary",
1742
+ icon: "settings",
1743
+ "aria-label": u(o)("auditLog.exportSettings.title"),
1744
+ disabled: A.value
1745
+ }, null, 8, ["aria-label", "disabled"])]),
1746
+ default: Y(() => [a("div", Ss, [a("p", ks, l(u(o)("auditLog.exportSettings.title")), 1), (f(), v(z, null, ce(Ze, (p) => g(L, {
1747
+ key: p.key,
1748
+ label: u(o)(p.labelKey),
1749
+ "has-checkbox": "",
1750
+ "model-value": he.value.has(p.key),
1751
+ disabled: he.value.has(p.key) && he.value.size === 1,
1752
+ onClick: ($) => fo(p.key)
1753
+ }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
1754
+ _: 1
1755
+ })]),
1756
+ default: Y(() => [a("div", ws, [a("div", Is, [g(ns, {
1757
+ modelValue: ne.value,
1758
+ "onUpdate:modelValue": s[0] || (s[0] = (p) => ne.value = p),
1759
+ items: zt.value
1760
+ }, null, 8, ["modelValue", "items"]), a("div", As, [g(re, {
1761
+ modelValue: oe.value,
1762
+ "onUpdate:modelValue": s[1] || (s[1] = (p) => oe.value = p),
1763
+ "show-predefined-range": "",
1764
+ "show-time": "",
1765
+ "predefined-range": no.value
1766
+ }, {
1767
+ "trigger-button": Y(() => [g(E, {
1768
+ label: ao.value,
1769
+ icon: "calendar_month"
1770
+ }, null, 8, ["label"])]),
1771
+ _: 1
1772
+ }, 8, ["modelValue", "predefined-range"]), q.value ? F("", !0) : (f(), v("div", Fs, [g(Fe, {
1773
+ modelValue: fe.value,
1774
+ "onUpdate:modelValue": s[2] || (s[2] = (p) => fe.value = p),
1775
+ items: Wt.value,
1776
+ multiple: "",
1777
+ variant: "dark",
1778
+ placeholder: u(o)("auditLog.filter.user_placeholder"),
1779
+ "selected-prefix": u(o)("auditLog.filter.selected_user_prefix"),
1780
+ "chip-icon": "account_circle"
1781
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])), q.value ? F("", !0) : (f(), v("div", Ms, [g(Fe, {
1782
+ modelValue: Q.value,
1783
+ "onUpdate:modelValue": s[3] || (s[3] = (p) => Q.value = p),
1784
+ items: Xt.value,
1785
+ "filter-fn": Qt,
1786
+ multiple: "",
1787
+ variant: "dark",
1788
+ placeholder: u(o)("auditLog.filter.subject_placeholder"),
1789
+ "selected-prefix": u(o)("auditLog.filter.selected_subject_prefix"),
1790
+ "chip-icon": "badge"
1791
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])), a("div", Ds, [g(Fe, {
1792
+ modelValue: ae.value,
1793
+ "onUpdate:modelValue": s[4] || (s[4] = (p) => ae.value = p),
1794
+ items: Zt.value,
1795
+ multiple: "",
1796
+ variant: "dark",
1797
+ placeholder: u(o)("auditLog.filter.action_placeholder"),
1798
+ "selected-prefix": u(o)("auditLog.filter.selected_action_prefix"),
1799
+ searchable: !1
1800
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), a("div", Os, [g(Fe, {
1801
+ modelValue: se.value,
1802
+ "onUpdate:modelValue": s[5] || (s[5] = (p) => se.value = p),
1803
+ items: eo.value,
1804
+ multiple: "",
1805
+ variant: "dark",
1806
+ placeholder: u(o)("auditLog.filter.status_placeholder"),
1807
+ "selected-prefix": u(o)("auditLog.filter.selected_status_prefix"),
1808
+ searchable: !1,
1809
+ "chip-icon": "check_circle"
1810
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), q.value ? (f(), v("div", Cs, [g(Fe, {
1811
+ modelValue: Z.value,
1812
+ "onUpdate:modelValue": s[6] || (s[6] = (p) => Z.value = p),
1813
+ items: Jt.value,
1814
+ multiple: "",
1815
+ variant: "dark",
1816
+ placeholder: u(o)("auditLog.filter.restaurant_placeholder"),
1817
+ "selected-prefix": u(o)("auditLog.filter.selected_restaurant_prefix"),
1818
+ "chip-icon": "storefront"
1819
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])) : F("", !0), g(Re, {
1820
+ modelValue: qe.value,
1821
+ "onUpdate:modelValue": s[7] || (s[7] = (p) => qe.value = p),
1822
+ class: "ml-auto w-[280px]",
1823
+ placeholder: u(o)("auditLog.search.placeholder")
1824
+ }, null, 8, ["modelValue", "placeholder"])])]), g(qo, null, {
1825
+ default: Y(() => [a("div", js, [g(Wo, {
1826
+ "is-loading": y.value,
1827
+ "is-empty": C.value.length === 0,
1828
+ title: u(o)("auditLog.noData.title"),
1829
+ subtitle: u(o)("auditLog.noData.subtitle")
1830
+ }, {
1831
+ default: Y(() => [(f(), Oe(ke, {
1832
+ key: wt.value,
1833
+ "column-defs": yo.value,
1834
+ "row-data": C.value,
1835
+ "page-size": De,
1836
+ "page-count": ft.value,
1837
+ "row-count": ze.value,
1838
+ "fetch-fn": _o,
1839
+ "hide-footer": ft.value <= 1,
1840
+ loading: y.value,
1841
+ "expanded-state": R.value,
1842
+ "get-row-can-expand": po,
1843
+ "get-sub-row": go,
1844
+ "pin-header-row": "",
1845
+ class: "audit-log-list-table cursor-pointer",
1846
+ "onUpdate:expandedState": s[8] || (s[8] = (p) => R.value = p),
1847
+ onRowClick: s[9] || (s[9] = (p) => xo(p.original))
1848
+ }, null, 8, ["column-defs", "row-data", "page-count", "row-count", "hide-footer", "loading", "expanded-state"]))]),
1849
+ _: 1
1850
+ }, 8, ["is-loading", "is-empty", "title", "subtitle"])])]),
1851
+ _: 1
1852
+ })])]),
1853
+ _: 1
1854
+ }, 8, ["heading"]), g(we, {
1855
+ header: u(o)("auditLog.detail.header"),
1856
+ "model-value": V.value,
1857
+ "max-width": 768,
1858
+ "dismiss-away": "",
1859
+ "onUpdate:modelValue": s[10] || (s[10] = (p) => {
1860
+ p || Lo();
1861
+ })
1862
+ }, {
1863
+ default: Y(() => [i.value ? (f(), v("div", Ts, [a("div", Vs, [a("div", $s, [a("p", Ps, l(ro(i.value)), 1), i.value.traceId ? (f(), v("p", Es, " Trace ID: " + l(i.value.traceId), 1)) : F("", !0), i.value.eventId ? (f(), v("p", Ns, " Event ID: " + l(i.value.eventId), 1)) : F("", !0)]), a("div", Rs, [g(E, {
1864
+ variant: Lt(i.value.outcome),
1865
+ label: Qe(i.value.outcome),
1866
+ compact: ""
1867
+ }, null, 8, ["variant", "label"]), u(Ct)(i.value) ? (f(), Oe(tt, {
1868
+ key: 0,
1869
+ variant: "plain",
1870
+ placement: "top"
1871
+ }, {
1872
+ content: Y(() => [Ae(l(u(o)("auditLog.operation.partialFailure")), 1)]),
1873
+ default: Y(() => [g(Ue, {
1874
+ name: "error",
1875
+ size: "sm",
1876
+ class: "cursor-help text-fm-color-typo-error"
1877
+ })]),
1878
+ _: 1
1879
+ })) : F("", !0)])]), a("div", Us, [a("div", Ks, [a("div", null, [a("p", Bs, l(u(o)("auditLog.detail.date")), 1), a("p", Ys, l(Xe(i.value.timestamp)), 1)]), a("div", null, [a("p", zs, l(u(o)("auditLog.detail.user")), 1), a("p", qs, l(Le(i.value)), 1)]), a("div", null, [a("p", Js, l(u(o)("auditLog.detail.email")), 1), a("p", Hs, l(lo(i.value)), 1)]), i.value.field ? (f(), v("div", Ws, [a("p", Gs, l(u(o)("auditLog.detail.field")), 1), a("p", Xs, l(i.value.field), 1)])) : F("", !0), a("div", null, [a("p", Qs, l(u(o)("auditLog.detail.business")), 1), a("p", Zs, l(i.value.businessId || "-"), 1)]), a("div", null, [a("p", ea, l(u(o)("auditLog.detail.restaurant")), 1), a("p", ta, l(i.value.restaurantId || "-"), 1)])])]), a("div", oa, [a("div", sa, [a("p", aa, l(u(o)("auditLog.detail.eventDetails")), 1)]), s[13] || (s[13] = a("hr", {
1880
+ class: "border-fm-color-border-default"
1881
+ }, null, -1)), a("div", na, [a("div", null, [a("p", la, l(u(o)("auditLog.detail.actionDescription")), 1), a("p", ra, l(i.value.metadata.operationLabel || "-"), 1)])])]), a("div", ia, [a("div", ua, [a("p", da, l(u(o)("auditLog.detail.metadata")), 1)]), s[14] || (s[14] = a("hr", {
1882
+ class: "border-fm-color-border-default"
1883
+ }, null, -1)), a("div", ca, [a("div", null, [a("p", fa, l(u(o)("auditLog.detail.resolvedFrom")), 1), a("p", ma, l(io(i.value.metadata.resolvedFrom)), 1)]), (i.value.metadata.resolvedFrom === "permissionSet" || i.value.metadata.resolvedFrom === "systemPermissionSet") && (i.value.metadata.permissionSetName || i.value.metadata.permissionSetId) ? (f(), v("div", va, [a("p", pa, l(u(o)("auditLog.detail.permissionSet")), 1), i.value.metadata.permissionSetName ? (f(), v("p", ga, l(i.value.metadata.permissionSetName), 1)) : F("", !0), i.value.metadata.permissionSetId ? (f(), v("p", ha, l(i.value.metadata.permissionSetId), 1)) : F("", !0)])) : F("", !0), i.value.metadata.reason ? (f(), v("div", ya, [a("p", ba, l(u(o)("auditLog.detail.reason")), 1), a("p", _a, l(i.value.metadata.reason), 1)])) : F("", !0), a("div", null, [a("p", xa, l(u(o)("auditLog.detail.requestMethod")), 1), a("p", La, l(uo(i.value)), 1)]), a("div", null, [a("p", Sa, l(u(o)("auditLog.detail.requestPath")), 1), a("p", ka, l(i.value.metadata.requestPath || "-"), 1)]), i.value.metadata.pos ? (f(), v(z, {
1884
+ key: 2
1885
+ }, [a("div", null, [a("p", wa, l(u(o)("auditLog.pos.details.eventKey")), 1), a("p", Ia, l(i.value.eventKey || "-"), 1)]), a("div", null, [a("p", Aa, l(u(o)("auditLog.columns.device")), 1), a("p", Fa, l(u(lt)(i.value, u(o))), 1), i.value.metadata.pos.machineId ? (f(), v("p", Ma, l(i.value.metadata.pos.machineId), 1)) : F("", !0)]), i.value.metadata.pos.appVersion ? (f(), v("div", Da, [a("p", Oa, l(u(o)("auditLog.pos.details.appVersion")), 1), a("p", Ca, l(i.value.metadata.pos.appVersion), 1)])) : F("", !0), a("div", null, [a("p", ja, l(u(o)("auditLog.columns.approver")), 1), a("p", Ta, l(u(jt)(i.value, u(o))), 1)]), a("div", null, [a("p", Va, l(u(o)("auditLog.pos.details.clock")), 1), a("p", $a, [Ae(l(Xe(new Date(i.value.metadata.pos.occurredAt))) + " · " + l(i.value.metadata.pos.clockSkewMs) + " ms", 1), i.value.metadata.pos.clockClamped ? (f(), v("span", Pa, " · " + l(u(o)("auditLog.pos.details.clamped")), 1)) : F("", !0)])]), i.value.params ? (f(), v("div", Ea, [a("p", Na, l(u(o)("auditLog.pos.details.params")), 1), a("pre", Ra, l(i.value.params), 1)])) : F("", !0)], 64)) : F("", !0), i.value.metadata.trace && i.value.metadata.trace.length > 0 ? (f(), v("div", Ua, [a("p", Ka, l(u(o)("auditLog.detail.permissionTrace")), 1), a("ol", Ba, [(f(!0), v(z, null, ce(i.value.metadata.trace, (p, $) => (f(), v("li", {
1886
+ key: $,
1887
+ class: "flex items-center gap-6"
1888
+ }, [a("span", Ya, l($ + 1), 1), a("span", za, l(p), 1), $ < i.value.metadata.trace.length - 1 ? (f(), v("span", qa, "→")) : F("", !0)]))), 128))])])) : F("", !0), T.value ? (f(), v("div", Ja, [a("p", Ha, l(u(o)("auditLog.detail.requestBody")), 1), a("pre", Wa, l(T.value), 1)])) : F("", !0)])])])) : F("", !0)]),
1889
+ _: 1
1890
+ }, 8, ["header", "model-value"]), g(we, {
1891
+ header: u(o)("auditLog.operation.sheetHeader"),
1892
+ "model-value": w.value,
1893
+ "max-width": 768,
1894
+ "dismiss-away": "",
1895
+ "onUpdate:modelValue": s[12] || (s[12] = (p) => {
1896
+ p || ko();
1897
+ })
1898
+ }, {
1899
+ default: Y(() => [m.value ? (f(), v("div", Ga, [a("div", Xa, [a("div", Qa, [a("p", Za, l(xt(m.value)), 1), m.value.entityId ? (f(), v("p", en, l(m.value.entityId), 1)) : F("", !0)]), g(E, {
1900
+ variant: m.value.status === "failed" ? "critical" : "success",
1901
+ label: m.value.status === "failed" ? u(o)("auditLog.outcome.failed") : u(o)("auditLog.outcome.success"),
1902
+ compact: ""
1903
+ }, null, 8, ["variant", "label"])]), a("div", tn, [a("div", on, [a("div", null, [a("p", sn, l(u(o)("auditLog.detail.date")), 1), a("p", an, l(Xe(m.value.timestamp)), 1)]), m.value.entityId ? (f(), v("div", nn, [a("p", ln, l(u(o)("auditLog.operation.entity")), 1), a("p", rn, l(m.value.entityId), 1)])) : F("", !0), m.value.durationMs !== void 0 ? (f(), v("div", un, [a("p", dn, l(u(o)("auditLog.operation.duration")), 1), a("p", cn, l(u(o)("auditLog.operation.durationValue", {
1904
+ ms: m.value.durationMs
1905
+ })), 1)])) : F("", !0)])]), m.value.status === "failed" ? (f(), v("div", fn, [a("p", mn, l(u(o)("auditLog.operation.error")), 1), a("p", vn, l(m.value.errorMessage || "-"), 1)])) : F("", !0), a("div", pn, [a("div", gn, [a("p", hn, l(u(o)("auditLog.operation.changes")), 1)]), s[17] || (s[17] = a("hr", {
1906
+ class: "border-fm-color-border-default"
1907
+ }, null, -1)), a("div", yn, [H.value.length ? (f(), v("div", bn, [(f(!0), v(z, null, ce(H.value, (p, $) => (f(), v("div", {
1908
+ key: $,
1909
+ class: "space-y-4 py-8 first:pt-0 last:pb-0"
1910
+ }, [a("div", _n, [g(E, {
1911
+ variant: _e(p.type),
1912
+ label: Ut(p.type),
1913
+ compact: ""
1914
+ }, null, 8, ["variant", "label"]), a("span", xn, l(Kt(p)), 1)]), a("p", Ln, [p.type === "add" ? (f(), v("span", Sn, l(p.afterDisplay), 1)) : p.type === "remove" ? (f(), v("span", kn, l(p.beforeDisplay), 1)) : (f(), v(z, {
1915
+ key: 2
1916
+ }, [a("span", wn, l(p.beforeDisplay), 1), s[15] || (s[15] = a("span", {
1917
+ class: "text-fm-color-typo-secondary"
1918
+ }, " → ", -1)), a("span", In, l(p.afterDisplay), 1)], 64))])]))), 128))])) : ct.value.length ? (f(), v("div", An, [(f(!0), v(z, null, ce(ct.value, (p) => (f(), v("div", {
1919
+ key: p.groupKey,
1920
+ class: "space-y-4 py-8 first:pt-0 last:pb-0"
1921
+ }, [a("div", Fn, [g(E, {
1922
+ variant: je(p.type),
1923
+ label: dt(p.type),
1924
+ compact: ""
1925
+ }, null, 8, ["variant", "label"]), a("span", Mn, l(p.displayKey), 1)]), a("div", Dn, [(f(!0), v(z, null, ce(p.rows, ($) => (f(), v("p", {
1926
+ key: $.path,
1927
+ class: "break-all font-mono text-xs"
1928
+ }, [$.type === "added" ? (f(), v("span", On, l($.after ?? "—"), 1)) : $.type === "removed" ? (f(), v("span", Cn, l($.before ?? "—"), 1)) : (f(), v(z, {
1929
+ key: 2
1930
+ }, [a("span", jn, l($.before ?? "—"), 1), s[16] || (s[16] = a("span", {
1931
+ class: "text-fm-color-typo-secondary"
1932
+ }, " → ", -1)), a("span", Tn, l($.after ?? "—"), 1)], 64))]))), 128))])]))), 128))])) : (f(), v("p", Vn, l(u(o)("auditLog.operation.noChanges")), 1))])]), U.value || k.value ? (f(), v("div", $n, [a("button", {
1933
+ type: "button",
1934
+ class: "flex w-full items-center justify-between p-12 text-left",
1935
+ onClick: s[11] || (s[11] = (p) => X.value = !X.value)
1936
+ }, [a("p", Pn, l(u(o)("auditLog.operation.showData")), 1), g(Ue, {
1937
+ name: "keyboard_arrow_down",
1938
+ class: Ko(["shrink-0 transition-transform", X.value ? "rotate-180" : ""])
1939
+ }, null, 8, ["class"])]), X.value ? (f(), v(z, {
1940
+ key: 0
1941
+ }, [s[18] || (s[18] = a("hr", {
1942
+ class: "border-fm-color-border-default"
1943
+ }, null, -1)), a("div", En, [U.value ? (f(), v("div", Nn, [a("p", Rn, l(u(o)("auditLog.operation.before")), 1), a("pre", Un, l(U.value), 1)])) : F("", !0), k.value ? (f(), v("div", Kn, [a("p", Bn, l(u(o)("auditLog.operation.after")), 1), a("pre", Yn, l(k.value), 1)])) : F("", !0)])], 64)) : F("", !0)])) : F("", !0)])) : F("", !0)]),
1944
+ _: 1
1945
+ }, 8, ["header", "model-value"])], 64);
1946
+ };
1947
+ }
1948
+ }), dl = /* @__PURE__ */ Zo(Jn, [["__scopeId", "data-v-2fab18d4"]]);
1949
+ export {
1950
+ dl as default
1951
+ };