@ahmetilhn/hanui 5.3.0 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/charts.js CHANGED
@@ -1,56 +1,59 @@
1
1
  "use client";
2
- import { jsx as m, jsxs as V, Fragment as Ct } from "react/jsx-runtime";
3
- import { useId as pn, useState as At, useRef as Pt, useEffect as Kt, useCallback as nt, useLayoutEffect as fn, memo as ot, useMemo as L } from "react";
4
- import { useAnnounce as Mn, useHanui as xt } from "@ahmetilhn/hanui";
5
- const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLAe", $n = "hanui-axis__label-dHxpo", kn = "hanui-axis__grid-RVxXW", Nn = "hanui-axis__baseline-jhG2z", ct = {
6
- axis: wn,
7
- axis__label: $n,
8
- axis__grid: kn,
9
- axis__baseline: Nn
10
- }, yn = 6.4, ut = (t) => t.length * yn, xn = (t, o = 8) => {
2
+ import { jsx as u, jsxs as X, Fragment as Ft } from "react/jsx-runtime";
3
+ import { useId as yn, useState as Tt, useRef as Pt, useEffect as tn, useCallback as nt, useLayoutEffect as xn, memo as ot, useMemo as L } from "react";
4
+ import { useAnnounce as wn, useHanui as xt } from "@ahmetilhn/hanui";
5
+ const it = (t, o) => Object.assign(t, { displayName: o }), kn = "hanui-axis-AqLAe", Nn = "hanui-axis__label-dHxpo", vn = "hanui-axis__grid-RVxXW", An = "hanui-axis__baseline-jhG2z", rt = {
6
+ axis: kn,
7
+ axis__label: Nn,
8
+ axis__grid: vn,
9
+ axis__baseline: An
10
+ }, vt = (t, o, n) => {
11
+ const e = n(t);
12
+ return t.map((r, i) => ({ position: o(r), label: e[i] }));
13
+ }, gn = 6.4, mt = (t) => t.length * gn, bn = (t, o = 8) => {
11
14
  if (t.length < 2) return [...t];
12
- const n = Math.max(...t.map((h) => ut(h.label))), e = Math.abs(t[1].position - t[0].position), r = e <= 0 ? 1 : Math.max(1, Math.ceil((n + o) / e));
13
- return t.filter((h, d) => d % r === 0);
14
- }, Et = (t, o) => {
15
- const n = Math.max(1, Math.floor(o / yn));
15
+ const n = Math.max(...t.map((i) => mt(i.label))), e = Math.abs(t[1].position - t[0].position), r = e <= 0 ? 1 : Math.max(1, Math.ceil((n + o) / e));
16
+ return t.filter((i, d) => d % r === 0);
17
+ }, Gt = (t, o) => {
18
+ const n = Math.max(1, Math.floor(o / gn));
16
19
  return t.length <= n ? t : `${t.slice(0, Math.max(1, n - 1))}…`;
17
- }, pt = ({ area: t, ticks: o, side: n, hasGrid: e = !1 }) => /* @__PURE__ */ m("g", { className: ct.axis, "aria-hidden": !0, children: o.map(
18
- (r) => n === "bottom" ? /* @__PURE__ */ V("g", { children: [
19
- e && /* @__PURE__ */ m(
20
+ }, ft = ({ area: t, ticks: o, side: n, hasGrid: e = !1 }) => /* @__PURE__ */ u("g", { className: rt.axis, "aria-hidden": !0, children: o.map(
21
+ (r) => n === "bottom" ? /* @__PURE__ */ X("g", { children: [
22
+ e && /* @__PURE__ */ u(
20
23
  "line",
21
24
  {
22
- className: ct.axis__grid,
25
+ className: rt.axis__grid,
23
26
  x1: r.position,
24
27
  x2: r.position,
25
28
  y1: t.top,
26
29
  y2: t.bottom
27
30
  }
28
31
  ),
29
- /* @__PURE__ */ m(
32
+ /* @__PURE__ */ u(
30
33
  "text",
31
34
  {
32
- className: ct.axis__label,
35
+ className: rt.axis__label,
33
36
  x: r.position,
34
37
  y: t.bottom + 16,
35
38
  textAnchor: "middle",
36
39
  children: r.label
37
40
  }
38
41
  )
39
- ] }, `${r.position}-${r.label}`) : /* @__PURE__ */ V("g", { children: [
40
- e && /* @__PURE__ */ m(
42
+ ] }, `${r.position}-${r.label}`) : /* @__PURE__ */ X("g", { children: [
43
+ e && /* @__PURE__ */ u(
41
44
  "line",
42
45
  {
43
- className: ct.axis__grid,
46
+ className: rt.axis__grid,
44
47
  x1: t.left,
45
48
  x2: t.right,
46
49
  y1: r.position,
47
50
  y2: r.position
48
51
  }
49
52
  ),
50
- /* @__PURE__ */ m(
53
+ /* @__PURE__ */ u(
51
54
  "text",
52
55
  {
53
- className: ct.axis__label,
56
+ className: rt.axis__label,
54
57
  x: n === "left" ? t.left - 8 : t.right + 8,
55
58
  y: r.position,
56
59
  dy: "0.32em",
@@ -59,21 +62,21 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
59
62
  }
60
63
  )
61
64
  ] }, `${r.position}-${r.label}`)
62
- ) }), Xt = ({ area: t, ticks: o, side: n }) => /* @__PURE__ */ m("g", { className: ct.axis, "aria-hidden": !0, children: n === "bottom" ? /* @__PURE__ */ V(Ct, { children: [
63
- /* @__PURE__ */ m(
65
+ ) }), Yt = ({ area: t, ticks: o, side: n }) => /* @__PURE__ */ u("g", { className: rt.axis, "aria-hidden": !0, children: n === "bottom" ? /* @__PURE__ */ X(Ft, { children: [
66
+ /* @__PURE__ */ u(
64
67
  "line",
65
68
  {
66
- className: ct.axis__baseline,
69
+ className: rt.axis__baseline,
67
70
  x1: t.left,
68
71
  x2: t.right,
69
72
  y1: t.bottom,
70
73
  y2: t.bottom
71
74
  }
72
75
  ),
73
- xn(o).map((e) => /* @__PURE__ */ m(
76
+ bn(o).map((e) => /* @__PURE__ */ u(
74
77
  "text",
75
78
  {
76
- className: ct.axis__label,
79
+ className: rt.axis__label,
77
80
  x: e.position,
78
81
  y: t.bottom + 16,
79
82
  textAnchor: "middle",
@@ -81,119 +84,119 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
81
84
  },
82
85
  `${e.position}-${e.label}`
83
86
  ))
84
- ] }) : /* @__PURE__ */ V(Ct, { children: [
85
- /* @__PURE__ */ m(
87
+ ] }) : /* @__PURE__ */ X(Ft, { children: [
88
+ /* @__PURE__ */ u(
86
89
  "line",
87
90
  {
88
- className: ct.axis__baseline,
91
+ className: rt.axis__baseline,
89
92
  x1: t.left,
90
93
  x2: t.left,
91
94
  y1: t.top,
92
95
  y2: t.bottom
93
96
  }
94
97
  ),
95
- o.map((e) => /* @__PURE__ */ m(
98
+ o.map((e) => /* @__PURE__ */ u(
96
99
  "text",
97
100
  {
98
- className: ct.axis__label,
101
+ className: rt.axis__label,
99
102
  x: t.left - 8,
100
103
  y: e.position,
101
104
  dy: "0.32em",
102
105
  textAnchor: "end",
103
- children: Et(e.label, t.left - 12)
106
+ children: Gt(e.label, t.left - 12)
104
107
  },
105
108
  `${e.position}-${e.label}`
106
109
  ))
107
- ] }) }), j = (t) => Math.round(t * 100) / 100, vn = (t) => {
110
+ ] }) }), V = (t) => Math.round(t * 100) / 100, Tn = (t) => {
108
111
  const o = [];
109
112
  let n = [];
110
113
  for (const e of t)
111
114
  e === null || !Number.isFinite(e.x) || !Number.isFinite(e.y) ? (n.length > 0 && o.push(n), n = []) : n.push(e);
112
115
  return n.length > 0 && o.push(n), o;
113
- }, Gt = (t) => t.map((o, n) => `${n === 0 ? "M" : "L"}${j(o.x)},${j(o.y)}`).join(""), gn = (t) => {
116
+ }, qt = (t) => t.map((o, n) => `${n === 0 ? "M" : "L"}${V(o.x)},${V(o.y)}`).join(""), _n = (t) => {
114
117
  const o = t.length;
115
- if (o < 3) return Gt(t);
118
+ if (o < 3) return qt(t);
116
119
  const n = [], e = [];
117
- for (let h = 0; h < o - 1; h += 1) {
118
- const d = t[h + 1].x - t[h].x;
119
- e.push(d === 0 ? 0 : (t[h + 1].y - t[h].y) / d);
120
+ for (let i = 0; i < o - 1; i += 1) {
121
+ const d = t[i + 1].x - t[i].x;
122
+ e.push(d === 0 ? 0 : (t[i + 1].y - t[i].y) / d);
120
123
  }
121
124
  n.push(e[0]);
122
- for (let h = 1; h < o - 1; h += 1)
125
+ for (let i = 1; i < o - 1; i += 1)
123
126
  n.push(
124
- e[h - 1] * e[h] <= 0 ? 0 : (e[h - 1] + e[h]) / 2
127
+ e[i - 1] * e[i] <= 0 ? 0 : (e[i - 1] + e[i]) / 2
125
128
  );
126
129
  n.push(e[o - 2]);
127
- for (let h = 0; h < o - 1; h += 1) {
128
- if (e[h] === 0) {
129
- n[h] = 0, n[h + 1] = 0;
130
+ for (let i = 0; i < o - 1; i += 1) {
131
+ if (e[i] === 0) {
132
+ n[i] = 0, n[i + 1] = 0;
130
133
  continue;
131
134
  }
132
- const d = n[h] / e[h], u = n[h + 1] / e[h], k = d * d + u * u;
135
+ const d = n[i] / e[i], m = n[i + 1] / e[i], k = d * d + m * m;
133
136
  if (k > 9) {
134
- const I = 3 / Math.sqrt(k);
135
- n[h] = I * d * e[h], n[h + 1] = I * u * e[h];
137
+ const T = 3 / Math.sqrt(k);
138
+ n[i] = T * d * e[i], n[i + 1] = T * m * e[i];
136
139
  }
137
140
  }
138
- let r = `M${j(t[0].x)},${j(t[0].y)}`;
139
- for (let h = 0; h < o - 1; h += 1) {
140
- const d = t[h], u = t[h + 1], k = (u.x - d.x) / 3;
141
- r += `C${j(d.x + k)},${j(d.y + n[h] * k)} ${j(u.x - k)},${j(u.y - n[h + 1] * k)} ${j(u.x)},${j(u.y)}`;
141
+ let r = `M${V(t[0].x)},${V(t[0].y)}`;
142
+ for (let i = 0; i < o - 1; i += 1) {
143
+ const d = t[i], m = t[i + 1], k = (m.x - d.x) / 3;
144
+ r += `C${V(d.x + k)},${V(d.y + n[i] * k)} ${V(m.x - k)},${V(m.y - n[i + 1] * k)} ${V(m.x)},${V(m.y)}`;
142
145
  }
143
146
  return r;
144
- }, An = (t, o = "linear") => vn(t).map((n) => o === "monotone" ? gn(n) : Gt(n)).join(""), Tn = (t, o, n = "linear") => {
147
+ }, In = (t, o = "linear") => Tn(t).map((n) => o === "monotone" ? _n(n) : qt(n)).join(""), Cn = (t, o, n = "linear") => {
145
148
  const e = [];
146
- let r = [], h = [];
149
+ let r = [], i = [];
147
150
  const d = () => {
148
151
  if (r.length > 0) {
149
- const u = n === "monotone" ? gn : Gt, k = u([...h].reverse()).replace(/^M/, "L");
150
- e.push(`${u(r)}${k}Z`);
152
+ const m = n === "monotone" ? _n : qt, k = m([...i].reverse()).replace(/^M/, "L");
153
+ e.push(`${m(r)}${k}Z`);
151
154
  }
152
- r = [], h = [];
155
+ r = [], i = [];
153
156
  };
154
- return t.forEach((u, k) => {
155
- const I = o[k];
156
- u === null || I === null || I === void 0 ? d() : (r.push(u), h.push(I));
157
+ return t.forEach((m, k) => {
158
+ const T = o[k];
159
+ m === null || T === null || T === void 0 ? d() : (r.push(m), i.push(T));
157
160
  }), d(), e.join("");
158
161
  }, et = (t, o, n, e) => ({
159
162
  x: t + n * Math.sin(e),
160
163
  y: o - n * Math.cos(e)
161
- }), tn = (t, o, n, e, r, h) => {
162
- const d = h - r;
164
+ }), nn = (t, o, n, e, r, i) => {
165
+ const d = i - r;
163
166
  if (d <= 0 || n <= 0) return "";
164
167
  if (d >= Math.PI * 2 - 1e-6) {
165
- const b = (S, P) => `M${j(t)},${j(o - S)}A${S},${S} 0 1 ${P} ${j(t)},${j(o + S)}A${S},${S} 0 1 ${P} ${j(t)},${j(o - S)}Z`;
166
- return b(n, 1) + (e > 0 ? b(e, 0) : "");
168
+ const g = (R, z) => `M${V(t)},${V(o - R)}A${R},${R} 0 1 ${z} ${V(t)},${V(o + R)}A${R},${R} 0 1 ${z} ${V(t)},${V(o - R)}Z`;
169
+ return g(n, 1) + (e > 0 ? g(e, 0) : "");
167
170
  }
168
- const u = d > Math.PI ? 1 : 0, k = et(t, o, n, r), I = et(t, o, n, h);
171
+ const m = d > Math.PI ? 1 : 0, k = et(t, o, n, r), T = et(t, o, n, i);
169
172
  if (e <= 0)
170
- return `M${j(t)},${j(o)}L${j(k.x)},${j(k.y)}A${n},${n} 0 ${u} 1 ${j(I.x)},${j(I.y)}Z`;
171
- const A = et(t, o, e, h), C = et(t, o, e, r);
172
- return `M${j(k.x)},${j(k.y)}A${n},${n} 0 ${u} 1 ${j(I.x)},${j(I.y)}L${j(A.x)},${j(A.y)}A${e},${e} 0 ${u} 0 ${j(C.x)},${j(C.y)}Z`;
173
- }, nn = (t) => t.length === 0 ? "" : `${Gt(t)}Z`, ft = (t, o) => {
174
- const [n, e] = t, [r, h] = o, d = e - n, u = (k) => d === 0 ? (r + h) / 2 : r + (k - n) / d * (h - r);
175
- return u.domain = t, u.range = o, u.invert = (k) => h === r ? n : n + (k - r) / (h - r) * d, u;
173
+ return `M${V(t)},${V(o)}L${V(k.x)},${V(k.y)}A${n},${n} 0 ${m} 1 ${V(T.x)},${V(T.y)}Z`;
174
+ const A = et(t, o, e, i), I = et(t, o, e, r);
175
+ return `M${V(k.x)},${V(k.y)}A${n},${n} 0 ${m} 1 ${V(T.x)},${V(T.y)}L${V(A.x)},${V(A.y)}A${e},${e} 0 ${m} 0 ${V(I.x)},${V(I.y)}Z`;
176
+ }, en = (t) => t.length === 0 ? "" : `${qt(t)}Z`, pt = (t, o) => {
177
+ const [n, e] = t, [r, i] = o, d = e - n, m = (k) => d === 0 ? (r + i) / 2 : r + (k - n) / d * (i - r);
178
+ return m.domain = t, m.range = o, m.invert = (k) => i === r ? n : n + (k - r) / (i - r) * d, m;
176
179
  }, Dt = (t, o, { paddingInner: n = 0.2, paddingOuter: e = 0.1 } = {}) => {
177
- const [r, h] = o, d = t.length, u = d === 0 ? 0 : (h - r) / Math.max(1, d - n + e * 2), k = u * (1 - n), I = r + u * e, A = new Map(t.map((b, S) => [b, S])), C = (b) => {
178
- const S = A.get(b);
179
- return S === void 0 ? Number.NaN : I + S * u;
180
+ const [r, i] = o, d = t.length, m = d === 0 ? 0 : (i - r) / Math.max(1, d - n + e * 2), k = m * (1 - n), T = r + m * e, A = new Map(t.map((g, R) => [g, R])), I = (g) => {
181
+ const R = A.get(g);
182
+ return R === void 0 ? Number.NaN : T + R * m;
180
183
  };
181
- return C.domain = t, C.range = o, C.bandwidth = k, C.step = u, C.indexAt = (b) => d === 0 ? -1 : Math.min(
184
+ return I.domain = t, I.range = o, I.bandwidth = k, I.step = m, I.indexAt = (g) => d === 0 ? -1 : Math.min(
182
185
  d - 1,
183
186
  Math.max(
184
187
  0,
185
- Math.floor((b - r - u * e + (u - k) / 2) / u)
188
+ Math.floor((g - r - m * e + (m - k) / 2) / m)
186
189
  )
187
- ), C;
188
- }, Zt = (t, o, n) => {
190
+ ), I;
191
+ }, Ut = (t, o, n) => {
189
192
  const e = Math.abs(o - t);
190
193
  if (e === 0 || !Number.isFinite(e) || n <= 0) return 1;
191
- const r = e / n, h = 10 ** Math.floor(Math.log10(r)), d = r / h;
192
- return (d >= 7.5 ? 10 : d >= 3.5 ? 5 : d >= 1.5 ? 2 : 1) * h;
193
- }, Yt = (t, o) => {
194
+ const r = e / n, i = 10 ** Math.floor(Math.log10(r)), d = r / i;
195
+ return (d >= 7.5 ? 10 : d >= 3.5 ? 5 : d >= 1.5 ? 2 : 1) * i;
196
+ }, Zt = (t, o) => {
194
197
  const n = Math.max(0, -Math.floor(Math.log10(o)) + 1);
195
198
  return Number(t.toFixed(Math.min(n, 12)));
196
- }, vt = (t, o, n = 5) => {
199
+ }, At = (t, o, n = 5) => {
197
200
  if (!Number.isFinite(t) || !Number.isFinite(o)) return [0, 1];
198
201
  let e = Math.min(t, o), r = Math.max(t, o);
199
202
  if (e === r) {
@@ -201,16 +204,16 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
201
204
  const d = Math.abs(e) * 0.5;
202
205
  e = e > 0 ? 0 : e - d, r = r < 0 ? 0 : r + d;
203
206
  }
204
- const h = Zt(e, r, n);
205
- return [Yt(Math.floor(e / h) * h, h), Yt(Math.ceil(r / h) * h, h)];
206
- }, rt = (t, o, n = 5) => {
207
+ const i = Ut(e, r, n);
208
+ return [Zt(Math.floor(e / i) * i, i), Zt(Math.ceil(r / i) * i, i)];
209
+ }, ct = (t, o, n = 5) => {
207
210
  if (!Number.isFinite(t) || !Number.isFinite(o)) return [];
208
211
  if (t === o) return [t];
209
- const e = Zt(t, o, n), r = Math.ceil(t / e - 1e-9), h = Math.floor(o / e + 1e-9), d = [];
210
- for (let u = r; u <= h && d.length < 1e3; u += 1)
211
- d.push(Yt(u * e, e));
212
+ const e = Ut(t, o, n), r = Math.ceil(t / e - 1e-9), i = Math.floor(o / e + 1e-9), d = [];
213
+ for (let m = r; m <= i && d.length < 1e3; m += 1)
214
+ d.push(Zt(m * e, e));
212
215
  return d;
213
- }, In = (t, o) => {
216
+ }, Fn = (t, o) => {
214
217
  if (t.length === 0) return -1;
215
218
  let n = 0, e = t.length - 1;
216
219
  for (; n < e; ) {
@@ -218,277 +221,278 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
218
221
  t[r] < o ? n = r + 1 : e = r;
219
222
  }
220
223
  return n > 0 && Math.abs(t[n - 1] - o) <= Math.abs(t[n] - o) ? n - 1 : n;
221
- }, qt = (t) => t.filter((o) => typeof o == "number" && Number.isFinite(o)), yt = (t) => {
224
+ }, Ot = (t) => t.filter((o) => typeof o == "number" && Number.isFinite(o)), yt = (t) => {
222
225
  if (t.length === 0) return [0, 0];
223
226
  let o = t[0], n = t[0];
224
227
  for (const e of t)
225
228
  e < o && (o = e), e > n && (n = e);
226
229
  return [o, n];
227
- }, Bt = (t, o) => {
230
+ }, Wt = (t, o) => {
228
231
  if (t.length === 0) return Number.NaN;
229
232
  if (t.length === 1) return t[0];
230
233
  const n = (t.length - 1) * Math.min(1, Math.max(0, o)), e = Math.floor(n), r = n - e;
231
234
  return e + 1 < t.length ? t[e] + (t[e + 1] - t[e]) * r : t[e];
232
- }, Cn = (t) => {
233
- const o = qt(t).sort((d, u) => d - u);
235
+ }, Rn = (t) => {
236
+ const o = Ot(t).sort((d, m) => d - m);
234
237
  if (o.length === 0) return null;
235
- const n = Bt(o, 0.25), e = Bt(o, 0.75), r = (e - n) * 1.5, h = o.filter((d) => d >= n - r && d <= e + r);
238
+ const n = Wt(o, 0.25), e = Wt(o, 0.75), r = (e - n) * 1.5, i = o.filter((d) => d >= n - r && d <= e + r);
236
239
  return {
237
240
  count: o.length,
238
241
  min: o[0],
239
242
  q1: n,
240
- median: Bt(o, 0.5),
243
+ median: Wt(o, 0.5),
241
244
  q3: e,
242
245
  max: o[o.length - 1],
243
- whiskerLow: h[0] ?? n,
244
- whiskerHigh: h[h.length - 1] ?? e,
246
+ whiskerLow: i[0] ?? n,
247
+ whiskerHigh: i[i.length - 1] ?? e,
245
248
  outliers: o.filter((d) => d < n - r || d > e + r)
246
249
  };
247
- }, Rn = (t, o) => {
248
- const n = qt(t);
250
+ }, Sn = (t, o) => {
251
+ const n = Ot(t);
249
252
  if (n.length === 0) return [];
250
253
  const [e, r] = yt(n);
251
254
  if (e === r) return [{ from: e, to: e + 1, count: n.length }];
252
- const h = o ?? Math.ceil(Math.log2(n.length)) + 1, d = Zt(e, r, Math.max(1, h)), u = Math.floor(e / d) * d, k = Math.max(1, Math.ceil((r - u) / d - 1e-9)), I = Array.from({ length: k }, (A, C) => ({
253
- from: u + C * d,
254
- to: u + (C + 1) * d,
255
+ const i = o ?? Math.ceil(Math.log2(n.length)) + 1, d = Ut(e, r, Math.max(1, i)), m = Math.floor(e / d) * d, k = Math.max(1, Math.ceil((r - m) / d - 1e-9)), T = Array.from({ length: k }, (A, I) => ({
256
+ from: m + I * d,
257
+ to: m + (I + 1) * d,
255
258
  count: 0
256
259
  }));
257
260
  for (const A of n) {
258
- const C = Math.min(I.length - 1, Math.floor((A - u) / d));
259
- I[C].count += 1;
261
+ const I = Math.min(T.length - 1, Math.floor((A - m) / d));
262
+ T[I].count += 1;
260
263
  }
261
- return I;
262
- }, Nt = (t) => typeof t == "number" && Number.isFinite(t) ? t : null, it = { top: 12, right: 16, bottom: 28, minLeft: 32 }, Fn = (t, o) => {
264
+ return T;
265
+ }, Nt = (t) => typeof t == "number" && Number.isFinite(t) ? t : null, lt = { top: 12, right: 16, bottom: 28, minLeft: 32 }, Hn = (t, o) => {
263
266
  const n = t.map(() => 0), e = t.map(() => 0), r = {};
264
- for (const h of o)
265
- r[h] = t.map((d, u) => {
266
- const k = Nt(d[h]) ?? 0;
267
+ for (const i of o)
268
+ r[i] = t.map((d, m) => {
269
+ const k = Nt(d[i]) ?? 0;
267
270
  if (k >= 0) {
268
- const A = n[u];
269
- return n[u] += k, { base: A, top: n[u] };
271
+ const A = n[m];
272
+ return n[m] += k, { base: A, top: n[m] };
270
273
  }
271
- const I = e[u];
272
- return e[u] += k, { base: I, top: e[u] };
274
+ const T = e[m];
275
+ return e[m] += k, { base: T, top: e[m] };
273
276
  });
274
277
  return r;
275
- }, Sn = (t) => {
276
- const { rows: o, xKey: n, series: e, width: r, height: h, isStacked: d, curve: u, formatX: k } = t, I = e.some((v) => v.type === "bar"), C = (I && e.every((v) => v.type === "bar") ? t.orientation : "vertical") === "horizontal", b = o.map((v) => v[n]), S = !I && !C && b.length > 1 && b.every((v) => Nt(v) !== null), P = {};
278
+ }, Ln = (t) => {
279
+ const { rows: o, xKey: n, series: e, width: r, height: i, isStacked: d, curve: m, formatX: k } = t, T = e.some((v) => v.type === "bar"), I = (T && e.every((v) => v.type === "bar") ? t.orientation : "vertical") === "horizontal", g = o.map((v) => v[n]), R = !T && !I && g.length > 1 && g.every((v) => Nt(v) !== null), z = {};
277
280
  if (d)
278
281
  for (const v of ["left", "right"])
279
282
  for (const B of ["bar", "area"]) {
280
- const W = e.filter((Z) => (Z.axis ?? "left") === v && Z.type === B).map((Z) => Z.key);
281
- Object.assign(P, Fn(o, W));
283
+ const W = e.filter((Q) => (Q.axis ?? "left") === v && Q.type === B).map((Q) => Q.key);
284
+ Object.assign(z, Hn(o, W));
282
285
  }
283
- const H = (v, B) => {
284
- if (P[v]) return P[v][B];
286
+ const S = (v, B) => {
287
+ if (z[v]) return z[v][B];
285
288
  const W = Nt(o[B][v]);
286
289
  return W === null ? null : { base: 0, top: W };
287
290
  }, q = (v) => {
288
291
  const B = e.filter((dt) => (dt.axis ?? "left") === v);
289
292
  if (B.length === 0) return null;
290
- let W = Number.POSITIVE_INFINITY, Z = Number.NEGATIVE_INFINITY;
293
+ let W = Number.POSITIVE_INFINITY, Q = Number.NEGATIVE_INFINITY;
291
294
  for (const dt of B)
292
295
  for (let Mt = 0; Mt < o.length; Mt += 1) {
293
- const mt = H(dt.key, Mt);
294
- mt && (W = Math.min(W, mt.top, mt.base), Z = Math.max(Z, mt.top, mt.base));
296
+ const ut = S(dt.key, Mt);
297
+ ut && (W = Math.min(W, ut.top, ut.base), Q = Math.max(Q, ut.top, ut.base));
295
298
  }
296
- if (B.some((dt) => dt.type !== "line") && (W = Math.min(W, 0), Z = Math.max(Z, 0)), !Number.isFinite(W) || !Number.isFinite(Z)) return [0, 1];
297
- const [at, K] = v === "left" ? t.domain ?? [void 0, void 0] : [void 0, void 0], tt = vt(at ?? W, K ?? Z);
299
+ if (B.some((dt) => dt.type !== "line") && (W = Math.min(W, 0), Q = Math.max(Q, 0)), !Number.isFinite(W) || !Number.isFinite(Q)) return [0, 1];
300
+ const [at, K] = v === "left" ? t.domain ?? [void 0, void 0] : [void 0, void 0], tt = At(at ?? W, K ?? Q);
298
301
  return [at ?? tt[0], K ?? tt[1]];
299
- }, E = q("left") ?? [0, 1], N = q("right"), R = N !== null && !C, D = rt(E[0], E[1], 5).map(t.formatLeft), M = N ? rt(N[0], N[1], 5).map(t.formatRight) : [], $ = o.map((v) => k(v[n])), i = C ? Math.min(r * 0.4, Math.max(it.minLeft, ...$.map(ut)) + 12) : Math.max(it.minLeft, ...D.map(ut)) + 10, y = R ? Math.max(it.minLeft, ...M.map(ut)) + 10 : it.right, s = {
300
- left: i,
301
- top: it.top,
302
- right: Math.max(i + 1, r - y),
303
- bottom: Math.max(it.top + 1, h - it.bottom),
304
- width: Math.max(1, r - y - i),
305
- height: Math.max(1, h - it.bottom - it.top)
306
- }, l = C ? [s.top, s.bottom] : [s.left, s.right], c = C ? [s.left, s.right] : [s.bottom, s.top], a = ft(E, c), p = N ? ft(N, c) : a, _ = (v) => (v.axis ?? "left") === "right" && N ? p : a;
307
- let w, x = 0, f = null;
308
- if (S) {
309
- const v = b.map((B) => Nt(B));
310
- f = ft(yt(v), l), w = v.map(f);
302
+ }, D = q("left") ?? [0, 1], N = q("right"), C = N !== null && !I, P = t.formatLeft(ct(D[0], D[1], 5)), M = N ? t.formatRight(ct(N[0], N[1], 5)) : [], w = o.map((v) => k(v[n])), h = I ? Math.min(r * 0.4, Math.max(lt.minLeft, ...w.map(mt)) + 12) : Math.max(lt.minLeft, ...P.map(mt)) + 10, p = C ? Math.max(lt.minLeft, ...M.map(mt)) + 10 : lt.right, s = {
303
+ left: h,
304
+ top: lt.top,
305
+ right: Math.max(h + 1, r - p),
306
+ bottom: Math.max(lt.top + 1, i - lt.bottom),
307
+ width: Math.max(1, r - p - h),
308
+ height: Math.max(1, i - lt.bottom - lt.top)
309
+ }, l = I ? [s.top, s.bottom] : [s.left, s.right], c = I ? [s.left, s.right] : [s.bottom, s.top], a = pt(D, c), f = N ? pt(N, c) : a, b = (v) => (v.axis ?? "left") === "right" && N ? f : a;
310
+ let $, y = 0, _ = null;
311
+ if (R) {
312
+ const v = g.map((B) => Nt(B));
313
+ _ = pt(yt(v), l), $ = v.map(_);
311
314
  } else {
312
315
  const v = Dt(
313
316
  o.map((B, W) => String(W)),
314
317
  l,
315
- I ? { paddingInner: 0.24, paddingOuter: 0.12 } : { paddingInner: 0, paddingOuter: 0 }
318
+ T ? { paddingInner: 0.24, paddingOuter: 0.12 } : { paddingInner: 0, paddingOuter: 0 }
316
319
  );
317
- x = v.bandwidth, w = o.map((B, W) => v(String(W)) + v.bandwidth / 2);
320
+ y = v.bandwidth, $ = o.map((B, W) => v(String(W)) + v.bandwidth / 2);
318
321
  }
319
- const T = (v, B) => C ? { x: B, y: v } : { x: v, y: B }, O = [], X = e.filter((v) => v.type === "bar"), U = d ? 1 : Math.max(1, X.length), G = U > 1 ? Math.min(2, x * 0.04) : 0, g = Math.max(1, (x - G * (U - 1)) / U);
320
- X.forEach((v, B) => {
321
- const W = _(v), Z = d ? 0 : B;
322
+ const G = (v, B) => I ? { x: B, y: v } : { x: v, y: B }, H = [], j = e.filter((v) => v.type === "bar"), Y = d ? 1 : Math.max(1, j.length), O = Y > 1 ? Math.min(2, y * 0.04) : 0, x = Math.max(1, (y - O * (Y - 1)) / Y);
323
+ j.forEach((v, B) => {
324
+ const W = b(v), Q = d ? 0 : B;
322
325
  o.forEach((at, K) => {
323
- const tt = H(v.key, K);
326
+ const tt = S(v.key, K);
324
327
  if (!tt || tt.top === tt.base) return;
325
- const dt = w[K] - x / 2 + Z * (g + G), Mt = W(tt.base), mt = W(tt.top), Qt = Math.min(Mt, mt), Jt = Math.max(1, Math.abs(mt - Mt));
326
- O.push(
327
- C ? {
328
+ const dt = $[K] - y / 2 + Q * (x + O), Mt = W(tt.base), ut = W(tt.top), Jt = Math.min(Mt, ut), Kt = Math.max(1, Math.abs(ut - Mt));
329
+ H.push(
330
+ I ? {
328
331
  key: v.key,
329
332
  index: K,
330
333
  tone: v.tone,
331
- x: Qt,
334
+ x: Jt,
332
335
  y: dt,
333
- width: Jt,
334
- height: g
336
+ width: Kt,
337
+ height: x
335
338
  } : {
336
339
  key: v.key,
337
340
  index: K,
338
341
  tone: v.tone,
339
342
  x: dt,
340
- y: Qt,
341
- width: g,
342
- height: Jt
343
+ y: Jt,
344
+ width: x,
345
+ height: Kt
343
346
  }
344
347
  );
345
348
  });
346
349
  });
347
- const F = {}, z = [], Y = [];
350
+ const F = {}, E = [], Z = [];
348
351
  for (const v of e) {
349
352
  if (v.type === "bar") continue;
350
- const B = _(v), W = o.map((Z, at) => {
351
- const K = H(v.key, at);
352
- return K ? T(w[at], B(K.top)) : null;
353
+ const B = b(v), W = o.map((Q, at) => {
354
+ const K = S(v.key, at);
355
+ return K ? G($[at], B(K.top)) : null;
353
356
  });
354
357
  if (F[v.key] = W, v.type === "area") {
355
- const Z = o.map((at, K) => {
356
- const tt = H(v.key, K);
357
- return tt ? T(w[K], B(tt.base)) : null;
358
+ const Q = o.map((at, K) => {
359
+ const tt = S(v.key, K);
360
+ return tt ? G($[K], B(tt.base)) : null;
358
361
  });
359
- Y.push({ key: v.key, tone: v.tone, d: Tn(W, Z, u) });
362
+ Z.push({ key: v.key, tone: v.tone, d: Cn(W, Q, m) });
360
363
  }
361
- z.push({ key: v.key, tone: v.tone, d: An(W, u) });
364
+ E.push({ key: v.key, tone: v.tone, d: In(W, m) });
362
365
  }
363
366
  const ht = o.map((v, B) => {
364
367
  let W = null;
365
368
  for (const at of e) {
366
- const K = H(at.key, B);
369
+ const K = S(at.key, B);
367
370
  if (!K) continue;
368
- const tt = _(at)(K.top);
369
- W = W === null ? tt : C ? Math.max(W, tt) : Math.min(W, tt);
371
+ const tt = b(at)(K.top);
372
+ W = W === null ? tt : I ? Math.max(W, tt) : Math.min(W, tt);
370
373
  }
371
- const Z = C ? s.left : s.bottom;
372
- return T(w[B], W ?? Z);
373
- }), Tt = (v, B, W) => rt(
374
- B[0],
375
- B[1],
376
- C ? Math.max(2, Math.floor(s.width / 90)) : Math.max(2, Math.floor(s.height / 48))
377
- ).map((Z) => ({
378
- position: v(Z),
379
- label: W(Z)
380
- })), _n = f ? rt(f.domain[0], f.domain[1], Math.max(2, Math.floor(s.width / 90))).map(
374
+ const Q = I ? s.left : s.bottom;
375
+ return G($[B], W ?? Q);
376
+ }), It = (v, B, W) => vt(
377
+ ct(
378
+ B[0],
379
+ B[1],
380
+ I ? Math.max(2, Math.floor(s.width / 90)) : Math.max(2, Math.floor(s.height / 48))
381
+ ),
382
+ v,
383
+ W
384
+ ), $n = _ ? ct(_.domain[0], _.domain[1], Math.max(2, Math.floor(s.width / 90))).map(
381
385
  (v) => ({
382
- position: f(v),
386
+ position: _(v),
383
387
  label: k(v)
384
388
  })
385
389
  ) : o.map((v, B) => ({
386
- position: w[B],
387
- label: C ? Et($[B], i - 12) : $[B]
390
+ position: $[B],
391
+ label: I ? Gt(w[B], h - 12) : w[B]
388
392
  }));
389
393
  return {
390
- zero: E[0] < 0 && E[1] > 0 ? a(0) : null,
394
+ zero: D[0] < 0 && D[1] > 0 ? a(0) : null,
391
395
  area: s,
392
- centers: w,
393
- bandwidth: x,
394
- isContinuous: S,
395
- categoryTicks: _n,
396
- leftTicks: Tt(a, E, t.formatLeft),
397
- rightTicks: R && N ? Tt(p, N, t.formatRight) : [],
398
- hasRightAxis: R,
399
- lines: z,
400
- areas: Y,
401
- bars: O,
396
+ centers: $,
397
+ bandwidth: y,
398
+ isContinuous: R,
399
+ categoryTicks: $n,
400
+ leftTicks: It(a, D, t.formatLeft),
401
+ rightTicks: C && N ? It(f, N, t.formatRight) : [],
402
+ hasRightAxis: C,
403
+ lines: E,
404
+ areas: Z,
405
+ bars: H,
402
406
  points: F,
403
407
  anchors: ht
404
408
  };
405
- }, en = (...t) => {
409
+ }, on = (...t) => {
406
410
  let o = "";
407
411
  for (const n of t)
408
412
  n && (o = o === "" ? n : `${o} ${n}`);
409
413
  return o;
410
- }, on = [
414
+ }, an = [
411
415
  "cat-1",
412
416
  "cat-2",
413
417
  "cat-3",
414
418
  "cat-4",
415
419
  "cat-5",
416
420
  "series-2"
417
- ], Ft = (t, o) => o ?? on[t % on.length], Q = (t) => t === "muted" ? "var(--hanui-text-3)" : `var(--hanui-${t})`, Hn = "hanui-chart-iR-5u", Ln = "hanui-chart__canvas-4wf8o", zn = "hanui-chart__svg-yC5iw", Pn = "hanui-chart__overlay-kbXEv", Dn = "hanui-chart__tooltip-wbhLY", En = "hanui-chart__tooltipTitle-j-1Nw", Gn = "hanui-chart__tooltipRow-phors", qn = "hanui-chart__tooltipLabel-72x80", On = "hanui-chart__tooltipValue-caeby", Bn = "hanui-chart__swatch--mk77", Wn = "hanui-chart__legend-EhXcQ", jn = "hanui-chart__legendItem--AaGe", Vn = "hanui-chart__srOnly-Oyem2", J = {
418
- chart: Hn,
419
- chart__canvas: Ln,
420
- chart__svg: zn,
421
- chart__overlay: Pn,
422
- chart__tooltip: Dn,
423
- chart__tooltipTitle: En,
424
- chart__tooltipRow: Gn,
425
- chart__tooltipLabel: qn,
426
- chart__tooltipValue: On,
427
- chart__swatch: Bn,
428
- chart__legend: Wn,
429
- chart__legendItem: jn,
421
+ ], St = (t, o) => o ?? an[t % an.length], U = (t) => t === "muted" ? "var(--hanui-text-3)" : `var(--hanui-${t})`, En = "hanui-chart-iR-5u", zn = "hanui-chart__canvas-4wf8o", Pn = "hanui-chart__svg-yC5iw", Dn = "hanui-chart__overlay-kbXEv", Gn = "hanui-chart__tooltip-wbhLY", qn = "hanui-chart__tooltipTitle-j-1Nw", On = "hanui-chart__tooltipRow-phors", Bn = "hanui-chart__tooltipLabel-72x80", Wn = "hanui-chart__tooltipValue-caeby", Vn = "hanui-chart__swatch--mk77", jn = "hanui-chart__legend-EhXcQ", Xn = "hanui-chart__legendItem--AaGe", Yn = "hanui-chart__srOnly-Oyem2", J = {
422
+ chart: En,
423
+ chart__canvas: zn,
424
+ chart__svg: Pn,
425
+ chart__overlay: Dn,
426
+ chart__tooltip: Gn,
427
+ chart__tooltipTitle: qn,
428
+ chart__tooltipRow: On,
429
+ chart__tooltipLabel: Bn,
430
+ chart__tooltipValue: Wn,
431
+ chart__swatch: Vn,
432
+ chart__legend: jn,
433
+ chart__legendItem: Xn,
430
434
  "chart__legendItem--hidden": "hanui-chart__legendItem--hidden-D3li8",
431
- chart__srOnly: Vn
432
- }, an = 12, gt = ({
435
+ chart__srOnly: Yn
436
+ }, sn = 12, gt = ({
433
437
  label: t,
434
438
  description: o,
435
439
  containerRef: n,
436
440
  width: e,
437
441
  height: r,
438
- plot: h,
442
+ plot: i,
439
443
  overlay: d,
440
- underlay: u,
444
+ underlay: m,
441
445
  itemCount: k,
442
- columns: I,
446
+ columns: T,
443
447
  pick: A,
444
- tooltip: C,
445
- anchor: b,
446
- tooltipSide: S = "inward",
447
- announce: P,
448
- table: H,
448
+ tooltip: I,
449
+ anchor: g,
450
+ tooltipSide: R = "inward",
451
+ announce: z,
452
+ table: S,
449
453
  legend: q,
450
- className: E,
454
+ className: D,
451
455
  testId: N
452
456
  }) => {
453
- const R = pn(), D = Mn(), [M, $] = At(null), i = Pt(null), y = Pt(null), s = Pt(null);
454
- Kt(() => {
455
- M !== null && M >= k && $(k > 0 ? k - 1 : null);
456
- }, [M, k]), Kt(
457
+ const C = yn(), P = wn(), [M, w] = Tt(null), h = Pt(null), p = Pt(null), s = Pt(null);
458
+ tn(() => {
459
+ M !== null && M >= k && w(k > 0 ? k - 1 : null);
460
+ }, [M, k]), tn(
457
461
  () => () => {
458
- i.current !== null && cancelAnimationFrame(i.current);
462
+ h.current !== null && cancelAnimationFrame(h.current);
459
463
  },
460
464
  []
461
465
  );
462
466
  const l = nt(
463
- (x) => {
464
- const f = x.currentTarget.getBoundingClientRect();
465
- s.current = { x: x.clientX - f.left, y: x.clientY - f.top }, i.current === null && (i.current = requestAnimationFrame(() => {
466
- i.current = null;
467
- const T = s.current;
468
- T && $(A(T.x, T.y));
467
+ (y) => {
468
+ const _ = y.currentTarget.getBoundingClientRect();
469
+ s.current = { x: y.clientX - _.left, y: y.clientY - _.top }, h.current === null && (h.current = requestAnimationFrame(() => {
470
+ h.current = null;
471
+ const G = s.current;
472
+ G && w(A(G.x, G.y));
469
473
  }));
470
474
  },
471
475
  [A]
472
- ), c = (x) => {
473
- const f = Math.min(k - 1, Math.max(0, x));
474
- $(f), D(P(f));
475
- }, a = (x) => {
476
+ ), c = (y) => {
477
+ const _ = Math.min(k - 1, Math.max(0, y));
478
+ w(_), P(z(_));
479
+ }, a = (y) => {
476
480
  if (k === 0) return;
477
- const f = M ?? -1, T = I ?? 1, O = x.key === "ArrowRight" ? f + 1 : x.key === "ArrowLeft" ? Math.max(0, f - 1) : x.key === "ArrowDown" ? f < 0 ? 0 : f + T : x.key === "ArrowUp" ? Math.max(0, f - T) : x.key === "Home" ? 0 : x.key === "End" ? k - 1 : null;
478
- if (x.key === "Escape" && M !== null) {
479
- x.preventDefault(), $(null);
481
+ const _ = M ?? -1, G = T ?? 1, H = y.key === "ArrowRight" ? _ + 1 : y.key === "ArrowLeft" ? Math.max(0, _ - 1) : y.key === "ArrowDown" ? _ < 0 ? 0 : _ + G : y.key === "ArrowUp" ? Math.max(0, _ - G) : y.key === "Home" ? 0 : y.key === "End" ? k - 1 : null;
482
+ if (y.key === "Escape" && M !== null) {
483
+ y.preventDefault(), w(null);
480
484
  return;
481
485
  }
482
- O !== null && (x.preventDefault(), c(O));
483
- }, p = M === null ? null : C(M), _ = M === null ? null : b(M), w = _ == null ? void 0 : _.x;
484
- return fn(() => {
485
- const x = y.current;
486
- if (!x || w === void 0) return;
487
- const f = x.offsetWidth, T = w > e / 2, O = S === "outward" ? !T : T, X = w - an - f, U = w + an, G = X >= 0, g = U + f <= e, F = S === "outward" ? O ? X : U : O ? G || !g ? X : U : g || !G ? U : X;
488
- x.style.left = `${Math.min(Math.max(0, F), Math.max(0, e - f))}px`;
489
- }, [M, w, e, S]), /* @__PURE__ */ V("figure", { className: en(J.chart, E), "data-testid": N, children: [
490
- /* @__PURE__ */ V("div", { ref: n, className: J.chart__canvas, style: { blockSize: r }, children: [
491
- /* @__PURE__ */ V(
486
+ H !== null && (y.preventDefault(), c(H));
487
+ }, f = M === null ? null : I(M), b = M === null ? null : g(M), $ = b == null ? void 0 : b.x;
488
+ return xn(() => {
489
+ const y = p.current;
490
+ if (!y || $ === void 0) return;
491
+ const _ = y.offsetWidth, G = $ > e / 2, H = R === "outward" ? !G : G, j = $ - sn - _, Y = $ + sn, O = j >= 0, x = Y + _ <= e, F = R === "outward" ? H ? j : Y : H ? O || !x ? j : Y : x || !O ? Y : j;
492
+ y.style.left = `${Math.min(Math.max(0, F), Math.max(0, e - _))}px`;
493
+ }, [M, $, e, R]), /* @__PURE__ */ X("figure", { className: on(J.chart, D), "data-testid": N, children: [
494
+ /* @__PURE__ */ X("div", { ref: n, className: J.chart__canvas, style: { blockSize: r }, children: [
495
+ /* @__PURE__ */ X(
492
496
  "svg",
493
497
  {
494
498
  className: J.chart__svg,
@@ -497,223 +501,247 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
497
501
  viewBox: `0 0 ${e} ${r}`,
498
502
  role: "img",
499
503
  "aria-label": t,
500
- "aria-describedby": o ? R : void 0,
504
+ "aria-describedby": o ? C : void 0,
501
505
  tabIndex: k > 0 ? 0 : void 0,
502
506
  onPointerMove: l,
503
507
  onPointerDown: l,
504
- onPointerLeave: () => $(null),
508
+ onPointerLeave: () => w(null),
505
509
  onKeyDown: a,
506
- onBlur: () => $(null),
510
+ onBlur: () => w(null),
507
511
  children: [
508
- M !== null && u && /* @__PURE__ */ m("g", { className: J.chart__overlay, children: u(M) }),
509
- h,
510
- M !== null && /* @__PURE__ */ m("g", { className: J.chart__overlay, children: d(M) })
512
+ M !== null && m && /* @__PURE__ */ u("g", { className: J.chart__overlay, children: m(M) }),
513
+ i,
514
+ M !== null && /* @__PURE__ */ u("g", { className: J.chart__overlay, children: d(M) })
511
515
  ]
512
516
  }
513
517
  ),
514
- p && _ && /* Okunan karşılığı duyuru ve tablo; ipucu yalnızca görsel. */
515
- /* @__PURE__ */ V(
518
+ f && b && /* Okunan karşılığı duyuru ve tablo; ipucu yalnızca görsel. */
519
+ /* @__PURE__ */ X(
516
520
  "div",
517
521
  {
518
- ref: y,
522
+ ref: p,
519
523
  "aria-hidden": !0,
520
524
  className: J.chart__tooltip,
521
- style: { insetBlockStart: Math.max(24, Math.min(_.y, r - 24)) },
525
+ style: { insetBlockStart: Math.max(24, Math.min(b.y, r - 24)) },
522
526
  children: [
523
- p.title && /* @__PURE__ */ m("span", { className: J.chart__tooltipTitle, children: p.title }),
524
- p.rows.map((x) => /* @__PURE__ */ V("span", { className: J.chart__tooltipRow, children: [
525
- x.tone && /* @__PURE__ */ m(
527
+ f.title && /* @__PURE__ */ u("span", { className: J.chart__tooltipTitle, children: f.title }),
528
+ f.rows.map((y) => /* @__PURE__ */ X("span", { className: J.chart__tooltipRow, children: [
529
+ y.tone && /* @__PURE__ */ u(
526
530
  "span",
527
531
  {
528
532
  className: J.chart__swatch,
529
- style: { backgroundColor: Q(x.tone) }
533
+ style: { backgroundColor: U(y.tone) }
530
534
  }
531
535
  ),
532
- /* @__PURE__ */ m("span", { className: J.chart__tooltipLabel, children: x.label }),
533
- /* @__PURE__ */ m("span", { className: J.chart__tooltipValue, children: x.value })
534
- ] }, x.id))
536
+ /* @__PURE__ */ u("span", { className: J.chart__tooltipLabel, children: y.label }),
537
+ /* @__PURE__ */ u("span", { className: J.chart__tooltipValue, children: y.value })
538
+ ] }, y.id))
535
539
  ]
536
540
  }
537
541
  )
538
542
  ] }),
539
- q && q.entries.length > 1 && /* @__PURE__ */ m("ul", { className: J.chart__legend, children: q.entries.map((x) => {
540
- const f = q.hidden.has(x.id);
541
- return /* @__PURE__ */ m("li", { children: /* @__PURE__ */ V(
543
+ q && q.entries.length > 1 && /* @__PURE__ */ u("ul", { className: J.chart__legend, children: q.entries.map((y) => {
544
+ const _ = q.hidden.has(y.id);
545
+ return /* @__PURE__ */ u("li", { children: /* @__PURE__ */ X(
542
546
  "button",
543
547
  {
544
548
  type: "button",
545
- className: en(
549
+ className: on(
546
550
  J.chart__legendItem,
547
- f && J["chart__legendItem--hidden"]
551
+ _ && J["chart__legendItem--hidden"]
548
552
  ),
549
- "aria-pressed": !f,
550
- onClick: () => q.onToggle(x.id),
553
+ "aria-pressed": !_,
554
+ onClick: () => q.onToggle(y.id),
551
555
  children: [
552
- /* @__PURE__ */ m(Xn, { tone: x.tone, isHidden: f }),
553
- x.label
556
+ /* @__PURE__ */ u(Zn, { tone: y.tone, isHidden: _ }),
557
+ y.label
554
558
  ]
555
559
  }
556
- ) }, x.id);
560
+ ) }, y.id);
557
561
  }) }),
558
- o && /* @__PURE__ */ m("p", { id: R, className: J.chart__srOnly, children: o }),
559
- /* @__PURE__ */ m("div", { className: J.chart__srOnly, children: /* @__PURE__ */ V("table", { children: [
560
- /* @__PURE__ */ m("caption", { children: t }),
561
- /* @__PURE__ */ m("thead", { children: /* @__PURE__ */ m("tr", { children: H.columns.map((x, f) => /* @__PURE__ */ m("th", { scope: "col", children: x }, f)) }) }),
562
- /* @__PURE__ */ m("tbody", { children: H.rows.map((x, f) => /* @__PURE__ */ m("tr", { children: x.map(
563
- (T, O) => O === 0 ? /* @__PURE__ */ m("th", { scope: "row", children: T }, O) : /* @__PURE__ */ m("td", { children: T }, O)
564
- ) }, f)) })
562
+ o && /* @__PURE__ */ u("p", { id: C, className: J.chart__srOnly, children: o }),
563
+ /* @__PURE__ */ u("div", { className: J.chart__srOnly, children: /* @__PURE__ */ X("table", { children: [
564
+ /* @__PURE__ */ u("caption", { children: t }),
565
+ /* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: S.columns.map((y, _) => /* @__PURE__ */ u("th", { scope: "col", children: y }, _)) }) }),
566
+ /* @__PURE__ */ u("tbody", { children: S.rows.map((y, _) => /* @__PURE__ */ u("tr", { children: y.map(
567
+ (G, H) => H === 0 ? /* @__PURE__ */ u("th", { scope: "row", children: G }, H) : /* @__PURE__ */ u("td", { children: G }, H)
568
+ ) }, _)) })
565
569
  ] }) })
566
570
  ] });
567
- }, Xn = ({ tone: t, isHidden: o }) => /* @__PURE__ */ m(
571
+ }, Zn = ({ tone: t, isHidden: o }) => /* @__PURE__ */ u(
568
572
  "span",
569
573
  {
570
574
  "aria-hidden": !0,
571
575
  className: J.chart__swatch,
572
- style: o ? { backgroundColor: "transparent", boxShadow: `inset 0 0 0 2px ${Q(t)}` } : { backgroundColor: Q(t) }
576
+ style: o ? { backgroundColor: "transparent", boxShadow: `inset 0 0 0 2px ${U(t)}` } : { backgroundColor: U(t) }
573
577
  }
574
- ), sn = /* @__PURE__ */ new Map(), bn = (t, o) => {
578
+ ), rn = /* @__PURE__ */ new Map(), Mn = (t, o) => {
575
579
  const n = `${t ?? ""}|${JSON.stringify(o)}`;
576
- let e = sn.get(n);
577
- return e || (e = new Intl.NumberFormat(t, o), sn.set(n, e)), e;
578
- }, St = (t) => (o) => bn(t, { notation: "compact", maximumFractionDigits: 1 }).format(o), bt = (t) => (o) => bn(t, { maximumFractionDigits: 2 }).format(o), Yn = 640, Zn = typeof window > "u" ? () => {
579
- } : fn, _t = (t) => {
580
- const o = Pt(null), [n, e] = At(t ?? Yn);
581
- return Zn(() => {
580
+ let e = rn.get(n);
581
+ return e || (e = new Intl.NumberFormat(t, o), rn.set(n, e)), e;
582
+ }, cn = (t) => {
583
+ if (t === 0 || !Number.isFinite(t)) return null;
584
+ const [o, n] = Math.abs(t).toExponential(9).split("e"), e = Number(n);
585
+ return { first: e, last: e - (o.replace(".", "").replace(/0+$/, "").length - 1) };
586
+ }, Ht = (t) => (o) => {
587
+ const n = o.reduce(
588
+ (e, r) => {
589
+ var i;
590
+ return Math.min(e, ((i = cn(r)) == null ? void 0 : i.last) ?? e);
591
+ },
592
+ Number.POSITIVE_INFINITY
593
+ );
594
+ return o.map(
595
+ (e) => {
596
+ var r;
597
+ return Mn(t, {
598
+ notation: "compact",
599
+ maximumSignificantDigits: Math.min(
600
+ 21,
601
+ Math.max(1, (((r = cn(e)) == null ? void 0 : r.first) ?? 0) - n + 1)
602
+ )
603
+ }).format(e);
604
+ }
605
+ );
606
+ }, bt = (t) => (o) => Mn(t, { maximumFractionDigits: 2 }).format(o), Un = 640, Qn = typeof window > "u" ? () => {
607
+ } : xn, _t = (t) => {
608
+ const o = Pt(null), [n, e] = Tt(t ?? Un);
609
+ return Qn(() => {
582
610
  if (t !== void 0) {
583
611
  e(t);
584
612
  return;
585
613
  }
586
614
  const r = o.current;
587
615
  if (!r) return;
588
- const h = (u) => {
589
- const k = Math.floor(u);
590
- k > 0 && e((I) => I === k ? I : k);
616
+ const i = (m) => {
617
+ const k = Math.floor(m);
618
+ k > 0 && e((T) => T === k ? T : k);
591
619
  };
592
- if (h(r.clientWidth), typeof ResizeObserver > "u") return;
593
- const d = new ResizeObserver(([u]) => h(u.contentRect.width));
620
+ if (i(r.clientWidth), typeof ResizeObserver > "u") return;
621
+ const d = new ResizeObserver(([m]) => i(m.contentRect.width));
594
622
  return d.observe(r), () => d.disconnect();
595
623
  }, [t]), [o, n];
596
- }, Un = "hanui-line-CLpqU", Qn = "hanui-area-LkWXB", Jn = "hanui-bar-260Bd", Kn = "hanui-point-Vc-kX", te = "hanui-marker-G-xZb", ne = "hanui-crosshair-nV-xX", ee = "hanui-band-jnG7s", oe = "hanui-zero-GpHvw", st = {
597
- line: Un,
598
- area: Qn,
599
- bar: Jn,
600
- point: Kn,
601
- marker: te,
602
- crosshair: ne,
603
- band: ee,
604
- zero: oe
605
- }, ae = 280, cn = "—", se = ({
624
+ }, Jn = "hanui-line-CLpqU", Kn = "hanui-area-LkWXB", te = "hanui-bar-260Bd", ne = "hanui-point-Vc-kX", ee = "hanui-marker-G-xZb", oe = "hanui-crosshair-nV-xX", ae = "hanui-band-jnG7s", se = "hanui-zero-GpHvw", st = {
625
+ line: Jn,
626
+ area: Kn,
627
+ bar: te,
628
+ point: ne,
629
+ marker: ee,
630
+ crosshair: oe,
631
+ band: ae,
632
+ zero: se
633
+ }, re = 280, ln = "—", ce = ({
606
634
  label: t,
607
635
  description: o,
608
636
  data: n,
609
637
  xKey: e,
610
638
  xLabel: r,
611
- series: h,
612
- height: d = ae,
613
- width: u,
639
+ series: i,
640
+ height: d = re,
641
+ width: m,
614
642
  isStacked: k = !1,
615
- orientation: I = "vertical",
643
+ orientation: T = "vertical",
616
644
  curve: A = "monotone",
617
- hasPoints: C = !1,
618
- formatX: b = String,
619
- formatValue: S,
620
- domain: P,
621
- className: H,
645
+ hasPoints: I = !1,
646
+ formatX: g = String,
647
+ formatValue: R,
648
+ domain: z,
649
+ className: S,
622
650
  testId: q
623
651
  }) => {
624
- const { labels: E } = xt(), N = E == null ? void 0 : E.locale, [R, D] = _t(u), [M, $] = At(() => /* @__PURE__ */ new Set()), i = L(() => S ?? bt(N), [S, N]), y = L(() => St(N), [N]), s = nt(
625
- (g) => g == null ? "" : b(g),
626
- [b]
652
+ const { labels: D } = xt(), N = D == null ? void 0 : D.locale, [C, P] = _t(m), [M, w] = Tt(() => /* @__PURE__ */ new Set()), h = L(() => R ?? bt(N), [R, N]), p = L(() => Ht(N), [N]), s = nt(
653
+ (x) => x == null ? "" : g(x),
654
+ [g]
627
655
  ), l = L(
628
- () => h.map((g, F) => ({ ...g, tone: Ft(F, g.tone) })),
629
- [h]
630
- ), c = L(() => l.filter((g) => !M.has(g.key)), [l, M]), a = L(
631
- () => Sn({
656
+ () => i.map((x, F) => ({ ...x, tone: St(F, x.tone) })),
657
+ [i]
658
+ ), c = L(() => l.filter((x) => !M.has(x.key)), [l, M]), a = L(
659
+ () => Ln({
632
660
  rows: n,
633
661
  xKey: e,
634
662
  series: c,
635
- width: D,
663
+ width: P,
636
664
  height: d,
637
665
  isStacked: k,
638
- orientation: I,
666
+ orientation: T,
639
667
  curve: A,
640
668
  formatX: s,
641
- formatLeft: y,
642
- formatRight: y,
643
- domain: P
669
+ formatLeft: p,
670
+ formatRight: p,
671
+ domain: z
644
672
  }),
645
673
  [
646
674
  n,
647
675
  e,
648
676
  c,
649
- D,
677
+ P,
650
678
  d,
651
679
  k,
652
- I,
680
+ T,
653
681
  A,
654
682
  s,
655
- y,
656
- P
683
+ p,
684
+ z
657
685
  ]
658
- ), p = I === "horizontal" && c.length > 0 && c.every((g) => g.type === "bar"), _ = c.some((g) => g.type === "bar"), w = L(() => {
659
- const g = a.centers.map((F, z) => ({ center: F, index: z })).sort((F, z) => F.center - z.center);
660
- return { centers: g.map((F) => F.center), indices: g.map((F) => F.index) };
661
- }, [a.centers]), x = nt(
662
- (g, F) => {
663
- const { area: z } = a;
664
- if (g < z.left - 4 || g > z.right + 4 || F < z.top - 4 || F > z.bottom + 4)
686
+ ), f = T === "horizontal" && c.length > 0 && c.every((x) => x.type === "bar"), b = c.some((x) => x.type === "bar"), $ = L(() => {
687
+ const x = a.centers.map((F, E) => ({ center: F, index: E })).sort((F, E) => F.center - E.center);
688
+ return { centers: x.map((F) => F.center), indices: x.map((F) => F.index) };
689
+ }, [a.centers]), y = nt(
690
+ (x, F) => {
691
+ const { area: E } = a;
692
+ if (x < E.left - 4 || x > E.right + 4 || F < E.top - 4 || F > E.bottom + 4)
665
693
  return null;
666
- const Y = In(w.centers, p ? F : g);
667
- return Y < 0 ? null : w.indices[Y];
694
+ const Z = Fn($.centers, f ? F : x);
695
+ return Z < 0 ? null : $.indices[Z];
668
696
  },
669
- [a, w, p]
670
- ), f = nt(
671
- (g) => {
697
+ [a, $, f]
698
+ ), _ = nt(
699
+ (x) => {
672
700
  var F;
673
701
  return {
674
- title: s((F = n[g]) == null ? void 0 : F[e]),
675
- rows: c.map((z) => {
702
+ title: s((F = n[x]) == null ? void 0 : F[e]),
703
+ rows: c.map((E) => {
676
704
  var ht;
677
- const Y = Nt((ht = n[g]) == null ? void 0 : ht[z.key]);
705
+ const Z = Nt((ht = n[x]) == null ? void 0 : ht[E.key]);
678
706
  return {
679
- id: z.key,
680
- label: z.label,
681
- tone: z.tone,
682
- value: Y === null ? cn : (z.format ?? i)(Y)
707
+ id: E.key,
708
+ label: E.label,
709
+ tone: E.tone,
710
+ value: Z === null ? ln : (E.format ?? h)(Z)
683
711
  };
684
712
  })
685
713
  };
686
714
  },
687
- [n, e, c, i, s]
688
- ), T = nt(
689
- (g) => {
690
- const F = f(g);
691
- return `${F.title}: ${F.rows.map((z) => `${z.label} ${z.value}`).join(", ")}`;
715
+ [n, e, c, h, s]
716
+ ), G = nt(
717
+ (x) => {
718
+ const F = _(x);
719
+ return `${F.title}: ${F.rows.map((E) => `${E.label} ${E.value}`).join(", ")}`;
692
720
  },
693
- [f]
694
- ), O = L(
721
+ [_]
722
+ ), H = L(
695
723
  () => ({
696
- columns: [r ?? e, ...l.map((g) => g.label)],
697
- rows: n.map((g) => [
698
- s(g[e]),
724
+ columns: [r ?? e, ...l.map((x) => x.label)],
725
+ rows: n.map((x) => [
726
+ s(x[e]),
699
727
  ...l.map((F) => {
700
- const z = Nt(g[F.key]);
701
- return z === null ? cn : (F.format ?? i)(z);
728
+ const E = Nt(x[F.key]);
729
+ return E === null ? ln : (F.format ?? h)(E);
702
730
  })
703
731
  ])
704
732
  }),
705
- [n, e, r, l, i, s]
706
- ), X = L(
707
- () => /* @__PURE__ */ V("g", { children: [
708
- p ? /* @__PURE__ */ V(Ct, { children: [
709
- /* @__PURE__ */ m(pt, { area: a.area, ticks: a.leftTicks, side: "bottom", hasGrid: !0 }),
710
- /* @__PURE__ */ m(Xt, { area: a.area, ticks: a.categoryTicks, side: "left" })
711
- ] }) : /* @__PURE__ */ V(Ct, { children: [
712
- /* @__PURE__ */ m(pt, { area: a.area, ticks: a.leftTicks, side: "left", hasGrid: !0 }),
713
- a.hasRightAxis && /* @__PURE__ */ m(pt, { area: a.area, ticks: a.rightTicks, side: "right" }),
714
- /* @__PURE__ */ m(Xt, { area: a.area, ticks: a.categoryTicks, side: "bottom" })
733
+ [n, e, r, l, h, s]
734
+ ), j = L(
735
+ () => /* @__PURE__ */ X("g", { children: [
736
+ f ? /* @__PURE__ */ X(Ft, { children: [
737
+ /* @__PURE__ */ u(ft, { area: a.area, ticks: a.leftTicks, side: "bottom", hasGrid: !0 }),
738
+ /* @__PURE__ */ u(Yt, { area: a.area, ticks: a.categoryTicks, side: "left" })
739
+ ] }) : /* @__PURE__ */ X(Ft, { children: [
740
+ /* @__PURE__ */ u(ft, { area: a.area, ticks: a.leftTicks, side: "left", hasGrid: !0 }),
741
+ a.hasRightAxis && /* @__PURE__ */ u(ft, { area: a.area, ticks: a.rightTicks, side: "right" }),
742
+ /* @__PURE__ */ u(Yt, { area: a.area, ticks: a.categoryTicks, side: "bottom" })
715
743
  ] }),
716
- a.zero !== null && (p ? /* @__PURE__ */ m(
744
+ a.zero !== null && (f ? /* @__PURE__ */ u(
717
745
  "line",
718
746
  {
719
747
  className: st.zero,
@@ -722,7 +750,7 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
722
750
  y1: a.area.top,
723
751
  y2: a.area.bottom
724
752
  }
725
- ) : /* @__PURE__ */ m(
753
+ ) : /* @__PURE__ */ u(
726
754
  "line",
727
755
  {
728
756
  className: st.zero,
@@ -732,589 +760,586 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
732
760
  y2: a.zero
733
761
  }
734
762
  )),
735
- a.areas.map((g) => /* @__PURE__ */ m(
763
+ a.areas.map((x) => /* @__PURE__ */ u(
736
764
  "path",
737
765
  {
738
- d: g.d,
766
+ d: x.d,
739
767
  className: st.area,
740
- style: { fill: `color-mix(in srgb, ${Q(g.tone)} 18%, transparent)` }
768
+ style: { fill: `color-mix(in srgb, ${U(x.tone)} 18%, transparent)` }
741
769
  },
742
- `area-${g.key}`
770
+ `area-${x.key}`
743
771
  )),
744
- a.bars.map((g) => /* @__PURE__ */ m(
772
+ a.bars.map((x) => /* @__PURE__ */ u(
745
773
  "rect",
746
774
  {
747
775
  className: st.bar,
748
- x: g.x,
749
- y: g.y,
750
- width: g.width,
751
- height: g.height,
752
- rx: Math.min(3, g.width / 4, g.height / 4),
753
- style: { fill: Q(g.tone) }
776
+ x: x.x,
777
+ y: x.y,
778
+ width: x.width,
779
+ height: x.height,
780
+ rx: Math.min(3, x.width / 4, x.height / 4),
781
+ style: { fill: U(x.tone) }
754
782
  },
755
- `bar-${g.key}-${g.index}`
783
+ `bar-${x.key}-${x.index}`
756
784
  )),
757
- a.lines.map((g) => /* @__PURE__ */ m(
785
+ a.lines.map((x) => /* @__PURE__ */ u(
758
786
  "path",
759
787
  {
760
- d: g.d,
788
+ d: x.d,
761
789
  className: st.line,
762
- style: { stroke: Q(g.tone) }
790
+ style: { stroke: U(x.tone) }
763
791
  },
764
- `line-${g.key}`
792
+ `line-${x.key}`
765
793
  )),
766
- c.filter((g) => g.type !== "bar").flatMap(
767
- (g) => (a.points[g.key] ?? []).map(
768
- (F, z, Y) => F && (C || !Y[z - 1] && !Y[z + 1]) ? /* @__PURE__ */ m(
794
+ c.filter((x) => x.type !== "bar").flatMap(
795
+ (x) => (a.points[x.key] ?? []).map(
796
+ (F, E, Z) => F && (I || !Z[E - 1] && !Z[E + 1]) ? /* @__PURE__ */ u(
769
797
  "circle",
770
798
  {
771
799
  className: st.point,
772
800
  cx: F.x,
773
801
  cy: F.y,
774
802
  r: 3,
775
- style: { fill: Q(g.tone) }
803
+ style: { fill: U(x.tone) }
776
804
  },
777
- `point-${g.key}-${z}`
805
+ `point-${x.key}-${E}`
778
806
  ) : null
779
807
  )
780
808
  )
781
809
  ] }),
782
- [a, C, p, c]
783
- ), U = nt(
784
- (g) => {
785
- if (!_ || a.bandwidth <= 0) return null;
786
- const { area: F } = a, z = a.centers[g], Y = a.bandwidth * 0.12;
787
- return p ? /* @__PURE__ */ m(
810
+ [a, I, f, c]
811
+ ), Y = nt(
812
+ (x) => {
813
+ if (!b || a.bandwidth <= 0) return null;
814
+ const { area: F } = a, E = a.centers[x], Z = a.bandwidth * 0.12;
815
+ return f ? /* @__PURE__ */ u(
788
816
  "rect",
789
817
  {
790
818
  className: st.band,
791
819
  x: F.left,
792
820
  width: F.width,
793
- y: z - a.bandwidth / 2 - Y,
794
- height: a.bandwidth + Y * 2
821
+ y: E - a.bandwidth / 2 - Z,
822
+ height: a.bandwidth + Z * 2
795
823
  }
796
- ) : /* @__PURE__ */ m(
824
+ ) : /* @__PURE__ */ u(
797
825
  "rect",
798
826
  {
799
827
  className: st.band,
800
828
  y: F.top,
801
829
  height: F.height,
802
- x: z - a.bandwidth / 2 - Y,
803
- width: a.bandwidth + Y * 2
830
+ x: E - a.bandwidth / 2 - Z,
831
+ width: a.bandwidth + Z * 2
804
832
  }
805
833
  );
806
834
  },
807
- [a, p, _]
808
- ), G = nt(
809
- (g) => {
810
- const { area: F } = a, z = a.centers[g];
811
- return /* @__PURE__ */ V(Ct, { children: [
812
- !_ && /* @__PURE__ */ m(
835
+ [a, f, b]
836
+ ), O = nt(
837
+ (x) => {
838
+ const { area: F } = a, E = a.centers[x];
839
+ return /* @__PURE__ */ X(Ft, { children: [
840
+ !b && /* @__PURE__ */ u(
813
841
  "line",
814
842
  {
815
843
  className: st.crosshair,
816
- x1: z,
817
- x2: z,
844
+ x1: E,
845
+ x2: E,
818
846
  y1: F.top,
819
847
  y2: F.bottom
820
848
  }
821
849
  ),
822
- c.filter((Y) => Y.type !== "bar").map((Y) => {
823
- var Tt;
824
- const ht = (Tt = a.points[Y.key]) == null ? void 0 : Tt[g];
825
- return ht ? /* @__PURE__ */ m(
850
+ c.filter((Z) => Z.type !== "bar").map((Z) => {
851
+ var It;
852
+ const ht = (It = a.points[Z.key]) == null ? void 0 : It[x];
853
+ return ht ? /* @__PURE__ */ u(
826
854
  "circle",
827
855
  {
828
856
  className: st.marker,
829
857
  cx: ht.x,
830
858
  cy: ht.y,
831
859
  r: 4.5,
832
- style: { fill: Q(Y.tone) }
860
+ style: { fill: U(Z.tone) }
833
861
  },
834
- Y.key
862
+ Z.key
835
863
  ) : null;
836
864
  })
837
865
  ] });
838
866
  },
839
- [a, c, _]
867
+ [a, c, b]
840
868
  );
841
- return /* @__PURE__ */ m(
869
+ return /* @__PURE__ */ u(
842
870
  gt,
843
871
  {
844
872
  label: t,
845
873
  description: o,
846
- containerRef: R,
847
- width: D,
874
+ containerRef: C,
875
+ width: P,
848
876
  height: d,
849
- plot: X,
850
- overlay: G,
851
- underlay: U,
877
+ plot: j,
878
+ overlay: O,
879
+ underlay: Y,
852
880
  itemCount: n.length,
853
- pick: x,
854
- tooltip: f,
855
- anchor: (g) => a.anchors[g] ?? { x: 0, y: 0 },
856
- announce: T,
857
- table: O,
881
+ pick: y,
882
+ tooltip: _,
883
+ anchor: (x) => a.anchors[x] ?? { x: 0, y: 0 },
884
+ announce: G,
885
+ table: H,
858
886
  legend: {
859
- entries: l.map((g) => ({ id: g.key, label: g.label, tone: g.tone })),
887
+ entries: l.map((x) => ({ id: x.key, label: x.label, tone: x.tone })),
860
888
  hidden: M,
861
- onToggle: (g) => $((F) => {
862
- const z = new Set(F);
863
- return z.has(g) ? z.delete(g) : l.length - F.size > 1 && z.add(g), z;
889
+ onToggle: (x) => w((F) => {
890
+ const E = new Set(F);
891
+ return E.has(x) ? E.delete(x) : l.length - F.size > 1 && E.add(x), E;
864
892
  })
865
893
  },
866
- className: H,
894
+ className: S,
867
895
  testId: q
868
896
  }
869
897
  );
870
- }, Ot = ot(se), ce = ({ series: t, ...o }) => {
898
+ }, Bt = ot(ce), ie = ({ series: t, ...o }) => {
871
899
  const n = L(() => t.map((e) => ({ ...e, type: "line" })), [t]);
872
- return /* @__PURE__ */ m(Ot, { ...o, series: n });
873
- }, We = /* @__PURE__ */ ot(/* @__PURE__ */ lt(ce, "LineChart")), re = ({ series: t, ...o }) => {
900
+ return /* @__PURE__ */ u(Bt, { ...o, series: n });
901
+ }, je = /* @__PURE__ */ ot(/* @__PURE__ */ it(ie, "LineChart")), le = ({ series: t, ...o }) => {
874
902
  const n = L(() => t.map((e) => ({ ...e, type: "area" })), [t]);
875
- return /* @__PURE__ */ m(Ot, { ...o, series: n });
876
- }, je = /* @__PURE__ */ ot(/* @__PURE__ */ lt(re, "AreaChart")), le = ({ series: t, ...o }) => {
903
+ return /* @__PURE__ */ u(Bt, { ...o, series: n });
904
+ }, Xe = /* @__PURE__ */ ot(/* @__PURE__ */ it(le, "AreaChart")), he = ({ series: t, ...o }) => {
877
905
  const n = L(() => t.map((e) => ({ ...e, type: "bar" })), [t]);
878
- return /* @__PURE__ */ m(Ot, { ...o, series: n });
879
- }, Ve = /* @__PURE__ */ ot(/* @__PURE__ */ lt(le, "BarChart")), ie = (t) => /* @__PURE__ */ m(Ot, { ...t }), Xe = /* @__PURE__ */ ot(
880
- /* @__PURE__ */ lt(ie, "ComposedChart")
881
- ), he = "hanui-slice-dFWuh", de = "hanui-center__value-GnqKe", me = "hanui-center__label-DsgTV", It = {
882
- slice: he,
883
- center__value: de,
884
- center__label: me
885
- }, Ht = 6, rn = 1.5, ue = ({
906
+ return /* @__PURE__ */ u(Bt, { ...o, series: n });
907
+ }, Ye = /* @__PURE__ */ ot(/* @__PURE__ */ it(he, "BarChart")), de = (t) => /* @__PURE__ */ u(Bt, { ...t }), Ze = /* @__PURE__ */ ot(
908
+ /* @__PURE__ */ it(de, "ComposedChart")
909
+ ), ue = "hanui-slice-dFWuh", me = "hanui-center__value-GnqKe", fe = "hanui-center__label-DsgTV", Ct = {
910
+ slice: ue,
911
+ center__value: me,
912
+ center__label: fe
913
+ }, Lt = 6, hn = 1.5, pe = ({
886
914
  label: t,
887
915
  description: o,
888
916
  data: n,
889
917
  variant: e = "donut",
890
918
  centerValue: r,
891
- centerLabel: h,
919
+ centerLabel: i,
892
920
  valueLabel: d,
893
- height: u = 260,
921
+ height: m = 260,
894
922
  width: k,
895
- formatValue: I,
923
+ formatValue: T,
896
924
  className: A,
897
- testId: C
925
+ testId: I
898
926
  }) => {
899
- const { labels: b } = xt(), [S, P] = _t(k), [H, q] = At(() => /* @__PURE__ */ new Set()), E = L(() => bt(b == null ? void 0 : b.locale), [b == null ? void 0 : b.locale]), N = I ?? E, R = L(
900
- () => n.map((s, l) => ({ ...s, tone: Ft(l, s.tone) })),
927
+ const { labels: g } = xt(), [R, z] = _t(k), [S, q] = Tt(() => /* @__PURE__ */ new Set()), D = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), N = T ?? D, C = L(
928
+ () => n.map((s, l) => ({ ...s, tone: St(l, s.tone) })),
901
929
  [n]
902
- ), D = L(() => {
903
- const s = R.filter(
904
- (f) => !H.has(f.id) && Number.isFinite(f.value) && f.value > 0
905
- ), l = s.reduce((f, T) => f + T.value, 0), c = P / 2, a = u / 2, p = Math.max(8, Math.min(P, u) / 2 - Ht - 4), _ = e === "donut" ? p * 0.62 : 0;
906
- let w = 0;
907
- const x = s.map((f) => {
908
- const T = l > 0 ? f.value / l * Math.PI * 2 : 0, O = w;
909
- return w += T, { ...f, start: O, end: w, share: l > 0 ? f.value / l : 0 };
930
+ ), P = L(() => {
931
+ const s = C.filter(
932
+ (_) => !S.has(_.id) && Number.isFinite(_.value) && _.value > 0
933
+ ), l = s.reduce((_, G) => _ + G.value, 0), c = z / 2, a = m / 2, f = Math.max(8, Math.min(z, m) / 2 - Lt - 4), b = e === "donut" ? f * 0.62 : 0;
934
+ let $ = 0;
935
+ const y = s.map((_) => {
936
+ const G = l > 0 ? _.value / l * Math.PI * 2 : 0, H = $;
937
+ return $ += G, { ..._, start: H, end: $, share: l > 0 ? _.value / l : 0 };
910
938
  });
911
- return { cx: c, cy: a, outer: p, inner: _, total: l, slices: x };
912
- }, [R, H, P, u, e]), M = L(() => {
913
- const s = new Intl.NumberFormat(b == null ? void 0 : b.locale, {
939
+ return { cx: c, cy: a, outer: f, inner: b, total: l, slices: y };
940
+ }, [C, S, z, m, e]), M = L(() => {
941
+ const s = new Intl.NumberFormat(g == null ? void 0 : g.locale, {
914
942
  style: "percent",
915
943
  maximumFractionDigits: 1
916
944
  });
917
945
  return (l) => s.format(l);
918
- }, [b == null ? void 0 : b.locale]), $ = L(() => {
919
- const { cx: s, cy: l, outer: c, inner: a, slices: p, total: _ } = D;
920
- return /* @__PURE__ */ V("g", { children: [
921
- p.map((w) => /* @__PURE__ */ m(
946
+ }, [g == null ? void 0 : g.locale]), w = L(() => {
947
+ const { cx: s, cy: l, outer: c, inner: a, slices: f, total: b } = P;
948
+ return /* @__PURE__ */ X("g", { children: [
949
+ f.map(($) => /* @__PURE__ */ u(
922
950
  "path",
923
951
  {
924
- className: It.slice,
925
- d: tn(s, l, c, a, w.start, w.end),
926
- style: { fill: Q(w.tone), strokeWidth: p.length > 1 ? rn : 0 }
952
+ className: Ct.slice,
953
+ d: nn(s, l, c, a, $.start, $.end),
954
+ style: { fill: U($.tone), strokeWidth: f.length > 1 ? hn : 0 }
927
955
  },
928
- w.id
956
+ $.id
929
957
  )),
930
- e === "donut" && /* @__PURE__ */ V("g", { "aria-hidden": !0, className: It.center, children: [
931
- /* @__PURE__ */ m(
958
+ e === "donut" && /* @__PURE__ */ X("g", { "aria-hidden": !0, className: Ct.center, children: [
959
+ /* @__PURE__ */ u(
932
960
  "text",
933
961
  {
934
- className: It.center__value,
962
+ className: Ct.center__value,
935
963
  x: s,
936
- y: h ? l - 4 : l,
964
+ y: i ? l - 4 : l,
937
965
  dy: "0.32em",
938
966
  textAnchor: "middle",
939
- children: r ?? N(_)
967
+ children: r ?? N(b)
940
968
  }
941
969
  ),
942
- h && /* @__PURE__ */ m(
970
+ i && /* @__PURE__ */ u(
943
971
  "text",
944
972
  {
945
- className: It.center__label,
973
+ className: Ct.center__label,
946
974
  x: s,
947
975
  y: l + 16,
948
976
  dy: "0.32em",
949
977
  textAnchor: "middle",
950
- children: h
978
+ children: i
951
979
  }
952
980
  )
953
981
  ] })
954
982
  ] });
955
- }, [D, e, r, h, N]), i = nt(
983
+ }, [P, e, r, i, N]), h = nt(
956
984
  (s, l) => {
957
- const { cx: c, cy: a, outer: p, inner: _, slices: w } = D, x = Math.hypot(s - c, l - a);
958
- if (x > p + Ht || x < _) return null;
959
- let f = Math.atan2(s - c, -(l - a));
960
- f < 0 && (f += Math.PI * 2);
961
- const T = w.findIndex((O) => f >= O.start && f < O.end);
962
- return T < 0 ? null : T;
985
+ const { cx: c, cy: a, outer: f, inner: b, slices: $ } = P, y = Math.hypot(s - c, l - a);
986
+ if (y > f + Lt || y < b) return null;
987
+ let _ = Math.atan2(s - c, -(l - a));
988
+ _ < 0 && (_ += Math.PI * 2);
989
+ const G = $.findIndex((H) => _ >= H.start && _ < H.end);
990
+ return G < 0 ? null : G;
963
991
  },
964
- [D]
965
- ), y = (s) => {
966
- const l = D.slices[s];
992
+ [P]
993
+ ), p = (s) => {
994
+ const l = P.slices[s];
967
995
  return `${N(l.value)} (${M(l.share)})`;
968
996
  };
969
- return /* @__PURE__ */ m(
997
+ return /* @__PURE__ */ u(
970
998
  gt,
971
999
  {
972
1000
  label: t,
973
1001
  description: o,
974
- containerRef: S,
975
- width: P,
976
- height: u,
977
- plot: $,
1002
+ containerRef: R,
1003
+ width: z,
1004
+ height: m,
1005
+ plot: w,
978
1006
  overlay: (s) => {
979
- const { cx: l, cy: c, outer: a, inner: p, slices: _ } = D, w = _[s], x = (w.start + w.end) / 2, f = et(0, 0, Ht, x);
980
- return /* @__PURE__ */ m(
1007
+ const { cx: l, cy: c, outer: a, inner: f, slices: b } = P, $ = b[s], y = ($.start + $.end) / 2, _ = et(0, 0, Lt, y);
1008
+ return /* @__PURE__ */ u(
981
1009
  "path",
982
1010
  {
983
- className: It.slice,
984
- d: tn(l + f.x, c + f.y, a, p, w.start, w.end),
985
- style: { fill: Q(w.tone), strokeWidth: rn }
1011
+ className: Ct.slice,
1012
+ d: nn(l + _.x, c + _.y, a, f, $.start, $.end),
1013
+ style: { fill: U($.tone), strokeWidth: hn }
986
1014
  }
987
1015
  );
988
1016
  },
989
- itemCount: D.slices.length,
990
- pick: i,
1017
+ itemCount: P.slices.length,
1018
+ pick: h,
991
1019
  tooltip: (s) => {
992
- const l = D.slices[s];
1020
+ const l = P.slices[s];
993
1021
  return {
994
- rows: [{ id: l.id, label: l.label, value: y(s), tone: l.tone }]
1022
+ rows: [{ id: l.id, label: l.label, value: p(s), tone: l.tone }]
995
1023
  };
996
1024
  },
997
1025
  anchor: (s) => {
998
- const { cx: l, cy: c, outer: a, slices: p } = D, _ = p[s];
999
- return et(l, c, a + Ht, (_.start + _.end) / 2);
1026
+ const { cx: l, cy: c, outer: a, slices: f } = P, b = f[s];
1027
+ return et(l, c, a + Lt, (b.start + b.end) / 2);
1000
1028
  },
1001
1029
  tooltipSide: "outward",
1002
- announce: (s) => `${D.slices[s].label}: ${y(s)}`,
1030
+ announce: (s) => `${P.slices[s].label}: ${p(s)}`,
1003
1031
  table: {
1004
1032
  columns: [t, d],
1005
- rows: R.map((s) => [
1033
+ rows: C.map((s) => [
1006
1034
  s.label,
1007
1035
  Number.isFinite(s.value) ? N(s.value) : "—"
1008
1036
  ])
1009
1037
  },
1010
1038
  legend: {
1011
- entries: R.map((s) => ({ id: s.id, label: s.label, tone: s.tone })),
1012
- hidden: H,
1039
+ entries: C.map((s) => ({ id: s.id, label: s.label, tone: s.tone })),
1040
+ hidden: S,
1013
1041
  onToggle: (s) => q((l) => {
1014
1042
  const c = new Set(l);
1015
- return c.has(s) ? c.delete(s) : R.length - l.size > 1 && c.add(s), c;
1043
+ return c.has(s) ? c.delete(s) : C.length - l.size > 1 && c.add(s), c;
1016
1044
  })
1017
1045
  },
1018
1046
  className: A,
1019
- testId: C
1047
+ testId: I
1020
1048
  }
1021
1049
  );
1022
- }, Ye = /* @__PURE__ */ ot(/* @__PURE__ */ lt(ue, "PieChart")), Ut = (t, o, n, { top: e = 12, right: r = 16, bottom: h = 28 } = {}) => {
1023
- const d = Math.max(32, ...n.map(ut)) + 10;
1050
+ }, Ue = /* @__PURE__ */ ot(/* @__PURE__ */ it(pe, "PieChart")), Qt = (t, o, n, { top: e = 12, right: r = 16, bottom: i = 28 } = {}) => {
1051
+ const d = Math.max(32, ...n.map(mt)) + 10;
1024
1052
  return {
1025
1053
  left: d,
1026
1054
  top: e,
1027
1055
  right: Math.max(d + 1, t - r),
1028
- bottom: Math.max(e + 1, o - h),
1056
+ bottom: Math.max(e + 1, o - i),
1029
1057
  width: Math.max(1, t - r - d),
1030
- height: Math.max(1, o - e - h)
1058
+ height: Math.max(1, o - e - i)
1031
1059
  };
1032
- }, Rt = (t, o) => Math.max(2, Math.floor(t / (o ? 90 : 48))), pe = (t, o = 24) => {
1033
- const n = /* @__PURE__ */ new Map(), e = (r, h) => `${r}:${h}`;
1034
- return t.forEach((r, h) => {
1060
+ }, Rt = (t, o) => Math.max(2, Math.floor(t / (o ? 90 : 48))), ye = (t, o = 24) => {
1061
+ const n = /* @__PURE__ */ new Map(), e = (r, i) => `${r}:${i}`;
1062
+ return t.forEach((r, i) => {
1035
1063
  if (!Number.isFinite(r.x) || !Number.isFinite(r.y)) return;
1036
- const d = e(Math.floor(r.x / o), Math.floor(r.y / o)), u = n.get(d);
1037
- u ? u.push(h) : n.set(d, [h]);
1064
+ const d = e(Math.floor(r.x / o), Math.floor(r.y / o)), m = n.get(d);
1065
+ m ? m.push(i) : n.set(d, [i]);
1038
1066
  }), {
1039
- nearest: (r, h, d) => {
1040
- const u = Math.ceil(d / o), k = Math.floor(r / o), I = Math.floor(h / o);
1041
- let A = null, C = d * d;
1042
- for (let b = -u; b <= u; b += 1)
1043
- for (let S = -u; S <= u; S += 1)
1044
- for (const P of n.get(e(k + b, I + S)) ?? []) {
1045
- const H = (t[P].x - r) ** 2 + (t[P].y - h) ** 2;
1046
- H <= C && (C = H, A = P);
1067
+ nearest: (r, i, d) => {
1068
+ const m = Math.ceil(d / o), k = Math.floor(r / o), T = Math.floor(i / o);
1069
+ let A = null, I = d * d;
1070
+ for (let g = -m; g <= m; g += 1)
1071
+ for (let R = -m; R <= m; R += 1)
1072
+ for (const z of n.get(e(k + g, T + R)) ?? []) {
1073
+ const S = (t[z].x - r) ** 2 + (t[z].y - i) ** 2;
1074
+ S <= I && (I = S, A = z);
1047
1075
  }
1048
1076
  return A;
1049
1077
  }
1050
1078
  };
1051
- }, fe = "hanui-point-YKyMm", ye = "hanui-marker-ToO1T", ln = {
1052
- point: fe,
1053
- marker: ye
1054
- }, wt = { plain: 4, min: 3, max: 16 }, xe = 22, ge = ({
1079
+ }, xe = "hanui-point-YKyMm", ge = "hanui-marker-ToO1T", dn = {
1080
+ point: xe,
1081
+ marker: ge
1082
+ }, $t = { plain: 4, min: 3, max: 16 }, be = 22, _e = ({
1055
1083
  label: t,
1056
1084
  description: o,
1057
1085
  series: n,
1058
1086
  xLabel: e,
1059
1087
  yLabel: r,
1060
- sizeLabel: h,
1088
+ sizeLabel: i,
1061
1089
  height: d = 300,
1062
- width: u,
1090
+ width: m,
1063
1091
  formatX: k,
1064
- formatY: I,
1092
+ formatY: T,
1065
1093
  className: A,
1066
- testId: C
1094
+ testId: I
1067
1095
  }) => {
1068
- const { labels: b } = xt(), [S, P] = _t(u), [H, q] = At(() => /* @__PURE__ */ new Set()), E = L(() => bt(b == null ? void 0 : b.locale), [b == null ? void 0 : b.locale]), N = L(() => St(b == null ? void 0 : b.locale), [b == null ? void 0 : b.locale]), R = k ?? E, D = I ?? E, M = L(
1069
- () => n.map((c, a) => ({ ...c, tone: Ft(a, c.tone) })),
1096
+ const { labels: g } = xt(), [R, z] = _t(m), [S, q] = Tt(() => /* @__PURE__ */ new Set()), D = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), N = L(() => Ht(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), C = k ?? D, P = T ?? D, M = L(
1097
+ () => n.map((c, a) => ({ ...c, tone: St(a, c.tone) })),
1070
1098
  [n]
1071
- ), $ = L(
1072
- () => M.filter((c) => !H.has(c.id)).flatMap(
1099
+ ), w = L(
1100
+ () => M.filter((c) => !S.has(c.id)).flatMap(
1073
1101
  (c) => c.data.filter((a) => Number.isFinite(a.x) && Number.isFinite(a.y)).map((a) => ({ ...a, series: c }))
1074
1102
  ).sort((c, a) => c.x - a.x || c.y - a.y),
1075
- [M, H]
1076
- ), i = L(() => {
1077
- const c = vt(...yt($.map((G) => G.x))), a = vt(...yt($.map((G) => G.y))), p = rt(a[0], a[1], Rt(d, !1)), _ = Ut(P, d, p.map(N), { right: 20 }), w = ft(c, [_.left, _.right]), x = ft(a, [_.bottom, _.top]), f = qt($.map((G) => G.size)), [T, O] = yt(f), X = (G) => G === void 0 || !Number.isFinite(G) || f.length === 0 ? wt.plain : O === T ? (wt.min + wt.max) / 2 : Math.sqrt(
1078
- wt.min ** 2 + (G - T) / (O - T) * (wt.max ** 2 - wt.min ** 2)
1079
- ), U = $.map((G) => ({
1080
- ...G,
1081
- cx: w(G.x),
1082
- cy: x(G.y),
1083
- r: X(G.size)
1103
+ [M, S]
1104
+ ), h = L(() => {
1105
+ const c = At(...yt(w.map((O) => O.x))), a = At(...yt(w.map((O) => O.y))), f = ct(a[0], a[1], Rt(d, !1)), b = Qt(z, d, N(f), { right: 20 }), $ = pt(c, [b.left, b.right]), y = pt(a, [b.bottom, b.top]), _ = Ot(w.map((O) => O.size)), [G, H] = yt(_), j = (O) => O === void 0 || !Number.isFinite(O) || _.length === 0 ? $t.plain : H === G ? ($t.min + $t.max) / 2 : Math.sqrt(
1106
+ $t.min ** 2 + (O - G) / (H - G) * ($t.max ** 2 - $t.min ** 2)
1107
+ ), Y = w.map((O) => ({
1108
+ ...O,
1109
+ cx: $(O.x),
1110
+ cy: y(O.y),
1111
+ r: j(O.size)
1084
1112
  }));
1085
1113
  return {
1086
- area: _,
1087
- placed: U,
1088
- index: pe(U.map((G) => ({ x: G.cx, y: G.cy }))),
1089
- xTicks: rt(c[0], c[1], Rt(_.width, !0)).map((G) => ({
1090
- position: w(G),
1091
- label: N(G)
1092
- })),
1093
- yTicks: p.map((G) => ({ position: x(G), label: N(G) }))
1114
+ area: b,
1115
+ placed: Y,
1116
+ index: ye(Y.map((O) => ({ x: O.cx, y: O.cy }))),
1117
+ xTicks: vt(ct(c[0], c[1], Rt(b.width, !0)), $, N),
1118
+ yTicks: vt(f, y, N)
1094
1119
  };
1095
- }, [$, P, d, N]), y = L(
1096
- () => /* @__PURE__ */ V("g", { children: [
1097
- /* @__PURE__ */ m(pt, { area: i.area, ticks: i.yTicks, side: "left", hasGrid: !0 }),
1098
- /* @__PURE__ */ m(pt, { area: i.area, ticks: i.xTicks, side: "bottom", hasGrid: !0 }),
1099
- i.placed.map((c, a) => /* @__PURE__ */ m(
1120
+ }, [w, z, d, N]), p = L(
1121
+ () => /* @__PURE__ */ X("g", { children: [
1122
+ /* @__PURE__ */ u(ft, { area: h.area, ticks: h.yTicks, side: "left", hasGrid: !0 }),
1123
+ /* @__PURE__ */ u(ft, { area: h.area, ticks: h.xTicks, side: "bottom", hasGrid: !0 }),
1124
+ h.placed.map((c, a) => /* @__PURE__ */ u(
1100
1125
  "circle",
1101
1126
  {
1102
- className: ln.point,
1127
+ className: dn.point,
1103
1128
  cx: c.cx,
1104
1129
  cy: c.cy,
1105
1130
  r: c.r,
1106
1131
  style: {
1107
- fill: `color-mix(in srgb, ${Q(c.series.tone)} 72%, transparent)`,
1108
- stroke: Q(c.series.tone)
1132
+ fill: `color-mix(in srgb, ${U(c.series.tone)} 72%, transparent)`,
1133
+ stroke: U(c.series.tone)
1109
1134
  }
1110
1135
  },
1111
1136
  a
1112
1137
  ))
1113
1138
  ] }),
1114
- [i]
1139
+ [h]
1115
1140
  ), s = nt(
1116
- (c, a) => i.index.nearest(c, a, xe),
1117
- [i]
1141
+ (c, a) => h.index.nearest(c, a, be),
1142
+ [h]
1118
1143
  ), l = (c) => {
1119
- const a = i.placed[c];
1144
+ const a = h.placed[c];
1120
1145
  return {
1121
1146
  title: a.label ?? a.series.label,
1122
1147
  rows: [
1123
1148
  { id: "series", label: a.series.label, value: "", tone: a.series.tone },
1124
- { id: "x", label: e, value: R(a.x) },
1125
- { id: "y", label: r, value: D(a.y) },
1126
- ...a.size !== void 0 && h ? [{ id: "size", label: h, value: E(a.size) }] : []
1149
+ { id: "x", label: e, value: C(a.x) },
1150
+ { id: "y", label: r, value: P(a.y) },
1151
+ ...a.size !== void 0 && i ? [{ id: "size", label: i, value: D(a.size) }] : []
1127
1152
  ]
1128
1153
  };
1129
1154
  };
1130
- return /* @__PURE__ */ m(
1155
+ return /* @__PURE__ */ u(
1131
1156
  gt,
1132
1157
  {
1133
1158
  label: t,
1134
1159
  description: o,
1135
- containerRef: S,
1136
- width: P,
1160
+ containerRef: R,
1161
+ width: z,
1137
1162
  height: d,
1138
- plot: y,
1163
+ plot: p,
1139
1164
  overlay: (c) => {
1140
- const a = i.placed[c];
1141
- return /* @__PURE__ */ m(
1165
+ const a = h.placed[c];
1166
+ return /* @__PURE__ */ u(
1142
1167
  "circle",
1143
1168
  {
1144
- className: ln.marker,
1169
+ className: dn.marker,
1145
1170
  cx: a.cx,
1146
1171
  cy: a.cy,
1147
1172
  r: a.r + 3,
1148
- style: { stroke: Q(a.series.tone) }
1173
+ style: { stroke: U(a.series.tone) }
1149
1174
  }
1150
1175
  );
1151
1176
  },
1152
- itemCount: i.placed.length,
1177
+ itemCount: h.placed.length,
1153
1178
  pick: s,
1154
1179
  tooltip: l,
1155
- anchor: (c) => ({ x: i.placed[c].cx, y: i.placed[c].cy }),
1180
+ anchor: (c) => ({ x: h.placed[c].cx, y: h.placed[c].cy }),
1156
1181
  announce: (c) => {
1157
- const a = i.placed[c];
1158
- return `${a.label ? `${a.label}, ` : ""}${a.series.label}: ${e} ${R(a.x)}, ${r} ${D(a.y)}`;
1182
+ const a = h.placed[c];
1183
+ return `${a.label ? `${a.label}, ` : ""}${a.series.label}: ${e} ${C(a.x)}, ${r} ${P(a.y)}`;
1159
1184
  },
1160
1185
  table: {
1161
1186
  columns: [t, e, r],
1162
- rows: $.map((c) => [c.label ?? c.series.label, R(c.x), D(c.y)])
1187
+ rows: w.map((c) => [c.label ?? c.series.label, C(c.x), P(c.y)])
1163
1188
  },
1164
1189
  legend: {
1165
1190
  entries: M.map((c) => ({ id: c.id, label: c.label, tone: c.tone })),
1166
- hidden: H,
1191
+ hidden: S,
1167
1192
  onToggle: (c) => q((a) => {
1168
- const p = new Set(a);
1169
- return p.has(c) ? p.delete(c) : M.length - a.size > 1 && p.add(c), p;
1193
+ const f = new Set(a);
1194
+ return f.has(c) ? f.delete(c) : M.length - a.size > 1 && f.add(c), f;
1170
1195
  })
1171
1196
  },
1172
1197
  className: A,
1173
- testId: C
1198
+ testId: I
1174
1199
  }
1175
1200
  );
1176
- }, Ze = /* @__PURE__ */ ot(
1177
- /* @__PURE__ */ lt(ge, "ScatterPlot")
1178
- ), be = "hanui-labels-MJWYF", _e = "hanui-empty-AW7c9", Me = "hanui-focus-hLQdB", Lt = {
1179
- labels: be,
1180
- empty: _e,
1181
- focus: Me
1182
- }, Wt = 8, we = 28, jt = 140, hn = (t, o, n) => {
1201
+ }, Qe = /* @__PURE__ */ ot(
1202
+ /* @__PURE__ */ it(_e, "ScatterPlot")
1203
+ ), Me = "hanui-labels-MJWYF", $e = "hanui-empty-AW7c9", we = "hanui-focus-hLQdB", Et = {
1204
+ labels: Me,
1205
+ empty: $e,
1206
+ focus: we
1207
+ }, Vt = 8, ke = 28, jt = 140, un = (t, o, n) => {
1183
1208
  var r;
1184
1209
  const e = (r = t[o]) == null ? void 0 : r[n];
1185
1210
  return typeof e == "number" && Number.isFinite(e) ? e : null;
1186
- }, dn = (t) => t.map((o, n) => String(n)), $e = ({
1211
+ }, mn = (t) => t.map((o, n) => String(n)), Ne = ({
1187
1212
  label: t,
1188
1213
  description: o,
1189
1214
  columns: n,
1190
1215
  rows: e,
1191
1216
  values: r,
1192
- valueLabel: h,
1217
+ valueLabel: i,
1193
1218
  tone: d = "cat-1",
1194
- height: u = 280,
1219
+ height: m = 280,
1195
1220
  width: k,
1196
- formatValue: I,
1221
+ formatValue: T,
1197
1222
  className: A,
1198
- testId: C
1223
+ testId: I
1199
1224
  }) => {
1200
- const { labels: b } = xt(), [S, P] = _t(k), H = L(() => bt(b == null ? void 0 : b.locale), [b == null ? void 0 : b.locale]), q = I ?? H, E = `hanui-heat-${pn().replace(/:/g, "")}`, N = L(() => {
1201
- const y = { left: Math.min(P * 0.3, Math.max(32, ...e.map(ut)) + 12), top: 8, right: P - 8, bottom: u - 28 - we }, s = Dt(dn(n), [y.left, y.right], {
1225
+ const { labels: g } = xt(), [R, z] = _t(k), S = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), q = T ?? S, D = `hanui-heat-${yn().replace(/:/g, "")}`, N = L(() => {
1226
+ const p = { left: Math.min(z * 0.3, Math.max(32, ...e.map(mt)) + 12), top: 8, right: z - 8, bottom: m - 28 - ke }, s = Dt(mn(n), [p.left, p.right], {
1202
1227
  paddingInner: 0.06,
1203
1228
  paddingOuter: 0
1204
- }), l = Dt(dn(e), [y.top, y.bottom], {
1229
+ }), l = Dt(mn(e), [p.top, p.bottom], {
1205
1230
  paddingInner: 0.06,
1206
1231
  paddingOuter: 0
1207
- }), [c, a] = yt(qt(r.flat())), p = (w) => w === null ? null : a === c ? 60 : Wt + (w - c) / (a - c) * (100 - Wt), _ = e.flatMap(
1208
- (w, x) => n.map((f, T) => {
1209
- const O = hn(r, x, T);
1232
+ }), [c, a] = yt(Ot(r.flat())), f = ($) => $ === null ? null : a === c ? 60 : Vt + ($ - c) / (a - c) * (100 - Vt), b = e.flatMap(
1233
+ ($, y) => n.map((_, G) => {
1234
+ const H = un(r, y, G);
1210
1235
  return {
1211
- row: w,
1212
- column: f,
1213
- key: `${x}:${T}`,
1214
- value: O,
1215
- x: s(String(T)),
1216
- y: l(String(x)),
1236
+ row: $,
1237
+ column: _,
1238
+ key: `${y}:${G}`,
1239
+ value: H,
1240
+ x: s(String(G)),
1241
+ y: l(String(y)),
1217
1242
  width: s.bandwidth,
1218
1243
  height: l.bandwidth,
1219
- mix: p(O)
1244
+ mix: f(H)
1220
1245
  };
1221
1246
  })
1222
1247
  );
1223
- return { area: y, x: s, y: l, cells: _, min: c, max: a };
1224
- }, [n, e, r, P, u]), R = Q(d), D = L(() => {
1225
- const { area: i, x: y, y: s, cells: l } = N, c = q(N.max), a = i.right - ut(c) - 8, p = xn(
1226
- n.map((_, w) => ({
1227
- position: y(String(w)) + y.bandwidth / 2,
1228
- label: _
1248
+ return { area: p, x: s, y: l, cells: b, min: c, max: a };
1249
+ }, [n, e, r, z, m]), C = U(d), P = L(() => {
1250
+ const { area: h, x: p, y: s, cells: l } = N, c = q(N.max), a = h.right - mt(c) - 8, f = bn(
1251
+ n.map((b, $) => ({
1252
+ position: p(String($)) + p.bandwidth / 2,
1253
+ label: b
1229
1254
  }))
1230
1255
  );
1231
- return /* @__PURE__ */ V("g", { children: [
1232
- l.map((_) => /* @__PURE__ */ m(
1256
+ return /* @__PURE__ */ X("g", { children: [
1257
+ l.map((b) => /* @__PURE__ */ u(
1233
1258
  "rect",
1234
1259
  {
1235
- className: _.mix === null ? Lt.empty : void 0,
1236
- x: _.x,
1237
- y: _.y,
1238
- width: _.width,
1239
- height: _.height,
1260
+ className: b.mix === null ? Et.empty : void 0,
1261
+ x: b.x,
1262
+ y: b.y,
1263
+ width: b.width,
1264
+ height: b.height,
1240
1265
  rx: 2,
1241
- style: _.mix === null ? void 0 : { fill: `color-mix(in srgb, ${R} ${_.mix}%, var(--hanui-surface))` }
1266
+ style: b.mix === null ? void 0 : { fill: `color-mix(in srgb, ${C} ${b.mix}%, var(--hanui-surface))` }
1242
1267
  },
1243
- _.key
1268
+ b.key
1244
1269
  )),
1245
- /* @__PURE__ */ V("g", { "aria-hidden": !0, className: Lt.labels, children: [
1246
- e.map((_, w) => /* @__PURE__ */ m(
1270
+ /* @__PURE__ */ X("g", { "aria-hidden": !0, className: Et.labels, children: [
1271
+ e.map((b, $) => /* @__PURE__ */ u(
1247
1272
  "text",
1248
1273
  {
1249
- x: i.left - 8,
1250
- y: s(String(w)) + s.bandwidth / 2,
1274
+ x: h.left - 8,
1275
+ y: s(String($)) + s.bandwidth / 2,
1251
1276
  dy: "0.32em",
1252
1277
  textAnchor: "end",
1253
- children: Et(_, i.left - 12)
1278
+ children: Gt(b, h.left - 12)
1254
1279
  },
1255
- w
1280
+ $
1256
1281
  )),
1257
- p.map((_) => /* @__PURE__ */ m("text", { x: _.position, y: i.bottom + 16, textAnchor: "middle", children: _.label }, _.position))
1282
+ f.map((b) => /* @__PURE__ */ u("text", { x: b.position, y: h.bottom + 16, textAnchor: "middle", children: b.label }, b.position))
1258
1283
  ] }),
1259
- /* @__PURE__ */ m("defs", { children: /* @__PURE__ */ V("linearGradient", { id: E, children: [
1260
- /* @__PURE__ */ m(
1284
+ /* @__PURE__ */ u("defs", { children: /* @__PURE__ */ X("linearGradient", { id: D, children: [
1285
+ /* @__PURE__ */ u(
1261
1286
  "stop",
1262
1287
  {
1263
1288
  offset: "0%",
1264
1289
  style: {
1265
- stopColor: `color-mix(in srgb, ${R} ${Wt}%, var(--hanui-surface))`
1290
+ stopColor: `color-mix(in srgb, ${C} ${Vt}%, var(--hanui-surface))`
1266
1291
  }
1267
1292
  }
1268
1293
  ),
1269
- /* @__PURE__ */ m("stop", { offset: "100%", style: { stopColor: R } })
1294
+ /* @__PURE__ */ u("stop", { offset: "100%", style: { stopColor: C } })
1270
1295
  ] }) }),
1271
- /* @__PURE__ */ V("g", { "aria-hidden": !0, className: Lt.labels, children: [
1272
- /* @__PURE__ */ m(
1296
+ /* @__PURE__ */ X("g", { "aria-hidden": !0, className: Et.labels, children: [
1297
+ /* @__PURE__ */ u(
1273
1298
  "rect",
1274
1299
  {
1275
1300
  x: a - jt,
1276
- y: u - 18,
1301
+ y: m - 18,
1277
1302
  width: jt,
1278
1303
  height: 8,
1279
1304
  rx: 4,
1280
- style: { fill: `url(#${E})` }
1305
+ style: { fill: `url(#${D})` }
1281
1306
  }
1282
1307
  ),
1283
- /* @__PURE__ */ m("text", { x: a - jt - 8, y: u - 14, dy: "0.32em", textAnchor: "end", children: q(N.min) }),
1284
- /* @__PURE__ */ m("text", { x: i.right, y: u - 14, dy: "0.32em", textAnchor: "end", children: c })
1308
+ /* @__PURE__ */ u("text", { x: a - jt - 8, y: m - 14, dy: "0.32em", textAnchor: "end", children: q(N.min) }),
1309
+ /* @__PURE__ */ u("text", { x: h.right, y: m - 14, dy: "0.32em", textAnchor: "end", children: c })
1285
1310
  ] })
1286
1311
  ] });
1287
- }, [N, n, e, R, E, u, q]), M = nt(
1288
- (i, y) => {
1312
+ }, [N, n, e, C, D, m, q]), M = nt(
1313
+ (h, p) => {
1289
1314
  const { area: s, x: l, y: c } = N;
1290
- if (i < s.left || i > s.right || y < s.top || y > s.bottom) return null;
1291
- const a = l.indexAt(i), p = c.indexAt(y);
1292
- return a < 0 || p < 0 ? null : p * n.length + a;
1315
+ if (h < s.left || h > s.right || p < s.top || p > s.bottom) return null;
1316
+ const a = l.indexAt(h), f = c.indexAt(p);
1317
+ return a < 0 || f < 0 ? null : f * n.length + a;
1293
1318
  },
1294
1319
  [N, n.length]
1295
- ), $ = (i) => {
1296
- const y = N.cells[i];
1297
- return { cell: y, value: y.value === null ? "—" : q(y.value) };
1320
+ ), w = (h) => {
1321
+ const p = N.cells[h];
1322
+ return { cell: p, value: p.value === null ? "—" : q(p.value) };
1298
1323
  };
1299
- return /* @__PURE__ */ m(
1324
+ return /* @__PURE__ */ u(
1300
1325
  gt,
1301
1326
  {
1302
1327
  label: t,
1303
1328
  description: o,
1304
- containerRef: S,
1305
- width: P,
1306
- height: u,
1307
- plot: D,
1308
- overlay: (i) => {
1309
- const y = N.cells[i];
1310
- return /* @__PURE__ */ m(
1329
+ containerRef: R,
1330
+ width: z,
1331
+ height: m,
1332
+ plot: P,
1333
+ overlay: (h) => {
1334
+ const p = N.cells[h];
1335
+ return /* @__PURE__ */ u(
1311
1336
  "rect",
1312
1337
  {
1313
- className: Lt.focus,
1314
- x: y.x - 1,
1315
- y: y.y - 1,
1316
- width: y.width + 2,
1317
- height: y.height + 2,
1338
+ className: Et.focus,
1339
+ x: p.x - 1,
1340
+ y: p.y - 1,
1341
+ width: p.width + 2,
1342
+ height: p.height + 2,
1318
1343
  rx: 3
1319
1344
  }
1320
1345
  );
@@ -1322,192 +1347,192 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
1322
1347
  itemCount: N.cells.length,
1323
1348
  columns: n.length,
1324
1349
  pick: M,
1325
- tooltip: (i) => {
1326
- const { cell: y, value: s } = $(i);
1350
+ tooltip: (h) => {
1351
+ const { cell: p, value: s } = w(h);
1327
1352
  return {
1328
- title: `${y.row} · ${y.column}`,
1329
- rows: [{ id: "value", label: h, value: s, tone: d }]
1353
+ title: `${p.row} · ${p.column}`,
1354
+ rows: [{ id: "value", label: i, value: s, tone: d }]
1330
1355
  };
1331
1356
  },
1332
- anchor: (i) => {
1333
- const y = N.cells[i];
1334
- return { x: y.x + y.width / 2, y: y.y + y.height / 2 };
1357
+ anchor: (h) => {
1358
+ const p = N.cells[h];
1359
+ return { x: p.x + p.width / 2, y: p.y + p.height / 2 };
1335
1360
  },
1336
- announce: (i) => {
1337
- const { cell: y, value: s } = $(i);
1338
- return `${y.row}, ${y.column}: ${h} ${s}`;
1361
+ announce: (h) => {
1362
+ const { cell: p, value: s } = w(h);
1363
+ return `${p.row}, ${p.column}: ${i} ${s}`;
1339
1364
  },
1340
1365
  table: {
1341
1366
  columns: [t, ...n],
1342
- rows: e.map((i, y) => [
1343
- i,
1367
+ rows: e.map((h, p) => [
1368
+ h,
1344
1369
  ...n.map((s, l) => {
1345
- const c = hn(r, y, l);
1370
+ const c = un(r, p, l);
1346
1371
  return c === null ? "—" : q(c);
1347
1372
  })
1348
1373
  ])
1349
1374
  },
1350
1375
  className: A,
1351
- testId: C
1376
+ testId: I
1352
1377
  }
1353
1378
  );
1354
- }, Ue = /* @__PURE__ */ ot(/* @__PURE__ */ lt($e, "Heatmap")), ke = "hanui-box-7zEQ-", Ne = "hanui-median-J5g6o", ve = "hanui-outlier-M0VN-", Ae = "hanui-band-kK09D", zt = {
1355
- box: ke,
1356
- median: Ne,
1357
- outlier: ve,
1358
- band: Ae
1359
- }, Te = ({
1379
+ }, Je = /* @__PURE__ */ ot(/* @__PURE__ */ it(Ne, "Heatmap")), ve = "hanui-box-7zEQ-", Ae = "hanui-median-J5g6o", Te = "hanui-outlier-M0VN-", Ie = "hanui-band-kK09D", zt = {
1380
+ box: ve,
1381
+ median: Ae,
1382
+ outlier: Te,
1383
+ band: Ie
1384
+ }, Ce = ({
1360
1385
  label: t,
1361
1386
  description: o,
1362
1387
  groups: n,
1363
1388
  groupLabel: e,
1364
1389
  labels: r,
1365
- height: h = 280,
1390
+ height: i = 280,
1366
1391
  width: d,
1367
- formatValue: u,
1392
+ formatValue: m,
1368
1393
  className: k,
1369
- testId: I
1394
+ testId: T
1370
1395
  }) => {
1371
- const { labels: A } = xt(), [C, b] = _t(d), S = L(() => bt(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), P = L(() => St(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), H = u ?? S, q = L(
1372
- () => n.map((M, $) => ({
1396
+ const { labels: A } = xt(), [I, g] = _t(d), R = L(() => bt(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), z = L(() => Ht(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), S = m ?? R, q = L(
1397
+ () => n.map((M, w) => ({
1373
1398
  group: M,
1374
- tone: Ft($, M.tone),
1375
- stats: Cn(M.values)
1399
+ tone: St(w, M.tone),
1400
+ stats: Rn(M.values)
1376
1401
  })),
1377
1402
  [n]
1378
- ), E = L(() => {
1379
- const M = q.flatMap((p) => p.stats ? [p.stats.min, p.stats.max] : []), [$, i] = M.length ? yt(M) : [0, 1], y = vt($, i), s = rt(y[0], y[1], Rt(h, !1)), l = Ut(b, h, s.map(P)), c = Dt(
1380
- n.map((p) => p.id),
1403
+ ), D = L(() => {
1404
+ const M = q.flatMap((f) => f.stats ? [f.stats.min, f.stats.max] : []), [w, h] = M.length ? yt(M) : [0, 1], p = At(w, h), s = ct(p[0], p[1], Rt(i, !1)), l = Qt(g, i, z(s)), c = Dt(
1405
+ n.map((f) => f.id),
1381
1406
  [l.left, l.right],
1382
1407
  { paddingInner: 0.4, paddingOuter: 0.2 }
1383
- ), a = ft(y, [l.bottom, l.top]);
1408
+ ), a = pt(p, [l.bottom, l.top]);
1384
1409
  return {
1385
1410
  area: l,
1386
1411
  band: c,
1387
1412
  y: a,
1388
- yTicks: s.map((p) => ({ position: a(p), label: P(p) })),
1389
- groupTicks: n.map((p) => ({
1390
- position: c(p.id) + c.bandwidth / 2,
1391
- label: p.label
1413
+ yTicks: vt(s, a, z),
1414
+ groupTicks: n.map((f) => ({
1415
+ position: c(f.id) + c.bandwidth / 2,
1416
+ label: f.label
1392
1417
  }))
1393
1418
  };
1394
- }, [q, n, b, h, P]), N = (M) => [
1395
- { id: "max", label: r.max, value: H(M.whiskerHigh) },
1396
- { id: "q3", label: r.q3, value: H(M.q3) },
1397
- { id: "median", label: r.median, value: H(M.median) },
1398
- { id: "q1", label: r.q1, value: H(M.q1) },
1399
- { id: "min", label: r.min, value: H(M.whiskerLow) },
1400
- ...M.outliers.length > 0 ? [{ id: "outliers", label: r.outliers, value: S(M.outliers.length) }] : [],
1401
- { id: "count", label: r.count, value: S(M.count) }
1402
- ], R = L(() => {
1403
- const { area: M, band: $, y: i } = E;
1404
- return /* @__PURE__ */ V("g", { children: [
1405
- /* @__PURE__ */ m(pt, { area: M, ticks: E.yTicks, side: "left", hasGrid: !0 }),
1406
- /* @__PURE__ */ m(Xt, { area: M, ticks: E.groupTicks, side: "bottom" }),
1407
- q.map(({ group: y, tone: s, stats: l }) => {
1419
+ }, [q, n, g, i, z]), N = (M) => [
1420
+ { id: "max", label: r.max, value: S(M.whiskerHigh) },
1421
+ { id: "q3", label: r.q3, value: S(M.q3) },
1422
+ { id: "median", label: r.median, value: S(M.median) },
1423
+ { id: "q1", label: r.q1, value: S(M.q1) },
1424
+ { id: "min", label: r.min, value: S(M.whiskerLow) },
1425
+ ...M.outliers.length > 0 ? [{ id: "outliers", label: r.outliers, value: R(M.outliers.length) }] : [],
1426
+ { id: "count", label: r.count, value: R(M.count) }
1427
+ ], C = L(() => {
1428
+ const { area: M, band: w, y: h } = D;
1429
+ return /* @__PURE__ */ X("g", { children: [
1430
+ /* @__PURE__ */ u(ft, { area: M, ticks: D.yTicks, side: "left", hasGrid: !0 }),
1431
+ /* @__PURE__ */ u(Yt, { area: M, ticks: D.groupTicks, side: "bottom" }),
1432
+ q.map(({ group: p, tone: s, stats: l }) => {
1408
1433
  if (!l) return null;
1409
- const c = $(y.id), a = c + $.bandwidth / 2, p = $.bandwidth * 0.3, _ = Q(s);
1410
- return /* @__PURE__ */ V("g", { style: { stroke: _ }, className: zt.box, children: [
1411
- /* @__PURE__ */ m("line", { x1: a, x2: a, y1: i(l.whiskerHigh), y2: i(l.q3) }),
1412
- /* @__PURE__ */ m("line", { x1: a, x2: a, y1: i(l.q1), y2: i(l.whiskerLow) }),
1413
- /* @__PURE__ */ m(
1434
+ const c = w(p.id), a = c + w.bandwidth / 2, f = w.bandwidth * 0.3, b = U(s);
1435
+ return /* @__PURE__ */ X("g", { style: { stroke: b }, className: zt.box, children: [
1436
+ /* @__PURE__ */ u("line", { x1: a, x2: a, y1: h(l.whiskerHigh), y2: h(l.q3) }),
1437
+ /* @__PURE__ */ u("line", { x1: a, x2: a, y1: h(l.q1), y2: h(l.whiskerLow) }),
1438
+ /* @__PURE__ */ u(
1414
1439
  "line",
1415
1440
  {
1416
- x1: a - p,
1417
- x2: a + p,
1418
- y1: i(l.whiskerHigh),
1419
- y2: i(l.whiskerHigh)
1441
+ x1: a - f,
1442
+ x2: a + f,
1443
+ y1: h(l.whiskerHigh),
1444
+ y2: h(l.whiskerHigh)
1420
1445
  }
1421
1446
  ),
1422
- /* @__PURE__ */ m(
1447
+ /* @__PURE__ */ u(
1423
1448
  "line",
1424
1449
  {
1425
- x1: a - p,
1426
- x2: a + p,
1427
- y1: i(l.whiskerLow),
1428
- y2: i(l.whiskerLow)
1450
+ x1: a - f,
1451
+ x2: a + f,
1452
+ y1: h(l.whiskerLow),
1453
+ y2: h(l.whiskerLow)
1429
1454
  }
1430
1455
  ),
1431
- /* @__PURE__ */ m(
1456
+ /* @__PURE__ */ u(
1432
1457
  "rect",
1433
1458
  {
1434
1459
  x: c,
1435
- width: $.bandwidth,
1436
- y: i(l.q3),
1437
- height: Math.max(1, i(l.q1) - i(l.q3)),
1460
+ width: w.bandwidth,
1461
+ y: h(l.q3),
1462
+ height: Math.max(1, h(l.q1) - h(l.q3)),
1438
1463
  rx: 2,
1439
- style: { fill: `color-mix(in srgb, ${_} 22%, transparent)` }
1464
+ style: { fill: `color-mix(in srgb, ${b} 22%, transparent)` }
1440
1465
  }
1441
1466
  ),
1442
- /* @__PURE__ */ m(
1467
+ /* @__PURE__ */ u(
1443
1468
  "line",
1444
1469
  {
1445
1470
  className: zt.median,
1446
1471
  x1: c,
1447
- x2: c + $.bandwidth,
1448
- y1: i(l.median),
1449
- y2: i(l.median)
1472
+ x2: c + w.bandwidth,
1473
+ y1: h(l.median),
1474
+ y2: h(l.median)
1450
1475
  }
1451
1476
  ),
1452
- l.outliers.map((w, x) => /* @__PURE__ */ m("circle", { className: zt.outlier, cx: a, cy: i(w), r: 3 }, x))
1453
- ] }, y.id);
1477
+ l.outliers.map(($, y) => /* @__PURE__ */ u("circle", { className: zt.outlier, cx: a, cy: h($), r: 3 }, y))
1478
+ ] }, p.id);
1454
1479
  })
1455
1480
  ] });
1456
- }, [E, q]), D = nt(
1457
- (M, $) => {
1458
- const { area: i, band: y } = E;
1459
- if (M < i.left || M > i.right || $ < i.top - 4 || $ > i.bottom + 4)
1481
+ }, [D, q]), P = nt(
1482
+ (M, w) => {
1483
+ const { area: h, band: p } = D;
1484
+ if (M < h.left || M > h.right || w < h.top - 4 || w > h.bottom + 4)
1460
1485
  return null;
1461
- const s = y.indexAt(M);
1486
+ const s = p.indexAt(M);
1462
1487
  return s < 0 ? null : s;
1463
1488
  },
1464
- [E]
1489
+ [D]
1465
1490
  );
1466
- return /* @__PURE__ */ m(
1491
+ return /* @__PURE__ */ u(
1467
1492
  gt,
1468
1493
  {
1469
1494
  label: t,
1470
1495
  description: o,
1471
- containerRef: C,
1472
- width: b,
1473
- height: h,
1474
- plot: R,
1496
+ containerRef: I,
1497
+ width: g,
1498
+ height: i,
1499
+ plot: C,
1475
1500
  underlay: (M) => {
1476
- const { area: $, band: i } = E, y = i.step * 0.2;
1477
- return /* @__PURE__ */ m(
1501
+ const { area: w, band: h } = D, p = h.step * 0.2;
1502
+ return /* @__PURE__ */ u(
1478
1503
  "rect",
1479
1504
  {
1480
1505
  className: zt.band,
1481
- x: i(n[M].id) - y,
1482
- width: i.bandwidth + y * 2,
1483
- y: $.top,
1484
- height: $.height
1506
+ x: h(n[M].id) - p,
1507
+ width: h.bandwidth + p * 2,
1508
+ y: w.top,
1509
+ height: w.height
1485
1510
  }
1486
1511
  );
1487
1512
  },
1488
1513
  overlay: () => null,
1489
1514
  itemCount: n.length,
1490
- pick: D,
1515
+ pick: P,
1491
1516
  tooltip: (M) => {
1492
- const $ = q[M];
1517
+ const w = q[M];
1493
1518
  return {
1494
- title: $.group.label,
1495
- rows: $.stats ? N($.stats).map((i) => ({
1496
- ...i,
1497
- tone: i.id === "median" ? $.tone : void 0
1519
+ title: w.group.label,
1520
+ rows: w.stats ? N(w.stats).map((h) => ({
1521
+ ...h,
1522
+ tone: h.id === "median" ? w.tone : void 0
1498
1523
  })) : []
1499
1524
  };
1500
1525
  },
1501
1526
  anchor: (M) => {
1502
- const $ = q[M], { band: i, y } = E;
1527
+ const w = q[M], { band: h, y: p } = D;
1503
1528
  return {
1504
- x: i($.group.id) + i.bandwidth / 2,
1505
- y: $.stats ? y($.stats.q3) : E.area.bottom
1529
+ x: h(w.group.id) + h.bandwidth / 2,
1530
+ y: w.stats ? p(w.stats.q3) : D.area.bottom
1506
1531
  };
1507
1532
  },
1508
1533
  announce: (M) => {
1509
- const $ = q[M];
1510
- return $.stats ? `${$.group.label}: ${N($.stats).map((i) => `${i.label} ${i.value}`).join(", ")}` : $.group.label;
1534
+ const w = q[M];
1535
+ return w.stats ? `${w.group.label}: ${N(w.stats).map((h) => `${h.label} ${h.value}`).join(", ")}` : w.group.label;
1511
1536
  },
1512
1537
  table: {
1513
1538
  columns: [
@@ -1520,324 +1545,321 @@ const lt = (t, o) => Object.assign(t, { displayName: o }), wn = "hanui-axis-AqLA
1520
1545
  r.count
1521
1546
  ],
1522
1547
  rows: q.map(
1523
- ({ group: M, stats: $ }) => $ ? [
1548
+ ({ group: M, stats: w }) => w ? [
1524
1549
  M.label,
1525
- H($.whiskerLow),
1526
- H($.q1),
1527
- H($.median),
1528
- H($.q3),
1529
- H($.whiskerHigh),
1530
- S($.count)
1550
+ S(w.whiskerLow),
1551
+ S(w.q1),
1552
+ S(w.median),
1553
+ S(w.q3),
1554
+ S(w.whiskerHigh),
1555
+ R(w.count)
1531
1556
  ] : [M.label, "—", "—", "—", "—", "—", "0"]
1532
1557
  )
1533
1558
  },
1534
1559
  className: k,
1535
- testId: I
1560
+ testId: T
1536
1561
  }
1537
1562
  );
1538
- }, Qe = /* @__PURE__ */ ot(/* @__PURE__ */ lt(Te, "BoxPlot")), Ie = "hanui-baseline-wWs7h", Ce = "hanui-band-xvYtL", mn = {
1539
- baseline: Ie,
1540
- band: Ce
1541
- }, $t = 1, Re = ({
1563
+ }, Ke = /* @__PURE__ */ ot(/* @__PURE__ */ it(Ce, "BoxPlot")), Fe = "hanui-baseline-wWs7h", Re = "hanui-band-xvYtL", fn = {
1564
+ baseline: Fe,
1565
+ band: Re
1566
+ }, wt = 1, Se = ({
1542
1567
  label: t,
1543
1568
  description: o,
1544
1569
  values: n,
1545
1570
  bins: e,
1546
1571
  valueLabel: r,
1547
- countLabel: h,
1572
+ countLabel: i,
1548
1573
  tone: d = "cat-1",
1549
- height: u = 260,
1574
+ height: m = 260,
1550
1575
  width: k,
1551
- formatValue: I,
1576
+ formatValue: T,
1552
1577
  className: A,
1553
- testId: C
1578
+ testId: I
1554
1579
  }) => {
1555
- const { labels: b } = xt(), [S, P] = _t(k), H = L(() => bt(b == null ? void 0 : b.locale), [b == null ? void 0 : b.locale]), q = L(() => St(b == null ? void 0 : b.locale), [b == null ? void 0 : b.locale]), E = I ?? H, N = L(() => Rn(n, e), [n, e]), R = L(() => {
1556
- var w, x;
1557
- const i = Math.max(1, ...N.map((f) => f.count)), y = vt(0, i), s = rt(0, y[1], Rt(u, !1)).filter(Number.isInteger), l = Ut(P, u, s.map(q)), c = ((w = N[0]) == null ? void 0 : w.from) ?? 0, a = ((x = N[N.length - 1]) == null ? void 0 : x.to) ?? 1, p = ft([c, a], [l.left, l.right]), _ = ft(y, [l.bottom, l.top]);
1580
+ const { labels: g } = xt(), [R, z] = _t(k), S = L(() => bt(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), q = L(() => Ht(g == null ? void 0 : g.locale), [g == null ? void 0 : g.locale]), D = T ?? S, N = L(() => Sn(n, e), [n, e]), C = L(() => {
1581
+ var $, y;
1582
+ const h = Math.max(1, ...N.map((_) => _.count)), p = At(0, h), s = ct(0, p[1], Rt(m, !1)).filter(Number.isInteger), l = Qt(z, m, q(s)), c = (($ = N[0]) == null ? void 0 : $.from) ?? 0, a = ((y = N[N.length - 1]) == null ? void 0 : y.to) ?? 1, f = pt([c, a], [l.left, l.right]), b = pt(p, [l.bottom, l.top]);
1558
1583
  return {
1559
1584
  area: l,
1560
- columns: N.map((f) => ({
1561
- x: p(f.from) + $t / 2,
1562
- width: Math.max(1, p(f.to) - p(f.from) - $t),
1563
- y: _(f.count),
1564
- height: Math.max(0, l.bottom - _(f.count)),
1565
- center: (p(f.from) + p(f.to)) / 2
1566
- })),
1567
- xTicks: rt(c, a, Rt(l.width, !0)).map((f) => ({
1568
- position: p(f),
1569
- label: q(f)
1585
+ columns: N.map((_) => ({
1586
+ x: f(_.from) + wt / 2,
1587
+ width: Math.max(1, f(_.to) - f(_.from) - wt),
1588
+ y: b(_.count),
1589
+ height: Math.max(0, l.bottom - b(_.count)),
1590
+ center: (f(_.from) + f(_.to)) / 2
1570
1591
  })),
1571
- yTicks: s.map((f) => ({ position: _(f), label: q(f) }))
1592
+ xTicks: vt(ct(c, a, Rt(l.width, !0)), f, q),
1593
+ yTicks: vt(s, b, q)
1572
1594
  };
1573
- }, [N, P, u, q]), D = (i) => `${E(N[i].from)} – ${E(N[i].to)}`, M = L(
1574
- () => /* @__PURE__ */ V("g", { children: [
1575
- /* @__PURE__ */ m(pt, { area: R.area, ticks: R.yTicks, side: "left", hasGrid: !0 }),
1576
- /* @__PURE__ */ m(pt, { area: R.area, ticks: R.xTicks, side: "bottom" }),
1577
- /* @__PURE__ */ m(
1595
+ }, [N, z, m, q]), P = (h) => `${D(N[h].from)} – ${D(N[h].to)}`, M = L(
1596
+ () => /* @__PURE__ */ X("g", { children: [
1597
+ /* @__PURE__ */ u(ft, { area: C.area, ticks: C.yTicks, side: "left", hasGrid: !0 }),
1598
+ /* @__PURE__ */ u(ft, { area: C.area, ticks: C.xTicks, side: "bottom" }),
1599
+ /* @__PURE__ */ u(
1578
1600
  "line",
1579
1601
  {
1580
- className: mn.baseline,
1581
- x1: R.area.left,
1582
- x2: R.area.right,
1583
- y1: R.area.bottom,
1584
- y2: R.area.bottom
1602
+ className: fn.baseline,
1603
+ x1: C.area.left,
1604
+ x2: C.area.right,
1605
+ y1: C.area.bottom,
1606
+ y2: C.area.bottom
1585
1607
  }
1586
1608
  ),
1587
- R.columns.map(
1588
- (i, y) => i.height > 0 ? /* @__PURE__ */ m(
1609
+ C.columns.map(
1610
+ (h, p) => h.height > 0 ? /* @__PURE__ */ u(
1589
1611
  "rect",
1590
1612
  {
1591
- x: i.x,
1592
- y: i.y,
1593
- width: i.width,
1594
- height: i.height,
1595
- style: { fill: Q(d) }
1613
+ x: h.x,
1614
+ y: h.y,
1615
+ width: h.width,
1616
+ height: h.height,
1617
+ style: { fill: U(d) }
1596
1618
  },
1597
- y
1619
+ p
1598
1620
  ) : null
1599
1621
  )
1600
1622
  ] }),
1601
- [R, d]
1602
- ), $ = nt(
1603
- (i, y) => {
1604
- const { area: s, columns: l } = R;
1605
- if (i < s.left || i > s.right || y < s.top - 4 || y > s.bottom + 4)
1623
+ [C, d]
1624
+ ), w = nt(
1625
+ (h, p) => {
1626
+ const { area: s, columns: l } = C;
1627
+ if (h < s.left || h > s.right || p < s.top - 4 || p > s.bottom + 4)
1606
1628
  return null;
1607
1629
  const c = l.findIndex(
1608
- (a) => i >= a.x - $t && i <= a.x + a.width + $t
1630
+ (a) => h >= a.x - wt && h <= a.x + a.width + wt
1609
1631
  );
1610
1632
  return c < 0 ? null : c;
1611
1633
  },
1612
- [R]
1634
+ [C]
1613
1635
  );
1614
- return /* @__PURE__ */ m(
1636
+ return /* @__PURE__ */ u(
1615
1637
  gt,
1616
1638
  {
1617
1639
  label: t,
1618
1640
  description: o,
1619
- containerRef: S,
1620
- width: P,
1621
- height: u,
1641
+ containerRef: R,
1642
+ width: z,
1643
+ height: m,
1622
1644
  plot: M,
1623
- underlay: (i) => {
1624
- const y = R.columns[i];
1625
- return /* @__PURE__ */ m(
1645
+ underlay: (h) => {
1646
+ const p = C.columns[h];
1647
+ return /* @__PURE__ */ u(
1626
1648
  "rect",
1627
1649
  {
1628
- className: mn.band,
1629
- x: y.x - $t / 2,
1630
- width: y.width + $t,
1631
- y: R.area.top,
1632
- height: R.area.height
1650
+ className: fn.band,
1651
+ x: p.x - wt / 2,
1652
+ width: p.width + wt,
1653
+ y: C.area.top,
1654
+ height: C.area.height
1633
1655
  }
1634
1656
  );
1635
1657
  },
1636
1658
  overlay: () => null,
1637
1659
  itemCount: N.length,
1638
- pick: $,
1639
- tooltip: (i) => ({
1640
- title: D(i),
1641
- rows: [{ id: "count", label: h, value: H(N[i].count), tone: d }]
1660
+ pick: w,
1661
+ tooltip: (h) => ({
1662
+ title: P(h),
1663
+ rows: [{ id: "count", label: i, value: S(N[h].count), tone: d }]
1642
1664
  }),
1643
- anchor: (i) => ({ x: R.columns[i].center, y: R.columns[i].y }),
1644
- announce: (i) => `${r} ${D(i)}: ${h} ${H(N[i].count)}`,
1665
+ anchor: (h) => ({ x: C.columns[h].center, y: C.columns[h].y }),
1666
+ announce: (h) => `${r} ${P(h)}: ${i} ${S(N[h].count)}`,
1645
1667
  table: {
1646
- columns: [r, h],
1647
- rows: N.map((i, y) => [D(y), H(i.count)])
1668
+ columns: [r, i],
1669
+ rows: N.map((h, p) => [P(p), S(h.count)])
1648
1670
  },
1649
1671
  className: A,
1650
- testId: C
1672
+ testId: I
1651
1673
  }
1652
1674
  );
1653
- }, Je = /* @__PURE__ */ ot(/* @__PURE__ */ lt(Re, "Histogram")), Fe = "hanui-grid-fHioN", Se = "hanui-shape-Vbb9D", He = "hanui-labels-nRfEk", Le = "hanui-axisLabel-UOZQ7", ze = "hanui-spoke-P-6cp", Pe = "hanui-marker-xzn9h", kt = {
1654
- grid: Fe,
1655
- shape: Se,
1656
- labels: He,
1657
- axisLabel: Le,
1658
- spoke: ze,
1659
- marker: Pe
1660
- }, un = 10, De = 16, Ee = 28, Vt = (t, o) => {
1675
+ }, to = /* @__PURE__ */ ot(/* @__PURE__ */ it(Se, "Histogram")), He = "hanui-grid-fHioN", Le = "hanui-shape-Vbb9D", Ee = "hanui-labels-nRfEk", ze = "hanui-axisLabel-UOZQ7", Pe = "hanui-spoke-P-6cp", De = "hanui-marker-xzn9h", kt = {
1676
+ grid: He,
1677
+ shape: Le,
1678
+ labels: Ee,
1679
+ axisLabel: ze,
1680
+ spoke: Pe,
1681
+ marker: De
1682
+ }, pn = 10, Ge = 16, qe = 28, Xt = (t, o) => {
1661
1683
  const n = t.values[o];
1662
1684
  return typeof n == "number" && Number.isFinite(n) ? n : null;
1663
- }, Ge = ({
1685
+ }, Oe = ({
1664
1686
  label: t,
1665
1687
  description: o,
1666
1688
  axes: n,
1667
1689
  series: e,
1668
1690
  max: r,
1669
- height: h = 320,
1691
+ height: i = 320,
1670
1692
  width: d,
1671
- formatValue: u,
1693
+ formatValue: m,
1672
1694
  className: k,
1673
- testId: I
1695
+ testId: T
1674
1696
  }) => {
1675
- const { labels: A } = xt(), [C, b] = _t(d), [S, P] = At(() => /* @__PURE__ */ new Set()), H = L(() => St(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), q = L(() => bt(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), E = u ?? q, N = L(
1676
- () => e.map((s, l) => ({ ...s, tone: Ft(l, s.tone) })),
1697
+ const { labels: A } = xt(), [I, g] = _t(d), [R, z] = Tt(() => /* @__PURE__ */ new Set()), S = L(() => Ht(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), q = L(() => bt(A == null ? void 0 : A.locale), [A == null ? void 0 : A.locale]), D = m ?? q, N = L(
1698
+ () => e.map((s, l) => ({ ...s, tone: St(l, s.tone) })),
1677
1699
  [e]
1678
- ), R = L(() => N.filter((s) => !S.has(s.id)), [N, S]), D = L(() => {
1679
- const s = n.length, l = s > 0 ? Math.PI * 2 / s : 0, c = n.map((X, U) => U * l), a = Math.min(b * 0.22, Math.max(0, ...n.map((X) => ut(X.label)))), p = Math.max(24, Math.min(h / 2 - 24, b / 2 - a - un - 4)), _ = b / 2, w = h / 2;
1680
- let x = 0;
1681
- for (const X of e)
1682
- for (const U of n) {
1683
- const G = Vt(X, U.key);
1684
- G !== null && G > x && (x = G);
1700
+ ), C = L(() => N.filter((s) => !R.has(s.id)), [N, R]), P = L(() => {
1701
+ const s = n.length, l = s > 0 ? Math.PI * 2 / s : 0, c = n.map((j, Y) => Y * l), a = Math.min(g * 0.22, Math.max(0, ...n.map((j) => mt(j.label)))), f = Math.max(24, Math.min(i / 2 - 24, g / 2 - a - pn - 4)), b = g / 2, $ = i / 2;
1702
+ let y = 0;
1703
+ for (const j of e)
1704
+ for (const Y of n) {
1705
+ const O = Xt(j, Y.key);
1706
+ O !== null && O > y && (y = O);
1685
1707
  }
1686
- const f = r !== void 0 && r > 0 ? r : vt(0, x, 4)[1], T = rt(0, f, 4).filter((X) => X > 0);
1687
- return { cx: _, cy: w, radius: p, angles: c, step: l, top: f, rings: T, scale: (X) => Math.min(Math.max(X, 0), f) / f * p, labelRoom: a };
1688
- }, [n, e, r, b, h]), M = L(() => {
1689
- const { cx: s, cy: l, angles: c, scale: a } = D;
1690
- return R.map((p) => ({
1691
- ...p,
1692
- points: n.map((_, w) => {
1693
- const x = Vt(p, _.key);
1694
- return { ...et(s, l, a(x ?? 0), c[w]), value: x };
1708
+ const _ = r !== void 0 && r > 0 ? r : At(0, y, 4)[1], G = ct(0, _, 4).filter((j) => j > 0);
1709
+ return { cx: b, cy: $, radius: f, angles: c, step: l, top: _, rings: G, scale: (j) => Math.min(Math.max(j, 0), _) / _ * f, labelRoom: a };
1710
+ }, [n, e, r, g, i]), M = L(() => {
1711
+ const { cx: s, cy: l, angles: c, scale: a } = P;
1712
+ return C.map((f) => ({
1713
+ ...f,
1714
+ points: n.map((b, $) => {
1715
+ const y = Xt(f, b.key);
1716
+ return { ...et(s, l, a(y ?? 0), c[$]), value: y };
1695
1717
  })
1696
1718
  }));
1697
- }, [D, R, n]), $ = L(() => {
1698
- const { cx: s, cy: l, radius: c, angles: a, rings: p, scale: _, labelRoom: w } = D, x = p.length > 0 ? _(p[0]) : c, f = Math.max(1, Math.ceil(De / Math.max(1, x)));
1699
- return /* @__PURE__ */ V("g", { children: [
1700
- /* @__PURE__ */ V("g", { "aria-hidden": !0, className: kt.grid, children: [
1701
- p.map((T) => /* @__PURE__ */ m(
1719
+ }, [P, C, n]), w = L(() => {
1720
+ const { cx: s, cy: l, radius: c, angles: a, rings: f, scale: b, labelRoom: $ } = P, y = f.length > 0 ? b(f[0]) : c, _ = Math.max(1, Math.ceil(Ge / Math.max(1, y))), G = S(f);
1721
+ return /* @__PURE__ */ X("g", { children: [
1722
+ /* @__PURE__ */ X("g", { "aria-hidden": !0, className: kt.grid, children: [
1723
+ f.map((H) => /* @__PURE__ */ u(
1702
1724
  "path",
1703
1725
  {
1704
- d: nn(a.map((O) => et(s, l, _(T), O)))
1726
+ d: en(a.map((j) => et(s, l, b(H), j)))
1705
1727
  },
1706
- T
1728
+ H
1707
1729
  )),
1708
- a.map((T, O) => {
1709
- const X = et(s, l, c, T);
1710
- return /* @__PURE__ */ m("line", { x1: s, y1: l, x2: X.x, y2: X.y }, n[O].key);
1730
+ a.map((H, j) => {
1731
+ const Y = et(s, l, c, H);
1732
+ return /* @__PURE__ */ u("line", { x1: s, y1: l, x2: Y.x, y2: Y.y }, n[j].key);
1711
1733
  })
1712
1734
  ] }),
1713
- M.map((T) => /* @__PURE__ */ m(
1735
+ M.map((H) => /* @__PURE__ */ u(
1714
1736
  "path",
1715
1737
  {
1716
1738
  className: kt.shape,
1717
- d: nn(T.points),
1739
+ d: en(H.points),
1718
1740
  style: {
1719
- fill: `color-mix(in srgb, ${Q(T.tone)} 14%, transparent)`,
1720
- stroke: Q(T.tone)
1741
+ fill: `color-mix(in srgb, ${U(H.tone)} 14%, transparent)`,
1742
+ stroke: U(H.tone)
1721
1743
  }
1722
1744
  },
1723
- T.id
1745
+ H.id
1724
1746
  )),
1725
- /* @__PURE__ */ V("g", { "aria-hidden": !0, className: kt.labels, children: [
1726
- p.map(
1727
- (T, O) => (p.length - 1 - O) % f === 0 ? /* @__PURE__ */ m("text", { x: s + 4, y: l - _(T), dy: "1.1em", children: H(T) }, T) : null
1747
+ /* @__PURE__ */ X("g", { "aria-hidden": !0, className: kt.labels, children: [
1748
+ f.map(
1749
+ (H, j) => (f.length - 1 - j) % _ === 0 ? /* @__PURE__ */ u("text", { x: s + 4, y: l - b(H), dy: "1.1em", children: G[j] }, H) : null
1728
1750
  ),
1729
- n.map((T, O) => {
1730
- const X = a[O], U = et(s, l, c + un, X), G = Math.sin(X), g = Math.cos(X), F = G > 0.3 ? "start" : G < -0.3 ? "end" : "middle", z = g > 0.3 ? "-0.2em" : g < -0.3 ? "0.9em" : "0.32em";
1731
- return /* @__PURE__ */ m(
1751
+ n.map((H, j) => {
1752
+ const Y = a[j], O = et(s, l, c + pn, Y), x = Math.sin(Y), F = Math.cos(Y), E = x > 0.3 ? "start" : x < -0.3 ? "end" : "middle", Z = F > 0.3 ? "-0.2em" : F < -0.3 ? "0.9em" : "0.32em";
1753
+ return /* @__PURE__ */ u(
1732
1754
  "text",
1733
1755
  {
1734
1756
  className: kt.axisLabel,
1735
- x: U.x,
1736
- y: U.y,
1737
- dy: z,
1738
- textAnchor: F,
1739
- children: Et(T.label, F === "middle" ? c * 1.4 : w)
1757
+ x: O.x,
1758
+ y: O.y,
1759
+ dy: Z,
1760
+ textAnchor: E,
1761
+ children: Gt(H.label, E === "middle" ? c * 1.4 : $)
1740
1762
  },
1741
- T.key
1763
+ H.key
1742
1764
  );
1743
1765
  })
1744
1766
  ] })
1745
1767
  ] });
1746
- }, [D, M, n, H]), i = nt(
1768
+ }, [P, M, n, S]), h = nt(
1747
1769
  (s, l) => {
1748
- const { cx: c, cy: a, radius: p, step: _ } = D;
1749
- if (n.length === 0 || Math.hypot(s - c, l - a) > p + Ee) return null;
1750
- let w = Math.atan2(s - c, -(l - a));
1751
- return w < 0 && (w += Math.PI * 2), Math.round(w / _) % n.length;
1770
+ const { cx: c, cy: a, radius: f, step: b } = P;
1771
+ if (n.length === 0 || Math.hypot(s - c, l - a) > f + qe) return null;
1772
+ let $ = Math.atan2(s - c, -(l - a));
1773
+ return $ < 0 && ($ += Math.PI * 2), Math.round($ / b) % n.length;
1752
1774
  },
1753
- [D, n.length]
1754
- ), y = (s) => M.map((l) => {
1775
+ [P, n.length]
1776
+ ), p = (s) => M.map((l) => {
1755
1777
  const c = l.points[s].value;
1756
1778
  return {
1757
1779
  id: l.id,
1758
1780
  label: l.label,
1759
- value: c === null ? "—" : E(c),
1781
+ value: c === null ? "—" : D(c),
1760
1782
  tone: l.tone
1761
1783
  };
1762
1784
  });
1763
- return /* @__PURE__ */ m(
1785
+ return /* @__PURE__ */ u(
1764
1786
  gt,
1765
1787
  {
1766
1788
  label: t,
1767
1789
  description: o,
1768
- containerRef: C,
1769
- width: b,
1770
- height: h,
1771
- plot: $,
1790
+ containerRef: I,
1791
+ width: g,
1792
+ height: i,
1793
+ plot: w,
1772
1794
  overlay: (s) => {
1773
- const { cx: l, cy: c, radius: a, angles: p } = D, _ = et(l, c, a, p[s]);
1774
- return /* @__PURE__ */ V("g", { children: [
1775
- /* @__PURE__ */ m("line", { className: kt.spoke, x1: l, y1: c, x2: _.x, y2: _.y }),
1776
- M.map((w) => {
1777
- const x = w.points[s];
1778
- return x.value === null ? null : /* @__PURE__ */ m(
1795
+ const { cx: l, cy: c, radius: a, angles: f } = P, b = et(l, c, a, f[s]);
1796
+ return /* @__PURE__ */ X("g", { children: [
1797
+ /* @__PURE__ */ u("line", { className: kt.spoke, x1: l, y1: c, x2: b.x, y2: b.y }),
1798
+ M.map(($) => {
1799
+ const y = $.points[s];
1800
+ return y.value === null ? null : /* @__PURE__ */ u(
1779
1801
  "circle",
1780
1802
  {
1781
1803
  className: kt.marker,
1782
- cx: x.x,
1783
- cy: x.y,
1804
+ cx: y.x,
1805
+ cy: y.y,
1784
1806
  r: 4.5,
1785
- style: { fill: Q(w.tone) }
1807
+ style: { fill: U($.tone) }
1786
1808
  },
1787
- w.id
1809
+ $.id
1788
1810
  );
1789
1811
  })
1790
1812
  ] });
1791
1813
  },
1792
1814
  itemCount: n.length,
1793
- pick: i,
1794
- tooltip: (s) => ({ title: n[s].label, rows: y(s) }),
1815
+ pick: h,
1816
+ tooltip: (s) => ({ title: n[s].label, rows: p(s) }),
1795
1817
  anchor: (s) => {
1796
- const { cx: l, cy: c, radius: a, angles: p } = D;
1797
- let _ = 0;
1798
- for (const w of M) {
1799
- const x = w.points[s];
1800
- _ = Math.max(_, Math.hypot(x.x - l, x.y - c));
1818
+ const { cx: l, cy: c, radius: a, angles: f } = P;
1819
+ let b = 0;
1820
+ for (const $ of M) {
1821
+ const y = $.points[s];
1822
+ b = Math.max(b, Math.hypot(y.x - l, y.y - c));
1801
1823
  }
1802
- return et(l, c, Math.min(a, _), p[s]);
1824
+ return et(l, c, Math.min(a, b), f[s]);
1803
1825
  },
1804
1826
  tooltipSide: "outward",
1805
- announce: (s) => `${n[s].label}: ${y(s).map((l) => `${l.label} ${l.value}`).join(", ")}`,
1827
+ announce: (s) => `${n[s].label}: ${p(s).map((l) => `${l.label} ${l.value}`).join(", ")}`,
1806
1828
  table: {
1807
1829
  columns: [t, ...N.map((s) => s.label)],
1808
1830
  rows: n.map((s) => [
1809
1831
  s.label,
1810
1832
  ...N.map((l) => {
1811
- const c = Vt(l, s.key);
1812
- return c === null ? "—" : E(c);
1833
+ const c = Xt(l, s.key);
1834
+ return c === null ? "—" : D(c);
1813
1835
  })
1814
1836
  ])
1815
1837
  },
1816
1838
  legend: N.length > 1 ? {
1817
1839
  entries: N.map((s) => ({ id: s.id, label: s.label, tone: s.tone })),
1818
- hidden: S,
1819
- onToggle: (s) => P((l) => {
1840
+ hidden: R,
1841
+ onToggle: (s) => z((l) => {
1820
1842
  const c = new Set(l);
1821
1843
  return c.has(s) ? c.delete(s) : N.length - l.size > 1 && c.add(s), c;
1822
1844
  })
1823
1845
  } : void 0,
1824
1846
  className: k,
1825
- testId: I
1847
+ testId: T
1826
1848
  }
1827
1849
  );
1828
- }, Ke = /* @__PURE__ */ ot(
1829
- /* @__PURE__ */ lt(Ge, "RadarChart")
1850
+ }, no = /* @__PURE__ */ ot(
1851
+ /* @__PURE__ */ it(Oe, "RadarChart")
1830
1852
  );
1831
1853
  export {
1832
- je as AreaChart,
1833
- Ve as BarChart,
1834
- Qe as BoxPlot,
1835
- Xe as ComposedChart,
1836
- Ue as Heatmap,
1837
- Je as Histogram,
1838
- We as LineChart,
1839
- Ye as PieChart,
1840
- Ke as RadarChart,
1841
- Ze as ScatterPlot
1854
+ Xe as AreaChart,
1855
+ Ye as BarChart,
1856
+ Ke as BoxPlot,
1857
+ Ze as ComposedChart,
1858
+ Je as Heatmap,
1859
+ to as Histogram,
1860
+ je as LineChart,
1861
+ Ue as PieChart,
1862
+ no as RadarChart,
1863
+ Qe as ScatterPlot
1842
1864
  };
1843
1865
  //# sourceMappingURL=charts.js.map