@overdoser/react-toolkit 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,21 +1,21 @@
1
- import { forwardRef as $e, createElement as an, useState as Le, useCallback as fe, useMemo as ke, useEffect as Ne, useLayoutEffect as jt, useRef as re, useId as Ye, isValidElement as dn, cloneElement as Xt, createContext as _t, useContext as ft, useImperativeHandle as un } from "react";
2
- import { jsxs as z, jsx as s, Fragment as je } from "react/jsx-runtime";
1
+ import { forwardRef as Ne, createElement as an, useState as Re, useCallback as pe, useMemo as ke, useEffect as Le, useLayoutEffect as zt, useRef as oe, useId as Ue, isValidElement as dn, cloneElement as jt, createContext as _t, useContext as ft, useImperativeHandle as un } from "react";
2
+ import { jsxs as z, jsx as s, Fragment as ze } from "react/jsx-runtime";
3
3
  import { createPortal as pt } from "react-dom";
4
4
  import { FormProvider as hn, useFormContext as mn, useController as fn } from "react-hook-form";
5
- function Ut(e) {
5
+ function Yt(e) {
6
6
  var t, n, r = "";
7
7
  if (typeof e == "string" || typeof e == "number") r += e;
8
8
  else if (typeof e == "object") if (Array.isArray(e)) {
9
9
  var o = e.length;
10
- for (t = 0; t < o; t++) e[t] && (n = Ut(e[t])) && (r && (r += " "), r += n);
10
+ for (t = 0; t < o; t++) e[t] && (n = Yt(e[t])) && (r && (r += " "), r += n);
11
11
  } else for (n in e) e[n] && (r && (r += " "), r += n);
12
12
  return r;
13
13
  }
14
14
  function m() {
15
- for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = Ut(e)) && (r && (r += " "), r += t);
15
+ for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = Yt(e)) && (r && (r += " "), r += t);
16
16
  return r;
17
17
  }
18
- const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY", vn = "crk-secondary-j-3rj", bn = "crk-danger-Hxs5n", xn = "crk-ghost-kQ0A8", kn = "crk-sm-RXFPY", Mn = "crk-md-nDnOD", wn = "crk-lg-qD-Qh", $n = "crk-fullWidth-AHpSl", Nn = "crk-iconOnly-FNrSu", Ln = "crk-content-PpYVU", Sn = "crk-shimmer-8iQSU", Rn = "crk-loadingShimmer-BVvFw", Tn = "crk-shimmerSweep-uiZ01", Cn = "crk-dots-U8wss", An = "crk-loadingDots-eKv64", Bn = "crk-dot-Owuk1", In = "crk-dotBounce-FwdcC", Dn = "crk-loadingBorder-9ULFw", En = "crk-borderSpin-EJ2gW", Be = {
18
+ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY", vn = "crk-secondary-j-3rj", bn = "crk-danger-Hxs5n", xn = "crk-ghost-kQ0A8", kn = "crk-sm-RXFPY", Mn = "crk-md-nDnOD", wn = "crk-lg-qD-Qh", $n = "crk-fullWidth-AHpSl", Nn = "crk-iconOnly-FNrSu", Ln = "crk-content-PpYVU", Rn = "crk-shimmer-8iQSU", Sn = "crk-loadingShimmer-BVvFw", Tn = "crk-shimmerSweep-uiZ01", Cn = "crk-dots-U8wss", An = "crk-loadingDots-eKv64", Bn = "crk-dot-Owuk1", In = "crk-dotBounce-FwdcC", Dn = "crk-loadingBorder-9ULFw", En = "crk-borderSpin-EJ2gW", Be = {
19
19
  root: pn,
20
20
  loading: gn,
21
21
  primary: yn,
@@ -28,8 +28,8 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
28
28
  fullWidth: $n,
29
29
  iconOnly: Nn,
30
30
  content: Ln,
31
- shimmer: Sn,
32
- loadingShimmer: Rn,
31
+ shimmer: Rn,
32
+ loadingShimmer: Sn,
33
33
  shimmerSweep: Tn,
34
34
  dots: Cn,
35
35
  loadingDots: An,
@@ -41,7 +41,7 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
41
41
  dots: Be.loadingDots,
42
42
  shimmer: Be.loadingShimmer,
43
43
  border: Be.loadingBorder
44
- }, Yt = $e(
44
+ }, Ut = Ne(
45
45
  ({
46
46
  variant: e = "primary",
47
47
  size: t = "md",
@@ -86,14 +86,14 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
86
86
  }
87
87
  )
88
88
  );
89
- Yt.displayName = "Button";
89
+ Ut.displayName = "Button";
90
90
  const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn = "crk-srOnly-LGQgs", $t = {
91
91
  root: Wn,
92
92
  default: "crk-default-3TBlr",
93
93
  muted: Hn,
94
94
  danger: On,
95
95
  srOnly: Fn
96
- }, zn = $e(
96
+ }, Xn = Ne(
97
97
  ({
98
98
  variant: e = "default",
99
99
  external: t = !1,
@@ -119,13 +119,13 @@ const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn
119
119
  }
120
120
  )
121
121
  );
122
- zn.displayName = "Link";
123
- const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", Un = "crk-h3-lrbrK", Yn = "crk-h4--jkC1", Vn = "crk-h5-GnQvD", qn = "crk-h6-MKlIN", Gn = "crk-p-FzRtm", Zn = "crk-span-NZvLx", Kn = "crk-label-Cwi6a", Qn = "crk-normal-7AeZz", Jn = "crk-medium-36OXr", er = "crk-semibold-oQixc", tr = "crk-bold-bk4b4", nr = "crk-muted-itOSW", rr = "crk-primary-rp36t", or = "crk-danger-SyOy-", ir = "crk-success-w8PpD", cr = "crk-align-left-3AGYw", lr = "crk-align-center-h-x--", sr = "crk-align-right-IXFhK", ar = "crk-truncate-eqr85", Ue = {
124
- root: jn,
125
- h1: Xn,
122
+ Xn.displayName = "Link";
123
+ const zn = "crk-root-U-oiq", jn = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", Yn = "crk-h3-lrbrK", Un = "crk-h4--jkC1", Vn = "crk-h5-GnQvD", qn = "crk-h6-MKlIN", Gn = "crk-p-FzRtm", Zn = "crk-span-NZvLx", Kn = "crk-label-Cwi6a", Qn = "crk-normal-7AeZz", Jn = "crk-medium-36OXr", er = "crk-semibold-oQixc", tr = "crk-bold-bk4b4", nr = "crk-muted-itOSW", rr = "crk-primary-rp36t", or = "crk-danger-SyOy-", ir = "crk-success-w8PpD", cr = "crk-align-left-3AGYw", lr = "crk-align-center-h-x--", sr = "crk-align-right-IXFhK", ar = "crk-truncate-eqr85", Ye = {
124
+ root: zn,
125
+ h1: jn,
126
126
  h2: _n,
127
- h3: Un,
128
- h4: Yn,
127
+ h3: Yn,
128
+ h4: Un,
129
129
  h5: Vn,
130
130
  h6: qn,
131
131
  p: Gn,
@@ -144,7 +144,7 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", Un = "crk
144
144
  alignCenter: lr,
145
145
  alignRight: sr,
146
146
  truncate: ar
147
- }, dr = $e(
147
+ }, dr = Ne(
148
148
  ({
149
149
  variant: e = "p",
150
150
  weight: t,
@@ -160,12 +160,12 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", Un = "crk
160
160
  {
161
161
  ref: h,
162
162
  className: m(
163
- Ue.root,
164
- Ue[e],
165
- t && Ue[t],
166
- n && Ue[n],
167
- r && Ue[`align-${r}`],
168
- o && Ue.truncate,
163
+ Ye.root,
164
+ Ye[e],
165
+ t && Ye[t],
166
+ n && Ye[n],
167
+ r && Ye[`align-${r}`],
168
+ o && Ye.truncate,
169
169
  c
170
170
  ),
171
171
  style: i,
@@ -184,7 +184,7 @@ const ur = "crk-root-PVrgx", hr = "crk-unordered-FhCWT", mr = "crk-item-TfW82",
184
184
  sm: gr,
185
185
  md: yr,
186
186
  lg: vr
187
- }, br = $e(
187
+ }, br = Ne(
188
188
  ({
189
189
  variant: e = "unordered",
190
190
  spacing: t = "md",
@@ -209,7 +209,7 @@ const ur = "crk-root-PVrgx", hr = "crk-unordered-FhCWT", mr = "crk-item-TfW82",
209
209
  )
210
210
  );
211
211
  br.displayName = "List";
212
- const xr = $e(
212
+ const xr = Ne(
213
213
  ({ className: e, style: t, children: n, ...r }, o) => /* @__PURE__ */ s(
214
214
  "li",
215
215
  {
@@ -222,15 +222,15 @@ const xr = $e(
222
222
  )
223
223
  );
224
224
  xr.displayName = "ListItem";
225
- const kr = "crk-wrapper-zxjMt", Mr = "crk-root-Gf85-", wr = "crk-headerCell-ePPZW", $r = "crk-headerCellSortable-NMybk", Nr = "crk-sortIndicator-WGD2S", Lr = "crk-sortArrow-1-ok4", Sr = "crk-sortArrowActive-yhWrO", Rr = "crk-sortIndex-HGoca", Tr = "crk-row-H0wL1", Cr = "crk-cell-ZfnbG", Ar = "crk-emptyRow-AoPfj", Br = "crk-emptyCell-99-7C", Ir = "crk-striped-6Qckq", Dr = "crk-hoverable-ljU9B", Er = "crk-compact-2-UWr", Pr = "crk-paginator-UlYIY", Wr = "crk-paginatorInfo-BVca4", Hr = "crk-paginatorText-sqWS0", Or = "crk-pageSizeSelect-yhqJQ", Fr = "crk-paginatorNav-MDSui", zr = "crk-pageButton-1PX-g", jr = "crk-pageButtonActive--D7Q7", Xr = "crk-pageEllipsis-en59J", ve = {
225
+ const kr = "crk-wrapper-zxjMt", Mr = "crk-root-Gf85-", wr = "crk-headerCell-ePPZW", $r = "crk-headerCellSortable-NMybk", Nr = "crk-sortIndicator-WGD2S", Lr = "crk-sortArrow-1-ok4", Rr = "crk-sortArrowActive-yhWrO", Sr = "crk-sortIndex-HGoca", Tr = "crk-row-H0wL1", Cr = "crk-cell-ZfnbG", Ar = "crk-emptyRow-AoPfj", Br = "crk-emptyCell-99-7C", Ir = "crk-striped-6Qckq", Dr = "crk-hoverable-ljU9B", Er = "crk-compact-2-UWr", Pr = "crk-paginator-UlYIY", Wr = "crk-paginatorInfo-BVca4", Hr = "crk-paginatorText-sqWS0", Or = "crk-pageSizeSelect-yhqJQ", Fr = "crk-paginatorNav-MDSui", Xr = "crk-pageButton-1PX-g", zr = "crk-pageButtonActive--D7Q7", jr = "crk-pageEllipsis-en59J", ve = {
226
226
  wrapper: kr,
227
227
  root: Mr,
228
228
  headerCell: wr,
229
229
  headerCellSortable: $r,
230
230
  sortIndicator: Nr,
231
231
  sortArrow: Lr,
232
- sortArrowActive: Sr,
233
- sortIndex: Rr,
232
+ sortArrowActive: Rr,
233
+ sortIndex: Sr,
234
234
  row: Tr,
235
235
  cell: Cr,
236
236
  emptyRow: Ar,
@@ -243,20 +243,20 @@ const kr = "crk-wrapper-zxjMt", Mr = "crk-root-Gf85-", wr = "crk-headerCell-ePPZ
243
243
  paginatorText: Hr,
244
244
  pageSizeSelect: Or,
245
245
  paginatorNav: Fr,
246
- pageButton: zr,
247
- pageButtonActive: jr,
248
- pageEllipsis: Xr
246
+ pageButton: Xr,
247
+ pageButtonActive: zr,
248
+ pageEllipsis: jr
249
249
  };
250
250
  function _r(e, t) {
251
251
  return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
252
252
  }
253
- function Ur(e, t = []) {
254
- const [n, r] = Le(t), o = fe((a) => {
253
+ function Yr(e, t = []) {
254
+ const [n, r] = Re(t), o = pe((a) => {
255
255
  r((h) => {
256
256
  const u = h.find((d) => d.key === a);
257
257
  return u ? u.direction === "asc" ? [{ key: a, direction: "desc" }] : [] : [{ key: a, direction: "asc" }];
258
258
  });
259
- }, []), c = fe((a) => {
259
+ }, []), c = pe((a) => {
260
260
  r((h) => {
261
261
  const u = h.findIndex((f) => f.key === a);
262
262
  if (u === -1)
@@ -265,9 +265,9 @@ function Ur(e, t = []) {
265
265
  const f = [...h];
266
266
  return f[u] = { key: a, direction: "desc" }, f;
267
267
  }
268
- return h.filter((f, y) => y !== u);
268
+ return h.filter((f, p) => p !== u);
269
269
  });
270
- }, []), i = fe(() => {
270
+ }, []), i = pe(() => {
271
271
  r([]);
272
272
  }, []);
273
273
  return { sortedData: ke(() => n.length === 0 ? e : [...e].sort((a, h) => {
@@ -279,7 +279,7 @@ function Ur(e, t = []) {
279
279
  return 0;
280
280
  }), [e, n]), sortConfig: n, requestSort: o, requestMultiSort: c, resetSort: i };
281
281
  }
282
- function Yr({ direction: e, sortIndex: t }) {
282
+ function Ur({ direction: e, sortIndex: t }) {
283
283
  return /* @__PURE__ */ z("span", { className: ve.sortIndicator, "aria-hidden": "true", children: [
284
284
  /* @__PURE__ */ s("span", { className: m(ve.sortArrow, e === "asc" && ve.sortArrowActive), children: "▲" }),
285
285
  /* @__PURE__ */ s("span", { className: m(ve.sortArrow, e === "desc" && ve.sortArrowActive), children: "▼" }),
@@ -377,50 +377,50 @@ function qr({
377
377
  rowKey: u,
378
378
  rowClassName: d,
379
379
  rowStyle: f,
380
- emptyMessage: y = "No data",
380
+ emptyMessage: p = "No data",
381
381
  pagination: L,
382
- classes: v
382
+ classes: b
383
383
  }) {
384
- const S = r !== void 0, {
385
- sortedData: N,
386
- sortConfig: D,
387
- requestSort: j,
388
- requestMultiSort: Z
389
- } = Ur(e, n), U = S ? n ?? [] : D, C = S ? e : N, $ = ke(() => {
390
- if (!L || S) return C;
391
- const R = (L.page - 1) * L.pageSize;
392
- return C.slice(R, R + L.pageSize);
393
- }, [C, L, S]), oe = L?.totalRows ?? C.length, ce = fe(
394
- (R, te) => {
395
- const H = o && (te.ctrlKey || te.metaKey);
396
- if (S)
397
- if (H) {
398
- const O = U.findIndex((F) => F.key === R);
399
- let A;
400
- O === -1 ? A = [...U, { key: R, direction: "asc" }] : U[O].direction === "asc" ? A = U.map(
401
- (F, ne) => ne === O ? { key: R, direction: "desc" } : F
402
- ) : A = U.filter((F, ne) => ne !== O), r(A);
384
+ const R = r !== void 0, {
385
+ sortedData: w,
386
+ sortConfig: Q,
387
+ requestSort: W,
388
+ requestMultiSort: D
389
+ } = Yr(e, n), Z = R ? n ?? [] : Q, T = R ? e : w, $ = ke(() => {
390
+ if (!L || R) return T;
391
+ const S = (L.page - 1) * L.pageSize;
392
+ return T.slice(S, S + L.pageSize);
393
+ }, [T, L, R]), ie = L?.totalRows ?? T.length, ne = pe(
394
+ (S, re) => {
395
+ const F = o && (re.ctrlKey || re.metaKey);
396
+ if (R)
397
+ if (F) {
398
+ const j = Z.findIndex((X) => X.key === S);
399
+ let C;
400
+ j === -1 ? C = [...Z, { key: S, direction: "asc" }] : Z[j].direction === "asc" ? C = Z.map(
401
+ (X, se) => se === j ? { key: S, direction: "desc" } : X
402
+ ) : C = Z.filter((X, se) => se !== j), r(C);
403
403
  } else {
404
- const O = U.find((A) => A.key === R);
405
- O ? O.direction === "asc" ? r([{ key: R, direction: "desc" }]) : r([]) : r([{ key: R, direction: "asc" }]);
404
+ const j = Z.find((C) => C.key === S);
405
+ j ? j.direction === "asc" ? r([{ key: S, direction: "desc" }]) : r([]) : r([{ key: S, direction: "asc" }]);
406
406
  }
407
407
  else
408
- H ? Z(R) : j(R);
408
+ F ? D(S) : W(S);
409
409
  },
410
410
  [
411
- S,
411
+ R,
412
412
  o,
413
- U,
413
+ Z,
414
414
  r,
415
- j,
416
- Z
415
+ W,
416
+ D
417
417
  ]
418
- ), q = (R) => U.find((H) => H.key === R)?.direction, ae = (R) => {
419
- if (U.length <= 1) return;
420
- const te = U.findIndex((H) => H.key === R);
421
- return te >= 0 ? te : void 0;
418
+ ), V = (S) => Z.find((F) => F.key === S)?.direction, ue = (S) => {
419
+ if (Z.length <= 1) return;
420
+ const re = Z.findIndex((F) => F.key === S);
421
+ return re >= 0 ? re : void 0;
422
422
  };
423
- return /* @__PURE__ */ z("div", { className: m(ve.wrapper, v?.wrapper), children: [
423
+ return /* @__PURE__ */ z("div", { className: m(ve.wrapper, b?.wrapper), children: [
424
424
  /* @__PURE__ */ z(
425
425
  "table",
426
426
  {
@@ -429,56 +429,56 @@ function qr({
429
429
  c && ve.striped,
430
430
  i && ve.hoverable,
431
431
  l && ve.compact,
432
- v?.root,
432
+ b?.root,
433
433
  a
434
434
  ),
435
435
  style: h,
436
436
  children: [
437
- /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((R) => /* @__PURE__ */ z(
437
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((S) => /* @__PURE__ */ z(
438
438
  "th",
439
439
  {
440
440
  className: m(
441
441
  ve.headerCell,
442
- R.sortable && ve.headerCellSortable,
443
- v?.headerCell
442
+ S.sortable && ve.headerCellSortable,
443
+ b?.headerCell
444
444
  ),
445
445
  style: {
446
- width: R.width,
447
- textAlign: R.align
446
+ width: S.width,
447
+ textAlign: S.align
448
448
  },
449
- onClick: R.sortable ? (te) => ce(R.key, te) : void 0,
450
- "aria-sort": R.sortable ? q(R.key) === "asc" ? "ascending" : q(R.key) === "desc" ? "descending" : "none" : void 0,
449
+ onClick: S.sortable ? (re) => ne(S.key, re) : void 0,
450
+ "aria-sort": S.sortable ? V(S.key) === "asc" ? "ascending" : V(S.key) === "desc" ? "descending" : "none" : void 0,
451
451
  children: [
452
- R.header,
453
- R.sortable && /* @__PURE__ */ s(
454
- Yr,
452
+ S.header,
453
+ S.sortable && /* @__PURE__ */ s(
454
+ Ur,
455
455
  {
456
- direction: q(R.key),
457
- sortIndex: ae(R.key)
456
+ direction: V(S.key),
457
+ sortIndex: ue(S.key)
458
458
  }
459
459
  )
460
460
  ]
461
461
  },
462
- R.key
462
+ S.key
463
463
  )) }) }),
464
- /* @__PURE__ */ s("tbody", { children: $.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: m(ve.emptyCell, v?.emptyCell), colSpan: t.length, children: y }) }) : $.map((R, te) => {
465
- const H = u ? String(R[u]) : te, O = typeof d == "function" ? d(R, te) : d, A = typeof f == "function" ? f(R, te) : f;
464
+ /* @__PURE__ */ s("tbody", { children: $.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: m(ve.emptyCell, b?.emptyCell), colSpan: t.length, children: p }) }) : $.map((S, re) => {
465
+ const F = u ? String(S[u]) : re, j = typeof d == "function" ? d(S, re) : d, C = typeof f == "function" ? f(S, re) : f;
466
466
  return /* @__PURE__ */ s(
467
467
  "tr",
468
468
  {
469
- className: m(ve.row, v?.row, O),
470
- style: A,
471
- children: t.map((F) => /* @__PURE__ */ s(
469
+ className: m(ve.row, b?.row, j),
470
+ style: C,
471
+ children: t.map((X) => /* @__PURE__ */ s(
472
472
  "td",
473
473
  {
474
- className: m(ve.cell, v?.cell),
475
- style: { textAlign: F.align },
476
- children: F.render ? F.render(R[F.key], R, te) : R[F.key]
474
+ className: m(ve.cell, b?.cell),
475
+ style: { textAlign: X.align },
476
+ children: X.render ? X.render(S[X.key], S, re) : S[X.key]
477
477
  },
478
- F.key
478
+ X.key
479
479
  ))
480
480
  },
481
- H
481
+ F
482
482
  );
483
483
  }) })
484
484
  ]
@@ -488,13 +488,13 @@ function qr({
488
488
  Vr,
489
489
  {
490
490
  ...L,
491
- totalRows: oe,
492
- paginatorClasses: { paginator: v?.paginator, pageButton: v?.pageButton }
491
+ totalRows: ie,
492
+ paginatorClasses: { paginator: b?.paginator, pageButton: b?.pageButton }
493
493
  }
494
494
  )
495
495
  ] });
496
496
  }
497
- const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trigger-LwPaD", Qr = "crk-triggerOpen-U4pa9", Jr = "crk-triggerLabel-QLITs", eo = "crk-triggerError-3jlu1", to = "crk-placeholder-fWdch", no = "crk-chevron-jmDNe", ro = "crk-menu-fxnKL", oo = "crk-menuOpen-HF-Y1", io = "crk-alignLeft-buCDJ", co = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo", Me = {
497
+ const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trigger-LwPaD", Qr = "crk-triggerOpen-U4pa9", Jr = "crk-triggerLabel-QLITs", eo = "crk-triggerError-3jlu1", to = "crk-placeholder-fWdch", no = "crk-chevron-jmDNe", ro = "crk-menu-fxnKL", oo = "crk-menuOpen-HF-Y1", io = "crk-alignLeft-buCDJ", co = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo", we = {
498
498
  root: Gr,
499
499
  fullWidth: Zr,
500
500
  trigger: Kr,
@@ -511,15 +511,15 @@ const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trig
511
511
  itemDisabled: so,
512
512
  itemSelected: ao
513
513
  };
514
- function Rt(e, t = !0) {
515
- const n = fe(
514
+ function St(e, t = !0) {
515
+ const n = pe(
516
516
  (r) => {
517
517
  const o = e[r.key];
518
518
  o && o(r);
519
519
  },
520
520
  [e]
521
521
  );
522
- Ne(() => {
522
+ Le(() => {
523
523
  if (t)
524
524
  return document.addEventListener("keydown", n), () => {
525
525
  document.removeEventListener("keydown", n);
@@ -527,8 +527,8 @@ function Rt(e, t = !0) {
527
527
  }, [t, n]);
528
528
  }
529
529
  function Tt(e, t) {
530
- const [n, r] = Le({ top: 0, left: 0, width: 0 });
531
- return jt(() => {
530
+ const [n, r] = Re({ top: 0, left: 0, width: 0 });
531
+ return zt(() => {
532
532
  if (!t) return;
533
533
  const o = () => {
534
534
  const c = e.current;
@@ -542,7 +542,7 @@ function Tt(e, t) {
542
542
  };
543
543
  }, [t, e]), n;
544
544
  }
545
- const Vt = $e(
545
+ const Vt = Ne(
546
546
  ({
547
547
  trigger: e,
548
548
  children: t,
@@ -557,113 +557,113 @@ const Vt = $e(
557
557
  value: u,
558
558
  onChange: d,
559
559
  error: f = !1,
560
- fullWidth: y = !0,
560
+ fullWidth: p = !0,
561
561
  portal: L = !0,
562
- classes: v
563
- }, S) => {
564
- const [N, D] = Le(!1), j = re(null), Z = re(null), U = re(null), C = Ye();
565
- Ne(() => {
566
- N && Z.current && Z.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
567
- }, [N]);
568
- const $ = fe(() => {
569
- D(!1), l?.(), U.current?.focus();
570
- }, [l]), oe = fe(() => {
571
- D((A) => {
572
- const F = !A;
573
- return F ? i?.() : l?.(), F;
562
+ classes: b
563
+ }, R) => {
564
+ const [w, Q] = Re(!1), W = oe(null), D = oe(null), Z = oe(null), T = Ue();
565
+ Le(() => {
566
+ w && D.current && D.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
567
+ }, [w]);
568
+ const $ = pe(() => {
569
+ Q(!1), l?.(), Z.current?.focus();
570
+ }, [l]), ie = pe(() => {
571
+ Q((C) => {
572
+ const X = !C;
573
+ return X ? i?.() : l?.(), X;
574
574
  });
575
- }, [i, l]), ce = fe(
576
- (A) => {
577
- d?.(A), $();
575
+ }, [i, l]), ne = pe(
576
+ (C) => {
577
+ d?.(C), $();
578
578
  },
579
579
  [d, $]
580
580
  );
581
- Ne(() => {
582
- if (!N) return;
583
- const A = (F) => {
584
- const ne = F.target;
585
- j.current?.contains(ne) || Z.current?.contains(ne) || $();
581
+ Le(() => {
582
+ if (!w) return;
583
+ const C = (X) => {
584
+ const se = X.target;
585
+ W.current?.contains(se) || D.current?.contains(se) || $();
586
586
  };
587
- return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
588
- }, [N, $]), Rt(
587
+ return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
588
+ }, [w, $]), St(
589
589
  {
590
590
  Escape: () => $()
591
591
  },
592
- N
592
+ w
593
593
  );
594
- const q = Tt(U, N && L), ae = a?.find((A) => A.value === u)?.label, R = a ? ae || h : e, te = a && !ae, H = a ? a.map((A) => /* @__PURE__ */ s(
594
+ const V = Tt(Z, w && L), ue = a?.find((C) => C.value === u)?.label, S = a ? ue || h : e, re = a && !ue, F = a ? a.map((C) => /* @__PURE__ */ s(
595
595
  "button",
596
596
  {
597
597
  type: "button",
598
598
  role: "menuitem",
599
599
  className: m(
600
- Me.item,
601
- A.disabled && Me.itemDisabled,
602
- A.value === u && Me.itemSelected,
603
- v?.item
600
+ we.item,
601
+ C.disabled && we.itemDisabled,
602
+ C.value === u && we.itemSelected,
603
+ b?.item
604
604
  ),
605
- disabled: A.disabled,
606
- onClick: () => ce(A.value),
607
- children: A.label
605
+ disabled: C.disabled,
606
+ onClick: () => ne(C.value),
607
+ children: C.label
608
608
  },
609
- A.value
610
- )) : t, O = (A) => /* @__PURE__ */ s(
609
+ C.value
610
+ )) : t, j = (C) => /* @__PURE__ */ s(
611
611
  "div",
612
612
  {
613
- ref: Z,
614
- id: C,
613
+ ref: D,
614
+ id: T,
615
615
  className: m(
616
- Me.menu,
617
- N && Me.menuOpen,
618
- n === "left" ? Me.alignLeft : Me.alignRight,
619
- !L && y && Me.fullWidth,
620
- v?.menu
616
+ we.menu,
617
+ w && we.menuOpen,
618
+ n === "left" ? we.alignLeft : we.alignRight,
619
+ !L && p && we.fullWidth,
620
+ b?.menu
621
621
  ),
622
- style: A,
622
+ style: C,
623
623
  role: "menu",
624
- children: H
624
+ children: F
625
625
  }
626
626
  );
627
627
  return /* @__PURE__ */ z(
628
628
  "div",
629
629
  {
630
- ref: S,
631
- className: m(Me.root, y && Me.fullWidth, v?.root, r),
630
+ ref: R,
631
+ className: m(we.root, p && we.fullWidth, b?.root, r),
632
632
  style: o,
633
633
  children: [
634
- /* @__PURE__ */ z("div", { ref: j, style: y ? { width: "100%" } : void 0, children: [
634
+ /* @__PURE__ */ z("div", { ref: W, style: p ? { width: "100%" } : void 0, children: [
635
635
  /* @__PURE__ */ z(
636
636
  "button",
637
637
  {
638
- ref: U,
638
+ ref: Z,
639
639
  id: c,
640
640
  type: "button",
641
641
  className: m(
642
- Me.trigger,
643
- N && Me.triggerOpen,
644
- f && Me.triggerError,
645
- y && Me.fullWidth,
646
- v?.trigger
642
+ we.trigger,
643
+ w && we.triggerOpen,
644
+ f && we.triggerError,
645
+ p && we.fullWidth,
646
+ b?.trigger
647
647
  ),
648
- onClick: oe,
649
- "aria-expanded": N,
648
+ onClick: ie,
649
+ "aria-expanded": w,
650
650
  "aria-haspopup": "menu",
651
- "aria-controls": N ? C : void 0,
651
+ "aria-controls": w ? T : void 0,
652
652
  children: [
653
- /* @__PURE__ */ s("span", { className: m(Me.triggerLabel, te && Me.placeholder, v?.triggerLabel), children: R }),
654
- /* @__PURE__ */ s("span", { className: m(Me.chevron, v?.chevron), "aria-hidden": "true" })
653
+ /* @__PURE__ */ s("span", { className: m(we.triggerLabel, re && we.placeholder, b?.triggerLabel), children: S }),
654
+ /* @__PURE__ */ s("span", { className: m(we.chevron, b?.chevron), "aria-hidden": "true" })
655
655
  ]
656
656
  }
657
657
  ),
658
- !L && O()
658
+ !L && j()
659
659
  ] }),
660
- L && N && typeof document < "u" && pt(
661
- O({
660
+ L && w && typeof document < "u" && pt(
661
+ j({
662
662
  position: "fixed",
663
- top: q.top + 4,
664
- left: n === "right" ? void 0 : q.left,
665
- right: n === "right" ? window.innerWidth - (q.left + q.width) : void 0,
666
- minWidth: q.width,
663
+ top: V.top + 4,
664
+ left: n === "right" ? void 0 : V.left,
665
+ right: n === "right" ? window.innerWidth - (V.left + V.width) : void 0,
666
+ minWidth: V.width,
667
667
  zIndex: "var(--crk-z-floating)"
668
668
  }),
669
669
  document.body
@@ -674,7 +674,7 @@ const Vt = $e(
674
674
  }
675
675
  );
676
676
  Vt.displayName = "Dropdown";
677
- const uo = $e(
677
+ const uo = Ne(
678
678
  ({
679
679
  disabled: e = !1,
680
680
  className: t,
@@ -687,8 +687,8 @@ const uo = $e(
687
687
  type: "button",
688
688
  role: "menuitem",
689
689
  className: m(
690
- Me.item,
691
- e && Me.itemDisabled,
690
+ we.item,
691
+ e && we.itemDisabled,
692
692
  t
693
693
  ),
694
694
  disabled: e,
@@ -709,7 +709,7 @@ const ho = "crk-root-8H-L9", mo = "crk-trigger-Zn1nQ", fo = "crk-popover-rvS3X",
709
709
  right: bo
710
710
  };
711
711
  function xo(e, t, n = !0) {
712
- Ne(() => {
712
+ Le(() => {
713
713
  if (!n) return;
714
714
  const r = (o) => {
715
715
  !e.current || e.current.contains(o.target) || t();
@@ -725,7 +725,7 @@ function ko(...e) {
725
725
  n && (typeof n == "function" ? n(t) : n.current = t);
726
726
  };
727
727
  }
728
- const qt = $e(
728
+ const qt = Ne(
729
729
  ({
730
730
  trigger: e,
731
731
  asChild: t = !1,
@@ -737,53 +737,53 @@ const qt = $e(
737
737
  className: l,
738
738
  style: a
739
739
  }, h) => {
740
- const [u, d] = Le(!1), f = re(null), y = re(null), L = re(null), v = Ye(), S = o !== void 0, N = S ? o : u, D = fe(
741
- (C) => {
742
- S || d(C), c?.(C);
740
+ const [u, d] = Re(!1), f = oe(null), p = oe(null), L = oe(null), b = Ue(), R = o !== void 0, w = R ? o : u, Q = pe(
741
+ (T) => {
742
+ R || d(T), c?.(T);
743
743
  },
744
- [S, c]
745
- ), j = fe(() => {
746
- D(!1), L.current?.focus();
747
- }, [D]), Z = fe(() => {
748
- D(!N);
749
- }, [N, D]);
750
- xo(f, j, N), Rt(
744
+ [R, c]
745
+ ), W = pe(() => {
746
+ Q(!1), L.current?.focus();
747
+ }, [Q]), D = pe(() => {
748
+ Q(!w);
749
+ }, [w, Q]);
750
+ xo(f, W, w), St(
751
751
  {
752
- Escape: () => j()
752
+ Escape: () => W()
753
753
  },
754
- N
755
- ), Ne(() => {
756
- if (N && y.current) {
757
- const C = y.current.querySelector(
754
+ w
755
+ ), Le(() => {
756
+ if (w && p.current) {
757
+ const T = p.current.querySelector(
758
758
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
759
759
  );
760
- C ? C.focus() : y.current.focus();
760
+ T ? T.focus() : p.current.focus();
761
761
  }
762
- }, [N]);
763
- let U;
762
+ }, [w]);
763
+ let Z;
764
764
  if (t && dn(e)) {
765
- const C = e, $ = C.ref;
766
- U = Xt(C, {
765
+ const T = e, $ = T.ref;
766
+ Z = jt(T, {
767
767
  ref: ko(L, $),
768
- onClick: (oe) => {
769
- C.props.onClick?.(oe), Z();
768
+ onClick: (ie) => {
769
+ T.props.onClick?.(ie), D();
770
770
  },
771
- className: m(C.props.className, i?.trigger),
772
- "aria-expanded": N,
771
+ className: m(T.props.className, i?.trigger),
772
+ "aria-expanded": w,
773
773
  "aria-haspopup": "dialog",
774
- "aria-controls": N ? v : void 0
774
+ "aria-controls": w ? b : void 0
775
775
  });
776
776
  } else
777
- U = /* @__PURE__ */ s(
777
+ Z = /* @__PURE__ */ s(
778
778
  "button",
779
779
  {
780
780
  ref: L,
781
781
  type: "button",
782
782
  className: m(at.trigger, i?.trigger),
783
- onClick: Z,
784
- "aria-expanded": N,
783
+ onClick: D,
784
+ "aria-expanded": w,
785
785
  "aria-haspopup": "dialog",
786
- "aria-controls": N ? v : void 0,
786
+ "aria-controls": w ? b : void 0,
787
787
  children: e
788
788
  }
789
789
  );
@@ -794,12 +794,12 @@ const qt = $e(
794
794
  className: m(at.root, i?.root, l),
795
795
  style: a,
796
796
  children: /* @__PURE__ */ z("div", { ref: f, children: [
797
- U,
798
- N && /* @__PURE__ */ s(
797
+ Z,
798
+ w && /* @__PURE__ */ s(
799
799
  "div",
800
800
  {
801
- ref: y,
802
- id: v,
801
+ ref: p,
802
+ id: b,
803
803
  role: "dialog",
804
804
  tabIndex: -1,
805
805
  className: m(at.popover, at[r], i?.popover),
@@ -821,7 +821,7 @@ const It = [
821
821
  '[tabindex]:not([tabindex="-1"])'
822
822
  ].join(", ");
823
823
  function Mo(e, t) {
824
- const n = re(null), r = fe(
824
+ const n = oe(null), r = pe(
825
825
  (o) => {
826
826
  if (o.key !== "Tab" || !e.current)
827
827
  return;
@@ -837,7 +837,7 @@ function Mo(e, t) {
837
837
  },
838
838
  [e]
839
839
  );
840
- Ne(() => {
840
+ Le(() => {
841
841
  if (!t || !e.current)
842
842
  return;
843
843
  n.current = document.activeElement;
@@ -847,13 +847,13 @@ function Mo(e, t) {
847
847
  };
848
848
  }, [t, e, r]);
849
849
  }
850
- const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yNG-7", Lo = "crk-modalIn-xFUwm", So = "crk-sm--xyY9", Ro = "crk-md-ETTfh", To = "crk-lg-5DBb7", Co = "crk-fullscreen-b4jQ-", Ao = "crk-header-NS30G", Bo = "crk-headerWithClose-4davm", Io = "crk-closeButton-JX-aq", Do = "crk-body-3zIj9", Eo = "crk-footer-Oyz-R", ze = {
850
+ const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yNG-7", Lo = "crk-modalIn-xFUwm", Ro = "crk-sm--xyY9", So = "crk-md-ETTfh", To = "crk-lg-5DBb7", Co = "crk-fullscreen-b4jQ-", Ao = "crk-header-NS30G", Bo = "crk-headerWithClose-4davm", Io = "crk-closeButton-JX-aq", Do = "crk-body-3zIj9", Eo = "crk-footer-Oyz-R", Xe = {
851
851
  backdrop: wo,
852
852
  backdropIn: $o,
853
853
  modal: No,
854
854
  modalIn: Lo,
855
- sm: So,
856
- md: Ro,
855
+ sm: Ro,
856
+ md: So,
857
857
  lg: To,
858
858
  fullscreen: Co,
859
859
  header: Ao,
@@ -867,7 +867,7 @@ const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
867
867
  "div",
868
868
  {
869
869
  id: c,
870
- className: m(ze.header, r && ze.headerWithClose, o.header, t),
870
+ className: m(Xe.header, r && Xe.headerWithClose, o.header, t),
871
871
  style: n,
872
872
  children: [
873
873
  e,
@@ -875,7 +875,7 @@ const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
875
875
  "button",
876
876
  {
877
877
  type: "button",
878
- className: m(ze.closeButton, o.closeButton),
878
+ className: m(Xe.closeButton, o.closeButton),
879
879
  onClick: r,
880
880
  "aria-label": "Close",
881
881
  children: "×"
@@ -888,15 +888,15 @@ const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
888
888
  Gt.displayName = "Modal.Header";
889
889
  const Zt = ({ children: e, className: t, style: n }) => {
890
890
  const { classes: r } = ft(gt);
891
- return /* @__PURE__ */ s("div", { className: m(ze.body, r.body, t), style: n, children: e });
891
+ return /* @__PURE__ */ s("div", { className: m(Xe.body, r.body, t), style: n, children: e });
892
892
  };
893
893
  Zt.displayName = "Modal.Body";
894
894
  const Kt = ({ children: e, className: t, style: n }) => {
895
895
  const { classes: r } = ft(gt);
896
- return /* @__PURE__ */ s("div", { className: m(ze.footer, r.footer, t), style: n, children: e });
896
+ return /* @__PURE__ */ s("div", { className: m(Xe.footer, r.footer, t), style: n, children: e });
897
897
  };
898
898
  Kt.displayName = "Modal.Footer";
899
- const yt = $e(
899
+ const yt = Ne(
900
900
  ({
901
901
  open: e,
902
902
  onClose: t,
@@ -910,9 +910,9 @@ const yt = $e(
910
910
  "aria-label": h,
911
911
  "aria-labelledby": u
912
912
  }, d) => {
913
- const f = re(null), y = d ?? f, L = Ye(), v = u ?? `${L}-title`;
914
- Mo(y, e);
915
- const S = ke(
913
+ const f = oe(null), p = d ?? f, L = Ue(), b = u ?? `${L}-title`;
914
+ Mo(p, e);
915
+ const R = ke(
916
916
  () => ({
917
917
  Escape: () => {
918
918
  r && t();
@@ -920,34 +920,34 @@ const yt = $e(
920
920
  }),
921
921
  [r, t]
922
922
  );
923
- Rt(S, e), Ne(() => {
923
+ St(R, e), Le(() => {
924
924
  if (!e) return;
925
- const D = document.body.style.overflow;
925
+ const Q = document.body.style.overflow;
926
926
  return document.body.style.overflow = "hidden", () => {
927
- document.body.style.overflow = D;
927
+ document.body.style.overflow = Q;
928
928
  };
929
929
  }, [e]);
930
- const N = (D) => {
931
- n && D.target === D.currentTarget && t();
930
+ const w = (Q) => {
931
+ n && Q.target === Q.currentTarget && t();
932
932
  };
933
933
  return e ? pt(
934
934
  /* @__PURE__ */ s(
935
935
  "div",
936
936
  {
937
- className: m(ze.backdrop, c?.backdrop),
938
- onClick: N,
937
+ className: m(Xe.backdrop, c?.backdrop),
938
+ onClick: w,
939
939
  role: "presentation",
940
940
  children: /* @__PURE__ */ s(
941
941
  "div",
942
942
  {
943
- ref: y,
944
- className: m(ze.modal, ze[o], c?.modal, i),
943
+ ref: p,
944
+ className: m(Xe.modal, Xe[o], c?.modal, i),
945
945
  style: l,
946
946
  role: "dialog",
947
947
  "aria-modal": "true",
948
948
  "aria-label": h,
949
- "aria-labelledby": h ? void 0 : v,
950
- children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: v }, children: a })
949
+ "aria-labelledby": h ? void 0 : b,
950
+ children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: b }, children: a })
951
951
  }
952
952
  )
953
953
  }
@@ -960,17 +960,17 @@ yt.displayName = "Modal";
960
960
  yt.Header = Gt;
961
961
  yt.Body = Zt;
962
962
  yt.Footer = Kt;
963
- const Po = "crk-root-jHIIP", Wo = "crk-formErrors-eh-OP", Ho = "crk-formError-XEuWv", Oo = "crk-field-OUlYz", Fo = "crk-label-udkR7", zo = "crk-labelError-LOgKi", jo = "crk-required-IYiA2", Xo = "crk-error-yFZXm", _o = "crk-helperText-Dm-rb", Uo = "crk-row-nNbx-", We = {
963
+ const Po = "crk-root-jHIIP", Wo = "crk-formErrors-eh-OP", Ho = "crk-formError-XEuWv", Oo = "crk-field-OUlYz", Fo = "crk-label-udkR7", Xo = "crk-labelError-LOgKi", zo = "crk-required-IYiA2", jo = "crk-error-yFZXm", _o = "crk-helperText-Dm-rb", Yo = "crk-row-nNbx-", We = {
964
964
  root: Po,
965
965
  formErrors: Wo,
966
966
  formError: Ho,
967
967
  field: Oo,
968
968
  label: Fo,
969
- labelError: zo,
970
- required: jo,
971
- error: Xo,
969
+ labelError: Xo,
970
+ required: zo,
971
+ error: jo,
972
972
  helperText: _o,
973
- row: Uo
973
+ row: Yo
974
974
  };
975
975
  function Pl({
976
976
  form: e,
@@ -994,7 +994,7 @@ function Pl({
994
994
  }
995
995
  ) });
996
996
  }
997
- const Yo = /* @__PURE__ */ new Set([
997
+ const Uo = /* @__PURE__ */ new Set([
998
998
  "Select",
999
999
  "NativeSelect",
1000
1000
  "SearchableSelect",
@@ -1012,15 +1012,15 @@ function Wl({
1012
1012
  style: l,
1013
1013
  children: a
1014
1014
  }) {
1015
- const { control: h } = mn(), { field: u, fieldState: d } = fn({ name: e, control: h, rules: o }), f = a.type, y = typeof f == "string" ? "" : f?.displayName ?? f?.name ?? "", L = Yo.has(y), { ref: v, ...S } = u, N = re(v);
1016
- N.current = v;
1017
- const D = fe(
1018
- (j) => {
1019
- if (j) {
1020
- const Z = j.matches("input, select, textarea, button, [tabindex]") ? j : j.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
1021
- N.current(Z ?? j);
1015
+ const { control: h } = mn(), { field: u, fieldState: d } = fn({ name: e, control: h, rules: o }), f = a.type, p = typeof f == "string" ? "" : f?.displayName ?? f?.name ?? "", L = Uo.has(p), { ref: b, ...R } = u, w = oe(b);
1016
+ w.current = b;
1017
+ const Q = pe(
1018
+ (W) => {
1019
+ if (W) {
1020
+ const D = W.matches("input, select, textarea, button, [tabindex]") ? W : W.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
1021
+ w.current(D ?? W);
1022
1022
  } else
1023
- N.current(null);
1023
+ w.current(null);
1024
1024
  },
1025
1025
  // eslint-disable-next-line react-hooks/exhaustive-deps
1026
1026
  []
@@ -1030,9 +1030,9 @@ function Wl({
1030
1030
  t,
1031
1031
  r && /* @__PURE__ */ s("span", { className: We.required, children: "*" })
1032
1032
  ] }),
1033
- Xt(a, {
1034
- ...S,
1035
- ref: D,
1033
+ jt(a, {
1034
+ ...R,
1035
+ ref: Q,
1036
1036
  id: e,
1037
1037
  error: !!d.error,
1038
1038
  "aria-invalid": d.error ? !0 : void 0,
@@ -1041,11 +1041,11 @@ function Wl({
1041
1041
  // Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
1042
1042
  // handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
1043
1043
  ...L && {
1044
- onValueChange: S.onChange,
1045
- onValuesChange: S.onChange
1044
+ onValueChange: R.onChange,
1045
+ onValuesChange: R.onChange
1046
1046
  },
1047
1047
  // Bridge for Checkbox (expects checked, not value)
1048
- checked: typeof S.value == "boolean" ? S.value : void 0
1048
+ checked: typeof R.value == "boolean" ? R.value : void 0
1049
1049
  }),
1050
1050
  d.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className: m(We.error, c?.error), role: "alert", children: d.error.message }) : n ? /* @__PURE__ */ s("span", { id: `${e}-helper`, className: m(We.helperText, c?.helperText), children: n }) : null
1051
1051
  ] });
@@ -1064,7 +1064,7 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
1064
1064
  suffix: ei,
1065
1065
  hasPrefix: ti,
1066
1066
  hasSuffix: ni
1067
- }, ri = $e(
1067
+ }, ri = Ne(
1068
1068
  ({
1069
1069
  inputSize: e = "md",
1070
1070
  error: t = !1,
@@ -1107,7 +1107,7 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
1107
1107
  }
1108
1108
  );
1109
1109
  ri.displayName = "Input";
1110
- const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "crk-lg-24Xd3", si = "crk-root-Uu9Ah", ai = "crk-error-9oRU6", di = "crk-arrow-WU8ZW", ui = "crk-searchableWrapper-7AL4l", hi = "crk-hiddenSelect-s3DEx", mi = "crk-searchableTrigger-m-GWV", fi = "crk-triggerOpen-Lo8-j", pi = "crk-triggerLabel-5rETZ", gi = "crk-placeholder-teBBh", yi = "crk-arrowInline-m-roG", vi = "crk-disabled-pcSeq", bi = "crk-visuallyHidden-2tTD5", xi = "crk-menu--i-je", ki = "crk-menuEnter-vJjLV", Mi = "crk-menuItems-VrZnE", wi = "crk-item-fU3XI", $i = "crk-itemHighlighted-MvR41", Ni = "crk-itemDisabled-KTUO8", Li = "crk-itemSelected-42-BG", Si = "crk-noResults-uicSW", Ri = "crk-multiTrigger-Pd3wJ", Ti = "crk-multiTriggerDisabled-9ajge", Ci = "crk-chip-TuYUB", Ai = "crk-chipLabel-H4JWu", Bi = "crk-chipRemove-Lfk0R", Ii = "crk-multiSearch-OrVeS", Di = "crk-arrowMulti-Nh9Hr", Ei = "crk-itemCheck-DPB5A", W = {
1110
+ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "crk-lg-24Xd3", si = "crk-root-Uu9Ah", ai = "crk-error-9oRU6", di = "crk-arrow-WU8ZW", ui = "crk-searchableWrapper-7AL4l", hi = "crk-hiddenSelect-s3DEx", mi = "crk-searchableTrigger-m-GWV", fi = "crk-triggerOpen-Lo8-j", pi = "crk-triggerLabel-5rETZ", gi = "crk-placeholder-teBBh", yi = "crk-arrowInline-m-roG", vi = "crk-disabled-pcSeq", bi = "crk-visuallyHidden-2tTD5", xi = "crk-menu--i-je", ki = "crk-menuEnter-vJjLV", Mi = "crk-menuItems-VrZnE", wi = "crk-item-fU3XI", $i = "crk-itemHighlighted-MvR41", Ni = "crk-itemDisabled-KTUO8", Li = "crk-itemSelected-42-BG", Ri = "crk-noResults-uicSW", Si = "crk-multiTrigger-Pd3wJ", Ti = "crk-multiTriggerDisabled-9ajge", Ci = "crk-chip-TuYUB", Ai = "crk-chipLabel-H4JWu", Bi = "crk-chipRemove-Lfk0R", Ii = "crk-multiSearch-OrVeS", Di = "crk-arrowMulti-Nh9Hr", Ei = "crk-itemCheck-DPB5A", P = {
1111
1111
  wrapper: oi,
1112
1112
  sm: ii,
1113
1113
  md: ci,
@@ -1131,8 +1131,8 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1131
1131
  itemHighlighted: $i,
1132
1132
  itemDisabled: Ni,
1133
1133
  itemSelected: Li,
1134
- noResults: Si,
1135
- multiTrigger: Ri,
1134
+ noResults: Ri,
1135
+ multiTrigger: Si,
1136
1136
  multiTriggerDisabled: Ti,
1137
1137
  chip: Ci,
1138
1138
  chipLabel: Ai,
@@ -1140,7 +1140,7 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1140
1140
  multiSearch: Ii,
1141
1141
  arrowMulti: Di,
1142
1142
  itemCheck: Ei
1143
- }, Qt = $e(
1143
+ }, Qt = Ne(
1144
1144
  ({
1145
1145
  inputSize: e = "md",
1146
1146
  error: t = !1,
@@ -1154,24 +1154,24 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1154
1154
  searchPlaceholder: h,
1155
1155
  onValueChange: u,
1156
1156
  ...d
1157
- }, f) => /* @__PURE__ */ z("div", { className: m(W.wrapper, W[e], t && W.error, o?.wrapper, c), style: i, children: [
1157
+ }, f) => /* @__PURE__ */ z("div", { className: m(P.wrapper, P[e], t && P.error, o?.wrapper, c), style: i, children: [
1158
1158
  /* @__PURE__ */ z(
1159
1159
  "select",
1160
1160
  {
1161
1161
  ref: f,
1162
- className: m(W.root, W[e], t && W.error, o?.root),
1162
+ className: m(P.root, P[e], t && P.error, o?.root),
1163
1163
  ...d,
1164
1164
  children: [
1165
1165
  r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
1166
- n ? n.map((y) => /* @__PURE__ */ s("option", { value: y.value, disabled: y.disabled, children: y.label }, y.value)) : l
1166
+ n ? n.map((p) => /* @__PURE__ */ s("option", { value: p.value, disabled: p.disabled, children: p.label }, p.value)) : l
1167
1167
  ]
1168
1168
  }
1169
1169
  ),
1170
- /* @__PURE__ */ s("span", { className: m(W.arrow, o?.arrow) })
1170
+ /* @__PURE__ */ s("span", { className: m(P.arrow, o?.arrow) })
1171
1171
  ] })
1172
1172
  );
1173
1173
  Qt.displayName = "NativeSelect";
1174
- const Jt = $e(
1174
+ const Jt = Ne(
1175
1175
  ({
1176
1176
  inputSize: e = "md",
1177
1177
  error: t = !1,
@@ -1186,84 +1186,84 @@ const Jt = $e(
1186
1186
  searchPlaceholder: u = "Search...",
1187
1187
  onChange: d,
1188
1188
  onValueChange: f,
1189
- portal: y = !0
1189
+ portal: p = !0
1190
1190
  }, L) => {
1191
- const [v, S] = Le(!1), [N, D] = Le(""), [j, Z] = Le(0), U = re(null), C = re(null), $ = re(null), oe = re(null), ce = re(null), q = Ye(), ae = Tt($, v && y), R = re(null), te = L ?? R, H = re(!1);
1192
- Ne(() => {
1193
- H.current && !v && $.current?.focus(), H.current = v;
1194
- }, [v]);
1195
- const O = fe(() => {
1196
- S(!1), D(""), Z(0);
1197
- }, []), A = fe(() => {
1198
- a || (S(!0), D(""), Z(0), setTimeout(() => C.current?.focus(), 0));
1199
- }, [a]), F = fe(
1200
- (M) => {
1201
- if (f?.(M), te.current) {
1191
+ const [b, R] = Re(!1), [w, Q] = Re(""), [W, D] = Re(0), Z = oe(null), T = oe(null), $ = oe(null), ie = oe(null), ne = oe(null), V = Ue(), ue = Tt($, b && p), S = oe(null), re = L ?? S, F = oe(!1);
1192
+ Le(() => {
1193
+ F.current && !b && $.current?.focus(), F.current = b;
1194
+ }, [b]);
1195
+ const j = pe(() => {
1196
+ R(!1), Q(""), D(0);
1197
+ }, []), C = pe(() => {
1198
+ a || (R(!0), Q(""), D(0), setTimeout(() => T.current?.focus(), 0));
1199
+ }, [a]), X = pe(
1200
+ (N) => {
1201
+ if (f?.(N), re.current) {
1202
1202
  Object.getOwnPropertyDescriptor(
1203
1203
  HTMLSelectElement.prototype,
1204
1204
  "value"
1205
- )?.set?.call(te.current, M);
1206
- const k = new Event("change", { bubbles: !0 });
1207
- te.current.dispatchEvent(k), d?.(k);
1205
+ )?.set?.call(re.current, N);
1206
+ const v = new Event("change", { bubbles: !0 });
1207
+ re.current.dispatchEvent(v), d?.(v);
1208
1208
  }
1209
- O();
1209
+ j();
1210
1210
  },
1211
- [f, d, te, O]
1212
- ), ne = ke(() => {
1213
- if (!N) return n;
1214
- const M = N.toLowerCase();
1215
- return n.filter((g) => g.label.toLowerCase().includes(M));
1216
- }, [n, N]);
1217
- Ne(() => {
1218
- const M = ne.findIndex((g) => !g.disabled);
1219
- Z(M >= 0 ? M : 0);
1220
- }, [ne]), Ne(() => {
1221
- if (!v) return;
1222
- const M = ce.current;
1223
- if (!M) return;
1224
- M.querySelectorAll('[role="option"]')[j]?.scrollIntoView?.({ block: "nearest" });
1225
- }, [j, v]);
1226
- const pe = fe(
1227
- (M) => {
1228
- const g = ne.map((k, B) => k.disabled ? -1 : B).filter((k) => k >= 0);
1229
- if (g.length !== 0)
1230
- if (M.key === "ArrowDown")
1231
- M.preventDefault(), Z((k) => {
1232
- const B = g.indexOf(k);
1233
- return B < g.length - 1 ? g[B + 1] : g[0];
1211
+ [f, d, re, j]
1212
+ ), se = ke(() => {
1213
+ if (!w) return n;
1214
+ const N = w.toLowerCase();
1215
+ return n.filter((y) => y.label.toLowerCase().includes(N));
1216
+ }, [n, w]);
1217
+ Le(() => {
1218
+ const N = se.findIndex((y) => !y.disabled);
1219
+ D(N >= 0 ? N : 0);
1220
+ }, [se]), Le(() => {
1221
+ if (!b) return;
1222
+ const N = ne.current;
1223
+ if (!N) return;
1224
+ N.querySelectorAll('[role="option"]')[W]?.scrollIntoView?.({ block: "nearest" });
1225
+ }, [W, b]);
1226
+ const me = pe(
1227
+ (N) => {
1228
+ const y = se.map((v, A) => v.disabled ? -1 : A).filter((v) => v >= 0);
1229
+ if (y.length !== 0)
1230
+ if (N.key === "ArrowDown")
1231
+ N.preventDefault(), D((v) => {
1232
+ const A = y.indexOf(v);
1233
+ return A < y.length - 1 ? y[A + 1] : y[0];
1234
1234
  });
1235
- else if (M.key === "ArrowUp")
1236
- M.preventDefault(), Z((k) => {
1237
- const B = g.indexOf(k);
1238
- return B > 0 ? g[B - 1] : g[g.length - 1];
1235
+ else if (N.key === "ArrowUp")
1236
+ N.preventDefault(), D((v) => {
1237
+ const A = y.indexOf(v);
1238
+ return A > 0 ? y[A - 1] : y[y.length - 1];
1239
1239
  });
1240
- else if (M.key === "Enter") {
1241
- M.preventDefault();
1242
- const k = ne[j];
1243
- k && !k.disabled && F(k.value);
1244
- } else M.key === "Escape" && (M.preventDefault(), O());
1240
+ else if (N.key === "Enter") {
1241
+ N.preventDefault();
1242
+ const v = se[W];
1243
+ v && !v.disabled && X(v.value);
1244
+ } else N.key === "Escape" && (N.preventDefault(), j());
1245
1245
  },
1246
- [ne, j, F, O]
1246
+ [se, W, X, j]
1247
1247
  );
1248
- Ne(() => {
1249
- if (!v) return;
1250
- const M = (g) => {
1251
- const k = g.target;
1252
- U.current?.contains(k) || oe.current?.contains(k) || O();
1248
+ Le(() => {
1249
+ if (!b) return;
1250
+ const N = (y) => {
1251
+ const v = y.target;
1252
+ Z.current?.contains(v) || ie.current?.contains(v) || j();
1253
1253
  };
1254
- return document.addEventListener("mousedown", M), () => document.removeEventListener("mousedown", M);
1255
- }, [v, O]);
1256
- const K = n.find((M) => M.value === l)?.label, X = ne.filter((M) => !M.disabled);
1254
+ return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
1255
+ }, [b, j]);
1256
+ const K = n.find((N) => N.value === l)?.label, H = se.filter((N) => !N.disabled);
1257
1257
  return /* @__PURE__ */ z(
1258
1258
  "div",
1259
1259
  {
1260
- ref: U,
1260
+ ref: Z,
1261
1261
  className: m(
1262
- W.wrapper,
1263
- W.searchableWrapper,
1264
- W[e],
1265
- t && W.error,
1266
- a && W.disabled,
1262
+ P.wrapper,
1263
+ P.searchableWrapper,
1264
+ P[e],
1265
+ t && P.error,
1266
+ a && P.disabled,
1267
1267
  o?.wrapper,
1268
1268
  c
1269
1269
  ),
@@ -1272,15 +1272,15 @@ const Jt = $e(
1272
1272
  /* @__PURE__ */ s(
1273
1273
  "select",
1274
1274
  {
1275
- ref: te,
1276
- className: W.hiddenSelect,
1275
+ ref: re,
1276
+ className: P.hiddenSelect,
1277
1277
  value: l ?? "",
1278
1278
  disabled: a,
1279
1279
  tabIndex: -1,
1280
1280
  "aria-hidden": "true",
1281
1281
  onChange: () => {
1282
1282
  },
1283
- children: n.map((M) => /* @__PURE__ */ s("option", { value: M.value, children: M.label }, M.value))
1283
+ children: n.map((N) => /* @__PURE__ */ s("option", { value: N.value, children: N.label }, N.value))
1284
1284
  }
1285
1285
  ),
1286
1286
  /* @__PURE__ */ z(
@@ -1290,90 +1290,90 @@ const Jt = $e(
1290
1290
  id: h,
1291
1291
  type: "button",
1292
1292
  className: m(
1293
- W.root,
1294
- W.searchableTrigger,
1295
- W[e],
1296
- v && W.triggerOpen,
1297
- t && W.error,
1298
- v && W.visuallyHidden,
1293
+ P.root,
1294
+ P.searchableTrigger,
1295
+ P[e],
1296
+ b && P.triggerOpen,
1297
+ t && P.error,
1298
+ b && P.visuallyHidden,
1299
1299
  o?.root
1300
1300
  ),
1301
- onClick: A,
1301
+ onClick: C,
1302
1302
  disabled: a,
1303
- "aria-expanded": v,
1303
+ "aria-expanded": b,
1304
1304
  "aria-haspopup": "listbox",
1305
- "aria-controls": v ? q : void 0,
1305
+ "aria-controls": b ? V : void 0,
1306
1306
  children: [
1307
- /* @__PURE__ */ s("span", { className: m(W.triggerLabel, !K && W.placeholder), children: K || r }),
1308
- /* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowInline, o?.arrow) })
1307
+ /* @__PURE__ */ s("span", { className: m(P.triggerLabel, !K && P.placeholder), children: K || r }),
1308
+ /* @__PURE__ */ s("span", { className: m(P.arrow, P.arrowInline, o?.arrow) })
1309
1309
  ]
1310
1310
  }
1311
1311
  ),
1312
- v && /* @__PURE__ */ s(
1312
+ b && /* @__PURE__ */ s(
1313
1313
  "input",
1314
1314
  {
1315
- ref: C,
1315
+ ref: T,
1316
1316
  type: "text",
1317
1317
  role: "combobox",
1318
1318
  className: m(
1319
- W.root,
1320
- W.searchableTrigger,
1321
- W[e],
1322
- W.triggerOpen,
1323
- t && W.error,
1319
+ P.root,
1320
+ P.searchableTrigger,
1321
+ P[e],
1322
+ P.triggerOpen,
1323
+ t && P.error,
1324
1324
  o?.root,
1325
1325
  o?.search
1326
1326
  ),
1327
1327
  placeholder: K || r,
1328
- value: N,
1329
- onChange: (M) => D(M.target.value),
1330
- onKeyDown: pe,
1328
+ value: w,
1329
+ onChange: (N) => Q(N.target.value),
1330
+ onKeyDown: me,
1331
1331
  "aria-expanded": !0,
1332
1332
  "aria-haspopup": "listbox",
1333
- "aria-controls": q,
1334
- "aria-activedescendant": X.length > 0 ? `select-option-${ne[j]?.value}` : void 0
1333
+ "aria-controls": V,
1334
+ "aria-activedescendant": H.length > 0 ? `select-option-${se[W]?.value}` : void 0
1335
1335
  }
1336
1336
  ),
1337
- v && (() => {
1338
- const M = y ? {
1337
+ b && (() => {
1338
+ const N = p ? {
1339
1339
  position: "fixed",
1340
- top: ae.top + 4,
1341
- left: ae.left,
1340
+ top: ue.top + 4,
1341
+ left: ue.left,
1342
1342
  right: "auto",
1343
- width: ae.width,
1343
+ width: ue.width,
1344
1344
  zIndex: "var(--crk-z-floating)"
1345
- } : void 0, g = /* @__PURE__ */ s(
1345
+ } : void 0, y = /* @__PURE__ */ s(
1346
1346
  "div",
1347
1347
  {
1348
- id: q,
1349
- ref: oe,
1350
- className: m(W.menu, o?.menu),
1351
- style: M,
1348
+ id: V,
1349
+ ref: ie,
1350
+ className: m(P.menu, o?.menu),
1351
+ style: N,
1352
1352
  role: "listbox",
1353
- children: /* @__PURE__ */ s("div", { className: W.menuItems, ref: ce, children: ne.length === 0 ? /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }) : ne.map((k, B) => /* @__PURE__ */ s(
1353
+ children: /* @__PURE__ */ s("div", { className: P.menuItems, ref: ne, children: se.length === 0 ? /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }) : se.map((v, A) => /* @__PURE__ */ s(
1354
1354
  "button",
1355
1355
  {
1356
- id: `select-option-${k.value}`,
1356
+ id: `select-option-${v.value}`,
1357
1357
  type: "button",
1358
1358
  role: "option",
1359
- "aria-selected": k.value === l,
1359
+ "aria-selected": v.value === l,
1360
1360
  className: m(
1361
- W.item,
1362
- k.disabled && W.itemDisabled,
1363
- k.value === l && W.itemSelected,
1364
- B === j && W.itemHighlighted,
1361
+ P.item,
1362
+ v.disabled && P.itemDisabled,
1363
+ v.value === l && P.itemSelected,
1364
+ A === W && P.itemHighlighted,
1365
1365
  o?.item
1366
1366
  ),
1367
- disabled: k.disabled,
1368
- onClick: () => F(k.value),
1369
- onMouseEnter: () => Z(B),
1370
- children: k.content ?? k.label
1367
+ disabled: v.disabled,
1368
+ onClick: () => X(v.value),
1369
+ onMouseEnter: () => D(A),
1370
+ children: v.content ?? v.label
1371
1371
  },
1372
- k.value
1372
+ v.value
1373
1373
  )) })
1374
1374
  }
1375
1375
  );
1376
- return y && typeof document < "u" ? pt(g, document.body) : g;
1376
+ return p && typeof document < "u" ? pt(y, document.body) : y;
1377
1377
  })()
1378
1378
  ]
1379
1379
  }
@@ -1381,7 +1381,7 @@ const Jt = $e(
1381
1381
  }
1382
1382
  );
1383
1383
  Jt.displayName = "SearchableSelect";
1384
- const en = $e(
1384
+ const en = Ne(
1385
1385
  ({
1386
1386
  inputSize: e = "md",
1387
1387
  error: t = !1,
@@ -1396,96 +1396,97 @@ const en = $e(
1396
1396
  searchPlaceholder: u,
1397
1397
  onValuesChange: d,
1398
1398
  clearSearchOnSelect: f = !0,
1399
- allowCreate: y = !1,
1400
- onCreate: L,
1401
- createLabel: v,
1402
- portal: S = !0
1403
- }, N) => {
1404
- const D = Array.isArray(l) ? l : l ? [l] : [], [j, Z] = Le(!1), [U, C] = Le(""), [$, oe] = Le(0), ce = re(null), q = re(null), ae = re(null), R = re(null), te = re(null), H = Ye(), O = Tt(te, j && S), A = re(null), F = N ?? A, ne = fe(() => {
1405
- Z(!1), C(""), oe(0);
1406
- }, []), pe = fe(() => {
1407
- a || (Z(!0), C(""), oe(0), setTimeout(() => q.current?.focus(), 0));
1408
- }, [a]), K = fe(
1409
- (b) => {
1410
- const E = D.includes(b) ? D.filter((V) => V !== b) : [...D, b];
1411
- d?.(E), f && C("");
1399
+ closeOnSelect: p = !0,
1400
+ allowCreate: L = !1,
1401
+ onCreate: b,
1402
+ createLabel: R,
1403
+ portal: w = !0
1404
+ }, Q) => {
1405
+ const W = Array.isArray(l) ? l : l ? [l] : [], [D, Z] = Re(!1), [T, $] = Re(""), [ie, ne] = Re(0), V = oe(null), ue = oe(null), S = oe(null), re = oe(null), F = oe(null), j = Ue(), C = Tt(F, D && w), X = oe(null), se = Q ?? X, me = pe(() => {
1406
+ Z(!1), $(""), ne(0);
1407
+ }, []), K = pe(() => {
1408
+ a || (Z(!0), $(""), ne(0), setTimeout(() => ue.current?.focus(), 0));
1409
+ }, [a]), H = pe(
1410
+ (k) => {
1411
+ const G = W.includes(k) ? W.filter((O) => O !== k) : [...W, k];
1412
+ d?.(G), p ? me() : f && $("");
1412
1413
  },
1413
- [D, d, f]
1414
- ), X = fe(
1415
- (b, E) => {
1416
- E.stopPropagation(), d?.(D.filter((V) => V !== b));
1414
+ [W, d, p, me, f]
1415
+ ), N = pe(
1416
+ (k, G) => {
1417
+ G.stopPropagation(), d?.(W.filter((O) => O !== k));
1417
1418
  },
1418
- [D, d]
1419
- ), M = ke(() => {
1420
- if (!U) return n;
1421
- const b = U.toLowerCase();
1422
- return n.filter((E) => E.label.toLowerCase().includes(b));
1423
- }, [n, U]), g = U.trim(), k = y && g.length > 0 && !n.some(
1424
- (b) => b.label.toLowerCase() === g.toLowerCase() || b.value === g
1425
- ) && !D.includes(g), B = fe(() => {
1426
- g && (D.includes(g) || (L?.(g), d?.([...D, g]), f && C("")));
1427
- }, [g, D, L, d, f]);
1428
- Ne(() => {
1429
- const b = M.findIndex((E) => !E.disabled);
1430
- oe(b >= 0 ? b : 0);
1431
- }, [M]), Ne(() => {
1432
- if (!j) return;
1433
- const b = R.current;
1434
- if (!b) return;
1435
- b.querySelectorAll('[role="option"]')[$]?.scrollIntoView?.({ block: "nearest" });
1436
- }, [$, j]);
1437
- const _ = M.length, J = fe(
1438
- (b) => {
1439
- const E = M.map((V, de) => V.disabled ? -1 : de).filter((V) => V >= 0);
1440
- if (k && E.push(_), b.key === "Backspace" && U === "" && D.length > 0) {
1441
- b.preventDefault(), d?.(D.slice(0, -1));
1419
+ [W, d]
1420
+ ), y = ke(() => {
1421
+ if (!T) return n;
1422
+ const k = T.toLowerCase();
1423
+ return n.filter((G) => G.label.toLowerCase().includes(k));
1424
+ }, [n, T]), v = T.trim(), A = L && v.length > 0 && !n.some(
1425
+ (k) => k.label.toLowerCase() === v.toLowerCase() || k.value === v
1426
+ ) && !W.includes(v), _ = pe(() => {
1427
+ v && (W.includes(v) || (b?.(v), d?.([...W, v]), p ? me() : f && $("")));
1428
+ }, [v, W, b, d, p, me, f]);
1429
+ Le(() => {
1430
+ const k = y.findIndex((G) => !G.disabled);
1431
+ ne(k >= 0 ? k : 0);
1432
+ }, [y]), Le(() => {
1433
+ if (!D) return;
1434
+ const k = re.current;
1435
+ if (!k) return;
1436
+ k.querySelectorAll('[role="option"]')[ie]?.scrollIntoView?.({ block: "nearest" });
1437
+ }, [ie, D]);
1438
+ const q = y.length, Y = pe(
1439
+ (k) => {
1440
+ const G = y.map((O, de) => O.disabled ? -1 : de).filter((O) => O >= 0);
1441
+ if (A && G.push(q), k.key === "Backspace" && T === "" && W.length > 0) {
1442
+ k.preventDefault(), d?.(W.slice(0, -1));
1442
1443
  return;
1443
1444
  }
1444
- if (E.length !== 0)
1445
- if (b.key === "ArrowDown") {
1446
- if (b.preventDefault(), !j) {
1447
- pe();
1445
+ if (G.length !== 0)
1446
+ if (k.key === "ArrowDown") {
1447
+ if (k.preventDefault(), !D) {
1448
+ K();
1448
1449
  return;
1449
1450
  }
1450
- oe((V) => {
1451
- const de = E.indexOf(V);
1452
- return de < E.length - 1 ? E[de + 1] : E[0];
1451
+ ne((O) => {
1452
+ const de = G.indexOf(O);
1453
+ return de < G.length - 1 ? G[de + 1] : G[0];
1453
1454
  });
1454
- } else if (b.key === "ArrowUp")
1455
- b.preventDefault(), oe((V) => {
1456
- const de = E.indexOf(V);
1457
- return de > 0 ? E[de - 1] : E[E.length - 1];
1455
+ } else if (k.key === "ArrowUp")
1456
+ k.preventDefault(), ne((O) => {
1457
+ const de = G.indexOf(O);
1458
+ return de > 0 ? G[de - 1] : G[G.length - 1];
1458
1459
  });
1459
- else if (b.key === "Enter") {
1460
- if (b.preventDefault(), k && $ === _) {
1461
- B();
1460
+ else if (k.key === "Enter") {
1461
+ if (k.preventDefault(), A && ie === q) {
1462
+ _();
1462
1463
  return;
1463
1464
  }
1464
- const V = M[$];
1465
- V && !V.disabled ? K(V.value) : k && B();
1466
- } else b.key === "Escape" && (b.preventDefault(), ne());
1465
+ const O = y[ie];
1466
+ O && !O.disabled ? H(O.value) : A && _();
1467
+ } else k.key === "Escape" && (k.preventDefault(), me());
1467
1468
  },
1468
- [M, $, K, ne, U, D, d, j, pe, k, B, _]
1469
+ [y, ie, H, me, T, W, d, D, K, A, _, q]
1469
1470
  );
1470
- Ne(() => {
1471
- if (!j) return;
1472
- const b = (E) => {
1473
- const V = E.target;
1474
- ce.current?.contains(V) || ae.current?.contains(V) || ne();
1471
+ Le(() => {
1472
+ if (!D) return;
1473
+ const k = (G) => {
1474
+ const O = G.target;
1475
+ V.current?.contains(O) || S.current?.contains(O) || me();
1475
1476
  };
1476
- return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
1477
- }, [j, ne]);
1478
- const Y = D.map((b) => n.find((V) => V.value === b) ?? { value: b, label: b });
1477
+ return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
1478
+ }, [D, me]);
1479
+ const J = W.map((k) => n.find((O) => O.value === k) ?? { value: k, label: k });
1479
1480
  return /* @__PURE__ */ z(
1480
1481
  "div",
1481
1482
  {
1482
- ref: ce,
1483
+ ref: V,
1483
1484
  className: m(
1484
- W.wrapper,
1485
- W.searchableWrapper,
1486
- W[e],
1487
- t && W.error,
1488
- a && W.disabled,
1485
+ P.wrapper,
1486
+ P.searchableWrapper,
1487
+ P[e],
1488
+ t && P.error,
1489
+ a && P.disabled,
1489
1490
  o?.wrapper,
1490
1491
  c
1491
1492
  ),
@@ -1494,135 +1495,135 @@ const en = $e(
1494
1495
  /* @__PURE__ */ s(
1495
1496
  "select",
1496
1497
  {
1497
- ref: F,
1498
- className: W.hiddenSelect,
1498
+ ref: se,
1499
+ className: P.hiddenSelect,
1499
1500
  multiple: !0,
1500
- value: D,
1501
+ value: W,
1501
1502
  disabled: a,
1502
1503
  tabIndex: -1,
1503
1504
  "aria-hidden": "true",
1504
1505
  onChange: () => {
1505
1506
  },
1506
- children: n.map((b) => /* @__PURE__ */ s("option", { value: b.value, children: b.label }, b.value))
1507
+ children: n.map((k) => /* @__PURE__ */ s("option", { value: k.value, children: k.label }, k.value))
1507
1508
  }
1508
1509
  ),
1509
1510
  /* @__PURE__ */ z(
1510
1511
  "div",
1511
1512
  {
1512
- ref: te,
1513
+ ref: F,
1513
1514
  className: m(
1514
- W.multiTrigger,
1515
- W[e],
1516
- j && W.triggerOpen,
1517
- t && W.error,
1518
- a && W.multiTriggerDisabled,
1515
+ P.multiTrigger,
1516
+ P[e],
1517
+ D && P.triggerOpen,
1518
+ t && P.error,
1519
+ a && P.multiTriggerDisabled,
1519
1520
  o?.root
1520
1521
  ),
1521
1522
  onClick: () => {
1522
- j ? q.current?.focus() : pe();
1523
+ D ? ue.current?.focus() : K();
1523
1524
  },
1524
1525
  role: "combobox",
1525
- "aria-expanded": j,
1526
+ "aria-expanded": D,
1526
1527
  "aria-haspopup": "listbox",
1527
- "aria-controls": j ? H : void 0,
1528
+ "aria-controls": D ? j : void 0,
1528
1529
  children: [
1529
- Y.map((b) => /* @__PURE__ */ z("span", { className: m(W.chip, o?.chip), children: [
1530
- /* @__PURE__ */ s("span", { className: W.chipLabel, children: b.content ?? b.label }),
1530
+ J.map((k) => /* @__PURE__ */ z("span", { className: m(P.chip, o?.chip), children: [
1531
+ /* @__PURE__ */ s("span", { className: P.chipLabel, children: k.content ?? k.label }),
1531
1532
  /* @__PURE__ */ s(
1532
1533
  "button",
1533
1534
  {
1534
1535
  type: "button",
1535
- className: m(W.chipRemove, o?.chipRemove),
1536
- onClick: (E) => X(b.value, E),
1537
- "aria-label": `Remove ${b.label}`,
1536
+ className: m(P.chipRemove, o?.chipRemove),
1537
+ onClick: (G) => N(k.value, G),
1538
+ "aria-label": `Remove ${k.label}`,
1538
1539
  tabIndex: -1,
1539
1540
  children: "×"
1540
1541
  }
1541
1542
  )
1542
- ] }, b.value)),
1543
+ ] }, k.value)),
1543
1544
  /* @__PURE__ */ s(
1544
1545
  "input",
1545
1546
  {
1546
- ref: q,
1547
+ ref: ue,
1547
1548
  id: h,
1548
1549
  type: "text",
1549
- className: W.multiSearch,
1550
- placeholder: D.length === 0 ? r : "",
1551
- value: U,
1552
- onChange: (b) => {
1553
- C(b.target.value), j || pe();
1550
+ className: P.multiSearch,
1551
+ placeholder: W.length === 0 ? r : "",
1552
+ value: T,
1553
+ onChange: (k) => {
1554
+ $(k.target.value), D || K();
1554
1555
  },
1555
- onKeyDown: J,
1556
+ onKeyDown: Y,
1556
1557
  disabled: a,
1557
1558
  "aria-label": "Search options"
1558
1559
  }
1559
1560
  ),
1560
- /* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowMulti, o?.arrow) })
1561
+ /* @__PURE__ */ s("span", { className: m(P.arrow, P.arrowMulti, o?.arrow) })
1561
1562
  ]
1562
1563
  }
1563
1564
  ),
1564
- j && (() => {
1565
- const b = S ? {
1565
+ D && (() => {
1566
+ const k = w ? {
1566
1567
  position: "fixed",
1567
- top: O.top + 4,
1568
- left: O.left,
1568
+ top: C.top + 4,
1569
+ left: C.left,
1569
1570
  right: "auto",
1570
- width: O.width,
1571
+ width: C.width,
1571
1572
  zIndex: "var(--crk-z-floating)"
1572
- } : void 0, E = /* @__PURE__ */ s(
1573
+ } : void 0, G = /* @__PURE__ */ s(
1573
1574
  "div",
1574
1575
  {
1575
- id: H,
1576
- ref: ae,
1577
- className: m(W.menu, o?.menu),
1578
- style: b,
1576
+ id: j,
1577
+ ref: S,
1578
+ className: m(P.menu, o?.menu),
1579
+ style: k,
1579
1580
  role: "listbox",
1580
1581
  "aria-multiselectable": "true",
1581
- children: /* @__PURE__ */ z("div", { className: W.menuItems, ref: R, children: [
1582
- M.length === 0 && !k && /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }),
1583
- M.map((V, de) => {
1584
- const he = D.includes(V.value);
1582
+ children: /* @__PURE__ */ z("div", { className: P.menuItems, ref: re, children: [
1583
+ y.length === 0 && !A && /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }),
1584
+ y.map((O, de) => {
1585
+ const ge = W.includes(O.value);
1585
1586
  return /* @__PURE__ */ z(
1586
1587
  "button",
1587
1588
  {
1588
- id: `select-option-${V.value}`,
1589
+ id: `select-option-${O.value}`,
1589
1590
  type: "button",
1590
1591
  role: "option",
1591
- "aria-selected": he,
1592
+ "aria-selected": ge,
1592
1593
  className: m(
1593
- W.item,
1594
- V.disabled && W.itemDisabled,
1595
- he && W.itemSelected,
1596
- de === $ && W.itemHighlighted,
1594
+ P.item,
1595
+ O.disabled && P.itemDisabled,
1596
+ ge && P.itemSelected,
1597
+ de === ie && P.itemHighlighted,
1597
1598
  o?.item
1598
1599
  ),
1599
- disabled: V.disabled,
1600
- onClick: () => K(V.value),
1601
- onMouseEnter: () => oe(de),
1600
+ disabled: O.disabled,
1601
+ onClick: () => H(O.value),
1602
+ onMouseEnter: () => ne(de),
1602
1603
  children: [
1603
- he && /* @__PURE__ */ s("span", { className: W.itemCheck, "aria-hidden": "true" }),
1604
- V.content ?? V.label
1604
+ ge && /* @__PURE__ */ s("span", { className: P.itemCheck, "aria-hidden": "true" }),
1605
+ O.content ?? O.label
1605
1606
  ]
1606
1607
  },
1607
- V.value
1608
+ O.value
1608
1609
  );
1609
1610
  }),
1610
- k && /* @__PURE__ */ s(
1611
+ A && /* @__PURE__ */ s(
1611
1612
  "button",
1612
1613
  {
1613
1614
  type: "button",
1614
1615
  role: "option",
1615
1616
  "aria-selected": !1,
1616
1617
  className: m(
1617
- W.item,
1618
- $ === _ && W.itemHighlighted,
1618
+ P.item,
1619
+ ie === q && P.itemHighlighted,
1619
1620
  o?.item
1620
1621
  ),
1621
- onClick: B,
1622
- onMouseEnter: () => oe(_),
1623
- children: v ? v(g) : /* @__PURE__ */ z(je, { children: [
1622
+ onClick: _,
1623
+ onMouseEnter: () => ne(q),
1624
+ children: R ? R(v) : /* @__PURE__ */ z(ze, { children: [
1624
1625
  "Create “",
1625
- /* @__PURE__ */ s("strong", { children: g }),
1626
+ /* @__PURE__ */ s("strong", { children: v }),
1626
1627
  "”"
1627
1628
  ] })
1628
1629
  },
@@ -1631,7 +1632,7 @@ const en = $e(
1631
1632
  ] })
1632
1633
  }
1633
1634
  );
1634
- return S && typeof document < "u" ? pt(E, document.body) : E;
1635
+ return w && typeof document < "u" ? pt(G, document.body) : G;
1635
1636
  })()
1636
1637
  ]
1637
1638
  }
@@ -1639,7 +1640,7 @@ const en = $e(
1639
1640
  }
1640
1641
  );
1641
1642
  en.displayName = "MultiSelect";
1642
- const Pi = $e(
1643
+ const Pi = Ne(
1643
1644
  (e, t) => e.multiple ? /* @__PURE__ */ s(en, { ref: t, ...e }) : e.searchable ? /* @__PURE__ */ s(Jt, { ref: t, ...e }) : /* @__PURE__ */ s(Qt, { ref: t, ...e })
1644
1645
  );
1645
1646
  Pi.displayName = "Select";
@@ -1648,7 +1649,7 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1648
1649
  input: Hi,
1649
1650
  label: Oi,
1650
1651
  indeterminate: Fi
1651
- }, zi = $e(
1652
+ }, Xi = Ne(
1652
1653
  ({
1653
1654
  label: e,
1654
1655
  indeterminate: t = !1,
@@ -1657,8 +1658,8 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1657
1658
  style: o,
1658
1659
  ...c
1659
1660
  }, i) => {
1660
- const l = re(null);
1661
- return Ne(() => {
1661
+ const l = oe(null);
1662
+ return Le(() => {
1662
1663
  l.current && (l.current.indeterminate = t);
1663
1664
  }, [t]), /* @__PURE__ */ z(
1664
1665
  "label",
@@ -1683,13 +1684,13 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1683
1684
  );
1684
1685
  }
1685
1686
  );
1686
- zi.displayName = "Checkbox";
1687
- const ji = "crk-group-NNwCD", Xi = "crk-root-7fGik", _i = "crk-input-43PQW", Ui = "crk-label-aW30x", ht = {
1688
- group: ji,
1689
- root: Xi,
1687
+ Xi.displayName = "Checkbox";
1688
+ const zi = "crk-group-NNwCD", ji = "crk-root-7fGik", _i = "crk-input-43PQW", Yi = "crk-label-aW30x", ht = {
1689
+ group: zi,
1690
+ root: ji,
1690
1691
  input: _i,
1691
- label: Ui
1692
- }, tn = _t(null), Yi = ({
1692
+ label: Yi
1693
+ }, tn = _t(null), Ui = ({
1693
1694
  name: e,
1694
1695
  value: t,
1695
1696
  onChange: n,
@@ -1714,8 +1715,8 @@ const ji = "crk-group-NNwCD", Xi = "crk-root-7fGik", _i = "crk-input-43PQW", Ui
1714
1715
  children: c
1715
1716
  }
1716
1717
  ) });
1717
- Yi.displayName = "RadioGroup";
1718
- const Vi = $e(
1718
+ Ui.displayName = "RadioGroup";
1719
+ const Vi = Ne(
1719
1720
  ({
1720
1721
  label: e,
1721
1722
  value: t,
@@ -1727,7 +1728,7 @@ const Vi = $e(
1727
1728
  name: l,
1728
1729
  ...a
1729
1730
  }, h) => {
1730
- const u = ft(tn), d = u?.name ?? l, f = u ? u.value === t : i, y = (L) => {
1731
+ const u = ft(tn), d = u?.name ?? l, f = u ? u.value === t : i, p = (L) => {
1731
1732
  u?.onChange?.(t), c?.(L);
1732
1733
  };
1733
1734
  return /* @__PURE__ */ z("label", { className: m(ht.root, n?.root, r), style: o, children: [
@@ -1740,7 +1741,7 @@ const Vi = $e(
1740
1741
  name: d,
1741
1742
  value: t,
1742
1743
  checked: f,
1743
- onChange: y,
1744
+ onChange: p,
1744
1745
  ...a
1745
1746
  }
1746
1747
  ),
@@ -1765,7 +1766,7 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1765
1766
  vertical: "resizeVertical",
1766
1767
  horizontal: "resizeHorizontal",
1767
1768
  both: "resizeBoth"
1768
- }, ic = $e(
1769
+ }, ic = Ne(
1769
1770
  ({
1770
1771
  inputSize: e = "md",
1771
1772
  error: t = !1,
@@ -1776,24 +1777,24 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1776
1777
  onChange: i,
1777
1778
  ...l
1778
1779
  }, a) => {
1779
- const h = re(null), u = fe(() => {
1780
- const y = h.current;
1781
- y && (y.style.height = "auto", y.style.height = `${y.scrollHeight}px`);
1780
+ const h = oe(null), u = pe(() => {
1781
+ const p = h.current;
1782
+ p && (p.style.height = "auto", p.style.height = `${p.scrollHeight}px`);
1782
1783
  }, []), d = l.value ?? "";
1783
- Ne(() => {
1784
+ Le(() => {
1784
1785
  r && u();
1785
1786
  }, [r, u, d]);
1786
- const f = fe(
1787
- (y) => {
1788
- r && u(), i?.(y);
1787
+ const f = pe(
1788
+ (p) => {
1789
+ r && u(), i?.(p);
1789
1790
  },
1790
1791
  [r, u, i]
1791
1792
  );
1792
1793
  return /* @__PURE__ */ s(
1793
1794
  "textarea",
1794
1795
  {
1795
- ref: (y) => {
1796
- h.current = y, typeof a == "function" ? a(y) : a && (a.current = y);
1796
+ ref: (p) => {
1797
+ h.current = p, typeof a == "function" ? a(p) : a && (a.current = p);
1797
1798
  },
1798
1799
  className: m(
1799
1800
  Ke.root,
@@ -1812,8 +1813,8 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1812
1813
  );
1813
1814
  ic.displayName = "Textarea";
1814
1815
  function cc(e, t = { width: 600, height: 300 }) {
1815
- const [n, r] = Le(t), o = re(t);
1816
- return Ne(() => {
1816
+ const [n, r] = Re(t), o = oe(t);
1817
+ return Le(() => {
1817
1818
  const c = e.current;
1818
1819
  if (!c || typeof ResizeObserver > "u") return;
1819
1820
  const i = (h, u) => {
@@ -1830,7 +1831,7 @@ function cc(e, t = { width: 600, height: 300 }) {
1830
1831
  return a.observe(c), () => a.disconnect();
1831
1832
  }, [e]), n;
1832
1833
  }
1833
- const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc = "crk-gridLine-K2Gx9", uc = "crk-axis-Zum8-", hc = "crk-axisLabel-Ilv3u", mc = "crk-cursorLine-iNHim", fc = "crk-linePath-E4eYA", pc = "crk-areaPath-ZwMc6", gc = "crk-point-DTAoa", yc = "crk-bar-9sYbq", vc = "crk-barLabelInside-dlQh5", bc = "crk-activeBar-FJhPJ", xc = "crk-interactionLayer-dHNAG", kc = "crk-legend-JL6YI", Mc = "crk-legendItem-rcdvO", wc = "crk-legendSwatch-eJBsF", $c = "crk-legendIcon-6gzcO", Nc = "crk-legendLabel-C-eu3", Lc = "crk-tooltip-m55-N", Sc = "crk-tooltipTitle-0EfoX", Rc = "crk-tooltipRows-MC0wM", Tc = "crk-tooltipRow-ZQomr", Cc = "crk-tooltipLabel-s4OKX", Ac = "crk-tooltipValue-iwj1s", Bc = "crk-empty-aa4vk", Ic = "crk-sparkline-3-eRc", Dc = "crk-tradingHeader-Pb9wS", w = {
1834
+ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc = "crk-gridLine-K2Gx9", uc = "crk-axis-Zum8-", hc = "crk-axisLabel-Ilv3u", mc = "crk-cursorLine-iNHim", fc = "crk-linePath-E4eYA", pc = "crk-areaPath-ZwMc6", gc = "crk-point-DTAoa", yc = "crk-bar-9sYbq", vc = "crk-barLabelInside-dlQh5", bc = "crk-activeBar-FJhPJ", xc = "crk-interactionLayer-dHNAG", kc = "crk-legend-JL6YI", Mc = "crk-legendItem-rcdvO", wc = "crk-legendSwatch-eJBsF", $c = "crk-legendIcon-6gzcO", Nc = "crk-legendLabel-C-eu3", Lc = "crk-tooltip-m55-N", Rc = "crk-tooltipTitle-0EfoX", Sc = "crk-tooltipRows-MC0wM", Tc = "crk-tooltipRow-ZQomr", Cc = "crk-tooltipLabel-s4OKX", Ac = "crk-tooltipValue-iwj1s", Bc = "crk-empty-aa4vk", Ic = "crk-sparkline-3-eRc", Dc = "crk-tradingHeader-Pb9wS", M = {
1834
1835
  root: lc,
1835
1836
  canvas: sc,
1836
1837
  svg: ac,
@@ -1851,31 +1852,31 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1851
1852
  legendIcon: $c,
1852
1853
  legendLabel: Nc,
1853
1854
  tooltip: Lc,
1854
- tooltipTitle: Sc,
1855
- tooltipRows: Rc,
1855
+ tooltipTitle: Rc,
1856
+ tooltipRows: Sc,
1856
1857
  tooltipRow: Tc,
1857
1858
  tooltipLabel: Cc,
1858
1859
  tooltipValue: Ac,
1859
1860
  empty: Bc,
1860
1861
  sparkline: Ic,
1861
1862
  tradingHeader: Dc
1862
- }, Ve = $e(
1863
+ }, Ve = Ne(
1863
1864
  ({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: c, overlay: i, children: l }, a) => {
1864
- const h = re(null);
1865
+ const h = oe(null);
1865
1866
  un(a, () => h.current);
1866
1867
  const { width: u } = cc(h), d = Math.max(0, u), f = t ?? Math.round(d / e);
1867
1868
  return /* @__PURE__ */ z(
1868
1869
  "div",
1869
1870
  {
1870
1871
  ref: h,
1871
- className: m(w.root, o?.root, n),
1872
+ className: m(M.root, o?.root, n),
1872
1873
  style: r,
1873
1874
  children: [
1874
- /* @__PURE__ */ z("div", { className: w.canvas, style: { height: f || void 0 }, children: [
1875
+ /* @__PURE__ */ z("div", { className: M.canvas, style: { height: f || void 0 }, children: [
1875
1876
  d > 0 && f > 0 && /* @__PURE__ */ s(
1876
1877
  "svg",
1877
1878
  {
1878
- className: m(w.svg, o?.svg),
1879
+ className: m(M.svg, o?.svg),
1879
1880
  width: d,
1880
1881
  height: f,
1881
1882
  viewBox: `0 0 ${d} ${f}`,
@@ -1894,13 +1895,13 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1894
1895
  Ve.displayName = "ChartContainer";
1895
1896
  function vt({ config: e, order: t, classes: n }) {
1896
1897
  const r = t ?? Object.keys(e);
1897
- return /* @__PURE__ */ s("div", { className: m(w.legend, n?.legend), role: "list", children: r.map((o) => {
1898
+ return /* @__PURE__ */ s("div", { className: m(M.legend, n?.legend), role: "list", children: r.map((o) => {
1898
1899
  const c = e[o];
1899
- return c ? /* @__PURE__ */ z("div", { className: m(w.legendItem, n?.legendItem), role: "listitem", children: [
1900
+ return c ? /* @__PURE__ */ z("div", { className: m(M.legendItem, n?.legendItem), role: "listitem", children: [
1900
1901
  c.icon ? /* @__PURE__ */ s(
1901
1902
  "span",
1902
1903
  {
1903
- className: w.legendIcon,
1904
+ className: M.legendIcon,
1904
1905
  style: { color: c.color },
1905
1906
  "aria-hidden": "true",
1906
1907
  children: c.icon
@@ -1908,12 +1909,12 @@ function vt({ config: e, order: t, classes: n }) {
1908
1909
  ) : /* @__PURE__ */ s(
1909
1910
  "span",
1910
1911
  {
1911
- className: w.legendSwatch,
1912
+ className: M.legendSwatch,
1912
1913
  style: { background: c.color },
1913
1914
  "aria-hidden": "true"
1914
1915
  }
1915
1916
  ),
1916
- /* @__PURE__ */ s("span", { className: w.legendLabel, children: c.label })
1917
+ /* @__PURE__ */ s("span", { className: M.legendLabel, children: c.label })
1917
1918
  ] }, o) : null;
1918
1919
  }) });
1919
1920
  }
@@ -1930,23 +1931,23 @@ function et({
1930
1931
  classes: h
1931
1932
  }) {
1932
1933
  if (!e) return null;
1933
- const u = 180, f = t + u + 16 > r ? t - u - 12 : t + 12, y = Math.max(8, n - 16);
1934
+ const u = 180, f = t + u + 16 > r ? t - u - 12 : t + 12, p = Math.max(8, n - 16);
1934
1935
  return /* @__PURE__ */ s(
1935
1936
  "div",
1936
1937
  {
1937
- className: m(w.tooltip, h?.tooltip),
1938
- style: { left: f, top: y, width: u },
1938
+ className: m(M.tooltip, h?.tooltip),
1939
+ style: { left: f, top: p, width: u },
1939
1940
  role: "tooltip",
1940
- children: c ? c(e) : /* @__PURE__ */ z(je, { children: [
1941
- l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: w.tooltipTitle, children: String(e[l]) }),
1942
- /* @__PURE__ */ s("div", { className: w.tooltipRows, children: Object.entries(o).map(([L, v]) => {
1943
- const S = e[L];
1944
- if (S == null) return null;
1945
- const N = typeof S == "number" ? i(S) : String(S), D = a?.(L) ?? v.color;
1946
- return /* @__PURE__ */ z("div", { className: w.tooltipRow, children: [
1947
- /* @__PURE__ */ s("span", { className: w.legendSwatch, style: { background: D }, "aria-hidden": "true" }),
1948
- /* @__PURE__ */ s("span", { className: w.tooltipLabel, children: v.label }),
1949
- /* @__PURE__ */ s("span", { className: w.tooltipValue, children: N })
1941
+ children: c ? c(e) : /* @__PURE__ */ z(ze, { children: [
1942
+ l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: M.tooltipTitle, children: String(e[l]) }),
1943
+ /* @__PURE__ */ s("div", { className: M.tooltipRows, children: Object.entries(o).map(([L, b]) => {
1944
+ const R = e[L];
1945
+ if (R == null) return null;
1946
+ const w = typeof R == "number" ? i(R) : String(R), Q = a?.(L) ?? b.color;
1947
+ return /* @__PURE__ */ z("div", { className: M.tooltipRow, children: [
1948
+ /* @__PURE__ */ s("span", { className: M.legendSwatch, style: { background: Q }, "aria-hidden": "true" }),
1949
+ /* @__PURE__ */ s("span", { className: M.tooltipLabel, children: b.label }),
1950
+ /* @__PURE__ */ s("span", { className: M.tooltipValue, children: w })
1950
1951
  ] }, L);
1951
1952
  }) })
1952
1953
  ] })
@@ -1954,11 +1955,11 @@ function et({
1954
1955
  );
1955
1956
  }
1956
1957
  function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: c }) {
1957
- return /* @__PURE__ */ s("g", { className: m(w.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ z("g", { children: [
1958
+ return /* @__PURE__ */ s("g", { className: m(M.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ z("g", { children: [
1958
1959
  o && /* @__PURE__ */ s(
1959
1960
  "line",
1960
1961
  {
1961
- className: m(w.gridLine, c?.grid),
1962
+ className: m(M.gridLine, c?.grid),
1962
1963
  x1: t,
1963
1964
  x2: t + n,
1964
1965
  y1: l,
@@ -1968,7 +1969,7 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1968
1969
  /* @__PURE__ */ s(
1969
1970
  "text",
1970
1971
  {
1971
- className: m(w.axisLabel, c?.axisLabel),
1972
+ className: m(M.axisLabel, c?.axisLabel),
1972
1973
  x: t - 8,
1973
1974
  y: l,
1974
1975
  textAnchor: "end",
@@ -1979,10 +1980,10 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1979
1980
  ] }, `y-${i}`)) });
1980
1981
  }
1981
1982
  function rn({ ticks: e, y: t, format: n, classes: r }) {
1982
- return /* @__PURE__ */ s("g", { className: m(w.axis, r?.axis), children: e.map(({ label: o, x: c }) => /* @__PURE__ */ s(
1983
+ return /* @__PURE__ */ s("g", { className: m(M.axis, r?.axis), children: e.map(({ label: o, x: c }) => /* @__PURE__ */ s(
1983
1984
  "text",
1984
1985
  {
1985
- className: m(w.axisLabel, r?.axisLabel),
1986
+ className: m(M.axisLabel, r?.axisLabel),
1986
1987
  x: c,
1987
1988
  y: t + 16,
1988
1989
  textAnchor: "middle",
@@ -2004,7 +2005,7 @@ function Je(e, t) {
2004
2005
  const [n, r] = e, [o, c] = t, i = r - n || 1, l = c - o, a = (h) => o + (h - n) / i * l;
2005
2006
  return a.invert = (h) => n + (h - o) / l * i, a;
2006
2007
  }
2007
- function Xe(e, t, n = 0.2) {
2008
+ function je(e, t, n = 0.2) {
2008
2009
  const [r, o] = t, i = (o - r) / Math.max(1, e.length), l = i * (1 - n), a = /* @__PURE__ */ new Map();
2009
2010
  for (let u = 0; u < e.length; u++) a.set(e[u], u);
2010
2011
  const h = (u) => {
@@ -2062,179 +2063,179 @@ function Ol({
2062
2063
  valuePosition: u = "top",
2063
2064
  renderLabel: d,
2064
2065
  activeIndex: f,
2065
- onPointClick: y,
2066
+ onPointClick: p,
2066
2067
  showGrid: L = !0,
2067
- showLegend: v = !0,
2068
- showTooltip: S = !0,
2069
- yTickCount: N = 5,
2070
- yFormat: D,
2071
- xFormat: j,
2072
- valueFormat: Z,
2073
- renderTooltip: U,
2074
- margin: C,
2068
+ showLegend: b = !0,
2069
+ showTooltip: R = !0,
2070
+ yTickCount: w = 5,
2071
+ yFormat: Q,
2072
+ xFormat: W,
2073
+ valueFormat: D,
2074
+ renderTooltip: Z,
2075
+ margin: T,
2075
2076
  emptyMessage: $ = "No data",
2076
- className: oe,
2077
- style: ce,
2078
- classes: q
2077
+ className: ie,
2078
+ style: ne,
2079
+ classes: V
2079
2080
  }) {
2080
- const ae = { ...Ec, ...C }, R = ke(() => Object.keys(n), [n]), [te, H] = Le(null), O = re(null), A = f ?? te, F = (pe, K) => {
2081
+ const ue = { ...Ec, ...T }, S = ke(() => Object.keys(n), [n]), [re, F] = Re(null), j = oe(null), C = f ?? re, X = (me, K) => {
2081
2082
  if (l) {
2082
- const X = e[K]?.[l];
2083
- if (typeof X == "string") return X;
2083
+ const H = e[K]?.[l];
2084
+ if (typeof H == "string") return H;
2084
2085
  }
2085
- return n[pe]?.color ?? "var(--crk-chart-1)";
2086
+ return n[me]?.color ?? "var(--crk-chart-1)";
2086
2087
  };
2087
2088
  if (e.length === 0)
2088
- return /* @__PURE__ */ s("div", { ref: O, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
2089
- const ne = S && A !== null ? /* @__PURE__ */ s(
2089
+ return /* @__PURE__ */ s("div", { ref: j, className: m(M.root, V?.root, ie), style: ne, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: $ }) }) });
2090
+ const se = R && C !== null ? /* @__PURE__ */ s(
2090
2091
  et,
2091
2092
  {
2092
- row: e[A],
2093
- x: Hc(e, t, ae, A, O),
2093
+ row: e[C],
2094
+ x: Hc(e, t, ue, C, j),
2094
2095
  y: 16,
2095
- containerWidth: O.current?.getBoundingClientRect().width ?? 0,
2096
+ containerWidth: j.current?.getBoundingClientRect().width ?? 0,
2096
2097
  config: n,
2097
- render: U ? () => U(e[A]) : void 0,
2098
- valueFormat: Z,
2098
+ render: Z ? () => Z(e[C]) : void 0,
2099
+ valueFormat: D,
2099
2100
  titleKey: t,
2100
- resolveColor: l ? (pe) => F(pe, A) : void 0,
2101
- classes: q
2101
+ resolveColor: l ? (me) => X(me, C) : void 0,
2102
+ classes: V
2102
2103
  }
2103
2104
  ) : null;
2104
2105
  return /* @__PURE__ */ s(
2105
2106
  Ve,
2106
2107
  {
2107
- ref: O,
2108
+ ref: j,
2108
2109
  aspectRatio: r,
2109
2110
  height: o,
2110
- className: oe,
2111
- style: ce,
2112
- classes: q,
2113
- legend: v ? /* @__PURE__ */ s(vt, { config: n, classes: q }) : void 0,
2114
- overlay: ne,
2115
- children: ({ width: pe, height: K }) => {
2116
- const X = ae.left, M = pe - ae.right, g = ae.top, k = K - ae.bottom, B = Math.max(0, M - X), _ = Math.max(0, k - g), J = e.map((p) => String(p[t])), Y = Xe(J, [X, M], 0), b = [];
2117
- for (const p of R)
2111
+ className: ie,
2112
+ style: ne,
2113
+ classes: V,
2114
+ legend: b ? /* @__PURE__ */ s(vt, { config: n, classes: V }) : void 0,
2115
+ overlay: se,
2116
+ children: ({ width: me, height: K }) => {
2117
+ const H = ue.left, N = me - ue.right, y = ue.top, v = K - ue.bottom, A = Math.max(0, N - H), _ = Math.max(0, v - y), q = e.map((g) => String(g[t])), Y = je(q, [H, N], 0), J = [];
2118
+ for (const g of S)
2118
2119
  for (const x of e) {
2119
- const ee = x[p];
2120
- typeof ee == "number" && b.push(ee);
2120
+ const ee = x[g];
2121
+ typeof ee == "number" && J.push(ee);
2121
2122
  }
2122
- const [E, V] = bt(b), de = Math.min(0, E), he = qe(de, V, N), ye = Je([he[0], he[he.length - 1]], [k, g]), be = he.map((p) => ({ value: p, y: ye(p) })), Se = Wc(J).map((p) => ({ label: p, x: Y(p) }));
2123
- return /* @__PURE__ */ z(je, { children: [
2123
+ const [k, G] = bt(J), O = Math.min(0, k), de = qe(O, G, w), ge = Je([de[0], de[de.length - 1]], [v, y]), be = de.map((g) => ({ value: g, y: ge(g) })), Se = Wc(q).map((g) => ({ label: g, x: Y(g) }));
2124
+ return /* @__PURE__ */ z(ze, { children: [
2124
2125
  /* @__PURE__ */ s(
2125
2126
  nn,
2126
2127
  {
2127
2128
  ticks: be,
2128
- x: X,
2129
- plotWidth: B,
2130
- format: D,
2129
+ x: H,
2130
+ plotWidth: A,
2131
+ format: Q,
2131
2132
  showGrid: L,
2132
- classes: q
2133
+ classes: V
2133
2134
  }
2134
2135
  ),
2135
- /* @__PURE__ */ s(rn, { ticks: Se, y: k, format: j, classes: q }),
2136
- R.map((p) => {
2137
- const x = n[p], ee = e.map((P, G) => {
2138
- const I = P[p], me = typeof I == "number" ? I : 0;
2139
- return { x: Y(J[G]), y: ye(me), value: me, row: P };
2136
+ /* @__PURE__ */ s(rn, { ticks: Se, y: v, format: W, classes: V }),
2137
+ S.map((g) => {
2138
+ const x = n[g], ee = e.map((E, U) => {
2139
+ const I = E[g], fe = typeof I == "number" ? I : 0;
2140
+ return { x: Y(q[U]), y: ge(fe), value: fe, row: E };
2140
2141
  });
2141
- return /* @__PURE__ */ z("g", { className: m(w.series, q?.series), children: [
2142
+ return /* @__PURE__ */ z("g", { className: m(M.series, V?.series), children: [
2142
2143
  /* @__PURE__ */ s(
2143
2144
  "path",
2144
2145
  {
2145
- className: m(w.linePath),
2146
+ className: m(M.linePath),
2146
2147
  d: Pc(ee, c),
2147
2148
  stroke: x.color
2148
2149
  }
2149
2150
  ),
2150
- i && ee.map((P, G) => {
2151
- const I = F(p, G), me = A === G, Q = f !== void 0 && !me, T = y ? () => y({ row: P.row, value: P.value, seriesKey: p, index: G }) : void 0;
2151
+ i && ee.map((E, U) => {
2152
+ const I = X(g, U), fe = C === U, ce = f !== void 0 && !fe, B = p ? () => p({ row: E.row, value: E.value, seriesKey: g, index: U }) : void 0;
2152
2153
  return a ? /* @__PURE__ */ s(
2153
2154
  "g",
2154
2155
  {
2155
- onClick: T,
2156
- style: T ? { cursor: "pointer" } : void 0,
2157
- opacity: Q ? 0.45 : 1,
2156
+ onClick: B,
2157
+ style: B ? { cursor: "pointer" } : void 0,
2158
+ opacity: ce ? 0.45 : 1,
2158
2159
  children: a({
2159
- row: P.row,
2160
- value: P.value,
2161
- seriesKey: p,
2162
- index: G,
2163
- x: P.x,
2164
- y: P.y,
2160
+ row: E.row,
2161
+ value: E.value,
2162
+ seriesKey: g,
2163
+ index: U,
2164
+ x: E.x,
2165
+ y: E.y,
2165
2166
  color: I,
2166
- active: me
2167
+ active: fe
2167
2168
  })
2168
2169
  },
2169
- `${p}-${G}`
2170
+ `${g}-${U}`
2170
2171
  ) : /* @__PURE__ */ s(
2171
2172
  "circle",
2172
2173
  {
2173
- className: m(w.point, q?.point),
2174
- cx: P.x,
2175
- cy: P.y,
2176
- r: me ? 5 : 3.5,
2174
+ className: m(M.point, V?.point),
2175
+ cx: E.x,
2176
+ cy: E.y,
2177
+ r: fe ? 5 : 3.5,
2177
2178
  fill: I,
2178
- onClick: T,
2179
- style: T ? { cursor: "pointer" } : void 0,
2180
- opacity: Q ? 0.45 : 1
2179
+ onClick: B,
2180
+ style: B ? { cursor: "pointer" } : void 0,
2181
+ opacity: ce ? 0.45 : 1
2181
2182
  },
2182
- `${p}-${G}`
2183
+ `${g}-${U}`
2183
2184
  );
2184
2185
  }),
2185
- (h || d) && ee.map((P, G) => {
2186
- const I = d ? d({ row: P.row, value: P.value, seriesKey: p, index: G }) : h ? Z ? Z(P.value) : String(P.value) : null;
2186
+ (h || d) && ee.map((E, U) => {
2187
+ const I = d ? d({ row: E.row, value: E.value, seriesKey: g, index: U }) : h ? D ? D(E.value) : String(E.value) : null;
2187
2188
  if (I == null) return null;
2188
- const me = 10, Q = u === "top" ? P.y - me : P.y + me + 4;
2189
+ const fe = 10, ce = u === "top" ? E.y - fe : E.y + fe + 4;
2189
2190
  return /* @__PURE__ */ s(
2190
2191
  "text",
2191
2192
  {
2192
- className: m(w.axisLabel),
2193
- x: P.x,
2194
- y: Q,
2193
+ className: m(M.axisLabel),
2194
+ x: E.x,
2195
+ y: ce,
2195
2196
  textAnchor: "middle",
2196
2197
  dominantBaseline: u === "top" ? "auto" : "middle",
2197
2198
  children: I
2198
2199
  },
2199
- `label-${p}-${G}`
2200
+ `label-${g}-${U}`
2200
2201
  );
2201
2202
  })
2202
- ] }, p);
2203
+ ] }, g);
2203
2204
  }),
2204
- A !== null && /* @__PURE__ */ s(
2205
+ C !== null && /* @__PURE__ */ s(
2205
2206
  "line",
2206
2207
  {
2207
- className: w.cursorLine,
2208
- x1: Y(J[A]),
2209
- x2: Y(J[A]),
2210
- y1: g,
2211
- y2: k
2208
+ className: M.cursorLine,
2209
+ x1: Y(q[C]),
2210
+ x2: Y(q[C]),
2211
+ y1: y,
2212
+ y2: v
2212
2213
  }
2213
2214
  ),
2214
2215
  /* @__PURE__ */ s(
2215
2216
  "rect",
2216
2217
  {
2217
- className: w.interactionLayer,
2218
- x: X,
2219
- y: g,
2220
- width: B,
2218
+ className: M.interactionLayer,
2219
+ x: H,
2220
+ y,
2221
+ width: A,
2221
2222
  height: _,
2222
- onMouseMove: (p) => {
2223
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
2223
+ onMouseMove: (g) => {
2224
+ const x = g.currentTarget.getBoundingClientRect(), ee = g.clientX - x.left + H, E = Y.step(), U = Math.max(
2224
2225
  0,
2225
- Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
2226
+ Math.min(e.length - 1, Math.round((ee - H - E / 2) / E))
2226
2227
  );
2227
- H(G);
2228
+ F(U);
2228
2229
  },
2229
- onMouseLeave: () => H(null),
2230
- onClick: y ? (p) => {
2231
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
2230
+ onMouseLeave: () => F(null),
2231
+ onClick: p ? (g) => {
2232
+ const x = g.currentTarget.getBoundingClientRect(), ee = g.clientX - x.left + H, E = Y.step(), U = Math.max(
2232
2233
  0,
2233
- Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
2234
- ), I = R[0], me = e[G][I], Q = typeof me == "number" ? me : 0;
2235
- y({ row: e[G], value: Q, seriesKey: I, index: G });
2234
+ Math.min(e.length - 1, Math.round((ee - H - E / 2) / E))
2235
+ ), I = S[0], fe = e[U][I], ce = typeof fe == "number" ? fe : 0;
2236
+ p({ row: e[U], value: ce, seriesKey: I, index: U });
2236
2237
  } : void 0,
2237
- style: y ? { cursor: "pointer" } : void 0
2238
+ style: p ? { cursor: "pointer" } : void 0
2238
2239
  }
2239
2240
  )
2240
2241
  ] });
@@ -2246,10 +2247,10 @@ function Hc(e, t, n, r, o) {
2246
2247
  const c = o.current;
2247
2248
  if (!c) return 0;
2248
2249
  const i = c.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
2249
- return Xe(l, [n.left, i - n.right], 0)(l[r]);
2250
+ return je(l, [n.left, i - n.right], 0)(l[r]);
2250
2251
  }
2251
2252
  const Oc = { top: 12, right: 16, bottom: 28, left: 48 };
2252
- function St(e, t) {
2253
+ function Rt(e, t) {
2253
2254
  if (e.length === 0) return "";
2254
2255
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
2255
2256
  if (t === "linear")
@@ -2269,12 +2270,12 @@ function St(e, t) {
2269
2270
  }
2270
2271
  function Dt(e, t, n) {
2271
2272
  if (e.length === 0) return "";
2272
- const r = St(e, n);
2273
+ const r = Rt(e, n);
2273
2274
  if (typeof t == "number") {
2274
2275
  const l = e[e.length - 1], a = e[0];
2275
2276
  return `${r} L ${l.x} ${t} L ${a.x} ${t} Z`;
2276
2277
  }
2277
- const o = e.map((l, a) => ({ x: l.x, y: t[a] })).reverse(), i = St(o, n).replace(/^M /, "L ");
2278
+ const o = e.map((l, a) => ({ x: l.x, y: t[a] })).reverse(), i = Rt(o, n).replace(/^M /, "L ");
2278
2279
  return `${r} ${i} Z`;
2279
2280
  }
2280
2281
  function Fc(e, t = 8) {
@@ -2296,177 +2297,177 @@ function Fl({
2296
2297
  showXAxis: u = !0,
2297
2298
  showYAxis: d = !0,
2298
2299
  showLegend: f = !0,
2299
- showTooltip: y = !0,
2300
+ showTooltip: p = !0,
2300
2301
  yTickCount: L = 5,
2301
- yFormat: v,
2302
- xFormat: S,
2303
- valueFormat: N,
2304
- renderTooltip: D,
2305
- margin: j,
2306
- emptyMessage: Z = "No data",
2307
- className: U,
2308
- style: C,
2302
+ yFormat: b,
2303
+ xFormat: R,
2304
+ valueFormat: w,
2305
+ renderTooltip: Q,
2306
+ margin: W,
2307
+ emptyMessage: D = "No data",
2308
+ className: Z,
2309
+ style: T,
2309
2310
  classes: $
2310
2311
  }) {
2311
- const oe = ke(
2312
+ const ie = ke(
2312
2313
  () => ({
2313
2314
  ...Oc,
2314
2315
  ...d ? {} : { left: 16 },
2315
- ...j
2316
+ ...W
2316
2317
  }),
2317
- [j, d]
2318
- ), ce = ke(() => Object.keys(n), [n]), q = i && ce.length > 0, ae = q && l === "expand", [R, te] = Le(null), H = re(null), O = Ye();
2318
+ [W, d]
2319
+ ), ne = ke(() => Object.keys(n), [n]), V = i && ne.length > 0, ue = V && l === "expand", [S, re] = Re(null), F = oe(null), j = Ue();
2319
2320
  if (e.length === 0)
2320
- return /* @__PURE__ */ s("div", { ref: H, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
2321
- const A = ke(() => {
2322
- const X = ce.map(() => []), M = ce.map(() => []);
2323
- for (let g = 0; g < e.length; g++) {
2324
- let k = 0;
2325
- if (ae) {
2326
- for (const _ of ce) {
2327
- const J = e[g][_];
2328
- typeof J == "number" && J > 0 && (k += J);
2321
+ return /* @__PURE__ */ s("div", { ref: F, className: m(M.root, $?.root, Z), style: T, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: D }) }) });
2322
+ const C = ke(() => {
2323
+ const H = ne.map(() => []), N = ne.map(() => []);
2324
+ for (let y = 0; y < e.length; y++) {
2325
+ let v = 0;
2326
+ if (ue) {
2327
+ for (const _ of ne) {
2328
+ const q = e[y][_];
2329
+ typeof q == "number" && q > 0 && (v += q);
2329
2330
  }
2330
- k === 0 && (k = 1);
2331
+ v === 0 && (v = 1);
2331
2332
  }
2332
- let B = 0;
2333
- for (let _ = 0; _ < ce.length; _++) {
2334
- const J = ce[_], Y = e[g][J], b = typeof Y == "number" ? Y : 0;
2335
- if (q) {
2336
- const E = ae ? b / k : b;
2337
- M[_][g] = B, B += E, X[_][g] = B;
2333
+ let A = 0;
2334
+ for (let _ = 0; _ < ne.length; _++) {
2335
+ const q = ne[_], Y = e[y][q], J = typeof Y == "number" ? Y : 0;
2336
+ if (V) {
2337
+ const k = ue ? J / v : J;
2338
+ N[_][y] = A, A += k, H[_][y] = A;
2338
2339
  } else
2339
- M[_][g] = 0, X[_][g] = b;
2340
+ N[_][y] = 0, H[_][y] = J;
2340
2341
  }
2341
2342
  }
2342
- return { tops: X, bottoms: M };
2343
- }, [e, ce, q, ae]), { tops: F, bottoms: ne } = A, [pe, K] = ke(() => {
2344
- if (ae) return [0, 1];
2345
- let X = 0, M = 0;
2346
- for (const g of F)
2347
- for (const k of g)
2348
- k < X && (X = k), k > M && (M = k);
2349
- for (const g of ne)
2350
- for (const k of g)
2351
- k < X && (X = k);
2352
- return [Math.min(0, X), M];
2353
- }, [F, ne, ae]);
2343
+ return { tops: H, bottoms: N };
2344
+ }, [e, ne, V, ue]), { tops: X, bottoms: se } = C, [me, K] = ke(() => {
2345
+ if (ue) return [0, 1];
2346
+ let H = 0, N = 0;
2347
+ for (const y of X)
2348
+ for (const v of y)
2349
+ v < H && (H = v), v > N && (N = v);
2350
+ for (const y of se)
2351
+ for (const v of y)
2352
+ v < H && (H = v);
2353
+ return [Math.min(0, H), N];
2354
+ }, [X, se, ue]);
2354
2355
  return /* @__PURE__ */ s(
2355
2356
  Ve,
2356
2357
  {
2357
- ref: H,
2358
+ ref: F,
2358
2359
  aspectRatio: r,
2359
2360
  height: o,
2360
- className: U,
2361
- style: C,
2361
+ className: Z,
2362
+ style: T,
2362
2363
  classes: $,
2363
2364
  legend: f ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
2364
- overlay: y && R !== null ? /* @__PURE__ */ s(
2365
+ overlay: p && S !== null ? /* @__PURE__ */ s(
2365
2366
  et,
2366
2367
  {
2367
- row: e[R],
2368
- x: zc(e, t, oe, R, H),
2368
+ row: e[S],
2369
+ x: Xc(e, t, ie, S, F),
2369
2370
  y: 16,
2370
- containerWidth: H.current?.getBoundingClientRect().width ?? 0,
2371
+ containerWidth: F.current?.getBoundingClientRect().width ?? 0,
2371
2372
  config: n,
2372
- render: D ? () => D(e[R]) : void 0,
2373
- valueFormat: ae ? (X) => `${Math.round(X * 100)}%` : N,
2373
+ render: Q ? () => Q(e[S]) : void 0,
2374
+ valueFormat: ue ? (H) => `${Math.round(H * 100)}%` : w,
2374
2375
  titleKey: t,
2375
2376
  classes: $
2376
2377
  }
2377
2378
  ) : null,
2378
- children: ({ width: X, height: M }) => {
2379
- const g = oe.left, k = X - oe.right, B = oe.top, _ = M - oe.bottom, J = Math.max(0, k - g), Y = Math.max(0, _ - B), b = e.map((p) => String(p[t])), E = Xe(b, [g, k], 0), V = ae ? [0, 0.25, 0.5, 0.75, 1] : qe(pe, K, L), de = Je([V[0], V[V.length - 1]], [_, B]), he = de(0), ye = V.map((p) => ({ value: p, y: de(p) })), Ce = Fc(b).map((p) => ({ label: p, x: E(p) })), Se = ae ? (p) => `${Math.round(p * 100)}%` : v;
2380
- return /* @__PURE__ */ z(je, { children: [
2381
- a && /* @__PURE__ */ s("defs", { children: ce.map((p) => /* @__PURE__ */ z(
2379
+ children: ({ width: H, height: N }) => {
2380
+ const y = ie.left, v = H - ie.right, A = ie.top, _ = N - ie.bottom, q = Math.max(0, v - y), Y = Math.max(0, _ - A), J = e.map((g) => String(g[t])), k = je(J, [y, v], 0), G = ue ? [0, 0.25, 0.5, 0.75, 1] : qe(me, K, L), O = Je([G[0], G[G.length - 1]], [_, A]), de = O(0), ge = G.map((g) => ({ value: g, y: O(g) })), Ce = Fc(J).map((g) => ({ label: g, x: k(g) })), Se = ue ? (g) => `${Math.round(g * 100)}%` : b;
2381
+ return /* @__PURE__ */ z(ze, { children: [
2382
+ a && /* @__PURE__ */ s("defs", { children: ne.map((g) => /* @__PURE__ */ z(
2382
2383
  "linearGradient",
2383
2384
  {
2384
- id: `${O}-${p}`,
2385
+ id: `${j}-${g}`,
2385
2386
  x1: "0",
2386
2387
  y1: "0",
2387
2388
  x2: "0",
2388
2389
  y2: "1",
2389
2390
  children: [
2390
- /* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[p].color, stopOpacity: 0.6 }),
2391
- /* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[p].color, stopOpacity: 0.05 })
2391
+ /* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[g].color, stopOpacity: 0.6 }),
2392
+ /* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[g].color, stopOpacity: 0.05 })
2392
2393
  ]
2393
2394
  },
2394
- p
2395
+ g
2395
2396
  )) }),
2396
2397
  d ? /* @__PURE__ */ s(
2397
2398
  nn,
2398
2399
  {
2399
- ticks: ye,
2400
- x: g,
2401
- plotWidth: J,
2400
+ ticks: ge,
2401
+ x: y,
2402
+ plotWidth: q,
2402
2403
  format: Se,
2403
2404
  showGrid: h,
2404
2405
  classes: $
2405
2406
  }
2406
- ) : h && /* @__PURE__ */ s("g", { className: m(w.axis, $?.axis), children: ye.map(({ value: p, y: x }) => /* @__PURE__ */ s(
2407
+ ) : h && /* @__PURE__ */ s("g", { className: m(M.axis, $?.axis), children: ge.map(({ value: g, y: x }) => /* @__PURE__ */ s(
2407
2408
  "line",
2408
2409
  {
2409
- className: m(w.gridLine, $?.grid),
2410
- x1: g,
2411
- x2: k,
2410
+ className: m(M.gridLine, $?.grid),
2411
+ x1: y,
2412
+ x2: v,
2412
2413
  y1: x,
2413
2414
  y2: x
2414
2415
  },
2415
- `grid-${p}`
2416
+ `grid-${g}`
2416
2417
  )) }),
2417
- u && /* @__PURE__ */ s(rn, { ticks: Ce, y: _, format: S, classes: $ }),
2418
- ce.map((p, x) => {
2419
- const ee = n[p], P = e.map((Q, T) => ({
2420
- x: E(b[T]),
2421
- y: de(F[x][T])
2422
- })), G = a ? `url(#${O}-${p})` : ee.color, I = a ? 1 : 0.18, me = q ? Dt(P, ne[x].map((Q) => de(Q)), c) : Dt(P, he, c);
2423
- return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
2418
+ u && /* @__PURE__ */ s(rn, { ticks: Ce, y: _, format: R, classes: $ }),
2419
+ ne.map((g, x) => {
2420
+ const ee = n[g], E = e.map((ce, B) => ({
2421
+ x: k(J[B]),
2422
+ y: O(X[x][B])
2423
+ })), U = a ? `url(#${j}-${g})` : ee.color, I = a ? 1 : 0.18, fe = V ? Dt(E, se[x].map((ce) => O(ce)), c) : Dt(E, de, c);
2424
+ return /* @__PURE__ */ z("g", { className: m(M.series, $?.series), children: [
2424
2425
  /* @__PURE__ */ s(
2425
2426
  "path",
2426
2427
  {
2427
- className: w.areaPath,
2428
- d: me,
2429
- fill: G,
2428
+ className: M.areaPath,
2429
+ d: fe,
2430
+ fill: U,
2430
2431
  fillOpacity: I
2431
2432
  }
2432
2433
  ),
2433
- /* @__PURE__ */ s("path", { className: w.linePath, d: St(P, c), stroke: ee.color }),
2434
- !q && P.map((Q, T) => /* @__PURE__ */ s(
2434
+ /* @__PURE__ */ s("path", { className: M.linePath, d: Rt(E, c), stroke: ee.color }),
2435
+ !V && E.map((ce, B) => /* @__PURE__ */ s(
2435
2436
  "circle",
2436
2437
  {
2437
- className: m(w.point, $?.point),
2438
- cx: Q.x,
2439
- cy: Q.y,
2440
- r: R === T ? 5 : 3,
2438
+ className: m(M.point, $?.point),
2439
+ cx: ce.x,
2440
+ cy: ce.y,
2441
+ r: S === B ? 5 : 3,
2441
2442
  fill: ee.color
2442
2443
  },
2443
- `${p}-${T}`
2444
+ `${g}-${B}`
2444
2445
  ))
2445
- ] }, p);
2446
+ ] }, g);
2446
2447
  }),
2447
- R !== null && /* @__PURE__ */ s(
2448
+ S !== null && /* @__PURE__ */ s(
2448
2449
  "line",
2449
2450
  {
2450
- className: w.cursorLine,
2451
- x1: E(b[R]),
2452
- x2: E(b[R]),
2453
- y1: B,
2451
+ className: M.cursorLine,
2452
+ x1: k(J[S]),
2453
+ x2: k(J[S]),
2454
+ y1: A,
2454
2455
  y2: _
2455
2456
  }
2456
2457
  ),
2457
2458
  /* @__PURE__ */ s(
2458
2459
  "rect",
2459
2460
  {
2460
- className: w.interactionLayer,
2461
- x: g,
2462
- y: B,
2463
- width: J,
2461
+ className: M.interactionLayer,
2462
+ x: y,
2463
+ y: A,
2464
+ width: q,
2464
2465
  height: Y,
2465
- onMouseMove: (p) => {
2466
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + g, P = E.step(), G = Math.max(0, Math.min(e.length - 1, Math.round((ee - g - P / 2) / P)));
2467
- te(G);
2466
+ onMouseMove: (g) => {
2467
+ const x = g.currentTarget.getBoundingClientRect(), ee = g.clientX - x.left + y, E = k.step(), U = Math.max(0, Math.min(e.length - 1, Math.round((ee - y - E / 2) / E)));
2468
+ re(U);
2468
2469
  },
2469
- onMouseLeave: () => te(null)
2470
+ onMouseLeave: () => re(null)
2470
2471
  }
2471
2472
  )
2472
2473
  ] });
@@ -2474,25 +2475,25 @@ function Fl({
2474
2475
  }
2475
2476
  );
2476
2477
  }
2477
- function zc(e, t, n, r, o) {
2478
+ function Xc(e, t, n, r, o) {
2478
2479
  const c = o.current;
2479
2480
  if (!c) return 0;
2480
2481
  const i = c.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
2481
- return Xe(l, [n.left, i - n.right], 0)(l[r]);
2482
+ return je(l, [n.left, i - n.right], 0)(l[r]);
2482
2483
  }
2483
- const jc = [
2484
+ const zc = [
2484
2485
  "var(--crk-chart-1)",
2485
2486
  "var(--crk-chart-2)",
2486
2487
  "var(--crk-chart-3)",
2487
2488
  "var(--crk-chart-4)",
2488
2489
  "var(--crk-chart-5)"
2489
- ], Xc = { top: 12, right: 16, bottom: 28, left: 48 }, _c = { top: 12, right: 16, bottom: 28, left: 72 };
2490
- function Uc(e, t = 8) {
2490
+ ], jc = { top: 12, right: 16, bottom: 28, left: 48 }, _c = { top: 12, right: 16, bottom: 28, left: 72 };
2491
+ function Yc(e, t = 8) {
2491
2492
  if (e.length <= t) return e;
2492
2493
  const n = Math.ceil(e.length / t);
2493
2494
  return e.filter((r, o) => o % n === 0);
2494
2495
  }
2495
- function zl({
2496
+ function Xl({
2496
2497
  data: e,
2497
2498
  xKey: t,
2498
2499
  config: n,
@@ -2506,177 +2507,177 @@ function zl({
2506
2507
  showGrid: u = !0,
2507
2508
  showLegend: d = !0,
2508
2509
  showTooltip: f = !0,
2509
- showValues: y = !1,
2510
+ showValues: p = !1,
2510
2511
  valuePosition: L = "outside",
2511
- renderLabel: v,
2512
- colorBy: S = "series",
2513
- colors: N = jc,
2514
- negativeColor: D,
2515
- activeIndex: j,
2516
- onBarClick: Z,
2517
- yTickCount: U = 5,
2518
- yFormat: C,
2512
+ renderLabel: b,
2513
+ colorBy: R = "series",
2514
+ colors: w = zc,
2515
+ negativeColor: Q,
2516
+ activeIndex: W,
2517
+ onBarClick: D,
2518
+ yTickCount: Z = 5,
2519
+ yFormat: T,
2519
2520
  xFormat: $,
2520
- valueFormat: oe,
2521
- renderTooltip: ce,
2522
- margin: q,
2523
- emptyMessage: ae = "No data",
2524
- className: R,
2525
- style: te,
2526
- classes: H
2521
+ valueFormat: ie,
2522
+ renderTooltip: ne,
2523
+ margin: V,
2524
+ emptyMessage: ue = "No data",
2525
+ className: S,
2526
+ style: re,
2527
+ classes: F
2527
2528
  }) {
2528
- const O = r === "horizontal", A = { ...O ? _c : Xc, ...q }, F = ke(() => Object.keys(n), [n]), ne = o && F.length > 1, [pe, K] = Le(null), X = re(null);
2529
+ const j = r === "horizontal", C = { ...j ? _c : jc, ...V }, X = ke(() => Object.keys(n), [n]), se = o && X.length > 1, [me, K] = Re(null), H = oe(null);
2529
2530
  if (e.length === 0)
2530
- return /* @__PURE__ */ s("div", { ref: X, className: m(w.root, H?.root, R), style: te, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: ae }) }) });
2531
- const M = e.map((E) => String(E[t])), g = j ?? pe, k = ke(() => {
2532
- if (ne) {
2533
- let he = 0, ye = 0;
2531
+ return /* @__PURE__ */ s("div", { ref: H, className: m(M.root, F?.root, S), style: re, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: ue }) }) });
2532
+ const N = e.map((k) => String(k[t])), y = W ?? me, v = ke(() => {
2533
+ if (se) {
2534
+ let de = 0, ge = 0;
2534
2535
  for (const be of e) {
2535
2536
  let Ce = 0, Se = 0;
2536
- for (const p of F) {
2537
- const x = be[p];
2537
+ for (const g of X) {
2538
+ const x = be[g];
2538
2539
  typeof x == "number" && (x >= 0 ? Ce += x : Se += x);
2539
2540
  }
2540
- Ce > he && (he = Ce), Se < ye && (ye = Se);
2541
+ Ce > de && (de = Ce), Se < ge && (ge = Se);
2541
2542
  }
2542
- return [ye, he];
2543
+ return [ge, de];
2543
2544
  }
2544
- const E = [];
2545
- for (const he of e)
2546
- for (const ye of F) {
2547
- const be = he[ye];
2548
- typeof be == "number" && E.push(be);
2545
+ const k = [];
2546
+ for (const de of e)
2547
+ for (const ge of X) {
2548
+ const be = de[ge];
2549
+ typeof be == "number" && k.push(be);
2549
2550
  }
2550
- const [V, de] = bt(E);
2551
- return [Math.min(0, V), Math.max(0, de)];
2552
- }, [e, F, ne]), B = qe(k[0], k[1], U), _ = B[0], J = B[B.length - 1], Y = (E, V) => S === "index" ? N[V % N.length] : n[E]?.color ?? N[0], b = f && g !== null && e[g] ? /* @__PURE__ */ s(
2551
+ const [G, O] = bt(k);
2552
+ return [Math.min(0, G), Math.max(0, O)];
2553
+ }, [e, X, se]), A = qe(v[0], v[1], Z), _ = A[0], q = A[A.length - 1], Y = (k, G) => R === "index" ? w[G % w.length] : n[k]?.color ?? w[0], J = f && y !== null && e[y] ? /* @__PURE__ */ s(
2553
2554
  et,
2554
2555
  {
2555
- row: e[g],
2556
- x: Vc(e, t, A, g, X, O, l),
2557
- y: O ? qc(e, t, A, g, X, l) : 16,
2558
- containerWidth: X.current?.getBoundingClientRect().width ?? 0,
2556
+ row: e[y],
2557
+ x: Vc(e, t, C, y, H, j, l),
2558
+ y: j ? qc(e, t, C, y, H, l) : 16,
2559
+ containerWidth: H.current?.getBoundingClientRect().width ?? 0,
2559
2560
  config: n,
2560
- render: ce ? () => ce(e[g]) : void 0,
2561
- valueFormat: oe,
2561
+ render: ne ? () => ne(e[y]) : void 0,
2562
+ valueFormat: ie,
2562
2563
  titleKey: t,
2563
- resolveColor: (E) => {
2564
- const V = e[g][E], de = Y(E, g);
2565
- return typeof V != "number" ? de : D !== void 0 && V < 0 ? D : de;
2564
+ resolveColor: (k) => {
2565
+ const G = e[y][k], O = Y(k, y);
2566
+ return typeof G != "number" ? O : Q !== void 0 && G < 0 ? Q : O;
2566
2567
  },
2567
- classes: H
2568
+ classes: F
2568
2569
  }
2569
2570
  ) : null;
2570
2571
  return /* @__PURE__ */ s(
2571
2572
  Ve,
2572
2573
  {
2573
- ref: X,
2574
+ ref: H,
2574
2575
  aspectRatio: c,
2575
2576
  height: i,
2576
- className: R,
2577
- style: te,
2578
- classes: H,
2579
- legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: H }) : void 0,
2580
- overlay: b,
2581
- children: ({ width: E, height: V }) => {
2582
- const de = A.left, he = E - A.right, ye = A.top, be = V - A.bottom, Ce = Math.max(0, he - de), Se = Math.max(0, be - ye), x = Xe(M, O ? [ye, be] : [de, he], l), ee = x.bandWidth(), G = Je([_, J], O ? [de, he] : [be, ye]), I = G(0), me = ne ? 1 : Math.max(1, F.length), Q = ee / me, T = Q * (1 - a), le = B.map((ie) => ({
2583
- value: ie,
2584
- pos: G(ie)
2585
- })), ge = Uc(M);
2586
- return /* @__PURE__ */ z(je, { children: [
2587
- u && /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(
2588
- ({ value: ie, pos: ue }) => O ? /* @__PURE__ */ s(
2577
+ className: S,
2578
+ style: re,
2579
+ classes: F,
2580
+ legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: F }) : void 0,
2581
+ overlay: J,
2582
+ children: ({ width: k, height: G }) => {
2583
+ const O = C.left, de = k - C.right, ge = C.top, be = G - C.bottom, Ce = Math.max(0, de - O), Se = Math.max(0, be - ge), x = je(N, j ? [ge, be] : [O, de], l), ee = x.bandWidth(), U = Je([_, q], j ? [O, de] : [be, ge]), I = U(0), fe = se ? 1 : Math.max(1, X.length), ce = ee / fe, B = ce * (1 - a), le = A.map((te) => ({
2584
+ value: te,
2585
+ pos: U(te)
2586
+ })), ye = Yc(N);
2587
+ return /* @__PURE__ */ z(ze, { children: [
2588
+ u && /* @__PURE__ */ s("g", { className: m(M.axis, F?.axis), children: le.map(
2589
+ ({ value: te, pos: ae }) => j ? /* @__PURE__ */ s(
2589
2590
  "line",
2590
2591
  {
2591
- className: m(w.gridLine, H?.grid),
2592
- x1: ue,
2593
- x2: ue,
2594
- y1: ye,
2592
+ className: m(M.gridLine, F?.grid),
2593
+ x1: ae,
2594
+ x2: ae,
2595
+ y1: ge,
2595
2596
  y2: be
2596
2597
  },
2597
- `g-${ie}`
2598
+ `g-${te}`
2598
2599
  ) : /* @__PURE__ */ s(
2599
2600
  "line",
2600
2601
  {
2601
- className: m(w.gridLine, H?.grid),
2602
- x1: de,
2603
- x2: he,
2604
- y1: ue,
2605
- y2: ue
2602
+ className: m(M.gridLine, F?.grid),
2603
+ x1: O,
2604
+ x2: de,
2605
+ y1: ae,
2606
+ y2: ae
2606
2607
  },
2607
- `g-${ie}`
2608
+ `g-${te}`
2608
2609
  )
2609
2610
  ) }),
2610
- /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(({ value: ie, pos: ue }) => {
2611
- const Ae = C ? C(ie) : String(ie);
2612
- return O ? /* @__PURE__ */ s(
2611
+ /* @__PURE__ */ s("g", { className: m(M.axis, F?.axis), children: le.map(({ value: te, pos: ae }) => {
2612
+ const Ae = T ? T(te) : String(te);
2613
+ return j ? /* @__PURE__ */ s(
2613
2614
  "text",
2614
2615
  {
2615
- className: m(w.axisLabel, H?.axisLabel),
2616
- x: ue,
2616
+ className: m(M.axisLabel, F?.axisLabel),
2617
+ x: ae,
2617
2618
  y: be + 16,
2618
2619
  textAnchor: "middle",
2619
2620
  children: Ae
2620
2621
  },
2621
- `vt-${ie}`
2622
+ `vt-${te}`
2622
2623
  ) : /* @__PURE__ */ s(
2623
2624
  "text",
2624
2625
  {
2625
- className: m(w.axisLabel, H?.axisLabel),
2626
- x: de - 8,
2627
- y: ue,
2626
+ className: m(M.axisLabel, F?.axisLabel),
2627
+ x: O - 8,
2628
+ y: ae,
2628
2629
  textAnchor: "end",
2629
2630
  dominantBaseline: "middle",
2630
2631
  children: Ae
2631
2632
  },
2632
- `vt-${ie}`
2633
+ `vt-${te}`
2633
2634
  );
2634
2635
  }) }),
2635
- /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: ge.map((ie) => {
2636
- const ue = x(ie), Ae = $ ? $(ie) : ie;
2637
- return O ? /* @__PURE__ */ s(
2636
+ /* @__PURE__ */ s("g", { className: m(M.axis, F?.axis), children: ye.map((te) => {
2637
+ const ae = x(te), Ae = $ ? $(te) : te;
2638
+ return j ? /* @__PURE__ */ s(
2638
2639
  "text",
2639
2640
  {
2640
- className: m(w.axisLabel, H?.axisLabel),
2641
- x: de - 8,
2642
- y: ue,
2641
+ className: m(M.axisLabel, F?.axisLabel),
2642
+ x: O - 8,
2643
+ y: ae,
2643
2644
  textAnchor: "end",
2644
2645
  dominantBaseline: "middle",
2645
2646
  children: Ae
2646
2647
  },
2647
- `c-${ie}`
2648
+ `c-${te}`
2648
2649
  ) : /* @__PURE__ */ s(
2649
2650
  "text",
2650
2651
  {
2651
- className: m(w.axisLabel, H?.axisLabel),
2652
- x: ue,
2652
+ className: m(M.axisLabel, F?.axisLabel),
2653
+ x: ae,
2653
2654
  y: be + 16,
2654
2655
  textAnchor: "middle",
2655
2656
  children: Ae
2656
2657
  },
2657
- `c-${ie}`
2658
+ `c-${te}`
2658
2659
  );
2659
2660
  }) }),
2660
- e.map((ie, ue) => {
2661
- const De = x(M[ue]) - ee / 2;
2662
- let xe = 0, se = 0;
2663
- return /* @__PURE__ */ s("g", { className: m(w.series, H?.series), children: F.map((Ie, He) => {
2664
- const Ge = ie[Ie];
2661
+ e.map((te, ae) => {
2662
+ const De = x(N[ae]) - ee / 2;
2663
+ let xe = 0, he = 0;
2664
+ return /* @__PURE__ */ s("g", { className: m(M.series, F?.series), children: X.map((Ie, He) => {
2665
+ const Ge = te[Ie];
2665
2666
  if (typeof Ge != "number") return null;
2666
- const Ee = Ge, xt = Y(Ie, ue), kt = D !== void 0 && Ee < 0 ? D : xt, Oe = j !== void 0 ? j === ue : pe === ue, tt = j !== void 0 && !Oe;
2667
+ const Ee = Ge, xt = Y(Ie, ae), kt = Q !== void 0 && Ee < 0 ? Q : xt, Oe = W !== void 0 ? W === ae : me === ae, tt = W !== void 0 && !Oe;
2667
2668
  let nt, _e;
2668
- ne ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = se, _e = se + Ee, se = _e) : (nt = 0, _e = Ee);
2669
- const rt = G(nt), ot = G(_e), Bt = ne ? (ee - T) / 2 : He * Q + (Q - T) / 2;
2669
+ se ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = he, _e = he + Ee, he = _e) : (nt = 0, _e = Ee);
2670
+ const rt = U(nt), ot = U(_e), Bt = se ? (ee - B) / 2 : He * ce + (ce - B) / 2;
2670
2671
  let it = 0, ct = 0, lt = 0, st = 0;
2671
- if (O) {
2672
+ if (j) {
2672
2673
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2673
- it = Ze, lt = wt - Ze, ct = De + Bt, st = T;
2674
+ it = Ze, lt = wt - Ze, ct = De + Bt, st = B;
2674
2675
  } else {
2675
2676
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2676
- it = De + Bt, lt = T, ct = Ze, st = wt - Ze;
2677
+ it = De + Bt, lt = B, ct = Ze, st = wt - Ze;
2677
2678
  }
2678
- const Mt = v ? v({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : y ? oe ? oe(Ee) : String(Ee) : null, Fe = Yc({
2679
- isHorizontal: O,
2679
+ const Mt = b ? b({ row: te, value: Ee, seriesKey: Ie, index: ae }) : p ? ie ? ie(Ee) : String(Ee) : null, Fe = Uc({
2680
+ isHorizontal: j,
2680
2681
  valuePosition: L,
2681
2682
  x: it,
2682
2683
  y: ct,
@@ -2689,9 +2690,9 @@ function zl({
2689
2690
  "rect",
2690
2691
  {
2691
2692
  className: m(
2692
- w.bar,
2693
- Oe && w.activeBar,
2694
- H?.point
2693
+ M.bar,
2694
+ Oe && M.activeBar,
2695
+ F?.point
2695
2696
  ),
2696
2697
  x: it,
2697
2698
  y: ct,
@@ -2701,16 +2702,16 @@ function zl({
2701
2702
  ry: h,
2702
2703
  fill: kt,
2703
2704
  opacity: tt ? 0.35 : 1,
2704
- onClick: Z ? () => Z({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : void 0,
2705
- style: Z ? { cursor: "pointer" } : void 0
2705
+ onClick: D ? () => D({ row: te, value: Ee, seriesKey: Ie, index: ae }) : void 0,
2706
+ style: D ? { cursor: "pointer" } : void 0
2706
2707
  }
2707
2708
  ),
2708
2709
  Mt != null && /* @__PURE__ */ s(
2709
2710
  "text",
2710
2711
  {
2711
2712
  className: m(
2712
- w.axisLabel,
2713
- (L === "inside" || L === "inside-start") && w.barLabelInside
2713
+ M.axisLabel,
2714
+ (L === "inside" || L === "inside-start") && M.barLabelInside
2714
2715
  ),
2715
2716
  x: Fe.x,
2716
2717
  y: Fe.y,
@@ -2722,31 +2723,31 @@ function zl({
2722
2723
  }
2723
2724
  )
2724
2725
  ] }, Ie);
2725
- }) }, `group-${ue}`);
2726
+ }) }, `group-${ae}`);
2726
2727
  }),
2727
- _ < 0 && J > 0 && /* @__PURE__ */ s(
2728
+ _ < 0 && q > 0 && /* @__PURE__ */ s(
2728
2729
  "line",
2729
2730
  {
2730
- className: m(w.gridLine),
2731
- x1: O ? I : de,
2732
- x2: O ? I : he,
2733
- y1: O ? ye : I,
2734
- y2: O ? be : I,
2731
+ className: m(M.gridLine),
2732
+ x1: j ? I : O,
2733
+ x2: j ? I : de,
2734
+ y1: j ? ge : I,
2735
+ y2: j ? be : I,
2735
2736
  opacity: 0.9
2736
2737
  }
2737
2738
  ),
2738
2739
  /* @__PURE__ */ s(
2739
2740
  "rect",
2740
2741
  {
2741
- className: w.interactionLayer,
2742
- x: de,
2743
- y: ye,
2742
+ className: M.interactionLayer,
2743
+ x: O,
2744
+ y: ge,
2744
2745
  width: Ce,
2745
2746
  height: Se,
2746
- onMouseMove: (ie) => {
2747
- const ue = ie.currentTarget.getBoundingClientRect(), Ae = ie.clientX - ue.left + de, De = ie.clientY - ue.top + ye, xe = x.step(), se = O ? De - ye : Ae - de, Ie = Math.max(
2747
+ onMouseMove: (te) => {
2748
+ const ae = te.currentTarget.getBoundingClientRect(), Ae = te.clientX - ae.left + O, De = te.clientY - ae.top + ge, xe = x.step(), he = j ? De - ge : Ae - O, Ie = Math.max(
2748
2749
  0,
2749
- Math.min(e.length - 1, Math.round((se - xe / 2) / xe))
2750
+ Math.min(e.length - 1, Math.round((he - xe / 2) / xe))
2750
2751
  );
2751
2752
  K(Ie);
2752
2753
  },
@@ -2758,7 +2759,7 @@ function zl({
2758
2759
  }
2759
2760
  );
2760
2761
  }
2761
- function Yc({
2762
+ function Uc({
2762
2763
  isHorizontal: e,
2763
2764
  valuePosition: t,
2764
2765
  x: n,
@@ -2814,13 +2815,13 @@ function Vc(e, t, n, r, o, c, i) {
2814
2815
  const l = o.current;
2815
2816
  if (!l) return 0;
2816
2817
  const a = l.getBoundingClientRect(), h = e.map((d) => String(d[t]));
2817
- return c ? a.width / 2 : Xe(h, [n.left, a.width - n.right], i)(h[r]);
2818
+ return c ? a.width / 2 : je(h, [n.left, a.width - n.right], i)(h[r]);
2818
2819
  }
2819
2820
  function qc(e, t, n, r, o, c) {
2820
2821
  const i = o.current;
2821
2822
  if (!i) return 16;
2822
2823
  const l = i.getBoundingClientRect(), a = e.map((u) => String(u[t]));
2823
- return Xe(a, [n.top, l.height - n.bottom], c)(a[r]);
2824
+ return je(a, [n.top, l.height - n.bottom], c)(a[r]);
2824
2825
  }
2825
2826
  const Gc = [
2826
2827
  "var(--crk-chart-1)",
@@ -2852,12 +2853,12 @@ function Zc(e, t, n, r, o, c) {
2852
2853
  ].join(" ");
2853
2854
  const i = (o - 90) * Math.PI / 180, l = (c - 90) * Math.PI / 180, a = c - o > 180 ? 1 : 0, h = e + n * Math.cos(i), u = t + n * Math.sin(i), d = e + n * Math.cos(l), f = t + n * Math.sin(l);
2854
2855
  if (r > 0) {
2855
- const y = e + r * Math.cos(l), L = t + r * Math.sin(l), v = e + r * Math.cos(i), S = t + r * Math.sin(i);
2856
+ const p = e + r * Math.cos(l), L = t + r * Math.sin(l), b = e + r * Math.cos(i), R = t + r * Math.sin(i);
2856
2857
  return [
2857
2858
  `M ${h} ${u}`,
2858
2859
  `A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
2859
- `L ${y} ${L}`,
2860
- `A ${r} ${r} 0 ${a} 0 ${v} ${S}`,
2860
+ `L ${p} ${L}`,
2861
+ `A ${r} ${r} 0 ${a} 0 ${b} ${R}`,
2861
2862
  "Z"
2862
2863
  ].join(" ");
2863
2864
  }
@@ -2872,7 +2873,7 @@ function Pt(e, t, n, r, o) {
2872
2873
  const i = ((r + o) / 2 - 90) * Math.PI / 180;
2873
2874
  return { x: e + n * Math.cos(i), y: t + n * Math.sin(i) };
2874
2875
  }
2875
- function jl({
2876
+ function zl({
2876
2877
  data: e,
2877
2878
  valueKey: t,
2878
2879
  nameKey: n,
@@ -2886,119 +2887,119 @@ function jl({
2886
2887
  strokeColor: u = "var(--crk-color-bg)",
2887
2888
  padAngle: d = 0,
2888
2889
  showLabels: f = !1,
2889
- valuePosition: y = "outside",
2890
+ valuePosition: p = "outside",
2890
2891
  showLabelLines: L = !0,
2891
- renderLabel: v,
2892
- centerLabel: S,
2893
- activeIndex: N,
2894
- onSliceClick: D,
2895
- showLegend: j = !0,
2896
- showTooltip: Z = !0,
2897
- valueFormat: U,
2898
- renderTooltip: C,
2892
+ renderLabel: b,
2893
+ centerLabel: R,
2894
+ activeIndex: w,
2895
+ onSliceClick: Q,
2896
+ showLegend: W = !0,
2897
+ showTooltip: D = !0,
2898
+ valueFormat: Z,
2899
+ renderTooltip: T,
2899
2900
  emptyMessage: $ = "No data",
2900
- className: oe,
2901
- style: ce,
2902
- classes: q
2901
+ className: ie,
2902
+ style: ne,
2903
+ classes: V
2903
2904
  }) {
2904
- const [ae, R] = Le(null), te = re(null), H = N ?? ae, O = (K) => {
2905
+ const [ue, S] = Re(null), re = oe(null), F = w ?? ue, j = (K) => {
2905
2906
  if (r) {
2906
- const X = e[K]?.[r];
2907
- if (typeof X == "string") return X;
2907
+ const H = e[K]?.[r];
2908
+ if (typeof H == "string") return H;
2908
2909
  }
2909
2910
  return o[K % o.length];
2910
- }, A = ke(() => {
2911
+ }, C = ke(() => {
2911
2912
  let K = 0;
2912
- for (const X of e) {
2913
- const M = X[t];
2914
- typeof M == "number" && M > 0 && (K += M);
2913
+ for (const H of e) {
2914
+ const N = H[t];
2915
+ typeof N == "number" && N > 0 && (K += N);
2915
2916
  }
2916
2917
  return K;
2917
2918
  }, [e, t]);
2918
- if (e.length === 0 || A === 0)
2919
- return /* @__PURE__ */ s("div", { ref: te, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
2920
- const F = ke(() => {
2919
+ if (e.length === 0 || C === 0)
2920
+ return /* @__PURE__ */ s("div", { ref: re, className: m(M.root, V?.root, ie), style: ne, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: $ }) }) });
2921
+ const X = ke(() => {
2921
2922
  const K = [];
2922
- let X = 0;
2923
- for (let M = 0; M < e.length; M++) {
2924
- const g = e[M], k = g[t], B = typeof k == "number" && k > 0 ? k : 0;
2925
- if (B === 0) continue;
2926
- const _ = B / A, J = _ * 360;
2927
- K.push({ index: M, row: g, value: B, start: X, end: X + J, fraction: _ }), X += J;
2923
+ let H = 0;
2924
+ for (let N = 0; N < e.length; N++) {
2925
+ const y = e[N], v = y[t], A = typeof v == "number" && v > 0 ? v : 0;
2926
+ if (A === 0) continue;
2927
+ const _ = A / C, q = _ * 360;
2928
+ K.push({ index: N, row: y, value: A, start: H, end: H + q, fraction: _ }), H += q;
2928
2929
  }
2929
2930
  return K;
2930
- }, [e, t, A]), ne = j ? /* @__PURE__ */ s("div", { className: m(w.legend, q?.legend), role: "list", children: F.map((K) => /* @__PURE__ */ z("div", { className: m(w.legendItem, q?.legendItem), role: "listitem", children: [
2931
+ }, [e, t, C]), se = W ? /* @__PURE__ */ s("div", { className: m(M.legend, V?.legend), role: "list", children: X.map((K) => /* @__PURE__ */ z("div", { className: m(M.legendItem, V?.legendItem), role: "listitem", children: [
2931
2932
  /* @__PURE__ */ s(
2932
2933
  "span",
2933
2934
  {
2934
- className: w.legendSwatch,
2935
- style: { background: O(K.index) },
2935
+ className: M.legendSwatch,
2936
+ style: { background: j(K.index) },
2936
2937
  "aria-hidden": "true"
2937
2938
  }
2938
2939
  ),
2939
- /* @__PURE__ */ s("span", { className: w.legendLabel, children: String(K.row[n]) })
2940
- ] }, K.index)) }) : void 0, pe = ke(() => {
2940
+ /* @__PURE__ */ s("span", { className: M.legendLabel, children: String(K.row[n]) })
2941
+ ] }, K.index)) }) : void 0, me = ke(() => {
2941
2942
  const K = {};
2942
- for (const X of F)
2943
- K[X.index.toString()] = {
2944
- label: String(X.row[n]),
2945
- color: O(X.index)
2943
+ for (const H of X)
2944
+ K[H.index.toString()] = {
2945
+ label: String(H.row[n]),
2946
+ color: j(H.index)
2946
2947
  };
2947
2948
  return K;
2948
- }, [F]);
2949
+ }, [X]);
2949
2950
  return /* @__PURE__ */ s(
2950
2951
  Ve,
2951
2952
  {
2952
- ref: te,
2953
+ ref: re,
2953
2954
  aspectRatio: c,
2954
2955
  height: i,
2955
- className: oe,
2956
- style: ce,
2957
- classes: q,
2958
- legend: ne,
2959
- overlay: Z && H !== null && e[H] ? /* @__PURE__ */ s(
2956
+ className: ie,
2957
+ style: ne,
2958
+ classes: V,
2959
+ legend: se,
2960
+ overlay: D && F !== null && e[F] ? /* @__PURE__ */ s(
2960
2961
  et,
2961
2962
  {
2962
- row: { [H.toString()]: e[H][t] },
2963
- x: te.current ? te.current.getBoundingClientRect().width / 2 : 0,
2963
+ row: { [F.toString()]: e[F][t] },
2964
+ x: re.current ? re.current.getBoundingClientRect().width / 2 : 0,
2964
2965
  y: 16,
2965
- containerWidth: te.current?.getBoundingClientRect().width ?? 0,
2966
- config: { [H.toString()]: pe[H.toString()] },
2967
- render: C ? () => C(e[H]) : void 0,
2968
- valueFormat: U,
2966
+ containerWidth: re.current?.getBoundingClientRect().width ?? 0,
2967
+ config: { [F.toString()]: me[F.toString()] },
2968
+ render: T ? () => T(e[F]) : void 0,
2969
+ valueFormat: Z,
2969
2970
  titleKey: void 0,
2970
- classes: q
2971
+ classes: V
2971
2972
  }
2972
2973
  ) : null,
2973
- children: ({ width: K, height: X }) => {
2974
- const M = K / 2, g = X / 2, k = Math.min(K, X) / 2 - 4, B = Et(a, k), _ = Math.min(B - 1, Et(l, k)), J = Math.max(4, B * 0.06);
2975
- return /* @__PURE__ */ z(je, { children: [
2976
- /* @__PURE__ */ s("g", { children: F.map((Y) => {
2977
- const b = d / 2, E = Math.min(Y.end, Y.start + b), V = Math.max(Y.start, Y.end - b), de = O(Y.index), he = H === Y.index, ye = N !== void 0 && !he, be = he && N !== void 0 ? B + J : B, Ce = Zc(M, g, be, _, E, V), Se = D ? () => D({ row: Y.row, value: Y.value, index: Y.index }) : void 0;
2974
+ children: ({ width: K, height: H }) => {
2975
+ const N = K / 2, y = H / 2, v = Math.min(K, H) / 2 - 4, A = Et(a, v), _ = Math.min(A - 1, Et(l, v)), q = Math.max(4, A * 0.06);
2976
+ return /* @__PURE__ */ z(ze, { children: [
2977
+ /* @__PURE__ */ s("g", { children: X.map((Y) => {
2978
+ const J = d / 2, k = Math.min(Y.end, Y.start + J), G = Math.max(Y.start, Y.end - J), O = j(Y.index), de = F === Y.index, ge = w !== void 0 && !de, be = de && w !== void 0 ? A + q : A, Ce = Zc(N, y, be, _, k, G), Se = Q ? () => Q({ row: Y.row, value: Y.value, index: Y.index }) : void 0;
2978
2979
  return /* @__PURE__ */ s(
2979
2980
  "path",
2980
2981
  {
2981
2982
  d: Ce,
2982
- fill: de,
2983
+ fill: O,
2983
2984
  stroke: h > 0 ? u : "none",
2984
2985
  strokeWidth: h,
2985
- opacity: ye ? 0.45 : 1,
2986
- onMouseEnter: () => R(Y.index),
2987
- onMouseLeave: () => R(null),
2986
+ opacity: ge ? 0.45 : 1,
2987
+ onMouseEnter: () => S(Y.index),
2988
+ onMouseLeave: () => S(null),
2988
2989
  onClick: Se,
2989
2990
  style: Se ? { cursor: "pointer" } : void 0
2990
2991
  },
2991
2992
  Y.index
2992
2993
  );
2993
2994
  }) }),
2994
- (f || v) && F.map((Y) => {
2995
- const b = v ? v({ row: Y.row, value: Y.value, fraction: Y.fraction, index: Y.index }) : f ? `${String(Y.row[n])} ${U ? U(Y.value) : Math.round(Y.fraction * 100) + "%"}` : null;
2996
- if (b == null) return null;
2997
- const E = y === "inside", V = Math.max(16, B * 0.12), de = E ? (B + _) / 2 : B + V, he = Pt(M, g, de, Y.start, Y.end), ye = E ? "middle" : he.x < M - 1 ? "end" : he.x > M + 1 ? "start" : "middle";
2995
+ (f || b) && X.map((Y) => {
2996
+ const J = b ? b({ row: Y.row, value: Y.value, fraction: Y.fraction, index: Y.index }) : f ? `${String(Y.row[n])} ${Z ? Z(Y.value) : Math.round(Y.fraction * 100) + "%"}` : null;
2997
+ if (J == null) return null;
2998
+ const k = p === "inside", G = Math.max(16, A * 0.12), O = k ? (A + _) / 2 : A + G, de = Pt(N, y, O, Y.start, Y.end), ge = k ? "middle" : de.x < N - 1 ? "end" : de.x > N + 1 ? "start" : "middle";
2998
2999
  let be = null;
2999
- if (!E && L) {
3000
- const Ce = Pt(M, g, B, Y.start, Y.end), Se = 4, p = ye === "end" ? Se : ye === "start" ? -Se : 0;
3001
- be = { x1: Ce.x, y1: Ce.y, x2: he.x + p, y2: he.y };
3000
+ if (!k && L) {
3001
+ const Ce = Pt(N, y, A, Y.start, Y.end), Se = 4, g = ge === "end" ? Se : ge === "start" ? -Se : 0;
3002
+ be = { x1: Ce.x, y1: Ce.y, x2: de.x + g, y2: de.y };
3002
3003
  }
3003
3004
  return /* @__PURE__ */ z("g", { children: [
3004
3005
  be && /* @__PURE__ */ s(
@@ -3008,7 +3009,7 @@ function jl({
3008
3009
  y1: be.y1,
3009
3010
  x2: be.x2,
3010
3011
  y2: be.y2,
3011
- stroke: O(Y.index),
3012
+ stroke: j(Y.index),
3012
3013
  strokeWidth: 1,
3013
3014
  opacity: 0.7
3014
3015
  }
@@ -3016,24 +3017,24 @@ function jl({
3016
3017
  /* @__PURE__ */ s(
3017
3018
  "text",
3018
3019
  {
3019
- x: he.x,
3020
- y: he.y,
3020
+ x: de.x,
3021
+ y: de.y,
3021
3022
  className: m(
3022
- w.axisLabel,
3023
- E && w.barLabelInside
3023
+ M.axisLabel,
3024
+ k && M.barLabelInside
3024
3025
  ),
3025
- textAnchor: ye,
3026
+ textAnchor: ge,
3026
3027
  dominantBaseline: "middle",
3027
- children: b
3028
+ children: J
3028
3029
  }
3029
3030
  )
3030
3031
  ] }, `label-${Y.index}`);
3031
3032
  }),
3032
- S !== void 0 && /* @__PURE__ */ s(
3033
+ R !== void 0 && /* @__PURE__ */ s(
3033
3034
  "foreignObject",
3034
3035
  {
3035
- x: M - _,
3036
- y: g - _,
3036
+ x: N - _,
3037
+ y: y - _,
3037
3038
  width: Math.max(0, _ * 2),
3038
3039
  height: Math.max(0, _ * 2),
3039
3040
  style: { pointerEvents: "none" },
@@ -3051,7 +3052,7 @@ function jl({
3051
3052
  color: "var(--crk-color-text)",
3052
3053
  fontFamily: "var(--crk-font-family)"
3053
3054
  },
3054
- children: S
3055
+ children: R
3055
3056
  }
3056
3057
  )
3057
3058
  }
@@ -3071,7 +3072,7 @@ function Kc(e, t, n, r) {
3071
3072
  return `${c.x},${c.y}`;
3072
3073
  }).join(" ");
3073
3074
  }
3074
- function Xl({
3075
+ function jl({
3075
3076
  data: e,
3076
3077
  axisKey: t,
3077
3078
  config: n,
@@ -3085,185 +3086,185 @@ function Xl({
3085
3086
  levels: u = 5,
3086
3087
  showPoints: d = !0,
3087
3088
  fillOpacity: f = 0.4,
3088
- strokeWidth: y = 2,
3089
+ strokeWidth: p = 2,
3089
3090
  renderAxisLabel: L,
3090
- axisFormat: v,
3091
- valueFormat: S,
3092
- renderTooltip: N,
3093
- showLegend: D = !0,
3094
- showTooltip: j = !0,
3095
- emptyMessage: Z = "No data",
3096
- className: U,
3097
- style: C,
3091
+ axisFormat: b,
3092
+ valueFormat: R,
3093
+ renderTooltip: w,
3094
+ showLegend: Q = !0,
3095
+ showTooltip: W = !0,
3096
+ emptyMessage: D = "No data",
3097
+ className: Z,
3098
+ style: T,
3098
3099
  classes: $
3099
3100
  }) {
3100
- const [oe, ce] = Le(null), q = re(null), ae = ke(() => Object.keys(n), [n]);
3101
+ const [ie, ne] = Re(null), V = oe(null), ue = ke(() => Object.keys(n), [n]);
3101
3102
  if (e.length === 0)
3102
- return /* @__PURE__ */ s("div", { ref: q, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
3103
- const R = ke(
3104
- () => e.map((A, F) => F / e.length * 360),
3103
+ return /* @__PURE__ */ s("div", { ref: V, className: m(M.root, $?.root, Z), style: T, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: D }) }) });
3104
+ const S = ke(
3105
+ () => e.map((C, X) => X / e.length * 360),
3105
3106
  [e]
3106
- ), te = ke(() => {
3107
- const A = [];
3108
- for (const ne of ae)
3109
- for (const pe of e) {
3110
- const K = pe[ne];
3111
- typeof K == "number" && A.push(K);
3107
+ ), re = ke(() => {
3108
+ const C = [];
3109
+ for (const se of ue)
3110
+ for (const me of e) {
3111
+ const K = me[se];
3112
+ typeof K == "number" && C.push(K);
3112
3113
  }
3113
- const [, F] = bt(A);
3114
- return Math.max(1, F);
3115
- }, [e, ae]), H = ke(() => qe(0, te, u).filter((F) => F > 0), [te, u]), O = H[H.length - 1] ?? te;
3114
+ const [, X] = bt(C);
3115
+ return Math.max(1, X);
3116
+ }, [e, ue]), F = ke(() => qe(0, re, u).filter((X) => X > 0), [re, u]), j = F[F.length - 1] ?? re;
3116
3117
  return /* @__PURE__ */ s(
3117
3118
  Ve,
3118
3119
  {
3119
- ref: q,
3120
+ ref: V,
3120
3121
  aspectRatio: r,
3121
3122
  height: o,
3122
- className: U,
3123
- style: C,
3123
+ className: Z,
3124
+ style: T,
3124
3125
  classes: $,
3125
- legend: D ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
3126
- overlay: j && oe !== null ? /* @__PURE__ */ s(
3126
+ legend: Q ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
3127
+ overlay: W && ie !== null ? /* @__PURE__ */ s(
3127
3128
  et,
3128
3129
  {
3129
- row: e[oe],
3130
- x: (q.current?.getBoundingClientRect().width ?? 0) / 2,
3130
+ row: e[ie],
3131
+ x: (V.current?.getBoundingClientRect().width ?? 0) / 2,
3131
3132
  y: 16,
3132
- containerWidth: q.current?.getBoundingClientRect().width ?? 0,
3133
+ containerWidth: V.current?.getBoundingClientRect().width ?? 0,
3133
3134
  config: n,
3134
- render: N ? () => N(e[oe]) : void 0,
3135
- valueFormat: S,
3135
+ render: w ? () => w(e[ie]) : void 0,
3136
+ valueFormat: R,
3136
3137
  titleKey: t,
3137
3138
  classes: $
3138
3139
  }
3139
3140
  ) : null,
3140
- children: ({ width: A, height: F }) => {
3141
- const ne = a ? 32 : 8, pe = A / 2, K = F / 2, X = Math.max(0, Math.min(A, F) / 2 - ne), M = (g) => Math.max(0, g) / O * X;
3142
- return /* @__PURE__ */ z(je, { children: [
3143
- i && H.map((g) => {
3144
- const k = M(g);
3141
+ children: ({ width: C, height: X }) => {
3142
+ const se = a ? 32 : 8, me = C / 2, K = X / 2, H = Math.max(0, Math.min(C, X) / 2 - se), N = (y) => Math.max(0, y) / j * H;
3143
+ return /* @__PURE__ */ z(ze, { children: [
3144
+ i && F.map((y) => {
3145
+ const v = N(y);
3145
3146
  return c === "circle" ? /* @__PURE__ */ s(
3146
3147
  "circle",
3147
3148
  {
3148
- className: m(w.gridLine, $?.grid),
3149
- cx: pe,
3149
+ className: m(M.gridLine, $?.grid),
3150
+ cx: me,
3150
3151
  cy: K,
3151
- r: k,
3152
+ r: v,
3152
3153
  fill: "none"
3153
3154
  },
3154
- `ring-${g}`
3155
+ `ring-${y}`
3155
3156
  ) : /* @__PURE__ */ s(
3156
3157
  "polygon",
3157
3158
  {
3158
- className: m(w.gridLine, $?.grid),
3159
- points: Kc(pe, K, k, R),
3159
+ className: m(M.gridLine, $?.grid),
3160
+ points: Kc(me, K, v, S),
3160
3161
  fill: "none"
3161
3162
  },
3162
- `ring-${g}`
3163
+ `ring-${y}`
3163
3164
  );
3164
3165
  }),
3165
- l && R.map((g, k) => {
3166
- const B = mt(pe, K, X, g);
3166
+ l && S.map((y, v) => {
3167
+ const A = mt(me, K, H, y);
3167
3168
  return /* @__PURE__ */ s(
3168
3169
  "line",
3169
3170
  {
3170
- className: m(w.gridLine, $?.grid),
3171
- x1: pe,
3171
+ className: m(M.gridLine, $?.grid),
3172
+ x1: me,
3172
3173
  y1: K,
3173
- x2: B.x,
3174
- y2: B.y
3174
+ x2: A.x,
3175
+ y2: A.y
3175
3176
  },
3176
- `spoke-${k}`
3177
+ `spoke-${v}`
3177
3178
  );
3178
3179
  }),
3179
- h && H.map((g) => {
3180
- const k = M(g);
3180
+ h && F.map((y) => {
3181
+ const v = N(y);
3181
3182
  return /* @__PURE__ */ s(
3182
3183
  "text",
3183
3184
  {
3184
- className: m(w.axisLabel, $?.axisLabel),
3185
- x: pe + 4,
3186
- y: K - k,
3185
+ className: m(M.axisLabel, $?.axisLabel),
3186
+ x: me + 4,
3187
+ y: K - v,
3187
3188
  textAnchor: "start",
3188
3189
  dominantBaseline: "middle",
3189
- children: S ? S(g) : g
3190
+ children: R ? R(y) : y
3190
3191
  },
3191
- `raxis-${g}`
3192
+ `raxis-${y}`
3192
3193
  );
3193
3194
  }),
3194
- a && e.map((g, k) => {
3195
- const B = R[k], _ = mt(pe, K, X + 14, B), J = _.x < pe - 1 ? "end" : _.x > pe + 1 ? "start" : "middle";
3195
+ a && e.map((y, v) => {
3196
+ const A = S[v], _ = mt(me, K, H + 14, A), q = _.x < me - 1 ? "end" : _.x > me + 1 ? "start" : "middle";
3196
3197
  if (L)
3197
3198
  return /* @__PURE__ */ s("g", { children: L({
3198
- row: g,
3199
- index: k,
3200
- angle: B,
3199
+ row: y,
3200
+ index: v,
3201
+ angle: A,
3201
3202
  x: _.x,
3202
3203
  y: _.y,
3203
- textAnchor: J
3204
- }) }, `label-${k}`);
3205
- const Y = String(g[t]), b = v ? v(Y) : Y;
3204
+ textAnchor: q
3205
+ }) }, `label-${v}`);
3206
+ const Y = String(y[t]), J = b ? b(Y) : Y;
3206
3207
  return /* @__PURE__ */ s(
3207
3208
  "text",
3208
3209
  {
3209
- className: m(w.axisLabel, $?.axisLabel),
3210
+ className: m(M.axisLabel, $?.axisLabel),
3210
3211
  x: _.x,
3211
3212
  y: _.y,
3212
- textAnchor: J,
3213
+ textAnchor: q,
3213
3214
  dominantBaseline: "middle",
3214
- children: b
3215
+ children: J
3215
3216
  },
3216
- `label-${k}`
3217
+ `label-${v}`
3217
3218
  );
3218
3219
  }),
3219
- ae.map((g) => {
3220
- const k = n[g], B = e.map((J, Y) => {
3221
- const b = J[g], V = M(typeof b == "number" ? b : 0);
3222
- return mt(pe, K, V, R[Y]);
3223
- }), _ = B.map((J) => `${J.x},${J.y}`).join(" ");
3224
- return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
3220
+ ue.map((y) => {
3221
+ const v = n[y], A = e.map((q, Y) => {
3222
+ const J = q[y], G = N(typeof J == "number" ? J : 0);
3223
+ return mt(me, K, G, S[Y]);
3224
+ }), _ = A.map((q) => `${q.x},${q.y}`).join(" ");
3225
+ return /* @__PURE__ */ z("g", { className: m(M.series, $?.series), children: [
3225
3226
  /* @__PURE__ */ s(
3226
3227
  "polygon",
3227
3228
  {
3228
3229
  points: _,
3229
- fill: k.color,
3230
+ fill: v.color,
3230
3231
  fillOpacity: f,
3231
- stroke: k.color,
3232
- strokeWidth: y,
3232
+ stroke: v.color,
3233
+ strokeWidth: p,
3233
3234
  strokeLinejoin: "round",
3234
3235
  strokeLinecap: "round"
3235
3236
  }
3236
3237
  ),
3237
- d && B.map((J, Y) => /* @__PURE__ */ s(
3238
+ d && A.map((q, Y) => /* @__PURE__ */ s(
3238
3239
  "circle",
3239
3240
  {
3240
- className: m(w.point, $?.point),
3241
- cx: J.x,
3242
- cy: J.y,
3243
- r: oe === Y ? 5 : 3.5,
3244
- fill: k.color
3241
+ className: m(M.point, $?.point),
3242
+ cx: q.x,
3243
+ cy: q.y,
3244
+ r: ie === Y ? 5 : 3.5,
3245
+ fill: v.color
3245
3246
  },
3246
- `${g}-${Y}`
3247
+ `${y}-${Y}`
3247
3248
  ))
3248
- ] }, g);
3249
+ ] }, y);
3249
3250
  }),
3250
3251
  /* @__PURE__ */ s(
3251
3252
  "rect",
3252
3253
  {
3253
- className: w.interactionLayer,
3254
+ className: M.interactionLayer,
3254
3255
  x: 0,
3255
3256
  y: 0,
3256
- width: A,
3257
- height: F,
3258
- onMouseMove: (g) => {
3259
- const k = g.currentTarget.getBoundingClientRect(), B = g.clientX - k.left - pe, _ = g.clientY - k.top - K;
3260
- if (B === 0 && _ === 0) return;
3261
- let J = Math.atan2(_, B) * 180 / Math.PI + 90;
3262
- J < 0 && (J += 360), J >= 360 && (J -= 360);
3263
- const Y = 360 / e.length, b = Math.round(J / Y) % e.length;
3264
- ce(b);
3257
+ width: C,
3258
+ height: X,
3259
+ onMouseMove: (y) => {
3260
+ const v = y.currentTarget.getBoundingClientRect(), A = y.clientX - v.left - me, _ = y.clientY - v.top - K;
3261
+ if (A === 0 && _ === 0) return;
3262
+ let q = Math.atan2(_, A) * 180 / Math.PI + 90;
3263
+ q < 0 && (q += 360), q >= 360 && (q -= 360);
3264
+ const Y = 360 / e.length, J = Math.round(q / Y) % e.length;
3265
+ ne(J);
3265
3266
  },
3266
- onMouseLeave: () => ce(null)
3267
+ onMouseLeave: () => ne(null)
3267
3268
  }
3268
3269
  )
3269
3270
  ] });
@@ -3302,8 +3303,8 @@ function el(e, t, n = 2) {
3302
3303
  const h = a / t;
3303
3304
  let u = 0;
3304
3305
  for (let f = l - t + 1; f <= l; f++) {
3305
- const y = e[f].close - h;
3306
- u += y * y;
3306
+ const p = e[f].close - h;
3307
+ u += p * p;
3307
3308
  }
3308
3309
  u /= t;
3309
3310
  const d = Math.sqrt(u);
@@ -3332,36 +3333,42 @@ function Wt(e, t) {
3332
3333
  function _l(e) {
3333
3334
  return e.map((t) => typeof t.volume == "number" ? t.volume : null);
3334
3335
  }
3335
- const Re = 86400;
3336
+ const Me = 86400;
3336
3337
  function on(e) {
3337
3338
  switch (e) {
3338
3339
  case "1D":
3339
- return Re;
3340
+ return Me;
3340
3341
  case "5D":
3341
- return 5 * Re;
3342
+ return 5 * Me;
3342
3343
  case "1M":
3343
- return 30 * Re;
3344
+ return 30 * Me;
3344
3345
  case "3M":
3345
- return 90 * Re;
3346
+ return 90 * Me;
3346
3347
  case "6M":
3347
- return 180 * Re;
3348
+ return 180 * Me;
3348
3349
  case "1Y":
3349
- return 365 * Re;
3350
+ return 365 * Me;
3350
3351
  case "5Y":
3351
- return 5 * 365 * Re;
3352
+ return 5 * 365 * Me;
3353
+ case "10Y":
3354
+ return 10 * 365 * Me;
3355
+ case "20Y":
3356
+ return 20 * 365 * Me;
3357
+ case "MAX":
3358
+ return 100 * 365 * Me;
3352
3359
  }
3353
3360
  const t = /^(\d+)\s*([dDwWmMyYhH])$/.exec(e);
3354
3361
  if (t) {
3355
3362
  const n = Number(t[1]), r = t[2].toLowerCase();
3356
3363
  if (r === "h") return n * 3600;
3357
- if (r === "d") return n * Re;
3358
- if (r === "w") return n * 7 * Re;
3359
- if (r === "m") return n * 30 * Re;
3360
- if (r === "y") return n * 365 * Re;
3364
+ if (r === "d") return n * Me;
3365
+ if (r === "w") return n * 7 * Me;
3366
+ if (r === "m") return n * 30 * Me;
3367
+ if (r === "y") return n * 365 * Me;
3361
3368
  }
3362
- return 30 * Re;
3369
+ return 30 * Me;
3363
3370
  }
3364
- function Ul(e) {
3371
+ function Yl(e) {
3365
3372
  switch (e) {
3366
3373
  case "1D":
3367
3374
  return "5";
@@ -3377,11 +3384,17 @@ function Ul(e) {
3377
3384
  return "D";
3378
3385
  case "5Y":
3379
3386
  return "W";
3387
+ case "10Y":
3388
+ return "W";
3389
+ case "20Y":
3390
+ return "M";
3391
+ case "MAX":
3392
+ return "M";
3380
3393
  }
3381
3394
  const t = on(e);
3382
- return t >= 3 * 365 * Re ? "W" : t >= 180 * Re ? "D" : t >= 60 * Re ? "240" : t >= 14 * Re ? "60" : t >= 3 * Re ? "15" : "5";
3395
+ return t >= 3 * 365 * Me ? "W" : t >= 180 * Me ? "D" : t >= 60 * Me ? "240" : t >= 14 * Me ? "60" : t >= 3 * Me ? "15" : "5";
3383
3396
  }
3384
- function Yl(e) {
3397
+ function Ul(e) {
3385
3398
  if (e === "W" || e === "M") return "5Y";
3386
3399
  if (e === "D") return "1Y";
3387
3400
  const t = Number(e);
@@ -3402,208 +3415,208 @@ function Vl({
3402
3415
  downColor: u = "var(--crk-color-danger)",
3403
3416
  lineColor: d = "var(--crk-chart-1)",
3404
3417
  timezone: f,
3405
- defaultTimezone: y = "local",
3418
+ defaultTimezone: p = "local",
3406
3419
  onTimezoneChange: L,
3407
- showConfigPanel: v = !0,
3408
- onCrosshair: S,
3409
- onVisibleRangeChange: N,
3410
- className: D,
3411
- style: j
3420
+ showConfigPanel: b = !0,
3421
+ onCrosshair: R,
3422
+ onVisibleRangeChange: w,
3423
+ className: Q,
3424
+ style: W
3412
3425
  }) {
3413
- const Z = re(null), U = re(null), C = re([]), $ = re({ from: 0, to: 0 }), oe = re(null), ce = re(null), q = re(!1), ae = re(null), R = re(null), te = re(1), H = re({ width: 0, height: 0 }), O = re(() => {
3414
- }), A = re(S), F = re(N);
3415
- A.current = S, F.current = N;
3416
- const [ne, pe] = Le(null), [K, X] = Le(y), M = f ?? K, g = fe(
3417
- (p) => {
3418
- f === void 0 && X(p), L?.(p);
3426
+ const D = oe(null), Z = oe(null), T = oe([]), $ = oe({ from: 0, to: 0 }), ie = oe(null), ne = oe(null), V = oe(!1), ue = oe(null), S = oe(null), re = oe(1), F = oe({ width: 0, height: 0 }), j = oe(() => {
3427
+ }), C = oe(R), X = oe(w);
3428
+ C.current = R, X.current = w;
3429
+ const [se, me] = Re(null), [K, H] = Re(p), N = f ?? K, y = pe(
3430
+ (g) => {
3431
+ f === void 0 && H(g), L?.(g);
3419
3432
  },
3420
3433
  [f, L]
3421
- ), k = ke(
3434
+ ), v = ke(
3422
3435
  () => ({ up: h, down: u, line: d }),
3423
3436
  [h, u, d]
3424
- ), B = c, _ = B.some((p) => p.type === "rsi"), J = B.some((p) => p.type === "volume"), Y = fe(() => {
3425
- const p = U.current;
3426
- if (!p) return;
3427
- const x = p.getContext("2d");
3437
+ ), A = c, _ = A.some((g) => g.type === "rsi"), q = A.some((g) => g.type === "volume"), Y = pe(() => {
3438
+ const g = Z.current;
3439
+ if (!g) return;
3440
+ const x = g.getContext("2d");
3428
3441
  if (!x) return;
3429
- const { width: ee, height: P } = H.current;
3430
- if (ee === 0 || P === 0) return;
3431
- const G = te.current;
3432
- x.save(), x.setTransform(1, 0, 0, 1, 0, 0), x.clearRect(0, 0, p.width, p.height), x.scale(G, G);
3433
- const I = pl(Z.current, k), me = ln(Z.current), Q = C.current;
3434
- if (Q.length === 0) {
3435
- gl(x, ee, P, I), x.restore();
3442
+ const { width: ee, height: E } = F.current;
3443
+ if (ee === 0 || E === 0) return;
3444
+ const U = re.current;
3445
+ x.save(), x.setTransform(1, 0, 0, 1, 0, 0), x.clearRect(0, 0, g.width, g.height), x.scale(U, U);
3446
+ const I = pl(D.current, v), fe = ln(D.current), ce = T.current;
3447
+ if (ce.length === 0) {
3448
+ gl(x, ee, E, I), x.restore();
3436
3449
  return;
3437
3450
  }
3438
- const T = Nt(ee, P, _, J), { from: le, to: ge } = hl($.current, Q.length);
3439
- $.current = { from: le, to: ge };
3440
- const ie = Q.slice(Math.max(0, Math.floor(le)), Math.min(Q.length, Math.ceil(ge) + 1)), ue = (se) => {
3441
- const Ie = ge - le + 1, He = T.plotWidth / Ie;
3442
- return T.plotLeft + (se - le + 0.5) * He;
3443
- }, Ae = T.plotWidth / (ge - le + 1), De = B.map((se) => ml(se, Q)).filter((se) => se !== null).map((se) => ({ ...se, color: me(se.color) })), xe = cn(T.main, ie, De, le, ge);
3444
- Lt(x, T.plotLeft, T.plotRight, xe, I), yl(x, T, xe, i, I), x.save(), x.beginPath(), x.rect(T.plotLeft, xe.paneTop, T.plotWidth, xe.paneHeight), x.clip();
3445
- for (let se = 0; se < B.length; se++) {
3446
- const Ie = B[se], He = De[se];
3447
- He && kl(x, He, Ie, Q, le, ge, ue, xe);
3451
+ const B = Nt(ee, E, _, q), { from: le, to: ye } = hl($.current, ce.length);
3452
+ $.current = { from: le, to: ye };
3453
+ const te = ce.slice(Math.max(0, Math.floor(le)), Math.min(ce.length, Math.ceil(ye) + 1)), ae = (he) => {
3454
+ const Ie = ye - le + 1, He = B.plotWidth / Ie;
3455
+ return B.plotLeft + (he - le + 0.5) * He;
3456
+ }, Ae = B.plotWidth / (ye - le + 1), De = A.map((he) => ml(he, ce)).filter((he) => he !== null).map((he) => ({ ...he, color: fe(he.color) })), xe = cn(B.main, te, De, le, ye);
3457
+ Lt(x, B.plotLeft, B.plotRight, xe, I), yl(x, B, xe, i, I), x.save(), x.beginPath(), x.rect(B.plotLeft, xe.paneTop, B.plotWidth, xe.paneHeight), x.clip();
3458
+ for (let he = 0; he < A.length; he++) {
3459
+ const Ie = A[he], He = De[he];
3460
+ He && kl(x, He, Ie, ce, le, ye, ae, xe);
3448
3461
  }
3449
- if (o === "candle" ? vl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : o === "bar" ? bl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : xl(x, Q, le, ge, ue, xe, I.line, o === "area"), x.restore(), T.volume) {
3450
- const se = fl(T.volume, Q, le, ge);
3451
- Lt(x, T.plotLeft, T.plotRight, se, I, !0), Ft(x, T, T.volume, "Volume", I), x.save(), x.beginPath(), x.rect(T.plotLeft, se.paneTop, T.plotWidth, se.paneHeight), x.clip(), Ml(x, Q, le, ge, ue, Ae, se, { up: I.up, down: I.down }), x.restore();
3462
+ if (o === "candle" ? vl(x, ce, le, ye, ae, Ae, xe, { up: I.up, down: I.down }) : o === "bar" ? bl(x, ce, le, ye, ae, Ae, xe, { up: I.up, down: I.down }) : xl(x, ce, le, ye, ae, xe, I.line, o === "area"), x.restore(), B.volume) {
3463
+ const he = fl(B.volume, ce, le, ye);
3464
+ Lt(x, B.plotLeft, B.plotRight, he, I, !0), Ft(x, B, B.volume, "Volume", I), x.save(), x.beginPath(), x.rect(B.plotLeft, he.paneTop, B.plotWidth, he.paneHeight), x.clip(), Ml(x, ce, le, ye, ae, Ae, he, { up: I.up, down: I.down }), x.restore();
3452
3465
  }
3453
- if (T.rsi) {
3454
- const se = B.find((tt) => tt.type === "rsi"), Ie = se && se.type === "rsi" ? se.period ?? 14 : 14, He = se && se.type === "rsi" ? se.overbought ?? 70 : 70, Ge = se && se.type === "rsi" ? se.oversold ?? 30 : 30, Ee = (se && se.type === "rsi" ? se.color : void 0) ?? "var(--crk-chart-5)", xt = me(Ee), kt = tl(Q, Ie), Oe = {
3455
- paneTop: T.rsi.top,
3456
- paneBottom: T.rsi.bottom,
3457
- paneHeight: T.rsi.height,
3466
+ if (B.rsi) {
3467
+ const he = A.find((tt) => tt.type === "rsi"), Ie = he && he.type === "rsi" ? he.period ?? 14 : 14, He = he && he.type === "rsi" ? he.overbought ?? 70 : 70, Ge = he && he.type === "rsi" ? he.oversold ?? 30 : 30, Ee = (he && he.type === "rsi" ? he.color : void 0) ?? "var(--crk-chart-5)", xt = fe(Ee), kt = tl(ce, Ie), Oe = {
3468
+ paneTop: B.rsi.top,
3469
+ paneBottom: B.rsi.bottom,
3470
+ paneHeight: B.rsi.height,
3458
3471
  priceMin: 0,
3459
3472
  priceMax: 100,
3460
3473
  ticks: [Ge, 50, He]
3461
3474
  };
3462
- Lt(x, T.plotLeft, T.plotRight, Oe, I, !0), Ft(x, T, T.rsi, `RSI ${Ie}`, I), x.save(), x.beginPath(), x.rect(T.plotLeft, Oe.paneTop, T.plotWidth, Oe.paneHeight), x.clip(), Qe(x, kt, le, ge, ue, Oe, xt), x.restore(), wl(x, T, Oe, He, Ge, I);
3475
+ Lt(x, B.plotLeft, B.plotRight, Oe, I, !0), Ft(x, B, B.rsi, `RSI ${Ie}`, I), x.save(), x.beginPath(), x.rect(B.plotLeft, Oe.paneTop, B.plotWidth, Oe.paneHeight), x.clip(), Qe(x, kt, le, ye, ae, Oe, xt), x.restore(), wl(x, B, Oe, He, Ge, I);
3463
3476
  }
3464
- $l(x, T, Q, le, ge, n, I), oe.current && Nl(x, T, oe.current, Q, le, ge, ue, i, xe, M, I), x.restore();
3465
- }, [o, B, _, J, i, k, n, M]);
3466
- O.current = Y;
3467
- const b = fe(() => {
3468
- if (R.current === null) {
3477
+ $l(x, B, ce, le, ye, n, I), ie.current && Nl(x, B, ie.current, ce, le, ye, ae, i, xe, N, I), x.restore();
3478
+ }, [o, A, _, q, i, v, n, N]);
3479
+ j.current = Y;
3480
+ const J = pe(() => {
3481
+ if (S.current === null) {
3469
3482
  if (typeof requestAnimationFrame > "u") {
3470
- O.current();
3483
+ j.current();
3471
3484
  return;
3472
3485
  }
3473
- R.current = requestAnimationFrame(() => {
3474
- R.current = null, O.current();
3486
+ S.current = requestAnimationFrame(() => {
3487
+ S.current = null, j.current();
3475
3488
  });
3476
3489
  }
3477
3490
  }, []);
3478
- jt(() => {
3479
- const p = Z.current;
3480
- if (!p) return;
3491
+ zt(() => {
3492
+ const g = D.current;
3493
+ if (!g) return;
3481
3494
  const x = () => {
3482
- const P = p.getBoundingClientRect(), G = typeof window < "u" && window.devicePixelRatio || 1;
3483
- te.current = G, H.current = { width: P.width, height: P.height };
3484
- const I = U.current;
3485
- I && (I.width = Math.round(P.width * G), I.height = Math.round(P.height * G), I.style.width = `${P.width}px`, I.style.height = `${P.height}px`), b();
3495
+ const E = g.getBoundingClientRect(), U = typeof window < "u" && window.devicePixelRatio || 1;
3496
+ re.current = U, F.current = { width: E.width, height: E.height };
3497
+ const I = Z.current;
3498
+ I && (I.width = Math.round(E.width * U), I.height = Math.round(E.height * U), I.style.width = `${E.width}px`, I.style.height = `${E.height}px`), J();
3486
3499
  };
3487
3500
  if (x(), typeof ResizeObserver > "u") return;
3488
3501
  const ee = new ResizeObserver(x);
3489
- return ee.observe(p), () => ee.disconnect();
3490
- }, [b]), Ne(() => {
3491
- let p = !1;
3492
- const x = Math.floor(Date.now() / 1e3), ee = zt(n), P = r !== void 0 ? on(r) : ee * l, G = r !== void 0 ? Math.max(10, Math.ceil(P / ee)) : l, I = x - P;
3493
- C.current = [], $.current = { from: 0, to: 0 }, b(), e.getBars({ symbol: t, resolution: n, from: I, to: x, countBack: G }).then((Q) => {
3494
- if (p) return;
3495
- const T = [...Q].sort((ge, ie) => ge.time - ie.time);
3496
- C.current = T;
3497
- const le = T.length - 1;
3502
+ return ee.observe(g), () => ee.disconnect();
3503
+ }, [J]), Le(() => {
3504
+ let g = !1;
3505
+ const x = Math.floor(Date.now() / 1e3), ee = Xt(n), E = r === "MAX", U = r !== void 0 ? on(r) : ee * l, I = r !== void 0 ? Math.max(10, Math.ceil(U / ee)) : l, fe = E ? 0 : x - U;
3506
+ T.current = [], $.current = { from: 0, to: 0 }, J(), e.getBars({ symbol: t, resolution: n, from: fe, to: x, countBack: I }).then((B) => {
3507
+ if (g) return;
3508
+ const le = [...B].sort((te, ae) => te.time - ae.time);
3509
+ T.current = le;
3510
+ const ye = le.length - 1;
3498
3511
  if (r !== void 0)
3499
- $.current = { from: 0, to: le };
3512
+ $.current = { from: 0, to: ye };
3500
3513
  else {
3501
- const ge = Math.min(T.length, Math.min(200, l));
3514
+ const te = Math.min(le.length, Math.min(200, l));
3502
3515
  $.current = {
3503
- from: Math.max(0, le - ge + 1),
3504
- to: le
3516
+ from: Math.max(0, ye - te + 1),
3517
+ to: ye
3505
3518
  };
3506
3519
  }
3507
- F.current?.($.current, T), b();
3520
+ X.current?.($.current, le), J();
3508
3521
  }).catch(() => {
3509
3522
  });
3510
- const me = e.subscribeBars({
3523
+ const ce = e.subscribeBars({
3511
3524
  symbol: t,
3512
3525
  resolution: n,
3513
- onTick: (Q) => {
3514
- if (p) return;
3515
- const T = C.current, le = T[T.length - 1];
3516
- if (le && le.time === Q.time)
3517
- T[T.length - 1] = Q;
3518
- else if (!le || Q.time > le.time) {
3519
- T.push(Q);
3520
- const ge = $.current;
3521
- ge.to >= T.length - 2 && ($.current = { from: ge.from + 1, to: ge.to + 1 });
3526
+ onTick: (B) => {
3527
+ if (g) return;
3528
+ const le = T.current, ye = le[le.length - 1];
3529
+ if (ye && ye.time === B.time)
3530
+ le[le.length - 1] = B;
3531
+ else if (!ye || B.time > ye.time) {
3532
+ le.push(B);
3533
+ const te = $.current;
3534
+ te.to >= le.length - 2 && ($.current = { from: te.from + 1, to: te.to + 1 });
3522
3535
  }
3523
- b();
3536
+ J();
3524
3537
  }
3525
3538
  });
3526
- return ae.current = me, () => {
3527
- p = !0, ae.current !== null && (e.unsubscribeBars(ae.current), ae.current = null);
3539
+ return ue.current = ce, () => {
3540
+ g = !0, ue.current !== null && (e.unsubscribeBars(ue.current), ue.current = null);
3528
3541
  };
3529
3542
  }, [e, t, n, r, l]);
3530
- const E = fe((p) => {
3531
- pe(p), A.current?.(p);
3532
- }, []), V = fe((p) => {
3533
- p.currentTarget.setPointerCapture(p.pointerId);
3543
+ const k = pe((g) => {
3544
+ me(g), C.current?.(g);
3545
+ }, []), G = pe((g) => {
3546
+ g.currentTarget.setPointerCapture(g.pointerId);
3534
3547
  const x = $.current;
3535
- ce.current = { startX: p.clientX, from: x.from, to: x.to };
3536
- }, []), de = fe(
3537
- (p) => {
3538
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = p.clientY - x.top;
3539
- if (oe.current = { x: ee, y: P }, ce.current) {
3540
- const { startX: me, from: Q, to: T } = ce.current, { width: le } = H.current, ge = Math.max(1, le - Ct), ie = T - Q + 1, ue = ge / ie, Ae = -(p.clientX - me) / ue;
3541
- let De = Q + Ae, xe = T + Ae;
3542
- const se = C.current.length;
3543
- De < 0 && (Se(), De = 0, xe = ie - 1), xe > se - 1 && (xe = se - 1, De = xe - ie + 1), $.current = { from: De, to: xe }, F.current?.($.current, C.current);
3548
+ ne.current = { startX: g.clientX, from: x.from, to: x.to };
3549
+ }, []), O = pe(
3550
+ (g) => {
3551
+ const x = g.currentTarget.getBoundingClientRect(), ee = g.clientX - x.left, E = g.clientY - x.top;
3552
+ if (ie.current = { x: ee, y: E }, ne.current) {
3553
+ const { startX: fe, from: ce, to: B } = ne.current, { width: le } = F.current, ye = Math.max(1, le - Ct), te = B - ce + 1, ae = ye / te, Ae = -(g.clientX - fe) / ae;
3554
+ let De = ce + Ae, xe = B + Ae;
3555
+ const he = T.current.length;
3556
+ De < 0 && (Se(), De = 0, xe = te - 1), xe > he - 1 && (xe = he - 1, De = xe - te + 1), $.current = { from: De, to: xe }, X.current?.($.current, T.current);
3544
3557
  }
3545
- const G = Nt(x.width, x.height, _, J), I = $.current;
3546
- if (ee >= G.plotLeft && ee <= G.plotRight) {
3547
- const me = I.to - I.from + 1, Q = G.plotWidth / me, T = Math.round(I.from + (ee - G.plotLeft) / Q - 0.5), le = C.current, ge = Math.max(0, Math.min(le.length - 1, T)), ie = le[ge] ?? null, ue = Ll(P, G, le, I.from, I.to);
3548
- E({ barIndex: ge, bar: ie, priceAtCursor: ue });
3558
+ const U = Nt(x.width, x.height, _, q), I = $.current;
3559
+ if (ee >= U.plotLeft && ee <= U.plotRight) {
3560
+ const fe = I.to - I.from + 1, ce = U.plotWidth / fe, B = Math.round(I.from + (ee - U.plotLeft) / ce - 0.5), le = T.current, ye = Math.max(0, Math.min(le.length - 1, B)), te = le[ye] ?? null, ae = Ll(E, U, le, I.from, I.to);
3561
+ k({ barIndex: ye, bar: te, priceAtCursor: ae });
3549
3562
  } else
3550
- E(null);
3551
- b();
3563
+ k(null);
3564
+ J();
3552
3565
  },
3553
- [_, J, b, E]
3554
- ), he = fe((p) => {
3555
- p.currentTarget.releasePointerCapture(p.pointerId), ce.current = null;
3556
- }, []), ye = fe(() => {
3557
- oe.current = null, ce.current = null, E(null), b();
3558
- }, [b, E]), be = fe(
3559
- (p) => {
3560
- p.preventDefault();
3561
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = Nt(x.width, x.height, _, J), G = $.current, I = C.current;
3566
+ [_, q, J, k]
3567
+ ), de = pe((g) => {
3568
+ g.currentTarget.releasePointerCapture(g.pointerId), ne.current = null;
3569
+ }, []), ge = pe(() => {
3570
+ ie.current = null, ne.current = null, k(null), J();
3571
+ }, [J, k]), be = pe(
3572
+ (g) => {
3573
+ g.preventDefault();
3574
+ const x = g.currentTarget.getBoundingClientRect(), ee = g.clientX - x.left, E = Nt(x.width, x.height, _, q), U = $.current, I = T.current;
3562
3575
  if (I.length === 0) return;
3563
- const me = G.to - G.from + 1, Q = p.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), T = Math.max(
3564
- P.plotWidth / cl,
3565
- Math.min(I.length, P.plotWidth / il, me * Q)
3566
- ), le = G.from + (ee - P.plotLeft) / (P.plotWidth / me), ge = (le - G.from) / me;
3567
- let ie = le - ge * T, ue = ie + T - 1;
3568
- ie < 0 && (ie = 0, ue = T - 1), ue > I.length - 1 && (ue = I.length - 1, ie = ue - T + 1), $.current = { from: ie, to: ue }, F.current?.($.current, I), b();
3576
+ const fe = U.to - U.from + 1, ce = g.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), B = Math.max(
3577
+ E.plotWidth / cl,
3578
+ Math.min(I.length, E.plotWidth / il, fe * ce)
3579
+ ), le = U.from + (ee - E.plotLeft) / (E.plotWidth / fe), ye = (le - U.from) / fe;
3580
+ let te = le - ye * B, ae = te + B - 1;
3581
+ te < 0 && (te = 0, ae = B - 1), ae > I.length - 1 && (ae = I.length - 1, te = ae - B + 1), $.current = { from: te, to: ae }, X.current?.($.current, I), J();
3569
3582
  },
3570
- [_, J, b]
3571
- ), Ce = fe(
3572
- (p) => {
3573
- const x = $.current, ee = x.to - x.from + 1, P = C.current;
3574
- if (P.length === 0) return;
3575
- let G = 0;
3576
- if (p.key === "ArrowLeft") G = -Math.max(1, Math.floor(ee * 0.1));
3577
- else if (p.key === "ArrowRight") G = Math.max(1, Math.floor(ee * 0.1));
3583
+ [_, q, J]
3584
+ ), Ce = pe(
3585
+ (g) => {
3586
+ const x = $.current, ee = x.to - x.from + 1, E = T.current;
3587
+ if (E.length === 0) return;
3588
+ let U = 0;
3589
+ if (g.key === "ArrowLeft") U = -Math.max(1, Math.floor(ee * 0.1));
3590
+ else if (g.key === "ArrowRight") U = Math.max(1, Math.floor(ee * 0.1));
3578
3591
  else return;
3579
- p.preventDefault();
3580
- let I = x.from + G, me = x.to + G;
3581
- I < 0 && (I = 0, me = ee - 1), me > P.length - 1 && (me = P.length - 1, I = me - ee + 1), $.current = { from: I, to: me }, F.current?.($.current, P), b();
3592
+ g.preventDefault();
3593
+ let I = x.from + U, fe = x.to + U;
3594
+ I < 0 && (I = 0, fe = ee - 1), fe > E.length - 1 && (fe = E.length - 1, I = fe - ee + 1), $.current = { from: I, to: fe }, X.current?.($.current, E), J();
3582
3595
  },
3583
- [b]
3584
- ), Se = fe(() => {
3585
- if (q.current) return;
3586
- const p = C.current;
3587
- if (p.length === 0) return;
3588
- q.current = !0;
3589
- const x = zt(n), ee = p[0].time, P = ee - x * l, G = ee - x;
3590
- e.getBars({ symbol: t, resolution: n, from: P, to: G, countBack: l }).then((I) => {
3596
+ [J]
3597
+ ), Se = pe(() => {
3598
+ if (V.current) return;
3599
+ const g = T.current;
3600
+ if (g.length === 0) return;
3601
+ V.current = !0;
3602
+ const x = Xt(n), ee = g[0].time, E = ee - x * l, U = ee - x;
3603
+ e.getBars({ symbol: t, resolution: n, from: E, to: U, countBack: l }).then((I) => {
3591
3604
  if (I.length === 0) {
3592
- q.current = !1;
3605
+ V.current = !1;
3593
3606
  return;
3594
3607
  }
3595
- const Q = [...I].sort((le, ge) => le.time - ge.time).filter((le) => le.time < ee), T = $.current;
3596
- C.current = [...Q, ...p], $.current = { from: T.from + Q.length, to: T.to + Q.length }, q.current = !1, b();
3608
+ const ce = [...I].sort((le, ye) => le.time - ye.time).filter((le) => le.time < ee), B = $.current;
3609
+ T.current = [...ce, ...g], $.current = { from: B.from + ce.length, to: B.to + ce.length }, V.current = !1, J();
3597
3610
  }).catch(() => {
3598
- q.current = !1;
3611
+ V.current = !1;
3599
3612
  });
3600
- }, [e, t, n, l, b]);
3613
+ }, [e, t, n, l, J]);
3601
3614
  return /* @__PURE__ */ z(
3602
3615
  "div",
3603
3616
  {
3604
- ref: Z,
3605
- className: m(w.root, D),
3606
- style: { ...j, height: a, position: "relative" },
3617
+ ref: D,
3618
+ className: m(M.root, Q),
3619
+ style: { ...W, height: a, position: "relative" },
3607
3620
  tabIndex: 0,
3608
3621
  role: "figure",
3609
3622
  "aria-label": `${t} ${n} chart`,
@@ -3612,20 +3625,20 @@ function Vl({
3612
3625
  /* @__PURE__ */ s(
3613
3626
  "canvas",
3614
3627
  {
3615
- ref: U,
3616
- className: w.svg,
3617
- onPointerDown: V,
3618
- onPointerMove: de,
3619
- onPointerUp: he,
3620
- onPointerLeave: ye,
3628
+ ref: Z,
3629
+ className: M.svg,
3630
+ onPointerDown: G,
3631
+ onPointerMove: O,
3632
+ onPointerUp: de,
3633
+ onPointerLeave: ge,
3621
3634
  onWheel: be,
3622
- style: { cursor: ce.current ? "grabbing" : "crosshair", touchAction: "none" }
3635
+ style: { cursor: ne.current ? "grabbing" : "crosshair", touchAction: "none" }
3623
3636
  }
3624
3637
  ),
3625
3638
  /* @__PURE__ */ z(
3626
3639
  "div",
3627
3640
  {
3628
- className: w.tradingHeader,
3641
+ className: M.tradingHeader,
3629
3642
  style: {
3630
3643
  position: "absolute",
3631
3644
  top: ol,
@@ -3641,25 +3654,25 @@ function Vl({
3641
3654
  /* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
3642
3655
  /* @__PURE__ */ s("strong", { children: t }),
3643
3656
  /* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
3644
- ne?.bar && /* @__PURE__ */ z("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3657
+ se?.bar && /* @__PURE__ */ z("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3645
3658
  "O ",
3646
- ne.bar.open.toFixed(i),
3659
+ se.bar.open.toFixed(i),
3647
3660
  " · H ",
3648
- ne.bar.high.toFixed(i),
3661
+ se.bar.high.toFixed(i),
3649
3662
  " · L",
3650
3663
  " ",
3651
- ne.bar.low.toFixed(i),
3664
+ se.bar.low.toFixed(i),
3652
3665
  " · C ",
3653
- ne.bar.close.toFixed(i)
3666
+ se.bar.close.toFixed(i)
3654
3667
  ] })
3655
3668
  ] }),
3656
- v && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3669
+ b && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3657
3670
  qt,
3658
3671
  {
3659
3672
  position: "bottom",
3660
3673
  asChild: !0,
3661
3674
  trigger: /* @__PURE__ */ s(
3662
- Yt,
3675
+ Ut,
3663
3676
  {
3664
3677
  variant: "ghost",
3665
3678
  size: "sm",
@@ -3671,8 +3684,8 @@ function Vl({
3671
3684
  content: /* @__PURE__ */ s(
3672
3685
  dl,
3673
3686
  {
3674
- timezone: M,
3675
- onTimezoneChange: g
3687
+ timezone: N,
3688
+ onTimezoneChange: y
3676
3689
  }
3677
3690
  )
3678
3691
  }
@@ -3745,9 +3758,9 @@ function Nt(e, t, n, r) {
3745
3758
  const c = Math.max(0, e - Ct), i = rl, l = Math.max(i, t - At), a = Math.max(0, c - 0), h = Math.max(0, l - i);
3746
3759
  let u = h, d = i;
3747
3760
  const f = { top: i, bottom: l, height: h };
3748
- let y = null, L = null;
3749
- const v = n ? Ht.rsi : 0, S = r ? Ht.volume : 0;
3750
- return u = h * (1 - v - S), f.top = d, f.height = u, f.bottom = f.top + u, d = f.bottom, n && (y = { top: d, height: h * v, bottom: d + h * v }, d = y.bottom), r && (L = { top: d, height: h * S, bottom: d + h * S }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: f, rsi: y, volume: L };
3761
+ let p = null, L = null;
3762
+ const b = n ? Ht.rsi : 0, R = r ? Ht.volume : 0;
3763
+ return u = h * (1 - b - R), f.top = d, f.height = u, f.bottom = f.top + u, d = f.bottom, n && (p = { top: d, height: h * b, bottom: d + h * b }, d = p.bottom), r && (L = { top: d, height: h * R, bottom: d + h * R }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: f, rsi: p, volume: L };
3751
3764
  }
3752
3765
  function hl(e, t) {
3753
3766
  if (t === 0) return { from: 0, to: 0 };
@@ -3782,11 +3795,11 @@ function cn(e, t, n, r, o) {
3782
3795
  d.low < c && (c = d.low), d.high > i && (i = d.high);
3783
3796
  for (const d of n) {
3784
3797
  const f = d.kind === "line" ? [d.values] : [d.upper, d.lower];
3785
- for (const y of f) {
3786
- const L = Math.max(0, Math.floor(r)), v = Math.min(y.length - 1, Math.ceil(o));
3787
- for (let S = L; S <= v; S++) {
3788
- const N = y[S];
3789
- N != null && (N < c && (c = N), N > i && (i = N));
3798
+ for (const p of f) {
3799
+ const L = Math.max(0, Math.floor(r)), b = Math.min(p.length - 1, Math.ceil(o));
3800
+ for (let R = L; R <= b; R++) {
3801
+ const w = p[R];
3802
+ w != null && (w < c && (c = w), w > i && (i = w));
3790
3803
  }
3791
3804
  }
3792
3805
  }
@@ -3804,7 +3817,7 @@ function fl(e, t, n, r) {
3804
3817
  const l = qe(0, o || 1, 3), a = Math.max(l[l.length - 1], o);
3805
3818
  return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: 0, priceMax: a, ticks: l };
3806
3819
  }
3807
- function we(e, t) {
3820
+ function $e(e, t) {
3808
3821
  const n = (e - t.priceMin) / (t.priceMax - t.priceMin || 1);
3809
3822
  return t.paneBottom - n * t.paneHeight;
3810
3823
  }
@@ -3844,7 +3857,7 @@ function gl(e, t, n, r) {
3844
3857
  function Lt(e, t, n, r, o, c = !1) {
3845
3858
  e.strokeStyle = o.grid, e.lineWidth = 1, e.beginPath();
3846
3859
  for (const i of r.ticks) {
3847
- const l = Math.round(we(i, r)) + 0.5;
3860
+ const l = Math.round($e(i, r)) + 0.5;
3848
3861
  e.moveTo(t, l), e.lineTo(n, l);
3849
3862
  }
3850
3863
  e.stroke();
@@ -3852,35 +3865,35 @@ function Lt(e, t, n, r, o, c = !1) {
3852
3865
  function yl(e, t, n, r, o) {
3853
3866
  e.fillStyle = o.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle";
3854
3867
  for (const c of n.ticks) {
3855
- const i = we(c, n);
3868
+ const i = $e(c, n);
3856
3869
  e.fillText(c.toFixed(r), t.plotRight + 6, i);
3857
3870
  }
3858
3871
  }
3859
3872
  function vl(e, t, n, r, o, c, i, l) {
3860
3873
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
3861
3874
  for (let d = a; d <= h; d++) {
3862
- const f = t[d], y = o(d), L = we(f.open, i), v = we(f.close, i), S = we(f.high, i), N = we(f.low, i), j = f.close >= f.open ? l.up : l.down;
3863
- e.strokeStyle = j, e.fillStyle = j, e.beginPath();
3864
- const Z = Math.round(y) + 0.5;
3865
- e.moveTo(Z, S), e.lineTo(Z, N), e.stroke();
3866
- const U = Math.min(L, v), C = Math.max(1, Math.abs(v - L));
3867
- e.fillRect(Math.round(y - u / 2), Math.round(U), Math.round(u), Math.round(C));
3875
+ const f = t[d], p = o(d), L = $e(f.open, i), b = $e(f.close, i), R = $e(f.high, i), w = $e(f.low, i), W = f.close >= f.open ? l.up : l.down;
3876
+ e.strokeStyle = W, e.fillStyle = W, e.beginPath();
3877
+ const D = Math.round(p) + 0.5;
3878
+ e.moveTo(D, R), e.lineTo(D, w), e.stroke();
3879
+ const Z = Math.min(L, b), T = Math.max(1, Math.abs(b - L));
3880
+ e.fillRect(Math.round(p - u / 2), Math.round(Z), Math.round(u), Math.round(T));
3868
3881
  }
3869
3882
  }
3870
3883
  function bl(e, t, n, r, o, c, i, l) {
3871
3884
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(2, Math.min(c * 0.4, 8));
3872
3885
  e.lineWidth = Math.max(1, Math.min(2, c * 0.18)), e.lineCap = "butt";
3873
3886
  for (let d = a; d <= h; d++) {
3874
- const f = t[d], y = Math.round(o(d)) + 0.5, L = we(f.high, i), v = we(f.low, i), S = we(f.open, i), N = we(f.close, i), D = f.close >= f.open;
3875
- e.strokeStyle = D ? l.up : l.down, e.beginPath(), e.moveTo(y, L), e.lineTo(y, v), e.moveTo(y - u, S), e.lineTo(y, S), e.moveTo(y, N), e.lineTo(y + u, N), e.stroke();
3887
+ const f = t[d], p = Math.round(o(d)) + 0.5, L = $e(f.high, i), b = $e(f.low, i), R = $e(f.open, i), w = $e(f.close, i), Q = f.close >= f.open;
3888
+ e.strokeStyle = Q ? l.up : l.down, e.beginPath(), e.moveTo(p, L), e.lineTo(p, b), e.moveTo(p - u, R), e.lineTo(p, R), e.moveTo(p, w), e.lineTo(p + u, w), e.stroke();
3876
3889
  }
3877
3890
  }
3878
3891
  function xl(e, t, n, r, o, c, i, l) {
3879
3892
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
3880
3893
  if (!(h <= a)) {
3881
- e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), we(t[a].close, c));
3894
+ e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), $e(t[a].close, c));
3882
3895
  for (let u = a + 1; u <= h; u++)
3883
- e.lineTo(o(u), we(t[u].close, c));
3896
+ e.lineTo(o(u), $e(t[u].close, c));
3884
3897
  e.stroke(), l && (e.globalAlpha = 0.18, e.fillStyle = i, e.lineTo(o(h), c.paneBottom), e.lineTo(o(a), c.paneBottom), e.closePath(), e.fill(), e.globalAlpha = 1);
3885
3898
  }
3886
3899
  }
@@ -3895,12 +3908,12 @@ function kl(e, t, n, r, o, c, i, l) {
3895
3908
  for (let d = a; d <= h; d++) {
3896
3909
  const f = t.upper[d];
3897
3910
  if (f == null) continue;
3898
- const y = i(d), L = we(f, l);
3899
- u ? e.lineTo(y, L) : (e.moveTo(y, L), u = !0);
3911
+ const p = i(d), L = $e(f, l);
3912
+ u ? e.lineTo(p, L) : (e.moveTo(p, L), u = !0);
3900
3913
  }
3901
3914
  for (let d = h; d >= a; d--) {
3902
3915
  const f = t.lower[d];
3903
- f != null && e.lineTo(i(d), we(f, l));
3916
+ f != null && e.lineTo(i(d), $e(f, l));
3904
3917
  }
3905
3918
  e.closePath(), e.fill(), e.globalAlpha = 1, Qe(e, t.upper, o, c, i, l, t.color), Qe(e, t.lower, o, c, i, l, t.color), Qe(e, t.middle, o, c, i, l, t.color);
3906
3919
  }
@@ -3914,30 +3927,30 @@ function Qe(e, t, n, r, o, c, i) {
3914
3927
  l = !1;
3915
3928
  continue;
3916
3929
  }
3917
- const f = o(u), y = we(d, c);
3918
- l ? e.lineTo(f, y) : (e.moveTo(f, y), l = !0);
3930
+ const f = o(u), p = $e(d, c);
3931
+ l ? e.lineTo(f, p) : (e.moveTo(f, p), l = !0);
3919
3932
  }
3920
3933
  e.stroke();
3921
3934
  }
3922
3935
  function Ml(e, t, n, r, o, c, i, l) {
3923
3936
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
3924
3937
  for (let d = a; d <= h; d++) {
3925
- const f = t[d], y = f.volume ?? 0;
3926
- if (y === 0) continue;
3938
+ const f = t[d], p = f.volume ?? 0;
3939
+ if (p === 0) continue;
3927
3940
  const L = f.close >= f.open;
3928
3941
  e.fillStyle = L ? l.up : l.down, e.globalAlpha = 0.55;
3929
- const v = we(y, i), S = i.paneBottom - v;
3930
- e.fillRect(Math.round(o(d) - u / 2), Math.round(v), Math.round(u), Math.round(S));
3942
+ const b = $e(p, i), R = i.paneBottom - b;
3943
+ e.fillRect(Math.round(o(d) - u / 2), Math.round(b), Math.round(u), Math.round(R));
3931
3944
  }
3932
3945
  e.globalAlpha = 1;
3933
3946
  }
3934
3947
  function wl(e, t, n, r, o, c) {
3935
3948
  e.strokeStyle = c.grid, e.setLineDash([3, 3]), e.beginPath();
3936
3949
  for (const i of [r, o]) {
3937
- const l = Math.round(we(i, n)) + 0.5;
3950
+ const l = Math.round($e(i, n)) + 0.5;
3938
3951
  e.moveTo(t.plotLeft, l), e.lineTo(t.plotRight, l);
3939
3952
  }
3940
- e.stroke(), e.setLineDash([]), e.fillStyle = c.axis, e.font = "10px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(String(r), t.plotRight + 6, we(r, n)), e.fillText(String(o), t.plotRight + 6, we(o, n));
3953
+ e.stroke(), e.setLineDash([]), e.fillStyle = c.axis, e.font = "10px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(String(r), t.plotRight + 6, $e(r, n)), e.fillText(String(o), t.plotRight + 6, $e(o, n));
3941
3954
  }
3942
3955
  function Ft(e, t, n, r, o) {
3943
3956
  e.fillStyle = o.textMuted, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "top", e.fillText(r, t.plotLeft + 6, n.top + 4);
@@ -3946,26 +3959,26 @@ function $l(e, t, n, r, o, c, i) {
3946
3959
  const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
3947
3960
  e.fillStyle = i.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
3948
3961
  const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), f = t.plotBottom + At / 2;
3949
- for (let y = u; y <= d; y += h) {
3950
- const L = n[y], v = t.plotLeft + (y - r + 0.5) * a;
3951
- e.fillText(Sl(L.time, c), v, f);
3962
+ for (let p = u; p <= d; p += h) {
3963
+ const L = n[p], b = t.plotLeft + (p - r + 0.5) * a;
3964
+ e.fillText(Rl(L.time, c), b, f);
3952
3965
  }
3953
3966
  }
3954
3967
  function Nl(e, t, n, r, o, c, i, l, a, h, u) {
3955
3968
  if (n.x < t.plotLeft || n.x > t.plotRight) return;
3956
- const d = c - o + 1, f = t.plotWidth / d, y = o + (n.x - t.plotLeft) / f - 0.5, L = Math.round(y), v = Math.max(0, Math.min(r.length - 1, L)), S = i(v);
3957
- if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(S + 0.5, t.plotTop), e.lineTo(S + 0.5, t.plotBottom), e.moveTo(t.plotLeft, n.y + 0.5), e.lineTo(t.plotRight, n.y + 0.5), e.stroke(), e.setLineDash([]), n.y >= a.paneTop && n.y <= a.paneBottom) {
3958
- const N = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3959
- e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Ct, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(N.toFixed(l), t.plotRight + 6, n.y);
3969
+ const d = c - o + 1, f = t.plotWidth / d, p = o + (n.x - t.plotLeft) / f - 0.5, L = Math.round(p), b = Math.max(0, Math.min(r.length - 1, L)), R = i(b);
3970
+ if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(R + 0.5, t.plotTop), e.lineTo(R + 0.5, t.plotBottom), e.moveTo(t.plotLeft, n.y + 0.5), e.lineTo(t.plotRight, n.y + 0.5), e.stroke(), e.setLineDash([]), n.y >= a.paneTop && n.y <= a.paneBottom) {
3971
+ const w = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3972
+ e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Ct, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(w.toFixed(l), t.plotRight + 6, n.y);
3960
3973
  }
3961
- if (r[v]) {
3962
- const N = sn(r[v].time, h);
3974
+ if (r[b]) {
3975
+ const w = sn(r[b].time, h);
3963
3976
  e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
3964
- const Z = e.measureText(N).width + 8 * 2, U = At, C = Math.max(
3977
+ const D = e.measureText(w).width + 8 * 2, Z = At, T = Math.max(
3965
3978
  t.plotLeft,
3966
- Math.min(t.plotRight - Z, S - Z / 2)
3979
+ Math.min(t.plotRight - D, R - D / 2)
3967
3980
  ), $ = t.plotBottom;
3968
- e.fillStyle = u.text, e.fillRect(C, $, Z, U), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(N, C + Z / 2, $ + U / 2);
3981
+ e.fillStyle = u.text, e.fillRect(T, $, D, Z), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(w, T + D / 2, $ + Z / 2);
3969
3982
  }
3970
3983
  e.restore();
3971
3984
  }
@@ -3973,14 +3986,14 @@ function Ll(e, t, n, r, o, c, i) {
3973
3986
  const l = n.slice(Math.max(0, Math.floor(r)), Math.min(n.length, Math.ceil(o) + 1)), a = cn(t.main, l, [], r, o);
3974
3987
  return e < a.paneTop || e > a.paneBottom ? null : a.priceMax - (e - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3975
3988
  }
3976
- function Sl(e, t) {
3989
+ function Rl(e, t) {
3977
3990
  const n = new Date(e * 1e3);
3978
3991
  return t === "D" || t === "W" || t === "M" ? `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())}` : `${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}`;
3979
3992
  }
3980
3993
  function sn(e, t) {
3981
3994
  const n = new Date(e * 1e3);
3982
3995
  if (t === "local")
3983
- return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${Rl(n)}`;
3996
+ return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${Sl(n)}`;
3984
3997
  if (t === "utc")
3985
3998
  return `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())} ${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}:${Te(n.getUTCSeconds())} UTC`;
3986
3999
  try {
@@ -4001,14 +4014,14 @@ function sn(e, t) {
4001
4014
  return sn(e, "utc");
4002
4015
  }
4003
4016
  }
4004
- function Rl(e) {
4017
+ function Sl(e) {
4005
4018
  const t = -e.getTimezoneOffset(), n = t >= 0 ? "+" : "-", r = Math.abs(t);
4006
4019
  return `${n}${Te(Math.floor(r / 60))}:${Te(r % 60)}`;
4007
4020
  }
4008
4021
  function Te(e) {
4009
4022
  return e < 10 ? `0${e}` : String(e);
4010
4023
  }
4011
- function zt(e) {
4024
+ function Xt(e) {
4012
4025
  if (e === "D") return 86400;
4013
4026
  if (e === "W") return 86400 * 7;
4014
4027
  if (e === "M") return 86400 * 30;
@@ -4035,7 +4048,7 @@ function Tl(e, t) {
4035
4048
  }
4036
4049
  return n;
4037
4050
  }
4038
- const Cl = $e(
4051
+ const Cl = Ne(
4039
4052
  ({
4040
4053
  data: e,
4041
4054
  width: t = 80,
@@ -4049,16 +4062,16 @@ const Cl = $e(
4049
4062
  className: h,
4050
4063
  style: u
4051
4064
  }, d) => {
4052
- const { line: f, area: y, last: L } = ke(() => {
4065
+ const { line: f, area: p, last: L } = ke(() => {
4053
4066
  if (e.length === 0) return { line: "", area: "", last: null };
4054
- const v = o, S = Math.max(1, t - v * 2), N = Math.max(1, n - v * 2), [D, j] = bt(e), Z = Je([0, Math.max(1, e.length - 1)], [v, v + S]), U = Je([D, j], [v + N, v]), C = e.map((ce, q) => ({ x: Z(q), y: U(ce) })), $ = Tl(C, c), oe = i ? `${$} L ${C[C.length - 1].x} ${v + N} L ${C[0].x} ${v + N} Z` : "";
4055
- return { line: $, area: oe, last: C[C.length - 1] };
4067
+ const b = o, R = Math.max(1, t - b * 2), w = Math.max(1, n - b * 2), [Q, W] = bt(e), D = Je([0, Math.max(1, e.length - 1)], [b, b + R]), Z = Je([Q, W], [b + w, b]), T = e.map((ne, V) => ({ x: D(V), y: Z(ne) })), $ = Tl(T, c), ie = i ? `${$} L ${T[T.length - 1].x} ${b + w} L ${T[0].x} ${b + w} Z` : "";
4068
+ return { line: $, area: ie, last: T[T.length - 1] };
4056
4069
  }, [e, t, n, o, c, i]);
4057
4070
  return /* @__PURE__ */ z(
4058
4071
  "svg",
4059
4072
  {
4060
4073
  ref: d,
4061
- className: m(w.sparkline, h),
4074
+ className: m(M.sparkline, h),
4062
4075
  style: u,
4063
4076
  width: t,
4064
4077
  height: n,
@@ -4066,7 +4079,7 @@ const Cl = $e(
4066
4079
  role: "img",
4067
4080
  "aria-label": a,
4068
4081
  children: [
4069
- i && y && /* @__PURE__ */ s("path", { d: y, fill: r, opacity: 0.18 }),
4082
+ i && p && /* @__PURE__ */ s("path", { d: p, fill: r, opacity: 0.18 }),
4070
4083
  f && /* @__PURE__ */ s(
4071
4084
  "path",
4072
4085
  {
@@ -4087,9 +4100,9 @@ const Cl = $e(
4087
4100
  Cl.displayName = "Sparkline";
4088
4101
  export {
4089
4102
  Fl as AreaChart,
4090
- zl as BarChart,
4091
- Yt as Button,
4092
- zi as Checkbox,
4103
+ Xl as BarChart,
4104
+ Ut as Button,
4105
+ Xi as Checkbox,
4093
4106
  Vt as Dropdown,
4094
4107
  uo as DropdownItem,
4095
4108
  Pl as Form,
@@ -4097,15 +4110,15 @@ export {
4097
4110
  Hl as FormRow,
4098
4111
  ri as Input,
4099
4112
  Ol as LineChart,
4100
- zn as Link,
4113
+ Xn as Link,
4101
4114
  br as List,
4102
4115
  xr as ListItem,
4103
4116
  yt as Modal,
4104
- jl as PieChart,
4117
+ zl as PieChart,
4105
4118
  qt as Popover,
4106
- Xl as RadarChart,
4119
+ jl as RadarChart,
4107
4120
  Vi as Radio,
4108
- Yi as RadioGroup,
4121
+ Ui as RadioGroup,
4109
4122
  Pi as Select,
4110
4123
  Cl as Sparkline,
4111
4124
  El as Table,
@@ -4118,11 +4131,11 @@ export {
4118
4131
  on as periodToSeconds,
4119
4132
  tl as rsi,
4120
4133
  Qc as sma,
4121
- Yl as suggestPeriodForResolution,
4122
- Ul as suggestResolutionForPeriod,
4134
+ Ul as suggestPeriodForResolution,
4135
+ Yl as suggestResolutionForPeriod,
4123
4136
  xo as useClickOutside,
4124
4137
  Mo as useFocusTrap,
4125
- Rt as useKeyboard,
4126
- Ur as useTableSort,
4138
+ St as useKeyboard,
4139
+ Yr as useTableSort,
4127
4140
  _l as volumeSeries
4128
4141
  };