@canplot/react 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/canplot.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs as lt, jsx as _, Fragment as _t } from "react/jsx-runtime";
2
- import Z, { createContext as vt, useContext as J, useRef as D, useLayoutEffect as N, useEffect as wt, version as Rt, forwardRef as At, useMemo as Q, useState as V, useId as Ut } from "react";
2
+ import Z, { createContext as vt, useContext as J, useRef as U, useLayoutEffect as N, useEffect as wt, version as Rt, forwardRef as At, useMemo as Q, useState as V, useId as Ut } from "react";
3
3
  import { createStore as bt, useStore as St } from "zustand";
4
4
  const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e) => s + (e ?? 0), 0), ue = (t, s) => {
5
5
  let e = 0;
@@ -7,7 +7,7 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
7
7
  Math.abs(t[o] - s) < Math.abs(t[e] - s) && (e = o);
8
8
  return e;
9
9
  }, Dt = (t, s, e, o) => {
10
- const { min: n, max: c, origin: a } = I(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = (a === "x" ? r.width : r.height) / (c - n);
10
+ const { min: n, max: i, origin: a } = I(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = (a === "x" ? r.width : r.height) / (i - n);
11
11
  return s / d;
12
12
  }, I = (t, s) => {
13
13
  const e = t.scales.find((o) => o.id === s);
@@ -18,11 +18,11 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
18
18
  const e = window.devicePixelRatio || 1;
19
19
  t.lineCap = s?.lineCap ?? "butt", t.lineDashOffset = e * (s?.lineDashOffset ?? 0), t.lineJoin = s?.lineJoin ?? "miter", t.lineWidth = e * (s?.lineWidth ?? 1), t.miterLimit = e * (s?.miterLimit ?? 10), t.strokeStyle = s?.strokeStyle ?? "black", t.fillStyle = s?.fillStyle ?? t.strokeStyle, t.font = s?.font ?? `${10 * e}px sans-serif`, t.textAlign = s?.textAlign ?? "start", t.direction = s?.direction ?? "inherit", t.textBaseline = s?.textBaseline ?? "alphabetic", t.fontKerning = s?.fontKerning ?? "auto";
20
20
  }, ut = (t, s, e, o) => {
21
- const n = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, { min: c, max: a, origin: r } = I(t, e), d = (r === "x" ? n.width : n.height) / (a - c);
21
+ const n = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, { min: i, max: a, origin: r } = I(t, e), d = (r === "x" ? n.width : n.height) / (a - i);
22
22
  return s * d;
23
23
  }, H = (t, s, e, o) => {
24
- const { min: n, origin: c } = I(t, e), a = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, r = ut(t, s - n, e, o);
25
- return c === "x" ? j(
24
+ const { min: n, origin: i } = I(t, e), a = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, r = ut(t, s - n, e, o);
25
+ return i === "x" ? j(
26
26
  a.x + r,
27
27
  a.x - 10 * a.width,
28
28
  a.x + 11 * a.width
@@ -34,19 +34,19 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
34
34
  }, de = (t, s, e) => {
35
35
  const { min: o, max: n } = I(t, e);
36
36
  return j(s, o, n);
37
- }, O = (t, s, e) => {
37
+ }, Y = (t, s, e) => {
38
38
  const o = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
39
39
  return j(s, o.x, o.x + o.width);
40
- }, B = (t, s, e) => {
40
+ }, O = (t, s, e) => {
41
41
  const o = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
42
42
  return j(s, o.y, o.y + o.height);
43
43
  }, rt = (t, s, e) => {
44
44
  const { min: o, max: n } = I(t, e);
45
45
  return s >= o && s <= n;
46
- }, L = (t, s, e, o) => {
47
- const { min: n, max: c, origin: a } = I(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = a === "x" ? (s - r.x) / r.width : (r.height - s + r.y) / r.height;
48
- return n + d * (c - n);
49
- }, Lt = (t) => {
46
+ }, D = (t, s, e, o) => {
47
+ const { min: n, max: i, origin: a } = I(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = a === "x" ? (s - r.x) / r.width : (r.height - s + r.y) / r.height;
48
+ return n + d * (i - n);
49
+ }, It = (t) => {
50
50
  const { ctx: s, scales: e } = t;
51
51
  for (const o of e) {
52
52
  if (!o.axis) continue;
@@ -61,16 +61,16 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
61
61
  if (o.axis.position === "bottom")
62
62
  s.beginPath(), s.moveTo(n.x, n.y), s.lineTo(n.x + n.width, n.y), s.stroke();
63
63
  else if (o.axis.position === "top") {
64
- const c = n.y + n.height;
65
- s.beginPath(), s.moveTo(n.x, c), s.lineTo(n.x + n.width, c), s.stroke();
64
+ const i = n.y + n.height;
65
+ s.beginPath(), s.moveTo(n.x, i), s.lineTo(n.x + n.width, i), s.stroke();
66
66
  }
67
67
  } else if (o.axis.position === "left") {
68
- const c = n.x + n.width;
69
- s.beginPath(), s.moveTo(c, n.y), s.lineTo(c, n.y + n.height), s.stroke();
68
+ const i = n.x + n.width;
69
+ s.beginPath(), s.moveTo(i, n.y), s.lineTo(i, n.y + n.height), s.stroke();
70
70
  } else o.axis.position === "right" && (s.beginPath(), s.moveTo(n.x, n.y), s.lineTo(n.x, n.y + n.height), s.stroke());
71
71
  s.restore();
72
72
  }
73
- }, It = () => bt((t, s) => {
73
+ }, Lt = () => bt((t, s) => {
74
74
  const e = () => {
75
75
  const o = s()._frame;
76
76
  if (!o) throw new Error("No frame set in frame store");
@@ -80,14 +80,14 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
80
80
  _frame: null,
81
81
  getFrame: e,
82
82
  getCtx: () => e().ctx,
83
- clampXPosToChartArea: (o, n) => O(e(), o, n ?? "canvas"),
84
- clampYPosToChartArea: (o, n) => B(e(), o, n ?? "canvas"),
85
- valToPos: (o, n, c) => H(e(), o, n, c ?? "canvas"),
86
- valToPxDistance: (o, n, c) => ut(
83
+ clampXPosToChartArea: (o, n) => Y(e(), o, n ?? "canvas"),
84
+ clampYPosToChartArea: (o, n) => O(e(), o, n ?? "canvas"),
85
+ valToPos: (o, n, i) => H(e(), o, n, i ?? "canvas"),
86
+ valToPxDistance: (o, n, i) => ut(
87
87
  e(),
88
88
  o,
89
89
  n,
90
- c ?? "canvas"
90
+ i ?? "canvas"
91
91
  ),
92
92
  valFits: (o, n) => rt(e(), o, n),
93
93
  getScale: (o) => I(e(), o)
@@ -97,14 +97,14 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
97
97
  t((s) => ({ version: s.version + 1 }));
98
98
  },
99
99
  version: 0
100
- })), dt = vt(null), Ct = vt(null), Y = (t, s) => {
100
+ })), dt = vt(null), Ct = vt(null), z = (t, s) => {
101
101
  const e = J(dt), o = J(Ct);
102
102
  if (!e || !o)
103
103
  throw new Error("useFrame must be used within a CanPlot component");
104
- const n = D(t);
104
+ const n = U(t);
105
105
  n.current = t, N(() => {
106
- n.current(e.getState()), e.subscribe((c) => {
107
- c._frame && n.current(c);
106
+ n.current(e.getState()), e.subscribe((i) => {
107
+ i._frame && n.current(i);
108
108
  });
109
109
  }, [e]), wt(() => {
110
110
  o.getState().notify();
@@ -127,8 +127,8 @@ function Ft(t) {
127
127
  return (s) => {
128
128
  const e = [];
129
129
  for (const o of t) {
130
- const n = at(o, s), c = typeof n == "function";
131
- e.push(c ? n : () => at(o, null));
130
+ const n = at(o, s), i = typeof n == "function";
131
+ e.push(i ? n : () => at(o, null));
132
132
  }
133
133
  return () => {
134
134
  for (const o of e) o();
@@ -142,12 +142,12 @@ function at(t, s) {
142
142
  }
143
143
  var zt = parseInt(Rt.split(".")[0], 10) >= 19 ? Ft : Kt;
144
144
  const he = At(({ configuration: t, children: s, style: e, className: o }, n) => {
145
- const c = D(null), a = D(null), r = Ot(a), d = Q(It, []), u = Q(Xt, []);
145
+ const i = U(null), a = U(null), r = Ot(a), d = Q(Lt, []), u = Q(Xt, []);
146
146
  N(() => {
147
147
  d.setState({
148
- _frame: Bt(t, r, c.current)
148
+ _frame: Bt(t, r, i.current)
149
149
  });
150
- }, [t, r, c, d]), N(() => d.subscribe((p) => {
150
+ }, [t, r, i, d]), N(() => d.subscribe((p) => {
151
151
  p._frame && $t(p._frame);
152
152
  }), [d]), N(() => {
153
153
  let p = !1;
@@ -175,7 +175,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
175
175
  /* @__PURE__ */ _(
176
176
  "canvas",
177
177
  {
178
- ref: c,
178
+ ref: i,
179
179
  width: r.width * l,
180
180
  height: r.height * l,
181
181
  style: {
@@ -202,8 +202,8 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
202
202
  width: 0,
203
203
  height: 0
204
204
  }), [o] = V(() => new ResizeObserver((n) => {
205
- for (const c of n) {
206
- const a = Math.round(c.contentRect.width), r = Math.round(c.contentRect.height);
205
+ for (const i of n) {
206
+ const a = Math.round(i.contentRect.width), r = Math.round(i.contentRect.height);
207
207
  e(
208
208
  (d) => d.width !== a || d.height !== r ? { ...d, width: a, height: r } : d
209
209
  );
@@ -211,9 +211,9 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
211
211
  }));
212
212
  return N(() => {
213
213
  if (!t.current) return;
214
- const n = t.current.clientWidth, c = t.current.clientHeight;
214
+ const n = t.current.clientWidth, i = t.current.clientHeight;
215
215
  return e(
216
- (a) => a.width !== n || a.height !== c ? { ...a, width: n, height: c } : a
216
+ (a) => a.width !== n || a.height !== i ? { ...a, width: n, height: i } : a
217
217
  ), o.observe(t.current, { box: "border-box" }), () => o.disconnect();
218
218
  }, [o, t]), s;
219
219
  }, Bt = (t, s, e) => {
@@ -222,22 +222,22 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
222
222
  const n = window.devicePixelRatio || 1;
223
223
  if (s.width === 0 || s.height === 0)
224
224
  return null;
225
- const c = {
225
+ const i = {
226
226
  x: t.padding.left,
227
227
  y: t.padding.top,
228
228
  width: s.width - t.padding.left - t.padding.right,
229
229
  height: s.height - t.padding.top - t.padding.bottom
230
230
  };
231
231
  for (const f of t.scales)
232
- f.axis && (f.origin === "x" ? (f.axis.position === "bottom" || f.axis.position === "top") && (c.height = Math.max(
232
+ f.axis && (f.origin === "x" ? (f.axis.position === "bottom" || f.axis.position === "top") && (i.height = Math.max(
233
233
  0,
234
- c.height - f.axis.size
235
- ), f.axis.position === "top" && (c.y += f.axis.size)) : (f.axis.position === "left" || f.axis.position === "right") && (c.width = Math.max(0, c.width - f.axis.size), f.axis.position === "left" && (c.x += f.axis.size)));
234
+ i.height - f.axis.size
235
+ ), f.axis.position === "top" && (i.y += f.axis.size)) : (f.axis.position === "left" || f.axis.position === "right") && (i.width = Math.max(0, i.width - f.axis.size), f.axis.position === "left" && (i.x += f.axis.size)));
236
236
  const a = {
237
- x: c.x * n,
238
- y: c.y * n,
239
- width: c.width * n,
240
- height: c.height * n
237
+ x: i.x * n,
238
+ y: i.y * n,
239
+ width: i.width * n,
240
+ height: i.height * n
241
241
  }, r = [];
242
242
  let d = t.padding.left * n, u = o.canvas.width - t.padding.right * n, l = o.canvas.height - t.padding.bottom * n, p = t.padding.top * n;
243
243
  for (const f of t.scales) {
@@ -245,22 +245,22 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
245
245
  r.push({ ...f, axis: null });
246
246
  continue;
247
247
  }
248
- let i;
248
+ let c;
249
249
  if (f.origin === "x")
250
250
  switch (f.axis.position) {
251
251
  case "bottom":
252
- l -= f.axis.size * n, i = {
253
- x: c.x,
252
+ l -= f.axis.size * n, c = {
253
+ x: i.x,
254
254
  y: l / n,
255
- width: c.width,
255
+ width: i.width,
256
256
  height: f.axis.size
257
257
  };
258
258
  break;
259
259
  case "top":
260
- p += f.axis.size * n, i = {
261
- x: c.x,
260
+ p += f.axis.size * n, c = {
261
+ x: i.x,
262
262
  y: p / n - f.axis.size,
263
- width: c.width,
263
+ width: i.width,
264
264
  height: f.axis.size
265
265
  };
266
266
  break;
@@ -271,19 +271,19 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
271
271
  else
272
272
  switch (f.axis.position) {
273
273
  case "left":
274
- d += f.axis.size * n, i = {
274
+ d += f.axis.size * n, c = {
275
275
  x: d / n - f.axis.size,
276
- y: c.y,
276
+ y: i.y,
277
277
  width: f.axis.size,
278
- height: c.height
278
+ height: i.height
279
279
  };
280
280
  break;
281
281
  case "right":
282
- u -= f.axis.size * n, i = {
282
+ u -= f.axis.size * n, c = {
283
283
  x: u / n,
284
- y: c.y,
284
+ y: i.y,
285
285
  width: f.axis.size,
286
- height: c.height
286
+ height: i.height
287
287
  };
288
288
  break;
289
289
  case "top":
@@ -291,16 +291,16 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
291
291
  throw new Error("Invalid axis position for y origin");
292
292
  }
293
293
  const h = {
294
- x: i.x * n,
295
- y: i.y * n,
296
- width: i.width * n,
297
- height: i.height * n
294
+ x: c.x * n,
295
+ y: c.y * n,
296
+ width: c.width * n,
297
+ height: c.height * n
298
298
  };
299
299
  r.push({
300
300
  ...f,
301
301
  axis: {
302
302
  ...f.axis,
303
- cssRect: i,
303
+ cssRect: c,
304
304
  canvasRect: h
305
305
  }
306
306
  });
@@ -310,24 +310,24 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
310
310
  dpr: n,
311
311
  padding: t.padding,
312
312
  scales: r,
313
- chartAreaCSS: c,
313
+ chartAreaCSS: i,
314
314
  chartAreaCanvasPX: a
315
315
  };
316
316
  }, $t = (t) => {
317
- t.ctx.clearRect(0, 0, t.ctx.canvas.width, t.ctx.canvas.height), Lt(t);
318
- }, fe = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (Y(
319
- ({ getCtx: n, clampXPosToChartArea: c, clampYPosToChartArea: a, valToPos: r }) => {
317
+ t.ctx.clearRect(0, 0, t.ctx.canvas.width, t.ctx.canvas.height), It(t);
318
+ }, fe = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (z(
319
+ ({ getCtx: n, clampXPosToChartArea: i, clampYPosToChartArea: a, valToPos: r }) => {
320
320
  const d = n();
321
321
  d.save(), d.beginPath(), R(d, o);
322
322
  for (const u of t) {
323
- const l = c(r(u.x, s)), p = a(r(u.y, e));
323
+ const l = i(r(u.x, s)), p = a(r(u.y, e));
324
324
  d.lineTo(l, p);
325
325
  }
326
326
  d.stroke(), d.restore();
327
327
  },
328
328
  [t, s, e, o]
329
- ), null), me = ({ data: t, xScaleId: s, yScaleId: e, radius: o = 5, style: n }) => (Y(({ getCtx: c, valToPos: a, valFits: r }) => {
330
- const d = c();
329
+ ), null), me = ({ data: t, xScaleId: s, yScaleId: e, radius: o = 5, style: n }) => (z(({ getCtx: i, valToPos: a, valFits: r }) => {
330
+ const d = i();
331
331
  d.save(), d.beginPath(), R(d, n);
332
332
  for (const u of t) {
333
333
  if (!r(u.x, s) || !r(u.y, e))
@@ -342,9 +342,9 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
342
342
  yScaleId: e,
343
343
  style: o,
344
344
  barWidth: n,
345
- xPositionOffset: c,
345
+ xPositionOffset: i,
346
346
  radius: a
347
- }) => (Y(
347
+ }) => (z(
348
348
  ({
349
349
  getCtx: r,
350
350
  valToPxDistance: d,
@@ -357,8 +357,8 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
357
357
  m.save(), R(m, o);
358
358
  const f = d(n, s);
359
359
  m.beginPath();
360
- for (const i of t) {
361
- const y = u(i.x, s) - f / 2 + c * f, x = p(u(0, e)), w = p(u(i.y, e)), g = x - w, v = l(y), T = l(y + f) - v;
360
+ for (const c of t) {
361
+ const y = u(c.x, s) - f / 2 + i * f, x = p(u(0, e)), w = p(u(c.y, e)), g = x - w, v = l(y), T = l(y + f) - v;
362
362
  a ? m.roundRect(
363
363
  v,
364
364
  w,
@@ -369,11 +369,11 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
369
369
  }
370
370
  m.closePath(), m.fill(), o?.strokeStyle && m.stroke(), m.restore();
371
371
  },
372
- [t, s, e, o, n, c, a]
373
- ), null), ye = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (Y(({ getCtx: n, clampXPosToChartArea: c, clampYPosToChartArea: a, valToPos: r }) => {
372
+ [t, s, e, o, n, i, a]
373
+ ), null), ye = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (z(({ getCtx: n, clampXPosToChartArea: i, clampYPosToChartArea: a, valToPos: r }) => {
374
374
  const d = [];
375
375
  for (const l of t) {
376
- const p = c(r(l.x, s)), m = a(r(l.y[0], e)), f = a(r(l.y[1], e));
376
+ const p = i(r(l.x, s)), m = a(r(l.y[0], e)), f = a(r(l.y[1], e));
377
377
  d.push({ x: p, y: m }), d.unshift({ x: p, y: f });
378
378
  }
379
379
  const u = n();
@@ -383,11 +383,11 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
383
383
  u.lineTo(l.x, l.y);
384
384
  u.closePath(), u.fill(), u.restore();
385
385
  }
386
- }, [t, s, e, o]), null), xe = ({ data: t, stroked: s, xScaleId: e, yScaleId: o, style: n }) => (Y(
387
- ({ getCtx: c, clampXPosToChartArea: a, clampYPosToChartArea: r, valToPos: d }) => {
388
- const u = [], l = c();
389
- for (const i of t) {
390
- const h = a(d(i.x, e)), y = r(d(i.y, o));
386
+ }, [t, s, e, o]), null), xe = ({ data: t, stroked: s, xScaleId: e, yScaleId: o, style: n }) => (z(
387
+ ({ getCtx: i, clampXPosToChartArea: a, clampYPosToChartArea: r, valToPos: d }) => {
388
+ const u = [], l = i();
389
+ for (const c of t) {
390
+ const h = a(d(c.x, e)), y = r(d(c.y, o));
391
391
  u.push({ x: h, y });
392
392
  }
393
393
  const p = u.at(0), m = u.at(-1);
@@ -395,12 +395,12 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
395
395
  return;
396
396
  const f = r(d(0, o));
397
397
  l.save(), l.beginPath(), R(l, n), l.moveTo(p.x, f);
398
- for (const i of u)
399
- l.lineTo(i.x, i.y);
398
+ for (const c of u)
399
+ l.lineTo(c.x, c.y);
400
400
  if (l.lineTo(m.x, f), l.closePath(), l.fill(), s) {
401
401
  l.beginPath(), l.moveTo(p.x, p.y);
402
- for (const i of u)
403
- l.lineTo(i.x, i.y);
402
+ for (const c of u)
403
+ l.lineTo(c.x, c.y);
404
404
  l.stroke();
405
405
  }
406
406
  l.restore();
@@ -411,7 +411,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
411
411
  clampXPosToChartArea: e,
412
412
  clampYPosToChartArea: o,
413
413
  getScale: n,
414
- valToPos: c,
414
+ valToPos: i,
415
415
  valFits: a
416
416
  }) => {
417
417
  const r = {};
@@ -420,13 +420,13 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
420
420
  switch (u.exceeding) {
421
421
  case "discard": {
422
422
  if (a(u.value, u.scaleId)) {
423
- const l = c(u.value, u.scaleId, s);
423
+ const l = i(u.value, u.scaleId, s);
424
424
  r[d] = l;
425
425
  }
426
426
  break;
427
427
  }
428
428
  case "clamp": {
429
- const l = c(u.value, u.scaleId, s);
429
+ const l = i(u.value, u.scaleId, s);
430
430
  r[d] = n(u.scaleId)?.origin === "x" ? e(l, s) : o(l, s);
431
431
  break;
432
432
  }
@@ -434,15 +434,15 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
434
434
  }
435
435
  return r;
436
436
  }
437
- ), ve = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: c }) => (Y(
437
+ ), ve = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: i }) => (z(
438
438
  ({ getCtx: a, valToPos: r, getScale: d, getFrame: u }) => {
439
439
  const l = a(), p = d(t);
440
440
  if (!p || !p.axis || p.origin !== "x") return;
441
- const m = p.axis, f = m.position === "top" ? m.canvasRect.y + m.canvasRect.height : m.canvasRect.y, i = window.devicePixelRatio || 1, h = f, y = (n ?? 6) * i, x = m.position === "top" ? f - y : f + y, w = (o ?? 12) * i;
441
+ const m = p.axis, f = m.position === "top" ? m.canvasRect.y + m.canvasRect.height : m.canvasRect.y, c = window.devicePixelRatio || 1, h = f, y = (n ?? 6) * c, x = m.position === "top" ? f - y : f + y, w = (o ?? 12) * c;
442
442
  l.save(), l.fontKerning = "auto", R(l, {
443
443
  ...s
444
444
  }), l.beginPath();
445
- const g = Array.isArray(c) ? c : c({ ...p, axis: m }, u());
445
+ const g = Array.isArray(i) ? i : i({ ...p, axis: m }, u());
446
446
  for (const { value: v } of g) {
447
447
  const T = r(v, t, "canvas");
448
448
  l.moveTo(T, h), l.lineTo(T, x);
@@ -457,20 +457,20 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
457
457
  const b = r(v, t, "canvas"), C = T.split(`
458
458
  `);
459
459
  for (let k = 0; k < C.length; k++)
460
- l.fillText(C[k], b, x + i * 2 + k * w);
460
+ l.fillText(C[k], b, x + c * 2 + k * w);
461
461
  }
462
462
  l.restore();
463
463
  },
464
- [c, t, s, e]
465
- ), null), we = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: c }) => (Y(
464
+ [i, t, s, e]
465
+ ), null), we = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: i }) => (z(
466
466
  ({ getCtx: a, valToPos: r, getScale: d, getFrame: u }) => {
467
467
  const l = a(), p = d(t);
468
468
  if (!p || !p.axis || p.origin !== "y") return;
469
- const m = p.axis, f = m.position === "left" ? m.canvasRect.x + m.canvasRect.width : m.canvasRect.x, i = f, h = n ?? 6, y = m.position === "left" ? f - h : f + h, x = o ?? 12, w = Array.isArray(c) ? c : c({ ...p, axis: m }, u());
469
+ const m = p.axis, f = m.position === "left" ? m.canvasRect.x + m.canvasRect.width : m.canvasRect.x, c = f, h = n ?? 6, y = m.position === "left" ? f - h : f + h, x = o ?? 12, w = Array.isArray(i) ? i : i({ ...p, axis: m }, u());
470
470
  l.save(), l.fontKerning = "auto", R(l, { ...s }), l.beginPath();
471
471
  for (const { value: g } of w) {
472
472
  const v = r(g, t, "canvas");
473
- l.moveTo(i, v), l.lineTo(y, v);
473
+ l.moveTo(c, v), l.lineTo(y, v);
474
474
  }
475
475
  l.stroke(), l.restore(), l.save(), R(l, {
476
476
  textBaseline: "middle",
@@ -486,7 +486,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
486
486
  }
487
487
  l.restore();
488
488
  },
489
- [c, t, s, e]
489
+ [i, t, s, e]
490
490
  ), null), E = () => {
491
491
  const t = [];
492
492
  return {
@@ -524,8 +524,8 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
524
524
  const o = Z.useRef(e);
525
525
  o.current = e, Z.useEffect(() => S[t].addEventListener(
526
526
  s,
527
- (c, a) => {
528
- o.current(a, c);
527
+ (i, a) => {
528
+ o.current(a, i);
529
529
  }
530
530
  ), [s, t, o]);
531
531
  }, ft = Z.createContext(""), mt = (t, s) => {
@@ -533,18 +533,18 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
533
533
  return M(t, e, s);
534
534
  }, Nt = (t, s, e, o, n) => {
535
535
  if (!s) return;
536
- const c = o ?? e.scales.find((p) => p.origin === "x")?.id, a = n ?? e.scales.find((p) => p.origin === "y")?.id;
537
- if (!c || !a)
536
+ const i = o ?? e.scales.find((p) => p.origin === "x")?.id, a = n ?? e.scales.find((p) => p.origin === "y")?.id;
537
+ if (!i || !a)
538
538
  return;
539
539
  const r = t.clientX - s.left, d = {
540
- scaleId: c,
541
- value: L(e, r, c, "css")
540
+ scaleId: i,
541
+ value: D(e, r, i, "css")
542
542
  }, u = t.clientY - s.top, l = {
543
543
  scaleId: a,
544
- value: L(e, u, a, "css")
544
+ value: D(e, u, a, "css")
545
545
  };
546
546
  return { pointerSyncPosition: { x: d, y: l }, cssX: r, cssY: u };
547
- }, z = (t, s) => {
547
+ }, F = (t, s) => {
548
548
  const e = t.x ? H(
549
549
  s,
550
550
  t.x.value,
@@ -561,8 +561,8 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
561
561
  cssY: o,
562
562
  scaled: Object.fromEntries(
563
563
  s.scales.map((n) => {
564
- const c = n.origin === "y" ? o : e;
565
- return [n.id, L(s, c, n.id, "css")];
564
+ const i = n.origin === "y" ? o : e;
565
+ return [n.id, D(s, i, n.id, "css")];
566
566
  })
567
567
  )
568
568
  };
@@ -577,11 +577,11 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
577
577
  s.to,
578
578
  s.scaleId,
579
579
  "css"
580
- ), c = e.scales.flatMap(
580
+ ), i = e.scales.flatMap(
581
581
  (a) => {
582
582
  if (a.origin !== t)
583
583
  return [];
584
- const r = L(e, o, a.id, "css"), d = L(e, n, a.id, "css");
584
+ const r = D(e, o, a.id, "css"), d = D(e, n, a.id, "css");
585
585
  return [
586
586
  {
587
587
  scaleId: a.id,
@@ -594,7 +594,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
594
594
  return {
595
595
  fromCSS: o,
596
596
  toCSS: n,
597
- scaled: c
597
+ scaled: i
598
598
  };
599
599
  }, be = ({
600
600
  id: t,
@@ -602,7 +602,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
602
602
  onDblClick: e,
603
603
  onMouseMove: o,
604
604
  onMouseDown: n,
605
- onMouseUp: c,
605
+ onMouseUp: i,
606
606
  onDocumentMouseUp: a,
607
607
  onSpanSelect: r,
608
608
  onContextMenu: d,
@@ -611,24 +611,24 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
611
611
  sync: p,
612
612
  children: m
613
613
  }) => {
614
- const f = Ut(), i = t || f;
615
- return M("dblclick", i, (h) => {
614
+ const f = Ut(), c = t || f;
615
+ return M("dblclick", c, (h) => {
616
616
  e?.(h);
617
- }), M("click", i, (h) => {
617
+ }), M("click", c, (h) => {
618
618
  s?.(h);
619
- }), M("move", i, (h) => {
619
+ }), M("move", c, (h) => {
620
620
  o?.(h);
621
- }), M("mousedown", i, (h) => {
621
+ }), M("mousedown", c, (h) => {
622
622
  n?.(h);
623
- }), M("mouseup", i, (h) => {
624
- c?.(h);
625
- }), M("documentmouseup", i, (h) => {
623
+ }), M("mouseup", c, (h) => {
624
+ i?.(h);
625
+ }), M("documentmouseup", c, (h) => {
626
626
  a?.(h);
627
- }), M("spanselect", i, (h) => {
627
+ }), M("spanselect", c, (h) => {
628
628
  r?.(h);
629
- }), M("contextmenu", i, (h) => {
629
+ }), M("contextmenu", c, (h) => {
630
630
  d?.(h);
631
- }), /* @__PURE__ */ lt(ft.Provider, { value: i, children: [
631
+ }), /* @__PURE__ */ lt(ft.Provider, { value: c, children: [
632
632
  /* @__PURE__ */ _(
633
633
  Vt,
634
634
  {
@@ -640,22 +640,22 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
640
640
  m
641
641
  ] });
642
642
  }, Vt = ({ className: t, style: s, sync: e }) => {
643
- const o = D(null), n = ht(), c = D(n);
644
- c.current = n;
645
- const a = J(ft), r = e?.key || a, d = D(null), u = D(null), l = D(null), p = () => {
646
- const i = o.current?.parentElement;
647
- if (i) {
648
- if (i.dataset.canplotroot === void 0)
643
+ const o = U(null), n = ht(), i = U(n);
644
+ i.current = n;
645
+ const a = J(ft), r = e?.key || a, d = U(null), u = U(null), l = U(null), p = () => {
646
+ const c = o.current?.parentElement;
647
+ if (c) {
648
+ if (c.dataset.canplotroot === void 0)
649
649
  throw new Error(
650
650
  "ChartAreaInteractions must be used within a CanPlot component"
651
651
  );
652
- return i.getBoundingClientRect();
652
+ return c.getBoundingClientRect();
653
653
  }
654
- }, m = (i, h) => {
654
+ }, m = (c, h) => {
655
655
  const y = Nt(
656
- i,
656
+ c,
657
657
  p(),
658
- c.current,
658
+ i.current,
659
659
  e?.xViaScaleId,
660
660
  e?.yViaScaleId
661
661
  );
@@ -663,21 +663,21 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
663
663
  y.pointerSyncPosition,
664
664
  { cssX: y.cssX, cssY: y.cssY },
665
665
  {
666
- ctrlKey: i.ctrlKey,
667
- altKey: i.altKey,
668
- shiftKey: i.shiftKey,
669
- metaKey: i.metaKey
666
+ ctrlKey: c.ctrlKey,
667
+ altKey: c.altKey,
668
+ shiftKey: c.shiftKey,
669
+ metaKey: c.metaKey
670
670
  }
671
671
  );
672
- }, f = D(m);
672
+ }, f = U(m);
673
673
  return f.current = m, wt(() => {
674
- const i = (g) => {
674
+ const c = (g) => {
675
675
  const v = u.current;
676
676
  v && S.sync_spanselect.dispatchEvent(r, {
677
677
  ...v,
678
678
  completed: !0
679
679
  }), S.documentmouseup.dispatchEvent(r, {
680
- frame: c.current,
680
+ frame: i.current,
681
681
  keys: {
682
682
  ctrlKey: g.ctrlKey,
683
683
  altKey: g.altKey,
@@ -715,44 +715,44 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
715
715
  (v, { cssX: T, cssY: b }, C) => {
716
716
  const k = d.current;
717
717
  if (!k || !v.x || !v.y) return;
718
- const A = c.current, P = k.xRangeCss.start, $ = T, F = k.yRangeCss.start, st = b, nt = I(A, v.x.scaleId), ot = I(A, v.y.scaleId);
718
+ const A = i.current, P = k.xRangeCss.start, B = T, K = k.yRangeCss.start, st = b, nt = I(A, v.x.scaleId), ot = I(A, v.y.scaleId);
719
719
  d.current = {
720
- xRangeCss: { start: P, end: $ },
721
- yRangeCss: { start: F, end: st }
720
+ xRangeCss: { start: P, end: B },
721
+ yRangeCss: { start: K, end: st }
722
722
  };
723
- let U = "below_threshold";
724
- const ct = Math.abs(F - st), it = Math.abs(P - $);
725
- ct < 10 && it < 10 ? U = "below_threshold" : ct > 30 && it > 30 ? U = "box" : ct > it ? U = "y" : U = "x";
726
- const Mt = U === "x" || U === "box" ? {
723
+ let $ = "below_threshold";
724
+ const it = Math.abs(K - st), ct = Math.abs(P - B);
725
+ it < 10 && ct < 10 ? $ = "below_threshold" : it > 30 && ct > 30 ? $ = "box" : it > ct ? $ = "y" : $ = "x";
726
+ const Mt = {
727
727
  scaleId: nt.id,
728
- from: L(
728
+ from: D(
729
729
  A,
730
- O(c.current, P, "css"),
730
+ Y(i.current, P, "css"),
731
731
  nt.id,
732
732
  "css"
733
733
  ),
734
- to: L(
734
+ to: D(
735
735
  A,
736
- O(c.current, $, "css"),
736
+ Y(i.current, B, "css"),
737
737
  nt.id,
738
738
  "css"
739
739
  )
740
- } : void 0, Pt = U === "y" || U === "box" ? {
740
+ }, Pt = {
741
741
  scaleId: ot.id,
742
- from: L(
742
+ from: D(
743
743
  A,
744
- B(c.current, F, "css"),
744
+ O(i.current, K, "css"),
745
745
  ot.id,
746
746
  "css"
747
747
  ),
748
- to: L(
748
+ to: D(
749
749
  A,
750
- B(c.current, st, "css"),
750
+ O(i.current, st, "css"),
751
751
  ot.id,
752
752
  "css"
753
753
  )
754
- } : void 0, yt = {
755
- mode: U,
754
+ }, yt = {
755
+ mode: $,
756
756
  xRange: Mt,
757
757
  yRange: Pt,
758
758
  completed: !1,
@@ -779,96 +779,96 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
779
779
  }
780
780
  });
781
781
  };
782
- document.addEventListener("mouseup", i), document.addEventListener("keydown", h), document.addEventListener("keyup", h), document.addEventListener("mousemove", y);
782
+ document.addEventListener("mouseup", c), document.addEventListener("keydown", h), document.addEventListener("keyup", h), document.addEventListener("mousemove", y);
783
783
  const w = o.current;
784
784
  return w?.addEventListener("wheel", x, {
785
785
  passive: !1
786
786
  }), () => {
787
- document.removeEventListener("mouseup", i), document.removeEventListener("keydown", h), document.removeEventListener("keyup", h), document.removeEventListener("mousemove", y), w?.removeEventListener("wheel", x);
787
+ document.removeEventListener("mouseup", c), document.removeEventListener("keydown", h), document.removeEventListener("keyup", h), document.removeEventListener("mousemove", y), w?.removeEventListener("wheel", x);
788
788
  };
789
- }, [c, r, f]), M("sync_dblclick", r, (i) => {
790
- const h = z(
791
- i.positions,
792
- c.current
789
+ }, [i, r, f]), M("sync_dblclick", r, (c) => {
790
+ const h = F(
791
+ c.positions,
792
+ i.current
793
793
  );
794
794
  h && S.dblclick.dispatchEvent(a, {
795
- frame: c.current,
795
+ frame: i.current,
796
796
  pointer: h,
797
- keys: i.keys
797
+ keys: c.keys
798
798
  });
799
- }), M("sync_click", r, (i) => {
800
- const h = z(
801
- i.positions,
802
- c.current
799
+ }), M("sync_click", r, (c) => {
800
+ const h = F(
801
+ c.positions,
802
+ i.current
803
803
  );
804
804
  h && S.click.dispatchEvent(a, {
805
- frame: c.current,
805
+ frame: i.current,
806
806
  pointer: h,
807
- keys: i.keys
807
+ keys: c.keys
808
808
  });
809
- }), M("sync_contextmenu", r, (i) => {
810
- const h = z(
811
- i.positions,
812
- c.current
809
+ }), M("sync_contextmenu", r, (c) => {
810
+ const h = F(
811
+ c.positions,
812
+ i.current
813
813
  );
814
814
  h && S.contextmenu.dispatchEvent(a, {
815
- frame: c.current,
815
+ frame: i.current,
816
816
  pointer: h,
817
- keys: i.keys
817
+ keys: c.keys
818
818
  });
819
- }), M("sync_move", r, (i) => {
820
- const h = i.positions ? z(
821
- i.positions,
822
- c.current
819
+ }), M("sync_move", r, (c) => {
820
+ const h = c.positions ? F(
821
+ c.positions,
822
+ i.current
823
823
  ) : null;
824
- l.current = i, S.move.dispatchEvent(a, {
825
- frame: c.current,
824
+ l.current = c, S.move.dispatchEvent(a, {
825
+ frame: i.current,
826
826
  pointer: h ?? null,
827
- keys: i.keys
827
+ keys: c.keys
828
828
  });
829
- }), M("sync_mousedown", r, (i) => {
830
- const h = z(
831
- i.positions,
832
- c.current
829
+ }), M("sync_mousedown", r, (c) => {
830
+ const h = F(
831
+ c.positions,
832
+ i.current
833
833
  );
834
834
  h && S.mousedown.dispatchEvent(a, {
835
- frame: c.current,
835
+ frame: i.current,
836
836
  pointer: h,
837
- keys: i.keys
837
+ keys: c.keys
838
838
  });
839
- }), M("sync_mouseup", r, (i) => {
840
- const h = z(
841
- i.positions,
842
- c.current
839
+ }), M("sync_mouseup", r, (c) => {
840
+ const h = F(
841
+ c.positions,
842
+ i.current
843
843
  );
844
844
  h && S.mouseup.dispatchEvent(a, {
845
- frame: c.current,
845
+ frame: i.current,
846
846
  pointer: h,
847
- keys: i.keys
847
+ keys: c.keys
848
848
  });
849
849
  }), M(
850
850
  "sync_pressandwheel",
851
851
  r,
852
- (i) => {
853
- const h = z(
854
- i.positions,
855
- c.current
852
+ (c) => {
853
+ const h = F(
854
+ c.positions,
855
+ i.current
856
856
  );
857
857
  h && S.pressandwheel.dispatchEvent(a, {
858
- frame: c.current,
858
+ frame: i.current,
859
859
  pointer: h,
860
- keys: i.keys,
861
- deltaX: i.deltaX,
862
- deltaY: i.deltaY,
863
- deltaAbs: i.deltaAbs
860
+ keys: c.keys,
861
+ deltaX: c.deltaX,
862
+ deltaY: c.deltaY,
863
+ deltaAbs: c.deltaAbs
864
864
  });
865
865
  }
866
- ), M("sync_spanselect", r, (i) => {
867
- const h = i.xRange && xt("x", i.xRange, c.current), y = i.yRange && xt("y", i.yRange, c.current), x = h?.scaled, w = y?.scaled;
868
- i.completed && (d.current = null), S.spanselect.dispatchEvent(a, {
869
- mode: i.mode,
870
- frame: c.current,
871
- completed: i.completed,
866
+ ), M("sync_spanselect", r, (c) => {
867
+ const h = c.xRange && xt("x", c.xRange, i.current), y = c.yRange && xt("y", c.yRange, i.current), x = h?.scaled, w = y?.scaled;
868
+ c.completed && (d.current = null), S.spanselect.dispatchEvent(a, {
869
+ mode: c.mode,
870
+ frame: i.current,
871
+ completed: c.completed,
872
872
  x: {
873
873
  css: h && {
874
874
  from: h.fromCSS,
@@ -883,7 +883,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
883
883
  },
884
884
  scaled: w ?? []
885
885
  },
886
- keys: i.keys
886
+ keys: c.keys
887
887
  });
888
888
  }), /* @__PURE__ */ _(
889
889
  "div",
@@ -900,35 +900,35 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
900
900
  zIndex: 25,
901
901
  ...s
902
902
  },
903
- onDragStart: (i) => {
904
- i.preventDefault();
903
+ onDragStart: (c) => {
904
+ c.preventDefault();
905
905
  },
906
- onClick: (i) => {
907
- m(i, (h, y, x) => {
906
+ onClick: (c) => {
907
+ m(c, (h, y, x) => {
908
908
  S.sync_click.dispatchEvent(r, {
909
909
  positions: h,
910
910
  keys: x
911
911
  });
912
912
  });
913
913
  },
914
- onMouseLeave: (i) => {
915
- m(i, (h, y, x) => {
914
+ onMouseLeave: (c) => {
915
+ m(c, (h, y, x) => {
916
916
  S.sync_move.dispatchEvent(r, {
917
917
  positions: null,
918
918
  keys: x
919
919
  });
920
920
  });
921
921
  },
922
- onMouseMove: (i) => {
923
- m(i, (h, y, x) => {
922
+ onMouseMove: (c) => {
923
+ m(c, (h, y, x) => {
924
924
  S.sync_move.dispatchEvent(r, {
925
925
  positions: h,
926
926
  keys: x
927
927
  });
928
928
  });
929
929
  },
930
- onMouseDown: (i) => {
931
- m(i, (h, { cssX: y, cssY: x }, w) => {
930
+ onMouseDown: (c) => {
931
+ m(c, (h, { cssX: y, cssY: x }, w) => {
932
932
  S.sync_mousedown.dispatchEvent(r, {
933
933
  positions: h,
934
934
  keys: w
@@ -938,8 +938,8 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
938
938
  };
939
939
  });
940
940
  },
941
- onMouseUp: (i) => {
942
- m(i, (h, y, x) => {
941
+ onMouseUp: (c) => {
942
+ m(c, (h, y, x) => {
943
943
  S.sync_mouseup.dispatchEvent(r, {
944
944
  positions: h,
945
945
  keys: x
@@ -960,16 +960,16 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
960
960
  }
961
961
  });
962
962
  },
963
- onContextMenu: (i) => {
964
- i.preventDefault(), m(i, (h, y, x) => {
963
+ onContextMenu: (c) => {
964
+ c.preventDefault(), m(c, (h, y, x) => {
965
965
  S.sync_contextmenu.dispatchEvent(r, {
966
966
  positions: h,
967
967
  keys: x
968
968
  });
969
969
  });
970
970
  },
971
- onDoubleClick: (i) => {
972
- m(i, (h, y, x) => {
971
+ onDoubleClick: (c) => {
972
+ m(c, (h, y, x) => {
973
973
  S.sync_dblclick.dispatchEvent(r, {
974
974
  positions: h,
975
975
  keys: x
@@ -983,7 +983,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
983
983
  mt("move", (a) => {
984
984
  n(a);
985
985
  });
986
- const c = Q(() => {
986
+ const i = Q(() => {
987
987
  if (!o)
988
988
  return null;
989
989
  const { frame: a, pointer: r } = o, d = r?.scaled[e];
@@ -999,14 +999,14 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
999
999
  const x = Math.abs(y.x - d);
1000
1000
  x < f && (f = x, m = h);
1001
1001
  }
1002
- const i = p.points[m ?? -1];
1003
- if (!i || ut(a, f, e, "css") > 30) {
1002
+ const c = p.points[m ?? -1];
1003
+ if (!c || ut(a, f, e, "css") > 30) {
1004
1004
  u.push({ seriesId: p.seriesId, y: null });
1005
1005
  continue;
1006
1006
  }
1007
- l = i.x, u.push({
1007
+ l = c.x, u.push({
1008
1008
  seriesId: p.seriesId,
1009
- y: i.y
1009
+ y: c.y
1010
1010
  });
1011
1011
  }
1012
1012
  return {
@@ -1015,14 +1015,14 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
1015
1015
  points: u
1016
1016
  };
1017
1017
  }, [t, o, e]);
1018
- return s(c);
1018
+ return s(i);
1019
1019
  }, Ce = ({ makeXStyle: t, makeXClassName: s, makeYStyle: e, makeYClassName: o }) => {
1020
- const [n, c] = V(null);
1020
+ const [n, i] = V(null);
1021
1021
  if (mt("move", (l) => {
1022
- c(l);
1022
+ i(l);
1023
1023
  }), !n)
1024
1024
  return null;
1025
- const { frame: a, pointer: r } = n, d = O(a, r?.cssX ?? 0, "css"), u = B(a, r?.cssY ?? 0, "css");
1025
+ const { frame: a, pointer: r } = n, d = Y(a, r?.cssX ?? 0, "css"), u = O(a, r?.cssY ?? 0, "css");
1026
1026
  return /* @__PURE__ */ lt(_t, { children: [
1027
1027
  /* @__PURE__ */ _(
1028
1028
  "div",
@@ -1066,30 +1066,16 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
1066
1066
  ] });
1067
1067
  }, Te = ({ makeClassName: t, makeStyle: s }) => {
1068
1068
  const [e, o] = V(null);
1069
- mt("spanselect", (c) => {
1070
- o(c.mode === "below_threshold" || c.completed ? null : c);
1069
+ mt("spanselect", (i) => {
1070
+ o(
1071
+ i.mode === "below_threshold" || i.completed ? null : i
1072
+ );
1071
1073
  });
1072
1074
  const n = Q(() => {
1073
1075
  if (!e || e.mode === "below_threshold")
1074
1076
  return null;
1075
- const c = O(
1076
- e.frame,
1077
- e.x.css?.from ?? -1 / 0,
1078
- "css"
1079
- ), a = O(
1080
- e.frame,
1081
- e.x.css?.to ?? 1 / 0,
1082
- "css"
1083
- ), r = B(
1084
- e.frame,
1085
- e.y.css?.from ?? -1 / 0,
1086
- "css"
1087
- ), d = B(
1088
- e.frame,
1089
- e.y.css?.to ?? 1 / 0,
1090
- "css"
1091
- ), u = Math.min(c, a), l = Math.min(r, d), p = Math.abs(a - c), m = Math.abs(d - r);
1092
- return { leftPx: u, topPx: l, widthPx: p, heightPx: m };
1077
+ const i = e.mode === "y" ? -1 / 0 : e.x.css?.from ?? -1 / 0, a = e.mode === "y" ? 1 / 0 : e.x.css?.to ?? 1 / 0, r = e.mode === "x" ? -1 / 0 : e.y.css?.from ?? -1 / 0, d = e.mode === "x" ? 1 / 0 : e.y.css?.from ?? 1 / 0, u = Y(e.frame, i, "css"), l = Y(e.frame, a, "css"), p = O(e.frame, r, "css"), m = O(e.frame, d, "css"), f = Math.min(u, l), c = Math.min(p, m), h = Math.abs(l - u), y = Math.abs(m - p);
1078
+ return { leftPx: f, topPx: c, widthPx: h, heightPx: y };
1093
1079
  }, [e]);
1094
1080
  return /* @__PURE__ */ _(
1095
1081
  "div",
@@ -1108,7 +1094,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
1108
1094
  }
1109
1095
  );
1110
1096
  }, ke = ({ style: t, children: s, scaleId: e, ...o }) => {
1111
- const n = ht((c) => c.getScale(e)?.axis);
1097
+ const n = ht((i) => i.getScale(e)?.axis);
1112
1098
  return n ? /* @__PURE__ */ _(
1113
1099
  "div",
1114
1100
  {
@@ -1130,16 +1116,16 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
1130
1116
  formatter: s,
1131
1117
  acceptableIncrements: e
1132
1118
  } = {}) => (o, n) => {
1133
- const { min: c, max: a } = o, r = [], d = window.devicePixelRatio || 1, u = (t ?? (o.origin === "x" ? Tt : jt)) * d, l = Dt(
1119
+ const { min: i, max: a } = o, r = [], d = window.devicePixelRatio || 1, u = (t ?? (o.origin === "x" ? Tt : jt)) * d, l = Dt(
1134
1120
  n,
1135
1121
  u,
1136
1122
  o.id,
1137
1123
  "canvas"
1138
- ), p = e ?? W, m = p.find((i) => i > l) ?? p.at(-1) ?? 1;
1139
- let f = c;
1124
+ ), p = e ?? W, m = p.find((c) => c > l) ?? p.at(-1) ?? 1;
1125
+ let f = i;
1140
1126
  if (Math.abs(f % m) > Number.EPSILON) {
1141
- const i = (m - f % m) % m;
1142
- f += i;
1127
+ const c = (m - f % m) % m;
1128
+ f += c;
1143
1129
  }
1144
1130
  for (; f <= a && r.length < 1e3; )
1145
1131
  r.push(f), f += m;
@@ -1238,7 +1224,7 @@ const qt = 1, Et = 1e3 * qt, pt = 60 * Et, tt = 60 * pt, et = 24 * tt, Gt = 30 *
1238
1224
  }, gt = (t, s) => {
1239
1225
  const e = new Date(t);
1240
1226
  return e.setUTCMonth(e.getUTCMonth() + s), e.getTime();
1241
- }, K = (t, s) => {
1227
+ }, X = (t, s) => {
1242
1228
  const [e, o] = s;
1243
1229
  switch (o) {
1244
1230
  case "milliseconds":
@@ -1263,32 +1249,32 @@ function G(t, s) {
1263
1249
  }
1264
1250
  const oe = (t, s, e = "UTC") => {
1265
1251
  const [o, n] = s;
1266
- let c = new Date(t);
1252
+ let i = new Date(t);
1267
1253
  const a = () => {
1268
- c.setUTCHours(-G(c, e), 0, 0, 0);
1254
+ i.setUTCHours(-G(i, e), 0, 0, 0);
1269
1255
  };
1270
1256
  switch (n) {
1271
1257
  case "milliseconds":
1272
- c.setUTCMilliseconds(
1273
- Math.ceil(c.getUTCMilliseconds() / o) * o
1258
+ i.setUTCMilliseconds(
1259
+ Math.ceil(i.getUTCMilliseconds() / o) * o
1274
1260
  );
1275
1261
  break;
1276
1262
  case "seconds":
1277
- c.setUTCSeconds(
1278
- Math.ceil(c.getUTCSeconds() / o) * o,
1263
+ i.setUTCSeconds(
1264
+ Math.ceil(i.getUTCSeconds() / o) * o,
1279
1265
  0
1280
1266
  );
1281
1267
  break;
1282
1268
  case "minutes":
1283
- c.setUTCMinutes(
1284
- Math.ceil(c.getTime() % tt / pt / o) * o,
1269
+ i.setUTCMinutes(
1270
+ Math.ceil(i.getTime() % tt / pt / o) * o,
1285
1271
  0,
1286
1272
  0
1287
1273
  );
1288
1274
  break;
1289
1275
  case "hours":
1290
- c.setUTCHours(
1291
- Math.ceil(c.getTime() % et / tt / o) * o,
1276
+ i.setUTCHours(
1277
+ Math.ceil(i.getTime() % et / tt / o) * o,
1292
1278
  0,
1293
1279
  0,
1294
1280
  0
@@ -1297,20 +1283,20 @@ const oe = (t, s, e = "UTC") => {
1297
1283
  case "days":
1298
1284
  case "months":
1299
1285
  case "years":
1300
- n === "months" ? c.setUTCDate(1) : n === "years" && c.setUTCMonth(0, 1), a(), c.getTime() < t && (c = new Date(K(c, [1, n])));
1286
+ n === "months" ? i.setUTCDate(1) : n === "years" && i.setUTCMonth(0, 1), a(), i.getTime() < t && (i = new Date(X(i, [1, n])));
1301
1287
  break;
1302
1288
  }
1303
- return c.getTime();
1289
+ return i.getTime();
1304
1290
  }, Me = ({
1305
1291
  timeZone: t = kt,
1306
1292
  space: s = Tt,
1307
1293
  formatter: e,
1308
1294
  locale: o,
1309
1295
  showTimezone: n
1310
- } = {}) => (c, a) => {
1311
- const { min: r, max: d } = c, u = Math.floor(a.chartAreaCanvasPX.width / s) + 1, p = (d - r) / u, [m, f] = Jt.find(
1296
+ } = {}) => (i, a) => {
1297
+ const { min: r, max: d } = i, u = Math.floor(a.chartAreaCanvasPX.width / s) + 1, p = (d - r) / u, [m, f] = Jt.find(
1312
1298
  (w) => q(w) >= p
1313
- ) ?? [1, "milliseconds"], i = oe(r, [m, f], t), h = G(i, t), y = [i];
1299
+ ) ?? [1, "milliseconds"], c = oe(r, [m, f], t), h = G(c, t), y = [c];
1314
1300
  let x;
1315
1301
  for (; ; ) {
1316
1302
  switch (f) {
@@ -1318,15 +1304,15 @@ const oe = (t, s, e = "UTC") => {
1318
1304
  case "seconds":
1319
1305
  case "minutes":
1320
1306
  case "hours": {
1321
- x = K(i, [y.length * m, f]);
1307
+ x = X(c, [y.length * m, f]);
1322
1308
  break;
1323
1309
  }
1324
1310
  case "days": {
1325
- const w = K(i, [
1311
+ const w = X(c, [
1326
1312
  y.length * m,
1327
1313
  f
1328
1314
  ]);
1329
- x = K(w, [
1315
+ x = X(w, [
1330
1316
  h - G(w, t),
1331
1317
  "hours"
1332
1318
  ]);
@@ -1334,14 +1320,14 @@ const oe = (t, s, e = "UTC") => {
1334
1320
  }
1335
1321
  case "months":
1336
1322
  case "years": {
1337
- const w = K(
1338
- K(K(i, [h, "hours"]), [
1323
+ const w = X(
1324
+ X(X(c, [h, "hours"]), [
1339
1325
  y.length * m,
1340
1326
  f
1341
1327
  ]),
1342
1328
  [-h, "hours"]
1343
1329
  );
1344
- x = K(w, [
1330
+ x = X(w, [
1345
1331
  h - G(w, t),
1346
1332
  "hours"
1347
1333
  ]);
@@ -1352,12 +1338,12 @@ const oe = (t, s, e = "UTC") => {
1352
1338
  break;
1353
1339
  y.push(x);
1354
1340
  }
1355
- return (e ?? ce({
1341
+ return (e ?? ie({
1356
1342
  locale: o,
1357
1343
  showTimezone: n,
1358
1344
  timeZone: t
1359
1345
  }))(y);
1360
- }, X = (t, s, e) => t.find((o) => o.type === e)?.value !== s.find((o) => o.type === e)?.value, ce = ({
1346
+ }, L = (t, s, e) => t.find((o) => o.type === e)?.value !== s.find((o) => o.type === e)?.value, ie = ({
1361
1347
  timeZone: t = kt,
1362
1348
  locale: s = Ht,
1363
1349
  showTimezone: e = !0
@@ -1375,26 +1361,26 @@ const oe = (t, s, e = "UTC") => {
1375
1361
  timeZone: t
1376
1362
  });
1377
1363
  return (n) => {
1378
- const c = n[1] - n[0], a = c < q([1, "days"]), r = c < q([1, "minutes"]), d = c < q([1, "seconds"]);
1364
+ const i = n[1] - n[0], a = i < q([1, "days"]), r = i < q([1, "minutes"]), d = i < q([1, "seconds"]);
1379
1365
  return n.map((u) => ({ value: u, label: o.formatToParts(new Date(u)) })).map((u, l, p) => {
1380
- const m = p[l - 1], f = l === 0 || X(u.label, m.label, "year"), i = l === 0 || X(u.label, m.label, "day"), h = l === 0 || X(u.label, m.label, "month"), y = l === 0 || X(u.label, m.label, "hour"), x = l === 0 || X(u.label, m.label, "timeZoneName"), w = l === 0 || X(u.label, m.label, "minute"), g = l === 0 || X(u.label, m.label, "second"), v = l === 0 || X(u.label, m.label, "fractionalSecond"), T = [];
1366
+ const m = p[l - 1], f = l === 0 || L(u.label, m.label, "year"), c = l === 0 || L(u.label, m.label, "day"), h = l === 0 || L(u.label, m.label, "month"), y = l === 0 || L(u.label, m.label, "hour"), x = l === 0 || L(u.label, m.label, "timeZoneName"), w = l === 0 || L(u.label, m.label, "minute"), g = l === 0 || L(u.label, m.label, "second"), v = l === 0 || L(u.label, m.label, "fractionalSecond"), T = [];
1381
1367
  if (a && (y || w || x || g || v)) {
1382
1368
  const b = u.label.find((P) => P.type === "hour")?.value, C = u.label.find((P) => P.type === "minute")?.value, k = u.label.find((P) => P.type === "timeZoneName")?.value;
1383
1369
  let A = "";
1384
1370
  if (r) {
1385
- const P = u.label.find((F) => F.type === "second")?.value, $ = u.label.find(
1386
- (F) => F.type === "fractionalSecond"
1371
+ const P = u.label.find((K) => K.type === "second")?.value, B = u.label.find(
1372
+ (K) => K.type === "fractionalSecond"
1387
1373
  )?.value;
1388
- A = `:${P}` + (d ? `.${$}` : "");
1374
+ A = `:${P}` + (d ? `.${B}` : "");
1389
1375
  }
1390
1376
  T.push(
1391
1377
  `${b}:${C}${A}` + (e && x ? ` ${k}` : "")
1392
1378
  );
1393
1379
  }
1394
- return (i || h) && T.push(
1380
+ return (c || h) && T.push(
1395
1381
  [
1396
1382
  u.label.find((b) => b.type === "month")?.value,
1397
- i && u.label.find((b) => b.type === "day")?.value
1383
+ c && u.label.find((b) => b.type === "day")?.value
1398
1384
  ].filter(Boolean).join(" ")
1399
1385
  ), f && T.push(u.label.find((b) => b.type === "year")?.value), {
1400
1386
  value: u.value,
@@ -1421,18 +1407,18 @@ export {
1421
1407
  R as applyStyles,
1422
1408
  j as clamp,
1423
1409
  de as clampUnfit,
1424
- O as clampXPosToChartArea,
1425
- B as clampYPosToChartArea,
1410
+ Y as clampXPosToChartArea,
1411
+ O as clampYPosToChartArea,
1426
1412
  Wt as defaultNumericalTicksFormatter,
1427
1413
  ue as findClosestIndex,
1428
1414
  I as getScale,
1429
1415
  Ee as makeLinearTicks,
1430
- ce as makeTimeTickFormat,
1416
+ ie as makeTimeTickFormat,
1431
1417
  Me as makeTimeTicks,
1432
- L as posToVal,
1418
+ D as posToVal,
1433
1419
  Dt as pxToValDistance,
1434
1420
  le as sum,
1435
- Y as useDrawEffect,
1421
+ z as useDrawEffect,
1436
1422
  ht as useFrameState,
1437
1423
  mt as useInteractionsEvent,
1438
1424
  ge as useXPositioned,