@nice2dev/ui-enterprise 1.2.0 → 1.2.1

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.
package/dist/index.mjs CHANGED
@@ -1,111 +1,111 @@
1
- import { jsxs as c, jsx as e, Fragment as ee } from "react/jsx-runtime";
2
- import { NtdClipboard as Be, NtdFile as He, NtdBrackets as Fe, NtdBarChart as Je, NtdFileText as we, NtdList as Ge, NtdGrid as Ke, NtdSearch as pe, NtdDownload as me, NtdChevronDown as De, NtdChevronRight as $e, NtdCircle as Ce, NtdSettings as Pe, NtdKey as be, NtdLogOut as Re, NtdLogIn as We, NtdError as oe, NtdCheck as ae, NtdUpload as Xe, NtdEye as Ze, NtdClose as ge, NtdEdit as Oe, NtdPlus as Se, NtdArrowRight as Qe, NtdBook as ec, NtdClock as xe, NtdArrowUp as cc, NtdArrowDown as ic, NtdLock as Ee, NtdOctagon as ac, NtdDollar as sc, NtdWarning as Me, NtdCookieConsent as tc, NtdArrowLeft as nc, NtdTrash as lc, NtdZap as je, NtdHelp as Ue, NtdFolder as rc, NtdUser as Ye, NtdRefresh as Ne, NtdMinus as oc, NtdTable as dc, NtdCalendar as hc, NtdMap as Te, NtdShield as qe, NtdSlash as uc, NtdFlag as pc, NtdUnlock as mc, NtdSmartphone as fe, NtdMonitor as gc } from "@nice2dev/icons";
3
- import vc, { forwardRef as te, useState as w, useCallback as $, useImperativeHandle as ne, useEffect as ue, useRef as ye, useId as bc, useMemo as he } from "react";
4
- import { NiceAppShell as Nc, NiceTutorialButton as fc, resolveTutorial as yc } from "@nice2dev/ui";
5
- function kc(i, s, t) {
6
- const a = t.csvDelimiter || ",", n = [];
7
- return t.includeHeaders !== !1 && n.push(
8
- s.filter((l) => l.include).map((l) => `"${l.label}"`).join(a)
9
- ), i.forEach((l) => {
10
- const h = s.filter((r) => r.include).map((r) => {
11
- let u = l[r.field];
12
- return r.transform && (u = r.transform(u)), u == null ? "" : typeof u == "string" ? `"${u.replace(/"/g, '""')}"` : String(u);
1
+ import { jsxs as c, jsx as e, Fragment as ae } from "react/jsx-runtime";
2
+ import { NtdClipboard as Ge, NtdFile as Ke, NtdBrackets as Re, NtdBarChart as We, NtdFileText as xe, NtdList as Xe, NtdGrid as Ze, NtdSearch as ge, NtdDownload as ve, NtdChevronDown as Se, NtdChevronRight as Fe, NtdCircle as De, NtdSettings as $e, NtdKey as fe, NtdLogOut as Me, NtdLogIn as Qe, NtdError as he, NtdCheck as se, NtdUpload as ec, NtdEye as cc, NtdClose as be, NtdEdit as je, NtdPlus as Te, NtdArrowRight as ac, NtdBook as tc, NtdClock as Le, NtdArrowUp as ic, NtdArrowDown as sc, NtdLock as Ue, NtdOctagon as nc, NtdDollar as lc, NtdWarning as Ye, NtdCookieConsent as rc, NtdArrowLeft as oc, NtdTrash as dc, NtdZap as qe, NtdHelp as Ve, NtdFolder as hc, NtdUser as Be, NtdRefresh as ye, NtdMinus as pc, NtdTable as uc, NtdCalendar as mc, NtdMap as Ee, NtdShield as He, NtdSlash as gc, NtdFlag as vc, NtdUnlock as bc, NtdSmartphone as we, NtdMonitor as Nc } from "@nice2dev/icons";
3
+ import { useNiceTranslation as W, NiceAppShell as fc, NiceTutorialButton as yc, resolveTutorial as wc, NiceIcon as _e } from "@nice2dev/ui";
4
+ import kc, { forwardRef as le, useState as k, useCallback as R, useImperativeHandle as re, useEffect as me, useRef as ke, useId as Cc, useMemo as ue } from "react";
5
+ function xc(a, n, s) {
6
+ const i = s.csvDelimiter || ",", t = [];
7
+ return s.includeHeaders !== !1 && t.push(
8
+ n.filter((l) => l.include).map((l) => `"${l.label}"`).join(i)
9
+ ), a.forEach((l) => {
10
+ const h = n.filter((r) => r.include).map((r) => {
11
+ let o = l[r.field];
12
+ return r.transform && (o = r.transform(o)), o == null ? "" : typeof o == "string" ? `"${o.replace(/"/g, '""')}"` : String(o);
13
13
  });
14
- n.push(h.join(a));
15
- }), n.join(`
14
+ t.push(h.join(i));
15
+ }), t.join(`
16
16
  `);
17
17
  }
18
- function wc(i, s, t) {
19
- const a = s.filter((l) => l.include), n = i.map((l) => {
18
+ function Sc(a, n, s) {
19
+ const i = n.filter((l) => l.include), t = a.map((l) => {
20
20
  const h = {};
21
- return a.forEach((r) => {
22
- let u = l[r.field];
23
- r.transform && (u = r.transform(u)), h[r.field] = u;
21
+ return i.forEach((r) => {
22
+ let o = l[r.field];
23
+ r.transform && (o = r.transform(o)), h[r.field] = o;
24
24
  }), h;
25
25
  });
26
- return JSON.stringify(n, null, 2);
26
+ return JSON.stringify(t, null, 2);
27
27
  }
28
- const ke = {
29
- csv: { label: "CSV", icon: /* @__PURE__ */ e(we, { size: 20 }), description: "Comma-separated values" },
30
- xlsx: { label: "Excel", icon: /* @__PURE__ */ e(Je, { size: 20 }), description: "Microsoft Excel" },
28
+ const Ce = {
29
+ csv: { label: "CSV", icon: /* @__PURE__ */ e(xe, { size: 20 }), description: "Comma-separated values" },
30
+ xlsx: { label: "Excel", icon: /* @__PURE__ */ e(We, { size: 20 }), description: "Microsoft Excel" },
31
31
  json: {
32
32
  label: "JSON",
33
- icon: /* @__PURE__ */ e(Fe, { size: 20 }),
33
+ icon: /* @__PURE__ */ e(Re, { size: 20 }),
34
34
  description: "JavaScript Object Notation"
35
35
  },
36
- pdf: { label: "PDF", icon: /* @__PURE__ */ e(He, { size: 20 }), description: "Portable Document Format" },
36
+ pdf: { label: "PDF", icon: /* @__PURE__ */ e(Ke, { size: 20 }), description: "Portable Document Format" },
37
37
  xml: {
38
38
  label: "XML",
39
- icon: /* @__PURE__ */ e(Be, { size: 20 }),
39
+ icon: /* @__PURE__ */ e(Ge, { size: 20 }),
40
40
  description: "Extensible Markup Language"
41
41
  }
42
- }, Dc = ({ formats: i, selected: s, onChange: t }) => /* @__PURE__ */ e("div", { className: "nice-export-formats", children: i.map((a) => {
43
- const n = ke[a];
42
+ }, Dc = ({ formats: a, selected: n, onChange: s }) => /* @__PURE__ */ e("div", { className: "nice-export-formats", children: a.map((i) => {
43
+ const t = Ce[i];
44
44
  return /* @__PURE__ */ c(
45
45
  "button",
46
46
  {
47
47
  type: "button",
48
- className: `nice-export-format ${s === a ? "nice-export-format--selected" : ""}`,
49
- onClick: () => t(a),
50
- title: n.description,
48
+ className: `nice-export-format ${n === i ? "nice-export-format--selected" : ""}`,
49
+ onClick: () => s(i),
50
+ title: t.description,
51
51
  children: [
52
- /* @__PURE__ */ e("span", { className: "nice-export-format-icon", children: n.icon }),
53
- /* @__PURE__ */ e("span", { className: "nice-export-format-label", children: n.label })
52
+ /* @__PURE__ */ e("span", { className: "nice-export-format-icon", children: t.icon }),
53
+ /* @__PURE__ */ e("span", { className: "nice-export-format-label", children: t.label })
54
54
  ]
55
55
  },
56
- a
56
+ i
57
57
  );
58
- }) }), Cc = ({ fields: i, onChange: s }) => {
59
- const t = (l) => {
60
- const h = [...i];
61
- h[l] = { ...h[l], include: !h[l].include }, s(h);
62
- }, a = (l) => {
63
- s(i.map((h) => ({ ...h, include: l })));
64
- }, n = i.filter((l) => l.include).length;
58
+ }) }), Tc = ({ fields: a, onChange: n }) => {
59
+ const { t: s } = W(), i = (h) => {
60
+ const r = [...a];
61
+ r[h] = { ...r[h], include: !r[h].include }, n(r);
62
+ }, t = (h) => {
63
+ n(a.map((r) => ({ ...r, include: h })));
64
+ }, l = a.filter((h) => h.include).length;
65
65
  return /* @__PURE__ */ c("div", { className: "nice-export-fields", children: [
66
66
  /* @__PURE__ */ c("div", { className: "nice-export-fields-header", children: [
67
67
  /* @__PURE__ */ c("span", { children: [
68
68
  "Fields to export (",
69
- n,
69
+ l,
70
70
  "/",
71
- i.length,
71
+ a.length,
72
72
  ")"
73
73
  ] }),
74
74
  /* @__PURE__ */ c("div", { className: "nice-export-fields-actions", children: [
75
- /* @__PURE__ */ e("button", { type: "button", onClick: () => a(!0), children: "Select all" }),
76
- /* @__PURE__ */ e("button", { type: "button", onClick: () => a(!1), children: "Deselect all" })
75
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => t(!0), children: s("dataExportCenter.selectAll", "Select all") }),
76
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => t(!1), children: s("dataExportCenter.deselectAll", "Deselect all") })
77
77
  ] })
78
78
  ] }),
79
- /* @__PURE__ */ e("div", { className: "nice-export-fields-list", children: i.map((l, h) => /* @__PURE__ */ c("label", { className: "nice-export-field", children: [
80
- /* @__PURE__ */ e("input", { type: "checkbox", checked: l.include, onChange: () => t(h) }),
81
- /* @__PURE__ */ e("span", { className: "nice-export-field-label", children: l.label }),
82
- /* @__PURE__ */ e("span", { className: "nice-export-field-name", children: l.field })
83
- ] }, l.field)) })
79
+ /* @__PURE__ */ e("div", { className: "nice-export-fields-list", children: a.map((h, r) => /* @__PURE__ */ c("label", { className: "nice-export-field", children: [
80
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: h.include, onChange: () => i(r) }),
81
+ /* @__PURE__ */ e("span", { className: "nice-export-field-label", children: h.label }),
82
+ /* @__PURE__ */ e("span", { className: "nice-export-field-name", children: h.field })
83
+ ] }, h.field)) })
84
84
  ] });
85
- }, Sc = ({ format: i, options: s, onChange: t }) => {
86
- const a = (n, l) => {
87
- t({ ...s, [n]: l });
85
+ }, Lc = ({ format: a, options: n, onChange: s }) => {
86
+ const { t: i } = W(), t = (l, h) => {
87
+ s({ ...n, [l]: h });
88
88
  };
89
89
  return /* @__PURE__ */ c("div", { className: "nice-export-options", children: [
90
- /* @__PURE__ */ e("h4", { children: "Export Options" }),
90
+ /* @__PURE__ */ e("h4", { children: i("dataExportCenter.exportOptions", "Export Options") }),
91
91
  /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
92
92
  /* @__PURE__ */ e(
93
93
  "input",
94
94
  {
95
95
  type: "checkbox",
96
- checked: s.includeHeaders !== !1,
97
- onChange: (n) => a("includeHeaders", n.target.checked)
96
+ checked: n.includeHeaders !== !1,
97
+ onChange: (l) => t("includeHeaders", l.target.checked)
98
98
  }
99
99
  ),
100
- "Include headers"
100
+ i("dataExportCenter.includeHeaders", "Include headers")
101
101
  ] }),
102
- i === "csv" && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
102
+ a === "csv" && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
103
103
  /* @__PURE__ */ e("span", { children: "Delimiter:" }),
104
104
  /* @__PURE__ */ c(
105
105
  "select",
106
106
  {
107
- value: s.csvDelimiter || ",",
108
- onChange: (n) => a("csvDelimiter", n.target.value),
107
+ value: n.csvDelimiter || ",",
108
+ onChange: (l) => t("csvDelimiter", l.target.value),
109
109
  children: [
110
110
  /* @__PURE__ */ e("option", { value: ",", children: "Comma (,)" }),
111
111
  /* @__PURE__ */ e("option", { value: ";", children: "Semicolon (;)" }),
@@ -120,13 +120,13 @@ const ke = {
120
120
  /* @__PURE__ */ c(
121
121
  "select",
122
122
  {
123
- value: s.dateFormat || "YYYY-MM-DD",
124
- onChange: (n) => a("dateFormat", n.target.value),
123
+ value: n.dateFormat || "YYYY-MM-DD",
124
+ onChange: (l) => t("dateFormat", l.target.value),
125
125
  children: [
126
- /* @__PURE__ */ e("option", { value: "YYYY-MM-DD", children: "YYYY-MM-DD" }),
126
+ /* @__PURE__ */ e("option", { value: "YYYY-MM-DD", children: i("dataExportCenter.yyyyMmDd", "YYYY-MM-DD") }),
127
127
  /* @__PURE__ */ e("option", { value: "DD/MM/YYYY", children: "DD/MM/YYYY" }),
128
128
  /* @__PURE__ */ e("option", { value: "MM/DD/YYYY", children: "MM/DD/YYYY" }),
129
- /* @__PURE__ */ e("option", { value: "ISO", children: "ISO 8601" })
129
+ /* @__PURE__ */ e("option", { value: "ISO", children: i("dataExportCenter.iso8601", "ISO 8601") })
130
130
  ]
131
131
  }
132
132
  )
@@ -136,364 +136,369 @@ const ke = {
136
136
  /* @__PURE__ */ c(
137
137
  "select",
138
138
  {
139
- value: s.encoding || "utf-8",
140
- onChange: (n) => a("encoding", n.target.value),
139
+ value: n.encoding || "utf-8",
140
+ onChange: (l) => t("encoding", l.target.value),
141
141
  children: [
142
- /* @__PURE__ */ e("option", { value: "utf-8", children: "UTF-8" }),
143
- /* @__PURE__ */ e("option", { value: "utf-16", children: "UTF-16" }),
144
- /* @__PURE__ */ e("option", { value: "iso-8859-1", children: "ISO-8859-1" })
142
+ /* @__PURE__ */ e("option", { value: "utf-8", children: i("dataExportCenter.utf8", "UTF-8") }),
143
+ /* @__PURE__ */ e("option", { value: "utf-16", children: i("dataExportCenter.utf16", "UTF-16") }),
144
+ /* @__PURE__ */ e("option", { value: "iso-8859-1", children: i("dataExportCenter.iso88591", "ISO-8859-1") })
145
145
  ]
146
146
  }
147
147
  )
148
148
  ] }),
149
- (i === "xlsx" || i === "pdf") && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
149
+ (a === "xlsx" || a === "pdf") && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
150
150
  /* @__PURE__ */ e("span", { children: "Password protect:" }),
151
151
  /* @__PURE__ */ e(
152
152
  "input",
153
153
  {
154
154
  type: "password",
155
- value: s.password || "",
156
- onChange: (n) => a("password", n.target.value || void 0),
157
- placeholder: "Leave empty for no password"
155
+ value: n.password || "",
156
+ onChange: (l) => t("password", l.target.value || void 0),
157
+ placeholder: i(
158
+ "dataExportCenter.leaveEmptyForNoPassword",
159
+ "Leave empty for no password"
160
+ )
158
161
  }
159
162
  )
160
163
  ] })
161
164
  ] });
162
- }, xc = ({ jobs: i, onDownload: s }) => {
163
- if (i.length === 0)
164
- return /* @__PURE__ */ e("div", { className: "nice-export-history-empty", children: "No export history" });
165
- const t = (a) => a ? a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : `${(a / 1024 / 1024).toFixed(1)} MB` : "-";
165
+ }, zc = ({ jobs: a, onDownload: n }) => {
166
+ const { t: s } = W();
167
+ if (a.length === 0)
168
+ return /* @__PURE__ */ e("div", { className: "nice-export-history-empty", children: s("dataExportCenter.noExportHistory", "No export history") });
169
+ const i = (t) => t ? t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / 1024 / 1024).toFixed(1)} MB` : "-";
166
170
  return /* @__PURE__ */ c("div", { className: "nice-export-history", children: [
167
- /* @__PURE__ */ e("h4", { children: "Export History" }),
168
- /* @__PURE__ */ e("div", { className: "nice-export-history-list", children: i.map((a) => /* @__PURE__ */ c("div", { className: `nice-export-job nice-export-job--${a.status}`, children: [
171
+ /* @__PURE__ */ e("h4", { children: s("dataExportCenter.exportHistory", "Export History") }),
172
+ /* @__PURE__ */ e("div", { className: "nice-export-history-list", children: a.map((t) => /* @__PURE__ */ c("div", { className: `nice-export-job nice-export-job--${t.status}`, children: [
169
173
  /* @__PURE__ */ c("div", { className: "nice-export-job-info", children: [
170
- /* @__PURE__ */ e("span", { className: "nice-export-job-name", children: a.name }),
171
- /* @__PURE__ */ e("span", { className: "nice-export-job-format", children: a.format.toUpperCase() }),
172
- /* @__PURE__ */ e("span", { className: "nice-export-job-date", children: new Date(a.createdAt).toLocaleString() })
174
+ /* @__PURE__ */ e("span", { className: "nice-export-job-name", children: t.name }),
175
+ /* @__PURE__ */ e("span", { className: "nice-export-job-format", children: t.format.toUpperCase() }),
176
+ /* @__PURE__ */ e("span", { className: "nice-export-job-date", children: new Date(t.createdAt).toLocaleString() })
173
177
  ] }),
174
178
  /* @__PURE__ */ c("div", { className: "nice-export-job-meta", children: [
175
- a.rowCount && /* @__PURE__ */ c("span", { children: [
176
- a.rowCount,
179
+ t.rowCount && /* @__PURE__ */ c("span", { children: [
180
+ t.rowCount,
177
181
  " rows"
178
182
  ] }),
179
- a.fileSize && /* @__PURE__ */ e("span", { children: t(a.fileSize) })
183
+ t.fileSize && /* @__PURE__ */ e("span", { children: i(t.fileSize) })
180
184
  ] }),
181
185
  /* @__PURE__ */ c("div", { className: "nice-export-job-status", children: [
182
- a.status === "processing" && /* @__PURE__ */ e("div", { className: "nice-export-job-progress", children: /* @__PURE__ */ e(
186
+ t.status === "processing" && /* @__PURE__ */ e("div", { className: "nice-export-job-progress", children: /* @__PURE__ */ e(
183
187
  "div",
184
188
  {
185
189
  className: "nice-export-job-progress-bar",
186
- style: { width: `${a.progress}%` }
190
+ style: { width: `${t.progress}%` }
187
191
  }
188
192
  ) }),
189
- a.status === "completed" && a.downloadUrl && /* @__PURE__ */ e(
193
+ t.status === "completed" && t.downloadUrl && /* @__PURE__ */ e(
190
194
  "button",
191
195
  {
192
196
  type: "button",
193
197
  className: "nice-export-job-download",
194
- onClick: () => s == null ? void 0 : s(a),
195
- children: "Download"
198
+ onClick: () => n == null ? void 0 : n(t),
199
+ children: s("dataExportCenter.download", "Download")
196
200
  }
197
201
  ),
198
- a.status === "failed" && /* @__PURE__ */ e("span", { className: "nice-export-job-error", title: a.error, children: "Failed" })
202
+ t.status === "failed" && /* @__PURE__ */ e("span", { className: "nice-export-job-error", title: t.error, children: s("dataExportCenter.failed", "Failed") })
199
203
  ] })
200
- ] }, a.id)) })
204
+ ] }, t.id)) })
201
205
  ] });
202
- }, zc = te(
203
- ({
204
- dataSource: i,
205
- formats: s = ["csv", "xlsx", "json", "pdf"],
206
- templates: t = [],
207
- enableScheduling: a = !1,
208
- exportHistory: n = [],
209
- onExportStart: l,
210
- onExportComplete: h,
211
- onExportError: r,
212
- onSaveTemplate: u,
213
- onDeleteTemplate: T,
214
- onSchedule: E,
215
- customExportHandler: S,
216
- title: y = "Data Export",
217
- description: J,
218
- className: _ = "",
219
- style: K
220
- }, O) => {
221
- const [M, j] = w(s[0]), [U, B] = w(i.getFields()), [m, k] = w({
222
- includeHeaders: !0,
223
- dateFormat: "YYYY-MM-DD",
224
- encoding: "utf-8"
225
- }), [g, Y] = w(!1), [p, P] = w(0), [A, I] = w("export"), C = $(async () => {
226
- const v = {
227
- id: Date.now().toString(),
228
- name: `Export ${(/* @__PURE__ */ new Date()).toISOString()}`,
229
- format: M,
230
- status: "processing",
231
- progress: 0,
232
- createdAt: /* @__PURE__ */ new Date()
233
- };
234
- Y(!0), P(0), l == null || l(v);
235
- try {
236
- const x = await i.fetchData({
237
- fields: U,
238
- filters: void 0,
239
- sorting: void 0
240
- });
241
- P(50);
242
- let z;
243
- if (S)
244
- z = await S(M, x, m);
245
- else
246
- switch (M) {
247
- case "csv":
248
- z = kc(x, U, m);
249
- break;
250
- case "json":
251
- z = wc(x, U, m);
252
- break;
253
- default:
254
- throw new Error(`Format ${M} requires a custom export handler`);
255
- }
256
- P(100);
257
- const G = typeof z == "string" ? new Blob([z], { type: "text/plain" }) : z, V = URL.createObjectURL(G), b = document.createElement("a");
258
- b.href = V, b.download = `export-${Date.now()}.${M}`, document.body.appendChild(b), b.click(), document.body.removeChild(b), URL.revokeObjectURL(V);
259
- const L = {
260
- ...v,
261
- status: "completed",
262
- progress: 100,
263
- completedAt: /* @__PURE__ */ new Date(),
264
- rowCount: x.length,
265
- fileSize: G.size
206
+ }, ta = /* @__PURE__ */ Object.assign(
207
+ /* @__PURE__ */ le(
208
+ ({
209
+ dataSource: a,
210
+ formats: n = ["csv", "xlsx", "json", "pdf"],
211
+ templates: s = [],
212
+ enableScheduling: i = !1,
213
+ exportHistory: t = [],
214
+ onExportStart: l,
215
+ onExportComplete: h,
216
+ onExportError: r,
217
+ onSaveTemplate: o,
218
+ onDeleteTemplate: w,
219
+ onSchedule: _,
220
+ customExportHandler: I,
221
+ title: C,
222
+ description: z,
223
+ className: F = "",
224
+ style: U
225
+ }, L) => {
226
+ const { t: Y } = W(), ce = C ?? Y("dataExportCenter.title", "Data Export"), [$, q] = k(n[0]), [E, m] = k(a.getFields()), [N, g] = k({
227
+ includeHeaders: !0,
228
+ dateFormat: "YYYY-MM-DD",
229
+ encoding: "utf-8"
230
+ }), [V, u] = k(!1), [B, O] = k(0), [P, x] = k("export"), H = R(async () => {
231
+ const b = {
232
+ id: Date.now().toString(),
233
+ name: `Export ${(/* @__PURE__ */ new Date()).toISOString()}`,
234
+ format: $,
235
+ status: "processing",
236
+ progress: 0,
237
+ createdAt: /* @__PURE__ */ new Date()
266
238
  };
267
- h == null || h(L);
268
- } catch (x) {
269
- const z = {
270
- ...v,
271
- status: "failed",
272
- error: x instanceof Error ? x.message : "Unknown error"
273
- };
274
- r == null || r(z, x instanceof Error ? x : new Error("Export failed"));
275
- } finally {
276
- Y(!1), P(0);
277
- }
278
- }, [
279
- M,
280
- U,
281
- m,
282
- i,
283
- S,
284
- l,
285
- h,
286
- r
287
- ]), q = $(
288
- (v) => {
289
- const x = t.find((z) => z.id === v);
290
- x && (j(x.format), B(x.fields), x.options && k(x.options));
291
- },
292
- [t]
293
- );
294
- return ne(O, () => ({
295
- exportNow: async (v) => {
296
- j(v), await C();
297
- },
298
- getSelectedFields: () => U,
299
- loadTemplate: q
300
- })), /* @__PURE__ */ c("div", { className: `nice-export-center ${_}`, style: K, children: [
301
- /* @__PURE__ */ e("div", { className: "nice-export-header", children: /* @__PURE__ */ c("div", { className: "nice-export-title-area", children: [
302
- /* @__PURE__ */ e("h3", { className: "nice-export-title", children: y }),
303
- J && /* @__PURE__ */ e("p", { className: "nice-export-description", children: J })
304
- ] }) }),
305
- /* @__PURE__ */ c("div", { className: "nice-export-tabs", children: [
306
- /* @__PURE__ */ e(
307
- "button",
308
- {
309
- type: "button",
310
- className: `nice-export-tab ${A === "export" ? "nice-export-tab--active" : ""}`,
311
- onClick: () => I("export"),
312
- children: "Export"
313
- }
314
- ),
315
- t.length > 0 && /* @__PURE__ */ c(
316
- "button",
317
- {
318
- type: "button",
319
- className: `nice-export-tab ${A === "templates" ? "nice-export-tab--active" : ""}`,
320
- onClick: () => I("templates"),
321
- children: [
322
- "Templates (",
323
- t.length,
324
- ")"
325
- ]
326
- }
327
- ),
328
- n.length > 0 && /* @__PURE__ */ e(
329
- "button",
330
- {
331
- type: "button",
332
- className: `nice-export-tab ${A === "history" ? "nice-export-tab--active" : ""}`,
333
- onClick: () => I("history"),
334
- children: "History"
335
- }
336
- )
337
- ] }),
338
- /* @__PURE__ */ c("div", { className: "nice-export-content", children: [
339
- A === "export" && /* @__PURE__ */ c(ee, { children: [
239
+ u(!0), O(0), l == null || l(b);
240
+ try {
241
+ const S = await a.fetchData({
242
+ fields: E,
243
+ filters: void 0,
244
+ sorting: void 0
245
+ });
246
+ O(50);
247
+ let A;
248
+ if (I)
249
+ A = await I($, S, N);
250
+ else
251
+ switch ($) {
252
+ case "csv":
253
+ A = xc(S, E, N);
254
+ break;
255
+ case "json":
256
+ A = Sc(S, E, N);
257
+ break;
258
+ default:
259
+ throw new Error(`Format ${$} requires a custom export handler`);
260
+ }
261
+ O(100);
262
+ const J = typeof A == "string" ? new Blob([A], { type: "text/plain" }) : A, f = URL.createObjectURL(J), T = document.createElement("a");
263
+ T.href = f, T.download = `export-${Date.now()}.${$}`, document.body.appendChild(T), T.click(), document.body.removeChild(T), URL.revokeObjectURL(f);
264
+ const X = {
265
+ ...b,
266
+ status: "completed",
267
+ progress: 100,
268
+ completedAt: /* @__PURE__ */ new Date(),
269
+ rowCount: S.length,
270
+ fileSize: J.size
271
+ };
272
+ h == null || h(X);
273
+ } catch (S) {
274
+ const A = {
275
+ ...b,
276
+ status: "failed",
277
+ error: S instanceof Error ? S.message : "Unknown error"
278
+ };
279
+ r == null || r(A, S instanceof Error ? S : new Error("Export failed"));
280
+ } finally {
281
+ u(!1), O(0);
282
+ }
283
+ }, [
284
+ $,
285
+ E,
286
+ N,
287
+ a,
288
+ I,
289
+ l,
290
+ h,
291
+ r
292
+ ]), j = R(
293
+ (b) => {
294
+ const S = s.find((A) => A.id === b);
295
+ S && (q(S.format), m(S.fields), S.options && g(S.options));
296
+ },
297
+ [s]
298
+ );
299
+ return re(L, () => ({
300
+ exportNow: async (b) => {
301
+ q(b), await H();
302
+ },
303
+ getSelectedFields: () => E,
304
+ loadTemplate: j
305
+ })), /* @__PURE__ */ c("div", { className: `nice-export-center ${F}`, style: U, children: [
306
+ /* @__PURE__ */ e("div", { className: "nice-export-header", children: /* @__PURE__ */ c("div", { className: "nice-export-title-area", children: [
307
+ /* @__PURE__ */ e("h3", { className: "nice-export-title", children: ce }),
308
+ z && /* @__PURE__ */ e("p", { className: "nice-export-description", children: z })
309
+ ] }) }),
310
+ /* @__PURE__ */ c("div", { className: "nice-export-tabs", children: [
340
311
  /* @__PURE__ */ e(
341
- Dc,
312
+ "button",
313
+ {
314
+ type: "button",
315
+ className: `nice-export-tab ${P === "export" ? "nice-export-tab--active" : ""}`,
316
+ onClick: () => x("export"),
317
+ children: Y("dataExportCenter.export", "Export")
318
+ }
319
+ ),
320
+ s.length > 0 && /* @__PURE__ */ c(
321
+ "button",
342
322
  {
343
- formats: s,
344
- selected: M,
345
- onChange: j
323
+ type: "button",
324
+ className: `nice-export-tab ${P === "templates" ? "nice-export-tab--active" : ""}`,
325
+ onClick: () => x("templates"),
326
+ children: [
327
+ "Templates (",
328
+ s.length,
329
+ ")"
330
+ ]
346
331
  }
347
332
  ),
348
- /* @__PURE__ */ e(Cc, { fields: U, onChange: B }),
349
- /* @__PURE__ */ e(Sc, { format: M, options: m, onChange: k }),
350
- /* @__PURE__ */ c("div", { className: "nice-export-actions", children: [
333
+ t.length > 0 && /* @__PURE__ */ e(
334
+ "button",
335
+ {
336
+ type: "button",
337
+ className: `nice-export-tab ${P === "history" ? "nice-export-tab--active" : ""}`,
338
+ onClick: () => x("history"),
339
+ children: Y("dataExportCenter.history", "History")
340
+ }
341
+ )
342
+ ] }),
343
+ /* @__PURE__ */ c("div", { className: "nice-export-content", children: [
344
+ P === "export" && /* @__PURE__ */ c(ae, { children: [
351
345
  /* @__PURE__ */ e(
352
- "button",
346
+ Dc,
353
347
  {
354
- type: "button",
355
- className: "nice-export-btn nice-export-btn--primary",
356
- onClick: C,
357
- disabled: g || U.filter((v) => v.include).length === 0,
358
- children: g ? `Exporting... ${p}%` : "Export Now"
348
+ formats: n,
349
+ selected: $,
350
+ onChange: q
359
351
  }
360
352
  ),
361
- u && /* @__PURE__ */ e(
362
- "button",
363
- {
364
- type: "button",
365
- className: "nice-export-btn nice-export-btn--secondary",
366
- onClick: () => u({
367
- id: Date.now().toString(),
368
- name: `Template ${t.length + 1}`,
369
- format: M,
370
- fields: U,
371
- options: m
372
- }),
373
- children: "Save as Template"
374
- }
375
- )
376
- ] })
377
- ] }),
378
- A === "templates" && /* @__PURE__ */ e("div", { className: "nice-export-templates", children: t.map((v) => /* @__PURE__ */ c("div", { className: "nice-export-template", children: [
379
- /* @__PURE__ */ c("div", { className: "nice-export-template-info", children: [
380
- /* @__PURE__ */ e("span", { className: "nice-export-template-name", children: v.name }),
381
- /* @__PURE__ */ c("span", { className: "nice-export-template-format", children: [
382
- ke[v.format].icon,
383
- " ",
384
- ke[v.format].label
385
- ] }),
386
- v.description && /* @__PURE__ */ e("span", { className: "nice-export-template-desc", children: v.description })
353
+ /* @__PURE__ */ e(Tc, { fields: E, onChange: m }),
354
+ /* @__PURE__ */ e(Lc, { format: $, options: N, onChange: g }),
355
+ /* @__PURE__ */ c("div", { className: "nice-export-actions", children: [
356
+ /* @__PURE__ */ e(
357
+ "button",
358
+ {
359
+ type: "button",
360
+ className: "nice-export-btn nice-export-btn--primary",
361
+ onClick: H,
362
+ disabled: V || E.filter((b) => b.include).length === 0,
363
+ children: V ? `Exporting... ${B}%` : "Export Now"
364
+ }
365
+ ),
366
+ o && /* @__PURE__ */ e(
367
+ "button",
368
+ {
369
+ type: "button",
370
+ className: "nice-export-btn nice-export-btn--secondary",
371
+ onClick: () => o({
372
+ id: Date.now().toString(),
373
+ name: `Template ${s.length + 1}`,
374
+ format: $,
375
+ fields: E,
376
+ options: N
377
+ }),
378
+ children: Y("dataExportCenter.saveAsTemplate", "Save as Template")
379
+ }
380
+ )
381
+ ] })
387
382
  ] }),
388
- /* @__PURE__ */ c("div", { className: "nice-export-template-actions", children: [
389
- /* @__PURE__ */ e(
390
- "button",
391
- {
392
- type: "button",
393
- onClick: () => {
394
- q(v.id), I("export");
395
- },
396
- children: "Use"
383
+ P === "templates" && /* @__PURE__ */ e("div", { className: "nice-export-templates", children: s.map((b) => /* @__PURE__ */ c("div", { className: "nice-export-template", children: [
384
+ /* @__PURE__ */ c("div", { className: "nice-export-template-info", children: [
385
+ /* @__PURE__ */ e("span", { className: "nice-export-template-name", children: b.name }),
386
+ /* @__PURE__ */ c("span", { className: "nice-export-template-format", children: [
387
+ Ce[b.format].icon,
388
+ " ",
389
+ Ce[b.format].label
390
+ ] }),
391
+ b.description && /* @__PURE__ */ e("span", { className: "nice-export-template-desc", children: b.description })
392
+ ] }),
393
+ /* @__PURE__ */ c("div", { className: "nice-export-template-actions", children: [
394
+ /* @__PURE__ */ e(
395
+ "button",
396
+ {
397
+ type: "button",
398
+ onClick: () => {
399
+ j(b.id), x("export");
400
+ },
401
+ children: "Use"
402
+ }
403
+ ),
404
+ w && /* @__PURE__ */ e("button", { type: "button", onClick: () => w(b.id), children: Y("dataExportCenter.delete", "Delete") })
405
+ ] })
406
+ ] }, b.id)) }),
407
+ P === "history" && /* @__PURE__ */ e(
408
+ zc,
409
+ {
410
+ jobs: t,
411
+ onDownload: (b) => {
412
+ b.downloadUrl && window.open(b.downloadUrl, "_blank");
397
413
  }
398
- ),
399
- T && /* @__PURE__ */ e("button", { type: "button", onClick: () => T(v.id), children: "Delete" })
400
- ] })
401
- ] }, v.id)) }),
402
- A === "history" && /* @__PURE__ */ e(
403
- xc,
404
- {
405
- jobs: n,
406
- onDownload: (v) => {
407
- v.downloadUrl && window.open(v.downloadUrl, "_blank");
408
414
  }
409
- }
410
- )
411
- ] })
412
- ] });
413
- }
414
- );
415
- zc.displayName = "NiceDataExportCenter";
416
- const se = {
415
+ )
416
+ ] })
417
+ ] });
418
+ }
419
+ ),
420
+ { displayName: "NiceDataExportCenter" }
421
+ ), ne = {
417
422
  create: {
418
- icon: /* @__PURE__ */ e(Se, { size: 16 }),
423
+ icon: /* @__PURE__ */ e(Te, { size: 16 }),
419
424
  label: "Created",
420
425
  color: "var(--nice-color-success, #10b981)"
421
426
  },
422
427
  update: {
423
- icon: /* @__PURE__ */ e(Oe, { size: 16 }),
428
+ icon: /* @__PURE__ */ e(je, { size: 16 }),
424
429
  label: "Updated",
425
430
  color: "var(--nice-color-primary, #3b82f6)"
426
431
  },
427
432
  delete: {
428
- icon: /* @__PURE__ */ e(ge, { size: 16 }),
433
+ icon: /* @__PURE__ */ e(be, { size: 16 }),
429
434
  label: "Deleted",
430
435
  color: "var(--nice-color-error, #ef4444)"
431
436
  },
432
- view: { icon: /* @__PURE__ */ e(Ze, { size: 16 }), label: "Viewed", color: "var(--nice-text-muted, #6b7280)" },
437
+ view: { icon: /* @__PURE__ */ e(cc, { size: 16 }), label: "Viewed", color: "var(--nice-text-muted, #6b7280)" },
433
438
  export: {
434
- icon: /* @__PURE__ */ e(me, { size: 16 }),
439
+ icon: /* @__PURE__ */ e(ve, { size: 16 }),
435
440
  label: "Exported",
436
441
  color: "var(--nice-color-accent, #8b5cf6)"
437
442
  },
438
443
  import: {
439
- icon: /* @__PURE__ */ e(Xe, { size: 16 }),
444
+ icon: /* @__PURE__ */ e(ec, { size: 16 }),
440
445
  label: "Imported",
441
446
  color: "var(--nice-color-accent, #8b5cf6)"
442
447
  },
443
448
  approve: {
444
- icon: /* @__PURE__ */ e(ae, { size: 16 }),
449
+ icon: /* @__PURE__ */ e(se, { size: 16 }),
445
450
  label: "Approved",
446
451
  color: "var(--nice-color-success, #10b981)"
447
452
  },
448
453
  reject: {
449
- icon: /* @__PURE__ */ e(oe, { size: 16 }),
454
+ icon: /* @__PURE__ */ e(he, { size: 16 }),
450
455
  label: "Rejected",
451
456
  color: "var(--nice-color-error, #ef4444)"
452
457
  },
453
458
  login: {
454
- icon: /* @__PURE__ */ e(We, { size: 16 }),
459
+ icon: /* @__PURE__ */ e(Qe, { size: 16 }),
455
460
  label: "Login",
456
461
  color: "var(--nice-color-success, #10b981)"
457
462
  },
458
463
  logout: {
459
- icon: /* @__PURE__ */ e(Re, { size: 16 }),
464
+ icon: /* @__PURE__ */ e(Me, { size: 16 }),
460
465
  label: "Logout",
461
466
  color: "var(--nice-text-muted, #6b7280)"
462
467
  },
463
468
  permission_change: {
464
- icon: /* @__PURE__ */ e(be, { size: 16 }),
469
+ icon: /* @__PURE__ */ e(fe, { size: 16 }),
465
470
  label: "Permissions",
466
471
  color: "var(--nice-color-warning, #f59e0b)"
467
472
  },
468
473
  config_change: {
469
- icon: /* @__PURE__ */ e(Pe, { size: 16 }),
474
+ icon: /* @__PURE__ */ e($e, { size: 16 }),
470
475
  label: "Config",
471
476
  color: "var(--nice-color-warning, #f59e0b)"
472
477
  },
473
478
  custom: {
474
- icon: /* @__PURE__ */ e(Ce, { size: 16 }),
479
+ icon: /* @__PURE__ */ e(De, { size: 16 }),
475
480
  label: "Action",
476
481
  color: "var(--nice-text-muted, #6b7280)"
477
482
  }
478
- }, Tc = ({
479
- filter: i,
480
- onChange: s,
481
- availableFilters: t
483
+ }, Ec = ({
484
+ filter: a,
485
+ onChange: n,
486
+ availableFilters: s
482
487
  }) => {
483
- var n, l;
484
- const a = (h, r) => {
485
- s({ ...i, [h]: r });
488
+ var l, h;
489
+ const { t: i } = W(), t = (r, o) => {
490
+ n({ ...a, [r]: o });
486
491
  };
487
492
  return /* @__PURE__ */ c("div", { className: "nice-audit-filters", children: [
488
493
  /* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
489
- /* @__PURE__ */ e("label", { children: "Date Range" }),
494
+ /* @__PURE__ */ e("label", { children: i("auditTrail.dateRange", "Date Range") }),
490
495
  /* @__PURE__ */ c("div", { className: "nice-audit-date-range", children: [
491
496
  /* @__PURE__ */ e(
492
497
  "input",
493
498
  {
494
499
  type: "date",
495
- value: ((n = i.startDate) == null ? void 0 : n.toISOString().split("T")[0]) || "",
496
- onChange: (h) => a("startDate", h.target.value ? new Date(h.target.value) : void 0)
500
+ value: ((l = a.startDate) == null ? void 0 : l.toISOString().split("T")[0]) || "",
501
+ onChange: (r) => t("startDate", r.target.value ? new Date(r.target.value) : void 0)
497
502
  }
498
503
  ),
499
504
  /* @__PURE__ */ e("span", { children: "to" }),
@@ -501,357 +506,366 @@ const se = {
501
506
  "input",
502
507
  {
503
508
  type: "date",
504
- value: ((l = i.endDate) == null ? void 0 : l.toISOString().split("T")[0]) || "",
505
- onChange: (h) => a("endDate", h.target.value ? new Date(h.target.value) : void 0)
509
+ value: ((h = a.endDate) == null ? void 0 : h.toISOString().split("T")[0]) || "",
510
+ onChange: (r) => t("endDate", r.target.value ? new Date(r.target.value) : void 0)
506
511
  }
507
512
  )
508
513
  ] })
509
514
  ] }),
510
515
  /* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
511
- /* @__PURE__ */ e("label", { children: "Actions" }),
512
- /* @__PURE__ */ e("div", { className: "nice-audit-action-chips", children: Object.keys(se).slice(0, 8).map((h) => {
513
- var T;
514
- const r = se[h], u = (T = i.actions) == null ? void 0 : T.includes(h);
516
+ /* @__PURE__ */ e("label", { children: i("auditTrail.actions", "Actions") }),
517
+ /* @__PURE__ */ e("div", { className: "nice-audit-action-chips", children: Object.keys(ne).slice(0, 8).map((r) => {
518
+ var _;
519
+ const o = ne[r], w = (_ = a.actions) == null ? void 0 : _.includes(r);
515
520
  return /* @__PURE__ */ c(
516
521
  "button",
517
522
  {
518
523
  type: "button",
519
- className: `nice-audit-chip ${u ? "nice-audit-chip--selected" : ""}`,
520
- style: { "--chip-color": r.color },
524
+ className: `nice-audit-chip ${w ? "nice-audit-chip--selected" : ""}`,
525
+ style: { "--chip-color": o.color },
521
526
  onClick: () => {
522
- const E = i.actions || [];
523
- a(
527
+ const I = a.actions || [];
528
+ t(
524
529
  "actions",
525
- u ? E.filter((S) => S !== h) : [...E, h]
530
+ w ? I.filter((C) => C !== r) : [...I, r]
526
531
  );
527
532
  },
528
533
  children: [
529
- /* @__PURE__ */ e("span", { className: "nice-audit-chip-icon", children: r.icon }),
530
- r.label
534
+ /* @__PURE__ */ e("span", { className: "nice-audit-chip-icon", children: o.icon }),
535
+ o.label
531
536
  ]
532
537
  },
533
- h
538
+ r
534
539
  );
535
540
  }) })
536
541
  ] }),
537
542
  /* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
538
- /* @__PURE__ */ e("label", { children: "Search" }),
543
+ /* @__PURE__ */ e("label", { children: i("auditTrail.search", "Search") }),
539
544
  /* @__PURE__ */ e(
540
545
  "input",
541
546
  {
542
547
  type: "text",
543
548
  className: "nice-audit-search",
544
- placeholder: "Search entries...",
545
- value: i.searchQuery || "",
546
- onChange: (h) => a("searchQuery", h.target.value || void 0)
549
+ placeholder: i("auditTrail.searchEntries", "Search entries..."),
550
+ value: a.searchQuery || "",
551
+ onChange: (r) => t("searchQuery", r.target.value || void 0)
547
552
  }
548
553
  )
549
554
  ] })
550
555
  ] });
551
- }, _c = ({ changes: i }) => {
552
- if (!i.length)
556
+ }, _c = ({ changes: a }) => {
557
+ if (!a.length)
553
558
  return null;
554
- const s = (t, a) => a || (t == null ? "(empty)" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t));
555
- return /* @__PURE__ */ e("div", { className: "nice-audit-diff", children: i.map((t, a) => /* @__PURE__ */ c("div", { className: "nice-audit-diff-row", children: [
556
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-field", children: t.field }),
559
+ const n = (s, i) => i || (s == null ? "(empty)" : typeof s == "object" ? JSON.stringify(s, null, 2) : String(s));
560
+ return /* @__PURE__ */ e("div", { className: "nice-audit-diff", children: a.map((s, i) => /* @__PURE__ */ c("div", { className: "nice-audit-diff-row", children: [
561
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-field", children: s.field }),
557
562
  /* @__PURE__ */ c("div", { className: "nice-audit-diff-values", children: [
558
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-old", children: s(t.oldValue, t.displayOldValue) }),
559
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-arrow", children: /* @__PURE__ */ e(Qe, { size: 14 }) }),
560
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-new", children: s(t.newValue, t.displayNewValue) })
563
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-old", children: n(s.oldValue, s.displayOldValue) }),
564
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-arrow", children: /* @__PURE__ */ e(ac, { size: 14 }) }),
565
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-new", children: n(s.newValue, s.displayNewValue) })
561
566
  ] })
562
- ] }, a)) });
563
- }, Lc = ({
564
- entry: i,
565
- showDiff: s,
566
- renderActionIcon: t,
567
- renderUser: a,
568
- onClick: n
567
+ ] }, i)) });
568
+ }, Ac = ({
569
+ entry: a,
570
+ showDiff: n,
571
+ renderActionIcon: s,
572
+ renderUser: i,
573
+ onClick: t
569
574
  }) => {
570
- const [l, h] = w(!1), r = se[i.action] || se.custom;
575
+ const { t: l } = W(), [h, r] = k(!1), o = ne[a.action] || ne.custom;
571
576
  return /* @__PURE__ */ c(
572
577
  "div",
573
578
  {
574
- className: `nice-audit-timeline-entry nice-audit-timeline-entry--${i.severity || "info"}`,
575
- onClick: n,
576
- role: n ? "button" : void 0,
577
- tabIndex: n ? 0 : void 0,
579
+ className: `nice-audit-timeline-entry nice-audit-timeline-entry--${a.severity || "info"}`,
580
+ onClick: t,
581
+ role: t ? "button" : void 0,
582
+ tabIndex: t ? 0 : void 0,
578
583
  children: [
579
584
  /* @__PURE__ */ e(
580
585
  "div",
581
586
  {
582
587
  className: "nice-audit-timeline-marker",
583
- style: { "--marker-color": r.color },
584
- children: t ? t(i.action) : r.icon
588
+ style: { "--marker-color": o.color },
589
+ children: s ? s(a.action) : o.icon
585
590
  }
586
591
  ),
587
592
  /* @__PURE__ */ c("div", { className: "nice-audit-timeline-content", children: [
588
593
  /* @__PURE__ */ c("div", { className: "nice-audit-timeline-header", children: [
589
- /* @__PURE__ */ e("span", { className: "nice-audit-timeline-action", children: i.actionLabel || r.label }),
594
+ /* @__PURE__ */ e("span", { className: "nice-audit-timeline-action", children: a.actionLabel || o.label }),
590
595
  /* @__PURE__ */ c("span", { className: "nice-audit-timeline-entity", children: [
591
- i.entityType,
596
+ a.entityType,
592
597
  " ",
593
- i.entityName && `"${i.entityName}"`
598
+ a.entityName && `"${a.entityName}"`
594
599
  ] }),
595
- /* @__PURE__ */ e("span", { className: "nice-audit-timeline-time", children: new Date(i.timestamp).toLocaleString() })
600
+ /* @__PURE__ */ e("span", { className: "nice-audit-timeline-time", children: new Date(a.timestamp).toLocaleString() })
596
601
  ] }),
597
- /* @__PURE__ */ e("div", { className: "nice-audit-timeline-user", children: a ? a(i) : /* @__PURE__ */ c(ee, { children: [
598
- i.userAvatar && /* @__PURE__ */ e("img", { src: i.userAvatar, alt: "", className: "nice-audit-avatar" }),
599
- /* @__PURE__ */ e("span", { className: "nice-audit-username", children: i.userName }),
600
- i.userRole && /* @__PURE__ */ e("span", { className: "nice-audit-role", children: i.userRole })
602
+ /* @__PURE__ */ e("div", { className: "nice-audit-timeline-user", children: i ? i(a) : /* @__PURE__ */ c(ae, { children: [
603
+ a.userAvatar && /* @__PURE__ */ e("img", { src: a.userAvatar, alt: "", className: "nice-audit-avatar" }),
604
+ /* @__PURE__ */ e("span", { className: "nice-audit-username", children: a.userName }),
605
+ a.userRole && /* @__PURE__ */ e("span", { className: "nice-audit-role", children: a.userRole })
601
606
  ] }) }),
602
- i.notes && /* @__PURE__ */ e("div", { className: "nice-audit-timeline-notes", children: i.notes }),
603
- s && i.changes && i.changes.length > 0 && /* @__PURE__ */ c(ee, { children: [
607
+ a.notes && /* @__PURE__ */ e("div", { className: "nice-audit-timeline-notes", children: a.notes }),
608
+ n && a.changes && a.changes.length > 0 && /* @__PURE__ */ c(ae, { children: [
604
609
  /* @__PURE__ */ e(
605
610
  "button",
606
611
  {
607
612
  type: "button",
608
613
  className: "nice-audit-expand-btn",
609
- onClick: (u) => {
610
- u.stopPropagation(), h(!l);
614
+ onClick: (w) => {
615
+ w.stopPropagation(), r(!h);
611
616
  },
612
- children: l ? /* @__PURE__ */ c(ee, { children: [
613
- /* @__PURE__ */ e(De, { size: 14 }),
614
- " Hide changes"
615
- ] }) : /* @__PURE__ */ c(ee, { children: [
616
- /* @__PURE__ */ e($e, { size: 14 }),
617
- " Show ",
618
- i.changes.length,
619
- " changes"
617
+ children: h ? /* @__PURE__ */ c(ae, { children: [
618
+ /* @__PURE__ */ e(Se, { size: 14 }),
619
+ " ",
620
+ l("auditTrail.hideChanges", "Hide changes")
621
+ ] }) : /* @__PURE__ */ c(ae, { children: [
622
+ /* @__PURE__ */ e(Fe, { size: 14 }),
623
+ " ",
624
+ l("auditTrail.showChanges", "Show {changes} changes").replace(
625
+ "{changes}",
626
+ String(a.changes.length)
627
+ )
620
628
  ] })
621
629
  }
622
630
  ),
623
- l && /* @__PURE__ */ e(_c, { changes: i.changes })
631
+ h && /* @__PURE__ */ e(_c, { changes: a.changes })
624
632
  ] }),
625
- i.ipAddress && /* @__PURE__ */ c("div", { className: "nice-audit-timeline-meta", children: [
633
+ a.ipAddress && /* @__PURE__ */ c("div", { className: "nice-audit-timeline-meta", children: [
626
634
  /* @__PURE__ */ c("span", { children: [
627
635
  "IP: ",
628
- i.ipAddress
636
+ a.ipAddress
629
637
  ] }),
630
- i.location && /* @__PURE__ */ c("span", { children: [
638
+ a.location && /* @__PURE__ */ c("span", { children: [
631
639
  "• ",
632
- i.location
640
+ a.location
633
641
  ] })
634
642
  ] })
635
643
  ] })
636
644
  ]
637
645
  }
638
646
  );
639
- }, Ac = ({ entries: i, showDiff: s, onEntryClick: t }) => /* @__PURE__ */ c("table", { className: "nice-audit-table", children: [
640
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
641
- /* @__PURE__ */ e("th", { children: "Timestamp" }),
642
- /* @__PURE__ */ e("th", { children: "Action" }),
643
- /* @__PURE__ */ e("th", { children: "User" }),
644
- /* @__PURE__ */ e("th", { children: "Entity" }),
645
- /* @__PURE__ */ e("th", { children: "Changes" }),
646
- /* @__PURE__ */ e("th", { children: "IP Address" })
647
- ] }) }),
648
- /* @__PURE__ */ e("tbody", { children: i.map((a) => {
649
- const n = se[a.action] || se.custom;
650
- return /* @__PURE__ */ c(
651
- "tr",
652
- {
653
- className: `nice-audit-row nice-audit-row--${a.severity || "info"}`,
654
- onClick: () => t == null ? void 0 : t(a),
655
- role: t ? "button" : void 0,
656
- children: [
657
- /* @__PURE__ */ e("td", { className: "nice-audit-cell-time", children: new Date(a.timestamp).toLocaleString() }),
658
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ c(
659
- "span",
660
- {
661
- className: "nice-audit-action-badge",
662
- style: { "--badge-color": n.color },
663
- children: [
664
- n.icon,
665
- " ",
666
- a.actionLabel || n.label
667
- ]
668
- }
669
- ) }),
670
- /* @__PURE__ */ c("td", { className: "nice-audit-cell-user", children: [
671
- a.userAvatar && /* @__PURE__ */ e("img", { src: a.userAvatar, alt: "", className: "nice-audit-avatar-sm" }),
672
- a.userName
673
- ] }),
674
- /* @__PURE__ */ c("td", { children: [
675
- a.entityType,
676
- a.entityName && `: ${a.entityName}`
677
- ] }),
678
- /* @__PURE__ */ e("td", { children: a.changes && a.changes.length > 0 ? /* @__PURE__ */ c("span", { className: "nice-audit-changes-count", children: [
679
- a.changes.length,
680
- " field(s)"
681
- ] }) : "-" }),
682
- /* @__PURE__ */ e("td", { className: "nice-audit-cell-ip", children: a.ipAddress || "-" })
683
- ]
684
- },
685
- a.id
686
- );
687
- }) })
688
- ] }), Ic = te(
689
- ({
690
- dataSource: i,
691
- initialFilter: s = {},
692
- pageSize: t = 50,
693
- viewMode: a = "timeline",
694
- enableExport: n = !0,
695
- showDiffs: l = !0,
696
- renderActionIcon: h,
697
- renderUser: r,
698
- onEntryClick: u,
699
- onExport: T,
700
- title: E = "Audit Trail",
701
- className: S = "",
702
- style: y
703
- }, J) => {
704
- const [_, K] = w([]), [O, M] = w(0), [j, U] = w(s), [B, m] = w(1), [k, g] = w(!1), [Y, p] = w(a), [P, A] = w(!1), I = $(async () => {
705
- g(!0);
706
- try {
707
- const v = await i.fetchEntries(j, { page: B, pageSize: t });
708
- K(v.entries), M(v.totalCount);
709
- } finally {
710
- g(!1);
711
- }
712
- }, [i, j, B, t]);
713
- vc.useEffect(() => {
714
- I();
715
- }, [I]);
716
- const C = $(
717
- (v) => {
718
- if (T)
719
- T(_, v);
720
- else {
721
- let x, z;
722
- if (v === "json")
723
- x = JSON.stringify(_, null, 2), z = "application/json";
647
+ }, Ic = ({ entries: a, showDiff: n, onEntryClick: s }) => {
648
+ const { t: i } = W();
649
+ return /* @__PURE__ */ c("table", { className: "nice-audit-table", children: [
650
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
651
+ /* @__PURE__ */ e("th", { children: i("auditTrail.timestamp", "Timestamp") }),
652
+ /* @__PURE__ */ e("th", { children: i("auditTrail.action", "Action") }),
653
+ /* @__PURE__ */ e("th", { children: i("auditTrail.user", "User") }),
654
+ /* @__PURE__ */ e("th", { children: i("auditTrail.entity", "Entity") }),
655
+ /* @__PURE__ */ e("th", { children: i("auditTrail.changes", "Changes") }),
656
+ /* @__PURE__ */ e("th", { children: i("auditTrail.ipAddress", "IP Address") })
657
+ ] }) }),
658
+ /* @__PURE__ */ e("tbody", { children: a.map((t) => {
659
+ const l = ne[t.action] || ne.custom;
660
+ return /* @__PURE__ */ c(
661
+ "tr",
662
+ {
663
+ className: `nice-audit-row nice-audit-row--${t.severity || "info"}`,
664
+ onClick: () => s == null ? void 0 : s(t),
665
+ role: s ? "button" : void 0,
666
+ children: [
667
+ /* @__PURE__ */ e("td", { className: "nice-audit-cell-time", children: new Date(t.timestamp).toLocaleString() }),
668
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ c(
669
+ "span",
670
+ {
671
+ className: "nice-audit-action-badge",
672
+ style: { "--badge-color": l.color },
673
+ children: [
674
+ l.icon,
675
+ " ",
676
+ t.actionLabel || l.label
677
+ ]
678
+ }
679
+ ) }),
680
+ /* @__PURE__ */ c("td", { className: "nice-audit-cell-user", children: [
681
+ t.userAvatar && /* @__PURE__ */ e("img", { src: t.userAvatar, alt: "", className: "nice-audit-avatar-sm" }),
682
+ t.userName
683
+ ] }),
684
+ /* @__PURE__ */ c("td", { children: [
685
+ t.entityType,
686
+ t.entityName && `: ${t.entityName}`
687
+ ] }),
688
+ /* @__PURE__ */ e("td", { children: t.changes && t.changes.length > 0 ? /* @__PURE__ */ c("span", { className: "nice-audit-changes-count", children: [
689
+ t.changes.length,
690
+ " field(s)"
691
+ ] }) : "-" }),
692
+ /* @__PURE__ */ e("td", { className: "nice-audit-cell-ip", children: t.ipAddress || "-" })
693
+ ]
694
+ },
695
+ t.id
696
+ );
697
+ }) })
698
+ ] });
699
+ }, ia = /* @__PURE__ */ Object.assign(
700
+ /* @__PURE__ */ le(
701
+ ({
702
+ dataSource: a,
703
+ initialFilter: n = {},
704
+ pageSize: s = 50,
705
+ viewMode: i = "timeline",
706
+ enableExport: t = !0,
707
+ showDiffs: l = !0,
708
+ renderActionIcon: h,
709
+ renderUser: r,
710
+ onEntryClick: o,
711
+ onExport: w,
712
+ title: _,
713
+ className: I = "",
714
+ style: C
715
+ }, z) => {
716
+ const { t: F } = W(), U = _ ?? F("auditTrail.title", "Audit Trail"), [L, Y] = k([]), [ce, $] = k(0), [q, E] = k(n), [m, N] = k(1), [g, V] = k(!1), [u, B] = k(i), [O, P] = k(!1), x = R(async () => {
717
+ V(!0);
718
+ try {
719
+ const b = await a.fetchEntries(q, { page: m, pageSize: s });
720
+ Y(b.entries), $(b.totalCount);
721
+ } finally {
722
+ V(!1);
723
+ }
724
+ }, [a, q, m, s]);
725
+ kc.useEffect(() => {
726
+ x();
727
+ }, [x]);
728
+ const H = R(
729
+ (b) => {
730
+ if (w)
731
+ w(L, b);
724
732
  else {
725
- const L = [
726
- "Timestamp",
727
- "Action",
728
- "User",
729
- "Entity Type",
730
- "Entity",
731
- "IP",
732
- "Changes"
733
- ], W = _.map((F) => {
734
- var Q;
735
- return [
736
- new Date(F.timestamp).toISOString(),
737
- F.action,
738
- F.userName,
739
- F.entityType,
740
- F.entityName || F.entityId,
741
- F.ipAddress || "",
742
- ((Q = F.changes) == null ? void 0 : Q.length) || 0
743
- ];
744
- });
745
- x = [L.join(","), ...W.map((F) => F.join(","))].join(`
746
- `), z = "text/csv";
733
+ let S, A;
734
+ if (b === "json")
735
+ S = JSON.stringify(L, null, 2), A = "application/json";
736
+ else {
737
+ const X = [
738
+ "Timestamp",
739
+ "Action",
740
+ "User",
741
+ "Entity Type",
742
+ "Entity",
743
+ "IP",
744
+ "Changes"
745
+ ], Z = L.map((G) => {
746
+ var v;
747
+ return [
748
+ new Date(G.timestamp).toISOString(),
749
+ G.action,
750
+ G.userName,
751
+ G.entityType,
752
+ G.entityName || G.entityId,
753
+ G.ipAddress || "",
754
+ ((v = G.changes) == null ? void 0 : v.length) || 0
755
+ ];
756
+ });
757
+ S = [X.join(","), ...Z.map((G) => G.join(","))].join(`
758
+ `), A = "text/csv";
759
+ }
760
+ const J = new Blob([S], { type: A }), f = URL.createObjectURL(J), T = document.createElement("a");
761
+ T.href = f, T.download = `audit-trail-${Date.now()}.${b}`, T.click(), URL.revokeObjectURL(f);
747
762
  }
748
- const G = new Blob([x], { type: z }), V = URL.createObjectURL(G), b = document.createElement("a");
749
- b.href = V, b.download = `audit-trail-${Date.now()}.${v}`, b.click(), URL.revokeObjectURL(V);
750
- }
751
- },
752
- [_, T]
753
- );
754
- ne(J, () => ({
755
- refresh: I,
756
- setFilter: (v) => {
757
- U(v), m(1);
758
- },
759
- getEntries: () => _
760
- }));
761
- const q = Math.ceil(O / t);
762
- return /* @__PURE__ */ c("div", { className: `nice-audit-trail ${S}`, style: y, children: [
763
- /* @__PURE__ */ c("div", { className: "nice-audit-header", children: [
764
- /* @__PURE__ */ e("h3", { className: "nice-audit-title", children: E }),
765
- /* @__PURE__ */ c("div", { className: "nice-audit-header-actions", children: [
766
- /* @__PURE__ */ e(
767
- "button",
763
+ },
764
+ [L, w]
765
+ );
766
+ re(z, () => ({
767
+ refresh: x,
768
+ setFilter: (b) => {
769
+ E(b), N(1);
770
+ },
771
+ getEntries: () => L
772
+ }));
773
+ const j = Math.ceil(ce / s);
774
+ return /* @__PURE__ */ c("div", { className: `nice-audit-trail ${I}`, style: C, children: [
775
+ /* @__PURE__ */ c("div", { className: "nice-audit-header", children: [
776
+ /* @__PURE__ */ e("h3", { className: "nice-audit-title", children: U }),
777
+ /* @__PURE__ */ c("div", { className: "nice-audit-header-actions", children: [
778
+ /* @__PURE__ */ e(
779
+ "button",
780
+ {
781
+ type: "button",
782
+ className: `nice-audit-view-btn ${u === "timeline" ? "nice-audit-view-btn--active" : ""}`,
783
+ onClick: () => B("timeline"),
784
+ title: F("auditTrail.timelineView", "Timeline view"),
785
+ children: /* @__PURE__ */ e(Xe, { size: 16 })
786
+ }
787
+ ),
788
+ /* @__PURE__ */ e(
789
+ "button",
790
+ {
791
+ type: "button",
792
+ className: `nice-audit-view-btn ${u === "table" ? "nice-audit-view-btn--active" : ""}`,
793
+ onClick: () => B("table"),
794
+ title: F("auditTrail.tableView", "Table view"),
795
+ children: /* @__PURE__ */ e(Ze, { size: 16 })
796
+ }
797
+ ),
798
+ /* @__PURE__ */ c(
799
+ "button",
800
+ {
801
+ type: "button",
802
+ className: `nice-audit-filter-btn ${O ? "nice-audit-filter-btn--active" : ""}`,
803
+ onClick: () => P(!O),
804
+ children: [
805
+ /* @__PURE__ */ e(ge, { size: 16 }),
806
+ " ",
807
+ F("auditTrail.filter", "Filter")
808
+ ]
809
+ }
810
+ ),
811
+ t && /* @__PURE__ */ c("div", { className: "nice-audit-export-dropdown", children: [
812
+ /* @__PURE__ */ c("button", { type: "button", className: "nice-audit-export-btn", children: [
813
+ /* @__PURE__ */ e(ve, { size: 16 }),
814
+ " ",
815
+ F("auditTrail.export", "Export")
816
+ ] }),
817
+ /* @__PURE__ */ c("div", { className: "nice-audit-export-menu", children: [
818
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => H("csv"), children: F("auditTrail.exportAsCsv", "Export as CSV") }),
819
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => H("json"), children: F("auditTrail.exportAsJson", "Export as JSON") })
820
+ ] })
821
+ ] })
822
+ ] })
823
+ ] }),
824
+ O && /* @__PURE__ */ e(Ec, { filter: q, onChange: E }),
825
+ /* @__PURE__ */ c("div", { className: "nice-audit-stats", children: [
826
+ /* @__PURE__ */ e("span", { children: F("auditTrail.showingOfEntries", "Showing {entries} of {totalCount} entries").replace("{entries}", String(L.length)).replace("{totalCount}", String(ce)) }),
827
+ q.startDate && q.endDate && /* @__PURE__ */ c("span", { className: "nice-audit-date-indicator", children: [
828
+ q.startDate.toLocaleDateString(),
829
+ " - ",
830
+ q.endDate.toLocaleDateString()
831
+ ] })
832
+ ] }),
833
+ /* @__PURE__ */ c("div", { className: `nice-audit-content ${g ? "nice-audit-content--loading" : ""}`, children: [
834
+ g && /* @__PURE__ */ e("div", { className: "nice-audit-loader", children: /* @__PURE__ */ e("div", { className: "nice-audit-spinner" }) }),
835
+ u === "timeline" ? /* @__PURE__ */ e("div", { className: "nice-audit-timeline", children: L.map((b) => /* @__PURE__ */ e(
836
+ Ac,
768
837
  {
769
- type: "button",
770
- className: `nice-audit-view-btn ${Y === "timeline" ? "nice-audit-view-btn--active" : ""}`,
771
- onClick: () => p("timeline"),
772
- title: "Timeline view",
773
- children: /* @__PURE__ */ e(Ge, { size: 16 })
774
- }
775
- ),
838
+ entry: b,
839
+ showDiff: l,
840
+ renderActionIcon: h,
841
+ renderUser: r,
842
+ onClick: o ? () => o(b) : void 0
843
+ },
844
+ b.id
845
+ )) }) : /* @__PURE__ */ e(Ic, { entries: L, showDiff: l, onEntryClick: o }),
846
+ L.length === 0 && !g && /* @__PURE__ */ e("div", { className: "nice-audit-empty", children: F(
847
+ "auditTrail.noAuditEntriesFoundMatching",
848
+ "No audit entries found matching the current filters."
849
+ ) })
850
+ ] }),
851
+ j > 1 && /* @__PURE__ */ c("div", { className: "nice-audit-pagination", children: [
852
+ /* @__PURE__ */ e("button", { type: "button", disabled: m === 1, onClick: () => N(m - 1), children: F("auditTrail.previous", "Previous") }),
853
+ /* @__PURE__ */ e("span", { children: F("auditTrail.pageOf", "Page {page} of {totalPages}").replace("{page}", String(m)).replace("{totalPages}", String(j)) }),
776
854
  /* @__PURE__ */ e(
777
855
  "button",
778
856
  {
779
857
  type: "button",
780
- className: `nice-audit-view-btn ${Y === "table" ? "nice-audit-view-btn--active" : ""}`,
781
- onClick: () => p("table"),
782
- title: "Table view",
783
- children: /* @__PURE__ */ e(Ke, { size: 16 })
784
- }
785
- ),
786
- /* @__PURE__ */ c(
787
- "button",
788
- {
789
- type: "button",
790
- className: `nice-audit-filter-btn ${P ? "nice-audit-filter-btn--active" : ""}`,
791
- onClick: () => A(!P),
792
- children: [
793
- /* @__PURE__ */ e(pe, { size: 16 }),
794
- " Filter"
795
- ]
858
+ disabled: m === j,
859
+ onClick: () => N(m + 1),
860
+ children: F("auditTrail.next", "Next")
796
861
  }
797
- ),
798
- n && /* @__PURE__ */ c("div", { className: "nice-audit-export-dropdown", children: [
799
- /* @__PURE__ */ c("button", { type: "button", className: "nice-audit-export-btn", children: [
800
- /* @__PURE__ */ e(me, { size: 16 }),
801
- " Export"
802
- ] }),
803
- /* @__PURE__ */ c("div", { className: "nice-audit-export-menu", children: [
804
- /* @__PURE__ */ e("button", { type: "button", onClick: () => C("csv"), children: "Export as CSV" }),
805
- /* @__PURE__ */ e("button", { type: "button", onClick: () => C("json"), children: "Export as JSON" })
806
- ] })
807
- ] })
808
- ] })
809
- ] }),
810
- P && /* @__PURE__ */ e(Tc, { filter: j, onChange: U }),
811
- /* @__PURE__ */ c("div", { className: "nice-audit-stats", children: [
812
- /* @__PURE__ */ c("span", { children: [
813
- "Showing ",
814
- _.length,
815
- " of ",
816
- O,
817
- " entries"
818
- ] }),
819
- j.startDate && j.endDate && /* @__PURE__ */ c("span", { className: "nice-audit-date-indicator", children: [
820
- j.startDate.toLocaleDateString(),
821
- " - ",
822
- j.endDate.toLocaleDateString()
862
+ )
823
863
  ] })
824
- ] }),
825
- /* @__PURE__ */ c("div", { className: `nice-audit-content ${k ? "nice-audit-content--loading" : ""}`, children: [
826
- k && /* @__PURE__ */ e("div", { className: "nice-audit-loader", children: /* @__PURE__ */ e("div", { className: "nice-audit-spinner" }) }),
827
- Y === "timeline" ? /* @__PURE__ */ e("div", { className: "nice-audit-timeline", children: _.map((v) => /* @__PURE__ */ e(
828
- Lc,
829
- {
830
- entry: v,
831
- showDiff: l,
832
- renderActionIcon: h,
833
- renderUser: r,
834
- onClick: u ? () => u(v) : void 0
835
- },
836
- v.id
837
- )) }) : /* @__PURE__ */ e(Ac, { entries: _, showDiff: l, onEntryClick: u }),
838
- _.length === 0 && !k && /* @__PURE__ */ e("div", { className: "nice-audit-empty", children: "No audit entries found matching the current filters." })
839
- ] }),
840
- q > 1 && /* @__PURE__ */ c("div", { className: "nice-audit-pagination", children: [
841
- /* @__PURE__ */ e("button", { type: "button", disabled: B === 1, onClick: () => m(B - 1), children: "Previous" }),
842
- /* @__PURE__ */ c("span", { children: [
843
- "Page ",
844
- B,
845
- " of ",
846
- q
847
- ] }),
848
- /* @__PURE__ */ e("button", { type: "button", disabled: B === q, onClick: () => m(B + 1), children: "Next" })
849
- ] })
850
- ] });
851
- }
852
- );
853
- Ic.displayName = "NiceAuditTrail";
854
- const Fc = [
864
+ ] });
865
+ }
866
+ ),
867
+ { displayName: "NiceAuditTrail" }
868
+ ), Oc = [
855
869
  {
856
870
  target: ".nice-contract-editor",
857
871
  titleKey: "tutorial.contractEditor.intro.title",
@@ -864,59 +878,59 @@ const Fc = [
864
878
  general: {
865
879
  label: "General",
866
880
  color: "var(--nice-text-muted, #6b7280)",
867
- icon: /* @__PURE__ */ e(we, { size: 16 })
881
+ icon: /* @__PURE__ */ e(xe, { size: 16 })
868
882
  },
869
883
  liability: {
870
884
  label: "Liability",
871
885
  color: "var(--nice-color-error, #ef4444)",
872
- icon: /* @__PURE__ */ e(Me, { size: 16 })
886
+ icon: /* @__PURE__ */ e(Ye, { size: 16 })
873
887
  },
874
888
  payment: {
875
889
  label: "Payment",
876
890
  color: "var(--nice-color-success, #10b981)",
877
- icon: /* @__PURE__ */ e(sc, { size: 16 })
891
+ icon: /* @__PURE__ */ e(lc, { size: 16 })
878
892
  },
879
893
  termination: {
880
894
  label: "Termination",
881
895
  color: "var(--nice-color-warning, #f59e0b)",
882
- icon: /* @__PURE__ */ e(ac, { size: 16 })
896
+ icon: /* @__PURE__ */ e(nc, { size: 16 })
883
897
  },
884
898
  confidentiality: {
885
899
  label: "Confidentiality",
886
900
  color: "var(--nice-color-accent, #8b5cf6)",
887
- icon: /* @__PURE__ */ e(Ee, { size: 16 })
901
+ icon: /* @__PURE__ */ e(Ue, { size: 16 })
888
902
  },
889
903
  compliance: {
890
904
  label: "Compliance",
891
905
  color: "var(--nice-color-primary, #3b82f6)",
892
- icon: /* @__PURE__ */ e(ae, { size: 16 })
906
+ icon: /* @__PURE__ */ e(se, { size: 16 })
893
907
  },
894
908
  custom: {
895
909
  label: "Custom",
896
910
  color: "var(--nice-text-muted, #64748b)",
897
- icon: /* @__PURE__ */ e(Oe, { size: 16 })
911
+ icon: /* @__PURE__ */ e(je, { size: 16 })
898
912
  }
899
- }, $c = {
913
+ }, Pc = {
900
914
  draft: { label: "Draft", color: "var(--nice-text-muted, #6b7280)" },
901
915
  pending_review: { label: "Pending Review", color: "var(--nice-color-warning, #f59e0b)" },
902
916
  approved: { label: "Approved", color: "var(--nice-color-success, #10b981)" },
903
917
  rejected: { label: "Rejected", color: "var(--nice-color-error, #ef4444)" },
904
918
  signed: { label: "Signed", color: "var(--nice-color-accent, #8b5cf6)" }
905
- }, Pc = ({ clauses: i, onInsert: s }) => {
906
- const [t, a] = w(""), [n, l] = w("all"), h = i.filter((r) => {
907
- const u = t === "" || r.name.toLowerCase().includes(t.toLowerCase()) || r.content.toLowerCase().includes(t.toLowerCase()), T = n === "all" || r.category === n;
908
- return u && T;
919
+ }, Rc = ({ clauses: a, onInsert: n }) => {
920
+ const { t: s } = W(), [i, t] = k(""), [l, h] = k("all"), r = a.filter((o) => {
921
+ const w = i === "" || o.name.toLowerCase().includes(i.toLowerCase()) || o.content.toLowerCase().includes(i.toLowerCase()), _ = l === "all" || o.category === l;
922
+ return w && _;
909
923
  });
910
924
  return /* @__PURE__ */ c("div", { className: "nice-contract-library", children: [
911
925
  /* @__PURE__ */ c("div", { className: "nice-contract-library-header", children: [
912
- /* @__PURE__ */ e("h4", { children: "Clause Library" }),
926
+ /* @__PURE__ */ e("h4", { children: s("contractEditor.clauseLibrary", "Clause Library") }),
913
927
  /* @__PURE__ */ e(
914
928
  "input",
915
929
  {
916
930
  type: "text",
917
- placeholder: "Search clauses...",
918
- value: t,
919
- onChange: (r) => a(r.target.value),
931
+ placeholder: s("contractEditor.searchClauses", "Search clauses..."),
932
+ value: i,
933
+ onChange: (o) => t(o.target.value),
920
934
  className: "nice-contract-library-search"
921
935
  }
922
936
  )
@@ -926,193 +940,200 @@ const Fc = [
926
940
  "button",
927
941
  {
928
942
  type: "button",
929
- className: `nice-contract-category-btn ${n === "all" ? "nice-contract-category-btn--active" : ""}`,
930
- onClick: () => l("all"),
943
+ className: `nice-contract-category-btn ${l === "all" ? "nice-contract-category-btn--active" : ""}`,
944
+ onClick: () => h("all"),
931
945
  children: "All"
932
946
  }
933
947
  ),
934
- Object.keys(ie).map((r) => /* @__PURE__ */ c(
948
+ Object.keys(ie).map((o) => /* @__PURE__ */ c(
935
949
  "button",
936
950
  {
937
951
  type: "button",
938
- className: `nice-contract-category-btn ${n === r ? "nice-contract-category-btn--active" : ""}`,
939
- onClick: () => l(r),
940
- style: { "--cat-color": ie[r].color },
952
+ className: `nice-contract-category-btn ${l === o ? "nice-contract-category-btn--active" : ""}`,
953
+ onClick: () => h(o),
954
+ style: { "--cat-color": ie[o].color },
941
955
  children: [
942
- ie[r].icon,
956
+ ie[o].icon,
943
957
  " ",
944
- ie[r].label
958
+ ie[o].label
945
959
  ]
946
960
  },
947
- r
961
+ o
948
962
  ))
949
963
  ] }),
950
964
  /* @__PURE__ */ c("div", { className: "nice-contract-library-list", children: [
951
- h.map((r) => /* @__PURE__ */ c("div", { className: "nice-contract-library-item", children: [
965
+ r.map((o) => /* @__PURE__ */ c("div", { className: "nice-contract-library-item", children: [
952
966
  /* @__PURE__ */ c("div", { className: "nice-contract-library-item-header", children: [
953
- /* @__PURE__ */ e("span", { className: "nice-contract-library-item-name", children: r.name }),
967
+ /* @__PURE__ */ e("span", { className: "nice-contract-library-item-name", children: o.name }),
954
968
  /* @__PURE__ */ e(
955
969
  "span",
956
970
  {
957
971
  className: "nice-contract-library-item-cat",
958
- style: { "--cat-color": ie[r.category].color },
959
- children: ie[r.category].icon
972
+ style: { "--cat-color": ie[o.category].color },
973
+ children: ie[o.category].icon
960
974
  }
961
975
  )
962
976
  ] }),
963
- r.description && /* @__PURE__ */ e("p", { className: "nice-contract-library-item-desc", children: r.description }),
977
+ o.description && /* @__PURE__ */ e("p", { className: "nice-contract-library-item-desc", children: o.description }),
964
978
  /* @__PURE__ */ c(
965
979
  "button",
966
980
  {
967
981
  type: "button",
968
982
  className: "nice-contract-library-insert",
969
- onClick: () => s(r),
983
+ onClick: () => n(o),
970
984
  children: [
971
- /* @__PURE__ */ e(Se, { size: 14 }),
972
- " Insert"
985
+ /* @__PURE__ */ e(Te, { size: 14 }),
986
+ " ",
987
+ s("contractEditor.insert", "Insert")
973
988
  ]
974
989
  }
975
990
  )
976
- ] }, r.id)),
977
- h.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-library-empty", children: "No matching clauses" })
991
+ ] }, o.id)),
992
+ r.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-library-empty", children: s("contractEditor.noMatchingClauses", "No matching clauses") })
978
993
  ] })
979
994
  ] });
980
- }, Rc = ({ variables: i, definitions: s, onChange: t }) => /* @__PURE__ */ c("div", { className: "nice-contract-variables", children: [
981
- /* @__PURE__ */ e("h4", { children: "Variables" }),
982
- /* @__PURE__ */ e("div", { className: "nice-contract-variables-list", children: s.map((a) => /* @__PURE__ */ c("div", { className: "nice-contract-variable", children: [
983
- /* @__PURE__ */ c("label", { children: [
984
- a.name,
985
- a.required && /* @__PURE__ */ e("span", { className: "nice-contract-required", children: "*" })
986
- ] }),
987
- a.type === "select" && a.options ? /* @__PURE__ */ c(
988
- "select",
989
- {
990
- value: i[a.name] || a.defaultValue || "",
991
- onChange: (n) => t(a.name, n.target.value),
992
- children: [
993
- /* @__PURE__ */ e("option", { value: "", children: "Select..." }),
994
- a.options.map((n) => /* @__PURE__ */ e("option", { value: n, children: n }, n))
995
- ]
996
- }
997
- ) : a.type === "date" ? /* @__PURE__ */ e(
998
- "input",
999
- {
1000
- type: "date",
1001
- value: i[a.name] || a.defaultValue || "",
1002
- onChange: (n) => t(a.name, n.target.value)
1003
- }
1004
- ) : /* @__PURE__ */ e(
1005
- "input",
1006
- {
1007
- type: a.type === "number" || a.type === "currency" ? "number" : "text",
1008
- value: i[a.name] || a.defaultValue || "",
1009
- placeholder: a.placeholder,
1010
- onChange: (n) => t(a.name, n.target.value)
1011
- }
1012
- )
1013
- ] }, a.name)) })
1014
- ] }), Oc = ({
1015
- section: i,
1016
- variables: s,
1017
- readOnly: t,
1018
- onToggle: a,
1019
- onRemoveClause: n,
995
+ }, Fc = ({ variables: a, definitions: n, onChange: s }) => {
996
+ const { t: i } = W();
997
+ return /* @__PURE__ */ c("div", { className: "nice-contract-variables", children: [
998
+ /* @__PURE__ */ e("h4", { children: i("contractEditor.variables", "Variables") }),
999
+ /* @__PURE__ */ e("div", { className: "nice-contract-variables-list", children: n.map((t) => /* @__PURE__ */ c("div", { className: "nice-contract-variable", children: [
1000
+ /* @__PURE__ */ c("label", { children: [
1001
+ t.name,
1002
+ t.required && /* @__PURE__ */ e("span", { className: "nice-contract-required", children: "*" })
1003
+ ] }),
1004
+ t.type === "select" && t.options ? /* @__PURE__ */ c(
1005
+ "select",
1006
+ {
1007
+ value: a[t.name] || t.defaultValue || "",
1008
+ onChange: (l) => s(t.name, l.target.value),
1009
+ children: [
1010
+ /* @__PURE__ */ e("option", { value: "", children: i("contractEditor.select", "Select...") }),
1011
+ t.options.map((l) => /* @__PURE__ */ e("option", { value: l, children: l }, l))
1012
+ ]
1013
+ }
1014
+ ) : t.type === "date" ? /* @__PURE__ */ e(
1015
+ "input",
1016
+ {
1017
+ type: "date",
1018
+ value: a[t.name] || t.defaultValue || "",
1019
+ onChange: (l) => s(t.name, l.target.value)
1020
+ }
1021
+ ) : /* @__PURE__ */ e(
1022
+ "input",
1023
+ {
1024
+ type: t.type === "number" || t.type === "currency" ? "number" : "text",
1025
+ value: a[t.name] || t.defaultValue || "",
1026
+ placeholder: t.placeholder,
1027
+ onChange: (l) => s(t.name, l.target.value)
1028
+ }
1029
+ )
1030
+ ] }, t.name)) })
1031
+ ] });
1032
+ }, $c = ({
1033
+ section: a,
1034
+ variables: n,
1035
+ readOnly: s,
1036
+ onToggle: i,
1037
+ onRemoveClause: t,
1020
1038
  onMoveClause: l
1021
1039
  }) => {
1022
- const h = (r) => r.replace(/\{\{(\w+)\}\}/g, (u, T) => s[T] || `[${T}]`);
1040
+ const { t: h } = W(), r = (o) => o.replace(/\{\{(\w+)\}\}/g, (w, _) => n[_] || `[${_}]`);
1023
1041
  return /* @__PURE__ */ c(
1024
1042
  "div",
1025
1043
  {
1026
- className: `nice-contract-section ${i.collapsed ? "nice-contract-section--collapsed" : ""}`,
1044
+ className: `nice-contract-section ${a.collapsed ? "nice-contract-section--collapsed" : ""}`,
1027
1045
  children: [
1028
- /* @__PURE__ */ c("div", { className: "nice-contract-section-header", onClick: a, children: [
1029
- /* @__PURE__ */ e("span", { className: "nice-contract-section-toggle", children: i.collapsed ? /* @__PURE__ */ e($e, { size: 14 }) : /* @__PURE__ */ e(De, { size: 14 }) }),
1030
- /* @__PURE__ */ e("h3", { children: i.title }),
1046
+ /* @__PURE__ */ c("div", { className: "nice-contract-section-header", onClick: i, children: [
1047
+ /* @__PURE__ */ e("span", { className: "nice-contract-section-toggle", children: a.collapsed ? /* @__PURE__ */ e(Fe, { size: 14 }) : /* @__PURE__ */ e(Se, { size: 14 }) }),
1048
+ /* @__PURE__ */ e("h3", { children: a.title }),
1031
1049
  /* @__PURE__ */ c("span", { className: "nice-contract-section-count", children: [
1032
- i.clauses.length,
1050
+ a.clauses.length,
1033
1051
  " clause(s)"
1034
1052
  ] })
1035
1053
  ] }),
1036
- !i.collapsed && /* @__PURE__ */ c("div", { className: "nice-contract-section-content", children: [
1037
- i.clauses.map((r, u) => /* @__PURE__ */ c("div", { className: "nice-contract-clause", children: [
1054
+ !a.collapsed && /* @__PURE__ */ c("div", { className: "nice-contract-section-content", children: [
1055
+ a.clauses.map((o, w) => /* @__PURE__ */ c("div", { className: "nice-contract-clause", children: [
1038
1056
  /* @__PURE__ */ c("div", { className: "nice-contract-clause-header", children: [
1039
1057
  /* @__PURE__ */ e(
1040
1058
  "span",
1041
1059
  {
1042
1060
  className: "nice-contract-clause-cat",
1043
- style: { "--cat-color": ie[r.category].color },
1044
- children: ie[r.category].icon
1061
+ style: { "--cat-color": ie[o.category].color },
1062
+ children: ie[o.category].icon
1045
1063
  }
1046
1064
  ),
1047
- /* @__PURE__ */ e("span", { className: "nice-contract-clause-name", children: r.name }),
1048
- r.isRequired && /* @__PURE__ */ e("span", { className: "nice-contract-clause-required", children: "Required" }),
1049
- !t && /* @__PURE__ */ c("div", { className: "nice-contract-clause-actions", children: [
1065
+ /* @__PURE__ */ e("span", { className: "nice-contract-clause-name", children: o.name }),
1066
+ o.isRequired && /* @__PURE__ */ e("span", { className: "nice-contract-clause-required", children: h("contractEditor.required", "Required") }),
1067
+ !s && /* @__PURE__ */ c("div", { className: "nice-contract-clause-actions", children: [
1050
1068
  /* @__PURE__ */ e(
1051
1069
  "button",
1052
1070
  {
1053
1071
  type: "button",
1054
- onClick: () => l(r.id, "up"),
1055
- disabled: u === 0,
1056
- children: /* @__PURE__ */ e(cc, { size: 14 })
1072
+ onClick: () => l(o.id, "up"),
1073
+ disabled: w === 0,
1074
+ children: /* @__PURE__ */ e(ic, { size: 14 })
1057
1075
  }
1058
1076
  ),
1059
1077
  /* @__PURE__ */ e(
1060
1078
  "button",
1061
1079
  {
1062
1080
  type: "button",
1063
- onClick: () => l(r.id, "down"),
1064
- disabled: u === i.clauses.length - 1,
1065
- children: /* @__PURE__ */ e(ic, { size: 14 })
1081
+ onClick: () => l(o.id, "down"),
1082
+ disabled: w === a.clauses.length - 1,
1083
+ children: /* @__PURE__ */ e(sc, { size: 14 })
1066
1084
  }
1067
1085
  ),
1068
- /* @__PURE__ */ e("button", { type: "button", onClick: () => n(r.id), children: /* @__PURE__ */ e(ge, { size: 14 }) })
1086
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => t(o.id), children: /* @__PURE__ */ e(be, { size: 14 }) })
1069
1087
  ] })
1070
1088
  ] }),
1071
1089
  /* @__PURE__ */ e(
1072
1090
  "div",
1073
1091
  {
1074
1092
  className: "nice-contract-clause-content",
1075
- dangerouslySetInnerHTML: { __html: h(r.content) }
1093
+ dangerouslySetInnerHTML: { __html: r(o.content) }
1076
1094
  }
1077
1095
  )
1078
- ] }, r.id)),
1079
- i.clauses.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-section-empty", children: "No clauses in this section. Drag clauses here or use the library." })
1096
+ ] }, o.id)),
1097
+ a.clauses.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-section-empty", children: h(
1098
+ "contractEditor.noClausesInThisSection",
1099
+ "No clauses in this section. Drag clauses here or use the library."
1100
+ ) })
1080
1101
  ] })
1081
1102
  ]
1082
1103
  }
1083
1104
  );
1084
- }, Ec = ({ workflow: i, onAction: s }) => {
1085
- const [t, a] = w(null), [n, l] = w("");
1105
+ }, Mc = ({ workflow: a, onAction: n }) => {
1106
+ const { t: s } = W(), [i, t] = k(null), [l, h] = k("");
1086
1107
  return /* @__PURE__ */ c("div", { className: "nice-contract-workflow", children: [
1087
- /* @__PURE__ */ e("h4", { children: "Approval Workflow" }),
1088
- /* @__PURE__ */ e("div", { className: "nice-contract-workflow-steps", children: i.steps.map((h, r) => /* @__PURE__ */ c(
1108
+ /* @__PURE__ */ e("h4", { children: s("contractEditor.approvalWorkflow", "Approval Workflow") }),
1109
+ /* @__PURE__ */ e("div", { className: "nice-contract-workflow-steps", children: a.steps.map((r, o) => /* @__PURE__ */ c(
1089
1110
  "div",
1090
1111
  {
1091
- className: `nice-contract-workflow-step nice-contract-workflow-step--${h.status}`,
1112
+ className: `nice-contract-workflow-step nice-contract-workflow-step--${r.status}`,
1092
1113
  children: [
1093
1114
  /* @__PURE__ */ c("div", { className: "nice-contract-workflow-step-header", children: [
1094
- /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-num", children: r + 1 }),
1095
- /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-name", children: h.name }),
1115
+ /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-num", children: o + 1 }),
1116
+ /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-name", children: r.name }),
1096
1117
  /* @__PURE__ */ e(
1097
1118
  "span",
1098
1119
  {
1099
- className: `nice-contract-workflow-step-status nice-contract-workflow-step-status--${h.status}`,
1100
- children: h.status
1120
+ className: `nice-contract-workflow-step-status nice-contract-workflow-step-status--${r.status}`,
1121
+ children: r.status
1101
1122
  }
1102
1123
  )
1103
1124
  ] }),
1104
- /* @__PURE__ */ e("div", { className: "nice-contract-workflow-approvers", children: h.approvers.map((u) => /* @__PURE__ */ c("div", { className: "nice-contract-approver", children: [
1105
- u.avatar && /* @__PURE__ */ e("img", { src: u.avatar, alt: "", className: "nice-contract-approver-avatar" }),
1106
- /* @__PURE__ */ e("span", { children: u.name }),
1107
- /* @__PURE__ */ e("span", { className: "nice-contract-approver-role", children: u.role })
1108
- ] }, u.id)) }),
1109
- h.status === "pending" && i.currentStep === r && /* @__PURE__ */ e("div", { className: "nice-contract-workflow-actions", children: t === h.id ? /* @__PURE__ */ c(ee, { children: [
1125
+ /* @__PURE__ */ e("div", { className: "nice-contract-workflow-approvers", children: r.approvers.map((w) => /* @__PURE__ */ c("div", { className: "nice-contract-approver", children: [
1126
+ w.avatar && /* @__PURE__ */ e("img", { src: w.avatar, alt: "", className: "nice-contract-approver-avatar" }),
1127
+ /* @__PURE__ */ e("span", { children: w.name }),
1128
+ /* @__PURE__ */ e("span", { className: "nice-contract-approver-role", children: w.role })
1129
+ ] }, w.id)) }),
1130
+ r.status === "pending" && a.currentStep === o && /* @__PURE__ */ e("div", { className: "nice-contract-workflow-actions", children: i === r.id ? /* @__PURE__ */ c(ae, { children: [
1110
1131
  /* @__PURE__ */ e(
1111
1132
  "textarea",
1112
1133
  {
1113
- placeholder: "Comments (optional)",
1114
- value: n,
1115
- onChange: (u) => l(u.target.value)
1134
+ placeholder: s("contractEditor.commentsOptional", "Comments (optional)"),
1135
+ value: l,
1136
+ onChange: (w) => h(w.target.value)
1116
1137
  }
1117
1138
  ),
1118
1139
  /* @__PURE__ */ c("div", { className: "nice-contract-workflow-btns", children: [
@@ -1122,11 +1143,12 @@ const Fc = [
1122
1143
  type: "button",
1123
1144
  className: "nice-contract-btn nice-contract-btn--approve",
1124
1145
  onClick: () => {
1125
- s(h.id, "approve", n), a(null), l("");
1146
+ n(r.id, "approve", l), t(null), h("");
1126
1147
  },
1127
1148
  children: [
1128
- /* @__PURE__ */ e(ae, { size: 14 }),
1129
- " Approve"
1149
+ /* @__PURE__ */ e(se, { size: 14 }),
1150
+ " ",
1151
+ s("contractEditor.approve", "Approve")
1130
1152
  ]
1131
1153
  }
1132
1154
  ),
@@ -1136,266 +1158,273 @@ const Fc = [
1136
1158
  type: "button",
1137
1159
  className: "nice-contract-btn nice-contract-btn--reject",
1138
1160
  onClick: () => {
1139
- s(h.id, "reject", n), a(null), l("");
1161
+ n(r.id, "reject", l), t(null), h("");
1140
1162
  },
1141
1163
  children: [
1142
- /* @__PURE__ */ e(oe, { size: 14 }),
1143
- " Reject"
1164
+ /* @__PURE__ */ e(he, { size: 14 }),
1165
+ " ",
1166
+ s("contractEditor.reject", "Reject")
1144
1167
  ]
1145
1168
  }
1146
1169
  ),
1147
- /* @__PURE__ */ e("button", { type: "button", onClick: () => a(null), children: "Cancel" })
1170
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => t(null), children: s("contractEditor.cancel", "Cancel") })
1148
1171
  ] })
1149
1172
  ] }) : /* @__PURE__ */ e(
1150
1173
  "button",
1151
1174
  {
1152
1175
  type: "button",
1153
1176
  className: "nice-contract-btn",
1154
- onClick: () => a(h.id),
1155
- children: "Review"
1177
+ onClick: () => t(r.id),
1178
+ children: s("contractEditor.review", "Review")
1156
1179
  }
1157
1180
  ) })
1158
1181
  ]
1159
1182
  },
1160
- h.id
1183
+ r.id
1161
1184
  )) })
1162
1185
  ] });
1163
- }, Mc = te(
1164
- ({
1165
- document: i,
1166
- clauseLibrary: s = [],
1167
- readOnly: t = !1,
1168
- showClauseLibrary: a = !0,
1169
- showVersionHistory: n = !1,
1170
- showComments: l = !1,
1171
- showWorkflow: h = !0,
1172
- currentUser: r,
1173
- onChange: u,
1174
- onAddClause: T,
1175
- onRemoveClause: E,
1176
- onVariableChange: S,
1177
- onAddComment: y,
1178
- onApprovalAction: J,
1179
- onRestoreVersion: _,
1180
- onSave: K,
1181
- onExport: O,
1182
- className: M = "",
1183
- style: j,
1184
- tutorial: U
1185
- }, B) => {
1186
- var Q;
1187
- const [m, k] = w(i), [g, Y] = w(a ? "library" : null), [p, P] = w(
1188
- ((Q = m.sections[0]) == null ? void 0 : Q.id) || null
1189
- ), I = m.sections.flatMap(
1190
- (N) => N.clauses.flatMap((D) => D.variables || [])
1191
- ).filter(
1192
- (N, D, R) => R.findIndex((H) => H.name === N.name) === D
1193
- ), C = $(
1194
- (N) => {
1195
- const D = { ...m, ...N, updatedAt: /* @__PURE__ */ new Date() };
1196
- k(D), u == null || u(D);
1197
- },
1198
- [m, u]
1199
- ), q = $(
1200
- (N, D) => {
1201
- const R = m.sections.map(
1202
- (H) => H.id === D ? { ...H, clauses: [...H.clauses, { ...N, id: `${N.id}-${Date.now()}` }] } : H
1203
- );
1204
- C({ sections: R }), T == null || T(N, D);
1205
- },
1206
- [m, C, T]
1207
- ), v = $(
1208
- (N, D) => {
1209
- const R = m.sections.map(
1210
- (H) => H.id === D ? { ...H, clauses: H.clauses.filter((X) => X.id !== N) } : H
1211
- );
1212
- C({ sections: R }), E == null || E(N, D);
1213
- },
1214
- [m, C, E]
1215
- ), x = $(
1216
- (N, D, R) => {
1217
- const H = m.sections.map((X) => {
1218
- if (X.id !== N)
1219
- return X;
1220
- const o = X.clauses.findIndex((Z) => Z.id === D);
1221
- if (o === -1)
1222
- return X;
1223
- const d = R === "up" ? o - 1 : o + 1;
1224
- if (d < 0 || d >= X.clauses.length)
1225
- return X;
1226
- const f = [...X.clauses];
1227
- return [f[o], f[d]] = [f[d], f[o]], { ...X, clauses: f };
1228
- });
1229
- C({ sections: H });
1230
- },
1231
- [m, C]
1232
- ), z = $(
1233
- (N) => {
1234
- const D = m.sections.map(
1235
- (R) => R.id === N ? { ...R, collapsed: !R.collapsed } : R
1236
- );
1237
- C({ sections: D });
1238
- },
1239
- [m, C]
1240
- ), G = $(
1241
- (N, D) => {
1242
- C({ variables: { ...m.variables, [N]: D } }), S == null || S(N, D);
1243
- },
1244
- [m, C, S]
1245
- ), V = $(() => {
1246
- const N = [];
1247
- return I.forEach((D) => {
1248
- D.required && !m.variables[D.name] && N.push(`Missing required variable: ${D.name}`);
1249
- }), m.sections.forEach((D) => {
1250
- D.clauses.forEach((R) => {
1251
- R.isRequired && !R.content && N.push(`Required clause "${R.name}" is empty`);
1252
- });
1253
- }), { valid: N.length === 0, errors: N };
1254
- }, [m, I]);
1255
- ne(B, () => ({
1256
- getDocument: () => m,
1257
- insertClause: q,
1258
- setVariable: G,
1259
- exportDocument: (N) => O == null ? void 0 : O(N),
1260
- validate: V
1261
- }));
1262
- const b = $c[m.status], L = /* @__PURE__ */ c("div", { className: "nice-contract-header", children: [
1263
- /* @__PURE__ */ c("div", { className: "nice-contract-header-info", children: [
1264
- /* @__PURE__ */ e("h2", { className: "nice-contract-title", children: m.title }),
1265
- /* @__PURE__ */ e(
1266
- "span",
1267
- {
1268
- className: "nice-contract-status",
1269
- style: { "--status-color": b.color },
1270
- children: b.label
1271
- }
1272
- )
1273
- ] }),
1274
- /* @__PURE__ */ c("div", { className: "nice-contract-header-actions", children: [
1275
- K && !t && /* @__PURE__ */ e(
1276
- "button",
1186
+ }, sa = /* @__PURE__ */ Object.assign(
1187
+ /* @__PURE__ */ le(
1188
+ ({
1189
+ document: a,
1190
+ clauseLibrary: n = [],
1191
+ readOnly: s = !1,
1192
+ showClauseLibrary: i = !0,
1193
+ showVersionHistory: t = !1,
1194
+ showComments: l = !1,
1195
+ showWorkflow: h = !0,
1196
+ currentUser: r,
1197
+ onChange: o,
1198
+ onAddClause: w,
1199
+ onRemoveClause: _,
1200
+ onVariableChange: I,
1201
+ onAddComment: C,
1202
+ onApprovalAction: z,
1203
+ onRestoreVersion: F,
1204
+ onSave: U,
1205
+ onExport: L,
1206
+ className: Y = "",
1207
+ style: ce,
1208
+ tutorial: $
1209
+ }, q) => {
1210
+ var G;
1211
+ const { t: E } = W(), [m, N] = k(a), [g, V] = k(i ? "library" : null), [u, B] = k(
1212
+ ((G = m.sections[0]) == null ? void 0 : G.id) || null
1213
+ ), P = m.sections.flatMap(
1214
+ (v) => v.clauses.flatMap((D) => D.variables || [])
1215
+ ).filter(
1216
+ (v, D, M) => M.findIndex((K) => K.name === v.name) === D
1217
+ ), x = R(
1218
+ (v) => {
1219
+ const D = { ...m, ...v, updatedAt: /* @__PURE__ */ new Date() };
1220
+ N(D), o == null || o(D);
1221
+ },
1222
+ [m, o]
1223
+ ), H = R(
1224
+ (v, D) => {
1225
+ const M = m.sections.map(
1226
+ (K) => K.id === D ? { ...K, clauses: [...K.clauses, { ...v, id: `${v.id}-${Date.now()}` }] } : K
1227
+ );
1228
+ x({ sections: M }), w == null || w(v, D);
1229
+ },
1230
+ [m, x, w]
1231
+ ), j = R(
1232
+ (v, D) => {
1233
+ const M = m.sections.map(
1234
+ (K) => K.id === D ? { ...K, clauses: K.clauses.filter((Q) => Q.id !== v) } : K
1235
+ );
1236
+ x({ sections: M }), _ == null || _(v, D);
1237
+ },
1238
+ [m, x, _]
1239
+ ), b = R(
1240
+ (v, D, M) => {
1241
+ const K = m.sections.map((Q) => {
1242
+ if (Q.id !== v)
1243
+ return Q;
1244
+ const d = Q.clauses.findIndex((ee) => ee.id === D);
1245
+ if (d === -1)
1246
+ return Q;
1247
+ const p = M === "up" ? d - 1 : d + 1;
1248
+ if (p < 0 || p >= Q.clauses.length)
1249
+ return Q;
1250
+ const y = [...Q.clauses];
1251
+ return [y[d], y[p]] = [y[p], y[d]], { ...Q, clauses: y };
1252
+ });
1253
+ x({ sections: K });
1254
+ },
1255
+ [m, x]
1256
+ ), S = R(
1257
+ (v) => {
1258
+ const D = m.sections.map(
1259
+ (M) => M.id === v ? { ...M, collapsed: !M.collapsed } : M
1260
+ );
1261
+ x({ sections: D });
1262
+ },
1263
+ [m, x]
1264
+ ), A = R(
1265
+ (v, D) => {
1266
+ x({ variables: { ...m.variables, [v]: D } }), I == null || I(v, D);
1267
+ },
1268
+ [m, x, I]
1269
+ ), J = R(() => {
1270
+ const v = [];
1271
+ return P.forEach((D) => {
1272
+ D.required && !m.variables[D.name] && v.push(`Missing required variable: ${D.name}`);
1273
+ }), m.sections.forEach((D) => {
1274
+ D.clauses.forEach((M) => {
1275
+ M.isRequired && !M.content && v.push(`Required clause "${M.name}" is empty`);
1276
+ });
1277
+ }), { valid: v.length === 0, errors: v };
1278
+ }, [m, P]);
1279
+ re(q, () => ({
1280
+ getDocument: () => m,
1281
+ insertClause: H,
1282
+ setVariable: A,
1283
+ exportDocument: (v) => L == null ? void 0 : L(v),
1284
+ validate: J
1285
+ }));
1286
+ const f = Pc[m.status], T = /* @__PURE__ */ c("div", { className: "nice-contract-header", children: [
1287
+ /* @__PURE__ */ c("div", { className: "nice-contract-header-info", children: [
1288
+ /* @__PURE__ */ e("h2", { className: "nice-contract-title", children: m.title }),
1289
+ /* @__PURE__ */ e(
1290
+ "span",
1291
+ {
1292
+ className: "nice-contract-status",
1293
+ style: { "--status-color": f.color },
1294
+ children: f.label
1295
+ }
1296
+ )
1297
+ ] }),
1298
+ /* @__PURE__ */ c("div", { className: "nice-contract-header-actions", children: [
1299
+ U && !s && /* @__PURE__ */ e(
1300
+ "button",
1301
+ {
1302
+ type: "button",
1303
+ className: "nice-contract-btn nice-contract-btn--primary",
1304
+ onClick: () => U(m),
1305
+ children: E("contractEditor.save", "Save")
1306
+ }
1307
+ ),
1308
+ L && /* @__PURE__ */ c("div", { className: "nice-contract-export-dropdown", children: [
1309
+ /* @__PURE__ */ c("button", { type: "button", className: "nice-contract-btn", children: [
1310
+ E("contractEditor.export", "Export"),
1311
+ " ",
1312
+ /* @__PURE__ */ e(Se, { size: 14 })
1313
+ ] }),
1314
+ /* @__PURE__ */ c("div", { className: "nice-contract-export-menu", children: [
1315
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => L("pdf"), children: "PDF" }),
1316
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => L("docx"), children: "Word (.docx)" }),
1317
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => L("html"), children: E("contractEditor.html", "HTML") })
1318
+ ] })
1319
+ ] })
1320
+ ] })
1321
+ ] }), X = /* @__PURE__ */ c("div", { className: "nice-contract-toolbar", children: [
1322
+ i && /* @__PURE__ */ c(
1323
+ "button",
1277
1324
  {
1278
1325
  type: "button",
1279
- className: "nice-contract-btn nice-contract-btn--primary",
1280
- onClick: () => K(m),
1281
- children: "Save"
1326
+ className: `nice-contract-toolbar-btn ${g === "library" ? "nice-contract-toolbar-btn--active" : ""}`,
1327
+ onClick: () => V(g === "library" ? null : "library"),
1328
+ children: [
1329
+ /* @__PURE__ */ e(tc, { size: 16 }),
1330
+ " ",
1331
+ E("contractEditor.library", "Library")
1332
+ ]
1282
1333
  }
1283
1334
  ),
1284
- O && /* @__PURE__ */ c("div", { className: "nice-contract-export-dropdown", children: [
1285
- /* @__PURE__ */ c("button", { type: "button", className: "nice-contract-btn", children: [
1286
- "Export ",
1287
- /* @__PURE__ */ e(De, { size: 14 })
1288
- ] }),
1289
- /* @__PURE__ */ c("div", { className: "nice-contract-export-menu", children: [
1290
- /* @__PURE__ */ e("button", { type: "button", onClick: () => O("pdf"), children: "PDF" }),
1291
- /* @__PURE__ */ e("button", { type: "button", onClick: () => O("docx"), children: "Word (.docx)" }),
1292
- /* @__PURE__ */ e("button", { type: "button", onClick: () => O("html"), children: "HTML" })
1293
- ] })
1294
- ] })
1295
- ] })
1296
- ] }), W = /* @__PURE__ */ c("div", { className: "nice-contract-toolbar", children: [
1297
- a && /* @__PURE__ */ c(
1298
- "button",
1299
- {
1300
- type: "button",
1301
- className: `nice-contract-toolbar-btn ${g === "library" ? "nice-contract-toolbar-btn--active" : ""}`,
1302
- onClick: () => Y(g === "library" ? null : "library"),
1303
- children: [
1304
- /* @__PURE__ */ e(ec, { size: 16 }),
1305
- " Library"
1306
- ]
1307
- }
1308
- ),
1309
- /* @__PURE__ */ c(
1310
- "button",
1311
- {
1312
- type: "button",
1313
- className: `nice-contract-toolbar-btn ${g === "variables" ? "nice-contract-toolbar-btn--active" : ""}`,
1314
- onClick: () => Y(g === "variables" ? null : "variables"),
1315
- children: [
1316
- /* @__PURE__ */ e(Fe, { size: 16 }),
1317
- " Variables"
1318
- ]
1319
- }
1320
- ),
1321
- h && m.workflow && /* @__PURE__ */ c(
1322
- "button",
1323
- {
1324
- type: "button",
1325
- className: `nice-contract-toolbar-btn ${g === "workflow" ? "nice-contract-toolbar-btn--active" : ""}`,
1326
- onClick: () => Y(g === "workflow" ? null : "workflow"),
1327
- children: [
1328
- /* @__PURE__ */ e(ae, { size: 16 }),
1329
- " Workflow"
1330
- ]
1331
- }
1332
- ),
1333
- n && /* @__PURE__ */ c(
1334
- "button",
1335
- {
1336
- type: "button",
1337
- className: `nice-contract-toolbar-btn ${g === "history" ? "nice-contract-toolbar-btn--active" : ""}`,
1338
- onClick: () => Y(g === "history" ? null : "history"),
1339
- children: [
1340
- /* @__PURE__ */ e(xe, { size: 16 }),
1341
- " History"
1342
- ]
1343
- }
1344
- )
1345
- ] }), F = g ? /* @__PURE__ */ c("div", { className: "nice-contract-panel", children: [
1346
- g === "library" && /* @__PURE__ */ e(
1347
- Pc,
1348
- {
1349
- clauses: s,
1350
- onInsert: (N) => p && q(N, p)
1351
- }
1352
- ),
1353
- g === "variables" && /* @__PURE__ */ e(
1354
- Rc,
1355
- {
1356
- variables: m.variables,
1357
- definitions: I,
1358
- onChange: G
1359
- }
1360
- ),
1361
- g === "workflow" && m.workflow && /* @__PURE__ */ e(
1362
- Ec,
1335
+ /* @__PURE__ */ c(
1336
+ "button",
1337
+ {
1338
+ type: "button",
1339
+ className: `nice-contract-toolbar-btn ${g === "variables" ? "nice-contract-toolbar-btn--active" : ""}`,
1340
+ onClick: () => V(g === "variables" ? null : "variables"),
1341
+ children: [
1342
+ /* @__PURE__ */ e(Re, { size: 16 }),
1343
+ " ",
1344
+ E("contractEditor.variables", "Variables")
1345
+ ]
1346
+ }
1347
+ ),
1348
+ h && m.workflow && /* @__PURE__ */ c(
1349
+ "button",
1350
+ {
1351
+ type: "button",
1352
+ className: `nice-contract-toolbar-btn ${g === "workflow" ? "nice-contract-toolbar-btn--active" : ""}`,
1353
+ onClick: () => V(g === "workflow" ? null : "workflow"),
1354
+ children: [
1355
+ /* @__PURE__ */ e(se, { size: 16 }),
1356
+ " ",
1357
+ E("contractEditor.workflow", "Workflow")
1358
+ ]
1359
+ }
1360
+ ),
1361
+ t && /* @__PURE__ */ c(
1362
+ "button",
1363
+ {
1364
+ type: "button",
1365
+ className: `nice-contract-toolbar-btn ${g === "history" ? "nice-contract-toolbar-btn--active" : ""}`,
1366
+ onClick: () => V(g === "history" ? null : "history"),
1367
+ children: [
1368
+ /* @__PURE__ */ e(Le, { size: 16 }),
1369
+ " ",
1370
+ E("contractEditor.history", "History")
1371
+ ]
1372
+ }
1373
+ )
1374
+ ] }), Z = g ? /* @__PURE__ */ c("div", { className: "nice-contract-panel", children: [
1375
+ g === "library" && /* @__PURE__ */ e(
1376
+ Rc,
1377
+ {
1378
+ clauses: n,
1379
+ onInsert: (v) => u && H(v, u)
1380
+ }
1381
+ ),
1382
+ g === "variables" && /* @__PURE__ */ e(
1383
+ Fc,
1384
+ {
1385
+ variables: m.variables,
1386
+ definitions: P,
1387
+ onChange: A
1388
+ }
1389
+ ),
1390
+ g === "workflow" && m.workflow && /* @__PURE__ */ e(
1391
+ Mc,
1392
+ {
1393
+ workflow: m.workflow,
1394
+ onAction: (v, D, M) => z == null ? void 0 : z(v, D, M)
1395
+ }
1396
+ )
1397
+ ] }) : void 0;
1398
+ return /* @__PURE__ */ e(
1399
+ fc,
1363
1400
  {
1364
- workflow: m.workflow,
1365
- onAction: (N, D, R) => J == null ? void 0 : J(N, D, R)
1401
+ flush: !0,
1402
+ className: `nice-contract-editor ${Y}`,
1403
+ style: ce,
1404
+ menubar: T,
1405
+ toolbar: X,
1406
+ sidebar: Z,
1407
+ children: /* @__PURE__ */ c("div", { className: "nice-contract-document", children: [
1408
+ /* @__PURE__ */ e("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ e(yc, { steps: wc($, Oc) }) }),
1409
+ m.sections.map((v) => /* @__PURE__ */ e(
1410
+ $c,
1411
+ {
1412
+ section: v,
1413
+ variables: m.variables,
1414
+ readOnly: s,
1415
+ onToggle: () => S(v.id),
1416
+ onRemoveClause: (D) => j(D, v.id),
1417
+ onMoveClause: (D, M) => b(v.id, D, M)
1418
+ },
1419
+ v.id
1420
+ ))
1421
+ ] })
1366
1422
  }
1367
- )
1368
- ] }) : void 0;
1369
- return /* @__PURE__ */ e(
1370
- Nc,
1371
- {
1372
- flush: !0,
1373
- className: `nice-contract-editor ${M}`,
1374
- style: j,
1375
- menubar: L,
1376
- toolbar: W,
1377
- sidebar: F,
1378
- children: /* @__PURE__ */ c("div", { className: "nice-contract-document", children: [
1379
- /* @__PURE__ */ e("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ e(fc, { steps: yc(U, Fc) }) }),
1380
- m.sections.map((N) => /* @__PURE__ */ e(
1381
- Oc,
1382
- {
1383
- section: N,
1384
- variables: m.variables,
1385
- readOnly: t,
1386
- onToggle: () => z(N.id),
1387
- onRemoveClause: (D) => v(D, N.id),
1388
- onMoveClause: (D, R) => x(N.id, D, R)
1389
- },
1390
- N.id
1391
- ))
1392
- ] })
1393
- }
1394
- );
1395
- }
1396
- );
1397
- Mc.displayName = "NiceContractEditor";
1398
- const jc = [
1423
+ );
1424
+ }
1425
+ ),
1426
+ { displayName: "NiceContractEditor" }
1427
+ ), jc = [
1399
1428
  {
1400
1429
  id: "necessary",
1401
1430
  label: "Necessary",
@@ -1454,246 +1483,223 @@ const jc = [
1454
1483
  processing: "Processing",
1455
1484
  completed: "Completed",
1456
1485
  close: "Close"
1457
- }, Yc = ({ option: i, enabled: s, onChange: t }) => /* @__PURE__ */ c("div", { className: "nice-gdpr-option", children: [
1458
- /* @__PURE__ */ c("div", { className: "nice-gdpr-option-header", children: [
1459
- /* @__PURE__ */ c("label", { className: "nice-gdpr-option-toggle", children: [
1460
- /* @__PURE__ */ e(
1461
- "input",
1486
+ }, Yc = ({ option: a, enabled: n, onChange: s }) => {
1487
+ const { t: i } = W();
1488
+ return /* @__PURE__ */ c("div", { className: "nice-gdpr-option", children: [
1489
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-option-header", children: [
1490
+ /* @__PURE__ */ c("label", { className: "nice-gdpr-option-toggle", children: [
1491
+ /* @__PURE__ */ e(
1492
+ "input",
1493
+ {
1494
+ type: "checkbox",
1495
+ checked: n,
1496
+ onChange: (t) => s(t.target.checked),
1497
+ disabled: a.required
1498
+ }
1499
+ ),
1500
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-toggle-slider" })
1501
+ ] }),
1502
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-option-info", children: [
1503
+ /* @__PURE__ */ c("span", { className: "nice-gdpr-option-label", children: [
1504
+ a.label,
1505
+ a.required && /* @__PURE__ */ e("span", { className: "nice-gdpr-required", children: i("gdprConsent.required", "Required") })
1506
+ ] }),
1507
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-option-desc", children: a.description })
1508
+ ] })
1509
+ ] }),
1510
+ a.partners && a.partners.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-option-partners", children: [
1511
+ /* @__PURE__ */ e("span", { children: "Partners: " }),
1512
+ a.partners.join(", ")
1513
+ ] })
1514
+ ] });
1515
+ }, qc = ({
1516
+ requests: a,
1517
+ policies: n,
1518
+ onRequest: s,
1519
+ onDownload: i,
1520
+ labels: t
1521
+ }) => {
1522
+ const { t: l } = W();
1523
+ return /* @__PURE__ */ c("div", { className: "nice-gdpr-rights", children: [
1524
+ /* @__PURE__ */ e("h4", { children: t.dataRights }),
1525
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-rights-actions", children: [
1526
+ /* @__PURE__ */ c(
1527
+ "button",
1462
1528
  {
1463
- type: "checkbox",
1464
- checked: s,
1465
- onChange: (a) => t(a.target.checked),
1466
- disabled: i.required
1529
+ type: "button",
1530
+ className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1531
+ onClick: () => s("export"),
1532
+ children: [
1533
+ /* @__PURE__ */ e(ve, { size: 16 }),
1534
+ " ",
1535
+ t.exportData
1536
+ ]
1467
1537
  }
1468
1538
  ),
1469
- /* @__PURE__ */ e("span", { className: "nice-gdpr-toggle-slider" })
1470
- ] }),
1471
- /* @__PURE__ */ c("div", { className: "nice-gdpr-option-info", children: [
1472
- /* @__PURE__ */ c("span", { className: "nice-gdpr-option-label", children: [
1473
- i.label,
1474
- i.required && /* @__PURE__ */ e("span", { className: "nice-gdpr-required", children: "Required" })
1475
- ] }),
1476
- /* @__PURE__ */ e("span", { className: "nice-gdpr-option-desc", children: i.description })
1477
- ] })
1478
- ] }),
1479
- i.partners && i.partners.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-option-partners", children: [
1480
- /* @__PURE__ */ e("span", { children: "Partners: " }),
1481
- i.partners.join(", ")
1482
- ] })
1483
- ] }), qc = ({
1484
- requests: i,
1485
- policies: s,
1486
- onRequest: t,
1487
- onDownload: a,
1488
- labels: n
1489
- }) => /* @__PURE__ */ c("div", { className: "nice-gdpr-rights", children: [
1490
- /* @__PURE__ */ e("h4", { children: n.dataRights }),
1491
- /* @__PURE__ */ c("div", { className: "nice-gdpr-rights-actions", children: [
1492
- /* @__PURE__ */ c(
1493
- "button",
1494
- {
1495
- type: "button",
1496
- className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1497
- onClick: () => t("export"),
1498
- children: [
1499
- /* @__PURE__ */ e(me, { size: 16 }),
1500
- " ",
1501
- n.exportData
1502
- ]
1503
- }
1504
- ),
1505
- /* @__PURE__ */ c(
1506
- "button",
1507
- {
1508
- type: "button",
1509
- className: "nice-gdpr-btn nice-gdpr-btn--danger",
1510
- onClick: () => t("delete"),
1511
- children: [
1512
- /* @__PURE__ */ e(lc, { size: 16 }),
1513
- " ",
1514
- n.deleteData
1515
- ]
1516
- }
1517
- )
1518
- ] }),
1519
- i.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-requests", children: [
1520
- /* @__PURE__ */ e("h5", { children: "Previous Requests" }),
1521
- i.map((l) => /* @__PURE__ */ c("div", { className: `nice-gdpr-request nice-gdpr-request--${l.status}`, children: [
1522
- /* @__PURE__ */ e("span", { className: "nice-gdpr-request-type", children: l.type }),
1523
- /* @__PURE__ */ e("span", { className: "nice-gdpr-request-date", children: new Date(l.requestedAt).toLocaleDateString() }),
1524
- /* @__PURE__ */ e("span", { className: "nice-gdpr-request-status", children: l.status }),
1525
- l.status === "completed" && l.downloadUrl && /* @__PURE__ */ e(
1539
+ /* @__PURE__ */ c(
1526
1540
  "button",
1527
1541
  {
1528
1542
  type: "button",
1529
- className: "nice-gdpr-download-btn",
1530
- onClick: () => a(l.id),
1531
- children: "Download"
1543
+ className: "nice-gdpr-btn nice-gdpr-btn--danger",
1544
+ onClick: () => s("delete"),
1545
+ children: [
1546
+ /* @__PURE__ */ e(dc, { size: 16 }),
1547
+ " ",
1548
+ t.deleteData
1549
+ ]
1532
1550
  }
1533
1551
  )
1534
- ] }, l.id))
1535
- ] }),
1536
- s.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-policies", children: [
1537
- /* @__PURE__ */ e("h5", { children: "Data Retention" }),
1538
- /* @__PURE__ */ c("table", { className: "nice-gdpr-policies-table", children: [
1539
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
1540
- /* @__PURE__ */ e("th", { children: "Category" }),
1541
- /* @__PURE__ */ e("th", { children: "Retention" }),
1542
- /* @__PURE__ */ e("th", { children: "Legal Basis" })
1543
- ] }) }),
1544
- /* @__PURE__ */ e("tbody", { children: s.map((l, h) => /* @__PURE__ */ c("tr", { children: [
1545
- /* @__PURE__ */ e("td", { children: l.category }),
1546
- /* @__PURE__ */ c("td", { children: [
1547
- l.retentionDays,
1548
- " days"
1549
- ] }),
1550
- /* @__PURE__ */ e("td", { children: l.legalBasis })
1551
- ] }, h)) })
1552
- ] })
1553
- ] })
1554
- ] }), Vc = te(
1555
- ({
1556
- appName: i,
1557
- companyName: s,
1558
- options: t = jc,
1559
- currentConsent: a = null,
1560
- retentionPolicies: n = [],
1561
- dataRequests: l = [],
1562
- privacyPolicy: h = [],
1563
- storageKey: r = "nice_gdpr_consent",
1564
- consentVersion: u = "1.0",
1565
- variant: T = "banner",
1566
- position: E = "bottom",
1567
- onConsentChange: S,
1568
- onDataRequest: y,
1569
- onDownloadExport: J,
1570
- privacyPolicyUrl: _,
1571
- cookiePolicyUrl: K,
1572
- termsUrl: O,
1573
- labels: M,
1574
- className: j = "",
1575
- style: U
1576
- }, B) => {
1577
- const m = { ...Uc, ...M }, [k, g] = w(!1), [Y, p] = w(!1), [P, A] = w(!1), [I, C] = w(() => {
1578
- const b = {};
1579
- return t.forEach((L) => {
1580
- b[L.id] = (a == null ? void 0 : a.categories[L.id]) ?? L.enabled;
1581
- }), b;
1582
- });
1583
- ue(() => {
1584
- (!a || a.version !== u) && g(!0);
1585
- }, [a, u]);
1586
- const q = $(
1587
- (b, L) => {
1588
- const W = L || I;
1589
- W.necessary = !0;
1590
- const F = {
1591
- version: u,
1592
- timestamp: /* @__PURE__ */ new Date(),
1593
- categories: W,
1594
- action: b
1595
- };
1596
- try {
1597
- localStorage.setItem(r, JSON.stringify(F));
1598
- } catch {
1599
- }
1600
- C(W), g(!1), p(!1), S == null || S(F);
1601
- },
1602
- [I, u, r, S]
1603
- ), v = $(() => {
1604
- const b = {};
1605
- t.forEach((L) => {
1606
- b[L.id] = !0;
1607
- }), q("accept_all", b);
1608
- }, [t, q]), x = $(() => {
1609
- const b = {};
1610
- t.forEach((L) => {
1611
- b[L.id] = L.required || !1;
1612
- }), q("reject_all", b);
1613
- }, [t, q]), z = $(
1614
- async (b) => {
1615
- y && await y(b);
1616
- },
1617
- [y]
1618
- );
1619
- if (ne(B, () => ({
1620
- showBanner: () => g(!0),
1621
- hideBanner: () => g(!1),
1622
- getConsent: () => {
1623
- try {
1624
- const b = localStorage.getItem(r);
1625
- return b ? JSON.parse(b) : null;
1626
- } catch {
1627
- return null;
1628
- }
1629
- },
1630
- revokeConsent: () => {
1631
- try {
1632
- localStorage.removeItem(r);
1633
- } catch {
1634
- }
1635
- g(!0);
1636
- },
1637
- openPreferences: () => {
1638
- g(!0), p(!0);
1639
- }
1640
- })), !k && T !== "embedded")
1641
- return null;
1642
- const G = /* @__PURE__ */ c("div", { className: "nice-gdpr-content", children: [
1643
- /* @__PURE__ */ c("div", { className: "nice-gdpr-header", children: [
1644
- /* @__PURE__ */ e("div", { className: "nice-gdpr-icon", children: /* @__PURE__ */ e(tc, { size: 32 }) }),
1645
- /* @__PURE__ */ c("div", { className: "nice-gdpr-header-text", children: [
1646
- /* @__PURE__ */ e("h3", { children: m.title }),
1647
- /* @__PURE__ */ e("p", { children: m.description.replace("{app}", i).replace("{company}", s) })
1648
- ] })
1649
- ] }),
1650
- !Y && !P && /* @__PURE__ */ c("div", { className: "nice-gdpr-quick-actions", children: [
1651
- /* @__PURE__ */ e(
1552
+ ] }),
1553
+ a.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-requests", children: [
1554
+ /* @__PURE__ */ e("h5", { children: l("gdprConsent.previousRequests", "Previous Requests") }),
1555
+ a.map((h) => /* @__PURE__ */ c("div", { className: `nice-gdpr-request nice-gdpr-request--${h.status}`, children: [
1556
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-request-type", children: h.type }),
1557
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-request-date", children: new Date(h.requestedAt).toLocaleDateString() }),
1558
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-request-status", children: h.status }),
1559
+ h.status === "completed" && h.downloadUrl && /* @__PURE__ */ e(
1652
1560
  "button",
1653
1561
  {
1654
1562
  type: "button",
1655
- className: "nice-gdpr-btn nice-gdpr-btn--primary",
1656
- onClick: v,
1657
- children: m.acceptAll
1563
+ className: "nice-gdpr-download-btn",
1564
+ onClick: () => i(h.id),
1565
+ children: l("gdprConsent.download", "Download")
1658
1566
  }
1659
- ),
1660
- /* @__PURE__ */ e(
1661
- "button",
1662
- {
1663
- type: "button",
1664
- className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1665
- onClick: x,
1666
- children: m.rejectAll
1567
+ )
1568
+ ] }, h.id))
1569
+ ] }),
1570
+ n.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-policies", children: [
1571
+ /* @__PURE__ */ e("h5", { children: l("gdprConsent.dataRetention", "Data Retention") }),
1572
+ /* @__PURE__ */ c("table", { className: "nice-gdpr-policies-table", children: [
1573
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
1574
+ /* @__PURE__ */ e("th", { children: l("gdprConsent.category", "Category") }),
1575
+ /* @__PURE__ */ e("th", { children: l("gdprConsent.retention", "Retention") }),
1576
+ /* @__PURE__ */ e("th", { children: l("gdprConsent.legalBasis", "Legal Basis") })
1577
+ ] }) }),
1578
+ /* @__PURE__ */ e("tbody", { children: n.map((h, r) => /* @__PURE__ */ c("tr", { children: [
1579
+ /* @__PURE__ */ e("td", { children: h.category }),
1580
+ /* @__PURE__ */ c("td", { children: [
1581
+ h.retentionDays,
1582
+ " days"
1583
+ ] }),
1584
+ /* @__PURE__ */ e("td", { children: h.legalBasis })
1585
+ ] }, r)) })
1586
+ ] })
1587
+ ] })
1588
+ ] });
1589
+ }, na = /* @__PURE__ */ Object.assign(
1590
+ /* @__PURE__ */ le(
1591
+ ({
1592
+ appName: a,
1593
+ companyName: n,
1594
+ options: s = jc,
1595
+ currentConsent: i = null,
1596
+ retentionPolicies: t = [],
1597
+ dataRequests: l = [],
1598
+ privacyPolicy: h = [],
1599
+ storageKey: r = "nice_gdpr_consent",
1600
+ consentVersion: o = "1.0",
1601
+ variant: w = "banner",
1602
+ position: _ = "bottom",
1603
+ onConsentChange: I,
1604
+ onDataRequest: C,
1605
+ onDownloadExport: z,
1606
+ privacyPolicyUrl: F,
1607
+ cookiePolicyUrl: U,
1608
+ termsUrl: L,
1609
+ labels: Y,
1610
+ className: ce = "",
1611
+ style: $
1612
+ }, q) => {
1613
+ const { t: E } = W(), m = { ...Uc, ...Y }, [N, g] = k(!1), [V, u] = k(!1), [B, O] = k(!1), [P, x] = k(() => {
1614
+ const f = {};
1615
+ return s.forEach((T) => {
1616
+ f[T.id] = (i == null ? void 0 : i.categories[T.id]) ?? T.enabled;
1617
+ }), f;
1618
+ });
1619
+ me(() => {
1620
+ (!i || i.version !== o) && g(!0);
1621
+ }, [i, o]);
1622
+ const H = R(
1623
+ (f, T) => {
1624
+ const X = T || P;
1625
+ X.necessary = !0;
1626
+ const Z = {
1627
+ version: o,
1628
+ timestamp: /* @__PURE__ */ new Date(),
1629
+ categories: X,
1630
+ action: f
1631
+ };
1632
+ try {
1633
+ localStorage.setItem(r, JSON.stringify(Z));
1634
+ } catch {
1667
1635
  }
1668
- ),
1669
- /* @__PURE__ */ e(
1670
- "button",
1671
- {
1672
- type: "button",
1673
- className: "nice-gdpr-btn nice-gdpr-btn--link",
1674
- onClick: () => p(!0),
1675
- children: m.customize
1636
+ x(X), g(!1), u(!1), I == null || I(Z);
1637
+ },
1638
+ [P, o, r, I]
1639
+ ), j = R(() => {
1640
+ const f = {};
1641
+ s.forEach((T) => {
1642
+ f[T.id] = !0;
1643
+ }), H("accept_all", f);
1644
+ }, [s, H]), b = R(() => {
1645
+ const f = {};
1646
+ s.forEach((T) => {
1647
+ f[T.id] = T.required || !1;
1648
+ }), H("reject_all", f);
1649
+ }, [s, H]), S = R(
1650
+ async (f) => {
1651
+ C && await C(f);
1652
+ },
1653
+ [C]
1654
+ );
1655
+ if (re(q, () => ({
1656
+ showBanner: () => g(!0),
1657
+ hideBanner: () => g(!1),
1658
+ getConsent: () => {
1659
+ try {
1660
+ const f = localStorage.getItem(r);
1661
+ return f ? JSON.parse(f) : null;
1662
+ } catch {
1663
+ return null;
1676
1664
  }
1677
- )
1678
- ] }),
1679
- Y && !P && /* @__PURE__ */ c("div", { className: "nice-gdpr-preferences", children: [
1680
- /* @__PURE__ */ e("div", { className: "nice-gdpr-options", children: t.map((b) => /* @__PURE__ */ e(
1681
- Yc,
1682
- {
1683
- option: b,
1684
- enabled: I[b.id],
1685
- onChange: (L) => C((W) => ({ ...W, [b.id]: L }))
1686
- },
1687
- b.id
1688
- )) }),
1689
- /* @__PURE__ */ c("div", { className: "nice-gdpr-pref-actions", children: [
1665
+ },
1666
+ revokeConsent: () => {
1667
+ try {
1668
+ localStorage.removeItem(r);
1669
+ } catch {
1670
+ }
1671
+ g(!0);
1672
+ },
1673
+ openPreferences: () => {
1674
+ g(!0), u(!0);
1675
+ }
1676
+ })), !N && w !== "embedded")
1677
+ return null;
1678
+ const A = /* @__PURE__ */ c("div", { className: "nice-gdpr-content", children: [
1679
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-header", children: [
1680
+ /* @__PURE__ */ e("div", { className: "nice-gdpr-icon", children: /* @__PURE__ */ e(rc, { size: 32 }) }),
1681
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-header-text", children: [
1682
+ /* @__PURE__ */ e("h3", { children: m.title }),
1683
+ /* @__PURE__ */ e("p", { children: m.description.replace("{app}", a).replace("{company}", n) })
1684
+ ] })
1685
+ ] }),
1686
+ !V && !B && /* @__PURE__ */ c("div", { className: "nice-gdpr-quick-actions", children: [
1690
1687
  /* @__PURE__ */ e(
1691
1688
  "button",
1692
1689
  {
1693
1690
  type: "button",
1694
1691
  className: "nice-gdpr-btn nice-gdpr-btn--primary",
1695
- onClick: () => q("custom"),
1696
- children: m.savePreferences
1692
+ onClick: j,
1693
+ children: m.acceptAll
1694
+ }
1695
+ ),
1696
+ /* @__PURE__ */ e(
1697
+ "button",
1698
+ {
1699
+ type: "button",
1700
+ className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1701
+ onClick: b,
1702
+ children: m.rejectAll
1697
1703
  }
1698
1704
  ),
1699
1705
  /* @__PURE__ */ e(
@@ -1701,164 +1707,198 @@ const jc = [
1701
1707
  {
1702
1708
  type: "button",
1703
1709
  className: "nice-gdpr-btn nice-gdpr-btn--link",
1704
- onClick: () => A(!0),
1705
- children: m.dataRights
1710
+ onClick: () => u(!0),
1711
+ children: m.customize
1712
+ }
1713
+ )
1714
+ ] }),
1715
+ V && !B && /* @__PURE__ */ c("div", { className: "nice-gdpr-preferences", children: [
1716
+ /* @__PURE__ */ e("div", { className: "nice-gdpr-options", children: s.map((f) => /* @__PURE__ */ e(
1717
+ Yc,
1718
+ {
1719
+ option: f,
1720
+ enabled: P[f.id],
1721
+ onChange: (T) => x((X) => ({ ...X, [f.id]: T }))
1722
+ },
1723
+ f.id
1724
+ )) }),
1725
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-pref-actions", children: [
1726
+ /* @__PURE__ */ e(
1727
+ "button",
1728
+ {
1729
+ type: "button",
1730
+ className: "nice-gdpr-btn nice-gdpr-btn--primary",
1731
+ onClick: () => H("custom"),
1732
+ children: m.savePreferences
1733
+ }
1734
+ ),
1735
+ /* @__PURE__ */ e(
1736
+ "button",
1737
+ {
1738
+ type: "button",
1739
+ className: "nice-gdpr-btn nice-gdpr-btn--link",
1740
+ onClick: () => O(!0),
1741
+ children: m.dataRights
1742
+ }
1743
+ )
1744
+ ] })
1745
+ ] }),
1746
+ B && /* @__PURE__ */ c(ae, { children: [
1747
+ /* @__PURE__ */ e(
1748
+ qc,
1749
+ {
1750
+ requests: l,
1751
+ policies: t,
1752
+ onRequest: S,
1753
+ onDownload: (f) => z == null ? void 0 : z(f),
1754
+ labels: m
1755
+ }
1756
+ ),
1757
+ /* @__PURE__ */ c(
1758
+ "button",
1759
+ {
1760
+ type: "button",
1761
+ className: "nice-gdpr-btn nice-gdpr-btn--link",
1762
+ onClick: () => O(!1),
1763
+ children: [
1764
+ /* @__PURE__ */ e(oc, { size: 14 }),
1765
+ " ",
1766
+ E("gdprConsent.backToPreferences", "Back to preferences")
1767
+ ]
1706
1768
  }
1707
1769
  )
1770
+ ] }),
1771
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-footer", children: [
1772
+ F && /* @__PURE__ */ e("a", { href: F, target: "_blank", rel: "noopener noreferrer", children: E("gdprConsent.privacyPolicy", "Privacy Policy") }),
1773
+ U && /* @__PURE__ */ e("a", { href: U, target: "_blank", rel: "noopener noreferrer", children: E("gdprConsent.cookiePolicy", "Cookie Policy") }),
1774
+ L && /* @__PURE__ */ e("a", { href: L, target: "_blank", rel: "noopener noreferrer", children: E("gdprConsent.termsOfService", "Terms of Service") })
1708
1775
  ] })
1709
- ] }),
1710
- P && /* @__PURE__ */ c(ee, { children: [
1711
- /* @__PURE__ */ e(
1712
- qc,
1713
- {
1714
- requests: l,
1715
- policies: n,
1716
- onRequest: z,
1717
- onDownload: (b) => J == null ? void 0 : J(b),
1718
- labels: m
1719
- }
1720
- ),
1721
- /* @__PURE__ */ c(
1722
- "button",
1723
- {
1724
- type: "button",
1725
- className: "nice-gdpr-btn nice-gdpr-btn--link",
1726
- onClick: () => A(!1),
1727
- children: [
1728
- /* @__PURE__ */ e(nc, { size: 14 }),
1729
- " Back to preferences"
1730
- ]
1731
- }
1732
- )
1733
- ] }),
1734
- /* @__PURE__ */ c("div", { className: "nice-gdpr-footer", children: [
1735
- _ && /* @__PURE__ */ e("a", { href: _, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" }),
1736
- K && /* @__PURE__ */ e("a", { href: K, target: "_blank", rel: "noopener noreferrer", children: "Cookie Policy" }),
1737
- O && /* @__PURE__ */ e("a", { href: O, target: "_blank", rel: "noopener noreferrer", children: "Terms of Service" })
1738
- ] })
1739
- ] }), V = `nice-gdpr-consent nice-gdpr-consent--${T} nice-gdpr-consent--${E} ${j}`;
1740
- return T === "modal" ? /* @__PURE__ */ e("div", { className: "nice-gdpr-overlay", children: /* @__PURE__ */ e("div", { className: V, style: U, role: "dialog", "aria-modal": "true", children: G }) }) : /* @__PURE__ */ e("div", { className: V, style: U, children: G });
1741
- }
1742
- );
1743
- Vc.displayName = "NiceGDPRConsent";
1744
- const Ve = {
1745
- document: /* @__PURE__ */ e(we, { size: 16 }),
1746
- user: /* @__PURE__ */ e(Ye, { size: 16 }),
1747
- task: /* @__PURE__ */ e(ae, { size: 16 }),
1748
- project: /* @__PURE__ */ e(rc, { size: 16 }),
1749
- setting: /* @__PURE__ */ e(Pe, { size: 16 }),
1750
- help: /* @__PURE__ */ e(Ue, { size: 16 }),
1751
- action: /* @__PURE__ */ e(je, { size: 16 }),
1752
- custom: /* @__PURE__ */ e(Ce, { size: 16 })
1753
- }, Bc = ({
1754
- value: i,
1755
- onChange: s,
1756
- onKeyDown: t,
1757
- placeholder: a,
1758
- isLoading: n,
1759
- inputRef: l
1760
- }) => /* @__PURE__ */ c("div", { className: "nice-search-input-container", children: [
1761
- /* @__PURE__ */ e("span", { className: "nice-search-icon", children: /* @__PURE__ */ e(pe, { size: 16 }) }),
1762
- /* @__PURE__ */ e(
1763
- "input",
1764
- {
1765
- ref: l,
1766
- type: "text",
1767
- className: "nice-search-input",
1768
- placeholder: a,
1769
- value: i,
1770
- onChange: (h) => s(h.target.value),
1771
- onKeyDown: t,
1772
- "aria-label": "Search"
1776
+ ] }), J = `nice-gdpr-consent nice-gdpr-consent--${w} nice-gdpr-consent--${_} ${ce}`;
1777
+ return w === "modal" ? /* @__PURE__ */ e("div", { className: "nice-gdpr-overlay", children: /* @__PURE__ */ e("div", { className: J, style: $, role: "dialog", "aria-modal": "true", children: A }) }) : /* @__PURE__ */ e("div", { className: J, style: $, children: A });
1773
1778
  }
1774
1779
  ),
1775
- n && /* @__PURE__ */ e("span", { className: "nice-search-loader" }),
1776
- i && !n && /* @__PURE__ */ e(
1777
- "button",
1778
- {
1779
- type: "button",
1780
- className: "nice-search-clear",
1781
- onClick: () => s(""),
1782
- "aria-label": "Clear search",
1783
- children: /* @__PURE__ */ e(ge, { size: 16 })
1784
- }
1785
- )
1786
- ] }), Hc = ({ result: i, isSelected: s, onSelect: t, renderResult: a }) => a ? /* @__PURE__ */ e("div", { onClick: t, children: a(i, s) }) : /* @__PURE__ */ c(
1780
+ { displayName: "NiceGDPRConsent" }
1781
+ ), Vc = [], Je = {
1782
+ document: /* @__PURE__ */ e(xe, { size: 16 }),
1783
+ user: /* @__PURE__ */ e(Be, { size: 16 }),
1784
+ task: /* @__PURE__ */ e(se, { size: 16 }),
1785
+ project: /* @__PURE__ */ e(hc, { size: 16 }),
1786
+ setting: /* @__PURE__ */ e($e, { size: 16 }),
1787
+ help: /* @__PURE__ */ e(Ve, { size: 16 }),
1788
+ action: /* @__PURE__ */ e(qe, { size: 16 }),
1789
+ custom: /* @__PURE__ */ e(De, { size: 16 })
1790
+ }, Bc = ({
1791
+ value: a,
1792
+ onChange: n,
1793
+ onKeyDown: s,
1794
+ placeholder: i,
1795
+ isLoading: t,
1796
+ inputRef: l
1797
+ }) => {
1798
+ const { t: h } = W();
1799
+ return /* @__PURE__ */ c("div", { className: "nice-search-input-container", children: [
1800
+ /* @__PURE__ */ e("span", { className: "nice-search-icon", children: /* @__PURE__ */ e(ge, { size: 16 }) }),
1801
+ /* @__PURE__ */ e(
1802
+ "input",
1803
+ {
1804
+ ref: l,
1805
+ type: "text",
1806
+ className: "nice-search-input",
1807
+ placeholder: i,
1808
+ value: a,
1809
+ onChange: (r) => n(r.target.value),
1810
+ onKeyDown: s,
1811
+ "aria-label": h("globalSearch.search", "Search")
1812
+ }
1813
+ ),
1814
+ t && /* @__PURE__ */ e("span", { className: "nice-search-loader" }),
1815
+ a && !t && /* @__PURE__ */ e(
1816
+ "button",
1817
+ {
1818
+ type: "button",
1819
+ className: "nice-search-clear",
1820
+ onClick: () => n(""),
1821
+ "aria-label": h("globalSearch.clearSearch", "Clear search"),
1822
+ children: /* @__PURE__ */ e(be, { size: 16 })
1823
+ }
1824
+ )
1825
+ ] });
1826
+ }, Hc = ({ result: a, isSelected: n, onSelect: s, renderResult: i }) => i ? /* @__PURE__ */ e("div", { onClick: s, children: i(a, n) }) : /* @__PURE__ */ c(
1787
1827
  "div",
1788
1828
  {
1789
- className: `nice-search-result ${s ? "nice-search-result--selected" : ""}`,
1790
- onClick: t,
1829
+ className: `nice-search-result ${n ? "nice-search-result--selected" : ""}`,
1830
+ onClick: s,
1791
1831
  role: "option",
1792
- "aria-selected": s,
1832
+ "aria-selected": n,
1793
1833
  children: [
1794
- /* @__PURE__ */ e("div", { className: "nice-search-result-icon", children: i.icon || (i.image ? /* @__PURE__ */ e("img", { src: i.image, alt: "" }) : Ve[i.type]) }),
1834
+ /* @__PURE__ */ e("div", { className: "nice-search-result-icon", children: a.icon || (a.image ? /* @__PURE__ */ e("img", { src: a.image, alt: "" }) : Je[a.type]) }),
1795
1835
  /* @__PURE__ */ c("div", { className: "nice-search-result-content", children: [
1796
- /* @__PURE__ */ e("span", { className: "nice-search-result-title", children: i.title }),
1797
- i.subtitle && /* @__PURE__ */ e("span", { className: "nice-search-result-subtitle", children: i.subtitle }),
1798
- i.description && /* @__PURE__ */ e("span", { className: "nice-search-result-desc", children: i.description })
1836
+ /* @__PURE__ */ e("span", { className: "nice-search-result-title", children: a.title }),
1837
+ a.subtitle && /* @__PURE__ */ e("span", { className: "nice-search-result-subtitle", children: a.subtitle }),
1838
+ a.description && /* @__PURE__ */ e("span", { className: "nice-search-result-desc", children: a.description })
1799
1839
  ] }),
1800
1840
  /* @__PURE__ */ c("div", { className: "nice-search-result-meta", children: [
1801
- /* @__PURE__ */ e("span", { className: "nice-search-result-source", children: i.source }),
1802
- /* @__PURE__ */ e("span", { className: "nice-search-result-type", children: i.type })
1841
+ /* @__PURE__ */ e("span", { className: "nice-search-result-source", children: a.source }),
1842
+ /* @__PURE__ */ e("span", { className: "nice-search-result-type", children: a.type })
1803
1843
  ] }),
1804
- i.actions && i.actions.length > 0 && /* @__PURE__ */ e("div", { className: "nice-search-result-actions", children: i.actions.map((n) => /* @__PURE__ */ e(
1844
+ a.actions && a.actions.length > 0 && /* @__PURE__ */ e("div", { className: "nice-search-result-actions", children: a.actions.map((t) => /* @__PURE__ */ e(
1805
1845
  "button",
1806
1846
  {
1807
1847
  type: "button",
1808
1848
  className: "nice-search-action-btn",
1809
1849
  onClick: (l) => {
1810
- l.stopPropagation(), n.onClick();
1850
+ l.stopPropagation(), t.onClick();
1811
1851
  },
1812
- title: n.label,
1813
- children: n.icon || n.label
1852
+ title: t.label,
1853
+ children: t.icon || t.label
1814
1854
  },
1815
- n.id
1855
+ t.id
1816
1856
  )) })
1817
1857
  ]
1818
1858
  }
1819
- ), Jc = ({ categories: i, selected: s, onSelect: t }) => /* @__PURE__ */ c("div", { className: "nice-search-categories", children: [
1859
+ ), Jc = ({ categories: a, selected: n, onSelect: s }) => /* @__PURE__ */ c("div", { className: "nice-search-categories", children: [
1820
1860
  /* @__PURE__ */ e(
1821
1861
  "button",
1822
1862
  {
1823
1863
  type: "button",
1824
- className: `nice-search-category ${s === null ? "nice-search-category--active" : ""}`,
1825
- onClick: () => t(null),
1864
+ className: `nice-search-category ${n === null ? "nice-search-category--active" : ""}`,
1865
+ onClick: () => s(null),
1826
1866
  children: "All"
1827
1867
  }
1828
1868
  ),
1829
- i.map((a) => /* @__PURE__ */ c(
1869
+ a.map((i) => /* @__PURE__ */ c(
1830
1870
  "button",
1831
1871
  {
1832
1872
  type: "button",
1833
- className: `nice-search-category ${s === a.id ? "nice-search-category--active" : ""}`,
1834
- onClick: () => t(a.id),
1873
+ className: `nice-search-category ${n === i.id ? "nice-search-category--active" : ""}`,
1874
+ onClick: () => s(i.id),
1835
1875
  children: [
1836
- a.icon && /* @__PURE__ */ e("span", { className: "nice-search-category-icon", children: a.icon }),
1837
- a.label,
1838
- a.count !== void 0 && /* @__PURE__ */ e("span", { className: "nice-search-category-count", children: a.count })
1876
+ i.icon && /* @__PURE__ */ e("span", { className: "nice-search-category-icon", children: i.icon }),
1877
+ i.label,
1878
+ i.count !== void 0 && /* @__PURE__ */ e("span", { className: "nice-search-category-count", children: i.count })
1839
1879
  ]
1840
1880
  },
1841
- a.id
1881
+ i.id
1842
1882
  ))
1843
1883
  ] }), Gc = ({
1844
- searches: i,
1845
- onSelect: s,
1846
- onClear: t,
1847
- label: a,
1848
- clearLabel: n
1884
+ searches: a,
1885
+ onSelect: n,
1886
+ onClear: s,
1887
+ label: i,
1888
+ clearLabel: t
1849
1889
  }) => /* @__PURE__ */ c("div", { className: "nice-search-recent", children: [
1850
1890
  /* @__PURE__ */ c("div", { className: "nice-search-recent-header", children: [
1851
- /* @__PURE__ */ e("span", { children: a }),
1852
- /* @__PURE__ */ e("button", { type: "button", onClick: t, children: n })
1891
+ /* @__PURE__ */ e("span", { children: i }),
1892
+ /* @__PURE__ */ e("button", { type: "button", onClick: s, children: t })
1853
1893
  ] }),
1854
- /* @__PURE__ */ e("div", { className: "nice-search-recent-list", children: i.map((l, h) => /* @__PURE__ */ c(
1894
+ /* @__PURE__ */ e("div", { className: "nice-search-recent-list", children: a.map((l, h) => /* @__PURE__ */ c(
1855
1895
  "button",
1856
1896
  {
1857
1897
  type: "button",
1858
1898
  className: "nice-search-recent-item",
1859
- onClick: () => s(l.query),
1899
+ onClick: () => n(l.query),
1860
1900
  children: [
1861
- /* @__PURE__ */ e("span", { className: "nice-search-recent-icon", children: /* @__PURE__ */ e(xe, { size: 14 }) }),
1901
+ /* @__PURE__ */ e("span", { className: "nice-search-recent-icon", children: /* @__PURE__ */ e(Le, { size: 14 }) }),
1862
1902
  /* @__PURE__ */ e("span", { className: "nice-search-recent-query", children: l.query })
1863
1903
  ]
1864
1904
  },
@@ -1872,250 +1912,254 @@ const Ve = {
1872
1912
  clearRecent: "Clear",
1873
1913
  categories: "Categories",
1874
1914
  filters: "Filters"
1875
- }, Wc = te(
1876
- ({
1877
- sources: i,
1878
- placeholder: s,
1879
- minQueryLength: t = 2,
1880
- debounceMs: a = 300,
1881
- showCategories: n = !0,
1882
- filters: l = [],
1883
- showRecent: h = !0,
1884
- maxRecent: r = 5,
1885
- showShortcuts: u = !0,
1886
- hotkey: T = "k",
1887
- onResultSelect: E,
1888
- onSearch: S,
1889
- onClose: y,
1890
- renderResult: J,
1891
- renderEmpty: _,
1892
- defaultOpen: K = !1,
1893
- open: O,
1894
- variant: M = "modal",
1895
- labels: j,
1896
- className: U = "",
1897
- style: B
1898
- }, m) => {
1899
- const k = { ...Kc, ...j }, g = ye(null), Y = ye(void 0), [p, P] = w(K), [A, I] = w(""), [C, q] = w([]), [v, x] = w(!1), [z, G] = w(0), [V, b] = w(null), [L, W] = w([]), F = O !== void 0 ? O : p;
1900
- ue(() => {
1901
- try {
1902
- const d = localStorage.getItem("nice_recent_searches");
1903
- d && W(JSON.parse(d));
1904
- } catch {
1905
- }
1906
- }, []);
1907
- const Q = $(
1908
- (d, f) => {
1909
- const ce = [{
1910
- query: d,
1911
- timestamp: /* @__PURE__ */ new Date(),
1912
- resultCount: f
1913
- }, ...L.filter((de) => de.query !== d)].slice(
1914
- 0,
1915
- r
1916
- );
1917
- W(ce);
1915
+ }, la = /* @__PURE__ */ Object.assign(
1916
+ /* @__PURE__ */ le(
1917
+ ({
1918
+ sources: a = Vc,
1919
+ placeholder: n,
1920
+ minQueryLength: s = 2,
1921
+ debounceMs: i = 300,
1922
+ showCategories: t = !0,
1923
+ filters: l = [],
1924
+ showRecent: h = !0,
1925
+ maxRecent: r = 5,
1926
+ showShortcuts: o = !0,
1927
+ hotkey: w = "k",
1928
+ onResultSelect: _,
1929
+ onSearch: I,
1930
+ onClose: C,
1931
+ renderResult: z,
1932
+ renderEmpty: F,
1933
+ defaultOpen: U = !1,
1934
+ open: L,
1935
+ variant: Y = "modal",
1936
+ labels: ce,
1937
+ className: $ = "",
1938
+ style: q
1939
+ }, E) => {
1940
+ const { t: m } = W(), N = { ...Kc, ...ce }, g = ke(null), V = ke(void 0), [u, B] = k(U), [O, P] = k(""), [x, H] = k([]), [j, b] = k(!1), [S, A] = k(0), [J, f] = k(null), [T, X] = k([]), Z = L !== void 0 ? L : u;
1941
+ me(() => {
1918
1942
  try {
1919
- localStorage.setItem("nice_recent_searches", JSON.stringify(ce));
1943
+ const p = localStorage.getItem("nice_recent_searches");
1944
+ p && X(JSON.parse(p));
1920
1945
  } catch {
1921
1946
  }
1922
- },
1923
- [L, r]
1924
- ), N = $(
1925
- async (d) => {
1926
- if (d.length < t) {
1927
- q([]);
1928
- return;
1929
- }
1930
- x(!0);
1931
- try {
1932
- const f = i.map(async (ce) => {
1933
- try {
1934
- return (await ce.search(d)).map((ze) => ({
1935
- ...ze,
1936
- source: ce.name,
1937
- relevanceScore: ze.relevanceScore * (ce.priority || 1)
1938
- }));
1939
- } catch {
1940
- return [];
1941
- }
1942
- }), Z = (await Promise.all(f)).flat();
1943
- Z.sort((ce, de) => de.relevanceScore - ce.relevanceScore), q(Z), G(0), S == null || S(d, Z), Z.length > 0 && Q(d, Z.length);
1944
- } finally {
1945
- x(!1);
1946
- }
1947
- },
1948
- [i, t, S, Q]
1949
- ), D = $(
1950
- (d) => {
1951
- I(d), Y.current && clearTimeout(Y.current), Y.current = setTimeout(() => {
1952
- N(d);
1953
- }, a);
1954
- },
1955
- [N, a]
1956
- ), R = $(
1957
- (d) => {
1958
- switch (d.key) {
1959
- case "ArrowDown":
1960
- d.preventDefault(), G((f) => Math.min(f + 1, C.length - 1));
1961
- break;
1962
- case "ArrowUp":
1963
- d.preventDefault(), G((f) => Math.max(f - 1, 0));
1964
- break;
1965
- case "Enter":
1966
- d.preventDefault(), C[z] && (E == null || E(C[z]), P(!1), y == null || y());
1967
- break;
1968
- case "Escape":
1969
- d.preventDefault(), P(!1), y == null || y();
1970
- break;
1971
- }
1972
- },
1973
- [C, z, E, y]
1974
- );
1975
- ue(() => {
1976
- const d = (f) => {
1977
- (f.metaKey || f.ctrlKey) && f.key === T && (f.preventDefault(), P(!0), setTimeout(() => {
1978
- var Z;
1979
- return (Z = g.current) == null ? void 0 : Z.focus();
1980
- }, 0));
1981
- };
1982
- return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
1983
- }, [T]), ue(() => {
1984
- F && setTimeout(() => {
1985
- var d;
1986
- return (d = g.current) == null ? void 0 : d.focus();
1987
- }, 0);
1988
- }, [F]);
1989
- const H = V ? C.filter((d) => d.type === V) : C, X = Array.from(new Set(C.map((d) => d.type))).map(
1990
- (d) => ({
1991
- id: d,
1992
- label: d.charAt(0).toUpperCase() + d.slice(1),
1993
- icon: Ve[d],
1994
- count: C.filter((f) => f.type === d).length
1995
- })
1996
- );
1997
- if (ne(m, () => ({
1998
- open: () => P(!0),
1999
- close: () => {
2000
- P(!1), y == null || y();
2001
- },
2002
- focus: () => {
2003
- var d;
2004
- return (d = g.current) == null ? void 0 : d.focus();
2005
- },
2006
- clear: () => {
2007
- I(""), q([]);
2008
- },
2009
- search: async (d) => {
2010
- I(d), await N(d);
2011
- }
2012
- })), !F && M !== "inline")
2013
- return null;
2014
- const o = /* @__PURE__ */ c("div", { className: "nice-search-content", children: [
2015
- /* @__PURE__ */ e(
2016
- Bc,
2017
- {
2018
- value: A,
2019
- onChange: D,
2020
- onKeyDown: R,
2021
- placeholder: s || k.placeholder,
2022
- isLoading: v,
2023
- inputRef: g
2024
- }
2025
- ),
2026
- n && X.length > 1 && A.length >= t && /* @__PURE__ */ e(
2027
- Jc,
2028
- {
2029
- categories: X,
2030
- selected: V,
2031
- onSelect: b
1947
+ }, []);
1948
+ const G = R(
1949
+ (p, y) => {
1950
+ const te = [
1951
+ {
1952
+ query: p,
1953
+ timestamp: /* @__PURE__ */ new Date(),
1954
+ resultCount: y
1955
+ },
1956
+ ...T.filter((pe) => pe.query !== p)
1957
+ ].slice(0, r);
1958
+ X(te);
1959
+ try {
1960
+ localStorage.setItem("nice_recent_searches", JSON.stringify(te));
1961
+ } catch {
1962
+ }
1963
+ },
1964
+ [T, r]
1965
+ ), v = R(
1966
+ async (p) => {
1967
+ if (p.length < s) {
1968
+ H([]);
1969
+ return;
1970
+ }
1971
+ b(!0);
1972
+ try {
1973
+ const y = a.map(async (te) => {
1974
+ try {
1975
+ return (await te.search(p)).map((ze) => ({
1976
+ ...ze,
1977
+ source: te.name,
1978
+ relevanceScore: ze.relevanceScore * (te.priority || 1)
1979
+ }));
1980
+ } catch {
1981
+ return [];
1982
+ }
1983
+ }), ee = (await Promise.all(y)).flat();
1984
+ ee.sort((te, pe) => pe.relevanceScore - te.relevanceScore), H(ee), A(0), I == null || I(p, ee), ee.length > 0 && G(p, ee.length);
1985
+ } finally {
1986
+ b(!1);
1987
+ }
1988
+ },
1989
+ [a, s, I, G]
1990
+ ), D = R(
1991
+ (p) => {
1992
+ P(p), V.current && clearTimeout(V.current), V.current = setTimeout(() => {
1993
+ v(p);
1994
+ }, i);
1995
+ },
1996
+ [v, i]
1997
+ ), M = R(
1998
+ (p) => {
1999
+ switch (p.key) {
2000
+ case "ArrowDown":
2001
+ p.preventDefault(), A((y) => Math.min(y + 1, x.length - 1));
2002
+ break;
2003
+ case "ArrowUp":
2004
+ p.preventDefault(), A((y) => Math.max(y - 1, 0));
2005
+ break;
2006
+ case "Enter":
2007
+ p.preventDefault(), x[S] && (_ == null || _(x[S]), B(!1), C == null || C());
2008
+ break;
2009
+ case "Escape":
2010
+ p.preventDefault(), B(!1), C == null || C();
2011
+ break;
2012
+ }
2013
+ },
2014
+ [x, S, _, C]
2015
+ );
2016
+ me(() => {
2017
+ const p = (y) => {
2018
+ (y.metaKey || y.ctrlKey) && y.key === w && (y.preventDefault(), B(!0), setTimeout(() => {
2019
+ var ee;
2020
+ return (ee = g.current) == null ? void 0 : ee.focus();
2021
+ }, 0));
2022
+ };
2023
+ return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
2024
+ }, [w]), me(() => {
2025
+ Z && setTimeout(() => {
2026
+ var p;
2027
+ return (p = g.current) == null ? void 0 : p.focus();
2028
+ }, 0);
2029
+ }, [Z]);
2030
+ const K = J ? x.filter((p) => p.type === J) : x, Q = Array.from(new Set(x.map((p) => p.type))).map(
2031
+ (p) => ({
2032
+ id: p,
2033
+ label: p.charAt(0).toUpperCase() + p.slice(1),
2034
+ icon: Je[p],
2035
+ count: x.filter((y) => y.type === p).length
2036
+ })
2037
+ );
2038
+ if (re(E, () => ({
2039
+ open: () => B(!0),
2040
+ close: () => {
2041
+ B(!1), C == null || C();
2042
+ },
2043
+ focus: () => {
2044
+ var p;
2045
+ return (p = g.current) == null ? void 0 : p.focus();
2046
+ },
2047
+ clear: () => {
2048
+ P(""), H([]);
2049
+ },
2050
+ search: async (p) => {
2051
+ P(p), await v(p);
2032
2052
  }
2033
- ),
2034
- /* @__PURE__ */ c("div", { className: "nice-search-results", role: "listbox", children: [
2035
- v && A.length >= t && /* @__PURE__ */ e("div", { className: "nice-search-loading", children: k.searching }),
2036
- !v && A.length >= t && H.length === 0 && /* @__PURE__ */ e("div", { className: "nice-search-empty", children: _ ? _(A) : /* @__PURE__ */ c(ee, { children: [
2037
- /* @__PURE__ */ e("span", { className: "nice-search-empty-icon", children: /* @__PURE__ */ e(pe, { size: 32 }) }),
2038
- /* @__PURE__ */ c("span", { children: [
2039
- k.noResults,
2040
- ' "',
2041
- A,
2042
- '"'
2043
- ] })
2044
- ] }) }),
2045
- H.map((d, f) => /* @__PURE__ */ e(
2046
- Hc,
2053
+ })), !Z && Y !== "inline")
2054
+ return null;
2055
+ const d = /* @__PURE__ */ c("div", { className: "nice-search-content", children: [
2056
+ /* @__PURE__ */ e(
2057
+ Bc,
2058
+ {
2059
+ value: O,
2060
+ onChange: D,
2061
+ onKeyDown: M,
2062
+ placeholder: n || N.placeholder,
2063
+ isLoading: j,
2064
+ inputRef: g
2065
+ }
2066
+ ),
2067
+ t && Q.length > 1 && O.length >= s && /* @__PURE__ */ e(
2068
+ Jc,
2047
2069
  {
2048
- result: d,
2049
- isSelected: f === z,
2050
- onSelect: () => {
2051
- E == null || E(d), P(!1), y == null || y();
2070
+ categories: Q,
2071
+ selected: J,
2072
+ onSelect: f
2073
+ }
2074
+ ),
2075
+ /* @__PURE__ */ c("div", { className: "nice-search-results", role: "listbox", children: [
2076
+ j && O.length >= s && /* @__PURE__ */ e("div", { className: "nice-search-loading", children: N.searching }),
2077
+ !j && O.length >= s && K.length === 0 && /* @__PURE__ */ e("div", { className: "nice-search-empty", children: F ? F(O) : /* @__PURE__ */ c(ae, { children: [
2078
+ /* @__PURE__ */ e("span", { className: "nice-search-empty-icon", children: /* @__PURE__ */ e(ge, { size: 32 }) }),
2079
+ /* @__PURE__ */ c("span", { children: [
2080
+ N.noResults,
2081
+ ' "',
2082
+ O,
2083
+ '"'
2084
+ ] })
2085
+ ] }) }),
2086
+ K.map((p, y) => /* @__PURE__ */ e(
2087
+ Hc,
2088
+ {
2089
+ result: p,
2090
+ isSelected: y === S,
2091
+ onSelect: () => {
2092
+ _ == null || _(p), B(!1), C == null || C();
2093
+ },
2094
+ renderResult: z
2052
2095
  },
2053
- renderResult: J
2054
- },
2055
- d.id
2056
- ))
2057
- ] }),
2058
- h && A.length < t && L.length > 0 && /* @__PURE__ */ e(
2059
- Gc,
2060
- {
2061
- searches: L,
2062
- onSelect: (d) => {
2063
- I(d), N(d);
2064
- },
2065
- onClear: () => {
2066
- W([]), localStorage.removeItem("nice_recent_searches");
2067
- },
2068
- label: k.recent,
2069
- clearLabel: k.clearRecent
2070
- }
2071
- ),
2072
- u && /* @__PURE__ */ c("div", { className: "nice-search-shortcuts", children: [
2073
- /* @__PURE__ */ c("span", { children: [
2074
- /* @__PURE__ */ e("kbd", { children: "↑" }),
2075
- /* @__PURE__ */ e("kbd", { children: "↓" }),
2076
- " Navigate"
2077
- ] }),
2078
- /* @__PURE__ */ c("span", { children: [
2079
- /* @__PURE__ */ e("kbd", { children: "↵" }),
2080
- " Select"
2096
+ p.id
2097
+ ))
2081
2098
  ] }),
2082
- /* @__PURE__ */ c("span", { children: [
2083
- /* @__PURE__ */ e("kbd", { children: "Esc" }),
2084
- " Close"
2085
- ] })
2086
- ] })
2087
- ] });
2088
- return M === "modal" ? /* @__PURE__ */ e(
2089
- "div",
2090
- {
2091
- className: "nice-search-overlay",
2092
- onClick: () => {
2093
- P(!1), y == null || y();
2094
- },
2095
- children: /* @__PURE__ */ e(
2096
- "div",
2099
+ h && O.length < s && T.length > 0 && /* @__PURE__ */ e(
2100
+ Gc,
2097
2101
  {
2098
- className: `nice-global-search nice-global-search--modal ${U}`,
2099
- style: B,
2100
- onClick: (d) => d.stopPropagation(),
2101
- role: "dialog",
2102
- "aria-modal": "true",
2103
- children: o
2102
+ searches: T,
2103
+ onSelect: (p) => {
2104
+ P(p), v(p);
2105
+ },
2106
+ onClear: () => {
2107
+ X([]), localStorage.removeItem("nice_recent_searches");
2108
+ },
2109
+ label: N.recent,
2110
+ clearLabel: N.clearRecent
2104
2111
  }
2105
- )
2106
- }
2107
- ) : /* @__PURE__ */ e(
2108
- "div",
2109
- {
2110
- className: `nice-global-search nice-global-search--${M} ${U}`,
2111
- style: B,
2112
- children: o
2113
- }
2114
- );
2115
- }
2116
- );
2117
- Wc.displayName = "NiceGlobalSearch";
2118
- const le = {
2112
+ ),
2113
+ o && /* @__PURE__ */ c("div", { className: "nice-search-shortcuts", children: [
2114
+ /* @__PURE__ */ c("span", { children: [
2115
+ /* @__PURE__ */ e("kbd", { children: /* @__PURE__ */ e(_e, { name: "arrow-up", size: 12 }) }),
2116
+ /* @__PURE__ */ e("kbd", { children: /* @__PURE__ */ e(_e, { name: "arrow-down", size: 12 }) }),
2117
+ " ",
2118
+ m("globalSearch.navigate", "Navigate")
2119
+ ] }),
2120
+ /* @__PURE__ */ c("span", { children: [
2121
+ /* @__PURE__ */ e("kbd", { children: "↵" }),
2122
+ " ",
2123
+ m("globalSearch.select", "Select")
2124
+ ] }),
2125
+ /* @__PURE__ */ c("span", { children: [
2126
+ /* @__PURE__ */ e("kbd", { children: "Esc" }),
2127
+ " ",
2128
+ m("globalSearch.close", "Close")
2129
+ ] })
2130
+ ] })
2131
+ ] });
2132
+ return Y === "modal" ? /* @__PURE__ */ e(
2133
+ "div",
2134
+ {
2135
+ className: "nice-search-overlay",
2136
+ onClick: () => {
2137
+ B(!1), C == null || C();
2138
+ },
2139
+ children: /* @__PURE__ */ e(
2140
+ "div",
2141
+ {
2142
+ className: `nice-global-search nice-global-search--modal ${$}`,
2143
+ style: q,
2144
+ onClick: (p) => p.stopPropagation(),
2145
+ role: "dialog",
2146
+ "aria-modal": "true",
2147
+ children: d
2148
+ }
2149
+ )
2150
+ }
2151
+ ) : /* @__PURE__ */ e(
2152
+ "div",
2153
+ {
2154
+ className: `nice-global-search nice-global-search--${Y} ${$}`,
2155
+ style: q,
2156
+ children: d
2157
+ }
2158
+ );
2159
+ }
2160
+ ),
2161
+ { displayName: "NiceGlobalSearch" }
2162
+ ), Wc = [], oe = {
2119
2163
  title: "Access Log",
2120
2164
  filters: "Filters",
2121
2165
  search: "Search users, IPs...",
@@ -2167,619 +2211,647 @@ const le = {
2167
2211
  risk: "Risk",
2168
2212
  status: "Status"
2169
2213
  }
2170
- }, ve = {
2171
- login_success: /* @__PURE__ */ e(ae, { size: 16 }),
2172
- login_failed: /* @__PURE__ */ e(oe, { size: 16 }),
2173
- logout: /* @__PURE__ */ e(Re, { size: 16 }),
2174
- password_change: /* @__PURE__ */ e(be, { size: 16 }),
2175
- password_reset: /* @__PURE__ */ e(Ne, { size: 16 }),
2176
- mfa_enabled: /* @__PURE__ */ e(qe, { size: 16 }),
2177
- mfa_disabled: /* @__PURE__ */ e(Me, { size: 16 }),
2178
- mfa_challenged: /* @__PURE__ */ e(fe, { size: 16 }),
2179
- permission_change: /* @__PURE__ */ e(Ye, { size: 16 }),
2180
- session_expired: /* @__PURE__ */ e(xe, { size: 16 }),
2181
- account_locked: /* @__PURE__ */ e(Ee, { size: 16 }),
2182
- account_unlocked: /* @__PURE__ */ e(mc, { size: 16 }),
2183
- api_key_created: /* @__PURE__ */ e(be, { size: 16 }),
2184
- api_key_revoked: /* @__PURE__ */ e(oe, { size: 16 }),
2185
- token_refresh: /* @__PURE__ */ e(Ne, { size: 16 }),
2186
- suspicious_activity: /* @__PURE__ */ e(je, { size: 16 })
2187
- }, re = {
2214
+ }, Ne = {
2215
+ login_success: /* @__PURE__ */ e(se, { size: 16 }),
2216
+ login_failed: /* @__PURE__ */ e(he, { size: 16 }),
2217
+ logout: /* @__PURE__ */ e(Me, { size: 16 }),
2218
+ password_change: /* @__PURE__ */ e(fe, { size: 16 }),
2219
+ password_reset: /* @__PURE__ */ e(ye, { size: 16 }),
2220
+ mfa_enabled: /* @__PURE__ */ e(He, { size: 16 }),
2221
+ mfa_disabled: /* @__PURE__ */ e(Ye, { size: 16 }),
2222
+ mfa_challenged: /* @__PURE__ */ e(we, { size: 16 }),
2223
+ permission_change: /* @__PURE__ */ e(Be, { size: 16 }),
2224
+ session_expired: /* @__PURE__ */ e(Le, { size: 16 }),
2225
+ account_locked: /* @__PURE__ */ e(Ue, { size: 16 }),
2226
+ account_unlocked: /* @__PURE__ */ e(bc, { size: 16 }),
2227
+ api_key_created: /* @__PURE__ */ e(fe, { size: 16 }),
2228
+ api_key_revoked: /* @__PURE__ */ e(he, { size: 16 }),
2229
+ token_refresh: /* @__PURE__ */ e(ye, { size: 16 }),
2230
+ suspicious_activity: /* @__PURE__ */ e(qe, { size: 16 })
2231
+ }, de = {
2188
2232
  low: "var(--nice-color-success, #22c55e)",
2189
2233
  medium: "var(--nice-color-warning, #f59e0b)",
2190
2234
  high: "var(--nice-color-error, #ef4444)",
2191
2235
  critical: "var(--nice-color-accent-hover, #7c3aed)"
2192
- }, _e = {
2193
- desktop: /* @__PURE__ */ e(gc, { size: 16 }),
2194
- mobile: /* @__PURE__ */ e(fe, { size: 16 }),
2195
- tablet: /* @__PURE__ */ e(fe, { size: 16 }),
2196
- unknown: /* @__PURE__ */ e(Ue, { size: 16 })
2197
- }, Le = (i) => (typeof i == "string" ? new Date(i) : i).toLocaleString("en-US", {
2236
+ }, Ae = {
2237
+ desktop: /* @__PURE__ */ e(Nc, { size: 16 }),
2238
+ mobile: /* @__PURE__ */ e(we, { size: 16 }),
2239
+ tablet: /* @__PURE__ */ e(we, { size: 16 }),
2240
+ unknown: /* @__PURE__ */ e(Ve, { size: 16 })
2241
+ }, Ie = (a) => (typeof a == "string" ? new Date(a) : a).toLocaleString("en-US", {
2198
2242
  month: "short",
2199
2243
  day: "numeric",
2200
2244
  hour: "2-digit",
2201
2245
  minute: "2-digit",
2202
2246
  second: "2-digit"
2203
- }), Ae = (i) => {
2204
- if (!i)
2247
+ }), Oe = (a) => {
2248
+ if (!a)
2205
2249
  return "Unknown";
2206
- const s = [];
2207
- return i.city && s.push(i.city), i.country && s.push(i.country), s.length > 0 ? s.join(", ") : "Unknown";
2208
- }, Xc = (i) => {
2209
- if (!i)
2250
+ const n = [];
2251
+ return a.city && n.push(a.city), a.country && n.push(a.country), n.length > 0 ? n.join(", ") : "Unknown";
2252
+ }, Xc = (a) => {
2253
+ if (!a)
2210
2254
  return "Unknown";
2211
- const s = [];
2212
- return i.browser && s.push(i.browser), i.os && s.push(i.os), s.length > 0 ? s.join(" / ") : i.type;
2213
- }, Ie = (i) => i >= 80 ? re.critical : i >= 60 ? re.high : i >= 40 ? re.medium : re.low, Zc = (i, s) => {
2214
- var t, a, n, l, h;
2215
- if (s.startDate) {
2216
- const r = typeof s.startDate == "string" ? new Date(s.startDate) : s.startDate;
2217
- if ((typeof i.timestamp == "string" ? new Date(i.timestamp) : i.timestamp) < r)
2255
+ const n = [];
2256
+ return a.browser && n.push(a.browser), a.os && n.push(a.os), n.length > 0 ? n.join(" / ") : a.type;
2257
+ }, Pe = (a) => a >= 80 ? de.critical : a >= 60 ? de.high : a >= 40 ? de.medium : de.low, Zc = (a, n) => {
2258
+ var s, i, t, l, h;
2259
+ if (n.startDate) {
2260
+ const r = typeof n.startDate == "string" ? new Date(n.startDate) : n.startDate;
2261
+ if ((typeof a.timestamp == "string" ? new Date(a.timestamp) : a.timestamp) < r)
2218
2262
  return !1;
2219
2263
  }
2220
- if (s.endDate) {
2221
- const r = typeof s.endDate == "string" ? new Date(s.endDate) : s.endDate;
2222
- if ((typeof i.timestamp == "string" ? new Date(i.timestamp) : i.timestamp) > r)
2264
+ if (n.endDate) {
2265
+ const r = typeof n.endDate == "string" ? new Date(n.endDate) : n.endDate;
2266
+ if ((typeof a.timestamp == "string" ? new Date(a.timestamp) : a.timestamp) > r)
2223
2267
  return !1;
2224
2268
  }
2225
- if ((t = s.eventTypes) != null && t.length && !s.eventTypes.includes(i.eventType) || (a = s.riskLevels) != null && a.length && !s.riskLevels.includes(i.riskLevel) || s.userId && i.userId !== s.userId || s.ipAddress && !i.ipAddress.includes(s.ipAddress) || s.country && ((n = i.location) == null ? void 0 : n.country) !== s.country || s.successOnly && !i.success || s.failedOnly && i.success)
2269
+ if ((s = n.eventTypes) != null && s.length && !n.eventTypes.includes(a.eventType) || (i = n.riskLevels) != null && i.length && !n.riskLevels.includes(a.riskLevel) || n.userId && a.userId !== n.userId || n.ipAddress && !a.ipAddress.includes(n.ipAddress) || n.country && ((t = a.location) == null ? void 0 : t.country) !== n.country || n.successOnly && !a.success || n.failedOnly && a.success)
2226
2270
  return !1;
2227
- if (s.searchQuery) {
2228
- const r = s.searchQuery.toLowerCase();
2271
+ if (n.searchQuery) {
2272
+ const r = n.searchQuery.toLowerCase();
2229
2273
  if (![
2230
- i.userName,
2231
- i.userEmail,
2232
- i.userId,
2233
- i.ipAddress,
2234
- (l = i.location) == null ? void 0 : l.city,
2235
- (h = i.location) == null ? void 0 : h.country
2274
+ a.userName,
2275
+ a.userEmail,
2276
+ a.userId,
2277
+ a.ipAddress,
2278
+ (l = a.location) == null ? void 0 : l.city,
2279
+ (h = a.location) == null ? void 0 : h.country
2236
2280
  ].filter(Boolean).join(" ").toLowerCase().includes(r))
2237
2281
  return !1;
2238
2282
  }
2239
2283
  return !0;
2240
- }, Qc = te(
2241
- function(s, t) {
2242
- var H, X;
2243
- const {
2244
- entries: a,
2245
- filter: n = {},
2246
- stats: l,
2247
- realtime: h = !1,
2248
- pollingInterval: r = 3e4,
2249
- showMap: u = !1,
2250
- showStats: T = !0,
2251
- showDetails: E = !0,
2252
- pageSize: S = 50,
2253
- labels: y,
2254
- loading: J = !1,
2255
- onFilterChange: _,
2256
- onExport: K,
2257
- onEntrySelect: O,
2258
- onBlockIP: M,
2259
- onRefresh: j,
2260
- className: U = "",
2261
- ...B
2262
- } = s, m = ye(null);
2263
- bc();
2264
- const k = he(
2265
- () => ({
2266
- ...le,
2267
- ...y,
2268
- eventTypes: { ...le.eventTypes, ...y == null ? void 0 : y.eventTypes },
2269
- riskLevels: { ...le.riskLevels, ...y == null ? void 0 : y.riskLevels },
2270
- deviceTypes: { ...le.deviceTypes, ...y == null ? void 0 : y.deviceTypes },
2271
- columns: { ...le.columns, ...y == null ? void 0 : y.columns }
2272
- }),
2273
- [y]
2274
- ), [g, Y] = w(n), [p, P] = w(null), [A, I] = w(S), [C, q] = w(!1), [v, x] = w("table"), z = he(() => a.filter((o) => Zc(o, g)), [a, g]), G = he(() => z.slice(0, A), [z, A]), V = he(() => {
2275
- if (l)
2276
- return l;
2277
- const o = new Set(a.map((f) => f.ipAddress)), d = new Set(a.map((f) => {
2278
- var Z;
2279
- return (Z = f.location) == null ? void 0 : Z.country;
2280
- }).filter(Boolean));
2281
- return {
2282
- totalEvents: a.length,
2283
- successfulLogins: a.filter((f) => f.eventType === "login_success").length,
2284
- failedLogins: a.filter((f) => f.eventType === "login_failed").length,
2285
- uniqueIPs: o.size,
2286
- uniqueCountries: d.size,
2287
- highRiskEvents: a.filter((f) => f.riskLevel === "high" || f.riskLevel === "critical").length,
2288
- suspiciousActivities: a.filter((f) => f.eventType === "suspicious_activity").length
2289
- };
2290
- }, [a, l]), b = $(
2291
- (o) => {
2292
- const d = { ...g, ...o };
2293
- Y(d), I(S), _ == null || _(d);
2294
- },
2295
- [g, _, S]
2296
- ), L = $(() => {
2297
- Y({}), I(S), _ == null || _({});
2298
- }, [_, S]), W = $(
2299
- (o) => {
2300
- P(o), O == null || O(o);
2301
- },
2302
- [O]
2303
- ), F = $(
2304
- (o) => {
2305
- K == null || K(o);
2306
- },
2307
- [K]
2308
- ), Q = $(() => {
2309
- j == null || j();
2310
- }, [j]), N = $(() => {
2311
- I((o) => o + S);
2312
- }, [S]);
2313
- ne(
2314
- t,
2315
- () => ({
2316
- getFilter: () => g,
2317
- applyFilter: b,
2318
- clearFilters: L,
2319
- export: F,
2320
- refresh: Q,
2321
- getSelectedEntry: () => p,
2322
- getElement: () => m.current
2323
- }),
2324
- [g, b, L, F, Q, p]
2325
- );
2326
- const D = (o) => {
2327
- var d, f;
2328
- return /* @__PURE__ */ c(
2329
- "tr",
2330
- {
2331
- className: `nice-accesslog-row ${(p == null ? void 0 : p.id) === o.id ? "nice-accesslog-row--selected" : ""} ${o.success ? "" : "nice-accesslog-row--failed"}`,
2332
- onClick: () => W(o),
2333
- children: [
2334
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--timestamp", children: Le(o.timestamp) }),
2335
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--user", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-user", children: [
2336
- /* @__PURE__ */ e("span", { className: "nice-accesslog-username", children: o.userName || o.userId }),
2337
- o.userEmail && /* @__PURE__ */ e("span", { className: "nice-accesslog-email", children: o.userEmail })
2338
- ] }) }),
2339
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--event", children: /* @__PURE__ */ c("span", { className: `nice-accesslog-event nice-accesslog-event--${o.eventType}`, children: [
2340
- /* @__PURE__ */ e("span", { className: "nice-accesslog-event-icon", children: ve[o.eventType] }),
2341
- k.eventTypes[o.eventType]
2342
- ] }) }),
2343
- /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--ip", children: [
2344
- /* @__PURE__ */ e("span", { className: "nice-accesslog-ip", children: o.ipAddress }),
2345
- M && /* @__PURE__ */ e(
2346
- "button",
2284
+ }, ra = /* @__PURE__ */ Object.assign(
2285
+ /* @__PURE__ */ le(
2286
+ function(n, s) {
2287
+ var K, Q;
2288
+ const { t: i } = W(), {
2289
+ entries: t = Wc,
2290
+ filter: l = {},
2291
+ stats: h,
2292
+ realtime: r = !1,
2293
+ pollingInterval: o = 3e4,
2294
+ showMap: w = !1,
2295
+ showStats: _ = !0,
2296
+ showDetails: I = !0,
2297
+ pageSize: C = 50,
2298
+ labels: z,
2299
+ loading: F = !1,
2300
+ onFilterChange: U,
2301
+ onExport: L,
2302
+ onEntrySelect: Y,
2303
+ onBlockIP: ce,
2304
+ onRefresh: $,
2305
+ className: q = "",
2306
+ ...E
2307
+ } = n, m = ke(null);
2308
+ Cc();
2309
+ const N = ue(
2310
+ () => ({
2311
+ ...oe,
2312
+ ...z,
2313
+ eventTypes: { ...oe.eventTypes, ...z == null ? void 0 : z.eventTypes },
2314
+ riskLevels: { ...oe.riskLevels, ...z == null ? void 0 : z.riskLevels },
2315
+ deviceTypes: { ...oe.deviceTypes, ...z == null ? void 0 : z.deviceTypes },
2316
+ columns: { ...oe.columns, ...z == null ? void 0 : z.columns }
2317
+ }),
2318
+ [z]
2319
+ ), [g, V] = k(l), [u, B] = k(null), [O, P] = k(C), [x, H] = k(!1), [j, b] = k("table"), S = ue(() => t.filter((d) => Zc(d, g)), [t, g]), A = ue(() => S.slice(0, O), [S, O]), J = ue(() => {
2320
+ if (h)
2321
+ return h;
2322
+ const d = new Set(t.map((y) => y.ipAddress)), p = new Set(t.map((y) => {
2323
+ var ee;
2324
+ return (ee = y.location) == null ? void 0 : ee.country;
2325
+ }).filter(Boolean));
2326
+ return {
2327
+ totalEvents: t.length,
2328
+ successfulLogins: t.filter((y) => y.eventType === "login_success").length,
2329
+ failedLogins: t.filter((y) => y.eventType === "login_failed").length,
2330
+ uniqueIPs: d.size,
2331
+ uniqueCountries: p.size,
2332
+ highRiskEvents: t.filter(
2333
+ (y) => y.riskLevel === "high" || y.riskLevel === "critical"
2334
+ ).length,
2335
+ suspiciousActivities: t.filter((y) => y.eventType === "suspicious_activity").length
2336
+ };
2337
+ }, [t, h]), f = R(
2338
+ (d) => {
2339
+ const p = { ...g, ...d };
2340
+ V(p), P(C), U == null || U(p);
2341
+ },
2342
+ [g, U, C]
2343
+ ), T = R(() => {
2344
+ V({}), P(C), U == null || U({});
2345
+ }, [U, C]), X = R(
2346
+ (d) => {
2347
+ B(d), Y == null || Y(d);
2348
+ },
2349
+ [Y]
2350
+ ), Z = R(
2351
+ (d) => {
2352
+ L == null || L(d);
2353
+ },
2354
+ [L]
2355
+ ), G = R(() => {
2356
+ $ == null || $();
2357
+ }, [$]), v = R(() => {
2358
+ P((d) => d + C);
2359
+ }, [C]);
2360
+ re(
2361
+ s,
2362
+ () => ({
2363
+ getFilter: () => g,
2364
+ applyFilter: f,
2365
+ clearFilters: T,
2366
+ export: Z,
2367
+ refresh: G,
2368
+ getSelectedEntry: () => u,
2369
+ getElement: () => m.current
2370
+ }),
2371
+ [g, f, T, Z, G, u]
2372
+ );
2373
+ const D = (d) => {
2374
+ var p, y;
2375
+ return /* @__PURE__ */ c(
2376
+ "tr",
2377
+ {
2378
+ className: `nice-accesslog-row ${(u == null ? void 0 : u.id) === d.id ? "nice-accesslog-row--selected" : ""} ${d.success ? "" : "nice-accesslog-row--failed"}`,
2379
+ onClick: () => X(d),
2380
+ children: [
2381
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--timestamp", children: Ie(d.timestamp) }),
2382
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--user", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-user", children: [
2383
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-username", children: d.userName || d.userId }),
2384
+ d.userEmail && /* @__PURE__ */ e("span", { className: "nice-accesslog-email", children: d.userEmail })
2385
+ ] }) }),
2386
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--event", children: /* @__PURE__ */ c("span", { className: `nice-accesslog-event nice-accesslog-event--${d.eventType}`, children: [
2387
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-event-icon", children: Ne[d.eventType] }),
2388
+ N.eventTypes[d.eventType]
2389
+ ] }) }),
2390
+ /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--ip", children: [
2391
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-ip", children: d.ipAddress }),
2392
+ ce && /* @__PURE__ */ e(
2393
+ "button",
2394
+ {
2395
+ type: "button",
2396
+ className: "nice-accesslog-block-btn",
2397
+ onClick: (ee) => {
2398
+ ee.stopPropagation(), ce(d.ipAddress);
2399
+ },
2400
+ title: i("accessLog.blockIp", "Block IP"),
2401
+ children: /* @__PURE__ */ e(gc, { size: 14 })
2402
+ }
2403
+ )
2404
+ ] }),
2405
+ /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--location", children: [
2406
+ ((p = d.location) == null ? void 0 : p.countryCode) && /* @__PURE__ */ e("span", { className: "nice-accesslog-flag", children: /* @__PURE__ */ e(vc, { size: 14 }) }),
2407
+ Oe(d.location)
2408
+ ] }),
2409
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--device", children: /* @__PURE__ */ c("span", { className: "nice-accesslog-device", children: [
2410
+ Ae[((y = d.device) == null ? void 0 : y.type) || "unknown"],
2411
+ Xc(d.device)
2412
+ ] }) }),
2413
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--risk", children: /* @__PURE__ */ c(
2414
+ "span",
2347
2415
  {
2348
- type: "button",
2349
- className: "nice-accesslog-block-btn",
2350
- onClick: (Z) => {
2351
- Z.stopPropagation(), M(o.ipAddress);
2352
- },
2353
- title: "Block IP",
2354
- children: /* @__PURE__ */ e(uc, { size: 14 })
2416
+ className: `nice-accesslog-risk nice-accesslog-risk--${d.riskLevel}`,
2417
+ style: { "--risk-color": Pe(d.riskScore) },
2418
+ children: [
2419
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-score", children: d.riskScore }),
2420
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-label", children: N.riskLevels[d.riskLevel] })
2421
+ ]
2355
2422
  }
2356
- )
2357
- ] }),
2358
- /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--location", children: [
2359
- ((d = o.location) == null ? void 0 : d.countryCode) && /* @__PURE__ */ e("span", { className: "nice-accesslog-flag", children: /* @__PURE__ */ e(pc, { size: 14 }) }),
2360
- Ae(o.location)
2361
- ] }),
2362
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--device", children: /* @__PURE__ */ c("span", { className: "nice-accesslog-device", children: [
2363
- _e[((f = o.device) == null ? void 0 : f.type) || "unknown"],
2364
- Xc(o.device)
2365
- ] }) }),
2366
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--risk", children: /* @__PURE__ */ c(
2367
- "span",
2368
- {
2369
- className: `nice-accesslog-risk nice-accesslog-risk--${o.riskLevel}`,
2370
- style: { "--risk-color": Ie(o.riskScore) },
2371
- children: [
2372
- /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-score", children: o.riskScore }),
2373
- /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-label", children: k.riskLevels[o.riskLevel] })
2374
- ]
2375
- }
2376
- ) }),
2377
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--status", children: /* @__PURE__ */ e(
2378
- "span",
2423
+ ) }),
2424
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--status", children: /* @__PURE__ */ e(
2425
+ "span",
2426
+ {
2427
+ className: `nice-accesslog-status ${d.success ? "nice-accesslog-status--success" : "nice-accesslog-status--failed"}`,
2428
+ children: d.success ? /* @__PURE__ */ e(se, { size: 14 }) : /* @__PURE__ */ e(he, { size: 14 })
2429
+ }
2430
+ ) })
2431
+ ]
2432
+ },
2433
+ d.id
2434
+ );
2435
+ }, M = (d) => /* @__PURE__ */ c(
2436
+ "div",
2437
+ {
2438
+ className: `nice-accesslog-timeline-item nice-accesslog-timeline-item--${d.riskLevel}`,
2439
+ onClick: () => X(d),
2440
+ children: [
2441
+ /* @__PURE__ */ e(
2442
+ "div",
2379
2443
  {
2380
- className: `nice-accesslog-status ${o.success ? "nice-accesslog-status--success" : "nice-accesslog-status--failed"}`,
2381
- children: o.success ? /* @__PURE__ */ e(ae, { size: 14 }) : /* @__PURE__ */ e(oe, { size: 14 })
2444
+ className: "nice-accesslog-timeline-marker",
2445
+ style: { background: de[d.riskLevel] }
2382
2446
  }
2383
- ) })
2447
+ ),
2448
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-content", children: [
2449
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-header", children: [
2450
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-timeline-event", children: [
2451
+ Ne[d.eventType],
2452
+ " ",
2453
+ N.eventTypes[d.eventType]
2454
+ ] }),
2455
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-timeline-time", children: Ie(d.timestamp) })
2456
+ ] }),
2457
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-details", children: [
2458
+ /* @__PURE__ */ e("span", { children: d.userName || d.userId }),
2459
+ /* @__PURE__ */ e("span", { children: "•" }),
2460
+ /* @__PURE__ */ e("span", { children: d.ipAddress }),
2461
+ /* @__PURE__ */ e("span", { children: "•" }),
2462
+ /* @__PURE__ */ e("span", { children: Oe(d.location) })
2463
+ ] }),
2464
+ d.flags && d.flags.length > 0 && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline-flags", children: d.flags.map((p, y) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: p }, y)) })
2465
+ ] })
2384
2466
  ]
2385
2467
  },
2386
- o.id
2468
+ d.id
2387
2469
  );
2388
- }, R = (o) => /* @__PURE__ */ c(
2389
- "div",
2390
- {
2391
- className: `nice-accesslog-timeline-item nice-accesslog-timeline-item--${o.riskLevel}`,
2392
- onClick: () => W(o),
2393
- children: [
2394
- /* @__PURE__ */ e(
2395
- "div",
2396
- {
2397
- className: "nice-accesslog-timeline-marker",
2398
- style: { background: re[o.riskLevel] }
2399
- }
2400
- ),
2401
- /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-content", children: [
2402
- /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-header", children: [
2403
- /* @__PURE__ */ c("span", { className: "nice-accesslog-timeline-event", children: [
2404
- ve[o.eventType],
2405
- " ",
2406
- k.eventTypes[o.eventType]
2407
- ] }),
2408
- /* @__PURE__ */ e("span", { className: "nice-accesslog-timeline-time", children: Le(o.timestamp) })
2409
- ] }),
2410
- /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-details", children: [
2411
- /* @__PURE__ */ e("span", { children: o.userName || o.userId }),
2412
- /* @__PURE__ */ e("span", { children: "•" }),
2413
- /* @__PURE__ */ e("span", { children: o.ipAddress }),
2414
- /* @__PURE__ */ e("span", { children: "•" }),
2415
- /* @__PURE__ */ e("span", { children: Ae(o.location) })
2416
- ] }),
2417
- o.flags && o.flags.length > 0 && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline-flags", children: o.flags.map((d, f) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: d }, f)) })
2418
- ] })
2419
- ]
2420
- },
2421
- o.id
2422
- );
2423
- return /* @__PURE__ */ c("div", { ref: m, className: `nice-accesslog ${U}`, ...B, children: [
2424
- /* @__PURE__ */ c("div", { className: "nice-accesslog-header", children: [
2425
- /* @__PURE__ */ c("div", { className: "nice-accesslog-header-left", children: [
2426
- /* @__PURE__ */ e("h2", { className: "nice-accesslog-title", children: k.title }),
2427
- h && /* @__PURE__ */ c("span", { className: "nice-accesslog-realtime-badge", children: [
2428
- /* @__PURE__ */ e(Ce, { size: 10 }),
2429
- " Live"
2430
- ] })
2431
- ] }),
2432
- /* @__PURE__ */ c("div", { className: "nice-accesslog-header-actions", children: [
2433
- /* @__PURE__ */ c(
2434
- "button",
2435
- {
2436
- type: "button",
2437
- className: "nice-accesslog-btn",
2438
- onClick: Q,
2439
- disabled: J,
2440
- children: [
2441
- /* @__PURE__ */ e(Ne, { size: 16 }),
2442
- " ",
2443
- k.refresh
2444
- ]
2445
- }
2446
- ),
2447
- /* @__PURE__ */ c("div", { className: "nice-accesslog-export-dropdown", children: [
2448
- /* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-btn", children: [
2449
- /* @__PURE__ */ e(me, { size: 16 }),
2470
+ return /* @__PURE__ */ c("div", { ref: m, className: `nice-accesslog ${q}`, ...E, children: [
2471
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-header", children: [
2472
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-header-left", children: [
2473
+ /* @__PURE__ */ e("h2", { className: "nice-accesslog-title", children: N.title }),
2474
+ r && /* @__PURE__ */ c("span", { className: "nice-accesslog-realtime-badge", children: [
2475
+ /* @__PURE__ */ e(De, { size: 10 }),
2450
2476
  " ",
2451
- k.export
2452
- ] }),
2453
- /* @__PURE__ */ c("div", { className: "nice-accesslog-export-menu", children: [
2454
- /* @__PURE__ */ e("button", { onClick: () => F("csv"), children: "CSV" }),
2455
- /* @__PURE__ */ e("button", { onClick: () => F("json"), children: "JSON" }),
2456
- /* @__PURE__ */ e("button", { onClick: () => F("pdf"), children: "PDF" })
2477
+ i("accessLog.live", "Live")
2457
2478
  ] })
2458
- ] })
2459
- ] })
2460
- ] }),
2461
- T && /* @__PURE__ */ c("div", { className: "nice-accesslog-stats", children: [
2462
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2463
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.totalEvents }),
2464
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Total Events" })
2465
- ] }),
2466
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--success", children: [
2467
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.successfulLogins }),
2468
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Successful" })
2469
- ] }),
2470
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--failed", children: [
2471
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.failedLogins }),
2472
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Failed" })
2473
- ] }),
2474
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2475
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.uniqueIPs }),
2476
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Unique IPs" })
2477
- ] }),
2478
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2479
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.uniqueCountries }),
2480
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Countries" })
2481
- ] }),
2482
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--warning", children: [
2483
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.highRiskEvents }),
2484
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "High Risk" })
2485
- ] })
2486
- ] }),
2487
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filters", children: [
2488
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-row", children: [
2489
- /* @__PURE__ */ c("div", { className: "nice-accesslog-search", children: [
2490
- /* @__PURE__ */ e("span", { className: "nice-accesslog-search-icon", children: /* @__PURE__ */ e(pe, { size: 16 }) }),
2491
- /* @__PURE__ */ e(
2492
- "input",
2493
- {
2494
- type: "text",
2495
- placeholder: k.search,
2496
- value: g.searchQuery || "",
2497
- onChange: (o) => b({ searchQuery: o.target.value })
2498
- }
2499
- )
2500
2479
  ] }),
2501
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-quick", children: [
2502
- /* @__PURE__ */ e(
2480
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-header-actions", children: [
2481
+ /* @__PURE__ */ c(
2503
2482
  "button",
2504
2483
  {
2505
2484
  type: "button",
2506
- className: `nice-accesslog-filter-chip ${g.failedOnly ? "nice-accesslog-filter-chip--active" : ""}`,
2507
- onClick: () => b({ failedOnly: !g.failedOnly, successOnly: !1 }),
2508
- children: "Failed Only"
2509
- }
2510
- ),
2511
- /* @__PURE__ */ e(
2512
- "button",
2513
- {
2514
- type: "button",
2515
- className: `nice-accesslog-filter-chip ${(H = g.riskLevels) != null && H.includes("high") || (X = g.riskLevels) != null && X.includes("critical") ? "nice-accesslog-filter-chip--active" : ""}`,
2516
- onClick: () => {
2517
- var o;
2518
- return b({
2519
- riskLevels: (o = g.riskLevels) != null && o.includes("high") ? [] : ["high", "critical"]
2520
- });
2521
- },
2522
- children: "High Risk"
2485
+ className: "nice-accesslog-btn",
2486
+ onClick: G,
2487
+ disabled: F,
2488
+ children: [
2489
+ /* @__PURE__ */ e(ye, { size: 16 }),
2490
+ " ",
2491
+ N.refresh
2492
+ ]
2523
2493
  }
2524
2494
  ),
2525
- /* @__PURE__ */ e(
2526
- "button",
2527
- {
2528
- type: "button",
2529
- className: "nice-accesslog-filter-toggle",
2530
- onClick: () => q(!C),
2531
- children: C ? /* @__PURE__ */ c(ee, { children: [
2532
- /* @__PURE__ */ e(oc, { size: 14 }),
2533
- " Less"
2534
- ] }) : /* @__PURE__ */ c(ee, { children: [
2535
- /* @__PURE__ */ e(Se, { size: 14 }),
2536
- " More"
2537
- ] })
2538
- }
2539
- )
2495
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-export-dropdown", children: [
2496
+ /* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-btn", children: [
2497
+ /* @__PURE__ */ e(ve, { size: 16 }),
2498
+ " ",
2499
+ N.export
2500
+ ] }),
2501
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-export-menu", children: [
2502
+ /* @__PURE__ */ e("button", { onClick: () => Z("csv"), children: "CSV" }),
2503
+ /* @__PURE__ */ e("button", { onClick: () => Z("json"), children: i("accessLog.json", "JSON") }),
2504
+ /* @__PURE__ */ e("button", { onClick: () => Z("pdf"), children: "PDF" })
2505
+ ] })
2506
+ ] })
2540
2507
  ] })
2541
2508
  ] }),
2542
- C && /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-expanded", children: [
2543
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2544
- /* @__PURE__ */ e("label", { children: "Event Type" }),
2545
- /* @__PURE__ */ e(
2546
- "select",
2547
- {
2548
- multiple: !0,
2549
- value: g.eventTypes || [],
2550
- onChange: (o) => {
2551
- const d = Array.from(
2552
- o.target.selectedOptions,
2553
- (f) => f.value
2554
- );
2555
- b({ eventTypes: d.length ? d : void 0 });
2556
- },
2557
- children: Object.entries(k.eventTypes).map(([o, d]) => /* @__PURE__ */ e("option", { value: o, children: d }, o))
2558
- }
2559
- )
2509
+ _ && /* @__PURE__ */ c("div", { className: "nice-accesslog-stats", children: [
2510
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2511
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.totalEvents }),
2512
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.totalEvents", "Total Events") })
2513
+ ] }),
2514
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--success", children: [
2515
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.successfulLogins }),
2516
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.successful", "Successful") })
2517
+ ] }),
2518
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--failed", children: [
2519
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.failedLogins }),
2520
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.failed", "Failed") })
2521
+ ] }),
2522
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2523
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.uniqueIPs }),
2524
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.uniqueIps", "Unique IPs") })
2525
+ ] }),
2526
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2527
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.uniqueCountries }),
2528
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.countries", "Countries") })
2560
2529
  ] }),
2561
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2562
- /* @__PURE__ */ e("label", { children: "Date Range" }),
2563
- /* @__PURE__ */ c("div", { className: "nice-accesslog-date-range", children: [
2530
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--warning", children: [
2531
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.highRiskEvents }),
2532
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.highRisk", "High Risk") })
2533
+ ] })
2534
+ ] }),
2535
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filters", children: [
2536
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-row", children: [
2537
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-search", children: [
2538
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-search-icon", children: /* @__PURE__ */ e(ge, { size: 16 }) }),
2564
2539
  /* @__PURE__ */ e(
2565
2540
  "input",
2566
2541
  {
2567
- type: "date",
2568
- value: g.startDate ? new Date(g.startDate).toISOString().split("T")[0] : "",
2569
- onChange: (o) => b({ startDate: o.target.value || void 0 })
2542
+ type: "text",
2543
+ placeholder: N.search,
2544
+ value: g.searchQuery || "",
2545
+ onChange: (d) => f({ searchQuery: d.target.value })
2546
+ }
2547
+ )
2548
+ ] }),
2549
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-quick", children: [
2550
+ /* @__PURE__ */ e(
2551
+ "button",
2552
+ {
2553
+ type: "button",
2554
+ className: `nice-accesslog-filter-chip ${g.failedOnly ? "nice-accesslog-filter-chip--active" : ""}`,
2555
+ onClick: () => f({ failedOnly: !g.failedOnly, successOnly: !1 }),
2556
+ children: i("accessLog.failedOnly", "Failed Only")
2570
2557
  }
2571
2558
  ),
2572
- /* @__PURE__ */ e("span", { children: "to" }),
2573
2559
  /* @__PURE__ */ e(
2574
- "input",
2560
+ "button",
2575
2561
  {
2576
- type: "date",
2577
- value: g.endDate ? new Date(g.endDate).toISOString().split("T")[0] : "",
2578
- onChange: (o) => b({ endDate: o.target.value || void 0 })
2562
+ type: "button",
2563
+ className: `nice-accesslog-filter-chip ${(K = g.riskLevels) != null && K.includes("high") || (Q = g.riskLevels) != null && Q.includes("critical") ? "nice-accesslog-filter-chip--active" : ""}`,
2564
+ onClick: () => {
2565
+ var d;
2566
+ return f({
2567
+ riskLevels: (d = g.riskLevels) != null && d.includes("high") ? [] : ["high", "critical"]
2568
+ });
2569
+ },
2570
+ children: i("accessLog.highRisk", "High Risk")
2571
+ }
2572
+ ),
2573
+ /* @__PURE__ */ e(
2574
+ "button",
2575
+ {
2576
+ type: "button",
2577
+ className: "nice-accesslog-filter-toggle",
2578
+ onClick: () => H(!x),
2579
+ children: x ? /* @__PURE__ */ c(ae, { children: [
2580
+ /* @__PURE__ */ e(pc, { size: 14 }),
2581
+ " ",
2582
+ i("accessLog.less", "Less")
2583
+ ] }) : /* @__PURE__ */ c(ae, { children: [
2584
+ /* @__PURE__ */ e(Te, { size: 14 }),
2585
+ " ",
2586
+ i("accessLog.more", "More")
2587
+ ] })
2579
2588
  }
2580
2589
  )
2581
2590
  ] })
2582
2591
  ] }),
2583
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2584
- /* @__PURE__ */ e("label", { children: "IP Address" }),
2592
+ x && /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-expanded", children: [
2593
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2594
+ /* @__PURE__ */ e("label", { children: i("accessLog.eventType", "Event Type") }),
2595
+ /* @__PURE__ */ e(
2596
+ "select",
2597
+ {
2598
+ multiple: !0,
2599
+ value: g.eventTypes || [],
2600
+ onChange: (d) => {
2601
+ const p = Array.from(
2602
+ d.target.selectedOptions,
2603
+ (y) => y.value
2604
+ );
2605
+ f({ eventTypes: p.length ? p : void 0 });
2606
+ },
2607
+ children: Object.entries(N.eventTypes).map(([d, p]) => /* @__PURE__ */ e("option", { value: d, children: p }, d))
2608
+ }
2609
+ )
2610
+ ] }),
2611
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2612
+ /* @__PURE__ */ e("label", { children: i("accessLog.dateRange", "Date Range") }),
2613
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-date-range", children: [
2614
+ /* @__PURE__ */ e(
2615
+ "input",
2616
+ {
2617
+ type: "date",
2618
+ value: g.startDate ? new Date(g.startDate).toISOString().split("T")[0] : "",
2619
+ onChange: (d) => f({ startDate: d.target.value || void 0 })
2620
+ }
2621
+ ),
2622
+ /* @__PURE__ */ e("span", { children: "to" }),
2623
+ /* @__PURE__ */ e(
2624
+ "input",
2625
+ {
2626
+ type: "date",
2627
+ value: g.endDate ? new Date(g.endDate).toISOString().split("T")[0] : "",
2628
+ onChange: (d) => f({ endDate: d.target.value || void 0 })
2629
+ }
2630
+ )
2631
+ ] })
2632
+ ] }),
2633
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2634
+ /* @__PURE__ */ e("label", { children: i("accessLog.ipAddress", "IP Address") }),
2635
+ /* @__PURE__ */ e(
2636
+ "input",
2637
+ {
2638
+ type: "text",
2639
+ placeholder: "e.g., 192.168",
2640
+ value: g.ipAddress || "",
2641
+ onChange: (d) => f({ ipAddress: d.target.value || void 0 })
2642
+ }
2643
+ )
2644
+ ] }),
2585
2645
  /* @__PURE__ */ e(
2586
- "input",
2646
+ "button",
2587
2647
  {
2588
- type: "text",
2589
- placeholder: "e.g., 192.168",
2590
- value: g.ipAddress || "",
2591
- onChange: (o) => b({ ipAddress: o.target.value || void 0 })
2648
+ type: "button",
2649
+ className: "nice-accesslog-clear-filters",
2650
+ onClick: T,
2651
+ children: i("accessLog.clearAllFilters", "Clear All Filters")
2592
2652
  }
2593
2653
  )
2594
- ] }),
2595
- /* @__PURE__ */ e("button", { type: "button", className: "nice-accesslog-clear-filters", onClick: L, children: "Clear All Filters" })
2596
- ] })
2597
- ] }),
2598
- /* @__PURE__ */ c("div", { className: "nice-accesslog-tabs", children: [
2599
- /* @__PURE__ */ c(
2600
- "button",
2601
- {
2602
- type: "button",
2603
- className: `nice-accesslog-tab ${v === "table" ? "nice-accesslog-tab--active" : ""}`,
2604
- onClick: () => x("table"),
2605
- children: [
2606
- /* @__PURE__ */ e(dc, { size: 16 }),
2607
- " Table"
2608
- ]
2609
- }
2610
- ),
2611
- /* @__PURE__ */ c(
2612
- "button",
2613
- {
2614
- type: "button",
2615
- className: `nice-accesslog-tab ${v === "timeline" ? "nice-accesslog-tab--active" : ""}`,
2616
- onClick: () => x("timeline"),
2617
- children: [
2618
- /* @__PURE__ */ e(hc, { size: 16 }),
2619
- " ",
2620
- k.timeline
2621
- ]
2622
- }
2623
- ),
2624
- u && /* @__PURE__ */ c(
2625
- "button",
2626
- {
2627
- type: "button",
2628
- className: `nice-accesslog-tab ${v === "map" ? "nice-accesslog-tab--active" : ""}`,
2629
- onClick: () => x("map"),
2630
- children: [
2631
- /* @__PURE__ */ e(Te, { size: 16 }),
2632
- " ",
2633
- k.map
2634
- ]
2635
- }
2636
- ),
2637
- /* @__PURE__ */ c("span", { className: "nice-accesslog-count", children: [
2638
- z.length,
2639
- " entries"
2640
- ] })
2641
- ] }),
2642
- /* @__PURE__ */ e("div", { className: "nice-accesslog-content", children: J ? /* @__PURE__ */ c("div", { className: "nice-accesslog-loading", children: [
2643
- /* @__PURE__ */ e("div", { className: "nice-accesslog-spinner" }),
2644
- "Loading access logs..."
2645
- ] }) : z.length === 0 ? /* @__PURE__ */ c("div", { className: "nice-accesslog-empty", children: [
2646
- /* @__PURE__ */ e("span", { className: "nice-accesslog-empty-icon", children: /* @__PURE__ */ e(qe, { size: 32 }) }),
2647
- /* @__PURE__ */ e("span", { children: k.noResults })
2648
- ] }) : /* @__PURE__ */ c(ee, { children: [
2649
- v === "table" && /* @__PURE__ */ e("div", { className: "nice-accesslog-table-wrapper", children: /* @__PURE__ */ c("table", { className: "nice-accesslog-table", children: [
2650
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
2651
- /* @__PURE__ */ e("th", { children: k.columns.timestamp }),
2652
- /* @__PURE__ */ e("th", { children: k.columns.user }),
2653
- /* @__PURE__ */ e("th", { children: k.columns.event }),
2654
- /* @__PURE__ */ e("th", { children: k.columns.ip }),
2655
- /* @__PURE__ */ e("th", { children: k.columns.location }),
2656
- /* @__PURE__ */ e("th", { children: k.columns.device }),
2657
- /* @__PURE__ */ e("th", { children: k.columns.risk }),
2658
- /* @__PURE__ */ e("th", { children: k.columns.status })
2654
+ ] })
2655
+ ] }),
2656
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-tabs", children: [
2657
+ /* @__PURE__ */ c(
2658
+ "button",
2659
+ {
2660
+ type: "button",
2661
+ className: `nice-accesslog-tab ${j === "table" ? "nice-accesslog-tab--active" : ""}`,
2662
+ onClick: () => b("table"),
2663
+ children: [
2664
+ /* @__PURE__ */ e(uc, { size: 16 }),
2665
+ " ",
2666
+ i("accessLog.table", "Table")
2667
+ ]
2668
+ }
2669
+ ),
2670
+ /* @__PURE__ */ c(
2671
+ "button",
2672
+ {
2673
+ type: "button",
2674
+ className: `nice-accesslog-tab ${j === "timeline" ? "nice-accesslog-tab--active" : ""}`,
2675
+ onClick: () => b("timeline"),
2676
+ children: [
2677
+ /* @__PURE__ */ e(mc, { size: 16 }),
2678
+ " ",
2679
+ N.timeline
2680
+ ]
2681
+ }
2682
+ ),
2683
+ w && /* @__PURE__ */ c(
2684
+ "button",
2685
+ {
2686
+ type: "button",
2687
+ className: `nice-accesslog-tab ${j === "map" ? "nice-accesslog-tab--active" : ""}`,
2688
+ onClick: () => b("map"),
2689
+ children: [
2690
+ /* @__PURE__ */ e(Ee, { size: 16 }),
2691
+ " ",
2692
+ N.map
2693
+ ]
2694
+ }
2695
+ ),
2696
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-count", children: [
2697
+ S.length,
2698
+ " entries"
2699
+ ] })
2700
+ ] }),
2701
+ /* @__PURE__ */ e("div", { className: "nice-accesslog-content", children: F ? /* @__PURE__ */ c("div", { className: "nice-accesslog-loading", children: [
2702
+ /* @__PURE__ */ e("div", { className: "nice-accesslog-spinner" }),
2703
+ i("accessLog.loadingAccessLogs", "Loading access logs...")
2704
+ ] }) : S.length === 0 ? /* @__PURE__ */ c("div", { className: "nice-accesslog-empty", children: [
2705
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-empty-icon", children: /* @__PURE__ */ e(He, { size: 32 }) }),
2706
+ /* @__PURE__ */ e("span", { children: N.noResults })
2707
+ ] }) : /* @__PURE__ */ c(ae, { children: [
2708
+ j === "table" && /* @__PURE__ */ e("div", { className: "nice-accesslog-table-wrapper", children: /* @__PURE__ */ c("table", { className: "nice-accesslog-table", children: [
2709
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
2710
+ /* @__PURE__ */ e("th", { children: N.columns.timestamp }),
2711
+ /* @__PURE__ */ e("th", { children: N.columns.user }),
2712
+ /* @__PURE__ */ e("th", { children: N.columns.event }),
2713
+ /* @__PURE__ */ e("th", { children: N.columns.ip }),
2714
+ /* @__PURE__ */ e("th", { children: N.columns.location }),
2715
+ /* @__PURE__ */ e("th", { children: N.columns.device }),
2716
+ /* @__PURE__ */ e("th", { children: N.columns.risk }),
2717
+ /* @__PURE__ */ e("th", { children: N.columns.status })
2718
+ ] }) }),
2719
+ /* @__PURE__ */ e("tbody", { children: A.map(D) })
2659
2720
  ] }) }),
2660
- /* @__PURE__ */ e("tbody", { children: G.map(D) })
2661
- ] }) }),
2662
- v === "timeline" && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline", children: G.map(R) }),
2663
- v === "map" && /* @__PURE__ */ e("div", { className: "nice-accesslog-map", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-map-placeholder", children: [
2664
- /* @__PURE__ */ e(Te, { size: 16 }),
2665
- " Geographic visualization would render here"
2666
- ] }) }),
2667
- A < z.length && /* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-show-more", onClick: N, children: [
2668
- k.showMore,
2669
- " (",
2670
- z.length - A,
2671
- " remaining)"
2672
- ] })
2673
- ] }) }),
2674
- E && p && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail", children: [
2675
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-header", children: [
2676
- /* @__PURE__ */ e("h3", { children: k.details }),
2677
- /* @__PURE__ */ e(
2721
+ j === "timeline" && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline", children: A.map(M) }),
2722
+ j === "map" && /* @__PURE__ */ e("div", { className: "nice-accesslog-map", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-map-placeholder", children: [
2723
+ /* @__PURE__ */ e(Ee, { size: 16 }),
2724
+ " ",
2725
+ i(
2726
+ "accessLog.geographicVisualizationWouldRenderHere",
2727
+ "Geographic visualization would render here"
2728
+ )
2729
+ ] }) }),
2730
+ O < S.length && /* @__PURE__ */ c(
2678
2731
  "button",
2679
2732
  {
2680
2733
  type: "button",
2681
- className: "nice-accesslog-detail-close",
2682
- onClick: () => P(null),
2683
- children: /* @__PURE__ */ e(ge, { size: 16 })
2734
+ className: "nice-accesslog-show-more",
2735
+ onClick: v,
2736
+ children: [
2737
+ N.showMore,
2738
+ " (",
2739
+ S.length - O,
2740
+ " remaining)"
2741
+ ]
2684
2742
  }
2685
2743
  )
2686
- ] }),
2687
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-content", children: [
2688
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2689
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Event ID" }),
2690
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.id })
2691
- ] }),
2692
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2693
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Timestamp" }),
2694
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: new Date(p.timestamp).toISOString() })
2695
- ] }),
2696
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2697
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "User" }),
2698
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2699
- p.userName,
2700
- " (",
2701
- p.userId,
2702
- ")",
2703
- p.userEmail && /* @__PURE__ */ e("div", { children: p.userEmail })
2704
- ] })
2705
- ] }),
2706
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2707
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Event Type" }),
2708
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2709
- ve[p.eventType],
2710
- " ",
2711
- k.eventTypes[p.eventType]
2712
- ] })
2713
- ] }),
2714
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2715
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "IP Address" }),
2716
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.ipAddress })
2744
+ ] }) }),
2745
+ I && u && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail", children: [
2746
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-header", children: [
2747
+ /* @__PURE__ */ e("h3", { children: N.details }),
2748
+ /* @__PURE__ */ e(
2749
+ "button",
2750
+ {
2751
+ type: "button",
2752
+ className: "nice-accesslog-detail-close",
2753
+ onClick: () => B(null),
2754
+ children: /* @__PURE__ */ e(be, { size: 16 })
2755
+ }
2756
+ )
2717
2757
  ] }),
2718
- p.location && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2719
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Location" }),
2720
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2721
- p.location.city,
2722
- ", ",
2723
- p.location.region,
2724
- ",",
2725
- " ",
2726
- p.location.country,
2727
- p.location.latitude && p.location.longitude && /* @__PURE__ */ c("div", { className: "nice-accesslog-coords", children: [
2728
- "(",
2729
- p.location.latitude,
2758
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-content", children: [
2759
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2760
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.eventId", "Event ID") }),
2761
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: u.id })
2762
+ ] }),
2763
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2764
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.timestamp", "Timestamp") }),
2765
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: new Date(u.timestamp).toISOString() })
2766
+ ] }),
2767
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2768
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.user", "User") }),
2769
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2770
+ u.userName,
2771
+ " (",
2772
+ u.userId,
2773
+ ")",
2774
+ u.userEmail && /* @__PURE__ */ e("div", { children: u.userEmail })
2775
+ ] })
2776
+ ] }),
2777
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2778
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.eventType", "Event Type") }),
2779
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2780
+ Ne[u.eventType],
2781
+ " ",
2782
+ N.eventTypes[u.eventType]
2783
+ ] })
2784
+ ] }),
2785
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2786
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.ipAddress", "IP Address") }),
2787
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: u.ipAddress })
2788
+ ] }),
2789
+ u.location && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2790
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.location", "Location") }),
2791
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2792
+ u.location.city,
2730
2793
  ", ",
2731
- p.location.longitude,
2732
- ")"
2794
+ u.location.region,
2795
+ ",",
2796
+ " ",
2797
+ u.location.country,
2798
+ u.location.latitude && u.location.longitude && /* @__PURE__ */ c("div", { className: "nice-accesslog-coords", children: [
2799
+ "(",
2800
+ u.location.latitude,
2801
+ ", ",
2802
+ u.location.longitude,
2803
+ ")"
2804
+ ] })
2733
2805
  ] })
2734
- ] })
2735
- ] }),
2736
- p.device && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2737
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Device" }),
2738
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2739
- _e[p.device.type],
2740
- " ",
2741
- p.device.os,
2742
- " ",
2743
- p.device.osVersion,
2744
- /* @__PURE__ */ c("div", { children: [
2745
- p.device.browser,
2806
+ ] }),
2807
+ u.device && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2808
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.device", "Device") }),
2809
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2810
+ Ae[u.device.type],
2746
2811
  " ",
2747
- p.device.browserVersion
2748
- ] }),
2749
- p.device.fingerprint && /* @__PURE__ */ c("div", { className: "nice-accesslog-fingerprint", children: [
2750
- "Fingerprint: ",
2751
- p.device.fingerprint
2812
+ u.device.os,
2813
+ " ",
2814
+ u.device.osVersion,
2815
+ /* @__PURE__ */ c("div", { children: [
2816
+ u.device.browser,
2817
+ " ",
2818
+ u.device.browserVersion
2819
+ ] }),
2820
+ u.device.fingerprint && /* @__PURE__ */ c("div", { className: "nice-accesslog-fingerprint", children: [
2821
+ "Fingerprint: ",
2822
+ u.device.fingerprint
2823
+ ] })
2752
2824
  ] })
2825
+ ] }),
2826
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2827
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.riskScore", "Risk Score") }),
2828
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: /* @__PURE__ */ c("span", { style: { color: Pe(u.riskScore) }, children: [
2829
+ u.riskScore,
2830
+ "/100 (",
2831
+ N.riskLevels[u.riskLevel],
2832
+ ")"
2833
+ ] }) })
2834
+ ] }),
2835
+ u.flags && u.flags.length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2836
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.flags", "Flags") }),
2837
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: u.flags.map((d, p) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: d }, p)) })
2838
+ ] }),
2839
+ u.details && Object.keys(u.details).length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2840
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.additionalDetails", "Additional Details") }),
2841
+ /* @__PURE__ */ e("pre", { className: "nice-accesslog-detail-json", children: JSON.stringify(u.details, null, 2) })
2753
2842
  ] })
2754
- ] }),
2755
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2756
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Risk Score" }),
2757
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: /* @__PURE__ */ c("span", { style: { color: Ie(p.riskScore) }, children: [
2758
- p.riskScore,
2759
- "/100 (",
2760
- k.riskLevels[p.riskLevel],
2761
- ")"
2762
- ] }) })
2763
- ] }),
2764
- p.flags && p.flags.length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2765
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Flags" }),
2766
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.flags.map((o, d) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: o }, d)) })
2767
- ] }),
2768
- p.details && Object.keys(p.details).length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2769
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Additional Details" }),
2770
- /* @__PURE__ */ e("pre", { className: "nice-accesslog-detail-json", children: JSON.stringify(p.details, null, 2) })
2771
2843
  ] })
2772
2844
  ] })
2773
- ] })
2774
- ] });
2775
- }
2845
+ ] });
2846
+ }
2847
+ ),
2848
+ { displayName: "NiceAccessLog" }
2776
2849
  );
2777
- Qc.displayName = "NiceAccessLog";
2778
2850
  export {
2779
- Qc as NiceAccessLog,
2780
- Ic as NiceAuditTrail,
2781
- Mc as NiceContractEditor,
2782
- zc as NiceDataExportCenter,
2783
- Vc as NiceGDPRConsent,
2784
- Wc as NiceGlobalSearch
2851
+ ra as NiceAccessLog,
2852
+ ia as NiceAuditTrail,
2853
+ sa as NiceContractEditor,
2854
+ ta as NiceDataExportCenter,
2855
+ na as NiceGDPRConsent,
2856
+ la as NiceGlobalSearch
2785
2857
  };