@archbase/security 4.0.39 → 4.0.41

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