@archbase/security 4.3.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import "reflect-metadata";
2
2
  import * as I from "inversify";
3
- import { decorate as Bt, injectable as Lt } from "inversify";
4
- import { compressString as Ot, decompressString as zt, IOCContainer as jt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as ie, IsNotEmpty as Q, IsOptional as Z, IsBoolean as se, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Ht, getI18nextInstance as S, useArchbaseTheme as Vt, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
5
- import q from "crypto-js";
6
- import { jwtDecode as qt } from "jwt-decode";
7
- import { jsx as o, jsxs as C, Fragment as ae } from "react/jsx-runtime";
8
- import it, { useState as p, useEffect as X, createContext as He, useMemo as at, useRef as ct, useCallback as Ie, useContext as Ve } from "react";
9
- import { BehaviorSubject as Ze } from "rxjs";
10
- import { ArchbaseRemoteApiService as ge, useArchbaseStore as lt } from "@archbase/data";
3
+ import { decorate as Lt, injectable as Ot } from "inversify";
4
+ import { compressString as zt, decompressString as jt, IOCContainer as Ft, ARCHBASE_IOC_API_TYPE as q, processErrorMessage as oe, IsNotEmpty as Q, IsOptional as Z, IsBoolean as se, IsEmail as Ht, getKeyByEnumValue as et, useArchbasePasswordRemember as Vt, getI18nextInstance as S, useArchbaseTheme as Wt, resolveArchbasePasswordPolicy as Gt, isEmailValidate as Jt, validateArchbasePassword as Kt, useArchbaseAppContext as qt } from "@archbase/core";
5
+ import K from "crypto-js";
6
+ import { jwtDecode as Yt } from "jwt-decode";
7
+ import { jsx as o, jsxs as C, Fragment as ie } from "react/jsx-runtime";
8
+ import ct, { useState as p, useEffect as Y, createContext as Ve, useMemo as lt, useRef as We, useCallback as Ce, useContext as Ge } from "react";
9
+ import { BehaviorSubject as tt } from "rxjs";
10
+ import { ArchbaseRemoteApiService as ye, useArchbaseStore as dt } from "@archbase/data";
11
11
  import { v4 as ee } from "uuid";
12
- import { Card as We, Text as F, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as ze, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ce } from "@mantine/core";
13
- import { useFocusTrap as ut } from "@mantine/hooks";
14
- import { IconCopy as rr } from "@tabler/icons-react";
15
- import { ArchbaseQRCode as sr, ArchbasePasswordStrengthMeter as nr, ArchbaseDialog as nt } from "@archbase/components";
16
- import { useContainer as De } from "inversify-react";
17
- class ht {
12
+ import { Card as Je, Text as j, Divider as De, Stack as xe, TextInput as Se, Button as W, Anchor as rt, Group as ue, Select as Xt, Tooltip as Qt, Loader as ut, PasswordInput as je, Checkbox as Zt, Alert as st, Code as nt, CopyButton as ot, SimpleGrid as er, useMantineColorScheme as tr, Box as rr, Skeleton as Pe } from "@mantine/core";
13
+ import { useFocusTrap as ht } from "@mantine/hooks";
14
+ import { IconCopy as sr } from "@tabler/icons-react";
15
+ import { ArchbaseQRCode as nr, ArchbasePasswordStrengthMeter as or, ArchbaseDialog as it } from "@archbase/components";
16
+ import { useContainer as _e } from "inversify-react";
17
+ class pt {
18
18
  id;
19
19
  displayName;
20
20
  email;
@@ -24,10 +24,10 @@ class ht {
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 ht({});
27
+ return new pt({});
28
28
  }
29
29
  }
30
- class pt {
30
+ class ft {
31
31
  username;
32
32
  password;
33
33
  remember;
@@ -35,16 +35,16 @@ class pt {
35
35
  this.username = e.username, this.password = e.password, this.remember = e.remember;
36
36
  }
37
37
  static newInstance() {
38
- return new pt({});
38
+ return new ft({});
39
39
  }
40
40
  }
41
- const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", $e = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Be = "602b05c5-ec46-451e-aba6-187e463bc245", Le = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
- class or {
41
+ const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", $e = "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 ir {
43
43
  getUsernameAndPassword() {
44
44
  try {
45
- const e = localStorage.getItem($e);
45
+ const e = localStorage.getItem(Be);
46
46
  if (e) {
47
- const t = q.AES.decrypt(e, le).toString(q.enc.Utf8), n = atob(t).split(":");
47
+ const t = K.AES.decrypt(e, le).toString(K.enc.Utf8), n = atob(t).split(":");
48
48
  return { username: n[0], password: n[1], remember: !0 };
49
49
  } else
50
50
  return null;
@@ -53,14 +53,14 @@ class or {
53
53
  }
54
54
  }
55
55
  saveUsernameAndPassword(e, t) {
56
- const s = btoa(`${e}:${t}`), n = q.AES.encrypt(s, le).toString();
57
- localStorage.setItem($e, n);
56
+ const s = btoa(`${e}:${t}`), n = K.AES.encrypt(s, le).toString();
57
+ localStorage.setItem(Be, n);
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 = q.AES.decrypt(e, le).toString(q.enc.Utf8);
63
+ const t = K.AES.decrypt(e, le).toString(K.enc.Utf8);
64
64
  return atob(t);
65
65
  } else
66
66
  return null;
@@ -69,42 +69,42 @@ class or {
69
69
  }
70
70
  }
71
71
  saveUsername(e) {
72
- const t = btoa(e), s = q.AES.encrypt(t, le).toString();
73
- localStorage.setItem(Be, s);
72
+ const t = btoa(e), s = K.AES.encrypt(t, le).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 n = qt(s.access_token);
80
+ const n = Yt(s.access_token);
81
81
  if (!n)
82
82
  return !0;
83
- const a = Math.floor(Date.now() / 1e3), c = n.exp;
84
- return a > c - t;
83
+ const c = Math.floor(Date.now() / 1e3), l = n.exp;
84
+ return c > l - t;
85
85
  } catch {
86
86
  return !0;
87
87
  }
88
88
  }
89
89
  saveToken(e) {
90
90
  if (e) {
91
- const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), n = Ot(s);
92
- localStorage.setItem(Ne, n);
91
+ const t = JSON.stringify(e), s = K.AES.encrypt(t, le).toString(), n = zt(s);
92
+ localStorage.setItem($e, n);
93
93
  } else
94
94
  this.clearToken();
95
95
  }
96
96
  clearUsernameAndPassword() {
97
- localStorage.removeItem($e), localStorage.removeItem(Be);
97
+ localStorage.removeItem(Be), localStorage.removeItem(Le);
98
98
  }
99
99
  clearToken() {
100
- localStorage.removeItem(Ne);
100
+ localStorage.removeItem($e);
101
101
  }
102
102
  getToken() {
103
103
  try {
104
- const e = localStorage.getItem(Ne);
104
+ const e = localStorage.getItem($e);
105
105
  if (!e)
106
106
  return null;
107
- const t = zt(e), s = q.AES.decrypt(t, le).toString(q.enc.Utf8);
107
+ const t = jt(e), s = K.AES.decrypt(t, le).toString(K.enc.Utf8);
108
108
  return JSON.parse(s);
109
109
  } catch {
110
110
  return null;
@@ -112,37 +112,37 @@ class or {
112
112
  }
113
113
  saveContext(e) {
114
114
  try {
115
- const t = q.AES.encrypt(e, le).toString();
116
- localStorage.setItem(Le, t);
115
+ const t = K.AES.encrypt(e, le).toString();
116
+ localStorage.setItem(Oe, t);
117
117
  } catch (t) {
118
118
  console.warn("Erro ao salvar contexto:", t);
119
119
  }
120
120
  }
121
121
  getContext() {
122
122
  try {
123
- const e = localStorage.getItem(Le);
124
- return e ? q.AES.decrypt(e, le).toString(q.enc.Utf8) : null;
123
+ const e = localStorage.getItem(Oe);
124
+ return e ? K.AES.decrypt(e, le).toString(K.enc.Utf8) : null;
125
125
  } catch {
126
126
  return null;
127
127
  }
128
128
  }
129
129
  clearContext() {
130
- localStorage.removeItem(Le);
130
+ localStorage.removeItem(Oe);
131
131
  }
132
132
  }
133
- Bt(Lt(), or);
134
- function ft(r) {
133
+ Lt(Ot(), ir);
134
+ function mt(r) {
135
135
  const t = new Uint8Array(1);
136
- return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ft(r) : t[0] % r;
136
+ return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? mt(r) : t[0] % r;
137
137
  }
138
- function ir(r) {
138
+ function ar(r) {
139
139
  let e = "";
140
140
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
141
141
  for (let s = 0; s < r; s++)
142
- e += t.charAt(ft(t.length - 1));
142
+ e += t.charAt(mt(t.length - 1));
143
143
  return e;
144
144
  }
145
- async function ar(r) {
145
+ async function cr(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 ar(r) {
150
150
  const t = new TextEncoder().encode(r), s = await window.crypto.subtle.digest("SHA-256", t), n = String.fromCharCode(...new Uint8Array(s));
151
151
  return btoa(n).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
152
152
  }
153
- class mt extends Error {
153
+ class gt 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 cr(r) {
160
+ function lr(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 lr(r, e) {
166
+ async function dr(r, e) {
167
167
  return fetch(r, {
168
168
  method: "POST",
169
- body: cr(e),
169
+ body: lr(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 mt(t.status, t.statusText, s);
174
+ throw new gt(t.status, t.statusText, s);
175
175
  }
176
176
  return t;
177
177
  });
178
178
  }
179
- const gt = "PKCE_code_verifier", je = "ROCP_auth_state";
180
- async function dr(r, e) {
181
- const t = ir(96);
182
- return sessionStorage.setItem(gt, t), ar(t).then((s) => {
179
+ const yt = "PKCE_code_verifier", Fe = "ROCP_auth_state";
180
+ async function ur(r, e) {
181
+ const t = ar(96);
182
+ return sessionStorage.setItem(yt, t), cr(t).then((s) => {
183
183
  const n = new URLSearchParams({
184
184
  response_type: "code",
185
185
  client_id: r.clientId,
@@ -188,23 +188,23 @@ async function dr(r, e) {
188
188
  code_challenge_method: "S256",
189
189
  ...r.extraAuthParameters
190
190
  });
191
- r.scope !== void 0 && n.append("scope", r.scope), sessionStorage.removeItem(je);
192
- const a = e ?? r.state;
193
- a && (sessionStorage.setItem(je, a), n.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${n.toString()}`);
191
+ r.scope !== void 0 && n.append("scope", r.scope), sessionStorage.removeItem(Fe);
192
+ const c = e ?? r.state;
193
+ c && (sessionStorage.setItem(Fe, c), n.append("state", c)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${n.toString()}`);
194
194
  });
195
195
  }
196
- function ur(r) {
196
+ function hr(r) {
197
197
  return r.access_token !== void 0;
198
198
  }
199
- function yt(r, e) {
200
- return lr(r, e).then((t) => t.json().then((s) => {
201
- if (ur(s))
199
+ function vt(r, e) {
200
+ return dr(r, e).then((t) => t.json().then((s) => {
201
+ if (hr(s))
202
202
  return s;
203
203
  throw Error(s);
204
204
  }));
205
205
  }
206
- const hr = (r) => {
207
- const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(gt);
206
+ const pr = (r) => {
207
+ const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(yt);
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 yt(r.tokenEndpoint, n);
225
- }, pr = (r) => {
224
+ return vt(r.tokenEndpoint, n);
225
+ }, fr = (r) => {
226
226
  const { config: e, refreshToken: t } = r, s = {
227
227
  grant_type: "refresh_token",
228
228
  refresh_token: t,
@@ -231,10 +231,10 @@ A autenticação ocorreu?`);
231
231
  redirect_uri: e.redirectUri,
232
232
  ...e.extraTokenParameters
233
233
  };
234
- return yt(e.tokenEndpoint, s);
234
+ return vt(e.tokenEndpoint, s);
235
235
  };
236
- function fr(r, e, t, s, n, a) {
237
- const c = new URLSearchParams({
236
+ function mr(r, e, t, s, n, c) {
237
+ const l = new URLSearchParams({
238
238
  token: t || e,
239
239
  token_type_hint: t ? "refresh_token" : "access_token",
240
240
  client_id: r.clientId,
@@ -242,17 +242,17 @@ function fr(r, e, t, s, n, a) {
242
242
  ui_locales: window.navigator.languages.reduce((i, d) => i + " " + d),
243
243
  ...r.extraLogoutParameters
244
244
  });
245
- s && c.append("id_token_hint", s), n && c.append("state", n), a && c.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${c.toString()}`);
245
+ s && l.append("id_token_hint", s), n && l.append("state", n), c && l.append("logout_hint", c), window.location.replace(`${r.logoutEndpoint}?${l.toString()}`);
246
246
  }
247
- function mr(r) {
248
- const e = r.get("state"), t = sessionStorage.getItem(je);
247
+ function gr(r) {
248
+ const e = r.get("state"), t = sessionStorage.getItem(Fe);
249
249
  if (e !== t)
250
250
  throw new Error(
251
251
  '"state" valor recebido do servidor de autenticação não corresponde à solicitação do cliente. Possível falsificação de solicitação entre sites'
252
252
  );
253
253
  }
254
254
  function de(r, e, t) {
255
- const s = t === "session" ? sessionStorage : localStorage, [n, a] = p(() => {
255
+ const s = t === "session" ? sessionStorage : localStorage, [n, c] = p(() => {
256
256
  const i = s.getItem(r);
257
257
  try {
258
258
  return i ? JSON.parse(i) : e;
@@ -263,69 +263,69 @@ Continuando com o valor padrão.
263
263
  Error: ${d.message}`
264
264
  ), e;
265
265
  }
266
- }), c = (i) => {
266
+ }), l = (i) => {
267
267
  if (i === void 0) {
268
- a(i), s.removeItem(r);
268
+ c(i), s.removeItem(r);
269
269
  return;
270
270
  }
271
271
  try {
272
272
  const d = i instanceof Function ? i(n) : i;
273
- a(d), s.setItem(r, JSON.stringify(d));
273
+ c(d), s.setItem(r, JSON.stringify(d));
274
274
  } catch {
275
275
  console.log(`Falha ao armazenar valor '${i}' para chave '${r}'`);
276
276
  }
277
277
  };
278
- return X(() => {
278
+ return Y(() => {
279
279
  const i = (d) => {
280
- d.storageArea === s && d.key === r && a(JSON.parse(d.newValue ?? ""));
280
+ d.storageArea === s && d.key === r && c(JSON.parse(d.newValue ?? ""));
281
281
  };
282
282
  return window.addEventListener("storage", i, !1), () => window.removeEventListener("storage", i, !1);
283
- }), [n, c];
283
+ }), [n, l];
284
284
  }
285
- const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
285
+ const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
286
286
  __proto__: null,
287
287
  default: de
288
288
  }, Symbol.toStringTag, { value: "Module" }));
289
- function Pe(r) {
289
+ function Te(r) {
290
290
  return ["", void 0, null].includes(r);
291
291
  }
292
- function gr(r) {
292
+ function yr(r) {
293
293
  const {
294
294
  autoLogin: e = !0,
295
295
  clearURL: t = !0,
296
296
  decodeToken: s = !0,
297
297
  scope: n = void 0,
298
- preLogin: a = () => null,
299
- postLogin: c = () => null,
298
+ preLogin: c = () => null,
299
+ postLogin: l = () => null,
300
300
  onRefreshTokenExpire: i = void 0,
301
301
  storage: d = "local"
302
- } = r, y = {
302
+ } = r, g = {
303
303
  ...r,
304
304
  autoLogin: e,
305
305
  clearURL: t,
306
306
  decodeToken: s,
307
307
  scope: n,
308
- preLogin: a,
309
- postLogin: c,
308
+ preLogin: c,
309
+ postLogin: l,
310
310
  onRefreshTokenExpire: i,
311
311
  storage: d
312
312
  };
313
- return yr(y), y;
313
+ return vr(g), g;
314
314
  }
315
- function yr(r) {
316
- if (Pe(r?.clientId))
315
+ function vr(r) {
316
+ if (Te(r?.clientId))
317
317
  throw Error(
318
318
  "'clientId' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
319
319
  );
320
- if (Pe(r?.authorizationEndpoint))
320
+ if (Te(r?.authorizationEndpoint))
321
321
  throw Error(
322
322
  "'authorizationEndpoint' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
323
323
  );
324
- if (Pe(r?.tokenEndpoint))
324
+ if (Te(r?.tokenEndpoint))
325
325
  throw Error(
326
326
  "'tokenEndpoint' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
327
327
  );
328
- if (Pe(r?.redirectUri))
328
+ if (Te(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 yr(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 fe = 600, pe = (r) => Math.round(Date.now() / 1e3 + r);
341
- function ot(r) {
340
+ const me = 600, fe = (r) => Math.round(Date.now() / 1e3 + r);
341
+ function at(r) {
342
342
  return Math.round(Date.now()) / 1e3 + 30 >= r;
343
343
  }
344
- const vr = [
344
+ const wr = [
345
345
  "refresh_expires_in",
346
346
  // KeyCloak
347
347
  "refresh_token_expires_in"
348
348
  // Azure AD
349
349
  ];
350
- function wr(r, e) {
351
- for (const t of vr)
350
+ function br(r, e) {
351
+ for (const t of wr)
352
352
  if (t in e)
353
353
  return e[t];
354
- return e.refresh_token ? r + fe : r;
354
+ return e.refresh_token ? r + me : r;
355
355
  }
356
- const Te = (r) => {
356
+ const Ue = (r) => {
357
357
  try {
358
358
  const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), s = decodeURIComponent(
359
359
  atob(t).split("").map(function(n) {
@@ -368,86 +368,86 @@ const Te = (r) => {
368
368
  Você pode desativar a decodificação JWT definindo o valor 'decodeToken' como 'falso' na configuração.`
369
369
  );
370
370
  }
371
- }, br = He({
371
+ }, Ar = Ve({
372
372
  token: "",
373
373
  login: () => null,
374
374
  logOut: () => null,
375
375
  error: null,
376
376
  loginInProgress: !1
377
- }), Gr = ({ authConfig: r, children: e }) => {
378
- const t = at(() => gr(r), [r]), [s, n] = de(
377
+ }), Jr = ({ authConfig: r, children: e }) => {
378
+ const t = lt(() => yr(r), [r]), [s, n] = de(
379
379
  "ROCP_refreshToken",
380
380
  void 0,
381
381
  t.storage
382
- ), [a, c] = de(
382
+ ), [c, l] = de(
383
383
  "ROCP_refreshTokenExpire",
384
- pe(2 * fe),
384
+ fe(2 * me),
385
385
  t.storage
386
- ), [i, d] = de("ROCP_token", "", t.storage), [y, k] = de(
386
+ ), [i, d] = de("ROCP_token", "", t.storage), [g, k] = de(
387
387
  "ROCP_tokenExpire",
388
- pe(fe),
388
+ fe(me),
389
389
  t.storage
390
- ), [h, U] = de(
390
+ ), [u, T] = de(
391
391
  "ROCP_idToken",
392
392
  void 0,
393
393
  t.storage
394
- ), [A, w] = de(
394
+ ), [b, v] = de(
395
395
  "ROCP_loginInProgress",
396
396
  !1,
397
397
  t.storage
398
- ), [x, P] = de(
398
+ ), [E, P] = de(
399
399
  "ROCP_refreshInProgress",
400
400
  !1,
401
401
  t.storage
402
- ), [M, B] = p(), [H, _] = p(), [b, m] = p(null);
403
- let R;
404
- function V() {
405
- n(void 0), d(""), k(pe(fe)), c(pe(fe)), U(void 0), B(void 0), _(void 0), w(!1);
406
- }
407
- function L(g, v) {
408
- V(), m(null), t?.logoutEndpoint && fr(t, i, s, h, g, v);
409
- }
410
- function N(g) {
411
- V(), w(!0);
412
- let v = g;
413
- g && typeof g != "string" && (console.warn(
414
- `O estado de login aprovado deve ser do tipo 'string'. Recebido'${g}'. Ignorando o valor...`
415
- ), v = void 0), dr(t, v).catch((K) => {
416
- console.error(K), m(K.message), w(!1);
402
+ ), [M, B] = p(), [F, D] = p(), [w, f] = p(null);
403
+ let _;
404
+ function H() {
405
+ n(void 0), d(""), k(fe(me)), l(fe(me)), T(void 0), B(void 0), D(void 0), v(!1);
406
+ }
407
+ function L(m, y) {
408
+ H(), f(null), t?.logoutEndpoint && mr(t, i, s, u, m, y);
409
+ }
410
+ function N(m) {
411
+ H(), v(!0);
412
+ let y = m;
413
+ m && typeof m != "string" && (console.warn(
414
+ `O estado de login aprovado deve ser do tipo 'string'. Recebido'${m}'. Ignorando o valor...`
415
+ ), y = void 0), ur(t, y).catch((J) => {
416
+ console.error(J), f(J.message), v(!1);
417
417
  });
418
418
  }
419
- function T(g) {
420
- d(g.access_token), n(g.refresh_token);
421
- const v = t.tokenExpiresIn ?? g.expires_in ?? fe;
422
- k(pe(v));
423
- const K = t.refreshTokenExpiresIn ?? wr(v, g);
424
- c(pe(K)), U(g.id_token);
419
+ function X(m) {
420
+ d(m.access_token), n(m.refresh_token);
421
+ const y = t.tokenExpiresIn ?? m.expires_in ?? me;
422
+ k(fe(y));
423
+ const J = t.refreshTokenExpiresIn ?? br(y, m);
424
+ l(fe(J)), T(m.id_token);
425
425
  try {
426
- g.id_token && _(Te(g.id_token));
427
- } catch (W) {
428
- console.warn(`Falha ao decodificar idToken: ${W.message}`);
426
+ m.id_token && D(Ue(m.id_token));
427
+ } catch (V) {
428
+ console.warn(`Falha ao decodificar idToken: ${V.message}`);
429
429
  }
430
430
  try {
431
- t.decodeToken && B(Te(g.access_token));
432
- } catch (W) {
433
- console.warn(`Falha ao decodificar o token de acesso: ${W.message}`);
431
+ t.decodeToken && B(Ue(m.access_token));
432
+ } catch (V) {
433
+ console.warn(`Falha ao decodificar o token de acesso: ${V.message}`);
434
434
  }
435
435
  }
436
- function te(g = !1) {
437
- return g || !t.onRefreshTokenExpire ? N() : t.onRefreshTokenExpire({ login: N });
436
+ function U(m = !1) {
437
+ return m || !t.onRefreshTokenExpire ? N() : t.onRefreshTokenExpire({ login: N });
438
438
  }
439
- function re(g = !1) {
440
- if (i && ot(y) && !(x && !g)) {
441
- if (ot(a))
442
- return te(g);
439
+ function te(m = !1) {
440
+ if (i && at(g) && !(E && !m)) {
441
+ if (at(c))
442
+ return U(m);
443
443
  if (s) {
444
- P(!0), pr({ config: t, refreshToken: s }).then((v) => T(v)).catch((v) => {
445
- if (v instanceof mt) {
446
- if (v.status === 400)
447
- return te(g);
448
- console.error(v), m(v.message), g && N();
444
+ P(!0), fr({ config: t, refreshToken: s }).then((y) => X(y)).catch((y) => {
445
+ if (y instanceof gt) {
446
+ if (y.status === 400)
447
+ return U(m);
448
+ console.error(y), f(y.message), m && N();
449
449
  } else
450
- v instanceof Error && (console.error(v), m(v.message), g && N());
450
+ y instanceof Error && (console.error(y), f(y.message), m && N());
451
451
  }).finally(() => {
452
452
  P(!1);
453
453
  });
@@ -458,29 +458,29 @@ const Te = (r) => {
458
458
  );
459
459
  }
460
460
  }
461
- X(() => (R = setInterval(() => re(), 1e4), () => clearInterval(R)), [i, s, a, y]);
462
- const ne = ct(!1);
463
- return X(() => {
464
- if (A) {
465
- const g = new URLSearchParams(window.location.search);
466
- if (!g.get("code")) {
467
- const v = g.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
- console.error(v), m(v), L();
461
+ Y(() => (_ = setInterval(() => te(), 1e4), () => clearInterval(_)), [i, s, c, g]);
462
+ const ae = We(!1);
463
+ return Y(() => {
464
+ if (b) {
465
+ const m = new URLSearchParams(window.location.search);
466
+ if (!m.get("code")) {
467
+ const y = m.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
+ console.error(y), f(y), L();
469
469
  return;
470
470
  }
471
- if (!ne.current) {
472
- ne.current = !0;
471
+ if (!ae.current) {
472
+ ae.current = !0;
473
473
  try {
474
- mr(g);
475
- } catch (v) {
476
- console.error(v), m(v.message);
474
+ gr(m);
475
+ } catch (y) {
476
+ console.error(y), f(y.message);
477
477
  }
478
- hr(t).then((v) => {
479
- T(v), t?.postLogin && t.postLogin();
480
- }).catch((v) => {
481
- console.error(v), m(v.message);
478
+ pr(t).then((y) => {
479
+ X(y), t?.postLogin && t.postLogin();
480
+ }).catch((y) => {
481
+ console.error(y), f(y.message);
482
482
  }).finally(() => {
483
- t.clearURL && window.history.replaceState(null, "", window.location.pathname), w(!1);
483
+ t.clearURL && window.history.replaceState(null, "", window.location.pathname), v(!1);
484
484
  });
485
485
  }
486
486
  return;
@@ -488,25 +488,25 @@ const Te = (r) => {
488
488
  if (!i && t.autoLogin)
489
489
  return N();
490
490
  try {
491
- h && _(Te(h));
492
- } catch (g) {
493
- console.warn(`Falha ao decodificar idToken: ${g.message}`);
491
+ u && D(Ue(u));
492
+ } catch (m) {
493
+ console.warn(`Falha ao decodificar idToken: ${m.message}`);
494
494
  }
495
495
  try {
496
- t.decodeToken && B(Te(i));
497
- } catch (g) {
498
- console.warn(`Falha ao decodificar o token de acesso: ${g.message}`);
496
+ t.decodeToken && B(Ue(i));
497
+ } catch (m) {
498
+ console.warn(`Falha ao decodificar o token de acesso: ${m.message}`);
499
499
  }
500
- re(!0);
500
+ te(!0);
501
501
  }, []), /* @__PURE__ */ o(
502
- br.Provider,
502
+ Ar.Provider,
503
503
  {
504
- value: { token: i, tokenData: M, idToken: h, idTokenData: H, login: N, logOut: L, error: b, loginInProgress: A },
504
+ value: { token: i, tokenData: M, idToken: u, idTokenData: F, login: N, logOut: L, error: w, loginInProgress: b },
505
505
  children: e
506
506
  }
507
507
  );
508
508
  };
509
- class vt {
509
+ class wt {
510
510
  resourceService;
511
511
  resource;
512
512
  actions;
@@ -515,7 +515,7 @@ class vt {
515
515
  error;
516
516
  isAdmin;
517
517
  constructor(e, t, s) {
518
- this.resourceService = jt.getContainer().get(Y.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
518
+ this.resourceService = Ft.getContainer().get(q.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
519
519
  }
520
520
  registerAction(e, t) {
521
521
  !this.alreadyApplied && this.actions.findIndex((s) => s.actionName === e) < 0 && this.actions.push({ actionName: e, actionDescription: t });
@@ -524,7 +524,7 @@ class vt {
524
524
  this.alreadyApplied || (this.alreadyApplied = !0, this.resourceService.registerResource({ resource: this.resource, actions: this.actions }).then((t) => {
525
525
  this.permissions = t.permissions, this.error = "", e && e();
526
526
  }).catch((t) => {
527
- this.alreadyApplied = !1, this.error = ie(t);
527
+ this.alreadyApplied = !1, this.error = oe(t);
528
528
  }));
529
529
  }
530
530
  hasPermission(e) {
@@ -586,10 +586,10 @@ class vt {
586
586
  return [...this.actions];
587
587
  }
588
588
  }
589
- class J {
589
+ class G {
590
590
  static instance;
591
- _currentTenant = new Ze(null);
592
- _availableTenants = new Ze([]);
591
+ _currentTenant = new tt(null);
592
+ _availableTenants = new tt([]);
593
593
  constructor() {
594
594
  const e = localStorage.getItem("tenant_info");
595
595
  if (e)
@@ -600,7 +600,7 @@ class J {
600
600
  }
601
601
  }
602
602
  static getInstance() {
603
- return J.instance || (J.instance = new J()), J.instance;
603
+ return G.instance || (G.instance = new G()), G.instance;
604
604
  }
605
605
  get currentTenant$() {
606
606
  return this._currentTenant.asObservable();
@@ -629,15 +629,15 @@ class J {
629
629
  return t && (e["X-TENANT-ID"] = t.id), e;
630
630
  }
631
631
  }
632
- function Jr() {
633
- return J.getInstance();
632
+ function Kr() {
633
+ return G.getInstance();
634
634
  }
635
- var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, E = (r, e, t, s) => {
636
- for (var n = void 0, a = r.length - 1, c; a >= 0; a--)
637
- (c = r[a]) && (n = c(e, t, n) || n);
638
- return n && Ar(e, t, n), n;
639
- }, Er = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(Er || {});
640
- const wt = class bt {
635
+ var ge = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(ge || {}), Er = Object.defineProperty, A = (r, e, t, s) => {
636
+ for (var n = void 0, c = r.length - 1, l; c >= 0; c--)
637
+ (l = r[c]) && (n = l(e, t, n) || n);
638
+ return n && Er(e, t, n), n;
639
+ }, xr = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(xr || {});
640
+ const bt = class At {
641
641
  id;
642
642
  code;
643
643
  version;
@@ -648,20 +648,20 @@ const wt = class bt {
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 xr(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 Sr(t)) : [];
652
652
  }
653
- static newInstance = () => new bt({
653
+ static newInstance = () => new At({
654
654
  id: ee(),
655
655
  intervals: []
656
656
  });
657
657
  };
658
- E([
658
+ A([
659
659
  Q({
660
660
  message: "archbase:Informe a descrição do cronograma de acesso"
661
661
  })
662
- ], wt.prototype, "description");
663
- let At = wt;
664
- const _e = class Et {
662
+ ], bt.prototype, "description");
663
+ let Et = bt;
664
+ const Re = class xt {
665
665
  id;
666
666
  code;
667
667
  version;
@@ -674,30 +674,30 @@ const _e = class Et {
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 At(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 Et(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
678
678
  }
679
- static newInstance = () => new Et({
679
+ static newInstance = () => new xt({
680
680
  id: ee(),
681
681
  dayOfWeek: (/* @__PURE__ */ new Date()).getDay(),
682
682
  startTime: "08:00",
683
683
  endTime: "17:00"
684
684
  });
685
685
  };
686
- E([
686
+ A([
687
687
  Z()
688
- ], _e.prototype, "accessSchedule");
689
- E([
688
+ ], Re.prototype, "accessSchedule");
689
+ A([
690
690
  Q({
691
691
  message: "archbase:Informe a hora de início"
692
692
  })
693
- ], _e.prototype, "startTime");
694
- E([
693
+ ], Re.prototype, "startTime");
694
+ A([
695
695
  Q({
696
696
  message: "archbase:Informe a hora de término"
697
697
  })
698
- ], _e.prototype, "endTime");
699
- let xr = _e;
700
- class ye {
698
+ ], Re.prototype, "endTime");
699
+ let Sr = Re;
700
+ class ve {
701
701
  id;
702
702
  code;
703
703
  version;
@@ -712,20 +712,20 @@ class ye {
712
712
  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 || [];
713
713
  }
714
714
  }
715
- E([
715
+ A([
716
716
  Q({
717
717
  message: "archbase:Informe o nome"
718
718
  })
719
- ], ye.prototype, "name");
720
- E([
719
+ ], ve.prototype, "name");
720
+ A([
721
721
  Q({
722
722
  message: "archbase:Informe a descrição"
723
723
  })
724
- ], ye.prototype, "description");
725
- E([
724
+ ], ve.prototype, "description");
725
+ A([
726
726
  Z()
727
- ], ye.prototype, "actions");
728
- const ve = class xt {
727
+ ], ve.prototype, "actions");
728
+ const we = class St {
729
729
  id;
730
730
  code;
731
731
  version;
@@ -741,48 +741,48 @@ const ve = class xt {
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 kt(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 It(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 xt({
746
+ static newInstance = () => new St({
747
747
  id: ee(),
748
748
  active: !0,
749
749
  isNewAction: !0
750
750
  });
751
751
  };
752
- E([
752
+ A([
753
753
  Q({
754
754
  message: "archbase:Informe o nome para a ação"
755
755
  })
756
- ], ve.prototype, "name");
757
- E([
756
+ ], we.prototype, "name");
757
+ A([
758
758
  Q({
759
759
  message: "archbase:Informe a descrição para a ação"
760
760
  })
761
- ], ve.prototype, "description");
762
- E([
761
+ ], we.prototype, "description");
762
+ A([
763
763
  Z()
764
- ], ve.prototype, "resource");
765
- E([
764
+ ], we.prototype, "resource");
765
+ A([
766
766
  Q({
767
767
  message: "archbase:Informe a categoria para a ação"
768
768
  })
769
- ], ve.prototype, "category");
770
- E([
769
+ ], we.prototype, "category");
770
+ A([
771
771
  se()
772
- ], ve.prototype, "active");
773
- let Sr = ve;
774
- class Se extends ye {
772
+ ], we.prototype, "active");
773
+ let kr = we;
774
+ class ke extends ve {
775
775
  type;
776
776
  isNewProfile;
777
777
  constructor(e) {
778
- super(e), this.type = me.PROFILE, this.isNewProfile = e.isNewProfile || !1;
778
+ super(e), this.type = ge.PROFILE, this.isNewProfile = e.isNewProfile || !1;
779
779
  }
780
- static newInstance = () => new Se({
780
+ static newInstance = () => new ke({
781
781
  id: ee(),
782
782
  isNewProfile: !0
783
783
  });
784
784
  }
785
- class Ge {
785
+ class Ke {
786
786
  id;
787
787
  code;
788
788
  version;
@@ -792,25 +792,25 @@ class Ge {
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 ke(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 Ie(e.group) : void 0;
796
796
  }
797
- static newInstance = (e) => new Ge({
797
+ static newInstance = (e) => new Ke({
798
798
  id: ee(),
799
799
  group: e
800
800
  });
801
801
  }
802
- class ke extends ye {
802
+ class Ie extends ve {
803
803
  type;
804
804
  isNewGroup;
805
805
  constructor(e) {
806
- super(e), this.type = me.GROUP, this.isNewGroup = e.isNewGroup || !1;
806
+ super(e), this.type = ge.GROUP, this.isNewGroup = e.isNewGroup || !1;
807
807
  }
808
- static newInstance = () => new ke({
808
+ static newInstance = () => new Ie({
809
809
  id: ee(),
810
810
  isNewGroup: !0
811
811
  });
812
812
  }
813
- const Re = class St {
813
+ const Me = class kt {
814
814
  id;
815
815
  code;
816
816
  version;
@@ -827,28 +827,28 @@ const Re = class St {
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 St({
830
+ static newInstance = () => new kt({
831
831
  id: ee(),
832
832
  actions: [],
833
833
  active: !0,
834
834
  isNewResource: !0
835
835
  });
836
836
  };
837
- E([
837
+ A([
838
838
  Q({
839
839
  message: "archbase:Informe o nome para o recurso"
840
840
  })
841
- ], Re.prototype, "name");
842
- E([
841
+ ], Me.prototype, "name");
842
+ A([
843
843
  Q({
844
844
  message: "archbase:Informe a descrição para o recurso"
845
845
  })
846
- ], Re.prototype, "description");
847
- E([
846
+ ], Me.prototype, "description");
847
+ A([
848
848
  se()
849
- ], Re.prototype, "active");
850
- let kt = Re;
851
- const O = class It extends ye {
849
+ ], Me.prototype, "active");
850
+ let It = Me;
851
+ const O = class Ct extends ve {
852
852
  userName;
853
853
  password;
854
854
  changePasswordOnNextLogin;
@@ -871,9 +871,9 @@ const O = class It extends ye {
871
871
  employeeId;
872
872
  externalId;
873
873
  constructor(e) {
874
- super(e), this.type = me.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.passwordChangedAt = e.passwordChangedAt || void 0, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new Se(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname, this.employeeId = e.employeeId || void 0, this.externalId = e.externalId || void 0;
874
+ 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 Et(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ke(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, this.employeeId = e.employeeId || void 0, this.externalId = e.externalId || void 0;
875
875
  }
876
- static newInstance = () => new It({
876
+ static newInstance = () => new Ct({
877
877
  id: ee(),
878
878
  userName: "",
879
879
  password: "",
@@ -885,63 +885,63 @@ const O = class It extends ye {
885
885
  isNewUser: !0
886
886
  });
887
887
  };
888
- E([
888
+ A([
889
889
  Q({
890
890
  message: "archbase:Informe o nome de usuário"
891
891
  })
892
892
  ], O.prototype, "userName");
893
- E([
893
+ A([
894
894
  se()
895
895
  ], O.prototype, "changePasswordOnNextLogin");
896
- E([
896
+ A([
897
897
  se()
898
898
  ], O.prototype, "allowPasswordChange");
899
- E([
899
+ A([
900
900
  se()
901
901
  ], O.prototype, "allowMultipleLogins");
902
- E([
902
+ A([
903
903
  se()
904
904
  ], O.prototype, "passwordNeverExpires");
905
- E([
905
+ A([
906
906
  Z()
907
907
  ], O.prototype, "passwordChangedAt");
908
- E([
908
+ A([
909
909
  se()
910
910
  ], O.prototype, "accountDeactivated");
911
- E([
911
+ A([
912
912
  se()
913
913
  ], O.prototype, "accountLocked");
914
- E([
914
+ A([
915
915
  se()
916
916
  ], O.prototype, "unlimitedAccessHours");
917
- E([
917
+ A([
918
918
  se()
919
919
  ], O.prototype, "isAdministrator");
920
- E([
920
+ A([
921
921
  Z()
922
922
  ], O.prototype, "accessSchedule");
923
- E([
923
+ A([
924
924
  Z()
925
925
  ], O.prototype, "groups");
926
- E([
926
+ A([
927
927
  Z()
928
928
  ], O.prototype, "profile");
929
- E([
930
- Ft(
929
+ A([
930
+ Ht(
931
931
  {},
932
932
  {
933
933
  message: "archbase:Informe um email válido"
934
934
  }
935
935
  )
936
936
  ], O.prototype, "email");
937
- E([
937
+ A([
938
938
  Z()
939
939
  ], O.prototype, "employeeId");
940
- E([
940
+ A([
941
941
  Z()
942
942
  ], O.prototype, "externalId");
943
- let Me = O;
944
- const Je = class Fe {
943
+ let Ne = O;
944
+ const qe = class He {
945
945
  id;
946
946
  code;
947
947
  version;
@@ -955,35 +955,35 @@ const Je = class Fe {
955
955
  companyId;
956
956
  projectId;
957
957
  constructor(e) {
958
- 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 Sr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
958
+ 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 ? He.createDtoFromJson(e.security) : void 0, this.action = e.action ? new kr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
959
959
  }
960
960
  static createDtoFromJson(e) {
961
961
  switch (e.type) {
962
962
  case "profile":
963
- return new Se(e);
964
- case "group":
965
963
  return new ke(e);
964
+ case "group":
965
+ return new Ie(e);
966
966
  case "user":
967
- return new Me(e);
967
+ return new Ne(e);
968
968
  default:
969
969
  throw new Error("Unknown DTO type");
970
970
  }
971
971
  }
972
- static newInstance = () => new Fe({
972
+ static newInstance = () => new He({
973
973
  id: ee(),
974
974
  tenantId: "",
975
975
  companyId: "",
976
976
  projectId: ""
977
977
  });
978
978
  };
979
- E([
979
+ A([
980
980
  Z()
981
- ], Je.prototype, "security");
982
- E([
981
+ ], qe.prototype, "security");
982
+ A([
983
983
  Z()
984
- ], Je.prototype, "action");
985
- let Kr = Je;
986
- class Ke {
984
+ ], qe.prototype, "action");
985
+ let qr = qe;
986
+ class Ye {
987
987
  id;
988
988
  code;
989
989
  version;
@@ -1001,13 +1001,13 @@ class Ke {
1001
1001
  activated;
1002
1002
  isNovoToken;
1003
1003
  constructor(e) {
1004
- 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 Me(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;
1004
+ 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;
1005
1005
  }
1006
- static newInstance = () => new Ke({
1006
+ static newInstance = () => new Ye({
1007
1007
  id: ee()
1008
1008
  });
1009
1009
  }
1010
- class qe {
1010
+ class Xe {
1011
1011
  id;
1012
1012
  code;
1013
1013
  version;
@@ -1024,23 +1024,23 @@ class qe {
1024
1024
  user;
1025
1025
  isNewAccessToken;
1026
1026
  constructor(e) {
1027
- 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 Me(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;
1027
+ 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;
1028
1028
  }
1029
- static newInstance = () => new qe({
1029
+ static newInstance = () => new Xe({
1030
1030
  id: ee(),
1031
1031
  active: !0,
1032
1032
  isNewAccessToken: !0
1033
1033
  });
1034
1034
  }
1035
- class Ct extends ge {
1035
+ class Pt extends ye {
1036
1036
  constructor(e) {
1037
1037
  super(e);
1038
1038
  }
1039
1039
  configureHeaders() {
1040
- return J.getInstance().getHeaders();
1040
+ return G.getInstance().getHeaders();
1041
1041
  }
1042
1042
  transform(e) {
1043
- return new Me(e);
1043
+ return new Ne(e);
1044
1044
  }
1045
1045
  getEndpoint() {
1046
1046
  return "/api/v1/user";
@@ -1059,17 +1059,17 @@ class Ct extends ge {
1059
1059
  return this.transform(t);
1060
1060
  }
1061
1061
  }
1062
- I.decorate(I.inject(Y.ApiClient), Ct, 0);
1063
- I.decorate(I.injectable(), Ct);
1064
- class Pt extends ge {
1062
+ I.decorate(I.inject(q.ApiClient), Pt, 0);
1063
+ I.decorate(I.injectable(), Pt);
1064
+ class Tt extends ye {
1065
1065
  constructor(e) {
1066
1066
  super(e);
1067
1067
  }
1068
1068
  configureHeaders() {
1069
- return J.getInstance().getHeaders();
1069
+ return G.getInstance().getHeaders();
1070
1070
  }
1071
1071
  transform(e) {
1072
- return new ke(e);
1072
+ return new Ie(e);
1073
1073
  }
1074
1074
  getEndpoint() {
1075
1075
  return "/api/v1/group";
@@ -1081,17 +1081,17 @@ class Pt extends ge {
1081
1081
  return e.isNewGroup;
1082
1082
  }
1083
1083
  }
1084
- I.decorate(I.inject(Y.ApiClient), Pt, 0);
1085
- I.decorate(I.injectable(), Pt);
1086
- class Tt extends ge {
1084
+ I.decorate(I.inject(q.ApiClient), Tt, 0);
1085
+ I.decorate(I.injectable(), Tt);
1086
+ class Ut extends ye {
1087
1087
  constructor(e) {
1088
1088
  super(e);
1089
1089
  }
1090
1090
  configureHeaders() {
1091
- return J.getInstance().getHeaders();
1091
+ return G.getInstance().getHeaders();
1092
1092
  }
1093
1093
  transform(e) {
1094
- return new Se(e);
1094
+ return new ke(e);
1095
1095
  }
1096
1096
  getEndpoint() {
1097
1097
  return "/api/v1/userProfile";
@@ -1103,17 +1103,17 @@ class Tt extends ge {
1103
1103
  return e.isNewProfile;
1104
1104
  }
1105
1105
  }
1106
- I.decorate(I.inject(Y.ApiClient), Tt, 0);
1107
- I.decorate(I.injectable(), Tt);
1108
- class Ut extends ge {
1106
+ I.decorate(I.inject(q.ApiClient), Ut, 0);
1107
+ I.decorate(I.injectable(), Ut);
1108
+ class Dt extends ye {
1109
1109
  constructor(e) {
1110
1110
  super(e);
1111
1111
  }
1112
1112
  configureHeaders() {
1113
- return J.getInstance().getHeaders();
1113
+ return G.getInstance().getHeaders();
1114
1114
  }
1115
1115
  transform(e) {
1116
- return new Ke(e);
1116
+ return new Ye(e);
1117
1117
  }
1118
1118
  getEndpoint() {
1119
1119
  return "/api/v1/apiToken";
@@ -1125,12 +1125,12 @@ class Ut extends ge {
1125
1125
  return e.isNovoToken;
1126
1126
  }
1127
1127
  async create(e, t, s, n) {
1128
- const a = await this.client.post(
1128
+ const c = await this.client.post(
1129
1129
  `${this.getEndpoint()}/create?email=${e}&expirationDate=${t}&name=${s}&description=${n}`,
1130
1130
  void 0,
1131
1131
  this.configureHeaders()
1132
1132
  );
1133
- return this.transform(a);
1133
+ return this.transform(c);
1134
1134
  }
1135
1135
  async revoke(e) {
1136
1136
  await this.client.post(
@@ -1140,17 +1140,17 @@ class Ut extends ge {
1140
1140
  );
1141
1141
  }
1142
1142
  }
1143
- I.decorate(I.inject(Y.ApiClient), Ut, 0);
1144
- I.decorate(I.injectable(), Ut);
1145
- class Dt extends ge {
1143
+ I.decorate(I.inject(q.ApiClient), Dt, 0);
1144
+ I.decorate(I.injectable(), Dt);
1145
+ class _t extends ye {
1146
1146
  constructor(e) {
1147
1147
  super(e);
1148
1148
  }
1149
1149
  configureHeaders() {
1150
- return J.getInstance().getHeaders();
1150
+ return G.getInstance().getHeaders();
1151
1151
  }
1152
1152
  transform(e) {
1153
- return new qe(e);
1153
+ return new Xe(e);
1154
1154
  }
1155
1155
  getEndpoint() {
1156
1156
  return "/api/v1/accessToken";
@@ -1169,17 +1169,17 @@ class Dt extends ge {
1169
1169
  );
1170
1170
  }
1171
1171
  }
1172
- I.decorate(I.inject(Y.ApiClient), Dt, 0);
1173
- I.decorate(I.injectable(), Dt);
1174
- class _t extends ge {
1172
+ I.decorate(I.inject(q.ApiClient), _t, 0);
1173
+ I.decorate(I.injectable(), _t);
1174
+ class Rt extends ye {
1175
1175
  constructor(e) {
1176
1176
  super(e);
1177
1177
  }
1178
1178
  configureHeaders() {
1179
- return J.getInstance().getHeaders();
1179
+ return G.getInstance().getHeaders();
1180
1180
  }
1181
1181
  transform(e) {
1182
- return new kt(e);
1182
+ return new It(e);
1183
1183
  }
1184
1184
  getEndpoint() {
1185
1185
  return "/api/v1/resource";
@@ -1203,7 +1203,7 @@ class _t extends ge {
1203
1203
  !1,
1204
1204
  {
1205
1205
  params: {
1206
- type: Qe(me, t)
1206
+ type: et(ge, t)
1207
1207
  }
1208
1208
  }
1209
1209
  );
@@ -1214,7 +1214,7 @@ class _t extends ge {
1214
1214
  {
1215
1215
  securityId: e,
1216
1216
  actionId: t,
1217
- type: Qe(me, s)
1217
+ type: et(ge, s)
1218
1218
  },
1219
1219
  this.configureHeaders()
1220
1220
  );
@@ -1233,15 +1233,15 @@ class _t extends ge {
1233
1233
  );
1234
1234
  }
1235
1235
  }
1236
- I.decorate(I.inject(Y.ApiClient), _t, 0);
1237
- I.decorate(I.injectable(), _t);
1238
- class Rt {
1236
+ I.decorate(I.inject(q.ApiClient), Rt, 0);
1237
+ I.decorate(I.injectable(), Rt);
1238
+ class Mt {
1239
1239
  client;
1240
1240
  constructor(e) {
1241
1241
  this.client = e;
1242
1242
  }
1243
1243
  configureHeaders() {
1244
- return J.getInstance().getHeaders();
1244
+ return G.getInstance().getHeaders();
1245
1245
  }
1246
1246
  getEndpoint() {
1247
1247
  return "/api/v1/security/diagnostics";
@@ -1353,88 +1353,88 @@ class Rt {
1353
1353
  );
1354
1354
  }
1355
1355
  }
1356
- I.decorate(I.inject(Y.ApiClient), Rt, 0);
1357
- I.decorate(I.injectable(), Rt);
1358
- function qr({
1356
+ I.decorate(I.inject(q.ApiClient), Mt, 0);
1357
+ I.decorate(I.injectable(), Mt);
1358
+ function Yr({
1359
1359
  onLogin: r,
1360
1360
  error: e,
1361
1361
  onClickForgotPassword: t,
1362
1362
  loginLabel: s = "Email",
1363
1363
  loginPlaceholder: n,
1364
- afterInputs: a,
1365
- showMockUsersSelector: c = !1,
1364
+ afterInputs: c,
1365
+ showMockUsersSelector: l = !1,
1366
1366
  mockUsers: i = [],
1367
1367
  mockUsersGroupMap: d,
1368
- options: y = {},
1368
+ options: g = {},
1369
1369
  onChangeUsername: k,
1370
- disabledLogin: h = !1,
1371
- isCheckingUsername: U = !1,
1372
- showSignIn: A = !0,
1373
- mfaRequired: w = !1,
1374
- onVerifyMfa: x,
1370
+ disabledLogin: u = !1,
1371
+ isCheckingUsername: T = !1,
1372
+ showSignIn: b = !0,
1373
+ mfaRequired: v = !1,
1374
+ onVerifyMfa: E,
1375
1375
  mfaError: P,
1376
1376
  onCancelMfa: M,
1377
1377
  isVerifyingMfa: B = !1
1378
1378
  }) {
1379
- const H = ut(), {
1380
- username: _,
1381
- password: b,
1382
- rememberMe: m,
1383
- clearRememberMe: R
1384
- } = Ht(), [V, L] = p(_), [N, T] = p(b), [te, re] = p(m), [ne, g] = p(!1), [v, K] = p(null), [W, we] = p("");
1385
- X(() => {
1386
- g(!!e);
1387
- }, [e]), X(() => {
1388
- _ !== V && (L(_), k?.(_)), b !== N && T(b), m !== te && re(m);
1389
- }, [_, b, m]);
1379
+ const F = ht(), {
1380
+ username: D,
1381
+ password: w,
1382
+ rememberMe: f,
1383
+ clearRememberMe: _
1384
+ } = Vt(), [H, L] = p(D), [N, X] = p(w), [U, te] = p(f), [ae, m] = p(!1), [y, J] = p(null), [V, be] = p("");
1385
+ Y(() => {
1386
+ m(!!e);
1387
+ }, [e]), Y(() => {
1388
+ D !== H && (L(D), k?.(D)), w !== N && X(w), f !== U && te(f);
1389
+ }, [D, w, f]);
1390
1390
  const he = () => {
1391
- g(!1);
1391
+ m(!1);
1392
1392
  }, $ = () => {
1393
- V && N && r(V, N, te).finally(() => g(!0));
1393
+ H && N && r(H, N, U).finally(() => m(!0));
1394
1394
  }, ce = () => {
1395
- const l = W.trim();
1396
- l && x && x(l);
1397
- }, oe = () => {
1395
+ const a = V.trim();
1396
+ a && E && E(a);
1397
+ }, ne = () => {
1398
1398
  if (!d)
1399
- return i.map((f) => ({
1400
- value: f.email,
1401
- label: f.email
1399
+ return i.map((h) => ({
1400
+ value: h.email,
1401
+ label: h.email
1402
1402
  }));
1403
- const l = i.reduce((f, D) => {
1404
- const j = d[D.type];
1405
- return j && (f[j] || (f[j] = []), f[j].push({
1406
- value: D.email,
1407
- label: D.email
1408
- })), f;
1403
+ const a = i.reduce((h, x) => {
1404
+ const R = d[x.type];
1405
+ return R && (h[R] || (h[R] = []), h[R].push({
1406
+ value: x.email,
1407
+ label: x.email
1408
+ })), h;
1409
1409
  }, {});
1410
- return Object.entries(l).map(([f, D]) => ({
1411
- group: f,
1412
- items: D
1410
+ return Object.entries(a).map(([h, x]) => ({
1411
+ group: h,
1412
+ items: x
1413
1413
  }));
1414
- }, be = () => {
1415
- if (v) {
1416
- const l = i.find((f) => f.email === v);
1417
- l && (L(l.email), T(l.password), he());
1414
+ }, Ae = () => {
1415
+ if (y) {
1416
+ const a = i.find((h) => h.email === y);
1417
+ a && (L(a.email), X(a.password), he());
1418
1418
  }
1419
- }, u = {
1419
+ }, pe = {
1420
1420
  withBorder: !0,
1421
1421
  shadow: "md",
1422
1422
  p: 30,
1423
1423
  mt: 30,
1424
1424
  radius: "md",
1425
1425
  w: 400,
1426
- ...y.cardProps
1426
+ ...g.cardProps
1427
1427
  };
1428
1428
  return /* @__PURE__ */ C(
1429
- We,
1429
+ Je,
1430
1430
  {
1431
- ...u,
1431
+ ...pe,
1432
1432
  pos: "relative",
1433
- ref: H,
1433
+ ref: F,
1434
1434
  children: [
1435
- A && /* @__PURE__ */ C(ae, { children: [
1435
+ b && /* @__PURE__ */ C(ie, { children: [
1436
1436
  /* @__PURE__ */ o(
1437
- F,
1437
+ j,
1438
1438
  {
1439
1439
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1440
1440
  fw: 800,
@@ -1444,43 +1444,43 @@ function qr({
1444
1444
  children: S().t("archbase:signIn")
1445
1445
  }
1446
1446
  ),
1447
- /* @__PURE__ */ o(Ue, { m: "md" })
1447
+ /* @__PURE__ */ o(De, { m: "md" })
1448
1448
  ] }),
1449
- y?.customContentBefore,
1450
- w && /* @__PURE__ */ C(Ee, { gap: "md", children: [
1449
+ g?.customContentBefore,
1450
+ v && /* @__PURE__ */ C(xe, { gap: "md", children: [
1451
1451
  /* @__PURE__ */ C("div", { children: [
1452
- /* @__PURE__ */ o(F, { fw: 700, fz: "lg", children: S().t("archbase:mfa.title", "Verificação em duas etapas") }),
1453
- /* @__PURE__ */ o(F, { c: "dimmed", fz: "sm", children: S().t(
1452
+ /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: S().t("archbase:mfa.title", "Verificação em duas etapas") }),
1453
+ /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: S().t(
1454
1454
  "archbase:mfa.subtitle",
1455
1455
  "Digite o código do seu aplicativo autenticador (ou um código de recuperação)."
1456
1456
  ) })
1457
1457
  ] }),
1458
1458
  /* @__PURE__ */ o(
1459
- xe,
1459
+ Se,
1460
1460
  {
1461
1461
  label: S().t("archbase:mfa.code", "Código de verificação"),
1462
1462
  placeholder: "000000",
1463
- value: W,
1463
+ value: V,
1464
1464
  autoFocus: !0,
1465
- onChange: (l) => we(l.currentTarget.value),
1466
- onKeyDown: (l) => {
1467
- l.key === "Enter" && ce();
1465
+ onChange: (a) => be(a.currentTarget.value),
1466
+ onKeyDown: (a) => {
1467
+ a.key === "Enter" && ce();
1468
1468
  }
1469
1469
  }
1470
1470
  ),
1471
- P && /* @__PURE__ */ o(F, { c: "red", fz: "sm", children: P }),
1471
+ P && /* @__PURE__ */ o(j, { c: "red", fz: "sm", children: P }),
1472
1472
  /* @__PURE__ */ o(
1473
- G,
1473
+ W,
1474
1474
  {
1475
1475
  fullWidth: !0,
1476
- disabled: !W.trim() || B,
1476
+ disabled: !V.trim() || B,
1477
1477
  loading: B,
1478
1478
  onClick: ce,
1479
1479
  children: S().t("archbase:mfa.verify", "Verificar")
1480
1480
  }
1481
1481
  ),
1482
1482
  M && /* @__PURE__ */ o(
1483
- et,
1483
+ rt,
1484
1484
  {
1485
1485
  component: "button",
1486
1486
  c: "var(--mantine-text-color)",
@@ -1492,55 +1492,55 @@ function qr({
1492
1492
  }
1493
1493
  )
1494
1494
  ] }),
1495
- !w && /* @__PURE__ */ C(ae, { children: [
1496
- c && /* @__PURE__ */ C(ae, { children: [
1495
+ !v && /* @__PURE__ */ C(ie, { children: [
1496
+ l && /* @__PURE__ */ C(ie, { children: [
1497
1497
  /* @__PURE__ */ C(ue, { gap: "sm", mb: "md", children: [
1498
1498
  /* @__PURE__ */ o(
1499
- Yt,
1499
+ Xt,
1500
1500
  {
1501
1501
  placeholder: "Selecione um usuário mock",
1502
- data: oe(),
1503
- value: v,
1504
- onChange: (l) => K(l ?? ""),
1502
+ data: ne(),
1503
+ value: y,
1504
+ onChange: (a) => J(a ?? ""),
1505
1505
  searchable: !0,
1506
1506
  clearable: !0,
1507
1507
  style: { flexGrow: 1 }
1508
1508
  }
1509
1509
  ),
1510
- /* @__PURE__ */ o(Xt, { label: "Aplicar", children: /* @__PURE__ */ o(
1511
- G,
1510
+ /* @__PURE__ */ o(Qt, { label: "Aplicar", children: /* @__PURE__ */ o(
1511
+ W,
1512
1512
  {
1513
1513
  variant: "light",
1514
1514
  size: "sm",
1515
- onClick: be,
1516
- disabled: !v,
1515
+ onClick: Ae,
1516
+ disabled: !y,
1517
1517
  "aria-label": "Aplicar usuário mock selecionado",
1518
- children: /* @__PURE__ */ o(rr, { size: 16 })
1518
+ children: /* @__PURE__ */ o(sr, { size: 16 })
1519
1519
  }
1520
1520
  ) })
1521
1521
  ] }),
1522
- /* @__PURE__ */ o(Ue, { mb: "md" })
1522
+ /* @__PURE__ */ o(De, { mb: "md" })
1523
1523
  ] }),
1524
1524
  /* @__PURE__ */ o(
1525
- xe,
1525
+ Se,
1526
1526
  {
1527
1527
  label: s,
1528
1528
  placeholder: n ?? S().t("archbase:usuario@email.com"),
1529
- rightSection: U ? /* @__PURE__ */ o(dt, { size: "xs" }) : null,
1530
- value: V || "",
1529
+ rightSection: T ? /* @__PURE__ */ o(ut, { size: "xs" }) : null,
1530
+ value: H || "",
1531
1531
  required: !0,
1532
- onChange: (l) => {
1533
- L(l.currentTarget.value), k?.(l.currentTarget.value), he();
1532
+ onChange: (a) => {
1533
+ L(a.currentTarget.value), k?.(a.currentTarget.value), he();
1534
1534
  }
1535
1535
  }
1536
1536
  ),
1537
1537
  /* @__PURE__ */ o(
1538
- ze,
1538
+ je,
1539
1539
  {
1540
1540
  label: S().t("archbase:Password"),
1541
1541
  placeholder: S().t("archbase:Sua senha"),
1542
- onChange: (l) => {
1543
- T(l.currentTarget.value), he();
1542
+ onChange: (a) => {
1543
+ X(a.currentTarget.value), he();
1544
1544
  },
1545
1545
  value: N || "",
1546
1546
  required: !0,
@@ -1549,18 +1549,18 @@ function qr({
1549
1549
  ),
1550
1550
  /* @__PURE__ */ C(ue, { justify: "space-between", mt: "md", children: [
1551
1551
  /* @__PURE__ */ o(
1552
- Qt,
1552
+ Zt,
1553
1553
  {
1554
1554
  label: S().t("archbase:Lembre-me"),
1555
- checked: te,
1556
- onChange: (l) => {
1557
- const f = l.currentTarget.checked;
1558
- re(f), f || R();
1555
+ checked: U,
1556
+ onChange: (a) => {
1557
+ const h = a.currentTarget.checked;
1558
+ te(h), h || _();
1559
1559
  }
1560
1560
  }
1561
1561
  ),
1562
1562
  t && /* @__PURE__ */ o(
1563
- et,
1563
+ rt,
1564
1564
  {
1565
1565
  component: "button",
1566
1566
  c: "var(--mantine-text-color)",
@@ -1572,11 +1572,11 @@ function qr({
1572
1572
  }
1573
1573
  )
1574
1574
  ] }),
1575
- y?.afterInputs || a,
1575
+ g?.afterInputs || c,
1576
1576
  /* @__PURE__ */ o(
1577
- G,
1577
+ W,
1578
1578
  {
1579
- disabled: !N || !V || h,
1579
+ disabled: !N || !H || u,
1580
1580
  fullWidth: !0,
1581
1581
  mt: "xl",
1582
1582
  onClick: $,
@@ -1584,156 +1584,156 @@ function qr({
1584
1584
  }
1585
1585
  )
1586
1586
  ] }),
1587
- y?.customContentAfter,
1588
- ne && e && /* @__PURE__ */ o(F, { c: "red", mt: "sm", children: e })
1587
+ g?.customContentAfter,
1588
+ ae && e && /* @__PURE__ */ o(j, { c: "red", mt: "sm", children: e })
1589
1589
  ]
1590
1590
  }
1591
1591
  );
1592
1592
  }
1593
1593
  const z = (r, e) => S().t(r, e);
1594
- function Yr({
1594
+ function Xr({
1595
1595
  enabled: r,
1596
1596
  onSetup: e,
1597
1597
  onEnable: t,
1598
1598
  onDisable: s,
1599
1599
  onStatusChange: n
1600
1600
  }) {
1601
- const [a, c] = p("idle"), [i, d] = p(null), [y, k] = p(""), [h, U] = p([]), [A, w] = p(!1), [x, P] = p(null), M = async () => {
1602
- w(!0), P(null);
1601
+ const [c, l] = p("idle"), [i, d] = p(null), [g, k] = p(""), [u, T] = p([]), [b, v] = p(!1), [E, P] = p(null), M = async () => {
1602
+ v(!0), P(null);
1603
1603
  try {
1604
- const b = await e();
1605
- d(b), k(""), c("setup");
1606
- } catch (b) {
1607
- P(b?.message || String(b));
1604
+ const w = await e();
1605
+ d(w), k(""), l("setup");
1606
+ } catch (w) {
1607
+ P(w?.message || String(w));
1608
1608
  } finally {
1609
- w(!1);
1609
+ v(!1);
1610
1610
  }
1611
1611
  }, B = async () => {
1612
- const b = y.trim();
1613
- if (b) {
1614
- w(!0), P(null);
1612
+ const w = g.trim();
1613
+ if (w) {
1614
+ v(!0), P(null);
1615
1615
  try {
1616
- const m = await t(b);
1617
- U(m), c("recovery"), n?.(!0);
1618
- } catch (m) {
1619
- P(m?.message || String(m));
1616
+ const f = await t(w);
1617
+ T(f), l("recovery"), n?.(!0);
1618
+ } catch (f) {
1619
+ P(f?.message || String(f));
1620
1620
  } finally {
1621
- w(!1);
1621
+ v(!1);
1622
1622
  }
1623
1623
  }
1624
- }, H = async () => {
1625
- w(!0), P(null);
1624
+ }, F = async () => {
1625
+ v(!0), P(null);
1626
1626
  try {
1627
- await s(), d(null), U([]), c("idle"), n?.(!1);
1628
- } catch (b) {
1629
- P(b?.message || String(b));
1627
+ await s(), d(null), T([]), l("idle"), n?.(!1);
1628
+ } catch (w) {
1629
+ P(w?.message || String(w));
1630
1630
  } finally {
1631
- w(!1);
1631
+ v(!1);
1632
1632
  }
1633
- }, _ = () => {
1634
- U([]), d(null), k(""), c("idle");
1633
+ }, D = () => {
1634
+ T([]), d(null), k(""), l("idle");
1635
1635
  };
1636
- return /* @__PURE__ */ o(We, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
1636
+ return /* @__PURE__ */ o(Je, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(xe, { gap: "md", children: [
1637
1637
  /* @__PURE__ */ C("div", { children: [
1638
- /* @__PURE__ */ o(F, { fw: 700, fz: "lg", children: z("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1639
- /* @__PURE__ */ o(F, { c: "dimmed", fz: "sm", children: z(
1638
+ /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: z("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1639
+ /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: z(
1640
1640
  "archbase:mfa.setup.subtitle",
1641
1641
  "Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
1642
1642
  ) })
1643
1643
  ] }),
1644
- x && /* @__PURE__ */ o(tt, { color: "red", children: x }),
1645
- r && a === "idle" && /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1646
- /* @__PURE__ */ o(F, { c: "teal", fw: 600, children: z("archbase:mfa.setup.active", "MFA ativo") }),
1647
- /* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick: H, children: z("archbase:mfa.setup.disable", "Desativar") })
1644
+ E && /* @__PURE__ */ o(st, { color: "red", children: E }),
1645
+ r && c === "idle" && /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1646
+ /* @__PURE__ */ o(j, { c: "teal", fw: 600, children: z("archbase:mfa.setup.active", "MFA ativo") }),
1647
+ /* @__PURE__ */ o(W, { color: "red", variant: "light", loading: b, onClick: F, children: z("archbase:mfa.setup.disable", "Desativar") })
1648
1648
  ] }),
1649
- !r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children: z("archbase:mfa.setup.enable", "Ativar MFA") }),
1650
- a === "setup" && i && /* @__PURE__ */ C(Ee, { gap: "sm", align: "center", children: [
1651
- /* @__PURE__ */ o(F, { fz: "sm", ta: "center", children: z(
1649
+ !r && c === "idle" && /* @__PURE__ */ o(W, { loading: b, onClick: M, children: z("archbase:mfa.setup.enable", "Ativar MFA") }),
1650
+ c === "setup" && i && /* @__PURE__ */ C(xe, { gap: "sm", align: "center", children: [
1651
+ /* @__PURE__ */ o(j, { fz: "sm", ta: "center", children: z(
1652
1652
  "archbase:mfa.setup.scan",
1653
1653
  "Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
1654
1654
  ) }),
1655
- /* @__PURE__ */ o(sr, { value: i.provisioningUri, size: 180, level: "M" }),
1656
- /* @__PURE__ */ o(F, { fz: "xs", c: "dimmed", ta: "center", children: z("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1655
+ /* @__PURE__ */ o(nr, { value: i.provisioningUri, size: 180, level: "M" }),
1656
+ /* @__PURE__ */ o(j, { fz: "xs", c: "dimmed", ta: "center", children: z("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1657
1657
  /* @__PURE__ */ C(ue, { gap: "xs", children: [
1658
- /* @__PURE__ */ o(rt, { children: i.secret }),
1659
- /* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copy", "Copiar") }) })
1658
+ /* @__PURE__ */ o(nt, { children: i.secret }),
1659
+ /* @__PURE__ */ o(ot, { value: i.secret, children: ({ copied: w, copy: f }) => /* @__PURE__ */ o(W, { size: "xs", variant: "subtle", onClick: f, children: w ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copy", "Copiar") }) })
1660
1660
  ] }),
1661
1661
  /* @__PURE__ */ o(
1662
- xe,
1662
+ Se,
1663
1663
  {
1664
1664
  w: "100%",
1665
1665
  label: z("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1666
1666
  placeholder: "000000",
1667
- value: y,
1668
- onChange: (b) => k(b.currentTarget.value),
1669
- onKeyDown: (b) => {
1670
- b.key === "Enter" && B();
1667
+ value: g,
1668
+ onChange: (w) => k(w.currentTarget.value),
1669
+ onKeyDown: (w) => {
1670
+ w.key === "Enter" && B();
1671
1671
  }
1672
1672
  }
1673
1673
  ),
1674
1674
  /* @__PURE__ */ C(ue, { w: "100%", justify: "flex-end", children: [
1675
- /* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children: z("archbase:mfa.setup.cancel", "Cancelar") }),
1676
- /* @__PURE__ */ o(G, { onClick: B, loading: A, disabled: !y.trim(), children: z("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1675
+ /* @__PURE__ */ o(W, { variant: "default", onClick: D, disabled: b, children: z("archbase:mfa.setup.cancel", "Cancelar") }),
1676
+ /* @__PURE__ */ o(W, { onClick: B, loading: b, disabled: !g.trim(), children: z("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1677
1677
  ] })
1678
1678
  ] }),
1679
- a === "recovery" && /* @__PURE__ */ C(Ee, { gap: "sm", children: [
1680
- /* @__PURE__ */ o(tt, { color: "yellow", children: z(
1679
+ c === "recovery" && /* @__PURE__ */ C(xe, { gap: "sm", children: [
1680
+ /* @__PURE__ */ o(st, { color: "yellow", children: z(
1681
1681
  "archbase:mfa.setup.recoveryWarning",
1682
1682
  "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."
1683
1683
  ) }),
1684
- /* @__PURE__ */ o(Zt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ o(rt, { fz: "sm", children: b }, b)) }),
1684
+ /* @__PURE__ */ o(er, { cols: 2, spacing: "xs", children: u.map((w) => /* @__PURE__ */ o(nt, { fz: "sm", children: w }, w)) }),
1685
1685
  /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1686
- /* @__PURE__ */ o(st, { value: h.join(`
1687
- `), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1688
- /* @__PURE__ */ o(G, { onClick: _, children: z("archbase:mfa.setup.done", "Guardei os códigos") })
1686
+ /* @__PURE__ */ o(ot, { value: u.join(`
1687
+ `), children: ({ copied: w, copy: f }) => /* @__PURE__ */ o(W, { variant: "subtle", onClick: f, children: w ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1688
+ /* @__PURE__ */ o(W, { onClick: D, children: z("archbase:mfa.setup.done", "Guardei os códigos") })
1689
1689
  ] })
1690
1690
  ] })
1691
1691
  ] }) });
1692
1692
  }
1693
- const kr = {
1693
+ const Ir = {
1694
1694
  position: "relative",
1695
1695
  width: "90%",
1696
1696
  maxWidth: 400,
1697
1697
  padding: 30,
1698
1698
  marginTop: 30
1699
1699
  };
1700
- function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: k = !0 }) {
1701
- const h = ut(), U = Vt(), { colorScheme: A } = er(), [w, x] = p(r ?? ""), [P, M] = p(c), [B, H] = p(""), [_, b] = p(""), [m, R] = p(""), [V, L] = p(!1), [N, T] = p(""), [te, re] = p(""), [ne, g] = p(""), [v, K] = p(""), W = Wt(y);
1702
- async function we($) {
1703
- $ && (Gt($) ? await e($).then(() => {
1704
- nt.showSuccess(`${S().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
1700
+ function Qr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: c, initialEmail: l = "", description: i, style: d, passwordPolicy: g, showPasswordRequirements: k = !0 }) {
1701
+ const u = ht(), T = Wt(), { colorScheme: b } = tr(), [v, E] = p(r ?? ""), [P, M] = p(l), [B, F] = p(""), [D, w] = p(""), [f, _] = p(""), [H, L] = p(!1), [N, X] = p(""), [U, te] = p(""), [ae, m] = p(""), [y, J] = p(""), V = Gt(g);
1702
+ async function be($) {
1703
+ $ && (Jt($) ? await e($).then(() => {
1704
+ it.showSuccess(`${S().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
1705
1705
  }).catch(() => {
1706
- }) : T(`${S().t("archbase:Email inválido")}`));
1706
+ }) : X(`${S().t("archbase:Email inválido")}`));
1707
1707
  }
1708
- async function he($, ce, oe, be) {
1709
- if ($ && ce && oe) {
1710
- let u = "", l = "", f = "";
1711
- a && (u = a(ce), re(u)), W && (l = Jt(oe, W).error ?? ""), !l && n && (l = n(oe)), g(l), oe !== be && (f = `${S().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t($, ce, oe).then(() => {
1712
- nt.showSuccess(`${S().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
1708
+ async function he($, ce, ne, Ae) {
1709
+ if ($ && ce && ne) {
1710
+ let pe = "", a = "", h = "";
1711
+ c && (pe = c(ce), te(pe)), V && (a = Kt(ne, V).error ?? ""), !a && n && (a = n(ne)), m(a), ne !== Ae && (h = `${S().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, J(h)), !a && !pe && !h && await t($, ce, ne).then(() => {
1712
+ it.showSuccess(`${S().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
1713
1713
  }).catch(() => {
1714
- x(r || `${S().t("archbase:Erro ao redefinir senha.")}`);
1714
+ E(r || `${S().t("archbase:Erro ao redefinir senha.")}`);
1715
1715
  });
1716
1716
  }
1717
1717
  }
1718
- return X(() => {
1719
- r && x(r);
1720
- }, [r]), X(() => {
1721
- x("");
1722
- }, [P, B, _, m]), /* @__PURE__ */ C(
1723
- We,
1718
+ return Y(() => {
1719
+ r && E(r);
1720
+ }, [r]), Y(() => {
1721
+ E("");
1722
+ }, [P, B, D, f]), /* @__PURE__ */ C(
1723
+ Je,
1724
1724
  {
1725
1725
  withBorder: !0,
1726
1726
  shadow: "md",
1727
1727
  radius: "md",
1728
- ref: h,
1728
+ ref: u,
1729
1729
  style: {
1730
- ...kr,
1730
+ ...Ir,
1731
1731
  ...d
1732
1732
  },
1733
1733
  children: [
1734
- V ? /* @__PURE__ */ C(ae, { children: [
1734
+ H ? /* @__PURE__ */ C(ie, { children: [
1735
1735
  /* @__PURE__ */ o(
1736
- F,
1736
+ j,
1737
1737
  {
1738
1738
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1739
1739
  fw: 800,
@@ -1743,79 +1743,79 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1743
1743
  children: S().t("archbase:Redefinir senha")
1744
1744
  }
1745
1745
  ),
1746
- /* @__PURE__ */ o(Ue, { m: "xs" }),
1746
+ /* @__PURE__ */ o(De, { m: "xs" }),
1747
1747
  /* @__PURE__ */ o(
1748
- xe,
1748
+ Se,
1749
1749
  {
1750
1750
  label: S().t("archbase:Código de segurança"),
1751
1751
  placeholder: `${S().t("archbase:Código enviado no seu e-mail")}`,
1752
1752
  value: B || "",
1753
1753
  required: !0,
1754
1754
  onChange: ($) => {
1755
- H($.currentTarget.value), re("");
1755
+ F($.currentTarget.value), te("");
1756
1756
  },
1757
- error: te
1757
+ error: U
1758
1758
  }
1759
1759
  ),
1760
1760
  /* @__PURE__ */ o(
1761
- ze,
1761
+ je,
1762
1762
  {
1763
1763
  label: S().t("archbase:Nova senha"),
1764
1764
  placeholder: S().t("archbase:Nova senha"),
1765
1765
  onChange: ($) => {
1766
- b($.currentTarget.value), g(""), K("");
1766
+ w($.currentTarget.value), m(""), J("");
1767
1767
  },
1768
- value: _,
1768
+ value: D,
1769
1769
  required: !0,
1770
- error: ne
1770
+ error: ae
1771
1771
  }
1772
1772
  ),
1773
- W && /* @__PURE__ */ o(
1774
- nr,
1773
+ V && /* @__PURE__ */ o(
1774
+ or,
1775
1775
  {
1776
- value: _,
1777
- policy: W,
1776
+ value: D,
1777
+ policy: V,
1778
1778
  showRequirements: k
1779
1779
  }
1780
1780
  ),
1781
1781
  /* @__PURE__ */ o(
1782
- ze,
1782
+ je,
1783
1783
  {
1784
1784
  label: S().t("archbase:Confirmar senha"),
1785
1785
  placeholder: S().t("archbase:Confirmar senha"),
1786
1786
  onChange: ($) => {
1787
- R($.currentTarget.value), K("");
1787
+ _($.currentTarget.value), J("");
1788
1788
  },
1789
- value: m || "",
1789
+ value: f || "",
1790
1790
  required: !0,
1791
- error: v
1791
+ error: y
1792
1792
  }
1793
1793
  ),
1794
1794
  /* @__PURE__ */ o(
1795
- G,
1795
+ W,
1796
1796
  {
1797
- disabled: !P || !B || !_ || !m,
1797
+ disabled: !P || !B || !D || !f,
1798
1798
  mt: "md",
1799
1799
  fullWidth: !0,
1800
- onClick: () => he(P, B, _, m),
1800
+ onClick: () => he(P, B, D, f),
1801
1801
  children: `${S().t("archbase:Redefinir senha")}`
1802
1802
  }
1803
1803
  ),
1804
1804
  /* @__PURE__ */ o(
1805
- G,
1805
+ W,
1806
1806
  {
1807
1807
  mt: "6px",
1808
1808
  fullWidth: !0,
1809
- color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
1809
+ color: b === "dark" ? T.colors.dark[4] : T.colors.gray[7],
1810
1810
  onClick: () => {
1811
1811
  N || L(!1);
1812
1812
  },
1813
1813
  children: `${S().t("archbase:Voltar")}`
1814
1814
  }
1815
1815
  )
1816
- ] }) : /* @__PURE__ */ C(ae, { children: [
1816
+ ] }) : /* @__PURE__ */ C(ie, { children: [
1817
1817
  /* @__PURE__ */ o(
1818
- F,
1818
+ j,
1819
1819
  {
1820
1820
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1821
1821
  fw: 800,
@@ -1825,261 +1825,265 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1825
1825
  children: S().t("archbase:Redefinir senha")
1826
1826
  }
1827
1827
  ),
1828
- /* @__PURE__ */ o(F, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1829
- /* @__PURE__ */ o(Ue, { m: "md" }),
1828
+ /* @__PURE__ */ o(j, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1829
+ /* @__PURE__ */ o(De, { m: "md" }),
1830
1830
  /* @__PURE__ */ o(
1831
- xe,
1831
+ Se,
1832
1832
  {
1833
1833
  label: "Email",
1834
1834
  placeholder: `${S().t("archbase:usuario@email.com")}`,
1835
1835
  value: P || "",
1836
1836
  required: !0,
1837
1837
  onChange: ($) => {
1838
- M($.currentTarget.value), T("");
1838
+ M($.currentTarget.value), X("");
1839
1839
  },
1840
1840
  error: N
1841
1841
  }
1842
1842
  ),
1843
1843
  /* @__PURE__ */ o(
1844
- G,
1844
+ W,
1845
1845
  {
1846
1846
  disabled: !P,
1847
1847
  mt: "md",
1848
1848
  fullWidth: !0,
1849
- onClick: () => we(P),
1849
+ onClick: () => be(P),
1850
1850
  children: `${S().t("archbase:Enviar")}`
1851
1851
  }
1852
1852
  ),
1853
1853
  /* @__PURE__ */ o(
1854
- G,
1854
+ W,
1855
1855
  {
1856
1856
  mt: "6px",
1857
1857
  fullWidth: !0,
1858
- color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
1858
+ color: b === "dark" ? T.colors.dark[4] : T.colors.gray[7],
1859
1859
  onClick: () => s && s(),
1860
1860
  children: `${S().t("archbase:Voltar")}`
1861
1861
  }
1862
1862
  )
1863
1863
  ] }),
1864
- w ? /* @__PURE__ */ o(F, { c: "red", style: { textAlign: "justify" }, children: w }) : null
1864
+ v ? /* @__PURE__ */ o(j, { c: "red", style: { textAlign: "justify" }, children: v }) : null
1865
1865
  ]
1866
1866
  }
1867
1867
  );
1868
1868
  }
1869
- const Ir = () => Kt().user, Mt = "archbaseSecurityManagerStore", Qr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1870
- const s = lt(Mt), n = Ir(), a = n?.isAdmin ?? !1, c = n?.id, i = ct(c), d = at(() => {
1869
+ const Cr = () => qt().user, Nt = "archbaseSecurityManagerStore", Zr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1870
+ const s = dt(Nt), n = Cr(), c = n?.isAdmin ?? !1, l = n?.id, i = We(l), d = lt(() => {
1871
1871
  if (!t)
1872
1872
  return null;
1873
- const y = c ? `${r}_${c}` : r;
1874
- if (s && s.existsValue(y)) {
1875
- const h = s.getValue(y);
1876
- if (h && h.isAdmin === a)
1877
- return h;
1873
+ const g = l ? `${r}_${l}` : r;
1874
+ if (s && s.existsValue(g)) {
1875
+ const u = s.getValue(g);
1876
+ if (u && u.isAdmin === c)
1877
+ return u;
1878
1878
  }
1879
- const k = new vt(r, e, a);
1880
- return s && c && s.setValue(y, k), k;
1881
- }, [t, r, e, a, c]);
1882
- return X(() => {
1883
- i.current = c;
1884
- }, [c]), { securityManager: d };
1879
+ const k = new wt(r, e, c);
1880
+ return s && l && s.setValue(g, k), k;
1881
+ }, [t, r, e, c, l]);
1882
+ return Y(() => {
1883
+ i.current = l;
1884
+ }, [l]), { securityManager: d };
1885
1885
  };
1886
- function Oe(r) {
1886
+ function ze(r) {
1887
1887
  const e = r?.response?.data ?? r?.data ?? r;
1888
1888
  return e?.error === "CREDENTIALS_EXPIRED" || e?.requirePasswordChange === !0;
1889
1889
  }
1890
- const Zr = ({
1890
+ const es = ({
1891
1891
  checkIntervalTokenHasExpired: r = 3e4,
1892
1892
  // Verificar a 30 segundos
1893
1893
  expirationThresholdOfToken: e = 300
1894
1894
  // Antecipar em 5 minutos
1895
1895
  }) => {
1896
- const t = De(
1897
- (u) => u.get(Y.TokenManager)
1898
- ), s = De(
1899
- (u) => u.get(Y.Authenticator)
1900
- ), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [k, h] = p(!1), [U, A] = p(!1), [w, x] = p(""), [P, M] = p(""), [B, H] = p(null), [_, b] = p(!1), [m, R] = p(!1), [V, L] = p(null), N = lt(Mt), T = {
1896
+ const t = _e(
1897
+ (a) => a.get(q.TokenManager)
1898
+ ), s = _e(
1899
+ (a) => a.get(q.Authenticator)
1900
+ ), [n, c] = p(null), [l, i] = p(!1), [d, g] = p(!0), [k, u] = p(!1), [T, b] = p(!1), [v, E] = p(""), [P, M] = p(""), [B, F] = p(null), [D, w] = p(!1), [f, _] = p(!1), [H, L] = p(null), N = We(!1), X = dt(Nt), U = {
1901
1901
  hasContextualLogin: typeof s.loginWithContext == "function",
1902
1902
  hasFlexibleLogin: typeof s.loginFlexible == "function",
1903
1903
  hasSocialLogin: typeof s.loginSocial == "function",
1904
1904
  hasRegistration: typeof s.register == "function",
1905
1905
  hasContextSupport: typeof t.saveContext == "function"
1906
1906
  };
1907
- X(() => {
1908
- const u = t.getUsername();
1909
- if (u && u != "" && M(u), T.hasContextSupport && t.getContext) {
1910
- const f = t.getContext();
1911
- if (f)
1907
+ Y(() => {
1908
+ const a = t.getUsername();
1909
+ if (a && a != "" && M(a), U.hasContextSupport && t.getContext) {
1910
+ const x = t.getContext();
1911
+ if (x)
1912
1912
  try {
1913
- const D = typeof f == "string" ? JSON.parse(f) : f;
1914
- H(D);
1915
- } catch (D) {
1916
- console.warn("Erro ao carregar contexto salvo:", D);
1913
+ const R = typeof x == "string" ? JSON.parse(x) : x;
1914
+ F(R);
1915
+ } catch (R) {
1916
+ console.warn("Erro ao carregar contexto salvo:", R);
1917
1917
  }
1918
1918
  }
1919
- const l = t.getToken();
1920
- l && (h(!0), x(""), A(!1), a(l)), y(!1);
1919
+ const h = t.getToken();
1920
+ h && (u(!0), E(""), b(!1), c(h)), g(!1);
1921
1921
  }, []);
1922
1922
  const te = () => {
1923
- A(!1), x("");
1924
- }, re = () => {
1925
- R(!1);
1926
- }, ne = (u) => {
1927
- i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""), H(null), x(""), A(!1), R(!1), N.clearAllValues();
1928
- }, g = async (u, l, f) => {
1923
+ b(!1), E("");
1924
+ }, ae = () => {
1925
+ _(!1);
1926
+ }, m = (a) => {
1927
+ i(!1), u(!1), c(null), t.clearToken(), a && t.clearUsernameAndPassword(), U.hasContextSupport && t.clearContext && t.clearContext(), M(""), F(null), E(""), b(!1), _(!1), X.clearAllValues();
1928
+ }, y = async (a, h, x) => {
1929
1929
  try {
1930
- i(!0), h(!1);
1931
- const D = await s.login(u, l);
1932
- t.saveToken(D), f && t.saveUsernameAndPassword(u, l), t.saveUsername(u), M(u), a(D), i(!1), h(!0);
1933
- } catch (D) {
1934
- i(!1), h(!1), Oe(D) && (M(u), R(!0)), x(ie(D)), A(!0);
1930
+ i(!0), u(!1);
1931
+ const R = await s.login(a, h);
1932
+ t.saveToken(R), x && t.saveUsernameAndPassword(a, h), t.saveUsername(a), M(a), c(R), i(!1), u(!0);
1933
+ } catch (R) {
1934
+ i(!1), u(!1), ze(R) && (M(a), _(!0)), E(oe(R)), b(!0);
1935
1935
  }
1936
- }, v = async (u, l = !1) => {
1937
- if (!T.hasContextualLogin || !s.loginWithContext)
1936
+ }, J = async (a, h = !1) => {
1937
+ if (!U.hasContextualLogin || !s.loginWithContext)
1938
1938
  throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
1939
1939
  try {
1940
- i(!0), h(!1);
1941
- const { context: f, user: D, ...j } = await s.loginWithContext(u);
1942
- if (j.mfa_required) {
1943
- L(j.challenge_token ?? null), b(!0), M(u.email), i(!1);
1940
+ i(!0), u(!1);
1941
+ const { context: x, user: R, ...re } = await s.loginWithContext(a);
1942
+ if (re.mfa_required) {
1943
+ L(re.challenge_token ?? null), w(!0), M(a.email), i(!1);
1944
1944
  return;
1945
1945
  }
1946
- const Ae = {
1946
+ const Ee = {
1947
1947
  scope: "",
1948
- ext_expires_in: j.expires_in,
1949
- ...j
1948
+ ext_expires_in: re.expires_in,
1949
+ ...re
1950
1950
  };
1951
- t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(u.email), a(Ae), i(!1), h(!0);
1952
- } catch (f) {
1953
- throw i(!1), h(!1), Oe(f) && (M(u.email), R(!0)), x(ie(f)), A(!0), f;
1951
+ t.saveToken(Ee), h ? t.saveUsernameAndPassword(a.email, a.password) : t.clearUsernameAndPassword(), t.saveUsername(a.email), U.hasContextSupport && t.saveContext && x && (t.saveContext(JSON.stringify(x)), F(x)), M(a.email), c(Ee), i(!1), u(!0);
1952
+ } catch (x) {
1953
+ throw i(!1), u(!1), ze(x) && (M(a.email), _(!0)), E(oe(x)), b(!0), x;
1954
1954
  }
1955
- }, K = async (u) => {
1955
+ }, V = async (a) => {
1956
1956
  if (!s.verifyMfa)
1957
1957
  throw new Error("verifyMfa não suportado por esta implementação do ArchbaseAuthenticator");
1958
- if (!V)
1958
+ if (!H)
1959
1959
  throw new Error("Nenhum desafio de MFA pendente");
1960
1960
  try {
1961
- i(!0), x(""), A(!1);
1962
- const l = await s.verifyMfa(V, u);
1963
- t.saveToken(l), t.saveUsername(P), a(l), b(!1), L(null), i(!1), h(!0);
1964
- } catch (l) {
1965
- throw i(!1), x(ie(l)), A(!0), l;
1961
+ i(!0), E(""), b(!1);
1962
+ const h = await s.verifyMfa(H, a);
1963
+ t.saveToken(h), t.saveUsername(P), c(h), w(!1), L(null), i(!1), u(!0);
1964
+ } catch (h) {
1965
+ throw i(!1), E(oe(h)), b(!0), h;
1966
1966
  }
1967
- }, W = () => {
1968
- b(!1), L(null), x(""), A(!1);
1969
- }, we = async (u, l = !1) => {
1970
- if (!T.hasFlexibleLogin || !s.loginFlexible)
1967
+ }, be = () => {
1968
+ w(!1), L(null), E(""), b(!1);
1969
+ }, he = async (a, h = !1) => {
1970
+ if (!U.hasFlexibleLogin || !s.loginFlexible)
1971
1971
  throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
1972
1972
  try {
1973
- i(!0), h(!1);
1974
- const { context: f, user: D, ...j } = await s.loginFlexible(u), Ae = {
1973
+ i(!0), u(!1);
1974
+ const { context: x, user: R, ...re } = await s.loginFlexible(a), Ee = {
1975
1975
  scope: "",
1976
- ext_expires_in: j.expires_in,
1977
- ...j
1976
+ ext_expires_in: re.expires_in,
1977
+ ...re
1978
1978
  };
1979
- t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
1980
- } catch (f) {
1981
- throw i(!1), h(!1), Oe(f) && (M(u.identifier), R(!0)), x(ie(f)), A(!0), f;
1979
+ t.saveToken(Ee), h && t.saveUsernameAndPassword(a.identifier, a.password), t.saveUsername(R.email || a.identifier), U.hasContextSupport && t.saveContext && x && (t.saveContext(JSON.stringify(x)), F(x)), M(R.email || a.identifier), c(Ee), i(!1), u(!0);
1980
+ } catch (x) {
1981
+ throw i(!1), u(!1), ze(x) && (M(a.identifier), _(!0)), E(oe(x)), b(!0), x;
1982
1982
  }
1983
- }, he = async (u) => {
1984
- if (!T.hasSocialLogin || !s.loginSocial)
1983
+ }, $ = async (a) => {
1984
+ if (!U.hasSocialLogin || !s.loginSocial)
1985
1985
  throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
1986
1986
  try {
1987
- i(!0), h(!1);
1988
- const { context: l, user: f, ...D } = await s.loginSocial(u), j = {
1987
+ i(!0), u(!1);
1988
+ const { context: h, user: x, ...R } = await s.loginSocial(a), re = {
1989
1989
  scope: "",
1990
- ext_expires_in: D.expires_in,
1991
- ...D
1990
+ ext_expires_in: R.expires_in,
1991
+ ...R
1992
1992
  };
1993
- t.saveToken(j), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), H(l)), M(f.email), a(j), i(!1), h(!0);
1994
- } catch (l) {
1995
- throw i(!1), h(!1), x(ie(l)), A(!0), l;
1993
+ t.saveToken(re), t.saveUsername(x.email), U.hasContextSupport && t.saveContext && h && (t.saveContext(JSON.stringify(h)), F(h)), M(x.email), c(re), i(!1), u(!0);
1994
+ } catch (h) {
1995
+ throw i(!1), u(!1), E(oe(h)), b(!0), h;
1996
1996
  }
1997
- }, $ = async (u) => {
1998
- if (!T.hasRegistration || !s.register)
1997
+ }, ce = async (a) => {
1998
+ if (!U.hasRegistration || !s.register)
1999
1999
  throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
2000
2000
  try {
2001
2001
  i(!0);
2002
- const l = await s.register(u);
2003
- return i(!1), l;
2004
- } catch (l) {
2005
- throw i(!1), x(ie(l)), A(!0), l;
2002
+ const h = await s.register(a);
2003
+ return i(!1), h;
2004
+ } catch (h) {
2005
+ throw i(!1), E(oe(h)), b(!0), h;
2006
2006
  }
2007
- }, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, oe = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
2008
- X(() => {
2009
- const u = setInterval(() => {
2010
- n && n.access_token && t.isTokenExpired(n, e) && be();
2007
+ }, ne = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, Ae = async (a) => s.validateContext ? await s.validateContext(a) : { context: a, supported: a === "DEFAULT" };
2008
+ Y(() => {
2009
+ const a = setInterval(() => {
2010
+ n && n.access_token && t.isTokenExpired(n, e) && pe();
2011
2011
  }, r);
2012
2012
  return () => {
2013
- clearInterval(u);
2013
+ clearInterval(a);
2014
2014
  };
2015
2015
  }, [n]);
2016
- const be = async () => {
2017
- if (n)
2016
+ const pe = async () => {
2017
+ if (n && !N.current) {
2018
+ N.current = !0;
2018
2019
  try {
2019
- const u = await s.refreshToken(n?.refresh_token);
2020
- t.saveToken(u), a(u);
2021
- } catch (u) {
2022
- console.error("Erro ao renovar o token:", u), ne();
2020
+ const a = await s.refreshToken(n?.refresh_token);
2021
+ t.saveToken(a), c(a);
2022
+ } catch (a) {
2023
+ console.error("Erro ao renovar o token:", a), m();
2024
+ } finally {
2025
+ N.current = !1;
2023
2026
  }
2027
+ }
2024
2028
  };
2025
2029
  return {
2026
2030
  // Métodos básicos (compatibilidade)
2027
- login: g,
2028
- logout: ne,
2031
+ login: y,
2032
+ logout: m,
2029
2033
  username: P,
2030
2034
  isAuthenticated: k,
2031
- isAuthenticating: c,
2035
+ isAuthenticating: l,
2032
2036
  isInitializing: d,
2033
- isError: U,
2034
- error: w,
2037
+ isError: T,
2038
+ error: v,
2035
2039
  clearError: te,
2036
2040
  accessToken: n ? n.access_token : null,
2037
2041
  // Métodos opcionais para autenticação avançada
2038
- loginWithContext: T.hasContextualLogin ? v : void 0,
2039
- loginFlexible: T.hasFlexibleLogin ? we : void 0,
2040
- loginSocial: T.hasSocialLogin ? he : void 0,
2041
- register: T.hasRegistration ? $ : void 0,
2042
- getSupportedContexts: ce,
2043
- validateContext: oe,
2042
+ loginWithContext: U.hasContextualLogin ? J : void 0,
2043
+ loginFlexible: U.hasFlexibleLogin ? he : void 0,
2044
+ loginSocial: U.hasSocialLogin ? $ : void 0,
2045
+ register: U.hasRegistration ? ce : void 0,
2046
+ getSupportedContexts: ne,
2047
+ validateContext: Ae,
2044
2048
  // MFA / segundo fator (2 passos)
2045
- mfaRequired: _,
2046
- verifyMfa: typeof s.verifyMfa == "function" ? K : void 0,
2047
- cancelMfa: W,
2049
+ mfaRequired: D,
2050
+ verifyMfa: typeof s.verifyMfa == "function" ? V : void 0,
2051
+ cancelMfa: be,
2048
2052
  // Troca de senha obrigatória (CREDENTIALS_EXPIRED)
2049
- passwordChangeRequired: m,
2050
- clearPasswordChangeRequired: re,
2053
+ passwordChangeRequired: f,
2054
+ clearPasswordChangeRequired: ae,
2051
2055
  // Informações de contexto
2052
2056
  context: B,
2053
2057
  // Detecção de capacidades
2054
- capabilities: T
2058
+ capabilities: U
2055
2059
  };
2056
- }, es = () => {
2057
- const r = De(
2058
- (s) => s.get(Y.TokenManager)
2060
+ }, ts = () => {
2061
+ const r = _e(
2062
+ (s) => s.get(q.TokenManager)
2059
2063
  ), [e, t] = p(null);
2060
- return X(() => {
2064
+ return Y(() => {
2061
2065
  const s = r.getToken();
2062
2066
  s && t(s.access_token);
2063
2067
  }, []), {
2064
2068
  token: e
2065
2069
  };
2066
- }, ts = () => {
2067
- const r = De(
2068
- (d) => d.get(Y.Authenticator)
2070
+ }, rs = () => {
2071
+ const r = _e(
2072
+ (d) => d.get(q.Authenticator)
2069
2073
  ), [e, t] = p(!1), [s, n] = p("");
2070
2074
  return {
2071
2075
  sendResetPasswordEmail: async (d) => {
2072
2076
  try {
2073
2077
  return await r.sendResetPasswordEmail(d);
2074
- } catch (y) {
2075
- throw n(ie(y)), t(!0), y;
2078
+ } catch (g) {
2079
+ throw n(oe(g)), t(!0), g;
2076
2080
  }
2077
2081
  },
2078
- resetPassword: async (d, y, k) => {
2082
+ resetPassword: async (d, g, k) => {
2079
2083
  try {
2080
- return await r.resetPassword(d, y, k);
2081
- } catch (h) {
2082
- throw n(ie(h)), t(!0), h;
2084
+ return await r.resetPassword(d, g, k);
2085
+ } catch (u) {
2086
+ throw n(oe(u)), t(!0), u;
2083
2087
  }
2084
2088
  },
2085
2089
  isError: e,
@@ -2088,77 +2092,77 @@ const Zr = ({
2088
2092
  t(!1), n("");
2089
2093
  }
2090
2094
  };
2091
- }, Cr = () => /* @__PURE__ */ o(tr, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
2095
+ }, Pr = () => /* @__PURE__ */ o(rr, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ C(xe, { gap: "md", children: [
2092
2096
  /* @__PURE__ */ C(ue, { gap: "sm", children: [
2093
- /* @__PURE__ */ o(dt, { size: "sm" }),
2094
- /* @__PURE__ */ o(F, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2097
+ /* @__PURE__ */ o(ut, { size: "sm" }),
2098
+ /* @__PURE__ */ o(j, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2095
2099
  ] }),
2096
- /* @__PURE__ */ o(Ce, { height: 40, radius: "sm" }),
2097
- /* @__PURE__ */ o(Ce, { height: 200, radius: "sm" }),
2100
+ /* @__PURE__ */ o(Pe, { height: 40, radius: "sm" }),
2101
+ /* @__PURE__ */ o(Pe, { height: 200, radius: "sm" }),
2098
2102
  /* @__PURE__ */ C(ue, { gap: "md", children: [
2099
- /* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" }),
2100
- /* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" })
2103
+ /* @__PURE__ */ o(Pe, { height: 36, width: 100, radius: "sm" }),
2104
+ /* @__PURE__ */ o(Pe, { height: 36, width: 100, radius: "sm" })
2101
2105
  ] })
2102
- ] }) }), Ye = He(null), rs = ({
2106
+ ] }) }), Qe = Ve(null), ss = ({
2103
2107
  children: r,
2104
2108
  user: e,
2105
2109
  onError: t
2106
2110
  }) => {
2107
- const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]), k = Ie((w) => d ? !0 : w.some((x) => i.includes(x)), [i, d]), h = Ie((w) => d ? !0 : w.every((x) => i.includes(x)), [i, d]), U = Ie((w) => {
2108
- c(w), w && t && t(w);
2109
- }, [t]), A = {
2111
+ const [s, n] = p(!1), [c, l] = p(null), [i] = p([]), d = e?.isAdministrator || !1, g = Ce((v) => d ? !0 : i.includes(v), [i, d]), k = Ce((v) => d ? !0 : v.some((E) => i.includes(E)), [i, d]), u = Ce((v) => d ? !0 : v.every((E) => i.includes(E)), [i, d]), T = Ce((v) => {
2112
+ l(v), v && t && t(v);
2113
+ }, [t]), b = {
2110
2114
  user: e,
2111
2115
  isLoading: s,
2112
- hasGlobalPermission: y,
2116
+ hasGlobalPermission: g,
2113
2117
  hasAnyGlobalPermission: k,
2114
- hasAllGlobalPermissions: h,
2118
+ hasAllGlobalPermissions: u,
2115
2119
  isAdmin: d,
2116
- error: a,
2117
- setError: U
2120
+ error: c,
2121
+ setError: T
2118
2122
  };
2119
- return /* @__PURE__ */ o(Ye.Provider, { value: A, children: r });
2120
- }, Nt = He(null), Pr = ({
2123
+ return /* @__PURE__ */ o(Qe.Provider, { value: b, children: r });
2124
+ }, $t = Ve(null), Tr = ({
2121
2125
  children: r,
2122
2126
  resourceName: e,
2123
2127
  resourceDescription: t,
2124
2128
  requiredPermissions: s = [],
2125
2129
  fallbackComponent: n,
2126
- loadingComponent: a,
2127
- onSecurityReady: c,
2130
+ loadingComponent: c,
2131
+ onSecurityReady: l,
2128
2132
  onError: i
2129
2133
  }) => {
2130
- const d = Ve(Ye);
2134
+ const d = Ge(Qe);
2131
2135
  if (!d)
2132
2136
  throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
2133
- const { user: y, isAdmin: k } = d, [h, U] = p(null), [A, w] = p(!0), [x, P] = p(null);
2134
- if (it.useEffect(() => {
2135
- if (!y) {
2136
- w(!1);
2137
+ const { user: g, isAdmin: k } = d, [u, T] = p(null), [b, v] = p(!0), [E, P] = p(null);
2138
+ if (ct.useEffect(() => {
2139
+ if (!g) {
2140
+ v(!1);
2137
2141
  return;
2138
2142
  }
2139
- const m = new vt(e, t, k);
2143
+ const f = new wt(e, t, k);
2140
2144
  (async () => {
2141
- w(!0);
2145
+ v(!0);
2142
2146
  try {
2143
- await m.apply(() => {
2144
- U(m), w(!1), c && c(m);
2147
+ await f.apply(() => {
2148
+ T(f), v(!1), l && l(f);
2145
2149
  });
2146
2150
  } catch {
2147
- const L = m.getError() || "Erro ao carregar permissões";
2148
- P(L), w(!1), i && i(L);
2151
+ const L = f.getError() || "Erro ao carregar permissões";
2152
+ P(L), v(!1), i && i(L);
2149
2153
  }
2150
2154
  })();
2151
- }, [e, t, y, k, c, i]), A)
2152
- return a ? /* @__PURE__ */ o(ae, { children: a }) : /* @__PURE__ */ o(Cr, {});
2153
- if (x)
2155
+ }, [e, t, g, k, l, i]), b)
2156
+ return c ? /* @__PURE__ */ o(ie, { children: c }) : /* @__PURE__ */ o(Pr, {});
2157
+ if (E)
2154
2158
  return /* @__PURE__ */ o("div", { className: "archbase-security-error", children: /* @__PURE__ */ C("div", { children: [
2155
2159
  "Erro ao carregar permissões: ",
2156
- x
2160
+ E
2157
2161
  ] }) });
2158
- if (!y)
2162
+ if (!g)
2159
2163
  return n || /* @__PURE__ */ o("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ o("div", { children: "É necessário fazer login para acessar esta área" }) });
2160
- if (s.length > 0 && h && !s.every(
2161
- (R) => h.hasPermission(R)
2164
+ if (s.length > 0 && u && !s.every(
2165
+ (_) => u.hasPermission(_)
2162
2166
  ))
2163
2167
  return n || /* @__PURE__ */ C("div", { className: "archbase-security-access-denied", children: [
2164
2168
  /* @__PURE__ */ o("div", { children: "Você não possui permissão para acessar esta área" }),
@@ -2167,37 +2171,37 @@ const Zr = ({
2167
2171
  s.join(", ")
2168
2172
  ] })
2169
2173
  ] });
2170
- const b = {
2171
- securityManager: h,
2172
- hasPermission: (m) => h?.hasPermission(m) || !1,
2173
- hasAnyPermission: (m) => m.some((R) => h?.hasPermission(R) || !1),
2174
- hasAllPermissions: (m) => m.every((R) => h?.hasPermission(R) || !1),
2175
- registerAction: (m, R) => {
2176
- h?.registerAction(m, R);
2174
+ const w = {
2175
+ securityManager: u,
2176
+ hasPermission: (f) => u?.hasPermission(f) || !1,
2177
+ hasAnyPermission: (f) => f.some((_) => u?.hasPermission(_) || !1),
2178
+ hasAllPermissions: (f) => f.every((_) => u?.hasPermission(_) || !1),
2179
+ registerAction: (f, _) => {
2180
+ u?.registerAction(f, _);
2177
2181
  },
2178
- isLoading: A,
2179
- error: x
2182
+ isLoading: b,
2183
+ error: E
2180
2184
  };
2181
- return /* @__PURE__ */ o(Nt.Provider, { value: b, children: r });
2182
- }, Tr = () => {
2183
- const r = Ve(Ye);
2185
+ return /* @__PURE__ */ o($t.Provider, { value: w, children: r });
2186
+ }, Ur = () => {
2187
+ const r = Ge(Qe);
2184
2188
  if (!r)
2185
2189
  throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
2186
2190
  return r;
2187
- }, Xe = () => {
2188
- const r = Ve(Nt);
2191
+ }, Ze = () => {
2192
+ const r = Ge($t);
2189
2193
  if (!r)
2190
2194
  throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
2191
2195
  return r;
2192
- }, ss = (r, e) => {
2193
- const t = Xe(), { hasPermission: s, hasAnyPermission: n, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading: d, error: y } = t;
2194
- return it.useEffect(() => {
2195
- r && e && (c("create", `Criar ${e}`), c("edit", `Editar ${e}`), c("delete", `Deletar ${e}`), c("view", `Visualizar ${e}`), c("list", `Listar ${e}`));
2196
- }, [r, e, c]), {
2196
+ }, ns = (r, e) => {
2197
+ const t = Ze(), { hasPermission: s, hasAnyPermission: n, hasAllPermissions: c, registerAction: l, securityManager: i, isLoading: d, error: g } = t;
2198
+ return ct.useEffect(() => {
2199
+ r && e && (l("create", `Criar ${e}`), l("edit", `Editar ${e}`), l("delete", `Deletar ${e}`), l("view", `Visualizar ${e}`), l("list", `Listar ${e}`));
2200
+ }, [r, e, l]), {
2197
2201
  hasPermission: s,
2198
2202
  hasAnyPermission: n,
2199
- hasAllPermissions: a,
2200
- registerAction: c,
2203
+ hasAllPermissions: c,
2204
+ registerAction: l,
2201
2205
  securityManager: i,
2202
2206
  canCreate: s("create"),
2203
2207
  canEdit: s("edit"),
@@ -2205,52 +2209,52 @@ const Zr = ({
2205
2209
  canView: s("view"),
2206
2210
  canList: s("list"),
2207
2211
  isLoading: d,
2208
- error: y
2212
+ error: g
2209
2213
  };
2210
- }, ns = () => {
2211
- const r = Xe();
2214
+ }, os = () => {
2215
+ const r = Ze();
2212
2216
  return {
2213
2217
  check: r.hasPermission,
2214
2218
  checkAny: r.hasAnyPermission,
2215
2219
  checkAll: r.hasAllPermissions,
2216
- isAdmin: Tr().isAdmin
2220
+ isAdmin: Ur().isAdmin
2217
2221
  };
2218
- }, $t = ({
2222
+ }, Bt = ({
2219
2223
  children: r,
2220
2224
  actionName: e,
2221
2225
  requiredPermissions: t = [],
2222
2226
  requireAll: s = !0,
2223
2227
  actionDescription: n,
2224
- fallback: a = null,
2225
- autoRegister: c = !0
2228
+ fallback: c = null,
2229
+ autoRegister: l = !0
2226
2230
  }) => {
2227
- const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction: k } = Xe();
2228
- X(() => {
2229
- c && e && n && k(e, n);
2230
- }, [e, n, c, k]);
2231
- let h = !1;
2232
- return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ o(ae, { children: r }) : /* @__PURE__ */ o(ae, { children: a });
2233
- }, os = ({
2231
+ const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: g, registerAction: k } = Ze();
2232
+ Y(() => {
2233
+ l && e && n && k(e, n);
2234
+ }, [e, n, l, k]);
2235
+ let u = !1;
2236
+ return e ? u = i(e) : t.length > 0 ? u = s ? g(t) : d(t) : u = !0, u ? /* @__PURE__ */ o(ie, { children: r }) : /* @__PURE__ */ o(ie, { children: c });
2237
+ }, is = ({
2234
2238
  actionName: r,
2235
2239
  actionDescription: e,
2236
2240
  children: t,
2237
2241
  onClick: s,
2238
2242
  disabled: n = !1,
2239
- className: a = "",
2240
- style: c = {},
2243
+ className: c = "",
2244
+ style: l = {},
2241
2245
  variant: i = "primary",
2242
2246
  size: d = "medium",
2243
- type: y = "button"
2247
+ type: g = "button"
2244
2248
  }) => {
2245
2249
  const k = () => {
2246
- const U = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, w = `archbase-secure-btn--${d}`;
2247
- return `${U} ${A} ${w} ${a}`.trim();
2248
- }, h = () => {
2249
- const U = {
2250
+ const T = "archbase-secure-btn", b = `archbase-secure-btn--${i}`, v = `archbase-secure-btn--${d}`;
2251
+ return `${T} ${b} ${v} ${c}`.trim();
2252
+ }, u = () => {
2253
+ const T = {
2250
2254
  small: { padding: "4px 8px", fontSize: "12px" },
2251
2255
  medium: { padding: "8px 16px", fontSize: "14px" },
2252
2256
  large: { padding: "12px 24px", fontSize: "16px" }
2253
- }, A = {
2257
+ }, b = {
2254
2258
  primary: { backgroundColor: "#007bff", color: "white" },
2255
2259
  secondary: { backgroundColor: "#6c757d", color: "white" },
2256
2260
  danger: { backgroundColor: "#dc3545", color: "white" },
@@ -2263,13 +2267,13 @@ const Zr = ({
2263
2267
  cursor: n ? "not-allowed" : "pointer",
2264
2268
  fontWeight: "500",
2265
2269
  opacity: n ? 0.6 : 1,
2266
- ...U[d],
2267
- ...A[i],
2268
- ...c
2270
+ ...T[d],
2271
+ ...b[i],
2272
+ ...l
2269
2273
  };
2270
2274
  };
2271
2275
  return /* @__PURE__ */ o(
2272
- $t,
2276
+ Bt,
2273
2277
  {
2274
2278
  actionName: r,
2275
2279
  actionDescription: e,
@@ -2277,30 +2281,30 @@ const Zr = ({
2277
2281
  children: /* @__PURE__ */ o(
2278
2282
  "button",
2279
2283
  {
2280
- type: y,
2284
+ type: g,
2281
2285
  onClick: s,
2282
2286
  disabled: n,
2283
2287
  className: k(),
2284
- style: h(),
2288
+ style: u(),
2285
2289
  children: t
2286
2290
  }
2287
2291
  )
2288
2292
  }
2289
2293
  );
2290
- }, is = ({
2294
+ }, as = ({
2291
2295
  children: r,
2292
2296
  actionName: e,
2293
2297
  actionDescription: t,
2294
2298
  showLabel: s = !0,
2295
2299
  label: n,
2296
- fallbackText: a = "Campo não disponível",
2297
- fallbackComponent: c
2300
+ fallbackText: c = "Campo não disponível",
2301
+ fallbackComponent: l
2298
2302
  }) => e ? /* @__PURE__ */ o(
2299
- $t,
2303
+ Bt,
2300
2304
  {
2301
2305
  actionName: e,
2302
2306
  actionDescription: t,
2303
- fallback: c || /* @__PURE__ */ C("div", { className: "archbase-secure-field-fallback", style: {
2307
+ fallback: l || /* @__PURE__ */ C("div", { className: "archbase-secure-field-fallback", style: {
2304
2308
  padding: "8px",
2305
2309
  color: "#666",
2306
2310
  fontStyle: "italic",
@@ -2312,20 +2316,20 @@ const Zr = ({
2312
2316
  n,
2313
2317
  ": "
2314
2318
  ] }),
2315
- a
2319
+ c
2316
2320
  ] }),
2317
2321
  children: r
2318
2322
  }
2319
- ) : /* @__PURE__ */ o(ae, { children: r });
2320
- function as(r, e) {
2323
+ ) : /* @__PURE__ */ o(ie, { children: r });
2324
+ function cs(r, e) {
2321
2325
  return function(s) {
2322
- const { resourceName: n, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
2326
+ const { resourceName: n, resourceDescription: c, requiredPermissions: l, fallbackComponent: i } = e;
2323
2327
  return /* @__PURE__ */ o(
2324
- Pr,
2328
+ Tr,
2325
2329
  {
2326
2330
  resourceName: n,
2327
- resourceDescription: a,
2328
- requiredPermissions: c,
2331
+ resourceDescription: c,
2332
+ requiredPermissions: l,
2329
2333
  fallbackComponent: i,
2330
2334
  children: /* @__PURE__ */ o(r, { ...s })
2331
2335
  }
@@ -2333,77 +2337,77 @@ function as(r, e) {
2333
2337
  };
2334
2338
  }
2335
2339
  export {
2336
- Mt as ARCHBASE_SECURITY_MANAGER_STORE,
2337
- xr as AccessIntervalDto,
2338
- At as AccessScheduleDto,
2339
- qe as AccessTokenDto,
2340
- Sr as ActionDto,
2341
- Ke as ApiTokenDto,
2342
- Dt as ArchbaseAccessTokenService,
2343
- Ut as ArchbaseApiTokenService,
2344
- br as ArchbaseAuthContext,
2345
- Gr as ArchbaseAuthProvider,
2346
- Pt as ArchbaseGroupService,
2347
- qr as ArchbaseLogin,
2348
- Yr as ArchbaseMfaSetup,
2349
- Tt as ArchbaseProfileService,
2350
- $t as ArchbaseProtectedComponent,
2351
- Xr as ArchbaseResetPassword,
2352
- _t as ArchbaseResourceService,
2353
- os as ArchbaseSecureActionButton,
2354
- is as ArchbaseSecureFormField,
2355
- Rt as ArchbaseSecurityDiagnosticsService,
2356
- vt as ArchbaseSecurityManager,
2357
- rs as ArchbaseSecurityProvider,
2358
- J as ArchbaseTenantManager,
2359
- ht as ArchbaseUser,
2360
- Ct as ArchbaseUserService,
2361
- pt as ArchbaseUsernameAndPassword,
2362
- pt as ArchbaseUsernameAndPasswordImpl,
2363
- Pr as ArchbaseViewSecurityProvider,
2364
- Le as CONTEXT_STORAGE_KEY,
2365
- or as DefaultArchbaseTokenManager,
2366
- Cr as DefaultSecurityLoading,
2340
+ Nt as ARCHBASE_SECURITY_MANAGER_STORE,
2341
+ Sr as AccessIntervalDto,
2342
+ Et as AccessScheduleDto,
2343
+ Xe as AccessTokenDto,
2344
+ kr as ActionDto,
2345
+ Ye as ApiTokenDto,
2346
+ _t as ArchbaseAccessTokenService,
2347
+ Dt as ArchbaseApiTokenService,
2348
+ Ar as ArchbaseAuthContext,
2349
+ Jr as ArchbaseAuthProvider,
2350
+ Tt as ArchbaseGroupService,
2351
+ Yr as ArchbaseLogin,
2352
+ Xr as ArchbaseMfaSetup,
2353
+ Ut as ArchbaseProfileService,
2354
+ Bt as ArchbaseProtectedComponent,
2355
+ Qr as ArchbaseResetPassword,
2356
+ Rt as ArchbaseResourceService,
2357
+ is as ArchbaseSecureActionButton,
2358
+ as as ArchbaseSecureFormField,
2359
+ Mt as ArchbaseSecurityDiagnosticsService,
2360
+ wt as ArchbaseSecurityManager,
2361
+ ss as ArchbaseSecurityProvider,
2362
+ G as ArchbaseTenantManager,
2363
+ pt as ArchbaseUser,
2364
+ Pt as ArchbaseUserService,
2365
+ ft as ArchbaseUsernameAndPassword,
2366
+ ft as ArchbaseUsernameAndPasswordImpl,
2367
+ Tr as ArchbaseViewSecurityProvider,
2368
+ Oe as CONTEXT_STORAGE_KEY,
2369
+ ir as DefaultArchbaseTokenManager,
2370
+ Pr as DefaultSecurityLoading,
2367
2371
  le as ENCRYPTION_KEY,
2368
- mt as FetchError,
2369
- ke as GroupDto,
2370
- Kr as PermissionDto,
2371
- Se as ProfileDto,
2372
- kt as ResourceDto,
2373
- ye as SecurityDto,
2374
- me as SecurityType,
2375
- Ne as TOKEN_COOKIE_NAME,
2376
- Er as TipoRecurso,
2377
- Be as USER_NAME,
2378
- $e as USER_NAME_AND_PASSWORD,
2379
- Me as UserDto,
2380
- Ge as UserGroupDto,
2381
- gr as createInternalConfig,
2382
- Te as decodeJWT,
2383
- pe as epochAtSecondsFromNow,
2384
- ot as epochTimeIsPast,
2385
- hr as fetchTokens,
2386
- pr as fetchWithRefreshToken,
2387
- ar as generateCodeChallenge,
2388
- ir as generateRandomString,
2389
- ft as getRandomInteger,
2390
- wr as getRefreshExpiresIn,
2391
- Oe as isCredentialsExpiredError,
2392
- lr as postWithXForm,
2393
- dr as redirectToLogin,
2394
- fr as redirectToLogout,
2395
- Zr as useArchbaseAuthenticationManager,
2396
- es as useArchbaseGetCurrentToken,
2397
- Ir as useArchbaseGetLoggedUser,
2398
- ns as useArchbasePermissionCheck,
2399
- ts as useArchbaseResetPassword,
2400
- ss as useArchbaseSecureForm,
2401
- Tr as useArchbaseSecurity,
2402
- Qr as useArchbaseSecurityManager,
2403
- Jr as useArchbaseTenantManager,
2404
- Xe as useArchbaseViewSecurity,
2405
- Wr as useBrowserStorage,
2406
- yr as validateConfig,
2407
- mr as validateState,
2408
- as as withArchbaseSecurity
2372
+ gt as FetchError,
2373
+ Ie as GroupDto,
2374
+ qr as PermissionDto,
2375
+ ke as ProfileDto,
2376
+ It as ResourceDto,
2377
+ ve as SecurityDto,
2378
+ ge as SecurityType,
2379
+ $e as TOKEN_COOKIE_NAME,
2380
+ xr as TipoRecurso,
2381
+ Le as USER_NAME,
2382
+ Be as USER_NAME_AND_PASSWORD,
2383
+ Ne as UserDto,
2384
+ Ke as UserGroupDto,
2385
+ yr as createInternalConfig,
2386
+ Ue as decodeJWT,
2387
+ fe as epochAtSecondsFromNow,
2388
+ at as epochTimeIsPast,
2389
+ pr as fetchTokens,
2390
+ fr as fetchWithRefreshToken,
2391
+ cr as generateCodeChallenge,
2392
+ ar as generateRandomString,
2393
+ mt as getRandomInteger,
2394
+ br as getRefreshExpiresIn,
2395
+ ze as isCredentialsExpiredError,
2396
+ dr as postWithXForm,
2397
+ ur as redirectToLogin,
2398
+ mr as redirectToLogout,
2399
+ es as useArchbaseAuthenticationManager,
2400
+ ts as useArchbaseGetCurrentToken,
2401
+ Cr as useArchbaseGetLoggedUser,
2402
+ os as useArchbasePermissionCheck,
2403
+ rs as useArchbaseResetPassword,
2404
+ ns as useArchbaseSecureForm,
2405
+ Ur as useArchbaseSecurity,
2406
+ Zr as useArchbaseSecurityManager,
2407
+ Kr as useArchbaseTenantManager,
2408
+ Ze as useArchbaseViewSecurity,
2409
+ Gr as useBrowserStorage,
2410
+ vr as validateConfig,
2411
+ gr as validateState,
2412
+ cs as withArchbaseSecurity
2409
2413
  };