@dakataa/crud-react 1.0.7 → 1.0.10

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,33 +1,33 @@
1
- import { jsx as o, jsxs as _, Fragment as P } from "react/jsx-runtime";
2
- import H, { convertObjectToURLSearchParams as An, convertURLSearchParamsToObject as dt, Method as Ve, InterceptEvent as xe, RequestBodyType as ut, convertFormDataToObject as Pn } from "@dakataa/requester";
3
- import * as ie from "react";
4
- import v, { useState as R, memo as Z, useEffect as N, forwardRef as X, useRef as O, useImperativeHandle as ye, useReducer as Y, useId as Ee, useCallback as Ln, Fragment as Oe, Children as On, createRef as Sn } from "react";
5
- import { createPortal as Rn } from "react-dom";
6
- import kn from "lottie-web/build/player/esm/lottie.min.js";
7
- import * as Qe from "@popperjs/core";
8
- class mt {
1
+ import { jsx as r, jsxs as C, Fragment as A } from "react/jsx-runtime";
2
+ import G, { convertObjectToURLSearchParams as Sn, convertURLSearchParamsToObject as ht, convertFormDataToObject as $e, Method as qe, InterceptEvent as we, RequestBodyType as pt } from "@dakataa/requester";
3
+ import * as ce from "react";
4
+ import v, { useState as R, memo as ue, useEffect as N, useRef as O, useImperativeHandle as fe, useReducer as z, useId as _e, useCallback as kn, Fragment as ke, forwardRef as He, createElement as tt, Children as Dn, createRef as Rn } from "react";
5
+ import { createPortal as Tn } from "react-dom";
6
+ import In from "lottie-web/build/player/esm/lottie.min.js";
7
+ import * as nt from "@popperjs/core";
8
+ class gt {
9
9
  code;
10
10
  detail;
11
11
  trace;
12
- constructor(t = 0, n, r) {
13
- this.code = t, this.detail = n, this.trace = r;
12
+ constructor(t = 0, n, o) {
13
+ this.code = t, this.detail = n, this.trace = o;
14
14
  }
15
15
  }
16
- class Be extends mt {
16
+ class Ke extends gt {
17
17
  status = 400;
18
- constructor(t, n, r) {
19
- super(0, n, r), this.status = t;
18
+ constructor(t, n, o) {
19
+ super(0, n, o), this.status = t;
20
20
  }
21
21
  }
22
- const ft = ie.createContext(void 0);
23
- function pt() {
24
- return ie.useContext(ft);
22
+ const bt = ce.createContext(void 0);
23
+ function yt() {
24
+ return ce.useContext(bt);
25
25
  }
26
- function Dn({ ...e }) {
26
+ function Fn({ ...e }) {
27
27
  const [t, n] = R(!1);
28
- return /* @__PURE__ */ o(ft.Provider, { value: { defaultPrevented: t, setPreventDefault: n }, children: e.children });
28
+ return /* @__PURE__ */ r(bt.Provider, { value: { defaultPrevented: t, setPreventDefault: n }, children: e.children });
29
29
  }
30
- class Tn extends ie.Component {
30
+ class jn extends ce.Component {
31
31
  constructor(t) {
32
32
  super(t), this.state = {
33
33
  hasError: !1,
@@ -48,7 +48,7 @@ class Tn extends ie.Component {
48
48
  window.removeEventListener("unhandledrejection", this.promiseRejectionHandler);
49
49
  }
50
50
  static getDerivedStateFromError(t) {
51
- return t instanceof Error && (t = new Be(0, t.message)), {
51
+ return t instanceof Error && (t = new Ke(0, t.message)), {
52
52
  hasError: !0,
53
53
  error: t
54
54
  };
@@ -56,11 +56,11 @@ class Tn extends ie.Component {
56
56
  componentDidCatch(t, n) {
57
57
  console.log("error", t);
58
58
  }
59
- componentDidUpdate(t, n, r) {
59
+ componentDidUpdate(t, n, o) {
60
60
  this.state.error?.detail !== n.error?.detail && this.state.hasError && !this.props.defaultPrevented && this.props.fallback instanceof Function && this.props.fallback(this.state.error);
61
61
  }
62
62
  render() {
63
- return this.state.hasError && !this.props.defaultPrevented && this.props.fallback && ie.isValidElement(this.props.fallback) ? ie.cloneElement(
63
+ return this.state.hasError && !this.props.defaultPrevented && this.props.fallback && ce.isValidElement(this.props.fallback) ? ce.cloneElement(
64
64
  this.props.fallback,
65
65
  {
66
66
  error: this.state.error,
@@ -69,28 +69,32 @@ class Tn extends ie.Component {
69
69
  ) : this.props.children;
70
70
  }
71
71
  }
72
- const In = ({ children: e, ...t }) => {
73
- const n = pt();
74
- return /* @__PURE__ */ o(Tn, { ...t, defaultPrevented: n?.defaultPrevented || !1, children: e });
75
- }, ht = ({ children: e, ...t }) => {
76
- const n = pt();
77
- return /* @__PURE__ */ o(Dn, { children: /* @__PURE__ */ o(In, { ...t, parentErrorBoundaryContext: n, children: e }) });
78
- }, gt = Z(({ children: e }) => /* @__PURE__ */ o("div", { className: "crud", children: e })), jn = Z(({ error: e }) => /* @__PURE__ */ o(gt, { children: /* @__PURE__ */ o("main", { children: /* @__PURE__ */ _("div", { className: "content d-flex flex-column", children: [
79
- /* @__PURE__ */ o("h1", { className: "display-1", children: e?.status || e.name || "Error" }),
80
- /* @__PURE__ */ o("p", { className: "text-secondary", children: e?.detail || "Unknown Error" }),
81
- /* @__PURE__ */ o("br", {}),
82
- /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("a", { className: "btn btn-primary", href: "#", children: "Back to home" }) })
72
+ const Mn = ({ children: e, ...t }) => {
73
+ const n = yt();
74
+ return /* @__PURE__ */ r(jn, { ...t, defaultPrevented: n?.defaultPrevented || !1, children: e });
75
+ }, vt = ({ children: e, ...t }) => {
76
+ const n = yt();
77
+ return /* @__PURE__ */ r(Fn, { children: /* @__PURE__ */ r(Mn, { ...t, parentErrorBoundaryContext: n, children: e }) });
78
+ }, Et = ue(({ children: e }) => /* @__PURE__ */ r("div", { className: "crud", children: e })), Un = ue(({ error: e }) => /* @__PURE__ */ r(Et, { children: /* @__PURE__ */ r("main", { children: /* @__PURE__ */ C("div", { className: "content d-flex flex-column", children: [
79
+ /* @__PURE__ */ r("h1", { className: "display-1", children: e?.status || e.name || "Error" }),
80
+ /* @__PURE__ */ r("p", { className: "text-secondary", children: e?.detail || "Unknown Error" }),
81
+ /* @__PURE__ */ r("br", {}),
82
+ /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("a", { className: "btn btn-primary", href: "#", children: "Back to home" }) })
83
83
  ] }) }) }));
84
- var bt = /* @__PURE__ */ ((e) => (e.PROD = "prod", e.DEV = "dev", e.TEST = "test", e))(bt || {});
85
- const vt = v.createContext({
84
+ var Ct = /* @__PURE__ */ ((e) => (e.PROD = "prod", e.DEV = "dev", e.TEST = "test", e))(Ct || {});
85
+ const _t = v.createContext({
86
86
  env: "prod"
87
87
  /* PROD */
88
88
  });
89
- function le() {
90
- return v.useContext(vt);
89
+ function te() {
90
+ return v.useContext(_t);
91
91
  }
92
- function Fn({ config: e, ...t }) {
93
- return /* @__PURE__ */ o(vt.Provider, { value: e, children: t.children });
92
+ function Vn({ config: e, ...t }) {
93
+ const n = te();
94
+ return /* @__PURE__ */ r(_t.Provider, { value: {
95
+ ...n || {},
96
+ ...e
97
+ }, children: t.children });
94
98
  }
95
99
  window.history.pushState = new Proxy(window.history.pushState, {
96
100
  apply: (e, t, n) => {
@@ -102,79 +106,79 @@ window.history.replaceState = new Proxy(window.history.replaceState, {
102
106
  e.apply(t, n), window.dispatchEvent(new Event("replacestate"));
103
107
  }
104
108
  });
105
- const Ze = "actions", yt = v.createContext(void 0);
106
- function T() {
107
- const e = v.useContext(yt);
109
+ const rt = "actions", xt = v.createContext(void 0);
110
+ function M() {
111
+ const e = v.useContext(xt);
108
112
  if (!e)
109
113
  throw new Error("UseActions must be used in ActionProvider");
110
- const t = le(), { actions: n, location: r } = e, s = (d, b, p) => n?.filter((x) => x.entity === d && x.name === b && (p === void 0 || x.namespace === p)).shift(), i = (d) => {
114
+ const t = te(), { actions: n, location: o } = e, s = (d, g, h) => n?.filter((x) => x.entity === d && x.name === g && (h === void 0 || x.namespace === h)).shift(), i = (d) => {
111
115
  if (n)
112
- return n.find((b) => b.route?.path && f(b.route.path, d)) ?? null;
116
+ return n.find((g) => g.route?.path && y(g.route.path, d)) ?? null;
113
117
  }, a = (d) => {
114
- const b = i(d);
115
- if (!b)
116
- return b;
117
- const p = f(b.route?.path || "", d);
118
+ const g = i(d);
119
+ if (!g)
120
+ return g;
121
+ const h = y(g.route?.path || "", d);
118
122
  return {
119
- action: b,
120
- parameters: p?.params,
121
- query: p?.query
123
+ action: g,
124
+ parameters: h?.params,
125
+ query: h?.query
122
126
  };
123
- }, l = (d) => d.replaceAll(new RegExp("{(.*?)}", "gi"), ":$1"), c = (d, b, p) => m(l(d), b, p), u = (d, b, p) => d ? c(d.path, { ...d.defaults || {}, ...b }, p) : "#", g = (d) => {
124
- const b = s(d.action.entity, d.action.name, d.action.namespace);
125
- return u(b?.route, d.parameters, d.query);
126
- }, h = (d, b, p) => u(d, b, p), y = (d) => (t.link?.prefix && (d = "/" + t.link.prefix.replaceAll(new RegExp("^/|/$", "g"), "") + d), d), E = (d) => (t.link?.prefix && (d = d.replace(new RegExp("^/" + t.link.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), d), C = (d, b) => {
127
+ }, c = (d) => d.replaceAll(new RegExp("{(.*?)}", "gi"), ":$1"), f = (d, g, h) => l(c(d), g, h), u = (d, g, h) => d ? f(d.path, { ...d.defaults || {}, ...g }, h) : "#", p = (d) => {
128
+ const g = s(d.action.entity, d.action.name, d.action.namespace);
129
+ return u(g?.route, d.parameters, d.query);
130
+ }, m = (d, g, h) => u(d, g, h), b = (d) => (t.link?.prefix && (d = "/" + t.link.prefix.replaceAll(new RegExp("^/|/$", "g"), "") + d), d), E = (d) => (t.link?.prefix && (d = d.replace(new RegExp("^/" + t.link.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), d), _ = (d, g) => {
127
131
  try {
128
- b ? history.replaceState(null, "", d) : history.pushState(null, "", d);
132
+ g ? history.replaceState(null, "", d) : history.pushState(null, "", d);
129
133
  } catch {
130
134
  window.location.assign(d);
131
135
  }
132
- }, f = (d, b) => {
133
- const p = new URL(b, r.origin), x = E(p.pathname), w = "^" + d.replace(new RegExp("/[{:](\\w+)}?", "g"), "[/]?(?<$1>[^/]+)?").replace("*", ".*") + "$";
134
- if (!new RegExp(w, "giu").test(x))
136
+ }, y = (d, g) => {
137
+ const h = new URL(g, o.origin), x = E(h.pathname), P = "^" + d.replace(new RegExp("/[{:](\\w+)}?", "g"), "[/]?(?<$1>[^/]+)?").replace("*", ".*") + "$";
138
+ if (!new RegExp(P, "giu").test(x))
135
139
  return null;
136
- const I = x.matchAll(new RegExp(w, "giu"))?.next().value?.groups, oe = dt(p.searchParams);
140
+ const L = x.matchAll(new RegExp(P, "giu"))?.next().value?.groups, I = ht(h.searchParams);
137
141
  return {
138
142
  pathname: x,
139
- params: I,
140
- query: oe,
143
+ params: L,
144
+ query: I,
141
145
  pattern: d
142
146
  };
143
- }, m = (d, b, p) => {
144
- const x = d.replaceAll(new RegExp("[{:](\\w+)}?", "g"), (S, I) => {
145
- const oe = b?.[I];
146
- return oe !== void 0 && delete b?.[I], oe ?? "";
147
- }).replace(new RegExp("/$", "g"), ""), w = new URL(x, r.origin);
148
- return An(p || {}).entries().forEach(([S, I]) => {
149
- w.searchParams.set(S, I);
150
- }), y(w.pathname + w.search);
147
+ }, l = (d, g, h) => {
148
+ const x = d.replaceAll(new RegExp("[{:](\\w+)}?", "g"), (S, L) => {
149
+ const I = g?.[L];
150
+ return I !== void 0 && delete g?.[L], I ?? "";
151
+ }).replace(new RegExp("/$", "g"), ""), P = new URL(x, o.origin);
152
+ return Sn(h || {}).entries().forEach(([S, L]) => {
153
+ P.searchParams.set(S, L);
154
+ }), b(P.pathname + P.search);
151
155
  };
152
156
  return {
153
157
  getAction: s,
154
158
  getActionByPath: i,
155
159
  getOnClickActionByPath: a,
156
- navigate: C,
160
+ navigate: _,
157
161
  actions: n,
158
- location: r,
159
- matchPath: f,
162
+ location: o,
163
+ matchPath: y,
160
164
  generateRoute: u,
161
- generateRoutePath: c,
162
- crudToReactPathPattern: l,
163
- generateActionLink: g,
164
- generateLink: h,
165
- generatePath: m,
166
- internalToExternalPath: y,
165
+ generateRoutePath: f,
166
+ crudToReactPathPattern: c,
167
+ generateActionLink: p,
168
+ generateLink: m,
169
+ generatePath: l,
170
+ internalToExternalPath: b,
167
171
  externalToInternalPath: E
168
172
  };
169
173
  }
170
- function Et(e) {
174
+ function Nt(e) {
171
175
  let t = null;
172
176
  try {
173
- const a = sessionStorage.getItem(Ze);
177
+ const a = sessionStorage.getItem(rt);
174
178
  t = JSON.parse(atob(a || ""));
175
179
  } catch {
176
180
  }
177
- const [n, r] = R(t), [s, i] = R(new URL(document.location.href));
181
+ const [n, o] = R(t), [s, i] = R(new URL(document.location.href));
178
182
  return N(() => {
179
183
  const a = (() => {
180
184
  i(new URL(document.location.href));
@@ -183,171 +187,179 @@ function Et(e) {
183
187
  window.removeEventListener("pushstate", a), window.removeEventListener("replacestate", a), window.removeEventListener("popstate", a);
184
188
  };
185
189
  }, []), N(() => {
186
- t || ce().get({ url: "/_crud/actions" }).then(({ status: a, data: l }) => {
187
- a === 200 && (sessionStorage.setItem(Ze, btoa(JSON.stringify(l))), r(l));
190
+ t || de().get({ url: "/_crud/actions" }).then(({ status: a, data: c }) => {
191
+ a === 200 && (sessionStorage.setItem(rt, btoa(JSON.stringify(c))), o(c));
188
192
  }).catch((a) => {
189
193
  console.log("error", a);
190
194
  }).finally(() => {
191
195
  });
192
- }, []), /* @__PURE__ */ o(yt.Provider, { value: {
196
+ }, []), /* @__PURE__ */ r(xt.Provider, { value: {
193
197
  actions: n,
194
198
  location: s,
195
199
  setLocation: i
196
200
  }, children: e.children });
197
201
  }
198
- function Ro(e) {
199
- return (t) => /* @__PURE__ */ o(Et, { children: /* @__PURE__ */ o(e, { ...t }) });
202
+ function Io(e) {
203
+ return (t) => /* @__PURE__ */ r(Nt, { children: /* @__PURE__ */ r(e, { ...t }) });
200
204
  }
201
- var A = /* @__PURE__ */ ((e) => (e.Form = "form", e.Input = "input", e.Money = "money", e.Hidden = "hidden", e.Number = "number", e.Text = "text", e.Tel = "tel", e.Checkbox = "checkbox", e.Radio = "radio", e.Integer = "integer", e.Password = "password", e.Email = "email", e.Choice = "choice", e.Enum = "enum", e.Entity = "entity", e.Collection = "collection", e.Repeated = "repeated", e.Datetime = "datetime", e.Date = "date", e.Time = "time", e.Birthday = "birthday", e))(A || {});
202
- const Ct = v.createContext(void 0);
203
- function de() {
204
- const e = v.useContext(Ct);
205
+ var w = /* @__PURE__ */ ((e) => (e.Form = "form", e.Input = "input", e.Money = "money", e.Hidden = "hidden", e.Number = "number", e.Text = "text", e.Tel = "tel", e.Checkbox = "checkbox", e.Radio = "radio", e.Integer = "integer", e.Password = "password", e.Email = "email", e.Choice = "choice", e.Enum = "enum", e.Entity = "entity", e.Collection = "collection", e.Repeated = "repeated", e.Datetime = "datetime", e.Date = "date", e.Time = "time", e.Currency = "currency", e.Language = "language", e.Birthday = "birthday", e))(w || {});
206
+ const wt = v.createContext(void 0);
207
+ function me() {
208
+ const e = v.useContext(wt);
205
209
  if (!e)
206
210
  throw new Error("useForm must be used in Form");
207
211
  return e;
208
212
  }
209
- const Ce = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").replace(/([a-zA-Z])(?=[A-Z])/g, "$1_") + (t ?? "")).toLowerCase(), _t = X(({
213
+ const xe = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").replace(/([a-zA-Z])(?=[A-Z])/g, "$1_") + (t ?? "")).toLowerCase(), At = ({
210
214
  id: e,
211
215
  children: t,
212
216
  data: n,
213
- onError: r,
217
+ onError: o,
214
218
  onBeforeSubmit: s,
215
219
  onSubmit: i,
216
220
  onReset: a,
217
- ...l
218
- }, c) => {
219
- const u = O(null), g = {
221
+ ref: c,
222
+ ...f
223
+ }) => {
224
+ const u = O(null), p = {
220
225
  response: null,
221
226
  constraints: {},
222
227
  errors: {}
223
- }, h = (m, d) => {
224
- const b = u.current?.elements.namedItem(m);
225
- if (!b) {
226
- console.warn("Cannot Set Value on missing Form Element with name: " + m);
228
+ }, m = (l, d) => {
229
+ const g = u.current?.elements.namedItem(l);
230
+ if (!g) {
231
+ console.warn("Cannot Set Value on missing Form Element with name: " + l);
227
232
  return;
228
233
  }
229
- if (!(b instanceof HTMLInputElement))
230
- throw new Error("Cannot Set Value on missing Form Element with name: " + m);
231
- switch (b.type) {
232
- case A.Checkbox:
233
- case A.Radio: {
234
- d !== null && !(d instanceof Array) && (d = [d]), d?.includes(b.value) && (b.checked = !0);
235
- break;
234
+ let h = [];
235
+ if (g instanceof RadioNodeList)
236
+ h = [...g];
237
+ else if (g instanceof HTMLInputElement || g instanceof HTMLSelectElement)
238
+ h = [g];
239
+ else
240
+ throw new Error("Cannot Set Value on missing Form Element with name: " + l);
241
+ h.forEach((x) => {
242
+ switch (x.type) {
243
+ case w.Checkbox:
244
+ case w.Radio: {
245
+ d !== null && !(d instanceof Array) && (d = [d]), x.checked = d?.includes(x.value) ?? !1;
246
+ break;
247
+ }
248
+ default:
249
+ if (d instanceof Array)
250
+ throw new Error("Invalid Value");
251
+ x.value = d || "";
236
252
  }
237
- default:
238
- if (d instanceof Array)
239
- throw new Error("Invalid Value");
240
- b.value = d || "";
241
- }
242
- }, y = {
253
+ });
254
+ }, b = {
243
255
  getFormData: () => new FormData(u.current || void 0),
244
- setFormData: (m) => {
256
+ setFormData: (l) => {
245
257
  [...u.current?.elements || []].forEach((d) => {
246
- const b = m.get(d.name);
258
+ const g = l.get(d.name);
247
259
  switch (d.tagName.toLowerCase()) {
248
260
  case "select": {
249
- d.multiple ? [...d.options].forEach((p) => {
250
- p.selected = m.getAll(d.name).includes(p.value);
251
- }) : d.value = b;
261
+ d.multiple ? [...d.options].forEach((h) => {
262
+ h.selected = l.getAll(d.name).includes(h.value);
263
+ }) : d.value = g;
252
264
  break;
253
265
  }
254
266
  default:
255
267
  switch (d.type) {
256
268
  case "checkbox":
257
- d.checked = !!b;
269
+ d.checked = !!g;
258
270
  break;
259
271
  default:
260
- d.value = b;
272
+ d.value = g;
261
273
  break;
262
274
  }
263
275
  }
264
276
  });
265
277
  },
266
- setValue: h,
267
- setValues: (m) => {
268
- Object.keys(m).map((d) => h(d, m[d]));
278
+ setValue: m,
279
+ setValues: (l) => {
280
+ Object.keys(l).map((d) => m(d, l[d]));
269
281
  },
270
- setErrors: (m) => {
271
- const [, d] = C;
272
- d({ action: "errors", payload: m });
282
+ setErrors: (l) => {
283
+ const [, d] = _;
284
+ d({ action: "errors", payload: l });
273
285
  },
274
286
  reset: () => {
275
287
  u.current?.reset();
276
288
  },
277
289
  success: () => {
278
- const [, m] = C;
279
- m({ action: "success", payload: !0 });
290
+ const [, l] = _;
291
+ l({ action: "success", payload: !0 });
280
292
  },
281
293
  submit: () => u.current?.requestSubmit()
282
294
  };
283
- ye(c, () => y), N(() => {
284
- const m = () => {
295
+ fe(c, () => b), N(() => {
296
+ const l = () => {
285
297
  a && a();
286
298
  }, d = u?.current;
287
- return d?.addEventListener("reset", m), () => {
288
- d?.removeEventListener("reset", m);
299
+ return d?.addEventListener("reset", l), () => {
300
+ d?.removeEventListener("reset", l);
289
301
  };
290
302
  }, []);
291
- const E = (m, d) => {
292
- const b = y.getFormData();
293
- for (const p of d)
294
- if (!p.isValid(b.get(m) || null))
295
- return { valid: !1, message: p.getMessage() };
303
+ const E = (l, d) => {
304
+ const g = b.getFormData();
305
+ for (const h of d)
306
+ if (!h.isValid(g.get(l) || null))
307
+ return { valid: !1, message: h.getMessage() };
296
308
  return { valid: !0, message: null };
297
- }, C = Y((m, d) => {
298
- const { action: b, payload: p } = d;
299
- switch (b) {
309
+ }, _ = z((l, d) => {
310
+ const { action: g, payload: h } = d;
311
+ switch (g) {
300
312
  case "constraints": {
301
- const { name: x, constraints: w } = p;
313
+ const { name: x, constraints: P } = h;
302
314
  return {
303
- ...m,
315
+ ...l,
304
316
  constraints: {
305
- ...m.constraints || {},
306
- [x]: w
317
+ ...l.constraints || {},
318
+ [x]: P
307
319
  }
308
320
  };
309
321
  }
310
322
  case "validate": {
311
- const { valid: x, message: w } = E(p, m.constraints[p] || []), L = m.errors || {}, S = p;
312
- return x ? delete L[S] : L[S] = [...L[S] || [], { message: w || "Error" }], Object.keys(L).length ? {
313
- ...m,
314
- errors: L
315
- } : m;
323
+ const { valid: x, message: P } = E(h, l.constraints[h] || []), D = l.errors || {}, S = h;
324
+ return x ? delete D[S] : D[S] = [...D[S] || [], { message: P || "Error" }], Object.keys(D).length ? {
325
+ ...l,
326
+ errors: D
327
+ } : l;
316
328
  }
317
329
  case "response":
318
330
  return {
319
- ...m,
320
- response: p
331
+ ...l,
332
+ response: h
321
333
  };
322
334
  case "errors":
323
335
  return {
324
- ...m,
325
- errors: p || []
336
+ ...l,
337
+ errors: h || []
326
338
  };
327
339
  case "error": {
328
- const x = { ...m.errors, ...p };
340
+ const x = { ...l.errors, ...h };
329
341
  return {
330
- ...m,
342
+ ...l,
331
343
  errors: x
332
344
  };
333
345
  }
334
346
  case "success":
335
347
  return {
336
- ...m,
337
- success: p
348
+ ...l,
349
+ success: h
338
350
  };
339
351
  }
340
- return m;
341
- }, g), f = (m) => {
342
- m.preventDefault();
343
- const [d, b] = C;
344
- let p = {};
345
- for (const [w, L] of Object.entries(d.constraints)) {
346
- const { valid: S, message: I } = E(w, L);
347
- S || (p[w] = [I]);
352
+ return l;
353
+ }, p), y = (l) => {
354
+ l.preventDefault();
355
+ const [d, g] = _;
356
+ let h = {};
357
+ for (const [P, D] of Object.entries(d.constraints)) {
358
+ const { valid: S, message: L } = E(P, D);
359
+ S || (h[P] = [L]);
348
360
  }
349
- if (Object.values(p).length) {
350
- b({ action: "errors", payload: p });
361
+ if (Object.values(h).length) {
362
+ g({ action: "errors", payload: h });
351
363
  return;
352
364
  }
353
365
  const x = new FormData(u?.current || void 0);
@@ -356,155 +368,188 @@ const Ce = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").re
356
368
  return;
357
369
  }
358
370
  };
359
- return /* @__PURE__ */ o(Ct.Provider, { value: [C, c, u], children: /* @__PURE__ */ o("form", { id: e, ref: u, onSubmit: f, ...l, children: t }) });
360
- }), xt = ({
371
+ return /* @__PURE__ */ r(wt.Provider, { value: [_, c, u], children: /* @__PURE__ */ r("form", { id: e, ref: u, onSubmit: y, ...f, children: t }) });
372
+ }, Pt = ({
361
373
  icon: e,
362
374
  preloader: t,
363
375
  rightIcon: n,
364
- children: r,
376
+ children: o,
365
377
  preload: s = !1
366
- }) => /* @__PURE__ */ _(P, { children: [
367
- s ? t || /* @__PURE__ */ o(P, { children: "*" }) : e,
368
- r,
378
+ }) => /* @__PURE__ */ C(A, { children: [
379
+ s ? t || /* @__PURE__ */ r(A, { children: "*" }) : e,
380
+ o,
369
381
  n
370
- ] }), wt = v.createContext(void 0), Nt = () => v.useContext(wt), At = v.createContext(void 0), Mn = () => v.useContext(At), Un = ({ loader: e, children: t }) => {
371
- const n = Ee();
372
- return /* @__PURE__ */ o(At.Provider, { value: e || n, children: t });
373
- }, Vn = ({ children: e }) => {
374
- const [t, n] = Y((i, a) => {
375
- const [l, c] = a;
382
+ ] }), Lt = v.createContext(void 0), Ot = () => v.useContext(Lt), St = v.createContext(void 0), Bn = () => v.useContext(St), $n = ({ loader: e, children: t }) => {
383
+ const n = _e();
384
+ return /* @__PURE__ */ r(St.Provider, { value: e || n, children: t });
385
+ }, qn = ({ children: e }) => {
386
+ const [t, n] = z((i, a) => {
387
+ const [c, f] = a;
376
388
  return {
377
389
  ...i,
378
- [l]: c
390
+ [c]: f
379
391
  };
380
- }, {}), r = (i) => {
392
+ }, {}), o = (i) => {
381
393
  n([i, !0]);
382
394
  }, s = (i) => {
383
395
  n([i, !1]);
384
396
  };
385
- return /* @__PURE__ */ o(wt.Provider, { value: {
397
+ return /* @__PURE__ */ r(Lt.Provider, { value: {
386
398
  loaders: t,
387
- startLoading: r,
399
+ startLoading: o,
388
400
  stopLoading: s,
389
401
  isLoading: (i) => t[i] ?? !1
390
402
  }, children: e });
391
- }, ue = X(({
403
+ }, he = ({
392
404
  children: e,
393
405
  type: t,
394
406
  form: n,
395
- ...r
396
- }, s) => {
397
- const { isLoading: i } = Nt() || {}, a = Mn() || n || "form", l = t === "submit" && i?.(a);
398
- return /* @__PURE__ */ o("button", { disabled: l, form: n, ...r, ref: s, children: /* @__PURE__ */ o(xt, { preload: l, ...r, children: e }) });
399
- }), Pt = v.createContext("");
400
- function Lt() {
401
- return v.useContext(Pt);
407
+ preload: o,
408
+ autoDisableOnInvalid: s,
409
+ ref: i,
410
+ ...a
411
+ }) => {
412
+ const { isLoading: c } = Ot() || {}, f = Bn() || n || "form", u = i || O(null), [p, m] = R(s || !1);
413
+ return o = o || t === "submit" && c?.(f), N(() => {
414
+ if (!s)
415
+ return;
416
+ const b = u.current?.closest("form"), E = u.current?.closest("fieldset, form"), _ = () => {
417
+ u.current && m(!b?.checkValidity() || !1);
418
+ }, y = "input, select, textarea", l = new MutationObserver((d) => {
419
+ d.forEach((g) => {
420
+ [...g.addedNodes, ...g.removedNodes, g.target].forEach((h) => {
421
+ h instanceof Element && (h.matches(y) || h.querySelector(y)) && _();
422
+ });
423
+ });
424
+ });
425
+ return E?.addEventListener("input", _), b && l.observe(b, {
426
+ childList: !0,
427
+ subtree: !0,
428
+ attributes: !0,
429
+ attributeFilter: ["hidden", "style", "class"]
430
+ }), setTimeout(_, 150), () => {
431
+ l.disconnect(), E?.removeEventListener("input", _);
432
+ };
433
+ }, []), N(() => {
434
+ u.current && (u.current.disabled = o || p);
435
+ }, [o]), /* @__PURE__ */ r("button", { form: n, type: t, disabled: p, ...a, ref: u, children: /* @__PURE__ */ r(Pt, { preload: o, ...a, children: e }) });
436
+ }, kt = v.createContext("");
437
+ function Dt() {
438
+ return v.useContext(kt);
402
439
  }
403
- function Bn({ namespace: e, ...t }) {
404
- return /* @__PURE__ */ o(Pt.Provider, { value: e, children: t.children });
440
+ function Hn({ namespace: e, ...t }) {
441
+ return /* @__PURE__ */ r(kt.Provider, { value: e, children: t.children });
405
442
  }
406
- const Ot = v.createContext(void 0);
407
- function $n({ children: e }) {
408
- const [t, n] = Y((r, { key: s, context: i }) => (r = { ...r }, i ? r[s] = i : delete r[s], r), {});
409
- return /* @__PURE__ */ o(Ot.Provider, { value: {
410
- set: (r, s) => n({ key: r, context: s }),
411
- get: (r) => t[r] || null,
412
- unset: (r) => {
413
- n({ key: r });
443
+ const Rt = v.createContext(void 0);
444
+ function Kn({ children: e }) {
445
+ const [t, n] = z((o, { key: s, context: i }) => (o = { ...o }, i ? o[s] = i : delete o[s], o), {});
446
+ return /* @__PURE__ */ r(Rt.Provider, { value: {
447
+ set: (o, s) => n({ key: o, context: s }),
448
+ get: (o) => t[o] || null,
449
+ unset: (o) => {
450
+ n({ key: o });
414
451
  }
415
452
  }, children: e });
416
453
  }
417
- function qn() {
418
- const e = v.useContext(Ot);
454
+ function Gn() {
455
+ const e = v.useContext(Rt);
419
456
  if (!e)
420
457
  throw new Error("UseCurrentActionCollection must be used in CurrentActionCollectionProvider");
421
458
  return e;
422
459
  }
423
- const St = v.createContext(void 0);
424
- function ee() {
425
- const e = v.useContext(St);
460
+ const Tt = v.createContext(void 0);
461
+ function ne() {
462
+ const e = v.useContext(Tt);
426
463
  if (!e)
427
464
  throw new Error("UseCurrentAction must be used in CurrentActionProvider");
428
465
  return e;
429
466
  }
430
- function Rt({ action: e, name: t, ...n }) {
431
- const { getAction: r } = T(), { set: s, unset: i } = qn();
467
+ function It({ action: e, name: t, ref: n, ...o }) {
468
+ const { getAction: s } = M(), { set: i, unset: a } = Gn();
432
469
  t ??= [e.action.entity, e.action.name, e.action.namespace].join("-");
433
- const a = r(e.action.entity, e.action.name, e.action.namespace);
434
- if (!a)
435
- throw new Error("Invalid Current Action");
470
+ const c = s(e.action.entity, e.action.name, e.action.namespace);
471
+ if (!c)
472
+ throw console.log("Invalid Action", e), new Error("Invalid Current Action");
436
473
  e = {
437
474
  ...e,
438
- action: a
475
+ action: c
439
476
  };
440
- const [l, c] = R(1), [u, g] = R(e), h = {
441
- action: u,
442
- setAction: g,
443
- refresh: () => {
444
- c(Date.now());
445
- }
477
+ const f = () => {
478
+ p(Date.now());
479
+ };
480
+ fe(n, () => ({
481
+ refresh: f
482
+ }), []);
483
+ const [u, p] = R(1), [m, b] = R(e), E = {
484
+ action: m,
485
+ setAction: b,
486
+ refresh: f
446
487
  };
447
488
  return N(() => {
448
- g({ ...e, query: { ...e.query, _ts: l } });
449
- }, [l]), N(() => {
450
- g(e);
451
- }, [JSON.stringify(e)]), N(() => (s(t, h), () => {
452
- i(t);
453
- }), []), /* @__PURE__ */ o(St.Provider, { value: h, children: /* @__PURE__ */ o(Bn, { namespace: u.action.namespace || "", children: n.children }) });
489
+ b({ ...e, query: { ...e.query, _ts: u } });
490
+ }, [u]), N(() => {
491
+ b(e);
492
+ }, [JSON.stringify(e)]), N(() => (i(t, E), () => {
493
+ a(t);
494
+ }), []), /* @__PURE__ */ r(Tt.Provider, { value: E, children: /* @__PURE__ */ r(Hn, { namespace: m.action.namespace || "", children: o.children }) });
454
495
  }
455
- const ko = ({ path: e, preloader: t }) => {
456
- if (!H.namespace[Je])
457
- throw new mt(500, "Invalid Configuration.");
458
- const { link: n } = le(), { getOnClickActionByPath: r, actions: s } = T(), [i, a] = R(void 0);
496
+ const Fo = ({ path: e, preloader: t }) => {
497
+ if (!G.namespace[et])
498
+ throw new gt(500, "Invalid Configuration.");
499
+ const { link: n } = te(), { getOnClickActionByPath: o, actions: s } = M(), [i, a] = R(void 0), c = i ? [
500
+ i.action.entity,
501
+ i.action.namespace,
502
+ i.action.name
503
+ ].filter((f) => f).join("-") : Date.now().toString();
459
504
  return e ??= n?.path ?? location.pathname + location.search, n?.prefix && (e = e.replace(new RegExp("^/" + n.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), N(() => {
460
- a(r(e));
505
+ a(o(e));
461
506
  }, [e, JSON.stringify(s)]), N(() => {
462
507
  if (i === null)
463
- throw new Be(404, "Not Found");
464
- }, [i]), i === void 0 ? t ?? /* @__PURE__ */ o(P, { children: "Loading" }) : i === null ? null : /* @__PURE__ */ o(Rt, { action: i, children: /* @__PURE__ */ o(Dt, { children: /* @__PURE__ */ o(yn, { view: i.action.name }) }) });
465
- }, kt = v.createContext(null);
466
- function te() {
467
- return v.useContext(kt);
508
+ throw new Ke(404, "Not Found");
509
+ }, [i]), i === void 0 ? t ?? /* @__PURE__ */ r(A, { children: "Loading" }) : i === null ? null : /* @__PURE__ */ r(It, { action: i, children: /* @__PURE__ */ r(jt, { children: /* @__PURE__ */ r(xn, { view: i.action.name }) }) }, c);
510
+ }, Ft = v.createContext(null);
511
+ function re() {
512
+ return v.useContext(Ft);
468
513
  }
469
- const Hn = ({
514
+ const Yn = ({
470
515
  path: e,
471
516
  method: t,
472
517
  body: n,
473
- bodyType: r,
518
+ bodyType: o,
474
519
  loadOnInit: s = !0
475
520
  }) => {
476
- const i = O(s), { navigate: a, externalToInternalPath: l, internalToExternalPath: c } = T(), [u, g] = R(), h = O(null), [y, E] = R(1);
477
- e = l(e);
478
- const C = Ln(() => {
521
+ const i = O(s), { navigate: a, externalToInternalPath: c, internalToExternalPath: f } = M(), [u, p] = R(), m = O(null), [b, E] = R(1), _ = JSON.stringify(n instanceof FormData ? $e(n) : n);
522
+ e = c(e);
523
+ const y = kn(() => {
479
524
  if (!i.current) {
480
525
  i.current = !0;
481
526
  return;
482
527
  }
483
- return h.current = new AbortController(), ce().fetch({
528
+ return m.current = new AbortController(), de().fetch({
484
529
  url: e,
485
- method: t || Ve.GET,
530
+ method: t || qe.GET,
486
531
  body: n,
487
- signal: h.current?.signal
488
- }).then(({ data: m, response: d }) => {
489
- if (d.redirected && !["cors"].includes(d.type)) {
490
- const b = c(new URL(d.url).pathname);
491
- a(b);
532
+ signal: m.current?.signal
533
+ }).then(({ data: d, response: g }) => {
534
+ if (g.redirected && g.status === 200) {
535
+ const h = f(new URL(g.url).pathname);
536
+ a(h);
492
537
  return;
493
538
  }
494
- if (g({ data: m, response: d }), [401, 403, 404, 500].includes(d.status))
495
- throw new Be(d.status, d.statusText || "Error", m);
539
+ if (p({ data: d, response: g }), [401, 403, 404, 500].includes(g.status))
540
+ throw new Ke(g.status, g.statusText || "Error", d);
496
541
  }).finally(() => {
497
542
  }), () => {
498
543
  i.current = s;
499
544
  };
500
- }, [y, e, n, r, t]);
545
+ }, [b, e, _, o, t]);
501
546
  N(() => () => {
502
- f(), i.current = s;
547
+ l(), i.current = s;
503
548
  }, []), N(() => {
504
- C();
505
- }, [y, e, n, r, t]);
506
- const f = () => {
507
- h.current?.abort("canceled"), h.current = null;
549
+ y();
550
+ }, [b, e, _, o, t]);
551
+ const l = () => {
552
+ m.current?.abort("canceled"), m.current = null;
508
553
  };
509
554
  return {
510
555
  url: e,
@@ -514,115 +559,125 @@ const Hn = ({
514
559
  refresh: () => {
515
560
  E(Date.now());
516
561
  },
517
- cancel: f
562
+ cancel: l
518
563
  };
519
- }, Kn = ({
564
+ }, Wn = ({
520
565
  action: e,
521
566
  loadOnInit: t = !0
522
567
  }) => {
523
- const { generateActionLink: n } = T(), r = n(e);
524
- return Hn({ path: r, method: e.method, body: e.body, bodyType: e.bodyType, loadOnInit: t });
525
- }, Dt = ({ suspense: e, children: t }) => {
526
- const { action: n } = ee(), { generateActionLink: r } = T(), s = te(), i = r(n);
568
+ const { generateActionLink: n } = M(), o = n(e);
569
+ return Yn({ path: o, method: e.method, body: e.body, bodyType: e.bodyType, loadOnInit: t });
570
+ }, jt = ({ suspense: e, children: t }) => {
571
+ const { action: n } = ne(), { generateActionLink: o } = M(), s = re(), i = o(n);
527
572
  if (s?.url === i)
528
573
  return t;
529
- const a = Kn({
574
+ const a = Wn({
530
575
  action: n
531
576
  });
532
- return e ??= /* @__PURE__ */ o(P, { children: "Data Loading" }), /* @__PURE__ */ o(kt.Provider, { value: a, children: e && !a?.results ? e : t });
577
+ return e ??= /* @__PURE__ */ r(A, { children: "Data Loading" }), /* @__PURE__ */ r(Ft.Provider, { value: a, children: e && !a?.results ? e : t });
533
578
  };
534
- function Tt(e) {
535
- return (t) => /* @__PURE__ */ o(Dt, { children: /* @__PURE__ */ o(e, { ...t }) });
579
+ function Mt(e) {
580
+ return (t) => /* @__PURE__ */ r(jt, { children: /* @__PURE__ */ r(e, { ...t }) });
536
581
  }
537
- const U = ({ children: e, domain: t, properties: n }) => (n ??= {}, Object.keys(n).forEach((r) => {
538
- e = e?.replaceAll(new RegExp(":" + r, "g"), n[r]?.toString() || "");
539
- }), e = e?.replaceAll(new RegExp(":w+", "g"), ""), /* @__PURE__ */ o(P, { children: e })), Do = (e) => {
582
+ const jo = (e) => {
540
583
  const t = new RegExp("(?<=.)[^@\\n](?=[^@\\n]*?@)|(?:(?<=@.)|(?!^)\\G(?=[^@\\n]*$)).(?=.*[^@\\n]\\.)", "i");
541
584
  return e.replace(t, "*");
542
- }, Se = (e) => e.replace(new RegExp("^.{1,1}"), (t) => t.toUpperCase()), Gn = (e) => {
543
- let t = e.replace(new RegExp("[-_]", "gi"), " ").split(new RegExp("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])"));
544
- const n = t.shift(), r = t.pop();
545
- return t = t.map((s) => s.toLowerCase()), n && t.unshift(Se(n)), r && t.push(Se(r)), t.join(" ");
546
- }, Yn = ({ children: e }) => /* @__PURE__ */ o(P, { children: e }), It = v.createContext(void 0);
547
- function Wn() {
548
- return v.useContext(It);
585
+ }, De = (e) => e.replace(new RegExp("^.{1,1}"), (t) => t.toUpperCase()), zn = (e) => {
586
+ let t = e?.replace(new RegExp("[-_]", "gi"), " ").split(new RegExp("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])"));
587
+ if (!t?.length)
588
+ return null;
589
+ const n = t.shift(), o = t.pop();
590
+ return t = t.map((s) => s.toLowerCase()), n && t.unshift(De(n)), o && t.push(De(o)), t.join(" ");
591
+ }, Jn = ({ children: e }) => /* @__PURE__ */ r(A, { children: e }), Ut = v.createContext(void 0);
592
+ function Qn() {
593
+ return v.useContext(Ut);
549
594
  }
550
- const F = Z(({ view: e, prefix: t, namespace: n, children: r, props: s, data: i }) => {
551
- const { templates: a } = le(), l = Wn(), [c, u] = R(1), g = O(Yn);
552
- n ??= Lt(), e instanceof Array || (e = [e]), e = e.map((f) => f.split(/[._]/).filter((m) => m).map((m) => Se(m)).join(""));
553
- const h = [
554
- ...e.map((f) => ["crud", n, t, f].filter((m) => m).join("/") + ".tsx"),
555
- ...e.map((f) => ["crud", "general", t, f].filter((m) => m).join("/") + ".tsx")
556
- ], [y, E, C] = h.reduce((f, m) => {
557
- if (f)
558
- return f;
559
- const [, d] = Object.entries(a ?? {}).filter(([p]) => p.endsWith(m)).shift() || [], b = l?.template === m && l?.isImported;
560
- return d !== void 0 ? [m, b, d] : null;
595
+ const j = ue(({ view: e, prefix: t, namespace: n, children: o, props: s, data: i }) => {
596
+ const { templates: a } = te(), c = Qn(), [f, u] = R(1), p = O(Jn);
597
+ n ??= Dt(), e instanceof Array || (e = [e]), e = e.map((y) => y.split(/[._]/).filter((l) => l).map((l) => De(l)).join(""));
598
+ const m = [
599
+ ...e.map((y) => ["crud", n, t, y].filter((l) => l).join("/") + ".tsx"),
600
+ ...e.map((y) => ["crud", "general", t, y].filter((l) => l).join("/") + ".tsx")
601
+ ], [b, E, _] = m.reduce((y, l) => {
602
+ if (y)
603
+ return y;
604
+ const [, d] = Object.entries(a ?? {}).filter(([h]) => h.endsWith(l)).shift() || [], g = c?.template === l && c?.isImported;
605
+ return d !== void 0 ? [l, g, d] : null;
561
606
  }, null) || [!1, void 0];
562
607
  return N(() => {
563
608
  if (!E) {
564
- if (C === void 0)
609
+ if (_ === void 0)
565
610
  return () => {
566
611
  };
567
- C().then((f) => {
568
- g.current = f.default, u(c + 1);
612
+ _().then((y) => {
613
+ p.current = y.default, u(f + 1);
569
614
  });
570
615
  }
571
- }, []), E || !y ? r : /* @__PURE__ */ o(It.Provider, { value: {
572
- template: y,
573
- parent: r,
616
+ }, []), E || !b ? o : /* @__PURE__ */ r(Ut.Provider, { value: {
617
+ template: b,
618
+ parent: o,
574
619
  data: i,
575
620
  view: e,
576
621
  namespace: n,
577
- isImported: !!C
578
- }, children: /* @__PURE__ */ o(g.current, { ...s }) });
579
- }), jt = v.createContext(void 0);
580
- function zn() {
581
- return v.useContext(jt);
622
+ isImported: !!_
623
+ }, children: /* @__PURE__ */ r(p.current, { ...s }) });
624
+ }), k = ({ children: e, domain: t, properties: n, ...o }) => typeof e != "string" ? null : (n ??= {}, Object.keys(n).forEach((s) => {
625
+ e = e?.replaceAll(new RegExp(":" + s, "g"), n[s]?.toString() || "");
626
+ }), e = e?.replaceAll(new RegExp(":w+", "g"), ""), /* @__PURE__ */ r(
627
+ j,
628
+ {
629
+ view: "Translation",
630
+ props: { ...o, domain: t, properties: n },
631
+ children: e
632
+ }
633
+ )), Vt = v.createContext(void 0);
634
+ function Zn() {
635
+ return v.useContext(Vt);
582
636
  }
583
- function Jn({ id: e, view: t, children: n }) {
584
- return /* @__PURE__ */ o(jt.Provider, { value: { id: e, view: t }, children: n });
637
+ function Xn({ id: e, view: t, children: n }) {
638
+ return /* @__PURE__ */ r(Vt.Provider, { value: { id: e, view: t }, children: n });
585
639
  }
586
- const To = ({
640
+ const Mo = ({
587
641
  name: e,
588
- optional: t
642
+ options: t,
643
+ optional: n
589
644
  // Stop throwing error when Form View is missing.
590
645
  }) => {
591
- const { form: n } = V(), r = e ? n?.children?.[e] : n;
592
- if (!r) {
593
- if (t)
646
+ const { form: o } = B(), i = { ...e ? o?.children?.[e] : o, ...t || {} };
647
+ if (!i?.type) {
648
+ if (n)
594
649
  return null;
595
650
  throw new Error("Missing Provided Form View to Form Group" + (e ? ": " + e : ""));
596
651
  }
597
- return /* @__PURE__ */ o(ne, { view: r, children: /* @__PURE__ */ o(me, {}) });
598
- }, Ft = v.createContext(void 0), Mt = () => v.useContext(Ft), Io = ({ children: e, ...t }) => /* @__PURE__ */ o(Ft.Provider, { value: t, children: e }), Re = ({
652
+ return /* @__PURE__ */ r(oe, { view: i, children: /* @__PURE__ */ r(pe, {}) });
653
+ }, Bt = v.createContext(void 0), $t = () => v.useContext(Bt), Uo = ({ children: e, ...t }) => /* @__PURE__ */ r(Bt.Provider, { value: t, children: e }), Re = ({
599
654
  view: e,
600
655
  className: t
601
656
  }) => {
602
- const r = Mt()?.label || e.label || Gn(e.name || ""), s = ["checkbox", "radio"].includes(e.type || "input");
603
- return /* @__PURE__ */ o(P, { children: s ? /* @__PURE__ */ o(
657
+ const o = $t()?.label || e.label || zn(e.name || "") || "", s = ["checkbox", "radio"].includes(e.type || "input");
658
+ return /* @__PURE__ */ r(A, { children: s ? /* @__PURE__ */ r(
604
659
  "label",
605
660
  {
606
661
  className: t ?? "form-check-label",
607
- htmlFor: e.id || Ce(e.full_name || ""),
662
+ htmlFor: e.id || xe(e.full_name || ""),
608
663
  ...e.label_attr && (e.label_attr instanceof Function ? e.label_attr() : e.label_attr),
609
- children: r
664
+ children: /* @__PURE__ */ r(k, { children: o })
610
665
  }
611
- ) : /* @__PURE__ */ o(
666
+ ) : /* @__PURE__ */ r(
612
667
  "label",
613
668
  {
614
669
  className: t ?? "form-label",
615
670
  ...e.label_attr && (e.label_attr instanceof Function ? e.label_attr() : e.label_attr),
616
- children: r
671
+ children: /* @__PURE__ */ r(k, { children: o })
617
672
  }
618
673
  ) });
619
- }, Qn = ({
674
+ }, er = ({
620
675
  name: e
621
676
  }) => {
622
- const { form: t } = V(), n = e ? t.children?.[e] : t;
677
+ const { form: t } = B(), n = e ? t.children?.[e] : t;
623
678
  if (!n)
624
679
  throw new Error("Missing Form View for FormField" + (e ? ": " + e : ""));
625
- return /* @__PURE__ */ o(P, { children: n.help && /* @__PURE__ */ o(
680
+ return /* @__PURE__ */ r(A, { children: n.help && /* @__PURE__ */ r(
626
681
  "div",
627
682
  {
628
683
  className: "form-text",
@@ -630,60 +685,73 @@ const To = ({
630
685
  children: n.help
631
686
  }
632
687
  ) });
633
- }, Ut = ({ view: e, choice: t }) => /* @__PURE__ */ o(
634
- "option",
635
- {
636
- value: t.value || t.label,
637
- ...t.attr && (t.attr instanceof Function ? t.attr(t) : t.attr),
638
- children: t.label
639
- }
640
- ), Zn = ({ view: e, group: t }) => /* @__PURE__ */ o("optgroup", { label: t.label, children: Object.values(t.choices).map((n, r) => /* @__PURE__ */ o(Ut, { view: e, choice: n }, r)) }), ke = ({
688
+ }, qt = ({ view: e, choice: t }) => {
689
+ const n = t.label instanceof Function ? t.label(t) : t.label;
690
+ return /* @__PURE__ */ r(
691
+ "option",
692
+ {
693
+ value: t.value || n,
694
+ ...t.attr && (t.attr instanceof Function ? t.attr(t) : t.attr),
695
+ children: /* @__PURE__ */ r(k, { children: n })
696
+ }
697
+ );
698
+ }, tr = ({ view: e, group: t }) => /* @__PURE__ */ r("optgroup", { label: t.label, children: Object.values(t.choices).map((n, o) => /* @__PURE__ */ r(qt, { view: e, choice: n }, o)) }), Te = ({
641
699
  view: e,
642
700
  choice: t,
643
701
  choiceValueTransform: n,
644
- choiceLabelTransform: r
702
+ choiceLabelTransform: o
645
703
  }) => {
646
- const s = e.full_name, i = n ? n(t) : t.value, a = r ? r(t) : t.label || i, l = Ce(s || "", i), c = {
647
- id: l,
648
- ...t?.attr && (t?.attr instanceof Function ? t?.attr(t) : t?.attr)
649
- };
650
- return /* @__PURE__ */ _("div", { className: "form-check", children: [
651
- /* @__PURE__ */ o(
704
+ const s = e.full_name, i = n ? n(t) : t.value, a = o ? o(t) : t.label, c = xe(s || "", i), f = {
705
+ ...(e.label_attr instanceof Function ? e.label_attr() : e.label_attr) || {}
706
+ }, u = {
707
+ id: c,
708
+ ...(e.choice_attr instanceof Function ? e.choice_attr(e) : e.choice_attr) || {}
709
+ }, p = e.checked instanceof Function ? e.checked(i) : e.checked, m = e?.data, b = m instanceof Array ? m.includes(i) : m == i;
710
+ return /* @__PURE__ */ C(A, { children: [
711
+ /* @__PURE__ */ r(
652
712
  "input",
653
713
  {
654
714
  defaultValue: i,
655
715
  type: e?.multiple ? "checkbox" : "radio",
656
- defaultChecked: e?.data?.includes(i),
657
- name: s + (e?.multiple ? "[]" : ""),
658
- id: l,
716
+ defaultChecked: p || b,
717
+ name: (s || "") + (e?.multiple ? "[]" : ""),
718
+ id: c,
659
719
  className: "form-check-input",
660
- ...c
720
+ checked: p,
721
+ ...u
661
722
  }
662
723
  ),
663
- /* @__PURE__ */ o(
724
+ a?.length > 0 && /* @__PURE__ */ r(
664
725
  "label",
665
726
  {
666
- htmlFor: c.id,
727
+ htmlFor: u.id,
667
728
  className: "form-check-label",
668
- children: a
729
+ ...f,
730
+ children: /* @__PURE__ */ r(k, { children: a })
669
731
  }
670
732
  )
671
733
  ] });
672
- }, Xn = ({ view: e, group: t, ...n }) => /* @__PURE__ */ _("div", { className: "form-group", children: [
673
- /* @__PURE__ */ o("label", { className: "form-label", children: t.label }),
674
- Object.values(t.choices).map((r, s) => /* @__PURE__ */ o(ke, { view: e, choice: r, ...n }, s))
675
- ] }), er = ({
734
+ }, nr = ({ view: e, group: t, ...n }) => /* @__PURE__ */ C("div", { className: "form-group", children: [
735
+ /* @__PURE__ */ r("label", { className: "form-label", children: t.label }),
736
+ Object.values(t.choices).map((o, s) => /* @__PURE__ */ r(Te, { view: e, choice: o, ...n }, s))
737
+ ] }), rr = ({
676
738
  view: e,
677
739
  constraints: t,
678
740
  className: n,
679
- onChange: r,
741
+ onChange: o,
680
742
  choiceValueTransform: s,
681
743
  choiceLabelTransform: i
682
744
  }) => {
683
745
  t = t || [];
684
- const a = e.full_name, [[l, c], u] = de(), h = !!(l?.errors[a || ""] || []).length, y = btoa(encodeURIComponent(e.full_name + JSON.stringify(e.data)));
746
+ const a = e.full_name, [[c, f], u] = me(), m = !!(c?.errors[a || ""] || []).length, b = {
747
+ ...(e.attr instanceof Function ? e.attr() : e.attr) || {}
748
+ }, E = btoa(encodeURIComponent(e.full_name + JSON.stringify(e.data))), _ = [
749
+ ...(b.class || "").split(" ") || [],
750
+ ...(n || "").split(" ") || [],
751
+ ...m ? ["is-invalid"] : []
752
+ ];
685
753
  N(() => {
686
- c({
754
+ f({
687
755
  action: "constraints",
688
756
  payload: {
689
757
  name: e.full_name,
@@ -691,214 +759,216 @@ const To = ({
691
759
  }
692
760
  });
693
761
  }, []);
694
- const E = (C) => {
695
- c({ action: "validate", payload: e.full_name }), r && r(C);
762
+ const y = (l) => {
763
+ f({ action: "validate", payload: e.full_name }), o && o(l);
696
764
  };
697
- return e?.expanded ? /* @__PURE__ */ _("div", { className: [...h ? ["is-invalid"] : []].join(" "), children: [
698
- typeof e.placeholder == "string" && /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(
699
- ke,
765
+ return e?.expanded ? /* @__PURE__ */ C(A, { children: [
766
+ typeof e.placeholder == "string" && /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
767
+ Te,
700
768
  {
701
769
  view: e,
702
770
  choice: { label: e.placeholder, value: null }
703
771
  }
704
772
  ) }),
705
773
  Object.values(e.choices || []).map(
706
- (C, f) => /* @__PURE__ */ o(Oe, { children: C.choices !== void 0 ? /* @__PURE__ */ o(
707
- Xn,
774
+ (l, d) => /* @__PURE__ */ r(ke, { children: l.choices !== void 0 ? /* @__PURE__ */ r(
775
+ nr,
708
776
  {
709
777
  view: e,
710
- group: C,
778
+ group: l,
711
779
  choiceLabelTransform: i,
712
780
  choiceValueTransform: s
713
781
  }
714
- ) : /* @__PURE__ */ o(
715
- ke,
782
+ ) : /* @__PURE__ */ r("div", { className: "form-check", ...b, children: /* @__PURE__ */ r(
783
+ Te,
716
784
  {
717
785
  view: e,
718
- choice: C,
786
+ choice: l,
719
787
  choiceLabelTransform: i,
720
788
  choiceValueTransform: s
721
789
  }
722
- ) }, f)
790
+ ) }) }, d)
723
791
  )
724
- ] }) : /* @__PURE__ */ _(
792
+ ] }) : /* @__PURE__ */ C(
725
793
  "select",
726
794
  {
727
795
  name: a,
728
796
  multiple: e.multiple,
729
- "aria-invalid": h,
730
- onChange: (C) => E({
731
- value: (e.multiple ? u?.current?.getFormData().getAll(a) : u?.current?.getFormData().get(a)) || C.target.value
797
+ "aria-invalid": m,
798
+ onChange: (l) => y({
799
+ value: (e.multiple ? u?.current?.getFormData().getAll(a) : u?.current?.getFormData().get(a)) || l.target.value
732
800
  }),
733
- className: [...(n || "").split(" ") || [], "form-control", ...h ? ["is-invalid"] : []].join(" "),
801
+ className: [..._, "form-select"].join(" "),
734
802
  ...e.attr && (e.attr instanceof Function ? e.attr() : e.attr),
735
803
  defaultValue: e.data,
736
804
  children: [
737
- e.placeholder && /* @__PURE__ */ o("option", { value: "", children: e.placeholder }),
738
- Object.values(e.choices || []).map((C, f) => /* @__PURE__ */ o(Oe, { children: C.choices !== void 0 ? /* @__PURE__ */ o(Zn, { view: e, group: C }) : /* @__PURE__ */ o(Ut, { view: e, choice: C }) }, f))
805
+ e.placeholder && /* @__PURE__ */ r("option", { value: "", children: /* @__PURE__ */ r(k, { children: e.placeholder }) }),
806
+ Object.values(e.choices || []).map((l, d) => /* @__PURE__ */ r(ke, { children: l.choices !== void 0 ? /* @__PURE__ */ r(tr, { view: e, group: l }) : /* @__PURE__ */ r(qt, { view: e, choice: l }) }, d))
739
807
  ]
740
808
  },
741
- y
809
+ E
742
810
  );
743
- }, tr = ({
811
+ }, or = ({
744
812
  view: e,
745
813
  constraints: t,
746
- onChange: n
814
+ onChange: n,
815
+ ref: o
747
816
  }) => {
748
- const r = e.full_name, [[s, i]] = de(), a = O(null), l = s?.errors[r || ""] || [];
817
+ const s = e.full_name, [[i, a]] = me(), c = i?.errors[s || ""] || [];
749
818
  N(() => {
750
- i({
819
+ a({
751
820
  action: "constraints",
752
821
  payload: {
753
- name: r,
822
+ name: s,
754
823
  constraints: t || []
755
824
  }
756
825
  });
757
826
  }, []);
758
- const c = (m) => {
759
- i({ action: "validate", payload: r }), n && n(m);
760
- }, g = ["checkbox", "radio"].includes(e.type) ? "form-check-input" : "form-control", h = btoa(encodeURIComponent(r + JSON.stringify(e.data))), y = (e.attr instanceof Function ? e.attr() : e.attr) || {}, E = Mt();
761
- let C = e.type, f = e.data;
762
- if ([A.Date, A.Birthday, A.Datetime].includes(C)) {
763
- const m = f?.date ? new Date(f.date) : null;
764
- if (m) {
765
- const d = m.getTimezoneOffset() * 6e4;
766
- f = new Date(m.getTime() - d).toISOString().split("T").shift();
827
+ const f = (l) => {
828
+ a({ action: "validate", payload: s }), n && n(l);
829
+ }, p = ["checkbox", "radio"].includes(e.type) ? "form-check-input" : "form-control", m = btoa(encodeURIComponent(s + JSON.stringify(e.data))), b = (e.attr instanceof Function ? e.attr() : e.attr) || {}, E = $t();
830
+ let _ = e.type, y = e.data;
831
+ if ([w.Date, w.Birthday, w.Datetime].includes(_)) {
832
+ const l = y?.date ? new Date(y.date) : null;
833
+ if (l) {
834
+ const d = l.getTimezoneOffset() * 6e4;
835
+ y = new Date(l.getTime() - d).toISOString().split("T").shift();
767
836
  }
768
- C = C === A.Datetime ? "datetime-local" : "date";
837
+ _ = _ === w.Datetime ? "datetime-local" : "date";
769
838
  }
770
- return /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(
839
+ return e.required && (b.required = "required"), /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
771
840
  "input",
772
841
  {
773
- ref: a,
842
+ ref: o,
774
843
  id: e.id,
775
- name: r,
776
- type: C,
777
- defaultValue: f,
778
- "aria-invalid": !l.length,
779
- onKeyUp: (m) => c({ value: m.target.value }),
780
- onChange: (m) => c({ value: m.target.value }),
844
+ name: s,
845
+ type: _,
846
+ defaultValue: y,
847
+ "aria-invalid": !c.length,
848
+ onInput: (l) => {
849
+ b.onChange instanceof Function && b.onChange(l), !l.defaultPrevented && f({ value: l.target.value });
850
+ },
781
851
  className: E?.className || [
782
- g,
852
+ p,
783
853
  E?.size ? "form-control-" + E.size : null,
784
854
  E?.extraClassName,
785
- ...l.length ? ["is-invalid"] : []
786
- ].filter((m) => m).join(" "),
855
+ ...c.length ? ["is-invalid"] : []
856
+ ].filter((l) => l).join(" "),
787
857
  defaultChecked: e?.checked,
788
858
  placeholder: E?.placeholder || e?.placeholder || void 0,
789
- ...y,
790
- ...y.inputmode === "decimal" && { step: "any" }
859
+ ...b,
860
+ ...b.inputmode === "decimal" && { step: "any" }
791
861
  },
792
- h
862
+ m
793
863
  ) });
794
- }, Vt = v.createContext({
864
+ }, Ht = v.createContext({
795
865
  requests: []
796
866
  });
797
- function nr(e) {
798
- const t = v.useContext(Vt);
867
+ function sr(e) {
868
+ const t = v.useContext(Ht);
799
869
  if (t === void 0)
800
870
  throw new Error("UseLoaderIndicator must be within DataLoaderIndicatorProvider");
801
- const { requests: n } = t, { matchPath: r, getActionByPath: s, generateActionLink: i } = T();
871
+ const { requests: n } = t, { matchPath: o, getActionByPath: s, generateActionLink: i } = M();
802
872
  let a = null;
803
873
  if (e) {
804
- const c = s(e?.toString() ?? "");
805
- if (c) {
806
- const u = dt(new URL(e, location.origin).searchParams), { params: g } = r(c.route?.path || "", e) ?? { params: void 0 };
807
- a = i({ action: c, parameters: { ...g, ...u } });
874
+ const f = s(e?.toString() ?? "");
875
+ if (f) {
876
+ const u = ht(new URL(e, location.origin).searchParams), { params: p } = o(f.route?.path || "", e) ?? { params: void 0 };
877
+ a = i({ action: f, parameters: p, query: u });
808
878
  }
809
879
  }
810
880
  return {
811
- isLoading: a ? !!n.filter((c) => c.url === a).length : !1
881
+ isLoading: a ? !!n.filter((f) => f.url === a).length : !1
812
882
  };
813
883
  }
814
- function rr({ ...e }) {
815
- const [t, n] = Y((r, s) => {
816
- const { action: i, requestId: a, url: l } = s, c = new URL(l), u = c.toString().replace(c.origin, "");
817
- switch (r = { requests: r.requests.filter((g) => g.requestId !== a) }, i) {
884
+ function ir({ ...e }) {
885
+ const [t, n] = z((o, s) => {
886
+ const { action: i, requestId: a, url: c } = s, f = new URL(c), u = f.toString().replace(f.origin, "");
887
+ switch (o = { requests: o.requests.filter((p) => p.requestId !== a) }, i) {
818
888
  case "cancel":
819
889
  case "complete":
820
890
  break;
821
891
  default:
822
- r.requests.push({ url: u, requestId: a }), r = { requests: r.requests };
892
+ o.requests.push({ url: u, requestId: a }), o = { requests: o.requests };
823
893
  }
824
- return r;
894
+ return o;
825
895
  }, { requests: [] });
826
896
  return N(() => {
827
- const r = H.on(xe.PRE_REQUEST, (a, l, c) => {
828
- n({ action: "load", requestId: a, url: l.toString() });
829
- }), s = H.on(xe.POST_RESPONSE, (a, l, c, u) => {
830
- n({ action: "complete", requestId: a, url: c.toString() });
831
- }), i = H.on(xe.ERROR, (a, l, c, u) => {
832
- n({ action: "cancel", requestId: a, url: c.toString() });
897
+ const o = G.on(we.PRE_REQUEST, (a, c, f) => {
898
+ n({ action: "load", requestId: a, url: c.toString() });
899
+ }), s = G.on(we.POST_RESPONSE, (a, c, f, u) => {
900
+ n({ action: "complete", requestId: a, url: f.toString() });
901
+ }), i = G.on(we.ERROR, (a, c, f, u) => {
902
+ n({ action: "cancel", requestId: a, url: f.toString() });
833
903
  });
834
904
  return () => {
835
- H.off(r).off(s).off(i);
905
+ G.off(o).off(s).off(i);
836
906
  };
837
- }, []), /* @__PURE__ */ o(Vt.Provider, { value: t, children: e.children });
907
+ }, []), /* @__PURE__ */ r(Ht.Provider, { value: t, children: e.children });
838
908
  }
839
- const j = ({ to: e, children: t, onClick: n, ...r }) => {
840
- const { navigate: s } = T(), i = O(null), [a, l] = R(!1), { isLoading: c } = nr(e?.toString()), u = (h) => {
841
- if (c) {
842
- h.preventDefault(), h.stopPropagation();
909
+ const U = ({ to: e, children: t, onClick: n, ...o }) => {
910
+ const { navigate: s } = M(), i = O(null), [a, c] = R(!1), { isLoading: f } = sr(e?.toString()), u = (m) => {
911
+ if (f) {
912
+ m.preventDefault(), m.stopPropagation();
843
913
  return;
844
914
  }
845
- l(!0), n && n(h), !h.defaultPrevented && e && (h.preventDefault(), s(e.toString()));
915
+ c(!0), n && n(m), !m.defaultPrevented && e && (m.preventDefault(), s(e.toString()));
846
916
  };
847
917
  return N(() => {
848
- a && (c || l(!1));
849
- }, [c]), N(() => (i?.current?.addEventListener("click", u), () => {
918
+ a && (f || c(!1));
919
+ }, [f]), N(() => (i?.current?.addEventListener("click", u), () => {
850
920
  i?.current?.removeEventListener("click", u);
851
- }), [e, n]), /* @__PURE__ */ o("a", { ref: i, href: e, ...r, children: /* @__PURE__ */ o(xt, { preload: a && c, ...r, children: t }) });
852
- }, Bt = v.createContext(void 0), $t = () => {
853
- const e = v.useContext(Bt);
921
+ }), [e, n]), /* @__PURE__ */ r("a", { ref: i, href: e, ...o, children: /* @__PURE__ */ r(Pt, { preload: a && f, ...o, children: t }) });
922
+ }, Kt = v.createContext(void 0), Gt = () => {
923
+ const e = v.useContext(Kt);
854
924
  if (!e)
855
925
  throw new Error("UseCollection must be used within a Collection");
856
926
  return e;
857
- }, or = ({
927
+ }, ar = ({
858
928
  view: e
859
929
  }) => {
860
- const t = Object.keys(e.children || []), [n, r] = Y((l, c) => {
861
- const { action: u, value: g } = c;
930
+ const t = Object.keys(e.children || []), [n, o] = z((c, f) => {
931
+ const { action: u, value: p } = f;
862
932
  switch (u) {
863
933
  case "delete": {
864
- if (g && typeof g != "string")
934
+ if (p && typeof p != "string")
865
935
  throw new Error("Invalid value. Should be a string.");
866
- l = [...l.filter((h) => h !== g)];
936
+ c = [...c.filter((m) => m !== p)];
867
937
  break;
868
938
  }
869
939
  case "set": {
870
- if (!(g instanceof Array))
940
+ if (!(p instanceof Array))
871
941
  throw new Error("Invalid value. Should be a array.");
872
- l = g;
942
+ c = p;
873
943
  break;
874
944
  }
875
945
  default: {
876
- if (g && typeof g != "string")
946
+ if (p && typeof p != "string")
877
947
  throw new Error("Invalid value. Should be a string.");
878
- const h = Math.floor(Math.random() * Date.now());
879
- l = [...l, h.toString()];
948
+ const m = Math.floor(Math.random() * Date.now());
949
+ c = [...c, m.toString()];
880
950
  }
881
951
  }
882
- return l;
883
- }, t), s = !!e.prototype, i = () => r({ action: "add" }), a = (l) => {
884
- r({ action: "delete", value: l });
952
+ return c;
953
+ }, t), s = !!e.prototype, i = () => o({ action: "add" }), a = (c) => {
954
+ o({ action: "delete", value: c });
885
955
  };
886
956
  return N(() => {
887
- r({ action: "set", value: t });
888
- }, [JSON.stringify(t)]), /* @__PURE__ */ o(Bt.Provider, { value: {
957
+ o({ action: "set", value: t });
958
+ }, [JSON.stringify(t)]), /* @__PURE__ */ r(Kt.Provider, { value: {
889
959
  addItem: i,
890
960
  removeItem: a,
891
961
  items: n,
892
962
  isPrototype: s
893
- }, children: /* @__PURE__ */ _(
894
- F,
963
+ }, children: /* @__PURE__ */ C(
964
+ j,
895
965
  {
896
966
  prefix: "modify/form",
897
967
  view: [...e.block_prefixes || [], e.name + ".collection"],
898
968
  children: [
899
- /* @__PURE__ */ o(sr, {}),
900
- s && /* @__PURE__ */ o(
901
- j,
969
+ /* @__PURE__ */ r(cr, {}),
970
+ s && /* @__PURE__ */ r(
971
+ U,
902
972
  {
903
973
  onClick: () => i(),
904
974
  className: "btn btn-outline-primary btn-sm",
@@ -909,89 +979,99 @@ const j = ({ to: e, children: t, onClick: n, ...r }) => {
909
979
  },
910
980
  e.full_name
911
981
  ) });
912
- }, sr = () => {
913
- const { items: e } = $t(), { form: t } = V(), n = !!t.prototype, r = (s) => {
982
+ }, cr = () => {
983
+ const { items: e } = Gt(), { form: t } = B(), n = !!t.prototype, o = (s, i) => {
914
984
  if (s.prototype_name) {
915
- const i = s.full_name?.replace("__name__", s.prototype_name || "") || "", a = (s.id || Ce(i)).replace("__name__", s.prototype_name || "");
916
- s.full_name = i, s.id = a, Object.keys(s.children || {}).map((l) => {
917
- const c = s.children?.[l];
918
- c !== void 0 && (c.prototype_name || (c.prototype_name = s.prototype_name, r(c)));
985
+ const a = s.full_name?.replace("__name__", s.prototype_name || "") || "", c = (s.id || xe(a)).replace("__name__", s.prototype_name || ""), f = s.label?.replace("__name__label__", i.toString()) || "";
986
+ s.full_name = a, s.id = c, s.label = s.label?.replace("__name__label__", f), Object.keys(s.children || {}).map((u, p) => {
987
+ const m = s.children?.[u];
988
+ m !== void 0 && (m.prototype_name || (m.prototype_name = s.prototype_name, o(m, p)));
919
989
  }, {});
920
990
  }
921
991
  };
922
- return /* @__PURE__ */ o(P, { children: e.map((s, i) => {
992
+ return /* @__PURE__ */ r(A, { children: e.map((s, i) => {
923
993
  const a = JSON.parse(JSON.stringify(t.children?.[s] ?? (t.prototype || t)));
924
- return a ? (t.children?.[s] === void 0 && (a.prototype_name = s), r(a), /* @__PURE__ */ o(ir, { index: i, view: a, isPrototype: n })) : null;
994
+ return a ? (t.children?.[s] === void 0 && (a.prototype_name = s), o(a, i), /* @__PURE__ */ r(lr, { index: i, view: a, isPrototype: n })) : null;
925
995
  }) });
926
- }, qt = v.createContext(void 0), jo = () => {
927
- const e = v.useContext(qt);
996
+ }, Yt = v.createContext(void 0), Vo = () => {
997
+ const e = v.useContext(Yt);
928
998
  if (!e)
929
999
  throw new Error("UseCollectionItem must be used within a CollectionItem");
930
1000
  return e;
931
- }, ir = ({ view: e, index: t, isPrototype: n }) => {
932
- const { removeItem: r } = $t(), { form: s } = Yt() || { form: e }, i = e.prototype_name || e.name || "";
933
- return /* @__PURE__ */ o(ne, { view: e, allowDuplicates: n, children: /* @__PURE__ */ o(qt.Provider, { value: { index: t, removeItem: () => r(i) }, children: /* @__PURE__ */ o(
934
- F,
1001
+ }, lr = ({ view: e, index: t, isPrototype: n }) => {
1002
+ const { removeItem: o } = Gt(), { form: s } = Qt() || { form: e }, i = e.prototype_name || e.name || "";
1003
+ return /* @__PURE__ */ r(oe, { view: e, allowDuplicates: n, children: /* @__PURE__ */ r(Yt.Provider, { value: { index: t, removeItem: () => o(i) }, children: /* @__PURE__ */ r(
1004
+ j,
935
1005
  {
936
1006
  prefix: "modify/form",
937
1007
  view: [...e.block_prefixes || [], s.name + ".item"],
938
- children: /* @__PURE__ */ _("div", { className: "mb-3", children: [
939
- /* @__PURE__ */ o(Kt, { view: e }),
940
- n && /* @__PURE__ */ o(
941
- j,
1008
+ children: /* @__PURE__ */ C("div", { className: "mb-3", children: [
1009
+ /* @__PURE__ */ r(zt, { view: e }),
1010
+ n && /* @__PURE__ */ r(
1011
+ U,
942
1012
  {
943
1013
  to: "#",
944
- onClick: () => r(i),
1014
+ onClick: () => o(i),
945
1015
  className: "btn btn-outline-danger btn-sm",
946
- children: /* @__PURE__ */ o(U, { children: "Delete" })
1016
+ children: /* @__PURE__ */ r(k, { children: "Delete" })
947
1017
  }
948
1018
  )
949
1019
  ] })
950
1020
  }
951
1021
  ) }) });
952
- }, Xe = ({ view: e }) => {
1022
+ }, dr = ({ view: e, ref: t }) => {
953
1023
  switch (e.type) {
954
- case A.Entity:
955
- case A.Choice:
956
- case A.Enum:
957
- return /* @__PURE__ */ o(er, { view: e });
958
- case A.Collection:
959
- return /* @__PURE__ */ o(or, { view: e });
960
- case A.Hidden:
961
- case A.Input:
962
- case A.Money:
963
- case A.Text:
964
- case A.Tel:
965
- case A.Checkbox:
966
- case A.Radio:
967
- case A.Integer:
968
- case A.Number:
969
- case A.Password:
970
- case A.Datetime:
971
- case A.Date:
972
- case A.Birthday:
973
- case A.Time:
974
- case A.Email:
975
- return /* @__PURE__ */ o(tr, { view: e });
976
- case A.Repeated:
977
- case A.Form:
978
- return /* @__PURE__ */ o(me, {});
1024
+ case w.Entity:
1025
+ case w.Choice:
1026
+ case w.Currency:
1027
+ case w.Language:
1028
+ case w.Enum:
1029
+ return /* @__PURE__ */ r(rr, { view: e });
1030
+ case w.Collection:
1031
+ return /* @__PURE__ */ r(ar, { view: e });
1032
+ case w.Hidden:
1033
+ case w.Input:
1034
+ case w.Money:
1035
+ case w.Text:
1036
+ case w.Tel:
1037
+ case w.Checkbox:
1038
+ case w.Radio:
1039
+ case w.Integer:
1040
+ case w.Number:
1041
+ case w.Password:
1042
+ case w.Datetime:
1043
+ case w.Date:
1044
+ case w.Birthday:
1045
+ case w.Time:
1046
+ case w.Email:
1047
+ return /* @__PURE__ */ r(or, { view: e, ref: t });
1048
+ case w.Repeated:
1049
+ case w.Form:
1050
+ return /* @__PURE__ */ r(pe, {});
979
1051
  default:
980
1052
  throw new Error("Invalid view type: " + e.type);
981
1053
  }
982
- }, et = ({ name: e, options: t }) => {
983
- const { form: n } = V(), r = e ? n.children?.[e] : n;
984
- if (!r)
1054
+ }, ot = ({ name: e, options: t, ref: n }) => {
1055
+ const { form: o } = B(), s = e ? o.children?.[e] : o;
1056
+ if (!s)
985
1057
  throw new Error("Missing Form View for FormField" + (e ? ": " + e : ""));
986
- const s = { ...r, ...t || {} };
987
- return e !== void 0 ? /* @__PURE__ */ o(ne, { view: s, children: /* @__PURE__ */ o(Xe, { view: s }) }) : /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(Xe, { view: s }) });
988
- }, Ht = ({ name: e, className: t }) => {
989
- const [[n]] = de() || {};
1058
+ const i = { ...s, ...t || {} }, a = [(i.name || "form") + "Field", ...i.block_prefixes || []];
1059
+ return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(oe, { view: i, children: /* @__PURE__ */ r(
1060
+ j,
1061
+ {
1062
+ view: a,
1063
+ prefix: "modify/form",
1064
+ data: s,
1065
+ children: /* @__PURE__ */ r(dr, { view: i, ref: n })
1066
+ }
1067
+ ) }) });
1068
+ }, Wt = ({ name: e, className: t }) => {
1069
+ const [[n]] = me() || {};
990
1070
  e = e instanceof Array ? e : [e];
991
- const r = [].concat(...e.map((s) => n?.errors[s] || []));
992
- return r.length ? /* @__PURE__ */ o("div", { className: t, children: /* @__PURE__ */ o("ul", { className: "mb-0", children: r.map((s, i) => /* @__PURE__ */ o("li", { children: s.message }, i)) }) }) : null;
993
- }, ar = ({ name: e, className: t }) => {
994
- const { form: n, getRootViewContext: r } = V(), s = e ? (e instanceof Array ? e : [e]).map((i) => {
1071
+ const o = [].concat(...e.map((s) => n?.errors[s] || []));
1072
+ return o.length ? /* @__PURE__ */ r("div", { className: t, children: /* @__PURE__ */ r("ul", { className: "mb-0", children: o.map((s, i) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(k, { children: s.message }) }, i)) }) }) : null;
1073
+ }, ur = ({ name: e, className: t }) => {
1074
+ const { form: n, getRootViewContext: o } = B(), s = e ? (e instanceof Array ? e : [e]).map((i) => {
995
1075
  const a = i ? n.children?.[i] : n;
996
1076
  if (!a)
997
1077
  throw new Error("Missing Form View for FormError: " + (i || ""));
@@ -999,98 +1079,98 @@ const j = ({ to: e, children: t, onClick: n, ...r }) => {
999
1079
  }) : [n];
1000
1080
  return N(() => {
1001
1081
  s.forEach((i) => {
1002
- i.full_name && r().setRenderedError(i.full_name);
1082
+ i.full_name && o().setRenderedError(i.full_name);
1003
1083
  });
1004
- }, []), /* @__PURE__ */ o(Ht, { name: s.map((i) => i.full_name || ""), className: t });
1005
- }, Kt = ({
1084
+ }, []), /* @__PURE__ */ r(Wt, { name: s.map((i) => i.full_name || ""), className: t });
1085
+ }, zt = ({
1006
1086
  view: e,
1007
1087
  className: t,
1008
1088
  size: n,
1009
- type: r
1089
+ type: o
1010
1090
  }) => {
1011
- const s = [A.Checkbox, A.Radio].includes(e.type);
1012
- return e.type = r || e.type, /* @__PURE__ */ o(P, { children: e.type === A.Hidden ? /* @__PURE__ */ o(et, {}) : /* @__PURE__ */ _(
1091
+ const s = [w.Checkbox, w.Radio].includes(e.type);
1092
+ return e.type = o || e.type, /* @__PURE__ */ r(A, { children: e.type === w.Hidden ? /* @__PURE__ */ r(ot, {}) : /* @__PURE__ */ C(
1013
1093
  "div",
1014
1094
  {
1015
- className: [...t?.split(" ") || [], "mb-3", s && "form-check"].filter((i) => i).join(" "),
1095
+ className: [...t?.split(" ") || [s ? "form-check" : "mb-3"]].filter((i) => i).join(" "),
1016
1096
  ...e.attr && (e.attr instanceof Function ? e.attr() : e.attr),
1017
1097
  children: [
1018
- !s && /* @__PURE__ */ o(Re, { view: e }),
1019
- /* @__PURE__ */ o(et, { size: n }),
1020
- s && /* @__PURE__ */ o(Re, { view: e }),
1021
- /* @__PURE__ */ o(ar, { className: "invalid-feedback" }),
1022
- /* @__PURE__ */ o(Qn, {})
1098
+ !s && /* @__PURE__ */ r(Re, { view: e }),
1099
+ /* @__PURE__ */ r(ot, { size: n }),
1100
+ s && /* @__PURE__ */ r(Re, { view: e }),
1101
+ /* @__PURE__ */ r(ur, { className: "invalid-feedback" }),
1102
+ /* @__PURE__ */ r(er, {})
1023
1103
  ]
1024
1104
  }
1025
1105
  ) });
1026
- }, me = Z(() => {
1027
- const e = Ee(), { form: t } = V();
1028
- return /* @__PURE__ */ o(Jn, { id: e, view: t, children: /* @__PURE__ */ o(
1029
- F,
1106
+ }, pe = () => {
1107
+ const e = _e(), { form: t } = B(), n = [(t.name || "form") + "Group", ...t.block_prefixes || []].map((o) => o + "_group");
1108
+ return /* @__PURE__ */ r(Xn, { id: e, view: t, children: /* @__PURE__ */ r(
1109
+ j,
1030
1110
  {
1031
- view: [t.name || "form", ...t.block_prefixes || []],
1111
+ view: n,
1032
1112
  prefix: "modify/form",
1033
1113
  data: t,
1034
- children: [A.Form, A.Repeated].includes(t?.type) ? Object.values(t.children || []).map((n, r) => /* @__PURE__ */ o(Oe, { children: /* @__PURE__ */ o(ne, { view: n, children: /* @__PURE__ */ o(me, {}) }, r) }, r)) : /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(Kt, { view: t }) })
1114
+ children: [w.Form, w.Repeated].includes(t?.type) ? Object.values(t.children || []).map((o, s) => /* @__PURE__ */ r(ke, { children: /* @__PURE__ */ r(oe, { view: o, children: /* @__PURE__ */ r(pe, {}) }, s) }, s)) : /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(zt, { view: t }) })
1035
1115
  }
1036
1116
  ) });
1037
- }), cr = () => /* @__PURE__ */ o(me, {}), lr = ({ className: e }) => {
1038
- const [[t]] = de() || {}, { getRootViewContext: n, getParentViewContext: r, getElements: s } = V(), a = (() => {
1039
- let c = Object.keys(s?.() || []), u = r?.() || null;
1117
+ }, fr = () => /* @__PURE__ */ r(pe, {}), mr = ({ className: e }) => {
1118
+ const [[t]] = me() || {}, { getRootViewContext: n, getParentViewContext: o, getElements: s } = B(), a = (() => {
1119
+ let f = Object.keys(s?.() || []), u = o?.() || null;
1040
1120
  for (; u !== null; )
1041
- c = [
1042
- ...c,
1121
+ f = [
1122
+ ...f,
1043
1123
  ...Object.keys(u.getElements?.() || [])
1044
1124
  ], u = u.getParentViewContext();
1045
- return c;
1046
- })(), l = Object.keys(t?.errors || []).filter((c) => a.includes(c)).filter((c) => !n().getRenderedErrors().includes(c));
1047
- return /* @__PURE__ */ o(Ht, { name: l, className: e });
1048
- }, De = v.createContext(void 0), $e = () => {
1049
- const e = v.useContext(De);
1125
+ return f;
1126
+ })(), c = Object.keys(t?.errors || []).filter((f) => a.includes(f)).filter((f) => !n().getRenderedErrors().includes(f));
1127
+ return /* @__PURE__ */ r(Wt, { name: c, className: e });
1128
+ }, Ie = v.createContext(void 0), Ge = () => {
1129
+ const e = v.useContext(Ie);
1050
1130
  if (!e)
1051
1131
  throw new Error("UseTemplate must be used inside Template");
1052
1132
  return e;
1053
- }, dr = ({ name: e, children: t }) => {
1054
- const n = v.useContext(De), [r, s] = Y((i, a) => {
1133
+ }, hr = ({ name: e, children: t }) => {
1134
+ const n = v.useContext(Ie), [o, s] = z((i, a) => {
1055
1135
  if (a.template && a.template !== e)
1056
1136
  return n?.dispatch(a), i;
1057
- const l = i[a.block] || [], c = a.element || null;
1137
+ const c = i[a.block] || [], f = a.element || null;
1058
1138
  if (a.action === "set") {
1059
- const u = l.find((g) => g.id === a.id);
1060
- u ? u.element = c : l.push({
1139
+ const u = c.find((p) => p.id === a.id);
1140
+ u ? u.element = f : c.push({
1061
1141
  id: a.id,
1062
- element: c
1142
+ element: f
1063
1143
  });
1064
1144
  } else
1065
- l.filter((u) => u.id === a.id).forEach((u) => {
1145
+ c.filter((u) => u.id === a.id).forEach((u) => {
1066
1146
  u.element = null;
1067
1147
  });
1068
1148
  return {
1069
1149
  ...i,
1070
- [a.block]: l
1150
+ [a.block]: c
1071
1151
  };
1072
1152
  }, {});
1073
- return /* @__PURE__ */ o(De.Provider, { value: {
1153
+ return /* @__PURE__ */ r(Ie.Provider, { value: {
1074
1154
  name: e,
1075
- blocks: r,
1076
- getBlock: (i, a) => a && a !== e ? n?.getBlock(i, a) : [...r[i] || []].pop()?.element,
1077
- getParent: (i) => [...r[i] || []].slice(-2).shift()?.element,
1155
+ blocks: o,
1156
+ getBlock: (i, a) => a && a !== e ? n?.getBlock(i, a) : [...o[i] || []].pop()?.element,
1157
+ getParent: (i) => [...o[i] || []].slice(-2).shift()?.element,
1078
1158
  dispatch: s
1079
1159
  }, children: t });
1080
- }, Gt = v.createContext(void 0), k = ({ name: e, template: t, children: n }) => {
1081
- const { getBlock: r } = $e(), s = r(e, t);
1082
- return /* @__PURE__ */ o(Gt.Provider, { value: { name: e, children: n }, children: s === void 0 ? n : s });
1083
- }, q = ({ name: e, template: t, children: n }) => {
1084
- const r = Ee(), { dispatch: s } = $e(), i = () => {
1160
+ }, Jt = v.createContext(void 0), T = ({ name: e, template: t, children: n }) => {
1161
+ const { getBlock: o } = Ge(), s = o(e, t);
1162
+ return /* @__PURE__ */ r(Jt.Provider, { value: { name: e, children: n }, children: s === void 0 ? n : s });
1163
+ }, H = ({ name: e, template: t, children: n }) => {
1164
+ const o = _e(), { dispatch: s } = Ge(), i = () => {
1085
1165
  s({
1086
- id: r,
1166
+ id: o,
1087
1167
  action: "unset",
1088
1168
  template: t,
1089
1169
  block: e
1090
1170
  });
1091
1171
  };
1092
1172
  return N(() => (s({
1093
- id: r,
1173
+ id: o,
1094
1174
  action: "set",
1095
1175
  block: e,
1096
1176
  template: t,
@@ -1100,280 +1180,293 @@ const j = ({ to: e, children: t, onClick: n, ...r }) => {
1100
1180
  }), [n]), N(() => () => {
1101
1181
  i();
1102
1182
  }, []), null;
1103
- }, Fo = () => {
1104
- const { name: e, children: t } = v.useContext(Gt) || {}, { name: n, getParent: r } = $e();
1105
- return (e ? r(e) : null) || t || null;
1183
+ }, Bo = () => {
1184
+ const { name: e, children: t } = v.useContext(Jt) || {}, { name: n, getParent: o } = Ge();
1185
+ return (e ? o(e) : null) || t || null;
1106
1186
  };
1107
- function _e(e, t) {
1108
- return (n) => /* @__PURE__ */ _(dr, { name: t.name, children: [
1109
- /* @__PURE__ */ o(e, { ...n }),
1187
+ function Ne(e, t) {
1188
+ return (n) => /* @__PURE__ */ C(hr, { name: t.name, children: [
1189
+ /* @__PURE__ */ r(e, { ...n }),
1110
1190
  n.children
1111
1191
  ] });
1112
1192
  }
1113
- const qe = v.createContext(void 0), ne = ({ view: e, allowDuplicates: t, children: n }) => {
1114
- const r = Yt(), {
1193
+ const Ye = v.createContext(void 0), oe = ({ view: e, allowDuplicates: t, children: n }) => {
1194
+ const o = Qt(), {
1115
1195
  form: s,
1116
1196
  getParentViewContext: i,
1117
1197
  getElements: a,
1118
- allowDuplicates: l,
1119
- unsetRendered: c
1120
- } = r || {}, u = O(a?.() || {}), g = O([]), [, h] = de(), y = (f, m) => {
1121
- const d = f ? f.split(".").reduce((b, p) => b?.children?.[p] || null, e) : e;
1122
- d && (d.data = m, h.current?.setValue(d.full_name, m));
1123
- }, C = {
1198
+ allowDuplicates: c,
1199
+ unsetRendered: f
1200
+ } = o || {}, u = O(a?.() || {}), p = O([]), [, m] = me(), b = Zn(), E = (l, d) => {
1201
+ const g = l ? l.split(".").reduce((h, x) => h?.children?.[x] || null, e) : e;
1202
+ g && (g.data = d, m.current?.setValue(g.full_name, d));
1203
+ }, y = {
1124
1204
  form: e,
1125
- setRendered: (f, m) => {
1126
- f.full_name && u.current[f.full_name] === void 0 && (u.current[f.full_name] = m);
1205
+ setRendered: (l, d) => {
1206
+ l.full_name && u.current[l.full_name] === void 0 && (u.current[l.full_name] = d);
1127
1207
  },
1128
- unsetRendered: (f, m) => {
1129
- f.full_name && u.current[f.full_name] === m && delete u.current[f.full_name], c?.(f, m);
1208
+ unsetRendered: (l, d) => {
1209
+ l.full_name && u.current[l.full_name] === d && delete u.current[l.full_name], f?.(l, d);
1130
1210
  },
1131
- canRender: (f, m) => t ? !0 : zn()?.view.full_name === f.full_name || r?.form.full_name === f.full_name || Object.values(u.current).includes(m),
1132
- setValue: y,
1133
- setValues: (f) => {
1134
- Object.keys(f).map((m) => y(m, f[m]));
1211
+ canRender: (l, d) => t ? !0 : b?.view.full_name === l.full_name || o?.form.full_name === l.full_name || Object.values(u.current).includes(d),
1212
+ setValue: E,
1213
+ setValues: (l) => {
1214
+ Object.keys(l).map((d) => E(d, l[d]));
1135
1215
  },
1136
1216
  getElements: () => u.current,
1137
1217
  allowDuplicates: t,
1138
- getParentViewContext: () => r || null,
1139
- getRootViewContext: () => r?.getRootViewContext() || r || C,
1140
- setRenderedError: (f) => {
1141
- g.current.includes(f) || g.current.push(f);
1218
+ getParentViewContext: () => o || null,
1219
+ getRootViewContext: () => o?.getRootViewContext() || o || y,
1220
+ setRenderedError: (l) => {
1221
+ p.current.includes(l) || p.current.push(l);
1142
1222
  },
1143
- isRenderedError: (f) => g.current.includes(f),
1144
- getRenderedErrors: () => g.current
1223
+ isRenderedError: (l) => p.current.includes(l),
1224
+ getRenderedErrors: () => p.current
1145
1225
  };
1146
- return /* @__PURE__ */ o(qe.Provider, { value: C, children: /* @__PURE__ */ o(ur, { children: n }) });
1147
- }, ur = ({ children: e }) => {
1148
- const t = Ee(), [n, r] = R(null), { form: s, unsetRendered: i, setRendered: a, canRender: l } = V();
1149
- return N(() => {
1150
- const c = t;
1151
- return a?.(s, c), r(c), () => {
1152
- };
1153
- }, []), !n || !l?.(s, n) ? /* @__PURE__ */ o(P, {}) : /* @__PURE__ */ o(P, { children: e });
1226
+ return /* @__PURE__ */ r(Ye.Provider, { value: y, children: /* @__PURE__ */ r(pr, { children: n }) });
1227
+ }, pr = ({ children: e }) => {
1228
+ const t = _e(), [n, o] = R(null), { form: s, unsetRendered: i, setRendered: a, canRender: c } = B();
1229
+ return N(() => (a?.(s, t), o(t), () => {
1230
+ i?.(s, t), o(null);
1231
+ }), []), !n || !c?.(s, n) ? /* @__PURE__ */ r(A, {}) : /* @__PURE__ */ r(A, { children: e });
1154
1232
  };
1155
- function V() {
1156
- const e = v.useContext(qe);
1233
+ function B() {
1234
+ const e = v.useContext(Ye);
1157
1235
  if (!e)
1158
1236
  throw new Error("UseFormView must be used within a FormViewProvider.");
1159
1237
  return e;
1160
1238
  }
1161
- function Yt() {
1162
- return v.useContext(qe);
1239
+ function Qt() {
1240
+ return v.useContext(Ye);
1163
1241
  }
1164
- const mr = _e(X(({ onSuccess: e, onError: t, onLoad: n, embedded: r = !1 }, s) => {
1165
- const { navigate: i, generateLink: a, generateActionLink: l } = T(), { action: c, setAction: u } = ee(), g = l(c), [h, y] = R(null), E = O(null), C = te(), { startLoading: f, stopLoading: m } = Nt() || {};
1166
- ye(s, () => ({
1167
- getFormRef: () => E.current
1242
+ const gr = Ne(He(({ onSuccess: e, onError: t, onLoad: n, embedded: o = !1 }, s) => {
1243
+ const { navigate: i, generateLink: a, generateActionLink: c } = M(), { action: f, setAction: u, refresh: p } = ne(), m = c(f), [b, E] = R(null), _ = O(void 0), y = re(), { startLoading: l, stopLoading: d } = Ot() || {}, g = O(null), [h, x] = R(null);
1244
+ fe(s, () => ({
1245
+ getFormRef: () => _.current
1168
1246
  }));
1169
- const d = (x) => {
1170
- let w = (x.errors || []).reduce((L, S) => {
1171
- const I = S.origin || x.full_name || "";
1172
- return { ...L, [I]: [...L[I] || [], S] };
1247
+ const P = (L) => {
1248
+ let I = (L.errors || []).reduce((K, Z) => {
1249
+ const ie = Z.origin || L.full_name || "";
1250
+ return { ...K, [ie]: [...K[ie] || [], Z] };
1173
1251
  }, {});
1174
- for (let [, L] of Object.entries(x?.children || []))
1175
- w = { ...w, ...d(L) };
1176
- return w;
1177
- }, b = (x) => {
1178
- f?.(p?.full_name || "form"), u({
1179
- ...c,
1180
- method: Ve.POST,
1181
- body: x,
1182
- bodyType: ut.FormData
1183
- });
1252
+ for (let [, K] of Object.entries(L?.children || []))
1253
+ I = { ...I, ...P(K) };
1254
+ return I;
1255
+ }, D = (L) => {
1256
+ l?.(S?.full_name || "form"), g.current = setTimeout(() => d?.(S?.full_name || "form"), 250), L.append("_ts", Date.now().toString()), x(L);
1184
1257
  };
1185
1258
  N(() => {
1259
+ h && (g.current && clearTimeout(g.current), u({
1260
+ ...f,
1261
+ method: qe.POST,
1262
+ body: h,
1263
+ bodyType: pt.FormData
1264
+ }));
1265
+ }, [h ? JSON.stringify($e(h)) : null]), N(() => {
1186
1266
  n && n();
1187
1267
  }, []), N(() => {
1188
- const x = C?.results?.form?.modify?.view;
1189
- if (!x)
1268
+ const L = y?.results?.form?.modify?.view;
1269
+ if (!L)
1270
+ return;
1271
+ const I = y.results, K = P(L);
1272
+ if (E(I), d?.(L?.full_name || "form"), _.current?.setErrors(K), !L.submitted || y?.status !== 200 || Object.entries(K).length)
1190
1273
  return;
1191
- const w = C.results, L = d(x);
1192
- if (y(w), m?.(x?.full_name || "form"), E.current?.setErrors(L), !x.submitted || C?.status !== 200 || Object.entries(L).length)
1274
+ if (!h) {
1275
+ p();
1193
1276
  return;
1194
- E.current?.success();
1195
- const S = () => {
1196
- w.redirect && !r && i(a(w.redirect.route, { ...c.parameters || {}, ...w.redirect.parameters }), !0);
1277
+ }
1278
+ _.current?.success();
1279
+ const Z = () => {
1280
+ I.redirect && !o && i(a(I.redirect.route, { ...f.parameters || {}, ...I.redirect.parameters }), !0);
1197
1281
  };
1198
- e ? e(w).then(() => S()) : S();
1199
- }, [C?.results]);
1200
- const p = h?.form?.modify?.view;
1201
- if (p)
1202
- return /* @__PURE__ */ o(Un, { loader: p.full_name, children: /* @__PURE__ */ o(
1203
- _t,
1282
+ if (e) {
1283
+ const ie = e(I);
1284
+ ie instanceof Promise ? ie.then(() => Z()) : Z();
1285
+ } else
1286
+ Z();
1287
+ }, [y?.results]);
1288
+ const S = b?.form?.modify?.view;
1289
+ if (S)
1290
+ return /* @__PURE__ */ r($n, { loader: S.full_name, children: /* @__PURE__ */ r(
1291
+ At,
1204
1292
  {
1205
- ref: E,
1206
- id: p.id || "form",
1207
- name: p.name || "form",
1208
- action: g,
1293
+ ref: _,
1294
+ id: S.id || "form",
1295
+ name: S.name || "form",
1296
+ action: m,
1209
1297
  method: "POST",
1210
- onSubmit: b,
1211
- children: /* @__PURE__ */ o(ne, { view: p, children: /* @__PURE__ */ o(k, { name: "content", children: /* @__PURE__ */ _(
1212
- F,
1298
+ onSubmit: D,
1299
+ children: /* @__PURE__ */ r(oe, { view: S, children: /* @__PURE__ */ r(T, { name: "content", children: /* @__PURE__ */ C(
1300
+ j,
1213
1301
  {
1214
- view: p.name || "form",
1302
+ view: S.name || "form",
1215
1303
  prefix: "modify/form",
1216
- data: p,
1304
+ data: S,
1217
1305
  children: [
1218
- /* @__PURE__ */ o(k, { name: "messages", children: Object.keys(h?.messages || {}).map((x, w) => /* @__PURE__ */ o(
1306
+ /* @__PURE__ */ r(T, { name: "messages", children: Object.keys(b?.messages || {}).map((L, I) => /* @__PURE__ */ r(
1219
1307
  "div",
1220
1308
  {
1221
- className: ["alert", "alert-" + x].join(" "),
1222
- children: (h?.messages[x] || ["Item was saved successful."]).join(" ")
1309
+ className: ["alert", "alert-" + L].join(" "),
1310
+ children: (b?.messages[L] || ["Item was saved successful."]).join(" ")
1223
1311
  },
1224
- "alert-" + x
1312
+ "alert-" + L
1225
1313
  )) }),
1226
- /* @__PURE__ */ o(lr, { className: "alert alert-danger" }),
1227
- /* @__PURE__ */ o(cr, {}),
1228
- /* @__PURE__ */ o(k, { name: "actions", children: /* @__PURE__ */ o(ue, { type: "submit", className: "btn btn-primary", children: /* @__PURE__ */ o(U, { children: "Save" }) }) })
1314
+ /* @__PURE__ */ r(mr, { className: "alert alert-danger" }),
1315
+ /* @__PURE__ */ r(fr, {}),
1316
+ /* @__PURE__ */ r(T, { name: "actions", children: /* @__PURE__ */ r(he, { type: "submit", className: "btn btn-primary", children: /* @__PURE__ */ r(k, { children: "Save" }) }) })
1229
1317
  ]
1230
1318
  },
1231
- p.id || "form"
1319
+ S.id || "form"
1232
1320
  ) }) })
1233
1321
  }
1234
1322
  ) });
1235
- }), { name: "form" }), Wt = _e(X(({
1323
+ }), { name: "form" }), Zt = Ne(He(({
1236
1324
  children: e,
1237
1325
  ...t
1238
1326
  }, n) => {
1239
- const { closeModal: r, modal: s } = ze(), {
1327
+ const { closeModal: o, modal: s } = Xe(), {
1240
1328
  open: i = !0,
1241
1329
  animation: a = "fade",
1242
- backdrop: l = !0,
1243
- keyboard: c = !0,
1330
+ backdrop: c = !0,
1331
+ keyboard: f = !0,
1244
1332
  size: u,
1245
- onClose: g,
1246
- className: h
1247
- } = { ...t, ...s?.props || {} }, [y, E] = R(i);
1248
- ye(n, () => ({
1249
- toggle: () => E(!y),
1333
+ onClose: p,
1334
+ className: m
1335
+ } = { ...t, ...s?.props || {} }, [b, E] = R(i);
1336
+ fe(n, () => ({
1337
+ toggle: () => E(!b),
1250
1338
  open: () => E(!0),
1251
- close: () => b(),
1252
- isOpen: () => y
1339
+ close: () => g(),
1340
+ isOpen: () => b
1253
1341
  })), N(() => {
1254
1342
  E(i);
1255
1343
  }, [i]);
1256
- const C = (p) => {
1257
- if (c)
1258
- switch (p.key) {
1344
+ const _ = (h) => {
1345
+ if (f)
1346
+ switch (h.key) {
1259
1347
  case "Escape": {
1260
- b();
1348
+ g();
1261
1349
  break;
1262
1350
  }
1263
1351
  }
1264
1352
  };
1265
1353
  N(() => {
1266
- if (!y)
1354
+ if (!b)
1267
1355
  return;
1268
- const p = () => {
1269
- f.current?.addEventListener("animationend", x);
1356
+ const h = () => {
1357
+ y.current?.addEventListener("animationend", x);
1270
1358
  }, x = () => {
1271
- f.current?.classList.remove(a), f.current?.removeEventListener("animationstart", p), f.current?.removeEventListener("animationend", x);
1359
+ y.current?.classList.remove(a), y.current?.removeEventListener("animationstart", h), y.current?.removeEventListener("animationend", x);
1272
1360
  };
1273
1361
  return setTimeout(() => {
1274
- f.current?.classList.add("d-block", "show"), m?.current?.classList.add("show");
1275
- }, a ? 100 : 0), document.addEventListener("keydown", C), f.current?.addEventListener("animationstart", p), () => {
1276
- document.removeEventListener("keydown", C), f.current?.removeEventListener("animationstart", p), f.current?.removeEventListener("animationend", x);
1362
+ y.current?.classList.add("d-block", "show"), l?.current?.classList.add("show");
1363
+ }, a ? 100 : 0), document.addEventListener("keydown", _), y.current?.addEventListener("animationstart", h), () => {
1364
+ document.removeEventListener("keydown", _), y.current?.removeEventListener("animationstart", h), y.current?.removeEventListener("animationend", x);
1277
1365
  };
1278
- }, [y]);
1279
- const f = O(null), m = O(null), d = () => {
1280
- E(!1), r?.();
1281
- }, b = () => new Promise((p, x) => {
1282
- if (!y)
1283
- return p();
1284
- const w = () => {
1285
- f?.current?.classList.remove("show", "d-block"), p(), d();
1366
+ }, [b]);
1367
+ const y = O(null), l = O(null), d = () => {
1368
+ E(!1), o?.();
1369
+ }, g = () => new Promise((h, x) => {
1370
+ if (!b)
1371
+ return h();
1372
+ const P = () => {
1373
+ y?.current?.classList.remove("show", "d-block"), h(), d();
1286
1374
  };
1287
1375
  if (a) {
1288
- const L = setTimeout(() => {
1289
- w();
1376
+ const D = setTimeout(() => {
1377
+ P();
1290
1378
  }, a ? 50 : 0);
1291
- f.current?.addEventListener("animationstart", () => {
1292
- clearTimeout(L), f.current?.removeEventListener("animationend", w), f.current?.addEventListener("animationend", w);
1293
- }), f.current?.classList.add(a, "close");
1379
+ y.current?.addEventListener("animationstart", () => {
1380
+ clearTimeout(D), y.current?.removeEventListener("animationend", P), y.current?.addEventListener("animationend", P);
1381
+ }), y.current?.classList.add(a, "close");
1294
1382
  } else
1295
- w();
1383
+ P();
1296
1384
  });
1297
1385
  return N(() => () => {
1298
- g && g();
1299
- }, []), y && Rn(/* @__PURE__ */ _(P, { children: [
1300
- /* @__PURE__ */ o(
1386
+ p && p();
1387
+ }, []), b && Tn(/* @__PURE__ */ C(A, { children: [
1388
+ /* @__PURE__ */ r(
1301
1389
  "div",
1302
1390
  {
1303
- ref: f,
1304
- className: ["modal", u && "modal-" + u, a && a, h].filter((p) => p).join(" "),
1305
- children: /* @__PURE__ */ o("div", { className: "modal-dialog modal-dialog-centered", role: "document", children: /* @__PURE__ */ _("div", { className: "modal-content", children: [
1306
- /* @__PURE__ */ o(k, { name: "header", children: /* @__PURE__ */ _("div", { className: "modal-header", children: [
1307
- /* @__PURE__ */ o("h5", { className: "modal-title", id: "exampleModalLabel", children: /* @__PURE__ */ o(k, { name: "title", children: "Title" }) }),
1308
- /* @__PURE__ */ o(k, { name: "navigation", children: /* @__PURE__ */ o("nav", { children: e }) }),
1309
- /* @__PURE__ */ o("button", { onClick: b, type: "button", className: "btn-close", "aria-label": "Close" })
1391
+ ref: y,
1392
+ className: ["modal", u && "modal-" + u, a && a, m].filter((h) => h).join(" "),
1393
+ children: /* @__PURE__ */ r("div", { className: "modal-dialog modal-dialog-centered", role: "document", children: /* @__PURE__ */ C("div", { className: "modal-content", children: [
1394
+ /* @__PURE__ */ r(T, { name: "header", children: /* @__PURE__ */ C("div", { className: "modal-header", children: [
1395
+ /* @__PURE__ */ r("h5", { className: "modal-title", id: "exampleModalLabel", children: /* @__PURE__ */ r(T, { name: "title", children: "Title" }) }),
1396
+ /* @__PURE__ */ r(T, { name: "navigation", children: /* @__PURE__ */ r("nav", { children: e }) }),
1397
+ /* @__PURE__ */ r("button", { onClick: g, type: "button", className: "btn-close", "aria-label": "Close" })
1310
1398
  ] }) }),
1311
- /* @__PURE__ */ o("div", { className: "modal-body", children: /* @__PURE__ */ o(k, { name: "content", children: e }) }),
1312
- /* @__PURE__ */ o(k, { name: "footer", children: /* @__PURE__ */ o("div", { className: "modal-footer", children: /* @__PURE__ */ o(k, { name: "actions", children: /* @__PURE__ */ o("button", { onClick: b, type: "button", className: "btn btn-secondary", children: "Close" }) }) }) })
1399
+ /* @__PURE__ */ r("div", { className: "modal-body", children: /* @__PURE__ */ r(T, { name: "content", children: e }) }),
1400
+ /* @__PURE__ */ r(T, { name: "footer", children: /* @__PURE__ */ r("div", { className: "modal-footer", children: /* @__PURE__ */ r(T, { name: "actions", children: /* @__PURE__ */ r("button", { onClick: g, type: "button", className: "btn btn-secondary", children: "Close" }) }) }) })
1313
1401
  ] }) })
1314
1402
  }
1315
1403
  ),
1316
- l && /* @__PURE__ */ o(
1404
+ c && /* @__PURE__ */ r(
1317
1405
  "div",
1318
1406
  {
1319
- ref: m,
1320
- className: ["modal-backdrop", "fade", ...a && ["show"]].filter((p) => p).join(" ")
1407
+ ref: l,
1408
+ className: ["modal-backdrop", "fade", ...a && ["show"]].filter((h) => h).join(" ")
1321
1409
  }
1322
1410
  )
1323
1411
  ] }), document.body);
1324
- }), { name: "modal" }), fr = ({
1412
+ }), { name: "modal" }), br = ({
1325
1413
  animationData: e,
1326
1414
  path: t,
1327
1415
  options: n,
1328
- width: r,
1416
+ width: o,
1329
1417
  height: s,
1330
1418
  className: i,
1331
1419
  ...a
1332
1420
  }) => {
1333
- const l = O(null);
1421
+ const c = O(null);
1334
1422
  return N(() => {
1335
- if (!l.current)
1423
+ if (!c.current)
1336
1424
  return;
1337
- const c = kn.loadAnimation({
1425
+ const f = n?.autoplay !== void 0 ? n?.autoplay : !0, u = In.loadAnimation({
1338
1426
  renderer: "svg",
1339
1427
  loop: !1,
1340
- autoplay: !0,
1341
1428
  rendererSettings: {
1342
1429
  preserveAspectRatio: "xMidYMid meet"
1343
1430
  },
1344
1431
  animationData: e,
1345
1432
  path: t,
1346
- container: l.current,
1347
- ...n || {}
1433
+ container: c.current,
1434
+ ...n || {},
1435
+ autoplay: !1
1348
1436
  });
1349
- return () => {
1350
- c.destroy();
1437
+ let p = null;
1438
+ return f && (p = new IntersectionObserver((m) => {
1439
+ m.forEach((b) => {
1440
+ b.isIntersecting && u.play();
1441
+ });
1442
+ }), p.observe(c.current)), () => {
1443
+ p?.disconnect(), u.destroy();
1351
1444
  };
1352
- }, []), /* @__PURE__ */ o("div", { className: i, ref: l, style: { width: r, height: s } });
1353
- }, zt = v.createContext(void 0);
1354
- var Q = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.denied = 1] = "denied", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e[e.confirm = 4] = "confirm", e))(Q || {});
1355
- function He() {
1356
- const e = v.useContext(zt);
1445
+ }, []), /* @__PURE__ */ r("div", { className: i, ref: c, style: { width: o, height: s } });
1446
+ }, Xt = v.createContext(void 0);
1447
+ var ee = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.denied = 1] = "denied", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e[e.confirm = 4] = "confirm", e))(ee || {});
1448
+ function We() {
1449
+ const e = v.useContext(Xt);
1357
1450
  if (e === void 0)
1358
1451
  throw new Error("UseAlert must be within AlertProvider");
1359
1452
  return e;
1360
1453
  }
1361
- function Jt({ children: e }) {
1362
- const [t, n] = R(), r = O(0), s = O(void 0), [i, a] = R(null);
1454
+ function en({ children: e }) {
1455
+ const [t, n] = R(), o = O(0), s = O(void 0), [i, a] = R(null);
1363
1456
  N(() => {
1364
- r.current += 1;
1457
+ o.current += 1;
1365
1458
  }, [t]);
1366
- const l = /* @__PURE__ */ Object.assign({ "/src/assets/images/alert/denied.json": () => import("./denied-CgoMpaA7.js"), "/src/assets/images/alert/info.json": () => import("./info-D-NzIEYs.js"), "/src/assets/images/alert/success.json": () => import("./success-Bu_BJcf1.js"), "/src/assets/images/alert/warning.json": () => import("./warning-B1nr7TsB.js") }), c = () => {
1459
+ const c = /* @__PURE__ */ Object.assign({ "/src/assets/images/alert/denied.json": () => import("./denied-CgoMpaA7.js"), "/src/assets/images/alert/info.json": () => import("./info-D-NzIEYs.js"), "/src/assets/images/alert/success.json": () => import("./success-Bu_BJcf1.js"), "/src/assets/images/alert/warning.json": () => import("./warning-B1nr7TsB.js") }), f = () => {
1367
1460
  a(null), n(void 0);
1368
- }, u = (h) => {
1369
- let y = {
1461
+ }, u = (m) => {
1462
+ let b = {
1370
1463
  title: "Are you confirm?",
1371
1464
  icon: 3,
1372
1465
  animation: "scale",
1373
1466
  size: "auto",
1374
1467
  allowClose: !1,
1375
1468
  timeoutProgress: !1,
1376
- ...h || {}
1469
+ ...m || {}
1377
1470
  };
1378
1471
  const E = {
1379
1472
  0: "success.json",
@@ -1382,13 +1475,13 @@ function Jt({ children: e }) {
1382
1475
  3: "info.json",
1383
1476
  4: "info.json"
1384
1477
  };
1385
- if (Object.hasOwn(E, y.icon)) {
1386
- const C = E[y.icon], f = Object.keys(l).filter((m) => m.endsWith(C)).pop();
1387
- f && l[f]().then((m) => {
1388
- a(m.default);
1478
+ if (Object.hasOwn(E, b.icon)) {
1479
+ const _ = E[b.icon], y = Object.keys(c).filter((l) => l.endsWith(_)).pop();
1480
+ y && c[y]().then((l) => {
1481
+ a(l.default);
1389
1482
  });
1390
1483
  }
1391
- !y.actions && !y.timeoutProgress ? y.actions = {
1484
+ !b.actions && !b.timeoutProgress ? b.actions = {
1392
1485
  cancel: {
1393
1486
  label: "Cancel",
1394
1487
  classList: ["btn-outline-primary"]
@@ -1397,22 +1490,22 @@ function Jt({ children: e }) {
1397
1490
  label: "Confirm"
1398
1491
  }
1399
1492
  } : setTimeout(() => {
1400
- s.current?.close().finally(c);
1401
- }, y.timeout || 1e3), s.current?.isOpen() ? s.current?.close().finally(() => {
1402
- n(y);
1403
- }) : n(y);
1404
- }, g = (h) => {
1405
- const y = {
1406
- [h]: !0,
1407
- isConfirmed: h === "confirm",
1408
- isCancelled: h === "cancel",
1409
- isDenied: h === "deny"
1493
+ s.current?.close().finally(f);
1494
+ }, b.timeout || 1e3), s.current?.isOpen() ? s.current?.close().finally(() => {
1495
+ n(b);
1496
+ }) : n(b);
1497
+ }, p = (m) => {
1498
+ const b = {
1499
+ [m]: !0,
1500
+ isConfirmed: m === "confirm",
1501
+ isCancelled: m === "cancel",
1502
+ isDenied: m === "deny"
1410
1503
  };
1411
- t?.onResult && t.onResult(y), s.current?.close().then(c);
1504
+ t?.onResult && t.onResult(b), s.current?.close().then(f);
1412
1505
  };
1413
- return /* @__PURE__ */ _(zt.Provider, { value: { open: u }, children: [
1414
- t && /* @__PURE__ */ _(
1415
- Wt,
1506
+ return /* @__PURE__ */ C(Xt.Provider, { value: { open: u }, children: [
1507
+ t && /* @__PURE__ */ C(
1508
+ Zt,
1416
1509
  {
1417
1510
  size: t.size,
1418
1511
  className: "modal-alert",
@@ -1420,65 +1513,65 @@ function Jt({ children: e }) {
1420
1513
  open: !0,
1421
1514
  ref: s,
1422
1515
  children: [
1423
- /* @__PURE__ */ o(q, { name: "header" }),
1424
- /* @__PURE__ */ o(q, { name: "footer" }),
1425
- /* @__PURE__ */ o(q, { name: "content", children: /* @__PURE__ */ _("div", { className: "d-flex flex-column align-items-center", children: [
1426
- i !== null && /* @__PURE__ */ o(fr, { className: "modal-alert-icon", animationData: i }),
1427
- /* @__PURE__ */ o("h3", { className: "modal-alert-title", children: t.title }),
1428
- !!t.text?.length && /* @__PURE__ */ o("p", { className: "modal-alert-text", children: t.text }),
1429
- t.actions && /* @__PURE__ */ o("div", { className: "d-flex justify-content-center align-items-center", children: Object.keys(t.actions).map((h) => /* @__PURE__ */ o(
1430
- ue,
1516
+ /* @__PURE__ */ r(H, { name: "header" }),
1517
+ /* @__PURE__ */ r(H, { name: "footer" }),
1518
+ /* @__PURE__ */ r(H, { name: "content", children: /* @__PURE__ */ C("div", { className: "d-flex flex-column align-items-center", children: [
1519
+ i !== null && /* @__PURE__ */ r(br, { className: "modal-alert-icon", animationData: i }),
1520
+ /* @__PURE__ */ r("h3", { className: "modal-alert-title", children: t.title }),
1521
+ !!t.text?.length && /* @__PURE__ */ r("p", { className: "modal-alert-text", children: t.text }),
1522
+ t.actions && /* @__PURE__ */ r("div", { className: "d-flex justify-content-center align-items-center", children: Object.keys(t.actions).map((m) => /* @__PURE__ */ r(
1523
+ he,
1431
1524
  {
1432
- className: "btn btn-lg mx-2 " + (t.actions?.[h].classList ?? ["btn-primary"]).join(" "),
1433
- onClick: () => g(h),
1434
- children: (t.actions?.[h] ?? null)?.label || h
1525
+ className: "btn btn-lg mx-2 " + (t.actions?.[m].classList ?? ["btn-primary"]).join(" "),
1526
+ onClick: () => p(m),
1527
+ children: (t.actions?.[m] ?? null)?.label || m
1435
1528
  },
1436
- h
1529
+ m
1437
1530
  )) })
1438
1531
  ] }) })
1439
1532
  ]
1440
1533
  },
1441
- r.current
1534
+ o.current
1442
1535
  ),
1443
1536
  e
1444
1537
  ] });
1445
1538
  }
1446
- function Mo(e) {
1447
- return (t) => /* @__PURE__ */ o(Jt, { children: /* @__PURE__ */ o(e, { ...t }) });
1539
+ function $o(e) {
1540
+ return (t) => /* @__PURE__ */ r(en, { children: /* @__PURE__ */ r(e, { ...t }) });
1448
1541
  }
1449
- const pr = _e(({ children: e }) => {
1450
- const { action: t } = ee(), { getAction: n, generateLink: r } = T(), s = n(t.action.entity, "list", t.action.namespace);
1451
- return /* @__PURE__ */ _("section", { className: "edit", children: [
1452
- /* @__PURE__ */ _("header", { children: [
1453
- /* @__PURE__ */ _("h2", { className: "title", children: [
1454
- s && /* @__PURE__ */ o(j, { to: r(s.route, t.parameters), children: "←" }),
1455
- /* @__PURE__ */ o(k, { name: "title" })
1542
+ const yr = Ne(({ children: e }) => {
1543
+ const { action: t } = ne(), { getAction: n, generateLink: o } = M(), s = n(t.action.entity, "list", t.action.namespace);
1544
+ return /* @__PURE__ */ C("section", { className: "edit", children: [
1545
+ /* @__PURE__ */ C("header", { children: [
1546
+ /* @__PURE__ */ C("h2", { className: "title", children: [
1547
+ s && /* @__PURE__ */ r(U, { to: o(s.route, t.parameters), children: "←" }),
1548
+ /* @__PURE__ */ r(T, { name: "title" })
1456
1549
  ] }),
1457
- /* @__PURE__ */ o("nav", { children: /* @__PURE__ */ o(k, { name: "navigation" }) })
1550
+ /* @__PURE__ */ r("nav", { children: /* @__PURE__ */ r(T, { name: "navigation" }) })
1458
1551
  ] }),
1459
- /* @__PURE__ */ _("main", { children: [
1460
- /* @__PURE__ */ o(k, { name: "content" }),
1461
- /* @__PURE__ */ o(k, { name: "actions" })
1552
+ /* @__PURE__ */ C("main", { children: [
1553
+ /* @__PURE__ */ r(T, { name: "content" }),
1554
+ /* @__PURE__ */ r(T, { name: "actions" })
1462
1555
  ] })
1463
1556
  ] });
1464
- }, { name: "modify" }), tt = Tt(({ template: e, children: t, onSuccess: n, modal: r }) => {
1465
- const { open: s } = He(), { closeModal: i } = ze(), a = te(), l = r ? Wt : e || pr;
1557
+ }, { name: "modify" }), st = Mt(({ template: e, children: t, onSuccess: n, modal: o }) => {
1558
+ const { open: s } = We(), { closeModal: i } = Xe(), a = re(), c = o ? Zt : e || yr;
1466
1559
  if (a)
1467
- return /* @__PURE__ */ _(l, { children: [
1468
- /* @__PURE__ */ o(q, { name: "title", children: a?.results?.title || "Title" }),
1469
- /* @__PURE__ */ o(q, { name: "navigation", children: /* @__PURE__ */ o(F, { view: "navigation", prefix: "modify" }) }),
1470
- /* @__PURE__ */ o(q, { name: "content", children: /* @__PURE__ */ o(F, { view: "content", prefix: "modify", children: /* @__PURE__ */ o(
1471
- mr,
1560
+ return /* @__PURE__ */ C(c, { children: [
1561
+ /* @__PURE__ */ r(H, { name: "title", children: /* @__PURE__ */ r(k, { children: a?.results?.title || "Title" }) }),
1562
+ /* @__PURE__ */ r(H, { name: "navigation", children: /* @__PURE__ */ r(j, { view: "navigation", prefix: "modify" }) }),
1563
+ /* @__PURE__ */ r(H, { name: "content", children: /* @__PURE__ */ r(j, { view: "content", prefix: "modify", children: /* @__PURE__ */ r(
1564
+ gr,
1472
1565
  {
1473
- onSuccess: (c) => new Promise((u, g) => {
1566
+ onSuccess: (f) => new Promise((u, p) => {
1474
1567
  i();
1475
- const h = new CustomEvent("success", { detail: c, cancelable: !0 });
1476
- if (n && n(h, c), h.defaultPrevented)
1477
- return g();
1568
+ const m = new CustomEvent("success", { detail: f, cancelable: !0 });
1569
+ if (n && n(m, f), m.defaultPrevented)
1570
+ return p();
1478
1571
  s({
1479
1572
  title: "Success",
1480
- text: Object.values(c.messages?.success ?? []).join(" ") ?? "Item was saved successful!",
1481
- icon: Q.success,
1573
+ text: Object.values(f.messages?.success ?? []).join(" ") ?? "Item was saved successful!",
1574
+ icon: ee.success,
1482
1575
  actions: {
1483
1576
  close: {
1484
1577
  label: "OK"
@@ -1489,11 +1582,11 @@ const pr = _e(({ children: e }) => {
1489
1582
  }
1490
1583
  });
1491
1584
  }),
1492
- onError: (c) => {
1585
+ onError: (f) => {
1493
1586
  s({
1494
- title: c.status + " " + c.detail,
1495
- text: c.detail,
1496
- icon: Q.denied,
1587
+ title: f.status + " " + f.detail,
1588
+ text: f.detail,
1589
+ icon: ee.denied,
1497
1590
  actions: {
1498
1591
  close: {
1499
1592
  label: "OK"
@@ -1503,103 +1596,103 @@ const pr = _e(({ children: e }) => {
1503
1596
  },
1504
1597
  onLoad: () => {
1505
1598
  },
1506
- embedded: r,
1507
- children: /* @__PURE__ */ o(q, { name: "actions" })
1599
+ embedded: o,
1600
+ children: /* @__PURE__ */ r(H, { name: "actions" })
1508
1601
  }
1509
1602
  ) }) }),
1510
- /* @__PURE__ */ o(q, { name: "actions", children: /* @__PURE__ */ o(
1511
- ue,
1603
+ /* @__PURE__ */ r(H, { name: "actions", children: /* @__PURE__ */ r(
1604
+ he,
1512
1605
  {
1513
1606
  type: "submit",
1514
1607
  className: "btn btn-primary",
1515
1608
  form: a?.results?.form?.modify?.view.full_name || "modify",
1516
- children: /* @__PURE__ */ o(U, { children: "Submit" })
1609
+ children: /* @__PURE__ */ r(k, { children: "Submit" })
1517
1610
  }
1518
1611
  ) }),
1519
1612
  t
1520
1613
  ] });
1521
1614
  });
1522
- var Ke = /* @__PURE__ */ ((e) => (e.List = "list", e.Object = "object", e.Internal = "internal", e))(Ke || {});
1523
- const Qt = v.createContext(void 0);
1524
- function B() {
1525
- const e = v.useContext(Qt);
1615
+ var ze = /* @__PURE__ */ ((e) => (e.List = "list", e.Object = "object", e.Internal = "internal", e))(ze || {});
1616
+ const tn = v.createContext(void 0);
1617
+ function $() {
1618
+ const e = v.useContext(tn);
1526
1619
  if (e === void 0)
1527
1620
  throw new Error("UseList must be within ListProvider");
1528
- const { data: t, onClick: n } = e, r = t?.entity?.primaryColumn, s = (t?.entity?.columns || []).filter((u) => u.visible).filter((u) => u.group !== !1), i = Object.values(t?.action || []), a = i.filter((u) => u.visibility === Ke.Object), l = s.length + (i.length ? 1 : 0), c = t?.entity?.data.items ?? [];
1621
+ const { data: t, onClick: n } = e, o = t?.entity?.primaryColumn, s = (t?.entity?.columns || []).filter((u) => u.visible).filter((u) => u.group !== !1), i = Object.values(t?.action || []), a = i.filter((u) => u.visibility === ze.Object), c = s.length + (i.length ? 1 : 0), f = t?.entity?.data.items ?? [];
1529
1622
  return {
1530
1623
  data: t,
1531
1624
  columns: s,
1532
1625
  actions: i,
1533
1626
  objectActions: a,
1534
- columnsTotal: l,
1535
- primaryColumn: r,
1536
- items: c,
1627
+ columnsTotal: c,
1628
+ primaryColumn: o,
1629
+ items: f,
1537
1630
  onClick: n
1538
1631
  };
1539
1632
  }
1540
- function hr({ data: e, onClick: t, ...n }) {
1541
- const { results: r } = te() || {};
1542
- return e ??= r, /* @__PURE__ */ o(Qt.Provider, { value: { data: e, onClick: t }, children: n.children });
1633
+ function vr({ data: e, onClick: t, ...n }) {
1634
+ const { results: o } = re() || {};
1635
+ return e ??= o, /* @__PURE__ */ r(tn.Provider, { value: { data: e, onClick: t }, children: n.children });
1543
1636
  }
1544
- const Zt = v.createContext(void 0);
1545
- function fe() {
1546
- const e = v.useContext(Zt);
1637
+ const nn = v.createContext(void 0);
1638
+ function ge() {
1639
+ const e = v.useContext(nn);
1547
1640
  if (e === void 0)
1548
1641
  throw new Error("UseListItem must be within ListItemProvider");
1549
- const { index: t } = e, { data: n, primaryColumn: r } = B();
1642
+ const { index: t } = e, { data: n, primaryColumn: o } = $();
1550
1643
  return {
1551
1644
  index: t,
1552
- id: n?.entity?.data.items[t][r?.field || ""] ?? null,
1645
+ id: n?.entity?.data.items[t][o?.field || ""] ?? null,
1553
1646
  data: n?.entity?.data.items[t] ?? null
1554
1647
  };
1555
1648
  }
1556
- function Xt({ index: e, ...t }) {
1557
- return /* @__PURE__ */ o(Zt.Provider, { value: { index: e }, children: t.children });
1649
+ function rn({ index: e, ...t }) {
1650
+ return /* @__PURE__ */ r(nn.Provider, { value: { index: e }, children: t.children });
1558
1651
  }
1559
- const en = ({ column: e, namespace: t }) => {
1560
- const { data: n } = fe();
1561
- return n && /* @__PURE__ */ o(F, { namespace: t, data: n, prefix: "list", view: e.field, children: n[e.field] !== void 0 && (n[e.field] instanceof Object ? n[e.field] instanceof Array ? n[e.field].join(", ") : JSON.stringify(n[e.field]) : n[e.field]?.toString()) });
1562
- }, tn = v.createContext(void 0);
1563
- function nn() {
1564
- return v.useContext(tn);
1652
+ const on = ({ column: e, namespace: t }) => {
1653
+ const { data: n } = ge();
1654
+ return n && /* @__PURE__ */ r(j, { namespace: t, data: n, prefix: "list", view: e.field, children: n[e.field] !== void 0 && (n[e.field] instanceof Object ? n[e.field] instanceof Array ? n[e.field].join(", ") : JSON.stringify(n[e.field]) : /* @__PURE__ */ r(k, { children: n[e.field]?.toString() })) });
1655
+ }, sn = v.createContext(void 0);
1656
+ function an() {
1657
+ return v.useContext(sn);
1565
1658
  }
1566
- function gr({ onClick: e, ...t }) {
1567
- const { data: n, items: r, primaryColumn: s } = B(), i = O([]), a = r.map((m) => m[s?.field || ""] || 0), l = !!a.length && a.reduce((m, d) => m && i.current.includes(d), !0), c = n?.form?.batch?.view?.children?.method?.choices?.reduce((m, d) => {
1568
- const b = d.label instanceof Function ? d.label(d) : d.label, p = d.value instanceof Function ? d.value() : d.value?.toString();
1569
- return { ...m, [p]: b };
1570
- }, {}), u = !!Object.keys(c || {}).length && s, [, g] = R(), h = (m, d = !1) => {
1571
- const b = a[m];
1572
- d ? i.current.push(b) : i.current = i.current.filter((p) => p !== b), g({});
1573
- }, y = (m = !1) => {
1574
- i.current = (m ? i.current.concat(a) : i.current.filter((d) => !a.includes(d))).filter((d, b, p) => p.indexOf(d) === b), g({});
1659
+ function Er({ onClick: e, ...t }) {
1660
+ const { data: n, items: o, primaryColumn: s } = $(), i = O([]), a = o.map((l) => l[s?.field || ""] || 0), c = !!a.length && a.reduce((l, d) => l && i.current.includes(d), !0), f = n?.form?.batch?.view?.children?.method?.choices?.reduce((l, d) => {
1661
+ const g = d.label instanceof Function ? d.label(d) : d.label, h = d.value instanceof Function ? d.value() : d.value?.toString();
1662
+ return { ...l, [h]: g };
1663
+ }, {}), u = !!Object.keys(f || {}).length && s, [, p] = R(), m = (l, d = !1) => {
1664
+ const g = a[l];
1665
+ d ? i.current.push(g) : i.current = i.current.filter((h) => h !== g), p({});
1666
+ }, b = (l = !1) => {
1667
+ i.current = (l ? i.current.concat(a) : i.current.filter((d) => !a.includes(d))).filter((d, g, h) => h.indexOf(d) === g), p({});
1575
1668
  }, E = () => {
1576
- i.current = [], g({});
1577
- }, C = (m) => {
1578
- const d = a[m];
1669
+ i.current = [], p({});
1670
+ }, _ = (l) => {
1671
+ const d = a[l];
1579
1672
  return i.current.includes(d);
1580
- }, f = (m) => new Promise((d, b) => {
1673
+ }, y = (l) => new Promise((d, g) => {
1581
1674
  if (!i)
1582
- return b();
1583
- const p = n?.form.batch.view;
1675
+ return g();
1676
+ const h = n?.form.batch.view;
1584
1677
  if (!u || !i.current?.length)
1585
- return b();
1678
+ return g();
1586
1679
  const x = new FormData();
1587
- i.current.forEach((w) => {
1588
- x.append(`${p?.children?.ids.full_name}[]`, w.toString());
1589
- }), x.append(p?.children?.method.full_name || "method", m), e(m, i.current, x).then(() => {
1680
+ i.current.forEach((P) => {
1681
+ x.append(`${h?.children?.ids.full_name}[]`, P.toString());
1682
+ }), x.append(h?.children?.method.full_name || "method", l), e(l, i.current, x).then(() => {
1590
1683
  E(), d();
1591
- }).catch(b);
1684
+ }).catch(g);
1592
1685
  });
1593
- return /* @__PURE__ */ o(
1594
- tn.Provider,
1686
+ return /* @__PURE__ */ r(
1687
+ sn.Provider,
1595
1688
  {
1596
1689
  value: {
1597
- actions: c,
1598
- toggle: h,
1599
- toggleAll: y,
1600
- isSelected: C,
1601
- isSelectedAll: l,
1602
- executeAction: f,
1690
+ actions: f,
1691
+ toggle: m,
1692
+ toggleAll: b,
1693
+ isSelected: _,
1694
+ isSelectedAll: c,
1695
+ executeAction: y,
1603
1696
  selected: i.current,
1604
1697
  clear: E
1605
1698
  },
@@ -1607,12 +1700,12 @@ function gr({ onClick: e, ...t }) {
1607
1700
  }
1608
1701
  );
1609
1702
  }
1610
- const rn = ({ className: e }) => {
1611
- const { index: t } = fe(), n = nn();
1703
+ const cn = ({ className: e }) => {
1704
+ const { index: t } = ge(), n = an();
1612
1705
  if (!n)
1613
- return /* @__PURE__ */ o(P, {});
1614
- const { actions: r, toggle: s, isSelected: i } = n;
1615
- return Object.keys(r || {}).length > 0 && /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(
1706
+ return /* @__PURE__ */ r(A, {});
1707
+ const { actions: o, toggle: s, isSelected: i } = n;
1708
+ return Object.keys(o || {}).length > 0 && /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
1616
1709
  "input",
1617
1710
  {
1618
1711
  checked: i(t),
@@ -1622,210 +1715,216 @@ const rn = ({ className: e }) => {
1622
1715
  onChange: (a) => s(t, a.target.checked)
1623
1716
  }
1624
1717
  ) });
1625
- }, on = ({ column: e, namespace: t }) => /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(F, { namespace: t, data: e, prefix: "list", view: e.field + ".label", children: e.label }) }), sn = ({ children: e, action: t, className: n }) => {
1626
- const { generateActionLink: r } = T(), { onClick: s } = B();
1627
- return /* @__PURE__ */ o(
1628
- j,
1718
+ }, ln = ({ column: e, namespace: t }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(j, { namespace: t, data: e, prefix: "list", view: e.field + ".label", children: /* @__PURE__ */ r(k, { children: e.label }) }) }), dn = ({ children: e, action: t, className: n }) => {
1719
+ const { generateActionLink: o } = M(), { onClick: s } = $();
1720
+ return /* @__PURE__ */ r(
1721
+ U,
1629
1722
  {
1630
1723
  onClick: (i) => {
1631
1724
  s && s(t, i);
1632
1725
  },
1633
1726
  className: n,
1634
- to: r(t),
1635
- children: e ?? t.action.title ?? t.action.name
1727
+ to: o(t),
1728
+ children: e ?? /* @__PURE__ */ r(k, { children: t.action.title ?? t.action.name })
1636
1729
  }
1637
1730
  );
1638
- }, br = ({ permission: e, children: t, id: n }) => {
1639
- const { results: r } = te() || {}, { id: s } = n ? { id: n } : fe();
1640
- if (!(e && !Object.values(r?.entity.acl[e] || []).map((i) => i.toString()).includes(s.toString())))
1641
- return /* @__PURE__ */ o(P, { children: t });
1642
- }, vr = ({ action: e, ...t }) => {
1643
- const { id: n } = fe();
1644
- return /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(br, { permission: e.action.permission, children: /* @__PURE__ */ o(sn, { ...t, action: { ...e, parameters: { ...e.parameters, id: n } } }) }) });
1645
- }, an = ({ namespace: e, routeParams: t }) => {
1646
- const { objectActions: n } = B(), { data: r } = fe();
1647
- return r && /* @__PURE__ */ o(F, { namespace: e, data: r, prefix: "list", view: "object.actions", children: n.map((s, i) => /* @__PURE__ */ o(
1648
- vr,
1731
+ }, Cr = ({ permission: e, children: t, id: n }) => {
1732
+ const { results: o } = re() || {}, { id: s } = n ? { id: n } : ge();
1733
+ if (!(e && !Object.values(o?.entity.acl[e] || []).map((i) => i.toString()).includes(s.toString())))
1734
+ return /* @__PURE__ */ r(A, { children: t });
1735
+ }, _r = ({ action: e, ...t }) => {
1736
+ const { id: n } = ge();
1737
+ return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Cr, { permission: e.action.permission, children: /* @__PURE__ */ r(dn, { ...t, action: { ...e, parameters: { ...e.parameters, id: n } } }) }) });
1738
+ }, un = ({ namespace: e, routeParams: t }) => {
1739
+ const { objectActions: n } = $(), { data: o } = ge();
1740
+ return o && /* @__PURE__ */ r(j, { namespace: e, data: o, prefix: "list", view: "object.actions", children: n.map((s, i) => /* @__PURE__ */ r(
1741
+ _r,
1649
1742
  {
1650
1743
  action: { action: s, parameters: t },
1651
1744
  className: ["btn", "btn-sm", "mb-1", "ms-1", (s.route?.methods ?? []).includes("DELETE") ? "btn-outline-danger" : "btn-outline-secondary"].join(" ")
1652
1745
  },
1653
1746
  i
1654
1747
  )) });
1655
- }, yr = X(({ routeParams: e, namespace: t, tableOptions: n, ...r }, s) => {
1656
- const { columns: i, primaryColumn: a, objectActions: l, columnsTotal: c, items: u, data: g, onClick: h } = B(), { action: y } = ee(), { options: E } = le(), C = {
1748
+ }, xr = ({
1749
+ routeParams: e,
1750
+ namespace: t,
1751
+ options: n,
1752
+ tableOptions: o,
1753
+ ...s
1754
+ }) => {
1755
+ const { columns: i, primaryColumn: a, objectActions: c, columnsTotal: f, items: u, data: p, onClick: m } = $(), { action: b } = ne(), { options: E } = te(), _ = {
1657
1756
  className: "table-responsive",
1658
- ...r,
1757
+ ...s,
1659
1758
  ...E?.GridView || {}
1660
1759
  };
1661
- return n = {
1760
+ return o = {
1662
1761
  className: "table table-striped table-hover",
1663
1762
  ...E?.HTMLTableElement || {},
1664
- ...n || {}
1665
- }, /* @__PURE__ */ o("div", { ...C, children: /* @__PURE__ */ _("table", { ...n, children: [
1666
- /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ _("tr", { children: [
1667
- i.map((f, m) => /* @__PURE__ */ _("th", { children: [
1668
- /* @__PURE__ */ o(on, { column: f, namespace: t }),
1669
- f.sortable && g?.sort?.[f.field] !== void 0 && /* @__PURE__ */ o(
1670
- j,
1671
- {
1672
- onClick: (d) => h && h({
1673
- ...y,
1674
- query: {
1675
- ...y.query,
1676
- sort: { [f.field]: g?.sort[f.field] ? g?.sort[f.field] === "ASC" ? "DESC" : "" : "ASC" }
1677
- }
1678
- }, d),
1679
- className: "btn btn-sm",
1680
- to: "#",
1681
- children: g.sort[f.field] ? g.sort[f.field] === "ASC" ? "⇑" : "⇓" : "⇅"
1682
- }
1683
- )
1684
- ] }, m)),
1685
- a && l.length > 0 && /* @__PURE__ */ o("th", { className: "text-end", children: /* @__PURE__ */ o(U, { children: "Actions" }) })
1763
+ ...o || {}
1764
+ }, /* @__PURE__ */ r("div", { ..._, children: /* @__PURE__ */ C("table", { ...o, children: [
1765
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ C("tr", { children: [
1766
+ i.map((y, l) => /* @__PURE__ */ tt("th", { ...y?.view?.header?.attr || {}, key: l }, /* @__PURE__ */ r(ln, { column: y, namespace: t }), y.sortable && p?.sort?.[y.field] !== void 0 && /* @__PURE__ */ r(
1767
+ U,
1768
+ {
1769
+ onClick: (d) => m && m({
1770
+ ...b,
1771
+ query: {
1772
+ ...b.query,
1773
+ sort: { [y.field]: p?.sort[y.field] ? p?.sort[y.field] === "ASC" ? "DESC" : "" : "ASC" }
1774
+ }
1775
+ }, d),
1776
+ className: "btn btn-sm",
1777
+ to: "#",
1778
+ children: p.sort[y.field] ? p.sort[y.field] === "ASC" ? "⇑" : "⇓" : "⇅"
1779
+ }
1780
+ ))),
1781
+ a && c.length > 0 && /* @__PURE__ */ r("th", { className: "text-end", children: /* @__PURE__ */ r(k, { children: "Actions" }) })
1686
1782
  ] }) }),
1687
- /* @__PURE__ */ o("tbody", { children: u.length ? u.map((f, m) => /* @__PURE__ */ o(Xt, { index: m, children: /* @__PURE__ */ _("tr", { children: [
1783
+ /* @__PURE__ */ r("tbody", { children: u.length ? u.map((y, l) => /* @__PURE__ */ r(rn, { index: l, children: /* @__PURE__ */ C("tr", { children: [
1688
1784
  i?.map(
1689
- (d, b) => /* @__PURE__ */ _("td", { children: [
1690
- b === 0 && /* @__PURE__ */ o(rn, { className: "me-2" }),
1691
- /* @__PURE__ */ o(en, { column: d, namespace: t })
1692
- ] }, b)
1785
+ (d, g) => {
1786
+ const h = n?.columns?.[d.field];
1787
+ return d = {
1788
+ ...d,
1789
+ ...h instanceof Function ? h(p?.entity?.data.items[l]) : n?.columns?.[d.field]
1790
+ }, /* @__PURE__ */ tt("td", { ...d?.view?.content?.attr || {}, key: g }, g === 0 && /* @__PURE__ */ r(cn, { className: "me-2" }), /* @__PURE__ */ r(on, { column: d, namespace: t }));
1791
+ }
1693
1792
  ),
1694
- a && l.length > 0 && /* @__PURE__ */ o("td", { className: "text-end text-nowrap", children: /* @__PURE__ */ o(an, { routeParams: e, namespace: t }) })
1695
- ] }) }, m)) : /* @__PURE__ */ o("tr", { children: /* @__PURE__ */ o("td", { colSpan: c, children: /* @__PURE__ */ o(U, { children: "Not results found." }) }) }) })
1793
+ a && c.length > 0 && /* @__PURE__ */ r("td", { className: "text-end text-nowrap", children: /* @__PURE__ */ r(un, { routeParams: e, namespace: t }) })
1794
+ ] }) }, l)) : /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: f, children: /* @__PURE__ */ r(k, { children: "Not results found." }) }) }) })
1696
1795
  ] }) });
1697
- }), se = ({ page: e, active: t = !1, title: n, children: r }) => {
1698
- const { generateActionLink: s } = T(), { onClick: i } = B(), { action: a } = ee(), l = {
1796
+ }, ae = ({ page: e, active: t = !1, title: n, children: o }) => {
1797
+ const { generateActionLink: s } = M(), { onClick: i } = $(), { action: a } = ne(), c = {
1699
1798
  ...a,
1700
1799
  query: {
1701
1800
  ...a.query || {},
1702
1801
  page: e.toString()
1703
1802
  }
1704
- }, c = s(l);
1705
- return /* @__PURE__ */ o("li", { className: `page-item ${t ? "active" : ""}`, children: /* @__PURE__ */ o(
1706
- j,
1803
+ }, f = s(c);
1804
+ return /* @__PURE__ */ r("li", { className: `page-item ${t ? "active" : ""}`, children: /* @__PURE__ */ r(
1805
+ U,
1707
1806
  {
1708
- to: c.toString(),
1807
+ to: f.toString(),
1709
1808
  ...i && {
1710
1809
  onClick: (u) => {
1711
- i(l, u);
1810
+ i(c, u);
1712
1811
  }
1713
1812
  },
1714
1813
  className: "page-link",
1715
1814
  title: n,
1716
- children: r || e
1815
+ children: o || e
1717
1816
  }
1718
1817
  ) });
1719
- }, Er = () => {
1720
- const { data: e } = B(), t = e?.entity?.data.meta, n = 1, r = t?.totalPages || 0, s = t?.page || n, i = t?.links, a = !!t?.totalPages;
1721
- return a && /* @__PURE__ */ _("div", { className: "d-flex flex-column justiry-content-center", children: [
1722
- /* @__PURE__ */ _("small", { className: "mb-2", children: [
1818
+ }, Nr = () => {
1819
+ const { data: e } = $(), t = e?.entity?.data.meta, n = 1, o = t?.totalPages || 0, s = t?.page || n, i = t?.links, a = !!t?.totalPages;
1820
+ return a && /* @__PURE__ */ C("div", { className: "d-flex flex-column justiry-content-center", children: [
1821
+ /* @__PURE__ */ C("small", { className: "mb-2", children: [
1723
1822
  t.totalResults,
1724
1823
  " Results",
1725
- a && /* @__PURE__ */ _(P, { children: [
1824
+ a && /* @__PURE__ */ C(A, { children: [
1726
1825
  " - Page ",
1727
1826
  s,
1728
1827
  " of ",
1729
1828
  t.totalPages
1730
1829
  ] })
1731
1830
  ] }),
1732
- a && /* @__PURE__ */ o("nav", { "aria-label": "Page navigation", className: "m-auto text-center d-inline", children: /* @__PURE__ */ _("ul", { className: "pagination pagination-sm", children: [
1733
- s > n && /* @__PURE__ */ o(se, { page: s - 1, title: "Go to First Page", children: "«" }),
1734
- t.links[0] !== n && /* @__PURE__ */ _(P, { children: [
1735
- /* @__PURE__ */ o(se, { page: 1, active: n === s }, 1),
1736
- /* @__PURE__ */ o("div", { className: "page-item", children: /* @__PURE__ */ o("a", { className: "page-link", children: "..." }) })
1831
+ a && /* @__PURE__ */ r("nav", { "aria-label": "Page navigation", className: "m-auto text-center d-inline", children: /* @__PURE__ */ C("ul", { className: "pagination pagination-sm", children: [
1832
+ s > n && /* @__PURE__ */ r(ae, { page: s - 1, title: "Go to First Page", children: "«" }),
1833
+ t.links[0] !== n && /* @__PURE__ */ C(A, { children: [
1834
+ /* @__PURE__ */ r(ae, { page: 1, active: n === s }, 1),
1835
+ /* @__PURE__ */ r("div", { className: "page-item", children: /* @__PURE__ */ r("a", { className: "page-link", children: "..." }) })
1737
1836
  ] }),
1738
- (i || []).map((l, c) => /* @__PURE__ */ o(se, { page: l, active: l === s }, c)),
1739
- [...t.links].reverse()[0] !== r && /* @__PURE__ */ _(P, { children: [
1740
- /* @__PURE__ */ o("div", { className: "page-item", children: /* @__PURE__ */ o("a", { className: "page-link", children: "..." }) }),
1741
- /* @__PURE__ */ o(
1742
- se,
1837
+ (i || []).map((c, f) => /* @__PURE__ */ r(ae, { page: c, active: c === s }, c)),
1838
+ [...t.links].reverse()[0] !== o && /* @__PURE__ */ C(A, { children: [
1839
+ /* @__PURE__ */ r("div", { className: "page-item", children: /* @__PURE__ */ r("a", { className: "page-link", children: "..." }) }),
1840
+ /* @__PURE__ */ r(
1841
+ ae,
1743
1842
  {
1744
- page: r,
1745
- active: r === s
1843
+ page: o,
1844
+ active: o === s
1746
1845
  },
1747
- r
1846
+ o
1748
1847
  )
1749
1848
  ] }),
1750
- s < r && /* @__PURE__ */ o(se, { page: t.totalPages, title: "Go to Last Page", children: "»" })
1849
+ s < o && /* @__PURE__ */ r(ae, { page: t.totalPages, title: "Go to Last Page", children: "»" }, "last")
1751
1850
  ] }) })
1752
1851
  ] });
1753
- }, $ = /* @__PURE__ */ new Map(), we = {
1852
+ }, q = /* @__PURE__ */ new Map(), Ae = {
1754
1853
  set(e, t, n) {
1755
- $.has(e) || $.set(e, /* @__PURE__ */ new Map());
1756
- const r = $.get(e);
1757
- if (!r.has(t) && r.size !== 0) {
1758
- console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(r.keys())[0]}.`);
1854
+ q.has(e) || q.set(e, /* @__PURE__ */ new Map());
1855
+ const o = q.get(e);
1856
+ if (!o.has(t) && o.size !== 0) {
1857
+ console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(o.keys())[0]}.`);
1759
1858
  return;
1760
1859
  }
1761
- r.set(t, n);
1860
+ o.set(t, n);
1762
1861
  },
1763
1862
  get(e, t) {
1764
- return $.has(e) && $.get(e).get(t) || null;
1863
+ return q.has(e) && q.get(e).get(t) || null;
1765
1864
  },
1766
1865
  remove(e, t) {
1767
- if (!$.has(e))
1866
+ if (!q.has(e))
1768
1867
  return;
1769
- const n = $.get(e);
1770
- n.delete(t), n.size === 0 && $.delete(e);
1868
+ const n = q.get(e);
1869
+ n.delete(t), n.size === 0 && q.delete(e);
1771
1870
  }
1772
- }, Cr = 1e3, Te = "transitionend", cn = (e) => (e && window.CSS && window.CSS.escape && (e = e.replace(/#([^\s"#']+)/g, (t, n) => `#${CSS.escape(n)}`)), e), _r = (e) => e == null ? `${e}` : Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(), xr = (e) => {
1871
+ }, wr = 1e3, Fe = "transitionend", fn = (e) => (e && window.CSS && window.CSS.escape && (e = e.replace(/#([^\s"#']+)/g, (t, n) => `#${CSS.escape(n)}`)), e), Ar = (e) => e == null ? `${e}` : Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(), Pr = (e) => {
1773
1872
  if (!e)
1774
1873
  return 0;
1775
1874
  let { transitionDuration: t, transitionDelay: n } = window.getComputedStyle(e);
1776
- const r = Number.parseFloat(t), s = Number.parseFloat(n);
1777
- return !r && !s ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) * Cr);
1778
- }, wr = (e) => {
1779
- e.dispatchEvent(new Event(Te));
1780
- }, G = (e) => !e || typeof e != "object" ? !1 : (typeof e.jquery < "u" && (e = e[0]), typeof e.nodeType < "u"), Ie = (e) => G(e) ? e.jquery ? e[0] : e : typeof e == "string" && e.length > 0 ? document.querySelector(cn(e)) : null, ln = (e) => {
1781
- if (!G(e) || e.getClientRects().length === 0)
1875
+ const o = Number.parseFloat(t), s = Number.parseFloat(n);
1876
+ return !o && !s ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) * wr);
1877
+ }, Lr = (e) => {
1878
+ e.dispatchEvent(new Event(Fe));
1879
+ }, W = (e) => !e || typeof e != "object" ? !1 : (typeof e.jquery < "u" && (e = e[0]), typeof e.nodeType < "u"), je = (e) => W(e) ? e.jquery ? e[0] : e : typeof e == "string" && e.length > 0 ? document.querySelector(fn(e)) : null, mn = (e) => {
1880
+ if (!W(e) || e.getClientRects().length === 0)
1782
1881
  return !1;
1783
1882
  const t = getComputedStyle(e).getPropertyValue("visibility") === "visible", n = e.closest("details:not([open])");
1784
1883
  if (!n)
1785
1884
  return t;
1786
1885
  if (n !== e) {
1787
- const r = e.closest("summary");
1788
- if (r && r.parentNode !== n || r === null)
1886
+ const o = e.closest("summary");
1887
+ if (o && o.parentNode !== n || o === null)
1789
1888
  return !1;
1790
1889
  }
1791
1890
  return t;
1792
- }, je = (e) => !e || e.nodeType !== Node.ELEMENT_NODE || e.classList.contains("disabled") ? !0 : typeof e.disabled < "u" ? e.disabled : e.hasAttribute("disabled") && e.getAttribute("disabled") !== "false", nt = () => {
1793
- }, dn = () => window.jQuery && !document.body.hasAttribute("data-bs-no-jquery") ? window.jQuery : null, Ne = [], Nr = (e) => {
1794
- document.readyState === "loading" ? (Ne.length || document.addEventListener("DOMContentLoaded", () => {
1795
- for (const t of Ne)
1891
+ }, Me = (e) => !e || e.nodeType !== Node.ELEMENT_NODE || e.classList.contains("disabled") ? !0 : typeof e.disabled < "u" ? e.disabled : e.hasAttribute("disabled") && e.getAttribute("disabled") !== "false", it = () => {
1892
+ }, hn = () => window.jQuery && !document.body.hasAttribute("data-bs-no-jquery") ? window.jQuery : null, Pe = [], Or = (e) => {
1893
+ document.readyState === "loading" ? (Pe.length || document.addEventListener("DOMContentLoaded", () => {
1894
+ for (const t of Pe)
1796
1895
  t();
1797
- }), Ne.push(e)) : e();
1798
- }, re = () => document.documentElement.dir === "rtl", Ar = (e) => {
1799
- Nr(() => {
1800
- const t = dn();
1896
+ }), Pe.push(e)) : e();
1897
+ }, se = () => document.documentElement.dir === "rtl", Sr = (e) => {
1898
+ Or(() => {
1899
+ const t = hn();
1801
1900
  if (t) {
1802
- const n = e.NAME, r = t.fn[n];
1803
- t.fn[n] = e.jQueryInterface, t.fn[n].Constructor = e, t.fn[n].noConflict = () => (t.fn[n] = r, e.jQueryInterface);
1901
+ const n = e.NAME, o = t.fn[n];
1902
+ t.fn[n] = e.jQueryInterface, t.fn[n].Constructor = e, t.fn[n].noConflict = () => (t.fn[n] = o, e.jQueryInterface);
1804
1903
  }
1805
1904
  });
1806
- }, Fe = (e, t = [], n = e) => typeof e == "function" ? e.call(...t) : n, Pr = (e, t, n = !0) => {
1905
+ }, Ue = (e, t = [], n = e) => typeof e == "function" ? e.call(...t) : n, kr = (e, t, n = !0) => {
1807
1906
  if (!n) {
1808
- Fe(e);
1907
+ Ue(e);
1809
1908
  return;
1810
1909
  }
1811
- const s = xr(t) + 5;
1910
+ const s = Pr(t) + 5;
1812
1911
  let i = !1;
1813
- const a = ({ target: l }) => {
1814
- l === t && (i = !0, t.removeEventListener(Te, a), Fe(e));
1912
+ const a = ({ target: c }) => {
1913
+ c === t && (i = !0, t.removeEventListener(Fe, a), Ue(e));
1815
1914
  };
1816
- t.addEventListener(Te, a), setTimeout(() => {
1817
- i || wr(t);
1915
+ t.addEventListener(Fe, a), setTimeout(() => {
1916
+ i || Lr(t);
1818
1917
  }, s);
1819
- }, Lr = (e, t, n, r) => {
1918
+ }, Dr = (e, t, n, o) => {
1820
1919
  const s = e.length;
1821
1920
  let i = e.indexOf(t);
1822
- return i === -1 ? !n && r ? e[s - 1] : e[0] : (i += n ? 1 : -1, r && (i = (i + s) % s), e[Math.max(0, Math.min(i, s - 1))]);
1823
- }, Or = /[^.]*(?=\..*)\.|.*/, Sr = /\..*/, Rr = /::\d+$/, Ae = {};
1824
- let rt = 1;
1825
- const un = {
1921
+ return i === -1 ? !n && o ? e[s - 1] : e[0] : (i += n ? 1 : -1, o && (i = (i + s) % s), e[Math.max(0, Math.min(i, s - 1))]);
1922
+ }, Rr = /[^.]*(?=\..*)\.|.*/, Tr = /\..*/, Ir = /::\d+$/, Le = {};
1923
+ let at = 1;
1924
+ const pn = {
1826
1925
  mouseenter: "mouseover",
1827
1926
  mouseleave: "mouseout"
1828
- }, kr = /* @__PURE__ */ new Set([
1927
+ }, Fr = /* @__PURE__ */ new Set([
1829
1928
  "click",
1830
1929
  "dblclick",
1831
1930
  "mouseup",
@@ -1873,113 +1972,113 @@ const un = {
1873
1972
  "abort",
1874
1973
  "scroll"
1875
1974
  ]);
1876
- function mn(e, t) {
1877
- return t && `${t}::${rt++}` || e.uidEvent || rt++;
1975
+ function gn(e, t) {
1976
+ return t && `${t}::${at++}` || e.uidEvent || at++;
1878
1977
  }
1879
- function fn(e) {
1880
- const t = mn(e);
1881
- return e.uidEvent = t, Ae[t] = Ae[t] || {}, Ae[t];
1978
+ function bn(e) {
1979
+ const t = gn(e);
1980
+ return e.uidEvent = t, Le[t] = Le[t] || {}, Le[t];
1882
1981
  }
1883
- function Dr(e, t) {
1884
- return function n(r) {
1885
- return Ge(r, { delegateTarget: e }), n.oneOff && D.off(e, r.type, t), t.apply(e, [r]);
1982
+ function jr(e, t) {
1983
+ return function n(o) {
1984
+ return Je(o, { delegateTarget: e }), n.oneOff && F.off(e, o.type, t), t.apply(e, [o]);
1886
1985
  };
1887
1986
  }
1888
- function Tr(e, t, n) {
1889
- return function r(s) {
1987
+ function Mr(e, t, n) {
1988
+ return function o(s) {
1890
1989
  const i = e.querySelectorAll(t);
1891
1990
  for (let { target: a } = s; a && a !== this; a = a.parentNode)
1892
- for (const l of i)
1893
- if (l === a)
1894
- return Ge(s, { delegateTarget: a }), r.oneOff && D.off(e, s.type, t, n), n.apply(a, [s]);
1991
+ for (const c of i)
1992
+ if (c === a)
1993
+ return Je(s, { delegateTarget: a }), o.oneOff && F.off(e, s.type, t, n), n.apply(a, [s]);
1895
1994
  };
1896
1995
  }
1897
- function pn(e, t, n = null) {
1898
- return Object.values(e).find((r) => r.callable === t && r.delegationSelector === n);
1996
+ function yn(e, t, n = null) {
1997
+ return Object.values(e).find((o) => o.callable === t && o.delegationSelector === n);
1899
1998
  }
1900
- function hn(e, t, n) {
1901
- const r = typeof t == "string", s = r ? n : t || n;
1902
- let i = gn(e);
1903
- return kr.has(i) || (i = e), [r, s, i];
1999
+ function vn(e, t, n) {
2000
+ const o = typeof t == "string", s = o ? n : t || n;
2001
+ let i = En(e);
2002
+ return Fr.has(i) || (i = e), [o, s, i];
1904
2003
  }
1905
- function ot(e, t, n, r, s) {
2004
+ function ct(e, t, n, o, s) {
1906
2005
  if (typeof t != "string" || !e)
1907
2006
  return;
1908
- let [i, a, l] = hn(t, n, r);
1909
- t in un && (a = ((C) => function(f) {
1910
- if (!f.relatedTarget || f.relatedTarget !== f.delegateTarget && !f.delegateTarget.contains(f.relatedTarget))
1911
- return C.call(this, f);
2007
+ let [i, a, c] = vn(t, n, o);
2008
+ t in pn && (a = ((_) => function(y) {
2009
+ if (!y.relatedTarget || y.relatedTarget !== y.delegateTarget && !y.delegateTarget.contains(y.relatedTarget))
2010
+ return _.call(this, y);
1912
2011
  })(a));
1913
- const c = fn(e), u = c[l] || (c[l] = {}), g = pn(u, a, i ? n : null);
1914
- if (g) {
1915
- g.oneOff = g.oneOff && s;
2012
+ const f = bn(e), u = f[c] || (f[c] = {}), p = yn(u, a, i ? n : null);
2013
+ if (p) {
2014
+ p.oneOff = p.oneOff && s;
1916
2015
  return;
1917
2016
  }
1918
- const h = mn(a, t.replace(Or, "")), y = i ? Tr(e, n, a) : Dr(e, a);
1919
- y.delegationSelector = i ? n : null, y.callable = a, y.oneOff = s, y.uidEvent = h, u[h] = y, e.addEventListener(l, y, i);
2017
+ const m = gn(a, t.replace(Rr, "")), b = i ? Mr(e, n, a) : jr(e, a);
2018
+ b.delegationSelector = i ? n : null, b.callable = a, b.oneOff = s, b.uidEvent = m, u[m] = b, e.addEventListener(c, b, i);
1920
2019
  }
1921
- function Me(e, t, n, r, s) {
1922
- const i = pn(t[n], r, s);
2020
+ function Ve(e, t, n, o, s) {
2021
+ const i = yn(t[n], o, s);
1923
2022
  i && (e.removeEventListener(n, i, !!s), delete t[n][i.uidEvent]);
1924
2023
  }
1925
- function Ir(e, t, n, r) {
2024
+ function Ur(e, t, n, o) {
1926
2025
  const s = t[n] || {};
1927
2026
  for (const [i, a] of Object.entries(s))
1928
- i.includes(r) && Me(e, t, n, a.callable, a.delegationSelector);
2027
+ i.includes(o) && Ve(e, t, n, a.callable, a.delegationSelector);
1929
2028
  }
1930
- function gn(e) {
1931
- return e = e.replace(Sr, ""), un[e] || e;
2029
+ function En(e) {
2030
+ return e = e.replace(Tr, ""), pn[e] || e;
1932
2031
  }
1933
- const D = {
1934
- on(e, t, n, r) {
1935
- ot(e, t, n, r, !1);
2032
+ const F = {
2033
+ on(e, t, n, o) {
2034
+ ct(e, t, n, o, !1);
1936
2035
  },
1937
- one(e, t, n, r) {
1938
- ot(e, t, n, r, !0);
2036
+ one(e, t, n, o) {
2037
+ ct(e, t, n, o, !0);
1939
2038
  },
1940
- off(e, t, n, r) {
2039
+ off(e, t, n, o) {
1941
2040
  if (typeof t != "string" || !e)
1942
2041
  return;
1943
- const [s, i, a] = hn(t, n, r), l = a !== t, c = fn(e), u = c[a] || {}, g = t.startsWith(".");
2042
+ const [s, i, a] = vn(t, n, o), c = a !== t, f = bn(e), u = f[a] || {}, p = t.startsWith(".");
1944
2043
  if (typeof i < "u") {
1945
2044
  if (!Object.keys(u).length)
1946
2045
  return;
1947
- Me(e, c, a, i, s ? n : null);
2046
+ Ve(e, f, a, i, s ? n : null);
1948
2047
  return;
1949
2048
  }
1950
- if (g)
1951
- for (const h of Object.keys(c))
1952
- Ir(e, c, h, t.slice(1));
1953
- for (const [h, y] of Object.entries(u)) {
1954
- const E = h.replace(Rr, "");
1955
- (!l || t.includes(E)) && Me(e, c, a, y.callable, y.delegationSelector);
2049
+ if (p)
2050
+ for (const m of Object.keys(f))
2051
+ Ur(e, f, m, t.slice(1));
2052
+ for (const [m, b] of Object.entries(u)) {
2053
+ const E = m.replace(Ir, "");
2054
+ (!c || t.includes(E)) && Ve(e, f, a, b.callable, b.delegationSelector);
1956
2055
  }
1957
2056
  },
1958
2057
  trigger(e, t, n) {
1959
2058
  if (typeof t != "string" || !e)
1960
2059
  return null;
1961
- const r = dn(), s = gn(t), i = t !== s;
1962
- let a = null, l = !0, c = !0, u = !1;
1963
- i && r && (a = r.Event(t, n), r(e).trigger(a), l = !a.isPropagationStopped(), c = !a.isImmediatePropagationStopped(), u = a.isDefaultPrevented());
1964
- const g = Ge(new Event(t, { bubbles: l, cancelable: !0 }), n);
1965
- return u && g.preventDefault(), c && e.dispatchEvent(g), g.defaultPrevented && a && a.preventDefault(), g;
2060
+ const o = hn(), s = En(t), i = t !== s;
2061
+ let a = null, c = !0, f = !0, u = !1;
2062
+ i && o && (a = o.Event(t, n), o(e).trigger(a), c = !a.isPropagationStopped(), f = !a.isImmediatePropagationStopped(), u = a.isDefaultPrevented());
2063
+ const p = Je(new Event(t, { bubbles: c, cancelable: !0 }), n);
2064
+ return u && p.preventDefault(), f && e.dispatchEvent(p), p.defaultPrevented && a && a.preventDefault(), p;
1966
2065
  }
1967
2066
  };
1968
- function Ge(e, t = {}) {
1969
- for (const [n, r] of Object.entries(t))
2067
+ function Je(e, t = {}) {
2068
+ for (const [n, o] of Object.entries(t))
1970
2069
  try {
1971
- e[n] = r;
2070
+ e[n] = o;
1972
2071
  } catch {
1973
2072
  Object.defineProperty(e, n, {
1974
2073
  configurable: !0,
1975
2074
  get() {
1976
- return r;
2075
+ return o;
1977
2076
  }
1978
2077
  });
1979
2078
  }
1980
2079
  return e;
1981
2080
  }
1982
- function st(e) {
2081
+ function lt(e) {
1983
2082
  if (e === "true")
1984
2083
  return !0;
1985
2084
  if (e === "false")
@@ -1996,31 +2095,31 @@ function st(e) {
1996
2095
  return e;
1997
2096
  }
1998
2097
  }
1999
- function Pe(e) {
2098
+ function Oe(e) {
2000
2099
  return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
2001
2100
  }
2002
- const be = {
2101
+ const Ee = {
2003
2102
  setDataAttribute(e, t, n) {
2004
- e.setAttribute(`data-bs-${Pe(t)}`, n);
2103
+ e.setAttribute(`data-bs-${Oe(t)}`, n);
2005
2104
  },
2006
2105
  removeDataAttribute(e, t) {
2007
- e.removeAttribute(`data-bs-${Pe(t)}`);
2106
+ e.removeAttribute(`data-bs-${Oe(t)}`);
2008
2107
  },
2009
2108
  getDataAttributes(e) {
2010
2109
  if (!e)
2011
2110
  return {};
2012
- const t = {}, n = Object.keys(e.dataset).filter((r) => r.startsWith("bs") && !r.startsWith("bsConfig"));
2013
- for (const r of n) {
2014
- let s = r.replace(/^bs/, "");
2015
- s = s.charAt(0).toLowerCase() + s.slice(1), t[s] = st(e.dataset[r]);
2111
+ const t = {}, n = Object.keys(e.dataset).filter((o) => o.startsWith("bs") && !o.startsWith("bsConfig"));
2112
+ for (const o of n) {
2113
+ let s = o.replace(/^bs/, "");
2114
+ s = s.charAt(0).toLowerCase() + s.slice(1), t[s] = lt(e.dataset[o]);
2016
2115
  }
2017
2116
  return t;
2018
2117
  },
2019
2118
  getDataAttribute(e, t) {
2020
- return st(e.getAttribute(`data-bs-${Pe(t)}`));
2119
+ return lt(e.getAttribute(`data-bs-${Oe(t)}`));
2021
2120
  }
2022
2121
  };
2023
- class jr {
2122
+ class Vr {
2024
2123
  // Getters
2025
2124
  static get Default() {
2026
2125
  return {};
@@ -2038,51 +2137,51 @@ class jr {
2038
2137
  return t;
2039
2138
  }
2040
2139
  _mergeConfigObj(t, n) {
2041
- const r = G(n) ? be.getDataAttribute(n, "config") : {};
2140
+ const o = W(n) ? Ee.getDataAttribute(n, "config") : {};
2042
2141
  return {
2043
2142
  ...this.constructor.Default,
2044
- ...typeof r == "object" ? r : {},
2045
- ...G(n) ? be.getDataAttributes(n) : {},
2143
+ ...typeof o == "object" ? o : {},
2144
+ ...W(n) ? Ee.getDataAttributes(n) : {},
2046
2145
  ...typeof t == "object" ? t : {}
2047
2146
  };
2048
2147
  }
2049
2148
  _typeCheckConfig(t, n = this.constructor.DefaultType) {
2050
- for (const [r, s] of Object.entries(n)) {
2051
- const i = t[r], a = G(i) ? "element" : _r(i);
2149
+ for (const [o, s] of Object.entries(n)) {
2150
+ const i = t[o], a = W(i) ? "element" : Ar(i);
2052
2151
  if (!new RegExp(s).test(a))
2053
2152
  throw new TypeError(
2054
- `${this.constructor.NAME.toUpperCase()}: Option "${r}" provided type "${a}" but expected type "${s}".`
2153
+ `${this.constructor.NAME.toUpperCase()}: Option "${o}" provided type "${a}" but expected type "${s}".`
2055
2154
  );
2056
2155
  }
2057
2156
  }
2058
2157
  }
2059
- const Fr = "5.3.8";
2060
- class Mr extends jr {
2158
+ const Br = "5.3.8";
2159
+ class $r extends Vr {
2061
2160
  constructor(t, n) {
2062
- super(), t = Ie(t), t && (this._element = t, this._config = this._getConfig(n), we.set(this._element, this.constructor.DATA_KEY, this));
2161
+ super(), t = je(t), t && (this._element = t, this._config = this._getConfig(n), Ae.set(this._element, this.constructor.DATA_KEY, this));
2063
2162
  }
2064
2163
  // Public
2065
2164
  dispose() {
2066
- we.remove(this._element, this.constructor.DATA_KEY), D.off(this._element, this.constructor.EVENT_KEY);
2165
+ Ae.remove(this._element, this.constructor.DATA_KEY), F.off(this._element, this.constructor.EVENT_KEY);
2067
2166
  for (const t of Object.getOwnPropertyNames(this))
2068
2167
  this[t] = null;
2069
2168
  }
2070
2169
  // Private
2071
- _queueCallback(t, n, r = !0) {
2072
- Pr(t, n, r);
2170
+ _queueCallback(t, n, o = !0) {
2171
+ kr(t, n, o);
2073
2172
  }
2074
2173
  _getConfig(t) {
2075
2174
  return t = this._mergeConfigObj(t, this._element), t = this._configAfterMerge(t), this._typeCheckConfig(t), t;
2076
2175
  }
2077
2176
  // Static
2078
2177
  static getInstance(t) {
2079
- return we.get(Ie(t), this.DATA_KEY);
2178
+ return Ae.get(je(t), this.DATA_KEY);
2080
2179
  }
2081
2180
  static getOrCreateInstance(t, n = {}) {
2082
2181
  return this.getInstance(t) || new this(t, typeof n == "object" ? n : null);
2083
2182
  }
2084
2183
  static get VERSION() {
2085
- return Fr;
2184
+ return Br;
2086
2185
  }
2087
2186
  static get DATA_KEY() {
2088
2187
  return `bs.${this.NAME}`;
@@ -2094,7 +2193,7 @@ class Mr extends jr {
2094
2193
  return `${t}${this.EVENT_KEY}`;
2095
2194
  }
2096
2195
  }
2097
- const Le = (e) => {
2196
+ const Se = (e) => {
2098
2197
  let t = e.getAttribute("data-bs-target");
2099
2198
  if (!t || t === "#") {
2100
2199
  let n = e.getAttribute("href");
@@ -2102,8 +2201,8 @@ const Le = (e) => {
2102
2201
  return null;
2103
2202
  n.includes("#") && !n.startsWith("#") && (n = `#${n.split("#")[1]}`), t = n && n !== "#" ? n.trim() : null;
2104
2203
  }
2105
- return t ? t.split(",").map((n) => cn(n)).join(",") : null;
2106
- }, M = {
2204
+ return t ? t.split(",").map((n) => fn(n)).join(",") : null;
2205
+ }, V = {
2107
2206
  find(e, t = document.documentElement) {
2108
2207
  return [].concat(...Element.prototype.querySelectorAll.call(t, e));
2109
2208
  },
@@ -2115,9 +2214,9 @@ const Le = (e) => {
2115
2214
  },
2116
2215
  parents(e, t) {
2117
2216
  const n = [];
2118
- let r = e.parentNode.closest(t);
2119
- for (; r; )
2120
- n.push(r), r = r.parentNode.closest(t);
2217
+ let o = e.parentNode.closest(t);
2218
+ for (; o; )
2219
+ n.push(o), o = o.parentNode.closest(t);
2121
2220
  return n;
2122
2221
  },
2123
2222
  prev(e, t) {
@@ -2150,28 +2249,28 @@ const Le = (e) => {
2150
2249
  "[tabindex]",
2151
2250
  '[contenteditable="true"]'
2152
2251
  ].map((n) => `${n}:not([tabindex^="-"])`).join(",");
2153
- return this.find(t, e).filter((n) => !je(n) && ln(n));
2252
+ return this.find(t, e).filter((n) => !Me(n) && mn(n));
2154
2253
  },
2155
2254
  getSelectorFromElement(e) {
2156
- const t = Le(e);
2157
- return t && M.findOne(t) ? t : null;
2255
+ const t = Se(e);
2256
+ return t && V.findOne(t) ? t : null;
2158
2257
  },
2159
2258
  getElementFromSelector(e) {
2160
- const t = Le(e);
2161
- return t ? M.findOne(t) : null;
2259
+ const t = Se(e);
2260
+ return t ? V.findOne(t) : null;
2162
2261
  },
2163
2262
  getMultipleElementsFromSelector(e) {
2164
- const t = Le(e);
2165
- return t ? M.find(t) : [];
2263
+ const t = Se(e);
2264
+ return t ? V.find(t) : [];
2166
2265
  }
2167
- }, it = "dropdown", Ur = "bs.dropdown", W = `.${Ur}`, Ye = ".data-api", Vr = "Escape", at = "Tab", Br = "ArrowUp", ct = "ArrowDown", $r = 2, qr = `hide${W}`, Hr = `hidden${W}`, Kr = `show${W}`, Gr = `shown${W}`, bn = `click${W}${Ye}`, vn = `keydown${W}${Ye}`, Yr = `keyup${W}${Ye}`, J = "show", Wr = "dropup", zr = "dropend", Jr = "dropstart", Qr = "dropup-center", Zr = "dropdown-center", K = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)', Xr = `${K}.${J}`, pe = ".dropdown-menu", eo = ".navbar", to = ".navbar-nav", no = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", ro = re() ? "top-end" : "top-start", oo = re() ? "top-start" : "top-end", so = re() ? "bottom-end" : "bottom-start", io = re() ? "bottom-start" : "bottom-end", ao = re() ? "left-start" : "right-start", co = re() ? "right-start" : "left-start", lo = "top", uo = "bottom", mo = {
2266
+ }, dt = "dropdown", qr = "bs.dropdown", J = `.${qr}`, Qe = ".data-api", Hr = "Escape", ut = "Tab", Kr = "ArrowUp", ft = "ArrowDown", Gr = 2, Yr = `hide${J}`, Wr = `hidden${J}`, zr = `show${J}`, Jr = `shown${J}`, Cn = `click${J}${Qe}`, _n = `keydown${J}${Qe}`, Qr = `keyup${J}${Qe}`, X = "show", Zr = "dropup", Xr = "dropend", eo = "dropstart", to = "dropup-center", no = "dropdown-center", Y = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)', ro = `${Y}.${X}`, be = ".dropdown-menu", oo = ".navbar", so = ".navbar-nav", io = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", ao = se() ? "top-end" : "top-start", co = se() ? "top-start" : "top-end", lo = se() ? "bottom-end" : "bottom-start", uo = se() ? "bottom-start" : "bottom-end", fo = se() ? "left-start" : "right-start", mo = se() ? "right-start" : "left-start", ho = "top", po = "bottom", go = {
2168
2267
  autoClose: !0,
2169
2268
  boundary: "clippingParents",
2170
2269
  display: "dynamic",
2171
2270
  offset: [0, 2],
2172
2271
  popperConfig: null,
2173
2272
  reference: "toggle"
2174
- }, fo = {
2273
+ }, bo = {
2175
2274
  autoClose: "(boolean|string)",
2176
2275
  boundary: "(string|element)",
2177
2276
  display: "string",
@@ -2179,39 +2278,39 @@ const Le = (e) => {
2179
2278
  popperConfig: "(null|object|function)",
2180
2279
  reference: "(string|element|object)"
2181
2280
  };
2182
- let z = class he extends Mr {
2281
+ let Q = class ye extends $r {
2183
2282
  constructor(t, n) {
2184
- super(t, n), this._popper = null, this._parent = this._element.parentNode, this._menu = M.next(this._element, pe)[0] || M.prev(this._element, pe)[0] || M.findOne(pe, this._parent), this._inNavbar = this._detectNavbar();
2283
+ super(t, n), this._popper = null, this._parent = this._element.parentNode, this._menu = V.next(this._element, be)[0] || V.prev(this._element, be)[0] || V.findOne(be, this._parent), this._inNavbar = this._detectNavbar();
2185
2284
  }
2186
2285
  // Getters
2187
2286
  static get Default() {
2188
- return mo;
2287
+ return go;
2189
2288
  }
2190
2289
  static get DefaultType() {
2191
- return fo;
2290
+ return bo;
2192
2291
  }
2193
2292
  static get NAME() {
2194
- return it;
2293
+ return dt;
2195
2294
  }
2196
2295
  // Public
2197
2296
  toggle() {
2198
2297
  return this._isShown() ? this.hide() : this.show();
2199
2298
  }
2200
2299
  show() {
2201
- if (je(this._element) || this._isShown())
2300
+ if (Me(this._element) || this._isShown())
2202
2301
  return;
2203
2302
  const t = {
2204
2303
  relatedTarget: this._element
2205
2304
  };
2206
- if (!D.trigger(this._element, Kr, t).defaultPrevented) {
2207
- if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(to))
2208
- for (const r of [].concat(...document.body.children))
2209
- D.on(r, "mouseover", nt);
2210
- this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(J), this._element.classList.add(J), D.trigger(this._element, Gr, t);
2305
+ if (!F.trigger(this._element, zr, t).defaultPrevented) {
2306
+ if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(so))
2307
+ for (const o of [].concat(...document.body.children))
2308
+ F.on(o, "mouseover", it);
2309
+ this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(X), this._element.classList.add(X), F.trigger(this._element, Jr, t);
2211
2310
  }
2212
2311
  }
2213
2312
  hide() {
2214
- if (je(this._element) || !this._isShown())
2313
+ if (Me(this._element) || !this._isShown())
2215
2314
  return;
2216
2315
  const t = {
2217
2316
  relatedTarget: this._element
@@ -2226,44 +2325,44 @@ let z = class he extends Mr {
2226
2325
  }
2227
2326
  // Private
2228
2327
  _completeHide(t) {
2229
- if (!D.trigger(this._element, qr, t).defaultPrevented) {
2328
+ if (!F.trigger(this._element, Yr, t).defaultPrevented) {
2230
2329
  if ("ontouchstart" in document.documentElement)
2231
- for (const r of [].concat(...document.body.children))
2232
- D.off(r, "mouseover", nt);
2233
- this._popper && this._popper.destroy(), this._menu.classList.remove(J), this._element.classList.remove(J), this._element.setAttribute("aria-expanded", "false"), be.removeDataAttribute(this._menu, "popper"), D.trigger(this._element, Hr, t);
2330
+ for (const o of [].concat(...document.body.children))
2331
+ F.off(o, "mouseover", it);
2332
+ this._popper && this._popper.destroy(), this._menu.classList.remove(X), this._element.classList.remove(X), this._element.setAttribute("aria-expanded", "false"), Ee.removeDataAttribute(this._menu, "popper"), F.trigger(this._element, Wr, t);
2234
2333
  }
2235
2334
  }
2236
2335
  _getConfig(t) {
2237
- if (t = super._getConfig(t), typeof t.reference == "object" && !G(t.reference) && typeof t.reference.getBoundingClientRect != "function")
2238
- throw new TypeError(`${it.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2336
+ if (t = super._getConfig(t), typeof t.reference == "object" && !W(t.reference) && typeof t.reference.getBoundingClientRect != "function")
2337
+ throw new TypeError(`${dt.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2239
2338
  return t;
2240
2339
  }
2241
2340
  _createPopper() {
2242
- if (typeof Qe > "u")
2341
+ if (typeof nt > "u")
2243
2342
  throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org/docs/v2/)");
2244
2343
  let t = this._element;
2245
- this._config.reference === "parent" ? t = this._parent : G(this._config.reference) ? t = Ie(this._config.reference) : typeof this._config.reference == "object" && (t = this._config.reference);
2344
+ this._config.reference === "parent" ? t = this._parent : W(this._config.reference) ? t = je(this._config.reference) : typeof this._config.reference == "object" && (t = this._config.reference);
2246
2345
  const n = this._getPopperConfig();
2247
- this._popper = Qe.createPopper(t, this._menu, n);
2346
+ this._popper = nt.createPopper(t, this._menu, n);
2248
2347
  }
2249
2348
  _isShown() {
2250
- return this._menu.classList.contains(J);
2349
+ return this._menu.classList.contains(X);
2251
2350
  }
2252
2351
  _getPlacement() {
2253
2352
  const t = this._parent;
2254
- if (t.classList.contains(zr))
2255
- return ao;
2256
- if (t.classList.contains(Jr))
2257
- return co;
2258
- if (t.classList.contains(Qr))
2259
- return lo;
2260
- if (t.classList.contains(Zr))
2261
- return uo;
2353
+ if (t.classList.contains(Xr))
2354
+ return fo;
2355
+ if (t.classList.contains(eo))
2356
+ return mo;
2357
+ if (t.classList.contains(to))
2358
+ return ho;
2359
+ if (t.classList.contains(no))
2360
+ return po;
2262
2361
  const n = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
2263
- return t.classList.contains(Wr) ? n ? oo : ro : n ? io : so;
2362
+ return t.classList.contains(Zr) ? n ? co : ao : n ? uo : lo;
2264
2363
  }
2265
2364
  _detectNavbar() {
2266
- return this._element.closest(eo) !== null;
2365
+ return this._element.closest(oo) !== null;
2267
2366
  }
2268
2367
  _getOffset() {
2269
2368
  const { offset: t } = this._config;
@@ -2287,22 +2386,22 @@ let z = class he extends Mr {
2287
2386
  }
2288
2387
  ]
2289
2388
  };
2290
- return (this._inNavbar || this._config.display === "static") && (be.setDataAttribute(this._menu, "popper", "static"), t.modifiers = [{
2389
+ return (this._inNavbar || this._config.display === "static") && (Ee.setDataAttribute(this._menu, "popper", "static"), t.modifiers = [{
2291
2390
  name: "applyStyles",
2292
2391
  enabled: !1
2293
2392
  }]), {
2294
2393
  ...t,
2295
- ...Fe(this._config.popperConfig, [void 0, t])
2394
+ ...Ue(this._config.popperConfig, [void 0, t])
2296
2395
  };
2297
2396
  }
2298
2397
  _selectMenuItem({ key: t, target: n }) {
2299
- const r = M.find(no, this._menu).filter((s) => ln(s));
2300
- r.length && Lr(r, n, t === ct, !r.includes(n)).focus();
2398
+ const o = V.find(io, this._menu).filter((s) => mn(s));
2399
+ o.length && Dr(o, n, t === ft, !o.includes(n)).focus();
2301
2400
  }
2302
2401
  // Static
2303
2402
  static jQueryInterface(t) {
2304
2403
  return this.each(function() {
2305
- const n = he.getOrCreateInstance(this, t);
2404
+ const n = ye.getOrCreateInstance(this, t);
2306
2405
  if (typeof t == "string") {
2307
2406
  if (typeof n[t] > "u")
2308
2407
  throw new TypeError(`No method named "${t}"`);
@@ -2311,26 +2410,26 @@ let z = class he extends Mr {
2311
2410
  });
2312
2411
  }
2313
2412
  static clearMenus(t) {
2314
- if (t.button === $r || t.type === "keyup" && t.key !== at)
2413
+ if (t.button === Gr || t.type === "keyup" && t.key !== ut)
2315
2414
  return;
2316
- const n = M.find(Xr);
2317
- for (const r of n) {
2318
- const s = he.getInstance(r);
2415
+ const n = V.find(ro);
2416
+ for (const o of n) {
2417
+ const s = ye.getInstance(o);
2319
2418
  if (!s || s._config.autoClose === !1)
2320
2419
  continue;
2321
2420
  const i = t.composedPath(), a = i.includes(s._menu);
2322
- if (i.includes(s._element) || s._config.autoClose === "inside" && !a || s._config.autoClose === "outside" && a || s._menu.contains(t.target) && (t.type === "keyup" && t.key === at || /input|select|option|textarea|form/i.test(t.target.tagName)))
2421
+ if (i.includes(s._element) || s._config.autoClose === "inside" && !a || s._config.autoClose === "outside" && a || s._menu.contains(t.target) && (t.type === "keyup" && t.key === ut || /input|select|option|textarea|form/i.test(t.target.tagName)))
2323
2422
  continue;
2324
- const l = { relatedTarget: s._element };
2325
- t.type === "click" && (l.clickEvent = t), s._completeHide(l);
2423
+ const c = { relatedTarget: s._element };
2424
+ t.type === "click" && (c.clickEvent = t), s._completeHide(c);
2326
2425
  }
2327
2426
  }
2328
2427
  static dataApiKeydownHandler(t) {
2329
- const n = /input|textarea/i.test(t.target.tagName), r = t.key === Vr, s = [Br, ct].includes(t.key);
2330
- if (!s && !r || n && !r)
2428
+ const n = /input|textarea/i.test(t.target.tagName), o = t.key === Hr, s = [Kr, ft].includes(t.key);
2429
+ if (!s && !o || n && !o)
2331
2430
  return;
2332
2431
  t.preventDefault();
2333
- const i = this.matches(K) ? this : M.prev(this, K)[0] || M.next(this, K)[0] || M.findOne(K, t.delegateTarget.parentNode), a = he.getOrCreateInstance(i);
2432
+ const i = this.matches(Y) ? this : V.prev(this, Y)[0] || V.next(this, Y)[0] || V.findOne(Y, t.delegateTarget.parentNode), a = ye.getOrCreateInstance(i);
2334
2433
  if (s) {
2335
2434
  t.stopPropagation(), a.show(), a._selectMenuItem(t);
2336
2435
  return;
@@ -2338,52 +2437,54 @@ let z = class he extends Mr {
2338
2437
  a._isShown() && (t.stopPropagation(), a.hide(), i.focus());
2339
2438
  }
2340
2439
  };
2341
- D.on(document, vn, K, z.dataApiKeydownHandler);
2342
- D.on(document, vn, pe, z.dataApiKeydownHandler);
2343
- D.on(document, bn, z.clearMenus);
2344
- D.on(document, Yr, z.clearMenus);
2345
- D.on(document, bn, K, function(e) {
2346
- e.preventDefault(), z.getOrCreateInstance(this).toggle();
2440
+ F.on(document, _n, Y, Q.dataApiKeydownHandler);
2441
+ F.on(document, _n, be, Q.dataApiKeydownHandler);
2442
+ F.on(document, Cn, Q.clearMenus);
2443
+ F.on(document, Qr, Q.clearMenus);
2444
+ F.on(document, Cn, Y, function(e) {
2445
+ e.preventDefault(), Q.getOrCreateInstance(this).toggle();
2347
2446
  });
2348
- Ar(z);
2349
- const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P, { children: e }), ae = ({ children: e, ...t }) => /* @__PURE__ */ o("div", { className: "dropdown-menu", children: e }), We = ({ className: e, children: t, icon: n }) => {
2350
- const r = O(null);
2447
+ Sr(Q);
2448
+ const Ce = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ r(A, { children: e }), le = ({ children: e, ...t }) => /* @__PURE__ */ r("div", { className: "dropdown-menu", children: e }), Ze = ({ className: e, children: t, autoClose: n, icon: o }) => {
2449
+ const s = O(null);
2351
2450
  N(() => {
2352
- const u = new z(r.current);
2451
+ const p = new Q(s.current, {
2452
+ autoClose: n ?? !0
2453
+ });
2353
2454
  return () => {
2354
- u.dispose();
2455
+ p.dispose();
2355
2456
  };
2356
2457
  }, []);
2357
- const s = v.Children.toArray(t).find((u) => v.isValidElement(u) && u.type === ae), i = v.Children.toArray(t).filter((u) => v.isValidElement(u) && u.type === j), a = v.Children.toArray(t).find((u) => v.isValidElement(u) && u.type === ve), l = v.Children.toArray(t).filter((u) => !v.isValidElement(u) || u.type !== j && u.type !== ae && u.type !== ve), c = v.isValidElement(a) ? a.props : {};
2358
- return /* @__PURE__ */ _("div", { className: [...(e || "").split(" "), "dropdown"].filter((u, g, h) => h.indexOf(u) === g).join(" "), children: [
2359
- /* @__PURE__ */ o(ue, { ref: r, "data-bs-toggle": "dropdown", ...c, className: [...(c.className || "").split(" ")].filter((u, g, h) => h.indexOf(u) === g).join(" "), children: c.children ? c.children : l }),
2360
- s || /* @__PURE__ */ o(ae, { children: i })
2458
+ const i = v.Children.toArray(t).find((p) => v.isValidElement(p) && p.type === le), a = v.Children.toArray(t).filter((p) => v.isValidElement(p) && p.type === U), c = v.Children.toArray(t).find((p) => v.isValidElement(p) && p.type === Ce), f = v.Children.toArray(t).filter((p) => !v.isValidElement(p) || p.type !== U && p.type !== le && p.type !== Ce), u = v.isValidElement(c) ? c.props : {};
2459
+ return /* @__PURE__ */ C("div", { className: [...(e || "").split(" "), "dropdown"].filter((p, m, b) => b.indexOf(p) === m).join(" "), children: [
2460
+ /* @__PURE__ */ r(he, { ref: s, "data-bs-toggle": "dropdown", ...u, className: [...(u.className || "").split(" ")].filter((p, m, b) => b.indexOf(p) === m).join(" "), children: u.children ? u.children : f }),
2461
+ i || /* @__PURE__ */ r(le, { children: a })
2361
2462
  ] });
2362
- }, Ue = (e, t = !0) => (Object.entries(e).map(([n, r]) => (t && r instanceof Object && (r = Ue(r)), [n, r])).filter(([, n]) => n instanceof Object ? !Object.keys(n).length : ["", null, void 0].includes(n)).forEach(([n]) => {
2463
+ }, Be = (e, t = !0) => (Object.entries(e).map(([n, o]) => (t && o instanceof Object && (o = Be(o)), [n, o])).filter(([, n]) => n instanceof Object ? !Object.keys(n).length : ["", null, void 0].includes(n)).forEach(([n]) => {
2363
2464
  delete e[n];
2364
- }), e), po = ({ formView: e, onClick: t }) => {
2465
+ }), e), yo = ({ formView: e, onClick: t }) => {
2365
2466
  const n = (s) => {
2366
2467
  if (s.choices !== void 0) {
2367
- const i = s.choices?.reduce((a, l) => [...a, ...l.choices || [l]], []).reduce((a, l) => {
2368
- const c = l.value instanceof Function ? l.value(l) : l.value, u = l.label instanceof Function ? l.label(l) : l.label;
2369
- return { ...a, [c]: u };
2468
+ const i = s.choices?.reduce((a, c) => [...a, ...c.choices || [c]], []).reduce((a, c) => {
2469
+ const f = c.value instanceof Function ? c.value(c) : c.value, u = c.label instanceof Function ? c.label(c) : c.label;
2470
+ return { ...a, [f]: u };
2370
2471
  }, {});
2371
2472
  return s.choices ? Object.values(s.data instanceof Object ? s.data : [s.data]).map((a) => i[a] ?? a).join(", ") : s.data;
2372
2473
  } else if (s.checked !== void 0)
2373
2474
  return s.checked ? "Yes" : "No";
2374
2475
  return s.data;
2375
- }, r = Object.values(e.children || []).filter((s) => s.data !== null);
2376
- return !!r.length && /* @__PURE__ */ o("div", { className: "filters d-flex mb-sm overflow-auto", children: r.filter((s) => s.data !== null).map((s, i) => /* @__PURE__ */ _("div", { className: "filters-item d-flex text-nowrap flex-column me-2 mb-2", children: [
2377
- /* @__PURE__ */ o("small", { className: "mb-2", children: /* @__PURE__ */ o(U, { children: s.label }) }),
2378
- /* @__PURE__ */ _("div", { className: "btn btn-sm btn-primary me-1 mb-1", children: [
2379
- /* @__PURE__ */ o(U, { children: n(s) }),
2380
- t && /* @__PURE__ */ o("span", { onClick: () => t(s.name), className: "ms-2", children: "×" })
2476
+ }, o = Object.values(e.children || []).filter((s) => s.data !== null);
2477
+ return !!o.length && /* @__PURE__ */ r("div", { className: "filters d-flex mb-sm overflow-auto", children: o.filter((s) => s.data !== null).map((s, i) => /* @__PURE__ */ C("div", { className: "filters-item d-flex text-nowrap flex-column me-2 mb-2", children: [
2478
+ /* @__PURE__ */ r("small", { className: "mb-2", children: /* @__PURE__ */ r(k, { children: s.label }) }),
2479
+ /* @__PURE__ */ C("div", { className: "btn btn-sm btn-primary me-1 mb-1", children: [
2480
+ /* @__PURE__ */ r(k, { children: n(s) }),
2481
+ t && /* @__PURE__ */ r("span", { onClick: () => t(s.name), className: "ms-2", children: "×" })
2381
2482
  ] })
2382
2483
  ] }, i)) });
2383
- }, ho = () => {
2384
- const { actions: e, isSelectedAll: t, toggleAll: n, selected: r, executeAction: s, clear: i } = nn() || {};
2385
- return e && /* @__PURE__ */ _("div", { className: "btn-group btn-group-sm mb-2", children: [
2386
- /* @__PURE__ */ o("label", { className: "btn btn-light", children: /* @__PURE__ */ o(
2484
+ }, vo = () => {
2485
+ const { actions: e, isSelectedAll: t, toggleAll: n, selected: o, executeAction: s, clear: i } = an() || {};
2486
+ return e && /* @__PURE__ */ C("div", { className: "btn-group btn-group-sm mb-2", children: [
2487
+ /* @__PURE__ */ r("label", { className: "btn btn-light", children: /* @__PURE__ */ r(
2387
2488
  "input",
2388
2489
  {
2389
2490
  checked: t,
@@ -2391,10 +2492,10 @@ const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P,
2391
2492
  type: "checkbox"
2392
2493
  }
2393
2494
  ) }),
2394
- !!r?.length && /* @__PURE__ */ _(We, { className: "btn btn-sm btn-light", children: [
2395
- /* @__PURE__ */ o(ve, { disabled: !r?.length, className: "bg-transparent border-0", children: !!r?.length && /* @__PURE__ */ o(U, { properties: { number: r?.length }, children: ":number selected" }) }),
2396
- /* @__PURE__ */ o(ae, { children: Object.keys(e).map((a) => /* @__PURE__ */ o(
2397
- j,
2495
+ !!o?.length && /* @__PURE__ */ C(Ze, { className: "btn btn-sm btn-light", children: [
2496
+ /* @__PURE__ */ r(Ce, { disabled: !o?.length, className: "bg-transparent border-0", children: !!o?.length && /* @__PURE__ */ r(k, { properties: { number: o?.length }, children: ":number selected" }) }),
2497
+ /* @__PURE__ */ r(le, { children: Object.keys(e).map((a) => /* @__PURE__ */ r(
2498
+ U,
2398
2499
  {
2399
2500
  to: "#",
2400
2501
  onClick: () => s?.(a),
@@ -2404,55 +2505,55 @@ const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P,
2404
2505
  a
2405
2506
  )) })
2406
2507
  ] }),
2407
- !!r?.length && /* @__PURE__ */ o("button", { title: "Clear selection", onClick: i, className: "btn btn-light", children: "×" })
2508
+ !!o?.length && /* @__PURE__ */ r("button", { title: "Clear selection", onClick: i, className: "btn btn-light", children: "×" })
2408
2509
  ] });
2409
- }, go = Tt(_e(({ embedded: e = !1, title: t, className: n, onAction: r }) => {
2410
- const { action: s, setAction: i } = ee(), { generateActionLink: a, location: l, navigate: c } = T(), u = O(null), { openModal: g } = ze(), { open: h } = He(), y = s.action.entity;
2411
- if (!y)
2510
+ }, Eo = Mt(Ne(({ embedded: e = !1, title: t, className: n, onAction: o }) => {
2511
+ const { action: s, setAction: i } = ne(), { generateActionLink: a, location: c, navigate: f } = M(), u = O(null), { openModal: p } = Xe(), { open: m } = We(), b = s.action.entity;
2512
+ if (!b)
2412
2513
  throw new Error("Invalid Entity");
2413
- const { results: E, refresh: C } = te() || {}, f = Object.values(E?.action ?? []).filter((p) => p.visibility === Ke.List && p.name !== s.action.name), m = ({ newAction: p, excludeFilterParameters: x }) => {
2414
- const w = { ...p ?? s };
2415
- if (x?.forEach((L) => {
2416
- delete w.query?.filter?.[L];
2514
+ const { results: E, refresh: _ } = re() || {}, y = Object.values(E?.action ?? []).filter((h) => h.visibility === ze.List && h.name !== s.action.name), l = ({ newAction: h, excludeFilterParameters: x }) => {
2515
+ const P = { ...h ?? s };
2516
+ if (x?.forEach((D) => {
2517
+ delete P.query?.filter?.[D];
2417
2518
  }), e)
2418
- i(w);
2519
+ i(P);
2419
2520
  else {
2420
- const L = a(w);
2421
- c(L);
2521
+ const D = a(P);
2522
+ f(D);
2422
2523
  }
2423
- }, d = (p, x, w) => new Promise((L, S) => {
2424
- h({
2524
+ }, d = (h, x, P) => new Promise((D, S) => {
2525
+ m({
2425
2526
  title: "Are you sure?",
2426
- icon: Q.confirm,
2427
- onResult: (I) => {
2428
- I.isConfirmed ? ce().post({
2527
+ icon: ee.confirm,
2528
+ onResult: (L) => {
2529
+ L.isConfirmed ? de().post({
2429
2530
  url: a(s),
2430
- body: w,
2431
- bodyType: ut.FormData
2432
- }).catch((oe) => {
2531
+ body: P,
2532
+ bodyType: pt.FormData
2533
+ }).catch((I) => {
2433
2534
  S();
2434
2535
  }).finally(() => {
2435
- C?.(), L();
2536
+ _?.(), D();
2436
2537
  }) : S();
2437
2538
  }
2438
2539
  });
2439
- }), b = (p, x) => {
2440
- if (!r?.(p, x)) {
2441
- switch (x?.preventDefault(), p.parameters = { ...p.parameters || {}, ...s.parameters || {} }, p.parameters = Ue(p.parameters), Object.keys(p.parameters).length || (p.parameters = void 0), p.query !== void 0 && (Object.keys(p.query).length || (p.query = void 0)), p.action.name) {
2540
+ }), g = (h, x) => {
2541
+ if (!o?.(h, x)) {
2542
+ switch (x?.preventDefault(), h.parameters = { ...h.parameters || {}, ...s.parameters || {} }, h.parameters = Be(h.parameters), Object.keys(h.parameters).length || (h.parameters = void 0), h.query !== void 0 && (Object.keys(h.query).length || (h.query = void 0)), h.action.name) {
2442
2543
  case "list":
2443
- return m({ newAction: p });
2544
+ return l({ newAction: h });
2444
2545
  case "delete": {
2445
- h({
2546
+ m({
2446
2547
  title: "Are you sure?",
2447
- icon: Q.confirm,
2448
- onResult: (w) => {
2449
- w.isConfirmed && ce().fetch({
2450
- url: a(p),
2451
- method: Ve.DELETE
2452
- }).catch((L) => {
2453
- console.log("error", L);
2548
+ icon: ee.confirm,
2549
+ onResult: (P) => {
2550
+ P.isConfirmed && de().fetch({
2551
+ url: a(h),
2552
+ method: qe.DELETE
2553
+ }).catch((D) => {
2554
+ console.log("error", D);
2454
2555
  }).finally(() => {
2455
- C?.();
2556
+ _?.();
2456
2557
  });
2457
2558
  }
2458
2559
  });
@@ -2460,89 +2561,104 @@ const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P,
2460
2561
  }
2461
2562
  }
2462
2563
  if (e) {
2463
- g({
2464
- action: p,
2564
+ p({
2565
+ action: h,
2465
2566
  props: {
2466
2567
  size: "lg",
2467
2568
  onClose: () => {
2468
- C?.();
2569
+ _?.();
2469
2570
  }
2470
2571
  }
2471
2572
  });
2472
2573
  return;
2473
2574
  }
2474
- m({ newAction: p });
2575
+ l({ newAction: h });
2475
2576
  }
2476
2577
  };
2477
- return /* @__PURE__ */ o(hr, { data: E, onClick: b, children: /* @__PURE__ */ _("section", { className: n || "list", children: [
2478
- /* @__PURE__ */ o(k, { name: "header", children: /* @__PURE__ */ _("header", { className: "content-header d-md-flex mb-3 justify-content-between align-items-center", children: [
2479
- /* @__PURE__ */ o(k, { name: "title", children: t !== !1 && (v.isValidElement(t) ? t : /* @__PURE__ */ o("h2", { children: t ?? E?.title })) }),
2480
- /* @__PURE__ */ _("div", { className: "d-flex align-items-center", children: [
2481
- /* @__PURE__ */ o(k, { name: "actions", children: !!f.length && /* @__PURE__ */ o("div", { className: "btn-group btn-group-sm me-2", children: f.map((p, x) => /* @__PURE__ */ o(
2482
- sn,
2483
- {
2484
- action: { ...s, action: p },
2485
- className: "btn btn-outline-secondary"
2486
- },
2487
- x
2488
- )) }) }),
2489
- E?.form?.filter?.view && /* @__PURE__ */ _("div", { className: "btn-group btn-group-sm", children: [
2490
- /* @__PURE__ */ _(We, { children: [
2491
- /* @__PURE__ */ o(ve, { className: "btn btn-sm dropdown-toggle btn-outline-dark", children: /* @__PURE__ */ o(U, { children: "Filter" }) }),
2492
- /* @__PURE__ */ o(ae, { children: /* @__PURE__ */ o("div", { className: "filter", children: /* @__PURE__ */ _(
2493
- _t,
2578
+ return /* @__PURE__ */ r(vr, { data: E, onClick: g, children: /* @__PURE__ */ C("section", { className: n || "list", children: [
2579
+ /* @__PURE__ */ r(T, { name: "header", children: /* @__PURE__ */ C(
2580
+ "header",
2581
+ {
2582
+ className: "content-header d-flex flex-column flex-md-row gap-3 mb-3 justify-content-between align-items-md-center",
2583
+ children: [
2584
+ /* @__PURE__ */ r(T, { name: "title", children: t !== !1 && (v.isValidElement(t) ? t : /* @__PURE__ */ r("h2", { children: /* @__PURE__ */ r(k, { children: t ?? E?.title }) })) }),
2585
+ /* @__PURE__ */ C("div", { className: "d-flex align-items-center", children: [
2586
+ /* @__PURE__ */ r(T, { name: "actions", children: !!y.length && /* @__PURE__ */ r("div", { className: "btn-group btn-group-sm me-2", children: y.map((h, x) => /* @__PURE__ */ r(
2587
+ dn,
2494
2588
  {
2495
- id: "filter_" + Ce(y),
2496
- ref: u,
2497
- onSubmit: (p) => b({
2498
- ...s,
2499
- query: Ue(Pn(p))
2500
- }),
2501
- onReset: () => b({
2502
- ...s,
2503
- query: void 0
2504
- }),
2505
- children: [
2506
- E?.form?.filter && /* @__PURE__ */ o(ne, { view: E.form.filter.view, children: /* @__PURE__ */ o(me, {}) }),
2507
- /* @__PURE__ */ o("button", { className: "btn btn-primary me-2", type: "submit", children: /* @__PURE__ */ o(U, { children: "Submit" }) })
2508
- ]
2509
- }
2510
- ) }) })
2511
- ] }),
2512
- l.searchParams.has("filter") && /* @__PURE__ */ o(ue, { onClick: () => {
2513
- u.current?.reset();
2514
- }, className: "btn btn-outline-dark", children: "x" })
2515
- ] })
2516
- ] })
2517
- ] }) }),
2518
- /* @__PURE__ */ _(gr, { onClick: d, children: [
2519
- E?.form?.filter?.view && /* @__PURE__ */ o(po, { formView: E.form.filter.view, onClick: (p) => m({ excludeFilterParameters: [p] }) }),
2520
- /* @__PURE__ */ o(ho, {}),
2521
- /* @__PURE__ */ _(k, { name: "content", children: [
2522
- /* @__PURE__ */ o(F, { prefix: "list", view: "content", data: E, children: /* @__PURE__ */ o(
2523
- yr,
2589
+ action: { ...s, action: h },
2590
+ className: "btn btn-outline-secondary"
2591
+ },
2592
+ x
2593
+ )) }) }),
2594
+ E?.form?.filter?.view && /* @__PURE__ */ r(T, { name: "filter", children: /* @__PURE__ */ C("div", { className: "btn-group btn-group-sm", children: [
2595
+ /* @__PURE__ */ C(Ze, { autoClose: "outside", children: [
2596
+ /* @__PURE__ */ r(Ce, { className: "btn btn-sm dropdown-toggle btn-outline-dark", children: /* @__PURE__ */ r(k, { children: "Filter" }) }),
2597
+ /* @__PURE__ */ r(le, { children: /* @__PURE__ */ r("div", { className: "filter", children: /* @__PURE__ */ C(
2598
+ At,
2599
+ {
2600
+ id: "filter_" + xe(b),
2601
+ ref: u,
2602
+ onSubmit: (h) => g({
2603
+ ...s,
2604
+ query: Be($e(h))
2605
+ }),
2606
+ onReset: () => g({
2607
+ ...s,
2608
+ query: void 0
2609
+ }),
2610
+ children: [
2611
+ E?.form?.filter && /* @__PURE__ */ r(oe, { view: E.form.filter.view, children: /* @__PURE__ */ r(pe, {}) }),
2612
+ /* @__PURE__ */ C("div", { className: "d-flex gap-2", children: [
2613
+ /* @__PURE__ */ r("button", { className: "btn btn-primary", type: "submit", children: /* @__PURE__ */ r(k, { children: "Apply Filters" }) }),
2614
+ /* @__PURE__ */ r("button", { className: "btn", type: "reset", children: /* @__PURE__ */ r(k, { children: "Clear" }) })
2615
+ ] })
2616
+ ]
2617
+ }
2618
+ ) }) })
2619
+ ] }),
2620
+ c.searchParams.has("filter") && /* @__PURE__ */ r(he, { onClick: () => {
2621
+ u.current?.reset();
2622
+ }, className: "btn btn-outline-dark", children: "x" })
2623
+ ] }) })
2624
+ ] })
2625
+ ]
2626
+ }
2627
+ ) }),
2628
+ /* @__PURE__ */ C(Er, { onClick: d, children: [
2629
+ E?.form?.filter?.view && /* @__PURE__ */ r(
2630
+ yo,
2631
+ {
2632
+ formView: E.form.filter.view,
2633
+ onClick: (h) => l({ excludeFilterParameters: [h] })
2634
+ }
2635
+ ),
2636
+ /* @__PURE__ */ r(vo, {}),
2637
+ /* @__PURE__ */ C(T, { name: "content", children: [
2638
+ /* @__PURE__ */ r(j, { prefix: "list", view: "content", data: E, children: /* @__PURE__ */ r(
2639
+ xr,
2524
2640
  {
2525
2641
  routeParams: s.parameters
2526
2642
  }
2527
2643
  ) }, "list"),
2528
- /* @__PURE__ */ o(Er, {})
2644
+ /* @__PURE__ */ r(Nr, {})
2529
2645
  ] })
2530
2646
  ] })
2531
2647
  ] }) });
2532
- }, { name: "list" })), bo = ({ view: e }) => /* @__PURE__ */ _(P, { children: [
2648
+ }, { name: "list" })), Co = ({ view: e }) => /* @__PURE__ */ C(A, { children: [
2533
2649
  'View "',
2534
2650
  e,
2535
2651
  '" Not found.'
2536
- ] }), vo = ({ view: e, props: t }) => {
2652
+ ] }), _o = ({ view: e, props: t }) => {
2537
2653
  const n = {
2538
- add: tt,
2539
- edit: tt,
2540
- list: go
2541
- }, r = Lt();
2542
- return /* @__PURE__ */ o(F, { view: e, props: t, children: n[e] !== void 0 ? v.createElement(n[e], t) : /* @__PURE__ */ o(bo, { view: e }) }, r + e);
2543
- }, yn = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(vo, { view: e, props: n }) }), En = v.createContext({});
2544
- function ze() {
2545
- const { modal: e, setModal: t } = v.useContext(En);
2654
+ add: st,
2655
+ edit: st,
2656
+ list: Eo
2657
+ }, o = Dt();
2658
+ return /* @__PURE__ */ r(j, { view: e, props: t, children: n[e] !== void 0 ? v.createElement(n[e], t) : /* @__PURE__ */ r(Co, { view: e }) }, o + e);
2659
+ }, xn = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(_o, { view: e, props: n }) }), Nn = v.createContext({});
2660
+ function Xe() {
2661
+ const { modal: e, setModal: t } = v.useContext(Nn);
2546
2662
  return {
2547
2663
  modal: e,
2548
2664
  openModal: (n) => {
@@ -2553,296 +2669,298 @@ function ze() {
2553
2669
  }
2554
2670
  };
2555
2671
  }
2556
- function yo(e) {
2557
- const [t, n] = Y((c, u) => {
2558
- const g = [...c];
2559
- return u ? g.push(u) : g.pop(), g;
2560
- }, []), r = t[t.length - 1] ?? null, { open: s } = He(), i = O(0);
2672
+ function xo(e) {
2673
+ const [t, n] = z((u, p) => {
2674
+ const m = [...u];
2675
+ return p ? m.push(p) : m.pop(), m;
2676
+ }, []), o = t[t.length - 1] ?? null, { open: s } = We(), i = O(0);
2561
2677
  N(() => {
2562
2678
  i.current += 1;
2563
- }, [r]);
2679
+ }, [o]);
2564
2680
  const a = {
2565
- ...r?.props || {}
2566
- }, l = r ? [
2567
- r.action.action.entity,
2568
- r.action.action.namespace,
2569
- r.action.action.name
2570
- ].filter((c) => c).join("-") : Date.now();
2571
- return /* @__PURE__ */ _(En.Provider, { value: {
2572
- modal: r,
2573
- setModal: (c) => {
2574
- n(c);
2681
+ ...o?.props || {}
2682
+ }, c = (u) => u ? [
2683
+ u.action.action.entity,
2684
+ u.action.action.namespace,
2685
+ u.action.action.name
2686
+ ].filter((p) => p).join("-") : Date.now().toString(), f = c(o);
2687
+ return /* @__PURE__ */ C(Nn.Provider, { value: {
2688
+ modal: o,
2689
+ setModal: (u) => {
2690
+ f !== c(u) && n(u);
2575
2691
  }
2576
2692
  }, children: [
2577
2693
  e.children,
2578
- r && /* @__PURE__ */ o(ht, { preventDefault: !0, fallback: (c) => {
2694
+ o && /* @__PURE__ */ r(vt, { preventDefault: !0, fallback: (u) => {
2579
2695
  n(null), s({
2580
- title: c?.detail ?? "Unknown Error",
2581
- icon: Q.denied,
2696
+ title: u?.detail ?? "Unknown Error",
2697
+ icon: ee.denied,
2582
2698
  actions: {
2583
2699
  close: {
2584
2700
  label: "OK"
2585
2701
  }
2586
2702
  }
2587
2703
  });
2588
- }, children: /* @__PURE__ */ o(Rt, { action: r.action, children: /* @__PURE__ */ o(
2589
- yn,
2704
+ }, children: /* @__PURE__ */ r(It, { action: o.action, children: /* @__PURE__ */ r(
2705
+ xn,
2590
2706
  {
2591
- view: r.action.action.name || "list",
2707
+ view: o.action.action.name || "list",
2592
2708
  props: {
2593
2709
  modal: !0,
2594
2710
  props: a
2595
2711
  }
2596
2712
  }
2597
- ) }, l) })
2713
+ ) }, f) })
2598
2714
  ] });
2599
2715
  }
2600
- const Eo = ({ children: e, config: t }) => /* @__PURE__ */ o(Fn, { config: t, children: /* @__PURE__ */ o(rr, { children: /* @__PURE__ */ o(Vn, { children: /* @__PURE__ */ o(Jt, { children: /* @__PURE__ */ o(yo, { children: e }) }) }) }) });
2601
- let ge = null;
2602
- const Cn = {}, Je = "dakataa_crud", Uo = ({ connection: e, templates: t }) => {
2603
- H.namespace[Je] = e, Cn.templates = t, ge = null;
2604
- }, ce = () => (ge || (ge = H.instance({ namespace: Je })), ge), Vo = ({ children: e, config: t, errorFallback: n }) => {
2605
- const r = Object.assign(Cn.templates ?? {}, t?.templates ?? {});
2606
- return /* @__PURE__ */ o(Et, { children: /* @__PURE__ */ o($n, { children: /* @__PURE__ */ o(ht, { fallback: n ?? /* @__PURE__ */ o(jn, {}), children: /* @__PURE__ */ o(Eo, { config: { ...t || { env: bt.DEV }, templates: r }, children: e }) }) }) });
2607
- }, Co = ({ namespace: e }) => {
2608
- const { columns: t } = B();
2609
- return /* @__PURE__ */ o("div", { className: "card mb-3", children: /* @__PURE__ */ o("div", { className: "card-body", children: /* @__PURE__ */ _("div", { className: "d-flex flex-row gap-3 align-items-start", children: [
2610
- /* @__PURE__ */ o(rn, {}),
2611
- /* @__PURE__ */ o("div", { className: "d-flex flex-column flex-wrap gap-2", children: t.map((n, r) => /* @__PURE__ */ _("div", { className: "d-flex align-items-start", children: [
2612
- /* @__PURE__ */ _("span", { className: "text-secondary me-1", children: [
2613
- /* @__PURE__ */ o(on, { column: n, namespace: e }),
2716
+ const No = ({ children: e, config: t }) => /* @__PURE__ */ r(Vn, { config: t, children: /* @__PURE__ */ r(ir, { children: /* @__PURE__ */ r(qn, { children: /* @__PURE__ */ r(en, { children: /* @__PURE__ */ r(xo, { children: e }) }) }) }) });
2717
+ let ve = null;
2718
+ const wn = {}, et = "dakataa_crud", qo = ({ connection: e, templates: t }) => {
2719
+ G.namespace[et] = e, wn.templates = t, ve = null;
2720
+ }, de = () => (ve || (ve = G.instance({ namespace: et })), ve), Ho = ({ children: e, config: t, errorFallback: n }) => {
2721
+ const o = Object.assign(wn.templates ?? {}, t?.templates ?? {});
2722
+ return /* @__PURE__ */ r(Nt, { children: /* @__PURE__ */ r(Kn, { children: /* @__PURE__ */ r(vt, { fallback: n ?? /* @__PURE__ */ r(Un, {}), children: /* @__PURE__ */ r(No, { config: { ...t || { env: Ct.DEV }, templates: o }, children: e }) }) }) });
2723
+ }, wo = ({ namespace: e }) => {
2724
+ const { columns: t } = $();
2725
+ return /* @__PURE__ */ r("div", { className: "card mb-3", children: /* @__PURE__ */ r("div", { className: "card-body", children: /* @__PURE__ */ C("div", { className: "d-flex flex-row gap-3 align-items-start", children: [
2726
+ /* @__PURE__ */ r(cn, {}),
2727
+ /* @__PURE__ */ r("div", { className: "d-flex flex-column flex-wrap gap-2", children: t.map((n, o) => /* @__PURE__ */ C("div", { className: "d-flex align-items-start", children: [
2728
+ /* @__PURE__ */ C("span", { className: "text-secondary me-1", children: [
2729
+ /* @__PURE__ */ r(ln, { column: n, namespace: e }),
2614
2730
  ":"
2615
2731
  ] }),
2616
- /* @__PURE__ */ o(en, { column: n, namespace: e })
2617
- ] }, r)) }),
2618
- /* @__PURE__ */ o("div", { className: "ms-auto", children: /* @__PURE__ */ o(an, { namespace: e }) })
2732
+ /* @__PURE__ */ r(on, { column: n, namespace: e })
2733
+ ] }, o)) }),
2734
+ /* @__PURE__ */ r("div", { className: "ms-auto", children: /* @__PURE__ */ r(un, { namespace: e }) })
2619
2735
  ] }) }) });
2620
- }, Bo = ({ itemView: e, emptyView: t, namespace: n }) => {
2621
- const { items: r, primaryColumn: s, data: i } = B();
2622
- return !!i && (r.length ? r.map((a, l) => /* @__PURE__ */ o(Xt, { index: l, children: /* @__PURE__ */ o(
2623
- F,
2736
+ }, Ko = ({ itemView: e, emptyView: t, namespace: n }) => {
2737
+ const { items: o, primaryColumn: s, data: i } = $();
2738
+ return !!i && (o.length ? o.map((a, c) => /* @__PURE__ */ r(rn, { index: c, children: /* @__PURE__ */ r(
2739
+ j,
2624
2740
  {
2625
2741
  namespace: n,
2626
2742
  prefix: "list",
2627
2743
  view: "listItem",
2628
- children: e || /* @__PURE__ */ o(Co, { namespace: n })
2744
+ children: e || /* @__PURE__ */ r(wo, { namespace: n })
2629
2745
  },
2630
- i?.entity?.data.items[l][s?.field ?? ""]
2631
- ) }, l)) : t === void 0 ? /* @__PURE__ */ o(U, { children: "No results found." }) : t);
2632
- }, $o = ({ name: e }) => {
2633
- const { form: t } = V(), n = e ? t.children?.[e] : t;
2746
+ i?.entity?.data.items[c][s?.field ?? ""]
2747
+ ) }, c)) : t === void 0 ? /* @__PURE__ */ r(k, { children: "No results found." }) : t);
2748
+ }, Go = ({ name: e }) => {
2749
+ const { form: t } = B(), n = e ? t.children?.[e] : t;
2634
2750
  if (!n)
2635
2751
  throw new Error("Missing Form View for FormLabel" + (e ? ": " + e : ""));
2636
- return /* @__PURE__ */ o(Re, { view: n });
2637
- }, _o = ({ children: e }) => /* @__PURE__ */ o(P, { children: e }), lt = Z(({ name: e, children: t, parent: n, render: r }) => (t = v.Children.toArray((r ? r(n) : t) || []).map((s) => (v.isValidElement(s) && s.type === _o && (s = v.cloneElement(s, { children: n })), s)), /* @__PURE__ */ o(P, { children: t }))), qo = Z(({ name: e, content: t, children: n, data: r }) => {
2638
- const s = v.Children.toArray(t).find((l) => v.isValidElement(l) && l.type === lt && l.props.name === e);
2752
+ return /* @__PURE__ */ r(Re, { view: n });
2753
+ }, Ao = ({ children: e }) => /* @__PURE__ */ r(A, { children: e }), mt = ue(({ name: e, children: t, parent: n, render: o }) => (t = v.Children.toArray((o ? o(n) : t) || []).map((s) => (v.isValidElement(s) && s.type === Ao && (s = v.cloneElement(s, { children: n })), s)), /* @__PURE__ */ r(A, { children: t }))), Yo = ue(({ name: e, content: t, children: n, data: o }) => {
2754
+ const s = v.Children.toArray(t).find((c) => v.isValidElement(c) && c.type === mt && c.props.name === e);
2639
2755
  let i = null;
2640
- s && v.isValidElement(s) && (i = v.cloneElement(s, { parent: n, data: r }));
2641
- const a = v.Children.toArray(n).filter((l) => v.isValidElement(l) && l.type !== lt);
2642
- return /* @__PURE__ */ o(P, { children: i || (a.length ? a : n) });
2643
- }), _n = v.createContext(null), xn = ({ item: e }) => /* @__PURE__ */ o(_n.Provider, { value: e, children: e.parent?.parent ? /* @__PURE__ */ o(xn, { item: e.parent }) : e.parent?.element ? e.parent.element : e.element }), Ho = () => v.useContext(_n)?.element || "Empty", Ko = ({ children: e }) => {
2644
- const t = (l, c) => On.toArray(l).reduce((u, g) => {
2645
- const h = g.props, y = (f) => f?.replace(/\/$/, ""), E = [c?.path, h?.path].filter((f) => f).map((f) => y(f)).join("/"), C = t(h.children, { path: E, element: h.element });
2756
+ s && v.isValidElement(s) && (i = v.cloneElement(s, { parent: n, data: o }));
2757
+ const a = v.Children.toArray(n).filter((c) => v.isValidElement(c) && c.type !== mt);
2758
+ return /* @__PURE__ */ r(A, { children: i || (a.length ? a : n) });
2759
+ }), An = v.createContext(null), Pn = ({ item: e }) => /* @__PURE__ */ r(An.Provider, { value: e, children: e.parent?.parent ? /* @__PURE__ */ r(Pn, { item: e.parent }) : e.parent?.element ? e.parent.element : e.element }), Wo = () => v.useContext(An)?.element || "Empty", zo = ({ children: e }) => {
2760
+ const t = (c, f) => Dn.toArray(c).reduce((u, p) => {
2761
+ const m = p.props, b = (y) => y?.replace(/\/$/, ""), E = [f?.path, m?.path].filter((y) => y).map((y) => b(y)).join("/"), _ = t(m.children, { path: E, element: m.element });
2646
2762
  return [
2647
2763
  ...u,
2648
- ...C.length ? C : [{
2764
+ ..._.length ? _ : [{
2649
2765
  path: "/" + E,
2650
- element: h?.element,
2651
- parent: c
2766
+ element: m?.element,
2767
+ parent: f
2652
2768
  }]
2653
2769
  ];
2654
2770
  }, []), n = O(null);
2655
2771
  n.current === null && (n.current = t(e));
2656
- const { matchPath: r } = T(), s = n.current.filter((l) => l.path && r(l.path, document.location.href)).shift(), [, i] = R(document.location.href), a = () => {
2772
+ const { matchPath: o } = M(), s = n.current.filter((c) => c.path && o(c.path, document.location.href)).shift(), [, i] = R(document.location.href), a = () => {
2657
2773
  i(document.location.href);
2658
2774
  };
2659
2775
  if (N(() => (a(), window.addEventListener("locationchange", a), () => {
2660
2776
  window.removeEventListener("locationchange", a);
2661
2777
  }), []), !!s)
2662
- return /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(xn, { item: s }) });
2663
- }, Go = (e) => null, wn = v.createContext(null), xo = () => v.useContext(wn), wo = ({ item: e, open: t = !1 }) => {
2664
- const n = !!e.items?.length, { location: r, generateRoute: s } = T(), i = r.pathname.replace(/(.*?)\/?$/i, "$1"), a = s(e.route), l = i.includes(a, 0), [c, u] = v.useState(l), g = xo(), h = O(null), y = O(null), E = "collapse", C = "collapsing", f = {
2665
- toggle: (b) => {
2666
- u(b !== void 0 ? b : !c);
2778
+ return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Pn, { item: s }) });
2779
+ }, Jo = (e) => null, Ln = v.createContext(null), Po = () => v.useContext(Ln), Lo = ({ item: e, open: t = !1 }) => {
2780
+ const n = !!e.items?.length, { location: o, generateRoute: s } = M(), i = o.pathname.replace(/(.*?)\/?$/i, "$1"), a = s(e.route), c = i.includes(a, 0), [f, u] = v.useState(c), p = Po(), m = O(null), b = O(null), E = "collapse", _ = "collapsing", y = {
2781
+ toggle: (g) => {
2782
+ u(g !== void 0 ? g : !f);
2667
2783
  }
2668
- }, m = () => {
2669
- h.current?.classList.remove(C), h.current?.classList.add(E), h.current?.classList.toggle("show", c), h.current?.style.removeProperty("height");
2784
+ }, l = () => {
2785
+ m.current?.classList.remove(_), m.current?.classList.add(E), m.current?.classList.toggle("show", f), m.current?.style.removeProperty("height");
2670
2786
  }, d = () => {
2671
- y.current && (clearTimeout(y.current), y.current = null);
2787
+ b.current && (clearTimeout(b.current), b.current = null);
2672
2788
  };
2673
- return N(() => (c && g && g.toggle(!0), h.current?.addEventListener("animationstart", d), h.current?.addEventListener("transitionstart", d), h.current?.addEventListener("animationend", m), h.current?.addEventListener("transitionend", m), h.current?.style.setProperty("height", (c ? 0 : h.current?.scrollHeight) + "px"), h.current?.classList.remove("show"), h.current?.classList.remove(E), h.current?.classList.add(C), setTimeout(() => {
2674
- h.current?.style.setProperty("height", (c ? h.current?.scrollHeight : 0) + "px");
2675
- }, 10), y.current = setTimeout(m, 50), () => {
2676
- d(), h.current?.removeEventListener("animationstart", d), h.current?.removeEventListener("transitionstart", d), h.current?.removeEventListener("animationend", m), h.current?.removeEventListener("transitionend", m);
2677
- }), [c]), N(() => {
2678
- t !== c && u(t);
2679
- }, [t]), /* @__PURE__ */ o(wn.Provider, { value: f, children: /* @__PURE__ */ _("nav", { className: ["item", ...c || l ? ["active"] : []].join(" "), children: [
2680
- /* @__PURE__ */ _(
2681
- j,
2789
+ return N(() => (f && p && p.toggle(!0), m.current?.addEventListener("animationstart", d), m.current?.addEventListener("transitionstart", d), m.current?.addEventListener("animationend", l), m.current?.addEventListener("transitionend", l), m.current?.style.setProperty("height", (f ? 0 : m.current?.scrollHeight) + "px"), m.current?.classList.remove("show"), m.current?.classList.remove(E), m.current?.classList.add(_), setTimeout(() => {
2790
+ m.current?.style.setProperty("height", (f ? m.current?.scrollHeight : 0) + "px");
2791
+ }, 10), b.current = setTimeout(l, 50), () => {
2792
+ d(), m.current?.removeEventListener("animationstart", d), m.current?.removeEventListener("transitionstart", d), m.current?.removeEventListener("animationend", l), m.current?.removeEventListener("transitionend", l);
2793
+ }), [f]), N(() => {
2794
+ t !== f && u(t);
2795
+ }, [t]), /* @__PURE__ */ r(Ln.Provider, { value: y, children: /* @__PURE__ */ C("nav", { className: ["item", ...f || c ? ["active"] : []].join(" "), children: [
2796
+ /* @__PURE__ */ C(
2797
+ U,
2682
2798
  {
2683
2799
  to: n ? "#" : s(e.route),
2684
2800
  ...e.icon && { icon: e.icon },
2685
2801
  ...n && {
2686
2802
  onClick: () => {
2687
- u(!c);
2803
+ u(!f);
2688
2804
  }
2689
2805
  },
2690
2806
  children: [
2691
- /* @__PURE__ */ o("span", { className: "icon" }),
2692
- /* @__PURE__ */ o("span", { className: "title", children: e.title })
2807
+ /* @__PURE__ */ r("span", { className: "icon" }),
2808
+ /* @__PURE__ */ r("span", { className: "title", children: e.title })
2693
2809
  ]
2694
2810
  }
2695
2811
  ),
2696
- n && !!e.items?.length && /* @__PURE__ */ o("nav", { ref: h, className: E, children: /* @__PURE__ */ o(Nn, { items: e.items }) })
2812
+ n && !!e.items?.length && /* @__PURE__ */ r("nav", { ref: m, className: E, children: /* @__PURE__ */ r(On, { items: e.items }) })
2697
2813
  ] }) });
2698
- }, Nn = ({ items: e }) => e.map(
2814
+ }, On = ({ items: e }) => e.map(
2699
2815
  (t) => {
2700
- const n = [parent, t.title].filter((r) => r).join("-").toLowerCase();
2701
- return /* @__PURE__ */ o(wo, { item: t }, n);
2816
+ const n = [parent, t.title].filter((o) => o).join("-").toLowerCase();
2817
+ return /* @__PURE__ */ r(Lo, { item: t }, n);
2702
2818
  }
2703
- ), No = X(({ items: e, className: t, open: n = !1 }, r) => {
2819
+ ), Oo = He(({ items: e, className: t, open: n = !1 }, o) => {
2704
2820
  const s = O(null), [i, a] = v.useState(n);
2705
- r = r || Sn();
2706
- const l = {
2707
- toggle: (c) => {
2708
- a(c !== void 0 ? c : !i);
2821
+ o = o || Rn();
2822
+ const c = {
2823
+ toggle: (f) => {
2824
+ a(f !== void 0 ? f : !i);
2709
2825
  }
2710
2826
  };
2711
- return ye(r, () => l), N(() => {
2827
+ return fe(o, () => c), N(() => {
2712
2828
  document.body.classList.toggle("toggle-nav", i);
2713
- const c = (u) => {
2714
- s.current?.contains(u.target) || (a(!1), document.body.removeEventListener("click", c));
2829
+ const f = (u) => {
2830
+ s.current?.contains(u.target) || (a(!1), document.body.removeEventListener("click", f));
2715
2831
  };
2716
2832
  if (i)
2717
- return document.body.addEventListener("click", c), () => {
2718
- document.body.removeEventListener("click", c);
2833
+ return document.body.addEventListener("click", f), () => {
2834
+ document.body.removeEventListener("click", f);
2719
2835
  };
2720
- }, [i]), /* @__PURE__ */ o("nav", { ref: s, children: /* @__PURE__ */ o(Nn, { items: e }) });
2721
- }), Yo = ({ children: e, ...t }) => {
2722
- const n = O(null), [r, s] = R([]);
2836
+ }, [i]), /* @__PURE__ */ r("nav", { ref: s, children: /* @__PURE__ */ r(On, { items: e }) });
2837
+ }), Qo = ({ children: e, ...t }) => {
2838
+ const n = O(null), [o, s] = R([]);
2723
2839
  return N(() => {
2724
- ce().get({
2840
+ de().get({
2725
2841
  url: "/_crud/navigation"
2726
2842
  }).then(({ status: i, data: a }) => {
2727
2843
  i === 200 && s(a);
2728
2844
  });
2729
- }, []), /* @__PURE__ */ _(gt, { children: [
2730
- /* @__PURE__ */ o("header", { children: /* @__PURE__ */ _("div", { className: "wrap", children: [
2731
- /* @__PURE__ */ o("button", { onClick: (i) => n.current?.toggle(), className: "btn btn-mobile", children: /* @__PURE__ */ o("i", {}) }),
2732
- /* @__PURE__ */ o("nav", { className: "first-nav", children: /* @__PURE__ */ o(j, { className: "logo", to: "/", children: "Admin" }) }),
2733
- /* @__PURE__ */ o("nav", { className: "second-nav", children: /* @__PURE__ */ _(We, { className: "user", children: [
2734
- /* @__PURE__ */ o("span", { className: "initials", children: "YL" }),
2735
- /* @__PURE__ */ o(j, { to: "#", children: "Yordan Lazarov" }),
2736
- /* @__PURE__ */ o(j, { to: "#", children: "Logout" })
2845
+ }, []), /* @__PURE__ */ C(Et, { children: [
2846
+ /* @__PURE__ */ r("header", { children: /* @__PURE__ */ C("div", { className: "wrap", children: [
2847
+ /* @__PURE__ */ r("button", { onClick: (i) => n.current?.toggle(), className: "btn btn-mobile", children: /* @__PURE__ */ r("i", {}) }),
2848
+ /* @__PURE__ */ r("nav", { className: "first-nav", children: /* @__PURE__ */ r(U, { className: "logo", to: "/", children: "Admin" }) }),
2849
+ /* @__PURE__ */ r("nav", { className: "second-nav", children: /* @__PURE__ */ C(Ze, { className: "user", children: [
2850
+ /* @__PURE__ */ r("span", { className: "initials", children: "YL" }),
2851
+ /* @__PURE__ */ r(U, { to: "#", children: "Yordan Lazarov" }),
2852
+ /* @__PURE__ */ r(U, { to: "#", children: "Logout" })
2737
2853
  ] }) })
2738
2854
  ] }) }),
2739
- /* @__PURE__ */ _("main", { children: [
2740
- !!r.length && /* @__PURE__ */ o("div", { className: "navigation d-print-none", children: /* @__PURE__ */ o(No, { ref: n, items: r }) }),
2741
- /* @__PURE__ */ o("div", { className: "content", children: e })
2855
+ /* @__PURE__ */ C("main", { children: [
2856
+ !!o.length && /* @__PURE__ */ r("div", { className: "navigation d-print-none", children: /* @__PURE__ */ r(Oo, { ref: n, items: o }) }),
2857
+ /* @__PURE__ */ r("div", { className: "content", children: e })
2742
2858
  ] })
2743
2859
  ] });
2744
- }, Wo = ({ currency: e, locale: t, children: n }) => {
2745
- const r = Intl.NumberFormat().resolvedOptions().locale, { currency: s, locale: i } = le();
2746
- e ??= s ?? "EUR", t ??= i ?? r;
2747
- const a = Number(n);
2748
- return /* @__PURE__ */ o(P, { children: !isNaN(a) && a.toLocaleString(t, { style: "currency", currency: e }) });
2860
+ }, Zo = ({ currency: e, locale: t, children: n, precision: o = 2 }) => {
2861
+ const s = Intl.NumberFormat().resolvedOptions().locale, { currency: i, locale: a } = te();
2862
+ e ??= i ?? "EUR", t ??= a ?? s;
2863
+ const c = Number(n);
2864
+ return /* @__PURE__ */ r(A, { children: !isNaN(c) && c.toLocaleString(t, { style: "currency", currency: e, minimumFractionDigits: o }) });
2749
2865
  };
2750
2866
  export {
2751
- sn as Action,
2752
- Et as ActionProvider,
2753
- Q as AlertIcon,
2754
- Jt as AlertProvider,
2755
- _e as AsTemplate,
2756
- Ht as BaseFormFieldError,
2757
- Kt as BaseFormGroup,
2758
- Qn as BaseFormHelp,
2867
+ dn as Action,
2868
+ Nt as ActionProvider,
2869
+ ee as AlertIcon,
2870
+ en as AlertProvider,
2871
+ Ne as AsTemplate,
2872
+ Wt as BaseFormFieldError,
2873
+ zt as BaseFormGroup,
2874
+ er as BaseFormHelp,
2759
2875
  Re as BaseFormLabel,
2760
- gt as BaseLayout,
2761
- k as Block,
2762
- ue as Button,
2763
- er as Choice,
2764
- Xn as ChoiceGroupOption,
2765
- ke as ChoiceOption,
2766
- or as Collection,
2767
- ir as CollectionItem,
2768
- sr as CollectionList,
2769
- Fn as ConfigProvider,
2770
- Vo as Crud,
2771
- Uo as CrudConfiguration,
2772
- mr as CrudForm,
2773
- ko as CrudLoader,
2774
- Eo as CrudProvider,
2775
- ce as CrudRequester,
2776
- Rt as CurrentActionProvider,
2777
- Dt as DataProvider,
2778
- We as Dropdown,
2779
- ve as DropdownButton,
2780
- ae as DropdownContent,
2781
- F as DynamicView,
2782
- bt as Environment,
2783
- ht as ErrorBoundary,
2784
- mt as Exception,
2785
- q as Extend,
2786
- _t as Form,
2787
- ar as FormError,
2788
- et as FormField,
2789
- me as FormFieldViewLoader,
2790
- To as FormGroup,
2791
- $o as FormLabel,
2792
- cr as FormRest,
2793
- lr as FormRestError,
2794
- Io as FormSetting,
2795
- ne as FormViewProvider,
2796
- A as FormViewTypeEnum,
2797
- Hn as GetData,
2798
- Kn as GetDataByAction,
2799
- yr as GridView,
2800
- Be as HttpException,
2801
- tr as Input,
2802
- br as IsListItemActionGranted,
2803
- vr as ItemAction,
2804
- j as Link,
2805
- go as List,
2806
- Co as ListItem,
2807
- hr as ListProvider,
2808
- Bo as ListView,
2809
- Yo as MainLayout,
2810
- Wt as Modal,
2811
- yo as ModalProvider,
2812
- tt as Modify,
2813
- Wo as Money,
2814
- Ho as Outlet,
2815
- Er as Paginator,
2816
- Fo as Parent,
2817
- Go as Route,
2818
- Ko as Router,
2819
- Zn as SelectGroupOption,
2820
- Ut as SelectOption,
2821
- dr as Template,
2822
- qo as TemplateBlock,
2823
- lt as TemplateExtend,
2824
- _o as TemplateParentBlock,
2825
- U as Translation,
2826
- T as UseActions,
2827
- He as UseAlert,
2828
- $t as UseCollection,
2829
- jo as UseCollectionItem,
2830
- le as UseConfig,
2831
- ee as UseCurrentAction,
2832
- qn as UseCurrentActionCollection,
2833
- te as UseDataProvider,
2834
- de as UseForm,
2835
- Mt as UseFormSettings,
2836
- V as UseFormView,
2837
- B as UseList,
2838
- fe as UseListItem,
2839
- ze as UseModal,
2840
- yn as ViewLoader,
2841
- Ro as WithActionProviderContext,
2842
- Mo as WithAlertProvider,
2843
- Tt as WithDataProvider,
2844
- Se as capitalize,
2845
- Do as maskEmail,
2846
- Ce as nameToId,
2847
- Gn as titlize
2876
+ Et as BaseLayout,
2877
+ T as Block,
2878
+ he as Button,
2879
+ rr as Choice,
2880
+ nr as ChoiceGroupOption,
2881
+ Te as ChoiceOption,
2882
+ ar as Collection,
2883
+ lr as CollectionItem,
2884
+ cr as CollectionList,
2885
+ Vn as ConfigProvider,
2886
+ Ho as Crud,
2887
+ qo as CrudConfiguration,
2888
+ gr as CrudForm,
2889
+ Fo as CrudLoader,
2890
+ No as CrudProvider,
2891
+ de as CrudRequester,
2892
+ It as CurrentActionProvider,
2893
+ jt as DataProvider,
2894
+ Ze as Dropdown,
2895
+ Ce as DropdownButton,
2896
+ le as DropdownContent,
2897
+ j as DynamicView,
2898
+ Ct as Environment,
2899
+ vt as ErrorBoundary,
2900
+ gt as Exception,
2901
+ H as Extend,
2902
+ At as Form,
2903
+ ur as FormError,
2904
+ ot as FormField,
2905
+ pe as FormFieldViewLoader,
2906
+ Mo as FormGroup,
2907
+ Go as FormLabel,
2908
+ fr as FormRest,
2909
+ mr as FormRestError,
2910
+ Uo as FormSetting,
2911
+ oe as FormViewProvider,
2912
+ w as FormViewTypeEnum,
2913
+ Yn as GetData,
2914
+ Wn as GetDataByAction,
2915
+ xr as GridView,
2916
+ Ke as HttpException,
2917
+ or as Input,
2918
+ Cr as IsListItemActionGranted,
2919
+ _r as ItemAction,
2920
+ U as Link,
2921
+ Eo as List,
2922
+ wo as ListItem,
2923
+ vr as ListProvider,
2924
+ Ko as ListView,
2925
+ br as LottieAnimation,
2926
+ Qo as MainLayout,
2927
+ Zt as Modal,
2928
+ xo as ModalProvider,
2929
+ st as Modify,
2930
+ Zo as Money,
2931
+ Wo as Outlet,
2932
+ Nr as Paginator,
2933
+ Bo as Parent,
2934
+ Jo as Route,
2935
+ zo as Router,
2936
+ tr as SelectGroupOption,
2937
+ qt as SelectOption,
2938
+ hr as Template,
2939
+ Yo as TemplateBlock,
2940
+ mt as TemplateExtend,
2941
+ Ao as TemplateParentBlock,
2942
+ k as Translation,
2943
+ M as UseActions,
2944
+ We as UseAlert,
2945
+ Gt as UseCollection,
2946
+ Vo as UseCollectionItem,
2947
+ te as UseConfig,
2948
+ ne as UseCurrentAction,
2949
+ Gn as UseCurrentActionCollection,
2950
+ re as UseDataProvider,
2951
+ Qn as UseDynamicView,
2952
+ me as UseForm,
2953
+ $t as UseFormSettings,
2954
+ B as UseFormView,
2955
+ $ as UseList,
2956
+ ge as UseListItem,
2957
+ Xe as UseModal,
2958
+ xn as ViewLoader,
2959
+ Io as WithActionProviderContext,
2960
+ $o as WithAlertProvider,
2961
+ Mt as WithDataProvider,
2962
+ De as capitalize,
2963
+ jo as maskEmail,
2964
+ xe as nameToId,
2965
+ zn as titlize
2848
2966
  };