@archbase/security 4.1.1 → 4.2.0

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,18 +1,18 @@
1
1
  import "reflect-metadata";
2
- import * as C from "inversify";
3
- import { decorate as Ot, injectable as Lt } from "inversify";
4
- import { compressString as $t, decompressString as jt, IOCContainer as zt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as ne, IsNotEmpty as Q, IsOptional as ae, IsBoolean as re, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Vt, getI18nextInstance as x, useArchbaseTheme as Ht, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
2
+ import * as I from "inversify";
3
+ import { decorate as $t, injectable as Ot } from "inversify";
4
+ import { compressString as Lt, decompressString as zt, IOCContainer as jt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as oe, IsNotEmpty as Q, IsOptional as ae, IsBoolean as re, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Vt, getI18nextInstance as x, useArchbaseTheme as Ht, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
5
5
  import q from "crypto-js";
6
6
  import { jwtDecode as qt } from "jwt-decode";
7
- import { jsx as n, jsxs as I, Fragment as ie } from "react/jsx-runtime";
8
- import it, { useState as p, useEffect as X, createContext as Ve, useMemo as at, useRef as ct, useCallback as Ce, useContext as He } from "react";
7
+ import { jsx as o, jsxs as C, Fragment as ie } from "react/jsx-runtime";
8
+ import it, { useState as p, useEffect as X, createContext as Ve, useMemo as at, useRef as ct, useCallback as Ie, useContext as He } from "react";
9
9
  import { BehaviorSubject as Ze } from "rxjs";
10
10
  import { ArchbaseRemoteApiService as ge, useArchbaseStore as lt } from "@archbase/data";
11
11
  import { v4 as Z } from "uuid";
12
- import { Card as We, Text as z, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as je, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ie } from "@mantine/core";
12
+ import { Card as We, Text as j, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as ze, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ce } from "@mantine/core";
13
13
  import { useFocusTrap as ut } from "@mantine/hooks";
14
14
  import { IconCopy as rr } from "@tabler/icons-react";
15
- import { ArchbaseQRCode as sr, ArchbasePasswordStrengthMeter as or, ArchbaseDialog as ot } from "@archbase/components";
15
+ import { ArchbaseQRCode as sr, ArchbasePasswordStrengthMeter as nr, ArchbaseDialog as nt } from "@archbase/components";
16
16
  import { useContainer as De } from "inversify-react";
17
17
  class ht {
18
18
  id;
@@ -38,14 +38,14 @@ class pt {
38
38
  return new pt({});
39
39
  }
40
40
  }
41
- const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Be = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Oe = "602b05c5-ec46-451e-aba6-187e463bc245", Le = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
- class nr {
41
+ const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Be = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", $e = "602b05c5-ec46-451e-aba6-187e463bc245", Oe = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
+ class or {
43
43
  getUsernameAndPassword() {
44
44
  try {
45
45
  const e = localStorage.getItem(Be);
46
46
  if (e) {
47
- const t = q.AES.decrypt(e, le).toString(q.enc.Utf8), o = atob(t).split(":");
48
- return { username: o[0], password: o[1], remember: !0 };
47
+ const t = q.AES.decrypt(e, le).toString(q.enc.Utf8), n = atob(t).split(":");
48
+ return { username: n[0], password: n[1], remember: !0 };
49
49
  } else
50
50
  return null;
51
51
  } catch {
@@ -53,12 +53,12 @@ class nr {
53
53
  }
54
54
  }
55
55
  saveUsernameAndPassword(e, t) {
56
- const s = btoa(`${e}:${t}`), o = q.AES.encrypt(s, le).toString();
57
- localStorage.setItem(Be, o);
56
+ const s = btoa(`${e}:${t}`), n = q.AES.encrypt(s, le).toString();
57
+ localStorage.setItem(Be, n);
58
58
  }
59
59
  getUsername() {
60
60
  try {
61
- const e = localStorage.getItem(Oe);
61
+ const e = localStorage.getItem($e);
62
62
  if (e) {
63
63
  const t = q.AES.decrypt(e, le).toString(q.enc.Utf8);
64
64
  return atob(t);
@@ -70,17 +70,17 @@ class nr {
70
70
  }
71
71
  saveUsername(e) {
72
72
  const t = btoa(e), s = q.AES.encrypt(t, le).toString();
73
- localStorage.setItem(Oe, s);
73
+ localStorage.setItem($e, s);
74
74
  }
75
75
  isTokenExpired(e, t = 300) {
76
76
  let s = e;
77
77
  if (!s && !this.getToken())
78
78
  return !0;
79
79
  try {
80
- const o = qt(s.access_token);
81
- if (!o)
80
+ const n = qt(s.access_token);
81
+ if (!n)
82
82
  return !0;
83
- const a = Math.floor(Date.now() / 1e3), c = o.exp;
83
+ const a = Math.floor(Date.now() / 1e3), c = n.exp;
84
84
  return a > c - t;
85
85
  } catch {
86
86
  return !0;
@@ -88,13 +88,13 @@ class nr {
88
88
  }
89
89
  saveToken(e) {
90
90
  if (e) {
91
- const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), o = $t(s);
92
- localStorage.setItem(Ne, o);
91
+ const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), n = Lt(s);
92
+ localStorage.setItem(Ne, n);
93
93
  } else
94
94
  this.clearToken();
95
95
  }
96
96
  clearUsernameAndPassword() {
97
- localStorage.removeItem(Be), localStorage.removeItem(Oe);
97
+ localStorage.removeItem(Be), localStorage.removeItem($e);
98
98
  }
99
99
  clearToken() {
100
100
  localStorage.removeItem(Ne);
@@ -104,7 +104,7 @@ class nr {
104
104
  const e = localStorage.getItem(Ne);
105
105
  if (!e)
106
106
  return null;
107
- const t = jt(e), s = q.AES.decrypt(t, le).toString(q.enc.Utf8);
107
+ const t = zt(e), s = q.AES.decrypt(t, le).toString(q.enc.Utf8);
108
108
  return JSON.parse(s);
109
109
  } catch {
110
110
  return null;
@@ -113,24 +113,24 @@ class nr {
113
113
  saveContext(e) {
114
114
  try {
115
115
  const t = q.AES.encrypt(e, le).toString();
116
- localStorage.setItem(Le, t);
116
+ localStorage.setItem(Oe, t);
117
117
  } catch (t) {
118
118
  console.warn("Erro ao salvar contexto:", t);
119
119
  }
120
120
  }
121
121
  getContext() {
122
122
  try {
123
- const e = localStorage.getItem(Le);
123
+ const e = localStorage.getItem(Oe);
124
124
  return e ? q.AES.decrypt(e, le).toString(q.enc.Utf8) : null;
125
125
  } catch {
126
126
  return null;
127
127
  }
128
128
  }
129
129
  clearContext() {
130
- localStorage.removeItem(Le);
130
+ localStorage.removeItem(Oe);
131
131
  }
132
132
  }
133
- Ot(Lt(), nr);
133
+ $t(Ot(), or);
134
134
  function ft(r) {
135
135
  const t = new Uint8Array(1);
136
136
  return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ft(r) : t[0] % r;
@@ -147,8 +147,8 @@ async function ar(r) {
147
147
  throw new Error(
148
148
  "The context/environment is not secure, and does not support the 'crypto.subtle' module. See: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle for details"
149
149
  );
150
- const t = new TextEncoder().encode(r), s = await window.crypto.subtle.digest("SHA-256", t), o = String.fromCharCode(...new Uint8Array(s));
151
- return btoa(o).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
150
+ const t = new TextEncoder().encode(r), s = await window.crypto.subtle.digest("SHA-256", t), n = String.fromCharCode(...new Uint8Array(s));
151
+ return btoa(n).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
152
152
  }
153
153
  class mt extends Error {
154
154
  status;
@@ -176,11 +176,11 @@ async function lr(r, e) {
176
176
  return t;
177
177
  });
178
178
  }
179
- const gt = "PKCE_code_verifier", ze = "ROCP_auth_state";
179
+ const gt = "PKCE_code_verifier", je = "ROCP_auth_state";
180
180
  async function dr(r, e) {
181
181
  const t = ir(96);
182
182
  return sessionStorage.setItem(gt, t), ar(t).then((s) => {
183
- const o = new URLSearchParams({
183
+ const n = new URLSearchParams({
184
184
  response_type: "code",
185
185
  client_id: r.clientId,
186
186
  redirect_uri: r.redirectUri,
@@ -188,9 +188,9 @@ async function dr(r, e) {
188
188
  code_challenge_method: "S256",
189
189
  ...r.extraAuthParameters
190
190
  });
191
- r.scope !== void 0 && o.append("scope", r.scope), sessionStorage.removeItem(ze);
191
+ r.scope !== void 0 && n.append("scope", r.scope), sessionStorage.removeItem(je);
192
192
  const a = e ?? r.state;
193
- a && (sessionStorage.setItem(ze, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
193
+ a && (sessionStorage.setItem(je, a), n.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${n.toString()}`);
194
194
  });
195
195
  }
196
196
  function ur(r) {
@@ -211,7 +211,7 @@ A autenticação ocorreu?`);
211
211
  if (!s)
212
212
  throw Error(`Não é possível obter tokens sem o CodeVerifier.
213
213
  A autenticação ocorreu?`);
214
- const o = {
214
+ const n = {
215
215
  grant_type: "authorization_code",
216
216
  code: t,
217
217
  scope: r.scope,
@@ -221,7 +221,7 @@ A autenticação ocorreu?`);
221
221
  ...r.extraTokenParameters,
222
222
  ...r.extraAuthParams
223
223
  };
224
- return yt(r.tokenEndpoint, o);
224
+ return yt(r.tokenEndpoint, n);
225
225
  }, pr = (r) => {
226
226
  const { config: e, refreshToken: t } = r, s = {
227
227
  grant_type: "refresh_token",
@@ -233,7 +233,7 @@ A autenticação ocorreu?`);
233
233
  };
234
234
  return yt(e.tokenEndpoint, s);
235
235
  };
236
- function fr(r, e, t, s, o, a) {
236
+ function fr(r, e, t, s, n, a) {
237
237
  const c = new URLSearchParams({
238
238
  token: t || e,
239
239
  token_type_hint: t ? "refresh_token" : "access_token",
@@ -242,17 +242,17 @@ function fr(r, e, t, s, o, a) {
242
242
  ui_locales: window.navigator.languages.reduce((i, d) => i + " " + d),
243
243
  ...r.extraLogoutParameters
244
244
  });
245
- s && c.append("id_token_hint", s), o && c.append("state", o), a && c.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${c.toString()}`);
245
+ s && c.append("id_token_hint", s), n && c.append("state", n), a && c.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${c.toString()}`);
246
246
  }
247
247
  function mr(r) {
248
- const e = r.get("state"), t = sessionStorage.getItem(ze);
248
+ const e = r.get("state"), t = sessionStorage.getItem(je);
249
249
  if (e !== t)
250
250
  throw new Error(
251
251
  '"state" valor recebido do servidor de autenticação não corresponde à solicitação do cliente. Possível falsificação de solicitação entre sites'
252
252
  );
253
253
  }
254
254
  function de(r, e, t) {
255
- const s = t === "session" ? sessionStorage : localStorage, [o, a] = p(() => {
255
+ const s = t === "session" ? sessionStorage : localStorage, [n, a] = p(() => {
256
256
  const i = s.getItem(r);
257
257
  try {
258
258
  return i ? JSON.parse(i) : e;
@@ -269,7 +269,7 @@ Error: ${d.message}`
269
269
  return;
270
270
  }
271
271
  try {
272
- const d = i instanceof Function ? i(o) : i;
272
+ const d = i instanceof Function ? i(n) : i;
273
273
  a(d), s.setItem(r, JSON.stringify(d));
274
274
  } catch {
275
275
  console.log(`Falha ao armazenar valor '${i}' para chave '${r}'`);
@@ -280,7 +280,7 @@ Error: ${d.message}`
280
280
  d.storageArea === s && d.key === r && a(JSON.parse(d.newValue ?? ""));
281
281
  };
282
282
  return window.addEventListener("storage", i, !1), () => window.removeEventListener("storage", i, !1);
283
- }), [o, c];
283
+ }), [n, c];
284
284
  }
285
285
  const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
286
286
  __proto__: null,
@@ -294,7 +294,7 @@ function gr(r) {
294
294
  autoLogin: e = !0,
295
295
  clearURL: t = !0,
296
296
  decodeToken: s = !0,
297
- scope: o = void 0,
297
+ scope: n = void 0,
298
298
  preLogin: a = () => null,
299
299
  postLogin: c = () => null,
300
300
  onRefreshTokenExpire: i = void 0,
@@ -304,7 +304,7 @@ function gr(r) {
304
304
  autoLogin: e,
305
305
  clearURL: t,
306
306
  decodeToken: s,
307
- scope: o,
307
+ scope: n,
308
308
  preLogin: a,
309
309
  postLogin: c,
310
310
  onRefreshTokenExpire: i,
@@ -338,7 +338,7 @@ function yr(r) {
338
338
  );
339
339
  }
340
340
  const fe = 600, pe = (r) => Math.round(Date.now() / 1e3 + r);
341
- function nt(r) {
341
+ function ot(r) {
342
342
  return Math.round(Date.now()) / 1e3 + 30 >= r;
343
343
  }
344
344
  const vr = [
@@ -356,8 +356,8 @@ function wr(r, e) {
356
356
  const Te = (r) => {
357
357
  try {
358
358
  const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), s = decodeURIComponent(
359
- atob(t).split("").map(function(o) {
360
- return "%" + ("00" + o.charCodeAt(0).toString(16)).slice(-2);
359
+ atob(t).split("").map(function(n) {
360
+ return "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2);
361
361
  }).join("")
362
362
  );
363
363
  return JSON.parse(s);
@@ -375,7 +375,7 @@ const Te = (r) => {
375
375
  error: null,
376
376
  loginInProgress: !1
377
377
  }), Gr = ({ authConfig: r, children: e }) => {
378
- const t = at(() => gr(r), [r]), [s, o] = de(
378
+ const t = at(() => gr(r), [r]), [s, n] = de(
379
379
  "ROCP_refreshToken",
380
380
  void 0,
381
381
  t.storage
@@ -399,12 +399,12 @@ const Te = (r) => {
399
399
  "ROCP_refreshInProgress",
400
400
  !1,
401
401
  t.storage
402
- ), [M, O] = p(), [V, _] = p(), [b, m] = p(null);
402
+ ), [M, $] = p(), [V, _] = p(), [b, m] = p(null);
403
403
  let R;
404
404
  function H() {
405
- o(void 0), d(""), S(pe(fe)), c(pe(fe)), U(void 0), O(void 0), _(void 0), w(!1);
405
+ n(void 0), d(""), S(pe(fe)), c(pe(fe)), U(void 0), $(void 0), _(void 0), w(!1);
406
406
  }
407
- function L(g, v) {
407
+ function O(g, v) {
408
408
  H(), m(null), t?.logoutEndpoint && fr(t, i, s, h, g, v);
409
409
  }
410
410
  function N(g) {
@@ -417,7 +417,7 @@ const Te = (r) => {
417
417
  });
418
418
  }
419
419
  function T(g) {
420
- d(g.access_token), o(g.refresh_token);
420
+ d(g.access_token), n(g.refresh_token);
421
421
  const v = t.tokenExpiresIn ?? g.expires_in ?? fe;
422
422
  S(pe(v));
423
423
  const K = t.refreshTokenExpiresIn ?? wr(v, g);
@@ -428,7 +428,7 @@ const Te = (r) => {
428
428
  console.warn(`Falha ao decodificar idToken: ${W.message}`);
429
429
  }
430
430
  try {
431
- t.decodeToken && O(Te(g.access_token));
431
+ t.decodeToken && $(Te(g.access_token));
432
432
  } catch (W) {
433
433
  console.warn(`Falha ao decodificar o token de acesso: ${W.message}`);
434
434
  }
@@ -437,8 +437,8 @@ const Te = (r) => {
437
437
  return g || !t.onRefreshTokenExpire ? N() : t.onRefreshTokenExpire({ login: N });
438
438
  }
439
439
  function te(g = !1) {
440
- if (i && nt(y) && !(E && !g)) {
441
- if (nt(a))
440
+ if (i && ot(y) && !(E && !g)) {
441
+ if (ot(a))
442
442
  return ee(g);
443
443
  if (s) {
444
444
  P(!0), pr({ config: t, refreshToken: s }).then((v) => T(v)).catch((v) => {
@@ -465,7 +465,7 @@ const Te = (r) => {
465
465
  const g = new URLSearchParams(window.location.search);
466
466
  if (!g.get("code")) {
467
467
  const v = g.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
- console.error(v), m(v), L();
468
+ console.error(v), m(v), O();
469
469
  return;
470
470
  }
471
471
  if (!se.current) {
@@ -493,15 +493,15 @@ const Te = (r) => {
493
493
  console.warn(`Falha ao decodificar idToken: ${g.message}`);
494
494
  }
495
495
  try {
496
- t.decodeToken && O(Te(i));
496
+ t.decodeToken && $(Te(i));
497
497
  } catch (g) {
498
498
  console.warn(`Falha ao decodificar o token de acesso: ${g.message}`);
499
499
  }
500
500
  te(!0);
501
- }, []), /* @__PURE__ */ n(
501
+ }, []), /* @__PURE__ */ o(
502
502
  br.Provider,
503
503
  {
504
- value: { token: i, tokenData: M, idToken: h, idTokenData: V, login: N, logOut: L, error: b, loginInProgress: A },
504
+ value: { token: i, tokenData: M, idToken: h, idTokenData: V, login: N, logOut: O, error: b, loginInProgress: A },
505
505
  children: e
506
506
  }
507
507
  );
@@ -515,7 +515,7 @@ class vt {
515
515
  error;
516
516
  isAdmin;
517
517
  constructor(e, t, s) {
518
- this.resourceService = zt.getContainer().get(Y.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
518
+ this.resourceService = jt.getContainer().get(Y.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
519
519
  }
520
520
  registerAction(e, t) {
521
521
  !this.alreadyApplied && this.actions.findIndex((s) => s.actionName === e) < 0 && this.actions.push({ actionName: e, actionDescription: t });
@@ -524,7 +524,7 @@ class vt {
524
524
  this.alreadyApplied || (this.alreadyApplied = !0, this.resourceService.registerResource({ resource: this.resource, actions: this.actions }).then((t) => {
525
525
  this.permissions = t.permissions, this.error = "", e && e();
526
526
  }).catch((t) => {
527
- this.alreadyApplied = !1, this.error = ne(t);
527
+ this.alreadyApplied = !1, this.error = oe(t);
528
528
  }));
529
529
  }
530
530
  hasPermission(e) {
@@ -633,9 +633,9 @@ function Jr() {
633
633
  return J.getInstance();
634
634
  }
635
635
  var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, k = (r, e, t, s) => {
636
- for (var o = void 0, a = r.length - 1, c; a >= 0; a--)
637
- (c = r[a]) && (o = c(e, t, o) || o);
638
- return o && Ar(e, t, o), o;
636
+ for (var n = void 0, a = r.length - 1, c; a >= 0; a--)
637
+ (c = r[a]) && (n = c(e, t, n) || n);
638
+ return n && Ar(e, t, n), n;
639
639
  }, Er = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(Er || {});
640
640
  const wt = class bt {
641
641
  id;
@@ -848,7 +848,7 @@ k([
848
848
  re()
849
849
  ], Re.prototype, "active");
850
850
  let St = Re;
851
- const F = class Ct extends ye {
851
+ const F = class It extends ye {
852
852
  userName;
853
853
  password;
854
854
  changePasswordOnNextLogin;
@@ -871,7 +871,7 @@ const F = class Ct extends ye {
871
871
  constructor(e) {
872
872
  super(e), this.type = me.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.passwordChangedAt = e.passwordChangedAt || void 0, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new ke(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
873
873
  }
874
- static newInstance = () => new Ct({
874
+ static newInstance = () => new It({
875
875
  id: Z(),
876
876
  userName: "",
877
877
  password: "",
@@ -1024,7 +1024,7 @@ class qe {
1024
1024
  isNewAccessToken: !0
1025
1025
  });
1026
1026
  }
1027
- class It extends ge {
1027
+ class Ct extends ge {
1028
1028
  constructor(e) {
1029
1029
  super(e);
1030
1030
  }
@@ -1051,8 +1051,8 @@ class It extends ge {
1051
1051
  return this.transform(t);
1052
1052
  }
1053
1053
  }
1054
- C.decorate(C.inject(Y.ApiClient), It, 0);
1055
- C.decorate(C.injectable(), It);
1054
+ I.decorate(I.inject(Y.ApiClient), Ct, 0);
1055
+ I.decorate(I.injectable(), Ct);
1056
1056
  class Pt extends ge {
1057
1057
  constructor(e) {
1058
1058
  super(e);
@@ -1073,8 +1073,8 @@ class Pt extends ge {
1073
1073
  return e.isNewGroup;
1074
1074
  }
1075
1075
  }
1076
- C.decorate(C.inject(Y.ApiClient), Pt, 0);
1077
- C.decorate(C.injectable(), Pt);
1076
+ I.decorate(I.inject(Y.ApiClient), Pt, 0);
1077
+ I.decorate(I.injectable(), Pt);
1078
1078
  class Tt extends ge {
1079
1079
  constructor(e) {
1080
1080
  super(e);
@@ -1095,8 +1095,8 @@ class Tt extends ge {
1095
1095
  return e.isNewProfile;
1096
1096
  }
1097
1097
  }
1098
- C.decorate(C.inject(Y.ApiClient), Tt, 0);
1099
- C.decorate(C.injectable(), Tt);
1098
+ I.decorate(I.inject(Y.ApiClient), Tt, 0);
1099
+ I.decorate(I.injectable(), Tt);
1100
1100
  class Ut extends ge {
1101
1101
  constructor(e) {
1102
1102
  super(e);
@@ -1116,9 +1116,9 @@ class Ut extends ge {
1116
1116
  isNewRecord(e) {
1117
1117
  return e.isNovoToken;
1118
1118
  }
1119
- async create(e, t, s, o) {
1119
+ async create(e, t, s, n) {
1120
1120
  const a = await this.client.post(
1121
- `${this.getEndpoint()}/create?email=${e}&expirationDate=${t}&name=${s}&description=${o}`,
1121
+ `${this.getEndpoint()}/create?email=${e}&expirationDate=${t}&name=${s}&description=${n}`,
1122
1122
  void 0,
1123
1123
  this.configureHeaders()
1124
1124
  );
@@ -1132,8 +1132,8 @@ class Ut extends ge {
1132
1132
  );
1133
1133
  }
1134
1134
  }
1135
- C.decorate(C.inject(Y.ApiClient), Ut, 0);
1136
- C.decorate(C.injectable(), Ut);
1135
+ I.decorate(I.inject(Y.ApiClient), Ut, 0);
1136
+ I.decorate(I.injectable(), Ut);
1137
1137
  class Dt extends ge {
1138
1138
  constructor(e) {
1139
1139
  super(e);
@@ -1161,8 +1161,8 @@ class Dt extends ge {
1161
1161
  );
1162
1162
  }
1163
1163
  }
1164
- C.decorate(C.inject(Y.ApiClient), Dt, 0);
1165
- C.decorate(C.injectable(), Dt);
1164
+ I.decorate(I.inject(Y.ApiClient), Dt, 0);
1165
+ I.decorate(I.injectable(), Dt);
1166
1166
  class _t extends ge {
1167
1167
  constructor(e) {
1168
1168
  super(e);
@@ -1225,8 +1225,8 @@ class _t extends ge {
1225
1225
  );
1226
1226
  }
1227
1227
  }
1228
- C.decorate(C.inject(Y.ApiClient), _t, 0);
1229
- C.decorate(C.injectable(), _t);
1228
+ I.decorate(I.inject(Y.ApiClient), _t, 0);
1229
+ I.decorate(I.injectable(), _t);
1230
1230
  class Rt {
1231
1231
  client;
1232
1232
  constructor(e) {
@@ -1242,6 +1242,58 @@ class Rt {
1242
1242
  async getOverview() {
1243
1243
  return this.client.get(`${this.getEndpoint()}/overview`, this.configureHeaders());
1244
1244
  }
1245
+ /**
1246
+ * Os itens por trás de um número do panorama.
1247
+ *
1248
+ * Um card diz "29 ações inativas"; sozinho, isso não permite agir. Aqui vêm quais são, com o
1249
+ * motivo de cada uma estar na lista.
1250
+ */
1251
+ async getOverviewItems(e, t = 0, s = 25) {
1252
+ return this.client.get(
1253
+ `${this.getEndpoint()}/overview/${e}?page=${t}&size=${s}`,
1254
+ this.configureHeaders()
1255
+ );
1256
+ }
1257
+ /**
1258
+ * Um ramo da árvore, buscado ao abrir.
1259
+ *
1260
+ * Não existe "carregar a árvore": um tenant real tem centenas de ações e recursos, e a carga
1261
+ * única trava o navegador. O filtro também vai para o servidor — buscar no cliente exigiria ter
1262
+ * carregado tudo antes.
1263
+ */
1264
+ async browse(e, t = {}) {
1265
+ const s = new URLSearchParams();
1266
+ return t.parentId && s.set("parentId", t.parentId), t.q && s.set("q", t.q), s.set("page", String(t.page ?? 0)), s.set("size", String(t.size ?? 50)), this.client.get(
1267
+ `${this.getEndpoint()}/tree/${e}?${s.toString()}`,
1268
+ this.configureHeaders()
1269
+ );
1270
+ }
1271
+ /** Quem está no grupo e o que cada pessoa acumula de todas as origens. */
1272
+ async getGroup(e) {
1273
+ return this.client.get(
1274
+ `${this.getEndpoint()}/groups/${encodeURIComponent(e)}`,
1275
+ this.configureHeaders()
1276
+ );
1277
+ }
1278
+ /** Idem para perfil — a via mais ampla, que vale para todo mundo que o tem. */
1279
+ async getProfile(e) {
1280
+ return this.client.get(
1281
+ `${this.getEndpoint()}/profiles/${encodeURIComponent(e)}`,
1282
+ this.configureHeaders()
1283
+ );
1284
+ }
1285
+ /**
1286
+ * Quem alcança uma capacidade — a consulta reversa.
1287
+ *
1288
+ * Inclui administrador, com a via marcada: ele alcança sem concessão nenhuma, e omiti-lo daria
1289
+ * a resposta errada para a pergunta "quem pode".
1290
+ */
1291
+ async getReach(e) {
1292
+ return this.client.get(
1293
+ `${this.getEndpoint()}/actions/${encodeURIComponent(e)}/reach`,
1294
+ this.configureHeaders()
1295
+ );
1296
+ }
1245
1297
  /** O que a pessoa pode, com a origem de cada concessão. */
1246
1298
  async getEffectiveAccessByUserId(e) {
1247
1299
  return this.client.get(
@@ -1270,14 +1322,14 @@ class Rt {
1270
1322
  );
1271
1323
  }
1272
1324
  }
1273
- C.decorate(C.inject(Y.ApiClient), Rt, 0);
1274
- C.decorate(C.injectable(), Rt);
1325
+ I.decorate(I.inject(Y.ApiClient), Rt, 0);
1326
+ I.decorate(I.injectable(), Rt);
1275
1327
  function qr({
1276
1328
  onLogin: r,
1277
1329
  error: e,
1278
1330
  onClickForgotPassword: t,
1279
1331
  loginLabel: s = "Email",
1280
- loginPlaceholder: o,
1332
+ loginPlaceholder: n,
1281
1333
  afterInputs: a,
1282
1334
  showMockUsersSelector: c = !1,
1283
1335
  mockUsers: i = [],
@@ -1291,18 +1343,18 @@ function qr({
1291
1343
  onVerifyMfa: E,
1292
1344
  mfaError: P,
1293
1345
  onCancelMfa: M,
1294
- isVerifyingMfa: O = !1
1346
+ isVerifyingMfa: $ = !1
1295
1347
  }) {
1296
1348
  const V = ut(), {
1297
1349
  username: _,
1298
1350
  password: b,
1299
1351
  rememberMe: m,
1300
1352
  clearRememberMe: R
1301
- } = Vt(), [H, L] = p(_), [N, T] = p(b), [ee, te] = p(m), [se, g] = p(!1), [v, K] = p(null), [W, we] = p("");
1353
+ } = Vt(), [H, O] = p(_), [N, T] = p(b), [ee, te] = p(m), [se, g] = p(!1), [v, K] = p(null), [W, we] = p("");
1302
1354
  X(() => {
1303
1355
  g(!!e);
1304
1356
  }, [e]), X(() => {
1305
- _ !== H && (L(_), S?.(_)), b !== N && T(b), m !== ee && te(m);
1357
+ _ !== H && (O(_), S?.(_)), b !== N && T(b), m !== ee && te(m);
1306
1358
  }, [_, b, m]);
1307
1359
  const he = () => {
1308
1360
  g(!1);
@@ -1311,15 +1363,15 @@ function qr({
1311
1363
  }, ce = () => {
1312
1364
  const l = W.trim();
1313
1365
  l && E && E(l);
1314
- }, oe = () => {
1366
+ }, ne = () => {
1315
1367
  if (!d)
1316
1368
  return i.map((f) => ({
1317
1369
  value: f.email,
1318
1370
  label: f.email
1319
1371
  }));
1320
1372
  const l = i.reduce((f, D) => {
1321
- const j = d[D.type];
1322
- return j && (f[j] || (f[j] = []), f[j].push({
1373
+ const z = d[D.type];
1374
+ return z && (f[z] || (f[z] = []), f[z].push({
1323
1375
  value: D.email,
1324
1376
  label: D.email
1325
1377
  })), f;
@@ -1331,7 +1383,7 @@ function qr({
1331
1383
  }, be = () => {
1332
1384
  if (v) {
1333
1385
  const l = i.find((f) => f.email === v);
1334
- l && (L(l.email), T(l.password), he());
1386
+ l && (O(l.email), T(l.password), he());
1335
1387
  }
1336
1388
  }, u = {
1337
1389
  withBorder: !0,
@@ -1342,16 +1394,16 @@ function qr({
1342
1394
  w: 400,
1343
1395
  ...y.cardProps
1344
1396
  };
1345
- return /* @__PURE__ */ I(
1397
+ return /* @__PURE__ */ C(
1346
1398
  We,
1347
1399
  {
1348
1400
  ...u,
1349
1401
  pos: "relative",
1350
1402
  ref: V,
1351
1403
  children: [
1352
- A && /* @__PURE__ */ I(ie, { children: [
1353
- /* @__PURE__ */ n(
1354
- z,
1404
+ A && /* @__PURE__ */ C(ie, { children: [
1405
+ /* @__PURE__ */ o(
1406
+ j,
1355
1407
  {
1356
1408
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1357
1409
  fw: 800,
@@ -1361,18 +1413,18 @@ function qr({
1361
1413
  children: x().t("archbase:signIn")
1362
1414
  }
1363
1415
  ),
1364
- /* @__PURE__ */ n(Ue, { m: "md" })
1416
+ /* @__PURE__ */ o(Ue, { m: "md" })
1365
1417
  ] }),
1366
1418
  y?.customContentBefore,
1367
- w && /* @__PURE__ */ I(Ee, { gap: "md", children: [
1368
- /* @__PURE__ */ I("div", { children: [
1369
- /* @__PURE__ */ n(z, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
1370
- /* @__PURE__ */ n(z, { c: "dimmed", fz: "sm", children: x().t(
1419
+ w && /* @__PURE__ */ C(Ee, { gap: "md", children: [
1420
+ /* @__PURE__ */ C("div", { children: [
1421
+ /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
1422
+ /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: x().t(
1371
1423
  "archbase:mfa.subtitle",
1372
1424
  "Digite o código do seu aplicativo autenticador (ou um código de recuperação)."
1373
1425
  ) })
1374
1426
  ] }),
1375
- /* @__PURE__ */ n(
1427
+ /* @__PURE__ */ o(
1376
1428
  xe,
1377
1429
  {
1378
1430
  label: x().t("archbase:mfa.code", "Código de verificação"),
@@ -1385,18 +1437,18 @@ function qr({
1385
1437
  }
1386
1438
  }
1387
1439
  ),
1388
- P && /* @__PURE__ */ n(z, { c: "red", fz: "sm", children: P }),
1389
- /* @__PURE__ */ n(
1440
+ P && /* @__PURE__ */ o(j, { c: "red", fz: "sm", children: P }),
1441
+ /* @__PURE__ */ o(
1390
1442
  G,
1391
1443
  {
1392
1444
  fullWidth: !0,
1393
- disabled: !W.trim() || O,
1394
- loading: O,
1445
+ disabled: !W.trim() || $,
1446
+ loading: $,
1395
1447
  onClick: ce,
1396
1448
  children: x().t("archbase:mfa.verify", "Verificar")
1397
1449
  }
1398
1450
  ),
1399
- M && /* @__PURE__ */ n(
1451
+ M && /* @__PURE__ */ o(
1400
1452
  et,
1401
1453
  {
1402
1454
  component: "button",
@@ -1409,14 +1461,14 @@ function qr({
1409
1461
  }
1410
1462
  )
1411
1463
  ] }),
1412
- !w && /* @__PURE__ */ I(ie, { children: [
1413
- c && /* @__PURE__ */ I(ie, { children: [
1414
- /* @__PURE__ */ I(ue, { gap: "sm", mb: "md", children: [
1415
- /* @__PURE__ */ n(
1464
+ !w && /* @__PURE__ */ C(ie, { children: [
1465
+ c && /* @__PURE__ */ C(ie, { children: [
1466
+ /* @__PURE__ */ C(ue, { gap: "sm", mb: "md", children: [
1467
+ /* @__PURE__ */ o(
1416
1468
  Yt,
1417
1469
  {
1418
1470
  placeholder: "Selecione um usuário mock",
1419
- data: oe(),
1471
+ data: ne(),
1420
1472
  value: v,
1421
1473
  onChange: (l) => K(l ?? ""),
1422
1474
  searchable: !0,
@@ -1424,7 +1476,7 @@ function qr({
1424
1476
  style: { flexGrow: 1 }
1425
1477
  }
1426
1478
  ),
1427
- /* @__PURE__ */ n(Xt, { label: "Aplicar", children: /* @__PURE__ */ n(
1479
+ /* @__PURE__ */ o(Xt, { label: "Aplicar", children: /* @__PURE__ */ o(
1428
1480
  G,
1429
1481
  {
1430
1482
  variant: "light",
@@ -1432,27 +1484,27 @@ function qr({
1432
1484
  onClick: be,
1433
1485
  disabled: !v,
1434
1486
  "aria-label": "Aplicar usuário mock selecionado",
1435
- children: /* @__PURE__ */ n(rr, { size: 16 })
1487
+ children: /* @__PURE__ */ o(rr, { size: 16 })
1436
1488
  }
1437
1489
  ) })
1438
1490
  ] }),
1439
- /* @__PURE__ */ n(Ue, { mb: "md" })
1491
+ /* @__PURE__ */ o(Ue, { mb: "md" })
1440
1492
  ] }),
1441
- /* @__PURE__ */ n(
1493
+ /* @__PURE__ */ o(
1442
1494
  xe,
1443
1495
  {
1444
1496
  label: s,
1445
- placeholder: o ?? x().t("archbase:usuario@email.com"),
1446
- rightSection: U ? /* @__PURE__ */ n(dt, { size: "xs" }) : null,
1497
+ placeholder: n ?? x().t("archbase:usuario@email.com"),
1498
+ rightSection: U ? /* @__PURE__ */ o(dt, { size: "xs" }) : null,
1447
1499
  value: H || "",
1448
1500
  required: !0,
1449
1501
  onChange: (l) => {
1450
- L(l.currentTarget.value), S?.(l.currentTarget.value), he();
1502
+ O(l.currentTarget.value), S?.(l.currentTarget.value), he();
1451
1503
  }
1452
1504
  }
1453
1505
  ),
1454
- /* @__PURE__ */ n(
1455
- je,
1506
+ /* @__PURE__ */ o(
1507
+ ze,
1456
1508
  {
1457
1509
  label: x().t("archbase:Password"),
1458
1510
  placeholder: x().t("archbase:Sua senha"),
@@ -1464,8 +1516,8 @@ function qr({
1464
1516
  mt: "md"
1465
1517
  }
1466
1518
  ),
1467
- /* @__PURE__ */ I(ue, { justify: "space-between", mt: "md", children: [
1468
- /* @__PURE__ */ n(
1519
+ /* @__PURE__ */ C(ue, { justify: "space-between", mt: "md", children: [
1520
+ /* @__PURE__ */ o(
1469
1521
  Qt,
1470
1522
  {
1471
1523
  label: x().t("archbase:Lembre-me"),
@@ -1476,7 +1528,7 @@ function qr({
1476
1528
  }
1477
1529
  }
1478
1530
  ),
1479
- t && /* @__PURE__ */ n(
1531
+ t && /* @__PURE__ */ o(
1480
1532
  et,
1481
1533
  {
1482
1534
  component: "button",
@@ -1490,7 +1542,7 @@ function qr({
1490
1542
  )
1491
1543
  ] }),
1492
1544
  y?.afterInputs || a,
1493
- /* @__PURE__ */ n(
1545
+ /* @__PURE__ */ o(
1494
1546
  G,
1495
1547
  {
1496
1548
  disabled: !N || !H || h,
@@ -1502,18 +1554,18 @@ function qr({
1502
1554
  )
1503
1555
  ] }),
1504
1556
  y?.customContentAfter,
1505
- se && e && /* @__PURE__ */ n(z, { c: "red", mt: "sm", children: e })
1557
+ se && e && /* @__PURE__ */ o(j, { c: "red", mt: "sm", children: e })
1506
1558
  ]
1507
1559
  }
1508
1560
  );
1509
1561
  }
1510
- const $ = (r, e) => x().t(r, e);
1562
+ const L = (r, e) => x().t(r, e);
1511
1563
  function Yr({
1512
1564
  enabled: r,
1513
1565
  onSetup: e,
1514
1566
  onEnable: t,
1515
1567
  onDisable: s,
1516
- onStatusChange: o
1568
+ onStatusChange: n
1517
1569
  }) {
1518
1570
  const [a, c] = p("idle"), [i, d] = p(null), [y, S] = p(""), [h, U] = p([]), [A, w] = p(!1), [E, P] = p(null), M = async () => {
1519
1571
  w(!0), P(null);
@@ -1525,13 +1577,13 @@ function Yr({
1525
1577
  } finally {
1526
1578
  w(!1);
1527
1579
  }
1528
- }, O = async () => {
1580
+ }, $ = async () => {
1529
1581
  const b = y.trim();
1530
1582
  if (b) {
1531
1583
  w(!0), P(null);
1532
1584
  try {
1533
1585
  const m = await t(b);
1534
- U(m), c("recovery"), o?.(!0);
1586
+ U(m), c("recovery"), n?.(!0);
1535
1587
  } catch (m) {
1536
1588
  P(m?.message || String(m));
1537
1589
  } finally {
@@ -1541,7 +1593,7 @@ function Yr({
1541
1593
  }, V = async () => {
1542
1594
  w(!0), P(null);
1543
1595
  try {
1544
- await s(), d(null), U([]), c("idle"), o?.(!1);
1596
+ await s(), d(null), U([]), c("idle"), n?.(!1);
1545
1597
  } catch (b) {
1546
1598
  P(b?.message || String(b));
1547
1599
  } finally {
@@ -1550,59 +1602,59 @@ function Yr({
1550
1602
  }, _ = () => {
1551
1603
  U([]), d(null), S(""), c("idle");
1552
1604
  };
1553
- return /* @__PURE__ */ n(We, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ I(Ee, { gap: "md", children: [
1554
- /* @__PURE__ */ I("div", { children: [
1555
- /* @__PURE__ */ n(z, { fw: 700, fz: "lg", children: $("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1556
- /* @__PURE__ */ n(z, { c: "dimmed", fz: "sm", children: $(
1605
+ return /* @__PURE__ */ o(We, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
1606
+ /* @__PURE__ */ C("div", { children: [
1607
+ /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: L("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1608
+ /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: L(
1557
1609
  "archbase:mfa.setup.subtitle",
1558
1610
  "Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
1559
1611
  ) })
1560
1612
  ] }),
1561
- E && /* @__PURE__ */ n(tt, { color: "red", children: E }),
1562
- r && a === "idle" && /* @__PURE__ */ I(ue, { justify: "space-between", children: [
1563
- /* @__PURE__ */ n(z, { c: "teal", fw: 600, children: $("archbase:mfa.setup.active", "MFA ativo") }),
1564
- /* @__PURE__ */ n(G, { color: "red", variant: "light", loading: A, onClick: V, children: $("archbase:mfa.setup.disable", "Desativar") })
1613
+ E && /* @__PURE__ */ o(tt, { color: "red", children: E }),
1614
+ r && a === "idle" && /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1615
+ /* @__PURE__ */ o(j, { c: "teal", fw: 600, children: L("archbase:mfa.setup.active", "MFA ativo") }),
1616
+ /* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick: V, children: L("archbase:mfa.setup.disable", "Desativar") })
1565
1617
  ] }),
1566
- !r && a === "idle" && /* @__PURE__ */ n(G, { loading: A, onClick: M, children: $("archbase:mfa.setup.enable", "Ativar MFA") }),
1567
- a === "setup" && i && /* @__PURE__ */ I(Ee, { gap: "sm", align: "center", children: [
1568
- /* @__PURE__ */ n(z, { fz: "sm", ta: "center", children: $(
1618
+ !r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children: L("archbase:mfa.setup.enable", "Ativar MFA") }),
1619
+ a === "setup" && i && /* @__PURE__ */ C(Ee, { gap: "sm", align: "center", children: [
1620
+ /* @__PURE__ */ o(j, { fz: "sm", ta: "center", children: L(
1569
1621
  "archbase:mfa.setup.scan",
1570
1622
  "Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
1571
1623
  ) }),
1572
- /* @__PURE__ */ n(sr, { value: i.provisioningUri, size: 180, level: "M" }),
1573
- /* @__PURE__ */ n(z, { fz: "xs", c: "dimmed", ta: "center", children: $("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1574
- /* @__PURE__ */ I(ue, { gap: "xs", children: [
1575
- /* @__PURE__ */ n(rt, { children: i.secret }),
1576
- /* @__PURE__ */ n(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ n(G, { size: "xs", variant: "subtle", onClick: m, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copy", "Copiar") }) })
1624
+ /* @__PURE__ */ o(sr, { value: i.provisioningUri, size: 180, level: "M" }),
1625
+ /* @__PURE__ */ o(j, { fz: "xs", c: "dimmed", ta: "center", children: L("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1626
+ /* @__PURE__ */ C(ue, { gap: "xs", children: [
1627
+ /* @__PURE__ */ o(rt, { children: i.secret }),
1628
+ /* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ? L("archbase:mfa.setup.copied", "Copiado") : L("archbase:mfa.setup.copy", "Copiar") }) })
1577
1629
  ] }),
1578
- /* @__PURE__ */ n(
1630
+ /* @__PURE__ */ o(
1579
1631
  xe,
1580
1632
  {
1581
1633
  w: "100%",
1582
- label: $("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1634
+ label: L("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1583
1635
  placeholder: "000000",
1584
1636
  value: y,
1585
1637
  onChange: (b) => S(b.currentTarget.value),
1586
1638
  onKeyDown: (b) => {
1587
- b.key === "Enter" && O();
1639
+ b.key === "Enter" && $();
1588
1640
  }
1589
1641
  }
1590
1642
  ),
1591
- /* @__PURE__ */ I(ue, { w: "100%", justify: "flex-end", children: [
1592
- /* @__PURE__ */ n(G, { variant: "default", onClick: _, disabled: A, children: $("archbase:mfa.setup.cancel", "Cancelar") }),
1593
- /* @__PURE__ */ n(G, { onClick: O, loading: A, disabled: !y.trim(), children: $("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1643
+ /* @__PURE__ */ C(ue, { w: "100%", justify: "flex-end", children: [
1644
+ /* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children: L("archbase:mfa.setup.cancel", "Cancelar") }),
1645
+ /* @__PURE__ */ o(G, { onClick: $, loading: A, disabled: !y.trim(), children: L("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1594
1646
  ] })
1595
1647
  ] }),
1596
- a === "recovery" && /* @__PURE__ */ I(Ee, { gap: "sm", children: [
1597
- /* @__PURE__ */ n(tt, { color: "yellow", children: $(
1648
+ a === "recovery" && /* @__PURE__ */ C(Ee, { gap: "sm", children: [
1649
+ /* @__PURE__ */ o(tt, { color: "yellow", children: L(
1598
1650
  "archbase:mfa.setup.recoveryWarning",
1599
1651
  "Guarde estes códigos de recuperação em local seguro. Cada um funciona uma única vez e permite entrar se você perder o acesso ao app autenticador. Eles não serão exibidos novamente."
1600
1652
  ) }),
1601
- /* @__PURE__ */ n(Zt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ n(rt, { fz: "sm", children: b }, b)) }),
1602
- /* @__PURE__ */ I(ue, { justify: "space-between", children: [
1603
- /* @__PURE__ */ n(st, { value: h.join(`
1604
- `), children: ({ copied: b, copy: m }) => /* @__PURE__ */ n(G, { variant: "subtle", onClick: m, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1605
- /* @__PURE__ */ n(G, { onClick: _, children: $("archbase:mfa.setup.done", "Guardei os códigos") })
1653
+ /* @__PURE__ */ o(Zt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ o(rt, { fz: "sm", children: b }, b)) }),
1654
+ /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1655
+ /* @__PURE__ */ o(st, { value: h.join(`
1656
+ `), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ? L("archbase:mfa.setup.copied", "Copiado") : L("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1657
+ /* @__PURE__ */ o(G, { onClick: _, children: L("archbase:mfa.setup.done", "Guardei os códigos") })
1606
1658
  ] })
1607
1659
  ] })
1608
1660
  ] }) });
@@ -1614,19 +1666,19 @@ const Sr = {
1614
1666
  padding: 30,
1615
1667
  marginTop: 30
1616
1668
  };
1617
- function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: S = !0 }) {
1618
- const h = ut(), U = Ht(), { colorScheme: A } = er(), [w, E] = p(r ?? ""), [P, M] = p(c), [O, V] = p(""), [_, b] = p(""), [m, R] = p(""), [H, L] = p(!1), [N, T] = p(""), [ee, te] = p(""), [se, g] = p(""), [v, K] = p(""), W = Wt(y);
1669
+ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: S = !0 }) {
1670
+ const h = ut(), U = Ht(), { colorScheme: A } = er(), [w, E] = p(r ?? ""), [P, M] = p(c), [$, V] = p(""), [_, b] = p(""), [m, R] = p(""), [H, O] = p(!1), [N, T] = p(""), [ee, te] = p(""), [se, g] = p(""), [v, K] = p(""), W = Wt(y);
1619
1671
  async function we(B) {
1620
1672
  B && (Gt(B) ? await e(B).then(() => {
1621
- ot.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
1673
+ nt.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), O(!0);
1622
1674
  }).catch(() => {
1623
1675
  }) : T(`${x().t("archbase:Email inválido")}`));
1624
1676
  }
1625
- async function he(B, ce, oe, be) {
1626
- if (B && ce && oe) {
1677
+ async function he(B, ce, ne, be) {
1678
+ if (B && ce && ne) {
1627
1679
  let u = "", l = "", f = "";
1628
- a && (u = a(ce), te(u)), W && (l = Jt(oe, W).error ?? ""), !l && o && (l = o(oe)), g(l), oe !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t(B, ce, oe).then(() => {
1629
- ot.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
1680
+ a && (u = a(ce), te(u)), W && (l = Jt(ne, W).error ?? ""), !l && n && (l = n(ne)), g(l), ne !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t(B, ce, ne).then(() => {
1681
+ nt.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), O(!1);
1630
1682
  }).catch(() => {
1631
1683
  E(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
1632
1684
  });
@@ -1636,7 +1688,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1636
1688
  r && E(r);
1637
1689
  }, [r]), X(() => {
1638
1690
  E("");
1639
- }, [P, O, _, m]), /* @__PURE__ */ I(
1691
+ }, [P, $, _, m]), /* @__PURE__ */ C(
1640
1692
  We,
1641
1693
  {
1642
1694
  withBorder: !0,
@@ -1648,9 +1700,9 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1648
1700
  ...d
1649
1701
  },
1650
1702
  children: [
1651
- H ? /* @__PURE__ */ I(ie, { children: [
1652
- /* @__PURE__ */ n(
1653
- z,
1703
+ H ? /* @__PURE__ */ C(ie, { children: [
1704
+ /* @__PURE__ */ o(
1705
+ j,
1654
1706
  {
1655
1707
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1656
1708
  fw: 800,
@@ -1660,13 +1712,13 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1660
1712
  children: x().t("archbase:Redefinir senha")
1661
1713
  }
1662
1714
  ),
1663
- /* @__PURE__ */ n(Ue, { m: "xs" }),
1664
- /* @__PURE__ */ n(
1715
+ /* @__PURE__ */ o(Ue, { m: "xs" }),
1716
+ /* @__PURE__ */ o(
1665
1717
  xe,
1666
1718
  {
1667
1719
  label: x().t("archbase:Código de segurança"),
1668
1720
  placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
1669
- value: O || "",
1721
+ value: $ || "",
1670
1722
  required: !0,
1671
1723
  onChange: (B) => {
1672
1724
  V(B.currentTarget.value), te("");
@@ -1674,8 +1726,8 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1674
1726
  error: ee
1675
1727
  }
1676
1728
  ),
1677
- /* @__PURE__ */ n(
1678
- je,
1729
+ /* @__PURE__ */ o(
1730
+ ze,
1679
1731
  {
1680
1732
  label: x().t("archbase:Nova senha"),
1681
1733
  placeholder: x().t("archbase:Nova senha"),
@@ -1687,16 +1739,16 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1687
1739
  error: se
1688
1740
  }
1689
1741
  ),
1690
- W && /* @__PURE__ */ n(
1691
- or,
1742
+ W && /* @__PURE__ */ o(
1743
+ nr,
1692
1744
  {
1693
1745
  value: _,
1694
1746
  policy: W,
1695
1747
  showRequirements: S
1696
1748
  }
1697
1749
  ),
1698
- /* @__PURE__ */ n(
1699
- je,
1750
+ /* @__PURE__ */ o(
1751
+ ze,
1700
1752
  {
1701
1753
  label: x().t("archbase:Confirmar senha"),
1702
1754
  placeholder: x().t("archbase:Confirmar senha"),
@@ -1708,31 +1760,31 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1708
1760
  error: v
1709
1761
  }
1710
1762
  ),
1711
- /* @__PURE__ */ n(
1763
+ /* @__PURE__ */ o(
1712
1764
  G,
1713
1765
  {
1714
- disabled: !P || !O || !_ || !m,
1766
+ disabled: !P || !$ || !_ || !m,
1715
1767
  mt: "md",
1716
1768
  fullWidth: !0,
1717
- onClick: () => he(P, O, _, m),
1769
+ onClick: () => he(P, $, _, m),
1718
1770
  children: `${x().t("archbase:Redefinir senha")}`
1719
1771
  }
1720
1772
  ),
1721
- /* @__PURE__ */ n(
1773
+ /* @__PURE__ */ o(
1722
1774
  G,
1723
1775
  {
1724
1776
  mt: "6px",
1725
1777
  fullWidth: !0,
1726
1778
  color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
1727
1779
  onClick: () => {
1728
- N || L(!1);
1780
+ N || O(!1);
1729
1781
  },
1730
1782
  children: `${x().t("archbase:Voltar")}`
1731
1783
  }
1732
1784
  )
1733
- ] }) : /* @__PURE__ */ I(ie, { children: [
1734
- /* @__PURE__ */ n(
1735
- z,
1785
+ ] }) : /* @__PURE__ */ C(ie, { children: [
1786
+ /* @__PURE__ */ o(
1787
+ j,
1736
1788
  {
1737
1789
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1738
1790
  fw: 800,
@@ -1742,9 +1794,9 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1742
1794
  children: x().t("archbase:Redefinir senha")
1743
1795
  }
1744
1796
  ),
1745
- /* @__PURE__ */ n(z, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1746
- /* @__PURE__ */ n(Ue, { m: "md" }),
1747
- /* @__PURE__ */ n(
1797
+ /* @__PURE__ */ o(j, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1798
+ /* @__PURE__ */ o(Ue, { m: "md" }),
1799
+ /* @__PURE__ */ o(
1748
1800
  xe,
1749
1801
  {
1750
1802
  label: "Email",
@@ -1757,7 +1809,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1757
1809
  error: N
1758
1810
  }
1759
1811
  ),
1760
- /* @__PURE__ */ n(
1812
+ /* @__PURE__ */ o(
1761
1813
  G,
1762
1814
  {
1763
1815
  disabled: !P,
@@ -1767,7 +1819,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1767
1819
  children: `${x().t("archbase:Enviar")}`
1768
1820
  }
1769
1821
  ),
1770
- /* @__PURE__ */ n(
1822
+ /* @__PURE__ */ o(
1771
1823
  G,
1772
1824
  {
1773
1825
  mt: "6px",
@@ -1778,13 +1830,13 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1778
1830
  }
1779
1831
  )
1780
1832
  ] }),
1781
- w ? /* @__PURE__ */ n(z, { c: "red", style: { textAlign: "justify" }, children: w }) : null
1833
+ w ? /* @__PURE__ */ o(j, { c: "red", style: { textAlign: "justify" }, children: w }) : null
1782
1834
  ]
1783
1835
  }
1784
1836
  );
1785
1837
  }
1786
- const Cr = () => Kt().user, Mt = "archbaseSecurityManagerStore", Qr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1787
- const s = lt(Mt), o = Cr(), a = o?.isAdmin ?? !1, c = o?.id, i = ct(c), d = at(() => {
1838
+ const Ir = () => Kt().user, Mt = "archbaseSecurityManagerStore", Qr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1839
+ const s = lt(Mt), n = Ir(), a = n?.isAdmin ?? !1, c = n?.id, i = ct(c), d = at(() => {
1788
1840
  if (!t)
1789
1841
  return null;
1790
1842
  const y = c ? `${r}_${c}` : r;
@@ -1800,7 +1852,7 @@ const Cr = () => Kt().user, Mt = "archbaseSecurityManagerStore", Qr = ({ resourc
1800
1852
  i.current = c;
1801
1853
  }, [c]), { securityManager: d };
1802
1854
  };
1803
- function $e(r) {
1855
+ function Le(r) {
1804
1856
  const e = r?.response?.data ?? r?.data ?? r;
1805
1857
  return e?.error === "CREDENTIALS_EXPIRED" || e?.requirePasswordChange === !0;
1806
1858
  }
@@ -1814,7 +1866,7 @@ const Zr = ({
1814
1866
  (u) => u.get(Y.TokenManager)
1815
1867
  ), s = De(
1816
1868
  (u) => u.get(Y.Authenticator)
1817
- ), [o, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [S, h] = p(!1), [U, A] = p(!1), [w, E] = p(""), [P, M] = p(""), [O, V] = p(null), [_, b] = p(!1), [m, R] = p(!1), [H, L] = p(null), N = lt(Mt), T = {
1869
+ ), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [S, h] = p(!1), [U, A] = p(!1), [w, E] = p(""), [P, M] = p(""), [$, V] = p(null), [_, b] = p(!1), [m, R] = p(!1), [H, O] = p(null), N = lt(Mt), T = {
1818
1870
  hasContextualLogin: typeof s.loginWithContext == "function",
1819
1871
  hasFlexibleLogin: typeof s.loginFlexible == "function",
1820
1872
  hasSocialLogin: typeof s.loginSocial == "function",
@@ -1848,26 +1900,26 @@ const Zr = ({
1848
1900
  const D = await s.login(u, l);
1849
1901
  t.saveToken(D), f && t.saveUsernameAndPassword(u, l), t.saveUsername(u), M(u), a(D), i(!1), h(!0);
1850
1902
  } catch (D) {
1851
- i(!1), h(!1), $e(D) && (M(u), R(!0)), E(ne(D)), A(!0);
1903
+ i(!1), h(!1), Le(D) && (M(u), R(!0)), E(oe(D)), A(!0);
1852
1904
  }
1853
1905
  }, v = async (u, l = !1) => {
1854
1906
  if (!T.hasContextualLogin || !s.loginWithContext)
1855
1907
  throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
1856
1908
  try {
1857
1909
  i(!0), h(!1);
1858
- const { context: f, user: D, ...j } = await s.loginWithContext(u);
1859
- if (j.mfa_required) {
1860
- L(j.challenge_token ?? null), b(!0), M(u.email), i(!1);
1910
+ const { context: f, user: D, ...z } = await s.loginWithContext(u);
1911
+ if (z.mfa_required) {
1912
+ O(z.challenge_token ?? null), b(!0), M(u.email), i(!1);
1861
1913
  return;
1862
1914
  }
1863
1915
  const Ae = {
1864
1916
  scope: "",
1865
- ext_expires_in: j.expires_in,
1866
- ...j
1917
+ ext_expires_in: z.expires_in,
1918
+ ...z
1867
1919
  };
1868
1920
  t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(u.email), a(Ae), i(!1), h(!0);
1869
1921
  } catch (f) {
1870
- throw i(!1), h(!1), $e(f) && (M(u.email), R(!0)), E(ne(f)), A(!0), f;
1922
+ throw i(!1), h(!1), Le(f) && (M(u.email), R(!0)), E(oe(f)), A(!0), f;
1871
1923
  }
1872
1924
  }, K = async (u) => {
1873
1925
  if (!s.verifyMfa)
@@ -1877,39 +1929,39 @@ const Zr = ({
1877
1929
  try {
1878
1930
  i(!0), E(""), A(!1);
1879
1931
  const l = await s.verifyMfa(H, u);
1880
- t.saveToken(l), t.saveUsername(P), a(l), b(!1), L(null), i(!1), h(!0);
1932
+ t.saveToken(l), t.saveUsername(P), a(l), b(!1), O(null), i(!1), h(!0);
1881
1933
  } catch (l) {
1882
- throw i(!1), E(ne(l)), A(!0), l;
1934
+ throw i(!1), E(oe(l)), A(!0), l;
1883
1935
  }
1884
1936
  }, W = () => {
1885
- b(!1), L(null), E(""), A(!1);
1937
+ b(!1), O(null), E(""), A(!1);
1886
1938
  }, we = async (u, l = !1) => {
1887
1939
  if (!T.hasFlexibleLogin || !s.loginFlexible)
1888
1940
  throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
1889
1941
  try {
1890
1942
  i(!0), h(!1);
1891
- const { context: f, user: D, ...j } = await s.loginFlexible(u), Ae = {
1943
+ const { context: f, user: D, ...z } = await s.loginFlexible(u), Ae = {
1892
1944
  scope: "",
1893
- ext_expires_in: j.expires_in,
1894
- ...j
1945
+ ext_expires_in: z.expires_in,
1946
+ ...z
1895
1947
  };
1896
1948
  t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
1897
1949
  } catch (f) {
1898
- throw i(!1), h(!1), $e(f) && (M(u.identifier), R(!0)), E(ne(f)), A(!0), f;
1950
+ throw i(!1), h(!1), Le(f) && (M(u.identifier), R(!0)), E(oe(f)), A(!0), f;
1899
1951
  }
1900
1952
  }, he = async (u) => {
1901
1953
  if (!T.hasSocialLogin || !s.loginSocial)
1902
1954
  throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
1903
1955
  try {
1904
1956
  i(!0), h(!1);
1905
- const { context: l, user: f, ...D } = await s.loginSocial(u), j = {
1957
+ const { context: l, user: f, ...D } = await s.loginSocial(u), z = {
1906
1958
  scope: "",
1907
1959
  ext_expires_in: D.expires_in,
1908
1960
  ...D
1909
1961
  };
1910
- t.saveToken(j), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), V(l)), M(f.email), a(j), i(!1), h(!0);
1962
+ t.saveToken(z), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), V(l)), M(f.email), a(z), i(!1), h(!0);
1911
1963
  } catch (l) {
1912
- throw i(!1), h(!1), E(ne(l)), A(!0), l;
1964
+ throw i(!1), h(!1), E(oe(l)), A(!0), l;
1913
1965
  }
1914
1966
  }, B = async (u) => {
1915
1967
  if (!T.hasRegistration || !s.register)
@@ -1919,21 +1971,21 @@ const Zr = ({
1919
1971
  const l = await s.register(u);
1920
1972
  return i(!1), l;
1921
1973
  } catch (l) {
1922
- throw i(!1), E(ne(l)), A(!0), l;
1974
+ throw i(!1), E(oe(l)), A(!0), l;
1923
1975
  }
1924
- }, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, oe = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
1976
+ }, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, ne = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
1925
1977
  X(() => {
1926
1978
  const u = setInterval(() => {
1927
- o && o.access_token && t.isTokenExpired(o, e) && be();
1979
+ n && n.access_token && t.isTokenExpired(n, e) && be();
1928
1980
  }, r);
1929
1981
  return () => {
1930
1982
  clearInterval(u);
1931
1983
  };
1932
- }, [o]);
1984
+ }, [n]);
1933
1985
  const be = async () => {
1934
- if (o)
1986
+ if (n)
1935
1987
  try {
1936
- const u = await s.refreshToken(o?.refresh_token);
1988
+ const u = await s.refreshToken(n?.refresh_token);
1937
1989
  t.saveToken(u), a(u);
1938
1990
  } catch (u) {
1939
1991
  console.error("Erro ao renovar o token:", u), se();
@@ -1950,14 +2002,14 @@ const Zr = ({
1950
2002
  isError: U,
1951
2003
  error: w,
1952
2004
  clearError: ee,
1953
- accessToken: o ? o.access_token : null,
2005
+ accessToken: n ? n.access_token : null,
1954
2006
  // Métodos opcionais para autenticação avançada
1955
2007
  loginWithContext: T.hasContextualLogin ? v : void 0,
1956
2008
  loginFlexible: T.hasFlexibleLogin ? we : void 0,
1957
2009
  loginSocial: T.hasSocialLogin ? he : void 0,
1958
2010
  register: T.hasRegistration ? B : void 0,
1959
2011
  getSupportedContexts: ce,
1960
- validateContext: oe,
2012
+ validateContext: ne,
1961
2013
  // MFA / segundo fator (2 passos)
1962
2014
  mfaRequired: _,
1963
2015
  verifyMfa: typeof s.verifyMfa == "function" ? K : void 0,
@@ -1966,7 +2018,7 @@ const Zr = ({
1966
2018
  passwordChangeRequired: m,
1967
2019
  clearPasswordChangeRequired: te,
1968
2020
  // Informações de contexto
1969
- context: O,
2021
+ context: $,
1970
2022
  // Detecção de capacidades
1971
2023
  capabilities: T
1972
2024
  };
@@ -1983,45 +2035,45 @@ const Zr = ({
1983
2035
  }, ts = () => {
1984
2036
  const r = De(
1985
2037
  (d) => d.get(Y.Authenticator)
1986
- ), [e, t] = p(!1), [s, o] = p("");
2038
+ ), [e, t] = p(!1), [s, n] = p("");
1987
2039
  return {
1988
2040
  sendResetPasswordEmail: async (d) => {
1989
2041
  try {
1990
2042
  return await r.sendResetPasswordEmail(d);
1991
2043
  } catch (y) {
1992
- throw o(ne(y)), t(!0), y;
2044
+ throw n(oe(y)), t(!0), y;
1993
2045
  }
1994
2046
  },
1995
2047
  resetPassword: async (d, y, S) => {
1996
2048
  try {
1997
2049
  return await r.resetPassword(d, y, S);
1998
2050
  } catch (h) {
1999
- throw o(ne(h)), t(!0), h;
2051
+ throw n(oe(h)), t(!0), h;
2000
2052
  }
2001
2053
  },
2002
2054
  isError: e,
2003
2055
  error: s,
2004
2056
  clearError: () => {
2005
- t(!1), o("");
2057
+ t(!1), n("");
2006
2058
  }
2007
2059
  };
2008
- }, Ir = () => /* @__PURE__ */ n(tr, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ I(Ee, { gap: "md", children: [
2009
- /* @__PURE__ */ I(ue, { gap: "sm", children: [
2010
- /* @__PURE__ */ n(dt, { size: "sm" }),
2011
- /* @__PURE__ */ n(z, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2060
+ }, Cr = () => /* @__PURE__ */ o(tr, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
2061
+ /* @__PURE__ */ C(ue, { gap: "sm", children: [
2062
+ /* @__PURE__ */ o(dt, { size: "sm" }),
2063
+ /* @__PURE__ */ o(j, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2012
2064
  ] }),
2013
- /* @__PURE__ */ n(Ie, { height: 40, radius: "sm" }),
2014
- /* @__PURE__ */ n(Ie, { height: 200, radius: "sm" }),
2015
- /* @__PURE__ */ I(ue, { gap: "md", children: [
2016
- /* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" }),
2017
- /* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" })
2065
+ /* @__PURE__ */ o(Ce, { height: 40, radius: "sm" }),
2066
+ /* @__PURE__ */ o(Ce, { height: 200, radius: "sm" }),
2067
+ /* @__PURE__ */ C(ue, { gap: "md", children: [
2068
+ /* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" }),
2069
+ /* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" })
2018
2070
  ] })
2019
2071
  ] }) }), Ye = Ve(null), rs = ({
2020
2072
  children: r,
2021
2073
  user: e,
2022
2074
  onError: t
2023
2075
  }) => {
2024
- const [s, o] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ce((w) => d ? !0 : i.includes(w), [i, d]), S = Ce((w) => d ? !0 : w.some((E) => i.includes(E)), [i, d]), h = Ce((w) => d ? !0 : w.every((E) => i.includes(E)), [i, d]), U = Ce((w) => {
2076
+ const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]), S = Ie((w) => d ? !0 : w.some((E) => i.includes(E)), [i, d]), h = Ie((w) => d ? !0 : w.every((E) => i.includes(E)), [i, d]), U = Ie((w) => {
2025
2077
  c(w), w && t && t(w);
2026
2078
  }, [t]), A = {
2027
2079
  user: e,
@@ -2033,13 +2085,13 @@ const Zr = ({
2033
2085
  error: a,
2034
2086
  setError: U
2035
2087
  };
2036
- return /* @__PURE__ */ n(Ye.Provider, { value: A, children: r });
2088
+ return /* @__PURE__ */ o(Ye.Provider, { value: A, children: r });
2037
2089
  }, Nt = Ve(null), Pr = ({
2038
2090
  children: r,
2039
2091
  resourceName: e,
2040
2092
  resourceDescription: t,
2041
2093
  requiredPermissions: s = [],
2042
- fallbackComponent: o,
2094
+ fallbackComponent: n,
2043
2095
  loadingComponent: a,
2044
2096
  onSecurityReady: c,
2045
2097
  onError: i
@@ -2061,25 +2113,25 @@ const Zr = ({
2061
2113
  U(m), w(!1), c && c(m);
2062
2114
  });
2063
2115
  } catch {
2064
- const L = m.getError() || "Erro ao carregar permissões";
2065
- P(L), w(!1), i && i(L);
2116
+ const O = m.getError() || "Erro ao carregar permissões";
2117
+ P(O), w(!1), i && i(O);
2066
2118
  }
2067
2119
  })();
2068
2120
  }, [e, t, y, S, c, i]), A)
2069
- return a ? /* @__PURE__ */ n(ie, { children: a }) : /* @__PURE__ */ n(Ir, {});
2121
+ return a ? /* @__PURE__ */ o(ie, { children: a }) : /* @__PURE__ */ o(Cr, {});
2070
2122
  if (E)
2071
- return /* @__PURE__ */ n("div", { className: "archbase-security-error", children: /* @__PURE__ */ I("div", { children: [
2123
+ return /* @__PURE__ */ o("div", { className: "archbase-security-error", children: /* @__PURE__ */ C("div", { children: [
2072
2124
  "Erro ao carregar permissões: ",
2073
2125
  E
2074
2126
  ] }) });
2075
2127
  if (!y)
2076
- return o || /* @__PURE__ */ n("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ n("div", { children: "É necessário fazer login para acessar esta área" }) });
2128
+ return n || /* @__PURE__ */ o("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ o("div", { children: "É necessário fazer login para acessar esta área" }) });
2077
2129
  if (s.length > 0 && h && !s.every(
2078
2130
  (R) => h.hasPermission(R)
2079
2131
  ))
2080
- return o || /* @__PURE__ */ I("div", { className: "archbase-security-access-denied", children: [
2081
- /* @__PURE__ */ n("div", { children: "Você não possui permissão para acessar esta área" }),
2082
- /* @__PURE__ */ I("small", { children: [
2132
+ return n || /* @__PURE__ */ C("div", { className: "archbase-security-access-denied", children: [
2133
+ /* @__PURE__ */ o("div", { children: "Você não possui permissão para acessar esta área" }),
2134
+ /* @__PURE__ */ C("small", { children: [
2083
2135
  "Permissões necessárias: ",
2084
2136
  s.join(", ")
2085
2137
  ] })
@@ -2095,7 +2147,7 @@ const Zr = ({
2095
2147
  isLoading: A,
2096
2148
  error: E
2097
2149
  };
2098
- return /* @__PURE__ */ n(Nt.Provider, { value: b, children: r });
2150
+ return /* @__PURE__ */ o(Nt.Provider, { value: b, children: r });
2099
2151
  }, Tr = () => {
2100
2152
  const r = He(Ye);
2101
2153
  if (!r)
@@ -2107,12 +2159,12 @@ const Zr = ({
2107
2159
  throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
2108
2160
  return r;
2109
2161
  }, ss = (r, e) => {
2110
- const t = Xe(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading: d, error: y } = t;
2162
+ const t = Xe(), { hasPermission: s, hasAnyPermission: n, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading: d, error: y } = t;
2111
2163
  return it.useEffect(() => {
2112
2164
  r && e && (c("create", `Criar ${e}`), c("edit", `Editar ${e}`), c("delete", `Deletar ${e}`), c("view", `Visualizar ${e}`), c("list", `Listar ${e}`));
2113
2165
  }, [r, e, c]), {
2114
2166
  hasPermission: s,
2115
- hasAnyPermission: o,
2167
+ hasAnyPermission: n,
2116
2168
  hasAllPermissions: a,
2117
2169
  registerAction: c,
2118
2170
  securityManager: i,
@@ -2124,7 +2176,7 @@ const Zr = ({
2124
2176
  isLoading: d,
2125
2177
  error: y
2126
2178
  };
2127
- }, os = () => {
2179
+ }, ns = () => {
2128
2180
  const r = Xe();
2129
2181
  return {
2130
2182
  check: r.hasPermission,
@@ -2137,22 +2189,22 @@ const Zr = ({
2137
2189
  actionName: e,
2138
2190
  requiredPermissions: t = [],
2139
2191
  requireAll: s = !0,
2140
- actionDescription: o,
2192
+ actionDescription: n,
2141
2193
  fallback: a = null,
2142
2194
  autoRegister: c = !0
2143
2195
  }) => {
2144
2196
  const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction: S } = Xe();
2145
2197
  X(() => {
2146
- c && e && o && S(e, o);
2147
- }, [e, o, c, S]);
2198
+ c && e && n && S(e, n);
2199
+ }, [e, n, c, S]);
2148
2200
  let h = !1;
2149
- return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ n(ie, { children: r }) : /* @__PURE__ */ n(ie, { children: a });
2150
- }, ns = ({
2201
+ return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ o(ie, { children: r }) : /* @__PURE__ */ o(ie, { children: a });
2202
+ }, os = ({
2151
2203
  actionName: r,
2152
2204
  actionDescription: e,
2153
2205
  children: t,
2154
2206
  onClick: s,
2155
- disabled: o = !1,
2207
+ disabled: n = !1,
2156
2208
  className: a = "",
2157
2209
  style: c = {},
2158
2210
  variant: i = "primary",
@@ -2177,26 +2229,26 @@ const Zr = ({
2177
2229
  return {
2178
2230
  border: "none",
2179
2231
  borderRadius: "4px",
2180
- cursor: o ? "not-allowed" : "pointer",
2232
+ cursor: n ? "not-allowed" : "pointer",
2181
2233
  fontWeight: "500",
2182
- opacity: o ? 0.6 : 1,
2234
+ opacity: n ? 0.6 : 1,
2183
2235
  ...U[d],
2184
2236
  ...A[i],
2185
2237
  ...c
2186
2238
  };
2187
2239
  };
2188
- return /* @__PURE__ */ n(
2240
+ return /* @__PURE__ */ o(
2189
2241
  Bt,
2190
2242
  {
2191
2243
  actionName: r,
2192
2244
  actionDescription: e,
2193
2245
  fallback: null,
2194
- children: /* @__PURE__ */ n(
2246
+ children: /* @__PURE__ */ o(
2195
2247
  "button",
2196
2248
  {
2197
2249
  type: y,
2198
2250
  onClick: s,
2199
- disabled: o,
2251
+ disabled: n,
2200
2252
  className: S(),
2201
2253
  style: h(),
2202
2254
  children: t
@@ -2209,15 +2261,15 @@ const Zr = ({
2209
2261
  actionName: e,
2210
2262
  actionDescription: t,
2211
2263
  showLabel: s = !0,
2212
- label: o,
2264
+ label: n,
2213
2265
  fallbackText: a = "Campo não disponível",
2214
2266
  fallbackComponent: c
2215
- }) => e ? /* @__PURE__ */ n(
2267
+ }) => e ? /* @__PURE__ */ o(
2216
2268
  Bt,
2217
2269
  {
2218
2270
  actionName: e,
2219
2271
  actionDescription: t,
2220
- fallback: c || /* @__PURE__ */ I("div", { className: "archbase-secure-field-fallback", style: {
2272
+ fallback: c || /* @__PURE__ */ C("div", { className: "archbase-secure-field-fallback", style: {
2221
2273
  padding: "8px",
2222
2274
  color: "#666",
2223
2275
  fontStyle: "italic",
@@ -2225,26 +2277,26 @@ const Zr = ({
2225
2277
  border: "1px dashed #dee2e6",
2226
2278
  borderRadius: "4px"
2227
2279
  }, children: [
2228
- s && o && /* @__PURE__ */ I("label", { style: { fontWeight: "bold" }, children: [
2229
- o,
2280
+ s && n && /* @__PURE__ */ C("label", { style: { fontWeight: "bold" }, children: [
2281
+ n,
2230
2282
  ": "
2231
2283
  ] }),
2232
2284
  a
2233
2285
  ] }),
2234
2286
  children: r
2235
2287
  }
2236
- ) : /* @__PURE__ */ n(ie, { children: r });
2288
+ ) : /* @__PURE__ */ o(ie, { children: r });
2237
2289
  function as(r, e) {
2238
2290
  return function(s) {
2239
- const { resourceName: o, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
2240
- return /* @__PURE__ */ n(
2291
+ const { resourceName: n, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
2292
+ return /* @__PURE__ */ o(
2241
2293
  Pr,
2242
2294
  {
2243
- resourceName: o,
2295
+ resourceName: n,
2244
2296
  resourceDescription: a,
2245
2297
  requiredPermissions: c,
2246
2298
  fallbackComponent: i,
2247
- children: /* @__PURE__ */ n(r, { ...s })
2299
+ children: /* @__PURE__ */ o(r, { ...s })
2248
2300
  }
2249
2301
  );
2250
2302
  };
@@ -2267,20 +2319,20 @@ export {
2267
2319
  Bt as ArchbaseProtectedComponent,
2268
2320
  Xr as ArchbaseResetPassword,
2269
2321
  _t as ArchbaseResourceService,
2270
- ns as ArchbaseSecureActionButton,
2322
+ os as ArchbaseSecureActionButton,
2271
2323
  is as ArchbaseSecureFormField,
2272
2324
  Rt as ArchbaseSecurityDiagnosticsService,
2273
2325
  vt as ArchbaseSecurityManager,
2274
2326
  rs as ArchbaseSecurityProvider,
2275
2327
  J as ArchbaseTenantManager,
2276
2328
  ht as ArchbaseUser,
2277
- It as ArchbaseUserService,
2329
+ Ct as ArchbaseUserService,
2278
2330
  pt as ArchbaseUsernameAndPassword,
2279
2331
  pt as ArchbaseUsernameAndPasswordImpl,
2280
2332
  Pr as ArchbaseViewSecurityProvider,
2281
- Le as CONTEXT_STORAGE_KEY,
2282
- nr as DefaultArchbaseTokenManager,
2283
- Ir as DefaultSecurityLoading,
2333
+ Oe as CONTEXT_STORAGE_KEY,
2334
+ or as DefaultArchbaseTokenManager,
2335
+ Cr as DefaultSecurityLoading,
2284
2336
  le as ENCRYPTION_KEY,
2285
2337
  mt as FetchError,
2286
2338
  Se as GroupDto,
@@ -2291,28 +2343,28 @@ export {
2291
2343
  me as SecurityType,
2292
2344
  Ne as TOKEN_COOKIE_NAME,
2293
2345
  Er as TipoRecurso,
2294
- Oe as USER_NAME,
2346
+ $e as USER_NAME,
2295
2347
  Be as USER_NAME_AND_PASSWORD,
2296
2348
  Me as UserDto,
2297
2349
  Ge as UserGroupDto,
2298
2350
  gr as createInternalConfig,
2299
2351
  Te as decodeJWT,
2300
2352
  pe as epochAtSecondsFromNow,
2301
- nt as epochTimeIsPast,
2353
+ ot as epochTimeIsPast,
2302
2354
  hr as fetchTokens,
2303
2355
  pr as fetchWithRefreshToken,
2304
2356
  ar as generateCodeChallenge,
2305
2357
  ir as generateRandomString,
2306
2358
  ft as getRandomInteger,
2307
2359
  wr as getRefreshExpiresIn,
2308
- $e as isCredentialsExpiredError,
2360
+ Le as isCredentialsExpiredError,
2309
2361
  lr as postWithXForm,
2310
2362
  dr as redirectToLogin,
2311
2363
  fr as redirectToLogout,
2312
2364
  Zr as useArchbaseAuthenticationManager,
2313
2365
  es as useArchbaseGetCurrentToken,
2314
- Cr as useArchbaseGetLoggedUser,
2315
- os as useArchbasePermissionCheck,
2366
+ Ir as useArchbaseGetLoggedUser,
2367
+ ns as useArchbasePermissionCheck,
2316
2368
  ts as useArchbaseResetPassword,
2317
2369
  ss as useArchbaseSecureForm,
2318
2370
  Tr as useArchbaseSecurity,