@feedmepos/mf-hrm-portal 2.3.2-dev.2 → 2.3.2-dev.20

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