uplot-plus 0.1.5 → 0.2.0

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/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import { jsx as X, jsxs as Q, Fragment as Pe } from "react/jsx-runtime";
2
- import { useRef as E, useContext as Le, createContext as De, useEffect as Y, useState as St, useCallback as q, useSyncExternalStore as fe, memo as ze, useLayoutEffect as zt } from "react";
3
- var U = /* @__PURE__ */ ((t) => (t[t.Top = 0] = "Top", t[t.Right = 1] = "Right", t[t.Bottom = 2] = "Bottom", t[t.Left = 3] = "Left", t))(U || {}), G = /* @__PURE__ */ ((t) => (t[t.Horizontal = 0] = "Horizontal", t[t.Vertical = 1] = "Vertical", t))(G || {}), K = /* @__PURE__ */ ((t) => (t[t.Forward = 1] = "Forward", t[t.Backward = -1] = "Backward", t))(K || {}), N = /* @__PURE__ */ ((t) => (t[t.Linear = 1] = "Linear", t[t.Ordinal = 2] = "Ordinal", t[t.Log = 3] = "Log", t[t.Asinh = 4] = "Asinh", t))(N || {}), yt = /* @__PURE__ */ ((t) => (t[t.Ascending = 1] = "Ascending", t[t.Descending = -1] = "Descending", t[t.Unsorted = 0] = "Unsorted", t))(yt || {});
4
- function Mt(t) {
2
+ import { useRef as E, useContext as Le, createContext as ze, useEffect as K, useState as St, useCallback as Z, useSyncExternalStore as fe, memo as De, useLayoutEffect as Dt } from "react";
3
+ var U = /* @__PURE__ */ ((t) => (t[t.Top = 0] = "Top", t[t.Right = 1] = "Right", t[t.Bottom = 2] = "Bottom", t[t.Left = 3] = "Left", t))(U || {}), V = /* @__PURE__ */ ((t) => (t[t.Horizontal = 0] = "Horizontal", t[t.Vertical = 1] = "Vertical", t))(V || {}), N = /* @__PURE__ */ ((t) => (t[t.Forward = 1] = "Forward", t[t.Backward = -1] = "Backward", t))(N || {}), q = /* @__PURE__ */ ((t) => (t[t.Linear = 1] = "Linear", t[t.Ordinal = 2] = "Ordinal", t[t.Log = 3] = "Log", t[t.Asinh = 4] = "Asinh", t))(q || {}), yt = /* @__PURE__ */ ((t) => (t[t.Ascending = 1] = "Ascending", t[t.Descending = -1] = "Descending", t[t.Unsorted = 0] = "Unsorted", t))(yt || {});
4
+ function xt(t) {
5
5
  return t % 2;
6
6
  }
7
7
  var tt = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Scales = 1] = "Scales", t[t.Axes = 2] = "Axes", t[t.Paths = 4] = "Paths", t[t.Cursor = 8] = "Cursor", t[t.Select = 16] = "Select", t[t.Size = 32] = "Size", t[t.Full = 63] = "Full", t))(tt || {});
8
- const J = Math, _t = J.PI, gt = J.abs, st = J.floor, $ = J.round, Tt = J.ceil, qt = J.min, kt = J.max, wt = J.pow, Zt = J.sign, et = J.log10, xt = J.log2, Fe = (t, e = 1) => J.sinh(t) * e, Wt = (t, e = 1) => J.asinh(t / e), Z = 1 / 0, he = Number.isInteger;
8
+ const J = Math, _t = J.PI, pt = J.abs, ot = J.floor, _ = J.round, Tt = J.ceil, Zt = J.min, kt = J.max, wt = J.pow, Ot = J.sign, et = J.log10, Mt = J.log2, Fe = (t, e = 1) => J.sinh(t) * e, Et = (t, e = 1) => J.asinh(t / e), O = 1 / 0, he = Number.isInteger;
9
9
  function Vt(t, e) {
10
10
  return t[e] ?? 0;
11
11
  }
12
- function ct(t, e, n = 0, s = e.length - 1) {
12
+ function ut(t, e, n = 0, s = e.length - 1) {
13
13
  let o;
14
14
  const i = s <= 2147483647;
15
15
  for (; s - n > 1; )
16
- o = i ? n + s >> 1 : st((n + s) / 2), Vt(e, o) < t ? n = o : s = o;
16
+ o = i ? n + s >> 1 : ot((n + s) / 2), Vt(e, o) < t ? n = o : s = o;
17
17
  return t - Vt(e, n) <= Vt(e, s) - t ? n : s;
18
18
  }
19
19
  const de = (t) => t != null, ge = (t) => t != null && t > 0;
@@ -36,34 +36,34 @@ function pe(t) {
36
36
  const Ft = pe(de), me = pe(ge);
37
37
  function Re(t, e, n, s = yt.Unsorted, o = !1) {
38
38
  const i = o ? me : Ft, l = o ? ge : de, [r, a] = i(t, e, n);
39
- let c = t[r] ?? Z, u = t[r] ?? -Z;
39
+ let u = t[r] ?? O, c = t[r] ?? -O;
40
40
  if (r > -1)
41
41
  if (s === yt.Ascending)
42
- c = t[r] ?? Z, u = t[a] ?? -Z;
42
+ u = t[r] ?? O, c = t[a] ?? -O;
43
43
  else if (s === yt.Descending)
44
- c = t[a] ?? Z, u = t[r] ?? -Z;
44
+ u = t[a] ?? O, c = t[r] ?? -O;
45
45
  else
46
- for (let d = r; d <= a; d++) {
47
- const f = t[d];
48
- f != null && l(f) && (f < c ? c = f : f > u && (u = f));
46
+ for (let h = r; h <= a; h++) {
47
+ const f = t[h];
48
+ f != null && l(f) && (f < u ? u = f : f > c && (c = f));
49
49
  }
50
- return [c, u];
50
+ return [u, c];
51
51
  }
52
- function ut(t, e = 0) {
52
+ function ft(t, e = 0) {
53
53
  if (he(t))
54
54
  return t;
55
55
  const n = 10 ** e, s = t * n * (1 + Number.EPSILON);
56
- return $(s) / n;
56
+ return _(s) / n;
57
57
  }
58
58
  const vt = /* @__PURE__ */ new Map();
59
- function He(t) {
59
+ function Ge(t) {
60
60
  return (String(t).split(".")[1] ?? "").length;
61
61
  }
62
- const Ge = /\.\d*?(?=9{6,}|0{6,})/gm;
62
+ const He = /\.\d*?(?=9{6,}|0{6,})/gm;
63
63
  function It(t) {
64
64
  if (he(t) || vt.has(t))
65
65
  return t;
66
- const e = `${t}`, n = e.match(Ge);
66
+ const e = `${t}`, n = e.match(He);
67
67
  if (n == null)
68
68
  return t;
69
69
  const s = n[0].length - 1;
@@ -71,26 +71,26 @@ function It(t) {
71
71
  const o = e.split("e"), i = o[0] ?? "0", l = o[1] ?? "0";
72
72
  return +`${It(+i)}e${l}`;
73
73
  }
74
- return ut(t, s);
74
+ return ft(t, s);
75
75
  }
76
- function Et(t, e, n = !0) {
76
+ function Xt(t, e, n = !0) {
77
77
  return n ? It(Tt(It(t / e)) * e) : Tt(t / e) * e;
78
78
  }
79
79
  function we(t, e, n = !0) {
80
- return n ? It(st(It(t / e)) * e) : st(t / e) * e;
80
+ return n ? It(ot(It(t / e)) * e) : ot(t / e) * e;
81
81
  }
82
82
  function ve(t, e, n, s) {
83
- const o = [], i = s.map(He);
83
+ const o = [], i = s.map(Ge);
84
84
  for (let l = e; l < n; l++) {
85
- const r = gt(l);
85
+ const r = pt(l);
86
86
  for (let a = 0; a < s.length; a++) {
87
- const c = s[a] ?? 0, u = i[a] ?? 0, d = +`${c}e${l}`, f = (l >= 0 ? 0 : r) + (l >= u ? 0 : u), g = d;
88
- o.push(g), vt.set(g, f);
87
+ const u = s[a] ?? 0, c = i[a] ?? 0, h = +`${u}e${l}`, f = (l >= 0 ? 0 : r) + (l >= c ? 0 : c), d = h;
88
+ o.push(d), vt.set(d, f);
89
89
  }
90
90
  }
91
91
  return o;
92
92
  }
93
- const _e = new Intl.NumberFormat(), Me = (t) => _e.format(t), Ve = 0.1, lt = {
93
+ const _e = new Intl.NumberFormat(), xe = (t) => _e.format(t), Ve = 0.1, it = {
94
94
  mode: 3,
95
95
  pad: Ve,
96
96
  soft: null
@@ -98,31 +98,31 @@ const _e = new Intl.NumberFormat(), Me = (t) => _e.format(t), Ve = 0.1, lt = {
98
98
  function bt(t, e, n, s) {
99
99
  let o;
100
100
  typeof n == "number" ? (Ct.pad = n, Ct.soft = null, Ct.mode = 0, o = $e) : o = n;
101
- const i = o.min, l = o.max, r = i.pad, a = l.pad, c = i.hard ?? -Z, u = l.hard ?? Z, d = i.soft ?? Z, f = l.soft ?? -Z, g = i.mode, v = l.mode;
102
- let x = e - t;
103
- const L = et(x), h = kt(gt(t), gt(e)), I = et(h), P = gt(I - L);
104
- (x < 1e-24 || P > 10) && (x = 0, (t === 0 || e === 0) && (x = 1e-24));
105
- const D = x || h || 1e3, T = et(D), M = wt(10, st(T)), S = D * (x === 0 ? t === 0 ? 0.1 : 1 : r), b = ut(we(t - S, M / 10), 24), C = t >= d && (g === 1 || g === 3 && b <= d || g === 2 && b >= d) ? d : Z, z = kt(c, b < C && t >= C ? C : qt(C, b)), p = D * (x === 0 ? e === 0 ? 0.1 : 1 : a), m = ut(Et(e + p, M / 10), 24), w = e <= f && (v === 1 || v === 3 && m >= f || v === 2 && m <= f) ? f : -Z, y = qt(u, m > w && e <= w ? w : kt(w, m));
106
- return z === y && z === 0 ? [-1, 1] : [z, y];
101
+ const i = o.min, l = o.max, r = i.pad, a = l.pad, u = i.hard ?? -O, c = l.hard ?? O, h = i.soft ?? O, f = l.soft ?? -O, d = i.mode, x = l.mode;
102
+ let b = e - t;
103
+ const L = et(b), g = kt(pt(t), pt(e)), w = et(g), P = pt(w - L);
104
+ (b < 1e-24 || P > 10) && (b = 0, (t === 0 || e === 0) && (b = 1e-24));
105
+ const z = b || g || 1e3, T = et(z), S = wt(10, ot(T)), C = z * (b === 0 ? t === 0 ? 0.1 : 1 : r), v = ft(we(t - C, S / 10), 24), I = t >= h && (d === 1 || d === 3 && v <= h || d === 2 && v >= h) ? h : O, D = kt(u, v < I && t >= I ? I : Zt(I, v)), m = z * (b === 0 ? e === 0 ? 0.1 : 1 : a), p = ft(Xt(e + m, S / 10), 24), M = e <= f && (x === 1 || x === 3 && p >= f || x === 2 && p <= f) ? f : -O, k = Zt(c, p > M && e <= M ? M : kt(M, p));
106
+ return D === k && D === 0 ? [-1, 1] : [D, k];
107
107
  }
108
108
  function Be(t, e, n, s) {
109
109
  n === 2 && (s = !0);
110
- const o = Zt(t), i = Zt(e);
110
+ const o = Ot(t), i = Ot(e);
111
111
  t === e && (o === -1 ? (t *= n, e /= n) : (t /= n, e *= n));
112
- const l = n === 10 ? et : xt, r = o === 1 ? st : Tt, a = i === 1 ? Tt : st, c = l(gt(t)), u = l(gt(e)), d = r(c), f = a(u);
113
- let g = wt(n, d), v = wt(n, f);
114
- return n === 10 && (d < 0 && (g = ut(g, -d)), f < 0 && (v = ut(v, -f))), s ? (t = g * o, e = v * i) : (t = we(t, wt(n, st(c)), !1), e = Et(e, wt(n, st(u)), !1)), [t, e];
112
+ const l = n === 10 ? et : Mt, r = o === 1 ? ot : Tt, a = i === 1 ? Tt : ot, u = l(pt(t)), c = l(pt(e)), h = r(u), f = a(c);
113
+ let d = wt(n, h), x = wt(n, f);
114
+ return n === 10 && (h < 0 && (d = ft(d, -h)), f < 0 && (x = ft(x, -f))), s ? (t = d * o, e = x * i) : (t = we(t, wt(n, ot(u)), !1), e = Xt(e, wt(n, ot(c)), !1)), [t, e];
115
115
  }
116
- function Ot(t) {
116
+ function Jt(t) {
117
117
  return (et((t ^ t >> 31) - (t >> 31)) | 0) + 1;
118
118
  }
119
119
  function We(t, e, n, s, o) {
120
- const i = kt(Ot(t), Ot(e)), l = e - t;
121
- let r = kt(0, ct(o / s * l, n) - 1);
120
+ const i = kt(Jt(t), Jt(e)), l = e - t;
121
+ let r = kt(0, ut(o / s * l, n) - 1);
122
122
  do {
123
- const a = n[r] ?? 0, c = s * a / l;
124
- if (c >= o * 0.9 && i + (a < 5 ? vt.get(a) ?? 0 : 0) <= 17)
125
- return [a, c];
123
+ const a = n[r] ?? 0, u = s * a / l;
124
+ if (u >= o * 0.9 && i + (a < 5 ? vt.get(a) ?? 0 : 0) <= 17)
125
+ return [a, u];
126
126
  } while (++r < n.length);
127
127
  return [0, 0];
128
128
  }
@@ -131,11 +131,11 @@ function Ee(t) {
131
131
  id: t.id,
132
132
  min: t.min ?? null,
133
133
  max: t.max ?? null,
134
- distr: t.distr ?? N.Linear,
134
+ distr: t.distr ?? q.Linear,
135
135
  log: t.log ?? 10,
136
136
  asinh: t.asinh ?? 1,
137
- ori: t.ori ?? (t.id === "x" ? G.Horizontal : G.Vertical),
138
- dir: t.dir ?? K.Forward,
137
+ ori: t.ori ?? (t.id === "x" ? V.Horizontal : V.Vertical),
138
+ dir: t.dir ?? N.Forward,
139
139
  time: t.time ?? !1,
140
140
  auto: t.auto ?? !0,
141
141
  range: t.range ?? null,
@@ -143,58 +143,58 @@ function Ee(t) {
143
143
  _max: null
144
144
  };
145
145
  }
146
- function at(t) {
146
+ function ct(t) {
147
147
  t._min = null, t._max = null;
148
148
  }
149
- function xe(t) {
149
+ function Me(t) {
150
150
  if (t._min != null) return t._min;
151
151
  const { min: e, distr: n } = t;
152
152
  if (e == null) return 0;
153
- if (n === N.Log) {
153
+ if (n === q.Log) {
154
154
  const s = e > 0 ? e : 1e-10;
155
- t._min = (t.log === 10 ? et : xt)(s);
156
- } else n === N.Asinh ? t._min = Wt(e, t.asinh) : t._min = e;
155
+ t._min = (t.log === 10 ? et : Mt)(s);
156
+ } else n === q.Asinh ? t._min = Et(e, t.asinh) : t._min = e;
157
157
  return t._min;
158
158
  }
159
159
  function be(t) {
160
160
  if (t._max != null) return t._max;
161
161
  const { max: e, distr: n } = t;
162
162
  if (e == null) return 0;
163
- if (n === N.Log) {
163
+ if (n === q.Log) {
164
164
  const s = e > 0 ? e : 1e-10;
165
- t._max = (t.log === 10 ? et : xt)(s);
166
- } else n === N.Asinh ? t._max = Wt(e, t.asinh) : t._max = e;
165
+ t._max = (t.log === 10 ? et : Mt)(s);
166
+ } else n === q.Asinh ? t._max = Et(e, t.asinh) : t._max = e;
167
167
  return t._max;
168
168
  }
169
169
  function Xe(t, e) {
170
170
  if (e.min == null || e.max == null) return 0;
171
- const n = xe(e), o = be(e) - n;
171
+ const n = Me(e), o = be(e) - n;
172
172
  if (o === 0) return 0;
173
173
  const { distr: i } = e;
174
- if (i === N.Log) {
175
- const l = e.log === 10 ? et : xt, r = t > 0 ? t : 1e-10;
174
+ if (i === q.Log) {
175
+ const l = e.log === 10 ? et : Mt, r = t > 0 ? t : 1e-10;
176
176
  return (l(r) - n) / o;
177
177
  }
178
- return i === N.Asinh ? (Wt(t, e.asinh) - n) / o : (t - n) / o;
178
+ return i === q.Asinh ? (Et(t, e.asinh) - n) / o : (t - n) / o;
179
179
  }
180
180
  function Ye(t, e) {
181
181
  if (e.min == null || e.max == null) return 0;
182
- const n = xe(e), s = be(e);
182
+ const n = Me(e), s = be(e);
183
183
  if (s === n) return e.min;
184
184
  const { distr: o } = e;
185
- return o === N.Log ? Math.pow(e.log, n + t * (s - n)) : o === N.Asinh ? Fe(n + t * (s - n), e.asinh) : n + t * (s - n);
185
+ return o === q.Log ? Math.pow(e.log, n + t * (s - n)) : o === q.Asinh ? Fe(n + t * (s - n), e.asinh) : n + t * (s - n);
186
186
  }
187
- function _(t, e, n, s) {
187
+ function $(t, e, n, s) {
188
188
  const o = Xe(t, e);
189
189
  let i;
190
- return e.ori === G.Horizontal ? i = e.dir === K.Forward ? o : 1 - o : i = e.dir === K.Forward ? 1 - o : o, s + i * n;
190
+ return e.ori === V.Horizontal ? i = e.dir === N.Forward ? o : 1 - o : i = e.dir === N.Forward ? 1 - o : o, s + i * n;
191
191
  }
192
- function it(t, e, n, s) {
192
+ function rt(t, e, n, s) {
193
193
  if (n === 0) return e.min ?? 0;
194
194
  let o = (t - s) / n;
195
- return e.ori === G.Horizontal ? e.dir === K.Backward && (o = 1 - o) : e.dir !== K.Backward && (o = 1 - o), Ye(o, e);
195
+ return e.ori === V.Horizontal ? e.dir === N.Backward && (o = 1 - o) : e.dir !== N.Backward && (o = 1 - o), Ye(o, e);
196
196
  }
197
- class Ue {
197
+ class Ke {
198
198
  constructor() {
199
199
  this.scales = /* @__PURE__ */ new Map(), this.groupXScales = /* @__PURE__ */ new Map();
200
200
  }
@@ -224,7 +224,7 @@ class Ue {
224
224
  */
225
225
  setRange(e, n, s) {
226
226
  const o = this.scales.get(e);
227
- o && (o.min = n, o.max = s, at(o));
227
+ o && (o.min = n, o.max = s, ct(o));
228
228
  }
229
229
  /**
230
230
  * Auto-range only x-scales from data (cheap: just reads first/last x values).
@@ -233,31 +233,31 @@ class Ue {
233
233
  autoRangeX(e) {
234
234
  var s, o, i, l, r, a;
235
235
  const n = /* @__PURE__ */ new Map();
236
- for (const [c, u] of this.groupXScales) {
237
- const d = this.scales.get(u);
238
- if (!d || !d.auto) continue;
239
- const f = e[c];
236
+ for (const [u, c] of this.groupXScales) {
237
+ const h = this.scales.get(c);
238
+ if (!h || !h.auto) continue;
239
+ const f = e[u];
240
240
  if (!f || f.x.length === 0) continue;
241
- const g = f.x[0], v = f.x[f.x.length - 1];
242
- if (g == null || v == null) continue;
243
- const x = n.get(u);
244
- x ? (x.dataMin = Math.min(x.dataMin, g), x.dataMax = Math.max(x.dataMax, v)) : n.set(u, { dataMin: g, dataMax: v });
241
+ const d = f.x[0], x = f.x[f.x.length - 1];
242
+ if (d == null || x == null) continue;
243
+ const b = n.get(c);
244
+ b ? (b.dataMin = Math.min(b.dataMin, d), b.dataMax = Math.max(b.dataMax, x)) : n.set(c, { dataMin: d, dataMax: x });
245
245
  }
246
- for (const [c, { dataMin: u, dataMax: d }] of n) {
247
- const f = this.scales.get(c);
246
+ for (const [u, { dataMin: c, dataMax: h }] of n) {
247
+ const f = this.scales.get(u);
248
248
  if (f) {
249
249
  if (f.range) {
250
- const [g, v] = bt(u, d, {
250
+ const [d, x] = bt(c, h, {
251
251
  min: { pad: ((s = f.range.min) == null ? void 0 : s.pad) ?? 0, soft: ((o = f.range.min) == null ? void 0 : o.soft) ?? null, mode: ((i = f.range.min) == null ? void 0 : i.mode) ?? 0 },
252
252
  max: { pad: ((l = f.range.max) == null ? void 0 : l.pad) ?? 0, soft: ((r = f.range.max) == null ? void 0 : r.soft) ?? null, mode: ((a = f.range.max) == null ? void 0 : a.mode) ?? 0 }
253
253
  });
254
- f.min = g, f.max = v;
254
+ f.min = d, f.max = x;
255
255
  } else
256
- u === d ? [f.min, f.max] = bt(u, d, {
256
+ c === h ? [f.min, f.max] = bt(c, h, {
257
257
  min: { pad: 0.1, soft: null, mode: 0 },
258
258
  max: { pad: 0.1, soft: null, mode: 0 }
259
- }) : (f.min = u, f.max = d);
260
- at(f);
259
+ }) : (f.min = c, f.max = h);
260
+ ct(f);
261
261
  }
262
262
  }
263
263
  }
@@ -267,66 +267,66 @@ class Ue {
267
267
  * For each y-scale: range from all series that reference it, within the visible x-window.
268
268
  */
269
269
  autoRange(e, n, s) {
270
- var r, a, c, u, d, f, g, v, x, L, h, I;
270
+ var r, a, u, c, h, f, d, x, b, L, g, w;
271
271
  const o = /* @__PURE__ */ new Map();
272
- for (const [P, D] of this.groupXScales) {
273
- const T = this.scales.get(D);
272
+ for (const [P, z] of this.groupXScales) {
273
+ const T = this.scales.get(z);
274
274
  if (!T || !T.auto) continue;
275
- const M = e[P];
276
- if (!M || M.x.length === 0) continue;
277
- const S = M.x[0], b = M.x[M.x.length - 1];
278
- if (S == null || b == null) continue;
279
- const C = o.get(D);
280
- C ? (C.dataMin = Math.min(C.dataMin, S), C.dataMax = Math.max(C.dataMax, b)) : o.set(D, { dataMin: S, dataMax: b });
281
- }
282
- for (const [P, { dataMin: D, dataMax: T }] of o) {
283
- const M = this.scales.get(P);
284
- if (M) {
285
- if (M.range) {
286
- const [S, b] = bt(D, T, {
287
- min: { pad: ((r = M.range.min) == null ? void 0 : r.pad) ?? 0, soft: ((a = M.range.min) == null ? void 0 : a.soft) ?? null, mode: ((c = M.range.min) == null ? void 0 : c.mode) ?? 0 },
288
- max: { pad: ((u = M.range.max) == null ? void 0 : u.pad) ?? 0, soft: ((d = M.range.max) == null ? void 0 : d.soft) ?? null, mode: ((f = M.range.max) == null ? void 0 : f.mode) ?? 0 }
275
+ const S = e[P];
276
+ if (!S || S.x.length === 0) continue;
277
+ const C = S.x[0], v = S.x[S.x.length - 1];
278
+ if (C == null || v == null) continue;
279
+ const I = o.get(z);
280
+ I ? (I.dataMin = Math.min(I.dataMin, C), I.dataMax = Math.max(I.dataMax, v)) : o.set(z, { dataMin: C, dataMax: v });
281
+ }
282
+ for (const [P, { dataMin: z, dataMax: T }] of o) {
283
+ const S = this.scales.get(P);
284
+ if (S) {
285
+ if (S.range) {
286
+ const [C, v] = bt(z, T, {
287
+ min: { pad: ((r = S.range.min) == null ? void 0 : r.pad) ?? 0, soft: ((a = S.range.min) == null ? void 0 : a.soft) ?? null, mode: ((u = S.range.min) == null ? void 0 : u.mode) ?? 0 },
288
+ max: { pad: ((c = S.range.max) == null ? void 0 : c.pad) ?? 0, soft: ((h = S.range.max) == null ? void 0 : h.soft) ?? null, mode: ((f = S.range.max) == null ? void 0 : f.mode) ?? 0 }
289
289
  });
290
- M.min = S, M.max = b;
290
+ S.min = C, S.max = v;
291
291
  } else
292
- D === T ? [M.min, M.max] = bt(D, T, {
292
+ z === T ? [S.min, S.max] = bt(z, T, {
293
293
  min: { pad: 0.1, soft: null, mode: 0 },
294
294
  max: { pad: 0.1, soft: null, mode: 0 }
295
- }) : (M.min = D, M.max = T);
296
- at(M);
295
+ }) : (S.min = z, S.max = T);
296
+ ct(S);
297
297
  }
298
298
  }
299
299
  const i = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
300
- for (const { group: P, index: D, yScale: T } of n) {
301
- const M = e[P];
302
- if (!M) continue;
303
- const S = M.series[D];
304
- if (!S || S.length === 0) continue;
305
- const b = s.windows.get(P), C = b ? b[0] : 0, z = b ? b[1] : S.length - 1, p = this.scales.get(T), m = (p == null ? void 0 : p.distr) === N.Log, [w, y] = s.getCachedMinMax(P, D, C, z, 0, m), k = i.get(T), A = l.get(T);
306
- i.set(T, k != null ? Math.min(k, w) : w), l.set(T, A != null ? Math.max(A, y) : y);
307
- }
308
- for (const [P, D] of i) {
300
+ for (const { group: P, index: z, yScale: T } of n) {
301
+ const S = e[P];
302
+ if (!S) continue;
303
+ const C = S.series[z];
304
+ if (!C || C.length === 0) continue;
305
+ const v = s.windows.get(P), I = v ? v[0] : 0, D = v ? v[1] : C.length - 1, m = this.scales.get(T), p = (m == null ? void 0 : m.distr) === q.Log, [M, k] = s.getCachedMinMax(P, z, I, D, 0, p), y = i.get(T), A = l.get(T);
306
+ i.set(T, y != null ? Math.min(y, M) : M), l.set(T, A != null ? Math.max(A, k) : k);
307
+ }
308
+ for (const [P, z] of i) {
309
309
  const T = this.scales.get(P);
310
310
  if (!T || !T.auto) continue;
311
- const M = l.get(P) ?? -Z;
312
- if (D === Z) continue;
313
- let S, b;
314
- if (T.distr === N.Log)
315
- [S, b] = Be(D, M, T.log, !1);
311
+ const S = l.get(P) ?? -O;
312
+ if (z === O) continue;
313
+ let C, v;
314
+ if (T.distr === q.Log)
315
+ [C, v] = Be(z, S, T.log, !1);
316
316
  else {
317
- const C = T.range ?? { min: lt, max: lt };
318
- [S, b] = bt(D, M, {
319
- min: { pad: ((g = C.min) == null ? void 0 : g.pad) ?? lt.pad, soft: ((v = C.min) == null ? void 0 : v.soft) ?? lt.soft, mode: ((x = C.min) == null ? void 0 : x.mode) ?? lt.mode },
320
- max: { pad: ((L = C.max) == null ? void 0 : L.pad) ?? lt.pad, soft: ((h = C.max) == null ? void 0 : h.soft) ?? lt.soft, mode: ((I = C.max) == null ? void 0 : I.mode) ?? lt.mode }
317
+ const I = T.range ?? { min: it, max: it };
318
+ [C, v] = bt(z, S, {
319
+ min: { pad: ((d = I.min) == null ? void 0 : d.pad) ?? it.pad, soft: ((x = I.min) == null ? void 0 : x.soft) ?? it.soft, mode: ((b = I.min) == null ? void 0 : b.mode) ?? it.mode },
320
+ max: { pad: ((L = I.max) == null ? void 0 : L.pad) ?? it.pad, soft: ((g = I.max) == null ? void 0 : g.soft) ?? it.soft, mode: ((w = I.max) == null ? void 0 : w.mode) ?? it.mode }
321
321
  });
322
322
  }
323
- T.min = S, T.max = b, at(T);
323
+ T.min = C, T.max = v, ct(T);
324
324
  }
325
325
  }
326
326
  }
327
- const Ke = 1024;
327
+ const Ue = 1024;
328
328
  class Ne {
329
- constructor(e, n = Ke) {
329
+ constructor(e, n = Ue) {
330
330
  this.data = e, this.len = e.length, this.blockSize = n, this.nBlocks = Math.ceil(e.length / n), this.blocks = new Float64Array(this.nBlocks * 2), this.buildAll();
331
331
  }
332
332
  /** Build min/max for all blocks */
@@ -334,12 +334,12 @@ class Ne {
334
334
  const { data: e, blockSize: n, nBlocks: s, blocks: o, len: i } = this;
335
335
  for (let l = 0; l < s; l++) {
336
336
  const r = l * n, a = Math.min(r + n, i);
337
- let c = 1 / 0, u = -1 / 0;
338
- for (let d = r; d < a; d++) {
339
- const f = e[d];
340
- f != null && (f < c && (c = f), f > u && (u = f));
337
+ let u = 1 / 0, c = -1 / 0;
338
+ for (let h = r; h < a; h++) {
339
+ const f = e[h];
340
+ f != null && (f < u && (u = f), f > c && (c = f));
341
341
  }
342
- o[l * 2] = c, o[l * 2 + 1] = u;
342
+ o[l * 2] = u, o[l * 2 + 1] = c;
343
343
  }
344
344
  }
345
345
  /**
@@ -349,27 +349,27 @@ class Ne {
349
349
  rangeMinMax(e, n) {
350
350
  const { data: s, blockSize: o, blocks: i } = this;
351
351
  let l = 1 / 0, r = -1 / 0;
352
- const a = Math.floor(e / o), c = Math.floor(n / o);
353
- if (a === c) {
352
+ const a = Math.floor(e / o), u = Math.floor(n / o);
353
+ if (a === u) {
354
354
  for (let f = e; f <= n; f++) {
355
- const g = s[f];
356
- g != null && (g < l && (l = g), g > r && (r = g));
355
+ const d = s[f];
356
+ d != null && (d < l && (l = d), d > r && (r = d));
357
357
  }
358
358
  return [l, r];
359
359
  }
360
- const u = (a + 1) * o - 1;
361
- for (let f = e; f <= u; f++) {
362
- const g = s[f];
363
- g != null && (g < l && (l = g), g > r && (r = g));
360
+ const c = (a + 1) * o - 1;
361
+ for (let f = e; f <= c; f++) {
362
+ const d = s[f];
363
+ d != null && (d < l && (l = d), d > r && (r = d));
364
364
  }
365
- for (let f = a + 1; f < c; f++) {
366
- const g = i[f * 2] ?? 1 / 0, v = i[f * 2 + 1] ?? -1 / 0;
367
- g < l && (l = g), v > r && (r = v);
365
+ for (let f = a + 1; f < u; f++) {
366
+ const d = i[f * 2] ?? 1 / 0, x = i[f * 2 + 1] ?? -1 / 0;
367
+ d < l && (l = d), x > r && (r = x);
368
368
  }
369
- const d = c * o;
370
- for (let f = d; f <= n; f++) {
371
- const g = s[f];
372
- g != null && (g < l && (l = g), g > r && (r = g));
369
+ const h = u * o;
370
+ for (let f = h; f <= n; f++) {
371
+ const d = s[f];
372
+ d != null && (d < l && (l = d), d > r && (r = d));
373
373
  }
374
374
  return [l, r];
375
375
  }
@@ -381,12 +381,12 @@ class Ne {
381
381
  const { data: n, blockSize: s, blocks: o, len: i } = this;
382
382
  if (e >= this.nBlocks) return;
383
383
  const l = e * s, r = Math.min(l + s, i);
384
- let a = 1 / 0, c = -1 / 0;
385
- for (let u = l; u < r; u++) {
386
- const d = n[u];
387
- d != null && (d < a && (a = d), d > c && (c = d));
384
+ let a = 1 / 0, u = -1 / 0;
385
+ for (let c = l; c < r; c++) {
386
+ const h = n[c];
387
+ h != null && (h < a && (a = h), h > u && (u = h));
388
388
  }
389
- o[e * 2] = a, o[e * 2 + 1] = c;
389
+ o[e * 2] = a, o[e * 2 + 1] = u;
390
390
  }
391
391
  /**
392
392
  * Grow the tree to accommodate new data length.
@@ -437,20 +437,20 @@ class je {
437
437
  let n = !1;
438
438
  for (let o = 0; o < this.data.length; o++) {
439
439
  const i = this.data[o], l = e(o), r = this.windows.get(o);
440
- let a, c;
440
+ let a, u;
441
441
  if (!i || !l || l.min == null || l.max == null)
442
- a = 0, c = Math.max(0, ((i == null ? void 0 : i.x.length) ?? 1) - 1);
442
+ a = 0, u = Math.max(0, ((i == null ? void 0 : i.x.length) ?? 1) - 1);
443
443
  else {
444
- const u = i.x;
445
- if (u.length === 0)
446
- a = 0, c = 0;
444
+ const c = i.x;
445
+ if (c.length === 0)
446
+ a = 0, u = 0;
447
447
  else {
448
- a = ct(l.min, u), c = ct(l.max, u);
449
- const d = u[a], f = u[c];
450
- a > 0 && d != null && d > l.min && a--, c < u.length - 1 && f != null && f < l.max && c++;
448
+ a = ut(l.min, c), u = ut(l.max, c);
449
+ const h = c[a], f = c[u];
450
+ a > 0 && h != null && h > l.min && a--, u < c.length - 1 && f != null && f < l.max && u++;
451
451
  }
452
452
  }
453
- (!r || r[0] !== a || r[1] !== c) && (n = !0, (s = this.minMaxCache.get(o)) == null || s.clear()), this.windows.set(o, [a, c]);
453
+ (!r || r[0] !== a || r[1] !== u) && (n = !0, (s = this.minMaxCache.get(o)) == null || s.clear()), this.windows.set(o, [a, u]);
454
454
  }
455
455
  return n;
456
456
  }
@@ -474,17 +474,17 @@ class je {
474
474
  let r = this.minMaxCache.get(e);
475
475
  const a = `${n}:${s}:${o}`;
476
476
  if (r) {
477
- const g = r.get(a);
478
- if (g != null) return g;
477
+ const d = r.get(a);
478
+ if (d != null) return d;
479
479
  } else
480
480
  r = /* @__PURE__ */ new Map(), this.minMaxCache.set(e, r);
481
- const c = this.data[e];
482
- if (!c) return [1 / 0, -1 / 0];
483
- const u = c.series[n];
484
- if (!u || u.length === 0) return [1 / 0, -1 / 0];
485
- let d;
481
+ const u = this.data[e];
482
+ if (!u) return [1 / 0, -1 / 0];
483
+ const c = u.series[n];
484
+ if (!c || c.length === 0) return [1 / 0, -1 / 0];
485
+ let h;
486
486
  const f = !l && i === yt.Unsorted ? this.getOrBuildTree(e, n) : void 0;
487
- return f ? d = f.rangeMinMax(s, o) : d = Re(u, s, o, i, l), r.set(a, d), d;
487
+ return f ? h = f.rangeMinMax(s, o) : h = Re(c, s, o, i, l), r.set(a, h), h;
488
488
  }
489
489
  /** Get block tree for a series (exposed for incremental append) */
490
490
  getBlockTree(e, n) {
@@ -510,12 +510,12 @@ class je {
510
510
  for (let r = 0; r < o.series.length; r++) {
511
511
  const a = o.series[r];
512
512
  if (!a || !Array.isArray(a)) continue;
513
- const c = s[r];
514
- if (c)
515
- for (let d = 0; d < c.length; d++)
516
- a.push(c[d] ?? null);
517
- const u = this.blockTrees.get(`${e}:${r}`);
518
- u && (u.setData(a), u.grow(a.length));
513
+ const u = s[r];
514
+ if (u)
515
+ for (let h = 0; h < u.length; h++)
516
+ a.push(u[h] ?? null);
517
+ const c = this.blockTrees.get(`${e}:${r}`);
518
+ c && (c.setData(a), c.grow(a.length));
519
519
  }
520
520
  (l = this.minMaxCache.get(e)) == null || l.clear();
521
521
  }
@@ -556,44 +556,44 @@ class qe {
556
556
  */
557
557
  update(e, n, s, o, i, l, r, a) {
558
558
  this.state.left = e, this.state.top = n;
559
- let c = 1 / 0, u = -1, d = -1, f = -1;
560
- const g = /* @__PURE__ */ new Map();
561
- for (const v of i) {
562
- if (v.show === !1) continue;
563
- let x = g.get(v.group);
564
- x == null && (x = [], g.set(v.group, x)), x.push(v);
565
- }
566
- for (let v = 0; v < o.length; v++) {
567
- const x = o[v];
568
- if (x == null) continue;
569
- const L = x.x;
559
+ let u = 1 / 0, c = -1, h = -1, f = -1;
560
+ const d = /* @__PURE__ */ new Map();
561
+ for (const x of i) {
562
+ if (x.show === !1) continue;
563
+ let b = d.get(x.group);
564
+ b == null && (b = [], d.set(x.group, b)), b.push(x);
565
+ }
566
+ for (let x = 0; x < o.length; x++) {
567
+ const b = o[x];
568
+ if (b == null) continue;
569
+ const L = b.x;
570
570
  if (L.length === 0) continue;
571
- const h = a(v);
572
- if (h == null) continue;
573
- const I = l(h);
574
- if (I == null || I.min == null || I.max == null) continue;
575
- const [P, D] = r(v), T = s.width, M = s.left, S = it(e + M, I, T, M), b = ct(S, L, P, D), C = [b];
576
- b > P && C.push(b - 1), b < D && C.push(b + 1);
577
- const z = /* @__PURE__ */ new Map();
578
- for (const p of C) {
579
- const m = L[p];
580
- if (m == null) continue;
581
- const w = _(m, I, T, M);
582
- for (const y of g.get(v) ?? []) {
583
- const k = x.series[y.index];
584
- if (k == null) continue;
585
- const A = k[p];
571
+ const g = a(x);
572
+ if (g == null) continue;
573
+ const w = l(g);
574
+ if (w == null || w.min == null || w.max == null) continue;
575
+ const [P, z] = r(x), T = s.width, S = s.left, C = rt(e + S, w, T, S), v = ut(C, L, P, z), I = [v];
576
+ v > P && I.push(v - 1), v < z && I.push(v + 1);
577
+ const D = /* @__PURE__ */ new Map();
578
+ for (const m of I) {
579
+ const p = L[m];
580
+ if (p == null) continue;
581
+ const M = $(p, w, T, S);
582
+ for (const k of d.get(x) ?? []) {
583
+ const y = b.series[k.index];
584
+ if (y == null) continue;
585
+ const A = y[m];
586
586
  if (A == null) continue;
587
- let F = z.get(y.yScale);
588
- if (F == null && !z.has(y.yScale) && (F = l(y.yScale), z.set(y.yScale, F)), F == null || F.min == null || F.max == null) continue;
589
- const R = s.height, H = s.top, V = _(A, F, R, H), B = e + M - w, W = n + H - V, j = B * B + W * W;
590
- if (j < c && (c = j, u = v, d = y.index, f = p, j === 0))
587
+ let F = D.get(k.yScale);
588
+ if (F == null && !D.has(k.yScale) && (F = l(k.yScale), D.set(k.yScale, F)), F == null || F.min == null || F.max == null) continue;
589
+ const R = s.height, G = s.top, H = $(A, F, R, G), B = e + S - M, W = n + G - H, Y = B * B + W * W;
590
+ if (Y < u && (u = Y, c = x, h = k.index, f = m, Y === 0))
591
591
  break;
592
592
  }
593
- if (c === 0) break;
593
+ if (u === 0) break;
594
594
  }
595
595
  }
596
- this.state.activeGroup = u, this.state.activeSeriesIdx = d, this.state.activeDataIdx = f;
596
+ this.state.activeGroup = c, this.state.activeSeriesIdx = h, this.state.activeDataIdx = f;
597
597
  }
598
598
  /**
599
599
  * Sync cursor to a specific x-value (from another chart in a sync group).
@@ -608,24 +608,24 @@ class qe {
608
608
  if (i == null) return;
609
609
  const l = n.scaleManager.getScale(i);
610
610
  if (l == null || l.min == null || l.max == null) return;
611
- const [r, a] = n.dataStore.getWindow(0), c = ct(e, o.x, r, a), u = o.x[c];
612
- if (u == null) return;
613
- const d = _(u, l, n.plotBox.width, n.plotBox.left);
614
- this.state.left = d - n.plotBox.left, this.state.activeGroup = 0, this.state.activeDataIdx = c;
615
- let f = 0, g = n.plotBox.height / 2;
616
- for (const v of n.seriesConfigs) {
617
- if (v.group !== 0 || v.show === !1) continue;
618
- const x = o.series[v.index];
619
- if (x == null) continue;
620
- const L = x[c];
611
+ const [r, a] = n.dataStore.getWindow(0), u = ut(e, o.x, r, a), c = o.x[u];
612
+ if (c == null) return;
613
+ const h = $(c, l, n.plotBox.width, n.plotBox.left);
614
+ this.state.left = h - n.plotBox.left, this.state.activeGroup = 0, this.state.activeDataIdx = u;
615
+ let f = 0, d = n.plotBox.height / 2;
616
+ for (const x of n.seriesConfigs) {
617
+ if (x.group !== 0 || x.show === !1) continue;
618
+ const b = o.series[x.index];
619
+ if (b == null) continue;
620
+ const L = b[u];
621
621
  if (L == null) continue;
622
- const h = n.scaleManager.getScale(v.yScale);
623
- if (!(h == null || h.min == null || h.max == null)) {
624
- g = _(L, h, n.plotBox.height, n.plotBox.top) - n.plotBox.top, f = v.index;
622
+ const g = n.scaleManager.getScale(x.yScale);
623
+ if (!(g == null || g.min == null || g.max == null)) {
624
+ d = $(L, g, n.plotBox.height, n.plotBox.top) - n.plotBox.top, f = x.index;
625
625
  break;
626
626
  }
627
627
  }
628
- this.state.top = g, this.state.activeSeriesIdx = f;
628
+ this.state.top = d, this.state.activeSeriesIdx = f;
629
629
  }
630
630
  }
631
631
  class Ze {
@@ -672,41 +672,41 @@ class Ze {
672
672
  function Rt(t, e, n) {
673
673
  t.lineTo(e, n);
674
674
  }
675
- function Ht(t, e, n) {
675
+ function Gt(t, e, n) {
676
676
  t.lineTo(n, e);
677
677
  }
678
- function Xt(t, e, n, s, o, i) {
678
+ function Yt(t, e, n, s, o, i) {
679
679
  const l = [];
680
680
  let r = -1;
681
- const a = o === K.Forward ? n : s, c = o === K.Forward ? s : n, u = o;
682
- for (let d = a; o === K.Forward ? d <= c : d >= c; d += u)
683
- if (e[d] === null || e[d] === void 0) {
681
+ const a = o === N.Forward ? n : s, u = o === N.Forward ? s : n, c = o;
682
+ for (let h = a; o === N.Forward ? h <= u : h >= u; h += c)
683
+ if (e[h] === null || e[h] === void 0) {
684
684
  if (r === -1) {
685
- const f = Math.max(n, Math.min(d - o, s));
685
+ const f = Math.max(n, Math.min(h - o, s));
686
686
  r = i(t[f]);
687
687
  }
688
688
  } else
689
- r !== -1 && (l.push([r, i(t[d])]), r = -1);
689
+ r !== -1 && (l.push([r, i(t[h])]), r = -1);
690
690
  return r !== -1 && l.push([r, i(t[s])]), l;
691
691
  }
692
- function Yt(t, e, n, s, o, i) {
692
+ function Kt(t, e, n, s, o, i) {
693
693
  const l = new Path2D();
694
- let r = e === G.Horizontal ? n : s;
695
- const a = e === G.Horizontal ? n + o : s + i, c = e === G.Horizontal ? s : n, u = e === G.Horizontal ? i : o;
696
- for (const [d, f] of t)
697
- d > r && (e === G.Horizontal ? l.rect(r, c, d - r, u) : l.rect(c, r, u, d - r)), r = f;
698
- return r < a && (e === G.Horizontal ? l.rect(r, c, a - r, u) : l.rect(c, r, u, a - r)), l;
694
+ let r = e === V.Horizontal ? n : s;
695
+ const a = e === V.Horizontal ? n + o : s + i, u = e === V.Horizontal ? s : n, c = e === V.Horizontal ? i : o;
696
+ for (const [h, f] of t)
697
+ h > r && (e === V.Horizontal ? l.rect(r, u, h - r, c) : l.rect(u, r, c, h - r)), r = f;
698
+ return r < a && (e === V.Horizontal ? l.rect(r, u, a - r, c) : l.rect(u, r, c, a - r)), l;
699
699
  }
700
700
  function Se(t) {
701
701
  return (e, n, s, o, i, l) => {
702
702
  s !== o && (i !== s && l !== s && t(e, n, s), i !== o && l !== o && t(e, n, o), t(e, n, l));
703
703
  };
704
704
  }
705
- const Oe = Se(Rt), Je = Se(Ht);
705
+ const Oe = Se(Rt), Je = Se(Gt);
706
706
  function Qe() {
707
- return (t, e, n, s, o, i, l, r, a, c, u, d, f) => {
708
- const g = (f == null ? void 0 : f.spanGaps) ?? !1;
709
- if ([a, c] = (s.distr === N.Log ? me : Ft)(e, a, c), a === -1)
707
+ return (t, e, n, s, o, i, l, r, a, u, c, h, f) => {
708
+ const d = (f == null ? void 0 : f.spanGaps) ?? !1;
709
+ if ([a, u] = (s.distr === q.Log ? me : Ft)(e, a, u), a === -1)
710
710
  return {
711
711
  stroke: new Path2D(),
712
712
  fill: null,
@@ -714,71 +714,71 @@ function Qe() {
714
714
  band: null,
715
715
  gaps: null
716
716
  };
717
- const x = (S) => d(_(S, n, o, l)), L = (S) => d(_(S, s, i, r));
718
- let h, I;
719
- n.ori === G.Horizontal ? (h = Rt, I = Oe) : (h = Ht, I = Je);
717
+ const b = (C) => h($(C, n, o, l)), L = (C) => h($(C, s, i, r));
718
+ let g, w;
719
+ n.ori === V.Horizontal ? (g = Rt, w = Oe) : (g = Gt, w = Je);
720
720
  const P = {
721
721
  stroke: new Path2D(),
722
722
  fill: null,
723
723
  clip: null,
724
724
  band: null,
725
725
  gaps: null
726
- }, D = P.stroke;
726
+ }, z = P.stroke;
727
727
  let T = !1;
728
- if (c - a >= o * 4) {
729
- const S = (A) => it(A, n, o, l);
730
- let b = null, C = 0, z = 0, p = 0, m = x(t[u === K.Forward ? a : c]);
731
- const w = x(t[a]), y = x(t[c]);
732
- let k = S(u === K.Forward ? w + 1 : y - 1);
733
- for (let A = u === K.Forward ? a : c; A >= a && A <= c; A += u) {
734
- const F = t[A], H = (u === K.Forward ? F < k : F > k) ? m : x(F), V = e[A];
735
- H === m ? V != null ? (p = V, b == null ? (h(D, H, L(p)), z = b = C = p) : p < b ? b = p : p > C && (C = p)) : V === null && !g && (T = !0) : (b != null && I(D, m, L(b), L(C), L(z), L(p)), V != null ? (p = V, h(D, H, L(p)), b = C = z = p) : (b = null, C = 0, V === null && !g && (T = !0)), m = H, k = S(m + u));
728
+ if (u - a >= o * 4) {
729
+ const C = (A) => rt(A, n, o, l);
730
+ let v = null, I = 0, D = 0, m = 0, p = b(t[c === N.Forward ? a : u]);
731
+ const M = b(t[a]), k = b(t[u]);
732
+ let y = C(c === N.Forward ? M + 1 : k - 1);
733
+ for (let A = c === N.Forward ? a : u; A >= a && A <= u; A += c) {
734
+ const F = t[A], G = (c === N.Forward ? F < y : F > y) ? p : b(F), H = e[A];
735
+ G === p ? H != null ? (m = H, v == null ? (g(z, G, L(m)), D = v = I = m) : m < v ? v = m : m > I && (I = m)) : H === null && !d && (T = !0) : (v != null && w(z, p, L(v), L(I), L(D), L(m)), H != null ? (m = H, g(z, G, L(m)), v = I = D = m) : (v = null, I = 0, H === null && !d && (T = !0)), p = G, y = C(p + c));
736
736
  }
737
- b != null && (b !== C ? I(D, m, L(b), L(C), L(z), L(p)) : h(D, m, L(p)));
737
+ v != null && (v !== I ? w(z, p, L(v), L(I), L(D), L(m)) : g(z, p, L(m)));
738
738
  } else
739
- for (let S = u === K.Forward ? a : c; S >= a && S <= c; S += u) {
740
- const b = e[S];
741
- b === null && !g ? T = !0 : b != null && h(D, x(t[S]), L(b));
739
+ for (let C = c === N.Forward ? a : u; C >= a && C <= u; C += c) {
740
+ const v = e[C];
741
+ v === null && !d ? T = !0 : v != null && g(z, b(t[C]), L(v));
742
742
  }
743
743
  {
744
- const S = P.fill = new Path2D(D), b = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, C = L(b);
745
- let z = l, p = l + o;
746
- u === K.Backward && ([p, z] = [z, p]), h(S, p, C), h(S, z, C);
744
+ const C = P.fill = new Path2D(z), v = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, I = L(v);
745
+ let D = l, m = l + o;
746
+ c === N.Backward && ([m, D] = [D, m]), g(C, m, I), g(C, D, I);
747
747
  }
748
748
  if (T) {
749
- const S = Xt(t, e, a, c, u, x);
750
- P.gaps = S, P.clip = Yt(S, n.ori, l, r, o, i);
749
+ const C = Yt(t, e, a, u, c, b);
750
+ P.gaps = C, P.clip = Kt(C, n.ori, l, r, o, i);
751
751
  }
752
752
  return P;
753
753
  };
754
754
  }
755
- const Jt = /* @__PURE__ */ new WeakMap();
756
- function Qt(t, e, n) {
755
+ const Qt = /* @__PURE__ */ new WeakMap();
756
+ function te(t, e, n) {
757
757
  return typeof e == "string" ? e : tn(t, e, n);
758
758
  }
759
759
  function tn(t, e, n) {
760
- const s = Jt.get(e);
760
+ const s = Qt.get(e);
761
761
  if (s != null && s.top === n.top && s.height === n.height)
762
762
  return s.grad;
763
763
  const o = t.createLinearGradient(0, n.top, 0, n.top + n.height);
764
764
  for (const [i, l] of e.stops)
765
765
  o.addColorStop(i, l);
766
- return Jt.set(e, { grad: o, top: n.top, height: n.height }), o;
766
+ return Qt.set(e, { grad: o, top: n.top, height: n.height }), o;
767
767
  }
768
768
  function en(t, e, n, s, o) {
769
769
  if (e.show === !1) return;
770
770
  const i = e.alpha ?? 1;
771
771
  t.save(), i < 1 && (t.globalAlpha = i), n.clip && t.clip(n.clip);
772
772
  const l = o ?? { top: 0, width: t.canvas.width / s, height: t.canvas.height / s };
773
- if (e.fill && n.fill && (t.fillStyle = Qt(t, e.fill, l), t.fill(n.fill)), e.stroke) {
773
+ if (e.fill && n.fill && (t.fillStyle = te(t, e.fill, l), t.fill(n.fill)), e.stroke) {
774
774
  const r = (e.width ?? 1) * s;
775
- t.strokeStyle = Qt(t, e.stroke, l), t.lineWidth = r, t.lineJoin = e.join ?? "round", t.lineCap = e.cap ?? "butt", e.dash && t.setLineDash(e.dash.map((d) => d * s));
776
- const a = e.pxAlign ?? 1, c = r % 2 / 2;
777
- a === 1 && c > 0 && t.translate(c, c), t.stroke(n.stroke);
775
+ t.strokeStyle = te(t, e.stroke, l), t.lineWidth = r, t.lineJoin = e.join ?? "round", t.lineCap = e.cap ?? "butt", e.dash && t.setLineDash(e.dash.map((h) => h * s));
776
+ const a = e.pxAlign ?? 1, u = r % 2 / 2;
777
+ a === 1 && u > 0 && t.translate(u, u), t.stroke(n.stroke);
778
778
  }
779
779
  t.restore();
780
780
  }
781
- const nn = Qe(), te = 64;
781
+ const nn = Qe(), ee = 64;
782
782
  class sn {
783
783
  constructor() {
784
784
  this.ctx = null, this.pxRatio = 1, this.pathCache = /* @__PURE__ */ new Map(), this.pathCacheSize = 0, this.bandCache = /* @__PURE__ */ new Map(), this.lruHead = null, this.lruTail = null, this.lruMap = /* @__PURE__ */ new Map(), this.snapshotCanvas = null, this.snapshotValid = !1, this.cachedFillStyle = "", this.cachedStrokeStyle = "", this.cachedLineWidth = -1, this.cachedFont = "", this.cachedTextAlign = "", this.cachedTextBaseline = "", this.cachedGlobalAlpha = -1;
@@ -857,35 +857,35 @@ class sn {
857
857
  if (l == null) return;
858
858
  const r = this.windowKey(s, o), a = l.get(r);
859
859
  if (a != null) {
860
- const c = this.lruMap.get(this.lruKey(e, n, r));
861
- c != null && c !== this.lruTail && (this.lruUnlink(c), this.lruAppend(c));
860
+ const u = this.lruMap.get(this.lruKey(e, n, r));
861
+ u != null && u !== this.lruTail && (this.lruUnlink(u), this.lruAppend(u));
862
862
  }
863
863
  return a;
864
864
  }
865
865
  /** Store paths in cache, evicting oldest 25% when at capacity */
866
866
  setCachedPaths(e, n, s, o, i) {
867
- if (this.pathCacheSize >= te) {
868
- const u = te >> 2;
869
- let d = this.lruHead;
870
- for (let f = 0; f < u && d != null; f++) {
871
- const g = d.next, v = this.pathCache.get(d.group);
872
- if (v != null) {
873
- const x = v.get(d.index);
874
- x != null && (x.delete(d.key), this.pathCacheSize--, x.size === 0 && v.delete(d.index), v.size === 0 && this.pathCache.delete(d.group));
867
+ if (this.pathCacheSize >= ee) {
868
+ const c = ee >> 2;
869
+ let h = this.lruHead;
870
+ for (let f = 0; f < c && h != null; f++) {
871
+ const d = h.next, x = this.pathCache.get(h.group);
872
+ if (x != null) {
873
+ const b = x.get(h.index);
874
+ b != null && (b.delete(h.key), this.pathCacheSize--, b.size === 0 && x.delete(h.index), x.size === 0 && this.pathCache.delete(h.group));
875
875
  }
876
- this.lruMap.delete(this.lruKey(d.group, d.index, d.key)), d = g;
876
+ this.lruMap.delete(this.lruKey(h.group, h.index, h.key)), h = d;
877
877
  }
878
- this.lruHead = d, d != null ? d.prev = null : this.lruTail = null;
878
+ this.lruHead = h, h != null ? h.prev = null : this.lruTail = null;
879
879
  }
880
880
  let l = this.pathCache.get(e);
881
881
  l == null && (l = /* @__PURE__ */ new Map(), this.pathCache.set(e, l));
882
882
  let r = l.get(n);
883
883
  r == null && (r = /* @__PURE__ */ new Map(), l.set(n, r));
884
- const a = this.windowKey(s, o), c = this.lruKey(e, n, a);
884
+ const a = this.windowKey(s, o), u = this.lruKey(e, n, a);
885
885
  if (!r.has(a)) {
886
886
  this.pathCacheSize++;
887
- const u = { group: e, index: n, key: a, prev: null, next: null };
888
- this.lruAppend(u), this.lruMap.set(c, u);
887
+ const c = { group: e, index: n, key: a, prev: null, next: null };
888
+ this.lruAppend(c), this.lruMap.set(u, c);
889
889
  }
890
890
  r.set(a, i);
891
891
  }
@@ -942,10 +942,10 @@ class sn {
942
942
  const o = this.ctx;
943
943
  if (o == null || e.config.show === !1) return;
944
944
  const i = e.config.group, l = e.config.index, [r, a] = e.window;
945
- let c = this.getCachedPaths(i, l, r, a);
946
- if (c == null) {
947
- const u = e.config.paths ?? nn, d = e.xScale.dir, f = (x) => $(x), g = e.config.fillTo, v = typeof g == "function" ? g(e.yScale.min ?? 0, e.yScale.max ?? 0) : g;
948
- c = u(
945
+ let u = this.getCachedPaths(i, l, r, a);
946
+ if (u == null) {
947
+ const c = e.config.paths ?? nn, h = e.xScale.dir, f = (b) => _(b), d = e.config.fillTo, x = typeof d == "function" ? d(e.yScale.min ?? 0, e.yScale.max ?? 0) : d;
948
+ u = c(
949
949
  e.dataX,
950
950
  e.dataY,
951
951
  e.xScale,
@@ -956,12 +956,12 @@ class sn {
956
956
  n.top,
957
957
  r,
958
958
  a,
959
- d,
959
+ h,
960
960
  f,
961
- { fillTo: v, spanGaps: e.config.spanGaps }
962
- ), this.setCachedPaths(i, l, r, a, c);
961
+ { fillTo: x, spanGaps: e.config.spanGaps }
962
+ ), this.setCachedPaths(i, l, r, a, u);
963
963
  }
964
- en(o, e.config, c, s, n);
964
+ en(o, e.config, u, s, n);
965
965
  }
966
966
  /**
967
967
  * Full draw cycle: clear canvas and draw all series.
@@ -976,51 +976,51 @@ class sn {
976
976
  i.restore(), this.resetPropertyCache();
977
977
  }
978
978
  }
979
- const ye = [1, 2, 2.5, 5], on = ve(10, -32, 0, ye), ln = ve(10, 0, 32, ye), ft = on.concat(ln);
979
+ const ye = [1, 2, 2.5, 5], on = ve(10, -32, 0, ye), ln = ve(10, 0, 32, ye), ht = on.concat(ln);
980
980
  function rn(t, e, n, s, o) {
981
981
  if (n <= 0 || e < t) return [];
982
- const i = [], l = vt.get(n) ?? 0, r = o ? t : ut(Et(t, n), l);
983
- for (let a = r; a <= e; a = ut(a + n, l))
982
+ const i = [], l = vt.get(n) ?? 0, r = o ? t : ft(Xt(t, n), l);
983
+ for (let a = r; a <= e; a = ft(a + n, l))
984
984
  i.push(Object.is(a, -0) ? 0 : a);
985
985
  return i;
986
986
  }
987
- function ee(t) {
988
- return t.map((e) => Me(e));
987
+ function ne(t) {
988
+ return t.map((e) => xe(e));
989
989
  }
990
990
  function an(t, e, n) {
991
991
  if (t <= 0 || e <= 0 || t >= e) return [];
992
- const s = [], i = st((n === 10 ? et : xt)(t));
992
+ const s = [], i = ot((n === 10 ? et : Mt)(t));
993
993
  let l = wt(n, i);
994
- n === 10 && (l = ft[ct(l, ft)] ?? l);
994
+ n === 10 && (l = ht[ut(l, ht)] ?? l);
995
995
  let r = l, a = l * n;
996
- n === 10 && (a = ft[ct(a, ft)] ?? a);
997
- let c = 0;
996
+ n === 10 && (a = ht[ut(a, ht)] ?? a);
997
+ let u = 0;
998
998
  do {
999
999
  if (r >= t && s.push(r), r = r + l, n === 10 && !vt.has(r)) {
1000
- const u = vt.get(l) ?? 0;
1001
- r = ut(r, u);
1000
+ const c = vt.get(l) ?? 0;
1001
+ r = ft(r, c);
1002
1002
  }
1003
- r >= a * (1 - 1e-10) && (l = r, a = l * n, n === 10 && (a = ft[ct(a, ft)] ?? a));
1004
- } while (r <= e && ++c < 1e4);
1003
+ r >= a * (1 - 1e-10) && (l = r, a = l * n, n === 10 && (a = ht[ut(a, ht)] ?? a));
1004
+ } while (r <= e && ++u < 1e4);
1005
1005
  return s;
1006
1006
  }
1007
1007
  function cn(t, e) {
1008
- const n = e === 10 ? et : xt;
1008
+ const n = e === 10 ? et : Mt;
1009
1009
  return t.map((s) => {
1010
1010
  if (s === 0) return !0;
1011
1011
  if (s < 0) return !1;
1012
1012
  const o = n(s);
1013
- return gt(o - Math.round(o)) < 1e-10;
1013
+ return pt(o - Math.round(o)) < 1e-10;
1014
1014
  });
1015
1015
  }
1016
1016
  function un(t, e) {
1017
- const s = Me(Math.max(Math.abs(t), Math.abs(e))).length * 7;
1017
+ const s = xe(Math.max(Math.abs(t), Math.abs(e))).length * 7;
1018
1018
  return Math.max(50, s + 16);
1019
1019
  }
1020
1020
  function fn(t, e, n, s) {
1021
1021
  if (s <= 0)
1022
1022
  return [0, 0];
1023
- const o = Mt(t.side) === G.Vertical, i = t.space ?? (o ? 30 : un(e, n)), l = t.incrs ?? ft;
1023
+ const o = xt(t.side) === V.Vertical, i = t.space ?? (o ? 30 : un(e, n)), l = t.incrs ?? ht;
1024
1024
  return We(e, n, l, s, i);
1025
1025
  }
1026
1026
  const hn = 50;
@@ -1029,12 +1029,12 @@ function dn(t, e, n) {
1029
1029
  if (t.size != null)
1030
1030
  return t.size;
1031
1031
  const s = ((r = t.ticks) == null ? void 0 : r.show) !== !1 ? ((a = t.ticks) == null ? void 0 : a.size) ?? 10 : 0, o = t.gap ?? 5, i = 12;
1032
- if (Mt(t.side) === G.Vertical && e != null) {
1033
- let c = 0;
1034
- for (const d of e)
1035
- d.length > c && (c = d.length);
1036
- const u = c * 7;
1037
- return Math.max(50, s + o + u + 4);
1032
+ if (xt(t.side) === V.Vertical && e != null) {
1033
+ let u = 0;
1034
+ for (const h of e)
1035
+ h.length > u && (u = h.length);
1036
+ const c = u * 7;
1037
+ return Math.max(50, s + o + c + 4);
1038
1038
  }
1039
1039
  return Math.max(50, s + o + i + 3);
1040
1040
  }
@@ -1052,7 +1052,7 @@ function gn(t) {
1052
1052
  _rotate: 0
1053
1053
  };
1054
1054
  }
1055
- const mt = 60, ht = 3600, rt = 86400, dt = 2592e3, At = 31536e3, pn = [
1055
+ const mt = 60, dt = 3600, at = 86400, gt = 2592e3, At = 31536e3, pn = [
1056
1056
  // Seconds
1057
1057
  1,
1058
1058
  5,
@@ -1066,23 +1066,23 @@ const mt = 60, ht = 3600, rt = 86400, dt = 2592e3, At = 31536e3, pn = [
1066
1066
  15 * mt,
1067
1067
  30 * mt,
1068
1068
  // Hours
1069
- ht,
1070
- 2 * ht,
1071
- 3 * ht,
1072
- 4 * ht,
1073
- 6 * ht,
1074
- 12 * ht,
1075
- // Days
1076
- rt,
1077
- 2 * rt,
1078
- 3 * rt,
1079
- 7 * rt,
1080
- 14 * rt,
1081
- // Months (approximate)
1082
1069
  dt,
1083
1070
  2 * dt,
1084
1071
  3 * dt,
1072
+ 4 * dt,
1085
1073
  6 * dt,
1074
+ 12 * dt,
1075
+ // Days
1076
+ at,
1077
+ 2 * at,
1078
+ 3 * at,
1079
+ 7 * at,
1080
+ 14 * at,
1081
+ // Months (approximate)
1082
+ gt,
1083
+ 2 * gt,
1084
+ 3 * gt,
1085
+ 6 * gt,
1086
1086
  // Years
1087
1087
  At
1088
1088
  ];
@@ -1096,21 +1096,21 @@ function mn(t, e, n, s) {
1096
1096
  o.push(i), l.setUTCFullYear(l.getUTCFullYear() + Math.round(n / At)), i = l.getTime() / 1e3;
1097
1097
  return o;
1098
1098
  }
1099
- if (n >= dt) {
1099
+ if (n >= gt) {
1100
1100
  const l = new Date(t * 1e3);
1101
1101
  l.setUTCDate(1), l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3;
1102
- const r = Math.max(1, Math.round(n / dt));
1102
+ const r = Math.max(1, Math.round(n / gt));
1103
1103
  if (i < t && (l.setUTCMonth(l.getUTCMonth() + 1), i = l.getTime() / 1e3), r > 1) {
1104
- const a = l.getUTCMonth(), c = Math.ceil((a + 1) / r) * r;
1105
- l.setUTCMonth(c - 1), i = l.getTime() / 1e3;
1104
+ const a = l.getUTCMonth(), u = Math.ceil((a + 1) / r) * r;
1105
+ l.setUTCMonth(u - 1), i = l.getTime() / 1e3;
1106
1106
  }
1107
1107
  for (; i <= e; )
1108
1108
  o.push(i), l.setUTCMonth(l.getUTCMonth() + r), i = l.getTime() / 1e3;
1109
1109
  return o;
1110
1110
  }
1111
- if (n >= rt) {
1111
+ if (n >= at) {
1112
1112
  const l = new Date(t * 1e3);
1113
- l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3, i < t && (i += rt);
1113
+ l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3, i < t && (i += at);
1114
1114
  } else
1115
1115
  i = Math.ceil(t / n) * n;
1116
1116
  for (let l = 0; ; l++) {
@@ -1120,11 +1120,11 @@ function mn(t, e, n, s) {
1120
1120
  }
1121
1121
  return o;
1122
1122
  }
1123
- const ne = /* @__PURE__ */ new Map();
1123
+ const se = /* @__PURE__ */ new Map();
1124
1124
  function wn(t, e) {
1125
1125
  const n = JSON.stringify(t) + (e ?? "");
1126
- let s = ne.get(n);
1127
- return s == null && (s = new Intl.DateTimeFormat(void 0, { ...t, timeZone: e }), ne.set(n, s)), s;
1126
+ let s = se.get(n);
1127
+ return s == null && (s = new Intl.DateTimeFormat(void 0, { ...t, timeZone: e }), se.set(n, s)), s;
1128
1128
  }
1129
1129
  function nt(t, e, n) {
1130
1130
  const s = new Date(t * 1e3);
@@ -1133,10 +1133,10 @@ function nt(t, e, n) {
1133
1133
  function vn(t, e) {
1134
1134
  return nt(t, { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
1135
1135
  }
1136
- function Mn(t, e) {
1136
+ function xn(t, e) {
1137
1137
  return nt(t, { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
1138
1138
  }
1139
- function xn(t, e) {
1139
+ function Mn(t, e) {
1140
1140
  return nt(t, { hour: "2-digit", minute: "2-digit", hour12: !1 }, e);
1141
1141
  }
1142
1142
  function bn(t, e) {
@@ -1150,15 +1150,15 @@ function yn(t, e) {
1150
1150
  }
1151
1151
  function kn(t, e, n) {
1152
1152
  let s;
1153
- return e >= At ? s = Sn : e >= dt ? s = yn : e >= rt ? s = bn : e >= ht ? s = xn : e >= mt ? s = Mn : s = vn, t.map((o) => s(o, n));
1153
+ return e >= At ? s = Sn : e >= gt ? s = yn : e >= at ? s = bn : e >= dt ? s = Mn : e >= mt ? s = xn : s = vn, t.map((o) => s(o, n));
1154
1154
  }
1155
1155
  function Cn(t, e, n, s, o) {
1156
1156
  const i = e - t;
1157
1157
  if (i <= 0 || s <= 0) return [0, 0];
1158
1158
  for (const r of n) {
1159
- const a = i / r, c = s / a;
1160
- if (c >= o)
1161
- return [r, c];
1159
+ const a = i / r, u = s / a;
1160
+ if (u >= o)
1161
+ return [r, u];
1162
1162
  }
1163
1163
  const l = n[n.length - 1] ?? At;
1164
1164
  return [l, s / (i / l)];
@@ -1176,53 +1176,53 @@ function In(t, e, n, s, o) {
1176
1176
  continue;
1177
1177
  } else
1178
1178
  l._show || (i = !1, l._show = !0);
1179
- const c = r.side, d = Mt(c) === G.Horizontal ? n : s, { min: f, max: g } = a;
1180
- let v, x;
1179
+ const u = r.side, h = xt(u) === V.Horizontal ? n : s, { min: f, max: d } = a;
1180
+ let x, b;
1181
1181
  if (a.time) {
1182
- const h = r.space ?? 80;
1183
- [v, x] = Cn(f, g, pn, d, h);
1182
+ const g = r.space ?? 80;
1183
+ [x, b] = Cn(f, d, pn, h, g);
1184
1184
  } else
1185
- [v, x] = fn(r, f, g, d);
1186
- if (l._incr = v, l._space = x, x === 0)
1185
+ [x, b] = fn(r, f, d, h);
1186
+ if (l._incr = x, l._space = b, b === 0)
1187
1187
  continue;
1188
1188
  if (r.splits)
1189
- l._splits = r.splits(f, g, v, x);
1189
+ l._splits = r.splits(f, d, x, b);
1190
1190
  else if (a.time)
1191
- l._splits = mn(f, g, v);
1192
- else if (a.distr === N.Log)
1193
- l._splits = an(f, g, a.log);
1191
+ l._splits = mn(f, d, x);
1192
+ else if (a.distr === q.Log)
1193
+ l._splits = an(f, d, a.log);
1194
1194
  else {
1195
- const h = a.distr === N.Ordinal;
1196
- l._splits = rn(f, g, v, x, h);
1195
+ const g = a.distr === q.Ordinal;
1196
+ l._splits = rn(f, d, x, b, g);
1197
1197
  }
1198
1198
  if (r.values)
1199
- l._values = r.values(l._splits, x, v);
1199
+ l._values = r.values(l._splits, b, x);
1200
1200
  else if (a.time)
1201
- l._values = kn(l._splits, v);
1202
- else if (a.distr === N.Log) {
1203
- const h = cn(l._splits, a.log), I = ee(l._splits);
1204
- l._values = I.map((P, D) => h[D] ? P : "");
1201
+ l._values = kn(l._splits, x);
1202
+ else if (a.distr === q.Log) {
1203
+ const g = cn(l._splits, a.log), w = ne(l._splits);
1204
+ l._values = w.map((P, z) => g[z] ? P : "");
1205
1205
  } else
1206
- l._values = ee(l._splits);
1207
- l._rotate = c === U.Bottom ? r.rotate ?? 0 : 0;
1206
+ l._values = ne(l._splits);
1207
+ l._rotate = u === U.Bottom ? r.rotate ?? 0 : 0;
1208
1208
  const L = l._size;
1209
1209
  l._size = Tt(dn(r, l._values)), L !== l._size && (i = !1);
1210
1210
  }
1211
1211
  return i;
1212
1212
  }
1213
- function se(t, e, n) {
1214
- let s = t, o = e, i = 0, l = 0;
1215
- for (const r of n) {
1216
- if (!r._show)
1213
+ function oe(t, e, n, s = 0) {
1214
+ let o = t, i = e - s, l = 0, r = s;
1215
+ for (const a of n) {
1216
+ if (!a._show)
1217
1217
  continue;
1218
- const a = r.config.side, c = Mt(a) === G.Vertical, u = r.config.label != null ? r.config.labelSize ?? 20 : 0, d = r._size + u;
1219
- d > 0 && (c ? (s -= d, a === U.Left && (i += d)) : (o -= d, a === U.Top && (l += d)));
1218
+ const u = a.config.side, c = xt(u) === V.Vertical, h = a.config.label != null ? a.config.labelSize ?? 20 : 0, f = a._size + h;
1219
+ f > 0 && (c ? (o -= f, u === U.Left && (l += f)) : (i -= f, u === U.Top && (r += f)));
1220
1220
  }
1221
1221
  return {
1222
- left: i,
1223
- top: l,
1224
- width: Math.max(s, 0),
1225
- height: Math.max(o, 0)
1222
+ left: l,
1223
+ top: r,
1224
+ width: Math.max(o, 0),
1225
+ height: Math.max(i, 0)
1226
1226
  };
1227
1227
  }
1228
1228
  function An(t, e) {
@@ -1232,12 +1232,12 @@ function An(t, e) {
1232
1232
  case U.Top:
1233
1233
  return n -= a, n + a;
1234
1234
  case U.Right: {
1235
- const c = s;
1236
- return s += a, c;
1235
+ const u = s;
1236
+ return s += a, u;
1237
1237
  }
1238
1238
  case U.Bottom: {
1239
- const c = o;
1240
- return o += a, c;
1239
+ const u = o;
1240
+ return o += a, u;
1241
1241
  }
1242
1242
  case U.Left:
1243
1243
  return i -= a, i + a;
@@ -1250,100 +1250,104 @@ function An(t, e) {
1250
1250
  continue;
1251
1251
  const a = r.config.side;
1252
1252
  if (r._pos = l(a, r._size), r.config.label != null) {
1253
- const c = r.config.labelSize ?? 20;
1254
- r._lpos = l(a, c);
1253
+ const u = r.config.labelSize ?? 20;
1254
+ r._lpos = l(a, u);
1255
1255
  }
1256
1256
  }
1257
1257
  }
1258
- function Pn(t, e, n, s) {
1259
- for (const r of n)
1260
- r._size = 0;
1261
- let o = !1, i = 0, l = { left: 0, top: 0, width: t, height: e };
1262
- for (; !o; ) {
1263
- i++;
1264
- const r = In(
1258
+ function Pn(t, e, n, s, o = 0) {
1259
+ for (const a of n)
1260
+ a._size = 0;
1261
+ let i = !1, l = 0, r = { left: 0, top: 0, width: t, height: e };
1262
+ for (; !i; ) {
1263
+ l++;
1264
+ const a = In(
1265
1265
  n,
1266
1266
  s,
1267
- l.width,
1268
- l.height
1267
+ r.width,
1268
+ r.height
1269
1269
  );
1270
- o = i === Tn || r, o || (l = se(t, e, n));
1270
+ i = l === Tn || a, i || (r = oe(t, e, n, o));
1271
1271
  }
1272
- return l = se(t, e, n), An(n, l), l;
1272
+ return r = oe(t, e, n, o), An(n, r), r;
1273
1273
  }
1274
- const oe = "top", le = "bottom", Ln = "left", Dn = "right";
1275
- function ie(t, e) {
1274
+ const le = "top", ie = "bottom", Ln = "left", zn = "right";
1275
+ function $t(t, e) {
1276
1276
  return e === 1 ? t : t.replace(/(\d+(?:\.\d+)?)px/, (n, s) => `${Math.round(Number(s) * e)}px`);
1277
1277
  }
1278
- function re(t, e, n, s, o, i, l, r, a, c, u) {
1279
- const d = r % 2 / 2;
1280
- t.save(), t.translate(d, d), t.strokeStyle = a, t.lineWidth = r, c.length > 0 && t.setLineDash(c), t.beginPath();
1281
- let f = 0, g = 0, v = 0, x = 0;
1278
+ function re(t, e, n, s, o, i, l, r, a, u, c) {
1279
+ const h = r % 2 / 2;
1280
+ t.save(), t.translate(h, h), t.strokeStyle = a, t.lineWidth = r, u.length > 0 && t.setLineDash(u), t.beginPath();
1281
+ let f = 0, d = 0, x = 0, b = 0;
1282
1282
  const L = i + (o === U.Top || o === U.Left ? -l : l);
1283
- s === G.Horizontal ? (g = i, x = L) : (f = i, v = L);
1284
- for (let h = 0; h < e.length; h++)
1285
- n[h] != null && (s === G.Horizontal ? f = v = e[h] ?? 0 : g = x = e[h] ?? 0, t.moveTo(f, g), t.lineTo(v, x));
1283
+ s === V.Horizontal ? (d = i, b = L) : (f = i, x = L);
1284
+ for (let g = 0; g < e.length; g++)
1285
+ n[g] != null && (s === V.Horizontal ? f = x = e[g] ?? 0 : d = b = e[g] ?? 0, t.moveTo(f, d), t.lineTo(x, b));
1286
1286
  t.stroke(), t.restore();
1287
1287
  }
1288
- function zn(t, e, n, s, o) {
1289
- const i = $(s.left * o), l = $(s.top * o), r = $(s.width * o), a = $(s.height * o);
1288
+ function Dn(t, e, n, s, o, i) {
1289
+ const l = _(s.left * o), r = _(s.top * o), a = _(s.width * o), u = _(s.height * o);
1290
1290
  for (const c of e) {
1291
1291
  if (!c._show)
1292
1292
  continue;
1293
- const u = c.config, d = u.side, f = Mt(d), g = n(u.scale);
1294
- if (!g || g.min == null || g.max == null)
1293
+ const h = c.config, f = h.side, d = xt(f), x = n(h.scale);
1294
+ if (!x || x.min == null || x.max == null)
1295
1295
  continue;
1296
- const v = u.stroke ?? "#000", x = d === U.Top || d === U.Left ? -1 : 1, L = c._splits, h = c._values;
1297
- if (!L || !h || c._space === 0)
1296
+ const b = h.stroke ?? "#000", L = f === U.Top || f === U.Left ? -1 : 1, g = c._splits, w = c._values;
1297
+ if (!g || !w || c._space === 0)
1298
1298
  continue;
1299
- const I = f === G.Horizontal ? s.width : s.height, P = f === G.Horizontal ? s.left : s.top, D = L.map((C) => $(_(C, g, I, P) * o)), T = h.map((C) => C === "" ? null : C), M = u.grid;
1300
- if ((M == null ? void 0 : M.show) !== !1) {
1301
- const C = (M == null ? void 0 : M.stroke) ?? "rgba(0,0,0,0.12)", z = $(((M == null ? void 0 : M.width) ?? 2) * o), p = ((M == null ? void 0 : M.dash) ?? []).map((y) => y * o), m = f === G.Horizontal ? l : i, w = f === G.Horizontal ? a : r;
1302
- re(t, D, T, f, 2, m, w, z, C, p);
1299
+ const P = d === V.Horizontal ? s.width : s.height, z = d === V.Horizontal ? s.left : s.top, T = g.map((D) => _($(D, x, P, z) * o)), S = w.map((D) => D === "" ? null : D), C = h.grid;
1300
+ if ((C == null ? void 0 : C.show) !== !1) {
1301
+ const D = (C == null ? void 0 : C.stroke) ?? "rgba(0,0,0,0.12)", m = _(((C == null ? void 0 : C.width) ?? 2) * o), p = ((C == null ? void 0 : C.dash) ?? []).map((y) => y * o), M = d === V.Horizontal ? r : l, k = d === V.Horizontal ? u : a;
1302
+ re(t, T, S, d, 2, M, k, m, D, p);
1303
1303
  }
1304
- const S = u.ticks;
1305
- if ((S == null ? void 0 : S.show) !== !1) {
1306
- const C = (S == null ? void 0 : S.stroke) ?? v, z = $(((S == null ? void 0 : S.width) ?? 1) * o), p = $(((S == null ? void 0 : S.size) ?? 10) * o), m = ((S == null ? void 0 : S.dash) ?? []).map((y) => y * o), w = $(c._pos * o);
1307
- re(t, D, T, f, d, w, p, z, C, m);
1304
+ const v = h.ticks;
1305
+ if ((v == null ? void 0 : v.show) !== !1) {
1306
+ const D = (v == null ? void 0 : v.stroke) ?? b, m = _(((v == null ? void 0 : v.width) ?? 1) * o), p = _(((v == null ? void 0 : v.size) ?? 10) * o), M = ((v == null ? void 0 : v.dash) ?? []).map((y) => y * o), k = _(c._pos * o);
1307
+ re(t, T, S, d, f, k, p, m, D, M);
1308
1308
  }
1309
1309
  {
1310
- const C = (S == null ? void 0 : S.show) !== !1 ? ((S == null ? void 0 : S.size) ?? 10) * o : 0, z = $((u.gap ?? 5) * o), p = $(c._pos * o), m = (C + z) * x, w = p + m, y = ie(u.font ?? "12px system-ui, sans-serif", o), k = f === G.Horizontal ? "center" : d === U.Left ? Dn : Ln, A = f === G.Horizontal ? d === U.Bottom ? oe : le : "middle";
1311
- t.font = y, t.fillStyle = v, t.textAlign = k, t.textBaseline = A;
1312
- const F = c._rotate * -_t / 180;
1313
- if (F !== 0) {
1314
- const R = Math.cos(F), H = Math.sin(F);
1315
- for (let V = 0; V < h.length; V++) {
1316
- const B = h[V];
1317
- if (B == null || B === "")
1310
+ const D = (v == null ? void 0 : v.show) !== !1 ? ((v == null ? void 0 : v.size) ?? 10) * o : 0, m = _((h.gap ?? 5) * o), p = _(c._pos * o), M = (D + m) * L, k = p + M, y = $t(h.font ?? "12px system-ui, sans-serif", o), A = d === V.Horizontal ? "center" : f === U.Left ? zn : Ln, F = d === V.Horizontal ? f === U.Bottom ? le : ie : "middle";
1311
+ t.font = y, t.fillStyle = b, t.textAlign = A, t.textBaseline = F;
1312
+ const R = c._rotate * -_t / 180;
1313
+ if (R !== 0) {
1314
+ const G = Math.cos(R), H = Math.sin(R);
1315
+ for (let B = 0; B < w.length; B++) {
1316
+ const W = w[B];
1317
+ if (W == null || W === "")
1318
1318
  continue;
1319
- const W = D[V] ?? 0;
1320
- t.setTransform(R, H, -H, R, W, w), t.fillText(B, 0, 0);
1319
+ const Y = T[B] ?? 0;
1320
+ t.setTransform(G, H, -H, G, Y, k), t.fillText(W, 0, 0);
1321
1321
  }
1322
1322
  t.setTransform(1, 0, 0, 1, 0, 0);
1323
1323
  } else
1324
- for (let R = 0; R < h.length; R++) {
1325
- const H = h[R];
1324
+ for (let G = 0; G < w.length; G++) {
1325
+ const H = w[G];
1326
1326
  if (H == null || H === "")
1327
1327
  continue;
1328
- const V = D[R] ?? 0, B = f === G.Horizontal ? V : w, W = f === G.Horizontal ? w : V;
1329
- t.fillText(H, B, W);
1328
+ const B = T[G] ?? 0, W = d === V.Horizontal ? B : k, Y = d === V.Horizontal ? k : B;
1329
+ t.fillText(H, W, Y);
1330
1330
  }
1331
1331
  }
1332
- if (u.label != null) {
1333
- const C = ie(u.labelFont ?? "bold 12px system-ui, sans-serif", o);
1334
- t.font = C, t.fillStyle = v, t.textAlign = "center", t.textBaseline = d === U.Bottom ? oe : le;
1335
- const z = $((c._lpos + (u.labelGap ?? 0) * x) * o);
1336
- f === G.Vertical ? (t.save(), t.translate(
1337
- z,
1338
- $(l + a / 2)
1339
- ), t.rotate((d === U.Left ? -_t : _t) / 2), t.fillText(u.label, 0, 0), t.restore()) : t.fillText(u.label, $(i + r / 2), z);
1332
+ if (h.label != null) {
1333
+ const D = $t(h.labelFont ?? "bold 12px system-ui, sans-serif", o);
1334
+ t.font = D, t.fillStyle = b, t.textAlign = "center", t.textBaseline = f === U.Bottom ? le : ie;
1335
+ const m = _((c._lpos + (h.labelGap ?? 0) * L) * o);
1336
+ d === V.Vertical ? (t.save(), t.translate(
1337
+ m,
1338
+ _(r + u / 2)
1339
+ ), t.rotate((f === U.Left ? -_t : _t) / 2), t.fillText(h.label, 0, 0), t.restore()) : t.fillText(h.label, _(l + a / 2), m);
1340
1340
  }
1341
- const b = u.border;
1342
- if ((b == null ? void 0 : b.show) !== !1 && b != null) {
1343
- const C = b.stroke ?? v, z = $((b.width ?? 1) * o), p = (b.dash ?? []).map((w) => w * o), m = $(c._pos * o);
1344
- t.strokeStyle = C, t.lineWidth = z, p.length > 0 && t.setLineDash(p), t.beginPath(), f === G.Horizontal ? (t.moveTo(i, m), t.lineTo(i + r, m)) : (t.moveTo(m, l), t.lineTo(m, l + a)), t.stroke(), p.length > 0 && t.setLineDash([]);
1341
+ const I = h.border;
1342
+ if ((I == null ? void 0 : I.show) !== !1 && I != null) {
1343
+ const D = I.stroke ?? b, m = _((I.width ?? 1) * o), p = (I.dash ?? []).map((k) => k * o), M = _(c._pos * o);
1344
+ t.strokeStyle = D, t.lineWidth = m, p.length > 0 && t.setLineDash(p), t.beginPath(), d === V.Horizontal ? (t.moveTo(l, M), t.lineTo(l + a, M)) : (t.moveTo(M, r), t.lineTo(M, r + u)), t.stroke(), p.length > 0 && t.setLineDash([]);
1345
1345
  }
1346
1346
  }
1347
+ if (i != null) {
1348
+ const c = $t("bold 14px system-ui, sans-serif", o);
1349
+ t.font = c, t.fillStyle = "#000", t.textAlign = "center", t.textBaseline = "top", t.fillText(i, _(l + a / 2), _(4 * o));
1350
+ }
1347
1351
  }
1348
1352
  const Fn = {
1349
1353
  stroke: "#607D8B",
@@ -1356,24 +1360,24 @@ const Fn = {
1356
1360
  function ae(t, e, n, s, o, i, l, r, a) {
1357
1361
  var P;
1358
1362
  if (e.left < 0 || e.top < 0) return;
1359
- const c = { ...Fn, ...a }, u = s, d = $(n.left * u), f = $(n.top * u), g = $(n.width * u), v = $(n.height * u), x = $(c.width * u), L = x % 2 / 2, h = $((n.left + e.left) * u) + L, I = $((n.top + e.top) * u) + L;
1360
- if (t.save(), t.strokeStyle = c.stroke, t.lineWidth = x, t.setLineDash(c.dash.map((D) => D * u)), c.showX && (t.beginPath(), t.moveTo(h, f), t.lineTo(h, f + v), t.stroke()), c.showY && (t.beginPath(), t.moveTo(d, I), t.lineTo(d + g, I), t.stroke()), t.setLineDash([]), e.activeGroup >= 0 && e.activeDataIdx >= 0) {
1361
- const D = e.activeGroup, T = e.activeSeriesIdx, M = e.activeDataIdx, S = o[D];
1362
- if (S != null && T >= 0 && T < S.series.length && M < S.x.length) {
1363
- const b = S.x[M], C = S.series[T], z = C != null ? C[M] : null;
1364
- if (b != null && z != null) {
1365
- let p = c.stroke, m = !0;
1366
- for (const w of i)
1367
- if (w.group === D && w.index === T) {
1368
- const y = w.stroke;
1369
- p = (typeof y == "string" ? y : void 0) ?? c.stroke, m = ((P = w.cursor) == null ? void 0 : P.show) !== !1;
1363
+ const u = { ...Fn, ...a }, c = s, h = _(n.left * c), f = _(n.top * c), d = _(n.width * c), x = _(n.height * c), b = _(u.width * c), L = b % 2 / 2, g = _((n.left + e.left) * c) + L, w = _((n.top + e.top) * c) + L;
1364
+ if (t.save(), t.strokeStyle = u.stroke, t.lineWidth = b, t.setLineDash(u.dash.map((z) => z * c)), u.showX && (t.beginPath(), t.moveTo(g, f), t.lineTo(g, f + x), t.stroke()), u.showY && (t.beginPath(), t.moveTo(h, w), t.lineTo(h + d, w), t.stroke()), t.setLineDash([]), e.activeGroup >= 0 && e.activeDataIdx >= 0) {
1365
+ const z = e.activeGroup, T = e.activeSeriesIdx, S = e.activeDataIdx, C = o[z];
1366
+ if (C != null && T >= 0 && T < C.series.length && S < C.x.length) {
1367
+ const v = C.x[S], I = C.series[T], D = I != null ? I[S] : null;
1368
+ if (v != null && D != null) {
1369
+ let m = u.stroke, p = !0;
1370
+ for (const M of i)
1371
+ if (M.group === z && M.index === T) {
1372
+ const k = M.stroke;
1373
+ m = (typeof k == "string" ? k : void 0) ?? u.stroke, p = ((P = M.cursor) == null ? void 0 : P.show) !== !1;
1370
1374
  break;
1371
1375
  }
1372
- if (m) {
1373
- const w = r(D), y = w != null ? l(w) : void 0, k = Rn(i, D, T), A = k != null ? l(k) : void 0;
1374
- if (y != null && A != null && y.min != null && y.max != null && A.min != null && A.max != null) {
1375
- const F = $(_(b, y, n.width, n.left) * u), R = $(_(z, A, n.height, n.top) * u), H = c.pointRadius * u, V = $(2 * u);
1376
- t.beginPath(), t.arc(F, R, H, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = p, t.lineWidth = V, t.stroke();
1376
+ if (p) {
1377
+ const M = r(z), k = M != null ? l(M) : void 0, y = Rn(i, z, T), A = y != null ? l(y) : void 0;
1378
+ if (k != null && A != null && k.min != null && k.max != null && A.min != null && A.max != null) {
1379
+ const F = _($(v, k, n.width, n.left) * c), R = _($(D, A, n.height, n.top) * c), G = u.pointRadius * c, H = _(2 * c);
1380
+ t.beginPath(), t.arc(F, R, G, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = m, t.lineWidth = H, t.stroke();
1377
1381
  }
1378
1382
  }
1379
1383
  }
@@ -1386,26 +1390,26 @@ function Rn(t, e, n) {
1386
1390
  if (s.group === e && s.index === n)
1387
1391
  return s.yScale;
1388
1392
  }
1389
- const Hn = {
1393
+ const Gn = {
1390
1394
  fill: "rgba(0,0,0,0.07)",
1391
1395
  stroke: "rgba(0,0,0,0.15)",
1392
1396
  width: 1
1393
1397
  };
1394
1398
  function ce(t, e, n, s, o) {
1395
1399
  if (!e.show || e.width <= 0) return;
1396
- const i = { ...Hn, ...o }, l = s, r = $((n.left + e.left) * l), a = $((n.top + e.top) * l), c = $(e.width * l), u = $(e.height * l);
1397
- t.save(), t.fillStyle = i.fill, t.fillRect(r, a, c, u), i.width > 0 && (t.strokeStyle = i.stroke, t.lineWidth = $(i.width * l), t.strokeRect(r, a, c, u)), t.restore();
1400
+ const i = { ...Gn, ...o }, l = s, r = _((n.left + e.left) * l), a = _((n.top + e.top) * l), u = _(e.width * l), c = _(e.height * l);
1401
+ t.save(), t.fillStyle = i.fill, t.fillRect(r, a, u, c), i.width > 0 && (t.strokeStyle = i.stroke, t.lineWidth = _(i.width * l), t.strokeRect(r, a, u, c)), t.restore();
1398
1402
  }
1399
- function Gn(t, e, n, s, o, i, l, r, a, c, u, d) {
1400
- const f = u / 2 * l, g = Math.max(1, $(u * 0.2)) * l, v = (c == null ? void 0 : c.stroke) ?? d, x = (c == null ? void 0 : c.fill) ?? "#fff";
1401
- t.save(), t.strokeStyle = v, t.fillStyle = x, t.lineWidth = g, (c == null ? void 0 : c.dash) != null && t.setLineDash(c.dash.map((L) => L * l));
1403
+ function Hn(t, e, n, s, o, i, l, r, a, u, c, h) {
1404
+ const f = c / 2 * l, d = Math.max(1, _(c * 0.2)) * l, x = (u == null ? void 0 : u.stroke) ?? h, b = (u == null ? void 0 : u.fill) ?? "#fff";
1405
+ t.save(), t.strokeStyle = x, t.fillStyle = b, t.lineWidth = d, (u == null ? void 0 : u.dash) != null && t.setLineDash(u.dash.map((L) => L * l));
1402
1406
  for (let L = r; L <= a; L++) {
1403
- const h = n[L];
1404
- if (h == null) continue;
1405
- const I = e[L];
1406
- if (I == null) continue;
1407
- const P = $(_(I, s, i.width, i.left) * l), D = $(_(h, o, i.height, i.top) * l);
1408
- t.beginPath(), t.arc(P, D, f, 0, Math.PI * 2), t.fill(), t.stroke();
1407
+ const g = n[L];
1408
+ if (g == null) continue;
1409
+ const w = e[L];
1410
+ if (w == null) continue;
1411
+ const P = _($(w, s, i.width, i.left) * l), z = _($(g, o, i.height, i.top) * l);
1412
+ t.beginPath(), t.arc(P, z, f, 0, Math.PI * 2), t.fill(), t.stroke();
1409
1413
  }
1410
1414
  t.restore();
1411
1415
  }
@@ -1419,36 +1423,36 @@ function _n(t, e, n, s, o, i, l) {
1419
1423
  }
1420
1424
  function Vn(t, e, n, s, o, i, l, r, a) {
1421
1425
  if (r > a || r < 0) return null;
1422
- const c = (g) => _(g, s, i.width, i.left) * l, u = (g) => _(g, o, i.height, i.top) * l, d = new Path2D();
1426
+ const u = (d) => $(d, s, i.width, i.left) * l, c = (d) => $(d, o, i.height, i.top) * l, h = new Path2D();
1423
1427
  let f = !1;
1424
- for (let g = r; g <= a; g++) {
1425
- const v = e[g], x = t[g];
1426
- if (v == null || x == null) continue;
1427
- const L = c(x), h = u(v);
1428
- f ? d.lineTo(L, h) : (d.moveTo(L, h), f = !0);
1428
+ for (let d = r; d <= a; d++) {
1429
+ const x = e[d], b = t[d];
1430
+ if (x == null || b == null) continue;
1431
+ const L = u(b), g = c(x);
1432
+ f ? h.lineTo(L, g) : (h.moveTo(L, g), f = !0);
1429
1433
  }
1430
1434
  if (!f) return null;
1431
- for (let g = a; g >= r; g--) {
1432
- const v = n[g], x = t[g];
1433
- v == null || x == null || d.lineTo(c(x), u(v));
1435
+ for (let d = a; d >= r; d--) {
1436
+ const x = n[d], b = t[d];
1437
+ x == null || b == null || h.lineTo(u(b), c(x));
1434
1438
  }
1435
- return d.closePath(), d;
1439
+ return h.closePath(), h;
1436
1440
  }
1437
1441
  function $n(t, e, n) {
1438
1442
  t.save(), t.fillStyle = e.fill ?? "rgba(0, 120, 255, 0.1)", t.fill(n), t.restore();
1439
1443
  }
1440
- function $t(t, e, n, s) {
1444
+ function Bt(t, e, n, s) {
1441
1445
  return { ctx: t, plotBox: e, pxRatio: n, getScale: s, valToX: (l, r = "x") => {
1442
1446
  const a = s(r);
1443
- return a == null || a.min == null || a.max == null ? null : _(l, a, e.width, e.left);
1447
+ return a == null || a.min == null || a.max == null ? null : $(l, a, e.width, e.left);
1444
1448
  }, valToY: (l, r) => {
1445
1449
  const a = s(r);
1446
- return a == null || a.min == null || a.max == null ? null : _(l, a, e.height, e.top);
1450
+ return a == null || a.min == null || a.max == null ? null : $(l, a, e.height, e.top);
1447
1451
  } };
1448
1452
  }
1449
1453
  function Bn() {
1450
1454
  const t = {
1451
- scaleManager: new Ue(),
1455
+ scaleManager: new Ke(),
1452
1456
  dataStore: new je(),
1453
1457
  renderer: new sn(),
1454
1458
  cursorManager: new qe(),
@@ -1470,6 +1474,7 @@ function Bn() {
1470
1474
  focusedSeries: null,
1471
1475
  focusAlpha: 0.15,
1472
1476
  wheelZoom: !1,
1477
+ title: void 0,
1473
1478
  revision: 0,
1474
1479
  eventCallbacks: {},
1475
1480
  _prevScaleRanges: /* @__PURE__ */ new Map(),
@@ -1511,169 +1516,174 @@ function Bn() {
1511
1516
  };
1512
1517
  },
1513
1518
  redraw() {
1514
- const { scaleManager: e, dataStore: n, renderer: s, seriesConfigs: o, width: i, height: l, pxRatio: r, canvas: a, scheduler: c } = t;
1519
+ const { scaleManager: e, dataStore: n, renderer: s, seriesConfigs: o, width: i, height: l, pxRatio: r, canvas: a, scheduler: u } = t;
1515
1520
  if (a == null || i === 0 || l === 0) return;
1516
- const u = a.getContext("2d");
1517
- if (u == null) return;
1518
- s.setContext(u, r);
1519
- const f = (c.dirty & ~(tt.Cursor | tt.Select)) === 0, g = (h) => e.getScale(h);
1520
- if (f && s.restoreSnapshot(u)) {
1521
+ const c = a.getContext("2d");
1522
+ if (c == null) return;
1523
+ s.setContext(c, r);
1524
+ const f = (u.dirty & ~(tt.Cursor | tt.Select)) === 0, d = (g) => e.getScale(g);
1525
+ if (f && s.restoreSnapshot(c)) {
1521
1526
  if (ae(
1522
- u,
1527
+ c,
1523
1528
  t.cursorManager.state,
1524
1529
  t.plotBox,
1525
1530
  r,
1526
1531
  n.data,
1527
1532
  o,
1528
- g,
1529
- (h) => e.getGroupXScaleKey(h)
1530
- ), ce(u, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
1531
- u.save(), u.scale(r, r);
1532
- const h = $t(u, t.plotBox, r, g);
1533
- for (const I of t.cursorDrawHooks)
1533
+ d,
1534
+ (g) => e.getGroupXScaleKey(g)
1535
+ ), ce(c, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
1536
+ c.save(), c.scale(r, r);
1537
+ const g = Bt(c, t.plotBox, r, d);
1538
+ for (const w of t.cursorDrawHooks)
1534
1539
  try {
1535
- I(h, t.cursorManager.state);
1540
+ w(g, t.cursorManager.state);
1536
1541
  } catch (P) {
1537
1542
  console.warn("[uPlot+] draw hook error:", P);
1538
1543
  }
1539
- u.restore();
1544
+ c.restore();
1540
1545
  }
1541
- for (const h of t.listeners) h();
1546
+ for (const g of t.listeners) g();
1542
1547
  return;
1543
1548
  }
1544
- e.autoRangeX(n.data), n.updateWindows((h) => {
1545
- const I = e.getGroupXScaleKey(h);
1546
- return I != null ? e.getScale(I) : void 0;
1549
+ e.autoRangeX(n.data), n.updateWindows((g) => {
1550
+ const w = e.getGroupXScaleKey(g);
1551
+ return w != null ? e.getScale(w) : void 0;
1547
1552
  });
1548
- const v = o.map((h) => ({
1549
- group: h.group,
1550
- index: h.index,
1551
- yScale: h.yScale
1553
+ const x = o.map((g) => ({
1554
+ group: g.group,
1555
+ index: g.index,
1556
+ yScale: g.yScale
1552
1557
  }));
1553
- e.autoRange(n.data, v, n), Wn(t), t.axisStates.length > 0 ? t.plotBox = Pn(i, l, t.axisStates, g) : t.plotBox = {
1554
- left: 10,
1555
- top: 10,
1556
- width: i - 20,
1557
- height: l - 20
1558
- }, u.clearRect(0, 0, i * r, l * r), t.axisStates.length > 0 && zn(u, t.axisStates, g, t.plotBox, r);
1559
- const x = [];
1560
- for (const h of o) {
1561
- const I = e.getGroupXScaleKey(h.group), P = I != null ? e.getScale(I) : void 0, D = e.getScale(h.yScale);
1562
- P == null || D == null || x.push({
1563
- config: h,
1564
- dataX: n.getXValues(h.group),
1565
- dataY: n.getYValues(h.group, h.index),
1558
+ if (e.autoRange(n.data, x, n), Wn(t), t.axisStates.length > 0) {
1559
+ const g = t.title != null ? 20 : 0;
1560
+ t.plotBox = Pn(i, l, t.axisStates, d, g);
1561
+ } else
1562
+ t.plotBox = {
1563
+ left: 10,
1564
+ top: 10,
1565
+ width: i - 20,
1566
+ height: l - 20
1567
+ };
1568
+ c.clearRect(0, 0, i * r, l * r), t.axisStates.length > 0 && Dn(c, t.axisStates, d, t.plotBox, r, t.title);
1569
+ const b = [];
1570
+ for (const g of o) {
1571
+ const w = e.getGroupXScaleKey(g.group), P = w != null ? e.getScale(w) : void 0, z = e.getScale(g.yScale);
1572
+ P == null || z == null || b.push({
1573
+ config: g,
1574
+ dataX: n.getXValues(g.group),
1575
+ dataY: n.getYValues(g.group, g.index),
1566
1576
  xScale: P,
1567
- yScale: D,
1568
- window: n.getWindow(h.group)
1577
+ yScale: z,
1578
+ window: n.getWindow(g.group)
1569
1579
  });
1570
1580
  }
1571
- u.save(), u.scale(r, r), u.beginPath(), u.rect(t.plotBox.left, t.plotBox.top, t.plotBox.width, t.plotBox.height), u.clip();
1572
- for (let h = 0; h < x.length; h++) {
1573
- const I = x[h];
1574
- I != null && (t.focusedSeries != null && h !== t.focusedSeries ? (u.globalAlpha = t.focusAlpha, s.drawSeries(I, t.plotBox, 1), u.globalAlpha = 1) : s.drawSeries(I, t.plotBox, 1));
1581
+ c.save(), c.scale(r, r), c.beginPath(), c.rect(t.plotBox.left, t.plotBox.top, t.plotBox.width, t.plotBox.height), c.clip();
1582
+ for (let g = 0; g < b.length; g++) {
1583
+ const w = b[g];
1584
+ w != null && (t.focusedSeries != null && g !== t.focusedSeries ? (c.globalAlpha = t.focusAlpha, s.drawSeries(w, t.plotBox, 1), c.globalAlpha = 1) : s.drawSeries(w, t.plotBox, 1));
1575
1585
  }
1576
1586
  const L = /* @__PURE__ */ new Map();
1577
- for (const h of o)
1578
- L.set(`${h.group}-${h.index}`, h);
1579
- for (const h of t.bandConfigs) {
1580
- const I = e.getGroupXScaleKey(h.group), P = I != null ? e.getScale(I) : void 0, D = L.get(`${h.group}-${h.series[0]}`), T = L.get(`${h.group}-${h.series[1]}`);
1581
- if (P == null || D == null || T == null) continue;
1582
- const M = e.getScale(D.yScale);
1583
- if (M == null) continue;
1584
- const [S, b] = n.getWindow(h.group), C = h.series[0], z = h.series[1];
1585
- let p = s.getCachedBandPath(h.group, C, z, S, b);
1586
- p == null && (p = Vn(
1587
- n.getXValues(h.group),
1588
- n.getYValues(h.group, C),
1589
- n.getYValues(h.group, z),
1587
+ for (const g of o)
1588
+ L.set(`${g.group}-${g.index}`, g);
1589
+ for (const g of t.bandConfigs) {
1590
+ const w = e.getGroupXScaleKey(g.group), P = w != null ? e.getScale(w) : void 0, z = L.get(`${g.group}-${g.series[0]}`), T = L.get(`${g.group}-${g.series[1]}`);
1591
+ if (P == null || z == null || T == null) continue;
1592
+ const S = e.getScale(z.yScale);
1593
+ if (S == null) continue;
1594
+ const [C, v] = n.getWindow(g.group), I = g.series[0], D = g.series[1];
1595
+ let m = s.getCachedBandPath(g.group, I, D, C, v);
1596
+ m == null && (m = Vn(
1597
+ n.getXValues(g.group),
1598
+ n.getYValues(g.group, I),
1599
+ n.getYValues(g.group, D),
1590
1600
  P,
1591
- M,
1601
+ S,
1592
1602
  t.plotBox,
1593
1603
  r,
1594
- S,
1595
- b
1596
- ) ?? void 0, p != null && s.setCachedBandPath(h.group, C, z, S, b, p)), p != null && $n(u, h, p);
1604
+ C,
1605
+ v
1606
+ ) ?? void 0, m != null && s.setCachedBandPath(g.group, I, D, C, v, m)), m != null && $n(c, g, m);
1597
1607
  }
1598
- for (const h of x) {
1599
- const I = h.config;
1600
- if (I.show === !1) continue;
1601
- const P = I.points, D = I.width ?? 1, T = (P == null ? void 0 : P.size) ?? 3 + D * 2, M = (P == null ? void 0 : P.space) ?? T * 2, [S, b] = h.window;
1602
- _n(P == null ? void 0 : P.show, I.group, I.index, S, b, t.plotBox.width, M) && Gn(
1603
- u,
1604
- h.dataX,
1605
- h.dataY,
1606
- h.xScale,
1607
- h.yScale,
1608
+ for (const g of b) {
1609
+ const w = g.config;
1610
+ if (w.show === !1) continue;
1611
+ const P = w.points, z = w.width ?? 1, T = (P == null ? void 0 : P.size) ?? 3 + z * 2, S = (P == null ? void 0 : P.space) ?? T * 2, [C, v] = g.window;
1612
+ _n(P == null ? void 0 : P.show, w.group, w.index, C, v, t.plotBox.width, S) && Hn(
1613
+ c,
1614
+ g.dataX,
1615
+ g.dataY,
1616
+ g.xScale,
1617
+ g.yScale,
1608
1618
  t.plotBox,
1609
1619
  r,
1610
- S,
1611
- b,
1620
+ C,
1621
+ v,
1612
1622
  P,
1613
1623
  T,
1614
- (typeof I.stroke == "string" ? I.stroke : null) ?? "#000"
1624
+ (typeof w.stroke == "string" ? w.stroke : null) ?? "#000"
1615
1625
  );
1616
1626
  }
1617
- if (u.restore(), t.drawHooks.size > 0) {
1618
- u.save(), u.beginPath(), u.rect(
1627
+ if (c.restore(), t.drawHooks.size > 0) {
1628
+ c.save(), c.beginPath(), c.rect(
1619
1629
  t.plotBox.left * r,
1620
1630
  t.plotBox.top * r,
1621
1631
  t.plotBox.width * r,
1622
1632
  t.plotBox.height * r
1623
- ), u.clip(), u.scale(r, r);
1624
- const h = $t(u, t.plotBox, r, g);
1625
- for (const I of t.drawHooks)
1633
+ ), c.clip(), c.scale(r, r);
1634
+ const g = Bt(c, t.plotBox, r, d);
1635
+ for (const w of t.drawHooks)
1626
1636
  try {
1627
- I(h);
1637
+ w(g);
1628
1638
  } catch (P) {
1629
1639
  console.warn("[uPlot+] draw hook error:", P);
1630
1640
  }
1631
- u.restore();
1641
+ c.restore();
1632
1642
  }
1633
- if (t.cursorManager.state.left >= 0 && (s.saveSnapshot(u, i * r, l * r), t.cursorManager.update(
1643
+ if (t.cursorManager.state.left >= 0 && (s.saveSnapshot(c, i * r, l * r), t.cursorManager.update(
1634
1644
  t.cursorManager.state.left,
1635
1645
  t.cursorManager.state.top,
1636
1646
  t.plotBox,
1637
1647
  n.data,
1638
1648
  o,
1639
- g,
1640
- (h) => n.getWindow(h),
1641
- (h) => e.getGroupXScaleKey(h)
1649
+ d,
1650
+ (g) => n.getWindow(g),
1651
+ (g) => e.getGroupXScaleKey(g)
1642
1652
  )), ae(
1643
- u,
1653
+ c,
1644
1654
  t.cursorManager.state,
1645
1655
  t.plotBox,
1646
1656
  r,
1647
1657
  n.data,
1648
1658
  o,
1649
- g,
1650
- (h) => e.getGroupXScaleKey(h)
1651
- ), ce(u, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
1652
- u.save(), u.scale(r, r);
1653
- const h = $t(u, t.plotBox, r, g);
1654
- for (const I of t.cursorDrawHooks)
1659
+ d,
1660
+ (g) => e.getGroupXScaleKey(g)
1661
+ ), ce(c, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
1662
+ c.save(), c.scale(r, r);
1663
+ const g = Bt(c, t.plotBox, r, d);
1664
+ for (const w of t.cursorDrawHooks)
1655
1665
  try {
1656
- I(h, t.cursorManager.state);
1666
+ w(g, t.cursorManager.state);
1657
1667
  } catch (P) {
1658
1668
  console.warn("[uPlot+] draw hook error:", P);
1659
1669
  }
1660
- u.restore();
1670
+ c.restore();
1661
1671
  }
1662
- for (const h of t.listeners) h();
1672
+ for (const g of t.listeners) g();
1663
1673
  if (t._prevScaleRanges.size > 0 && t.eventCallbacks.onScaleChange != null)
1664
- for (const h of e.getAllScales()) {
1665
- if (h.min == null || h.max == null) continue;
1666
- const I = t._prevScaleRanges.get(h.id);
1667
- if (I == null || I.min !== h.min || I.max !== h.max)
1674
+ for (const g of e.getAllScales()) {
1675
+ if (g.min == null || g.max == null) continue;
1676
+ const w = t._prevScaleRanges.get(g.id);
1677
+ if (w == null || w.min !== g.min || w.max !== g.max)
1668
1678
  try {
1669
- t.eventCallbacks.onScaleChange(h.id, h.min, h.max);
1679
+ t.eventCallbacks.onScaleChange(g.id, g.min, g.max);
1670
1680
  } catch (P) {
1671
1681
  console.warn("[uPlot+] event callback error:", P);
1672
1682
  }
1673
1683
  }
1674
1684
  t._prevScaleRanges.clear();
1675
- for (const h of e.getAllScales())
1676
- h.min != null && h.max != null && t._prevScaleRanges.set(h.id, { min: h.min, max: h.max });
1685
+ for (const g of e.getAllScales())
1686
+ g.min != null && g.max != null && t._prevScaleRanges.set(g.id, { min: g.min, max: g.max });
1677
1687
  }
1678
1688
  };
1679
1689
  return t.scheduler.onRedraw(() => t.redraw()), t;
@@ -1691,15 +1701,15 @@ function En() {
1691
1701
  const t = E(null);
1692
1702
  return t.current === null && (t.current = Bn()), t.current;
1693
1703
  }
1694
- const ke = De(null);
1695
- function ot() {
1704
+ const ke = ze(null);
1705
+ function lt() {
1696
1706
  const t = Le(ke);
1697
1707
  if (!t)
1698
1708
  throw new Error("useChart must be used within a <Chart> component");
1699
1709
  return t;
1700
1710
  }
1701
1711
  function Xn(t, e) {
1702
- Y(() => {
1712
+ K(() => {
1703
1713
  if (e != null)
1704
1714
  return Yn(t, e);
1705
1715
  }, [t, e]);
@@ -1708,103 +1718,103 @@ function Yn(t, e) {
1708
1718
  let n = null;
1709
1719
  const s = { show: !1, left: 0, top: 0, width: 0, height: 0 };
1710
1720
  let o = null, i = null, l = !1;
1711
- function r(p) {
1712
- const m = e.getBoundingClientRect(), w = t.plotBox, y = p.clientX - m.left - w.left, k = p.clientY - m.top - w.top;
1713
- return { cx: y, cy: k };
1721
+ function r(m) {
1722
+ const p = e.getBoundingClientRect(), M = t.plotBox, k = m.clientX - p.left - M.left, y = m.clientY - p.top - M.top;
1723
+ return { cx: k, cy: y };
1714
1724
  }
1715
- function a(p, m) {
1716
- const w = t.plotBox;
1717
- return p >= 0 && p <= w.width && m >= 0 && m <= w.height;
1725
+ function a(m, p) {
1726
+ const M = t.plotBox;
1727
+ return m >= 0 && m <= M.width && p >= 0 && p <= M.height;
1718
1728
  }
1719
- function c(p, m) {
1720
- const w = e.getBoundingClientRect(), y = p - w.left, k = m - w.top, A = t.plotBox;
1729
+ function u(m, p) {
1730
+ const M = e.getBoundingClientRect(), k = m - M.left, y = p - M.top, A = t.plotBox;
1721
1731
  for (const F of t.axisStates) {
1722
- const R = F.config, H = R.side;
1732
+ const R = F.config, G = R.side;
1723
1733
  if (F._size <= 0) continue;
1724
- const B = k >= A.top && k <= A.top + A.height, W = y >= A.left && y <= A.left + A.width;
1725
- if (H === U.Left && y < A.left && B || H === U.Right && y > A.left + A.width && B || H === U.Top && k < A.top && W || H === U.Bottom && k > A.top + A.height && W) {
1726
- const O = Mt(H);
1727
- return { scaleId: R.scale, ori: O };
1734
+ const B = y >= A.top && y <= A.top + A.height, W = k >= A.left && k <= A.left + A.width;
1735
+ if (G === U.Left && k < A.left && B || G === U.Right && k > A.left + A.width && B || G === U.Top && y < A.top && W || G === U.Bottom && y > A.top + A.height && W) {
1736
+ const j = xt(G);
1737
+ return { scaleId: R.scale, ori: j };
1728
1738
  }
1729
1739
  }
1730
1740
  return null;
1731
1741
  }
1732
- function u(p, m, w) {
1733
- const y = t.cursorManager.state;
1734
- let k = null;
1735
- if (y.activeGroup >= 0 && y.activeDataIdx >= 0) {
1736
- const A = t.dataStore.data[y.activeGroup];
1742
+ function c(m, p, M) {
1743
+ const k = t.cursorManager.state;
1744
+ let y = null;
1745
+ if (k.activeGroup >= 0 && k.activeDataIdx >= 0) {
1746
+ const A = t.dataStore.data[k.activeGroup];
1737
1747
  if (A != null) {
1738
- const F = A.x[y.activeDataIdx], R = A.series[y.activeSeriesIdx], H = R != null ? R[y.activeDataIdx] : void 0;
1739
- if (F != null && H != null) {
1740
- const V = t.plotBox, B = t.scaleManager.getGroupXScaleKey(y.activeGroup), W = B != null ? t.scaleManager.getScale(B) : void 0, j = t.seriesConfigs.find(
1741
- (jt) => jt.group === y.activeGroup && jt.index === y.activeSeriesIdx
1742
- ), O = j != null ? t.scaleManager.getScale(j.yScale) : void 0;
1743
- let pt = m, Gt = w;
1744
- (W == null ? void 0 : W.min) != null && W.max != null && (pt = _(F, W, V.width, V.left) - V.left), (O == null ? void 0 : O.min) != null && O.max != null && (Gt = _(H, O, V.height, V.top) - V.top);
1745
- const Kt = m - pt, Nt = w - Gt;
1746
- k = {
1747
- group: y.activeGroup,
1748
- seriesIdx: y.activeSeriesIdx,
1749
- dataIdx: y.activeDataIdx,
1748
+ const F = A.x[k.activeDataIdx], R = A.series[k.activeSeriesIdx], G = R != null ? R[k.activeDataIdx] : void 0;
1749
+ if (F != null && G != null) {
1750
+ const H = t.plotBox, B = t.scaleManager.getGroupXScaleKey(k.activeGroup), W = B != null ? t.scaleManager.getScale(B) : void 0, Y = t.seriesConfigs.find(
1751
+ (qt) => qt.group === k.activeGroup && qt.index === k.activeSeriesIdx
1752
+ ), j = Y != null ? t.scaleManager.getScale(Y.yScale) : void 0;
1753
+ let st = p, Ht = M;
1754
+ (W == null ? void 0 : W.min) != null && W.max != null && (st = $(F, W, H.width, H.left) - H.left), (j == null ? void 0 : j.min) != null && j.max != null && (Ht = $(G, j, H.height, H.top) - H.top);
1755
+ const Nt = p - st, jt = M - Ht;
1756
+ y = {
1757
+ group: k.activeGroup,
1758
+ seriesIdx: k.activeSeriesIdx,
1759
+ dataIdx: k.activeDataIdx,
1750
1760
  xVal: F,
1751
- yVal: H,
1752
- pxX: pt,
1753
- pxY: Gt,
1754
- dist: Math.sqrt(Kt * Kt + Nt * Nt)
1761
+ yVal: G,
1762
+ pxX: st,
1763
+ pxY: Ht,
1764
+ dist: Math.sqrt(Nt * Nt + jt * jt)
1755
1765
  };
1756
1766
  }
1757
1767
  }
1758
1768
  }
1759
- return { plotX: m, plotY: w, point: k, srcEvent: p };
1769
+ return { plotX: p, plotY: M, point: y, srcEvent: m };
1760
1770
  }
1761
- function d(p) {
1762
- const m = t.plotBox, w = p.left / m.width, y = (p.left + p.width) / m.width, k = {};
1771
+ function h(m) {
1772
+ const p = t.plotBox, M = m.left / p.width, k = (m.left + m.width) / p.width, y = {};
1763
1773
  for (const A of t.scaleManager.getAllScales()) {
1764
- if (A.ori !== G.Horizontal || A.min == null || A.max == null) continue;
1765
- const F = it(
1766
- m.left + w * m.width,
1774
+ if (A.ori !== V.Horizontal || A.min == null || A.max == null) continue;
1775
+ const F = rt(
1776
+ p.left + M * p.width,
1767
1777
  A,
1768
- m.width,
1769
- m.left
1770
- ), R = it(
1771
- m.left + y * m.width,
1778
+ p.width,
1779
+ p.left
1780
+ ), R = rt(
1781
+ p.left + k * p.width,
1772
1782
  A,
1773
- m.width,
1774
- m.left
1783
+ p.width,
1784
+ p.left
1775
1785
  );
1776
- k[A.id] = {
1786
+ y[A.id] = {
1777
1787
  min: Math.min(F, R),
1778
1788
  max: Math.max(F, R)
1779
1789
  };
1780
1790
  }
1781
- return { left: w, right: y, ranges: k };
1791
+ return { left: M, right: k, ranges: y };
1782
1792
  }
1783
1793
  function f() {
1784
- const p = t.eventCallbacks.onScaleChange;
1785
- if (p != null)
1786
- for (const m of t.scaleManager.getAllScales()) {
1787
- if (m.min == null || m.max == null) continue;
1788
- const w = t._prevScaleRanges.get(m.id);
1789
- (w == null || w.min !== m.min || w.max !== m.max) && p(m.id, m.min, m.max);
1794
+ const m = t.eventCallbacks.onScaleChange;
1795
+ if (m != null)
1796
+ for (const p of t.scaleManager.getAllScales()) {
1797
+ if (p.min == null || p.max == null) continue;
1798
+ const M = t._prevScaleRanges.get(p.id);
1799
+ (M == null || M.min !== p.min || M.max !== p.max) && m(p.id, p.min, p.max);
1790
1800
  }
1791
1801
  }
1792
- function g(p, m) {
1802
+ function d(m, p) {
1793
1803
  if (i != null) {
1794
- const A = e.getBoundingClientRect(), F = p.clientY - A.top, R = t.plotBox, H = (F - i.startY) / R.height, V = i.startMax - i.startMin, B = t.scaleManager.getScale(i.scaleId);
1795
- B != null && (B.min = i.startMin + H * V, B.max = i.startMax + H * V, B.auto = !1, at(B), t.renderer.clearCache(), t.scheduleRedraw());
1804
+ const A = e.getBoundingClientRect(), F = m.clientY - A.top, R = t.plotBox, G = (F - i.startY) / R.height, H = i.startMax - i.startMin, B = t.scaleManager.getScale(i.scaleId);
1805
+ B != null && (B.min = i.startMin + G * H, B.max = i.startMax + G * H, B.auto = !1, ct(B), t.renderer.clearCache(), t.scheduleRedraw());
1796
1806
  return;
1797
1807
  }
1798
- const w = r(p);
1799
- if (w == null) return;
1800
- const { cx: y, cy: k } = w;
1801
- if (!a(y, k) && n == null) {
1808
+ const M = r(m);
1809
+ if (M == null) return;
1810
+ const { cx: k, cy: y } = M;
1811
+ if (!a(k, y) && n == null) {
1802
1812
  t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), t.scheduleCursorRedraw();
1803
1813
  return;
1804
1814
  }
1805
1815
  if (t.cursorManager.update(
1806
- y,
1807
1816
  k,
1817
+ y,
1808
1818
  t.plotBox,
1809
1819
  t.dataStore.data,
1810
1820
  t.seriesConfigs,
@@ -1820,41 +1830,41 @@ function Yn(t, e) {
1820
1830
  F >= 0 && t.focusedSeries !== F && (t.focusedSeries = F, t.scheduleRedraw());
1821
1831
  }
1822
1832
  }
1823
- if (m != null && t.eventCallbacks.onCursorMove != null && a(y, k))
1833
+ if (p != null && t.eventCallbacks.onCursorMove != null && a(k, y))
1824
1834
  try {
1825
- t.eventCallbacks.onCursorMove(u(m, y, k));
1835
+ t.eventCallbacks.onCursorMove(c(p, k, y));
1826
1836
  } catch (A) {
1827
1837
  console.warn("[uPlot+] event callback error:", A);
1828
1838
  }
1829
1839
  if (n != null) {
1830
- const A = n.x, F = t.plotBox, R = Math.max(0, Math.min(y, F.width));
1840
+ const A = n.x, F = t.plotBox, R = Math.max(0, Math.min(k, F.width));
1831
1841
  s.show = !0, s.left = Math.min(A, R), s.top = 0, s.width = Math.abs(R - A), s.height = F.height, t.selectState = s;
1832
1842
  }
1833
1843
  n != null ? t.scheduler.mark(tt.Cursor | tt.Select) : t.scheduleCursorRedraw();
1834
1844
  }
1835
- function v(p) {
1836
- g(p, p);
1845
+ function x(m) {
1846
+ d(m, m);
1837
1847
  }
1838
- function x(p) {
1839
- if (p.button !== 0) return;
1840
- const m = c(p.clientX, p.clientY);
1841
- if (m != null && m.ori === G.Vertical) {
1842
- const y = t.scaleManager.getScale(m.scaleId);
1843
- if (y != null && y.min != null && y.max != null) {
1844
- const k = e.getBoundingClientRect();
1848
+ function b(m) {
1849
+ if (m.button !== 0) return;
1850
+ const p = u(m.clientX, m.clientY);
1851
+ if (p != null && p.ori === V.Vertical) {
1852
+ const k = t.scaleManager.getScale(p.scaleId);
1853
+ if (k != null && k.min != null && k.max != null) {
1854
+ const y = e.getBoundingClientRect();
1845
1855
  i = {
1846
- scaleId: m.scaleId,
1847
- startY: p.clientY - k.top,
1848
- startMin: y.min,
1849
- startMax: y.max
1850
- }, p.preventDefault();
1856
+ scaleId: p.scaleId,
1857
+ startY: m.clientY - y.top,
1858
+ startMin: k.min,
1859
+ startMax: k.max
1860
+ }, m.preventDefault();
1851
1861
  return;
1852
1862
  }
1853
1863
  }
1854
- const w = r(p);
1855
- w != null && a(w.cx, w.cy) && (n = { x: w.cx, y: w.cy }, l = !1, s.show = !1, s.left = 0, s.width = 0, t.selectState = s);
1864
+ const M = r(m);
1865
+ M != null && a(M.cx, M.cy) && (n = { x: M.cx, y: M.cy }, l = !1, s.show = !1, s.left = 0, s.width = 0, t.selectState = s);
1856
1866
  }
1857
- function L(p) {
1867
+ function L(m) {
1858
1868
  if (i != null) {
1859
1869
  f(), i = null;
1860
1870
  return;
@@ -1862,159 +1872,180 @@ function Yn(t, e) {
1862
1872
  if (n != null) {
1863
1873
  if (s.width > 5) {
1864
1874
  l = !0;
1865
- let m = !0;
1875
+ let p = !0;
1866
1876
  if (t.eventCallbacks.onSelect != null) {
1867
- const w = d(s);
1868
- let y;
1877
+ const M = h(s);
1878
+ let k;
1869
1879
  try {
1870
- y = t.eventCallbacks.onSelect(w);
1871
- } catch (k) {
1872
- console.warn("[uPlot+] event callback error:", k);
1880
+ k = t.eventCallbacks.onSelect(M);
1881
+ } catch (y) {
1882
+ console.warn("[uPlot+] event callback error:", y);
1873
1883
  }
1874
- y === !1 && (m = !1);
1884
+ k === !1 && (p = !1);
1875
1885
  }
1876
- m && (S(s), f());
1886
+ p && (C(s), f());
1877
1887
  }
1878
1888
  n = null, s.show = !1, s.left = 0, s.width = 0, t.selectState = s, t.scheduleRedraw();
1879
1889
  }
1880
1890
  }
1881
- function h(p) {
1891
+ function g(m) {
1882
1892
  L();
1883
1893
  }
1884
- function I(p) {
1894
+ function w(m) {
1885
1895
  if (l) {
1886
1896
  l = !1;
1887
1897
  return;
1888
1898
  }
1889
- const m = t.eventCallbacks.onClick;
1890
- if (m == null) return;
1891
- const w = r(p);
1892
- if (w != null && a(w.cx, w.cy))
1899
+ const p = t.eventCallbacks.onClick;
1900
+ if (p == null) return;
1901
+ const M = r(m);
1902
+ if (M != null && a(M.cx, M.cy))
1893
1903
  try {
1894
- m(u(p, w.cx, w.cy));
1895
- } catch (y) {
1896
- console.warn("[uPlot+] event callback error:", y);
1904
+ p(c(m, M.cx, M.cy));
1905
+ } catch (k) {
1906
+ console.warn("[uPlot+] event callback error:", k);
1897
1907
  }
1898
1908
  }
1899
- function P(p) {
1900
- const m = t.eventCallbacks.onContextMenu;
1901
- if (m == null) return;
1902
- const w = r(p);
1903
- if (w != null && a(w.cx, w.cy)) {
1904
- p.preventDefault();
1909
+ function P(m) {
1910
+ const p = t.eventCallbacks.onContextMenu;
1911
+ if (p == null) return;
1912
+ const M = r(m);
1913
+ if (M != null && a(M.cx, M.cy)) {
1914
+ m.preventDefault();
1905
1915
  try {
1906
- m(u(p, w.cx, w.cy));
1907
- } catch (y) {
1908
- console.warn("[uPlot+] event callback error:", y);
1916
+ p(c(m, M.cx, M.cy));
1917
+ } catch (k) {
1918
+ console.warn("[uPlot+] event callback error:", k);
1909
1919
  }
1910
1920
  }
1911
1921
  }
1912
- function D(p) {
1913
- var m, w;
1922
+ function z(m) {
1923
+ var p, M;
1914
1924
  t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), n != null && (n = null, s.show = !1, s.width = 0, t.selectState = s), i != null && (i = null), t.scheduleCursorRedraw();
1915
1925
  try {
1916
- (w = (m = t.eventCallbacks).onCursorLeave) == null || w.call(m);
1917
- } catch (y) {
1918
- console.warn("[uPlot+] event callback error:", y);
1926
+ (M = (p = t.eventCallbacks).onCursorLeave) == null || M.call(p);
1927
+ } catch (k) {
1928
+ console.warn("[uPlot+] event callback error:", k);
1919
1929
  }
1920
1930
  }
1921
- function T(p) {
1931
+ function T(m) {
1922
1932
  if (t.eventCallbacks.onDblClick != null) {
1923
- const m = r(p);
1924
- if (m != null && a(m.cx, m.cy)) {
1925
- let w;
1933
+ const p = r(m);
1934
+ if (p != null && a(p.cx, p.cy)) {
1935
+ let M;
1926
1936
  try {
1927
- w = t.eventCallbacks.onDblClick(u(p, m.cx, m.cy));
1928
- } catch (y) {
1929
- console.warn("[uPlot+] event callback error:", y);
1937
+ M = t.eventCallbacks.onDblClick(c(m, p.cx, p.cy));
1938
+ } catch (k) {
1939
+ console.warn("[uPlot+] event callback error:", k);
1930
1940
  }
1931
- if (w === !1)
1941
+ if (M === !1)
1932
1942
  return;
1933
1943
  }
1934
1944
  }
1935
- for (const m of t.scaleConfigs)
1936
- t.scaleManager.addScale(m);
1945
+ for (const p of t.scaleConfigs)
1946
+ t.scaleManager.addScale(p);
1937
1947
  t.renderer.clearCache(), t.scheduleRedraw();
1938
1948
  }
1939
- function M(p) {
1940
- if (!t.wheelZoom) return;
1941
- const m = r(p);
1942
- if (m == null || !a(m.cx, m.cy)) return;
1943
- p.preventDefault();
1944
- const w = Math.max(0.1, Math.min(10, 1 - p.deltaY * 1e-3)), y = t.plotBox;
1945
- for (const k of t.scaleManager.getAllScales()) {
1946
- if (k.ori !== G.Horizontal || k.min == null || k.max == null) continue;
1947
- const A = it(m.cx + y.left, k, y.width, y.left), F = A - (A - k.min) * w, R = A + (k.max - A) * w;
1948
- k.min = Math.min(F, R), k.max = Math.max(F, R), k.auto = !1, at(k);
1949
+ function S(m) {
1950
+ const p = t.wheelZoom;
1951
+ if (!p) return;
1952
+ let M = !1, k = !1;
1953
+ if (p === !0 || p === "x")
1954
+ M = !0;
1955
+ else if (p === "y")
1956
+ k = !0;
1957
+ else if (p === "xy")
1958
+ M = !0, k = !0;
1959
+ else if (typeof p == "object") {
1960
+ if (p.x) {
1961
+ const R = typeof p.x == "object" ? p.x.key : void 0;
1962
+ M = R == null || m[`${R}Key`];
1963
+ }
1964
+ if (p.y) {
1965
+ const R = typeof p.y == "object" ? p.y.key : void 0;
1966
+ k = R == null || m[`${R}Key`];
1967
+ }
1968
+ }
1969
+ if (!M && !k) return;
1970
+ const y = r(m);
1971
+ if (y == null || !a(y.cx, y.cy)) return;
1972
+ m.preventDefault();
1973
+ const A = Math.max(0.1, Math.min(10, 1 - m.deltaY * 1e-3)), F = t.plotBox;
1974
+ for (const R of t.scaleManager.getAllScales()) {
1975
+ if (R.min == null || R.max == null) continue;
1976
+ const G = R.ori === V.Horizontal;
1977
+ if (G && !M || !G && !k) continue;
1978
+ const H = G ? F.width : F.height, B = G ? F.left : F.top, W = G ? y.cx + F.left : y.cy + F.top, Y = rt(W, R, H, B), j = Y - (Y - R.min) * A, st = Y + (R.max - Y) * A;
1979
+ R.min = Math.min(j, st), R.max = Math.max(j, st), R.auto = !1, ct(R);
1949
1980
  }
1950
1981
  t.renderer.clearCache(), t.scheduleRedraw(), f();
1951
1982
  }
1952
- function S(p) {
1953
- const m = t.plotBox, w = p.left / m.width, y = (p.left + p.width) / m.width;
1954
- for (const k of t.scaleManager.getAllScales()) {
1955
- if (k.ori !== G.Horizontal || k.min == null || k.max == null) continue;
1956
- const A = it(
1957
- m.left + w * m.width,
1958
- k,
1959
- m.width,
1960
- m.left
1961
- ), F = it(
1962
- m.left + y * m.width,
1963
- k,
1964
- m.width,
1965
- m.left
1983
+ function C(m) {
1984
+ const p = t.plotBox, M = m.left / p.width, k = (m.left + m.width) / p.width;
1985
+ for (const y of t.scaleManager.getAllScales()) {
1986
+ if (y.ori !== V.Horizontal || y.min == null || y.max == null) continue;
1987
+ const A = rt(
1988
+ p.left + M * p.width,
1989
+ y,
1990
+ p.width,
1991
+ p.left
1992
+ ), F = rt(
1993
+ p.left + k * p.width,
1994
+ y,
1995
+ p.width,
1996
+ p.left
1966
1997
  );
1967
- k.min = Math.min(A, F), k.max = Math.max(A, F), k.auto = !1, at(k);
1998
+ y.min = Math.min(A, F), y.max = Math.max(A, F), y.auto = !1, ct(y);
1968
1999
  }
1969
2000
  t.renderer.clearCache();
1970
2001
  }
1971
- function b(p) {
1972
- if (p.touches.length === 2) {
1973
- const y = p.touches[0], k = p.touches[1], A = k.clientX - y.clientX, F = k.clientY - y.clientY;
2002
+ function v(m) {
2003
+ if (m.touches.length === 2) {
2004
+ const k = m.touches[0], y = m.touches[1], A = y.clientX - k.clientX, F = y.clientY - k.clientY;
1974
2005
  o = {
1975
2006
  dist: Math.sqrt(A * A + F * F),
1976
- midX: (y.clientX + k.clientX) / 2,
1977
- midY: (y.clientY + k.clientY) / 2
2007
+ midX: (k.clientX + y.clientX) / 2,
2008
+ midY: (k.clientY + y.clientY) / 2
1978
2009
  }, n = null;
1979
2010
  return;
1980
2011
  }
1981
- const m = p.touches[0];
1982
- if (m == null) return;
1983
- const w = r(m);
1984
- w != null && a(w.cx, w.cy) && (n = { x: w.cx, y: w.cy }, l = !1);
2012
+ const p = m.touches[0];
2013
+ if (p == null) return;
2014
+ const M = r(p);
2015
+ M != null && a(M.cx, M.cy) && (n = { x: M.cx, y: M.cy }, l = !1);
1985
2016
  }
1986
- function C(p) {
1987
- if (p.touches.length === 2 && o != null) {
1988
- p.preventDefault();
1989
- const w = p.touches[0], y = p.touches[1], k = y.clientX - w.clientX, A = y.clientY - w.clientY, F = Math.sqrt(k * k + A * A), R = F / o.dist, H = e.getBoundingClientRect(), V = t.plotBox, B = o.midX - H.left - V.left;
2017
+ function I(m) {
2018
+ if (m.touches.length === 2 && o != null) {
2019
+ m.preventDefault();
2020
+ const M = m.touches[0], k = m.touches[1], y = k.clientX - M.clientX, A = k.clientY - M.clientY, F = Math.sqrt(y * y + A * A), R = F / o.dist, G = e.getBoundingClientRect(), H = t.plotBox, B = o.midX - G.left - H.left;
1990
2021
  for (const W of t.scaleManager.getAllScales()) {
1991
- if (W.ori !== G.Horizontal || W.min == null || W.max == null) continue;
1992
- const j = it(B + V.left, W, V.width, V.left), O = j - (j - W.min) / R, pt = j + (W.max - j) / R;
1993
- W.min = Math.min(O, pt), W.max = Math.max(O, pt), W.auto = !1, at(W);
2022
+ if (W.ori !== V.Horizontal || W.min == null || W.max == null) continue;
2023
+ const Y = rt(B + H.left, W, H.width, H.left), j = Y - (Y - W.min) / R, st = Y + (W.max - Y) / R;
2024
+ W.min = Math.min(j, st), W.max = Math.max(j, st), W.auto = !1, ct(W);
1994
2025
  }
1995
2026
  o.dist = F, t.renderer.clearCache(), t.scheduleRedraw(), f();
1996
2027
  return;
1997
2028
  }
1998
- const m = p.touches[0];
1999
- m != null && (g(m, p), n != null && p.preventDefault());
2029
+ const p = m.touches[0];
2030
+ p != null && (d(p, m), n != null && m.preventDefault());
2000
2031
  }
2001
- function z(p) {
2032
+ function D(m) {
2002
2033
  if (o != null) {
2003
2034
  o = null;
2004
2035
  return;
2005
2036
  }
2006
- p.changedTouches[0] != null && L();
2037
+ m.changedTouches[0] != null && L();
2007
2038
  }
2008
- return e.addEventListener("mousemove", v), e.addEventListener("mousedown", x), e.addEventListener("mouseup", h), e.addEventListener("click", I), e.addEventListener("contextmenu", P), e.addEventListener("mouseleave", D), e.addEventListener("dblclick", T), e.addEventListener("wheel", M, { passive: !1 }), e.addEventListener("touchstart", b, { passive: !0 }), e.addEventListener("touchmove", C, { passive: !1 }), e.addEventListener("touchend", z), () => {
2009
- e.removeEventListener("mousemove", v), e.removeEventListener("mousedown", x), e.removeEventListener("mouseup", h), e.removeEventListener("click", I), e.removeEventListener("contextmenu", P), e.removeEventListener("mouseleave", D), e.removeEventListener("dblclick", T), e.removeEventListener("wheel", M), e.removeEventListener("touchstart", b), e.removeEventListener("touchmove", C), e.removeEventListener("touchend", z);
2039
+ return e.addEventListener("mousemove", x), e.addEventListener("mousedown", b), e.addEventListener("mouseup", g), e.addEventListener("click", w), e.addEventListener("contextmenu", P), e.addEventListener("mouseleave", z), e.addEventListener("dblclick", T), e.addEventListener("wheel", S, { passive: !1 }), e.addEventListener("touchstart", v, { passive: !0 }), e.addEventListener("touchmove", I, { passive: !1 }), e.addEventListener("touchend", D), () => {
2040
+ e.removeEventListener("mousemove", x), e.removeEventListener("mousedown", b), e.removeEventListener("mouseup", g), e.removeEventListener("click", w), e.removeEventListener("contextmenu", P), e.removeEventListener("mouseleave", z), e.removeEventListener("dblclick", T), e.removeEventListener("wheel", S), e.removeEventListener("touchstart", v), e.removeEventListener("touchmove", I), e.removeEventListener("touchend", D);
2010
2041
  };
2011
2042
  }
2012
- const Bt = /* @__PURE__ */ new Map();
2013
- function Un(t) {
2014
- let e = Bt.get(t);
2015
- return e == null && (e = new Kn(t), Bt.set(t, e)), e;
2043
+ const Wt = /* @__PURE__ */ new Map();
2044
+ function Kn(t) {
2045
+ let e = Wt.get(t);
2046
+ return e == null && (e = new Un(t), Wt.set(t, e)), e;
2016
2047
  }
2017
- class Kn {
2048
+ class Un {
2018
2049
  constructor(e) {
2019
2050
  this.members = /* @__PURE__ */ new Set(), this.publishing = !1, this.syncedStores = /* @__PURE__ */ new WeakSet(), this.key = e;
2020
2051
  }
@@ -2024,7 +2055,7 @@ class Kn {
2024
2055
  }
2025
2056
  /** Remove a chart from this sync group. Cleans up empty groups. */
2026
2057
  leave(e) {
2027
- this.members.delete(e), this.members.size === 0 && Bt.delete(this.key);
2058
+ this.members.delete(e), this.members.size === 0 && Wt.delete(this.key);
2028
2059
  }
2029
2060
  /**
2030
2061
  * Publish cursor position from one chart to all others in the group.
@@ -2055,9 +2086,9 @@ class Kn {
2055
2086
  }
2056
2087
  }
2057
2088
  function Nn(t, e) {
2058
- Y(() => {
2089
+ K(() => {
2059
2090
  if (e == null) return;
2060
- const n = Un(e);
2091
+ const n = Kn(e);
2061
2092
  n.join(t);
2062
2093
  let s = -1, o = -1;
2063
2094
  const i = t.subscribe(() => {
@@ -2076,77 +2107,78 @@ function Ce({
2076
2107
  children: s,
2077
2108
  className: o,
2078
2109
  pxRatio: i,
2079
- onDraw: l,
2080
- onCursorDraw: r,
2081
- syncKey: a,
2110
+ title: l,
2111
+ onDraw: r,
2112
+ onCursorDraw: a,
2113
+ syncKey: u,
2082
2114
  cursor: c,
2083
- onClick: u,
2084
- onContextMenu: d,
2085
- onDblClick: f,
2086
- onCursorMove: g,
2087
- onCursorLeave: v,
2088
- onScaleChange: x,
2089
- onSelect: L
2115
+ onClick: h,
2116
+ onContextMenu: f,
2117
+ onDblClick: d,
2118
+ onCursorMove: x,
2119
+ onCursorLeave: b,
2120
+ onScaleChange: L,
2121
+ onSelect: g
2090
2122
  }) {
2091
- var m;
2092
- const h = En(), [I, P] = St(null), D = i ?? (typeof window < "u" && window.devicePixelRatio || 1), T = (c == null ? void 0 : c.wheelZoom) ?? !1, M = ((m = c == null ? void 0 : c.focus) == null ? void 0 : m.alpha) ?? ((c == null ? void 0 : c.focus) != null ? 0.15 : 1);
2093
- Y(() => {
2094
- h.wheelZoom = T, h.focusAlpha = M;
2095
- }, [h, T, M]), h.eventCallbacks.onClick = u, h.eventCallbacks.onContextMenu = d, h.eventCallbacks.onDblClick = f, h.eventCallbacks.onCursorMove = g, h.eventCallbacks.onCursorLeave = v, h.eventCallbacks.onScaleChange = x, h.eventCallbacks.onSelect = L, Xn(h, I), Nn(h, a);
2096
- const S = q((w) => {
2097
- h.canvas = w, w && h.scheduleRedraw();
2098
- }, [h]), b = q((w) => {
2099
- P(w);
2123
+ var k;
2124
+ const w = En(), [P, z] = St(null), T = i ?? (typeof window < "u" && window.devicePixelRatio || 1), S = c == null ? void 0 : c.wheelZoom, C = typeof S == "object" ? JSON.stringify(S) : S, v = ((k = c == null ? void 0 : c.focus) == null ? void 0 : k.alpha) ?? ((c == null ? void 0 : c.focus) != null ? 0.15 : 1);
2125
+ K(() => {
2126
+ w.wheelZoom = S, w.focusAlpha = v;
2127
+ }, [w, C, v]), w.title = l, w.eventCallbacks.onClick = h, w.eventCallbacks.onContextMenu = f, w.eventCallbacks.onDblClick = d, w.eventCallbacks.onCursorMove = x, w.eventCallbacks.onCursorLeave = b, w.eventCallbacks.onScaleChange = L, w.eventCallbacks.onSelect = g, Xn(w, P), Nn(w, u);
2128
+ const I = Z((y) => {
2129
+ w.canvas = y, y && w.scheduleRedraw();
2130
+ }, [w]), D = Z((y) => {
2131
+ z(y);
2100
2132
  }, []);
2101
- Y(() => {
2102
- h.pxRatio = D, h.setSize(t, e);
2103
- }, [h, t, e, D]), Y(() => () => {
2104
- h.canvas = null, h.scheduler.cancel(), h.focusedSeries = null;
2105
- }, [h]), Y(() => {
2106
- if (I == null || typeof ResizeObserver > "u") return;
2107
- const w = new ResizeObserver((y) => {
2108
- const k = y[0];
2109
- if (k == null) return;
2110
- const { width: A, height: F } = k.contentRect;
2111
- A > 0 && F > 0 && (A !== h.width || F !== h.height) && h.setSize(Math.round(A), Math.round(F));
2133
+ K(() => {
2134
+ w.pxRatio = T, w.setSize(t, e);
2135
+ }, [w, t, e, T]), K(() => () => {
2136
+ w.canvas = null, w.scheduler.cancel(), w.focusedSeries = null;
2137
+ }, [w]), K(() => {
2138
+ if (P == null || typeof ResizeObserver > "u") return;
2139
+ const y = new ResizeObserver((A) => {
2140
+ const F = A[0];
2141
+ if (F == null) return;
2142
+ const { width: R, height: G } = F.contentRect;
2143
+ R > 0 && G > 0 && (R !== w.width || G !== w.height) && w.setSize(Math.round(R), Math.round(G));
2112
2144
  });
2113
- return w.observe(I), () => {
2114
- w.disconnect();
2145
+ return y.observe(P), () => {
2146
+ y.disconnect();
2115
2147
  };
2116
- }, [h, I]);
2117
- const C = E(n);
2118
- Y(() => {
2119
- if (n === C.current && h.dataStore.data.length > 0) return;
2120
- C.current = n, h.dataStore.setData(n), h.renderer.clearCache();
2121
- const w = "x";
2122
- h.scaleManager.getScale(w) || h.registerScale({
2123
- id: w,
2148
+ }, [w, P]);
2149
+ const m = E(n);
2150
+ K(() => {
2151
+ if (n === m.current && w.dataStore.data.length > 0) return;
2152
+ m.current = n, w.dataStore.setData(n), w.renderer.clearCache();
2153
+ const y = "x";
2154
+ w.scaleManager.getScale(y) || w.registerScale({
2155
+ id: y,
2124
2156
  auto: !0
2125
2157
  });
2126
- for (let y = 0; y < n.length; y++)
2127
- h.scaleManager.setGroupXScale(y, w);
2128
- h.scheduleRedraw();
2129
- }, [h, n]);
2130
- const z = E(l);
2131
- z.current = l, Y(() => {
2132
- const w = (y) => {
2133
- var k;
2134
- (k = z.current) == null || k.call(z, y);
2158
+ for (let A = 0; A < n.length; A++)
2159
+ w.scaleManager.setGroupXScale(A, y);
2160
+ w.scheduleRedraw();
2161
+ }, [w, n]);
2162
+ const p = E(r);
2163
+ p.current = r, K(() => {
2164
+ const y = (A) => {
2165
+ var F;
2166
+ (F = p.current) == null || F.call(p, A);
2135
2167
  };
2136
- return h.drawHooks.add(w), () => {
2137
- h.drawHooks.delete(w);
2168
+ return w.drawHooks.add(y), () => {
2169
+ w.drawHooks.delete(y);
2138
2170
  };
2139
- }, [h]);
2140
- const p = E(r);
2141
- return p.current = r, Y(() => {
2142
- const w = (y, k) => {
2143
- var A;
2144
- (A = p.current) == null || A.call(p, y, k);
2171
+ }, [w]);
2172
+ const M = E(a);
2173
+ return M.current = a, K(() => {
2174
+ const y = (A, F) => {
2175
+ var R;
2176
+ (R = M.current) == null || R.call(M, A, F);
2145
2177
  };
2146
- return h.cursorDrawHooks.add(w), () => {
2147
- h.cursorDrawHooks.delete(w);
2178
+ return w.cursorDrawHooks.add(y), () => {
2179
+ w.cursorDrawHooks.delete(y);
2148
2180
  };
2149
- }, [h]), /* @__PURE__ */ X(ke.Provider, { value: h, children: /* @__PURE__ */ Q(
2181
+ }, [w]), /* @__PURE__ */ X(ke.Provider, { value: w, children: /* @__PURE__ */ Q(
2150
2182
  "div",
2151
2183
  {
2152
2184
  className: o,
@@ -2160,7 +2192,7 @@ function Ce({
2160
2192
  /* @__PURE__ */ X(
2161
2193
  "div",
2162
2194
  {
2163
- ref: b,
2195
+ ref: D,
2164
2196
  style: {
2165
2197
  position: "relative",
2166
2198
  width: `${t}px`,
@@ -2171,7 +2203,7 @@ function Ce({
2171
2203
  children: /* @__PURE__ */ X(
2172
2204
  "canvas",
2173
2205
  {
2174
- ref: S,
2206
+ ref: I,
2175
2207
  style: {
2176
2208
  position: "absolute",
2177
2209
  left: 0,
@@ -2211,30 +2243,30 @@ function Ut(t, e) {
2211
2243
  return !0;
2212
2244
  }
2213
2245
  function Lt(t) {
2214
- const e = ot(), n = E(t);
2215
- n.current = t, Y(() => {
2246
+ const e = lt(), n = E(t);
2247
+ n.current = t, K(() => {
2216
2248
  const o = n.current;
2217
2249
  return e.registerScale({ ...o }), e.scheduleRedraw(), () => {
2218
2250
  e.unregisterScale(o.id), e.scheduleRedraw();
2219
2251
  };
2220
2252
  }, [e, t.id]);
2221
2253
  const s = E(null);
2222
- return Y(() => {
2254
+ return K(() => {
2223
2255
  Ut(s.current, t) || (s.current = t, e.scaleConfigs = e.scaleConfigs.map(
2224
2256
  (o) => o.id === t.id ? { ...t } : o
2225
2257
  ), e.scaleManager.addScale({ ...t }), e.renderer.clearCache(), e.scheduleRedraw());
2226
2258
  }), null;
2227
2259
  }
2228
2260
  function Te(t) {
2229
- const e = ot(), n = E(t);
2230
- n.current = t, Y(() => {
2261
+ const e = lt(), n = E(t);
2262
+ n.current = t, K(() => {
2231
2263
  const o = n.current;
2232
2264
  return e.registerSeries({ ...o, show: o.show ?? !0 }), e.renderer.clearCache(), e.scheduleRedraw(), () => {
2233
2265
  e.unregisterSeries(o.group, o.index), e.renderer.clearCache(), e.scheduleRedraw();
2234
2266
  };
2235
2267
  }, [e, t.group, t.index]);
2236
2268
  const s = E(null);
2237
- return Y(() => {
2269
+ return K(() => {
2238
2270
  Ut(s.current, t) || (s.current = t, e.seriesConfigs = e.seriesConfigs.map(
2239
2271
  (o) => o.group === t.group && o.index === t.index ? { ...t, show: t.show ?? !0 } : o
2240
2272
  ), e.renderer.invalidateSeries(t.group, t.index), e.scheduleRedraw());
@@ -2243,9 +2275,9 @@ function Te(t) {
2243
2275
  function qn(t) {
2244
2276
  return { ...t, side: t.side ?? (t.scale === "x" ? U.Bottom : U.Left), show: t.show ?? !0 };
2245
2277
  }
2246
- function Dt(t) {
2247
- const e = ot(), n = qn(t), s = E(n);
2248
- s.current = n, Y(() => {
2278
+ function zt(t) {
2279
+ const e = lt(), n = qn(t), s = E(n);
2280
+ s.current = n, K(() => {
2249
2281
  const i = s.current;
2250
2282
  return e.axisConfigs = e.axisConfigs.filter(
2251
2283
  (l) => !(l.scale === i.scale && l.side === i.side)
@@ -2256,18 +2288,18 @@ function Dt(t) {
2256
2288
  };
2257
2289
  }, [e, n.scale, n.side]);
2258
2290
  const o = E(null);
2259
- return Y(() => {
2291
+ return K(() => {
2260
2292
  Ut(o.current, t) || (o.current = t, e.axisConfigs = e.axisConfigs.map(
2261
2293
  (i) => i.scale === n.scale && i.side === n.side ? n : i
2262
2294
  ), e.scheduleRedraw());
2263
2295
  }), null;
2264
2296
  }
2265
2297
  function as({ series: t, group: e, fill: n, dir: s }) {
2266
- const o = ot(), i = E(null), l = t[0], r = t[1];
2267
- return Y(() => {
2298
+ const o = lt(), i = E(null), l = t[0], r = t[1];
2299
+ return K(() => {
2268
2300
  const a = { series: [l, r], group: e, fill: n, dir: s };
2269
- return i.current != null && (o.bandConfigs = o.bandConfigs.filter((c) => c !== i.current)), i.current = a, o.bandConfigs.push(a), o.scheduleRedraw(), () => {
2270
- o.bandConfigs = o.bandConfigs.filter((c) => c !== i.current), i.current = null, o.scheduleRedraw();
2301
+ return i.current != null && (o.bandConfigs = o.bandConfigs.filter((u) => u !== i.current)), i.current = a, o.bandConfigs.push(a), o.scheduleRedraw(), () => {
2302
+ o.bandConfigs = o.bandConfigs.filter((u) => u !== i.current), i.current = null, o.scheduleRedraw();
2271
2303
  };
2272
2304
  }, [o, l, r, e, n, s]), null;
2273
2305
  }
@@ -2284,8 +2316,8 @@ const Zn = {
2284
2316
  cursor: "pointer",
2285
2317
  fontSize: 12,
2286
2318
  fontFamily: "sans-serif"
2287
- }, Qn = ze(function({ group: e, index: n, label: s, color: o, isHidden: i, valueStr: l, store: r }) {
2288
- const a = q(() => {
2319
+ }, Qn = De(function({ group: e, index: n, label: s, color: o, isHidden: i, valueStr: l, store: r }) {
2320
+ const a = Z(() => {
2289
2321
  r.toggleSeries(e, n);
2290
2322
  }, [r, e, n]);
2291
2323
  return /* @__PURE__ */ Q(
@@ -2302,18 +2334,18 @@ const Zn = {
2302
2334
  );
2303
2335
  });
2304
2336
  function cs({ show: t = !0, position: e = "bottom", className: n }) {
2305
- const s = ot(), o = E({ activeGroup: -1, activeDataIdx: -1, seriesCount: 0, revision: -1 }), i = q(
2306
- (u) => s.subscribe(u),
2337
+ const s = lt(), o = E({ activeGroup: -1, activeDataIdx: -1, seriesCount: 0, revision: -1 }), i = Z(
2338
+ (c) => s.subscribe(c),
2307
2339
  [s]
2308
- ), l = q(() => {
2309
- const { activeGroup: u, activeDataIdx: d } = s.cursorManager.state, f = s.seriesConfigs.length, { revision: g } = s, v = o.current;
2310
- if (v.activeGroup === u && v.activeDataIdx === d && v.seriesCount === f && v.revision === g)
2311
- return v;
2312
- const x = { activeGroup: u, activeDataIdx: d, seriesCount: f, revision: g };
2313
- return o.current = x, x;
2340
+ ), l = Z(() => {
2341
+ const { activeGroup: c, activeDataIdx: h } = s.cursorManager.state, f = s.seriesConfigs.length, { revision: d } = s, x = o.current;
2342
+ if (x.activeGroup === c && x.activeDataIdx === h && x.seriesCount === f && x.revision === d)
2343
+ return x;
2344
+ const b = { activeGroup: c, activeDataIdx: h, seriesCount: f, revision: d };
2345
+ return o.current = b, b;
2314
2346
  }, [s]), r = fe(i, l);
2315
2347
  if (!t) return null;
2316
- const { activeGroup: a, activeDataIdx: c } = r;
2348
+ const { activeGroup: a, activeDataIdx: u } = r;
2317
2349
  return /* @__PURE__ */ X(
2318
2350
  "div",
2319
2351
  {
@@ -2325,25 +2357,25 @@ function cs({ show: t = !0, position: e = "bottom", className: n }) {
2325
2357
  order: e === "top" ? -1 : 1,
2326
2358
  padding: "4px 0"
2327
2359
  },
2328
- children: s.seriesConfigs.map((u) => {
2329
- const d = typeof u.stroke == "string" ? u.stroke : "#000";
2360
+ children: s.seriesConfigs.map((c) => {
2361
+ const h = typeof c.stroke == "string" ? c.stroke : "#000";
2330
2362
  let f = "";
2331
- if (c >= 0 && a >= 0) {
2332
- const v = s.dataStore.getYValues(u.group, u.index)[c];
2333
- v != null && (f = typeof v == "number" ? v.toPrecision(4) : String(v));
2363
+ if (u >= 0 && a >= 0) {
2364
+ const x = s.dataStore.getYValues(c.group, c.index)[u];
2365
+ x != null && (f = typeof x == "number" ? x.toPrecision(4) : String(x));
2334
2366
  }
2335
2367
  return /* @__PURE__ */ X(
2336
2368
  Qn,
2337
2369
  {
2338
- group: u.group,
2339
- index: u.index,
2340
- label: u.label ?? `Series ${u.index}`,
2341
- color: d,
2342
- isHidden: u.show === !1,
2370
+ group: c.group,
2371
+ index: c.index,
2372
+ label: c.label ?? `Series ${c.index}`,
2373
+ color: h,
2374
+ isHidden: c.show === !1,
2343
2375
  valueStr: f,
2344
2376
  store: s
2345
2377
  },
2346
- `${u.group}:${u.index}`
2378
+ `${c.group}:${c.index}`
2347
2379
  );
2348
2380
  })
2349
2381
  }
@@ -2355,57 +2387,57 @@ function us({
2355
2387
  children: n,
2356
2388
  offset: s = {}
2357
2389
  }) {
2358
- var w, y;
2359
- const o = ot(), i = E({ left: -10, top: -10, activeGroup: -1, activeDataIdx: -1, revision: -1 }), l = E(null), r = q(
2360
- (k) => o.subscribe(k),
2390
+ var M, k;
2391
+ const o = lt(), i = E({ left: -10, top: -10, activeGroup: -1, activeDataIdx: -1, revision: -1 }), l = E(null), r = Z(
2392
+ (y) => o.subscribe(y),
2361
2393
  [o]
2362
- ), a = q(() => {
2363
- const k = o.cursorManager.state, { revision: A } = o, F = i.current;
2364
- if (F.left === k.left && F.top === k.top && F.activeGroup === k.activeGroup && F.activeDataIdx === k.activeDataIdx && F.revision === A)
2394
+ ), a = Z(() => {
2395
+ const y = o.cursorManager.state, { revision: A } = o, F = i.current;
2396
+ if (F.left === y.left && F.top === y.top && F.activeGroup === y.activeGroup && F.activeDataIdx === y.activeDataIdx && F.revision === A)
2365
2397
  return F;
2366
2398
  const R = {
2367
- left: k.left,
2368
- top: k.top,
2369
- activeGroup: k.activeGroup,
2370
- activeDataIdx: k.activeDataIdx,
2399
+ left: y.left,
2400
+ top: y.top,
2401
+ activeGroup: y.activeGroup,
2402
+ activeDataIdx: y.activeDataIdx,
2371
2403
  revision: A
2372
2404
  };
2373
2405
  return i.current = R, R;
2374
- }, [o]), c = fe(r, a);
2375
- if (!t || c.activeDataIdx < 0 || c.activeGroup < 0 || c.left < 0) return null;
2376
- const { activeGroup: u, activeDataIdx: d } = c, f = o.plotBox, g = o.dataStore.data[u], v = g != null ? g.x[d] ?? null : null, x = v != null ? parseFloat(v.toPrecision(6)).toString() : "", L = [];
2377
- for (const k of o.seriesConfigs) {
2378
- if (k.show === !1) continue;
2379
- const A = o.dataStore.getYValues(k.group, k.index), F = k.group === u ? A[d] : null;
2406
+ }, [o]), u = fe(r, a);
2407
+ if (!t || u.activeDataIdx < 0 || u.activeGroup < 0 || u.left < 0) return null;
2408
+ const { activeGroup: c, activeDataIdx: h } = u, f = o.plotBox, d = o.dataStore.data[c], x = d != null ? d.x[h] ?? null : null, b = x != null ? parseFloat(x.toPrecision(6)).toString() : "", L = [];
2409
+ for (const y of o.seriesConfigs) {
2410
+ if (y.show === !1) continue;
2411
+ const A = o.dataStore.getYValues(y.group, y.index), F = y.group === c ? A[h] : null;
2380
2412
  L.push({
2381
- label: k.label ?? `Series ${k.index}`,
2413
+ label: y.label ?? `Series ${y.index}`,
2382
2414
  value: F,
2383
- color: typeof k.stroke == "string" ? k.stroke : "#000",
2384
- group: k.group,
2385
- index: k.index
2415
+ color: typeof y.stroke == "string" ? y.stroke : "#000",
2416
+ group: y.group,
2417
+ index: y.index
2386
2418
  });
2387
2419
  }
2388
- const h = {
2389
- x: v,
2390
- xLabel: x,
2420
+ const g = {
2421
+ x,
2422
+ xLabel: b,
2391
2423
  items: L,
2392
- left: c.left + f.left,
2393
- top: c.top + f.top
2394
- }, I = s.x ?? 12, P = s.y ?? -12, D = ((w = l.current) == null ? void 0 : w.offsetWidth) ?? 0, T = ((y = l.current) == null ? void 0 : y.offsetHeight) ?? 0, M = c.left + f.left, S = c.top + f.top, b = f.left + f.width, C = f.top + f.height, z = Math.max(f.left, Math.min(M + I, b - D)), p = Math.max(f.top, Math.min(S + P, C - T)), m = {
2424
+ left: u.left + f.left,
2425
+ top: u.top + f.top
2426
+ }, w = s.x ?? 12, P = s.y ?? -12, z = ((M = l.current) == null ? void 0 : M.offsetWidth) ?? 0, T = ((k = l.current) == null ? void 0 : k.offsetHeight) ?? 0, S = u.left + f.left, C = u.top + f.top, v = f.left + f.width, I = f.top + f.height, D = Math.max(f.left, Math.min(S + w, v - z)), m = Math.max(f.top, Math.min(C + P, I - T)), p = {
2395
2427
  position: "absolute",
2396
- left: z,
2397
- top: p,
2428
+ left: D,
2429
+ top: m,
2398
2430
  whiteSpace: "nowrap",
2399
2431
  pointerEvents: "none",
2400
2432
  zIndex: 100
2401
2433
  };
2402
- return n ? /* @__PURE__ */ X("div", { ref: l, className: e, style: m, children: n(h) }) : /* @__PURE__ */ Q(
2434
+ return n ? /* @__PURE__ */ X("div", { ref: l, className: e, style: p, children: n(g) }) : /* @__PURE__ */ Q(
2403
2435
  "div",
2404
2436
  {
2405
2437
  ref: l,
2406
2438
  className: e,
2407
2439
  style: {
2408
- ...m,
2440
+ ...p,
2409
2441
  background: "rgba(0,0,0,0.85)",
2410
2442
  color: "#fff",
2411
2443
  padding: "6px 10px",
@@ -2416,15 +2448,15 @@ function us({
2416
2448
  lineHeight: 1.5
2417
2449
  },
2418
2450
  children: [
2419
- /* @__PURE__ */ X("div", { style: { fontWeight: 600, marginBottom: 2 }, children: x }),
2420
- L.map((k) => /* @__PURE__ */ Q("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2421
- /* @__PURE__ */ X("span", { style: { width: 8, height: 8, borderRadius: "50%", backgroundColor: k.color, display: "inline-block" } }),
2451
+ /* @__PURE__ */ X("div", { style: { fontWeight: 600, marginBottom: 2 }, children: b }),
2452
+ L.map((y) => /* @__PURE__ */ Q("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2453
+ /* @__PURE__ */ X("span", { style: { width: 8, height: 8, borderRadius: "50%", backgroundColor: y.color, display: "inline-block" } }),
2422
2454
  /* @__PURE__ */ Q("span", { children: [
2423
- k.label,
2455
+ y.label,
2424
2456
  ":"
2425
2457
  ] }),
2426
- /* @__PURE__ */ X("span", { style: { fontWeight: 600 }, children: k.value != null ? k.value.toPrecision(4) : "—" })
2427
- ] }, `${k.group}:${k.index}`))
2458
+ /* @__PURE__ */ X("span", { style: { fontWeight: 600 }, children: y.value != null ? y.value.toPrecision(4) : "—" })
2459
+ ] }, `${y.group}:${y.index}`))
2428
2460
  ]
2429
2461
  }
2430
2462
  );
@@ -2439,96 +2471,96 @@ function fs({
2439
2471
  colors: l,
2440
2472
  grips: r = !1
2441
2473
  }) {
2442
- const a = E(null), [c, u] = St(() => {
2474
+ const a = E(null), [u, c] = St(() => {
2443
2475
  if (o != null && n.length > 0) {
2444
2476
  const T = n[0];
2445
2477
  if (T != null && T.x.length > 1) {
2446
- const M = T.x[0], b = T.x[T.x.length - 1] - M;
2447
- if (b > 0)
2478
+ const S = T.x[0], v = T.x[T.x.length - 1] - S;
2479
+ if (v > 0)
2448
2480
  return [
2449
- Math.max(0, (o[0] - M) / b),
2450
- Math.min(1, (o[1] - M) / b)
2481
+ Math.max(0, (o[0] - S) / v),
2482
+ Math.min(1, (o[1] - S) / v)
2451
2483
  ];
2452
2484
  }
2453
2485
  }
2454
2486
  return [0.25, 0.75];
2455
- }), d = E(null);
2456
- Y(() => {
2487
+ }), h = E(null);
2488
+ K(() => {
2457
2489
  if (s == null || n.length === 0) return;
2458
2490
  const T = n[0];
2459
2491
  if (T == null || T.x.length < 2) return;
2460
- const M = T.x[0], b = T.x[T.x.length - 1] - M, C = M + c[0] * b, z = M + c[1] * b, p = d.current, m = Math.max(1e-10, Math.abs(z - C) * 1e-12);
2461
- p != null && Math.abs(p[0] - C) < m && Math.abs(p[1] - z) < m || (d.current = [C, z], s(C, z));
2462
- }, [c, n, s]);
2463
- const f = E(null), g = q((T) => {
2464
- const M = a.current;
2465
- if (M == null) return 0;
2466
- const S = M.getBoundingClientRect();
2467
- return Math.max(0, Math.min(1, (T - S.left) / S.width));
2468
- }, []), v = q((T) => {
2469
- const M = a.current;
2470
- if (M == null) return;
2471
- const S = g(T.clientX), b = M.getBoundingClientRect().width, C = b > 0 ? 8 / b : 0;
2472
- let z;
2473
- if (Math.abs(S - c[0]) < C)
2474
- z = "left";
2475
- else if (Math.abs(S - c[1]) < C)
2476
- z = "right";
2477
- else if (S >= c[0] && S <= c[1])
2478
- z = "move";
2492
+ const S = T.x[0], v = T.x[T.x.length - 1] - S, I = S + u[0] * v, D = S + u[1] * v, m = h.current, p = Math.max(1e-10, Math.abs(D - I) * 1e-12);
2493
+ m != null && Math.abs(m[0] - I) < p && Math.abs(m[1] - D) < p || (h.current = [I, D], s(I, D));
2494
+ }, [u, n, s]);
2495
+ const f = E(null), d = Z((T) => {
2496
+ const S = a.current;
2497
+ if (S == null) return 0;
2498
+ const C = S.getBoundingClientRect();
2499
+ return Math.max(0, Math.min(1, (T - C.left) / C.width));
2500
+ }, []), x = Z((T) => {
2501
+ const S = a.current;
2502
+ if (S == null) return;
2503
+ const C = d(T.clientX), v = S.getBoundingClientRect().width, I = v > 0 ? 8 / v : 0;
2504
+ let D;
2505
+ if (Math.abs(C - u[0]) < I)
2506
+ D = "left";
2507
+ else if (Math.abs(C - u[1]) < I)
2508
+ D = "right";
2509
+ else if (C >= u[0] && C <= u[1])
2510
+ D = "move";
2479
2511
  else {
2480
- const p = c[1] - c[0], m = p / 2, w = Math.max(0, Math.min(1 - p, S - m));
2481
- u([w, w + p]), z = "move";
2512
+ const m = u[1] - u[0], p = m / 2, M = Math.max(0, Math.min(1 - m, C - p));
2513
+ c([M, M + m]), D = "move";
2482
2514
  }
2483
2515
  f.current = {
2484
- mode: z,
2516
+ mode: D,
2485
2517
  startX: T.clientX,
2486
- startFrac: [...c]
2487
- }, M.setPointerCapture(T.pointerId), T.preventDefault();
2488
- }, [c, g]), x = q((T) => {
2489
- const M = f.current;
2490
- if (M == null) return;
2491
- const S = g(T.clientX), b = g(M.startX), C = S - b;
2492
- if (M.mode === "move") {
2493
- const z = M.startFrac[1] - M.startFrac[0];
2494
- let p = M.startFrac[0] + C;
2495
- p = Math.max(0, Math.min(1 - z, p)), u([p, p + z]);
2496
- } else if (M.mode === "left") {
2497
- const z = Math.max(0, Math.min(M.startFrac[1] - 0.01, M.startFrac[0] + C));
2498
- u([z, M.startFrac[1]]);
2518
+ startFrac: [...u]
2519
+ }, S.setPointerCapture(T.pointerId), T.preventDefault();
2520
+ }, [u, d]), b = Z((T) => {
2521
+ const S = f.current;
2522
+ if (S == null) return;
2523
+ const C = d(T.clientX), v = d(S.startX), I = C - v;
2524
+ if (S.mode === "move") {
2525
+ const D = S.startFrac[1] - S.startFrac[0];
2526
+ let m = S.startFrac[0] + I;
2527
+ m = Math.max(0, Math.min(1 - D, m)), c([m, m + D]);
2528
+ } else if (S.mode === "left") {
2529
+ const D = Math.max(0, Math.min(S.startFrac[1] - 0.01, S.startFrac[0] + I));
2530
+ c([D, S.startFrac[1]]);
2499
2531
  } else {
2500
- const z = Math.min(1, Math.max(M.startFrac[0] + 0.01, M.startFrac[1] + C));
2501
- u([M.startFrac[0], z]);
2532
+ const D = Math.min(1, Math.max(S.startFrac[0] + 0.01, S.startFrac[1] + I));
2533
+ c([S.startFrac[0], D]);
2502
2534
  }
2503
- }, [g]), L = q((T) => {
2535
+ }, [d]), L = Z((T) => {
2504
2536
  f.current = null;
2505
- const M = a.current;
2506
- M != null && M.releasePointerCapture(T.pointerId);
2507
- }, []), h = `${c[0] * 100}%`, I = `${(c[1] - c[0]) * 100}%`, P = n[0], D = P != null ? P.series.length : 0;
2537
+ const S = a.current;
2538
+ S != null && S.releasePointerCapture(T.pointerId);
2539
+ }, []), g = `${u[0] * 100}%`, w = `${(u[1] - u[0]) * 100}%`, P = n[0], z = P != null ? P.series.length : 0;
2508
2540
  return /* @__PURE__ */ Q("div", { className: i, style: { position: "relative", width: t, height: e }, children: [
2509
2541
  /* @__PURE__ */ Q(Ce, { width: t, height: e, data: n, children: [
2510
2542
  /* @__PURE__ */ X(Lt, { id: "x" }),
2511
2543
  /* @__PURE__ */ X(Lt, { id: "y" }),
2512
- /* @__PURE__ */ X(Dt, { scale: "x", show: !1 }),
2513
- /* @__PURE__ */ X(Dt, { scale: "y", show: !1 }),
2514
- Array.from({ length: D }, (T, M) => /* @__PURE__ */ X(
2544
+ /* @__PURE__ */ X(zt, { scale: "x", show: !1 }),
2545
+ /* @__PURE__ */ X(zt, { scale: "y", show: !1 }),
2546
+ Array.from({ length: z }, (T, S) => /* @__PURE__ */ X(
2515
2547
  Te,
2516
2548
  {
2517
2549
  group: 0,
2518
- index: M,
2550
+ index: S,
2519
2551
  yScale: "y",
2520
- stroke: l != null && l[M] != null ? l[M] : `hsl(${M * 137}, 60%, 50%)`,
2552
+ stroke: l != null && l[S] != null ? l[S] : `hsl(${S * 137}, 60%, 50%)`,
2521
2553
  width: 1
2522
2554
  },
2523
- M
2555
+ S
2524
2556
  ))
2525
2557
  ] }),
2526
2558
  /* @__PURE__ */ Q(
2527
2559
  "div",
2528
2560
  {
2529
2561
  ref: a,
2530
- onPointerDown: v,
2531
- onPointerMove: x,
2562
+ onPointerDown: x,
2563
+ onPointerMove: b,
2532
2564
  onPointerUp: L,
2533
2565
  style: {
2534
2566
  position: "absolute",
@@ -2547,7 +2579,7 @@ function fs({
2547
2579
  position: "absolute",
2548
2580
  top: 0,
2549
2581
  left: 0,
2550
- width: h,
2582
+ width: g,
2551
2583
  height: "100%",
2552
2584
  background: "rgba(0,0,0,0.3)",
2553
2585
  pointerEvents: "none"
@@ -2560,7 +2592,7 @@ function fs({
2560
2592
  style: {
2561
2593
  position: "absolute",
2562
2594
  top: 0,
2563
- left: `${c[1] * 100}%`,
2595
+ left: `${u[1] * 100}%`,
2564
2596
  right: 0,
2565
2597
  height: "100%",
2566
2598
  background: "rgba(0,0,0,0.3)",
@@ -2574,8 +2606,8 @@ function fs({
2574
2606
  style: {
2575
2607
  position: "absolute",
2576
2608
  top: 0,
2577
- left: h,
2578
- width: I,
2609
+ left: g,
2610
+ width: w,
2579
2611
  height: "100%",
2580
2612
  borderLeft: "2px solid rgba(0,100,255,0.8)",
2581
2613
  borderRight: "2px solid rgba(0,100,255,0.8)",
@@ -2617,8 +2649,8 @@ function fs({
2617
2649
  ] });
2618
2650
  }
2619
2651
  function Pt(t) {
2620
- const e = ot(), n = E(t);
2621
- n.current = t, Y(() => {
2652
+ const e = lt(), n = E(t);
2653
+ n.current = t, K(() => {
2622
2654
  const s = (o) => n.current(o);
2623
2655
  return e.drawHooks.add(s), () => {
2624
2656
  e.drawHooks.delete(s);
@@ -2626,8 +2658,8 @@ function Pt(t) {
2626
2658
  }, [e]);
2627
2659
  }
2628
2660
  function hs(t) {
2629
- const e = ot(), n = E(t);
2630
- n.current = t, Y(() => {
2661
+ const e = lt(), n = E(t);
2662
+ n.current = t, K(() => {
2631
2663
  const s = (o, i) => n.current(o, i);
2632
2664
  return e.cursorDrawHooks.add(s), () => {
2633
2665
  e.cursorDrawHooks.delete(s);
@@ -2640,7 +2672,7 @@ function ds({
2640
2672
  gap: n = 2,
2641
2673
  scaleId: s = "x"
2642
2674
  }) {
2643
- const o = ot();
2675
+ const o = lt();
2644
2676
  return Pt(({ ctx: i, plotBox: l, pxRatio: r }) => {
2645
2677
  const a = o.scaleManager.getScale(s);
2646
2678
  if (a == null || a.min == null || a.max == null) return;
@@ -2650,15 +2682,15 @@ function ds({
2650
2682
  l.width * r,
2651
2683
  l.height * r
2652
2684
  ), i.clip();
2653
- const c = (e + n) * r, u = e * r, d = l.top * r;
2685
+ const u = (e + n) * r, c = e * r, h = l.top * r;
2654
2686
  for (let f = 0; f < t.length; f++) {
2655
- const g = t[f];
2656
- if (g == null) continue;
2657
- const v = d + f * c;
2658
- i.fillStyle = "#666", i.font = `${11 * r}px sans-serif`, i.textAlign = "right", i.textBaseline = "middle", i.fillText(g.label, (l.left - 6) * r, v + u / 2);
2659
- for (const x of g.segments) {
2660
- const L = _(x.start, a, l.width, l.left) * r, I = _(x.end, a, l.width, l.left) * r - L;
2661
- I <= 0 || (i.fillStyle = x.color ?? "#4dabf7", i.fillRect(L, v, I, u), x.label != null && I > 20 * r && (i.fillStyle = "#fff", i.font = `${10 * r}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle", i.fillText(x.label, L + I / 2, v + u / 2, I - 4 * r)));
2687
+ const d = t[f];
2688
+ if (d == null) continue;
2689
+ const x = h + f * u;
2690
+ i.fillStyle = "#666", i.font = `${11 * r}px sans-serif`, i.textAlign = "right", i.textBaseline = "middle", i.fillText(d.label, (l.left - 6) * r, x + c / 2);
2691
+ for (const b of d.segments) {
2692
+ const L = $(b.start, a, l.width, l.left) * r, w = $(b.end, a, l.width, l.left) * r - L;
2693
+ w <= 0 || (i.fillStyle = b.color ?? "#4dabf7", i.fillRect(L, x, w, c), b.label != null && w > 20 * r && (i.fillStyle = "#fff", i.font = `${10 * r}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle", i.fillText(b.label, L + w / 2, x + c / 2, w - 4 * r)));
2662
2694
  }
2663
2695
  }
2664
2696
  i.restore();
@@ -2678,8 +2710,8 @@ function gs({
2678
2710
  return /* @__PURE__ */ X("div", { style: { pointerEvents: "none" }, className: a, children: /* @__PURE__ */ Q(Ce, { width: e, height: n, data: t, children: [
2679
2711
  /* @__PURE__ */ X(Lt, { id: "x" }),
2680
2712
  /* @__PURE__ */ X(Lt, { id: "y" }),
2681
- /* @__PURE__ */ X(Dt, { scale: "x", show: !1 }),
2682
- /* @__PURE__ */ X(Dt, { scale: "y", show: !1 }),
2713
+ /* @__PURE__ */ X(zt, { scale: "x", show: !1 }),
2714
+ /* @__PURE__ */ X(zt, { scale: "y", show: !1 }),
2683
2715
  /* @__PURE__ */ X(
2684
2716
  Te,
2685
2717
  {
@@ -2696,24 +2728,24 @@ function gs({
2696
2728
  ] }) });
2697
2729
  }
2698
2730
  function ts(t, e, n, s = {}) {
2699
- const { ctx: o, plotBox: i } = t, l = _(n, e, i.height, i.top);
2731
+ const { ctx: o, plotBox: i } = t, l = $(n, e, i.height, i.top);
2700
2732
  o.beginPath(), o.moveTo(i.left, l), o.lineTo(i.left + i.width, l), o.strokeStyle = s.stroke ?? "red", o.lineWidth = s.width ?? 1, s.dash && o.setLineDash(s.dash), o.stroke(), s.dash && o.setLineDash([]);
2701
2733
  }
2702
2734
  function es(t, e, n, s = {}) {
2703
- const { ctx: o, plotBox: i } = t, l = _(n, e, i.width, i.left);
2735
+ const { ctx: o, plotBox: i } = t, l = $(n, e, i.width, i.left);
2704
2736
  o.beginPath(), o.moveTo(l, i.top), o.lineTo(l, i.top + i.height), o.strokeStyle = s.stroke ?? "red", o.lineWidth = s.width ?? 1, s.dash && o.setLineDash(s.dash), o.stroke(), s.dash && o.setLineDash([]);
2705
2737
  }
2706
2738
  function ps(t, e, n, s, o, i, l = {}) {
2707
- const { ctx: r, plotBox: a } = t, c = _(s, e, a.width, a.left), u = _(o, n, a.height, a.top);
2708
- r.font = l.font ?? "12px sans-serif", r.fillStyle = l.fill ?? "#000", r.textBaseline = "bottom", r.fillText(i, c, u - 4);
2739
+ const { ctx: r, plotBox: a } = t, u = $(s, e, a.width, a.left), c = $(o, n, a.height, a.top);
2740
+ r.font = l.font ?? "12px sans-serif", r.fillStyle = l.fill ?? "#000", r.textBaseline = "bottom", r.fillText(i, u, c - 4);
2709
2741
  }
2710
2742
  function ns(t, e, n, s, o = {}) {
2711
- const { ctx: i, plotBox: l } = t, r = _(s, e, l.height, l.top), a = _(n, e, l.height, l.top);
2743
+ const { ctx: i, plotBox: l } = t, r = $(s, e, l.height, l.top), a = $(n, e, l.height, l.top);
2712
2744
  i.fillStyle = o.fill ?? "rgba(255,0,0,0.1)", i.fillRect(l.left, Math.min(r, a), l.width, Math.abs(a - r)), o.stroke && (i.strokeStyle = o.stroke, i.lineWidth = o.width ?? 1, o.dash && i.setLineDash(o.dash), i.strokeRect(l.left, Math.min(r, a), l.width, Math.abs(a - r)), o.dash && i.setLineDash([]));
2713
2745
  }
2714
2746
  function ms(t) {
2715
2747
  const e = E(t);
2716
- return zt(() => {
2748
+ return Dt(() => {
2717
2749
  e.current = t;
2718
2750
  }), Pt((n) => {
2719
2751
  const s = e.current, o = s.yScale ?? "y", i = n.getScale(o);
@@ -2731,7 +2763,7 @@ function ms(t) {
2731
2763
  }
2732
2764
  function ws(t) {
2733
2765
  const e = E(t);
2734
- return zt(() => {
2766
+ return Dt(() => {
2735
2767
  e.current = t;
2736
2768
  }), Pt((n) => {
2737
2769
  const s = e.current, o = s.xScale ?? "x", i = n.getScale(o);
@@ -2749,7 +2781,7 @@ function ws(t) {
2749
2781
  }
2750
2782
  function vs(t) {
2751
2783
  const e = E(t);
2752
- return zt(() => {
2784
+ return Dt(() => {
2753
2785
  e.current = t;
2754
2786
  }), Pt((n) => {
2755
2787
  const s = e.current, o = n.getScale(s.yScale ?? "y");
@@ -2761,9 +2793,9 @@ function vs(t) {
2761
2793
  });
2762
2794
  }), null;
2763
2795
  }
2764
- function Ms(t) {
2796
+ function xs(t) {
2765
2797
  const e = E(t);
2766
- return zt(() => {
2798
+ return Dt(() => {
2767
2799
  e.current = t;
2768
2800
  }), Pt((n) => {
2769
2801
  const s = e.current, o = n.valToX(s.x, s.xScale ?? "x"), i = n.valToY(s.y, s.yScale ?? "y");
@@ -2772,138 +2804,138 @@ function Ms(t) {
2772
2804
  l.font = s.font ?? "12px sans-serif", l.fillStyle = s.fill ?? "#000", l.textAlign = s.align ?? "left", l.textBaseline = s.baseline ?? "bottom", l.fillText(s.text, o, i - 4);
2773
2805
  }), null;
2774
2806
  }
2775
- function xs(t, e) {
2776
- const { window: n, batchSize: s = 1 } = e, o = e.autoStart ?? !0, [i, l] = St(t), [r, a] = St(!1), [c, u] = St(0), d = E(0), f = E(0), g = E(0), v = E(/* @__PURE__ */ new Map()), x = E(0), L = E(n);
2807
+ function Ms(t, e) {
2808
+ const { window: n, batchSize: s = 1 } = e, o = e.autoStart ?? !0, [i, l] = St(t), [r, a] = St(!1), [u, c] = St(0), h = E(0), f = E(0), d = E(0), x = E(/* @__PURE__ */ new Map()), b = E(0), L = E(n);
2777
2809
  L.current = n;
2778
- const h = q(
2779
- (T, M, ...S) => {
2780
- let b = v.current.get(T);
2781
- b == null && (b = { x: [], series: S.map(() => []) }, v.current.set(T, b)), b.x.push(...M);
2782
- for (let C = 0; C < S.length; C++) {
2783
- let z = b.series[C];
2784
- z == null && (z = [], b.series[C] = z), z.push(...S[C] ?? []);
2810
+ const g = Z(
2811
+ (T, S, ...C) => {
2812
+ let v = x.current.get(T);
2813
+ v == null && (v = { x: [], series: C.map(() => []) }, x.current.set(T, v)), v.x.push(...S);
2814
+ for (let I = 0; I < C.length; I++) {
2815
+ let D = v.series[I];
2816
+ D == null && (D = [], v.series[I] = D), D.push(...C[I] ?? []);
2785
2817
  }
2786
- x.current === 0 && (x.current = requestAnimationFrame(() => {
2787
- x.current = 0;
2788
- const C = v.current;
2789
- v.current = /* @__PURE__ */ new Map();
2790
- const z = L.current;
2791
- l((p) => {
2792
- const m = p.slice();
2793
- for (const [w, { x: y, series: k }] of C) {
2794
- const A = m[w];
2818
+ b.current === 0 && (b.current = requestAnimationFrame(() => {
2819
+ b.current = 0;
2820
+ const I = x.current;
2821
+ x.current = /* @__PURE__ */ new Map();
2822
+ const D = L.current;
2823
+ l((m) => {
2824
+ const p = m.slice();
2825
+ for (const [M, { x: k, series: y }] of I) {
2826
+ const A = p[M];
2795
2827
  if (A == null) continue;
2796
- const F = A.x, R = Math.max(0, F.length + y.length - z), H = R > 0 ? F.slice(R).concat(y) : F.concat(y), V = A.series.map((B, W) => {
2797
- const j = B, O = k[W] ?? [];
2798
- return R > 0 ? j.slice(R).concat(O) : j.concat(O);
2828
+ const F = A.x, R = Math.max(0, F.length + k.length - D), G = R > 0 ? F.slice(R).concat(k) : F.concat(k), H = A.series.map((B, W) => {
2829
+ const Y = B, j = y[W] ?? [];
2830
+ return R > 0 ? Y.slice(R).concat(j) : Y.concat(j);
2799
2831
  });
2800
- m[w] = { x: H, series: V };
2832
+ p[M] = { x: G, series: H };
2801
2833
  }
2802
- return m;
2834
+ return p;
2803
2835
  });
2804
2836
  }));
2805
2837
  },
2806
2838
  []
2807
- ), I = q(
2808
- (T, ...M) => {
2809
- h(0, T, ...M);
2839
+ ), w = Z(
2840
+ (T, ...S) => {
2841
+ g(0, T, ...S);
2810
2842
  },
2811
- [h]
2812
- ), P = q(() => {
2843
+ [g]
2844
+ ), P = Z(() => {
2813
2845
  a(!0);
2814
- }, []), D = q(() => {
2846
+ }, []), z = Z(() => {
2815
2847
  a(!1);
2816
2848
  }, []);
2817
- return Y(() => {
2849
+ return K(() => {
2818
2850
  if (!r) {
2819
- d.current !== 0 && (cancelAnimationFrame(d.current), d.current = 0);
2851
+ h.current !== 0 && (cancelAnimationFrame(h.current), h.current = 0);
2820
2852
  return;
2821
2853
  }
2822
- g.current = performance.now(), f.current = 0;
2823
- const T = (M) => {
2854
+ d.current = performance.now(), f.current = 0;
2855
+ const T = (S) => {
2824
2856
  f.current++;
2825
- const S = M - g.current;
2826
- S >= 1e3 && (u(Math.round(f.current * 1e3 / S)), f.current = 0, g.current = M), d.current = requestAnimationFrame(T);
2857
+ const C = S - d.current;
2858
+ C >= 1e3 && (c(Math.round(f.current * 1e3 / C)), f.current = 0, d.current = S), h.current = requestAnimationFrame(T);
2827
2859
  };
2828
- return d.current = requestAnimationFrame(T), () => {
2829
- d.current !== 0 && (cancelAnimationFrame(d.current), d.current = 0);
2860
+ return h.current = requestAnimationFrame(T), () => {
2861
+ h.current !== 0 && (cancelAnimationFrame(h.current), h.current = 0);
2830
2862
  };
2831
- }, [r]), Y(() => () => {
2832
- x.current !== 0 && cancelAnimationFrame(x.current);
2833
- }, []), Y(() => {
2863
+ }, [r]), K(() => () => {
2864
+ b.current !== 0 && cancelAnimationFrame(b.current);
2865
+ }, []), K(() => {
2834
2866
  o && a(!0);
2835
- }, [o]), { data: i, push: I, pushGroup: h, start: P, stop: D, running: r, fps: c };
2867
+ }, [o]), { data: i, push: w, pushGroup: g, start: P, stop: z, running: r, fps: u };
2836
2868
  }
2837
2869
  function bs(t) {
2838
- return (e, n, s, o, i, l, r, a, c, u, d, f, g) => {
2839
- const v = (g == null ? void 0 : g.align) ?? t ?? 1, x = (g == null ? void 0 : g.spanGaps) ?? !1;
2840
- if ([c, u] = Ft(n, c, u), c === -1)
2870
+ return (e, n, s, o, i, l, r, a, u, c, h, f, d) => {
2871
+ const x = (d == null ? void 0 : d.align) ?? t ?? 1, b = (d == null ? void 0 : d.spanGaps) ?? !1;
2872
+ if ([u, c] = Ft(n, u, c), u === -1)
2841
2873
  return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
2842
- const L = (C) => f(_(C, s, i, r)), h = (C) => f(_(C, o, l, a)), I = s.ori === G.Horizontal ? Rt : Ht, P = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null }, D = P.stroke;
2874
+ const L = (I) => f($(I, s, i, r)), g = (I) => f($(I, o, l, a)), w = s.ori === V.Horizontal ? Rt : Gt, P = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null }, z = P.stroke;
2843
2875
  let T = !1;
2844
- const M = d === K.Forward ? c : u;
2845
- let S = h(n[M]), b = L(e[M]);
2846
- I(D, b, S);
2847
- for (let C = M; C >= c && C <= u; C += d) {
2848
- const z = n[C];
2849
- if (z == null) {
2850
- z === null && !x && (T = !0);
2876
+ const S = h === N.Forward ? u : c;
2877
+ let C = g(n[S]), v = L(e[S]);
2878
+ w(z, v, C);
2879
+ for (let I = S; I >= u && I <= c; I += h) {
2880
+ const D = n[I];
2881
+ if (D == null) {
2882
+ D === null && !b && (T = !0);
2851
2883
  continue;
2852
2884
  }
2853
- const p = L(e[C]), m = h(z);
2854
- if (v === 1)
2855
- I(D, p, S);
2856
- else if (v === -1)
2857
- I(D, b, m);
2885
+ const m = L(e[I]), p = g(D);
2886
+ if (x === 1)
2887
+ w(z, m, C);
2888
+ else if (x === -1)
2889
+ w(z, v, p);
2858
2890
  else {
2859
- const w = f((b + p) / 2);
2860
- I(D, w, S), I(D, w, m);
2891
+ const M = f((v + m) / 2);
2892
+ w(z, M, C), w(z, M, p);
2861
2893
  }
2862
- I(D, p, m), S = m, b = p;
2894
+ w(z, m, p), C = p, v = m;
2863
2895
  }
2864
2896
  {
2865
- const C = P.fill = new Path2D(D), z = (g == null ? void 0 : g.fillTo) ?? o.min ?? 0, p = h(z);
2866
- let m = r, w = r + i;
2867
- d === K.Backward && ([w, m] = [m, w]), I(C, w, p), I(C, m, p);
2897
+ const I = P.fill = new Path2D(z), D = (d == null ? void 0 : d.fillTo) ?? o.min ?? 0, m = g(D);
2898
+ let p = r, M = r + i;
2899
+ h === N.Backward && ([M, p] = [p, M]), w(I, M, m), w(I, p, m);
2868
2900
  }
2869
2901
  if (T) {
2870
- const C = Xt(e, n, c, u, d, L);
2871
- P.gaps = C, P.clip = Yt(C, s.ori, r, a, i, l);
2902
+ const I = Yt(e, n, u, c, h, L);
2903
+ P.gaps = I, P.clip = Kt(I, s.ori, r, a, i, l);
2872
2904
  }
2873
2905
  return P;
2874
2906
  };
2875
2907
  }
2876
2908
  function Ss() {
2877
- return (t, e, n, s, o, i, l, r, a, c, u, d, f) => {
2878
- const g = (f == null ? void 0 : f.barWidth) ?? 0.6, v = (f == null ? void 0 : f.barGap) ?? 0, x = (f == null ? void 0 : f.barRadius) ?? 0, L = (f == null ? void 0 : f.barGroupIdx) ?? 0, h = (f == null ? void 0 : f.barGroupCount) ?? 1, I = (w) => d(_(w, n, o, l)), P = (w) => d(_(w, s, i, r));
2879
- let D = o;
2880
- if (c > a) {
2881
- let w = 1 / 0, y = -1;
2882
- for (let k = a; k <= c; k++)
2883
- if (e[k] != null) {
2884
- if (y >= 0) {
2885
- const A = t[k], F = t[y], R = Math.abs(I(A) - I(F));
2886
- R < w && (w = R);
2909
+ return (t, e, n, s, o, i, l, r, a, u, c, h, f) => {
2910
+ const d = (f == null ? void 0 : f.barWidth) ?? 0.6, x = (f == null ? void 0 : f.barGap) ?? 0, b = (f == null ? void 0 : f.barRadius) ?? 0, L = (f == null ? void 0 : f.barGroupIdx) ?? 0, g = (f == null ? void 0 : f.barGroupCount) ?? 1, w = (M) => h($(M, n, o, l)), P = (M) => h($(M, s, i, r));
2911
+ let z = o;
2912
+ if (u > a) {
2913
+ let M = 1 / 0, k = -1;
2914
+ for (let y = a; y <= u; y++)
2915
+ if (e[y] != null) {
2916
+ if (k >= 0) {
2917
+ const A = t[y], F = t[k], R = Math.abs(w(A) - w(F));
2918
+ R < M && (M = R);
2887
2919
  }
2888
- y = k;
2920
+ k = y;
2889
2921
  }
2890
- w < 1 / 0 && (D = w);
2922
+ M < 1 / 0 && (z = M);
2891
2923
  }
2892
- const T = D * (1 - g), M = Math.max(0, T + v), S = Math.max(1, d(D - M)), b = h > 1 ? Math.max(1, d(S / Math.max(1, h))) : S, C = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, z = P(C), p = new Path2D(), m = n.ori === G.Horizontal;
2893
- for (let w = u === K.Forward ? a : c; w >= a && w <= c; w += u) {
2894
- const y = e[w];
2895
- if (y == null) continue;
2896
- const k = I(t[w]), A = P(y), F = h > 1 ? (L - (h - 1) / 2) * b : 0, R = d(k - b / 2 + F), H = Math.min(A, z), B = Math.max(A, z) - H;
2924
+ const T = z * (1 - d), S = Math.max(0, T + x), C = Math.max(1, h(z - S)), v = g > 1 ? Math.max(1, h(C / Math.max(1, g))) : C, I = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, D = P(I), m = new Path2D(), p = n.ori === V.Horizontal;
2925
+ for (let M = c === N.Forward ? a : u; M >= a && M <= u; M += c) {
2926
+ const k = e[M];
2927
+ if (k == null) continue;
2928
+ const y = w(t[M]), A = P(k), F = g > 1 ? (L - (g - 1) / 2) * v : 0, R = h(y - v / 2 + F), G = Math.min(A, D), B = Math.max(A, D) - G;
2897
2929
  if (B !== 0)
2898
- if (x > 0) {
2899
- const W = Math.min(x * b, B / 2);
2900
- ss(p, m, R, H, b, B, W, y < C);
2930
+ if (b > 0) {
2931
+ const W = Math.min(b * v, B / 2);
2932
+ ss(m, p, R, G, v, B, W, k < I);
2901
2933
  } else
2902
- m ? p.rect(R, H, b, B) : p.rect(H, R, B, b);
2934
+ p ? m.rect(R, G, v, B) : m.rect(G, R, B, v);
2903
2935
  }
2904
2936
  return {
2905
- stroke: p,
2906
- fill: p,
2937
+ stroke: m,
2938
+ fill: m,
2907
2939
  // bars are filled with the same path
2908
2940
  clip: null,
2909
2941
  band: null,
@@ -2915,33 +2947,33 @@ function ss(t, e, n, s, o, i, l, r) {
2915
2947
  l = Math.min(l, o / 2, i / 2), e ? r ? (t.moveTo(n, s), t.lineTo(n + o, s), t.lineTo(n + o, s + i - l), t.arc(n + o - l, s + i - l, l, 0, Math.PI / 2), t.lineTo(n + l, s + i), t.arc(n + l, s + i - l, l, Math.PI / 2, Math.PI), t.closePath()) : (t.moveTo(n, s + i), t.lineTo(n, s + l), t.arc(n + l, s + l, l, Math.PI, Math.PI * 1.5), t.lineTo(n + o - l, s), t.arc(n + o - l, s + l, l, Math.PI * 1.5, 0), t.lineTo(n + o, s + i), t.closePath()) : r ? (t.moveTo(s, n), t.lineTo(s, n + o), t.lineTo(s + i - l, n + o), t.arc(s + i - l, n + o - l, l, Math.PI / 2, 0, !0), t.lineTo(s + i, n + l), t.arc(s + i - l, n + l, l, 0, -Math.PI / 2, !0), t.closePath()) : (t.moveTo(s + i, n), t.lineTo(s + l, n), t.arc(s + l, n + l, l, -Math.PI / 2, Math.PI, !0), t.lineTo(s, n + o - l), t.arc(s + l, n + o - l, l, Math.PI, Math.PI / 2, !0), t.lineTo(s + i, n + o), t.closePath());
2916
2948
  }
2917
2949
  function Ie(t) {
2918
- return (e, n, s, o, i, l, r, a, c, u, d, f, g) => {
2919
- const v = (g == null ? void 0 : g.spanGaps) ?? !1;
2920
- if ([c, u] = Ft(n, c, u), c === -1)
2950
+ return (e, n, s, o, i, l, r, a, u, c, h, f, d) => {
2951
+ const x = (d == null ? void 0 : d.spanGaps) ?? !1;
2952
+ if ([u, c] = Ft(n, u, c), u === -1)
2921
2953
  return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
2922
- const x = (b) => f(_(b, s, i, r)), L = (b) => f(_(b, o, l, a)), h = s.ori === G.Horizontal ? Rt : Ht, I = [], P = [];
2923
- let D = !1;
2924
- for (let b = d === K.Forward ? c : u; b >= c && b <= u; b += d) {
2925
- const C = n[b];
2926
- C != null ? (I.push(x(e[b])), P.push(L(C))) : C === null && !v && (D = !0);
2927
- }
2928
- const T = s.ori === G.Horizontal, M = t(I, P, T, f), S = {
2929
- stroke: M ?? new Path2D(),
2954
+ const b = (v) => f($(v, s, i, r)), L = (v) => f($(v, o, l, a)), g = s.ori === V.Horizontal ? Rt : Gt, w = [], P = [];
2955
+ let z = !1;
2956
+ for (let v = h === N.Forward ? u : c; v >= u && v <= c; v += h) {
2957
+ const I = n[v];
2958
+ I != null ? (w.push(b(e[v])), P.push(L(I))) : I === null && !x && (z = !0);
2959
+ }
2960
+ const T = s.ori === V.Horizontal, S = t(w, P, T, f), C = {
2961
+ stroke: S ?? new Path2D(),
2930
2962
  fill: null,
2931
2963
  clip: null,
2932
2964
  band: null,
2933
2965
  gaps: null
2934
2966
  };
2935
- if (M != null) {
2936
- const b = S.fill = new Path2D(M), C = (g == null ? void 0 : g.fillTo) ?? o.min ?? 0, z = L(C);
2937
- let p = r, m = r + i;
2938
- d === K.Backward && ([m, p] = [p, m]), h(b, m, z), h(b, p, z);
2967
+ if (S != null) {
2968
+ const v = C.fill = new Path2D(S), I = (d == null ? void 0 : d.fillTo) ?? o.min ?? 0, D = L(I);
2969
+ let m = r, p = r + i;
2970
+ h === N.Backward && ([p, m] = [m, p]), g(v, p, D), g(v, m, D);
2939
2971
  }
2940
- if (D) {
2941
- const b = Xt(e, n, c, u, d, x);
2942
- S.gaps = b, S.clip = Yt(b, s.ori, r, a, i, l);
2972
+ if (z) {
2973
+ const v = Yt(e, n, u, c, h, b);
2974
+ C.gaps = v, C.clip = Kt(v, s.ori, r, a, i, l);
2943
2975
  }
2944
- return S;
2976
+ return C;
2945
2977
  };
2946
2978
  }
2947
2979
  function ys() {
@@ -2952,26 +2984,26 @@ const os = (t, e, n, s) => {
2952
2984
  if (o < 2) return null;
2953
2985
  const i = new Path2D(), l = t[0] ?? 0, r = e[0] ?? 0;
2954
2986
  if (n ? i.moveTo(l, r) : i.moveTo(r, l), o === 2) {
2955
- const f = t[1] ?? 0, g = e[1] ?? 0;
2956
- return n ? i.lineTo(f, g) : i.lineTo(g, f), i;
2987
+ const f = t[1] ?? 0, d = e[1] ?? 0;
2988
+ return n ? i.lineTo(f, d) : i.lineTo(d, f), i;
2957
2989
  }
2958
- const a = new Array(o), c = new Array(o - 1), u = new Array(o - 1), d = new Array(o - 1);
2990
+ const a = new Array(o), u = new Array(o - 1), c = new Array(o - 1), h = new Array(o - 1);
2959
2991
  for (let f = 0; f < o - 1; f++)
2960
- u[f] = (e[f + 1] ?? 0) - (e[f] ?? 0), d[f] = (t[f + 1] ?? 0) - (t[f] ?? 0), c[f] = d[f] !== 0 ? (u[f] ?? 0) / (d[f] ?? 1) : 0;
2961
- a[0] = c[0] ?? 0;
2992
+ c[f] = (e[f + 1] ?? 0) - (e[f] ?? 0), h[f] = (t[f + 1] ?? 0) - (t[f] ?? 0), u[f] = h[f] !== 0 ? (c[f] ?? 0) / (h[f] ?? 1) : 0;
2993
+ a[0] = u[0] ?? 0;
2962
2994
  for (let f = 1; f < o - 1; f++) {
2963
- const g = c[f] ?? 0, v = c[f - 1] ?? 0;
2964
- if (g === 0 || v === 0 || v > 0 != g > 0)
2995
+ const d = u[f] ?? 0, x = u[f - 1] ?? 0;
2996
+ if (d === 0 || x === 0 || x > 0 != d > 0)
2965
2997
  a[f] = 0;
2966
2998
  else {
2967
- const x = d[f] ?? 1, L = d[f - 1] ?? 1;
2968
- a[f] = 3 * (L + x) / ((2 * x + L) / v + (x + 2 * L) / g), isFinite(a[f] ?? 0) || (a[f] = 0);
2999
+ const b = h[f] ?? 1, L = h[f - 1] ?? 1;
3000
+ a[f] = 3 * (L + b) / ((2 * b + L) / x + (b + 2 * L) / d), isFinite(a[f] ?? 0) || (a[f] = 0);
2969
3001
  }
2970
3002
  }
2971
- a[o - 1] = c[o - 2] ?? 0;
3003
+ a[o - 1] = u[o - 2] ?? 0;
2972
3004
  for (let f = 0; f < o - 1; f++) {
2973
- const g = d[f] ?? 1, v = t[f] ?? 0, x = e[f] ?? 0, L = t[f + 1] ?? 0, h = e[f + 1] ?? 0, I = a[f] ?? 0, P = a[f + 1] ?? 0, D = v + g / 3, T = x + I * g / 3, M = L - g / 3, S = h - P * g / 3;
2974
- n ? i.bezierCurveTo(D, T, M, S, L, h) : i.bezierCurveTo(T, D, S, M, h, L);
3005
+ const d = h[f] ?? 1, x = t[f] ?? 0, b = e[f] ?? 0, L = t[f + 1] ?? 0, g = e[f + 1] ?? 0, w = a[f] ?? 0, P = a[f + 1] ?? 0, z = x + d / 3, T = b + w * d / 3, S = L - d / 3, C = g - P * d / 3;
3006
+ n ? i.bezierCurveTo(z, T, S, C, L, g) : i.bezierCurveTo(T, z, C, S, g, L);
2975
3007
  }
2976
3008
  return i;
2977
3009
  };
@@ -2983,38 +3015,38 @@ const ls = (t, e, n, s) => {
2983
3015
  if (o < 2) return null;
2984
3016
  const i = new Path2D(), l = s(t[0] ?? 0), r = s(e[0] ?? 0);
2985
3017
  if (n ? i.moveTo(l, r) : i.moveTo(r, l), o === 2) {
2986
- const a = s(t[1] ?? 0), c = s(e[1] ?? 0);
2987
- return n ? i.lineTo(a, c) : i.lineTo(c, a), i;
3018
+ const a = s(t[1] ?? 0), u = s(e[1] ?? 0);
3019
+ return n ? i.lineTo(a, u) : i.lineTo(u, a), i;
2988
3020
  }
2989
3021
  for (let a = 0; a < o - 1; a++) {
2990
- const c = a === 0 ? 0 : a - 1, u = t[c] ?? 0, d = e[c] ?? 0, f = t[a] ?? 0, g = e[a] ?? 0, v = t[a + 1] ?? 0, x = e[a + 1] ?? 0, L = a + 2 < o ? t[a + 2] ?? 0 : v, h = a + 2 < o ? e[a + 2] ?? 0 : x, I = Math.hypot(u - f, d - g), P = Math.hypot(f - v, g - x), D = Math.hypot(v - L, x - h), T = Math.sqrt(D), M = D, S = Math.sqrt(P), b = P, C = Math.sqrt(I), z = I, p = 2 * z + 3 * C * S + b, m = 2 * M + 3 * T * S + b, w = 3 * C * (C + S), y = 3 * T * (T + S);
2991
- let k, A, F, R;
2992
- if (w > 0) {
2993
- const H = 1 / w;
2994
- k = (-b * u + p * f + z * v) * H, A = (-b * d + p * g + z * x) * H;
3022
+ const u = a === 0 ? 0 : a - 1, c = t[u] ?? 0, h = e[u] ?? 0, f = t[a] ?? 0, d = e[a] ?? 0, x = t[a + 1] ?? 0, b = e[a + 1] ?? 0, L = a + 2 < o ? t[a + 2] ?? 0 : x, g = a + 2 < o ? e[a + 2] ?? 0 : b, w = Math.hypot(c - f, h - d), P = Math.hypot(f - x, d - b), z = Math.hypot(x - L, b - g), T = Math.sqrt(z), S = z, C = Math.sqrt(P), v = P, I = Math.sqrt(w), D = w, m = 2 * D + 3 * I * C + v, p = 2 * S + 3 * T * C + v, M = 3 * I * (I + C), k = 3 * T * (T + C);
3023
+ let y, A, F, R;
3024
+ if (M > 0) {
3025
+ const G = 1 / M;
3026
+ y = (-v * c + m * f + D * x) * G, A = (-v * h + m * d + D * b) * G;
2995
3027
  } else
2996
- k = f, A = g;
2997
- if (y > 0) {
2998
- const H = 1 / y;
2999
- F = (M * f + m * v - b * L) * H, R = (M * g + m * x - b * h) * H;
3028
+ y = f, A = d;
3029
+ if (k > 0) {
3030
+ const G = 1 / k;
3031
+ F = (S * f + p * x - v * L) * G, R = (S * d + p * b - v * g) * G;
3000
3032
  } else
3001
- F = v, R = x;
3002
- n ? i.bezierCurveTo(k, A, F, R, v, x) : i.bezierCurveTo(A, k, R, F, x, v);
3033
+ F = x, R = b;
3034
+ n ? i.bezierCurveTo(y, A, F, R, x, b) : i.bezierCurveTo(A, y, R, F, b, x);
3003
3035
  }
3004
3036
  return i;
3005
3037
  };
3006
3038
  function Cs(t = 4) {
3007
- return (e, n, s, o, i, l, r, a, c, u, d, f, g) => {
3008
- const v = (P) => f(_(P, s, i, r)), x = (P) => f(_(P, o, l, a)), L = t / 2, h = new Path2D(), I = s.ori === G.Horizontal;
3009
- for (let P = d === K.Forward ? c : u; P >= c && P <= u; P += d) {
3010
- const D = n[P];
3011
- if (D == null) continue;
3012
- const T = v(e[P]), M = x(D);
3013
- I ? (h.moveTo(T + L, M), h.arc(T, M, L, 0, Math.PI * 2)) : (h.moveTo(M + L, T), h.arc(M, T, L, 0, Math.PI * 2));
3039
+ return (e, n, s, o, i, l, r, a, u, c, h, f, d) => {
3040
+ const x = (P) => f($(P, s, i, r)), b = (P) => f($(P, o, l, a)), L = t / 2, g = new Path2D(), w = s.ori === V.Horizontal;
3041
+ for (let P = h === N.Forward ? u : c; P >= u && P <= c; P += h) {
3042
+ const z = n[P];
3043
+ if (z == null) continue;
3044
+ const T = x(e[P]), S = b(z);
3045
+ w ? (g.moveTo(T + L, S), g.arc(T, S, L, 0, Math.PI * 2)) : (g.moveTo(S + L, T), g.arc(S, T, L, 0, Math.PI * 2));
3014
3046
  }
3015
3047
  return {
3016
- stroke: h,
3017
- fill: h,
3048
+ stroke: g,
3049
+ fill: g,
3018
3050
  clip: null,
3019
3051
  band: null,
3020
3052
  gaps: null
@@ -3029,54 +3061,54 @@ function Ts(t) {
3029
3061
  high: l,
3030
3062
  low: r,
3031
3063
  close: a,
3032
- xScale: c,
3033
- yScale: u,
3034
- upColor: d = "#26a69a",
3064
+ xScale: u,
3065
+ yScale: c,
3066
+ upColor: h = "#26a69a",
3035
3067
  downColor: f = "#ef5350",
3036
- bodyWidth: g = 0.6,
3037
- wickWidth: v = 1
3068
+ bodyWidth: d = 0.6,
3069
+ wickWidth: x = 1
3038
3070
  } = t;
3039
- if (c.min == null || c.max == null || u.min == null || u.max == null) return;
3040
- const x = o.length;
3041
- if (x === 0) return;
3042
- const h = Math.max(2, n.width / x * g) * s / 2;
3071
+ if (u.min == null || u.max == null || c.min == null || c.max == null) return;
3072
+ const b = o.length;
3073
+ if (b === 0) return;
3074
+ const g = Math.max(2, n.width / b * d) * s / 2;
3043
3075
  e.save();
3044
- for (let I = 0; I < x; I++) {
3045
- const P = o[I], D = i[I], T = l[I], M = r[I], S = a[I];
3046
- if (P == null || D == null || T == null || M == null || S == null) continue;
3047
- const b = _(P, c, n.width, n.left) * s, C = _(D, u, n.height, n.top) * s, z = _(T, u, n.height, n.top) * s, p = _(M, u, n.height, n.top) * s, m = _(S, u, n.height, n.top) * s, y = S >= D ? d : f;
3048
- e.strokeStyle = y, e.lineWidth = v * s, e.beginPath(), e.moveTo(b, z), e.lineTo(b, p), e.stroke();
3049
- const k = Math.min(C, m), A = Math.abs(m - C);
3050
- e.fillStyle = y, e.fillRect(b - h, k, h * 2, Math.max(A, 1 * s));
3076
+ for (let w = 0; w < b; w++) {
3077
+ const P = o[w], z = i[w], T = l[w], S = r[w], C = a[w];
3078
+ if (P == null || z == null || T == null || S == null || C == null) continue;
3079
+ const v = $(P, u, n.width, n.left) * s, I = $(z, c, n.height, n.top) * s, D = $(T, c, n.height, n.top) * s, m = $(S, c, n.height, n.top) * s, p = $(C, c, n.height, n.top) * s, k = C >= z ? h : f;
3080
+ e.strokeStyle = k, e.lineWidth = x * s, e.beginPath(), e.moveTo(v, D), e.lineTo(v, m), e.stroke();
3081
+ const y = Math.min(I, p), A = Math.abs(p - I);
3082
+ e.fillStyle = k, e.fillRect(v - g, y, g * 2, Math.max(A, 1 * s));
3051
3083
  }
3052
3084
  e.restore();
3053
3085
  };
3054
3086
  }
3055
3087
  function Is(t, e, n = 0) {
3056
- const s = e ?? t.series.map((c, u) => u), o = t.x.length, i = [], l = new Float64Array(o);
3057
- for (let c = 0; c < s.length; c++) {
3058
- const u = s[c];
3059
- if (u == null) continue;
3060
- const d = t.series[u];
3061
- if (d == null) continue;
3088
+ const s = e ?? t.series.map((u, c) => c), o = t.x.length, i = [], l = new Float64Array(o);
3089
+ for (let u = 0; u < s.length; u++) {
3090
+ const c = s[u];
3091
+ if (c == null) continue;
3092
+ const h = t.series[c];
3093
+ if (h == null) continue;
3062
3094
  const f = new Array(o);
3063
- for (let g = 0; g < o; g++) {
3064
- const v = d[g];
3065
- v != null ? (l[g] = l[g] + v, f[g] = l[g]) : f[g] = null;
3095
+ for (let d = 0; d < o; d++) {
3096
+ const x = h[d];
3097
+ x != null ? (l[d] = l[d] + x, f[d] = l[d]) : f[d] = null;
3066
3098
  }
3067
3099
  i.push(f);
3068
3100
  }
3069
3101
  const r = [];
3070
- for (let c = 0; c < t.series.length; c++) {
3071
- const u = s.indexOf(c), d = u >= 0 ? i[u] : void 0;
3072
- d != null ? r.push(d) : r.push(t.series[c] ?? []);
3102
+ for (let u = 0; u < t.series.length; u++) {
3103
+ const c = s.indexOf(u), h = c >= 0 ? i[c] : void 0;
3104
+ h != null ? r.push(h) : r.push(t.series[u] ?? []);
3073
3105
  }
3074
3106
  const a = [];
3075
- for (let c = s.length - 1; c > 0; c--) {
3076
- const u = s[c], d = s[c - 1];
3077
- u != null && d != null && a.push({
3107
+ for (let u = s.length - 1; u > 0; u--) {
3108
+ const c = s[u], h = s[u - 1];
3109
+ c != null && h != null && a.push({
3078
3110
  group: n,
3079
- series: [u, d]
3111
+ series: [c, h]
3080
3112
  });
3081
3113
  }
3082
3114
  return {
@@ -3100,10 +3132,10 @@ function As(t) {
3100
3132
  for (const [i, l] of t) {
3101
3133
  const r = new Array(n.length).fill(null);
3102
3134
  for (let a = 0; a < i.length; a++) {
3103
- const c = i[a];
3104
- if (c == null) continue;
3105
- const u = s.get(c);
3106
- u != null && (r[u] = l[a] ?? null);
3135
+ const u = i[a];
3136
+ if (u == null) continue;
3137
+ const c = s.get(u);
3138
+ c != null && (r[c] = l[a] ?? null);
3107
3139
  }
3108
3140
  o.push(r);
3109
3141
  }
@@ -3119,11 +3151,11 @@ function Ps(t) {
3119
3151
  function Ls(t, e = 0) {
3120
3152
  return (n) => n.map((s) => s.toFixed(e) + t);
3121
3153
  }
3122
- function Ds(t) {
3154
+ function zs(t) {
3123
3155
  const e = (t == null ? void 0 : t.utc) ?? !1;
3124
3156
  return (n) => n.map((s) => e ? nt(s, { hour: "2-digit", minute: "2-digit", hour12: !1 }, "UTC") : nt(s, { hour: "2-digit", minute: "2-digit", hour12: !1 }));
3125
3157
  }
3126
- function zs(t) {
3158
+ function Ds(t) {
3127
3159
  const e = t != null && t.utc ? "UTC" : void 0, n = (t == null ? void 0 : t.format) ?? "short";
3128
3160
  return (s) => s.map((o) => nt(o, { month: n }, e));
3129
3161
  }
@@ -3155,7 +3187,7 @@ function Ae(t) {
3155
3187
  const s = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(t);
3156
3188
  return s ? [Number(s[1]), Number(s[2]), Number(s[3])] : null;
3157
3189
  }
3158
- function Hs(t, e = 0.8, n = 0) {
3190
+ function Gs(t, e = 0.8, n = 0) {
3159
3191
  const s = Ae(t);
3160
3192
  if (s == null)
3161
3193
  return { type: "linear", stops: [[0, t], [1, t]] };
@@ -3168,7 +3200,7 @@ function Hs(t, e = 0.8, n = 0) {
3168
3200
  ]
3169
3201
  };
3170
3202
  }
3171
- function Gs(t, e) {
3203
+ function Hs(t, e) {
3172
3204
  const n = Ae(t);
3173
3205
  if (n == null) return t;
3174
3206
  const [s, o, i] = n;
@@ -3183,15 +3215,15 @@ function _s(t, e = 65, n = 50) {
3183
3215
  return s;
3184
3216
  }
3185
3217
  export {
3186
- Ms as AnnotationLabel,
3187
- Dt as Axis,
3218
+ xs as AnnotationLabel,
3219
+ zt as Axis,
3188
3220
  as as Band,
3189
3221
  Ce as Chart,
3190
- K as Direction,
3191
- N as Distribution,
3222
+ N as Direction,
3223
+ q as Distribution,
3192
3224
  ms as HLine,
3193
3225
  cs as Legend,
3194
- G as Orientation,
3226
+ V as Orientation,
3195
3227
  vs as Region,
3196
3228
  Lt as Scale,
3197
3229
  Te as Series,
@@ -3210,25 +3242,25 @@ export {
3210
3242
  ps as drawLabel,
3211
3243
  ns as drawRegion,
3212
3244
  es as drawVLine,
3213
- Hs as fadeGradient,
3245
+ Gs as fadeGradient,
3214
3246
  Ps as fmtCompact,
3215
3247
  Fs as fmtDateStr,
3216
- Ds as fmtHourMin,
3248
+ zs as fmtHourMin,
3217
3249
  Rs as fmtLabels,
3218
- zs as fmtMonthName,
3250
+ Ds as fmtMonthName,
3219
3251
  Ls as fmtSuffix,
3220
3252
  Qe as linear,
3221
3253
  ys as monotoneCubic,
3222
3254
  _s as palette,
3223
3255
  Cs as points,
3224
- it as posToVal,
3225
- Mt as sideOrientation,
3256
+ rt as posToVal,
3257
+ xt as sideOrientation,
3226
3258
  Is as stackGroup,
3227
3259
  bs as stepped,
3228
- ot as useChart,
3260
+ lt as useChart,
3229
3261
  hs as useCursorDrawHook,
3230
3262
  Pt as useDrawHook,
3231
- xs as useStreamingData,
3232
- _ as valToPos,
3233
- Gs as withAlpha
3263
+ Ms as useStreamingData,
3264
+ $ as valToPos,
3265
+ Hs as withAlpha
3234
3266
  };