@kareemelbalshe/any-table 1.1.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,6 +1,6 @@
1
- import r, { useMemo as $, useState as P, useEffect as G, useCallback as S, useRef as de, useImperativeHandle as Wt, createContext as Ft, useContext as qe } from "react";
2
- function A(e, t, o = void 0) {
3
- if (e == null) return o;
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];
@@ -9,326 +9,23 @@ function A(e, t, o = void 0) {
9
9
  for (let l = 0; l < i.length; l++) {
10
10
  const m = i[l];
11
11
  if (a == null)
12
- return o;
12
+ return n;
13
13
  a = a[m];
14
14
  }
15
- return a !== void 0 ? a : o;
15
+ return a !== void 0 ? a : n;
16
16
  }
17
- function Lt(e) {
17
+ function Cr(e) {
18
18
  return e !== null && typeof e == "object" && !Array.isArray(e);
19
19
  }
20
- function le(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 Ot = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif"], It = ["image", "avatar", "photo", "logo", "picture", "thumbnail", "banner", "img", "icon"], Ut = ["price", "spend", "cost", "amount", "total", "fee", "rate", "salary", "balance", "deposit", "commission", "charge"], Vt = ["status", "state", "phase", "condition"];
29
- function ie(e, t) {
30
- const o = e.toLowerCase();
31
- if (It.some((a) => o.includes(a)))
32
- return "image";
33
- if (Ut.some((a) => o.includes(a)))
34
- return "currency";
35
- if (Vt.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" && Ue(i.url) ? "image" : "object";
47
- if (typeof i == "number")
48
- return "number";
49
- if (typeof i == "string") {
50
- const a = i.trim();
51
- if (Ue(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 (Yt(a) || l && a.length >= 8 && !isNaN(Date.parse(a)))
55
- return a.includes("T") || a.includes(":") ? "datetime" : "date";
56
- if (a.includes("@") && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a))
57
- 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 Ue(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 Ot.some((o) => t.endsWith(o));
70
- }
71
- function Yt(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 Gt = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
75
- function Kt(e, t = Gt, 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" || Xe(a, "", s, i, t, 0, o);
81
- return Array.from(s.values());
82
- }
83
- function Xe(e, t, o, s, i, a, l) {
84
- if (!(!e || typeof e != "object" || a > l))
85
- for (const m of Object.keys(e)) {
86
- if (i.includes(m)) continue;
87
- const d = t ? `${t}.${m}` : m, c = e[m];
88
- if (Lt(c) && !Zt(c) && a < l) {
89
- Xe(c, d, o, s, i, a + 1, l);
90
- continue;
91
- }
92
- if (!o.has(d)) {
93
- const n = s.map((g) => A(g, d)), f = ie(d, n);
94
- o.set(d, {
95
- key: d,
96
- title: le(d),
97
- type: f,
98
- sortable: !0,
99
- searchable: !0,
100
- align: f === "number" || f === "currency" ? "right" : "left"
101
- });
102
- }
103
- }
104
- }
105
- function Zt(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 Jt(e) {
109
- const { data: t = [], columns: o, autoColumns: s = !0, thead: i, headerData: a } = e;
110
- return a && Array.isArray(a) && a.length > 0 ? a.map((l, m) => {
111
- const d = i && i[m] ? i[m] : le(l), c = t.map((f) => A(f, l)), n = ie(l, c);
112
- 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) => A(g, l)), f = ie(l, n);
123
- return {
124
- key: l,
125
- title: le(l),
126
- type: f,
127
- sortable: !0,
128
- searchable: !0,
129
- align: f === "number" || f === "currency" ? "right" : "left"
130
- };
131
- }
132
- const m = String(l.key), d = l.title !== void 0 ? l.title : le(m), c = l.type || ie(m, t.map((n) => A(n, m)));
133
- 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 ? Kt(t) : [];
142
- }
143
- function qt(e) {
144
- const {
145
- explicitActions: t,
146
- buttons: o,
147
- block: s,
148
- handleBlock: i,
149
- view: a,
150
- linkView: l,
151
- viewHandler: m,
152
- edit: d,
153
- linkEdit: c,
154
- editHandler: n,
155
- del: f,
156
- handleDelete: g
157
- } = e, u = [...t || []];
158
- return o && Array.isArray(o) && o.forEach((b, y) => {
159
- u.push({
160
- id: `legacy-btn-${y}`,
161
- label: b.label,
162
- icon: b.icon,
163
- className: b.className,
164
- show: b.show,
165
- hide: b.hide,
166
- onClick: (v) => b.onClick(v)
167
- });
168
- }), s && i && u.push({
169
- id: "legacy-block",
170
- label: (b) => b.isBanned || !b.isActive ? "Unblock" : "Block",
171
- variant: (b) => b.isBanned || !b.isActive ? "success" : "danger",
172
- onClick: (b) => i(b?._id || b?.id)
173
- }), a && (m || l) && u.push({
174
- id: "legacy-view",
175
- label: "View",
176
- variant: "primary",
177
- onClick: (b) => {
178
- const y = b?._id || b?.id;
179
- m ? m(y) : l && typeof window < "u" && (window.location.href = `${l}/${y}`);
180
- }
181
- }), d && (n || c) && u.push({
182
- id: "legacy-edit",
183
- label: "Edit",
184
- variant: "info",
185
- onClick: (b) => {
186
- const y = b?._id || b?.id;
187
- n ? n(y) : c && typeof window < "u" && (window.location.href = `${c}/${y}`);
188
- }
189
- }), f && g && u.push({
190
- id: "legacy-del",
191
- label: "Delete",
192
- variant: "danger",
193
- confirmation: {
194
- title: "Delete Item",
195
- message: "Are you sure you want to delete this record?"
196
- },
197
- onClick: (b) => g(b?._id || b?.id)
198
- }), u;
199
- }
200
- function Xt({
201
- config: e,
202
- onSearchChange: t
203
- }) {
204
- const o = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.debounce ?? 350, [a, l] = P(""), [m, d] = P(""), [c, n] = P(!1);
205
- G(() => {
206
- if (!s) return;
207
- if (a === "") {
208
- d(""), n(!1), t?.("");
209
- return;
210
- }
211
- n(!0);
212
- const u = setTimeout(() => {
213
- d(a), n(!1), t?.(a);
214
- }, i);
215
- return () => {
216
- clearTimeout(u);
217
- };
218
- }, [a, i, s, t]);
219
- const f = S((u) => {
220
- l(u);
221
- }, []), g = S(() => {
222
- l(""), d(""), n(!1), t?.("");
223
- }, [t]);
224
- return {
225
- enabled: s,
226
- search: a,
227
- debouncedSearch: m,
228
- isDebouncing: c,
229
- setSearch: f,
230
- clearSearch: g,
231
- searchConfig: o
232
- };
233
- }
234
- function Qt({
235
- config: e,
236
- onSortChange: t
237
- }) {
238
- const o = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.allowUnsort ?? !0, [a, l] = P(
239
- o.defaultSortBy || null
240
- ), [m, d] = P(
241
- o.defaultSortOrder || null
242
- ), c = S(
243
- (g) => {
244
- if (s) {
245
- if (a !== g) {
246
- l(g), d("asc"), t?.(g, "asc");
247
- return;
248
- }
249
- m === "asc" ? (d("desc"), t?.(g, "desc")) : m === "desc" && i ? (l(null), d(null), t?.(null, null)) : (d("asc"), t?.(g, "asc"));
250
- }
251
- },
252
- [s, a, m, i, t]
253
- ), n = S(
254
- (g, u) => {
255
- l(g), d(u), t?.(g, u);
256
- },
257
- [t]
258
- ), f = S(() => {
259
- l(null), d(null), t?.(null, null);
260
- }, [t]);
261
- return {
262
- enabled: s,
263
- sortBy: a,
264
- sortOrder: m,
265
- toggleSort: c,
266
- setSorting: n,
267
- resetSorting: f,
268
- sortingConfig: o
269
- };
270
- }
271
- function er({
272
- config: e,
273
- totalRecords: t,
274
- onPageChange: o
275
- }) {
276
- const s = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), i = s.enabled !== !1 && !!e, a = s.defaultPage || 1, l = s.defaultPageSize || 10, m = s.pageSizeOptions || [5, 10, 20, 50, 100], [d, c] = P(a), [n, f] = P(l), g = Math.max(1, Math.ceil(t / Math.max(1, n))), u = S(
277
- (p) => {
278
- const x = Math.max(1, Math.min(p, g));
279
- c(x), o?.(x, n);
280
- },
281
- [g, n, o]
282
- ), b = S(
283
- (p) => {
284
- f(p), c(1), o?.(1, p);
285
- },
286
- [o]
287
- ), y = S(() => {
288
- d < g && u(d + 1);
289
- }, [d, g, u]), v = S(() => {
290
- d > 1 && u(d - 1);
291
- }, [d, u]), T = S(() => {
292
- c(1), f(l), o?.(1, l);
293
- }, [l, o]), B = S(
294
- (p = 5) => {
295
- const x = Math.max(
296
- 1,
297
- Math.min(d - Math.floor(p / 2), g - p + 1)
298
- ), k = Math.min(g, x + p - 1), w = [];
299
- for (let D = x; D <= k; D++)
300
- w.push(D);
301
- return w;
302
- },
303
- [d, g]
304
- ), E = S(
305
- (p) => {
306
- if (!i) return p;
307
- const x = (d - 1) * n;
308
- return p.slice(x, x + n);
309
- },
310
- [i, d, n]
311
- );
312
- return {
313
- enabled: i,
314
- page: d,
315
- pageSize: n,
316
- totalRecords: t,
317
- totalPages: g,
318
- pageSizeOptions: m,
319
- hasNextPage: d < g,
320
- hasPrevPage: d > 1,
321
- setPage: u,
322
- setPageSize: b,
323
- nextPage: y,
324
- prevPage: v,
325
- resetPagination: T,
326
- getPageWindow: B,
327
- sliceData: E,
328
- paginationConfig: s
329
- };
330
- }
331
- const tr = [
28
+ const Tr = [
332
29
  "total",
333
30
  "totalCount",
334
31
  "count",
@@ -344,7 +41,7 @@ const tr = [
344
41
  "pageInfo.total",
345
42
  "pageInfo.totalCount",
346
43
  "paging.total"
347
- ], rr = [
44
+ ], Rr = [
348
45
  "page",
349
46
  "currentPage",
350
47
  "pageNumber",
@@ -354,7 +51,7 @@ const tr = [
354
51
  "pagination.page",
355
52
  "pagination.currentPage",
356
53
  "pageInfo.page"
357
- ], ar = [
54
+ ], Br = [
358
55
  "pageSize",
359
56
  "limit",
360
57
  "perPage",
@@ -365,7 +62,7 @@ const tr = [
365
62
  "pagination.pageSize",
366
63
  "pagination.limit",
367
64
  "pagination.perPage"
368
- ], nr = [
65
+ ], $r = [
369
66
  "totalPages",
370
67
  "pageCount",
371
68
  "lastPage",
@@ -376,82 +73,82 @@ const tr = [
376
73
  "pagination.totalPages",
377
74
  "pagination.lastPage"
378
75
  ];
379
- function q(e, t, o = 1, s = 10, i) {
76
+ function We(e, t, n = 1, s = 10, i) {
380
77
  if (!e || typeof e != "object") {
381
- const c = i !== void 0 ? i : 0;
78
+ const u = i !== void 0 ? i : 0;
382
79
  return {
383
- page: o,
80
+ page: n,
384
81
  pageSize: s,
385
- total: c,
386
- 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))),
387
84
  hasNextPage: !1,
388
85
  hasPrevPage: !1
389
86
  };
390
87
  }
391
88
  let a;
392
89
  if (t?.totalPath) {
393
- const c = A(e, t.totalPath);
394
- 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));
395
92
  }
396
93
  if (a === void 0)
397
- for (const c of tr) {
398
- const n = A(e, c);
399
- if (typeof n == "number" && !isNaN(n)) {
400
- a = n;
94
+ for (const u of Tr) {
95
+ const o = L(e, u);
96
+ if (typeof o == "number" && !isNaN(o)) {
97
+ a = o;
401
98
  break;
402
99
  }
403
- if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
404
- a = Number(n);
100
+ if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
101
+ a = Number(o);
405
102
  break;
406
103
  }
407
104
  }
408
105
  a === void 0 && (a = i !== void 0 ? i : 0);
409
106
  let l;
410
107
  if (t?.pagePath) {
411
- const c = A(e, t.pagePath);
412
- 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));
413
110
  }
414
111
  if (l === void 0)
415
- for (const c of rr) {
416
- const n = A(e, c);
417
- if (typeof n == "number" && !isNaN(n)) {
418
- l = n;
112
+ for (const u of Rr) {
113
+ const o = L(e, u);
114
+ if (typeof o == "number" && !isNaN(o)) {
115
+ l = o;
419
116
  break;
420
117
  }
421
- if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
422
- l = Number(n);
118
+ if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
119
+ l = Number(o);
423
120
  break;
424
121
  }
425
122
  }
426
- l === void 0 && (l = o);
123
+ l === void 0 && (l = n);
427
124
  let m;
428
125
  if (t?.pageSizePath) {
429
- const c = A(e, t.pageSizePath);
430
- typeof c == "number" ? m = c : typeof c == "string" && !isNaN(Number(c)) && (m = Number(c));
126
+ const u = L(e, t.pageSizePath);
127
+ typeof u == "number" ? m = u : typeof u == "string" && !isNaN(Number(u)) && (m = Number(u));
431
128
  }
432
129
  if (m === void 0)
433
- for (const c of ar) {
434
- const n = A(e, c);
435
- if (typeof n == "number" && !isNaN(n)) {
436
- m = n;
130
+ for (const u of Br) {
131
+ const o = L(e, u);
132
+ if (typeof o == "number" && !isNaN(o)) {
133
+ m = o;
437
134
  break;
438
135
  }
439
- if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
440
- m = Number(n);
136
+ if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
137
+ m = Number(o);
441
138
  break;
442
139
  }
443
140
  }
444
141
  m === void 0 && (m = s);
445
142
  let d;
446
143
  if (t?.totalPagesPath) {
447
- const c = A(e, t.totalPagesPath);
448
- 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));
449
146
  }
450
147
  if (d === void 0)
451
- for (const c of nr) {
452
- const n = A(e, c);
453
- if (typeof n == "number" && !isNaN(n)) {
454
- d = n;
148
+ for (const u of $r) {
149
+ const o = L(e, u);
150
+ if (typeof o == "number" && !isNaN(o)) {
151
+ d = o;
455
152
  break;
456
153
  }
457
154
  }
@@ -464,7 +161,7 @@ function q(e, t, o = 1, s = 10, i) {
464
161
  hasPrevPage: l > 1
465
162
  };
466
163
  }
467
- const or = [
164
+ const zr = [
468
165
  "data",
469
166
  "items",
470
167
  "results",
@@ -485,14 +182,14 @@ const or = [
485
182
  "subscriptions",
486
183
  "deadLetters.items"
487
184
  ];
488
- function sr(e, t, o) {
489
- 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;
490
187
  if (t?.transformResponse && typeof t.transformResponse == "function") {
491
188
  const a = t.transformResponse(e);
492
189
  if (Array.isArray(a))
493
190
  return {
494
191
  data: a,
495
- meta: q(e, t.response, s, i, a.length),
192
+ meta: We(e, t.response, s, i, a.length),
496
193
  raw: e
497
194
  };
498
195
  if (a && typeof a == "object") {
@@ -501,7 +198,7 @@ function sr(e, t, o) {
501
198
  page: a.meta.page !== void 0 ? a.meta.page : s,
502
199
  pageSize: a.meta.pageSize !== void 0 ? a.meta.pageSize : i,
503
200
  totalPages: a.meta.totalPages !== void 0 ? a.meta.totalPages : Math.max(1, Math.ceil((a.meta.total || l.length) / (a.meta.pageSize || i)))
504
- } : q(e, t.response, s, i, l.length);
201
+ } : We(e, t.response, s, i, l.length);
505
202
  return { data: l, meta: m, raw: e };
506
203
  }
507
204
  }
@@ -519,14 +216,14 @@ function sr(e, t, o) {
519
216
  raw: e
520
217
  };
521
218
  if (t?.response?.dataPath) {
522
- const a = A(e, t.response.dataPath), l = Array.isArray(a) ? a : [], m = q(e, t.response, s, i, l.length);
219
+ const a = L(e, t.response.dataPath), l = Array.isArray(a) ? a : [], m = We(e, t.response, s, i, l.length);
523
220
  return { data: l, meta: m, raw: e };
524
221
  }
525
222
  if (e && typeof e == "object") {
526
- for (const a of or) {
527
- const l = A(e, a);
223
+ for (const a of zr) {
224
+ const l = L(e, a);
528
225
  if (Array.isArray(l)) {
529
- const m = q(e, t?.response, s, i, l.length);
226
+ const m = We(e, t?.response, s, i, l.length);
530
227
  return {
531
228
  data: l,
532
229
  meta: m,
@@ -536,7 +233,7 @@ function sr(e, t, o) {
536
233
  }
537
234
  for (const a in e)
538
235
  if (Array.isArray(e[a])) {
539
- const l = q(e, t?.response, s, i, e[a].length);
236
+ const l = We(e, t?.response, s, i, e[a].length);
540
237
  return {
541
238
  data: e[a],
542
239
  meta: l,
@@ -573,7 +270,346 @@ function sr(e, t, o) {
573
270
  raw: e
574
271
  };
575
272
  }
576
- function lr(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) {
577
613
  if (!e || !e.length) return [];
578
614
  if (!t || typeof t != "string" || !t.trim()) return e;
579
615
  const i = t.trim().toLowerCase();
@@ -583,149 +619,154 @@ function lr(e, t, o, s) {
583
619
  return e.filter((l) => {
584
620
  if (!l || typeof l != "object") return !1;
585
621
  const m = [];
586
- if (o && o.length > 0)
587
- for (const c of o) {
588
- const n = A(l, c);
589
- n != null && (typeof n == "object" ? m.push(JSON.stringify(n).toLowerCase()) : m.push(String(n).toLowerCase()));
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()));
590
626
  }
591
627
  else
592
- pe(l, m);
628
+ ht(l, m);
593
629
  const d = m.join(" ");
594
- return a.every((c) => d.includes(c));
630
+ return a.every((u) => d.includes(u));
595
631
  });
596
632
  }
597
- function pe(e, t, o = 0) {
598
- if (!(o > 4 || e === null || e === void 0)) {
633
+ function ht(e, t, n = 0) {
634
+ if (!(n > 4 || e === null || e === void 0)) {
599
635
  if (typeof e != "object") {
600
636
  t.push(String(e).toLowerCase());
601
637
  return;
602
638
  }
603
639
  if (Array.isArray(e)) {
604
640
  for (const s of e)
605
- pe(s, t, o + 1);
641
+ ht(s, t, n + 1);
606
642
  return;
607
643
  }
608
644
  for (const s in e)
609
645
  if (Object.prototype.hasOwnProperty.call(e, s)) {
610
646
  if (s.startsWith("__") || s.toLowerCase().includes("password")) continue;
611
- pe(e[s], t, o + 1);
647
+ ht(e[s], t, n + 1);
612
648
  }
613
649
  }
614
650
  }
615
- function ir(e, t, o, s) {
616
- if (!e || !e.length || !t || !o)
651
+ function Ur(e, t, n, s) {
652
+ if (!e || !e.length || !t || !n)
617
653
  return e;
618
654
  const i = [...e];
619
655
  return s && typeof s == "function" ? (i.sort((a, l) => {
620
- const m = A(a, t), d = A(l, t);
656
+ const m = L(a, t), d = L(l, t);
621
657
  if (m == null)
622
658
  return d == null ? 0 : 1;
623
659
  if (d == null) return -1;
624
- const c = s(a, l);
625
- return o === "desc" ? -c : c;
660
+ const u = s(a, l);
661
+ return n === "desc" ? -u : u;
626
662
  }), i) : (i.sort((a, l) => {
627
- const m = A(a, t), d = A(l, t);
663
+ const m = L(a, t), d = L(l, t);
628
664
  if (m == null)
629
665
  return d == null ? 0 : 1;
630
666
  if (d == null)
631
667
  return -1;
632
- let c = 0;
668
+ let u = 0;
633
669
  if (typeof m == "number" && typeof d == "number")
634
- c = m - d;
670
+ u = m - d;
635
671
  else if (typeof m == "boolean" && typeof d == "boolean")
636
- c = m === d ? 0 : m ? -1 : 1;
672
+ u = m === d ? 0 : m ? -1 : 1;
637
673
  else if (m instanceof Date && d instanceof Date)
638
- c = m.getTime() - d.getTime();
639
- else if (typeof m == "string" && typeof d == "string" && Ve(m) && Ve(d))
640
- c = new Date(m).getTime() - new Date(d).getTime();
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();
641
677
  else {
642
- const n = String(m), f = String(d);
643
- c = n.localeCompare(f, void 0, {
678
+ const o = String(m), p = String(d);
679
+ u = o.localeCompare(p, void 0, {
644
680
  numeric: !0,
645
681
  sensitivity: "base"
646
682
  });
647
683
  }
648
- return o === "desc" ? -c : c;
684
+ return n === "desc" ? -u : u;
649
685
  }), i);
650
686
  }
651
- function Ve(e) {
687
+ function $t(e) {
652
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);
653
689
  }
654
- function dr({
690
+ function It({
655
691
  data: e,
656
692
  api: t,
657
- columns: o,
693
+ columns: n,
658
694
  searchQuery: s,
659
695
  sortBy: i,
660
696
  sortOrder: a,
661
697
  page: l,
662
698
  pageSize: m,
663
699
  paginationEnabled: d = !0,
664
- manualLoading: c
700
+ manualLoading: u
665
701
  }) {
666
- const n = !!(t && typeof t.fetcher == "function"), f = n && t?.mode !== "client", [g, u] = P([]), [b, y] = P(0), [v, T] = P(!1), [B, E] = P(null), [p, x] = P(0), k = de(null), w = S(async () => {
667
- if (!n || !t?.fetcher) return;
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;
668
707
  k.current && k.current.abort();
669
- const M = new AbortController();
670
- k.current = M, T(!0), E(null);
671
- const z = t.paramNames || {}, I = z.pageParam || "page", Q = z.pageSizeParam || "limit", K = z.searchParam || "q", U = z.sortByParam || "sortBy", L = z.sortOrderParam || "sortOrder", H = {
672
- [I]: l,
673
- [Q]: m,
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,
674
713
  page: l,
675
714
  pageSize: m,
676
- ...s ? { [K]: s, search: s, q: s } : {},
677
- ...i ? { [U]: i, sortBy: i } : {},
678
- ...a ? { [L]: a, sortOrder: a } : {},
679
- ...t.params || {}
715
+ ...s ? { [R]: s, search: s, q: s } : {},
716
+ ...i ? { [V]: i, sortBy: i } : {},
717
+ ...a ? { [C]: a, sortOrder: a } : {},
718
+ ...P.params || {}
680
719
  };
681
720
  try {
682
- const R = await t.fetcher(H, M.signal);
683
- if (M.signal.aborted) return;
684
- const V = sr(
685
- R,
686
- t,
687
- H
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
688
727
  );
689
- u(V.data), y(V.meta.total), t.onSuccess?.(V);
690
- } catch (R) {
691
- if (R?.name === "AbortError" || R?.name === "CanceledError")
728
+ g(ce.data), b(ce.meta.total), P.onSuccess?.(ce);
729
+ } catch (se) {
730
+ if (se?.name === "AbortError" || se?.name === "CanceledError")
692
731
  return;
693
- E(R), t.onError?.(R);
732
+ E(se), P.onError?.(se);
694
733
  } finally {
695
- M.signal.aborted || T(!1);
734
+ H.signal.aborted || z(!1);
696
735
  }
697
- }, [n, t, l, m, s, i, a]);
698
- G(() => {
699
- n && w();
700
- }, [w, p]), G(() => () => {
736
+ }, [o, l, m, s, i, a]);
737
+ we(() => {
738
+ o && j();
739
+ }, [j, y]), we(() => () => {
701
740
  k.current && k.current.abort();
702
741
  }, []);
703
- const D = S(async () => {
704
- n && x((M) => M + 1);
705
- }, [n]), { displayRows: h, finalTotal: j } = $(() => {
706
- if (f)
742
+ const v = B(async () => {
743
+ o && x((P) => P + 1);
744
+ }, [o]), { displayRows: F, allFilteredRows: w, finalTotal: T } = D(() => {
745
+ if (p)
707
746
  return {
708
- displayRows: g,
709
- finalTotal: b
747
+ displayRows: c,
748
+ allFilteredRows: c,
749
+ finalTotal: f
710
750
  };
711
- const M = n ? g : e || [], z = o.filter((H) => H.searchable !== !1).map((H) => H.key), I = lr(M, s, z), K = o.find((H) => H.key === i)?.comparator, U = ir(I, i, a, K);
712
- let L;
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;
713
753
  if (d) {
714
- const H = (l - 1) * m;
715
- L = U.slice(H, H + m);
754
+ const C = (l - 1) * m;
755
+ V = R.slice(C, C + m);
716
756
  } else
717
- L = U;
757
+ V = R;
718
758
  return {
719
- displayRows: L,
720
- finalTotal: I.length
759
+ displayRows: V,
760
+ allFilteredRows: R,
761
+ finalTotal: N.length
721
762
  };
722
763
  }, [
764
+ p,
765
+ o,
766
+ c,
767
+ e,
723
768
  f,
724
769
  n,
725
- g,
726
- e,
727
- b,
728
- o,
729
770
  s,
730
771
  i,
731
772
  a,
@@ -734,120 +775,127 @@ function dr({
734
775
  d
735
776
  ]);
736
777
  return {
737
- rows: h,
738
- totalRecords: j,
739
- loading: c !== void 0 ? c : v,
740
- error: B,
741
- refresh: D,
742
- isServerMode: f,
743
- rawRemoteData: g
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
744
786
  };
745
787
  }
746
- function cr({
788
+ function Vr({
747
789
  tableRef: e,
748
790
  refresh: t,
749
- resetPagination: o,
791
+ resetPagination: n,
750
792
  resetSearch: s,
751
793
  resetSorting: i,
752
794
  setPage: a,
753
795
  setPageSize: l,
754
796
  setSearch: m,
755
797
  setSorting: d,
756
- selectedRows: c,
757
- clearSelection: n,
758
- getState: f,
759
- scrollToIndex: g
798
+ selectedRows: u,
799
+ clearSelection: o,
800
+ getState: p,
801
+ scrollToIndex: c,
802
+ exportData: g,
803
+ isExporting: f
760
804
  }) {
761
- Wt(
805
+ Ar(
762
806
  e,
763
807
  () => ({
764
808
  refresh: t,
765
809
  reset: () => {
766
- o(), s(), i(), n();
810
+ n(), s(), i(), o();
767
811
  },
768
812
  resetSearch: s,
769
813
  resetSorting: i,
770
- resetPagination: o,
814
+ resetPagination: n,
771
815
  setPage: a,
772
816
  setPageSize: l,
773
817
  setSearch: m,
774
818
  setSorting: d,
775
- getSelectedRows: () => c,
776
- clearSelection: n,
777
- getState: f,
778
- scrollToIndex: g
819
+ getSelectedRows: () => u,
820
+ clearSelection: o,
821
+ getState: p,
822
+ scrollToIndex: c,
823
+ exportData: g,
824
+ isExporting: f
779
825
  }),
780
826
  [
781
827
  t,
782
- o,
828
+ n,
783
829
  s,
784
830
  i,
785
831
  a,
786
832
  l,
787
833
  m,
788
834
  d,
835
+ u,
836
+ o,
837
+ p,
789
838
  c,
790
- n,
791
- f,
792
- g
839
+ g,
840
+ f
793
841
  ]
794
842
  );
795
843
  }
796
- function mr({
844
+ function Ut({
797
845
  rows: e,
798
846
  rowKeyResolver: t,
799
- onSelectionChange: o
847
+ onSelectionChange: n
800
848
  }) {
801
- const [s, i] = P(/* @__PURE__ */ new Set()), a = de(/* @__PURE__ */ new Map());
802
- G(() => {
803
- e && e.length > 0 && e.forEach((g, u) => {
804
- const b = t(g, u);
805
- s.has(b) && a.current.set(b, g);
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);
806
854
  });
807
855
  }, [e, s, t]);
808
- const l = S(
809
- (g, u) => {
810
- i((b) => {
811
- const y = new Set(b);
812
- y.has(g) ? (y.delete(g), a.current.delete(g)) : (y.add(g), a.current.set(g, u));
813
- const v = Array.from(y).map(
814
- (T) => a.current.get(T) || e.find((B, E) => t(B, E) === T)
856
+ const l = B(
857
+ (c, g) => {
858
+ i((f) => {
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)
815
863
  ).filter(Boolean);
816
- return o?.(v, Array.from(y)), y;
864
+ return n?.(S, Array.from(b)), b;
817
865
  });
818
866
  },
819
- [e, t, o]
820
- ), m = S(() => {
867
+ [e, t, n]
868
+ ), m = B(() => {
821
869
  if (s.size === e.length && e.length > 0)
822
- i(/* @__PURE__ */ new Set()), a.current.clear(), o?.([], []);
870
+ i(/* @__PURE__ */ new Set()), a.current.clear(), n?.([], []);
823
871
  else {
824
- const g = new Set(e.map((u, b) => t(u, b)));
825
- e.forEach((u, b) => {
826
- a.current.set(t(u, b), u);
827
- }), i(g), o?.(e, Array.from(g));
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));
828
876
  }
829
- }, [e, s.size, t, o]), d = S(() => {
830
- i(/* @__PURE__ */ new Set()), a.current.clear(), o?.([], []);
831
- }, [o]), c = e.length > 0 && s.size === e.length, n = s.size > 0 && s.size < e.length, f = $(() => Array.from(s).map(
832
- (g) => a.current.get(g) || e.find((u, b) => t(u, b) === g)
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)
833
881
  ).filter(Boolean), [e, s, t]);
834
882
  return {
835
883
  selectedKeys: s,
836
884
  setSelectedKeys: i,
837
- selectedRows: f,
885
+ selectedRows: p,
838
886
  onToggleSelectRow: l,
839
887
  handleToggleSelectAll: m,
840
888
  clearSelection: d,
841
- allSelected: c,
842
- isIndeterminate: n
889
+ allSelected: u,
890
+ isIndeterminate: o
843
891
  };
844
892
  }
845
- function gr({
893
+ function Jr({
846
894
  config: e,
847
895
  totalCount: t,
848
- scrollContainerRef: o
896
+ scrollContainerRef: n
849
897
  }) {
850
- const s = $(() => typeof e == "object" && e !== null ? {
898
+ const s = D(() => typeof e == "object" && e !== null ? {
851
899
  enabled: e.enabled !== !1,
852
900
  rowHeight: e.rowHeight ?? 48,
853
901
  maxHeight: e.maxHeight ?? 520,
@@ -857,31 +905,31 @@ function gr({
857
905
  rowHeight: 48,
858
906
  maxHeight: 520,
859
907
  overscan: 10
860
- }, [e]), i = !!(s.enabled && t > 0), a = s.rowHeight || 48, l = s.maxHeight || 520, m = s.overscan ?? 10, [d, c] = P(0), [n, f] = P(
908
+ }, [e]), i = !!(s.enabled && t > 0), a = s.rowHeight || 48, l = s.maxHeight || 520, m = s.overscan ?? 10, [d, u] = $(0), [o, p] = $(
861
909
  typeof l == "number" ? l : 520
862
- ), g = de(null);
863
- G(() => {
910
+ ), c = ve(null);
911
+ we(() => {
864
912
  if (!i) return;
865
- const p = o.current;
866
- if (!p) return;
867
- p.clientHeight > 0 && f(p.clientHeight);
913
+ const y = n.current;
914
+ if (!y) return;
915
+ y.clientHeight > 0 && p(y.clientHeight);
868
916
  const x = () => {
869
- g.current !== null && cancelAnimationFrame(g.current), g.current = requestAnimationFrame(() => {
870
- p && c(p.scrollTop);
917
+ c.current !== null && cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
918
+ y && u(y.scrollTop);
871
919
  });
872
920
  };
873
- p.addEventListener("scroll", x, { passive: !0 });
921
+ y.addEventListener("scroll", x, { passive: !0 });
874
922
  let k = null;
875
- return typeof ResizeObserver < "u" && (k = new ResizeObserver((w) => {
876
- for (const D of w) {
877
- const h = D.contentRect;
878
- h.height > 0 && f(h.height);
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);
879
927
  }
880
- }), k.observe(p)), () => {
881
- p.removeEventListener("scroll", x), 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();
882
930
  };
883
- }, [i, o]);
884
- const u = t * a, { startIndex: b, endIndex: y, paddingTop: v, paddingBottom: T } = $(() => {
931
+ }, [i, n]);
932
+ const g = t * a, { startIndex: f, endIndex: b, paddingTop: S, paddingBottom: z } = D(() => {
885
933
  if (!i || t === 0)
886
934
  return {
887
935
  startIndex: 0,
@@ -889,56 +937,56 @@ function gr({
889
937
  paddingTop: 0,
890
938
  paddingBottom: 0
891
939
  };
892
- const p = Math.floor(d / a), x = Math.ceil(n / a), k = Math.max(0, p - m), w = Math.min(t - 1, p + x + m), D = k * a, h = Math.max(0, (t - 1 - w) * a);
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);
893
941
  return {
894
942
  startIndex: k,
895
- endIndex: w,
896
- paddingTop: D,
897
- paddingBottom: h
943
+ endIndex: h,
944
+ paddingTop: j,
945
+ paddingBottom: v
898
946
  };
899
- }, [i, t, a, d, n, m]), B = S(
900
- (p, x = "auto") => {
901
- const k = o.current;
947
+ }, [i, t, a, d, o, m]), W = B(
948
+ (y, x = "auto") => {
949
+ const k = n.current;
902
950
  if (!k) return;
903
- const w = p * a, D = k.scrollTop, h = k.clientHeight || (typeof l == "number" ? l : 520);
904
- let j = w;
951
+ const h = y * a, j = k.scrollTop, v = k.clientHeight || (typeof l == "number" ? l : 520);
952
+ let F = h;
905
953
  if (x === "start")
906
- j = w;
954
+ F = h;
907
955
  else if (x === "end")
908
- j = w - h + a;
956
+ F = h - v + a;
909
957
  else if (x === "center")
910
- j = w - h / 2 + a / 2;
911
- else if (w < D)
912
- j = w;
913
- else if (w + a > D + h)
914
- j = w - h + a;
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;
915
963
  else
916
964
  return;
917
- const M = Math.max(0, Math.min(j, u - h));
965
+ const w = Math.max(0, Math.min(F, g - v));
918
966
  typeof k.scrollTo == "function" ? k.scrollTo({
919
- top: M,
967
+ top: w,
920
968
  behavior: "smooth"
921
- }) : k.scrollTop = M;
969
+ }) : k.scrollTop = w;
922
970
  },
923
- [a, l, u, o]
924
- ), E = S(
925
- (p) => i ? p.slice(b, y + 1) : p,
926
- [i, b, y]
971
+ [a, l, g, n]
972
+ ), E = B(
973
+ (y) => i ? y.slice(f, b + 1) : y,
974
+ [i, f, b]
927
975
  );
928
976
  return {
929
977
  isVirtualized: i,
930
- totalHeight: u,
931
- paddingTop: v,
932
- paddingBottom: T,
933
- startIndex: b,
934
- endIndex: y,
978
+ totalHeight: g,
979
+ paddingTop: S,
980
+ paddingBottom: z,
981
+ startIndex: f,
982
+ endIndex: b,
935
983
  rowHeight: a,
936
984
  maxHeight: l,
937
- scrollToIndex: B,
985
+ scrollToIndex: W,
938
986
  sliceRows: E
939
987
  };
940
988
  }
941
- const Qe = {
989
+ const Vt = {
942
990
  primary: "#2667EC",
943
991
  primaryHover: "#1E54C6",
944
992
  primaryLight: "#397FF6",
@@ -957,9 +1005,9 @@ const Qe = {
957
1005
  inputBg: "#1E293B",
958
1006
  rowHover: "rgba(38, 103, 236, 0.04)",
959
1007
  rowSelected: "rgba(38, 103, 236, 0.08)"
960
- }, Ye = {
1008
+ }, zt = {
961
1009
  default: {
962
- colors: Qe,
1010
+ colors: Vt,
963
1011
  borderRadius: "1rem",
964
1012
  density: "normal",
965
1013
  classes: {
@@ -1091,9 +1139,9 @@ const Qe = {
1091
1139
  paginationButtonActive: "bg-blue-800 text-white font-bold"
1092
1140
  }
1093
1141
  }
1094
- }, et = {
1142
+ }, Jt = {
1095
1143
  mode: "auto",
1096
- colors: Qe,
1144
+ colors: Vt,
1097
1145
  borderRadius: "1rem",
1098
1146
  fontFamily: "'Alexandria', system-ui, -apple-system, sans-serif",
1099
1147
  density: "normal",
@@ -1113,13 +1161,13 @@ const Qe = {
1113
1161
  paginationButtonActive: "bg-primary text-white hover:bg-primary-soft shadow-md shadow-primary/30",
1114
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"
1115
1163
  }
1116
- }, xe = Ft(et), ur = ({
1164
+ }, kt = Pr(Jt), qr = ({
1117
1165
  theme: e,
1118
1166
  preset: t,
1119
- children: o
1167
+ children: n
1120
1168
  }) => {
1121
- const s = qe(xe), i = $(() => {
1122
- const a = s || et, l = t && Ye[t] ? Ye[t] : {};
1169
+ const s = Wt(kt), i = D(() => {
1170
+ const a = s || Jt, l = t && zt[t] ? zt[t] : {};
1123
1171
  return {
1124
1172
  ...a,
1125
1173
  ...l,
@@ -1136,19 +1184,19 @@ const Qe = {
1136
1184
  }
1137
1185
  };
1138
1186
  }, [s, t, e]);
1139
- return /* @__PURE__ */ r.createElement(xe.Provider, { value: i }, o);
1187
+ return /* @__PURE__ */ r.createElement(kt.Provider, { value: i }, n);
1140
1188
  };
1141
- function X() {
1142
- return qe(xe);
1189
+ function _e() {
1190
+ return Wt(kt);
1143
1191
  }
1144
- function br({
1192
+ function Yr({
1145
1193
  value: e,
1146
1194
  onChange: t,
1147
- onClear: o,
1195
+ onClear: n,
1148
1196
  isDebouncing: s = !1,
1149
1197
  placeholder: i = "Search records..."
1150
1198
  }) {
1151
- const a = X();
1199
+ const a = _e();
1152
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(
1153
1201
  "svg",
1154
1202
  {
@@ -1180,7 +1228,7 @@ function br({
1180
1228
  "button",
1181
1229
  {
1182
1230
  type: "button",
1183
- onClick: o,
1231
+ onClick: n,
1184
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",
1185
1233
  title: "Clear search"
1186
1234
  },
@@ -1195,132 +1243,465 @@ function br({
1195
1243
  },
1196
1244
  /* @__PURE__ */ r.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })
1197
1245
  )
1198
- )));
1199
- }
1200
- function fr({
1201
- displayTitle: e,
1202
- subtitle: t,
1203
- isSearchEnabled: o,
1204
- searchQuery: s = "",
1205
- setSearch: i,
1206
- clearSearch: a,
1207
- isDebouncing: l = !1,
1208
- searchPlaceholder: m,
1209
- headerActions: d,
1210
- add: c,
1211
- linkAdd: n,
1212
- addHandler: f
1213
- }) {
1214
- return !(e || t || o || d || c) ? null : /* @__PURE__ */ r.createElement("div", { className: "w-full flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-1" }, (e || t) && /* @__PURE__ */ r.createElement("div", { className: "flex flex-col" }, e && /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold tracking-tight text-gray-900 dark:text-white flex items-center gap-2" }, e), t && /* @__PURE__ */ r.createElement("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-0.5" }, t)), /* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap items-center gap-3 w-full sm:w-auto justify-start sm:justify-end ml-auto" }, o && i && a && /* @__PURE__ */ r.createElement(
1215
- br,
1216
- {
1217
- value: s,
1218
- onChange: i,
1219
- onClear: a,
1220
- isDebouncing: l,
1221
- placeholder: m
1222
- }
1223
- ), d, c && /* @__PURE__ */ r.createElement(
1224
- "button",
1225
- {
1226
- type: "button",
1227
- onClick: () => {
1228
- f ? f() : n && typeof window < "u" && (window.location.href = n);
1229
- },
1230
- className: "inline-flex items-center gap-2 px-4 py-2.5 rounded-xl bg-primary text-white text-xs sm:text-sm font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95 whitespace-nowrap"
1231
- },
1232
- /* @__PURE__ */ r.createElement("span", null, "+"),
1233
- /* @__PURE__ */ r.createElement("span", null, "Add ", e || "Record")
1234
- )));
1246
+ )));
1247
+ }
1248
+ const Ee = {
1249
+ searchPlaceholder: "Search records...",
1250
+ noRecordsTitle: "No records found",
1251
+ noRecordsDescription: "Try adjusting your search query or clear active filters.",
1252
+ errorTitle: "Unable to load data",
1253
+ errorDescription: "An unexpected error occurred while fetching the records.",
1254
+ retry: "Retry Request",
1255
+ showing: "Showing",
1256
+ to: "to",
1257
+ of: "of",
1258
+ results: "results",
1259
+ page: "Page",
1260
+ rowsPerPage: "Rows / page",
1261
+ actions: "Actions",
1262
+ export: "Export",
1263
+ exportCsv: "Export CSV",
1264
+ exportJson: "Export JSON",
1265
+ exportSuccess: "Export completed successfully",
1266
+ exporting: "Exporting...",
1267
+ exportAll: "Export All Filtered",
1268
+ exportCurrentPage: "Export Current Page",
1269
+ exportSelected: "Export Selected Rows",
1270
+ selectAll: "Select all rows",
1271
+ selectRow: "Select row",
1272
+ prevPage: "Previous page",
1273
+ nextPage: "Next page",
1274
+ confirmTitle: "Are you sure?",
1275
+ confirmButton: "Confirm",
1276
+ cancelButton: "Cancel",
1277
+ addRecord: "Add",
1278
+ clearSearch: "Clear search",
1279
+ loading: "Loading..."
1280
+ }, Gr = {
1281
+ searchPlaceholder: "بحث في السجلات...",
1282
+ noRecordsTitle: "لا توجد سجلات",
1283
+ noRecordsDescription: "جرّب تغيير عبارة البحث أو إعادة تعيين الفلاتر.",
1284
+ errorTitle: "تعذر تحميل بيانات الجدول",
1285
+ errorDescription: "حدث خطأ غير متوقع أثناء جلب السجلات من الخادم.",
1286
+ retry: "إعادة المحاولة",
1287
+ showing: "عرض",
1288
+ to: "إلى",
1289
+ of: "من إجمالي",
1290
+ results: "سجل",
1291
+ page: "صفحة",
1292
+ rowsPerPage: "سجل لكل صفحة",
1293
+ actions: "الإجراءات",
1294
+ export: "تصدير",
1295
+ exportCsv: "تصدير CSV (Excel)",
1296
+ exportJson: "تصدير JSON",
1297
+ exportSuccess: "تم تصدير البيانات بنجاح",
1298
+ exporting: "جاري التصدير...",
1299
+ exportAll: "تصدير كل السجلات (المفلترة)",
1300
+ exportCurrentPage: "تصدير الصفحة الحالية فقط",
1301
+ exportSelected: "تصدير السجلات المحددة",
1302
+ selectAll: "تحديد جميع الصفوف",
1303
+ selectRow: "تحديد الصف",
1304
+ prevPage: "الصفحة السابقة",
1305
+ nextPage: "الصفحة التالية",
1306
+ confirmTitle: "هل أنت متأكد؟",
1307
+ confirmButton: "تأكيد",
1308
+ cancelButton: "إلغاء",
1309
+ addRecord: "إضافة",
1310
+ clearSearch: "مسح البحث",
1311
+ loading: "جاري التحميل..."
1312
+ };
1313
+ function Xr(e = "en", t) {
1314
+ const s = e.toLowerCase().startsWith("ar") ? Gr : Ee;
1315
+ return t ? { ...s, ...t } : s;
1316
+ }
1317
+ function Zr({
1318
+ displayTitle: e,
1319
+ subtitle: t,
1320
+ isSearchEnabled: n,
1321
+ searchQuery: s = "",
1322
+ setSearch: i,
1323
+ clearSearch: a,
1324
+ isDebouncing: l = !1,
1325
+ searchPlaceholder: m,
1326
+ headerActions: d,
1327
+ add: u,
1328
+ linkAdd: o,
1329
+ addHandler: p,
1330
+ messages: c = Ee,
1331
+ exportable: g = !1,
1332
+ onExport: f,
1333
+ isExporting: b = !1,
1334
+ hasSelectedRows: S = !1,
1335
+ dir: z = "ltr"
1336
+ }) {
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);
1341
+ }
1342
+ return E && document.addEventListener("mousedown", T), () => {
1343
+ document.removeEventListener("mousedown", T);
1344
+ };
1345
+ }, [E]), !!(e || t || n || d || u || k) ? /* @__PURE__ */ r.createElement(
1346
+ "div",
1347
+ {
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"}`
1350
+ },
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)),
1352
+ /* @__PURE__ */ r.createElement(
1353
+ "div",
1354
+ {
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"}`
1356
+ },
1357
+ n && i && a && /* @__PURE__ */ r.createElement(
1358
+ Yr,
1359
+ {
1360
+ value: s,
1361
+ onChange: i,
1362
+ onClear: a,
1363
+ isDebouncing: l,
1364
+ placeholder: m || c.searchPlaceholder
1365
+ }
1366
+ ),
1367
+ k && /* @__PURE__ */ r.createElement("div", { className: "relative inline-block", ref: x }, F ? /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1368
+ "button",
1369
+ {
1370
+ type: "button",
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
1375
+ },
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(
1403
+ "svg",
1404
+ {
1405
+ className: "w-4 h-4 text-gray-500 dark:text-gray-400",
1406
+ fill: "none",
1407
+ viewBox: "0 0 24 24",
1408
+ stroke: "currentColor",
1409
+ strokeWidth: 2
1410
+ },
1411
+ /* @__PURE__ */ r.createElement(
1412
+ "path",
1413
+ {
1414
+ strokeLinecap: "round",
1415
+ strokeLinejoin: "round",
1416
+ d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
1417
+ }
1418
+ )
1419
+ ),
1420
+ /* @__PURE__ */ r.createElement("span", null, b ? c.exporting : c.export),
1421
+ /* @__PURE__ */ r.createElement("span", { className: "text-[10px] opacity-70" }, "▼")
1422
+ ), E && /* @__PURE__ */ r.createElement(
1423
+ "div",
1424
+ {
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"}`
1426
+ },
1427
+ h && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1428
+ "button",
1429
+ {
1430
+ type: "button",
1431
+ disabled: b,
1432
+ onClick: () => {
1433
+ f?.("csv", "all"), y(!1);
1434
+ },
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"
1436
+ },
1437
+ /* @__PURE__ */ r.createElement("span", { className: "text-emerald-500 font-bold" }, "📊"),
1438
+ /* @__PURE__ */ r.createElement("span", null, v ? c.exportAll : c.exportCsv)
1439
+ ), v && /* @__PURE__ */ r.createElement(
1440
+ "button",
1441
+ {
1442
+ type: "button",
1443
+ disabled: b,
1444
+ onClick: () => {
1445
+ f?.("csv", "current-page"), y(!1);
1446
+ },
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" : ""}`
1471
+ },
1472
+ /* @__PURE__ */ r.createElement("span", { className: "text-amber-500 font-bold" }, "{ }"),
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
+ ))
1486
+ )) : /* @__PURE__ */ r.createElement(
1487
+ "button",
1488
+ {
1489
+ type: "button",
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
1494
+ },
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(
1522
+ "svg",
1523
+ {
1524
+ className: "w-4 h-4 text-gray-500 dark:text-gray-400",
1525
+ fill: "none",
1526
+ viewBox: "0 0 24 24",
1527
+ stroke: "currentColor",
1528
+ strokeWidth: 2
1529
+ },
1530
+ /* @__PURE__ */ r.createElement(
1531
+ "path",
1532
+ {
1533
+ strokeLinecap: "round",
1534
+ strokeLinejoin: "round",
1535
+ d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
1536
+ }
1537
+ )
1538
+ ),
1539
+ /* @__PURE__ */ r.createElement("span", null, b ? c.exporting : h ? c.exportCsv : c.exportJson)
1540
+ )),
1541
+ d,
1542
+ u && /* @__PURE__ */ r.createElement(
1543
+ "button",
1544
+ {
1545
+ type: "button",
1546
+ onClick: () => {
1547
+ p ? p() : o && typeof window < "u" && (window.location.href = o);
1548
+ },
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"
1550
+ },
1551
+ /* @__PURE__ */ r.createElement("span", null, "+"),
1552
+ /* @__PURE__ */ r.createElement("span", null, c.addRecord, " ", e || "")
1553
+ )
1554
+ )
1555
+ ) : null;
1235
1556
  }
1236
- function yr({
1557
+ function Qr({
1237
1558
  columns: e,
1238
1559
  hasActions: t,
1239
- actionsTitle: o = "Actions",
1560
+ actionsTitle: n,
1240
1561
  actionsWidth: s,
1241
1562
  sortBy: i,
1242
1563
  sortOrder: a,
1243
1564
  onSort: l,
1244
1565
  selectable: m,
1245
1566
  allSelected: d,
1246
- isIndeterminate: c,
1247
- onToggleSelectAll: n,
1248
- headerClassName: f = "",
1249
- sticky: g = !1
1567
+ isIndeterminate: u,
1568
+ onToggleSelectAll: o,
1569
+ headerClassName: p = "",
1570
+ sticky: c = !1,
1571
+ messages: g = Ee,
1572
+ dir: f = "ltr",
1573
+ resizableColumns: b = !1,
1574
+ columnWidths: S = {},
1575
+ onResizeColumn: z,
1576
+ pinnedStyles: W = {}
1250
1577
  }) {
1251
- const u = X(), b = {};
1252
- return g && (b.position = "sticky", b.top = 0, b.zIndex = 10), u.colors?.theadBg && (b.backgroundColor = u.colors.theadBg), u.colors?.theadText && (b.color = u.colors.theadText), /* @__PURE__ */ r.createElement(
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);
1591
+ };
1592
+ document.addEventListener("mousemove", H), document.addEventListener("mouseup", N);
1593
+ },
1594
+ [y, z]
1595
+ ), v = {};
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;
1598
+ return /* @__PURE__ */ r.createElement(
1253
1599
  "thead",
1254
1600
  {
1255
- style: b,
1256
- className: `${u.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${f}`
1601
+ style: v,
1602
+ className: `${E.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${p}`
1257
1603
  },
1258
- /* @__PURE__ */ r.createElement("tr", null, m && /* @__PURE__ */ r.createElement("th", { className: "w-10 px-4 py-3 text-center align-middle" }, /* @__PURE__ */ r.createElement(
1259
- "input",
1604
+ /* @__PURE__ */ r.createElement("tr", null, m && /* @__PURE__ */ r.createElement(
1605
+ "th",
1260
1606
  {
1261
- type: "checkbox",
1262
- checked: d,
1263
- ref: (y) => {
1264
- y && (y.indeterminate = !!c);
1607
+ style: {
1608
+ width: 44,
1609
+ minWidth: 44,
1610
+ backgroundColor: E.colors?.theadBg || void 0
1265
1611
  },
1266
- onChange: n,
1267
- className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1268
- }
1269
- )), e.map((y) => {
1270
- const v = i === y.key, T = y.sortable !== !1 && !!l, B = y.align === "center" ? "text-center" : y.align === "right" ? "text-right" : "text-left";
1612
+ className: "w-11 px-4 py-3.5 text-center align-middle"
1613
+ },
1614
+ /* @__PURE__ */ r.createElement(
1615
+ "input",
1616
+ {
1617
+ type: "checkbox",
1618
+ checked: d,
1619
+ title: g.selectAll,
1620
+ "aria-label": g.selectAll,
1621
+ ref: (w) => {
1622
+ w && (w.indeterminate = !!u);
1623
+ },
1624
+ onChange: o,
1625
+ className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1626
+ }
1627
+ )
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;
1271
1637
  return /* @__PURE__ */ r.createElement(
1272
1638
  "th",
1273
1639
  {
1274
- key: String(y.key),
1275
- style: {
1276
- width: y.width,
1277
- minWidth: y.minWidth,
1278
- maxWidth: y.maxWidth
1279
- },
1280
- onClick: () => T && l?.(String(y.key)),
1281
- className: `${u.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${B} ${y.headerClassName || ""} ${T ? "cursor-pointer hover:text-primary transition-colors group" : ""}`
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)]" : ""}`
1282
1644
  },
1283
1645
  /* @__PURE__ */ r.createElement(
1284
1646
  "div",
1285
1647
  {
1286
- className: `inline-flex items-center gap-1.5 ${y.align === "center" ? "justify-center" : y.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"}`
1287
1649
  },
1288
- /* @__PURE__ */ r.createElement("span", null, y.title),
1289
- T && /* @__PURE__ */ r.createElement(
1650
+ /* @__PURE__ */ r.createElement("span", null, w.title),
1651
+ H && /* @__PURE__ */ r.createElement(
1290
1652
  "span",
1291
1653
  {
1292
- className: `inline-flex flex-col text-[10px] transition-transform ${v ? "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"}`
1293
1655
  },
1294
- v ? 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" }, "▲▼")
1657
+ )
1658
+ ),
1659
+ C && /* @__PURE__ */ r.createElement(
1660
+ "div",
1661
+ {
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"}`,
1665
+ title: "Resize column"
1666
+ },
1667
+ /* @__PURE__ */ r.createElement(
1668
+ "div",
1669
+ {
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"}`
1671
+ }
1295
1672
  )
1296
1673
  )
1297
1674
  );
1298
1675
  }), t && /* @__PURE__ */ r.createElement(
1299
1676
  "th",
1300
1677
  {
1301
- style: { width: s || "auto" },
1302
- className: `${u.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} text-right pr-6`
1678
+ style: {
1679
+ width: s || "auto",
1680
+ minWidth: typeof s == "number" ? s : void 0,
1681
+ backgroundColor: E.colors?.theadBg || void 0
1682
+ },
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"}`
1303
1684
  },
1304
- o
1685
+ F
1305
1686
  ))
1306
1687
  );
1307
1688
  }
1308
- const _ = () => /* @__PURE__ */ r.createElement("span", { className: "text-gray-400 dark:text-gray-500 font-mono text-sm" }, "—");
1309
- function tt({ 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 }) {
1310
1691
  if (e == null || e === "")
1311
- return /* @__PURE__ */ r.createElement(_, null);
1692
+ return /* @__PURE__ */ r.createElement(Q, null);
1312
1693
  const t = String(e);
1313
1694
  return /* @__PURE__ */ r.createElement("span", { className: "truncate block max-w-xs font-normal text-sm", title: t }, t);
1314
1695
  }
1315
- function pr({ value: e }) {
1696
+ function ea({ value: e }) {
1316
1697
  if (e == null || isNaN(Number(e)))
1317
- return /* @__PURE__ */ r.createElement(_, null);
1698
+ return /* @__PURE__ */ r.createElement(Q, null);
1318
1699
  const t = Number(e);
1319
1700
  return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-medium" }, t.toLocaleString());
1320
1701
  }
1321
- function xr({ value: e }) {
1702
+ function ta({ value: e }) {
1322
1703
  if (e == null)
1323
- return /* @__PURE__ */ r.createElement(_, null);
1704
+ return /* @__PURE__ */ r.createElement(Q, null);
1324
1705
  const t = !!e;
1325
1706
  return /* @__PURE__ */ r.createElement(
1326
1707
  "span",
@@ -1331,34 +1712,34 @@ function xr({ value: e }) {
1331
1712
  t ? "Yes" : "No"
1332
1713
  );
1333
1714
  }
1334
- function Ge({ value: e, isDateTime: t = !1 }) {
1335
- if (!e) return /* @__PURE__ */ r.createElement(_, null);
1336
- const o = e instanceof Date ? e : new Date(e);
1337
- return isNaN(o.getTime()) ? /* @__PURE__ */ r.createElement(tt, { value: e, column: { key: "" } }) : /* @__PURE__ */ r.createElement("span", { className: "whitespace-nowrap text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300" }, o.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }), t && /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-400 dark:text-gray-500 ml-1.5" }, o.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" })));
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" })));
1338
1719
  }
1339
- function hr({ value: e, column: t }) {
1720
+ function ra({ value: e, column: t }) {
1340
1721
  if (e == null || isNaN(Number(e)))
1341
- return /* @__PURE__ */ r.createElement(_, null);
1342
- const o = Number(e), s = t.currency || "EGP";
1343
- return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-bold text-gray-900 dark:text-white" }, o.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), " ", /* @__PURE__ */ r.createElement("span", { className: "text-xs font-normal text-gray-500 dark:text-gray-400" }, s));
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));
1344
1725
  }
1345
- const Ke = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E";
1346
- function kr({ value: e }) {
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 }) {
1347
1728
  let t = "";
1348
- return typeof e == "string" ? t = e : Array.isArray(e) && e.length > 0 ? t = typeof e[0] == "string" ? e[0] : e[0]?.url || "" : e && typeof e == "object" && (t = e.url || ""), t || (t = Ke), /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center" }, /* @__PURE__ */ r.createElement(
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(
1349
1730
  "img",
1350
1731
  {
1351
1732
  src: t,
1352
1733
  alt: "Thumbnail",
1353
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",
1354
1735
  loading: "lazy",
1355
- onError: (o) => {
1356
- o.target.src = Ke;
1736
+ onError: (n) => {
1737
+ n.target.src = Mt;
1357
1738
  }
1358
1739
  }
1359
1740
  ));
1360
1741
  }
1361
- const wr = {
1742
+ const na = {
1362
1743
  active: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
1363
1744
  delivered: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
1364
1745
  completed: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
@@ -1375,12 +1756,12 @@ const wr = {
1375
1756
  offline: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" },
1376
1757
  closed: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" }
1377
1758
  };
1378
- function vr({ value: e, column: t }) {
1759
+ function oa({ value: e, column: t }) {
1379
1760
  if (e == null || e === "")
1380
- return /* @__PURE__ */ r.createElement(_, null);
1381
- const o = String(e), s = o.toLowerCase();
1382
- if (t.statusMap && t.statusMap[o]) {
1383
- const a = t.statusMap[o];
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];
1384
1765
  return /* @__PURE__ */ r.createElement(
1385
1766
  "span",
1386
1767
  {
@@ -1388,10 +1769,10 @@ function vr({ value: e, column: t }) {
1388
1769
  style: { color: a.color, backgroundColor: a.bg }
1389
1770
  },
1390
1771
  /* @__PURE__ */ r.createElement("span", { className: "w-1.5 h-1.5 rounded-full", style: { backgroundColor: a.color } }),
1391
- a.label || o
1772
+ a.label || n
1392
1773
  );
1393
1774
  }
1394
- const i = wr[s] || {
1775
+ const i = na[s] || {
1395
1776
  bg: "bg-gray-500/10 border-gray-500/20",
1396
1777
  text: "text-gray-700 dark:text-gray-300",
1397
1778
  dot: "bg-gray-400"
@@ -1402,24 +1783,24 @@ function vr({ value: e, column: t }) {
1402
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}`
1403
1784
  },
1404
1785
  /* @__PURE__ */ r.createElement("span", { className: `w-1.5 h-1.5 rounded-full ${i.dot}` }),
1405
- o
1786
+ n
1406
1787
  );
1407
1788
  }
1408
- function Er({ value: e }) {
1409
- return !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ r.createElement(_, null) : /* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap gap-1 items-center" }, e.slice(0, 3).map((t, o) => /* @__PURE__ */ r.createElement(
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(
1410
1791
  "span",
1411
1792
  {
1412
- key: o,
1793
+ key: n,
1413
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"
1414
1795
  },
1415
1796
  typeof t == "object" ? JSON.stringify(t) : String(t)
1416
1797
  )), e.length > 3 && /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-400 font-medium" }, "+", e.length - 3));
1417
1798
  }
1418
- function Nr({ value: e }) {
1419
- return !e || typeof e != "object" ? /* @__PURE__ */ r.createElement(_, null) : "en" in e || "ar" in e ? /* @__PURE__ */ r.createElement("span", { className: "font-medium text-sm" }, e.en || e.ar || "") : /* @__PURE__ */ r.createElement("span", { className: "font-mono text-xs text-gray-500 dark:text-gray-400 truncate block max-w-xs", title: JSON.stringify(e) }, JSON.stringify(e));
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));
1420
1801
  }
1421
- function Ar({ value: e }) {
1422
- if (!e) return /* @__PURE__ */ r.createElement(_, null);
1802
+ function ia({ value: e }) {
1803
+ if (!e) return /* @__PURE__ */ r.createElement(Q, null);
1423
1804
  const t = String(e);
1424
1805
  return /* @__PURE__ */ r.createElement(
1425
1806
  "a",
@@ -1433,8 +1814,8 @@ function Ar({ value: e }) {
1433
1814
  /* @__PURE__ */ r.createElement("span", { className: "text-xs" }, "↗")
1434
1815
  );
1435
1816
  }
1436
- function Tr({ value: e }) {
1437
- if (!e) return /* @__PURE__ */ r.createElement(_, null);
1817
+ function da({ value: e }) {
1818
+ if (!e) return /* @__PURE__ */ r.createElement(Q, null);
1438
1819
  const t = String(e);
1439
1820
  return /* @__PURE__ */ r.createElement(
1440
1821
  "a",
@@ -1445,8 +1826,8 @@ function Tr({ value: e }) {
1445
1826
  t
1446
1827
  );
1447
1828
  }
1448
- function Sr({ value: e }) {
1449
- if (!e) return /* @__PURE__ */ r.createElement(_, null);
1829
+ function ca({ value: e }) {
1830
+ if (!e) return /* @__PURE__ */ r.createElement(Q, null);
1450
1831
  const t = String(e);
1451
1832
  return /* @__PURE__ */ r.createElement(
1452
1833
  "a",
@@ -1457,79 +1838,79 @@ function Sr({ value: e }) {
1457
1838
  t
1458
1839
  );
1459
1840
  }
1460
- function Cr({ value: e }) {
1841
+ function ua({ value: e }) {
1461
1842
  if (e == null || isNaN(Number(e)))
1462
- return /* @__PURE__ */ r.createElement(_, null);
1463
- const t = Math.min(100, Math.max(0, Math.round(Number(e)))), o = t >= 80 ? "bg-emerald-500" : t >= 50 ? "bg-blue-500" : t >= 30 ? "bg-amber-500" : "bg-rose-500";
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";
1464
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(
1465
1846
  "div",
1466
1847
  {
1467
- className: `h-full rounded-full ${o} transition-all duration-500`,
1848
+ className: `h-full rounded-full ${n} transition-all duration-500`,
1468
1849
  style: { width: `${t}%` }
1469
1850
  }
1470
1851
  )), /* @__PURE__ */ r.createElement("span", { className: "font-mono text-xs font-bold text-gray-700 dark:text-gray-300 w-9 text-right" }, t, "%"));
1471
1852
  }
1472
- function Pr({ value: e }) {
1853
+ function ma({ value: e }) {
1473
1854
  if (e == null || isNaN(Number(e)))
1474
- return /* @__PURE__ */ r.createElement(_, null);
1855
+ return /* @__PURE__ */ r.createElement(Q, null);
1475
1856
  const t = Number(e);
1476
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"));
1477
1858
  }
1478
- function $r({ value: e }) {
1859
+ function ga({ value: e }) {
1479
1860
  if (e == null || e === "")
1480
- return /* @__PURE__ */ r.createElement(_, null);
1861
+ return /* @__PURE__ */ r.createElement(Q, null);
1481
1862
  const t = String(e);
1482
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);
1483
1864
  }
1484
- function Br({
1865
+ function fa({
1485
1866
  row: e,
1486
1867
  column: t,
1487
- rowIndex: o
1868
+ rowIndex: n
1488
1869
  }) {
1489
- const s = A(e, t.key);
1870
+ const s = L(e, t.key);
1490
1871
  if (t.render && typeof t.render == "function")
1491
- 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));
1492
1873
  if (t.formatter && typeof t.formatter == "function")
1493
- 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));
1494
1875
  switch (t.type) {
1495
1876
  case "boolean":
1496
- return /* @__PURE__ */ r.createElement(xr, { value: s, column: t });
1877
+ return /* @__PURE__ */ r.createElement(ta, { value: s, column: t });
1497
1878
  case "number":
1498
- return /* @__PURE__ */ r.createElement(pr, { value: s, column: t });
1879
+ return /* @__PURE__ */ r.createElement(ea, { value: s, column: t });
1499
1880
  case "currency":
1500
- return /* @__PURE__ */ r.createElement(hr, { value: s, column: t });
1881
+ return /* @__PURE__ */ r.createElement(ra, { value: s, column: t });
1501
1882
  case "date":
1502
- return /* @__PURE__ */ r.createElement(Ge, { value: s, column: t, isDateTime: !1 });
1883
+ return /* @__PURE__ */ r.createElement(jt, { value: s, column: t, isDateTime: !1 });
1503
1884
  case "datetime":
1504
- return /* @__PURE__ */ r.createElement(Ge, { value: s, column: t, isDateTime: !0 });
1885
+ return /* @__PURE__ */ r.createElement(jt, { value: s, column: t, isDateTime: !0 });
1505
1886
  case "image":
1506
- return /* @__PURE__ */ r.createElement(kr, { value: s, column: t });
1887
+ return /* @__PURE__ */ r.createElement(aa, { value: s, column: t });
1507
1888
  case "status":
1508
- return /* @__PURE__ */ r.createElement(vr, { value: s, column: t });
1889
+ return /* @__PURE__ */ r.createElement(oa, { value: s, column: t });
1509
1890
  case "progress":
1510
- return /* @__PURE__ */ r.createElement(Cr, { value: s, column: t });
1891
+ return /* @__PURE__ */ r.createElement(ua, { value: s, column: t });
1511
1892
  case "rating":
1512
- return /* @__PURE__ */ r.createElement(Pr, { value: s, column: t });
1893
+ return /* @__PURE__ */ r.createElement(ma, { value: s, column: t });
1513
1894
  case "badge":
1514
- return /* @__PURE__ */ r.createElement($r, { value: s, column: t });
1895
+ return /* @__PURE__ */ r.createElement(ga, { value: s, column: t });
1515
1896
  case "array":
1516
- return /* @__PURE__ */ r.createElement(Er, { value: s, column: t });
1897
+ return /* @__PURE__ */ r.createElement(sa, { value: s, column: t });
1517
1898
  case "object":
1518
- return /* @__PURE__ */ r.createElement(Nr, { value: s, column: t });
1899
+ return /* @__PURE__ */ r.createElement(la, { value: s, column: t });
1519
1900
  case "url":
1520
- return /* @__PURE__ */ r.createElement(Ar, { value: s, column: t });
1901
+ return /* @__PURE__ */ r.createElement(ia, { value: s, column: t });
1521
1902
  case "email":
1522
- return /* @__PURE__ */ r.createElement(Tr, { value: s, column: t });
1903
+ return /* @__PURE__ */ r.createElement(da, { value: s, column: t });
1523
1904
  case "phone":
1524
- return /* @__PURE__ */ r.createElement(Sr, { value: s, column: t });
1905
+ return /* @__PURE__ */ r.createElement(ca, { value: s, column: t });
1525
1906
  default:
1526
- return /* @__PURE__ */ r.createElement(tt, { value: s, column: t });
1907
+ return /* @__PURE__ */ r.createElement(qt, { value: s, column: t });
1527
1908
  }
1528
1909
  }
1529
- function Dr({
1910
+ function pa({
1530
1911
  isOpen: e,
1531
1912
  title: t,
1532
- message: o,
1913
+ message: n,
1533
1914
  confirmText: s = "Confirm",
1534
1915
  cancelText: i = "Cancel",
1535
1916
  type: a = "danger",
@@ -1537,11 +1918,11 @@ function Dr({
1537
1918
  onConfirm: m,
1538
1919
  isLoading: d = !1
1539
1920
  }) {
1540
- return G(() => {
1541
- const c = (n) => {
1542
- n.key === "Escape" && l();
1921
+ return we(() => {
1922
+ const u = (o) => {
1923
+ o.key === "Escape" && l();
1543
1924
  };
1544
- return e && window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
1925
+ return e && window.addEventListener("keydown", u), () => window.removeEventListener("keydown", u);
1545
1926
  }, [e, l]), e ? /* @__PURE__ */ r.createElement(
1546
1927
  "div",
1547
1928
  {
@@ -1552,7 +1933,7 @@ function Dr({
1552
1933
  "div",
1553
1934
  {
1554
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",
1555
- onClick: (c) => c.stopPropagation(),
1936
+ onClick: (u) => u.stopPropagation(),
1556
1937
  role: "dialog"
1557
1938
  },
1558
1939
  /* @__PURE__ */ r.createElement(
@@ -1563,7 +1944,7 @@ function Dr({
1563
1944
  a === "danger" ? "⚠️" : a === "warning" ? "⚡" : "ℹ️"
1564
1945
  ),
1565
1946
  /* @__PURE__ */ r.createElement("h3", { className: "text-xl font-black text-gray-900 dark:text-white mb-2" }, t),
1566
- /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed" }, o),
1947
+ /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed" }, n),
1567
1948
  /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center gap-3" }, /* @__PURE__ */ r.createElement(
1568
1949
  "button",
1569
1950
  {
@@ -1586,7 +1967,7 @@ function Dr({
1586
1967
  )
1587
1968
  ) : null;
1588
1969
  }
1589
- function rt(e, t) {
1970
+ function Yt(e, t) {
1590
1971
  if (!e) return null;
1591
1972
  if (r.isValidElement(e))
1592
1973
  return e;
@@ -1595,22 +1976,22 @@ function rt(e, t) {
1595
1976
  const i = e;
1596
1977
  return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1597
1978
  }
1598
- const o = e.displayName || e.name || "";
1599
- if (/^[A-Z]/.test(o)) {
1979
+ const n = e.displayName || e.name || "";
1980
+ if (/^[A-Z]/.test(n)) {
1600
1981
  const i = e;
1601
1982
  return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1602
1983
  }
1603
1984
  try {
1604
1985
  const i = e(t);
1605
- return rt(i, t);
1986
+ return Yt(i, t);
1606
1987
  } catch {
1607
1988
  const i = e;
1608
1989
  return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
1609
1990
  }
1610
1991
  }
1611
1992
  if (typeof e == "object" && e !== null && (e.$$typeof || e.render)) {
1612
- const o = e;
1613
- return /* @__PURE__ */ r.createElement(o, { className: "w-4 h-4 shrink-0" });
1993
+ const n = e;
1994
+ return /* @__PURE__ */ r.createElement(n, { className: "w-4 h-4 shrink-0" });
1614
1995
  }
1615
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(
1616
1997
  "img",
@@ -1621,7 +2002,7 @@ function rt(e, t) {
1621
2002
  }
1622
2003
  ) : /* @__PURE__ */ r.createElement("span", { className: "inline-flex items-center justify-center leading-none text-base" }, e) : e;
1623
2004
  }
1624
- const Ze = {
2005
+ const Dt = {
1625
2006
  primary: "bg-primary text-white hover:bg-primary-soft shadow-sm shadow-primary/20",
1626
2007
  secondary: "bg-emerald-600 text-white hover:bg-emerald-700 shadow-sm shadow-emerald-600/20",
1627
2008
  success: "bg-emerald-500 text-white hover:bg-emerald-600 shadow-sm shadow-emerald-500/20",
@@ -1631,73 +2012,73 @@ const Ze = {
1631
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",
1632
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"
1633
2014
  };
1634
- function Mr({
2015
+ function ba({
1635
2016
  row: e,
1636
2017
  actions: t,
1637
- context: o
2018
+ context: n
1638
2019
  }) {
1639
- const [s, i] = P(null), [a, l] = P({});
2020
+ const [s, i] = $(null), [a, l] = $({});
1640
2021
  if (!t || !t.length)
1641
2022
  return null;
1642
- const m = async (n) => {
1643
- if (n.confirmation) {
1644
- const f = typeof n.confirmation.title == "function" ? n.confirmation.title(e) : n.confirmation.title || "Confirm Action", g = typeof n.confirmation.message == "function" ? n.confirmation.message(e) : n.confirmation.message || "Are you sure you want to perform this action?";
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?";
1645
2026
  i({
1646
2027
  isOpen: !0,
1647
- title: f,
1648
- message: g,
1649
- confirmText: n.confirmation.confirmText || "Confirm",
1650
- cancelText: n.confirmation.cancelText || "Cancel",
1651
- 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",
1652
2033
  onConfirm: async () => {
1653
- i(null), await d(n);
2034
+ i(null), await d(o);
1654
2035
  }
1655
2036
  });
1656
2037
  return;
1657
2038
  }
1658
- await d(n);
1659
- }, d = async (n) => {
1660
- if (n.type === "button" || !n.type) {
1661
- l((f) => ({ ...f, [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 }));
1662
2043
  try {
1663
- await n.onClick(e, o);
2044
+ await o.onClick(e, n);
1664
2045
  } finally {
1665
- l((f) => ({ ...f, [n.id]: !1 }));
2046
+ l((p) => ({ ...p, [o.id]: !1 }));
1666
2047
  }
1667
2048
  }
1668
- }, c = async (n, f) => {
1669
- const g = !f;
1670
- l((u) => ({ ...u, [n.id]: !0 }));
2049
+ }, u = async (o, p) => {
2050
+ const c = !p;
2051
+ l((g) => ({ ...g, [o.id]: !0 }));
1671
2052
  try {
1672
- await n.onChange(e, g, o);
2053
+ await o.onChange(e, c, n);
1673
2054
  } finally {
1674
- l((u) => ({ ...u, [n.id]: !1 }));
2055
+ l((g) => ({ ...g, [o.id]: !1 }));
1675
2056
  }
1676
2057
  };
1677
- return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-end gap-2 pr-2" }, t.map((n) => {
1678
- if (typeof n.hide == "function" && n.hide(e) || typeof n.show == "function" && !n.show(e)) return null;
1679
- const f = typeof n.disabled == "function" ? n.disabled(e) : !!n.disabled, g = a[n.id] || (typeof n.loading == "function" ? n.loading(e) : !!n.loading), u = typeof n.label == "function" ? n.label(e) : n.label, b = rt(n.icon, e), y = typeof n.tooltip == "function" ? n.tooltip(e) : n.tooltip, v = typeof n.className == "function" ? n.className(e) : n.className || "";
1680
- if (n.type === "custom" && n.render)
1681
- return /* @__PURE__ */ r.createElement(r.Fragment, { key: n.id }, n.render(e, o));
1682
- if (n.type === "switch") {
1683
- const p = n, x = p.checked(e);
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);
1684
2065
  return /* @__PURE__ */ r.createElement(
1685
2066
  "div",
1686
2067
  {
1687
- key: n.id,
1688
- className: "flex items-center gap-2",
1689
- title: y || u
2068
+ key: o.id,
2069
+ className: "flex items-center gap-2 shrink-0",
2070
+ title: b || g
1690
2071
  },
1691
- u && /* @__PURE__ */ r.createElement("span", { className: "text-xs font-semibold text-gray-500" }, u, ":"),
2072
+ g && /* @__PURE__ */ r.createElement("span", { className: "text-xs font-semibold text-gray-500" }, g, ":"),
1692
2073
  /* @__PURE__ */ r.createElement(
1693
2074
  "button",
1694
2075
  {
1695
2076
  type: "button",
1696
2077
  role: "switch",
1697
2078
  "aria-checked": x,
1698
- disabled: f || g,
1699
- onClick: () => c(p, x),
1700
- className: `relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${x ? "bg-emerald-500" : "bg-gray-300 dark:bg-gray-700"} ${v}`
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}`
1701
2082
  },
1702
2083
  /* @__PURE__ */ r.createElement(
1703
2084
  "span",
@@ -1705,28 +2086,28 @@ function Mr({
1705
2086
  "aria-hidden": "true",
1706
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"}`
1707
2088
  },
1708
- 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" })
1709
2090
  )
1710
2091
  )
1711
2092
  );
1712
2093
  }
1713
- const T = typeof n.variant == "function" ? n.variant(e) : n.variant || "neutral", B = Ze[T] || Ze.neutral, E = !u && b ? "p-2 min-w-[2rem]" : "px-3 py-1.5";
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";
1714
2095
  return /* @__PURE__ */ r.createElement(
1715
2096
  "button",
1716
2097
  {
1717
- key: n.id,
2098
+ key: o.id,
1718
2099
  type: "button",
1719
- disabled: f || g,
1720
- onClick: () => m(n),
1721
- title: y,
1722
- style: n.color ? { backgroundColor: n.color, color: "#ffffff" } : void 0,
1723
- className: `inline-flex items-center justify-center gap-1.5 ${E} rounded-xl text-xs font-bold transition-all duration-200 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 ${B} ${v}`
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}`
1724
2105
  },
1725
- g ? /* @__PURE__ */ r.createElement("span", { className: "w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full animate-spin" }) : b && /* @__PURE__ */ r.createElement("span", { className: "text-sm flex items-center justify-center shrink-0" }, b),
1726
- u && /* @__PURE__ */ r.createElement("span", null, u)
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)
1727
2108
  );
1728
2109
  })), s && /* @__PURE__ */ r.createElement(
1729
- Dr,
2110
+ pa,
1730
2111
  {
1731
2112
  isOpen: s.isOpen,
1732
2113
  title: s.title,
@@ -1739,178 +2120,227 @@ function Mr({
1739
2120
  }
1740
2121
  ));
1741
2122
  }
1742
- function Hr({
2123
+ function ya({
1743
2124
  rows: e,
1744
2125
  columns: t,
1745
- actions: o,
2126
+ actions: n,
1746
2127
  actionContext: s,
1747
2128
  rowKeyResolver: i,
1748
2129
  selectable: a,
1749
2130
  selectedKeys: l,
1750
2131
  onToggleSelectRow: m,
1751
2132
  onRowClick: d,
1752
- striped: c = !1,
1753
- hoverable: n = !0,
1754
- rowClassName: f,
1755
- isVirtualized: g = !1,
1756
- paddingTop: u = 0,
1757
- paddingBottom: b = 0,
1758
- startIndex: y = 0
2133
+ striped: u = !1,
2134
+ hoverable: o = !0,
2135
+ rowClassName: p,
2136
+ isVirtualized: c = !1,
2137
+ paddingTop: g = 0,
2138
+ paddingBottom: f = 0,
2139
+ startIndex: b = 0,
2140
+ pinnedStyles: S = {},
2141
+ columnWidths: z = {},
2142
+ dir: W = "ltr",
2143
+ actionsWidth: E,
2144
+ messages: y = Ee
1759
2145
  }) {
1760
- const v = X(), T = !!(o && o.length > 0), B = t.length + (a ? 1 : 0) + (T ? 1 : 0);
1761
- return /* @__PURE__ */ r.createElement("tbody", { className: v.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900" }, g && u > 0 && /* @__PURE__ */ r.createElement(
1762
- "tr",
2146
+ const x = _e(), k = W === "rtl", h = !!(n && n.length > 0), j = t.length + (a ? 1 : 0) + (h ? 1 : 0);
2147
+ return /* @__PURE__ */ r.createElement(
2148
+ "tbody",
1763
2149
  {
1764
- style: { height: `${u}px`, border: 0 },
1765
- "aria-hidden": "true",
1766
- className: "pointer-events-none"
2150
+ className: x.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900"
1767
2151
  },
1768
- /* @__PURE__ */ r.createElement(
1769
- "td",
1770
- {
1771
- colSpan: B,
1772
- style: { height: `${u}px`, padding: 0, border: 0 }
1773
- }
1774
- )
1775
- ), e.map((E, p) => {
1776
- const x = y + p, k = i(E, x), w = l?.has(k), D = typeof f == "function" ? f(E, x) : f || "";
1777
- return /* @__PURE__ */ r.createElement(
2152
+ c && g > 0 && /* @__PURE__ */ r.createElement(
1778
2153
  "tr",
1779
2154
  {
1780
- key: String(k),
1781
- onClick: (h) => d?.(E, x, h),
1782
- className: `${v.classes?.tr || "transition-colors duration-150"} ${c && x % 2 === 1 ? "bg-gray-50/40 dark:bg-slate-800/20" : ""} ${n ? "hover:bg-gray-50/70 dark:hover:bg-slate-800/50" : ""} ${w ? "bg-primary/5 dark:bg-primary/10" : ""} ${d ? "cursor-pointer" : ""} ${D}`
2155
+ style: { height: `${g}px`, border: 0 },
2156
+ "aria-hidden": "true",
2157
+ className: "pointer-events-none"
1783
2158
  },
1784
- a && /* @__PURE__ */ r.createElement(
2159
+ /* @__PURE__ */ r.createElement(
1785
2160
  "td",
1786
2161
  {
1787
- className: "w-10 px-4 py-3 text-center align-middle",
1788
- onClick: (h) => h.stopPropagation()
2162
+ colSpan: j,
2163
+ style: { height: `${g}px`, padding: 0, border: 0 }
2164
+ }
2165
+ )
2166
+ ),
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 || "";
2169
+ return /* @__PURE__ */ r.createElement(
2170
+ "tr",
2171
+ {
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}`
1789
2175
  },
1790
- /* @__PURE__ */ r.createElement(
1791
- "input",
2176
+ a && /* @__PURE__ */ r.createElement(
2177
+ "td",
1792
2178
  {
1793
- type: "checkbox",
1794
- checked: w,
1795
- onChange: () => m?.(k, E),
1796
- className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
1797
- }
1798
- )
1799
- ),
1800
- t.map((h) => {
1801
- const j = h.align === "center" ? "text-center" : h.align === "right" ? "text-right" : "text-left", M = typeof h.className == "function" ? h.className(E?.[h.key], E, x) : h.className || "";
1802
- return /* @__PURE__ */ r.createElement(
2179
+ style: {
2180
+ width: 44,
2181
+ minWidth: 44,
2182
+ backgroundColor: P ? void 0 : x.colors?.tableBg || void 0
2183
+ },
2184
+ className: "w-11 px-4 py-3 text-center align-middle",
2185
+ onClick: (N) => N.stopPropagation()
2186
+ },
2187
+ /* @__PURE__ */ r.createElement(
2188
+ "input",
2189
+ {
2190
+ type: "checkbox",
2191
+ checked: P,
2192
+ title: y.selectRow,
2193
+ "aria-label": y.selectRow,
2194
+ onChange: () => m?.(T, v),
2195
+ className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
2196
+ }
2197
+ )
2198
+ ),
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
2206
+ };
2207
+ return /* @__PURE__ */ r.createElement(
2208
+ "td",
2209
+ {
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)]" : ""}`
2213
+ },
2214
+ /* @__PURE__ */ r.createElement(fa, { row: v, column: N, rowIndex: w })
2215
+ );
2216
+ }),
2217
+ h && /* @__PURE__ */ r.createElement(
1803
2218
  "td",
1804
2219
  {
1805
- key: String(h.key),
1806
2220
  style: {
1807
- width: h.width,
1808
- minWidth: h.minWidth,
1809
- maxWidth: h.maxWidth
2221
+ width: E || "auto",
2222
+ minWidth: typeof E == "number" ? E : void 0,
2223
+ backgroundColor: P ? void 0 : x.colors?.tableBg || void 0
1810
2224
  },
1811
- className: `${v.classes?.td || "py-3 px-4 text-sm align-middle"} ${j} ${M}`
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()
1812
2227
  },
1813
- /* @__PURE__ */ r.createElement(Br, { row: E, column: h, rowIndex: x })
1814
- );
1815
- }),
1816
- T && /* @__PURE__ */ r.createElement(
2228
+ /* @__PURE__ */ r.createElement(
2229
+ ba,
2230
+ {
2231
+ row: v,
2232
+ actions: n || [],
2233
+ context: s
2234
+ }
2235
+ )
2236
+ )
2237
+ );
2238
+ }),
2239
+ c && f > 0 && /* @__PURE__ */ r.createElement(
2240
+ "tr",
2241
+ {
2242
+ style: { height: `${f}px`, border: 0 },
2243
+ "aria-hidden": "true",
2244
+ className: "pointer-events-none"
2245
+ },
2246
+ /* @__PURE__ */ r.createElement(
1817
2247
  "td",
1818
2248
  {
1819
- className: `${v.classes?.td || "py-3 px-4 text-sm align-middle"} text-right`,
1820
- onClick: (h) => h.stopPropagation()
1821
- },
1822
- /* @__PURE__ */ r.createElement(
1823
- Mr,
1824
- {
1825
- row: E,
1826
- actions: o || [],
1827
- context: s
1828
- }
1829
- )
2249
+ colSpan: j,
2250
+ style: { height: `${f}px`, padding: 0, border: 0 }
2251
+ }
1830
2252
  )
1831
- );
1832
- }), g && b > 0 && /* @__PURE__ */ r.createElement(
1833
- "tr",
1834
- {
1835
- style: { height: `${b}px`, border: 0 },
1836
- "aria-hidden": "true",
1837
- className: "pointer-events-none"
1838
- },
1839
- /* @__PURE__ */ r.createElement(
1840
- "td",
1841
- {
1842
- colSpan: B,
1843
- style: { height: `${b}px`, padding: 0, border: 0 }
1844
- }
1845
2253
  )
1846
- ));
2254
+ );
1847
2255
  }
1848
- function _r({
2256
+ function xa({
1849
2257
  page: e,
1850
2258
  pageSize: t,
1851
- totalRecords: o,
2259
+ totalRecords: n,
1852
2260
  totalPages: s,
1853
2261
  pageSizeOptions: i = [5, 10, 20, 50, 100],
1854
2262
  onPageChange: a,
1855
2263
  onPageSizeChange: l,
1856
2264
  showPageSizeSelector: m = !0,
1857
2265
  showTotalCount: d = !0,
1858
- pageWindow: c
2266
+ pageWindow: u,
2267
+ messages: o = Ee,
2268
+ dir: p = "ltr"
1859
2269
  }) {
1860
- const n = X(), f = Math.min((e - 1) * t + 1, o), g = 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);
1861
2271
  return /* @__PURE__ */ r.createElement(
1862
2272
  "div",
1863
2273
  {
1864
- className: n.classes?.paginationContainer || "w-full flex flex-wrap items-center justify-between gap-4 pt-4 text-sm text-gray-600 dark:text-gray-400"
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"
1865
2276
  },
1866
- /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-3" }, d && o > 0 ? /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, "Showing ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, f), " to", " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, g), " of", " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, o.toLocaleString()), " results") : /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, "Page ", e, " of ", s), m && /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-2 ml-2" }, /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-500 hidden sm:inline" }, "Rows:"), /* @__PURE__ */ r.createElement(
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(
1867
2278
  "select",
1868
2279
  {
1869
2280
  value: t,
1870
- onChange: (u) => l(Number(u.target.value)),
1871
- className: n.classes?.paginationSelect || "h-8 px-2.5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-xs font-semibold text-gray-800 dark:text-gray-200 focus:outline-none focus:border-primary cursor-pointer"
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"
1872
2284
  },
1873
- i.map((u) => /* @__PURE__ */ r.createElement("option", { key: u, value: u, className: "bg-white dark:bg-slate-800 text-gray-900 dark:text-white" }, u, " / page"))
2285
+ i.map((S) => /* @__PURE__ */ r.createElement(
2286
+ "option",
2287
+ {
2288
+ key: S,
2289
+ value: S,
2290
+ className: "bg-white dark:bg-slate-800 text-gray-900 dark:text-white"
2291
+ },
2292
+ S
2293
+ ))
1874
2294
  ))),
1875
- /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-1.5 ml-auto" }, /* @__PURE__ */ r.createElement(
1876
- "button",
2295
+ /* @__PURE__ */ r.createElement(
2296
+ "div",
1877
2297
  {
1878
- type: "button",
1879
- disabled: e <= 1,
1880
- onClick: () => a(e - 1),
1881
- "aria-label": "Previous Page",
1882
- className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40"}`
2298
+ className: `flex items-center gap-1.5 ${g ? "mr-auto" : "ml-auto"}`
1883
2299
  },
1884
- "‹"
1885
- ), c.map((u) => {
1886
- const b = u === e;
1887
- return /* @__PURE__ */ r.createElement(
2300
+ /* @__PURE__ */ r.createElement(
1888
2301
  "button",
1889
2302
  {
1890
- key: u,
1891
2303
  type: "button",
1892
- onClick: () => a(u),
1893
- className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs"} ${b ? n.classes?.paginationButtonActive || "bg-primary text-white shadow-sm shadow-primary/30" : "bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700"}`
2304
+ disabled: e <= 1,
2305
+ onClick: () => a(e - 1),
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"}`
1894
2309
  },
1895
- u
1896
- );
1897
- }), /* @__PURE__ */ r.createElement(
1898
- "button",
1899
- {
1900
- type: "button",
1901
- disabled: e >= s,
1902
- onClick: () => a(e + 1),
1903
- "aria-label": "Next Page",
1904
- className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40"}`
1905
- },
1906
- "›"
1907
- ))
2310
+ g ? "›" : "‹"
2311
+ ),
2312
+ u.map((S) => {
2313
+ const z = S === e;
2314
+ return /* @__PURE__ */ r.createElement(
2315
+ "button",
2316
+ {
2317
+ key: S,
2318
+ type: "button",
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"}`
2321
+ },
2322
+ S
2323
+ );
2324
+ }),
2325
+ /* @__PURE__ */ r.createElement(
2326
+ "button",
2327
+ {
2328
+ type: "button",
2329
+ disabled: e >= s,
2330
+ onClick: () => a(e + 1),
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"}`
2334
+ },
2335
+ g ? "‹" : "›"
2336
+ )
2337
+ )
1908
2338
  );
1909
2339
  }
1910
- function jr({
2340
+ function ha({
1911
2341
  columnsCount: e = 5,
1912
2342
  rowsCount: t = 5,
1913
- hasActions: o = !0
2343
+ hasActions: n = !0
1914
2344
  }) {
1915
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(
1916
2346
  "div",
@@ -1920,434 +2350,898 @@ function jr({
1920
2350
  width: `${Math.floor(40 + (l * 19 + i * 13) % 45)}%`
1921
2351
  }
1922
2352
  }
1923
- ))), o && /* @__PURE__ */ r.createElement("td", { className: "py-4 px-4 text-right align-middle pr-6" }, /* @__PURE__ */ r.createElement("div", { className: "inline-flex gap-2 justify-end" }, /* @__PURE__ */ r.createElement("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }), /* @__PURE__ */ r.createElement("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }))))));
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" }))))));
1924
2354
  }
1925
- function zr({
2355
+ function ka({
1926
2356
  title: e,
1927
2357
  description: t,
1928
- isSearchActive: o = !1,
2358
+ isSearchActive: n = !1,
1929
2359
  onClearSearch: s,
1930
- colSpan: i
2360
+ colSpan: i,
2361
+ messages: a = Ee
1931
2362
  }) {
1932
- const a = o ? "No matching records found" : "No data available", l = o ? "Try adjusting your search criteria or clear the search filter." : "There are currently no records to display.", m = /* @__PURE__ */ r.createElement("div", { className: "w-full py-16 px-6 flex flex-col items-center justify-center text-center any-table-fade-in" }, /* @__PURE__ */ r.createElement("div", { className: "w-16 h-16 mb-4 rounded-2xl bg-gray-100 dark:bg-slate-800 text-gray-400 dark:text-gray-500 flex items-center justify-center text-3xl shadow-inner" }, o ? "🔍" : "📂"), /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1" }, e || a), /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-sm mb-5 leading-relaxed" }, t || l), o && s && /* @__PURE__ */ r.createElement(
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(
1933
2364
  "button",
1934
2365
  {
1935
2366
  type: "button",
1936
2367
  onClick: s,
1937
- className: "px-4 py-2 rounded-xl bg-primary text-white text-xs font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95"
2368
+ className: "px-4 py-2 rounded-xl bg-primary text-white text-xs font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95 cursor-pointer"
1938
2369
  },
1939
- "Clear Search Filter"
2370
+ a.clearSearch
1940
2371
  ));
1941
- return i !== void 0 ? /* @__PURE__ */ r.createElement("tbody", null, /* @__PURE__ */ r.createElement("tr", null, /* @__PURE__ */ r.createElement("td", { colSpan: i, className: "p-0" }, m))) : m;
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;
1942
2373
  }
1943
- function Rr({ error: e, onRetry: t }) {
1944
- const o = typeof e == "string" ? e : e?.message || e?.response?.data?.message || "Failed to load table data.";
1945
- return /* @__PURE__ */ r.createElement("div", { className: "w-full py-14 px-6 flex flex-col items-center justify-center text-center any-table-fade-in" }, /* @__PURE__ */ r.createElement("div", { className: "w-14 h-14 mb-4 rounded-2xl bg-rose-500/10 text-rose-500 flex items-center justify-center text-2xl border border-rose-500/20" }, "⚠️"), /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1" }, "Unable to load data"), /* @__PURE__ */ r.createElement("p", { className: "text-xs sm:text-sm text-rose-600 dark:text-rose-400 font-medium max-w-md mb-5 leading-relaxed bg-rose-500/5 px-3 py-1.5 rounded-lg border border-rose-500/10" }, o), t && /* @__PURE__ */ r.createElement(
2374
+ function wa({
2375
+ error: e,
2376
+ onRetry: t,
2377
+ messages: n = Ee
2378
+ }) {
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(
1946
2381
  "button",
1947
2382
  {
1948
2383
  type: "button",
1949
2384
  onClick: t,
1950
- className: "inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-gray-900 dark:bg-white text-white dark:text-gray-900 text-xs font-bold hover:bg-gray-800 dark:hover:bg-gray-100 transition-all shadow-md active:scale-95"
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"
1951
2386
  },
1952
2387
  /* @__PURE__ */ r.createElement("span", null, "🔄"),
1953
- /* @__PURE__ */ r.createElement("span", null, "Retry Request")
2388
+ /* @__PURE__ */ r.createElement("span", null, n.retry)
1954
2389
  ));
1955
2390
  }
1956
- function Je(e) {
2391
+ function xt(e) {
2392
+ if (e == null) return "";
2393
+ const t = String(e);
2394
+ return t.includes(",") || t.includes('"') || t.includes(`
2395
+ `) || t.includes("\r") ? `"${t.replace(/"/g, '""')}"` : t;
2396
+ }
2397
+ function va(e, t) {
2398
+ const n = t.filter(
2399
+ (a) => !a.hidden && a.key && a.exportable !== !1
2400
+ ), i = [n.map((a) => {
2401
+ const l = typeof a.title == "string" ? a.title : String(a.key);
2402
+ return xt(l);
2403
+ }).join(",")];
2404
+ for (let a = 0; a < e.length; a++) {
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")
2416
+ try {
2417
+ return xt(JSON.stringify(o));
2418
+ } catch {
2419
+ return "";
2420
+ }
2421
+ return xt(o);
2422
+ });
2423
+ i.push(m.join(","));
2424
+ }
2425
+ return "\uFEFF" + i.join(`\r
2426
+ `);
2427
+ }
2428
+ function Gt(e, t, n) {
2429
+ if (typeof window > "u" || typeof document > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function")
2430
+ return;
2431
+ const s = e instanceof Blob ? e : new Blob([e], { type: n }), i = URL.createObjectURL(s), a = document.createElement("a");
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);
2433
+ }
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;");
2437
+ }
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;");
2441
+ }
2442
+ function Lt(e) {
1957
2443
  const {
1958
2444
  data: t,
1959
- api: o,
2445
+ api: n,
1960
2446
  columns: s,
1961
2447
  autoColumns: i = !0,
1962
2448
  rowKey: a,
1963
2449
  title: l,
1964
2450
  subtitle: m,
1965
2451
  actions: d,
1966
- actionsTitle: c = "Actions",
1967
- actionsWidth: n,
1968
- search: f = !0,
1969
- sorting: g = !0,
1970
- pagination: u,
1971
- virtualized: b = !1,
1972
- selectable: y = !1,
1973
- onSelectionChange: v,
1974
- onRowClick: T,
1975
- loading: B,
2452
+ actionsTitle: u,
2453
+ actionsWidth: o,
2454
+ search: p = !0,
2455
+ sorting: c = !0,
2456
+ pagination: g,
2457
+ virtualized: f = !1,
2458
+ selectable: b = !1,
2459
+ onSelectionChange: S,
2460
+ onRowClick: z,
2461
+ loading: W,
1976
2462
  loadingComponent: E,
1977
- emptyComponent: p,
2463
+ emptyComponent: y,
1978
2464
  emptyTitle: x,
1979
2465
  emptyDescription: k,
1980
- errorComponent: w,
1981
- className: D = "",
1982
- tableClassName: h = "",
1983
- headerClassName: j = "",
1984
- rowClassName: M,
1985
- headerActions: z,
1986
- showHeader: I = !0,
1987
- bordered: Q = !0,
1988
- striped: K = !1,
2466
+ errorComponent: h,
2467
+ className: j = "",
2468
+ tableClassName: v = "",
2469
+ headerClassName: F = "",
2470
+ rowClassName: w,
2471
+ headerActions: T,
2472
+ showHeader: P = !0,
2473
+ bordered: H = !0,
2474
+ striped: N = !1,
1989
2475
  hoverable: U = !0,
1990
- compact: L = !1,
1991
- stickyHeader: H = !1,
1992
- tableRef: R,
2476
+ compact: G = !1,
2477
+ stickyHeader: R = !1,
2478
+ tableRef: V,
2479
+ // Internationalization & Features
2480
+ dir: C,
2481
+ locale: J = "en",
2482
+ messages: se,
2483
+ exportable: ce = !1,
2484
+ resizableColumns: Ne = !1,
1993
2485
  // Legacy Wasel Props
1994
- thead: V,
1995
- headerData: he,
1996
- tbodys: ke,
1997
- titleHeader: at,
1998
- add: nt,
1999
- linkAdd: ot,
2000
- addHandler: st,
2001
- view: we,
2002
- linkView: ve,
2003
- viewHandler: Ee,
2004
- edit: Ne,
2005
- linkEdit: Ae,
2006
- editHandler: Te,
2007
- del: Se,
2008
- handleDelete: Ce,
2009
- block: Pe,
2010
- handleBlock: $e,
2011
- buttons: Be
2012
- } = e, C = X(), ee = $(() => t || ke || void 0, [t, ke]), Z = $(() => Jt({
2013
- data: ee,
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,
2014
2509
  columns: s,
2015
2510
  autoColumns: i,
2016
- thead: V,
2017
- headerData: he
2018
- }).filter((F) => typeof F.hidden == "function" ? !F.hidden({ data: ee || [] }) : !F.hidden), [ee, s, i, V, he]), De = S(
2019
- (N, F) => {
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) => {
2020
2517
  if (typeof a == "function")
2021
- return a(N, F);
2518
+ return a(A, ae);
2022
2519
  if (typeof a == "string") {
2023
- const ye = A(N, a);
2024
- if (ye != null) return ye;
2520
+ const X = L(A, a);
2521
+ if (X != null) return X;
2025
2522
  }
2026
- const fe = N?._id ?? N?.id ?? N?.key;
2027
- return fe ?? F;
2523
+ const ke = A?._id ?? A?.id ?? A?.key;
2524
+ return ke ?? ae;
2028
2525
  },
2029
2526
  [a]
2030
2527
  ), {
2031
- enabled: lt,
2032
- search: Me,
2033
- debouncedSearch: it,
2034
- isDebouncing: dt,
2035
- setSearch: He,
2036
- clearSearch: _e,
2037
- searchConfig: ct
2038
- } = Xt({ config: f }), {
2039
- enabled: mt,
2040
- sortBy: ce,
2041
- sortOrder: me,
2042
- toggleSort: gt,
2043
- setSorting: ut,
2044
- resetSorting: bt
2045
- } = Qt({ config: g }), je = $(
2046
- () => qt({
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({
2047
2544
  explicitActions: d,
2048
- buttons: Be,
2049
- block: Pe,
2050
- handleBlock: $e,
2051
- view: we,
2052
- linkView: ve,
2053
- viewHandler: Ee,
2054
- edit: Ne,
2055
- linkEdit: Ae,
2056
- editHandler: Te,
2057
- del: Se,
2058
- handleDelete: Ce
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
2059
2556
  }),
2060
2557
  [
2061
2558
  d,
2062
- Be,
2063
- Pe,
2064
- $e,
2065
- we,
2066
- ve,
2067
- Ee,
2068
- Ne,
2069
- Ae,
2070
- Te,
2559
+ xe,
2560
+ Je,
2561
+ qe,
2071
2562
  Se,
2072
- Ce
2563
+ Ke,
2564
+ Ae,
2565
+ me,
2566
+ Ie,
2567
+ Ue,
2568
+ Pe,
2569
+ Ve
2073
2570
  ]
2074
- ), [ft, yt] = P(1), [pt, xt] = P(10), ze = $(() => typeof b == "object" && b !== null ? b.enabled !== !1 : !!b, [b]), Y = $(() => u !== void 0 ? u : !ze, [ze, u]), ht = $(() => typeof Y == "object" && Y !== null ? Y.enabled !== !1 : !!Y, [Y]), {
2075
- rows: W,
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,
2076
2574
  totalRecords: ge,
2077
- loading: te,
2078
- error: re,
2079
- refresh: J,
2080
- isServerMode: kt
2081
- } = dr({
2082
- data: ee,
2083
- api: o,
2084
- columns: Z,
2085
- searchQuery: it,
2086
- sortBy: ce,
2087
- sortOrder: me,
2088
- page: ft,
2089
- pageSize: pt,
2090
- paginationEnabled: ht,
2091
- manualLoading: B
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
2092
2590
  }), {
2093
- enabled: wt,
2094
- page: ae,
2095
- pageSize: ue,
2096
- totalPages: Re,
2097
- pageSizeOptions: vt,
2098
- setPage: ne,
2099
- setPageSize: We,
2100
- resetPagination: Et,
2101
- getPageWindow: Nt,
2102
- paginationConfig: Fe
2103
- } = er({
2104
- config: 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,
2105
2603
  totalRecords: ge,
2106
- onPageChange: (N, F) => {
2107
- yt(N), xt(F);
2604
+ onPageChange: (A, ae) => {
2605
+ ar(A), or(ae);
2108
2606
  }
2109
- }), Le = de(null), {
2110
- isVirtualized: O,
2111
- paddingTop: At,
2112
- paddingBottom: Tt,
2113
- startIndex: St,
2114
- maxHeight: oe,
2115
- scrollToIndex: Ct,
2116
- sliceRows: Oe
2117
- } = gr({
2118
- config: b,
2119
- totalCount: W.length,
2120
- scrollContainerRef: Le
2121
- }), Pt = $(() => O ? Oe(W) : W, [O, W, Oe]), {
2122
- selectedKeys: Ie,
2123
- selectedRows: se,
2124
- onToggleSelectRow: $t,
2125
- handleToggleSelectAll: Bt,
2126
- clearSelection: Dt,
2127
- allSelected: Mt,
2128
- isIndeterminate: Ht
2129
- } = mr({
2130
- rows: W,
2131
- rowKeyResolver: De,
2132
- onSelectionChange: v
2133
- }), _t = $(
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({
2616
+ config: f,
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(
2134
2632
  () => ({
2135
- refresh: J,
2136
- loading: te,
2137
- page: ae,
2138
- selectedRows: se,
2139
- setPage: ne
2633
+ refresh: Me,
2634
+ loading: Ge,
2635
+ page: Qe,
2636
+ selectedRows: ue,
2637
+ setPage: et
2140
2638
  }),
2141
- [J, te, ae, se, ne]
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"
2646
+ }), [
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);
2736
+ },
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
+ ]
2142
2752
  );
2143
- cr({
2144
- tableRef: R,
2145
- refresh: J,
2146
- resetPagination: Et,
2147
- resetSearch: _e,
2148
- resetSorting: bt,
2149
- setPage: ne,
2150
- setPageSize: We,
2151
- setSearch: He,
2152
- setSorting: ut,
2153
- selectedRows: se,
2154
- clearSelection: Dt,
2155
- scrollToIndex: Ct,
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,
2156
2768
  getState: () => ({
2157
- data: W,
2158
- loading: te,
2159
- error: re,
2160
- page: ae,
2161
- pageSize: ue,
2769
+ data: Y,
2770
+ loading: Ge,
2771
+ error: Xe,
2772
+ page: Qe,
2773
+ pageSize: mt,
2162
2774
  total: ge,
2163
- totalPages: Re,
2164
- search: Me,
2165
- sortBy: ce,
2166
- sortOrder: me,
2167
- selectedRowKeys: Array.from(Ie),
2168
- selectedRows: se,
2169
- isServerMode: kt
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
2170
2783
  })
2171
2784
  });
2172
- const jt = l || at, be = je.length > 0, zt = $(() => {
2173
- const N = {};
2174
- return C.borderRadius && (N["--any-table-radius"] = C.borderRadius), C.fontFamily && (N["--any-table-font"] = C.fontFamily, N.fontFamily = C.fontFamily), C.colors?.primary && (N["--any-table-primary"] = C.colors.primary), C.colors?.primaryHover && (N["--any-table-primary-hover"] = C.colors.primaryHover), C.colors?.border && (N["--any-table-border"] = C.colors.border), N;
2175
- }, [C]), Rt = $(() => {
2176
- const N = {};
2177
- return C.borderRadius && (N.borderRadius = C.borderRadius), O && (N.maxHeight = typeof oe == "number" ? `${oe}px` : oe, N.overflowY = "auto", N.position = "relative"), N;
2178
- }, [C.borderRadius, O, oe]);
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]);
2179
2792
  return /* @__PURE__ */ r.createElement(
2180
2793
  "div",
2181
2794
  {
2182
- style: zt,
2183
- className: `any-table-wrapper ${C.classes?.container || "w-full flex flex-col gap-4 font-sans text-gray-900 dark:text-gray-100"} ${D}`
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}`
2184
2799
  },
2185
2800
  /* @__PURE__ */ r.createElement(
2186
- fr,
2801
+ Zr,
2187
2802
  {
2188
- displayTitle: jt,
2803
+ displayTitle: vr,
2189
2804
  subtitle: m,
2190
- isSearchEnabled: lt,
2191
- searchQuery: Me,
2192
- setSearch: He,
2193
- clearSearch: _e,
2194
- isDebouncing: dt,
2195
- searchPlaceholder: ct.placeholder,
2196
- headerActions: z,
2197
- add: nt,
2198
- linkAdd: ot,
2199
- addHandler: st
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
2200
2821
  }
2201
2822
  ),
2202
2823
  /* @__PURE__ */ r.createElement(
2203
2824
  "div",
2204
2825
  {
2205
- ref: Le,
2206
- style: Rt,
2207
- className: `${C.classes?.tableWrapper || "w-full overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-slate-900 shadow-sm transition-colors"} ${Q ? "" : "border-0 shadow-none"}`
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"}`
2208
2829
  },
2209
- re ? typeof w == "function" ? w(re, J) : w || /* @__PURE__ */ r.createElement(Rr, { error: re, onRetry: J }) : /* @__PURE__ */ r.createElement(
2830
+ Xe ? typeof h == "function" ? h(Xe, Me) : h || /* @__PURE__ */ r.createElement(
2831
+ wa,
2832
+ {
2833
+ error: Xe,
2834
+ onRetry: Me,
2835
+ messages: pe
2836
+ }
2837
+ ) : /* @__PURE__ */ r.createElement(
2210
2838
  "table",
2211
2839
  {
2212
- className: `${C.classes?.table || "w-full border-collapse text-left text-sm"} ${L || C.density === "compact" ? "text-xs" : ""} ${H || O ? "relative" : ""} ${h}`
2840
+ className: `${_.classes?.table || "w-full border-collapse text-left rtl:text-right text-sm"} ${G || _.density === "compact" ? "text-xs" : ""} ${R || he ? "relative" : ""} ${v}`
2213
2841
  },
2214
- I && /* @__PURE__ */ r.createElement(
2215
- yr,
2842
+ P && /* @__PURE__ */ r.createElement(
2843
+ Qr,
2216
2844
  {
2217
- columns: Z,
2218
- hasActions: be,
2219
- actionsTitle: c,
2220
- actionsWidth: n,
2221
- sortBy: ce,
2222
- sortOrder: me,
2223
- onSort: mt ? gt : void 0,
2224
- selectable: y,
2225
- allSelected: Mt,
2226
- isIndeterminate: Ht,
2227
- onToggleSelectAll: Bt,
2228
- headerClassName: j,
2229
- sticky: H || O
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
2230
2864
  }
2231
2865
  ),
2232
- te && W.length === 0 ? E || /* @__PURE__ */ r.createElement(
2233
- jr,
2866
+ Ge && Y.length === 0 ? E || /* @__PURE__ */ r.createElement(
2867
+ ha,
2234
2868
  {
2235
- columnsCount: Z.length + (y ? 1 : 0) + (be ? 1 : 0),
2236
- rowsCount: ue || 5
2869
+ columnsCount: O.length + (b ? 1 : 0) + (De ? 1 : 0),
2870
+ rowsCount: mt || 5
2237
2871
  }
2238
- ) : W.length === 0 ? (
2872
+ ) : Y.length === 0 ? (
2239
2873
  // Empty State
2240
- p || /* @__PURE__ */ r.createElement(
2241
- zr,
2874
+ y || /* @__PURE__ */ r.createElement(
2875
+ ka,
2242
2876
  {
2243
2877
  title: x,
2244
2878
  description: k,
2245
- colSpan: Z.length + (y ? 1 : 0) + (be ? 1 : 0)
2879
+ colSpan: O.length + (b ? 1 : 0) + (De ? 1 : 0),
2880
+ messages: pe
2246
2881
  }
2247
2882
  )
2248
2883
  ) : (
2249
2884
  // Table Body
2250
2885
  /* @__PURE__ */ r.createElement(
2251
- Hr,
2886
+ ya,
2252
2887
  {
2253
- rows: Pt,
2254
- columns: Z,
2255
- actions: je,
2256
- actionContext: _t,
2257
- rowKeyResolver: De,
2258
- selectable: y,
2259
- selectedKeys: Ie,
2260
- onToggleSelectRow: $t,
2261
- onRowClick: T,
2262
- striped: K,
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,
2263
2898
  hoverable: U,
2264
- rowClassName: M,
2265
- isVirtualized: O,
2266
- paddingTop: At,
2267
- paddingBottom: Tt,
2268
- startIndex: St
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
2269
2909
  }
2270
2910
  )
2271
2911
  )
2272
2912
  )
2273
2913
  ),
2274
- wt && /* @__PURE__ */ r.createElement(
2275
- _r,
2914
+ lr && /* @__PURE__ */ r.createElement(
2915
+ xa,
2276
2916
  {
2277
- page: ae,
2278
- pageSize: ue,
2917
+ page: Qe,
2918
+ pageSize: mt,
2279
2919
  totalRecords: ge,
2280
- totalPages: Re,
2281
- pageSizeOptions: vt,
2282
- onPageChange: ne,
2283
- onPageSizeChange: We,
2284
- showPageSizeSelector: Fe.showPageSizeSelector,
2285
- showTotalCount: Fe.showTotalCount,
2286
- pageWindow: Nt(5)
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
2287
2929
  }
2288
2930
  )
2289
2931
  );
2290
2932
  }
2291
- const Fr = r.forwardRef(function(t, o) {
2292
- const s = o || t.tableRef;
2293
- return !t.theme && !t.preset ? /* @__PURE__ */ r.createElement(Je, { ...t, tableRef: s }) : /* @__PURE__ */ r.createElement(ur, { theme: t.theme, preset: t.preset }, /* @__PURE__ */ r.createElement(Je, { ...t, tableRef: s }));
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 }));
2294
2936
  });
2937
+ function Aa(e = {}) {
2938
+ const {
2939
+ data: t,
2940
+ api: n,
2941
+ columns: s,
2942
+ autoColumns: i = !0,
2943
+ rowKey: a,
2944
+ search: l = !0,
2945
+ sorting: m = !0,
2946
+ pagination: d = !0,
2947
+ manualLoading: u,
2948
+ onSelectionChange: o,
2949
+ exportable: p
2950
+ } = e, c = D(() => Ot({
2951
+ data: t,
2952
+ columns: s,
2953
+ autoColumns: i
2954
+ }), [t, s, i]), g = B(
2955
+ (M, le) => {
2956
+ if (typeof a == "function")
2957
+ return a(M, le);
2958
+ if (typeof a == "string") {
2959
+ const K = L(M, a);
2960
+ if (K != null) return K;
2961
+ }
2962
+ const O = M?._id ?? M?.id ?? M?.key;
2963
+ return O ?? le;
2964
+ },
2965
+ [a]
2966
+ ), {
2967
+ enabled: f,
2968
+ search: b,
2969
+ debouncedSearch: S,
2970
+ isDebouncing: z,
2971
+ setSearch: W,
2972
+ clearSearch: E,
2973
+ searchConfig: y
2974
+ } = Ft({ config: l }), {
2975
+ enabled: x,
2976
+ sortBy: k,
2977
+ sortOrder: h,
2978
+ toggleSort: j,
2979
+ setSorting: v,
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({
2990
+ data: t,
2991
+ api: n,
2992
+ columns: c,
2993
+ searchQuery: S,
2994
+ sortBy: k,
2995
+ sortOrder: h,
2996
+ page: P,
2997
+ pageSize: N,
2998
+ paginationEnabled: G,
2999
+ manualLoading: u
3000
+ }), {
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({
3011
+ config: d,
3012
+ totalRecords: C,
3013
+ onPageChange: (M, le) => {
3014
+ H(M), U(le);
3015
+ }
3016
+ }), {
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);
3111
+ },
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]);
3129
+ return {
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,
3139
+ search: {
3140
+ enabled: f,
3141
+ query: b,
3142
+ isDebouncing: z,
3143
+ setSearch: W,
3144
+ clearSearch: E,
3145
+ placeholder: y.placeholder
3146
+ },
3147
+ sorting: {
3148
+ enabled: x,
3149
+ sortBy: k,
3150
+ sortOrder: h,
3151
+ toggleSort: j,
3152
+ setSorting: v,
3153
+ resetSorting: F
3154
+ },
3155
+ pagination: {
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
3165
+ },
3166
+ selection: {
3167
+ selectedKeys: Ae,
3168
+ selectedRows: me,
3169
+ toggleSelectRow: Ie,
3170
+ toggleSelectAll: Ue,
3171
+ clearSelection: Pe,
3172
+ allSelected: Ve,
3173
+ isIndeterminate: Je
3174
+ },
3175
+ exportData: _
3176
+ };
3177
+ }
2295
3178
  export {
2296
- Mr as ActionRenderer,
2297
- Fr as AnyTable,
2298
- Je as AnyTableInner,
2299
- ur as AnyTableThemeProvider,
2300
- Er as ArrayRenderer,
2301
- $r as BadgeRenderer,
2302
- xr as BooleanRenderer,
2303
- Br as CellRenderer,
2304
- Dr as ConfirmModal,
2305
- hr as CurrencyRenderer,
2306
- Qe as DEFAULT_THEME_COLORS,
2307
- Ge as DateRenderer,
2308
- Tr as EmailRenderer,
2309
- _ as FallbackPlaceholder,
2310
- kr as ImageRenderer,
2311
- pr as NumberRenderer,
2312
- Nr as ObjectRenderer,
2313
- Sr as PhoneRenderer,
2314
- Cr as ProgressRenderer,
2315
- Pr as RatingRenderer,
2316
- vr as StatusRenderer,
2317
- tt as StringRenderer,
2318
- Ye as TABLE_PRESETS,
2319
- Hr as TableBody,
2320
- zr as TableEmptyState,
2321
- Rr as TableErrorState,
2322
- yr as TableHeader,
2323
- _r as TablePagination,
2324
- br as TableSearch,
2325
- jr as TableSkeleton,
2326
- fr as TableToolbar,
2327
- Ar as UrlRenderer,
2328
- Fr as default,
2329
- et as defaultAnyTableTheme,
2330
- q as extractPaginationMeta,
2331
- lr as filterRowsBySearch,
2332
- Kt as generateAutoColumns,
2333
- A as getNestedValue,
2334
- ie as inferColumnType,
2335
- Ue as isImageUrl,
2336
- Yt as isIsoDate,
2337
- Lt as isPlainObject,
2338
- sr as normalizeApiResponse,
2339
- rt as renderActionIcon,
2340
- Jt as resolveColumns,
2341
- qt as resolveTableActions,
2342
- ir as sortRows,
2343
- le as toTitleCase,
2344
- cr as useAnyTableController,
2345
- dr as useAnyTableData,
2346
- er as useAnyTablePagination,
2347
- Xt as useAnyTableSearch,
2348
- mr as useAnyTableSelection,
2349
- Qt as useAnyTableSorting,
2350
- X as useAnyTableTheme,
2351
- gr as useAnyTableVirtualizer
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
2352
3246
  };
2353
3247
  //# sourceMappingURL=index.js.map