jc-react-datatable 1.0.0 → 1.0.1

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.
@@ -1,1651 +1,1076 @@
1
- import Ye, { useState as Re, useEffect as vr, useMemo as We } from "react";
2
- function Lr(r) {
3
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useMemo } from "react";
3
+ import require$$0 from "react-is";
4
+ function getDefaultExportFromCjs(x) {
5
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
4
6
  }
5
- var qe = { exports: {} }, Ee = {};
6
- /**
7
- * @license React
8
- * react-jsx-runtime.production.min.js
9
- *
10
- * Copyright (c) Facebook, Inc. and its affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- */
15
- var tr;
16
- function Vr() {
17
- if (tr)
18
- return Ee;
19
- tr = 1;
20
- var r = Ye, h = Symbol.for("react.element"), b = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, p = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
21
- function y(i, d, f) {
22
- var v, g = {}, k = null, P = null;
23
- f !== void 0 && (k = "" + f), d.key !== void 0 && (k = "" + d.key), d.ref !== void 0 && (P = d.ref);
24
- for (v in d)
25
- a.call(d, v) && !u.hasOwnProperty(v) && (g[v] = d[v]);
26
- if (i && i.defaultProps)
27
- for (v in d = i.defaultProps, d)
28
- g[v] === void 0 && (g[v] = d[v]);
29
- return { $$typeof: h, type: i, key: k, ref: P, props: g, _owner: p.current };
30
- }
31
- return Ee.Fragment = b, Ee.jsx = y, Ee.jsxs = y, Ee;
32
- }
33
- var Te = {};
34
- /**
35
- * @license React
36
- * react-jsx-runtime.development.js
37
- *
38
- * Copyright (c) Facebook, Inc. and its affiliates.
39
- *
40
- * This source code is licensed under the MIT license found in the
41
- * LICENSE file in the root directory of this source tree.
42
- */
43
- var nr;
44
- function Ur() {
45
- return nr || (nr = 1, process.env.NODE_ENV !== "production" && function() {
46
- var r = Ye, h = Symbol.for("react.element"), b = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), y = Symbol.for("react.provider"), i = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), Y = Symbol.iterator, N = "@@iterator";
47
- function B(e) {
48
- if (e === null || typeof e != "object")
49
- return null;
50
- var t = Y && e[Y] || e[N];
51
- return typeof t == "function" ? t : null;
52
- }
53
- var V = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
54
- function W(e) {
55
- {
56
- for (var t = arguments.length, o = new Array(t > 1 ? t - 1 : 0), m = 1; m < t; m++)
57
- o[m - 1] = arguments[m];
58
- U("error", e, o);
59
- }
60
- }
61
- function U(e, t, o) {
62
- {
63
- var m = V.ReactDebugCurrentFrame, D = m.getStackAddendum();
64
- D !== "" && (t += "%s", o = o.concat([D]));
65
- var q = o.map(function($) {
66
- return String($);
67
- });
68
- q.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, q);
69
- }
70
- }
71
- var L = !1, c = !1, te = !1, ie = !1, be = !1, ce;
72
- ce = Symbol.for("react.module.reference");
73
- function he(e) {
74
- return !!(typeof e == "string" || typeof e == "function" || e === a || e === u || be || e === p || e === f || e === v || ie || e === P || L || c || te || typeof e == "object" && e !== null && (e.$$typeof === k || e.$$typeof === g || e.$$typeof === y || e.$$typeof === i || e.$$typeof === d || // This needs to include all possible module reference object
75
- // types supported by any Flight configuration anywhere since
76
- // we don't know which Flight build this will end up being used
77
- // with.
78
- e.$$typeof === ce || e.getModuleId !== void 0));
79
- }
80
- function fe(e, t, o) {
81
- var m = e.displayName;
82
- if (m)
83
- return m;
84
- var D = t.displayName || t.name || "";
85
- return D !== "" ? o + "(" + D + ")" : o;
86
- }
87
- function le(e) {
88
- return e.displayName || "Context";
89
- }
90
- function G(e) {
91
- if (e == null)
92
- return null;
93
- if (typeof e.tag == "number" && W("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
94
- return e.displayName || e.name || null;
95
- if (typeof e == "string")
96
- return e;
97
- switch (e) {
98
- case a:
99
- return "Fragment";
100
- case b:
101
- return "Portal";
102
- case u:
103
- return "Profiler";
104
- case p:
105
- return "StrictMode";
106
- case f:
107
- return "Suspense";
108
- case v:
109
- return "SuspenseList";
110
- }
111
- if (typeof e == "object")
112
- switch (e.$$typeof) {
113
- case i:
114
- var t = e;
115
- return le(t) + ".Consumer";
116
- case y:
117
- var o = e;
118
- return le(o._context) + ".Provider";
119
- case d:
120
- return fe(e, e.render, "ForwardRef");
121
- case g:
122
- var m = e.displayName || null;
123
- return m !== null ? m : G(e.type) || "Memo";
124
- case k: {
125
- var D = e, q = D._payload, $ = D._init;
126
- try {
127
- return G($(q));
128
- } catch {
129
- return null;
130
- }
131
- }
132
- }
133
- return null;
134
- }
135
- var X = Object.assign, ae = 0, Q, ne, oe, de, n, l, x;
136
- function j() {
137
- }
138
- j.__reactDisabledLog = !0;
139
- function T() {
140
- {
141
- if (ae === 0) {
142
- Q = console.log, ne = console.info, oe = console.warn, de = console.error, n = console.group, l = console.groupCollapsed, x = console.groupEnd;
143
- var e = {
144
- configurable: !0,
145
- enumerable: !0,
146
- value: j,
147
- writable: !0
148
- };
149
- Object.defineProperties(console, {
150
- info: e,
151
- log: e,
152
- warn: e,
153
- error: e,
154
- group: e,
155
- groupCollapsed: e,
156
- groupEnd: e
157
- });
158
- }
159
- ae++;
160
- }
161
- }
162
- function A() {
163
- {
164
- if (ae--, ae === 0) {
165
- var e = {
166
- configurable: !0,
167
- enumerable: !0,
168
- writable: !0
169
- };
170
- Object.defineProperties(console, {
171
- log: X({}, e, {
172
- value: Q
173
- }),
174
- info: X({}, e, {
175
- value: ne
176
- }),
177
- warn: X({}, e, {
178
- value: oe
179
- }),
180
- error: X({}, e, {
181
- value: de
182
- }),
183
- group: X({}, e, {
184
- value: n
185
- }),
186
- groupCollapsed: X({}, e, {
187
- value: l
188
- }),
189
- groupEnd: X({}, e, {
190
- value: x
191
- })
192
- });
193
- }
194
- ae < 0 && W("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
195
- }
196
- }
197
- var R = V.ReactCurrentDispatcher, _;
198
- function O(e, t, o) {
199
- {
200
- if (_ === void 0)
201
- try {
202
- throw Error();
203
- } catch (D) {
204
- var m = D.stack.trim().match(/\n( *(at )?)/);
205
- _ = m && m[1] || "";
206
- }
207
- return `
208
- ` + _ + e;
209
- }
210
- }
211
- var I = !1, C;
212
- {
213
- var H = typeof WeakMap == "function" ? WeakMap : Map;
214
- C = new H();
215
- }
216
- function s(e, t) {
217
- if (!e || I)
218
- return "";
219
- {
220
- var o = C.get(e);
221
- if (o !== void 0)
222
- return o;
223
- }
224
- var m;
225
- I = !0;
226
- var D = Error.prepareStackTrace;
227
- Error.prepareStackTrace = void 0;
228
- var q;
229
- q = R.current, R.current = null, T();
230
- try {
231
- if (t) {
232
- var $ = function() {
233
- throw Error();
234
- };
235
- if (Object.defineProperty($.prototype, "props", {
236
- set: function() {
237
- throw Error();
238
- }
239
- }), typeof Reflect == "object" && Reflect.construct) {
240
- try {
241
- Reflect.construct($, []);
242
- } catch (Z) {
243
- m = Z;
244
- }
245
- Reflect.construct(e, [], $);
246
- } else {
247
- try {
248
- $.call();
249
- } catch (Z) {
250
- m = Z;
251
- }
252
- e.call($.prototype);
253
- }
254
- } else {
255
- try {
256
- throw Error();
257
- } catch (Z) {
258
- m = Z;
259
- }
260
- e();
261
- }
262
- } catch (Z) {
263
- if (Z && m && typeof Z.stack == "string") {
264
- for (var w = Z.stack.split(`
265
- `), K = m.stack.split(`
266
- `), z = w.length - 1, J = K.length - 1; z >= 1 && J >= 0 && w[z] !== K[J]; )
267
- J--;
268
- for (; z >= 1 && J >= 0; z--, J--)
269
- if (w[z] !== K[J]) {
270
- if (z !== 1 || J !== 1)
271
- do
272
- if (z--, J--, J < 0 || w[z] !== K[J]) {
273
- var re = `
274
- ` + w[z].replace(" at new ", " at ");
275
- return e.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", e.displayName)), typeof e == "function" && C.set(e, re), re;
276
- }
277
- while (z >= 1 && J >= 0);
278
- break;
279
- }
280
- }
281
- } finally {
282
- I = !1, R.current = q, A(), Error.prepareStackTrace = D;
283
- }
284
- var ye = e ? e.displayName || e.name : "", ue = ye ? O(ye) : "";
285
- return typeof e == "function" && C.set(e, ue), ue;
286
- }
287
- function ee(e, t, o) {
288
- return s(e, !1);
289
- }
290
- function ve(e) {
291
- var t = e.prototype;
292
- return !!(t && t.isReactComponent);
293
- }
294
- function se(e, t, o) {
295
- if (e == null)
296
- return "";
297
- if (typeof e == "function")
298
- return s(e, ve(e));
299
- if (typeof e == "string")
300
- return O(e);
301
- switch (e) {
302
- case f:
303
- return O("Suspense");
304
- case v:
305
- return O("SuspenseList");
306
- }
307
- if (typeof e == "object")
308
- switch (e.$$typeof) {
309
- case d:
310
- return ee(e.render);
311
- case g:
312
- return se(e.type, t, o);
313
- case k: {
314
- var m = e, D = m._payload, q = m._init;
315
- try {
316
- return se(q(D), t, o);
317
- } catch {
318
- }
319
- }
320
- }
321
- return "";
322
- }
323
- var ge = Object.prototype.hasOwnProperty, Ve = {}, Ue = V.ReactDebugCurrentFrame;
324
- function _e(e) {
325
- if (e) {
326
- var t = e._owner, o = se(e.type, e._source, t ? t.type : null);
327
- Ue.setExtraStackFrame(o);
328
- } else
329
- Ue.setExtraStackFrame(null);
330
- }
331
- function Er(e, t, o, m, D) {
332
- {
333
- var q = Function.call.bind(ge);
334
- for (var $ in e)
335
- if (q(e, $)) {
336
- var w = void 0;
337
- try {
338
- if (typeof e[$] != "function") {
339
- var K = Error((m || "React class") + ": " + o + " type `" + $ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[$] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
340
- throw K.name = "Invariant Violation", K;
341
- }
342
- w = e[$](t, $, m, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
343
- } catch (z) {
344
- w = z;
345
- }
346
- w && !(w instanceof Error) && (_e(D), 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).", m || "React class", o, $, typeof w), _e(null)), w instanceof Error && !(w.message in Ve) && (Ve[w.message] = !0, _e(D), W("Failed %s type: %s", o, w.message), _e(null));
347
- }
348
- }
349
- }
350
- var Tr = Array.isArray;
351
- function je(e) {
352
- return Tr(e);
353
- }
354
- function Rr(e) {
355
- {
356
- var t = typeof Symbol == "function" && Symbol.toStringTag, o = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
357
- return o;
358
- }
359
- }
360
- function _r(e) {
361
- try {
362
- return ze(e), !1;
363
- } catch {
364
- return !0;
365
- }
366
- }
367
- function ze(e) {
368
- return "" + e;
369
- }
370
- function Be(e) {
371
- if (_r(e))
372
- return W("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Rr(e)), ze(e);
373
- }
374
- var me = V.ReactCurrentOwner, Sr = {
375
- key: !0,
376
- ref: !0,
377
- __self: !0,
378
- __source: !0
379
- }, Je, He, xe;
380
- xe = {};
381
- function Pr(e) {
382
- if (ge.call(e, "ref")) {
383
- var t = Object.getOwnPropertyDescriptor(e, "ref").get;
384
- if (t && t.isReactWarning)
385
- return !1;
386
- }
387
- return e.ref !== void 0;
388
- }
389
- function jr(e) {
390
- if (ge.call(e, "key")) {
391
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
392
- if (t && t.isReactWarning)
393
- return !1;
394
- }
395
- return e.key !== void 0;
396
- }
397
- function xr(e, t) {
398
- if (typeof e.ref == "string" && me.current && t && me.current.stateNode !== t) {
399
- var o = G(me.current.type);
400
- xe[o] || (W('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', G(me.current.type), e.ref), xe[o] = !0);
401
- }
402
- }
403
- function Or(e, t) {
404
- {
405
- var o = function() {
406
- Je || (Je = !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)", t));
407
- };
408
- o.isReactWarning = !0, Object.defineProperty(e, "key", {
409
- get: o,
410
- configurable: !0
411
- });
412
- }
413
- }
414
- function Cr(e, t) {
415
- {
416
- var o = function() {
417
- He || (He = !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)", t));
418
- };
419
- o.isReactWarning = !0, Object.defineProperty(e, "ref", {
420
- get: o,
421
- configurable: !0
422
- });
423
- }
424
- }
425
- var wr = function(e, t, o, m, D, q, $) {
426
- var w = {
427
- // This tag allows us to uniquely identify this as a React Element
428
- $$typeof: h,
429
- // Built-in properties that belong on the element
430
- type: e,
431
- key: t,
432
- ref: o,
433
- props: $,
434
- // Record the component responsible for creating this element.
435
- _owner: q
436
- };
437
- return w._store = {}, Object.defineProperty(w._store, "validated", {
438
- configurable: !1,
439
- enumerable: !1,
440
- writable: !0,
441
- value: !1
442
- }), Object.defineProperty(w, "_self", {
443
- configurable: !1,
444
- enumerable: !1,
445
- writable: !1,
446
- value: m
447
- }), Object.defineProperty(w, "_source", {
448
- configurable: !1,
449
- enumerable: !1,
450
- writable: !1,
451
- value: D
452
- }), Object.freeze && (Object.freeze(w.props), Object.freeze(w)), w;
453
- };
454
- function kr(e, t, o, m, D) {
455
- {
456
- var q, $ = {}, w = null, K = null;
457
- o !== void 0 && (Be(o), w = "" + o), jr(t) && (Be(t.key), w = "" + t.key), Pr(t) && (K = t.ref, xr(t, D));
458
- for (q in t)
459
- ge.call(t, q) && !Sr.hasOwnProperty(q) && ($[q] = t[q]);
460
- if (e && e.defaultProps) {
461
- var z = e.defaultProps;
462
- for (q in z)
463
- $[q] === void 0 && ($[q] = z[q]);
464
- }
465
- if (w || K) {
466
- var J = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
467
- w && Or($, J), K && Cr($, J);
468
- }
469
- return wr(e, w, K, D, m, me.current, $);
470
- }
471
- }
472
- var Oe = V.ReactCurrentOwner, Ke = V.ReactDebugCurrentFrame;
473
- function pe(e) {
474
- if (e) {
475
- var t = e._owner, o = se(e.type, e._source, t ? t.type : null);
476
- Ke.setExtraStackFrame(o);
477
- } else
478
- Ke.setExtraStackFrame(null);
479
- }
480
- var Ce;
481
- Ce = !1;
482
- function we(e) {
483
- return typeof e == "object" && e !== null && e.$$typeof === h;
484
- }
485
- function Ge() {
486
- {
487
- if (Oe.current) {
488
- var e = G(Oe.current.type);
489
- if (e)
490
- return `
491
-
492
- Check the render method of \`` + e + "`.";
493
- }
494
- return "";
495
- }
7
+ var propTypes = { exports: {} };
8
+ var objectAssign;
9
+ var hasRequiredObjectAssign;
10
+ function requireObjectAssign() {
11
+ if (hasRequiredObjectAssign) return objectAssign;
12
+ hasRequiredObjectAssign = 1;
13
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
14
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
15
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
16
+ function toObject(val) {
17
+ if (val === null || val === void 0) {
18
+ throw new TypeError("Object.assign cannot be called with null or undefined");
496
19
  }
497
- function Ar(e) {
498
- {
499
- if (e !== void 0) {
500
- var t = e.fileName.replace(/^.*[\\\/]/, ""), o = e.lineNumber;
501
- return `
502
-
503
- Check your code at ` + t + ":" + o + ".";
504
- }
505
- return "";
20
+ return Object(val);
21
+ }
22
+ function shouldUseNative() {
23
+ try {
24
+ if (!Object.assign) {
25
+ return false;
506
26
  }
507
- }
508
- var Xe = {};
509
- function $r(e) {
510
- {
511
- var t = Ge();
512
- if (!t) {
513
- var o = typeof e == "string" ? e : e.displayName || e.name;
514
- o && (t = `
515
-
516
- Check the top-level render call using <` + o + ">.");
517
- }
518
- return t;
27
+ var test1 = new String("abc");
28
+ test1[5] = "de";
29
+ if (Object.getOwnPropertyNames(test1)[0] === "5") {
30
+ return false;
519
31
  }
520
- }
521
- function Ze(e, t) {
522
- {
523
- if (!e._store || e._store.validated || e.key != null)
524
- return;
525
- e._store.validated = !0;
526
- var o = $r(t);
527
- if (Xe[o])
528
- return;
529
- Xe[o] = !0;
530
- var m = "";
531
- e && e._owner && e._owner !== Oe.current && (m = " It was passed a child from " + G(e._owner.type) + "."), pe(e), W('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, m), pe(null);
32
+ var test2 = {};
33
+ for (var i = 0; i < 10; i++) {
34
+ test2["_" + String.fromCharCode(i)] = i;
532
35
  }
533
- }
534
- function Qe(e, t) {
535
- {
536
- if (typeof e != "object")
537
- return;
538
- if (je(e))
539
- for (var o = 0; o < e.length; o++) {
540
- var m = e[o];
541
- we(m) && Ze(m, t);
542
- }
543
- else if (we(e))
544
- e._store && (e._store.validated = !0);
545
- else if (e) {
546
- var D = B(e);
547
- if (typeof D == "function" && D !== e.entries)
548
- for (var q = D.call(e), $; !($ = q.next()).done; )
549
- we($.value) && Ze($.value, t);
550
- }
551
- }
552
- }
553
- function Ir(e) {
554
- {
555
- var t = e.type;
556
- if (t == null || typeof t == "string")
557
- return;
558
- var o;
559
- if (typeof t == "function")
560
- o = t.propTypes;
561
- else if (typeof t == "object" && (t.$$typeof === d || // Note: Memo only checks outer props here.
562
- // Inner props are checked in the reconciler.
563
- t.$$typeof === g))
564
- o = t.propTypes;
565
- else
566
- return;
567
- if (o) {
568
- var m = G(t);
569
- Er(o, e.props, "prop", m, e);
570
- } else if (t.PropTypes !== void 0 && !Ce) {
571
- Ce = !0;
572
- var D = G(t);
573
- W("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", D || "Unknown");
574
- }
575
- typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && W("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
36
+ var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
37
+ return test2[n];
38
+ });
39
+ if (order2.join("") !== "0123456789") {
40
+ return false;
576
41
  }
577
- }
578
- function Dr(e) {
579
- {
580
- for (var t = Object.keys(e.props), o = 0; o < t.length; o++) {
581
- var m = t[o];
582
- if (m !== "children" && m !== "key") {
583
- pe(e), W("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", m), pe(null);
584
- break;
585
- }
586
- }
587
- e.ref !== null && (pe(e), W("Invalid attribute `ref` supplied to `React.Fragment`."), pe(null));
42
+ var test3 = {};
43
+ "abcdefghijklmnopqrst".split("").forEach(function(letter) {
44
+ test3[letter] = letter;
45
+ });
46
+ if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
47
+ return false;
588
48
  }
49
+ return true;
50
+ } catch (err) {
51
+ return false;
589
52
  }
590
- var er = {};
591
- function rr(e, t, o, m, D, q) {
592
- {
593
- var $ = he(e);
594
- if (!$) {
595
- var w = "";
596
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (w += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
597
- var K = Ar(D);
598
- K ? w += K : w += Ge();
599
- var z;
600
- e === null ? z = "null" : je(e) ? z = "array" : e !== void 0 && e.$$typeof === h ? (z = "<" + (G(e.type) || "Unknown") + " />", w = " Did you accidentally export a JSX literal instead of a component?") : z = typeof e, W("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", z, w);
601
- }
602
- var J = kr(e, t, o, D, q);
603
- if (J == null)
604
- return J;
605
- if ($) {
606
- var re = t.children;
607
- if (re !== void 0)
608
- if (m)
609
- if (je(re)) {
610
- for (var ye = 0; ye < re.length; ye++)
611
- Qe(re[ye], e);
612
- Object.freeze && Object.freeze(re);
613
- } else
614
- 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.");
615
- else
616
- Qe(re, e);
617
- }
618
- if (ge.call(t, "key")) {
619
- var ue = G(e), Z = Object.keys(t).filter(function(Wr) {
620
- return Wr !== "key";
621
- }), ke = Z.length > 0 ? "{key: someKey, " + Z.join(": ..., ") + ": ...}" : "{key: someKey}";
622
- if (!er[ue + ke]) {
623
- var Yr = Z.length > 0 ? "{" + Z.join(": ..., ") + ": ...}" : "{}";
624
- W(`A props object containing a "key" prop is being spread into JSX:
625
- let props = %s;
626
- <%s {...props} />
627
- React keys must be passed directly to JSX without using spread:
628
- let props = %s;
629
- <%s key={someKey} {...props} />`, ke, ue, Yr, ue), er[ue + ke] = !0;
630
- }
53
+ }
54
+ objectAssign = shouldUseNative() ? Object.assign : function(target, source) {
55
+ var from;
56
+ var to = toObject(target);
57
+ var symbols;
58
+ for (var s = 1; s < arguments.length; s++) {
59
+ from = Object(arguments[s]);
60
+ for (var key in from) {
61
+ if (hasOwnProperty.call(from, key)) {
62
+ to[key] = from[key];
631
63
  }
632
- return e === a ? Dr(J) : Ir(J), J;
633
64
  }
634
- }
635
- function Fr(e, t, o) {
636
- return rr(e, t, o, !0);
637
- }
638
- function Mr(e, t, o) {
639
- return rr(e, t, o, !1);
640
- }
641
- var qr = Mr, Nr = Fr;
642
- Te.Fragment = a, Te.jsx = qr, Te.jsxs = Nr;
643
- }()), Te;
644
- }
645
- process.env.NODE_ENV === "production" ? qe.exports = Vr() : qe.exports = Ur();
646
- var S = qe.exports, Ne = { exports: {} }, Se = { exports: {} }, F = {};
647
- /** @license React v16.13.1
648
- * react-is.production.min.js
649
- *
650
- * Copyright (c) Facebook, Inc. and its affiliates.
651
- *
652
- * This source code is licensed under the MIT license found in the
653
- * LICENSE file in the root directory of this source tree.
654
- */
655
- var ar;
656
- function zr() {
657
- if (ar)
658
- return F;
659
- ar = 1;
660
- var r = typeof Symbol == "function" && Symbol.for, h = r ? Symbol.for("react.element") : 60103, b = r ? Symbol.for("react.portal") : 60106, a = r ? Symbol.for("react.fragment") : 60107, p = r ? Symbol.for("react.strict_mode") : 60108, u = r ? Symbol.for("react.profiler") : 60114, y = r ? Symbol.for("react.provider") : 60109, i = r ? Symbol.for("react.context") : 60110, d = r ? Symbol.for("react.async_mode") : 60111, f = r ? Symbol.for("react.concurrent_mode") : 60111, v = r ? Symbol.for("react.forward_ref") : 60112, g = r ? Symbol.for("react.suspense") : 60113, k = r ? Symbol.for("react.suspense_list") : 60120, P = r ? Symbol.for("react.memo") : 60115, Y = r ? Symbol.for("react.lazy") : 60116, N = r ? Symbol.for("react.block") : 60121, B = r ? Symbol.for("react.fundamental") : 60117, V = r ? Symbol.for("react.responder") : 60118, W = r ? Symbol.for("react.scope") : 60119;
661
- function U(c) {
662
- if (typeof c == "object" && c !== null) {
663
- var te = c.$$typeof;
664
- switch (te) {
665
- case h:
666
- switch (c = c.type, c) {
667
- case d:
668
- case f:
669
- case a:
670
- case u:
671
- case p:
672
- case g:
673
- return c;
674
- default:
675
- switch (c = c && c.$$typeof, c) {
676
- case i:
677
- case v:
678
- case Y:
679
- case P:
680
- case y:
681
- return c;
682
- default:
683
- return te;
684
- }
65
+ if (getOwnPropertySymbols) {
66
+ symbols = getOwnPropertySymbols(from);
67
+ for (var i = 0; i < symbols.length; i++) {
68
+ if (propIsEnumerable.call(from, symbols[i])) {
69
+ to[symbols[i]] = from[symbols[i]];
685
70
  }
686
- case b:
687
- return te;
688
- }
689
- }
690
- }
691
- function L(c) {
692
- return U(c) === f;
693
- }
694
- return F.AsyncMode = d, F.ConcurrentMode = f, F.ContextConsumer = i, F.ContextProvider = y, F.Element = h, F.ForwardRef = v, F.Fragment = a, F.Lazy = Y, F.Memo = P, F.Portal = b, F.Profiler = u, F.StrictMode = p, F.Suspense = g, F.isAsyncMode = function(c) {
695
- return L(c) || U(c) === d;
696
- }, F.isConcurrentMode = L, F.isContextConsumer = function(c) {
697
- return U(c) === i;
698
- }, F.isContextProvider = function(c) {
699
- return U(c) === y;
700
- }, F.isElement = function(c) {
701
- return typeof c == "object" && c !== null && c.$$typeof === h;
702
- }, F.isForwardRef = function(c) {
703
- return U(c) === v;
704
- }, F.isFragment = function(c) {
705
- return U(c) === a;
706
- }, F.isLazy = function(c) {
707
- return U(c) === Y;
708
- }, F.isMemo = function(c) {
709
- return U(c) === P;
710
- }, F.isPortal = function(c) {
711
- return U(c) === b;
712
- }, F.isProfiler = function(c) {
713
- return U(c) === u;
714
- }, F.isStrictMode = function(c) {
715
- return U(c) === p;
716
- }, F.isSuspense = function(c) {
717
- return U(c) === g;
718
- }, F.isValidElementType = function(c) {
719
- return typeof c == "string" || typeof c == "function" || c === a || c === f || c === u || c === p || c === g || c === k || typeof c == "object" && c !== null && (c.$$typeof === Y || c.$$typeof === P || c.$$typeof === y || c.$$typeof === i || c.$$typeof === v || c.$$typeof === B || c.$$typeof === V || c.$$typeof === W || c.$$typeof === N);
720
- }, F.typeOf = U, F;
721
- }
722
- var M = {};
723
- /** @license React v16.13.1
724
- * react-is.development.js
725
- *
726
- * Copyright (c) Facebook, Inc. and its affiliates.
727
- *
728
- * This source code is licensed under the MIT license found in the
729
- * LICENSE file in the root directory of this source tree.
730
- */
731
- var ir;
732
- function Br() {
733
- return ir || (ir = 1, process.env.NODE_ENV !== "production" && function() {
734
- var r = typeof Symbol == "function" && Symbol.for, h = r ? Symbol.for("react.element") : 60103, b = r ? Symbol.for("react.portal") : 60106, a = r ? Symbol.for("react.fragment") : 60107, p = r ? Symbol.for("react.strict_mode") : 60108, u = r ? Symbol.for("react.profiler") : 60114, y = r ? Symbol.for("react.provider") : 60109, i = r ? Symbol.for("react.context") : 60110, d = r ? Symbol.for("react.async_mode") : 60111, f = r ? Symbol.for("react.concurrent_mode") : 60111, v = r ? Symbol.for("react.forward_ref") : 60112, g = r ? Symbol.for("react.suspense") : 60113, k = r ? Symbol.for("react.suspense_list") : 60120, P = r ? Symbol.for("react.memo") : 60115, Y = r ? Symbol.for("react.lazy") : 60116, N = r ? Symbol.for("react.block") : 60121, B = r ? Symbol.for("react.fundamental") : 60117, V = r ? Symbol.for("react.responder") : 60118, W = r ? Symbol.for("react.scope") : 60119;
735
- function U(s) {
736
- return typeof s == "string" || typeof s == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
737
- s === a || s === f || s === u || s === p || s === g || s === k || typeof s == "object" && s !== null && (s.$$typeof === Y || s.$$typeof === P || s.$$typeof === y || s.$$typeof === i || s.$$typeof === v || s.$$typeof === B || s.$$typeof === V || s.$$typeof === W || s.$$typeof === N);
738
- }
739
- function L(s) {
740
- if (typeof s == "object" && s !== null) {
741
- var ee = s.$$typeof;
742
- switch (ee) {
743
- case h:
744
- var ve = s.type;
745
- switch (ve) {
746
- case d:
747
- case f:
748
- case a:
749
- case u:
750
- case p:
751
- case g:
752
- return ve;
753
- default:
754
- var se = ve && ve.$$typeof;
755
- switch (se) {
756
- case i:
757
- case v:
758
- case Y:
759
- case P:
760
- case y:
761
- return se;
762
- default:
763
- return ee;
764
- }
765
- }
766
- case b:
767
- return ee;
768
71
  }
769
72
  }
770
73
  }
771
- var c = d, te = f, ie = i, be = y, ce = h, he = v, fe = a, le = Y, G = P, X = b, ae = u, Q = p, ne = g, oe = !1;
772
- function de(s) {
773
- return oe || (oe = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), n(s) || L(s) === d;
774
- }
775
- function n(s) {
776
- return L(s) === f;
777
- }
778
- function l(s) {
779
- return L(s) === i;
780
- }
781
- function x(s) {
782
- return L(s) === y;
783
- }
784
- function j(s) {
785
- return typeof s == "object" && s !== null && s.$$typeof === h;
786
- }
787
- function T(s) {
788
- return L(s) === v;
789
- }
790
- function A(s) {
791
- return L(s) === a;
792
- }
793
- function R(s) {
794
- return L(s) === Y;
795
- }
796
- function _(s) {
797
- return L(s) === P;
798
- }
799
- function O(s) {
800
- return L(s) === b;
801
- }
802
- function I(s) {
803
- return L(s) === u;
804
- }
805
- function C(s) {
806
- return L(s) === p;
807
- }
808
- function H(s) {
809
- return L(s) === g;
810
- }
811
- M.AsyncMode = c, M.ConcurrentMode = te, M.ContextConsumer = ie, M.ContextProvider = be, M.Element = ce, M.ForwardRef = he, M.Fragment = fe, M.Lazy = le, M.Memo = G, M.Portal = X, M.Profiler = ae, M.StrictMode = Q, M.Suspense = ne, M.isAsyncMode = de, M.isConcurrentMode = n, M.isContextConsumer = l, M.isContextProvider = x, M.isElement = j, M.isForwardRef = T, M.isFragment = A, M.isLazy = R, M.isMemo = _, M.isPortal = O, M.isProfiler = I, M.isStrictMode = C, M.isSuspense = H, M.isValidElementType = U, M.typeOf = L;
812
- }()), M;
813
- }
814
- var or;
815
- function pr() {
816
- return or || (or = 1, process.env.NODE_ENV === "production" ? Se.exports = zr() : Se.exports = Br()), Se.exports;
817
- }
818
- /*
819
- object-assign
820
- (c) Sindre Sorhus
821
- @license MIT
822
- */
823
- var Ae, sr;
824
- function Jr() {
825
- if (sr)
826
- return Ae;
827
- sr = 1;
828
- var r = Object.getOwnPropertySymbols, h = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
829
- function a(u) {
830
- if (u == null)
831
- throw new TypeError("Object.assign cannot be called with null or undefined");
832
- return Object(u);
833
- }
834
- function p() {
835
- try {
836
- if (!Object.assign)
837
- return !1;
838
- var u = new String("abc");
839
- if (u[5] = "de", Object.getOwnPropertyNames(u)[0] === "5")
840
- return !1;
841
- for (var y = {}, i = 0; i < 10; i++)
842
- y["_" + String.fromCharCode(i)] = i;
843
- var d = Object.getOwnPropertyNames(y).map(function(v) {
844
- return y[v];
845
- });
846
- if (d.join("") !== "0123456789")
847
- return !1;
848
- var f = {};
849
- return "abcdefghijklmnopqrst".split("").forEach(function(v) {
850
- f[v] = v;
851
- }), Object.keys(Object.assign({}, f)).join("") === "abcdefghijklmnopqrst";
852
- } catch {
853
- return !1;
854
- }
855
- }
856
- return Ae = p() ? Object.assign : function(u, y) {
857
- for (var i, d = a(u), f, v = 1; v < arguments.length; v++) {
858
- i = Object(arguments[v]);
859
- for (var g in i)
860
- h.call(i, g) && (d[g] = i[g]);
861
- if (r) {
862
- f = r(i);
863
- for (var k = 0; k < f.length; k++)
864
- b.call(i, f[k]) && (d[f[k]] = i[f[k]]);
865
- }
866
- }
867
- return d;
868
- }, Ae;
74
+ return to;
75
+ };
76
+ return objectAssign;
869
77
  }
870
- var $e, ur;
871
- function Le() {
872
- if (ur)
873
- return $e;
874
- ur = 1;
875
- var r = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
876
- return $e = r, $e;
78
+ var ReactPropTypesSecret_1;
79
+ var hasRequiredReactPropTypesSecret;
80
+ function requireReactPropTypesSecret() {
81
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
82
+ hasRequiredReactPropTypesSecret = 1;
83
+ var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
84
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
85
+ return ReactPropTypesSecret_1;
877
86
  }
878
- var Ie, cr;
879
- function yr() {
880
- return cr || (cr = 1, Ie = Function.call.bind(Object.prototype.hasOwnProperty)), Ie;
87
+ var has;
88
+ var hasRequiredHas;
89
+ function requireHas() {
90
+ if (hasRequiredHas) return has;
91
+ hasRequiredHas = 1;
92
+ has = Function.call.bind(Object.prototype.hasOwnProperty);
93
+ return has;
881
94
  }
882
- var De, fr;
883
- function Hr() {
884
- if (fr)
885
- return De;
886
- fr = 1;
887
- var r = function() {
95
+ var checkPropTypes_1;
96
+ var hasRequiredCheckPropTypes;
97
+ function requireCheckPropTypes() {
98
+ if (hasRequiredCheckPropTypes) return checkPropTypes_1;
99
+ hasRequiredCheckPropTypes = 1;
100
+ var printWarning = function() {
888
101
  };
889
102
  if (process.env.NODE_ENV !== "production") {
890
- var h = Le(), b = {}, a = yr();
891
- r = function(u) {
892
- var y = "Warning: " + u;
893
- typeof console < "u" && console.error(y);
103
+ var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
104
+ var loggedTypeFailures = {};
105
+ var has2 = /* @__PURE__ */ requireHas();
106
+ printWarning = function(text) {
107
+ var message = "Warning: " + text;
108
+ if (typeof console !== "undefined") {
109
+ console.error(message);
110
+ }
894
111
  try {
895
- throw new Error(y);
896
- } catch {
112
+ throw new Error(message);
113
+ } catch (x) {
897
114
  }
898
115
  };
899
116
  }
900
- function p(u, y, i, d, f) {
117
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
901
118
  if (process.env.NODE_ENV !== "production") {
902
- for (var v in u)
903
- if (a(u, v)) {
904
- var g;
119
+ for (var typeSpecName in typeSpecs) {
120
+ if (has2(typeSpecs, typeSpecName)) {
121
+ var error;
905
122
  try {
906
- if (typeof u[v] != "function") {
907
- var k = Error(
908
- (d || "React class") + ": " + i + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof u[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
123
+ if (typeof typeSpecs[typeSpecName] !== "function") {
124
+ var err = Error(
125
+ (componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
909
126
  );
910
- throw k.name = "Invariant Violation", k;
127
+ err.name = "Invariant Violation";
128
+ throw err;
911
129
  }
912
- g = u[v](y, v, d, i, null, h);
913
- } catch (Y) {
914
- g = Y;
130
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
131
+ } catch (ex) {
132
+ error = ex;
915
133
  }
916
- if (g && !(g instanceof Error) && r(
917
- (d || "React class") + ": type specification of " + i + " `" + v + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof g + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
918
- ), g instanceof Error && !(g.message in b)) {
919
- b[g.message] = !0;
920
- var P = f ? f() : "";
921
- r(
922
- "Failed " + i + " type: " + g.message + (P ?? "")
134
+ if (error && !(error instanceof Error)) {
135
+ printWarning(
136
+ (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
137
+ );
138
+ }
139
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
140
+ loggedTypeFailures[error.message] = true;
141
+ var stack = getStack ? getStack() : "";
142
+ printWarning(
143
+ "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
923
144
  );
924
145
  }
925
146
  }
147
+ }
926
148
  }
927
149
  }
928
- return p.resetWarningCache = function() {
929
- process.env.NODE_ENV !== "production" && (b = {});
930
- }, De = p, De;
150
+ checkPropTypes.resetWarningCache = function() {
151
+ if (process.env.NODE_ENV !== "production") {
152
+ loggedTypeFailures = {};
153
+ }
154
+ };
155
+ checkPropTypes_1 = checkPropTypes;
156
+ return checkPropTypes_1;
931
157
  }
932
- var Fe, lr;
933
- function Kr() {
934
- if (lr)
935
- return Fe;
936
- lr = 1;
937
- var r = pr(), h = Jr(), b = Le(), a = yr(), p = Hr(), u = function() {
158
+ var factoryWithTypeCheckers;
159
+ var hasRequiredFactoryWithTypeCheckers;
160
+ function requireFactoryWithTypeCheckers() {
161
+ if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
162
+ hasRequiredFactoryWithTypeCheckers = 1;
163
+ var ReactIs = require$$0;
164
+ var assign = requireObjectAssign();
165
+ var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
166
+ var has2 = /* @__PURE__ */ requireHas();
167
+ var checkPropTypes = /* @__PURE__ */ requireCheckPropTypes();
168
+ var printWarning = function() {
938
169
  };
939
- process.env.NODE_ENV !== "production" && (u = function(i) {
940
- var d = "Warning: " + i;
941
- typeof console < "u" && console.error(d);
942
- try {
943
- throw new Error(d);
944
- } catch {
945
- }
946
- });
947
- function y() {
170
+ if (process.env.NODE_ENV !== "production") {
171
+ printWarning = function(text) {
172
+ var message = "Warning: " + text;
173
+ if (typeof console !== "undefined") {
174
+ console.error(message);
175
+ }
176
+ try {
177
+ throw new Error(message);
178
+ } catch (x) {
179
+ }
180
+ };
181
+ }
182
+ function emptyFunctionThatReturnsNull() {
948
183
  return null;
949
184
  }
950
- return Fe = function(i, d) {
951
- var f = typeof Symbol == "function" && Symbol.iterator, v = "@@iterator";
952
- function g(n) {
953
- var l = n && (f && n[f] || n[v]);
954
- if (typeof l == "function")
955
- return l;
185
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
186
+ var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
187
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
188
+ function getIteratorFn(maybeIterable) {
189
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
190
+ if (typeof iteratorFn === "function") {
191
+ return iteratorFn;
192
+ }
956
193
  }
957
- var k = "<<anonymous>>", P = {
958
- array: V("array"),
959
- bigint: V("bigint"),
960
- bool: V("boolean"),
961
- func: V("function"),
962
- number: V("number"),
963
- object: V("object"),
964
- string: V("string"),
965
- symbol: V("symbol"),
966
- any: W(),
967
- arrayOf: U,
968
- element: L(),
969
- elementType: c(),
970
- instanceOf: te,
971
- node: he(),
972
- objectOf: be,
973
- oneOf: ie,
974
- oneOfType: ce,
975
- shape: le,
976
- exact: G
194
+ var ANONYMOUS = "<<anonymous>>";
195
+ var ReactPropTypes = {
196
+ array: createPrimitiveTypeChecker("array"),
197
+ bigint: createPrimitiveTypeChecker("bigint"),
198
+ bool: createPrimitiveTypeChecker("boolean"),
199
+ func: createPrimitiveTypeChecker("function"),
200
+ number: createPrimitiveTypeChecker("number"),
201
+ object: createPrimitiveTypeChecker("object"),
202
+ string: createPrimitiveTypeChecker("string"),
203
+ symbol: createPrimitiveTypeChecker("symbol"),
204
+ any: createAnyTypeChecker(),
205
+ arrayOf: createArrayOfTypeChecker,
206
+ element: createElementTypeChecker(),
207
+ elementType: createElementTypeTypeChecker(),
208
+ instanceOf: createInstanceTypeChecker,
209
+ node: createNodeChecker(),
210
+ objectOf: createObjectOfTypeChecker,
211
+ oneOf: createEnumTypeChecker,
212
+ oneOfType: createUnionTypeChecker,
213
+ shape: createShapeTypeChecker,
214
+ exact: createStrictShapeTypeChecker
977
215
  };
978
- function Y(n, l) {
979
- return n === l ? n !== 0 || 1 / n === 1 / l : n !== n && l !== l;
216
+ function is(x, y) {
217
+ if (x === y) {
218
+ return x !== 0 || 1 / x === 1 / y;
219
+ } else {
220
+ return x !== x && y !== y;
221
+ }
980
222
  }
981
- function N(n, l) {
982
- this.message = n, this.data = l && typeof l == "object" ? l : {}, this.stack = "";
223
+ function PropTypeError(message, data) {
224
+ this.message = message;
225
+ this.data = data && typeof data === "object" ? data : {};
226
+ this.stack = "";
983
227
  }
984
- N.prototype = Error.prototype;
985
- function B(n) {
986
- if (process.env.NODE_ENV !== "production")
987
- var l = {}, x = 0;
988
- function j(A, R, _, O, I, C, H) {
989
- if (O = O || k, C = C || _, H !== b) {
990
- if (d) {
991
- var s = new Error(
228
+ PropTypeError.prototype = Error.prototype;
229
+ function createChainableTypeChecker(validate) {
230
+ if (process.env.NODE_ENV !== "production") {
231
+ var manualPropTypeCallCache = {};
232
+ var manualPropTypeWarningCount = 0;
233
+ }
234
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
235
+ componentName = componentName || ANONYMOUS;
236
+ propFullName = propFullName || propName;
237
+ if (secret !== ReactPropTypesSecret) {
238
+ if (throwOnDirectAccess) {
239
+ var err = new Error(
992
240
  "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
993
241
  );
994
- throw s.name = "Invariant Violation", s;
995
- } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
996
- var ee = O + ":" + _;
997
- !l[ee] && // Avoid spamming the console because they are often not actionable except for lib authors
998
- x < 3 && (u(
999
- "You are manually calling a React.PropTypes validation function for the `" + C + "` prop on `" + O + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
1000
- ), l[ee] = !0, x++);
242
+ err.name = "Invariant Violation";
243
+ throw err;
244
+ } else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
245
+ var cacheKey = componentName + ":" + propName;
246
+ if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
247
+ manualPropTypeWarningCount < 3) {
248
+ printWarning(
249
+ "You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
250
+ );
251
+ manualPropTypeCallCache[cacheKey] = true;
252
+ manualPropTypeWarningCount++;
253
+ }
254
+ }
255
+ }
256
+ if (props[propName] == null) {
257
+ if (isRequired) {
258
+ if (props[propName] === null) {
259
+ return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
260
+ }
261
+ return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
1001
262
  }
263
+ return null;
264
+ } else {
265
+ return validate(props, propName, componentName, location, propFullName);
1002
266
  }
1003
- return R[_] == null ? A ? R[_] === null ? new N("The " + I + " `" + C + "` is marked as required " + ("in `" + O + "`, but its value is `null`.")) : new N("The " + I + " `" + C + "` is marked as required in " + ("`" + O + "`, but its value is `undefined`.")) : null : n(R, _, O, I, C);
1004
267
  }
1005
- var T = j.bind(null, !1);
1006
- return T.isRequired = j.bind(null, !0), T;
1007
- }
1008
- function V(n) {
1009
- function l(x, j, T, A, R, _) {
1010
- var O = x[j], I = Q(O);
1011
- if (I !== n) {
1012
- var C = ne(O);
1013
- return new N(
1014
- "Invalid " + A + " `" + R + "` of type " + ("`" + C + "` supplied to `" + T + "`, expected ") + ("`" + n + "`."),
1015
- { expectedType: n }
268
+ var chainedCheckType = checkType.bind(null, false);
269
+ chainedCheckType.isRequired = checkType.bind(null, true);
270
+ return chainedCheckType;
271
+ }
272
+ function createPrimitiveTypeChecker(expectedType) {
273
+ function validate(props, propName, componentName, location, propFullName, secret) {
274
+ var propValue = props[propName];
275
+ var propType = getPropType(propValue);
276
+ if (propType !== expectedType) {
277
+ var preciseType = getPreciseType(propValue);
278
+ return new PropTypeError(
279
+ "Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
280
+ { expectedType }
1016
281
  );
1017
282
  }
1018
283
  return null;
1019
284
  }
1020
- return B(l);
285
+ return createChainableTypeChecker(validate);
1021
286
  }
1022
- function W() {
1023
- return B(y);
287
+ function createAnyTypeChecker() {
288
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1024
289
  }
1025
- function U(n) {
1026
- function l(x, j, T, A, R) {
1027
- if (typeof n != "function")
1028
- return new N("Property `" + R + "` of component `" + T + "` has invalid PropType notation inside arrayOf.");
1029
- var _ = x[j];
1030
- if (!Array.isArray(_)) {
1031
- var O = Q(_);
1032
- return new N("Invalid " + A + " `" + R + "` of type " + ("`" + O + "` supplied to `" + T + "`, expected an array."));
290
+ function createArrayOfTypeChecker(typeChecker) {
291
+ function validate(props, propName, componentName, location, propFullName) {
292
+ if (typeof typeChecker !== "function") {
293
+ return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
1033
294
  }
1034
- for (var I = 0; I < _.length; I++) {
1035
- var C = n(_, I, T, A, R + "[" + I + "]", b);
1036
- if (C instanceof Error)
1037
- return C;
295
+ var propValue = props[propName];
296
+ if (!Array.isArray(propValue)) {
297
+ var propType = getPropType(propValue);
298
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
299
+ }
300
+ for (var i = 0; i < propValue.length; i++) {
301
+ var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
302
+ if (error instanceof Error) {
303
+ return error;
304
+ }
1038
305
  }
1039
306
  return null;
1040
307
  }
1041
- return B(l);
1042
- }
1043
- function L() {
1044
- function n(l, x, j, T, A) {
1045
- var R = l[x];
1046
- if (!i(R)) {
1047
- var _ = Q(R);
1048
- return new N("Invalid " + T + " `" + A + "` of type " + ("`" + _ + "` supplied to `" + j + "`, expected a single ReactElement."));
308
+ return createChainableTypeChecker(validate);
309
+ }
310
+ function createElementTypeChecker() {
311
+ function validate(props, propName, componentName, location, propFullName) {
312
+ var propValue = props[propName];
313
+ if (!isValidElement(propValue)) {
314
+ var propType = getPropType(propValue);
315
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
1049
316
  }
1050
317
  return null;
1051
318
  }
1052
- return B(n);
1053
- }
1054
- function c() {
1055
- function n(l, x, j, T, A) {
1056
- var R = l[x];
1057
- if (!r.isValidElementType(R)) {
1058
- var _ = Q(R);
1059
- return new N("Invalid " + T + " `" + A + "` of type " + ("`" + _ + "` supplied to `" + j + "`, expected a single ReactElement type."));
319
+ return createChainableTypeChecker(validate);
320
+ }
321
+ function createElementTypeTypeChecker() {
322
+ function validate(props, propName, componentName, location, propFullName) {
323
+ var propValue = props[propName];
324
+ if (!ReactIs.isValidElementType(propValue)) {
325
+ var propType = getPropType(propValue);
326
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
1060
327
  }
1061
328
  return null;
1062
329
  }
1063
- return B(n);
1064
- }
1065
- function te(n) {
1066
- function l(x, j, T, A, R) {
1067
- if (!(x[j] instanceof n)) {
1068
- var _ = n.name || k, O = de(x[j]);
1069
- return new N("Invalid " + A + " `" + R + "` of type " + ("`" + O + "` supplied to `" + T + "`, expected ") + ("instance of `" + _ + "`."));
330
+ return createChainableTypeChecker(validate);
331
+ }
332
+ function createInstanceTypeChecker(expectedClass) {
333
+ function validate(props, propName, componentName, location, propFullName) {
334
+ if (!(props[propName] instanceof expectedClass)) {
335
+ var expectedClassName = expectedClass.name || ANONYMOUS;
336
+ var actualClassName = getClassName(props[propName]);
337
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
1070
338
  }
1071
339
  return null;
1072
340
  }
1073
- return B(l);
1074
- }
1075
- function ie(n) {
1076
- if (!Array.isArray(n))
1077
- return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? u(
1078
- "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
1079
- ) : u("Invalid argument supplied to oneOf, expected an array.")), y;
1080
- function l(x, j, T, A, R) {
1081
- for (var _ = x[j], O = 0; O < n.length; O++)
1082
- if (Y(_, n[O]))
341
+ return createChainableTypeChecker(validate);
342
+ }
343
+ function createEnumTypeChecker(expectedValues) {
344
+ if (!Array.isArray(expectedValues)) {
345
+ if (process.env.NODE_ENV !== "production") {
346
+ if (arguments.length > 1) {
347
+ printWarning(
348
+ "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
349
+ );
350
+ } else {
351
+ printWarning("Invalid argument supplied to oneOf, expected an array.");
352
+ }
353
+ }
354
+ return emptyFunctionThatReturnsNull;
355
+ }
356
+ function validate(props, propName, componentName, location, propFullName) {
357
+ var propValue = props[propName];
358
+ for (var i = 0; i < expectedValues.length; i++) {
359
+ if (is(propValue, expectedValues[i])) {
1083
360
  return null;
1084
- var I = JSON.stringify(n, function(H, s) {
1085
- var ee = ne(s);
1086
- return ee === "symbol" ? String(s) : s;
361
+ }
362
+ }
363
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
364
+ var type = getPreciseType(value);
365
+ if (type === "symbol") {
366
+ return String(value);
367
+ }
368
+ return value;
1087
369
  });
1088
- return new N("Invalid " + A + " `" + R + "` of value `" + String(_) + "` " + ("supplied to `" + T + "`, expected one of " + I + "."));
370
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
1089
371
  }
1090
- return B(l);
372
+ return createChainableTypeChecker(validate);
1091
373
  }
1092
- function be(n) {
1093
- function l(x, j, T, A, R) {
1094
- if (typeof n != "function")
1095
- return new N("Property `" + R + "` of component `" + T + "` has invalid PropType notation inside objectOf.");
1096
- var _ = x[j], O = Q(_);
1097
- if (O !== "object")
1098
- return new N("Invalid " + A + " `" + R + "` of type " + ("`" + O + "` supplied to `" + T + "`, expected an object."));
1099
- for (var I in _)
1100
- if (a(_, I)) {
1101
- var C = n(_, I, T, A, R + "." + I, b);
1102
- if (C instanceof Error)
1103
- return C;
374
+ function createObjectOfTypeChecker(typeChecker) {
375
+ function validate(props, propName, componentName, location, propFullName) {
376
+ if (typeof typeChecker !== "function") {
377
+ return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
378
+ }
379
+ var propValue = props[propName];
380
+ var propType = getPropType(propValue);
381
+ if (propType !== "object") {
382
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
383
+ }
384
+ for (var key in propValue) {
385
+ if (has2(propValue, key)) {
386
+ var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
387
+ if (error instanceof Error) {
388
+ return error;
389
+ }
1104
390
  }
391
+ }
1105
392
  return null;
1106
393
  }
1107
- return B(l);
394
+ return createChainableTypeChecker(validate);
1108
395
  }
1109
- function ce(n) {
1110
- if (!Array.isArray(n))
1111
- return process.env.NODE_ENV !== "production" && u("Invalid argument supplied to oneOfType, expected an instance of array."), y;
1112
- for (var l = 0; l < n.length; l++) {
1113
- var x = n[l];
1114
- if (typeof x != "function")
1115
- return u(
1116
- "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + oe(x) + " at index " + l + "."
1117
- ), y;
396
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
397
+ if (!Array.isArray(arrayOfTypeCheckers)) {
398
+ process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
399
+ return emptyFunctionThatReturnsNull;
400
+ }
401
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
402
+ var checker = arrayOfTypeCheckers[i];
403
+ if (typeof checker !== "function") {
404
+ printWarning(
405
+ "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
406
+ );
407
+ return emptyFunctionThatReturnsNull;
408
+ }
1118
409
  }
1119
- function j(T, A, R, _, O) {
1120
- for (var I = [], C = 0; C < n.length; C++) {
1121
- var H = n[C], s = H(T, A, R, _, O, b);
1122
- if (s == null)
410
+ function validate(props, propName, componentName, location, propFullName) {
411
+ var expectedTypes = [];
412
+ for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
413
+ var checker2 = arrayOfTypeCheckers[i2];
414
+ var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
415
+ if (checkerResult == null) {
1123
416
  return null;
1124
- s.data && a(s.data, "expectedType") && I.push(s.data.expectedType);
417
+ }
418
+ if (checkerResult.data && has2(checkerResult.data, "expectedType")) {
419
+ expectedTypes.push(checkerResult.data.expectedType);
420
+ }
1125
421
  }
1126
- var ee = I.length > 0 ? ", expected one of type [" + I.join(", ") + "]" : "";
1127
- return new N("Invalid " + _ + " `" + O + "` supplied to " + ("`" + R + "`" + ee + "."));
422
+ var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
423
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
1128
424
  }
1129
- return B(j);
425
+ return createChainableTypeChecker(validate);
1130
426
  }
1131
- function he() {
1132
- function n(l, x, j, T, A) {
1133
- return X(l[x]) ? null : new N("Invalid " + T + " `" + A + "` supplied to " + ("`" + j + "`, expected a ReactNode."));
427
+ function createNodeChecker() {
428
+ function validate(props, propName, componentName, location, propFullName) {
429
+ if (!isNode(props[propName])) {
430
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
431
+ }
432
+ return null;
1134
433
  }
1135
- return B(n);
434
+ return createChainableTypeChecker(validate);
1136
435
  }
1137
- function fe(n, l, x, j, T) {
1138
- return new N(
1139
- (n || "React class") + ": " + l + " type `" + x + "." + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + T + "`."
436
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
437
+ return new PropTypeError(
438
+ (componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
1140
439
  );
1141
440
  }
1142
- function le(n) {
1143
- function l(x, j, T, A, R) {
1144
- var _ = x[j], O = Q(_);
1145
- if (O !== "object")
1146
- return new N("Invalid " + A + " `" + R + "` of type `" + O + "` " + ("supplied to `" + T + "`, expected `object`."));
1147
- for (var I in n) {
1148
- var C = n[I];
1149
- if (typeof C != "function")
1150
- return fe(T, A, R, I, ne(C));
1151
- var H = C(_, I, T, A, R + "." + I, b);
1152
- if (H)
1153
- return H;
441
+ function createShapeTypeChecker(shapeTypes) {
442
+ function validate(props, propName, componentName, location, propFullName) {
443
+ var propValue = props[propName];
444
+ var propType = getPropType(propValue);
445
+ if (propType !== "object") {
446
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
447
+ }
448
+ for (var key in shapeTypes) {
449
+ var checker = shapeTypes[key];
450
+ if (typeof checker !== "function") {
451
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
452
+ }
453
+ var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
454
+ if (error) {
455
+ return error;
456
+ }
1154
457
  }
1155
458
  return null;
1156
459
  }
1157
- return B(l);
1158
- }
1159
- function G(n) {
1160
- function l(x, j, T, A, R) {
1161
- var _ = x[j], O = Q(_);
1162
- if (O !== "object")
1163
- return new N("Invalid " + A + " `" + R + "` of type `" + O + "` " + ("supplied to `" + T + "`, expected `object`."));
1164
- var I = h({}, x[j], n);
1165
- for (var C in I) {
1166
- var H = n[C];
1167
- if (a(n, C) && typeof H != "function")
1168
- return fe(T, A, R, C, ne(H));
1169
- if (!H)
1170
- return new N(
1171
- "Invalid " + A + " `" + R + "` key `" + C + "` supplied to `" + T + "`.\nBad object: " + JSON.stringify(x[j], null, " ") + `
1172
- Valid keys: ` + JSON.stringify(Object.keys(n), null, " ")
460
+ return createChainableTypeChecker(validate);
461
+ }
462
+ function createStrictShapeTypeChecker(shapeTypes) {
463
+ function validate(props, propName, componentName, location, propFullName) {
464
+ var propValue = props[propName];
465
+ var propType = getPropType(propValue);
466
+ if (propType !== "object") {
467
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
468
+ }
469
+ var allKeys = assign({}, props[propName], shapeTypes);
470
+ for (var key in allKeys) {
471
+ var checker = shapeTypes[key];
472
+ if (has2(shapeTypes, key) && typeof checker !== "function") {
473
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
474
+ }
475
+ if (!checker) {
476
+ return new PropTypeError(
477
+ "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
1173
478
  );
1174
- var s = H(_, C, T, A, R + "." + C, b);
1175
- if (s)
1176
- return s;
479
+ }
480
+ var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
481
+ if (error) {
482
+ return error;
483
+ }
1177
484
  }
1178
485
  return null;
1179
486
  }
1180
- return B(l);
487
+ return createChainableTypeChecker(validate);
1181
488
  }
1182
- function X(n) {
1183
- switch (typeof n) {
489
+ function isNode(propValue) {
490
+ switch (typeof propValue) {
1184
491
  case "number":
1185
492
  case "string":
1186
493
  case "undefined":
1187
- return !0;
494
+ return true;
1188
495
  case "boolean":
1189
- return !n;
496
+ return !propValue;
1190
497
  case "object":
1191
- if (Array.isArray(n))
1192
- return n.every(X);
1193
- if (n === null || i(n))
1194
- return !0;
1195
- var l = g(n);
1196
- if (l) {
1197
- var x = l.call(n), j;
1198
- if (l !== n.entries) {
1199
- for (; !(j = x.next()).done; )
1200
- if (!X(j.value))
1201
- return !1;
1202
- } else
1203
- for (; !(j = x.next()).done; ) {
1204
- var T = j.value;
1205
- if (T && !X(T[1]))
1206
- return !1;
498
+ if (Array.isArray(propValue)) {
499
+ return propValue.every(isNode);
500
+ }
501
+ if (propValue === null || isValidElement(propValue)) {
502
+ return true;
503
+ }
504
+ var iteratorFn = getIteratorFn(propValue);
505
+ if (iteratorFn) {
506
+ var iterator = iteratorFn.call(propValue);
507
+ var step;
508
+ if (iteratorFn !== propValue.entries) {
509
+ while (!(step = iterator.next()).done) {
510
+ if (!isNode(step.value)) {
511
+ return false;
512
+ }
513
+ }
514
+ } else {
515
+ while (!(step = iterator.next()).done) {
516
+ var entry = step.value;
517
+ if (entry) {
518
+ if (!isNode(entry[1])) {
519
+ return false;
520
+ }
521
+ }
1207
522
  }
1208
- } else
1209
- return !1;
1210
- return !0;
523
+ }
524
+ } else {
525
+ return false;
526
+ }
527
+ return true;
1211
528
  default:
1212
- return !1;
529
+ return false;
1213
530
  }
1214
531
  }
1215
- function ae(n, l) {
1216
- return n === "symbol" ? !0 : l ? l["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && l instanceof Symbol : !1;
532
+ function isSymbol(propType, propValue) {
533
+ if (propType === "symbol") {
534
+ return true;
535
+ }
536
+ if (!propValue) {
537
+ return false;
538
+ }
539
+ if (propValue["@@toStringTag"] === "Symbol") {
540
+ return true;
541
+ }
542
+ if (typeof Symbol === "function" && propValue instanceof Symbol) {
543
+ return true;
544
+ }
545
+ return false;
1217
546
  }
1218
- function Q(n) {
1219
- var l = typeof n;
1220
- return Array.isArray(n) ? "array" : n instanceof RegExp ? "object" : ae(l, n) ? "symbol" : l;
547
+ function getPropType(propValue) {
548
+ var propType = typeof propValue;
549
+ if (Array.isArray(propValue)) {
550
+ return "array";
551
+ }
552
+ if (propValue instanceof RegExp) {
553
+ return "object";
554
+ }
555
+ if (isSymbol(propType, propValue)) {
556
+ return "symbol";
557
+ }
558
+ return propType;
1221
559
  }
1222
- function ne(n) {
1223
- if (typeof n > "u" || n === null)
1224
- return "" + n;
1225
- var l = Q(n);
1226
- if (l === "object") {
1227
- if (n instanceof Date)
560
+ function getPreciseType(propValue) {
561
+ if (typeof propValue === "undefined" || propValue === null) {
562
+ return "" + propValue;
563
+ }
564
+ var propType = getPropType(propValue);
565
+ if (propType === "object") {
566
+ if (propValue instanceof Date) {
1228
567
  return "date";
1229
- if (n instanceof RegExp)
568
+ } else if (propValue instanceof RegExp) {
1230
569
  return "regexp";
570
+ }
1231
571
  }
1232
- return l;
572
+ return propType;
1233
573
  }
1234
- function oe(n) {
1235
- var l = ne(n);
1236
- switch (l) {
574
+ function getPostfixForTypeWarning(value) {
575
+ var type = getPreciseType(value);
576
+ switch (type) {
1237
577
  case "array":
1238
578
  case "object":
1239
- return "an " + l;
579
+ return "an " + type;
1240
580
  case "boolean":
1241
581
  case "date":
1242
582
  case "regexp":
1243
- return "a " + l;
583
+ return "a " + type;
1244
584
  default:
1245
- return l;
585
+ return type;
1246
586
  }
1247
587
  }
1248
- function de(n) {
1249
- return !n.constructor || !n.constructor.name ? k : n.constructor.name;
588
+ function getClassName(propValue) {
589
+ if (!propValue.constructor || !propValue.constructor.name) {
590
+ return ANONYMOUS;
591
+ }
592
+ return propValue.constructor.name;
1250
593
  }
1251
- return P.checkPropTypes = p, P.resetWarningCache = p.resetWarningCache, P.PropTypes = P, P;
1252
- }, Fe;
594
+ ReactPropTypes.checkPropTypes = checkPropTypes;
595
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
596
+ ReactPropTypes.PropTypes = ReactPropTypes;
597
+ return ReactPropTypes;
598
+ };
599
+ return factoryWithTypeCheckers;
1253
600
  }
1254
- var Me, dr;
1255
- function Gr() {
1256
- if (dr)
1257
- return Me;
1258
- dr = 1;
1259
- var r = Le();
1260
- function h() {
601
+ var factoryWithThrowingShims;
602
+ var hasRequiredFactoryWithThrowingShims;
603
+ function requireFactoryWithThrowingShims() {
604
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
605
+ hasRequiredFactoryWithThrowingShims = 1;
606
+ var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
607
+ function emptyFunction() {
1261
608
  }
1262
- function b() {
609
+ function emptyFunctionWithReset() {
1263
610
  }
1264
- return b.resetWarningCache = h, Me = function() {
1265
- function a(y, i, d, f, v, g) {
1266
- if (g !== r) {
1267
- var k = new Error(
1268
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
1269
- );
1270
- throw k.name = "Invariant Violation", k;
611
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
612
+ factoryWithThrowingShims = function() {
613
+ function shim(props, propName, componentName, location, propFullName, secret) {
614
+ if (secret === ReactPropTypesSecret) {
615
+ return;
1271
616
  }
1272
- }
1273
- a.isRequired = a;
1274
- function p() {
1275
- return a;
1276
- }
1277
- var u = {
1278
- array: a,
1279
- bigint: a,
1280
- bool: a,
1281
- func: a,
1282
- number: a,
1283
- object: a,
1284
- string: a,
1285
- symbol: a,
1286
- any: a,
1287
- arrayOf: p,
1288
- element: a,
1289
- elementType: a,
1290
- instanceOf: p,
1291
- node: a,
1292
- objectOf: p,
1293
- oneOf: p,
1294
- oneOfType: p,
1295
- shape: p,
1296
- exact: p,
1297
- checkPropTypes: b,
1298
- resetWarningCache: h
617
+ var err = new Error(
618
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
619
+ );
620
+ err.name = "Invariant Violation";
621
+ throw err;
622
+ }
623
+ shim.isRequired = shim;
624
+ function getShim() {
625
+ return shim;
626
+ }
627
+ var ReactPropTypes = {
628
+ array: shim,
629
+ bigint: shim,
630
+ bool: shim,
631
+ func: shim,
632
+ number: shim,
633
+ object: shim,
634
+ string: shim,
635
+ symbol: shim,
636
+ any: shim,
637
+ arrayOf: getShim,
638
+ element: shim,
639
+ elementType: shim,
640
+ instanceOf: getShim,
641
+ node: shim,
642
+ objectOf: getShim,
643
+ oneOf: getShim,
644
+ oneOfType: getShim,
645
+ shape: getShim,
646
+ exact: getShim,
647
+ checkPropTypes: emptyFunctionWithReset,
648
+ resetWarningCache: emptyFunction
1299
649
  };
1300
- return u.PropTypes = u, u;
1301
- }, Me;
650
+ ReactPropTypes.PropTypes = ReactPropTypes;
651
+ return ReactPropTypes;
652
+ };
653
+ return factoryWithThrowingShims;
1302
654
  }
1303
- if (process.env.NODE_ENV !== "production") {
1304
- var Xr = pr(), Zr = !0;
1305
- Ne.exports = Kr()(Xr.isElement, Zr);
1306
- } else
1307
- Ne.exports = Gr()();
1308
- var Qr = Ne.exports;
1309
- const E = /* @__PURE__ */ Lr(Qr);
1310
- const br = ({ column: r, filterValue: h, setFilter: b, onClose: a }) => {
1311
- const [p, u] = Re(h || "");
1312
- return vr(() => {
1313
- const y = setTimeout(() => {
1314
- b(r.key, p);
655
+ var hasRequiredPropTypes;
656
+ function requirePropTypes() {
657
+ if (hasRequiredPropTypes) return propTypes.exports;
658
+ hasRequiredPropTypes = 1;
659
+ if (process.env.NODE_ENV !== "production") {
660
+ var ReactIs = require$$0;
661
+ var throwOnDirectAccess = true;
662
+ propTypes.exports = /* @__PURE__ */ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
663
+ } else {
664
+ propTypes.exports = /* @__PURE__ */ requireFactoryWithThrowingShims()();
665
+ }
666
+ return propTypes.exports;
667
+ }
668
+ var propTypesExports = /* @__PURE__ */ requirePropTypes();
669
+ const PropTypes = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
670
+ const ColumnFilter = ({ column, filterValue, setFilter, onClose }) => {
671
+ const [value, setValue] = useState(filterValue || "");
672
+ useEffect(() => {
673
+ const handler = setTimeout(() => {
674
+ setFilter(column.key, value);
1315
675
  }, 300);
1316
676
  return () => {
1317
- clearTimeout(y);
677
+ clearTimeout(handler);
1318
678
  };
1319
- }, [p, r.key, b]), r.searchable ? /* @__PURE__ */ S.jsxs("div", { className: "jc-datatable-filter", children: [
1320
- /* @__PURE__ */ S.jsx(
679
+ }, [value, column.key, setFilter]);
680
+ if (!column.searchable) return null;
681
+ return /* @__PURE__ */ jsxs("div", { className: "jc-datatable-filter", children: [
682
+ /* @__PURE__ */ jsx(
1321
683
  "input",
1322
684
  {
1323
- autoFocus: !0,
685
+ autoFocus: true,
1324
686
  type: "text",
1325
- placeholder: `Search ${r.header}...`,
1326
- value: p,
1327
- onChange: (y) => u(y.target.value),
687
+ placeholder: `Search ${column.header}...`,
688
+ value,
689
+ onChange: (e) => setValue(e.target.value),
1328
690
  className: "jc-datatable-filter-input",
1329
- "aria-label": `Filter by ${r.header}`
691
+ "aria-label": `Filter by ${column.header}`
1330
692
  }
1331
693
  ),
1332
- /* @__PURE__ */ S.jsx("button", { className: "jc-datatable-filter-close", onClick: a, "aria-label": "Close filter", children: "×" })
1333
- ] }) : null;
694
+ /* @__PURE__ */ jsx("button", { className: "jc-datatable-filter-close", onClick: onClose, "aria-label": "Close filter", children: "×" })
695
+ ] });
1334
696
  };
1335
- br.propTypes = {
1336
- column: E.object.isRequired,
1337
- filterValue: E.any,
1338
- setFilter: E.func.isRequired,
1339
- onClose: E.func.isRequired
697
+ ColumnFilter.propTypes = {
698
+ column: PropTypes.object.isRequired,
699
+ filterValue: PropTypes.any,
700
+ setFilter: PropTypes.func.isRequired,
701
+ onClose: PropTypes.func.isRequired
1340
702
  };
1341
- const hr = ({ columns: r, sortConfig: h, requestSort: b, filters: a, setFilter: p }) => {
1342
- const [u, y] = Ye.useState(null), i = (f, v) => {
1343
- f.stopPropagation(), y(u === v ? null : v);
1344
- }, d = (f) => !h || h.key !== f.key ? /* @__PURE__ */ S.jsx("span", { className: "jc-datatable-sort-icon", children: "↕" }) : h.direction === "asc" ? /* @__PURE__ */ S.jsx("span", { className: "jc-datatable-sort-icon active", children: "↑" }) : /* @__PURE__ */ S.jsx("span", { className: "jc-datatable-sort-icon active", children: "↓" });
1345
- return /* @__PURE__ */ S.jsx("thead", { className: "jc-datatable-thead", children: /* @__PURE__ */ S.jsx("tr", { children: r.map((f, v) => {
1346
- const g = v === r.length - 1, k = v === 0;
1347
- let P = "jc-datatable-filter-popover";
1348
- return g && (P += " right-aligned"), k && (P += " left-aligned"), /* @__PURE__ */ S.jsxs(
703
+ const TableHeader = ({ columns, sortConfig, requestSort, filters, setFilter }) => {
704
+ const [activeFilter, setActiveFilter] = React.useState(null);
705
+ const toggleFilter = (e, key) => {
706
+ e.stopPropagation();
707
+ setActiveFilter(activeFilter === key ? null : key);
708
+ };
709
+ const getSortIndicator = (column) => {
710
+ if (!sortConfig || sortConfig.key !== column.key) {
711
+ return /* @__PURE__ */ jsx("span", { className: "jc-datatable-sort-icon", children: "↕" });
712
+ }
713
+ return sortConfig.direction === "asc" ? /* @__PURE__ */ jsx("span", { className: "jc-datatable-sort-icon active", children: "↑" }) : /* @__PURE__ */ jsx("span", { className: "jc-datatable-sort-icon active", children: "↓" });
714
+ };
715
+ return /* @__PURE__ */ jsx("thead", { className: "jc-datatable-thead", children: /* @__PURE__ */ jsx("tr", { children: columns.map((column, index) => {
716
+ const isLastColumn = index === columns.length - 1;
717
+ const isFirstColumn = index === 0;
718
+ let popoverClass = "jc-datatable-filter-popover";
719
+ if (isLastColumn) popoverClass += " right-aligned";
720
+ if (isFirstColumn) popoverClass += " left-aligned";
721
+ return /* @__PURE__ */ jsxs(
1349
722
  "th",
1350
723
  {
1351
- className: `jc-datatable-th ${f.sortable ? "sortable" : ""}`,
1352
- style: { width: f.width },
1353
- onClick: () => f.sortable && b(f.key),
724
+ className: `jc-datatable-th ${column.sortable ? "sortable" : ""}`,
725
+ style: {
726
+ width: column.width,
727
+ minWidth: column.minWidth || column.width,
728
+ maxWidth: column.maxWidth
729
+ },
730
+ onClick: () => column.sortable && requestSort(column.key),
1354
731
  children: [
1355
- /* @__PURE__ */ S.jsxs("div", { className: "jc-datatable-th-content", children: [
1356
- /* @__PURE__ */ S.jsx("span", { children: f.header }),
1357
- f.sortable && d(f),
1358
- f.searchable && /* @__PURE__ */ S.jsx(
732
+ /* @__PURE__ */ jsxs("div", { className: "jc-datatable-th-content", children: [
733
+ /* @__PURE__ */ jsx("span", { children: column.header }),
734
+ column.sortable && getSortIndicator(column),
735
+ column.searchable && /* @__PURE__ */ jsx(
1359
736
  "button",
1360
737
  {
1361
- className: `jc-datatable-filter-trigger ${a[f.key] ? "active" : ""}`,
1362
- onClick: (Y) => i(Y, f.key),
1363
- "aria-label": `Filter ${f.header}`,
1364
- children: /* @__PURE__ */ S.jsx("svg", { viewBox: "0 0 24 24", width: "14", height: "14", fill: "currentColor", children: /* @__PURE__ */ S.jsx("path", { d: "M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z" }) })
738
+ className: `jc-datatable-filter-trigger ${filters[column.key] ? "active" : ""}`,
739
+ onClick: (e) => toggleFilter(e, column.key),
740
+ "aria-label": `Filter ${column.header}`,
741
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "14", height: "14", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z" }) })
1365
742
  }
1366
743
  )
1367
744
  ] }),
1368
- u === f.key && /* @__PURE__ */ S.jsx("div", { className: P, onClick: (Y) => Y.stopPropagation(), children: /* @__PURE__ */ S.jsx(
1369
- br,
745
+ activeFilter === column.key && /* @__PURE__ */ jsx("div", { className: popoverClass, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
746
+ ColumnFilter,
1370
747
  {
1371
- column: f,
1372
- filterValue: a[f.key],
1373
- setFilter: p,
1374
- onClose: () => y(null)
748
+ column,
749
+ filterValue: filters[column.key],
750
+ setFilter,
751
+ onClose: () => setActiveFilter(null)
1375
752
  }
1376
753
  ) })
1377
754
  ]
1378
755
  },
1379
- f.key
756
+ column.key
1380
757
  );
1381
758
  }) }) });
1382
759
  };
1383
- hr.propTypes = {
1384
- columns: E.array.isRequired,
1385
- sortConfig: E.shape({
1386
- key: E.string,
1387
- direction: E.oneOf(["asc", "desc"])
760
+ TableHeader.propTypes = {
761
+ columns: PropTypes.array.isRequired,
762
+ sortConfig: PropTypes.shape({
763
+ key: PropTypes.string,
764
+ direction: PropTypes.oneOf(["asc", "desc"])
1388
765
  }),
1389
- requestSort: E.func.isRequired,
1390
- filters: E.object.isRequired,
1391
- setFilter: E.func.isRequired
766
+ requestSort: PropTypes.func.isRequired,
767
+ filters: PropTypes.object.isRequired,
768
+ setFilter: PropTypes.func.isRequired
1392
769
  };
1393
- function Pe(r, h, b = void 0) {
1394
- if (!h || !r)
1395
- return b;
1396
- const a = h.split(".").reduce((p, u) => p && p[u] !== void 0 ? p[u] : void 0, r);
1397
- return a !== void 0 ? a : b;
770
+ function get(obj, path, defaultValue = void 0) {
771
+ if (!path || !obj) return defaultValue;
772
+ const value = path.split(".").reduce((acc, part) => {
773
+ return acc && acc[part] !== void 0 ? acc[part] : void 0;
774
+ }, obj);
775
+ return value !== void 0 ? value : defaultValue;
1398
776
  }
1399
- const gr = ({ data: r, columns: h, loading: b, onRowClick: a, noDataText: p }) => b ? /* @__PURE__ */ S.jsx("tbody", { className: "jc-datatable-tbody", children: /* @__PURE__ */ S.jsx("tr", { children: /* @__PURE__ */ S.jsxs("td", { colSpan: h.length, className: "jc-datatable-loading-cell", children: [
1400
- /* @__PURE__ */ S.jsx("div", { className: "jc-datatable-spinner" }),
1401
- "Loading..."
1402
- ] }) }) }) : !r || r.length === 0 ? /* @__PURE__ */ S.jsx("tbody", { className: "jc-datatable-tbody", children: /* @__PURE__ */ S.jsx("tr", { children: /* @__PURE__ */ S.jsx("td", { colSpan: h.length, className: "jc-datatable-empty-cell", children: p || "No records found" }) }) }) : /* @__PURE__ */ S.jsx("tbody", { className: "jc-datatable-tbody", children: r.map((u, y) => /* @__PURE__ */ S.jsx(
1403
- "tr",
1404
- {
1405
- className: `jc-datatable-tr ${a ? "clickable" : ""}`,
1406
- onClick: () => a && a(u),
1407
- children: h.map((i) => /* @__PURE__ */ S.jsx(
1408
- "td",
1409
- {
1410
- className: "jc-datatable-td",
1411
- "data-label": i.header,
1412
- children: i.render ? i.render(u, y) : Pe(u, i.key)
1413
- },
1414
- `${u.id || y}-${i.key}`
1415
- ))
1416
- },
1417
- u.id || y
1418
- )) });
1419
- gr.propTypes = {
1420
- data: E.array.isRequired,
1421
- columns: E.array.isRequired,
1422
- loading: E.bool,
1423
- onRowClick: E.func,
1424
- noDataText: E.string
777
+ const TableBody = ({ data, columns, loading, onRowClick, noDataText }) => {
778
+ if (loading) {
779
+ return /* @__PURE__ */ jsx("tbody", { className: "jc-datatable-tbody", children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { colSpan: columns.length, className: "jc-datatable-loading-cell", children: [
780
+ /* @__PURE__ */ jsx("div", { className: "jc-datatable-spinner" }),
781
+ "Loading..."
782
+ ] }) }) });
783
+ }
784
+ if (!data || data.length === 0) {
785
+ return /* @__PURE__ */ jsx("tbody", { className: "jc-datatable-tbody", children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columns.length, className: "jc-datatable-empty-cell", children: noDataText || "No records found" }) }) });
786
+ }
787
+ return /* @__PURE__ */ jsx("tbody", { className: "jc-datatable-tbody", children: data.map((row, rowIndex) => /* @__PURE__ */ jsx(
788
+ "tr",
789
+ {
790
+ className: `jc-datatable-tr ${onRowClick ? "clickable" : ""}`,
791
+ onClick: () => onRowClick && onRowClick(row),
792
+ children: columns.map((column) => /* @__PURE__ */ jsx(
793
+ "td",
794
+ {
795
+ className: "jc-datatable-td",
796
+ "data-label": column.header,
797
+ children: column.render ? column.render(row, rowIndex) : get(row, column.key)
798
+ },
799
+ `${row.id || rowIndex}-${column.key}`
800
+ ))
801
+ },
802
+ row.id || rowIndex
803
+ )) });
1425
804
  };
1426
- const mr = ({
1427
- currentPage: r,
1428
- totalPages: h,
1429
- pageSize: b,
1430
- setPageSize: a,
1431
- nextPage: p,
1432
- prevPage: u,
1433
- totalItems: y,
1434
- pageSizeOptions: i = [5, 10, 20, 50]
1435
- }) => /* @__PURE__ */ S.jsxs("div", { className: "jc-datatable-pagination", children: [
1436
- /* @__PURE__ */ S.jsxs("div", { className: "jc-datatable-pagination-info", children: [
1437
- "Showing ",
1438
- (r - 1) * b + 1,
1439
- " to ",
1440
- Math.min(r * b, y),
1441
- " of ",
1442
- y,
1443
- " entries"
1444
- ] }),
1445
- /* @__PURE__ */ S.jsxs("div", { className: "jc-datatable-pagination-controls", children: [
1446
- /* @__PURE__ */ S.jsx(
1447
- "select",
1448
- {
1449
- value: b,
1450
- onChange: (d) => a(Number(d.target.value)),
1451
- className: "jc-datatable-page-size-select",
1452
- "aria-label": "Select page size",
1453
- children: i.map((d) => /* @__PURE__ */ S.jsxs("option", { value: d, children: [
1454
- d,
1455
- " / page"
1456
- ] }, d))
1457
- }
1458
- ),
1459
- /* @__PURE__ */ S.jsx(
1460
- "button",
1461
- {
1462
- onClick: u,
1463
- disabled: r === 1,
1464
- className: "jc-datatable-pagination-btn",
1465
- "aria-label": "Previous page",
1466
- children: "Previous"
1467
- }
1468
- ),
1469
- /* @__PURE__ */ S.jsxs("span", { className: "jc-datatable-pagination-pages", children: [
1470
- "Page ",
1471
- r,
805
+ TableBody.propTypes = {
806
+ data: PropTypes.array.isRequired,
807
+ columns: PropTypes.array.isRequired,
808
+ loading: PropTypes.bool,
809
+ onRowClick: PropTypes.func,
810
+ noDataText: PropTypes.string
811
+ };
812
+ const Pagination = ({
813
+ currentPage,
814
+ totalPages,
815
+ pageSize,
816
+ setPageSize,
817
+ nextPage,
818
+ prevPage,
819
+ totalItems,
820
+ pageSizeOptions = [5, 10, 20, 50]
821
+ }) => {
822
+ return /* @__PURE__ */ jsxs("div", { className: "jc-datatable-pagination", children: [
823
+ /* @__PURE__ */ jsxs("div", { className: "jc-datatable-pagination-info", children: [
824
+ "Showing ",
825
+ (currentPage - 1) * pageSize + 1,
826
+ " to ",
827
+ Math.min(currentPage * pageSize, totalItems),
1472
828
  " of ",
1473
- h
829
+ totalItems,
830
+ " entries"
1474
831
  ] }),
1475
- /* @__PURE__ */ S.jsx(
1476
- "button",
1477
- {
1478
- onClick: p,
1479
- disabled: r === h,
1480
- className: "jc-datatable-pagination-btn",
1481
- "aria-label": "Next page",
1482
- children: "Next"
1483
- }
1484
- )
1485
- ] })
1486
- ] });
1487
- mr.propTypes = {
1488
- currentPage: E.number.isRequired,
1489
- totalPages: E.number.isRequired,
1490
- pageSize: E.number.isRequired,
1491
- setPageSize: E.func.isRequired,
1492
- nextPage: E.func.isRequired,
1493
- prevPage: E.func.isRequired,
1494
- totalItems: E.number.isRequired,
1495
- pageSizeOptions: E.arrayOf(E.number)
832
+ /* @__PURE__ */ jsxs("div", { className: "jc-datatable-pagination-controls", children: [
833
+ /* @__PURE__ */ jsx(
834
+ "select",
835
+ {
836
+ value: pageSize,
837
+ onChange: (e) => setPageSize(Number(e.target.value)),
838
+ className: "jc-datatable-page-size-select",
839
+ "aria-label": "Select page size",
840
+ children: pageSizeOptions.map((size) => /* @__PURE__ */ jsxs("option", { value: size, children: [
841
+ size,
842
+ " / page"
843
+ ] }, size))
844
+ }
845
+ ),
846
+ /* @__PURE__ */ jsx(
847
+ "button",
848
+ {
849
+ onClick: prevPage,
850
+ disabled: currentPage === 1,
851
+ className: "jc-datatable-pagination-btn",
852
+ "aria-label": "Previous page",
853
+ children: "Previous"
854
+ }
855
+ ),
856
+ /* @__PURE__ */ jsxs("span", { className: "jc-datatable-pagination-pages", children: [
857
+ "Page ",
858
+ currentPage,
859
+ " of ",
860
+ totalPages
861
+ ] }),
862
+ /* @__PURE__ */ jsx(
863
+ "button",
864
+ {
865
+ onClick: nextPage,
866
+ disabled: currentPage === totalPages,
867
+ className: "jc-datatable-pagination-btn",
868
+ "aria-label": "Next page",
869
+ children: "Next"
870
+ }
871
+ )
872
+ ] })
873
+ ] });
874
+ };
875
+ Pagination.propTypes = {
876
+ currentPage: PropTypes.number.isRequired,
877
+ totalPages: PropTypes.number.isRequired,
878
+ pageSize: PropTypes.number.isRequired,
879
+ setPageSize: PropTypes.func.isRequired,
880
+ nextPage: PropTypes.func.isRequired,
881
+ prevPage: PropTypes.func.isRequired,
882
+ totalItems: PropTypes.number.isRequired,
883
+ pageSizeOptions: PropTypes.arrayOf(PropTypes.number)
1496
884
  };
1497
- const et = (r, h, b = null) => {
1498
- const [a, p] = Re(b), u = (i) => {
1499
- let d = "asc";
1500
- a && a.key === i && a.direction === "asc" && (d = "desc"), p({ key: i, direction: d });
885
+ const useSort = (data, columns, initialSort = null) => {
886
+ const [sortConfig, setSortConfig] = useState(initialSort);
887
+ const requestSort = (key) => {
888
+ let direction = "asc";
889
+ if (sortConfig && sortConfig.key === key && sortConfig.direction === "asc") {
890
+ direction = "desc";
891
+ }
892
+ setSortConfig({ key, direction });
1501
893
  };
1502
- return { sortedData: We(() => {
1503
- if (!a)
1504
- return r;
1505
- const i = h.find((f) => f.key === a.key);
1506
- return i ? [...r].sort((f, v) => {
1507
- if (i.sortFn)
1508
- return a.direction === "asc" ? i.sortFn(f, v) : i.sortFn(v, f);
1509
- const g = Pe(f, i.key), k = Pe(v, i.key);
1510
- return g < k ? a.direction === "asc" ? -1 : 1 : g > k ? a.direction === "asc" ? 1 : -1 : 0;
1511
- }) : r;
1512
- }, [r, a, h]), sortConfig: a, requestSort: u };
1513
- }, rt = (r, h) => {
1514
- const [b, a] = Re({}), p = (y, i) => {
1515
- a((d) => ({
1516
- ...d,
1517
- [y]: i
894
+ const sortedData = useMemo(() => {
895
+ if (!sortConfig) return data;
896
+ const column = columns.find((col) => col.key === sortConfig.key);
897
+ if (!column) return data;
898
+ const sortableItems = [...data];
899
+ return sortableItems.sort((a, b) => {
900
+ if (column.sortFn) {
901
+ return sortConfig.direction === "asc" ? column.sortFn(a, b) : column.sortFn(b, a);
902
+ }
903
+ const aValue = get(a, column.key);
904
+ const bValue = get(b, column.key);
905
+ if (aValue < bValue) {
906
+ return sortConfig.direction === "asc" ? -1 : 1;
907
+ }
908
+ if (aValue > bValue) {
909
+ return sortConfig.direction === "asc" ? 1 : -1;
910
+ }
911
+ return 0;
912
+ });
913
+ }, [data, sortConfig, columns]);
914
+ return { sortedData, sortConfig, requestSort };
915
+ };
916
+ const useFilter = (data, columns) => {
917
+ const [filters, setFilters] = useState({});
918
+ const setFilter = (key, value) => {
919
+ setFilters((prev) => ({
920
+ ...prev,
921
+ [key]: value
1518
922
  }));
1519
923
  };
1520
- return { filteredData: We(() => r.filter((y) => Object.keys(b).every((i) => {
1521
- const d = b[i];
1522
- if (!d)
1523
- return !0;
1524
- const f = h.find((g) => g.key === i);
1525
- if (!f)
1526
- return !0;
1527
- const v = Pe(y, i);
1528
- return f.filterFn ? f.filterFn(v, d, y) : String(v || "").toLowerCase().includes(String(d).toLowerCase());
1529
- })), [r, b, h]), filters: b, setFilter: p };
1530
- }, tt = (r, h = !0, b = 10) => {
1531
- const [a, p] = Re(1), [u, y] = Re(b);
1532
- vr(() => {
1533
- p(1);
1534
- }, [r.length, u]);
1535
- const i = r.length, d = h ? Math.ceil(i / u) : 1;
1536
- return {
1537
- paginatedData: We(() => {
1538
- if (!h)
1539
- return r;
1540
- const P = (a - 1) * u;
1541
- return r.slice(P, P + u);
1542
- }, [r, a, u, h]),
1543
- currentPage: a,
1544
- totalPages: d,
1545
- pageSize: u,
1546
- totalItems: i,
1547
- setPage: (P) => {
1548
- const Y = Math.max(1, Math.min(P, d));
1549
- p(Y);
1550
- },
1551
- setPageSize: y,
1552
- nextPage: () => {
1553
- a < d && p((P) => P + 1);
1554
- },
1555
- prevPage: () => {
1556
- a > 1 && p((P) => P - 1);
924
+ const filteredData = useMemo(() => {
925
+ return data.filter((row) => {
926
+ return Object.keys(filters).every((key) => {
927
+ const filterValue = filters[key];
928
+ if (!filterValue) return true;
929
+ const column = columns.find((col) => col.key === key);
930
+ if (!column) return true;
931
+ const rowValue = get(row, key);
932
+ if (column.filterFn) {
933
+ return column.filterFn(rowValue, filterValue, row);
934
+ }
935
+ return String(rowValue || "").toLowerCase().includes(String(filterValue).toLowerCase());
936
+ });
937
+ });
938
+ }, [data, filters, columns]);
939
+ return { filteredData, filters, setFilter };
940
+ };
941
+ const usePagination = (data, enabled = true, initialPageSize = 10) => {
942
+ const [currentPage, setCurrentPage] = useState(1);
943
+ const [pageSize, setPageSize] = useState(initialPageSize);
944
+ useEffect(() => {
945
+ setCurrentPage(1);
946
+ }, [data.length, pageSize]);
947
+ const totalItems = data.length;
948
+ const totalPages = enabled ? Math.ceil(totalItems / pageSize) : 1;
949
+ const paginatedData = useMemo(() => {
950
+ if (!enabled) return data;
951
+ const start = (currentPage - 1) * pageSize;
952
+ return data.slice(start, start + pageSize);
953
+ }, [data, currentPage, pageSize, enabled]);
954
+ const nextPage = () => {
955
+ if (currentPage < totalPages) {
956
+ setCurrentPage((prev) => prev + 1);
957
+ }
958
+ };
959
+ const prevPage = () => {
960
+ if (currentPage > 1) {
961
+ setCurrentPage((prev) => prev - 1);
1557
962
  }
1558
963
  };
1559
- }, nt = ({
1560
- columns: r,
1561
- data: h,
1562
- loading: b = !1,
1563
- pagination: a = !0,
1564
- pageSizeOptions: p = [5, 10, 20, 50],
1565
- defaultPageSize: u = 10,
1566
- onRowClick: y,
1567
- noDataText: i = "No records found",
1568
- className: d = "",
1569
- maxHeight: f
964
+ const setPage = (page) => {
965
+ const p = Math.max(1, Math.min(page, totalPages));
966
+ setCurrentPage(p);
967
+ };
968
+ return {
969
+ paginatedData,
970
+ currentPage,
971
+ totalPages,
972
+ pageSize,
973
+ totalItems,
974
+ setPage,
975
+ setPageSize,
976
+ nextPage,
977
+ prevPage
978
+ };
979
+ };
980
+ const DataTable = ({
981
+ columns,
982
+ data,
983
+ loading = false,
984
+ pagination = true,
985
+ pageSizeOptions = [5, 10, 20, 50],
986
+ defaultPageSize = 10,
987
+ onRowClick,
988
+ noDataText = "No records found",
989
+ className = "",
990
+ maxHeight
1570
991
  }) => {
1571
- const { filteredData: v, filters: g, setFilter: k } = rt(h, r), { sortedData: P, sortConfig: Y, requestSort: N } = et(v, r), {
1572
- paginatedData: B,
1573
- currentPage: V,
1574
- totalPages: W,
1575
- pageSize: U,
1576
- setPageSize: L,
1577
- nextPage: c,
1578
- prevPage: te,
1579
- totalItems: ie
1580
- } = tt(P, a, u);
1581
- return /* @__PURE__ */ S.jsxs("div", { className: `jc-datatable-wrapper ${d || ""}`, children: [
1582
- /* @__PURE__ */ S.jsx(
992
+ const { filteredData, filters, setFilter } = useFilter(data, columns);
993
+ const { sortedData, sortConfig, requestSort } = useSort(filteredData, columns);
994
+ const {
995
+ paginatedData,
996
+ currentPage,
997
+ totalPages,
998
+ pageSize,
999
+ setPageSize,
1000
+ nextPage,
1001
+ prevPage,
1002
+ totalItems
1003
+ } = usePagination(sortedData, pagination, defaultPageSize);
1004
+ return /* @__PURE__ */ jsxs("div", { className: `jc-datatable-wrapper ${className || ""}`, children: [
1005
+ /* @__PURE__ */ jsx(
1583
1006
  "div",
1584
1007
  {
1585
1008
  className: "jc-datatable-container",
1586
- style: f ? { maxHeight: f, overflowY: "auto" } : {},
1587
- children: /* @__PURE__ */ S.jsxs("table", { className: "jc-datatable-table", children: [
1588
- /* @__PURE__ */ S.jsx(
1589
- hr,
1009
+ style: maxHeight ? { maxHeight, overflowY: "auto" } : {},
1010
+ children: /* @__PURE__ */ jsxs("table", { className: "jc-datatable-table", children: [
1011
+ /* @__PURE__ */ jsx(
1012
+ TableHeader,
1590
1013
  {
1591
- columns: r,
1592
- sortConfig: Y,
1593
- requestSort: N,
1594
- filters: g,
1595
- setFilter: k
1014
+ columns,
1015
+ sortConfig,
1016
+ requestSort,
1017
+ filters,
1018
+ setFilter
1596
1019
  }
1597
1020
  ),
1598
- /* @__PURE__ */ S.jsx(
1599
- gr,
1021
+ /* @__PURE__ */ jsx(
1022
+ TableBody,
1600
1023
  {
1601
- data: a ? B : P,
1602
- columns: r,
1603
- loading: b,
1604
- onRowClick: y,
1605
- noDataText: i
1024
+ data: pagination ? paginatedData : sortedData,
1025
+ columns,
1026
+ loading,
1027
+ onRowClick,
1028
+ noDataText
1606
1029
  }
1607
1030
  )
1608
1031
  ] })
1609
1032
  }
1610
1033
  ),
1611
- a && !b && h.length > 0 && /* @__PURE__ */ S.jsx(
1612
- mr,
1034
+ pagination && !loading && data.length > 0 && /* @__PURE__ */ jsx(
1035
+ Pagination,
1613
1036
  {
1614
- currentPage: V,
1615
- totalPages: W,
1616
- pageSize: U,
1617
- setPageSize: L,
1618
- nextPage: c,
1619
- prevPage: te,
1620
- totalItems: ie,
1621
- pageSizeOptions: p
1037
+ currentPage,
1038
+ totalPages,
1039
+ pageSize,
1040
+ setPageSize,
1041
+ nextPage,
1042
+ prevPage,
1043
+ totalItems,
1044
+ pageSizeOptions
1622
1045
  }
1623
1046
  )
1624
1047
  ] });
1625
1048
  };
1626
- nt.propTypes = {
1627
- columns: E.arrayOf(
1628
- E.shape({
1629
- key: E.string.isRequired,
1630
- header: E.string.isRequired,
1631
- width: E.string,
1632
- sortable: E.bool,
1633
- searchable: E.bool,
1634
- render: E.func,
1635
- sortFn: E.func,
1636
- filterFn: E.func
1049
+ DataTable.propTypes = {
1050
+ columns: PropTypes.arrayOf(
1051
+ PropTypes.shape({
1052
+ key: PropTypes.string.isRequired,
1053
+ header: PropTypes.string.isRequired,
1054
+ width: PropTypes.string,
1055
+ minWidth: PropTypes.string,
1056
+ maxWidth: PropTypes.string,
1057
+ sortable: PropTypes.bool,
1058
+ searchable: PropTypes.bool,
1059
+ render: PropTypes.func,
1060
+ sortFn: PropTypes.func,
1061
+ filterFn: PropTypes.func
1637
1062
  })
1638
1063
  ).isRequired,
1639
- data: E.array.isRequired,
1640
- loading: E.bool,
1641
- pagination: E.bool,
1642
- pageSizeOptions: E.arrayOf(E.number),
1643
- defaultPageSize: E.number,
1644
- onRowClick: E.func,
1645
- noDataText: E.string,
1646
- className: E.string,
1647
- maxHeight: E.string
1064
+ data: PropTypes.array.isRequired,
1065
+ loading: PropTypes.bool,
1066
+ pagination: PropTypes.bool,
1067
+ pageSizeOptions: PropTypes.arrayOf(PropTypes.number),
1068
+ defaultPageSize: PropTypes.number,
1069
+ onRowClick: PropTypes.func,
1070
+ noDataText: PropTypes.string,
1071
+ className: PropTypes.string,
1072
+ maxHeight: PropTypes.string
1648
1073
  };
1649
1074
  export {
1650
- nt as DataTable
1075
+ DataTable
1651
1076
  };