react-admin-crud-manager 1.0.1 → 1.0.2

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.
Files changed (33) hide show
  1. package/README.md +12 -1
  2. package/dist/index.cjs.js +62 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.es.js +2871 -0
  5. package/dist/index.es.js.map +1 -0
  6. package/dist/style.css +1 -0
  7. package/package.json +9 -4
  8. package/src/components/Button/Button.jsx +0 -85
  9. package/src/components/Chip/Chip.jsx +0 -71
  10. package/src/components/CrudPage.jsx +0 -532
  11. package/src/components/Details/Details.jsx +0 -134
  12. package/src/components/Filter/FilterDrawer.jsx +0 -99
  13. package/src/components/Form/Form.jsx +0 -51
  14. package/src/components/Form/components/Checkbox.jsx +0 -119
  15. package/src/components/Form/components/ImagePicker.jsx +0 -128
  16. package/src/components/Form/components/Input.jsx +0 -71
  17. package/src/components/Form/components/InputLabel.jsx +0 -12
  18. package/src/components/Form/components/PhoneInput.jsx +0 -221
  19. package/src/components/Form/components/RenderFields.jsx +0 -181
  20. package/src/components/Form/components/Select.jsx +0 -191
  21. package/src/components/Form/components/Switch.jsx +0 -64
  22. package/src/components/Form/components/TextArea.jsx +0 -31
  23. package/src/components/Form/components/TinyEditor.jsx +0 -113
  24. package/src/components/Loader/Spinner.jsx +0 -21
  25. package/src/components/Modal/Modal.jsx +0 -152
  26. package/src/components/Table/Table.jsx +0 -554
  27. package/src/components/Table/components/ImagePreview.jsx +0 -58
  28. package/src/components/Table/components/TableSkeleton.jsx +0 -39
  29. package/src/data/countries.js +0 -252
  30. package/src/data/teams.js +0 -130
  31. package/src/index.css +0 -170
  32. package/src/index.js +0 -11
  33. package/src/lib/utils.js +0 -74
@@ -0,0 +1,2871 @@
1
+ import Oe, { useState as P, useRef as ke, useEffect as ae, useMemo as Ke } from "react";
2
+ import { ChevronDown as dr, Search as ze, Check as Fr, X as Ae, Filter as Dr, ChevronLeft as Ar, ChevronRight as Ir, EllipsisVertical as Lr, User as cr, Plus as Br } from "lucide-react";
3
+ import { createPortal as $r } from "react-dom";
4
+ import { Icon as He } from "@iconify/react";
5
+ import { Editor as Gr } from "@tinymce/tinymce-react";
6
+ import { SnackbarProvider as Yr, enqueueSnackbar as $e } from "notistack";
7
+ import a from "prop-types";
8
+ var Ue = { exports: {} }, _e = {};
9
+ /**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */
18
+ var nr;
19
+ function Kr() {
20
+ if (nr) return _e;
21
+ nr = 1;
22
+ var h = Oe, c = Symbol.for("react.element"), s = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, d = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, t = { key: !0, ref: !0, __self: !0, __source: !0 };
23
+ function n(N, y, v) {
24
+ var f, u = {}, g = null, C = null;
25
+ v !== void 0 && (g = "" + v), y.key !== void 0 && (g = "" + y.key), y.ref !== void 0 && (C = y.ref);
26
+ for (f in y) i.call(y, f) && !t.hasOwnProperty(f) && (u[f] = y[f]);
27
+ if (N && N.defaultProps) for (f in y = N.defaultProps, y) u[f] === void 0 && (u[f] = y[f]);
28
+ return { $$typeof: c, type: N, key: g, ref: C, props: u, _owner: d.current };
29
+ }
30
+ return _e.Fragment = s, _e.jsx = n, _e.jsxs = n, _e;
31
+ }
32
+ var Pe = {};
33
+ /**
34
+ * @license React
35
+ * react-jsx-runtime.development.js
36
+ *
37
+ * Copyright (c) Facebook, Inc. and its affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */
42
+ var lr;
43
+ function Ur() {
44
+ return lr || (lr = 1, process.env.NODE_ENV !== "production" && function() {
45
+ var h = Oe, c = Symbol.for("react.element"), s = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), t = Symbol.for("react.profiler"), n = Symbol.for("react.provider"), N = Symbol.for("react.context"), y = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), C = Symbol.for("react.offscreen"), p = Symbol.iterator, E = "@@iterator";
46
+ function M(r) {
47
+ if (r === null || typeof r != "object")
48
+ return null;
49
+ var o = p && r[p] || r[E];
50
+ return typeof o == "function" ? o : null;
51
+ }
52
+ var R = h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
53
+ function w(r) {
54
+ {
55
+ for (var o = arguments.length, b = new Array(o > 1 ? o - 1 : 0), k = 1; k < o; k++)
56
+ b[k - 1] = arguments[k];
57
+ L("error", r, b);
58
+ }
59
+ }
60
+ function L(r, o, b) {
61
+ {
62
+ var k = R.ReactDebugCurrentFrame, I = k.getStackAddendum();
63
+ I !== "" && (o += "%s", b = b.concat([I]));
64
+ var Y = b.map(function(D) {
65
+ return String(D);
66
+ });
67
+ Y.unshift("Warning: " + o), Function.prototype.apply.call(console[r], console, Y);
68
+ }
69
+ }
70
+ var U = !1, V = !1, Z = !1, $ = !1, x = !1, B;
71
+ B = Symbol.for("react.module.reference");
72
+ function G(r) {
73
+ return !!(typeof r == "string" || typeof r == "function" || r === i || r === t || x || r === d || r === v || r === f || $ || r === C || U || V || Z || typeof r == "object" && r !== null && (r.$$typeof === g || r.$$typeof === u || r.$$typeof === n || r.$$typeof === N || r.$$typeof === y || // This needs to include all possible module reference object
74
+ // types supported by any Flight configuration anywhere since
75
+ // we don't know which Flight build this will end up being used
76
+ // with.
77
+ r.$$typeof === B || r.getModuleId !== void 0));
78
+ }
79
+ function T(r, o, b) {
80
+ var k = r.displayName;
81
+ if (k)
82
+ return k;
83
+ var I = o.displayName || o.name || "";
84
+ return I !== "" ? b + "(" + I + ")" : b;
85
+ }
86
+ function S(r) {
87
+ return r.displayName || "Context";
88
+ }
89
+ function O(r) {
90
+ if (r == null)
91
+ return null;
92
+ if (typeof r.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
93
+ return r.displayName || r.name || null;
94
+ if (typeof r == "string")
95
+ return r;
96
+ switch (r) {
97
+ case i:
98
+ return "Fragment";
99
+ case s:
100
+ return "Portal";
101
+ case t:
102
+ return "Profiler";
103
+ case d:
104
+ return "StrictMode";
105
+ case v:
106
+ return "Suspense";
107
+ case f:
108
+ return "SuspenseList";
109
+ }
110
+ if (typeof r == "object")
111
+ switch (r.$$typeof) {
112
+ case N:
113
+ var o = r;
114
+ return S(o) + ".Consumer";
115
+ case n:
116
+ var b = r;
117
+ return S(b._context) + ".Provider";
118
+ case y:
119
+ return T(r, r.render, "ForwardRef");
120
+ case u:
121
+ var k = r.displayName || null;
122
+ return k !== null ? k : O(r.type) || "Memo";
123
+ case g: {
124
+ var I = r, Y = I._payload, D = I._init;
125
+ try {
126
+ return O(D(Y));
127
+ } catch {
128
+ return null;
129
+ }
130
+ }
131
+ }
132
+ return null;
133
+ }
134
+ var W = Object.assign, Q = 0, oe, pe, ye, ge, ve, fe, se;
135
+ function Se() {
136
+ }
137
+ Se.__reactDisabledLog = !0;
138
+ function Ee() {
139
+ {
140
+ if (Q === 0) {
141
+ oe = console.log, pe = console.info, ye = console.warn, ge = console.error, ve = console.group, fe = console.groupCollapsed, se = console.groupEnd;
142
+ var r = {
143
+ configurable: !0,
144
+ enumerable: !0,
145
+ value: Se,
146
+ writable: !0
147
+ };
148
+ Object.defineProperties(console, {
149
+ info: r,
150
+ log: r,
151
+ warn: r,
152
+ error: r,
153
+ group: r,
154
+ groupCollapsed: r,
155
+ groupEnd: r
156
+ });
157
+ }
158
+ Q++;
159
+ }
160
+ }
161
+ function Te() {
162
+ {
163
+ if (Q--, Q === 0) {
164
+ var r = {
165
+ configurable: !0,
166
+ enumerable: !0,
167
+ writable: !0
168
+ };
169
+ Object.defineProperties(console, {
170
+ log: W({}, r, {
171
+ value: oe
172
+ }),
173
+ info: W({}, r, {
174
+ value: pe
175
+ }),
176
+ warn: W({}, r, {
177
+ value: ye
178
+ }),
179
+ error: W({}, r, {
180
+ value: ge
181
+ }),
182
+ group: W({}, r, {
183
+ value: ve
184
+ }),
185
+ groupCollapsed: W({}, r, {
186
+ value: fe
187
+ }),
188
+ groupEnd: W({}, r, {
189
+ value: se
190
+ })
191
+ });
192
+ }
193
+ Q < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
194
+ }
195
+ }
196
+ var me = R.ReactCurrentDispatcher, ie;
197
+ function de(r, o, b) {
198
+ {
199
+ if (ie === void 0)
200
+ try {
201
+ throw Error();
202
+ } catch (I) {
203
+ var k = I.stack.trim().match(/\n( *(at )?)/);
204
+ ie = k && k[1] || "";
205
+ }
206
+ return `
207
+ ` + ie + r;
208
+ }
209
+ }
210
+ var xe = !1, ce;
211
+ {
212
+ var Ne = typeof WeakMap == "function" ? WeakMap : Map;
213
+ ce = new Ne();
214
+ }
215
+ function we(r, o) {
216
+ if (!r || xe)
217
+ return "";
218
+ {
219
+ var b = ce.get(r);
220
+ if (b !== void 0)
221
+ return b;
222
+ }
223
+ var k;
224
+ xe = !0;
225
+ var I = Error.prepareStackTrace;
226
+ Error.prepareStackTrace = void 0;
227
+ var Y;
228
+ Y = me.current, me.current = null, Ee();
229
+ try {
230
+ if (o) {
231
+ var D = function() {
232
+ throw Error();
233
+ };
234
+ if (Object.defineProperty(D.prototype, "props", {
235
+ set: function() {
236
+ throw Error();
237
+ }
238
+ }), typeof Reflect == "object" && Reflect.construct) {
239
+ try {
240
+ Reflect.construct(D, []);
241
+ } catch (he) {
242
+ k = he;
243
+ }
244
+ Reflect.construct(r, [], D);
245
+ } else {
246
+ try {
247
+ D.call();
248
+ } catch (he) {
249
+ k = he;
250
+ }
251
+ r.call(D.prototype);
252
+ }
253
+ } else {
254
+ try {
255
+ throw Error();
256
+ } catch (he) {
257
+ k = he;
258
+ }
259
+ r();
260
+ }
261
+ } catch (he) {
262
+ if (he && k && typeof he.stack == "string") {
263
+ for (var _ = he.stack.split(`
264
+ `), re = k.stack.split(`
265
+ `), q = _.length - 1, J = re.length - 1; q >= 1 && J >= 0 && _[q] !== re[J]; )
266
+ J--;
267
+ for (; q >= 1 && J >= 0; q--, J--)
268
+ if (_[q] !== re[J]) {
269
+ if (q !== 1 || J !== 1)
270
+ do
271
+ if (q--, J--, J < 0 || _[q] !== re[J]) {
272
+ var ne = `
273
+ ` + _[q].replace(" at new ", " at ");
274
+ return r.displayName && ne.includes("<anonymous>") && (ne = ne.replace("<anonymous>", r.displayName)), typeof r == "function" && ce.set(r, ne), ne;
275
+ }
276
+ while (q >= 1 && J >= 0);
277
+ break;
278
+ }
279
+ }
280
+ } finally {
281
+ xe = !1, me.current = Y, Te(), Error.prepareStackTrace = I;
282
+ }
283
+ var Re = r ? r.displayName || r.name : "", tr = Re ? de(Re) : "";
284
+ return typeof r == "function" && ce.set(r, tr), tr;
285
+ }
286
+ function l(r, o, b) {
287
+ return we(r, !1);
288
+ }
289
+ function m(r) {
290
+ var o = r.prototype;
291
+ return !!(o && o.isReactComponent);
292
+ }
293
+ function A(r, o, b) {
294
+ if (r == null)
295
+ return "";
296
+ if (typeof r == "function")
297
+ return we(r, m(r));
298
+ if (typeof r == "string")
299
+ return de(r);
300
+ switch (r) {
301
+ case v:
302
+ return de("Suspense");
303
+ case f:
304
+ return de("SuspenseList");
305
+ }
306
+ if (typeof r == "object")
307
+ switch (r.$$typeof) {
308
+ case y:
309
+ return l(r.render);
310
+ case u:
311
+ return A(r.type, o, b);
312
+ case g: {
313
+ var k = r, I = k._payload, Y = k._init;
314
+ try {
315
+ return A(Y(I), o, b);
316
+ } catch {
317
+ }
318
+ }
319
+ }
320
+ return "";
321
+ }
322
+ var H = Object.prototype.hasOwnProperty, z = {}, te = R.ReactDebugCurrentFrame;
323
+ function X(r) {
324
+ if (r) {
325
+ var o = r._owner, b = A(r.type, r._source, o ? o.type : null);
326
+ te.setExtraStackFrame(b);
327
+ } else
328
+ te.setExtraStackFrame(null);
329
+ }
330
+ function ue(r, o, b, k, I) {
331
+ {
332
+ var Y = Function.call.bind(H);
333
+ for (var D in r)
334
+ if (Y(r, D)) {
335
+ var _ = void 0;
336
+ try {
337
+ if (typeof r[D] != "function") {
338
+ var re = Error((k || "React class") + ": " + b + " type `" + D + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[D] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
339
+ throw re.name = "Invariant Violation", re;
340
+ }
341
+ _ = r[D](o, D, k, b, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
342
+ } catch (q) {
343
+ _ = q;
344
+ }
345
+ _ && !(_ instanceof Error) && (X(I), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", k || "React class", b, D, typeof _), X(null)), _ instanceof Error && !(_.message in z) && (z[_.message] = !0, X(I), w("Failed %s type: %s", b, _.message), X(null));
346
+ }
347
+ }
348
+ }
349
+ var je = Array.isArray;
350
+ function j(r) {
351
+ return je(r);
352
+ }
353
+ function F(r) {
354
+ {
355
+ var o = typeof Symbol == "function" && Symbol.toStringTag, b = o && r[Symbol.toStringTag] || r.constructor.name || "Object";
356
+ return b;
357
+ }
358
+ }
359
+ function K(r) {
360
+ try {
361
+ return le(r), !1;
362
+ } catch {
363
+ return !0;
364
+ }
365
+ }
366
+ function le(r) {
367
+ return "" + r;
368
+ }
369
+ function ee(r) {
370
+ if (K(r))
371
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", F(r)), le(r);
372
+ }
373
+ var We = R.ReactCurrentOwner, xr = {
374
+ key: !0,
375
+ ref: !0,
376
+ __self: !0,
377
+ __source: !0
378
+ }, qe, Je;
379
+ function yr(r) {
380
+ if (H.call(r, "ref")) {
381
+ var o = Object.getOwnPropertyDescriptor(r, "ref").get;
382
+ if (o && o.isReactWarning)
383
+ return !1;
384
+ }
385
+ return r.ref !== void 0;
386
+ }
387
+ function vr(r) {
388
+ if (H.call(r, "key")) {
389
+ var o = Object.getOwnPropertyDescriptor(r, "key").get;
390
+ if (o && o.isReactWarning)
391
+ return !1;
392
+ }
393
+ return r.key !== void 0;
394
+ }
395
+ function wr(r, o) {
396
+ typeof r.ref == "string" && We.current;
397
+ }
398
+ function jr(r, o) {
399
+ {
400
+ var b = function() {
401
+ qe || (qe = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
402
+ };
403
+ b.isReactWarning = !0, Object.defineProperty(r, "key", {
404
+ get: b,
405
+ configurable: !0
406
+ });
407
+ }
408
+ }
409
+ function kr(r, o) {
410
+ {
411
+ var b = function() {
412
+ Je || (Je = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
413
+ };
414
+ b.isReactWarning = !0, Object.defineProperty(r, "ref", {
415
+ get: b,
416
+ configurable: !0
417
+ });
418
+ }
419
+ }
420
+ var Sr = function(r, o, b, k, I, Y, D) {
421
+ var _ = {
422
+ // This tag allows us to uniquely identify this as a React Element
423
+ $$typeof: c,
424
+ // Built-in properties that belong on the element
425
+ type: r,
426
+ key: o,
427
+ ref: b,
428
+ props: D,
429
+ // Record the component responsible for creating this element.
430
+ _owner: Y
431
+ };
432
+ return _._store = {}, Object.defineProperty(_._store, "validated", {
433
+ configurable: !1,
434
+ enumerable: !1,
435
+ writable: !0,
436
+ value: !1
437
+ }), Object.defineProperty(_, "_self", {
438
+ configurable: !1,
439
+ enumerable: !1,
440
+ writable: !1,
441
+ value: k
442
+ }), Object.defineProperty(_, "_source", {
443
+ configurable: !1,
444
+ enumerable: !1,
445
+ writable: !1,
446
+ value: I
447
+ }), Object.freeze && (Object.freeze(_.props), Object.freeze(_)), _;
448
+ };
449
+ function Nr(r, o, b, k, I) {
450
+ {
451
+ var Y, D = {}, _ = null, re = null;
452
+ b !== void 0 && (ee(b), _ = "" + b), vr(o) && (ee(o.key), _ = "" + o.key), yr(o) && (re = o.ref, wr(o, I));
453
+ for (Y in o)
454
+ H.call(o, Y) && !xr.hasOwnProperty(Y) && (D[Y] = o[Y]);
455
+ if (r && r.defaultProps) {
456
+ var q = r.defaultProps;
457
+ for (Y in q)
458
+ D[Y] === void 0 && (D[Y] = q[Y]);
459
+ }
460
+ if (_ || re) {
461
+ var J = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
462
+ _ && jr(D, J), re && kr(D, J);
463
+ }
464
+ return Sr(r, _, re, I, k, We.current, D);
465
+ }
466
+ }
467
+ var Ie = R.ReactCurrentOwner, Ze = R.ReactDebugCurrentFrame;
468
+ function Ce(r) {
469
+ if (r) {
470
+ var o = r._owner, b = A(r.type, r._source, o ? o.type : null);
471
+ Ze.setExtraStackFrame(b);
472
+ } else
473
+ Ze.setExtraStackFrame(null);
474
+ }
475
+ var Le;
476
+ Le = !1;
477
+ function Be(r) {
478
+ return typeof r == "object" && r !== null && r.$$typeof === c;
479
+ }
480
+ function Xe() {
481
+ {
482
+ if (Ie.current) {
483
+ var r = O(Ie.current.type);
484
+ if (r)
485
+ return `
486
+
487
+ Check the render method of \`` + r + "`.";
488
+ }
489
+ return "";
490
+ }
491
+ }
492
+ function Cr(r) {
493
+ return "";
494
+ }
495
+ var Qe = {};
496
+ function Rr(r) {
497
+ {
498
+ var o = Xe();
499
+ if (!o) {
500
+ var b = typeof r == "string" ? r : r.displayName || r.name;
501
+ b && (o = `
502
+
503
+ Check the top-level render call using <` + b + ">.");
504
+ }
505
+ return o;
506
+ }
507
+ }
508
+ function er(r, o) {
509
+ {
510
+ if (!r._store || r._store.validated || r.key != null)
511
+ return;
512
+ r._store.validated = !0;
513
+ var b = Rr(o);
514
+ if (Qe[b])
515
+ return;
516
+ Qe[b] = !0;
517
+ var k = "";
518
+ r && r._owner && r._owner !== Ie.current && (k = " It was passed a child from " + O(r._owner.type) + "."), Ce(r), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', b, k), Ce(null);
519
+ }
520
+ }
521
+ function rr(r, o) {
522
+ {
523
+ if (typeof r != "object")
524
+ return;
525
+ if (j(r))
526
+ for (var b = 0; b < r.length; b++) {
527
+ var k = r[b];
528
+ Be(k) && er(k, o);
529
+ }
530
+ else if (Be(r))
531
+ r._store && (r._store.validated = !0);
532
+ else if (r) {
533
+ var I = M(r);
534
+ if (typeof I == "function" && I !== r.entries)
535
+ for (var Y = I.call(r), D; !(D = Y.next()).done; )
536
+ Be(D.value) && er(D.value, o);
537
+ }
538
+ }
539
+ }
540
+ function Mr(r) {
541
+ {
542
+ var o = r.type;
543
+ if (o == null || typeof o == "string")
544
+ return;
545
+ var b;
546
+ if (typeof o == "function")
547
+ b = o.propTypes;
548
+ else if (typeof o == "object" && (o.$$typeof === y || // Note: Memo only checks outer props here.
549
+ // Inner props are checked in the reconciler.
550
+ o.$$typeof === u))
551
+ b = o.propTypes;
552
+ else
553
+ return;
554
+ if (b) {
555
+ var k = O(o);
556
+ ue(b, r.props, "prop", k, r);
557
+ } else if (o.PropTypes !== void 0 && !Le) {
558
+ Le = !0;
559
+ var I = O(o);
560
+ w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", I || "Unknown");
561
+ }
562
+ typeof o.getDefaultProps == "function" && !o.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
563
+ }
564
+ }
565
+ function Er(r) {
566
+ {
567
+ for (var o = Object.keys(r.props), b = 0; b < o.length; b++) {
568
+ var k = o[b];
569
+ if (k !== "children" && k !== "key") {
570
+ Ce(r), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", k), Ce(null);
571
+ break;
572
+ }
573
+ }
574
+ r.ref !== null && (Ce(r), w("Invalid attribute `ref` supplied to `React.Fragment`."), Ce(null));
575
+ }
576
+ }
577
+ function ar(r, o, b, k, I, Y) {
578
+ {
579
+ var D = G(r);
580
+ if (!D) {
581
+ var _ = "";
582
+ (r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (_ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
583
+ var re = Cr();
584
+ re ? _ += re : _ += Xe();
585
+ var q;
586
+ r === null ? q = "null" : j(r) ? q = "array" : r !== void 0 && r.$$typeof === c ? (q = "<" + (O(r.type) || "Unknown") + " />", _ = " Did you accidentally export a JSX literal instead of a component?") : q = typeof r, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, _);
587
+ }
588
+ var J = Nr(r, o, b, I, Y);
589
+ if (J == null)
590
+ return J;
591
+ if (D) {
592
+ var ne = o.children;
593
+ if (ne !== void 0)
594
+ if (k)
595
+ if (j(ne)) {
596
+ for (var Re = 0; Re < ne.length; Re++)
597
+ rr(ne[Re], r);
598
+ Object.freeze && Object.freeze(ne);
599
+ } else
600
+ w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
601
+ else
602
+ rr(ne, r);
603
+ }
604
+ return r === i ? Er(J) : Mr(J), J;
605
+ }
606
+ }
607
+ function Tr(r, o, b) {
608
+ return ar(r, o, b, !0);
609
+ }
610
+ function _r(r, o, b) {
611
+ return ar(r, o, b, !1);
612
+ }
613
+ var Pr = _r, Or = Tr;
614
+ Pe.Fragment = i, Pe.jsx = Pr, Pe.jsxs = Or;
615
+ }()), Pe;
616
+ }
617
+ process.env.NODE_ENV === "production" ? Ue.exports = Kr() : Ue.exports = Ur();
618
+ var e = Ue.exports;
619
+ const ur = (h, c = "DD MMM YYYY") => {
620
+ if (!h) return "N/A";
621
+ const s = new Date(h);
622
+ if (isNaN(s)) return "Invalid Date";
623
+ const i = (t) => String(t).padStart(2, "0"), d = {
624
+ YYYY: s.getFullYear(),
625
+ YY: String(s.getFullYear()).slice(-2),
626
+ MMMM: s.toLocaleString("en-US", { month: "long" }),
627
+ MMM: s.toLocaleString("en-US", { month: "short" }),
628
+ MM: i(s.getMonth() + 1),
629
+ M: s.getMonth() + 1,
630
+ DD: i(s.getDate()),
631
+ D: s.getDate(),
632
+ dddd: s.toLocaleString("en-US", { weekday: "long" }),
633
+ ddd: s.toLocaleString("en-US", { weekday: "short" }),
634
+ HH: i(s.getHours()),
635
+ hh: i(s.getHours() % 12 || 12),
636
+ mm: i(s.getMinutes()),
637
+ ss: i(s.getSeconds()),
638
+ A: s.getHours() >= 12 ? "PM" : "AM"
639
+ };
640
+ return c.replace(
641
+ /YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
642
+ (t) => d[t]
643
+ );
644
+ }, zr = (h, c, s = []) => {
645
+ if (!(c != null && c.trim())) return h;
646
+ const i = c.toLowerCase(), d = (t) => t == null ? [] : typeof t == "object" ? Object.values(t).flatMap(d) : [String(t)];
647
+ return h.filter((t) => {
648
+ let n = [];
649
+ return s.length > 0 ? s.forEach((N) => {
650
+ t[N] !== void 0 && n.push(...d(t[N]));
651
+ }) : n = d(t), n.some(
652
+ (N) => N.toLowerCase().includes(i)
653
+ );
654
+ });
655
+ }, Me = Oe.forwardRef(
656
+ ({
657
+ className: h = "",
658
+ variant: c = "contained",
659
+ color: s = "default",
660
+ size: i = "default",
661
+ fullWidth: d = !1,
662
+ children: t,
663
+ ...n
664
+ }, N) => {
665
+ var p;
666
+ const y = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", v = {
667
+ sm: "h-8 px-3 rounded-md text-sm",
668
+ md: "h-9 px-4 rounded-md text-sm",
669
+ lg: "h-11 px-6 rounded-md text-base",
670
+ xl: "h-12 px-8 rounded-lg text-lg",
671
+ default: "h-9 px-4 rounded-md text-sm"
672
+ }, f = {
673
+ primary: {
674
+ contained: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 shadow-sm",
675
+ outlined: "border border-blue-600 bg-transparent text-blue-600 hover:bg-blue-50 focus:ring-blue-500",
676
+ text: "bg-transparent text-blue-600 hover:bg-blue-50 focus:ring-blue-500"
677
+ },
678
+ success: {
679
+ contained: "bg-green-600 text-white hover:bg-green-700 focus:ring-green-500 shadow-sm",
680
+ outlined: "border border-green-600 bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500",
681
+ text: "bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500"
682
+ },
683
+ error: {
684
+ contained: "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500 shadow-sm",
685
+ outlined: "border border-red-600 bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500",
686
+ text: "bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500"
687
+ },
688
+ default: {
689
+ contained: "border bg-gray-200 text-gray-800 hover:bg-gray-300 focus:ring-gray-300 shadow-sm dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600 dark:focus:ring-gray-600",
690
+ outlined: "border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",
691
+ text: "bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"
692
+ }
693
+ }, u = ((p = f[s]) == null ? void 0 : p[c]) || f.default.contained, g = v[i], C = `
694
+ ${y}
695
+ ${u}
696
+ ${g}
697
+ ${d ? "w-full" : ""}
698
+ ${h}
699
+ `.trim();
700
+ return /* @__PURE__ */ e.jsx(
701
+ "button",
702
+ {
703
+ ref: N,
704
+ type: n.type || "button",
705
+ className: C,
706
+ ...n,
707
+ children: t
708
+ }
709
+ );
710
+ }
711
+ );
712
+ Me.displayName = "Button";
713
+ function be({ label: h, required: c = !1 }) {
714
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
715
+ h,
716
+ c && /* @__PURE__ */ e.jsx("span", { className: "ml-1", children: "*" })
717
+ ] }) });
718
+ }
719
+ const Hr = ({
720
+ options: h = [],
721
+ value: c,
722
+ onChange: s,
723
+ placeholder: i = "Select option",
724
+ className: d = "",
725
+ disabled: t = !1,
726
+ search: n = !1,
727
+ label: N = "",
728
+ required: y = !1,
729
+ name: v = "",
730
+ parentClass: f = "",
731
+ multiple: u = !1,
732
+ // ✅ NEW
733
+ dropdownMaxHeight: g = ""
734
+ }) => {
735
+ var T;
736
+ const [C, p] = P(!1), [E, M] = P(""), [R, w] = P(!0), L = ke(null), U = ke(null), V = (S) => String(typeof S == "boolean" ? S : S ?? ""), Z = u ? (c || []).map(V) : V(c), $ = h.filter(
737
+ (S) => S.label.toLowerCase().includes(E.toLowerCase())
738
+ ), x = (S) => {
739
+ const O = V(S);
740
+ return u ? Z.includes(O) : O === Z;
741
+ };
742
+ ae(() => {
743
+ const S = (O) => {
744
+ L.current && !L.current.contains(O.target) && (p(!1), M(""));
745
+ };
746
+ return document.addEventListener("mousedown", S), () => document.removeEventListener("mousedown", S);
747
+ }, []), ae(() => {
748
+ if (C && L.current) {
749
+ const S = L.current.getBoundingClientRect(), W = window.innerHeight - S.bottom;
750
+ w(W < 200);
751
+ }
752
+ }, [C]), ae(() => {
753
+ C && U.current && U.current.focus();
754
+ }, [C]);
755
+ const B = (S) => {
756
+ let O = S;
757
+ if (S === "true" ? O = !0 : S === "false" && (O = !1), u) {
758
+ const W = Z.includes(V(S));
759
+ let Q;
760
+ W ? Q = c.filter(
761
+ (oe) => V(oe) !== V(S)
762
+ ) : Q = [...c || [], O], s(Q);
763
+ } else
764
+ s(O), p(!1);
765
+ M("");
766
+ }, G = u ? h.filter((S) => x(S.value)).map((S) => S.label).join(", ") : (T = h.find((S) => x(S.value))) == null ? void 0 : T.label;
767
+ return /* @__PURE__ */ e.jsxs("div", { className: f || "col-span-12", children: [
768
+ /* @__PURE__ */ e.jsx(be, { label: N, required: y }),
769
+ /* @__PURE__ */ e.jsxs("div", { className: `relative ${d}`, ref: L, children: [
770
+ /* @__PURE__ */ e.jsxs(
771
+ "button",
772
+ {
773
+ type: "button",
774
+ onClick: () => !t && p(!C),
775
+ disabled: t,
776
+ className: `w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
777
+ ${G ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
778
+ ${t ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
779
+ children: [
780
+ /* @__PURE__ */ e.jsx("span", { className: "truncate", children: G || i }),
781
+ /* @__PURE__ */ e.jsx(
782
+ dr,
783
+ {
784
+ className: `w-4 h-4 transition-transform ${C ? "rotate-180" : ""}`
785
+ }
786
+ )
787
+ ]
788
+ }
789
+ ),
790
+ C && /* @__PURE__ */ e.jsxs(
791
+ "div",
792
+ {
793
+ className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
794
+ ${R ? "bottom-full mb-1" : "top-full mt-1"}`,
795
+ children: [
796
+ n && /* @__PURE__ */ e.jsx("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
797
+ /* @__PURE__ */ e.jsx(ze, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
798
+ /* @__PURE__ */ e.jsx(
799
+ "input",
800
+ {
801
+ ref: U,
802
+ type: "text",
803
+ value: E,
804
+ onChange: (S) => M(S.target.value),
805
+ placeholder: "Search...",
806
+ className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
807
+ }
808
+ )
809
+ ] }) }),
810
+ /* @__PURE__ */ e.jsx(
811
+ "div",
812
+ {
813
+ className: "max-h-40 overflow-y-auto",
814
+ style: {
815
+ maxHeight: g || ""
816
+ },
817
+ children: $.length > 0 ? $.map((S) => /* @__PURE__ */ e.jsxs(
818
+ "button",
819
+ {
820
+ type: "button",
821
+ onClick: () => B(String(S.value)),
822
+ className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
823
+ ${x(S.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
824
+ children: [
825
+ /* @__PURE__ */ e.jsx("span", { children: S.label }),
826
+ u && x(S.value) && /* @__PURE__ */ e.jsx(Fr, { className: "w-4 h-4" })
827
+ ]
828
+ },
829
+ String(S.value)
830
+ )) : /* @__PURE__ */ e.jsx("div", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No options found" })
831
+ }
832
+ )
833
+ ]
834
+ }
835
+ )
836
+ ] })
837
+ ] }, v);
838
+ }, Vr = ({
839
+ value: h = !0,
840
+ onChange: c,
841
+ text: s,
842
+ options: i = [],
843
+ label: d,
844
+ required: t,
845
+ name: n = "",
846
+ disabled: N = !1,
847
+ parentClass: y = ""
848
+ }) => {
849
+ const v = i.length > 0 ? i : [
850
+ { label: "Active", value: !0 },
851
+ { label: "Inactive", value: !1 }
852
+ ];
853
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: y || "col-span-12", children: [
854
+ /* @__PURE__ */ e.jsx(be, { label: d, required: t }),
855
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
856
+ s && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: s }),
857
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-6", children: v.map((f, u) => /* @__PURE__ */ e.jsxs(
858
+ "label",
859
+ {
860
+ className: "flex items-center gap-2 cursor-pointer select-none",
861
+ children: [
862
+ /* @__PURE__ */ e.jsx(
863
+ "input",
864
+ {
865
+ type: "radio",
866
+ name: "switch-field",
867
+ required: t && u === 0,
868
+ value: f.value,
869
+ disabled: N,
870
+ checked: h === f.value,
871
+ onChange: () => c(f.value),
872
+ className: "w-4 h-4 border-gray-300 cursor-pointer"
873
+ }
874
+ ),
875
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-700 dark:text-white", children: f.label })
876
+ ]
877
+ },
878
+ u
879
+ )) })
880
+ ] })
881
+ ] }, n) });
882
+ }, Fe = [
883
+ { label: "Afghanistan", code: "AF", phone: "93" },
884
+ { label: "Aland Islands", code: "AX", phone: "358" },
885
+ { label: "Albania", code: "AL", phone: "355" },
886
+ { label: "Algeria", code: "DZ", phone: "213" },
887
+ { label: "American Samoa", code: "AS", phone: "1" },
888
+ { label: "Andorra", code: "AD", phone: "376" },
889
+ { label: "Angola", code: "AO", phone: "244" },
890
+ { label: "Anguilla", code: "AI", phone: "1" },
891
+ { label: "Antarctica", code: "AQ", phone: "672" },
892
+ { label: "Antigua and Barbuda", code: "AG", phone: "1" },
893
+ { label: "Argentina", code: "AR", phone: "54" },
894
+ { label: "Armenia", code: "AM", phone: "374" },
895
+ { label: "Aruba", code: "AW", phone: "297" },
896
+ { label: "Australia", code: "AU", phone: "61" },
897
+ { label: "Austria", code: "AT", phone: "43" },
898
+ { label: "Azerbaijan", code: "AZ", phone: "994" },
899
+ { label: "Bahrain", code: "BH", phone: "973" },
900
+ { label: "Bangladesh", code: "BD", phone: "880" },
901
+ { label: "Barbados", code: "BB", phone: "1" },
902
+ { label: "Belarus", code: "BY", phone: "375" },
903
+ { label: "Belgium", code: "BE", phone: "32" },
904
+ { label: "Belize", code: "BZ", phone: "501" },
905
+ { label: "Benin", code: "BJ", phone: "229" },
906
+ { label: "Bermuda", code: "BM", phone: "1" },
907
+ { label: "Bhutan", code: "BT", phone: "975" },
908
+ { label: "Bolivia", code: "BO", phone: "591" },
909
+ { label: "Bonaire, Sint Eustatius and Saba", code: "BQ", phone: "599" },
910
+ { label: "Bosnia and Herzegovina", code: "BA", phone: "387" },
911
+ { label: "Botswana", code: "BW", phone: "267" },
912
+ { label: "Bouvet Island", code: "BV", phone: "0055" },
913
+ { label: "Brazil", code: "BR", phone: "55" },
914
+ { label: "British Indian Ocean Territory", code: "IO", phone: "246" },
915
+ { label: "Brunei", code: "BN", phone: "673" },
916
+ { label: "Bulgaria", code: "BG", phone: "359" },
917
+ { label: "Burkina Faso", code: "BF", phone: "226" },
918
+ { label: "Burundi", code: "BI", phone: "257" },
919
+ { label: "Cambodia", code: "KH", phone: "855" },
920
+ { label: "Cameroon", code: "CM", phone: "237" },
921
+ { label: "Canada", code: "CA", phone: "1" },
922
+ { label: "Cape Verde", code: "CV", phone: "238" },
923
+ { label: "Cayman Islands", code: "KY", phone: "1" },
924
+ { label: "Central African Republic", code: "CF", phone: "236" },
925
+ { label: "Chad", code: "TD", phone: "235" },
926
+ { label: "Chile", code: "CL", phone: "56" },
927
+ { label: "China", code: "CN", phone: "86" },
928
+ { label: "Christmas Island", code: "CX", phone: "61" },
929
+ { label: "Cocos (Keeling) Islands", code: "CC", phone: "61" },
930
+ { label: "Colombia", code: "CO", phone: "57" },
931
+ { label: "Comoros", code: "KM", phone: "269" },
932
+ { label: "Congo", code: "CG", phone: "242" },
933
+ { label: "Cook Islands", code: "CK", phone: "682" },
934
+ { label: "Costa Rica", code: "CR", phone: "506" },
935
+ { label: "Croatia", code: "HR", phone: "385" },
936
+ { label: "Cuba", code: "CU", phone: "53" },
937
+ { label: "Curaçao", code: "CW", phone: "599" },
938
+ { label: "Cyprus", code: "CY", phone: "357" },
939
+ { label: "Czech Republic", code: "CZ", phone: "420" },
940
+ { label: "Democratic Republic of the Congo", code: "CD", phone: "243" },
941
+ { label: "Denmark", code: "DK", phone: "45" },
942
+ { label: "Djibouti", code: "DJ", phone: "253" },
943
+ { label: "Dominica", code: "DM", phone: "1" },
944
+ { label: "Dominican Republic", code: "DO", phone: "1" },
945
+ { label: "Ecuador", code: "EC", phone: "593" },
946
+ { label: "Egypt", code: "EG", phone: "20" },
947
+ { label: "El Salvador", code: "SV", phone: "503" },
948
+ { label: "Equatorial Guinea", code: "GQ", phone: "240" },
949
+ { label: "Eritrea", code: "ER", phone: "291" },
950
+ { label: "Estonia", code: "EE", phone: "372" },
951
+ { label: "Eswatini", code: "SZ", phone: "268" },
952
+ { label: "Ethiopia", code: "ET", phone: "251" },
953
+ { label: "Falkland Islands", code: "FK", phone: "500" },
954
+ { label: "Faroe Islands", code: "FO", phone: "298" },
955
+ { label: "Fiji Islands", code: "FJ", phone: "679" },
956
+ { label: "Finland", code: "FI", phone: "358" },
957
+ { label: "France", code: "FR", phone: "33" },
958
+ { label: "French Guiana", code: "GF", phone: "594" },
959
+ { label: "French Polynesia", code: "PF", phone: "689" },
960
+ { label: "French Southern Territories", code: "TF", phone: "262" },
961
+ { label: "Gabon", code: "GA", phone: "241" },
962
+ { label: "Georgia", code: "GE", phone: "995" },
963
+ { label: "Germany", code: "DE", phone: "49" },
964
+ { label: "Ghana", code: "GH", phone: "233" },
965
+ { label: "Gibraltar", code: "GI", phone: "350" },
966
+ { label: "Greece", code: "GR", phone: "30" },
967
+ { label: "Greenland", code: "GL", phone: "299" },
968
+ { label: "Grenada", code: "GD", phone: "1" },
969
+ { label: "Guadeloupe", code: "GP", phone: "590" },
970
+ { label: "Guam", code: "GU", phone: "1" },
971
+ { label: "Guatemala", code: "GT", phone: "502" },
972
+ { label: "Guernsey", code: "GG", phone: "44" },
973
+ { label: "Guinea", code: "GN", phone: "224" },
974
+ { label: "Guinea-Bissau", code: "GW", phone: "245" },
975
+ { label: "Guyana", code: "GY", phone: "592" },
976
+ { label: "Haiti", code: "HT", phone: "509" },
977
+ { label: "Heard Island and McDonald Islands", code: "HM", phone: "672" },
978
+ { label: "Honduras", code: "HN", phone: "504" },
979
+ { label: "Hong Kong S.A.R.", code: "HK", phone: "852" },
980
+ { label: "Hungary", code: "HU", phone: "36" },
981
+ { label: "Iceland", code: "IS", phone: "354" },
982
+ { label: "India", code: "IN", phone: "91" },
983
+ { label: "Indonesia", code: "ID", phone: "62" },
984
+ { label: "Iran", code: "IR", phone: "98" },
985
+ { label: "Iraq", code: "IQ", phone: "964" },
986
+ { label: "Ireland", code: "IE", phone: "353" },
987
+ { label: "Israel", code: "IL", phone: "972" },
988
+ { label: "Italy", code: "IT", phone: "39" },
989
+ { label: "Ivory Coast", code: "CI", phone: "225" },
990
+ { label: "Jamaica", code: "JM", phone: "1" },
991
+ { label: "Japan", code: "JP", phone: "81" },
992
+ { label: "Jersey", code: "JE", phone: "44" },
993
+ { label: "Jordan", code: "JO", phone: "962" },
994
+ { label: "Kazakhstan", code: "KZ", phone: "7" },
995
+ { label: "Kenya", code: "KE", phone: "254" },
996
+ { label: "Kiribati", code: "KI", phone: "686" },
997
+ { label: "Kosovo", code: "XK", phone: "383" },
998
+ { label: "Kuwait", code: "KW", phone: "965" },
999
+ { label: "Kyrgyzstan", code: "KG", phone: "996" },
1000
+ { label: "Laos", code: "LA", phone: "856" },
1001
+ { label: "Latvia", code: "LV", phone: "371" },
1002
+ { label: "Lebanon", code: "LB", phone: "961" },
1003
+ { label: "Lesotho", code: "LS", phone: "266" },
1004
+ { label: "Liberia", code: "LR", phone: "231" },
1005
+ { label: "Libya", code: "LY", phone: "218" },
1006
+ { label: "Liechtenstein", code: "LI", phone: "423" },
1007
+ { label: "Lithuania", code: "LT", phone: "370" },
1008
+ { label: "Luxembourg", code: "LU", phone: "352" },
1009
+ { label: "Macau S.A.R.", code: "MO", phone: "853" },
1010
+ { label: "Madagascar", code: "MG", phone: "261" },
1011
+ { label: "Malawi", code: "MW", phone: "265" },
1012
+ { label: "Malaysia", code: "MY", phone: "60" },
1013
+ { label: "Maldives", code: "MV", phone: "960" },
1014
+ { label: "Mali", code: "ML", phone: "223" },
1015
+ { label: "Malta", code: "MT", phone: "356" },
1016
+ { label: "Man (Isle of)", code: "IM", phone: "44" },
1017
+ { label: "Marshall Islands", code: "MH", phone: "692" },
1018
+ { label: "Martinique", code: "MQ", phone: "596" },
1019
+ { label: "Mauritania", code: "MR", phone: "222" },
1020
+ { label: "Mauritius", code: "MU", phone: "230" },
1021
+ { label: "Mayotte", code: "YT", phone: "262" },
1022
+ { label: "Mexico", code: "MX", phone: "52" },
1023
+ { label: "Micronesia", code: "FM", phone: "691" },
1024
+ { label: "Moldova", code: "MD", phone: "373" },
1025
+ { label: "Monaco", code: "MC", phone: "377" },
1026
+ { label: "Mongolia", code: "MN", phone: "976" },
1027
+ { label: "Montenegro", code: "ME", phone: "382" },
1028
+ { label: "Montserrat", code: "MS", phone: "1" },
1029
+ { label: "Morocco", code: "MA", phone: "212" },
1030
+ { label: "Mozambique", code: "MZ", phone: "258" },
1031
+ { label: "Myanmar", code: "MM", phone: "95" },
1032
+ { label: "Namibia", code: "NA", phone: "264" },
1033
+ { label: "Nauru", code: "NR", phone: "674" },
1034
+ { label: "Nepal", code: "NP", phone: "977" },
1035
+ { label: "Netherlands", code: "NL", phone: "31" },
1036
+ { label: "New Caledonia", code: "NC", phone: "687" },
1037
+ { label: "New Zealand", code: "NZ", phone: "64" },
1038
+ { label: "Nicaragua", code: "NI", phone: "505" },
1039
+ { label: "Niger", code: "NE", phone: "227" },
1040
+ { label: "Nigeria", code: "NG", phone: "234" },
1041
+ { label: "Niue", code: "NU", phone: "683" },
1042
+ { label: "Norfolk Island", code: "NF", phone: "672" },
1043
+ { label: "North Korea", code: "KP", phone: "850" },
1044
+ { label: "North Macedonia", code: "MK", phone: "389" },
1045
+ { label: "Northern Mariana Islands", code: "MP", phone: "1" },
1046
+ { label: "Norway", code: "NO", phone: "47" },
1047
+ { label: "Oman", code: "OM", phone: "968" },
1048
+ { label: "Pakistan", code: "PK", phone: "92" },
1049
+ { label: "Palau", code: "PW", phone: "680" },
1050
+ { label: "Palestinian Territory Occupied", code: "PS", phone: "970" },
1051
+ { label: "Panama", code: "PA", phone: "507" },
1052
+ { label: "Papua New Guinea", code: "PG", phone: "675" },
1053
+ { label: "Paraguay", code: "PY", phone: "595" },
1054
+ { label: "Peru", code: "PE", phone: "51" },
1055
+ { label: "Philippines", code: "PH", phone: "63" },
1056
+ { label: "Pitcairn Island", code: "PN", phone: "870" },
1057
+ { label: "Poland", code: "PL", phone: "48" },
1058
+ { label: "Portugal", code: "PT", phone: "351" },
1059
+ { label: "Puerto Rico", code: "PR", phone: "1" },
1060
+ { label: "Qatar", code: "QA", phone: "974" },
1061
+ { label: "Reunion", code: "RE", phone: "262" },
1062
+ { label: "Romania", code: "RO", phone: "40" },
1063
+ { label: "Russia", code: "RU", phone: "7" },
1064
+ { label: "Rwanda", code: "RW", phone: "250" },
1065
+ { label: "Saint Helena", code: "SH", phone: "290" },
1066
+ { label: "Saint Kitts and Nevis", code: "KN", phone: "1" },
1067
+ { label: "Saint Lucia", code: "LC", phone: "1" },
1068
+ { label: "Saint Pierre and Miquelon", code: "PM", phone: "508" },
1069
+ { label: "Saint Vincent and the Grenadines", code: "VC", phone: "1" },
1070
+ { label: "Saint-Barthelemy", code: "BL", phone: "590" },
1071
+ { label: "Saint-Martin (French part)", code: "MF", phone: "590" },
1072
+ { label: "Samoa", code: "WS", phone: "685" },
1073
+ { label: "San Marino", code: "SM", phone: "378" },
1074
+ { label: "Sao Tome and Principe", code: "ST", phone: "239" },
1075
+ { label: "Saudi Arabia", code: "SA", phone: "966" },
1076
+ { label: "Senegal", code: "SN", phone: "221" },
1077
+ { label: "Serbia", code: "RS", phone: "381" },
1078
+ { label: "Seychelles", code: "SC", phone: "248" },
1079
+ { label: "Sierra Leone", code: "SL", phone: "232" },
1080
+ { label: "Singapore", code: "SG", phone: "65" },
1081
+ { label: "Sint Maarten (Dutch part)", code: "SX", phone: "1721" },
1082
+ { label: "Slovakia", code: "SK", phone: "421" },
1083
+ { label: "Slovenia", code: "SI", phone: "386" },
1084
+ { label: "Solomon Islands", code: "SB", phone: "677" },
1085
+ { label: "Somalia", code: "SO", phone: "252" },
1086
+ { label: "South Africa", code: "ZA", phone: "27" },
1087
+ { label: "South Georgia", code: "GS", phone: "500" },
1088
+ { label: "South Korea", code: "KR", phone: "82" },
1089
+ { label: "South Sudan", code: "SS", phone: "211" },
1090
+ { label: "Spain", code: "ES", phone: "34" },
1091
+ { label: "Sri Lanka", code: "LK", phone: "94" },
1092
+ { label: "Sudan", code: "SD", phone: "249" },
1093
+ { label: "Suriname", code: "SR", phone: "597" },
1094
+ { label: "Svalbard and Jan Mayen Islands", code: "SJ", phone: "47" },
1095
+ { label: "Sweden", code: "SE", phone: "46" },
1096
+ { label: "Switzerland", code: "CH", phone: "41" },
1097
+ { label: "Syria", code: "SY", phone: "963" },
1098
+ { label: "Taiwan", code: "TW", phone: "886" },
1099
+ { label: "Tajikistan", code: "TJ", phone: "992" },
1100
+ { label: "Tanzania", code: "TZ", phone: "255" },
1101
+ { label: "Thailand", code: "TH", phone: "66" },
1102
+ { label: "The Bahamas", code: "BS", phone: "1" },
1103
+ { label: "The Gambia", code: "GM", phone: "220" },
1104
+ { label: "Timor-Leste", code: "TL", phone: "670" },
1105
+ { label: "Togo", code: "TG", phone: "228" },
1106
+ { label: "Tokelau", code: "TK", phone: "690" },
1107
+ { label: "Tonga", code: "TO", phone: "676" },
1108
+ { label: "Trinidad and Tobago", code: "TT", phone: "1" },
1109
+ { label: "Tunisia", code: "TN", phone: "216" },
1110
+ { label: "Turkey", code: "TR", phone: "90" },
1111
+ { label: "Turkmenistan", code: "TM", phone: "993" },
1112
+ { label: "Turks and Caicos Islands", code: "TC", phone: "1" },
1113
+ { label: "Tuvalu", code: "TV", phone: "688" },
1114
+ { label: "Uganda", code: "UG", phone: "256" },
1115
+ { label: "Ukraine", code: "UA", phone: "380" },
1116
+ { label: "United Arab Emirates", code: "AE", phone: "971" },
1117
+ { label: "United Kingdom", code: "GB", phone: "44" },
1118
+ { label: "United States", code: "US", phone: "1" },
1119
+ { label: "United States Minor Outlying Islands", code: "UM", phone: "1" },
1120
+ { label: "Uruguay", code: "UY", phone: "598" },
1121
+ { label: "Uzbekistan", code: "UZ", phone: "998" },
1122
+ { label: "Vanuatu", code: "VU", phone: "678" },
1123
+ { label: "Vatican City State (Holy See)", code: "VA", phone: "379" },
1124
+ { label: "Venezuela", code: "VE", phone: "58" },
1125
+ { label: "Vietnam", code: "VN", phone: "84" },
1126
+ { label: "Virgin Islands (British)", code: "VG", phone: "1" },
1127
+ { label: "Virgin Islands (US)", code: "VI", phone: "1" },
1128
+ { label: "Wallis and Futuna Islands", code: "WF", phone: "681" },
1129
+ { label: "Western Sahara", code: "EH", phone: "212" },
1130
+ { label: "Yemen", code: "YE", phone: "967" },
1131
+ { label: "Zambia", code: "ZM", phone: "260" },
1132
+ { label: "Zimbabwe", code: "ZW", phone: "263" }
1133
+ ];
1134
+ function Wr({
1135
+ label: h = "",
1136
+ value: c = "",
1137
+ name: s = "",
1138
+ parentClass: i = "",
1139
+ onChange: d,
1140
+ disabled: t = !1,
1141
+ required: n = !1,
1142
+ placeholder: N = "Phone number",
1143
+ search: y = !1,
1144
+ countriesList: v = !1,
1145
+ defaultCountry: f = ""
1146
+ }) {
1147
+ const u = (x) => Fe.find((B) => B.code == x), [g, C] = P(
1148
+ u(f) || Fe[0]
1149
+ ), [p, E] = P(""), [M, R] = P(!1), [w, L] = P(""), U = ke();
1150
+ ae(() => {
1151
+ if (typeof c == "string" && c.startsWith("+")) {
1152
+ const x = Fe.filter((B) => c.startsWith("+" + B.phone)).sort((B, G) => G.phone.length - B.phone.length)[0];
1153
+ if (x) {
1154
+ C(x), E(c.replace("+" + x.phone, ""));
1155
+ return;
1156
+ }
1157
+ }
1158
+ E(c);
1159
+ }, [c]);
1160
+ const V = (x) => {
1161
+ const B = x.target.value.replace(/\D/g, "");
1162
+ E(B), g && d && d("+" + g.phone + B);
1163
+ }, Z = (x) => {
1164
+ C(x), d && d("+" + x.phone + p), R(!1), L("");
1165
+ };
1166
+ ae(() => {
1167
+ const x = (B) => {
1168
+ U.current && !U.current.contains(B.target) && R(!1);
1169
+ };
1170
+ return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
1171
+ }, []);
1172
+ const $ = Fe.filter(
1173
+ (x) => x.label.toLowerCase().includes(w.toLowerCase()) || x.phone.includes(w)
1174
+ );
1175
+ if (!v) {
1176
+ const x = (B) => {
1177
+ const G = B.target.value.replace(/[^+\d]/g, ""), T = G.startsWith("+") ? "+" + G.replace(/[+]/g, "").slice(0) : G;
1178
+ d(T);
1179
+ };
1180
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: i || "col-span-12", children: [
1181
+ /* @__PURE__ */ e.jsx(be, { label: h, required: n }),
1182
+ /* @__PURE__ */ e.jsx(
1183
+ "input",
1184
+ {
1185
+ type: "text",
1186
+ value: c,
1187
+ onChange: x,
1188
+ placeholder: N,
1189
+ disabled: t,
1190
+ required: n,
1191
+ className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
1192
+ bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
1193
+ focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,
1194
+ inputMode: "tel",
1195
+ pattern: "^\\+\\d{1,15}$"
1196
+ }
1197
+ )
1198
+ ] }, s) });
1199
+ }
1200
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: i || "col-span-12", children: [
1201
+ /* @__PURE__ */ e.jsx(be, { label: h, required: n }),
1202
+ /* @__PURE__ */ e.jsxs("div", { className: "relative ", ref: U, children: [
1203
+ /* @__PURE__ */ e.jsxs(
1204
+ "div",
1205
+ {
1206
+ className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
1207
+ ${M ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
1208
+ ${t ? "opacity-60 cursor-not-allowed" : ""}`,
1209
+ children: [
1210
+ /* @__PURE__ */ e.jsxs(
1211
+ "button",
1212
+ {
1213
+ type: "button",
1214
+ disabled: t,
1215
+ onClick: () => R(!M),
1216
+ className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
1217
+ children: [
1218
+ g ? /* @__PURE__ */ e.jsx(
1219
+ "img",
1220
+ {
1221
+ src: `https://flagcdn.com/w20/${g.code.toLowerCase()}.png`,
1222
+ alt: g.code,
1223
+ className: "w-5 h-3 object-cover"
1224
+ }
1225
+ ) : /* @__PURE__ */ e.jsx("span", { className: "text-gray-400 text-xs", children: "🌐" }),
1226
+ /* @__PURE__ */ e.jsx(dr, { className: "w-3 h-3 text-gray-500" })
1227
+ ]
1228
+ }
1229
+ ),
1230
+ g && /* @__PURE__ */ e.jsxs("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
1231
+ "+",
1232
+ g.phone
1233
+ ] }),
1234
+ /* @__PURE__ */ e.jsx(
1235
+ "input",
1236
+ {
1237
+ type: "tel",
1238
+ value: p,
1239
+ onChange: V,
1240
+ required: n,
1241
+ disabled: t || !g,
1242
+ placeholder: g ? N : "Select a country",
1243
+ className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
1244
+ }
1245
+ ),
1246
+ /* @__PURE__ */ e.jsx(
1247
+ "input",
1248
+ {
1249
+ type: "tel",
1250
+ required: n,
1251
+ tabIndex: -1,
1252
+ readOnly: !0,
1253
+ value: g && p ? "+" + g.phone + p : "",
1254
+ style: {
1255
+ position: "absolute",
1256
+ opacity: 0,
1257
+ pointerEvents: "none",
1258
+ height: 0
1259
+ }
1260
+ }
1261
+ )
1262
+ ]
1263
+ }
1264
+ ),
1265
+ M && /* @__PURE__ */ e.jsxs("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
1266
+ y && /* @__PURE__ */ e.jsx("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
1267
+ /* @__PURE__ */ e.jsx(ze, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
1268
+ /* @__PURE__ */ e.jsx(
1269
+ "input",
1270
+ {
1271
+ type: "text",
1272
+ value: w,
1273
+ onChange: (x) => L(x.target.value),
1274
+ placeholder: "Search country...",
1275
+ className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "
1276
+ }
1277
+ )
1278
+ ] }) }),
1279
+ $.map((x) => /* @__PURE__ */ e.jsxs(
1280
+ "button",
1281
+ {
1282
+ type: "button",
1283
+ onClick: () => Z(x),
1284
+ className: "w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",
1285
+ children: [
1286
+ /* @__PURE__ */ e.jsx(
1287
+ "img",
1288
+ {
1289
+ src: `https://flagcdn.com/w20/${x.code.toLowerCase()}.png`,
1290
+ alt: x.code,
1291
+ className: "w-5 h-3 object-cover"
1292
+ }
1293
+ ),
1294
+ /* @__PURE__ */ e.jsxs("span", { children: [
1295
+ x.label,
1296
+ " (+",
1297
+ x.phone,
1298
+ ")"
1299
+ ] })
1300
+ ]
1301
+ },
1302
+ x.code
1303
+ ))
1304
+ ] })
1305
+ ] })
1306
+ ] }, s) });
1307
+ }
1308
+ const hr = Oe.forwardRef(
1309
+ ({ className: h = "", label: c, required: s, ...i }, d) => {
1310
+ const t = `
1311
+ placeholder-gray-400 dark:placeholder-gray-400
1312
+ ${h}
1313
+ `.trim();
1314
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: i.parentClass || "col-span-12", children: [
1315
+ /* @__PURE__ */ e.jsx(be, { label: c, required: s }),
1316
+ /* @__PURE__ */ e.jsx("div", { className: "relative", children: /* @__PURE__ */ e.jsx(
1317
+ "textarea",
1318
+ {
1319
+ className: t,
1320
+ ref: d,
1321
+ required: s,
1322
+ ...i
1323
+ }
1324
+ ) })
1325
+ ] }, i.name) });
1326
+ }
1327
+ );
1328
+ hr.displayName = "TextArea";
1329
+ const qr = ({
1330
+ label: h = "",
1331
+ value: c = null,
1332
+ onChange: s,
1333
+ required: i = !1,
1334
+ accept: d = "image/*",
1335
+ id: t,
1336
+ dragDrop: n = !1,
1337
+ name: N = "",
1338
+ parentClass: y = ""
1339
+ }) => {
1340
+ const [v, f] = P(c), [u, g] = P(!1), C = ke(null);
1341
+ ae(() => {
1342
+ f(c);
1343
+ }, [c]);
1344
+ const p = (w) => {
1345
+ if (!w || w.length === 0) {
1346
+ f(null), s == null || s(null);
1347
+ return;
1348
+ }
1349
+ const L = w[0], U = URL.createObjectURL(L);
1350
+ f({ file: L, preview: U }), s == null || s(U);
1351
+ }, E = (w) => {
1352
+ n && (w.preventDefault(), g(!0));
1353
+ }, M = (w) => {
1354
+ n && (w.preventDefault(), g(!1));
1355
+ }, R = (w) => {
1356
+ n && (w.preventDefault(), g(!1), p(w.dataTransfer.files));
1357
+ };
1358
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: y || "col-span-12", children: [
1359
+ /* @__PURE__ */ e.jsx(be, { label: h, required: i }),
1360
+ /* @__PURE__ */ e.jsxs(
1361
+ "div",
1362
+ {
1363
+ className: `relative rounded-md p-2 transition-all ${u ? "border border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900" : "border bg-gray-50 dark:bg-gray-700"}`,
1364
+ onDragOver: E,
1365
+ onDragLeave: M,
1366
+ onDrop: R,
1367
+ children: [
1368
+ /* @__PURE__ */ e.jsxs(
1369
+ "div",
1370
+ {
1371
+ className: `flex items-center space-x-3 transition-all ${u ? "filter blur-sm" : ""}`,
1372
+ children: [
1373
+ /* @__PURE__ */ e.jsx(
1374
+ "div",
1375
+ {
1376
+ className: "cursor-pointer",
1377
+ onClick: () => C.current.click(),
1378
+ children: v ? /* @__PURE__ */ e.jsx(
1379
+ "img",
1380
+ {
1381
+ src: v.preview || v,
1382
+ alt: "preview",
1383
+ className: "object-cover w-20 h-20 rounded-full"
1384
+ }
1385
+ ) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx("div", { className: "rounded-full bg-gray-200 dark:bg-gray-800 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e.jsx(
1386
+ He,
1387
+ {
1388
+ icon: "ri:image-add-fill",
1389
+ className: "text-gray-400 w-10 h-10"
1390
+ }
1391
+ ) }) })
1392
+ }
1393
+ ),
1394
+ /* @__PURE__ */ e.jsx(
1395
+ "input",
1396
+ {
1397
+ ref: C,
1398
+ id: t,
1399
+ type: "file",
1400
+ accept: d,
1401
+ onChange: (w) => p(w.target.files),
1402
+ required: i && !v,
1403
+ className: "inline-flex items-center justify-center p-2 text-gray-400 text-sm file:cursor-pointer"
1404
+ }
1405
+ )
1406
+ ]
1407
+ }
1408
+ ),
1409
+ n && u && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ e.jsx("span", { className: "text-blue-500 font-semibold text-xl", children: "Drop here" }) })
1410
+ ]
1411
+ }
1412
+ )
1413
+ ] }, N) });
1414
+ }, br = Oe.forwardRef(
1415
+ ({
1416
+ label: h,
1417
+ required: c,
1418
+ parentClass: s = "",
1419
+ className: i = "",
1420
+ type: d = "text",
1421
+ onKeyDown: t,
1422
+ ...n
1423
+ }, N) => {
1424
+ const [y, v] = P(!1), f = (g) => {
1425
+ d === "number" && ["e", "E"].includes(g.key) && g.preventDefault(), t == null || t(g);
1426
+ }, u = `
1427
+ h-10 placeholder-gray-400 dark:placeholder-gray-400
1428
+ ${d === "password" ? "pr-10" : ""}
1429
+ ${i}
1430
+ `.trim();
1431
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: s || "col-span-12", children: [
1432
+ /* @__PURE__ */ e.jsx(be, { label: h, required: c }),
1433
+ /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
1434
+ /* @__PURE__ */ e.jsx(
1435
+ "input",
1436
+ {
1437
+ type: d === "password" && y ? "text" : d,
1438
+ ref: N,
1439
+ required: c,
1440
+ onKeyDown: f,
1441
+ className: u,
1442
+ ...n
1443
+ }
1444
+ ),
1445
+ d === "password" && /* @__PURE__ */ e.jsx(
1446
+ "button",
1447
+ {
1448
+ type: "button",
1449
+ tabIndex: -1,
1450
+ onClick: () => v((g) => !g),
1451
+ className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
1452
+ children: /* @__PURE__ */ e.jsx(
1453
+ He,
1454
+ {
1455
+ icon: y ? "mdi:eye-off-outline" : "mdi:eye-outline",
1456
+ className: "w-5 h-5"
1457
+ }
1458
+ )
1459
+ }
1460
+ )
1461
+ ] })
1462
+ ] }, n.name) });
1463
+ }
1464
+ );
1465
+ br.displayName = "Input";
1466
+ const Jr = ({
1467
+ key: h,
1468
+ editorKey: c = "",
1469
+ value: s = "",
1470
+ onChange: i,
1471
+ label: d = "",
1472
+ required: t = !1,
1473
+ placeholder: n = "",
1474
+ parentClass: N = "col-span-12",
1475
+ height: y = 400,
1476
+ inline: v = !1,
1477
+ disabled: f = !1,
1478
+ plugins: u,
1479
+ toolbar: g,
1480
+ menubar: C = !1,
1481
+ fontFamily: p = "Inter, sans-serif",
1482
+ initConfig: E = {},
1483
+ imageUploadHandler: M
1484
+ // ✅ Promise function passed from parent
1485
+ }) => {
1486
+ const R = [
1487
+ "advlist",
1488
+ "autolink",
1489
+ "lists",
1490
+ "link",
1491
+ "image",
1492
+ "charmap",
1493
+ "preview",
1494
+ "anchor",
1495
+ "searchreplace",
1496
+ "visualblocks",
1497
+ "code",
1498
+ "fullscreen",
1499
+ "insertdatetime",
1500
+ "media",
1501
+ "table",
1502
+ "help",
1503
+ "wordcount"
1504
+ ], w = "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview", L = (U) => new Promise((V, Z) => {
1505
+ if (!M) {
1506
+ V(`data:${U.blob().type};base64,${U.base64()}`);
1507
+ return;
1508
+ }
1509
+ M(U).then(($) => {
1510
+ $ ? V($) : Z("Upload failed: No URL returned");
1511
+ }).catch(($) => {
1512
+ Z(
1513
+ typeof $ == "string" ? $ : ($ == null ? void 0 : $.message) || "Image upload failed"
1514
+ );
1515
+ });
1516
+ });
1517
+ return /* @__PURE__ */ e.jsxs("div", { className: N, children: [
1518
+ d && /* @__PURE__ */ e.jsx(be, { label: d, required: t }),
1519
+ /* @__PURE__ */ e.jsx(
1520
+ Gr,
1521
+ {
1522
+ apiKey: c,
1523
+ value: s,
1524
+ disabled: f,
1525
+ init: {
1526
+ height: y,
1527
+ inline: v,
1528
+ menubar: C,
1529
+ branding: !1,
1530
+ statusbar: !0,
1531
+ automatic_uploads: !0,
1532
+ images_upload_handler: L,
1533
+ plugins: u ?? R,
1534
+ toolbar: g ?? w,
1535
+ placeholder: n,
1536
+ content_style: `
1537
+ body {
1538
+ font-family: ${p};
1539
+ }
1540
+ `,
1541
+ ...E
1542
+ },
1543
+ onEditorChange: (U) => {
1544
+ i && i(U);
1545
+ }
1546
+ }
1547
+ )
1548
+ ] }, h);
1549
+ }, Zr = ({
1550
+ name: h = "",
1551
+ label: c = "",
1552
+ // label for single checkbox
1553
+ options: s = [],
1554
+ // array of { label, value } for multiple
1555
+ value: i = null,
1556
+ // boolean for single, array for multiple, or string for single select
1557
+ onChange: d,
1558
+ disabled: t = !1,
1559
+ required: n = !1,
1560
+ parentClass: N = "col-span-12",
1561
+ className: y = "",
1562
+ multiSelect: v = !1
1563
+ // ✅ if true, only one option can be selected (like radio)
1564
+ }) => {
1565
+ const f = Array.isArray(s) && s.length > 0, u = (p) => f ? v ? Array.isArray(i) && i.includes(p) : i === p : !!i, g = (p) => {
1566
+ d == null || d(p.target.checked, h);
1567
+ }, C = (p, E) => {
1568
+ if (d)
1569
+ if (!v)
1570
+ d(E ? p : "", h);
1571
+ else {
1572
+ const M = Array.isArray(i) ? [...i] : [];
1573
+ if (E)
1574
+ M.includes(p) || M.push(p);
1575
+ else {
1576
+ const R = M.indexOf(p);
1577
+ R > -1 && M.splice(R, 1);
1578
+ }
1579
+ d(M, h);
1580
+ }
1581
+ };
1582
+ return f ? /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: `${N}`, children: [
1583
+ /* @__PURE__ */ e.jsx(be, { label: c, required: n }),
1584
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col space-y-2", children: s.map((p, E) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
1585
+ /* @__PURE__ */ e.jsx(
1586
+ "input",
1587
+ {
1588
+ type: "checkbox",
1589
+ name: h,
1590
+ value: p.value,
1591
+ checked: u(p.value),
1592
+ disabled: t || p.disabled,
1593
+ required: n && E === 0,
1594
+ onChange: (M) => C(p.value, M.target.checked),
1595
+ className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${y}`
1596
+ },
1597
+ h
1598
+ ),
1599
+ p.label && /* @__PURE__ */ e.jsx(
1600
+ "label",
1601
+ {
1602
+ htmlFor: h,
1603
+ className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1604
+ children: p.label
1605
+ }
1606
+ )
1607
+ ] }, p.value || p.label)) })
1608
+ ] }) }) : /* @__PURE__ */ e.jsxs("div", { className: `flex items-center ${N}`, children: [
1609
+ /* @__PURE__ */ e.jsx(
1610
+ "input",
1611
+ {
1612
+ type: "checkbox",
1613
+ name: h,
1614
+ checked: u(),
1615
+ disabled: t,
1616
+ required: n,
1617
+ onChange: g,
1618
+ className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${y}`
1619
+ }
1620
+ ),
1621
+ c && /* @__PURE__ */ e.jsx(
1622
+ "label",
1623
+ {
1624
+ htmlFor: h,
1625
+ className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1626
+ children: c
1627
+ }
1628
+ )
1629
+ ] });
1630
+ }, pr = ({ field: h, formData: c, handleChange: s }) => {
1631
+ const {
1632
+ key: i,
1633
+ label: d,
1634
+ type: t,
1635
+ options: n,
1636
+ placeholder: N,
1637
+ rows: y,
1638
+ inputClass: v,
1639
+ search: f,
1640
+ accept: u,
1641
+ text: g,
1642
+ required: C = !1,
1643
+ minLength: p,
1644
+ dragDrop: E,
1645
+ parentClass: M,
1646
+ countriesList: R,
1647
+ defaultCountry: w,
1648
+ multiple: L,
1649
+ dropdownMaxHeight: U,
1650
+ editorKey: V,
1651
+ fontFamily: Z,
1652
+ disabled: $
1653
+ } = h;
1654
+ let x = c == null ? void 0 : c[i];
1655
+ x == null && (x = "");
1656
+ const B = N || (t === "select" ? `Select ${d}` : `Enter ${d}`), G = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
1657
+ switch (t) {
1658
+ case "select":
1659
+ return /* @__PURE__ */ e.jsx(
1660
+ Hr,
1661
+ {
1662
+ options: n || [],
1663
+ value: x,
1664
+ onChange: (T) => s(i, T),
1665
+ placeholder: B,
1666
+ className: v || "",
1667
+ search: f,
1668
+ required: C,
1669
+ label: d,
1670
+ name: i,
1671
+ disabled: $,
1672
+ parentClass: M,
1673
+ multiple: L,
1674
+ dropdownMaxHeight: U
1675
+ }
1676
+ );
1677
+ case "checkbox":
1678
+ return /* @__PURE__ */ e.jsx(
1679
+ Zr,
1680
+ {
1681
+ name: i,
1682
+ label: d,
1683
+ options: n || [],
1684
+ value: x,
1685
+ onChange: (T) => s(i, T),
1686
+ required: C,
1687
+ parentClass: M,
1688
+ className: v || "",
1689
+ multiSelect: L,
1690
+ disabled: $
1691
+ }
1692
+ );
1693
+ case "switch":
1694
+ return /* @__PURE__ */ e.jsx(
1695
+ Vr,
1696
+ {
1697
+ value: x,
1698
+ onChange: (T) => s(i, T),
1699
+ text: g,
1700
+ options: n || [],
1701
+ label: d,
1702
+ required: C,
1703
+ name: i,
1704
+ disabled: $,
1705
+ parentClass: M
1706
+ }
1707
+ );
1708
+ case "phone":
1709
+ return /* @__PURE__ */ e.jsx(
1710
+ Wr,
1711
+ {
1712
+ value: x,
1713
+ onChange: (T) => s(i, T),
1714
+ countriesList: R,
1715
+ defaultCountry: w,
1716
+ required: C,
1717
+ placeholder: B,
1718
+ search: f,
1719
+ label: d,
1720
+ name: i,
1721
+ disabled: $,
1722
+ parentClass: M
1723
+ }
1724
+ );
1725
+ case "textarea":
1726
+ return /* @__PURE__ */ e.jsx(
1727
+ hr,
1728
+ {
1729
+ value: x,
1730
+ onChange: (T) => s(i, T.target.value),
1731
+ placeholder: B,
1732
+ rows: y || 3,
1733
+ className: `${G} ${v || ""}`,
1734
+ required: C,
1735
+ name: i,
1736
+ label: d,
1737
+ disabled: $,
1738
+ parentClass: M
1739
+ }
1740
+ );
1741
+ case "image":
1742
+ return /* @__PURE__ */ e.jsx(
1743
+ qr,
1744
+ {
1745
+ value: x,
1746
+ onChange: (T) => s(i, T),
1747
+ required: C,
1748
+ accept: u || "image/*",
1749
+ id: `file-${i}`,
1750
+ dragDrop: E,
1751
+ label: d,
1752
+ name: i,
1753
+ parentClass: M
1754
+ }
1755
+ );
1756
+ case "tinyEditor":
1757
+ return /* @__PURE__ */ e.jsx(
1758
+ Jr,
1759
+ {
1760
+ value: x,
1761
+ onChange: (T) => s(i, T),
1762
+ required: C,
1763
+ placeholder: B,
1764
+ label: d,
1765
+ parentClass: M,
1766
+ fontFamily: Z,
1767
+ editorKey: V,
1768
+ disabled: $
1769
+ },
1770
+ `editor-${i}`
1771
+ );
1772
+ default:
1773
+ return /* @__PURE__ */ e.jsx(
1774
+ br,
1775
+ {
1776
+ type: t || "text",
1777
+ value: x,
1778
+ onChange: (T) => s(i, T.target.value),
1779
+ placeholder: B,
1780
+ className: `${G} ${v || ""}`,
1781
+ required: C,
1782
+ name: i,
1783
+ minLength: p,
1784
+ label: d,
1785
+ parentClass: M,
1786
+ disabled: $
1787
+ }
1788
+ );
1789
+ }
1790
+ }, Xr = ({ isOpen: h, onClose: c, config: s, onApply: i }) => {
1791
+ var v;
1792
+ const [d, t] = P({}), n = (f, u) => {
1793
+ t((g) => ({ ...g, [f]: u }));
1794
+ }, N = () => {
1795
+ i == null || i(d), c();
1796
+ }, y = () => {
1797
+ t({}), i == null || i({}), c();
1798
+ };
1799
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1800
+ /* @__PURE__ */ e.jsx(
1801
+ "div",
1802
+ {
1803
+ className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${h ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
1804
+ onClick: c
1805
+ }
1806
+ ),
1807
+ /* @__PURE__ */ e.jsxs(
1808
+ "div",
1809
+ {
1810
+ className: `fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
1811
+ transform transition-transform duration-300 ease-in-out
1812
+ ${h ? "translate-x-0" : "translate-x-full"}
1813
+ `,
1814
+ children: [
1815
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
1816
+ /* @__PURE__ */ e.jsx("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Filters" }),
1817
+ /* @__PURE__ */ e.jsx(
1818
+ "button",
1819
+ {
1820
+ onClick: c,
1821
+ className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
1822
+ children: /* @__PURE__ */ e.jsx(Ae, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1823
+ }
1824
+ )
1825
+ ] }),
1826
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: s != null && s.component ? /* @__PURE__ */ e.jsx(s.component, { filters: d, onFilterChange: n }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-4", children: (v = s == null ? void 0 : s.fields) == null ? void 0 : v.map((f) => /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
1827
+ pr,
1828
+ {
1829
+ field: f,
1830
+ formData: d,
1831
+ handleChange: n
1832
+ },
1833
+ f.key
1834
+ ) })) }) }),
1835
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
1836
+ /* @__PURE__ */ e.jsx(
1837
+ Me,
1838
+ {
1839
+ onClick: N,
1840
+ variant: "contained",
1841
+ color: "primary",
1842
+ fullWidth: !0,
1843
+ children: "Apply Filters"
1844
+ }
1845
+ ),
1846
+ /* @__PURE__ */ e.jsx(
1847
+ Me,
1848
+ {
1849
+ onClick: y,
1850
+ variant: "contained",
1851
+ className: "min-w-[150px]",
1852
+ children: "Reset"
1853
+ }
1854
+ )
1855
+ ] })
1856
+ ]
1857
+ }
1858
+ )
1859
+ ] });
1860
+ }, or = {
1861
+ blue: {
1862
+ bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
1863
+ border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
1864
+ },
1865
+ teal: {
1866
+ bg: "bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",
1867
+ border: "border border-teal-300 text-teal-700 dark:border-teal-700 dark:text-teal-300"
1868
+ },
1869
+ purple: {
1870
+ bg: "bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",
1871
+ border: "border border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300"
1872
+ },
1873
+ yellow: {
1874
+ bg: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",
1875
+ border: "border border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300"
1876
+ },
1877
+ green: {
1878
+ bg: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
1879
+ border: "border border-green-300 text-green-700 dark:border-green-700 dark:text-green-300"
1880
+ },
1881
+ red: {
1882
+ bg: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",
1883
+ border: "border border-red-300 text-red-700 dark:border-red-700 dark:text-red-300"
1884
+ },
1885
+ gray: {
1886
+ bg: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",
1887
+ border: "border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"
1888
+ }
1889
+ }, sr = {
1890
+ contained: "bg",
1891
+ outline: "border !bg-transparent",
1892
+ soft: "bg opacity-90"
1893
+ }, gr = ({
1894
+ label: h,
1895
+ variant: c = "contained",
1896
+ // contained | outline | soft
1897
+ color: s = "green",
1898
+ className: i = ""
1899
+ }) => {
1900
+ const d = or[s] || or.green, t = sr[c] || sr.contained, n = c === "outline" ? d.border : d.bg;
1901
+ return /* @__PURE__ */ e.jsx(
1902
+ "span",
1903
+ {
1904
+ className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
1905
+ ${n}
1906
+ ${t}
1907
+ ${i}`,
1908
+ children: h
1909
+ }
1910
+ );
1911
+ }, Qr = ({ rows: h = 5, columns: c = 5 }) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1912
+ /* @__PURE__ */ e.jsx("div", { className: "w-full mb-6 inline-flex justify-end items-center", children: /* @__PURE__ */ e.jsx("div", { className: "h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }),
1913
+ /* @__PURE__ */ e.jsx("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full border-collapse", children: [
1914
+ /* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: c }).map((s, i) => /* @__PURE__ */ e.jsx("th", { className: "px-4 py-3", children: /* @__PURE__ */ e.jsx("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, i)) }) }),
1915
+ /* @__PURE__ */ e.jsx("tbody", { children: Array.from({ length: h }).map((s, i) => /* @__PURE__ */ e.jsx(
1916
+ "tr",
1917
+ {
1918
+ className: "border-t border-gray-200 dark:border-gray-800",
1919
+ children: Array.from({ length: c }).map((d, t) => /* @__PURE__ */ e.jsx("td", { className: "px-4 py-6", children: /* @__PURE__ */ e.jsx("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, t))
1920
+ },
1921
+ i
1922
+ )) })
1923
+ ] }) })
1924
+ ] }), fr = ({ src: h, alt: c = "preview", isOpen: s, setIsOpen: i }) => {
1925
+ const d = () => i(!1);
1926
+ return ae(() => {
1927
+ const t = (n) => {
1928
+ n.key === "Escape" && d();
1929
+ };
1930
+ return s && (document.body.style.overflow = "hidden", document.addEventListener("keydown", t)), () => {
1931
+ document.body.style.overflow = "", document.removeEventListener("keydown", t);
1932
+ };
1933
+ }, [s]), /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
1934
+ "div",
1935
+ {
1936
+ className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
1937
+ backdrop-blur-sm animate-in fade-in duration-200`,
1938
+ onClick: d,
1939
+ children: [
1940
+ /* @__PURE__ */ e.jsx(
1941
+ "button",
1942
+ {
1943
+ onClick: d,
1944
+ className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
1945
+ hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
1946
+ children: /* @__PURE__ */ e.jsx(Ae, { size: 20 })
1947
+ }
1948
+ ),
1949
+ /* @__PURE__ */ e.jsx(
1950
+ "div",
1951
+ {
1952
+ className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
1953
+ onClick: (t) => t.stopPropagation(),
1954
+ children: /* @__PURE__ */ e.jsx(
1955
+ "img",
1956
+ {
1957
+ src: h,
1958
+ alt: c,
1959
+ className: "w-full max-h-[90vh] object-contain rounded-xl"
1960
+ }
1961
+ )
1962
+ }
1963
+ )
1964
+ ]
1965
+ }
1966
+ ) });
1967
+ }, ea = ({ config: h }) => {
1968
+ const {
1969
+ data: c = [],
1970
+ table_head: s = [],
1971
+ loading: i = !1,
1972
+ search: d = {
1973
+ enabled: !1,
1974
+ placeholder: "Search...",
1975
+ useServerSideSearch: !1
1976
+ },
1977
+ filter: t = {
1978
+ enabled: !1,
1979
+ useServerSideFilters: !1
1980
+ },
1981
+ pagination: n = {
1982
+ enabled: !1,
1983
+ rows_per_page: 10,
1984
+ useServerSidePagination: !1
1985
+ },
1986
+ emptyMessage: N = "No data available",
1987
+ onMenuAction: y,
1988
+ setServerSidePaginationData: v = () => {
1989
+ },
1990
+ onFilterApply: f,
1991
+ filterConfig: u = null
1992
+ } = h, [g, C] = P(""), [p, E] = P(null), [M, R] = P([]), [w, L] = P({}), [U, V] = P(!1), [Z, $] = P(null), [x, B] = P(!1), G = Ke(() => !d.enabled || !g.trim() || d.useServerSideSearch ? c : zr(c, g, d.searchKeys || []), [c, g, d]), [T, S] = P(1), [O, W] = P((n == null ? void 0 : n.rows_per_page) || 50), [Q, oe] = P(G.length || 0), pe = n != null && n.useServerSidePagination ? n.total_pages : Math.ceil(G.length / O), ye = Ke(() => {
1993
+ if (n.useServerSidePagination) return G;
1994
+ const l = (T - 1) * O;
1995
+ return G.slice(l, l + O);
1996
+ }, [G, T, O]), ge = ke(null), ve = ke({}), fe = ke(null), se = (l) => {
1997
+ C(l), S(1), d.useServerSideSearch && (fe.current && clearTimeout(fe.current), fe.current = setTimeout(async () => {
1998
+ try {
1999
+ await v((m) => ({
2000
+ ...m,
2001
+ search: l,
2002
+ current_page: 1
2003
+ }));
2004
+ } catch (m) {
2005
+ console.error("Search error:", m);
2006
+ }
2007
+ }, 800));
2008
+ }, Se = (l, m, A) => {
2009
+ A.stopPropagation(), E(null), y == null || y(l.type, m);
2010
+ }, Ee = (l, m, A) => {
2011
+ m.stopPropagation(), R(A);
2012
+ const H = m.currentTarget;
2013
+ ve.current[l] = H;
2014
+ const z = H.getBoundingClientRect(), te = 192, X = A.length * 40, ue = window.innerWidth, je = window.innerHeight, F = ue - z.right < te ? z.left - te + z.width : z.left, le = je - z.bottom < X && z.top > X ? z.top - X - 2 : z.bottom + 2;
2015
+ L({
2016
+ top: Math.max(8, Math.min(le, je - X - 8)),
2017
+ left: Math.max(8, Math.min(F, ue - te - 8))
2018
+ }), E(p === l ? null : l);
2019
+ }, Te = (l) => (T - 1) * O + l + 1, me = (l) => {
2020
+ $(l), B(!0);
2021
+ }, ie = (l, m, A, H = null) => /* @__PURE__ */ e.jsx(e.Fragment, { children: l ? /* @__PURE__ */ e.jsx(
2022
+ "img",
2023
+ {
2024
+ src: l,
2025
+ alt: m || "Avatar",
2026
+ onClick: (z) => {
2027
+ z.stopPropagation(), z.preventDefault(), me({ src: l, alt: m });
2028
+ },
2029
+ className: `w-10 h-10 cursor-pointer rounded-full object-cover border border-gray-200 dark:border-gray-700 ${A || ""}`
2030
+ }
2031
+ ) : /* @__PURE__ */ e.jsx(e.Fragment, { children: H || /* @__PURE__ */ e.jsx(
2032
+ "div",
2033
+ {
2034
+ className: `w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${A || ""}`,
2035
+ children: /* @__PURE__ */ e.jsx(cr, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
2036
+ }
2037
+ ) }) }), de = (l, m) => /* @__PURE__ */ e.jsxs("div", { className: `flex items-center space-x-4 ${m.className || ""}`, children: [
2038
+ m.imageKey ? ie(l[m.imageKey], l[m.titleKey], "group-avatar") : "",
2039
+ /* @__PURE__ */ e.jsxs("div", { children: [
2040
+ /* @__PURE__ */ e.jsx("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: l[m.titleKey] || "" }),
2041
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: l[m.subtitleKey] || "" })
2042
+ ] })
2043
+ ] }), xe = (l, m) => {
2044
+ var te;
2045
+ let A = String(l);
2046
+ const H = m.variant || "contained";
2047
+ let z = m.defaultColor;
2048
+ if (((te = m == null ? void 0 : m.chipOptions) == null ? void 0 : te.length) > 0) {
2049
+ let X = m == null ? void 0 : m.chipOptions.find((ue) => ue.value == l);
2050
+ X && (A = X.label, z = X.color);
2051
+ }
2052
+ return /* @__PURE__ */ e.jsx(
2053
+ gr,
2054
+ {
2055
+ label: A,
2056
+ variant: H,
2057
+ color: z,
2058
+ className: m.className || ""
2059
+ }
2060
+ );
2061
+ }, ce = (l, m, A) => {
2062
+ const H = m[l.key];
2063
+ return l.type === "menu_actions" ? /* @__PURE__ */ e.jsx("div", { className: `text-center ${l.className || ""}`, children: /* @__PURE__ */ e.jsx(
2064
+ "button",
2065
+ {
2066
+ ref: (z) => ve.current[m.id] = z,
2067
+ onClick: (z) => Ee(m.id, z, l.menuList),
2068
+ className: "p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300",
2069
+ children: /* @__PURE__ */ e.jsx(Lr, { className: "h-4 w-4" })
2070
+ }
2071
+ ) }) : l.type === "index" ? /* @__PURE__ */ e.jsx("span", { className: l.className || "", children: Te(A) }) : l.type === "group" ? de(m, l) : l.type === "chip" ? /* @__PURE__ */ e.jsx(e.Fragment, { children: xe(H, l) }) : l.type === "date" ? /* @__PURE__ */ e.jsx("span", { className: l.className || "", children: ur(H, l.format || "DD MMM YYYY") }) : l.type === "avatar" ? /* @__PURE__ */ e.jsx(e.Fragment, { children: ie(H, l.alt, l.className, l.fallback_icon) }) : /* @__PURE__ */ e.jsx("span", { className: l.className || "", children: H || "N/A" });
2072
+ }, Ne = (l, m) => {
2073
+ if (l.onClickDetails)
2074
+ return y == null ? void 0 : y("view", m);
2075
+ if (typeof l.handleClick == "function")
2076
+ return l.handleClick(m);
2077
+ }, we = (l) => l.onClickDetails || typeof l.handleClick == "function";
2078
+ return ae(() => {
2079
+ const l = () => {
2080
+ p && E(null);
2081
+ };
2082
+ return window.addEventListener("scroll", l, !0), () => {
2083
+ window.removeEventListener("scroll", l, !0);
2084
+ };
2085
+ }, [p]), ae(() => {
2086
+ const l = (m) => {
2087
+ ge.current && !ge.current.contains(m.target) && E(null);
2088
+ };
2089
+ return document.addEventListener("click", l), () => document.removeEventListener("click", l);
2090
+ }, []), ae(() => {
2091
+ n != null && n.rows_per_page && (n != null && n.useServerSidePagination) && W((n == null ? void 0 : n.rows_per_page) || 50), n.current_page && S(n.current_page);
2092
+ }, [
2093
+ n.rows_per_page,
2094
+ n == null ? void 0 : n.useServerSidePagination,
2095
+ n.current_page
2096
+ ]), ae(() => {
2097
+ oe(
2098
+ n != null && n.useServerSidePagination ? n.total_records : G.length
2099
+ ), G.length <= O * (T - 1) && !(n != null && n.useServerSidePagination) && S((l) => l - 1 || 1);
2100
+ }, [
2101
+ G.length,
2102
+ n.total_records,
2103
+ n == null ? void 0 : n.useServerSidePagination
2104
+ ]), i ? /* @__PURE__ */ e.jsx(Qr, { rows: 6, columns: 6 }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2105
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-end items-center mb-6 gap-2", children: [
2106
+ d.enabled && /* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsxs("div", { className: "relative min-w-[300px]", children: [
2107
+ /* @__PURE__ */ e.jsx(ze, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
2108
+ /* @__PURE__ */ e.jsx(
2109
+ "input",
2110
+ {
2111
+ type: "text",
2112
+ placeholder: d.placeholder || "Search...",
2113
+ value: g,
2114
+ onChange: (l) => se(l.target.value),
2115
+ className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
2116
+ }
2117
+ )
2118
+ ] }) }),
2119
+ u && t.enabled && /* @__PURE__ */ e.jsxs(Me, { onClick: () => V(!0), variant: "contained", children: [
2120
+ /* @__PURE__ */ e.jsx(Dr, { className: "w-4 h-4 mr-2" }),
2121
+ "Filters"
2122
+ ] })
2123
+ ] }),
2124
+ /* @__PURE__ */ e.jsxs("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
2125
+ /* @__PURE__ */ e.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ e.jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
2126
+ /* @__PURE__ */ e.jsx("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e.jsx("tr", { children: s.map((l) => /* @__PURE__ */ e.jsx(
2127
+ "th",
2128
+ {
2129
+ className: "px-6 py-4 text-left text-xs font-medium text-black dark:text-white uppercase tracking-wider min-w-max max-w-[180px] truncate",
2130
+ children: l.title
2131
+ },
2132
+ l.key
2133
+ )) }) }),
2134
+ /* @__PURE__ */ e.jsx("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: ye.length === 0 ? /* @__PURE__ */ e.jsx("tr", { children: /* @__PURE__ */ e.jsx(
2135
+ "td",
2136
+ {
2137
+ colSpan: s.length,
2138
+ className: "text-center py-10 text-gray-500 dark:text-gray-400",
2139
+ children: N
2140
+ }
2141
+ ) }) : ye.map((l, m) => /* @__PURE__ */ e.jsx(
2142
+ "tr",
2143
+ {
2144
+ className: "hover:bg-gray-50 dark:hover:bg-blue-800/10 transition",
2145
+ children: s.map((A) => /* @__PURE__ */ e.jsx(
2146
+ "td",
2147
+ {
2148
+ className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max max-w-[300px] truncate ${we(A) ? "cursor-pointer" : ""}`,
2149
+ title: String(l[A.key] ?? ""),
2150
+ onClick: () => Ne(A, l),
2151
+ children: A.render ? A.render(l, m) : ce(A, l, m)
2152
+ },
2153
+ A.key
2154
+ ))
2155
+ },
2156
+ l.id || m
2157
+ )) })
2158
+ ] }) }),
2159
+ (n == null ? void 0 : n.enabled) && G.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
2160
+ /* @__PURE__ */ e.jsxs("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
2161
+ "Showing ",
2162
+ (T - 1) * O + 1,
2163
+ " to",
2164
+ " ",
2165
+ Math.min(T * O, Q),
2166
+ " of ",
2167
+ Q,
2168
+ " ",
2169
+ "results"
2170
+ ] }),
2171
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
2172
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
2173
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: "Rows per page:" }),
2174
+ /* @__PURE__ */ e.jsx(
2175
+ "select",
2176
+ {
2177
+ value: O,
2178
+ onChange: (l) => {
2179
+ const m = Number(l.target.value);
2180
+ W(m), S(1), n.useServerSidePagination && v((A) => ({
2181
+ ...A,
2182
+ current_page: 1,
2183
+ rows_per_page: m
2184
+ }));
2185
+ },
2186
+ className: "border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-blue-500",
2187
+ children: [2, 10, 25, 50, 100].map((l) => /* @__PURE__ */ e.jsx("option", { value: l, children: l }, l))
2188
+ }
2189
+ )
2190
+ ] }),
2191
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
2192
+ /* @__PURE__ */ e.jsx(
2193
+ "button",
2194
+ {
2195
+ onClick: () => {
2196
+ if (T > 1) {
2197
+ const l = T - 1;
2198
+ S(l), n.useServerSidePagination && v((m) => ({
2199
+ ...m,
2200
+ current_page: l
2201
+ }));
2202
+ }
2203
+ },
2204
+ disabled: T === 1,
2205
+ className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
2206
+ children: /* @__PURE__ */ e.jsx(Ar, { className: "h-4 w-4" })
2207
+ }
2208
+ ),
2209
+ /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
2210
+ "Page ",
2211
+ T,
2212
+ " of ",
2213
+ pe
2214
+ ] }),
2215
+ /* @__PURE__ */ e.jsx(
2216
+ "button",
2217
+ {
2218
+ onClick: () => {
2219
+ if (T < pe) {
2220
+ const l = T + 1;
2221
+ S(l), n.useServerSidePagination && v((m) => ({
2222
+ ...m,
2223
+ current_page: l
2224
+ }));
2225
+ }
2226
+ },
2227
+ disabled: T === pe,
2228
+ className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
2229
+ children: /* @__PURE__ */ e.jsx(Ir, { className: "h-4 w-4" })
2230
+ }
2231
+ )
2232
+ ] })
2233
+ ] })
2234
+ ] })
2235
+ ] }),
2236
+ p && $r(
2237
+ /* @__PURE__ */ e.jsx(
2238
+ "div",
2239
+ {
2240
+ ref: ge,
2241
+ style: {
2242
+ position: "fixed",
2243
+ top: `${w.top}px`,
2244
+ left: `${w.left}px`,
2245
+ zIndex: 9999
2246
+ },
2247
+ className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
2248
+ children: M.map((l, m) => /* @__PURE__ */ e.jsxs(
2249
+ "button",
2250
+ {
2251
+ onClick: (A) => Se(
2252
+ l,
2253
+ c.find((H) => H.id === p),
2254
+ A
2255
+ ),
2256
+ className: `w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${l.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
2257
+ children: [
2258
+ l.icon && /* @__PURE__ */ e.jsx("span", { className: "shrink-0", children: l.icon }),
2259
+ l.title
2260
+ ]
2261
+ },
2262
+ m
2263
+ ))
2264
+ }
2265
+ ),
2266
+ document.body
2267
+ ),
2268
+ u && /* @__PURE__ */ e.jsx(
2269
+ Xr,
2270
+ {
2271
+ isOpen: U,
2272
+ onClose: () => V(!1),
2273
+ config: u,
2274
+ onApply: f
2275
+ }
2276
+ ),
2277
+ x && /* @__PURE__ */ e.jsx(
2278
+ fr,
2279
+ {
2280
+ src: Z.src,
2281
+ alt: Z.alt,
2282
+ isOpen: x,
2283
+ setIsOpen: B
2284
+ }
2285
+ )
2286
+ ] });
2287
+ }, De = ({
2288
+ isOpen: h,
2289
+ onClose: c,
2290
+ icon: s,
2291
+ title: i,
2292
+ children: d,
2293
+ size: t = "md",
2294
+ actionButtons: n = [],
2295
+ actions: N,
2296
+ showDefaultClose: y = !0,
2297
+ footerConfig: v = null,
2298
+ hideFooter: f = !1,
2299
+ onFormSubmit: u = () => {
2300
+ },
2301
+ onCancel: g,
2302
+ loadingBtn: C = !1,
2303
+ executeFunction: p = () => {
2304
+ },
2305
+ selectedItem: E = null
2306
+ }) => {
2307
+ if (!h) return null;
2308
+ const M = {
2309
+ sm: "max-w-md",
2310
+ md: "max-w-lg",
2311
+ lg: "max-w-2xl",
2312
+ xl: "max-w-4xl",
2313
+ full: "max-w-full"
2314
+ };
2315
+ return /* @__PURE__ */ e.jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
2316
+ /* @__PURE__ */ e.jsx(
2317
+ "div",
2318
+ {
2319
+ className: "fixed inset-0 bg-gray-500 opacity-75",
2320
+ onClick: () => c()
2321
+ }
2322
+ ),
2323
+ /* @__PURE__ */ e.jsxs(
2324
+ "div",
2325
+ {
2326
+ className: `relative bg-white rounded-lg shadow-xl w-full ${M[t] || M.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
2327
+ children: [
2328
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
2329
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
2330
+ s && /* @__PURE__ */ e.jsx("span", { children: s }),
2331
+ /* @__PURE__ */ e.jsx("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: i })
2332
+ ] }),
2333
+ /* @__PURE__ */ e.jsx(
2334
+ "button",
2335
+ {
2336
+ onClick: () => c(),
2337
+ className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
2338
+ children: /* @__PURE__ */ e.jsx(Ae, { className: "w-6 h-6" })
2339
+ }
2340
+ )
2341
+ ] }),
2342
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 overflow-y-auto p-4", children: d }),
2343
+ n.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: n.map((R) => /* @__PURE__ */ e.jsx(
2344
+ Me,
2345
+ {
2346
+ onClick: (w) => {
2347
+ R.type == "submit" ? u(w) : p(
2348
+ () => {
2349
+ var L;
2350
+ return (L = R == null ? void 0 : R.onClick) == null ? void 0 : L.call(R, w, E);
2351
+ },
2352
+ (L) => c == null ? void 0 : c(L)
2353
+ );
2354
+ },
2355
+ disabled: C || R.disabled,
2356
+ variant: R.variant || "contained",
2357
+ color: R.color || "primary",
2358
+ className: `min-w-[100px] ${R.className}`,
2359
+ type: R.type || "button",
2360
+ children: C ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
2361
+ /* @__PURE__ */ e.jsx("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2" }),
2362
+ R.label || "Submit",
2363
+ "..."
2364
+ ] }) : R.label || "Submit"
2365
+ }
2366
+ )) })
2367
+ ]
2368
+ }
2369
+ )
2370
+ ] });
2371
+ }, ir = ({ config: h, onSubmit: c, initialData: s = {} }) => {
2372
+ var v;
2373
+ const { formClass: i = "grid grid-cols-12 gap-4", formFields: d = [] } = h || {}, [t, n] = P(s);
2374
+ ae(() => {
2375
+ n(s);
2376
+ }, []);
2377
+ const N = (f, u) => {
2378
+ n((g) => ({ ...g, [f]: u }));
2379
+ }, y = (f) => {
2380
+ f.preventDefault();
2381
+ const u = f.target;
2382
+ if (!u.checkValidity()) {
2383
+ u.reportValidity();
2384
+ return;
2385
+ }
2386
+ c(t);
2387
+ };
2388
+ return /* @__PURE__ */ e.jsx(
2389
+ "form",
2390
+ {
2391
+ id: (v = h.title) != null && v.toLowerCase().includes("edit") ? "editForm" : "addForm",
2392
+ onSubmit: y,
2393
+ className: i,
2394
+ noValidate: !1,
2395
+ children: d.map((f) => /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
2396
+ pr,
2397
+ {
2398
+ field: f,
2399
+ formData: t,
2400
+ handleChange: N
2401
+ },
2402
+ f.key
2403
+ ) }))
2404
+ }
2405
+ );
2406
+ };
2407
+ function ra({ data: h, config: c }) {
2408
+ const { fields: s, containerClass: i } = c, [d, t] = P(null), [n, N] = P(!1), y = (u) => {
2409
+ t(u), N(!0);
2410
+ }, v = ({ col: u }) => {
2411
+ let g = u == null ? void 0 : u.icon, C = u.label, p = h[u.key], E = u.type, M = u.variant || "outline", R = u.defaultColor;
2412
+ if (E == "chip" && u.chipOptions.length > 0) {
2413
+ let w = u == null ? void 0 : u.chipOptions.find((L) => L.value == p);
2414
+ w && (p = w.label, R = w.color);
2415
+ }
2416
+ return /* @__PURE__ */ e.jsxs(
2417
+ "div",
2418
+ {
2419
+ className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
2420
+ bg-gray-100 dark:bg-gray-900 ${u.blockClass}`,
2421
+ children: [
2422
+ g && /* @__PURE__ */ e.jsx("div", { className: "flex-shrink-0", children: g }),
2423
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
2424
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: C }),
2425
+ E == "chip" ? /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
2426
+ gr,
2427
+ {
2428
+ label: p,
2429
+ variant: M,
2430
+ color: R,
2431
+ className: "mt-1"
2432
+ }
2433
+ ) }) : E == "tinyEditor" ? /* @__PURE__ */ e.jsx(
2434
+ "p",
2435
+ {
2436
+ className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
2437
+ dangerouslySetInnerHTML: {
2438
+ __html: p
2439
+ }
2440
+ }
2441
+ ) : /* @__PURE__ */ e.jsx("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: E == "date" ? /* @__PURE__ */ e.jsx("span", { children: ur(p, u.format || "DD MMM YYYY") }) : p || "N/A" })
2442
+ ] })
2443
+ ]
2444
+ }
2445
+ );
2446
+ }, f = ({ col: u }) => {
2447
+ let g = h[u.titleKey], C = h[u.subtitleKey], p = h[u.imageKey], E = h[u.fallback_icon];
2448
+ return /* @__PURE__ */ e.jsxs(
2449
+ "div",
2450
+ {
2451
+ className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
2452
+ bg-gray-100 dark:bg-gray-900
2453
+ ${u.blockClass}`,
2454
+ children: [
2455
+ p ? /* @__PURE__ */ e.jsx(
2456
+ "img",
2457
+ {
2458
+ src: p,
2459
+ alt: g,
2460
+ onClick: () => y({ src: p, alt: g }),
2461
+ className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
2462
+ }
2463
+ ) : E || /* @__PURE__ */ e.jsx("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e.jsx(cr, { className: "w-8 h-8 text-gray-400" }) }),
2464
+ /* @__PURE__ */ e.jsxs("div", { children: [
2465
+ /* @__PURE__ */ e.jsx("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: g }),
2466
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: C })
2467
+ ] })
2468
+ ]
2469
+ }
2470
+ );
2471
+ };
2472
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2473
+ n && /* @__PURE__ */ e.jsx(
2474
+ fr,
2475
+ {
2476
+ src: d.src,
2477
+ alt: d.alt,
2478
+ isOpen: n,
2479
+ setIsOpen: N
2480
+ }
2481
+ ),
2482
+ /* @__PURE__ */ e.jsx("div", { className: `grid grid-cols-12 gap-4 ${i || ""}`, children: s.map(
2483
+ (u) => u.type == "group" ? /* @__PURE__ */ e.jsx(f, { col: u }) : /* @__PURE__ */ e.jsx(v, { col: u })
2484
+ ) })
2485
+ ] });
2486
+ }
2487
+ const mr = ({ config: h }) => {
2488
+ var me, ie, de, xe, ce, Ne, we, l, m, A, H, z, te, X, ue, je;
2489
+ const {
2490
+ title: c,
2491
+ fetchData: s = async () => {
2492
+ },
2493
+ isStaticData: i = !1,
2494
+ tableConfig: d = {},
2495
+ modalConfig: t = {},
2496
+ filterConfig: n
2497
+ } = h, [N, y] = P(!0), [v, f] = P(!1), [u, g] = P([]), [C, p] = P(null), [E, M] = P({
2498
+ search: "",
2499
+ rows_per_page: 50,
2500
+ current_page: 1
2501
+ }), [R, w] = P({}), [L, U] = P(!1), [V, Z] = P(!1), [$, x] = P(!1), [B, G] = P(!1), [T, S] = P(!1), [O, W] = P(null), Q = (j, F) => {
2502
+ j === "edit" ? (W(F), x(!0)) : j === "view" ? (W(F), S(!0)) : j === "delete" && (W(F), G(!0));
2503
+ }, oe = async (j, F, K = "", le = "") => {
2504
+ f(!0);
2505
+ try {
2506
+ const ee = await (j == null ? void 0 : j());
2507
+ (K || ee.message) && $e(K || ee.message, {
2508
+ variant: "success"
2509
+ }), F == null || F(ee);
2510
+ } catch (ee) {
2511
+ (le || ee.message) && $e(le || ee.message, { variant: "error" });
2512
+ } finally {
2513
+ f(!1);
2514
+ }
2515
+ }, pe = (j) => {
2516
+ let F = j.newObject;
2517
+ i ? (g((K) => [F, ...K]), p((K) => ({
2518
+ ...K,
2519
+ current_page: 1
2520
+ }))) : (M((K) => ({
2521
+ ...K,
2522
+ current_page: 1
2523
+ })), E.current_page == 1 && se()), Z(!1);
2524
+ }, ye = (j) => {
2525
+ let F = j.newObject, K = j.targetObject;
2526
+ i ? g(
2527
+ (le) => le.map(
2528
+ (ee) => ee.id === K.id ? { ...ee, ...F } : ee
2529
+ )
2530
+ ) : se(), x(!1);
2531
+ }, ge = (j) => {
2532
+ if (!j) {
2533
+ G(!1), W(null);
2534
+ return;
2535
+ }
2536
+ i ? g(
2537
+ (F) => F.filter((K) => K.id !== j.targetObject.id)
2538
+ ) : u.length == 1 && E.current_page > 1 ? M((F) => ({
2539
+ ...F,
2540
+ current_page: F.current_page - 1
2541
+ })) : se(), G(!1), W(null);
2542
+ }, ve = (j) => oe(
2543
+ () => {
2544
+ var F, K;
2545
+ return (K = (F = t == null ? void 0 : t.addModal) == null ? void 0 : F.handleSubmit) == null ? void 0 : K.call(F, j);
2546
+ },
2547
+ pe
2548
+ ), fe = (j) => oe(
2549
+ () => {
2550
+ var F, K;
2551
+ return (K = (F = t == null ? void 0 : t.editModal) == null ? void 0 : F.handleSubmit) == null ? void 0 : K.call(F, j, O);
2552
+ },
2553
+ ye
2554
+ ), se = async () => {
2555
+ y(!0), s == null || s({ ...E, ...R }).then((j) => {
2556
+ g(j.data), p(j.pagination);
2557
+ }).catch((j) => {
2558
+ $e(j.message, { variant: "error" });
2559
+ }).finally(() => {
2560
+ y(!1);
2561
+ });
2562
+ }, Se = (j) => {
2563
+ var F;
2564
+ w((K) => ({
2565
+ ...j
2566
+ })), (F = d == null ? void 0 : d.filter) != null && F.useServerSideFilters && U((K) => !K);
2567
+ }, Ee = (j, F) => j.filter(
2568
+ (K) => Object.entries(F).every(([le, ee]) => K[le] === ee)
2569
+ ), Te = Ke(() => {
2570
+ var j;
2571
+ return (j = d == null ? void 0 : d.filter) != null && j.useServerSideFilters ? data : Ee(u, R);
2572
+ }, [u, R]);
2573
+ return ae(() => {
2574
+ se();
2575
+ }, [
2576
+ E.search,
2577
+ E.rows_per_page,
2578
+ E.current_page,
2579
+ L
2580
+ ]), /* @__PURE__ */ e.jsx(
2581
+ Yr,
2582
+ {
2583
+ maxSnack: 3,
2584
+ anchorOrigin: {
2585
+ vertical: "bottom",
2586
+ horizontal: "right"
2587
+ },
2588
+ autoHideDuration: 3e3,
2589
+ action: (j) => /* @__PURE__ */ e.jsx(
2590
+ "button",
2591
+ {
2592
+ onClick: () => {
2593
+ window.dispatchEvent(
2594
+ new CustomEvent("closeSnackbar", { detail: j })
2595
+ );
2596
+ },
2597
+ className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
2598
+ children: /* @__PURE__ */ e.jsx(Ae, { className: "h-4 w-4" })
2599
+ }
2600
+ ),
2601
+ children: /* @__PURE__ */ e.jsxs("div", { children: [
2602
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6", children: [
2603
+ /* @__PURE__ */ e.jsxs("div", { children: [
2604
+ /* @__PURE__ */ e.jsx("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: c }),
2605
+ /* @__PURE__ */ e.jsx("p", { className: "text-md text-gray-600 dark:text-gray-400 mt-2", children: h == null ? void 0 : h.description })
2606
+ ] }),
2607
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ e.jsxs(
2608
+ Me,
2609
+ {
2610
+ onClick: () => Z(!0),
2611
+ variant: "contained",
2612
+ color: "primary",
2613
+ children: [
2614
+ /* @__PURE__ */ e.jsx(Br, { className: "w-4 h-4 mr-2" }),
2615
+ h.buttonText || "Add New"
2616
+ ]
2617
+ }
2618
+ ) })
2619
+ ] }),
2620
+ /* @__PURE__ */ e.jsx(
2621
+ ea,
2622
+ {
2623
+ config: {
2624
+ ...d,
2625
+ pagination: {
2626
+ ...d.pagination,
2627
+ ...C
2628
+ },
2629
+ data: Te,
2630
+ setServerSidePaginationData: M,
2631
+ onMenuAction: Q,
2632
+ filterConfig: n,
2633
+ onFilterApply: Se,
2634
+ loading: N
2635
+ }
2636
+ }
2637
+ ),
2638
+ /* @__PURE__ */ e.jsx(
2639
+ De,
2640
+ {
2641
+ isOpen: V,
2642
+ onClose: () => Z(!1),
2643
+ icon: (me = t.addModal) == null ? void 0 : me.icon,
2644
+ title: ((ie = t.addModal) == null ? void 0 : ie.title) || "Add New",
2645
+ size: ((de = t.addModal) == null ? void 0 : de.size) || "md",
2646
+ onFormSubmit: () => {
2647
+ var j;
2648
+ return (j = document.querySelector("#addForm")) == null ? void 0 : j.requestSubmit();
2649
+ },
2650
+ loadingBtn: v,
2651
+ actionButtons: t.addModal.actionButtons,
2652
+ children: /* @__PURE__ */ e.jsx(
2653
+ ir,
2654
+ {
2655
+ config: (t == null ? void 0 : t.addModal) || [],
2656
+ onSubmit: ve,
2657
+ initialData: {},
2658
+ loading: v
2659
+ }
2660
+ )
2661
+ }
2662
+ ),
2663
+ /* @__PURE__ */ e.jsx(
2664
+ De,
2665
+ {
2666
+ isOpen: $,
2667
+ onClose: () => x(!1),
2668
+ icon: (xe = t.editModal) == null ? void 0 : xe.icon,
2669
+ title: ((ce = t.editModal) == null ? void 0 : ce.title) || "Edit",
2670
+ size: ((Ne = t.editModal) == null ? void 0 : Ne.size) || "md",
2671
+ onFormSubmit: () => {
2672
+ var j;
2673
+ return (j = document.querySelector("#editForm")) == null ? void 0 : j.requestSubmit();
2674
+ },
2675
+ actionButtons: t.editModal.actionButtons,
2676
+ loadingBtn: v,
2677
+ children: /* @__PURE__ */ e.jsx(
2678
+ ir,
2679
+ {
2680
+ config: t.editModal || [],
2681
+ onSubmit: fe,
2682
+ initialData: O,
2683
+ loading: v
2684
+ }
2685
+ )
2686
+ }
2687
+ ),
2688
+ B && /* @__PURE__ */ e.jsx(
2689
+ De,
2690
+ {
2691
+ isOpen: B,
2692
+ onClose: (j) => {
2693
+ ge(j);
2694
+ },
2695
+ icon: ((we = t.deleteModal) == null ? void 0 : we.icon) || /* @__PURE__ */ e.jsx(He, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
2696
+ title: ((l = t.deleteModal) == null ? void 0 : l.title) || "Confirm Delete",
2697
+ size: ((m = t.deleteModal) == null ? void 0 : m.size) || "md",
2698
+ loading: v,
2699
+ actionButtons: t.deleteModal.actionButtons,
2700
+ executeFunction: oe,
2701
+ selectedItem: O,
2702
+ children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ e.jsxs("div", { children: [
2703
+ /* @__PURE__ */ e.jsx("p", { className: "text-md text-gray-700 dark:text-white", children: ((A = t.deleteModal) == null ? void 0 : A.confirmText) || "Are you sure you want to delete this item?" }),
2704
+ ((H = t.deleteModal) == null ? void 0 : H.referenceKey) && /* @__PURE__ */ e.jsx("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: O[(z = t.deleteModal) == null ? void 0 : z.referenceKey] })
2705
+ ] }) })
2706
+ }
2707
+ ),
2708
+ t.viewModal && /* @__PURE__ */ e.jsx(
2709
+ De,
2710
+ {
2711
+ isOpen: T,
2712
+ onClose: () => {
2713
+ S(!1), W(null);
2714
+ },
2715
+ icon: (te = t.viewModal) == null ? void 0 : te.icon,
2716
+ title: ((X = t.viewModal) == null ? void 0 : X.title) || "View Details",
2717
+ size: ((ue = t.viewModal) == null ? void 0 : ue.size) || "lg",
2718
+ footerConfig: t == null ? void 0 : t.viewModal.footer,
2719
+ children: (je = t.viewModal) != null && je.component ? /* @__PURE__ */ e.jsx(t.viewModal.component, { data: O }) : /* @__PURE__ */ e.jsx(
2720
+ ra,
2721
+ {
2722
+ data: O,
2723
+ config: t.viewModal || {}
2724
+ }
2725
+ )
2726
+ }
2727
+ )
2728
+ ] })
2729
+ }
2730
+ );
2731
+ }, Ve = a.shape({
2732
+ value: a.oneOfType([
2733
+ a.string,
2734
+ a.number,
2735
+ a.bool
2736
+ ]).isRequired,
2737
+ label: a.string.isRequired,
2738
+ color: a.string
2739
+ }), Ge = a.shape({
2740
+ type: a.string.isRequired,
2741
+ label: a.string.isRequired,
2742
+ color: a.string,
2743
+ variant: a.string,
2744
+ onClick: a.func
2745
+ }), aa = a.shape({
2746
+ title: a.string.isRequired,
2747
+ type: a.string.isRequired,
2748
+ variant: a.string,
2749
+ icon: a.node
2750
+ }), ta = a.shape({
2751
+ key: a.string.isRequired,
2752
+ title: a.string,
2753
+ type: a.string,
2754
+ imageKey: a.string,
2755
+ titleKey: a.string,
2756
+ subtitleKey: a.string,
2757
+ onClickDetails: a.bool,
2758
+ variant: a.string,
2759
+ chipOptions: a.arrayOf(Ve),
2760
+ defaultColor: a.string,
2761
+ className: a.string,
2762
+ format: a.string,
2763
+ menuList: a.arrayOf(aa)
2764
+ }), Ye = a.shape({
2765
+ key: a.string.isRequired,
2766
+ label: a.string,
2767
+ type: a.string.isRequired,
2768
+ required: a.bool,
2769
+ minLength: a.number,
2770
+ parentClass: a.string,
2771
+ search: a.bool,
2772
+ multiple: a.bool,
2773
+ dropdownMaxHeight: a.string,
2774
+ dragDrop: a.bool,
2775
+ countriesList: a.bool,
2776
+ defaultCountry: a.string,
2777
+ placeholder: a.string,
2778
+ rows: a.number,
2779
+ text: a.string,
2780
+ editorKey: a.string,
2781
+ options: a.arrayOf(Ve)
2782
+ }), na = a.shape({
2783
+ key: a.string,
2784
+ label: a.string,
2785
+ type: a.string,
2786
+ imageKey: a.string,
2787
+ titleKey: a.string,
2788
+ subtitleKey: a.string,
2789
+ blockClass: a.string,
2790
+ icon: a.node,
2791
+ variant: a.string,
2792
+ chipOptions: a.arrayOf(Ve),
2793
+ defaultColor: a.string,
2794
+ className: a.string,
2795
+ format: a.string
2796
+ });
2797
+ mr.propTypes = {
2798
+ config: a.shape({
2799
+ title: a.string.isRequired,
2800
+ description: a.string,
2801
+ buttonText: a.string,
2802
+ fetchData: a.func.isRequired,
2803
+ isStaticData: a.bool,
2804
+ /* ================= TABLE CONFIG ================= */
2805
+ tableConfig: a.shape({
2806
+ table_head: a.arrayOf(ta).isRequired,
2807
+ search: a.shape({
2808
+ enabled: a.bool,
2809
+ useServerSideSearch: a.bool,
2810
+ searchKeys: a.arrayOf(a.string)
2811
+ }),
2812
+ pagination: a.shape({
2813
+ enabled: a.bool,
2814
+ useServerSidePagination: a.bool
2815
+ }),
2816
+ filter: a.shape({
2817
+ enabled: a.bool,
2818
+ useServerSideFilters: a.bool
2819
+ })
2820
+ }).isRequired,
2821
+ /* ================= MODAL CONFIG ================= */
2822
+ modalConfig: a.shape({
2823
+ addModal: a.shape({
2824
+ title: a.string.isRequired,
2825
+ size: a.string,
2826
+ formClass: a.string,
2827
+ formFields: a.arrayOf(Ye),
2828
+ handleSubmit: a.func.isRequired,
2829
+ actionButtons: a.arrayOf(Ge)
2830
+ }),
2831
+ editModal: a.shape({
2832
+ title: a.string.isRequired,
2833
+ size: a.string,
2834
+ formClass: a.string,
2835
+ formFields: a.arrayOf(Ye),
2836
+ handleSubmit: a.func.isRequired,
2837
+ actionButtons: a.arrayOf(Ge)
2838
+ }),
2839
+ deleteModal: a.shape({
2840
+ title: a.string.isRequired,
2841
+ size: a.string,
2842
+ confirmText: a.string,
2843
+ referenceKey: a.string,
2844
+ actionButtons: a.arrayOf(Ge)
2845
+ }),
2846
+ viewModal: a.shape({
2847
+ title: a.string.isRequired,
2848
+ size: a.string,
2849
+ // 👇 This covers your commented code:
2850
+ component: a.elementType,
2851
+ // for custom component like TeamMemberDetail
2852
+ fields: a.arrayOf(na),
2853
+ footer: a.shape({
2854
+ cancelButton: a.bool,
2855
+ cancelText: a.string
2856
+ })
2857
+ })
2858
+ }),
2859
+ /* ================= FILTER CONFIG ================= */
2860
+ filterConfig: a.shape({
2861
+ fields: a.arrayOf(Ye)
2862
+ })
2863
+ }).isRequired
2864
+ };
2865
+ function ha(h) {
2866
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(mr, { config: h }) });
2867
+ }
2868
+ export {
2869
+ ha as default
2870
+ };
2871
+ //# sourceMappingURL=index.es.js.map