@sito/dashboard-app 0.0.53 → 0.0.54

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