react-admin-crud-manager 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,65 +1,65 @@
1
- import { jsx as e, Fragment as E, jsxs as h } from "react/jsx-runtime";
2
- import Me, { useState as S, useRef as X, useEffect as z, useMemo as Se } from "react";
3
- import { ChevronDown as Ie, Search as Ce, Check as _e, X as fe, Filter as je, ChevronLeft as ze, ChevronRight as He, EllipsisVertical as Ue, User as Pe, Plus as Ye } from "lucide-react";
4
- import { createPortal as Ve } from "react-dom";
5
- import { Icon as De } from "@iconify/react";
1
+ import { jsx as e, Fragment as $, jsxs as c } from "react/jsx-runtime";
2
+ import Ce, { useState as R, useRef as X, useEffect as H, useMemo as Me } from "react";
3
+ import { ChevronDown as Ie, Search as Re, Check as _e, X as ye, Filter as Ke, ChevronLeft as Ue, ChevronRight as ze, EllipsisVertical as He, User as Te, Music as Ye, Plus as Ve } from "lucide-react";
4
+ import { createPortal as We } from "react-dom";
5
+ import { Icon as le } from "@iconify/react";
6
6
  import { Editor as qe } from "@tinymce/tinymce-react";
7
- import { SnackbarProvider as We, enqueueSnackbar as we } from "notistack";
7
+ import { SnackbarProvider as Ze, enqueueSnackbar as ke } from "notistack";
8
8
  import a from "prop-types";
9
- const Oe = (s, d = "DD MMM YYYY") => {
10
- if (!s) return "N/A";
11
- const n = new Date(s);
12
- if (isNaN(n)) return "Invalid Date";
13
- const i = (r) => String(r).padStart(2, "0"), o = {
14
- YYYY: n.getFullYear(),
15
- YY: String(n.getFullYear()).slice(-2),
16
- MMMM: n.toLocaleString("en-US", { month: "long" }),
17
- MMM: n.toLocaleString("en-US", { month: "short" }),
18
- MM: i(n.getMonth() + 1),
19
- M: n.getMonth() + 1,
20
- DD: i(n.getDate()),
21
- D: n.getDate(),
22
- dddd: n.toLocaleString("en-US", { weekday: "long" }),
23
- ddd: n.toLocaleString("en-US", { weekday: "short" }),
24
- HH: i(n.getHours()),
25
- hh: i(n.getHours() % 12 || 12),
26
- mm: i(n.getMinutes()),
27
- ss: i(n.getSeconds()),
28
- A: n.getHours() >= 12 ? "PM" : "AM"
9
+ const Oe = (h, n = "DD MMM YYYY") => {
10
+ if (!h) return "N/A";
11
+ const o = new Date(h);
12
+ if (isNaN(o)) return "Invalid Date";
13
+ const i = (l) => String(l).padStart(2, "0"), s = {
14
+ YYYY: o.getFullYear(),
15
+ YY: String(o.getFullYear()).slice(-2),
16
+ MMMM: o.toLocaleString("en-US", { month: "long" }),
17
+ MMM: o.toLocaleString("en-US", { month: "short" }),
18
+ MM: i(o.getMonth() + 1),
19
+ M: o.getMonth() + 1,
20
+ DD: i(o.getDate()),
21
+ D: o.getDate(),
22
+ dddd: o.toLocaleString("en-US", { weekday: "long" }),
23
+ ddd: o.toLocaleString("en-US", { weekday: "short" }),
24
+ HH: i(o.getHours()),
25
+ hh: i(o.getHours() % 12 || 12),
26
+ mm: i(o.getMinutes()),
27
+ ss: i(o.getSeconds()),
28
+ A: o.getHours() >= 12 ? "PM" : "AM"
29
29
  };
30
- return d.replace(
30
+ return n.replace(
31
31
  /YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
32
- (r) => o[r]
32
+ (l) => s[l]
33
33
  );
34
- }, Ze = (s, d, n = []) => {
35
- if (!(d != null && d.trim())) return s;
36
- const i = d.toLowerCase(), o = (r) => r == null ? [] : typeof r == "object" ? Object.values(r).flatMap(o) : [String(r)];
37
- return s.filter((r) => {
38
- let l = [];
39
- return n.length > 0 ? n.forEach((N) => {
40
- r[N] !== void 0 && l.push(...o(r[N]));
41
- }) : l = o(r), l.some(
42
- (N) => N.toLowerCase().includes(i)
34
+ }, Je = (h, n, o = []) => {
35
+ if (!(n != null && n.trim())) return h;
36
+ const i = n.toLowerCase(), s = (l) => l == null ? [] : typeof l == "object" ? Object.values(l).flatMap(s) : [String(l)];
37
+ return h.filter((l) => {
38
+ let r = [];
39
+ return o.length > 0 ? o.forEach((C) => {
40
+ l[C] !== void 0 && r.push(...s(l[C]));
41
+ }) : r = s(l), r.some(
42
+ (C) => C.toLowerCase().includes(i)
43
43
  );
44
44
  });
45
- }, ae = Me.forwardRef(
45
+ }, Q = Ce.forwardRef(
46
46
  ({
47
- className: s = "",
48
- variant: d = "contained",
49
- color: n = "default",
47
+ className: h = "",
48
+ variant: n = "contained",
49
+ color: o = "default",
50
50
  size: i = "default",
51
- fullWidth: o = !1,
52
- children: r,
53
- ...l
54
- }, N) => {
51
+ fullWidth: s = !1,
52
+ children: l,
53
+ ...r
54
+ }, C) => {
55
55
  var u;
56
- const M = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", y = {
56
+ const L = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", b = {
57
57
  sm: "h-8 px-3 rounded-md text-sm",
58
58
  md: "h-9 px-4 rounded-md text-sm",
59
59
  lg: "h-11 px-6 rounded-md text-base",
60
60
  xl: "h-12 px-8 rounded-lg text-lg",
61
61
  default: "h-9 px-4 rounded-md text-sm"
62
- }, f = {
62
+ }, y = {
63
63
  primary: {
64
64
  contained: "bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",
65
65
  outlined: "border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",
@@ -80,118 +80,134 @@ const Oe = (s, d = "DD MMM YYYY") => {
80
80
  outlined: "border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",
81
81
  text: "bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"
82
82
  }
83
- }, c = ((u = f[n]) == null ? void 0 : u[d]) || f.default.contained, g = y[i], m = `
84
- ${M}
85
- ${c}
86
- ${g}
87
- ${o ? "w-full" : ""}
88
- ${s}
83
+ }, d = ((u = y[o]) == null ? void 0 : u[n]) || y.default.contained, p = b[i], m = `
84
+ ${L}
85
+ ${d}
86
+ ${p}
87
+ ${s ? "w-full" : ""}
88
+ ${h}
89
89
  `.trim();
90
90
  return /* @__PURE__ */ e(
91
91
  "button",
92
92
  {
93
- ref: N,
94
- type: l.type || "button",
93
+ ref: C,
94
+ type: r.type || "button",
95
95
  className: m,
96
- ...l,
97
- children: r
96
+ ...r,
97
+ children: l
98
98
  }
99
99
  );
100
100
  }
101
101
  );
102
- ae.displayName = "Button";
103
- function W({ label: s, required: d = !1 }) {
104
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
105
- s,
106
- d && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
102
+ Q.displayName = "Button";
103
+ function q({ label: h, required: n = !1 }) {
104
+ return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
105
+ h,
106
+ n && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
107
107
  ] }) });
108
108
  }
109
- const Je = ({
110
- options: s = [],
111
- value: d,
112
- onChange: n,
113
- placeholder: i = "Select option",
114
- className: o = "",
109
+ const Qe = ({
110
+ options: h = [],
111
+ value: n = "",
112
+ defaultValue: o = "",
113
+ onChange: i,
114
+ placeholder: s = "Select option",
115
+ className: l = "",
115
116
  disabled: r = !1,
116
- search: l = !1,
117
- label: N = "",
118
- required: M = !1,
117
+ search: C = !1,
118
+ label: L = "",
119
+ required: b = !1,
119
120
  name: y = "",
120
- parentClass: f = "",
121
- multiple: c = !1,
121
+ parentClass: d = "",
122
+ multiple: p = !1,
122
123
  // ✅ NEW
123
- dropdownMaxHeight: g = ""
124
+ dropdownMaxHeight: m = ""
124
125
  }) => {
125
- var B;
126
- const [m, u] = S(!1), [k, w] = S(""), [C, D] = S(!0), A = X(null), G = X(null), K = (b) => String(typeof b == "boolean" ? b : b ?? ""), j = c ? (d || []).map(K) : K(d), O = s.filter(
127
- (b) => b.label.toLowerCase().includes(k.toLowerCase())
128
- ), v = (b) => {
129
- const I = K(b);
130
- return c ? j.includes(I) : I === j;
126
+ var A;
127
+ const [u, x] = R(!1), [v, S] = R(""), [E, T] = R(!0), M = X(null), G = X(null);
128
+ let j = n || o;
129
+ const f = (N) => {
130
+ if (N == null || N === "") return "";
131
+ }, k = p ? (j || []).map(f) : f(j), O = h.filter(
132
+ (N) => N.label.toLowerCase().includes(v.toLowerCase())
133
+ ), D = (N) => {
134
+ const z = f(N);
135
+ return p ? k.includes(z) : z === k;
131
136
  };
132
- z(() => {
133
- const b = (I) => {
134
- A.current && !A.current.contains(I.target) && (u(!1), w(""));
137
+ H(() => {
138
+ const N = (z) => {
139
+ M.current && !M.current.contains(z.target) && (x(!1), S(""));
135
140
  };
136
- return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
137
- }, []), z(() => {
138
- if (m && A.current) {
139
- const b = A.current.getBoundingClientRect(), H = window.innerHeight - b.bottom;
140
- D(H < 200);
141
+ return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
142
+ }, []), H(() => {
143
+ if (u && M.current) {
144
+ const N = M.current.getBoundingClientRect(), Z = window.innerHeight - N.bottom;
145
+ T(Z < 200);
141
146
  }
142
- }, [m]), z(() => {
143
- m && G.current && G.current.focus();
144
- }, [m]);
145
- const L = (b) => {
146
- let I = b;
147
- if (b === "true" ? I = !0 : b === "false" && (I = !1), c) {
148
- const H = j.includes(K(b));
149
- let V;
150
- H ? V = d.filter(
151
- (J) => K(J) !== K(b)
152
- ) : V = [...d || [], I], n(V);
147
+ }, [u]), H(() => {
148
+ u && G.current && G.current.focus();
149
+ }, [u]);
150
+ const F = (N) => {
151
+ let z = N;
152
+ if (N === "true" ? z = !0 : N === "false" && (z = !1), p) {
153
+ const Z = k.includes(f(N));
154
+ let W;
155
+ Z ? W = n.filter(
156
+ (re) => f(re) !== f(N)
157
+ ) : W = [...n || [], z], i(W);
153
158
  } else
154
- n(I), u(!1);
155
- w("");
156
- }, T = c ? s.filter((b) => v(b.value)).map((b) => b.label).join(", ") : (B = s.find((b) => v(b.value))) == null ? void 0 : B.label;
157
- return /* @__PURE__ */ h("div", { className: f || "col-span-12", children: [
158
- /* @__PURE__ */ e(W, { label: N, required: M }),
159
- /* @__PURE__ */ h("div", { className: `relative ${o}`, ref: A, children: [
160
- /* @__PURE__ */ h(
159
+ i(z), x(!1);
160
+ S("");
161
+ }, U = p ? h.filter((N) => D(N.value)).map((N) => N.label).join(", ") : (A = h.find((N) => D(N.value))) == null ? void 0 : A.label;
162
+ return /* @__PURE__ */ c("div", { className: d || "col-span-12", children: [
163
+ /* @__PURE__ */ e(q, { label: L, required: b }),
164
+ /* @__PURE__ */ c("div", { className: `relative ${l}`, ref: M, children: [
165
+ /* @__PURE__ */ e(
166
+ "select",
167
+ {
168
+ name: "hidden_select_for_validation",
169
+ value: U || "",
170
+ required: b,
171
+ multiple: p,
172
+ className: "absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",
173
+ children: /* @__PURE__ */ e("option", { hidden: !0, value: U, children: U })
174
+ }
175
+ ),
176
+ /* @__PURE__ */ c(
161
177
  "button",
162
178
  {
163
179
  type: "button",
164
- onClick: () => !r && u(!m),
180
+ onClick: () => !r && x(!u),
165
181
  disabled: r,
166
182
  className: `w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
167
- ${T ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
183
+ ${U ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
168
184
  ${r ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
169
185
  children: [
170
- /* @__PURE__ */ e("span", { className: "truncate", children: T || i }),
186
+ /* @__PURE__ */ e("span", { className: "truncate", children: U || s }),
171
187
  /* @__PURE__ */ e(
172
188
  Ie,
173
189
  {
174
- className: `w-4 h-4 transition-transform ${m ? "rotate-180" : ""}`
190
+ className: `w-4 h-4 transition-transform ${u ? "rotate-180" : ""}`
175
191
  }
176
192
  )
177
193
  ]
178
194
  }
179
195
  ),
180
- m && /* @__PURE__ */ h(
196
+ u && /* @__PURE__ */ c(
181
197
  "div",
182
198
  {
183
199
  className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
184
- ${C ? "bottom-full mb-1" : "top-full mt-1"}`,
200
+ ${E ? "bottom-full mb-1" : "top-full mt-1"}`,
185
201
  children: [
186
- l && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ h("div", { className: "relative", children: [
187
- /* @__PURE__ */ e(Ce, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
202
+ C && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ c("div", { className: "relative", children: [
203
+ /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
188
204
  /* @__PURE__ */ e(
189
205
  "input",
190
206
  {
191
207
  ref: G,
192
208
  type: "text",
193
- value: k,
194
- onChange: (b) => w(b.target.value),
209
+ value: v,
210
+ onChange: (N) => S(N.target.value),
195
211
  placeholder: "Search...",
196
212
  className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
197
213
  }
@@ -202,21 +218,21 @@ const Je = ({
202
218
  {
203
219
  className: "max-h-40 overflow-y-auto",
204
220
  style: {
205
- maxHeight: g || ""
221
+ maxHeight: m || ""
206
222
  },
207
- children: O.length > 0 ? O.map((b) => /* @__PURE__ */ h(
223
+ children: O.length > 0 ? O.map((N) => /* @__PURE__ */ c(
208
224
  "button",
209
225
  {
210
226
  type: "button",
211
- onClick: () => L(String(b.value)),
227
+ onClick: () => F(String(N.value)),
212
228
  className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
213
- ${v(b.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
229
+ ${D(N.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
214
230
  children: [
215
- /* @__PURE__ */ e("span", { children: b.label }),
216
- c && v(b.value) && /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
231
+ /* @__PURE__ */ e("span", { children: N.label }),
232
+ p && D(N.value) && /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
217
233
  ]
218
234
  },
219
- String(b.value)
235
+ String(N.value)
220
236
  )) : /* @__PURE__ */ e("div", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No options found" })
221
237
  }
222
238
  )
@@ -225,26 +241,26 @@ const Je = ({
225
241
  )
226
242
  ] })
227
243
  ] }, y);
228
- }, Qe = ({
229
- value: s = !0,
230
- onChange: d,
231
- text: n,
244
+ }, Xe = ({
245
+ value: h = !0,
246
+ onChange: n,
247
+ text: o,
232
248
  options: i = [],
233
- label: o,
234
- required: r,
235
- name: l = "",
236
- disabled: N = !1,
237
- parentClass: M = ""
249
+ label: s,
250
+ required: l,
251
+ name: r = "",
252
+ disabled: C = !1,
253
+ parentClass: L = ""
238
254
  }) => {
239
- const y = i.length > 0 ? i : [
255
+ const b = i.length > 0 ? i : [
240
256
  { label: "Active", value: !0 },
241
257
  { label: "Inactive", value: !1 }
242
258
  ];
243
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: M || "col-span-12", children: [
244
- /* @__PURE__ */ e(W, { label: o, required: r }),
245
- /* @__PURE__ */ h("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
246
- n && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: n }),
247
- /* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: y.map((f, c) => /* @__PURE__ */ h(
259
+ return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
260
+ /* @__PURE__ */ e(q, { label: s, required: l }),
261
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
262
+ o && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: o }),
263
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: b.map((y, d) => /* @__PURE__ */ c(
248
264
  "label",
249
265
  {
250
266
  className: "flex items-center gap-2 cursor-pointer select-none",
@@ -254,22 +270,22 @@ const Je = ({
254
270
  {
255
271
  type: "radio",
256
272
  name: "switch-field",
257
- required: r && c === 0,
258
- value: f.value,
259
- disabled: N,
260
- checked: s === f.value,
261
- onChange: () => d(f.value),
273
+ required: l && d === 0,
274
+ value: y.value,
275
+ disabled: C,
276
+ checked: h === y.value,
277
+ onChange: () => n(y.value),
262
278
  className: "w-4 h-4 border-gray-300 cursor-pointer"
263
279
  }
264
280
  ),
265
- /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: f.label })
281
+ /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: y.label })
266
282
  ]
267
283
  },
268
- c
284
+ d
269
285
  )) })
270
286
  ] })
271
- ] }, l) });
272
- }, ge = [
287
+ ] }, r) });
288
+ }, me = [
273
289
  { label: "Afghanistan", code: "AF", phone: "93" },
274
290
  { label: "Aland Islands", code: "AX", phone: "358" },
275
291
  { label: "Albania", code: "AL", phone: "355" },
@@ -521,70 +537,70 @@ const Je = ({
521
537
  { label: "Zambia", code: "ZM", phone: "260" },
522
538
  { label: "Zimbabwe", code: "ZW", phone: "263" }
523
539
  ];
524
- function Xe({
525
- label: s = "",
526
- value: d = "",
527
- name: n = "",
540
+ function ea({
541
+ label: h = "",
542
+ value: n = "",
543
+ name: o = "",
528
544
  parentClass: i = "",
529
- onChange: o,
530
- disabled: r = !1,
531
- required: l = !1,
532
- placeholder: N = "Phone number",
533
- search: M = !1,
534
- countriesList: y = !1,
535
- defaultCountry: f = ""
545
+ onChange: s,
546
+ disabled: l = !1,
547
+ required: r = !1,
548
+ placeholder: C = "Phone number",
549
+ search: L = !1,
550
+ countriesList: b = !1,
551
+ defaultCountry: y = ""
536
552
  }) {
537
- const c = (v) => ge.find((L) => L.code == v), [g, m] = S(
538
- c(f) || ge[0]
539
- ), [u, k] = S(""), [w, C] = S(!1), [D, A] = S(""), G = X();
540
- z(() => {
541
- if (typeof d == "string" && d.startsWith("+")) {
542
- const v = ge.filter((L) => d.startsWith("+" + L.phone)).sort((L, T) => T.phone.length - L.phone.length)[0];
543
- if (v) {
544
- m(v), k(d.replace("+" + v.phone, ""));
553
+ const d = (k) => me.find((O) => O.code == k), [p, m] = R(
554
+ d(y) || me[0]
555
+ ), [u, x] = R(""), [v, S] = R(!1), [E, T] = R(""), M = X();
556
+ H(() => {
557
+ if (typeof n == "string" && n.startsWith("+")) {
558
+ const k = me.filter((O) => n.startsWith("+" + O.phone)).sort((O, D) => D.phone.length - O.phone.length)[0];
559
+ if (k) {
560
+ m(k), x(n.replace("+" + k.phone, ""));
545
561
  return;
546
562
  }
547
563
  }
548
- k(d);
549
- }, [d]);
550
- const K = (v) => {
551
- const L = v.target.value.replace(/\D/g, "");
552
- k(L), g && o && o("+" + g.phone + L);
553
- }, j = (v) => {
554
- m(v), o && o("+" + v.phone + u), C(!1), A("");
564
+ x(n);
565
+ }, [n]);
566
+ const G = (k) => {
567
+ const O = k.target.value.replace(/\D/g, "");
568
+ x(O), p && s && s("+" + p.phone + O);
569
+ }, j = (k) => {
570
+ m(k), s && s("+" + k.phone + u), S(!1), T("");
555
571
  };
556
- z(() => {
557
- const v = (L) => {
558
- G.current && !G.current.contains(L.target) && C(!1);
572
+ H(() => {
573
+ const k = (O) => {
574
+ M.current && !M.current.contains(O.target) && S(!1);
559
575
  };
560
- return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
576
+ return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
561
577
  }, []);
562
- const O = ge.filter(
563
- (v) => v.label.toLowerCase().includes(D.toLowerCase()) || v.phone.includes(D)
578
+ const f = me.filter(
579
+ (k) => k.label.toLowerCase().includes(E.toLowerCase()) || k.phone.includes(E)
564
580
  );
565
- return y ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
566
- /* @__PURE__ */ e(W, { label: s, required: l }),
567
- /* @__PURE__ */ h("div", { className: "relative ", ref: G, children: [
568
- /* @__PURE__ */ h(
581
+ return b ? /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
582
+ /* @__PURE__ */ e(q, { label: h, required: r }),
583
+ /* @__PURE__ */ c("div", { className: "relative ", ref: M, children: [
584
+ /* @__PURE__ */ c(
569
585
  "div",
570
586
  {
571
587
  className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
572
- ${w ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
573
- ${r ? "opacity-60 cursor-not-allowed" : ""}`,
588
+ ${v ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
589
+ ${l ? "opacity-60 cursor-not-allowed" : ""}`,
574
590
  children: [
575
- /* @__PURE__ */ h(
591
+ /* @__PURE__ */ c(
576
592
  "button",
577
593
  {
578
594
  type: "button",
579
- disabled: r,
580
- onClick: () => C(!w),
595
+ disabled: l,
596
+ onClick: () => S(!v),
581
597
  className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
582
598
  children: [
583
- g ? /* @__PURE__ */ e(
599
+ p ? /* @__PURE__ */ e(
584
600
  "img",
585
601
  {
586
- src: `https://flagcdn.com/w20/${g.code.toLowerCase()}.png`,
587
- alt: g.code,
602
+ src: `https://flagcdn.com/w20/${p.code.toLowerCase()}.png`,
603
+ alt: p.code,
588
604
  className: "w-5 h-3 object-cover"
589
605
  }
590
606
  ) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
@@ -592,19 +608,19 @@ function Xe({
592
608
  ]
593
609
  }
594
610
  ),
595
- g && /* @__PURE__ */ h("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
611
+ p && /* @__PURE__ */ c("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
596
612
  "+",
597
- g.phone
613
+ p.phone
598
614
  ] }),
599
615
  /* @__PURE__ */ e(
600
616
  "input",
601
617
  {
602
618
  type: "tel",
603
619
  value: u,
604
- onChange: K,
605
- required: l,
606
- disabled: r || !g,
607
- placeholder: g ? N : "Select a country",
620
+ onChange: G,
621
+ required: r,
622
+ disabled: l || !p,
623
+ placeholder: p ? C : "Select a country",
608
624
  className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
609
625
  }
610
626
  ),
@@ -612,10 +628,10 @@ function Xe({
612
628
  "input",
613
629
  {
614
630
  type: "tel",
615
- required: l,
631
+ required: r,
616
632
  tabIndex: -1,
617
633
  readOnly: !0,
618
- value: g && u ? "+" + g.phone + u : "",
634
+ value: p && u ? "+" + p.phone + u : "",
619
635
  style: {
620
636
  position: "absolute",
621
637
  opacity: 0,
@@ -627,61 +643,61 @@ function Xe({
627
643
  ]
628
644
  }
629
645
  ),
630
- w && /* @__PURE__ */ h("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
631
- M && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ h("div", { className: "relative", children: [
632
- /* @__PURE__ */ e(Ce, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
646
+ v && /* @__PURE__ */ c("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
647
+ L && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ c("div", { className: "relative", children: [
648
+ /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
633
649
  /* @__PURE__ */ e(
634
650
  "input",
635
651
  {
636
652
  type: "text",
637
- value: D,
638
- onChange: (v) => A(v.target.value),
653
+ value: E,
654
+ onChange: (k) => T(k.target.value),
639
655
  placeholder: "Search country...",
640
656
  className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "
641
657
  }
642
658
  )
643
659
  ] }) }),
644
- O.map((v) => /* @__PURE__ */ h(
660
+ f.map((k) => /* @__PURE__ */ c(
645
661
  "button",
646
662
  {
647
663
  type: "button",
648
- onClick: () => j(v),
664
+ onClick: () => j(k),
649
665
  className: "w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",
650
666
  children: [
651
667
  /* @__PURE__ */ e(
652
668
  "img",
653
669
  {
654
- src: `https://flagcdn.com/w20/${v.code.toLowerCase()}.png`,
655
- alt: v.code,
670
+ src: `https://flagcdn.com/w20/${k.code.toLowerCase()}.png`,
671
+ alt: k.code,
656
672
  className: "w-5 h-3 object-cover"
657
673
  }
658
674
  ),
659
- /* @__PURE__ */ h("span", { children: [
660
- v.label,
675
+ /* @__PURE__ */ c("span", { children: [
676
+ k.label,
661
677
  " (+",
662
- v.phone,
678
+ k.phone,
663
679
  ")"
664
680
  ] })
665
681
  ]
666
682
  },
667
- v.code
683
+ k.code
668
684
  ))
669
685
  ] })
670
686
  ] })
671
- ] }, n) }) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
672
- /* @__PURE__ */ e(W, { label: s, required: l }),
687
+ ] }, o) }) : /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
688
+ /* @__PURE__ */ e(q, { label: h, required: r }),
673
689
  /* @__PURE__ */ e(
674
690
  "input",
675
691
  {
676
692
  type: "text",
677
- value: d,
678
- onChange: (L) => {
679
- const T = L.target.value.replace(/[^+\d]/g, ""), B = T.startsWith("+") ? "+" + T.replace(/[+]/g, "").slice(0) : T;
680
- o(B);
693
+ value: n,
694
+ onChange: (O) => {
695
+ const D = O.target.value.replace(/[^+\d]/g, ""), F = D.startsWith("+") ? "+" + D.replace(/[+]/g, "").slice(0) : D;
696
+ s(F);
681
697
  },
682
- placeholder: N,
683
- disabled: r,
684
- required: l,
698
+ placeholder: C,
699
+ disabled: l,
700
+ required: r,
685
701
  className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
686
702
  bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
687
703
  focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,
@@ -689,22 +705,22 @@ function Xe({
689
705
  pattern: "^\\+\\d{1,15}$"
690
706
  }
691
707
  )
692
- ] }, n) });
708
+ ] }, o) });
693
709
  }
694
- const Fe = Me.forwardRef(
695
- ({ className: s = "", label: d, required: n, ...i }, o) => {
696
- const r = `
710
+ const Fe = Ce.forwardRef(
711
+ ({ className: h = "", label: n, required: o, ...i }, s) => {
712
+ const l = `
697
713
  placeholder-gray-400 dark:placeholder-gray-400
698
- ${s}
714
+ ${h}
699
715
  `.trim();
700
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: i.parentClass || "col-span-12", children: [
701
- /* @__PURE__ */ e(W, { label: d, required: n }),
716
+ return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: i.parentClass || "col-span-12", children: [
717
+ /* @__PURE__ */ e(q, { label: n, required: o }),
702
718
  /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
703
719
  "textarea",
704
720
  {
705
- className: r,
706
- ref: o,
707
- required: n,
721
+ className: l,
722
+ ref: s,
723
+ required: o,
708
724
  ...i
709
725
  }
710
726
  ) })
@@ -712,109 +728,135 @@ const Fe = Me.forwardRef(
712
728
  }
713
729
  );
714
730
  Fe.displayName = "TextArea";
715
- const ea = ({
716
- label: s = "",
717
- value: d = null,
718
- onChange: n,
731
+ const aa = ({
732
+ label: h = "",
733
+ value: n = null,
734
+ onChange: o,
719
735
  required: i = !1,
720
- accept: o = "image/*",
721
- id: r,
722
- dragDrop: l = !1,
723
- name: N = "",
724
- parentClass: M = ""
736
+ accept: s = "image/*",
737
+ id: l,
738
+ dragDrop: r = !1,
739
+ name: C = "",
740
+ parentClass: L = ""
725
741
  }) => {
726
- const [y, f] = S(d), [c, g] = S(!1), m = X(null);
727
- z(() => {
728
- f(d instanceof File ? URL.createObjectURL(d) : d);
729
- }, [d]);
730
- const u = (D) => {
731
- if (!D || D.length === 0) {
732
- f(null), n == null || n(null);
742
+ const [b, y] = R(n), [d, p] = R(!1), m = X(null);
743
+ H(() => (n instanceof File ? y({ file: n, preview: URL.createObjectURL(n) }) : (n != null && n.preview, y(n)), () => {
744
+ b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview);
745
+ }), [n]);
746
+ const u = (M) => {
747
+ if (!M || M.length === 0)
733
748
  return;
734
- }
735
- const A = D[0], G = URL.createObjectURL(A);
736
- f({ file: A, preview: G }), n == null || n(A);
749
+ const G = M[0], j = URL.createObjectURL(G), f = { file: G, preview: j };
750
+ b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview), y(f), o == null || o(G);
751
+ }, x = (M) => {
752
+ M && M.stopPropagation(), b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview), y(null), o == null || o(null), m.current && (m.current.value = "");
753
+ }, v = (M) => {
754
+ r && (M.preventDefault(), p(!0));
755
+ }, S = (M) => {
756
+ r && (M.preventDefault(), p(!1));
757
+ }, E = (M) => {
758
+ r && (M.preventDefault(), p(!1), u(M.dataTransfer.files));
759
+ }, T = () => {
760
+ m.current.click();
737
761
  };
738
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: M || "col-span-12", children: [
739
- /* @__PURE__ */ e(W, { label: s, required: i }),
740
- /* @__PURE__ */ h(
762
+ return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
763
+ /* @__PURE__ */ e(q, { label: h, required: i }),
764
+ /* @__PURE__ */ c(
741
765
  "div",
742
766
  {
743
- className: `relative rounded-md p-2 transition-all ${c ? "border border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900" : "border bg-gray-50 dark:bg-gray-700"}`,
744
- onDragOver: (D) => {
745
- l && (D.preventDefault(), g(!0));
746
- },
747
- onDragLeave: (D) => {
748
- l && (D.preventDefault(), g(!1));
749
- },
750
- onDrop: (D) => {
751
- l && (D.preventDefault(), g(!1), u(D.dataTransfer.files));
752
- },
767
+ className: `relative rounded-md p-2 transition-all ${d ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
768
+ onDragOver: v,
769
+ onDragLeave: S,
770
+ onDrop: E,
753
771
  children: [
754
- /* @__PURE__ */ h(
772
+ /* @__PURE__ */ e(
773
+ "input",
774
+ {
775
+ ref: m,
776
+ id: l,
777
+ type: "file",
778
+ accept: s,
779
+ onChange: (M) => u(M.target.files),
780
+ required: i && !b,
781
+ className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
782
+ }
783
+ ),
784
+ /* @__PURE__ */ c(
755
785
  "div",
756
786
  {
757
- className: `flex items-center space-x-3 transition-all ${c ? "filter blur-sm" : ""}`,
787
+ className: `flex items-center space-x-4 transition-all ${d ? "opacity-50" : ""}`,
758
788
  children: [
759
- /* @__PURE__ */ e(
760
- "div",
761
- {
762
- className: "cursor-pointer",
763
- onClick: () => m.current.click(),
764
- children: y ? /* @__PURE__ */ e(
789
+ b ? (
790
+ // Image preview with close button
791
+ /* @__PURE__ */ c("div", { className: "relative group", children: [
792
+ /* @__PURE__ */ e(
765
793
  "img",
766
794
  {
767
- src: y.preview || y,
795
+ src: b.preview || b,
768
796
  alt: "preview",
769
- className: "object-cover w-20 h-20 rounded-full"
797
+ className: "object-cover w-20 h-20 rounded-full shadow-md"
770
798
  }
771
- ) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { className: "rounded-full bg-gray-200 dark:bg-gray-800 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(
772
- De,
799
+ ),
800
+ !i && /* @__PURE__ */ e(
801
+ "button",
773
802
  {
774
- icon: "ri:image-add-fill",
775
- className: "text-gray-400 w-10 h-10"
803
+ type: "button",
804
+ onClick: x,
805
+ className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",
806
+ "aria-label": "Remove image",
807
+ children: /* @__PURE__ */ e(le, { icon: "mdi:close", className: "w-3 h-3" })
776
808
  }
777
- ) }) })
778
- }
809
+ )
810
+ ] })
811
+ ) : (
812
+ // Placeholder icon
813
+ /* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(
814
+ le,
815
+ {
816
+ icon: "ri:image-add-fill",
817
+ className: "text-gray-400 w-10 h-10"
818
+ }
819
+ ) })
779
820
  ),
780
- /* @__PURE__ */ e(
781
- "input",
782
- {
783
- ref: m,
784
- id: r,
785
- type: "file",
786
- accept: o,
787
- onChange: (D) => u(D.target.files),
788
- required: i && !y,
789
- className: "inline-flex items-center justify-center p-2 text-gray-400 text-sm file:cursor-pointer"
790
- }
791
- )
821
+ /* @__PURE__ */ c("div", { className: "flex flex-col items-center space-y-1", children: [
822
+ /* @__PURE__ */ e(
823
+ Q,
824
+ {
825
+ type: "button",
826
+ onClick: T,
827
+ variant: "outlined",
828
+ color: "default",
829
+ children: b ? "Change Image" : "Select Image"
830
+ }
831
+ ),
832
+ r && !b && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
833
+ ] })
792
834
  ]
793
835
  }
794
836
  ),
795
- l && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ e("span", { className: "text-blue-500 font-semibold text-xl", children: "Drop here" }) })
837
+ r && d && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
796
838
  ]
797
839
  }
798
840
  )
799
- ] }, N) });
800
- }, Be = Me.forwardRef(
841
+ ] }, C) });
842
+ }, Be = Ce.forwardRef(
801
843
  ({
802
- label: s,
803
- required: d,
804
- parentClass: n = "",
844
+ label: h,
845
+ required: n,
846
+ parentClass: o = "",
805
847
  className: i = "",
806
- type: o = "text",
807
- onKeyDown: r,
808
- negativeNumberAllow: l = !0,
809
- ...N
810
- }, M) => {
811
- const [y, f] = S(!1), c = (m) => {
812
- if (o === "number") {
848
+ type: s = "text",
849
+ onKeyDown: l,
850
+ negativeNumberAllow: r = !0,
851
+ ...C
852
+ }, L) => {
853
+ const [b, y] = R(!1), d = (m) => {
854
+ if (s === "number") {
813
855
  if (["e", "E", "+"].includes(m.key)) {
814
856
  m.preventDefault();
815
857
  return;
816
858
  }
817
- if (l == !1 && m.key === "-") {
859
+ if (r == !1 && m.key === "-") {
818
860
  m.preventDefault();
819
861
  return;
820
862
  }
@@ -823,96 +865,96 @@ const ea = ({
823
865
  return;
824
866
  }
825
867
  }
826
- r == null || r(m);
827
- }, g = `
868
+ l == null || l(m);
869
+ }, p = `
828
870
  h-10 placeholder-gray-400 dark:placeholder-gray-400
829
- ${o === "password" ? "pr-10" : ""}
830
- ${o === "number" ? "no-spinner" : ""}
871
+ ${s === "password" ? "pr-10" : ""}
872
+ ${s === "number" ? "no-spinner" : ""}
831
873
  ${i}
832
874
  `.trim();
833
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: n || "col-span-12", children: [
834
- /* @__PURE__ */ e(W, { label: s, required: d }),
835
- /* @__PURE__ */ h("div", { className: "relative", children: [
875
+ return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: o || "col-span-12", children: [
876
+ /* @__PURE__ */ e(q, { label: h, required: n }),
877
+ /* @__PURE__ */ c("div", { className: "relative", children: [
836
878
  /* @__PURE__ */ e(
837
879
  "input",
838
880
  {
839
- type: o === "password" && y ? "text" : o,
840
- ref: M,
841
- required: d,
842
- onKeyDown: c,
843
- className: g,
844
- ...N
881
+ type: s === "password" && b ? "text" : s,
882
+ ref: L,
883
+ required: n,
884
+ onKeyDown: d,
885
+ className: p,
886
+ ...C
845
887
  }
846
888
  ),
847
- o === "password" && /* @__PURE__ */ e(
889
+ s === "password" && /* @__PURE__ */ e(
848
890
  "button",
849
891
  {
850
892
  type: "button",
851
893
  tabIndex: -1,
852
- onClick: () => f((m) => !m),
894
+ onClick: () => y((m) => !m),
853
895
  className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
854
896
  children: /* @__PURE__ */ e(
855
- De,
897
+ le,
856
898
  {
857
- icon: y ? "mdi:eye-off-outline" : "mdi:eye-outline",
899
+ icon: b ? "mdi:eye-outline" : "mdi:eye-off-outline",
858
900
  className: "w-5 h-5"
859
901
  }
860
902
  )
861
903
  }
862
904
  )
863
905
  ] })
864
- ] }, N.name) });
906
+ ] }, C.name) });
865
907
  }
866
908
  );
867
909
  Be.displayName = "Input";
868
- const aa = ({
869
- key: s,
870
- editorKey: d = "",
871
- value: n = "",
910
+ const ra = ({
911
+ key: h,
912
+ editorKey: n = "",
913
+ value: o = "",
872
914
  onChange: i,
873
- label: o = "",
874
- required: r = !1,
875
- placeholder: l = "",
876
- parentClass: N = "col-span-12",
877
- height: M = 400,
878
- inline: y = !1,
879
- disabled: f = !1,
880
- plugins: c,
881
- toolbar: g,
915
+ label: s = "",
916
+ required: l = !1,
917
+ placeholder: r = "",
918
+ parentClass: C = "col-span-12",
919
+ height: L = 400,
920
+ inline: b = !1,
921
+ disabled: y = !1,
922
+ plugins: d,
923
+ toolbar: p,
882
924
  menubar: m = !1,
883
925
  fontFamily: u = "Inter, sans-serif",
884
- initConfig: k = {},
885
- imageUploadHandler: w
926
+ initConfig: x = {},
927
+ imageUploadHandler: v
886
928
  // ✅ Promise function passed from parent
887
- }) => /* @__PURE__ */ h("div", { className: N, children: [
888
- o && /* @__PURE__ */ e(W, { label: o, required: r }),
929
+ }) => /* @__PURE__ */ c("div", { className: C, children: [
930
+ s && /* @__PURE__ */ e(q, { label: s, required: l }),
889
931
  /* @__PURE__ */ e(
890
932
  qe,
891
933
  {
892
- apiKey: d,
893
- value: n,
894
- disabled: f,
934
+ apiKey: n,
935
+ value: o,
936
+ disabled: y,
895
937
  init: {
896
- height: M,
897
- inline: y,
938
+ height: L,
939
+ inline: b,
898
940
  menubar: m,
899
941
  branding: !1,
900
942
  statusbar: !0,
901
943
  automatic_uploads: !0,
902
- images_upload_handler: (G) => new Promise((K, j) => {
903
- if (!w) {
904
- K(`data:${G.blob().type};base64,${G.base64()}`);
944
+ images_upload_handler: (M) => new Promise((G, j) => {
945
+ if (!v) {
946
+ G(`data:${M.blob().type};base64,${M.base64()}`);
905
947
  return;
906
948
  }
907
- w(G).then((O) => {
908
- O ? K(O) : j("Upload failed: No URL returned");
909
- }).catch((O) => {
949
+ v(M).then((f) => {
950
+ f ? G(f) : j("Upload failed: No URL returned");
951
+ }).catch((f) => {
910
952
  j(
911
- typeof O == "string" ? O : (O == null ? void 0 : O.message) || "Image upload failed"
953
+ typeof f == "string" ? f : (f == null ? void 0 : f.message) || "Image upload failed"
912
954
  );
913
955
  });
914
956
  }),
915
- plugins: c ?? [
957
+ plugins: d ?? [
916
958
  "advlist",
917
959
  "autolink",
918
960
  "lists",
@@ -931,241 +973,369 @@ const aa = ({
931
973
  "help",
932
974
  "wordcount"
933
975
  ],
934
- toolbar: g ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
935
- placeholder: l,
976
+ toolbar: p ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
977
+ placeholder: r,
936
978
  content_style: `
937
979
  body {
938
980
  font-family: ${u};
939
981
  }
940
982
  `,
941
- ...k
983
+ ...x
942
984
  },
943
- onEditorChange: (G) => {
944
- i && i(G);
985
+ onEditorChange: (M) => {
986
+ i && i(M);
945
987
  }
946
988
  }
947
989
  )
948
- ] }, s), ra = ({
949
- name: s = "",
950
- label: d = "",
990
+ ] }, h), ta = ({
991
+ name: h = "",
992
+ label: n = "",
951
993
  // label for single checkbox
952
- options: n = [],
994
+ options: o = [],
953
995
  // array of { label, value } for multiple
954
996
  value: i = null,
955
997
  // boolean for single, array for multiple, or string for single select
956
- onChange: o,
957
- disabled: r = !1,
958
- required: l = !1,
959
- parentClass: N = "col-span-12",
960
- className: M = "",
961
- multiSelect: y = !1
998
+ onChange: s,
999
+ disabled: l = !1,
1000
+ required: r = !1,
1001
+ parentClass: C = "col-span-12",
1002
+ className: L = "",
1003
+ multiSelect: b = !1
962
1004
  // ✅ if true, only one option can be selected (like radio)
963
1005
  }) => {
964
- const f = Array.isArray(n) && n.length > 0, c = (u) => f ? y ? Array.isArray(i) && i.includes(u) : i === u : !!i, g = (u) => {
965
- o == null || o(u.target.checked, s);
966
- }, m = (u, k) => {
967
- if (o)
968
- if (!y)
969
- o(k ? u : "", s);
1006
+ const y = Array.isArray(o) && o.length > 0, d = (u) => y ? b ? Array.isArray(i) && i.includes(u) : i === u : !!i, p = (u) => {
1007
+ s == null || s(u.target.checked, h);
1008
+ }, m = (u, x) => {
1009
+ if (s)
1010
+ if (!b)
1011
+ s(x ? u : "", h);
970
1012
  else {
971
- const w = Array.isArray(i) ? [...i] : [];
972
- if (k)
973
- w.includes(u) || w.push(u);
1013
+ const v = Array.isArray(i) ? [...i] : [];
1014
+ if (x)
1015
+ v.includes(u) || v.push(u);
974
1016
  else {
975
- const C = w.indexOf(u);
976
- C > -1 && w.splice(C, 1);
1017
+ const S = v.indexOf(u);
1018
+ S > -1 && v.splice(S, 1);
977
1019
  }
978
- o(w, s);
1020
+ s(v, h);
979
1021
  }
980
1022
  };
981
- return f ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: `${N}`, children: [
982
- /* @__PURE__ */ e(W, { label: d, required: l }),
983
- /* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: n.map((u, k) => /* @__PURE__ */ h("div", { className: "flex items-center", children: [
1023
+ return y ? /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: `${C}`, children: [
1024
+ /* @__PURE__ */ e(q, { label: n, required: r }),
1025
+ /* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: o.map((u, x) => /* @__PURE__ */ c("div", { className: "flex items-center", children: [
984
1026
  /* @__PURE__ */ e(
985
1027
  "input",
986
1028
  {
987
1029
  type: "checkbox",
988
- name: s,
1030
+ name: h,
989
1031
  value: u.value,
990
- checked: c(u.value),
991
- disabled: r || u.disabled,
992
- required: l && k === 0,
993
- onChange: (w) => m(u.value, w.target.checked),
994
- className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
1032
+ checked: d(u.value),
1033
+ disabled: l || u.disabled,
1034
+ required: r && x === 0,
1035
+ onChange: (v) => m(u.value, v.target.checked),
1036
+ className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${L}`
995
1037
  },
996
- s
1038
+ h
997
1039
  ),
998
1040
  u.label && /* @__PURE__ */ e(
999
1041
  "label",
1000
1042
  {
1001
- htmlFor: s,
1043
+ htmlFor: h,
1002
1044
  className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1003
1045
  children: u.label
1004
1046
  }
1005
1047
  )
1006
1048
  ] }, u.value || u.label)) })
1007
- ] }) }) : /* @__PURE__ */ h("div", { className: `flex items-center ${N}`, children: [
1049
+ ] }) }) : /* @__PURE__ */ c("div", { className: `flex items-center ${C}`, children: [
1008
1050
  /* @__PURE__ */ e(
1009
1051
  "input",
1010
1052
  {
1011
1053
  type: "checkbox",
1012
- name: s,
1013
- checked: c(),
1014
- disabled: r,
1015
- required: l,
1016
- onChange: g,
1017
- className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
1054
+ name: h,
1055
+ checked: d(),
1056
+ disabled: l,
1057
+ required: r,
1058
+ onChange: p,
1059
+ className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${L}`
1018
1060
  }
1019
1061
  ),
1020
- d && /* @__PURE__ */ e(
1062
+ n && /* @__PURE__ */ e(
1021
1063
  "label",
1022
1064
  {
1023
- htmlFor: s,
1065
+ htmlFor: h,
1024
1066
  className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1025
- children: d
1067
+ children: n
1026
1068
  }
1027
1069
  )
1028
1070
  ] });
1029
- }, Ee = ({ field: s, formData: d, handleChange: n }) => {
1071
+ }, la = ({
1072
+ label: h = "",
1073
+ value: n = null,
1074
+ onChange: o,
1075
+ required: i = !1,
1076
+ accept: s = "audio/*",
1077
+ id: l,
1078
+ dragDrop: r = !1,
1079
+ name: C = "",
1080
+ parentClass: L = "",
1081
+ buttonComponent: b = null,
1082
+ buttonProps: y = {}
1083
+ }) => {
1084
+ const [d, p] = R(null), [m, u] = R(!1), x = X(null);
1085
+ H(() => {
1086
+ if (!n) {
1087
+ v(), p(null);
1088
+ return;
1089
+ }
1090
+ if (n instanceof File) {
1091
+ const f = URL.createObjectURL(n);
1092
+ return p({ file: n, preview: f }), () => {
1093
+ URL.revokeObjectURL(f);
1094
+ };
1095
+ } else typeof n == "string" ? p({ preview: n }) : n != null && n.preview && p(n);
1096
+ }, [n]);
1097
+ const v = () => {
1098
+ d != null && d.preview && d.preview.startsWith("blob:") && URL.revokeObjectURL(d.preview);
1099
+ }, S = (f) => {
1100
+ if (!f || f.length === 0)
1101
+ return;
1102
+ const k = f[0], O = URL.createObjectURL(k);
1103
+ v(), p({ file: k, preview: O }), o == null || o(k);
1104
+ }, E = (f) => {
1105
+ f && f.stopPropagation(), v(), p(null), o == null || o(null), x.current && (x.current.value = "");
1106
+ }, T = (f) => {
1107
+ r && (f.preventDefault(), u(!0));
1108
+ }, M = (f) => {
1109
+ r && (f.preventDefault(), u(!1));
1110
+ }, G = (f) => {
1111
+ r && (f.preventDefault(), u(!1), S(f.dataTransfer.files));
1112
+ }, j = () => {
1113
+ x.current.click();
1114
+ };
1115
+ return /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
1116
+ /* @__PURE__ */ e(q, { label: h, required: i }),
1117
+ /* @__PURE__ */ c(
1118
+ "div",
1119
+ {
1120
+ className: `relative rounded-lg p-2 transition-all ${m ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
1121
+ onDragOver: T,
1122
+ onDragLeave: M,
1123
+ onDrop: G,
1124
+ children: [
1125
+ /* @__PURE__ */ e(
1126
+ "input",
1127
+ {
1128
+ ref: x,
1129
+ id: l,
1130
+ type: "file",
1131
+ accept: s,
1132
+ onChange: (f) => S(f.target.files),
1133
+ required: i && !d,
1134
+ className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
1135
+ }
1136
+ ),
1137
+ /* @__PURE__ */ e(
1138
+ "div",
1139
+ {
1140
+ className: `flex items-center space-x-4 transition-all ${m ? "opacity-50" : ""}`,
1141
+ children: d ? (
1142
+ // Audio player with close button and change button
1143
+ /* @__PURE__ */ c("div", { className: "flex items-center space-x-4", children: [
1144
+ /* @__PURE__ */ c("div", { className: "relative w-full", children: [
1145
+ !i && /* @__PURE__ */ e(
1146
+ "button",
1147
+ {
1148
+ type: "button",
1149
+ onClick: E,
1150
+ className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",
1151
+ "aria-label": "Remove audio",
1152
+ children: /* @__PURE__ */ e(le, { icon: "mdi:close", className: "w-3 h-3" })
1153
+ }
1154
+ ),
1155
+ /* @__PURE__ */ e("audio", { src: d.preview, controls: !0 }, d.preview)
1156
+ ] }),
1157
+ /* @__PURE__ */ e(Q, { type: "button", onClick: j, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
1158
+ ] })
1159
+ ) : (
1160
+ // Empty state with upload button
1161
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-center space-x-4", children: [
1162
+ /* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(le, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
1163
+ /* @__PURE__ */ e(
1164
+ Q,
1165
+ {
1166
+ type: "button",
1167
+ onClick: j,
1168
+ variant: "outlined",
1169
+ children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
1170
+ }
1171
+ ),
1172
+ r && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
1173
+ ] })
1174
+ )
1175
+ }
1176
+ ),
1177
+ r && m && !d && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
1178
+ ]
1179
+ }
1180
+ )
1181
+ ] }, C);
1182
+ }, Ee = ({ field: h, formData: n, handleChange: o }) => {
1030
1183
  const {
1031
1184
  key: i,
1032
- label: o,
1033
- type: r,
1034
- options: l,
1035
- placeholder: N,
1036
- rows: M,
1037
- inputClass: y,
1038
- search: f,
1039
- accept: c,
1040
- text: g,
1185
+ label: s,
1186
+ type: l,
1187
+ options: r,
1188
+ placeholder: C,
1189
+ rows: L,
1190
+ inputClass: b,
1191
+ search: y,
1192
+ accept: d,
1193
+ text: p,
1041
1194
  required: m = !1,
1042
1195
  minLength: u,
1043
- dragDrop: k,
1044
- parentClass: w,
1045
- countriesList: C,
1046
- defaultCountry: D,
1047
- multiple: A,
1048
- dropdownMaxHeight: G,
1049
- editorKey: K,
1196
+ dragDrop: x,
1197
+ parentClass: v,
1198
+ countriesList: S,
1199
+ defaultCountry: E,
1200
+ multiple: T,
1201
+ dropdownMaxHeight: M,
1202
+ editorKey: G,
1050
1203
  fontFamily: j,
1051
- disabled: O,
1052
- negativeNumberAllow: v
1053
- } = s;
1054
- let L = d == null ? void 0 : d[i];
1055
- L == null && (L = "");
1056
- const T = N || (r === "select" ? `Select ${o}` : `Enter ${o}`), B = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
1057
- switch (r) {
1204
+ disabled: f,
1205
+ negativeNumberAllow: k,
1206
+ defaultValue: O
1207
+ } = h;
1208
+ let D = n == null ? void 0 : n[i];
1209
+ D == null && (D = "");
1210
+ const F = C || (l === "select" ? `Select ${s}` : `Enter ${s}`), U = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
1211
+ switch (l) {
1058
1212
  case "select":
1059
1213
  return /* @__PURE__ */ e(
1060
- Je,
1214
+ Qe,
1061
1215
  {
1062
- options: l || [],
1063
- value: L,
1064
- onChange: (b) => n(i, b),
1065
- placeholder: T,
1066
- className: y || "",
1067
- search: f,
1216
+ options: r || [],
1217
+ value: D,
1218
+ onChange: (A) => o(i, A),
1219
+ placeholder: F,
1220
+ className: b || "",
1221
+ search: y,
1068
1222
  required: m,
1069
- label: o,
1223
+ defaultValue: O,
1224
+ label: s,
1070
1225
  name: i,
1071
- disabled: O,
1072
- parentClass: w,
1073
- multiple: A,
1074
- dropdownMaxHeight: G
1226
+ disabled: f,
1227
+ parentClass: v,
1228
+ multiple: T,
1229
+ dropdownMaxHeight: M
1075
1230
  }
1076
1231
  );
1077
1232
  case "checkbox":
1078
1233
  return /* @__PURE__ */ e(
1079
- ra,
1234
+ ta,
1080
1235
  {
1081
1236
  name: i,
1082
- label: o,
1083
- options: l || [],
1084
- value: L,
1085
- onChange: (b) => n(i, b),
1237
+ label: s,
1238
+ options: r || [],
1239
+ value: D,
1240
+ onChange: (A) => o(i, A),
1086
1241
  required: m,
1087
- parentClass: w,
1088
- className: y || "",
1089
- multiSelect: A,
1090
- disabled: O
1242
+ parentClass: v,
1243
+ className: b || "",
1244
+ multiSelect: T,
1245
+ disabled: f
1091
1246
  }
1092
1247
  );
1093
1248
  case "switch":
1094
1249
  return /* @__PURE__ */ e(
1095
- Qe,
1250
+ Xe,
1096
1251
  {
1097
- value: L,
1098
- onChange: (b) => n(i, b),
1099
- text: g,
1100
- options: l || [],
1101
- label: o,
1252
+ value: D,
1253
+ onChange: (A) => o(i, A),
1254
+ text: p,
1255
+ options: r || [],
1256
+ label: s,
1102
1257
  required: m,
1103
1258
  name: i,
1104
- disabled: O,
1105
- parentClass: w
1259
+ disabled: f,
1260
+ parentClass: v
1106
1261
  }
1107
1262
  );
1108
1263
  case "phone":
1109
1264
  return /* @__PURE__ */ e(
1110
- Xe,
1265
+ ea,
1111
1266
  {
1112
- value: L,
1113
- onChange: (b) => n(i, b),
1114
- countriesList: C,
1115
- defaultCountry: D,
1267
+ value: D,
1268
+ onChange: (A) => o(i, A),
1269
+ countriesList: S,
1270
+ defaultCountry: E,
1116
1271
  required: m,
1117
- placeholder: T,
1118
- search: f,
1119
- label: o,
1272
+ placeholder: F,
1273
+ search: y,
1274
+ label: s,
1120
1275
  name: i,
1121
- disabled: O,
1122
- parentClass: w
1276
+ disabled: f,
1277
+ parentClass: v
1123
1278
  }
1124
1279
  );
1125
1280
  case "textarea":
1126
1281
  return /* @__PURE__ */ e(
1127
1282
  Fe,
1128
1283
  {
1129
- value: L,
1130
- onChange: (b) => n(i, b.target.value),
1131
- placeholder: T,
1132
- rows: M || 3,
1133
- className: `${B} ${y || ""}`,
1284
+ value: D,
1285
+ onChange: (A) => o(i, A.target.value),
1286
+ placeholder: F,
1287
+ rows: L || 3,
1288
+ className: `${U} ${b || ""}`,
1134
1289
  required: m,
1135
1290
  name: i,
1136
- label: o,
1137
- disabled: O,
1138
- parentClass: w
1291
+ label: s,
1292
+ disabled: f,
1293
+ parentClass: v
1139
1294
  }
1140
1295
  );
1141
1296
  case "image":
1142
1297
  return /* @__PURE__ */ e(
1143
- ea,
1298
+ aa,
1144
1299
  {
1145
- value: L,
1146
- onChange: (b) => n(i, b),
1300
+ value: D,
1301
+ onChange: (A) => o(i, A),
1147
1302
  required: m,
1148
- accept: c || "image/*",
1303
+ accept: d || "image/*",
1149
1304
  id: `file-${i}`,
1150
- dragDrop: k,
1151
- label: o,
1305
+ dragDrop: x,
1306
+ label: s,
1152
1307
  name: i,
1153
- parentClass: w
1308
+ parentClass: v
1309
+ }
1310
+ );
1311
+ case "audio":
1312
+ return /* @__PURE__ */ e(
1313
+ la,
1314
+ {
1315
+ value: D,
1316
+ onChange: (A) => o(i, A),
1317
+ required: m,
1318
+ accept: d || "audio/*",
1319
+ id: `file-${i}`,
1320
+ dragDrop: x,
1321
+ label: s,
1322
+ name: i,
1323
+ parentClass: v
1154
1324
  }
1155
1325
  );
1156
1326
  case "tinyEditor":
1157
1327
  return /* @__PURE__ */ e(
1158
- aa,
1328
+ ra,
1159
1329
  {
1160
- value: L,
1161
- onChange: (b) => n(i, b),
1330
+ value: D,
1331
+ onChange: (A) => o(i, A),
1162
1332
  required: m,
1163
- placeholder: T,
1164
- label: o,
1165
- parentClass: w,
1333
+ placeholder: F,
1334
+ label: s,
1335
+ parentClass: v,
1166
1336
  fontFamily: j,
1167
- editorKey: K,
1168
- disabled: O
1337
+ editorKey: G,
1338
+ disabled: f
1169
1339
  },
1170
1340
  `editor-${i}`
1171
1341
  );
@@ -1173,71 +1343,71 @@ const aa = ({
1173
1343
  return /* @__PURE__ */ e(
1174
1344
  Be,
1175
1345
  {
1176
- type: r || "text",
1177
- value: L,
1178
- onChange: (b) => n(i, b.target.value),
1179
- placeholder: T,
1180
- className: `${B} ${y || ""}`,
1346
+ type: l || "text",
1347
+ value: D,
1348
+ onChange: (A) => o(i, A.target.value),
1349
+ placeholder: F,
1350
+ className: `${U} ${b || ""}`,
1181
1351
  required: m,
1182
1352
  name: i,
1183
1353
  minLength: u,
1184
- label: o,
1185
- negativeNumberAllow: v,
1186
- parentClass: w,
1187
- disabled: O
1354
+ label: s,
1355
+ negativeNumberAllow: k,
1356
+ parentClass: v,
1357
+ disabled: f
1188
1358
  }
1189
1359
  );
1190
1360
  }
1191
- }, ta = ({ isOpen: s, onClose: d, config: n, onApply: i }) => {
1192
- var y;
1193
- const [o, r] = S({}), l = (f, c) => {
1194
- r((g) => ({ ...g, [f]: c }));
1195
- }, N = () => {
1196
- i == null || i(o), d();
1197
- }, M = () => {
1198
- r({}), i == null || i({}), d();
1361
+ }, na = ({ isOpen: h, onClose: n, config: o, onApply: i }) => {
1362
+ var b;
1363
+ const [s, l] = R({}), r = (y, d) => {
1364
+ l((p) => ({ ...p, [y]: d }));
1365
+ }, C = () => {
1366
+ i == null || i(s), n();
1367
+ }, L = () => {
1368
+ l({}), i == null || i({}), n();
1199
1369
  };
1200
- return /* @__PURE__ */ h(E, { children: [
1370
+ return /* @__PURE__ */ c($, { children: [
1201
1371
  /* @__PURE__ */ e(
1202
1372
  "div",
1203
1373
  {
1204
- className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${s ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
1205
- onClick: d
1374
+ className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${h ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
1375
+ onClick: n
1206
1376
  }
1207
1377
  ),
1208
- /* @__PURE__ */ h(
1378
+ /* @__PURE__ */ c(
1209
1379
  "div",
1210
1380
  {
1211
1381
  className: `fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
1212
1382
  transform transition-transform duration-300 ease-in-out
1213
- ${s ? "translate-x-0" : "translate-x-full"}
1383
+ ${h ? "translate-x-0" : "translate-x-full"}
1214
1384
  `,
1215
1385
  children: [
1216
- /* @__PURE__ */ h("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
1386
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
1217
1387
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Filters" }),
1218
1388
  /* @__PURE__ */ e(
1219
1389
  "button",
1220
1390
  {
1221
- onClick: d,
1391
+ onClick: n,
1222
1392
  className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
1223
- children: /* @__PURE__ */ e(fe, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1393
+ children: /* @__PURE__ */ e(ye, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1224
1394
  }
1225
1395
  )
1226
1396
  ] }),
1227
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: n != null && n.component ? /* @__PURE__ */ e(n.component, { filters: o, onFilterChange: l }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (y = n == null ? void 0 : n.fields) == null ? void 0 : y.map((f) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
1397
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: o != null && o.component ? /* @__PURE__ */ e(o.component, { filters: s, onFilterChange: r }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (b = o == null ? void 0 : o.fields) == null ? void 0 : b.map((y) => /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
1228
1398
  Ee,
1229
1399
  {
1230
- field: f,
1231
- formData: o,
1232
- handleChange: l
1400
+ field: y,
1401
+ formData: s,
1402
+ handleChange: r
1233
1403
  },
1234
- f.key
1404
+ y.key
1235
1405
  ) })) }) }),
1236
- /* @__PURE__ */ h("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
1406
+ /* @__PURE__ */ c("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
1237
1407
  /* @__PURE__ */ e(
1238
- ae,
1408
+ Q,
1239
1409
  {
1240
- onClick: N,
1410
+ onClick: C,
1241
1411
  variant: "contained",
1242
1412
  color: "primary",
1243
1413
  fullWidth: !0,
@@ -1245,9 +1415,9 @@ const aa = ({
1245
1415
  }
1246
1416
  ),
1247
1417
  /* @__PURE__ */ e(
1248
- ae,
1418
+ Q,
1249
1419
  {
1250
- onClick: M,
1420
+ onClick: L,
1251
1421
  variant: "contained",
1252
1422
  className: "min-w-[150px]",
1253
1423
  children: "Reset"
@@ -1258,7 +1428,7 @@ const aa = ({
1258
1428
  }
1259
1429
  )
1260
1430
  ] });
1261
- }, Le = {
1431
+ }, De = {
1262
1432
  blue: {
1263
1433
  bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
1264
1434
  border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
@@ -1287,76 +1457,76 @@ const aa = ({
1287
1457
  bg: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",
1288
1458
  border: "border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"
1289
1459
  }
1290
- }, Te = {
1460
+ }, Ae = {
1291
1461
  contained: "bg",
1292
1462
  outline: "border !bg-transparent",
1293
1463
  soft: "bg opacity-90"
1294
- }, Ge = ({
1295
- label: s,
1296
- variant: d = "contained",
1464
+ }, $e = ({
1465
+ label: h,
1466
+ variant: n = "contained",
1297
1467
  // contained | outline | soft
1298
- color: n = "green",
1468
+ color: o = "green",
1299
1469
  className: i = ""
1300
1470
  }) => {
1301
- const o = Le[n] || Le.green, r = Te[d] || Te.contained, l = d === "outline" ? o.border : o.bg;
1471
+ const s = De[o] || De.green, l = Ae[n] || Ae.contained, r = n === "outline" ? s.border : s.bg;
1302
1472
  return /* @__PURE__ */ e(
1303
1473
  "span",
1304
1474
  {
1305
1475
  className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
1306
- ${l}
1307
1476
  ${r}
1477
+ ${l}
1308
1478
  ${i}`,
1309
- children: s
1479
+ children: h
1310
1480
  }
1311
1481
  );
1312
- }, la = ({ rows: s = 5, columns: d = 5 }) => /* @__PURE__ */ h(E, { children: [
1482
+ }, oa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ c($, { children: [
1313
1483
  /* @__PURE__ */ e("div", { className: "w-full mb-6 inline-flex justify-end items-center", children: /* @__PURE__ */ e("div", { className: "h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }),
1314
- /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ h("table", { className: "w-full border-collapse", children: [
1315
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: d }).map((n, i) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, i)) }) }),
1316
- /* @__PURE__ */ e("tbody", { children: Array.from({ length: s }).map((n, i) => /* @__PURE__ */ e(
1484
+ /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ c("table", { className: "w-full border-collapse", children: [
1485
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: n }).map((o, i) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, i)) }) }),
1486
+ /* @__PURE__ */ e("tbody", { children: Array.from({ length: h }).map((o, i) => /* @__PURE__ */ e(
1317
1487
  "tr",
1318
1488
  {
1319
1489
  className: "border-t border-gray-200 dark:border-gray-800",
1320
- children: Array.from({ length: d }).map((o, r) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, r))
1490
+ children: Array.from({ length: n }).map((s, l) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, l))
1321
1491
  },
1322
1492
  i
1323
1493
  )) })
1324
1494
  ] }) })
1325
- ] }), $e = ({ src: s, alt: d = "preview", isOpen: n, setIsOpen: i }) => {
1326
- const o = () => i(!1);
1327
- return z(() => {
1328
- const r = (l) => {
1329
- l.key === "Escape" && o();
1495
+ ] }), Ge = ({ src: h, alt: n = "preview", isOpen: o, setIsOpen: i }) => {
1496
+ const s = () => i(!1);
1497
+ return H(() => {
1498
+ const l = (r) => {
1499
+ r.key === "Escape" && s();
1330
1500
  };
1331
- return n && (document.body.style.overflow = "hidden", document.addEventListener("keydown", r)), () => {
1332
- document.body.style.overflow = "", document.removeEventListener("keydown", r);
1501
+ return o && (document.body.style.overflow = "hidden", document.addEventListener("keydown", l)), () => {
1502
+ document.body.style.overflow = "", document.removeEventListener("keydown", l);
1333
1503
  };
1334
- }, [n]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h(
1504
+ }, [o]), /* @__PURE__ */ e($, { children: /* @__PURE__ */ c(
1335
1505
  "div",
1336
1506
  {
1337
1507
  className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
1338
1508
  backdrop-blur-sm animate-in fade-in duration-200`,
1339
- onClick: o,
1509
+ onClick: s,
1340
1510
  children: [
1341
1511
  /* @__PURE__ */ e(
1342
1512
  "button",
1343
1513
  {
1344
- onClick: o,
1514
+ onClick: s,
1345
1515
  className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
1346
1516
  hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
1347
- children: /* @__PURE__ */ e(fe, { size: 20 })
1517
+ children: /* @__PURE__ */ e(ye, { size: 20 })
1348
1518
  }
1349
1519
  ),
1350
1520
  /* @__PURE__ */ e(
1351
1521
  "div",
1352
1522
  {
1353
1523
  className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
1354
- onClick: (r) => r.stopPropagation(),
1524
+ onClick: (l) => l.stopPropagation(),
1355
1525
  children: /* @__PURE__ */ e(
1356
1526
  "img",
1357
1527
  {
1358
- src: s,
1359
- alt: d,
1528
+ src: h,
1529
+ alt: n,
1360
1530
  className: "w-full max-h-[90vh] object-contain rounded-xl"
1361
1531
  }
1362
1532
  )
@@ -1365,166 +1535,183 @@ const aa = ({
1365
1535
  ]
1366
1536
  }
1367
1537
  ) });
1368
- }, na = ({ config: s }) => {
1538
+ }, ia = ({ config: h }) => {
1369
1539
  const {
1370
- data: d = [],
1371
- table_head: n = [],
1540
+ data: n = [],
1541
+ table_head: o = [],
1372
1542
  loading: i = !1,
1373
- search: o = {
1543
+ search: s = {
1374
1544
  enabled: !1,
1375
1545
  placeholder: "Search...",
1376
1546
  useServerSideSearch: !1
1377
1547
  },
1378
- filter: r = {
1548
+ filter: l = {
1379
1549
  enabled: !1,
1380
1550
  useServerSideFilters: !1
1381
1551
  },
1382
- pagination: l = {
1552
+ pagination: r = {
1383
1553
  enabled: !1,
1384
1554
  rows_per_page: 10,
1385
1555
  useServerSidePagination: !1
1386
1556
  },
1387
- emptyMessage: N = "No data available",
1388
- onMenuAction: M,
1389
- setServerSidePaginationData: y = () => {
1557
+ emptyMessage: C = "No data available",
1558
+ onMenuAction: L,
1559
+ setServerSidePaginationData: b = () => {
1390
1560
  },
1391
- onFilterApply: f,
1392
- filterConfig: c = null
1393
- } = s, [g, m] = S(""), [u, k] = S(null), [w, C] = S([]), [D, A] = S({}), [G, K] = S(!1), [j, O] = S(null), [v, L] = S(!1), T = Se(() => !o.enabled || !g.trim() || o.useServerSideSearch ? d : Ze(d, g, o.searchKeys || []), [d, g, o]), [B, b] = S(1), [I, H] = S((l == null ? void 0 : l.rows_per_page) || 50), [V, J] = S(T.length || 0), re = l != null && l.useServerSidePagination ? l.total_pages : Math.ceil(T.length / I), ie = Se(() => {
1394
- if (l.useServerSidePagination) return T;
1395
- const t = (B - 1) * I;
1396
- return T.slice(t, t + I);
1397
- }, [T, B, I]), te = X(null), de = X({}), le = X(null), ee = (t) => {
1398
- m(t), b(1), o.useServerSideSearch && (le.current && clearTimeout(le.current), le.current = setTimeout(async () => {
1561
+ onFilterApply: y,
1562
+ filterConfig: d = null
1563
+ } = h, [p, m] = R(""), [u, x] = R(null), [v, S] = R([]), [E, T] = R({}), [M, G] = R(!1), [j, f] = R(null), [k, O] = R(!1), D = Me(() => !s.enabled || !p.trim() || s.useServerSideSearch ? n : Je(n, p, s.searchKeys || []), [n, p, s]), [F, U] = R(1), [A, N] = R((r == null ? void 0 : r.rows_per_page) || 50), [z, Z] = R(D.length || 0), W = r != null && r.useServerSidePagination ? r.total_pages : Math.ceil(D.length / A), re = Me(() => {
1564
+ if (r.useServerSidePagination) return D;
1565
+ const t = (F - 1) * A;
1566
+ return D.slice(t, t + A);
1567
+ }, [D, F, A]), ne = X(null), se = X({}), oe = X(null), te = (t) => {
1568
+ m(t), U(1), s.useServerSideSearch && (oe.current && clearTimeout(oe.current), oe.current = setTimeout(async () => {
1399
1569
  try {
1400
- await y((p) => ({
1401
- ...p,
1570
+ await b((g) => ({
1571
+ ...g,
1402
1572
  search: t,
1403
1573
  current_page: 1
1404
1574
  }));
1405
- } catch (p) {
1406
- console.error("Search error:", p);
1575
+ } catch (g) {
1576
+ console.error("Search error:", g);
1407
1577
  }
1408
1578
  }, 800));
1409
- }, ye = (t, p, P) => {
1410
- P.stopPropagation(), k(null), M == null || M(t.type, p);
1411
- }, xe = (t, p, P) => {
1412
- p.stopPropagation(), C(P);
1413
- const _ = p.currentTarget;
1414
- de.current[t] = _;
1415
- const $ = _.getBoundingClientRect(), q = 192, Y = P.length * 40, Q = window.innerWidth, oe = window.innerHeight, R = Q - $.right < q ? $.left - q + $.width : $.left, Z = oe - $.bottom < Y && $.top > Y ? $.top - Y - 2 : $.bottom + 2;
1416
- A({
1417
- top: Math.max(8, Math.min(Z, oe - Y - 8)),
1418
- left: Math.max(8, Math.min(R, Q - q - 8))
1419
- }), k(u === t ? null : t);
1420
- }, ve = (t) => (B - 1) * I + t + 1, se = (t) => {
1421
- O(t), L(!0);
1422
- }, ne = (t, p, P, _ = null) => /* @__PURE__ */ e(E, { children: t ? /* @__PURE__ */ e(
1579
+ }, xe = (t, g, I) => {
1580
+ I.stopPropagation(), x(null), L == null || L(t.type, g);
1581
+ }, ve = (t, g, I) => {
1582
+ g.stopPropagation(), S(I);
1583
+ const K = g.currentTarget;
1584
+ se.current[t] = K;
1585
+ const _ = K.getBoundingClientRect(), J = 192, V = I.length * 40, ee = window.innerWidth, w = window.innerHeight, B = ee - _.right < J ? _.left - J + _.width : _.left, Y = w - _.bottom < V && _.top > V ? _.top - V - 2 : _.bottom + 2;
1586
+ T({
1587
+ top: Math.max(8, Math.min(Y, w - V - 8)),
1588
+ left: Math.max(8, Math.min(B, ee - J - 8))
1589
+ }), x(u === t ? null : t);
1590
+ }, we = (t) => (F - 1) * A + t + 1, de = (t) => {
1591
+ f(t), O(!0);
1592
+ }, ie = (t, g, I, K = null) => /* @__PURE__ */ e($, { children: t ? /* @__PURE__ */ e(
1423
1593
  "img",
1424
1594
  {
1425
1595
  src: t,
1426
- alt: p || "Avatar",
1427
- onClick: ($) => {
1428
- $.stopPropagation(), $.preventDefault(), se({ src: t, alt: p });
1596
+ alt: g || "Avatar",
1597
+ onClick: (_) => {
1598
+ _.stopPropagation(), _.preventDefault(), de({ src: t, alt: g });
1429
1599
  },
1430
- className: `w-10 h-10 cursor-pointer rounded-full object-cover border border-gray-200 dark:border-gray-700 ${P || ""}`
1600
+ className: `w-10 h-10 cursor-pointer rounded-full object-cover border border-gray-200 dark:border-gray-700 ${I || ""}`
1431
1601
  }
1432
- ) : /* @__PURE__ */ e(E, { children: _ || /* @__PURE__ */ e(
1602
+ ) : /* @__PURE__ */ e($, { children: K || /* @__PURE__ */ e(
1433
1603
  "div",
1434
1604
  {
1435
- className: `w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${P || ""}`,
1436
- children: /* @__PURE__ */ e(Pe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1605
+ className: `w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${I || ""}`,
1606
+ children: /* @__PURE__ */ e(Te, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1437
1607
  }
1438
- ) }) }), ce = (t, p) => /* @__PURE__ */ h("div", { className: `flex items-center space-x-4 ${p.className || ""}`, children: [
1439
- p.imageKey ? ne(t[p.imageKey], t[p.titleKey], "group-avatar") : "",
1440
- /* @__PURE__ */ h("div", { children: [
1441
- /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: t[p.titleKey] || "" }),
1442
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: t[p.subtitleKey] || "" })
1608
+ ) }) }), ce = (t, g) => /* @__PURE__ */ e($, { children: t ? /* @__PURE__ */ e(
1609
+ "audio",
1610
+ {
1611
+ controls: !0,
1612
+ src: t,
1613
+ onClick: (I) => {
1614
+ I.stopPropagation();
1615
+ },
1616
+ className: `w-64 cursor-pointer ${g || ""}`
1617
+ },
1618
+ t
1619
+ ) : /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
1620
+ "div",
1621
+ {
1622
+ className: `w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${g || ""}`,
1623
+ children: /* @__PURE__ */ e(Ye, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1624
+ }
1625
+ ) }) }), he = (t, g) => /* @__PURE__ */ c("div", { className: `flex items-center space-x-4 ${g.className || ""}`, children: [
1626
+ g.imageKey ? ie(t[g.imageKey], t[g.titleKey], "group-avatar") : "",
1627
+ /* @__PURE__ */ c("div", { children: [
1628
+ /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: t[g.titleKey] || "" }),
1629
+ /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: t[g.subtitleKey] || "" })
1443
1630
  ] })
1444
- ] }), he = (t, p) => {
1445
- var q;
1446
- let P = String(t);
1447
- const _ = p.variant || "contained";
1448
- let $ = p.defaultColor;
1449
- if (((q = p == null ? void 0 : p.chipOptions) == null ? void 0 : q.length) > 0) {
1450
- let Y = p == null ? void 0 : p.chipOptions.find((Q) => Q.value == t);
1451
- Y && (P = Y.label, $ = Y.color);
1631
+ ] }), ue = (t, g) => {
1632
+ var J;
1633
+ let I = String(t);
1634
+ const K = g.variant || "contained";
1635
+ let _ = g.defaultColor;
1636
+ if (((J = g == null ? void 0 : g.chipOptions) == null ? void 0 : J.length) > 0) {
1637
+ let V = g == null ? void 0 : g.chipOptions.find((ee) => ee.value == t);
1638
+ V && (I = V.label, _ = V.color);
1452
1639
  }
1453
1640
  return /* @__PURE__ */ e(
1454
- Ge,
1641
+ $e,
1455
1642
  {
1456
- label: P,
1457
- variant: _,
1458
- color: $,
1459
- className: p.className || ""
1643
+ label: I,
1644
+ variant: K,
1645
+ color: _,
1646
+ className: g.className || ""
1460
1647
  }
1461
1648
  );
1462
- }, ue = (t, p, P) => {
1463
- const _ = p[t.key];
1649
+ }, be = (t, g, I) => {
1650
+ const K = g[t.key];
1464
1651
  return t.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${t.className || ""}`, children: /* @__PURE__ */ e(
1465
1652
  "button",
1466
1653
  {
1467
- ref: ($) => de.current[p.id || p._id] = $,
1468
- onClick: ($) => xe(p.id || p._id, $, t.menuList),
1654
+ ref: (_) => se.current[g.id || g._id] = _,
1655
+ onClick: (_) => ve(g.id || g._id, _, t.menuList),
1469
1656
  className: "p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300",
1470
- children: /* @__PURE__ */ e(Ue, { className: "h-4 w-4" })
1657
+ children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
1471
1658
  }
1472
- ) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: ve(P) }) : t.type === "group" ? ce(p, t) : t.type === "chip" ? /* @__PURE__ */ e(E, { children: he(_, t) }) : t.type === "date" ? /* @__PURE__ */ e("span", { className: t.className || "", children: Oe(_, t.format || "DD MMM YYYY") }) : t.type === "avatar" ? /* @__PURE__ */ e(E, { children: ne(_, t.alt, t.className, t.fallback_icon) }) : /* @__PURE__ */ e("span", { className: t.className || "", children: _ || "N/A" });
1473
- }, be = (t, p) => {
1659
+ ) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: we(I) }) : t.type === "group" ? he(g, t) : t.type === "chip" ? /* @__PURE__ */ e($, { children: ue(K, t) }) : t.type === "date" ? /* @__PURE__ */ e("span", { className: t.className || "", children: Oe(K, t.format || "DD MMM YYYY") }) : t.type === "avatar" ? /* @__PURE__ */ e($, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ie(K, t.alt, t.className, t.fallback_icon) }) }) : t.type === "audio" ? /* @__PURE__ */ e($, { children: ce(K, t.className) }) : /* @__PURE__ */ e("span", { className: t.className || "", children: K || "N/A" });
1660
+ }, pe = (t, g) => {
1474
1661
  if (t.onClickDetails)
1475
- return M == null ? void 0 : M("view", p);
1662
+ return L == null ? void 0 : L("view", g);
1476
1663
  if (typeof t.handleClick == "function")
1477
- return t.handleClick(p);
1478
- }, pe = (t) => t.onClickDetails || typeof t.handleClick == "function";
1479
- return z(() => {
1664
+ return t.handleClick(g);
1665
+ }, ge = (t) => t.onClickDetails || typeof t.handleClick == "function";
1666
+ return H(() => {
1480
1667
  const t = () => {
1481
- u && k(null);
1668
+ u && x(null);
1482
1669
  };
1483
1670
  return window.addEventListener("scroll", t, !0), () => {
1484
1671
  window.removeEventListener("scroll", t, !0);
1485
1672
  };
1486
- }, [u]), z(() => {
1487
- const t = (p) => {
1488
- te.current && !te.current.contains(p.target) && k(null);
1673
+ }, [u]), H(() => {
1674
+ const t = (g) => {
1675
+ ne.current && !ne.current.contains(g.target) && x(null);
1489
1676
  };
1490
1677
  return document.addEventListener("click", t), () => document.removeEventListener("click", t);
1491
- }, []), z(() => {
1492
- l != null && l.rows_per_page && (l != null && l.useServerSidePagination) && H((l == null ? void 0 : l.rows_per_page) || 50), l.current_page && b(l.current_page);
1678
+ }, []), H(() => {
1679
+ r != null && r.rows_per_page && (r != null && r.useServerSidePagination) && N((r == null ? void 0 : r.rows_per_page) || 50), r.current_page && U(r.current_page);
1493
1680
  }, [
1494
- l.rows_per_page,
1495
- l == null ? void 0 : l.useServerSidePagination,
1496
- l.current_page
1497
- ]), z(() => {
1498
- J(
1499
- l != null && l.useServerSidePagination ? l.total_records : T.length
1500
- ), T.length <= I * (B - 1) && !(l != null && l.useServerSidePagination) && b((t) => t - 1 || 1);
1681
+ r.rows_per_page,
1682
+ r == null ? void 0 : r.useServerSidePagination,
1683
+ r.current_page
1684
+ ]), H(() => {
1685
+ Z(
1686
+ r != null && r.useServerSidePagination ? r.total_records : D.length
1687
+ ), D.length <= A * (F - 1) && !(r != null && r.useServerSidePagination) && U((t) => t - 1 || 1);
1501
1688
  }, [
1502
- T.length,
1503
- l.total_records,
1504
- l == null ? void 0 : l.useServerSidePagination
1505
- ]), i ? /* @__PURE__ */ e(la, { rows: 6, columns: 6 }) : /* @__PURE__ */ h(E, { children: [
1506
- /* @__PURE__ */ h("div", { className: "flex justify-end items-center mb-4 gap-2", children: [
1507
- o.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ h("div", { className: "relative min-w-[300px]", children: [
1508
- /* @__PURE__ */ e(Ce, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
1689
+ D.length,
1690
+ r.total_records,
1691
+ r == null ? void 0 : r.useServerSidePagination
1692
+ ]), i ? /* @__PURE__ */ e(oa, { rows: 6, columns: 6 }) : /* @__PURE__ */ c($, { children: [
1693
+ /* @__PURE__ */ c("div", { className: "flex justify-end items-center mb-4 gap-2", children: [
1694
+ s.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ c("div", { className: "relative min-w-[300px]", children: [
1695
+ /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
1509
1696
  /* @__PURE__ */ e(
1510
1697
  "input",
1511
1698
  {
1512
1699
  type: "text",
1513
- placeholder: o.placeholder || "Search...",
1514
- value: g,
1515
- onChange: (t) => ee(t.target.value),
1700
+ placeholder: s.placeholder || "Search...",
1701
+ value: p,
1702
+ onChange: (t) => te(t.target.value),
1516
1703
  className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
1517
1704
  }
1518
1705
  )
1519
1706
  ] }) }),
1520
- c && r.enabled && /* @__PURE__ */ h(ae, { onClick: () => K(!0), variant: "contained", children: [
1521
- /* @__PURE__ */ e(je, { className: "w-4 h-4 mr-2" }),
1707
+ d && l.enabled && /* @__PURE__ */ c(Q, { onClick: () => G(!0), variant: "contained", children: [
1708
+ /* @__PURE__ */ e(Ke, { className: "w-4 h-4 mr-2" }),
1522
1709
  "Filters"
1523
1710
  ] })
1524
1711
  ] }),
1525
- /* @__PURE__ */ h("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
1526
- /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ h("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
1527
- /* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: n.map((t) => /* @__PURE__ */ e(
1712
+ /* @__PURE__ */ c("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
1713
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ c("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
1714
+ /* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: o.map((t) => /* @__PURE__ */ e(
1528
1715
  "th",
1529
1716
  {
1530
1717
  className: `px-6 py-4 text-left text-xs font-medium text-black dark:text-white uppercase tracking-wider min-w-max max-w-[180px] truncate ${t.headClass || ""}`,
@@ -1532,56 +1719,56 @@ const aa = ({
1532
1719
  },
1533
1720
  t.key
1534
1721
  )) }) }),
1535
- /* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: ie.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
1722
+ /* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: re.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
1536
1723
  "td",
1537
1724
  {
1538
- colSpan: n.length,
1725
+ colSpan: o.length,
1539
1726
  className: "text-center py-10 text-gray-500 dark:text-gray-400",
1540
- children: N
1727
+ children: C
1541
1728
  }
1542
- ) }) : ie.map((t, p) => /* @__PURE__ */ e(
1729
+ ) }) : re.map((t, g) => /* @__PURE__ */ e(
1543
1730
  "tr",
1544
1731
  {
1545
1732
  className: "hover:bg-gray-50 dark:hover:bg-blue-800/10 transition",
1546
- children: n.map((P) => /* @__PURE__ */ e(
1733
+ children: o.map((I) => /* @__PURE__ */ e(
1547
1734
  "td",
1548
1735
  {
1549
- className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max max-w-[300px] truncate ${pe(P) ? "cursor-pointer" : ""}`,
1550
- title: String(t[P.key] ?? ""),
1551
- onClick: () => be(P, t),
1552
- children: P.render ? P.render(t, p) : ue(P, t, p)
1736
+ className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${I.type == "audio" ? "" : "max-w-[300px]"} truncate ${ge(I) ? "cursor-pointer" : ""}`,
1737
+ title: String(t[I.key] ?? ""),
1738
+ onClick: () => pe(I, t),
1739
+ children: I.render ? I.render(t, g) : be(I, t, g)
1553
1740
  },
1554
- P.key
1741
+ I.key
1555
1742
  ))
1556
1743
  },
1557
- t.id || t._id || p
1744
+ t.id || t._id || g
1558
1745
  )) })
1559
1746
  ] }) }),
1560
- (l == null ? void 0 : l.enabled) && T.length > 0 && /* @__PURE__ */ h("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
1561
- /* @__PURE__ */ h("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
1747
+ (r == null ? void 0 : r.enabled) && D.length > 0 && /* @__PURE__ */ c("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
1748
+ /* @__PURE__ */ c("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
1562
1749
  "Showing ",
1563
- (B - 1) * I + 1,
1750
+ (F - 1) * A + 1,
1564
1751
  " to",
1565
1752
  " ",
1566
- Math.min(B * I, V),
1753
+ Math.min(F * A, z),
1567
1754
  " of ",
1568
- V,
1755
+ z,
1569
1756
  " ",
1570
1757
  "results"
1571
1758
  ] }),
1572
- /* @__PURE__ */ h("div", { className: "flex items-center gap-4", children: [
1573
- /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
1759
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
1760
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1574
1761
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: "Rows per page:" }),
1575
1762
  /* @__PURE__ */ e(
1576
1763
  "select",
1577
1764
  {
1578
- value: I,
1765
+ value: A,
1579
1766
  onChange: (t) => {
1580
- const p = Number(t.target.value);
1581
- H(p), b(1), l.useServerSidePagination && y((P) => ({
1582
- ...P,
1767
+ const g = Number(t.target.value);
1768
+ N(g), U(1), r.useServerSidePagination && b((I) => ({
1769
+ ...I,
1583
1770
  current_page: 1,
1584
- rows_per_page: p
1771
+ rows_per_page: g
1585
1772
  }));
1586
1773
  },
1587
1774
  className: "border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-blue-500",
@@ -1589,72 +1776,72 @@ const aa = ({
1589
1776
  }
1590
1777
  )
1591
1778
  ] }),
1592
- /* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
1779
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1593
1780
  /* @__PURE__ */ e(
1594
1781
  "button",
1595
1782
  {
1596
1783
  onClick: () => {
1597
- if (B > 1) {
1598
- const t = B - 1;
1599
- b(t), l.useServerSidePagination && y((p) => ({
1600
- ...p,
1784
+ if (F > 1) {
1785
+ const t = F - 1;
1786
+ U(t), r.useServerSidePagination && b((g) => ({
1787
+ ...g,
1601
1788
  current_page: t
1602
1789
  }));
1603
1790
  }
1604
1791
  },
1605
- disabled: B === 1,
1792
+ disabled: F === 1,
1606
1793
  className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
1607
- children: /* @__PURE__ */ e(ze, { className: "h-4 w-4" })
1794
+ children: /* @__PURE__ */ e(Ue, { className: "h-4 w-4" })
1608
1795
  }
1609
1796
  ),
1610
- /* @__PURE__ */ h("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
1797
+ /* @__PURE__ */ c("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
1611
1798
  "Page ",
1612
- B,
1799
+ F,
1613
1800
  " of ",
1614
- re
1801
+ W
1615
1802
  ] }),
1616
1803
  /* @__PURE__ */ e(
1617
1804
  "button",
1618
1805
  {
1619
1806
  onClick: () => {
1620
- if (B < re) {
1621
- const t = B + 1;
1622
- b(t), l.useServerSidePagination && y((p) => ({
1623
- ...p,
1807
+ if (F < W) {
1808
+ const t = F + 1;
1809
+ U(t), r.useServerSidePagination && b((g) => ({
1810
+ ...g,
1624
1811
  current_page: t
1625
1812
  }));
1626
1813
  }
1627
1814
  },
1628
- disabled: B === re,
1815
+ disabled: F === W,
1629
1816
  className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
1630
- children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
1817
+ children: /* @__PURE__ */ e(ze, { className: "h-4 w-4" })
1631
1818
  }
1632
1819
  )
1633
1820
  ] })
1634
1821
  ] })
1635
1822
  ] })
1636
1823
  ] }),
1637
- u && Ve(
1824
+ u && We(
1638
1825
  /* @__PURE__ */ e(
1639
1826
  "div",
1640
1827
  {
1641
- ref: te,
1828
+ ref: ne,
1642
1829
  style: {
1643
1830
  position: "fixed",
1644
- top: `${D.top}px`,
1645
- left: `${D.left}px`,
1831
+ top: `${E.top}px`,
1832
+ left: `${E.left}px`,
1646
1833
  zIndex: 9999
1647
1834
  },
1648
1835
  className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
1649
- children: w.map((t, p) => /* @__PURE__ */ h(
1836
+ children: v.map((t, g) => /* @__PURE__ */ c(
1650
1837
  "button",
1651
1838
  {
1652
- onClick: (P) => ye(
1839
+ onClick: (I) => xe(
1653
1840
  t,
1654
- d.find(
1655
- (_) => _.id === u || _._id == u
1841
+ n.find(
1842
+ (K) => K.id === u || K._id == u
1656
1843
  ),
1657
- P
1844
+ I
1658
1845
  ),
1659
1846
  className: `w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${t.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
1660
1847
  children: [
@@ -1662,326 +1849,341 @@ const aa = ({
1662
1849
  t.title
1663
1850
  ]
1664
1851
  },
1665
- p
1852
+ g
1666
1853
  ))
1667
1854
  }
1668
1855
  ),
1669
1856
  document.body
1670
1857
  ),
1671
- c && /* @__PURE__ */ e(
1672
- ta,
1858
+ d && /* @__PURE__ */ e(
1859
+ na,
1673
1860
  {
1674
- isOpen: G,
1675
- onClose: () => K(!1),
1676
- config: c,
1677
- onApply: f
1861
+ isOpen: M,
1862
+ onClose: () => G(!1),
1863
+ config: d,
1864
+ onApply: y
1678
1865
  }
1679
1866
  ),
1680
- v && /* @__PURE__ */ e(
1681
- $e,
1867
+ k && /* @__PURE__ */ e(
1868
+ Ge,
1682
1869
  {
1683
1870
  src: j.src,
1684
1871
  alt: j.alt,
1685
- isOpen: v,
1686
- setIsOpen: L
1872
+ isOpen: k,
1873
+ setIsOpen: O
1687
1874
  }
1688
1875
  )
1689
1876
  ] });
1690
- }, me = ({
1691
- isOpen: s,
1692
- onClose: d,
1693
- icon: n,
1877
+ }, fe = ({
1878
+ isOpen: h,
1879
+ onClose: n,
1880
+ icon: o,
1694
1881
  title: i,
1695
- children: o,
1696
- size: r = "md",
1697
- actionButtons: l = [],
1698
- actions: N,
1699
- showDefaultClose: M = !0,
1700
- footerConfig: y = null,
1701
- hideFooter: f = !1,
1702
- onFormSubmit: c = () => {
1882
+ children: s,
1883
+ size: l = "md",
1884
+ actionButtons: r = [],
1885
+ actions: C,
1886
+ showDefaultClose: L = !0,
1887
+ footerConfig: b = null,
1888
+ hideFooter: y = !1,
1889
+ onFormSubmit: d = () => {
1703
1890
  },
1704
- onCancel: g,
1891
+ onCancel: p,
1705
1892
  loadingBtn: m = !1,
1706
1893
  executeFunction: u = () => {
1707
1894
  },
1708
- selectedItem: k = null
1895
+ selectedItem: x = null
1709
1896
  }) => {
1710
- if (!s) return null;
1711
- const w = {
1897
+ if (!h) return null;
1898
+ const v = {
1712
1899
  sm: "max-w-md",
1713
1900
  md: "max-w-lg",
1714
1901
  lg: "max-w-2xl",
1715
1902
  xl: "max-w-4xl",
1716
1903
  full: "max-w-full"
1717
1904
  };
1718
- return /* @__PURE__ */ h("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
1905
+ return /* @__PURE__ */ c("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
1719
1906
  /* @__PURE__ */ e(
1720
1907
  "div",
1721
1908
  {
1722
1909
  className: "fixed inset-0 bg-gray-500 opacity-75",
1723
- onClick: () => d()
1910
+ onClick: () => n()
1724
1911
  }
1725
1912
  ),
1726
- /* @__PURE__ */ h(
1913
+ /* @__PURE__ */ c(
1727
1914
  "div",
1728
1915
  {
1729
- className: `relative bg-white rounded-lg shadow-xl w-full ${w[r] || w.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
1916
+ className: `relative bg-white rounded-lg shadow-xl w-full ${v[l] || v.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
1730
1917
  children: [
1731
- /* @__PURE__ */ h("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
1732
- /* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
1733
- n && /* @__PURE__ */ e("span", { children: n }),
1918
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
1919
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
1920
+ o && /* @__PURE__ */ e("span", { children: o }),
1734
1921
  /* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: i })
1735
1922
  ] }),
1736
1923
  /* @__PURE__ */ e(
1737
1924
  "button",
1738
1925
  {
1739
- onClick: () => d(),
1926
+ onClick: () => n(),
1740
1927
  className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
1741
- children: /* @__PURE__ */ e(fe, { className: "w-6 h-6" })
1928
+ children: /* @__PURE__ */ e(ye, { className: "w-6 h-6" })
1742
1929
  }
1743
1930
  )
1744
1931
  ] }),
1745
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: o }),
1746
- l.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: l.map((C) => /* @__PURE__ */ e(
1747
- ae,
1932
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: s }),
1933
+ r.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: r.map((S) => /* @__PURE__ */ e(
1934
+ Q,
1748
1935
  {
1749
- onClick: (D) => {
1750
- C.type == "submit" ? c(D) : u(
1936
+ onClick: (E) => {
1937
+ S.type == "submit" ? d(E) : u(
1751
1938
  () => {
1752
- var A;
1753
- return (A = C == null ? void 0 : C.onClick) == null ? void 0 : A.call(C, D, k);
1939
+ var T;
1940
+ return (T = S == null ? void 0 : S.onClick) == null ? void 0 : T.call(S, E, x);
1754
1941
  },
1755
- (A) => d == null ? void 0 : d(A)
1942
+ (T) => n == null ? void 0 : n(T)
1756
1943
  );
1757
1944
  },
1758
- disabled: m || C.disabled,
1759
- variant: C.variant || "contained",
1760
- color: C.color || "primary",
1761
- className: `min-w-[100px] ${C.className}`,
1762
- type: C.type || "button",
1763
- children: m ? /* @__PURE__ */ h("div", { className: "flex items-center", children: [
1945
+ disabled: m || S.disabled,
1946
+ variant: S.variant || "contained",
1947
+ color: S.color || "primary",
1948
+ className: `min-w-[100px] ${S.className}`,
1949
+ type: S.type || "button",
1950
+ children: m ? /* @__PURE__ */ c("div", { className: "flex items-center", children: [
1764
1951
  /* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2" }),
1765
- C.label || "Submit",
1952
+ S.label || "Submit",
1766
1953
  "..."
1767
- ] }) : C.label || "Submit"
1954
+ ] }) : S.label || "Submit"
1768
1955
  }
1769
1956
  )) })
1770
1957
  ]
1771
1958
  }
1772
1959
  )
1773
1960
  ] });
1774
- }, Ae = ({ config: s, onSubmit: d, initialData: n = {} }) => {
1775
- var y;
1776
- const { formClass: i = "grid grid-cols-12 gap-4", formFields: o = [] } = s || {}, [r, l] = S(n);
1777
- z(() => {
1778
- l(n);
1961
+ }, Pe = ({ config: h, onSubmit: n, initialData: o = {}, type: i = "add" }) => {
1962
+ const { formClass: s = "grid grid-cols-12 gap-4", formFields: l = [] } = h || {}, [r, C] = R(o);
1963
+ H(() => {
1964
+ C(o);
1779
1965
  }, []);
1780
- const N = (f, c) => {
1781
- l((g) => ({ ...g, [f]: c }));
1782
- }, M = (f) => {
1783
- f.preventDefault();
1784
- const c = f.target;
1785
- if (!c.checkValidity()) {
1786
- c.reportValidity();
1966
+ const L = (y, d) => {
1967
+ C((p) => ({ ...p, [y]: d }));
1968
+ }, b = (y) => {
1969
+ y.preventDefault();
1970
+ const d = y.target;
1971
+ if (!d.checkValidity()) {
1972
+ d.reportValidity();
1787
1973
  return;
1788
1974
  }
1789
- d(r);
1975
+ n(r);
1790
1976
  };
1791
1977
  return /* @__PURE__ */ e(
1792
1978
  "form",
1793
1979
  {
1794
- id: (y = s.title) != null && y.toLowerCase().includes("edit") ? "editForm" : "addForm",
1795
- onSubmit: M,
1796
- className: i,
1980
+ id: i == "add" ? "addForm" : i == "edit" ? "editForm" : "defaultForm",
1981
+ onSubmit: b,
1982
+ className: s,
1797
1983
  noValidate: !1,
1798
- children: o.map((f) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
1984
+ children: l.map((y) => /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
1799
1985
  Ee,
1800
1986
  {
1801
- field: f,
1987
+ field: y,
1802
1988
  formData: r,
1803
- handleChange: N
1989
+ handleChange: L
1804
1990
  },
1805
- f.key
1991
+ y.key
1806
1992
  ) }))
1807
1993
  }
1808
1994
  );
1809
1995
  };
1810
- function oa({ data: s, config: d }) {
1811
- const { fields: n, containerClass: i } = d, [o, r] = S(null), [l, N] = S(!1), M = (c) => {
1812
- r(c), N(!0);
1813
- }, y = ({ col: c }) => {
1814
- let g = c == null ? void 0 : c.icon, m = c.label, u = s[c.key], k = c.type, w = c.variant || "outline", C = c.defaultColor;
1815
- if (k == "chip" && c.chipOptions.length > 0) {
1816
- let D = c == null ? void 0 : c.chipOptions.find((A) => A.value == u);
1817
- D && (u = D.label, C = D.color);
1996
+ function sa({ data: h, config: n }) {
1997
+ const { fields: o, containerClass: i } = n, [s, l] = R(null), [r, C] = R(!1), L = (d) => {
1998
+ l(d), C(!0);
1999
+ }, b = ({ col: d }) => {
2000
+ var E;
2001
+ let p = d == null ? void 0 : d.icon, m = d.label, u = h[d.key], x = d.type, v = d.variant || "outline", S = d.defaultColor;
2002
+ if (x === "chip" && ((E = d.chipOptions) == null ? void 0 : E.length) > 0) {
2003
+ let T = d == null ? void 0 : d.chipOptions.find((M) => M.value == u);
2004
+ T && (u = T.label, S = T.color);
1818
2005
  }
1819
- return /* @__PURE__ */ h(
2006
+ return /* @__PURE__ */ c(
1820
2007
  "div",
1821
2008
  {
1822
2009
  className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
1823
- bg-gray-100 dark:bg-gray-900 ${c.blockClass}`,
2010
+ bg-gray-100 dark:bg-gray-900 ${d.blockClass || ""}`,
1824
2011
  children: [
1825
- g && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g }),
1826
- /* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
2012
+ p && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p }),
2013
+ /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
1827
2014
  /* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: m }),
1828
- k == "chip" ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
1829
- Ge,
2015
+ x === "chip" ? /* @__PURE__ */ e(
2016
+ $e,
1830
2017
  {
1831
2018
  label: u,
1832
- variant: w,
1833
- color: C,
2019
+ variant: v,
2020
+ color: S,
1834
2021
  className: "mt-1"
1835
2022
  }
1836
- ) }) : k == "tinyEditor" ? /* @__PURE__ */ e(
1837
- "p",
1838
- {
1839
- className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
1840
- dangerouslySetInnerHTML: {
1841
- __html: u
2023
+ ) : (
2024
+ /* TINY EDITOR */
2025
+ x === "tinyEditor" ? /* @__PURE__ */ e(
2026
+ "p",
2027
+ {
2028
+ className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
2029
+ dangerouslySetInnerHTML: {
2030
+ __html: u
2031
+ }
1842
2032
  }
1843
- }
1844
- ) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: k == "date" ? /* @__PURE__ */ e("span", { children: Oe(u, c.format || "DD MMM YYYY") }) : u || "N/A" })
2033
+ ) : x === "audio" ? u ? /* @__PURE__ */ e(
2034
+ "audio",
2035
+ {
2036
+ controls: !0,
2037
+ src: u,
2038
+ onClick: (T) => T.stopPropagation(),
2039
+ className: "shadow-md rounded-full"
2040
+ },
2041
+ u
2042
+ ) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
2043
+ /* DEFAULT */
2044
+ /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: x == "date" ? /* @__PURE__ */ e("span", { children: Oe(u, d.format || "DD MMM YYYY") }) : u || "N/A" })
2045
+ )
2046
+ )
1845
2047
  ] })
1846
2048
  ]
1847
2049
  }
1848
2050
  );
1849
- }, f = ({ col: c }) => {
1850
- let g = s[c.titleKey], m = s[c.subtitleKey], u = s[c.imageKey], k = s[c.fallback_icon];
1851
- return /* @__PURE__ */ h(
2051
+ }, y = ({ col: d }) => {
2052
+ let p = h[d.titleKey], m = h[d.subtitleKey], u = h[d.imageKey], x = h[d.fallback_icon];
2053
+ return /* @__PURE__ */ c(
1852
2054
  "div",
1853
2055
  {
1854
2056
  className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
1855
2057
  bg-gray-100 dark:bg-gray-900
1856
- ${c.blockClass}`,
2058
+ ${d.blockClass}`,
1857
2059
  children: [
1858
2060
  u ? /* @__PURE__ */ e(
1859
2061
  "img",
1860
2062
  {
1861
2063
  src: u,
1862
- alt: g,
1863
- onClick: () => M({ src: u, alt: g }),
2064
+ alt: p,
2065
+ onClick: () => L({ src: u, alt: p }),
1864
2066
  className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
1865
2067
  }
1866
- ) : k || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Pe, { className: "w-8 h-8 text-gray-400" }) }),
1867
- /* @__PURE__ */ h("div", { children: [
1868
- /* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: g }),
2068
+ ) : x || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Te, { className: "w-8 h-8 text-gray-400" }) }),
2069
+ /* @__PURE__ */ c("div", { children: [
2070
+ /* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: p }),
1869
2071
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: m })
1870
2072
  ] })
1871
2073
  ]
1872
2074
  }
1873
2075
  );
1874
2076
  };
1875
- return /* @__PURE__ */ h(E, { children: [
1876
- l && /* @__PURE__ */ e(
1877
- $e,
2077
+ return /* @__PURE__ */ c($, { children: [
2078
+ r && /* @__PURE__ */ e(
2079
+ Ge,
1878
2080
  {
1879
- src: o.src,
1880
- alt: o.alt,
1881
- isOpen: l,
1882
- setIsOpen: N
2081
+ src: s.src,
2082
+ alt: s.alt,
2083
+ isOpen: r,
2084
+ setIsOpen: C
1883
2085
  }
1884
2086
  ),
1885
- /* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${i || ""}`, children: n.map(
1886
- (c) => c.type == "group" ? /* @__PURE__ */ e(f, { col: c }) : /* @__PURE__ */ e(y, { col: c })
2087
+ /* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${i || ""}`, children: o.map(
2088
+ (d) => d.type == "group" ? /* @__PURE__ */ e(y, { col: d }) : /* @__PURE__ */ e(b, { col: d })
1887
2089
  ) })
1888
2090
  ] });
1889
2091
  }
1890
- const Ke = ({ config: s }) => {
1891
- var se, ne, ce, he, ue, be, pe, t, p, P, _, $, q, Y, Q, oe;
2092
+ const je = ({ config: h }) => {
2093
+ var de, ie, ce, he, ue, be, pe, ge, t, g, I, K, _, J, V, ee;
1892
2094
  const {
1893
- title: d,
1894
- fetchData: n = async () => {
2095
+ title: n,
2096
+ fetchData: o = async () => {
1895
2097
  },
1896
2098
  isStaticData: i = !1,
1897
- tableConfig: o = {},
1898
- modalConfig: r = {},
1899
- filterConfig: l
1900
- } = s, [N, M] = S(!0), [y, f] = S(!1), [c, g] = S([]), [m, u] = S(null), [k, w] = S({
2099
+ tableConfig: s = {},
2100
+ modalConfig: l = {},
2101
+ filterConfig: r
2102
+ } = h, [C, L] = R(!0), [b, y] = R(!1), [d, p] = R([]), [m, u] = R(null), [x, v] = R({
1901
2103
  search: "",
1902
2104
  rows_per_page: 50,
1903
2105
  current_page: 1
1904
- }), [C, D] = S({}), [A, G] = S(!1), [K, j] = S(!1), [O, v] = S(!1), [L, T] = S(!1), [B, b] = S(!1), [I, H] = S(null), V = (x, R) => {
1905
- x === "edit" ? (H(R), v(!0)) : x === "view" ? (H(R), b(!0)) : x === "delete" && (H(R), T(!0));
1906
- }, J = async (x, R, F = "", Z = "") => {
1907
- f(!0);
2106
+ }), [S, E] = R({}), [T, M] = R(!1), [G, j] = R(!1), [f, k] = R(!1), [O, D] = R(!1), [F, U] = R(!1), [A, N] = R(null), z = (w, P) => {
2107
+ w === "edit" ? (N(P), k(!0)) : w === "view" ? (N(P), U(!0)) : w === "delete" && (N(P), D(!0));
2108
+ }, Z = async (w, P, B = "", ae = "") => {
2109
+ y(!0);
1908
2110
  try {
1909
- const U = await (x == null ? void 0 : x());
1910
- (F || U.message) && we(F || U.message, {
2111
+ const Y = await (w == null ? void 0 : w());
2112
+ (B || Y.message) && ke(B || Y.message, {
1911
2113
  variant: "success"
1912
- }), R == null || R(U);
1913
- } catch (U) {
1914
- (Z || U.message) && we(Z || U.message, { variant: "error" });
2114
+ }), P == null || P(Y);
2115
+ } catch (Y) {
2116
+ (ae || Y.message) && ke(ae || Y.message, { variant: "error" });
1915
2117
  } finally {
1916
- f(!1);
2118
+ y(!1);
1917
2119
  }
1918
- }, re = (x) => {
1919
- let R = x.newObject;
1920
- i ? (g((F) => [R, ...F]), u((F) => ({
1921
- ...F,
2120
+ }, W = (w) => {
2121
+ let P = w.newObject;
2122
+ i ? (p((B) => [P, ...B]), u((B) => ({
2123
+ ...B,
1922
2124
  current_page: 1
1923
- }))) : (w((F) => ({
1924
- ...F,
2125
+ }))) : (v((B) => ({
2126
+ ...B,
1925
2127
  current_page: 1
1926
- })), k.current_page == 1 && ee()), j(!1);
1927
- }, ie = (x) => {
1928
- let R = x.newObject, F = x.targetObject;
1929
- i ? g(
1930
- (Z) => Z.map(
1931
- (U) => U.id === F.id ? { ...U, ...R } : U
2128
+ })), x.current_page == 1 && te()), j(!1);
2129
+ }, re = (w) => {
2130
+ let P = w.newObject, B = w.targetObject;
2131
+ i ? p(
2132
+ (ae) => ae.map(
2133
+ (Y) => Y.id === B.id ? { ...Y, ...P } : Y
1932
2134
  )
1933
- ) : ee(), v(!1);
1934
- }, te = (x) => {
1935
- if (!x) {
1936
- T(!1), H(null);
2135
+ ) : te(), k(!1);
2136
+ }, ne = (w) => {
2137
+ if (!w) {
2138
+ D(!1), N(null);
1937
2139
  return;
1938
2140
  }
1939
- i ? g(
1940
- (R) => R.filter((F) => F.id !== x.targetObject.id)
1941
- ) : c.length == 1 && k.current_page > 1 ? w((R) => ({
1942
- ...R,
1943
- current_page: R.current_page - 1
1944
- })) : ee(), T(!1), H(null);
1945
- }, de = (x) => J(
2141
+ i ? p(
2142
+ (P) => P.filter((B) => B.id !== w.targetObject.id)
2143
+ ) : d.length == 1 && x.current_page > 1 ? v((P) => ({
2144
+ ...P,
2145
+ current_page: P.current_page - 1
2146
+ })) : te(), D(!1), N(null);
2147
+ }, se = (w) => Z(
1946
2148
  () => {
1947
- var R, F;
1948
- return (F = (R = r == null ? void 0 : r.addModal) == null ? void 0 : R.handleSubmit) == null ? void 0 : F.call(R, x);
2149
+ var P, B;
2150
+ return (B = (P = l == null ? void 0 : l.addModal) == null ? void 0 : P.handleSubmit) == null ? void 0 : B.call(P, w);
1949
2151
  },
1950
- re
1951
- ), le = (x) => J(
2152
+ W
2153
+ ), oe = (w) => Z(
1952
2154
  () => {
1953
- var R, F;
1954
- return (F = (R = r == null ? void 0 : r.editModal) == null ? void 0 : R.handleSubmit) == null ? void 0 : F.call(R, x, I);
2155
+ var P, B;
2156
+ return (B = (P = l == null ? void 0 : l.editModal) == null ? void 0 : P.handleSubmit) == null ? void 0 : B.call(P, w, A);
1955
2157
  },
1956
- ie
1957
- ), ee = async () => {
1958
- M(!0), n == null || n({ ...k, ...C }).then((x) => {
1959
- g(x.data), u(x.pagination);
1960
- }).catch((x) => {
1961
- we(x.message, { variant: "error" });
2158
+ re
2159
+ ), te = async () => {
2160
+ L(!0), o == null || o({ ...x, ...S }).then((w) => {
2161
+ p(w.data), u(w.pagination);
2162
+ }).catch((w) => {
2163
+ ke(w.message, { variant: "error" });
1962
2164
  }).finally(() => {
1963
- M(!1);
2165
+ L(!1);
1964
2166
  });
1965
- }, ye = (x) => {
1966
- var R;
1967
- D((F) => ({
1968
- ...x
1969
- })), (R = o == null ? void 0 : o.filter) != null && R.useServerSideFilters && G((F) => !F);
1970
- }, xe = (x, R) => x.filter(
1971
- (F) => Object.entries(R).every(([Z, U]) => F[Z] === U)
1972
- ), ve = Se(() => {
1973
- var x;
1974
- return (x = o == null ? void 0 : o.filter) != null && x.useServerSideFilters ? c : xe(c, C);
1975
- }, [c, C]);
1976
- return z(() => {
1977
- ee();
2167
+ }, xe = (w) => {
2168
+ var P;
2169
+ E((B) => ({
2170
+ ...w
2171
+ })), (P = s == null ? void 0 : s.filter) != null && P.useServerSideFilters && M((B) => !B);
2172
+ }, ve = (w, P) => w.filter(
2173
+ (B) => Object.entries(P).every(([ae, Y]) => B[ae] === Y)
2174
+ ), we = Me(() => {
2175
+ var w;
2176
+ return (w = s == null ? void 0 : s.filter) != null && w.useServerSideFilters ? d : ve(d, S);
2177
+ }, [d, S]);
2178
+ return H(() => {
2179
+ te();
1978
2180
  }, [
1979
- k.search,
1980
- k.rows_per_page,
1981
- k.current_page,
1982
- A
2181
+ x.search,
2182
+ x.rows_per_page,
2183
+ x.current_page,
2184
+ T
1983
2185
  ]), /* @__PURE__ */ e(
1984
- We,
2186
+ Ze,
1985
2187
  {
1986
2188
  maxSnack: 3,
1987
2189
  anchorOrigin: {
@@ -1989,141 +2191,147 @@ const Ke = ({ config: s }) => {
1989
2191
  horizontal: "right"
1990
2192
  },
1991
2193
  autoHideDuration: 3e3,
1992
- action: (x) => /* @__PURE__ */ e(
2194
+ action: (w) => /* @__PURE__ */ e(
1993
2195
  "button",
1994
2196
  {
1995
2197
  onClick: () => {
1996
2198
  window.dispatchEvent(
1997
- new CustomEvent("closeSnackbar", { detail: x })
2199
+ new CustomEvent("closeSnackbar", { detail: w })
1998
2200
  );
1999
2201
  },
2000
2202
  className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
2001
- children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" })
2203
+ children: /* @__PURE__ */ e(ye, { className: "h-4 w-4" })
2002
2204
  }
2003
2205
  ),
2004
- children: /* @__PURE__ */ h("div", { children: [
2005
- /* @__PURE__ */ h("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-3", children: [
2006
- /* @__PURE__ */ h("div", { children: [
2007
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: d }),
2008
- /* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: s == null ? void 0 : s.description })
2206
+ children: /* @__PURE__ */ c("div", { children: [
2207
+ /* @__PURE__ */ c("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-3", children: [
2208
+ /* @__PURE__ */ c("div", { children: [
2209
+ /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: n }),
2210
+ /* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: h == null ? void 0 : h.description })
2009
2211
  ] }),
2010
- /* @__PURE__ */ e("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ h(
2011
- ae,
2212
+ /* @__PURE__ */ e("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ c(
2213
+ Q,
2012
2214
  {
2013
2215
  onClick: () => j(!0),
2014
2216
  variant: "contained",
2015
2217
  color: "primary",
2016
2218
  children: [
2017
- /* @__PURE__ */ e(Ye, { className: "w-4 h-4 mr-2" }),
2018
- s.buttonText || "Add New"
2219
+ /* @__PURE__ */ e(Ve, { className: "w-4 h-4 mr-2" }),
2220
+ h.buttonText || "Add New"
2019
2221
  ]
2020
2222
  }
2021
2223
  ) })
2022
2224
  ] }),
2023
2225
  /* @__PURE__ */ e(
2024
- na,
2226
+ ia,
2025
2227
  {
2026
2228
  config: {
2027
- ...o,
2229
+ ...s,
2028
2230
  pagination: {
2029
- ...o.pagination,
2231
+ ...s.pagination,
2030
2232
  ...m
2031
2233
  },
2032
- data: ve,
2033
- setServerSidePaginationData: w,
2034
- onMenuAction: V,
2035
- filterConfig: l,
2036
- onFilterApply: ye,
2037
- loading: N
2234
+ data: we,
2235
+ setServerSidePaginationData: v,
2236
+ onMenuAction: z,
2237
+ filterConfig: r,
2238
+ onFilterApply: xe,
2239
+ loading: C
2038
2240
  }
2039
2241
  }
2040
2242
  ),
2041
2243
  /* @__PURE__ */ e(
2042
- me,
2244
+ fe,
2043
2245
  {
2044
- isOpen: K,
2045
- onClose: () => j(!1),
2046
- icon: (se = r.addModal) == null ? void 0 : se.icon,
2047
- title: ((ne = r.addModal) == null ? void 0 : ne.title) || "Add New",
2048
- size: ((ce = r.addModal) == null ? void 0 : ce.size) || "md",
2246
+ isOpen: G,
2247
+ onClose: () => {
2248
+ b || j(!1);
2249
+ },
2250
+ icon: (de = l.addModal) == null ? void 0 : de.icon,
2251
+ title: ((ie = l.addModal) == null ? void 0 : ie.title) || "Add New",
2252
+ size: ((ce = l.addModal) == null ? void 0 : ce.size) || "md",
2049
2253
  onFormSubmit: () => {
2050
- var x;
2051
- return (x = document.querySelector("#addForm")) == null ? void 0 : x.requestSubmit();
2254
+ var w;
2255
+ return (w = document.querySelector("#addForm")) == null ? void 0 : w.requestSubmit();
2052
2256
  },
2053
- loadingBtn: y,
2054
- actionButtons: r.addModal.actionButtons,
2257
+ loadingBtn: b,
2258
+ actionButtons: l.addModal.actionButtons,
2055
2259
  children: /* @__PURE__ */ e(
2056
- Ae,
2260
+ Pe,
2057
2261
  {
2058
- config: (r == null ? void 0 : r.addModal) || [],
2059
- onSubmit: de,
2262
+ config: (l == null ? void 0 : l.addModal) || [],
2263
+ onSubmit: se,
2060
2264
  initialData: {},
2061
- loading: y
2265
+ type: "add",
2266
+ loading: b
2062
2267
  }
2063
2268
  )
2064
2269
  }
2065
2270
  ),
2066
2271
  /* @__PURE__ */ e(
2067
- me,
2272
+ fe,
2068
2273
  {
2069
- isOpen: O,
2070
- onClose: () => v(!1),
2071
- icon: (he = r.editModal) == null ? void 0 : he.icon,
2072
- title: ((ue = r.editModal) == null ? void 0 : ue.title) || "Edit",
2073
- size: ((be = r.editModal) == null ? void 0 : be.size) || "md",
2274
+ isOpen: f,
2275
+ onClose: () => {
2276
+ b || k(!1);
2277
+ },
2278
+ icon: (he = l.editModal) == null ? void 0 : he.icon,
2279
+ title: ((ue = l.editModal) == null ? void 0 : ue.title) || "Edit",
2280
+ size: ((be = l.editModal) == null ? void 0 : be.size) || "md",
2074
2281
  onFormSubmit: () => {
2075
- var x;
2076
- return (x = document.querySelector("#editForm")) == null ? void 0 : x.requestSubmit();
2282
+ var w;
2283
+ return (w = document.querySelector("#editForm")) == null ? void 0 : w.requestSubmit();
2077
2284
  },
2078
- actionButtons: r.editModal.actionButtons,
2079
- loadingBtn: y,
2285
+ actionButtons: l.editModal.actionButtons,
2286
+ loadingBtn: b,
2080
2287
  children: /* @__PURE__ */ e(
2081
- Ae,
2288
+ Pe,
2082
2289
  {
2083
- config: r.editModal || [],
2084
- onSubmit: le,
2085
- initialData: I,
2086
- loading: y
2290
+ config: l.editModal || [],
2291
+ onSubmit: oe,
2292
+ initialData: A,
2293
+ type: "edit",
2294
+ loading: b
2087
2295
  }
2088
2296
  )
2089
2297
  }
2090
2298
  ),
2091
- L && /* @__PURE__ */ e(
2092
- me,
2299
+ O && /* @__PURE__ */ e(
2300
+ fe,
2093
2301
  {
2094
- isOpen: L,
2095
- onClose: (x) => {
2096
- te(x);
2302
+ isOpen: O,
2303
+ onClose: (w) => {
2304
+ ne(w);
2097
2305
  },
2098
- icon: ((pe = r.deleteModal) == null ? void 0 : pe.icon) || /* @__PURE__ */ e(De, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
2099
- title: ((t = r.deleteModal) == null ? void 0 : t.title) || "Confirm Delete",
2100
- size: ((p = r.deleteModal) == null ? void 0 : p.size) || "md",
2101
- loading: y,
2102
- actionButtons: r.deleteModal.actionButtons,
2103
- executeFunction: J,
2104
- selectedItem: I,
2105
- children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ h("div", { children: [
2106
- /* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((P = r.deleteModal) == null ? void 0 : P.confirmText) || "Are you sure you want to delete this item?" }),
2107
- ((_ = r.deleteModal) == null ? void 0 : _.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: I[($ = r.deleteModal) == null ? void 0 : $.referenceKey] })
2306
+ icon: ((pe = l.deleteModal) == null ? void 0 : pe.icon) || /* @__PURE__ */ e(le, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
2307
+ title: ((ge = l.deleteModal) == null ? void 0 : ge.title) || "Confirm Delete",
2308
+ size: ((t = l.deleteModal) == null ? void 0 : t.size) || "md",
2309
+ loading: b,
2310
+ actionButtons: l.deleteModal.actionButtons,
2311
+ executeFunction: Z,
2312
+ selectedItem: A,
2313
+ children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ c("div", { children: [
2314
+ /* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((g = l.deleteModal) == null ? void 0 : g.confirmText) || "Are you sure you want to delete this item?" }),
2315
+ ((I = l.deleteModal) == null ? void 0 : I.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: A[(K = l.deleteModal) == null ? void 0 : K.referenceKey] })
2108
2316
  ] }) })
2109
2317
  }
2110
2318
  ),
2111
- r.viewModal && /* @__PURE__ */ e(
2112
- me,
2319
+ l.viewModal && /* @__PURE__ */ e(
2320
+ fe,
2113
2321
  {
2114
- isOpen: B,
2322
+ isOpen: F,
2115
2323
  onClose: () => {
2116
- b(!1), H(null);
2324
+ U(!1), N(null);
2117
2325
  },
2118
- icon: (q = r.viewModal) == null ? void 0 : q.icon,
2119
- title: ((Y = r.viewModal) == null ? void 0 : Y.title) || "View Details",
2120
- size: ((Q = r.viewModal) == null ? void 0 : Q.size) || "lg",
2121
- footerConfig: r == null ? void 0 : r.viewModal.footer,
2122
- children: (oe = r.viewModal) != null && oe.component ? /* @__PURE__ */ e(r.viewModal.component, { data: I }) : /* @__PURE__ */ e(
2123
- oa,
2326
+ icon: (_ = l.viewModal) == null ? void 0 : _.icon,
2327
+ title: ((J = l.viewModal) == null ? void 0 : J.title) || "View Details",
2328
+ size: ((V = l.viewModal) == null ? void 0 : V.size) || "lg",
2329
+ footerConfig: l == null ? void 0 : l.viewModal.footer,
2330
+ children: (ee = l.viewModal) != null && ee.component ? /* @__PURE__ */ e(l.viewModal.component, { data: A }) : /* @__PURE__ */ e(
2331
+ sa,
2124
2332
  {
2125
- data: I,
2126
- config: r.viewModal || {}
2333
+ data: A,
2334
+ config: l.viewModal || {}
2127
2335
  }
2128
2336
  )
2129
2337
  }
@@ -2131,7 +2339,7 @@ const Ke = ({ config: s }) => {
2131
2339
  ] })
2132
2340
  }
2133
2341
  );
2134
- }, Re = a.shape({
2342
+ }, Le = a.shape({
2135
2343
  value: a.oneOfType([
2136
2344
  a.string,
2137
2345
  a.number,
@@ -2139,18 +2347,18 @@ const Ke = ({ config: s }) => {
2139
2347
  ]).isRequired,
2140
2348
  label: a.string.isRequired,
2141
2349
  color: a.string
2142
- }), ke = a.shape({
2350
+ }), Ne = a.shape({
2143
2351
  type: a.string.isRequired,
2144
2352
  label: a.string.isRequired,
2145
2353
  color: a.string,
2146
2354
  variant: a.string,
2147
2355
  onClick: a.func
2148
- }), ia = a.shape({
2356
+ }), da = a.shape({
2149
2357
  title: a.string.isRequired,
2150
2358
  type: a.string.isRequired,
2151
2359
  variant: a.string,
2152
2360
  icon: a.node
2153
- }), da = a.shape({
2361
+ }), ca = a.shape({
2154
2362
  key: a.string.isRequired,
2155
2363
  title: a.string,
2156
2364
  type: a.string,
@@ -2159,12 +2367,12 @@ const Ke = ({ config: s }) => {
2159
2367
  subtitleKey: a.string,
2160
2368
  onClickDetails: a.bool,
2161
2369
  variant: a.string,
2162
- chipOptions: a.arrayOf(Re),
2370
+ chipOptions: a.arrayOf(Le),
2163
2371
  defaultColor: a.string,
2164
2372
  className: a.string,
2165
2373
  format: a.string,
2166
- menuList: a.arrayOf(ia)
2167
- }), Ne = a.shape({
2374
+ menuList: a.arrayOf(da)
2375
+ }), Se = a.shape({
2168
2376
  key: a.string.isRequired,
2169
2377
  label: a.string,
2170
2378
  type: a.string.isRequired,
@@ -2181,8 +2389,8 @@ const Ke = ({ config: s }) => {
2181
2389
  rows: a.number,
2182
2390
  text: a.string,
2183
2391
  editorKey: a.string,
2184
- options: a.arrayOf(Re)
2185
- }), sa = a.shape({
2392
+ options: a.arrayOf(Le)
2393
+ }), ha = a.shape({
2186
2394
  key: a.string,
2187
2395
  label: a.string,
2188
2396
  type: a.string,
@@ -2192,12 +2400,12 @@ const Ke = ({ config: s }) => {
2192
2400
  blockClass: a.string,
2193
2401
  icon: a.node,
2194
2402
  variant: a.string,
2195
- chipOptions: a.arrayOf(Re),
2403
+ chipOptions: a.arrayOf(Le),
2196
2404
  defaultColor: a.string,
2197
2405
  className: a.string,
2198
2406
  format: a.string
2199
2407
  });
2200
- Ke.propTypes = {
2408
+ je.propTypes = {
2201
2409
  config: a.shape({
2202
2410
  title: a.string.isRequired,
2203
2411
  description: a.string,
@@ -2206,7 +2414,7 @@ Ke.propTypes = {
2206
2414
  isStaticData: a.bool,
2207
2415
  /* ================= TABLE CONFIG ================= */
2208
2416
  tableConfig: a.shape({
2209
- table_head: a.arrayOf(da).isRequired,
2417
+ table_head: a.arrayOf(ca).isRequired,
2210
2418
  search: a.shape({
2211
2419
  enabled: a.bool,
2212
2420
  useServerSideSearch: a.bool,
@@ -2227,24 +2435,24 @@ Ke.propTypes = {
2227
2435
  title: a.string.isRequired,
2228
2436
  size: a.string,
2229
2437
  formClass: a.string,
2230
- formFields: a.arrayOf(Ne),
2438
+ formFields: a.arrayOf(Se),
2231
2439
  handleSubmit: a.func.isRequired,
2232
- actionButtons: a.arrayOf(ke)
2440
+ actionButtons: a.arrayOf(Ne)
2233
2441
  }),
2234
2442
  editModal: a.shape({
2235
2443
  title: a.string.isRequired,
2236
2444
  size: a.string,
2237
2445
  formClass: a.string,
2238
- formFields: a.arrayOf(Ne),
2446
+ formFields: a.arrayOf(Se),
2239
2447
  handleSubmit: a.func.isRequired,
2240
- actionButtons: a.arrayOf(ke)
2448
+ actionButtons: a.arrayOf(Ne)
2241
2449
  }),
2242
2450
  deleteModal: a.shape({
2243
2451
  title: a.string.isRequired,
2244
2452
  size: a.string,
2245
2453
  confirmText: a.string,
2246
2454
  referenceKey: a.string,
2247
- actionButtons: a.arrayOf(ke)
2455
+ actionButtons: a.arrayOf(Ne)
2248
2456
  }),
2249
2457
  viewModal: a.shape({
2250
2458
  title: a.string.isRequired,
@@ -2252,7 +2460,7 @@ Ke.propTypes = {
2252
2460
  // 👇 This covers your commented code:
2253
2461
  component: a.elementType,
2254
2462
  // for custom component like TeamMemberDetail
2255
- fields: a.arrayOf(sa),
2463
+ fields: a.arrayOf(ha),
2256
2464
  footer: a.shape({
2257
2465
  cancelButton: a.bool,
2258
2466
  cancelText: a.string
@@ -2261,15 +2469,15 @@ Ke.propTypes = {
2261
2469
  }),
2262
2470
  /* ================= FILTER CONFIG ================= */
2263
2471
  filterConfig: a.shape({
2264
- fields: a.arrayOf(Ne)
2472
+ fields: a.arrayOf(Se)
2265
2473
  })
2266
2474
  }).isRequired
2267
2475
  };
2268
- const ca = () => {
2476
+ const ua = () => {
2269
2477
  if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
2270
- const s = document.createElement("style");
2271
- s.id = "react-admin-crud-manager-styles";
2272
- const d = `
2478
+ const h = document.createElement("style");
2479
+ h.id = "react-admin-crud-manager-styles";
2480
+ const n = `
2273
2481
  .no-spinner::-webkit-outer-spin-button,
2274
2482
  .no-spinner::-webkit-inner-spin-button {
2275
2483
  -webkit-appearance: none;
@@ -2285,14 +2493,14 @@ const ca = () => {
2285
2493
  box-shadow: none !important;
2286
2494
  }
2287
2495
  `;
2288
- s.textContent = d, document.head.appendChild(s);
2496
+ h.textContent = n, document.head.appendChild(h);
2289
2497
  };
2290
- function xa(s) {
2291
- return z(() => {
2292
- ca();
2293
- }, []), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(Ke, { config: s.config }) });
2498
+ function wa(h) {
2499
+ return H(() => {
2500
+ ua();
2501
+ }, []), /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(je, { config: h.config }) });
2294
2502
  }
2295
2503
  export {
2296
- xa as default
2504
+ wa as default
2297
2505
  };
2298
2506
  //# sourceMappingURL=index.es.js.map