@archbase/security 4.3.0 → 4.3.2

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