@archbase/security 4.0.40 → 4.0.41

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
- import * as U from "inversify";
3
- import { decorate as Mt, injectable as Nt } from "inversify";
4
- import { compressString as Bt, decompressString as Ot, IOCContainer as Lt, ARCHBASE_IOC_API_TYPE as X, processErrorMessage as oe, IsNotEmpty as Q, IsOptional as de, IsBoolean as re, IsEmail as $t, getKeyByEnumValue as Ye, useArchbasePasswordRemember as zt, getI18nextInstance as x, useArchbaseTheme as jt, isEmailValidate as Ft, useArchbaseAppContext as Vt } from "@archbase/core";
2
+ import * as P from "inversify";
3
+ import { decorate as Bt, injectable as Lt } from "inversify";
4
+ import { compressString as Ot, decompressString as $t, IOCContainer as zt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as oe, IsNotEmpty as X, IsOptional as ie, IsBoolean as te, IsEmail as jt, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Ft, getI18nextInstance as x, useArchbaseTheme as Vt, isEmailValidate as Wt, useArchbaseAppContext as Ht } from "@archbase/core";
5
5
  import G from "crypto-js";
6
- import { jwtDecode as Wt } from "jwt-decode";
7
- import { jsx as n, jsxs as P, Fragment as ne } from "react/jsx-runtime";
8
- import ot, { useState as h, useEffect as K, createContext as je, useMemo as nt, useRef as it, useCallback as Se, useContext as Fe } from "react";
9
- import { BehaviorSubject as Xe } from "rxjs";
10
- import { ArchbaseRemoteApiService as me, useArchbaseStore as at } from "@archbase/data";
11
- import { v4 as Z } from "uuid";
12
- import { Card as Ve, Text as j, Divider as Te, Stack as be, TextInput as Ae, Button as W, Anchor as Qe, Group as le, Select as Ht, Tooltip as Gt, Loader as ct, PasswordInput as Le, Checkbox as Jt, Alert as Ze, Code as et, CopyButton as tt, SimpleGrid as Kt, useMantineColorScheme as qt, Box as Yt, Skeleton as Ie } from "@mantine/core";
13
- import { useFocusTrap as lt } from "@mantine/hooks";
14
- import { IconCopy as Xt } from "@tabler/icons-react";
15
- import { ArchbaseQRCode as Qt, ArchbaseDialog as rt } from "@archbase/components";
16
- import { useContainer as Ue } from "inversify-react";
17
- class dt {
6
+ import { jwtDecode as Gt } from "jwt-decode";
7
+ import { jsx as n, jsxs as C, Fragment as ne } from "react/jsx-runtime";
8
+ import it, { useState as p, useEffect as K, createContext as Ve, useMemo as at, useRef as ct, useCallback as Ce, useContext as We } from "react";
9
+ import { BehaviorSubject as Ze } from "rxjs";
10
+ import { ArchbaseRemoteApiService as ye, useArchbaseStore as lt } from "@archbase/data";
11
+ import { v4 as Q } from "uuid";
12
+ import { Card as He, Text as F, Divider as Ue, Stack as Ee, TextInput as xe, Button as H, Anchor as et, Group as de, Select as Jt, Tooltip as Kt, Loader as dt, PasswordInput as ze, Checkbox as qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Yt, useMantineColorScheme as Xt, Box as Qt, Skeleton as Ie } from "@mantine/core";
13
+ import { useFocusTrap as ut } from "@mantine/hooks";
14
+ import { IconCopy as Zt } from "@tabler/icons-react";
15
+ import { ArchbaseQRCode as er, ArchbaseDialog as ot } from "@archbase/components";
16
+ import { useContainer as De } from "inversify-react";
17
+ class ht {
18
18
  id;
19
19
  displayName;
20
20
  email;
@@ -24,10 +24,10 @@ class dt {
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 dt({});
27
+ return new ht({});
28
28
  }
29
29
  }
30
- class ut {
30
+ class pt {
31
31
  username;
32
32
  password;
33
33
  remember;
@@ -35,16 +35,16 @@ class ut {
35
35
  this.username = e.username, this.password = e.password, this.remember = e.remember;
36
36
  }
37
37
  static newInstance() {
38
- return new ut({});
38
+ return new pt({});
39
39
  }
40
40
  }
41
- const ae = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Me = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Ne = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Be = "602b05c5-ec46-451e-aba6-187e463bc245", Oe = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
- class Zt {
41
+ const ce = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Me = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Be = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Le = "602b05c5-ec46-451e-aba6-187e463bc245", Oe = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
+ class tr {
43
43
  getUsernameAndPassword() {
44
44
  try {
45
- const e = localStorage.getItem(Ne);
45
+ const e = localStorage.getItem(Be);
46
46
  if (e) {
47
- const t = G.AES.decrypt(e, ae).toString(G.enc.Utf8), o = atob(t).split(":");
47
+ const t = G.AES.decrypt(e, ce).toString(G.enc.Utf8), o = atob(t).split(":");
48
48
  return { username: o[0], password: o[1], remember: !0 };
49
49
  } else
50
50
  return null;
@@ -53,14 +53,14 @@ class Zt {
53
53
  }
54
54
  }
55
55
  saveUsernameAndPassword(e, t) {
56
- const s = btoa(`${e}:${t}`), o = G.AES.encrypt(s, ae).toString();
57
- localStorage.setItem(Ne, o);
56
+ const s = btoa(`${e}:${t}`), o = G.AES.encrypt(s, ce).toString();
57
+ localStorage.setItem(Be, o);
58
58
  }
59
59
  getUsername() {
60
60
  try {
61
- const e = localStorage.getItem(Be);
61
+ const e = localStorage.getItem(Le);
62
62
  if (e) {
63
- const t = G.AES.decrypt(e, ae).toString(G.enc.Utf8);
63
+ const t = G.AES.decrypt(e, ce).toString(G.enc.Utf8);
64
64
  return atob(t);
65
65
  } else
66
66
  return null;
@@ -69,15 +69,15 @@ class Zt {
69
69
  }
70
70
  }
71
71
  saveUsername(e) {
72
- const t = btoa(e), s = G.AES.encrypt(t, ae).toString();
73
- localStorage.setItem(Be, s);
72
+ const t = btoa(e), s = G.AES.encrypt(t, ce).toString();
73
+ localStorage.setItem(Le, 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 = Wt(s.access_token);
80
+ const o = Gt(s.access_token);
81
81
  if (!o)
82
82
  return !0;
83
83
  const a = Math.floor(Date.now() / 1e3), c = o.exp;
@@ -88,13 +88,13 @@ class Zt {
88
88
  }
89
89
  saveToken(e) {
90
90
  if (e) {
91
- const t = JSON.stringify(e), s = G.AES.encrypt(t, ae).toString(), o = Bt(s);
91
+ const t = JSON.stringify(e), s = G.AES.encrypt(t, ce).toString(), o = Ot(s);
92
92
  localStorage.setItem(Me, o);
93
93
  } else
94
94
  this.clearToken();
95
95
  }
96
96
  clearUsernameAndPassword() {
97
- localStorage.removeItem(Ne), localStorage.removeItem(Be);
97
+ localStorage.removeItem(Be), localStorage.removeItem(Le);
98
98
  }
99
99
  clearToken() {
100
100
  localStorage.removeItem(Me);
@@ -104,7 +104,7 @@ class Zt {
104
104
  const e = localStorage.getItem(Me);
105
105
  if (!e)
106
106
  return null;
107
- const t = Ot(e), s = G.AES.decrypt(t, ae).toString(G.enc.Utf8);
107
+ const t = $t(e), s = G.AES.decrypt(t, ce).toString(G.enc.Utf8);
108
108
  return JSON.parse(s);
109
109
  } catch {
110
110
  return null;
@@ -112,7 +112,7 @@ class Zt {
112
112
  }
113
113
  saveContext(e) {
114
114
  try {
115
- const t = G.AES.encrypt(e, ae).toString();
115
+ const t = G.AES.encrypt(e, ce).toString();
116
116
  localStorage.setItem(Oe, t);
117
117
  } catch (t) {
118
118
  console.warn("Erro ao salvar contexto:", t);
@@ -121,7 +121,7 @@ class Zt {
121
121
  getContext() {
122
122
  try {
123
123
  const e = localStorage.getItem(Oe);
124
- return e ? G.AES.decrypt(e, ae).toString(G.enc.Utf8) : null;
124
+ return e ? G.AES.decrypt(e, ce).toString(G.enc.Utf8) : null;
125
125
  } catch {
126
126
  return null;
127
127
  }
@@ -130,19 +130,19 @@ class Zt {
130
130
  localStorage.removeItem(Oe);
131
131
  }
132
132
  }
133
- Mt(Nt(), Zt);
134
- function ht(r) {
133
+ Bt(Lt(), tr);
134
+ function ft(r) {
135
135
  const t = new Uint8Array(1);
136
- return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ht(r) : t[0] % r;
136
+ return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ft(r) : t[0] % r;
137
137
  }
138
- function er(r) {
138
+ function rr(r) {
139
139
  let e = "";
140
140
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
141
141
  for (let s = 0; s < r; s++)
142
- e += t.charAt(ht(t.length - 1));
142
+ e += t.charAt(ft(t.length - 1));
143
143
  return e;
144
144
  }
145
- async function tr(r) {
145
+ async function sr(r) {
146
146
  if (!window.crypto.subtle?.digest)
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"
@@ -150,36 +150,36 @@ async function tr(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 pt extends Error {
153
+ class mt extends Error {
154
154
  status;
155
155
  statusText;
156
156
  constructor(e, t, s) {
157
157
  super(s), this.name = "FetchError", this.status = e, this.statusText = t;
158
158
  }
159
159
  }
160
- function rr(r) {
160
+ function or(r) {
161
161
  let e = "";
162
162
  return Object.entries(r).forEach(([t, s]) => {
163
163
  e += (e ? "&" : "") + t + "=" + encodeURIComponent(s);
164
164
  }), e;
165
165
  }
166
- async function sr(r, e) {
166
+ async function nr(r, e) {
167
167
  return fetch(r, {
168
168
  method: "POST",
169
- body: rr(e),
169
+ body: or(e),
170
170
  headers: { "Content-Type": "application/x-www-form-urlencoded" }
171
171
  }).then(async (t) => {
172
172
  if (!t.ok) {
173
173
  const s = await t.text();
174
- throw new pt(t.status, t.statusText, s);
174
+ throw new mt(t.status, t.statusText, s);
175
175
  }
176
176
  return t;
177
177
  });
178
178
  }
179
- const ft = "PKCE_code_verifier", $e = "ROCP_auth_state";
180
- async function or(r, e) {
181
- const t = er(96);
182
- return sessionStorage.setItem(ft, t), tr(t).then((s) => {
179
+ const gt = "PKCE_code_verifier", je = "ROCP_auth_state";
180
+ async function ir(r, e) {
181
+ const t = rr(96);
182
+ return sessionStorage.setItem(gt, t), sr(t).then((s) => {
183
183
  const o = new URLSearchParams({
184
184
  response_type: "code",
185
185
  client_id: r.clientId,
@@ -188,23 +188,23 @@ async function or(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($e);
191
+ r.scope !== void 0 && o.append("scope", r.scope), sessionStorage.removeItem(je);
192
192
  const a = e ?? r.state;
193
- a && (sessionStorage.setItem($e, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
193
+ a && (sessionStorage.setItem(je, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
194
194
  });
195
195
  }
196
- function nr(r) {
196
+ function ar(r) {
197
197
  return r.access_token !== void 0;
198
198
  }
199
- function mt(r, e) {
200
- return sr(r, e).then((t) => t.json().then((s) => {
201
- if (nr(s))
199
+ function yt(r, e) {
200
+ return nr(r, e).then((t) => t.json().then((s) => {
201
+ if (ar(s))
202
202
  return s;
203
203
  throw Error(s);
204
204
  }));
205
205
  }
206
- const ir = (r) => {
207
- const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(ft);
206
+ const cr = (r) => {
207
+ const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(gt);
208
208
  if (!t)
209
209
  throw Error(`Parâmetro 'código' não encontrado na URL.
210
210
  A autenticação ocorreu?`);
@@ -221,8 +221,8 @@ A autenticação ocorreu?`);
221
221
  ...r.extraTokenParameters,
222
222
  ...r.extraAuthParams
223
223
  };
224
- return mt(r.tokenEndpoint, o);
225
- }, ar = (r) => {
224
+ return yt(r.tokenEndpoint, o);
225
+ }, lr = (r) => {
226
226
  const { config: e, refreshToken: t } = r, s = {
227
227
  grant_type: "refresh_token",
228
228
  refresh_token: t,
@@ -231,9 +231,9 @@ A autenticação ocorreu?`);
231
231
  redirect_uri: e.redirectUri,
232
232
  ...e.extraTokenParameters
233
233
  };
234
- return mt(e.tokenEndpoint, s);
234
+ return yt(e.tokenEndpoint, s);
235
235
  };
236
- function cr(r, e, t, s, o, a) {
236
+ function dr(r, e, t, s, o, a) {
237
237
  const c = new URLSearchParams({
238
238
  token: t || e,
239
239
  token_type_hint: t ? "refresh_token" : "access_token",
@@ -244,15 +244,15 @@ function cr(r, e, t, s, o, a) {
244
244
  });
245
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()}`);
246
246
  }
247
- function lr(r) {
248
- const e = r.get("state"), t = sessionStorage.getItem($e);
247
+ function ur(r) {
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
- function ce(r, e, t) {
255
- const s = t === "session" ? sessionStorage : localStorage, [o, a] = h(() => {
254
+ function le(r, e, t) {
255
+ const s = t === "session" ? sessionStorage : localStorage, [o, a] = p(() => {
256
256
  const i = s.getItem(r);
257
257
  try {
258
258
  return i ? JSON.parse(i) : e;
@@ -282,14 +282,14 @@ Error: ${l.message}`
282
282
  return window.addEventListener("storage", i, !1), () => window.removeEventListener("storage", i, !1);
283
283
  }), [o, c];
284
284
  }
285
- const $r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
285
+ const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
286
286
  __proto__: null,
287
- default: ce
287
+ default: le
288
288
  }, Symbol.toStringTag, { value: "Module" }));
289
- function Ce(r) {
289
+ function Pe(r) {
290
290
  return ["", void 0, null].includes(r);
291
291
  }
292
- function dr(r) {
292
+ function hr(r) {
293
293
  const {
294
294
  autoLogin: e = !0,
295
295
  clearURL: t = !0,
@@ -299,7 +299,7 @@ function dr(r) {
299
299
  postLogin: c = () => null,
300
300
  onRefreshTokenExpire: i = void 0,
301
301
  storage: l = "local"
302
- } = r, g = {
302
+ } = r, y = {
303
303
  ...r,
304
304
  autoLogin: e,
305
305
  clearURL: t,
@@ -310,22 +310,22 @@ function dr(r) {
310
310
  onRefreshTokenExpire: i,
311
311
  storage: l
312
312
  };
313
- return ur(g), g;
313
+ return pr(y), y;
314
314
  }
315
- function ur(r) {
316
- if (Ce(r?.clientId))
315
+ function pr(r) {
316
+ if (Pe(r?.clientId))
317
317
  throw Error(
318
318
  "'clientId' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
319
319
  );
320
- if (Ce(r?.authorizationEndpoint))
320
+ if (Pe(r?.authorizationEndpoint))
321
321
  throw Error(
322
322
  "'authorizationEndpoint' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
323
323
  );
324
- if (Ce(r?.tokenEndpoint))
324
+ if (Pe(r?.tokenEndpoint))
325
325
  throw Error(
326
326
  "'tokenEndpoint' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
327
327
  );
328
- if (Ce(r?.redirectUri))
328
+ if (Pe(r?.redirectUri))
329
329
  throw Error(
330
330
  "'redirectUri' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
331
331
  );
@@ -337,23 +337,23 @@ function ur(r) {
337
337
  "Usar 'extraAuthParams' e 'extraTokenParameters' não é recomendado. Eles fazem a mesma coisa e você deve usar apenas 'extraTokenParameters'"
338
338
  );
339
339
  }
340
- const pe = 600, he = (r) => Math.round(Date.now() / 1e3 + r);
341
- function st(r) {
340
+ const me = 600, fe = (r) => Math.round(Date.now() / 1e3 + r);
341
+ function nt(r) {
342
342
  return Math.round(Date.now()) / 1e3 + 30 >= r;
343
343
  }
344
- const hr = [
344
+ const fr = [
345
345
  "refresh_expires_in",
346
346
  // KeyCloak
347
347
  "refresh_token_expires_in"
348
348
  // Azure AD
349
349
  ];
350
- function pr(r, e) {
351
- for (const t of hr)
350
+ function mr(r, e) {
351
+ for (const t of fr)
352
352
  if (t in e)
353
353
  return e[t];
354
- return e.refresh_token ? r + pe : r;
354
+ return e.refresh_token ? r + me : r;
355
355
  }
356
- const Pe = (r) => {
356
+ const Te = (r) => {
357
357
  try {
358
358
  const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), s = decodeURIComponent(
359
359
  atob(t).split("").map(function(o) {
@@ -368,86 +368,86 @@ const Pe = (r) => {
368
368
  Você pode desativar a decodificação JWT definindo o valor 'decodeToken' como 'falso' na configuração.`
369
369
  );
370
370
  }
371
- }, fr = je({
371
+ }, gr = Ve({
372
372
  token: "",
373
373
  login: () => null,
374
374
  logOut: () => null,
375
375
  error: null,
376
376
  loginInProgress: !1
377
- }), zr = ({ authConfig: r, children: e }) => {
378
- const t = nt(() => dr(r), [r]), [s, o] = ce(
377
+ }), Fr = ({ authConfig: r, children: e }) => {
378
+ const t = at(() => hr(r), [r]), [s, o] = le(
379
379
  "ROCP_refreshToken",
380
380
  void 0,
381
381
  t.storage
382
- ), [a, c] = ce(
382
+ ), [a, c] = le(
383
383
  "ROCP_refreshTokenExpire",
384
- he(2 * pe),
384
+ fe(2 * me),
385
385
  t.storage
386
- ), [i, l] = ce("ROCP_token", "", t.storage), [g, E] = ce(
386
+ ), [i, l] = le("ROCP_token", "", t.storage), [y, E] = le(
387
387
  "ROCP_tokenExpire",
388
- he(pe),
388
+ fe(me),
389
389
  t.storage
390
- ), [d, _] = ce(
390
+ ), [d, R] = le(
391
391
  "ROCP_idToken",
392
392
  void 0,
393
393
  t.storage
394
- ), [v, f] = ce(
394
+ ), [A, g] = le(
395
395
  "ROCP_loginInProgress",
396
396
  !1,
397
397
  t.storage
398
- ), [S, D] = ce(
398
+ ), [S, D] = le(
399
399
  "ROCP_refreshInProgress",
400
400
  !1,
401
401
  t.storage
402
- ), [B, O] = h(), [F, N] = h(), [w, m] = h(null);
403
- let R;
404
- function V() {
405
- o(void 0), l(""), E(he(pe)), c(he(pe)), _(void 0), O(void 0), N(void 0), f(!1);
406
- }
407
- function C(p, y) {
408
- V(), m(null), t?.logoutEndpoint && cr(t, i, s, d, p, y);
409
- }
410
- function L(p) {
411
- V(), f(!0);
412
- let y = p;
413
- p && typeof p != "string" && (console.warn(
414
- `O estado de login aprovado deve ser do tipo 'string'. Recebido'${p}'. Ignorando o valor...`
415
- ), y = void 0), or(t, y).catch((te) => {
416
- console.error(te), m(te.message), f(!1);
402
+ ), [N, B] = p(), [W, M] = p(), [b, w] = p(null);
403
+ let T;
404
+ function z() {
405
+ o(void 0), l(""), E(fe(me)), c(fe(me)), R(void 0), B(void 0), M(void 0), g(!1);
406
+ }
407
+ function O(f, v) {
408
+ z(), w(null), t?.logoutEndpoint && dr(t, i, s, d, f, v);
409
+ }
410
+ function L(f) {
411
+ z(), g(!0);
412
+ let v = f;
413
+ f && typeof f != "string" && (console.warn(
414
+ `O estado de login aprovado deve ser do tipo 'string'. Recebido'${f}'. Ignorando o valor...`
415
+ ), v = void 0), ir(t, v).catch((ee) => {
416
+ console.error(ee), w(ee.message), g(!1);
417
417
  });
418
418
  }
419
- function q(p) {
420
- l(p.access_token), o(p.refresh_token);
421
- const y = t.tokenExpiresIn ?? p.expires_in ?? pe;
422
- E(he(y));
423
- const te = t.refreshTokenExpiresIn ?? pr(y, p);
424
- c(he(te)), _(p.id_token);
419
+ function U(f) {
420
+ l(f.access_token), o(f.refresh_token);
421
+ const v = t.tokenExpiresIn ?? f.expires_in ?? me;
422
+ E(fe(v));
423
+ const ee = t.refreshTokenExpiresIn ?? mr(v, f);
424
+ c(fe(ee)), R(f.id_token);
425
425
  try {
426
- p.id_token && N(Pe(p.id_token));
427
- } catch (T) {
428
- console.warn(`Falha ao decodificar idToken: ${T.message}`);
426
+ f.id_token && M(Te(f.id_token));
427
+ } catch (I) {
428
+ console.warn(`Falha ao decodificar idToken: ${I.message}`);
429
429
  }
430
430
  try {
431
- t.decodeToken && O(Pe(p.access_token));
432
- } catch (T) {
433
- console.warn(`Falha ao decodificar o token de acesso: ${T.message}`);
431
+ t.decodeToken && B(Te(f.access_token));
432
+ } catch (I) {
433
+ console.warn(`Falha ao decodificar o token de acesso: ${I.message}`);
434
434
  }
435
435
  }
436
- function ee(p = !1) {
437
- return p || !t.onRefreshTokenExpire ? L() : t.onRefreshTokenExpire({ login: L });
436
+ function Z(f = !1) {
437
+ return f || !t.onRefreshTokenExpire ? L() : t.onRefreshTokenExpire({ login: L });
438
438
  }
439
- function Y(p = !1) {
440
- if (i && st(g) && !(S && !p)) {
441
- if (st(a))
442
- return ee(p);
439
+ function q(f = !1) {
440
+ if (i && nt(y) && !(S && !f)) {
441
+ if (nt(a))
442
+ return Z(f);
443
443
  if (s) {
444
- D(!0), ar({ config: t, refreshToken: s }).then((y) => q(y)).catch((y) => {
445
- if (y instanceof pt) {
446
- if (y.status === 400)
447
- return ee(p);
448
- console.error(y), m(y.message), p && L();
444
+ D(!0), lr({ config: t, refreshToken: s }).then((v) => U(v)).catch((v) => {
445
+ if (v instanceof mt) {
446
+ if (v.status === 400)
447
+ return Z(f);
448
+ console.error(v), w(v.message), f && L();
449
449
  } else
450
- y instanceof Error && (console.error(y), m(y.message), p && L());
450
+ v instanceof Error && (console.error(v), w(v.message), f && L());
451
451
  }).finally(() => {
452
452
  D(!1);
453
453
  });
@@ -458,29 +458,29 @@ const Pe = (r) => {
458
458
  );
459
459
  }
460
460
  }
461
- K(() => (R = setInterval(() => Y(), 1e4), () => clearInterval(R)), [i, s, a, g]);
462
- const ie = it(!1);
461
+ K(() => (T = setInterval(() => q(), 1e4), () => clearInterval(T)), [i, s, a, y]);
462
+ const re = ct(!1);
463
463
  return K(() => {
464
- if (v) {
465
- const p = new URLSearchParams(window.location.search);
466
- if (!p.get("code")) {
467
- const y = p.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
- console.error(y), m(y), C();
464
+ if (A) {
465
+ const f = new URLSearchParams(window.location.search);
466
+ if (!f.get("code")) {
467
+ const v = f.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
+ console.error(v), w(v), O();
469
469
  return;
470
470
  }
471
- if (!ie.current) {
472
- ie.current = !0;
471
+ if (!re.current) {
472
+ re.current = !0;
473
473
  try {
474
- lr(p);
475
- } catch (y) {
476
- console.error(y), m(y.message);
474
+ ur(f);
475
+ } catch (v) {
476
+ console.error(v), w(v.message);
477
477
  }
478
- ir(t).then((y) => {
479
- q(y), t?.postLogin && t.postLogin();
480
- }).catch((y) => {
481
- console.error(y), m(y.message);
478
+ cr(t).then((v) => {
479
+ U(v), t?.postLogin && t.postLogin();
480
+ }).catch((v) => {
481
+ console.error(v), w(v.message);
482
482
  }).finally(() => {
483
- t.clearURL && window.history.replaceState(null, "", window.location.pathname), f(!1);
483
+ t.clearURL && window.history.replaceState(null, "", window.location.pathname), g(!1);
484
484
  });
485
485
  }
486
486
  return;
@@ -488,25 +488,25 @@ const Pe = (r) => {
488
488
  if (!i && t.autoLogin)
489
489
  return L();
490
490
  try {
491
- d && N(Pe(d));
492
- } catch (p) {
493
- console.warn(`Falha ao decodificar idToken: ${p.message}`);
491
+ d && M(Te(d));
492
+ } catch (f) {
493
+ console.warn(`Falha ao decodificar idToken: ${f.message}`);
494
494
  }
495
495
  try {
496
- t.decodeToken && O(Pe(i));
497
- } catch (p) {
498
- console.warn(`Falha ao decodificar o token de acesso: ${p.message}`);
496
+ t.decodeToken && B(Te(i));
497
+ } catch (f) {
498
+ console.warn(`Falha ao decodificar o token de acesso: ${f.message}`);
499
499
  }
500
- Y(!0);
500
+ q(!0);
501
501
  }, []), /* @__PURE__ */ n(
502
- fr.Provider,
502
+ gr.Provider,
503
503
  {
504
- value: { token: i, tokenData: B, idToken: d, idTokenData: F, login: L, logOut: C, error: w, loginInProgress: v },
504
+ value: { token: i, tokenData: N, idToken: d, idTokenData: W, login: L, logOut: O, error: b, loginInProgress: A },
505
505
  children: e
506
506
  }
507
507
  );
508
508
  };
509
- class gt {
509
+ class wt {
510
510
  resourceService;
511
511
  resource;
512
512
  actions;
@@ -515,7 +515,7 @@ class gt {
515
515
  error;
516
516
  isAdmin;
517
517
  constructor(e, t, s) {
518
- this.resourceService = Lt.getContainer().get(X.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = 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;
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 });
@@ -588,8 +588,8 @@ class gt {
588
588
  }
589
589
  class J {
590
590
  static instance;
591
- _currentTenant = new Xe(null);
592
- _availableTenants = new Xe([]);
591
+ _currentTenant = new Ze(null);
592
+ _availableTenants = new Ze([]);
593
593
  constructor() {
594
594
  const e = localStorage.getItem("tenant_info");
595
595
  if (e)
@@ -629,15 +629,15 @@ class J {
629
629
  return t && (e["X-TENANT-ID"] = t.id), e;
630
630
  }
631
631
  }
632
- function jr() {
632
+ function Vr() {
633
633
  return J.getInstance();
634
634
  }
635
- var fe = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(fe || {}), mr = Object.defineProperty, k = (r, e, t, s) => {
635
+ var ge = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(ge || {}), yr = Object.defineProperty, k = (r, e, t, s) => {
636
636
  for (var o = void 0, a = r.length - 1, c; a >= 0; a--)
637
637
  (c = r[a]) && (o = c(e, t, o) || o);
638
- return o && mr(e, t, o), o;
639
- }, gr = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(gr || {});
640
- const yt = class wt {
638
+ return o && yr(e, t, o), o;
639
+ }, wr = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(wr || {});
640
+ const vt = class bt {
641
641
  id;
642
642
  code;
643
643
  version;
@@ -648,20 +648,20 @@ const yt = class wt {
648
648
  description;
649
649
  intervals;
650
650
  constructor(e) {
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 yr(t)) : [];
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 vr(t)) : [];
652
652
  }
653
- static newInstance = () => new wt({
654
- id: Z(),
653
+ static newInstance = () => new bt({
654
+ id: Q(),
655
655
  intervals: []
656
656
  });
657
657
  };
658
658
  k([
659
- Q({
659
+ X({
660
660
  message: "archbase:Informe a descrição do cronograma de acesso"
661
661
  })
662
- ], yt.prototype, "description");
663
- let vt = yt;
664
- const De = class bt {
662
+ ], vt.prototype, "description");
663
+ let At = vt;
664
+ const _e = class Et {
665
665
  id;
666
666
  code;
667
667
  version;
@@ -674,30 +674,30 @@ const De = class bt {
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 vt(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 At(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
678
678
  }
679
- static newInstance = () => new bt({
680
- id: Z(),
679
+ static newInstance = () => new Et({
680
+ id: Q(),
681
681
  dayOfWeek: (/* @__PURE__ */ new Date()).getDay(),
682
682
  startTime: "08:00",
683
683
  endTime: "17:00"
684
684
  });
685
685
  };
686
686
  k([
687
- de()
688
- ], De.prototype, "accessSchedule");
687
+ ie()
688
+ ], _e.prototype, "accessSchedule");
689
689
  k([
690
- Q({
690
+ X({
691
691
  message: "archbase:Informe a hora de início"
692
692
  })
693
- ], De.prototype, "startTime");
693
+ ], _e.prototype, "startTime");
694
694
  k([
695
- Q({
695
+ X({
696
696
  message: "archbase:Informe a hora de término"
697
697
  })
698
- ], De.prototype, "endTime");
699
- let yr = De;
700
- class ge {
698
+ ], _e.prototype, "endTime");
699
+ let vr = _e;
700
+ class we {
701
701
  id;
702
702
  code;
703
703
  version;
@@ -713,19 +713,19 @@ class ge {
713
713
  }
714
714
  }
715
715
  k([
716
- Q({
716
+ X({
717
717
  message: "archbase:Informe o nome"
718
718
  })
719
- ], ge.prototype, "name");
719
+ ], we.prototype, "name");
720
720
  k([
721
- Q({
721
+ X({
722
722
  message: "archbase:Informe a descrição"
723
723
  })
724
- ], ge.prototype, "description");
724
+ ], we.prototype, "description");
725
725
  k([
726
- de()
727
- ], ge.prototype, "actions");
728
- const ye = class At {
726
+ ie()
727
+ ], we.prototype, "actions");
728
+ const ve = class xt {
729
729
  id;
730
730
  code;
731
731
  version;
@@ -741,48 +741,48 @@ const ye = class At {
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 xt(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 St(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 At({
747
- id: Z(),
746
+ static newInstance = () => new xt({
747
+ id: Q(),
748
748
  active: !0,
749
749
  isNewAction: !0
750
750
  });
751
751
  };
752
752
  k([
753
- Q({
753
+ X({
754
754
  message: "archbase:Informe o nome para a ação"
755
755
  })
756
- ], ye.prototype, "name");
756
+ ], ve.prototype, "name");
757
757
  k([
758
- Q({
758
+ X({
759
759
  message: "archbase:Informe a descrição para a ação"
760
760
  })
761
- ], ye.prototype, "description");
761
+ ], ve.prototype, "description");
762
762
  k([
763
- de()
764
- ], ye.prototype, "resource");
763
+ ie()
764
+ ], ve.prototype, "resource");
765
765
  k([
766
- Q({
766
+ X({
767
767
  message: "archbase:Informe a categoria para a ação"
768
768
  })
769
- ], ye.prototype, "category");
769
+ ], ve.prototype, "category");
770
770
  k([
771
- re()
772
- ], ye.prototype, "active");
773
- let wr = ye;
774
- class Ee extends ge {
771
+ te()
772
+ ], ve.prototype, "active");
773
+ let br = ve;
774
+ class ke extends we {
775
775
  type;
776
776
  isNewProfile;
777
777
  constructor(e) {
778
- super(e), this.type = fe.PROFILE, this.isNewProfile = e.isNewProfile || !1;
778
+ super(e), this.type = ge.PROFILE, this.isNewProfile = e.isNewProfile || !1;
779
779
  }
780
- static newInstance = () => new Ee({
781
- id: Z(),
780
+ static newInstance = () => new ke({
781
+ id: Q(),
782
782
  isNewProfile: !0
783
783
  });
784
784
  }
785
- class We {
785
+ class Ge {
786
786
  id;
787
787
  code;
788
788
  version;
@@ -792,25 +792,25 @@ class We {
792
792
  lastModifiedByUser;
793
793
  group;
794
794
  constructor(e) {
795
- 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.group = e.group ? new xe(e.group) : void 0;
795
+ 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.group = e.group ? new Se(e.group) : void 0;
796
796
  }
797
- static newInstance = (e) => new We({
798
- id: Z(),
797
+ static newInstance = (e) => new Ge({
798
+ id: Q(),
799
799
  group: e
800
800
  });
801
801
  }
802
- class xe extends ge {
802
+ class Se extends we {
803
803
  type;
804
804
  isNewGroup;
805
805
  constructor(e) {
806
- super(e), this.type = fe.GROUP, this.isNewGroup = e.isNewGroup || !1;
806
+ super(e), this.type = ge.GROUP, this.isNewGroup = e.isNewGroup || !1;
807
807
  }
808
- static newInstance = () => new xe({
809
- id: Z(),
808
+ static newInstance = () => new Se({
809
+ id: Q(),
810
810
  isNewGroup: !0
811
811
  });
812
812
  }
813
- const _e = class Et {
813
+ const Re = class kt {
814
814
  id;
815
815
  code;
816
816
  version;
@@ -827,34 +827,35 @@ const _e = class Et {
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 Et({
831
- id: Z(),
830
+ static newInstance = () => new kt({
831
+ id: Q(),
832
832
  actions: [],
833
833
  active: !0,
834
834
  isNewResource: !0
835
835
  });
836
836
  };
837
837
  k([
838
- Q({
838
+ X({
839
839
  message: "archbase:Informe o nome para o recurso"
840
840
  })
841
- ], _e.prototype, "name");
841
+ ], Re.prototype, "name");
842
842
  k([
843
- Q({
843
+ X({
844
844
  message: "archbase:Informe a descrição para o recurso"
845
845
  })
846
- ], _e.prototype, "description");
846
+ ], Re.prototype, "description");
847
847
  k([
848
- re()
849
- ], _e.prototype, "active");
850
- let xt = _e;
851
- const H = class kt extends ge {
848
+ te()
849
+ ], Re.prototype, "active");
850
+ let St = Re;
851
+ const V = class Ct extends we {
852
852
  userName;
853
853
  password;
854
854
  changePasswordOnNextLogin;
855
855
  allowPasswordChange;
856
856
  allowMultipleLogins;
857
857
  passwordNeverExpires;
858
+ passwordChangedAt;
858
859
  accountDeactivated;
859
860
  accountLocked;
860
861
  unlimitedAccessHours;
@@ -868,10 +869,10 @@ const H = class kt extends ge {
868
869
  type;
869
870
  isNewUser;
870
871
  constructor(e) {
871
- super(e), this.type = fe.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 vt(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new We(t)) : [], this.profile = e.profile ? new Ee(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
872
+ super(e), this.type = ge.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;
872
873
  }
873
- static newInstance = () => new kt({
874
- id: Z(),
874
+ static newInstance = () => new Ct({
875
+ id: Q(),
875
876
  userName: "",
876
877
  password: "",
877
878
  groups: [],
@@ -883,53 +884,56 @@ const H = class kt extends ge {
883
884
  });
884
885
  };
885
886
  k([
886
- Q({
887
+ X({
887
888
  message: "archbase:Informe o nome de usuário"
888
889
  })
889
- ], H.prototype, "userName");
890
+ ], V.prototype, "userName");
890
891
  k([
891
- re()
892
- ], H.prototype, "changePasswordOnNextLogin");
892
+ te()
893
+ ], V.prototype, "changePasswordOnNextLogin");
893
894
  k([
894
- re()
895
- ], H.prototype, "allowPasswordChange");
895
+ te()
896
+ ], V.prototype, "allowPasswordChange");
896
897
  k([
897
- re()
898
- ], H.prototype, "allowMultipleLogins");
898
+ te()
899
+ ], V.prototype, "allowMultipleLogins");
899
900
  k([
900
- re()
901
- ], H.prototype, "passwordNeverExpires");
901
+ te()
902
+ ], V.prototype, "passwordNeverExpires");
902
903
  k([
903
- re()
904
- ], H.prototype, "accountDeactivated");
904
+ ie()
905
+ ], V.prototype, "passwordChangedAt");
905
906
  k([
906
- re()
907
- ], H.prototype, "accountLocked");
907
+ te()
908
+ ], V.prototype, "accountDeactivated");
908
909
  k([
909
- re()
910
- ], H.prototype, "unlimitedAccessHours");
910
+ te()
911
+ ], V.prototype, "accountLocked");
911
912
  k([
912
- re()
913
- ], H.prototype, "isAdministrator");
913
+ te()
914
+ ], V.prototype, "unlimitedAccessHours");
914
915
  k([
915
- de()
916
- ], H.prototype, "accessSchedule");
916
+ te()
917
+ ], V.prototype, "isAdministrator");
917
918
  k([
918
- de()
919
- ], H.prototype, "groups");
919
+ ie()
920
+ ], V.prototype, "accessSchedule");
920
921
  k([
921
- de()
922
- ], H.prototype, "profile");
922
+ ie()
923
+ ], V.prototype, "groups");
923
924
  k([
924
- $t(
925
+ ie()
926
+ ], V.prototype, "profile");
927
+ k([
928
+ jt(
925
929
  {},
926
930
  {
927
931
  message: "archbase:Informe um email válido"
928
932
  }
929
933
  )
930
- ], H.prototype, "email");
931
- let Re = H;
932
- const He = class ze {
934
+ ], V.prototype, "email");
935
+ let Ne = V;
936
+ const Je = class Fe {
933
937
  id;
934
938
  code;
935
939
  version;
@@ -943,35 +947,35 @@ const He = class ze {
943
947
  companyId;
944
948
  projectId;
945
949
  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 ? ze.createDtoFromJson(e.security) : void 0, this.action = e.action ? new wr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
950
+ 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 ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new br(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
947
951
  }
948
952
  static createDtoFromJson(e) {
949
953
  switch (e.type) {
950
954
  case "profile":
951
- return new Ee(e);
955
+ return new ke(e);
952
956
  case "group":
953
- return new xe(e);
957
+ return new Se(e);
954
958
  case "user":
955
- return new Re(e);
959
+ return new Ne(e);
956
960
  default:
957
961
  throw new Error("Unknown DTO type");
958
962
  }
959
963
  }
960
- static newInstance = () => new ze({
961
- id: Z(),
964
+ static newInstance = () => new Fe({
965
+ id: Q(),
962
966
  tenantId: "",
963
967
  companyId: "",
964
968
  projectId: ""
965
969
  });
966
970
  };
967
971
  k([
968
- de()
969
- ], He.prototype, "security");
972
+ ie()
973
+ ], Je.prototype, "security");
970
974
  k([
971
- de()
972
- ], He.prototype, "action");
973
- let Fr = He;
974
- class Ge {
975
+ ie()
976
+ ], Je.prototype, "action");
977
+ let Wr = Je;
978
+ class Ke {
975
979
  id;
976
980
  code;
977
981
  version;
@@ -989,13 +993,13 @@ class Ge {
989
993
  activated;
990
994
  isNovoToken;
991
995
  constructor(e) {
992
- 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.tenantId = e.tenantId || "", this.user = e.user ? new Re(e.user) : void 0, this.name = e.name || "", this.description = e.description || "", this.token = e.token || "", this.expirationDate = e.expirationDate, this.revoked = e.revoked, this.activated = e.activated || !1;
996
+ 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.tenantId = e.tenantId || "", this.user = e.user ? new Ne(e.user) : void 0, this.name = e.name || "", this.description = e.description || "", this.token = e.token || "", this.expirationDate = e.expirationDate, this.revoked = e.revoked, this.activated = e.activated || !1;
993
997
  }
994
- static newInstance = () => new Ge({
995
- id: Z()
998
+ static newInstance = () => new Ke({
999
+ id: Q()
996
1000
  });
997
1001
  }
998
- class Je {
1002
+ class qe {
999
1003
  id;
1000
1004
  code;
1001
1005
  version;
@@ -1012,15 +1016,15 @@ class Je {
1012
1016
  user;
1013
1017
  isNewAccessToken;
1014
1018
  constructor(e) {
1015
- 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.token = e.token || "", this.tokenType = e.tokenType || void 0, this.user = e.user ? new Re(e.user) : void 0, this.revoked = e.revoked || !1, this.expired = e.expired || !1, this.expirationTime = e.expirationTime || 0, this.expirationDate = e.expirationDate || "", this.isNewAccessToken = e.isNewAccessToken || !1;
1019
+ 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.token = e.token || "", this.tokenType = e.tokenType || void 0, this.user = e.user ? new Ne(e.user) : void 0, this.revoked = e.revoked || !1, this.expired = e.expired || !1, this.expirationTime = e.expirationTime || 0, this.expirationDate = e.expirationDate || "", this.isNewAccessToken = e.isNewAccessToken || !1;
1016
1020
  }
1017
- static newInstance = () => new Je({
1018
- id: Z(),
1021
+ static newInstance = () => new qe({
1022
+ id: Q(),
1019
1023
  active: !0,
1020
1024
  isNewAccessToken: !0
1021
1025
  });
1022
1026
  }
1023
- class St extends me {
1027
+ class It extends ye {
1024
1028
  constructor(e) {
1025
1029
  super(e);
1026
1030
  }
@@ -1028,7 +1032,7 @@ class St extends me {
1028
1032
  return J.getInstance().getHeaders();
1029
1033
  }
1030
1034
  transform(e) {
1031
- return new Re(e);
1035
+ return new Ne(e);
1032
1036
  }
1033
1037
  getEndpoint() {
1034
1038
  return "/api/v1/user";
@@ -1047,9 +1051,9 @@ class St extends me {
1047
1051
  return this.transform(t);
1048
1052
  }
1049
1053
  }
1050
- U.decorate(U.inject(X.ApiClient), St, 0);
1051
- U.decorate(U.injectable(), St);
1052
- class It extends me {
1054
+ P.decorate(P.inject(Y.ApiClient), It, 0);
1055
+ P.decorate(P.injectable(), It);
1056
+ class Pt extends ye {
1053
1057
  constructor(e) {
1054
1058
  super(e);
1055
1059
  }
@@ -1057,7 +1061,7 @@ class It extends me {
1057
1061
  return J.getInstance().getHeaders();
1058
1062
  }
1059
1063
  transform(e) {
1060
- return new xe(e);
1064
+ return new Se(e);
1061
1065
  }
1062
1066
  getEndpoint() {
1063
1067
  return "/api/v1/group";
@@ -1069,9 +1073,9 @@ class It extends me {
1069
1073
  return e.isNewGroup;
1070
1074
  }
1071
1075
  }
1072
- U.decorate(U.inject(X.ApiClient), It, 0);
1073
- U.decorate(U.injectable(), It);
1074
- class Ct extends me {
1076
+ P.decorate(P.inject(Y.ApiClient), Pt, 0);
1077
+ P.decorate(P.injectable(), Pt);
1078
+ class Tt extends ye {
1075
1079
  constructor(e) {
1076
1080
  super(e);
1077
1081
  }
@@ -1079,7 +1083,7 @@ class Ct extends me {
1079
1083
  return J.getInstance().getHeaders();
1080
1084
  }
1081
1085
  transform(e) {
1082
- return new Ee(e);
1086
+ return new ke(e);
1083
1087
  }
1084
1088
  getEndpoint() {
1085
1089
  return "/api/v1/userProfile";
@@ -1091,9 +1095,9 @@ class Ct extends me {
1091
1095
  return e.isNewProfile;
1092
1096
  }
1093
1097
  }
1094
- U.decorate(U.inject(X.ApiClient), Ct, 0);
1095
- U.decorate(U.injectable(), Ct);
1096
- class Pt extends me {
1098
+ P.decorate(P.inject(Y.ApiClient), Tt, 0);
1099
+ P.decorate(P.injectable(), Tt);
1100
+ class Ut extends ye {
1097
1101
  constructor(e) {
1098
1102
  super(e);
1099
1103
  }
@@ -1101,7 +1105,7 @@ class Pt extends me {
1101
1105
  return J.getInstance().getHeaders();
1102
1106
  }
1103
1107
  transform(e) {
1104
- return new Ge(e);
1108
+ return new Ke(e);
1105
1109
  }
1106
1110
  getEndpoint() {
1107
1111
  return "/api/v1/apiToken";
@@ -1128,9 +1132,9 @@ class Pt extends me {
1128
1132
  );
1129
1133
  }
1130
1134
  }
1131
- U.decorate(U.inject(X.ApiClient), Pt, 0);
1132
- U.decorate(U.injectable(), Pt);
1133
- class Tt extends me {
1135
+ P.decorate(P.inject(Y.ApiClient), Ut, 0);
1136
+ P.decorate(P.injectable(), Ut);
1137
+ class Dt extends ye {
1134
1138
  constructor(e) {
1135
1139
  super(e);
1136
1140
  }
@@ -1138,7 +1142,7 @@ class Tt extends me {
1138
1142
  return J.getInstance().getHeaders();
1139
1143
  }
1140
1144
  transform(e) {
1141
- return new Je(e);
1145
+ return new qe(e);
1142
1146
  }
1143
1147
  getEndpoint() {
1144
1148
  return "/api/v1/accessToken";
@@ -1157,9 +1161,9 @@ class Tt extends me {
1157
1161
  );
1158
1162
  }
1159
1163
  }
1160
- U.decorate(U.inject(X.ApiClient), Tt, 0);
1161
- U.decorate(U.injectable(), Tt);
1162
- class Ut extends me {
1164
+ P.decorate(P.inject(Y.ApiClient), Dt, 0);
1165
+ P.decorate(P.injectable(), Dt);
1166
+ class _t extends ye {
1163
1167
  constructor(e) {
1164
1168
  super(e);
1165
1169
  }
@@ -1167,7 +1171,7 @@ class Ut extends me {
1167
1171
  return J.getInstance().getHeaders();
1168
1172
  }
1169
1173
  transform(e) {
1170
- return new xt(e);
1174
+ return new St(e);
1171
1175
  }
1172
1176
  getEndpoint() {
1173
1177
  return "/api/v1/resource";
@@ -1191,7 +1195,7 @@ class Ut extends me {
1191
1195
  !1,
1192
1196
  {
1193
1197
  params: {
1194
- type: Ye(fe, t)
1198
+ type: Qe(ge, t)
1195
1199
  }
1196
1200
  }
1197
1201
  );
@@ -1202,7 +1206,7 @@ class Ut extends me {
1202
1206
  {
1203
1207
  securityId: e,
1204
1208
  actionId: t,
1205
- type: Ye(fe, s)
1209
+ type: Qe(ge, s)
1206
1210
  },
1207
1211
  this.configureHeaders()
1208
1212
  );
@@ -1221,9 +1225,9 @@ class Ut extends me {
1221
1225
  );
1222
1226
  }
1223
1227
  }
1224
- U.decorate(U.inject(X.ApiClient), Ut, 0);
1225
- U.decorate(U.injectable(), Ut);
1226
- function Vr({
1228
+ P.decorate(P.inject(Y.ApiClient), _t, 0);
1229
+ P.decorate(P.injectable(), _t);
1230
+ function Hr({
1227
1231
  onLogin: r,
1228
1232
  error: e,
1229
1233
  onClickForgotPassword: t,
@@ -1233,76 +1237,76 @@ function Vr({
1233
1237
  showMockUsersSelector: c = !1,
1234
1238
  mockUsers: i = [],
1235
1239
  mockUsersGroupMap: l,
1236
- options: g = {},
1240
+ options: y = {},
1237
1241
  onChangeUsername: E,
1238
1242
  disabledLogin: d = !1,
1239
- isCheckingUsername: _ = !1,
1240
- showSignIn: v = !0,
1241
- mfaRequired: f = !1,
1243
+ isCheckingUsername: R = !1,
1244
+ showSignIn: A = !0,
1245
+ mfaRequired: g = !1,
1242
1246
  onVerifyMfa: S,
1243
1247
  mfaError: D,
1244
- onCancelMfa: B,
1245
- isVerifyingMfa: O = !1
1248
+ onCancelMfa: N,
1249
+ isVerifyingMfa: B = !1
1246
1250
  }) {
1247
- const F = lt(), {
1248
- username: N,
1249
- password: w,
1250
- rememberMe: m,
1251
- clearRememberMe: R
1252
- } = zt(), [V, C] = h(N), [L, q] = h(w), [ee, Y] = h(m), [ie, p] = h(!1), [y, te] = h(null), [T, ue] = h("");
1251
+ const W = ut(), {
1252
+ username: M,
1253
+ password: b,
1254
+ rememberMe: w,
1255
+ clearRememberMe: T
1256
+ } = Ft(), [z, O] = p(M), [L, U] = p(b), [Z, q] = p(w), [re, f] = p(!1), [v, ee] = p(null), [I, he] = p("");
1253
1257
  K(() => {
1254
- p(!!e);
1258
+ f(!!e);
1255
1259
  }, [e]), K(() => {
1256
- N !== V && (C(N), E?.(N)), w !== L && q(w), m !== ee && Y(m);
1257
- }, [N, w, m]);
1260
+ M !== z && (O(M), E?.(M)), b !== L && U(b), w !== Z && q(w);
1261
+ }, [M, b, w]);
1258
1262
  const se = () => {
1259
- p(!1);
1260
- }, we = () => {
1261
- V && L && r(V, L, ee).finally(() => p(!0));
1262
- }, u = () => {
1263
- const A = T.trim();
1264
- A && S && S(A);
1265
- }, b = () => {
1263
+ f(!1);
1264
+ }, be = () => {
1265
+ z && L && r(z, L, Z).finally(() => f(!0));
1266
+ }, ae = () => {
1267
+ const h = I.trim();
1268
+ h && S && S(h);
1269
+ }, ue = () => {
1266
1270
  if (!l)
1267
- return i.map((M) => ({
1268
- value: M.email,
1269
- label: M.email
1271
+ return i.map((m) => ({
1272
+ value: m.email,
1273
+ label: m.email
1270
1274
  }));
1271
- const A = i.reduce((M, ve) => {
1272
- const ke = l[ve.type];
1273
- return ke && (M[ke] || (M[ke] = []), M[ke].push({
1274
- value: ve.email,
1275
- label: ve.email
1276
- })), M;
1275
+ const h = i.reduce((m, _) => {
1276
+ const j = l[_.type];
1277
+ return j && (m[j] || (m[j] = []), m[j].push({
1278
+ value: _.email,
1279
+ label: _.email
1280
+ })), m;
1277
1281
  }, {});
1278
- return Object.entries(A).map(([M, ve]) => ({
1279
- group: M,
1280
- items: ve
1282
+ return Object.entries(h).map(([m, _]) => ({
1283
+ group: m,
1284
+ items: _
1281
1285
  }));
1282
- }, I = () => {
1283
- if (y) {
1284
- const A = i.find((M) => M.email === y);
1285
- A && (C(A.email), q(A.password), se());
1286
+ }, pe = () => {
1287
+ if (v) {
1288
+ const h = i.find((m) => m.email === v);
1289
+ h && (O(h.email), U(h.password), se());
1286
1290
  }
1287
- }, $ = {
1291
+ }, u = {
1288
1292
  withBorder: !0,
1289
1293
  shadow: "md",
1290
1294
  p: 30,
1291
1295
  mt: 30,
1292
1296
  radius: "md",
1293
1297
  w: 400,
1294
- ...g.cardProps
1298
+ ...y.cardProps
1295
1299
  };
1296
- return /* @__PURE__ */ P(
1297
- Ve,
1300
+ return /* @__PURE__ */ C(
1301
+ He,
1298
1302
  {
1299
- ...$,
1303
+ ...u,
1300
1304
  pos: "relative",
1301
- ref: F,
1305
+ ref: W,
1302
1306
  children: [
1303
- v && /* @__PURE__ */ P(ne, { children: [
1307
+ A && /* @__PURE__ */ C(ne, { children: [
1304
1308
  /* @__PURE__ */ n(
1305
- j,
1309
+ F,
1306
1310
  {
1307
1311
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1308
1312
  fw: 800,
@@ -1312,123 +1316,123 @@ function Vr({
1312
1316
  children: x().t("archbase:signIn")
1313
1317
  }
1314
1318
  ),
1315
- /* @__PURE__ */ n(Te, { m: "md" })
1319
+ /* @__PURE__ */ n(Ue, { m: "md" })
1316
1320
  ] }),
1317
- g?.customContentBefore,
1318
- f && /* @__PURE__ */ P(be, { gap: "md", children: [
1319
- /* @__PURE__ */ P("div", { children: [
1320
- /* @__PURE__ */ n(j, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
1321
- /* @__PURE__ */ n(j, { c: "dimmed", fz: "sm", children: x().t(
1321
+ y?.customContentBefore,
1322
+ g && /* @__PURE__ */ C(Ee, { gap: "md", children: [
1323
+ /* @__PURE__ */ C("div", { children: [
1324
+ /* @__PURE__ */ n(F, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
1325
+ /* @__PURE__ */ n(F, { c: "dimmed", fz: "sm", children: x().t(
1322
1326
  "archbase:mfa.subtitle",
1323
1327
  "Digite o código do seu aplicativo autenticador (ou um código de recuperação)."
1324
1328
  ) })
1325
1329
  ] }),
1326
1330
  /* @__PURE__ */ n(
1327
- Ae,
1331
+ xe,
1328
1332
  {
1329
1333
  label: x().t("archbase:mfa.code", "Código de verificação"),
1330
1334
  placeholder: "000000",
1331
- value: T,
1335
+ value: I,
1332
1336
  autoFocus: !0,
1333
- onChange: (A) => ue(A.currentTarget.value),
1334
- onKeyDown: (A) => {
1335
- A.key === "Enter" && u();
1337
+ onChange: (h) => he(h.currentTarget.value),
1338
+ onKeyDown: (h) => {
1339
+ h.key === "Enter" && ae();
1336
1340
  }
1337
1341
  }
1338
1342
  ),
1339
- D && /* @__PURE__ */ n(j, { c: "red", fz: "sm", children: D }),
1343
+ D && /* @__PURE__ */ n(F, { c: "red", fz: "sm", children: D }),
1340
1344
  /* @__PURE__ */ n(
1341
- W,
1345
+ H,
1342
1346
  {
1343
1347
  fullWidth: !0,
1344
- disabled: !T.trim() || O,
1345
- loading: O,
1346
- onClick: u,
1348
+ disabled: !I.trim() || B,
1349
+ loading: B,
1350
+ onClick: ae,
1347
1351
  children: x().t("archbase:mfa.verify", "Verificar")
1348
1352
  }
1349
1353
  ),
1350
- B && /* @__PURE__ */ n(
1351
- Qe,
1354
+ N && /* @__PURE__ */ n(
1355
+ et,
1352
1356
  {
1353
1357
  component: "button",
1354
1358
  c: "var(--mantine-text-color)",
1355
1359
  fz: 14,
1356
1360
  ta: "center",
1357
1361
  styles: { root: { cursor: "pointer" } },
1358
- onClick: B,
1362
+ onClick: N,
1359
1363
  children: x().t("archbase:mfa.back", "Voltar ao login")
1360
1364
  }
1361
1365
  )
1362
1366
  ] }),
1363
- !f && /* @__PURE__ */ P(ne, { children: [
1364
- c && /* @__PURE__ */ P(ne, { children: [
1365
- /* @__PURE__ */ P(le, { gap: "sm", mb: "md", children: [
1367
+ !g && /* @__PURE__ */ C(ne, { children: [
1368
+ c && /* @__PURE__ */ C(ne, { children: [
1369
+ /* @__PURE__ */ C(de, { gap: "sm", mb: "md", children: [
1366
1370
  /* @__PURE__ */ n(
1367
- Ht,
1371
+ Jt,
1368
1372
  {
1369
1373
  placeholder: "Selecione um usuário mock",
1370
- data: b(),
1371
- value: y,
1372
- onChange: (A) => te(A ?? ""),
1374
+ data: ue(),
1375
+ value: v,
1376
+ onChange: (h) => ee(h ?? ""),
1373
1377
  searchable: !0,
1374
1378
  clearable: !0,
1375
1379
  style: { flexGrow: 1 }
1376
1380
  }
1377
1381
  ),
1378
- /* @__PURE__ */ n(Gt, { label: "Aplicar", children: /* @__PURE__ */ n(
1379
- W,
1382
+ /* @__PURE__ */ n(Kt, { label: "Aplicar", children: /* @__PURE__ */ n(
1383
+ H,
1380
1384
  {
1381
1385
  variant: "light",
1382
1386
  size: "sm",
1383
- onClick: I,
1384
- disabled: !y,
1387
+ onClick: pe,
1388
+ disabled: !v,
1385
1389
  "aria-label": "Aplicar usuário mock selecionado",
1386
- children: /* @__PURE__ */ n(Xt, { size: 16 })
1390
+ children: /* @__PURE__ */ n(Zt, { size: 16 })
1387
1391
  }
1388
1392
  ) })
1389
1393
  ] }),
1390
- /* @__PURE__ */ n(Te, { mb: "md" })
1394
+ /* @__PURE__ */ n(Ue, { mb: "md" })
1391
1395
  ] }),
1392
1396
  /* @__PURE__ */ n(
1393
- Ae,
1397
+ xe,
1394
1398
  {
1395
1399
  label: s,
1396
1400
  placeholder: o ?? x().t("archbase:usuario@email.com"),
1397
- rightSection: _ ? /* @__PURE__ */ n(ct, { size: "xs" }) : null,
1398
- value: V || "",
1401
+ rightSection: R ? /* @__PURE__ */ n(dt, { size: "xs" }) : null,
1402
+ value: z || "",
1399
1403
  required: !0,
1400
- onChange: (A) => {
1401
- C(A.currentTarget.value), E?.(A.currentTarget.value), se();
1404
+ onChange: (h) => {
1405
+ O(h.currentTarget.value), E?.(h.currentTarget.value), se();
1402
1406
  }
1403
1407
  }
1404
1408
  ),
1405
1409
  /* @__PURE__ */ n(
1406
- Le,
1410
+ ze,
1407
1411
  {
1408
1412
  label: x().t("archbase:Password"),
1409
1413
  placeholder: x().t("archbase:Sua senha"),
1410
- onChange: (A) => {
1411
- q(A.currentTarget.value), se();
1414
+ onChange: (h) => {
1415
+ U(h.currentTarget.value), se();
1412
1416
  },
1413
1417
  value: L || "",
1414
1418
  required: !0,
1415
1419
  mt: "md"
1416
1420
  }
1417
1421
  ),
1418
- /* @__PURE__ */ P(le, { justify: "space-between", mt: "md", children: [
1422
+ /* @__PURE__ */ C(de, { justify: "space-between", mt: "md", children: [
1419
1423
  /* @__PURE__ */ n(
1420
- Jt,
1424
+ qt,
1421
1425
  {
1422
1426
  label: x().t("archbase:Lembre-me"),
1423
- checked: ee,
1424
- onChange: (A) => {
1425
- const M = A.currentTarget.checked;
1426
- Y(M), M || R();
1427
+ checked: Z,
1428
+ onChange: (h) => {
1429
+ const m = h.currentTarget.checked;
1430
+ q(m), m || T();
1427
1431
  }
1428
1432
  }
1429
1433
  ),
1430
1434
  t && /* @__PURE__ */ n(
1431
- Qe,
1435
+ et,
1432
1436
  {
1433
1437
  component: "button",
1434
1438
  c: "var(--mantine-text-color)",
@@ -1440,168 +1444,168 @@ function Vr({
1440
1444
  }
1441
1445
  )
1442
1446
  ] }),
1443
- g?.afterInputs || a,
1447
+ y?.afterInputs || a,
1444
1448
  /* @__PURE__ */ n(
1445
- W,
1449
+ H,
1446
1450
  {
1447
- disabled: !L || !V || d,
1451
+ disabled: !L || !z || d,
1448
1452
  fullWidth: !0,
1449
1453
  mt: "xl",
1450
- onClick: we,
1454
+ onClick: be,
1451
1455
  children: x().t("archbase:signIn")
1452
1456
  }
1453
1457
  )
1454
1458
  ] }),
1455
- g?.customContentAfter,
1456
- ie && e && /* @__PURE__ */ n(j, { c: "red", mt: "sm", children: e })
1459
+ y?.customContentAfter,
1460
+ re && e && /* @__PURE__ */ n(F, { c: "red", mt: "sm", children: e })
1457
1461
  ]
1458
1462
  }
1459
1463
  );
1460
1464
  }
1461
- const z = (r, e) => x().t(r, e);
1462
- function Wr({
1465
+ const $ = (r, e) => x().t(r, e);
1466
+ function Gr({
1463
1467
  enabled: r,
1464
1468
  onSetup: e,
1465
1469
  onEnable: t,
1466
1470
  onDisable: s,
1467
1471
  onStatusChange: o
1468
1472
  }) {
1469
- const [a, c] = h("idle"), [i, l] = h(null), [g, E] = h(""), [d, _] = h([]), [v, f] = h(!1), [S, D] = h(null), B = async () => {
1470
- f(!0), D(null);
1473
+ const [a, c] = p("idle"), [i, l] = p(null), [y, E] = p(""), [d, R] = p([]), [A, g] = p(!1), [S, D] = p(null), N = async () => {
1474
+ g(!0), D(null);
1471
1475
  try {
1472
- const w = await e();
1473
- l(w), E(""), c("setup");
1474
- } catch (w) {
1475
- D(w?.message || String(w));
1476
+ const b = await e();
1477
+ l(b), E(""), c("setup");
1478
+ } catch (b) {
1479
+ D(b?.message || String(b));
1476
1480
  } finally {
1477
- f(!1);
1481
+ g(!1);
1478
1482
  }
1479
- }, O = async () => {
1480
- const w = g.trim();
1481
- if (w) {
1482
- f(!0), D(null);
1483
+ }, B = async () => {
1484
+ const b = y.trim();
1485
+ if (b) {
1486
+ g(!0), D(null);
1483
1487
  try {
1484
- const m = await t(w);
1485
- _(m), c("recovery"), o?.(!0);
1486
- } catch (m) {
1487
- D(m?.message || String(m));
1488
+ const w = await t(b);
1489
+ R(w), c("recovery"), o?.(!0);
1490
+ } catch (w) {
1491
+ D(w?.message || String(w));
1488
1492
  } finally {
1489
- f(!1);
1493
+ g(!1);
1490
1494
  }
1491
1495
  }
1492
- }, F = async () => {
1493
- f(!0), D(null);
1496
+ }, W = async () => {
1497
+ g(!0), D(null);
1494
1498
  try {
1495
- await s(), l(null), _([]), c("idle"), o?.(!1);
1496
- } catch (w) {
1497
- D(w?.message || String(w));
1499
+ await s(), l(null), R([]), c("idle"), o?.(!1);
1500
+ } catch (b) {
1501
+ D(b?.message || String(b));
1498
1502
  } finally {
1499
- f(!1);
1503
+ g(!1);
1500
1504
  }
1501
- }, N = () => {
1502
- _([]), l(null), E(""), c("idle");
1505
+ }, M = () => {
1506
+ R([]), l(null), E(""), c("idle");
1503
1507
  };
1504
- return /* @__PURE__ */ n(Ve, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ P(be, { gap: "md", children: [
1505
- /* @__PURE__ */ P("div", { children: [
1506
- /* @__PURE__ */ n(j, { fw: 700, fz: "lg", children: z("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1507
- /* @__PURE__ */ n(j, { c: "dimmed", fz: "sm", children: z(
1508
+ return /* @__PURE__ */ n(He, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
1509
+ /* @__PURE__ */ C("div", { children: [
1510
+ /* @__PURE__ */ n(F, { fw: 700, fz: "lg", children: $("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1511
+ /* @__PURE__ */ n(F, { c: "dimmed", fz: "sm", children: $(
1508
1512
  "archbase:mfa.setup.subtitle",
1509
1513
  "Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
1510
1514
  ) })
1511
1515
  ] }),
1512
- S && /* @__PURE__ */ n(Ze, { color: "red", children: S }),
1513
- r && a === "idle" && /* @__PURE__ */ P(le, { justify: "space-between", children: [
1514
- /* @__PURE__ */ n(j, { c: "teal", fw: 600, children: z("archbase:mfa.setup.active", "MFA ativo") }),
1515
- /* @__PURE__ */ n(W, { color: "red", variant: "light", loading: v, onClick: F, children: z("archbase:mfa.setup.disable", "Desativar") })
1516
+ S && /* @__PURE__ */ n(tt, { color: "red", children: S }),
1517
+ r && a === "idle" && /* @__PURE__ */ C(de, { justify: "space-between", children: [
1518
+ /* @__PURE__ */ n(F, { c: "teal", fw: 600, children: $("archbase:mfa.setup.active", "MFA ativo") }),
1519
+ /* @__PURE__ */ n(H, { color: "red", variant: "light", loading: A, onClick: W, children: $("archbase:mfa.setup.disable", "Desativar") })
1516
1520
  ] }),
1517
- !r && a === "idle" && /* @__PURE__ */ n(W, { loading: v, onClick: B, children: z("archbase:mfa.setup.enable", "Ativar MFA") }),
1518
- a === "setup" && i && /* @__PURE__ */ P(be, { gap: "sm", align: "center", children: [
1519
- /* @__PURE__ */ n(j, { fz: "sm", ta: "center", children: z(
1521
+ !r && a === "idle" && /* @__PURE__ */ n(H, { loading: A, onClick: N, children: $("archbase:mfa.setup.enable", "Ativar MFA") }),
1522
+ a === "setup" && i && /* @__PURE__ */ C(Ee, { gap: "sm", align: "center", children: [
1523
+ /* @__PURE__ */ n(F, { fz: "sm", ta: "center", children: $(
1520
1524
  "archbase:mfa.setup.scan",
1521
1525
  "Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
1522
1526
  ) }),
1523
- /* @__PURE__ */ n(Qt, { value: i.provisioningUri, size: 180, level: "M" }),
1524
- /* @__PURE__ */ n(j, { fz: "xs", c: "dimmed", ta: "center", children: z("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1525
- /* @__PURE__ */ P(le, { gap: "xs", children: [
1526
- /* @__PURE__ */ n(et, { children: i.secret }),
1527
- /* @__PURE__ */ n(tt, { value: i.secret, children: ({ copied: w, copy: m }) => /* @__PURE__ */ n(W, { size: "xs", variant: "subtle", onClick: m, children: w ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copy", "Copiar") }) })
1527
+ /* @__PURE__ */ n(er, { value: i.provisioningUri, size: 180, level: "M" }),
1528
+ /* @__PURE__ */ n(F, { fz: "xs", c: "dimmed", ta: "center", children: $("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1529
+ /* @__PURE__ */ C(de, { gap: "xs", children: [
1530
+ /* @__PURE__ */ n(rt, { children: i.secret }),
1531
+ /* @__PURE__ */ n(st, { value: i.secret, children: ({ copied: b, copy: w }) => /* @__PURE__ */ n(H, { size: "xs", variant: "subtle", onClick: w, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copy", "Copiar") }) })
1528
1532
  ] }),
1529
1533
  /* @__PURE__ */ n(
1530
- Ae,
1534
+ xe,
1531
1535
  {
1532
1536
  w: "100%",
1533
- label: z("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1537
+ label: $("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1534
1538
  placeholder: "000000",
1535
- value: g,
1536
- onChange: (w) => E(w.currentTarget.value),
1537
- onKeyDown: (w) => {
1538
- w.key === "Enter" && O();
1539
+ value: y,
1540
+ onChange: (b) => E(b.currentTarget.value),
1541
+ onKeyDown: (b) => {
1542
+ b.key === "Enter" && B();
1539
1543
  }
1540
1544
  }
1541
1545
  ),
1542
- /* @__PURE__ */ P(le, { w: "100%", justify: "flex-end", children: [
1543
- /* @__PURE__ */ n(W, { variant: "default", onClick: N, disabled: v, children: z("archbase:mfa.setup.cancel", "Cancelar") }),
1544
- /* @__PURE__ */ n(W, { onClick: O, loading: v, disabled: !g.trim(), children: z("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1546
+ /* @__PURE__ */ C(de, { w: "100%", justify: "flex-end", children: [
1547
+ /* @__PURE__ */ n(H, { variant: "default", onClick: M, disabled: A, children: $("archbase:mfa.setup.cancel", "Cancelar") }),
1548
+ /* @__PURE__ */ n(H, { onClick: B, loading: A, disabled: !y.trim(), children: $("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1545
1549
  ] })
1546
1550
  ] }),
1547
- a === "recovery" && /* @__PURE__ */ P(be, { gap: "sm", children: [
1548
- /* @__PURE__ */ n(Ze, { color: "yellow", children: z(
1551
+ a === "recovery" && /* @__PURE__ */ C(Ee, { gap: "sm", children: [
1552
+ /* @__PURE__ */ n(tt, { color: "yellow", children: $(
1549
1553
  "archbase:mfa.setup.recoveryWarning",
1550
1554
  "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."
1551
1555
  ) }),
1552
- /* @__PURE__ */ n(Kt, { cols: 2, spacing: "xs", children: d.map((w) => /* @__PURE__ */ n(et, { fz: "sm", children: w }, w)) }),
1553
- /* @__PURE__ */ P(le, { justify: "space-between", children: [
1554
- /* @__PURE__ */ n(tt, { value: d.join(`
1555
- `), children: ({ copied: w, copy: m }) => /* @__PURE__ */ n(W, { variant: "subtle", onClick: m, children: w ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1556
- /* @__PURE__ */ n(W, { onClick: N, children: z("archbase:mfa.setup.done", "Guardei os códigos") })
1556
+ /* @__PURE__ */ n(Yt, { cols: 2, spacing: "xs", children: d.map((b) => /* @__PURE__ */ n(rt, { fz: "sm", children: b }, b)) }),
1557
+ /* @__PURE__ */ C(de, { justify: "space-between", children: [
1558
+ /* @__PURE__ */ n(st, { value: d.join(`
1559
+ `), children: ({ copied: b, copy: w }) => /* @__PURE__ */ n(H, { variant: "subtle", onClick: w, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1560
+ /* @__PURE__ */ n(H, { onClick: M, children: $("archbase:mfa.setup.done", "Guardei os códigos") })
1557
1561
  ] })
1558
1562
  ] })
1559
1563
  ] }) });
1560
1564
  }
1561
- const vr = {
1565
+ const Ar = {
1562
1566
  position: "relative",
1563
1567
  width: "90%",
1564
1568
  maxWidth: 400,
1565
1569
  padding: 30,
1566
1570
  marginTop: 30
1567
1571
  };
1568
- function Hr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: c = "", description: i, style: l }) {
1569
- const g = lt(), E = jt(), { colorScheme: d } = qt(), [_, v] = h(r ?? ""), [f, S] = h(c), [D, B] = h(""), [O, F] = h(""), [N, w] = h(""), [m, R] = h(!1), [V, C] = h(""), [L, q] = h(""), [ee, Y] = h(""), [ie, p] = h("");
1570
- async function y(T) {
1571
- T && (Ft(T) ? await e(T).then(() => {
1572
- rt.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), R(!0);
1572
+ function Jr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: c = "", description: i, style: l }) {
1573
+ const y = ut(), E = Vt(), { colorScheme: d } = Xt(), [R, A] = p(r ?? ""), [g, S] = p(c), [D, N] = p(""), [B, W] = p(""), [M, b] = p(""), [w, T] = p(!1), [z, O] = p(""), [L, U] = p(""), [Z, q] = p(""), [re, f] = p("");
1574
+ async function v(I) {
1575
+ I && (Wt(I) ? await e(I).then(() => {
1576
+ ot.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), T(!0);
1573
1577
  }).catch(() => {
1574
- }) : C(`${x().t("archbase:Email inválido")}`));
1578
+ }) : O(`${x().t("archbase:Email inválido")}`));
1575
1579
  }
1576
- async function te(T, ue, se, we) {
1577
- if (T && ue && se) {
1578
- let u = "", b = "", I = "";
1579
- a && (u = a(), Y(u)), o && (b = o(), Y(b)), se !== we && (I = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, p(I)), !b && !u && await t(T, ue, se).then(() => {
1580
- rt.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), R(!1);
1580
+ async function ee(I, he, se, be) {
1581
+ if (I && he && se) {
1582
+ let ae = "", ue = "", pe = "";
1583
+ a && (ae = a(), q(ae)), o && (ue = o(), q(ue)), se !== be && (pe = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, f(pe)), !ue && !ae && await t(I, he, se).then(() => {
1584
+ ot.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), T(!1);
1581
1585
  }).catch(() => {
1582
- v(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
1586
+ A(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
1583
1587
  });
1584
1588
  }
1585
1589
  }
1586
1590
  return K(() => {
1587
- r && v(r);
1591
+ r && A(r);
1588
1592
  }, [r]), K(() => {
1589
- v("");
1590
- }, [f, D, O, N]), /* @__PURE__ */ P(
1591
- Ve,
1593
+ A("");
1594
+ }, [g, D, B, M]), /* @__PURE__ */ C(
1595
+ He,
1592
1596
  {
1593
1597
  withBorder: !0,
1594
1598
  shadow: "md",
1595
1599
  radius: "md",
1596
- ref: g,
1600
+ ref: y,
1597
1601
  style: {
1598
- ...vr,
1602
+ ...Ar,
1599
1603
  ...l
1600
1604
  },
1601
1605
  children: [
1602
- m ? /* @__PURE__ */ P(ne, { children: [
1606
+ w ? /* @__PURE__ */ C(ne, { children: [
1603
1607
  /* @__PURE__ */ n(
1604
- j,
1608
+ F,
1605
1609
  {
1606
1610
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1607
1611
  fw: 800,
@@ -1611,71 +1615,71 @@ function Hr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1611
1615
  children: x().t("archbase:Redefinir senha")
1612
1616
  }
1613
1617
  ),
1614
- /* @__PURE__ */ n(Te, { m: "xs" }),
1618
+ /* @__PURE__ */ n(Ue, { m: "xs" }),
1615
1619
  /* @__PURE__ */ n(
1616
- Ae,
1620
+ xe,
1617
1621
  {
1618
1622
  label: x().t("archbase:Código de segurança"),
1619
1623
  placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
1620
1624
  value: D || "",
1621
1625
  required: !0,
1622
- onChange: (T) => {
1623
- B(T.currentTarget.value), q("");
1626
+ onChange: (I) => {
1627
+ N(I.currentTarget.value), U("");
1624
1628
  },
1625
1629
  error: L
1626
1630
  }
1627
1631
  ),
1628
1632
  /* @__PURE__ */ n(
1629
- Le,
1633
+ ze,
1630
1634
  {
1631
1635
  label: x().t("archbase:Nova senha"),
1632
1636
  placeholder: x().t("archbase:Nova senha"),
1633
- onChange: (T) => {
1634
- F(T.currentTarget.value), Y(""), p("");
1637
+ onChange: (I) => {
1638
+ W(I.currentTarget.value), q(""), f("");
1635
1639
  },
1636
- value: O,
1640
+ value: B,
1637
1641
  required: !0,
1638
- error: ee
1642
+ error: Z
1639
1643
  }
1640
1644
  ),
1641
1645
  /* @__PURE__ */ n(
1642
- Le,
1646
+ ze,
1643
1647
  {
1644
1648
  label: x().t("archbase:Confirmar senha"),
1645
1649
  placeholder: x().t("archbase:Confirmar senha"),
1646
- onChange: (T) => {
1647
- w(T.currentTarget.value), p("");
1650
+ onChange: (I) => {
1651
+ b(I.currentTarget.value), f("");
1648
1652
  },
1649
- value: N || "",
1653
+ value: M || "",
1650
1654
  required: !0,
1651
- error: ie
1655
+ error: re
1652
1656
  }
1653
1657
  ),
1654
1658
  /* @__PURE__ */ n(
1655
- W,
1659
+ H,
1656
1660
  {
1657
- disabled: !f || !D || !O || !N,
1661
+ disabled: !g || !D || !B || !M,
1658
1662
  mt: "md",
1659
1663
  fullWidth: !0,
1660
- onClick: () => te(f, D, O, N),
1664
+ onClick: () => ee(g, D, B, M),
1661
1665
  children: `${x().t("archbase:Redefinir senha")}`
1662
1666
  }
1663
1667
  ),
1664
1668
  /* @__PURE__ */ n(
1665
- W,
1669
+ H,
1666
1670
  {
1667
1671
  mt: "6px",
1668
1672
  fullWidth: !0,
1669
1673
  color: d === "dark" ? E.colors.dark[4] : E.colors.gray[7],
1670
1674
  onClick: () => {
1671
- V || R(!1);
1675
+ z || T(!1);
1672
1676
  },
1673
1677
  children: `${x().t("archbase:Voltar")}`
1674
1678
  }
1675
1679
  )
1676
- ] }) : /* @__PURE__ */ P(ne, { children: [
1680
+ ] }) : /* @__PURE__ */ C(ne, { children: [
1677
1681
  /* @__PURE__ */ n(
1678
- j,
1682
+ F,
1679
1683
  {
1680
1684
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1681
1685
  fw: 800,
@@ -1685,33 +1689,33 @@ function Hr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1685
1689
  children: x().t("archbase:Redefinir senha")
1686
1690
  }
1687
1691
  ),
1688
- /* @__PURE__ */ n(j, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1689
- /* @__PURE__ */ n(Te, { m: "md" }),
1692
+ /* @__PURE__ */ n(F, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1693
+ /* @__PURE__ */ n(Ue, { m: "md" }),
1690
1694
  /* @__PURE__ */ n(
1691
- Ae,
1695
+ xe,
1692
1696
  {
1693
1697
  label: "Email",
1694
1698
  placeholder: `${x().t("archbase:usuario@email.com")}`,
1695
- value: f || "",
1699
+ value: g || "",
1696
1700
  required: !0,
1697
- onChange: (T) => {
1698
- S(T.currentTarget.value), C("");
1701
+ onChange: (I) => {
1702
+ S(I.currentTarget.value), O("");
1699
1703
  },
1700
- error: V
1704
+ error: z
1701
1705
  }
1702
1706
  ),
1703
1707
  /* @__PURE__ */ n(
1704
- W,
1708
+ H,
1705
1709
  {
1706
- disabled: !f,
1710
+ disabled: !g,
1707
1711
  mt: "md",
1708
1712
  fullWidth: !0,
1709
- onClick: () => y(f),
1713
+ onClick: () => v(g),
1710
1714
  children: `${x().t("archbase:Enviar")}`
1711
1715
  }
1712
1716
  ),
1713
1717
  /* @__PURE__ */ n(
1714
- W,
1718
+ H,
1715
1719
  {
1716
1720
  mt: "6px",
1717
1721
  fullWidth: !0,
@@ -1721,38 +1725,43 @@ function Hr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1721
1725
  }
1722
1726
  )
1723
1727
  ] }),
1724
- _ ? /* @__PURE__ */ n(j, { c: "red", style: { textAlign: "justify" }, children: _ }) : null
1728
+ R ? /* @__PURE__ */ n(F, { c: "red", style: { textAlign: "justify" }, children: R }) : null
1725
1729
  ]
1726
1730
  }
1727
1731
  );
1728
1732
  }
1729
- const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1730
- const s = at(Dt), o = br(), a = o?.isAdmin ?? !1, c = o?.id, i = it(c), l = nt(() => {
1733
+ const Er = () => Ht().user, Rt = "archbaseSecurityManagerStore", Kr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1734
+ const s = lt(Rt), o = Er(), a = o?.isAdmin ?? !1, c = o?.id, i = ct(c), l = at(() => {
1731
1735
  if (!t)
1732
1736
  return null;
1733
- const g = c ? `${r}_${c}` : r;
1734
- if (s && s.existsValue(g)) {
1735
- const d = s.getValue(g);
1737
+ const y = c ? `${r}_${c}` : r;
1738
+ if (s && s.existsValue(y)) {
1739
+ const d = s.getValue(y);
1736
1740
  if (d && d.isAdmin === a)
1737
1741
  return d;
1738
1742
  }
1739
- const E = new gt(r, e, a);
1740
- return s && c && s.setValue(g, E), E;
1743
+ const E = new wt(r, e, a);
1744
+ return s && c && s.setValue(y, E), E;
1741
1745
  }, [t, r, e, a, c]);
1742
1746
  return K(() => {
1743
1747
  i.current = c;
1744
1748
  }, [c]), { securityManager: l };
1745
- }, Jr = ({
1749
+ };
1750
+ function $e(r) {
1751
+ const e = r?.response?.data ?? r?.data ?? r;
1752
+ return e?.error === "CREDENTIALS_EXPIRED" || e?.requirePasswordChange === !0;
1753
+ }
1754
+ const qr = ({
1746
1755
  checkIntervalTokenHasExpired: r = 3e4,
1747
1756
  // Verificar a 30 segundos
1748
1757
  expirationThresholdOfToken: e = 300
1749
1758
  // Antecipar em 5 minutos
1750
1759
  }) => {
1751
- const t = Ue(
1752
- (u) => u.get(X.TokenManager)
1753
- ), s = Ue(
1754
- (u) => u.get(X.Authenticator)
1755
- ), [o, a] = h(null), [c, i] = h(!1), [l, g] = h(!0), [E, d] = h(!1), [_, v] = h(!1), [f, S] = h(""), [D, B] = h(""), [O, F] = h(null), [N, w] = h(!1), [m, R] = h(null), V = at(Dt), C = {
1760
+ const t = De(
1761
+ (u) => u.get(Y.TokenManager)
1762
+ ), s = De(
1763
+ (u) => u.get(Y.Authenticator)
1764
+ ), [o, a] = p(null), [c, i] = p(!1), [l, y] = p(!0), [E, d] = p(!1), [R, A] = p(!1), [g, S] = p(""), [D, N] = p(""), [B, W] = p(null), [M, b] = p(!1), [w, T] = p(!1), [z, O] = p(null), L = lt(Rt), U = {
1756
1765
  hasContextualLogin: typeof s.loginWithContext == "function",
1757
1766
  hasFlexibleLogin: typeof s.loginFlexible == "function",
1758
1767
  hasSocialLogin: typeof s.loginSocial == "function",
@@ -1761,173 +1770,178 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
1761
1770
  };
1762
1771
  K(() => {
1763
1772
  const u = t.getUsername();
1764
- if (u && u != "" && B(u), C.hasContextSupport && t.getContext) {
1765
- const I = t.getContext();
1766
- if (I)
1773
+ if (u && u != "" && N(u), U.hasContextSupport && t.getContext) {
1774
+ const m = t.getContext();
1775
+ if (m)
1767
1776
  try {
1768
- const $ = typeof I == "string" ? JSON.parse(I) : I;
1769
- F($);
1770
- } catch ($) {
1771
- console.warn("Erro ao carregar contexto salvo:", $);
1777
+ const _ = typeof m == "string" ? JSON.parse(m) : m;
1778
+ W(_);
1779
+ } catch (_) {
1780
+ console.warn("Erro ao carregar contexto salvo:", _);
1772
1781
  }
1773
1782
  }
1774
- const b = t.getToken();
1775
- b && (d(!0), S(""), v(!1), a(b)), g(!1);
1783
+ const h = t.getToken();
1784
+ h && (d(!0), S(""), A(!1), a(h)), y(!1);
1776
1785
  }, []);
1777
- const L = () => {
1778
- v(!1), S("");
1779
- }, q = (u) => {
1780
- i(!1), d(!1), t.clearToken(), u && t.clearUsernameAndPassword(), C.hasContextSupport && t.clearContext && t.clearContext(), B(""), F(null), S(""), v(!1), V.clearAllValues();
1781
- }, ee = async (u, b, I) => {
1786
+ const Z = () => {
1787
+ A(!1), S("");
1788
+ }, q = () => {
1789
+ T(!1);
1790
+ }, re = (u) => {
1791
+ i(!1), d(!1), t.clearToken(), u && t.clearUsernameAndPassword(), U.hasContextSupport && t.clearContext && t.clearContext(), N(""), W(null), S(""), A(!1), T(!1), L.clearAllValues();
1792
+ }, f = async (u, h, m) => {
1782
1793
  try {
1783
1794
  i(!0), d(!1);
1784
- const $ = await s.login(u, b);
1785
- t.saveToken($), I && t.saveUsernameAndPassword(u, b), t.saveUsername(u), B(u), a($), i(!1), d(!0);
1786
- } catch ($) {
1787
- i(!1), d(!1), S(oe($)), v(!0);
1795
+ const _ = await s.login(u, h);
1796
+ t.saveToken(_), m && t.saveUsernameAndPassword(u, h), t.saveUsername(u), N(u), a(_), i(!1), d(!0);
1797
+ } catch (_) {
1798
+ i(!1), d(!1), $e(_) && (N(u), T(!0)), S(oe(_)), A(!0);
1788
1799
  }
1789
- }, Y = async (u, b = !1) => {
1790
- if (!C.hasContextualLogin || !s.loginWithContext)
1800
+ }, v = async (u, h = !1) => {
1801
+ if (!U.hasContextualLogin || !s.loginWithContext)
1791
1802
  throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
1792
1803
  try {
1793
1804
  i(!0), d(!1);
1794
- const { context: I, user: $, ...A } = await s.loginWithContext(u);
1795
- if (A.mfa_required) {
1796
- R(A.challenge_token ?? null), w(!0), B(u.email), i(!1);
1805
+ const { context: m, user: _, ...j } = await s.loginWithContext(u);
1806
+ if (j.mfa_required) {
1807
+ O(j.challenge_token ?? null), b(!0), N(u.email), i(!1);
1797
1808
  return;
1798
1809
  }
1799
- const M = {
1810
+ const Ae = {
1800
1811
  scope: "",
1801
- ext_expires_in: A.expires_in,
1802
- ...A
1812
+ ext_expires_in: j.expires_in,
1813
+ ...j
1803
1814
  };
1804
- t.saveToken(M), b ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), C.hasContextSupport && t.saveContext && I && (t.saveContext(JSON.stringify(I)), F(I)), B(u.email), a(M), i(!1), d(!0);
1805
- } catch (I) {
1806
- throw i(!1), d(!1), S(oe(I)), v(!0), I;
1815
+ t.saveToken(Ae), h ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), U.hasContextSupport && t.saveContext && m && (t.saveContext(JSON.stringify(m)), W(m)), N(u.email), a(Ae), i(!1), d(!0);
1816
+ } catch (m) {
1817
+ throw i(!1), d(!1), $e(m) && (N(u.email), T(!0)), S(oe(m)), A(!0), m;
1807
1818
  }
1808
- }, ie = async (u) => {
1819
+ }, ee = async (u) => {
1809
1820
  if (!s.verifyMfa)
1810
1821
  throw new Error("verifyMfa não suportado por esta implementação do ArchbaseAuthenticator");
1811
- if (!m)
1822
+ if (!z)
1812
1823
  throw new Error("Nenhum desafio de MFA pendente");
1813
1824
  try {
1814
- i(!0), S(""), v(!1);
1815
- const b = await s.verifyMfa(m, u);
1816
- t.saveToken(b), t.saveUsername(D), a(b), w(!1), R(null), i(!1), d(!0);
1817
- } catch (b) {
1818
- throw i(!1), S(oe(b)), v(!0), b;
1825
+ i(!0), S(""), A(!1);
1826
+ const h = await s.verifyMfa(z, u);
1827
+ t.saveToken(h), t.saveUsername(D), a(h), b(!1), O(null), i(!1), d(!0);
1828
+ } catch (h) {
1829
+ throw i(!1), S(oe(h)), A(!0), h;
1819
1830
  }
1820
- }, p = () => {
1821
- w(!1), R(null), S(""), v(!1);
1822
- }, y = async (u, b = !1) => {
1823
- if (!C.hasFlexibleLogin || !s.loginFlexible)
1831
+ }, I = () => {
1832
+ b(!1), O(null), S(""), A(!1);
1833
+ }, he = async (u, h = !1) => {
1834
+ if (!U.hasFlexibleLogin || !s.loginFlexible)
1824
1835
  throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
1825
1836
  try {
1826
1837
  i(!0), d(!1);
1827
- const { context: I, user: $, ...A } = await s.loginFlexible(u), M = {
1838
+ const { context: m, user: _, ...j } = await s.loginFlexible(u), Ae = {
1828
1839
  scope: "",
1829
- ext_expires_in: A.expires_in,
1830
- ...A
1840
+ ext_expires_in: j.expires_in,
1841
+ ...j
1831
1842
  };
1832
- t.saveToken(M), b && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername($.email || u.identifier), C.hasContextSupport && t.saveContext && I && (t.saveContext(JSON.stringify(I)), F(I)), B($.email || u.identifier), a(M), i(!1), d(!0);
1833
- } catch (I) {
1834
- throw i(!1), d(!1), S(oe(I)), v(!0), I;
1843
+ t.saveToken(Ae), h && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(_.email || u.identifier), U.hasContextSupport && t.saveContext && m && (t.saveContext(JSON.stringify(m)), W(m)), N(_.email || u.identifier), a(Ae), i(!1), d(!0);
1844
+ } catch (m) {
1845
+ throw i(!1), d(!1), $e(m) && (N(u.identifier), T(!0)), S(oe(m)), A(!0), m;
1835
1846
  }
1836
- }, te = async (u) => {
1837
- if (!C.hasSocialLogin || !s.loginSocial)
1847
+ }, se = async (u) => {
1848
+ if (!U.hasSocialLogin || !s.loginSocial)
1838
1849
  throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
1839
1850
  try {
1840
1851
  i(!0), d(!1);
1841
- const { context: b, user: I, ...$ } = await s.loginSocial(u), A = {
1852
+ const { context: h, user: m, ..._ } = await s.loginSocial(u), j = {
1842
1853
  scope: "",
1843
- ext_expires_in: $.expires_in,
1844
- ...$
1854
+ ext_expires_in: _.expires_in,
1855
+ ..._
1845
1856
  };
1846
- t.saveToken(A), t.saveUsername(I.email), C.hasContextSupport && t.saveContext && b && (t.saveContext(JSON.stringify(b)), F(b)), B(I.email), a(A), i(!1), d(!0);
1847
- } catch (b) {
1848
- throw i(!1), d(!1), S(oe(b)), v(!0), b;
1857
+ t.saveToken(j), t.saveUsername(m.email), U.hasContextSupport && t.saveContext && h && (t.saveContext(JSON.stringify(h)), W(h)), N(m.email), a(j), i(!1), d(!0);
1858
+ } catch (h) {
1859
+ throw i(!1), d(!1), S(oe(h)), A(!0), h;
1849
1860
  }
1850
- }, T = async (u) => {
1851
- if (!C.hasRegistration || !s.register)
1861
+ }, be = async (u) => {
1862
+ if (!U.hasRegistration || !s.register)
1852
1863
  throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
1853
1864
  try {
1854
1865
  i(!0);
1855
- const b = await s.register(u);
1856
- return i(!1), b;
1857
- } catch (b) {
1858
- throw i(!1), S(oe(b)), v(!0), b;
1866
+ const h = await s.register(u);
1867
+ return i(!1), h;
1868
+ } catch (h) {
1869
+ throw i(!1), S(oe(h)), A(!0), h;
1859
1870
  }
1860
- }, ue = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, se = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
1871
+ }, ae = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, ue = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
1861
1872
  K(() => {
1862
1873
  const u = setInterval(() => {
1863
- o && o.access_token && t.isTokenExpired(o, e) && we();
1874
+ o && o.access_token && t.isTokenExpired(o, e) && pe();
1864
1875
  }, r);
1865
1876
  return () => {
1866
1877
  clearInterval(u);
1867
1878
  };
1868
1879
  }, [o]);
1869
- const we = async () => {
1880
+ const pe = async () => {
1870
1881
  if (o)
1871
1882
  try {
1872
1883
  const u = await s.refreshToken(o?.refresh_token);
1873
1884
  t.saveToken(u), a(u);
1874
1885
  } catch (u) {
1875
- console.error("Erro ao renovar o token:", u), q();
1886
+ console.error("Erro ao renovar o token:", u), re();
1876
1887
  }
1877
1888
  };
1878
1889
  return {
1879
1890
  // Métodos básicos (compatibilidade)
1880
- login: ee,
1881
- logout: q,
1891
+ login: f,
1892
+ logout: re,
1882
1893
  username: D,
1883
1894
  isAuthenticated: E,
1884
1895
  isAuthenticating: c,
1885
1896
  isInitializing: l,
1886
- isError: _,
1887
- error: f,
1888
- clearError: L,
1897
+ isError: R,
1898
+ error: g,
1899
+ clearError: Z,
1889
1900
  accessToken: o ? o.access_token : null,
1890
1901
  // Métodos opcionais para autenticação avançada
1891
- loginWithContext: C.hasContextualLogin ? Y : void 0,
1892
- loginFlexible: C.hasFlexibleLogin ? y : void 0,
1893
- loginSocial: C.hasSocialLogin ? te : void 0,
1894
- register: C.hasRegistration ? T : void 0,
1895
- getSupportedContexts: ue,
1896
- validateContext: se,
1902
+ loginWithContext: U.hasContextualLogin ? v : void 0,
1903
+ loginFlexible: U.hasFlexibleLogin ? he : void 0,
1904
+ loginSocial: U.hasSocialLogin ? se : void 0,
1905
+ register: U.hasRegistration ? be : void 0,
1906
+ getSupportedContexts: ae,
1907
+ validateContext: ue,
1897
1908
  // MFA / segundo fator (2 passos)
1898
- mfaRequired: N,
1899
- verifyMfa: typeof s.verifyMfa == "function" ? ie : void 0,
1900
- cancelMfa: p,
1909
+ mfaRequired: M,
1910
+ verifyMfa: typeof s.verifyMfa == "function" ? ee : void 0,
1911
+ cancelMfa: I,
1912
+ // Troca de senha obrigatória (CREDENTIALS_EXPIRED)
1913
+ passwordChangeRequired: w,
1914
+ clearPasswordChangeRequired: q,
1901
1915
  // Informações de contexto
1902
- context: O,
1916
+ context: B,
1903
1917
  // Detecção de capacidades
1904
- capabilities: C
1918
+ capabilities: U
1905
1919
  };
1906
- }, Kr = () => {
1907
- const r = Ue(
1908
- (s) => s.get(X.TokenManager)
1909
- ), [e, t] = h(null);
1920
+ }, Yr = () => {
1921
+ const r = De(
1922
+ (s) => s.get(Y.TokenManager)
1923
+ ), [e, t] = p(null);
1910
1924
  return K(() => {
1911
1925
  const s = r.getToken();
1912
1926
  s && t(s.access_token);
1913
1927
  }, []), {
1914
1928
  token: e
1915
1929
  };
1916
- }, qr = () => {
1917
- const r = Ue(
1918
- (l) => l.get(X.Authenticator)
1919
- ), [e, t] = h(!1), [s, o] = h("");
1930
+ }, Xr = () => {
1931
+ const r = De(
1932
+ (l) => l.get(Y.Authenticator)
1933
+ ), [e, t] = p(!1), [s, o] = p("");
1920
1934
  return {
1921
1935
  sendResetPasswordEmail: async (l) => {
1922
1936
  try {
1923
1937
  return await r.sendResetPasswordEmail(l);
1924
- } catch (g) {
1925
- throw o(oe(g)), t(!0), g;
1938
+ } catch (y) {
1939
+ throw o(oe(y)), t(!0), y;
1926
1940
  }
1927
1941
  },
1928
- resetPassword: async (l, g, E) => {
1942
+ resetPassword: async (l, y, E) => {
1929
1943
  try {
1930
- return await r.resetPassword(l, g, E);
1944
+ return await r.resetPassword(l, y, E);
1931
1945
  } catch (d) {
1932
1946
  throw o(oe(d)), t(!0), d;
1933
1947
  }
@@ -1938,36 +1952,36 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
1938
1952
  t(!1), o("");
1939
1953
  }
1940
1954
  };
1941
- }, Ar = () => /* @__PURE__ */ n(Yt, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ P(be, { gap: "md", children: [
1942
- /* @__PURE__ */ P(le, { gap: "sm", children: [
1943
- /* @__PURE__ */ n(ct, { size: "sm" }),
1944
- /* @__PURE__ */ n(j, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
1955
+ }, xr = () => /* @__PURE__ */ n(Qt, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
1956
+ /* @__PURE__ */ C(de, { gap: "sm", children: [
1957
+ /* @__PURE__ */ n(dt, { size: "sm" }),
1958
+ /* @__PURE__ */ n(F, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
1945
1959
  ] }),
1946
1960
  /* @__PURE__ */ n(Ie, { height: 40, radius: "sm" }),
1947
1961
  /* @__PURE__ */ n(Ie, { height: 200, radius: "sm" }),
1948
- /* @__PURE__ */ P(le, { gap: "md", children: [
1962
+ /* @__PURE__ */ C(de, { gap: "md", children: [
1949
1963
  /* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" }),
1950
1964
  /* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" })
1951
1965
  ] })
1952
- ] }) }), Ke = je(null), Yr = ({
1966
+ ] }) }), Ye = Ve(null), Qr = ({
1953
1967
  children: r,
1954
1968
  user: e,
1955
1969
  onError: t
1956
1970
  }) => {
1957
- const [s, o] = h(!1), [a, c] = h(null), [i] = h([]), l = e?.isAdministrator || !1, g = Se((f) => l ? !0 : i.includes(f), [i, l]), E = Se((f) => l ? !0 : f.some((S) => i.includes(S)), [i, l]), d = Se((f) => l ? !0 : f.every((S) => i.includes(S)), [i, l]), _ = Se((f) => {
1958
- c(f), f && t && t(f);
1959
- }, [t]), v = {
1971
+ const [s, o] = p(!1), [a, c] = p(null), [i] = p([]), l = e?.isAdministrator || !1, y = Ce((g) => l ? !0 : i.includes(g), [i, l]), E = Ce((g) => l ? !0 : g.some((S) => i.includes(S)), [i, l]), d = Ce((g) => l ? !0 : g.every((S) => i.includes(S)), [i, l]), R = Ce((g) => {
1972
+ c(g), g && t && t(g);
1973
+ }, [t]), A = {
1960
1974
  user: e,
1961
1975
  isLoading: s,
1962
- hasGlobalPermission: g,
1976
+ hasGlobalPermission: y,
1963
1977
  hasAnyGlobalPermission: E,
1964
1978
  hasAllGlobalPermissions: d,
1965
1979
  isAdmin: l,
1966
1980
  error: a,
1967
- setError: _
1981
+ setError: R
1968
1982
  };
1969
- return /* @__PURE__ */ n(Ke.Provider, { value: v, children: r });
1970
- }, _t = je(null), Er = ({
1983
+ return /* @__PURE__ */ n(Ye.Provider, { value: A, children: r });
1984
+ }, Nt = Ve(null), kr = ({
1971
1985
  children: r,
1972
1986
  resourceName: e,
1973
1987
  resourceDescription: t,
@@ -1977,71 +1991,71 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
1977
1991
  onSecurityReady: c,
1978
1992
  onError: i
1979
1993
  }) => {
1980
- const l = Fe(Ke);
1994
+ const l = We(Ye);
1981
1995
  if (!l)
1982
1996
  throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
1983
- const { user: g, isAdmin: E } = l, [d, _] = h(null), [v, f] = h(!0), [S, D] = h(null);
1984
- if (ot.useEffect(() => {
1985
- if (!g) {
1986
- f(!1);
1997
+ const { user: y, isAdmin: E } = l, [d, R] = p(null), [A, g] = p(!0), [S, D] = p(null);
1998
+ if (it.useEffect(() => {
1999
+ if (!y) {
2000
+ g(!1);
1987
2001
  return;
1988
2002
  }
1989
- const m = new gt(e, t, E);
2003
+ const w = new wt(e, t, E);
1990
2004
  (async () => {
1991
- f(!0);
2005
+ g(!0);
1992
2006
  try {
1993
- await m.apply(() => {
1994
- _(m), f(!1), c && c(m);
2007
+ await w.apply(() => {
2008
+ R(w), g(!1), c && c(w);
1995
2009
  });
1996
2010
  } catch {
1997
- const C = m.getError() || "Erro ao carregar permissões";
1998
- D(C), f(!1), i && i(C);
2011
+ const O = w.getError() || "Erro ao carregar permissões";
2012
+ D(O), g(!1), i && i(O);
1999
2013
  }
2000
2014
  })();
2001
- }, [e, t, g, E, c, i]), v)
2002
- return a ? /* @__PURE__ */ n(ne, { children: a }) : /* @__PURE__ */ n(Ar, {});
2015
+ }, [e, t, y, E, c, i]), A)
2016
+ return a ? /* @__PURE__ */ n(ne, { children: a }) : /* @__PURE__ */ n(xr, {});
2003
2017
  if (S)
2004
- return /* @__PURE__ */ n("div", { className: "archbase-security-error", children: /* @__PURE__ */ P("div", { children: [
2018
+ return /* @__PURE__ */ n("div", { className: "archbase-security-error", children: /* @__PURE__ */ C("div", { children: [
2005
2019
  "Erro ao carregar permissões: ",
2006
2020
  S
2007
2021
  ] }) });
2008
- if (!g)
2022
+ if (!y)
2009
2023
  return o || /* @__PURE__ */ n("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ n("div", { children: "É necessário fazer login para acessar esta área" }) });
2010
2024
  if (s.length > 0 && d && !s.every(
2011
- (R) => d.hasPermission(R)
2025
+ (T) => d.hasPermission(T)
2012
2026
  ))
2013
- return o || /* @__PURE__ */ P("div", { className: "archbase-security-access-denied", children: [
2027
+ return o || /* @__PURE__ */ C("div", { className: "archbase-security-access-denied", children: [
2014
2028
  /* @__PURE__ */ n("div", { children: "Você não possui permissão para acessar esta área" }),
2015
- /* @__PURE__ */ P("small", { children: [
2029
+ /* @__PURE__ */ C("small", { children: [
2016
2030
  "Permissões necessárias: ",
2017
2031
  s.join(", ")
2018
2032
  ] })
2019
2033
  ] });
2020
- const w = {
2034
+ const b = {
2021
2035
  securityManager: d,
2022
- hasPermission: (m) => d?.hasPermission(m) || !1,
2023
- hasAnyPermission: (m) => m.some((R) => d?.hasPermission(R) || !1),
2024
- hasAllPermissions: (m) => m.every((R) => d?.hasPermission(R) || !1),
2025
- registerAction: (m, R) => {
2026
- d?.registerAction(m, R);
2036
+ hasPermission: (w) => d?.hasPermission(w) || !1,
2037
+ hasAnyPermission: (w) => w.some((T) => d?.hasPermission(T) || !1),
2038
+ hasAllPermissions: (w) => w.every((T) => d?.hasPermission(T) || !1),
2039
+ registerAction: (w, T) => {
2040
+ d?.registerAction(w, T);
2027
2041
  },
2028
- isLoading: v,
2042
+ isLoading: A,
2029
2043
  error: S
2030
2044
  };
2031
- return /* @__PURE__ */ n(_t.Provider, { value: w, children: r });
2032
- }, xr = () => {
2033
- const r = Fe(Ke);
2045
+ return /* @__PURE__ */ n(Nt.Provider, { value: b, children: r });
2046
+ }, Sr = () => {
2047
+ const r = We(Ye);
2034
2048
  if (!r)
2035
2049
  throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
2036
2050
  return r;
2037
- }, qe = () => {
2038
- const r = Fe(_t);
2051
+ }, Xe = () => {
2052
+ const r = We(Nt);
2039
2053
  if (!r)
2040
2054
  throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
2041
2055
  return r;
2042
- }, Xr = (r, e) => {
2043
- const t = qe(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading: l, error: g } = t;
2044
- return ot.useEffect(() => {
2056
+ }, Zr = (r, e) => {
2057
+ const t = Xe(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading: l, error: y } = t;
2058
+ return it.useEffect(() => {
2045
2059
  r && e && (c("create", `Criar ${e}`), c("edit", `Editar ${e}`), c("delete", `Deletar ${e}`), c("view", `Visualizar ${e}`), c("list", `Listar ${e}`));
2046
2060
  }, [r, e, c]), {
2047
2061
  hasPermission: s,
@@ -2055,17 +2069,17 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2055
2069
  canView: s("view"),
2056
2070
  canList: s("list"),
2057
2071
  isLoading: l,
2058
- error: g
2072
+ error: y
2059
2073
  };
2060
- }, Qr = () => {
2061
- const r = qe();
2074
+ }, es = () => {
2075
+ const r = Xe();
2062
2076
  return {
2063
2077
  check: r.hasPermission,
2064
2078
  checkAny: r.hasAnyPermission,
2065
2079
  checkAll: r.hasAllPermissions,
2066
- isAdmin: xr().isAdmin
2080
+ isAdmin: Sr().isAdmin
2067
2081
  };
2068
- }, Rt = ({
2082
+ }, Mt = ({
2069
2083
  children: r,
2070
2084
  actionName: e,
2071
2085
  requiredPermissions: t = [],
@@ -2074,13 +2088,13 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2074
2088
  fallback: a = null,
2075
2089
  autoRegister: c = !0
2076
2090
  }) => {
2077
- const { hasPermission: i, hasAnyPermission: l, hasAllPermissions: g, registerAction: E } = qe();
2091
+ const { hasPermission: i, hasAnyPermission: l, hasAllPermissions: y, registerAction: E } = Xe();
2078
2092
  K(() => {
2079
2093
  c && e && o && E(e, o);
2080
2094
  }, [e, o, c, E]);
2081
2095
  let d = !1;
2082
- return e ? d = i(e) : t.length > 0 ? d = s ? g(t) : l(t) : d = !0, d ? /* @__PURE__ */ n(ne, { children: r }) : /* @__PURE__ */ n(ne, { children: a });
2083
- }, Zr = ({
2096
+ return e ? d = i(e) : t.length > 0 ? d = s ? y(t) : l(t) : d = !0, d ? /* @__PURE__ */ n(ne, { children: r }) : /* @__PURE__ */ n(ne, { children: a });
2097
+ }, ts = ({
2084
2098
  actionName: r,
2085
2099
  actionDescription: e,
2086
2100
  children: t,
@@ -2090,17 +2104,17 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2090
2104
  style: c = {},
2091
2105
  variant: i = "primary",
2092
2106
  size: l = "medium",
2093
- type: g = "button"
2107
+ type: y = "button"
2094
2108
  }) => {
2095
2109
  const E = () => {
2096
- const _ = "archbase-secure-btn", v = `archbase-secure-btn--${i}`, f = `archbase-secure-btn--${l}`;
2097
- return `${_} ${v} ${f} ${a}`.trim();
2110
+ const R = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, g = `archbase-secure-btn--${l}`;
2111
+ return `${R} ${A} ${g} ${a}`.trim();
2098
2112
  }, d = () => {
2099
- const _ = {
2113
+ const R = {
2100
2114
  small: { padding: "4px 8px", fontSize: "12px" },
2101
2115
  medium: { padding: "8px 16px", fontSize: "14px" },
2102
2116
  large: { padding: "12px 24px", fontSize: "16px" }
2103
- }, v = {
2117
+ }, A = {
2104
2118
  primary: { backgroundColor: "#007bff", color: "white" },
2105
2119
  secondary: { backgroundColor: "#6c757d", color: "white" },
2106
2120
  danger: { backgroundColor: "#dc3545", color: "white" },
@@ -2113,13 +2127,13 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2113
2127
  cursor: o ? "not-allowed" : "pointer",
2114
2128
  fontWeight: "500",
2115
2129
  opacity: o ? 0.6 : 1,
2116
- ..._[l],
2117
- ...v[i],
2130
+ ...R[l],
2131
+ ...A[i],
2118
2132
  ...c
2119
2133
  };
2120
2134
  };
2121
2135
  return /* @__PURE__ */ n(
2122
- Rt,
2136
+ Mt,
2123
2137
  {
2124
2138
  actionName: r,
2125
2139
  actionDescription: e,
@@ -2127,7 +2141,7 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2127
2141
  children: /* @__PURE__ */ n(
2128
2142
  "button",
2129
2143
  {
2130
- type: g,
2144
+ type: y,
2131
2145
  onClick: s,
2132
2146
  disabled: o,
2133
2147
  className: E(),
@@ -2137,7 +2151,7 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2137
2151
  )
2138
2152
  }
2139
2153
  );
2140
- }, es = ({
2154
+ }, rs = ({
2141
2155
  children: r,
2142
2156
  actionName: e,
2143
2157
  actionDescription: t,
@@ -2146,11 +2160,11 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2146
2160
  fallbackText: a = "Campo não disponível",
2147
2161
  fallbackComponent: c
2148
2162
  }) => e ? /* @__PURE__ */ n(
2149
- Rt,
2163
+ Mt,
2150
2164
  {
2151
2165
  actionName: e,
2152
2166
  actionDescription: t,
2153
- fallback: c || /* @__PURE__ */ P("div", { className: "archbase-secure-field-fallback", style: {
2167
+ fallback: c || /* @__PURE__ */ C("div", { className: "archbase-secure-field-fallback", style: {
2154
2168
  padding: "8px",
2155
2169
  color: "#666",
2156
2170
  fontStyle: "italic",
@@ -2158,7 +2172,7 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2158
2172
  border: "1px dashed #dee2e6",
2159
2173
  borderRadius: "4px"
2160
2174
  }, children: [
2161
- s && o && /* @__PURE__ */ P("label", { style: { fontWeight: "bold" }, children: [
2175
+ s && o && /* @__PURE__ */ C("label", { style: { fontWeight: "bold" }, children: [
2162
2176
  o,
2163
2177
  ": "
2164
2178
  ] }),
@@ -2167,11 +2181,11 @@ const br = () => Vt().user, Dt = "archbaseSecurityManagerStore", Gr = ({ resourc
2167
2181
  children: r
2168
2182
  }
2169
2183
  ) : /* @__PURE__ */ n(ne, { children: r });
2170
- function ts(r, e) {
2184
+ function ss(r, e) {
2171
2185
  return function(s) {
2172
2186
  const { resourceName: o, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
2173
2187
  return /* @__PURE__ */ n(
2174
- Er,
2188
+ kr,
2175
2189
  {
2176
2190
  resourceName: o,
2177
2191
  resourceDescription: a,
@@ -2183,75 +2197,76 @@ function ts(r, e) {
2183
2197
  };
2184
2198
  }
2185
2199
  export {
2186
- Dt as ARCHBASE_SECURITY_MANAGER_STORE,
2187
- yr as AccessIntervalDto,
2188
- vt as AccessScheduleDto,
2189
- Je as AccessTokenDto,
2190
- wr as ActionDto,
2191
- Ge as ApiTokenDto,
2192
- Tt as ArchbaseAccessTokenService,
2193
- Pt as ArchbaseApiTokenService,
2194
- fr as ArchbaseAuthContext,
2195
- zr as ArchbaseAuthProvider,
2196
- It as ArchbaseGroupService,
2197
- Vr as ArchbaseLogin,
2198
- Wr as ArchbaseMfaSetup,
2199
- Ct as ArchbaseProfileService,
2200
- Rt as ArchbaseProtectedComponent,
2201
- Hr as ArchbaseResetPassword,
2202
- Ut as ArchbaseResourceService,
2203
- Zr as ArchbaseSecureActionButton,
2204
- es as ArchbaseSecureFormField,
2205
- gt as ArchbaseSecurityManager,
2206
- Yr as ArchbaseSecurityProvider,
2200
+ Rt as ARCHBASE_SECURITY_MANAGER_STORE,
2201
+ vr as AccessIntervalDto,
2202
+ At as AccessScheduleDto,
2203
+ qe as AccessTokenDto,
2204
+ br as ActionDto,
2205
+ Ke as ApiTokenDto,
2206
+ Dt as ArchbaseAccessTokenService,
2207
+ Ut as ArchbaseApiTokenService,
2208
+ gr as ArchbaseAuthContext,
2209
+ Fr as ArchbaseAuthProvider,
2210
+ Pt as ArchbaseGroupService,
2211
+ Hr as ArchbaseLogin,
2212
+ Gr as ArchbaseMfaSetup,
2213
+ Tt as ArchbaseProfileService,
2214
+ Mt as ArchbaseProtectedComponent,
2215
+ Jr as ArchbaseResetPassword,
2216
+ _t as ArchbaseResourceService,
2217
+ ts as ArchbaseSecureActionButton,
2218
+ rs as ArchbaseSecureFormField,
2219
+ wt as ArchbaseSecurityManager,
2220
+ Qr as ArchbaseSecurityProvider,
2207
2221
  J as ArchbaseTenantManager,
2208
- dt as ArchbaseUser,
2209
- St as ArchbaseUserService,
2210
- ut as ArchbaseUsernameAndPassword,
2211
- ut as ArchbaseUsernameAndPasswordImpl,
2212
- Er as ArchbaseViewSecurityProvider,
2222
+ ht as ArchbaseUser,
2223
+ It as ArchbaseUserService,
2224
+ pt as ArchbaseUsernameAndPassword,
2225
+ pt as ArchbaseUsernameAndPasswordImpl,
2226
+ kr as ArchbaseViewSecurityProvider,
2213
2227
  Oe as CONTEXT_STORAGE_KEY,
2214
- Zt as DefaultArchbaseTokenManager,
2215
- Ar as DefaultSecurityLoading,
2216
- ae as ENCRYPTION_KEY,
2217
- pt as FetchError,
2218
- xe as GroupDto,
2219
- Fr as PermissionDto,
2220
- Ee as ProfileDto,
2221
- xt as ResourceDto,
2222
- ge as SecurityDto,
2223
- fe as SecurityType,
2228
+ tr as DefaultArchbaseTokenManager,
2229
+ xr as DefaultSecurityLoading,
2230
+ ce as ENCRYPTION_KEY,
2231
+ mt as FetchError,
2232
+ Se as GroupDto,
2233
+ Wr as PermissionDto,
2234
+ ke as ProfileDto,
2235
+ St as ResourceDto,
2236
+ we as SecurityDto,
2237
+ ge as SecurityType,
2224
2238
  Me as TOKEN_COOKIE_NAME,
2225
- gr as TipoRecurso,
2226
- Be as USER_NAME,
2227
- Ne as USER_NAME_AND_PASSWORD,
2228
- Re as UserDto,
2229
- We as UserGroupDto,
2230
- dr as createInternalConfig,
2231
- Pe as decodeJWT,
2232
- he as epochAtSecondsFromNow,
2233
- st as epochTimeIsPast,
2234
- ir as fetchTokens,
2235
- ar as fetchWithRefreshToken,
2236
- tr as generateCodeChallenge,
2237
- er as generateRandomString,
2238
- ht as getRandomInteger,
2239
- pr as getRefreshExpiresIn,
2240
- sr as postWithXForm,
2241
- or as redirectToLogin,
2242
- cr as redirectToLogout,
2243
- Jr as useArchbaseAuthenticationManager,
2244
- Kr as useArchbaseGetCurrentToken,
2245
- br as useArchbaseGetLoggedUser,
2246
- Qr as useArchbasePermissionCheck,
2247
- qr as useArchbaseResetPassword,
2248
- Xr as useArchbaseSecureForm,
2249
- xr as useArchbaseSecurity,
2250
- Gr as useArchbaseSecurityManager,
2251
- jr as useArchbaseTenantManager,
2252
- qe as useArchbaseViewSecurity,
2253
- $r as useBrowserStorage,
2254
- ur as validateConfig,
2255
- lr as validateState,
2256
- ts as withArchbaseSecurity
2239
+ wr as TipoRecurso,
2240
+ Le as USER_NAME,
2241
+ Be as USER_NAME_AND_PASSWORD,
2242
+ Ne as UserDto,
2243
+ Ge as UserGroupDto,
2244
+ hr as createInternalConfig,
2245
+ Te as decodeJWT,
2246
+ fe as epochAtSecondsFromNow,
2247
+ nt as epochTimeIsPast,
2248
+ cr as fetchTokens,
2249
+ lr as fetchWithRefreshToken,
2250
+ sr as generateCodeChallenge,
2251
+ rr as generateRandomString,
2252
+ ft as getRandomInteger,
2253
+ mr as getRefreshExpiresIn,
2254
+ $e as isCredentialsExpiredError,
2255
+ nr as postWithXForm,
2256
+ ir as redirectToLogin,
2257
+ dr as redirectToLogout,
2258
+ qr as useArchbaseAuthenticationManager,
2259
+ Yr as useArchbaseGetCurrentToken,
2260
+ Er as useArchbaseGetLoggedUser,
2261
+ es as useArchbasePermissionCheck,
2262
+ Xr as useArchbaseResetPassword,
2263
+ Zr as useArchbaseSecureForm,
2264
+ Sr as useArchbaseSecurity,
2265
+ Kr as useArchbaseSecurityManager,
2266
+ Vr as useArchbaseTenantManager,
2267
+ Xe as useArchbaseViewSecurity,
2268
+ jr as useBrowserStorage,
2269
+ pr as validateConfig,
2270
+ ur as validateState,
2271
+ ss as withArchbaseSecurity
2257
2272
  };