@archbase/security 3.0.10 → 3.0.11

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,20 +1,20 @@
1
1
  import "reflect-metadata";
2
2
  import * as I from "inversify";
3
- import { decorate as At, injectable as Et } from "inversify";
4
- import { compressString as xt, decompressString as St, IOCContainer as kt, ARCHBASE_IOC_API_TYPE as G, processErrorMessage as ee, IsNotEmpty as J, IsOptional as re, IsBoolean as q, IsEmail as It, getKeyByEnumValue as Ve, useArchbasePasswordRemember as Pt, getI18nextInstance as S, useArchbaseTheme as Tt, isEmailValidate as Ct, useArchbaseAppContext as Ut } from "@archbase/core";
3
+ import { decorate as xt, injectable as kt } from "inversify";
4
+ import { compressString as St, decompressString as It, IOCContainer as Pt, ARCHBASE_IOC_API_TYPE as G, processErrorMessage as ee, IsNotEmpty as J, IsOptional as re, IsBoolean as q, IsEmail as Tt, getKeyByEnumValue as Ve, useArchbasePasswordRemember as Ct, getI18nextInstance as S, useArchbaseTheme as Ut, isEmailValidate as _t, useArchbaseAppContext as Dt } from "@archbase/core";
5
5
  import F from "crypto-js";
6
- import { jwtDecode as Dt } from "jwt-decode";
7
- import { jsx as l, jsxs as R, Fragment as te } from "react/jsx-runtime";
8
- import Ge, { useState as f, useEffect as z, createContext as Re, useMemo as _t, useRef as Rt, useCallback as pe, useContext as Ne } from "react";
6
+ import { jwtDecode as Rt } from "jwt-decode";
7
+ import { jsx as d, jsxs as R, Fragment as te } from "react/jsx-runtime";
8
+ import Ge, { useState as f, useEffect as z, createContext as Re, useMemo as Je, useRef as Ke, useCallback as pe, useContext as Ne } from "react";
9
9
  import { BehaviorSubject as ze } from "rxjs";
10
- import { ArchbaseRemoteApiService as ce, useArchbaseStore as Je } from "@archbase/data";
10
+ import { ArchbaseRemoteApiService as ce, useArchbaseStore as qe } from "@archbase/data";
11
11
  import { v4 as K } from "uuid";
12
- import { Card as Ke, Text as se, Divider as ye, Group as we, Select as Nt, Tooltip as Bt, Button as ie, TextInput as Ce, Loader as qe, PasswordInput as Ue, Checkbox as Mt, Anchor as Ot, useMantineColorScheme as Lt, Box as $t, Stack as jt, Skeleton as fe } from "@mantine/core";
13
- import { useFocusTrap as Ye } from "@mantine/hooks";
12
+ import { Card as Ye, Text as se, Divider as ye, Group as we, Select as Nt, Tooltip as Bt, Button as ie, TextInput as Ce, Loader as Xe, PasswordInput as Ue, Checkbox as Mt, Anchor as Ot, useMantineColorScheme as Lt, Box as $t, Stack as jt, Skeleton as fe } from "@mantine/core";
13
+ import { useFocusTrap as Qe } from "@mantine/hooks";
14
14
  import { IconCopy as Ft } from "@tabler/icons-react";
15
15
  import { ArchbaseDialog as We } from "@archbase/components";
16
16
  import { useContainer as ve } from "inversify-react";
17
- class Xe {
17
+ class Ze {
18
18
  id;
19
19
  displayName;
20
20
  email;
@@ -24,10 +24,10 @@ class Xe {
24
24
  this.id = e.id, this.displayName = e.displayName, this.email = e.email, this.photo = e.photo, this.isAdmin = e.isAdmin;
25
25
  }
26
26
  static newInstance() {
27
- return new Xe({});
27
+ return new Ze({});
28
28
  }
29
29
  }
30
- class Qe {
30
+ class et {
31
31
  username;
32
32
  password;
33
33
  remember;
@@ -35,10 +35,10 @@ class Qe {
35
35
  this.username = e.username, this.password = e.password, this.remember = e.remember;
36
36
  }
37
37
  static newInstance() {
38
- return new Qe({});
38
+ return new et({});
39
39
  }
40
40
  }
41
- const Q = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", ke = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Ie = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Pe = "602b05c5-ec46-451e-aba6-187e463bc245", Te = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
41
+ const Q = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Se = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Ie = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Pe = "602b05c5-ec46-451e-aba6-187e463bc245", Te = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
42
  class Vt {
43
43
  getUsernameAndPassword() {
44
44
  try {
@@ -77,19 +77,19 @@ class Vt {
77
77
  if (!s && !this.getToken())
78
78
  return !0;
79
79
  try {
80
- const o = Dt(s.access_token);
80
+ const o = Rt(s.access_token);
81
81
  if (!o)
82
82
  return !0;
83
- const a = Math.floor(Date.now() / 1e3), d = o.exp;
84
- return a > d - t;
83
+ const a = Math.floor(Date.now() / 1e3), l = o.exp;
84
+ return a > l - t;
85
85
  } catch {
86
86
  return !0;
87
87
  }
88
88
  }
89
89
  saveToken(e) {
90
90
  if (e) {
91
- const t = JSON.stringify(e), s = F.AES.encrypt(t, Q).toString(), o = xt(s);
92
- localStorage.setItem(ke, o);
91
+ const t = JSON.stringify(e), s = F.AES.encrypt(t, Q).toString(), o = St(s);
92
+ localStorage.setItem(Se, o);
93
93
  } else
94
94
  this.clearToken();
95
95
  }
@@ -97,14 +97,14 @@ class Vt {
97
97
  localStorage.removeItem(Ie), localStorage.removeItem(Pe);
98
98
  }
99
99
  clearToken() {
100
- localStorage.removeItem(ke);
100
+ localStorage.removeItem(Se);
101
101
  }
102
102
  getToken() {
103
103
  try {
104
- const e = localStorage.getItem(ke);
104
+ const e = localStorage.getItem(Se);
105
105
  if (!e)
106
106
  return null;
107
- const t = St(e), s = F.AES.decrypt(t, Q).toString(F.enc.Utf8);
107
+ const t = It(e), s = F.AES.decrypt(t, Q).toString(F.enc.Utf8);
108
108
  return JSON.parse(s);
109
109
  } catch {
110
110
  return null;
@@ -130,16 +130,16 @@ class Vt {
130
130
  localStorage.removeItem(Te);
131
131
  }
132
132
  }
133
- At(Et(), Vt);
134
- function Ze(r) {
133
+ xt(kt(), Vt);
134
+ function tt(r) {
135
135
  const t = new Uint8Array(1);
136
- return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? Ze(r) : t[0] % r;
136
+ return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? tt(r) : t[0] % r;
137
137
  }
138
138
  function zt(r) {
139
139
  let e = "";
140
140
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
141
141
  for (let s = 0; s < r; s++)
142
- e += t.charAt(Ze(t.length - 1));
142
+ e += t.charAt(tt(t.length - 1));
143
143
  return e;
144
144
  }
145
145
  async function Wt(r) {
@@ -150,7 +150,7 @@ async function Wt(r) {
150
150
  const t = new TextEncoder().encode(r), s = await window.crypto.subtle.digest("SHA-256", t), o = String.fromCharCode(...new Uint8Array(s));
151
151
  return btoa(o).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
152
152
  }
153
- class et extends Error {
153
+ class rt extends Error {
154
154
  status;
155
155
  statusText;
156
156
  constructor(e, t, s) {
@@ -171,15 +171,15 @@ async function Gt(r, e) {
171
171
  }).then(async (t) => {
172
172
  if (!t.ok) {
173
173
  const s = await t.text();
174
- throw new et(t.status, t.statusText, s);
174
+ throw new rt(t.status, t.statusText, s);
175
175
  }
176
176
  return t;
177
177
  });
178
178
  }
179
- const tt = "PKCE_code_verifier", De = "ROCP_auth_state";
179
+ const st = "PKCE_code_verifier", _e = "ROCP_auth_state";
180
180
  async function Jt(r, e) {
181
181
  const t = zt(96);
182
- return sessionStorage.setItem(tt, t), Wt(t).then((s) => {
182
+ return sessionStorage.setItem(st, t), Wt(t).then((s) => {
183
183
  const o = new URLSearchParams({
184
184
  response_type: "code",
185
185
  client_id: r.clientId,
@@ -188,15 +188,15 @@ async function Jt(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(De);
191
+ r.scope !== void 0 && o.append("scope", r.scope), sessionStorage.removeItem(_e);
192
192
  const a = e ?? r.state;
193
- a && (sessionStorage.setItem(De, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
193
+ a && (sessionStorage.setItem(_e, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
194
194
  });
195
195
  }
196
196
  function Kt(r) {
197
197
  return r.access_token !== void 0;
198
198
  }
199
- function rt(r, e) {
199
+ function ot(r, e) {
200
200
  return Gt(r, e).then((t) => t.json().then((s) => {
201
201
  if (Kt(s))
202
202
  return s;
@@ -204,7 +204,7 @@ function rt(r, e) {
204
204
  }));
205
205
  }
206
206
  const qt = (r) => {
207
- const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(tt);
207
+ const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(st);
208
208
  if (!t)
209
209
  throw Error(`Parâmetro 'código' não encontrado na URL.
210
210
  A autenticação ocorreu?`);
@@ -221,7 +221,7 @@ A autenticação ocorreu?`);
221
221
  ...r.extraTokenParameters,
222
222
  ...r.extraAuthParams
223
223
  };
224
- return rt(r.tokenEndpoint, o);
224
+ return ot(r.tokenEndpoint, o);
225
225
  }, Yt = (r) => {
226
226
  const { config: e, refreshToken: t } = r, s = {
227
227
  grant_type: "refresh_token",
@@ -231,10 +231,10 @@ A autenticação ocorreu?`);
231
231
  redirect_uri: e.redirectUri,
232
232
  ...e.extraTokenParameters
233
233
  };
234
- return rt(e.tokenEndpoint, s);
234
+ return ot(e.tokenEndpoint, s);
235
235
  };
236
236
  function Xt(r, e, t, s, o, a) {
237
- const d = new URLSearchParams({
237
+ const l = new URLSearchParams({
238
238
  token: t || e,
239
239
  token_type_hint: t ? "refresh_token" : "access_token",
240
240
  client_id: r.clientId,
@@ -242,10 +242,10 @@ function Xt(r, e, t, s, o, a) {
242
242
  ui_locales: window.navigator.languages.reduce((i, u) => i + " " + u),
243
243
  ...r.extraLogoutParameters
244
244
  });
245
- s && d.append("id_token_hint", s), o && d.append("state", o), a && d.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${d.toString()}`);
245
+ s && l.append("id_token_hint", s), o && l.append("state", o), a && l.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${l.toString()}`);
246
246
  }
247
247
  function Qt(r) {
248
- const e = r.get("state"), t = sessionStorage.getItem(De);
248
+ const e = r.get("state"), t = sessionStorage.getItem(_e);
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'
@@ -263,7 +263,7 @@ Continuando com o valor padrão.
263
263
  Error: ${u.message}`
264
264
  ), e;
265
265
  }
266
- }), d = (i) => {
266
+ }), l = (i) => {
267
267
  if (i === void 0) {
268
268
  a(i), s.removeItem(r);
269
269
  return;
@@ -280,9 +280,9 @@ Error: ${u.message}`
280
280
  u.storageArea === s && u.key === r && a(JSON.parse(u.newValue ?? ""));
281
281
  };
282
282
  return window.addEventListener("storage", i, !1), () => window.removeEventListener("storage", i, !1);
283
- }), [o, d];
283
+ }), [o, l];
284
284
  }
285
- const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
285
+ const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
286
286
  __proto__: null,
287
287
  default: Z
288
288
  }, Symbol.toStringTag, { value: "Module" }));
@@ -296,21 +296,21 @@ function Zt(r) {
296
296
  decodeToken: s = !0,
297
297
  scope: o = void 0,
298
298
  preLogin: a = () => null,
299
- postLogin: d = () => null,
299
+ postLogin: l = () => null,
300
300
  onRefreshTokenExpire: i = void 0,
301
301
  storage: u = "local"
302
- } = r, y = {
302
+ } = r, m = {
303
303
  ...r,
304
304
  autoLogin: e,
305
305
  clearURL: t,
306
306
  decodeToken: s,
307
307
  scope: o,
308
308
  preLogin: a,
309
- postLogin: d,
309
+ postLogin: l,
310
310
  onRefreshTokenExpire: i,
311
311
  storage: u
312
312
  };
313
- return er(y), y;
313
+ return er(m), m;
314
314
  }
315
315
  function er(r) {
316
316
  if (me(r?.clientId))
@@ -374,16 +374,16 @@ const ge = (r) => {
374
374
  logOut: () => null,
375
375
  error: null,
376
376
  loginInProgress: !1
377
- }), Ur = ({ authConfig: r, children: e }) => {
378
- const t = _t(() => Zt(r), [r]), [s, o] = Z(
377
+ }), Cr = ({ authConfig: r, children: e }) => {
378
+ const t = Je(() => Zt(r), [r]), [s, o] = Z(
379
379
  "ROCP_refreshToken",
380
380
  void 0,
381
381
  t.storage
382
- ), [a, d] = Z(
382
+ ), [a, l] = Z(
383
383
  "ROCP_refreshTokenExpire",
384
384
  oe(2 * ne),
385
385
  t.storage
386
- ), [i, u] = Z("ROCP_token", "", t.storage), [y, k] = Z(
386
+ ), [i, u] = Z("ROCP_token", "", t.storage), [m, b] = Z(
387
387
  "ROCP_tokenExpire",
388
388
  oe(ne),
389
389
  t.storage
@@ -391,37 +391,37 @@ const ge = (r) => {
391
391
  "ROCP_idToken",
392
392
  void 0,
393
393
  t.storage
394
- ), [A, g] = Z(
394
+ ), [E, y] = Z(
395
395
  "ROCP_loginInProgress",
396
396
  !1,
397
397
  t.storage
398
- ), [E, U] = Z(
398
+ ), [x, U] = Z(
399
399
  "ROCP_refreshInProgress",
400
400
  !1,
401
401
  t.storage
402
- ), [D, O] = f(), [_, N] = f(), [x, b] = f(null);
402
+ ), [_, O] = f(), [D, N] = f(), [k, A] = f(null);
403
403
  let P;
404
404
  function W() {
405
- o(void 0), u(""), k(oe(ne)), d(oe(ne)), C(void 0), O(void 0), N(void 0), g(!1);
405
+ o(void 0), u(""), b(oe(ne)), l(oe(ne)), C(void 0), O(void 0), N(void 0), y(!1);
406
406
  }
407
407
  function L(p, n) {
408
- W(), b(null), t?.logoutEndpoint && Xt(t, i, s, h, p, n);
408
+ W(), A(null), t?.logoutEndpoint && Xt(t, i, s, h, p, n);
409
409
  }
410
410
  function B(p) {
411
- W(), g(!0);
411
+ W(), y(!0);
412
412
  let n = p;
413
413
  p && typeof p != "string" && (console.warn(
414
414
  `O estado de login aprovado deve ser do tipo 'string'. Recebido'${p}'. Ignorando o valor...`
415
415
  ), n = void 0), Jt(t, n).catch((w) => {
416
- console.error(w), b(w.message), g(!1);
416
+ console.error(w), A(w.message), y(!1);
417
417
  });
418
418
  }
419
419
  function H(p) {
420
420
  u(p.access_token), o(p.refresh_token);
421
421
  const n = t.tokenExpiresIn ?? p.expires_in ?? ne;
422
- k(oe(n));
422
+ b(oe(n));
423
423
  const w = t.refreshTokenExpiresIn ?? rr(n, p);
424
- d(oe(w)), C(p.id_token);
424
+ l(oe(w)), C(p.id_token);
425
425
  try {
426
426
  p.id_token && N(ge(p.id_token));
427
427
  } catch (c) {
@@ -437,17 +437,17 @@ const ge = (r) => {
437
437
  return p || !t.onRefreshTokenExpire ? B() : t.onRefreshTokenExpire({ login: B });
438
438
  }
439
439
  function $(p = !1) {
440
- if (i && He(y) && !(E && !p)) {
440
+ if (i && He(m) && !(x && !p)) {
441
441
  if (He(a))
442
442
  return Y(p);
443
443
  if (s) {
444
444
  U(!0), Yt({ config: t, refreshToken: s }).then((n) => H(n)).catch((n) => {
445
- if (n instanceof et) {
445
+ if (n instanceof rt) {
446
446
  if (n.status === 400)
447
447
  return Y(p);
448
- console.error(n), b(n.message), p && B();
448
+ console.error(n), A(n.message), p && B();
449
449
  } else
450
- n instanceof Error && (console.error(n), b(n.message), p && B());
450
+ n instanceof Error && (console.error(n), A(n.message), p && B());
451
451
  }).finally(() => {
452
452
  U(!1);
453
453
  });
@@ -458,14 +458,14 @@ const ge = (r) => {
458
458
  );
459
459
  }
460
460
  }
461
- z(() => (P = setInterval(() => $(), 1e4), () => clearInterval(P)), [i, s, a, y]);
462
- const X = Rt(!1);
461
+ z(() => (P = setInterval(() => $(), 1e4), () => clearInterval(P)), [i, s, a, m]);
462
+ const X = Ke(!1);
463
463
  return z(() => {
464
- if (A) {
464
+ if (E) {
465
465
  const p = new URLSearchParams(window.location.search);
466
466
  if (!p.get("code")) {
467
467
  const n = p.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
- console.error(n), b(n), L();
468
+ console.error(n), A(n), L();
469
469
  return;
470
470
  }
471
471
  if (!X.current) {
@@ -473,14 +473,14 @@ const ge = (r) => {
473
473
  try {
474
474
  Qt(p);
475
475
  } catch (n) {
476
- console.error(n), b(n.message);
476
+ console.error(n), A(n.message);
477
477
  }
478
478
  qt(t).then((n) => {
479
479
  H(n), t?.postLogin && t.postLogin();
480
480
  }).catch((n) => {
481
- console.error(n), b(n.message);
481
+ console.error(n), A(n.message);
482
482
  }).finally(() => {
483
- t.clearURL && window.history.replaceState(null, "", window.location.pathname), g(!1);
483
+ t.clearURL && window.history.replaceState(null, "", window.location.pathname), y(!1);
484
484
  });
485
485
  }
486
486
  return;
@@ -498,15 +498,15 @@ const ge = (r) => {
498
498
  console.warn(`Falha ao decodificar o token de acesso: ${p.message}`);
499
499
  }
500
500
  $(!0);
501
- }, []), /* @__PURE__ */ l(
501
+ }, []), /* @__PURE__ */ d(
502
502
  sr.Provider,
503
503
  {
504
- value: { token: i, tokenData: D, idToken: h, idTokenData: _, login: B, logOut: L, error: x, loginInProgress: A },
504
+ value: { token: i, tokenData: _, idToken: h, idTokenData: D, login: B, logOut: L, error: k, loginInProgress: E },
505
505
  children: e
506
506
  }
507
507
  );
508
508
  };
509
- class st {
509
+ class nt {
510
510
  resourceService;
511
511
  resource;
512
512
  actions;
@@ -515,7 +515,7 @@ class st {
515
515
  error;
516
516
  isAdmin;
517
517
  constructor(e, t, s) {
518
- this.resourceService = kt.getContainer().get(G.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
518
+ this.resourceService = Pt.getContainer().get(G.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 });
@@ -629,15 +629,15 @@ class V {
629
629
  return t && (e["X-TENANT-ID"] = t.id), e;
630
630
  }
631
631
  }
632
- function Dr() {
632
+ function Ur() {
633
633
  return V.getInstance();
634
634
  }
635
635
  var ae = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(ae || {}), or = Object.defineProperty, v = (r, e, t, s) => {
636
- for (var o = void 0, a = r.length - 1, d; a >= 0; a--)
637
- (d = r[a]) && (o = d(e, t, o) || o);
636
+ for (var o = void 0, a = r.length - 1, l; a >= 0; a--)
637
+ (l = r[a]) && (o = l(e, t, o) || o);
638
638
  return o && or(e, t, o), o;
639
639
  }, nr = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(nr || {});
640
- const ot = class nt {
640
+ const it = class at {
641
641
  id;
642
642
  code;
643
643
  version;
@@ -650,7 +650,7 @@ const ot = class nt {
650
650
  constructor(e) {
651
651
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new ir(t)) : [];
652
652
  }
653
- static newInstance = () => new nt({
653
+ static newInstance = () => new at({
654
654
  id: K(),
655
655
  intervals: []
656
656
  });
@@ -659,9 +659,9 @@ v([
659
659
  J({
660
660
  message: "archbase:Informe a descrição do cronograma de acesso"
661
661
  })
662
- ], ot.prototype, "description");
663
- let it = ot;
664
- const be = class at {
662
+ ], it.prototype, "description");
663
+ let ct = it;
664
+ const Ae = class lt {
665
665
  id;
666
666
  code;
667
667
  version;
@@ -674,9 +674,9 @@ const be = class at {
674
674
  startTime;
675
675
  endTime;
676
676
  constructor(e) {
677
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.accessSchedule = e.accessSchedule ? new it(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
677
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.accessSchedule = e.accessSchedule ? new ct(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
678
678
  }
679
- static newInstance = () => new at({
679
+ static newInstance = () => new lt({
680
680
  id: K(),
681
681
  dayOfWeek: (/* @__PURE__ */ new Date()).getDay(),
682
682
  startTime: "08:00",
@@ -685,18 +685,18 @@ const be = class at {
685
685
  };
686
686
  v([
687
687
  re()
688
- ], be.prototype, "accessSchedule");
688
+ ], Ae.prototype, "accessSchedule");
689
689
  v([
690
690
  J({
691
691
  message: "archbase:Informe a hora de início"
692
692
  })
693
- ], be.prototype, "startTime");
693
+ ], Ae.prototype, "startTime");
694
694
  v([
695
695
  J({
696
696
  message: "archbase:Informe a hora de término"
697
697
  })
698
- ], be.prototype, "endTime");
699
- let ir = be;
698
+ ], Ae.prototype, "endTime");
699
+ let ir = Ae;
700
700
  class le {
701
701
  id;
702
702
  code;
@@ -725,7 +725,7 @@ v([
725
725
  v([
726
726
  re()
727
727
  ], le.prototype, "actions");
728
- const de = class ct {
728
+ const de = class dt {
729
729
  id;
730
730
  code;
731
731
  version;
@@ -741,9 +741,9 @@ const de = class ct {
741
741
  actionVersion;
742
742
  isNewAction;
743
743
  constructor(e) {
744
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new dt(e.resource) : void 0, this.category = e.category || "", this.active = e.active || !1, this.actionVersion = e.actionVersion || "", this.isNewAction = e.isNewAction || !1;
744
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new ht(e.resource) : void 0, this.category = e.category || "", this.active = e.active || !1, this.actionVersion = e.actionVersion || "", this.isNewAction = e.isNewAction || !1;
745
745
  }
746
- static newInstance = () => new ct({
746
+ static newInstance = () => new dt({
747
747
  id: K(),
748
748
  active: !0,
749
749
  isNewAction: !0
@@ -810,7 +810,7 @@ class he extends le {
810
810
  isNewGroup: !0
811
811
  });
812
812
  }
813
- const Ae = class lt {
813
+ const be = class ut {
814
814
  id;
815
815
  code;
816
816
  version;
@@ -827,7 +827,7 @@ const Ae = class lt {
827
827
  constructor(e) {
828
828
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [], this.active = e.active || !1, this.type = e.type || "VIEW", this.isNewResource = e.isNewResource || !1;
829
829
  }
830
- static newInstance = () => new lt({
830
+ static newInstance = () => new ut({
831
831
  id: K(),
832
832
  actions: [],
833
833
  active: !0,
@@ -838,17 +838,17 @@ v([
838
838
  J({
839
839
  message: "archbase:Informe o nome para o recurso"
840
840
  })
841
- ], Ae.prototype, "name");
841
+ ], be.prototype, "name");
842
842
  v([
843
843
  J({
844
844
  message: "archbase:Informe a descrição para o recurso"
845
845
  })
846
- ], Ae.prototype, "description");
846
+ ], be.prototype, "description");
847
847
  v([
848
848
  q()
849
- ], Ae.prototype, "active");
850
- let dt = Ae;
851
- const M = class ut extends le {
849
+ ], be.prototype, "active");
850
+ let ht = be;
851
+ const M = class pt extends le {
852
852
  userName;
853
853
  password;
854
854
  changePasswordOnNextLogin;
@@ -868,9 +868,9 @@ const M = class ut extends le {
868
868
  type;
869
869
  isNewUser;
870
870
  constructor(e) {
871
- super(e), this.type = ae.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.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new it(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Be(t)) : [], this.profile = e.profile ? new ue(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
871
+ super(e), this.type = ae.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.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new ct(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Be(t)) : [], this.profile = e.profile ? new ue(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
872
872
  }
873
- static newInstance = () => new ut({
873
+ static newInstance = () => new pt({
874
874
  id: K(),
875
875
  userName: "",
876
876
  password: "",
@@ -921,7 +921,7 @@ v([
921
921
  re()
922
922
  ], M.prototype, "profile");
923
923
  v([
924
- It(
924
+ Tt(
925
925
  {},
926
926
  {
927
927
  message: "archbase:Informe um email válido"
@@ -929,7 +929,7 @@ v([
929
929
  )
930
930
  ], M.prototype, "email");
931
931
  let Ee = M;
932
- const Me = class _e {
932
+ const Me = class De {
933
933
  id;
934
934
  code;
935
935
  version;
@@ -943,7 +943,7 @@ const Me = class _e {
943
943
  companyId;
944
944
  projectId;
945
945
  constructor(e) {
946
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? _e.createDtoFromJson(e.security) : void 0, this.action = e.action ? new ar(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
946
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? De.createDtoFromJson(e.security) : void 0, this.action = e.action ? new ar(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
947
947
  }
948
948
  static createDtoFromJson(e) {
949
949
  switch (e.type) {
@@ -957,7 +957,7 @@ const Me = class _e {
957
957
  throw new Error("Unknown DTO type");
958
958
  }
959
959
  }
960
- static newInstance = () => new _e({
960
+ static newInstance = () => new De({
961
961
  id: K(),
962
962
  tenantId: "",
963
963
  companyId: "",
@@ -1020,7 +1020,7 @@ class Le {
1020
1020
  isNewAccessToken: !0
1021
1021
  });
1022
1022
  }
1023
- class ht extends ce {
1023
+ class ft extends ce {
1024
1024
  constructor(e) {
1025
1025
  super(e);
1026
1026
  }
@@ -1047,9 +1047,9 @@ class ht extends ce {
1047
1047
  return this.transform(t);
1048
1048
  }
1049
1049
  }
1050
- I.decorate(I.inject(G.ApiClient), ht, 0);
1051
- I.decorate(I.injectable(), ht);
1052
- class pt extends ce {
1050
+ I.decorate(I.inject(G.ApiClient), ft, 0);
1051
+ I.decorate(I.injectable(), ft);
1052
+ class mt extends ce {
1053
1053
  constructor(e) {
1054
1054
  super(e);
1055
1055
  }
@@ -1069,9 +1069,9 @@ class pt extends ce {
1069
1069
  return e.isNewGroup;
1070
1070
  }
1071
1071
  }
1072
- I.decorate(I.inject(G.ApiClient), pt, 0);
1073
- I.decorate(I.injectable(), pt);
1074
- class ft extends ce {
1072
+ I.decorate(I.inject(G.ApiClient), mt, 0);
1073
+ I.decorate(I.injectable(), mt);
1074
+ class gt extends ce {
1075
1075
  constructor(e) {
1076
1076
  super(e);
1077
1077
  }
@@ -1091,9 +1091,9 @@ class ft extends ce {
1091
1091
  return e.isNewProfile;
1092
1092
  }
1093
1093
  }
1094
- I.decorate(I.inject(G.ApiClient), ft, 0);
1095
- I.decorate(I.injectable(), ft);
1096
- class mt extends ce {
1094
+ I.decorate(I.inject(G.ApiClient), gt, 0);
1095
+ I.decorate(I.injectable(), gt);
1096
+ class yt extends ce {
1097
1097
  constructor(e) {
1098
1098
  super(e);
1099
1099
  }
@@ -1128,9 +1128,9 @@ class mt extends ce {
1128
1128
  );
1129
1129
  }
1130
1130
  }
1131
- I.decorate(I.inject(G.ApiClient), mt, 0);
1132
- I.decorate(I.injectable(), mt);
1133
- class gt extends ce {
1131
+ I.decorate(I.inject(G.ApiClient), yt, 0);
1132
+ I.decorate(I.injectable(), yt);
1133
+ class wt extends ce {
1134
1134
  constructor(e) {
1135
1135
  super(e);
1136
1136
  }
@@ -1157,9 +1157,9 @@ class gt extends ce {
1157
1157
  );
1158
1158
  }
1159
1159
  }
1160
- I.decorate(I.inject(G.ApiClient), gt, 0);
1161
- I.decorate(I.injectable(), gt);
1162
- class yt extends ce {
1160
+ I.decorate(I.inject(G.ApiClient), wt, 0);
1161
+ I.decorate(I.injectable(), wt);
1162
+ class vt extends ce {
1163
1163
  constructor(e) {
1164
1164
  super(e);
1165
1165
  }
@@ -1167,7 +1167,7 @@ class yt extends ce {
1167
1167
  return V.getInstance().getHeaders();
1168
1168
  }
1169
1169
  transform(e) {
1170
- return new dt(e);
1170
+ return new ht(e);
1171
1171
  }
1172
1172
  getEndpoint() {
1173
1173
  return "/api/v1/resource";
@@ -1221,60 +1221,60 @@ class yt extends ce {
1221
1221
  );
1222
1222
  }
1223
1223
  }
1224
- I.decorate(I.inject(G.ApiClient), yt, 0);
1225
- I.decorate(I.injectable(), yt);
1226
- function Rr({
1224
+ I.decorate(I.inject(G.ApiClient), vt, 0);
1225
+ I.decorate(I.injectable(), vt);
1226
+ function Dr({
1227
1227
  onLogin: r,
1228
1228
  error: e,
1229
1229
  onClickForgotPassword: t,
1230
1230
  loginLabel: s = "Email",
1231
1231
  loginPlaceholder: o,
1232
1232
  afterInputs: a,
1233
- showMockUsersSelector: d = !1,
1233
+ showMockUsersSelector: l = !1,
1234
1234
  mockUsers: i = [],
1235
1235
  mockUsersGroupMap: u,
1236
- options: y = {},
1237
- onChangeUsername: k,
1236
+ options: m = {},
1237
+ onChangeUsername: b,
1238
1238
  disabledLogin: h = !1,
1239
1239
  isCheckingUsername: C = !1,
1240
- showSignIn: A = !0
1240
+ showSignIn: E = !0
1241
1241
  }) {
1242
- const g = Ye(), {
1243
- username: E,
1242
+ const y = Qe(), {
1243
+ username: x,
1244
1244
  password: U,
1245
- rememberMe: D,
1245
+ rememberMe: _,
1246
1246
  clearRememberMe: O
1247
- } = Pt(), [_, N] = f(E), [x, b] = f(U), [P, W] = f(D), [L, B] = f(!1), [H, Y] = f(null);
1247
+ } = Ct(), [D, N] = f(x), [k, A] = f(U), [P, W] = f(_), [L, B] = f(!1), [H, Y] = f(null);
1248
1248
  z(() => {
1249
1249
  B(!!e);
1250
1250
  }, [e]), z(() => {
1251
- E !== _ && (N(E), k?.(E)), U !== x && b(U), D !== P && W(D);
1252
- }, [E, U, D]);
1251
+ x !== D && (N(x), b?.(x)), U !== k && A(U), _ !== P && W(_);
1252
+ }, [x, U, _]);
1253
1253
  const $ = () => {
1254
1254
  B(!1);
1255
1255
  }, X = () => {
1256
- _ && x && r(_, x, P).finally(() => B(!0));
1256
+ D && k && r(D, k, P).finally(() => B(!0));
1257
1257
  }, p = () => {
1258
1258
  if (!u)
1259
- return i.map((m) => ({
1260
- value: m.email,
1261
- label: m.email
1259
+ return i.map((g) => ({
1260
+ value: g.email,
1261
+ label: g.email
1262
1262
  }));
1263
- const c = i.reduce((m, T) => {
1263
+ const c = i.reduce((g, T) => {
1264
1264
  const j = u[T.type];
1265
- return j && (m[j] || (m[j] = []), m[j].push({
1265
+ return j && (g[j] || (g[j] = []), g[j].push({
1266
1266
  value: T.email,
1267
1267
  label: T.email
1268
- })), m;
1268
+ })), g;
1269
1269
  }, {});
1270
- return Object.entries(c).map(([m, T]) => ({
1271
- group: m,
1270
+ return Object.entries(c).map(([g, T]) => ({
1271
+ group: g,
1272
1272
  items: T
1273
1273
  }));
1274
1274
  }, n = () => {
1275
1275
  if (H) {
1276
- const c = i.find((m) => m.email === H);
1277
- c && (N(c.email), b(c.password), $());
1276
+ const c = i.find((g) => g.email === H);
1277
+ c && (N(c.email), A(c.password), $());
1278
1278
  }
1279
1279
  }, w = {
1280
1280
  withBorder: !0,
@@ -1283,17 +1283,17 @@ function Rr({
1283
1283
  mt: 30,
1284
1284
  radius: "md",
1285
1285
  w: 400,
1286
- ...y.cardProps
1286
+ ...m.cardProps
1287
1287
  };
1288
1288
  return /* @__PURE__ */ R(
1289
- Ke,
1289
+ Ye,
1290
1290
  {
1291
1291
  ...w,
1292
1292
  pos: "relative",
1293
- ref: g,
1293
+ ref: y,
1294
1294
  children: [
1295
- A && /* @__PURE__ */ R(te, { children: [
1296
- /* @__PURE__ */ l(
1295
+ E && /* @__PURE__ */ R(te, { children: [
1296
+ /* @__PURE__ */ d(
1297
1297
  se,
1298
1298
  {
1299
1299
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
@@ -1304,12 +1304,12 @@ function Rr({
1304
1304
  children: S().t("archbase:signIn")
1305
1305
  }
1306
1306
  ),
1307
- /* @__PURE__ */ l(ye, { m: "md" })
1307
+ /* @__PURE__ */ d(ye, { m: "md" })
1308
1308
  ] }),
1309
- y?.customContentBefore,
1310
- d && /* @__PURE__ */ R(te, { children: [
1309
+ m?.customContentBefore,
1310
+ l && /* @__PURE__ */ R(te, { children: [
1311
1311
  /* @__PURE__ */ R(we, { gap: "sm", mb: "md", children: [
1312
- /* @__PURE__ */ l(
1312
+ /* @__PURE__ */ d(
1313
1313
  Nt,
1314
1314
  {
1315
1315
  placeholder: "Selecione um usuário mock",
@@ -1321,7 +1321,7 @@ function Rr({
1321
1321
  style: { flexGrow: 1 }
1322
1322
  }
1323
1323
  ),
1324
- /* @__PURE__ */ l(Bt, { label: "Aplicar", children: /* @__PURE__ */ l(
1324
+ /* @__PURE__ */ d(Bt, { label: "Aplicar", children: /* @__PURE__ */ d(
1325
1325
  ie,
1326
1326
  {
1327
1327
  variant: "light",
@@ -1329,51 +1329,51 @@ function Rr({
1329
1329
  onClick: n,
1330
1330
  disabled: !H,
1331
1331
  "aria-label": "Aplicar usuário mock selecionado",
1332
- children: /* @__PURE__ */ l(Ft, { size: 16 })
1332
+ children: /* @__PURE__ */ d(Ft, { size: 16 })
1333
1333
  }
1334
1334
  ) })
1335
1335
  ] }),
1336
- /* @__PURE__ */ l(ye, { mb: "md" })
1336
+ /* @__PURE__ */ d(ye, { mb: "md" })
1337
1337
  ] }),
1338
- /* @__PURE__ */ l(
1338
+ /* @__PURE__ */ d(
1339
1339
  Ce,
1340
1340
  {
1341
1341
  label: s,
1342
1342
  placeholder: o ?? S().t("archbase:usuario@email.com"),
1343
- rightSection: C ? /* @__PURE__ */ l(qe, { size: "xs" }) : null,
1344
- value: _ || "",
1343
+ rightSection: C ? /* @__PURE__ */ d(Xe, { size: "xs" }) : null,
1344
+ value: D || "",
1345
1345
  required: !0,
1346
1346
  onChange: (c) => {
1347
- N(c.currentTarget.value), k?.(c.currentTarget.value), $();
1347
+ N(c.currentTarget.value), b?.(c.currentTarget.value), $();
1348
1348
  }
1349
1349
  }
1350
1350
  ),
1351
- /* @__PURE__ */ l(
1351
+ /* @__PURE__ */ d(
1352
1352
  Ue,
1353
1353
  {
1354
1354
  label: S().t("archbase:Password"),
1355
1355
  placeholder: S().t("archbase:Sua senha"),
1356
1356
  onChange: (c) => {
1357
- b(c.currentTarget.value), $();
1357
+ A(c.currentTarget.value), $();
1358
1358
  },
1359
- value: x || "",
1359
+ value: k || "",
1360
1360
  required: !0,
1361
1361
  mt: "md"
1362
1362
  }
1363
1363
  ),
1364
1364
  /* @__PURE__ */ R(we, { justify: "space-between", mt: "md", children: [
1365
- /* @__PURE__ */ l(
1365
+ /* @__PURE__ */ d(
1366
1366
  Mt,
1367
1367
  {
1368
1368
  label: S().t("archbase:Lembre-me"),
1369
1369
  checked: P,
1370
1370
  onChange: (c) => {
1371
- const m = c.currentTarget.checked;
1372
- W(m), m || O();
1371
+ const g = c.currentTarget.checked;
1372
+ W(g), g || O();
1373
1373
  }
1374
1374
  }
1375
1375
  ),
1376
- t && /* @__PURE__ */ l(
1376
+ t && /* @__PURE__ */ d(
1377
1377
  Ot,
1378
1378
  {
1379
1379
  component: "button",
@@ -1386,19 +1386,19 @@ function Rr({
1386
1386
  }
1387
1387
  )
1388
1388
  ] }),
1389
- y?.afterInputs || a,
1390
- /* @__PURE__ */ l(
1389
+ m?.afterInputs || a,
1390
+ /* @__PURE__ */ d(
1391
1391
  ie,
1392
1392
  {
1393
- disabled: !x || !_ || h,
1393
+ disabled: !k || !D || h,
1394
1394
  fullWidth: !0,
1395
1395
  mt: "xl",
1396
1396
  onClick: X,
1397
1397
  children: S().t("archbase:signIn")
1398
1398
  }
1399
1399
  ),
1400
- y?.customContentAfter,
1401
- L && e && /* @__PURE__ */ l(se, { c: "red", mt: "sm", children: e })
1400
+ m?.customContentAfter,
1401
+ L && e && /* @__PURE__ */ d(se, { c: "red", mt: "sm", children: e })
1402
1402
  ]
1403
1403
  }
1404
1404
  );
@@ -1410,42 +1410,42 @@ const cr = {
1410
1410
  padding: 30,
1411
1411
  marginTop: 30
1412
1412
  };
1413
- function Nr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: d = "", description: i, style: u }) {
1414
- const y = Ye(), k = Tt(), { colorScheme: h } = Lt(), [C, A] = f(r ?? ""), [g, E] = f(d), [U, D] = f(""), [O, _] = f(""), [N, x] = f(""), [b, P] = f(!1), [W, L] = f(""), [B, H] = f(""), [Y, $] = f(""), [X, p] = f("");
1413
+ function Rr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: l = "", description: i, style: u }) {
1414
+ const m = Qe(), b = Ut(), { colorScheme: h } = Lt(), [C, E] = f(r ?? ""), [y, x] = f(l), [U, _] = f(""), [O, D] = f(""), [N, k] = f(""), [A, P] = f(!1), [W, L] = f(""), [B, H] = f(""), [Y, $] = f(""), [X, p] = f("");
1415
1415
  async function n(c) {
1416
- c && (Ct(c) ? await e(c).then(() => {
1416
+ c && (_t(c) ? await e(c).then(() => {
1417
1417
  We.showSuccess(`${S().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), P(!0);
1418
1418
  }).catch(() => {
1419
1419
  }) : L(`${S().t("archbase:Email inválido")}`));
1420
1420
  }
1421
- async function w(c, m, T, j) {
1422
- if (c && m && T) {
1423
- let xe = "", Se = "", Fe = "";
1424
- a && (xe = a(), $(xe)), o && (Se = o(), $(Se)), T !== j && (Fe = `${S().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, p(Fe)), !Se && !xe && await t(c, m, T).then(() => {
1421
+ async function w(c, g, T, j) {
1422
+ if (c && g && T) {
1423
+ let xe = "", ke = "", Fe = "";
1424
+ a && (xe = a(), $(xe)), o && (ke = o(), $(ke)), T !== j && (Fe = `${S().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, p(Fe)), !ke && !xe && await t(c, g, T).then(() => {
1425
1425
  We.showSuccess(`${S().t("archbase:Senha redefinida com sucesso.")}`), s(), P(!1);
1426
1426
  }).catch(() => {
1427
- A(r || `${S().t("archbase:Erro ao redefinir senha.")}`);
1427
+ E(r || `${S().t("archbase:Erro ao redefinir senha.")}`);
1428
1428
  });
1429
1429
  }
1430
1430
  }
1431
1431
  return z(() => {
1432
- r && A(r);
1432
+ r && E(r);
1433
1433
  }, [r]), z(() => {
1434
- A("");
1435
- }, [g, U, O, N]), /* @__PURE__ */ R(
1436
- Ke,
1434
+ E("");
1435
+ }, [y, U, O, N]), /* @__PURE__ */ R(
1436
+ Ye,
1437
1437
  {
1438
1438
  withBorder: !0,
1439
1439
  shadow: "md",
1440
1440
  radius: "md",
1441
- ref: y,
1441
+ ref: m,
1442
1442
  style: {
1443
1443
  ...cr,
1444
1444
  ...u
1445
1445
  },
1446
1446
  children: [
1447
- b ? /* @__PURE__ */ R(te, { children: [
1448
- /* @__PURE__ */ l(
1447
+ A ? /* @__PURE__ */ R(te, { children: [
1448
+ /* @__PURE__ */ d(
1449
1449
  se,
1450
1450
  {
1451
1451
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
@@ -1456,8 +1456,8 @@ function Nr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1456
1456
  children: S().t("archbase:Redefinir senha")
1457
1457
  }
1458
1458
  ),
1459
- /* @__PURE__ */ l(ye, { m: "xs" }),
1460
- /* @__PURE__ */ l(
1459
+ /* @__PURE__ */ d(ye, { m: "xs" }),
1460
+ /* @__PURE__ */ d(
1461
1461
  Ce,
1462
1462
  {
1463
1463
  label: S().t("archbase:Código de segurança"),
@@ -1465,53 +1465,53 @@ function Nr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1465
1465
  value: U || "",
1466
1466
  required: !0,
1467
1467
  onChange: (c) => {
1468
- D(c.currentTarget.value), H("");
1468
+ _(c.currentTarget.value), H("");
1469
1469
  },
1470
1470
  error: B
1471
1471
  }
1472
1472
  ),
1473
- /* @__PURE__ */ l(
1473
+ /* @__PURE__ */ d(
1474
1474
  Ue,
1475
1475
  {
1476
1476
  label: S().t("archbase:Nova senha"),
1477
1477
  placeholder: S().t("archbase:Nova senha"),
1478
1478
  onChange: (c) => {
1479
- _(c.currentTarget.value), $(""), p("");
1479
+ D(c.currentTarget.value), $(""), p("");
1480
1480
  },
1481
1481
  value: O,
1482
1482
  required: !0,
1483
1483
  error: Y
1484
1484
  }
1485
1485
  ),
1486
- /* @__PURE__ */ l(
1486
+ /* @__PURE__ */ d(
1487
1487
  Ue,
1488
1488
  {
1489
1489
  label: S().t("archbase:Confirmar senha"),
1490
1490
  placeholder: S().t("archbase:Confirmar senha"),
1491
1491
  onChange: (c) => {
1492
- x(c.currentTarget.value), p("");
1492
+ k(c.currentTarget.value), p("");
1493
1493
  },
1494
1494
  value: N || "",
1495
1495
  required: !0,
1496
1496
  error: X
1497
1497
  }
1498
1498
  ),
1499
- /* @__PURE__ */ l(
1499
+ /* @__PURE__ */ d(
1500
1500
  ie,
1501
1501
  {
1502
- disabled: !g || !U || !O || !N,
1502
+ disabled: !y || !U || !O || !N,
1503
1503
  mt: "md",
1504
1504
  fullWidth: !0,
1505
- onClick: () => w(g, U, O, N),
1505
+ onClick: () => w(y, U, O, N),
1506
1506
  children: `${S().t("archbase:Redefinir senha")}`
1507
1507
  }
1508
1508
  ),
1509
- /* @__PURE__ */ l(
1509
+ /* @__PURE__ */ d(
1510
1510
  ie,
1511
1511
  {
1512
1512
  mt: "6px",
1513
1513
  fullWidth: !0,
1514
- color: h === "dark" ? k.colors.dark[4] : k.colors.gray[7],
1514
+ color: h === "dark" ? b.colors.dark[4] : b.colors.gray[7],
1515
1515
  onClick: () => {
1516
1516
  W || P(!1);
1517
1517
  },
@@ -1519,7 +1519,7 @@ function Nr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1519
1519
  }
1520
1520
  )
1521
1521
  ] }) : /* @__PURE__ */ R(te, { children: [
1522
- /* @__PURE__ */ l(
1522
+ /* @__PURE__ */ d(
1523
1523
  se,
1524
1524
  {
1525
1525
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
@@ -1530,55 +1530,64 @@ function Nr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1530
1530
  children: S().t("archbase:Redefinir senha")
1531
1531
  }
1532
1532
  ),
1533
- /* @__PURE__ */ l(se, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1534
- /* @__PURE__ */ l(ye, { m: "md" }),
1535
- /* @__PURE__ */ l(
1533
+ /* @__PURE__ */ d(se, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1534
+ /* @__PURE__ */ d(ye, { m: "md" }),
1535
+ /* @__PURE__ */ d(
1536
1536
  Ce,
1537
1537
  {
1538
1538
  label: "Email",
1539
1539
  placeholder: `${S().t("archbase:usuario@email.com")}`,
1540
- value: g || "",
1540
+ value: y || "",
1541
1541
  required: !0,
1542
1542
  onChange: (c) => {
1543
- E(c.currentTarget.value), L("");
1543
+ x(c.currentTarget.value), L("");
1544
1544
  },
1545
1545
  error: W
1546
1546
  }
1547
1547
  ),
1548
- /* @__PURE__ */ l(
1548
+ /* @__PURE__ */ d(
1549
1549
  ie,
1550
1550
  {
1551
- disabled: !g,
1551
+ disabled: !y,
1552
1552
  mt: "md",
1553
1553
  fullWidth: !0,
1554
- onClick: () => n(g),
1554
+ onClick: () => n(y),
1555
1555
  children: `${S().t("archbase:Enviar")}`
1556
1556
  }
1557
1557
  ),
1558
- /* @__PURE__ */ l(
1558
+ /* @__PURE__ */ d(
1559
1559
  ie,
1560
1560
  {
1561
1561
  mt: "6px",
1562
1562
  fullWidth: !0,
1563
- color: h === "dark" ? k.colors.dark[4] : k.colors.gray[7],
1563
+ color: h === "dark" ? b.colors.dark[4] : b.colors.gray[7],
1564
1564
  onClick: () => s && s(),
1565
1565
  children: `${S().t("archbase:Voltar")}`
1566
1566
  }
1567
1567
  )
1568
1568
  ] }),
1569
- C ? /* @__PURE__ */ l(se, { c: "red", style: { textAlign: "justify" }, children: C }) : null
1569
+ C ? /* @__PURE__ */ d(se, { c: "red", style: { textAlign: "justify" }, children: C }) : null
1570
1570
  ]
1571
1571
  }
1572
1572
  );
1573
1573
  }
1574
- const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t, s) => r && r.existsValue(e) ? r.getValue(e) : new st(e, t, s), Br = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1575
- const s = Je(wt), o = lr(), [a, d] = f({
1576
- securityManager: t && dr(s, r, e, o.isAdmin)
1577
- });
1574
+ const lr = () => Dt().user, At = "archbaseSecurityManagerStore", Nr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1575
+ const s = qe(At), o = lr(), a = o?.isAdmin ?? !1, l = o?.id, i = Ke(l), u = Je(() => {
1576
+ if (!t)
1577
+ return null;
1578
+ const m = l ? `${r}_${l}` : r;
1579
+ if (s && s.existsValue(m)) {
1580
+ const h = s.getValue(m);
1581
+ if (h && h.isAdmin === a)
1582
+ return h;
1583
+ }
1584
+ const b = new nt(r, e, a);
1585
+ return s && l && s.setValue(m, b), b;
1586
+ }, [t, r, e, a, l]);
1578
1587
  return z(() => {
1579
- t && s.setValue(r, a.securityManager);
1580
- }, [r]), { securityManager: a.securityManager };
1581
- }, Mr = ({
1588
+ i.current = l;
1589
+ }, [l]), { securityManager: u };
1590
+ }, Br = ({
1582
1591
  checkIntervalTokenHasExpired: r = 3e4,
1583
1592
  // Verificar a 30 segundos
1584
1593
  expirationThresholdOfToken: e = 300
@@ -1588,7 +1597,7 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1588
1597
  (n) => n.get(G.TokenManager)
1589
1598
  ), s = ve(
1590
1599
  (n) => n.get(G.Authenticator)
1591
- ), [o, a] = f(null), [d, i] = f(!1), [u, y] = f(!0), [k, h] = f(!1), [C, A] = f(!1), [g, E] = f(""), [U, D] = f(""), [O, _] = f(null), N = Je(wt), x = {
1600
+ ), [o, a] = f(null), [l, i] = f(!1), [u, m] = f(!0), [b, h] = f(!1), [C, E] = f(!1), [y, x] = f(""), [U, _] = f(""), [O, D] = f(null), N = qe(At), k = {
1592
1601
  hasContextualLogin: typeof s.loginWithContext == "function",
1593
1602
  hasFlexibleLogin: typeof s.loginFlexible == "function",
1594
1603
  hasSocialLogin: typeof s.loginSocial == "function",
@@ -1597,82 +1606,82 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1597
1606
  };
1598
1607
  z(() => {
1599
1608
  const n = t.getUsername();
1600
- if (n && n != "" && D(n), x.hasContextSupport && t.getContext) {
1609
+ if (n && n != "" && _(n), k.hasContextSupport && t.getContext) {
1601
1610
  const c = t.getContext();
1602
1611
  if (c)
1603
1612
  try {
1604
- const m = typeof c == "string" ? JSON.parse(c) : c;
1605
- _(m);
1606
- } catch (m) {
1607
- console.warn("Erro ao carregar contexto salvo:", m);
1613
+ const g = typeof c == "string" ? JSON.parse(c) : c;
1614
+ D(g);
1615
+ } catch (g) {
1616
+ console.warn("Erro ao carregar contexto salvo:", g);
1608
1617
  }
1609
1618
  }
1610
1619
  const w = t.getToken();
1611
- w && (h(!0), E(""), A(!1), a(w)), y(!1);
1620
+ w && (h(!0), x(""), E(!1), a(w)), m(!1);
1612
1621
  }, []);
1613
- const b = () => {
1614
- A(!1), E("");
1622
+ const A = () => {
1623
+ E(!1), x("");
1615
1624
  }, P = (n) => {
1616
- i(!1), h(!1), t.clearToken(), n && t.clearUsernameAndPassword(), x.hasContextSupport && t.clearContext && t.clearContext(), D(""), _(null), E(""), A(!1), N.clearAllValues();
1625
+ i(!1), h(!1), t.clearToken(), n && t.clearUsernameAndPassword(), k.hasContextSupport && t.clearContext && t.clearContext(), _(""), D(null), x(""), E(!1), N.clearAllValues();
1617
1626
  }, W = async (n, w, c) => {
1618
1627
  try {
1619
1628
  i(!0), h(!1);
1620
- const m = await s.login(n, w);
1621
- t.saveToken(m), c && t.saveUsernameAndPassword(n, w), t.saveUsername(n), D(n), a(m), i(!1), h(!0);
1622
- } catch (m) {
1623
- i(!1), h(!1), E(ee(m)), A(!0);
1629
+ const g = await s.login(n, w);
1630
+ t.saveToken(g), c && t.saveUsernameAndPassword(n, w), t.saveUsername(n), _(n), a(g), i(!1), h(!0);
1631
+ } catch (g) {
1632
+ i(!1), h(!1), x(ee(g)), E(!0);
1624
1633
  }
1625
1634
  }, L = async (n, w = !1) => {
1626
- if (!x.hasContextualLogin || !s.loginWithContext)
1635
+ if (!k.hasContextualLogin || !s.loginWithContext)
1627
1636
  throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
1628
1637
  try {
1629
1638
  i(!0), h(!1);
1630
- const { context: c, user: m, ...T } = await s.loginWithContext(n), j = {
1639
+ const { context: c, user: g, ...T } = await s.loginWithContext(n), j = {
1631
1640
  scope: "",
1632
1641
  ext_expires_in: T.expires_in,
1633
1642
  ...T
1634
1643
  };
1635
- t.saveToken(j), w ? t.saveUsernameAndPassword(n.email, n.password) : t.clearUsernameAndPassword(), t.saveUsername(n.email), x.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), _(c)), D(n.email), a(j), i(!1), h(!0);
1644
+ t.saveToken(j), w ? t.saveUsernameAndPassword(n.email, n.password) : t.clearUsernameAndPassword(), t.saveUsername(n.email), k.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), D(c)), _(n.email), a(j), i(!1), h(!0);
1636
1645
  } catch (c) {
1637
- throw i(!1), h(!1), E(ee(c)), A(!0), c;
1646
+ throw i(!1), h(!1), x(ee(c)), E(!0), c;
1638
1647
  }
1639
1648
  }, B = async (n, w = !1) => {
1640
- if (!x.hasFlexibleLogin || !s.loginFlexible)
1649
+ if (!k.hasFlexibleLogin || !s.loginFlexible)
1641
1650
  throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
1642
1651
  try {
1643
1652
  i(!0), h(!1);
1644
- const { context: c, user: m, ...T } = await s.loginFlexible(n), j = {
1653
+ const { context: c, user: g, ...T } = await s.loginFlexible(n), j = {
1645
1654
  scope: "",
1646
1655
  ext_expires_in: T.expires_in,
1647
1656
  ...T
1648
1657
  };
1649
- t.saveToken(j), w && t.saveUsernameAndPassword(n.identifier, n.password), t.saveUsername(m.email || n.identifier), x.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), _(c)), D(m.email || n.identifier), a(j), i(!1), h(!0);
1658
+ t.saveToken(j), w && t.saveUsernameAndPassword(n.identifier, n.password), t.saveUsername(g.email || n.identifier), k.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), D(c)), _(g.email || n.identifier), a(j), i(!1), h(!0);
1650
1659
  } catch (c) {
1651
- throw i(!1), h(!1), E(ee(c)), A(!0), c;
1660
+ throw i(!1), h(!1), x(ee(c)), E(!0), c;
1652
1661
  }
1653
1662
  }, H = async (n) => {
1654
- if (!x.hasSocialLogin || !s.loginSocial)
1663
+ if (!k.hasSocialLogin || !s.loginSocial)
1655
1664
  throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
1656
1665
  try {
1657
1666
  i(!0), h(!1);
1658
- const { context: w, user: c, ...m } = await s.loginSocial(n), T = {
1667
+ const { context: w, user: c, ...g } = await s.loginSocial(n), T = {
1659
1668
  scope: "",
1660
- ext_expires_in: m.expires_in,
1661
- ...m
1669
+ ext_expires_in: g.expires_in,
1670
+ ...g
1662
1671
  };
1663
- t.saveToken(T), t.saveUsername(c.email), x.hasContextSupport && t.saveContext && w && (t.saveContext(JSON.stringify(w)), _(w)), D(c.email), a(T), i(!1), h(!0);
1672
+ t.saveToken(T), t.saveUsername(c.email), k.hasContextSupport && t.saveContext && w && (t.saveContext(JSON.stringify(w)), D(w)), _(c.email), a(T), i(!1), h(!0);
1664
1673
  } catch (w) {
1665
- throw i(!1), h(!1), E(ee(w)), A(!0), w;
1674
+ throw i(!1), h(!1), x(ee(w)), E(!0), w;
1666
1675
  }
1667
1676
  }, Y = async (n) => {
1668
- if (!x.hasRegistration || !s.register)
1677
+ if (!k.hasRegistration || !s.register)
1669
1678
  throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
1670
1679
  try {
1671
1680
  i(!0);
1672
1681
  const w = await s.register(n);
1673
1682
  return i(!1), w;
1674
1683
  } catch (w) {
1675
- throw i(!1), E(ee(w)), A(!0), w;
1684
+ throw i(!1), x(ee(w)), E(!0), w;
1676
1685
  }
1677
1686
  }, $ = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, X = async (n) => s.validateContext ? await s.validateContext(n) : { context: n, supported: n === "DEFAULT" };
1678
1687
  z(() => {
@@ -1697,26 +1706,26 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1697
1706
  login: W,
1698
1707
  logout: P,
1699
1708
  username: U,
1700
- isAuthenticated: k,
1701
- isAuthenticating: d,
1709
+ isAuthenticated: b,
1710
+ isAuthenticating: l,
1702
1711
  isInitializing: u,
1703
1712
  isError: C,
1704
- error: g,
1705
- clearError: b,
1713
+ error: y,
1714
+ clearError: A,
1706
1715
  accessToken: o ? o.access_token : null,
1707
1716
  // Métodos opcionais para autenticação avançada
1708
- loginWithContext: x.hasContextualLogin ? L : void 0,
1709
- loginFlexible: x.hasFlexibleLogin ? B : void 0,
1710
- loginSocial: x.hasSocialLogin ? H : void 0,
1711
- register: x.hasRegistration ? Y : void 0,
1717
+ loginWithContext: k.hasContextualLogin ? L : void 0,
1718
+ loginFlexible: k.hasFlexibleLogin ? B : void 0,
1719
+ loginSocial: k.hasSocialLogin ? H : void 0,
1720
+ register: k.hasRegistration ? Y : void 0,
1712
1721
  getSupportedContexts: $,
1713
1722
  validateContext: X,
1714
1723
  // Informações de contexto
1715
1724
  context: O,
1716
1725
  // Detecção de capacidades
1717
- capabilities: x
1726
+ capabilities: k
1718
1727
  };
1719
- }, Or = () => {
1728
+ }, Mr = () => {
1720
1729
  const r = ve(
1721
1730
  (s) => s.get(G.TokenManager)
1722
1731
  ), [e, t] = f(null);
@@ -1726,7 +1735,7 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1726
1735
  }, []), {
1727
1736
  token: e
1728
1737
  };
1729
- }, Lr = () => {
1738
+ }, Or = () => {
1730
1739
  const r = ve(
1731
1740
  (u) => u.get(G.Authenticator)
1732
1741
  ), [e, t] = f(!1), [s, o] = f("");
@@ -1734,13 +1743,13 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1734
1743
  sendResetPasswordEmail: async (u) => {
1735
1744
  try {
1736
1745
  return await r.sendResetPasswordEmail(u);
1737
- } catch (y) {
1738
- throw o(ee(y)), t(!0), y;
1746
+ } catch (m) {
1747
+ throw o(ee(m)), t(!0), m;
1739
1748
  }
1740
1749
  },
1741
- resetPassword: async (u, y, k) => {
1750
+ resetPassword: async (u, m, b) => {
1742
1751
  try {
1743
- return await r.resetPassword(u, y, k);
1752
+ return await r.resetPassword(u, m, b);
1744
1753
  } catch (h) {
1745
1754
  throw o(ee(h)), t(!0), h;
1746
1755
  }
@@ -1751,116 +1760,116 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1751
1760
  t(!1), o("");
1752
1761
  }
1753
1762
  };
1754
- }, ur = () => /* @__PURE__ */ l($t, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ R(jt, { gap: "md", children: [
1763
+ }, dr = () => /* @__PURE__ */ d($t, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ R(jt, { gap: "md", children: [
1755
1764
  /* @__PURE__ */ R(we, { gap: "sm", children: [
1756
- /* @__PURE__ */ l(qe, { size: "sm" }),
1757
- /* @__PURE__ */ l(se, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
1765
+ /* @__PURE__ */ d(Xe, { size: "sm" }),
1766
+ /* @__PURE__ */ d(se, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
1758
1767
  ] }),
1759
- /* @__PURE__ */ l(fe, { height: 40, radius: "sm" }),
1760
- /* @__PURE__ */ l(fe, { height: 200, radius: "sm" }),
1768
+ /* @__PURE__ */ d(fe, { height: 40, radius: "sm" }),
1769
+ /* @__PURE__ */ d(fe, { height: 200, radius: "sm" }),
1761
1770
  /* @__PURE__ */ R(we, { gap: "md", children: [
1762
- /* @__PURE__ */ l(fe, { height: 36, width: 100, radius: "sm" }),
1763
- /* @__PURE__ */ l(fe, { height: 36, width: 100, radius: "sm" })
1771
+ /* @__PURE__ */ d(fe, { height: 36, width: 100, radius: "sm" }),
1772
+ /* @__PURE__ */ d(fe, { height: 36, width: 100, radius: "sm" })
1764
1773
  ] })
1765
- ] }) }), $e = Re(null), $r = ({
1774
+ ] }) }), $e = Re(null), Lr = ({
1766
1775
  children: r,
1767
1776
  user: e,
1768
1777
  onError: t
1769
1778
  }) => {
1770
- const [s, o] = f(!1), [a, d] = f(null), [i] = f([]), u = e?.isAdministrator || !1, y = pe((g) => u ? !0 : i.includes(g), [i, u]), k = pe((g) => u ? !0 : g.some((E) => i.includes(E)), [i, u]), h = pe((g) => u ? !0 : g.every((E) => i.includes(E)), [i, u]), C = pe((g) => {
1771
- d(g), g && t && t(g);
1772
- }, [t]), A = {
1779
+ const [s, o] = f(!1), [a, l] = f(null), [i] = f([]), u = e?.isAdministrator || !1, m = pe((y) => u ? !0 : i.includes(y), [i, u]), b = pe((y) => u ? !0 : y.some((x) => i.includes(x)), [i, u]), h = pe((y) => u ? !0 : y.every((x) => i.includes(x)), [i, u]), C = pe((y) => {
1780
+ l(y), y && t && t(y);
1781
+ }, [t]), E = {
1773
1782
  user: e,
1774
1783
  isLoading: s,
1775
- hasGlobalPermission: y,
1776
- hasAnyGlobalPermission: k,
1784
+ hasGlobalPermission: m,
1785
+ hasAnyGlobalPermission: b,
1777
1786
  hasAllGlobalPermissions: h,
1778
1787
  isAdmin: u,
1779
1788
  error: a,
1780
1789
  setError: C
1781
1790
  };
1782
- return /* @__PURE__ */ l($e.Provider, { value: A, children: r });
1783
- }, vt = Re(null), hr = ({
1791
+ return /* @__PURE__ */ d($e.Provider, { value: E, children: r });
1792
+ }, bt = Re(null), ur = ({
1784
1793
  children: r,
1785
1794
  resourceName: e,
1786
1795
  resourceDescription: t,
1787
1796
  requiredPermissions: s = [],
1788
1797
  fallbackComponent: o,
1789
1798
  loadingComponent: a,
1790
- onSecurityReady: d,
1799
+ onSecurityReady: l,
1791
1800
  onError: i
1792
1801
  }) => {
1793
1802
  const u = Ne($e);
1794
1803
  if (!u)
1795
1804
  throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
1796
- const { user: y, isAdmin: k } = u, [h, C] = f(null), [A, g] = f(!0), [E, U] = f(null);
1805
+ const { user: m, isAdmin: b } = u, [h, C] = f(null), [E, y] = f(!0), [x, U] = f(null);
1797
1806
  if (Ge.useEffect(() => {
1798
- if (!y) {
1799
- g(!1);
1807
+ if (!m) {
1808
+ y(!1);
1800
1809
  return;
1801
1810
  }
1802
- const b = new st(e, t, k);
1811
+ const A = new nt(e, t, b);
1803
1812
  (async () => {
1804
- g(!0);
1813
+ y(!0);
1805
1814
  try {
1806
- await b.apply(() => {
1807
- C(b), g(!1), d && d(b);
1815
+ await A.apply(() => {
1816
+ C(A), y(!1), l && l(A);
1808
1817
  });
1809
1818
  } catch {
1810
- const L = b.getError() || "Erro ao carregar permissões";
1811
- U(L), g(!1), i && i(L);
1819
+ const L = A.getError() || "Erro ao carregar permissões";
1820
+ U(L), y(!1), i && i(L);
1812
1821
  }
1813
1822
  })();
1814
- }, [e, t, y, k, d, i]), A)
1815
- return a ? /* @__PURE__ */ l(te, { children: a }) : /* @__PURE__ */ l(ur, {});
1816
- if (E)
1817
- return /* @__PURE__ */ l("div", { className: "archbase-security-error", children: /* @__PURE__ */ R("div", { children: [
1823
+ }, [e, t, m, b, l, i]), E)
1824
+ return a ? /* @__PURE__ */ d(te, { children: a }) : /* @__PURE__ */ d(dr, {});
1825
+ if (x)
1826
+ return /* @__PURE__ */ d("div", { className: "archbase-security-error", children: /* @__PURE__ */ R("div", { children: [
1818
1827
  "Erro ao carregar permissões: ",
1819
- E
1828
+ x
1820
1829
  ] }) });
1821
- if (!y)
1822
- return o || /* @__PURE__ */ l("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ l("div", { children: "É necessário fazer login para acessar esta área" }) });
1830
+ if (!m)
1831
+ return o || /* @__PURE__ */ d("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ d("div", { children: "É necessário fazer login para acessar esta área" }) });
1823
1832
  if (s.length > 0 && h && !s.every(
1824
1833
  (P) => h.hasPermission(P)
1825
1834
  ))
1826
1835
  return o || /* @__PURE__ */ R("div", { className: "archbase-security-access-denied", children: [
1827
- /* @__PURE__ */ l("div", { children: "Você não possui permissão para acessar esta área" }),
1836
+ /* @__PURE__ */ d("div", { children: "Você não possui permissão para acessar esta área" }),
1828
1837
  /* @__PURE__ */ R("small", { children: [
1829
1838
  "Permissões necessárias: ",
1830
1839
  s.join(", ")
1831
1840
  ] })
1832
1841
  ] });
1833
- const x = {
1842
+ const k = {
1834
1843
  securityManager: h,
1835
- hasPermission: (b) => h?.hasPermission(b) || !1,
1836
- hasAnyPermission: (b) => b.some((P) => h?.hasPermission(P) || !1),
1837
- hasAllPermissions: (b) => b.every((P) => h?.hasPermission(P) || !1),
1838
- registerAction: (b, P) => {
1839
- h?.registerAction(b, P);
1844
+ hasPermission: (A) => h?.hasPermission(A) || !1,
1845
+ hasAnyPermission: (A) => A.some((P) => h?.hasPermission(P) || !1),
1846
+ hasAllPermissions: (A) => A.every((P) => h?.hasPermission(P) || !1),
1847
+ registerAction: (A, P) => {
1848
+ h?.registerAction(A, P);
1840
1849
  },
1841
- isLoading: A,
1842
- error: E
1850
+ isLoading: E,
1851
+ error: x
1843
1852
  };
1844
- return /* @__PURE__ */ l(vt.Provider, { value: x, children: r });
1845
- }, pr = () => {
1853
+ return /* @__PURE__ */ d(bt.Provider, { value: k, children: r });
1854
+ }, hr = () => {
1846
1855
  const r = Ne($e);
1847
1856
  if (!r)
1848
1857
  throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
1849
1858
  return r;
1850
1859
  }, je = () => {
1851
- const r = Ne(vt);
1860
+ const r = Ne(bt);
1852
1861
  if (!r)
1853
1862
  throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
1854
1863
  return r;
1855
- }, jr = (r, e) => {
1856
- const t = je(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: d, securityManager: i, isLoading: u, error: y } = t;
1864
+ }, $r = (r, e) => {
1865
+ const t = je(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: l, securityManager: i, isLoading: u, error: m } = t;
1857
1866
  return Ge.useEffect(() => {
1858
- r && e && (d("create", `Criar ${e}`), d("edit", `Editar ${e}`), d("delete", `Deletar ${e}`), d("view", `Visualizar ${e}`), d("list", `Listar ${e}`));
1859
- }, [r, e, d]), {
1867
+ r && e && (l("create", `Criar ${e}`), l("edit", `Editar ${e}`), l("delete", `Deletar ${e}`), l("view", `Visualizar ${e}`), l("list", `Listar ${e}`));
1868
+ }, [r, e, l]), {
1860
1869
  hasPermission: s,
1861
1870
  hasAnyPermission: o,
1862
1871
  hasAllPermissions: a,
1863
- registerAction: d,
1872
+ registerAction: l,
1864
1873
  securityManager: i,
1865
1874
  canCreate: s("create"),
1866
1875
  canEdit: s("edit"),
@@ -1868,52 +1877,52 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1868
1877
  canView: s("view"),
1869
1878
  canList: s("list"),
1870
1879
  isLoading: u,
1871
- error: y
1880
+ error: m
1872
1881
  };
1873
- }, Fr = () => {
1882
+ }, jr = () => {
1874
1883
  const r = je();
1875
1884
  return {
1876
1885
  check: r.hasPermission,
1877
1886
  checkAny: r.hasAnyPermission,
1878
1887
  checkAll: r.hasAllPermissions,
1879
- isAdmin: pr().isAdmin
1888
+ isAdmin: hr().isAdmin
1880
1889
  };
1881
- }, bt = ({
1890
+ }, Et = ({
1882
1891
  children: r,
1883
1892
  actionName: e,
1884
1893
  requiredPermissions: t = [],
1885
1894
  requireAll: s = !0,
1886
1895
  actionDescription: o,
1887
1896
  fallback: a = null,
1888
- autoRegister: d = !0
1897
+ autoRegister: l = !0
1889
1898
  }) => {
1890
- const { hasPermission: i, hasAnyPermission: u, hasAllPermissions: y, registerAction: k } = je();
1899
+ const { hasPermission: i, hasAnyPermission: u, hasAllPermissions: m, registerAction: b } = je();
1891
1900
  z(() => {
1892
- d && e && o && k(e, o);
1893
- }, [e, o, d, k]);
1901
+ l && e && o && b(e, o);
1902
+ }, [e, o, l, b]);
1894
1903
  let h = !1;
1895
- return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : u(t) : h = !0, h ? /* @__PURE__ */ l(te, { children: r }) : /* @__PURE__ */ l(te, { children: a });
1896
- }, Vr = ({
1904
+ return e ? h = i(e) : t.length > 0 ? h = s ? m(t) : u(t) : h = !0, h ? /* @__PURE__ */ d(te, { children: r }) : /* @__PURE__ */ d(te, { children: a });
1905
+ }, Fr = ({
1897
1906
  actionName: r,
1898
1907
  actionDescription: e,
1899
1908
  children: t,
1900
1909
  onClick: s,
1901
1910
  disabled: o = !1,
1902
1911
  className: a = "",
1903
- style: d = {},
1912
+ style: l = {},
1904
1913
  variant: i = "primary",
1905
1914
  size: u = "medium",
1906
- type: y = "button"
1915
+ type: m = "button"
1907
1916
  }) => {
1908
- const k = () => {
1909
- const C = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, g = `archbase-secure-btn--${u}`;
1910
- return `${C} ${A} ${g} ${a}`.trim();
1917
+ const b = () => {
1918
+ const C = "archbase-secure-btn", E = `archbase-secure-btn--${i}`, y = `archbase-secure-btn--${u}`;
1919
+ return `${C} ${E} ${y} ${a}`.trim();
1911
1920
  }, h = () => {
1912
1921
  const C = {
1913
1922
  small: { padding: "4px 8px", fontSize: "12px" },
1914
1923
  medium: { padding: "8px 16px", fontSize: "14px" },
1915
1924
  large: { padding: "12px 24px", fontSize: "16px" }
1916
- }, A = {
1925
+ }, E = {
1917
1926
  primary: { backgroundColor: "#007bff", color: "white" },
1918
1927
  secondary: { backgroundColor: "#6c757d", color: "white" },
1919
1928
  danger: { backgroundColor: "#dc3545", color: "white" },
@@ -1927,43 +1936,43 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1927
1936
  fontWeight: "500",
1928
1937
  opacity: o ? 0.6 : 1,
1929
1938
  ...C[u],
1930
- ...A[i],
1931
- ...d
1939
+ ...E[i],
1940
+ ...l
1932
1941
  };
1933
1942
  };
1934
- return /* @__PURE__ */ l(
1935
- bt,
1943
+ return /* @__PURE__ */ d(
1944
+ Et,
1936
1945
  {
1937
1946
  actionName: r,
1938
1947
  actionDescription: e,
1939
1948
  fallback: null,
1940
- children: /* @__PURE__ */ l(
1949
+ children: /* @__PURE__ */ d(
1941
1950
  "button",
1942
1951
  {
1943
- type: y,
1952
+ type: m,
1944
1953
  onClick: s,
1945
1954
  disabled: o,
1946
- className: k(),
1955
+ className: b(),
1947
1956
  style: h(),
1948
1957
  children: t
1949
1958
  }
1950
1959
  )
1951
1960
  }
1952
1961
  );
1953
- }, zr = ({
1962
+ }, Vr = ({
1954
1963
  children: r,
1955
1964
  actionName: e,
1956
1965
  actionDescription: t,
1957
1966
  showLabel: s = !0,
1958
1967
  label: o,
1959
1968
  fallbackText: a = "Campo não disponível",
1960
- fallbackComponent: d
1961
- }) => e ? /* @__PURE__ */ l(
1962
- bt,
1969
+ fallbackComponent: l
1970
+ }) => e ? /* @__PURE__ */ d(
1971
+ Et,
1963
1972
  {
1964
1973
  actionName: e,
1965
1974
  actionDescription: t,
1966
- fallback: d || /* @__PURE__ */ R("div", { className: "archbase-secure-field-fallback", style: {
1975
+ fallback: l || /* @__PURE__ */ R("div", { className: "archbase-secure-field-fallback", style: {
1967
1976
  padding: "8px",
1968
1977
  color: "#666",
1969
1978
  fontStyle: "italic",
@@ -1979,61 +1988,61 @@ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t,
1979
1988
  ] }),
1980
1989
  children: r
1981
1990
  }
1982
- ) : /* @__PURE__ */ l(te, { children: r });
1983
- function Wr(r, e) {
1991
+ ) : /* @__PURE__ */ d(te, { children: r });
1992
+ function zr(r, e) {
1984
1993
  return function(s) {
1985
- const { resourceName: o, resourceDescription: a, requiredPermissions: d, fallbackComponent: i } = e;
1986
- return /* @__PURE__ */ l(
1987
- hr,
1994
+ const { resourceName: o, resourceDescription: a, requiredPermissions: l, fallbackComponent: i } = e;
1995
+ return /* @__PURE__ */ d(
1996
+ ur,
1988
1997
  {
1989
1998
  resourceName: o,
1990
1999
  resourceDescription: a,
1991
- requiredPermissions: d,
2000
+ requiredPermissions: l,
1992
2001
  fallbackComponent: i,
1993
- children: /* @__PURE__ */ l(r, { ...s })
2002
+ children: /* @__PURE__ */ d(r, { ...s })
1994
2003
  }
1995
2004
  );
1996
2005
  };
1997
2006
  }
1998
2007
  export {
1999
- wt as ARCHBASE_SECURITY_MANAGER_STORE,
2008
+ At as ARCHBASE_SECURITY_MANAGER_STORE,
2000
2009
  ir as AccessIntervalDto,
2001
- it as AccessScheduleDto,
2010
+ ct as AccessScheduleDto,
2002
2011
  Le as AccessTokenDto,
2003
2012
  ar as ActionDto,
2004
2013
  Oe as ApiTokenDto,
2005
- gt as ArchbaseAccessTokenService,
2006
- mt as ArchbaseApiTokenService,
2014
+ wt as ArchbaseAccessTokenService,
2015
+ yt as ArchbaseApiTokenService,
2007
2016
  sr as ArchbaseAuthContext,
2008
- Ur as ArchbaseAuthProvider,
2009
- pt as ArchbaseGroupService,
2010
- Rr as ArchbaseLogin,
2011
- ft as ArchbaseProfileService,
2012
- bt as ArchbaseProtectedComponent,
2013
- Nr as ArchbaseResetPassword,
2014
- yt as ArchbaseResourceService,
2015
- Vr as ArchbaseSecureActionButton,
2016
- zr as ArchbaseSecureFormField,
2017
- st as ArchbaseSecurityManager,
2018
- $r as ArchbaseSecurityProvider,
2017
+ Cr as ArchbaseAuthProvider,
2018
+ mt as ArchbaseGroupService,
2019
+ Dr as ArchbaseLogin,
2020
+ gt as ArchbaseProfileService,
2021
+ Et as ArchbaseProtectedComponent,
2022
+ Rr as ArchbaseResetPassword,
2023
+ vt as ArchbaseResourceService,
2024
+ Fr as ArchbaseSecureActionButton,
2025
+ Vr as ArchbaseSecureFormField,
2026
+ nt as ArchbaseSecurityManager,
2027
+ Lr as ArchbaseSecurityProvider,
2019
2028
  V as ArchbaseTenantManager,
2020
- Xe as ArchbaseUser,
2021
- ht as ArchbaseUserService,
2022
- Qe as ArchbaseUsernameAndPassword,
2023
- Qe as ArchbaseUsernameAndPasswordImpl,
2024
- hr as ArchbaseViewSecurityProvider,
2029
+ Ze as ArchbaseUser,
2030
+ ft as ArchbaseUserService,
2031
+ et as ArchbaseUsernameAndPassword,
2032
+ et as ArchbaseUsernameAndPasswordImpl,
2033
+ ur as ArchbaseViewSecurityProvider,
2025
2034
  Te as CONTEXT_STORAGE_KEY,
2026
2035
  Vt as DefaultArchbaseTokenManager,
2027
- ur as DefaultSecurityLoading,
2036
+ dr as DefaultSecurityLoading,
2028
2037
  Q as ENCRYPTION_KEY,
2029
- et as FetchError,
2038
+ rt as FetchError,
2030
2039
  he as GroupDto,
2031
2040
  _r as PermissionDto,
2032
2041
  ue as ProfileDto,
2033
- dt as ResourceDto,
2042
+ ht as ResourceDto,
2034
2043
  le as SecurityDto,
2035
2044
  ae as SecurityType,
2036
- ke as TOKEN_COOKIE_NAME,
2045
+ Se as TOKEN_COOKIE_NAME,
2037
2046
  nr as TipoRecurso,
2038
2047
  Pe as USER_NAME,
2039
2048
  Ie as USER_NAME_AND_PASSWORD,
@@ -2047,23 +2056,23 @@ export {
2047
2056
  Yt as fetchWithRefreshToken,
2048
2057
  Wt as generateCodeChallenge,
2049
2058
  zt as generateRandomString,
2050
- Ze as getRandomInteger,
2059
+ tt as getRandomInteger,
2051
2060
  rr as getRefreshExpiresIn,
2052
2061
  Gt as postWithXForm,
2053
2062
  Jt as redirectToLogin,
2054
2063
  Xt as redirectToLogout,
2055
- Mr as useArchbaseAuthenticationManager,
2056
- Or as useArchbaseGetCurrentToken,
2064
+ Br as useArchbaseAuthenticationManager,
2065
+ Mr as useArchbaseGetCurrentToken,
2057
2066
  lr as useArchbaseGetLoggedUser,
2058
- Fr as useArchbasePermissionCheck,
2059
- Lr as useArchbaseResetPassword,
2060
- jr as useArchbaseSecureForm,
2061
- pr as useArchbaseSecurity,
2062
- Br as useArchbaseSecurityManager,
2063
- Dr as useArchbaseTenantManager,
2067
+ jr as useArchbasePermissionCheck,
2068
+ Or as useArchbaseResetPassword,
2069
+ $r as useArchbaseSecureForm,
2070
+ hr as useArchbaseSecurity,
2071
+ Nr as useArchbaseSecurityManager,
2072
+ Ur as useArchbaseTenantManager,
2064
2073
  je as useArchbaseViewSecurity,
2065
- Cr as useBrowserStorage,
2074
+ Tr as useBrowserStorage,
2066
2075
  er as validateConfig,
2067
2076
  Qt as validateState,
2068
- Wr as withArchbaseSecurity
2077
+ zr as withArchbaseSecurity
2069
2078
  };