@archbase/security-ui 4.1.1 → 4.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.js CHANGED
@@ -1,121 +1,121 @@
1
- import { jsx as e, jsxs as o, Fragment as Ne } from "react/jsx-runtime";
2
- import { Modal as ze, ScrollArea as we, Stack as W, Grid as O, Group as N, Button as Z, Paper as Y, Box as _e, Text as w, List as Ee, Checkbox as ea, Tooltip as Ce, ActionIcon as ue, Flex as Re, Space as ua, Input as be, useTree as aa, useMantineColorScheme as Ge, TextInput as ge, Tree as ra, Badge as te, Tabs as K, RingProgress as Ea, SimpleGrid as Me, Loader as Ke, Alert as ke, Chip as ta, Table as j } from "@mantine/core";
3
- import { getI18nextInstance as s, resolveArchbasePasswordPolicy as $a, ARCHBASE_IOC_API_TYPE as Q, emit as Le, builder as Ie, validateArchbasePassword as Na, convertDateToISOString as La, processErrorMessage as he, getKeyByEnumValue as me, useArchbaseTheme as Qe, useArchbaseValidator as Va, useArchbaseTranslation as Ga, useValidationErrors as Ma, processDetailErrorMessage as $e } from "@archbase/core";
4
- import { ArchbaseEdit as re, ArchbaseNotifications as ee, ArchbasePasswordEdit as Oa, ArchbaseSelect as Ua, ArchbaseCheckbox as ve, ArchbaseAvatarEdit as Ba, ArchbaseAsyncSelect as Wa, Columns as Ae, ArchbaseDataGridColumn as T, ArchbaseDataGrid as ha, ArchbaseDialog as ce } from "@archbase/components";
5
- import { useArchbaseV1V2Compatibility as Pe, useArchbaseDataSourceListener as oa, useArchbaseRemoteServiceApi as X, useArchbaseRemoteDataSource as Je, ArchbaseDataSource as qa, useArchbaseStore as pa, useArchbaseRemoteDataSourceV2 as xe, useArchbaseDataSource as ja } from "@archbase/data";
6
- import { useState as P, useCallback as de, useEffect as Se, forwardRef as Ha, useMemo as ae, useRef as ye } from "react";
7
- import { IconArrowRight as ma, IconArrowLeft as ga, IconChevronDown as ia, IconBorderCornerSquare as na, IconEye as Za, IconEdit as fa, IconTrashX as Xe, IconShieldCheckered as Ja, IconPlus as ba, IconChartBar as Ka, IconListSearch as Qa, IconShieldSearch as Xa } from "@tabler/icons-react";
8
- import { UserGroupDto as sa, SecurityType as H, UserDto as Ya, GroupDto as _a, ProfileDto as er, ApiTokenDto as ar } from "@archbase/security";
9
- import { DateTimePicker as rr } from "@mantine/dates";
10
- import { useFocusTrap as tr, useDebouncedValue as la } from "@mantine/hooks";
11
- import { ArchbaseSpaceFixed as or, ArchbaseSpaceFill as ir, ArchbaseSpaceBottom as nr } from "@archbase/layout";
12
- const sr = (a) => {
13
- const r = { ...a.options ?? {} }, l = () => {
14
- a.onCustomSave ? a.onCustomSave(a.dataSource.getCurrentRecord(), (h) => {
15
- h && a.onAfterSave && a.onAfterSave(a.dataSource.getCurrentRecord()), a.onClickOk(a.dataSource.getCurrentRecord(), h);
1
+ import { jsx as e, jsxs as r, Fragment as Pe } from "react/jsx-runtime";
2
+ import { Modal as Oe, ScrollArea as fe, Stack as L, Grid as W, Group as N, Button as Y, Paper as _, Box as ae, Text as p, List as Le, Checkbox as oa, Tooltip as Re, ActionIcon as pe, Flex as De, Space as wa, Input as Te, useTree as na, useMantineColorScheme as Be, TextInput as me, Tree as sa, Badge as Z, Tabs as we, RingProgress as Wa, SimpleGrid as We, Table as y, Drawer as qa, Loader as le, Alert as be, Pagination as Ha, Chip as la, UnstyledButton as Ee } from "@mantine/core";
3
+ import { getI18nextInstance as g, resolveArchbasePasswordPolicy as ja, ARCHBASE_IOC_API_TYPE as Q, emit as Me, builder as Fe, validateArchbasePassword as Za, convertDateToISOString as Ka, processErrorMessage as ge, getKeyByEnumValue as Ce, useArchbaseTheme as ra, useArchbaseValidator as Qa, useArchbaseTranslation as Ja, useValidationErrors as Xa, processDetailErrorMessage as Ve } from "@archbase/core";
4
+ import { ArchbaseEdit as ne, ArchbaseNotifications as te, ArchbasePasswordEdit as Ya, ArchbaseSelect as _a, ArchbaseCheckbox as Ae, ArchbaseAvatarEdit as er, ArchbaseAsyncSelect as ar, Columns as ke, ArchbaseDataGridColumn as P, ArchbaseDataGrid as Ca, ArchbaseDialog as he } from "@archbase/components";
5
+ import { useArchbaseV1V2Compatibility as Ne, useArchbaseDataSourceListener as ca, useArchbaseRemoteServiceApi as J, useArchbaseRemoteDataSource as ea, ArchbaseDataSource as rr, useArchbaseStore as Sa, useArchbaseRemoteDataSourceV2 as Ie, useArchbaseDataSource as tr } from "@archbase/data";
6
+ import { useState as z, useCallback as oe, useEffect as ee, forwardRef as ir, useMemo as ie, useRef as xe } from "react";
7
+ import { IconArrowRight as Ta, IconArrowLeft as Aa, IconChevronDown as da, IconBorderCornerSquare as ua, IconEye as or, IconEdit as xa, IconTrashX as ta, IconShieldCheckered as nr, IconPlus as Ra } from "@tabler/icons-react";
8
+ import { UserGroupDto as ha, SecurityType as X, UserDto as sr, GroupDto as lr, ProfileDto as cr, ApiTokenDto as dr } from "@archbase/security";
9
+ import { DateTimePicker as ur } from "@mantine/dates";
10
+ import { useFocusTrap as hr, useDebouncedValue as aa } from "@mantine/hooks";
11
+ import { ArchbaseSpaceFixed as pr, ArchbaseSpaceFill as mr, ArchbaseSpaceBottom as gr } from "@archbase/layout";
12
+ const fr = (a) => {
13
+ const t = { ...a.options ?? {} }, o = () => {
14
+ a.onCustomSave ? a.onCustomSave(a.dataSource.getCurrentRecord(), (u) => {
15
+ u && a.onAfterSave && a.onAfterSave(a.dataSource.getCurrentRecord()), a.onClickOk(a.dataSource.getCurrentRecord(), u);
16
16
  }) : a.onClickOk(a.dataSource.getCurrentRecord(), !0);
17
17
  }, i = () => {
18
18
  a.onClickCancel(a.dataSource.getCurrentRecord());
19
19
  };
20
20
  return /* @__PURE__ */ e(
21
- ze,
21
+ Oe,
22
22
  {
23
23
  opened: a.opened,
24
24
  onClose: i,
25
- title: s().t("archbase:Perfil"),
25
+ title: g().t("archbase:Perfil"),
26
26
  size: "60%",
27
27
  styles: { content: { maxWidth: 1e3 } },
28
- children: /* @__PURE__ */ e(we, { style: { height: "460px" }, children: /* @__PURE__ */ o(W, { w: "98%", children: [
29
- r?.customContentBefore && r.customContentBefore(a.dataSource.getCurrentRecord()),
30
- /* @__PURE__ */ o(O, { children: [
31
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 12, lg: 12 }, children: /* @__PURE__ */ e(
32
- re,
28
+ children: /* @__PURE__ */ e(fe, { style: { height: "460px" }, children: /* @__PURE__ */ r(L, { w: "98%", children: [
29
+ t?.customContentBefore && t.customContentBefore(a.dataSource.getCurrentRecord()),
30
+ /* @__PURE__ */ r(W, { children: [
31
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 12, lg: 12 }, children: /* @__PURE__ */ e(
32
+ ne,
33
33
  {
34
- label: `${s().t("archbase:Nome do perfil")}`,
35
- placeholder: `${s().t("archbase:Informe o nome do perfil")}`,
34
+ label: `${g().t("archbase:Nome do perfil")}`,
35
+ placeholder: `${g().t("archbase:Informe o nome do perfil")}`,
36
36
  dataSource: a.dataSource,
37
37
  dataField: "name"
38
38
  }
39
39
  ) }),
40
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 12, lg: 12 }, children: /* @__PURE__ */ e(
41
- re,
40
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 12, lg: 12 }, children: /* @__PURE__ */ e(
41
+ ne,
42
42
  {
43
- label: `${s().t("archbase:Descrição do perfil")}`,
44
- placeholder: `${s().t("archbase:Informe a descrição do perfil")}`,
43
+ label: `${g().t("archbase:Descrição do perfil")}`,
44
+ placeholder: `${g().t("archbase:Informe a descrição do perfil")}`,
45
45
  dataSource: a.dataSource,
46
46
  dataField: "description"
47
47
  }
48
48
  ) })
49
49
  ] }),
50
- r?.customContentAfter && r.customContentAfter(a.dataSource.getCurrentRecord()),
51
- /* @__PURE__ */ o(N, { justify: "flex-end", mt: "md", children: [
52
- /* @__PURE__ */ e(Z, { variant: "default", onClick: i, children: s().t("archbase:Cancelar") }),
53
- /* @__PURE__ */ e(Z, { onClick: l, children: s().t("archbase:Salvar") })
50
+ t?.customContentAfter && t.customContentAfter(a.dataSource.getCurrentRecord()),
51
+ /* @__PURE__ */ r(N, { justify: "flex-end", mt: "md", children: [
52
+ /* @__PURE__ */ e(Y, { variant: "default", onClick: i, children: g().t("archbase:Cancelar") }),
53
+ /* @__PURE__ */ e(Y, { onClick: o, children: g().t("archbase:Salvar") })
54
54
  ] })
55
55
  ] }) })
56
56
  }
57
57
  );
58
58
  };
59
- function lr({
59
+ function br({
60
60
  availableItemsDS: a,
61
- assignedItemsDS: r,
62
- idFieldAvailable: l,
61
+ assignedItemsDS: t,
62
+ idFieldAvailable: o,
63
63
  labelFieldAvailable: i,
64
- idFieldAssigned: h,
65
- labelFieldAssigned: n,
66
- handleCreateAssociationObject: A,
67
- width: v = "400px",
64
+ idFieldAssigned: u,
65
+ labelFieldAssigned: h,
66
+ handleCreateAssociationObject: c,
67
+ width: I = "400px",
68
68
  height: x = "200px",
69
- titleAvailable: c = "Disponíveis",
69
+ titleAvailable: f = "Disponíveis",
70
70
  titleAssigned: C = "Selecionados"
71
71
  }) {
72
- Pe(
72
+ Ne(
73
73
  "ArchbaseDualListSelector-Available",
74
74
  a,
75
75
  void 0,
76
76
  []
77
77
  );
78
- const u = Pe(
78
+ const S = Ne(
79
79
  "ArchbaseDualListSelector-Assigned",
80
- r,
80
+ t,
81
81
  void 0,
82
82
  []
83
- ), [b, D] = P([]), [y, q] = P([]), [V, t] = P([]), [d, g] = P([]), F = de(() => {
84
- a && D(a.browseRecords()), r && q(r.browseRecords());
85
- }, [a, r]);
86
- oa({
83
+ ), [n, s] = z([]), [w, D] = z([]), [d, l] = z([]), [m, v] = z([]), T = oe(() => {
84
+ a && s(a.browseRecords()), t && D(t.browseRecords());
85
+ }, [a, t]);
86
+ ca({
87
87
  dataSource: a,
88
- listener: () => F()
89
- }), oa({
90
- dataSource: r,
91
- listener: () => F()
92
- }), Se(() => {
93
- F();
94
- }, [F]);
95
- const z = (S, k) => typeof k == "function" ? k(S) : S[k], f = (S, k) => typeof k == "function" ? k(S) : S[k], oe = (S, k) => {
96
- S((R) => R.includes(k) ? R.filter((fe) => fe !== k) : [...R, k]);
88
+ listener: () => T()
89
+ }), ca({
90
+ dataSource: t,
91
+ listener: () => T()
92
+ }), ee(() => {
93
+ T();
94
+ }, [T]);
95
+ const A = (E, O) => typeof O == "function" ? O(E) : E[O], b = (E, O) => typeof O == "function" ? O(E) : E[O], j = (E, O) => {
96
+ E((F) => F.includes(O) ? F.filter((Se) => Se !== O) : [...F, O]);
97
97
  }, G = () => {
98
- V.forEach((S) => {
99
- const k = b.find((R) => z(R, l) === S);
100
- if (k) {
101
- const R = A(k);
102
- u.isDataSourceV2 ? (r.insert(R), r.save()) : (r.insert(R), r.save(), u.v1State.forceUpdate());
98
+ d.forEach((E) => {
99
+ const O = n.find((F) => A(F, o) === E);
100
+ if (O) {
101
+ const F = c(O);
102
+ S.isDataSourceV2 ? (t.insert(F), t.save()) : (t.insert(F), t.save(), S.v1State.forceUpdate());
103
103
  }
104
- }), t([]);
105
- }, J = () => {
106
- d.forEach((S) => {
107
- const k = y.find((R) => z(R, h) === S);
108
- if (k) {
109
- const R = typeof h == "function" ? { customId: h(k) } : { [h]: S };
110
- u.isDataSourceV2 ? r.remove(() => r.locate(R)) : (r.remove(() => r.locate(R)), u.v1State.forceUpdate());
104
+ }), l([]);
105
+ }, K = () => {
106
+ m.forEach((E) => {
107
+ const O = w.find((F) => A(F, u) === E);
108
+ if (O) {
109
+ const F = typeof u == "function" ? { customId: u(O) } : { [u]: E };
110
+ S.isDataSourceV2 ? t.remove(() => t.locate(F)) : (t.remove(() => t.locate(F)), S.v1State.forceUpdate());
111
111
  }
112
- }), g([]);
112
+ }), v([]);
113
113
  };
114
- return /* @__PURE__ */ o(Y, { withBorder: !0, style: { display: "flex", width: v, height: x }, children: [
115
- /* @__PURE__ */ o(_e, { style: { minWidth: "44%", minHeight: x }, children: [
116
- /* @__PURE__ */ e(w, { children: c }),
114
+ return /* @__PURE__ */ r(_, { withBorder: !0, style: { display: "flex", width: I, height: x }, children: [
115
+ /* @__PURE__ */ r(ae, { style: { minWidth: "44%", minHeight: x }, children: [
116
+ /* @__PURE__ */ e(p, { children: f }),
117
117
  /* @__PURE__ */ e(
118
- Ee,
118
+ Le,
119
119
  {
120
120
  spacing: "xs",
121
121
  size: "sm",
@@ -127,28 +127,28 @@ function lr({
127
127
  overflowX: "hidden",
128
128
  height: "calc(100% - 32px)"
129
129
  },
130
- children: b.map((S) => /* @__PURE__ */ e(Ee.Item, { children: /* @__PURE__ */ e(
131
- ea,
130
+ children: n.map((E) => /* @__PURE__ */ e(Le.Item, { children: /* @__PURE__ */ e(
131
+ oa,
132
132
  {
133
- label: f(S, i),
134
- checked: V.includes(z(S, l)),
135
- onChange: () => oe(t, z(S, l)),
136
- disabled: y.some(
137
- (k) => z(k, h) === z(S, l)
133
+ label: b(E, i),
134
+ checked: d.includes(A(E, o)),
135
+ onChange: () => j(l, A(E, o)),
136
+ disabled: w.some(
137
+ (O) => A(O, u) === A(E, o)
138
138
  )
139
139
  }
140
- ) }, z(S, l)))
140
+ ) }, A(E, o)))
141
141
  }
142
142
  )
143
143
  ] }),
144
- /* @__PURE__ */ o(W, { gap: 5, style: { minWidth: "10%" }, justify: "center", align: "center", children: [
145
- /* @__PURE__ */ e(Ce, { label: "Adicionar", children: /* @__PURE__ */ e(ue, { onClick: G, disabled: !V.length, children: /* @__PURE__ */ e(ma, {}) }) }),
146
- /* @__PURE__ */ e(Ce, { label: "Remover", children: /* @__PURE__ */ e(ue, { onClick: J, disabled: !d.length, children: /* @__PURE__ */ e(ga, {}) }) })
144
+ /* @__PURE__ */ r(L, { gap: 5, style: { minWidth: "10%" }, justify: "center", align: "center", children: [
145
+ /* @__PURE__ */ e(Re, { label: "Adicionar", children: /* @__PURE__ */ e(pe, { onClick: G, disabled: !d.length, children: /* @__PURE__ */ e(Ta, {}) }) }),
146
+ /* @__PURE__ */ e(Re, { label: "Remover", children: /* @__PURE__ */ e(pe, { onClick: K, disabled: !m.length, children: /* @__PURE__ */ e(Aa, {}) }) })
147
147
  ] }),
148
- /* @__PURE__ */ o(_e, { style: { minWidth: "44%", minHeight: x }, children: [
149
- /* @__PURE__ */ e(w, { children: C }),
148
+ /* @__PURE__ */ r(ae, { style: { minWidth: "44%", minHeight: x }, children: [
149
+ /* @__PURE__ */ e(p, { children: C }),
150
150
  /* @__PURE__ */ e(
151
- Ee,
151
+ Le,
152
152
  {
153
153
  spacing: "xs",
154
154
  size: "sm",
@@ -160,25 +160,25 @@ function lr({
160
160
  overflowX: "hidden",
161
161
  height: "calc(100% - 32px)"
162
162
  },
163
- children: y.map((S) => /* @__PURE__ */ e(Ee.Item, { children: /* @__PURE__ */ e(
164
- ea,
163
+ children: w.map((E) => /* @__PURE__ */ e(Le.Item, { children: /* @__PURE__ */ e(
164
+ oa,
165
165
  {
166
- label: f(S, n),
167
- checked: d.includes(z(S, h)),
168
- onChange: () => oe(g, z(S, h))
166
+ label: b(E, h),
167
+ checked: m.includes(A(E, u)),
168
+ onChange: () => j(v, A(E, u))
169
169
  }
170
- ) }, z(S, h)))
170
+ ) }, A(E, u)))
171
171
  }
172
172
  )
173
173
  ] })
174
174
  ] });
175
175
  }
176
- const cr = Ha(
177
- ({ image: a, label: r, description: l, origin: i, ...h }, n) => /* @__PURE__ */ e("div", { ref: n, ...h, children: /* @__PURE__ */ o(Re, { children: [
178
- /* @__PURE__ */ e(w, { size: "sm", fw: 600, children: i ? i.name : "" }),
179
- /* @__PURE__ */ e(ua, { w: "lg" })
176
+ const vr = ir(
177
+ ({ image: a, label: t, description: o, origin: i, ...u }, h) => /* @__PURE__ */ e("div", { ref: h, ...u, children: /* @__PURE__ */ r(De, { children: [
178
+ /* @__PURE__ */ e(p, { size: "sm", fw: 600, children: i ? i.name : "" }),
179
+ /* @__PURE__ */ e(wa, { w: "lg" })
180
180
  ] }) })
181
- ), dr = {
181
+ ), yr = {
182
182
  // Campos de identificação
183
183
  showNickname: !0,
184
184
  // Campos de perfil e grupos
@@ -202,89 +202,89 @@ const cr = Ha(
202
202
  avatarImageQuality: 1,
203
203
  avatarMaxOutputSizePx: 512,
204
204
  allowEditEmail: !0
205
- }, ur = (a) => {
206
- const [r, l] = P(""), i = { ...dr, ...a.options ?? {} }, h = a.dataSource.getFieldValue("passwordChangedAt"), n = h ? new Date(h) : void 0, A = n && !Number.isNaN(n.getTime()) ? n.toLocaleString() : void 0, v = $a(i.passwordPolicy), x = i.forbidPersonalDataInPassword ? ["name", "nickname", "email"].map((t) => {
207
- const d = a.dataSource.getFieldValue(t);
208
- return t === "email" && d ? d.split("@")[0] : d;
209
- }).filter((t) => typeof t == "string" && t.trim().length >= 3) : [], c = v ? {
210
- ...v,
211
- blocklist: [...v.blocklist ?? [], ...x]
212
- } : void 0, C = X(Q.Group), { dataSource: u } = Je({
205
+ }, wr = (a) => {
206
+ const [t, o] = z(""), i = { ...yr, ...a.options ?? {} }, u = a.dataSource.getFieldValue("passwordChangedAt"), h = u ? new Date(u) : void 0, c = h && !Number.isNaN(h.getTime()) ? h.toLocaleString() : void 0, I = ja(i.passwordPolicy), x = i.forbidPersonalDataInPassword ? ["name", "nickname", "email"].map((l) => {
207
+ const m = a.dataSource.getFieldValue(l);
208
+ return l === "email" && m ? m.split("@")[0] : m;
209
+ }).filter((l) => typeof l == "string" && l.trim().length >= 3) : [], f = I ? {
210
+ ...I,
211
+ blocklist: [...I.blocklist ?? [], ...x]
212
+ } : void 0, C = J(Q.Group), { dataSource: S } = ea({
213
213
  name: "dsGroups",
214
214
  service: C,
215
215
  pageSize: 9999,
216
216
  loadOnStart: !0,
217
217
  sort: ["name:asc"],
218
- onError: (t, d) => {
219
- ee.showError(s().t("archbase:WARNING"), t, d);
218
+ onError: (l, m) => {
219
+ te.showError(g().t("archbase:WARNING"), l, m);
220
220
  }
221
221
  });
222
222
  console.log("versão 12/05/2026");
223
- const b = X(Q.Profile), { dataSource: D } = Je({
223
+ const n = J(Q.Profile), { dataSource: s } = ea({
224
224
  name: "dsProfiles",
225
- service: b,
225
+ service: n,
226
226
  pageSize: 9999,
227
227
  loadOnStart: !0,
228
228
  sort: ["name:asc"],
229
- onError: (t, d) => {
230
- ee.showError(s().t("archbase:WARNING"), t, d);
229
+ onError: (l, m) => {
230
+ te.showError(g().t("archbase:WARNING"), l, m);
231
231
  }
232
232
  });
233
- Se(() => {
234
- l("");
233
+ ee(() => {
234
+ o("");
235
235
  }, [a.dataSource.getFieldValue("password")]);
236
- const y = async () => {
236
+ const w = async () => {
237
237
  if (a.dataSource.isInserting()) {
238
238
  if (i.userDefaultProfile) {
239
- const t = Le(Ie.eq("name", i.userDefaultProfile)), d = await b.findAllWithFilter(t, 0, 1);
240
- d && d.content.length > 0 && a.dataSource.setFieldValue("profile", d.content[0]);
239
+ const l = Me(Fe.eq("name", i.userDefaultProfile)), m = await n.findAllWithFilter(l, 0, 1);
240
+ m && m.content.length > 0 && a.dataSource.setFieldValue("profile", m.content[0]);
241
241
  }
242
242
  if (i.userDefaultGroups) {
243
- const t = Le(Ie.in("name", i.userDefaultGroups)), d = await C.findAllWithFilter(t, 0, 500);
244
- d && d.content.length > 0 && a.dataSource.setFieldValue("groups", d.content.map((g) => sa.newInstance(g)));
243
+ const l = Me(Fe.in("name", i.userDefaultGroups)), m = await C.findAllWithFilter(l, 0, 500);
244
+ m && m.content.length > 0 && a.dataSource.setFieldValue("groups", m.content.map((v) => ha.newInstance(v)));
245
245
  }
246
246
  }
247
247
  };
248
- Se(() => {
249
- a.opened && y();
248
+ ee(() => {
249
+ a.opened && w();
250
250
  }, [a.opened]);
251
- const q = () => {
252
- const t = a.dataSource.getCurrentRecord();
253
- if (!t.password && a.dataSource.isInserting()) {
254
- l(s().t("archbase:Informe a senha"));
251
+ const D = () => {
252
+ const l = a.dataSource.getCurrentRecord();
253
+ if (!l.password && a.dataSource.isInserting()) {
254
+ o(g().t("archbase:Informe a senha"));
255
255
  return;
256
256
  }
257
- if (c && t.password) {
258
- const d = Na(t.password, c);
259
- if (!d.valid) {
260
- l(d.error);
257
+ if (f && l.password) {
258
+ const m = Za(l.password, f);
259
+ if (!m.valid) {
260
+ o(m.error);
261
261
  return;
262
262
  }
263
263
  }
264
- a.onCustomSave ? a.onCustomSave(t, (d) => {
265
- d && a.onAfterSave && a.onAfterSave(t), a.onClickOk(t, d);
266
- }) : a.onClickOk(t, !0);
267
- }, V = () => {
264
+ a.onCustomSave ? a.onCustomSave(l, (m) => {
265
+ m && a.onAfterSave && a.onAfterSave(l), a.onClickOk(l, m);
266
+ }) : a.onClickOk(l, !0);
267
+ }, d = () => {
268
268
  a.onClickCancel(a.dataSource.getCurrentRecord());
269
269
  };
270
- return /* @__PURE__ */ o(
271
- ze,
270
+ return /* @__PURE__ */ r(
271
+ Oe,
272
272
  {
273
273
  opened: a.opened,
274
- onClose: V,
275
- title: s().t("archbase:Usuário"),
274
+ onClose: d,
275
+ title: g().t("archbase:Usuário"),
276
276
  size: "80%",
277
277
  styles: { content: { maxWidth: 1e3 } },
278
278
  children: [
279
- /* @__PURE__ */ e(we, { style: { height: "500px" }, children: /* @__PURE__ */ o(W, { w: "98%", children: [
280
- i?.customContentBefore && /* @__PURE__ */ e(Ne, { children: i.customContentBefore(a.dataSource.getCurrentRecord()) }),
281
- /* @__PURE__ */ o(O, { children: [
282
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ o(N, { children: [
279
+ /* @__PURE__ */ e(fe, { style: { height: "500px" }, children: /* @__PURE__ */ r(L, { w: "98%", children: [
280
+ i?.customContentBefore && /* @__PURE__ */ e(Pe, { children: i.customContentBefore(a.dataSource.getCurrentRecord()) }),
281
+ /* @__PURE__ */ r(W, { children: [
282
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ r(N, { children: [
283
283
  /* @__PURE__ */ e(
284
- re,
284
+ ne,
285
285
  {
286
- label: `${s().t("archbase:Nome completo")}`,
287
- placeholder: `${s().t("archbase:Informe o nome completo do usuário")}`,
286
+ label: `${g().t("archbase:Nome completo")}`,
287
+ placeholder: `${g().t("archbase:Informe o nome completo do usuário")}`,
288
288
  dataSource: a.dataSource,
289
289
  dataField: "name",
290
290
  required: !0,
@@ -292,131 +292,131 @@ const cr = Ha(
292
292
  }
293
293
  ),
294
294
  i.showNickname && /* @__PURE__ */ e(
295
- re,
295
+ ne,
296
296
  {
297
- label: `${s().t("archbase:Apelido")}`,
298
- placeholder: `${s().t("archbase:Apelido")}`,
297
+ label: `${g().t("archbase:Apelido")}`,
298
+ placeholder: `${g().t("archbase:Apelido")}`,
299
299
  dataSource: a.dataSource,
300
300
  dataField: "nickname",
301
301
  required: i.requiredNickname
302
302
  }
303
303
  )
304
304
  ] }) }),
305
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
306
- re,
305
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
306
+ ne,
307
307
  {
308
- label: `${s().t("archbase:Descrição do usuário")}`,
309
- placeholder: `${s().t("archbase:Informe a descrição do usuário")}`,
308
+ label: `${g().t("archbase:Descrição do usuário")}`,
309
+ placeholder: `${g().t("archbase:Informe a descrição do usuário")}`,
310
310
  dataSource: a.dataSource,
311
311
  dataField: "description",
312
312
  required: !0
313
313
  }
314
314
  ) })
315
315
  ] }),
316
- /* @__PURE__ */ o(O, { children: [
317
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
318
- re,
316
+ /* @__PURE__ */ r(W, { children: [
317
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
318
+ ne,
319
319
  {
320
- label: `${s().t("archbase:E-mail")}`,
321
- placeholder: `${s().t("archbase:Informe o e-mail do usuário")}`,
320
+ label: `${g().t("archbase:E-mail")}`,
321
+ placeholder: `${g().t("archbase:Informe o e-mail do usuário")}`,
322
322
  dataSource: a.dataSource,
323
- onChangeValue: (t) => a.dataSource.setFieldValue("userName", t),
323
+ onChangeValue: (l) => a.dataSource.setFieldValue("userName", l),
324
324
  dataField: "email",
325
325
  readOnly: a.dataSource.isEditing() ? !i.allowEditEmail : !1,
326
326
  required: !0
327
327
  }
328
328
  ) }),
329
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
330
- Oa,
329
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
330
+ Ya,
331
331
  {
332
- label: `${s().t("archbase:Senha usuário")}`,
332
+ label: `${g().t("archbase:Senha usuário")}`,
333
333
  dataSource: a.dataSource,
334
334
  dataField: "password",
335
- error: r,
335
+ error: t,
336
336
  required: a.dataSource.getFieldValue("isNewUser"),
337
- passwordPolicy: c,
337
+ passwordPolicy: f,
338
338
  showPasswordRequirements: i.showPasswordRequirements
339
339
  }
340
340
  ) })
341
341
  ] }),
342
- /* @__PURE__ */ e(O, { children: i.showProfile && /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
343
- Ua,
342
+ /* @__PURE__ */ e(W, { children: i.showProfile && /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 6, lg: 6 }, children: /* @__PURE__ */ e(
343
+ _a,
344
344
  {
345
- label: `${s().t("archbase:Perfil do usuário")}`,
345
+ label: `${g().t("archbase:Perfil do usuário")}`,
346
346
  dataSource: a.dataSource,
347
347
  dataField: "profile",
348
- options: D,
348
+ options: s,
349
349
  allowDeselect: !0,
350
350
  optionsLabelField: "nome",
351
- itemComponent: cr,
352
- getOptionLabel: (t) => t.name,
353
- getOptionValue: (t) => t.id
351
+ itemComponent: vr,
352
+ getOptionLabel: (l) => l.name,
353
+ getOptionValue: (l) => l.id
354
354
  }
355
355
  ) }) }),
356
- /* @__PURE__ */ o(O, { children: [
357
- /* @__PURE__ */ e(O.Col, { span: { base: 12 }, children: i.showAccountConfigLabel && /* @__PURE__ */ e(w, { fz: 14, fw: 500, children: "Informe" }) }),
358
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 4, lg: 4 }, children: /* @__PURE__ */ o(W, { gap: "lg", children: [
359
- i.showChangePasswordOnNextLogin && /* @__PURE__ */ e(be.Wrapper, { label: "", children: /* @__PURE__ */ e(
360
- ve,
356
+ /* @__PURE__ */ r(W, { children: [
357
+ /* @__PURE__ */ e(W.Col, { span: { base: 12 }, children: i.showAccountConfigLabel && /* @__PURE__ */ e(p, { fz: 14, fw: 500, children: "Informe" }) }),
358
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 4, lg: 4 }, children: /* @__PURE__ */ r(L, { gap: "lg", children: [
359
+ i.showChangePasswordOnNextLogin && /* @__PURE__ */ e(Te.Wrapper, { label: "", children: /* @__PURE__ */ e(
360
+ Ae,
361
361
  {
362
362
  dataSource: a.dataSource,
363
363
  dataField: "changePasswordOnNextLogin",
364
- label: `${s().t("archbase:Deve alterar senha próximo login ?")}`
364
+ label: `${g().t("archbase:Deve alterar senha próximo login ?")}`
365
365
  }
366
366
  ) }),
367
- i.showAllowPasswordChange && /* @__PURE__ */ e(be.Wrapper, { label: "", children: /* @__PURE__ */ e(
368
- ve,
367
+ i.showAllowPasswordChange && /* @__PURE__ */ e(Te.Wrapper, { label: "", children: /* @__PURE__ */ e(
368
+ Ae,
369
369
  {
370
370
  dataSource: a.dataSource,
371
371
  dataField: "allowPasswordChange",
372
- label: `${s().t("archbase:Pode alterar a senha ?")}`
372
+ label: `${g().t("archbase:Pode alterar a senha ?")}`
373
373
  }
374
374
  ) }),
375
- i.showPasswordNeverExpires && /* @__PURE__ */ o(be.Wrapper, { label: "", children: [
375
+ i.showPasswordNeverExpires && /* @__PURE__ */ r(Te.Wrapper, { label: "", children: [
376
376
  /* @__PURE__ */ e(
377
- ve,
377
+ Ae,
378
378
  {
379
379
  dataSource: a.dataSource,
380
380
  dataField: "passwordNeverExpires",
381
- label: `${s().t("archbase:Senha nunca expira ?")}`
381
+ label: `${g().t("archbase:Senha nunca expira ?")}`
382
382
  }
383
383
  ),
384
- /* @__PURE__ */ e(w, { fz: 12, c: "dimmed", children: s().t(
384
+ /* @__PURE__ */ e(p, { fz: 12, c: "dimmed", children: g().t(
385
385
  'archbase:Desmarcado, a senha expira conforme a política de validade do servidor. Para exigir a troca agora, use "Deve alterar senha próximo login".'
386
386
  ) })
387
387
  ] }),
388
- i.showPasswordChangedAt && A && /* @__PURE__ */ e(w, { fz: 12, c: "dimmed", children: `${s().t("archbase:Última troca de senha")}: ${A}` })
388
+ i.showPasswordChangedAt && c && /* @__PURE__ */ e(p, { fz: 12, c: "dimmed", children: `${g().t("archbase:Última troca de senha")}: ${c}` })
389
389
  ] }) }),
390
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 4, lg: 4 }, children: /* @__PURE__ */ o(W, { gap: "lg", children: [
391
- i.showAccountDeactivated && /* @__PURE__ */ e(be.Wrapper, { label: "", children: /* @__PURE__ */ e(
392
- ve,
390
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 4, lg: 4 }, children: /* @__PURE__ */ r(L, { gap: "lg", children: [
391
+ i.showAccountDeactivated && /* @__PURE__ */ e(Te.Wrapper, { label: "", children: /* @__PURE__ */ e(
392
+ Ae,
393
393
  {
394
394
  dataSource: a.dataSource,
395
395
  dataField: "accountDeactivated",
396
- label: `${s().t("archbase:Conta desativada ?")}`
396
+ label: `${g().t("archbase:Conta desativada ?")}`
397
397
  }
398
398
  ) }),
399
- i.showAccountLocked && /* @__PURE__ */ e(be.Wrapper, { label: "", children: /* @__PURE__ */ e(
400
- ve,
399
+ i.showAccountLocked && /* @__PURE__ */ e(Te.Wrapper, { label: "", children: /* @__PURE__ */ e(
400
+ Ae,
401
401
  {
402
402
  dataSource: a.dataSource,
403
403
  dataField: "accountLocked",
404
- label: `${s().t("archbase:Conta bloqueada ?")}`
404
+ label: `${g().t("archbase:Conta bloqueada ?")}`
405
405
  }
406
406
  ) }),
407
- i.showIsAdministrator && /* @__PURE__ */ e(be.Wrapper, { label: "", children: /* @__PURE__ */ e(
408
- ve,
407
+ i.showIsAdministrator && /* @__PURE__ */ e(Te.Wrapper, { label: "", children: /* @__PURE__ */ e(
408
+ Ae,
409
409
  {
410
410
  dataSource: a.dataSource,
411
411
  dataField: "isAdministrator",
412
- label: `${s().t("archbase:Administrador ?")}`
412
+ label: `${g().t("archbase:Administrador ?")}`
413
413
  }
414
414
  ) })
415
415
  ] }) }),
416
- /* @__PURE__ */ e(O.Col, { span: { base: 12, md: 4, lg: 4 }, children: /* @__PURE__ */ e(W, { gap: "lg", children: /* @__PURE__ */ e(
417
- Ba,
416
+ /* @__PURE__ */ e(W.Col, { span: { base: 12, md: 4, lg: 4 }, children: /* @__PURE__ */ e(L, { gap: "lg", children: /* @__PURE__ */ e(
417
+ er,
418
418
  {
419
- label: s().t("archbase:Foto do usuário"),
419
+ label: g().t("archbase:Foto do usuário"),
420
420
  dataSource: a.dataSource,
421
421
  dataField: "avatar",
422
422
  width: 120,
@@ -427,14 +427,14 @@ const cr = Ha(
427
427
  }
428
428
  ) }) })
429
429
  ] }),
430
- i.showGroups && /* @__PURE__ */ o(O, { children: [
431
- /* @__PURE__ */ e(O.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(w, { fz: 14, fw: 500, children: "Grupos" }) }),
432
- /* @__PURE__ */ e(O.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(
433
- lr,
430
+ i.showGroups && /* @__PURE__ */ r(W, { children: [
431
+ /* @__PURE__ */ e(W.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(p, { fz: 14, fw: 500, children: "Grupos" }) }),
432
+ /* @__PURE__ */ e(W.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(
433
+ br,
434
434
  {
435
- titleAvailable: s().t("archbase:Disponíveis"),
436
- titleAssigned: s().t("archbase:Selecionados"),
437
- assignedItemsDS: new qa("dsDualList", {
435
+ titleAvailable: g().t("archbase:Disponíveis"),
436
+ titleAssigned: g().t("archbase:Selecionados"),
437
+ assignedItemsDS: new rr("dsDualList", {
438
438
  records: a.dataSource.getFieldValue("groups"),
439
439
  grandTotalRecords: a.dataSource.getFieldValue("groups").length,
440
440
  currentPage: 0,
@@ -443,335 +443,335 @@ const cr = Ha(
443
443
  }),
444
444
  width: "100%",
445
445
  height: "200px",
446
- availableItemsDS: u,
447
- handleCreateAssociationObject: (t) => sa.newInstance(t),
448
- idFieldAssigned: (t) => t && t.group ? t.group.id : "",
446
+ availableItemsDS: S,
447
+ handleCreateAssociationObject: (l) => ha.newInstance(l),
448
+ idFieldAssigned: (l) => l && l.group ? l.group.id : "",
449
449
  idFieldAvailable: "id",
450
- labelFieldAssigned: (t) => t && t.group ? t.group.name : "",
450
+ labelFieldAssigned: (l) => l && l.group ? l.group.name : "",
451
451
  labelFieldAvailable: "name"
452
452
  }
453
453
  ) })
454
454
  ] }),
455
- i?.customContentAfter && /* @__PURE__ */ e(Ne, { children: i.customContentAfter(a.dataSource.getCurrentRecord()) }),
456
- /* @__PURE__ */ e(ua, { h: "12px" })
455
+ i?.customContentAfter && /* @__PURE__ */ e(Pe, { children: i.customContentAfter(a.dataSource.getCurrentRecord()) }),
456
+ /* @__PURE__ */ e(wa, { h: "12px" })
457
457
  ] }) }),
458
- /* @__PURE__ */ o(N, { justify: "flex-end", mt: "md", children: [
459
- /* @__PURE__ */ e(Z, { variant: "default", onClick: V, children: s().t("archbase:Cancelar") }),
460
- /* @__PURE__ */ e(Z, { onClick: q, children: s().t("archbase:Salvar") })
458
+ /* @__PURE__ */ r(N, { justify: "flex-end", mt: "md", children: [
459
+ /* @__PURE__ */ e(Y, { variant: "default", onClick: d, children: g().t("archbase:Cancelar") }),
460
+ /* @__PURE__ */ e(Y, { onClick: D, children: g().t("archbase:Salvar") })
461
461
  ] })
462
462
  ]
463
463
  }
464
464
  );
465
- }, hr = (a) => {
466
- const r = { ...a.options ?? {} }, l = () => {
467
- a.onCustomSave ? a.onCustomSave(a.dataSource.getCurrentRecord(), (h) => {
468
- h && a.onAfterSave && a.onAfterSave(a.dataSource.getCurrentRecord()), a.onClickOk(a.dataSource.getCurrentRecord(), h);
465
+ }, Cr = (a) => {
466
+ const t = { ...a.options ?? {} }, o = () => {
467
+ a.onCustomSave ? a.onCustomSave(a.dataSource.getCurrentRecord(), (u) => {
468
+ u && a.onAfterSave && a.onAfterSave(a.dataSource.getCurrentRecord()), a.onClickOk(a.dataSource.getCurrentRecord(), u);
469
469
  }) : a.onClickOk(a.dataSource.getCurrentRecord(), !0);
470
470
  }, i = () => {
471
471
  a.onClickCancel(a.dataSource.getCurrentRecord());
472
472
  };
473
473
  return /* @__PURE__ */ e(
474
- ze,
474
+ Oe,
475
475
  {
476
476
  opened: a.opened,
477
477
  onClose: i,
478
- title: s().t("archbase:Grupo"),
478
+ title: g().t("archbase:Grupo"),
479
479
  size: "60%",
480
480
  styles: { content: { maxWidth: 1e3 } },
481
- children: /* @__PURE__ */ e(we, { style: { height: "460px" }, children: /* @__PURE__ */ o(W, { w: "98%", children: [
482
- r?.customContentBefore && r.customContentBefore(a.dataSource.getCurrentRecord()),
483
- /* @__PURE__ */ o(O, { children: [
484
- /* @__PURE__ */ e(O.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(
485
- re,
481
+ children: /* @__PURE__ */ e(fe, { style: { height: "460px" }, children: /* @__PURE__ */ r(L, { w: "98%", children: [
482
+ t?.customContentBefore && t.customContentBefore(a.dataSource.getCurrentRecord()),
483
+ /* @__PURE__ */ r(W, { children: [
484
+ /* @__PURE__ */ e(W.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(
485
+ ne,
486
486
  {
487
- label: `${s().t("archbase:Nome do grupo")}`,
488
- placeholder: `${s().t("archbase:Informe o nome do grupo")}`,
487
+ label: `${g().t("archbase:Nome do grupo")}`,
488
+ placeholder: `${g().t("archbase:Informe o nome do grupo")}`,
489
489
  dataSource: a.dataSource,
490
490
  dataField: "name"
491
491
  }
492
492
  ) }),
493
- /* @__PURE__ */ e(O.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(
494
- re,
493
+ /* @__PURE__ */ e(W.Col, { span: { base: 12 }, children: /* @__PURE__ */ e(
494
+ ne,
495
495
  {
496
- label: `${s().t("archbase:Descrição do grupo")}`,
497
- placeholder: `${s().t("archbase:Informe a descrição do grupo")}`,
496
+ label: `${g().t("archbase:Descrição do grupo")}`,
497
+ placeholder: `${g().t("archbase:Informe a descrição do grupo")}`,
498
498
  dataSource: a.dataSource,
499
499
  dataField: "description"
500
500
  }
501
501
  ) })
502
502
  ] }),
503
- r?.customContentAfter && r.customContentAfter(a.dataSource.getCurrentRecord()),
504
- /* @__PURE__ */ o(N, { justify: "flex-end", mt: "md", children: [
505
- /* @__PURE__ */ e(Z, { variant: "default", onClick: i, children: s().t("archbase:Cancelar") }),
506
- /* @__PURE__ */ e(Z, { onClick: l, children: s().t("archbase:Salvar") })
503
+ t?.customContentAfter && t.customContentAfter(a.dataSource.getCurrentRecord()),
504
+ /* @__PURE__ */ r(N, { justify: "flex-end", mt: "md", children: [
505
+ /* @__PURE__ */ e(Y, { variant: "default", onClick: i, children: g().t("archbase:Cancelar") }),
506
+ /* @__PURE__ */ e(Y, { onClick: o, children: g().t("archbase:Salvar") })
507
507
  ] })
508
508
  ] }) })
509
509
  }
510
510
  );
511
- }, pr = ({ image: a, label: r, description: l, ...i }) => /* @__PURE__ */ e("div", { ...i, children: /* @__PURE__ */ o(N, { grow: !0, children: [
511
+ }, Sr = ({ image: a, label: t, description: o, ...i }) => /* @__PURE__ */ e("div", { ...i, children: /* @__PURE__ */ r(N, { grow: !0, children: [
512
512
  /* @__PURE__ */ e("img", { style: { maxWidth: "32px" }, src: a }),
513
- /* @__PURE__ */ o("div", { children: [
514
- /* @__PURE__ */ e(w, { size: "sm", children: r }),
515
- /* @__PURE__ */ e(w, { size: "xs", opacity: 0.65, children: l })
513
+ /* @__PURE__ */ r("div", { children: [
514
+ /* @__PURE__ */ e(p, { size: "sm", children: t }),
515
+ /* @__PURE__ */ e(p, { size: "xs", opacity: 0.65, children: o })
516
516
  ] })
517
- ] }) }), mr = (a) => {
518
- tr();
519
- const [r, l] = P(), i = X(Q.User), h = Pe(
517
+ ] }) }), Tr = (a) => {
518
+ hr();
519
+ const [t, o] = z(), i = J(Q.User), u = Ne(
520
520
  "ApiTokenModal",
521
521
  a.dataSource,
522
522
  "expirationDate",
523
523
  ""
524
524
  );
525
- process.env.NODE_ENV === "development" && a.dataSource && console.log(`[ApiTokenModal] DataSource version: ${h.dataSourceVersion}`);
526
- const n = (c) => {
527
- if (!c)
528
- h.handleValueChange(void 0);
525
+ process.env.NODE_ENV === "development" && a.dataSource && console.log(`[ApiTokenModal] DataSource version: ${u.dataSourceVersion}`);
526
+ const h = (f) => {
527
+ if (!f)
528
+ u.handleValueChange(void 0);
529
529
  else {
530
- const C = typeof c == "string" ? new Date(c) : c, u = La(C);
531
- h.handleValueChange(u);
530
+ const C = typeof f == "string" ? new Date(f) : f, S = Ka(C);
531
+ u.handleValueChange(S);
532
532
  }
533
- l(c);
534
- }, A = async (c, C) => new Promise(async (u, b) => {
533
+ o(f);
534
+ }, c = async (f, C) => new Promise(async (S, n) => {
535
535
  try {
536
- const D = Le(Ie.or(Ie.eq("name", `^*${C.trim()}*`))), y = await i.findAllWithFilter(D, c, 20);
537
- u({
538
- options: y.content,
539
- page: y.pageable.pageNumber,
540
- totalPages: y.totalPages
536
+ const s = Me(Fe.or(Fe.eq("name", `^*${C.trim()}*`))), w = await i.findAllWithFilter(s, f, 20);
537
+ S({
538
+ options: w.content,
539
+ page: w.pageable.pageNumber,
540
+ totalPages: w.totalPages
541
541
  });
542
- } catch (D) {
543
- b(he(D));
542
+ } catch (s) {
543
+ n(ge(s));
544
544
  }
545
- }), v = () => {
546
- a.onCustomSave ? a.onCustomSave(a.dataSource.current, (c) => {
547
- c && a.onAfterSave && a.onAfterSave(a.dataSource.current), a.onClickOk(a.dataSource.current, c);
545
+ }), I = () => {
546
+ a.onCustomSave ? a.onCustomSave(a.dataSource.current, (f) => {
547
+ f && a.onAfterSave && a.onAfterSave(a.dataSource.current), a.onClickOk(a.dataSource.current, f);
548
548
  }) : a.onClickOk(a.dataSource.current, !0);
549
549
  }, x = () => {
550
550
  a.onClickCancel(a.dataSource.current);
551
551
  };
552
- return /* @__PURE__ */ o(
553
- ze,
552
+ return /* @__PURE__ */ r(
553
+ Oe,
554
554
  {
555
555
  opened: a.opened,
556
556
  onClose: x,
557
- title: s().t("archbase:Token de API"),
557
+ title: g().t("archbase:Token de API"),
558
558
  size: "50%",
559
559
  children: [
560
- /* @__PURE__ */ o(we, { style: { height: "300px" }, children: [
560
+ /* @__PURE__ */ r(fe, { style: { height: "300px" }, children: [
561
561
  /* @__PURE__ */ e(
562
- re,
562
+ ne,
563
563
  {
564
- label: `${s().t("archbase:Nome do token")}`,
565
- placeholder: `${s().t("archbase:Informe o nome do token")}`,
564
+ label: `${g().t("archbase:Nome do token")}`,
565
+ placeholder: `${g().t("archbase:Informe o nome do token")}`,
566
566
  dataSource: a.dataSource,
567
567
  dataField: "name"
568
568
  }
569
569
  ),
570
570
  /* @__PURE__ */ e(
571
- re,
571
+ ne,
572
572
  {
573
- label: `${s().t("archbase:Descrição do token")}`,
574
- placeholder: `${s().t("archbase:Informe a descrição do token")}`,
573
+ label: `${g().t("archbase:Descrição do token")}`,
574
+ placeholder: `${g().t("archbase:Informe a descrição do token")}`,
575
575
  dataSource: a.dataSource,
576
576
  dataField: "description"
577
577
  }
578
578
  ),
579
579
  /* @__PURE__ */ e(
580
- rr,
580
+ ur,
581
581
  {
582
582
  withSeconds: !0,
583
- value: r,
584
- onChange: n,
583
+ value: t,
584
+ onChange: h,
585
585
  label: "Data/hora expiração",
586
586
  placeholder: "Selecione a data de expiração"
587
587
  }
588
588
  ),
589
589
  /* @__PURE__ */ e(
590
- Wa,
590
+ ar,
591
591
  {
592
- label: `${s().t("archbase:Usuário")}`,
592
+ label: `${g().t("archbase:Usuário")}`,
593
593
  dataSource: a.dataSource,
594
594
  dataField: "user",
595
- placeholder: `${s().t("archbase:Digite aqui o nome do usuário")}`,
596
- getOptionLabel: (c) => c && c.email ? c.email : "",
597
- getOptionValue: (c) => c && c.id ? c.id.toString() : "",
598
- getOptions: A,
595
+ placeholder: `${g().t("archbase:Digite aqui o nome do usuário")}`,
596
+ getOptionLabel: (f) => f && f.email ? f.email : "",
597
+ getOptionValue: (f) => f && f.id ? f.id.toString() : "",
598
+ getOptions: c,
599
599
  debounceTime: 500,
600
600
  minCharsToSearch: 1,
601
- itemComponent: pr
601
+ itemComponent: Sr
602
602
  }
603
603
  )
604
604
  ] }),
605
- /* @__PURE__ */ o(N, { justify: "flex-end", mt: "md", children: [
606
- /* @__PURE__ */ e(Z, { variant: "default", onClick: x, children: s().t("archbase:Cancelar") }),
607
- /* @__PURE__ */ e(Z, { onClick: v, children: s().t("archbase:Salvar") })
605
+ /* @__PURE__ */ r(N, { justify: "flex-end", mt: "md", children: [
606
+ /* @__PURE__ */ e(Y, { variant: "default", onClick: x, children: g().t("archbase:Cancelar") }),
607
+ /* @__PURE__ */ e(Y, { onClick: I, children: g().t("archbase:Salvar") })
608
608
  ] })
609
609
  ]
610
610
  }
611
611
  );
612
- }, ca = (a) => {
613
- const r = "->";
614
- return a.includes(r) ? a.split(r).map((h) => h.trim()).map((h) => s().t(h)).join(` ${r} `) : s().t(a);
612
+ }, pa = (a) => {
613
+ const t = "->";
614
+ return a.includes(t) ? a.split(t).map((u) => u.trim()).map((u) => g().t(u)).join(` ${t} `) : g().t(a);
615
615
  };
616
- function qe({ dataSource: a, opened: r, close: l }) {
617
- const i = ae(() => a?.getFieldValue("name") || "", [a]), h = ae(() => a?.getFieldValue("id") || "", [a]), n = ae(() => a?.getFieldValue("type") || "", [a]), A = aa(), v = aa(), [x, c] = P([]), [C, u] = P([]), [b, D] = P(), [y, q] = P(), [V, t] = P(""), [d] = la(V, 200), [g, F] = P(""), [z] = la(g, 200), f = X(Q.Resource), { colorScheme: oe } = Ge(), G = oe === "dark" ? "var(--mantine-primary-color-7)" : "var(--mantine-primary-color-4)", J = ae(() => C.sort((p, m) => p.resourceDescription.localeCompare(m.resourceDescription)).map((p) => ({
618
- value: p.resourceId,
619
- label: p.resourceDescription,
620
- children: p.permissions.filter((m) => m.actionDescription.toLowerCase().includes(z.toLowerCase())).sort((m, M) => m.actionDescription.localeCompare(M.actionDescription)).map((m) => ({
621
- value: m.actionId,
622
- label: m.actionDescription,
616
+ function Ke({ dataSource: a, opened: t, close: o }) {
617
+ const i = ie(() => a?.getFieldValue("name") || "", [a]), u = ie(() => a?.getFieldValue("id") || "", [a]), h = ie(() => a?.getFieldValue("type") || "", [a]), c = na(), I = na(), [x, f] = z([]), [C, S] = z([]), [n, s] = z(), [w, D] = z(), [d, l] = z(""), [m] = aa(d, 200), [v, T] = z(""), [A] = aa(v, 200), b = J(Q.Resource), { colorScheme: j } = Be(), G = j === "dark" ? "var(--mantine-primary-color-7)" : "var(--mantine-primary-color-4)", K = ie(() => C.sort((R, k) => R.resourceDescription.localeCompare(k.resourceDescription)).map((R) => ({
618
+ value: R.resourceId,
619
+ label: R.resourceDescription,
620
+ children: R.permissions.filter((k) => k.actionDescription.toLowerCase().includes(A.toLowerCase())).sort((k, B) => k.actionDescription.localeCompare(B.actionDescription)).map((k) => ({
621
+ value: k.actionId,
622
+ label: k.actionDescription,
623
623
  nodeProps: {
624
- permissionId: m.permissionId,
625
- types: m.types ?? [],
626
- owner: p
624
+ permissionId: k.permissionId,
625
+ types: k.types ?? [],
626
+ owner: R
627
627
  }
628
628
  }))
629
- })), [C, z]), S = ae(() => C.map((p) => p.permissions.map((m) => m.actionId)).flat(), [C]), k = ae(() => x.sort((p, m) => p.resourceDescription.localeCompare(m.resourceDescription)).map((p) => ({
630
- value: p.resourceId,
631
- label: p.resourceDescription,
632
- children: p.permissions.filter((m) => m.actionDescription.toLowerCase().includes(d.toLowerCase())).sort((m, M) => m.actionDescription.localeCompare(M.actionDescription)).map((m) => {
633
- const M = C.find((E) => E.resourceId === p.resourceId)?.permissions.find((E) => E.actionId === m.actionId);
629
+ })), [C, A]), E = ie(() => C.map((R) => R.permissions.map((k) => k.actionId)).flat(), [C]), O = ie(() => x.sort((R, k) => R.resourceDescription.localeCompare(k.resourceDescription)).map((R) => ({
630
+ value: R.resourceId,
631
+ label: R.resourceDescription,
632
+ children: R.permissions.filter((k) => k.actionDescription.toLowerCase().includes(m.toLowerCase())).sort((k, B) => k.actionDescription.localeCompare(B.actionDescription)).map((k) => {
633
+ const B = C.find((V) => V.resourceId === R.resourceId)?.permissions.find((V) => V.actionId === k.actionId);
634
634
  return {
635
- value: m.actionId,
636
- label: m.actionDescription,
635
+ value: k.actionId,
636
+ label: k.actionDescription,
637
637
  nodeProps: {
638
- granted: S.includes(m.actionId) && M?.types?.includes(me(H, n)),
639
- owner: p
638
+ granted: E.includes(k.actionId) && B?.types?.includes(Ce(X, h)),
639
+ owner: R
640
640
  }
641
641
  };
642
642
  })
643
- })), [x, C, S, n, d]), R = de(async () => {
644
- if (h) {
645
- const p = await f.getPermissionsBySecurityId(h, n), m = await f.getAllPermissionsAvailable();
646
- c(m), u(p);
643
+ })), [x, C, E, h, m]), F = oe(async () => {
644
+ if (u) {
645
+ const R = await b.getPermissionsBySecurityId(u, h), k = await b.getAllPermissionsAvailable();
646
+ f(k), S(R);
647
647
  }
648
- }, [h, n]), fe = de(() => {
649
- b?.value && h && f.createPermission(h, b.value, n).then((p) => {
650
- if (p) {
651
- u((U) => {
652
- let $;
653
- return U.map((B) => B.resourceId).includes(p.resourceId) ? $ = U.map((B) => B.resourceId === p.resourceId ? B.permissions.map((L) => L.actionId).includes(b.value) ? {
654
- ...B,
655
- permissions: B.permissions.map(
656
- (L) => L.actionId === b.value ? {
657
- ...L,
658
- permissionId: p.permissionId,
659
- types: [...L.types ?? [], me(H, n)]
660
- } : L
648
+ }, [u, h]), Se = oe(() => {
649
+ n?.value && u && b.createPermission(u, n.value, h).then((R) => {
650
+ if (R) {
651
+ S((q) => {
652
+ let M;
653
+ return q.map((H) => H.resourceId).includes(R.resourceId) ? M = q.map((H) => H.resourceId === R.resourceId ? H.permissions.map((U) => U.actionId).includes(n.value) ? {
654
+ ...H,
655
+ permissions: H.permissions.map(
656
+ (U) => U.actionId === n.value ? {
657
+ ...U,
658
+ permissionId: R.permissionId,
659
+ types: [...U.types ?? [], Ce(X, h)]
660
+ } : U
661
661
  )
662
662
  } : {
663
- ...B,
663
+ ...H,
664
664
  permissions: [
665
- ...B.permissions ?? [],
665
+ ...H.permissions ?? [],
666
666
  {
667
- actionId: p.actionId,
668
- actionDescription: p.actionDescription,
669
- permissionId: p.permissionId,
670
- types: [me(H, n)]
667
+ actionId: R.actionId,
668
+ actionDescription: R.actionDescription,
669
+ permissionId: R.permissionId,
670
+ types: [Ce(X, h)]
671
671
  }
672
672
  ]
673
- } : B) : $ = [
674
- ...U,
673
+ } : H) : M = [
674
+ ...q,
675
675
  {
676
- resourceId: p.resourceId,
677
- resourceDescription: p.resourceDescription,
676
+ resourceId: R.resourceId,
677
+ resourceDescription: R.resourceDescription,
678
678
  permissions: [
679
679
  {
680
- actionId: p.actionId,
681
- actionDescription: p.actionDescription,
682
- permissionId: p.permissionId,
683
- types: [me(H, n)]
680
+ actionId: R.actionId,
681
+ actionDescription: R.actionDescription,
682
+ permissionId: R.permissionId,
683
+ types: [Ce(X, h)]
684
684
  }
685
685
  ]
686
686
  }
687
- ], $;
687
+ ], M;
688
688
  });
689
- const m = k.filter((U) => U.value === b?.nodeProps?.owner?.resourceId).map((U) => U.children).flat(), M = m.map((U) => U.value).indexOf(b.value), E = m.find((U, $) => !U?.nodeProps?.granted && U?.value !== b.value && (m.length > M + 1 ? $ > M : !0));
690
- E?.value && A.select(E.value), v.expand(p.resourceId), D(E);
689
+ const k = O.filter((q) => q.value === n?.nodeProps?.owner?.resourceId).map((q) => q.children).flat(), B = k.map((q) => q.value).indexOf(n.value), V = k.find((q, M) => !q?.nodeProps?.granted && q?.value !== n.value && (k.length > B + 1 ? M > B : !0));
690
+ V?.value && c.select(V.value), I.expand(R.resourceId), s(V);
691
691
  }
692
692
  });
693
- }, [b, h, n, f, k, x, C, A, v]), pe = de(() => {
694
- y?.nodeProps?.permissionId && f.deletePermission(y.nodeProps.permissionId).then(() => {
695
- u((E) => [...E].filter(($) => {
696
- let B = !0;
697
- return $.permissions?.forEach((L) => {
698
- L.permissionId !== void 0 && L.permissionId === y?.nodeProps?.permissionId && $.permissions.length === 1 && L?.types?.length === 1 && L.types[0] === me(H, n) && (B = !1);
699
- }), B;
700
- }).map(($) => {
701
- const B = y?.nodeProps?.owner;
702
- return $.resourceId === B.resourceId ? y?.nodeProps?.types?.length === 1 ? {
703
- ...$,
704
- permissions: [...($.permissions ?? []).filter((L) => L.permissionId !== y?.nodeProps?.permissionId)]
693
+ }, [n, u, h, b, O, x, C, c, I]), ye = oe(() => {
694
+ w?.nodeProps?.permissionId && b.deletePermission(w.nodeProps.permissionId).then(() => {
695
+ S((V) => [...V].filter((M) => {
696
+ let H = !0;
697
+ return M.permissions?.forEach((U) => {
698
+ U.permissionId !== void 0 && U.permissionId === w?.nodeProps?.permissionId && M.permissions.length === 1 && U?.types?.length === 1 && U.types[0] === Ce(X, h) && (H = !1);
699
+ }), H;
700
+ }).map((M) => {
701
+ const H = w?.nodeProps?.owner;
702
+ return M.resourceId === H.resourceId ? w?.nodeProps?.types?.length === 1 ? {
703
+ ...M,
704
+ permissions: [...(M.permissions ?? []).filter((U) => U.permissionId !== w?.nodeProps?.permissionId)]
705
705
  } : {
706
- ...$,
707
- permissions: ($.permissions ?? []).map((L) => L.actionId === y.value ? {
708
- actionId: L.actionId,
709
- actionDescription: L.actionDescription,
710
- types: [...L.types?.filter((ie) => ie && ie !== me(H, n)) ?? []]
711
- } : L)
712
- } : $;
706
+ ...M,
707
+ permissions: (M.permissions ?? []).map((U) => U.actionId === w.value ? {
708
+ actionId: U.actionId,
709
+ actionDescription: U.actionDescription,
710
+ types: [...U.types?.filter((se) => se && se !== Ce(X, h)) ?? []]
711
+ } : U)
712
+ } : M;
713
713
  }));
714
- const p = J.filter((E) => E.value === y?.nodeProps?.owner?.resourceId).map((E) => E.children).flat(), m = p.map((E) => E.value).indexOf(y.value), M = p.find((E, U) => E?.nodeProps?.types.includes(me(H, n)) && E?.value !== y.value && (p.length > m + 1 ? U > m : !0));
715
- M?.value && v.select(M.value), q(M);
714
+ const R = K.filter((V) => V.value === w?.nodeProps?.owner?.resourceId).map((V) => V.children).flat(), k = R.map((V) => V.value).indexOf(w.value), B = R.find((V, q) => V?.nodeProps?.types.includes(Ce(X, h)) && V?.value !== w.value && (R.length > k + 1 ? q > k : !0));
715
+ B?.value && I.select(B.value), D(B);
716
716
  });
717
- }, [y, f, n, J, C, v]);
718
- return Se(() => {
719
- r && a && (D(void 0), q(void 0), t(""), F(""), v.collapseAllNodes(), A.collapseAllNodes(), R());
720
- }, [r, n, h, R]), a ? /* @__PURE__ */ e(ze, { opened: r, onClose: l, title: `${s().t(`archbase:${n}`)}: ${i}`, size: "80%", styles: { root: { overflow: "hidden" } }, children: /* @__PURE__ */ o(or, { height: "540px", children: [
721
- /* @__PURE__ */ e(ir, { children: /* @__PURE__ */ e(Y, { withBorder: !0, my: 20, p: 20, style: { height: "calc(100% - 40px)", overflow: "hidden", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ o("div", { style: { flex: 1, display: "flex", flexDirection: "row", overflow: "hidden", minHeight: 0, gap: "8px" }, children: [
722
- /* @__PURE__ */ o("div", { style: { flex: 9, display: "flex", flexDirection: "column", overflow: "hidden", minHeight: 0 }, children: [
723
- /* @__PURE__ */ o(N, { mb: 20, children: [
724
- /* @__PURE__ */ e(w, { children: s().t("archbase:Available") }),
717
+ }, [w, b, h, K, C, I]);
718
+ return ee(() => {
719
+ t && a && (s(void 0), D(void 0), l(""), T(""), I.collapseAllNodes(), c.collapseAllNodes(), F());
720
+ }, [t, h, u, F]), a ? /* @__PURE__ */ e(Oe, { opened: t, onClose: o, title: `${g().t(`archbase:${h}`)}: ${i}`, size: "80%", styles: { root: { overflow: "hidden" } }, children: /* @__PURE__ */ r(pr, { height: "540px", children: [
721
+ /* @__PURE__ */ e(mr, { children: /* @__PURE__ */ e(_, { withBorder: !0, my: 20, p: 20, style: { height: "calc(100% - 40px)", overflow: "hidden", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ r("div", { style: { flex: 1, display: "flex", flexDirection: "row", overflow: "hidden", minHeight: 0, gap: "8px" }, children: [
722
+ /* @__PURE__ */ r("div", { style: { flex: 9, display: "flex", flexDirection: "column", overflow: "hidden", minHeight: 0 }, children: [
723
+ /* @__PURE__ */ r(N, { mb: 20, children: [
724
+ /* @__PURE__ */ e(p, { children: g().t("archbase:Available") }),
725
725
  /* @__PURE__ */ e(
726
- ge,
726
+ me,
727
727
  {
728
728
  size: "xs",
729
- value: V,
730
- onChange: (p) => t(p.target.value),
731
- placeholder: s().t("archbase:Filter available permissions")
729
+ value: d,
730
+ onChange: (R) => l(R.target.value),
731
+ placeholder: g().t("archbase:Filter available permissions")
732
732
  }
733
733
  )
734
734
  ] }),
735
- /* @__PURE__ */ e(we, { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ e(
736
- ra,
735
+ /* @__PURE__ */ e(fe, { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ e(
736
+ sa,
737
737
  {
738
- data: k,
738
+ data: O,
739
739
  selectOnClick: !0,
740
740
  allowRangeSelection: !1,
741
- tree: A,
742
- renderNode: ({ level: p, node: m, expanded: M, hasChildren: E, selected: U, elementProps: $ }) => {
743
- const B = m?.nodeProps?.granted, L = B ? "dimmed" : void 0, ie = B ? "line-through" : void 0, Oe = de((Ue) => {
744
- D(m), $.onClick(Ue);
745
- }, [m, $.onClick]);
746
- return /* @__PURE__ */ o(
741
+ tree: c,
742
+ renderNode: ({ level: R, node: k, expanded: B, hasChildren: V, selected: q, elementProps: M }) => {
743
+ const H = k?.nodeProps?.granted, U = H ? "dimmed" : void 0, se = H ? "line-through" : void 0, qe = oe((He) => {
744
+ s(k), M.onClick(He);
745
+ }, [k, M.onClick]);
746
+ return /* @__PURE__ */ r(
747
747
  N,
748
748
  {
749
- ml: E ? 0 : 5,
749
+ ml: V ? 0 : 5,
750
750
  gap: 5,
751
- ...$,
752
- bg: U && p === 2 ? G : "",
753
- onClick: Oe,
751
+ ...M,
752
+ bg: q && R === 2 ? G : "",
753
+ onClick: qe,
754
754
  children: [
755
- E && /* @__PURE__ */ e(
756
- ia,
755
+ V && /* @__PURE__ */ e(
756
+ da,
757
757
  {
758
758
  size: 18,
759
- style: { transform: M ? "rotate(0deg)" : "rotate(-90deg)" }
759
+ style: { transform: B ? "rotate(0deg)" : "rotate(-90deg)" }
760
760
  }
761
761
  ),
762
- !E && /* @__PURE__ */ e(
763
- na,
762
+ !V && /* @__PURE__ */ e(
763
+ ua,
764
764
  {
765
765
  size: 12,
766
766
  style: { transform: "rotate(-90deg)", marginTop: "-5px" }
767
767
  }
768
768
  ),
769
769
  /* @__PURE__ */ e(
770
- w,
770
+ p,
771
771
  {
772
- c: L,
773
- td: ie,
774
- children: ca(m.label)
772
+ c: U,
773
+ td: se,
774
+ children: pa(k.label)
775
775
  }
776
776
  )
777
777
  ]
@@ -781,61 +781,61 @@ function qe({ dataSource: a, opened: r, close: l }) {
781
781
  }
782
782
  ) })
783
783
  ] }),
784
- /* @__PURE__ */ e("div", { style: { flex: 2, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ o(W, { gap: 5, align: "center", children: [
785
- /* @__PURE__ */ e(Ce, { label: s().t("archbase:Add"), children: /* @__PURE__ */ e(ue, { onClick: fe, disabled: !b || b?.nodeProps?.granted || !b.nodeProps, children: /* @__PURE__ */ e(ma, {}) }) }),
786
- /* @__PURE__ */ e(Ce, { label: s().t("archbase:Remove"), children: /* @__PURE__ */ e(ue, { onClick: pe, disabled: !y || !y?.nodeProps?.permissionId || !y.nodeProps, children: /* @__PURE__ */ e(ga, {}) }) })
784
+ /* @__PURE__ */ e("div", { style: { flex: 2, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ r(L, { gap: 5, align: "center", children: [
785
+ /* @__PURE__ */ e(Re, { label: g().t("archbase:Add"), children: /* @__PURE__ */ e(pe, { onClick: Se, disabled: !n || n?.nodeProps?.granted || !n.nodeProps, children: /* @__PURE__ */ e(Ta, {}) }) }),
786
+ /* @__PURE__ */ e(Re, { label: g().t("archbase:Remove"), children: /* @__PURE__ */ e(pe, { onClick: ye, disabled: !w || !w?.nodeProps?.permissionId || !w.nodeProps, children: /* @__PURE__ */ e(Aa, {}) }) })
787
787
  ] }) }),
788
- /* @__PURE__ */ o("div", { style: { flex: 9, display: "flex", flexDirection: "column", overflow: "hidden", minHeight: 0 }, children: [
789
- /* @__PURE__ */ o(N, { mb: 20, children: [
790
- /* @__PURE__ */ e(w, { children: s().t("archbase:Granted") }),
788
+ /* @__PURE__ */ r("div", { style: { flex: 9, display: "flex", flexDirection: "column", overflow: "hidden", minHeight: 0 }, children: [
789
+ /* @__PURE__ */ r(N, { mb: 20, children: [
790
+ /* @__PURE__ */ e(p, { children: g().t("archbase:Granted") }),
791
791
  /* @__PURE__ */ e(
792
- ge,
792
+ me,
793
793
  {
794
794
  size: "xs",
795
- value: g,
796
- onChange: (p) => F(p.target.value),
797
- placeholder: s().t("archbase:Filter granted permissions")
795
+ value: v,
796
+ onChange: (R) => T(R.target.value),
797
+ placeholder: g().t("archbase:Filter granted permissions")
798
798
  }
799
799
  )
800
800
  ] }),
801
- /* @__PURE__ */ e(we, { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ e(
802
- ra,
801
+ /* @__PURE__ */ e(fe, { style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ e(
802
+ sa,
803
803
  {
804
- data: J,
804
+ data: K,
805
805
  selectOnClick: !0,
806
806
  allowRangeSelection: !1,
807
- tree: v,
808
- renderNode: ({ level: p, node: m, expanded: M, hasChildren: E, selected: U, elementProps: $ }) => {
809
- const B = de((L) => {
810
- q(m), $.onClick(L);
811
- }, [m, $.onClick]);
812
- return /* @__PURE__ */ o(
807
+ tree: I,
808
+ renderNode: ({ level: R, node: k, expanded: B, hasChildren: V, selected: q, elementProps: M }) => {
809
+ const H = oe((U) => {
810
+ D(k), M.onClick(U);
811
+ }, [k, M.onClick]);
812
+ return /* @__PURE__ */ r(
813
813
  N,
814
814
  {
815
- ml: E ? 0 : 5,
815
+ ml: V ? 0 : 5,
816
816
  gap: 5,
817
- ...$,
818
- bg: U && p === 2 ? G : "",
819
- onClick: B,
817
+ ...M,
818
+ bg: q && R === 2 ? G : "",
819
+ onClick: H,
820
820
  children: [
821
- E && /* @__PURE__ */ e(
822
- ia,
821
+ V && /* @__PURE__ */ e(
822
+ da,
823
823
  {
824
824
  size: 18,
825
- style: { transform: M ? "rotate(0deg)" : "rotate(-90deg)" }
825
+ style: { transform: B ? "rotate(0deg)" : "rotate(-90deg)" }
826
826
  }
827
827
  ),
828
- !E && /* @__PURE__ */ e(
829
- na,
828
+ !V && /* @__PURE__ */ e(
829
+ ua,
830
830
  {
831
831
  size: 12,
832
832
  style: { transform: "rotate(-90deg)", marginTop: "-5px" }
833
833
  }
834
834
  ),
835
- /* @__PURE__ */ e(w, { children: ca(m.label) }),
836
- m?.nodeProps?.types?.includes("USER") && /* @__PURE__ */ e(te, { color: "blue", children: s().t("archbase:user") }),
837
- m?.nodeProps?.types?.includes("GROUP") && /* @__PURE__ */ e(te, { color: "orange", children: s().t("archbase:group") }),
838
- m?.nodeProps?.types?.includes("PROFILE") && /* @__PURE__ */ e(te, { color: "pink", children: s().t("archbase:profile") })
835
+ /* @__PURE__ */ e(p, { children: pa(k.label) }),
836
+ k?.nodeProps?.types?.includes("USER") && /* @__PURE__ */ e(Z, { color: "blue", children: g().t("archbase:user") }),
837
+ k?.nodeProps?.types?.includes("GROUP") && /* @__PURE__ */ e(Z, { color: "orange", children: g().t("archbase:group") }),
838
+ k?.nodeProps?.types?.includes("PROFILE") && /* @__PURE__ */ e(Z, { color: "pink", children: g().t("archbase:profile") })
839
839
  ]
840
840
  }
841
841
  );
@@ -844,22 +844,22 @@ function qe({ dataSource: a, opened: r, close: l }) {
844
844
  ) })
845
845
  ] })
846
846
  ] }) }) }),
847
- /* @__PURE__ */ e(nr, { size: "40px", children: /* @__PURE__ */ e(N, { justify: "flex-end", children: /* @__PURE__ */ e(Z, { onClick: l, children: s().t("archbase:Close") }) }) })
847
+ /* @__PURE__ */ e(gr, { size: "40px", children: /* @__PURE__ */ e(N, { justify: "flex-end", children: /* @__PURE__ */ e(Y, { onClick: o, children: g().t("archbase:Close") }) }) })
848
848
  ] }) }) : null;
849
849
  }
850
- const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAAABj1BMVEUAAADMzMzLy8vAwMDLy8vLy8vLy8vMzMzKysrR0dHPz8/MzMzNzc3KysrMzMzKysrLy8vLy8vLy8vJycnR0dHMzMzPz8/Ozs7MzMxPT0/Nzc1UVFTJyclTU1PMzMzKysrMzMzJycldXV1iYmLMzMzIyMhNTU1NTU3MzMzLy8vNzc3MzMxVVVXLy8vMzMzLy8vLy8tNTU3MzMzOzs5QUFDLy8vKyspRUVFRUVHMzMxZWVlycnLLy8tUVFTJycnKyspZWVlXV1dhYWHGxsZMTExQUFBPT0/Ozs7Ly8vPz89SUlJSUlLMzMxVVVVWVlZVVVXKysptbW1bW1t6enpmZmbLy8tKSkrQ0NDOzs5FRUXNzc1NTU3S0tLU1NRHR0dSUlKzs7ORkZF4eHhPT0/Jycm9vb26urp8fHxYWFisrKylpaWdnZ11dXVubm5fX1+8vLy3t7ehoaFkZGRVVVXBwcG/v7+vr6+ZmZmUlJSNjY2GhoZzc3NcXFzGxsbDw8Ofn5+WlpaBgYGwsLCpqalqampaWRCJAAAAVXRSTlMA+YUG1M7Df1AQ8urbdWdiXjo2HQkE+/vu4qqIcV1bRDEpIRwXFO/q2ZiObWJZSiv+9uTe3cq8s6qkgX55b1pWR0YVDfvJyLCcmZWTi2lZVz82LRcUQGGNCgAAA9pJREFUWMPll2db2zAQgJ0AgUIYDSl7tZRZ6N57793akizZCSSEEJKw9yi0/eHtEwgid5IxfOX9mnvenM93J8s4tZw5391Q3/Hu0mj3lTMnllys+hi6HqBCCCIEDVwPDVddPEEqXW9qiEOoeQAlDqlpGz1eYo2VYSFsE2ELcSPY6FvTV1njUFMDdVqCff48DWGgAdhOuMtPie8JrUaWq+3I5zs76Jg+cG50e3seVxPTF6S63svT0URNn1BSqffUEhvHE/ofgn8x9aZLKJpcja/sZnO57Pp0yqbIVKv2VDUBD93amedsn0QuA1U2eazynG8BceRPnrnWAczdmAERtLoHe6IhAaJWLWaVwNLLBPxXxQskCjogZse1ICz2G+TkDKNGbAb5THELwzaXQB2bzpZ6zt0GD5acZ5bKNA4LGSorET2BDz/NLDVT0FQywGW34GT81YhYForKo4dbCHjsVMLSEJuxgWnUkMAKkTmmE7E52ExhuX2vBGDzj+lFa7AKzRHUQ1K0qheNQZETPHj3FQSKfulF0zCYlpcVpyyAlseypcOdojC6uThxdQLt94mYTpRI2WjvduyL3kqRbGxXk1A+iYJFmywRhEyCIuEZwUXqq7Hxb+M60QYOtlsaZa3BT7PazuZxisP3VkA3/MX79a8QHH5574iWtfbZ2RDRUBDVA5HPzsbvvw6LaMZraLGodu9YdEzPhsRrBCIq985FLDKpto8mKY4WD+VWQymlXWVjpydshaiuILpcEKGxjSkfLE4VwaSqIOq5aioQ40w1IMRUEUEjgrctXkaqEZFDi1lccL1fGd5s94RKRLMMJZSTHrBGcEfiMxJ3Ne5HeYhg7CX03vgsVUZGiuesLBJqSrzUcNxgFBxHMGA2gVeRAjFkFOkJmCqSebekqzeTyrDmQ182IV8NEJtQNtytc+irBn5rwUHLqMJEvSGJlitCCCr2BsVRNFzyGdklcEQcHwAZop58SRmqEt2aZ3iJpChMuyJqlPC1CQRs51RDm08RdIAAhpzD6dCpvPpjNJ2hh5NyhvCFb5DIq0F83NKd/VY2LlWkXHFXjlTTfU1qlzNLC+OTs8Tev0JElHfZQkpkaT0GNEiVWJ8oqIjm8vdQ2GR7bAFrsGphbZHYQnthC5orm8y1fOCy9Fhy2NDyANVYr3IfGB6MXOM+Rdc+GZ48venLxG8+M46g9y734bl7wTiazlZ+hKZ1xPBFb/sA99D0t/cafrnQ3sq50sJb2+FTefOz804/50DC+++MPDeOTe+XD68GeJGXA6/ff4bJ+OfHt2edj+7ff9T59Ptz47TyD0dpv5fjoIC3AAAAAElFTkSuQmCC", gr = (a) => a.groups ? /* @__PURE__ */ e("div", { style: { display: "flex" }, children: a.groups.slice().sort((r, l) => (r.group?.name ?? "").localeCompare(l.group?.name ?? "")).map((r, l) => /* @__PURE__ */ e("div", { style: { paddingRight: "2px" }, children: /* @__PURE__ */ e(te, { color: "blue", children: r.group?.name }) }, l)) }) : null, fr = (a) => a.profile ? /* @__PURE__ */ e(te, { color: "green", children: a.profile?.name }) : null, br = (a) => /* @__PURE__ */ o(Ae, { children: [
850
+ const ia = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAAABj1BMVEUAAADMzMzLy8vAwMDLy8vLy8vLy8vMzMzKysrR0dHPz8/MzMzNzc3KysrMzMzKysrLy8vLy8vLy8vJycnR0dHMzMzPz8/Ozs7MzMxPT0/Nzc1UVFTJyclTU1PMzMzKysrMzMzJycldXV1iYmLMzMzIyMhNTU1NTU3MzMzLy8vNzc3MzMxVVVXLy8vMzMzLy8vLy8tNTU3MzMzOzs5QUFDLy8vKyspRUVFRUVHMzMxZWVlycnLLy8tUVFTJycnKyspZWVlXV1dhYWHGxsZMTExQUFBPT0/Ozs7Ly8vPz89SUlJSUlLMzMxVVVVWVlZVVVXKysptbW1bW1t6enpmZmbLy8tKSkrQ0NDOzs5FRUXNzc1NTU3S0tLU1NRHR0dSUlKzs7ORkZF4eHhPT0/Jycm9vb26urp8fHxYWFisrKylpaWdnZ11dXVubm5fX1+8vLy3t7ehoaFkZGRVVVXBwcG/v7+vr6+ZmZmUlJSNjY2GhoZzc3NcXFzGxsbDw8Ofn5+WlpaBgYGwsLCpqalqampaWRCJAAAAVXRSTlMA+YUG1M7Df1AQ8urbdWdiXjo2HQkE+/vu4qqIcV1bRDEpIRwXFO/q2ZiObWJZSiv+9uTe3cq8s6qkgX55b1pWR0YVDfvJyLCcmZWTi2lZVz82LRcUQGGNCgAAA9pJREFUWMPll2db2zAQgJ0AgUIYDSl7tZRZ6N57793akizZCSSEEJKw9yi0/eHtEwgid5IxfOX9mnvenM93J8s4tZw5391Q3/Hu0mj3lTMnllys+hi6HqBCCCIEDVwPDVddPEEqXW9qiEOoeQAlDqlpGz1eYo2VYSFsE2ELcSPY6FvTV1njUFMDdVqCff48DWGgAdhOuMtPie8JrUaWq+3I5zs76Jg+cG50e3seVxPTF6S63svT0URNn1BSqffUEhvHE/ofgn8x9aZLKJpcja/sZnO57Pp0yqbIVKv2VDUBD93amedsn0QuA1U2eazynG8BceRPnrnWAczdmAERtLoHe6IhAaJWLWaVwNLLBPxXxQskCjogZse1ICz2G+TkDKNGbAb5THELwzaXQB2bzpZ6zt0GD5acZ5bKNA4LGSorET2BDz/NLDVT0FQywGW34GT81YhYForKo4dbCHjsVMLSEJuxgWnUkMAKkTmmE7E52ExhuX2vBGDzj+lFa7AKzRHUQ1K0qheNQZETPHj3FQSKfulF0zCYlpcVpyyAlseypcOdojC6uThxdQLt94mYTpRI2WjvduyL3kqRbGxXk1A+iYJFmywRhEyCIuEZwUXqq7Hxb+M60QYOtlsaZa3BT7PazuZxisP3VkA3/MX79a8QHH5574iWtfbZ2RDRUBDVA5HPzsbvvw6LaMZraLGodu9YdEzPhsRrBCIq985FLDKpto8mKY4WD+VWQymlXWVjpydshaiuILpcEKGxjSkfLE4VwaSqIOq5aioQ40w1IMRUEUEjgrctXkaqEZFDi1lccL1fGd5s94RKRLMMJZSTHrBGcEfiMxJ3Ne5HeYhg7CX03vgsVUZGiuesLBJqSrzUcNxgFBxHMGA2gVeRAjFkFOkJmCqSebekqzeTyrDmQ182IV8NEJtQNtytc+irBn5rwUHLqMJEvSGJlitCCCr2BsVRNFzyGdklcEQcHwAZop58SRmqEt2aZ3iJpChMuyJqlPC1CQRs51RDm08RdIAAhpzD6dCpvPpjNJ2hh5NyhvCFb5DIq0F83NKd/VY2LlWkXHFXjlTTfU1qlzNLC+OTs8Tev0JElHfZQkpkaT0GNEiVWJ8oqIjm8vdQ2GR7bAFrsGphbZHYQnthC5orm8y1fOCy9Fhy2NDyANVYr3IfGB6MXOM+Rdc+GZ48venLxG8+M46g9y734bl7wTiazlZ+hKZ1xPBFb/sA99D0t/cafrnQ3sq50sJb2+FTefOz804/50DC+++MPDeOTe+XD68GeJGXA6/ff4bJ+OfHt2edj+7ff9T59Ptz47TyD0dpv5fjoIC3AAAAAElFTkSuQmCC", Ar = (a) => a.groups ? /* @__PURE__ */ e("div", { style: { display: "flex" }, children: a.groups.slice().sort((t, o) => (t.group?.name ?? "").localeCompare(o.group?.name ?? "")).map((t, o) => /* @__PURE__ */ e("div", { style: { paddingRight: "2px" }, children: /* @__PURE__ */ e(Z, { color: "blue", children: t.group?.name }) }, o)) }) : null, xr = (a) => a.profile ? /* @__PURE__ */ e(Z, { color: "green", children: a.profile?.name }) : null, Rr = (a) => /* @__PURE__ */ r(ke, { children: [
851
851
  /* @__PURE__ */ e(
852
- T,
852
+ P,
853
853
  {
854
854
  dataField: "user.avatar",
855
855
  dataType: "image",
856
856
  size: 80,
857
857
  header: `${a("archbase:Foto")}`,
858
- render: (r) => /* @__PURE__ */ e(
858
+ render: (t) => /* @__PURE__ */ e(
859
859
  "img",
860
860
  {
861
861
  style: { borderRadius: 50, height: "32px", maxHeight: "32px" },
862
- src: r.row.user && r.row.user.avatar ? atob(r.row.user.avatar) : Ye
862
+ src: t.row.user && t.row.user.avatar ? atob(t.row.user.avatar) : ia
863
863
  }
864
864
  ),
865
865
  inputFilterType: "text",
@@ -868,7 +868,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
868
868
  }
869
869
  ),
870
870
  /* @__PURE__ */ e(
871
- T,
871
+ P,
872
872
  {
873
873
  dataField: "user.userName",
874
874
  dataType: "text",
@@ -878,7 +878,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
878
878
  }
879
879
  ),
880
880
  /* @__PURE__ */ e(
881
- T,
881
+ P,
882
882
  {
883
883
  dataField: "user.email",
884
884
  dataType: "text",
@@ -888,18 +888,18 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
888
888
  }
889
889
  ),
890
890
  /* @__PURE__ */ e(
891
- T,
891
+ P,
892
892
  {
893
893
  dataField: "expirationDate",
894
894
  dataType: "text",
895
895
  size: 300,
896
896
  header: `${a("archbase:Expira em")}`,
897
- render: (r) => /* @__PURE__ */ e(w, { size: "sm", children: r.row.expirationDate }),
897
+ render: (t) => /* @__PURE__ */ e(p, { size: "sm", children: t.row.expirationDate }),
898
898
  inputFilterType: "text"
899
899
  }
900
900
  ),
901
901
  /* @__PURE__ */ e(
902
- T,
902
+ P,
903
903
  {
904
904
  dataField: "revoked",
905
905
  dataType: "boolean",
@@ -908,7 +908,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
908
908
  }
909
909
  ),
910
910
  /* @__PURE__ */ e(
911
- T,
911
+ P,
912
912
  {
913
913
  dataField: "expired",
914
914
  dataType: "boolean",
@@ -917,7 +917,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
917
917
  }
918
918
  ),
919
919
  /* @__PURE__ */ e(
920
- T,
920
+ P,
921
921
  {
922
922
  dataField: "token",
923
923
  dataType: "text",
@@ -926,19 +926,19 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
926
926
  inputFilterType: "text"
927
927
  }
928
928
  )
929
- ] }), vr = (a) => /* @__PURE__ */ o(Ae, { children: [
929
+ ] }), kr = (a) => /* @__PURE__ */ r(ke, { children: [
930
930
  /* @__PURE__ */ e(
931
- T,
931
+ P,
932
932
  {
933
933
  dataField: "avatar",
934
934
  dataType: "image",
935
935
  size: 80,
936
936
  header: `${a("archbase:Foto")}`,
937
- render: (r) => /* @__PURE__ */ e(
937
+ render: (t) => /* @__PURE__ */ e(
938
938
  "img",
939
939
  {
940
940
  style: { borderRadius: 50, height: "32px", maxHeight: "32px" },
941
- src: r.row.avatar ? atob(r.row.avatar) : Ye
941
+ src: t.row.avatar ? atob(t.row.avatar) : ia
942
942
  }
943
943
  ),
944
944
  enableSorting: !1,
@@ -949,7 +949,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
949
949
  }
950
950
  ),
951
951
  /* @__PURE__ */ e(
952
- T,
952
+ P,
953
953
  {
954
954
  dataField: "name",
955
955
  dataType: "text",
@@ -960,7 +960,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
960
960
  }
961
961
  ),
962
962
  /* @__PURE__ */ e(
963
- T,
963
+ P,
964
964
  {
965
965
  dataField: "nickname",
966
966
  dataType: "text",
@@ -971,7 +971,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
971
971
  }
972
972
  ),
973
973
  /* @__PURE__ */ e(
974
- T,
974
+ P,
975
975
  {
976
976
  dataField: "email",
977
977
  dataType: "text",
@@ -982,7 +982,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
982
982
  }
983
983
  ),
984
984
  /* @__PURE__ */ e(
985
- T,
985
+ P,
986
986
  {
987
987
  dataField: "accountDeactivated",
988
988
  dataType: "boolean",
@@ -992,32 +992,32 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
992
992
  }
993
993
  ),
994
994
  /* @__PURE__ */ e(
995
- T,
995
+ P,
996
996
  {
997
997
  dataField: "profile.name",
998
998
  dataType: "text",
999
999
  header: `${a("archbase:Perfil")}`,
1000
1000
  size: 200,
1001
- render: (r) => fr(r.row),
1001
+ render: (t) => xr(t.row),
1002
1002
  inputFilterType: "text"
1003
1003
  }
1004
1004
  ),
1005
1005
  /* @__PURE__ */ e(
1006
- T,
1006
+ P,
1007
1007
  {
1008
1008
  dataField: "groups",
1009
1009
  dataType: "text",
1010
1010
  size: 300,
1011
1011
  header: `${a("archbase:Grupos")}`,
1012
- render: (r) => gr(r.row),
1013
- exportValue: (r) => r.groups?.slice().sort((l, i) => (l.group?.name ?? "").localeCompare(i.group?.name ?? "")).map((l) => l.group?.name).filter(Boolean).join(", ") || "",
1012
+ render: (t) => Ar(t.row),
1013
+ exportValue: (t) => t.groups?.slice().sort((o, i) => (o.group?.name ?? "").localeCompare(i.group?.name ?? "")).map((o) => o.group?.name).filter(Boolean).join(", ") || "",
1014
1014
  enableSorting: !1,
1015
1015
  enableColumnFilter: !1,
1016
1016
  enableGlobalFilter: !1
1017
1017
  }
1018
1018
  ),
1019
1019
  /* @__PURE__ */ e(
1020
- T,
1020
+ P,
1021
1021
  {
1022
1022
  dataField: "isAdministrator",
1023
1023
  dataType: "boolean",
@@ -1026,7 +1026,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1026
1026
  }
1027
1027
  ),
1028
1028
  /* @__PURE__ */ e(
1029
- T,
1029
+ P,
1030
1030
  {
1031
1031
  dataField: "changePasswordOnNextLogin",
1032
1032
  dataType: "boolean",
@@ -1036,7 +1036,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1036
1036
  }
1037
1037
  ),
1038
1038
  /* @__PURE__ */ e(
1039
- T,
1039
+ P,
1040
1040
  {
1041
1041
  dataField: "allowPasswordChange",
1042
1042
  dataType: "boolean",
@@ -1046,7 +1046,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1046
1046
  }
1047
1047
  ),
1048
1048
  /* @__PURE__ */ e(
1049
- T,
1049
+ P,
1050
1050
  {
1051
1051
  dataField: "allowMultipleLogins",
1052
1052
  dataType: "boolean",
@@ -1056,7 +1056,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1056
1056
  }
1057
1057
  ),
1058
1058
  /* @__PURE__ */ e(
1059
- T,
1059
+ P,
1060
1060
  {
1061
1061
  dataField: "passwordNeverExpires",
1062
1062
  dataType: "boolean",
@@ -1066,7 +1066,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1066
1066
  }
1067
1067
  ),
1068
1068
  /* @__PURE__ */ e(
1069
- T,
1069
+ P,
1070
1070
  {
1071
1071
  dataField: "passwordChangedAt",
1072
1072
  dataType: "datetime",
@@ -1076,7 +1076,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1076
1076
  }
1077
1077
  ),
1078
1078
  /* @__PURE__ */ e(
1079
- T,
1079
+ P,
1080
1080
  {
1081
1081
  dataField: "accountLocked",
1082
1082
  dataType: "boolean",
@@ -1086,7 +1086,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1086
1086
  }
1087
1087
  ),
1088
1088
  /* @__PURE__ */ e(
1089
- T,
1089
+ P,
1090
1090
  {
1091
1091
  dataField: "unlimitedAccessHours",
1092
1092
  dataType: "boolean",
@@ -1095,9 +1095,9 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1095
1095
  size: 140
1096
1096
  }
1097
1097
  )
1098
- ] }), yr = (a) => /* @__PURE__ */ o(Ae, { children: [
1098
+ ] }), Ir = (a) => /* @__PURE__ */ r(ke, { children: [
1099
1099
  /* @__PURE__ */ e(
1100
- T,
1100
+ P,
1101
1101
  {
1102
1102
  dataField: "name",
1103
1103
  dataType: "text",
@@ -1107,7 +1107,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1107
1107
  }
1108
1108
  ),
1109
1109
  /* @__PURE__ */ e(
1110
- T,
1110
+ P,
1111
1111
  {
1112
1112
  dataField: "description",
1113
1113
  dataType: "text",
@@ -1116,9 +1116,9 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1116
1116
  inputFilterType: "text"
1117
1117
  }
1118
1118
  )
1119
- ] }), wr = (a) => /* @__PURE__ */ o(Ae, { children: [
1119
+ ] }), zr = (a) => /* @__PURE__ */ r(ke, { children: [
1120
1120
  /* @__PURE__ */ e(
1121
- T,
1121
+ P,
1122
1122
  {
1123
1123
  dataField: "name",
1124
1124
  dataType: "text",
@@ -1128,7 +1128,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1128
1128
  }
1129
1129
  ),
1130
1130
  /* @__PURE__ */ e(
1131
- T,
1131
+ P,
1132
1132
  {
1133
1133
  dataField: "description",
1134
1134
  dataType: "text",
@@ -1137,9 +1137,9 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1137
1137
  inputFilterType: "text"
1138
1138
  }
1139
1139
  )
1140
- ] }), Cr = (a) => /* @__PURE__ */ o(Ae, { children: [
1140
+ ] }), Er = (a) => /* @__PURE__ */ r(ke, { children: [
1141
1141
  /* @__PURE__ */ e(
1142
- T,
1142
+ P,
1143
1143
  {
1144
1144
  dataField: "name",
1145
1145
  dataType: "text",
@@ -1149,7 +1149,7 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1149
1149
  }
1150
1150
  ),
1151
1151
  /* @__PURE__ */ e(
1152
- T,
1152
+ P,
1153
1153
  {
1154
1154
  dataField: "description",
1155
1155
  dataType: "text",
@@ -1159,23 +1159,23 @@ const Ye = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABMCAMAAAD5ogFjAA
1159
1159
  }
1160
1160
  )
1161
1161
  ] });
1162
- function Te({
1162
+ function ze({
1163
1163
  active: a,
1164
- printTitle: r,
1165
- gridRef: l,
1164
+ printTitle: t,
1165
+ gridRef: o,
1166
1166
  dataSource: i,
1167
- isLoading: h,
1168
- error: n,
1169
- getRowId: A,
1170
- striped: v = !1,
1167
+ isLoading: u,
1168
+ error: h,
1169
+ getRowId: c,
1170
+ striped: I = !1,
1171
1171
  enableRowActions: x = !0,
1172
- toolbarLeftContent: c,
1172
+ toolbarLeftContent: f,
1173
1173
  renderRowActions: C,
1174
- actionsColumnWidth: u,
1175
- children: b
1174
+ actionsColumnWidth: S,
1175
+ children: n
1176
1176
  }) {
1177
1177
  return /* @__PURE__ */ e(
1178
- Y,
1178
+ _,
1179
1179
  {
1180
1180
  withBorder: !0,
1181
1181
  mt: "md",
@@ -1187,62 +1187,62 @@ function Te({
1187
1187
  overflow: "auto"
1188
1188
  },
1189
1189
  children: /* @__PURE__ */ e(
1190
- ha,
1190
+ Ca,
1191
1191
  {
1192
- gridRef: l,
1193
- printTitle: r,
1192
+ gridRef: o,
1193
+ printTitle: t,
1194
1194
  width: "100%",
1195
1195
  height: "100%",
1196
1196
  withBorder: !1,
1197
1197
  dataSource: i,
1198
1198
  withColumnBorders: !0,
1199
- striped: v,
1199
+ striped: I,
1200
1200
  enableTopToolbar: !0,
1201
1201
  enableRowActions: x,
1202
1202
  pageSize: 50,
1203
- isLoading: h,
1204
- isError: !!n,
1205
- error: n,
1203
+ isLoading: u,
1204
+ isError: !!h,
1205
+ error: h,
1206
1206
  enableGlobalFilter: !0,
1207
- getRowId: A,
1208
- toolbarLeftContent: c,
1207
+ getRowId: c,
1208
+ toolbarLeftContent: f,
1209
1209
  renderRowActions: C,
1210
- actionsColumnWidth: u,
1211
- children: b
1210
+ actionsColumnWidth: S,
1211
+ children: n
1212
1212
  }
1213
1213
  )
1214
1214
  }
1215
1215
  );
1216
1216
  }
1217
- function je({
1217
+ function Qe({
1218
1218
  dataSource: a,
1219
- securityType: r,
1220
- newInstance: l,
1219
+ securityType: t,
1220
+ newInstance: o,
1221
1221
  createEntitiesWithId: i,
1222
- removeMessageKey: h,
1223
- setOpenedModal: n,
1224
- setOpenedPermissionsModal: A,
1225
- validationContext: v,
1222
+ removeMessageKey: u,
1223
+ setOpenedModal: h,
1224
+ setOpenedPermissionsModal: c,
1225
+ validationContext: I,
1226
1226
  t: x
1227
1227
  }) {
1228
- const c = a, C = (d) => c.isEmpty() ? null : c.gotoRecordByData(d) ?? null;
1228
+ const f = a, C = (m) => f.isEmpty() ? null : f.gotoRecordByData(m) ?? null;
1229
1229
  return {
1230
1230
  handleAdd: () => {
1231
- const d = l();
1232
- i || (d.id = void 0), c.insert(d), n(r);
1231
+ const m = o();
1232
+ i || (m.id = void 0), f.insert(m), h(t);
1233
1233
  },
1234
- handleViewRow: (d) => {
1235
- C(d) && n(r);
1234
+ handleViewRow: (m) => {
1235
+ C(m) && h(t);
1236
1236
  },
1237
- handleEditRow: (d) => {
1238
- C(d) && (c.isEditing() || c.edit(), n(r));
1237
+ handleEditRow: (m) => {
1238
+ C(m) && (f.isEditing() || f.edit(), h(t));
1239
1239
  },
1240
- handleRemoveRow: (d) => {
1241
- C(d) && ce.showConfirmDialogYesNo(
1240
+ handleRemoveRow: (m) => {
1241
+ C(m) && he.showConfirmDialogYesNo(
1242
1242
  `${x("archbase:Confirme")}`,
1243
- `${x(h)}${d.name} ?`,
1243
+ `${x(u)}${m.name} ?`,
1244
1244
  () => {
1245
- c.remove();
1245
+ f.remove();
1246
1246
  },
1247
1247
  () => {
1248
1248
  }
@@ -1250,400 +1250,400 @@ function je({
1250
1250
  },
1251
1251
  handleSaveModal: async () => {
1252
1252
  try {
1253
- await c.save();
1253
+ await f.save();
1254
1254
  } catch {
1255
1255
  return;
1256
1256
  }
1257
- n(""), v?.clearAll();
1257
+ h(""), I?.clearAll();
1258
1258
  },
1259
1259
  handleCancelModal: () => {
1260
- n(""), c.isBrowsing() || c.cancel(), v?.clearAll();
1260
+ h(""), f.isBrowsing() || f.cancel(), I?.clearAll();
1261
1261
  },
1262
1262
  handleOpenPermissionsModal: () => {
1263
- A(r);
1263
+ c(t);
1264
1264
  }
1265
1265
  };
1266
1266
  }
1267
- function He({
1267
+ function Je({
1268
1268
  row: a,
1269
- onView: r,
1270
- onEdit: l,
1269
+ onView: t,
1270
+ onEdit: o,
1271
1271
  onRemove: i,
1272
- onEditPermissions: h,
1273
- before: n,
1274
- after: A,
1275
- t: v
1272
+ onEditPermissions: u,
1273
+ before: h,
1274
+ after: c,
1275
+ t: I
1276
1276
  }) {
1277
- const x = Qe(), { colorScheme: c } = Ge(), C = c === "dark", u = (b) => C ? x.colors[b][8] : x.colors[b][4];
1278
- return /* @__PURE__ */ o(N, { gap: 1, wrap: "nowrap", children: [
1279
- n?.(a),
1280
- /* @__PURE__ */ e(ue, { variant: "transparent", onClick: () => r(a), children: /* @__PURE__ */ e(Za, { size: 20, color: u("blue") }) }),
1281
- /* @__PURE__ */ e(ue, { variant: "transparent", onClick: () => l(a), children: /* @__PURE__ */ e(fa, { size: 20, color: u("yellow") }) }),
1282
- /* @__PURE__ */ e(ue, { variant: "transparent", onClick: () => i(a), children: /* @__PURE__ */ e(Xe, { size: 20, color: u("red") }) }),
1283
- /* @__PURE__ */ e(Ce, { withinPortal: !0, withArrow: !0, position: "left", label: `${v("archbase:Edit permissions")}`, children: /* @__PURE__ */ e(ue, { variant: "transparent", onClick: h, children: /* @__PURE__ */ e(Ja, { size: 20, color: u("green") }) }) }),
1284
- A?.(a)
1277
+ const x = ra(), { colorScheme: f } = Be(), C = f === "dark", S = (n) => C ? x.colors[n][8] : x.colors[n][4];
1278
+ return /* @__PURE__ */ r(N, { gap: 1, wrap: "nowrap", children: [
1279
+ h?.(a),
1280
+ /* @__PURE__ */ e(pe, { variant: "transparent", onClick: () => t(a), children: /* @__PURE__ */ e(or, { size: 20, color: S("blue") }) }),
1281
+ /* @__PURE__ */ e(pe, { variant: "transparent", onClick: () => o(a), children: /* @__PURE__ */ e(xa, { size: 20, color: S("yellow") }) }),
1282
+ /* @__PURE__ */ e(pe, { variant: "transparent", onClick: () => i(a), children: /* @__PURE__ */ e(ta, { size: 20, color: S("red") }) }),
1283
+ /* @__PURE__ */ e(Re, { withinPortal: !0, withArrow: !0, position: "left", label: `${I("archbase:Edit permissions")}`, children: /* @__PURE__ */ e(pe, { variant: "transparent", onClick: u, children: /* @__PURE__ */ e(nr, { size: 20, color: S("green") }) }) }),
1284
+ c?.(a)
1285
1285
  ] });
1286
1286
  }
1287
- const Ze = ({ onAdd: a, onEditPermissions: r, t: l }) => /* @__PURE__ */ o(Re, { justify: "space-between", style: { width: "50%" }, children: [
1288
- /* @__PURE__ */ o(N, { align: "end", gap: "4px", wrap: "nowrap", children: [
1289
- /* @__PURE__ */ e(Z, { color: "green", leftSection: /* @__PURE__ */ e(ba, {}), onClick: a, children: `${l("archbase:New")}` }),
1290
- /* @__PURE__ */ e(Z, { color: "blue", leftSection: /* @__PURE__ */ e(fa, {}), onClick: r, children: `${l("archbase:Edit permissions")}` })
1287
+ const Xe = ({ onAdd: a, onEditPermissions: t, t: o }) => /* @__PURE__ */ r(De, { justify: "space-between", style: { width: "50%" }, children: [
1288
+ /* @__PURE__ */ r(N, { align: "end", gap: "4px", wrap: "nowrap", children: [
1289
+ /* @__PURE__ */ e(Y, { color: "green", leftSection: /* @__PURE__ */ e(Ra, {}), onClick: a, children: `${o("archbase:New")}` }),
1290
+ /* @__PURE__ */ e(Y, { color: "blue", leftSection: /* @__PURE__ */ e(xa, {}), onClick: t, children: `${o("archbase:Edit permissions")}` })
1291
1291
  ] }),
1292
- /* @__PURE__ */ e(Re, { align: "flex-start", justify: "flex-end", style: { width: "200px" } })
1292
+ /* @__PURE__ */ e(De, { align: "flex-start", justify: "flex-end", style: { width: "200px" } })
1293
1293
  ] });
1294
- function Zr({
1294
+ function ot({
1295
1295
  height: a = "400px",
1296
- width: r = "100%",
1297
- createEntitiesWithId: l = !0,
1296
+ width: t = "100%",
1297
+ createEntitiesWithId: o = !0,
1298
1298
  userModalOptions: i,
1299
- profileModalOptions: h,
1300
- groupModalOptions: n,
1301
- options: A
1299
+ profileModalOptions: u,
1300
+ groupModalOptions: h,
1301
+ options: c
1302
1302
  }) {
1303
- Qe(), pa("securityStore");
1304
- const v = Va(), { colorScheme: x } = Ge(), [c, C] = P(void 0), [u, b] = P("users"), D = X(Q.User), y = X(Q.Group), q = X(Q.Resource), V = X(Q.Profile), [t, d] = P(""), [g, F] = P(""), z = X(Q.AccessToken), { t: f } = Ga(), oe = ye(null), G = ye(null), J = ye(null), S = ye(null), k = ye(null), R = (I) => I.id, fe = (I) => I.id, pe = (I) => I.id, p = (I) => I.id, m = (I) => I.id, {
1305
- dataSource: M,
1306
- isLoading: E,
1307
- refreshData: U
1308
- } = xe({
1303
+ ra(), Sa("securityStore");
1304
+ const I = Qa(), { colorScheme: x } = Be(), [f, C] = z(void 0), [S, n] = z("users"), s = J(Q.User), w = J(Q.Group), D = J(Q.Resource), d = J(Q.Profile), [l, m] = z(""), [v, T] = z(""), A = J(Q.AccessToken), { t: b } = Ja(), j = xe(null), G = xe(null), K = xe(null), E = xe(null), O = xe(null), F = ($) => $.id, Se = ($) => $.id, ye = ($) => $.id, R = ($) => $.id, k = ($) => $.id, {
1305
+ dataSource: B,
1306
+ isLoading: V,
1307
+ refreshData: q
1308
+ } = Ie({
1309
1309
  name: "accessTokenApi",
1310
- service: z,
1311
- validator: v,
1310
+ service: A,
1311
+ validator: I,
1312
1312
  pageSize: 25,
1313
1313
  defaultSortFields: ["user.email", "expirationTime:desc"],
1314
- onError: (I, _) => {
1315
- C(I), ee.showError(`${f("archbase:WARNING")}`, I, _);
1314
+ onError: ($, re) => {
1315
+ C($), te.showError(`${b("archbase:WARNING")}`, $, re);
1316
1316
  }
1317
1317
  }), {
1318
- dataSource: $,
1319
- isLoading: B,
1320
- refreshData: L
1321
- } = xe({
1318
+ dataSource: M,
1319
+ isLoading: H,
1320
+ refreshData: U
1321
+ } = Ie({
1322
1322
  name: "dsUsers",
1323
- service: D,
1324
- validator: v,
1323
+ service: s,
1324
+ validator: I,
1325
1325
  pageSize: 25,
1326
- onError: (I, _) => {
1327
- C(I), ee.showError(`${f("archbase:WARNING")}`, I, _);
1326
+ onError: ($, re) => {
1327
+ C($), te.showError(`${b("archbase:WARNING")}`, $, re);
1328
1328
  }
1329
1329
  }), {
1330
- dataSource: ie,
1331
- isLoading: Oe,
1332
- refreshData: Ue
1333
- } = xe({
1330
+ dataSource: se,
1331
+ isLoading: qe,
1332
+ refreshData: He
1333
+ } = Ie({
1334
1334
  name: "dsGroups",
1335
- service: y,
1336
- validator: v,
1335
+ service: w,
1336
+ validator: I,
1337
1337
  pageSize: 25,
1338
- onError: (I, _) => {
1339
- C(I), ee.showError(`${f("archbase:WARNING")}`, I, _);
1338
+ onError: ($, re) => {
1339
+ C($), te.showError(`${b("archbase:WARNING")}`, $, re);
1340
1340
  }
1341
1341
  }), {
1342
- dataSource: De,
1343
- isLoading: va,
1344
- refreshData: ya
1345
- } = xe({
1342
+ dataSource: $e,
1343
+ isLoading: Ia,
1344
+ refreshData: za
1345
+ } = Ie({
1346
1346
  name: "dsProfile",
1347
- service: V,
1348
- validator: v,
1347
+ service: d,
1348
+ validator: I,
1349
1349
  pageSize: 25,
1350
- onError: (I, _) => {
1351
- C(I), ee.showError(`${f("archbase:WARNING")}`, I, _);
1350
+ onError: ($, re) => {
1351
+ C($), te.showError(`${b("archbase:WARNING")}`, $, re);
1352
1352
  }
1353
1353
  }), {
1354
- dataSource: wa,
1355
- isLoading: Ca,
1356
- refreshData: Sa
1357
- } = xe({
1354
+ dataSource: Ea,
1355
+ isLoading: Pa,
1356
+ refreshData: Da
1357
+ } = Ie({
1358
1358
  name: "dsResources",
1359
- service: q,
1360
- validator: v,
1359
+ service: D,
1360
+ validator: I,
1361
1361
  pageSize: 25,
1362
- onError: (I, _) => {
1363
- C(I), ee.showError(`${f("archbase:WARNING")}`, I, _);
1362
+ onError: ($, re) => {
1363
+ C($), te.showError(`${b("archbase:WARNING")}`, $, re);
1364
1364
  }
1365
1365
  });
1366
- Se(() => {
1367
- U({ filter: Le(Ie.eq("revoked", "false")) }), L(), Ue(), ya(), Sa();
1366
+ ee(() => {
1367
+ q({ filter: Me(Fe.eq("revoked", "false")) }), U(), He(), za(), Da();
1368
1368
  }, []);
1369
- const Aa = br(f), xa = vr(f), Ta = yr(f), Ra = wr(f), ka = Cr(f), Be = Ma(), ne = je({
1370
- dataSource: $,
1371
- securityType: H.USER,
1372
- newInstance: () => Ya.newInstance(),
1373
- createEntitiesWithId: l,
1369
+ const Fa = Rr(b), Na = kr(b), Oa = Ir(b), $a = zr(b), La = Er(b), je = Xa(), ce = Qe({
1370
+ dataSource: M,
1371
+ securityType: X.USER,
1372
+ newInstance: () => sr.newInstance(),
1373
+ createEntitiesWithId: o,
1374
1374
  removeMessageKey: "archbase:Deseja remover o usuário ",
1375
- setOpenedModal: d,
1376
- setOpenedPermissionsModal: F,
1377
- validationContext: Be,
1378
- t: f
1379
- }), se = je({
1380
- dataSource: ie,
1381
- securityType: H.GROUP,
1382
- newInstance: () => _a.newInstance(),
1383
- createEntitiesWithId: l,
1375
+ setOpenedModal: m,
1376
+ setOpenedPermissionsModal: T,
1377
+ validationContext: je,
1378
+ t: b
1379
+ }), de = Qe({
1380
+ dataSource: se,
1381
+ securityType: X.GROUP,
1382
+ newInstance: () => lr.newInstance(),
1383
+ createEntitiesWithId: o,
1384
1384
  removeMessageKey: "archbase:Deseja remover o grupo ",
1385
- setOpenedModal: d,
1386
- setOpenedPermissionsModal: F,
1387
- validationContext: Be,
1388
- t: f
1389
- }), le = je({
1390
- dataSource: De,
1391
- securityType: H.PROFILE,
1392
- newInstance: () => er.newInstance(),
1393
- createEntitiesWithId: l,
1385
+ setOpenedModal: m,
1386
+ setOpenedPermissionsModal: T,
1387
+ validationContext: je,
1388
+ t: b
1389
+ }), ue = Qe({
1390
+ dataSource: $e,
1391
+ securityType: X.PROFILE,
1392
+ newInstance: () => cr.newInstance(),
1393
+ createEntitiesWithId: o,
1394
1394
  removeMessageKey: "archbase:Deseja remover o perfil ",
1395
- setOpenedModal: d,
1396
- setOpenedPermissionsModal: F,
1397
- validationContext: Be,
1398
- t: f
1399
- }), Ia = (I) => /* @__PURE__ */ e(
1400
- He,
1395
+ setOpenedModal: m,
1396
+ setOpenedPermissionsModal: T,
1397
+ validationContext: je,
1398
+ t: b
1399
+ }), Va = ($) => /* @__PURE__ */ e(
1400
+ Je,
1401
1401
  {
1402
- row: I,
1403
- onView: ne.handleViewRow,
1404
- onEdit: ne.handleEditRow,
1405
- onRemove: ne.handleRemoveRow,
1406
- onEditPermissions: ne.handleOpenPermissionsModal,
1407
- before: A?.beforeDefaultUserActions,
1408
- after: A?.afterDefaultUserActions,
1409
- t: f
1402
+ row: $,
1403
+ onView: ce.handleViewRow,
1404
+ onEdit: ce.handleEditRow,
1405
+ onRemove: ce.handleRemoveRow,
1406
+ onEditPermissions: ce.handleOpenPermissionsModal,
1407
+ before: c?.beforeDefaultUserActions,
1408
+ after: c?.afterDefaultUserActions,
1409
+ t: b
1410
1410
  }
1411
- ), Pa = (I) => /* @__PURE__ */ e(
1412
- He,
1411
+ ), Ma = ($) => /* @__PURE__ */ e(
1412
+ Je,
1413
1413
  {
1414
- row: I,
1415
- onView: se.handleViewRow,
1416
- onEdit: se.handleEditRow,
1417
- onRemove: se.handleRemoveRow,
1418
- onEditPermissions: se.handleOpenPermissionsModal,
1419
- before: A?.beforeDefaultGroupActions,
1420
- after: A?.afterDefaultGroupActions,
1421
- t: f
1414
+ row: $,
1415
+ onView: de.handleViewRow,
1416
+ onEdit: de.handleEditRow,
1417
+ onRemove: de.handleRemoveRow,
1418
+ onEditPermissions: de.handleOpenPermissionsModal,
1419
+ before: c?.beforeDefaultGroupActions,
1420
+ after: c?.afterDefaultGroupActions,
1421
+ t: b
1422
1422
  }
1423
- ), Fa = (I) => /* @__PURE__ */ e(
1424
- He,
1423
+ ), Ga = ($) => /* @__PURE__ */ e(
1424
+ Je,
1425
1425
  {
1426
- row: I,
1427
- onView: le.handleViewRow,
1428
- onEdit: le.handleEditRow,
1429
- onRemove: le.handleRemoveRow,
1430
- onEditPermissions: le.handleOpenPermissionsModal,
1431
- before: A?.beforeDefaultProfileActions,
1432
- after: A?.afterDefaultProfileActions,
1433
- t: f
1426
+ row: $,
1427
+ onView: ue.handleViewRow,
1428
+ onEdit: ue.handleEditRow,
1429
+ onRemove: ue.handleRemoveRow,
1430
+ onEditPermissions: ue.handleOpenPermissionsModal,
1431
+ before: c?.beforeDefaultProfileActions,
1432
+ after: c?.afterDefaultProfileActions,
1433
+ t: b
1434
1434
  }
1435
- ), za = () => {
1436
- const I = M.getCurrentRecord();
1437
- I && ce.showConfirmDialogYesNo(
1438
- `${f("archbase:Confirme")}`,
1439
- `${f("archbase:Deseja revogar o token de Acesso do usuário ")}${I.user.name} ?`,
1435
+ ), Ua = () => {
1436
+ const $ = B.getCurrentRecord();
1437
+ $ && he.showConfirmDialogYesNo(
1438
+ `${b("archbase:Confirme")}`,
1439
+ `${b("archbase:Deseja revogar o token de Acesso do usuário ")}${$.user.name} ?`,
1440
1440
  async () => {
1441
- await z.revoke(I.token).then(async () => {
1442
- ee.showSuccess(
1443
- `${f("mentors:Informação")}`,
1444
- `${f("mentors:Token de Acesso revogado com sucesso!")}`
1445
- ), M.refreshData();
1446
- }).catch((_) => {
1447
- ce.showErrorWithDetails(
1448
- `${f("mentors:Atenção")}`,
1449
- he(_),
1450
- $e(_)
1441
+ await A.revoke($.token).then(async () => {
1442
+ te.showSuccess(
1443
+ `${b("mentors:Informação")}`,
1444
+ `${b("mentors:Token de Acesso revogado com sucesso!")}`
1445
+ ), B.refreshData();
1446
+ }).catch((re) => {
1447
+ he.showErrorWithDetails(
1448
+ `${b("mentors:Atenção")}`,
1449
+ ge(re),
1450
+ Ve(re)
1451
1451
  );
1452
1452
  });
1453
1453
  },
1454
1454
  () => {
1455
1455
  }
1456
1456
  );
1457
- }, We = () => {
1458
- F("");
1459
- }, Da = () => /* @__PURE__ */ e(Re, { justify: "space-between", style: { width: "50%" }, children: /* @__PURE__ */ e(N, { align: "start", gap: "4px", wrap: "nowrap", children: /* @__PURE__ */ e(
1460
- Z,
1457
+ }, Ze = () => {
1458
+ T("");
1459
+ }, Ba = () => /* @__PURE__ */ e(De, { justify: "space-between", style: { width: "50%" }, children: /* @__PURE__ */ e(N, { align: "start", gap: "4px", wrap: "nowrap", children: /* @__PURE__ */ e(
1460
+ Y,
1461
1461
  {
1462
- disabled: !M.getCurrentRecord(),
1462
+ disabled: !B.getCurrentRecord(),
1463
1463
  color: "red",
1464
- leftSection: /* @__PURE__ */ e(Xe, {}),
1465
- onClick: za,
1466
- children: `${f("archbase:Revoke")}`
1464
+ leftSection: /* @__PURE__ */ e(ta, {}),
1465
+ onClick: Ua,
1466
+ children: `${b("archbase:Revoke")}`
1467
1467
  }
1468
1468
  ) }) });
1469
- return /* @__PURE__ */ o(Y, { p: "md", style: { height: a, display: "flex", flexDirection: "column" }, children: [
1470
- /* @__PURE__ */ e(K, { variant: "pills", value: u, onChange: b, children: /* @__PURE__ */ o(K.List, { children: [
1471
- /* @__PURE__ */ e(K.Tab, { value: "users", children: `${f("Usuários")}` }),
1472
- /* @__PURE__ */ e(K.Tab, { value: "groups", children: `${f("Grupos")}` }),
1473
- /* @__PURE__ */ e(K.Tab, { value: "profiles", children: `${f("Perfis")}` }),
1474
- /* @__PURE__ */ e(K.Tab, { value: "resources", children: `${f("Recursos")}` }),
1475
- /* @__PURE__ */ e(K.Tab, { value: "accessTokens", children: `${f("Tokens Acesso")}` })
1469
+ return /* @__PURE__ */ r(_, { p: "md", style: { height: a, display: "flex", flexDirection: "column" }, children: [
1470
+ /* @__PURE__ */ e(we, { variant: "pills", value: S, onChange: n, children: /* @__PURE__ */ r(we.List, { children: [
1471
+ /* @__PURE__ */ e(we.Tab, { value: "users", children: `${b("Usuários")}` }),
1472
+ /* @__PURE__ */ e(we.Tab, { value: "groups", children: `${b("Grupos")}` }),
1473
+ /* @__PURE__ */ e(we.Tab, { value: "profiles", children: `${b("Perfis")}` }),
1474
+ /* @__PURE__ */ e(we.Tab, { value: "resources", children: `${b("Recursos")}` }),
1475
+ /* @__PURE__ */ e(we.Tab, { value: "accessTokens", children: `${b("Tokens Acesso")}` })
1476
1476
  ] }) }),
1477
1477
  /* @__PURE__ */ e(
1478
- Te,
1478
+ ze,
1479
1479
  {
1480
- active: u === "users",
1480
+ active: S === "users",
1481
1481
  printTitle: "Usuários",
1482
- gridRef: oe,
1483
- dataSource: $,
1484
- isLoading: B,
1485
- error: c,
1486
- getRowId: R,
1482
+ gridRef: j,
1483
+ dataSource: M,
1484
+ isLoading: H,
1485
+ error: f,
1486
+ getRowId: F,
1487
1487
  striped: !0,
1488
1488
  toolbarLeftContent: /* @__PURE__ */ e(
1489
- Ze,
1489
+ Xe,
1490
1490
  {
1491
- onAdd: ne.handleAdd,
1492
- onEditPermissions: ne.handleOpenPermissionsModal,
1493
- t: f
1491
+ onAdd: ce.handleAdd,
1492
+ onEditPermissions: ce.handleOpenPermissionsModal,
1493
+ t: b
1494
1494
  }
1495
1495
  ),
1496
- renderRowActions: Ia,
1497
- actionsColumnWidth: A?.userActionsColumnWidth,
1498
- children: xa
1496
+ renderRowActions: Va,
1497
+ actionsColumnWidth: c?.userActionsColumnWidth,
1498
+ children: Na
1499
1499
  }
1500
1500
  ),
1501
1501
  /* @__PURE__ */ e(
1502
- Te,
1502
+ ze,
1503
1503
  {
1504
- active: u === "groups",
1504
+ active: S === "groups",
1505
1505
  printTitle: "Grupos",
1506
1506
  gridRef: G,
1507
- dataSource: ie,
1508
- isLoading: Oe,
1509
- error: c,
1510
- getRowId: fe,
1507
+ dataSource: se,
1508
+ isLoading: qe,
1509
+ error: f,
1510
+ getRowId: Se,
1511
1511
  toolbarLeftContent: /* @__PURE__ */ e(
1512
- Ze,
1512
+ Xe,
1513
1513
  {
1514
- onAdd: se.handleAdd,
1515
- onEditPermissions: se.handleOpenPermissionsModal,
1516
- t: f
1514
+ onAdd: de.handleAdd,
1515
+ onEditPermissions: de.handleOpenPermissionsModal,
1516
+ t: b
1517
1517
  }
1518
1518
  ),
1519
- renderRowActions: Pa,
1520
- actionsColumnWidth: A?.groupActionsColumnWidth,
1521
- children: Ta
1519
+ renderRowActions: Ma,
1520
+ actionsColumnWidth: c?.groupActionsColumnWidth,
1521
+ children: Oa
1522
1522
  }
1523
1523
  ),
1524
1524
  /* @__PURE__ */ e(
1525
- Te,
1525
+ ze,
1526
1526
  {
1527
- active: u === "profiles",
1527
+ active: S === "profiles",
1528
1528
  printTitle: "Perfis",
1529
- gridRef: J,
1530
- dataSource: De,
1531
- isLoading: va,
1532
- error: c,
1533
- getRowId: pe,
1529
+ gridRef: K,
1530
+ dataSource: $e,
1531
+ isLoading: Ia,
1532
+ error: f,
1533
+ getRowId: ye,
1534
1534
  toolbarLeftContent: /* @__PURE__ */ e(
1535
- Ze,
1535
+ Xe,
1536
1536
  {
1537
- onAdd: le.handleAdd,
1538
- onEditPermissions: le.handleOpenPermissionsModal,
1539
- t: f
1537
+ onAdd: ue.handleAdd,
1538
+ onEditPermissions: ue.handleOpenPermissionsModal,
1539
+ t: b
1540
1540
  }
1541
1541
  ),
1542
- renderRowActions: Fa,
1543
- actionsColumnWidth: A?.profileActionsColumnWidth,
1544
- children: Ra
1542
+ renderRowActions: Ga,
1543
+ actionsColumnWidth: c?.profileActionsColumnWidth,
1544
+ children: $a
1545
1545
  }
1546
1546
  ),
1547
1547
  /* @__PURE__ */ e(
1548
- Te,
1548
+ ze,
1549
1549
  {
1550
- active: u === "resources",
1550
+ active: S === "resources",
1551
1551
  printTitle: "Recursos",
1552
- gridRef: S,
1553
- dataSource: wa,
1554
- isLoading: Ca,
1555
- error: c,
1556
- getRowId: p,
1552
+ gridRef: E,
1553
+ dataSource: Ea,
1554
+ isLoading: Pa,
1555
+ error: f,
1556
+ getRowId: R,
1557
1557
  enableRowActions: !1,
1558
- children: ka
1558
+ children: La
1559
1559
  }
1560
1560
  ),
1561
1561
  /* @__PURE__ */ e(
1562
- Te,
1562
+ ze,
1563
1563
  {
1564
- active: u === "accessTokens",
1564
+ active: S === "accessTokens",
1565
1565
  printTitle: "Tokens de API",
1566
- gridRef: k,
1567
- dataSource: M,
1568
- isLoading: E,
1569
- error: c,
1570
- getRowId: m,
1566
+ gridRef: O,
1567
+ dataSource: B,
1568
+ isLoading: V,
1569
+ error: f,
1570
+ getRowId: k,
1571
1571
  striped: !0,
1572
1572
  enableRowActions: !1,
1573
- toolbarLeftContent: Da(),
1574
- children: Aa
1573
+ toolbarLeftContent: Ba(),
1574
+ children: Fa
1575
1575
  }
1576
1576
  ),
1577
- t === H.USER ? /* @__PURE__ */ e(
1578
- ur,
1577
+ l === X.USER ? /* @__PURE__ */ e(
1578
+ wr,
1579
1579
  {
1580
- onClickOk: ne.handleSaveModal,
1580
+ onClickOk: ce.handleSaveModal,
1581
1581
  opened: !0,
1582
- dataSource: $,
1583
- onClickCancel: ne.handleCancelModal,
1582
+ dataSource: M,
1583
+ onClickCancel: ce.handleCancelModal,
1584
1584
  options: i
1585
1585
  }
1586
1586
  ) : null,
1587
- t === H.GROUP ? /* @__PURE__ */ e(
1588
- hr,
1587
+ l === X.GROUP ? /* @__PURE__ */ e(
1588
+ Cr,
1589
1589
  {
1590
- onClickOk: se.handleSaveModal,
1590
+ onClickOk: de.handleSaveModal,
1591
1591
  opened: !0,
1592
- dataSource: ie,
1593
- onClickCancel: se.handleCancelModal,
1594
- options: n
1592
+ dataSource: se,
1593
+ onClickCancel: de.handleCancelModal,
1594
+ options: h
1595
1595
  }
1596
1596
  ) : null,
1597
- t === H.PROFILE ? /* @__PURE__ */ e(
1598
- sr,
1597
+ l === X.PROFILE ? /* @__PURE__ */ e(
1598
+ fr,
1599
1599
  {
1600
- onClickOk: le.handleSaveModal,
1600
+ onClickOk: ue.handleSaveModal,
1601
1601
  opened: !0,
1602
- dataSource: De,
1603
- onClickCancel: le.handleCancelModal,
1604
- options: h
1602
+ dataSource: $e,
1603
+ onClickCancel: ue.handleCancelModal,
1604
+ options: u
1605
1605
  }
1606
1606
  ) : null,
1607
- g === H.USER ? /* @__PURE__ */ e(
1608
- qe,
1607
+ v === X.USER ? /* @__PURE__ */ e(
1608
+ Ke,
1609
1609
  {
1610
- dataSource: $,
1611
- opened: !!g,
1612
- close: We
1610
+ dataSource: M,
1611
+ opened: !!v,
1612
+ close: Ze
1613
1613
  }
1614
1614
  ) : null,
1615
- g === H.GROUP ? /* @__PURE__ */ e(
1616
- qe,
1615
+ v === X.GROUP ? /* @__PURE__ */ e(
1616
+ Ke,
1617
1617
  {
1618
- dataSource: ie,
1619
- opened: !!g,
1620
- close: We
1618
+ dataSource: se,
1619
+ opened: !!v,
1620
+ close: Ze
1621
1621
  }
1622
1622
  ) : null,
1623
- g === H.PROFILE ? /* @__PURE__ */ e(
1624
- qe,
1623
+ v === X.PROFILE ? /* @__PURE__ */ e(
1624
+ Ke,
1625
1625
  {
1626
- dataSource: De,
1627
- opened: !!g,
1628
- close: We
1626
+ dataSource: $e,
1627
+ opened: !!v,
1628
+ close: Ze
1629
1629
  }
1630
1630
  ) : null
1631
1631
  ] });
1632
1632
  }
1633
- function Jr({ height: a = "400px", width: r = "100%" }) {
1634
- Qe();
1635
- const l = pa("apiTokenStore"), i = { validateEntity: () => [] }, { colorScheme: h } = Ge(), [n, A] = P(void 0), v = X(Q.ApiToken), [x, c] = P(""), C = ye(null), u = (G) => G.id, { dataSource: b } = ja({
1633
+ function nt({ height: a = "400px", width: t = "100%" }) {
1634
+ ra();
1635
+ const o = Sa("apiTokenStore"), i = { validateEntity: () => [] }, { colorScheme: u } = Be(), [h, c] = z(void 0), I = J(Q.ApiToken), [x, f] = z(""), C = xe(null), S = (G) => G.id, { dataSource: n } = tr({
1636
1636
  initialData: [],
1637
1637
  name: "dataSource"
1638
- }), D = Pe(
1638
+ }), s = Ne(
1639
1639
  "ArchbaseApiTokenView-LocalDataSource",
1640
- b,
1640
+ n,
1641
1641
  void 0,
1642
1642
  void 0
1643
- ), { dataSource: y, isLoading: q } = Je({
1643
+ ), { dataSource: w, isLoading: D } = ea({
1644
1644
  name: "dsApiToken",
1645
- service: v,
1646
- store: l,
1645
+ service: I,
1646
+ store: o,
1647
1647
  validator: i,
1648
1648
  pageSize: 25,
1649
1649
  loadOnStart: !0,
@@ -1651,17 +1651,17 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1651
1651
  },
1652
1652
  onDestroy: (G) => {
1653
1653
  },
1654
- onError: (G, J) => {
1655
- A(G), ee.showError(s().t("archbase:WARNING"), G, J);
1654
+ onError: (G, K) => {
1655
+ c(G), te.showError(g().t("archbase:WARNING"), G, K);
1656
1656
  }
1657
- }), V = Pe(
1657
+ }), d = Ne(
1658
1658
  "ArchbaseApiTokenView-RemoteDataSource",
1659
- y,
1659
+ w,
1660
1660
  void 0,
1661
1661
  void 0
1662
- ), t = `calc(${a} - 40px)`, d = /* @__PURE__ */ o(Ae, { children: [
1662
+ ), l = `calc(${a} - 40px)`, m = /* @__PURE__ */ r(ke, { children: [
1663
1663
  /* @__PURE__ */ e(
1664
- T,
1664
+ P,
1665
1665
  {
1666
1666
  dataField: "user.avatar",
1667
1667
  dataType: "image",
@@ -1671,7 +1671,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1671
1671
  "img",
1672
1672
  {
1673
1673
  style: { borderRadius: 50, height: "32px", maxHeight: "32px" },
1674
- src: G.row.user && G.row.user.avatar ? atob(G.row.user.avatar) : Ye
1674
+ src: G.row.user && G.row.user.avatar ? atob(G.row.user.avatar) : ia
1675
1675
  }
1676
1676
  ),
1677
1677
  inputFilterType: "text",
@@ -1679,7 +1679,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1679
1679
  }
1680
1680
  ),
1681
1681
  /* @__PURE__ */ e(
1682
- T,
1682
+ P,
1683
1683
  {
1684
1684
  dataField: "user.userName",
1685
1685
  dataType: "text",
@@ -1689,7 +1689,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1689
1689
  }
1690
1690
  ),
1691
1691
  /* @__PURE__ */ e(
1692
- T,
1692
+ P,
1693
1693
  {
1694
1694
  dataField: "user.email",
1695
1695
  dataType: "text",
@@ -1699,7 +1699,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1699
1699
  }
1700
1700
  ),
1701
1701
  /* @__PURE__ */ e(
1702
- T,
1702
+ P,
1703
1703
  {
1704
1704
  dataField: "name",
1705
1705
  dataType: "text",
@@ -1709,7 +1709,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1709
1709
  }
1710
1710
  ),
1711
1711
  /* @__PURE__ */ e(
1712
- T,
1712
+ P,
1713
1713
  {
1714
1714
  dataField: "description",
1715
1715
  dataType: "text",
@@ -1719,7 +1719,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1719
1719
  }
1720
1720
  ),
1721
1721
  /* @__PURE__ */ e(
1722
- T,
1722
+ P,
1723
1723
  {
1724
1724
  dataField: "token",
1725
1725
  dataType: "text",
@@ -1730,7 +1730,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1730
1730
  }
1731
1731
  ),
1732
1732
  /* @__PURE__ */ e(
1733
- T,
1733
+ P,
1734
1734
  {
1735
1735
  dataField: "tenantId",
1736
1736
  dataType: "text",
@@ -1741,7 +1741,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1741
1741
  }
1742
1742
  ),
1743
1743
  /* @__PURE__ */ e(
1744
- T,
1744
+ P,
1745
1745
  {
1746
1746
  dataField: "expirationDate",
1747
1747
  dataType: "text",
@@ -1749,33 +1749,33 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1749
1749
  header: "Validade",
1750
1750
  render: (G) => {
1751
1751
  if (!G.row.expirationDate)
1752
- return /* @__PURE__ */ e(w, { c: "dimmed", children: "Sem expiração" });
1753
- const J = /* @__PURE__ */ new Date();
1754
- J.setHours(0, 0, 0, 0);
1755
- const S = new Date(G.row.expirationDate);
1756
- S.setHours(0, 0, 0, 0);
1757
- const k = S.getTime() - J.getTime(), R = Math.ceil(k / (1e3 * 60 * 60 * 24));
1758
- let pe = Math.max(0, Math.min(100, R / 365 * 100)), p = "green", m = "";
1759
- R < 0 ? (p = "red", pe = 100, m = `Vencido há ${Math.abs(R)} dia${Math.abs(R) !== 1 ? "s" : ""}`) : R === 0 ? (p = "red", pe = 5, m = "Vence hoje") : R <= 7 ? (p = "red", m = `${R} dia${R !== 1 ? "s" : ""}`) : R <= 30 ? (p = "orange", m = `${R} dias`) : R <= 90 ? (p = "yellow", m = `${R} dias`) : (p = "green", m = `${R} dias`);
1760
- const M = R < 0 ? `Vencido em ${S.toLocaleDateString()}` : `Expira em ${S.toLocaleDateString()}`;
1761
- return /* @__PURE__ */ e(Ce, { label: M, withArrow: !0, children: /* @__PURE__ */ o(N, { gap: "xs", wrap: "nowrap", children: [
1752
+ return /* @__PURE__ */ e(p, { c: "dimmed", children: "Sem expiração" });
1753
+ const K = /* @__PURE__ */ new Date();
1754
+ K.setHours(0, 0, 0, 0);
1755
+ const E = new Date(G.row.expirationDate);
1756
+ E.setHours(0, 0, 0, 0);
1757
+ const O = E.getTime() - K.getTime(), F = Math.ceil(O / (1e3 * 60 * 60 * 24));
1758
+ let ye = Math.max(0, Math.min(100, F / 365 * 100)), R = "green", k = "";
1759
+ F < 0 ? (R = "red", ye = 100, k = `Vencido há ${Math.abs(F)} dia${Math.abs(F) !== 1 ? "s" : ""}`) : F === 0 ? (R = "red", ye = 5, k = "Vence hoje") : F <= 7 ? (R = "red", k = `${F} dia${F !== 1 ? "s" : ""}`) : F <= 30 ? (R = "orange", k = `${F} dias`) : F <= 90 ? (R = "yellow", k = `${F} dias`) : (R = "green", k = `${F} dias`);
1760
+ const B = F < 0 ? `Vencido em ${E.toLocaleDateString()}` : `Expira em ${E.toLocaleDateString()}`;
1761
+ return /* @__PURE__ */ e(Re, { label: B, withArrow: !0, children: /* @__PURE__ */ r(N, { gap: "xs", wrap: "nowrap", children: [
1762
1762
  /* @__PURE__ */ e(
1763
- Ea,
1763
+ Wa,
1764
1764
  {
1765
1765
  size: 36,
1766
1766
  thickness: 4,
1767
1767
  roundCaps: !0,
1768
- sections: [{ value: R < 0 ? 100 : pe, color: p }]
1768
+ sections: [{ value: F < 0 ? 100 : ye, color: R }]
1769
1769
  }
1770
1770
  ),
1771
- /* @__PURE__ */ e(w, { size: "sm", c: R < 0 ? "red" : void 0, fw: R <= 7 ? 600 : void 0, children: m })
1771
+ /* @__PURE__ */ e(p, { size: "sm", c: F < 0 ? "red" : void 0, fw: F <= 7 ? 600 : void 0, children: k })
1772
1772
  ] }) });
1773
1773
  },
1774
1774
  inputFilterType: "text"
1775
1775
  }
1776
1776
  ),
1777
1777
  /* @__PURE__ */ e(
1778
- T,
1778
+ P,
1779
1779
  {
1780
1780
  dataField: "activated",
1781
1781
  dataType: "boolean",
@@ -1784,7 +1784,7 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1784
1784
  }
1785
1785
  ),
1786
1786
  /* @__PURE__ */ e(
1787
- T,
1787
+ P,
1788
1788
  {
1789
1789
  dataField: "revoked",
1790
1790
  dataType: "boolean",
@@ -1792,70 +1792,70 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1792
1792
  inputFilterType: "checkbox"
1793
1793
  }
1794
1794
  )
1795
- ] }), g = () => {
1796
- b.insert(ar.newInstance()), b && !D.isDataSourceV2 && D.v1State.forceUpdate(), c("apiToken");
1797
- }, F = () => {
1798
- y.getCurrentRecord() && ce.showConfirmDialogYesNo(
1799
- `${s().t("archbase:Confirme")}`,
1800
- `${s().t("archbase:Deseja revogar o token de API do usuário ")}${y.getCurrentRecord().user.name} ?`,
1795
+ ] }), v = () => {
1796
+ n.insert(dr.newInstance()), n && !s.isDataSourceV2 && s.v1State.forceUpdate(), f("apiToken");
1797
+ }, T = () => {
1798
+ w.getCurrentRecord() && he.showConfirmDialogYesNo(
1799
+ `${g().t("archbase:Confirme")}`,
1800
+ `${g().t("archbase:Deseja revogar o token de API do usuário ")}${w.getCurrentRecord().user.name} ?`,
1801
1801
  async () => {
1802
- await v.revoke(y.getCurrentRecord().token).then(async () => {
1803
- ee.showSuccess(
1804
- `${s().t("mentors:Informação")}`,
1805
- `${s().t("mentors:Token de API revogado com sucesso!")}`
1806
- ), y.refreshData(), y && !V.isDataSourceV2 && V.v1State.forceUpdate();
1802
+ await I.revoke(w.getCurrentRecord().token).then(async () => {
1803
+ te.showSuccess(
1804
+ `${g().t("mentors:Informação")}`,
1805
+ `${g().t("mentors:Token de API revogado com sucesso!")}`
1806
+ ), w.refreshData(), w && !d.isDataSourceV2 && d.v1State.forceUpdate();
1807
1807
  }).catch((G) => {
1808
- ce.showErrorWithDetails(
1809
- `${s().t("mentors:Atenção")}`,
1810
- he(G),
1811
- $e(G)
1808
+ he.showErrorWithDetails(
1809
+ `${g().t("mentors:Atenção")}`,
1810
+ ge(G),
1811
+ Ve(G)
1812
1812
  );
1813
1813
  });
1814
1814
  },
1815
1815
  () => {
1816
1816
  }
1817
1817
  );
1818
- }, z = () => {
1819
- c("");
1820
- }, f = async (G, J) => {
1821
- const S = b.getCurrentRecord();
1822
- if (S)
1818
+ }, A = () => {
1819
+ f("");
1820
+ }, b = async (G, K) => {
1821
+ const E = n.getCurrentRecord();
1822
+ if (E)
1823
1823
  try {
1824
- if (b.validate(), !S.user || !S.user.email) {
1825
- ce.showErrorWithDetails(
1826
- `${s().t("archbase:WARNING")}`,
1827
- `${s().t("archbase:Selecione um usuário para o token de API")}`,
1824
+ if (n.validate(), !E.user || !E.user.email) {
1825
+ he.showErrorWithDetails(
1826
+ `${g().t("archbase:WARNING")}`,
1827
+ `${g().t("archbase:Selecione um usuário para o token de API")}`,
1828
1828
  ""
1829
1829
  );
1830
1830
  return;
1831
1831
  }
1832
- await v.create(S.user.email, S.expirationDate, S.name, S.description).then(async (k) => {
1833
- b.cancel(), b && !D.isDataSourceV2 && D.v1State.forceUpdate(), y.append(k), y && !V.isDataSourceV2 && V.v1State.forceUpdate(), ee.showSuccess(
1834
- `${s().t("mentors:Informação")}`,
1835
- `${s().t("mentors:Token de API gerado com sucesso!")}`
1836
- ), J && J(!0);
1837
- }).catch((k) => {
1838
- ce.showErrorWithDetails(
1839
- `${s().t("mentors:Atenção")}`,
1840
- he(k),
1841
- $e(k)
1832
+ await I.create(E.user.email, E.expirationDate, E.name, E.description).then(async (O) => {
1833
+ n.cancel(), n && !s.isDataSourceV2 && s.v1State.forceUpdate(), w.append(O), w && !d.isDataSourceV2 && d.v1State.forceUpdate(), te.showSuccess(
1834
+ `${g().t("mentors:Informação")}`,
1835
+ `${g().t("mentors:Token de API gerado com sucesso!")}`
1836
+ ), K && K(!0);
1837
+ }).catch((O) => {
1838
+ he.showErrorWithDetails(
1839
+ `${g().t("mentors:Atenção")}`,
1840
+ ge(O),
1841
+ Ve(O)
1842
1842
  );
1843
1843
  });
1844
- } catch (k) {
1845
- ce.showErrorWithDetails(
1846
- `${s().t("mentors:Atenção")}`,
1847
- he(k),
1848
- $e(k)
1844
+ } catch (O) {
1845
+ he.showErrorWithDetails(
1846
+ `${g().t("mentors:Atenção")}`,
1847
+ ge(O),
1848
+ Ve(O)
1849
1849
  );
1850
1850
  }
1851
1851
  };
1852
- return /* @__PURE__ */ o(Y, { p: "md", style: { height: a, display: "flex", flexDirection: "column" }, children: [
1852
+ return /* @__PURE__ */ r(_, { p: "md", style: { height: a, display: "flex", flexDirection: "column" }, children: [
1853
1853
  /* @__PURE__ */ e(
1854
- Y,
1854
+ _,
1855
1855
  {
1856
1856
  withBorder: !0,
1857
1857
  style: {
1858
- height: t,
1858
+ height: l,
1859
1859
  display: "flex",
1860
1860
  width: "100%",
1861
1861
  flex: 1,
@@ -1863,46 +1863,46 @@ function Jr({ height: a = "400px", width: r = "100%" }) {
1863
1863
  overflow: "auto"
1864
1864
  },
1865
1865
  children: /* @__PURE__ */ e(
1866
- ha,
1866
+ Ca,
1867
1867
  {
1868
1868
  gridRef: C,
1869
1869
  printTitle: "Tokens de API",
1870
1870
  width: "100%",
1871
1871
  height: "100%",
1872
1872
  withBorder: !1,
1873
- dataSource: y,
1873
+ dataSource: w,
1874
1874
  withColumnBorders: !0,
1875
1875
  striped: !0,
1876
1876
  enableTopToolbar: !0,
1877
1877
  enableRowActions: !1,
1878
1878
  pageSize: 50,
1879
- isLoading: q,
1880
- isError: !!n,
1881
- error: n,
1879
+ isLoading: D,
1880
+ isError: !!h,
1881
+ error: h,
1882
1882
  enableGlobalFilter: !0,
1883
- getRowId: u,
1884
- toolbarLeftContent: /* @__PURE__ */ e(Re, { justify: "space-between", style: { width: "50%" }, children: /* @__PURE__ */ o(N, { align: "start", gap: "2px", wrap: "nowrap", children: [
1885
- /* @__PURE__ */ e(Z, { color: "green", leftSection: /* @__PURE__ */ e(ba, {}), onClick: g, children: s().t("archbase:New") }),
1886
- /* @__PURE__ */ e(Z, { disabled: !y.getCurrentRecord(), color: "red", leftSection: /* @__PURE__ */ e(Xe, {}), onClick: F, children: s().t("archbase:Revoke") })
1883
+ getRowId: S,
1884
+ toolbarLeftContent: /* @__PURE__ */ e(De, { justify: "space-between", style: { width: "50%" }, children: /* @__PURE__ */ r(N, { align: "start", gap: "2px", wrap: "nowrap", children: [
1885
+ /* @__PURE__ */ e(Y, { color: "green", leftSection: /* @__PURE__ */ e(Ra, {}), onClick: v, children: g().t("archbase:New") }),
1886
+ /* @__PURE__ */ e(Y, { disabled: !w.getCurrentRecord(), color: "red", leftSection: /* @__PURE__ */ e(ta, {}), onClick: T, children: g().t("archbase:Revoke") })
1887
1887
  ] }) }),
1888
- children: d
1888
+ children: m
1889
1889
  }
1890
1890
  )
1891
1891
  }
1892
1892
  ),
1893
1893
  x === "apiToken" ? /* @__PURE__ */ e(
1894
- mr,
1894
+ Tr,
1895
1895
  {
1896
- onClickOk: z,
1896
+ onClickOk: A,
1897
1897
  opened: !0,
1898
- dataSource: b,
1899
- onCustomSave: f,
1900
- onClickCancel: z
1898
+ dataSource: n,
1899
+ onCustomSave: b,
1900
+ onClickCancel: A
1901
1901
  }
1902
1902
  ) : null
1903
1903
  ] });
1904
1904
  }
1905
- const Ve = (a) => {
1905
+ const Ge = (a) => {
1906
1906
  switch (a) {
1907
1907
  case "critical":
1908
1908
  return "red";
@@ -1913,72 +1913,158 @@ const Ve = (a) => {
1913
1913
  default:
1914
1914
  return "gray";
1915
1915
  }
1916
- }, Sr = ({ card: a }) => /* @__PURE__ */ e(Y, { withBorder: !0, radius: "md", p: "sm", style: { borderLeft: `3px solid var(--mantine-color-${Ve(a.severity)}-6)` }, children: /* @__PURE__ */ o(W, { gap: 4, children: [
1917
- /* @__PURE__ */ o(N, { gap: 8, align: "baseline", wrap: "wrap", children: [
1918
- /* @__PURE__ */ e(w, { fw: 600, size: "1.7rem", lh: 1.05, c: Ve(a.severity), children: a.value }),
1919
- a.of ? /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", children: a.of }) : null
1920
- ] }),
1921
- /* @__PURE__ */ e(w, { size: "sm", fw: 550, children: a.label }),
1922
- a.description ? /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", lh: 1.45, children: a.description }) : null
1923
- ] }) }), Ar = ({ cards: a }) => /* @__PURE__ */ e(Me, { cols: { base: 1, sm: 2, lg: 3, xl: 4 }, spacing: "xs", children: a.map((r, l) => /* @__PURE__ */ e(Sr, { card: r }, `${r.label}-${l}`)) }), xr = ({ flags: a }) => /* @__PURE__ */ e(Me, { cols: { base: 1, sm: 2, lg: 4 }, spacing: "xs", children: a.map((r) => /* @__PURE__ */ e(Y, { withBorder: !0, radius: "md", p: "sm", children: /* @__PURE__ */ o(W, { gap: 3, children: [
1924
- /* @__PURE__ */ e(w, { size: "10px", c: "dimmed", ff: "monospace", style: { wordBreak: "break-all" }, children: r.key }),
1925
- /* @__PURE__ */ o(N, { gap: 7, wrap: "nowrap", children: [
1926
- /* @__PURE__ */ e(te, { size: "xs", circle: !0, color: Ve(r.severity) }),
1927
- /* @__PURE__ */ e(w, { size: "sm", fw: 550, children: r.value })
1916
+ }, Pr = ({ card: a, onOpen: t }) => {
1917
+ const o = !!(t && a.metric);
1918
+ return /* @__PURE__ */ e(
1919
+ _,
1920
+ {
1921
+ withBorder: !0,
1922
+ radius: "md",
1923
+ p: "sm",
1924
+ role: o ? "button" : void 0,
1925
+ tabIndex: o ? 0 : void 0,
1926
+ "aria-label": o ? `Ver os itens de ${a.label}` : void 0,
1927
+ onClick: o ? () => t?.(a) : void 0,
1928
+ onKeyDown: o ? (i) => {
1929
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), t?.(a));
1930
+ } : void 0,
1931
+ style: {
1932
+ borderLeft: `3px solid var(--mantine-color-${Ge(a.severity)}-6)`,
1933
+ cursor: o ? "pointer" : void 0
1934
+ },
1935
+ children: /* @__PURE__ */ r(L, { gap: 4, children: [
1936
+ /* @__PURE__ */ r(N, { gap: 8, align: "baseline", wrap: "wrap", children: [
1937
+ /* @__PURE__ */ e(p, { fw: 600, size: "1.7rem", lh: 1.05, c: Ge(a.severity), children: a.value }),
1938
+ a.of ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: a.of }) : null
1939
+ ] }),
1940
+ /* @__PURE__ */ e(p, { size: "sm", fw: 550, children: a.label }),
1941
+ a.description ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", lh: 1.45, children: a.description }) : null
1942
+ ] })
1943
+ }
1944
+ );
1945
+ }, Dr = ({ cards: a, onOpenCard: t }) => /* @__PURE__ */ e(We, { cols: { base: 1, sm: 2, lg: 3, xl: 4 }, spacing: "xs", children: a.map((o, i) => /* @__PURE__ */ e(Pr, { card: o, onOpen: t }, `${o.label}-${i}`)) }), Fr = ({ flags: a }) => /* @__PURE__ */ e(We, { cols: { base: 1, sm: 2, lg: 4 }, spacing: "xs", children: a.map((t) => /* @__PURE__ */ e(_, { withBorder: !0, radius: "md", p: "sm", children: /* @__PURE__ */ r(L, { gap: 3, children: [
1946
+ /* @__PURE__ */ e(p, { size: "10px", c: "dimmed", ff: "monospace", style: { wordBreak: "break-all" }, children: t.key }),
1947
+ /* @__PURE__ */ r(N, { gap: 7, wrap: "nowrap", children: [
1948
+ /* @__PURE__ */ e(Z, { size: "xs", circle: !0, color: Ge(t.severity) }),
1949
+ /* @__PURE__ */ e(p, { size: "sm", fw: 550, children: t.value })
1928
1950
  ] }),
1929
- r.description ? /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", lh: 1.4, children: r.description }) : null
1930
- ] }) }, r.key)) }), Tr = ({ attributes: a }) => /* @__PURE__ */ e(W, { gap: 7, children: a.map((r, l) => /* @__PURE__ */ o(N, { gap: 12, wrap: "nowrap", justify: "space-between", children: [
1931
- /* @__PURE__ */ e(w, { size: "sm", c: "dimmed", children: r.label }),
1932
- /* @__PURE__ */ e(w, { size: "sm", fw: 600, ta: "right", children: r.value })
1933
- ] }, `${r.label}-${l}`)) }), Fe = ({ title: a, hint: r, children: l }) => /* @__PURE__ */ o(W, { gap: "xs", children: [
1934
- /* @__PURE__ */ o(N, { gap: 10, align: "baseline", wrap: "wrap", children: [
1935
- /* @__PURE__ */ e(w, { size: "xs", fw: 650, tt: "uppercase", style: { letterSpacing: ".05em" }, children: a }),
1936
- r ? /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", children: r }) : null
1951
+ t.description ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", lh: 1.4, children: t.description }) : null
1952
+ ] }) }, t.key)) }), Nr = ({ attributes: a }) => /* @__PURE__ */ e(L, { gap: 7, children: a.map((t, o) => /* @__PURE__ */ r(N, { gap: 12, wrap: "nowrap", justify: "space-between", children: [
1953
+ /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: t.label }),
1954
+ /* @__PURE__ */ e(p, { size: "sm", fw: 600, ta: "right", children: t.value })
1955
+ ] }, `${t.label}-${o}`)) }), ve = ({ title: a, hint: t, children: o }) => /* @__PURE__ */ r(L, { gap: "xs", children: [
1956
+ /* @__PURE__ */ r(N, { gap: 10, align: "baseline", wrap: "wrap", children: [
1957
+ /* @__PURE__ */ e(p, { size: "xs", fw: 650, tt: "uppercase", style: { letterSpacing: ".05em" }, children: a }),
1958
+ t ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: t }) : null
1937
1959
  ] }),
1938
- l
1939
- ] }), Rr = (a, r) => r > 0 ? ` · ${Math.round(a / r * 100)}%` : "", kr = (a) => {
1940
- const r = a.flags;
1960
+ o
1961
+ ] }), Ue = ({ children: a, maxHeight: t = 420 }) => /* @__PURE__ */ e(fe.Autosize, { mah: t, type: "hover", offsetScrollbars: !0, children: /* @__PURE__ */ e(y.ScrollContainer, { minWidth: 480, type: "native", children: a }) }), Or = 25, $r = ({ card: a, onClose: t }) => {
1962
+ const o = J(
1963
+ Q.SecurityDiagnostics
1964
+ ), [i, u] = z([]), [h, c] = z(1), [I, x] = z(1), [f, C] = z(0), [S, n] = z(!1), [s, w] = z(null), D = a?.metric;
1965
+ return ee(() => {
1966
+ c(1);
1967
+ }, [D]), ee(() => {
1968
+ if (!D)
1969
+ return;
1970
+ let d = !1;
1971
+ return n(!0), w(null), o.getOverviewItems(D, h - 1, Or).then((l) => {
1972
+ d || (u(l.content ?? []), C(l.totalElements ?? 0), x(Math.max(l.totalPages ?? 1, 1)));
1973
+ }).catch((l) => {
1974
+ d || w(l instanceof Error ? l.message : "Não foi possível carregar os itens.");
1975
+ }).finally(() => {
1976
+ d || n(!1);
1977
+ }), () => {
1978
+ d = !0;
1979
+ };
1980
+ }, [o, D, h]), /* @__PURE__ */ e(
1981
+ qa,
1982
+ {
1983
+ opened: !!a,
1984
+ onClose: t,
1985
+ position: "right",
1986
+ size: "xl",
1987
+ title: /* @__PURE__ */ r(L, { gap: 2, children: [
1988
+ /* @__PURE__ */ e(p, { fw: 600, children: a?.label }),
1989
+ a?.description ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", lh: 1.4, children: a.description }) : null
1990
+ ] }),
1991
+ children: /* @__PURE__ */ r(L, { gap: "sm", children: [
1992
+ /* @__PURE__ */ r(N, { gap: 8, children: [
1993
+ /* @__PURE__ */ r(Z, { variant: "light", children: [
1994
+ f,
1995
+ " ",
1996
+ f === 1 ? "item" : "itens"
1997
+ ] }),
1998
+ S ? /* @__PURE__ */ e(le, { size: "xs" }) : null
1999
+ ] }),
2000
+ s ? /* @__PURE__ */ e(be, { color: "red", title: "Erro ao carregar", children: s }) : null,
2001
+ !S && !s && i.length === 0 ? /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: "Nada aqui — o número é zero." }) : null,
2002
+ i.length > 0 ? (
2003
+ // O scroll fica NA TABELA, não no drawer: rolando o drawer, o cabeçalho some e
2004
+ // uma coluna de valores sem cabeçalho deixa de dizer o que é. Aqui o cabeçalho
2005
+ // gruda e o título, a contagem e a paginação ficam onde estavam.
2006
+ /* @__PURE__ */ e(Ue, { maxHeight: "calc(100vh - 260px)", children: /* @__PURE__ */ r(y, { striped: !0, highlightOnHover: !0, withTableBorder: !0, stickyHeader: !0, children: [
2007
+ /* @__PURE__ */ e(y.Thead, { children: /* @__PURE__ */ r(y.Tr, { children: [
2008
+ /* @__PURE__ */ e(y.Th, { children: "Item" }),
2009
+ /* @__PURE__ */ e(y.Th, { children: "Onde" }),
2010
+ /* @__PURE__ */ e(y.Th, { children: "Por que está aqui" })
2011
+ ] }) }),
2012
+ /* @__PURE__ */ e(y.Tbody, { children: i.map((d) => /* @__PURE__ */ r(y.Tr, { children: [
2013
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ e(p, { size: "sm", fw: 550, children: d.label }) }),
2014
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: d.detail }) }),
2015
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ e(p, { size: "xs", children: d.reason }) })
2016
+ ] }, d.id)) })
2017
+ ] }) })
2018
+ ) : null,
2019
+ I > 1 ? /* @__PURE__ */ e(N, { justify: "center", children: /* @__PURE__ */ e(Ha, { value: h, onChange: c, total: I, size: "sm" }) }) : null
2020
+ ] })
2021
+ }
2022
+ );
2023
+ }, Lr = (a, t) => t > 0 ? ` · ${Math.round(a / t * 100)}%` : "", Vr = (a) => {
2024
+ const t = a.flags;
1941
2025
  return [
1942
2026
  {
1943
2027
  key: "archbase.security.access.require-active",
1944
2028
  label: "Filtro de ativo",
1945
- value: r.requireActive ? "Ligado" : "Desligado",
1946
- severity: r.requireActive ? "ok" : "critical",
1947
- description: r.requireActive ? "Permissão para ação inativa não decide." : "Permissão para ação inativa ainda decide."
2029
+ value: t.requireActive ? "Ligado" : "Desligado",
2030
+ severity: t.requireActive ? "ok" : "critical",
2031
+ description: t.requireActive ? "Permissão para ação inativa não decide." : "Permissão para ação inativa ainda decide."
1948
2032
  },
1949
2033
  {
1950
2034
  key: "archbase.security.admin-endpoints.policy",
1951
2035
  label: "Endpoints administrativos",
1952
- value: r.adminEndpointsPolicy,
1953
- severity: r.adminEndpointsPolicy === "permit" ? "critical" : "ok",
1954
- description: r.adminEndpointsPolicy === "permit" ? "permit = qualquer autenticado administra segurança." : "Restrito."
2036
+ value: t.adminEndpointsPolicy,
2037
+ severity: t.adminEndpointsPolicy === "permit" ? "critical" : "ok",
2038
+ description: t.adminEndpointsPolicy === "permit" ? "permit = qualquer autenticado administra segurança." : "Restrito."
1955
2039
  },
1956
2040
  {
1957
2041
  key: "ArchbaseRoleResolver",
1958
2042
  label: "Resolver de papel",
1959
- value: r.roleResolverRegistered ? "Registrado" : "Ausente",
1960
- severity: r.roleResolverRegistered ? "ok" : "warning",
1961
- description: r.roleResolverRegistered ? "@RequireRole é avaliado." : "@RequireRole não restringe nada sem ele."
2043
+ value: t.roleResolverRegistered ? "Registrado" : "Ausente",
2044
+ severity: t.roleResolverRegistered ? "ok" : "warning",
2045
+ description: t.roleResolverRegistered ? "@RequireRole é avaliado." : "@RequireRole não restringe nada sem ele."
1962
2046
  },
1963
2047
  {
1964
2048
  key: "scan",
1965
2049
  label: "Varredura de capacidades",
1966
- value: r.scanConfigured ? "Configurada" : "Não configurada",
1967
- severity: r.scanConfigured ? "ok" : "warning",
1968
- description: r.scanConfigured ? "O catálogo se alimenta do código." : "O catálogo não se alimenta do código."
2050
+ value: t.scanConfigured ? "Configurada" : "Não configurada",
2051
+ severity: t.scanConfigured ? "ok" : "warning",
2052
+ description: t.scanConfigured ? "O catálogo se alimenta do código." : "O catálogo não se alimenta do código."
1969
2053
  }
1970
2054
  ];
1971
- }, Ir = (a) => [
2055
+ }, Mr = (a) => [
1972
2056
  {
1973
2057
  severity: "critical",
1974
2058
  value: a.permissionsPointingToInactive,
1975
- of: `de ${a.permissions}${Rr(a.permissionsPointingToInactive, a.permissions)}`,
2059
+ metric: "PERMISSIONS_POINTING_TO_INACTIVE",
2060
+ of: `de ${a.permissions}${Lr(a.permissionsPointingToInactive, a.permissions)}`,
1976
2061
  label: "Permissões inertes",
1977
2062
  description: "Apontam para ação ou recurso inativo. É o acesso que o operador acredita ter concedido."
1978
2063
  },
1979
2064
  {
1980
2065
  severity: "warning",
1981
2066
  value: a.administrators,
2067
+ metric: "ADMINISTRATORS",
1982
2068
  of: `de ${a.users} usuários`,
1983
2069
  label: "Administradores",
1984
2070
  description: "Passam direto pelo portão GRANT. Nada configurado nesta tela se aplica a eles."
@@ -1986,6 +2072,7 @@ const Ve = (a) => {
1986
2072
  {
1987
2073
  severity: "warning",
1988
2074
  value: a.actionsInactive,
2075
+ metric: "ACTIONS_INACTIVE",
1989
2076
  of: `de ${a.actions} ações`,
1990
2077
  label: "Ações inativas",
1991
2078
  description: "Capacidades do catálogo que não valem. São a origem das permissões inertes."
@@ -1993,6 +2080,7 @@ const Ve = (a) => {
1993
2080
  {
1994
2081
  severity: "warning",
1995
2082
  value: a.apiResourcesInactive,
2083
+ metric: "API_RESOURCES_INACTIVE",
1996
2084
  of: `de ${a.apiResources} recursos API`,
1997
2085
  label: "Recursos API desativados",
1998
2086
  description: "Desativados pela varredura por não terem @HasPermission correspondente."
@@ -2000,6 +2088,7 @@ const Ve = (a) => {
2000
2088
  {
2001
2089
  severity: "neutral",
2002
2090
  value: a.resourcesWithoutAction,
2091
+ metric: "RESOURCES_WITHOUT_ACTION",
2003
2092
  of: `de ${a.resources} recursos`,
2004
2093
  label: "Recursos sem ação",
2005
2094
  description: "Telas ainda não abertas neste tenant. Indicador operacional, não alerta."
@@ -2007,323 +2096,802 @@ const Ve = (a) => {
2007
2096
  {
2008
2097
  severity: "warning",
2009
2098
  value: a.actionsWithoutPermission,
2099
+ metric: "ACTIONS_WITHOUT_PERMISSION",
2010
2100
  of: "ações",
2011
2101
  label: "Ninguém tem",
2012
2102
  description: "Capacidade existe no catálogo e não foi concedida a ninguém."
2013
2103
  }
2014
- ], Pr = ({ slots: a, onError: r }) => {
2015
- const l = X(
2104
+ ], ma = ({ slots: a, onError: t }) => {
2105
+ const o = J(
2016
2106
  Q.SecurityDiagnostics
2017
- ), [i, h] = P(void 0), [n, A] = P(!0), [v, x] = P(void 0);
2018
- Se(() => {
2019
- let u = !0;
2020
- return A(!0), l.getOverview().then((b) => {
2021
- u && (h(b), x(void 0));
2022
- }).catch((b) => {
2023
- if (u) {
2024
- const D = he(b);
2025
- x(D), r?.(D);
2107
+ ), [i, u] = z(void 0), [h, c] = z(!0), [I, x] = z(void 0), [f, C] = z(null);
2108
+ ee(() => {
2109
+ let s = !0;
2110
+ return c(!0), o.getOverview().then((w) => {
2111
+ s && (u(w), x(void 0));
2112
+ }).catch((w) => {
2113
+ if (s) {
2114
+ const D = ge(w);
2115
+ x(D), t?.(D);
2026
2116
  }
2027
2117
  }).finally(() => {
2028
- u && A(!1);
2118
+ s && c(!1);
2029
2119
  }), () => {
2030
- u = !1;
2120
+ s = !1;
2031
2121
  };
2032
- }, [l]);
2033
- const c = ae(
2034
- () => i ? [...kr(i), ...a?.additionalFlags?.(i) ?? []] : [],
2122
+ }, [o]);
2123
+ const S = ie(
2124
+ () => i ? [...Vr(i), ...a?.additionalFlags?.(i) ?? []] : [],
2035
2125
  [i, a]
2036
- ), C = ae(
2037
- () => i ? [...Ir(i), ...a?.additionalOverviewCards?.(i) ?? []] : [],
2126
+ ), n = ie(
2127
+ () => i ? [...Mr(i), ...a?.additionalOverviewCards?.(i) ?? []] : [],
2038
2128
  [i, a]
2039
2129
  );
2040
- return n ? /* @__PURE__ */ e(Ke, { size: "sm" }) : v ? /* @__PURE__ */ e(ke, { color: "red", title: "Não foi possível ler o diagnóstico", children: v }) : i ? /* @__PURE__ */ o(W, { gap: "lg", children: [
2041
- /* @__PURE__ */ o(Fe, { title: "Proteções", hint: "de AccessOverview.flags", children: [
2042
- /* @__PURE__ */ e(xr, { flags: c }),
2043
- /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", lh: 1.45, children: "Todas nascem com o padrão compatível — ligadas só quando alguém decide." })
2130
+ return h ? /* @__PURE__ */ e(le, { size: "sm" }) : I ? /* @__PURE__ */ e(be, { color: "red", title: "Não foi possível ler o diagnóstico", children: I }) : i ? /* @__PURE__ */ r(L, { gap: "lg", children: [
2131
+ /* @__PURE__ */ r(ve, { title: "Proteções", hint: "de AccessOverview.flags", children: [
2132
+ /* @__PURE__ */ e(Fr, { flags: S }),
2133
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", lh: 1.45, children: "Todas nascem com o padrão compatível — ligadas só quando alguém decide." })
2044
2134
  ] }),
2045
- /* @__PURE__ */ e(Fe, { title: "Catálogo e concessões", hint: "contagens vivas", children: /* @__PURE__ */ e(Ar, { cards: C }) }),
2046
- a?.afterOverview?.(i)
2135
+ /* @__PURE__ */ e(ve, { title: "Catálogo e concessões", hint: "contagens vivas", children: /* @__PURE__ */ e(Dr, { cards: n, onOpenCard: C }) }),
2136
+ a?.afterOverview?.(i),
2137
+ /* @__PURE__ */ e($r, { card: f, onClose: () => C(null) })
2047
2138
  ] }) : null;
2048
- }, da = {
2139
+ }, ga = {
2049
2140
  EFFECTIVE: { label: "Efetiva", color: "green" },
2050
2141
  INERT: { label: "Inerte", color: "orange" },
2051
2142
  DENIED: { label: "Negada", color: "red" }
2052
- }, Fr = { GROUP: "grupo", PROFILE: "perfil", USER: "direto" }, zr = [
2143
+ }, Gr = { GROUP: "grupo", PROFILE: "perfil", USER: "direto" }, Ur = [
2053
2144
  { value: "all", label: "Todas" },
2054
2145
  { value: "EFFECTIVE", label: "Só efetivas" },
2055
2146
  { value: "INERT", label: "Só inertes" },
2056
2147
  { value: "DENIED", label: "Negadas" },
2057
2148
  { value: "inherited", label: "Só herdadas" }
2058
- ], Dr = ({ slots: a, onError: r }) => {
2059
- const l = X(
2149
+ ], Br = ({ slots: a, onError: t, userId: o }) => {
2150
+ const i = J(
2060
2151
  Q.SecurityDiagnostics
2061
- ), [i, h] = P(""), [n, A] = P(void 0), [v, x] = P(!1), [c, C] = P(void 0), [u, b] = P("all"), D = de(
2062
- async (t) => {
2063
- const d = t.trim();
2064
- if (d) {
2065
- x(!0), C(void 0);
2152
+ ), [u, h] = z(""), [c, I] = z(void 0), [x, f] = z(!1), [C, S] = z(void 0), [n, s] = z("all"), w = !!o, D = oe(
2153
+ async (v) => {
2154
+ const T = v.trim();
2155
+ if (T) {
2156
+ f(!0), S(void 0);
2066
2157
  try {
2067
- const g = d.includes("@") ? await l.getEffectiveAccessByEmail(d) : await l.getEffectiveAccessByUserId(d);
2068
- A(g);
2069
- } catch (g) {
2070
- const F = he(g);
2071
- C(F), r?.(F), A(void 0);
2158
+ const A = T.includes("@") ? await i.getEffectiveAccessByEmail(T) : await i.getEffectiveAccessByUserId(T);
2159
+ I(A);
2160
+ } catch (A) {
2161
+ const b = ge(A);
2162
+ S(b), t?.(b), I(void 0);
2072
2163
  } finally {
2073
- x(!1);
2164
+ f(!1);
2074
2165
  }
2075
2166
  }
2076
2167
  },
2077
- [l, r]
2078
- ), y = ae(() => n ? [
2079
- { label: "Perfil", value: n.profileName || "—" },
2080
- { label: "Grupos", value: n.groupNames.length ? n.groupNames.join(", ") : "—" },
2081
- ...a?.userAttributes?.(n) ?? []
2082
- ] : [], [n, a]), q = ae(() => n ? u === "all" ? n.capabilities : u === "inherited" ? n.capabilities.filter((t) => t.grantedByType !== "USER") : n.capabilities.filter((t) => t.situation === u) : [], [n, u]), V = a?.additionalCapabilityColumns ?? [];
2083
- return /* @__PURE__ */ o(W, { gap: "lg", children: [
2084
- /* @__PURE__ */ e(Fe, { title: "Consultar", hint: "por e-mail ou id do usuário", children: a?.renderUserSearch ? a.renderUserSearch((t) => {
2085
- h(t), D(t);
2086
- }) : /* @__PURE__ */ o(N, { gap: "xs", align: "flex-end", children: [
2168
+ [i, t]
2169
+ ), d = ie(() => c ? [
2170
+ { label: "Perfil", value: c.profileName || "—" },
2171
+ { label: "Grupos", value: c.groupNames.length ? c.groupNames.join(", ") : "—" },
2172
+ ...a?.userAttributes?.(c) ?? []
2173
+ ] : [], [c, a]), l = ie(() => c ? n === "all" ? c.capabilities : n === "inherited" ? c.capabilities.filter((v) => v.grantedByType !== "USER") : c.capabilities.filter((v) => v.situation === n) : [], [c, n]);
2174
+ ee(() => {
2175
+ o && (s("all"), D(o));
2176
+ }, [o, D]);
2177
+ const m = a?.additionalCapabilityColumns ?? [];
2178
+ return /* @__PURE__ */ r(L, { gap: "lg", children: [
2179
+ w ? null : /* @__PURE__ */ e(ve, { title: "Consultar", hint: "por e-mail ou id do usuário", children: a?.renderUserSearch ? a.renderUserSearch((v) => {
2180
+ h(v), D(v);
2181
+ }) : /* @__PURE__ */ r(N, { gap: "xs", align: "flex-end", children: [
2087
2182
  /* @__PURE__ */ e(
2088
- ge,
2183
+ me,
2089
2184
  {
2090
2185
  style: { flex: 1, minWidth: 240 },
2091
2186
  label: "Usuário",
2092
2187
  placeholder: "pessoa@empresa.com.br",
2093
- value: i,
2094
- onChange: (t) => h(t.currentTarget.value),
2095
- onKeyDown: (t) => {
2096
- t.key === "Enter" && D(i);
2188
+ value: u,
2189
+ onChange: (v) => h(v.currentTarget.value),
2190
+ onKeyDown: (v) => {
2191
+ v.key === "Enter" && D(u);
2097
2192
  }
2098
2193
  }
2099
2194
  ),
2100
- /* @__PURE__ */ e(Z, { onClick: () => void D(i), loading: v, children: "Consultar" })
2195
+ /* @__PURE__ */ e(Y, { onClick: () => void D(u), loading: x, children: "Consultar" })
2101
2196
  ] }) }),
2102
- c ? /* @__PURE__ */ e(ke, { color: "red", title: "Não foi possível ler o efetivo", children: c }) : null,
2103
- v && !n ? /* @__PURE__ */ e(Ke, { size: "sm" }) : null,
2104
- n ? /* @__PURE__ */ o(Ne, { children: [
2105
- /* @__PURE__ */ e(Y, { withBorder: !0, radius: "md", p: "md", children: /* @__PURE__ */ o(W, { gap: "sm", children: [
2106
- /* @__PURE__ */ o(N, { gap: 8, wrap: "wrap", align: "center", children: [
2107
- /* @__PURE__ */ e(w, { fw: 620, children: n.userLabel }),
2108
- n.administrator ? /* @__PURE__ */ e(te, { color: "red", children: "administrador" }) : null,
2109
- n.enabled ? null : /* @__PURE__ */ e(te, { color: "red", children: "conta desativada" }),
2110
- a?.afterUserBadges?.(n)
2197
+ C ? /* @__PURE__ */ e(be, { color: "red", title: "Não foi possível ler o efetivo", children: C }) : null,
2198
+ x && !c ? /* @__PURE__ */ e(le, { size: "sm" }) : null,
2199
+ c ? /* @__PURE__ */ r(Pe, { children: [
2200
+ /* @__PURE__ */ e(_, { withBorder: !0, radius: "md", p: "md", children: /* @__PURE__ */ r(L, { gap: "sm", children: [
2201
+ /* @__PURE__ */ r(N, { gap: 8, wrap: "wrap", align: "center", children: [
2202
+ /* @__PURE__ */ e(p, { fw: 620, children: c.userLabel }),
2203
+ c.administrator ? /* @__PURE__ */ e(Z, { color: "red", children: "administrador" }) : null,
2204
+ c.enabled ? null : /* @__PURE__ */ e(Z, { color: "red", children: "conta desativada" }),
2205
+ a?.afterUserBadges?.(c)
2111
2206
  ] }),
2112
- /* @__PURE__ */ e(Tr, { attributes: y })
2207
+ /* @__PURE__ */ e(Nr, { attributes: d })
2113
2208
  ] }) }),
2114
- n.administrator ? /* @__PURE__ */ o(ke, { color: "orange", title: "Administrador passa direto", children: [
2209
+ c.administrator ? /* @__PURE__ */ r(be, { color: "orange", title: "Administrador passa direto", children: [
2115
2210
  "O portão GRANT concede sem consultar o catálogo. A lista abaixo vir vazia não é falta de dado — é o atalho que a flag ",
2116
2211
  /* @__PURE__ */ e("code", { children: "isAdministrator" }),
2117
2212
  " representa."
2118
2213
  ] }) : null,
2119
- /* @__PURE__ */ e(Me, { cols: { base: 2, sm: 4 }, spacing: "xs", children: [
2120
- ["concedidas", n.granted, "neutral"],
2121
- ["efetivas", n.effective, "ok"],
2122
- ["inertes", n.inert, "warning"],
2123
- ["negadas", n.denied, "critical"]
2124
- ].map(([t, d, g]) => /* @__PURE__ */ e(Y, { withBorder: !0, radius: "md", p: "sm", children: /* @__PURE__ */ o(W, { gap: 2, children: [
2125
- /* @__PURE__ */ e(w, { size: "1.3rem", fw: 620, c: Ve(g), children: d }),
2126
- /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", children: t })
2127
- ] }) }, t)) }),
2128
- a?.afterEffectiveTally?.(n),
2129
- /* @__PURE__ */ o(Fe, { title: "Capacidades", hint: `${q.length} de ${n.capabilities.length}`, children: [
2130
- /* @__PURE__ */ e(ta.Group, { multiple: !1, value: u, onChange: (t) => b(t), children: /* @__PURE__ */ e(N, { gap: 6, children: zr.map((t) => /* @__PURE__ */ e(ta, { value: t.value, size: "xs", variant: "outline", children: t.label }, t.value)) }) }),
2131
- /* @__PURE__ */ e(j.ScrollContainer, { minWidth: 640, children: /* @__PURE__ */ o(j, { striped: !0, highlightOnHover: !0, withTableBorder: !0, children: [
2132
- /* @__PURE__ */ e(j.Thead, { children: /* @__PURE__ */ o(j.Tr, { children: [
2133
- /* @__PURE__ */ e(j.Th, { children: "Capacidade" }),
2134
- /* @__PURE__ */ e(j.Th, { children: "Origem" }),
2135
- /* @__PURE__ */ e(j.Th, { children: "Situação" }),
2136
- V.map((t) => /* @__PURE__ */ e(j.Th, { children: t.header }, t.header))
2214
+ /* @__PURE__ */ e(We, { cols: { base: 2, sm: 4 }, spacing: "xs", children: [
2215
+ ["concedidas", c.granted, "neutral"],
2216
+ ["efetivas", c.effective, "ok"],
2217
+ ["inertes", c.inert, "warning"],
2218
+ ["negadas", c.denied, "critical"]
2219
+ ].map(([v, T, A]) => /* @__PURE__ */ e(_, { withBorder: !0, radius: "md", p: "sm", children: /* @__PURE__ */ r(L, { gap: 2, children: [
2220
+ /* @__PURE__ */ e(p, { size: "1.3rem", fw: 620, c: Ge(A), children: T }),
2221
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: v })
2222
+ ] }) }, v)) }),
2223
+ a?.afterEffectiveTally?.(c),
2224
+ /* @__PURE__ */ r(ve, { title: "Capacidades", hint: `${l.length} de ${c.capabilities.length}`, children: [
2225
+ /* @__PURE__ */ e(la.Group, { multiple: !1, value: n, onChange: (v) => s(v), children: /* @__PURE__ */ e(N, { gap: 6, children: Ur.map((v) => /* @__PURE__ */ e(la, { value: v.value, size: "xs", variant: "outline", children: v.label }, v.value)) }) }),
2226
+ /* @__PURE__ */ e(y.ScrollContainer, { minWidth: 640, children: /* @__PURE__ */ r(y, { striped: !0, highlightOnHover: !0, withTableBorder: !0, children: [
2227
+ /* @__PURE__ */ e(y.Thead, { children: /* @__PURE__ */ r(y.Tr, { children: [
2228
+ /* @__PURE__ */ e(y.Th, { children: "Capacidade" }),
2229
+ /* @__PURE__ */ e(y.Th, { children: "Origem" }),
2230
+ /* @__PURE__ */ e(y.Th, { children: "Situação" }),
2231
+ m.map((v) => /* @__PURE__ */ e(y.Th, { children: v.header }, v.header))
2137
2232
  ] }) }),
2138
- /* @__PURE__ */ o(j.Tbody, { children: [
2139
- q.map((t, d) => /* @__PURE__ */ o(j.Tr, { children: [
2140
- /* @__PURE__ */ e(j.Td, { children: /* @__PURE__ */ o(w, { size: "sm", ff: "monospace", children: [
2141
- t.resource,
2233
+ /* @__PURE__ */ r(y.Tbody, { children: [
2234
+ l.map((v, T) => /* @__PURE__ */ r(y.Tr, { children: [
2235
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ r(p, { size: "sm", ff: "monospace", children: [
2236
+ v.resource,
2142
2237
  ":",
2143
- t.action
2238
+ v.action
2144
2239
  ] }) }),
2145
- /* @__PURE__ */ e(j.Td, { children: /* @__PURE__ */ o(w, { size: "sm", children: [
2146
- /* @__PURE__ */ o(w, { span: !0, c: "dimmed", children: [
2147
- Fr[t.grantedByType] ?? t.grantedByType,
2240
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ r(p, { size: "sm", children: [
2241
+ /* @__PURE__ */ r(p, { span: !0, c: "dimmed", children: [
2242
+ Gr[v.grantedByType] ?? v.grantedByType,
2148
2243
  " "
2149
2244
  ] }),
2150
- t.grantedByName
2245
+ v.grantedByName
2151
2246
  ] }) }),
2152
- /* @__PURE__ */ e(j.Td, { children: /* @__PURE__ */ e(te, { color: da[t.situation].color, variant: "light", children: da[t.situation].label }) }),
2153
- V.map((g) => /* @__PURE__ */ e(j.Td, { children: g.render(t, n) }, g.header))
2154
- ] }, `${t.resource}:${t.action}:${d}`)),
2155
- q.length === 0 ? /* @__PURE__ */ e(j.Tr, { children: /* @__PURE__ */ e(j.Td, { colSpan: 3 + V.length, children: /* @__PURE__ */ e(w, { size: "sm", c: "dimmed", ta: "center", py: "md", children: "Nenhuma capacidade neste filtro." }) }) }) : null
2247
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ e(Z, { color: ga[v.situation].color, variant: "light", children: ga[v.situation].label }) }),
2248
+ m.map((A) => /* @__PURE__ */ e(y.Td, { children: A.render(v, c) }, A.header))
2249
+ ] }, `${v.resource}:${v.action}:${T}`)),
2250
+ l.length === 0 ? /* @__PURE__ */ e(y.Tr, { children: /* @__PURE__ */ e(y.Td, { colSpan: 3 + m.length, children: /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", ta: "center", py: "md", children: "Nenhuma capacidade neste filtro." }) }) }) : null
2156
2251
  ] })
2157
2252
  ] }) })
2158
2253
  ] })
2159
2254
  ] }) : null
2160
2255
  ] });
2161
- }, Er = [
2256
+ }, Wr = [
2162
2257
  { gate: "IDENTITY", titulo: "Identidade", papel: "só nega", pergunta: "O principal é resolvível e a conta está ativa?" },
2163
2258
  { gate: "SCOPE", titulo: "Escopo", papel: "só nega", pergunta: "A concessão vale para o tenant, empresa e projeto pedidos?" },
2164
2259
  { gate: "RESTRICTION", titulo: "Restrições", papel: "só nega", pergunta: "Perfil, papel e persona exigidos pela anotação." },
2165
2260
  { gate: "LEVEL", titulo: "Nível", papel: "só nega", pergunta: "O nível da pessoa alcança o piso da capacidade?" },
2166
2261
  { gate: "GRANT", titulo: "Concessão", papel: "concede", pergunta: "Existe permissão, sem negação explícita?" }
2167
- ], $r = ({ slots: a, onError: r }) => {
2168
- const l = X(
2262
+ ], qr = ({ slots: a, onError: t, initial: o }) => {
2263
+ const i = J(
2169
2264
  Q.SecurityDiagnostics
2170
- ), [i, h] = P(""), [n, A] = P(""), [v, x] = P(""), [c, C] = P({}), [u, b] = P(void 0), [D, y] = P(!1), [q, V] = P(void 0), t = de(async () => {
2171
- if (!(!i.trim() || !n.trim() || !v.trim())) {
2172
- y(!0), V(void 0);
2265
+ ), [u, h] = z(""), [c, I] = z(""), [x, f] = z(""), [C, S] = z({}), [n, s] = z(void 0), [w, D] = z(!1), [d, l] = z(void 0);
2266
+ ee(() => {
2267
+ o && (o.userId && h(o.userId), o.resource && I(o.resource), o.action && f(o.action), s(void 0));
2268
+ }, [o?.userId, o?.resource, o?.action]);
2269
+ const m = oe(async () => {
2270
+ if (!(!u.trim() || !c.trim() || !x.trim())) {
2271
+ D(!0), l(void 0);
2173
2272
  try {
2174
- const g = i.trim(), F = await l.simulate({
2175
- ...g.includes("@") ? { email: g } : { userId: g },
2176
- resource: n.trim(),
2177
- action: v.trim(),
2178
- companyId: c.companyId,
2179
- projectId: c.projectId
2273
+ const T = u.trim(), A = await i.simulate({
2274
+ ...T.includes("@") ? { email: T } : { userId: T },
2275
+ resource: c.trim(),
2276
+ action: x.trim(),
2277
+ companyId: C.companyId,
2278
+ projectId: C.projectId
2180
2279
  });
2181
- b(F);
2182
- } catch (g) {
2183
- const F = he(g);
2184
- V(F), r?.(F), b(void 0);
2280
+ s(A);
2281
+ } catch (T) {
2282
+ const A = ge(T);
2283
+ l(A), t?.(A), s(void 0);
2185
2284
  } finally {
2186
- y(!1);
2285
+ D(!1);
2187
2286
  }
2188
2287
  }
2189
- }, [l, i, n, v, c, r]), d = (g, F) => {
2190
- const z = F.chain?.find((f) => f.gate === g);
2191
- return z ? z.passed ? "passou" : "negou" : "nao-avaliado";
2288
+ }, [i, u, c, x, C, t]), v = (T, A) => {
2289
+ const b = A.chain?.find((j) => j.gate === T);
2290
+ return b ? b.passed ? "passou" : "negou" : "nao-avaliado";
2192
2291
  };
2193
- return /* @__PURE__ */ o(W, { gap: "lg", children: [
2194
- /* @__PURE__ */ e(Y, { withBorder: !0, radius: "md", p: "md", children: /* @__PURE__ */ o(W, { gap: "sm", children: [
2195
- /* @__PURE__ */ o(Me, { cols: { base: 1, sm: 2, lg: 4 }, spacing: "xs", children: [
2292
+ return /* @__PURE__ */ r(L, { gap: "lg", children: [
2293
+ /* @__PURE__ */ e(_, { withBorder: !0, radius: "md", p: "md", children: /* @__PURE__ */ r(L, { gap: "sm", children: [
2294
+ /* @__PURE__ */ r(We, { cols: { base: 1, sm: 2, lg: 4 }, spacing: "xs", children: [
2196
2295
  /* @__PURE__ */ e(
2197
- ge,
2296
+ me,
2198
2297
  {
2199
2298
  label: "Usuário",
2200
2299
  placeholder: "e-mail ou id",
2201
- value: i,
2202
- onChange: (g) => h(g.currentTarget.value)
2300
+ value: u,
2301
+ onChange: (T) => h(T.currentTarget.value)
2203
2302
  }
2204
2303
  ),
2205
2304
  /* @__PURE__ */ e(
2206
- ge,
2305
+ me,
2207
2306
  {
2208
2307
  label: "Recurso",
2209
2308
  placeholder: "tms.ordemservico",
2210
- value: n,
2211
- onChange: (g) => A(g.currentTarget.value)
2309
+ value: c,
2310
+ onChange: (T) => I(T.currentTarget.value)
2212
2311
  }
2213
2312
  ),
2214
2313
  /* @__PURE__ */ e(
2215
- ge,
2314
+ me,
2216
2315
  {
2217
2316
  label: "Ação",
2218
2317
  placeholder: "aprovar_custo",
2219
- value: v,
2220
- onChange: (g) => x(g.currentTarget.value)
2318
+ value: x,
2319
+ onChange: (T) => f(T.currentTarget.value)
2221
2320
  }
2222
2321
  ),
2223
2322
  /* @__PURE__ */ e(
2224
- ge,
2323
+ me,
2225
2324
  {
2226
2325
  label: "Empresa (opcional)",
2227
2326
  placeholder: "companyId",
2228
- value: c.companyId ?? "",
2229
- onChange: (g) => C((F) => ({ ...F, companyId: g.currentTarget.value || void 0 }))
2327
+ value: C.companyId ?? "",
2328
+ onChange: (T) => S((A) => ({ ...A, companyId: T.currentTarget.value || void 0 }))
2230
2329
  }
2231
2330
  )
2232
2331
  ] }),
2233
- a?.afterSimulationFields?.((g) => C((F) => ({ ...F, ...g }))),
2234
- /* @__PURE__ */ o(N, { gap: "xs", align: "center", children: [
2235
- /* @__PURE__ */ e(Z, { onClick: () => void t(), loading: D, children: "Simular" }),
2236
- /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", children: "Somente leitura — não altera permissão nenhuma." })
2332
+ a?.afterSimulationFields?.((T) => S((A) => ({ ...A, ...T }))),
2333
+ /* @__PURE__ */ r(N, { gap: "xs", align: "center", children: [
2334
+ /* @__PURE__ */ e(Y, { onClick: () => void m(), loading: w, children: "Simular" }),
2335
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: "Somente leitura — não altera permissão nenhuma." })
2237
2336
  ] })
2238
2337
  ] }) }),
2239
- q ? /* @__PURE__ */ e(ke, { color: "red", title: "Não foi possível simular", children: q }) : null,
2240
- D && !u ? /* @__PURE__ */ e(Ke, { size: "sm" }) : null,
2241
- u ? /* @__PURE__ */ o(Ne, { children: [
2242
- /* @__PURE__ */ e(Fe, { title: "Cadeia de decisão", hint: "os quatro primeiros só negam; só o quinto concede", children: /* @__PURE__ */ e(Y, { withBorder: !0, radius: "md", p: "md", children: /* @__PURE__ */ e(W, { gap: "sm", children: Er.map((g, F) => {
2243
- const z = d(g.gate, u), f = u.chain?.find((oe) => oe.gate === g.gate)?.detail;
2244
- return /* @__PURE__ */ o(N, { align: "flex-start", wrap: "nowrap", gap: "sm", children: [
2245
- /* @__PURE__ */ e(w, { size: "xs", ff: "monospace", c: "dimmed", w: 16, children: F + 1 }),
2246
- /* @__PURE__ */ o(W, { gap: 2, style: { flex: 1, minWidth: 0 }, children: [
2247
- /* @__PURE__ */ o(N, { gap: 8, align: "baseline", wrap: "wrap", children: [
2338
+ d ? /* @__PURE__ */ e(be, { color: "red", title: "Não foi possível simular", children: d }) : null,
2339
+ w && !n ? /* @__PURE__ */ e(le, { size: "sm" }) : null,
2340
+ n ? /* @__PURE__ */ r(Pe, { children: [
2341
+ /* @__PURE__ */ e(ve, { title: "Cadeia de decisão", hint: "os quatro primeiros só negam; só o quinto concede", children: /* @__PURE__ */ e(_, { withBorder: !0, radius: "md", p: "md", children: /* @__PURE__ */ e(L, { gap: "sm", children: Wr.map((T, A) => {
2342
+ const b = v(T.gate, n), j = n.chain?.find((G) => G.gate === T.gate)?.detail;
2343
+ return /* @__PURE__ */ r(N, { align: "flex-start", wrap: "nowrap", gap: "sm", children: [
2344
+ /* @__PURE__ */ e(p, { size: "xs", ff: "monospace", c: "dimmed", w: 16, children: A + 1 }),
2345
+ /* @__PURE__ */ r(L, { gap: 2, style: { flex: 1, minWidth: 0 }, children: [
2346
+ /* @__PURE__ */ r(N, { gap: 8, align: "baseline", wrap: "wrap", children: [
2248
2347
  /* @__PURE__ */ e(
2249
- w,
2348
+ p,
2250
2349
  {
2251
2350
  size: "sm",
2252
2351
  fw: 600,
2253
- c: z === "negou" ? "red" : void 0,
2254
- opacity: z === "nao-avaliado" ? 0.5 : 1,
2255
- children: g.titulo
2352
+ c: b === "negou" ? "red" : void 0,
2353
+ opacity: b === "nao-avaliado" ? 0.5 : 1,
2354
+ children: T.titulo
2256
2355
  }
2257
2356
  ),
2258
- /* @__PURE__ */ o(w, { size: "xs", c: "dimmed", children: [
2357
+ /* @__PURE__ */ r(p, { size: "xs", c: "dimmed", children: [
2259
2358
  "· ",
2260
- g.papel
2359
+ T.papel
2261
2360
  ] })
2262
2361
  ] }),
2263
- /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", opacity: z === "nao-avaliado" ? 0.5 : 1, children: g.pergunta }),
2264
- f ? /* @__PURE__ */ e(w, { size: "xs", c: "dimmed", children: f }) : null
2362
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", opacity: b === "nao-avaliado" ? 0.5 : 1, children: T.pergunta }),
2363
+ j ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: j }) : null
2265
2364
  ] }),
2266
2365
  /* @__PURE__ */ e(
2267
- te,
2366
+ Z,
2268
2367
  {
2269
2368
  variant: "light",
2270
- color: z === "negou" ? "red" : z === "passou" ? "green" : "gray",
2271
- children: z === "nao-avaliado" ? "não avaliado" : z
2369
+ color: b === "negou" ? "red" : b === "passou" ? "green" : "gray",
2370
+ children: b === "nao-avaliado" ? "não avaliado" : b
2272
2371
  }
2273
2372
  )
2274
- ] }, g.gate);
2373
+ ] }, T.gate);
2275
2374
  }) }) }) }),
2276
- /* @__PURE__ */ e(ke, { color: u.allowed ? "green" : "red", title: u.allowed ? "Pode" : "Não pode", children: /* @__PURE__ */ o(W, { gap: 6, children: [
2277
- /* @__PURE__ */ e(w, { size: "sm", children: u.message }),
2278
- /* @__PURE__ */ o(w, { size: "xs", ff: "monospace", c: "dimmed", children: [
2375
+ /* @__PURE__ */ e(be, { color: n.allowed ? "green" : "red", title: n.allowed ? "Pode" : "Não pode", children: /* @__PURE__ */ r(L, { gap: 6, children: [
2376
+ /* @__PURE__ */ e(p, { size: "sm", children: n.message }),
2377
+ /* @__PURE__ */ r(p, { size: "xs", ff: "monospace", c: "dimmed", children: [
2279
2378
  "reasonCode: ",
2280
- u.reasonCode,
2281
- u.deniedAt ? ` · deniedAt: ${u.deniedAt}` : "",
2282
- u.grantedByName ? ` · grantedBy: ${u.grantedByName}` : ""
2379
+ n.reasonCode,
2380
+ n.deniedAt ? ` · deniedAt: ${n.deniedAt}` : "",
2381
+ n.grantedByName ? ` · grantedBy: ${n.grantedByName}` : ""
2283
2382
  ] })
2284
2383
  ] }) }),
2285
- a?.afterDecision?.(u)
2384
+ a?.afterDecision?.(n)
2286
2385
  ] }) : null
2287
2386
  ] });
2288
- }, Nr = ["overview", "effective", "simulate"];
2289
- function Kr({
2290
- height: a = "100%",
2291
- width: r = "100%",
2292
- defaultTab: l = "overview",
2293
- tabs: i = Nr,
2294
- slots: h,
2295
- onError: n
2296
- }) {
2297
- const [A, v] = P(l), x = (c) => i.includes(c);
2298
- return /* @__PURE__ */ e(Y, { style: { height: a, width: r }, p: "md", withBorder: !1, children: /* @__PURE__ */ o(K, { value: A, onChange: v, variant: "pills", keepMounted: !1, children: [
2299
- /* @__PURE__ */ o(K.List, { mb: "md", children: [
2300
- x("overview") ? /* @__PURE__ */ e(K.Tab, { value: "overview", leftSection: /* @__PURE__ */ e(Ka, { size: "1rem" }), children: "Panorama" }) : null,
2301
- x("effective") ? /* @__PURE__ */ e(K.Tab, { value: "effective", leftSection: /* @__PURE__ */ e(Qa, { size: "1rem" }), children: "Efetivo do usuário" }) : null,
2302
- x("simulate") ? /* @__PURE__ */ e(K.Tab, { value: "simulate", leftSection: /* @__PURE__ */ e(Xa, { size: "1rem" }), children: "Simular" }) : null
2387
+ }, ka = (a) => {
2388
+ switch (a) {
2389
+ case "EFFECTIVE":
2390
+ return /* @__PURE__ */ e(Z, { size: "sm", color: "green", variant: "light", children: "vale" });
2391
+ case "INERT":
2392
+ return /* @__PURE__ */ e(Z, { size: "sm", color: "yellow", variant: "light", children: "não vale" });
2393
+ case "DENIED":
2394
+ return /* @__PURE__ */ e(Z, { size: "sm", color: "red", variant: "light", children: "bloqueada" });
2395
+ default:
2396
+ return /* @__PURE__ */ e(Z, { size: "sm", color: "gray", variant: "light", children: "—" });
2397
+ }
2398
+ }, Hr = ({ id: a, label: t, slots: o, onSelectUser: i, onSimulate: u }) => {
2399
+ const h = J(
2400
+ Q.SecurityDiagnostics
2401
+ ), [c, I] = z([]), [x, f] = z(!0), [C, S] = z();
2402
+ ee(() => {
2403
+ let s = !1;
2404
+ return f(!0), S(void 0), h.getReach(a).then((w) => {
2405
+ s || I(w ?? []);
2406
+ }).catch((w) => {
2407
+ s || S(w instanceof Error ? w.message : "Não foi possível carregar.");
2408
+ }).finally(() => {
2409
+ s || f(!1);
2410
+ }), () => {
2411
+ s = !0;
2412
+ };
2413
+ }, [h, a]);
2414
+ const n = c.filter((s) => s.kind === "ADMINISTRADOR").length;
2415
+ return /* @__PURE__ */ r(L, { gap: "lg", children: [
2416
+ /* @__PURE__ */ r(L, { gap: 4, children: [
2417
+ /* @__PURE__ */ e(p, { fw: 620, size: "xl", ff: "monospace", children: t }),
2418
+ /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: "Quem alcança esta capacidade, e por qual via." })
2303
2419
  ] }),
2304
- x("overview") ? /* @__PURE__ */ e(K.Panel, { value: "overview", children: /* @__PURE__ */ e(Pr, { slots: h, onError: n }) }) : null,
2305
- x("effective") ? /* @__PURE__ */ e(K.Panel, { value: "effective", children: /* @__PURE__ */ e(Dr, { slots: h, onError: n }) }) : null,
2306
- x("simulate") ? /* @__PURE__ */ e(K.Panel, { value: "simulate", children: /* @__PURE__ */ e($r, { slots: h, onError: n }) }) : null
2307
- ] }) });
2308
- }
2420
+ C ? /* @__PURE__ */ e(be, { color: "red", title: "Erro ao carregar", children: C }) : null,
2421
+ /* @__PURE__ */ e(
2422
+ ve,
2423
+ {
2424
+ title: "Quem alcança",
2425
+ hint: x ? "carregando…" : `${c.length} ${c.length === 1 ? "pessoa" : "pessoas"}`,
2426
+ children: x ? /* @__PURE__ */ e(le, { size: "sm" }) : c.length === 0 ? /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: "Ninguém. A capacidade existe no catálogo e nunca foi concedida." }) : /* @__PURE__ */ r(Pe, { children: [
2427
+ /* @__PURE__ */ e(Ue, { children: /* @__PURE__ */ r(y, { striped: !0, highlightOnHover: !0, withTableBorder: !0, stickyHeader: !0, children: [
2428
+ /* @__PURE__ */ e(y.Thead, { children: /* @__PURE__ */ r(y.Tr, { children: [
2429
+ /* @__PURE__ */ e(y.Th, { children: "Pessoa" }),
2430
+ /* @__PURE__ */ e(y.Th, { children: "Por qual via" }),
2431
+ /* @__PURE__ */ e(y.Th, { children: "Situação" })
2432
+ ] }) }),
2433
+ /* @__PURE__ */ e(y.Tbody, { children: c.map((s) => /* @__PURE__ */ r(
2434
+ y.Tr,
2435
+ {
2436
+ style: { cursor: i ? "pointer" : void 0 },
2437
+ onClick: () => i?.(s.userId, s.userName),
2438
+ children: [
2439
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ r(L, { gap: 0, children: [
2440
+ /* @__PURE__ */ e(p, { size: "sm", fw: 550, children: s.userName }),
2441
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: s.email })
2442
+ ] }) }),
2443
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ r(N, { gap: 6, children: [
2444
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: s.via }),
2445
+ s.kind === "ADMINISTRADOR" ? /* @__PURE__ */ e(Z, { size: "xs", color: "yellow", variant: "light", children: "atalho" }) : null
2446
+ ] }) }),
2447
+ /* @__PURE__ */ e(y.Td, { children: ka(s.situation) })
2448
+ ]
2449
+ },
2450
+ s.userId
2451
+ )) })
2452
+ ] }) }),
2453
+ n > 0 ? /* @__PURE__ */ r(p, { size: "xs", c: "dimmed", lh: 1.5, children: [
2454
+ n === 1 ? "Uma conta alcança" : `${n} contas alcançam`,
2455
+ " pelo atalho de administrador — sem concessão nenhuma. Revisar permissões não muda o que elas podem."
2456
+ ] }) : null
2457
+ ] })
2458
+ }
2459
+ ),
2460
+ o?.afterReachList?.(a, c),
2461
+ u ? /* @__PURE__ */ r(p, { size: "xs", c: "dimmed", children: [
2462
+ "Para testar uma pessoa específica contra esta capacidade, use ",
2463
+ /* @__PURE__ */ e("strong", { children: "Simular" }),
2464
+ " na árvore — ela já vem escolhida."
2465
+ ] }) : null
2466
+ ] });
2467
+ }, fa = ({ id: a, kind: t, slots: o, onSelectUser: i }) => {
2468
+ const u = J(
2469
+ Q.SecurityDiagnostics
2470
+ ), [h, c] = z(), [I, x] = z(!0), [f, C] = z();
2471
+ if (ee(() => {
2472
+ let s = !1;
2473
+ return x(!0), C(void 0), (t === "GROUP" ? u.getGroup(a) : u.getProfile(a)).then((D) => {
2474
+ s || c(D);
2475
+ }).catch((D) => {
2476
+ s || C(D instanceof Error ? D.message : "Não foi possível carregar.");
2477
+ }).finally(() => {
2478
+ s || x(!1);
2479
+ }), () => {
2480
+ s = !0;
2481
+ };
2482
+ }, [u, a, t]), I)
2483
+ return /* @__PURE__ */ r(N, { gap: 8, children: [
2484
+ /* @__PURE__ */ e(le, { size: "sm" }),
2485
+ /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: "Carregando…" })
2486
+ ] });
2487
+ if (f)
2488
+ return /* @__PURE__ */ e(be, { color: "red", title: "Erro ao carregar", children: f });
2489
+ if (!h)
2490
+ return null;
2491
+ const S = t === "GROUP" ? "grupo" : "perfil", n = o?.additionalMemberColumns ?? [];
2492
+ return /* @__PURE__ */ r(L, { gap: "lg", children: [
2493
+ /* @__PURE__ */ r(L, { gap: 4, children: [
2494
+ /* @__PURE__ */ r(N, { gap: 8, children: [
2495
+ /* @__PURE__ */ e(p, { fw: 620, size: "xl", children: h.groupName }),
2496
+ /* @__PURE__ */ e(Z, { variant: "light", children: S })
2497
+ ] }),
2498
+ h.description ? /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: h.description }) : null
2499
+ ] }),
2500
+ /* @__PURE__ */ r(
2501
+ ve,
2502
+ {
2503
+ title: "Membros",
2504
+ hint: `${h.members.length} — o total de cada um soma todas as origens`,
2505
+ children: [
2506
+ h.members.length === 0 ? /* @__PURE__ */ r(p, { size: "sm", c: "dimmed", children: [
2507
+ "Ninguém está ",
2508
+ t === "GROUP" ? "neste grupo" : "com este perfil",
2509
+ "."
2510
+ ] }) : /* @__PURE__ */ e(Ue, { children: /* @__PURE__ */ r(y, { striped: !0, highlightOnHover: !0, withTableBorder: !0, stickyHeader: !0, children: [
2511
+ /* @__PURE__ */ e(y.Thead, { children: /* @__PURE__ */ r(y.Tr, { children: [
2512
+ /* @__PURE__ */ e(y.Th, { children: "Pessoa" }),
2513
+ /* @__PURE__ */ e(y.Th, { children: "Perfil" }),
2514
+ /* @__PURE__ */ e(y.Th, { ta: "right", children: "Concedidas" }),
2515
+ /* @__PURE__ */ e(y.Th, { ta: "right", children: "Valem" }),
2516
+ /* @__PURE__ */ e(y.Th, { ta: "right", children: "Não valem" }),
2517
+ /* @__PURE__ */ e(y.Th, { ta: "right", children: "Bloqueadas" }),
2518
+ n.map((s) => /* @__PURE__ */ e(y.Th, { children: s.header }, s.header))
2519
+ ] }) }),
2520
+ /* @__PURE__ */ e(y.Tbody, { children: h.members.map((s) => /* @__PURE__ */ r(
2521
+ y.Tr,
2522
+ {
2523
+ style: { cursor: i ? "pointer" : void 0 },
2524
+ onClick: () => i?.(s.userId, s.name),
2525
+ children: [
2526
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ r(L, { gap: 0, children: [
2527
+ /* @__PURE__ */ r(N, { gap: 6, children: [
2528
+ /* @__PURE__ */ e(p, { size: "sm", fw: 550, children: s.name }),
2529
+ s.administrator ? /* @__PURE__ */ e(Z, { size: "xs", color: "yellow", variant: "light", children: "administrador" }) : null,
2530
+ s.enabled ? null : /* @__PURE__ */ e(Z, { size: "xs", color: "red", variant: "light", children: "desativada" })
2531
+ ] }),
2532
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: s.email })
2533
+ ] }) }),
2534
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: s.profileName ?? "—" }) }),
2535
+ /* @__PURE__ */ e(y.Td, { ta: "right", children: s.total }),
2536
+ /* @__PURE__ */ e(y.Td, { ta: "right", c: "green", children: s.effective }),
2537
+ /* @__PURE__ */ e(y.Td, { ta: "right", c: "yellow.7", children: s.inert }),
2538
+ /* @__PURE__ */ e(y.Td, { ta: "right", c: "red", children: s.denied }),
2539
+ n.map((w) => /* @__PURE__ */ e(y.Td, { children: w.render(s, h) }, w.header))
2540
+ ]
2541
+ },
2542
+ s.userId
2543
+ )) })
2544
+ ] }) }),
2545
+ /* @__PURE__ */ r(p, { size: "xs", c: "dimmed", lh: 1.5, children: [
2546
+ "O total do membro não é o total ",
2547
+ t === "GROUP" ? "do grupo" : "do perfil",
2548
+ ": ele soma o que vem de outras vias. Clique numa pessoa para ver a lista dela."
2549
+ ] })
2550
+ ]
2551
+ }
2552
+ ),
2553
+ /* @__PURE__ */ e(ve, { title: `O que este ${S} concede`, hint: "a parte que é responsabilidade dele", children: h.grants.length === 0 ? /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: "Nada concedido por esta via." }) : /* @__PURE__ */ e(Ue, { children: /* @__PURE__ */ r(y, { striped: !0, withTableBorder: !0, stickyHeader: !0, children: [
2554
+ /* @__PURE__ */ e(y.Thead, { children: /* @__PURE__ */ r(y.Tr, { children: [
2555
+ /* @__PURE__ */ e(y.Th, { children: "Capacidade" }),
2556
+ /* @__PURE__ */ e(y.Th, { children: "Situação" })
2557
+ ] }) }),
2558
+ /* @__PURE__ */ e(y.Tbody, { children: h.grants.map((s, w) => /* @__PURE__ */ r(y.Tr, { children: [
2559
+ /* @__PURE__ */ e(y.Td, { children: /* @__PURE__ */ r(p, { size: "sm", ff: "monospace", children: [
2560
+ s.resource,
2561
+ " · ",
2562
+ s.action
2563
+ ] }) }),
2564
+ /* @__PURE__ */ e(y.Td, { children: ka(s.situation) })
2565
+ ] }, `${s.resource}-${s.action}-${w}`)) })
2566
+ ] }) }) }),
2567
+ o?.afterGroupMembers?.(h)
2568
+ ] });
2569
+ }, ba = 50, Ye = [
2570
+ { branch: "USERS", label: "Pessoas" },
2571
+ { branch: "GROUPS", label: "Grupos" },
2572
+ { branch: "PROFILES", label: "Perfis" },
2573
+ { branch: "RESOURCES", label: "Recursos" }
2574
+ ], _e = { nodes: [], total: 0, carregando: !1, carregouTudo: !1 }, jr = ({ aberta: a }) => /* @__PURE__ */ e(
2575
+ ae,
2576
+ {
2577
+ "aria-hidden": !0,
2578
+ style: {
2579
+ width: 14,
2580
+ height: 14,
2581
+ flex: "none",
2582
+ display: "flex",
2583
+ alignItems: "center",
2584
+ justifyContent: "center"
2585
+ },
2586
+ children: /* @__PURE__ */ e(
2587
+ ae,
2588
+ {
2589
+ style: {
2590
+ width: 0,
2591
+ height: 0,
2592
+ borderLeft: "5px solid currentColor",
2593
+ borderTop: "4px solid transparent",
2594
+ borderBottom: "4px solid transparent",
2595
+ opacity: 0.55,
2596
+ transform: a ? "rotate(90deg)" : "none",
2597
+ transformOrigin: "2px 4px",
2598
+ transition: "transform 130ms ease"
2599
+ }
2600
+ }
2601
+ )
2602
+ }
2603
+ ), Zr = ({ selected: a, onSelect: t }) => {
2604
+ const o = J(
2605
+ Q.SecurityDiagnostics
2606
+ ), [i, u] = z(""), [h] = aa(i, 300), [c, I] = z({}), [x, f] = z({}), C = (d, l) => l ? `${d}:${l}` : d, S = oe(
2607
+ async (d, l, m) => {
2608
+ const v = C(d, l), T = x[v] ?? _e;
2609
+ if (T.carregando || m && T.carregouTudo)
2610
+ return;
2611
+ const A = m ? Math.floor(T.nodes.length / ba) : 0;
2612
+ f((b) => ({ ...b, [v]: { ...b[v] ?? _e, carregando: !0, erro: void 0 } }));
2613
+ try {
2614
+ const b = await o.browse(d, {
2615
+ parentId: l,
2616
+ q: h || void 0,
2617
+ page: A,
2618
+ size: ba
2619
+ });
2620
+ f((j) => {
2621
+ const K = [...m ? j[v]?.nodes ?? [] : [], ...b.content ?? []];
2622
+ return {
2623
+ ...j,
2624
+ [v]: {
2625
+ nodes: K,
2626
+ total: b.totalElements ?? K.length,
2627
+ carregando: !1,
2628
+ carregouTudo: K.length >= (b.totalElements ?? 0)
2629
+ }
2630
+ };
2631
+ });
2632
+ } catch (b) {
2633
+ f((j) => ({
2634
+ ...j,
2635
+ [v]: {
2636
+ ...j[v] ?? _e,
2637
+ carregando: !1,
2638
+ erro: b instanceof Error ? b.message : "Não foi possível carregar."
2639
+ }
2640
+ }));
2641
+ }
2642
+ },
2643
+ [o, h, x]
2644
+ );
2645
+ ee(() => {
2646
+ if (f({}), h) {
2647
+ const d = {};
2648
+ Ye.forEach((l) => {
2649
+ d[l.branch] = !0;
2650
+ }), I((l) => ({ ...l, ...d }));
2651
+ }
2652
+ }, [h]), ee(() => {
2653
+ Ye.forEach((d) => {
2654
+ c[d.branch] && !x[d.branch] && S(d.branch, void 0, !1);
2655
+ });
2656
+ }, [c, x, h]);
2657
+ const n = (d) => I((l) => ({ ...l, [d]: !l[d] })), s = (d) => d === "critical" ? "red" : d === "warning" ? "yellow" : void 0, w = (d, l, m) => {
2658
+ const v = C("ACTIONS_OF_RESOURCE", d.id), T = !!c[v], A = x[v], b = a?.kind === d.kind && a?.id === d.id;
2659
+ return /* @__PURE__ */ r(ae, { children: [
2660
+ /* @__PURE__ */ e(
2661
+ Ee,
2662
+ {
2663
+ onClick: () => {
2664
+ t({ kind: d.kind, id: d.id, label: d.label, parentLabel: m }), d.hasChildren && (n(v), A || S("ACTIONS_OF_RESOURCE", d.id, !1));
2665
+ },
2666
+ "aria-current": b ? "true" : void 0,
2667
+ "aria-expanded": d.hasChildren ? T : void 0,
2668
+ style: {
2669
+ display: "block",
2670
+ width: "100%",
2671
+ padding: "5px 8px",
2672
+ paddingLeft: 8 + l * 14,
2673
+ borderRadius: 5,
2674
+ background: b ? "var(--mantine-color-blue-light)" : void 0
2675
+ },
2676
+ children: /* @__PURE__ */ r(N, { gap: 7, wrap: "nowrap", children: [
2677
+ d.severity ? /* @__PURE__ */ e(Z, { size: "xs", circle: !0, color: s(d.severity) }) : /* @__PURE__ */ e(ae, { w: 8 }),
2678
+ /* @__PURE__ */ e(p, { size: "sm", fw: b ? 600 : 400, truncate: !0, style: { flex: 1 }, children: d.label }),
2679
+ d.badge ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", ff: "monospace", children: d.badge }) : null
2680
+ ] })
2681
+ }
2682
+ ),
2683
+ d.hasChildren && T ? /* @__PURE__ */ r(ae, { children: [
2684
+ A?.nodes.map((j) => w(j, l + 1, d.label)),
2685
+ A?.carregando ? /* @__PURE__ */ r(N, { gap: 6, pl: 8 + (l + 1) * 14, py: 4, children: [
2686
+ /* @__PURE__ */ e(le, { size: "xs" }),
2687
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: "carregando…" })
2688
+ ] }) : null,
2689
+ A && !A.erro && !A.carregouTudo && !A.carregando && A.total > A.nodes.length ? /* @__PURE__ */ e(
2690
+ Ee,
2691
+ {
2692
+ onClick: () => void S("ACTIONS_OF_RESOURCE", d.id, !0),
2693
+ style: { paddingLeft: 8 + (l + 1) * 14, paddingTop: 3, paddingBottom: 3 },
2694
+ children: /* @__PURE__ */ r(p, { size: "xs", c: "blue", children: [
2695
+ "mais ",
2696
+ A.total - A.nodes.length,
2697
+ " →"
2698
+ ] })
2699
+ }
2700
+ ) : null
2701
+ ] }) : null
2702
+ ] }, `${d.kind}-${d.id}`);
2703
+ }, D = ie(() => Ye, []);
2704
+ return /* @__PURE__ */ r(ae, { children: [
2705
+ /* @__PURE__ */ e(
2706
+ me,
2707
+ {
2708
+ size: "xs",
2709
+ placeholder: "Buscar pessoa, grupo, capacidade…",
2710
+ value: i,
2711
+ onChange: (d) => u(d.currentTarget.value),
2712
+ "aria-label": "Buscar na árvore",
2713
+ mb: "xs",
2714
+ rightSection: i && i !== h ? /* @__PURE__ */ e(le, { size: "xs" }) : null
2715
+ }
2716
+ ),
2717
+ D.map((d) => {
2718
+ const l = !!c[d.branch], m = x[d.branch];
2719
+ return /* @__PURE__ */ r(ae, { mb: 2, children: [
2720
+ /* @__PURE__ */ e(
2721
+ Ee,
2722
+ {
2723
+ onClick: () => {
2724
+ n(d.branch), m || S(d.branch, void 0, !1);
2725
+ },
2726
+ "aria-expanded": l,
2727
+ style: { display: "block", width: "100%", padding: "5px 8px", borderRadius: 5 },
2728
+ children: /* @__PURE__ */ r(N, { gap: 7, wrap: "nowrap", children: [
2729
+ /* @__PURE__ */ e(jr, { aberta: l }),
2730
+ /* @__PURE__ */ e(p, { size: "sm", fw: 600, style: { flex: 1 }, children: d.label }),
2731
+ m ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", ff: "monospace", children: m.total }) : null
2732
+ ] })
2733
+ }
2734
+ ),
2735
+ l ? /* @__PURE__ */ r(ae, { children: [
2736
+ m?.erro ? /* @__PURE__ */ e(p, { size: "xs", c: "red", pl: 22, py: 4, children: m.erro }) : null,
2737
+ m?.nodes.map((v) => w(v, 1)),
2738
+ m?.carregando ? /* @__PURE__ */ r(N, { gap: 6, pl: 22, py: 4, children: [
2739
+ /* @__PURE__ */ e(le, { size: "xs" }),
2740
+ /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", children: "carregando…" })
2741
+ ] }) : null,
2742
+ m && !m.erro && !m.carregouTudo && !m.carregando && m.total > m.nodes.length ? /* @__PURE__ */ e(
2743
+ Ee,
2744
+ {
2745
+ onClick: () => void S(d.branch, void 0, !0),
2746
+ style: { paddingLeft: 22, paddingTop: 3, paddingBottom: 3 },
2747
+ children: /* @__PURE__ */ r(p, { size: "xs", c: "blue", children: [
2748
+ "mais ",
2749
+ m.total - m.nodes.length,
2750
+ " →"
2751
+ ] })
2752
+ }
2753
+ ) : null,
2754
+ m && !m.erro && m.nodes.length === 0 && !m.carregando ? /* @__PURE__ */ e(p, { size: "xs", c: "dimmed", pl: 22, py: 4, children: h ? "Nada encontrado." : "Vazio." }) : null
2755
+ ] }) : null
2756
+ ] }, d.branch);
2757
+ })
2758
+ ] });
2759
+ }, va = { kind: "OVERVIEW", id: "overview", label: "Panorama" }, ya = { kind: "SIMULATE", id: "simulate", label: "Simular acesso" }, st = ({
2760
+ height: a = "100%",
2761
+ width: t = "100%",
2762
+ slots: o,
2763
+ onError: i
2764
+ }) => {
2765
+ const [u, h] = z(va), [c, I] = z({}), x = oe((n) => {
2766
+ h(n), n.kind === "USER" && I((s) => ({ ...s, userId: n.id })), n.kind === "ACTION" && I((s) => ({ ...s, action: n.label, resource: n.parentLabel }));
2767
+ }, []), f = oe(
2768
+ (n, s) => x({ kind: "USER", id: n, label: s }),
2769
+ [x]
2770
+ ), C = (n) => /* @__PURE__ */ e(
2771
+ Ee,
2772
+ {
2773
+ onClick: () => h(n),
2774
+ "aria-current": u.kind === n.kind ? "true" : void 0,
2775
+ style: {
2776
+ display: "block",
2777
+ width: "100%",
2778
+ padding: "6px 8px",
2779
+ borderRadius: 5,
2780
+ background: u.kind === n.kind ? "var(--mantine-color-blue-light)" : void 0
2781
+ },
2782
+ children: /* @__PURE__ */ e(p, { size: "sm", fw: u.kind === n.kind ? 600 : 500, children: n.label })
2783
+ },
2784
+ n.id
2785
+ ), S = () => {
2786
+ switch (u.kind) {
2787
+ case "OVERVIEW":
2788
+ return /* @__PURE__ */ e(ma, { slots: o, onError: i });
2789
+ case "SIMULATE":
2790
+ return /* @__PURE__ */ e(qr, { slots: o, onError: i, initial: c });
2791
+ case "USER":
2792
+ return /* @__PURE__ */ e(Br, { slots: o, onError: i, userId: u.id });
2793
+ case "GROUP":
2794
+ return /* @__PURE__ */ e(fa, { id: u.id, kind: "GROUP", slots: o, onSelectUser: f });
2795
+ case "PROFILE":
2796
+ return /* @__PURE__ */ e(fa, { id: u.id, kind: "PROFILE", slots: o, onSelectUser: f });
2797
+ case "ACTION":
2798
+ return /* @__PURE__ */ e(
2799
+ Hr,
2800
+ {
2801
+ id: u.id,
2802
+ label: u.parentLabel ? `${u.parentLabel} · ${u.label}` : u.label,
2803
+ slots: o,
2804
+ onSelectUser: f,
2805
+ onSimulate: () => h(ya)
2806
+ }
2807
+ );
2808
+ case "RESOURCE":
2809
+ return /* @__PURE__ */ r(L, { gap: "xs", children: [
2810
+ /* @__PURE__ */ e(p, { fw: 620, size: "xl", ff: "monospace", children: u.label }),
2811
+ /* @__PURE__ */ e(p, { size: "sm", c: "dimmed", children: "Abra o recurso na árvore para ver as ações. Cada ação responde quem alcança." })
2812
+ ] });
2813
+ default:
2814
+ return /* @__PURE__ */ e(ma, { slots: o, onError: i });
2815
+ }
2816
+ };
2817
+ return (
2818
+ // Grid CSS explícito em vez do <Grid> do Mantine: a coluna da árvore tem largura própria e
2819
+ // não uma fração de doze, e o `minmax(0, 1fr)` é o que impede uma tabela larga no painel de
2820
+ // empurrar a árvore para fora da tela.
2821
+ /* @__PURE__ */ r(
2822
+ ae,
2823
+ {
2824
+ style: {
2825
+ width: t,
2826
+ // `height` só resolve quando o contêiner de cima tem altura definida — e o padrão de
2827
+ // quem embute a view é não ter. O minHeight em vh garante que a árvore ocupe a tela
2828
+ // mesmo assim; sem ele o painel encolhe até o conteúdo e sobra metade da tela vazia.
2829
+ height: a,
2830
+ minHeight: "calc(100vh - 190px)",
2831
+ display: "grid",
2832
+ gridTemplateColumns: "minmax(240px, 300px) minmax(0, 1fr)",
2833
+ gap: "var(--mantine-spacing-md)",
2834
+ alignItems: "stretch"
2835
+ },
2836
+ className: "archbase-security-explorer",
2837
+ children: [
2838
+ /* @__PURE__ */ e(
2839
+ _,
2840
+ {
2841
+ withBorder: !0,
2842
+ radius: "md",
2843
+ p: "xs",
2844
+ style: { display: "flex", flexDirection: "column", minHeight: 0, overflow: "hidden" },
2845
+ children: /* @__PURE__ */ r(L, { gap: 2, style: { flex: 1, minHeight: 0 }, children: [
2846
+ o?.renderUserSearch ? /* @__PURE__ */ e(ae, { mb: 4, children: o.renderUserSearch(
2847
+ (n) => x({ kind: "USER", id: n, label: n })
2848
+ ) }) : null,
2849
+ C(va),
2850
+ C(ya),
2851
+ /* @__PURE__ */ e(ae, { my: 6, style: { borderTop: "1px solid var(--mantine-color-default-border)" } }),
2852
+ /* @__PURE__ */ e(fe, { type: "hover", style: { flex: 1, minHeight: 0 }, children: /* @__PURE__ */ e(Zr, { selected: u, onSelect: x }) })
2853
+ ] })
2854
+ }
2855
+ ),
2856
+ /* @__PURE__ */ e(
2857
+ _,
2858
+ {
2859
+ withBorder: !0,
2860
+ radius: "md",
2861
+ p: "md",
2862
+ style: { minWidth: 0, minHeight: 0, overflowY: "auto" },
2863
+ children: S()
2864
+ }
2865
+ )
2866
+ ]
2867
+ }
2868
+ )
2869
+ );
2870
+ };
2309
2871
  export {
2310
- mr as ApiTokenModal,
2311
- Jr as ArchbaseApiTokenView,
2312
- lr as ArchbaseDualListSelector,
2313
- Kr as ArchbaseSecurityDiagnosticsView,
2314
- Zr as ArchbaseSecurityView,
2315
- Tr as AttributeList,
2316
- Dr as EffectiveAccessPanel,
2317
- xr as FlagStrip,
2318
- hr as GroupModal,
2319
- Sr as MetricCard,
2320
- Ar as MetricCards,
2321
- Pr as OverviewPanel,
2322
- qe as PermissionsSelectorModal,
2323
- sr as ProfileModal,
2324
- cr as RenderProfileUserItem,
2325
- Fe as Section,
2326
- $r as SimulationPanel,
2327
- ur as UserModal,
2328
- Ve as severityColor
2872
+ Hr as ActionNodePanel,
2873
+ Tr as ApiTokenModal,
2874
+ nt as ArchbaseApiTokenView,
2875
+ br as ArchbaseDualListSelector,
2876
+ st as ArchbaseSecurityDiagnosticsView,
2877
+ ot as ArchbaseSecurityView,
2878
+ Nr as AttributeList,
2879
+ Br as EffectiveAccessPanel,
2880
+ Fr as FlagStrip,
2881
+ Cr as GroupModal,
2882
+ fa as GroupNodePanel,
2883
+ Pr as MetricCard,
2884
+ Dr as MetricCards,
2885
+ $r as OverviewItemsDrawer,
2886
+ ma as OverviewPanel,
2887
+ Ke as PermissionsSelectorModal,
2888
+ fr as ProfileModal,
2889
+ vr as RenderProfileUserItem,
2890
+ ve as Section,
2891
+ Zr as SecurityTree,
2892
+ qr as SimulationPanel,
2893
+ Ue as TabelaRolavel,
2894
+ wr as UserModal,
2895
+ Ge as severityColor,
2896
+ ka as situacaoBadge
2329
2897
  };