@kareemelbalshe/any-table 1.2.0 → 1.3.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,370 +1,31 @@
1
- import r, { useMemo as z, useState as R, useEffect as ee, useCallback as B, useRef as oe, useImperativeHandle as ur, createContext as gr, useContext as ft } from "react";
2
- function j(e, t, o = void 0) {
3
- if (e == null) return o;
1
+ import r, { useMemo as D, useState as $, useEffect as we, useCallback as B, useRef as ve, useImperativeHandle as Ar, createContext as Pr, useContext as Wt } from "react";
2
+ function L(e, t, n = void 0) {
3
+ if (e == null) return n;
4
4
  if (!t || typeof t != "string") return e;
5
5
  if (t in e && e[t] !== void 0)
6
6
  return e[t];
7
7
  const i = t.replace(/\[(\w+)\]/g, ".$1").split(".");
8
8
  let a = e;
9
9
  for (let l = 0; l < i.length; l++) {
10
- const u = i[l];
10
+ const m = i[l];
11
11
  if (a == null)
12
- return o;
13
- a = a[u];
12
+ return n;
13
+ a = a[m];
14
14
  }
15
- return a !== void 0 ? a : o;
15
+ return a !== void 0 ? a : n;
16
16
  }
17
- function mr(e) {
17
+ function Cr(e) {
18
18
  return e !== null && typeof e == "object" && !Array.isArray(e);
19
19
  }
20
- function Re(e) {
20
+ function ot(e) {
21
21
  if (!e || typeof e != "string") return "";
22
22
  let t = e.replace(/[._\-]+/g, " ");
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);
23
+ return t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.split(" ").filter(Boolean).map((n) => {
24
+ const s = n.toLowerCase();
25
+ return n.length <= 3 && n === n.toUpperCase() ? n : s.charAt(0).toUpperCase() + s.slice(1);
26
26
  }).join(" ");
27
27
  }
28
- const fr = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif"], br = ["image", "avatar", "photo", "logo", "picture", "thumbnail", "banner", "img", "icon"], pr = ["price", "spend", "cost", "amount", "total", "fee", "rate", "salary", "balance", "deposit", "commission", "charge"], yr = ["status", "state", "phase", "condition"];
29
- function ze(e, t) {
30
- const o = e.toLowerCase();
31
- if (br.some((a) => o.includes(a)))
32
- return "image";
33
- if (pr.some((a) => o.includes(a)))
34
- return "currency";
35
- if (yr.some((a) => o.includes(a)))
36
- return "status";
37
- const s = t.filter((a) => a != null && a !== "");
38
- if (s.length === 0)
39
- return "string";
40
- const i = s[0];
41
- if (typeof i == "boolean" || o.startsWith("is") || o.startsWith("has"))
42
- return "boolean";
43
- if (Array.isArray(i))
44
- return "array";
45
- if (typeof i == "object")
46
- return i.url && typeof i.url == "string" && lt(i.url) ? "image" : "object";
47
- if (typeof i == "number")
48
- return "number";
49
- if (typeof i == "string") {
50
- const a = i.trim();
51
- if (lt(a))
52
- return "image";
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 (hr(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
- return "email";
58
- if (a.startsWith("http://") || a.startsWith("https://"))
59
- return "url";
60
- if (o.includes("phone") || o.includes("mobile") || o.includes("tel"))
61
- return "phone";
62
- }
63
- return "string";
64
- }
65
- function lt(e) {
66
- if (!e || typeof e != "string") return !1;
67
- if (e.startsWith("data:image/")) return !0;
68
- const t = e.toLowerCase().split("?")[0];
69
- return fr.some((o) => t.endsWith(o));
70
- }
71
- function hr(e) {
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
- }
74
- const xr = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
75
- function kr(e, t = xr, o = 2) {
76
- if (!e || !e.length)
77
- return [];
78
- const s = /* @__PURE__ */ new Map(), i = e.slice(0, 10);
79
- for (const a of i)
80
- !a || typeof a != "object" || bt(a, "", s, i, t, 0, o);
81
- return Array.from(s.values());
82
- }
83
- function bt(e, t, o, s, i, a, l) {
84
- if (!(!e || typeof e != "object" || a > l))
85
- for (const u of Object.keys(e)) {
86
- if (i.includes(u)) continue;
87
- const d = t ? `${t}.${u}` : u, c = e[u];
88
- if (mr(c) && !vr(c) && a < l) {
89
- bt(c, d, o, s, i, a + 1, l);
90
- continue;
91
- }
92
- if (!o.has(d)) {
93
- const n = s.map((g) => j(g, d)), b = ze(d, n);
94
- o.set(d, {
95
- key: d,
96
- title: Re(d),
97
- type: b,
98
- sortable: !0,
99
- searchable: !0,
100
- align: b === "number" || b === "currency" ? "right" : "left"
101
- });
102
- }
103
- }
104
- }
105
- function vr(e, t) {
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
- }
108
- function pt(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, u) => {
111
- const d = i && i[u] ? i[u] : Re(l), c = t.map((b) => j(b, l)), n = ze(l, c);
112
- return {
113
- key: l,
114
- title: d,
115
- type: n,
116
- sortable: !0,
117
- searchable: !0,
118
- align: n === "number" || n === "currency" ? "right" : "left"
119
- };
120
- }) : o && Array.isArray(o) && o.length > 0 ? o.map((l) => {
121
- if (typeof l == "string") {
122
- const n = t.map((g) => j(g, l)), b = ze(l, n);
123
- return {
124
- key: l,
125
- title: Re(l),
126
- type: b,
127
- sortable: !0,
128
- searchable: !0,
129
- align: b === "number" || b === "currency" ? "right" : "left"
130
- };
131
- }
132
- const u = String(l.key), d = l.title !== void 0 ? l.title : Re(u), c = l.type || ze(u, t.map((n) => j(n, u)));
133
- return {
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
- };
141
- }) : s && t && t.length > 0 ? kr(t) : [];
142
- }
143
- function Ie(e) {
144
- if (typeof e == "number") return e;
145
- if (typeof e == "string") {
146
- const t = parseInt(e, 10);
147
- if (!isNaN(t)) return t;
148
- }
149
- return 150;
150
- }
151
- function wr(e, t = {}) {
152
- const {
153
- selectable: o = !1,
154
- hasActions: s = !1,
155
- actionsWidth: i = 100,
156
- columnWidths: a = {},
157
- isRtl: l = !1
158
- } = t, u = {};
159
- let d = o ? 44 : 0;
160
- for (let n = 0; n < e.length; n++) {
161
- const b = e[n], g = String(b.key), m = a[g] ?? Ie(b.width);
162
- b.pinned === "left" && (u[g] = {
163
- position: "sticky",
164
- [l ? "right" : "left"]: `${d}px`,
165
- zIndex: 5
166
- }, d += m);
167
- }
168
- let c = s ? Ie(i) : 0;
169
- for (let n = e.length - 1; n >= 0; n--) {
170
- const b = e[n], g = String(b.key), m = a[g] ?? Ie(b.width);
171
- b.pinned === "right" && (u[g] = {
172
- position: "sticky",
173
- [l ? "left" : "right"]: `${c}px`,
174
- zIndex: 5
175
- }, c += m);
176
- }
177
- return u;
178
- }
179
- function Er(e) {
180
- const {
181
- explicitActions: t,
182
- buttons: o,
183
- block: s,
184
- handleBlock: i,
185
- view: a,
186
- linkView: l,
187
- viewHandler: u,
188
- edit: d,
189
- linkEdit: c,
190
- editHandler: n,
191
- del: b,
192
- handleDelete: g
193
- } = e, m = [...t || []];
194
- return o && Array.isArray(o) && o.forEach((f, x) => {
195
- m.push({
196
- id: `legacy-btn-${x}`,
197
- label: f.label,
198
- icon: f.icon,
199
- className: f.className,
200
- show: f.show,
201
- hide: f.hide,
202
- onClick: (w) => f.onClick(w)
203
- });
204
- }), s && i && m.push({
205
- id: "legacy-block",
206
- label: (f) => f.isBanned || !f.isActive ? "Unblock" : "Block",
207
- variant: (f) => f.isBanned || !f.isActive ? "success" : "danger",
208
- onClick: (f) => i(f?._id || f?.id)
209
- }), a && (u || l) && m.push({
210
- id: "legacy-view",
211
- label: "View",
212
- variant: "primary",
213
- onClick: (f) => {
214
- const x = f?._id || f?.id;
215
- u ? u(x) : l && typeof window < "u" && (window.location.href = `${l}/${x}`);
216
- }
217
- }), d && (n || c) && m.push({
218
- id: "legacy-edit",
219
- label: "Edit",
220
- variant: "info",
221
- onClick: (f) => {
222
- const x = f?._id || f?.id;
223
- n ? n(x) : c && typeof window < "u" && (window.location.href = `${c}/${x}`);
224
- }
225
- }), b && g && m.push({
226
- id: "legacy-del",
227
- label: "Delete",
228
- variant: "danger",
229
- confirmation: {
230
- title: "Delete Item",
231
- message: "Are you sure you want to delete this record?"
232
- },
233
- onClick: (f) => g(f?._id || f?.id)
234
- }), m;
235
- }
236
- function yt({
237
- config: e,
238
- onSearchChange: t
239
- }) {
240
- const o = z(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.debounce ?? 350, [a, l] = R(""), [u, d] = R(""), [c, n] = R(!1);
241
- ee(() => {
242
- if (!s) return;
243
- if (a === "") {
244
- d(""), n(!1), t?.("");
245
- return;
246
- }
247
- n(!0);
248
- const m = setTimeout(() => {
249
- d(a), n(!1), t?.(a);
250
- }, i);
251
- return () => {
252
- clearTimeout(m);
253
- };
254
- }, [a, i, s, t]);
255
- const b = B((m) => {
256
- l(m);
257
- }, []), g = B(() => {
258
- l(""), d(""), n(!1), t?.("");
259
- }, [t]);
260
- return {
261
- enabled: s,
262
- search: a,
263
- debouncedSearch: u,
264
- isDebouncing: c,
265
- setSearch: b,
266
- clearSearch: g,
267
- searchConfig: o
268
- };
269
- }
270
- function ht({
271
- config: e,
272
- onSortChange: t
273
- }) {
274
- const o = z(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.allowUnsort ?? !0, [a, l] = R(
275
- o.defaultSortBy || null
276
- ), [u, d] = R(
277
- o.defaultSortOrder || null
278
- ), c = B(
279
- (g) => {
280
- if (s) {
281
- if (a !== g) {
282
- l(g), d("asc"), t?.(g, "asc");
283
- return;
284
- }
285
- u === "asc" ? (d("desc"), t?.(g, "desc")) : u === "desc" && i ? (l(null), d(null), t?.(null, null)) : (d("asc"), t?.(g, "asc"));
286
- }
287
- },
288
- [s, a, u, i, t]
289
- ), n = B(
290
- (g, m) => {
291
- l(g), d(m), t?.(g, m);
292
- },
293
- [t]
294
- ), b = B(() => {
295
- l(null), d(null), t?.(null, null);
296
- }, [t]);
297
- return {
298
- enabled: s,
299
- sortBy: a,
300
- sortOrder: u,
301
- toggleSort: c,
302
- setSorting: n,
303
- resetSorting: b,
304
- sortingConfig: o
305
- };
306
- }
307
- function xt({
308
- config: e,
309
- totalRecords: t,
310
- onPageChange: o
311
- }) {
312
- const s = z(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), i = s.enabled !== !1 && !!e, a = s.defaultPage || 1, l = s.defaultPageSize || 10, u = s.pageSizeOptions || [5, 10, 20, 50, 100], [d, c] = R(a), [n, b] = R(l), g = Math.max(1, Math.ceil(t / Math.max(1, n))), m = B(
313
- (p) => {
314
- const y = Math.max(1, Math.min(p, g));
315
- c(y), o?.(y, n);
316
- },
317
- [g, n, o]
318
- ), f = B(
319
- (p) => {
320
- b(p), c(1), o?.(1, p);
321
- },
322
- [o]
323
- ), x = B(() => {
324
- d < g && m(d + 1);
325
- }, [d, g, m]), w = B(() => {
326
- d > 1 && m(d - 1);
327
- }, [d, m]), P = B(() => {
328
- c(1), b(l), o?.(1, l);
329
- }, [l, o]), M = B(
330
- (p = 5) => {
331
- const y = Math.max(
332
- 1,
333
- Math.min(d - Math.floor(p / 2), g - p + 1)
334
- ), k = Math.min(g, y + p - 1), N = [];
335
- for (let D = y; D <= k; D++)
336
- N.push(D);
337
- return N;
338
- },
339
- [d, g]
340
- ), E = B(
341
- (p) => {
342
- if (!i) return p;
343
- const y = (d - 1) * n;
344
- return p.slice(y, y + n);
345
- },
346
- [i, d, n]
347
- );
348
- return {
349
- enabled: i,
350
- page: d,
351
- pageSize: n,
352
- totalRecords: t,
353
- totalPages: g,
354
- pageSizeOptions: u,
355
- hasNextPage: d < g,
356
- hasPrevPage: d > 1,
357
- setPage: m,
358
- setPageSize: f,
359
- nextPage: x,
360
- prevPage: w,
361
- resetPagination: P,
362
- getPageWindow: M,
363
- sliceData: E,
364
- paginationConfig: s
365
- };
366
- }
367
- const Nr = [
28
+ const Tr = [
368
29
  "total",
369
30
  "totalCount",
370
31
  "count",
@@ -380,7 +41,7 @@ const Nr = [
380
41
  "pageInfo.total",
381
42
  "pageInfo.totalCount",
382
43
  "paging.total"
383
- ], Sr = [
44
+ ], Rr = [
384
45
  "page",
385
46
  "currentPage",
386
47
  "pageNumber",
@@ -390,7 +51,7 @@ const Nr = [
390
51
  "pagination.page",
391
52
  "pagination.currentPage",
392
53
  "pageInfo.page"
393
- ], Cr = [
54
+ ], Br = [
394
55
  "pageSize",
395
56
  "limit",
396
57
  "perPage",
@@ -401,7 +62,7 @@ const Nr = [
401
62
  "pagination.pageSize",
402
63
  "pagination.limit",
403
64
  "pagination.perPage"
404
- ], Ar = [
65
+ ], $r = [
405
66
  "totalPages",
406
67
  "pageCount",
407
68
  "lastPage",
@@ -412,95 +73,95 @@ const Nr = [
412
73
  "pagination.totalPages",
413
74
  "pagination.lastPage"
414
75
  ];
415
- function de(e, t, o = 1, s = 10, i) {
76
+ function We(e, t, n = 1, s = 10, i) {
416
77
  if (!e || typeof e != "object") {
417
- const c = i !== void 0 ? i : 0;
78
+ const u = i !== void 0 ? i : 0;
418
79
  return {
419
- page: o,
80
+ page: n,
420
81
  pageSize: s,
421
- total: c,
422
- totalPages: Math.max(1, Math.ceil(c / Math.max(1, s))),
82
+ total: u,
83
+ totalPages: Math.max(1, Math.ceil(u / Math.max(1, s))),
423
84
  hasNextPage: !1,
424
85
  hasPrevPage: !1
425
86
  };
426
87
  }
427
88
  let a;
428
89
  if (t?.totalPath) {
429
- const c = j(e, t.totalPath);
430
- typeof c == "number" ? a = c : typeof c == "string" && !isNaN(Number(c)) && (a = Number(c));
90
+ const u = L(e, t.totalPath);
91
+ typeof u == "number" ? a = u : typeof u == "string" && !isNaN(Number(u)) && (a = Number(u));
431
92
  }
432
93
  if (a === void 0)
433
- for (const c of Nr) {
434
- const n = j(e, c);
435
- if (typeof n == "number" && !isNaN(n)) {
436
- a = n;
94
+ for (const u of Tr) {
95
+ const o = L(e, u);
96
+ if (typeof o == "number" && !isNaN(o)) {
97
+ a = o;
437
98
  break;
438
99
  }
439
- if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
440
- a = Number(n);
100
+ if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
101
+ a = Number(o);
441
102
  break;
442
103
  }
443
104
  }
444
105
  a === void 0 && (a = i !== void 0 ? i : 0);
445
106
  let l;
446
107
  if (t?.pagePath) {
447
- const c = j(e, t.pagePath);
448
- typeof c == "number" ? l = c : typeof c == "string" && !isNaN(Number(c)) && (l = Number(c));
108
+ const u = L(e, t.pagePath);
109
+ typeof u == "number" ? l = u : typeof u == "string" && !isNaN(Number(u)) && (l = Number(u));
449
110
  }
450
111
  if (l === void 0)
451
- for (const c of Sr) {
452
- const n = j(e, c);
453
- if (typeof n == "number" && !isNaN(n)) {
454
- l = n;
112
+ for (const u of Rr) {
113
+ const o = L(e, u);
114
+ if (typeof o == "number" && !isNaN(o)) {
115
+ l = o;
455
116
  break;
456
117
  }
457
- if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
458
- l = Number(n);
118
+ if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
119
+ l = Number(o);
459
120
  break;
460
121
  }
461
122
  }
462
- l === void 0 && (l = o);
463
- let u;
123
+ l === void 0 && (l = n);
124
+ let m;
464
125
  if (t?.pageSizePath) {
465
- const c = j(e, t.pageSizePath);
466
- typeof c == "number" ? u = c : typeof c == "string" && !isNaN(Number(c)) && (u = Number(c));
126
+ const u = L(e, t.pageSizePath);
127
+ typeof u == "number" ? m = u : typeof u == "string" && !isNaN(Number(u)) && (m = Number(u));
467
128
  }
468
- if (u === void 0)
469
- for (const c of Cr) {
470
- const n = j(e, c);
471
- if (typeof n == "number" && !isNaN(n)) {
472
- u = n;
129
+ if (m === void 0)
130
+ for (const u of Br) {
131
+ const o = L(e, u);
132
+ if (typeof o == "number" && !isNaN(o)) {
133
+ m = o;
473
134
  break;
474
135
  }
475
- if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
476
- u = Number(n);
136
+ if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
137
+ m = Number(o);
477
138
  break;
478
139
  }
479
140
  }
480
- u === void 0 && (u = s);
141
+ m === void 0 && (m = s);
481
142
  let d;
482
143
  if (t?.totalPagesPath) {
483
- const c = j(e, t.totalPagesPath);
484
- typeof c == "number" ? d = c : typeof c == "string" && !isNaN(Number(c)) && (d = Number(c));
144
+ const u = L(e, t.totalPagesPath);
145
+ typeof u == "number" ? d = u : typeof u == "string" && !isNaN(Number(u)) && (d = Number(u));
485
146
  }
486
147
  if (d === void 0)
487
- for (const c of Ar) {
488
- const n = j(e, c);
489
- if (typeof n == "number" && !isNaN(n)) {
490
- d = n;
148
+ for (const u of $r) {
149
+ const o = L(e, u);
150
+ if (typeof o == "number" && !isNaN(o)) {
151
+ d = o;
491
152
  break;
492
153
  }
493
154
  }
494
- return (d === void 0 || d <= 0) && (d = Math.max(1, Math.ceil(a / Math.max(1, u)))), {
155
+ return (d === void 0 || d <= 0) && (d = Math.max(1, Math.ceil(a / Math.max(1, m)))), {
495
156
  total: a,
496
157
  page: l,
497
- pageSize: u,
158
+ pageSize: m,
498
159
  totalPages: d,
499
160
  hasNextPage: l < d,
500
161
  hasPrevPage: l > 1
501
162
  };
502
163
  }
503
- const Pr = [
164
+ const zr = [
504
165
  "data",
505
166
  "items",
506
167
  "results",
@@ -521,24 +182,24 @@ const Pr = [
521
182
  "subscriptions",
522
183
  "deadLetters.items"
523
184
  ];
524
- function Tr(e, t, o) {
525
- const s = o?.page || 1, i = o?.pageSize || 10;
185
+ function wt(e, t, n) {
186
+ const s = n?.page || 1, i = n?.pageSize || 10;
526
187
  if (t?.transformResponse && typeof t.transformResponse == "function") {
527
188
  const a = t.transformResponse(e);
528
189
  if (Array.isArray(a))
529
190
  return {
530
191
  data: a,
531
- meta: de(e, t.response, s, i, a.length),
192
+ meta: We(e, t.response, s, i, a.length),
532
193
  raw: e
533
194
  };
534
195
  if (a && typeof a == "object") {
535
- const l = Array.isArray(a.data) ? a.data : [], u = a.meta ? {
196
+ const l = Array.isArray(a.data) ? a.data : [], m = a.meta ? {
536
197
  total: a.meta.total !== void 0 ? a.meta.total : l.length,
537
198
  page: a.meta.page !== void 0 ? a.meta.page : s,
538
199
  pageSize: a.meta.pageSize !== void 0 ? a.meta.pageSize : i,
539
200
  totalPages: a.meta.totalPages !== void 0 ? a.meta.totalPages : Math.max(1, Math.ceil((a.meta.total || l.length) / (a.meta.pageSize || i)))
540
- } : de(e, t.response, s, i, l.length);
541
- return { data: l, meta: u, raw: e };
201
+ } : We(e, t.response, s, i, l.length);
202
+ return { data: l, meta: m, raw: e };
542
203
  }
543
204
  }
544
205
  if (Array.isArray(e))
@@ -555,24 +216,24 @@ function Tr(e, t, o) {
555
216
  raw: e
556
217
  };
557
218
  if (t?.response?.dataPath) {
558
- const a = j(e, t.response.dataPath), l = Array.isArray(a) ? a : [], u = de(e, t.response, s, i, l.length);
559
- return { data: l, meta: u, raw: e };
219
+ const a = L(e, t.response.dataPath), l = Array.isArray(a) ? a : [], m = We(e, t.response, s, i, l.length);
220
+ return { data: l, meta: m, raw: e };
560
221
  }
561
222
  if (e && typeof e == "object") {
562
- for (const a of Pr) {
563
- const l = j(e, a);
223
+ for (const a of zr) {
224
+ const l = L(e, a);
564
225
  if (Array.isArray(l)) {
565
- const u = de(e, t?.response, s, i, l.length);
226
+ const m = We(e, t?.response, s, i, l.length);
566
227
  return {
567
228
  data: l,
568
- meta: u,
229
+ meta: m,
569
230
  raw: e
570
231
  };
571
232
  }
572
233
  }
573
234
  for (const a in e)
574
235
  if (Array.isArray(e[a])) {
575
- const l = de(e, t?.response, s, i, e[a].length);
236
+ const l = We(e, t?.response, s, i, e[a].length);
576
237
  return {
577
238
  data: e[a],
578
239
  meta: l,
@@ -609,7 +270,346 @@ function Tr(e, t, o) {
609
270
  raw: e
610
271
  };
611
272
  }
612
- function $r(e, t, o, s) {
273
+ const jr = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif"], Mr = ["image", "avatar", "photo", "logo", "picture", "thumbnail", "banner", "img", "icon"], Dr = ["price", "spend", "cost", "amount", "total", "fee", "rate", "salary", "balance", "deposit", "commission", "charge"], Lr = ["status", "state", "phase", "condition"];
274
+ function st(e, t) {
275
+ const n = e.toLowerCase();
276
+ if (Mr.some((a) => n.includes(a)))
277
+ return "image";
278
+ if (Dr.some((a) => n.includes(a)))
279
+ return "currency";
280
+ if (Lr.some((a) => n.includes(a)))
281
+ return "status";
282
+ const s = t.filter((a) => a != null && a !== "");
283
+ if (s.length === 0)
284
+ return "string";
285
+ const i = s[0];
286
+ if (typeof i == "boolean" || n.startsWith("is") || n.startsWith("has"))
287
+ return "boolean";
288
+ if (Array.isArray(i))
289
+ return "array";
290
+ if (typeof i == "object")
291
+ return i.url && typeof i.url == "string" && Bt(i.url) ? "image" : "object";
292
+ if (typeof i == "number")
293
+ return "number";
294
+ if (typeof i == "string") {
295
+ const a = i.trim();
296
+ if (Bt(a))
297
+ return "image";
298
+ const l = n.includes("date") || n.includes("time") || n.endsWith("_at") || n.includes("_at_") || /(?:created|updated|deleted|modified|published)at$/i.test(n);
299
+ if (Wr(a) || l && a.length >= 8 && !isNaN(Date.parse(a)))
300
+ return a.includes("T") || a.includes(":") ? "datetime" : "date";
301
+ if (a.includes("@") && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a))
302
+ return "email";
303
+ if (a.startsWith("http://") || a.startsWith("https://"))
304
+ return "url";
305
+ if (n.includes("phone") || n.includes("mobile") || n.includes("tel"))
306
+ return "phone";
307
+ }
308
+ return "string";
309
+ }
310
+ function Bt(e) {
311
+ if (!e || typeof e != "string") return !1;
312
+ if (e.startsWith("data:image/")) return !0;
313
+ const t = e.toLowerCase().split("?")[0];
314
+ return jr.some((n) => t.endsWith(n));
315
+ }
316
+ function Wr(e) {
317
+ 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);
318
+ }
319
+ const _r = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
320
+ function Or(e, t = _r, n = 2) {
321
+ if (!e || !e.length)
322
+ return [];
323
+ const s = /* @__PURE__ */ new Map(), i = e.slice(0, 10);
324
+ for (const a of i)
325
+ !a || typeof a != "object" || _t(a, "", s, i, t, 0, n);
326
+ return Array.from(s.values());
327
+ }
328
+ function _t(e, t, n, s, i, a, l) {
329
+ if (!(!e || typeof e != "object" || a > l))
330
+ for (const m of Object.keys(e)) {
331
+ if (i.includes(m)) continue;
332
+ const d = t ? `${t}.${m}` : m, u = e[m];
333
+ if (Cr(u) && !Fr(u) && a < l) {
334
+ _t(u, d, n, s, i, a + 1, l);
335
+ continue;
336
+ }
337
+ if (!n.has(d)) {
338
+ const o = s.map((c) => L(c, d)), p = st(d, o);
339
+ n.set(d, {
340
+ key: d,
341
+ title: ot(d),
342
+ type: p,
343
+ sortable: !0,
344
+ searchable: !0,
345
+ align: p === "number" || p === "currency" ? "right" : "left"
346
+ });
347
+ }
348
+ }
349
+ }
350
+ function Fr(e, t) {
351
+ 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;
352
+ }
353
+ function Ot(e) {
354
+ const { data: t = [], columns: n, autoColumns: s = !0, thead: i, headerData: a } = e;
355
+ return a && Array.isArray(a) && a.length > 0 ? a.map((l, m) => {
356
+ const d = i && i[m] ? i[m] : ot(l), u = t.map((p) => L(p, l)), o = st(l, u);
357
+ return {
358
+ key: l,
359
+ title: d,
360
+ type: o,
361
+ sortable: !0,
362
+ searchable: !0,
363
+ align: o === "number" || o === "currency" ? "right" : "left"
364
+ };
365
+ }) : n && Array.isArray(n) && n.length > 0 ? n.map((l) => {
366
+ if (typeof l == "string") {
367
+ const o = t.map((c) => L(c, l)), p = st(l, o);
368
+ return {
369
+ key: l,
370
+ title: ot(l),
371
+ type: p,
372
+ sortable: !0,
373
+ searchable: !0,
374
+ align: p === "number" || p === "currency" ? "right" : "left"
375
+ };
376
+ }
377
+ const m = String(l.key), d = l.title !== void 0 ? l.title : ot(m), u = l.type || st(m, t.map((o) => L(o, m)));
378
+ return {
379
+ ...l,
380
+ title: d,
381
+ type: u,
382
+ sortable: l.sortable !== void 0 ? l.sortable : !0,
383
+ searchable: l.searchable !== void 0 ? l.searchable : !0,
384
+ align: l.align || (u === "number" || u === "currency" ? "right" : "left")
385
+ };
386
+ }) : s && t && t.length > 0 ? Or(t) : [];
387
+ }
388
+ function yt(e) {
389
+ if (typeof e == "number") return e;
390
+ if (typeof e == "string") {
391
+ const t = parseInt(e, 10);
392
+ if (!isNaN(t)) return t;
393
+ }
394
+ return 150;
395
+ }
396
+ function Hr(e, t = {}) {
397
+ const {
398
+ selectable: n = !1,
399
+ hasActions: s = !1,
400
+ actionsWidth: i = 100,
401
+ columnWidths: a = {},
402
+ isRtl: l = !1
403
+ } = t, m = {};
404
+ let d = n ? 44 : 0;
405
+ for (let o = 0; o < e.length; o++) {
406
+ const p = e[o], c = String(p.key), g = a[c] ?? yt(p.width);
407
+ p.pinned === "left" && (m[c] = {
408
+ position: "sticky",
409
+ [l ? "right" : "left"]: `${d}px`,
410
+ zIndex: 5
411
+ }, d += g);
412
+ }
413
+ let u = s ? yt(i) : 0;
414
+ for (let o = e.length - 1; o >= 0; o--) {
415
+ const p = e[o], c = String(p.key), g = a[c] ?? yt(p.width);
416
+ p.pinned === "right" && (m[c] = {
417
+ position: "sticky",
418
+ [l ? "left" : "right"]: `${u}px`,
419
+ zIndex: 5
420
+ }, u += g);
421
+ }
422
+ return m;
423
+ }
424
+ function Kr(e) {
425
+ const {
426
+ explicitActions: t,
427
+ buttons: n,
428
+ block: s,
429
+ handleBlock: i,
430
+ view: a,
431
+ linkView: l,
432
+ viewHandler: m,
433
+ edit: d,
434
+ linkEdit: u,
435
+ editHandler: o,
436
+ del: p,
437
+ handleDelete: c
438
+ } = e, g = [...t || []];
439
+ return n && Array.isArray(n) && n.forEach((f, b) => {
440
+ g.push({
441
+ id: `legacy-btn-${b}`,
442
+ label: f.label,
443
+ icon: f.icon,
444
+ className: f.className,
445
+ show: f.show,
446
+ hide: f.hide,
447
+ onClick: (S) => f.onClick(S)
448
+ });
449
+ }), s && i && g.push({
450
+ id: "legacy-block",
451
+ label: (f) => f.isBanned || !f.isActive ? "Unblock" : "Block",
452
+ variant: (f) => f.isBanned || !f.isActive ? "success" : "danger",
453
+ onClick: (f) => i(f?._id || f?.id)
454
+ }), a && (m || l) && g.push({
455
+ id: "legacy-view",
456
+ label: "View",
457
+ variant: "primary",
458
+ onClick: (f) => {
459
+ const b = f?._id || f?.id;
460
+ m ? m(b) : l && typeof window < "u" && (window.location.href = `${l}/${b}`);
461
+ }
462
+ }), d && (o || u) && g.push({
463
+ id: "legacy-edit",
464
+ label: "Edit",
465
+ variant: "info",
466
+ onClick: (f) => {
467
+ const b = f?._id || f?.id;
468
+ o ? o(b) : u && typeof window < "u" && (window.location.href = `${u}/${b}`);
469
+ }
470
+ }), p && c && g.push({
471
+ id: "legacy-del",
472
+ label: "Delete",
473
+ variant: "danger",
474
+ confirmation: {
475
+ title: "Delete Item",
476
+ message: "Are you sure you want to delete this record?"
477
+ },
478
+ onClick: (f) => c(f?._id || f?.id)
479
+ }), g;
480
+ }
481
+ function Ft({
482
+ config: e,
483
+ onSearchChange: t
484
+ }) {
485
+ const n = D(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = n.enabled !== !1 && !!e, i = n.debounce ?? 350, [a, l] = $(""), [m, d] = $(""), [u, o] = $(!1);
486
+ we(() => {
487
+ if (!s) return;
488
+ if (a === "") {
489
+ d(""), o(!1), t?.("");
490
+ return;
491
+ }
492
+ o(!0);
493
+ const g = setTimeout(() => {
494
+ d(a), o(!1), t?.(a);
495
+ }, i);
496
+ return () => {
497
+ clearTimeout(g);
498
+ };
499
+ }, [a, i, s, t]);
500
+ const p = B((g) => {
501
+ l(g);
502
+ }, []), c = B(() => {
503
+ l(""), d(""), o(!1), t?.("");
504
+ }, [t]);
505
+ return {
506
+ enabled: s,
507
+ search: a,
508
+ debouncedSearch: m,
509
+ isDebouncing: u,
510
+ setSearch: p,
511
+ clearSearch: c,
512
+ searchConfig: n
513
+ };
514
+ }
515
+ function Ht({
516
+ config: e,
517
+ onSortChange: t
518
+ }) {
519
+ const n = D(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = n.enabled !== !1 && !!e, i = n.allowUnsort ?? !0, [a, l] = $(
520
+ n.defaultSortBy || null
521
+ ), [m, d] = $(
522
+ n.defaultSortOrder || null
523
+ ), u = B(
524
+ (c) => {
525
+ if (s) {
526
+ if (a !== c) {
527
+ l(c), d("asc"), t?.(c, "asc");
528
+ return;
529
+ }
530
+ m === "asc" ? (d("desc"), t?.(c, "desc")) : m === "desc" && i ? (l(null), d(null), t?.(null, null)) : (d("asc"), t?.(c, "asc"));
531
+ }
532
+ },
533
+ [s, a, m, i, t]
534
+ ), o = B(
535
+ (c, g) => {
536
+ l(c), d(g), t?.(c, g);
537
+ },
538
+ [t]
539
+ ), p = B(() => {
540
+ l(null), d(null), t?.(null, null);
541
+ }, [t]);
542
+ return {
543
+ enabled: s,
544
+ sortBy: a,
545
+ sortOrder: m,
546
+ toggleSort: u,
547
+ setSorting: o,
548
+ resetSorting: p,
549
+ sortingConfig: n
550
+ };
551
+ }
552
+ function Kt({
553
+ config: e,
554
+ totalRecords: t,
555
+ onPageChange: n
556
+ }) {
557
+ const s = D(() => 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, u] = $(a), [o, p] = $(l), c = Math.max(1, Math.ceil(t / Math.max(1, o))), g = B(
558
+ (y) => {
559
+ const x = Math.max(1, Math.min(y, c));
560
+ u(x), n?.(x, o);
561
+ },
562
+ [c, o, n]
563
+ ), f = B(
564
+ (y) => {
565
+ p(y), u(1), n?.(1, y);
566
+ },
567
+ [n]
568
+ ), b = B(() => {
569
+ d < c && g(d + 1);
570
+ }, [d, c, g]), S = B(() => {
571
+ d > 1 && g(d - 1);
572
+ }, [d, g]), z = B(() => {
573
+ u(1), p(l), n?.(1, l);
574
+ }, [l, n]), W = B(
575
+ (y = 5) => {
576
+ const x = Math.max(
577
+ 1,
578
+ Math.min(d - Math.floor(y / 2), c - y + 1)
579
+ ), k = Math.min(c, x + y - 1), h = [];
580
+ for (let j = x; j <= k; j++)
581
+ h.push(j);
582
+ return h;
583
+ },
584
+ [d, c]
585
+ ), E = B(
586
+ (y) => {
587
+ if (!i) return y;
588
+ const x = (d - 1) * o;
589
+ return y.slice(x, x + o);
590
+ },
591
+ [i, d, o]
592
+ );
593
+ return {
594
+ enabled: i,
595
+ page: d,
596
+ pageSize: o,
597
+ totalRecords: t,
598
+ totalPages: c,
599
+ pageSizeOptions: m,
600
+ hasNextPage: d < c,
601
+ hasPrevPage: d > 1,
602
+ setPage: g,
603
+ setPageSize: f,
604
+ nextPage: b,
605
+ prevPage: S,
606
+ resetPagination: z,
607
+ getPageWindow: W,
608
+ sliceData: E,
609
+ paginationConfig: s
610
+ };
611
+ }
612
+ function Ir(e, t, n, s) {
613
613
  if (!e || !e.length) return [];
614
614
  if (!t || typeof t != "string" || !t.trim()) return e;
615
615
  const i = t.trim().toLowerCase();
@@ -618,275 +618,284 @@ function $r(e, t, o, s) {
618
618
  const a = i.split(/\s+/).filter(Boolean);
619
619
  return e.filter((l) => {
620
620
  if (!l || typeof l != "object") return !1;
621
- const u = [];
622
- if (o && o.length > 0)
623
- for (const c of o) {
624
- const n = j(l, c);
625
- n != null && (typeof n == "object" ? u.push(JSON.stringify(n).toLowerCase()) : u.push(String(n).toLowerCase()));
621
+ const m = [];
622
+ if (n && n.length > 0)
623
+ for (const u of n) {
624
+ const o = L(l, u);
625
+ o != null && (typeof o == "object" ? m.push(JSON.stringify(o).toLowerCase()) : m.push(String(o).toLowerCase()));
626
626
  }
627
627
  else
628
- Ve(l, u);
629
- const d = u.join(" ");
630
- return a.every((c) => d.includes(c));
628
+ ht(l, m);
629
+ const d = m.join(" ");
630
+ return a.every((u) => d.includes(u));
631
631
  });
632
632
  }
633
- function Ve(e, t, o = 0) {
634
- if (!(o > 4 || e === null || e === void 0)) {
633
+ function ht(e, t, n = 0) {
634
+ if (!(n > 4 || e === null || e === void 0)) {
635
635
  if (typeof e != "object") {
636
636
  t.push(String(e).toLowerCase());
637
637
  return;
638
638
  }
639
639
  if (Array.isArray(e)) {
640
640
  for (const s of e)
641
- Ve(s, t, o + 1);
641
+ ht(s, t, n + 1);
642
642
  return;
643
643
  }
644
644
  for (const s in e)
645
645
  if (Object.prototype.hasOwnProperty.call(e, s)) {
646
646
  if (s.startsWith("__") || s.toLowerCase().includes("password")) continue;
647
- Ve(e[s], t, o + 1);
647
+ ht(e[s], t, n + 1);
648
648
  }
649
649
  }
650
650
  }
651
- function Br(e, t, o, s) {
652
- if (!e || !e.length || !t || !o)
651
+ function Ur(e, t, n, s) {
652
+ if (!e || !e.length || !t || !n)
653
653
  return e;
654
654
  const i = [...e];
655
655
  return s && typeof s == "function" ? (i.sort((a, l) => {
656
- const u = j(a, t), d = j(l, t);
657
- if (u == null)
656
+ const m = L(a, t), d = L(l, t);
657
+ if (m == null)
658
658
  return d == null ? 0 : 1;
659
659
  if (d == null) return -1;
660
- const c = s(a, l);
661
- return o === "desc" ? -c : c;
660
+ const u = s(a, l);
661
+ return n === "desc" ? -u : u;
662
662
  }), i) : (i.sort((a, l) => {
663
- const u = j(a, t), d = j(l, t);
664
- if (u == null)
663
+ const m = L(a, t), d = L(l, t);
664
+ if (m == null)
665
665
  return d == null ? 0 : 1;
666
666
  if (d == null)
667
667
  return -1;
668
- let c = 0;
669
- if (typeof u == "number" && typeof d == "number")
670
- c = u - d;
671
- else if (typeof u == "boolean" && typeof d == "boolean")
672
- c = u === d ? 0 : u ? -1 : 1;
673
- else if (u instanceof Date && d instanceof Date)
674
- c = u.getTime() - d.getTime();
675
- else if (typeof u == "string" && typeof d == "string" && it(u) && it(d))
676
- c = new Date(u).getTime() - new Date(d).getTime();
668
+ let u = 0;
669
+ if (typeof m == "number" && typeof d == "number")
670
+ u = m - d;
671
+ else if (typeof m == "boolean" && typeof d == "boolean")
672
+ u = m === d ? 0 : m ? -1 : 1;
673
+ else if (m instanceof Date && d instanceof Date)
674
+ u = m.getTime() - d.getTime();
675
+ else if (typeof m == "string" && typeof d == "string" && $t(m) && $t(d))
676
+ u = new Date(m).getTime() - new Date(d).getTime();
677
677
  else {
678
- const n = String(u), b = String(d);
679
- c = n.localeCompare(b, void 0, {
678
+ const o = String(m), p = String(d);
679
+ u = o.localeCompare(p, void 0, {
680
680
  numeric: !0,
681
681
  sensitivity: "base"
682
682
  });
683
683
  }
684
- return o === "desc" ? -c : c;
684
+ return n === "desc" ? -u : u;
685
685
  }), i);
686
686
  }
687
- function it(e) {
687
+ function $t(e) {
688
688
  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);
689
689
  }
690
- function kt({
690
+ function It({
691
691
  data: e,
692
692
  api: t,
693
- columns: o,
693
+ columns: n,
694
694
  searchQuery: s,
695
695
  sortBy: i,
696
696
  sortOrder: a,
697
697
  page: l,
698
- pageSize: u,
698
+ pageSize: m,
699
699
  paginationEnabled: d = !0,
700
- manualLoading: c
700
+ manualLoading: u
701
701
  }) {
702
- const n = !!(t && typeof t.fetcher == "function"), b = n && t?.mode !== "client", [g, m] = R([]), [f, x] = R(0), [w, P] = R(!1), [M, E] = R(null), [p, y] = R(0), k = oe(null), N = B(async () => {
703
- if (!n || !t?.fetcher) return;
702
+ const o = !!(t && typeof t.fetcher == "function"), p = o && t?.mode !== "client", [c, g] = $([]), [f, b] = $(0), [S, z] = $(!1), [W, E] = $(null), [y, x] = $(0), k = ve(null), h = ve(t);
703
+ h.current = t;
704
+ const j = B(async () => {
705
+ const P = h.current;
706
+ if (!o || !P?.fetcher) return;
704
707
  k.current && k.current.abort();
705
- const h = new AbortController();
706
- k.current = h, P(!0), E(null);
707
- const A = t.paramNames || {}, W = A.pageParam || "page", F = A.pageSizeParam || "limit", S = A.searchParam || "q", _ = A.sortByParam || "sortBy", H = A.sortOrderParam || "sortOrder", C = {
708
- [W]: l,
709
- [F]: u,
708
+ const H = new AbortController();
709
+ k.current = H, z(!0), E(null);
710
+ const N = P.paramNames || {}, U = N.pageParam || "page", G = N.pageSizeParam || "limit", R = N.searchParam || "q", V = N.sortByParam || "sortBy", C = N.sortOrderParam || "sortOrder", J = {
711
+ [U]: l,
712
+ [G]: m,
710
713
  page: l,
711
- pageSize: u,
712
- ...s ? { [S]: s, search: s, q: s } : {},
713
- ...i ? { [_]: i, sortBy: i } : {},
714
- ...a ? { [H]: a, sortOrder: a } : {},
715
- ...t.params || {}
714
+ pageSize: m,
715
+ ...s ? { [R]: s, search: s, q: s } : {},
716
+ ...i ? { [V]: i, sortBy: i } : {},
717
+ ...a ? { [C]: a, sortOrder: a } : {},
718
+ ...P.params || {}
716
719
  };
717
720
  try {
718
- const O = await t.fetcher(C, h.signal);
719
- if (h.signal.aborted) return;
720
- const I = Tr(
721
- O,
722
- t,
723
- C
721
+ const se = await P.fetcher(J, H.signal);
722
+ if (H.signal.aborted) return;
723
+ const ce = wt(
724
+ se,
725
+ P,
726
+ J
724
727
  );
725
- m(I.data), x(I.meta.total), t.onSuccess?.(I);
726
- } catch (O) {
727
- if (O?.name === "AbortError" || O?.name === "CanceledError")
728
+ g(ce.data), b(ce.meta.total), P.onSuccess?.(ce);
729
+ } catch (se) {
730
+ if (se?.name === "AbortError" || se?.name === "CanceledError")
728
731
  return;
729
- E(O), t.onError?.(O);
732
+ E(se), P.onError?.(se);
730
733
  } finally {
731
- h.signal.aborted || P(!1);
734
+ H.signal.aborted || z(!1);
732
735
  }
733
- }, [n, t, l, u, s, i, a]);
734
- ee(() => {
735
- n && N();
736
- }, [N, p]), ee(() => () => {
736
+ }, [o, l, m, s, i, a]);
737
+ we(() => {
738
+ o && j();
739
+ }, [j, y]), we(() => () => {
737
740
  k.current && k.current.abort();
738
741
  }, []);
739
- const D = B(async () => {
740
- n && y((h) => h + 1);
741
- }, [n]), { displayRows: v, finalTotal: L } = z(() => {
742
- if (b)
742
+ const v = B(async () => {
743
+ o && x((P) => P + 1);
744
+ }, [o]), { displayRows: F, allFilteredRows: w, finalTotal: T } = D(() => {
745
+ if (p)
743
746
  return {
744
- displayRows: g,
747
+ displayRows: c,
748
+ allFilteredRows: c,
745
749
  finalTotal: f
746
750
  };
747
- const h = n ? g : e || [], A = o.filter((C) => C.searchable !== !1).map((C) => C.key), W = $r(h, s, A), S = o.find((C) => C.key === i)?.comparator, _ = Br(W, i, a, S);
748
- let H;
751
+ const P = o ? c : e || [], H = n.filter((C) => C.searchable !== !1).map((C) => C.key), N = Ir(P, s, H), G = n.find((C) => C.key === i)?.comparator, R = Ur(N, i, a, G);
752
+ let V;
749
753
  if (d) {
750
- const C = (l - 1) * u;
751
- H = _.slice(C, C + u);
754
+ const C = (l - 1) * m;
755
+ V = R.slice(C, C + m);
752
756
  } else
753
- H = _;
757
+ V = R;
754
758
  return {
755
- displayRows: H,
756
- finalTotal: W.length
759
+ displayRows: V,
760
+ allFilteredRows: R,
761
+ finalTotal: N.length
757
762
  };
758
763
  }, [
759
- b,
760
- n,
761
- g,
764
+ p,
765
+ o,
766
+ c,
762
767
  e,
763
768
  f,
764
- o,
769
+ n,
765
770
  s,
766
771
  i,
767
772
  a,
768
773
  l,
769
- u,
774
+ m,
770
775
  d
771
776
  ]);
772
777
  return {
773
- rows: v,
774
- totalRecords: L,
775
- loading: c !== void 0 ? c : w,
776
- error: M,
777
- refresh: D,
778
- isServerMode: b,
779
- rawRemoteData: g
778
+ rows: F,
779
+ allFilteredRows: w,
780
+ totalRecords: T,
781
+ loading: u !== void 0 ? u : S,
782
+ error: W,
783
+ refresh: v,
784
+ isServerMode: p,
785
+ rawRemoteData: c
780
786
  };
781
787
  }
782
- function Rr({
788
+ function Vr({
783
789
  tableRef: e,
784
790
  refresh: t,
785
- resetPagination: o,
791
+ resetPagination: n,
786
792
  resetSearch: s,
787
793
  resetSorting: i,
788
794
  setPage: a,
789
795
  setPageSize: l,
790
- setSearch: u,
796
+ setSearch: m,
791
797
  setSorting: d,
792
- selectedRows: c,
793
- clearSelection: n,
794
- getState: b,
795
- scrollToIndex: g,
796
- exportData: m
798
+ selectedRows: u,
799
+ clearSelection: o,
800
+ getState: p,
801
+ scrollToIndex: c,
802
+ exportData: g,
803
+ isExporting: f
797
804
  }) {
798
- ur(
805
+ Ar(
799
806
  e,
800
807
  () => ({
801
808
  refresh: t,
802
809
  reset: () => {
803
- o(), s(), i(), n();
810
+ n(), s(), i(), o();
804
811
  },
805
812
  resetSearch: s,
806
813
  resetSorting: i,
807
- resetPagination: o,
814
+ resetPagination: n,
808
815
  setPage: a,
809
816
  setPageSize: l,
810
- setSearch: u,
817
+ setSearch: m,
811
818
  setSorting: d,
812
- getSelectedRows: () => c,
813
- clearSelection: n,
814
- getState: b,
815
- scrollToIndex: g,
816
- exportData: m
819
+ getSelectedRows: () => u,
820
+ clearSelection: o,
821
+ getState: p,
822
+ scrollToIndex: c,
823
+ exportData: g,
824
+ isExporting: f
817
825
  }),
818
826
  [
819
827
  t,
820
- o,
828
+ n,
821
829
  s,
822
830
  i,
823
831
  a,
824
832
  l,
825
- u,
833
+ m,
826
834
  d,
835
+ u,
836
+ o,
837
+ p,
827
838
  c,
828
- n,
829
- b,
830
839
  g,
831
- m
840
+ f
832
841
  ]
833
842
  );
834
843
  }
835
- function vt({
844
+ function Ut({
836
845
  rows: e,
837
846
  rowKeyResolver: t,
838
- onSelectionChange: o
847
+ onSelectionChange: n
839
848
  }) {
840
- const [s, i] = R(/* @__PURE__ */ new Set()), a = oe(/* @__PURE__ */ new Map());
841
- ee(() => {
842
- e && e.length > 0 && e.forEach((g, m) => {
843
- const f = t(g, m);
844
- s.has(f) && a.current.set(f, g);
849
+ const [s, i] = $(/* @__PURE__ */ new Set()), a = ve(/* @__PURE__ */ new Map());
850
+ we(() => {
851
+ e && e.length > 0 && e.forEach((c, g) => {
852
+ const f = t(c, g);
853
+ s.has(f) && a.current.set(f, c);
845
854
  });
846
855
  }, [e, s, t]);
847
856
  const l = B(
848
- (g, m) => {
857
+ (c, g) => {
849
858
  i((f) => {
850
- const x = new Set(f);
851
- x.has(g) ? (x.delete(g), a.current.delete(g)) : (x.add(g), a.current.set(g, m));
852
- const w = Array.from(x).map(
853
- (P) => a.current.get(P) || e.find((M, E) => t(M, E) === P)
859
+ const b = new Set(f);
860
+ b.has(c) ? (b.delete(c), a.current.delete(c)) : (b.add(c), a.current.set(c, g));
861
+ const S = Array.from(b).map(
862
+ (z) => a.current.get(z) || e.find((W, E) => t(W, E) === z)
854
863
  ).filter(Boolean);
855
- return o?.(w, Array.from(x)), x;
864
+ return n?.(S, Array.from(b)), b;
856
865
  });
857
866
  },
858
- [e, t, o]
859
- ), u = B(() => {
867
+ [e, t, n]
868
+ ), m = B(() => {
860
869
  if (s.size === e.length && e.length > 0)
861
- i(/* @__PURE__ */ new Set()), a.current.clear(), o?.([], []);
870
+ i(/* @__PURE__ */ new Set()), a.current.clear(), n?.([], []);
862
871
  else {
863
- const g = new Set(e.map((m, f) => t(m, f)));
864
- e.forEach((m, f) => {
865
- a.current.set(t(m, f), m);
866
- }), i(g), o?.(e, Array.from(g));
872
+ const c = new Set(e.map((g, f) => t(g, f)));
873
+ e.forEach((g, f) => {
874
+ a.current.set(t(g, f), g);
875
+ }), i(c), n?.(e, Array.from(c));
867
876
  }
868
- }, [e, s.size, t, o]), d = B(() => {
869
- i(/* @__PURE__ */ new Set()), a.current.clear(), o?.([], []);
870
- }, [o]), c = e.length > 0 && s.size === e.length, n = s.size > 0 && s.size < e.length, b = z(() => Array.from(s).map(
871
- (g) => a.current.get(g) || e.find((m, f) => t(m, f) === g)
877
+ }, [e, s.size, t, n]), d = B(() => {
878
+ i(/* @__PURE__ */ new Set()), a.current.clear(), n?.([], []);
879
+ }, [n]), u = e.length > 0 && s.size === e.length, o = s.size > 0 && s.size < e.length, p = D(() => Array.from(s).map(
880
+ (c) => a.current.get(c) || e.find((g, f) => t(g, f) === c)
872
881
  ).filter(Boolean), [e, s, t]);
873
882
  return {
874
883
  selectedKeys: s,
875
884
  setSelectedKeys: i,
876
- selectedRows: b,
885
+ selectedRows: p,
877
886
  onToggleSelectRow: l,
878
- handleToggleSelectAll: u,
887
+ handleToggleSelectAll: m,
879
888
  clearSelection: d,
880
- allSelected: c,
881
- isIndeterminate: n
889
+ allSelected: u,
890
+ isIndeterminate: o
882
891
  };
883
892
  }
884
- function zr({
893
+ function Jr({
885
894
  config: e,
886
895
  totalCount: t,
887
- scrollContainerRef: o
896
+ scrollContainerRef: n
888
897
  }) {
889
- const s = z(() => typeof e == "object" && e !== null ? {
898
+ const s = D(() => typeof e == "object" && e !== null ? {
890
899
  enabled: e.enabled !== !1,
891
900
  rowHeight: e.rowHeight ?? 48,
892
901
  maxHeight: e.maxHeight ?? 520,
@@ -896,31 +905,31 @@ function zr({
896
905
  rowHeight: 48,
897
906
  maxHeight: 520,
898
907
  overscan: 10
899
- }, [e]), i = !!(s.enabled && t > 0), a = s.rowHeight || 48, l = s.maxHeight || 520, u = s.overscan ?? 10, [d, c] = R(0), [n, b] = R(
908
+ }, [e]), i = !!(s.enabled && t > 0), a = s.rowHeight || 48, l = s.maxHeight || 520, m = s.overscan ?? 10, [d, u] = $(0), [o, p] = $(
900
909
  typeof l == "number" ? l : 520
901
- ), g = oe(null);
902
- ee(() => {
910
+ ), c = ve(null);
911
+ we(() => {
903
912
  if (!i) return;
904
- const p = o.current;
905
- if (!p) return;
906
- p.clientHeight > 0 && b(p.clientHeight);
907
- const y = () => {
908
- g.current !== null && cancelAnimationFrame(g.current), g.current = requestAnimationFrame(() => {
909
- p && c(p.scrollTop);
913
+ const y = n.current;
914
+ if (!y) return;
915
+ y.clientHeight > 0 && p(y.clientHeight);
916
+ const x = () => {
917
+ c.current !== null && cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
918
+ y && u(y.scrollTop);
910
919
  });
911
920
  };
912
- p.addEventListener("scroll", y, { passive: !0 });
921
+ y.addEventListener("scroll", x, { passive: !0 });
913
922
  let k = null;
914
- return typeof ResizeObserver < "u" && (k = new ResizeObserver((N) => {
915
- for (const D of N) {
916
- const v = D.contentRect;
917
- v.height > 0 && b(v.height);
923
+ return typeof ResizeObserver < "u" && (k = new ResizeObserver((h) => {
924
+ for (const j of h) {
925
+ const v = j.contentRect;
926
+ v.height > 0 && p(v.height);
918
927
  }
919
- }), k.observe(p)), () => {
920
- p.removeEventListener("scroll", y), g.current !== null && cancelAnimationFrame(g.current), k && k.disconnect();
928
+ }), k.observe(y)), () => {
929
+ y.removeEventListener("scroll", x), c.current !== null && cancelAnimationFrame(c.current), k && k.disconnect();
921
930
  };
922
- }, [i, o]);
923
- const m = t * a, { startIndex: f, endIndex: x, paddingTop: w, paddingBottom: P } = z(() => {
931
+ }, [i, n]);
932
+ const g = t * a, { startIndex: f, endIndex: b, paddingTop: S, paddingBottom: z } = D(() => {
924
933
  if (!i || t === 0)
925
934
  return {
926
935
  startIndex: 0,
@@ -928,56 +937,56 @@ function zr({
928
937
  paddingTop: 0,
929
938
  paddingBottom: 0
930
939
  };
931
- const p = Math.floor(d / a), y = Math.ceil(n / a), k = Math.max(0, p - u), N = Math.min(t - 1, p + y + u), D = k * a, v = Math.max(0, (t - 1 - N) * a);
940
+ const y = Math.floor(d / a), x = Math.ceil(o / a), k = Math.max(0, y - m), h = Math.min(t - 1, y + x + m), j = k * a, v = Math.max(0, (t - 1 - h) * a);
932
941
  return {
933
942
  startIndex: k,
934
- endIndex: N,
935
- paddingTop: D,
943
+ endIndex: h,
944
+ paddingTop: j,
936
945
  paddingBottom: v
937
946
  };
938
- }, [i, t, a, d, n, u]), M = B(
939
- (p, y = "auto") => {
940
- const k = o.current;
947
+ }, [i, t, a, d, o, m]), W = B(
948
+ (y, x = "auto") => {
949
+ const k = n.current;
941
950
  if (!k) return;
942
- const N = p * a, D = k.scrollTop, v = k.clientHeight || (typeof l == "number" ? l : 520);
943
- let L = N;
944
- if (y === "start")
945
- L = N;
946
- else if (y === "end")
947
- L = N - v + a;
948
- else if (y === "center")
949
- L = N - v / 2 + a / 2;
950
- else if (N < D)
951
- L = N;
952
- else if (N + a > D + v)
953
- L = N - v + a;
951
+ const h = y * a, j = k.scrollTop, v = k.clientHeight || (typeof l == "number" ? l : 520);
952
+ let F = h;
953
+ if (x === "start")
954
+ F = h;
955
+ else if (x === "end")
956
+ F = h - v + a;
957
+ else if (x === "center")
958
+ F = h - v / 2 + a / 2;
959
+ else if (h < j)
960
+ F = h;
961
+ else if (h + a > j + v)
962
+ F = h - v + a;
954
963
  else
955
964
  return;
956
- const h = Math.max(0, Math.min(L, m - v));
965
+ const w = Math.max(0, Math.min(F, g - v));
957
966
  typeof k.scrollTo == "function" ? k.scrollTo({
958
- top: h,
967
+ top: w,
959
968
  behavior: "smooth"
960
- }) : k.scrollTop = h;
969
+ }) : k.scrollTop = w;
961
970
  },
962
- [a, l, m, o]
971
+ [a, l, g, n]
963
972
  ), E = B(
964
- (p) => i ? p.slice(f, x + 1) : p,
965
- [i, f, x]
973
+ (y) => i ? y.slice(f, b + 1) : y,
974
+ [i, f, b]
966
975
  );
967
976
  return {
968
977
  isVirtualized: i,
969
- totalHeight: m,
970
- paddingTop: w,
971
- paddingBottom: P,
978
+ totalHeight: g,
979
+ paddingTop: S,
980
+ paddingBottom: z,
972
981
  startIndex: f,
973
- endIndex: x,
982
+ endIndex: b,
974
983
  rowHeight: a,
975
984
  maxHeight: l,
976
- scrollToIndex: M,
985
+ scrollToIndex: W,
977
986
  sliceRows: E
978
987
  };
979
988
  }
980
- const wt = {
989
+ const Vt = {
981
990
  primary: "#2667EC",
982
991
  primaryHover: "#1E54C6",
983
992
  primaryLight: "#397FF6",
@@ -996,9 +1005,9 @@ const wt = {
996
1005
  inputBg: "#1E293B",
997
1006
  rowHover: "rgba(38, 103, 236, 0.04)",
998
1007
  rowSelected: "rgba(38, 103, 236, 0.08)"
999
- }, dt = {
1008
+ }, zt = {
1000
1009
  default: {
1001
- colors: wt,
1010
+ colors: Vt,
1002
1011
  borderRadius: "1rem",
1003
1012
  density: "normal",
1004
1013
  classes: {
@@ -1130,9 +1139,9 @@ const wt = {
1130
1139
  paginationButtonActive: "bg-blue-800 text-white font-bold"
1131
1140
  }
1132
1141
  }
1133
- }, Et = {
1142
+ }, Jt = {
1134
1143
  mode: "auto",
1135
- colors: wt,
1144
+ colors: Vt,
1136
1145
  borderRadius: "1rem",
1137
1146
  fontFamily: "'Alexandria', system-ui, -apple-system, sans-serif",
1138
1147
  density: "normal",
@@ -1152,13 +1161,13 @@ const wt = {
1152
1161
  paginationButtonActive: "bg-primary text-white hover:bg-primary-soft shadow-md shadow-primary/30",
1153
1162
  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"
1154
1163
  }
1155
- }, Ke = gr(Et), jr = ({
1164
+ }, kt = Pr(Jt), qr = ({
1156
1165
  theme: e,
1157
1166
  preset: t,
1158
- children: o
1167
+ children: n
1159
1168
  }) => {
1160
- const s = ft(Ke), i = z(() => {
1161
- const a = s || Et, l = t && dt[t] ? dt[t] : {};
1169
+ const s = Wt(kt), i = D(() => {
1170
+ const a = s || Jt, l = t && zt[t] ? zt[t] : {};
1162
1171
  return {
1163
1172
  ...a,
1164
1173
  ...l,
@@ -1175,19 +1184,19 @@ const wt = {
1175
1184
  }
1176
1185
  };
1177
1186
  }, [s, t, e]);
1178
- return /* @__PURE__ */ r.createElement(Ke.Provider, { value: i }, o);
1187
+ return /* @__PURE__ */ r.createElement(kt.Provider, { value: i }, n);
1179
1188
  };
1180
- function ce() {
1181
- return ft(Ke);
1189
+ function _e() {
1190
+ return Wt(kt);
1182
1191
  }
1183
- function Mr({
1192
+ function Yr({
1184
1193
  value: e,
1185
1194
  onChange: t,
1186
- onClear: o,
1195
+ onClear: n,
1187
1196
  isDebouncing: s = !1,
1188
1197
  placeholder: i = "Search records..."
1189
1198
  }) {
1190
- const a = ce();
1199
+ const a = _e();
1191
1200
  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(
1192
1201
  "svg",
1193
1202
  {
@@ -1219,7 +1228,7 @@ function Mr({
1219
1228
  "button",
1220
1229
  {
1221
1230
  type: "button",
1222
- onClick: o,
1231
+ onClick: n,
1223
1232
  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",
1224
1233
  title: "Clear search"
1225
1234
  },
@@ -1236,7 +1245,7 @@ function Mr({
1236
1245
  )
1237
1246
  )));
1238
1247
  }
1239
- const te = {
1248
+ const Ee = {
1240
1249
  searchPlaceholder: "Search records...",
1241
1250
  noRecordsTitle: "No records found",
1242
1251
  noRecordsDescription: "Try adjusting your search query or clear active filters.",
@@ -1254,6 +1263,10 @@ const te = {
1254
1263
  exportCsv: "Export CSV",
1255
1264
  exportJson: "Export JSON",
1256
1265
  exportSuccess: "Export completed successfully",
1266
+ exporting: "Exporting...",
1267
+ exportAll: "Export All Filtered",
1268
+ exportCurrentPage: "Export Current Page",
1269
+ exportSelected: "Export Selected Rows",
1257
1270
  selectAll: "Select all rows",
1258
1271
  selectRow: "Select row",
1259
1272
  prevPage: "Previous page",
@@ -1264,7 +1277,7 @@ const te = {
1264
1277
  addRecord: "Add",
1265
1278
  clearSearch: "Clear search",
1266
1279
  loading: "Loading..."
1267
- }, Dr = {
1280
+ }, Gr = {
1268
1281
  searchPlaceholder: "بحث في السجلات...",
1269
1282
  noRecordsTitle: "لا توجد سجلات",
1270
1283
  noRecordsDescription: "جرّب تغيير عبارة البحث أو إعادة تعيين الفلاتر.",
@@ -1282,6 +1295,10 @@ const te = {
1282
1295
  exportCsv: "تصدير CSV (Excel)",
1283
1296
  exportJson: "تصدير JSON",
1284
1297
  exportSuccess: "تم تصدير البيانات بنجاح",
1298
+ exporting: "جاري التصدير...",
1299
+ exportAll: "تصدير كل السجلات (المفلترة)",
1300
+ exportCurrentPage: "تصدير الصفحة الحالية فقط",
1301
+ exportSelected: "تصدير السجلات المحددة",
1285
1302
  selectAll: "تحديد جميع الصفوف",
1286
1303
  selectRow: "تحديد الصف",
1287
1304
  prevPage: "الصفحة السابقة",
@@ -1293,67 +1310,96 @@ const te = {
1293
1310
  clearSearch: "مسح البحث",
1294
1311
  loading: "جاري التحميل..."
1295
1312
  };
1296
- function Lr(e = "en", t) {
1297
- const s = e.toLowerCase().startsWith("ar") ? Dr : te;
1313
+ function Xr(e = "en", t) {
1314
+ const s = e.toLowerCase().startsWith("ar") ? Gr : Ee;
1298
1315
  return t ? { ...s, ...t } : s;
1299
1316
  }
1300
- function Wr({
1317
+ function Zr({
1301
1318
  displayTitle: e,
1302
1319
  subtitle: t,
1303
- isSearchEnabled: o,
1320
+ isSearchEnabled: n,
1304
1321
  searchQuery: s = "",
1305
1322
  setSearch: i,
1306
1323
  clearSearch: a,
1307
1324
  isDebouncing: l = !1,
1308
- searchPlaceholder: u,
1325
+ searchPlaceholder: m,
1309
1326
  headerActions: d,
1310
- add: c,
1311
- linkAdd: n,
1312
- addHandler: b,
1313
- messages: g = te,
1314
- exportable: m = !1,
1327
+ add: u,
1328
+ linkAdd: o,
1329
+ addHandler: p,
1330
+ messages: c = Ee,
1331
+ exportable: g = !1,
1315
1332
  onExport: f,
1316
- dir: x = "ltr"
1333
+ isExporting: b = !1,
1334
+ hasSelectedRows: S = !1,
1335
+ dir: z = "ltr"
1317
1336
  }) {
1318
- const w = x === "rtl", [P, M] = R(!1), E = oe(null), p = !!(m && f), y = typeof m == "object" ? m.csv !== !1 : !0, k = typeof m == "object" ? m.json === !0 : !1, N = y && k;
1319
- return ee(() => {
1320
- function v(L) {
1321
- E.current && !E.current.contains(L.target) && M(!1);
1337
+ const W = z === "rtl", [E, y] = $(!1), x = ve(null), k = !!(g && f), h = typeof g == "object" ? g.csv !== !1 : !0, j = typeof g == "object" ? g.json === !0 : !1, v = typeof g == "object" ? !!g.showScopeOptions : !1, F = h && j || v;
1338
+ return we(() => {
1339
+ function T(P) {
1340
+ x.current && !x.current.contains(P.target) && y(!1);
1322
1341
  }
1323
- return P && document.addEventListener("mousedown", v), () => {
1324
- document.removeEventListener("mousedown", v);
1342
+ return E && document.addEventListener("mousedown", T), () => {
1343
+ document.removeEventListener("mousedown", T);
1325
1344
  };
1326
- }, [P]), !!(e || t || o || d || c || p) ? /* @__PURE__ */ r.createElement(
1345
+ }, [E]), !!(e || t || n || d || u || k) ? /* @__PURE__ */ r.createElement(
1327
1346
  "div",
1328
1347
  {
1329
- dir: x,
1330
- className: `w-full flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-1 ${w ? "text-right" : "text-left"}`
1348
+ dir: z,
1349
+ className: `w-full flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-1 ${W ? "text-right" : "text-left"}`
1331
1350
  },
1332
1351
  (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)),
1333
1352
  /* @__PURE__ */ r.createElement(
1334
1353
  "div",
1335
1354
  {
1336
- className: `flex flex-wrap items-center gap-3 w-full sm:w-auto ${w ? "justify-start sm:justify-start mr-auto" : "justify-start sm:justify-end ml-auto"}`
1355
+ className: `flex flex-wrap items-center gap-3 w-full sm:w-auto ${W ? "justify-start sm:justify-start mr-auto" : "justify-start sm:justify-end ml-auto"}`
1337
1356
  },
1338
- o && i && a && /* @__PURE__ */ r.createElement(
1339
- Mr,
1357
+ n && i && a && /* @__PURE__ */ r.createElement(
1358
+ Yr,
1340
1359
  {
1341
1360
  value: s,
1342
1361
  onChange: i,
1343
1362
  onClear: a,
1344
1363
  isDebouncing: l,
1345
- placeholder: u || g.searchPlaceholder
1364
+ placeholder: m || c.searchPlaceholder
1346
1365
  }
1347
1366
  ),
1348
- p && /* @__PURE__ */ r.createElement("div", { className: "relative inline-block", ref: E }, N ? /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1367
+ k && /* @__PURE__ */ r.createElement("div", { className: "relative inline-block", ref: x }, F ? /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1349
1368
  "button",
1350
1369
  {
1351
1370
  type: "button",
1352
- onClick: () => M((v) => !v),
1353
- className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-200 text-xs font-semibold hover:bg-gray-50 dark:hover:bg-slate-700 transition shadow-sm active:scale-95 cursor-pointer",
1354
- title: g.export
1371
+ disabled: b,
1372
+ onClick: () => y((T) => !T),
1373
+ className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-200 text-xs font-semibold hover:bg-gray-50 dark:hover:bg-slate-700 transition shadow-sm active:scale-95 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",
1374
+ title: b ? c.exporting : c.export
1355
1375
  },
1356
- /* @__PURE__ */ r.createElement(
1376
+ b ? /* @__PURE__ */ r.createElement(
1377
+ "svg",
1378
+ {
1379
+ className: "w-4 h-4 animate-spin text-primary",
1380
+ viewBox: "0 0 24 24",
1381
+ fill: "none"
1382
+ },
1383
+ /* @__PURE__ */ r.createElement(
1384
+ "circle",
1385
+ {
1386
+ className: "opacity-25",
1387
+ cx: "12",
1388
+ cy: "12",
1389
+ r: "10",
1390
+ stroke: "currentColor",
1391
+ strokeWidth: "4"
1392
+ }
1393
+ ),
1394
+ /* @__PURE__ */ r.createElement(
1395
+ "path",
1396
+ {
1397
+ className: "opacity-75",
1398
+ fill: "currentColor",
1399
+ d: "M4 12a8 8 0 018-8v8H4z"
1400
+ }
1401
+ )
1402
+ ) : /* @__PURE__ */ r.createElement(
1357
1403
  "svg",
1358
1404
  {
1359
1405
  className: "w-4 h-4 text-gray-500 dark:text-gray-400",
@@ -1371,46 +1417,108 @@ function Wr({
1371
1417
  }
1372
1418
  )
1373
1419
  ),
1374
- /* @__PURE__ */ r.createElement("span", null, g.export),
1420
+ /* @__PURE__ */ r.createElement("span", null, b ? c.exporting : c.export),
1375
1421
  /* @__PURE__ */ r.createElement("span", { className: "text-[10px] opacity-70" }, "▼")
1376
- ), P && /* @__PURE__ */ r.createElement(
1422
+ ), E && /* @__PURE__ */ r.createElement(
1377
1423
  "div",
1378
1424
  {
1379
- className: `absolute mt-1.5 w-36 rounded-xl border border-gray-100 dark:border-gray-800 bg-white dark:bg-slate-800 shadow-xl z-30 py-1 overflow-hidden any-table-fade-in ${w ? "left-0" : "right-0"}`
1425
+ className: `absolute mt-1.5 w-48 rounded-xl border border-gray-100 dark:border-gray-800 bg-white dark:bg-slate-800 shadow-xl z-30 py-1 overflow-hidden any-table-fade-in ${W ? "left-0" : "right-0"}`
1380
1426
  },
1381
- y && /* @__PURE__ */ r.createElement(
1427
+ h && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1382
1428
  "button",
1383
1429
  {
1384
1430
  type: "button",
1431
+ disabled: b,
1385
1432
  onClick: () => {
1386
- f?.("csv"), M(!1);
1433
+ f?.("csv", "all"), y(!1);
1387
1434
  },
1388
- className: "w-full text-left rtl:text-right px-3 py-2 text-xs font-medium text-gray-700 dark:text-gray-200 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer"
1435
+ className: "w-full text-left rtl:text-right px-3 py-2 text-xs font-medium text-gray-700 dark:text-gray-200 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer disabled:opacity-50"
1389
1436
  },
1390
1437
  /* @__PURE__ */ r.createElement("span", { className: "text-emerald-500 font-bold" }, "📊"),
1391
- /* @__PURE__ */ r.createElement("span", null, g.exportCsv)
1392
- ),
1393
- k && /* @__PURE__ */ r.createElement(
1438
+ /* @__PURE__ */ r.createElement("span", null, v ? c.exportAll : c.exportCsv)
1439
+ ), v && /* @__PURE__ */ r.createElement(
1394
1440
  "button",
1395
1441
  {
1396
1442
  type: "button",
1443
+ disabled: b,
1397
1444
  onClick: () => {
1398
- f?.("json"), M(!1);
1445
+ f?.("csv", "current-page"), y(!1);
1399
1446
  },
1400
- className: "w-full text-left rtl:text-right px-3 py-2 text-xs font-medium text-gray-700 dark:text-gray-200 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer"
1447
+ className: "w-full text-left rtl:text-right px-3 py-1.5 text-[11px] text-gray-500 dark:text-gray-400 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer ps-7 disabled:opacity-50"
1448
+ },
1449
+ /* @__PURE__ */ r.createElement("span", null, "↳ ", c.exportCurrentPage)
1450
+ ), v && S && /* @__PURE__ */ r.createElement(
1451
+ "button",
1452
+ {
1453
+ type: "button",
1454
+ disabled: b,
1455
+ onClick: () => {
1456
+ f?.("csv", "selected"), y(!1);
1457
+ },
1458
+ className: "w-full text-left rtl:text-right px-3 py-1.5 text-[11px] text-gray-500 dark:text-gray-400 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer ps-7 disabled:opacity-50"
1459
+ },
1460
+ /* @__PURE__ */ r.createElement("span", null, "↳ ", c.exportSelected)
1461
+ )),
1462
+ j && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1463
+ "button",
1464
+ {
1465
+ type: "button",
1466
+ disabled: b,
1467
+ onClick: () => {
1468
+ f?.("json", "all"), y(!1);
1469
+ },
1470
+ className: `w-full text-left rtl:text-right px-3 py-2 text-xs font-medium text-gray-700 dark:text-gray-200 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer disabled:opacity-50 ${h ? "border-t border-gray-100 dark:border-gray-800" : ""}`
1401
1471
  },
1402
1472
  /* @__PURE__ */ r.createElement("span", { className: "text-amber-500 font-bold" }, "{ }"),
1403
- /* @__PURE__ */ r.createElement("span", null, g.exportJson)
1404
- )
1473
+ /* @__PURE__ */ r.createElement("span", null, v ? `${c.exportJson} (${c.exportAll})` : c.exportJson)
1474
+ ), v && /* @__PURE__ */ r.createElement(
1475
+ "button",
1476
+ {
1477
+ type: "button",
1478
+ disabled: b,
1479
+ onClick: () => {
1480
+ f?.("json", "current-page"), y(!1);
1481
+ },
1482
+ className: "w-full text-left rtl:text-right px-3 py-1.5 text-[11px] text-gray-500 dark:text-gray-400 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer ps-7 disabled:opacity-50"
1483
+ },
1484
+ /* @__PURE__ */ r.createElement("span", null, "↳ ", c.exportCurrentPage)
1485
+ ))
1405
1486
  )) : /* @__PURE__ */ r.createElement(
1406
1487
  "button",
1407
1488
  {
1408
1489
  type: "button",
1409
- onClick: () => f?.(y ? "csv" : "json"),
1410
- className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-200 text-xs font-semibold hover:bg-gray-50 dark:hover:bg-slate-700 transition shadow-sm active:scale-95 cursor-pointer",
1411
- title: g.export
1490
+ disabled: b,
1491
+ onClick: () => f?.(h ? "csv" : "json", "all"),
1492
+ className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-200 text-xs font-semibold hover:bg-gray-50 dark:hover:bg-slate-700 transition shadow-sm active:scale-95 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",
1493
+ title: b ? c.exporting : c.export
1412
1494
  },
1413
- /* @__PURE__ */ r.createElement(
1495
+ b ? /* @__PURE__ */ r.createElement(
1496
+ "svg",
1497
+ {
1498
+ className: "w-4 h-4 animate-spin text-primary",
1499
+ viewBox: "0 0 24 24",
1500
+ fill: "none"
1501
+ },
1502
+ /* @__PURE__ */ r.createElement(
1503
+ "circle",
1504
+ {
1505
+ className: "opacity-25",
1506
+ cx: "12",
1507
+ cy: "12",
1508
+ r: "10",
1509
+ stroke: "currentColor",
1510
+ strokeWidth: "4"
1511
+ }
1512
+ ),
1513
+ /* @__PURE__ */ r.createElement(
1514
+ "path",
1515
+ {
1516
+ className: "opacity-75",
1517
+ fill: "currentColor",
1518
+ d: "M4 12a8 8 0 018-8v8H4z"
1519
+ }
1520
+ )
1521
+ ) : /* @__PURE__ */ r.createElement(
1414
1522
  "svg",
1415
1523
  {
1416
1524
  className: "w-4 h-4 text-gray-500 dark:text-gray-400",
@@ -1428,141 +1536,138 @@ function Wr({
1428
1536
  }
1429
1537
  )
1430
1538
  ),
1431
- /* @__PURE__ */ r.createElement("span", null, g.exportCsv)
1539
+ /* @__PURE__ */ r.createElement("span", null, b ? c.exporting : h ? c.exportCsv : c.exportJson)
1432
1540
  )),
1433
1541
  d,
1434
- c && /* @__PURE__ */ r.createElement(
1542
+ u && /* @__PURE__ */ r.createElement(
1435
1543
  "button",
1436
1544
  {
1437
1545
  type: "button",
1438
1546
  onClick: () => {
1439
- b ? b() : n && typeof window < "u" && (window.location.href = n);
1547
+ p ? p() : o && typeof window < "u" && (window.location.href = o);
1440
1548
  },
1441
1549
  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 cursor-pointer"
1442
1550
  },
1443
1551
  /* @__PURE__ */ r.createElement("span", null, "+"),
1444
- /* @__PURE__ */ r.createElement("span", null, g.addRecord, " ", e || "")
1552
+ /* @__PURE__ */ r.createElement("span", null, c.addRecord, " ", e || "")
1445
1553
  )
1446
1554
  )
1447
1555
  ) : null;
1448
1556
  }
1449
- function _r({
1557
+ function Qr({
1450
1558
  columns: e,
1451
1559
  hasActions: t,
1452
- actionsTitle: o,
1560
+ actionsTitle: n,
1453
1561
  actionsWidth: s,
1454
1562
  sortBy: i,
1455
1563
  sortOrder: a,
1456
1564
  onSort: l,
1457
- selectable: u,
1565
+ selectable: m,
1458
1566
  allSelected: d,
1459
- isIndeterminate: c,
1460
- onToggleSelectAll: n,
1461
- headerClassName: b = "",
1462
- sticky: g = !1,
1463
- messages: m = te,
1567
+ isIndeterminate: u,
1568
+ onToggleSelectAll: o,
1569
+ headerClassName: p = "",
1570
+ sticky: c = !1,
1571
+ messages: g = Ee,
1464
1572
  dir: f = "ltr",
1465
- resizableColumns: x = !1,
1466
- columnWidths: w = {},
1467
- onResizeColumn: P,
1468
- pinnedStyles: M = {}
1573
+ resizableColumns: b = !1,
1574
+ columnWidths: S = {},
1575
+ onResizeColumn: z,
1576
+ pinnedStyles: W = {}
1469
1577
  }) {
1470
- const E = ce(), p = f === "rtl", y = oe(null), [k, N] = R(null), D = B(
1471
- (h, A, W) => {
1472
- h.preventDefault(), h.stopPropagation(), y.current = {
1473
- key: A,
1474
- startX: h.clientX,
1475
- startWidth: W
1476
- }, N(A);
1477
- const F = (_) => {
1478
- if (!y.current) return;
1479
- const H = (_.clientX - y.current.startX) * (p ? -1 : 1), C = Math.max(50, y.current.startWidth + H);
1480
- P?.(y.current.key, C);
1481
- }, S = () => {
1482
- y.current = null, N(null), document.removeEventListener("mousemove", F), document.removeEventListener("mouseup", S);
1578
+ const E = _e(), y = f === "rtl", x = ve(null), [k, h] = $(null), j = B(
1579
+ (w, T, P) => {
1580
+ w.preventDefault(), w.stopPropagation(), x.current = {
1581
+ key: T,
1582
+ startX: w.clientX,
1583
+ startWidth: P
1584
+ }, h(T);
1585
+ const H = (U) => {
1586
+ if (!x.current) return;
1587
+ const G = (U.clientX - x.current.startX) * (y ? -1 : 1), R = Math.max(50, x.current.startWidth + G);
1588
+ z?.(x.current.key, R);
1589
+ }, N = () => {
1590
+ x.current = null, h(null), document.removeEventListener("mousemove", H), document.removeEventListener("mouseup", N);
1483
1591
  };
1484
- document.addEventListener("mousemove", F), document.addEventListener("mouseup", S);
1592
+ document.addEventListener("mousemove", H), document.addEventListener("mouseup", N);
1485
1593
  },
1486
- [p, P]
1594
+ [y, z]
1487
1595
  ), v = {};
1488
- g && (v.position = "sticky", v.top = 0, v.zIndex = 10), E.colors?.theadBg && (v.backgroundColor = E.colors.theadBg), E.colors?.theadText && (v.color = E.colors.theadText);
1489
- const L = o || m.actions;
1596
+ c && (v.position = "sticky", v.top = 0, v.zIndex = 10), E.colors?.theadBg && (v.backgroundColor = E.colors.theadBg), E.colors?.theadText && (v.color = E.colors.theadText);
1597
+ const F = n || g.actions;
1490
1598
  return /* @__PURE__ */ r.createElement(
1491
1599
  "thead",
1492
1600
  {
1493
1601
  style: v,
1494
- className: `${E.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${b}`
1602
+ className: `${E.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${p}`
1495
1603
  },
1496
- /* @__PURE__ */ r.createElement("tr", null, u && /* @__PURE__ */ r.createElement(
1604
+ /* @__PURE__ */ r.createElement("tr", null, m && /* @__PURE__ */ r.createElement(
1497
1605
  "th",
1498
1606
  {
1499
1607
  style: {
1500
1608
  width: 44,
1501
1609
  minWidth: 44,
1502
- position: g ? "sticky" : void 0,
1503
- [p ? "right" : "left"]: 0,
1504
- zIndex: 12,
1505
1610
  backgroundColor: E.colors?.theadBg || void 0
1506
1611
  },
1507
- className: "w-11 px-4 py-3 text-center align-middle"
1612
+ className: "w-11 px-4 py-3.5 text-center align-middle"
1508
1613
  },
1509
1614
  /* @__PURE__ */ r.createElement(
1510
1615
  "input",
1511
1616
  {
1512
1617
  type: "checkbox",
1513
1618
  checked: d,
1514
- title: m.selectAll,
1515
- "aria-label": m.selectAll,
1516
- ref: (h) => {
1517
- h && (h.indeterminate = !!c);
1619
+ title: g.selectAll,
1620
+ "aria-label": g.selectAll,
1621
+ ref: (w) => {
1622
+ w && (w.indeterminate = !!u);
1518
1623
  },
1519
- onChange: n,
1624
+ onChange: o,
1520
1625
  className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1521
1626
  }
1522
1627
  )
1523
- ), e.map((h) => {
1524
- const A = String(h.key), W = i === A, F = h.sortable !== !1 && !!l, S = M[A], _ = !!S, H = w[A] ?? (typeof h.width == "number" ? h.width : typeof h.width == "string" && parseInt(h.width, 10) || 150), C = {
1525
- width: w[A] ?? h.width,
1526
- minWidth: h.minWidth,
1527
- maxWidth: h.maxWidth,
1528
- ..._ ? S : {},
1529
- zIndex: _ ? g ? 15 : 8 : g ? 10 : void 0,
1530
- backgroundColor: _ ? E.colors?.theadBg || (E.colors?.tableBg ?? void 0) : void 0
1531
- }, O = h.align === "center" ? "text-center" : h.align === "right" ? "text-right" : h.align === "left" ? "text-left" : p ? "text-right" : "text-left", I = x && h.resizable !== !1;
1628
+ ), e.map((w) => {
1629
+ const T = String(w.key), P = i === T, H = w.sortable !== !1 && !!l, N = W[T], U = !!N, G = S[T] ?? (typeof w.width == "number" ? w.width : typeof w.width == "string" && parseInt(w.width, 10) || 150), R = {
1630
+ width: S[T] ?? w.width,
1631
+ minWidth: w.minWidth,
1632
+ maxWidth: w.maxWidth,
1633
+ ...U ? N : {},
1634
+ zIndex: U ? c ? 15 : 8 : c ? 10 : void 0,
1635
+ backgroundColor: U ? E.colors?.theadBg || (E.colors?.tableBg ?? void 0) : void 0
1636
+ }, V = w.align === "center" ? "text-center" : w.align === "right" ? "text-right" : w.align === "left" ? "text-left" : y ? "text-right" : "text-left", C = b && w.resizable !== !1;
1532
1637
  return /* @__PURE__ */ r.createElement(
1533
1638
  "th",
1534
1639
  {
1535
- key: A,
1536
- style: C,
1537
- onClick: () => F && l?.(A),
1538
- className: `relative ${E.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${O} ${h.headerClassName || ""} ${F ? "cursor-pointer hover:text-primary transition-colors group" : ""} ${_ ? p ? "border-l border-gray-200/80 dark:border-gray-700/80 shadow-[-2px_0_4px_rgba(0,0,0,0.03)]" : "border-r border-gray-200/80 dark:border-gray-700/80 shadow-[2px_0_4px_rgba(0,0,0,0.03)]" : ""}`
1640
+ key: T,
1641
+ style: R,
1642
+ onClick: () => H && l?.(T),
1643
+ className: `relative ${E.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${V} ${w.headerClassName || ""} ${H ? "cursor-pointer hover:text-primary transition-colors group" : ""} ${U ? y ? "border-l border-gray-200/80 dark:border-gray-700/80 shadow-[-2px_0_4px_rgba(0,0,0,0.03)]" : "border-r border-gray-200/80 dark:border-gray-700/80 shadow-[2px_0_4px_rgba(0,0,0,0.03)]" : ""}`
1539
1644
  },
1540
1645
  /* @__PURE__ */ r.createElement(
1541
1646
  "div",
1542
1647
  {
1543
- className: `inline-flex items-center gap-1.5 ${h.align === "center" ? "justify-center" : h.align === "right" ? "justify-end" : "justify-start"}`
1648
+ className: `inline-flex items-center gap-1.5 ${w.align === "center" ? "justify-center" : w.align === "right" ? "justify-end" : "justify-start"}`
1544
1649
  },
1545
- /* @__PURE__ */ r.createElement("span", null, h.title),
1546
- F && /* @__PURE__ */ r.createElement(
1650
+ /* @__PURE__ */ r.createElement("span", null, w.title),
1651
+ H && /* @__PURE__ */ r.createElement(
1547
1652
  "span",
1548
1653
  {
1549
- className: `inline-flex flex-col text-[10px] transition-transform ${W ? "text-primary scale-110" : "text-gray-400 opacity-40 group-hover:opacity-100"}`
1654
+ className: `inline-flex flex-col text-[10px] transition-transform ${P ? "text-primary scale-110" : "text-gray-400 opacity-40 group-hover:opacity-100"}`
1550
1655
  },
1551
- W ? a === "asc" ? "▲" : "▼" : /* @__PURE__ */ r.createElement("span", { className: "text-[9px] leading-none opacity-50" }, "▲▼")
1656
+ P ? a === "asc" ? "▲" : "▼" : /* @__PURE__ */ r.createElement("span", { className: "text-[9px] leading-none opacity-50" }, "▲▼")
1552
1657
  )
1553
1658
  ),
1554
- I && /* @__PURE__ */ r.createElement(
1659
+ C && /* @__PURE__ */ r.createElement(
1555
1660
  "div",
1556
1661
  {
1557
- onMouseDown: (V) => D(V, A, H),
1558
- onClick: (V) => V.stopPropagation(),
1559
- className: `absolute top-0 bottom-0 w-2 cursor-col-resize select-none z-20 group/handle ${p ? "left-0" : "right-0"}`,
1662
+ onMouseDown: (J) => j(J, T, G),
1663
+ onClick: (J) => J.stopPropagation(),
1664
+ className: `absolute top-0 bottom-0 w-2 cursor-col-resize select-none z-20 group/handle ${y ? "left-0" : "right-0"}`,
1560
1665
  title: "Resize column"
1561
1666
  },
1562
1667
  /* @__PURE__ */ r.createElement(
1563
1668
  "div",
1564
1669
  {
1565
- className: `w-0.5 h-full mx-auto transition-colors ${k === A ? "bg-primary w-1" : "bg-transparent group-hover/handle:bg-primary/60"}`
1670
+ className: `w-0.5 h-full mx-auto transition-colors ${k === T ? "bg-primary w-1" : "bg-transparent group-hover/handle:bg-primary/60"}`
1566
1671
  }
1567
1672
  )
1568
1673
  )
@@ -1572,33 +1677,31 @@ function _r({
1572
1677
  {
1573
1678
  style: {
1574
1679
  width: s || "auto",
1575
- position: g ? "sticky" : void 0,
1576
- [p ? "left" : "right"]: 0,
1577
- zIndex: 12,
1680
+ minWidth: typeof s == "number" ? s : void 0,
1578
1681
  backgroundColor: E.colors?.theadBg || void 0
1579
1682
  },
1580
- className: `${E.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${p ? "text-left pl-6" : "text-right pr-6"}`
1683
+ className: `${E.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${y ? "text-left pl-6" : "text-right pr-6"}`
1581
1684
  },
1582
- L
1685
+ F
1583
1686
  ))
1584
1687
  );
1585
1688
  }
1586
- const U = () => /* @__PURE__ */ r.createElement("span", { className: "text-gray-400 dark:text-gray-500 font-mono text-sm" }, "—");
1587
- function Nt({ value: e }) {
1689
+ const Q = () => /* @__PURE__ */ r.createElement("span", { className: "text-gray-400 dark:text-gray-500 font-mono text-sm" }, "—");
1690
+ function qt({ value: e }) {
1588
1691
  if (e == null || e === "")
1589
- return /* @__PURE__ */ r.createElement(U, null);
1692
+ return /* @__PURE__ */ r.createElement(Q, null);
1590
1693
  const t = String(e);
1591
1694
  return /* @__PURE__ */ r.createElement("span", { className: "truncate block max-w-xs font-normal text-sm", title: t }, t);
1592
1695
  }
1593
- function Hr({ value: e }) {
1696
+ function ea({ value: e }) {
1594
1697
  if (e == null || isNaN(Number(e)))
1595
- return /* @__PURE__ */ r.createElement(U, null);
1698
+ return /* @__PURE__ */ r.createElement(Q, null);
1596
1699
  const t = Number(e);
1597
1700
  return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-medium" }, t.toLocaleString());
1598
1701
  }
1599
- function Fr({ value: e }) {
1702
+ function ta({ value: e }) {
1600
1703
  if (e == null)
1601
- return /* @__PURE__ */ r.createElement(U, null);
1704
+ return /* @__PURE__ */ r.createElement(Q, null);
1602
1705
  const t = !!e;
1603
1706
  return /* @__PURE__ */ r.createElement(
1604
1707
  "span",
@@ -1609,34 +1712,34 @@ function Fr({ value: e }) {
1609
1712
  t ? "Yes" : "No"
1610
1713
  );
1611
1714
  }
1612
- function ct({ value: e, isDateTime: t = !1 }) {
1613
- if (!e) return /* @__PURE__ */ r.createElement(U, null);
1614
- const o = e instanceof Date ? e : new Date(e);
1615
- return isNaN(o.getTime()) ? /* @__PURE__ */ r.createElement(Nt, { 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" })));
1715
+ function jt({ value: e, isDateTime: t = !1 }) {
1716
+ if (!e) return /* @__PURE__ */ r.createElement(Q, null);
1717
+ const n = e instanceof Date ? e : new Date(e);
1718
+ return isNaN(n.getTime()) ? /* @__PURE__ */ r.createElement(qt, { 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" }, n.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" }, n.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" })));
1616
1719
  }
1617
- function Or({ value: e, column: t }) {
1720
+ function ra({ value: e, column: t }) {
1618
1721
  if (e == null || isNaN(Number(e)))
1619
- return /* @__PURE__ */ r.createElement(U, null);
1620
- const o = Number(e), s = t.currency || "EGP";
1621
- 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));
1722
+ return /* @__PURE__ */ r.createElement(Q, null);
1723
+ const n = Number(e), s = t.currency || "EGP";
1724
+ return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-bold text-gray-900 dark:text-white" }, n.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), " ", /* @__PURE__ */ r.createElement("span", { className: "text-xs font-normal text-gray-500 dark:text-gray-400" }, s));
1622
1725
  }
1623
- const ut = "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";
1624
- function Ir({ value: e }) {
1726
+ const Mt = "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";
1727
+ function aa({ value: e }) {
1625
1728
  let t = "";
1626
- 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 = ut), /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center" }, /* @__PURE__ */ r.createElement(
1729
+ 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 = Mt), /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center" }, /* @__PURE__ */ r.createElement(
1627
1730
  "img",
1628
1731
  {
1629
1732
  src: t,
1630
1733
  alt: "Thumbnail",
1631
1734
  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",
1632
1735
  loading: "lazy",
1633
- onError: (o) => {
1634
- o.target.src = ut;
1736
+ onError: (n) => {
1737
+ n.target.src = Mt;
1635
1738
  }
1636
1739
  }
1637
1740
  ));
1638
1741
  }
1639
- const Ur = {
1742
+ const na = {
1640
1743
  active: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
1641
1744
  delivered: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
1642
1745
  completed: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
@@ -1653,12 +1756,12 @@ const Ur = {
1653
1756
  offline: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" },
1654
1757
  closed: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" }
1655
1758
  };
1656
- function Vr({ value: e, column: t }) {
1759
+ function oa({ value: e, column: t }) {
1657
1760
  if (e == null || e === "")
1658
- return /* @__PURE__ */ r.createElement(U, null);
1659
- const o = String(e), s = o.toLowerCase();
1660
- if (t.statusMap && t.statusMap[o]) {
1661
- const a = t.statusMap[o];
1761
+ return /* @__PURE__ */ r.createElement(Q, null);
1762
+ const n = String(e), s = n.toLowerCase();
1763
+ if (t.statusMap && t.statusMap[n]) {
1764
+ const a = t.statusMap[n];
1662
1765
  return /* @__PURE__ */ r.createElement(
1663
1766
  "span",
1664
1767
  {
@@ -1666,10 +1769,10 @@ function Vr({ value: e, column: t }) {
1666
1769
  style: { color: a.color, backgroundColor: a.bg }
1667
1770
  },
1668
1771
  /* @__PURE__ */ r.createElement("span", { className: "w-1.5 h-1.5 rounded-full", style: { backgroundColor: a.color } }),
1669
- a.label || o
1772
+ a.label || n
1670
1773
  );
1671
1774
  }
1672
- const i = Ur[s] || {
1775
+ const i = na[s] || {
1673
1776
  bg: "bg-gray-500/10 border-gray-500/20",
1674
1777
  text: "text-gray-700 dark:text-gray-300",
1675
1778
  dot: "bg-gray-400"
@@ -1680,24 +1783,24 @@ function Vr({ value: e, column: t }) {
1680
1783
  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}`
1681
1784
  },
1682
1785
  /* @__PURE__ */ r.createElement("span", { className: `w-1.5 h-1.5 rounded-full ${i.dot}` }),
1683
- o
1786
+ n
1684
1787
  );
1685
1788
  }
1686
- function Kr({ value: e }) {
1687
- return !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ r.createElement(U, null) : /* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap gap-1 items-center" }, e.slice(0, 3).map((t, o) => /* @__PURE__ */ r.createElement(
1789
+ function sa({ value: e }) {
1790
+ return !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ r.createElement(Q, null) : /* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap gap-1 items-center" }, e.slice(0, 3).map((t, n) => /* @__PURE__ */ r.createElement(
1688
1791
  "span",
1689
1792
  {
1690
- key: o,
1793
+ key: n,
1691
1794
  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"
1692
1795
  },
1693
1796
  typeof t == "object" ? JSON.stringify(t) : String(t)
1694
1797
  )), e.length > 3 && /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-400 font-medium" }, "+", e.length - 3));
1695
1798
  }
1696
- function Jr({ value: e }) {
1697
- return !e || typeof e != "object" ? /* @__PURE__ */ r.createElement(U, 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));
1799
+ function la({ value: e }) {
1800
+ return !e || typeof e != "object" ? /* @__PURE__ */ r.createElement(Q, 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));
1698
1801
  }
1699
- function Yr({ value: e }) {
1700
- if (!e) return /* @__PURE__ */ r.createElement(U, null);
1802
+ function ia({ value: e }) {
1803
+ if (!e) return /* @__PURE__ */ r.createElement(Q, null);
1701
1804
  const t = String(e);
1702
1805
  return /* @__PURE__ */ r.createElement(
1703
1806
  "a",
@@ -1711,8 +1814,8 @@ function Yr({ value: e }) {
1711
1814
  /* @__PURE__ */ r.createElement("span", { className: "text-xs" }, "↗")
1712
1815
  );
1713
1816
  }
1714
- function Gr({ value: e }) {
1715
- if (!e) return /* @__PURE__ */ r.createElement(U, null);
1817
+ function da({ value: e }) {
1818
+ if (!e) return /* @__PURE__ */ r.createElement(Q, null);
1716
1819
  const t = String(e);
1717
1820
  return /* @__PURE__ */ r.createElement(
1718
1821
  "a",
@@ -1723,8 +1826,8 @@ function Gr({ value: e }) {
1723
1826
  t
1724
1827
  );
1725
1828
  }
1726
- function qr({ value: e }) {
1727
- if (!e) return /* @__PURE__ */ r.createElement(U, null);
1829
+ function ca({ value: e }) {
1830
+ if (!e) return /* @__PURE__ */ r.createElement(Q, null);
1728
1831
  const t = String(e);
1729
1832
  return /* @__PURE__ */ r.createElement(
1730
1833
  "a",
@@ -1735,91 +1838,91 @@ function qr({ value: e }) {
1735
1838
  t
1736
1839
  );
1737
1840
  }
1738
- function Xr({ value: e }) {
1841
+ function ua({ value: e }) {
1739
1842
  if (e == null || isNaN(Number(e)))
1740
- return /* @__PURE__ */ r.createElement(U, null);
1741
- 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";
1843
+ return /* @__PURE__ */ r.createElement(Q, null);
1844
+ 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";
1742
1845
  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(
1743
1846
  "div",
1744
1847
  {
1745
- className: `h-full rounded-full ${o} transition-all duration-500`,
1848
+ className: `h-full rounded-full ${n} transition-all duration-500`,
1746
1849
  style: { width: `${t}%` }
1747
1850
  }
1748
1851
  )), /* @__PURE__ */ r.createElement("span", { className: "font-mono text-xs font-bold text-gray-700 dark:text-gray-300 w-9 text-right" }, t, "%"));
1749
1852
  }
1750
- function Zr({ value: e }) {
1853
+ function ma({ value: e }) {
1751
1854
  if (e == null || isNaN(Number(e)))
1752
- return /* @__PURE__ */ r.createElement(U, null);
1855
+ return /* @__PURE__ */ r.createElement(Q, null);
1753
1856
  const t = Number(e);
1754
1857
  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"));
1755
1858
  }
1756
- function Qr({ value: e }) {
1859
+ function ga({ value: e }) {
1757
1860
  if (e == null || e === "")
1758
- return /* @__PURE__ */ r.createElement(U, null);
1861
+ return /* @__PURE__ */ r.createElement(Q, null);
1759
1862
  const t = String(e);
1760
1863
  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);
1761
1864
  }
1762
- function ea({
1865
+ function fa({
1763
1866
  row: e,
1764
1867
  column: t,
1765
- rowIndex: o
1868
+ rowIndex: n
1766
1869
  }) {
1767
- const s = j(e, t.key);
1870
+ const s = L(e, t.key);
1768
1871
  if (t.render && typeof t.render == "function")
1769
- return /* @__PURE__ */ r.createElement(r.Fragment, null, t.render(s, e, o));
1872
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, t.render(s, e, n));
1770
1873
  if (t.formatter && typeof t.formatter == "function")
1771
- return /* @__PURE__ */ r.createElement(r.Fragment, null, t.formatter(s, e, o));
1874
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, t.formatter(s, e, n));
1772
1875
  switch (t.type) {
1773
1876
  case "boolean":
1774
- return /* @__PURE__ */ r.createElement(Fr, { value: s, column: t });
1877
+ return /* @__PURE__ */ r.createElement(ta, { value: s, column: t });
1775
1878
  case "number":
1776
- return /* @__PURE__ */ r.createElement(Hr, { value: s, column: t });
1879
+ return /* @__PURE__ */ r.createElement(ea, { value: s, column: t });
1777
1880
  case "currency":
1778
- return /* @__PURE__ */ r.createElement(Or, { value: s, column: t });
1881
+ return /* @__PURE__ */ r.createElement(ra, { value: s, column: t });
1779
1882
  case "date":
1780
- return /* @__PURE__ */ r.createElement(ct, { value: s, column: t, isDateTime: !1 });
1883
+ return /* @__PURE__ */ r.createElement(jt, { value: s, column: t, isDateTime: !1 });
1781
1884
  case "datetime":
1782
- return /* @__PURE__ */ r.createElement(ct, { value: s, column: t, isDateTime: !0 });
1885
+ return /* @__PURE__ */ r.createElement(jt, { value: s, column: t, isDateTime: !0 });
1783
1886
  case "image":
1784
- return /* @__PURE__ */ r.createElement(Ir, { value: s, column: t });
1887
+ return /* @__PURE__ */ r.createElement(aa, { value: s, column: t });
1785
1888
  case "status":
1786
- return /* @__PURE__ */ r.createElement(Vr, { value: s, column: t });
1889
+ return /* @__PURE__ */ r.createElement(oa, { value: s, column: t });
1787
1890
  case "progress":
1788
- return /* @__PURE__ */ r.createElement(Xr, { value: s, column: t });
1891
+ return /* @__PURE__ */ r.createElement(ua, { value: s, column: t });
1789
1892
  case "rating":
1790
- return /* @__PURE__ */ r.createElement(Zr, { value: s, column: t });
1893
+ return /* @__PURE__ */ r.createElement(ma, { value: s, column: t });
1791
1894
  case "badge":
1792
- return /* @__PURE__ */ r.createElement(Qr, { value: s, column: t });
1895
+ return /* @__PURE__ */ r.createElement(ga, { value: s, column: t });
1793
1896
  case "array":
1794
- return /* @__PURE__ */ r.createElement(Kr, { value: s, column: t });
1897
+ return /* @__PURE__ */ r.createElement(sa, { value: s, column: t });
1795
1898
  case "object":
1796
- return /* @__PURE__ */ r.createElement(Jr, { value: s, column: t });
1899
+ return /* @__PURE__ */ r.createElement(la, { value: s, column: t });
1797
1900
  case "url":
1798
- return /* @__PURE__ */ r.createElement(Yr, { value: s, column: t });
1901
+ return /* @__PURE__ */ r.createElement(ia, { value: s, column: t });
1799
1902
  case "email":
1800
- return /* @__PURE__ */ r.createElement(Gr, { value: s, column: t });
1903
+ return /* @__PURE__ */ r.createElement(da, { value: s, column: t });
1801
1904
  case "phone":
1802
- return /* @__PURE__ */ r.createElement(qr, { value: s, column: t });
1905
+ return /* @__PURE__ */ r.createElement(ca, { value: s, column: t });
1803
1906
  default:
1804
- return /* @__PURE__ */ r.createElement(Nt, { value: s, column: t });
1907
+ return /* @__PURE__ */ r.createElement(qt, { value: s, column: t });
1805
1908
  }
1806
1909
  }
1807
- function ta({
1910
+ function pa({
1808
1911
  isOpen: e,
1809
1912
  title: t,
1810
- message: o,
1913
+ message: n,
1811
1914
  confirmText: s = "Confirm",
1812
1915
  cancelText: i = "Cancel",
1813
1916
  type: a = "danger",
1814
1917
  onClose: l,
1815
- onConfirm: u,
1918
+ onConfirm: m,
1816
1919
  isLoading: d = !1
1817
1920
  }) {
1818
- return ee(() => {
1819
- const c = (n) => {
1820
- n.key === "Escape" && l();
1921
+ return we(() => {
1922
+ const u = (o) => {
1923
+ o.key === "Escape" && l();
1821
1924
  };
1822
- return e && window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
1925
+ return e && window.addEventListener("keydown", u), () => window.removeEventListener("keydown", u);
1823
1926
  }, [e, l]), e ? /* @__PURE__ */ r.createElement(
1824
1927
  "div",
1825
1928
  {
@@ -1830,7 +1933,7 @@ function ta({
1830
1933
  "div",
1831
1934
  {
1832
1935
  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",
1833
- onClick: (c) => c.stopPropagation(),
1936
+ onClick: (u) => u.stopPropagation(),
1834
1937
  role: "dialog"
1835
1938
  },
1836
1939
  /* @__PURE__ */ r.createElement(
@@ -1841,7 +1944,7 @@ function ta({
1841
1944
  a === "danger" ? "⚠️" : a === "warning" ? "⚡" : "ℹ️"
1842
1945
  ),
1843
1946
  /* @__PURE__ */ r.createElement("h3", { className: "text-xl font-black text-gray-900 dark:text-white mb-2" }, t),
1844
- /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed" }, o),
1947
+ /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed" }, n),
1845
1948
  /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center gap-3" }, /* @__PURE__ */ r.createElement(
1846
1949
  "button",
1847
1950
  {
@@ -1856,7 +1959,7 @@ function ta({
1856
1959
  {
1857
1960
  type: "button",
1858
1961
  disabled: d,
1859
- onClick: u,
1962
+ onClick: m,
1860
1963
  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"}`
1861
1964
  },
1862
1965
  d ? "Processing..." : s
@@ -1864,7 +1967,7 @@ function ta({
1864
1967
  )
1865
1968
  ) : null;
1866
1969
  }
1867
- function St(e, t) {
1970
+ function Yt(e, t) {
1868
1971
  if (!e) return null;
1869
1972
  if (r.isValidElement(e))
1870
1973
  return e;
@@ -1873,22 +1976,22 @@ function St(e, t) {
1873
1976
  const i = e;
1874
1977
  return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1875
1978
  }
1876
- const o = e.displayName || e.name || "";
1877
- if (/^[A-Z]/.test(o)) {
1979
+ const n = e.displayName || e.name || "";
1980
+ if (/^[A-Z]/.test(n)) {
1878
1981
  const i = e;
1879
1982
  return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1880
1983
  }
1881
1984
  try {
1882
1985
  const i = e(t);
1883
- return St(i, t);
1986
+ return Yt(i, t);
1884
1987
  } catch {
1885
1988
  const i = e;
1886
1989
  return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1887
1990
  }
1888
1991
  }
1889
1992
  if (typeof e == "object" && e !== null && (e.$$typeof || e.render)) {
1890
- const o = e;
1891
- return /* @__PURE__ */ r.createElement(o, { className: "w-4 h-4 shrink-0" });
1993
+ const n = e;
1994
+ return /* @__PURE__ */ r.createElement(n, { className: "w-4 h-4 shrink-0" });
1892
1995
  }
1893
1996
  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(
1894
1997
  "img",
@@ -1899,7 +2002,7 @@ function St(e, t) {
1899
2002
  }
1900
2003
  ) : /* @__PURE__ */ r.createElement("span", { className: "inline-flex items-center justify-center leading-none text-base" }, e) : e;
1901
2004
  }
1902
- const gt = {
2005
+ const Dt = {
1903
2006
  primary: "bg-primary text-white hover:bg-primary-soft shadow-sm shadow-primary/20",
1904
2007
  secondary: "bg-emerald-600 text-white hover:bg-emerald-700 shadow-sm shadow-emerald-600/20",
1905
2008
  success: "bg-emerald-500 text-white hover:bg-emerald-600 shadow-sm shadow-emerald-500/20",
@@ -1909,102 +2012,102 @@ const gt = {
1909
2012
  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",
1910
2013
  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"
1911
2014
  };
1912
- function ra({
2015
+ function ba({
1913
2016
  row: e,
1914
2017
  actions: t,
1915
- context: o
2018
+ context: n
1916
2019
  }) {
1917
- const [s, i] = R(null), [a, l] = R({});
2020
+ const [s, i] = $(null), [a, l] = $({});
1918
2021
  if (!t || !t.length)
1919
2022
  return null;
1920
- const u = async (n) => {
1921
- if (n.confirmation) {
1922
- const b = 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?";
2023
+ const m = async (o) => {
2024
+ if (o.confirmation) {
2025
+ const p = typeof o.confirmation.title == "function" ? o.confirmation.title(e) : o.confirmation.title || "Confirm Action", c = typeof o.confirmation.message == "function" ? o.confirmation.message(e) : o.confirmation.message || "Are you sure you want to perform this action?";
1923
2026
  i({
1924
2027
  isOpen: !0,
1925
- title: b,
1926
- message: g,
1927
- confirmText: n.confirmation.confirmText || "Confirm",
1928
- cancelText: n.confirmation.cancelText || "Cancel",
1929
- type: n.confirmation.type || "danger",
2028
+ title: p,
2029
+ message: c,
2030
+ confirmText: o.confirmation.confirmText || "Confirm",
2031
+ cancelText: o.confirmation.cancelText || "Cancel",
2032
+ type: o.confirmation.type || "danger",
1930
2033
  onConfirm: async () => {
1931
- i(null), await d(n);
2034
+ i(null), await d(o);
1932
2035
  }
1933
2036
  });
1934
2037
  return;
1935
2038
  }
1936
- await d(n);
1937
- }, d = async (n) => {
1938
- if (n.type === "button" || !n.type) {
1939
- l((b) => ({ ...b, [n.id]: !0 }));
2039
+ await d(o);
2040
+ }, d = async (o) => {
2041
+ if (o.type === "button" || !o.type) {
2042
+ l((p) => ({ ...p, [o.id]: !0 }));
1940
2043
  try {
1941
- await n.onClick(e, o);
2044
+ await o.onClick(e, n);
1942
2045
  } finally {
1943
- l((b) => ({ ...b, [n.id]: !1 }));
2046
+ l((p) => ({ ...p, [o.id]: !1 }));
1944
2047
  }
1945
2048
  }
1946
- }, c = async (n, b) => {
1947
- const g = !b;
1948
- l((m) => ({ ...m, [n.id]: !0 }));
2049
+ }, u = async (o, p) => {
2050
+ const c = !p;
2051
+ l((g) => ({ ...g, [o.id]: !0 }));
1949
2052
  try {
1950
- await n.onChange(e, g, o);
2053
+ await o.onChange(e, c, n);
1951
2054
  } finally {
1952
- l((m) => ({ ...m, [n.id]: !1 }));
2055
+ l((g) => ({ ...g, [o.id]: !1 }));
1953
2056
  }
1954
2057
  };
1955
- return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-end gap-2 pr-2" }, t.map((n) => {
1956
- if (typeof n.hide == "function" && n.hide(e) || typeof n.show == "function" && !n.show(e)) return null;
1957
- const b = typeof n.disabled == "function" ? n.disabled(e) : !!n.disabled, g = a[n.id] || (typeof n.loading == "function" ? n.loading(e) : !!n.loading), m = typeof n.label == "function" ? n.label(e) : n.label, f = St(n.icon, e), x = typeof n.tooltip == "function" ? n.tooltip(e) : n.tooltip, w = typeof n.className == "function" ? n.className(e) : n.className || "";
1958
- if (n.type === "custom" && n.render)
1959
- return /* @__PURE__ */ r.createElement(r.Fragment, { key: n.id }, n.render(e, o));
1960
- if (n.type === "switch") {
1961
- const p = n, y = p.checked(e);
2058
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-end gap-2 pr-2 whitespace-nowrap" }, t.map((o) => {
2059
+ if (typeof o.hide == "function" && o.hide(e) || typeof o.show == "function" && !o.show(e)) return null;
2060
+ const p = typeof o.disabled == "function" ? o.disabled(e) : !!o.disabled, c = a[o.id] || (typeof o.loading == "function" ? o.loading(e) : !!o.loading), g = typeof o.label == "function" ? o.label(e) : o.label, f = Yt(o.icon, e), b = typeof o.tooltip == "function" ? o.tooltip(e) : o.tooltip, S = typeof o.className == "function" ? o.className(e) : o.className || "";
2061
+ if (o.type === "custom" && o.render)
2062
+ return /* @__PURE__ */ r.createElement(r.Fragment, { key: o.id }, o.render(e, n));
2063
+ if (o.type === "switch") {
2064
+ const y = o, x = y.checked(e);
1962
2065
  return /* @__PURE__ */ r.createElement(
1963
2066
  "div",
1964
2067
  {
1965
- key: n.id,
1966
- className: "flex items-center gap-2",
1967
- title: x || m
2068
+ key: o.id,
2069
+ className: "flex items-center gap-2 shrink-0",
2070
+ title: b || g
1968
2071
  },
1969
- m && /* @__PURE__ */ r.createElement("span", { className: "text-xs font-semibold text-gray-500" }, m, ":"),
2072
+ g && /* @__PURE__ */ r.createElement("span", { className: "text-xs font-semibold text-gray-500" }, g, ":"),
1970
2073
  /* @__PURE__ */ r.createElement(
1971
2074
  "button",
1972
2075
  {
1973
2076
  type: "button",
1974
2077
  role: "switch",
1975
- "aria-checked": y,
1976
- disabled: b || g,
1977
- onClick: () => c(p, y),
1978
- 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 ${y ? "bg-emerald-500" : "bg-gray-300 dark:bg-gray-700"} ${w}`
2078
+ "aria-checked": x,
2079
+ disabled: p || c,
2080
+ onClick: () => u(y, x),
2081
+ 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"} ${S}`
1979
2082
  },
1980
2083
  /* @__PURE__ */ r.createElement(
1981
2084
  "span",
1982
2085
  {
1983
2086
  "aria-hidden": "true",
1984
- 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 ${y ? "translate-x-5" : "translate-x-0"}`
2087
+ 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"}`
1985
2088
  },
1986
- g && /* @__PURE__ */ r.createElement("span", { className: "w-2.5 h-2.5 border-2 border-primary border-t-transparent rounded-full animate-spin" })
2089
+ c && /* @__PURE__ */ r.createElement("span", { className: "w-2.5 h-2.5 border-2 border-primary border-t-transparent rounded-full animate-spin" })
1987
2090
  )
1988
2091
  )
1989
2092
  );
1990
2093
  }
1991
- const P = typeof n.variant == "function" ? n.variant(e) : n.variant || "neutral", M = gt[P] || gt.neutral, E = !m && f ? "p-2 min-w-[2rem]" : "px-3 py-1.5";
2094
+ const z = typeof o.variant == "function" ? o.variant(e) : o.variant || "neutral", W = Dt[z] || Dt.neutral, E = !g && f ? "p-2 min-w-[2rem]" : "px-3 py-1.5";
1992
2095
  return /* @__PURE__ */ r.createElement(
1993
2096
  "button",
1994
2097
  {
1995
- key: n.id,
2098
+ key: o.id,
1996
2099
  type: "button",
1997
- disabled: b || g,
1998
- onClick: () => u(n),
1999
- title: x,
2000
- style: n.color ? { backgroundColor: n.color, color: "#ffffff" } : void 0,
2001
- 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 ${M} ${w}`
2100
+ disabled: p || c,
2101
+ onClick: () => m(o),
2102
+ title: b,
2103
+ style: o.color ? { backgroundColor: o.color, color: "#ffffff" } : void 0,
2104
+ className: `inline-flex items-center justify-center gap-1.5 ${E} rounded-xl text-xs font-bold shrink-0 transition-all duration-200 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 ${W} ${S}`
2002
2105
  },
2003
- g ? /* @__PURE__ */ r.createElement("span", { className: "w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full animate-spin" }) : f && /* @__PURE__ */ r.createElement("span", { className: "text-sm flex items-center justify-center shrink-0" }, f),
2004
- m && /* @__PURE__ */ r.createElement("span", null, m)
2106
+ c ? /* @__PURE__ */ r.createElement("span", { className: "w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full animate-spin" }) : f && /* @__PURE__ */ r.createElement("span", { className: "text-sm flex items-center justify-center shrink-0" }, f),
2107
+ g && /* @__PURE__ */ r.createElement("span", null, g)
2005
2108
  );
2006
2109
  })), s && /* @__PURE__ */ r.createElement(
2007
- ta,
2110
+ pa,
2008
2111
  {
2009
2112
  isOpen: s.isOpen,
2010
2113
  title: s.title,
@@ -2017,58 +2120,58 @@ function ra({
2017
2120
  }
2018
2121
  ));
2019
2122
  }
2020
- function aa({
2123
+ function ya({
2021
2124
  rows: e,
2022
2125
  columns: t,
2023
- actions: o,
2126
+ actions: n,
2024
2127
  actionContext: s,
2025
2128
  rowKeyResolver: i,
2026
2129
  selectable: a,
2027
2130
  selectedKeys: l,
2028
- onToggleSelectRow: u,
2131
+ onToggleSelectRow: m,
2029
2132
  onRowClick: d,
2030
- striped: c = !1,
2031
- hoverable: n = !0,
2032
- rowClassName: b,
2033
- isVirtualized: g = !1,
2034
- paddingTop: m = 0,
2133
+ striped: u = !1,
2134
+ hoverable: o = !0,
2135
+ rowClassName: p,
2136
+ isVirtualized: c = !1,
2137
+ paddingTop: g = 0,
2035
2138
  paddingBottom: f = 0,
2036
- startIndex: x = 0,
2037
- pinnedStyles: w = {},
2038
- columnWidths: P = {},
2039
- dir: M = "ltr",
2139
+ startIndex: b = 0,
2140
+ pinnedStyles: S = {},
2141
+ columnWidths: z = {},
2142
+ dir: W = "ltr",
2040
2143
  actionsWidth: E,
2041
- messages: p = te
2144
+ messages: y = Ee
2042
2145
  }) {
2043
- const y = ce(), k = M === "rtl", N = !!(o && o.length > 0), D = t.length + (a ? 1 : 0) + (N ? 1 : 0);
2146
+ const x = _e(), k = W === "rtl", h = !!(n && n.length > 0), j = t.length + (a ? 1 : 0) + (h ? 1 : 0);
2044
2147
  return /* @__PURE__ */ r.createElement(
2045
2148
  "tbody",
2046
2149
  {
2047
- className: y.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900"
2150
+ className: x.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900"
2048
2151
  },
2049
- g && m > 0 && /* @__PURE__ */ r.createElement(
2152
+ c && g > 0 && /* @__PURE__ */ r.createElement(
2050
2153
  "tr",
2051
2154
  {
2052
- style: { height: `${m}px`, border: 0 },
2155
+ style: { height: `${g}px`, border: 0 },
2053
2156
  "aria-hidden": "true",
2054
2157
  className: "pointer-events-none"
2055
2158
  },
2056
2159
  /* @__PURE__ */ r.createElement(
2057
2160
  "td",
2058
2161
  {
2059
- colSpan: D,
2060
- style: { height: `${m}px`, padding: 0, border: 0 }
2162
+ colSpan: j,
2163
+ style: { height: `${g}px`, padding: 0, border: 0 }
2061
2164
  }
2062
2165
  )
2063
2166
  ),
2064
- e.map((v, L) => {
2065
- const h = x + L, A = i(v, h), W = l?.has(A), F = typeof b == "function" ? b(v, h) : b || "";
2167
+ e.map((v, F) => {
2168
+ const w = b + F, T = i(v, w), P = l?.has(T), H = typeof p == "function" ? p(v, w) : p || "";
2066
2169
  return /* @__PURE__ */ r.createElement(
2067
2170
  "tr",
2068
2171
  {
2069
- key: String(A),
2070
- onClick: (S) => d?.(v, h, S),
2071
- className: `${y.classes?.tr || "transition-colors duration-150"} ${c && h % 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" : ""} ${F}`
2172
+ key: String(T),
2173
+ onClick: (N) => d?.(v, w, N),
2174
+ className: `${x.classes?.tr || "transition-colors duration-150"} ${u && w % 2 === 1 ? "bg-gray-50/40 dark:bg-slate-800/20" : ""} ${o ? "hover:bg-gray-50/70 dark:hover:bg-slate-800/50" : ""} ${P ? "bg-primary/5 dark:bg-primary/10" : ""} ${d ? "cursor-pointer" : ""} ${H}`
2072
2175
  },
2073
2176
  a && /* @__PURE__ */ r.createElement(
2074
2177
  "td",
@@ -2076,69 +2179,64 @@ function aa({
2076
2179
  style: {
2077
2180
  width: 44,
2078
2181
  minWidth: 44,
2079
- position: "sticky",
2080
- [k ? "right" : "left"]: 0,
2081
- zIndex: 3,
2082
- backgroundColor: W ? void 0 : y.colors?.tableBg || "inherit"
2182
+ backgroundColor: P ? void 0 : x.colors?.tableBg || void 0
2083
2183
  },
2084
2184
  className: "w-11 px-4 py-3 text-center align-middle",
2085
- onClick: (S) => S.stopPropagation()
2185
+ onClick: (N) => N.stopPropagation()
2086
2186
  },
2087
2187
  /* @__PURE__ */ r.createElement(
2088
2188
  "input",
2089
2189
  {
2090
2190
  type: "checkbox",
2091
- checked: W,
2092
- title: p.selectRow,
2093
- "aria-label": p.selectRow,
2094
- onChange: () => u?.(A, v),
2191
+ checked: P,
2192
+ title: y.selectRow,
2193
+ "aria-label": y.selectRow,
2194
+ onChange: () => m?.(T, v),
2095
2195
  className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
2096
2196
  }
2097
2197
  )
2098
2198
  ),
2099
- t.map((S) => {
2100
- const _ = String(S.key), H = w[_], C = !!H, O = S.align === "center" ? "text-center" : S.align === "right" ? "text-right" : S.align === "left" ? "text-left" : k ? "text-right" : "text-left", I = typeof S.className == "function" ? S.className(v?.[S.key], v, h) : S.className || "", V = {
2101
- width: P[_] ?? S.width,
2102
- minWidth: S.minWidth,
2103
- maxWidth: S.maxWidth,
2104
- ...C ? H : {},
2105
- backgroundColor: C ? W ? void 0 : y.colors?.tableBg || "inherit" : void 0
2199
+ t.map((N) => {
2200
+ const U = String(N.key), G = S[U], R = !!G, V = N.align === "center" ? "text-center" : N.align === "right" ? "text-right" : N.align === "left" ? "text-left" : k ? "text-right" : "text-left", C = typeof N.className == "function" ? N.className(v?.[N.key], v, w) : N.className || "", J = {
2201
+ width: z[U] ?? N.width,
2202
+ minWidth: N.minWidth,
2203
+ maxWidth: N.maxWidth,
2204
+ ...R ? G : {},
2205
+ backgroundColor: R ? P ? void 0 : x.colors?.tableBg || "inherit" : void 0
2106
2206
  };
2107
2207
  return /* @__PURE__ */ r.createElement(
2108
2208
  "td",
2109
2209
  {
2110
- key: _,
2111
- style: V,
2112
- className: `${y.classes?.td || "py-3 px-4 text-sm align-middle"} ${O} ${I} ${C ? k ? "border-l border-gray-200/60 dark:border-gray-800/60 shadow-[-2px_0_4px_rgba(0,0,0,0.03)]" : "border-r border-gray-200/60 dark:border-gray-800/60 shadow-[2px_0_4px_rgba(0,0,0,0.03)]" : ""}`
2210
+ key: U,
2211
+ style: J,
2212
+ className: `${x.classes?.td || "py-3 px-4 text-sm align-middle"} ${V} ${C} ${R ? k ? "border-l border-gray-200/60 dark:border-gray-800/60 shadow-[-2px_0_4px_rgba(0,0,0,0.03)]" : "border-r border-gray-200/60 dark:border-gray-800/60 shadow-[2px_0_4px_rgba(0,0,0,0.03)]" : ""}`
2113
2213
  },
2114
- /* @__PURE__ */ r.createElement(ea, { row: v, column: S, rowIndex: h })
2214
+ /* @__PURE__ */ r.createElement(fa, { row: v, column: N, rowIndex: w })
2115
2215
  );
2116
2216
  }),
2117
- N && /* @__PURE__ */ r.createElement(
2217
+ h && /* @__PURE__ */ r.createElement(
2118
2218
  "td",
2119
2219
  {
2120
2220
  style: {
2121
2221
  width: E || "auto",
2122
- position: "sticky",
2123
- [k ? "left" : "right"]: 0,
2124
- zIndex: 3,
2125
- backgroundColor: W ? void 0 : y.colors?.tableBg || "inherit"
2222
+ minWidth: typeof E == "number" ? E : void 0,
2223
+ backgroundColor: P ? void 0 : x.colors?.tableBg || void 0
2126
2224
  },
2127
- className: `${y.classes?.td || "py-3 px-4 text-sm align-middle"} ${k ? "text-left pl-6" : "text-right pr-6"}`,
2128
- onClick: (S) => S.stopPropagation()
2225
+ className: `${x.classes?.td || "py-3 px-4 text-sm align-middle"} ${k ? "text-left pl-6" : "text-right pr-6"} whitespace-nowrap`,
2226
+ onClick: (N) => N.stopPropagation()
2129
2227
  },
2130
2228
  /* @__PURE__ */ r.createElement(
2131
- ra,
2229
+ ba,
2132
2230
  {
2133
2231
  row: v,
2134
- actions: o || [],
2232
+ actions: n || [],
2135
2233
  context: s
2136
2234
  }
2137
2235
  )
2138
2236
  )
2139
2237
  );
2140
2238
  }),
2141
- g && f > 0 && /* @__PURE__ */ r.createElement(
2239
+ c && f > 0 && /* @__PURE__ */ r.createElement(
2142
2240
  "tr",
2143
2241
  {
2144
2242
  style: { height: `${f}px`, border: 0 },
@@ -2148,56 +2246,56 @@ function aa({
2148
2246
  /* @__PURE__ */ r.createElement(
2149
2247
  "td",
2150
2248
  {
2151
- colSpan: D,
2249
+ colSpan: j,
2152
2250
  style: { height: `${f}px`, padding: 0, border: 0 }
2153
2251
  }
2154
2252
  )
2155
2253
  )
2156
2254
  );
2157
2255
  }
2158
- function na({
2256
+ function xa({
2159
2257
  page: e,
2160
2258
  pageSize: t,
2161
- totalRecords: o,
2259
+ totalRecords: n,
2162
2260
  totalPages: s,
2163
2261
  pageSizeOptions: i = [5, 10, 20, 50, 100],
2164
2262
  onPageChange: a,
2165
2263
  onPageSizeChange: l,
2166
- showPageSizeSelector: u = !0,
2264
+ showPageSizeSelector: m = !0,
2167
2265
  showTotalCount: d = !0,
2168
- pageWindow: c,
2169
- messages: n = te,
2170
- dir: b = "ltr"
2266
+ pageWindow: u,
2267
+ messages: o = Ee,
2268
+ dir: p = "ltr"
2171
2269
  }) {
2172
- const g = ce(), m = b === "rtl", f = Math.min((e - 1) * t + 1, o), x = Math.min(e * t, o);
2270
+ const c = _e(), g = p === "rtl", f = Math.min((e - 1) * t + 1, n), b = Math.min(e * t, n);
2173
2271
  return /* @__PURE__ */ r.createElement(
2174
2272
  "div",
2175
2273
  {
2176
- dir: b,
2177
- className: g.classes?.paginationContainer || "w-full flex flex-wrap items-center justify-between gap-4 pt-4 text-sm text-gray-600 dark:text-gray-400"
2274
+ dir: p,
2275
+ className: c.classes?.paginationContainer || "w-full flex flex-wrap items-center justify-between gap-4 pt-4 text-sm text-gray-600 dark:text-gray-400"
2178
2276
  },
2179
- /* @__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" }, n.showing, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, f), " ", n.to, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, x), " ", n.of, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, o.toLocaleString()), " ", n.results) : /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, n.page, " ", e, " ", n.of, " ", s), u && /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-2 ml-2 rtl:ml-0 rtl:mr-2" }, /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-500 hidden sm:inline" }, n.rowsPerPage, ":"), /* @__PURE__ */ r.createElement(
2277
+ /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-3" }, d && n > 0 ? /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, o.showing, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, f), " ", o.to, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, b), " ", o.of, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, n.toLocaleString()), " ", o.results) : /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, o.page, " ", e, " ", o.of, " ", s), m && /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-2 ml-2 rtl:ml-0 rtl:mr-2" }, /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-500 hidden sm:inline" }, o.rowsPerPage, ":"), /* @__PURE__ */ r.createElement(
2180
2278
  "select",
2181
2279
  {
2182
2280
  value: t,
2183
- onChange: (w) => l(Number(w.target.value)),
2184
- "aria-label": n.rowsPerPage,
2185
- className: g.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"
2281
+ onChange: (S) => l(Number(S.target.value)),
2282
+ "aria-label": o.rowsPerPage,
2283
+ className: c.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"
2186
2284
  },
2187
- i.map((w) => /* @__PURE__ */ r.createElement(
2285
+ i.map((S) => /* @__PURE__ */ r.createElement(
2188
2286
  "option",
2189
2287
  {
2190
- key: w,
2191
- value: w,
2288
+ key: S,
2289
+ value: S,
2192
2290
  className: "bg-white dark:bg-slate-800 text-gray-900 dark:text-white"
2193
2291
  },
2194
- w
2292
+ S
2195
2293
  ))
2196
2294
  ))),
2197
2295
  /* @__PURE__ */ r.createElement(
2198
2296
  "div",
2199
2297
  {
2200
- className: `flex items-center gap-1.5 ${m ? "mr-auto" : "ml-auto"}`
2298
+ className: `flex items-center gap-1.5 ${g ? "mr-auto" : "ml-auto"}`
2201
2299
  },
2202
2300
  /* @__PURE__ */ r.createElement(
2203
2301
  "button",
@@ -2205,23 +2303,23 @@ function na({
2205
2303
  type: "button",
2206
2304
  disabled: e <= 1,
2207
2305
  onClick: () => a(e - 1),
2208
- "aria-label": n.prevPage,
2209
- title: n.prevPage,
2210
- className: `${g.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 cursor-pointer disabled:cursor-not-allowed"}`
2306
+ "aria-label": o.prevPage,
2307
+ title: o.prevPage,
2308
+ className: `${c.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 cursor-pointer disabled:cursor-not-allowed"}`
2211
2309
  },
2212
- m ? "›" : "‹"
2310
+ g ? "›" : "‹"
2213
2311
  ),
2214
- c.map((w) => {
2215
- const P = w === e;
2312
+ u.map((S) => {
2313
+ const z = S === e;
2216
2314
  return /* @__PURE__ */ r.createElement(
2217
2315
  "button",
2218
2316
  {
2219
- key: w,
2317
+ key: S,
2220
2318
  type: "button",
2221
- onClick: () => a(w),
2222
- className: `${g.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs transition shadow-sm cursor-pointer"} ${P ? "bg-primary text-white shadow-primary/20 scale-105" : "bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700"}`
2319
+ onClick: () => a(S),
2320
+ className: `${c.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs transition shadow-sm cursor-pointer"} ${z ? "bg-primary text-white shadow-primary/20 scale-105" : "bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700"}`
2223
2321
  },
2224
- w
2322
+ S
2225
2323
  );
2226
2324
  }),
2227
2325
  /* @__PURE__ */ r.createElement(
@@ -2230,19 +2328,19 @@ function na({
2230
2328
  type: "button",
2231
2329
  disabled: e >= s,
2232
2330
  onClick: () => a(e + 1),
2233
- "aria-label": n.nextPage,
2234
- title: n.nextPage,
2235
- className: `${g.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 cursor-pointer disabled:cursor-not-allowed"}`
2331
+ "aria-label": o.nextPage,
2332
+ title: o.nextPage,
2333
+ className: `${c.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 cursor-pointer disabled:cursor-not-allowed"}`
2236
2334
  },
2237
- m ? "‹" : "›"
2335
+ g ? "‹" : "›"
2238
2336
  )
2239
2337
  )
2240
2338
  );
2241
2339
  }
2242
- function oa({
2340
+ function ha({
2243
2341
  columnsCount: e = 5,
2244
2342
  rowsCount: t = 5,
2245
- hasActions: o = !0
2343
+ hasActions: n = !0
2246
2344
  }) {
2247
2345
  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(
2248
2346
  "div",
@@ -2252,17 +2350,17 @@ function oa({
2252
2350
  width: `${Math.floor(40 + (l * 19 + i * 13) % 45)}%`
2253
2351
  }
2254
2352
  }
2255
- ))), 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" }))))));
2353
+ ))), n && /* @__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" }))))));
2256
2354
  }
2257
- function sa({
2355
+ function ka({
2258
2356
  title: e,
2259
2357
  description: t,
2260
- isSearchActive: o = !1,
2358
+ isSearchActive: n = !1,
2261
2359
  onClearSearch: s,
2262
2360
  colSpan: i,
2263
- messages: a = te
2361
+ messages: a = Ee
2264
2362
  }) {
2265
- const l = a.noRecordsTitle, u = a.noRecordsDescription, d = /* @__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 || l), /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-sm mb-5 leading-relaxed" }, t || u), o && s && /* @__PURE__ */ r.createElement(
2363
+ const l = a.noRecordsTitle, m = a.noRecordsDescription, d = /* @__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" }, n ? "🔍" : "📂"), /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1" }, e || l), /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-sm mb-5 leading-relaxed" }, t || m), n && s && /* @__PURE__ */ r.createElement(
2266
2364
  "button",
2267
2365
  {
2268
2366
  type: "button",
@@ -2273,13 +2371,13 @@ function sa({
2273
2371
  ));
2274
2372
  return i !== void 0 ? /* @__PURE__ */ r.createElement("tbody", null, /* @__PURE__ */ r.createElement("tr", null, /* @__PURE__ */ r.createElement("td", { colSpan: i, className: "p-0" }, d))) : d;
2275
2373
  }
2276
- function la({
2374
+ function wa({
2277
2375
  error: e,
2278
2376
  onRetry: t,
2279
- messages: o = te
2377
+ messages: n = Ee
2280
2378
  }) {
2281
- const s = typeof e == "string" ? e : e?.message || e?.response?.data?.message || o.errorDescription;
2282
- 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" }, o.errorTitle), /* @__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" }, s), t && /* @__PURE__ */ r.createElement(
2379
+ const s = typeof e == "string" ? e : e?.message || e?.response?.data?.message || n.errorDescription;
2380
+ 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" }, n.errorTitle), /* @__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" }, s), t && /* @__PURE__ */ r.createElement(
2283
2381
  "button",
2284
2382
  {
2285
2383
  type: "button",
@@ -2287,662 +2385,863 @@ function la({
2287
2385
  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 cursor-pointer"
2288
2386
  },
2289
2387
  /* @__PURE__ */ r.createElement("span", null, "🔄"),
2290
- /* @__PURE__ */ r.createElement("span", null, o.retry)
2388
+ /* @__PURE__ */ r.createElement("span", null, n.retry)
2291
2389
  ));
2292
2390
  }
2293
- function Ue(e) {
2391
+ function xt(e) {
2294
2392
  if (e == null) return "";
2295
2393
  const t = String(e);
2296
2394
  return t.includes(",") || t.includes('"') || t.includes(`
2297
2395
  `) || t.includes("\r") ? `"${t.replace(/"/g, '""')}"` : t;
2298
2396
  }
2299
- function ia(e, t) {
2300
- const o = t.filter((a) => !a.hidden && a.key), i = [o.map((a) => {
2397
+ function va(e, t) {
2398
+ const n = t.filter(
2399
+ (a) => !a.hidden && a.key && a.exportable !== !1
2400
+ ), i = [n.map((a) => {
2301
2401
  const l = typeof a.title == "string" ? a.title : String(a.key);
2302
- return Ue(l);
2402
+ return xt(l);
2303
2403
  }).join(",")];
2304
2404
  for (let a = 0; a < e.length; a++) {
2305
- const l = e[a], u = o.map((d) => {
2306
- const c = j(l, String(d.key));
2307
- if (c == null) return "";
2308
- if (typeof c == "object")
2405
+ const l = e[a], m = n.map((d) => {
2406
+ const u = L(l, String(d.key));
2407
+ let o = u;
2408
+ if (typeof d.exportFormatter == "function")
2409
+ o = d.exportFormatter(u, l, a);
2410
+ else if (typeof d.formatter == "function") {
2411
+ const p = d.formatter(u, l, a);
2412
+ (typeof p == "string" || typeof p == "number") && (o = p);
2413
+ }
2414
+ if (o == null) return "";
2415
+ if (typeof o == "object")
2309
2416
  try {
2310
- return Ue(JSON.stringify(c));
2417
+ return xt(JSON.stringify(o));
2311
2418
  } catch {
2312
2419
  return "";
2313
2420
  }
2314
- return Ue(c);
2421
+ return xt(o);
2315
2422
  });
2316
- i.push(u.join(","));
2423
+ i.push(m.join(","));
2317
2424
  }
2318
2425
  return "\uFEFF" + i.join(`\r
2319
2426
  `);
2320
2427
  }
2321
- function Ct(e, t, o) {
2428
+ function Gt(e, t, n) {
2322
2429
  if (typeof window > "u" || typeof document > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function")
2323
2430
  return;
2324
- const s = e instanceof Blob ? e : new Blob([e], { type: o }), i = URL.createObjectURL(s), a = document.createElement("a");
2431
+ const s = e instanceof Blob ? e : new Blob([e], { type: n }), i = URL.createObjectURL(s), a = document.createElement("a");
2325
2432
  a.href = i, a.download = t, a.style.display = "none", document.body.appendChild(a), a.click(), document.body.removeChild(a), setTimeout(() => URL.revokeObjectURL(i), 1e3);
2326
2433
  }
2327
- function At(e, t, o = "table-export") {
2328
- const s = ia(e, t), i = o.endsWith(".csv") ? o : `${o}.csv`;
2329
- Ct(s, i, "text/csv;charset=utf-8;");
2434
+ function ne(e, t, n = "table-export") {
2435
+ const s = va(e, t), i = n.endsWith(".csv") ? n : `${n}.csv`;
2436
+ Gt(s, i, "text/csv;charset=utf-8;");
2330
2437
  }
2331
- function Pt(e, t = "table-export") {
2332
- const o = JSON.stringify(e, null, 2), s = t.endsWith(".json") ? t : `${t}.json`;
2333
- Ct(o, s, "application/json;charset=utf-8;");
2438
+ function oe(e, t = "table-export") {
2439
+ const n = JSON.stringify(e, null, 2), s = t.endsWith(".json") ? t : `${t}.json`;
2440
+ Gt(n, s, "application/json;charset=utf-8;");
2334
2441
  }
2335
- function mt(e) {
2442
+ function Lt(e) {
2336
2443
  const {
2337
2444
  data: t,
2338
- api: o,
2445
+ api: n,
2339
2446
  columns: s,
2340
2447
  autoColumns: i = !0,
2341
2448
  rowKey: a,
2342
2449
  title: l,
2343
- subtitle: u,
2450
+ subtitle: m,
2344
2451
  actions: d,
2345
- actionsTitle: c,
2346
- actionsWidth: n,
2347
- search: b = !0,
2348
- sorting: g = !0,
2349
- pagination: m,
2452
+ actionsTitle: u,
2453
+ actionsWidth: o,
2454
+ search: p = !0,
2455
+ sorting: c = !0,
2456
+ pagination: g,
2350
2457
  virtualized: f = !1,
2351
- selectable: x = !1,
2352
- onSelectionChange: w,
2353
- onRowClick: P,
2354
- loading: M,
2458
+ selectable: b = !1,
2459
+ onSelectionChange: S,
2460
+ onRowClick: z,
2461
+ loading: W,
2355
2462
  loadingComponent: E,
2356
- emptyComponent: p,
2357
- emptyTitle: y,
2463
+ emptyComponent: y,
2464
+ emptyTitle: x,
2358
2465
  emptyDescription: k,
2359
- errorComponent: N,
2360
- className: D = "",
2466
+ errorComponent: h,
2467
+ className: j = "",
2361
2468
  tableClassName: v = "",
2362
- headerClassName: L = "",
2363
- rowClassName: h,
2364
- headerActions: A,
2365
- showHeader: W = !0,
2366
- bordered: F = !0,
2367
- striped: S = !1,
2368
- hoverable: _ = !0,
2369
- compact: H = !1,
2370
- stickyHeader: C = !1,
2371
- tableRef: O,
2469
+ headerClassName: F = "",
2470
+ rowClassName: w,
2471
+ headerActions: T,
2472
+ showHeader: P = !0,
2473
+ bordered: H = !0,
2474
+ striped: N = !1,
2475
+ hoverable: U = !0,
2476
+ compact: G = !1,
2477
+ stickyHeader: R = !1,
2478
+ tableRef: V,
2372
2479
  // Internationalization & Features
2373
- dir: I,
2374
- locale: V = "en",
2375
- messages: ue,
2376
- exportable: re = !1,
2377
- resizableColumns: je = !1,
2480
+ dir: C,
2481
+ locale: J = "en",
2482
+ messages: se,
2483
+ exportable: ce = !1,
2484
+ resizableColumns: Ne = !1,
2378
2485
  // Legacy Wasel Props
2379
- thead: ge,
2380
- headerData: me,
2381
- tbodys: fe,
2382
- titleHeader: Me,
2383
- add: De,
2384
- linkAdd: Le,
2385
- addHandler: se,
2386
- view: be,
2387
- linkView: pe,
2388
- viewHandler: ye,
2389
- edit: he,
2390
- linkEdit: xe,
2391
- editHandler: ae,
2392
- del: ke,
2393
- handleDelete: ve,
2394
- block: we,
2395
- handleBlock: Ee,
2396
- buttons: J
2397
- } = e, T = ce(), K = z(
2398
- () => Lr(V, ue),
2399
- [V, ue]
2400
- ), G = z(() => I === "ltr" || I === "rtl" ? I : V?.toLowerCase().startsWith("ar") ? "rtl" : "ltr", [I, V]), Ne = z(() => t || fe || void 0, [t, fe]), X = z(() => pt({
2401
- data: Ne,
2486
+ thead: Oe,
2487
+ headerData: Fe,
2488
+ tbodys: He,
2489
+ titleHeader: lt,
2490
+ add: it,
2491
+ linkAdd: dt,
2492
+ addHandler: ct,
2493
+ view: Se,
2494
+ linkView: Ke,
2495
+ viewHandler: Ae,
2496
+ edit: me,
2497
+ linkEdit: Ie,
2498
+ editHandler: Ue,
2499
+ del: Pe,
2500
+ handleDelete: Ve,
2501
+ block: Je,
2502
+ handleBlock: qe,
2503
+ buttons: xe
2504
+ } = e, _ = _e(), pe = D(
2505
+ () => Xr(J, se),
2506
+ [J, se]
2507
+ ), M = D(() => C === "ltr" || C === "rtl" ? C : J?.toLowerCase().startsWith("ar") ? "rtl" : "ltr", [C, J]), le = D(() => t || He || void 0, [t, He]), O = D(() => Ot({
2508
+ data: le,
2402
2509
  columns: s,
2403
2510
  autoColumns: i,
2404
- thead: ge,
2405
- headerData: me
2406
- }).filter((Y) => typeof Y.hidden == "function" ? !Y.hidden({ data: Ne || [] }) : !Y.hidden), [Ne, s, i, ge, me]), [Se, Tt] = R({}), $t = B(($, Y) => {
2407
- Tt((Z) => ({ ...Z, [$]: Y }));
2408
- }, []), Je = B(
2409
- ($, Y) => {
2511
+ thead: Oe,
2512
+ headerData: Fe
2513
+ }).filter((ae) => typeof ae.hidden == "function" ? !ae.hidden({ data: le || [] }) : !ae.hidden), [le, s, i, Oe, Fe]), [K, ee] = $({}), be = B((A, ae) => {
2514
+ ee((ke) => ({ ...ke, [A]: ae }));
2515
+ }, []), te = B(
2516
+ (A, ae) => {
2410
2517
  if (typeof a == "function")
2411
- return a($, Y);
2518
+ return a(A, ae);
2412
2519
  if (typeof a == "string") {
2413
- const Oe = j($, a);
2414
- if (Oe != null) return Oe;
2520
+ const X = L(A, a);
2521
+ if (X != null) return X;
2415
2522
  }
2416
- const Z = $?._id ?? $?.id ?? $?.key;
2417
- return Z ?? Y;
2523
+ const ke = A?._id ?? A?.id ?? A?.key;
2524
+ return ke ?? ae;
2418
2525
  },
2419
2526
  [a]
2420
2527
  ), {
2421
- enabled: Bt,
2422
- search: Ye,
2423
- debouncedSearch: Rt,
2424
- isDebouncing: zt,
2425
- setSearch: Ge,
2426
- clearSearch: qe,
2427
- searchConfig: jt
2428
- } = yt({ config: b }), {
2429
- enabled: Mt,
2430
- sortBy: We,
2431
- sortOrder: _e,
2432
- toggleSort: Dt,
2433
- setSorting: Lt,
2434
- resetSorting: Wt
2435
- } = ht({ config: g }), Xe = z(
2436
- () => Er({
2528
+ enabled: q,
2529
+ search: I,
2530
+ debouncedSearch: ye,
2531
+ isDebouncing: je,
2532
+ setSearch: Ce,
2533
+ clearSearch: Te,
2534
+ searchConfig: Re
2535
+ } = Ft({ config: p }), {
2536
+ enabled: ut,
2537
+ sortBy: re,
2538
+ sortOrder: ie,
2539
+ toggleSort: Xt,
2540
+ setSorting: Zt,
2541
+ resetSorting: Qt
2542
+ } = Ht({ config: c }), vt = D(
2543
+ () => Kr({
2437
2544
  explicitActions: d,
2438
- buttons: J,
2439
- block: we,
2440
- handleBlock: Ee,
2441
- view: be,
2442
- linkView: pe,
2443
- viewHandler: ye,
2444
- edit: he,
2445
- linkEdit: xe,
2446
- editHandler: ae,
2447
- del: ke,
2448
- handleDelete: ve
2545
+ buttons: xe,
2546
+ block: Je,
2547
+ handleBlock: qe,
2548
+ view: Se,
2549
+ linkView: Ke,
2550
+ viewHandler: Ae,
2551
+ edit: me,
2552
+ linkEdit: Ie,
2553
+ editHandler: Ue,
2554
+ del: Pe,
2555
+ handleDelete: Ve
2449
2556
  }),
2450
2557
  [
2451
2558
  d,
2452
- J,
2453
- we,
2454
- Ee,
2455
- be,
2456
- pe,
2457
- ye,
2458
- he,
2459
2559
  xe,
2460
- ae,
2461
- ke,
2462
- ve
2560
+ Je,
2561
+ qe,
2562
+ Se,
2563
+ Ke,
2564
+ Ae,
2565
+ me,
2566
+ Ie,
2567
+ Ue,
2568
+ Pe,
2569
+ Ve
2463
2570
  ]
2464
- ), _t = typeof m == "object" && m !== null && m.defaultPageSize ? m.defaultPageSize : 10, Ht = typeof m == "object" && m !== null && m.defaultPage ? m.defaultPage : 1, [Ft, Ot] = R(Ht), [It, Ut] = R(_t), Ze = z(() => typeof f == "object" && f !== null ? f.enabled !== !1 : !!f, [f]), ne = z(() => m !== void 0 ? m : !Ze, [Ze, m]), Vt = z(() => typeof ne == "object" && ne !== null ? ne.enabled !== !1 : !!ne, [ne]), {
2465
- rows: q,
2466
- totalRecords: He,
2467
- loading: Ce,
2468
- error: Ae,
2469
- refresh: le,
2470
- isServerMode: Kt
2471
- } = kt({
2472
- data: Ne,
2473
- api: o,
2474
- columns: X,
2475
- searchQuery: Rt,
2476
- sortBy: We,
2477
- sortOrder: _e,
2478
- page: Ft,
2479
- pageSize: It,
2480
- paginationEnabled: Vt,
2481
- manualLoading: M
2571
+ ), er = typeof g == "object" && g !== null && g.defaultPageSize ? g.defaultPageSize : 10, tr = typeof g == "object" && g !== null && g.defaultPage ? g.defaultPage : 1, [rr, ar] = $(tr), [nr, or] = $(er), Et = D(() => typeof f == "object" && f !== null ? f.enabled !== !1 : !!f, [f]), Be = D(() => g !== void 0 ? g : !Et, [Et, g]), sr = D(() => typeof Be == "object" && Be !== null ? Be.enabled !== !1 : !!Be, [Be]), {
2572
+ rows: Y,
2573
+ allFilteredRows: Ye,
2574
+ totalRecords: ge,
2575
+ loading: Ge,
2576
+ error: Xe,
2577
+ refresh: Me,
2578
+ isServerMode: Ze
2579
+ } = It({
2580
+ data: le,
2581
+ api: n,
2582
+ columns: O,
2583
+ searchQuery: ye,
2584
+ sortBy: re,
2585
+ sortOrder: ie,
2586
+ page: rr,
2587
+ pageSize: nr,
2588
+ paginationEnabled: sr,
2589
+ manualLoading: W
2482
2590
  }), {
2483
- enabled: Jt,
2484
- page: Pe,
2485
- pageSize: Fe,
2486
- totalPages: Qe,
2487
- pageSizeOptions: Yt,
2488
- setPage: Te,
2489
- setPageSize: et,
2490
- resetPagination: Gt,
2491
- getPageWindow: qt,
2492
- paginationConfig: tt
2493
- } = xt({
2494
- config: ne,
2495
- totalRecords: He,
2496
- onPageChange: ($, Y) => {
2497
- Ot($), Ut(Y);
2591
+ enabled: lr,
2592
+ page: Qe,
2593
+ pageSize: mt,
2594
+ totalPages: Nt,
2595
+ pageSizeOptions: ir,
2596
+ setPage: et,
2597
+ setPageSize: St,
2598
+ resetPagination: dr,
2599
+ getPageWindow: cr,
2600
+ paginationConfig: At
2601
+ } = Kt({
2602
+ config: Be,
2603
+ totalRecords: ge,
2604
+ onPageChange: (A, ae) => {
2605
+ ar(A), or(ae);
2498
2606
  }
2499
- }), rt = oe(null), {
2500
- isVirtualized: Q,
2501
- paddingTop: Xt,
2502
- paddingBottom: Zt,
2503
- startIndex: Qt,
2504
- maxHeight: $e,
2505
- scrollToIndex: er,
2506
- sliceRows: at
2507
- } = zr({
2607
+ }), Pt = ve(null), {
2608
+ isVirtualized: he,
2609
+ paddingTop: ur,
2610
+ paddingBottom: mr,
2611
+ startIndex: gr,
2612
+ maxHeight: tt,
2613
+ scrollToIndex: fr,
2614
+ sliceRows: Ct
2615
+ } = Jr({
2508
2616
  config: f,
2509
- totalCount: q.length,
2510
- scrollContainerRef: rt
2511
- }), tr = z(() => Q ? at(q) : q, [Q, q, at]), {
2512
- selectedKeys: nt,
2513
- selectedRows: Be,
2514
- onToggleSelectRow: rr,
2515
- handleToggleSelectAll: ar,
2516
- clearSelection: nr,
2517
- allSelected: or,
2518
- isIndeterminate: sr
2519
- } = vt({
2520
- rows: q,
2521
- rowKeyResolver: Je,
2522
- onSelectionChange: w
2523
- }), lr = z(
2617
+ totalCount: Y.length,
2618
+ scrollContainerRef: Pt
2619
+ }), pr = D(() => he ? Ct(Y) : Y, [he, Y, Ct]), {
2620
+ selectedKeys: rt,
2621
+ selectedRows: ue,
2622
+ onToggleSelectRow: br,
2623
+ handleToggleSelectAll: yr,
2624
+ clearSelection: xr,
2625
+ allSelected: hr,
2626
+ isIndeterminate: kr
2627
+ } = Ut({
2628
+ rows: Y,
2629
+ rowKeyResolver: te,
2630
+ onSelectionChange: S
2631
+ }), wr = D(
2524
2632
  () => ({
2525
- refresh: le,
2526
- loading: Ce,
2527
- page: Pe,
2528
- selectedRows: Be,
2529
- setPage: Te
2633
+ refresh: Me,
2634
+ loading: Ge,
2635
+ page: Qe,
2636
+ selectedRows: ue,
2637
+ setPage: et
2530
2638
  }),
2531
- [le, Ce, Pe, Be, Te]
2532
- ), ie = Xe.length > 0, ot = z(() => wr(X, {
2533
- selectable: x,
2534
- hasActions: ie,
2535
- actionsWidth: n,
2536
- columnWidths: Se,
2537
- isRtl: G === "rtl"
2639
+ [Me, Ge, Qe, ue, et]
2640
+ ), De = vt.length > 0, Tt = D(() => Hr(O, {
2641
+ selectable: b,
2642
+ hasActions: De,
2643
+ actionsWidth: o,
2644
+ columnWidths: K,
2645
+ isRtl: M === "rtl"
2538
2646
  }), [
2539
- X,
2540
- x,
2541
- ie,
2542
- n,
2543
- Se,
2544
- G
2545
- ]), st = B(
2546
- ($ = "csv", Y) => {
2547
- const Z = typeof re == "object" && re?.filename || Y || (typeof l == "string" ? l.toLowerCase().replace(/\s+/g, "-") : "table-export");
2548
- $ === "json" ? Pt(q, Z) : At(q, X, Z);
2647
+ O,
2648
+ b,
2649
+ De,
2650
+ o,
2651
+ K,
2652
+ M
2653
+ ]), [gt, at] = $(!1), Rt = B(
2654
+ async (A = "csv", ae, ke) => {
2655
+ const X = typeof ce == "object" ? ce : {}, de = X.filename || ae || (typeof l == "string" ? l.toLowerCase().replace(/\s+/g, "-") : "table-export");
2656
+ let $e = ke || X.scope || "auto";
2657
+ if ($e === "auto" && (Ze ? $e = X.fetchAllRows || X.onExport ? "all" : "current-page" : $e = "all"), typeof X.onExport == "function") {
2658
+ at(!0);
2659
+ try {
2660
+ const fe = {
2661
+ format: A,
2662
+ scope: $e,
2663
+ search: I,
2664
+ sortBy: re,
2665
+ sortOrder: ie,
2666
+ params: n?.params,
2667
+ currentPageRows: Y,
2668
+ selectedRows: ue,
2669
+ selectedKeys: Array.from(rt),
2670
+ totalRecords: ge,
2671
+ columns: O,
2672
+ defaultExport: (Z, Le) => {
2673
+ const ze = Le || de;
2674
+ A === "json" ? oe(Z, ze) : ne(Z, O, ze);
2675
+ }
2676
+ };
2677
+ await X.onExport(A, fe);
2678
+ } finally {
2679
+ at(!1);
2680
+ }
2681
+ return;
2682
+ }
2683
+ if ($e === "selected" && ue.length > 0) {
2684
+ A === "json" ? oe(ue, de) : ne(ue, O, de);
2685
+ return;
2686
+ }
2687
+ if ($e === "current-page") {
2688
+ A === "json" ? oe(Y, de) : ne(Y, O, de);
2689
+ return;
2690
+ }
2691
+ if (!Ze) {
2692
+ const fe = Ye && Ye.length > 0 ? Ye : Y;
2693
+ A === "json" ? oe(fe, de) : ne(fe, O, de);
2694
+ return;
2695
+ }
2696
+ if (X.fetchAllRows) {
2697
+ at(!0);
2698
+ try {
2699
+ let fe = [];
2700
+ if (typeof X.fetchAllRows == "function") {
2701
+ const Z = n?.paramNames || {}, Le = Z.pageParam || "page", ze = Z.pageSizeParam || "limit", ft = Z.searchParam || "q", pt = Z.sortByParam || "sortBy", bt = Z.sortOrderParam || "sortOrder", nt = {
2702
+ [Le]: 1,
2703
+ [ze]: ge || 999999,
2704
+ page: 1,
2705
+ pageSize: ge || 999999,
2706
+ ...I ? { [ft]: I, search: I, q: I } : {},
2707
+ ...re ? { [pt]: re, sortBy: re } : {},
2708
+ ...ie ? { [bt]: ie, sortOrder: ie } : {},
2709
+ ...n?.params || {},
2710
+ all: !0
2711
+ };
2712
+ fe = await X.fetchAllRows(nt);
2713
+ } else if (X.fetchAllRows === !0 && n?.fetcher) {
2714
+ const Z = n.paramNames || {}, Le = Z.pageParam || "page", ze = Z.pageSizeParam || "limit", ft = Z.searchParam || "q", pt = Z.sortByParam || "sortBy", bt = Z.sortOrderParam || "sortOrder", nt = {
2715
+ [Le]: 1,
2716
+ [ze]: ge || 999999,
2717
+ page: 1,
2718
+ pageSize: ge || 999999,
2719
+ ...I ? { [ft]: I, search: I, q: I } : {},
2720
+ ...re ? { [pt]: re, sortBy: re } : {},
2721
+ ...ie ? { [bt]: ie, sortOrder: ie } : {},
2722
+ ...n.params || {},
2723
+ all: !0
2724
+ }, Sr = await n.fetcher(nt);
2725
+ fe = wt(Sr, n, nt).data;
2726
+ }
2727
+ A === "json" ? oe(fe, de) : ne(fe, O, de);
2728
+ } finally {
2729
+ at(!1);
2730
+ }
2731
+ return;
2732
+ }
2733
+ console.warn(
2734
+ "AnyTable: Exporting current page only. For server-side pagination, configure 'exportable.fetchAllRows' or 'exportable.onExport' to fetch all filtered records."
2735
+ ), A === "json" ? oe(Y, de) : ne(Y, O, de);
2549
2736
  },
2550
- [q, X, re, l]
2737
+ [
2738
+ ce,
2739
+ l,
2740
+ Ze,
2741
+ I,
2742
+ re,
2743
+ ie,
2744
+ n,
2745
+ Y,
2746
+ Ye,
2747
+ ue,
2748
+ rt,
2749
+ ge,
2750
+ O
2751
+ ]
2551
2752
  );
2552
- Rr({
2553
- tableRef: O,
2554
- refresh: le,
2555
- resetPagination: Gt,
2556
- resetSearch: qe,
2557
- resetSorting: Wt,
2558
- setPage: Te,
2559
- setPageSize: et,
2560
- setSearch: Ge,
2561
- setSorting: Lt,
2562
- selectedRows: Be,
2563
- clearSelection: nr,
2564
- scrollToIndex: er,
2565
- exportData: st,
2753
+ Vr({
2754
+ tableRef: V,
2755
+ refresh: Me,
2756
+ resetPagination: dr,
2757
+ resetSearch: Te,
2758
+ resetSorting: Qt,
2759
+ setPage: et,
2760
+ setPageSize: St,
2761
+ setSearch: Ce,
2762
+ setSorting: Zt,
2763
+ selectedRows: ue,
2764
+ clearSelection: xr,
2765
+ scrollToIndex: fr,
2766
+ exportData: Rt,
2767
+ isExporting: gt,
2566
2768
  getState: () => ({
2567
- data: q,
2568
- loading: Ce,
2569
- error: Ae,
2570
- page: Pe,
2571
- pageSize: Fe,
2572
- total: He,
2573
- totalPages: Qe,
2574
- search: Ye,
2575
- sortBy: We,
2576
- sortOrder: _e,
2577
- selectedRowKeys: Array.from(nt),
2578
- selectedRows: Be,
2579
- isServerMode: Kt
2769
+ data: Y,
2770
+ loading: Ge,
2771
+ error: Xe,
2772
+ page: Qe,
2773
+ pageSize: mt,
2774
+ total: ge,
2775
+ totalPages: Nt,
2776
+ search: I,
2777
+ sortBy: re,
2778
+ sortOrder: ie,
2779
+ selectedRowKeys: Array.from(rt),
2780
+ selectedRows: ue,
2781
+ isServerMode: Ze,
2782
+ isExporting: gt
2580
2783
  })
2581
2784
  });
2582
- const ir = l || Me, dr = z(() => {
2583
- const $ = {};
2584
- return T.borderRadius && ($["--any-table-radius"] = T.borderRadius), T.fontFamily && ($["--any-table-font"] = T.fontFamily, $.fontFamily = T.fontFamily), T.colors?.primary && ($["--any-table-primary"] = T.colors.primary), T.colors?.primaryHover && ($["--any-table-primary-hover"] = T.colors.primaryHover), T.colors?.border && ($["--any-table-border"] = T.colors.border), $;
2585
- }, [T]), cr = z(() => {
2586
- const $ = {};
2587
- return T.borderRadius && ($.borderRadius = T.borderRadius), Q && ($.maxHeight = typeof $e == "number" ? `${$e}px` : $e, $.overflowY = "auto", $.position = "relative"), $;
2588
- }, [T.borderRadius, Q, $e]);
2785
+ const vr = l || lt, Er = D(() => {
2786
+ const A = {};
2787
+ return _.borderRadius && (A["--any-table-radius"] = _.borderRadius), _.fontFamily && (A["--any-table-font"] = _.fontFamily, A.fontFamily = _.fontFamily), _.colors?.primary && (A["--any-table-primary"] = _.colors.primary), _.colors?.primaryHover && (A["--any-table-primary-hover"] = _.colors.primaryHover), _.colors?.border && (A["--any-table-border"] = _.colors.border), A;
2788
+ }, [_]), Nr = D(() => {
2789
+ const A = {};
2790
+ return _.borderRadius && (A.borderRadius = _.borderRadius), he && (A.maxHeight = typeof tt == "number" ? `${tt}px` : tt, A.overflowY = "auto", A.position = "relative"), A;
2791
+ }, [_.borderRadius, he, tt]);
2589
2792
  return /* @__PURE__ */ r.createElement(
2590
2793
  "div",
2591
2794
  {
2592
- dir: G,
2593
- lang: V,
2594
- style: dr,
2595
- className: `any-table-wrapper ${T.classes?.container || "w-full flex flex-col gap-4 font-sans text-gray-900 dark:text-gray-100"} ${D}`
2795
+ dir: M,
2796
+ lang: J,
2797
+ style: Er,
2798
+ className: `any-table-wrapper ${_.classes?.container || "w-full flex flex-col gap-4 font-sans text-gray-900 dark:text-gray-100"} ${j}`
2596
2799
  },
2597
2800
  /* @__PURE__ */ r.createElement(
2598
- Wr,
2801
+ Zr,
2599
2802
  {
2600
- displayTitle: ir,
2601
- subtitle: u,
2602
- isSearchEnabled: Bt,
2603
- searchQuery: Ye,
2604
- setSearch: Ge,
2605
- clearSearch: qe,
2606
- isDebouncing: zt,
2607
- searchPlaceholder: jt.placeholder,
2608
- headerActions: A,
2609
- add: De,
2610
- linkAdd: Le,
2611
- addHandler: se,
2612
- messages: K,
2613
- exportable: re,
2614
- onExport: st,
2615
- dir: G
2803
+ displayTitle: vr,
2804
+ subtitle: m,
2805
+ isSearchEnabled: q,
2806
+ searchQuery: I,
2807
+ setSearch: Ce,
2808
+ clearSearch: Te,
2809
+ isDebouncing: je,
2810
+ searchPlaceholder: Re.placeholder,
2811
+ headerActions: T,
2812
+ add: it,
2813
+ linkAdd: dt,
2814
+ addHandler: ct,
2815
+ messages: pe,
2816
+ exportable: ce,
2817
+ onExport: Rt,
2818
+ isExporting: gt,
2819
+ hasSelectedRows: ue.length > 0,
2820
+ dir: M
2616
2821
  }
2617
2822
  ),
2618
2823
  /* @__PURE__ */ r.createElement(
2619
2824
  "div",
2620
2825
  {
2621
- ref: rt,
2622
- style: cr,
2623
- className: `${T.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"} ${F ? "" : "border-0 shadow-none"}`
2826
+ ref: Pt,
2827
+ style: Nr,
2828
+ className: `${_.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"} ${H ? "" : "border-0 shadow-none"}`
2624
2829
  },
2625
- Ae ? typeof N == "function" ? N(Ae, le) : N || /* @__PURE__ */ r.createElement(
2626
- la,
2830
+ Xe ? typeof h == "function" ? h(Xe, Me) : h || /* @__PURE__ */ r.createElement(
2831
+ wa,
2627
2832
  {
2628
- error: Ae,
2629
- onRetry: le,
2630
- messages: K
2833
+ error: Xe,
2834
+ onRetry: Me,
2835
+ messages: pe
2631
2836
  }
2632
2837
  ) : /* @__PURE__ */ r.createElement(
2633
2838
  "table",
2634
2839
  {
2635
- className: `${T.classes?.table || "w-full border-collapse text-left rtl:text-right text-sm"} ${H || T.density === "compact" ? "text-xs" : ""} ${C || Q ? "relative" : ""} ${v}`
2840
+ className: `${_.classes?.table || "w-full border-collapse text-left rtl:text-right text-sm"} ${G || _.density === "compact" ? "text-xs" : ""} ${R || he ? "relative" : ""} ${v}`
2636
2841
  },
2637
- W && /* @__PURE__ */ r.createElement(
2638
- _r,
2842
+ P && /* @__PURE__ */ r.createElement(
2843
+ Qr,
2639
2844
  {
2640
- columns: X,
2641
- hasActions: ie,
2642
- actionsTitle: c,
2643
- actionsWidth: n,
2644
- sortBy: We,
2645
- sortOrder: _e,
2646
- onSort: Mt ? Dt : void 0,
2647
- selectable: x,
2648
- allSelected: or,
2649
- isIndeterminate: sr,
2650
- onToggleSelectAll: ar,
2651
- headerClassName: L,
2652
- sticky: C || Q,
2653
- messages: K,
2654
- dir: G,
2655
- resizableColumns: je,
2656
- columnWidths: Se,
2657
- onResizeColumn: $t,
2658
- pinnedStyles: ot
2845
+ columns: O,
2846
+ hasActions: De,
2847
+ actionsTitle: u,
2848
+ actionsWidth: o,
2849
+ sortBy: re,
2850
+ sortOrder: ie,
2851
+ onSort: ut ? Xt : void 0,
2852
+ selectable: b,
2853
+ allSelected: hr,
2854
+ isIndeterminate: kr,
2855
+ onToggleSelectAll: yr,
2856
+ headerClassName: F,
2857
+ sticky: R || he,
2858
+ messages: pe,
2859
+ dir: M,
2860
+ resizableColumns: Ne,
2861
+ columnWidths: K,
2862
+ onResizeColumn: be,
2863
+ pinnedStyles: Tt
2659
2864
  }
2660
2865
  ),
2661
- Ce && q.length === 0 ? E || /* @__PURE__ */ r.createElement(
2662
- oa,
2866
+ Ge && Y.length === 0 ? E || /* @__PURE__ */ r.createElement(
2867
+ ha,
2663
2868
  {
2664
- columnsCount: X.length + (x ? 1 : 0) + (ie ? 1 : 0),
2665
- rowsCount: Fe || 5
2869
+ columnsCount: O.length + (b ? 1 : 0) + (De ? 1 : 0),
2870
+ rowsCount: mt || 5
2666
2871
  }
2667
- ) : q.length === 0 ? (
2872
+ ) : Y.length === 0 ? (
2668
2873
  // Empty State
2669
- p || /* @__PURE__ */ r.createElement(
2670
- sa,
2874
+ y || /* @__PURE__ */ r.createElement(
2875
+ ka,
2671
2876
  {
2672
- title: y,
2877
+ title: x,
2673
2878
  description: k,
2674
- colSpan: X.length + (x ? 1 : 0) + (ie ? 1 : 0),
2675
- messages: K
2879
+ colSpan: O.length + (b ? 1 : 0) + (De ? 1 : 0),
2880
+ messages: pe
2676
2881
  }
2677
2882
  )
2678
2883
  ) : (
2679
2884
  // Table Body
2680
2885
  /* @__PURE__ */ r.createElement(
2681
- aa,
2886
+ ya,
2682
2887
  {
2683
- rows: tr,
2684
- columns: X,
2685
- actions: Xe,
2686
- actionContext: lr,
2687
- rowKeyResolver: Je,
2688
- selectable: x,
2689
- selectedKeys: nt,
2690
- onToggleSelectRow: rr,
2691
- onRowClick: P,
2692
- striped: S,
2693
- hoverable: _,
2694
- rowClassName: h,
2695
- isVirtualized: Q,
2696
- paddingTop: Xt,
2697
- paddingBottom: Zt,
2698
- startIndex: Qt,
2699
- pinnedStyles: ot,
2700
- columnWidths: Se,
2701
- dir: G,
2702
- actionsWidth: n,
2703
- messages: K
2888
+ rows: pr,
2889
+ columns: O,
2890
+ actions: vt,
2891
+ actionContext: wr,
2892
+ rowKeyResolver: te,
2893
+ selectable: b,
2894
+ selectedKeys: rt,
2895
+ onToggleSelectRow: br,
2896
+ onRowClick: z,
2897
+ striped: N,
2898
+ hoverable: U,
2899
+ rowClassName: w,
2900
+ isVirtualized: he,
2901
+ paddingTop: ur,
2902
+ paddingBottom: mr,
2903
+ startIndex: gr,
2904
+ pinnedStyles: Tt,
2905
+ columnWidths: K,
2906
+ dir: M,
2907
+ actionsWidth: o,
2908
+ messages: pe
2704
2909
  }
2705
2910
  )
2706
2911
  )
2707
2912
  )
2708
2913
  ),
2709
- Jt && /* @__PURE__ */ r.createElement(
2710
- na,
2914
+ lr && /* @__PURE__ */ r.createElement(
2915
+ xa,
2711
2916
  {
2712
- page: Pe,
2713
- pageSize: Fe,
2714
- totalRecords: He,
2715
- totalPages: Qe,
2716
- pageSizeOptions: Yt,
2717
- onPageChange: Te,
2718
- onPageSizeChange: et,
2719
- showPageSizeSelector: tt.showPageSizeSelector,
2720
- showTotalCount: tt.showTotalCount,
2721
- pageWindow: qt(5),
2722
- messages: K,
2723
- dir: G
2917
+ page: Qe,
2918
+ pageSize: mt,
2919
+ totalRecords: ge,
2920
+ totalPages: Nt,
2921
+ pageSizeOptions: ir,
2922
+ onPageChange: et,
2923
+ onPageSizeChange: St,
2924
+ showPageSizeSelector: At.showPageSizeSelector,
2925
+ showTotalCount: At.showTotalCount,
2926
+ pageWindow: cr(5),
2927
+ messages: pe,
2928
+ dir: M
2724
2929
  }
2725
2930
  )
2726
2931
  );
2727
2932
  }
2728
- const ca = r.forwardRef(function(t, o) {
2729
- const s = o || t.tableRef;
2730
- return !t.theme && !t.preset ? /* @__PURE__ */ r.createElement(mt, { ...t, tableRef: s }) : /* @__PURE__ */ r.createElement(jr, { theme: t.theme, preset: t.preset }, /* @__PURE__ */ r.createElement(mt, { ...t, tableRef: s }));
2933
+ const Sa = r.forwardRef(function(t, n) {
2934
+ const s = n || t.tableRef;
2935
+ return !t.theme && !t.preset ? /* @__PURE__ */ r.createElement(Lt, { ...t, tableRef: s }) : /* @__PURE__ */ r.createElement(qr, { theme: t.theme, preset: t.preset }, /* @__PURE__ */ r.createElement(Lt, { ...t, tableRef: s }));
2731
2936
  });
2732
- function ua(e = {}) {
2937
+ function Aa(e = {}) {
2733
2938
  const {
2734
2939
  data: t,
2735
- api: o,
2940
+ api: n,
2736
2941
  columns: s,
2737
2942
  autoColumns: i = !0,
2738
2943
  rowKey: a,
2739
2944
  search: l = !0,
2740
- sorting: u = !0,
2945
+ sorting: m = !0,
2741
2946
  pagination: d = !0,
2742
- manualLoading: c,
2743
- onSelectionChange: n,
2744
- exportable: b
2745
- } = e, g = z(() => pt({
2947
+ manualLoading: u,
2948
+ onSelectionChange: o,
2949
+ exportable: p
2950
+ } = e, c = D(() => Ot({
2746
2951
  data: t,
2747
2952
  columns: s,
2748
2953
  autoColumns: i
2749
- }), [t, s, i]), m = B(
2750
- (J, T) => {
2954
+ }), [t, s, i]), g = B(
2955
+ (M, le) => {
2751
2956
  if (typeof a == "function")
2752
- return a(J, T);
2957
+ return a(M, le);
2753
2958
  if (typeof a == "string") {
2754
- const G = j(J, a);
2755
- if (G != null) return G;
2959
+ const K = L(M, a);
2960
+ if (K != null) return K;
2756
2961
  }
2757
- const K = J?._id ?? J?.id ?? J?.key;
2758
- return K ?? T;
2962
+ const O = M?._id ?? M?.id ?? M?.key;
2963
+ return O ?? le;
2759
2964
  },
2760
2965
  [a]
2761
2966
  ), {
2762
2967
  enabled: f,
2763
- search: x,
2764
- debouncedSearch: w,
2765
- isDebouncing: P,
2766
- setSearch: M,
2968
+ search: b,
2969
+ debouncedSearch: S,
2970
+ isDebouncing: z,
2971
+ setSearch: W,
2767
2972
  clearSearch: E,
2768
- searchConfig: p
2769
- } = yt({ config: l }), {
2770
- enabled: y,
2973
+ searchConfig: y
2974
+ } = Ft({ config: l }), {
2975
+ enabled: x,
2771
2976
  sortBy: k,
2772
- sortOrder: N,
2773
- toggleSort: D,
2977
+ sortOrder: h,
2978
+ toggleSort: j,
2774
2979
  setSorting: v,
2775
- resetSorting: L
2776
- } = ht({ config: u }), h = typeof d == "object" && d !== null && d.defaultPageSize ? d.defaultPageSize : 10, A = typeof d == "object" && d !== null && d.defaultPage ? d.defaultPage : 1, [W, F] = R(A), [S, _] = R(h), H = z(() => typeof d == "object" && d !== null ? d.enabled !== !1 : !!d, [d]), {
2777
- rows: C,
2778
- totalRecords: O,
2779
- loading: I,
2780
- error: V,
2781
- refresh: ue,
2782
- isServerMode: re
2783
- } = kt({
2980
+ resetSorting: F
2981
+ } = Ht({ config: m }), w = typeof d == "object" && d !== null && d.defaultPageSize ? d.defaultPageSize : 10, T = typeof d == "object" && d !== null && d.defaultPage ? d.defaultPage : 1, [P, H] = $(T), [N, U] = $(w), G = D(() => typeof d == "object" && d !== null ? d.enabled !== !1 : !!d, [d]), {
2982
+ rows: R,
2983
+ allFilteredRows: V,
2984
+ totalRecords: C,
2985
+ loading: J,
2986
+ error: se,
2987
+ refresh: ce,
2988
+ isServerMode: Ne
2989
+ } = It({
2784
2990
  data: t,
2785
- api: o,
2786
- columns: g,
2787
- searchQuery: w,
2991
+ api: n,
2992
+ columns: c,
2993
+ searchQuery: S,
2788
2994
  sortBy: k,
2789
- sortOrder: N,
2790
- page: W,
2791
- pageSize: S,
2792
- paginationEnabled: H,
2793
- manualLoading: c
2995
+ sortOrder: h,
2996
+ page: P,
2997
+ pageSize: N,
2998
+ paginationEnabled: G,
2999
+ manualLoading: u
2794
3000
  }), {
2795
- enabled: je,
2796
- page: ge,
2797
- pageSize: me,
2798
- totalPages: fe,
2799
- pageSizeOptions: Me,
2800
- setPage: De,
2801
- setPageSize: Le,
2802
- resetPagination: se,
2803
- getPageWindow: be
2804
- } = xt({
3001
+ enabled: Oe,
3002
+ page: Fe,
3003
+ pageSize: He,
3004
+ totalPages: lt,
3005
+ pageSizeOptions: it,
3006
+ setPage: dt,
3007
+ setPageSize: ct,
3008
+ resetPagination: Se,
3009
+ getPageWindow: Ke
3010
+ } = Kt({
2805
3011
  config: d,
2806
- totalRecords: O,
2807
- onPageChange: (J, T) => {
2808
- F(J), _(T);
3012
+ totalRecords: C,
3013
+ onPageChange: (M, le) => {
3014
+ H(M), U(le);
2809
3015
  }
2810
3016
  }), {
2811
- selectedKeys: pe,
2812
- selectedRows: ye,
2813
- onToggleSelectRow: he,
2814
- handleToggleSelectAll: xe,
2815
- clearSelection: ae,
2816
- allSelected: ke,
2817
- isIndeterminate: ve
2818
- } = vt({
2819
- rows: C,
2820
- rowKeyResolver: m,
2821
- onSelectionChange: n
2822
- }), we = B(
2823
- (J = "csv", T) => {
2824
- const K = typeof b == "object" && b?.filename || T || "table-export";
2825
- J === "json" ? Pt(C, K) : At(C, g, K);
3017
+ selectedKeys: Ae,
3018
+ selectedRows: me,
3019
+ onToggleSelectRow: Ie,
3020
+ handleToggleSelectAll: Ue,
3021
+ clearSelection: Pe,
3022
+ allSelected: Ve,
3023
+ isIndeterminate: Je
3024
+ } = Ut({
3025
+ rows: R,
3026
+ rowKeyResolver: g,
3027
+ onSelectionChange: o
3028
+ }), [qe, xe] = $(!1), _ = B(
3029
+ async (M = "csv", le, O) => {
3030
+ const K = typeof p == "object" ? p : {}, ee = K.filename || le || "table-export";
3031
+ let be = O || K.scope || "auto";
3032
+ if (be === "auto" && (Ne ? be = K.fetchAllRows || K.onExport ? "all" : "current-page" : be = "all"), typeof K.onExport == "function") {
3033
+ xe(!0);
3034
+ try {
3035
+ const te = {
3036
+ format: M,
3037
+ scope: be,
3038
+ search: b,
3039
+ sortBy: k,
3040
+ sortOrder: h,
3041
+ params: n?.params,
3042
+ currentPageRows: R,
3043
+ selectedRows: me,
3044
+ selectedKeys: Array.from(Ae),
3045
+ totalRecords: C,
3046
+ columns: c,
3047
+ defaultExport: (q, I) => {
3048
+ const ye = I || ee;
3049
+ M === "json" ? oe(q, ye) : ne(q, c, ye);
3050
+ }
3051
+ };
3052
+ await K.onExport(M, te);
3053
+ } finally {
3054
+ xe(!1);
3055
+ }
3056
+ return;
3057
+ }
3058
+ if (be === "selected" && me.length > 0) {
3059
+ M === "json" ? oe(me, ee) : ne(me, c, ee);
3060
+ return;
3061
+ }
3062
+ if (be === "current-page") {
3063
+ M === "json" ? oe(R, ee) : ne(R, c, ee);
3064
+ return;
3065
+ }
3066
+ if (!Ne) {
3067
+ const te = V && V.length > 0 ? V : R;
3068
+ M === "json" ? oe(te, ee) : ne(te, c, ee);
3069
+ return;
3070
+ }
3071
+ if (K.fetchAllRows) {
3072
+ xe(!0);
3073
+ try {
3074
+ let te = [];
3075
+ if (typeof K.fetchAllRows == "function") {
3076
+ const q = n?.paramNames || {}, I = q.pageParam || "page", ye = q.pageSizeParam || "limit", je = q.searchParam || "q", Ce = q.sortByParam || "sortBy", Te = q.sortOrderParam || "sortOrder", Re = {
3077
+ [I]: 1,
3078
+ [ye]: C || 999999,
3079
+ page: 1,
3080
+ pageSize: C || 999999,
3081
+ ...b ? { [je]: b, search: b, q: b } : {},
3082
+ ...k ? { [Ce]: k, sortBy: k } : {},
3083
+ ...h ? { [Te]: h, sortOrder: h } : {},
3084
+ ...n?.params || {},
3085
+ all: !0
3086
+ };
3087
+ te = await K.fetchAllRows(Re);
3088
+ } else if (K.fetchAllRows === !0 && n?.fetcher) {
3089
+ const q = n.paramNames || {}, I = q.pageParam || "page", ye = q.pageSizeParam || "limit", je = q.searchParam || "q", Ce = q.sortByParam || "sortBy", Te = q.sortOrderParam || "sortOrder", Re = {
3090
+ [I]: 1,
3091
+ [ye]: C || 999999,
3092
+ page: 1,
3093
+ pageSize: C || 999999,
3094
+ ...b ? { [je]: b, search: b, q: b } : {},
3095
+ ...k ? { [Ce]: k, sortBy: k } : {},
3096
+ ...h ? { [Te]: h, sortOrder: h } : {},
3097
+ ...n.params || {},
3098
+ all: !0
3099
+ }, ut = await n.fetcher(Re);
3100
+ te = wt(ut, n, Re).data;
3101
+ }
3102
+ M === "json" ? oe(te, ee) : ne(te, c, ee);
3103
+ } finally {
3104
+ xe(!1);
3105
+ }
3106
+ return;
3107
+ }
3108
+ console.warn(
3109
+ "AnyTable: Exporting current page only. For server-side pagination, configure 'exportable.fetchAllRows' or 'exportable.onExport' to fetch all filtered records."
3110
+ ), M === "json" ? oe(R, ee) : ne(R, c, ee);
2826
3111
  },
2827
- [C, g, b]
2828
- ), Ee = B(() => {
2829
- se(), E(), L(), ae();
2830
- }, [se, E, L, ae]);
3112
+ [
3113
+ p,
3114
+ Ne,
3115
+ b,
3116
+ k,
3117
+ h,
3118
+ n,
3119
+ R,
3120
+ V,
3121
+ me,
3122
+ Ae,
3123
+ C,
3124
+ c
3125
+ ]
3126
+ ), pe = B(() => {
3127
+ Se(), E(), F(), Pe();
3128
+ }, [Se, E, F, Pe]);
2831
3129
  return {
2832
- rows: C,
2833
- columns: g,
2834
- totalRecords: O,
2835
- loading: I,
2836
- error: V,
2837
- isServerMode: re,
2838
- refresh: ue,
2839
- reset: Ee,
3130
+ rows: R,
3131
+ columns: c,
3132
+ totalRecords: C,
3133
+ loading: J,
3134
+ error: se,
3135
+ isServerMode: Ne,
3136
+ isExporting: qe,
3137
+ refresh: ce,
3138
+ reset: pe,
2840
3139
  search: {
2841
3140
  enabled: f,
2842
- query: x,
2843
- isDebouncing: P,
2844
- setSearch: M,
3141
+ query: b,
3142
+ isDebouncing: z,
3143
+ setSearch: W,
2845
3144
  clearSearch: E,
2846
- placeholder: p.placeholder
3145
+ placeholder: y.placeholder
2847
3146
  },
2848
3147
  sorting: {
2849
- enabled: y,
3148
+ enabled: x,
2850
3149
  sortBy: k,
2851
- sortOrder: N,
2852
- toggleSort: D,
3150
+ sortOrder: h,
3151
+ toggleSort: j,
2853
3152
  setSorting: v,
2854
- resetSorting: L
3153
+ resetSorting: F
2855
3154
  },
2856
3155
  pagination: {
2857
- enabled: je,
2858
- page: ge,
2859
- pageSize: me,
2860
- totalPages: fe,
2861
- pageSizeOptions: Me,
2862
- setPage: De,
2863
- setPageSize: Le,
2864
- resetPagination: se,
2865
- getPageWindow: be
3156
+ enabled: Oe,
3157
+ page: Fe,
3158
+ pageSize: He,
3159
+ totalPages: lt,
3160
+ pageSizeOptions: it,
3161
+ setPage: dt,
3162
+ setPageSize: ct,
3163
+ resetPagination: Se,
3164
+ getPageWindow: Ke
2866
3165
  },
2867
3166
  selection: {
2868
- selectedKeys: pe,
2869
- selectedRows: ye,
2870
- toggleSelectRow: he,
2871
- toggleSelectAll: xe,
2872
- clearSelection: ae,
2873
- allSelected: ke,
2874
- isIndeterminate: ve
3167
+ selectedKeys: Ae,
3168
+ selectedRows: me,
3169
+ toggleSelectRow: Ie,
3170
+ toggleSelectAll: Ue,
3171
+ clearSelection: Pe,
3172
+ allSelected: Ve,
3173
+ isIndeterminate: Je
2875
3174
  },
2876
- exportData: we
3175
+ exportData: _
2877
3176
  };
2878
3177
  }
2879
3178
  export {
2880
- ra as ActionRenderer,
2881
- ca as AnyTable,
2882
- mt as AnyTableInner,
2883
- jr as AnyTableThemeProvider,
2884
- Kr as ArrayRenderer,
2885
- Qr as BadgeRenderer,
2886
- Fr as BooleanRenderer,
2887
- ea as CellRenderer,
2888
- ta as ConfirmModal,
2889
- Or as CurrencyRenderer,
2890
- wt as DEFAULT_THEME_COLORS,
2891
- ct as DateRenderer,
2892
- Gr as EmailRenderer,
2893
- U as FallbackPlaceholder,
2894
- Ir as ImageRenderer,
2895
- Hr as NumberRenderer,
2896
- Jr as ObjectRenderer,
2897
- qr as PhoneRenderer,
2898
- Xr as ProgressRenderer,
2899
- Zr as RatingRenderer,
2900
- Vr as StatusRenderer,
2901
- Nt as StringRenderer,
2902
- dt as TABLE_PRESETS,
2903
- aa as TableBody,
2904
- sa as TableEmptyState,
2905
- la as TableErrorState,
2906
- _r as TableHeader,
2907
- na as TablePagination,
2908
- Mr as TableSearch,
2909
- oa as TableSkeleton,
2910
- Wr as TableToolbar,
2911
- Yr as UrlRenderer,
2912
- Dr as arMessages,
2913
- wr as computePinnedStyles,
2914
- ca as default,
2915
- Et as defaultAnyTableTheme,
2916
- te as enMessages,
2917
- Ue as escapeCsvValue,
2918
- At as exportToCsv,
2919
- Pt as exportToJson,
2920
- de as extractPaginationMeta,
2921
- $r as filterRowsBySearch,
2922
- kr as generateAutoColumns,
2923
- ia as generateCsvContent,
2924
- j as getNestedValue,
2925
- ze as inferColumnType,
2926
- lt as isImageUrl,
2927
- hr as isIsoDate,
2928
- mr as isPlainObject,
2929
- Tr as normalizeApiResponse,
2930
- Ie as parsePixelWidth,
2931
- St as renderActionIcon,
2932
- pt as resolveColumns,
2933
- Lr as resolveMessages,
2934
- Er as resolveTableActions,
2935
- Br as sortRows,
2936
- Re as toTitleCase,
2937
- Ct as triggerDownload,
2938
- ua as useAnyTable,
2939
- Rr as useAnyTableController,
2940
- kt as useAnyTableData,
2941
- xt as useAnyTablePagination,
2942
- yt as useAnyTableSearch,
2943
- vt as useAnyTableSelection,
2944
- ht as useAnyTableSorting,
2945
- ce as useAnyTableTheme,
2946
- zr as useAnyTableVirtualizer
3179
+ ba as ActionRenderer,
3180
+ Sa as AnyTable,
3181
+ Lt as AnyTableInner,
3182
+ qr as AnyTableThemeProvider,
3183
+ sa as ArrayRenderer,
3184
+ ga as BadgeRenderer,
3185
+ ta as BooleanRenderer,
3186
+ fa as CellRenderer,
3187
+ pa as ConfirmModal,
3188
+ ra as CurrencyRenderer,
3189
+ Vt as DEFAULT_THEME_COLORS,
3190
+ jt as DateRenderer,
3191
+ da as EmailRenderer,
3192
+ Q as FallbackPlaceholder,
3193
+ aa as ImageRenderer,
3194
+ ea as NumberRenderer,
3195
+ la as ObjectRenderer,
3196
+ ca as PhoneRenderer,
3197
+ ua as ProgressRenderer,
3198
+ ma as RatingRenderer,
3199
+ oa as StatusRenderer,
3200
+ qt as StringRenderer,
3201
+ zt as TABLE_PRESETS,
3202
+ ya as TableBody,
3203
+ ka as TableEmptyState,
3204
+ wa as TableErrorState,
3205
+ Qr as TableHeader,
3206
+ xa as TablePagination,
3207
+ Yr as TableSearch,
3208
+ ha as TableSkeleton,
3209
+ Zr as TableToolbar,
3210
+ ia as UrlRenderer,
3211
+ Gr as arMessages,
3212
+ Hr as computePinnedStyles,
3213
+ Sa as default,
3214
+ Jt as defaultAnyTableTheme,
3215
+ Ee as enMessages,
3216
+ xt as escapeCsvValue,
3217
+ ne as exportToCsv,
3218
+ oe as exportToJson,
3219
+ We as extractPaginationMeta,
3220
+ Ir as filterRowsBySearch,
3221
+ Or as generateAutoColumns,
3222
+ va as generateCsvContent,
3223
+ L as getNestedValue,
3224
+ st as inferColumnType,
3225
+ Bt as isImageUrl,
3226
+ Wr as isIsoDate,
3227
+ Cr as isPlainObject,
3228
+ wt as normalizeApiResponse,
3229
+ yt as parsePixelWidth,
3230
+ Yt as renderActionIcon,
3231
+ Ot as resolveColumns,
3232
+ Xr as resolveMessages,
3233
+ Kr as resolveTableActions,
3234
+ Ur as sortRows,
3235
+ ot as toTitleCase,
3236
+ Gt as triggerDownload,
3237
+ Aa as useAnyTable,
3238
+ Vr as useAnyTableController,
3239
+ It as useAnyTableData,
3240
+ Kt as useAnyTablePagination,
3241
+ Ft as useAnyTableSearch,
3242
+ Ut as useAnyTableSelection,
3243
+ Ht as useAnyTableSorting,
3244
+ _e as useAnyTableTheme,
3245
+ Jr as useAnyTableVirtualizer
2947
3246
  };
2948
3247
  //# sourceMappingURL=index.js.map