@overdoser/react-toolkit 0.0.7 → 0.0.9
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/AGENTS.md +1 -0
- package/components/Popover/Popover.d.ts +16 -1
- package/components/inputs/Select/Select.d.ts +18 -0
- package/index.js +1587 -1528
- package/llms.txt +15 -2
- package/manifest.json +7 -2
- package/package.json +1 -1
- package/recipes/tag-input.tsx +71 -0
package/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { forwardRef as $e, createElement as
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { FormProvider as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
function
|
|
1
|
+
import { forwardRef as $e, createElement as ln, useState as Se, useCallback as de, useMemo as ke, useEffect as Be, useRef as ne, useId as Ye, isValidElement as sn, cloneElement as jt, createContext as Xt, useContext as ft, useImperativeHandle as an, useLayoutEffect as dn } from "react";
|
|
2
|
+
import { jsxs as F, jsx as s, Fragment as Xe } from "react/jsx-runtime";
|
|
3
|
+
import { FormProvider as un, useFormContext as hn, useController as mn } from "react-hook-form";
|
|
4
|
+
import { createPortal as fn } from "react-dom";
|
|
5
|
+
function _t(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 =
|
|
10
|
+
for (t = 0; t < o; t++) e[t] && (n = _t(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 f() {
|
|
15
|
-
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t =
|
|
15
|
+
for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = _t(e)) && (r && (r += " "), r += t);
|
|
16
16
|
return r;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
root:
|
|
20
|
-
loading:
|
|
21
|
-
primary:
|
|
22
|
-
secondary:
|
|
23
|
-
danger:
|
|
24
|
-
ghost:
|
|
25
|
-
sm:
|
|
26
|
-
md:
|
|
27
|
-
lg:
|
|
28
|
-
fullWidth:
|
|
29
|
-
iconOnly:
|
|
30
|
-
content:
|
|
31
|
-
shimmer:
|
|
32
|
-
loadingShimmer:
|
|
33
|
-
shimmerSweep:
|
|
34
|
-
dots:
|
|
35
|
-
loadingDots:
|
|
36
|
-
dot:
|
|
37
|
-
dotBounce:
|
|
38
|
-
loadingBorder:
|
|
39
|
-
borderSpin:
|
|
40
|
-
},
|
|
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", Tn = "crk-loadingShimmer-BVvFw", Rn = "crk-shimmerSweep-uiZ01", Cn = "crk-dots-U8wss", An = "crk-loadingDots-eKv64", Bn = "crk-dot-Owuk1", Dn = "crk-dotBounce-FwdcC", In = "crk-loadingBorder-9ULFw", En = "crk-borderSpin-EJ2gW", Ae = {
|
|
19
|
+
root: pn,
|
|
20
|
+
loading: gn,
|
|
21
|
+
primary: yn,
|
|
22
|
+
secondary: vn,
|
|
23
|
+
danger: bn,
|
|
24
|
+
ghost: xn,
|
|
25
|
+
sm: kn,
|
|
26
|
+
md: Mn,
|
|
27
|
+
lg: wn,
|
|
28
|
+
fullWidth: $n,
|
|
29
|
+
iconOnly: Nn,
|
|
30
|
+
content: Ln,
|
|
31
|
+
shimmer: Sn,
|
|
32
|
+
loadingShimmer: Tn,
|
|
33
|
+
shimmerSweep: Rn,
|
|
34
|
+
dots: Cn,
|
|
35
|
+
loadingDots: An,
|
|
36
|
+
dot: Bn,
|
|
37
|
+
dotBounce: Dn,
|
|
38
|
+
loadingBorder: In,
|
|
39
|
+
borderSpin: En
|
|
40
|
+
}, Pn = {
|
|
41
41
|
dots: Ae.loadingDots,
|
|
42
42
|
shimmer: Ae.loadingShimmer,
|
|
43
43
|
border: Ae.loadingBorder
|
|
@@ -55,7 +55,7 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
|
|
|
55
55
|
style: h,
|
|
56
56
|
children: u,
|
|
57
57
|
...d
|
|
58
|
-
}, m) => /* @__PURE__ */
|
|
58
|
+
}, m) => /* @__PURE__ */ F(
|
|
59
59
|
"button",
|
|
60
60
|
{
|
|
61
61
|
ref: m,
|
|
@@ -66,7 +66,7 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
|
|
|
66
66
|
o && Ae.fullWidth,
|
|
67
67
|
i && Ae.iconOnly,
|
|
68
68
|
n && Ae.loading,
|
|
69
|
-
n &&
|
|
69
|
+
n && Pn[r],
|
|
70
70
|
l?.root,
|
|
71
71
|
a
|
|
72
72
|
),
|
|
@@ -77,7 +77,7 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
|
|
|
77
77
|
children: [
|
|
78
78
|
/* @__PURE__ */ s("div", { className: f(Ae.shimmer, l?.shimmer) }),
|
|
79
79
|
/* @__PURE__ */ s("span", { className: f(Ae.content, l?.content), children: u }),
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ F("span", { className: f(Ae.dots, l?.dots), "aria-hidden": "true", children: [
|
|
81
81
|
/* @__PURE__ */ s("span", { className: f(Ae.dot, l?.dot) }),
|
|
82
82
|
/* @__PURE__ */ s("span", { className: f(Ae.dot, l?.dot) }),
|
|
83
83
|
/* @__PURE__ */ s("span", { className: f(Ae.dot, l?.dot) })
|
|
@@ -87,13 +87,13 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
|
|
|
87
87
|
)
|
|
88
88
|
);
|
|
89
89
|
Ut.displayName = "Button";
|
|
90
|
-
const
|
|
91
|
-
root:
|
|
90
|
+
const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn = "crk-srOnly-LGQgs", $t = {
|
|
91
|
+
root: Wn,
|
|
92
92
|
default: "crk-default-3TBlr",
|
|
93
|
-
muted:
|
|
94
|
-
danger:
|
|
95
|
-
srOnly:
|
|
96
|
-
},
|
|
93
|
+
muted: Hn,
|
|
94
|
+
danger: On,
|
|
95
|
+
srOnly: Fn
|
|
96
|
+
}, jn = $e(
|
|
97
97
|
({
|
|
98
98
|
variant: e = "default",
|
|
99
99
|
external: t = !1,
|
|
@@ -101,7 +101,7 @@ const Pn = "crk-root-2j4Vp", Wn = "crk-muted-vReNc", Hn = "crk-danger-ugf9r", On
|
|
|
101
101
|
style: r,
|
|
102
102
|
children: o,
|
|
103
103
|
...i
|
|
104
|
-
}, c) => /* @__PURE__ */
|
|
104
|
+
}, c) => /* @__PURE__ */ F(
|
|
105
105
|
"a",
|
|
106
106
|
{
|
|
107
107
|
ref: c,
|
|
@@ -119,32 +119,32 @@ const Pn = "crk-root-2j4Vp", Wn = "crk-muted-vReNc", Hn = "crk-danger-ugf9r", On
|
|
|
119
119
|
}
|
|
120
120
|
)
|
|
121
121
|
);
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
root:
|
|
125
|
-
h1:
|
|
122
|
+
jn.displayName = "Link";
|
|
123
|
+
const Xn = "crk-root-U-oiq", _n = "crk-h1-Aivwz", Un = "crk-h2-CV8Oo", zn = "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-", cr = "crk-success-w8PpD", ir = "crk-align-left-3AGYw", lr = "crk-align-center-h-x--", sr = "crk-align-right-IXFhK", ar = "crk-truncate-eqr85", ze = {
|
|
124
|
+
root: Xn,
|
|
125
|
+
h1: _n,
|
|
126
126
|
h2: Un,
|
|
127
|
-
h3:
|
|
128
|
-
h4:
|
|
129
|
-
h5:
|
|
130
|
-
h6:
|
|
131
|
-
p:
|
|
132
|
-
span:
|
|
133
|
-
label:
|
|
134
|
-
normal:
|
|
135
|
-
medium:
|
|
136
|
-
semibold:
|
|
137
|
-
bold:
|
|
127
|
+
h3: zn,
|
|
128
|
+
h4: Yn,
|
|
129
|
+
h5: Vn,
|
|
130
|
+
h6: qn,
|
|
131
|
+
p: Gn,
|
|
132
|
+
span: Zn,
|
|
133
|
+
label: Kn,
|
|
134
|
+
normal: Qn,
|
|
135
|
+
medium: Jn,
|
|
136
|
+
semibold: er,
|
|
137
|
+
bold: tr,
|
|
138
138
|
default: "crk-default-79lKR",
|
|
139
|
-
muted:
|
|
140
|
-
primary:
|
|
141
|
-
danger:
|
|
142
|
-
success:
|
|
143
|
-
alignLeft:
|
|
144
|
-
alignCenter:
|
|
145
|
-
alignRight:
|
|
146
|
-
truncate:
|
|
147
|
-
},
|
|
139
|
+
muted: nr,
|
|
140
|
+
primary: rr,
|
|
141
|
+
danger: or,
|
|
142
|
+
success: cr,
|
|
143
|
+
alignLeft: ir,
|
|
144
|
+
alignCenter: lr,
|
|
145
|
+
alignRight: sr,
|
|
146
|
+
truncate: ar
|
|
147
|
+
}, dr = $e(
|
|
148
148
|
({
|
|
149
149
|
variant: e = "p",
|
|
150
150
|
weight: t,
|
|
@@ -155,17 +155,17 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", Un = "crk-h2-CV8Oo", _n = "crk
|
|
|
155
155
|
style: c,
|
|
156
156
|
children: l,
|
|
157
157
|
...a
|
|
158
|
-
}, h) =>
|
|
158
|
+
}, h) => ln(
|
|
159
159
|
e,
|
|
160
160
|
{
|
|
161
161
|
ref: h,
|
|
162
162
|
className: f(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
t &&
|
|
166
|
-
n &&
|
|
167
|
-
r &&
|
|
168
|
-
o &&
|
|
163
|
+
ze.root,
|
|
164
|
+
ze[e],
|
|
165
|
+
t && ze[t],
|
|
166
|
+
n && ze[n],
|
|
167
|
+
r && ze[`align-${r}`],
|
|
168
|
+
o && ze.truncate,
|
|
169
169
|
i
|
|
170
170
|
),
|
|
171
171
|
style: c,
|
|
@@ -174,17 +174,17 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", Un = "crk-h2-CV8Oo", _n = "crk
|
|
|
174
174
|
l
|
|
175
175
|
)
|
|
176
176
|
);
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
root:
|
|
180
|
-
unordered:
|
|
181
|
-
item:
|
|
182
|
-
ordered:
|
|
183
|
-
none:
|
|
184
|
-
sm:
|
|
185
|
-
md:
|
|
186
|
-
lg:
|
|
187
|
-
},
|
|
177
|
+
dr.displayName = "Typography";
|
|
178
|
+
const ur = "crk-root-PVrgx", hr = "crk-unordered-FhCWT", mr = "crk-item-TfW82", fr = "crk-ordered-8x4YC", pr = "crk-none-f03Kx", gr = "crk-sm-Rg4Mv", yr = "crk-md-X4Icb", vr = "crk-lg-JjNKZ", ut = {
|
|
179
|
+
root: ur,
|
|
180
|
+
unordered: hr,
|
|
181
|
+
item: mr,
|
|
182
|
+
ordered: fr,
|
|
183
|
+
none: pr,
|
|
184
|
+
sm: gr,
|
|
185
|
+
md: yr,
|
|
186
|
+
lg: vr
|
|
187
|
+
}, br = $e(
|
|
188
188
|
({
|
|
189
189
|
variant: e = "unordered",
|
|
190
190
|
spacing: t = "md",
|
|
@@ -208,8 +208,8 @@ const dr = "crk-root-PVrgx", ur = "crk-unordered-FhCWT", hr = "crk-item-TfW82",
|
|
|
208
208
|
}
|
|
209
209
|
)
|
|
210
210
|
);
|
|
211
|
-
|
|
212
|
-
const
|
|
211
|
+
br.displayName = "List";
|
|
212
|
+
const xr = $e(
|
|
213
213
|
({ className: e, style: t, children: n, ...r }, o) => /* @__PURE__ */ s(
|
|
214
214
|
"li",
|
|
215
215
|
{
|
|
@@ -221,42 +221,42 @@ const br = $e(
|
|
|
221
221
|
}
|
|
222
222
|
)
|
|
223
223
|
);
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
wrapper:
|
|
227
|
-
root:
|
|
228
|
-
headerCell:
|
|
229
|
-
headerCellSortable:
|
|
230
|
-
sortIndicator:
|
|
231
|
-
sortArrow:
|
|
232
|
-
sortArrowActive:
|
|
233
|
-
sortIndex:
|
|
234
|
-
row:
|
|
235
|
-
cell:
|
|
236
|
-
emptyRow:
|
|
237
|
-
emptyCell:
|
|
238
|
-
striped:
|
|
239
|
-
hoverable:
|
|
240
|
-
compact:
|
|
241
|
-
paginator:
|
|
242
|
-
paginatorInfo:
|
|
243
|
-
paginatorText:
|
|
244
|
-
pageSizeSelect:
|
|
245
|
-
paginatorNav:
|
|
246
|
-
pageButton:
|
|
247
|
-
pageButtonActive:
|
|
248
|
-
pageEllipsis:
|
|
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", Tr = "crk-sortIndex-HGoca", Rr = "crk-row-H0wL1", Cr = "crk-cell-ZfnbG", Ar = "crk-emptyRow-AoPfj", Br = "crk-emptyCell-99-7C", Dr = "crk-striped-6Qckq", Ir = "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", jr = "crk-pageButton-1PX-g", Xr = "crk-pageButtonActive--D7Q7", _r = "crk-pageEllipsis-en59J", ye = {
|
|
226
|
+
wrapper: kr,
|
|
227
|
+
root: Mr,
|
|
228
|
+
headerCell: wr,
|
|
229
|
+
headerCellSortable: $r,
|
|
230
|
+
sortIndicator: Nr,
|
|
231
|
+
sortArrow: Lr,
|
|
232
|
+
sortArrowActive: Sr,
|
|
233
|
+
sortIndex: Tr,
|
|
234
|
+
row: Rr,
|
|
235
|
+
cell: Cr,
|
|
236
|
+
emptyRow: Ar,
|
|
237
|
+
emptyCell: Br,
|
|
238
|
+
striped: Dr,
|
|
239
|
+
hoverable: Ir,
|
|
240
|
+
compact: Er,
|
|
241
|
+
paginator: Pr,
|
|
242
|
+
paginatorInfo: Wr,
|
|
243
|
+
paginatorText: Hr,
|
|
244
|
+
pageSizeSelect: Or,
|
|
245
|
+
paginatorNav: Fr,
|
|
246
|
+
pageButton: jr,
|
|
247
|
+
pageButtonActive: Xr,
|
|
248
|
+
pageEllipsis: _r
|
|
249
249
|
};
|
|
250
250
|
function Ur(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
|
|
254
|
-
const [n, r] = Se(t), o =
|
|
253
|
+
function zr(e, t = []) {
|
|
254
|
+
const [n, r] = Se(t), o = de((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
|
-
}, []), i =
|
|
259
|
+
}, []), i = de((a) => {
|
|
260
260
|
r((h) => {
|
|
261
261
|
const u = h.findIndex((m) => m.key === a);
|
|
262
262
|
if (u === -1)
|
|
@@ -267,7 +267,7 @@ function _r(e, t = []) {
|
|
|
267
267
|
}
|
|
268
268
|
return h.filter((m, p) => p !== u);
|
|
269
269
|
});
|
|
270
|
-
}, []), c =
|
|
270
|
+
}, []), c = de(() => {
|
|
271
271
|
r([]);
|
|
272
272
|
}, []);
|
|
273
273
|
return { sortedData: ke(() => n.length === 0 ? e : [...e].sort((a, h) => {
|
|
@@ -279,14 +279,14 @@ function _r(e, t = []) {
|
|
|
279
279
|
return 0;
|
|
280
280
|
}), [e, n]), sortConfig: n, requestSort: o, requestMultiSort: i, resetSort: c };
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return /* @__PURE__ */
|
|
282
|
+
function Yr({ direction: e, sortIndex: t }) {
|
|
283
|
+
return /* @__PURE__ */ F("span", { className: ye.sortIndicator, "aria-hidden": "true", children: [
|
|
284
284
|
/* @__PURE__ */ s("span", { className: f(ye.sortArrow, e === "asc" && ye.sortArrowActive), children: "▲" }),
|
|
285
285
|
/* @__PURE__ */ s("span", { className: f(ye.sortArrow, e === "desc" && ye.sortArrowActive), children: "▼" }),
|
|
286
286
|
t !== void 0 && t >= 0 && /* @__PURE__ */ s("span", { className: ye.sortIndex, children: t + 1 })
|
|
287
287
|
] });
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Vr({
|
|
290
290
|
page: e,
|
|
291
291
|
pageSize: t,
|
|
292
292
|
totalRows: n,
|
|
@@ -306,8 +306,8 @@ function Yr({
|
|
|
306
306
|
}
|
|
307
307
|
return u;
|
|
308
308
|
}, [e, c]);
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
309
|
+
return /* @__PURE__ */ F("nav", { className: f(ye.paginator, i?.paginator), "aria-label": "Table pagination", children: [
|
|
310
|
+
/* @__PURE__ */ F("div", { className: ye.paginatorInfo, children: [
|
|
311
311
|
/* @__PURE__ */ s("span", { className: ye.paginatorText, children: n > 0 ? `${l}–${a} of ${n}` : "No results" }),
|
|
312
312
|
r.length > 1 && /* @__PURE__ */ s(
|
|
313
313
|
"select",
|
|
@@ -316,14 +316,14 @@ function Yr({
|
|
|
316
316
|
value: t,
|
|
317
317
|
onChange: (u) => o(1, Number(u.target.value)),
|
|
318
318
|
"aria-label": "Rows per page",
|
|
319
|
-
children: r.map((u) => /* @__PURE__ */
|
|
319
|
+
children: r.map((u) => /* @__PURE__ */ F("option", { value: u, children: [
|
|
320
320
|
u,
|
|
321
321
|
" / page"
|
|
322
322
|
] }, u))
|
|
323
323
|
}
|
|
324
324
|
)
|
|
325
325
|
] }),
|
|
326
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ F("div", { className: ye.paginatorNav, children: [
|
|
327
327
|
/* @__PURE__ */ s(
|
|
328
328
|
"button",
|
|
329
329
|
{
|
|
@@ -363,7 +363,7 @@ function Yr({
|
|
|
363
363
|
] })
|
|
364
364
|
] });
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function qr({
|
|
367
367
|
data: e,
|
|
368
368
|
columns: t,
|
|
369
369
|
sortConfig: n,
|
|
@@ -379,47 +379,47 @@ function Vr({
|
|
|
379
379
|
pagination: m,
|
|
380
380
|
classes: p
|
|
381
381
|
}) {
|
|
382
|
-
const
|
|
383
|
-
sortedData:
|
|
384
|
-
sortConfig:
|
|
385
|
-
requestSort:
|
|
386
|
-
requestMultiSort:
|
|
387
|
-
} =
|
|
388
|
-
if (!m ||
|
|
389
|
-
const
|
|
390
|
-
return
|
|
391
|
-
}, [
|
|
392
|
-
(
|
|
393
|
-
const
|
|
394
|
-
if (
|
|
395
|
-
if (
|
|
396
|
-
const
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
(
|
|
400
|
-
) :
|
|
382
|
+
const x = r !== void 0, {
|
|
383
|
+
sortedData: C,
|
|
384
|
+
sortConfig: $,
|
|
385
|
+
requestSort: b,
|
|
386
|
+
requestMultiSort: W
|
|
387
|
+
} = zr(e, n), X = x ? n ?? [] : $, Y = x ? e : C, Q = ke(() => {
|
|
388
|
+
if (!m || x) return Y;
|
|
389
|
+
const M = (m.page - 1) * m.pageSize;
|
|
390
|
+
return Y.slice(M, M + m.pageSize);
|
|
391
|
+
}, [Y, m, x]), D = m?.totalRows ?? Y.length, S = de(
|
|
392
|
+
(M, G) => {
|
|
393
|
+
const O = o && (G.ctrlKey || G.metaKey);
|
|
394
|
+
if (x)
|
|
395
|
+
if (O) {
|
|
396
|
+
const te = X.findIndex((U) => U.key === M);
|
|
397
|
+
let j;
|
|
398
|
+
te === -1 ? j = [...X, { key: M, direction: "asc" }] : X[te].direction === "asc" ? j = X.map(
|
|
399
|
+
(U, J) => J === te ? { key: M, direction: "desc" } : U
|
|
400
|
+
) : j = X.filter((U, J) => J !== te), r(j);
|
|
401
401
|
} else {
|
|
402
|
-
const
|
|
403
|
-
|
|
402
|
+
const te = X.find((j) => j.key === M);
|
|
403
|
+
te ? te.direction === "asc" ? r([{ key: M, direction: "desc" }]) : r([]) : r([{ key: M, direction: "asc" }]);
|
|
404
404
|
}
|
|
405
405
|
else
|
|
406
|
-
|
|
406
|
+
O ? W(M) : b(M);
|
|
407
407
|
},
|
|
408
408
|
[
|
|
409
|
-
|
|
409
|
+
x,
|
|
410
410
|
o,
|
|
411
|
-
|
|
411
|
+
X,
|
|
412
412
|
r,
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
b,
|
|
414
|
+
W
|
|
415
415
|
]
|
|
416
|
-
),
|
|
417
|
-
if (
|
|
418
|
-
const
|
|
419
|
-
return
|
|
416
|
+
), ee = (M) => X.find((O) => O.key === M)?.direction, re = (M) => {
|
|
417
|
+
if (X.length <= 1) return;
|
|
418
|
+
const G = X.findIndex((O) => O.key === M);
|
|
419
|
+
return G >= 0 ? G : void 0;
|
|
420
420
|
};
|
|
421
|
-
return /* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
421
|
+
return /* @__PURE__ */ F("div", { className: f(ye.wrapper, p?.wrapper), children: [
|
|
422
|
+
/* @__PURE__ */ F(
|
|
423
423
|
"table",
|
|
424
424
|
{
|
|
425
425
|
className: f(
|
|
@@ -432,74 +432,74 @@ function Vr({
|
|
|
432
432
|
),
|
|
433
433
|
style: h,
|
|
434
434
|
children: [
|
|
435
|
-
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((
|
|
435
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((M) => /* @__PURE__ */ F(
|
|
436
436
|
"th",
|
|
437
437
|
{
|
|
438
438
|
className: f(
|
|
439
439
|
ye.headerCell,
|
|
440
|
-
|
|
440
|
+
M.sortable && ye.headerCellSortable,
|
|
441
441
|
p?.headerCell
|
|
442
442
|
),
|
|
443
443
|
style: {
|
|
444
|
-
width:
|
|
445
|
-
textAlign:
|
|
444
|
+
width: M.width,
|
|
445
|
+
textAlign: M.align
|
|
446
446
|
},
|
|
447
|
-
onClick:
|
|
448
|
-
"aria-sort":
|
|
447
|
+
onClick: M.sortable ? (G) => S(M.key, G) : void 0,
|
|
448
|
+
"aria-sort": M.sortable ? ee(M.key) === "asc" ? "ascending" : ee(M.key) === "desc" ? "descending" : "none" : void 0,
|
|
449
449
|
children: [
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
450
|
+
M.header,
|
|
451
|
+
M.sortable && /* @__PURE__ */ s(
|
|
452
|
+
Yr,
|
|
453
453
|
{
|
|
454
|
-
direction:
|
|
455
|
-
sortIndex:
|
|
454
|
+
direction: ee(M.key),
|
|
455
|
+
sortIndex: re(M.key)
|
|
456
456
|
}
|
|
457
457
|
)
|
|
458
458
|
]
|
|
459
459
|
},
|
|
460
|
-
|
|
460
|
+
M.key
|
|
461
461
|
)) }) }),
|
|
462
|
-
/* @__PURE__ */ s("tbody", { children:
|
|
463
|
-
const
|
|
464
|
-
return /* @__PURE__ */ s("tr", { className: f(ye.row, p?.row), children: t.map((
|
|
462
|
+
/* @__PURE__ */ s("tbody", { children: Q.length === 0 ? /* @__PURE__ */ s("tr", { className: ye.emptyRow, children: /* @__PURE__ */ s("td", { className: f(ye.emptyCell, p?.emptyCell), colSpan: t.length, children: d }) }) : Q.map((M, G) => {
|
|
463
|
+
const O = u ? String(M[u]) : G;
|
|
464
|
+
return /* @__PURE__ */ s("tr", { className: f(ye.row, p?.row), children: t.map((te) => /* @__PURE__ */ s(
|
|
465
465
|
"td",
|
|
466
466
|
{
|
|
467
467
|
className: f(ye.cell, p?.cell),
|
|
468
|
-
style: { textAlign:
|
|
469
|
-
children:
|
|
468
|
+
style: { textAlign: te.align },
|
|
469
|
+
children: te.render ? te.render(M[te.key], M, G) : M[te.key]
|
|
470
470
|
},
|
|
471
|
-
|
|
472
|
-
)) },
|
|
471
|
+
te.key
|
|
472
|
+
)) }, O);
|
|
473
473
|
}) })
|
|
474
474
|
]
|
|
475
475
|
}
|
|
476
476
|
),
|
|
477
477
|
m && /* @__PURE__ */ s(
|
|
478
|
-
|
|
478
|
+
Vr,
|
|
479
479
|
{
|
|
480
480
|
...m,
|
|
481
|
-
totalRows:
|
|
481
|
+
totalRows: D,
|
|
482
482
|
paginatorClasses: { paginator: p?.paginator, pageButton: p?.pageButton }
|
|
483
483
|
}
|
|
484
484
|
)
|
|
485
485
|
] });
|
|
486
486
|
}
|
|
487
|
-
const
|
|
488
|
-
root:
|
|
489
|
-
fullWidth:
|
|
490
|
-
trigger:
|
|
491
|
-
triggerOpen:
|
|
492
|
-
triggerLabel:
|
|
493
|
-
triggerError:
|
|
494
|
-
placeholder:
|
|
495
|
-
chevron:
|
|
496
|
-
menu:
|
|
497
|
-
menuOpen:
|
|
498
|
-
alignLeft:
|
|
499
|
-
alignRight:
|
|
500
|
-
item:
|
|
501
|
-
itemDisabled:
|
|
502
|
-
itemSelected:
|
|
487
|
+
const Il = 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", co = "crk-alignLeft-buCDJ", io = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo", Me = {
|
|
488
|
+
root: Gr,
|
|
489
|
+
fullWidth: Zr,
|
|
490
|
+
trigger: Kr,
|
|
491
|
+
triggerOpen: Qr,
|
|
492
|
+
triggerLabel: Jr,
|
|
493
|
+
triggerError: eo,
|
|
494
|
+
placeholder: to,
|
|
495
|
+
chevron: no,
|
|
496
|
+
menu: ro,
|
|
497
|
+
menuOpen: oo,
|
|
498
|
+
alignLeft: co,
|
|
499
|
+
alignRight: io,
|
|
500
|
+
item: lo,
|
|
501
|
+
itemDisabled: so,
|
|
502
|
+
itemSelected: ao
|
|
503
503
|
};
|
|
504
504
|
function pt(e, t, n = !0) {
|
|
505
505
|
Be(() => {
|
|
@@ -513,7 +513,7 @@ function pt(e, t, n = !0) {
|
|
|
513
513
|
}, [e, t, n]);
|
|
514
514
|
}
|
|
515
515
|
function Tt(e, t = !0) {
|
|
516
|
-
const n =
|
|
516
|
+
const n = de(
|
|
517
517
|
(r) => {
|
|
518
518
|
const o = e[r.key];
|
|
519
519
|
o && o(r);
|
|
@@ -527,7 +527,7 @@ function Tt(e, t = !0) {
|
|
|
527
527
|
};
|
|
528
528
|
}, [t, n]);
|
|
529
529
|
}
|
|
530
|
-
const
|
|
530
|
+
const zt = $e(
|
|
531
531
|
({
|
|
532
532
|
trigger: e,
|
|
533
533
|
children: t,
|
|
@@ -543,91 +543,91 @@ const _t = $e(
|
|
|
543
543
|
onChange: d,
|
|
544
544
|
error: m = !1,
|
|
545
545
|
fullWidth: p = !0,
|
|
546
|
-
classes:
|
|
547
|
-
},
|
|
548
|
-
const [
|
|
546
|
+
classes: x
|
|
547
|
+
}, C) => {
|
|
548
|
+
const [$, b] = Se(!1), W = ne(null), X = ne(null), Y = ne(null), Q = Ye();
|
|
549
549
|
Be(() => {
|
|
550
|
-
|
|
551
|
-
}, [
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
}, [l]),
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
return
|
|
550
|
+
$ && X.current && X.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
|
|
551
|
+
}, [$]);
|
|
552
|
+
const D = de(() => {
|
|
553
|
+
b(!1), l?.(), Y.current?.focus();
|
|
554
|
+
}, [l]), S = de(() => {
|
|
555
|
+
b((O) => {
|
|
556
|
+
const te = !O;
|
|
557
|
+
return te ? c?.() : l?.(), te;
|
|
558
558
|
});
|
|
559
|
-
}, [c, l]),
|
|
560
|
-
(
|
|
561
|
-
d?.(
|
|
559
|
+
}, [c, l]), ee = de(
|
|
560
|
+
(O) => {
|
|
561
|
+
d?.(O), D();
|
|
562
562
|
},
|
|
563
|
-
[d,
|
|
563
|
+
[d, D]
|
|
564
564
|
);
|
|
565
|
-
pt(
|
|
565
|
+
pt(W, D, $), Tt(
|
|
566
566
|
{
|
|
567
|
-
Escape: () =>
|
|
567
|
+
Escape: () => D()
|
|
568
568
|
},
|
|
569
|
-
|
|
569
|
+
$
|
|
570
570
|
);
|
|
571
|
-
const
|
|
571
|
+
const re = a?.find((O) => O.value === u)?.label, M = a ? re || h : e, G = a && !re;
|
|
572
572
|
return /* @__PURE__ */ s(
|
|
573
573
|
"div",
|
|
574
574
|
{
|
|
575
|
-
ref:
|
|
576
|
-
className: f(Me.root, p && Me.fullWidth,
|
|
575
|
+
ref: C,
|
|
576
|
+
className: f(Me.root, p && Me.fullWidth, x?.root, r),
|
|
577
577
|
style: o,
|
|
578
|
-
children: /* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
578
|
+
children: /* @__PURE__ */ F("div", { ref: W, style: p ? { width: "100%" } : void 0, children: [
|
|
579
|
+
/* @__PURE__ */ F(
|
|
580
580
|
"button",
|
|
581
581
|
{
|
|
582
|
-
ref:
|
|
582
|
+
ref: Y,
|
|
583
583
|
id: i,
|
|
584
584
|
type: "button",
|
|
585
585
|
className: f(
|
|
586
586
|
Me.trigger,
|
|
587
|
-
|
|
587
|
+
$ && Me.triggerOpen,
|
|
588
588
|
m && Me.triggerError,
|
|
589
589
|
p && Me.fullWidth,
|
|
590
|
-
|
|
590
|
+
x?.trigger
|
|
591
591
|
),
|
|
592
|
-
onClick:
|
|
593
|
-
"aria-expanded":
|
|
592
|
+
onClick: S,
|
|
593
|
+
"aria-expanded": $,
|
|
594
594
|
"aria-haspopup": "menu",
|
|
595
|
-
"aria-controls":
|
|
595
|
+
"aria-controls": $ ? Q : void 0,
|
|
596
596
|
children: [
|
|
597
|
-
/* @__PURE__ */ s("span", { className: f(Me.triggerLabel,
|
|
598
|
-
/* @__PURE__ */ s("span", { className: f(Me.chevron,
|
|
597
|
+
/* @__PURE__ */ s("span", { className: f(Me.triggerLabel, G && Me.placeholder, x?.triggerLabel), children: M }),
|
|
598
|
+
/* @__PURE__ */ s("span", { className: f(Me.chevron, x?.chevron), "aria-hidden": "true" })
|
|
599
599
|
]
|
|
600
600
|
}
|
|
601
601
|
),
|
|
602
602
|
/* @__PURE__ */ s(
|
|
603
603
|
"div",
|
|
604
604
|
{
|
|
605
|
-
ref:
|
|
606
|
-
id:
|
|
605
|
+
ref: X,
|
|
606
|
+
id: Q,
|
|
607
607
|
className: f(
|
|
608
608
|
Me.menu,
|
|
609
|
-
|
|
609
|
+
$ && Me.menuOpen,
|
|
610
610
|
n === "left" ? Me.alignLeft : Me.alignRight,
|
|
611
611
|
p && Me.fullWidth,
|
|
612
|
-
|
|
612
|
+
x?.menu
|
|
613
613
|
),
|
|
614
614
|
role: "menu",
|
|
615
|
-
children: a ? a.map((
|
|
615
|
+
children: a ? a.map((O) => /* @__PURE__ */ s(
|
|
616
616
|
"button",
|
|
617
617
|
{
|
|
618
618
|
type: "button",
|
|
619
619
|
role: "menuitem",
|
|
620
620
|
className: f(
|
|
621
621
|
Me.item,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
622
|
+
O.disabled && Me.itemDisabled,
|
|
623
|
+
O.value === u && Me.itemSelected,
|
|
624
|
+
x?.item
|
|
625
625
|
),
|
|
626
|
-
disabled:
|
|
627
|
-
onClick: () =>
|
|
628
|
-
children:
|
|
626
|
+
disabled: O.disabled,
|
|
627
|
+
onClick: () => ee(O.value),
|
|
628
|
+
children: O.label
|
|
629
629
|
},
|
|
630
|
-
|
|
630
|
+
O.value
|
|
631
631
|
)) : t
|
|
632
632
|
}
|
|
633
633
|
)
|
|
@@ -636,8 +636,8 @@ const _t = $e(
|
|
|
636
636
|
);
|
|
637
637
|
}
|
|
638
638
|
);
|
|
639
|
-
|
|
640
|
-
const
|
|
639
|
+
zt.displayName = "Dropdown";
|
|
640
|
+
const uo = $e(
|
|
641
641
|
({
|
|
642
642
|
disabled: e = !1,
|
|
643
643
|
className: t,
|
|
@@ -660,78 +660,102 @@ const ao = $e(
|
|
|
660
660
|
}
|
|
661
661
|
)
|
|
662
662
|
);
|
|
663
|
-
|
|
664
|
-
const
|
|
665
|
-
root:
|
|
666
|
-
trigger:
|
|
667
|
-
popover:
|
|
668
|
-
popoverFade:
|
|
669
|
-
bottom:
|
|
670
|
-
top:
|
|
671
|
-
left:
|
|
672
|
-
right:
|
|
673
|
-
}
|
|
663
|
+
uo.displayName = "DropdownItem";
|
|
664
|
+
const ho = "crk-root-8H-L9", mo = "crk-trigger-Zn1nQ", fo = "crk-popover-rvS3X", po = "crk-popoverFade-hj41M", go = "crk-bottom-lawQw", yo = "crk-top-rqvC6", vo = "crk-left-J6exv", bo = "crk-right-3y20l", at = {
|
|
665
|
+
root: ho,
|
|
666
|
+
trigger: mo,
|
|
667
|
+
popover: fo,
|
|
668
|
+
popoverFade: po,
|
|
669
|
+
bottom: go,
|
|
670
|
+
top: yo,
|
|
671
|
+
left: vo,
|
|
672
|
+
right: bo
|
|
673
|
+
};
|
|
674
|
+
function xo(...e) {
|
|
675
|
+
return (t) => {
|
|
676
|
+
for (const n of e)
|
|
677
|
+
n && (typeof n == "function" ? n(t) : n.current = t);
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
const Yt = $e(
|
|
674
681
|
({
|
|
675
682
|
trigger: e,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
683
|
+
asChild: t = !1,
|
|
684
|
+
content: n,
|
|
685
|
+
position: r = "bottom",
|
|
686
|
+
open: o,
|
|
687
|
+
onOpenChange: i,
|
|
688
|
+
classes: c,
|
|
689
|
+
className: l,
|
|
690
|
+
style: a
|
|
691
|
+
}, h) => {
|
|
692
|
+
const [u, d] = Se(!1), m = ne(null), p = ne(null), x = ne(null), C = Ye(), $ = o !== void 0, b = $ ? o : u, W = de(
|
|
693
|
+
(D) => {
|
|
694
|
+
$ || d(D), i?.(D);
|
|
687
695
|
},
|
|
688
|
-
[$,
|
|
689
|
-
), X =
|
|
690
|
-
|
|
691
|
-
}, [
|
|
692
|
-
|
|
693
|
-
}, [
|
|
694
|
-
|
|
696
|
+
[$, i]
|
|
697
|
+
), X = de(() => {
|
|
698
|
+
W(!1), x.current?.focus();
|
|
699
|
+
}, [W]), Y = de(() => {
|
|
700
|
+
W(!b);
|
|
701
|
+
}, [b, W]);
|
|
702
|
+
pt(m, X, b), Tt(
|
|
695
703
|
{
|
|
696
704
|
Escape: () => X()
|
|
697
705
|
},
|
|
698
|
-
|
|
706
|
+
b
|
|
699
707
|
), Be(() => {
|
|
700
|
-
if (
|
|
701
|
-
const
|
|
708
|
+
if (b && p.current) {
|
|
709
|
+
const D = p.current.querySelector(
|
|
702
710
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
703
711
|
);
|
|
704
|
-
|
|
712
|
+
D ? D.focus() : p.current.focus();
|
|
705
713
|
}
|
|
706
|
-
}, [
|
|
714
|
+
}, [b]);
|
|
715
|
+
let Q;
|
|
716
|
+
if (t && sn(e)) {
|
|
717
|
+
const D = e, S = D.ref;
|
|
718
|
+
Q = jt(D, {
|
|
719
|
+
ref: xo(x, S),
|
|
720
|
+
onClick: (ee) => {
|
|
721
|
+
D.props.onClick?.(ee), Y();
|
|
722
|
+
},
|
|
723
|
+
className: f(D.props.className, c?.trigger),
|
|
724
|
+
"aria-expanded": b,
|
|
725
|
+
"aria-haspopup": "dialog",
|
|
726
|
+
"aria-controls": b ? C : void 0
|
|
727
|
+
});
|
|
728
|
+
} else
|
|
729
|
+
Q = /* @__PURE__ */ s(
|
|
730
|
+
"button",
|
|
731
|
+
{
|
|
732
|
+
ref: x,
|
|
733
|
+
type: "button",
|
|
734
|
+
className: f(at.trigger, c?.trigger),
|
|
735
|
+
onClick: Y,
|
|
736
|
+
"aria-expanded": b,
|
|
737
|
+
"aria-haspopup": "dialog",
|
|
738
|
+
"aria-controls": b ? C : void 0,
|
|
739
|
+
children: e
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
return /* @__PURE__ */ s(
|
|
707
743
|
"div",
|
|
708
744
|
{
|
|
709
|
-
ref:
|
|
710
|
-
className: f(at.root,
|
|
711
|
-
style:
|
|
712
|
-
children: /* @__PURE__ */
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
{
|
|
716
|
-
ref: p,
|
|
717
|
-
type: "button",
|
|
718
|
-
className: f(at.trigger, i?.trigger),
|
|
719
|
-
onClick: E,
|
|
720
|
-
"aria-expanded": k,
|
|
721
|
-
"aria-haspopup": "dialog",
|
|
722
|
-
"aria-controls": k ? y : void 0,
|
|
723
|
-
children: e
|
|
724
|
-
}
|
|
725
|
-
),
|
|
726
|
-
k && /* @__PURE__ */ s(
|
|
745
|
+
ref: h,
|
|
746
|
+
className: f(at.root, c?.root, l),
|
|
747
|
+
style: a,
|
|
748
|
+
children: /* @__PURE__ */ F("div", { ref: m, children: [
|
|
749
|
+
Q,
|
|
750
|
+
b && /* @__PURE__ */ s(
|
|
727
751
|
"div",
|
|
728
752
|
{
|
|
729
|
-
ref:
|
|
730
|
-
id:
|
|
753
|
+
ref: p,
|
|
754
|
+
id: C,
|
|
731
755
|
role: "dialog",
|
|
732
756
|
tabIndex: -1,
|
|
733
|
-
className: f(at.popover, at[
|
|
734
|
-
children:
|
|
757
|
+
className: f(at.popover, at[r], c?.popover),
|
|
758
|
+
children: n
|
|
735
759
|
}
|
|
736
760
|
)
|
|
737
761
|
] })
|
|
@@ -739,7 +763,7 @@ const uo = "crk-root-8H-L9", ho = "crk-trigger-Zn1nQ", mo = "crk-popover-rvS3X",
|
|
|
739
763
|
);
|
|
740
764
|
}
|
|
741
765
|
);
|
|
742
|
-
|
|
766
|
+
Yt.displayName = "Popover";
|
|
743
767
|
const Bt = [
|
|
744
768
|
'input:not([disabled]):not([type="hidden"])',
|
|
745
769
|
"button:not([disabled])",
|
|
@@ -748,8 +772,8 @@ const Bt = [
|
|
|
748
772
|
"a[href]",
|
|
749
773
|
'[tabindex]:not([tabindex="-1"])'
|
|
750
774
|
].join(", ");
|
|
751
|
-
function
|
|
752
|
-
const n =
|
|
775
|
+
function ko(e, t) {
|
|
776
|
+
const n = ne(null), r = de(
|
|
753
777
|
(o) => {
|
|
754
778
|
if (o.key !== "Tab" || !e.current)
|
|
755
779
|
return;
|
|
@@ -775,23 +799,23 @@ function bo(e, t) {
|
|
|
775
799
|
};
|
|
776
800
|
}, [t, e, r]);
|
|
777
801
|
}
|
|
778
|
-
const
|
|
779
|
-
backdrop:
|
|
780
|
-
backdropIn:
|
|
781
|
-
modal:
|
|
782
|
-
modalIn:
|
|
783
|
-
sm:
|
|
784
|
-
md:
|
|
785
|
-
lg:
|
|
786
|
-
fullscreen:
|
|
787
|
-
header:
|
|
788
|
-
headerWithClose:
|
|
789
|
-
closeButton:
|
|
790
|
-
body:
|
|
791
|
-
footer:
|
|
792
|
-
}, gt =
|
|
802
|
+
const Mo = "crk-backdrop-jYpTA", wo = "crk-backdropIn-x5Z-A", $o = "crk-modal-yNG-7", No = "crk-modalIn-xFUwm", Lo = "crk-sm--xyY9", So = "crk-md-ETTfh", To = "crk-lg-5DBb7", Ro = "crk-fullscreen-b4jQ-", Co = "crk-header-NS30G", Ao = "crk-headerWithClose-4davm", Bo = "crk-closeButton-JX-aq", Do = "crk-body-3zIj9", Io = "crk-footer-Oyz-R", je = {
|
|
803
|
+
backdrop: Mo,
|
|
804
|
+
backdropIn: wo,
|
|
805
|
+
modal: $o,
|
|
806
|
+
modalIn: No,
|
|
807
|
+
sm: Lo,
|
|
808
|
+
md: So,
|
|
809
|
+
lg: To,
|
|
810
|
+
fullscreen: Ro,
|
|
811
|
+
header: Co,
|
|
812
|
+
headerWithClose: Ao,
|
|
813
|
+
closeButton: Bo,
|
|
814
|
+
body: Do,
|
|
815
|
+
footer: Io
|
|
816
|
+
}, gt = Xt({ classes: {}, titleId: "" }), Vt = ({ children: e, className: t, style: n, onClose: r }) => {
|
|
793
817
|
const { classes: o, titleId: i } = ft(gt);
|
|
794
|
-
return /* @__PURE__ */
|
|
818
|
+
return /* @__PURE__ */ F(
|
|
795
819
|
"div",
|
|
796
820
|
{
|
|
797
821
|
id: i,
|
|
@@ -813,17 +837,17 @@ const xo = "crk-backdrop-jYpTA", ko = "crk-backdropIn-x5Z-A", Mo = "crk-modal-yN
|
|
|
813
837
|
}
|
|
814
838
|
);
|
|
815
839
|
};
|
|
816
|
-
|
|
817
|
-
const
|
|
840
|
+
Vt.displayName = "Modal.Header";
|
|
841
|
+
const qt = ({ children: e, className: t, style: n }) => {
|
|
818
842
|
const { classes: r } = ft(gt);
|
|
819
843
|
return /* @__PURE__ */ s("div", { className: f(je.body, r.body, t), style: n, children: e });
|
|
820
844
|
};
|
|
821
|
-
|
|
822
|
-
const
|
|
845
|
+
qt.displayName = "Modal.Body";
|
|
846
|
+
const Gt = ({ children: e, className: t, style: n }) => {
|
|
823
847
|
const { classes: r } = ft(gt);
|
|
824
848
|
return /* @__PURE__ */ s("div", { className: f(je.footer, r.footer, t), style: n, children: e });
|
|
825
849
|
};
|
|
826
|
-
|
|
850
|
+
Gt.displayName = "Modal.Footer";
|
|
827
851
|
const yt = $e(
|
|
828
852
|
({
|
|
829
853
|
open: e,
|
|
@@ -838,9 +862,9 @@ const yt = $e(
|
|
|
838
862
|
"aria-label": h,
|
|
839
863
|
"aria-labelledby": u
|
|
840
864
|
}, d) => {
|
|
841
|
-
const m =
|
|
842
|
-
|
|
843
|
-
const
|
|
865
|
+
const m = ne(null), p = d ?? m, x = Ye(), C = u ?? `${x}-title`;
|
|
866
|
+
ko(p, e);
|
|
867
|
+
const $ = ke(
|
|
844
868
|
() => ({
|
|
845
869
|
Escape: () => {
|
|
846
870
|
r && t();
|
|
@@ -848,22 +872,22 @@ const yt = $e(
|
|
|
848
872
|
}),
|
|
849
873
|
[r, t]
|
|
850
874
|
);
|
|
851
|
-
Tt(
|
|
875
|
+
Tt($, e), Be(() => {
|
|
852
876
|
if (!e) return;
|
|
853
|
-
const
|
|
877
|
+
const W = document.body.style.overflow;
|
|
854
878
|
return document.body.style.overflow = "hidden", () => {
|
|
855
|
-
document.body.style.overflow =
|
|
879
|
+
document.body.style.overflow = W;
|
|
856
880
|
};
|
|
857
881
|
}, [e]);
|
|
858
|
-
const
|
|
859
|
-
n &&
|
|
882
|
+
const b = (W) => {
|
|
883
|
+
n && W.target === W.currentTarget && t();
|
|
860
884
|
};
|
|
861
|
-
return e ?
|
|
885
|
+
return e ? fn(
|
|
862
886
|
/* @__PURE__ */ s(
|
|
863
887
|
"div",
|
|
864
888
|
{
|
|
865
889
|
className: f(je.backdrop, i?.backdrop),
|
|
866
|
-
onClick:
|
|
890
|
+
onClick: b,
|
|
867
891
|
role: "presentation",
|
|
868
892
|
children: /* @__PURE__ */ s(
|
|
869
893
|
"div",
|
|
@@ -874,8 +898,8 @@ const yt = $e(
|
|
|
874
898
|
role: "dialog",
|
|
875
899
|
"aria-modal": "true",
|
|
876
900
|
"aria-label": h,
|
|
877
|
-
"aria-labelledby": h ? void 0 :
|
|
878
|
-
children: /* @__PURE__ */ s(gt.Provider, { value: { classes: i ?? {}, titleId:
|
|
901
|
+
"aria-labelledby": h ? void 0 : C,
|
|
902
|
+
children: /* @__PURE__ */ s(gt.Provider, { value: { classes: i ?? {}, titleId: C }, children: a })
|
|
879
903
|
}
|
|
880
904
|
)
|
|
881
905
|
}
|
|
@@ -885,22 +909,22 @@ const yt = $e(
|
|
|
885
909
|
}
|
|
886
910
|
);
|
|
887
911
|
yt.displayName = "Modal";
|
|
888
|
-
yt.Header =
|
|
889
|
-
yt.Body =
|
|
890
|
-
yt.Footer =
|
|
891
|
-
const
|
|
892
|
-
root:
|
|
893
|
-
formErrors:
|
|
894
|
-
formError:
|
|
895
|
-
field:
|
|
896
|
-
label:
|
|
897
|
-
labelError:
|
|
898
|
-
required:
|
|
899
|
-
error:
|
|
900
|
-
helperText:
|
|
901
|
-
row:
|
|
912
|
+
yt.Header = Vt;
|
|
913
|
+
yt.Body = qt;
|
|
914
|
+
yt.Footer = Gt;
|
|
915
|
+
const Eo = "crk-root-jHIIP", Po = "crk-formErrors-eh-OP", Wo = "crk-formError-XEuWv", Ho = "crk-field-OUlYz", Oo = "crk-label-udkR7", Fo = "crk-labelError-LOgKi", jo = "crk-required-IYiA2", Xo = "crk-error-yFZXm", _o = "crk-helperText-Dm-rb", Uo = "crk-row-nNbx-", We = {
|
|
916
|
+
root: Eo,
|
|
917
|
+
formErrors: Po,
|
|
918
|
+
formError: Wo,
|
|
919
|
+
field: Ho,
|
|
920
|
+
label: Oo,
|
|
921
|
+
labelError: Fo,
|
|
922
|
+
required: jo,
|
|
923
|
+
error: Xo,
|
|
924
|
+
helperText: _o,
|
|
925
|
+
row: Uo
|
|
902
926
|
};
|
|
903
|
-
function
|
|
927
|
+
function El({
|
|
904
928
|
form: e,
|
|
905
929
|
onSubmit: t,
|
|
906
930
|
errors: n,
|
|
@@ -909,7 +933,7 @@ function Bl({
|
|
|
909
933
|
children: i
|
|
910
934
|
}) {
|
|
911
935
|
const c = n && n.length > 0;
|
|
912
|
-
return /* @__PURE__ */ s(
|
|
936
|
+
return /* @__PURE__ */ s(un, { ...e, children: /* @__PURE__ */ F(
|
|
913
937
|
"form",
|
|
914
938
|
{
|
|
915
939
|
onSubmit: e.handleSubmit(t),
|
|
@@ -922,14 +946,14 @@ function Bl({
|
|
|
922
946
|
}
|
|
923
947
|
) });
|
|
924
948
|
}
|
|
925
|
-
const
|
|
949
|
+
const zo = /* @__PURE__ */ new Set([
|
|
926
950
|
"Select",
|
|
927
951
|
"NativeSelect",
|
|
928
952
|
"SearchableSelect",
|
|
929
953
|
"MultiSelect",
|
|
930
954
|
"Dropdown"
|
|
931
955
|
]);
|
|
932
|
-
function
|
|
956
|
+
function Pl({
|
|
933
957
|
name: e,
|
|
934
958
|
label: t,
|
|
935
959
|
helperText: n,
|
|
@@ -940,27 +964,27 @@ function Dl({
|
|
|
940
964
|
style: l,
|
|
941
965
|
children: a
|
|
942
966
|
}) {
|
|
943
|
-
const { control: h } =
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
(
|
|
947
|
-
if (
|
|
948
|
-
const
|
|
949
|
-
|
|
967
|
+
const { control: h } = hn(), { field: u, fieldState: d } = mn({ name: e, control: h, rules: o }), m = a.type, p = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "", x = zo.has(p), { ref: C, ...$ } = u, b = ne(C);
|
|
968
|
+
b.current = C;
|
|
969
|
+
const W = de(
|
|
970
|
+
(X) => {
|
|
971
|
+
if (X) {
|
|
972
|
+
const Y = X.matches("input, select, textarea, button, [tabindex]") ? X : X.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
|
|
973
|
+
b.current(Y ?? X);
|
|
950
974
|
} else
|
|
951
|
-
|
|
975
|
+
b.current(null);
|
|
952
976
|
},
|
|
953
977
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
954
978
|
[]
|
|
955
979
|
);
|
|
956
|
-
return /* @__PURE__ */
|
|
957
|
-
t && /* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ F("div", { className: f(We.field, i?.field, c), style: l, children: [
|
|
981
|
+
t && /* @__PURE__ */ F("label", { className: f(We.label, d.error && We.labelError, i?.label), htmlFor: e, children: [
|
|
958
982
|
t,
|
|
959
983
|
r && /* @__PURE__ */ s("span", { className: We.required, children: "*" })
|
|
960
984
|
] }),
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
ref:
|
|
985
|
+
jt(a, {
|
|
986
|
+
...$,
|
|
987
|
+
ref: W,
|
|
964
988
|
id: e,
|
|
965
989
|
error: !!d.error,
|
|
966
990
|
"aria-invalid": d.error ? !0 : void 0,
|
|
@@ -968,31 +992,31 @@ function Dl({
|
|
|
968
992
|
// Bridge for custom components that use onValueChange/onValuesChange (Select, Dropdown).
|
|
969
993
|
// Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
|
|
970
994
|
// handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
|
|
971
|
-
...
|
|
972
|
-
onValueChange:
|
|
973
|
-
onValuesChange:
|
|
995
|
+
...x && {
|
|
996
|
+
onValueChange: $.onChange,
|
|
997
|
+
onValuesChange: $.onChange
|
|
974
998
|
},
|
|
975
999
|
// Bridge for Checkbox (expects checked, not value)
|
|
976
|
-
checked: typeof
|
|
1000
|
+
checked: typeof $.value == "boolean" ? $.value : void 0
|
|
977
1001
|
}),
|
|
978
1002
|
d.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className: f(We.error, i?.error), role: "alert", children: d.error.message }) : n ? /* @__PURE__ */ s("span", { id: `${e}-helper`, className: f(We.helperText, i?.helperText), children: n }) : null
|
|
979
1003
|
] });
|
|
980
1004
|
}
|
|
981
|
-
function
|
|
1005
|
+
function Wl({ children: e, className: t, style: n }) {
|
|
982
1006
|
return /* @__PURE__ */ s("div", { className: f(We.row, t), style: n, children: e });
|
|
983
1007
|
}
|
|
984
|
-
const
|
|
985
|
-
root:
|
|
986
|
-
wrapper:
|
|
987
|
-
sm:
|
|
988
|
-
md:
|
|
989
|
-
lg:
|
|
990
|
-
error:
|
|
991
|
-
prefix:
|
|
992
|
-
suffix:
|
|
993
|
-
hasPrefix:
|
|
994
|
-
hasSuffix:
|
|
995
|
-
},
|
|
1008
|
+
const Yo = "crk-root-rSgdy", Vo = "crk-wrapper-GHy8V", qo = "crk-sm-DptM5", Go = "crk-md-F4B0G", Zo = "crk-lg-pBxwX", Ko = "crk-error-fucxe", Qo = "crk-prefix-w53Md", Jo = "crk-suffix-fcNgR", ec = "crk-hasPrefix--bqPD", tc = "crk-hasSuffix-zO0nX", Pe = {
|
|
1009
|
+
root: Yo,
|
|
1010
|
+
wrapper: Vo,
|
|
1011
|
+
sm: qo,
|
|
1012
|
+
md: Go,
|
|
1013
|
+
lg: Zo,
|
|
1014
|
+
error: Ko,
|
|
1015
|
+
prefix: Qo,
|
|
1016
|
+
suffix: Jo,
|
|
1017
|
+
hasPrefix: ec,
|
|
1018
|
+
hasSuffix: tc
|
|
1019
|
+
}, nc = $e(
|
|
996
1020
|
({
|
|
997
1021
|
inputSize: e = "md",
|
|
998
1022
|
error: t = !1,
|
|
@@ -1020,7 +1044,7 @@ const _o = "crk-root-rSgdy", zo = "crk-wrapper-GHy8V", Yo = "crk-sm-DptM5", Vo =
|
|
|
1020
1044
|
...l
|
|
1021
1045
|
}
|
|
1022
1046
|
);
|
|
1023
|
-
return n || r ? /* @__PURE__ */
|
|
1047
|
+
return n || r ? /* @__PURE__ */ F(
|
|
1024
1048
|
"div",
|
|
1025
1049
|
{
|
|
1026
1050
|
className: f(Pe.wrapper, Pe[e], t && Pe.error, o?.wrapper, i),
|
|
@@ -1034,41 +1058,41 @@ const _o = "crk-root-rSgdy", zo = "crk-wrapper-GHy8V", Yo = "crk-sm-DptM5", Vo =
|
|
|
1034
1058
|
) : h;
|
|
1035
1059
|
}
|
|
1036
1060
|
);
|
|
1037
|
-
|
|
1038
|
-
const
|
|
1039
|
-
wrapper:
|
|
1040
|
-
sm:
|
|
1041
|
-
md:
|
|
1042
|
-
lg:
|
|
1043
|
-
root:
|
|
1044
|
-
error:
|
|
1045
|
-
arrow:
|
|
1046
|
-
searchableWrapper:
|
|
1047
|
-
hiddenSelect:
|
|
1048
|
-
searchableTrigger:
|
|
1049
|
-
triggerOpen:
|
|
1050
|
-
triggerLabel:
|
|
1051
|
-
placeholder:
|
|
1052
|
-
arrowInline:
|
|
1053
|
-
disabled:
|
|
1054
|
-
visuallyHidden:
|
|
1055
|
-
menu:
|
|
1056
|
-
menuEnter:
|
|
1057
|
-
menuItems:
|
|
1058
|
-
item:
|
|
1059
|
-
itemHighlighted:
|
|
1060
|
-
itemDisabled:
|
|
1061
|
-
itemSelected:
|
|
1062
|
-
noResults:
|
|
1063
|
-
multiTrigger:
|
|
1064
|
-
multiTriggerDisabled:
|
|
1065
|
-
chip:
|
|
1066
|
-
chipLabel:
|
|
1067
|
-
chipRemove:
|
|
1068
|
-
multiSearch:
|
|
1069
|
-
arrowMulti:
|
|
1070
|
-
itemCheck:
|
|
1071
|
-
},
|
|
1061
|
+
nc.displayName = "Input";
|
|
1062
|
+
const rc = "crk-wrapper-SP2JE", oc = "crk-sm-DqshL", cc = "crk-md-j4AKI", ic = "crk-lg-24Xd3", lc = "crk-root-Uu9Ah", sc = "crk-error-9oRU6", ac = "crk-arrow-WU8ZW", dc = "crk-searchableWrapper-7AL4l", uc = "crk-hiddenSelect-s3DEx", hc = "crk-searchableTrigger-m-GWV", mc = "crk-triggerOpen-Lo8-j", fc = "crk-triggerLabel-5rETZ", pc = "crk-placeholder-teBBh", gc = "crk-arrowInline-m-roG", yc = "crk-disabled-pcSeq", vc = "crk-visuallyHidden-2tTD5", bc = "crk-menu--i-je", xc = "crk-menuEnter-vJjLV", kc = "crk-menuItems-VrZnE", Mc = "crk-item-fU3XI", wc = "crk-itemHighlighted-MvR41", $c = "crk-itemDisabled-KTUO8", Nc = "crk-itemSelected-42-BG", Lc = "crk-noResults-uicSW", Sc = "crk-multiTrigger-Pd3wJ", Tc = "crk-multiTriggerDisabled-9ajge", Rc = "crk-chip-TuYUB", Cc = "crk-chipLabel-H4JWu", Ac = "crk-chipRemove-Lfk0R", Bc = "crk-multiSearch-OrVeS", Dc = "crk-arrowMulti-Nh9Hr", Ic = "crk-itemCheck-DPB5A", P = {
|
|
1063
|
+
wrapper: rc,
|
|
1064
|
+
sm: oc,
|
|
1065
|
+
md: cc,
|
|
1066
|
+
lg: ic,
|
|
1067
|
+
root: lc,
|
|
1068
|
+
error: sc,
|
|
1069
|
+
arrow: ac,
|
|
1070
|
+
searchableWrapper: dc,
|
|
1071
|
+
hiddenSelect: uc,
|
|
1072
|
+
searchableTrigger: hc,
|
|
1073
|
+
triggerOpen: mc,
|
|
1074
|
+
triggerLabel: fc,
|
|
1075
|
+
placeholder: pc,
|
|
1076
|
+
arrowInline: gc,
|
|
1077
|
+
disabled: yc,
|
|
1078
|
+
visuallyHidden: vc,
|
|
1079
|
+
menu: bc,
|
|
1080
|
+
menuEnter: xc,
|
|
1081
|
+
menuItems: kc,
|
|
1082
|
+
item: Mc,
|
|
1083
|
+
itemHighlighted: wc,
|
|
1084
|
+
itemDisabled: $c,
|
|
1085
|
+
itemSelected: Nc,
|
|
1086
|
+
noResults: Lc,
|
|
1087
|
+
multiTrigger: Sc,
|
|
1088
|
+
multiTriggerDisabled: Tc,
|
|
1089
|
+
chip: Rc,
|
|
1090
|
+
chipLabel: Cc,
|
|
1091
|
+
chipRemove: Ac,
|
|
1092
|
+
multiSearch: Bc,
|
|
1093
|
+
arrowMulti: Dc,
|
|
1094
|
+
itemCheck: Ic
|
|
1095
|
+
}, Zt = $e(
|
|
1072
1096
|
({
|
|
1073
1097
|
inputSize: e = "md",
|
|
1074
1098
|
error: t = !1,
|
|
@@ -1082,12 +1106,12 @@ const tc = "crk-wrapper-SP2JE", nc = "crk-sm-DqshL", rc = "crk-md-j4AKI", oc = "
|
|
|
1082
1106
|
searchPlaceholder: h,
|
|
1083
1107
|
onValueChange: u,
|
|
1084
1108
|
...d
|
|
1085
|
-
}, m) => /* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1109
|
+
}, m) => /* @__PURE__ */ F("div", { className: f(P.wrapper, P[e], t && P.error, o?.wrapper, i), style: c, children: [
|
|
1110
|
+
/* @__PURE__ */ F(
|
|
1087
1111
|
"select",
|
|
1088
1112
|
{
|
|
1089
1113
|
ref: m,
|
|
1090
|
-
className: f(
|
|
1114
|
+
className: f(P.root, P[e], t && P.error, o?.root),
|
|
1091
1115
|
...d,
|
|
1092
1116
|
children: [
|
|
1093
1117
|
r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
|
|
@@ -1095,11 +1119,11 @@ const tc = "crk-wrapper-SP2JE", nc = "crk-sm-DqshL", rc = "crk-md-j4AKI", oc = "
|
|
|
1095
1119
|
]
|
|
1096
1120
|
}
|
|
1097
1121
|
),
|
|
1098
|
-
/* @__PURE__ */ s("span", { className: f(
|
|
1122
|
+
/* @__PURE__ */ s("span", { className: f(P.arrow, o?.arrow) })
|
|
1099
1123
|
] })
|
|
1100
1124
|
);
|
|
1101
|
-
|
|
1102
|
-
const
|
|
1125
|
+
Zt.displayName = "NativeSelect";
|
|
1126
|
+
const Kt = $e(
|
|
1103
1127
|
({
|
|
1104
1128
|
inputSize: e = "md",
|
|
1105
1129
|
error: t = !1,
|
|
@@ -1115,75 +1139,75 @@ const Zt = $e(
|
|
|
1115
1139
|
onChange: d,
|
|
1116
1140
|
onValueChange: m
|
|
1117
1141
|
}, p) => {
|
|
1118
|
-
const [
|
|
1142
|
+
const [x, C] = Se(!1), [$, b] = Se(""), [W, X] = Se(0), Y = ne(null), Q = ne(null), D = ne(null), S = ne(null), ee = Ye(), re = ne(null), M = p ?? re, G = ne(!1);
|
|
1119
1143
|
Be(() => {
|
|
1120
|
-
|
|
1121
|
-
}, [
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
}, []),
|
|
1125
|
-
a || (
|
|
1126
|
-
}, [a]),
|
|
1127
|
-
(
|
|
1128
|
-
if (m?.(
|
|
1144
|
+
G.current && !x && D.current?.focus(), G.current = x;
|
|
1145
|
+
}, [x]);
|
|
1146
|
+
const O = de(() => {
|
|
1147
|
+
C(!1), b(""), X(0);
|
|
1148
|
+
}, []), te = de(() => {
|
|
1149
|
+
a || (C(!0), b(""), X(0), setTimeout(() => Q.current?.focus(), 0));
|
|
1150
|
+
}, [a]), j = de(
|
|
1151
|
+
(w) => {
|
|
1152
|
+
if (m?.(w), M.current) {
|
|
1129
1153
|
Object.getOwnPropertyDescriptor(
|
|
1130
1154
|
HTMLSelectElement.prototype,
|
|
1131
1155
|
"value"
|
|
1132
|
-
)?.set?.call(
|
|
1156
|
+
)?.set?.call(M.current, w);
|
|
1133
1157
|
const N = new Event("change", { bubbles: !0 });
|
|
1134
|
-
|
|
1158
|
+
M.current.dispatchEvent(N), d?.(N);
|
|
1135
1159
|
}
|
|
1136
|
-
|
|
1160
|
+
O();
|
|
1137
1161
|
},
|
|
1138
|
-
[m, d,
|
|
1139
|
-
),
|
|
1140
|
-
if (
|
|
1141
|
-
const
|
|
1142
|
-
return n.filter((
|
|
1143
|
-
}, [n,
|
|
1162
|
+
[m, d, M, O]
|
|
1163
|
+
), U = ke(() => {
|
|
1164
|
+
if (!$) return n;
|
|
1165
|
+
const w = $.toLowerCase();
|
|
1166
|
+
return n.filter((B) => B.label.toLowerCase().includes(w));
|
|
1167
|
+
}, [n, $]);
|
|
1144
1168
|
Be(() => {
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
}, [
|
|
1148
|
-
if (!
|
|
1149
|
-
const
|
|
1150
|
-
if (!
|
|
1151
|
-
|
|
1152
|
-
}, [
|
|
1153
|
-
const
|
|
1154
|
-
(
|
|
1155
|
-
const
|
|
1156
|
-
if (
|
|
1157
|
-
if (
|
|
1158
|
-
|
|
1159
|
-
const z =
|
|
1160
|
-
return z <
|
|
1169
|
+
const w = U.findIndex((B) => !B.disabled);
|
|
1170
|
+
X(w >= 0 ? w : 0);
|
|
1171
|
+
}, [U]), Be(() => {
|
|
1172
|
+
if (!x) return;
|
|
1173
|
+
const w = S.current;
|
|
1174
|
+
if (!w) return;
|
|
1175
|
+
w.querySelectorAll('[role="option"]')[W]?.scrollIntoView?.({ block: "nearest" });
|
|
1176
|
+
}, [W, x]);
|
|
1177
|
+
const J = de(
|
|
1178
|
+
(w) => {
|
|
1179
|
+
const B = U.map((N, z) => N.disabled ? -1 : z).filter((N) => N >= 0);
|
|
1180
|
+
if (B.length !== 0)
|
|
1181
|
+
if (w.key === "ArrowDown")
|
|
1182
|
+
w.preventDefault(), X((N) => {
|
|
1183
|
+
const z = B.indexOf(N);
|
|
1184
|
+
return z < B.length - 1 ? B[z + 1] : B[0];
|
|
1161
1185
|
});
|
|
1162
|
-
else if (
|
|
1163
|
-
|
|
1164
|
-
const z =
|
|
1165
|
-
return z > 0 ?
|
|
1186
|
+
else if (w.key === "ArrowUp")
|
|
1187
|
+
w.preventDefault(), X((N) => {
|
|
1188
|
+
const z = B.indexOf(N);
|
|
1189
|
+
return z > 0 ? B[z - 1] : B[B.length - 1];
|
|
1166
1190
|
});
|
|
1167
|
-
else if (
|
|
1168
|
-
|
|
1169
|
-
const N =
|
|
1170
|
-
N && !N.disabled &&
|
|
1171
|
-
} else
|
|
1191
|
+
else if (w.key === "Enter") {
|
|
1192
|
+
w.preventDefault();
|
|
1193
|
+
const N = U[W];
|
|
1194
|
+
N && !N.disabled && j(N.value);
|
|
1195
|
+
} else w.key === "Escape" && (w.preventDefault(), O());
|
|
1172
1196
|
},
|
|
1173
|
-
[
|
|
1197
|
+
[U, W, j, O]
|
|
1174
1198
|
);
|
|
1175
|
-
pt(
|
|
1176
|
-
const
|
|
1177
|
-
return /* @__PURE__ */
|
|
1199
|
+
pt(Y, O, x);
|
|
1200
|
+
const oe = n.find((w) => w.value === l)?.label, he = U.filter((w) => !w.disabled);
|
|
1201
|
+
return /* @__PURE__ */ F(
|
|
1178
1202
|
"div",
|
|
1179
1203
|
{
|
|
1180
|
-
ref:
|
|
1204
|
+
ref: Y,
|
|
1181
1205
|
className: f(
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
t &&
|
|
1186
|
-
a &&
|
|
1206
|
+
P.wrapper,
|
|
1207
|
+
P.searchableWrapper,
|
|
1208
|
+
P[e],
|
|
1209
|
+
t && P.error,
|
|
1210
|
+
a && P.disabled,
|
|
1187
1211
|
o?.wrapper,
|
|
1188
1212
|
i
|
|
1189
1213
|
),
|
|
@@ -1192,96 +1216,96 @@ const Zt = $e(
|
|
|
1192
1216
|
/* @__PURE__ */ s(
|
|
1193
1217
|
"select",
|
|
1194
1218
|
{
|
|
1195
|
-
ref:
|
|
1196
|
-
className:
|
|
1219
|
+
ref: M,
|
|
1220
|
+
className: P.hiddenSelect,
|
|
1197
1221
|
value: l ?? "",
|
|
1198
1222
|
disabled: a,
|
|
1199
1223
|
tabIndex: -1,
|
|
1200
1224
|
"aria-hidden": "true",
|
|
1201
1225
|
onChange: () => {
|
|
1202
1226
|
},
|
|
1203
|
-
children: n.map((
|
|
1227
|
+
children: n.map((w) => /* @__PURE__ */ s("option", { value: w.value, children: w.label }, w.value))
|
|
1204
1228
|
}
|
|
1205
1229
|
),
|
|
1206
|
-
/* @__PURE__ */
|
|
1230
|
+
/* @__PURE__ */ F(
|
|
1207
1231
|
"button",
|
|
1208
1232
|
{
|
|
1209
|
-
ref:
|
|
1233
|
+
ref: D,
|
|
1210
1234
|
id: h,
|
|
1211
1235
|
type: "button",
|
|
1212
1236
|
className: f(
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
t &&
|
|
1218
|
-
|
|
1237
|
+
P.root,
|
|
1238
|
+
P.searchableTrigger,
|
|
1239
|
+
P[e],
|
|
1240
|
+
x && P.triggerOpen,
|
|
1241
|
+
t && P.error,
|
|
1242
|
+
x && P.visuallyHidden,
|
|
1219
1243
|
o?.root
|
|
1220
1244
|
),
|
|
1221
|
-
onClick:
|
|
1245
|
+
onClick: te,
|
|
1222
1246
|
disabled: a,
|
|
1223
|
-
"aria-expanded":
|
|
1247
|
+
"aria-expanded": x,
|
|
1224
1248
|
"aria-haspopup": "listbox",
|
|
1225
|
-
"aria-controls":
|
|
1249
|
+
"aria-controls": x ? ee : void 0,
|
|
1226
1250
|
children: [
|
|
1227
|
-
/* @__PURE__ */ s("span", { className: f(
|
|
1228
|
-
/* @__PURE__ */ s("span", { className: f(
|
|
1251
|
+
/* @__PURE__ */ s("span", { className: f(P.triggerLabel, !oe && P.placeholder), children: oe || r }),
|
|
1252
|
+
/* @__PURE__ */ s("span", { className: f(P.arrow, P.arrowInline, o?.arrow) })
|
|
1229
1253
|
]
|
|
1230
1254
|
}
|
|
1231
1255
|
),
|
|
1232
|
-
|
|
1256
|
+
x && /* @__PURE__ */ s(
|
|
1233
1257
|
"input",
|
|
1234
1258
|
{
|
|
1235
|
-
ref:
|
|
1259
|
+
ref: Q,
|
|
1236
1260
|
type: "text",
|
|
1237
1261
|
role: "combobox",
|
|
1238
1262
|
className: f(
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
t &&
|
|
1263
|
+
P.root,
|
|
1264
|
+
P.searchableTrigger,
|
|
1265
|
+
P[e],
|
|
1266
|
+
P.triggerOpen,
|
|
1267
|
+
t && P.error,
|
|
1244
1268
|
o?.root,
|
|
1245
1269
|
o?.search
|
|
1246
1270
|
),
|
|
1247
|
-
placeholder:
|
|
1248
|
-
value:
|
|
1249
|
-
onChange: (
|
|
1250
|
-
onKeyDown:
|
|
1271
|
+
placeholder: oe || r,
|
|
1272
|
+
value: $,
|
|
1273
|
+
onChange: (w) => b(w.target.value),
|
|
1274
|
+
onKeyDown: J,
|
|
1251
1275
|
"aria-expanded": !0,
|
|
1252
1276
|
"aria-haspopup": "listbox",
|
|
1253
|
-
"aria-controls":
|
|
1254
|
-
"aria-activedescendant":
|
|
1277
|
+
"aria-controls": ee,
|
|
1278
|
+
"aria-activedescendant": he.length > 0 ? `select-option-${U[W]?.value}` : void 0
|
|
1255
1279
|
}
|
|
1256
1280
|
),
|
|
1257
|
-
|
|
1281
|
+
x && /* @__PURE__ */ s("div", { id: ee, className: f(P.menu, o?.menu), role: "listbox", children: /* @__PURE__ */ s("div", { className: P.menuItems, ref: S, children: U.length === 0 ? /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }) : U.map((w, B) => /* @__PURE__ */ s(
|
|
1258
1282
|
"button",
|
|
1259
1283
|
{
|
|
1260
|
-
id: `select-option-${
|
|
1284
|
+
id: `select-option-${w.value}`,
|
|
1261
1285
|
type: "button",
|
|
1262
1286
|
role: "option",
|
|
1263
|
-
"aria-selected":
|
|
1287
|
+
"aria-selected": w.value === l,
|
|
1264
1288
|
className: f(
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1289
|
+
P.item,
|
|
1290
|
+
w.disabled && P.itemDisabled,
|
|
1291
|
+
w.value === l && P.itemSelected,
|
|
1292
|
+
B === W && P.itemHighlighted,
|
|
1269
1293
|
o?.item
|
|
1270
1294
|
),
|
|
1271
|
-
disabled:
|
|
1272
|
-
onClick: () =>
|
|
1273
|
-
onMouseEnter: () =>
|
|
1274
|
-
children:
|
|
1295
|
+
disabled: w.disabled,
|
|
1296
|
+
onClick: () => j(w.value),
|
|
1297
|
+
onMouseEnter: () => X(B),
|
|
1298
|
+
children: w.content ?? w.label
|
|
1275
1299
|
},
|
|
1276
|
-
|
|
1300
|
+
w.value
|
|
1277
1301
|
)) }) })
|
|
1278
1302
|
]
|
|
1279
1303
|
}
|
|
1280
1304
|
);
|
|
1281
1305
|
}
|
|
1282
1306
|
);
|
|
1283
|
-
|
|
1284
|
-
const
|
|
1307
|
+
Kt.displayName = "SearchableSelect";
|
|
1308
|
+
const Qt = $e(
|
|
1285
1309
|
({
|
|
1286
1310
|
inputSize: e = "md",
|
|
1287
1311
|
error: t = !1,
|
|
@@ -1295,79 +1319,89 @@ const Kt = $e(
|
|
|
1295
1319
|
id: h,
|
|
1296
1320
|
searchPlaceholder: u,
|
|
1297
1321
|
onValuesChange: d,
|
|
1298
|
-
clearSearchOnSelect: m = !0
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1322
|
+
clearSearchOnSelect: m = !0,
|
|
1323
|
+
allowCreate: p = !1,
|
|
1324
|
+
onCreate: x,
|
|
1325
|
+
createLabel: C
|
|
1326
|
+
}, $) => {
|
|
1327
|
+
const b = Array.isArray(l) ? l : l ? [l] : [], [W, X] = Se(!1), [Y, Q] = Se(""), [D, S] = Se(0), ee = ne(null), re = ne(null), M = ne(null), G = Ye(), O = ne(null), te = $ ?? O, j = de(() => {
|
|
1328
|
+
X(!1), Q(""), S(0);
|
|
1329
|
+
}, []), U = de(() => {
|
|
1330
|
+
a || (X(!0), Q(""), S(0), setTimeout(() => re.current?.focus(), 0));
|
|
1331
|
+
}, [a]), J = de(
|
|
1332
|
+
(y) => {
|
|
1333
|
+
const L = b.includes(y) ? b.filter((A) => A !== y) : [...b, y];
|
|
1334
|
+
d?.(L), m && Q("");
|
|
1308
1335
|
},
|
|
1309
|
-
[
|
|
1310
|
-
),
|
|
1311
|
-
(
|
|
1312
|
-
|
|
1336
|
+
[b, d, m]
|
|
1337
|
+
), oe = de(
|
|
1338
|
+
(y, L) => {
|
|
1339
|
+
L.stopPropagation(), d?.(b.filter((A) => A !== y));
|
|
1313
1340
|
},
|
|
1314
|
-
[
|
|
1315
|
-
),
|
|
1316
|
-
if (!
|
|
1317
|
-
const
|
|
1318
|
-
return n.filter((
|
|
1319
|
-
}, [n,
|
|
1341
|
+
[b, d]
|
|
1342
|
+
), he = ke(() => {
|
|
1343
|
+
if (!Y) return n;
|
|
1344
|
+
const y = Y.toLowerCase();
|
|
1345
|
+
return n.filter((L) => L.label.toLowerCase().includes(y));
|
|
1346
|
+
}, [n, Y]), w = Y.trim(), B = p && w.length > 0 && !n.some(
|
|
1347
|
+
(y) => y.label.toLowerCase() === w.toLowerCase() || y.value === w
|
|
1348
|
+
) && !b.includes(w), N = de(() => {
|
|
1349
|
+
w && (b.includes(w) || (x?.(w), d?.([...b, w]), m && Q("")));
|
|
1350
|
+
}, [w, b, x, d, m]);
|
|
1320
1351
|
Be(() => {
|
|
1321
|
-
const
|
|
1322
|
-
|
|
1323
|
-
}, [
|
|
1324
|
-
if (
|
|
1325
|
-
const
|
|
1326
|
-
if (!
|
|
1327
|
-
|
|
1328
|
-
}, [
|
|
1329
|
-
const
|
|
1330
|
-
(
|
|
1331
|
-
const
|
|
1332
|
-
if (L.key === "Backspace" &&
|
|
1333
|
-
|
|
1352
|
+
const y = he.findIndex((L) => !L.disabled);
|
|
1353
|
+
S(y >= 0 ? y : 0);
|
|
1354
|
+
}, [he]), Be(() => {
|
|
1355
|
+
if (!W) return;
|
|
1356
|
+
const y = M.current;
|
|
1357
|
+
if (!y) return;
|
|
1358
|
+
y.querySelectorAll('[role="option"]')[D]?.scrollIntoView?.({ block: "nearest" });
|
|
1359
|
+
}, [D, W]);
|
|
1360
|
+
const z = he.length, T = de(
|
|
1361
|
+
(y) => {
|
|
1362
|
+
const L = he.map((A, H) => A.disabled ? -1 : H).filter((A) => A >= 0);
|
|
1363
|
+
if (B && L.push(z), y.key === "Backspace" && Y === "" && b.length > 0) {
|
|
1364
|
+
y.preventDefault(), d?.(b.slice(0, -1));
|
|
1334
1365
|
return;
|
|
1335
1366
|
}
|
|
1336
|
-
if (
|
|
1337
|
-
if (
|
|
1338
|
-
if (
|
|
1339
|
-
|
|
1367
|
+
if (L.length !== 0)
|
|
1368
|
+
if (y.key === "ArrowDown") {
|
|
1369
|
+
if (y.preventDefault(), !W) {
|
|
1370
|
+
U();
|
|
1340
1371
|
return;
|
|
1341
1372
|
}
|
|
1342
|
-
|
|
1343
|
-
const
|
|
1344
|
-
return
|
|
1373
|
+
S((A) => {
|
|
1374
|
+
const H = L.indexOf(A);
|
|
1375
|
+
return H < L.length - 1 ? L[H + 1] : L[0];
|
|
1345
1376
|
});
|
|
1346
|
-
} else if (
|
|
1347
|
-
|
|
1348
|
-
const
|
|
1349
|
-
return
|
|
1377
|
+
} else if (y.key === "ArrowUp")
|
|
1378
|
+
y.preventDefault(), S((A) => {
|
|
1379
|
+
const H = L.indexOf(A);
|
|
1380
|
+
return H > 0 ? L[H - 1] : L[L.length - 1];
|
|
1350
1381
|
});
|
|
1351
|
-
else if (
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1382
|
+
else if (y.key === "Enter") {
|
|
1383
|
+
if (y.preventDefault(), B && D === z) {
|
|
1384
|
+
N();
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
const A = he[D];
|
|
1388
|
+
A && !A.disabled ? J(A.value) : B && N();
|
|
1389
|
+
} else y.key === "Escape" && (y.preventDefault(), j());
|
|
1356
1390
|
},
|
|
1357
|
-
[
|
|
1391
|
+
[he, D, J, j, Y, b, d, W, U, B, N, z]
|
|
1358
1392
|
);
|
|
1359
|
-
pt(
|
|
1360
|
-
const
|
|
1361
|
-
return /* @__PURE__ */
|
|
1393
|
+
pt(ee, j, W);
|
|
1394
|
+
const _ = b.map((y) => n.find((A) => A.value === y) ?? { value: y, label: y });
|
|
1395
|
+
return /* @__PURE__ */ F(
|
|
1362
1396
|
"div",
|
|
1363
1397
|
{
|
|
1364
|
-
ref:
|
|
1398
|
+
ref: ee,
|
|
1365
1399
|
className: f(
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
t &&
|
|
1370
|
-
a &&
|
|
1400
|
+
P.wrapper,
|
|
1401
|
+
P.searchableWrapper,
|
|
1402
|
+
P[e],
|
|
1403
|
+
t && P.error,
|
|
1404
|
+
a && P.disabled,
|
|
1371
1405
|
o?.wrapper,
|
|
1372
1406
|
i
|
|
1373
1407
|
),
|
|
@@ -1376,115 +1410,139 @@ const Kt = $e(
|
|
|
1376
1410
|
/* @__PURE__ */ s(
|
|
1377
1411
|
"select",
|
|
1378
1412
|
{
|
|
1379
|
-
ref:
|
|
1380
|
-
className:
|
|
1413
|
+
ref: te,
|
|
1414
|
+
className: P.hiddenSelect,
|
|
1381
1415
|
multiple: !0,
|
|
1382
|
-
value:
|
|
1416
|
+
value: b,
|
|
1383
1417
|
disabled: a,
|
|
1384
1418
|
tabIndex: -1,
|
|
1385
1419
|
"aria-hidden": "true",
|
|
1386
1420
|
onChange: () => {
|
|
1387
1421
|
},
|
|
1388
|
-
children: n.map((
|
|
1422
|
+
children: n.map((y) => /* @__PURE__ */ s("option", { value: y.value, children: y.label }, y.value))
|
|
1389
1423
|
}
|
|
1390
1424
|
),
|
|
1391
|
-
/* @__PURE__ */
|
|
1425
|
+
/* @__PURE__ */ F(
|
|
1392
1426
|
"div",
|
|
1393
1427
|
{
|
|
1394
1428
|
className: f(
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
t &&
|
|
1399
|
-
a &&
|
|
1429
|
+
P.multiTrigger,
|
|
1430
|
+
P[e],
|
|
1431
|
+
W && P.triggerOpen,
|
|
1432
|
+
t && P.error,
|
|
1433
|
+
a && P.multiTriggerDisabled,
|
|
1400
1434
|
o?.root
|
|
1401
1435
|
),
|
|
1402
1436
|
onClick: () => {
|
|
1403
|
-
|
|
1437
|
+
W ? re.current?.focus() : U();
|
|
1404
1438
|
},
|
|
1405
1439
|
role: "combobox",
|
|
1406
|
-
"aria-expanded":
|
|
1440
|
+
"aria-expanded": W,
|
|
1407
1441
|
"aria-haspopup": "listbox",
|
|
1408
|
-
"aria-controls":
|
|
1442
|
+
"aria-controls": W ? G : void 0,
|
|
1409
1443
|
children: [
|
|
1410
|
-
|
|
1411
|
-
/* @__PURE__ */ s("span", { className:
|
|
1444
|
+
_.map((y) => /* @__PURE__ */ F("span", { className: f(P.chip, o?.chip), children: [
|
|
1445
|
+
/* @__PURE__ */ s("span", { className: P.chipLabel, children: y.content ?? y.label }),
|
|
1412
1446
|
/* @__PURE__ */ s(
|
|
1413
1447
|
"button",
|
|
1414
1448
|
{
|
|
1415
1449
|
type: "button",
|
|
1416
|
-
className: f(
|
|
1417
|
-
onClick: (
|
|
1418
|
-
"aria-label": `Remove ${
|
|
1450
|
+
className: f(P.chipRemove, o?.chipRemove),
|
|
1451
|
+
onClick: (L) => oe(y.value, L),
|
|
1452
|
+
"aria-label": `Remove ${y.label}`,
|
|
1419
1453
|
tabIndex: -1,
|
|
1420
1454
|
children: "×"
|
|
1421
1455
|
}
|
|
1422
1456
|
)
|
|
1423
|
-
] },
|
|
1457
|
+
] }, y.value)),
|
|
1424
1458
|
/* @__PURE__ */ s(
|
|
1425
1459
|
"input",
|
|
1426
1460
|
{
|
|
1427
|
-
ref:
|
|
1461
|
+
ref: re,
|
|
1428
1462
|
id: h,
|
|
1429
1463
|
type: "text",
|
|
1430
|
-
className:
|
|
1431
|
-
placeholder:
|
|
1432
|
-
value:
|
|
1433
|
-
onChange: (
|
|
1434
|
-
|
|
1464
|
+
className: P.multiSearch,
|
|
1465
|
+
placeholder: b.length === 0 ? r : "",
|
|
1466
|
+
value: Y,
|
|
1467
|
+
onChange: (y) => {
|
|
1468
|
+
Q(y.target.value), W || U();
|
|
1435
1469
|
},
|
|
1436
|
-
onKeyDown:
|
|
1470
|
+
onKeyDown: T,
|
|
1437
1471
|
disabled: a,
|
|
1438
1472
|
"aria-label": "Search options"
|
|
1439
1473
|
}
|
|
1440
1474
|
),
|
|
1441
|
-
/* @__PURE__ */ s("span", { className: f(
|
|
1475
|
+
/* @__PURE__ */ s("span", { className: f(P.arrow, P.arrowMulti, o?.arrow) })
|
|
1442
1476
|
]
|
|
1443
1477
|
}
|
|
1444
1478
|
),
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1479
|
+
W && /* @__PURE__ */ s("div", { id: G, className: f(P.menu, o?.menu), role: "listbox", "aria-multiselectable": "true", children: /* @__PURE__ */ F("div", { className: P.menuItems, ref: M, children: [
|
|
1480
|
+
he.length === 0 && !B && /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }),
|
|
1481
|
+
he.map((y, L) => {
|
|
1482
|
+
const A = b.includes(y.value);
|
|
1483
|
+
return /* @__PURE__ */ F(
|
|
1484
|
+
"button",
|
|
1485
|
+
{
|
|
1486
|
+
id: `select-option-${y.value}`,
|
|
1487
|
+
type: "button",
|
|
1488
|
+
role: "option",
|
|
1489
|
+
"aria-selected": A,
|
|
1490
|
+
className: f(
|
|
1491
|
+
P.item,
|
|
1492
|
+
y.disabled && P.itemDisabled,
|
|
1493
|
+
A && P.itemSelected,
|
|
1494
|
+
L === D && P.itemHighlighted,
|
|
1495
|
+
o?.item
|
|
1496
|
+
),
|
|
1497
|
+
disabled: y.disabled,
|
|
1498
|
+
onClick: () => J(y.value),
|
|
1499
|
+
onMouseEnter: () => S(L),
|
|
1500
|
+
children: [
|
|
1501
|
+
A && /* @__PURE__ */ s("span", { className: P.itemCheck, "aria-hidden": "true" }),
|
|
1502
|
+
y.content ?? y.label
|
|
1503
|
+
]
|
|
1504
|
+
},
|
|
1505
|
+
y.value
|
|
1506
|
+
);
|
|
1507
|
+
}),
|
|
1508
|
+
B && /* @__PURE__ */ s(
|
|
1448
1509
|
"button",
|
|
1449
1510
|
{
|
|
1450
|
-
id: `select-option-${L.value}`,
|
|
1451
1511
|
type: "button",
|
|
1452
1512
|
role: "option",
|
|
1453
|
-
"aria-selected":
|
|
1513
|
+
"aria-selected": !1,
|
|
1454
1514
|
className: f(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
M && I.itemSelected,
|
|
1458
|
-
v === E && I.itemHighlighted,
|
|
1515
|
+
P.item,
|
|
1516
|
+
D === z && P.itemHighlighted,
|
|
1459
1517
|
o?.item
|
|
1460
1518
|
),
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
]
|
|
1519
|
+
onClick: N,
|
|
1520
|
+
onMouseEnter: () => S(z),
|
|
1521
|
+
children: C ? C(w) : /* @__PURE__ */ F(Xe, { children: [
|
|
1522
|
+
"Create “",
|
|
1523
|
+
/* @__PURE__ */ s("strong", { children: w }),
|
|
1524
|
+
"”"
|
|
1525
|
+
] })
|
|
1468
1526
|
},
|
|
1469
|
-
|
|
1470
|
-
)
|
|
1471
|
-
|
|
1527
|
+
"__create__"
|
|
1528
|
+
)
|
|
1529
|
+
] }) })
|
|
1472
1530
|
]
|
|
1473
1531
|
}
|
|
1474
1532
|
);
|
|
1475
1533
|
}
|
|
1476
1534
|
);
|
|
1477
|
-
|
|
1478
|
-
const
|
|
1479
|
-
(e, t) => e.multiple ? /* @__PURE__ */ s(
|
|
1535
|
+
Qt.displayName = "MultiSelect";
|
|
1536
|
+
const Ec = $e(
|
|
1537
|
+
(e, t) => e.multiple ? /* @__PURE__ */ s(Qt, { ref: t, ...e }) : e.searchable ? /* @__PURE__ */ s(Kt, { ref: t, ...e }) : /* @__PURE__ */ s(Zt, { ref: t, ...e })
|
|
1480
1538
|
);
|
|
1481
|
-
|
|
1482
|
-
const
|
|
1483
|
-
root:
|
|
1484
|
-
input:
|
|
1485
|
-
label:
|
|
1486
|
-
indeterminate:
|
|
1487
|
-
},
|
|
1539
|
+
Ec.displayName = "Select";
|
|
1540
|
+
const Pc = "crk-root-61cKD", Wc = "crk-input-bAjPU", Hc = "crk-label-W9IeS", Oc = "crk-indeterminate-mLarv", dt = {
|
|
1541
|
+
root: Pc,
|
|
1542
|
+
input: Wc,
|
|
1543
|
+
label: Hc,
|
|
1544
|
+
indeterminate: Oc
|
|
1545
|
+
}, Fc = $e(
|
|
1488
1546
|
({
|
|
1489
1547
|
label: e,
|
|
1490
1548
|
indeterminate: t = !1,
|
|
@@ -1493,10 +1551,10 @@ const Ic = "crk-root-61cKD", Ec = "crk-input-bAjPU", Pc = "crk-label-W9IeS", Wc
|
|
|
1493
1551
|
style: o,
|
|
1494
1552
|
...i
|
|
1495
1553
|
}, c) => {
|
|
1496
|
-
const l =
|
|
1554
|
+
const l = ne(null);
|
|
1497
1555
|
return Be(() => {
|
|
1498
1556
|
l.current && (l.current.indeterminate = t);
|
|
1499
|
-
}, [t]), /* @__PURE__ */
|
|
1557
|
+
}, [t]), /* @__PURE__ */ F(
|
|
1500
1558
|
"label",
|
|
1501
1559
|
{
|
|
1502
1560
|
className: f(dt.root, t && dt.indeterminate, n?.root, r),
|
|
@@ -1519,13 +1577,13 @@ const Ic = "crk-root-61cKD", Ec = "crk-input-bAjPU", Pc = "crk-label-W9IeS", Wc
|
|
|
1519
1577
|
);
|
|
1520
1578
|
}
|
|
1521
1579
|
);
|
|
1522
|
-
|
|
1523
|
-
const
|
|
1524
|
-
group:
|
|
1525
|
-
root:
|
|
1526
|
-
input:
|
|
1527
|
-
label:
|
|
1528
|
-
},
|
|
1580
|
+
Fc.displayName = "Checkbox";
|
|
1581
|
+
const jc = "crk-group-NNwCD", Xc = "crk-root-7fGik", _c = "crk-input-43PQW", Uc = "crk-label-aW30x", ht = {
|
|
1582
|
+
group: jc,
|
|
1583
|
+
root: Xc,
|
|
1584
|
+
input: _c,
|
|
1585
|
+
label: Uc
|
|
1586
|
+
}, Jt = Xt(null), zc = ({
|
|
1529
1587
|
name: e,
|
|
1530
1588
|
value: t,
|
|
1531
1589
|
onChange: n,
|
|
@@ -1536,7 +1594,7 @@ const Oc = "crk-group-NNwCD", Fc = "crk-root-7fGik", jc = "crk-input-43PQW", Xc
|
|
|
1536
1594
|
"aria-label": l,
|
|
1537
1595
|
"aria-labelledby": a,
|
|
1538
1596
|
required: h
|
|
1539
|
-
}) => /* @__PURE__ */ s(
|
|
1597
|
+
}) => /* @__PURE__ */ s(Jt.Provider, { value: { name: e, value: t, onChange: n }, children: /* @__PURE__ */ s(
|
|
1540
1598
|
"div",
|
|
1541
1599
|
{
|
|
1542
1600
|
id: c,
|
|
@@ -1550,8 +1608,8 @@ const Oc = "crk-group-NNwCD", Fc = "crk-root-7fGik", jc = "crk-input-43PQW", Xc
|
|
|
1550
1608
|
children: i
|
|
1551
1609
|
}
|
|
1552
1610
|
) });
|
|
1553
|
-
|
|
1554
|
-
const
|
|
1611
|
+
zc.displayName = "RadioGroup";
|
|
1612
|
+
const Yc = $e(
|
|
1555
1613
|
({
|
|
1556
1614
|
label: e,
|
|
1557
1615
|
value: t,
|
|
@@ -1563,10 +1621,10 @@ const _c = $e(
|
|
|
1563
1621
|
name: l,
|
|
1564
1622
|
...a
|
|
1565
1623
|
}, h) => {
|
|
1566
|
-
const u = ft(
|
|
1567
|
-
u?.onChange?.(t), i?.(
|
|
1624
|
+
const u = ft(Jt), d = u?.name ?? l, m = u ? u.value === t : c, p = (x) => {
|
|
1625
|
+
u?.onChange?.(t), i?.(x);
|
|
1568
1626
|
};
|
|
1569
|
-
return /* @__PURE__ */
|
|
1627
|
+
return /* @__PURE__ */ F("label", { className: f(ht.root, n?.root, r), style: o, children: [
|
|
1570
1628
|
/* @__PURE__ */ s(
|
|
1571
1629
|
"input",
|
|
1572
1630
|
{
|
|
@@ -1584,24 +1642,24 @@ const _c = $e(
|
|
|
1584
1642
|
] });
|
|
1585
1643
|
}
|
|
1586
1644
|
);
|
|
1587
|
-
|
|
1588
|
-
const
|
|
1589
|
-
root:
|
|
1590
|
-
sm:
|
|
1591
|
-
md:
|
|
1592
|
-
lg:
|
|
1593
|
-
error:
|
|
1594
|
-
resizeNone:
|
|
1595
|
-
resizeVertical:
|
|
1596
|
-
resizeHorizontal:
|
|
1597
|
-
resizeBoth:
|
|
1598
|
-
autoExpand:
|
|
1599
|
-
},
|
|
1645
|
+
Yc.displayName = "Radio";
|
|
1646
|
+
const Vc = "crk-root-IGgdn", qc = "crk-sm-N-5I2", Gc = "crk-md-bbyFl", Zc = "crk-lg-Pd-Iq", Kc = "crk-error-fyu3i", Qc = "crk-resizeNone-SmNT4", Jc = "crk-resizeVertical-oi8vP", ei = "crk-resizeHorizontal-riMLL", ti = "crk-resizeBoth-NYSh4", ni = "crk-autoExpand-JWone", Ke = {
|
|
1647
|
+
root: Vc,
|
|
1648
|
+
sm: qc,
|
|
1649
|
+
md: Gc,
|
|
1650
|
+
lg: Zc,
|
|
1651
|
+
error: Kc,
|
|
1652
|
+
resizeNone: Qc,
|
|
1653
|
+
resizeVertical: Jc,
|
|
1654
|
+
resizeHorizontal: ei,
|
|
1655
|
+
resizeBoth: ti,
|
|
1656
|
+
autoExpand: ni
|
|
1657
|
+
}, ri = {
|
|
1600
1658
|
none: "resizeNone",
|
|
1601
1659
|
vertical: "resizeVertical",
|
|
1602
1660
|
horizontal: "resizeHorizontal",
|
|
1603
1661
|
both: "resizeBoth"
|
|
1604
|
-
},
|
|
1662
|
+
}, oi = $e(
|
|
1605
1663
|
({
|
|
1606
1664
|
inputSize: e = "md",
|
|
1607
1665
|
error: t = !1,
|
|
@@ -1612,14 +1670,14 @@ const zc = "crk-root-IGgdn", Yc = "crk-sm-N-5I2", Vc = "crk-md-bbyFl", qc = "crk
|
|
|
1612
1670
|
onChange: c,
|
|
1613
1671
|
...l
|
|
1614
1672
|
}, a) => {
|
|
1615
|
-
const h =
|
|
1673
|
+
const h = ne(null), u = de(() => {
|
|
1616
1674
|
const p = h.current;
|
|
1617
1675
|
p && (p.style.height = "auto", p.style.height = `${p.scrollHeight}px`);
|
|
1618
1676
|
}, []), d = l.value ?? "";
|
|
1619
1677
|
Be(() => {
|
|
1620
1678
|
r && u();
|
|
1621
1679
|
}, [r, u, d]);
|
|
1622
|
-
const m =
|
|
1680
|
+
const m = de(
|
|
1623
1681
|
(p) => {
|
|
1624
1682
|
r && u(), c?.(p);
|
|
1625
1683
|
},
|
|
@@ -1635,7 +1693,7 @@ const zc = "crk-root-IGgdn", Yc = "crk-sm-N-5I2", Vc = "crk-md-bbyFl", qc = "crk
|
|
|
1635
1693
|
Ke.root,
|
|
1636
1694
|
Ke[e],
|
|
1637
1695
|
t && Ke.error,
|
|
1638
|
-
r ? Ke.autoExpand : Ke[
|
|
1696
|
+
r ? Ke.autoExpand : Ke[ri[n]],
|
|
1639
1697
|
o
|
|
1640
1698
|
),
|
|
1641
1699
|
style: i,
|
|
@@ -1646,9 +1704,9 @@ const zc = "crk-root-IGgdn", Yc = "crk-sm-N-5I2", Vc = "crk-md-bbyFl", qc = "crk
|
|
|
1646
1704
|
);
|
|
1647
1705
|
}
|
|
1648
1706
|
);
|
|
1649
|
-
|
|
1650
|
-
function
|
|
1651
|
-
const [n, r] = Se(t), o =
|
|
1707
|
+
oi.displayName = "Textarea";
|
|
1708
|
+
function ci(e, t = { width: 600, height: 300 }) {
|
|
1709
|
+
const [n, r] = Se(t), o = ne(t);
|
|
1652
1710
|
return Be(() => {
|
|
1653
1711
|
const i = e.current;
|
|
1654
1712
|
if (!i || typeof ResizeObserver > "u") return;
|
|
@@ -1666,52 +1724,52 @@ function ri(e, t = { width: 600, height: 300 }) {
|
|
|
1666
1724
|
return a.observe(i), () => a.disconnect();
|
|
1667
1725
|
}, [e]), n;
|
|
1668
1726
|
}
|
|
1669
|
-
const
|
|
1670
|
-
root:
|
|
1671
|
-
canvas:
|
|
1672
|
-
svg:
|
|
1673
|
-
gridLine:
|
|
1674
|
-
axis:
|
|
1675
|
-
axisLabel:
|
|
1676
|
-
cursorLine:
|
|
1677
|
-
linePath:
|
|
1678
|
-
areaPath:
|
|
1679
|
-
point:
|
|
1680
|
-
bar:
|
|
1681
|
-
barLabelInside:
|
|
1682
|
-
activeBar:
|
|
1683
|
-
interactionLayer:
|
|
1684
|
-
legend:
|
|
1685
|
-
legendItem:
|
|
1686
|
-
legendSwatch:
|
|
1687
|
-
legendIcon:
|
|
1688
|
-
legendLabel:
|
|
1689
|
-
tooltip:
|
|
1690
|
-
tooltipTitle:
|
|
1691
|
-
tooltipRows:
|
|
1692
|
-
tooltipRow:
|
|
1693
|
-
tooltipLabel:
|
|
1694
|
-
tooltipValue:
|
|
1695
|
-
empty:
|
|
1696
|
-
sparkline:
|
|
1697
|
-
tradingHeader:
|
|
1727
|
+
const ii = "crk-root-uMSq0", li = "crk-canvas-zhFr0", si = "crk-svg-waPLB", ai = "crk-gridLine-K2Gx9", di = "crk-axis-Zum8-", ui = "crk-axisLabel-Ilv3u", hi = "crk-cursorLine-iNHim", mi = "crk-linePath-E4eYA", fi = "crk-areaPath-ZwMc6", pi = "crk-point-DTAoa", gi = "crk-bar-9sYbq", yi = "crk-barLabelInside-dlQh5", vi = "crk-activeBar-FJhPJ", bi = "crk-interactionLayer-dHNAG", xi = "crk-legend-JL6YI", ki = "crk-legendItem-rcdvO", Mi = "crk-legendSwatch-eJBsF", wi = "crk-legendIcon-6gzcO", $i = "crk-legendLabel-C-eu3", Ni = "crk-tooltip-m55-N", Li = "crk-tooltipTitle-0EfoX", Si = "crk-tooltipRows-MC0wM", Ti = "crk-tooltipRow-ZQomr", Ri = "crk-tooltipLabel-s4OKX", Ci = "crk-tooltipValue-iwj1s", Ai = "crk-empty-aa4vk", Bi = "crk-sparkline-3-eRc", Di = "crk-tradingHeader-Pb9wS", k = {
|
|
1728
|
+
root: ii,
|
|
1729
|
+
canvas: li,
|
|
1730
|
+
svg: si,
|
|
1731
|
+
gridLine: ai,
|
|
1732
|
+
axis: di,
|
|
1733
|
+
axisLabel: ui,
|
|
1734
|
+
cursorLine: hi,
|
|
1735
|
+
linePath: mi,
|
|
1736
|
+
areaPath: fi,
|
|
1737
|
+
point: pi,
|
|
1738
|
+
bar: gi,
|
|
1739
|
+
barLabelInside: yi,
|
|
1740
|
+
activeBar: vi,
|
|
1741
|
+
interactionLayer: bi,
|
|
1742
|
+
legend: xi,
|
|
1743
|
+
legendItem: ki,
|
|
1744
|
+
legendSwatch: Mi,
|
|
1745
|
+
legendIcon: wi,
|
|
1746
|
+
legendLabel: $i,
|
|
1747
|
+
tooltip: Ni,
|
|
1748
|
+
tooltipTitle: Li,
|
|
1749
|
+
tooltipRows: Si,
|
|
1750
|
+
tooltipRow: Ti,
|
|
1751
|
+
tooltipLabel: Ri,
|
|
1752
|
+
tooltipValue: Ci,
|
|
1753
|
+
empty: Ai,
|
|
1754
|
+
sparkline: Bi,
|
|
1755
|
+
tradingHeader: Di
|
|
1698
1756
|
}, Ve = $e(
|
|
1699
1757
|
({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: i, overlay: c, children: l }, a) => {
|
|
1700
|
-
const h =
|
|
1701
|
-
|
|
1702
|
-
const { width: u } =
|
|
1703
|
-
return /* @__PURE__ */
|
|
1758
|
+
const h = ne(null);
|
|
1759
|
+
an(a, () => h.current);
|
|
1760
|
+
const { width: u } = ci(h), d = Math.max(0, u), m = t ?? Math.round(d / e);
|
|
1761
|
+
return /* @__PURE__ */ F(
|
|
1704
1762
|
"div",
|
|
1705
1763
|
{
|
|
1706
1764
|
ref: h,
|
|
1707
|
-
className: f(
|
|
1765
|
+
className: f(k.root, o?.root, n),
|
|
1708
1766
|
style: r,
|
|
1709
1767
|
children: [
|
|
1710
|
-
/* @__PURE__ */
|
|
1768
|
+
/* @__PURE__ */ F("div", { className: k.canvas, style: { height: m || void 0 }, children: [
|
|
1711
1769
|
d > 0 && m > 0 && /* @__PURE__ */ s(
|
|
1712
1770
|
"svg",
|
|
1713
1771
|
{
|
|
1714
|
-
className: f(
|
|
1772
|
+
className: f(k.svg, o?.svg),
|
|
1715
1773
|
width: d,
|
|
1716
1774
|
height: m,
|
|
1717
1775
|
viewBox: `0 0 ${d} ${m}`,
|
|
@@ -1730,13 +1788,13 @@ const oi = "crk-root-uMSq0", ci = "crk-canvas-zhFr0", ii = "crk-svg-waPLB", li =
|
|
|
1730
1788
|
Ve.displayName = "ChartContainer";
|
|
1731
1789
|
function vt({ config: e, order: t, classes: n }) {
|
|
1732
1790
|
const r = t ?? Object.keys(e);
|
|
1733
|
-
return /* @__PURE__ */ s("div", { className: f(
|
|
1791
|
+
return /* @__PURE__ */ s("div", { className: f(k.legend, n?.legend), role: "list", children: r.map((o) => {
|
|
1734
1792
|
const i = e[o];
|
|
1735
|
-
return i ? /* @__PURE__ */
|
|
1793
|
+
return i ? /* @__PURE__ */ F("div", { className: f(k.legendItem, n?.legendItem), role: "listitem", children: [
|
|
1736
1794
|
i.icon ? /* @__PURE__ */ s(
|
|
1737
1795
|
"span",
|
|
1738
1796
|
{
|
|
1739
|
-
className:
|
|
1797
|
+
className: k.legendIcon,
|
|
1740
1798
|
style: { color: i.color },
|
|
1741
1799
|
"aria-hidden": "true",
|
|
1742
1800
|
children: i.icon
|
|
@@ -1744,12 +1802,12 @@ function vt({ config: e, order: t, classes: n }) {
|
|
|
1744
1802
|
) : /* @__PURE__ */ s(
|
|
1745
1803
|
"span",
|
|
1746
1804
|
{
|
|
1747
|
-
className:
|
|
1805
|
+
className: k.legendSwatch,
|
|
1748
1806
|
style: { background: i.color },
|
|
1749
1807
|
"aria-hidden": "true"
|
|
1750
1808
|
}
|
|
1751
1809
|
),
|
|
1752
|
-
/* @__PURE__ */ s("span", { className:
|
|
1810
|
+
/* @__PURE__ */ s("span", { className: k.legendLabel, children: i.label })
|
|
1753
1811
|
] }, o) : null;
|
|
1754
1812
|
}) });
|
|
1755
1813
|
}
|
|
@@ -1770,31 +1828,31 @@ function et({
|
|
|
1770
1828
|
return /* @__PURE__ */ s(
|
|
1771
1829
|
"div",
|
|
1772
1830
|
{
|
|
1773
|
-
className: f(
|
|
1831
|
+
className: f(k.tooltip, h?.tooltip),
|
|
1774
1832
|
style: { left: m, top: p, width: u },
|
|
1775
1833
|
role: "tooltip",
|
|
1776
|
-
children: i ? i(e) : /* @__PURE__ */
|
|
1777
|
-
l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className:
|
|
1778
|
-
/* @__PURE__ */ s("div", { className:
|
|
1779
|
-
const
|
|
1780
|
-
if (
|
|
1781
|
-
const
|
|
1782
|
-
return /* @__PURE__ */
|
|
1783
|
-
/* @__PURE__ */ s("span", { className:
|
|
1784
|
-
/* @__PURE__ */ s("span", { className:
|
|
1785
|
-
/* @__PURE__ */ s("span", { className:
|
|
1786
|
-
] },
|
|
1834
|
+
children: i ? i(e) : /* @__PURE__ */ F(Xe, { children: [
|
|
1835
|
+
l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: k.tooltipTitle, children: String(e[l]) }),
|
|
1836
|
+
/* @__PURE__ */ s("div", { className: k.tooltipRows, children: Object.entries(o).map(([x, C]) => {
|
|
1837
|
+
const $ = e[x];
|
|
1838
|
+
if ($ == null) return null;
|
|
1839
|
+
const b = typeof $ == "number" ? c($) : String($), W = a?.(x) ?? C.color;
|
|
1840
|
+
return /* @__PURE__ */ F("div", { className: k.tooltipRow, children: [
|
|
1841
|
+
/* @__PURE__ */ s("span", { className: k.legendSwatch, style: { background: W }, "aria-hidden": "true" }),
|
|
1842
|
+
/* @__PURE__ */ s("span", { className: k.tooltipLabel, children: C.label }),
|
|
1843
|
+
/* @__PURE__ */ s("span", { className: k.tooltipValue, children: b })
|
|
1844
|
+
] }, x);
|
|
1787
1845
|
}) })
|
|
1788
1846
|
] })
|
|
1789
1847
|
}
|
|
1790
1848
|
);
|
|
1791
1849
|
}
|
|
1792
|
-
function
|
|
1793
|
-
return /* @__PURE__ */ s("g", { className: f(
|
|
1850
|
+
function en({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: i }) {
|
|
1851
|
+
return /* @__PURE__ */ s("g", { className: f(k.axis, i?.axis), children: e.map(({ value: c, y: l }) => /* @__PURE__ */ F("g", { children: [
|
|
1794
1852
|
o && /* @__PURE__ */ s(
|
|
1795
1853
|
"line",
|
|
1796
1854
|
{
|
|
1797
|
-
className: f(
|
|
1855
|
+
className: f(k.gridLine, i?.grid),
|
|
1798
1856
|
x1: t,
|
|
1799
1857
|
x2: t + n,
|
|
1800
1858
|
y1: l,
|
|
@@ -1804,7 +1862,7 @@ function Jt({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
|
|
|
1804
1862
|
/* @__PURE__ */ s(
|
|
1805
1863
|
"text",
|
|
1806
1864
|
{
|
|
1807
|
-
className: f(
|
|
1865
|
+
className: f(k.axisLabel, i?.axisLabel),
|
|
1808
1866
|
x: t - 8,
|
|
1809
1867
|
y: l,
|
|
1810
1868
|
textAnchor: "end",
|
|
@@ -1814,11 +1872,11 @@ function Jt({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
|
|
|
1814
1872
|
)
|
|
1815
1873
|
] }, `y-${c}`)) });
|
|
1816
1874
|
}
|
|
1817
|
-
function
|
|
1818
|
-
return /* @__PURE__ */ s("g", { className: f(
|
|
1875
|
+
function tn({ ticks: e, y: t, format: n, classes: r }) {
|
|
1876
|
+
return /* @__PURE__ */ s("g", { className: f(k.axis, r?.axis), children: e.map(({ label: o, x: i }) => /* @__PURE__ */ s(
|
|
1819
1877
|
"text",
|
|
1820
1878
|
{
|
|
1821
|
-
className: f(
|
|
1879
|
+
className: f(k.axisLabel, r?.axisLabel),
|
|
1822
1880
|
x: i,
|
|
1823
1881
|
y: t + 16,
|
|
1824
1882
|
textAnchor: "middle",
|
|
@@ -1840,7 +1898,7 @@ function Je(e, t) {
|
|
|
1840
1898
|
const [n, r] = e, [o, i] = t, c = r - n || 1, l = i - o, a = (h) => o + (h - n) / c * l;
|
|
1841
1899
|
return a.invert = (h) => n + (h - o) / l * c, a;
|
|
1842
1900
|
}
|
|
1843
|
-
function
|
|
1901
|
+
function _e(e, t, n = 0.2) {
|
|
1844
1902
|
const [r, o] = t, c = (o - r) / Math.max(1, e.length), l = c * (1 - n), a = /* @__PURE__ */ new Map();
|
|
1845
1903
|
for (let u = 0; u < e.length; u++) a.set(e[u], u);
|
|
1846
1904
|
const h = (u) => {
|
|
@@ -1860,8 +1918,8 @@ function qe(e, t, n = 5) {
|
|
|
1860
1918
|
u.push(Number(d.toFixed(10)));
|
|
1861
1919
|
return u;
|
|
1862
1920
|
}
|
|
1863
|
-
const
|
|
1864
|
-
function
|
|
1921
|
+
const Ii = { top: 12, right: 16, bottom: 28, left: 48 };
|
|
1922
|
+
function Ei(e, t) {
|
|
1865
1923
|
if (e.length === 0) return "";
|
|
1866
1924
|
if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
|
|
1867
1925
|
if (t === "linear")
|
|
@@ -1879,12 +1937,12 @@ function Di(e, t) {
|
|
|
1879
1937
|
}
|
|
1880
1938
|
return n;
|
|
1881
1939
|
}
|
|
1882
|
-
function
|
|
1940
|
+
function Pi(e, t = 8) {
|
|
1883
1941
|
if (e.length <= t) return e;
|
|
1884
1942
|
const n = Math.ceil(e.length / t);
|
|
1885
1943
|
return e.filter((r, o) => o % n === 0);
|
|
1886
1944
|
}
|
|
1887
|
-
function
|
|
1945
|
+
function Hl({
|
|
1888
1946
|
data: e,
|
|
1889
1947
|
xKey: t,
|
|
1890
1948
|
config: n,
|
|
@@ -1899,176 +1957,176 @@ function El({
|
|
|
1899
1957
|
renderLabel: d,
|
|
1900
1958
|
activeIndex: m,
|
|
1901
1959
|
onPointClick: p,
|
|
1902
|
-
showGrid:
|
|
1903
|
-
showLegend:
|
|
1904
|
-
showTooltip:
|
|
1905
|
-
yTickCount:
|
|
1906
|
-
yFormat:
|
|
1907
|
-
xFormat:
|
|
1908
|
-
valueFormat:
|
|
1909
|
-
renderTooltip:
|
|
1910
|
-
margin:
|
|
1911
|
-
emptyMessage:
|
|
1912
|
-
className:
|
|
1913
|
-
style:
|
|
1914
|
-
classes:
|
|
1960
|
+
showGrid: x = !0,
|
|
1961
|
+
showLegend: C = !0,
|
|
1962
|
+
showTooltip: $ = !0,
|
|
1963
|
+
yTickCount: b = 5,
|
|
1964
|
+
yFormat: W,
|
|
1965
|
+
xFormat: X,
|
|
1966
|
+
valueFormat: Y,
|
|
1967
|
+
renderTooltip: Q,
|
|
1968
|
+
margin: D,
|
|
1969
|
+
emptyMessage: S = "No data",
|
|
1970
|
+
className: ee,
|
|
1971
|
+
style: re,
|
|
1972
|
+
classes: M
|
|
1915
1973
|
}) {
|
|
1916
|
-
const
|
|
1974
|
+
const G = { ...Ii, ...D }, O = ke(() => Object.keys(n), [n]), [te, j] = Se(null), U = ne(null), J = m ?? te, oe = (w, B) => {
|
|
1917
1975
|
if (l) {
|
|
1918
|
-
const N = e[
|
|
1976
|
+
const N = e[B]?.[l];
|
|
1919
1977
|
if (typeof N == "string") return N;
|
|
1920
1978
|
}
|
|
1921
|
-
return n[
|
|
1979
|
+
return n[w]?.color ?? "var(--crk-chart-1)";
|
|
1922
1980
|
};
|
|
1923
1981
|
if (e.length === 0)
|
|
1924
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
1925
|
-
const
|
|
1982
|
+
return /* @__PURE__ */ s("div", { ref: U, className: f(k.root, M?.root, ee), style: re, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: S }) }) });
|
|
1983
|
+
const he = $ && J !== null ? /* @__PURE__ */ s(
|
|
1926
1984
|
et,
|
|
1927
1985
|
{
|
|
1928
|
-
row: e[
|
|
1929
|
-
x:
|
|
1986
|
+
row: e[J],
|
|
1987
|
+
x: Wi(e, t, G, J, U),
|
|
1930
1988
|
y: 16,
|
|
1931
|
-
containerWidth:
|
|
1989
|
+
containerWidth: U.current?.getBoundingClientRect().width ?? 0,
|
|
1932
1990
|
config: n,
|
|
1933
|
-
render:
|
|
1934
|
-
valueFormat:
|
|
1991
|
+
render: Q ? () => Q(e[J]) : void 0,
|
|
1992
|
+
valueFormat: Y,
|
|
1935
1993
|
titleKey: t,
|
|
1936
|
-
resolveColor: l ? (
|
|
1937
|
-
classes:
|
|
1994
|
+
resolveColor: l ? (w) => oe(w, J) : void 0,
|
|
1995
|
+
classes: M
|
|
1938
1996
|
}
|
|
1939
1997
|
) : null;
|
|
1940
1998
|
return /* @__PURE__ */ s(
|
|
1941
1999
|
Ve,
|
|
1942
2000
|
{
|
|
1943
|
-
ref:
|
|
2001
|
+
ref: U,
|
|
1944
2002
|
aspectRatio: r,
|
|
1945
2003
|
height: o,
|
|
1946
|
-
className:
|
|
1947
|
-
style:
|
|
1948
|
-
classes:
|
|
1949
|
-
legend:
|
|
1950
|
-
overlay:
|
|
1951
|
-
children: ({ width:
|
|
1952
|
-
const N =
|
|
1953
|
-
for (const g of
|
|
1954
|
-
for (const
|
|
1955
|
-
const K =
|
|
1956
|
-
typeof K == "number" &&
|
|
2004
|
+
className: ee,
|
|
2005
|
+
style: re,
|
|
2006
|
+
classes: M,
|
|
2007
|
+
legend: C ? /* @__PURE__ */ s(vt, { config: n, classes: M }) : void 0,
|
|
2008
|
+
overlay: he,
|
|
2009
|
+
children: ({ width: w, height: B }) => {
|
|
2010
|
+
const N = G.left, z = w - G.right, T = G.top, _ = B - G.bottom, y = Math.max(0, z - N), L = Math.max(0, _ - T), A = e.map((g) => String(g[t])), H = _e(A, [N, z], 0), Z = [];
|
|
2011
|
+
for (const g of O)
|
|
2012
|
+
for (const v of e) {
|
|
2013
|
+
const K = v[g];
|
|
2014
|
+
typeof K == "number" && Z.push(K);
|
|
1957
2015
|
}
|
|
1958
|
-
const [ue, be] = bt(
|
|
1959
|
-
return /* @__PURE__ */
|
|
2016
|
+
const [ue, be] = bt(Z), pe = Math.min(0, ue), fe = qe(pe, be, b), ge = Je([fe[0], fe[fe.length - 1]], [_, T]), ve = fe.map((g) => ({ value: g, y: ge(g) })), Ne = Pi(A).map((g) => ({ label: g, x: H(g) }));
|
|
2017
|
+
return /* @__PURE__ */ F(Xe, { children: [
|
|
1960
2018
|
/* @__PURE__ */ s(
|
|
1961
|
-
|
|
2019
|
+
en,
|
|
1962
2020
|
{
|
|
1963
2021
|
ticks: ve,
|
|
1964
2022
|
x: N,
|
|
1965
|
-
plotWidth:
|
|
1966
|
-
format:
|
|
1967
|
-
showGrid:
|
|
1968
|
-
classes:
|
|
2023
|
+
plotWidth: y,
|
|
2024
|
+
format: W,
|
|
2025
|
+
showGrid: x,
|
|
2026
|
+
classes: M
|
|
1969
2027
|
}
|
|
1970
2028
|
),
|
|
1971
|
-
/* @__PURE__ */ s(
|
|
1972
|
-
|
|
1973
|
-
const
|
|
1974
|
-
const
|
|
1975
|
-
return { x:
|
|
2029
|
+
/* @__PURE__ */ s(tn, { ticks: Ne, y: _, format: X, classes: M }),
|
|
2030
|
+
O.map((g) => {
|
|
2031
|
+
const v = n[g], K = e.map((E, V) => {
|
|
2032
|
+
const I = E[g], ae = typeof I == "number" ? I : 0;
|
|
2033
|
+
return { x: H(A[V]), y: ge(ae), value: ae, row: E };
|
|
1976
2034
|
});
|
|
1977
|
-
return /* @__PURE__ */
|
|
2035
|
+
return /* @__PURE__ */ F("g", { className: f(k.series, M?.series), children: [
|
|
1978
2036
|
/* @__PURE__ */ s(
|
|
1979
2037
|
"path",
|
|
1980
2038
|
{
|
|
1981
|
-
className: f(
|
|
1982
|
-
d:
|
|
1983
|
-
stroke:
|
|
2039
|
+
className: f(k.linePath),
|
|
2040
|
+
d: Ei(K, i),
|
|
2041
|
+
stroke: v.color
|
|
1984
2042
|
}
|
|
1985
2043
|
),
|
|
1986
|
-
c && K.map((
|
|
1987
|
-
const
|
|
2044
|
+
c && K.map((E, V) => {
|
|
2045
|
+
const I = oe(g, V), ae = J === V, q = m !== void 0 && !ae, R = p ? () => p({ row: E.row, value: E.value, seriesKey: g, index: V }) : void 0;
|
|
1988
2046
|
return a ? /* @__PURE__ */ s(
|
|
1989
2047
|
"g",
|
|
1990
2048
|
{
|
|
1991
|
-
onClick:
|
|
1992
|
-
style:
|
|
1993
|
-
opacity:
|
|
2049
|
+
onClick: R,
|
|
2050
|
+
style: R ? { cursor: "pointer" } : void 0,
|
|
2051
|
+
opacity: q ? 0.45 : 1,
|
|
1994
2052
|
children: a({
|
|
1995
|
-
row:
|
|
1996
|
-
value:
|
|
2053
|
+
row: E.row,
|
|
2054
|
+
value: E.value,
|
|
1997
2055
|
seriesKey: g,
|
|
1998
|
-
index:
|
|
1999
|
-
x:
|
|
2000
|
-
y:
|
|
2001
|
-
color:
|
|
2002
|
-
active:
|
|
2056
|
+
index: V,
|
|
2057
|
+
x: E.x,
|
|
2058
|
+
y: E.y,
|
|
2059
|
+
color: I,
|
|
2060
|
+
active: ae
|
|
2003
2061
|
})
|
|
2004
2062
|
},
|
|
2005
|
-
`${g}-${
|
|
2063
|
+
`${g}-${V}`
|
|
2006
2064
|
) : /* @__PURE__ */ s(
|
|
2007
2065
|
"circle",
|
|
2008
2066
|
{
|
|
2009
|
-
className: f(
|
|
2010
|
-
cx:
|
|
2011
|
-
cy:
|
|
2012
|
-
r:
|
|
2013
|
-
fill:
|
|
2014
|
-
onClick:
|
|
2015
|
-
style:
|
|
2016
|
-
opacity:
|
|
2067
|
+
className: f(k.point, M?.point),
|
|
2068
|
+
cx: E.x,
|
|
2069
|
+
cy: E.y,
|
|
2070
|
+
r: ae ? 5 : 3.5,
|
|
2071
|
+
fill: I,
|
|
2072
|
+
onClick: R,
|
|
2073
|
+
style: R ? { cursor: "pointer" } : void 0,
|
|
2074
|
+
opacity: q ? 0.45 : 1
|
|
2017
2075
|
},
|
|
2018
|
-
`${g}-${
|
|
2076
|
+
`${g}-${V}`
|
|
2019
2077
|
);
|
|
2020
2078
|
}),
|
|
2021
|
-
(h || d) && K.map((
|
|
2022
|
-
const
|
|
2023
|
-
if (
|
|
2024
|
-
const
|
|
2079
|
+
(h || d) && K.map((E, V) => {
|
|
2080
|
+
const I = d ? d({ row: E.row, value: E.value, seriesKey: g, index: V }) : h ? Y ? Y(E.value) : String(E.value) : null;
|
|
2081
|
+
if (I == null) return null;
|
|
2082
|
+
const ae = 10, q = u === "top" ? E.y - ae : E.y + ae + 4;
|
|
2025
2083
|
return /* @__PURE__ */ s(
|
|
2026
2084
|
"text",
|
|
2027
2085
|
{
|
|
2028
|
-
className: f(
|
|
2029
|
-
x:
|
|
2030
|
-
y:
|
|
2086
|
+
className: f(k.axisLabel),
|
|
2087
|
+
x: E.x,
|
|
2088
|
+
y: q,
|
|
2031
2089
|
textAnchor: "middle",
|
|
2032
2090
|
dominantBaseline: u === "top" ? "auto" : "middle",
|
|
2033
|
-
children:
|
|
2091
|
+
children: I
|
|
2034
2092
|
},
|
|
2035
|
-
`label-${g}-${
|
|
2093
|
+
`label-${g}-${V}`
|
|
2036
2094
|
);
|
|
2037
2095
|
})
|
|
2038
2096
|
] }, g);
|
|
2039
2097
|
}),
|
|
2040
|
-
|
|
2098
|
+
J !== null && /* @__PURE__ */ s(
|
|
2041
2099
|
"line",
|
|
2042
2100
|
{
|
|
2043
|
-
className:
|
|
2044
|
-
x1:
|
|
2045
|
-
x2:
|
|
2046
|
-
y1:
|
|
2047
|
-
y2:
|
|
2101
|
+
className: k.cursorLine,
|
|
2102
|
+
x1: H(A[J]),
|
|
2103
|
+
x2: H(A[J]),
|
|
2104
|
+
y1: T,
|
|
2105
|
+
y2: _
|
|
2048
2106
|
}
|
|
2049
2107
|
),
|
|
2050
2108
|
/* @__PURE__ */ s(
|
|
2051
2109
|
"rect",
|
|
2052
2110
|
{
|
|
2053
|
-
className:
|
|
2111
|
+
className: k.interactionLayer,
|
|
2054
2112
|
x: N,
|
|
2055
|
-
y:
|
|
2056
|
-
width:
|
|
2057
|
-
height:
|
|
2113
|
+
y: T,
|
|
2114
|
+
width: y,
|
|
2115
|
+
height: L,
|
|
2058
2116
|
onMouseMove: (g) => {
|
|
2059
|
-
const
|
|
2117
|
+
const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + N, E = H.step(), V = Math.max(
|
|
2060
2118
|
0,
|
|
2061
|
-
Math.min(e.length - 1, Math.round((K - N -
|
|
2119
|
+
Math.min(e.length - 1, Math.round((K - N - E / 2) / E))
|
|
2062
2120
|
);
|
|
2063
|
-
|
|
2121
|
+
j(V);
|
|
2064
2122
|
},
|
|
2065
|
-
onMouseLeave: () =>
|
|
2123
|
+
onMouseLeave: () => j(null),
|
|
2066
2124
|
onClick: p ? (g) => {
|
|
2067
|
-
const
|
|
2125
|
+
const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + N, E = H.step(), V = Math.max(
|
|
2068
2126
|
0,
|
|
2069
|
-
Math.min(e.length - 1, Math.round((K - N -
|
|
2070
|
-
),
|
|
2071
|
-
p({ row: e[
|
|
2127
|
+
Math.min(e.length - 1, Math.round((K - N - E / 2) / E))
|
|
2128
|
+
), I = O[0], ae = e[V][I], q = typeof ae == "number" ? ae : 0;
|
|
2129
|
+
p({ row: e[V], value: q, seriesKey: I, index: V });
|
|
2072
2130
|
} : void 0,
|
|
2073
2131
|
style: p ? { cursor: "pointer" } : void 0
|
|
2074
2132
|
}
|
|
@@ -2078,13 +2136,13 @@ function El({
|
|
|
2078
2136
|
}
|
|
2079
2137
|
);
|
|
2080
2138
|
}
|
|
2081
|
-
function
|
|
2139
|
+
function Wi(e, t, n, r, o) {
|
|
2082
2140
|
const i = o.current;
|
|
2083
2141
|
if (!i) return 0;
|
|
2084
2142
|
const c = i.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
|
|
2085
|
-
return
|
|
2143
|
+
return _e(l, [n.left, c - n.right], 0)(l[r]);
|
|
2086
2144
|
}
|
|
2087
|
-
const
|
|
2145
|
+
const Hi = { top: 12, right: 16, bottom: 28, left: 48 };
|
|
2088
2146
|
function St(e, t) {
|
|
2089
2147
|
if (e.length === 0) return "";
|
|
2090
2148
|
if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
|
|
@@ -2113,12 +2171,12 @@ function Dt(e, t, n) {
|
|
|
2113
2171
|
const o = e.map((l, a) => ({ x: l.x, y: t[a] })).reverse(), c = St(o, n).replace(/^M /, "L ");
|
|
2114
2172
|
return `${r} ${c} Z`;
|
|
2115
2173
|
}
|
|
2116
|
-
function
|
|
2174
|
+
function Oi(e, t = 8) {
|
|
2117
2175
|
if (e.length <= t) return e;
|
|
2118
2176
|
const n = Math.ceil(e.length / t);
|
|
2119
2177
|
return e.filter((r, o) => o % n === 0);
|
|
2120
2178
|
}
|
|
2121
|
-
function
|
|
2179
|
+
function Ol({
|
|
2122
2180
|
data: e,
|
|
2123
2181
|
xKey: t,
|
|
2124
2182
|
config: n,
|
|
@@ -2133,91 +2191,91 @@ function Pl({
|
|
|
2133
2191
|
showYAxis: d = !0,
|
|
2134
2192
|
showLegend: m = !0,
|
|
2135
2193
|
showTooltip: p = !0,
|
|
2136
|
-
yTickCount:
|
|
2137
|
-
yFormat:
|
|
2138
|
-
xFormat:
|
|
2139
|
-
valueFormat:
|
|
2140
|
-
renderTooltip:
|
|
2141
|
-
margin:
|
|
2142
|
-
emptyMessage:
|
|
2143
|
-
className:
|
|
2144
|
-
style:
|
|
2145
|
-
classes:
|
|
2194
|
+
yTickCount: x = 5,
|
|
2195
|
+
yFormat: C,
|
|
2196
|
+
xFormat: $,
|
|
2197
|
+
valueFormat: b,
|
|
2198
|
+
renderTooltip: W,
|
|
2199
|
+
margin: X,
|
|
2200
|
+
emptyMessage: Y = "No data",
|
|
2201
|
+
className: Q,
|
|
2202
|
+
style: D,
|
|
2203
|
+
classes: S
|
|
2146
2204
|
}) {
|
|
2147
|
-
const
|
|
2205
|
+
const ee = ke(
|
|
2148
2206
|
() => ({
|
|
2149
|
-
...
|
|
2207
|
+
...Hi,
|
|
2150
2208
|
...d ? {} : { left: 16 },
|
|
2151
|
-
...
|
|
2209
|
+
...X
|
|
2152
2210
|
}),
|
|
2153
|
-
[
|
|
2154
|
-
),
|
|
2211
|
+
[X, d]
|
|
2212
|
+
), re = ke(() => Object.keys(n), [n]), M = c && re.length > 0, G = M && l === "expand", [O, te] = Se(null), j = ne(null), U = Ye();
|
|
2155
2213
|
if (e.length === 0)
|
|
2156
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
2157
|
-
const
|
|
2158
|
-
const N =
|
|
2159
|
-
for (let
|
|
2160
|
-
let
|
|
2161
|
-
if (
|
|
2162
|
-
for (const
|
|
2163
|
-
const
|
|
2164
|
-
typeof
|
|
2214
|
+
return /* @__PURE__ */ s("div", { ref: j, className: f(k.root, S?.root, Q), style: D, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: Y }) }) });
|
|
2215
|
+
const J = ke(() => {
|
|
2216
|
+
const N = re.map(() => []), z = re.map(() => []);
|
|
2217
|
+
for (let T = 0; T < e.length; T++) {
|
|
2218
|
+
let _ = 0;
|
|
2219
|
+
if (G) {
|
|
2220
|
+
for (const L of re) {
|
|
2221
|
+
const A = e[T][L];
|
|
2222
|
+
typeof A == "number" && A > 0 && (_ += A);
|
|
2165
2223
|
}
|
|
2166
|
-
|
|
2224
|
+
_ === 0 && (_ = 1);
|
|
2167
2225
|
}
|
|
2168
|
-
let
|
|
2169
|
-
for (let
|
|
2170
|
-
const
|
|
2171
|
-
if (
|
|
2172
|
-
const ue =
|
|
2173
|
-
z[
|
|
2226
|
+
let y = 0;
|
|
2227
|
+
for (let L = 0; L < re.length; L++) {
|
|
2228
|
+
const A = re[L], H = e[T][A], Z = typeof H == "number" ? H : 0;
|
|
2229
|
+
if (M) {
|
|
2230
|
+
const ue = G ? Z / _ : Z;
|
|
2231
|
+
z[L][T] = y, y += ue, N[L][T] = y;
|
|
2174
2232
|
} else
|
|
2175
|
-
z[
|
|
2233
|
+
z[L][T] = 0, N[L][T] = Z;
|
|
2176
2234
|
}
|
|
2177
2235
|
}
|
|
2178
2236
|
return { tops: N, bottoms: z };
|
|
2179
|
-
}, [e,
|
|
2180
|
-
if (
|
|
2237
|
+
}, [e, re, M, G]), { tops: oe, bottoms: he } = J, [w, B] = ke(() => {
|
|
2238
|
+
if (G) return [0, 1];
|
|
2181
2239
|
let N = 0, z = 0;
|
|
2182
|
-
for (const
|
|
2183
|
-
for (const
|
|
2184
|
-
|
|
2185
|
-
for (const
|
|
2186
|
-
for (const
|
|
2187
|
-
|
|
2240
|
+
for (const T of oe)
|
|
2241
|
+
for (const _ of T)
|
|
2242
|
+
_ < N && (N = _), _ > z && (z = _);
|
|
2243
|
+
for (const T of he)
|
|
2244
|
+
for (const _ of T)
|
|
2245
|
+
_ < N && (N = _);
|
|
2188
2246
|
return [Math.min(0, N), z];
|
|
2189
|
-
}, [
|
|
2247
|
+
}, [oe, he, G]);
|
|
2190
2248
|
return /* @__PURE__ */ s(
|
|
2191
2249
|
Ve,
|
|
2192
2250
|
{
|
|
2193
|
-
ref:
|
|
2251
|
+
ref: j,
|
|
2194
2252
|
aspectRatio: r,
|
|
2195
2253
|
height: o,
|
|
2196
|
-
className:
|
|
2197
|
-
style:
|
|
2198
|
-
classes:
|
|
2199
|
-
legend: m ? /* @__PURE__ */ s(vt, { config: n, classes:
|
|
2200
|
-
overlay: p &&
|
|
2254
|
+
className: Q,
|
|
2255
|
+
style: D,
|
|
2256
|
+
classes: S,
|
|
2257
|
+
legend: m ? /* @__PURE__ */ s(vt, { config: n, classes: S }) : void 0,
|
|
2258
|
+
overlay: p && O !== null ? /* @__PURE__ */ s(
|
|
2201
2259
|
et,
|
|
2202
2260
|
{
|
|
2203
|
-
row: e[
|
|
2204
|
-
x:
|
|
2261
|
+
row: e[O],
|
|
2262
|
+
x: Fi(e, t, ee, O, j),
|
|
2205
2263
|
y: 16,
|
|
2206
|
-
containerWidth:
|
|
2264
|
+
containerWidth: j.current?.getBoundingClientRect().width ?? 0,
|
|
2207
2265
|
config: n,
|
|
2208
|
-
render:
|
|
2209
|
-
valueFormat:
|
|
2266
|
+
render: W ? () => W(e[O]) : void 0,
|
|
2267
|
+
valueFormat: G ? (N) => `${Math.round(N * 100)}%` : b,
|
|
2210
2268
|
titleKey: t,
|
|
2211
|
-
classes:
|
|
2269
|
+
classes: S
|
|
2212
2270
|
}
|
|
2213
2271
|
) : null,
|
|
2214
2272
|
children: ({ width: N, height: z }) => {
|
|
2215
|
-
const
|
|
2216
|
-
return /* @__PURE__ */
|
|
2217
|
-
a && /* @__PURE__ */ s("defs", { children:
|
|
2273
|
+
const T = ee.left, _ = N - ee.right, y = ee.top, L = z - ee.bottom, A = Math.max(0, _ - T), H = Math.max(0, L - y), Z = e.map((g) => String(g[t])), ue = _e(Z, [T, _], 0), be = G ? [0, 0.25, 0.5, 0.75, 1] : qe(w, B, x), pe = Je([be[0], be[be.length - 1]], [L, y]), fe = pe(0), ge = be.map((g) => ({ value: g, y: pe(g) })), Re = Oi(Z).map((g) => ({ label: g, x: ue(g) })), Ne = G ? (g) => `${Math.round(g * 100)}%` : C;
|
|
2274
|
+
return /* @__PURE__ */ F(Xe, { children: [
|
|
2275
|
+
a && /* @__PURE__ */ s("defs", { children: re.map((g) => /* @__PURE__ */ F(
|
|
2218
2276
|
"linearGradient",
|
|
2219
2277
|
{
|
|
2220
|
-
id: `${
|
|
2278
|
+
id: `${U}-${g}`,
|
|
2221
2279
|
x1: "0",
|
|
2222
2280
|
y1: "0",
|
|
2223
2281
|
x2: "0",
|
|
@@ -2230,79 +2288,79 @@ function Pl({
|
|
|
2230
2288
|
g
|
|
2231
2289
|
)) }),
|
|
2232
2290
|
d ? /* @__PURE__ */ s(
|
|
2233
|
-
|
|
2291
|
+
en,
|
|
2234
2292
|
{
|
|
2235
2293
|
ticks: ge,
|
|
2236
|
-
x:
|
|
2237
|
-
plotWidth:
|
|
2294
|
+
x: T,
|
|
2295
|
+
plotWidth: A,
|
|
2238
2296
|
format: Ne,
|
|
2239
2297
|
showGrid: h,
|
|
2240
|
-
classes:
|
|
2298
|
+
classes: S
|
|
2241
2299
|
}
|
|
2242
|
-
) : h && /* @__PURE__ */ s("g", { className: f(
|
|
2300
|
+
) : h && /* @__PURE__ */ s("g", { className: f(k.axis, S?.axis), children: ge.map(({ value: g, y: v }) => /* @__PURE__ */ s(
|
|
2243
2301
|
"line",
|
|
2244
2302
|
{
|
|
2245
|
-
className: f(
|
|
2246
|
-
x1:
|
|
2247
|
-
x2:
|
|
2248
|
-
y1:
|
|
2249
|
-
y2:
|
|
2303
|
+
className: f(k.gridLine, S?.grid),
|
|
2304
|
+
x1: T,
|
|
2305
|
+
x2: _,
|
|
2306
|
+
y1: v,
|
|
2307
|
+
y2: v
|
|
2250
2308
|
},
|
|
2251
2309
|
`grid-${g}`
|
|
2252
2310
|
)) }),
|
|
2253
|
-
u && /* @__PURE__ */ s(
|
|
2254
|
-
|
|
2255
|
-
const K = n[g],
|
|
2256
|
-
x: ue(
|
|
2257
|
-
y: pe(
|
|
2258
|
-
})),
|
|
2259
|
-
return /* @__PURE__ */
|
|
2311
|
+
u && /* @__PURE__ */ s(tn, { ticks: Re, y: L, format: $, classes: S }),
|
|
2312
|
+
re.map((g, v) => {
|
|
2313
|
+
const K = n[g], E = e.map((q, R) => ({
|
|
2314
|
+
x: ue(Z[R]),
|
|
2315
|
+
y: pe(oe[v][R])
|
|
2316
|
+
})), V = a ? `url(#${U}-${g})` : K.color, I = a ? 1 : 0.18, ae = M ? Dt(E, he[v].map((q) => pe(q)), i) : Dt(E, fe, i);
|
|
2317
|
+
return /* @__PURE__ */ F("g", { className: f(k.series, S?.series), children: [
|
|
2260
2318
|
/* @__PURE__ */ s(
|
|
2261
2319
|
"path",
|
|
2262
2320
|
{
|
|
2263
|
-
className:
|
|
2264
|
-
d:
|
|
2265
|
-
fill:
|
|
2266
|
-
fillOpacity:
|
|
2321
|
+
className: k.areaPath,
|
|
2322
|
+
d: ae,
|
|
2323
|
+
fill: V,
|
|
2324
|
+
fillOpacity: I
|
|
2267
2325
|
}
|
|
2268
2326
|
),
|
|
2269
|
-
/* @__PURE__ */ s("path", { className:
|
|
2270
|
-
!
|
|
2327
|
+
/* @__PURE__ */ s("path", { className: k.linePath, d: St(E, i), stroke: K.color }),
|
|
2328
|
+
!M && E.map((q, R) => /* @__PURE__ */ s(
|
|
2271
2329
|
"circle",
|
|
2272
2330
|
{
|
|
2273
|
-
className: f(
|
|
2274
|
-
cx:
|
|
2275
|
-
cy:
|
|
2276
|
-
r:
|
|
2331
|
+
className: f(k.point, S?.point),
|
|
2332
|
+
cx: q.x,
|
|
2333
|
+
cy: q.y,
|
|
2334
|
+
r: O === R ? 5 : 3,
|
|
2277
2335
|
fill: K.color
|
|
2278
2336
|
},
|
|
2279
|
-
`${g}-${
|
|
2337
|
+
`${g}-${R}`
|
|
2280
2338
|
))
|
|
2281
2339
|
] }, g);
|
|
2282
2340
|
}),
|
|
2283
|
-
|
|
2341
|
+
O !== null && /* @__PURE__ */ s(
|
|
2284
2342
|
"line",
|
|
2285
2343
|
{
|
|
2286
|
-
className:
|
|
2287
|
-
x1: ue(
|
|
2288
|
-
x2: ue(
|
|
2289
|
-
y1:
|
|
2290
|
-
y2:
|
|
2344
|
+
className: k.cursorLine,
|
|
2345
|
+
x1: ue(Z[O]),
|
|
2346
|
+
x2: ue(Z[O]),
|
|
2347
|
+
y1: y,
|
|
2348
|
+
y2: L
|
|
2291
2349
|
}
|
|
2292
2350
|
),
|
|
2293
2351
|
/* @__PURE__ */ s(
|
|
2294
2352
|
"rect",
|
|
2295
2353
|
{
|
|
2296
|
-
className:
|
|
2297
|
-
x:
|
|
2298
|
-
y
|
|
2299
|
-
width:
|
|
2300
|
-
height:
|
|
2354
|
+
className: k.interactionLayer,
|
|
2355
|
+
x: T,
|
|
2356
|
+
y,
|
|
2357
|
+
width: A,
|
|
2358
|
+
height: H,
|
|
2301
2359
|
onMouseMove: (g) => {
|
|
2302
|
-
const
|
|
2303
|
-
|
|
2360
|
+
const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + T, E = ue.step(), V = Math.max(0, Math.min(e.length - 1, Math.round((K - T - E / 2) / E)));
|
|
2361
|
+
te(V);
|
|
2304
2362
|
},
|
|
2305
|
-
onMouseLeave: () =>
|
|
2363
|
+
onMouseLeave: () => te(null)
|
|
2306
2364
|
}
|
|
2307
2365
|
)
|
|
2308
2366
|
] });
|
|
@@ -2310,25 +2368,25 @@ function Pl({
|
|
|
2310
2368
|
}
|
|
2311
2369
|
);
|
|
2312
2370
|
}
|
|
2313
|
-
function
|
|
2371
|
+
function Fi(e, t, n, r, o) {
|
|
2314
2372
|
const i = o.current;
|
|
2315
2373
|
if (!i) return 0;
|
|
2316
2374
|
const c = i.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
|
|
2317
|
-
return
|
|
2375
|
+
return _e(l, [n.left, c - n.right], 0)(l[r]);
|
|
2318
2376
|
}
|
|
2319
|
-
const
|
|
2377
|
+
const ji = [
|
|
2320
2378
|
"var(--crk-chart-1)",
|
|
2321
2379
|
"var(--crk-chart-2)",
|
|
2322
2380
|
"var(--crk-chart-3)",
|
|
2323
2381
|
"var(--crk-chart-4)",
|
|
2324
2382
|
"var(--crk-chart-5)"
|
|
2325
|
-
],
|
|
2326
|
-
function
|
|
2383
|
+
], Xi = { top: 12, right: 16, bottom: 28, left: 48 }, _i = { top: 12, right: 16, bottom: 28, left: 72 };
|
|
2384
|
+
function Ui(e, t = 8) {
|
|
2327
2385
|
if (e.length <= t) return e;
|
|
2328
2386
|
const n = Math.ceil(e.length / t);
|
|
2329
2387
|
return e.filter((r, o) => o % n === 0);
|
|
2330
2388
|
}
|
|
2331
|
-
function
|
|
2389
|
+
function Fl({
|
|
2332
2390
|
data: e,
|
|
2333
2391
|
xKey: t,
|
|
2334
2392
|
config: n,
|
|
@@ -2343,35 +2401,35 @@ function Wl({
|
|
|
2343
2401
|
showLegend: d = !0,
|
|
2344
2402
|
showTooltip: m = !0,
|
|
2345
2403
|
showValues: p = !1,
|
|
2346
|
-
valuePosition:
|
|
2347
|
-
renderLabel:
|
|
2348
|
-
colorBy:
|
|
2349
|
-
colors:
|
|
2350
|
-
negativeColor:
|
|
2351
|
-
activeIndex:
|
|
2352
|
-
onBarClick:
|
|
2353
|
-
yTickCount:
|
|
2354
|
-
yFormat:
|
|
2355
|
-
xFormat:
|
|
2356
|
-
valueFormat:
|
|
2357
|
-
renderTooltip:
|
|
2358
|
-
margin:
|
|
2359
|
-
emptyMessage:
|
|
2360
|
-
className:
|
|
2361
|
-
style:
|
|
2362
|
-
classes:
|
|
2404
|
+
valuePosition: x = "outside",
|
|
2405
|
+
renderLabel: C,
|
|
2406
|
+
colorBy: $ = "series",
|
|
2407
|
+
colors: b = ji,
|
|
2408
|
+
negativeColor: W,
|
|
2409
|
+
activeIndex: X,
|
|
2410
|
+
onBarClick: Y,
|
|
2411
|
+
yTickCount: Q = 5,
|
|
2412
|
+
yFormat: D,
|
|
2413
|
+
xFormat: S,
|
|
2414
|
+
valueFormat: ee,
|
|
2415
|
+
renderTooltip: re,
|
|
2416
|
+
margin: M,
|
|
2417
|
+
emptyMessage: G = "No data",
|
|
2418
|
+
className: O,
|
|
2419
|
+
style: te,
|
|
2420
|
+
classes: j
|
|
2363
2421
|
}) {
|
|
2364
|
-
const
|
|
2422
|
+
const U = r === "horizontal", J = { ...U ? _i : Xi, ...M }, oe = ke(() => Object.keys(n), [n]), he = o && oe.length > 1, [w, B] = Se(null), N = ne(null);
|
|
2365
2423
|
if (e.length === 0)
|
|
2366
|
-
return /* @__PURE__ */ s("div", { ref: N, className: f(
|
|
2367
|
-
const z = e.map((ue) => String(ue[t])),
|
|
2368
|
-
if (
|
|
2424
|
+
return /* @__PURE__ */ s("div", { ref: N, className: f(k.root, j?.root, O), style: te, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: G }) }) });
|
|
2425
|
+
const z = e.map((ue) => String(ue[t])), T = X ?? w, _ = ke(() => {
|
|
2426
|
+
if (he) {
|
|
2369
2427
|
let fe = 0, ge = 0;
|
|
2370
2428
|
for (const ve of e) {
|
|
2371
2429
|
let Re = 0, Ne = 0;
|
|
2372
|
-
for (const g of
|
|
2373
|
-
const
|
|
2374
|
-
typeof
|
|
2430
|
+
for (const g of oe) {
|
|
2431
|
+
const v = ve[g];
|
|
2432
|
+
typeof v == "number" && (v >= 0 ? Re += v : Ne += v);
|
|
2375
2433
|
}
|
|
2376
2434
|
Re > fe && (fe = Re), Ne < ge && (ge = Ne);
|
|
2377
2435
|
}
|
|
@@ -2379,28 +2437,28 @@ function Wl({
|
|
|
2379
2437
|
}
|
|
2380
2438
|
const ue = [];
|
|
2381
2439
|
for (const fe of e)
|
|
2382
|
-
for (const ge of
|
|
2440
|
+
for (const ge of oe) {
|
|
2383
2441
|
const ve = fe[ge];
|
|
2384
2442
|
typeof ve == "number" && ue.push(ve);
|
|
2385
2443
|
}
|
|
2386
2444
|
const [be, pe] = bt(ue);
|
|
2387
2445
|
return [Math.min(0, be), Math.max(0, pe)];
|
|
2388
|
-
}, [e,
|
|
2446
|
+
}, [e, oe, he]), y = qe(_[0], _[1], Q), L = y[0], A = y[y.length - 1], H = (ue, be) => $ === "index" ? b[be % b.length] : n[ue]?.color ?? b[0], Z = m && T !== null && e[T] ? /* @__PURE__ */ s(
|
|
2389
2447
|
et,
|
|
2390
2448
|
{
|
|
2391
|
-
row: e[
|
|
2392
|
-
x:
|
|
2393
|
-
y:
|
|
2449
|
+
row: e[T],
|
|
2450
|
+
x: Yi(e, t, J, T, N, U, l),
|
|
2451
|
+
y: U ? Vi(e, t, J, T, N, l) : 16,
|
|
2394
2452
|
containerWidth: N.current?.getBoundingClientRect().width ?? 0,
|
|
2395
2453
|
config: n,
|
|
2396
|
-
render:
|
|
2397
|
-
valueFormat:
|
|
2454
|
+
render: re ? () => re(e[T]) : void 0,
|
|
2455
|
+
valueFormat: ee,
|
|
2398
2456
|
titleKey: t,
|
|
2399
2457
|
resolveColor: (ue) => {
|
|
2400
|
-
const be = e[
|
|
2401
|
-
return typeof be != "number" ? pe :
|
|
2458
|
+
const be = e[T][ue], pe = H(ue, T);
|
|
2459
|
+
return typeof be != "number" ? pe : W !== void 0 && be < 0 ? W : pe;
|
|
2402
2460
|
},
|
|
2403
|
-
classes:
|
|
2461
|
+
classes: j
|
|
2404
2462
|
}
|
|
2405
2463
|
) : null;
|
|
2406
2464
|
return /* @__PURE__ */ s(
|
|
@@ -2409,125 +2467,125 @@ function Wl({
|
|
|
2409
2467
|
ref: N,
|
|
2410
2468
|
aspectRatio: i,
|
|
2411
2469
|
height: c,
|
|
2412
|
-
className:
|
|
2413
|
-
style:
|
|
2414
|
-
classes:
|
|
2415
|
-
legend: d ? /* @__PURE__ */ s(vt, { config: n, classes:
|
|
2416
|
-
overlay:
|
|
2470
|
+
className: O,
|
|
2471
|
+
style: te,
|
|
2472
|
+
classes: j,
|
|
2473
|
+
legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: j }) : void 0,
|
|
2474
|
+
overlay: Z,
|
|
2417
2475
|
children: ({ width: ue, height: be }) => {
|
|
2418
|
-
const pe =
|
|
2419
|
-
value:
|
|
2420
|
-
pos:
|
|
2421
|
-
})), me =
|
|
2422
|
-
return /* @__PURE__ */
|
|
2423
|
-
u && /* @__PURE__ */ s("g", { className: f(
|
|
2424
|
-
({ value:
|
|
2476
|
+
const pe = J.left, fe = ue - J.right, ge = J.top, ve = be - J.bottom, Re = Math.max(0, fe - pe), Ne = Math.max(0, ve - ge), v = _e(z, U ? [ge, ve] : [pe, fe], l), K = v.bandWidth(), V = Je([L, A], U ? [pe, fe] : [ve, ge]), I = V(0), ae = he ? 1 : Math.max(1, oe.length), q = K / ae, R = q * (1 - a), ie = y.map((ce) => ({
|
|
2477
|
+
value: ce,
|
|
2478
|
+
pos: V(ce)
|
|
2479
|
+
})), me = Ui(z);
|
|
2480
|
+
return /* @__PURE__ */ F(Xe, { children: [
|
|
2481
|
+
u && /* @__PURE__ */ s("g", { className: f(k.axis, j?.axis), children: ie.map(
|
|
2482
|
+
({ value: ce, pos: se }) => U ? /* @__PURE__ */ s(
|
|
2425
2483
|
"line",
|
|
2426
2484
|
{
|
|
2427
|
-
className: f(
|
|
2485
|
+
className: f(k.gridLine, j?.grid),
|
|
2428
2486
|
x1: se,
|
|
2429
2487
|
x2: se,
|
|
2430
2488
|
y1: ge,
|
|
2431
2489
|
y2: ve
|
|
2432
2490
|
},
|
|
2433
|
-
`g-${
|
|
2491
|
+
`g-${ce}`
|
|
2434
2492
|
) : /* @__PURE__ */ s(
|
|
2435
2493
|
"line",
|
|
2436
2494
|
{
|
|
2437
|
-
className: f(
|
|
2495
|
+
className: f(k.gridLine, j?.grid),
|
|
2438
2496
|
x1: pe,
|
|
2439
2497
|
x2: fe,
|
|
2440
2498
|
y1: se,
|
|
2441
2499
|
y2: se
|
|
2442
2500
|
},
|
|
2443
|
-
`g-${
|
|
2501
|
+
`g-${ce}`
|
|
2444
2502
|
)
|
|
2445
2503
|
) }),
|
|
2446
|
-
/* @__PURE__ */ s("g", { className: f(
|
|
2447
|
-
const Ce =
|
|
2448
|
-
return
|
|
2504
|
+
/* @__PURE__ */ s("g", { className: f(k.axis, j?.axis), children: ie.map(({ value: ce, pos: se }) => {
|
|
2505
|
+
const Ce = D ? D(ce) : String(ce);
|
|
2506
|
+
return U ? /* @__PURE__ */ s(
|
|
2449
2507
|
"text",
|
|
2450
2508
|
{
|
|
2451
|
-
className: f(
|
|
2509
|
+
className: f(k.axisLabel, j?.axisLabel),
|
|
2452
2510
|
x: se,
|
|
2453
2511
|
y: ve + 16,
|
|
2454
2512
|
textAnchor: "middle",
|
|
2455
2513
|
children: Ce
|
|
2456
2514
|
},
|
|
2457
|
-
`vt-${
|
|
2515
|
+
`vt-${ce}`
|
|
2458
2516
|
) : /* @__PURE__ */ s(
|
|
2459
2517
|
"text",
|
|
2460
2518
|
{
|
|
2461
|
-
className: f(
|
|
2519
|
+
className: f(k.axisLabel, j?.axisLabel),
|
|
2462
2520
|
x: pe - 8,
|
|
2463
2521
|
y: se,
|
|
2464
2522
|
textAnchor: "end",
|
|
2465
2523
|
dominantBaseline: "middle",
|
|
2466
2524
|
children: Ce
|
|
2467
2525
|
},
|
|
2468
|
-
`vt-${
|
|
2526
|
+
`vt-${ce}`
|
|
2469
2527
|
);
|
|
2470
2528
|
}) }),
|
|
2471
|
-
/* @__PURE__ */ s("g", { className: f(
|
|
2472
|
-
const se =
|
|
2473
|
-
return
|
|
2529
|
+
/* @__PURE__ */ s("g", { className: f(k.axis, j?.axis), children: me.map((ce) => {
|
|
2530
|
+
const se = v(ce), Ce = S ? S(ce) : ce;
|
|
2531
|
+
return U ? /* @__PURE__ */ s(
|
|
2474
2532
|
"text",
|
|
2475
2533
|
{
|
|
2476
|
-
className: f(
|
|
2534
|
+
className: f(k.axisLabel, j?.axisLabel),
|
|
2477
2535
|
x: pe - 8,
|
|
2478
2536
|
y: se,
|
|
2479
2537
|
textAnchor: "end",
|
|
2480
2538
|
dominantBaseline: "middle",
|
|
2481
2539
|
children: Ce
|
|
2482
2540
|
},
|
|
2483
|
-
`c-${
|
|
2541
|
+
`c-${ce}`
|
|
2484
2542
|
) : /* @__PURE__ */ s(
|
|
2485
2543
|
"text",
|
|
2486
2544
|
{
|
|
2487
|
-
className: f(
|
|
2545
|
+
className: f(k.axisLabel, j?.axisLabel),
|
|
2488
2546
|
x: se,
|
|
2489
2547
|
y: ve + 16,
|
|
2490
2548
|
textAnchor: "middle",
|
|
2491
2549
|
children: Ce
|
|
2492
2550
|
},
|
|
2493
|
-
`c-${
|
|
2551
|
+
`c-${ce}`
|
|
2494
2552
|
);
|
|
2495
2553
|
}) }),
|
|
2496
|
-
e.map((
|
|
2497
|
-
const Ie =
|
|
2498
|
-
let xe = 0,
|
|
2499
|
-
return /* @__PURE__ */ s("g", { className: f(
|
|
2500
|
-
const Ge =
|
|
2554
|
+
e.map((ce, se) => {
|
|
2555
|
+
const Ie = v(z[se]) - K / 2;
|
|
2556
|
+
let xe = 0, le = 0;
|
|
2557
|
+
return /* @__PURE__ */ s("g", { className: f(k.series, j?.series), children: oe.map((De, He) => {
|
|
2558
|
+
const Ge = ce[De];
|
|
2501
2559
|
if (typeof Ge != "number") return null;
|
|
2502
|
-
const Ee = Ge, xt =
|
|
2560
|
+
const Ee = Ge, xt = H(De, se), kt = W !== void 0 && Ee < 0 ? W : xt, Oe = X !== void 0 ? X === se : w === se, tt = X !== void 0 && !Oe;
|
|
2503
2561
|
let nt, Ue;
|
|
2504
|
-
|
|
2505
|
-
const rt =
|
|
2562
|
+
he ? Ee >= 0 ? (nt = xe, Ue = xe + Ee, xe = Ue) : (nt = le, Ue = le + Ee, le = Ue) : (nt = 0, Ue = Ee);
|
|
2563
|
+
const rt = V(nt), ot = V(Ue), At = he ? (K - R) / 2 : He * q + (q - R) / 2;
|
|
2506
2564
|
let ct = 0, it = 0, lt = 0, st = 0;
|
|
2507
|
-
if (
|
|
2565
|
+
if (U) {
|
|
2508
2566
|
const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
|
|
2509
|
-
ct = Ze, lt = wt - Ze, it = Ie + At, st =
|
|
2567
|
+
ct = Ze, lt = wt - Ze, it = Ie + At, st = R;
|
|
2510
2568
|
} else {
|
|
2511
2569
|
const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
|
|
2512
|
-
ct = Ie + At, lt =
|
|
2570
|
+
ct = Ie + At, lt = R, it = Ze, st = wt - Ze;
|
|
2513
2571
|
}
|
|
2514
|
-
const Mt =
|
|
2515
|
-
isHorizontal:
|
|
2516
|
-
valuePosition:
|
|
2572
|
+
const Mt = C ? C({ row: ce, value: Ee, seriesKey: De, index: se }) : p ? ee ? ee(Ee) : String(Ee) : null, Fe = zi({
|
|
2573
|
+
isHorizontal: U,
|
|
2574
|
+
valuePosition: x,
|
|
2517
2575
|
x: ct,
|
|
2518
2576
|
y: it,
|
|
2519
2577
|
rectW: lt,
|
|
2520
2578
|
rectH: st,
|
|
2521
2579
|
value: Ee
|
|
2522
2580
|
});
|
|
2523
|
-
return /* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ F("g", { children: [
|
|
2524
2582
|
/* @__PURE__ */ s(
|
|
2525
2583
|
"rect",
|
|
2526
2584
|
{
|
|
2527
2585
|
className: f(
|
|
2528
|
-
|
|
2529
|
-
Oe &&
|
|
2530
|
-
|
|
2586
|
+
k.bar,
|
|
2587
|
+
Oe && k.activeBar,
|
|
2588
|
+
j?.point
|
|
2531
2589
|
),
|
|
2532
2590
|
x: ct,
|
|
2533
2591
|
y: it,
|
|
@@ -2537,16 +2595,16 @@ function Wl({
|
|
|
2537
2595
|
ry: h,
|
|
2538
2596
|
fill: kt,
|
|
2539
2597
|
opacity: tt ? 0.35 : 1,
|
|
2540
|
-
onClick:
|
|
2541
|
-
style:
|
|
2598
|
+
onClick: Y ? () => Y({ row: ce, value: Ee, seriesKey: De, index: se }) : void 0,
|
|
2599
|
+
style: Y ? { cursor: "pointer" } : void 0
|
|
2542
2600
|
}
|
|
2543
2601
|
),
|
|
2544
2602
|
Mt != null && /* @__PURE__ */ s(
|
|
2545
2603
|
"text",
|
|
2546
2604
|
{
|
|
2547
2605
|
className: f(
|
|
2548
|
-
|
|
2549
|
-
(
|
|
2606
|
+
k.axisLabel,
|
|
2607
|
+
(x === "inside" || x === "inside-start") && k.barLabelInside
|
|
2550
2608
|
),
|
|
2551
2609
|
x: Fe.x,
|
|
2552
2610
|
y: Fe.y,
|
|
@@ -2560,33 +2618,33 @@ function Wl({
|
|
|
2560
2618
|
] }, De);
|
|
2561
2619
|
}) }, `group-${se}`);
|
|
2562
2620
|
}),
|
|
2563
|
-
|
|
2621
|
+
L < 0 && A > 0 && /* @__PURE__ */ s(
|
|
2564
2622
|
"line",
|
|
2565
2623
|
{
|
|
2566
|
-
className: f(
|
|
2567
|
-
x1:
|
|
2568
|
-
x2:
|
|
2569
|
-
y1:
|
|
2570
|
-
y2:
|
|
2624
|
+
className: f(k.gridLine),
|
|
2625
|
+
x1: U ? I : pe,
|
|
2626
|
+
x2: U ? I : fe,
|
|
2627
|
+
y1: U ? ge : I,
|
|
2628
|
+
y2: U ? ve : I,
|
|
2571
2629
|
opacity: 0.9
|
|
2572
2630
|
}
|
|
2573
2631
|
),
|
|
2574
2632
|
/* @__PURE__ */ s(
|
|
2575
2633
|
"rect",
|
|
2576
2634
|
{
|
|
2577
|
-
className:
|
|
2635
|
+
className: k.interactionLayer,
|
|
2578
2636
|
x: pe,
|
|
2579
2637
|
y: ge,
|
|
2580
2638
|
width: Re,
|
|
2581
2639
|
height: Ne,
|
|
2582
|
-
onMouseMove: (
|
|
2583
|
-
const se =
|
|
2640
|
+
onMouseMove: (ce) => {
|
|
2641
|
+
const se = ce.currentTarget.getBoundingClientRect(), Ce = ce.clientX - se.left + pe, Ie = ce.clientY - se.top + ge, xe = v.step(), le = U ? Ie - ge : Ce - pe, De = Math.max(
|
|
2584
2642
|
0,
|
|
2585
|
-
Math.min(e.length - 1, Math.round((
|
|
2643
|
+
Math.min(e.length - 1, Math.round((le - xe / 2) / xe))
|
|
2586
2644
|
);
|
|
2587
|
-
|
|
2645
|
+
B(De);
|
|
2588
2646
|
},
|
|
2589
|
-
onMouseLeave: () =>
|
|
2647
|
+
onMouseLeave: () => B(null)
|
|
2590
2648
|
}
|
|
2591
2649
|
)
|
|
2592
2650
|
] });
|
|
@@ -2594,7 +2652,7 @@ function Wl({
|
|
|
2594
2652
|
}
|
|
2595
2653
|
);
|
|
2596
2654
|
}
|
|
2597
|
-
function
|
|
2655
|
+
function zi({
|
|
2598
2656
|
isHorizontal: e,
|
|
2599
2657
|
valuePosition: t,
|
|
2600
2658
|
x: n,
|
|
@@ -2646,19 +2704,19 @@ function Ui({
|
|
|
2646
2704
|
dominantBaseline: a ? "auto" : "middle"
|
|
2647
2705
|
};
|
|
2648
2706
|
}
|
|
2649
|
-
function
|
|
2707
|
+
function Yi(e, t, n, r, o, i, c) {
|
|
2650
2708
|
const l = o.current;
|
|
2651
2709
|
if (!l) return 0;
|
|
2652
2710
|
const a = l.getBoundingClientRect(), h = e.map((d) => String(d[t]));
|
|
2653
|
-
return i ? a.width / 2 :
|
|
2711
|
+
return i ? a.width / 2 : _e(h, [n.left, a.width - n.right], c)(h[r]);
|
|
2654
2712
|
}
|
|
2655
|
-
function
|
|
2713
|
+
function Vi(e, t, n, r, o, i) {
|
|
2656
2714
|
const c = o.current;
|
|
2657
2715
|
if (!c) return 16;
|
|
2658
2716
|
const l = c.getBoundingClientRect(), a = e.map((u) => String(u[t]));
|
|
2659
|
-
return
|
|
2717
|
+
return _e(a, [n.top, l.height - n.bottom], i)(a[r]);
|
|
2660
2718
|
}
|
|
2661
|
-
const
|
|
2719
|
+
const qi = [
|
|
2662
2720
|
"var(--crk-chart-1)",
|
|
2663
2721
|
"var(--crk-chart-2)",
|
|
2664
2722
|
"var(--crk-chart-3)",
|
|
@@ -2670,7 +2728,7 @@ function It(e, t) {
|
|
|
2670
2728
|
const n = /^([\d.]+)%$/.exec(e);
|
|
2671
2729
|
return n ? parseFloat(n[1]) / 100 * t : parseFloat(e) || 0;
|
|
2672
2730
|
}
|
|
2673
|
-
function
|
|
2731
|
+
function Gi(e, t, n, r, o, i) {
|
|
2674
2732
|
if (Math.abs(i - o) >= 360 - 1e-6)
|
|
2675
2733
|
return r > 0 ? [
|
|
2676
2734
|
`M ${e + n} ${t}`,
|
|
@@ -2688,12 +2746,12 @@ function Vi(e, t, n, r, o, i) {
|
|
|
2688
2746
|
].join(" ");
|
|
2689
2747
|
const c = (o - 90) * Math.PI / 180, l = (i - 90) * Math.PI / 180, a = i - o > 180 ? 1 : 0, h = e + n * Math.cos(c), u = t + n * Math.sin(c), d = e + n * Math.cos(l), m = t + n * Math.sin(l);
|
|
2690
2748
|
if (r > 0) {
|
|
2691
|
-
const p = e + r * Math.cos(l),
|
|
2749
|
+
const p = e + r * Math.cos(l), x = t + r * Math.sin(l), C = e + r * Math.cos(c), $ = t + r * Math.sin(c);
|
|
2692
2750
|
return [
|
|
2693
2751
|
`M ${h} ${u}`,
|
|
2694
2752
|
`A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
|
|
2695
|
-
`L ${p} ${
|
|
2696
|
-
`A ${r} ${r} 0 ${a} 0 ${
|
|
2753
|
+
`L ${p} ${x}`,
|
|
2754
|
+
`A ${r} ${r} 0 ${a} 0 ${C} ${$}`,
|
|
2697
2755
|
"Z"
|
|
2698
2756
|
].join(" ");
|
|
2699
2757
|
}
|
|
@@ -2708,12 +2766,12 @@ function Et(e, t, n, r, o) {
|
|
|
2708
2766
|
const c = ((r + o) / 2 - 90) * Math.PI / 180;
|
|
2709
2767
|
return { x: e + n * Math.cos(c), y: t + n * Math.sin(c) };
|
|
2710
2768
|
}
|
|
2711
|
-
function
|
|
2769
|
+
function jl({
|
|
2712
2770
|
data: e,
|
|
2713
2771
|
valueKey: t,
|
|
2714
2772
|
nameKey: n,
|
|
2715
2773
|
colorKey: r,
|
|
2716
|
-
colors: o =
|
|
2774
|
+
colors: o = qi,
|
|
2717
2775
|
aspectRatio: i = 1,
|
|
2718
2776
|
height: c,
|
|
2719
2777
|
innerRadius: l = 0,
|
|
@@ -2723,94 +2781,94 @@ function Hl({
|
|
|
2723
2781
|
padAngle: d = 0,
|
|
2724
2782
|
showLabels: m = !1,
|
|
2725
2783
|
valuePosition: p = "outside",
|
|
2726
|
-
showLabelLines:
|
|
2727
|
-
renderLabel:
|
|
2728
|
-
centerLabel:
|
|
2729
|
-
activeIndex:
|
|
2730
|
-
onSliceClick:
|
|
2731
|
-
showLegend:
|
|
2732
|
-
showTooltip:
|
|
2733
|
-
valueFormat:
|
|
2734
|
-
renderTooltip:
|
|
2735
|
-
emptyMessage:
|
|
2736
|
-
className:
|
|
2737
|
-
style:
|
|
2738
|
-
classes:
|
|
2784
|
+
showLabelLines: x = !0,
|
|
2785
|
+
renderLabel: C,
|
|
2786
|
+
centerLabel: $,
|
|
2787
|
+
activeIndex: b,
|
|
2788
|
+
onSliceClick: W,
|
|
2789
|
+
showLegend: X = !0,
|
|
2790
|
+
showTooltip: Y = !0,
|
|
2791
|
+
valueFormat: Q,
|
|
2792
|
+
renderTooltip: D,
|
|
2793
|
+
emptyMessage: S = "No data",
|
|
2794
|
+
className: ee,
|
|
2795
|
+
style: re,
|
|
2796
|
+
classes: M
|
|
2739
2797
|
}) {
|
|
2740
|
-
const [
|
|
2798
|
+
const [G, O] = Se(null), te = ne(null), j = b ?? G, U = (B) => {
|
|
2741
2799
|
if (r) {
|
|
2742
|
-
const N = e[
|
|
2800
|
+
const N = e[B]?.[r];
|
|
2743
2801
|
if (typeof N == "string") return N;
|
|
2744
2802
|
}
|
|
2745
|
-
return o[
|
|
2746
|
-
},
|
|
2747
|
-
let
|
|
2803
|
+
return o[B % o.length];
|
|
2804
|
+
}, J = ke(() => {
|
|
2805
|
+
let B = 0;
|
|
2748
2806
|
for (const N of e) {
|
|
2749
2807
|
const z = N[t];
|
|
2750
|
-
typeof z == "number" && z > 0 && (
|
|
2808
|
+
typeof z == "number" && z > 0 && (B += z);
|
|
2751
2809
|
}
|
|
2752
|
-
return
|
|
2810
|
+
return B;
|
|
2753
2811
|
}, [e, t]);
|
|
2754
|
-
if (e.length === 0 ||
|
|
2755
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
2756
|
-
const
|
|
2757
|
-
const
|
|
2812
|
+
if (e.length === 0 || J === 0)
|
|
2813
|
+
return /* @__PURE__ */ s("div", { ref: te, className: f(k.root, M?.root, ee), style: re, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: S }) }) });
|
|
2814
|
+
const oe = ke(() => {
|
|
2815
|
+
const B = [];
|
|
2758
2816
|
let N = 0;
|
|
2759
2817
|
for (let z = 0; z < e.length; z++) {
|
|
2760
|
-
const
|
|
2761
|
-
if (
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2818
|
+
const T = e[z], _ = T[t], y = typeof _ == "number" && _ > 0 ? _ : 0;
|
|
2819
|
+
if (y === 0) continue;
|
|
2820
|
+
const L = y / J, A = L * 360;
|
|
2821
|
+
B.push({ index: z, row: T, value: y, start: N, end: N + A, fraction: L }), N += A;
|
|
2764
2822
|
}
|
|
2765
|
-
return
|
|
2766
|
-
}, [e, t,
|
|
2823
|
+
return B;
|
|
2824
|
+
}, [e, t, J]), he = X ? /* @__PURE__ */ s("div", { className: f(k.legend, M?.legend), role: "list", children: oe.map((B) => /* @__PURE__ */ F("div", { className: f(k.legendItem, M?.legendItem), role: "listitem", children: [
|
|
2767
2825
|
/* @__PURE__ */ s(
|
|
2768
2826
|
"span",
|
|
2769
2827
|
{
|
|
2770
|
-
className:
|
|
2771
|
-
style: { background:
|
|
2828
|
+
className: k.legendSwatch,
|
|
2829
|
+
style: { background: U(B.index) },
|
|
2772
2830
|
"aria-hidden": "true"
|
|
2773
2831
|
}
|
|
2774
2832
|
),
|
|
2775
|
-
/* @__PURE__ */ s("span", { className:
|
|
2776
|
-
] },
|
|
2777
|
-
const
|
|
2778
|
-
for (const N of
|
|
2779
|
-
|
|
2833
|
+
/* @__PURE__ */ s("span", { className: k.legendLabel, children: String(B.row[n]) })
|
|
2834
|
+
] }, B.index)) }) : void 0, w = ke(() => {
|
|
2835
|
+
const B = {};
|
|
2836
|
+
for (const N of oe)
|
|
2837
|
+
B[N.index.toString()] = {
|
|
2780
2838
|
label: String(N.row[n]),
|
|
2781
|
-
color:
|
|
2839
|
+
color: U(N.index)
|
|
2782
2840
|
};
|
|
2783
|
-
return
|
|
2784
|
-
}, [
|
|
2841
|
+
return B;
|
|
2842
|
+
}, [oe]);
|
|
2785
2843
|
return /* @__PURE__ */ s(
|
|
2786
2844
|
Ve,
|
|
2787
2845
|
{
|
|
2788
|
-
ref:
|
|
2846
|
+
ref: te,
|
|
2789
2847
|
aspectRatio: i,
|
|
2790
2848
|
height: c,
|
|
2791
|
-
className:
|
|
2792
|
-
style:
|
|
2793
|
-
classes:
|
|
2794
|
-
legend:
|
|
2795
|
-
overlay:
|
|
2849
|
+
className: ee,
|
|
2850
|
+
style: re,
|
|
2851
|
+
classes: M,
|
|
2852
|
+
legend: he,
|
|
2853
|
+
overlay: Y && j !== null && e[j] ? /* @__PURE__ */ s(
|
|
2796
2854
|
et,
|
|
2797
2855
|
{
|
|
2798
|
-
row: { [
|
|
2799
|
-
x:
|
|
2856
|
+
row: { [j.toString()]: e[j][t] },
|
|
2857
|
+
x: te.current ? te.current.getBoundingClientRect().width / 2 : 0,
|
|
2800
2858
|
y: 16,
|
|
2801
|
-
containerWidth:
|
|
2802
|
-
config: { [
|
|
2803
|
-
render:
|
|
2804
|
-
valueFormat:
|
|
2859
|
+
containerWidth: te.current?.getBoundingClientRect().width ?? 0,
|
|
2860
|
+
config: { [j.toString()]: w[j.toString()] },
|
|
2861
|
+
render: D ? () => D(e[j]) : void 0,
|
|
2862
|
+
valueFormat: Q,
|
|
2805
2863
|
titleKey: void 0,
|
|
2806
|
-
classes:
|
|
2864
|
+
classes: M
|
|
2807
2865
|
}
|
|
2808
2866
|
) : null,
|
|
2809
|
-
children: ({ width:
|
|
2810
|
-
const z =
|
|
2811
|
-
return /* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */ s("g", { children:
|
|
2813
|
-
const
|
|
2867
|
+
children: ({ width: B, height: N }) => {
|
|
2868
|
+
const z = B / 2, T = N / 2, _ = Math.min(B, N) / 2 - 4, y = It(a, _), L = Math.min(y - 1, It(l, _)), A = Math.max(4, y * 0.06);
|
|
2869
|
+
return /* @__PURE__ */ F(Xe, { children: [
|
|
2870
|
+
/* @__PURE__ */ s("g", { children: oe.map((H) => {
|
|
2871
|
+
const Z = d / 2, ue = Math.min(H.end, H.start + Z), be = Math.max(H.start, H.end - Z), pe = U(H.index), fe = j === H.index, ge = b !== void 0 && !fe, ve = fe && b !== void 0 ? y + A : y, Re = Gi(z, T, ve, L, ue, be), Ne = W ? () => W({ row: H.row, value: H.value, index: H.index }) : void 0;
|
|
2814
2872
|
return /* @__PURE__ */ s(
|
|
2815
2873
|
"path",
|
|
2816
2874
|
{
|
|
@@ -2819,24 +2877,24 @@ function Hl({
|
|
|
2819
2877
|
stroke: h > 0 ? u : "none",
|
|
2820
2878
|
strokeWidth: h,
|
|
2821
2879
|
opacity: ge ? 0.45 : 1,
|
|
2822
|
-
onMouseEnter: () =>
|
|
2823
|
-
onMouseLeave: () =>
|
|
2880
|
+
onMouseEnter: () => O(H.index),
|
|
2881
|
+
onMouseLeave: () => O(null),
|
|
2824
2882
|
onClick: Ne,
|
|
2825
2883
|
style: Ne ? { cursor: "pointer" } : void 0
|
|
2826
2884
|
},
|
|
2827
|
-
|
|
2885
|
+
H.index
|
|
2828
2886
|
);
|
|
2829
2887
|
}) }),
|
|
2830
|
-
(m ||
|
|
2831
|
-
const
|
|
2832
|
-
if (
|
|
2833
|
-
const ue = p === "inside", be = Math.max(16,
|
|
2888
|
+
(m || C) && oe.map((H) => {
|
|
2889
|
+
const Z = C ? C({ row: H.row, value: H.value, fraction: H.fraction, index: H.index }) : m ? `${String(H.row[n])} ${Q ? Q(H.value) : Math.round(H.fraction * 100) + "%"}` : null;
|
|
2890
|
+
if (Z == null) return null;
|
|
2891
|
+
const ue = p === "inside", be = Math.max(16, y * 0.12), pe = ue ? (y + L) / 2 : y + be, fe = Et(z, T, pe, H.start, H.end), ge = ue ? "middle" : fe.x < z - 1 ? "end" : fe.x > z + 1 ? "start" : "middle";
|
|
2834
2892
|
let ve = null;
|
|
2835
|
-
if (!ue &&
|
|
2836
|
-
const Re = Et(z,
|
|
2893
|
+
if (!ue && x) {
|
|
2894
|
+
const Re = Et(z, T, y, H.start, H.end), Ne = 4, g = ge === "end" ? Ne : ge === "start" ? -Ne : 0;
|
|
2837
2895
|
ve = { x1: Re.x, y1: Re.y, x2: fe.x + g, y2: fe.y };
|
|
2838
2896
|
}
|
|
2839
|
-
return /* @__PURE__ */
|
|
2897
|
+
return /* @__PURE__ */ F("g", { children: [
|
|
2840
2898
|
ve && /* @__PURE__ */ s(
|
|
2841
2899
|
"line",
|
|
2842
2900
|
{
|
|
@@ -2844,7 +2902,7 @@ function Hl({
|
|
|
2844
2902
|
y1: ve.y1,
|
|
2845
2903
|
x2: ve.x2,
|
|
2846
2904
|
y2: ve.y2,
|
|
2847
|
-
stroke:
|
|
2905
|
+
stroke: U(H.index),
|
|
2848
2906
|
strokeWidth: 1,
|
|
2849
2907
|
opacity: 0.7
|
|
2850
2908
|
}
|
|
@@ -2855,23 +2913,23 @@ function Hl({
|
|
|
2855
2913
|
x: fe.x,
|
|
2856
2914
|
y: fe.y,
|
|
2857
2915
|
className: f(
|
|
2858
|
-
|
|
2859
|
-
ue &&
|
|
2916
|
+
k.axisLabel,
|
|
2917
|
+
ue && k.barLabelInside
|
|
2860
2918
|
),
|
|
2861
2919
|
textAnchor: ge,
|
|
2862
2920
|
dominantBaseline: "middle",
|
|
2863
|
-
children:
|
|
2921
|
+
children: Z
|
|
2864
2922
|
}
|
|
2865
2923
|
)
|
|
2866
|
-
] }, `label-${
|
|
2924
|
+
] }, `label-${H.index}`);
|
|
2867
2925
|
}),
|
|
2868
|
-
|
|
2926
|
+
$ !== void 0 && /* @__PURE__ */ s(
|
|
2869
2927
|
"foreignObject",
|
|
2870
2928
|
{
|
|
2871
|
-
x: z -
|
|
2872
|
-
y:
|
|
2873
|
-
width: Math.max(0,
|
|
2874
|
-
height: Math.max(0,
|
|
2929
|
+
x: z - L,
|
|
2930
|
+
y: T - L,
|
|
2931
|
+
width: Math.max(0, L * 2),
|
|
2932
|
+
height: Math.max(0, L * 2),
|
|
2875
2933
|
style: { pointerEvents: "none" },
|
|
2876
2934
|
children: /* @__PURE__ */ s(
|
|
2877
2935
|
"div",
|
|
@@ -2887,7 +2945,7 @@ function Hl({
|
|
|
2887
2945
|
color: "var(--crk-color-text)",
|
|
2888
2946
|
fontFamily: "var(--crk-font-family)"
|
|
2889
2947
|
},
|
|
2890
|
-
children:
|
|
2948
|
+
children: $
|
|
2891
2949
|
}
|
|
2892
2950
|
)
|
|
2893
2951
|
}
|
|
@@ -2901,13 +2959,13 @@ function mt(e, t, n, r) {
|
|
|
2901
2959
|
const o = (r - 90) * Math.PI / 180;
|
|
2902
2960
|
return { x: e + n * Math.cos(o), y: t + n * Math.sin(o) };
|
|
2903
2961
|
}
|
|
2904
|
-
function
|
|
2962
|
+
function Zi(e, t, n, r) {
|
|
2905
2963
|
return r.map((o) => {
|
|
2906
2964
|
const i = mt(e, t, n, o);
|
|
2907
2965
|
return `${i.x},${i.y}`;
|
|
2908
2966
|
}).join(" ");
|
|
2909
2967
|
}
|
|
2910
|
-
function
|
|
2968
|
+
function Xl({
|
|
2911
2969
|
data: e,
|
|
2912
2970
|
axisKey: t,
|
|
2913
2971
|
config: n,
|
|
@@ -2922,184 +2980,184 @@ function Ol({
|
|
|
2922
2980
|
showPoints: d = !0,
|
|
2923
2981
|
fillOpacity: m = 0.4,
|
|
2924
2982
|
strokeWidth: p = 2,
|
|
2925
|
-
renderAxisLabel:
|
|
2926
|
-
axisFormat:
|
|
2927
|
-
valueFormat:
|
|
2928
|
-
renderTooltip:
|
|
2929
|
-
showLegend:
|
|
2930
|
-
showTooltip:
|
|
2931
|
-
emptyMessage:
|
|
2932
|
-
className:
|
|
2933
|
-
style:
|
|
2934
|
-
classes:
|
|
2983
|
+
renderAxisLabel: x,
|
|
2984
|
+
axisFormat: C,
|
|
2985
|
+
valueFormat: $,
|
|
2986
|
+
renderTooltip: b,
|
|
2987
|
+
showLegend: W = !0,
|
|
2988
|
+
showTooltip: X = !0,
|
|
2989
|
+
emptyMessage: Y = "No data",
|
|
2990
|
+
className: Q,
|
|
2991
|
+
style: D,
|
|
2992
|
+
classes: S
|
|
2935
2993
|
}) {
|
|
2936
|
-
const [
|
|
2994
|
+
const [ee, re] = Se(null), M = ne(null), G = ke(() => Object.keys(n), [n]);
|
|
2937
2995
|
if (e.length === 0)
|
|
2938
|
-
return /* @__PURE__ */ s("div", { ref:
|
|
2939
|
-
const
|
|
2940
|
-
() => e.map((
|
|
2996
|
+
return /* @__PURE__ */ s("div", { ref: M, className: f(k.root, S?.root, Q), style: D, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: Y }) }) });
|
|
2997
|
+
const O = ke(
|
|
2998
|
+
() => e.map((J, oe) => oe / e.length * 360),
|
|
2941
2999
|
[e]
|
|
2942
|
-
),
|
|
2943
|
-
const
|
|
2944
|
-
for (const
|
|
2945
|
-
for (const
|
|
2946
|
-
const
|
|
2947
|
-
typeof
|
|
3000
|
+
), te = ke(() => {
|
|
3001
|
+
const J = [];
|
|
3002
|
+
for (const he of G)
|
|
3003
|
+
for (const w of e) {
|
|
3004
|
+
const B = w[he];
|
|
3005
|
+
typeof B == "number" && J.push(B);
|
|
2948
3006
|
}
|
|
2949
|
-
const [,
|
|
2950
|
-
return Math.max(1,
|
|
2951
|
-
}, [e,
|
|
3007
|
+
const [, oe] = bt(J);
|
|
3008
|
+
return Math.max(1, oe);
|
|
3009
|
+
}, [e, G]), j = ke(() => qe(0, te, u).filter((oe) => oe > 0), [te, u]), U = j[j.length - 1] ?? te;
|
|
2952
3010
|
return /* @__PURE__ */ s(
|
|
2953
3011
|
Ve,
|
|
2954
3012
|
{
|
|
2955
|
-
ref:
|
|
3013
|
+
ref: M,
|
|
2956
3014
|
aspectRatio: r,
|
|
2957
3015
|
height: o,
|
|
2958
|
-
className:
|
|
2959
|
-
style:
|
|
2960
|
-
classes:
|
|
2961
|
-
legend:
|
|
2962
|
-
overlay:
|
|
3016
|
+
className: Q,
|
|
3017
|
+
style: D,
|
|
3018
|
+
classes: S,
|
|
3019
|
+
legend: W ? /* @__PURE__ */ s(vt, { config: n, classes: S }) : void 0,
|
|
3020
|
+
overlay: X && ee !== null ? /* @__PURE__ */ s(
|
|
2963
3021
|
et,
|
|
2964
3022
|
{
|
|
2965
|
-
row: e[
|
|
2966
|
-
x: (
|
|
3023
|
+
row: e[ee],
|
|
3024
|
+
x: (M.current?.getBoundingClientRect().width ?? 0) / 2,
|
|
2967
3025
|
y: 16,
|
|
2968
|
-
containerWidth:
|
|
3026
|
+
containerWidth: M.current?.getBoundingClientRect().width ?? 0,
|
|
2969
3027
|
config: n,
|
|
2970
|
-
render:
|
|
2971
|
-
valueFormat:
|
|
3028
|
+
render: b ? () => b(e[ee]) : void 0,
|
|
3029
|
+
valueFormat: $,
|
|
2972
3030
|
titleKey: t,
|
|
2973
|
-
classes:
|
|
3031
|
+
classes: S
|
|
2974
3032
|
}
|
|
2975
3033
|
) : null,
|
|
2976
|
-
children: ({ width:
|
|
2977
|
-
const
|
|
2978
|
-
return /* @__PURE__ */
|
|
2979
|
-
c &&
|
|
2980
|
-
const
|
|
3034
|
+
children: ({ width: J, height: oe }) => {
|
|
3035
|
+
const he = a ? 32 : 8, w = J / 2, B = oe / 2, N = Math.max(0, Math.min(J, oe) / 2 - he), z = (T) => Math.max(0, T) / U * N;
|
|
3036
|
+
return /* @__PURE__ */ F(Xe, { children: [
|
|
3037
|
+
c && j.map((T) => {
|
|
3038
|
+
const _ = z(T);
|
|
2981
3039
|
return i === "circle" ? /* @__PURE__ */ s(
|
|
2982
3040
|
"circle",
|
|
2983
3041
|
{
|
|
2984
|
-
className: f(
|
|
2985
|
-
cx:
|
|
2986
|
-
cy:
|
|
2987
|
-
r:
|
|
3042
|
+
className: f(k.gridLine, S?.grid),
|
|
3043
|
+
cx: w,
|
|
3044
|
+
cy: B,
|
|
3045
|
+
r: _,
|
|
2988
3046
|
fill: "none"
|
|
2989
3047
|
},
|
|
2990
|
-
`ring-${
|
|
3048
|
+
`ring-${T}`
|
|
2991
3049
|
) : /* @__PURE__ */ s(
|
|
2992
3050
|
"polygon",
|
|
2993
3051
|
{
|
|
2994
|
-
className: f(
|
|
2995
|
-
points:
|
|
3052
|
+
className: f(k.gridLine, S?.grid),
|
|
3053
|
+
points: Zi(w, B, _, O),
|
|
2996
3054
|
fill: "none"
|
|
2997
3055
|
},
|
|
2998
|
-
`ring-${
|
|
3056
|
+
`ring-${T}`
|
|
2999
3057
|
);
|
|
3000
3058
|
}),
|
|
3001
|
-
l &&
|
|
3002
|
-
const
|
|
3059
|
+
l && O.map((T, _) => {
|
|
3060
|
+
const y = mt(w, B, N, T);
|
|
3003
3061
|
return /* @__PURE__ */ s(
|
|
3004
3062
|
"line",
|
|
3005
3063
|
{
|
|
3006
|
-
className: f(
|
|
3007
|
-
x1:
|
|
3008
|
-
y1:
|
|
3009
|
-
x2:
|
|
3010
|
-
y2:
|
|
3064
|
+
className: f(k.gridLine, S?.grid),
|
|
3065
|
+
x1: w,
|
|
3066
|
+
y1: B,
|
|
3067
|
+
x2: y.x,
|
|
3068
|
+
y2: y.y
|
|
3011
3069
|
},
|
|
3012
|
-
`spoke-${
|
|
3070
|
+
`spoke-${_}`
|
|
3013
3071
|
);
|
|
3014
3072
|
}),
|
|
3015
|
-
h &&
|
|
3016
|
-
const
|
|
3073
|
+
h && j.map((T) => {
|
|
3074
|
+
const _ = z(T);
|
|
3017
3075
|
return /* @__PURE__ */ s(
|
|
3018
3076
|
"text",
|
|
3019
3077
|
{
|
|
3020
|
-
className: f(
|
|
3021
|
-
x:
|
|
3022
|
-
y:
|
|
3078
|
+
className: f(k.axisLabel, S?.axisLabel),
|
|
3079
|
+
x: w + 4,
|
|
3080
|
+
y: B - _,
|
|
3023
3081
|
textAnchor: "start",
|
|
3024
3082
|
dominantBaseline: "middle",
|
|
3025
|
-
children:
|
|
3083
|
+
children: $ ? $(T) : T
|
|
3026
3084
|
},
|
|
3027
|
-
`raxis-${
|
|
3085
|
+
`raxis-${T}`
|
|
3028
3086
|
);
|
|
3029
3087
|
}),
|
|
3030
|
-
a && e.map((
|
|
3031
|
-
const
|
|
3032
|
-
if (
|
|
3033
|
-
return /* @__PURE__ */ s("g", { children:
|
|
3034
|
-
row:
|
|
3035
|
-
index:
|
|
3036
|
-
angle:
|
|
3037
|
-
x:
|
|
3038
|
-
y:
|
|
3039
|
-
textAnchor:
|
|
3040
|
-
}) }, `label-${
|
|
3041
|
-
const
|
|
3088
|
+
a && e.map((T, _) => {
|
|
3089
|
+
const y = O[_], L = mt(w, B, N + 14, y), A = L.x < w - 1 ? "end" : L.x > w + 1 ? "start" : "middle";
|
|
3090
|
+
if (x)
|
|
3091
|
+
return /* @__PURE__ */ s("g", { children: x({
|
|
3092
|
+
row: T,
|
|
3093
|
+
index: _,
|
|
3094
|
+
angle: y,
|
|
3095
|
+
x: L.x,
|
|
3096
|
+
y: L.y,
|
|
3097
|
+
textAnchor: A
|
|
3098
|
+
}) }, `label-${_}`);
|
|
3099
|
+
const H = String(T[t]), Z = C ? C(H) : H;
|
|
3042
3100
|
return /* @__PURE__ */ s(
|
|
3043
3101
|
"text",
|
|
3044
3102
|
{
|
|
3045
|
-
className: f(
|
|
3046
|
-
x:
|
|
3047
|
-
y:
|
|
3048
|
-
textAnchor:
|
|
3103
|
+
className: f(k.axisLabel, S?.axisLabel),
|
|
3104
|
+
x: L.x,
|
|
3105
|
+
y: L.y,
|
|
3106
|
+
textAnchor: A,
|
|
3049
3107
|
dominantBaseline: "middle",
|
|
3050
|
-
children:
|
|
3108
|
+
children: Z
|
|
3051
3109
|
},
|
|
3052
|
-
`label-${
|
|
3110
|
+
`label-${_}`
|
|
3053
3111
|
);
|
|
3054
3112
|
}),
|
|
3055
|
-
|
|
3056
|
-
const
|
|
3057
|
-
const
|
|
3058
|
-
return mt(
|
|
3059
|
-
}),
|
|
3060
|
-
return /* @__PURE__ */
|
|
3113
|
+
G.map((T) => {
|
|
3114
|
+
const _ = n[T], y = e.map((A, H) => {
|
|
3115
|
+
const Z = A[T], be = z(typeof Z == "number" ? Z : 0);
|
|
3116
|
+
return mt(w, B, be, O[H]);
|
|
3117
|
+
}), L = y.map((A) => `${A.x},${A.y}`).join(" ");
|
|
3118
|
+
return /* @__PURE__ */ F("g", { className: f(k.series, S?.series), children: [
|
|
3061
3119
|
/* @__PURE__ */ s(
|
|
3062
3120
|
"polygon",
|
|
3063
3121
|
{
|
|
3064
|
-
points:
|
|
3065
|
-
fill:
|
|
3122
|
+
points: L,
|
|
3123
|
+
fill: _.color,
|
|
3066
3124
|
fillOpacity: m,
|
|
3067
|
-
stroke:
|
|
3125
|
+
stroke: _.color,
|
|
3068
3126
|
strokeWidth: p,
|
|
3069
3127
|
strokeLinejoin: "round",
|
|
3070
3128
|
strokeLinecap: "round"
|
|
3071
3129
|
}
|
|
3072
3130
|
),
|
|
3073
|
-
d &&
|
|
3131
|
+
d && y.map((A, H) => /* @__PURE__ */ s(
|
|
3074
3132
|
"circle",
|
|
3075
3133
|
{
|
|
3076
|
-
className: f(
|
|
3077
|
-
cx:
|
|
3078
|
-
cy:
|
|
3079
|
-
r:
|
|
3080
|
-
fill:
|
|
3134
|
+
className: f(k.point, S?.point),
|
|
3135
|
+
cx: A.x,
|
|
3136
|
+
cy: A.y,
|
|
3137
|
+
r: ee === H ? 5 : 3.5,
|
|
3138
|
+
fill: _.color
|
|
3081
3139
|
},
|
|
3082
|
-
`${
|
|
3140
|
+
`${T}-${H}`
|
|
3083
3141
|
))
|
|
3084
|
-
] },
|
|
3142
|
+
] }, T);
|
|
3085
3143
|
}),
|
|
3086
3144
|
/* @__PURE__ */ s(
|
|
3087
3145
|
"rect",
|
|
3088
3146
|
{
|
|
3089
|
-
className:
|
|
3147
|
+
className: k.interactionLayer,
|
|
3090
3148
|
x: 0,
|
|
3091
3149
|
y: 0,
|
|
3092
|
-
width:
|
|
3093
|
-
height:
|
|
3094
|
-
onMouseMove: (
|
|
3095
|
-
const
|
|
3096
|
-
if (
|
|
3097
|
-
let
|
|
3098
|
-
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3150
|
+
width: J,
|
|
3151
|
+
height: oe,
|
|
3152
|
+
onMouseMove: (T) => {
|
|
3153
|
+
const _ = T.currentTarget.getBoundingClientRect(), y = T.clientX - _.left - w, L = T.clientY - _.top - B;
|
|
3154
|
+
if (y === 0 && L === 0) return;
|
|
3155
|
+
let A = Math.atan2(L, y) * 180 / Math.PI + 90;
|
|
3156
|
+
A < 0 && (A += 360), A >= 360 && (A -= 360);
|
|
3157
|
+
const H = 360 / e.length, Z = Math.round(A / H) % e.length;
|
|
3158
|
+
re(Z);
|
|
3101
3159
|
},
|
|
3102
|
-
onMouseLeave: () =>
|
|
3160
|
+
onMouseLeave: () => re(null)
|
|
3103
3161
|
}
|
|
3104
3162
|
)
|
|
3105
3163
|
] });
|
|
@@ -3107,7 +3165,7 @@ function Ol({
|
|
|
3107
3165
|
}
|
|
3108
3166
|
);
|
|
3109
3167
|
}
|
|
3110
|
-
function
|
|
3168
|
+
function Ki(e, t) {
|
|
3111
3169
|
const n = new Array(e.length).fill(null);
|
|
3112
3170
|
if (t <= 0 || e.length < t) return n;
|
|
3113
3171
|
let r = 0;
|
|
@@ -3117,7 +3175,7 @@ function Gi(e, t) {
|
|
|
3117
3175
|
r += e[o].close - e[o - t].close, n[o] = r / t;
|
|
3118
3176
|
return n;
|
|
3119
3177
|
}
|
|
3120
|
-
function
|
|
3178
|
+
function Qi(e, t) {
|
|
3121
3179
|
const n = new Array(e.length).fill(null);
|
|
3122
3180
|
if (t <= 0 || e.length < t) return n;
|
|
3123
3181
|
const r = 2 / (t + 1);
|
|
@@ -3129,7 +3187,7 @@ function Zi(e, t) {
|
|
|
3129
3187
|
i = e[c].close * r + i * (1 - r), n[c] = i;
|
|
3130
3188
|
return n;
|
|
3131
3189
|
}
|
|
3132
|
-
function
|
|
3190
|
+
function Ji(e, t, n = 2) {
|
|
3133
3191
|
const r = e.length, o = new Array(r).fill(null), i = new Array(r).fill(null), c = new Array(r).fill(null);
|
|
3134
3192
|
if (t <= 0 || r < t) return { middle: o, upper: i, lower: c };
|
|
3135
3193
|
for (let l = t - 1; l < r; l++) {
|
|
@@ -3147,7 +3205,7 @@ function Ki(e, t, n = 2) {
|
|
|
3147
3205
|
}
|
|
3148
3206
|
return { middle: o, upper: i, lower: c };
|
|
3149
3207
|
}
|
|
3150
|
-
function
|
|
3208
|
+
function el(e, t = 14) {
|
|
3151
3209
|
const n = new Array(e.length).fill(null);
|
|
3152
3210
|
if (e.length <= t) return n;
|
|
3153
3211
|
let r = 0, o = 0;
|
|
@@ -3165,11 +3223,11 @@ function Qi(e, t = 14) {
|
|
|
3165
3223
|
function Pt(e, t) {
|
|
3166
3224
|
return t === 0 ? 100 : 100 - 100 / (1 + e / t);
|
|
3167
3225
|
}
|
|
3168
|
-
function
|
|
3226
|
+
function _l(e) {
|
|
3169
3227
|
return e.map((t) => typeof t.volume == "number" ? t.volume : null);
|
|
3170
3228
|
}
|
|
3171
3229
|
const Le = 86400;
|
|
3172
|
-
function
|
|
3230
|
+
function nn(e) {
|
|
3173
3231
|
switch (e) {
|
|
3174
3232
|
case "1D":
|
|
3175
3233
|
return Le;
|
|
@@ -3197,7 +3255,7 @@ function tn(e) {
|
|
|
3197
3255
|
}
|
|
3198
3256
|
return 30 * Le;
|
|
3199
3257
|
}
|
|
3200
|
-
function
|
|
3258
|
+
function Ul(e) {
|
|
3201
3259
|
switch (e) {
|
|
3202
3260
|
case "1D":
|
|
3203
3261
|
return "5";
|
|
@@ -3214,232 +3272,232 @@ function jl(e) {
|
|
|
3214
3272
|
case "5Y":
|
|
3215
3273
|
return "W";
|
|
3216
3274
|
}
|
|
3217
|
-
const t =
|
|
3275
|
+
const t = nn(e);
|
|
3218
3276
|
return t >= 3 * 365 * Le ? "W" : t >= 180 * Le ? "D" : t >= 60 * Le ? "240" : t >= 14 * Le ? "60" : t >= 3 * Le ? "15" : "5";
|
|
3219
3277
|
}
|
|
3220
|
-
function
|
|
3278
|
+
function zl(e) {
|
|
3221
3279
|
if (e === "W" || e === "M") return "5Y";
|
|
3222
3280
|
if (e === "D") return "1Y";
|
|
3223
3281
|
const t = Number(e);
|
|
3224
3282
|
return !Number.isFinite(t) || t >= 240 ? "3M" : t >= 60 ? "1M" : t >= 15 || t >= 5 ? "5D" : "1D";
|
|
3225
3283
|
}
|
|
3226
|
-
const
|
|
3227
|
-
function
|
|
3284
|
+
const tl = 420, Rt = 64, Ct = 28, nl = 40, rl = 4, Wt = { rsi: 0.18, volume: 0.14 }, ol = 1, cl = 40, Ht = 0.1, il = 500, ll = [];
|
|
3285
|
+
function Yl({
|
|
3228
3286
|
datafeed: e,
|
|
3229
3287
|
symbol: t,
|
|
3230
3288
|
resolution: n,
|
|
3231
3289
|
period: r,
|
|
3232
3290
|
seriesType: o = "candle",
|
|
3233
|
-
indicators: i =
|
|
3291
|
+
indicators: i = ll,
|
|
3234
3292
|
precision: c = 2,
|
|
3235
|
-
initialLookback: l =
|
|
3236
|
-
height: a =
|
|
3293
|
+
initialLookback: l = il,
|
|
3294
|
+
height: a = tl,
|
|
3237
3295
|
upColor: h = "var(--crk-color-success)",
|
|
3238
3296
|
downColor: u = "var(--crk-color-danger)",
|
|
3239
3297
|
lineColor: d = "var(--crk-chart-1)",
|
|
3240
3298
|
timezone: m,
|
|
3241
3299
|
defaultTimezone: p = "local",
|
|
3242
|
-
onTimezoneChange:
|
|
3243
|
-
showConfigPanel:
|
|
3244
|
-
onCrosshair:
|
|
3245
|
-
onVisibleRangeChange:
|
|
3246
|
-
className:
|
|
3247
|
-
style:
|
|
3300
|
+
onTimezoneChange: x,
|
|
3301
|
+
showConfigPanel: C = !0,
|
|
3302
|
+
onCrosshair: $,
|
|
3303
|
+
onVisibleRangeChange: b,
|
|
3304
|
+
className: W,
|
|
3305
|
+
style: X
|
|
3248
3306
|
}) {
|
|
3249
|
-
const
|
|
3250
|
-
}),
|
|
3251
|
-
|
|
3252
|
-
const [
|
|
3307
|
+
const Y = ne(null), Q = ne(null), D = ne([]), S = ne({ from: 0, to: 0 }), ee = ne(null), re = ne(null), M = ne(!1), G = ne(null), O = ne(null), te = ne(1), j = ne({ width: 0, height: 0 }), U = ne(() => {
|
|
3308
|
+
}), J = ne($), oe = ne(b);
|
|
3309
|
+
J.current = $, oe.current = b;
|
|
3310
|
+
const [he, w] = Se(null), [B, N] = Se(p), z = m ?? B, T = de(
|
|
3253
3311
|
(g) => {
|
|
3254
|
-
m === void 0 && N(g),
|
|
3312
|
+
m === void 0 && N(g), x?.(g);
|
|
3255
3313
|
},
|
|
3256
|
-
[m,
|
|
3257
|
-
),
|
|
3314
|
+
[m, x]
|
|
3315
|
+
), _ = ke(
|
|
3258
3316
|
() => ({ up: h, down: u, line: d }),
|
|
3259
3317
|
[h, u, d]
|
|
3260
|
-
),
|
|
3261
|
-
const g =
|
|
3318
|
+
), y = i, L = y.some((g) => g.type === "rsi"), A = y.some((g) => g.type === "volume"), H = de(() => {
|
|
3319
|
+
const g = Q.current;
|
|
3262
3320
|
if (!g) return;
|
|
3263
|
-
const
|
|
3264
|
-
if (!
|
|
3265
|
-
const { width: K, height:
|
|
3266
|
-
if (K === 0 ||
|
|
3267
|
-
const
|
|
3268
|
-
|
|
3269
|
-
const
|
|
3270
|
-
if (
|
|
3271
|
-
|
|
3321
|
+
const v = g.getContext("2d");
|
|
3322
|
+
if (!v) return;
|
|
3323
|
+
const { width: K, height: E } = j.current;
|
|
3324
|
+
if (K === 0 || E === 0) return;
|
|
3325
|
+
const V = te.current;
|
|
3326
|
+
v.save(), v.setTransform(1, 0, 0, 1, 0, 0), v.clearRect(0, 0, g.width, g.height), v.scale(V, V);
|
|
3327
|
+
const I = fl(Y.current, _), ae = on(Y.current), q = D.current;
|
|
3328
|
+
if (q.length === 0) {
|
|
3329
|
+
pl(v, K, E, I), v.restore();
|
|
3272
3330
|
return;
|
|
3273
3331
|
}
|
|
3274
|
-
const
|
|
3275
|
-
|
|
3276
|
-
const
|
|
3277
|
-
const De = me -
|
|
3278
|
-
return
|
|
3279
|
-
}, Ce =
|
|
3280
|
-
Lt(
|
|
3281
|
-
for (let
|
|
3282
|
-
const De =
|
|
3283
|
-
He &&
|
|
3332
|
+
const R = Nt(K, E, L, A), { from: ie, to: me } = ul(S.current, q.length);
|
|
3333
|
+
S.current = { from: ie, to: me };
|
|
3334
|
+
const ce = q.slice(Math.max(0, Math.floor(ie)), Math.min(q.length, Math.ceil(me) + 1)), se = (le) => {
|
|
3335
|
+
const De = me - ie + 1, He = R.plotWidth / De;
|
|
3336
|
+
return R.plotLeft + (le - ie + 0.5) * He;
|
|
3337
|
+
}, Ce = R.plotWidth / (me - ie + 1), Ie = y.map((le) => hl(le, q)).filter((le) => le !== null).map((le) => ({ ...le, color: ae(le.color) })), xe = rn(R.main, ce, Ie, ie, me);
|
|
3338
|
+
Lt(v, R.plotLeft, R.plotRight, xe, I), gl(v, R, xe, c, I), v.save(), v.beginPath(), v.rect(R.plotLeft, xe.paneTop, R.plotWidth, xe.paneHeight), v.clip();
|
|
3339
|
+
for (let le = 0; le < y.length; le++) {
|
|
3340
|
+
const De = y[le], He = Ie[le];
|
|
3341
|
+
He && xl(v, He, De, q, ie, me, se, xe);
|
|
3284
3342
|
}
|
|
3285
|
-
if (o === "candle" ?
|
|
3286
|
-
const
|
|
3287
|
-
Lt(
|
|
3343
|
+
if (o === "candle" ? yl(v, q, ie, me, se, Ce, xe, { up: I.up, down: I.down }) : o === "bar" ? vl(v, q, ie, me, se, Ce, xe, { up: I.up, down: I.down }) : bl(v, q, ie, me, se, xe, I.line, o === "area"), v.restore(), R.volume) {
|
|
3344
|
+
const le = ml(R.volume, q, ie, me);
|
|
3345
|
+
Lt(v, R.plotLeft, R.plotRight, le, I, !0), Ot(v, R, R.volume, "Volume", I), v.save(), v.beginPath(), v.rect(R.plotLeft, le.paneTop, R.plotWidth, le.paneHeight), v.clip(), kl(v, q, ie, me, se, Ce, le, { up: I.up, down: I.down }), v.restore();
|
|
3288
3346
|
}
|
|
3289
|
-
if (
|
|
3290
|
-
const
|
|
3291
|
-
paneTop:
|
|
3292
|
-
paneBottom:
|
|
3293
|
-
paneHeight:
|
|
3347
|
+
if (R.rsi) {
|
|
3348
|
+
const le = y.find((tt) => tt.type === "rsi"), De = le && le.type === "rsi" ? le.period ?? 14 : 14, He = le && le.type === "rsi" ? le.overbought ?? 70 : 70, Ge = le && le.type === "rsi" ? le.oversold ?? 30 : 30, Ee = (le && le.type === "rsi" ? le.color : void 0) ?? "var(--crk-chart-5)", xt = ae(Ee), kt = el(q, De), Oe = {
|
|
3349
|
+
paneTop: R.rsi.top,
|
|
3350
|
+
paneBottom: R.rsi.bottom,
|
|
3351
|
+
paneHeight: R.rsi.height,
|
|
3294
3352
|
priceMin: 0,
|
|
3295
3353
|
priceMax: 100,
|
|
3296
3354
|
ticks: [Ge, 50, He]
|
|
3297
3355
|
};
|
|
3298
|
-
Lt(
|
|
3356
|
+
Lt(v, R.plotLeft, R.plotRight, Oe, I, !0), Ot(v, R, R.rsi, `RSI ${De}`, I), v.save(), v.beginPath(), v.rect(R.plotLeft, Oe.paneTop, R.plotWidth, Oe.paneHeight), v.clip(), Qe(v, kt, ie, me, se, Oe, xt), v.restore(), Ml(v, R, Oe, He, Ge, I);
|
|
3299
3357
|
}
|
|
3300
|
-
|
|
3301
|
-
}, [o,
|
|
3302
|
-
|
|
3303
|
-
const
|
|
3304
|
-
if (
|
|
3358
|
+
wl(v, R, q, ie, me, n, I), ee.current && $l(v, R, ee.current, q, ie, me, se, c, xe, z, I), v.restore();
|
|
3359
|
+
}, [o, y, L, A, c, _, n, z]);
|
|
3360
|
+
U.current = H;
|
|
3361
|
+
const Z = de(() => {
|
|
3362
|
+
if (O.current === null) {
|
|
3305
3363
|
if (typeof requestAnimationFrame > "u") {
|
|
3306
|
-
|
|
3364
|
+
U.current();
|
|
3307
3365
|
return;
|
|
3308
3366
|
}
|
|
3309
|
-
|
|
3310
|
-
|
|
3367
|
+
O.current = requestAnimationFrame(() => {
|
|
3368
|
+
O.current = null, U.current();
|
|
3311
3369
|
});
|
|
3312
3370
|
}
|
|
3313
3371
|
}, []);
|
|
3314
|
-
|
|
3315
|
-
const g =
|
|
3372
|
+
dn(() => {
|
|
3373
|
+
const g = Y.current;
|
|
3316
3374
|
if (!g) return;
|
|
3317
|
-
const
|
|
3318
|
-
const
|
|
3319
|
-
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3375
|
+
const v = () => {
|
|
3376
|
+
const E = g.getBoundingClientRect(), V = typeof window < "u" && window.devicePixelRatio || 1;
|
|
3377
|
+
te.current = V, j.current = { width: E.width, height: E.height };
|
|
3378
|
+
const I = Q.current;
|
|
3379
|
+
I && (I.width = Math.round(E.width * V), I.height = Math.round(E.height * V), I.style.width = `${E.width}px`, I.style.height = `${E.height}px`), Z();
|
|
3322
3380
|
};
|
|
3323
|
-
if (
|
|
3324
|
-
const K = new ResizeObserver(
|
|
3381
|
+
if (v(), typeof ResizeObserver > "u") return;
|
|
3382
|
+
const K = new ResizeObserver(v);
|
|
3325
3383
|
return K.observe(g), () => K.disconnect();
|
|
3326
|
-
}, [
|
|
3384
|
+
}, [Z]), Be(() => {
|
|
3327
3385
|
let g = !1;
|
|
3328
|
-
const
|
|
3329
|
-
|
|
3386
|
+
const v = Math.floor(Date.now() / 1e3), K = Ft(n), E = r !== void 0 ? nn(r) : K * l, V = r !== void 0 ? Math.max(10, Math.ceil(E / K)) : l, I = v - E;
|
|
3387
|
+
D.current = [], S.current = { from: 0, to: 0 }, Z(), e.getBars({ symbol: t, resolution: n, from: I, to: v, countBack: V }).then((q) => {
|
|
3330
3388
|
if (g) return;
|
|
3331
|
-
const
|
|
3332
|
-
|
|
3333
|
-
const
|
|
3389
|
+
const R = [...q].sort((me, ce) => me.time - ce.time);
|
|
3390
|
+
D.current = R;
|
|
3391
|
+
const ie = R.length - 1;
|
|
3334
3392
|
if (r !== void 0)
|
|
3335
|
-
|
|
3393
|
+
S.current = { from: 0, to: ie };
|
|
3336
3394
|
else {
|
|
3337
|
-
const me = Math.min(
|
|
3338
|
-
|
|
3339
|
-
from: Math.max(0,
|
|
3340
|
-
to:
|
|
3395
|
+
const me = Math.min(R.length, Math.min(200, l));
|
|
3396
|
+
S.current = {
|
|
3397
|
+
from: Math.max(0, ie - me + 1),
|
|
3398
|
+
to: ie
|
|
3341
3399
|
};
|
|
3342
3400
|
}
|
|
3343
|
-
|
|
3401
|
+
oe.current?.(S.current, R), Z();
|
|
3344
3402
|
}).catch(() => {
|
|
3345
3403
|
});
|
|
3346
|
-
const
|
|
3404
|
+
const ae = e.subscribeBars({
|
|
3347
3405
|
symbol: t,
|
|
3348
3406
|
resolution: n,
|
|
3349
|
-
onTick: (
|
|
3407
|
+
onTick: (q) => {
|
|
3350
3408
|
if (g) return;
|
|
3351
|
-
const
|
|
3352
|
-
if (
|
|
3353
|
-
|
|
3354
|
-
else if (!
|
|
3355
|
-
|
|
3356
|
-
const me =
|
|
3357
|
-
me.to >=
|
|
3409
|
+
const R = D.current, ie = R[R.length - 1];
|
|
3410
|
+
if (ie && ie.time === q.time)
|
|
3411
|
+
R[R.length - 1] = q;
|
|
3412
|
+
else if (!ie || q.time > ie.time) {
|
|
3413
|
+
R.push(q);
|
|
3414
|
+
const me = S.current;
|
|
3415
|
+
me.to >= R.length - 2 && (S.current = { from: me.from + 1, to: me.to + 1 });
|
|
3358
3416
|
}
|
|
3359
|
-
|
|
3417
|
+
Z();
|
|
3360
3418
|
}
|
|
3361
3419
|
});
|
|
3362
|
-
return
|
|
3363
|
-
g = !0,
|
|
3420
|
+
return G.current = ae, () => {
|
|
3421
|
+
g = !0, G.current !== null && (e.unsubscribeBars(G.current), G.current = null);
|
|
3364
3422
|
};
|
|
3365
3423
|
}, [e, t, n, r, l]);
|
|
3366
|
-
const ue =
|
|
3367
|
-
|
|
3368
|
-
}, []), be =
|
|
3424
|
+
const ue = de((g) => {
|
|
3425
|
+
w(g), J.current?.(g);
|
|
3426
|
+
}, []), be = de((g) => {
|
|
3369
3427
|
g.currentTarget.setPointerCapture(g.pointerId);
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3372
|
-
}, []), pe =
|
|
3428
|
+
const v = S.current;
|
|
3429
|
+
re.current = { startX: g.clientX, from: v.from, to: v.to };
|
|
3430
|
+
}, []), pe = de(
|
|
3373
3431
|
(g) => {
|
|
3374
|
-
const
|
|
3375
|
-
if (
|
|
3376
|
-
const { startX:
|
|
3377
|
-
let Ie =
|
|
3378
|
-
const
|
|
3379
|
-
Ie < 0 && (Ne(), Ie = 0, xe =
|
|
3432
|
+
const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left, E = g.clientY - v.top;
|
|
3433
|
+
if (ee.current = { x: K, y: E }, re.current) {
|
|
3434
|
+
const { startX: ae, from: q, to: R } = re.current, { width: ie } = j.current, me = Math.max(1, ie - Rt), ce = R - q + 1, se = me / ce, Ce = -(g.clientX - ae) / se;
|
|
3435
|
+
let Ie = q + Ce, xe = R + Ce;
|
|
3436
|
+
const le = D.current.length;
|
|
3437
|
+
Ie < 0 && (Ne(), Ie = 0, xe = ce - 1), xe > le - 1 && (xe = le - 1, Ie = xe - ce + 1), S.current = { from: Ie, to: xe }, oe.current?.(S.current, D.current);
|
|
3380
3438
|
}
|
|
3381
|
-
const
|
|
3382
|
-
if (K >=
|
|
3383
|
-
const
|
|
3384
|
-
ue({ barIndex: me, bar:
|
|
3439
|
+
const V = Nt(v.width, v.height, L, A), I = S.current;
|
|
3440
|
+
if (K >= V.plotLeft && K <= V.plotRight) {
|
|
3441
|
+
const ae = I.to - I.from + 1, q = V.plotWidth / ae, R = Math.round(I.from + (K - V.plotLeft) / q - 0.5), ie = D.current, me = Math.max(0, Math.min(ie.length - 1, R)), ce = ie[me] ?? null, se = Nl(E, V, ie, I.from, I.to);
|
|
3442
|
+
ue({ barIndex: me, bar: ce, priceAtCursor: se });
|
|
3385
3443
|
} else
|
|
3386
3444
|
ue(null);
|
|
3387
|
-
|
|
3445
|
+
Z();
|
|
3388
3446
|
},
|
|
3389
|
-
[
|
|
3390
|
-
), fe =
|
|
3391
|
-
g.currentTarget.releasePointerCapture(g.pointerId),
|
|
3392
|
-
}, []), ge =
|
|
3393
|
-
|
|
3394
|
-
}, [
|
|
3447
|
+
[L, A, Z, ue]
|
|
3448
|
+
), fe = de((g) => {
|
|
3449
|
+
g.currentTarget.releasePointerCapture(g.pointerId), re.current = null;
|
|
3450
|
+
}, []), ge = de(() => {
|
|
3451
|
+
ee.current = null, re.current = null, ue(null), Z();
|
|
3452
|
+
}, [Z, ue]), ve = de(
|
|
3395
3453
|
(g) => {
|
|
3396
3454
|
g.preventDefault();
|
|
3397
|
-
const
|
|
3398
|
-
if (
|
|
3399
|
-
const
|
|
3400
|
-
|
|
3401
|
-
Math.min(
|
|
3402
|
-
),
|
|
3403
|
-
let
|
|
3404
|
-
|
|
3455
|
+
const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left, E = Nt(v.width, v.height, L, A), V = S.current, I = D.current;
|
|
3456
|
+
if (I.length === 0) return;
|
|
3457
|
+
const ae = V.to - V.from + 1, q = g.deltaY > 0 ? 1 + Ht : 1 / (1 + Ht), R = Math.max(
|
|
3458
|
+
E.plotWidth / cl,
|
|
3459
|
+
Math.min(I.length, E.plotWidth / ol, ae * q)
|
|
3460
|
+
), ie = V.from + (K - E.plotLeft) / (E.plotWidth / ae), me = (ie - V.from) / ae;
|
|
3461
|
+
let ce = ie - me * R, se = ce + R - 1;
|
|
3462
|
+
ce < 0 && (ce = 0, se = R - 1), se > I.length - 1 && (se = I.length - 1, ce = se - R + 1), S.current = { from: ce, to: se }, oe.current?.(S.current, I), Z();
|
|
3405
3463
|
},
|
|
3406
|
-
[
|
|
3407
|
-
), Re =
|
|
3464
|
+
[L, A, Z]
|
|
3465
|
+
), Re = de(
|
|
3408
3466
|
(g) => {
|
|
3409
|
-
const
|
|
3410
|
-
if (
|
|
3411
|
-
let
|
|
3412
|
-
if (g.key === "ArrowLeft")
|
|
3413
|
-
else if (g.key === "ArrowRight")
|
|
3467
|
+
const v = S.current, K = v.to - v.from + 1, E = D.current;
|
|
3468
|
+
if (E.length === 0) return;
|
|
3469
|
+
let V = 0;
|
|
3470
|
+
if (g.key === "ArrowLeft") V = -Math.max(1, Math.floor(K * 0.1));
|
|
3471
|
+
else if (g.key === "ArrowRight") V = Math.max(1, Math.floor(K * 0.1));
|
|
3414
3472
|
else return;
|
|
3415
3473
|
g.preventDefault();
|
|
3416
|
-
let
|
|
3417
|
-
|
|
3474
|
+
let I = v.from + V, ae = v.to + V;
|
|
3475
|
+
I < 0 && (I = 0, ae = K - 1), ae > E.length - 1 && (ae = E.length - 1, I = ae - K + 1), S.current = { from: I, to: ae }, oe.current?.(S.current, E), Z();
|
|
3418
3476
|
},
|
|
3419
|
-
[
|
|
3420
|
-
), Ne =
|
|
3421
|
-
if (
|
|
3422
|
-
const g =
|
|
3477
|
+
[Z]
|
|
3478
|
+
), Ne = de(() => {
|
|
3479
|
+
if (M.current) return;
|
|
3480
|
+
const g = D.current;
|
|
3423
3481
|
if (g.length === 0) return;
|
|
3424
|
-
|
|
3425
|
-
const
|
|
3426
|
-
e.getBars({ symbol: t, resolution: n, from:
|
|
3427
|
-
if (
|
|
3428
|
-
|
|
3482
|
+
M.current = !0;
|
|
3483
|
+
const v = Ft(n), K = g[0].time, E = K - v * l, V = K - v;
|
|
3484
|
+
e.getBars({ symbol: t, resolution: n, from: E, to: V, countBack: l }).then((I) => {
|
|
3485
|
+
if (I.length === 0) {
|
|
3486
|
+
M.current = !1;
|
|
3429
3487
|
return;
|
|
3430
3488
|
}
|
|
3431
|
-
const
|
|
3432
|
-
|
|
3489
|
+
const q = [...I].sort((ie, me) => ie.time - me.time).filter((ie) => ie.time < K), R = S.current;
|
|
3490
|
+
D.current = [...q, ...g], S.current = { from: R.from + q.length, to: R.to + q.length }, M.current = !1, Z();
|
|
3433
3491
|
}).catch(() => {
|
|
3434
|
-
|
|
3492
|
+
M.current = !1;
|
|
3435
3493
|
});
|
|
3436
|
-
}, [e, t, n, l,
|
|
3437
|
-
return /* @__PURE__ */
|
|
3494
|
+
}, [e, t, n, l, Z]);
|
|
3495
|
+
return /* @__PURE__ */ F(
|
|
3438
3496
|
"div",
|
|
3439
3497
|
{
|
|
3440
|
-
ref:
|
|
3441
|
-
className: f(
|
|
3442
|
-
style: { ...
|
|
3498
|
+
ref: Y,
|
|
3499
|
+
className: f(k.root, W),
|
|
3500
|
+
style: { ...X, height: a, position: "relative" },
|
|
3443
3501
|
tabIndex: 0,
|
|
3444
3502
|
role: "figure",
|
|
3445
3503
|
"aria-label": `${t} ${n} chart`,
|
|
@@ -3448,23 +3506,23 @@ function Ul({
|
|
|
3448
3506
|
/* @__PURE__ */ s(
|
|
3449
3507
|
"canvas",
|
|
3450
3508
|
{
|
|
3451
|
-
ref:
|
|
3452
|
-
className:
|
|
3509
|
+
ref: Q,
|
|
3510
|
+
className: k.svg,
|
|
3453
3511
|
onPointerDown: be,
|
|
3454
3512
|
onPointerMove: pe,
|
|
3455
3513
|
onPointerUp: fe,
|
|
3456
3514
|
onPointerLeave: ge,
|
|
3457
3515
|
onWheel: ve,
|
|
3458
|
-
style: { cursor:
|
|
3516
|
+
style: { cursor: re.current ? "grabbing" : "crosshair", touchAction: "none" }
|
|
3459
3517
|
}
|
|
3460
3518
|
),
|
|
3461
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__PURE__ */ F(
|
|
3462
3520
|
"div",
|
|
3463
3521
|
{
|
|
3464
|
-
className:
|
|
3522
|
+
className: k.tradingHeader,
|
|
3465
3523
|
style: {
|
|
3466
3524
|
position: "absolute",
|
|
3467
|
-
top:
|
|
3525
|
+
top: rl,
|
|
3468
3526
|
left: 8,
|
|
3469
3527
|
right: 8,
|
|
3470
3528
|
pointerEvents: "none",
|
|
@@ -3474,25 +3532,26 @@ function Ul({
|
|
|
3474
3532
|
gap: 8
|
|
3475
3533
|
},
|
|
3476
3534
|
children: [
|
|
3477
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ F("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
|
|
3478
3536
|
/* @__PURE__ */ s("strong", { children: t }),
|
|
3479
3537
|
/* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
|
|
3480
|
-
|
|
3538
|
+
he?.bar && /* @__PURE__ */ F("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
|
|
3481
3539
|
"O ",
|
|
3482
|
-
|
|
3540
|
+
he.bar.open.toFixed(c),
|
|
3483
3541
|
" · H ",
|
|
3484
|
-
|
|
3542
|
+
he.bar.high.toFixed(c),
|
|
3485
3543
|
" · L",
|
|
3486
3544
|
" ",
|
|
3487
|
-
|
|
3545
|
+
he.bar.low.toFixed(c),
|
|
3488
3546
|
" · C ",
|
|
3489
|
-
|
|
3547
|
+
he.bar.close.toFixed(c)
|
|
3490
3548
|
] })
|
|
3491
3549
|
] }),
|
|
3492
|
-
|
|
3493
|
-
|
|
3550
|
+
C && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
|
|
3551
|
+
Yt,
|
|
3494
3552
|
{
|
|
3495
3553
|
position: "bottom",
|
|
3554
|
+
asChild: !0,
|
|
3496
3555
|
trigger: /* @__PURE__ */ s(
|
|
3497
3556
|
Ut,
|
|
3498
3557
|
{
|
|
@@ -3500,14 +3559,14 @@ function Ul({
|
|
|
3500
3559
|
size: "sm",
|
|
3501
3560
|
iconOnly: !0,
|
|
3502
3561
|
"aria-label": "Chart settings",
|
|
3503
|
-
children: /* @__PURE__ */ s(
|
|
3562
|
+
children: /* @__PURE__ */ s(dl, {})
|
|
3504
3563
|
}
|
|
3505
3564
|
),
|
|
3506
3565
|
content: /* @__PURE__ */ s(
|
|
3507
|
-
|
|
3566
|
+
al,
|
|
3508
3567
|
{
|
|
3509
3568
|
timezone: z,
|
|
3510
|
-
onTimezoneChange:
|
|
3569
|
+
onTimezoneChange: T
|
|
3511
3570
|
}
|
|
3512
3571
|
)
|
|
3513
3572
|
}
|
|
@@ -3519,7 +3578,7 @@ function Ul({
|
|
|
3519
3578
|
}
|
|
3520
3579
|
);
|
|
3521
3580
|
}
|
|
3522
|
-
const
|
|
3581
|
+
const sl = [
|
|
3523
3582
|
{ value: "local", label: "Local time" },
|
|
3524
3583
|
{ value: "utc", label: "UTC" },
|
|
3525
3584
|
{ value: "America/New_York", label: "America / New York" },
|
|
@@ -3529,11 +3588,11 @@ const cl = [
|
|
|
3529
3588
|
{ value: "Asia/Tokyo", label: "Asia / Tokyo" },
|
|
3530
3589
|
{ value: "Asia/Singapore", label: "Asia / Singapore" }
|
|
3531
3590
|
];
|
|
3532
|
-
function
|
|
3591
|
+
function al({
|
|
3533
3592
|
timezone: e,
|
|
3534
3593
|
onTimezoneChange: t
|
|
3535
3594
|
}) {
|
|
3536
|
-
return /* @__PURE__ */
|
|
3595
|
+
return /* @__PURE__ */ F("div", { style: { minWidth: 220, padding: 4 }, children: [
|
|
3537
3596
|
/* @__PURE__ */ s(
|
|
3538
3597
|
"div",
|
|
3539
3598
|
{
|
|
@@ -3545,12 +3604,12 @@ function il({
|
|
|
3545
3604
|
children: "Settings"
|
|
3546
3605
|
}
|
|
3547
3606
|
),
|
|
3548
|
-
/* @__PURE__ */
|
|
3607
|
+
/* @__PURE__ */ F("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
|
|
3549
3608
|
/* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
|
|
3550
3609
|
/* @__PURE__ */ s(
|
|
3551
|
-
|
|
3610
|
+
zt,
|
|
3552
3611
|
{
|
|
3553
|
-
options:
|
|
3612
|
+
options: sl.map((n) => ({ value: n.value, label: n.label })),
|
|
3554
3613
|
value: e,
|
|
3555
3614
|
onChange: (n) => t(n)
|
|
3556
3615
|
}
|
|
@@ -3558,8 +3617,8 @@ function il({
|
|
|
3558
3617
|
] })
|
|
3559
3618
|
] });
|
|
3560
3619
|
}
|
|
3561
|
-
function
|
|
3562
|
-
return /* @__PURE__ */
|
|
3620
|
+
function dl() {
|
|
3621
|
+
return /* @__PURE__ */ F(
|
|
3563
3622
|
"svg",
|
|
3564
3623
|
{
|
|
3565
3624
|
viewBox: "0 0 24 24",
|
|
@@ -3577,14 +3636,14 @@ function ll() {
|
|
|
3577
3636
|
);
|
|
3578
3637
|
}
|
|
3579
3638
|
function Nt(e, t, n, r) {
|
|
3580
|
-
const i = Math.max(0, e - Rt), c =
|
|
3639
|
+
const i = Math.max(0, e - Rt), c = nl, l = Math.max(c, t - Ct), a = Math.max(0, i - 0), h = Math.max(0, l - c);
|
|
3581
3640
|
let u = h, d = c;
|
|
3582
3641
|
const m = { top: c, bottom: l, height: h };
|
|
3583
|
-
let p = null,
|
|
3584
|
-
const
|
|
3585
|
-
return u = h * (1 -
|
|
3642
|
+
let p = null, x = null;
|
|
3643
|
+
const C = n ? Wt.rsi : 0, $ = r ? Wt.volume : 0;
|
|
3644
|
+
return u = h * (1 - C - $), m.top = d, m.height = u, m.bottom = m.top + u, d = m.bottom, n && (p = { top: d, height: h * C, bottom: d + h * C }, d = p.bottom), r && (x = { top: d, height: h * $, bottom: d + h * $ }), { width: e, height: t, plotLeft: 0, plotRight: i, plotTop: c, plotBottom: l, plotWidth: a, plotHeight: h, main: m, rsi: p, volume: x };
|
|
3586
3645
|
}
|
|
3587
|
-
function
|
|
3646
|
+
function ul(e, t) {
|
|
3588
3647
|
if (t === 0) return { from: 0, to: 0 };
|
|
3589
3648
|
let { from: n, to: r } = e;
|
|
3590
3649
|
if (r >= t) {
|
|
@@ -3593,13 +3652,13 @@ function sl(e, t) {
|
|
|
3593
3652
|
}
|
|
3594
3653
|
return n < 0 && (n = 0), r < n && (r = n), { from: n, to: r };
|
|
3595
3654
|
}
|
|
3596
|
-
function
|
|
3655
|
+
function hl(e, t) {
|
|
3597
3656
|
if (e.type === "sma")
|
|
3598
|
-
return { kind: "line", values:
|
|
3657
|
+
return { kind: "line", values: Ki(t, e.period), color: e.color ?? "var(--crk-chart-2)" };
|
|
3599
3658
|
if (e.type === "ema")
|
|
3600
|
-
return { kind: "line", values:
|
|
3659
|
+
return { kind: "line", values: Qi(t, e.period), color: e.color ?? "var(--crk-chart-3)" };
|
|
3601
3660
|
if (e.type === "bollinger") {
|
|
3602
|
-
const n =
|
|
3661
|
+
const n = Ji(t, e.period, e.stdDev ?? 2);
|
|
3603
3662
|
return {
|
|
3604
3663
|
kind: "bollinger",
|
|
3605
3664
|
middle: n.middle,
|
|
@@ -3611,17 +3670,17 @@ function al(e, t) {
|
|
|
3611
3670
|
}
|
|
3612
3671
|
return null;
|
|
3613
3672
|
}
|
|
3614
|
-
function
|
|
3673
|
+
function rn(e, t, n, r, o) {
|
|
3615
3674
|
let i = 1 / 0, c = -1 / 0;
|
|
3616
3675
|
for (const d of t)
|
|
3617
3676
|
d.low < i && (i = d.low), d.high > c && (c = d.high);
|
|
3618
3677
|
for (const d of n) {
|
|
3619
3678
|
const m = d.kind === "line" ? [d.values] : [d.upper, d.lower];
|
|
3620
3679
|
for (const p of m) {
|
|
3621
|
-
const
|
|
3622
|
-
for (let
|
|
3623
|
-
const
|
|
3624
|
-
|
|
3680
|
+
const x = Math.max(0, Math.floor(r)), C = Math.min(p.length - 1, Math.ceil(o));
|
|
3681
|
+
for (let $ = x; $ <= C; $++) {
|
|
3682
|
+
const b = p[$];
|
|
3683
|
+
b != null && (b < i && (i = b), b > c && (c = b));
|
|
3625
3684
|
}
|
|
3626
3685
|
}
|
|
3627
3686
|
}
|
|
@@ -3629,7 +3688,7 @@ function nn(e, t, n, r, o) {
|
|
|
3629
3688
|
const l = (c - i) * 0.08 || 1, a = qe(i - l, c + l, 5), h = Math.min(a[0], i), u = Math.max(a[a.length - 1], c);
|
|
3630
3689
|
return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: h, priceMax: u, ticks: a };
|
|
3631
3690
|
}
|
|
3632
|
-
function
|
|
3691
|
+
function ml(e, t, n, r) {
|
|
3633
3692
|
let o = 0;
|
|
3634
3693
|
const i = Math.max(0, Math.floor(n)), c = Math.min(t.length - 1, Math.ceil(r));
|
|
3635
3694
|
for (let h = i; h <= c; h++) {
|
|
@@ -3643,7 +3702,7 @@ function we(e, t) {
|
|
|
3643
3702
|
const n = (e - t.priceMin) / (t.priceMax - t.priceMin || 1);
|
|
3644
3703
|
return t.paneBottom - n * t.paneHeight;
|
|
3645
3704
|
}
|
|
3646
|
-
function
|
|
3705
|
+
function on(e) {
|
|
3647
3706
|
if (!e || typeof getComputedStyle > "u") return (o) => o;
|
|
3648
3707
|
const t = getComputedStyle(e), n = /* @__PURE__ */ new Map(), r = (o) => {
|
|
3649
3708
|
if (!o || !o.includes("var(")) return o;
|
|
@@ -3660,8 +3719,8 @@ function rn(e) {
|
|
|
3660
3719
|
};
|
|
3661
3720
|
return r;
|
|
3662
3721
|
}
|
|
3663
|
-
function
|
|
3664
|
-
const n =
|
|
3722
|
+
function fl(e, t) {
|
|
3723
|
+
const n = on(e);
|
|
3665
3724
|
return {
|
|
3666
3725
|
up: n(t.up),
|
|
3667
3726
|
down: n(t.down),
|
|
@@ -3673,7 +3732,7 @@ function ul(e, t) {
|
|
|
3673
3732
|
bg: n("var(--crk-color-bg)") || "#ffffff"
|
|
3674
3733
|
};
|
|
3675
3734
|
}
|
|
3676
|
-
function
|
|
3735
|
+
function pl(e, t, n, r) {
|
|
3677
3736
|
e.fillStyle = r.textMuted, e.font = "13px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading…", t / 2, n / 2);
|
|
3678
3737
|
}
|
|
3679
3738
|
function Lt(e, t, n, r, o, i = !1) {
|
|
@@ -3684,33 +3743,33 @@ function Lt(e, t, n, r, o, i = !1) {
|
|
|
3684
3743
|
}
|
|
3685
3744
|
e.stroke();
|
|
3686
3745
|
}
|
|
3687
|
-
function
|
|
3746
|
+
function gl(e, t, n, r, o) {
|
|
3688
3747
|
e.fillStyle = o.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle";
|
|
3689
3748
|
for (const i of n.ticks) {
|
|
3690
3749
|
const c = we(i, n);
|
|
3691
3750
|
e.fillText(i.toFixed(r), t.plotRight + 6, c);
|
|
3692
3751
|
}
|
|
3693
3752
|
}
|
|
3694
|
-
function
|
|
3753
|
+
function yl(e, t, n, r, o, i, c, l) {
|
|
3695
3754
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, i * 0.7);
|
|
3696
3755
|
for (let d = a; d <= h; d++) {
|
|
3697
|
-
const m = t[d], p = o(d),
|
|
3698
|
-
e.strokeStyle =
|
|
3699
|
-
const
|
|
3700
|
-
e.moveTo(
|
|
3701
|
-
const
|
|
3702
|
-
e.fillRect(Math.round(p - u / 2), Math.round(
|
|
3756
|
+
const m = t[d], p = o(d), x = we(m.open, c), C = we(m.close, c), $ = we(m.high, c), b = we(m.low, c), X = m.close >= m.open ? l.up : l.down;
|
|
3757
|
+
e.strokeStyle = X, e.fillStyle = X, e.beginPath();
|
|
3758
|
+
const Y = Math.round(p) + 0.5;
|
|
3759
|
+
e.moveTo(Y, $), e.lineTo(Y, b), e.stroke();
|
|
3760
|
+
const Q = Math.min(x, C), D = Math.max(1, Math.abs(C - x));
|
|
3761
|
+
e.fillRect(Math.round(p - u / 2), Math.round(Q), Math.round(u), Math.round(D));
|
|
3703
3762
|
}
|
|
3704
3763
|
}
|
|
3705
|
-
function
|
|
3764
|
+
function vl(e, t, n, r, o, i, c, l) {
|
|
3706
3765
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(2, Math.min(i * 0.4, 8));
|
|
3707
3766
|
e.lineWidth = Math.max(1, Math.min(2, i * 0.18)), e.lineCap = "butt";
|
|
3708
3767
|
for (let d = a; d <= h; d++) {
|
|
3709
|
-
const m = t[d], p = Math.round(o(d)) + 0.5,
|
|
3710
|
-
e.strokeStyle =
|
|
3768
|
+
const m = t[d], p = Math.round(o(d)) + 0.5, x = we(m.high, c), C = we(m.low, c), $ = we(m.open, c), b = we(m.close, c), W = m.close >= m.open;
|
|
3769
|
+
e.strokeStyle = W ? l.up : l.down, e.beginPath(), e.moveTo(p, x), e.lineTo(p, C), e.moveTo(p - u, $), e.lineTo(p, $), e.moveTo(p, b), e.lineTo(p + u, b), e.stroke();
|
|
3711
3770
|
}
|
|
3712
3771
|
}
|
|
3713
|
-
function
|
|
3772
|
+
function bl(e, t, n, r, o, i, c, l) {
|
|
3714
3773
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
|
|
3715
3774
|
if (!(h <= a)) {
|
|
3716
3775
|
e.strokeStyle = c, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), we(t[a].close, i));
|
|
@@ -3719,7 +3778,7 @@ function gl(e, t, n, r, o, i, c, l) {
|
|
|
3719
3778
|
e.stroke(), l && (e.globalAlpha = 0.18, e.fillStyle = c, e.lineTo(o(h), i.paneBottom), e.lineTo(o(a), i.paneBottom), e.closePath(), e.fill(), e.globalAlpha = 1);
|
|
3720
3779
|
}
|
|
3721
3780
|
}
|
|
3722
|
-
function
|
|
3781
|
+
function xl(e, t, n, r, o, i, c, l) {
|
|
3723
3782
|
if (t.kind === "line") {
|
|
3724
3783
|
Qe(e, t.values, o, i, c, l, t.color);
|
|
3725
3784
|
return;
|
|
@@ -3730,8 +3789,8 @@ function yl(e, t, n, r, o, i, c, l) {
|
|
|
3730
3789
|
for (let d = a; d <= h; d++) {
|
|
3731
3790
|
const m = t.upper[d];
|
|
3732
3791
|
if (m == null) continue;
|
|
3733
|
-
const p = c(d),
|
|
3734
|
-
u ? e.lineTo(p,
|
|
3792
|
+
const p = c(d), x = we(m, l);
|
|
3793
|
+
u ? e.lineTo(p, x) : (e.moveTo(p, x), u = !0);
|
|
3735
3794
|
}
|
|
3736
3795
|
for (let d = h; d >= a; d--) {
|
|
3737
3796
|
const m = t.lower[d];
|
|
@@ -3754,19 +3813,19 @@ function Qe(e, t, n, r, o, i, c) {
|
|
|
3754
3813
|
}
|
|
3755
3814
|
e.stroke();
|
|
3756
3815
|
}
|
|
3757
|
-
function
|
|
3816
|
+
function kl(e, t, n, r, o, i, c, l) {
|
|
3758
3817
|
const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, i * 0.7);
|
|
3759
3818
|
for (let d = a; d <= h; d++) {
|
|
3760
3819
|
const m = t[d], p = m.volume ?? 0;
|
|
3761
3820
|
if (p === 0) continue;
|
|
3762
|
-
const
|
|
3763
|
-
e.fillStyle =
|
|
3764
|
-
const
|
|
3765
|
-
e.fillRect(Math.round(o(d) - u / 2), Math.round(
|
|
3821
|
+
const x = m.close >= m.open;
|
|
3822
|
+
e.fillStyle = x ? l.up : l.down, e.globalAlpha = 0.55;
|
|
3823
|
+
const C = we(p, c), $ = c.paneBottom - C;
|
|
3824
|
+
e.fillRect(Math.round(o(d) - u / 2), Math.round(C), Math.round(u), Math.round($));
|
|
3766
3825
|
}
|
|
3767
3826
|
e.globalAlpha = 1;
|
|
3768
3827
|
}
|
|
3769
|
-
function
|
|
3828
|
+
function Ml(e, t, n, r, o, i) {
|
|
3770
3829
|
e.strokeStyle = i.grid, e.setLineDash([3, 3]), e.beginPath();
|
|
3771
3830
|
for (const c of [r, o]) {
|
|
3772
3831
|
const l = Math.round(we(c, n)) + 0.5;
|
|
@@ -3777,45 +3836,45 @@ function bl(e, t, n, r, o, i) {
|
|
|
3777
3836
|
function Ot(e, t, n, r, o) {
|
|
3778
3837
|
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);
|
|
3779
3838
|
}
|
|
3780
|
-
function
|
|
3839
|
+
function wl(e, t, n, r, o, i, c) {
|
|
3781
3840
|
const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
|
|
3782
3841
|
e.fillStyle = c.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
|
|
3783
3842
|
const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), m = t.plotBottom + Ct / 2;
|
|
3784
3843
|
for (let p = u; p <= d; p += h) {
|
|
3785
|
-
const
|
|
3786
|
-
e.fillText(
|
|
3844
|
+
const x = n[p], C = t.plotLeft + (p - r + 0.5) * a;
|
|
3845
|
+
e.fillText(Ll(x.time, i), C, m);
|
|
3787
3846
|
}
|
|
3788
3847
|
}
|
|
3789
|
-
function
|
|
3848
|
+
function $l(e, t, n, r, o, i, c, l, a, h, u) {
|
|
3790
3849
|
if (n.x < t.plotLeft || n.x > t.plotRight) return;
|
|
3791
|
-
const d = i - o + 1, m = t.plotWidth / d, p = o + (n.x - t.plotLeft) / m - 0.5,
|
|
3792
|
-
if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(
|
|
3793
|
-
const
|
|
3794
|
-
e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Rt, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(
|
|
3850
|
+
const d = i - o + 1, m = t.plotWidth / d, p = o + (n.x - t.plotLeft) / m - 0.5, x = Math.round(p), C = Math.max(0, Math.min(r.length - 1, x)), $ = c(C);
|
|
3851
|
+
if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo($ + 0.5, t.plotTop), e.lineTo($ + 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) {
|
|
3852
|
+
const b = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
|
|
3853
|
+
e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Rt, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(b.toFixed(l), t.plotRight + 6, n.y);
|
|
3795
3854
|
}
|
|
3796
|
-
if (r[
|
|
3797
|
-
const
|
|
3855
|
+
if (r[C]) {
|
|
3856
|
+
const b = cn(r[C].time, h);
|
|
3798
3857
|
e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
|
|
3799
|
-
const
|
|
3858
|
+
const Y = e.measureText(b).width + 8 * 2, Q = Ct, D = Math.max(
|
|
3800
3859
|
t.plotLeft,
|
|
3801
|
-
Math.min(t.plotRight -
|
|
3802
|
-
),
|
|
3803
|
-
e.fillStyle = u.text, e.fillRect(
|
|
3860
|
+
Math.min(t.plotRight - Y, $ - Y / 2)
|
|
3861
|
+
), S = t.plotBottom;
|
|
3862
|
+
e.fillStyle = u.text, e.fillRect(D, S, Y, Q), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(b, D + Y / 2, S + Q / 2);
|
|
3804
3863
|
}
|
|
3805
3864
|
e.restore();
|
|
3806
3865
|
}
|
|
3807
|
-
function
|
|
3808
|
-
const l = n.slice(Math.max(0, Math.floor(r)), Math.min(n.length, Math.ceil(o) + 1)), a =
|
|
3866
|
+
function Nl(e, t, n, r, o, i, c) {
|
|
3867
|
+
const l = n.slice(Math.max(0, Math.floor(r)), Math.min(n.length, Math.ceil(o) + 1)), a = rn(t.main, l, [], r, o);
|
|
3809
3868
|
return e < a.paneTop || e > a.paneBottom ? null : a.priceMax - (e - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
|
|
3810
3869
|
}
|
|
3811
|
-
function
|
|
3870
|
+
function Ll(e, t) {
|
|
3812
3871
|
const n = new Date(e * 1e3);
|
|
3813
3872
|
return t === "D" || t === "W" || t === "M" ? `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())}` : `${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}`;
|
|
3814
3873
|
}
|
|
3815
|
-
function
|
|
3874
|
+
function cn(e, t) {
|
|
3816
3875
|
const n = new Date(e * 1e3);
|
|
3817
3876
|
if (t === "local")
|
|
3818
|
-
return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${
|
|
3877
|
+
return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${Sl(n)}`;
|
|
3819
3878
|
if (t === "utc")
|
|
3820
3879
|
return `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())} ${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}:${Te(n.getUTCSeconds())} UTC`;
|
|
3821
3880
|
try {
|
|
@@ -3833,10 +3892,10 @@ function on(e, t) {
|
|
|
3833
3892
|
}).formatToParts(n), i = (l) => o.find((a) => a.type === l)?.value ?? "", c = i("timeZoneName") || t;
|
|
3834
3893
|
return `${i("year")}-${i("month")}-${i("day")} ${i("hour")}:${i("minute")}:${i("second")} ${c}`;
|
|
3835
3894
|
} catch {
|
|
3836
|
-
return
|
|
3895
|
+
return cn(e, "utc");
|
|
3837
3896
|
}
|
|
3838
3897
|
}
|
|
3839
|
-
function
|
|
3898
|
+
function Sl(e) {
|
|
3840
3899
|
const t = -e.getTimezoneOffset(), n = t >= 0 ? "+" : "-", r = Math.abs(t);
|
|
3841
3900
|
return `${n}${Te(Math.floor(r / 60))}:${Te(r % 60)}`;
|
|
3842
3901
|
}
|
|
@@ -3859,7 +3918,7 @@ function Ft(e) {
|
|
|
3859
3918
|
}
|
|
3860
3919
|
return 60;
|
|
3861
3920
|
}
|
|
3862
|
-
function
|
|
3921
|
+
function Tl(e, t) {
|
|
3863
3922
|
if (e.length === 0) return "";
|
|
3864
3923
|
if (e.length === 1 || t === "linear")
|
|
3865
3924
|
return e.map((r, o) => `${o === 0 ? "M" : "L"} ${r.x} ${r.y}`).join(" ");
|
|
@@ -3870,7 +3929,7 @@ function Nl(e, t) {
|
|
|
3870
3929
|
}
|
|
3871
3930
|
return n;
|
|
3872
3931
|
}
|
|
3873
|
-
const
|
|
3932
|
+
const Rl = $e(
|
|
3874
3933
|
({
|
|
3875
3934
|
data: e,
|
|
3876
3935
|
width: t = 80,
|
|
@@ -3884,16 +3943,16 @@ const Ll = $e(
|
|
|
3884
3943
|
className: h,
|
|
3885
3944
|
style: u
|
|
3886
3945
|
}, d) => {
|
|
3887
|
-
const { line: m, area: p, last:
|
|
3946
|
+
const { line: m, area: p, last: x } = ke(() => {
|
|
3888
3947
|
if (e.length === 0) return { line: "", area: "", last: null };
|
|
3889
|
-
const
|
|
3890
|
-
return { line:
|
|
3948
|
+
const C = o, $ = Math.max(1, t - C * 2), b = Math.max(1, n - C * 2), [W, X] = bt(e), Y = Je([0, Math.max(1, e.length - 1)], [C, C + $]), Q = Je([W, X], [C + b, C]), D = e.map((re, M) => ({ x: Y(M), y: Q(re) })), S = Tl(D, i), ee = c ? `${S} L ${D[D.length - 1].x} ${C + b} L ${D[0].x} ${C + b} Z` : "";
|
|
3949
|
+
return { line: S, area: ee, last: D[D.length - 1] };
|
|
3891
3950
|
}, [e, t, n, o, i, c]);
|
|
3892
|
-
return /* @__PURE__ */
|
|
3951
|
+
return /* @__PURE__ */ F(
|
|
3893
3952
|
"svg",
|
|
3894
3953
|
{
|
|
3895
3954
|
ref: d,
|
|
3896
|
-
className: f(
|
|
3955
|
+
className: f(k.sparkline, h),
|
|
3897
3956
|
style: u,
|
|
3898
3957
|
width: t,
|
|
3899
3958
|
height: n,
|
|
@@ -3913,51 +3972,51 @@ const Ll = $e(
|
|
|
3913
3972
|
strokeLinecap: "round"
|
|
3914
3973
|
}
|
|
3915
3974
|
),
|
|
3916
|
-
l &&
|
|
3975
|
+
l && x && /* @__PURE__ */ s("circle", { cx: x.x, cy: x.y, r: o + 1, fill: r })
|
|
3917
3976
|
]
|
|
3918
3977
|
}
|
|
3919
3978
|
);
|
|
3920
3979
|
}
|
|
3921
3980
|
);
|
|
3922
|
-
|
|
3981
|
+
Rl.displayName = "Sparkline";
|
|
3923
3982
|
export {
|
|
3924
|
-
|
|
3925
|
-
|
|
3983
|
+
Ol as AreaChart,
|
|
3984
|
+
Fl as BarChart,
|
|
3926
3985
|
Ut as Button,
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3986
|
+
Fc as Checkbox,
|
|
3987
|
+
zt as Dropdown,
|
|
3988
|
+
uo as DropdownItem,
|
|
3989
|
+
El as Form,
|
|
3990
|
+
Pl as FormField,
|
|
3991
|
+
Wl as FormRow,
|
|
3992
|
+
nc as Input,
|
|
3993
|
+
Hl as LineChart,
|
|
3994
|
+
jn as Link,
|
|
3995
|
+
br as List,
|
|
3996
|
+
xr as ListItem,
|
|
3938
3997
|
yt as Modal,
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3998
|
+
jl as PieChart,
|
|
3999
|
+
Yt as Popover,
|
|
4000
|
+
Xl as RadarChart,
|
|
4001
|
+
Yc as Radio,
|
|
4002
|
+
zc as RadioGroup,
|
|
4003
|
+
Ec as Select,
|
|
4004
|
+
Rl as Sparkline,
|
|
4005
|
+
Il as Table,
|
|
4006
|
+
oi as Textarea,
|
|
4007
|
+
Yl as TradingChart,
|
|
4008
|
+
dr as Typography,
|
|
4009
|
+
Ji as bollinger,
|
|
4010
|
+
Qi as ema,
|
|
4011
|
+
cn as formatCrosshairTime,
|
|
4012
|
+
nn as periodToSeconds,
|
|
4013
|
+
el as rsi,
|
|
4014
|
+
Ki as sma,
|
|
4015
|
+
zl as suggestPeriodForResolution,
|
|
4016
|
+
Ul as suggestResolutionForPeriod,
|
|
3958
4017
|
pt as useClickOutside,
|
|
3959
|
-
|
|
4018
|
+
ko as useFocusTrap,
|
|
3960
4019
|
Tt as useKeyboard,
|
|
3961
|
-
|
|
3962
|
-
|
|
4020
|
+
zr as useTableSort,
|
|
4021
|
+
_l as volumeSeries
|
|
3963
4022
|
};
|