@sito/dashboard-app 0.0.45 → 0.0.47

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.
@@ -1,107 +1,107 @@
1
1
  var Ss = Object.defineProperty;
2
- var _s = (e, t, s) => t in e ? Ss(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var ee = (e, t, s) => _s(e, typeof t != "symbol" ? t + "" : t, s);
2
+ var Ts = (e, t, s) => t in e ? Ss(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var W = (e, t, s) => Ts(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  import "./main.css";
5
- import { State as Cs, inputStateClassName as Es, labelStateClassName as ks, helperTextStateClassName as Ns, useTranslation as V, Button as ve, Loading as xe, TextInput as As, FileInput as xs, Actions as Ts, ActionsDropdown as Fs, useTableOptions as $s, Badge as Ls, IconButton as Ds, Action as Vs } from "@sito/dashboard";
5
+ import { State as Es, inputStateClassName as _s, labelStateClassName as Cs, helperTextStateClassName as Ns, useTranslation as R, Button as ge, Loading as Le, TextInput as xs, FileInput as As, IconButton as Fs, Actions as $s, ActionsDropdown as Ls, useTableOptions as Ds, Badge as Vs, Action as Rs } from "@sito/dashboard";
6
6
  export * from "@sito/dashboard";
7
- import { Action as jn, Actions as Kn, ActionsDropdown as Qn, Button as Wn } from "@sito/dashboard";
8
- import { jsxs as T, jsx as b, Fragment as Pe } from "react/jsx-runtime";
9
- import { FontAwesomeIcon as le } from "@fortawesome/react-fontawesome";
10
- import ae, { forwardRef as Mt, useState as Y, useCallback as $, useEffect as me, useReducer as Ut, useRef as Oe, createContext as Te, useContext as Fe, useMemo as ke, useLayoutEffect as Is } from "react";
11
- import { faEyeSlash as Ps, faEye as Os, faClose as qt, faTrash as Rs, faRotateLeft as Bt, faPencil as Ms, faCircleNotch as Ht, faCloudArrowDown as Us, faCloudUpload as qs, faArrowLeft as Bs, faAdd as _t, faFilter as Hs, faBars as js, faSearch as Ks, faArrowUp as Qs, faCircleCheck as Ws, faWarning as Gs } from "@fortawesome/free-solid-svg-icons";
12
- import { createPortal as jt } from "react-dom";
13
- import { QueryClient as zs, QueryClientProvider as Js, useMutation as Re, useQuery as Ys } from "@tanstack/react-query";
14
- import { faSadTear as Xs } from "@fortawesome/free-regular-svg-icons";
15
- const Ct = (e) => e == null ? !1 : `${e}`.length > 0, rn = Mt(function(e, t) {
7
+ import { Action as jn, Actions as Qn, ActionsDropdown as Gn, Button as zn } from "@sito/dashboard";
8
+ import { jsxs as $, jsx as g, Fragment as Oe } from "react/jsx-runtime";
9
+ import { FontAwesomeIcon as ue } from "@fortawesome/react-fontawesome";
10
+ import ae, { forwardRef as Bt, useState as X, useCallback as D, useEffect as me, useReducer as qt, useRef as Ue, createContext as De, useContext as Ve, useMemo as xe, useLayoutEffect as Is } from "react";
11
+ import { faEyeSlash as Ps, faEye as Ms, faClose as Ht, faTrash as Os, faRotateLeft as Wt, faPencil as Us, faCircleNotch as jt, faCloudArrowDown as Ks, faCloudUpload as Bs, faArrowUp as qs, faArrowLeft as Hs, faAdd as Nt, faFilter as Ws, faBars as js, faSearch as Qs, faCircleCheck as Gs, faWarning as zs } from "@fortawesome/free-solid-svg-icons";
12
+ import { createPortal as Qt } from "react-dom";
13
+ import { QueryClient as Js, QueryClientProvider as Ys, useMutation as Ke, useQuery as Xs } from "@tanstack/react-query";
14
+ import { faSadTear as Zs } from "@fortawesome/free-regular-svg-icons";
15
+ const xt = (e) => e == null ? !1 : `${e}`.length > 0, an = Bt(function(e, t) {
16
16
  const {
17
17
  value: s,
18
18
  defaultValue: r,
19
- onChange: n,
20
- state: i = Cs.default,
19
+ onChange: i,
20
+ state: n = Es.default,
21
21
  name: a = "",
22
- id: c = "",
22
+ id: o = "",
23
23
  label: l = "",
24
24
  disabled: m = !1,
25
- required: g = !1,
25
+ required: f = !1,
26
26
  containerClassName: h = "",
27
27
  inputClassName: d = "",
28
- labelClassName: y = "",
29
- helperText: v = "",
30
- helperTextClassName: C = "",
31
- ...k
32
- } = e, q = s !== void 0, [N, L] = Y(
33
- () => Ct(r)
34
- ), x = q ? Ct(s) : N, A = (I) => {
35
- q || L(I.currentTarget.value.length > 0), n == null || n(I);
28
+ labelClassName: p = "",
29
+ helperText: b = "",
30
+ helperTextClassName: S = "",
31
+ ...E
32
+ } = e, N = s !== void 0, [C, F] = X(
33
+ () => xt(r)
34
+ ), x = N ? xt(s) : C, A = (I) => {
35
+ N || F(I.currentTarget.value.length > 0), i == null || i(I);
36
36
  };
37
- return /* @__PURE__ */ T("div", { className: `form-paragraph-container group ${h}`, children: [
38
- /* @__PURE__ */ b(
37
+ return /* @__PURE__ */ $("div", { className: `form-paragraph-container group ${h}`, children: [
38
+ /* @__PURE__ */ g(
39
39
  "textarea",
40
40
  {
41
41
  ref: t,
42
42
  name: a,
43
- id: c,
44
- className: `text-input text-area form-paragraph-textarea peer ${Es(i)} ${x ? "has-value" : ""} ${k.placeholder ? "has-placeholder" : ""} ${d}`,
45
- required: g,
43
+ id: o,
44
+ className: `text-input text-area form-paragraph-textarea peer ${_s(n)} ${x ? "has-value" : ""} ${E.placeholder ? "has-placeholder" : ""} ${d}`,
45
+ required: f,
46
46
  defaultValue: r,
47
- ...q ? { value: s } : {},
47
+ ...N ? { value: s } : {},
48
48
  onChange: A,
49
49
  disabled: m,
50
- ...k
50
+ ...E
51
51
  }
52
52
  ),
53
- /* @__PURE__ */ T(
53
+ /* @__PURE__ */ $(
54
54
  "label",
55
55
  {
56
- htmlFor: c,
57
- className: `text-input-label ${ks(i)} ${y}`,
56
+ htmlFor: o,
57
+ className: `text-input-label ${Cs(n)} ${p}`,
58
58
  children: [
59
59
  l,
60
- g ? " *" : ""
60
+ f ? " *" : ""
61
61
  ]
62
62
  }
63
63
  ),
64
- !!v && /* @__PURE__ */ b(
64
+ !!b && /* @__PURE__ */ g(
65
65
  "p",
66
66
  {
67
- className: `text-input-helper-text ${Ns(i)} ${C}`,
68
- children: v
67
+ className: `text-input-helper-text ${Ns(n)} ${S}`,
68
+ children: b
69
69
  }
70
70
  )
71
71
  ] });
72
- }), nn = (e) => {
73
- const { t } = V(), {
72
+ }), on = (e) => {
73
+ const { t } = R(), {
74
74
  children: s,
75
75
  handleSubmit: r,
76
- onSubmit: n,
77
- isLoading: i = !1,
76
+ onSubmit: i,
77
+ isLoading: n = !1,
78
78
  buttonEnd: a = !0,
79
- reset: c
79
+ reset: o
80
80
  } = e;
81
- return /* @__PURE__ */ T("form", { className: "form-container", onSubmit: r(n), children: [
81
+ return /* @__PURE__ */ $("form", { className: "form-container", onSubmit: r(i), children: [
82
82
  s,
83
- /* @__PURE__ */ T("div", { className: `form-actions ${a ? "end" : ""}`, children: [
84
- /* @__PURE__ */ T(
85
- ve,
83
+ /* @__PURE__ */ $("div", { className: `form-actions ${a ? "end" : ""}`, children: [
84
+ /* @__PURE__ */ $(
85
+ ge,
86
86
  {
87
87
  type: "submit",
88
88
  color: "primary",
89
89
  variant: "submit",
90
- disabled: i,
90
+ disabled: n,
91
91
  name: t("_accessibility:buttons.submit"),
92
92
  "aria-label": t("_accessibility:ariaLabels.submit"),
93
93
  children: [
94
- i ? /* @__PURE__ */ b(xe, { color: "stroke-base", loaderClass: "!w-6 mt-1", strokeWidth: "6" }) : null,
94
+ n ? /* @__PURE__ */ g(Le, { color: "stroke-base", loaderClass: "!w-6 mt-1", strokeWidth: "6" }) : null,
95
95
  t("_accessibility:buttons.submit")
96
96
  ]
97
97
  }
98
98
  ),
99
- /* @__PURE__ */ b(
100
- ve,
99
+ /* @__PURE__ */ g(
100
+ ge,
101
101
  {
102
102
  type: "button",
103
103
  variant: "outlined",
104
- onClick: () => c == null ? void 0 : c(),
104
+ onClick: () => o == null ? void 0 : o(),
105
105
  name: t("_accessibility:buttons.cancel"),
106
106
  "aria-label": t("_accessibility:ariaLabels.cancel"),
107
107
  children: t("_accessibility:buttons.cancel")
@@ -109,10 +109,10 @@ const Ct = (e) => e == null ? !1 : `${e}`.length > 0, rn = Mt(function(e, t) {
109
109
  )
110
110
  ] })
111
111
  ] });
112
- }, an = Mt(function(e, t) {
113
- const { t: s } = V(), [r, n] = Y(!1);
114
- return /* @__PURE__ */ b(As, { ...e, type: r ? "text" : "password", ref: t, children: /* @__PURE__ */ b(
115
- _e,
112
+ }, cn = Bt(function(e, t) {
113
+ const { t: s } = R(), [r, i] = X(!1);
114
+ return /* @__PURE__ */ g(xs, { ...e, type: r ? "text" : "password", ref: t, children: /* @__PURE__ */ g(
115
+ Te,
116
116
  {
117
117
  type: "button",
118
118
  tabIndex: -1,
@@ -120,63 +120,63 @@ const Ct = (e) => e == null ? !1 : `${e}`.length > 0, rn = Mt(function(e, t) {
120
120
  r ? "_accessibility:ariaLabels.hidePassword" : "_accessibility:ariaLabels.showPassword"
121
121
  ),
122
122
  className: "password-icon",
123
- onClick: () => n(!r),
124
- icon: r ? Ps : Os
123
+ onClick: () => i(!r),
124
+ icon: r ? Ps : Ms
125
125
  }
126
126
  ) });
127
- }), at = (e) => {
128
- const { t } = V(), {
127
+ }), dt = (e) => {
128
+ const { t } = R(), {
129
129
  title: s,
130
130
  children: r,
131
- handleClose: n,
132
- open: i = !1,
131
+ handleClose: i,
132
+ open: n = !1,
133
133
  containerClassName: a = "",
134
- className: c = "",
134
+ className: o = "",
135
135
  animationClass: l = "appear"
136
- } = e, m = $(
136
+ } = e, m = D(
137
137
  (h) => {
138
- h.key === "Escape" && i && n();
138
+ h.key === "Escape" && n && i();
139
139
  },
140
- [i, n]
140
+ [n, i]
141
141
  );
142
142
  me(() => (window.addEventListener("keydown", m), () => {
143
143
  window.removeEventListener("keydown", m);
144
144
  }), [m]);
145
- const g = $(
145
+ const f = D(
146
146
  (h) => {
147
- h.target === h.currentTarget && n();
147
+ h.target === h.currentTarget && i();
148
148
  },
149
- [n]
149
+ [i]
150
150
  );
151
151
  return me(() => {
152
152
  const h = (d) => {
153
153
  d ? document.body.style.overflow = "hidden" : document.body.style.overflow = "auto";
154
154
  };
155
- return h(i), () => {
155
+ return h(n), () => {
156
156
  h(!1);
157
157
  };
158
- }, [i]), jt(
159
- /* @__PURE__ */ b(
158
+ }, [n]), Qt(
159
+ /* @__PURE__ */ g(
160
160
  "div",
161
161
  {
162
162
  "aria-label": t("_accessibility:ariaLabels.closeDialog"),
163
- "aria-hidden": !i,
164
- onClick: g,
165
- className: `dialog-backdrop animated ${i ? `opened ${l}` : "closed"} ${a}`,
166
- children: /* @__PURE__ */ T(
163
+ "aria-hidden": !n,
164
+ onClick: f,
165
+ className: `dialog-backdrop animated ${n ? `opened ${l}` : "closed"} ${a}`,
166
+ children: /* @__PURE__ */ $(
167
167
  "div",
168
168
  {
169
- className: `dialog elevated animated ${i ? `opened ${l}` : "closed"} ${c}`,
169
+ className: `dialog elevated animated ${n ? `opened ${l}` : "closed"} ${o}`,
170
170
  children: [
171
- /* @__PURE__ */ T("div", { className: "dialog-header", children: [
172
- /* @__PURE__ */ b("h3", { className: "dialog-title", children: s }),
173
- /* @__PURE__ */ b(
174
- _e,
171
+ /* @__PURE__ */ $("div", { className: "dialog-header", children: [
172
+ /* @__PURE__ */ g("h3", { className: "dialog-title", children: s }),
173
+ /* @__PURE__ */ g(
174
+ Te,
175
175
  {
176
- icon: qt,
177
- disabled: !i,
178
- "aria-disabled": !i,
179
- onClick: n,
176
+ icon: Ht,
177
+ disabled: !n,
178
+ "aria-disabled": !n,
179
+ onClick: i,
180
180
  className: "icon-button dialog-close-btn",
181
181
  name: t("_accessibility:buttons.closeDialog"),
182
182
  "aria-label": t("_accessibility:ariaLabels.closeDialog")
@@ -191,32 +191,32 @@ const Ct = (e) => e == null ? !1 : `${e}`.length > 0, rn = Mt(function(e, t) {
191
191
  ),
192
192
  document.body
193
193
  );
194
- }, ot = (e) => {
194
+ }, ft = (e) => {
195
195
  const {
196
196
  primaryText: t,
197
197
  cancelText: s,
198
198
  onPrimaryClick: r,
199
- onCancel: n,
200
- isLoading: i = !1,
199
+ onCancel: i,
200
+ isLoading: n = !1,
201
201
  disabled: a = !1,
202
- primaryType: c = "submit",
202
+ primaryType: o = "submit",
203
203
  containerClassName: l = "",
204
204
  primaryClassName: m = "",
205
- alignEnd: g = !1,
205
+ alignEnd: f = !1,
206
206
  primaryName: h,
207
207
  primaryAriaLabel: d,
208
- cancelName: y,
209
- cancelAriaLabel: v
208
+ cancelName: p,
209
+ cancelAriaLabel: b
210
210
  } = e;
211
- return /* @__PURE__ */ T(
211
+ return /* @__PURE__ */ $(
212
212
  "div",
213
213
  {
214
- className: `dialog-actions ${g ? "end" : ""} ${l}`,
214
+ className: `dialog-actions ${f ? "end" : ""} ${l}`,
215
215
  children: [
216
- /* @__PURE__ */ T(
217
- ve,
216
+ /* @__PURE__ */ $(
217
+ ge,
218
218
  {
219
- type: c,
219
+ type: o,
220
220
  color: "primary",
221
221
  variant: "submit",
222
222
  className: m,
@@ -225,49 +225,49 @@ const Ct = (e) => e == null ? !1 : `${e}`.length > 0, rn = Mt(function(e, t) {
225
225
  name: h,
226
226
  "aria-label": d,
227
227
  children: [
228
- i ? /* @__PURE__ */ b(xe, { color: "stroke-base", loaderClass: "!w-6 mt-1", strokeWidth: "6" }) : null,
228
+ n ? /* @__PURE__ */ g(Le, { color: "stroke-base", loaderClass: "!w-6 mt-1", strokeWidth: "6" }) : null,
229
229
  t
230
230
  ]
231
231
  }
232
232
  ),
233
- /* @__PURE__ */ b(
234
- ve,
233
+ /* @__PURE__ */ g(
234
+ ge,
235
235
  {
236
236
  type: "button",
237
237
  variant: "outlined",
238
238
  disabled: a,
239
- onClick: n,
240
- name: y,
241
- "aria-label": v,
239
+ onClick: i,
240
+ name: p,
241
+ "aria-label": b,
242
242
  children: s
243
243
  }
244
244
  )
245
245
  ]
246
246
  }
247
247
  );
248
- }, on = (e) => {
249
- const { t } = V(), {
248
+ }, ln = (e) => {
249
+ const { t } = R(), {
250
250
  children: s,
251
251
  handleSubmit: r,
252
- onSubmit: n,
253
- handleClose: i,
252
+ onSubmit: i,
253
+ handleClose: n,
254
254
  isLoading: a = !1,
255
- buttonEnd: c = !0,
255
+ buttonEnd: o = !0,
256
256
  ...l
257
257
  } = e;
258
- return /* @__PURE__ */ b(at, { ...l, handleClose: i, children: /* @__PURE__ */ T("form", { onSubmit: r(n), children: [
259
- /* @__PURE__ */ b("div", { className: "form-container", children: s }),
260
- /* @__PURE__ */ b(
261
- ot,
258
+ return /* @__PURE__ */ g(dt, { ...l, handleClose: n, children: /* @__PURE__ */ $("form", { onSubmit: r(i), children: [
259
+ /* @__PURE__ */ g("div", { className: "form-container", children: s }),
260
+ /* @__PURE__ */ g(
261
+ ft,
262
262
  {
263
263
  primaryType: "submit",
264
264
  primaryText: t("_accessibility:buttons.submit"),
265
265
  cancelText: t("_accessibility:buttons.cancel"),
266
- onCancel: i,
266
+ onCancel: n,
267
267
  isLoading: a,
268
268
  disabled: a,
269
269
  primaryClassName: "dialog-form-primary",
270
- alignEnd: c,
270
+ alignEnd: o,
271
271
  primaryName: t("_accessibility:buttons.submit"),
272
272
  primaryAriaLabel: t("_accessibility:ariaLabels.submit"),
273
273
  cancelName: t("_accessibility:buttons.cancel"),
@@ -275,25 +275,25 @@ const Ct = (e) => e == null ? !1 : `${e}`.length > 0, rn = Mt(function(e, t) {
275
275
  }
276
276
  )
277
277
  ] }) });
278
- }, cn = (e) => {
279
- const { t } = V(), {
278
+ }, un = (e) => {
279
+ const { t } = R(), {
280
280
  children: s,
281
281
  handleSubmit: r,
282
- handleClose: n,
283
- isLoading: i = !1,
282
+ handleClose: i,
283
+ isLoading: n = !1,
284
284
  ...a
285
285
  } = e;
286
- return /* @__PURE__ */ T(at, { ...a, handleClose: n, children: [
286
+ return /* @__PURE__ */ $(dt, { ...a, handleClose: i, children: [
287
287
  s,
288
- /* @__PURE__ */ b(
289
- ot,
288
+ /* @__PURE__ */ g(
289
+ ft,
290
290
  {
291
291
  primaryText: t("_accessibility:buttons.ok"),
292
292
  cancelText: t("_accessibility:buttons.cancel"),
293
293
  onPrimaryClick: r,
294
- onCancel: n,
295
- isLoading: i,
296
- disabled: i,
294
+ onCancel: i,
295
+ isLoading: n,
296
+ disabled: n,
297
297
  primaryType: "button",
298
298
  containerClassName: "mt-5",
299
299
  primaryName: t("_accessibility:buttons.ok"),
@@ -304,34 +304,34 @@ const Ct = (e) => e == null ? !1 : `${e}`.length > 0, rn = Mt(function(e, t) {
304
304
  )
305
305
  ] });
306
306
  };
307
- function Zs(e) {
308
- const { message: t, className: s = "" } = e, { t: r } = V();
309
- return /* @__PURE__ */ b("p", { className: `import-error-message ${s}`, children: t ?? r("_messages:errors.parseFile", {
307
+ function er(e) {
308
+ const { message: t, className: s = "" } = e, { t: r } = R();
309
+ return /* @__PURE__ */ g("p", { className: `import-error-message ${s}`, children: t ?? r("_messages:errors.parseFile", {
310
310
  defaultValue: "Failed to process file"
311
311
  }) });
312
312
  }
313
- function er(e) {
314
- const { message: t, className: s = "" } = e, { t: r } = V();
315
- return /* @__PURE__ */ T("div", { className: `import-loading ${s}`, children: [
316
- /* @__PURE__ */ b(xe, { loaderClass: "w-5 h-5", className: "!w-auto" }),
317
- /* @__PURE__ */ b("span", { children: t ?? r("_messages:loading.processingFile", {
313
+ function tr(e) {
314
+ const { message: t, className: s = "" } = e, { t: r } = R();
315
+ return /* @__PURE__ */ $("div", { className: `import-loading ${s}`, children: [
316
+ /* @__PURE__ */ g(Le, { loaderClass: "w-5 h-5", className: "!w-auto" }),
317
+ /* @__PURE__ */ g("span", { children: t ?? r("_messages:loading.processingFile", {
318
318
  defaultValue: "Processing file..."
319
319
  }) })
320
320
  ] });
321
321
  }
322
- function tr(e) {
323
- const { items: t, max: s = 5, className: r = "" } = e, { t: n } = V();
322
+ function sr(e) {
323
+ const { items: t, max: s = 5, className: r = "" } = e, { t: i } = R();
324
324
  if (!t || t.length === 0) return null;
325
- const i = t.slice(0, s);
326
- return /* @__PURE__ */ T("div", { className: `import-preview ${r}`, children: [
327
- /* @__PURE__ */ b("p", { className: "import-preview-count", children: n("_pages:common.actions.import.previewCount", {
325
+ const n = t.slice(0, s);
326
+ return /* @__PURE__ */ $("div", { className: `import-preview ${r}`, children: [
327
+ /* @__PURE__ */ g("p", { className: "import-preview-count", children: i("_pages:common.actions.import.previewCount", {
328
328
  count: t.length,
329
329
  defaultValue: `Preview: ${t.length} items`
330
330
  }) }),
331
- /* @__PURE__ */ b("pre", { className: "import-preview-content", children: JSON.stringify(i, null, 2) })
331
+ /* @__PURE__ */ g("pre", { className: "import-preview-content", children: JSON.stringify(n, null, 2) })
332
332
  ] });
333
333
  }
334
- const Kt = () => ({
334
+ const Gt = () => ({
335
335
  file: null,
336
336
  previewItems: null,
337
337
  parseError: null,
@@ -339,7 +339,7 @@ const Kt = () => ({
339
339
  overrideExisting: !1,
340
340
  inputKey: 0
341
341
  });
342
- function sr(e, t) {
342
+ function rr(e, t) {
343
343
  switch (t.type) {
344
344
  case "SET_FILE":
345
345
  return { ...e, file: t.file, previewItems: null, parseError: null, processing: !1 };
@@ -352,35 +352,35 @@ function sr(e, t) {
352
352
  case "SET_OVERRIDE":
353
353
  return { ...e, overrideExisting: t.value };
354
354
  case "RESET":
355
- return { ...Kt(), inputKey: e.inputKey + 1 };
355
+ return { ...Gt(), inputKey: e.inputKey + 1 };
356
356
  }
357
357
  }
358
- const ln = (e) => {
359
- const { t } = V(), {
358
+ const dn = (e) => {
359
+ const { t } = R(), {
360
360
  children: s,
361
361
  handleSubmit: r,
362
- handleClose: n,
363
- isLoading: i = !1,
362
+ handleClose: i,
363
+ isLoading: n = !1,
364
364
  fileProcessor: a,
365
- onFileProcessed: c,
365
+ onFileProcessed: o,
366
366
  onOverrideChange: l,
367
367
  open: m,
368
- ...g
369
- } = e, [h, d] = Ut(sr, Kt()), { file: y, previewItems: v, parseError: C, processing: k, overrideExisting: q, inputKey: N } = h, L = Oe(c), x = Oe(a);
368
+ ...f
369
+ } = e, [h, d] = qt(rr, Gt()), { file: p, previewItems: b, parseError: S, processing: E, overrideExisting: N, inputKey: C } = h, F = Ue(o), x = Ue(a);
370
370
  me(() => {
371
- L.current = c;
372
- }, [c]), me(() => {
371
+ F.current = o;
372
+ }, [o]), me(() => {
373
373
  x.current = a;
374
374
  }, [a]), me(() => {
375
375
  m || d({ type: "RESET" });
376
376
  }, [m]);
377
- const A = $(async (I, R) => {
377
+ const A = D(async (I, O) => {
378
378
  var re;
379
379
  if (x.current) {
380
380
  d({ type: "START_PROCESSING" });
381
381
  try {
382
- const P = await x.current(I, { override: R });
383
- d({ type: "SET_PREVIEW", items: P ?? [] }), (re = L.current) == null || re.call(L, P ?? []);
382
+ const P = await x.current(I, { override: O });
383
+ d({ type: "SET_PREVIEW", items: P ?? [] }), (re = F.current) == null || re.call(F, P ?? []);
384
384
  } catch (P) {
385
385
  console.error(P);
386
386
  const ne = P instanceof Error ? P.message : "Failed to parse file";
@@ -388,57 +388,57 @@ const ln = (e) => {
388
388
  }
389
389
  }
390
390
  }, []);
391
- return /* @__PURE__ */ T(at, { ...g, open: m, handleClose: n, children: [
392
- /* @__PURE__ */ b(
393
- xs,
391
+ return /* @__PURE__ */ $(dt, { ...f, open: m, handleClose: i, children: [
392
+ /* @__PURE__ */ g(
393
+ As,
394
394
  {
395
395
  onClear: () => {
396
396
  var I;
397
- d({ type: "SET_FILE", file: null }), (I = L.current) == null || I.call(L, []);
397
+ d({ type: "SET_FILE", file: null }), (I = F.current) == null || I.call(F, []);
398
398
  },
399
399
  onChange: (I) => {
400
400
  var re, P;
401
- const R = (re = I.target.files) == null ? void 0 : re[0];
402
- if (!R) {
403
- d({ type: "SET_FILE", file: null }), (P = L.current) == null || P.call(L, []);
401
+ const O = (re = I.target.files) == null ? void 0 : re[0];
402
+ if (!O) {
403
+ d({ type: "SET_FILE", file: null }), (P = F.current) == null || P.call(F, []);
404
404
  return;
405
405
  }
406
- d({ type: "SET_FILE", file: R }), A(R, q);
406
+ d({ type: "SET_FILE", file: O }), A(O, N);
407
407
  },
408
408
  label: t("_accessibility:labels.file")
409
409
  },
410
- N
410
+ C
411
411
  ),
412
- /* @__PURE__ */ T("label", { className: "import-override-label", children: [
413
- /* @__PURE__ */ b(
412
+ /* @__PURE__ */ $("label", { className: "import-override-label", children: [
413
+ /* @__PURE__ */ g(
414
414
  "input",
415
415
  {
416
416
  type: "checkbox",
417
- checked: q,
417
+ checked: N,
418
418
  onChange: (I) => {
419
- const R = I.target.checked;
420
- d({ type: "SET_OVERRIDE", value: R }), l == null || l(R), y && A(y, R);
419
+ const O = I.target.checked;
420
+ d({ type: "SET_OVERRIDE", value: O }), l == null || l(O), p && A(p, O);
421
421
  }
422
422
  }
423
423
  ),
424
- /* @__PURE__ */ b("span", { children: t("_pages:common.actions.import.override", {
424
+ /* @__PURE__ */ g("span", { children: t("_pages:common.actions.import.override", {
425
425
  defaultValue: "Override existing items"
426
426
  }) })
427
427
  ] }),
428
- /* @__PURE__ */ b(Zs, { message: C }),
429
- k && /* @__PURE__ */ b(er, {}),
430
- !!v && v.length > 0 && /* @__PURE__ */ b(tr, { items: v }),
428
+ /* @__PURE__ */ g(er, { message: S }),
429
+ E && /* @__PURE__ */ g(tr, {}),
430
+ !!b && b.length > 0 && /* @__PURE__ */ g(sr, { items: b }),
431
431
  s,
432
- /* @__PURE__ */ b(
433
- ot,
432
+ /* @__PURE__ */ g(
433
+ ft,
434
434
  {
435
435
  primaryText: t("_accessibility:buttons.ok"),
436
436
  cancelText: t("_accessibility:buttons.cancel"),
437
437
  onPrimaryClick: () => {
438
- (!a || !!v && v.length > 0) && r();
438
+ (!a || !!b && b.length > 0) && r();
439
439
  },
440
- onCancel: n,
441
- isLoading: i,
440
+ onCancel: i,
441
+ isLoading: n,
442
442
  primaryType: "button",
443
443
  containerClassName: "import-dialog-actions",
444
444
  primaryName: t("_accessibility:buttons.ok"),
@@ -449,123 +449,204 @@ const ln = (e) => {
449
449
  )
450
450
  ] });
451
451
  };
452
- var z = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.error = 1] = "error", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e))(z || {}), se = /* @__PURE__ */ ((e) => (e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.PATCH = "PATCH", e.DELETE = "DELETE", e))(se || {});
453
- async function $e(e, t = "GET", s, r) {
454
- const n = {
452
+ var J = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.error = 1] = "error", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e))(J || {}), ee = /* @__PURE__ */ ((e) => (e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.PATCH = "PATCH", e.DELETE = "DELETE", e))(ee || {});
453
+ async function at(e, t = "GET", s, r) {
454
+ const i = {
455
455
  ...s ? { "Content-Type": "application/json" } : {},
456
456
  ...r
457
457
  };
458
458
  try {
459
- const i = await fetch(e, {
459
+ const n = await fetch(e, {
460
460
  method: t,
461
- headers: n,
461
+ headers: i,
462
462
  ...s ? { body: JSON.stringify(s) } : {}
463
- }), a = await i.text();
464
- let c = null;
463
+ }), a = await n.text();
464
+ let o = null;
465
465
  try {
466
- c = a ? JSON.parse(a) : null;
466
+ o = a ? JSON.parse(a) : null;
467
467
  } catch {
468
- c = null;
468
+ o = null;
469
469
  }
470
- if (!i.ok) {
471
- const l = typeof c == "object" && c !== null ? c.message ?? c.error ?? a : a || i.statusText;
470
+ if (!n.ok) {
471
+ const l = typeof o == "object" && o !== null ? o.message ?? o.error ?? a : a || n.statusText;
472
472
  return {
473
473
  data: null,
474
- status: i.status,
474
+ status: n.status,
475
475
  error: {
476
- status: i.status,
476
+ status: n.status,
477
477
  message: l || "Unknown error occurred"
478
478
  }
479
479
  };
480
480
  }
481
481
  return {
482
- data: i.status !== 204 && c !== null ? c : null,
483
- status: i.status,
482
+ data: n.status !== 204 && o !== null ? o : null,
483
+ status: n.status,
484
484
  error: null
485
485
  };
486
- } catch (i) {
486
+ } catch (n) {
487
487
  return {
488
488
  data: null,
489
489
  status: 500,
490
490
  error: {
491
491
  status: 500,
492
- message: i instanceof Error ? i.message : "Unknown error occurred"
492
+ message: n instanceof Error ? n.message : "Unknown error occurred"
493
493
  }
494
494
  };
495
495
  }
496
496
  }
497
- function rr(e, t) {
497
+ function nr(e, t) {
498
498
  if (t) {
499
499
  const s = Object.entries(t).filter(([, r]) => r != null).map(
500
- ([r, n]) => `${encodeURIComponent(r)}=${encodeURIComponent(String(n))}`
500
+ ([r, i]) => `${encodeURIComponent(r)}=${encodeURIComponent(String(i))}`
501
501
  ).join("&");
502
502
  return s ? `${e}?${s}` : e;
503
503
  }
504
504
  return e;
505
505
  }
506
- const Qt = (e, t, s) => {
506
+ const zt = (e, t, s) => {
507
507
  const r = [];
508
508
  if (t) {
509
- const { sortingBy: n, sortingOrder: i, currentPage: a, pageSize: c } = t;
510
- r.push(
511
- `sort=${String(n)}`,
512
- `order=${i}`,
513
- `page=${a}`,
514
- `pageSize=${c}`
515
- );
509
+ const { sortingBy: i, sortingOrder: n, currentPage: a, pageSize: o } = t;
510
+ i !== void 0 && r.push(`sort=${String(i)}`), n !== void 0 && r.push(`order=${n}`), a !== void 0 && r.push(`page=${a}`), o !== void 0 && r.push(`pageSize=${o}`);
516
511
  }
517
512
  if (s) {
518
- const n = Object.entries(s).filter(
519
- ([, i]) => i != null && i !== ""
520
- ).flatMap(([i, a]) => {
513
+ const i = Object.entries(s).filter(
514
+ ([, n]) => n != null && n !== ""
515
+ ).flatMap(([n, a]) => {
521
516
  if (Array.isArray(a))
522
- return a.map((c) => `${i}==${encodeURIComponent((c == null ? void 0 : c.id) ?? c)}`);
517
+ return a.map((o) => `${n}==${encodeURIComponent((o == null ? void 0 : o.id) ?? o)}`);
523
518
  if (typeof a == "object" && a !== null && "start" in a && "end" in a) {
524
- const c = [];
525
- return a.start != null && a.start !== "" && c.push(`${i}>=${encodeURIComponent(a.start)}`), a.end != null && a.end !== "" && c.push(`${i}<=${encodeURIComponent(a.end)}`), c;
519
+ const o = [];
520
+ return a.start != null && a.start !== "" && o.push(`${n}>=${encodeURIComponent(a.start)}`), a.end != null && a.end !== "" && o.push(`${n}<=${encodeURIComponent(a.end)}`), o;
526
521
  }
527
- return typeof a == "object" && a !== null ? `${i}==${encodeURIComponent(a.id ?? "")}` : `${i}==${encodeURIComponent(a)}`;
522
+ return typeof a == "object" && a !== null ? `${n}==${encodeURIComponent(a.id ?? "")}` : `${n}==${encodeURIComponent(a)}`;
528
523
  });
529
- n.length > 0 && r.push(`filters=${n.join(",")}`);
524
+ i.length > 0 && r.push(`filters=${i.join(",")}`);
530
525
  }
531
526
  return r.length ? `${e}?${r.join("&")}` : e;
532
- };
533
- class Wt {
527
+ }, $e = class $e {
534
528
  /**
535
529
  * @param baseUrl the base url of the server
536
530
  * @param userKey the local storage user key
537
531
  * @param secured if the api client requires token
538
532
  * @param tokenAcquirer custom token acquirer
539
533
  */
540
- constructor(t, s = "user", r = !0, n) {
541
- ee(this, "baseUrl");
542
- ee(this, "userKey");
543
- ee(this, "secured");
544
- ee(this, "tokenAcquirer");
545
- this.baseUrl = t, this.secured = r, this.userKey = s, this.tokenAcquirer = n ?? this.defaultTokenAcquirer;
534
+ constructor(t, s = "user", r = !0, i, n = {}) {
535
+ W(this, "baseUrl");
536
+ W(this, "userKey");
537
+ W(this, "rememberKey");
538
+ W(this, "refreshTokenKey");
539
+ W(this, "accessTokenExpiresAtKey");
540
+ W(this, "refreshEndpoint");
541
+ W(this, "refreshExpirySkewMs");
542
+ W(this, "secured");
543
+ W(this, "tokenAcquirer");
544
+ this.baseUrl = t, this.secured = r, this.userKey = s, this.rememberKey = n.rememberKey ?? "remember", this.refreshTokenKey = n.refreshTokenKey ?? "refreshToken", this.accessTokenExpiresAtKey = n.accessTokenExpiresAtKey ?? "accessTokenExpiresAt", this.refreshEndpoint = n.refreshEndpoint ?? "auth/refresh", this.refreshExpirySkewMs = n.refreshExpirySkewMs ?? 5e3, this.tokenAcquirer = i ?? this.defaultTokenAcquirer;
546
545
  }
547
546
  defaultTokenAcquirer(t) {
548
547
  if (t) return { credentials: "include" };
549
- const s = Gt(this.userKey);
548
+ const s = Ce(this.userKey);
550
549
  if (s && s.length)
551
550
  return { Authorization: `Bearer ${s}` };
552
551
  }
553
- async doQuery(t, s = se.GET, r, n) {
554
- const i = this.secured ? this.tokenAcquirer() : {}, { data: a, status: c, error: l } = await $e(
555
- `${this.baseUrl}${t}`,
552
+ getRefreshLockKey() {
553
+ return `${this.baseUrl}|${this.userKey}|${this.refreshTokenKey}|${this.accessTokenExpiresAtKey}`;
554
+ }
555
+ buildUrl(t) {
556
+ const s = this.baseUrl.endsWith("/") ? this.baseUrl.slice(0, -1) : this.baseUrl, r = t.startsWith("/") ? t : `/${t}`;
557
+ return `${s}${r}`;
558
+ }
559
+ getRefreshToken() {
560
+ const t = Ce(this.refreshTokenKey);
561
+ if (typeof t == "string" && t.length)
562
+ return t;
563
+ }
564
+ getAccessTokenExpiresAt() {
565
+ const t = Ce(this.accessTokenExpiresAtKey);
566
+ if (typeof t == "string" && t.length)
567
+ return t;
568
+ }
569
+ canRefresh() {
570
+ return !!this.getRefreshToken();
571
+ }
572
+ shouldRefreshBeforeRequest() {
573
+ const t = this.getRefreshToken(), s = this.getAccessTokenExpiresAt();
574
+ if (!t || !s) return !1;
575
+ const r = Date.parse(s);
576
+ return Number.isNaN(r) ? !1 : Date.now() >= r - this.refreshExpirySkewMs;
577
+ }
578
+ clearStoredSession() {
579
+ oe(this.userKey), oe(this.rememberKey), oe(this.refreshTokenKey), oe(this.accessTokenExpiresAtKey);
580
+ }
581
+ storeSession(t) {
582
+ ke(this.userKey, t.token), typeof t.refreshToken == "string" && t.refreshToken.length ? ke(this.refreshTokenKey, t.refreshToken) : oe(this.refreshTokenKey), typeof t.accessTokenExpiresAt == "string" && t.accessTokenExpiresAt.length ? ke(this.accessTokenExpiresAtKey, t.accessTokenExpiresAt) : oe(this.accessTokenExpiresAtKey);
583
+ }
584
+ async refreshAccessTokenWithMutex() {
585
+ const t = this.getRefreshToken();
586
+ if (!t)
587
+ throw {
588
+ status: 401,
589
+ message: "Missing refresh token"
590
+ };
591
+ const s = this.getRefreshLockKey(), r = $e.refreshInFlight.get(s);
592
+ if (r) {
593
+ await r;
594
+ return;
595
+ }
596
+ const i = (async () => {
597
+ const { data: n, status: a, error: o } = await at(
598
+ this.buildUrl(this.refreshEndpoint),
599
+ ee.POST,
600
+ { refreshToken: t }
601
+ );
602
+ if (o || !(n != null && n.token) || typeof n.refreshToken != "string" || !n.refreshToken.length)
603
+ throw this.clearStoredSession(), o ?? {
604
+ status: a,
605
+ message: "Unable to refresh session"
606
+ };
607
+ this.storeSession(n);
608
+ })();
609
+ $e.refreshInFlight.set(s, i);
610
+ try {
611
+ await i;
612
+ } finally {
613
+ $e.refreshInFlight.delete(s);
614
+ }
615
+ }
616
+ mergeHeaders(t) {
617
+ return {
618
+ ...(this.secured ? this.tokenAcquirer() : {}) ?? {},
619
+ ...t ?? {}
620
+ };
621
+ }
622
+ async makeRequestWithRefresh(t, s, r, i) {
623
+ this.secured && this.shouldRefreshBeforeRequest() && await this.refreshAccessTokenWithMutex();
624
+ let n = await at(
625
+ this.buildUrl(t),
556
626
  s,
557
627
  r,
558
- {
559
- ...i,
560
- ...n ?? {}
561
- }
628
+ this.mergeHeaders(i)
629
+ );
630
+ return this.secured && n.status === 401 && this.canRefresh() && (await this.refreshAccessTokenWithMutex(), n = await at(
631
+ this.buildUrl(t),
632
+ s,
633
+ r,
634
+ this.mergeHeaders(i)
635
+ )), n;
636
+ }
637
+ async doQuery(t, s = ee.GET, r, i) {
638
+ const { data: n, status: a, error: o } = await this.makeRequestWithRefresh(
639
+ t,
640
+ s,
641
+ r,
642
+ i
562
643
  );
563
- if (l || c < 200 || c >= 300)
564
- throw l ?? {
565
- status: c,
566
- message: String(c)
644
+ if (o || a < 200 || a >= 300)
645
+ throw o ?? {
646
+ status: a,
647
+ message: String(a)
567
648
  };
568
- return a;
649
+ return n;
569
650
  }
570
651
  /**
571
652
  * @description Get all objects
@@ -574,14 +655,12 @@ class Wt {
574
655
  * @returns Result list
575
656
  */
576
657
  async get(t, s, r) {
577
- const n = Qt(t, s, r), i = this.secured ? this.tokenAcquirer() : void 0, { data: a, error: c } = await $e(
578
- `${this.baseUrl}${n}`,
579
- se.GET,
580
- null,
581
- i
658
+ const i = zt(t, s, r), { data: n, error: a } = await this.makeRequestWithRefresh(
659
+ i,
660
+ ee.GET
582
661
  );
583
- if (c) throw c;
584
- return a;
662
+ if (a) throw a;
663
+ return n;
585
664
  }
586
665
  /**
587
666
  * @description Get entity by id
@@ -590,15 +669,14 @@ class Wt {
590
669
  * @returns updated entity
591
670
  */
592
671
  async patch(t, s) {
593
- const r = this.secured ? this.tokenAcquirer() : void 0, { error: n, data: i, status: a } = await $e(
594
- `${this.baseUrl}${t}`,
595
- se.PATCH,
596
- s,
597
- r
672
+ const { error: r, data: i, status: n } = await this.makeRequestWithRefresh(
673
+ t,
674
+ ee.PATCH,
675
+ s
598
676
  );
599
- if (n || !i)
600
- throw n ?? {
601
- status: a,
677
+ if (r || i === null || i === void 0)
678
+ throw r ?? {
679
+ status: n,
602
680
  message: "Unknown error"
603
681
  };
604
682
  return i;
@@ -609,15 +687,14 @@ class Wt {
609
687
  * @returns delete result
610
688
  */
611
689
  async delete(t, s) {
612
- const r = this.secured ? this.tokenAcquirer() : void 0, { error: n, data: i, status: a } = await $e(
613
- `${this.baseUrl}${t}`,
614
- se.DELETE,
615
- s,
616
- r
690
+ const { error: r, data: i, status: n } = await this.makeRequestWithRefresh(
691
+ t,
692
+ ee.DELETE,
693
+ s
617
694
  );
618
- if (n || !i)
619
- throw n ?? {
620
- status: a,
695
+ if (r || i === null || i === void 0)
696
+ throw r ?? {
697
+ status: n,
621
698
  message: "Unknown error"
622
699
  };
623
700
  return i;
@@ -629,53 +706,72 @@ class Wt {
629
706
  * @returns inserted item
630
707
  */
631
708
  async post(t, s) {
632
- const r = this.secured ? this.tokenAcquirer() : void 0, { error: n, data: i, status: a } = await $e(
633
- `${this.baseUrl}${t}`,
634
- se.POST,
635
- s,
636
- r
709
+ const { error: r, data: i, status: n } = await this.makeRequestWithRefresh(
710
+ t,
711
+ ee.POST,
712
+ s
637
713
  );
638
- if (n || !i)
639
- throw n ?? {
640
- status: a,
714
+ if (r || i === null || i === void 0)
715
+ throw r ?? {
716
+ status: n,
641
717
  message: "Unknown error"
642
718
  };
643
719
  return i;
644
720
  }
645
- }
646
- class nr {
647
- constructor(t, s = "user") {
648
- ee(this, "api");
649
- this.api = new Wt(t, s, !1);
721
+ };
722
+ W($e, "refreshInFlight", /* @__PURE__ */ new Map());
723
+ let Ge = $e;
724
+ class ir {
725
+ constructor(t, s = "user", r = {}) {
726
+ W(this, "api");
727
+ this.api = new Ge(t, s, !1, void 0, r);
650
728
  }
651
729
  async login(t) {
652
730
  const s = "auth/sign-in", r = t;
653
731
  return await this.api.doQuery(
654
732
  s,
655
- se.POST,
733
+ ee.POST,
656
734
  r
657
735
  );
658
736
  }
659
- async logout() {
660
- return await this.api.doQuery("auth/sign-out", se.POST);
737
+ async refresh(t) {
738
+ return await this.api.doQuery(
739
+ "auth/refresh",
740
+ ee.POST,
741
+ t
742
+ );
743
+ }
744
+ async logout(t) {
745
+ const s = "auth/sign-out", r = t != null && t.accessToken ? {
746
+ Authorization: `Bearer ${t.accessToken}`
747
+ } : void 0, i = t != null && t.refreshToken ? { refreshToken: t.refreshToken } : void 0;
748
+ return await this.api.doQuery(
749
+ s,
750
+ ee.POST,
751
+ i,
752
+ r
753
+ );
661
754
  }
662
755
  async register(t) {
663
756
  return await this.api.doQuery(
664
757
  "auth/sign-up",
665
- se.POST,
758
+ ee.POST,
666
759
  t
667
760
  );
668
761
  }
669
762
  async getSession() {
670
- return await this.api.doQuery("auth/session", se.GET, null, {
671
- ...this.api.defaultTokenAcquirer()
672
- });
763
+ return await this.api.doQuery(
764
+ "auth/session",
765
+ ee.GET,
766
+ void 0,
767
+ this.api.defaultTokenAcquirer()
768
+ );
673
769
  }
674
770
  }
675
- class un {
676
- constructor(t, s) {
677
- ee(this, "auth");
678
- this.auth = new nr(t, s);
771
+ class fn {
772
+ constructor(t, s, r = {}) {
773
+ W(this, "auth");
774
+ this.auth = new ir(t, s, r);
679
775
  }
680
776
  /**
681
777
  * @returns auth
@@ -684,17 +780,17 @@ class un {
684
780
  return this.auth;
685
781
  }
686
782
  }
687
- class dn {
783
+ class hn {
688
784
  /**
689
785
  *
690
786
  * @param table
691
787
  * @param secured to see if the api client requires jwt protection
692
788
  */
693
- constructor(t, s, r = "user", n = !0) {
694
- ee(this, "table");
695
- ee(this, "secured");
696
- ee(this, "api");
697
- this.table = t, this.secured = n, this.api = new Wt(s, r, n);
789
+ constructor(t, s, r = "user", i = !0, n = {}) {
790
+ W(this, "table");
791
+ W(this, "secured");
792
+ W(this, "api");
793
+ this.table = t, this.secured = i, this.api = new Ge(s, r, i, void 0, n);
698
794
  }
699
795
  /**
700
796
  *
@@ -712,7 +808,7 @@ class dn {
712
808
  async insertMany(t) {
713
809
  return await this.api.doQuery(
714
810
  `${this.table}/batch`,
715
- se.POST,
811
+ ee.POST,
716
812
  t
717
813
  );
718
814
  }
@@ -742,12 +838,12 @@ class dn {
742
838
  * @returns - List of elements
743
839
  */
744
840
  async export(t) {
745
- const s = Qt(
841
+ const s = zt(
746
842
  `${this.table}/export`,
747
843
  void 0,
748
844
  t
749
845
  );
750
- return await this.api.doQuery(s, se.GET, void 0);
846
+ return await this.api.doQuery(s, ee.GET, void 0);
751
847
  }
752
848
  /**
753
849
  *
@@ -757,7 +853,7 @@ class dn {
757
853
  async import(t) {
758
854
  return await this.api.doQuery(
759
855
  `${this.table}/import`,
760
- se.POST,
856
+ ee.POST,
761
857
  t
762
858
  );
763
859
  }
@@ -768,8 +864,8 @@ class dn {
768
864
  */
769
865
  async commonGet(t) {
770
866
  return await this.api.doQuery(
771
- rr(`${this.table}/common`, t),
772
- se.GET
867
+ nr(`${this.table}/common`, t),
868
+ ee.GET
773
869
  );
774
870
  }
775
871
  /**
@@ -787,34 +883,32 @@ class dn {
787
883
  return await this.api.patch(`${this.table}/restore`, t);
788
884
  }
789
885
  }
790
- class fn {
886
+ class mn {
791
887
  constructor(t, s, r = 1) {
792
- ee(this, "table");
793
- ee(this, "dbName");
794
- ee(this, "version");
795
- ee(this, "db", null);
888
+ W(this, "table");
889
+ W(this, "dbName");
890
+ W(this, "version");
891
+ W(this, "db", null);
796
892
  this.table = t, this.dbName = s, this.version = r;
797
893
  }
798
894
  open() {
799
895
  return this.db ? Promise.resolve(this.db) : new Promise((t, s) => {
800
896
  const r = indexedDB.open(this.dbName, this.version);
801
- r.onupgradeneeded = (n) => {
802
- const i = n.target.result;
803
- i.objectStoreNames.contains(this.table) || i.createObjectStore(this.table, {
897
+ r.onupgradeneeded = (i) => {
898
+ const n = i.target.result;
899
+ n.objectStoreNames.contains(this.table) || n.createObjectStore(this.table, {
804
900
  keyPath: "id",
805
901
  autoIncrement: !0
806
902
  });
807
- }, r.onsuccess = (n) => {
808
- this.db = n.target.result, t(this.db);
809
- }, r.onerror = (n) => {
810
- s(n.target.error);
903
+ }, r.onsuccess = (i) => {
904
+ this.db = i.target.result, t(this.db);
905
+ }, r.onerror = (i) => {
906
+ s(i.target.error);
811
907
  };
812
908
  });
813
909
  }
814
- transaction(t) {
815
- return this.open().then(
816
- (s) => s.transaction(this.table, t).objectStore(this.table)
817
- );
910
+ async transaction(t) {
911
+ return (await this.open()).transaction(this.table, t).objectStore(this.table);
818
912
  }
819
913
  request(t) {
820
914
  return new Promise((s, r) => {
@@ -828,31 +922,31 @@ class fn {
828
922
  async insertMany(t) {
829
923
  const s = await this.transaction("readwrite");
830
924
  let r = 0;
831
- for (const n of t)
832
- r = await this.request(s.add(n));
925
+ for (const i of t)
926
+ r = await this.request(s.add(i));
833
927
  return { ...t[t.length - 1], id: r };
834
928
  }
835
- async update(t) {
836
- const s = await this.transaction("readwrite");
837
- return await this.request(s.put(t)), t;
929
+ async update(t, s) {
930
+ const r = await this.transaction("readwrite");
931
+ return await this.request(r.put(s)), s;
838
932
  }
839
933
  async get(t, s) {
840
- var y;
841
- const r = await this.transaction("readonly"), n = await this.request(r.getAll()), i = this.applyFilter(n, s), a = (t == null ? void 0 : t.sortingBy) ?? "id", c = ((y = t == null ? void 0 : t.sortingOrder) == null ? void 0 : y.toLowerCase()) ?? "asc";
842
- i.sort((v, C) => {
843
- const k = v[a], q = C[a];
844
- return k < q ? c === "asc" ? -1 : 1 : k > q ? c === "asc" ? 1 : -1 : 0;
934
+ var p;
935
+ const r = await this.transaction("readonly"), i = await this.request(r.getAll()), n = this.applyFilter(i, s), a = (t == null ? void 0 : t.sortingBy) ?? "id", o = ((p = t == null ? void 0 : t.sortingOrder) == null ? void 0 : p.toLowerCase()) ?? "asc";
936
+ n.sort((b, S) => {
937
+ const E = b[a], N = S[a];
938
+ return E < N ? o === "asc" ? -1 : 1 : E > N ? o === "asc" ? 1 : -1 : 0;
845
939
  });
846
- const l = (t == null ? void 0 : t.pageSize) ?? 10, m = (t == null ? void 0 : t.currentPage) ?? 0, g = i.length, h = Math.ceil(g / l), d = i.slice(
940
+ const l = (t == null ? void 0 : t.pageSize) ?? 10, m = (t == null ? void 0 : t.currentPage) ?? 0, f = n.length, h = Math.ceil(f / l), d = n.slice(
847
941
  m * l,
848
942
  m * l + l
849
943
  );
850
944
  return {
851
945
  sort: a,
852
- order: c,
946
+ order: o,
853
947
  currentPage: m,
854
948
  pageSize: l,
855
- totalElements: g,
949
+ totalElements: f,
856
950
  totalPages: h,
857
951
  items: d
858
952
  };
@@ -864,8 +958,8 @@ class fn {
864
958
  async import(t) {
865
959
  const s = await this.transaction("readwrite");
866
960
  let r = 0;
867
- for (const n of t.items)
868
- t.override ? await this.request(s.put(n)) : await this.request(s.add(n)), r++;
961
+ for (const i of t.items)
962
+ t.override ? await this.request(s.put(i)) : await this.request(s.add(i)), r++;
869
963
  return r;
870
964
  }
871
965
  async commonGet(t) {
@@ -880,36 +974,36 @@ class fn {
880
974
  async softDelete(t) {
881
975
  const s = await this.transaction("readwrite");
882
976
  let r = 0;
883
- for (const n of t) {
884
- const i = await this.request(s.get(n));
885
- i && (await this.request(s.put({ ...i, deletedAt: /* @__PURE__ */ new Date() })), r++);
977
+ for (const i of t) {
978
+ const n = await this.request(s.get(i));
979
+ n && (await this.request(s.put({ ...n, deletedAt: /* @__PURE__ */ new Date() })), r++);
886
980
  }
887
981
  return r;
888
982
  }
889
983
  async restore(t) {
890
984
  const s = await this.transaction("readwrite");
891
985
  let r = 0;
892
- for (const n of t) {
893
- const i = await this.request(s.get(n));
894
- i && (await this.request(s.put({ ...i, deletedAt: null })), r++);
986
+ for (const i of t) {
987
+ const n = await this.request(s.get(i));
988
+ n && (await this.request(s.put({ ...n, deletedAt: null })), r++);
895
989
  }
896
990
  return r;
897
991
  }
898
992
  applyFilter(t, s) {
899
993
  return s ? t.filter(
900
994
  (r) => Object.keys(s).every(
901
- (n) => s[n] === void 0 || r[n] === s[n]
995
+ (i) => s[i] === void 0 || r[i] === s[i]
902
996
  )
903
997
  ) : t;
904
998
  }
905
999
  }
906
- function mn(e) {
1000
+ function yn(e) {
907
1001
  return Object.keys(e).filter((t) => isNaN(Number(t))).map((t) => ({
908
1002
  key: t,
909
1003
  value: e[t]
910
1004
  }));
911
1005
  }
912
- const Gt = (e, t = "") => {
1006
+ const Ce = (e, t = "") => {
913
1007
  const s = localStorage.getItem(e) ?? void 0;
914
1008
  if (s && t.length)
915
1009
  switch (t) {
@@ -923,11 +1017,11 @@ const Gt = (e, t = "") => {
923
1017
  return s;
924
1018
  }
925
1019
  return s;
926
- }, Et = (e, t) => localStorage.setItem(
1020
+ }, ke = (e, t) => localStorage.setItem(
927
1021
  e,
928
1022
  typeof t == "object" ? JSON.stringify(t) : t
929
- ), kt = (e) => localStorage.removeItem(e);
930
- function hn(e) {
1023
+ ), oe = (e) => localStorage.removeItem(e);
1024
+ function gn(e) {
931
1025
  const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = {
932
1026
  weekday: "long",
933
1027
  // martes
@@ -949,64 +1043,66 @@ function hn(e) {
949
1043
  s
950
1044
  );
951
1045
  }
952
- function gn(e) {
953
- const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = String(t.getDate()).padStart(2, "0"), r = String(t.getMonth() + 1).padStart(2, "0"), n = String(t.getFullYear()).slice(-2), i = String(t.getHours()).padStart(2, "0"), a = String(t.getMinutes()).padStart(2, "0");
954
- return `${s}/${r}/${n} ${i}:${a}`;
1046
+ function pn(e) {
1047
+ const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = String(t.getDate()).padStart(2, "0"), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getFullYear()).slice(-2), n = String(t.getHours()).padStart(2, "0"), a = String(t.getMinutes()).padStart(2, "0");
1048
+ return `${s}/${r}/${i} ${n}:${a}`;
955
1049
  }
956
- function yn(e) {
957
- const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = t.getFullYear(), r = String(t.getMonth() + 1).padStart(2, "0"), n = String(t.getDate()).padStart(2, "0"), i = String(t.getHours()).padStart(2, "0"), a = String(t.getMinutes()).padStart(2, "0");
958
- return `${s}-${r}-${n}T${i}:${a}`;
1050
+ function bn(e) {
1051
+ const t = e ? new Date(e) : /* @__PURE__ */ new Date(), s = t.getFullYear(), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), n = String(t.getHours()).padStart(2, "0"), a = String(t.getMinutes()).padStart(2, "0");
1052
+ return `${s}-${r}-${i}T${n}:${a}`;
959
1053
  }
960
- const ir = () => {
1054
+ const ar = () => {
961
1055
  var s;
962
1056
  const e = navigator, t = ((s = e == null ? void 0 : e.userAgentData) == null ? void 0 : s.platform) || (e == null ? void 0 : e.platform) || "";
963
1057
  return /Mac|iPhone|iPod|iPad/i.test(t);
964
1058
  };
965
- function Ge(e) {
1059
+ function Xe(e) {
966
1060
  if (!e || typeof e != "object") return !1;
967
1061
  const t = e;
968
1062
  return Array.isArray(t.errors) && t.errors.every(
969
1063
  (s) => Array.isArray(s) && s.length === 2 && typeof s[0] == "string"
970
1064
  );
971
1065
  }
972
- function ze(e) {
1066
+ function Ze(e) {
973
1067
  if (!e || typeof e != "object") return !1;
974
1068
  const t = e;
975
1069
  return typeof (t == null ? void 0 : t.status) == "number" && typeof (t == null ? void 0 : t.message) == "string";
976
1070
  }
977
- function bn(e, t) {
1071
+ function wn(e, t) {
978
1072
  return e != null && e.errors ? e.errors.map(([s, r]) => t(s, r)) : [];
979
1073
  }
980
- const zt = Te({});
981
- function pn(e) {
982
- const { children: t } = e, s = Oe(0), [r, n] = Ut(
1074
+ const Jt = De(
1075
+ void 0
1076
+ );
1077
+ function vn(e) {
1078
+ const { children: t } = e, s = Ue(0), [r, i] = qt(
983
1079
  (h, d) => {
984
- const { type: y, items: v, id: C } = d;
985
- switch (y) {
1080
+ const { type: p, items: b, id: S } = d;
1081
+ switch (p) {
986
1082
  case "set":
987
- return v ?? [];
1083
+ return b ?? [];
988
1084
  case "remove":
989
- return C !== void 0 ? h.filter((k) => k.id !== C) : [];
1085
+ return S !== void 0 ? h.filter((E) => E.id !== S) : [];
990
1086
  }
991
1087
  return h;
992
1088
  },
993
1089
  [],
994
1090
  () => []
995
- ), i = (h) => h.map((d) => ({ ...d, id: s.current++ })), a = (h) => n({
1091
+ ), n = (h) => h.map((d) => ({ ...d, id: s.current++ })), a = (h) => i({
996
1092
  type: "set",
997
- items: i([{ ...h, type: z.error }])
998
- }), c = (h) => n({ type: "set", items: i([{ ...h }]) }), l = (h) => n({ type: "set", items: i(h) }), m = (h) => n({
1093
+ items: n([{ ...h, type: J.error }])
1094
+ }), o = (h) => i({ type: "set", items: n([{ ...h }]) }), l = (h) => i({ type: "set", items: n(h) }), m = (h) => i({
999
1095
  type: "set",
1000
- items: i([{ ...h, type: z.success }])
1001
- }), g = (h) => n({ type: "remove", id: h });
1002
- return /* @__PURE__ */ b(
1003
- zt.Provider,
1096
+ items: n([{ ...h, type: J.success }])
1097
+ }), f = (h) => i({ type: "remove", id: h });
1098
+ return /* @__PURE__ */ g(
1099
+ Jt.Provider,
1004
1100
  {
1005
1101
  value: {
1006
1102
  notification: r,
1007
- removeNotification: g,
1103
+ removeNotification: f,
1008
1104
  showErrorNotification: a,
1009
- showNotification: c,
1105
+ showNotification: o,
1010
1106
  showSuccessNotification: m,
1011
1107
  showStackNotifications: l
1012
1108
  },
@@ -1014,12 +1110,12 @@ function pn(e) {
1014
1110
  }
1015
1111
  );
1016
1112
  }
1017
- const Ne = () => {
1018
- const e = Fe(zt);
1019
- if (e === void 0)
1113
+ const Ae = () => {
1114
+ const e = Ve(Jt);
1115
+ if (!e)
1020
1116
  throw new Error("NotificationContext must be used within a Provider");
1021
1117
  return e;
1022
- }, be = new zs({
1118
+ }, we = new Js({
1023
1119
  defaultOptions: {
1024
1120
  queries: {
1025
1121
  refetchInterval: !1,
@@ -1031,190 +1127,274 @@ const Ne = () => {
1031
1127
  // default: true
1032
1128
  }
1033
1129
  }
1034
- }), Jt = Te(
1130
+ }), Yt = De(
1035
1131
  void 0
1036
- ), wn = (e) => {
1132
+ ), kn = (e) => {
1037
1133
  const { children: t, manager: s } = e;
1038
- return /* @__PURE__ */ b(Jt.Provider, { value: { client: s }, children: /* @__PURE__ */ b(Js, { client: be, children: t }) });
1039
- }, ar = () => {
1040
- const e = Fe(Jt);
1134
+ return /* @__PURE__ */ g(Yt.Provider, { value: { client: s }, children: /* @__PURE__ */ g(Ys, { client: we, children: t }) });
1135
+ }, or = () => {
1136
+ const e = Ve(Yt);
1041
1137
  if (!e)
1042
1138
  throw new Error("managerContext must be used within a Provider");
1043
1139
  return e.client;
1044
- }, Yt = Te(
1140
+ }, Xt = De(
1045
1141
  void 0
1046
- ), vn = (e) => {
1047
- const { children: t, guestMode: s = "guest_mode", user: r = "user" } = e, n = ar(), [i, a] = Y({}), c = $(() => !!Gt(s, "boolean") && i.token === void 0, [i.token, s]), l = $((y) => {
1048
- Et(s, y);
1049
- }, [s]), m = $((y) => {
1050
- y && (a(y), kt(s), Et(r, y.token));
1051
- }, [s, r]), g = $(async () => {
1142
+ ), Sn = (e) => {
1143
+ const {
1144
+ children: t,
1145
+ guestMode: s = "guest_mode",
1146
+ user: r = "user",
1147
+ remember: i = "remember",
1148
+ refreshTokenKey: n = "refreshToken",
1149
+ accessTokenExpiresAtKey: a = "accessTokenExpiresAt"
1150
+ } = e, o = or(), [l, m] = X({}), f = D(() => {
1151
+ oe(r), oe(i), oe(n), oe(a);
1152
+ }, [a, n, i, r]), h = D(() => !!Ce(s, "boolean") && l.token === void 0, [l.token, s]), d = D((N) => {
1153
+ ke(s, N);
1154
+ }, [s]), p = D((N, C) => {
1155
+ if (!N) return;
1156
+ const F = Ce(i, "boolean"), x = C ?? (typeof F == "boolean" ? F : !1);
1157
+ m(N), oe(s), ke(r, N.token), ke(i, x), typeof N.refreshToken == "string" && N.refreshToken.length ? ke(n, N.refreshToken) : oe(n), typeof N.accessTokenExpiresAt == "string" && N.accessTokenExpiresAt.length ? ke(a, N.accessTokenExpiresAt) : oe(a);
1158
+ }, [
1159
+ a,
1160
+ s,
1161
+ n,
1162
+ i,
1163
+ r
1164
+ ]), b = D(async () => {
1165
+ const N = Ce(r) ?? l.token, C = Ce(n) ?? (typeof l.refreshToken == "string" ? l.refreshToken : void 0);
1052
1166
  try {
1053
- await n.Auth.logout();
1054
- } catch (y) {
1055
- console.error(y);
1167
+ await o.Auth.logout({
1168
+ accessToken: N,
1169
+ refreshToken: C
1170
+ });
1171
+ } catch (F) {
1172
+ console.error(F);
1056
1173
  }
1057
- a({}), kt(r);
1058
- }, [n.Auth, r]), h = $(async () => {
1174
+ m({}), f();
1175
+ }, [l.refreshToken, l.token, f, o.Auth, n, r]), S = D(async () => {
1059
1176
  try {
1060
- const y = await n.Auth.getSession();
1061
- m(y);
1062
- } catch (y) {
1063
- console.error(y), g();
1177
+ const N = await o.Auth.getSession();
1178
+ p(N);
1179
+ } catch (N) {
1180
+ console.error(N), b();
1064
1181
  }
1065
- }, [m, g, n.Auth]), d = {
1066
- account: i,
1067
- logUser: m,
1068
- logoutUser: g,
1069
- logUserFromLocal: h,
1070
- isInGuestMode: c,
1071
- setGuestMode: l
1182
+ }, [p, b, o.Auth]), E = {
1183
+ account: l,
1184
+ logUser: p,
1185
+ logoutUser: b,
1186
+ logUserFromLocal: S,
1187
+ isInGuestMode: h,
1188
+ setGuestMode: d
1072
1189
  };
1073
- return /* @__PURE__ */ b(Yt.Provider, { value: d, children: t });
1074
- }, Xt = () => {
1075
- const e = Fe(Yt);
1190
+ return /* @__PURE__ */ g(Xt.Provider, { value: E, children: t });
1191
+ }, Zt = () => {
1192
+ const e = Ve(Xt);
1076
1193
  if (!e)
1077
1194
  throw new Error("authContext must be used within a Provider");
1078
1195
  return e;
1079
- }, Zt = Te({}), Sn = (e) => {
1080
- const { children: t, location: s, navigate: r, linkComponent: n, searchComponent: i } = e;
1081
- return /* @__PURE__ */ b(
1082
- Zt.Provider,
1196
+ }, es = De({}), Tn = (e) => {
1197
+ const { children: t, location: s, navigate: r, linkComponent: i, searchComponent: n } = e;
1198
+ return /* @__PURE__ */ g(
1199
+ es.Provider,
1083
1200
  {
1084
- value: { location: s, navigate: r, linkComponent: n, searchComponent: i },
1201
+ value: { location: s, navigate: r, linkComponent: i, searchComponent: n },
1085
1202
  children: t
1086
1203
  }
1087
1204
  );
1088
- }, Me = () => {
1089
- const e = Fe(Zt);
1205
+ }, Be = () => {
1206
+ const e = Ve(es);
1090
1207
  if (e === void 0 || Object.keys(e).length === 0)
1091
1208
  throw new Error(
1092
1209
  "Config provider has not been set. This step is required and cannot be skipped."
1093
1210
  );
1094
1211
  return e;
1095
- }, es = Te({}), _n = (e) => {
1096
- const { children: t } = e, [s, r] = Y({}), n = $(
1097
- (l, m) => r((g) => ({
1098
- ...g,
1099
- [l]: [...g[l] ?? [], m]
1212
+ }, cr = {
1213
+ addChildItem: () => {
1214
+ },
1215
+ removeChildItem: () => {
1216
+ },
1217
+ clearDynamicItems: () => {
1218
+ },
1219
+ dynamicItems: {}
1220
+ }, ts = De(
1221
+ cr
1222
+ ), En = (e) => {
1223
+ const { children: t } = e, [s, r] = X({}), i = D(
1224
+ (l, m) => r((f) => ({
1225
+ ...f,
1226
+ [l]: [...f[l] ?? [], m]
1100
1227
  })),
1101
1228
  []
1102
- ), i = $(
1103
- (l, m) => r((g) => ({
1104
- ...g,
1105
- [l]: (g[l] ?? []).filter((h, d) => d !== m)
1229
+ ), n = D(
1230
+ (l, m) => r((f) => ({
1231
+ ...f,
1232
+ [l]: (f[l] ?? []).filter((h, d) => d !== m)
1106
1233
  })),
1107
1234
  []
1108
- ), a = $((l) => {
1235
+ ), a = D((l) => {
1109
1236
  r(l ? (m) => ({
1110
1237
  ...m,
1111
1238
  [l]: []
1112
1239
  }) : {});
1113
- }, []), c = ke(
1240
+ }, []), o = xe(
1114
1241
  () => ({
1115
1242
  dynamicItems: s,
1116
- addChildItem: n,
1117
- removeChildItem: i,
1243
+ addChildItem: i,
1244
+ removeChildItem: n,
1118
1245
  clearDynamicItems: a
1119
1246
  }),
1120
- [s, a, i, n]
1247
+ [s, a, n, i]
1121
1248
  );
1122
- return /* @__PURE__ */ b(es.Provider, { value: c, children: t });
1123
- }, or = () => Fe(
1124
- es
1125
- );
1126
- function Cn(e) {
1127
- const { t } = V(), { open: s, onClose: r, menuMap: n, logo: i } = e, { account: a } = Xt(), { dynamicItems: c } = or(), { linkComponent: l, location: m } = Me(), g = l, h = ke(() => n.filter((k) => {
1128
- const q = k.auth, N = !!(a != null && a.email);
1129
- return q == null || q && N || !q && !N;
1130
- }), [a == null ? void 0 : a.email, n]), d = $(
1131
- (k) => {
1132
- k.key === "Escape" && s && r();
1249
+ return /* @__PURE__ */ g(
1250
+ ts.Provider,
1251
+ {
1252
+ value: o,
1253
+ children: t
1254
+ }
1255
+ );
1256
+ }, lr = () => Ve(ts);
1257
+ function _n(e) {
1258
+ const { t } = R(), { open: s, onClose: r, menuMap: i, logo: n } = e, { account: a } = Zt(), { dynamicItems: o } = lr(), { linkComponent: l, location: m } = Be(), f = l, h = xe(() => i.filter((E) => {
1259
+ const N = E.auth, C = !!(a != null && a.email);
1260
+ return N == null || N && C || !N && !C;
1261
+ }), [a == null ? void 0 : a.email, i]), d = D(
1262
+ (E) => {
1263
+ E.key === "Escape" && s && r();
1133
1264
  },
1134
1265
  [r, s]
1135
1266
  );
1136
1267
  me(() => (document.addEventListener("keydown", d), () => {
1137
1268
  document.removeEventListener("keydown", d);
1138
1269
  }), [d]);
1139
- const y = $(
1140
- (k, q) => q ? k === `${m.pathname}${m.search}` : k === m.pathname,
1270
+ const p = D(
1271
+ (E, N) => N ? E === `${m.pathname}${m.search}` : E === m.pathname,
1141
1272
  [m.pathname, m.search]
1142
- ), v = $(
1143
- (k) => /* @__PURE__ */ b(
1273
+ ), b = D(
1274
+ (E) => /* @__PURE__ */ g(
1144
1275
  "li",
1145
1276
  {
1146
- className: `drawer-list-item-child ${y(k.path, !0) ? "active" : ""} animated`,
1147
- children: k.path ? /* @__PURE__ */ b(
1148
- g,
1277
+ className: `drawer-list-item-child ${p(E.path, !0) ? "active" : ""} animated`,
1278
+ children: E.path ? /* @__PURE__ */ g(
1279
+ f,
1149
1280
  {
1150
1281
  tabIndex: s ? 0 : -1,
1151
- to: k.path ?? "/",
1152
- "aria-label": t(`_accessibility:ariaLabels.${k.id}`, {
1153
- defaultValue: k.label
1282
+ to: E.path ?? "/",
1283
+ "aria-label": t(`_accessibility:ariaLabels.${E.id}`, {
1284
+ defaultValue: E.label
1154
1285
  }),
1155
1286
  className: "drawer-link",
1156
- children: k.label
1287
+ children: E.label
1157
1288
  }
1158
- ) : k.label
1289
+ ) : E.label
1159
1290
  },
1160
- k.id
1291
+ E.id
1161
1292
  ),
1162
- [g, s, t, y]
1163
- ), C = ke(() => h.map((k, q) => {
1164
- const N = k.page ?? String(q), L = `drawer-list-item ${y(k.path) ? "active" : ""} animated`;
1165
- if (k.type === "divider")
1166
- return /* @__PURE__ */ b("li", { className: L, children: /* @__PURE__ */ b("hr", { className: "drawer-divider" }) }, N);
1167
- const x = k.children ?? (k.page && c ? c[k.page] : null);
1168
- return /* @__PURE__ */ T("li", { className: L, children: [
1169
- /* @__PURE__ */ T(
1170
- g,
1293
+ [f, s, t, p]
1294
+ ), S = xe(() => h.map((E, N) => {
1295
+ const C = E.page ?? String(N), F = `drawer-list-item ${p(E.path) ? "active" : ""} animated`;
1296
+ if (E.type === "divider")
1297
+ return /* @__PURE__ */ g("li", { className: F, children: /* @__PURE__ */ g("hr", { className: "drawer-divider" }) }, C);
1298
+ const x = E.children ?? (E.page && o ? o[E.page] : null);
1299
+ return /* @__PURE__ */ $("li", { className: F, children: [
1300
+ /* @__PURE__ */ $(
1301
+ f,
1171
1302
  {
1172
1303
  tabIndex: s ? 0 : -1,
1173
- to: k.path ?? "/",
1174
- "aria-label": t(`_accessibility:ariaLabels.${String(k.page)}`, {
1175
- defaultValue: t(`_pages:${String(k.page)}.title`)
1304
+ to: E.path ?? "/",
1305
+ "aria-label": t(`_accessibility:ariaLabels.${String(E.page)}`, {
1306
+ defaultValue: t(`_pages:${String(E.page)}.title`)
1176
1307
  }),
1177
1308
  className: "drawer-link",
1178
1309
  children: [
1179
- k.icon,
1180
- t(`_pages:${k.page}.title`)
1310
+ E.icon,
1311
+ t(`_pages:${E.page}.title`)
1181
1312
  ]
1182
1313
  }
1183
1314
  ),
1184
- x && /* @__PURE__ */ b("ul", { className: "drawer-children-list", children: x.map(v) })
1185
- ] }, N);
1186
- }), [g, c, y, s, h, v, t]);
1187
- return /* @__PURE__ */ b(
1315
+ x && /* @__PURE__ */ g("ul", { className: "drawer-children-list", children: x.map(b) })
1316
+ ] }, C);
1317
+ }), [f, o, p, s, h, b, t]);
1318
+ return /* @__PURE__ */ g(
1188
1319
  "div",
1189
1320
  {
1190
1321
  "aria-label": t("_accessibility:ariaLabels.closeMenu"),
1191
1322
  "aria-disabled": !s,
1192
1323
  className: `${s ? "opened" : "closed"} drawer-backdrop`,
1193
1324
  onClick: () => r(),
1194
- children: /* @__PURE__ */ T("aside", { className: `${s ? "opened" : "closed"} drawer animated`, children: [
1195
- /* @__PURE__ */ T("div", { className: "drawer-header-container", children: [
1196
- i,
1197
- /* @__PURE__ */ b("h2", { className: "drawer-header poppins", children: t("_pages:home.appName") })
1325
+ children: /* @__PURE__ */ $("aside", { className: `${s ? "opened" : "closed"} drawer animated`, children: [
1326
+ /* @__PURE__ */ $("div", { className: "drawer-header-container", children: [
1327
+ n,
1328
+ /* @__PURE__ */ g("h2", { className: "drawer-header poppins", children: t("_pages:home.appName") })
1198
1329
  ] }),
1199
- /* @__PURE__ */ b("ul", { className: "drawer-menu-list", children: C })
1330
+ /* @__PURE__ */ g("ul", { className: "drawer-menu-list", children: S })
1200
1331
  ] })
1201
1332
  }
1202
1333
  );
1203
1334
  }
1204
- function En(e) {
1205
- const { error: t, resetErrorBoundary: s } = e, { t: r } = V();
1206
- return /* @__PURE__ */ T("div", { className: "error-container", children: [
1207
- /* @__PURE__ */ b(le, { icon: Xs, className: "error-icon" }),
1208
- /* @__PURE__ */ b("p", { className: "error-message", children: (t == null ? void 0 : t.message) ?? r("_accessibility:errors.unknownError") }),
1209
- s && /* @__PURE__ */ b("button", { className: "error-retry", onClick: s, children: r("_accessibility:actions.retry", { defaultValue: "Retry" }) })
1210
- ] });
1335
+ const Te = ({ icon: e, ...t }) => /* @__PURE__ */ g(Fs, { icon: /* @__PURE__ */ g(ue, { icon: e }), ...t });
1336
+ var ot, At;
1337
+ function ur() {
1338
+ if (At) return ot;
1339
+ At = 1;
1340
+ const e = (o, l = "local", m = void 0) => {
1341
+ if (l === "local") {
1342
+ if (localStorage.getItem(o) !== void 0 && localStorage.getItem(o) !== "undefined" && localStorage.getItem(o) !== null)
1343
+ return m === void 0 || m !== void 0 && localStorage.getItem(o) === m;
1344
+ } else if (l === "session" && sessionStorage.getItem(o) !== void 0 && sessionStorage.getItem(o) !== "undefined" && sessionStorage.getItem(o) !== null)
1345
+ return m === void 0 || m !== void 0 && sessionStorage.getItem(o) === m;
1346
+ return !1;
1347
+ }, t = (o) => {
1348
+ const l = {};
1349
+ return o.substring(1).split("&").forEach((f) => {
1350
+ const [h, d] = f.split("=");
1351
+ l[h] = d;
1352
+ }), l;
1353
+ }, s = (o = "") => {
1354
+ if (n(o) && o.length) return n(o);
1355
+ {
1356
+ let l = navigator.language || navigator.userLanguage;
1357
+ if (l.indexOf("en") < 0 && l.indexOf("es") < 0 && (l = "en-US"), l = l.split("-")[0], l)
1358
+ return o.length && i(o, 730, l), l;
1359
+ }
1360
+ return "en";
1361
+ }, r = (o = 0, l = 0, m = window, f = "smooth") => m.scroll({
1362
+ top: o,
1363
+ left: l,
1364
+ behavior: f
1365
+ }), i = (o, l, m, f = "/", h = "Lax") => {
1366
+ var d = /* @__PURE__ */ new Date();
1367
+ d.setTime(d.getTime() + l * 24 * 60 * 60 * 1e3);
1368
+ const p = "; expires=" + d.toUTCString();
1369
+ document.cookie = `${o}=${m || ""}${p};path=${f};SameSite=${h}`;
1370
+ }, n = (o) => {
1371
+ const l = `${o}=`, f = decodeURIComponent(document.cookie).split(";");
1372
+ for (let h = 0; h < f.length; h += 1) {
1373
+ let d = f[h];
1374
+ for (; d.charAt(0) === " "; )
1375
+ d = d.substring(1);
1376
+ if (d.indexOf(l) === 0)
1377
+ return d.substring(l.length, d.length);
1378
+ }
1379
+ return "";
1380
+ };
1381
+ return ot = {
1382
+ getCookie: n,
1383
+ createCookie: i,
1384
+ deleteCookie: (o) => document.cookie = `${o}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,
1385
+ getUserLanguage: s,
1386
+ scrollTo: r,
1387
+ parseQueries: t,
1388
+ validation: e
1389
+ }, ot;
1211
1390
  }
1212
- function kn() {
1213
- const { t: e, language: t } = V();
1214
- return { timeAge: $(
1391
+ var dr = ur();
1392
+ function Cn() {
1393
+ const { t: e, language: t } = R();
1394
+ return { timeAge: D(
1215
1395
  (r) => {
1216
- const i = /* @__PURE__ */ new Date() - r, a = Math.floor(i / (1e3 * 60)), c = Math.floor(a / 60), l = t === "es", m = e("_accessibility:labels.ago"), g = e("_accessibility:labels.minute"), h = e("_accessibility:labels.minutes"), d = e("_accessibility:labels.hour"), y = e("_accessibility:labels.hours"), v = e("_accessibility:labels.yesterday"), C = e("_accessibility:labels.justNow");
1217
- return i < 1e3 * 60 ? C : a < 60 ? `${l ? m : ""} ${a} ${a === 1 ? g : h} ${l ? "" : m}` : c < 24 ? `${l ? m : ""} ${c} ${c === 1 ? d : y} ${l ? "" : m}` : c < 48 ? v : r.toLocaleDateString(navigator.language || "es-ES", {
1396
+ const n = /* @__PURE__ */ new Date() - r, a = Math.floor(n / (1e3 * 60)), o = Math.floor(a / 60), l = t === "es", m = e("_accessibility:labels.ago"), f = e("_accessibility:labels.minute"), h = e("_accessibility:labels.minutes"), d = e("_accessibility:labels.hour"), p = e("_accessibility:labels.hours"), b = e("_accessibility:labels.yesterday"), S = e("_accessibility:labels.justNow");
1397
+ return n < 1e3 * 60 ? S : a < 60 ? `${l ? m : ""} ${a} ${a === 1 ? f : h} ${l ? "" : m}` : o < 24 ? `${l ? m : ""} ${o} ${o === 1 ? d : p} ${l ? "" : m}` : o < 48 ? b : r.toLocaleDateString(navigator.language || "es-ES", {
1218
1398
  day: "2-digit",
1219
1399
  month: "2-digit",
1220
1400
  year: "numeric"
@@ -1223,77 +1403,77 @@ function kn() {
1223
1403
  [e, t]
1224
1404
  ) };
1225
1405
  }
1226
- const ts = (e) => {
1227
- const { showSuccessNotification: t } = Ne(), { mutationFn: s, onError: r, onSuccess: n, onSuccessMessage: i } = e, [a, c] = Y([]), { open: l, handleClose: m, handleOpen: g } = us(), h = () => {
1228
- m(), c([]);
1229
- }, d = async (v) => {
1230
- c(v), g();
1231
- }, y = Re({
1406
+ const ss = (e) => {
1407
+ const { showSuccessNotification: t } = Ae(), { mutationFn: s, onError: r, onSuccess: i, onSuccessMessage: n } = e, [a, o] = X([]), { open: l, handleClose: m, handleOpen: f } = ds(), h = () => {
1408
+ m(), o([]);
1409
+ }, d = async (b) => {
1410
+ o(b), f();
1411
+ }, p = Ke({
1232
1412
  mutationFn: () => s(
1233
1413
  Array.isArray(a) ? a : [a]
1234
1414
  ),
1235
- onError: (v) => {
1236
- console.error(v), r && r(v), h();
1415
+ onError: (b) => {
1416
+ console.error(b), r && r(b), h();
1237
1417
  },
1238
- onSuccess: async (v) => {
1239
- n && n(v), t({
1240
- message: i
1418
+ onSuccess: async (b) => {
1419
+ i && i(b), t({
1420
+ message: n
1241
1421
  }), h();
1242
1422
  }
1243
1423
  });
1244
- return { open: l, onClick: d, close: h, dialogFn: y, isLoading: y.isPending };
1424
+ return { open: l, onClick: d, close: h, dialogFn: p, isLoading: p.isPending };
1245
1425
  };
1246
- var Ue = (e) => e.type === "checkbox", Ee = (e) => e instanceof Date, Z = (e) => e == null;
1247
- const ss = (e) => typeof e == "object";
1248
- var j = (e) => !Z(e) && !Array.isArray(e) && ss(e) && !Ee(e), cr = (e) => j(e) && e.target ? Ue(e.target) ? e.target.checked : e.target.value : e, lr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ur = (e, t) => e.has(lr(t)), dr = (e) => {
1426
+ var qe = (e) => e.type === "checkbox", Ne = (e) => e instanceof Date, te = (e) => e == null;
1427
+ const rs = (e) => typeof e == "object";
1428
+ var H = (e) => !te(e) && !Array.isArray(e) && rs(e) && !Ne(e), fr = (e) => H(e) && e.target ? qe(e.target) ? e.target.checked : e.target.value : e, hr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, mr = (e, t) => e.has(hr(t)), yr = (e) => {
1249
1429
  const t = e.constructor && e.constructor.prototype;
1250
- return j(t) && t.hasOwnProperty("isPrototypeOf");
1251
- }, ct = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
1252
- function G(e) {
1430
+ return H(t) && t.hasOwnProperty("isPrototypeOf");
1431
+ }, ht = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
1432
+ function z(e) {
1253
1433
  let t;
1254
1434
  const s = Array.isArray(e), r = typeof FileList < "u" ? e instanceof FileList : !1;
1255
1435
  if (e instanceof Date)
1256
1436
  t = new Date(e);
1257
- else if (!(ct && (e instanceof Blob || r)) && (s || j(e)))
1258
- if (t = s ? [] : {}, !s && !dr(e))
1437
+ else if (!(ht && (e instanceof Blob || r)) && (s || H(e)))
1438
+ if (t = s ? [] : {}, !s && !yr(e))
1259
1439
  t = e;
1260
1440
  else
1261
- for (const n in e)
1262
- e.hasOwnProperty(n) && (t[n] = G(e[n]));
1441
+ for (const i in e)
1442
+ e.hasOwnProperty(i) && (t[i] = z(e[i]));
1263
1443
  else
1264
1444
  return e;
1265
1445
  return t;
1266
1446
  }
1267
- var Je = (e) => /^\w*$/.test(e), Q = (e) => e === void 0, lt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], ut = (e) => lt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), _ = (e, t, s) => {
1268
- if (!t || !j(e))
1447
+ var et = (e) => /^\w*$/.test(e), Q = (e) => e === void 0, mt = (e) => Array.isArray(e) ? e.filter(Boolean) : [], yt = (e) => mt(e.replace(/["|']|\]/g, "").split(/\.|\[/)), T = (e, t, s) => {
1448
+ if (!t || !H(e))
1269
1449
  return s;
1270
- const r = (Je(t) ? [t] : ut(t)).reduce((n, i) => Z(n) ? n : n[i], e);
1450
+ const r = (et(t) ? [t] : yt(t)).reduce((i, n) => te(i) ? i : i[n], e);
1271
1451
  return Q(r) || r === e ? Q(e[t]) ? s : e[t] : r;
1272
- }, he = (e) => typeof e == "boolean", B = (e, t, s) => {
1452
+ }, ye = (e) => typeof e == "boolean", B = (e, t, s) => {
1273
1453
  let r = -1;
1274
- const n = Je(t) ? [t] : ut(t), i = n.length, a = i - 1;
1275
- for (; ++r < i; ) {
1276
- const c = n[r];
1454
+ const i = et(t) ? [t] : yt(t), n = i.length, a = n - 1;
1455
+ for (; ++r < n; ) {
1456
+ const o = i[r];
1277
1457
  let l = s;
1278
1458
  if (r !== a) {
1279
- const m = e[c];
1280
- l = j(m) || Array.isArray(m) ? m : isNaN(+n[r + 1]) ? {} : [];
1459
+ const m = e[o];
1460
+ l = H(m) || Array.isArray(m) ? m : isNaN(+i[r + 1]) ? {} : [];
1281
1461
  }
1282
- if (c === "__proto__" || c === "constructor" || c === "prototype")
1462
+ if (o === "__proto__" || o === "constructor" || o === "prototype")
1283
1463
  return;
1284
- e[c] = l, e = e[c];
1464
+ e[o] = l, e = e[o];
1285
1465
  }
1286
1466
  };
1287
- const Nt = {
1467
+ const Ft = {
1288
1468
  BLUR: "blur",
1289
1469
  FOCUS_OUT: "focusout"
1290
- }, de = {
1470
+ }, fe = {
1291
1471
  onBlur: "onBlur",
1292
1472
  onChange: "onChange",
1293
1473
  onSubmit: "onSubmit",
1294
1474
  onTouched: "onTouched",
1295
1475
  all: "all"
1296
- }, ye = {
1476
+ }, be = {
1297
1477
  max: "max",
1298
1478
  min: "min",
1299
1479
  maxLength: "maxLength",
@@ -1301,120 +1481,120 @@ const Nt = {
1301
1481
  pattern: "pattern",
1302
1482
  required: "required",
1303
1483
  validate: "validate"
1304
- }, fr = ae.createContext(null);
1305
- fr.displayName = "HookFormContext";
1306
- var mr = (e, t, s, r = !0) => {
1307
- const n = {
1484
+ }, gr = ae.createContext(null);
1485
+ gr.displayName = "HookFormContext";
1486
+ var pr = (e, t, s, r = !0) => {
1487
+ const i = {
1308
1488
  defaultValues: t._defaultValues
1309
1489
  };
1310
- for (const i in e)
1311
- Object.defineProperty(n, i, {
1490
+ for (const n in e)
1491
+ Object.defineProperty(i, n, {
1312
1492
  get: () => {
1313
- const a = i;
1314
- return t._proxyFormState[a] !== de.all && (t._proxyFormState[a] = !r || de.all), e[a];
1493
+ const a = n;
1494
+ return t._proxyFormState[a] !== fe.all && (t._proxyFormState[a] = !r || fe.all), e[a];
1315
1495
  }
1316
1496
  });
1317
- return n;
1497
+ return i;
1318
1498
  };
1319
- const hr = typeof window < "u" ? ae.useLayoutEffect : ae.useEffect;
1320
- var ge = (e) => typeof e == "string", gr = (e, t, s, r, n) => ge(e) ? (r && t.watch.add(e), _(s, e, n)) : Array.isArray(e) ? e.map((i) => (r && t.watch.add(i), _(s, i))) : (r && (t.watchAll = !0), s), it = (e) => Z(e) || !ss(e);
1321
- function we(e, t, s = /* @__PURE__ */ new WeakSet()) {
1322
- if (it(e) || it(t))
1499
+ const br = typeof window < "u" ? ae.useLayoutEffect : ae.useEffect;
1500
+ var pe = (e) => typeof e == "string", wr = (e, t, s, r, i) => pe(e) ? (r && t.watch.add(e), T(s, e, i)) : Array.isArray(e) ? e.map((n) => (r && t.watch.add(n), T(s, n))) : (r && (t.watchAll = !0), s), ut = (e) => te(e) || !rs(e);
1501
+ function Se(e, t, s = /* @__PURE__ */ new WeakSet()) {
1502
+ if (ut(e) || ut(t))
1323
1503
  return e === t;
1324
- if (Ee(e) && Ee(t))
1504
+ if (Ne(e) && Ne(t))
1325
1505
  return e.getTime() === t.getTime();
1326
- const r = Object.keys(e), n = Object.keys(t);
1327
- if (r.length !== n.length)
1506
+ const r = Object.keys(e), i = Object.keys(t);
1507
+ if (r.length !== i.length)
1328
1508
  return !1;
1329
1509
  if (s.has(e) || s.has(t))
1330
1510
  return !0;
1331
1511
  s.add(e), s.add(t);
1332
- for (const i of r) {
1333
- const a = e[i];
1334
- if (!n.includes(i))
1512
+ for (const n of r) {
1513
+ const a = e[n];
1514
+ if (!i.includes(n))
1335
1515
  return !1;
1336
- if (i !== "ref") {
1337
- const c = t[i];
1338
- if (Ee(a) && Ee(c) || j(a) && j(c) || Array.isArray(a) && Array.isArray(c) ? !we(a, c, s) : a !== c)
1516
+ if (n !== "ref") {
1517
+ const o = t[n];
1518
+ if (Ne(a) && Ne(o) || H(a) && H(o) || Array.isArray(a) && Array.isArray(o) ? !Se(a, o, s) : a !== o)
1339
1519
  return !1;
1340
1520
  }
1341
1521
  }
1342
1522
  return !0;
1343
1523
  }
1344
- var yr = (e, t, s, r, n) => t ? {
1524
+ var vr = (e, t, s, r, i) => t ? {
1345
1525
  ...s[e],
1346
1526
  types: {
1347
1527
  ...s[e] && s[e].types ? s[e].types : {},
1348
- [r]: n || !0
1528
+ [r]: i || !0
1349
1529
  }
1350
- } : {}, Ve = (e) => Array.isArray(e) ? e : [e], At = () => {
1530
+ } : {}, Pe = (e) => Array.isArray(e) ? e : [e], $t = () => {
1351
1531
  let e = [];
1352
1532
  return {
1353
1533
  get observers() {
1354
1534
  return e;
1355
1535
  },
1356
- next: (n) => {
1357
- for (const i of e)
1358
- i.next && i.next(n);
1536
+ next: (i) => {
1537
+ for (const n of e)
1538
+ n.next && n.next(i);
1359
1539
  },
1360
- subscribe: (n) => (e.push(n), {
1540
+ subscribe: (i) => (e.push(i), {
1361
1541
  unsubscribe: () => {
1362
- e = e.filter((i) => i !== n);
1542
+ e = e.filter((n) => n !== i);
1363
1543
  }
1364
1544
  }),
1365
1545
  unsubscribe: () => {
1366
1546
  e = [];
1367
1547
  }
1368
1548
  };
1369
- }, te = (e) => j(e) && !Object.keys(e).length, dt = (e) => e.type === "file", fe = (e) => typeof e == "function", Ke = (e) => {
1370
- if (!ct)
1549
+ }, se = (e) => H(e) && !Object.keys(e).length, gt = (e) => e.type === "file", he = (e) => typeof e == "function", ze = (e) => {
1550
+ if (!ht)
1371
1551
  return !1;
1372
1552
  const t = e ? e.ownerDocument : 0;
1373
1553
  return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
1374
- }, rs = (e) => e.type === "select-multiple", ft = (e) => e.type === "radio", br = (e) => ft(e) || Ue(e), st = (e) => Ke(e) && e.isConnected;
1375
- function pr(e, t) {
1554
+ }, ns = (e) => e.type === "select-multiple", pt = (e) => e.type === "radio", kr = (e) => pt(e) || qe(e), ct = (e) => ze(e) && e.isConnected;
1555
+ function Sr(e, t) {
1376
1556
  const s = t.slice(0, -1).length;
1377
1557
  let r = 0;
1378
1558
  for (; r < s; )
1379
1559
  e = Q(e) ? r++ : e[t[r++]];
1380
1560
  return e;
1381
1561
  }
1382
- function wr(e) {
1562
+ function Tr(e) {
1383
1563
  for (const t in e)
1384
1564
  if (e.hasOwnProperty(t) && !Q(e[t]))
1385
1565
  return !1;
1386
1566
  return !0;
1387
1567
  }
1388
- function K(e, t) {
1389
- const s = Array.isArray(t) ? t : Je(t) ? [t] : ut(t), r = s.length === 1 ? e : pr(e, s), n = s.length - 1, i = s[n];
1390
- return r && delete r[i], n !== 0 && (j(r) && te(r) || Array.isArray(r) && wr(r)) && K(e, s.slice(0, -1)), e;
1568
+ function j(e, t) {
1569
+ const s = Array.isArray(t) ? t : et(t) ? [t] : yt(t), r = s.length === 1 ? e : Sr(e, s), i = s.length - 1, n = s[i];
1570
+ return r && delete r[n], i !== 0 && (H(r) && se(r) || Array.isArray(r) && Tr(r)) && j(e, s.slice(0, -1)), e;
1391
1571
  }
1392
- var ns = (e) => {
1572
+ var is = (e) => {
1393
1573
  for (const t in e)
1394
- if (fe(e[t]))
1574
+ if (he(e[t]))
1395
1575
  return !0;
1396
1576
  return !1;
1397
1577
  };
1398
- function Qe(e, t = {}) {
1578
+ function Je(e, t = {}) {
1399
1579
  const s = Array.isArray(e);
1400
- if (j(e) || s)
1580
+ if (H(e) || s)
1401
1581
  for (const r in e)
1402
- Array.isArray(e[r]) || j(e[r]) && !ns(e[r]) ? (t[r] = Array.isArray(e[r]) ? [] : {}, Qe(e[r], t[r])) : Z(e[r]) || (t[r] = !0);
1582
+ Array.isArray(e[r]) || H(e[r]) && !is(e[r]) ? (t[r] = Array.isArray(e[r]) ? [] : {}, Je(e[r], t[r])) : te(e[r]) || (t[r] = !0);
1403
1583
  return t;
1404
1584
  }
1405
- function is(e, t, s) {
1585
+ function as(e, t, s) {
1406
1586
  const r = Array.isArray(e);
1407
- if (j(e) || r)
1408
- for (const n in e)
1409
- Array.isArray(e[n]) || j(e[n]) && !ns(e[n]) ? Q(t) || it(s[n]) ? s[n] = Array.isArray(e[n]) ? Qe(e[n], []) : { ...Qe(e[n]) } : is(e[n], Z(t) ? {} : t[n], s[n]) : s[n] = !we(e[n], t[n]);
1587
+ if (H(e) || r)
1588
+ for (const i in e)
1589
+ Array.isArray(e[i]) || H(e[i]) && !is(e[i]) ? Q(t) || ut(s[i]) ? s[i] = Array.isArray(e[i]) ? Je(e[i], []) : { ...Je(e[i]) } : as(e[i], te(t) ? {} : t[i], s[i]) : s[i] = !Se(e[i], t[i]);
1410
1590
  return s;
1411
1591
  }
1412
- var Le = (e, t) => is(e, t, Qe(t));
1413
- const xt = {
1592
+ var Re = (e, t) => as(e, t, Je(t));
1593
+ const Lt = {
1414
1594
  value: !1,
1415
1595
  isValid: !1
1416
- }, Tt = { value: !0, isValid: !0 };
1417
- var as = (e) => {
1596
+ }, Dt = { value: !0, isValid: !0 };
1597
+ var os = (e) => {
1418
1598
  if (Array.isArray(e)) {
1419
1599
  if (e.length > 1) {
1420
1600
  const t = e.filter((s) => s && s.checked && !s.disabled).map((s) => s.value);
@@ -1422,203 +1602,203 @@ var as = (e) => {
1422
1602
  }
1423
1603
  return e[0].checked && !e[0].disabled ? (
1424
1604
  // @ts-expect-error expected to work in the browser
1425
- e[0].attributes && !Q(e[0].attributes.value) ? Q(e[0].value) || e[0].value === "" ? Tt : { value: e[0].value, isValid: !0 } : Tt
1426
- ) : xt;
1605
+ e[0].attributes && !Q(e[0].attributes.value) ? Q(e[0].value) || e[0].value === "" ? Dt : { value: e[0].value, isValid: !0 } : Dt
1606
+ ) : Lt;
1427
1607
  }
1428
- return xt;
1429
- }, os = (e, { valueAsNumber: t, valueAsDate: s, setValueAs: r }) => Q(e) ? e : t ? e === "" ? NaN : e && +e : s && ge(e) ? new Date(e) : r ? r(e) : e;
1430
- const Ft = {
1608
+ return Lt;
1609
+ }, cs = (e, { valueAsNumber: t, valueAsDate: s, setValueAs: r }) => Q(e) ? e : t ? e === "" ? NaN : e && +e : s && pe(e) ? new Date(e) : r ? r(e) : e;
1610
+ const Vt = {
1431
1611
  isValid: !1,
1432
1612
  value: null
1433
1613
  };
1434
- var cs = (e) => Array.isArray(e) ? e.reduce((t, s) => s && s.checked && !s.disabled ? {
1614
+ var ls = (e) => Array.isArray(e) ? e.reduce((t, s) => s && s.checked && !s.disabled ? {
1435
1615
  isValid: !0,
1436
1616
  value: s.value
1437
- } : t, Ft) : Ft;
1438
- function $t(e) {
1617
+ } : t, Vt) : Vt;
1618
+ function Rt(e) {
1439
1619
  const t = e.ref;
1440
- return dt(t) ? t.files : ft(t) ? cs(e.refs).value : rs(t) ? [...t.selectedOptions].map(({ value: s }) => s) : Ue(t) ? as(e.refs).value : os(Q(t.value) ? e.ref.value : t.value, e);
1620
+ return gt(t) ? t.files : pt(t) ? ls(e.refs).value : ns(t) ? [...t.selectedOptions].map(({ value: s }) => s) : qe(t) ? os(e.refs).value : cs(Q(t.value) ? e.ref.value : t.value, e);
1441
1621
  }
1442
- var vr = (e, t, s, r) => {
1443
- const n = {};
1444
- for (const i of e) {
1445
- const a = _(t, i);
1446
- a && B(n, i, a._f);
1622
+ var Er = (e, t, s, r) => {
1623
+ const i = {};
1624
+ for (const n of e) {
1625
+ const a = T(t, n);
1626
+ a && B(i, n, a._f);
1447
1627
  }
1448
1628
  return {
1449
1629
  criteriaMode: s,
1450
1630
  names: [...e],
1451
- fields: n,
1631
+ fields: i,
1452
1632
  shouldUseNativeValidation: r
1453
1633
  };
1454
- }, We = (e) => e instanceof RegExp, De = (e) => Q(e) ? e : We(e) ? e.source : j(e) ? We(e.value) ? e.value.source : e.value : e, Lt = (e) => ({
1455
- isOnSubmit: !e || e === de.onSubmit,
1456
- isOnBlur: e === de.onBlur,
1457
- isOnChange: e === de.onChange,
1458
- isOnAll: e === de.all,
1459
- isOnTouch: e === de.onTouched
1634
+ }, Ye = (e) => e instanceof RegExp, Ie = (e) => Q(e) ? e : Ye(e) ? e.source : H(e) ? Ye(e.value) ? e.value.source : e.value : e, It = (e) => ({
1635
+ isOnSubmit: !e || e === fe.onSubmit,
1636
+ isOnBlur: e === fe.onBlur,
1637
+ isOnChange: e === fe.onChange,
1638
+ isOnAll: e === fe.all,
1639
+ isOnTouch: e === fe.onTouched
1460
1640
  });
1461
- const Dt = "AsyncFunction";
1462
- var Sr = (e) => !!e && !!e.validate && !!(fe(e.validate) && e.validate.constructor.name === Dt || j(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === Dt)), _r = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Vt = (e, t, s) => !s && (t.watchAll || t.watch.has(e) || [...t.watch].some((r) => e.startsWith(r) && /^\.\w+/.test(e.slice(r.length))));
1463
- const Ie = (e, t, s, r) => {
1464
- for (const n of s || Object.keys(e)) {
1465
- const i = _(e, n);
1466
- if (i) {
1467
- const { _f: a, ...c } = i;
1641
+ const Pt = "AsyncFunction";
1642
+ var _r = (e) => !!e && !!e.validate && !!(he(e.validate) && e.validate.constructor.name === Pt || H(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === Pt)), Cr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Mt = (e, t, s) => !s && (t.watchAll || t.watch.has(e) || [...t.watch].some((r) => e.startsWith(r) && /^\.\w+/.test(e.slice(r.length))));
1643
+ const Me = (e, t, s, r) => {
1644
+ for (const i of s || Object.keys(e)) {
1645
+ const n = T(e, i);
1646
+ if (n) {
1647
+ const { _f: a, ...o } = n;
1468
1648
  if (a) {
1469
- if (a.refs && a.refs[0] && t(a.refs[0], n) && !r)
1649
+ if (a.refs && a.refs[0] && t(a.refs[0], i) && !r)
1470
1650
  return !0;
1471
1651
  if (a.ref && t(a.ref, a.name) && !r)
1472
1652
  return !0;
1473
- if (Ie(c, t))
1653
+ if (Me(o, t))
1474
1654
  break;
1475
- } else if (j(c) && Ie(c, t))
1655
+ } else if (H(o) && Me(o, t))
1476
1656
  break;
1477
1657
  }
1478
1658
  }
1479
1659
  };
1480
- function It(e, t, s) {
1481
- const r = _(e, s);
1482
- if (r || Je(s))
1660
+ function Ot(e, t, s) {
1661
+ const r = T(e, s);
1662
+ if (r || et(s))
1483
1663
  return {
1484
1664
  error: r,
1485
1665
  name: s
1486
1666
  };
1487
- const n = s.split(".");
1488
- for (; n.length; ) {
1489
- const i = n.join("."), a = _(t, i), c = _(e, i);
1490
- if (a && !Array.isArray(a) && s !== i)
1667
+ const i = s.split(".");
1668
+ for (; i.length; ) {
1669
+ const n = i.join("."), a = T(t, n), o = T(e, n);
1670
+ if (a && !Array.isArray(a) && s !== n)
1491
1671
  return { name: s };
1492
- if (c && c.type)
1672
+ if (o && o.type)
1493
1673
  return {
1494
- name: i,
1495
- error: c
1674
+ name: n,
1675
+ error: o
1496
1676
  };
1497
- if (c && c.root && c.root.type)
1677
+ if (o && o.root && o.root.type)
1498
1678
  return {
1499
- name: `${i}.root`,
1500
- error: c.root
1679
+ name: `${n}.root`,
1680
+ error: o.root
1501
1681
  };
1502
- n.pop();
1682
+ i.pop();
1503
1683
  }
1504
1684
  return {
1505
1685
  name: s
1506
1686
  };
1507
1687
  }
1508
- var Cr = (e, t, s, r) => {
1688
+ var Nr = (e, t, s, r) => {
1509
1689
  s(e);
1510
- const { name: n, ...i } = e;
1511
- return te(i) || Object.keys(i).length >= Object.keys(t).length || Object.keys(i).find((a) => t[a] === (!r || de.all));
1512
- }, Er = (e, t, s) => !e || !t || e === t || Ve(e).some((r) => r && (s ? r === t : r.startsWith(t) || t.startsWith(r))), kr = (e, t, s, r, n) => n.isOnAll ? !1 : !s && n.isOnTouch ? !(t || e) : (s ? r.isOnBlur : n.isOnBlur) ? !e : (s ? r.isOnChange : n.isOnChange) ? e : !0, Nr = (e, t) => !lt(_(e, t)).length && K(e, t), Ar = (e, t, s) => {
1513
- const r = Ve(_(e, s));
1690
+ const { name: i, ...n } = e;
1691
+ return se(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((a) => t[a] === (!r || fe.all));
1692
+ }, xr = (e, t, s) => !e || !t || e === t || Pe(e).some((r) => r && (s ? r === t : r.startsWith(t) || t.startsWith(r))), Ar = (e, t, s, r, i) => i.isOnAll ? !1 : !s && i.isOnTouch ? !(t || e) : (s ? r.isOnBlur : i.isOnBlur) ? !e : (s ? r.isOnChange : i.isOnChange) ? e : !0, Fr = (e, t) => !mt(T(e, t)).length && j(e, t), $r = (e, t, s) => {
1693
+ const r = Pe(T(e, s));
1514
1694
  return B(r, "root", t[s]), B(e, s, r), e;
1515
- }, je = (e) => ge(e);
1516
- function Pt(e, t, s = "validate") {
1517
- if (je(e) || Array.isArray(e) && e.every(je) || he(e) && !e)
1695
+ }, Qe = (e) => pe(e);
1696
+ function Ut(e, t, s = "validate") {
1697
+ if (Qe(e) || Array.isArray(e) && e.every(Qe) || ye(e) && !e)
1518
1698
  return {
1519
1699
  type: s,
1520
- message: je(e) ? e : "",
1700
+ message: Qe(e) ? e : "",
1521
1701
  ref: t
1522
1702
  };
1523
1703
  }
1524
- var Ae = (e) => j(e) && !We(e) ? e : {
1704
+ var Fe = (e) => H(e) && !Ye(e) ? e : {
1525
1705
  value: e,
1526
1706
  message: ""
1527
- }, Ot = async (e, t, s, r, n, i) => {
1528
- const { ref: a, refs: c, required: l, maxLength: m, minLength: g, min: h, max: d, pattern: y, validate: v, name: C, valueAsNumber: k, mount: q } = e._f, N = _(s, C);
1529
- if (!q || t.has(C))
1707
+ }, Kt = async (e, t, s, r, i, n) => {
1708
+ const { ref: a, refs: o, required: l, maxLength: m, minLength: f, min: h, max: d, pattern: p, validate: b, name: S, valueAsNumber: E, mount: N } = e._f, C = T(s, S);
1709
+ if (!N || t.has(S))
1530
1710
  return {};
1531
- const L = c ? c[0] : a, x = (F) => {
1532
- n && L.reportValidity && (L.setCustomValidity(he(F) ? "" : F || ""), L.reportValidity());
1533
- }, A = {}, I = ft(a), R = Ue(a), re = I || R, P = (k || dt(a)) && Q(a.value) && Q(N) || Ke(a) && a.value === "" || N === "" || Array.isArray(N) && !N.length, ne = yr.bind(null, C, r, A), oe = (F, D, H, W = ye.maxLength, J = ye.minLength) => {
1534
- const M = F ? D : H;
1535
- A[C] = {
1536
- type: F ? W : J,
1537
- message: M,
1711
+ const F = o ? o[0] : a, x = (L) => {
1712
+ i && F.reportValidity && (F.setCustomValidity(ye(L) ? "" : L || ""), F.reportValidity());
1713
+ }, A = {}, I = pt(a), O = qe(a), re = I || O, P = (E || gt(a)) && Q(a.value) && Q(C) || ze(a) && a.value === "" || C === "" || Array.isArray(C) && !C.length, ne = vr.bind(null, S, r, A), ce = (L, V, q, G = be.maxLength, Y = be.minLength) => {
1714
+ const U = L ? V : q;
1715
+ A[S] = {
1716
+ type: L ? G : Y,
1717
+ message: U,
1538
1718
  ref: a,
1539
- ...ne(F ? W : J, M)
1719
+ ...ne(L ? G : Y, U)
1540
1720
  };
1541
1721
  };
1542
- if (i ? !Array.isArray(N) || !N.length : l && (!re && (P || Z(N)) || he(N) && !N || R && !as(c).isValid || I && !cs(c).isValid)) {
1543
- const { value: F, message: D } = je(l) ? { value: !!l, message: l } : Ae(l);
1544
- if (F && (A[C] = {
1545
- type: ye.required,
1546
- message: D,
1547
- ref: L,
1548
- ...ne(ye.required, D)
1722
+ if (n ? !Array.isArray(C) || !C.length : l && (!re && (P || te(C)) || ye(C) && !C || O && !os(o).isValid || I && !ls(o).isValid)) {
1723
+ const { value: L, message: V } = Qe(l) ? { value: !!l, message: l } : Fe(l);
1724
+ if (L && (A[S] = {
1725
+ type: be.required,
1726
+ message: V,
1727
+ ref: F,
1728
+ ...ne(be.required, V)
1549
1729
  }, !r))
1550
- return x(D), A;
1551
- }
1552
- if (!P && (!Z(h) || !Z(d))) {
1553
- let F, D;
1554
- const H = Ae(d), W = Ae(h);
1555
- if (!Z(N) && !isNaN(N)) {
1556
- const J = a.valueAsNumber || N && +N;
1557
- Z(H.value) || (F = J > H.value), Z(W.value) || (D = J < W.value);
1730
+ return x(V), A;
1731
+ }
1732
+ if (!P && (!te(h) || !te(d))) {
1733
+ let L, V;
1734
+ const q = Fe(d), G = Fe(h);
1735
+ if (!te(C) && !isNaN(C)) {
1736
+ const Y = a.valueAsNumber || C && +C;
1737
+ te(q.value) || (L = Y > q.value), te(G.value) || (V = Y < G.value);
1558
1738
  } else {
1559
- const J = a.valueAsDate || new Date(N), M = (ue) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ue), X = a.type == "time", ie = a.type == "week";
1560
- ge(H.value) && N && (F = X ? M(N) > M(H.value) : ie ? N > H.value : J > new Date(H.value)), ge(W.value) && N && (D = X ? M(N) < M(W.value) : ie ? N < W.value : J < new Date(W.value));
1739
+ const Y = a.valueAsDate || new Date(C), U = (de) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + de), Z = a.type == "time", ie = a.type == "week";
1740
+ pe(q.value) && C && (L = Z ? U(C) > U(q.value) : ie ? C > q.value : Y > new Date(q.value)), pe(G.value) && C && (V = Z ? U(C) < U(G.value) : ie ? C < G.value : Y < new Date(G.value));
1561
1741
  }
1562
- if ((F || D) && (oe(!!F, H.message, W.message, ye.max, ye.min), !r))
1563
- return x(A[C].message), A;
1564
- }
1565
- if ((m || g) && !P && (ge(N) || i && Array.isArray(N))) {
1566
- const F = Ae(m), D = Ae(g), H = !Z(F.value) && N.length > +F.value, W = !Z(D.value) && N.length < +D.value;
1567
- if ((H || W) && (oe(H, F.message, D.message), !r))
1568
- return x(A[C].message), A;
1569
- }
1570
- if (y && !P && ge(N)) {
1571
- const { value: F, message: D } = Ae(y);
1572
- if (We(F) && !N.match(F) && (A[C] = {
1573
- type: ye.pattern,
1574
- message: D,
1742
+ if ((L || V) && (ce(!!L, q.message, G.message, be.max, be.min), !r))
1743
+ return x(A[S].message), A;
1744
+ }
1745
+ if ((m || f) && !P && (pe(C) || n && Array.isArray(C))) {
1746
+ const L = Fe(m), V = Fe(f), q = !te(L.value) && C.length > +L.value, G = !te(V.value) && C.length < +V.value;
1747
+ if ((q || G) && (ce(q, L.message, V.message), !r))
1748
+ return x(A[S].message), A;
1749
+ }
1750
+ if (p && !P && pe(C)) {
1751
+ const { value: L, message: V } = Fe(p);
1752
+ if (Ye(L) && !C.match(L) && (A[S] = {
1753
+ type: be.pattern,
1754
+ message: V,
1575
1755
  ref: a,
1576
- ...ne(ye.pattern, D)
1756
+ ...ne(be.pattern, V)
1577
1757
  }, !r))
1578
- return x(D), A;
1579
- }
1580
- if (v) {
1581
- if (fe(v)) {
1582
- const F = await v(N, s), D = Pt(F, L);
1583
- if (D && (A[C] = {
1584
- ...D,
1585
- ...ne(ye.validate, D.message)
1758
+ return x(V), A;
1759
+ }
1760
+ if (b) {
1761
+ if (he(b)) {
1762
+ const L = await b(C, s), V = Ut(L, F);
1763
+ if (V && (A[S] = {
1764
+ ...V,
1765
+ ...ne(be.validate, V.message)
1586
1766
  }, !r))
1587
- return x(D.message), A;
1588
- } else if (j(v)) {
1589
- let F = {};
1590
- for (const D in v) {
1591
- if (!te(F) && !r)
1767
+ return x(V.message), A;
1768
+ } else if (H(b)) {
1769
+ let L = {};
1770
+ for (const V in b) {
1771
+ if (!se(L) && !r)
1592
1772
  break;
1593
- const H = Pt(await v[D](N, s), L, D);
1594
- H && (F = {
1595
- ...H,
1596
- ...ne(D, H.message)
1597
- }, x(H.message), r && (A[C] = F));
1773
+ const q = Ut(await b[V](C, s), F, V);
1774
+ q && (L = {
1775
+ ...q,
1776
+ ...ne(V, q.message)
1777
+ }, x(q.message), r && (A[S] = L));
1598
1778
  }
1599
- if (!te(F) && (A[C] = {
1600
- ref: L,
1601
- ...F
1779
+ if (!se(L) && (A[S] = {
1780
+ ref: F,
1781
+ ...L
1602
1782
  }, !r))
1603
1783
  return A;
1604
1784
  }
1605
1785
  }
1606
1786
  return x(!0), A;
1607
1787
  };
1608
- const xr = {
1609
- mode: de.onSubmit,
1610
- reValidateMode: de.onChange,
1788
+ const Lr = {
1789
+ mode: fe.onSubmit,
1790
+ reValidateMode: fe.onChange,
1611
1791
  shouldFocusError: !0
1612
1792
  };
1613
- function Tr(e = {}) {
1793
+ function Dr(e = {}) {
1614
1794
  let t = {
1615
- ...xr,
1795
+ ...Lr,
1616
1796
  ...e
1617
1797
  }, s = {
1618
1798
  submitCount: 0,
1619
1799
  isDirty: !1,
1620
1800
  isReady: !1,
1621
- isLoading: fe(t.defaultValues),
1801
+ isLoading: he(t.defaultValues),
1622
1802
  isValidating: !1,
1623
1803
  isSubmitted: !1,
1624
1804
  isSubmitting: !1,
@@ -1629,18 +1809,18 @@ function Tr(e = {}) {
1629
1809
  validatingFields: {},
1630
1810
  errors: t.errors || {},
1631
1811
  disabled: t.disabled || !1
1632
- }, r = {}, n = j(t.defaultValues) || j(t.values) ? G(t.defaultValues || t.values) || {} : {}, i = t.shouldUnregister ? {} : G(n), a = {
1812
+ }, r = {}, i = H(t.defaultValues) || H(t.values) ? z(t.defaultValues || t.values) || {} : {}, n = t.shouldUnregister ? {} : z(i), a = {
1633
1813
  action: !1,
1634
1814
  mount: !1,
1635
1815
  watch: !1
1636
- }, c = {
1816
+ }, o = {
1637
1817
  mount: /* @__PURE__ */ new Set(),
1638
1818
  disabled: /* @__PURE__ */ new Set(),
1639
1819
  unMount: /* @__PURE__ */ new Set(),
1640
1820
  array: /* @__PURE__ */ new Set(),
1641
1821
  watch: /* @__PURE__ */ new Set()
1642
1822
  }, l, m = 0;
1643
- const g = {
1823
+ const f = {
1644
1824
  isDirty: !1,
1645
1825
  dirtyFields: !1,
1646
1826
  validatingFields: !1,
@@ -1650,476 +1830,476 @@ function Tr(e = {}) {
1650
1830
  errors: !1
1651
1831
  };
1652
1832
  let h = {
1653
- ...g
1833
+ ...f
1654
1834
  };
1655
1835
  const d = {
1656
- array: At(),
1657
- state: At()
1658
- }, y = t.criteriaMode === de.all, v = (o) => (u) => {
1659
- clearTimeout(m), m = setTimeout(o, u);
1660
- }, C = async (o) => {
1661
- if (!t.disabled && (g.isValid || h.isValid || o)) {
1662
- const u = t.resolver ? te((await R()).errors) : await P(r, !0);
1836
+ array: $t(),
1837
+ state: $t()
1838
+ }, p = t.criteriaMode === fe.all, b = (c) => (u) => {
1839
+ clearTimeout(m), m = setTimeout(c, u);
1840
+ }, S = async (c) => {
1841
+ if (!t.disabled && (f.isValid || h.isValid || c)) {
1842
+ const u = t.resolver ? se((await O()).errors) : await P(r, !0);
1663
1843
  u !== s.isValid && d.state.next({
1664
1844
  isValid: u
1665
1845
  });
1666
1846
  }
1667
- }, k = (o, u) => {
1668
- !t.disabled && (g.isValidating || g.validatingFields || h.isValidating || h.validatingFields) && ((o || Array.from(c.mount)).forEach((f) => {
1669
- f && (u ? B(s.validatingFields, f, u) : K(s.validatingFields, f));
1847
+ }, E = (c, u) => {
1848
+ !t.disabled && (f.isValidating || f.validatingFields || h.isValidating || h.validatingFields) && ((c || Array.from(o.mount)).forEach((y) => {
1849
+ y && (u ? B(s.validatingFields, y, u) : j(s.validatingFields, y));
1670
1850
  }), d.state.next({
1671
1851
  validatingFields: s.validatingFields,
1672
- isValidating: !te(s.validatingFields)
1852
+ isValidating: !se(s.validatingFields)
1673
1853
  }));
1674
- }, q = (o, u = [], f, S, w = !0, p = !0) => {
1675
- if (S && f && !t.disabled) {
1676
- if (a.action = !0, p && Array.isArray(_(r, o))) {
1677
- const E = f(_(r, o), S.argA, S.argB);
1678
- w && B(r, o, E);
1854
+ }, N = (c, u = [], y, k, v = !0, w = !0) => {
1855
+ if (k && y && !t.disabled) {
1856
+ if (a.action = !0, w && Array.isArray(T(r, c))) {
1857
+ const _ = y(T(r, c), k.argA, k.argB);
1858
+ v && B(r, c, _);
1679
1859
  }
1680
- if (p && Array.isArray(_(s.errors, o))) {
1681
- const E = f(_(s.errors, o), S.argA, S.argB);
1682
- w && B(s.errors, o, E), Nr(s.errors, o);
1860
+ if (w && Array.isArray(T(s.errors, c))) {
1861
+ const _ = y(T(s.errors, c), k.argA, k.argB);
1862
+ v && B(s.errors, c, _), Fr(s.errors, c);
1683
1863
  }
1684
- if ((g.touchedFields || h.touchedFields) && p && Array.isArray(_(s.touchedFields, o))) {
1685
- const E = f(_(s.touchedFields, o), S.argA, S.argB);
1686
- w && B(s.touchedFields, o, E);
1864
+ if ((f.touchedFields || h.touchedFields) && w && Array.isArray(T(s.touchedFields, c))) {
1865
+ const _ = y(T(s.touchedFields, c), k.argA, k.argB);
1866
+ v && B(s.touchedFields, c, _);
1687
1867
  }
1688
- (g.dirtyFields || h.dirtyFields) && (s.dirtyFields = Le(n, i)), d.state.next({
1689
- name: o,
1690
- isDirty: oe(o, u),
1868
+ (f.dirtyFields || h.dirtyFields) && (s.dirtyFields = Re(i, n)), d.state.next({
1869
+ name: c,
1870
+ isDirty: ce(c, u),
1691
1871
  dirtyFields: s.dirtyFields,
1692
1872
  errors: s.errors,
1693
1873
  isValid: s.isValid
1694
1874
  });
1695
1875
  } else
1696
- B(i, o, u);
1697
- }, N = (o, u) => {
1698
- B(s.errors, o, u), d.state.next({
1876
+ B(n, c, u);
1877
+ }, C = (c, u) => {
1878
+ B(s.errors, c, u), d.state.next({
1699
1879
  errors: s.errors
1700
1880
  });
1701
- }, L = (o) => {
1702
- s.errors = o, d.state.next({
1881
+ }, F = (c) => {
1882
+ s.errors = c, d.state.next({
1703
1883
  errors: s.errors,
1704
1884
  isValid: !1
1705
1885
  });
1706
- }, x = (o, u, f, S) => {
1707
- const w = _(r, o);
1708
- if (w) {
1709
- const p = _(i, o, Q(f) ? _(n, o) : f);
1710
- Q(p) || S && S.defaultChecked || u ? B(i, o, u ? p : $t(w._f)) : H(o, p), a.mount && C();
1886
+ }, x = (c, u, y, k) => {
1887
+ const v = T(r, c);
1888
+ if (v) {
1889
+ const w = T(n, c, Q(y) ? T(i, c) : y);
1890
+ Q(w) || k && k.defaultChecked || u ? B(n, c, u ? w : Rt(v._f)) : q(c, w), a.mount && S();
1711
1891
  }
1712
- }, A = (o, u, f, S, w) => {
1713
- let p = !1, E = !1;
1714
- const O = {
1715
- name: o
1892
+ }, A = (c, u, y, k, v) => {
1893
+ let w = !1, _ = !1;
1894
+ const M = {
1895
+ name: c
1716
1896
  };
1717
1897
  if (!t.disabled) {
1718
- if (!f || S) {
1719
- (g.isDirty || h.isDirty) && (E = s.isDirty, s.isDirty = O.isDirty = oe(), p = E !== O.isDirty);
1720
- const U = we(_(n, o), u);
1721
- E = !!_(s.dirtyFields, o), U ? K(s.dirtyFields, o) : B(s.dirtyFields, o, !0), O.dirtyFields = s.dirtyFields, p = p || (g.dirtyFields || h.dirtyFields) && E !== !U;
1898
+ if (!y || k) {
1899
+ (f.isDirty || h.isDirty) && (_ = s.isDirty, s.isDirty = M.isDirty = ce(), w = _ !== M.isDirty);
1900
+ const K = Se(T(i, c), u);
1901
+ _ = !!T(s.dirtyFields, c), K ? j(s.dirtyFields, c) : B(s.dirtyFields, c, !0), M.dirtyFields = s.dirtyFields, w = w || (f.dirtyFields || h.dirtyFields) && _ !== !K;
1722
1902
  }
1723
- if (f) {
1724
- const U = _(s.touchedFields, o);
1725
- U || (B(s.touchedFields, o, f), O.touchedFields = s.touchedFields, p = p || (g.touchedFields || h.touchedFields) && U !== f);
1903
+ if (y) {
1904
+ const K = T(s.touchedFields, c);
1905
+ K || (B(s.touchedFields, c, y), M.touchedFields = s.touchedFields, w = w || (f.touchedFields || h.touchedFields) && K !== y);
1726
1906
  }
1727
- p && w && d.state.next(O);
1907
+ w && v && d.state.next(M);
1728
1908
  }
1729
- return p ? O : {};
1730
- }, I = (o, u, f, S) => {
1731
- const w = _(s.errors, o), p = (g.isValid || h.isValid) && he(u) && s.isValid !== u;
1732
- if (t.delayError && f ? (l = v(() => N(o, f)), l(t.delayError)) : (clearTimeout(m), l = null, f ? B(s.errors, o, f) : K(s.errors, o)), (f ? !we(w, f) : w) || !te(S) || p) {
1733
- const E = {
1734
- ...S,
1735
- ...p && he(u) ? { isValid: u } : {},
1909
+ return w ? M : {};
1910
+ }, I = (c, u, y, k) => {
1911
+ const v = T(s.errors, c), w = (f.isValid || h.isValid) && ye(u) && s.isValid !== u;
1912
+ if (t.delayError && y ? (l = b(() => C(c, y)), l(t.delayError)) : (clearTimeout(m), l = null, y ? B(s.errors, c, y) : j(s.errors, c)), (y ? !Se(v, y) : v) || !se(k) || w) {
1913
+ const _ = {
1914
+ ...k,
1915
+ ...w && ye(u) ? { isValid: u } : {},
1736
1916
  errors: s.errors,
1737
- name: o
1917
+ name: c
1738
1918
  };
1739
1919
  s = {
1740
1920
  ...s,
1741
- ...E
1742
- }, d.state.next(E);
1921
+ ..._
1922
+ }, d.state.next(_);
1743
1923
  }
1744
- }, R = async (o) => {
1745
- k(o, !0);
1746
- const u = await t.resolver(i, t.context, vr(o || c.mount, r, t.criteriaMode, t.shouldUseNativeValidation));
1747
- return k(o), u;
1748
- }, re = async (o) => {
1749
- const { errors: u } = await R(o);
1750
- if (o)
1751
- for (const f of o) {
1752
- const S = _(u, f);
1753
- S ? B(s.errors, f, S) : K(s.errors, f);
1924
+ }, O = async (c) => {
1925
+ E(c, !0);
1926
+ const u = await t.resolver(n, t.context, Er(c || o.mount, r, t.criteriaMode, t.shouldUseNativeValidation));
1927
+ return E(c), u;
1928
+ }, re = async (c) => {
1929
+ const { errors: u } = await O(c);
1930
+ if (c)
1931
+ for (const y of c) {
1932
+ const k = T(u, y);
1933
+ k ? B(s.errors, y, k) : j(s.errors, y);
1754
1934
  }
1755
1935
  else
1756
1936
  s.errors = u;
1757
1937
  return u;
1758
- }, P = async (o, u, f = {
1938
+ }, P = async (c, u, y = {
1759
1939
  valid: !0
1760
1940
  }) => {
1761
- for (const S in o) {
1762
- const w = o[S];
1763
- if (w) {
1764
- const { _f: p, ...E } = w;
1765
- if (p) {
1766
- const O = c.array.has(p.name), U = w._f && Sr(w._f);
1767
- U && g.validatingFields && k([S], !0);
1768
- const ce = await Ot(w, c.disabled, i, y, t.shouldUseNativeValidation && !u, O);
1769
- if (U && g.validatingFields && k([S]), ce[p.name] && (f.valid = !1, u))
1941
+ for (const k in c) {
1942
+ const v = c[k];
1943
+ if (v) {
1944
+ const { _f: w, ..._ } = v;
1945
+ if (w) {
1946
+ const M = o.array.has(w.name), K = v._f && _r(v._f);
1947
+ K && f.validatingFields && E([k], !0);
1948
+ const le = await Kt(v, o.disabled, n, p, t.shouldUseNativeValidation && !u, M);
1949
+ if (K && f.validatingFields && E([k]), le[w.name] && (y.valid = !1, u))
1770
1950
  break;
1771
- !u && (_(ce, p.name) ? O ? Ar(s.errors, ce, p.name) : B(s.errors, p.name, ce[p.name]) : K(s.errors, p.name));
1951
+ !u && (T(le, w.name) ? M ? $r(s.errors, le, w.name) : B(s.errors, w.name, le[w.name]) : j(s.errors, w.name));
1772
1952
  }
1773
- !te(E) && await P(E, u, f);
1953
+ !se(_) && await P(_, u, y);
1774
1954
  }
1775
1955
  }
1776
- return f.valid;
1956
+ return y.valid;
1777
1957
  }, ne = () => {
1778
- for (const o of c.unMount) {
1779
- const u = _(r, o);
1780
- u && (u._f.refs ? u._f.refs.every((f) => !st(f)) : !st(u._f.ref)) && Ye(o);
1958
+ for (const c of o.unMount) {
1959
+ const u = T(r, c);
1960
+ u && (u._f.refs ? u._f.refs.every((y) => !ct(y)) : !ct(u._f.ref)) && tt(c);
1781
1961
  }
1782
- c.unMount = /* @__PURE__ */ new Set();
1783
- }, oe = (o, u) => !t.disabled && (o && u && B(i, o, u), !we(ue(), n)), F = (o, u, f) => gr(o, c, {
1784
- ...a.mount ? i : Q(u) ? n : ge(o) ? { [o]: u } : u
1785
- }, f, u), D = (o) => lt(_(a.mount ? i : n, o, t.shouldUnregister ? _(n, o, []) : [])), H = (o, u, f = {}) => {
1786
- const S = _(r, o);
1787
- let w = u;
1788
- if (S) {
1789
- const p = S._f;
1790
- p && (!p.disabled && B(i, o, os(u, p)), w = Ke(p.ref) && Z(u) ? "" : u, rs(p.ref) ? [...p.ref.options].forEach((E) => E.selected = w.includes(E.value)) : p.refs ? Ue(p.ref) ? p.refs.forEach((E) => {
1791
- (!E.defaultChecked || !E.disabled) && (Array.isArray(w) ? E.checked = !!w.find((O) => O === E.value) : E.checked = w === E.value || !!w);
1792
- }) : p.refs.forEach((E) => E.checked = E.value === w) : dt(p.ref) ? p.ref.value = "" : (p.ref.value = w, p.ref.type || d.state.next({
1793
- name: o,
1794
- values: G(i)
1962
+ o.unMount = /* @__PURE__ */ new Set();
1963
+ }, ce = (c, u) => !t.disabled && (c && u && B(n, c, u), !Se(de(), i)), L = (c, u, y) => wr(c, o, {
1964
+ ...a.mount ? n : Q(u) ? i : pe(c) ? { [c]: u } : u
1965
+ }, y, u), V = (c) => mt(T(a.mount ? n : i, c, t.shouldUnregister ? T(i, c, []) : [])), q = (c, u, y = {}) => {
1966
+ const k = T(r, c);
1967
+ let v = u;
1968
+ if (k) {
1969
+ const w = k._f;
1970
+ w && (!w.disabled && B(n, c, cs(u, w)), v = ze(w.ref) && te(u) ? "" : u, ns(w.ref) ? [...w.ref.options].forEach((_) => _.selected = v.includes(_.value)) : w.refs ? qe(w.ref) ? w.refs.forEach((_) => {
1971
+ (!_.defaultChecked || !_.disabled) && (Array.isArray(v) ? _.checked = !!v.find((M) => M === _.value) : _.checked = v === _.value || !!v);
1972
+ }) : w.refs.forEach((_) => _.checked = _.value === v) : gt(w.ref) ? w.ref.value = "" : (w.ref.value = v, w.ref.type || d.state.next({
1973
+ name: c,
1974
+ values: z(n)
1795
1975
  })));
1796
1976
  }
1797
- (f.shouldDirty || f.shouldTouch) && A(o, w, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && ie(o);
1798
- }, W = (o, u, f) => {
1799
- for (const S in u) {
1800
- if (!u.hasOwnProperty(S))
1977
+ (y.shouldDirty || y.shouldTouch) && A(c, v, y.shouldTouch, y.shouldDirty, !0), y.shouldValidate && ie(c);
1978
+ }, G = (c, u, y) => {
1979
+ for (const k in u) {
1980
+ if (!u.hasOwnProperty(k))
1801
1981
  return;
1802
- const w = u[S], p = o + "." + S, E = _(r, p);
1803
- (c.array.has(o) || j(w) || E && !E._f) && !Ee(w) ? W(p, w, f) : H(p, w, f);
1982
+ const v = u[k], w = c + "." + k, _ = T(r, w);
1983
+ (o.array.has(c) || H(v) || _ && !_._f) && !Ne(v) ? G(w, v, y) : q(w, v, y);
1804
1984
  }
1805
- }, J = (o, u, f = {}) => {
1806
- const S = _(r, o), w = c.array.has(o), p = G(u);
1807
- B(i, o, p), w ? (d.array.next({
1808
- name: o,
1809
- values: G(i)
1810
- }), (g.isDirty || g.dirtyFields || h.isDirty || h.dirtyFields) && f.shouldDirty && d.state.next({
1811
- name: o,
1812
- dirtyFields: Le(n, i),
1813
- isDirty: oe(o, p)
1814
- })) : S && !S._f && !Z(p) ? W(o, p, f) : H(o, p, f), Vt(o, c) && d.state.next({ ...s, name: o }), d.state.next({
1815
- name: a.mount ? o : void 0,
1816
- values: G(i)
1985
+ }, Y = (c, u, y = {}) => {
1986
+ const k = T(r, c), v = o.array.has(c), w = z(u);
1987
+ B(n, c, w), v ? (d.array.next({
1988
+ name: c,
1989
+ values: z(n)
1990
+ }), (f.isDirty || f.dirtyFields || h.isDirty || h.dirtyFields) && y.shouldDirty && d.state.next({
1991
+ name: c,
1992
+ dirtyFields: Re(i, n),
1993
+ isDirty: ce(c, w)
1994
+ })) : k && !k._f && !te(w) ? G(c, w, y) : q(c, w, y), Mt(c, o) && d.state.next({ ...s, name: c }), d.state.next({
1995
+ name: a.mount ? c : void 0,
1996
+ values: z(n)
1817
1997
  });
1818
- }, M = async (o) => {
1998
+ }, U = async (c) => {
1819
1999
  a.mount = !0;
1820
- const u = o.target;
1821
- let f = u.name, S = !0;
1822
- const w = _(r, f), p = (U) => {
1823
- S = Number.isNaN(U) || Ee(U) && isNaN(U.getTime()) || we(U, _(i, f, U));
1824
- }, E = Lt(t.mode), O = Lt(t.reValidateMode);
1825
- if (w) {
1826
- let U, ce;
1827
- const Be = u.type ? $t(w._f) : cr(o), pe = o.type === Nt.BLUR || o.type === Nt.FOCUS_OUT, ps = !_r(w._f) && !t.resolver && !_(s.errors, f) && !w._f.deps || kr(pe, _(s.touchedFields, f), s.isSubmitted, O, E), et = Vt(f, c, pe);
1828
- B(i, f, Be), pe ? (w._f.onBlur && w._f.onBlur(o), l && l(0)) : w._f.onChange && w._f.onChange(o);
1829
- const tt = A(f, Be, pe), ws = !te(tt) || et;
1830
- if (!pe && d.state.next({
1831
- name: f,
1832
- type: o.type,
1833
- values: G(i)
1834
- }), ps)
1835
- return (g.isValid || h.isValid) && (t.mode === "onBlur" ? pe && C() : pe || C()), ws && d.state.next({ name: f, ...et ? {} : tt });
1836
- if (!pe && et && d.state.next({ ...s }), t.resolver) {
1837
- const { errors: vt } = await R([f]);
1838
- if (p(Be), S) {
1839
- const vs = It(s.errors, r, f), St = It(vt, r, vs.name || f);
1840
- U = St.error, f = St.name, ce = te(vt);
2000
+ const u = c.target;
2001
+ let y = u.name, k = !0;
2002
+ const v = T(r, y), w = (K) => {
2003
+ k = Number.isNaN(K) || Ne(K) && isNaN(K.getTime()) || Se(K, T(n, y, K));
2004
+ }, _ = It(t.mode), M = It(t.reValidateMode);
2005
+ if (v) {
2006
+ let K, le;
2007
+ const We = u.type ? Rt(v._f) : fr(c), ve = c.type === Ft.BLUR || c.type === Ft.FOCUS_OUT, ws = !Cr(v._f) && !t.resolver && !T(s.errors, y) && !v._f.deps || Ar(ve, T(s.touchedFields, y), s.isSubmitted, M, _), nt = Mt(y, o, ve);
2008
+ B(n, y, We), ve ? (v._f.onBlur && v._f.onBlur(c), l && l(0)) : v._f.onChange && v._f.onChange(c);
2009
+ const it = A(y, We, ve), vs = !se(it) || nt;
2010
+ if (!ve && d.state.next({
2011
+ name: y,
2012
+ type: c.type,
2013
+ values: z(n)
2014
+ }), ws)
2015
+ return (f.isValid || h.isValid) && (t.mode === "onBlur" ? ve && S() : ve || S()), vs && d.state.next({ name: y, ...nt ? {} : it });
2016
+ if (!ve && nt && d.state.next({ ...s }), t.resolver) {
2017
+ const { errors: _t } = await O([y]);
2018
+ if (w(We), k) {
2019
+ const ks = Ot(s.errors, r, y), Ct = Ot(_t, r, ks.name || y);
2020
+ K = Ct.error, y = Ct.name, le = se(_t);
1841
2021
  }
1842
2022
  } else
1843
- k([f], !0), U = (await Ot(w, c.disabled, i, y, t.shouldUseNativeValidation))[f], k([f]), p(Be), S && (U ? ce = !1 : (g.isValid || h.isValid) && (ce = await P(r, !0)));
1844
- S && (w._f.deps && ie(w._f.deps), I(f, ce, U, tt));
2023
+ E([y], !0), K = (await Kt(v, o.disabled, n, p, t.shouldUseNativeValidation))[y], E([y]), w(We), k && (K ? le = !1 : (f.isValid || h.isValid) && (le = await P(r, !0)));
2024
+ k && (v._f.deps && ie(v._f.deps), I(y, le, K, it));
1845
2025
  }
1846
- }, X = (o, u) => {
1847
- if (_(s.errors, u) && o.focus)
1848
- return o.focus(), 1;
1849
- }, ie = async (o, u = {}) => {
1850
- let f, S;
1851
- const w = Ve(o);
2026
+ }, Z = (c, u) => {
2027
+ if (T(s.errors, u) && c.focus)
2028
+ return c.focus(), 1;
2029
+ }, ie = async (c, u = {}) => {
2030
+ let y, k;
2031
+ const v = Pe(c);
1852
2032
  if (t.resolver) {
1853
- const p = await re(Q(o) ? o : w);
1854
- f = te(p), S = o ? !w.some((E) => _(p, E)) : f;
1855
- } else o ? (S = (await Promise.all(w.map(async (p) => {
1856
- const E = _(r, p);
1857
- return await P(E && E._f ? { [p]: E } : E);
1858
- }))).every(Boolean), !(!S && !s.isValid) && C()) : S = f = await P(r);
2033
+ const w = await re(Q(c) ? c : v);
2034
+ y = se(w), k = c ? !v.some((_) => T(w, _)) : y;
2035
+ } else c ? (k = (await Promise.all(v.map(async (w) => {
2036
+ const _ = T(r, w);
2037
+ return await P(_ && _._f ? { [w]: _ } : _);
2038
+ }))).every(Boolean), !(!k && !s.isValid) && S()) : k = y = await P(r);
1859
2039
  return d.state.next({
1860
- ...!ge(o) || (g.isValid || h.isValid) && f !== s.isValid ? {} : { name: o },
1861
- ...t.resolver || !o ? { isValid: f } : {},
2040
+ ...!pe(c) || (f.isValid || h.isValid) && y !== s.isValid ? {} : { name: c },
2041
+ ...t.resolver || !c ? { isValid: y } : {},
1862
2042
  errors: s.errors
1863
- }), u.shouldFocus && !S && Ie(r, X, o ? w : c.mount), S;
1864
- }, ue = (o) => {
2043
+ }), u.shouldFocus && !k && Me(r, Z, c ? v : o.mount), k;
2044
+ }, de = (c) => {
1865
2045
  const u = {
1866
- ...a.mount ? i : n
2046
+ ...a.mount ? n : i
1867
2047
  };
1868
- return Q(o) ? u : ge(o) ? _(u, o) : o.map((f) => _(u, f));
1869
- }, qe = (o, u) => ({
1870
- invalid: !!_((u || s).errors, o),
1871
- isDirty: !!_((u || s).dirtyFields, o),
1872
- error: _((u || s).errors, o),
1873
- isValidating: !!_(s.validatingFields, o),
1874
- isTouched: !!_((u || s).touchedFields, o)
1875
- }), Ce = (o) => {
1876
- o && Ve(o).forEach((u) => K(s.errors, u)), d.state.next({
1877
- errors: o ? s.errors : {}
2048
+ return Q(c) ? u : pe(c) ? T(u, c) : c.map((y) => T(u, y));
2049
+ }, He = (c, u) => ({
2050
+ invalid: !!T((u || s).errors, c),
2051
+ isDirty: !!T((u || s).dirtyFields, c),
2052
+ error: T((u || s).errors, c),
2053
+ isValidating: !!T(s.validatingFields, c),
2054
+ isTouched: !!T((u || s).touchedFields, c)
2055
+ }), _e = (c) => {
2056
+ c && Pe(c).forEach((u) => j(s.errors, u)), d.state.next({
2057
+ errors: c ? s.errors : {}
1878
2058
  });
1879
- }, mt = (o, u, f) => {
1880
- const S = (_(r, o, { _f: {} })._f || {}).ref, w = _(s.errors, o) || {}, { ref: p, message: E, type: O, ...U } = w;
1881
- B(s.errors, o, {
1882
- ...U,
2059
+ }, bt = (c, u, y) => {
2060
+ const k = (T(r, c, { _f: {} })._f || {}).ref, v = T(s.errors, c) || {}, { ref: w, message: _, type: M, ...K } = v;
2061
+ B(s.errors, c, {
2062
+ ...K,
1883
2063
  ...u,
1884
- ref: S
2064
+ ref: k
1885
2065
  }), d.state.next({
1886
- name: o,
2066
+ name: c,
1887
2067
  errors: s.errors,
1888
2068
  isValid: !1
1889
- }), f && f.shouldFocus && S && S.focus && S.focus();
1890
- }, fs = (o, u) => fe(o) ? d.state.subscribe({
1891
- next: (f) => "values" in f && o(F(void 0, u), f)
1892
- }) : F(o, u, !0), ht = (o) => d.state.subscribe({
2069
+ }), y && y.shouldFocus && k && k.focus && k.focus();
2070
+ }, hs = (c, u) => he(c) ? d.state.subscribe({
2071
+ next: (y) => "values" in y && c(L(void 0, u), y)
2072
+ }) : L(c, u, !0), wt = (c) => d.state.subscribe({
1893
2073
  next: (u) => {
1894
- Er(o.name, u.name, o.exact) && Cr(u, o.formState || g, bs, o.reRenderRoot) && o.callback({
1895
- values: { ...i },
2074
+ xr(c.name, u.name, c.exact) && Nr(u, c.formState || f, bs, c.reRenderRoot) && c.callback({
2075
+ values: { ...n },
1896
2076
  ...s,
1897
2077
  ...u,
1898
- defaultValues: n
2078
+ defaultValues: i
1899
2079
  });
1900
2080
  }
1901
- }).unsubscribe, ms = (o) => (a.mount = !0, h = {
2081
+ }).unsubscribe, ms = (c) => (a.mount = !0, h = {
1902
2082
  ...h,
1903
- ...o.formState
1904
- }, ht({
1905
- ...o,
2083
+ ...c.formState
2084
+ }, wt({
2085
+ ...c,
1906
2086
  formState: h
1907
- })), Ye = (o, u = {}) => {
1908
- for (const f of o ? Ve(o) : c.mount)
1909
- c.mount.delete(f), c.array.delete(f), u.keepValue || (K(r, f), K(i, f)), !u.keepError && K(s.errors, f), !u.keepDirty && K(s.dirtyFields, f), !u.keepTouched && K(s.touchedFields, f), !u.keepIsValidating && K(s.validatingFields, f), !t.shouldUnregister && !u.keepDefaultValue && K(n, f);
2087
+ })), tt = (c, u = {}) => {
2088
+ for (const y of c ? Pe(c) : o.mount)
2089
+ o.mount.delete(y), o.array.delete(y), u.keepValue || (j(r, y), j(n, y)), !u.keepError && j(s.errors, y), !u.keepDirty && j(s.dirtyFields, y), !u.keepTouched && j(s.touchedFields, y), !u.keepIsValidating && j(s.validatingFields, y), !t.shouldUnregister && !u.keepDefaultValue && j(i, y);
1910
2090
  d.state.next({
1911
- values: G(i)
2091
+ values: z(n)
1912
2092
  }), d.state.next({
1913
2093
  ...s,
1914
- ...u.keepDirty ? { isDirty: oe() } : {}
1915
- }), !u.keepIsValid && C();
1916
- }, gt = ({ disabled: o, name: u }) => {
1917
- (he(o) && a.mount || o || c.disabled.has(u)) && (o ? c.disabled.add(u) : c.disabled.delete(u));
1918
- }, Xe = (o, u = {}) => {
1919
- let f = _(r, o);
1920
- const S = he(u.disabled) || he(t.disabled);
1921
- return B(r, o, {
1922
- ...f || {},
2094
+ ...u.keepDirty ? { isDirty: ce() } : {}
2095
+ }), !u.keepIsValid && S();
2096
+ }, vt = ({ disabled: c, name: u }) => {
2097
+ (ye(c) && a.mount || c || o.disabled.has(u)) && (c ? o.disabled.add(u) : o.disabled.delete(u));
2098
+ }, st = (c, u = {}) => {
2099
+ let y = T(r, c);
2100
+ const k = ye(u.disabled) || ye(t.disabled);
2101
+ return B(r, c, {
2102
+ ...y || {},
1923
2103
  _f: {
1924
- ...f && f._f ? f._f : { ref: { name: o } },
1925
- name: o,
2104
+ ...y && y._f ? y._f : { ref: { name: c } },
2105
+ name: c,
1926
2106
  mount: !0,
1927
2107
  ...u
1928
2108
  }
1929
- }), c.mount.add(o), f ? gt({
1930
- disabled: he(u.disabled) ? u.disabled : t.disabled,
1931
- name: o
1932
- }) : x(o, !0, u.value), {
1933
- ...S ? { disabled: u.disabled || t.disabled } : {},
2109
+ }), o.mount.add(c), y ? vt({
2110
+ disabled: ye(u.disabled) ? u.disabled : t.disabled,
2111
+ name: c
2112
+ }) : x(c, !0, u.value), {
2113
+ ...k ? { disabled: u.disabled || t.disabled } : {},
1934
2114
  ...t.progressive ? {
1935
2115
  required: !!u.required,
1936
- min: De(u.min),
1937
- max: De(u.max),
1938
- minLength: De(u.minLength),
1939
- maxLength: De(u.maxLength),
1940
- pattern: De(u.pattern)
2116
+ min: Ie(u.min),
2117
+ max: Ie(u.max),
2118
+ minLength: Ie(u.minLength),
2119
+ maxLength: Ie(u.maxLength),
2120
+ pattern: Ie(u.pattern)
1941
2121
  } : {},
1942
- name: o,
1943
- onChange: M,
1944
- onBlur: M,
1945
- ref: (w) => {
1946
- if (w) {
1947
- Xe(o, u), f = _(r, o);
1948
- const p = Q(w.value) && w.querySelectorAll && w.querySelectorAll("input,select,textarea")[0] || w, E = br(p), O = f._f.refs || [];
1949
- if (E ? O.find((U) => U === p) : p === f._f.ref)
2122
+ name: c,
2123
+ onChange: U,
2124
+ onBlur: U,
2125
+ ref: (v) => {
2126
+ if (v) {
2127
+ st(c, u), y = T(r, c);
2128
+ const w = Q(v.value) && v.querySelectorAll && v.querySelectorAll("input,select,textarea")[0] || v, _ = kr(w), M = y._f.refs || [];
2129
+ if (_ ? M.find((K) => K === w) : w === y._f.ref)
1950
2130
  return;
1951
- B(r, o, {
2131
+ B(r, c, {
1952
2132
  _f: {
1953
- ...f._f,
1954
- ...E ? {
2133
+ ...y._f,
2134
+ ..._ ? {
1955
2135
  refs: [
1956
- ...O.filter(st),
1957
- p,
1958
- ...Array.isArray(_(n, o)) ? [{}] : []
2136
+ ...M.filter(ct),
2137
+ w,
2138
+ ...Array.isArray(T(i, c)) ? [{}] : []
1959
2139
  ],
1960
- ref: { type: p.type, name: o }
1961
- } : { ref: p }
2140
+ ref: { type: w.type, name: c }
2141
+ } : { ref: w }
1962
2142
  }
1963
- }), x(o, !1, void 0, p);
2143
+ }), x(c, !1, void 0, w);
1964
2144
  } else
1965
- f = _(r, o, {}), f._f && (f._f.mount = !1), (t.shouldUnregister || u.shouldUnregister) && !(ur(c.array, o) && a.action) && c.unMount.add(o);
2145
+ y = T(r, c, {}), y._f && (y._f.mount = !1), (t.shouldUnregister || u.shouldUnregister) && !(mr(o.array, c) && a.action) && o.unMount.add(c);
1966
2146
  }
1967
2147
  };
1968
- }, Ze = () => t.shouldFocusError && Ie(r, X, c.mount), hs = (o) => {
1969
- he(o) && (d.state.next({ disabled: o }), Ie(r, (u, f) => {
1970
- const S = _(r, f);
1971
- S && (u.disabled = S._f.disabled || o, Array.isArray(S._f.refs) && S._f.refs.forEach((w) => {
1972
- w.disabled = S._f.disabled || o;
2148
+ }, rt = () => t.shouldFocusError && Me(r, Z, o.mount), ys = (c) => {
2149
+ ye(c) && (d.state.next({ disabled: c }), Me(r, (u, y) => {
2150
+ const k = T(r, y);
2151
+ k && (u.disabled = k._f.disabled || c, Array.isArray(k._f.refs) && k._f.refs.forEach((v) => {
2152
+ v.disabled = k._f.disabled || c;
1973
2153
  }));
1974
2154
  }, 0, !1));
1975
- }, yt = (o, u) => async (f) => {
1976
- let S;
1977
- f && (f.preventDefault && f.preventDefault(), f.persist && f.persist());
1978
- let w = G(i);
2155
+ }, kt = (c, u) => async (y) => {
2156
+ let k;
2157
+ y && (y.preventDefault && y.preventDefault(), y.persist && y.persist());
2158
+ let v = z(n);
1979
2159
  if (d.state.next({
1980
2160
  isSubmitting: !0
1981
2161
  }), t.resolver) {
1982
- const { errors: p, values: E } = await R();
1983
- s.errors = p, w = G(E);
2162
+ const { errors: w, values: _ } = await O();
2163
+ s.errors = w, v = z(_);
1984
2164
  } else
1985
2165
  await P(r);
1986
- if (c.disabled.size)
1987
- for (const p of c.disabled)
1988
- K(w, p);
1989
- if (K(s.errors, "root"), te(s.errors)) {
2166
+ if (o.disabled.size)
2167
+ for (const w of o.disabled)
2168
+ j(v, w);
2169
+ if (j(s.errors, "root"), se(s.errors)) {
1990
2170
  d.state.next({
1991
2171
  errors: {}
1992
2172
  });
1993
2173
  try {
1994
- await o(w, f);
1995
- } catch (p) {
1996
- S = p;
2174
+ await c(v, y);
2175
+ } catch (w) {
2176
+ k = w;
1997
2177
  }
1998
2178
  } else
1999
- u && await u({ ...s.errors }, f), Ze(), setTimeout(Ze);
2179
+ u && await u({ ...s.errors }, y), rt(), setTimeout(rt);
2000
2180
  if (d.state.next({
2001
2181
  isSubmitted: !0,
2002
2182
  isSubmitting: !1,
2003
- isSubmitSuccessful: te(s.errors) && !S,
2183
+ isSubmitSuccessful: se(s.errors) && !k,
2004
2184
  submitCount: s.submitCount + 1,
2005
2185
  errors: s.errors
2006
- }), S)
2007
- throw S;
2008
- }, gs = (o, u = {}) => {
2009
- _(r, o) && (Q(u.defaultValue) ? J(o, G(_(n, o))) : (J(o, u.defaultValue), B(n, o, G(u.defaultValue))), u.keepTouched || K(s.touchedFields, o), u.keepDirty || (K(s.dirtyFields, o), s.isDirty = u.defaultValue ? oe(o, G(_(n, o))) : oe()), u.keepError || (K(s.errors, o), g.isValid && C()), d.state.next({ ...s }));
2010
- }, bt = (o, u = {}) => {
2011
- const f = o ? G(o) : n, S = G(f), w = te(o), p = w ? n : S;
2012
- if (u.keepDefaultValues || (n = f), !u.keepValues) {
2186
+ }), k)
2187
+ throw k;
2188
+ }, gs = (c, u = {}) => {
2189
+ T(r, c) && (Q(u.defaultValue) ? Y(c, z(T(i, c))) : (Y(c, u.defaultValue), B(i, c, z(u.defaultValue))), u.keepTouched || j(s.touchedFields, c), u.keepDirty || (j(s.dirtyFields, c), s.isDirty = u.defaultValue ? ce(c, z(T(i, c))) : ce()), u.keepError || (j(s.errors, c), f.isValid && S()), d.state.next({ ...s }));
2190
+ }, St = (c, u = {}) => {
2191
+ const y = c ? z(c) : i, k = z(y), v = se(c), w = v ? i : k;
2192
+ if (u.keepDefaultValues || (i = y), !u.keepValues) {
2013
2193
  if (u.keepDirtyValues) {
2014
- const E = /* @__PURE__ */ new Set([
2015
- ...c.mount,
2016
- ...Object.keys(Le(n, i))
2194
+ const _ = /* @__PURE__ */ new Set([
2195
+ ...o.mount,
2196
+ ...Object.keys(Re(i, n))
2017
2197
  ]);
2018
- for (const O of Array.from(E))
2019
- _(s.dirtyFields, O) ? B(p, O, _(i, O)) : J(O, _(p, O));
2198
+ for (const M of Array.from(_))
2199
+ T(s.dirtyFields, M) ? B(w, M, T(n, M)) : Y(M, T(w, M));
2020
2200
  } else {
2021
- if (ct && Q(o))
2022
- for (const E of c.mount) {
2023
- const O = _(r, E);
2024
- if (O && O._f) {
2025
- const U = Array.isArray(O._f.refs) ? O._f.refs[0] : O._f.ref;
2026
- if (Ke(U)) {
2027
- const ce = U.closest("form");
2028
- if (ce) {
2029
- ce.reset();
2201
+ if (ht && Q(c))
2202
+ for (const _ of o.mount) {
2203
+ const M = T(r, _);
2204
+ if (M && M._f) {
2205
+ const K = Array.isArray(M._f.refs) ? M._f.refs[0] : M._f.ref;
2206
+ if (ze(K)) {
2207
+ const le = K.closest("form");
2208
+ if (le) {
2209
+ le.reset();
2030
2210
  break;
2031
2211
  }
2032
2212
  }
2033
2213
  }
2034
2214
  }
2035
2215
  if (u.keepFieldsRef)
2036
- for (const E of c.mount)
2037
- J(E, _(p, E));
2216
+ for (const _ of o.mount)
2217
+ Y(_, T(w, _));
2038
2218
  else
2039
2219
  r = {};
2040
2220
  }
2041
- i = t.shouldUnregister ? u.keepDefaultValues ? G(n) : {} : G(p), d.array.next({
2042
- values: { ...p }
2221
+ n = t.shouldUnregister ? u.keepDefaultValues ? z(i) : {} : z(w), d.array.next({
2222
+ values: { ...w }
2043
2223
  }), d.state.next({
2044
- values: { ...p }
2224
+ values: { ...w }
2045
2225
  });
2046
2226
  }
2047
- c = {
2048
- mount: u.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
2227
+ o = {
2228
+ mount: u.keepDirtyValues ? o.mount : /* @__PURE__ */ new Set(),
2049
2229
  unMount: /* @__PURE__ */ new Set(),
2050
2230
  array: /* @__PURE__ */ new Set(),
2051
2231
  disabled: /* @__PURE__ */ new Set(),
2052
2232
  watch: /* @__PURE__ */ new Set(),
2053
2233
  watchAll: !1,
2054
2234
  focus: ""
2055
- }, a.mount = !g.isValid || !!u.keepIsValid || !!u.keepDirtyValues, a.watch = !!t.shouldUnregister, d.state.next({
2235
+ }, a.mount = !f.isValid || !!u.keepIsValid || !!u.keepDirtyValues, a.watch = !!t.shouldUnregister, d.state.next({
2056
2236
  submitCount: u.keepSubmitCount ? s.submitCount : 0,
2057
- isDirty: w ? !1 : u.keepDirty ? s.isDirty : !!(u.keepDefaultValues && !we(o, n)),
2237
+ isDirty: v ? !1 : u.keepDirty ? s.isDirty : !!(u.keepDefaultValues && !Se(c, i)),
2058
2238
  isSubmitted: u.keepIsSubmitted ? s.isSubmitted : !1,
2059
- dirtyFields: w ? {} : u.keepDirtyValues ? u.keepDefaultValues && i ? Le(n, i) : s.dirtyFields : u.keepDefaultValues && o ? Le(n, o) : u.keepDirty ? s.dirtyFields : {},
2239
+ dirtyFields: v ? {} : u.keepDirtyValues ? u.keepDefaultValues && n ? Re(i, n) : s.dirtyFields : u.keepDefaultValues && c ? Re(i, c) : u.keepDirty ? s.dirtyFields : {},
2060
2240
  touchedFields: u.keepTouched ? s.touchedFields : {},
2061
2241
  errors: u.keepErrors ? s.errors : {},
2062
2242
  isSubmitSuccessful: u.keepIsSubmitSuccessful ? s.isSubmitSuccessful : !1,
2063
2243
  isSubmitting: !1
2064
2244
  });
2065
- }, pt = (o, u) => bt(fe(o) ? o(i) : o, u), ys = (o, u = {}) => {
2066
- const f = _(r, o), S = f && f._f;
2067
- if (S) {
2068
- const w = S.refs ? S.refs[0] : S.ref;
2069
- w.focus && (w.focus(), u.shouldSelect && fe(w.select) && w.select());
2245
+ }, Tt = (c, u) => St(he(c) ? c(n) : c, u), ps = (c, u = {}) => {
2246
+ const y = T(r, c), k = y && y._f;
2247
+ if (k) {
2248
+ const v = k.refs ? k.refs[0] : k.ref;
2249
+ v.focus && (v.focus(), u.shouldSelect && he(v.select) && v.select());
2070
2250
  }
2071
- }, bs = (o) => {
2251
+ }, bs = (c) => {
2072
2252
  s = {
2073
2253
  ...s,
2074
- ...o
2254
+ ...c
2075
2255
  };
2076
- }, wt = {
2256
+ }, Et = {
2077
2257
  control: {
2078
- register: Xe,
2079
- unregister: Ye,
2080
- getFieldState: qe,
2081
- handleSubmit: yt,
2082
- setError: mt,
2083
- _subscribe: ht,
2084
- _runSchema: R,
2085
- _focusError: Ze,
2086
- _getWatch: F,
2087
- _getDirty: oe,
2088
- _setValid: C,
2089
- _setFieldArray: q,
2090
- _setDisabledField: gt,
2091
- _setErrors: L,
2092
- _getFieldArray: D,
2093
- _reset: bt,
2094
- _resetDefaultValues: () => fe(t.defaultValues) && t.defaultValues().then((o) => {
2095
- pt(o, t.resetOptions), d.state.next({
2258
+ register: st,
2259
+ unregister: tt,
2260
+ getFieldState: He,
2261
+ handleSubmit: kt,
2262
+ setError: bt,
2263
+ _subscribe: wt,
2264
+ _runSchema: O,
2265
+ _focusError: rt,
2266
+ _getWatch: L,
2267
+ _getDirty: ce,
2268
+ _setValid: S,
2269
+ _setFieldArray: N,
2270
+ _setDisabledField: vt,
2271
+ _setErrors: F,
2272
+ _getFieldArray: V,
2273
+ _reset: St,
2274
+ _resetDefaultValues: () => he(t.defaultValues) && t.defaultValues().then((c) => {
2275
+ Tt(c, t.resetOptions), d.state.next({
2096
2276
  isLoading: !1
2097
2277
  });
2098
2278
  }),
2099
2279
  _removeUnmounted: ne,
2100
- _disableForm: hs,
2280
+ _disableForm: ys,
2101
2281
  _subjects: d,
2102
- _proxyFormState: g,
2282
+ _proxyFormState: f,
2103
2283
  get _fields() {
2104
2284
  return r;
2105
2285
  },
2106
2286
  get _formValues() {
2107
- return i;
2287
+ return n;
2108
2288
  },
2109
2289
  get _state() {
2110
2290
  return a;
2111
2291
  },
2112
- set _state(o) {
2113
- a = o;
2292
+ set _state(c) {
2293
+ a = c;
2114
2294
  },
2115
2295
  get _defaultValues() {
2116
- return n;
2296
+ return i;
2117
2297
  },
2118
2298
  get _names() {
2119
- return c;
2299
+ return o;
2120
2300
  },
2121
- set _names(o) {
2122
- c = o;
2301
+ set _names(c) {
2302
+ o = c;
2123
2303
  },
2124
2304
  get _formState() {
2125
2305
  return s;
@@ -2127,38 +2307,38 @@ function Tr(e = {}) {
2127
2307
  get _options() {
2128
2308
  return t;
2129
2309
  },
2130
- set _options(o) {
2310
+ set _options(c) {
2131
2311
  t = {
2132
2312
  ...t,
2133
- ...o
2313
+ ...c
2134
2314
  };
2135
2315
  }
2136
2316
  },
2137
2317
  subscribe: ms,
2138
2318
  trigger: ie,
2139
- register: Xe,
2140
- handleSubmit: yt,
2141
- watch: fs,
2142
- setValue: J,
2143
- getValues: ue,
2144
- reset: pt,
2319
+ register: st,
2320
+ handleSubmit: kt,
2321
+ watch: hs,
2322
+ setValue: Y,
2323
+ getValues: de,
2324
+ reset: Tt,
2145
2325
  resetField: gs,
2146
- clearErrors: Ce,
2147
- unregister: Ye,
2148
- setError: mt,
2149
- setFocus: ys,
2150
- getFieldState: qe
2326
+ clearErrors: _e,
2327
+ unregister: tt,
2328
+ setError: bt,
2329
+ setFocus: ps,
2330
+ getFieldState: He
2151
2331
  };
2152
2332
  return {
2153
- ...wt,
2154
- formControl: wt
2333
+ ...Et,
2334
+ formControl: Et
2155
2335
  };
2156
2336
  }
2157
- function ls(e = {}) {
2158
- const t = ae.useRef(void 0), s = ae.useRef(void 0), [r, n] = ae.useState({
2337
+ function us(e = {}) {
2338
+ const t = ae.useRef(void 0), s = ae.useRef(void 0), [r, i] = ae.useState({
2159
2339
  isDirty: !1,
2160
2340
  isValidating: !1,
2161
- isLoading: fe(e.defaultValues),
2341
+ isLoading: he(e.defaultValues),
2162
2342
  isSubmitted: !1,
2163
2343
  isSubmitting: !1,
2164
2344
  isSubmitSuccessful: !1,
@@ -2170,790 +2350,789 @@ function ls(e = {}) {
2170
2350
  errors: e.errors || {},
2171
2351
  disabled: e.disabled || !1,
2172
2352
  isReady: !1,
2173
- defaultValues: fe(e.defaultValues) ? void 0 : e.defaultValues
2353
+ defaultValues: he(e.defaultValues) ? void 0 : e.defaultValues
2174
2354
  });
2175
2355
  if (!t.current)
2176
2356
  if (e.formControl)
2177
2357
  t.current = {
2178
2358
  ...e.formControl,
2179
2359
  formState: r
2180
- }, e.defaultValues && !fe(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
2360
+ }, e.defaultValues && !he(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
2181
2361
  else {
2182
- const { formControl: a, ...c } = Tr(e);
2362
+ const { formControl: a, ...o } = Dr(e);
2183
2363
  t.current = {
2184
- ...c,
2364
+ ...o,
2185
2365
  formState: r
2186
2366
  };
2187
2367
  }
2188
- const i = t.current.control;
2189
- return i._options = e, hr(() => {
2190
- const a = i._subscribe({
2191
- formState: i._proxyFormState,
2192
- callback: () => n({ ...i._formState }),
2368
+ const n = t.current.control;
2369
+ return n._options = e, br(() => {
2370
+ const a = n._subscribe({
2371
+ formState: n._proxyFormState,
2372
+ callback: () => i({ ...n._formState }),
2193
2373
  reRenderRoot: !0
2194
2374
  });
2195
- return n((c) => ({
2196
- ...c,
2375
+ return i((o) => ({
2376
+ ...o,
2197
2377
  isReady: !0
2198
- })), i._formState.isReady = !0, a;
2199
- }, [i]), ae.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), ae.useEffect(() => {
2200
- e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
2201
- }, [i, e.mode, e.reValidateMode]), ae.useEffect(() => {
2202
- e.errors && (i._setErrors(e.errors), i._focusError());
2203
- }, [i, e.errors]), ae.useEffect(() => {
2204
- e.shouldUnregister && i._subjects.state.next({
2205
- values: i._getWatch()
2378
+ })), n._formState.isReady = !0, a;
2379
+ }, [n]), ae.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), ae.useEffect(() => {
2380
+ e.mode && (n._options.mode = e.mode), e.reValidateMode && (n._options.reValidateMode = e.reValidateMode);
2381
+ }, [n, e.mode, e.reValidateMode]), ae.useEffect(() => {
2382
+ e.errors && (n._setErrors(e.errors), n._focusError());
2383
+ }, [n, e.errors]), ae.useEffect(() => {
2384
+ e.shouldUnregister && n._subjects.state.next({
2385
+ values: n._getWatch()
2206
2386
  });
2207
- }, [i, e.shouldUnregister]), ae.useEffect(() => {
2208
- if (i._proxyFormState.isDirty) {
2209
- const a = i._getDirty();
2210
- a !== r.isDirty && i._subjects.state.next({
2387
+ }, [n, e.shouldUnregister]), ae.useEffect(() => {
2388
+ if (n._proxyFormState.isDirty) {
2389
+ const a = n._getDirty();
2390
+ a !== r.isDirty && n._subjects.state.next({
2211
2391
  isDirty: a
2212
2392
  });
2213
2393
  }
2214
- }, [i, r.isDirty]), ae.useEffect(() => {
2215
- e.values && !we(e.values, s.current) ? (i._reset(e.values, {
2394
+ }, [n, r.isDirty]), ae.useEffect(() => {
2395
+ e.values && !Se(e.values, s.current) ? (n._reset(e.values, {
2216
2396
  keepFieldsRef: !0,
2217
- ...i._options.resetOptions
2218
- }), s.current = e.values, n((a) => ({ ...a }))) : i._resetDefaultValues();
2219
- }, [i, e.values]), ae.useEffect(() => {
2220
- i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
2221
- }), t.current.formState = mr(r, i), t.current;
2397
+ ...n._options.resetOptions
2398
+ }), s.current = e.values, i((a) => ({ ...a }))) : n._resetDefaultValues();
2399
+ }, [n, e.values]), ae.useEffect(() => {
2400
+ n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
2401
+ }), t.current.formState = pr(r, n), t.current;
2222
2402
  }
2223
2403
  const Nn = (e) => {
2224
- const { t } = V(), { showStackNotifications: s, showSuccessNotification: r } = Ne(), {
2225
- defaultValues: n,
2226
- mutationFn: i,
2404
+ const { t } = R(), { showStackNotifications: s, showSuccessNotification: r } = Ae(), {
2405
+ defaultValues: i,
2406
+ mutationFn: n,
2227
2407
  formToDto: a,
2228
- onError: c,
2408
+ onError: o,
2229
2409
  onSuccess: l,
2230
2410
  queryKey: m,
2231
- onSuccessMessage: g
2232
- } = e, { control: h, handleSubmit: d, reset: y, setError: v, getValues: C, setValue: k } = ls({
2233
- defaultValues: n
2234
- }), q = $(
2411
+ onSuccessMessage: f
2412
+ } = e, { control: h, handleSubmit: d, reset: p, setError: b, getValues: S, setValue: E } = us({
2413
+ defaultValues: i
2414
+ }), N = D(
2235
2415
  (x) => {
2236
2416
  const A = x == null ? void 0 : x.errors, I = [];
2237
- return A && A.forEach(([R, re]) => {
2238
- const P = document.querySelector(`[name="${R}"]`);
2239
- (P instanceof HTMLInputElement || P instanceof HTMLTextAreaElement || P instanceof HTMLSelectElement) && (P.focus(), P.classList.add("error"), I.push(t(`_entities:${m}.${R}.${re}`)));
2417
+ return A && A.forEach(([O, re]) => {
2418
+ const P = document.querySelector(`[name="${O}"]`);
2419
+ (P instanceof HTMLInputElement || P instanceof HTMLTextAreaElement || P instanceof HTMLSelectElement) && (P.focus(), P.classList.add("error"), I.push(t(`_entities:${m}.${O}.${re}`)));
2240
2420
  }), I;
2241
2421
  },
2242
2422
  [t, m]
2243
- ), N = $(() => {
2423
+ ), C = D(() => {
2244
2424
  document.querySelectorAll("input, textarea, select").forEach((A) => {
2245
2425
  A.classList.remove("error");
2246
2426
  });
2247
- }, []), L = Re(
2427
+ }, []), F = Ke(
2248
2428
  {
2249
- mutationFn: i,
2429
+ mutationFn: n,
2250
2430
  onError: (x) => {
2251
2431
  console.error(x);
2252
2432
  const A = x;
2253
- if (c) c(x);
2254
- else if (Ge(A)) {
2255
- const I = q(A);
2433
+ if (o) o(x);
2434
+ else if (Xe(A)) {
2435
+ const I = N(A);
2256
2436
  s(
2257
2437
  I.map(
2258
- (R) => ({
2259
- message: R,
2260
- type: z.error
2438
+ (O) => ({
2439
+ message: O,
2440
+ type: J.error
2261
2441
  })
2262
2442
  )
2263
2443
  );
2264
- } else if (ze(A)) {
2265
- const I = A.message || t("_accessibility:errors.500"), R = t(`_accessibility:errors.${A.status}`);
2444
+ } else if (Ze(A)) {
2445
+ const I = A.message || t("_accessibility:errors.500"), O = t(`_accessibility:errors.${A.status}`);
2266
2446
  s([
2267
2447
  {
2268
- message: R || I,
2269
- type: z.error
2448
+ message: O || I,
2449
+ type: J.error
2270
2450
  }
2271
2451
  ]);
2272
2452
  }
2273
2453
  },
2274
2454
  onSuccess: async (x) => {
2275
- be && await be.invalidateQueries({ queryKey: m }), l && l(x), g && r({
2276
- message: g
2455
+ we && await we.invalidateQueries({ queryKey: m }), l && l(x), f && r({
2456
+ message: f
2277
2457
  });
2278
2458
  }
2279
2459
  }
2280
2460
  );
2281
2461
  return {
2282
2462
  control: h,
2283
- getValues: C,
2284
- setValue: k,
2463
+ getValues: S,
2464
+ setValue: E,
2285
2465
  handleSubmit: d,
2286
2466
  onSubmit: (x) => {
2287
- N(), L.mutate(
2467
+ C(), F.mutate(
2288
2468
  a ? a(x) : x
2289
2469
  );
2290
2470
  },
2291
- reset: y,
2292
- setError: v,
2293
- isLoading: L.isPending
2471
+ reset: p,
2472
+ setError: b,
2473
+ isLoading: F.isPending
2294
2474
  };
2295
- }, Fr = (e) => {
2296
- const { t } = V(), {
2475
+ }, Vr = (e) => {
2476
+ const { t } = R(), {
2297
2477
  onClick: s,
2298
- icon: r = Rs,
2299
- sticky: n = !0,
2300
- hidden: i = !1,
2478
+ icon: r = Os,
2479
+ sticky: i = !0,
2480
+ hidden: n = !1,
2301
2481
  multiple: a = !0,
2302
- disabled: c = !1,
2303
- id: l = Se.Delete,
2482
+ disabled: o = !1,
2483
+ id: l = Ee.Delete,
2304
2484
  tooltip: m = t("_pages:common.actions.delete.text")
2305
2485
  } = e;
2306
2486
  return {
2307
- action: $(
2487
+ action: D(
2308
2488
  (h) => ({
2309
2489
  id: l,
2310
- sticky: n,
2490
+ sticky: i,
2311
2491
  tooltip: m,
2312
2492
  multiple: a,
2313
2493
  onClick: () => s([h == null ? void 0 : h.id]),
2314
- hidden: !!h.deletedAt || i,
2315
- disabled: !!h.deletedAt || c,
2316
- icon: /* @__PURE__ */ b(le, { className: "text-bg-error", icon: r }),
2317
- onMultipleClick: (d) => s(d.map((y) => y.id))
2494
+ hidden: !!h.deletedAt || n,
2495
+ disabled: !!h.deletedAt || o,
2496
+ icon: /* @__PURE__ */ g(ue, { className: "text-bg-error", icon: r }),
2497
+ onMultipleClick: (d) => s(d.map((p) => p.id))
2318
2498
  }),
2319
- [c, i, r, l, a, s, n, m]
2499
+ [o, n, r, l, a, s, i, m]
2320
2500
  )
2321
2501
  };
2322
- }, $r = (e) => {
2323
- const { t } = V(), {
2502
+ }, Rr = (e) => {
2503
+ const { t } = R(), {
2324
2504
  onClick: s,
2325
2505
  sticky: r = !0,
2326
- hidden: n = !1,
2327
- disabled: i = !1,
2506
+ hidden: i = !1,
2507
+ disabled: n = !1,
2328
2508
  multiple: a = !1,
2329
- icon: c = Bt,
2330
- id: l = Se.Restore,
2509
+ icon: o = Wt,
2510
+ id: l = Ee.Restore,
2331
2511
  tooltip: m = t("_pages:common.actions.restore.text")
2332
2512
  } = e;
2333
2513
  return {
2334
- action: $(
2514
+ action: D(
2335
2515
  (h) => ({
2336
2516
  id: l,
2337
2517
  sticky: r,
2338
2518
  tooltip: m,
2339
2519
  multiple: a,
2340
2520
  onClick: () => s([h == null ? void 0 : h.id]),
2341
- hidden: !h.deletedAt || n,
2342
- disabled: !h.deletedAt || i,
2343
- icon: /* @__PURE__ */ b(le, { className: "text-bg-error", icon: c }),
2344
- onMultipleClick: (d) => s(d.map((y) => y.id))
2521
+ hidden: !h.deletedAt || i,
2522
+ disabled: !h.deletedAt || n,
2523
+ icon: /* @__PURE__ */ g(ue, { className: "text-bg-error", icon: o }),
2524
+ onMultipleClick: (d) => s(d.map((p) => p.id))
2345
2525
  }),
2346
- [i, n, c, l, a, s, r, m]
2526
+ [n, i, o, l, a, s, r, m]
2347
2527
  )
2348
2528
  };
2349
- }, An = (e) => {
2350
- const { t } = V(), {
2529
+ }, xn = (e) => {
2530
+ const { t } = R(), {
2351
2531
  onClick: s,
2352
2532
  hidden: r = !1,
2353
- sticky: n = !0,
2354
- disabled: i = !1,
2355
- id: a = Se.Edit,
2356
- icon: c = Ms,
2533
+ sticky: i = !0,
2534
+ disabled: n = !1,
2535
+ id: a = Ee.Edit,
2536
+ icon: o = Us,
2357
2537
  tooltip: l = t("_pages:common.actions.edit.text")
2358
2538
  } = e;
2359
2539
  return {
2360
- action: $(
2361
- (g) => ({
2540
+ action: D(
2541
+ (f) => ({
2362
2542
  id: a,
2363
- sticky: n,
2543
+ sticky: i,
2364
2544
  tooltip: l,
2365
- onClick: () => s(g == null ? void 0 : g.id),
2366
- hidden: !!g.deletedAt || r,
2367
- disabled: !!g.deletedAt || i,
2368
- icon: /* @__PURE__ */ b(le, { className: "primary", icon: c })
2545
+ onClick: () => s(f == null ? void 0 : f.id),
2546
+ hidden: !!f.deletedAt || r,
2547
+ disabled: !!f.deletedAt || n,
2548
+ icon: /* @__PURE__ */ g(ue, { className: "primary", icon: o })
2369
2549
  }),
2370
- [i, r, c, a, s, n, l]
2550
+ [n, r, o, a, s, i, l]
2371
2551
  )
2372
2552
  };
2373
2553
  };
2374
- var Se = /* @__PURE__ */ ((e) => (e.Add = "add", e.Edit = "edit", e.Delete = "delete", e.Restore = "restore", e.Refresh = "refresh", e.Export = "export", e.Import = "import", e))(Se || {});
2375
- const Lr = (e) => {
2376
- const { t } = V(), {
2554
+ var Ee = /* @__PURE__ */ ((e) => (e.Add = "add", e.Edit = "edit", e.Delete = "delete", e.Restore = "restore", e.Refresh = "refresh", e.Export = "export", e.Import = "import", e))(Ee || {});
2555
+ const Ir = (e) => {
2556
+ const { t } = R(), {
2377
2557
  onClick: s,
2378
2558
  hidden: r = !1,
2379
- disabled: n = !1,
2380
- isLoading: i = !1
2559
+ disabled: i = !1,
2560
+ isLoading: n = !1
2381
2561
  } = e;
2382
2562
  return {
2383
- action: $(
2563
+ action: D(
2384
2564
  () => ({
2385
- id: Se.Export,
2565
+ id: Ee.Export,
2386
2566
  hidden: r,
2387
- disabled: n,
2388
- icon: /* @__PURE__ */ b(
2389
- le,
2567
+ disabled: i,
2568
+ icon: /* @__PURE__ */ g(
2569
+ ue,
2390
2570
  {
2391
- className: `${i ? "rotate" : ""}`,
2392
- icon: i ? Ht : Us
2571
+ className: `${n ? "rotate" : ""}`,
2572
+ icon: n ? jt : Ks
2393
2573
  }
2394
2574
  ),
2395
2575
  tooltip: t("_pages:common.actions.export.text"),
2396
2576
  onClick: s
2397
2577
  }),
2398
- [n, r, i, s, t]
2578
+ [i, r, n, s, t]
2399
2579
  )
2400
2580
  };
2401
- }, Dr = (e) => {
2402
- const { t } = V(), {
2581
+ }, Pr = (e) => {
2582
+ const { t } = R(), {
2403
2583
  onClick: s,
2404
2584
  hidden: r = !1,
2405
- disabled: n = !1,
2406
- isLoading: i = !1
2585
+ disabled: i = !1,
2586
+ isLoading: n = !1
2407
2587
  } = e;
2408
2588
  return {
2409
- action: $(
2589
+ action: D(
2410
2590
  () => ({
2411
- id: Se.Import,
2591
+ id: Ee.Import,
2412
2592
  hidden: r,
2413
- disabled: n,
2414
- icon: /* @__PURE__ */ b(
2415
- le,
2593
+ disabled: i,
2594
+ icon: /* @__PURE__ */ g(
2595
+ ue,
2416
2596
  {
2417
- className: `${i ? "rotate" : ""}`,
2418
- icon: i ? Ht : qs
2597
+ className: `${n ? "rotate" : ""}`,
2598
+ icon: n ? jt : Bs
2419
2599
  }
2420
2600
  ),
2421
2601
  tooltip: t("_pages:common.actions.import.text"),
2422
2602
  onClick: s
2423
2603
  }),
2424
- [n, r, i, s, t]
2604
+ [i, r, n, s, t]
2425
2605
  )
2426
2606
  };
2427
- }, xn = (e) => {
2428
- const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: n } = Ne(), { t: i } = V(), { open: a, onClick: c, close: l, dialogFn: m, isLoading: g } = ts({
2429
- onSuccessMessage: i("_pages:common.actions.delete.successMessage"),
2607
+ }, An = (e) => {
2608
+ const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: i } = Ae(), { t: n } = R(), { open: a, onClick: o, close: l, dialogFn: m, isLoading: f } = ss({
2609
+ onSuccessMessage: n("_pages:common.actions.delete.successMessage"),
2430
2610
  onError: (d) => {
2431
- const y = d;
2432
- if (Ge(y))
2433
- n(
2434
- y.errors.map(
2435
- ([v, C]) => ({
2436
- message: i(`_pages:${v}.errors.${C}`),
2437
- type: z.error
2611
+ const p = d;
2612
+ if (Xe(p))
2613
+ i(
2614
+ p.errors.map(
2615
+ ([b, S]) => ({
2616
+ message: n(`_pages:${b}.errors.${S}`),
2617
+ type: J.error
2438
2618
  })
2439
2619
  )
2440
2620
  );
2441
- else if (ze(y)) {
2442
- const v = y.message || i("_accessibility:errors.500"), C = i(`_accessibility:errors.${y.status}`);
2443
- n([
2621
+ else if (Ze(p)) {
2622
+ const b = p.message || n("_accessibility:errors.500"), S = n(`_accessibility:errors.${p.status}`);
2623
+ i([
2444
2624
  {
2445
- message: C || v,
2446
- type: z.error
2625
+ message: S || b,
2626
+ type: J.error
2447
2627
  }
2448
2628
  ]);
2449
2629
  }
2450
2630
  },
2451
2631
  onSuccess: async (d) => {
2452
- await be.invalidateQueries({ queryKey: t }), s && s(d);
2632
+ await we.invalidateQueries({ queryKey: t }), s && s(d);
2453
2633
  },
2454
2634
  ...r
2455
- }), { action: h } = Fr({ onClick: c });
2635
+ }), { action: h } = Vr({ onClick: o });
2456
2636
  return {
2457
- onClick: c,
2458
- title: i("_pages:common.actions.delete.dialog.title"),
2637
+ onClick: o,
2638
+ title: n("_pages:common.actions.delete.dialog.title"),
2459
2639
  open: a,
2460
- isLoading: g,
2640
+ isLoading: f,
2461
2641
  handleSubmit: () => m.mutate(),
2462
2642
  handleClose: l,
2463
2643
  action: h
2464
2644
  };
2465
- }, us = () => {
2466
- const [e, t] = Y(!1);
2645
+ }, ds = () => {
2646
+ const [e, t] = X(!1);
2467
2647
  return { open: e, setOpen: t, handleClose: () => t(!1), handleOpen: () => t(!0) };
2468
- }, Tn = (e) => {
2469
- const { t } = V(), {
2648
+ }, Fn = (e) => {
2649
+ const { t } = R(), {
2470
2650
  showErrorNotification: s,
2471
2651
  showStackNotifications: r,
2472
- showSuccessNotification: n
2473
- } = Ne(), {
2474
- defaultValues: i,
2652
+ showSuccessNotification: i
2653
+ } = Ae(), {
2654
+ defaultValues: n,
2475
2655
  getFunction: a,
2476
- mutationFn: c,
2656
+ mutationFn: o,
2477
2657
  formToDto: l,
2478
2658
  dtoToForm: m,
2479
- onError: g,
2659
+ onError: f,
2480
2660
  onSuccess: h,
2481
2661
  queryKey: d,
2482
- onSuccessMessage: y,
2483
- title: v
2484
- } = e, [C, k] = Y(0), { open: q, handleClose: N, handleOpen: L } = us(), { control: x, handleSubmit: A, reset: I, setError: R, getValues: re, setValue: P } = ls({
2485
- defaultValues: i
2486
- }), { data: ne, isLoading: oe } = Ys({
2487
- queryFn: () => a == null ? void 0 : a(C),
2488
- queryKey: [...d, C],
2489
- enabled: !!a && !!d && !!C
2662
+ onSuccessMessage: p,
2663
+ title: b
2664
+ } = e, [S, E] = X(0), { open: N, handleClose: C, handleOpen: F } = ds(), { control: x, handleSubmit: A, reset: I, setError: O, getValues: re, setValue: P } = us({
2665
+ defaultValues: n
2666
+ }), { data: ne, isLoading: ce } = Xs({
2667
+ queryFn: () => a == null ? void 0 : a(S),
2668
+ queryKey: [...d, S],
2669
+ enabled: !!a && !!d && !!S
2490
2670
  });
2491
2671
  me(() => {
2492
2672
  ne && m && I({ ...m(ne) });
2493
2673
  }, [ne]);
2494
- const F = $(
2495
- (M) => {
2496
- const X = M == null ? void 0 : M.errors, ie = [];
2497
- return X && X.forEach(([ue, qe]) => {
2498
- const Ce = document.querySelector(`[name="${ue}"]`);
2499
- (Ce instanceof HTMLInputElement || Ce instanceof HTMLTextAreaElement || Ce instanceof HTMLSelectElement) && (Ce.focus(), Ce.classList.add("error"), ie.push(t(`_entities:${d}.${ue}.${qe}`)));
2674
+ const L = D(
2675
+ (U) => {
2676
+ const Z = U == null ? void 0 : U.errors, ie = [];
2677
+ return Z && Z.forEach(([de, He]) => {
2678
+ const _e = document.querySelector(`[name="${de}"]`);
2679
+ (_e instanceof HTMLInputElement || _e instanceof HTMLTextAreaElement || _e instanceof HTMLSelectElement) && (_e.focus(), _e.classList.add("error"), ie.push(t(`_entities:${d}.${de}.${He}`)));
2500
2680
  }), ie;
2501
2681
  },
2502
2682
  [t, d]
2503
- ), D = $(() => {
2504
- document.querySelectorAll("input, textarea, select").forEach((X) => {
2505
- X.classList.remove("error");
2683
+ ), V = D(() => {
2684
+ document.querySelectorAll("input, textarea, select").forEach((Z) => {
2685
+ Z.classList.remove("error");
2506
2686
  });
2507
- }, []), H = $(
2508
- (M) => {
2509
- k(M ?? 0), L();
2687
+ }, []), q = D(
2688
+ (U) => {
2689
+ E(U ?? 0), F();
2510
2690
  },
2511
- [L]
2512
- ), W = $(() => {
2513
- D(), N(), I();
2514
- }, [I, D, N]), J = Re({
2515
- mutationFn: c,
2516
- onError: (M) => {
2517
- if (console.error(M), g) g(M);
2691
+ [F]
2692
+ ), G = D(() => {
2693
+ V(), C(), I();
2694
+ }, [I, V, C]), Y = Ke({
2695
+ mutationFn: o,
2696
+ onError: (U) => {
2697
+ if (console.error(U), f) f(U);
2518
2698
  else {
2519
- const X = M;
2520
- if (Ge(X)) {
2521
- const ie = F(X);
2699
+ const Z = U;
2700
+ if (Xe(Z)) {
2701
+ const ie = L(Z);
2522
2702
  r(
2523
2703
  ie.map(
2524
- (ue) => ({
2525
- message: ue,
2526
- type: z.error
2704
+ (de) => ({
2705
+ message: de,
2706
+ type: J.error
2527
2707
  })
2528
2708
  )
2529
2709
  );
2530
- } else if (ze(X)) {
2531
- const ie = X.message || t("_accessibility:errors.500"), ue = t(`_accessibility:errors.${X.status}`);
2532
- s({ message: ue || ie });
2710
+ } else if (Ze(Z)) {
2711
+ const ie = Z.message || t("_accessibility:errors.500"), de = t(`_accessibility:errors.${Z.status}`);
2712
+ s({ message: de || ie });
2533
2713
  } else
2534
2714
  s({ message: t("_accessibility:errors.500") });
2535
2715
  }
2536
2716
  },
2537
- onSuccess: async (M) => {
2538
- await be.invalidateQueries({ queryKey: d }), h && h(M), n({
2539
- message: y
2540
- }), W();
2717
+ onSuccess: async (U) => {
2718
+ await we.invalidateQueries({ queryKey: d }), h && h(U), i({
2719
+ message: p
2720
+ }), G();
2541
2721
  }
2542
2722
  });
2543
2723
  return {
2544
- open: q,
2545
- openDialog: H,
2546
- handleClose: W,
2724
+ open: N,
2725
+ openDialog: q,
2726
+ handleClose: G,
2547
2727
  control: x,
2548
2728
  getValues: re,
2549
2729
  setValue: P,
2550
2730
  handleSubmit: A,
2551
- onSubmit: (M) => J.mutate(
2552
- l ? l(M) : M
2731
+ onSubmit: (U) => Y.mutate(
2732
+ l ? l(U) : U
2553
2733
  ),
2554
2734
  reset: I,
2555
- setError: R,
2556
- title: v,
2557
- isLoading: oe || J.isPending
2735
+ setError: O,
2736
+ title: b,
2737
+ isLoading: ce || Y.isPending
2558
2738
  };
2559
- }, Fn = (e) => {
2560
- const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: n } = Ne(), { t: i } = V(), { open: a, onClick: c, close: l, dialogFn: m, isLoading: g } = ts({
2561
- onSuccessMessage: i("_pages:common.actions.restore.successMessage"),
2739
+ }, $n = (e) => {
2740
+ const { queryKey: t, onSuccess: s, ...r } = e, { showStackNotifications: i } = Ae(), { t: n } = R(), { open: a, onClick: o, close: l, dialogFn: m, isLoading: f } = ss({
2741
+ onSuccessMessage: n("_pages:common.actions.restore.successMessage"),
2562
2742
  onError: (d) => {
2563
- const y = d;
2564
- if (Ge(y))
2565
- n(
2566
- y.errors.map(
2567
- ([v, C]) => ({
2568
- message: i(`_pages:${v}.errors.${C}`),
2569
- type: z.error
2743
+ const p = d;
2744
+ if (Xe(p))
2745
+ i(
2746
+ p.errors.map(
2747
+ ([b, S]) => ({
2748
+ message: n(`_pages:${b}.errors.${S}`),
2749
+ type: J.error
2570
2750
  })
2571
2751
  )
2572
2752
  );
2573
- else if (ze(y)) {
2574
- const v = y.message || i("_accessibility:errors.500"), C = i(`_accessibility:errors.${y.status}`);
2575
- n([
2753
+ else if (Ze(p)) {
2754
+ const b = p.message || n("_accessibility:errors.500"), S = n(`_accessibility:errors.${p.status}`);
2755
+ i([
2576
2756
  {
2577
- message: C || v,
2578
- type: z.error
2757
+ message: S || b,
2758
+ type: J.error
2579
2759
  }
2580
2760
  ]);
2581
2761
  }
2582
2762
  },
2583
2763
  onSuccess: async (d) => {
2584
- await be.invalidateQueries({ queryKey: t }), s && s(d);
2764
+ await we.invalidateQueries({ queryKey: t }), s && s(d);
2585
2765
  },
2586
2766
  ...r
2587
- }), { action: h } = $r({ onClick: c });
2767
+ }), { action: h } = Rr({ onClick: o });
2588
2768
  return {
2589
- onClick: c,
2590
- title: i("_pages:common.actions.restore.dialog.title"),
2769
+ onClick: o,
2770
+ title: n("_pages:common.actions.restore.dialog.title"),
2591
2771
  open: a,
2592
- isLoading: g,
2772
+ isLoading: f,
2593
2773
  handleSubmit: () => m.mutate(),
2594
2774
  handleClose: l,
2595
2775
  action: h
2596
2776
  };
2597
2777
  };
2598
- function $n(e) {
2599
- const { t } = V(), { queryKey: s, mutationFn: r, entity: n, fileProcessor: i, onError: a } = e, [c, l] = Y(!1), [m, g] = Y(null), [h, d] = Y(!1), y = Re({
2778
+ function Ln(e) {
2779
+ const { t } = R(), { queryKey: s, mutationFn: r, entity: i, fileProcessor: n, onError: a } = e, [o, l] = X(!1), [m, f] = X(null), [h, d] = X(!1), p = Ke({
2600
2780
  mutationFn: r,
2601
- onError: (C) => {
2602
- console.error(C), a == null || a(C);
2781
+ onError: (S) => {
2782
+ console.error(S), a == null || a(S);
2603
2783
  },
2604
2784
  onSuccess: async () => {
2605
- be && await be.invalidateQueries({ queryKey: s });
2785
+ we && await we.invalidateQueries({ queryKey: s });
2606
2786
  }
2607
- }), { action: v } = Dr({
2787
+ }), { action: b } = Pr({
2608
2788
  onClick: () => l(!0)
2609
2789
  });
2610
2790
  return {
2611
2791
  handleSubmit: async () => {
2612
2792
  if (!(!m || m.length === 0))
2613
2793
  try {
2614
- await y.mutateAsync({
2794
+ await p.mutateAsync({
2615
2795
  items: m,
2616
2796
  override: h
2617
- }), l(!1), g(null), d(!1);
2618
- } catch (C) {
2619
- console.error(C);
2797
+ }), l(!1), f(null), d(!1);
2798
+ } catch (S) {
2799
+ console.error(S);
2620
2800
  }
2621
2801
  },
2622
- isLoading: y.isPending,
2623
- fileProcessor: i,
2624
- onFileProcessed: (C) => g(C),
2625
- onOverrideChange: (C) => d(C),
2626
- open: c,
2802
+ isLoading: p.isPending,
2803
+ fileProcessor: n,
2804
+ onFileProcessed: (S) => f(S),
2805
+ onOverrideChange: (S) => d(S),
2806
+ open: o,
2627
2807
  title: t("_pages:common.actions.import.dialog.title", {
2628
- entity: t(`_pages:${n}.title`)
2808
+ entity: t(`_pages:${i}.title`)
2629
2809
  }),
2630
2810
  handleClose: () => {
2631
- l(!1), g(null);
2811
+ l(!1), f(null);
2632
2812
  },
2633
- action: v
2813
+ action: b
2634
2814
  };
2635
2815
  }
2636
- const Ln = (e) => {
2637
- const { showSuccessNotification: t } = Ne(), { t: s } = V(), {
2816
+ const Dn = (e) => {
2817
+ const { showSuccessNotification: t } = Ae(), { t: s } = R(), {
2638
2818
  entity: r,
2639
- mutationFn: n,
2640
- onError: i,
2819
+ mutationFn: i,
2820
+ onError: n,
2641
2821
  onSuccess: a,
2642
- onSuccessMessage: c = s("_pages:common.actions.export.successMessage")
2643
- } = e, l = Re({
2644
- mutationFn: () => n(),
2822
+ onSuccessMessage: o = s("_pages:common.actions.export.successMessage")
2823
+ } = e, l = Ke({
2824
+ mutationFn: () => i(),
2645
2825
  onError: (h) => {
2646
- console.error(h), i && i(h);
2826
+ console.error(h), n && n(h);
2647
2827
  },
2648
2828
  onSuccess: async (h) => {
2649
- const d = JSON.stringify(h, null, 2), y = new Blob([d], { type: "application/json" }), v = URL.createObjectURL(y), C = document.createElement("a");
2650
- C.href = v, C.download = `${r}.json`, C.click(), URL.revokeObjectURL(v), a && a(h), t({
2651
- message: c
2829
+ const d = JSON.stringify(h, null, 2), p = new Blob([d], { type: "application/json" }), b = URL.createObjectURL(p), S = document.createElement("a");
2830
+ S.href = b, S.download = `${r}.json`, S.click(), URL.revokeObjectURL(b), a && a(h), t({
2831
+ message: o
2652
2832
  });
2653
2833
  }
2654
- }), m = $(() => {
2834
+ }), m = D(() => {
2655
2835
  l.mutate();
2656
- }, [l]), { action: g } = Lr({
2836
+ }, [l]), { action: f } = Ir({
2657
2837
  onClick: m,
2658
2838
  isLoading: l.isPending
2659
2839
  });
2660
2840
  return {
2661
- action: g
2841
+ action: f
2662
2842
  };
2663
2843
  };
2664
- function Vr(e) {
2665
- const [t, s] = Y(!1), r = $(() => {
2666
- const n = window.scrollY > e;
2667
- s(n);
2844
+ function Mr(e) {
2845
+ const [t, s] = X(!1), r = D(() => {
2846
+ const i = window.scrollY > e;
2847
+ s(i);
2668
2848
  }, [e]);
2669
2849
  return me(() => (window.addEventListener("scroll", r), () => {
2670
2850
  window.removeEventListener("scroll", r);
2671
2851
  }), [r]), t;
2672
2852
  }
2673
- const Ir = (e) => {
2674
- const { showBackButton: t, title: s, actions: r } = e, { t: n } = V(), { navigate: i } = Me();
2675
- return /* @__PURE__ */ T("div", { className: "page-header", children: [
2676
- /* @__PURE__ */ T("div", { className: "page-header-left", children: [
2677
- t && /* @__PURE__ */ b(
2678
- _e,
2853
+ const Vn = () => {
2854
+ const { t: e } = R(), t = Mr(200);
2855
+ return /* @__PURE__ */ g(
2856
+ Te,
2857
+ {
2858
+ variant: "submit",
2859
+ color: "primary",
2860
+ icon: qs,
2861
+ "data-tooltip-id": "tooltip",
2862
+ onClick: () => dr.scrollTo(0, 0),
2863
+ className: `to-top ${t ? "show" : "hide"}`,
2864
+ "data-tooltip-content": e("_accessibility:buttons.toTop")
2865
+ }
2866
+ );
2867
+ };
2868
+ function Rn(e) {
2869
+ const { t } = R();
2870
+ if ("children" in e) {
2871
+ const { children: x, className: A } = e;
2872
+ return /* @__PURE__ */ g("div", { className: `error-container${A ? ` ${A}` : ""}`, children: x });
2873
+ }
2874
+ const {
2875
+ error: r,
2876
+ message: i,
2877
+ iconProps: n,
2878
+ onRetry: a,
2879
+ retryLabel: o,
2880
+ retryButtonProps: l,
2881
+ messageProps: m,
2882
+ className: f,
2883
+ resetErrorBoundary: h
2884
+ } = e, d = a ?? h, {
2885
+ className: p,
2886
+ children: b,
2887
+ onClick: S,
2888
+ ...E
2889
+ } = l ?? {}, { className: N, ...C } = m ?? {}, F = n !== null;
2890
+ return /* @__PURE__ */ $("div", { className: `error-container${f ? ` ${f}` : ""}`, children: [
2891
+ F && /* @__PURE__ */ g(
2892
+ ue,
2893
+ {
2894
+ ...n,
2895
+ icon: (n == null ? void 0 : n.icon) ?? Zs,
2896
+ className: `error-icon${n != null && n.className ? ` ${n.className}` : ""}`
2897
+ }
2898
+ ),
2899
+ /* @__PURE__ */ g(
2900
+ "p",
2901
+ {
2902
+ ...C,
2903
+ className: `error-message${N ? ` ${N}` : ""}`,
2904
+ children: i ?? (r == null ? void 0 : r.message) ?? t("_accessibility:errors.unknownError")
2905
+ }
2906
+ ),
2907
+ d && /* @__PURE__ */ g(
2908
+ ge,
2909
+ {
2910
+ type: "button",
2911
+ variant: "submit",
2912
+ color: "primary",
2913
+ ...E,
2914
+ className: `error-retry ${p ? ` ${p}` : ""}`,
2915
+ onClick: (x) => {
2916
+ S == null || S(x), x.defaultPrevented || d();
2917
+ },
2918
+ children: b ?? o ?? t("_accessibility:actions.retry", { defaultValue: "Retry" })
2919
+ }
2920
+ )
2921
+ ] });
2922
+ }
2923
+ const Or = (e) => {
2924
+ const { showBackButton: t, title: s, actions: r } = e, { t: i } = R(), { navigate: n } = Be();
2925
+ return /* @__PURE__ */ $("div", { className: "page-header", children: [
2926
+ /* @__PURE__ */ $("div", { className: "page-header-left", children: [
2927
+ t && /* @__PURE__ */ g(
2928
+ Te,
2679
2929
  {
2680
- icon: Bs,
2681
- onClick: () => i(-1),
2682
- name: n("_accessibility:buttons.back"),
2930
+ icon: Hs,
2931
+ onClick: () => n(-1),
2932
+ name: i("_accessibility:buttons.back"),
2683
2933
  "data-tooltip-id": "tooltip",
2684
- "data-tooltip-content": n("_accessibility:buttons.back")
2934
+ "data-tooltip-content": i("_accessibility:buttons.back")
2685
2935
  }
2686
2936
  ),
2687
- /* @__PURE__ */ b("h2", { className: "page-header-title", children: s })
2937
+ /* @__PURE__ */ g("h2", { className: "page-header-title", children: s })
2688
2938
  ] }),
2689
- /* @__PURE__ */ T("div", { children: [
2690
- /* @__PURE__ */ b(Ts, { className: "page-header-actions-desktop", actions: r ?? [] }),
2691
- /* @__PURE__ */ b(Fs, { className: "page-header-actions-mobile", actions: r ?? [] })
2939
+ /* @__PURE__ */ $("div", { children: [
2940
+ /* @__PURE__ */ g($s, { className: "page-header-actions-desktop", actions: r ?? [] }),
2941
+ /* @__PURE__ */ g(Ls, { className: "page-header-actions-mobile", actions: r ?? [] })
2692
2942
  ] })
2693
2943
  ] });
2694
- }, Dn = (e) => {
2944
+ }, In = (e) => {
2695
2945
  const {
2696
2946
  title: t,
2697
2947
  children: s,
2698
2948
  addOptions: r,
2699
- filterOptions: n,
2700
- actions: i,
2949
+ filterOptions: i,
2950
+ actions: n,
2701
2951
  queryKey: a,
2702
- isLoading: c = !1,
2952
+ isLoading: o = !1,
2703
2953
  isAnimated: l = !0,
2704
2954
  showBackButton: m = !1
2705
- } = e, { t: g } = V(), { countOfFilters: h } = $s(), d = ke(() => {
2706
- const y = Array.isArray(i) ? [...i] : [];
2955
+ } = e, { t: f } = R(), { countOfFilters: h } = Ds(), d = xe(() => {
2956
+ const p = Array.isArray(n) ? [...n] : [];
2707
2957
  if (a) {
2708
- const v = {
2709
- id: Se.Refresh,
2710
- onClick: () => be.invalidateQueries({ queryKey: a }),
2711
- icon: /* @__PURE__ */ b(le, { icon: Bt }),
2712
- tooltip: g("_pages:common.actions.refresh.text")
2958
+ const b = {
2959
+ id: Ee.Refresh,
2960
+ onClick: () => we.invalidateQueries({ queryKey: a }),
2961
+ icon: /* @__PURE__ */ g(ue, { icon: Wt }),
2962
+ tooltip: f("_pages:common.actions.refresh.text")
2713
2963
  };
2714
- y.unshift(v);
2964
+ p.unshift(b);
2715
2965
  }
2716
2966
  if (r) {
2717
- const v = {
2967
+ const b = {
2718
2968
  ...r,
2719
- id: Se.Add,
2720
- icon: /* @__PURE__ */ b(le, { icon: _t })
2969
+ id: Ee.Add,
2970
+ icon: /* @__PURE__ */ g(ue, { icon: Nt })
2721
2971
  };
2722
- y.unshift(v);
2972
+ p.unshift(b);
2723
2973
  }
2724
- if (n) {
2725
- const v = {
2726
- ...n,
2974
+ if (i) {
2975
+ const b = {
2976
+ ...i,
2727
2977
  id: "filter",
2728
- icon: /* @__PURE__ */ b(le, { icon: Hs }),
2729
- children: /* @__PURE__ */ b(
2730
- Ls,
2978
+ icon: /* @__PURE__ */ g(ue, { icon: Ws }),
2979
+ children: /* @__PURE__ */ g(
2980
+ Vs,
2731
2981
  {
2732
2982
  className: `${h > 0 ? "show" : "hide"} `,
2733
2983
  count: h
2734
2984
  }
2735
2985
  )
2736
2986
  };
2737
- y.push(v);
2987
+ p.push(b);
2738
2988
  }
2739
- return y;
2740
- }, [i, r, h, n, a, g]);
2741
- return /* @__PURE__ */ T("main", { className: "page-main", children: [
2742
- /* @__PURE__ */ b(
2743
- Ir,
2989
+ return p;
2990
+ }, [n, r, h, i, a, f]);
2991
+ return /* @__PURE__ */ $("main", { className: "page-main", children: [
2992
+ /* @__PURE__ */ g(
2993
+ Or,
2744
2994
  {
2745
2995
  showBackButton: m,
2746
2996
  actions: d,
2747
2997
  title: t
2748
2998
  }
2749
2999
  ),
2750
- /* @__PURE__ */ b("div", { className: `page-main-content ${l ? "appear" : ""}`, children: c ? /* @__PURE__ */ b(xe, { className: "page-loading" }) : s }),
2751
- r && /* @__PURE__ */ b(
2752
- _e,
3000
+ /* @__PURE__ */ g("div", { className: `page-main-content ${l ? "appear" : ""}`, children: o ? /* @__PURE__ */ g(Le, { className: "page-loading" }) : s }),
3001
+ r && /* @__PURE__ */ g(
3002
+ Te,
2753
3003
  {
2754
- icon: r.icon ?? _t,
3004
+ icon: r.icon ?? Nt,
2755
3005
  color: r.color ?? "primary",
2756
3006
  variant: r.variant ?? "submit",
2757
3007
  onClick: () => {
2758
- var y;
2759
- return (y = r.onClick) == null ? void 0 : y.call(r);
3008
+ var p;
3009
+ return (p = r.onClick) == null ? void 0 : p.call(r);
2760
3010
  },
2761
3011
  className: `button fab ${r.className ?? ""}`
2762
3012
  }
2763
3013
  )
2764
3014
  ] });
2765
- }, Vn = (e) => {
2766
- const { t } = V(), {
3015
+ }, Pn = (e) => {
3016
+ const { t } = R(), {
2767
3017
  className: s = "",
2768
3018
  itemClassName: r = "",
2769
- loading: n = !1,
2770
- emptyComponent: i = null,
3019
+ loading: i = !1,
3020
+ emptyComponent: n = null,
2771
3021
  emptyMessage: a = t("_accessibility:messages.empty"),
2772
- renderComponent: c,
3022
+ renderComponent: o,
2773
3023
  data: l = []
2774
3024
  } = e;
2775
- return n ? /* @__PURE__ */ b(xe, {}) : /* @__PURE__ */ b(Pe, { children: l != null && l.length ? /* @__PURE__ */ b("ul", { className: `pretty-grid-main ${s}`, children: l == null ? void 0 : l.map((m) => /* @__PURE__ */ b("li", { className: `pretty-grid-item ${r}`, children: c(m) }, m.id)) }) : /* @__PURE__ */ b(Pe, { children: i || /* @__PURE__ */ b(Kr, { message: a }) }) });
2776
- }, ds = Te({
3025
+ return i ? /* @__PURE__ */ g(Le, {}) : /* @__PURE__ */ g(Oe, { children: l != null && l.length ? /* @__PURE__ */ g("ul", { className: `pretty-grid-main ${s}`, children: l == null ? void 0 : l.map((m) => /* @__PURE__ */ g("li", { className: `pretty-grid-item ${r}`, children: o(m) }, m.id)) }) : /* @__PURE__ */ g(Oe, { children: n || /* @__PURE__ */ g(Qr, { message: a }) }) });
3026
+ }, fs = De({
2777
3027
  title: "",
2778
3028
  setTitle: () => {
2779
3029
  },
2780
3030
  rightContent: null,
2781
3031
  setRightContent: () => {
2782
3032
  }
2783
- }), In = (e) => {
2784
- const { children: t } = e, [s, r] = Y(""), [n, i] = Y(null), a = $((m) => {
3033
+ }), Mn = (e) => {
3034
+ const { children: t } = e, [s, r] = X(""), [i, n] = X(null), a = D((m) => {
2785
3035
  r(m);
2786
- }, []), c = $((m) => {
2787
- i(m);
2788
- }, []), l = ke(
3036
+ }, []), o = D((m) => {
3037
+ n(m);
3038
+ }, []), l = xe(
2789
3039
  () => ({
2790
3040
  title: s,
2791
3041
  setTitle: a,
2792
- rightContent: n,
2793
- setRightContent: c
3042
+ rightContent: i,
3043
+ setRightContent: o
2794
3044
  }),
2795
- [s, a, n, c]
3045
+ [s, a, i, o]
2796
3046
  );
2797
- return /* @__PURE__ */ b(ds.Provider, { value: l, children: t });
2798
- }, Pr = () => Fe(ds);
2799
- function Pn(e) {
2800
- const { t } = V(), { openDrawer: s, showSearch: r = !0, menuButtonProps: n } = e, { searchComponent: i, location: a } = Me(), { title: c, rightContent: l } = Pr(), [m, g] = Y(!1), h = $((y) => {
2801
- (ir() ? y.metaKey : y.ctrlKey) && y.shiftKey && y.key.toLowerCase() === "f" && (g(!0), y.preventDefault());
3047
+ return /* @__PURE__ */ g(fs.Provider, { value: l, children: t });
3048
+ }, Ur = () => Ve(fs);
3049
+ function On(e) {
3050
+ const { t } = R(), { openDrawer: s, showSearch: r = !0, menuButtonProps: i } = e, { searchComponent: n, location: a } = Be(), { title: o, rightContent: l } = Ur(), [m, f] = X(!1), h = D((p) => {
3051
+ (ar() ? p.metaKey : p.ctrlKey) && p.shiftKey && p.key.toLowerCase() === "f" && (f(!0), p.preventDefault());
2802
3052
  }, []);
2803
3053
  me(() => (window.addEventListener("keydown", h), () => {
2804
3054
  window.removeEventListener("keydown", h);
2805
3055
  }), [h]);
2806
- const d = i;
2807
- return /* @__PURE__ */ T(Pe, { children: [
2808
- a.pathname !== "/" && !!d && /* @__PURE__ */ b(d, { open: m, onClose: () => g(!1) }),
2809
- /* @__PURE__ */ T("header", { id: "header", className: "header", children: [
2810
- /* @__PURE__ */ T("div", { className: "navbar-left", children: [
2811
- /* @__PURE__ */ b(
2812
- _e,
3056
+ const d = n;
3057
+ return /* @__PURE__ */ $(Oe, { children: [
3058
+ a.pathname !== "/" && !!d && /* @__PURE__ */ g(d, { open: m, onClose: () => f(!1) }),
3059
+ /* @__PURE__ */ $("header", { id: "header", className: "header", children: [
3060
+ /* @__PURE__ */ $("div", { className: "navbar-left", children: [
3061
+ /* @__PURE__ */ g(
3062
+ Te,
2813
3063
  {
2814
- ...n,
2815
- type: (n == null ? void 0 : n.type) ?? "button",
2816
- icon: (n == null ? void 0 : n.icon) ?? js,
2817
- onClick: (y) => {
2818
- var v;
2819
- (v = n == null ? void 0 : n.onClick) == null || v.call(n, y), s();
3064
+ ...i,
3065
+ type: (i == null ? void 0 : i.type) ?? "button",
3066
+ icon: (i == null ? void 0 : i.icon) ?? js,
3067
+ onClick: (p) => {
3068
+ var b;
3069
+ (b = i == null ? void 0 : i.onClick) == null || b.call(i, p), s();
2820
3070
  },
2821
- name: (n == null ? void 0 : n.name) ?? t("_accessibility:buttons.openMenu"),
2822
- "aria-label": (n == null ? void 0 : n["aria-label"]) ?? t("_accessibility:ariaLabels.openMenu"),
2823
- className: `navbar-menu animated ${(n == null ? void 0 : n.className) ?? ""}`
3071
+ name: (i == null ? void 0 : i.name) ?? t("_accessibility:buttons.openMenu"),
3072
+ "aria-label": (i == null ? void 0 : i["aria-label"]) ?? t("_accessibility:ariaLabels.openMenu"),
3073
+ className: `navbar-menu animated ${(i == null ? void 0 : i.className) ?? ""}`
2824
3074
  }
2825
3075
  ),
2826
- /* @__PURE__ */ b("h1", { className: "poppins navbar-title", children: c || t("_pages:home.appName") })
3076
+ /* @__PURE__ */ g("h1", { className: "poppins navbar-title", children: o || t("_pages:home.appName") })
2827
3077
  ] }),
2828
- /* @__PURE__ */ T("div", { className: "navbar-right", children: [
3078
+ /* @__PURE__ */ $("div", { className: "navbar-right", children: [
2829
3079
  l,
2830
- r && /* @__PURE__ */ b(
2831
- _e,
3080
+ r && /* @__PURE__ */ g(
3081
+ Te,
2832
3082
  {
2833
- icon: Ks,
3083
+ icon: Qs,
2834
3084
  className: "navbar-search-btn",
2835
- onClick: () => g(!0)
3085
+ onClick: () => f(!0)
2836
3086
  }
2837
3087
  )
2838
3088
  ] })
2839
3089
  ] })
2840
3090
  ] });
2841
3091
  }
2842
- const _e = ({ icon: e, ...t }) => /* @__PURE__ */ b(Ds, { icon: /* @__PURE__ */ b(le, { icon: e }), ...t });
2843
- var rt, Rt;
2844
- function Or() {
2845
- if (Rt) return rt;
2846
- Rt = 1;
2847
- const e = (c, l = "local", m = void 0) => {
2848
- if (l === "local") {
2849
- if (localStorage.getItem(c) !== void 0 && localStorage.getItem(c) !== "undefined" && localStorage.getItem(c) !== null)
2850
- return m === void 0 || m !== void 0 && localStorage.getItem(c) === m;
2851
- } else if (l === "session" && sessionStorage.getItem(c) !== void 0 && sessionStorage.getItem(c) !== "undefined" && sessionStorage.getItem(c) !== null)
2852
- return m === void 0 || m !== void 0 && sessionStorage.getItem(c) === m;
2853
- return !1;
2854
- }, t = (c) => {
2855
- const l = {};
2856
- return c.substring(1).split("&").forEach((g) => {
2857
- const [h, d] = g.split("=");
2858
- l[h] = d;
2859
- }), l;
2860
- }, s = (c = "") => {
2861
- if (i(c) && c.length) return i(c);
2862
- {
2863
- let l = navigator.language || navigator.userLanguage;
2864
- if (l.indexOf("en") < 0 && l.indexOf("es") < 0 && (l = "en-US"), l = l.split("-")[0], l)
2865
- return c.length && n(c, 730, l), l;
2866
- }
2867
- return "en";
2868
- }, r = (c = 0, l = 0, m = window, g = "smooth") => m.scroll({
2869
- top: c,
2870
- left: l,
2871
- behavior: g
2872
- }), n = (c, l, m, g = "/", h = "Lax") => {
2873
- var d = /* @__PURE__ */ new Date();
2874
- d.setTime(d.getTime() + l * 24 * 60 * 60 * 1e3);
2875
- const y = "; expires=" + d.toUTCString();
2876
- document.cookie = `${c}=${m || ""}${y};path=${g};SameSite=${h}`;
2877
- }, i = (c) => {
2878
- const l = `${c}=`, g = decodeURIComponent(document.cookie).split(";");
2879
- for (let h = 0; h < g.length; h += 1) {
2880
- let d = g[h];
2881
- for (; d.charAt(0) === " "; )
2882
- d = d.substring(1);
2883
- if (d.indexOf(l) === 0)
2884
- return d.substring(l.length, d.length);
2885
- }
2886
- return "";
2887
- };
2888
- return rt = {
2889
- getCookie: i,
2890
- createCookie: n,
2891
- deleteCookie: (c) => document.cookie = `${c}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,
2892
- getUserLanguage: s,
2893
- scrollTo: r,
2894
- parseQueries: t,
2895
- validation: e
2896
- }, rt;
2897
- }
2898
- var Rr = Or();
2899
- const On = () => {
2900
- const { t: e } = V(), t = Vr(200);
2901
- return /* @__PURE__ */ b(
2902
- _e,
2903
- {
2904
- variant: "submit",
2905
- color: "primary",
2906
- icon: Qs,
2907
- "data-tooltip-id": "tooltip",
2908
- onClick: () => Rr.scrollTo(0, 0),
2909
- className: `to-top ${t ? "show" : "hide"}`,
2910
- "data-tooltip-content": e("_accessibility:buttons.toTop")
2911
- }
2912
- );
2913
- }, He = 300, Mr = (e) => e ?? z.error, Ur = (e) => {
3092
+ const je = 300, Kr = (e) => e ?? J.error, Br = (e) => {
2914
3093
  switch (e) {
2915
- case z.error:
2916
- return Gs;
3094
+ case J.error:
3095
+ return zs;
2917
3096
  default:
2918
- return Ws;
3097
+ return Gs;
2919
3098
  }
2920
- }, nt = (e) => {
3099
+ }, lt = (e) => {
2921
3100
  switch (e) {
2922
- case z.success:
3101
+ case J.success:
2923
3102
  return "!text-success";
2924
- case z.error:
3103
+ case J.error:
2925
3104
  return "!text-error";
2926
- case z.warning:
3105
+ case J.warning:
2927
3106
  return "!text-warning";
2928
3107
  default:
2929
3108
  return "!text-info";
2930
3109
  }
2931
3110
  }, qr = (e) => {
2932
3111
  switch (e) {
2933
- case z.success:
3112
+ case J.success:
2934
3113
  return "bg-bg-success";
2935
- case z.error:
3114
+ case J.error:
2936
3115
  return "bg-bg-error";
2937
- case z.warning:
3116
+ case J.warning:
2938
3117
  return "bg-bg-warning";
2939
3118
  default:
2940
3119
  return "bg-bg-info";
2941
3120
  }
2942
3121
  };
2943
- function Rn() {
2944
- const { t: e } = V(), { notification: t, removeNotification: s } = Ne(), [r, n] = Y([]), i = Oe(r);
3122
+ function Un() {
3123
+ const { t: e } = R(), { notification: t, removeNotification: s } = Ae(), [r, i] = X([]), n = Ue(r);
2945
3124
  Is(() => {
2946
- i.current = r;
3125
+ n.current = r;
2947
3126
  });
2948
- const a = Oe(null), c = $(
3127
+ const a = Ue(null), o = D(
2949
3128
  (l) => {
2950
- n(
2951
- (m) => l !== void 0 ? m.map((g) => g.id === l ? { ...g, closing: !0 } : g) : m.map((g) => ({ ...g, closing: !0 }))
3129
+ i(
3130
+ (m) => l !== void 0 ? m.map((f) => f.id === l ? { ...f, closing: !0 } : f) : m.map((f) => ({ ...f, closing: !0 }))
2952
3131
  ), l !== void 0 ? setTimeout(() => {
2953
- s(l), n((m) => m.filter((g) => g.id !== l));
2954
- }, He) : (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
2955
- s(), n([]), a.current = null;
2956
- }, He));
3132
+ s(l), i((m) => m.filter((f) => f.id !== l));
3133
+ }, je) : (a.current && clearTimeout(a.current), a.current = setTimeout(() => {
3134
+ s(), i([]), a.current = null;
3135
+ }, je));
2957
3136
  },
2958
3137
  [s]
2959
3138
  );
@@ -2963,73 +3142,73 @@ function Rn() {
2963
3142
  l && clearTimeout(l), a.current && (clearTimeout(a.current), a.current = null);
2964
3143
  };
2965
3144
  if (t.length === 0)
2966
- return i.current.length === 0 ? void 0 : (a.current && clearTimeout(a.current), l = setTimeout(() => {
2967
- n((y) => y.map((v) => ({ ...v, closing: !0 }))), l = null;
3145
+ return n.current.length === 0 ? void 0 : (a.current && clearTimeout(a.current), l = setTimeout(() => {
3146
+ i((p) => p.map((b) => ({ ...b, closing: !0 }))), l = null;
2968
3147
  }, 0), a.current = setTimeout(() => {
2969
- n([]), a.current = null;
2970
- }, He), m);
2971
- const g = new Set(i.current.map((y) => y.id));
3148
+ i([]), a.current = null;
3149
+ }, je), m);
3150
+ const f = new Set(n.current.map((p) => p.id));
2972
3151
  if (!t.some(
2973
- (y) => y.id !== void 0 && !g.has(y.id)
3152
+ (p) => p.id !== void 0 && !f.has(p.id)
2974
3153
  )) return;
2975
- if (i.current.length === 0) {
2976
- const y = [...t];
3154
+ if (n.current.length === 0) {
3155
+ const p = [...t];
2977
3156
  return l = setTimeout(() => {
2978
- n(y.map((v) => ({ ...v, closing: !1 }))), l = null;
3157
+ i(p.map((b) => ({ ...b, closing: !1 }))), l = null;
2979
3158
  }, 0), () => {
2980
3159
  l && clearTimeout(l);
2981
3160
  };
2982
3161
  }
2983
3162
  a.current && clearTimeout(a.current), l = setTimeout(() => {
2984
- n(
2985
- (y) => y.every((v) => v.closing) ? y : y.map((v) => ({ ...v, closing: !0 }))
3163
+ i(
3164
+ (p) => p.every((b) => b.closing) ? p : p.map((b) => ({ ...b, closing: !0 }))
2986
3165
  ), l = null;
2987
3166
  }, 0);
2988
3167
  const d = [...t];
2989
3168
  return a.current = setTimeout(() => {
2990
- n(d.map((y) => ({ ...y, closing: !1 }))), a.current = null;
2991
- }, He), m;
3169
+ i(d.map((p) => ({ ...p, closing: !1 }))), a.current = null;
3170
+ }, je), m;
2992
3171
  }, [t]), me(() => {
2993
3172
  if (!r.length) return;
2994
3173
  let l;
2995
3174
  const m = window.setTimeout(() => {
2996
- l = () => c(), window.addEventListener("click", l);
2997
- }, 0), g = (h) => {
2998
- h.key === "Escape" && c();
3175
+ l = () => o(), window.addEventListener("click", l);
3176
+ }, 0), f = (h) => {
3177
+ h.key === "Escape" && o();
2999
3178
  };
3000
- return window.addEventListener("keydown", g), () => {
3001
- window.clearTimeout(m), l && window.removeEventListener("click", l), window.removeEventListener("keydown", g);
3179
+ return window.addEventListener("keydown", f), () => {
3180
+ window.clearTimeout(m), l && window.removeEventListener("click", l), window.removeEventListener("keydown", f);
3002
3181
  };
3003
- }, [r.length, c]), jt(
3004
- /* @__PURE__ */ b("div", { className: `notification-portal ${r.length ? "active" : ""}`, children: r.map(({ id: l, type: m, message: g, closing: h }) => {
3005
- const d = Mr(m);
3006
- return /* @__PURE__ */ T(
3182
+ }, [r.length, o]), Qt(
3183
+ /* @__PURE__ */ g("div", { className: `notification-portal ${r.length ? "active" : ""}`, children: r.map(({ id: l, type: m, message: f, closing: h }) => {
3184
+ const d = Kr(m);
3185
+ return /* @__PURE__ */ $(
3007
3186
  "div",
3008
3187
  {
3009
3188
  className: `notification ${h ? "closing" : ""} ${qr(d)}`,
3010
- onClick: (y) => y.stopPropagation(),
3189
+ onClick: (p) => p.stopPropagation(),
3011
3190
  children: [
3012
- /* @__PURE__ */ T("div", { className: "notification-body", children: [
3013
- /* @__PURE__ */ b(
3014
- le,
3191
+ /* @__PURE__ */ $("div", { className: "notification-body", children: [
3192
+ /* @__PURE__ */ g(
3193
+ ue,
3015
3194
  {
3016
- icon: Ur(d),
3017
- className: `notification-icon ${nt(d)}`
3195
+ icon: Br(d),
3196
+ className: `notification-icon ${lt(d)}`
3018
3197
  }
3019
3198
  ),
3020
- /* @__PURE__ */ b("p", { className: `notification-text ${nt(d)}`, children: g })
3199
+ /* @__PURE__ */ g("p", { className: `notification-text ${lt(d)}`, children: f })
3021
3200
  ] }),
3022
- /* @__PURE__ */ b(
3023
- _e,
3201
+ /* @__PURE__ */ g(
3202
+ Te,
3024
3203
  {
3025
3204
  type: "button",
3026
- icon: qt,
3205
+ icon: Ht,
3027
3206
  color: "error",
3028
3207
  className: "notification-close group",
3029
- onClick: (y) => {
3030
- y.stopPropagation(), l !== void 0 && c(l);
3208
+ onClick: (p) => {
3209
+ p.stopPropagation(), l !== void 0 && o(l);
3031
3210
  },
3032
- iconClassName: `${nt(d)} notification-close-icon`,
3211
+ iconClassName: `${lt(d)} notification-close-icon`,
3033
3212
  name: e("_accessibility:buttons.closeNotification"),
3034
3213
  "aria-label": e("_accessibility:ariaLabels.closeNotification")
3035
3214
  }
@@ -3042,216 +3221,256 @@ function Rn() {
3042
3221
  document.body
3043
3222
  );
3044
3223
  }
3045
- function Mn(e) {
3224
+ function Kn(e) {
3046
3225
  const { className: t, ...s } = e;
3047
- return /* @__PURE__ */ b("div", { className: "splash-screen", children: /* @__PURE__ */ b(xe, { className: `blur-appear ${t ? ` ${t}` : ""}`, ...s }) });
3226
+ return /* @__PURE__ */ g("div", { className: "splash-screen", children: /* @__PURE__ */ g(Le, { className: `blur-appear ${t ? ` ${t}` : ""}`, ...s }) });
3048
3227
  }
3049
- const Br = (e) => {
3050
- const { id: t, active: s, onClick: r, children: n, to: i } = e, { linkComponent: a } = Me();
3051
- return /* @__PURE__ */ b(
3052
- a,
3228
+ const Hr = (e) => {
3229
+ const { id: t, active: s, onClick: r, children: i, to: n, useLinks: a = !0, tabButtonProps: o } = e, { linkComponent: l } = Be(), m = l;
3230
+ if (!a) {
3231
+ const {
3232
+ className: h = "",
3233
+ variant: d = s ? "submit" : "outlined",
3234
+ color: p = s ? "primary" : "default",
3235
+ ...b
3236
+ } = o ?? {};
3237
+ return /* @__PURE__ */ g(
3238
+ ge,
3239
+ {
3240
+ type: "button",
3241
+ variant: d,
3242
+ color: p,
3243
+ className: `tab ${h}`,
3244
+ onClick: r,
3245
+ ...b,
3246
+ children: i
3247
+ }
3248
+ );
3249
+ }
3250
+ const f = `button submit tab ${s ? "primary" : "outlined"} ${(o == null ? void 0 : o.className) ?? ""}`.trim();
3251
+ return /* @__PURE__ */ g(
3252
+ m,
3053
3253
  {
3054
- to: i ?? `#${t}`,
3254
+ to: n ?? `#${t}`,
3055
3255
  onClick: () => r(),
3056
- className: `button submit tab ${s ? "primary" : "outlined"}`,
3057
- children: n
3256
+ className: f,
3257
+ children: i
3058
3258
  }
3059
3259
  );
3060
- }, Hr = (e) => {
3061
- var l;
3260
+ }, Wr = (e) => {
3261
+ var p;
3062
3262
  const {
3063
3263
  tabs: t = [],
3064
3264
  defaultTab: s,
3065
- className: r = "",
3066
- tabsContainerClassName: n = ""
3067
- } = e, [i, a] = Y(s ?? ((l = t[0]) == null ? void 0 : l.id)), c = ke(() => t.find((m) => m.id === i), [t, i]);
3068
- return /* @__PURE__ */ T("div", { className: `tabs-layout-main ${r}`, children: [
3069
- /* @__PURE__ */ b(
3265
+ currentTab: r,
3266
+ onTabChange: i,
3267
+ className: n = "",
3268
+ tabsContainerClassName: a = "",
3269
+ useLinks: o = !0,
3270
+ tabButtonProps: l
3271
+ } = e, [m, f] = X(s ?? ((p = t[0]) == null ? void 0 : p.id)), h = r ?? m, d = xe(() => t.find((b) => b.id === h), [t, h]);
3272
+ return /* @__PURE__ */ $("div", { className: `tabs-layout-main ${n}`, children: [
3273
+ /* @__PURE__ */ g(
3070
3274
  "ul",
3071
3275
  {
3072
- className: `horizontal tabs tabs-container ${n}`,
3073
- children: t.map(({ id: m, to: g, label: h }) => /* @__PURE__ */ b("li", { children: /* @__PURE__ */ b(
3074
- Br,
3276
+ className: `horizontal tabs tabs-container ${a}`,
3277
+ children: t.map(({ id: b, to: S, label: E }) => /* @__PURE__ */ g("li", { children: /* @__PURE__ */ g(
3278
+ Hr,
3075
3279
  {
3076
- onClick: () => a(m),
3077
- id: m,
3078
- to: g ?? "",
3280
+ onClick: () => {
3281
+ f(b), i == null || i(b);
3282
+ },
3283
+ id: b,
3284
+ to: S ?? "",
3079
3285
  siblings: t.length > 1,
3080
- active: i === m,
3081
- children: h
3286
+ active: h === b,
3287
+ useLinks: o,
3288
+ tabButtonProps: l,
3289
+ children: E
3082
3290
  }
3083
- ) }, m))
3291
+ ) }, b))
3084
3292
  }
3085
3293
  ),
3086
- c == null ? void 0 : c.content
3294
+ d == null ? void 0 : d.content
3087
3295
  ] });
3088
3296
  }, jr = (e) => {
3089
3297
  const {
3090
- translation: t,
3091
- onClickNext: s,
3092
- image: r = "",
3093
- alt: n = "",
3094
- final: i = !1
3095
- } = e, { setGuestMode: a } = Xt(), { navigate: c } = Me(), { t: l } = V();
3096
- return /* @__PURE__ */ T("div", { className: "big-appear step-container", children: [
3097
- r && /* @__PURE__ */ b("img", { src: r, alt: n }),
3098
- /* @__PURE__ */ b("h2", { className: "step-title", children: l(`_pages:onboarding.${t}.title`) }),
3099
- /* @__PURE__ */ b("p", { className: "step-body", children: l(`_pages:onboarding.${t}.body`) }),
3100
- /* @__PURE__ */ b("div", { className: "step-actions", children: i ? /* @__PURE__ */ T(Pe, { children: [
3101
- /* @__PURE__ */ b(
3102
- ve,
3298
+ title: t,
3299
+ body: s,
3300
+ content: r,
3301
+ onClickNext: i,
3302
+ image: n = "",
3303
+ alt: a = "",
3304
+ final: o = !1
3305
+ } = e, { setGuestMode: l } = Zt(), { navigate: m } = Be(), { t: f } = R();
3306
+ return /* @__PURE__ */ $("div", { className: "big-appear step-container", children: [
3307
+ n && /* @__PURE__ */ g("img", { src: n, alt: a }),
3308
+ t != null && /* @__PURE__ */ g("h2", { className: "step-title", children: t }),
3309
+ s != null && /* @__PURE__ */ g("div", { className: "step-body", children: s }),
3310
+ r != null && /* @__PURE__ */ g("div", { className: "step-content", children: r }),
3311
+ /* @__PURE__ */ g("div", { className: "step-actions", children: o ? /* @__PURE__ */ $(Oe, { children: [
3312
+ /* @__PURE__ */ g(
3313
+ ge,
3103
3314
  {
3104
3315
  color: "primary",
3105
3316
  className: "step-button",
3106
3317
  variant: "outlined",
3107
3318
  onClick: () => {
3108
- a(!0), c("/");
3319
+ l(!0), m("/");
3109
3320
  },
3110
- "aria-label": l("_accessibility:ariaLabels.start"),
3111
- children: l("_accessibility:buttons.startAsGuest")
3321
+ "aria-label": f("_accessibility:ariaLabels.start"),
3322
+ children: f("_accessibility:buttons.startAsGuest")
3112
3323
  }
3113
3324
  ),
3114
- /* @__PURE__ */ b(
3115
- ve,
3325
+ /* @__PURE__ */ g(
3326
+ ge,
3116
3327
  {
3117
3328
  color: "primary",
3118
3329
  variant: "submit",
3119
3330
  className: "step-button",
3120
- "aria-label": l("_accessibility:ariaLabels.start"),
3121
- onClick: () => c("/auth/sign-in"),
3122
- children: l("_accessibility:buttons.signIn")
3331
+ "aria-label": f("_accessibility:ariaLabels.start"),
3332
+ onClick: () => m("/auth/sign-in"),
3333
+ children: f("_accessibility:buttons.signIn")
3123
3334
  }
3124
3335
  )
3125
- ] }) : /* @__PURE__ */ T(Pe, { children: [
3126
- /* @__PURE__ */ b(
3127
- ve,
3336
+ ] }) : /* @__PURE__ */ $(Oe, { children: [
3337
+ /* @__PURE__ */ g(
3338
+ ge,
3128
3339
  {
3129
3340
  color: "primary",
3130
3341
  className: "step-button",
3131
3342
  variant: "outlined",
3132
- onClick: () => c("/auth/sign-in"),
3133
- "aria-label": l("_accessibility:ariaLabels.skip"),
3134
- children: l("_accessibility:buttons.skip")
3343
+ onClick: () => m("/auth/sign-in"),
3344
+ "aria-label": f("_accessibility:ariaLabels.skip"),
3345
+ children: f("_accessibility:buttons.skip")
3135
3346
  }
3136
3347
  ),
3137
- /* @__PURE__ */ b(
3138
- ve,
3348
+ /* @__PURE__ */ g(
3349
+ ge,
3139
3350
  {
3140
3351
  color: "primary",
3141
3352
  className: "step-button",
3142
3353
  variant: "outlined",
3143
- onClick: () => s(),
3144
- "aria-label": l("_accessibility:ariaLabels.next"),
3145
- children: l("_accessibility:buttons.next")
3354
+ onClick: () => i(),
3355
+ "aria-label": f("_accessibility:ariaLabels.next"),
3356
+ children: f("_accessibility:buttons.next")
3146
3357
  }
3147
3358
  )
3148
3359
  ] }) })
3149
3360
  ] });
3150
- }, Un = (e) => {
3151
- const { steps: t } = e, [s, r] = Y(1), n = ke(() => t.map((i, a) => ({
3361
+ }, Bn = (e) => {
3362
+ const { steps: t } = e, [s, r] = X(1), i = xe(() => t.map((n, a) => ({
3152
3363
  id: a + 1,
3153
3364
  label: "",
3154
- content: /* @__PURE__ */ b(
3365
+ content: /* @__PURE__ */ g(
3155
3366
  jr,
3156
3367
  {
3157
- translation: i,
3368
+ ...n,
3158
3369
  final: a === t.length - 1,
3159
- onClickNext: () => r((c) => c + 1)
3370
+ onClickNext: () => r((o) => o + 1)
3160
3371
  }
3161
3372
  )
3162
3373
  })), [t]);
3163
- return /* @__PURE__ */ b("div", { className: "onboarding-main", children: /* @__PURE__ */ b(Hr, { defaultTab: s, tabs: n }) });
3164
- }, Kr = (e) => {
3374
+ return /* @__PURE__ */ g("div", { className: "onboarding-main", children: /* @__PURE__ */ g(
3375
+ Wr,
3376
+ {
3377
+ currentTab: s,
3378
+ onTabChange: (n) => r(Number(n)),
3379
+ tabs: i,
3380
+ useLinks: !1
3381
+ }
3382
+ ) });
3383
+ }, Qr = (e) => {
3165
3384
  const {
3166
3385
  message: t,
3167
3386
  messageProps: s = { className: "empty-message" },
3168
3387
  action: r,
3169
- iconProps: n
3388
+ iconProps: i
3170
3389
  } = e;
3171
- return /* @__PURE__ */ T("div", { className: "empty-container", children: [
3172
- n && /* @__PURE__ */ b(le, { ...n }),
3173
- /* @__PURE__ */ b("p", { ...s, children: t }),
3174
- r && /* @__PURE__ */ b(Vs, { showTooltips: !1, showText: !0, ...r })
3390
+ return /* @__PURE__ */ $("div", { className: "empty-container", children: [
3391
+ i && /* @__PURE__ */ g(ue, { ...i }),
3392
+ /* @__PURE__ */ g("p", { ...s, children: t }),
3393
+ r && /* @__PURE__ */ g(Rs, { showTooltips: !1, showText: !0, ...r })
3175
3394
  ] });
3176
3395
  };
3177
3396
  export {
3178
- Wt as APIClient,
3397
+ Ge as APIClient,
3179
3398
  jn as Action,
3180
- Kn as Actions,
3181
- Qn as ActionsDropdown,
3182
- _e as AppIconButton,
3183
- nr as AuthClient,
3184
- vn as AuthProvider,
3185
- dn as BaseClient,
3186
- Wn as Button,
3187
- Sn as ConfigProvider,
3188
- cn as ConfirmationDialog,
3189
- at as Dialog,
3190
- ot as DialogActions,
3191
- Cn as Drawer,
3192
- es as DrawerMenuContext,
3193
- _n as DrawerMenuProvider,
3194
- Kr as Empty,
3195
- En as Error,
3196
- nn as FormContainer,
3197
- on as FormDialog,
3198
- Se as GlobalActions,
3199
- un as IManager,
3200
- _e as IconButton,
3201
- ln as ImportDialog,
3202
- fn as IndexedDBClient,
3203
- wn as ManagerProvider,
3204
- se as Methods,
3205
- Pn as Navbar,
3206
- ds as NavbarContext,
3207
- In as NavbarProvider,
3208
- Rn as Notification,
3209
- z as NotificationEnumType,
3210
- pn as NotificationProvider,
3211
- Un as Onboarding,
3212
- Dn as Page,
3213
- rn as ParagraphInput,
3214
- an as PasswordInput,
3215
- Vn as PrettyGrid,
3216
- Mn as SplashScreen,
3399
+ Qn as Actions,
3400
+ Gn as ActionsDropdown,
3401
+ Te as AppIconButton,
3402
+ ir as AuthClient,
3403
+ Sn as AuthProvider,
3404
+ hn as BaseClient,
3405
+ zn as Button,
3406
+ Tn as ConfigProvider,
3407
+ un as ConfirmationDialog,
3408
+ dt as Dialog,
3409
+ ft as DialogActions,
3410
+ _n as Drawer,
3411
+ ts as DrawerMenuContext,
3412
+ En as DrawerMenuProvider,
3413
+ Qr as Empty,
3414
+ Rn as Error,
3415
+ on as FormContainer,
3416
+ ln as FormDialog,
3417
+ Ee as GlobalActions,
3418
+ fn as IManager,
3419
+ Te as IconButton,
3420
+ dn as ImportDialog,
3421
+ mn as IndexedDBClient,
3422
+ kn as ManagerProvider,
3423
+ ee as Methods,
3424
+ On as Navbar,
3425
+ fs as NavbarContext,
3426
+ Mn as NavbarProvider,
3427
+ Un as Notification,
3428
+ J as NotificationEnumType,
3429
+ vn as NotificationProvider,
3430
+ Bn as Onboarding,
3431
+ In as Page,
3432
+ an as ParagraphInput,
3433
+ cn as PasswordInput,
3434
+ Pn as PrettyGrid,
3435
+ Kn as SplashScreen,
3217
3436
  jr as Step,
3218
- Br as Tab,
3219
- Hr as TabsLayout,
3220
- On as ToTop,
3221
- rr as buildQueryUrl,
3222
- mn as enumToKeyValueArray,
3223
- yn as formatForDatetimeLocal,
3224
- Gt as fromLocal,
3225
- hn as getFormattedDateTime,
3226
- gn as getShortFormattedDateTime,
3227
- ze as isHttpError,
3228
- ir as isMac,
3229
- Ge as isValidationError,
3230
- $e as makeRequest,
3231
- bn as mapValidationErrors,
3232
- Qt as parseQueries,
3233
- be as queryClient,
3234
- kt as removeFromLocal,
3235
- Et as toLocal,
3236
- Xt as useAuth,
3237
- Me as useConfig,
3238
- ts as useConfirmationForm,
3239
- Fr as useDeleteAction,
3240
- xn as useDeleteDialog,
3241
- us as useDialog,
3242
- or as useDrawerMenu,
3243
- An as useEditAction,
3244
- Lr as useExportAction,
3245
- Ln as useExportActionMutate,
3246
- Tn as useFormDialog,
3247
- Dr as useImportAction,
3248
- $n as useImportDialog,
3249
- ar as useManager,
3250
- Pr as useNavbar,
3251
- Ne as useNotification,
3437
+ Hr as Tab,
3438
+ Wr as TabsLayout,
3439
+ Vn as ToTop,
3440
+ nr as buildQueryUrl,
3441
+ yn as enumToKeyValueArray,
3442
+ bn as formatForDatetimeLocal,
3443
+ Ce as fromLocal,
3444
+ gn as getFormattedDateTime,
3445
+ pn as getShortFormattedDateTime,
3446
+ Ze as isHttpError,
3447
+ ar as isMac,
3448
+ Xe as isValidationError,
3449
+ at as makeRequest,
3450
+ wn as mapValidationErrors,
3451
+ zt as parseQueries,
3452
+ we as queryClient,
3453
+ oe as removeFromLocal,
3454
+ ke as toLocal,
3455
+ Zt as useAuth,
3456
+ Be as useConfig,
3457
+ ss as useConfirmationForm,
3458
+ Vr as useDeleteAction,
3459
+ An as useDeleteDialog,
3460
+ ds as useDialog,
3461
+ lr as useDrawerMenu,
3462
+ xn as useEditAction,
3463
+ Ir as useExportAction,
3464
+ Dn as useExportActionMutate,
3465
+ Fn as useFormDialog,
3466
+ Pr as useImportAction,
3467
+ Ln as useImportDialog,
3468
+ or as useManager,
3469
+ Ur as useNavbar,
3470
+ Ae as useNotification,
3252
3471
  Nn as usePostForm,
3253
- $r as useRestoreAction,
3254
- Fn as useRestoreDialog,
3255
- Vr as useScrollTrigger,
3256
- kn as useTimeAge
3472
+ Rr as useRestoreAction,
3473
+ $n as useRestoreDialog,
3474
+ Mr as useScrollTrigger,
3475
+ Cn as useTimeAge
3257
3476
  };