@kareemelbalshe/any-table 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,192 +1,192 @@
1
- import { jsx as o, jsxs as y, Fragment as me } from "react/jsx-runtime";
2
- import Ke, { useMemo as B, useState as A, useEffect as ne, useCallback as N, useRef as Tt, useImperativeHandle as Pt, createContext as Et, useContext as Ve } from "react";
3
- function S(e, t, n = void 0) {
4
- if (e == null) return n;
1
+ import r, { useMemo as $, useState as P, useEffect as G, useCallback as S, useRef as de, useImperativeHandle as Wt, createContext as Ft, useContext as qe } from "react";
2
+ function A(e, t, o = void 0) {
3
+ if (e == null) return o;
5
4
  if (!t || typeof t != "string") return e;
6
5
  if (t in e && e[t] !== void 0)
7
6
  return e[t];
8
- const l = t.replace(/\[(\w+)\]/g, ".$1").split(".");
9
- let r = e;
10
- for (let i = 0; i < l.length; i++) {
11
- const g = l[i];
12
- if (r == null)
13
- return n;
14
- r = r[g];
7
+ const i = t.replace(/\[(\w+)\]/g, ".$1").split(".");
8
+ let a = e;
9
+ for (let l = 0; l < i.length; l++) {
10
+ const m = i[l];
11
+ if (a == null)
12
+ return o;
13
+ a = a[m];
15
14
  }
16
- return r !== void 0 ? r : n;
15
+ return a !== void 0 ? a : o;
17
16
  }
18
- function $t(e) {
17
+ function Lt(e) {
19
18
  return e !== null && typeof e == "object" && !Array.isArray(e);
20
19
  }
21
- function re(e) {
20
+ function le(e) {
22
21
  if (!e || typeof e != "string") return "";
23
22
  let t = e.replace(/[._\-]+/g, " ");
24
- return t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.split(" ").filter(Boolean).map((n) => {
25
- const s = n.toLowerCase();
26
- return n.length <= 3 && n === n.toUpperCase() ? n : s.charAt(0).toUpperCase() + s.slice(1);
23
+ return t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.split(" ").filter(Boolean).map((o) => {
24
+ const s = o.toLowerCase();
25
+ return o.length <= 3 && o === o.toUpperCase() ? o : s.charAt(0).toUpperCase() + s.slice(1);
27
26
  }).join(" ");
28
27
  }
29
- const Bt = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif"], Dt = ["image", "avatar", "photo", "logo", "picture", "thumbnail", "banner", "img", "icon"], Mt = ["price", "spend", "cost", "amount", "total", "fee", "rate", "salary", "balance", "deposit", "commission", "charge"], _t = ["status", "state", "phase", "condition"];
30
- function ae(e, t) {
31
- const n = e.toLowerCase();
32
- if (Dt.some((r) => n.includes(r)))
28
+ const Ot = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif"], It = ["image", "avatar", "photo", "logo", "picture", "thumbnail", "banner", "img", "icon"], Ut = ["price", "spend", "cost", "amount", "total", "fee", "rate", "salary", "balance", "deposit", "commission", "charge"], Vt = ["status", "state", "phase", "condition"];
29
+ function ie(e, t) {
30
+ const o = e.toLowerCase();
31
+ if (It.some((a) => o.includes(a)))
33
32
  return "image";
34
- if (Mt.some((r) => n.includes(r)))
33
+ if (Ut.some((a) => o.includes(a)))
35
34
  return "currency";
36
- if (_t.some((r) => n.includes(r)))
35
+ if (Vt.some((a) => o.includes(a)))
37
36
  return "status";
38
- const s = t.filter((r) => r != null && r !== "");
37
+ const s = t.filter((a) => a != null && a !== "");
39
38
  if (s.length === 0)
40
39
  return "string";
41
- const l = s[0];
42
- if (typeof l == "boolean" || n.startsWith("is") || n.startsWith("has"))
40
+ const i = s[0];
41
+ if (typeof i == "boolean" || o.startsWith("is") || o.startsWith("has"))
43
42
  return "boolean";
44
- if (Array.isArray(l))
43
+ if (Array.isArray(i))
45
44
  return "array";
46
- if (typeof l == "object")
47
- return l.url && typeof l.url == "string" && Fe(l.url) ? "image" : "object";
48
- if (typeof l == "number")
45
+ if (typeof i == "object")
46
+ return i.url && typeof i.url == "string" && Ue(i.url) ? "image" : "object";
47
+ if (typeof i == "number")
49
48
  return "number";
50
- if (typeof l == "string") {
51
- const r = l.trim();
52
- if (Fe(r))
49
+ if (typeof i == "string") {
50
+ const a = i.trim();
51
+ if (Ue(a))
53
52
  return "image";
54
- if ((jt(r) || n.includes("date") || n.includes("at") || n.includes("time")) && !isNaN(Date.parse(r)))
55
- return r.includes("T") || r.includes(":") ? "datetime" : "date";
56
- if (r.includes("@") && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))
53
+ const l = o.includes("date") || o.includes("time") || o.endsWith("_at") || o.includes("_at_") || /(?:created|updated|deleted|modified|published)at$/i.test(o);
54
+ if (Yt(a) || l && a.length >= 8 && !isNaN(Date.parse(a)))
55
+ return a.includes("T") || a.includes(":") ? "datetime" : "date";
56
+ if (a.includes("@") && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a))
57
57
  return "email";
58
- if (r.startsWith("http://") || r.startsWith("https://"))
58
+ if (a.startsWith("http://") || a.startsWith("https://"))
59
59
  return "url";
60
- if (n.includes("phone") || n.includes("mobile") || n.includes("tel"))
60
+ if (o.includes("phone") || o.includes("mobile") || o.includes("tel"))
61
61
  return "phone";
62
62
  }
63
63
  return "string";
64
64
  }
65
- function Fe(e) {
65
+ function Ue(e) {
66
66
  if (!e || typeof e != "string") return !1;
67
67
  if (e.startsWith("data:image/")) return !0;
68
68
  const t = e.toLowerCase().split("?")[0];
69
- return Bt.some((n) => t.endsWith(n));
69
+ return Ot.some((o) => t.endsWith(o));
70
70
  }
71
- function jt(e) {
71
+ function Yt(e) {
72
72
  return !e || typeof e != "string" || e.length < 10 ? !1 : /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(e);
73
73
  }
74
- const Wt = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
75
- function zt(e, t = Wt, n = 2) {
74
+ const Gt = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
75
+ function Kt(e, t = Gt, o = 2) {
76
76
  if (!e || !e.length)
77
77
  return [];
78
- const s = /* @__PURE__ */ new Map(), l = e.slice(0, 10);
79
- for (const r of l)
80
- !r || typeof r != "object" || Ge(r, "", s, l, t, 0, n);
78
+ const s = /* @__PURE__ */ new Map(), i = e.slice(0, 10);
79
+ for (const a of i)
80
+ !a || typeof a != "object" || Xe(a, "", s, i, t, 0, o);
81
81
  return Array.from(s.values());
82
82
  }
83
- function Ge(e, t, n, s, l, r, i) {
84
- if (!(!e || typeof e != "object" || r > i))
85
- for (const g of Object.keys(e)) {
86
- if (l.includes(g)) continue;
87
- const c = t ? `${t}.${g}` : g, d = e[g];
88
- if ($t(d) && !Ft(d) && r < i) {
89
- Ge(d, c, n, s, l, r + 1, i);
83
+ function Xe(e, t, o, s, i, a, l) {
84
+ if (!(!e || typeof e != "object" || a > l))
85
+ for (const m of Object.keys(e)) {
86
+ if (i.includes(m)) continue;
87
+ const d = t ? `${t}.${m}` : m, c = e[m];
88
+ if (Lt(c) && !Zt(c) && a < l) {
89
+ Xe(c, d, o, s, i, a + 1, l);
90
90
  continue;
91
91
  }
92
- if (!n.has(c)) {
93
- const a = s.map((m) => S(m, c)), u = ae(c, a);
94
- n.set(c, {
95
- key: c,
96
- title: re(c),
97
- type: u,
92
+ if (!o.has(d)) {
93
+ const n = s.map((g) => A(g, d)), f = ie(d, n);
94
+ o.set(d, {
95
+ key: d,
96
+ title: le(d),
97
+ type: f,
98
98
  sortable: !0,
99
99
  searchable: !0,
100
- align: u === "number" || u === "currency" ? "right" : "left"
100
+ align: f === "number" || f === "currency" ? "right" : "left"
101
101
  });
102
102
  }
103
103
  }
104
104
  }
105
- function Ft(e, t) {
105
+ function Zt(e, t) {
106
106
  return "en" in e && "ar" in e && Object.keys(e).length <= 3 ? !1 : "url" in e && typeof e.url == "string" || "coordinates" in e || "lat" in e && "lng" in e;
107
107
  }
108
- function Lt(e) {
109
- const { data: t = [], columns: n, autoColumns: s = !0, thead: l, headerData: r } = e;
110
- return r && Array.isArray(r) && r.length > 0 ? r.map((i, g) => {
111
- const c = l && l[g] ? l[g] : re(i), d = t.map((u) => u?.[i]), a = ae(i, d);
108
+ function Jt(e) {
109
+ const { data: t = [], columns: o, autoColumns: s = !0, thead: i, headerData: a } = e;
110
+ return a && Array.isArray(a) && a.length > 0 ? a.map((l, m) => {
111
+ const d = i && i[m] ? i[m] : le(l), c = t.map((f) => A(f, l)), n = ie(l, c);
112
112
  return {
113
- key: i,
114
- title: c,
115
- type: a,
113
+ key: l,
114
+ title: d,
115
+ type: n,
116
116
  sortable: !0,
117
117
  searchable: !0,
118
- align: a === "number" || a === "currency" ? "right" : "left"
118
+ align: n === "number" || n === "currency" ? "right" : "left"
119
119
  };
120
- }) : n && Array.isArray(n) && n.length > 0 ? n.map((i) => {
121
- if (typeof i == "string") {
122
- const a = t.map((m) => m?.[i]), u = ae(i, a);
120
+ }) : o && Array.isArray(o) && o.length > 0 ? o.map((l) => {
121
+ if (typeof l == "string") {
122
+ const n = t.map((g) => A(g, l)), f = ie(l, n);
123
123
  return {
124
- key: i,
125
- title: re(i),
126
- type: u,
124
+ key: l,
125
+ title: le(l),
126
+ type: f,
127
127
  sortable: !0,
128
128
  searchable: !0,
129
- align: u === "number" || u === "currency" ? "right" : "left"
129
+ align: f === "number" || f === "currency" ? "right" : "left"
130
130
  };
131
131
  }
132
- const g = String(i.key), c = i.title !== void 0 ? i.title : re(g), d = i.type || ae(g, t.map((a) => a?.[g]));
132
+ const m = String(l.key), d = l.title !== void 0 ? l.title : le(m), c = l.type || ie(m, t.map((n) => A(n, m)));
133
133
  return {
134
- ...i,
135
- title: c,
136
- type: d,
137
- sortable: i.sortable !== void 0 ? i.sortable : !0,
138
- searchable: i.searchable !== void 0 ? i.searchable : !0,
139
- align: i.align || (d === "number" || d === "currency" ? "right" : "left")
134
+ ...l,
135
+ title: d,
136
+ type: c,
137
+ sortable: l.sortable !== void 0 ? l.sortable : !0,
138
+ searchable: l.searchable !== void 0 ? l.searchable : !0,
139
+ align: l.align || (c === "number" || c === "currency" ? "right" : "left")
140
140
  };
141
- }) : s && t && t.length > 0 ? zt(t) : [];
141
+ }) : s && t && t.length > 0 ? Kt(t) : [];
142
142
  }
143
- function Ht(e) {
143
+ function qt(e) {
144
144
  const {
145
145
  explicitActions: t,
146
- buttons: n,
146
+ buttons: o,
147
147
  block: s,
148
- handleBlock: l,
149
- view: r,
150
- linkView: i,
151
- viewHandler: g,
152
- edit: c,
153
- linkEdit: d,
154
- editHandler: a,
155
- del: u,
156
- handleDelete: m
157
- } = e, f = [...t || []];
158
- return n && Array.isArray(n) && n.forEach((b, h) => {
159
- f.push({
160
- id: `legacy-btn-${h}`,
148
+ handleBlock: i,
149
+ view: a,
150
+ linkView: l,
151
+ viewHandler: m,
152
+ edit: d,
153
+ linkEdit: c,
154
+ editHandler: n,
155
+ del: f,
156
+ handleDelete: g
157
+ } = e, u = [...t || []];
158
+ return o && Array.isArray(o) && o.forEach((b, y) => {
159
+ u.push({
160
+ id: `legacy-btn-${y}`,
161
161
  label: b.label,
162
162
  icon: b.icon,
163
163
  className: b.className,
164
164
  show: b.show,
165
165
  hide: b.hide,
166
- onClick: (k) => b.onClick(k)
166
+ onClick: (v) => b.onClick(v)
167
167
  });
168
- }), s && l && f.push({
168
+ }), s && i && u.push({
169
169
  id: "legacy-block",
170
170
  label: (b) => b.isBanned || !b.isActive ? "Unblock" : "Block",
171
171
  variant: (b) => b.isBanned || !b.isActive ? "success" : "danger",
172
- onClick: (b) => l(b?._id || b?.id)
173
- }), r && (g || i) && f.push({
172
+ onClick: (b) => i(b?._id || b?.id)
173
+ }), a && (m || l) && u.push({
174
174
  id: "legacy-view",
175
175
  label: "View",
176
176
  variant: "primary",
177
177
  onClick: (b) => {
178
- const h = b?._id || b?.id;
179
- g ? g(h) : i && typeof window < "u" && (window.location.href = `${i}/${h}`);
178
+ const y = b?._id || b?.id;
179
+ m ? m(y) : l && typeof window < "u" && (window.location.href = `${l}/${y}`);
180
180
  }
181
- }), c && (a || d) && f.push({
181
+ }), d && (n || c) && u.push({
182
182
  id: "legacy-edit",
183
183
  label: "Edit",
184
184
  variant: "info",
185
185
  onClick: (b) => {
186
- const h = b?._id || b?.id;
187
- a ? a(h) : d && typeof window < "u" && (window.location.href = `${d}/${h}`);
186
+ const y = b?._id || b?.id;
187
+ n ? n(y) : c && typeof window < "u" && (window.location.href = `${c}/${y}`);
188
188
  }
189
- }), u && m && f.push({
189
+ }), f && g && u.push({
190
190
  id: "legacy-del",
191
191
  label: "Delete",
192
192
  variant: "danger",
@@ -194,141 +194,141 @@ function Ht(e) {
194
194
  title: "Delete Item",
195
195
  message: "Are you sure you want to delete this record?"
196
196
  },
197
- onClick: (b) => m(b?._id || b?.id)
198
- }), f;
197
+ onClick: (b) => g(b?._id || b?.id)
198
+ }), u;
199
199
  }
200
- function Ot({
200
+ function Xt({
201
201
  config: e,
202
202
  onSearchChange: t
203
203
  }) {
204
- const n = B(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = n.enabled !== !1 && !!e, l = n.debounce ?? 350, [r, i] = A(""), [g, c] = A(""), [d, a] = A(!1);
205
- ne(() => {
204
+ const o = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.debounce ?? 350, [a, l] = P(""), [m, d] = P(""), [c, n] = P(!1);
205
+ G(() => {
206
206
  if (!s) return;
207
- if (r === "") {
208
- c(""), a(!1), t?.("");
207
+ if (a === "") {
208
+ d(""), n(!1), t?.("");
209
209
  return;
210
210
  }
211
- a(!0);
212
- const f = setTimeout(() => {
213
- c(r), a(!1), t?.(r);
214
- }, l);
211
+ n(!0);
212
+ const u = setTimeout(() => {
213
+ d(a), n(!1), t?.(a);
214
+ }, i);
215
215
  return () => {
216
- clearTimeout(f);
216
+ clearTimeout(u);
217
217
  };
218
- }, [r, l, s, t]);
219
- const u = N((f) => {
220
- i(f);
221
- }, []), m = N(() => {
222
- i(""), c(""), a(!1), t?.("");
218
+ }, [a, i, s, t]);
219
+ const f = S((u) => {
220
+ l(u);
221
+ }, []), g = S(() => {
222
+ l(""), d(""), n(!1), t?.("");
223
223
  }, [t]);
224
224
  return {
225
225
  enabled: s,
226
- search: r,
227
- debouncedSearch: g,
228
- isDebouncing: d,
229
- setSearch: u,
230
- clearSearch: m,
231
- searchConfig: n
226
+ search: a,
227
+ debouncedSearch: m,
228
+ isDebouncing: c,
229
+ setSearch: f,
230
+ clearSearch: g,
231
+ searchConfig: o
232
232
  };
233
233
  }
234
- function Rt({
234
+ function Qt({
235
235
  config: e,
236
236
  onSortChange: t
237
237
  }) {
238
- const n = B(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = n.enabled !== !1 && !!e, l = n.allowUnsort ?? !0, [r, i] = A(
239
- n.defaultSortBy || null
240
- ), [g, c] = A(
241
- n.defaultSortOrder || null
242
- ), d = N(
243
- (m) => {
238
+ const o = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.allowUnsort ?? !0, [a, l] = P(
239
+ o.defaultSortBy || null
240
+ ), [m, d] = P(
241
+ o.defaultSortOrder || null
242
+ ), c = S(
243
+ (g) => {
244
244
  if (s) {
245
- if (r !== m) {
246
- i(m), c("asc"), t?.(m, "asc");
245
+ if (a !== g) {
246
+ l(g), d("asc"), t?.(g, "asc");
247
247
  return;
248
248
  }
249
- g === "asc" ? (c("desc"), t?.(m, "desc")) : g === "desc" && l ? (i(null), c(null), t?.(null, null)) : (c("asc"), t?.(m, "asc"));
249
+ m === "asc" ? (d("desc"), t?.(g, "desc")) : m === "desc" && i ? (l(null), d(null), t?.(null, null)) : (d("asc"), t?.(g, "asc"));
250
250
  }
251
251
  },
252
- [s, r, g, l, t]
253
- ), a = N(
254
- (m, f) => {
255
- i(m), c(f), t?.(m, f);
252
+ [s, a, m, i, t]
253
+ ), n = S(
254
+ (g, u) => {
255
+ l(g), d(u), t?.(g, u);
256
256
  },
257
257
  [t]
258
- ), u = N(() => {
259
- i(null), c(null), t?.(null, null);
258
+ ), f = S(() => {
259
+ l(null), d(null), t?.(null, null);
260
260
  }, [t]);
261
261
  return {
262
262
  enabled: s,
263
- sortBy: r,
264
- sortOrder: g,
265
- toggleSort: d,
266
- setSorting: a,
267
- resetSorting: u,
268
- sortingConfig: n
263
+ sortBy: a,
264
+ sortOrder: m,
265
+ toggleSort: c,
266
+ setSorting: n,
267
+ resetSorting: f,
268
+ sortingConfig: o
269
269
  };
270
270
  }
271
- function Ut({
271
+ function er({
272
272
  config: e,
273
273
  totalRecords: t,
274
- onPageChange: n
274
+ onPageChange: o
275
275
  }) {
276
- const s = B(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), l = s.enabled !== !1 && !!e, r = s.defaultPage || 1, i = s.defaultPageSize || 10, g = s.pageSizeOptions || [5, 10, 20, 50, 100], [c, d] = A(r), [a, u] = A(i), m = Math.max(1, Math.ceil(t / Math.max(1, a))), f = N(
277
- (w) => {
278
- const x = Math.max(1, Math.min(w, m));
279
- d(x), n?.(x, a);
276
+ const s = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), i = s.enabled !== !1 && !!e, a = s.defaultPage || 1, l = s.defaultPageSize || 10, m = s.pageSizeOptions || [5, 10, 20, 50, 100], [d, c] = P(a), [n, f] = P(l), g = Math.max(1, Math.ceil(t / Math.max(1, n))), u = S(
277
+ (p) => {
278
+ const x = Math.max(1, Math.min(p, g));
279
+ c(x), o?.(x, n);
280
280
  },
281
- [m, a, n]
282
- ), b = N(
283
- (w) => {
284
- u(w), d(1), n?.(1, w);
281
+ [g, n, o]
282
+ ), b = S(
283
+ (p) => {
284
+ f(p), c(1), o?.(1, p);
285
285
  },
286
- [n]
287
- ), h = N(() => {
288
- c < m && f(c + 1);
289
- }, [c, m, f]), k = N(() => {
290
- c > 1 && f(c - 1);
291
- }, [c, f]), T = N(() => {
292
- d(1), u(i), n?.(1, i);
293
- }, [i, n]), $ = N(
294
- (w = 5) => {
286
+ [o]
287
+ ), y = S(() => {
288
+ d < g && u(d + 1);
289
+ }, [d, g, u]), v = S(() => {
290
+ d > 1 && u(d - 1);
291
+ }, [d, u]), T = S(() => {
292
+ c(1), f(l), o?.(1, l);
293
+ }, [l, o]), B = S(
294
+ (p = 5) => {
295
295
  const x = Math.max(
296
296
  1,
297
- Math.min(c - Math.floor(w / 2), m - w + 1)
298
- ), M = Math.min(m, x + w - 1), z = [];
299
- for (let W = x; W <= M; W++)
300
- z.push(W);
301
- return z;
297
+ Math.min(d - Math.floor(p / 2), g - p + 1)
298
+ ), k = Math.min(g, x + p - 1), w = [];
299
+ for (let D = x; D <= k; D++)
300
+ w.push(D);
301
+ return w;
302
302
  },
303
- [c, m]
304
- ), p = N(
305
- (w) => {
306
- if (!l) return w;
307
- const x = (c - 1) * a;
308
- return w.slice(x, x + a);
303
+ [d, g]
304
+ ), E = S(
305
+ (p) => {
306
+ if (!i) return p;
307
+ const x = (d - 1) * n;
308
+ return p.slice(x, x + n);
309
309
  },
310
- [l, c, a]
310
+ [i, d, n]
311
311
  );
312
312
  return {
313
- enabled: l,
314
- page: c,
315
- pageSize: a,
313
+ enabled: i,
314
+ page: d,
315
+ pageSize: n,
316
316
  totalRecords: t,
317
- totalPages: m,
318
- pageSizeOptions: g,
319
- hasNextPage: c < m,
320
- hasPrevPage: c > 1,
321
- setPage: f,
317
+ totalPages: g,
318
+ pageSizeOptions: m,
319
+ hasNextPage: d < g,
320
+ hasPrevPage: d > 1,
321
+ setPage: u,
322
322
  setPageSize: b,
323
- nextPage: h,
324
- prevPage: k,
323
+ nextPage: y,
324
+ prevPage: v,
325
325
  resetPagination: T,
326
- getPageWindow: $,
327
- sliceData: p,
326
+ getPageWindow: B,
327
+ sliceData: E,
328
328
  paginationConfig: s
329
329
  };
330
330
  }
331
- const It = [
331
+ const tr = [
332
332
  "total",
333
333
  "totalCount",
334
334
  "count",
@@ -344,7 +344,7 @@ const It = [
344
344
  "pageInfo.total",
345
345
  "pageInfo.totalCount",
346
346
  "paging.total"
347
- ], Kt = [
347
+ ], rr = [
348
348
  "page",
349
349
  "currentPage",
350
350
  "pageNumber",
@@ -354,7 +354,7 @@ const It = [
354
354
  "pagination.page",
355
355
  "pagination.currentPage",
356
356
  "pageInfo.page"
357
- ], Vt = [
357
+ ], ar = [
358
358
  "pageSize",
359
359
  "limit",
360
360
  "perPage",
@@ -365,7 +365,7 @@ const It = [
365
365
  "pagination.pageSize",
366
366
  "pagination.limit",
367
367
  "pagination.perPage"
368
- ], Gt = [
368
+ ], nr = [
369
369
  "totalPages",
370
370
  "pageCount",
371
371
  "lastPage",
@@ -376,95 +376,95 @@ const It = [
376
376
  "pagination.totalPages",
377
377
  "pagination.lastPage"
378
378
  ];
379
- function G(e, t, n = 1, s = 10, l) {
379
+ function q(e, t, o = 1, s = 10, i) {
380
380
  if (!e || typeof e != "object") {
381
- const d = l !== void 0 ? l : 0;
381
+ const c = i !== void 0 ? i : 0;
382
382
  return {
383
- page: n,
383
+ page: o,
384
384
  pageSize: s,
385
- total: d,
386
- totalPages: Math.max(1, Math.ceil(d / Math.max(1, s))),
385
+ total: c,
386
+ totalPages: Math.max(1, Math.ceil(c / Math.max(1, s))),
387
387
  hasNextPage: !1,
388
388
  hasPrevPage: !1
389
389
  };
390
390
  }
391
- let r;
391
+ let a;
392
392
  if (t?.totalPath) {
393
- const d = S(e, t.totalPath);
394
- typeof d == "number" ? r = d : typeof d == "string" && !isNaN(Number(d)) && (r = Number(d));
393
+ const c = A(e, t.totalPath);
394
+ typeof c == "number" ? a = c : typeof c == "string" && !isNaN(Number(c)) && (a = Number(c));
395
395
  }
396
- if (r === void 0)
397
- for (const d of It) {
398
- const a = S(e, d);
399
- if (typeof a == "number" && !isNaN(a)) {
400
- r = a;
396
+ if (a === void 0)
397
+ for (const c of tr) {
398
+ const n = A(e, c);
399
+ if (typeof n == "number" && !isNaN(n)) {
400
+ a = n;
401
401
  break;
402
402
  }
403
- if (typeof a == "string" && a.trim() !== "" && !isNaN(Number(a))) {
404
- r = Number(a);
403
+ if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
404
+ a = Number(n);
405
405
  break;
406
406
  }
407
407
  }
408
- r === void 0 && (r = l !== void 0 ? l : 0);
409
- let i;
408
+ a === void 0 && (a = i !== void 0 ? i : 0);
409
+ let l;
410
410
  if (t?.pagePath) {
411
- const d = S(e, t.pagePath);
412
- typeof d == "number" ? i = d : typeof d == "string" && !isNaN(Number(d)) && (i = Number(d));
411
+ const c = A(e, t.pagePath);
412
+ typeof c == "number" ? l = c : typeof c == "string" && !isNaN(Number(c)) && (l = Number(c));
413
413
  }
414
- if (i === void 0)
415
- for (const d of Kt) {
416
- const a = S(e, d);
417
- if (typeof a == "number" && !isNaN(a)) {
418
- i = a;
414
+ if (l === void 0)
415
+ for (const c of rr) {
416
+ const n = A(e, c);
417
+ if (typeof n == "number" && !isNaN(n)) {
418
+ l = n;
419
419
  break;
420
420
  }
421
- if (typeof a == "string" && a.trim() !== "" && !isNaN(Number(a))) {
422
- i = Number(a);
421
+ if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
422
+ l = Number(n);
423
423
  break;
424
424
  }
425
425
  }
426
- i === void 0 && (i = n);
427
- let g;
426
+ l === void 0 && (l = o);
427
+ let m;
428
428
  if (t?.pageSizePath) {
429
- const d = S(e, t.pageSizePath);
430
- typeof d == "number" ? g = d : typeof d == "string" && !isNaN(Number(d)) && (g = Number(d));
429
+ const c = A(e, t.pageSizePath);
430
+ typeof c == "number" ? m = c : typeof c == "string" && !isNaN(Number(c)) && (m = Number(c));
431
431
  }
432
- if (g === void 0)
433
- for (const d of Vt) {
434
- const a = S(e, d);
435
- if (typeof a == "number" && !isNaN(a)) {
436
- g = a;
432
+ if (m === void 0)
433
+ for (const c of ar) {
434
+ const n = A(e, c);
435
+ if (typeof n == "number" && !isNaN(n)) {
436
+ m = n;
437
437
  break;
438
438
  }
439
- if (typeof a == "string" && a.trim() !== "" && !isNaN(Number(a))) {
440
- g = Number(a);
439
+ if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
440
+ m = Number(n);
441
441
  break;
442
442
  }
443
443
  }
444
- g === void 0 && (g = s);
445
- let c;
444
+ m === void 0 && (m = s);
445
+ let d;
446
446
  if (t?.totalPagesPath) {
447
- const d = S(e, t.totalPagesPath);
448
- typeof d == "number" ? c = d : typeof d == "string" && !isNaN(Number(d)) && (c = Number(d));
447
+ const c = A(e, t.totalPagesPath);
448
+ typeof c == "number" ? d = c : typeof c == "string" && !isNaN(Number(c)) && (d = Number(c));
449
449
  }
450
- if (c === void 0)
451
- for (const d of Gt) {
452
- const a = S(e, d);
453
- if (typeof a == "number" && !isNaN(a)) {
454
- c = a;
450
+ if (d === void 0)
451
+ for (const c of nr) {
452
+ const n = A(e, c);
453
+ if (typeof n == "number" && !isNaN(n)) {
454
+ d = n;
455
455
  break;
456
456
  }
457
457
  }
458
- return (c === void 0 || c <= 0) && (c = Math.max(1, Math.ceil(r / Math.max(1, g)))), {
459
- total: r,
460
- page: i,
461
- pageSize: g,
462
- totalPages: c,
463
- hasNextPage: i < c,
464
- hasPrevPage: i > 1
458
+ return (d === void 0 || d <= 0) && (d = Math.max(1, Math.ceil(a / Math.max(1, m)))), {
459
+ total: a,
460
+ page: l,
461
+ pageSize: m,
462
+ totalPages: d,
463
+ hasNextPage: l < d,
464
+ hasPrevPage: l > 1
465
465
  };
466
466
  }
467
- const Yt = [
467
+ const or = [
468
468
  "data",
469
469
  "items",
470
470
  "results",
@@ -485,24 +485,24 @@ const Yt = [
485
485
  "subscriptions",
486
486
  "deadLetters.items"
487
487
  ];
488
- function Zt(e, t, n) {
489
- const s = n?.page || 1, l = n?.pageSize || 10;
488
+ function sr(e, t, o) {
489
+ const s = o?.page || 1, i = o?.pageSize || 10;
490
490
  if (t?.transformResponse && typeof t.transformResponse == "function") {
491
- const r = t.transformResponse(e);
492
- if (Array.isArray(r))
491
+ const a = t.transformResponse(e);
492
+ if (Array.isArray(a))
493
493
  return {
494
- data: r,
495
- meta: G(e, t.response, s, l, r.length),
494
+ data: a,
495
+ meta: q(e, t.response, s, i, a.length),
496
496
  raw: e
497
497
  };
498
- if (r && typeof r == "object") {
499
- const i = Array.isArray(r.data) ? r.data : [], g = r.meta ? {
500
- total: r.meta.total !== void 0 ? r.meta.total : i.length,
501
- page: r.meta.page !== void 0 ? r.meta.page : s,
502
- pageSize: r.meta.pageSize !== void 0 ? r.meta.pageSize : l,
503
- totalPages: r.meta.totalPages !== void 0 ? r.meta.totalPages : Math.max(1, Math.ceil((r.meta.total || i.length) / (r.meta.pageSize || l)))
504
- } : G(e, t.response, s, l, i.length);
505
- return { data: i, meta: g, raw: e };
498
+ if (a && typeof a == "object") {
499
+ const l = Array.isArray(a.data) ? a.data : [], m = a.meta ? {
500
+ total: a.meta.total !== void 0 ? a.meta.total : l.length,
501
+ page: a.meta.page !== void 0 ? a.meta.page : s,
502
+ pageSize: a.meta.pageSize !== void 0 ? a.meta.pageSize : i,
503
+ totalPages: a.meta.totalPages !== void 0 ? a.meta.totalPages : Math.max(1, Math.ceil((a.meta.total || l.length) / (a.meta.pageSize || i)))
504
+ } : q(e, t.response, s, i, l.length);
505
+ return { data: l, meta: m, raw: e };
506
506
  }
507
507
  }
508
508
  if (Array.isArray(e))
@@ -511,47 +511,47 @@ function Zt(e, t, n) {
511
511
  meta: {
512
512
  total: e.length,
513
513
  page: s,
514
- pageSize: l,
515
- totalPages: Math.max(1, Math.ceil(e.length / l)),
516
- hasNextPage: s * l < e.length,
514
+ pageSize: i,
515
+ totalPages: Math.max(1, Math.ceil(e.length / i)),
516
+ hasNextPage: s * i < e.length,
517
517
  hasPrevPage: s > 1
518
518
  },
519
519
  raw: e
520
520
  };
521
521
  if (t?.response?.dataPath) {
522
- const r = S(e, t.response.dataPath), i = Array.isArray(r) ? r : [], g = G(e, t.response, s, l, i.length);
523
- return { data: i, meta: g, raw: e };
522
+ const a = A(e, t.response.dataPath), l = Array.isArray(a) ? a : [], m = q(e, t.response, s, i, l.length);
523
+ return { data: l, meta: m, raw: e };
524
524
  }
525
525
  if (e && typeof e == "object") {
526
- for (const r of Yt) {
527
- const i = S(e, r);
528
- if (Array.isArray(i)) {
529
- const g = G(e, t?.response, s, l, i.length);
526
+ for (const a of or) {
527
+ const l = A(e, a);
528
+ if (Array.isArray(l)) {
529
+ const m = q(e, t?.response, s, i, l.length);
530
530
  return {
531
- data: i,
532
- meta: g,
531
+ data: l,
532
+ meta: m,
533
533
  raw: e
534
534
  };
535
535
  }
536
536
  }
537
- for (const r in e)
538
- if (Array.isArray(e[r])) {
539
- const i = G(e, t?.response, s, l, e[r].length);
537
+ for (const a in e)
538
+ if (Array.isArray(e[a])) {
539
+ const l = q(e, t?.response, s, i, e[a].length);
540
540
  return {
541
- data: e[r],
542
- meta: i,
541
+ data: e[a],
542
+ meta: l,
543
543
  raw: e
544
544
  };
545
545
  }
546
546
  if (Object.keys(e).length > 0 && !Array.isArray(e)) {
547
- const r = e.user || e.order || e.item || e.data || e;
548
- if (r && typeof r == "object" && !Array.isArray(r))
547
+ const a = e.user || e.order || e.item || e.data || e;
548
+ if (a && typeof a == "object" && !Array.isArray(a))
549
549
  return {
550
- data: [r],
550
+ data: [a],
551
551
  meta: {
552
552
  total: 1,
553
553
  page: 1,
554
- pageSize: l,
554
+ pageSize: i,
555
555
  totalPages: 1,
556
556
  hasNextPage: !1,
557
557
  hasPrevPage: !1
@@ -565,7 +565,7 @@ function Zt(e, t, n) {
565
565
  meta: {
566
566
  total: 0,
567
567
  page: s,
568
- pageSize: l,
568
+ pageSize: i,
569
569
  totalPages: 1,
570
570
  hasNextPage: !1,
571
571
  hasPrevPage: !1
@@ -573,251 +573,372 @@ function Zt(e, t, n) {
573
573
  raw: e
574
574
  };
575
575
  }
576
- function Jt(e, t, n, s) {
576
+ function lr(e, t, o, s) {
577
577
  if (!e || !e.length) return [];
578
578
  if (!t || typeof t != "string" || !t.trim()) return e;
579
- const l = t.trim().toLowerCase();
579
+ const i = t.trim().toLowerCase();
580
580
  if (s && typeof s == "function")
581
- return e.filter((i) => s(i, l));
582
- const r = l.split(/\s+/).filter(Boolean);
583
- return e.filter((i) => {
584
- if (!i || typeof i != "object") return !1;
585
- const g = [];
586
- if (n && n.length > 0)
587
- for (const d of n) {
588
- const a = S(i, d);
589
- a != null && (typeof a == "object" ? g.push(JSON.stringify(a).toLowerCase()) : g.push(String(a).toLowerCase()));
581
+ return e.filter((l) => s(l, i));
582
+ const a = i.split(/\s+/).filter(Boolean);
583
+ return e.filter((l) => {
584
+ if (!l || typeof l != "object") return !1;
585
+ const m = [];
586
+ if (o && o.length > 0)
587
+ for (const c of o) {
588
+ const n = A(l, c);
589
+ n != null && (typeof n == "object" ? m.push(JSON.stringify(n).toLowerCase()) : m.push(String(n).toLowerCase()));
590
590
  }
591
591
  else
592
- ue(i, g);
593
- const c = g.join(" ");
594
- return r.every((d) => c.includes(d));
592
+ pe(l, m);
593
+ const d = m.join(" ");
594
+ return a.every((c) => d.includes(c));
595
595
  });
596
596
  }
597
- function ue(e, t, n = 0) {
598
- if (!(n > 4 || e === null || e === void 0)) {
597
+ function pe(e, t, o = 0) {
598
+ if (!(o > 4 || e === null || e === void 0)) {
599
599
  if (typeof e != "object") {
600
600
  t.push(String(e).toLowerCase());
601
601
  return;
602
602
  }
603
603
  if (Array.isArray(e)) {
604
604
  for (const s of e)
605
- ue(s, t, n + 1);
605
+ pe(s, t, o + 1);
606
606
  return;
607
607
  }
608
608
  for (const s in e)
609
609
  if (Object.prototype.hasOwnProperty.call(e, s)) {
610
610
  if (s.startsWith("__") || s.toLowerCase().includes("password")) continue;
611
- ue(e[s], t, n + 1);
611
+ pe(e[s], t, o + 1);
612
612
  }
613
613
  }
614
614
  }
615
- function qt(e, t, n, s) {
616
- if (!e || !e.length || !t || !n)
615
+ function ir(e, t, o, s) {
616
+ if (!e || !e.length || !t || !o)
617
617
  return e;
618
- const l = [...e];
619
- return s && typeof s == "function" ? (l.sort((r, i) => {
620
- const g = s(r, i);
621
- return n === "desc" ? -g : g;
622
- }), l) : (l.sort((r, i) => {
623
- const g = S(r, t), c = S(i, t);
624
- if (g == null)
625
- return c == null ? 0 : 1;
626
- if (c == null)
618
+ const i = [...e];
619
+ return s && typeof s == "function" ? (i.sort((a, l) => {
620
+ const m = A(a, t), d = A(l, t);
621
+ if (m == null)
622
+ return d == null ? 0 : 1;
623
+ if (d == null) return -1;
624
+ const c = s(a, l);
625
+ return o === "desc" ? -c : c;
626
+ }), i) : (i.sort((a, l) => {
627
+ const m = A(a, t), d = A(l, t);
628
+ if (m == null)
629
+ return d == null ? 0 : 1;
630
+ if (d == null)
627
631
  return -1;
628
- let d = 0;
629
- if (typeof g == "number" && typeof c == "number")
630
- d = g - c;
631
- else if (typeof g == "boolean" && typeof c == "boolean")
632
- d = g === c ? 0 : g ? -1 : 1;
633
- else if (g instanceof Date && c instanceof Date)
634
- d = g.getTime() - c.getTime();
635
- else if (typeof g == "string" && typeof c == "string" && Le(g) && Le(c))
636
- d = new Date(g).getTime() - new Date(c).getTime();
632
+ let c = 0;
633
+ if (typeof m == "number" && typeof d == "number")
634
+ c = m - d;
635
+ else if (typeof m == "boolean" && typeof d == "boolean")
636
+ c = m === d ? 0 : m ? -1 : 1;
637
+ else if (m instanceof Date && d instanceof Date)
638
+ c = m.getTime() - d.getTime();
639
+ else if (typeof m == "string" && typeof d == "string" && Ve(m) && Ve(d))
640
+ c = new Date(m).getTime() - new Date(d).getTime();
637
641
  else {
638
- const a = String(g), u = String(c);
639
- d = a.localeCompare(u, void 0, {
642
+ const n = String(m), f = String(d);
643
+ c = n.localeCompare(f, void 0, {
640
644
  numeric: !0,
641
645
  sensitivity: "base"
642
646
  });
643
647
  }
644
- return n === "desc" ? -d : d;
645
- }), l);
648
+ return o === "desc" ? -c : c;
649
+ }), i);
646
650
  }
647
- function Le(e) {
651
+ function Ve(e) {
648
652
  return e.length < 10 ? !1 : /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(e);
649
653
  }
650
- function Xt({
654
+ function dr({
651
655
  data: e,
652
656
  api: t,
653
- columns: n,
657
+ columns: o,
654
658
  searchQuery: s,
655
- sortBy: l,
656
- sortOrder: r,
657
- page: i,
658
- pageSize: g,
659
+ sortBy: i,
660
+ sortOrder: a,
661
+ page: l,
662
+ pageSize: m,
663
+ paginationEnabled: d = !0,
659
664
  manualLoading: c
660
665
  }) {
661
- const d = !!(t && typeof t.fetcher == "function"), a = d && t?.mode !== "client", [u, m] = A([]), [f, b] = A(0), [h, k] = A(!1), [T, $] = A(null), [p, w] = A(0), x = Tt(null), M = N(async () => {
662
- if (!d || !t?.fetcher) return;
663
- x.current && x.current.abort();
664
- const D = new AbortController();
665
- x.current = D, k(!0), $(null);
666
- const _ = t.paramNames || {}, F = _.pageParam || "page", Z = _.pageSizeParam || "limit", O = _.searchParam || "q", R = _.sortByParam || "sortBy", L = _.sortOrderParam || "sortOrder", U = {
667
- [F]: i,
668
- [Z]: g,
669
- page: i,
670
- pageSize: g,
671
- ...s ? { [O]: s, search: s, q: s } : {},
672
- ...l ? { [R]: l, sortBy: l } : {},
673
- ...r ? { [L]: r, sortOrder: r } : {},
666
+ const n = !!(t && typeof t.fetcher == "function"), f = n && t?.mode !== "client", [g, u] = P([]), [b, y] = P(0), [v, T] = P(!1), [B, E] = P(null), [p, x] = P(0), k = de(null), w = S(async () => {
667
+ if (!n || !t?.fetcher) return;
668
+ k.current && k.current.abort();
669
+ const M = new AbortController();
670
+ k.current = M, T(!0), E(null);
671
+ const z = t.paramNames || {}, I = z.pageParam || "page", Q = z.pageSizeParam || "limit", K = z.searchParam || "q", U = z.sortByParam || "sortBy", L = z.sortOrderParam || "sortOrder", H = {
672
+ [I]: l,
673
+ [Q]: m,
674
+ page: l,
675
+ pageSize: m,
676
+ ...s ? { [K]: s, search: s, q: s } : {},
677
+ ...i ? { [U]: i, sortBy: i } : {},
678
+ ...a ? { [L]: a, sortOrder: a } : {},
674
679
  ...t.params || {}
675
680
  };
676
681
  try {
677
- const P = await t.fetcher(U, D.signal);
678
- if (D.signal.aborted) return;
679
- const H = Zt(
680
- P,
682
+ const R = await t.fetcher(H, M.signal);
683
+ if (M.signal.aborted) return;
684
+ const V = sr(
685
+ R,
681
686
  t,
682
- U
687
+ H
683
688
  );
684
- m(H.data), b(H.meta.total), t.onSuccess?.(H);
685
- } catch (P) {
686
- if (P?.name === "AbortError" || P?.name === "CanceledError")
689
+ u(V.data), y(V.meta.total), t.onSuccess?.(V);
690
+ } catch (R) {
691
+ if (R?.name === "AbortError" || R?.name === "CanceledError")
687
692
  return;
688
- $(P), t.onError?.(P);
693
+ E(R), t.onError?.(R);
689
694
  } finally {
690
- D.signal.aborted || k(!1);
695
+ M.signal.aborted || T(!1);
691
696
  }
692
- }, [d, t, i, g, s, l, r]);
693
- ne(() => {
694
- d && M();
695
- }, [M, p]), ne(() => () => {
696
- x.current && x.current.abort();
697
+ }, [n, t, l, m, s, i, a]);
698
+ G(() => {
699
+ n && w();
700
+ }, [w, p]), G(() => () => {
701
+ k.current && k.current.abort();
697
702
  }, []);
698
- const z = N(async () => {
699
- d && w((D) => D + 1);
700
- }, [d]), { displayRows: W, finalTotal: oe } = B(() => {
701
- if (a)
703
+ const D = S(async () => {
704
+ n && x((M) => M + 1);
705
+ }, [n]), { displayRows: h, finalTotal: j } = $(() => {
706
+ if (f)
702
707
  return {
703
- displayRows: u,
704
- finalTotal: f
708
+ displayRows: g,
709
+ finalTotal: b
705
710
  };
706
- const D = d ? u : e || [], _ = n.filter((P) => P.searchable !== !1).map((P) => P.key), F = Jt(D, s, _), O = n.find((P) => P.key === l)?.comparator, R = qt(F, l, r, O), L = (i - 1) * g;
711
+ const M = n ? g : e || [], z = o.filter((H) => H.searchable !== !1).map((H) => H.key), I = lr(M, s, z), K = o.find((H) => H.key === i)?.comparator, U = ir(I, i, a, K);
712
+ let L;
713
+ if (d) {
714
+ const H = (l - 1) * m;
715
+ L = U.slice(H, H + m);
716
+ } else
717
+ L = U;
707
718
  return {
708
- displayRows: R.slice(L, L + g),
709
- finalTotal: F.length
719
+ displayRows: L,
720
+ finalTotal: I.length
710
721
  };
711
722
  }, [
712
- a,
713
- d,
714
- u,
715
- e,
716
723
  f,
717
724
  n,
725
+ g,
726
+ e,
727
+ b,
728
+ o,
718
729
  s,
719
- l,
720
- r,
721
730
  i,
722
- g
731
+ a,
732
+ l,
733
+ m,
734
+ d
723
735
  ]);
724
736
  return {
725
- rows: W,
726
- totalRecords: oe,
727
- loading: c !== void 0 ? c : h,
728
- error: T,
729
- refresh: z,
730
- isServerMode: a,
731
- rawRemoteData: u
737
+ rows: h,
738
+ totalRecords: j,
739
+ loading: c !== void 0 ? c : v,
740
+ error: B,
741
+ refresh: D,
742
+ isServerMode: f,
743
+ rawRemoteData: g
732
744
  };
733
745
  }
734
- function Qt({
746
+ function cr({
735
747
  tableRef: e,
736
748
  refresh: t,
737
- resetPagination: n,
749
+ resetPagination: o,
738
750
  resetSearch: s,
739
- resetSorting: l,
740
- setPage: r,
741
- setPageSize: i,
742
- setSearch: g,
743
- setSorting: c,
744
- selectedRows: d,
745
- clearSelection: a,
746
- getState: u
751
+ resetSorting: i,
752
+ setPage: a,
753
+ setPageSize: l,
754
+ setSearch: m,
755
+ setSorting: d,
756
+ selectedRows: c,
757
+ clearSelection: n,
758
+ getState: f,
759
+ scrollToIndex: g
747
760
  }) {
748
- Pt(
761
+ Wt(
749
762
  e,
750
763
  () => ({
751
764
  refresh: t,
752
765
  reset: () => {
753
- n(), s(), l(), a();
766
+ o(), s(), i(), n();
754
767
  },
755
768
  resetSearch: s,
756
- resetSorting: l,
757
- resetPagination: n,
758
- setPage: r,
759
- setPageSize: i,
760
- setSearch: g,
761
- setSorting: c,
762
- getSelectedRows: () => d,
763
- clearSelection: a,
764
- getState: u
769
+ resetSorting: i,
770
+ resetPagination: o,
771
+ setPage: a,
772
+ setPageSize: l,
773
+ setSearch: m,
774
+ setSorting: d,
775
+ getSelectedRows: () => c,
776
+ clearSelection: n,
777
+ getState: f,
778
+ scrollToIndex: g
765
779
  }),
766
780
  [
767
781
  t,
768
- n,
782
+ o,
769
783
  s,
770
- l,
771
- r,
772
784
  i,
773
- g,
774
- c,
775
- d,
776
785
  a,
777
- u
786
+ l,
787
+ m,
788
+ d,
789
+ c,
790
+ n,
791
+ f,
792
+ g
778
793
  ]
779
794
  );
780
795
  }
781
- function er({
796
+ function mr({
782
797
  rows: e,
783
798
  rowKeyResolver: t,
784
- onSelectionChange: n
799
+ onSelectionChange: o
785
800
  }) {
786
- const [s, l] = A(/* @__PURE__ */ new Set()), r = N(
787
- (u, m) => {
788
- l((f) => {
789
- const b = new Set(f);
790
- b.has(u) ? b.delete(u) : b.add(u);
791
- const h = e.filter((k, T) => b.has(t(k, T)));
792
- return n?.(h, Array.from(b)), b;
801
+ const [s, i] = P(/* @__PURE__ */ new Set()), a = de(/* @__PURE__ */ new Map());
802
+ G(() => {
803
+ e && e.length > 0 && e.forEach((g, u) => {
804
+ const b = t(g, u);
805
+ s.has(b) && a.current.set(b, g);
806
+ });
807
+ }, [e, s, t]);
808
+ const l = S(
809
+ (g, u) => {
810
+ i((b) => {
811
+ const y = new Set(b);
812
+ y.has(g) ? (y.delete(g), a.current.delete(g)) : (y.add(g), a.current.set(g, u));
813
+ const v = Array.from(y).map(
814
+ (T) => a.current.get(T) || e.find((B, E) => t(B, E) === T)
815
+ ).filter(Boolean);
816
+ return o?.(v, Array.from(y)), y;
793
817
  });
794
818
  },
795
- [e, t, n]
796
- ), i = N(() => {
819
+ [e, t, o]
820
+ ), m = S(() => {
797
821
  if (s.size === e.length && e.length > 0)
798
- l(/* @__PURE__ */ new Set()), n?.([], []);
822
+ i(/* @__PURE__ */ new Set()), a.current.clear(), o?.([], []);
799
823
  else {
800
- const u = new Set(e.map((m, f) => t(m, f)));
801
- l(u), n?.(e, Array.from(u));
824
+ const g = new Set(e.map((u, b) => t(u, b)));
825
+ e.forEach((u, b) => {
826
+ a.current.set(t(u, b), u);
827
+ }), i(g), o?.(e, Array.from(g));
802
828
  }
803
- }, [e, s.size, t, n]), g = N(() => {
804
- l(/* @__PURE__ */ new Set()), n?.([], []);
805
- }, [n]), c = e.length > 0 && s.size === e.length, d = s.size > 0 && s.size < e.length, a = B(
806
- () => e.filter((u, m) => s.has(t(u, m))),
807
- [e, s, t]
808
- );
829
+ }, [e, s.size, t, o]), d = S(() => {
830
+ i(/* @__PURE__ */ new Set()), a.current.clear(), o?.([], []);
831
+ }, [o]), c = e.length > 0 && s.size === e.length, n = s.size > 0 && s.size < e.length, f = $(() => Array.from(s).map(
832
+ (g) => a.current.get(g) || e.find((u, b) => t(u, b) === g)
833
+ ).filter(Boolean), [e, s, t]);
809
834
  return {
810
835
  selectedKeys: s,
811
- setSelectedKeys: l,
812
- selectedRows: a,
813
- onToggleSelectRow: r,
814
- handleToggleSelectAll: i,
815
- clearSelection: g,
836
+ setSelectedKeys: i,
837
+ selectedRows: f,
838
+ onToggleSelectRow: l,
839
+ handleToggleSelectAll: m,
840
+ clearSelection: d,
816
841
  allSelected: c,
817
- isIndeterminate: d
842
+ isIndeterminate: n
843
+ };
844
+ }
845
+ function gr({
846
+ config: e,
847
+ totalCount: t,
848
+ scrollContainerRef: o
849
+ }) {
850
+ const s = $(() => typeof e == "object" && e !== null ? {
851
+ enabled: e.enabled !== !1,
852
+ rowHeight: e.rowHeight ?? 48,
853
+ maxHeight: e.maxHeight ?? 520,
854
+ overscan: e.overscan ?? 10
855
+ } : {
856
+ enabled: !!e,
857
+ rowHeight: 48,
858
+ maxHeight: 520,
859
+ overscan: 10
860
+ }, [e]), i = !!(s.enabled && t > 0), a = s.rowHeight || 48, l = s.maxHeight || 520, m = s.overscan ?? 10, [d, c] = P(0), [n, f] = P(
861
+ typeof l == "number" ? l : 520
862
+ ), g = de(null);
863
+ G(() => {
864
+ if (!i) return;
865
+ const p = o.current;
866
+ if (!p) return;
867
+ p.clientHeight > 0 && f(p.clientHeight);
868
+ const x = () => {
869
+ g.current !== null && cancelAnimationFrame(g.current), g.current = requestAnimationFrame(() => {
870
+ p && c(p.scrollTop);
871
+ });
872
+ };
873
+ p.addEventListener("scroll", x, { passive: !0 });
874
+ let k = null;
875
+ return typeof ResizeObserver < "u" && (k = new ResizeObserver((w) => {
876
+ for (const D of w) {
877
+ const h = D.contentRect;
878
+ h.height > 0 && f(h.height);
879
+ }
880
+ }), k.observe(p)), () => {
881
+ p.removeEventListener("scroll", x), g.current !== null && cancelAnimationFrame(g.current), k && k.disconnect();
882
+ };
883
+ }, [i, o]);
884
+ const u = t * a, { startIndex: b, endIndex: y, paddingTop: v, paddingBottom: T } = $(() => {
885
+ if (!i || t === 0)
886
+ return {
887
+ startIndex: 0,
888
+ endIndex: Math.max(0, t - 1),
889
+ paddingTop: 0,
890
+ paddingBottom: 0
891
+ };
892
+ const p = Math.floor(d / a), x = Math.ceil(n / a), k = Math.max(0, p - m), w = Math.min(t - 1, p + x + m), D = k * a, h = Math.max(0, (t - 1 - w) * a);
893
+ return {
894
+ startIndex: k,
895
+ endIndex: w,
896
+ paddingTop: D,
897
+ paddingBottom: h
898
+ };
899
+ }, [i, t, a, d, n, m]), B = S(
900
+ (p, x = "auto") => {
901
+ const k = o.current;
902
+ if (!k) return;
903
+ const w = p * a, D = k.scrollTop, h = k.clientHeight || (typeof l == "number" ? l : 520);
904
+ let j = w;
905
+ if (x === "start")
906
+ j = w;
907
+ else if (x === "end")
908
+ j = w - h + a;
909
+ else if (x === "center")
910
+ j = w - h / 2 + a / 2;
911
+ else if (w < D)
912
+ j = w;
913
+ else if (w + a > D + h)
914
+ j = w - h + a;
915
+ else
916
+ return;
917
+ const M = Math.max(0, Math.min(j, u - h));
918
+ typeof k.scrollTo == "function" ? k.scrollTo({
919
+ top: M,
920
+ behavior: "smooth"
921
+ }) : k.scrollTop = M;
922
+ },
923
+ [a, l, u, o]
924
+ ), E = S(
925
+ (p) => i ? p.slice(b, y + 1) : p,
926
+ [i, b, y]
927
+ );
928
+ return {
929
+ isVirtualized: i,
930
+ totalHeight: u,
931
+ paddingTop: v,
932
+ paddingBottom: T,
933
+ startIndex: b,
934
+ endIndex: y,
935
+ rowHeight: a,
936
+ maxHeight: l,
937
+ scrollToIndex: B,
938
+ sliceRows: E
818
939
  };
819
940
  }
820
- const Ye = {
941
+ const Qe = {
821
942
  primary: "#2667EC",
822
943
  primaryHover: "#1E54C6",
823
944
  primaryLight: "#397FF6",
@@ -836,9 +957,9 @@ const Ye = {
836
957
  inputBg: "#1E293B",
837
958
  rowHover: "rgba(38, 103, 236, 0.04)",
838
959
  rowSelected: "rgba(38, 103, 236, 0.08)"
839
- }, He = {
960
+ }, Ye = {
840
961
  default: {
841
- colors: Ye,
962
+ colors: Qe,
842
963
  borderRadius: "1rem",
843
964
  density: "normal",
844
965
  classes: {
@@ -970,9 +1091,9 @@ const Ye = {
970
1091
  paginationButtonActive: "bg-blue-800 text-white font-bold"
971
1092
  }
972
1093
  }
973
- }, Ze = {
1094
+ }, et = {
974
1095
  mode: "auto",
975
- colors: Ye,
1096
+ colors: Qe,
976
1097
  borderRadius: "1rem",
977
1098
  fontFamily: "'Alexandria', system-ui, -apple-system, sans-serif",
978
1099
  density: "normal",
@@ -992,278 +1113,252 @@ const Ye = {
992
1113
  paginationButtonActive: "bg-primary text-white hover:bg-primary-soft shadow-md shadow-primary/30",
993
1114
  paginationSelect: "h-9 px-3 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-sm font-medium text-gray-700 dark:text-gray-300 focus:outline-none focus:border-primary cursor-pointer"
994
1115
  }
995
- }, fe = Et(Ze), tr = ({
1116
+ }, xe = Ft(et), ur = ({
996
1117
  theme: e,
997
1118
  preset: t,
998
- children: n
1119
+ children: o
999
1120
  }) => {
1000
- const s = Ve(fe), l = B(() => {
1001
- const r = s || Ze, i = t && He[t] ? He[t] : {};
1121
+ const s = qe(xe), i = $(() => {
1122
+ const a = s || et, l = t && Ye[t] ? Ye[t] : {};
1002
1123
  return {
1003
- ...r,
1004
- ...i,
1124
+ ...a,
1125
+ ...l,
1005
1126
  ...e || {},
1006
1127
  colors: {
1007
- ...r.colors,
1008
- ...i.colors || {},
1128
+ ...a.colors,
1129
+ ...l.colors || {},
1009
1130
  ...e?.colors || {}
1010
1131
  },
1011
1132
  classes: {
1012
- ...r.classes,
1013
- ...i.classes || {},
1133
+ ...a.classes,
1134
+ ...l.classes || {},
1014
1135
  ...e?.classes || {}
1015
1136
  }
1016
1137
  };
1017
1138
  }, [s, t, e]);
1018
- return /* @__PURE__ */ o(fe.Provider, { value: l, children: n });
1139
+ return /* @__PURE__ */ r.createElement(xe.Provider, { value: i }, o);
1019
1140
  };
1020
- function Y() {
1021
- return Ve(fe);
1141
+ function X() {
1142
+ return qe(xe);
1022
1143
  }
1023
- const rr = ({
1144
+ function br({
1024
1145
  value: e,
1025
1146
  onChange: t,
1026
- onClear: n,
1147
+ onClear: o,
1027
1148
  isDebouncing: s = !1,
1028
- placeholder: l = "Search records..."
1029
- }) => {
1030
- const r = Y();
1031
- return /* @__PURE__ */ y("div", { className: r.classes?.searchContainer || "w-full sm:max-w-md relative flex items-center", children: [
1032
- /* @__PURE__ */ o("span", { className: "absolute left-3.5 text-gray-400 dark:text-gray-500 pointer-events-none flex items-center", children: /* @__PURE__ */ o(
1149
+ placeholder: i = "Search records..."
1150
+ }) {
1151
+ const a = X();
1152
+ return /* @__PURE__ */ r.createElement("div", { className: a.classes?.searchContainer || "w-full sm:max-w-md relative flex items-center" }, /* @__PURE__ */ r.createElement("span", { className: "absolute left-3.5 text-gray-400 dark:text-gray-500 pointer-events-none flex items-center" }, /* @__PURE__ */ r.createElement(
1153
+ "svg",
1154
+ {
1155
+ className: "w-4 h-4",
1156
+ fill: "none",
1157
+ stroke: "currentColor",
1158
+ viewBox: "0 0 24 24",
1159
+ xmlns: "http://www.w3.org/2000/svg"
1160
+ },
1161
+ /* @__PURE__ */ r.createElement(
1162
+ "path",
1163
+ {
1164
+ strokeLinecap: "round",
1165
+ strokeLinejoin: "round",
1166
+ strokeWidth: 2,
1167
+ d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
1168
+ }
1169
+ )
1170
+ )), /* @__PURE__ */ r.createElement(
1171
+ "input",
1172
+ {
1173
+ type: "text",
1174
+ value: e,
1175
+ onChange: (l) => t(l.target.value),
1176
+ placeholder: i,
1177
+ className: a.classes?.searchInput || "w-full pl-10 pr-10 py-2.5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-sm font-medium text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary transition-all"
1178
+ }
1179
+ ), /* @__PURE__ */ r.createElement("div", { className: "absolute right-3 flex items-center gap-1.5" }, s && /* @__PURE__ */ r.createElement("span", { className: "w-3.5 h-3.5 border-2 border-primary border-t-transparent rounded-full animate-spin" }), e && /* @__PURE__ */ r.createElement(
1180
+ "button",
1181
+ {
1182
+ type: "button",
1183
+ onClick: o,
1184
+ className: "p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",
1185
+ title: "Clear search"
1186
+ },
1187
+ /* @__PURE__ */ r.createElement(
1033
1188
  "svg",
1034
1189
  {
1035
- className: "w-4 h-4",
1190
+ className: "w-3.5 h-3.5",
1036
1191
  fill: "none",
1037
1192
  stroke: "currentColor",
1038
1193
  viewBox: "0 0 24 24",
1039
- xmlns: "http://www.w3.org/2000/svg",
1040
- children: /* @__PURE__ */ o(
1041
- "path",
1042
- {
1043
- strokeLinecap: "round",
1044
- strokeLinejoin: "round",
1045
- strokeWidth: 2,
1046
- d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
1047
- }
1048
- )
1049
- }
1050
- ) }),
1051
- /* @__PURE__ */ o(
1052
- "input",
1053
- {
1054
- type: "text",
1055
- value: e,
1056
- onChange: (i) => t(i.target.value),
1057
- placeholder: l,
1058
- className: r.classes?.searchInput || "w-full pl-10 pr-10 py-2.5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-sm font-medium text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary transition-all"
1059
- }
1060
- ),
1061
- /* @__PURE__ */ y("div", { className: "absolute right-3 flex items-center gap-1.5", children: [
1062
- s && /* @__PURE__ */ o("span", { className: "w-3.5 h-3.5 border-2 border-primary border-t-transparent rounded-full animate-spin" }),
1063
- e && /* @__PURE__ */ o(
1064
- "button",
1065
- {
1066
- type: "button",
1067
- onClick: n,
1068
- className: "p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",
1069
- title: "Clear search",
1070
- children: /* @__PURE__ */ o(
1071
- "svg",
1072
- {
1073
- className: "w-3.5 h-3.5",
1074
- fill: "none",
1075
- stroke: "currentColor",
1076
- viewBox: "0 0 24 24",
1077
- xmlns: "http://www.w3.org/2000/svg",
1078
- children: /* @__PURE__ */ o("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })
1079
- }
1080
- )
1081
- }
1082
- )
1083
- ] })
1084
- ] });
1085
- }, ar = ({
1194
+ xmlns: "http://www.w3.org/2000/svg"
1195
+ },
1196
+ /* @__PURE__ */ r.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })
1197
+ )
1198
+ )));
1199
+ }
1200
+ function fr({
1086
1201
  displayTitle: e,
1087
1202
  subtitle: t,
1088
- isSearchEnabled: n,
1203
+ isSearchEnabled: o,
1089
1204
  searchQuery: s = "",
1090
- setSearch: l,
1091
- clearSearch: r,
1092
- isDebouncing: i = !1,
1093
- searchPlaceholder: g,
1094
- headerActions: c,
1095
- add: d,
1096
- linkAdd: a,
1097
- addHandler: u
1098
- }) => !(e || t || n || c || d) ? null : /* @__PURE__ */ y("div", { className: "w-full flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-1", children: [
1099
- (e || t) && /* @__PURE__ */ y("div", { className: "flex flex-col", children: [
1100
- e && /* @__PURE__ */ o("h3", { className: "text-lg font-bold tracking-tight text-gray-900 dark:text-white flex items-center gap-2", children: e }),
1101
- t && /* @__PURE__ */ o("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-0.5", children: t })
1102
- ] }),
1103
- /* @__PURE__ */ y("div", { className: "flex flex-wrap items-center gap-3 w-full sm:w-auto justify-start sm:justify-end ml-auto", children: [
1104
- n && l && r && /* @__PURE__ */ o(
1105
- rr,
1106
- {
1107
- value: s,
1108
- onChange: l,
1109
- onClear: r,
1110
- isDebouncing: i,
1111
- placeholder: g
1112
- }
1113
- ),
1114
- c,
1115
- d && /* @__PURE__ */ y(
1116
- "button",
1117
- {
1118
- type: "button",
1119
- onClick: () => {
1120
- u ? u() : a && typeof window < "u" && (window.location.href = a);
1121
- },
1122
- className: "inline-flex items-center gap-2 px-4 py-2.5 rounded-xl bg-primary text-white text-xs sm:text-sm font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95 whitespace-nowrap",
1123
- children: [
1124
- /* @__PURE__ */ o("span", { children: "+" }),
1125
- /* @__PURE__ */ y("span", { children: [
1126
- "Add ",
1127
- e || "Record"
1128
- ] })
1129
- ]
1130
- }
1131
- )
1132
- ] })
1133
- ] }), nr = ({
1205
+ setSearch: i,
1206
+ clearSearch: a,
1207
+ isDebouncing: l = !1,
1208
+ searchPlaceholder: m,
1209
+ headerActions: d,
1210
+ add: c,
1211
+ linkAdd: n,
1212
+ addHandler: f
1213
+ }) {
1214
+ return !(e || t || o || d || c) ? null : /* @__PURE__ */ r.createElement("div", { className: "w-full flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-1" }, (e || t) && /* @__PURE__ */ r.createElement("div", { className: "flex flex-col" }, e && /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold tracking-tight text-gray-900 dark:text-white flex items-center gap-2" }, e), t && /* @__PURE__ */ r.createElement("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-0.5" }, t)), /* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap items-center gap-3 w-full sm:w-auto justify-start sm:justify-end ml-auto" }, o && i && a && /* @__PURE__ */ r.createElement(
1215
+ br,
1216
+ {
1217
+ value: s,
1218
+ onChange: i,
1219
+ onClear: a,
1220
+ isDebouncing: l,
1221
+ placeholder: m
1222
+ }
1223
+ ), d, c && /* @__PURE__ */ r.createElement(
1224
+ "button",
1225
+ {
1226
+ type: "button",
1227
+ onClick: () => {
1228
+ f ? f() : n && typeof window < "u" && (window.location.href = n);
1229
+ },
1230
+ className: "inline-flex items-center gap-2 px-4 py-2.5 rounded-xl bg-primary text-white text-xs sm:text-sm font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95 whitespace-nowrap"
1231
+ },
1232
+ /* @__PURE__ */ r.createElement("span", null, "+"),
1233
+ /* @__PURE__ */ r.createElement("span", null, "Add ", e || "Record")
1234
+ )));
1235
+ }
1236
+ function yr({
1134
1237
  columns: e,
1135
1238
  hasActions: t,
1136
- actionsTitle: n = "Actions",
1239
+ actionsTitle: o = "Actions",
1137
1240
  actionsWidth: s,
1138
- sortBy: l,
1139
- sortOrder: r,
1140
- onSort: i,
1141
- selectable: g,
1142
- allSelected: c,
1143
- isIndeterminate: d,
1144
- onToggleSelectAll: a,
1145
- headerClassName: u = ""
1146
- }) => {
1147
- const m = Y(), f = {};
1148
- return m.colors?.theadBg && (f.backgroundColor = m.colors.theadBg), m.colors?.theadText && (f.color = m.colors.theadText), /* @__PURE__ */ o(
1241
+ sortBy: i,
1242
+ sortOrder: a,
1243
+ onSort: l,
1244
+ selectable: m,
1245
+ allSelected: d,
1246
+ isIndeterminate: c,
1247
+ onToggleSelectAll: n,
1248
+ headerClassName: f = "",
1249
+ sticky: g = !1
1250
+ }) {
1251
+ const u = X(), b = {};
1252
+ return g && (b.position = "sticky", b.top = 0, b.zIndex = 10), u.colors?.theadBg && (b.backgroundColor = u.colors.theadBg), u.colors?.theadText && (b.color = u.colors.theadText), /* @__PURE__ */ r.createElement(
1149
1253
  "thead",
1150
1254
  {
1151
- style: f,
1152
- className: `${m.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${u}`,
1153
- children: /* @__PURE__ */ y("tr", { children: [
1154
- g && /* @__PURE__ */ o("th", { className: "w-10 px-4 py-3 text-center align-middle", children: /* @__PURE__ */ o(
1155
- "input",
1255
+ style: b,
1256
+ className: `${u.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${f}`
1257
+ },
1258
+ /* @__PURE__ */ r.createElement("tr", null, m && /* @__PURE__ */ r.createElement("th", { className: "w-10 px-4 py-3 text-center align-middle" }, /* @__PURE__ */ r.createElement(
1259
+ "input",
1260
+ {
1261
+ type: "checkbox",
1262
+ checked: d,
1263
+ ref: (y) => {
1264
+ y && (y.indeterminate = !!c);
1265
+ },
1266
+ onChange: n,
1267
+ className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1268
+ }
1269
+ )), e.map((y) => {
1270
+ const v = i === y.key, T = y.sortable !== !1 && !!l, B = y.align === "center" ? "text-center" : y.align === "right" ? "text-right" : "text-left";
1271
+ return /* @__PURE__ */ r.createElement(
1272
+ "th",
1273
+ {
1274
+ key: String(y.key),
1275
+ style: {
1276
+ width: y.width,
1277
+ minWidth: y.minWidth,
1278
+ maxWidth: y.maxWidth
1279
+ },
1280
+ onClick: () => T && l?.(String(y.key)),
1281
+ className: `${u.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${B} ${y.headerClassName || ""} ${T ? "cursor-pointer hover:text-primary transition-colors group" : ""}`
1282
+ },
1283
+ /* @__PURE__ */ r.createElement(
1284
+ "div",
1156
1285
  {
1157
- type: "checkbox",
1158
- checked: c,
1159
- ref: (b) => {
1160
- b && (b.indeterminate = !!d);
1161
- },
1162
- onChange: a,
1163
- className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1164
- }
1165
- ) }),
1166
- e.map((b) => {
1167
- const h = l === b.key, k = b.sortable !== !1 && !!i, T = b.align === "center" ? "text-center" : b.align === "right" ? "text-right" : "text-left";
1168
- return /* @__PURE__ */ o(
1169
- "th",
1286
+ className: `inline-flex items-center gap-1.5 ${y.align === "center" ? "justify-center" : y.align === "right" ? "justify-end" : "justify-start"}`
1287
+ },
1288
+ /* @__PURE__ */ r.createElement("span", null, y.title),
1289
+ T && /* @__PURE__ */ r.createElement(
1290
+ "span",
1170
1291
  {
1171
- style: {
1172
- width: b.width,
1173
- minWidth: b.minWidth,
1174
- maxWidth: b.maxWidth
1175
- },
1176
- onClick: () => k && i?.(String(b.key)),
1177
- className: `${m.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${T} ${b.headerClassName || ""} ${k ? "cursor-pointer hover:text-primary transition-colors group" : ""}`,
1178
- children: /* @__PURE__ */ y(
1179
- "div",
1180
- {
1181
- className: `inline-flex items-center gap-1.5 ${b.align === "center" ? "justify-center" : b.align === "right" ? "justify-end" : "justify-start"}`,
1182
- children: [
1183
- /* @__PURE__ */ o("span", { children: b.title }),
1184
- k && /* @__PURE__ */ o(
1185
- "span",
1186
- {
1187
- className: `inline-flex flex-col text-[10px] transition-transform ${h ? "text-primary scale-110" : "text-gray-400 opacity-40 group-hover:opacity-100"}`,
1188
- children: h ? r === "asc" ? "▲" : "▼" : /* @__PURE__ */ o("span", { className: "text-[9px] leading-none opacity-50", children: "▲▼" })
1189
- }
1190
- )
1191
- ]
1192
- }
1193
- )
1292
+ className: `inline-flex flex-col text-[10px] transition-transform ${v ? "text-primary scale-110" : "text-gray-400 opacity-40 group-hover:opacity-100"}`
1194
1293
  },
1195
- String(b.key)
1196
- );
1197
- }),
1198
- t && /* @__PURE__ */ o(
1199
- "th",
1200
- {
1201
- style: { width: s || "auto" },
1202
- className: `${m.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} text-right pr-6`,
1203
- children: n
1204
- }
1294
+ v ? a === "asc" ? "▲" : "▼" : /* @__PURE__ */ r.createElement("span", { className: "text-[9px] leading-none opacity-50" }, "▲▼")
1295
+ )
1205
1296
  )
1206
- ] })
1207
- }
1297
+ );
1298
+ }), t && /* @__PURE__ */ r.createElement(
1299
+ "th",
1300
+ {
1301
+ style: { width: s || "auto" },
1302
+ className: `${u.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} text-right pr-6`
1303
+ },
1304
+ o
1305
+ ))
1208
1306
  );
1209
- }, E = () => /* @__PURE__ */ o("span", { className: "text-gray-400 dark:text-gray-500 font-mono text-sm", children: "—" }), Je = ({ value: e }) => {
1307
+ }
1308
+ const _ = () => /* @__PURE__ */ r.createElement("span", { className: "text-gray-400 dark:text-gray-500 font-mono text-sm" }, "—");
1309
+ function tt({ value: e }) {
1210
1310
  if (e == null || e === "")
1211
- return /* @__PURE__ */ o(E, {});
1311
+ return /* @__PURE__ */ r.createElement(_, null);
1212
1312
  const t = String(e);
1213
- return /* @__PURE__ */ o("span", { className: "truncate block max-w-xs font-normal text-sm", title: t, children: t });
1214
- }, or = ({ value: e }) => {
1313
+ return /* @__PURE__ */ r.createElement("span", { className: "truncate block max-w-xs font-normal text-sm", title: t }, t);
1314
+ }
1315
+ function pr({ value: e }) {
1215
1316
  if (e == null || isNaN(Number(e)))
1216
- return /* @__PURE__ */ o(E, {});
1317
+ return /* @__PURE__ */ r.createElement(_, null);
1217
1318
  const t = Number(e);
1218
- return /* @__PURE__ */ o("span", { className: "font-mono text-sm font-medium", children: t.toLocaleString() });
1219
- }, sr = ({ value: e }) => {
1319
+ return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-medium" }, t.toLocaleString());
1320
+ }
1321
+ function xr({ value: e }) {
1220
1322
  if (e == null)
1221
- return /* @__PURE__ */ o(E, {});
1323
+ return /* @__PURE__ */ r.createElement(_, null);
1222
1324
  const t = !!e;
1223
- return /* @__PURE__ */ y(
1325
+ return /* @__PURE__ */ r.createElement(
1224
1326
  "span",
1225
1327
  {
1226
- className: `inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-semibold tracking-wide ${t ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20" : "bg-rose-500/10 text-rose-600 dark:text-rose-400 border border-rose-500/20"}`,
1227
- children: [
1228
- /* @__PURE__ */ o("span", { className: `w-1.5 h-1.5 rounded-full ${t ? "bg-emerald-500" : "bg-rose-500"}` }),
1229
- t ? "Yes" : "No"
1230
- ]
1231
- }
1328
+ className: `inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-semibold tracking-wide ${t ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20" : "bg-rose-500/10 text-rose-600 dark:text-rose-400 border border-rose-500/20"}`
1329
+ },
1330
+ /* @__PURE__ */ r.createElement("span", { className: `w-1.5 h-1.5 rounded-full ${t ? "bg-emerald-500" : "bg-rose-500"}` }),
1331
+ t ? "Yes" : "No"
1232
1332
  );
1233
- }, Oe = ({
1234
- value: e,
1235
- isDateTime: t = !1
1236
- }) => {
1237
- if (!e) return /* @__PURE__ */ o(E, {});
1238
- const n = e instanceof Date ? e : new Date(e);
1239
- return isNaN(n.getTime()) ? /* @__PURE__ */ o(Je, { value: e, column: { key: "" } }) : /* @__PURE__ */ y("span", { className: "whitespace-nowrap text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300", children: [
1240
- n.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }),
1241
- t && /* @__PURE__ */ o("span", { className: "text-xs text-gray-400 dark:text-gray-500 ml-1.5", children: n.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" }) })
1242
- ] });
1243
- }, ir = ({ value: e, column: t }) => {
1333
+ }
1334
+ function Ge({ value: e, isDateTime: t = !1 }) {
1335
+ if (!e) return /* @__PURE__ */ r.createElement(_, null);
1336
+ const o = e instanceof Date ? e : new Date(e);
1337
+ return isNaN(o.getTime()) ? /* @__PURE__ */ r.createElement(tt, { value: e, column: { key: "" } }) : /* @__PURE__ */ r.createElement("span", { className: "whitespace-nowrap text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300" }, o.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }), t && /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-400 dark:text-gray-500 ml-1.5" }, o.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" })));
1338
+ }
1339
+ function hr({ value: e, column: t }) {
1244
1340
  if (e == null || isNaN(Number(e)))
1245
- return /* @__PURE__ */ o(E, {});
1246
- const n = Number(e), s = t.currency || "EGP";
1247
- return /* @__PURE__ */ y("span", { className: "font-mono text-sm font-bold text-gray-900 dark:text-white", children: [
1248
- n.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }),
1249
- " ",
1250
- /* @__PURE__ */ o("span", { className: "text-xs font-normal text-gray-500 dark:text-gray-400", children: s })
1251
- ] });
1252
- }, Re = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E", lr = ({ value: e }) => {
1341
+ return /* @__PURE__ */ r.createElement(_, null);
1342
+ const o = Number(e), s = t.currency || "EGP";
1343
+ return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-bold text-gray-900 dark:text-white" }, o.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), " ", /* @__PURE__ */ r.createElement("span", { className: "text-xs font-normal text-gray-500 dark:text-gray-400" }, s));
1344
+ }
1345
+ const Ke = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E";
1346
+ function kr({ value: e }) {
1253
1347
  let t = "";
1254
- return typeof e == "string" ? t = e : Array.isArray(e) && e.length > 0 ? t = typeof e[0] == "string" ? e[0] : e[0]?.url || "" : e && typeof e == "object" && (t = e.url || ""), t || (t = Re), /* @__PURE__ */ o("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ o(
1348
+ return typeof e == "string" ? t = e : Array.isArray(e) && e.length > 0 ? t = typeof e[0] == "string" ? e[0] : e[0]?.url || "" : e && typeof e == "object" && (t = e.url || ""), t || (t = Ke), /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center" }, /* @__PURE__ */ r.createElement(
1255
1349
  "img",
1256
1350
  {
1257
1351
  src: t,
1258
1352
  alt: "Thumbnail",
1259
1353
  className: "w-10 h-10 rounded-full object-cover border border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 shadow-sm",
1260
1354
  loading: "lazy",
1261
- onError: (n) => {
1262
- n.target.src = Re;
1355
+ onError: (o) => {
1356
+ o.target.src = Ke;
1263
1357
  }
1264
1358
  }
1265
- ) });
1266
- }, dr = {
1359
+ ));
1360
+ }
1361
+ const wr = {
1267
1362
  active: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
1268
1363
  delivered: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
1269
1364
  completed: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
@@ -1279,251 +1374,254 @@ const rr = ({
1279
1374
  cancelled: { bg: "bg-rose-500/10 border-rose-500/20", text: "text-rose-600 dark:text-rose-400", dot: "bg-rose-500" },
1280
1375
  offline: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" },
1281
1376
  closed: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" }
1282
- }, cr = ({ value: e, column: t }) => {
1377
+ };
1378
+ function vr({ value: e, column: t }) {
1283
1379
  if (e == null || e === "")
1284
- return /* @__PURE__ */ o(E, {});
1285
- const n = String(e), s = n.toLowerCase();
1286
- if (t.statusMap && t.statusMap[n]) {
1287
- const r = t.statusMap[n];
1288
- return /* @__PURE__ */ y(
1380
+ return /* @__PURE__ */ r.createElement(_, null);
1381
+ const o = String(e), s = o.toLowerCase();
1382
+ if (t.statusMap && t.statusMap[o]) {
1383
+ const a = t.statusMap[o];
1384
+ return /* @__PURE__ */ r.createElement(
1289
1385
  "span",
1290
1386
  {
1291
1387
  className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-bold uppercase tracking-wider border",
1292
- style: { color: r.color, backgroundColor: r.bg },
1293
- children: [
1294
- /* @__PURE__ */ o("span", { className: "w-1.5 h-1.5 rounded-full", style: { backgroundColor: r.color } }),
1295
- r.label || n
1296
- ]
1297
- }
1388
+ style: { color: a.color, backgroundColor: a.bg }
1389
+ },
1390
+ /* @__PURE__ */ r.createElement("span", { className: "w-1.5 h-1.5 rounded-full", style: { backgroundColor: a.color } }),
1391
+ a.label || o
1298
1392
  );
1299
1393
  }
1300
- const l = dr[s] || {
1394
+ const i = wr[s] || {
1301
1395
  bg: "bg-gray-500/10 border-gray-500/20",
1302
1396
  text: "text-gray-700 dark:text-gray-300",
1303
1397
  dot: "bg-gray-400"
1304
1398
  };
1305
- return /* @__PURE__ */ y(
1399
+ return /* @__PURE__ */ r.createElement(
1306
1400
  "span",
1307
1401
  {
1308
- className: `inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-bold uppercase tracking-wider border ${l.bg} ${l.text}`,
1309
- children: [
1310
- /* @__PURE__ */ o("span", { className: `w-1.5 h-1.5 rounded-full ${l.dot}` }),
1311
- n
1312
- ]
1313
- }
1402
+ className: `inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-bold uppercase tracking-wider border ${i.bg} ${i.text}`
1403
+ },
1404
+ /* @__PURE__ */ r.createElement("span", { className: `w-1.5 h-1.5 rounded-full ${i.dot}` }),
1405
+ o
1314
1406
  );
1315
- }, gr = ({ value: e }) => !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ o(E, {}) : /* @__PURE__ */ y("div", { className: "flex flex-wrap gap-1 items-center", children: [
1316
- e.slice(0, 3).map((t, n) => /* @__PURE__ */ o(
1407
+ }
1408
+ function Er({ value: e }) {
1409
+ return !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ r.createElement(_, null) : /* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap gap-1 items-center" }, e.slice(0, 3).map((t, o) => /* @__PURE__ */ r.createElement(
1317
1410
  "span",
1318
1411
  {
1319
- className: "inline-block px-2 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-gray-700",
1320
- children: typeof t == "object" ? JSON.stringify(t) : String(t)
1412
+ key: o,
1413
+ className: "inline-block px-2 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-gray-700"
1321
1414
  },
1322
- n
1323
- )),
1324
- e.length > 3 && /* @__PURE__ */ y("span", { className: "text-xs text-gray-400 font-medium", children: [
1325
- "+",
1326
- e.length - 3
1327
- ] })
1328
- ] }), br = ({ value: e }) => !e || typeof e != "object" ? /* @__PURE__ */ o(E, {}) : "en" in e || "ar" in e ? /* @__PURE__ */ o("span", { className: "font-medium text-sm", children: e.en || e.ar || "" }) : /* @__PURE__ */ o("span", { className: "font-mono text-xs text-gray-500 dark:text-gray-400 truncate block max-w-xs", title: JSON.stringify(e), children: JSON.stringify(e) }), mr = ({ value: e }) => {
1329
- if (!e) return /* @__PURE__ */ o(E, {});
1415
+ typeof t == "object" ? JSON.stringify(t) : String(t)
1416
+ )), e.length > 3 && /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-400 font-medium" }, "+", e.length - 3));
1417
+ }
1418
+ function Nr({ value: e }) {
1419
+ return !e || typeof e != "object" ? /* @__PURE__ */ r.createElement(_, null) : "en" in e || "ar" in e ? /* @__PURE__ */ r.createElement("span", { className: "font-medium text-sm" }, e.en || e.ar || "") : /* @__PURE__ */ r.createElement("span", { className: "font-mono text-xs text-gray-500 dark:text-gray-400 truncate block max-w-xs", title: JSON.stringify(e) }, JSON.stringify(e));
1420
+ }
1421
+ function Ar({ value: e }) {
1422
+ if (!e) return /* @__PURE__ */ r.createElement(_, null);
1330
1423
  const t = String(e);
1331
- return /* @__PURE__ */ y(
1424
+ return /* @__PURE__ */ r.createElement(
1332
1425
  "a",
1333
1426
  {
1334
1427
  href: t,
1335
1428
  target: "_blank",
1336
1429
  rel: "noopener noreferrer",
1337
- className: "text-primary hover:underline text-sm font-medium inline-flex items-center gap-1",
1338
- children: [
1339
- /* @__PURE__ */ o("span", { className: "truncate max-w-[150px]", children: t }),
1340
- /* @__PURE__ */ o("span", { className: "text-xs", children: "↗" })
1341
- ]
1342
- }
1430
+ className: "text-primary hover:underline text-sm font-medium inline-flex items-center gap-1"
1431
+ },
1432
+ /* @__PURE__ */ r.createElement("span", { className: "truncate max-w-[150px]" }, t),
1433
+ /* @__PURE__ */ r.createElement("span", { className: "text-xs" }, "↗")
1343
1434
  );
1344
- }, ur = ({ value: e }) => {
1345
- if (!e) return /* @__PURE__ */ o(E, {});
1435
+ }
1436
+ function Tr({ value: e }) {
1437
+ if (!e) return /* @__PURE__ */ r.createElement(_, null);
1346
1438
  const t = String(e);
1347
- return /* @__PURE__ */ o(
1439
+ return /* @__PURE__ */ r.createElement(
1348
1440
  "a",
1349
1441
  {
1350
1442
  href: `mailto:${t}`,
1351
- className: "text-primary hover:underline text-sm font-medium truncate block max-w-xs",
1352
- children: t
1353
- }
1443
+ className: "text-primary hover:underline text-sm font-medium truncate block max-w-xs"
1444
+ },
1445
+ t
1354
1446
  );
1355
- }, fr = ({ value: e }) => {
1356
- if (!e) return /* @__PURE__ */ o(E, {});
1447
+ }
1448
+ function Sr({ value: e }) {
1449
+ if (!e) return /* @__PURE__ */ r.createElement(_, null);
1357
1450
  const t = String(e);
1358
- return /* @__PURE__ */ o(
1451
+ return /* @__PURE__ */ r.createElement(
1359
1452
  "a",
1360
1453
  {
1361
1454
  href: `tel:${t}`,
1362
- className: "font-mono text-sm text-gray-800 dark:text-gray-200 hover:text-primary transition-colors",
1363
- children: t
1364
- }
1455
+ className: "font-mono text-sm text-gray-800 dark:text-gray-200 hover:text-primary transition-colors"
1456
+ },
1457
+ t
1365
1458
  );
1366
- }, yr = ({ value: e }) => {
1459
+ }
1460
+ function Cr({ value: e }) {
1367
1461
  if (e == null || isNaN(Number(e)))
1368
- return /* @__PURE__ */ o(E, {});
1369
- const t = Math.min(100, Math.max(0, Math.round(Number(e)))), n = t >= 80 ? "bg-emerald-500" : t >= 50 ? "bg-blue-500" : t >= 30 ? "bg-amber-500" : "bg-rose-500";
1370
- return /* @__PURE__ */ y("div", { className: "flex items-center gap-2.5 min-w-[120px]", children: [
1371
- /* @__PURE__ */ o("div", { className: "flex-1 h-2 rounded-full bg-gray-200 dark:bg-slate-700 overflow-hidden", children: /* @__PURE__ */ o(
1372
- "div",
1373
- {
1374
- className: `h-full rounded-full ${n} transition-all duration-500`,
1375
- style: { width: `${t}%` }
1376
- }
1377
- ) }),
1378
- /* @__PURE__ */ y("span", { className: "font-mono text-xs font-bold text-gray-700 dark:text-gray-300 w-9 text-right", children: [
1379
- t,
1380
- "%"
1381
- ] })
1382
- ] });
1383
- }, hr = ({ value: e }) => {
1462
+ return /* @__PURE__ */ r.createElement(_, null);
1463
+ const t = Math.min(100, Math.max(0, Math.round(Number(e)))), o = t >= 80 ? "bg-emerald-500" : t >= 50 ? "bg-blue-500" : t >= 30 ? "bg-amber-500" : "bg-rose-500";
1464
+ return /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-2.5 min-w-[120px]" }, /* @__PURE__ */ r.createElement("div", { className: "flex-1 h-2 rounded-full bg-gray-200 dark:bg-slate-700 overflow-hidden" }, /* @__PURE__ */ r.createElement(
1465
+ "div",
1466
+ {
1467
+ className: `h-full rounded-full ${o} transition-all duration-500`,
1468
+ style: { width: `${t}%` }
1469
+ }
1470
+ )), /* @__PURE__ */ r.createElement("span", { className: "font-mono text-xs font-bold text-gray-700 dark:text-gray-300 w-9 text-right" }, t, "%"));
1471
+ }
1472
+ function Pr({ value: e }) {
1384
1473
  if (e == null || isNaN(Number(e)))
1385
- return /* @__PURE__ */ o(E, {});
1474
+ return /* @__PURE__ */ r.createElement(_, null);
1386
1475
  const t = Number(e);
1387
- return /* @__PURE__ */ y("div", { className: "inline-flex items-center gap-1.5 font-medium text-xs text-amber-500", children: [
1388
- /* @__PURE__ */ o("span", { className: "text-sm", children: "★" }),
1389
- /* @__PURE__ */ o("span", { className: "font-bold text-gray-900 dark:text-gray-100", children: t.toFixed(1) }),
1390
- /* @__PURE__ */ o("span", { className: "text-gray-400 dark:text-gray-500 text-[10px]", children: "/ 5" })
1391
- ] });
1392
- }, pr = ({ value: e }) => {
1476
+ return /* @__PURE__ */ r.createElement("div", { className: "inline-flex items-center gap-1.5 font-medium text-xs text-amber-500" }, /* @__PURE__ */ r.createElement("span", { className: "text-sm" }, "★"), /* @__PURE__ */ r.createElement("span", { className: "font-bold text-gray-900 dark:text-gray-100" }, t.toFixed(1)), /* @__PURE__ */ r.createElement("span", { className: "text-gray-400 dark:text-gray-500 text-[10px]" }, "/ 5"));
1477
+ }
1478
+ function $r({ value: e }) {
1393
1479
  if (e == null || e === "")
1394
- return /* @__PURE__ */ o(E, {});
1480
+ return /* @__PURE__ */ r.createElement(_, null);
1395
1481
  const t = String(e);
1396
- return /* @__PURE__ */ o("span", { className: "inline-flex items-center px-2.5 py-0.5 rounded-lg text-xs font-bold bg-primary/10 text-primary border border-primary/20", children: t });
1397
- }, xr = ({ row: e, column: t, rowIndex: n }) => {
1398
- const s = S(e, t.key);
1482
+ return /* @__PURE__ */ r.createElement("span", { className: "inline-flex items-center px-2.5 py-0.5 rounded-lg text-xs font-bold bg-primary/10 text-primary border border-primary/20" }, t);
1483
+ }
1484
+ function Br({
1485
+ row: e,
1486
+ column: t,
1487
+ rowIndex: o
1488
+ }) {
1489
+ const s = A(e, t.key);
1399
1490
  if (t.render && typeof t.render == "function")
1400
- return /* @__PURE__ */ o(me, { children: t.render(s, e, n) });
1491
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, t.render(s, e, o));
1401
1492
  if (t.formatter && typeof t.formatter == "function")
1402
- return /* @__PURE__ */ o(me, { children: t.formatter(s, e, n) });
1493
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, t.formatter(s, e, o));
1403
1494
  switch (t.type) {
1404
1495
  case "boolean":
1405
- return /* @__PURE__ */ o(sr, { value: s, column: t });
1496
+ return /* @__PURE__ */ r.createElement(xr, { value: s, column: t });
1406
1497
  case "number":
1407
- return /* @__PURE__ */ o(or, { value: s, column: t });
1498
+ return /* @__PURE__ */ r.createElement(pr, { value: s, column: t });
1408
1499
  case "currency":
1409
- return /* @__PURE__ */ o(ir, { value: s, column: t });
1500
+ return /* @__PURE__ */ r.createElement(hr, { value: s, column: t });
1410
1501
  case "date":
1411
- return /* @__PURE__ */ o(Oe, { value: s, column: t, isDateTime: !1 });
1502
+ return /* @__PURE__ */ r.createElement(Ge, { value: s, column: t, isDateTime: !1 });
1412
1503
  case "datetime":
1413
- return /* @__PURE__ */ o(Oe, { value: s, column: t, isDateTime: !0 });
1504
+ return /* @__PURE__ */ r.createElement(Ge, { value: s, column: t, isDateTime: !0 });
1414
1505
  case "image":
1415
- return /* @__PURE__ */ o(lr, { value: s, column: t });
1506
+ return /* @__PURE__ */ r.createElement(kr, { value: s, column: t });
1416
1507
  case "status":
1417
- return /* @__PURE__ */ o(cr, { value: s, column: t });
1508
+ return /* @__PURE__ */ r.createElement(vr, { value: s, column: t });
1418
1509
  case "progress":
1419
- return /* @__PURE__ */ o(yr, { value: s, column: t });
1510
+ return /* @__PURE__ */ r.createElement(Cr, { value: s, column: t });
1420
1511
  case "rating":
1421
- return /* @__PURE__ */ o(hr, { value: s, column: t });
1512
+ return /* @__PURE__ */ r.createElement(Pr, { value: s, column: t });
1422
1513
  case "badge":
1423
- return /* @__PURE__ */ o(pr, { value: s, column: t });
1514
+ return /* @__PURE__ */ r.createElement($r, { value: s, column: t });
1424
1515
  case "array":
1425
- return /* @__PURE__ */ o(gr, { value: s, column: t });
1516
+ return /* @__PURE__ */ r.createElement(Er, { value: s, column: t });
1426
1517
  case "object":
1427
- return /* @__PURE__ */ o(br, { value: s, column: t });
1518
+ return /* @__PURE__ */ r.createElement(Nr, { value: s, column: t });
1428
1519
  case "url":
1429
- return /* @__PURE__ */ o(mr, { value: s, column: t });
1520
+ return /* @__PURE__ */ r.createElement(Ar, { value: s, column: t });
1430
1521
  case "email":
1431
- return /* @__PURE__ */ o(ur, { value: s, column: t });
1522
+ return /* @__PURE__ */ r.createElement(Tr, { value: s, column: t });
1432
1523
  case "phone":
1433
- return /* @__PURE__ */ o(fr, { value: s, column: t });
1524
+ return /* @__PURE__ */ r.createElement(Sr, { value: s, column: t });
1434
1525
  default:
1435
- return /* @__PURE__ */ o(Je, { value: s, column: t });
1526
+ return /* @__PURE__ */ r.createElement(tt, { value: s, column: t });
1436
1527
  }
1437
- }, kr = ({
1528
+ }
1529
+ function Dr({
1438
1530
  isOpen: e,
1439
1531
  title: t,
1440
- message: n,
1532
+ message: o,
1441
1533
  confirmText: s = "Confirm",
1442
- cancelText: l = "Cancel",
1443
- type: r = "danger",
1444
- onClose: i,
1445
- onConfirm: g,
1446
- isLoading: c = !1
1447
- }) => (ne(() => {
1448
- const d = (a) => {
1449
- a.key === "Escape" && i();
1450
- };
1451
- return e && window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
1452
- }, [e, i]), e ? /* @__PURE__ */ o(
1453
- "div",
1454
- {
1455
- className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm any-table-fade-in",
1456
- onClick: i,
1457
- children: /* @__PURE__ */ y(
1534
+ cancelText: i = "Cancel",
1535
+ type: a = "danger",
1536
+ onClose: l,
1537
+ onConfirm: m,
1538
+ isLoading: d = !1
1539
+ }) {
1540
+ return G(() => {
1541
+ const c = (n) => {
1542
+ n.key === "Escape" && l();
1543
+ };
1544
+ return e && window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
1545
+ }, [e, l]), e ? /* @__PURE__ */ r.createElement(
1546
+ "div",
1547
+ {
1548
+ className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm any-table-fade-in",
1549
+ onClick: l
1550
+ },
1551
+ /* @__PURE__ */ r.createElement(
1458
1552
  "div",
1459
1553
  {
1460
1554
  className: "bg-white dark:bg-slate-900 border border-gray-200 dark:border-gray-800 w-full max-w-md rounded-2xl p-6 shadow-2xl transform transition-all text-center",
1461
- onClick: (d) => d.stopPropagation(),
1462
- role: "dialog",
1463
- children: [
1464
- /* @__PURE__ */ o(
1465
- "div",
1466
- {
1467
- className: `mx-auto mb-4 w-14 h-14 rounded-full flex items-center justify-center text-2xl ${r === "danger" ? "bg-rose-500/10 text-rose-500" : r === "warning" ? "bg-amber-500/10 text-amber-500" : "bg-blue-500/10 text-blue-500"}`,
1468
- children: r === "danger" ? "⚠️" : r === "warning" ? "⚡" : "ℹ️"
1469
- }
1470
- ),
1471
- /* @__PURE__ */ o("h3", { className: "text-xl font-black text-gray-900 dark:text-white mb-2", children: t }),
1472
- /* @__PURE__ */ o("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed", children: n }),
1473
- /* @__PURE__ */ y("div", { className: "flex items-center justify-center gap-3", children: [
1474
- /* @__PURE__ */ o(
1475
- "button",
1476
- {
1477
- type: "button",
1478
- disabled: c,
1479
- onClick: i,
1480
- className: "w-full py-2.5 px-4 rounded-xl border border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 font-bold text-sm hover:bg-gray-200 dark:hover:bg-slate-700 transition-colors disabled:opacity-50",
1481
- children: l
1482
- }
1483
- ),
1484
- /* @__PURE__ */ o(
1485
- "button",
1486
- {
1487
- type: "button",
1488
- disabled: c,
1489
- onClick: g,
1490
- className: `w-full py-2.5 px-4 rounded-xl font-bold text-sm text-white transition-all shadow-md active:scale-95 disabled:opacity-50 ${r === "danger" ? "bg-rose-600 hover:bg-rose-700 shadow-rose-600/30" : "bg-primary hover:bg-primary-soft shadow-primary/30"}`,
1491
- children: c ? "Processing..." : s
1492
- }
1493
- )
1494
- ] })
1495
- ]
1496
- }
1555
+ onClick: (c) => c.stopPropagation(),
1556
+ role: "dialog"
1557
+ },
1558
+ /* @__PURE__ */ r.createElement(
1559
+ "div",
1560
+ {
1561
+ className: `mx-auto mb-4 w-14 h-14 rounded-full flex items-center justify-center text-2xl ${a === "danger" ? "bg-rose-500/10 text-rose-500" : a === "warning" ? "bg-amber-500/10 text-amber-500" : "bg-blue-500/10 text-blue-500"}`
1562
+ },
1563
+ a === "danger" ? "⚠️" : a === "warning" ? "⚡" : "ℹ️"
1564
+ ),
1565
+ /* @__PURE__ */ r.createElement("h3", { className: "text-xl font-black text-gray-900 dark:text-white mb-2" }, t),
1566
+ /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed" }, o),
1567
+ /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center gap-3" }, /* @__PURE__ */ r.createElement(
1568
+ "button",
1569
+ {
1570
+ type: "button",
1571
+ disabled: d,
1572
+ onClick: l,
1573
+ className: "w-full py-2.5 px-4 rounded-xl border border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 font-bold text-sm hover:bg-gray-200 dark:hover:bg-slate-700 transition-colors disabled:opacity-50"
1574
+ },
1575
+ i
1576
+ ), /* @__PURE__ */ r.createElement(
1577
+ "button",
1578
+ {
1579
+ type: "button",
1580
+ disabled: d,
1581
+ onClick: m,
1582
+ className: `w-full py-2.5 px-4 rounded-xl font-bold text-sm text-white transition-all shadow-md active:scale-95 disabled:opacity-50 ${a === "danger" ? "bg-rose-600 hover:bg-rose-700 shadow-rose-600/30" : "bg-primary hover:bg-primary-soft shadow-primary/30"}`
1583
+ },
1584
+ d ? "Processing..." : s
1585
+ ))
1497
1586
  )
1498
- }
1499
- ) : null);
1500
- function qe(e, t) {
1587
+ ) : null;
1588
+ }
1589
+ function rt(e, t) {
1501
1590
  if (!e) return null;
1502
- if (Ke.isValidElement(e))
1591
+ if (r.isValidElement(e))
1503
1592
  return e;
1504
1593
  if (typeof e == "function") {
1505
- if (e.prototype && e.prototype.isReactComponent)
1506
- return /* @__PURE__ */ o(e, { className: "w-4 h-4 shrink-0" });
1507
- const n = e.displayName || e.name || "";
1508
- if (/^[A-Z]/.test(n))
1509
- return /* @__PURE__ */ o(e, { className: "w-4 h-4 shrink-0" });
1594
+ if (e.prototype && e.prototype.isReactComponent) {
1595
+ const i = e;
1596
+ return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1597
+ }
1598
+ const o = e.displayName || e.name || "";
1599
+ if (/^[A-Z]/.test(o)) {
1600
+ const i = e;
1601
+ return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1602
+ }
1510
1603
  try {
1511
- const l = e(t);
1512
- return qe(l, t);
1604
+ const i = e(t);
1605
+ return rt(i, t);
1513
1606
  } catch {
1514
- return /* @__PURE__ */ o(e, { className: "w-4 h-4 shrink-0" });
1607
+ const i = e;
1608
+ return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1515
1609
  }
1516
1610
  }
1517
- return typeof e == "object" && e !== null && (e.$$typeof || e.render) ? /* @__PURE__ */ o(e, { className: "w-4 h-4 shrink-0" }) : typeof e == "string" ? e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") || e.startsWith("./") || e.startsWith("data:image/") || /\.(png|jpe?g|svg|webp|gif|ico)$/i.test(e) ? /* @__PURE__ */ o(
1611
+ if (typeof e == "object" && e !== null && (e.$$typeof || e.render)) {
1612
+ const o = e;
1613
+ return /* @__PURE__ */ r.createElement(o, { className: "w-4 h-4 shrink-0" });
1614
+ }
1615
+ return typeof e == "string" ? e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") || e.startsWith("./") || e.startsWith("data:image/") || /\.(png|jpe?g|svg|webp|gif|ico)$/i.test(e) ? /* @__PURE__ */ r.createElement(
1518
1616
  "img",
1519
1617
  {
1520
1618
  src: e,
1521
1619
  alt: "action-icon",
1522
1620
  className: "w-4 h-4 object-contain shrink-0 inline-block"
1523
1621
  }
1524
- ) : /* @__PURE__ */ o("span", { className: "inline-flex items-center justify-center leading-none text-base", children: e }) : e;
1622
+ ) : /* @__PURE__ */ r.createElement("span", { className: "inline-flex items-center justify-center leading-none text-base" }, e) : e;
1525
1623
  }
1526
- const Ue = {
1624
+ const Ze = {
1527
1625
  primary: "bg-primary text-white hover:bg-primary-soft shadow-sm shadow-primary/20",
1528
1626
  secondary: "bg-emerald-600 text-white hover:bg-emerald-700 shadow-sm shadow-emerald-600/20",
1529
1627
  success: "bg-emerald-500 text-white hover:bg-emerald-600 shadow-sm shadow-emerald-500/20",
@@ -1532,718 +1630,724 @@ const Ue = {
1532
1630
  info: "bg-sky-500 text-white hover:bg-sky-600 shadow-sm shadow-sky-500/20",
1533
1631
  neutral: "bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-700 border border-gray-200 dark:border-gray-700",
1534
1632
  ghost: "bg-transparent text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white"
1535
- }, wr = ({ row: e, actions: t, context: n }) => {
1536
- const [s, l] = A(null), [r, i] = A({});
1633
+ };
1634
+ function Mr({
1635
+ row: e,
1636
+ actions: t,
1637
+ context: o
1638
+ }) {
1639
+ const [s, i] = P(null), [a, l] = P({});
1537
1640
  if (!t || !t.length)
1538
1641
  return null;
1539
- const g = async (a) => {
1540
- if (a.confirmation) {
1541
- const u = typeof a.confirmation.title == "function" ? a.confirmation.title(e) : a.confirmation.title || "Confirm Action", m = typeof a.confirmation.message == "function" ? a.confirmation.message(e) : a.confirmation.message || "Are you sure you want to perform this action?";
1542
- l({
1642
+ const m = async (n) => {
1643
+ if (n.confirmation) {
1644
+ const f = typeof n.confirmation.title == "function" ? n.confirmation.title(e) : n.confirmation.title || "Confirm Action", g = typeof n.confirmation.message == "function" ? n.confirmation.message(e) : n.confirmation.message || "Are you sure you want to perform this action?";
1645
+ i({
1543
1646
  isOpen: !0,
1544
- title: u,
1545
- message: m,
1546
- confirmText: a.confirmation.confirmText || "Confirm",
1547
- cancelText: a.confirmation.cancelText || "Cancel",
1548
- type: a.confirmation.type || "danger",
1647
+ title: f,
1648
+ message: g,
1649
+ confirmText: n.confirmation.confirmText || "Confirm",
1650
+ cancelText: n.confirmation.cancelText || "Cancel",
1651
+ type: n.confirmation.type || "danger",
1549
1652
  onConfirm: async () => {
1550
- l(null), await c(a);
1653
+ i(null), await d(n);
1551
1654
  }
1552
1655
  });
1553
1656
  return;
1554
1657
  }
1555
- await c(a);
1556
- }, c = async (a) => {
1557
- if (a.type === "button" || !a.type) {
1558
- i((u) => ({ ...u, [a.id]: !0 }));
1658
+ await d(n);
1659
+ }, d = async (n) => {
1660
+ if (n.type === "button" || !n.type) {
1661
+ l((f) => ({ ...f, [n.id]: !0 }));
1559
1662
  try {
1560
- await a.onClick(e, n);
1663
+ await n.onClick(e, o);
1561
1664
  } finally {
1562
- i((u) => ({ ...u, [a.id]: !1 }));
1665
+ l((f) => ({ ...f, [n.id]: !1 }));
1563
1666
  }
1564
1667
  }
1565
- }, d = async (a, u) => {
1566
- const m = !u;
1567
- i((f) => ({ ...f, [a.id]: !0 }));
1668
+ }, c = async (n, f) => {
1669
+ const g = !f;
1670
+ l((u) => ({ ...u, [n.id]: !0 }));
1568
1671
  try {
1569
- await a.onChange(e, m, n);
1672
+ await n.onChange(e, g, o);
1570
1673
  } finally {
1571
- i((f) => ({ ...f, [a.id]: !1 }));
1674
+ l((u) => ({ ...u, [n.id]: !1 }));
1572
1675
  }
1573
1676
  };
1574
- return /* @__PURE__ */ y(me, { children: [
1575
- /* @__PURE__ */ o("div", { className: "flex items-center justify-end gap-2 pr-2", children: t.map((a) => {
1576
- if (typeof a.hide == "function" && a.hide(e) || typeof a.show == "function" && !a.show(e)) return null;
1577
- const u = typeof a.disabled == "function" ? a.disabled(e) : !!a.disabled, m = r[a.id] || (typeof a.loading == "function" ? a.loading(e) : !!a.loading), f = typeof a.label == "function" ? a.label(e) : a.label, b = qe(a.icon, e), h = typeof a.tooltip == "function" ? a.tooltip(e) : a.tooltip, k = typeof a.className == "function" ? a.className(e) : a.className || "";
1578
- if (a.type === "custom" && a.render)
1579
- return /* @__PURE__ */ o(Ke.Fragment, { children: a.render(e, n) }, a.id);
1580
- if (a.type === "switch") {
1581
- const w = a, x = w.checked(e);
1582
- return /* @__PURE__ */ y(
1583
- "div",
1584
- {
1585
- className: "flex items-center gap-2",
1586
- title: h || f,
1587
- children: [
1588
- f && /* @__PURE__ */ y("span", { className: "text-xs font-semibold text-gray-500", children: [
1589
- f,
1590
- ":"
1591
- ] }),
1592
- /* @__PURE__ */ o(
1593
- "button",
1594
- {
1595
- type: "button",
1596
- role: "switch",
1597
- "aria-checked": x,
1598
- disabled: u || m,
1599
- onClick: () => d(w, x),
1600
- className: `relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${x ? "bg-emerald-500" : "bg-gray-300 dark:bg-gray-700"} ${k}`,
1601
- children: /* @__PURE__ */ o(
1602
- "span",
1603
- {
1604
- "aria-hidden": "true",
1605
- className: `pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out flex items-center justify-center ${x ? "translate-x-5" : "translate-x-0"}`,
1606
- children: m && /* @__PURE__ */ o("span", { className: "w-2.5 h-2.5 border-2 border-primary border-t-transparent rounded-full animate-spin" })
1607
- }
1608
- )
1609
- }
1610
- )
1611
- ]
1612
- },
1613
- a.id
1614
- );
1615
- }
1616
- const T = typeof a.variant == "function" ? a.variant(e) : a.variant || "neutral", $ = Ue[T] || Ue.neutral, p = !f && b ? "p-2 min-w-[2rem]" : "px-3 py-1.5";
1617
- return /* @__PURE__ */ y(
1618
- "button",
1677
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-end gap-2 pr-2" }, t.map((n) => {
1678
+ if (typeof n.hide == "function" && n.hide(e) || typeof n.show == "function" && !n.show(e)) return null;
1679
+ const f = typeof n.disabled == "function" ? n.disabled(e) : !!n.disabled, g = a[n.id] || (typeof n.loading == "function" ? n.loading(e) : !!n.loading), u = typeof n.label == "function" ? n.label(e) : n.label, b = rt(n.icon, e), y = typeof n.tooltip == "function" ? n.tooltip(e) : n.tooltip, v = typeof n.className == "function" ? n.className(e) : n.className || "";
1680
+ if (n.type === "custom" && n.render)
1681
+ return /* @__PURE__ */ r.createElement(r.Fragment, { key: n.id }, n.render(e, o));
1682
+ if (n.type === "switch") {
1683
+ const p = n, x = p.checked(e);
1684
+ return /* @__PURE__ */ r.createElement(
1685
+ "div",
1619
1686
  {
1620
- type: "button",
1621
- disabled: u || m,
1622
- onClick: () => g(a),
1623
- title: h,
1624
- style: a.color ? { backgroundColor: a.color, color: "#ffffff" } : void 0,
1625
- className: `inline-flex items-center justify-center gap-1.5 ${p} rounded-xl text-xs font-bold transition-all duration-200 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 ${$} ${k}`,
1626
- children: [
1627
- m ? /* @__PURE__ */ o("span", { className: "w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full animate-spin" }) : b && /* @__PURE__ */ o("span", { className: "text-sm flex items-center justify-center shrink-0", children: b }),
1628
- f && /* @__PURE__ */ o("span", { children: f })
1629
- ]
1687
+ key: n.id,
1688
+ className: "flex items-center gap-2",
1689
+ title: y || u
1630
1690
  },
1631
- a.id
1691
+ u && /* @__PURE__ */ r.createElement("span", { className: "text-xs font-semibold text-gray-500" }, u, ":"),
1692
+ /* @__PURE__ */ r.createElement(
1693
+ "button",
1694
+ {
1695
+ type: "button",
1696
+ role: "switch",
1697
+ "aria-checked": x,
1698
+ disabled: f || g,
1699
+ onClick: () => c(p, x),
1700
+ className: `relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${x ? "bg-emerald-500" : "bg-gray-300 dark:bg-gray-700"} ${v}`
1701
+ },
1702
+ /* @__PURE__ */ r.createElement(
1703
+ "span",
1704
+ {
1705
+ "aria-hidden": "true",
1706
+ className: `pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out flex items-center justify-center ${x ? "translate-x-5" : "translate-x-0"}`
1707
+ },
1708
+ g && /* @__PURE__ */ r.createElement("span", { className: "w-2.5 h-2.5 border-2 border-primary border-t-transparent rounded-full animate-spin" })
1709
+ )
1710
+ )
1632
1711
  );
1633
- }) }),
1634
- s && /* @__PURE__ */ o(
1635
- kr,
1712
+ }
1713
+ const T = typeof n.variant == "function" ? n.variant(e) : n.variant || "neutral", B = Ze[T] || Ze.neutral, E = !u && b ? "p-2 min-w-[2rem]" : "px-3 py-1.5";
1714
+ return /* @__PURE__ */ r.createElement(
1715
+ "button",
1636
1716
  {
1637
- isOpen: s.isOpen,
1638
- title: s.title,
1639
- message: s.message,
1640
- confirmText: s.confirmText,
1641
- cancelText: s.cancelText,
1642
- type: s.type,
1643
- onClose: () => l(null),
1644
- onConfirm: s.onConfirm
1645
- }
1646
- )
1647
- ] });
1648
- }, vr = ({
1717
+ key: n.id,
1718
+ type: "button",
1719
+ disabled: f || g,
1720
+ onClick: () => m(n),
1721
+ title: y,
1722
+ style: n.color ? { backgroundColor: n.color, color: "#ffffff" } : void 0,
1723
+ className: `inline-flex items-center justify-center gap-1.5 ${E} rounded-xl text-xs font-bold transition-all duration-200 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 ${B} ${v}`
1724
+ },
1725
+ g ? /* @__PURE__ */ r.createElement("span", { className: "w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full animate-spin" }) : b && /* @__PURE__ */ r.createElement("span", { className: "text-sm flex items-center justify-center shrink-0" }, b),
1726
+ u && /* @__PURE__ */ r.createElement("span", null, u)
1727
+ );
1728
+ })), s && /* @__PURE__ */ r.createElement(
1729
+ Dr,
1730
+ {
1731
+ isOpen: s.isOpen,
1732
+ title: s.title,
1733
+ message: s.message,
1734
+ confirmText: s.confirmText,
1735
+ cancelText: s.cancelText,
1736
+ type: s.type,
1737
+ onClose: () => i(null),
1738
+ onConfirm: s.onConfirm
1739
+ }
1740
+ ));
1741
+ }
1742
+ function Hr({
1649
1743
  rows: e,
1650
1744
  columns: t,
1651
- actions: n,
1745
+ actions: o,
1652
1746
  actionContext: s,
1653
- rowKeyResolver: l,
1654
- selectable: r,
1655
- selectedKeys: i,
1656
- onToggleSelectRow: g,
1657
- onRowClick: c,
1658
- striped: d = !1,
1659
- hoverable: a = !0,
1660
- rowClassName: u
1661
- }) => {
1662
- const m = Y(), f = !!(n && n.length > 0);
1663
- return /* @__PURE__ */ o("tbody", { className: m.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900", children: e.map((b, h) => {
1664
- const k = l(b, h), T = i?.has(k), $ = typeof u == "function" ? u(b, h) : u || "";
1665
- return /* @__PURE__ */ y(
1747
+ rowKeyResolver: i,
1748
+ selectable: a,
1749
+ selectedKeys: l,
1750
+ onToggleSelectRow: m,
1751
+ onRowClick: d,
1752
+ striped: c = !1,
1753
+ hoverable: n = !0,
1754
+ rowClassName: f,
1755
+ isVirtualized: g = !1,
1756
+ paddingTop: u = 0,
1757
+ paddingBottom: b = 0,
1758
+ startIndex: y = 0
1759
+ }) {
1760
+ const v = X(), T = !!(o && o.length > 0), B = t.length + (a ? 1 : 0) + (T ? 1 : 0);
1761
+ return /* @__PURE__ */ r.createElement("tbody", { className: v.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900" }, g && u > 0 && /* @__PURE__ */ r.createElement(
1762
+ "tr",
1763
+ {
1764
+ style: { height: `${u}px`, border: 0 },
1765
+ "aria-hidden": "true",
1766
+ className: "pointer-events-none"
1767
+ },
1768
+ /* @__PURE__ */ r.createElement(
1769
+ "td",
1770
+ {
1771
+ colSpan: B,
1772
+ style: { height: `${u}px`, padding: 0, border: 0 }
1773
+ }
1774
+ )
1775
+ ), e.map((E, p) => {
1776
+ const x = y + p, k = i(E, x), w = l?.has(k), D = typeof f == "function" ? f(E, x) : f || "";
1777
+ return /* @__PURE__ */ r.createElement(
1666
1778
  "tr",
1667
1779
  {
1668
- onClick: (p) => c?.(b, h, p),
1669
- className: `${m.classes?.tr || "transition-colors duration-150"} ${d && h % 2 === 1 ? "bg-gray-50/40 dark:bg-slate-800/20" : ""} ${a ? "hover:bg-gray-50/70 dark:hover:bg-slate-800/50" : ""} ${T ? "bg-primary/5 dark:bg-primary/10" : ""} ${c ? "cursor-pointer" : ""} ${$}`,
1670
- children: [
1671
- r && /* @__PURE__ */ o(
1672
- "td",
1673
- {
1674
- className: "w-10 px-4 py-3 text-center align-middle",
1675
- onClick: (p) => p.stopPropagation(),
1676
- children: /* @__PURE__ */ o(
1677
- "input",
1678
- {
1679
- type: "checkbox",
1680
- checked: T,
1681
- onChange: () => g?.(k, b),
1682
- className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1683
- }
1684
- )
1685
- }
1686
- ),
1687
- t.map((p) => {
1688
- const w = p.align === "center" ? "text-center" : p.align === "right" ? "text-right" : "text-left", x = typeof p.className == "function" ? p.className(b?.[p.key], b, h) : p.className || "";
1689
- return /* @__PURE__ */ o(
1690
- "td",
1691
- {
1692
- style: {
1693
- width: p.width,
1694
- minWidth: p.minWidth,
1695
- maxWidth: p.maxWidth
1696
- },
1697
- className: `${m.classes?.td || "py-3 px-4 text-sm align-middle"} ${w} ${x}`,
1698
- children: /* @__PURE__ */ o(xr, { row: b, column: p, rowIndex: h })
1699
- },
1700
- String(p.key)
1701
- );
1702
- }),
1703
- f && /* @__PURE__ */ o(
1704
- "td",
1705
- {
1706
- className: `${m.classes?.td || "py-3 px-4 text-sm align-middle"} text-right`,
1707
- onClick: (p) => p.stopPropagation(),
1708
- children: /* @__PURE__ */ o(
1709
- wr,
1710
- {
1711
- row: b,
1712
- actions: n || [],
1713
- context: s
1714
- }
1715
- )
1716
- }
1717
- )
1718
- ]
1780
+ key: String(k),
1781
+ onClick: (h) => d?.(E, x, h),
1782
+ className: `${v.classes?.tr || "transition-colors duration-150"} ${c && x % 2 === 1 ? "bg-gray-50/40 dark:bg-slate-800/20" : ""} ${n ? "hover:bg-gray-50/70 dark:hover:bg-slate-800/50" : ""} ${w ? "bg-primary/5 dark:bg-primary/10" : ""} ${d ? "cursor-pointer" : ""} ${D}`
1719
1783
  },
1720
- String(k)
1784
+ a && /* @__PURE__ */ r.createElement(
1785
+ "td",
1786
+ {
1787
+ className: "w-10 px-4 py-3 text-center align-middle",
1788
+ onClick: (h) => h.stopPropagation()
1789
+ },
1790
+ /* @__PURE__ */ r.createElement(
1791
+ "input",
1792
+ {
1793
+ type: "checkbox",
1794
+ checked: w,
1795
+ onChange: () => m?.(k, E),
1796
+ className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1797
+ }
1798
+ )
1799
+ ),
1800
+ t.map((h) => {
1801
+ const j = h.align === "center" ? "text-center" : h.align === "right" ? "text-right" : "text-left", M = typeof h.className == "function" ? h.className(E?.[h.key], E, x) : h.className || "";
1802
+ return /* @__PURE__ */ r.createElement(
1803
+ "td",
1804
+ {
1805
+ key: String(h.key),
1806
+ style: {
1807
+ width: h.width,
1808
+ minWidth: h.minWidth,
1809
+ maxWidth: h.maxWidth
1810
+ },
1811
+ className: `${v.classes?.td || "py-3 px-4 text-sm align-middle"} ${j} ${M}`
1812
+ },
1813
+ /* @__PURE__ */ r.createElement(Br, { row: E, column: h, rowIndex: x })
1814
+ );
1815
+ }),
1816
+ T && /* @__PURE__ */ r.createElement(
1817
+ "td",
1818
+ {
1819
+ className: `${v.classes?.td || "py-3 px-4 text-sm align-middle"} text-right`,
1820
+ onClick: (h) => h.stopPropagation()
1821
+ },
1822
+ /* @__PURE__ */ r.createElement(
1823
+ Mr,
1824
+ {
1825
+ row: E,
1826
+ actions: o || [],
1827
+ context: s
1828
+ }
1829
+ )
1830
+ )
1721
1831
  );
1722
- }) });
1723
- }, Nr = ({
1832
+ }), g && b > 0 && /* @__PURE__ */ r.createElement(
1833
+ "tr",
1834
+ {
1835
+ style: { height: `${b}px`, border: 0 },
1836
+ "aria-hidden": "true",
1837
+ className: "pointer-events-none"
1838
+ },
1839
+ /* @__PURE__ */ r.createElement(
1840
+ "td",
1841
+ {
1842
+ colSpan: B,
1843
+ style: { height: `${b}px`, padding: 0, border: 0 }
1844
+ }
1845
+ )
1846
+ ));
1847
+ }
1848
+ function _r({
1724
1849
  page: e,
1725
1850
  pageSize: t,
1726
- totalRecords: n,
1851
+ totalRecords: o,
1727
1852
  totalPages: s,
1728
- pageSizeOptions: l = [5, 10, 20, 50, 100],
1729
- onPageChange: r,
1730
- onPageSizeChange: i,
1731
- showPageSizeSelector: g = !0,
1732
- showTotalCount: c = !0,
1733
- pageWindow: d
1734
- }) => {
1735
- const a = Y(), u = Math.min((e - 1) * t + 1, n), m = Math.min(e * t, n);
1736
- return /* @__PURE__ */ y(
1853
+ pageSizeOptions: i = [5, 10, 20, 50, 100],
1854
+ onPageChange: a,
1855
+ onPageSizeChange: l,
1856
+ showPageSizeSelector: m = !0,
1857
+ showTotalCount: d = !0,
1858
+ pageWindow: c
1859
+ }) {
1860
+ const n = X(), f = Math.min((e - 1) * t + 1, o), g = Math.min(e * t, o);
1861
+ return /* @__PURE__ */ r.createElement(
1737
1862
  "div",
1738
1863
  {
1739
- className: a.classes?.paginationContainer || "w-full flex flex-wrap items-center justify-between gap-4 pt-4 text-sm text-gray-600 dark:text-gray-400",
1740
- children: [
1741
- /* @__PURE__ */ y("div", { className: "flex items-center gap-3", children: [
1742
- c && n > 0 ? /* @__PURE__ */ y("span", { className: "text-xs sm:text-sm font-medium", children: [
1743
- "Showing ",
1744
- /* @__PURE__ */ o("strong", { className: "text-gray-900 dark:text-white font-bold", children: u }),
1745
- " to",
1746
- " ",
1747
- /* @__PURE__ */ o("strong", { className: "text-gray-900 dark:text-white font-bold", children: m }),
1748
- " of",
1749
- " ",
1750
- /* @__PURE__ */ o("strong", { className: "text-gray-900 dark:text-white font-bold", children: n.toLocaleString() }),
1751
- " results"
1752
- ] }) : /* @__PURE__ */ y("span", { className: "text-xs sm:text-sm font-medium", children: [
1753
- "Page ",
1754
- e,
1755
- " of ",
1756
- s
1757
- ] }),
1758
- g && /* @__PURE__ */ y("div", { className: "flex items-center gap-2 ml-2", children: [
1759
- /* @__PURE__ */ o("span", { className: "text-xs text-gray-500 hidden sm:inline", children: "Rows:" }),
1760
- /* @__PURE__ */ o(
1761
- "select",
1762
- {
1763
- value: t,
1764
- onChange: (f) => i(Number(f.target.value)),
1765
- className: a.classes?.paginationSelect || "h-8 px-2.5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-xs font-semibold text-gray-800 dark:text-gray-200 focus:outline-none focus:border-primary cursor-pointer",
1766
- children: l.map((f) => /* @__PURE__ */ y("option", { value: f, className: "bg-white dark:bg-slate-800 text-gray-900 dark:text-white", children: [
1767
- f,
1768
- " / page"
1769
- ] }, f))
1770
- }
1771
- )
1772
- ] })
1773
- ] }),
1774
- /* @__PURE__ */ y("div", { className: "flex items-center gap-1.5 ml-auto", children: [
1775
- /* @__PURE__ */ o(
1776
- "button",
1777
- {
1778
- type: "button",
1779
- disabled: e <= 1,
1780
- onClick: () => r(e - 1),
1781
- "aria-label": "Previous Page",
1782
- className: `${a.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40"}`,
1783
- children: "‹"
1784
- }
1785
- ),
1786
- d.map((f) => {
1787
- const b = f === e;
1788
- return /* @__PURE__ */ o(
1789
- "button",
1790
- {
1791
- type: "button",
1792
- onClick: () => r(f),
1793
- className: `${a.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs"} ${b ? a.classes?.paginationButtonActive || "bg-primary text-white shadow-sm shadow-primary/30" : "bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700"}`,
1794
- children: f
1795
- },
1796
- f
1797
- );
1798
- }),
1799
- /* @__PURE__ */ o(
1800
- "button",
1801
- {
1802
- type: "button",
1803
- disabled: e >= s,
1804
- onClick: () => r(e + 1),
1805
- "aria-label": "Next Page",
1806
- className: `${a.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40"}`,
1807
- children: "›"
1808
- }
1809
- )
1810
- ] })
1811
- ]
1812
- }
1864
+ className: n.classes?.paginationContainer || "w-full flex flex-wrap items-center justify-between gap-4 pt-4 text-sm text-gray-600 dark:text-gray-400"
1865
+ },
1866
+ /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-3" }, d && o > 0 ? /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, "Showing ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, f), " to", " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, g), " of", " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, o.toLocaleString()), " results") : /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, "Page ", e, " of ", s), m && /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-2 ml-2" }, /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-500 hidden sm:inline" }, "Rows:"), /* @__PURE__ */ r.createElement(
1867
+ "select",
1868
+ {
1869
+ value: t,
1870
+ onChange: (u) => l(Number(u.target.value)),
1871
+ className: n.classes?.paginationSelect || "h-8 px-2.5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-xs font-semibold text-gray-800 dark:text-gray-200 focus:outline-none focus:border-primary cursor-pointer"
1872
+ },
1873
+ i.map((u) => /* @__PURE__ */ r.createElement("option", { key: u, value: u, className: "bg-white dark:bg-slate-800 text-gray-900 dark:text-white" }, u, " / page"))
1874
+ ))),
1875
+ /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-1.5 ml-auto" }, /* @__PURE__ */ r.createElement(
1876
+ "button",
1877
+ {
1878
+ type: "button",
1879
+ disabled: e <= 1,
1880
+ onClick: () => a(e - 1),
1881
+ "aria-label": "Previous Page",
1882
+ className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40"}`
1883
+ },
1884
+ "‹"
1885
+ ), c.map((u) => {
1886
+ const b = u === e;
1887
+ return /* @__PURE__ */ r.createElement(
1888
+ "button",
1889
+ {
1890
+ key: u,
1891
+ type: "button",
1892
+ onClick: () => a(u),
1893
+ className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs"} ${b ? n.classes?.paginationButtonActive || "bg-primary text-white shadow-sm shadow-primary/30" : "bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700"}`
1894
+ },
1895
+ u
1896
+ );
1897
+ }), /* @__PURE__ */ r.createElement(
1898
+ "button",
1899
+ {
1900
+ type: "button",
1901
+ disabled: e >= s,
1902
+ onClick: () => a(e + 1),
1903
+ "aria-label": "Next Page",
1904
+ className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40"}`
1905
+ },
1906
+ "›"
1907
+ ))
1813
1908
  );
1814
- }, Ar = ({
1909
+ }
1910
+ function jr({
1815
1911
  columnsCount: e = 5,
1816
1912
  rowsCount: t = 5,
1817
- hasActions: n = !0
1818
- }) => /* @__PURE__ */ o("tbody", { className: "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900", children: Array.from({ length: t }).map((s, l) => /* @__PURE__ */ y("tr", { className: "any-table-pulse", children: [
1819
- Array.from({ length: e }).map((r, i) => /* @__PURE__ */ o("td", { className: "py-4 px-4 align-middle", children: /* @__PURE__ */ o(
1913
+ hasActions: o = !0
1914
+ }) {
1915
+ return /* @__PURE__ */ r.createElement("tbody", { className: "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900" }, Array.from({ length: t }).map((s, i) => /* @__PURE__ */ r.createElement("tr", { key: i, className: "any-table-pulse" }, Array.from({ length: e }).map((a, l) => /* @__PURE__ */ r.createElement("td", { key: l, className: "py-4 px-4 align-middle" }, /* @__PURE__ */ r.createElement(
1820
1916
  "div",
1821
1917
  {
1822
1918
  className: "h-4 bg-gray-200 dark:bg-slate-700/60 rounded-md",
1823
1919
  style: {
1824
- width: `${Math.floor(40 + (i * 19 + l * 13) % 45)}%`
1920
+ width: `${Math.floor(40 + (l * 19 + i * 13) % 45)}%`
1825
1921
  }
1826
1922
  }
1827
- ) }, i)),
1828
- n && /* @__PURE__ */ o("td", { className: "py-4 px-4 text-right align-middle pr-6", children: /* @__PURE__ */ y("div", { className: "inline-flex gap-2 justify-end", children: [
1829
- /* @__PURE__ */ o("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }),
1830
- /* @__PURE__ */ o("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" })
1831
- ] }) })
1832
- ] }, l)) }), Cr = ({
1923
+ ))), o && /* @__PURE__ */ r.createElement("td", { className: "py-4 px-4 text-right align-middle pr-6" }, /* @__PURE__ */ r.createElement("div", { className: "inline-flex gap-2 justify-end" }, /* @__PURE__ */ r.createElement("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }), /* @__PURE__ */ r.createElement("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }))))));
1924
+ }
1925
+ function zr({
1833
1926
  title: e,
1834
1927
  description: t,
1835
- isSearchActive: n = !1,
1928
+ isSearchActive: o = !1,
1836
1929
  onClearSearch: s,
1837
- colSpan: l
1838
- }) => {
1839
- const g = /* @__PURE__ */ y("div", { className: "w-full py-16 px-6 flex flex-col items-center justify-center text-center any-table-fade-in", children: [
1840
- /* @__PURE__ */ o("div", { className: "w-16 h-16 mb-4 rounded-2xl bg-gray-100 dark:bg-slate-800 text-gray-400 dark:text-gray-500 flex items-center justify-center text-3xl shadow-inner", children: n ? "🔍" : "📂" }),
1841
- /* @__PURE__ */ o("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1", children: e || (n ? "No matching records found" : "No data available") }),
1842
- /* @__PURE__ */ o("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-sm mb-5 leading-relaxed", children: t || (n ? "Try adjusting your search criteria or clear the search filter." : "There are currently no records to display.") }),
1843
- n && s && /* @__PURE__ */ o(
1844
- "button",
1845
- {
1846
- type: "button",
1847
- onClick: s,
1848
- className: "px-4 py-2 rounded-xl bg-primary text-white text-xs font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95",
1849
- children: "Clear Search Filter"
1850
- }
1851
- )
1852
- ] });
1853
- return l !== void 0 ? /* @__PURE__ */ o("tbody", { children: /* @__PURE__ */ o("tr", { children: /* @__PURE__ */ o("td", { colSpan: l, className: "p-0", children: g }) }) }) : g;
1854
- }, Sr = ({ error: e, onRetry: t }) => {
1855
- const n = typeof e == "string" ? e : e?.message || e?.response?.data?.message || "Failed to load table data.";
1856
- return /* @__PURE__ */ y("div", { className: "w-full py-14 px-6 flex flex-col items-center justify-center text-center any-table-fade-in", children: [
1857
- /* @__PURE__ */ o("div", { className: "w-14 h-14 mb-4 rounded-2xl bg-rose-500/10 text-rose-500 flex items-center justify-center text-2xl border border-rose-500/20", children: "⚠️" }),
1858
- /* @__PURE__ */ o("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1", children: "Unable to load data" }),
1859
- /* @__PURE__ */ o("p", { className: "text-xs sm:text-sm text-rose-600 dark:text-rose-400 font-medium max-w-md mb-5 leading-relaxed bg-rose-500/5 px-3 py-1.5 rounded-lg border border-rose-500/10", children: n }),
1860
- t && /* @__PURE__ */ y(
1861
- "button",
1862
- {
1863
- type: "button",
1864
- onClick: t,
1865
- className: "inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-gray-900 dark:bg-white text-white dark:text-gray-900 text-xs font-bold hover:bg-gray-800 dark:hover:bg-gray-100 transition-all shadow-md active:scale-95",
1866
- children: [
1867
- /* @__PURE__ */ o("span", { children: "🔄" }),
1868
- /* @__PURE__ */ o("span", { children: "Retry Request" })
1869
- ]
1870
- }
1871
- )
1872
- ] });
1873
- };
1874
- function Ie(e) {
1930
+ colSpan: i
1931
+ }) {
1932
+ const a = o ? "No matching records found" : "No data available", l = o ? "Try adjusting your search criteria or clear the search filter." : "There are currently no records to display.", m = /* @__PURE__ */ r.createElement("div", { className: "w-full py-16 px-6 flex flex-col items-center justify-center text-center any-table-fade-in" }, /* @__PURE__ */ r.createElement("div", { className: "w-16 h-16 mb-4 rounded-2xl bg-gray-100 dark:bg-slate-800 text-gray-400 dark:text-gray-500 flex items-center justify-center text-3xl shadow-inner" }, o ? "🔍" : "📂"), /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1" }, e || a), /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-sm mb-5 leading-relaxed" }, t || l), o && s && /* @__PURE__ */ r.createElement(
1933
+ "button",
1934
+ {
1935
+ type: "button",
1936
+ onClick: s,
1937
+ className: "px-4 py-2 rounded-xl bg-primary text-white text-xs font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95"
1938
+ },
1939
+ "Clear Search Filter"
1940
+ ));
1941
+ return i !== void 0 ? /* @__PURE__ */ r.createElement("tbody", null, /* @__PURE__ */ r.createElement("tr", null, /* @__PURE__ */ r.createElement("td", { colSpan: i, className: "p-0" }, m))) : m;
1942
+ }
1943
+ function Rr({ error: e, onRetry: t }) {
1944
+ const o = typeof e == "string" ? e : e?.message || e?.response?.data?.message || "Failed to load table data.";
1945
+ return /* @__PURE__ */ r.createElement("div", { className: "w-full py-14 px-6 flex flex-col items-center justify-center text-center any-table-fade-in" }, /* @__PURE__ */ r.createElement("div", { className: "w-14 h-14 mb-4 rounded-2xl bg-rose-500/10 text-rose-500 flex items-center justify-center text-2xl border border-rose-500/20" }, "⚠️"), /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1" }, "Unable to load data"), /* @__PURE__ */ r.createElement("p", { className: "text-xs sm:text-sm text-rose-600 dark:text-rose-400 font-medium max-w-md mb-5 leading-relaxed bg-rose-500/5 px-3 py-1.5 rounded-lg border border-rose-500/10" }, o), t && /* @__PURE__ */ r.createElement(
1946
+ "button",
1947
+ {
1948
+ type: "button",
1949
+ onClick: t,
1950
+ className: "inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-gray-900 dark:bg-white text-white dark:text-gray-900 text-xs font-bold hover:bg-gray-800 dark:hover:bg-gray-100 transition-all shadow-md active:scale-95"
1951
+ },
1952
+ /* @__PURE__ */ r.createElement("span", null, "🔄"),
1953
+ /* @__PURE__ */ r.createElement("span", null, "Retry Request")
1954
+ ));
1955
+ }
1956
+ function Je(e) {
1875
1957
  const {
1876
1958
  data: t,
1877
- api: n,
1959
+ api: o,
1878
1960
  columns: s,
1879
- autoColumns: l = !0,
1880
- rowKey: r,
1881
- title: i,
1882
- subtitle: g,
1883
- actions: c,
1884
- actionsTitle: d = "Actions",
1885
- actionsWidth: a,
1886
- search: u = !0,
1887
- sorting: m = !0,
1888
- pagination: f = !0,
1889
- selectable: b = !1,
1890
- onSelectionChange: h,
1891
- onRowClick: k,
1892
- loading: T,
1893
- loadingComponent: $,
1961
+ autoColumns: i = !0,
1962
+ rowKey: a,
1963
+ title: l,
1964
+ subtitle: m,
1965
+ actions: d,
1966
+ actionsTitle: c = "Actions",
1967
+ actionsWidth: n,
1968
+ search: f = !0,
1969
+ sorting: g = !0,
1970
+ pagination: u,
1971
+ virtualized: b = !1,
1972
+ selectable: y = !1,
1973
+ onSelectionChange: v,
1974
+ onRowClick: T,
1975
+ loading: B,
1976
+ loadingComponent: E,
1894
1977
  emptyComponent: p,
1895
- emptyTitle: w,
1896
- emptyDescription: x,
1897
- errorComponent: M,
1898
- className: z = "",
1899
- tableClassName: W = "",
1900
- headerClassName: oe = "",
1901
- rowClassName: D,
1902
- headerActions: _,
1903
- showHeader: F = !0,
1904
- bordered: Z = !0,
1905
- striped: O = !1,
1906
- hoverable: R = !0,
1978
+ emptyTitle: x,
1979
+ emptyDescription: k,
1980
+ errorComponent: w,
1981
+ className: D = "",
1982
+ tableClassName: h = "",
1983
+ headerClassName: j = "",
1984
+ rowClassName: M,
1985
+ headerActions: z,
1986
+ showHeader: I = !0,
1987
+ bordered: Q = !0,
1988
+ striped: K = !1,
1989
+ hoverable: U = !0,
1907
1990
  compact: L = !1,
1908
- stickyHeader: U = !1,
1909
- tableRef: P,
1991
+ stickyHeader: H = !1,
1992
+ tableRef: R,
1910
1993
  // Legacy Wasel Props
1911
- thead: H,
1912
- headerData: ye,
1913
- tbodys: he,
1914
- titleHeader: Xe,
1915
- add: Qe,
1916
- linkAdd: et,
1917
- addHandler: tt,
1918
- view: pe,
1919
- linkView: xe,
1920
- viewHandler: ke,
1921
- edit: we,
1922
- linkEdit: ve,
1923
- editHandler: Ne,
1924
- del: Ae,
1994
+ thead: V,
1995
+ headerData: he,
1996
+ tbodys: ke,
1997
+ titleHeader: at,
1998
+ add: nt,
1999
+ linkAdd: ot,
2000
+ addHandler: st,
2001
+ view: we,
2002
+ linkView: ve,
2003
+ viewHandler: Ee,
2004
+ edit: Ne,
2005
+ linkEdit: Ae,
2006
+ editHandler: Te,
2007
+ del: Se,
1925
2008
  handleDelete: Ce,
1926
- block: Se,
1927
- handleBlock: Te,
1928
- buttons: Pe
1929
- } = e, v = Y(), J = B(() => t || he || void 0, [t, he]), I = B(() => Lt({
1930
- data: J,
2009
+ block: Pe,
2010
+ handleBlock: $e,
2011
+ buttons: Be
2012
+ } = e, C = X(), ee = $(() => t || ke || void 0, [t, ke]), Z = $(() => Jt({
2013
+ data: ee,
1931
2014
  columns: s,
1932
- autoColumns: l,
1933
- thead: H,
1934
- headerData: ye
1935
- }).filter((j) => typeof j.hidden == "function" ? !j.hidden({ data: J || [] }) : !j.hidden), [J, s, l, H, ye]), Ee = N(
1936
- (C, j) => {
1937
- if (typeof r == "function")
1938
- return r(C, j);
1939
- if (typeof r == "string") {
1940
- const be = S(C, r);
1941
- if (be != null) return be;
2015
+ autoColumns: i,
2016
+ thead: V,
2017
+ headerData: he
2018
+ }).filter((F) => typeof F.hidden == "function" ? !F.hidden({ data: ee || [] }) : !F.hidden), [ee, s, i, V, he]), De = S(
2019
+ (N, F) => {
2020
+ if (typeof a == "function")
2021
+ return a(N, F);
2022
+ if (typeof a == "string") {
2023
+ const ye = A(N, a);
2024
+ if (ye != null) return ye;
1942
2025
  }
1943
- const ge = C?._id ?? C?.id ?? C?.key;
1944
- return ge ?? j;
2026
+ const fe = N?._id ?? N?.id ?? N?.key;
2027
+ return fe ?? F;
1945
2028
  },
1946
- [r]
2029
+ [a]
1947
2030
  ), {
1948
- enabled: rt,
1949
- search: $e,
1950
- debouncedSearch: at,
1951
- isDebouncing: nt,
1952
- setSearch: Be,
1953
- clearSearch: De,
1954
- searchConfig: ot
1955
- } = Ot({ config: u }), {
1956
- enabled: st,
1957
- sortBy: se,
1958
- sortOrder: ie,
1959
- toggleSort: it,
1960
- setSorting: lt,
1961
- resetSorting: dt
1962
- } = Rt({ config: m }), Me = B(
1963
- () => Ht({
1964
- explicitActions: c,
1965
- buttons: Pe,
1966
- block: Se,
1967
- handleBlock: Te,
1968
- view: pe,
1969
- linkView: xe,
1970
- viewHandler: ke,
1971
- edit: we,
1972
- linkEdit: ve,
1973
- editHandler: Ne,
1974
- del: Ae,
2031
+ enabled: lt,
2032
+ search: Me,
2033
+ debouncedSearch: it,
2034
+ isDebouncing: dt,
2035
+ setSearch: He,
2036
+ clearSearch: _e,
2037
+ searchConfig: ct
2038
+ } = Xt({ config: f }), {
2039
+ enabled: mt,
2040
+ sortBy: ce,
2041
+ sortOrder: me,
2042
+ toggleSort: gt,
2043
+ setSorting: ut,
2044
+ resetSorting: bt
2045
+ } = Qt({ config: g }), je = $(
2046
+ () => qt({
2047
+ explicitActions: d,
2048
+ buttons: Be,
2049
+ block: Pe,
2050
+ handleBlock: $e,
2051
+ view: we,
2052
+ linkView: ve,
2053
+ viewHandler: Ee,
2054
+ edit: Ne,
2055
+ linkEdit: Ae,
2056
+ editHandler: Te,
2057
+ del: Se,
1975
2058
  handleDelete: Ce
1976
2059
  }),
1977
2060
  [
1978
- c,
2061
+ d,
2062
+ Be,
1979
2063
  Pe,
1980
- Se,
1981
- Te,
1982
- pe,
1983
- xe,
1984
- ke,
2064
+ $e,
1985
2065
  we,
1986
2066
  ve,
2067
+ Ee,
1987
2068
  Ne,
1988
2069
  Ae,
2070
+ Te,
2071
+ Se,
1989
2072
  Ce
1990
2073
  ]
1991
- ), [ct, gt] = A(1), [bt, mt] = A(10), {
1992
- rows: K,
1993
- totalRecords: le,
1994
- loading: q,
1995
- error: X,
1996
- refresh: V,
1997
- isServerMode: ut
1998
- } = Xt({
1999
- data: J,
2000
- api: n,
2001
- columns: I,
2002
- searchQuery: at,
2003
- sortBy: se,
2004
- sortOrder: ie,
2005
- page: ct,
2006
- pageSize: bt,
2007
- manualLoading: T
2008
- }), {
2009
- enabled: ft,
2010
- page: Q,
2011
- pageSize: de,
2012
- totalPages: _e,
2013
- pageSizeOptions: yt,
2014
- setPage: ee,
2015
- setPageSize: je,
2016
- resetPagination: ht,
2017
- getPageWindow: pt,
2018
- paginationConfig: We
2019
- } = Ut({
2020
- config: f,
2021
- totalRecords: le,
2022
- onPageChange: (C, j) => {
2023
- gt(C), mt(j);
2024
- }
2074
+ ), [ft, yt] = P(1), [pt, xt] = P(10), ze = $(() => typeof b == "object" && b !== null ? b.enabled !== !1 : !!b, [b]), Y = $(() => u !== void 0 ? u : !ze, [ze, u]), ht = $(() => typeof Y == "object" && Y !== null ? Y.enabled !== !1 : !!Y, [Y]), {
2075
+ rows: W,
2076
+ totalRecords: ge,
2077
+ loading: te,
2078
+ error: re,
2079
+ refresh: J,
2080
+ isServerMode: kt
2081
+ } = dr({
2082
+ data: ee,
2083
+ api: o,
2084
+ columns: Z,
2085
+ searchQuery: it,
2086
+ sortBy: ce,
2087
+ sortOrder: me,
2088
+ page: ft,
2089
+ pageSize: pt,
2090
+ paginationEnabled: ht,
2091
+ manualLoading: B
2025
2092
  }), {
2026
- selectedKeys: ze,
2027
- selectedRows: te,
2028
- onToggleSelectRow: xt,
2029
- handleToggleSelectAll: kt,
2030
- clearSelection: wt,
2031
- allSelected: vt,
2032
- isIndeterminate: Nt
2093
+ enabled: wt,
2094
+ page: ae,
2095
+ pageSize: ue,
2096
+ totalPages: Re,
2097
+ pageSizeOptions: vt,
2098
+ setPage: ne,
2099
+ setPageSize: We,
2100
+ resetPagination: Et,
2101
+ getPageWindow: Nt,
2102
+ paginationConfig: Fe
2033
2103
  } = er({
2034
- rows: K,
2035
- rowKeyResolver: Ee,
2036
- onSelectionChange: h
2037
- }), At = B(
2104
+ config: Y,
2105
+ totalRecords: ge,
2106
+ onPageChange: (N, F) => {
2107
+ yt(N), xt(F);
2108
+ }
2109
+ }), Le = de(null), {
2110
+ isVirtualized: O,
2111
+ paddingTop: At,
2112
+ paddingBottom: Tt,
2113
+ startIndex: St,
2114
+ maxHeight: oe,
2115
+ scrollToIndex: Ct,
2116
+ sliceRows: Oe
2117
+ } = gr({
2118
+ config: b,
2119
+ totalCount: W.length,
2120
+ scrollContainerRef: Le
2121
+ }), Pt = $(() => O ? Oe(W) : W, [O, W, Oe]), {
2122
+ selectedKeys: Ie,
2123
+ selectedRows: se,
2124
+ onToggleSelectRow: $t,
2125
+ handleToggleSelectAll: Bt,
2126
+ clearSelection: Dt,
2127
+ allSelected: Mt,
2128
+ isIndeterminate: Ht
2129
+ } = mr({
2130
+ rows: W,
2131
+ rowKeyResolver: De,
2132
+ onSelectionChange: v
2133
+ }), _t = $(
2038
2134
  () => ({
2039
- refresh: V,
2040
- loading: q,
2041
- page: Q,
2042
- selectedRows: te,
2043
- setPage: ee
2135
+ refresh: J,
2136
+ loading: te,
2137
+ page: ae,
2138
+ selectedRows: se,
2139
+ setPage: ne
2044
2140
  }),
2045
- [V, q, Q, te, ee]
2141
+ [J, te, ae, se, ne]
2046
2142
  );
2047
- Qt({
2048
- tableRef: P,
2049
- refresh: V,
2050
- resetPagination: ht,
2051
- resetSearch: De,
2052
- resetSorting: dt,
2053
- setPage: ee,
2054
- setPageSize: je,
2055
- setSearch: Be,
2056
- setSorting: lt,
2057
- selectedRows: te,
2058
- clearSelection: wt,
2143
+ cr({
2144
+ tableRef: R,
2145
+ refresh: J,
2146
+ resetPagination: Et,
2147
+ resetSearch: _e,
2148
+ resetSorting: bt,
2149
+ setPage: ne,
2150
+ setPageSize: We,
2151
+ setSearch: He,
2152
+ setSorting: ut,
2153
+ selectedRows: se,
2154
+ clearSelection: Dt,
2155
+ scrollToIndex: Ct,
2059
2156
  getState: () => ({
2060
- data: K,
2061
- loading: q,
2062
- error: X,
2063
- page: Q,
2064
- pageSize: de,
2065
- total: le,
2066
- totalPages: _e,
2067
- search: $e,
2068
- sortBy: se,
2069
- sortOrder: ie,
2070
- selectedRowKeys: Array.from(ze),
2071
- selectedRows: te,
2072
- isServerMode: ut
2157
+ data: W,
2158
+ loading: te,
2159
+ error: re,
2160
+ page: ae,
2161
+ pageSize: ue,
2162
+ total: ge,
2163
+ totalPages: Re,
2164
+ search: Me,
2165
+ sortBy: ce,
2166
+ sortOrder: me,
2167
+ selectedRowKeys: Array.from(Ie),
2168
+ selectedRows: se,
2169
+ isServerMode: kt
2073
2170
  })
2074
2171
  });
2075
- const Ct = i || Xe, ce = Me.length > 0, St = B(() => {
2076
- const C = {};
2077
- return v.borderRadius && (C["--any-table-radius"] = v.borderRadius), v.fontFamily && (C["--any-table-font"] = v.fontFamily, C.fontFamily = v.fontFamily), v.colors?.primary && (C["--any-table-primary"] = v.colors.primary), v.colors?.primaryHover && (C["--any-table-primary-hover"] = v.colors.primaryHover), v.colors?.border && (C["--any-table-border"] = v.colors.border), C;
2078
- }, [v]);
2079
- return /* @__PURE__ */ y(
2172
+ const jt = l || at, be = je.length > 0, zt = $(() => {
2173
+ const N = {};
2174
+ return C.borderRadius && (N["--any-table-radius"] = C.borderRadius), C.fontFamily && (N["--any-table-font"] = C.fontFamily, N.fontFamily = C.fontFamily), C.colors?.primary && (N["--any-table-primary"] = C.colors.primary), C.colors?.primaryHover && (N["--any-table-primary-hover"] = C.colors.primaryHover), C.colors?.border && (N["--any-table-border"] = C.colors.border), N;
2175
+ }, [C]), Rt = $(() => {
2176
+ const N = {};
2177
+ return C.borderRadius && (N.borderRadius = C.borderRadius), O && (N.maxHeight = typeof oe == "number" ? `${oe}px` : oe, N.overflowY = "auto", N.position = "relative"), N;
2178
+ }, [C.borderRadius, O, oe]);
2179
+ return /* @__PURE__ */ r.createElement(
2080
2180
  "div",
2081
2181
  {
2082
- style: St,
2083
- className: `any-table-wrapper ${v.classes?.container || "w-full flex flex-col gap-4 font-sans text-gray-900 dark:text-gray-100"} ${z}`,
2084
- children: [
2085
- /* @__PURE__ */ o(
2086
- ar,
2087
- {
2088
- displayTitle: Ct,
2089
- subtitle: g,
2090
- isSearchEnabled: rt,
2091
- searchQuery: $e,
2092
- setSearch: Be,
2093
- clearSearch: De,
2094
- isDebouncing: nt,
2095
- searchPlaceholder: ot.placeholder,
2096
- headerActions: _,
2097
- add: Qe,
2098
- linkAdd: et,
2099
- addHandler: tt
2100
- }
2101
- ),
2102
- /* @__PURE__ */ o(
2103
- "div",
2182
+ style: zt,
2183
+ className: `any-table-wrapper ${C.classes?.container || "w-full flex flex-col gap-4 font-sans text-gray-900 dark:text-gray-100"} ${D}`
2184
+ },
2185
+ /* @__PURE__ */ r.createElement(
2186
+ fr,
2187
+ {
2188
+ displayTitle: jt,
2189
+ subtitle: m,
2190
+ isSearchEnabled: lt,
2191
+ searchQuery: Me,
2192
+ setSearch: He,
2193
+ clearSearch: _e,
2194
+ isDebouncing: dt,
2195
+ searchPlaceholder: ct.placeholder,
2196
+ headerActions: z,
2197
+ add: nt,
2198
+ linkAdd: ot,
2199
+ addHandler: st
2200
+ }
2201
+ ),
2202
+ /* @__PURE__ */ r.createElement(
2203
+ "div",
2204
+ {
2205
+ ref: Le,
2206
+ style: Rt,
2207
+ className: `${C.classes?.tableWrapper || "w-full overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-slate-900 shadow-sm transition-colors"} ${Q ? "" : "border-0 shadow-none"}`
2208
+ },
2209
+ re ? typeof w == "function" ? w(re, J) : w || /* @__PURE__ */ r.createElement(Rr, { error: re, onRetry: J }) : /* @__PURE__ */ r.createElement(
2210
+ "table",
2211
+ {
2212
+ className: `${C.classes?.table || "w-full border-collapse text-left text-sm"} ${L || C.density === "compact" ? "text-xs" : ""} ${H || O ? "relative" : ""} ${h}`
2213
+ },
2214
+ I && /* @__PURE__ */ r.createElement(
2215
+ yr,
2104
2216
  {
2105
- style: v.borderRadius ? { borderRadius: v.borderRadius } : void 0,
2106
- className: `${v.classes?.tableWrapper || "w-full overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-slate-900 shadow-sm transition-colors"} ${Z ? "" : "border-0 shadow-none"}`,
2107
- children: X ? typeof M == "function" ? M(X, V) : M || /* @__PURE__ */ o(Sr, { error: X, onRetry: V }) : /* @__PURE__ */ y(
2108
- "table",
2109
- {
2110
- className: `${v.classes?.table || "w-full border-collapse text-left text-sm"} ${L || v.density === "compact" ? "text-xs" : ""} ${U ? "relative" : ""} ${W}`,
2111
- children: [
2112
- F && /* @__PURE__ */ o(
2113
- nr,
2114
- {
2115
- columns: I,
2116
- hasActions: ce,
2117
- actionsTitle: d,
2118
- actionsWidth: a,
2119
- sortBy: se,
2120
- sortOrder: ie,
2121
- onSort: st ? it : void 0,
2122
- selectable: b,
2123
- allSelected: vt,
2124
- isIndeterminate: Nt,
2125
- onToggleSelectAll: kt,
2126
- headerClassName: oe
2127
- }
2128
- ),
2129
- q && K.length === 0 ? $ || /* @__PURE__ */ o(
2130
- Ar,
2131
- {
2132
- columnsCount: I.length + (b ? 1 : 0) + (ce ? 1 : 0),
2133
- rowsCount: de || 5
2134
- }
2135
- ) : K.length === 0 ? (
2136
- // Empty State
2137
- p || /* @__PURE__ */ o(
2138
- Cr,
2139
- {
2140
- title: w,
2141
- description: x,
2142
- colSpan: I.length + (b ? 1 : 0) + (ce ? 1 : 0)
2143
- }
2144
- )
2145
- ) : (
2146
- // Table Body
2147
- /* @__PURE__ */ o(
2148
- vr,
2149
- {
2150
- rows: K,
2151
- columns: I,
2152
- actions: Me,
2153
- actionContext: At,
2154
- rowKeyResolver: Ee,
2155
- selectable: b,
2156
- selectedKeys: ze,
2157
- onToggleSelectRow: xt,
2158
- onRowClick: k,
2159
- striped: O,
2160
- hoverable: R,
2161
- rowClassName: D
2162
- }
2163
- )
2164
- )
2165
- ]
2166
- }
2167
- )
2217
+ columns: Z,
2218
+ hasActions: be,
2219
+ actionsTitle: c,
2220
+ actionsWidth: n,
2221
+ sortBy: ce,
2222
+ sortOrder: me,
2223
+ onSort: mt ? gt : void 0,
2224
+ selectable: y,
2225
+ allSelected: Mt,
2226
+ isIndeterminate: Ht,
2227
+ onToggleSelectAll: Bt,
2228
+ headerClassName: j,
2229
+ sticky: H || O
2168
2230
  }
2169
2231
  ),
2170
- ft && /* @__PURE__ */ o(
2171
- Nr,
2232
+ te && W.length === 0 ? E || /* @__PURE__ */ r.createElement(
2233
+ jr,
2172
2234
  {
2173
- page: Q,
2174
- pageSize: de,
2175
- totalRecords: le,
2176
- totalPages: _e,
2177
- pageSizeOptions: yt,
2178
- onPageChange: ee,
2179
- onPageSizeChange: je,
2180
- showPageSizeSelector: We.showPageSizeSelector,
2181
- showTotalCount: We.showTotalCount,
2182
- pageWindow: pt(5)
2235
+ columnsCount: Z.length + (y ? 1 : 0) + (be ? 1 : 0),
2236
+ rowsCount: ue || 5
2183
2237
  }
2238
+ ) : W.length === 0 ? (
2239
+ // Empty State
2240
+ p || /* @__PURE__ */ r.createElement(
2241
+ zr,
2242
+ {
2243
+ title: x,
2244
+ description: k,
2245
+ colSpan: Z.length + (y ? 1 : 0) + (be ? 1 : 0)
2246
+ }
2247
+ )
2248
+ ) : (
2249
+ // Table Body
2250
+ /* @__PURE__ */ r.createElement(
2251
+ Hr,
2252
+ {
2253
+ rows: Pt,
2254
+ columns: Z,
2255
+ actions: je,
2256
+ actionContext: _t,
2257
+ rowKeyResolver: De,
2258
+ selectable: y,
2259
+ selectedKeys: Ie,
2260
+ onToggleSelectRow: $t,
2261
+ onRowClick: T,
2262
+ striped: K,
2263
+ hoverable: U,
2264
+ rowClassName: M,
2265
+ isVirtualized: O,
2266
+ paddingTop: At,
2267
+ paddingBottom: Tt,
2268
+ startIndex: St
2269
+ }
2270
+ )
2184
2271
  )
2185
- ]
2186
- }
2272
+ )
2273
+ ),
2274
+ wt && /* @__PURE__ */ r.createElement(
2275
+ _r,
2276
+ {
2277
+ page: ae,
2278
+ pageSize: ue,
2279
+ totalRecords: ge,
2280
+ totalPages: Re,
2281
+ pageSizeOptions: vt,
2282
+ onPageChange: ne,
2283
+ onPageSizeChange: We,
2284
+ showPageSizeSelector: Fe.showPageSizeSelector,
2285
+ showTotalCount: Fe.showTotalCount,
2286
+ pageWindow: Nt(5)
2287
+ }
2288
+ )
2187
2289
  );
2188
2290
  }
2189
- function Er(e) {
2190
- return !e.theme && !e.preset ? /* @__PURE__ */ o(Ie, { ...e }) : /* @__PURE__ */ o(tr, { theme: e.theme, preset: e.preset, children: /* @__PURE__ */ o(Ie, { ...e }) });
2191
- }
2291
+ const Fr = r.forwardRef(function(t, o) {
2292
+ const s = o || t.tableRef;
2293
+ return !t.theme && !t.preset ? /* @__PURE__ */ r.createElement(Je, { ...t, tableRef: s }) : /* @__PURE__ */ r.createElement(ur, { theme: t.theme, preset: t.preset }, /* @__PURE__ */ r.createElement(Je, { ...t, tableRef: s }));
2294
+ });
2192
2295
  export {
2193
- wr as ActionRenderer,
2194
- Er as AnyTable,
2195
- Ie as AnyTableInner,
2196
- tr as AnyTableThemeProvider,
2197
- gr as ArrayRenderer,
2198
- pr as BadgeRenderer,
2199
- sr as BooleanRenderer,
2200
- xr as CellRenderer,
2201
- kr as ConfirmModal,
2202
- ir as CurrencyRenderer,
2203
- Ye as DEFAULT_THEME_COLORS,
2204
- Oe as DateRenderer,
2205
- ur as EmailRenderer,
2206
- E as FallbackPlaceholder,
2207
- lr as ImageRenderer,
2208
- or as NumberRenderer,
2209
- br as ObjectRenderer,
2210
- fr as PhoneRenderer,
2211
- yr as ProgressRenderer,
2212
- hr as RatingRenderer,
2213
- cr as StatusRenderer,
2214
- Je as StringRenderer,
2215
- He as TABLE_PRESETS,
2216
- vr as TableBody,
2217
- Cr as TableEmptyState,
2218
- Sr as TableErrorState,
2219
- nr as TableHeader,
2220
- Nr as TablePagination,
2221
- rr as TableSearch,
2222
- Ar as TableSkeleton,
2223
- ar as TableToolbar,
2224
- mr as UrlRenderer,
2225
- Er as default,
2226
- Ze as defaultAnyTableTheme,
2227
- G as extractPaginationMeta,
2228
- Jt as filterRowsBySearch,
2229
- zt as generateAutoColumns,
2230
- S as getNestedValue,
2231
- ae as inferColumnType,
2232
- Fe as isImageUrl,
2233
- jt as isIsoDate,
2234
- $t as isPlainObject,
2235
- Zt as normalizeApiResponse,
2236
- qe as renderActionIcon,
2237
- Lt as resolveColumns,
2238
- Ht as resolveTableActions,
2239
- qt as sortRows,
2240
- re as toTitleCase,
2241
- Qt as useAnyTableController,
2242
- Xt as useAnyTableData,
2243
- Ut as useAnyTablePagination,
2244
- Ot as useAnyTableSearch,
2245
- er as useAnyTableSelection,
2246
- Rt as useAnyTableSorting,
2247
- Y as useAnyTableTheme
2296
+ Mr as ActionRenderer,
2297
+ Fr as AnyTable,
2298
+ Je as AnyTableInner,
2299
+ ur as AnyTableThemeProvider,
2300
+ Er as ArrayRenderer,
2301
+ $r as BadgeRenderer,
2302
+ xr as BooleanRenderer,
2303
+ Br as CellRenderer,
2304
+ Dr as ConfirmModal,
2305
+ hr as CurrencyRenderer,
2306
+ Qe as DEFAULT_THEME_COLORS,
2307
+ Ge as DateRenderer,
2308
+ Tr as EmailRenderer,
2309
+ _ as FallbackPlaceholder,
2310
+ kr as ImageRenderer,
2311
+ pr as NumberRenderer,
2312
+ Nr as ObjectRenderer,
2313
+ Sr as PhoneRenderer,
2314
+ Cr as ProgressRenderer,
2315
+ Pr as RatingRenderer,
2316
+ vr as StatusRenderer,
2317
+ tt as StringRenderer,
2318
+ Ye as TABLE_PRESETS,
2319
+ Hr as TableBody,
2320
+ zr as TableEmptyState,
2321
+ Rr as TableErrorState,
2322
+ yr as TableHeader,
2323
+ _r as TablePagination,
2324
+ br as TableSearch,
2325
+ jr as TableSkeleton,
2326
+ fr as TableToolbar,
2327
+ Ar as UrlRenderer,
2328
+ Fr as default,
2329
+ et as defaultAnyTableTheme,
2330
+ q as extractPaginationMeta,
2331
+ lr as filterRowsBySearch,
2332
+ Kt as generateAutoColumns,
2333
+ A as getNestedValue,
2334
+ ie as inferColumnType,
2335
+ Ue as isImageUrl,
2336
+ Yt as isIsoDate,
2337
+ Lt as isPlainObject,
2338
+ sr as normalizeApiResponse,
2339
+ rt as renderActionIcon,
2340
+ Jt as resolveColumns,
2341
+ qt as resolveTableActions,
2342
+ ir as sortRows,
2343
+ le as toTitleCase,
2344
+ cr as useAnyTableController,
2345
+ dr as useAnyTableData,
2346
+ er as useAnyTablePagination,
2347
+ Xt as useAnyTableSearch,
2348
+ mr as useAnyTableSelection,
2349
+ Qt as useAnyTableSorting,
2350
+ X as useAnyTableTheme,
2351
+ gr as useAnyTableVirtualizer
2248
2352
  };
2249
2353
  //# sourceMappingURL=index.js.map