@diamondlightsource/davidia 1.3.0-rc.1 → 1.3.1-rc.3

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,55 +1,55 @@
1
1
  import e from "afterframe";
2
- import { AXIS_SCALE_TYPES as t, Box as n, Btn as r, COLOR_SCALE_TYPES as i, CellWidthInput as a, ColorMapGradient as o, ColorMapSelector as s, CurveType as c, DataCurve as l, DataToHtml as u, DefaultInteractions as d, DomainControls as f, DomainSlider as p, FloatingControl as m, GlyphType as h, GlyphType as g, HeatmapVis as _, Histogram as v, MatrixVis as y, MouseButton as b, ResetZoomButton as x, RgbVis as S, ScaleSelector as C, ScaleType as w, ScaleType as T, ScatterVis as E, Selector as D, Separator as O, SurfaceVis as k, SvgElement as A, ToggleBtn as ee, ToggleGroup as j, Toolbar as te, TooltipMesh as ne, VisCanvas as M, VisMesh as N, assertDefined as re, getVisDomain as P, useCanvasEvent as ie, useInteraction as ae, useModifierKeyPressed as oe, useSafeDomain as F, useVisCanvasContext as se, useVisDomain as ce } from "@h5web/lib";
3
- import I from "ndarray";
4
- import le from "ndarray-concat-rows";
5
- import { bin as ue } from "d3-array";
6
- import { scaleLinear as de } from "d3-scale";
7
- import { Fragment as L, createContext as fe, useCallback as R, useContext as pe, useEffect as z, useLayoutEffect as me, useMemo as B, useRef as V, useState as H } from "react";
8
- import { Matrix3 as U, Vector3 as W } from "three";
9
- import { useFrame as he, useThree as ge } from "@react-three/fiber";
10
- import { useClickOutside as _e, useKeyboardEvent as ve, usePrevious as ye, useRafState as be, useSyncedRef as xe, useToggle as Se } from "@react-hookz/web";
11
- import { Fragment as G, jsx as K, jsxs as q } from "react/jsx-runtime";
12
- import { Drag as Ce } from "@visx/drag";
13
- import { BsCardHeading as we, BsSlashLg as Te } from "react-icons/bs";
14
- import { MdAspectRatio as Ee, MdGridOn as De, MdHorizontalRule as Oe, MdOutlinePolyline as ke, MdOutlineRectangle as Ae, MdOutlineShapeLine as je } from "react-icons/md";
15
- import { TbAxisX as Me, TbAxisY as Ne, TbCircle as Pe, TbGridDots as Fe, TbOvalVertical as Ie, TbPolygon as Le, TbQuestionMark as Re, TbZoomInArea as ze, TbZoomPan as Be } from "react-icons/tb";
2
+ import { Fragment as t, createContext as n, useCallback as r, useContext as i, useEffect as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l } from "react";
3
+ import { AXIS_SCALE_TYPES as u, Box as d, Btn as f, COLOR_SCALE_TYPES as p, CellWidthInput as m, ColorMapGradient as h, ColorMapSelector as g, CurveType as _, DataCurve as v, DataToHtml as y, DefaultInteractions as b, DomainControls as x, DomainSlider as S, FloatingControl as C, GlyphType as w, GlyphType as T, HeatmapVis as E, Histogram as D, MatrixVis as O, MouseButton as k, ResetZoomButton as A, RgbVis as j, ScaleSelector as M, ScaleType as N, ScaleType as P, ScatterVis as F, Selector as I, Separator as L, SurfaceVis as R, SvgElement as z, ToggleBtn as ee, ToggleGroup as B, Toolbar as V, TooltipMesh as H, VisCanvas as te, VisMesh as ne, assertDefined as re, getVisDomain as U, useCanvasEvent as ie, useInteraction as ae, useModifierKeyPressed as oe, useSafeDomain as se, useVisCanvasContext as ce, useVisDomain as le } from "@h5web/lib";
4
+ import ue from "ndarray";
5
+ import W from "ndarray-concat-rows";
6
+ import { bin as de } from "d3-array";
7
+ import { scaleLinear as fe } from "d3-scale";
8
+ import { Matrix3 as G, Vector3 as K } from "three";
9
+ import { useFrame as pe, useThree as me } from "@react-three/fiber";
10
+ import { useClickOutside as he, useKeyboardEvent as ge, usePrevious as _e, useRafState as ve, useSyncedRef as ye, useToggle as be } from "@react-hookz/web";
11
+ import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
12
+ import { Drag as xe } from "@visx/drag";
13
+ import { BsCardHeading as Se, BsSlashLg as Ce } from "react-icons/bs";
14
+ import { MdAspectRatio as we, MdGridOn as Te, MdHorizontalRule as Ee, MdOutlinePolyline as De, MdOutlineRectangle as Oe } from "react-icons/md";
15
+ import { TbAxisX as ke, TbAxisY as Ae, TbCircle as je, TbGridDots as Me, TbOvalVertical as Ne, TbPolygon as Pe, TbQuestionMark as Fe, TbZoomInArea as Ie, TbZoomPan as Le } from "react-icons/tb";
16
16
  import "@h5web/lib/styles.css";
17
- import { IoMdUndo as Ve } from "react-icons/io";
18
- import He from "react-draggable";
19
- import { format as Ue } from "d3-format";
20
- import { HiCursorClick as We } from "react-icons/hi";
21
- import { IoShapesOutline as Ge } from "react-icons/io5";
22
- import { HexColorPicker as Ke } from "react-colorful";
23
- import { FaCircle as qe } from "react-icons/fa";
24
- import { RxCross1 as Je } from "react-icons/rx";
25
- import { FaSquareFull as Ye } from "react-icons/fa6";
26
- import Xe from "react-select";
27
- import { AiOutlineColumnHeight as Ze, AiOutlineColumnWidth as Qe } from "react-icons/ai";
28
- import { BiCircleQuarter as $e } from "react-icons/bi";
29
- import et from "ndarray-unsqueeze";
30
- import tt from "ndarray-tile";
31
- import { ArcballControls as nt, useTexture as rt, useVideoTexture as it } from "@react-three/drei";
32
- import { decode as at, encode as ot } from "@msgpack/msgpack";
33
- import st, { ReadyState as ct } from "react-use-websocket";
34
- import { toast as lt } from "react-toastify";
35
- //#region src/utils.ts
36
- function ut(e) {
17
+ import { IoMdUndo as Re } from "react-icons/io";
18
+ import ze from "react-draggable";
19
+ import { format as Be } from "d3-format";
20
+ import { HiCursorClick as Ve } from "react-icons/hi";
21
+ import { IoShapesOutline as He } from "react-icons/io5";
22
+ import { HexColorPicker as Ue } from "react-colorful";
23
+ import { FaCircle as We } from "react-icons/fa";
24
+ import { RxCross1 as Ge } from "react-icons/rx";
25
+ import { FaSquareFull as Ke } from "react-icons/fa6";
26
+ import qe from "react-select";
27
+ import { AiOutlineColumnHeight as Je, AiOutlineColumnWidth as Ye } from "react-icons/ai";
28
+ import { BiCircleQuarter as Xe } from "react-icons/bi";
29
+ import Ze from "ndarray-unsqueeze";
30
+ import Qe from "ndarray-tile";
31
+ import { ArcballControls as $e, useTexture as et, useVideoTexture as tt } from "@react-three/drei";
32
+ import { decode as nt, encode as rt } from "@msgpack/msgpack";
33
+ import it, { ReadyState as at } from "react-use-websocket";
34
+ import { toast as ot } from "react-toastify";
35
+ // src/utils.ts
36
+ function st(e) {
37
37
  let t = Infinity, n = -Infinity;
38
38
  if (e.data.forEach((e) => {
39
39
  Number.isNaN(e) || (e < t && (t = e), e > n && (n = e));
40
40
  }), t > n) throw Error("No valid numbers were compared");
41
41
  return [t, n];
42
42
  }
43
- function dt(e, t) {
43
+ function ct(e, t) {
44
44
  if (t == null) {
45
45
  if (e === void 0) throw Error("Cannot call with both arguments falsy");
46
46
  return e;
47
47
  }
48
48
  if (e === void 0) return t;
49
49
  let n, r = t.x.size, i = t.y.size;
50
- if (r === i || r === i + 1) n = le([e.x, t.x]);
50
+ if (r === i || r === i + 1) n = W([e.x, t.x]);
51
51
  else return console.log("x ({$xLength}) and y ({$yLength}) axes must be same length", t), e;
52
- let a = le([e.y, t.y]), o = ut(n), s = [Math.min(e.yDomain[0], t.yDomain[0]), Math.max(e.yDomain[1], t.yDomain[1])];
52
+ let a = W([e.y, t.y]), o = st(n), s = [Math.min(e.yDomain[0], t.yDomain[0]), Math.max(e.yDomain[1], t.yDomain[1])];
53
53
  return {
54
54
  key: e.key,
55
55
  lineParams: e.lineParams,
@@ -60,17 +60,17 @@ function dt(e, t) {
60
60
  yDomain: s
61
61
  };
62
62
  }
63
- function ft(e) {
63
+ function lt(e) {
64
64
  let t = e.map((e) => e.xDomain[0]), n = e.map((e) => e.xDomain[1]);
65
65
  return t.length == 1 ? [t[0], n[0]] : [Math.min(...t), Math.max(...n)];
66
66
  }
67
- function pt(e) {
67
+ function ut(e) {
68
68
  let t = e.map((e) => e.yDomain[0]), n = e.map((e) => e.yDomain[1]);
69
69
  return t.length == 1 ? [t[0], n[0]] : [Math.min(...t), Math.max(...n)];
70
70
  }
71
- function mt(e) {
72
- let t = e.values, n = J(t);
73
- if (St(e)) {
71
+ function dt(e) {
72
+ let t = e.values, n = yt(t);
73
+ if (bt(e)) {
74
74
  let t = e;
75
75
  return {
76
76
  domain: t.domain,
@@ -86,32 +86,32 @@ function mt(e) {
86
86
  values: n[0]
87
87
  };
88
88
  }
89
- function ht(e) {
90
- let t = e.heightValues, n = J(t);
89
+ function ft(e) {
90
+ let t = e.heightValues, n = yt(t);
91
91
  return {
92
92
  ...e,
93
93
  surfaceScale: e.surfaceScale ?? void 0,
94
94
  heightValues: n[0]
95
95
  };
96
96
  }
97
- function gt(e) {
98
- let t = e.cellValues, n = J(t);
97
+ function pt(e) {
98
+ let t = e.cellValues, n = yt(t);
99
99
  return {
100
100
  ...e,
101
101
  displayParams: e.displayParams ?? void 0,
102
102
  cellValues: n[0]
103
103
  };
104
104
  }
105
- function _t(e) {
105
+ function mt(e) {
106
106
  let t, n;
107
- return e?.xValues != null && (t = J(e.xValues)[0]), e?.yValues != null && (n = J(e.yValues)[0]), {
107
+ return e?.xValues != null && (t = yt(e.xValues)[0]), e?.yValues != null && (n = yt(e.yValues)[0]), {
108
108
  ...e,
109
109
  xValues: t,
110
110
  yValues: n
111
111
  };
112
112
  }
113
- function vt(e) {
114
- let t = e.x, n = J(t, !0), r = e.y, i = J(r, !0);
113
+ function ht(e) {
114
+ let t = e.x, n = yt(t, !0), r = e.y, i = yt(r, !0);
115
115
  return i[0].size == 0 ? null : {
116
116
  key: e.key,
117
117
  lineParams: e.lineParams,
@@ -121,8 +121,8 @@ function vt(e) {
121
121
  yDomain: i[1]
122
122
  };
123
123
  }
124
- function yt(e) {
125
- let t = e.pointValues, n = J(t), r = e.x, i = J(r), a = e.y, o = J(a);
124
+ function gt(e) {
125
+ let t = e.pointValues, n = yt(t), r = e.x, i = yt(r), a = e.y, o = yt(a);
126
126
  return {
127
127
  ...e,
128
128
  x: i[0],
@@ -130,7 +130,7 @@ function yt(e) {
130
130
  pointValues: n[0]
131
131
  };
132
132
  }
133
- function bt(e) {
133
+ function _t(e) {
134
134
  return e instanceof Uint8Array ? {
135
135
  buffer: e.buffer,
136
136
  offset: e.byteOffset
@@ -139,7 +139,7 @@ function bt(e) {
139
139
  offset: 0
140
140
  };
141
141
  }
142
- var xt = /* @__PURE__ */ new Map([
142
+ var vt = /* @__PURE__ */ new Map([
143
143
  ["|i1", Int8Array],
144
144
  ["<i2", Int16Array],
145
145
  ["<i4", Int32Array],
@@ -149,9 +149,9 @@ var xt = /* @__PURE__ */ new Map([
149
149
  ["<f4", Float32Array],
150
150
  ["<f8", Float64Array]
151
151
  ]);
152
- function J(e, t = !1) {
153
- if (e.shape.length === 0 || e.shape[0] === 0) return [I(/* @__PURE__ */ new Int8Array()), [0, 0]];
154
- let n = e.dtype, { buffer: r, offset: i } = bt(e.data);
152
+ function yt(e, t = !1) {
153
+ if (e.shape.length === 0 || e.shape[0] === 0) return [ue(/* @__PURE__ */ new Int8Array()), [0, 0]];
154
+ let n = e.dtype, { buffer: r, offset: i } = _t(e.data);
155
155
  if (!(r instanceof ArrayBuffer)) throw Error("Shared array buffer not supported");
156
156
  let a = e.shape.reduce((e, t) => e * t, 1);
157
157
  if (n === "<i8" || n === "<u8") {
@@ -160,7 +160,7 @@ function J(e, t = !1) {
160
160
  return t.forEach((e, t) => {
161
161
  if (Number.isSafeInteger(e)) o[t] = Number(e);
162
162
  else throw Error("Item not safe to convert");
163
- }), [I(o, e.shape), [0, 0]];
163
+ }), [ue(o, e.shape), [0, 0]];
164
164
  }
165
165
  let o = BigInt(2) ** BigInt(64), s = [o, -o], c = function(e) {
166
166
  e < s[0] && (s[0] = e), e > s[1] && (s[1] = e);
@@ -178,41 +178,41 @@ function J(e, t = !1) {
178
178
  let d = new Float64Array(l.length);
179
179
  return l.forEach((e, t) => {
180
180
  d[t] = Number(e);
181
- }), [I(d, e.shape), [Number(s[0]), Number(s[1])]];
181
+ }), [ue(d, e.shape), [Number(s[0]), Number(s[1])]];
182
182
  }
183
- let o = xt.get(n);
183
+ let o = vt.get(n);
184
184
  if (o === void 0) throw Error("ndarray of $dtype is not supported");
185
185
  let s = o.BYTES_PER_ELEMENT, c;
186
186
  i % s == 0 ? c = new o(r, i, a) : (console.warn("Buffer offset not aligned for a typed array so taking copy"), c = new o(r.slice(i, i + a * s)));
187
- let l = I(c, e.shape);
188
- return [l, t ? ut(l) : [0, 0]];
187
+ let l = ue(c, e.shape);
188
+ return [l, t ? st(l) : [0, 0]];
189
189
  }
190
- function St(e) {
190
+ function bt(e) {
191
191
  return "domain" in e && "heatmapScale" in e;
192
192
  }
193
- function Ct(e) {
194
- return St(e);
193
+ function xt(e) {
194
+ return bt(e);
195
195
  }
196
- function wt(e) {
196
+ function St(e) {
197
197
  return e === "equal" || e === "auto" ? e : "number";
198
198
  }
199
- function Y(e) {
199
+ function Ct(e) {
200
200
  let t = parseFloat(e);
201
201
  return [Number.isFinite(t), t];
202
202
  }
203
- function Tt(e, t, n, r) {
203
+ function wt(e, t, n, r) {
204
204
  let i = parseFloat(e);
205
205
  return [Number.isFinite(i) && i >= t && (r ? i <= n : i < n), i];
206
206
  }
207
- function Et(e, t, n) {
207
+ function Tt(e, t, n) {
208
208
  let r = parseFloat(e);
209
209
  return [Number.isFinite(r) && r > 0 && (n ? r <= t : r < t), r];
210
210
  }
211
- function Dt(e, t) {
211
+ function Et(e, t) {
212
212
  let n = parseFloat(e);
213
213
  return [Number.isFinite(n) && n >= 0 && !(n === 0 && !t), n];
214
214
  }
215
- function Ot(e) {
215
+ function Dt(e) {
216
216
  let t = e === "panAndWheelZoom", n = e === "selectToZoom";
217
217
  return {
218
218
  pan: t ? {} : !1,
@@ -224,9 +224,12 @@ function Ot(e) {
224
224
  ySelectToZoom: n ? { modifierKey: "Shift" } : !1
225
225
  };
226
226
  }
227
+ function Ot(e, t) {
228
+ return e.length == t.length && e.every((e, n) => e === t[n]);
229
+ }
227
230
  function kt(e, t) {
228
231
  if (e && e.length != 0) {
229
- let n = ue(), r = t === void 0 ? null : de().domain(t).nice(), i = e.length, a;
232
+ let n = de(), r = t === void 0 ? null : fe().domain(t).nice(), i = e.length, a;
230
233
  r !== null && i > 0 && (a = r.ticks(Math.min(i, 20)), n.thresholds(a));
231
234
  let o = n(e), s = o.map((e) => e.length);
232
235
  if (a === void 0) {
@@ -254,94 +257,93 @@ function jt() {
254
257
  var X = /* @__PURE__ */ function(e) {
255
258
  return e.panAndWheelZoom = "panAndWheelZoom", e.selectToZoom = "selectToZoom", e.selectRegion = "selectRegion", e;
256
259
  }(X || {});
257
- //#endregion
258
- //#region src/MulticlickSelectionTool.tsx
260
+ // src/MulticlickSelectionTool.tsx
259
261
  function Mt(e) {
260
- let { id: t = "MulticlickSelection", minPoints: n = 2, maxPoints: r = n, maxMovement: i = 1, modifierKey: a, disabled: o, transform: s = (e) => e, validate: c = () => !0, onSelectionStart: l, onSelectionChange: u, onSelectionEnd: d, onValidSelection: f, children: p } = e;
262
+ let { id: t = "MulticlickSelection", minPoints: n = 2, maxPoints: i = n, maxMovement: o = 1, modifierKey: l, disabled: u, transform: d = (e) => e, validate: f = () => !0, onSelectionStart: p, onSelectionChange: m, onSelectionEnd: h, onValidSelection: g, children: _ } = e;
261
263
  if (n < 1) throw RangeError(`minPoints must be >= 1, ${n}`);
262
- if (r < n && r !== -1) throw RangeError(`maxPoints must be -1 or >= minPoints, ${r} cf ${n}`);
263
- let m = xe(l), h = xe(u), g = xe(d), _ = xe(f), v = ge((e) => e.camera), y = se(), { canvasBox: x, htmlToWorld: S, worldToData: C } = y, [w, T] = be(), E = V(null), D = V(!0), O = V(!1), k = V(!1), A = oe(a), ee = ae(t, {
264
- button: b.Left,
265
- modifierKey: a,
266
- disabled: o
267
- }), j = R((e) => {
268
- let t = e.map((e) => S(v, e)), n = t.map(C);
269
- T({
264
+ if (i < n && i !== -1) throw RangeError(`maxPoints must be -1 or >= minPoints, ${i} cf ${n}`);
265
+ let v = ye(p), y = ye(m), b = ye(h), x = ye(g), S = me((e) => e.camera), C = ce(), { canvasBox: w, htmlToWorld: T, worldToData: E } = C, [D, O] = ve(), A = c(null), j = c(!0), M = c(!1), N = c(!1), P = oe(l), F = ae(t, {
266
+ button: k.Left,
267
+ modifierKey: l,
268
+ disabled: u
269
+ }), I = r((e) => {
270
+ let t = e.map((e) => T(S, e)), n = t.map(E);
271
+ O({
270
272
  html: e,
271
273
  world: t,
272
274
  data: n
273
275
  });
274
276
  }, [
275
- v,
276
277
  S,
277
278
  T,
278
- C
279
- ]), te = R((e, t, n) => {
280
- D.current ? (E.current = [n], O.current = !1, e.setPointerCapture(t), r === 1 && j([n])) : D.current = !0;
281
- }, [r, j]), ne = R((e, t, n, r) => {
282
- e.releasePointerCapture(t), D.current = !n, k.current = r, E.current = null;
279
+ O,
280
+ E
281
+ ]), L = r((e, t, n) => {
282
+ j.current ? (A.current = [n], M.current = !1, e.setPointerCapture(t), i === 1 && I([n])) : j.current = !0;
283
+ }, [i, I]), R = r((e, t, n, r) => {
284
+ e.releasePointerCapture(t), j.current = !n, N.current = r, A.current = null;
283
285
  }, []);
284
- function M(e) {
285
- let { sourceEvent: t } = e, a = t.type === "pointerdown", o = ee(t);
286
- if (a && !o) return;
287
- let { target: s, pointerId: c } = t, l = s, u = E.current, d = x.clampPoint(e.htmlPt);
286
+ function z(e) {
287
+ let { sourceEvent: t } = e, r = t.type === "pointerdown", a = F(t);
288
+ if (r && !a) return;
289
+ let { target: s, pointerId: c } = t, l = s, u = A.current, d = w.clampPoint(e.htmlPt);
288
290
  if (u === null) {
289
- te(l, c, d);
291
+ L(l, c, d);
290
292
  return;
291
293
  }
292
294
  let f = u.length, p = !1;
293
- if (D.current) {
295
+ if (j.current) {
294
296
  let e = u[f - 1];
295
- (f === 1 ? 0 : Math.max(Math.abs(e.x - d.x), Math.abs(e.y - d.y))) <= i ? p = a && O.current : (u.push(d), D.current = !1);
296
- } else D.current = !0;
297
- (p || f >= n && r > 0 && f === r) && (T(void 0), ne(l, c, a, o));
297
+ (f === 1 ? 0 : Math.max(Math.abs(e.x - d.x), Math.abs(e.y - d.y))) <= o ? p = r && M.current : (u.push(d), j.current = !1);
298
+ } else j.current = !0;
299
+ (p || f >= n && i > 0 && f === i) && (O(void 0), R(l, c, r, a));
298
300
  }
299
- function N(e) {
300
- let t = E.current;
301
+ function ee(e) {
302
+ let t = A.current;
301
303
  if (t === null) return;
302
- let n = t.length, r = x.clampPoint(e.htmlPt);
303
- D.current ? (t.push(r), D.current = !1) : t[n - 1] = r, j([...t]);
304
+ let n = t.length, r = w.clampPoint(e.htmlPt);
305
+ j.current ? (t.push(r), j.current = !1) : t[n - 1] = r, I([...t]);
304
306
  }
305
- ie("pointerdown", M), ie("pointermove", N), ie("pointerup", M), ve("Escape", () => {
306
- E.current = null, T(void 0);
307
- }, [], { event: "keydown" }), ve("Enter", () => {
308
- O.current && (k.current = !0, E.current = null, T(void 0));
307
+ ie("pointerdown", z), ie("pointermove", ee), ie("pointerup", z), ge("Escape", () => {
308
+ A.current = null, O(void 0);
309
+ }, [], { event: "keydown" }), ge("Enter", () => {
310
+ M.current && (N.current = !0, A.current = null, O(void 0));
309
311
  }, [], { event: "keydown" });
310
- let P = B(() => w && s(w, v, y), [
311
- w,
312
- s,
313
- v,
314
- y
315
- ]), F = !!P && c(P);
316
- z(() => {
317
- if (F) {
318
- let e = P.html.length;
319
- O.current = e >= n;
312
+ let B = s(() => D && d(D, S, C), [
313
+ D,
314
+ d,
315
+ S,
316
+ C
317
+ ]), V = !!B && f(B);
318
+ a(() => {
319
+ if (V) {
320
+ let e = B.html.length;
321
+ M.current = e >= n;
320
322
  }
321
323
  }, [
322
- O,
323
- F,
324
+ M,
325
+ V,
324
326
  n,
325
- P
327
+ B
326
328
  ]);
327
- let ce = ye(P), I = ye(F);
328
- return z(() => {
329
- P ? (re(w), ce || m.current?.(), h.current?.(A ? P : void 0, w, F)) : ce && (re(I), g.current?.(k.current ? ce : void 0, I), I && k.current && _.current?.(ce), k.current = !1);
329
+ let H = _e(B), te = _e(V);
330
+ return a(() => {
331
+ B ? (re(D), H || v.current?.(), y.current?.(P ? B : void 0, D, V)) : H && (re(te), b.current?.(N.current ? H : void 0, te), te && N.current && x.current?.(H), N.current = !1);
330
332
  }, [
333
+ B,
334
+ H,
335
+ D,
336
+ V,
337
+ te,
331
338
  P,
332
- ce,
333
- w,
334
- F,
335
- I,
336
- A,
337
- m,
338
- h,
339
- g,
340
- _
341
- ]), !P || !A ? null : (re(w), /* @__PURE__ */ K(G, { children: p(P, w, F, O) }));
339
+ v,
340
+ y,
341
+ b,
342
+ x
343
+ ]), !B || !P ? null : (re(D), /* @__PURE__ */ J(q, { children: _(B, D, V, M) }));
342
344
  }
343
345
  function Nt(e) {
344
- let { n: t, nx: n, ny: r, i, drag: a, ...o } = e, s = B(() => ({
346
+ let { n: t, nx: n, ny: r, i, drag: a, ...o } = e, c = s(() => ({
345
347
  onPointerMove: a?.dragMove,
346
348
  onPointerUp: a && ((e) => {
347
349
  e.stopPropagation(), e.target.releasePointerCapture(e.pointerId), a.dragEnd(e);
@@ -349,27 +351,27 @@ function Nt(e) {
349
351
  onPointerDown: a && ((e) => {
350
352
  e.stopPropagation(), e.target.setPointerCapture(e.pointerId), a.dragStart(e);
351
353
  })
352
- }), [a]), c = B(() => {
354
+ }), [a]), l = s(() => {
353
355
  if ("ref" in o) {
354
356
  let { ref: e, ...t } = o;
355
357
  return t;
356
358
  }
357
359
  return o;
358
360
  }, [o]);
359
- return /* @__PURE__ */ q("g", {
361
+ return /* @__PURE__ */ Y("g", {
360
362
  transform: `translate(${a?.dx ?? 0}, ${a?.dy ?? 0})`,
361
363
  style: { cursor: a ? "move" : void 0 },
362
- ...s,
363
- children: [/* @__PURE__ */ K("circle", {
364
+ ...c,
365
+ children: [/* @__PURE__ */ J("circle", {
364
366
  cx: n,
365
367
  cy: r,
366
368
  r: 8,
367
369
  pointerEvents: "visibleFill",
368
- ...c,
370
+ ...l,
369
371
  fill: a?.isDragging ? "white" : "transparent",
370
372
  fillOpacity: a?.isDragging ? .3 : 1,
371
373
  strokeWidth: 1
372
- }, `${t}-handle-${i}`), /* @__PURE__ */ K("circle", {
374
+ }, `${t}-handle-${i}`), /* @__PURE__ */ J("circle", {
373
375
  cx: n,
374
376
  cy: r,
375
377
  r: 16,
@@ -388,7 +390,7 @@ function Pt(e) {
388
390
  yMin: a,
389
391
  yMax: a,
390
392
  ...u
391
- }), /* @__PURE__ */ K(Ce, {
393
+ }), /* @__PURE__ */ J(xe, {
392
394
  width: n.width,
393
395
  height: n.height,
394
396
  x: i,
@@ -401,7 +403,7 @@ function Pt(e) {
401
403
  console.debug("DE:", e, t, "; delta:", n, i, "; drag:", a), o?.(r, [(e ?? 0) + n, (t ?? 0) + i], !1);
402
404
  },
403
405
  restrict: u,
404
- children: (e) => /* @__PURE__ */ K(Nt, {
406
+ children: (e) => /* @__PURE__ */ J(Nt, {
405
407
  n: t,
406
408
  i: r,
407
409
  nx: i,
@@ -411,26 +413,25 @@ function Pt(e) {
411
413
  })
412
414
  });
413
415
  }
414
- //#endregion
415
- //#region src/shapes/DvdAxisBox.tsx
416
+ // src/shapes/DvdAxisBox.tsx
416
417
  function Ft(e) {
417
- let { size: t, coords: n, isFixed: r, axis: i, onHandleChange: a, ...o } = e, s = [n[0].getComponent(i), n[1].getComponent(i)], c = Math.min(s[0], s[1]), l = Math.max(s[0], s[1]), u;
418
- u = i === 0 ? [
419
- new W(c, t.height),
420
- new W(c, 0),
421
- new W(l, 0),
422
- new W(l, t.height),
423
- new W((c + l) / 2, t.height / 2)
418
+ let { size: t, coords: n, isFixed: r, axis: i, onHandleChange: a, ...o } = e, c = [n[0].getComponent(i), n[1].getComponent(i)], l = Math.min(c[0], c[1]), u = Math.max(c[0], c[1]), d;
419
+ d = i === 0 ? [
420
+ new K(l, t.height),
421
+ new K(l, 0),
422
+ new K(u, 0),
423
+ new K(u, t.height),
424
+ new K((l + u) / 2, t.height / 2)
424
425
  ] : [
425
- new W(0, l),
426
- new W(t.width, l),
427
- new W(t.width, c),
428
- new W(0, c),
429
- new W(t.width / 2, (c + l) / 2)
426
+ new K(0, u),
427
+ new K(t.width, u),
428
+ new K(t.width, l),
429
+ new K(0, l),
430
+ new K(t.width / 2, (l + u) / 2)
430
431
  ];
431
- let d = B(() => u.map((e, n) => {
432
+ let f = s(() => d.map((e, n) => {
432
433
  let r = `'axisbox-drag-${n}`;
433
- return /* @__PURE__ */ K(Pt, {
434
+ return /* @__PURE__ */ J(Pt, {
434
435
  name: r,
435
436
  size: t,
436
437
  i: n,
@@ -442,64 +443,63 @@ function Ft(e) {
442
443
  ...o
443
444
  }, r);
444
445
  }), [
445
- u,
446
+ d,
446
447
  t,
447
448
  a,
448
449
  i,
449
450
  o
450
451
  ]);
451
- u.pop();
452
- let f = B(() => u.map((e) => `${e.x},${e.y}`).join(" "), [u]);
453
- return /* @__PURE__ */ q(G, { children: [
454
- /* @__PURE__ */ K("polygon", {
455
- points: f,
452
+ d.pop();
453
+ let p = s(() => d.map((e) => `${e.x},${e.y}`).join(" "), [d]);
454
+ return /* @__PURE__ */ Y(q, { children: [
455
+ /* @__PURE__ */ J("polygon", {
456
+ points: p,
456
457
  ...o,
457
458
  stroke: "none"
458
459
  }),
459
- !r && d,
460
- i === 0 && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K("line", {
461
- x1: c,
460
+ !r && f,
461
+ i === 0 && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("line", {
462
+ x1: l,
462
463
  y1: 0,
463
- x2: c,
464
+ x2: l,
464
465
  y2: t.height,
465
466
  stroke: o.fill,
466
467
  strokeDasharray: o.strokeDasharray
467
- }), /* @__PURE__ */ K("line", {
468
- x1: l,
468
+ }), /* @__PURE__ */ J("line", {
469
+ x1: u,
469
470
  y1: 0,
470
- x2: l,
471
+ x2: u,
471
472
  y2: t.height,
472
473
  stroke: o.fill,
473
474
  strokeDasharray: o.strokeDasharray
474
475
  })] }),
475
- i !== 0 && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K("line", {
476
+ i !== 0 && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("line", {
476
477
  x1: 0,
477
- y1: c,
478
+ y1: l,
478
479
  x2: t.width,
479
- y2: c,
480
+ y2: l,
480
481
  stroke: o.fill,
481
482
  strokeDasharray: o.strokeDasharray
482
- }), /* @__PURE__ */ K("line", {
483
+ }), /* @__PURE__ */ J("line", {
483
484
  x1: 0,
484
- y1: l,
485
+ y1: u,
485
486
  x2: t.width,
486
- y2: l,
487
+ y2: u,
487
488
  stroke: o.fill,
488
489
  strokeDasharray: o.strokeDasharray
489
490
  })] })
490
491
  ] });
491
492
  }
492
- //#endregion
493
- //#region src/shapes/DvdPolyline.tsx
494
- var It = 10, Lt = 20, Rt = new U().identity().rotate(Math.PI / 2).multiplyScalar(Math.sin(Math.PI / 3));
493
+ // src/shapes/DvdPolyline.tsx
494
+ var It = 10, Lt = 20, Rt = new G().identity().rotate(Math.PI / 2).multiplyScalar(Math.sin(Math.PI / 3));
495
495
  function zt(e, t) {
496
- let n = new W().subVectors(t, e), r = Math.hypot(n.x, n.y), i = n.clone().multiplyScalar(.5 + Lt / r);
496
+ let n = new K().subVectors(t, e), r = Math.hypot(n.x, n.y), i = n.clone().multiplyScalar(.5 + Lt / r);
497
497
  n.multiplyScalar(It / r);
498
498
  let a, o;
499
499
  if (r > 40) {
500
- let t = new W().addVectors(e, i);
501
- a = new W().subVectors(t, n), o = t.add(n);
502
- } else a = t, o = new W().addVectors(t, n);
500
+ let t = new K().addVectors(e, i);
501
+ a = new K().subVectors(t, n), o = t.add(n);
502
+ } else a = t, o = new K().addVectors(t, n);
503
503
  let s = n.applyMatrix3(Rt).add(a);
504
504
  return [
505
505
  a,
@@ -508,9 +508,9 @@ function zt(e, t) {
508
508
  ].map((e) => `${e.x},${e.y}`).join(" ");
509
509
  }
510
510
  function Bt(e) {
511
- let { size: t, coords: n, isClosed: r = !1, isFixed: i, onHandleChange: a, ...o } = e, s = n.slice(0, -1), c = B(() => n.map((e, n) => {
511
+ let { size: t, coords: n, isClosed: r = !1, isFixed: i, onHandleChange: a, ...o } = e, c = n.slice(0, -1), l = s(() => n.map((e, n) => {
512
512
  let i = `${r ? "polygon" : "polyline"}-drag-${n}`;
513
- return /* @__PURE__ */ K(Pt, {
513
+ return /* @__PURE__ */ J(Pt, {
514
514
  name: i,
515
515
  size: t,
516
516
  i: n,
@@ -525,26 +525,25 @@ function Bt(e) {
525
525
  t,
526
526
  a,
527
527
  o
528
- ]), l = B(() => s.map((e) => `${e.x},${e.y}`).join(" "), [s]), u = B(() => zt(n[0], n[1]), [n]);
529
- return /* @__PURE__ */ q(G, { children: [
530
- r ? /* @__PURE__ */ K("polygon", {
531
- points: l,
528
+ ]), u = s(() => c.map((e) => `${e.x},${e.y}`).join(" "), [c]), d = s(() => zt(n[0], n[1]), [n]);
529
+ return /* @__PURE__ */ Y(q, { children: [
530
+ r ? /* @__PURE__ */ J("polygon", {
531
+ points: u,
532
532
  ...o
533
- }) : /* @__PURE__ */ K("polyline", {
534
- points: l,
533
+ }) : /* @__PURE__ */ J("polyline", {
534
+ points: u,
535
535
  ...o,
536
536
  fill: "none"
537
537
  }),
538
- /* @__PURE__ */ K("polygon", {
539
- points: u,
538
+ /* @__PURE__ */ J("polygon", {
539
+ points: d,
540
540
  ...o,
541
541
  fill: o.stroke
542
542
  }),
543
- !i && c
543
+ !i && l
544
544
  ] });
545
545
  }
546
- //#endregion
547
- //#region src/selections/BaseSelection.tsx
546
+ // src/selections/BaseSelection.tsx
548
547
  var Vt = class e {
549
548
  id;
550
549
  name = "";
@@ -552,11 +551,12 @@ var Vt = class e {
552
551
  colour;
553
552
  alpha = .3;
554
553
  fixed = !1;
554
+ permanent = !1;
555
555
  start;
556
556
  _asDashed;
557
557
  _vStart;
558
558
  constructor(e) {
559
- this.id = crypto.randomUUID().slice(-8), this.start = e, this._vStart = new W(...e);
559
+ this.id = crypto.randomUUID().slice(-8), this.start = e, this._vStart = new K(...e);
560
560
  }
561
561
  toString() {
562
562
  return "";
@@ -568,7 +568,7 @@ var Vt = class e {
568
568
  return [this._vStart.clone()];
569
569
  }
570
570
  setProperties(e) {
571
- this.id = e.id, this.name = e.name, this.colour = e.colour, this.alpha = e.alpha, this._asDashed = e._asDashed, this.fixed = e.fixed;
571
+ this.id = e.id, this.name = e.name, this.colour = e.colour, this.alpha = e.alpha, this._asDashed = e._asDashed, this.fixed = e.fixed, this.permanent = e.permanent;
572
572
  }
573
573
  static createFromSelection(t) {
574
574
  let n = new e([...t.start]);
@@ -594,7 +594,7 @@ var Vt = class e {
594
594
  super(e), this.length = t, this.dimension = n, this.colour = this._defaultColour;
595
595
  }
596
596
  _getPoint(e = 1) {
597
- let t = new W(0, 0, 1);
597
+ let t = new K(0, 0, 1);
598
598
  return t.setComponent(this.dimension, this.length * e), t.add(this._vStart);
599
599
  }
600
600
  getPoints() {
@@ -672,9 +672,9 @@ var Vt = class e {
672
672
  return "radii" in e;
673
673
  }
674
674
  static createFromPoints(t) {
675
- let n = t[0], r = Zt(new W().subVectors(t[1], n)), i = r[0], a = r[1], o = i, s = a;
675
+ let n = t[0], r = Zt(new K().subVectors(t[1], n)), i = r[0], a = r[1], o = i, s = a;
676
676
  if (t.length > 2) {
677
- let e = Zt(new W().subVectors(t[2], n));
677
+ let e = Zt(new K().subVectors(t[2], n));
678
678
  o = e[0], s = e[1];
679
679
  }
680
680
  let c = i < o ? [i, o] : [o, i], l = a < s ? [a, s] : [s, a];
@@ -689,10 +689,10 @@ var Vt = class e {
689
689
  _transform;
690
690
  _invTransform;
691
691
  constructor(e, t = 0) {
692
- super(e), this.angle = t, this._transform = new U().identity().rotate(-this.angle), this._invTransform = new U().identity().rotate(this.angle);
692
+ super(e), this.angle = t, this._transform = new G().identity().rotate(-this.angle), this._invTransform = new G().identity().rotate(this.angle);
693
693
  }
694
694
  setAngle(e) {
695
- this.angle = e, this._transform = new U().identity().rotate(-this.angle), this._invTransform = new U().identity().rotate(this.angle);
695
+ this.angle = e, this._transform = new G().identity().rotate(-this.angle), this._invTransform = new G().identity().rotate(this.angle);
696
696
  }
697
697
  static isShape(e) {
698
698
  return "_transform" in e;
@@ -710,9 +710,9 @@ var Vt = class e {
710
710
  return "semiAxes" in e;
711
711
  }
712
712
  static createFromPoints(t) {
713
- let n = t[0], r = new W().subVectors(t[1], n);
713
+ let n = t[0], r = new K().subVectors(t[1], n);
714
714
  if (t.length < 3) return new e([n.x, n.y], [Math.abs(r.x), Math.abs(r.y)]);
715
- let i = Zt(r), a = i[0], o = new W().subVectors(t[2], n), s = Math.hypot(o.x, o.y), c = a < s ? [a, s] : [s, a];
715
+ let i = Zt(r), a = i[0], o = new K().subVectors(t[2], n), s = Math.hypot(o.x, o.y), c = a < s ? [a, s] : [s, a];
716
716
  return new e([n.x, n.y], c, i[1]);
717
717
  }
718
718
  static createFromSelection(t) {
@@ -726,7 +726,7 @@ var Vt = class e {
726
726
  super(e, n), this.length = t, this.colour = this._defaultColour;
727
727
  }
728
728
  _getPoint(e = 1) {
729
- return new W(this.length * e, 0, 1).applyMatrix3(this._transform).add(this._vStart);
729
+ return new K(this.length * e, 0, 1).applyMatrix3(this._transform).add(this._vStart);
730
730
  }
731
731
  getPoints() {
732
732
  return [
@@ -748,7 +748,7 @@ var Vt = class e {
748
748
  _setFromPoints(e) {
749
749
  let t = e[0];
750
750
  this.start = [t.x, t.y], this._vStart.x = t.x, this._vStart.y = t.y;
751
- let n = Zt(new W().subVectors(e[1], t));
751
+ let n = Zt(new K().subVectors(e[1], t));
752
752
  this.length = n[0], this.setAngle(n[1]);
753
753
  }
754
754
  static createFromPoints(t) {
@@ -782,7 +782,7 @@ var Vt = class e {
782
782
  super(e[0]), this.points = e, this.closed = !!t, this.colour = this.closed ? this._defaultClosedColour : this._defaultOpenColour;
783
783
  }
784
784
  getPoints() {
785
- let e = this.points.map((e) => new W(...e)), t = new W();
785
+ let e = this.points.map((e) => new K(...e)), t = new K();
786
786
  return e.forEach((e) => {
787
787
  t.add(e);
788
788
  }), t.divideScalar(e.length), [...e, t];
@@ -791,12 +791,12 @@ var Vt = class e {
791
791
  let t = this.points.length;
792
792
  if (e < t) {
793
793
  let t = this.points[e];
794
- return new W(t[0], t[1]);
794
+ return new K(t[0], t[1]);
795
795
  }
796
796
  if (e == t) {
797
- let e = new W();
797
+ let e = new K();
798
798
  return this.points.forEach((t) => {
799
- e.add(new W(t[0], t[1]));
799
+ e.add(new K(t[0], t[1]));
800
800
  }), e.divideScalar(t), e;
801
801
  }
802
802
  return null;
@@ -849,19 +849,19 @@ var Vt = class e {
849
849
  let t = null;
850
850
  switch (e) {
851
851
  case 0:
852
- t = new W(0, 0, 1);
852
+ t = new K(0, 0, 1);
853
853
  break;
854
854
  case 1:
855
- t = new W(this.lengths[0], 0, 1);
855
+ t = new K(this.lengths[0], 0, 1);
856
856
  break;
857
857
  case 2:
858
- t = new W(...this.lengths, 1);
858
+ t = new K(...this.lengths, 1);
859
859
  break;
860
860
  case 3:
861
- t = new W(0, this.lengths[1], 1);
861
+ t = new K(0, this.lengths[1], 1);
862
862
  break;
863
863
  case 4:
864
- t = new W(this.lengths[0] * .5, this.lengths[1] * .5, 1);
864
+ t = new K(this.lengths[0] * .5, this.lengths[1] * .5, 1);
865
865
  break;
866
866
  default: return null;
867
867
  }
@@ -879,7 +879,7 @@ var Vt = class e {
879
879
  return "lengths" in e;
880
880
  }
881
881
  static createFromPoints(t, n) {
882
- let r = n[0].clone(), i = new W().subVectors(n[1], r), a = 0, o = i.x, s = i.y;
882
+ let r = n[0].clone(), i = new K().subVectors(n[1], r), a = 0, o = i.x, s = i.y;
883
883
  return o < 0 === t[0] ? s < 0 !== t[1] && (a = -Math.PI / 2, i.y = i.x, i.x = -s) : (i.x = -o, s < 0 === t[1] ? (a = Math.PI / 2, i.y = i.x, i.x = s) : (a = Math.PI, i.y = -s)), new e([r.x, r.y], [i.x, i.y], a);
884
884
  }
885
885
  static createFromSelection(t) {
@@ -891,21 +891,21 @@ var Vt = class e {
891
891
  if (i !== null) {
892
892
  let e = n[0] ?? 0, a = n[1] ?? 0;
893
893
  if (t === 4) {
894
- let t = new W(e, a).sub(i), n = r._vStart;
894
+ let t = new K(e, a).sub(i), n = r._vStart;
895
895
  return n.x += t.x, n.y += t.y, r.start[0] = n.x, r.start[1] = n.y, r;
896
896
  }
897
- let o = new W(e, a).sub(i).applyMatrix3(this._invTransform), [s, c] = r.lengths, l, u;
897
+ let o = new K(e, a).sub(i).applyMatrix3(this._invTransform), [s, c] = r.lengths, l, u;
898
898
  t === 2 ? (l = Math.max(0, s + o.x), u = Math.max(0, c + o.y)) : (l = Math.max(0, s - o.x), u = Math.max(0, c - o.y));
899
899
  let d;
900
900
  switch (t) {
901
901
  case 0:
902
- d = new W(s - l, c - u);
902
+ d = new K(s - l, c - u);
903
903
  break;
904
904
  case 1:
905
- d = new W(0, c - u), l = Math.max(0, s + o.x);
905
+ d = new K(0, c - u), l = Math.max(0, s + o.x);
906
906
  break;
907
907
  case 2: break;
908
- case 3: d = new W(s - l), u = Math.max(0, c + o.y);
908
+ case 3: d = new K(s - l), u = Math.max(0, c + o.y);
909
909
  }
910
910
  d !== void 0 && (d.applyMatrix3(this._transform).add(this._vStart), r.start[0] = d.x, r.start[1] = d.y, r._vStart.x = d.x, r._vStart.y = d.y), r.lengths[0] = l, r.lengths[1] = u;
911
911
  }
@@ -975,7 +975,7 @@ function an(e, t, n, r, i, a, o, s) {
975
975
  };
976
976
  switch (e) {
977
977
  case "rectangle":
978
- case "polygon": return /* @__PURE__ */ K(A, { children: /* @__PURE__ */ K(Bt, {
978
+ case "polygon": return /* @__PURE__ */ J(z, { children: /* @__PURE__ */ J(Bt, {
979
979
  size: r,
980
980
  coords: t,
981
981
  isClosed: !0,
@@ -985,7 +985,7 @@ function an(e, t, n, r, i, a, o, s) {
985
985
  ...c
986
986
  }) });
987
987
  case "horizontalAxis":
988
- case "verticalAxis": return /* @__PURE__ */ K(A, { children: /* @__PURE__ */ K(Ft, {
988
+ case "verticalAxis": return /* @__PURE__ */ J(z, { children: /* @__PURE__ */ J(Ft, {
989
989
  size: r,
990
990
  coords: t,
991
991
  strokeDasharray: a ? "10, 10" : void 0,
@@ -995,7 +995,7 @@ function an(e, t, n, r, i, a, o, s) {
995
995
  ...c
996
996
  }) });
997
997
  case "line":
998
- case "polyline": return /* @__PURE__ */ K(A, { children: /* @__PURE__ */ K(Bt, {
998
+ case "polyline": return /* @__PURE__ */ J(z, { children: /* @__PURE__ */ J(Bt, {
999
999
  size: r,
1000
1000
  coords: t,
1001
1001
  strokeDasharray: a ? "10, 10" : void 0,
@@ -1011,29 +1011,27 @@ function on(e, t, n, r, i, a) {
1011
1011
  return an(e, o.getPoints(), r, i, a ?? o.colour ?? o._defaultColour, void 0, !0);
1012
1012
  }
1013
1013
  function sn(e) {
1014
- let { size: t, selection: n, updateSelection: r, showHandles: i } = e, a = Qt(n), { htmlToData: o } = se(), s = ge((e) => e.camera), c = R((e, t) => {
1015
- let n = o(s, new W(e, t));
1014
+ let { size: t, selection: n, updateSelection: i, showHandles: a } = e, o = Qt(n), { htmlToData: s } = ce(), c = me((e) => e.camera), l = r((e, t) => {
1015
+ let n = s(c, new K(e, t));
1016
1016
  return [n.x, n.y];
1017
- }, [o, s]), l = R((e) => {
1017
+ }, [s, c]), u = r((e) => {
1018
1018
  let t = e.onHandleChange.bind(e);
1019
- return (e, n, i = !0) => {
1020
- let a = c(n[0], n[1]);
1021
- console.debug("UH:", e, n, a);
1022
- let o = t(e, a);
1023
- return r(o, i), o;
1019
+ return (e, n, r = !0) => {
1020
+ let a = l(n[0], n[1]), o = t(e, a);
1021
+ return console.debug("UH:", e, n, a), i(o, r), o;
1024
1022
  };
1025
- }, [r, c]);
1026
- if (a !== "unknown") {
1023
+ }, [i, l]);
1024
+ if (o !== "unknown") {
1027
1025
  let e = n.getPoints();
1028
- return /* @__PURE__ */ K(u, {
1026
+ return /* @__PURE__ */ J(y, {
1029
1027
  points: e,
1030
- children: (...e) => an(a, e, n.alpha, t, n.colour ?? n._defaultColour, n._asDashed, n.fixed || !i, l(n))
1028
+ children: (...e) => an(o, e, n.alpha, t, n.colour ?? n._defaultColour, n._asDashed, n.fixed || !a, u(n))
1031
1029
  }, n.id);
1032
1030
  }
1033
1031
  return console.error("Unknown selection type or has no points getter", n), null;
1034
1032
  }
1035
1033
  function cn(e, t, n, r) {
1036
- return r && t.map((t) => /* @__PURE__ */ K(sn, {
1034
+ return r && t.map((t) => /* @__PURE__ */ J(sn, {
1037
1035
  size: e,
1038
1036
  selection: t,
1039
1037
  updateSelection: r,
@@ -1047,28 +1045,37 @@ function un(e, t, n) {
1047
1045
  return ln(e.find((e) => e.id === t) ?? null, n);
1048
1046
  }
1049
1047
  function dn(e, t) {
1050
- return n.fromPoints(...e).hasMinSize(t === "horizontalAxis" || t === "verticalAxis" ? 0 : 20);
1048
+ return d.fromPoints(...e).hasMinSize(t === "horizontalAxis" || t === "verticalAxis" ? 0 : 20);
1051
1049
  }
1052
1050
  var fn = /* @__PURE__ */ function(e) {
1053
1051
  return e.created = "created", e.removed = "removed", e.updated = "updated", e;
1054
1052
  }(fn || {});
1055
1053
  function pn(e, t) {
1056
- let [n, r] = H(e ?? []), i = V(!1), [a, o] = H(!0);
1054
+ let [n, i] = l(e ?? []), o = c(!1), [s, u] = l(!0), d = c(), f = (e) => {
1055
+ d.current = e;
1056
+ };
1057
+ a(() => {
1058
+ t !== void 0 && (d.current = t);
1059
+ }, [t, d]);
1060
+ let [p, m] = l(!0);
1057
1061
  return {
1058
1062
  selections: n,
1059
- setSelections: r,
1060
- isNewSelection: i,
1061
- updateSelection: R((e, n = !1, a = !1) => {
1062
- let o = null;
1063
- return e ? (o = e.id, a ? (console.debug("Clearing selection:", o), r((e) => e.filter((e) => e.id !== o)), t?.("removed", n, e)) : r((r) => {
1064
- let a = r.findIndex((e) => e.id === o);
1065
- if (i.current = a === -1, i.current) return t?.("created", n, e), [...r, e];
1066
- let s = [...r];
1067
- return console.debug("Replacing", s[a], "with", e), s[a] = e, t?.("updated", n, e), s;
1068
- })) : a && (console.debug("Clearing selections"), r([])), o;
1069
- }, [t]),
1070
- canSelect: a,
1071
- enableSelect: o
1063
+ setSelections: i,
1064
+ isNewSelection: o,
1065
+ updateSelection: r((e, t = !1, n = !1) => {
1066
+ let r = null;
1067
+ return e ? (r = e.id, n ? (console.debug("Clearing selection:", r), i((e) => e.filter((e) => e.id !== r)), d.current?.("removed", t, e)) : i((n) => {
1068
+ let i = n.findIndex((e) => e.id === r);
1069
+ if (o.current = i === -1, o.current) return d.current?.("created", t, e), [...n, e];
1070
+ let a = [...n];
1071
+ return console.debug("Replacing", a[i], "with", e), a[i] = e, d.current?.("updated", t, e), a;
1072
+ })) : n && (console.debug("Clearing selections"), i((e) => e.filter((e) => e.permanent))), r;
1073
+ }, [i]),
1074
+ canSelect: s,
1075
+ enableSelect: u,
1076
+ setSelectionsListener: f,
1077
+ editable: p,
1078
+ setEditable: m
1072
1079
  };
1073
1080
  }
1074
1081
  function mn(e) {
@@ -1077,197 +1084,248 @@ function mn(e) {
1077
1084
  function hn(e) {
1078
1085
  e._asDashed = !0;
1079
1086
  }
1080
- //#endregion
1081
- //#region src/SelectionComponent.tsx
1082
- function gn(e) {
1083
- let { disabled: t = !1, selectionMax: n = 0, selectionType: r = Z.rectangle, selections: i = [], updateSelection: a, batonProps: o } = e, s = .3, { canvasBox: c, dataToHtml: l } = se(), u = c.size, d = B(() => {
1084
- if (a != null) return cn(u, i, o?.hasBaton ?? !0, a);
1085
- }, [
1086
- u,
1087
- i,
1088
- a,
1089
- o?.hasBaton
1090
- ]), f = ge((e) => e.camera), p = B(() => {
1091
- let e = l(f, new W(0, 0)), t = l(f, new W(1, 1)).sub(e);
1092
- return [t.x < 0, t.y < 0];
1093
- }, [f, l]), m = B(() => n !== 0 && i.reduce((e, t) => e + +(Qt(t) === r), 0) >= n, [
1094
- n,
1095
- r,
1096
- i
1097
- ]), h = B(() => nn(r), [r]);
1098
- return /* @__PURE__ */ q(G, { children: [a && (o?.hasBaton ?? !0) && !t && !m && /* @__PURE__ */ K(Mt, {
1099
- modifierKey: e.modifierKey,
1100
- validate: ({ html: e }) => dn(e, r),
1101
- onValidSelection: ({ data: e }) => {
1102
- let t = rn(i, r, e, s);
1103
- return a(t);
1104
- },
1105
- minPoints: h[0],
1106
- maxPoints: h[1],
1107
- children: ({ html: e }, t, n) => on(r, e, p, s, u, n ? void 0 : "#cc6677")
1108
- }), d] });
1109
- }
1110
- //#endregion
1111
- //#region src/models.ts
1112
- var _n = {
1087
+ // src/models.ts
1088
+ var gn = {
1113
1089
  uuid: "",
1114
1090
  batonUuid: "",
1115
1091
  others: [],
1116
1092
  hasBaton: !0,
1117
1093
  requestBaton: () => {},
1118
1094
  offerBaton: (e) => {}
1119
- }, vn = fe({});
1120
- function yn() {
1121
- return pe(vn);
1122
- }
1123
- var bn = [0, 1];
1124
- function xn(e) {
1125
- let [t, n] = Se(), [r, i] = H(""), [a, o] = H(X.panAndWheelZoom), [s, c] = H(Z.unknown), [l, u] = H(0), [d, f] = H([null, null]), [p, m] = H([null, null]), [h, g] = H(""), [_, v] = H(""), [y, b] = H(T.Linear), [x, S] = H(T.Linear), [C, w] = H([null, null]), [E, D] = H(T.Linear), [O, k] = H("equal"), [A, ee] = H("Greys"), [j, te] = Se(), [ne, M] = Se(), [N, re] = H(/* @__PURE__ */ new Map()), [P, ie] = H(null), [ae, oe] = H(), [F, se] = H(10), ce = R((e) => oe(() => e), [oe]);
1126
- if (e.plotConfig.title !== void 0 && e.plotConfig.title !== r && i(e.plotConfig.title), e.plotConfig.xLabel !== void 0 && e.plotConfig.xLabel !== h && g(e.plotConfig.xLabel), e.plotConfig.yLabel !== void 0 && e.plotConfig.yLabel !== _ && v(e.plotConfig.yLabel), e.plotConfig.xScale !== void 0 && e.plotConfig.xScale !== y && b(e.plotConfig.xScale), e.plotConfig.yScale !== void 0 && e.plotConfig.yScale !== x && S(e.plotConfig.yScale), s === Z.unknown) {
1127
- let [t, n] = Object.entries(e.selectionOptions ?? {})[0] ?? [];
1128
- t !== void 0 && n !== void 0 && (c(Xt(t)), u(n));
1129
- }
1130
- let I = R((t) => {
1131
- c(t);
1132
- let n = (e.selectionOptions ?? {})[t];
1133
- n !== void 0 && u(n);
1134
- }, [
1135
- c,
1136
- u,
1137
- e.selectionOptions
1138
- ]), le = B(() => e.batonProps ?? _n, [e.batonProps]), ue = B(() => e.xDomain ?? bn, [e.xDomain]), de = B(() => e.yDomain ?? bn, [e.yDomain]), L = B(() => e.domain ?? bn, [e.domain]), fe = "Line";
1139
- "values" in e ? fe = e.heatmapScale ? "Heatmap" : "Image" : "pointValues" in e ? fe = "Scatter" : "heightValues" in e && (fe = "Surface"), fe !== "Line" && (e.heatmapScale && e.heatmapScale !== E && D(e.heatmapScale), e.surfaceScale && e.surfaceScale !== E && D(e.surfaceScale), e.showPoints !== void 0 && e.showPoints !== ne && M(e.showPoints), e.aspect !== void 0 && e.aspect !== O && (console.log("Setting aspect", O, e.aspect), k(e.aspect)), e.colourMap !== void 0 && e.colourMap !== A && ee(e.colourMap));
1140
- let { selections: pe, updateSelection: z, setSelections: me, canSelect: V, enableSelect: U } = pn([], e.selectionsListener), W = fe === "Surface";
1141
- e.selections !== void 0 && e.selections !== pe && me(e.selections);
1142
- let he = B(() => {
1143
- if (W) U(!1);
1144
- else {
1145
- let t = e.updateSelection;
1146
- if (U(t !== null), t) return t;
1095
+ }, _n = n({ batonProps: gn });
1096
+ function vn() {
1097
+ return i(_n);
1098
+ }
1099
+ function yn(e) {
1100
+ let [t, n] = l(gn), r = {
1101
+ batonProps: t,
1102
+ setBatonProps: n
1103
+ };
1104
+ return /* @__PURE__ */ J(_n.Provider, {
1105
+ value: r,
1106
+ children: e.children
1107
+ });
1108
+ }
1109
+ // src/SelectionComponent.tsx
1110
+ function bn(e) {
1111
+ let { selectionMax: t = 0, selectionType: n = Z.rectangle, selections: r = [], updateSelection: i, modifierKey: a, disabled: o = !1 } = e, { batonProps: c } = vn(), l = c.hasBaton, u = .3, { canvasBox: d, dataToHtml: f } = ce(), p = d.size, m = s(() => cn(p, r, l, i), [
1112
+ p,
1113
+ r,
1114
+ i,
1115
+ l
1116
+ ]), h = me((e) => e.camera), g = s(() => {
1117
+ let e = f(h, new K(0, 0)), t = f(h, new K(1, 1)).sub(e);
1118
+ return [t.x < 0, t.y < 0];
1119
+ }, [h, f]), _ = s(() => t !== 0 && r.reduce((e, t) => e + +(Qt(t) === n), 0) >= t, [
1120
+ t,
1121
+ n,
1122
+ r
1123
+ ]), v = s(() => nn(n), [n]);
1124
+ return /* @__PURE__ */ Y(q, { children: [i && l && !o && !_ && /* @__PURE__ */ J(Mt, {
1125
+ modifierKey: a,
1126
+ validate: ({ html: e }) => dn(e, n),
1127
+ onValidSelection: ({ data: e }) => {
1128
+ let t = rn(r, n, e, u);
1129
+ return i(t);
1130
+ },
1131
+ minPoints: v[0],
1132
+ maxPoints: v[1],
1133
+ children: ({ html: e }, t, r) => on(n, e, g, u, p, r ? void 0 : "#cc6677")
1134
+ }), m] });
1135
+ }
1136
+ // src/PlotCustomizationContext.tsx
1137
+ var xn = n({});
1138
+ function Q() {
1139
+ return i(xn);
1140
+ }
1141
+ var Sn = [0, 1], Cn = [null, null];
1142
+ function wn(e) {
1143
+ let [t, n] = be(), [i, o] = l(""), [c, u] = l(X.panAndWheelZoom), [d, f] = l(Z.unknown), [p, m] = l(0), [h, g] = l(Cn), [_, v] = l(Cn), [y, b] = l(""), [x, S] = l(""), [C, w] = l(P.Linear), [T, E] = l(P.Linear), [D, O] = l(Sn), [k, A] = l(Sn), [j, M] = l(Sn), [N, F] = l(Cn), [I, L] = l(P.Linear), [R, z] = l("equal"), [ee, B] = l("Greys"), [V, H] = be(), [te, ne] = be(!1), [re, U] = l(/* @__PURE__ */ new Map()), [ie, ae] = l(null), [oe, se] = l(), [ce, le] = l(10), ue = r((e) => se(() => e), [se]), [W, de] = l();
1144
+ if (d === Z.unknown && W !== void 0 && W) {
1145
+ let [e, t] = Object.entries(W)[0];
1146
+ e !== void 0 && t !== void 0 && (f(Xt(e)), m(t));
1147
+ }
1148
+ let fe = r((e) => {
1149
+ if (f(e), W) {
1150
+ let t = W[e];
1151
+ t !== void 0 && m(t);
1147
1152
  }
1148
- return z;
1149
1153
  }, [
1150
- U,
1151
- W,
1152
- e.updateSelection,
1153
- z
1154
- ]);
1155
- fe === "Scatter" && e.pointSize !== void 0 && e.pointSize !== F && se(e.pointSize);
1156
- let ge = R((e, t) => {
1157
- let n = new Map(N);
1158
- n.set(e, { ...t }), re(n);
1159
- }, [N]), _e = B(() => ({
1154
+ f,
1155
+ m,
1156
+ W
1157
+ ]), [G, K] = l("Line"), { selections: pe, updateSelection: me, setSelections: he, canSelect: ge, enableSelect: _e, setSelectionsListener: ve, editable: ye, setEditable: q } = pn([]), [Y, xe] = l(), Se = (e) => {
1158
+ let { selections: t, canEditSelections: n, selectionsListener: r, selectionOptions: i } = e, a = !1;
1159
+ t !== void 0 && Y?.selections !== t && (he(t), a = !0), n !== void 0 && Y?.canEditSelections !== n && (q(n), a = !0), r !== void 0 && Y?.selectionsListener !== r && (ve(r), a = !0), i !== void 0 && Y?.selectionOptions !== i && (de(i), m(0), a = !0), a && xe(e);
1160
+ }, Ce = r((e, t) => {
1161
+ let n = new Map(re);
1162
+ n.set(e, { ...t }), U(n);
1163
+ }, [re]), [we, Te] = l(), Ee = (e, t, n) => {
1164
+ n !== void 0 && Ve(n);
1165
+ let r = !1;
1166
+ e !== void 0 && we?.xDomain !== e && (O(e), r = !0), t !== void 0 && we?.yDomain !== t && (A(t), r = !0), r && Te({
1167
+ xDomain: e,
1168
+ yDomain: t
1169
+ }), K("Line");
1170
+ }, [De, Oe] = l(), ke = (e, t) => {
1171
+ Ve(t);
1172
+ let n = e.aspect;
1173
+ n !== void 0 && De?.aspect !== n && (z(n), Oe({ aspect: n })), K("Image");
1174
+ }, [Ae, je] = l(), Me = (e, t) => {
1175
+ Ve(t);
1176
+ let { aspect: n, heatmapScale: r, colourMap: i, domain: a } = e, o = !1;
1177
+ n !== void 0 && Ae?.aspect !== e.aspect && (z(n), o = !0), r !== void 0 && Ae?.scale !== r && (L(r), o = !0), i !== void 0 && Ae?.colourMap !== i && (B(i), o = !0), a !== void 0 && Ae?.domain !== a && (M(a), o = !0), o && je({
1178
+ aspect: n,
1179
+ scale: r,
1180
+ colourMap: i,
1181
+ domain: a
1182
+ }), K("Heatmap");
1183
+ }, [Ne, Pe] = l(), Fe = (e, t) => {
1184
+ Ve(t);
1185
+ let { surfaceScale: n, colourMap: r, domain: i, showPoints: a } = e, o = !1;
1186
+ n !== void 0 && Ne?.scale !== n && (L(n), o = !0), r !== void 0 && Ne?.colourMap !== r && (B(r), o = !0), i !== void 0 && Ne?.domain !== i && (M(i), o = !0), a !== void 0 && Ne?.toggle !== a && (ne(), o = !0), o && Pe({
1187
+ scale: n,
1188
+ colourMap: r,
1189
+ domain: i,
1190
+ toggle: a
1191
+ }), K("Surface");
1192
+ }, [Ie, Le] = l(), Re = (e, t) => {
1193
+ Ve(t);
1194
+ let { colourMap: n, domain: r, pointSize: i } = e, a = !1;
1195
+ n !== void 0 && Ie?.colourMap !== n && (B(n), a = !0), r !== void 0 && Ie?.domain !== r && (M(r), a = !0), i !== void 0 && Ie?.pointSize !== i && (le(i), a = !0), a && Le({
1196
+ colourMap: n,
1197
+ domain: r,
1198
+ pointSize: i
1199
+ }), K("Scatter");
1200
+ }, [ze, Be] = l(), Ve = (e) => {
1201
+ let t = !1;
1202
+ e.title !== void 0 && ze?.title !== e.title && (o(e.title), t = !0), e.xLabel !== void 0 && ze?.xLabel !== e.xLabel && (b(e.xLabel), t = !0), e.yLabel !== void 0 && ze?.yLabel !== e.yLabel && (S(e.yLabel), t = !0), e.xScale !== void 0 && ze?.xScale !== e.xScale && (w(e.xScale), t = !0), e.yScale !== void 0 && ze?.yScale !== e.yScale && (E(e.yScale), t = !0), t && Be(e);
1203
+ };
1204
+ a(() => {
1205
+ _e(G !== "Surface");
1206
+ }, [_e, G]);
1207
+ let He = s(() => ({
1160
1208
  showGrid: t,
1161
1209
  toggleShowGrid: n,
1162
- title: r,
1163
- setTitle: i,
1164
- mode: a,
1165
- setMode: o,
1166
- xLabel: h,
1167
- setXLabel: g,
1168
- yLabel: _,
1169
- setYLabel: v,
1170
- batonProps: le,
1171
- xScaleType: y,
1172
- setXScaleType: b,
1173
- yScaleType: x,
1174
- setYScaleType: S,
1175
- xDomain: ue,
1176
- xCustomDomain: d,
1177
- setXCustomDomain: f,
1178
- yDomain: de,
1179
- yCustomDomain: p,
1180
- setYCustomDomain: m,
1181
- dDomain: L,
1182
- dCustomDomain: C,
1183
- setDCustomDomain: w,
1184
- selectionOptions: e.selectionOptions,
1185
- selectionMax: l,
1186
- selectionType: s,
1187
- setSelectionType: I,
1188
- histogramGetter: ae,
1189
- updateHistogramGetter: ce,
1210
+ title: i,
1211
+ setTitle: o,
1212
+ mode: c,
1213
+ setMode: u,
1214
+ xLabel: y,
1215
+ setXLabel: b,
1216
+ yLabel: x,
1217
+ setYLabel: S,
1218
+ xScaleType: C,
1219
+ setXScaleType: w,
1220
+ yScaleType: T,
1221
+ setYScaleType: E,
1222
+ xDomain: D,
1223
+ setXDomain: O,
1224
+ xCustomDomain: h,
1225
+ setXCustomDomain: g,
1226
+ yDomain: k,
1227
+ setYDomain: A,
1228
+ yCustomDomain: _,
1229
+ setYCustomDomain: v,
1230
+ dDomain: j,
1231
+ setDDomain: M,
1232
+ dCustomDomain: N,
1233
+ setDCustomDomain: F,
1234
+ selectionOptions: W,
1235
+ selectionMax: p,
1236
+ selectionType: d,
1237
+ setSelectionType: fe,
1238
+ setSelectionsListener: ve,
1239
+ histogramGetter: oe,
1240
+ updateHistogramGetter: ue,
1190
1241
  selections: pe,
1191
- setSelections: me,
1192
- updateSelection: he,
1193
- allLineParams: N,
1194
- setAllLineParams: re,
1195
- updateLineParams: ge,
1196
- currentLineKey: P,
1197
- setCurrentLineKey: ie,
1198
- aspect: O,
1199
- setAspect: k,
1200
- dScaleType: E,
1201
- setDScaleType: D,
1202
- colourMap: A,
1203
- setColourMap: ee,
1204
- invertColourMap: j,
1205
- toggleInvertColourMap: te,
1206
- scatterPointSize: F,
1207
- setScatterPointSize: se,
1208
- showPoints: ne,
1209
- toggleShowPoints: M,
1210
- canSelect: V,
1211
- plotType: fe
1242
+ setSelections: he,
1243
+ updateSelection: me,
1244
+ allLineParams: re,
1245
+ setAllLineParams: U,
1246
+ updateLineParams: Ce,
1247
+ currentLineKey: ie,
1248
+ setCurrentLineKey: ae,
1249
+ aspect: R,
1250
+ setAspect: z,
1251
+ dScaleType: I,
1252
+ setDScaleType: L,
1253
+ colourMap: ee,
1254
+ setColourMap: B,
1255
+ invertColourMap: V,
1256
+ toggleInvertColourMap: H,
1257
+ scatterPointSize: ce,
1258
+ setScatterPointSize: le,
1259
+ showPoints: te,
1260
+ toggleShowPoints: ne,
1261
+ canSelect: ge,
1262
+ canEditSelections: ye,
1263
+ plotType: G,
1264
+ updateLineContext: Ee,
1265
+ updateHeatmapContext: Me,
1266
+ updateImageContext: ke,
1267
+ updateScatterContext: Re,
1268
+ updateSurfaceContext: Fe,
1269
+ updateSelectionContext: Se
1212
1270
  }), [
1271
+ re,
1272
+ R,
1273
+ ge,
1274
+ ye,
1275
+ ee,
1276
+ ie,
1213
1277
  N,
1214
- O,
1215
- le,
1216
- V,
1217
- A,
1218
- P,
1219
- C,
1220
- L,
1221
- E,
1222
- ae,
1223
- ce,
1224
1278
  j,
1225
- a,
1226
- he,
1227
1279
  I,
1280
+ oe,
1281
+ ue,
1282
+ V,
1283
+ c,
1284
+ me,
1228
1285
  fe,
1229
- e.selectionOptions,
1230
- F,
1231
- l,
1232
- s,
1286
+ G,
1287
+ W,
1288
+ ve,
1289
+ ce,
1290
+ p,
1291
+ d,
1233
1292
  pe,
1234
- me,
1293
+ he,
1235
1294
  t,
1236
- ne,
1237
- r,
1238
1295
  te,
1296
+ i,
1297
+ H,
1239
1298
  n,
1240
- M,
1241
- ge,
1242
- d,
1243
- ue,
1299
+ ne,
1300
+ Ce,
1244
1301
  h,
1302
+ D,
1245
1303
  y,
1246
- p,
1247
- de,
1304
+ C,
1248
1305
  _,
1249
- x
1306
+ k,
1307
+ x,
1308
+ T
1250
1309
  ]);
1251
- return /* @__PURE__ */ K(vn.Provider, {
1252
- value: _e,
1310
+ return /* @__PURE__ */ J(xn.Provider, {
1311
+ value: He,
1253
1312
  children: e.children
1254
1313
  });
1255
1314
  }
1256
- var Sn = {
1315
+ var Tn = {
1257
1316
  top: "_top_cq7uz_1",
1258
1317
  error: "_error_cq7uz_6",
1259
1318
  label: "_label_cq7uz_14"
1260
1319
  };
1261
- //#endregion
1262
- //#region src/LabelledInput.tsx
1263
- function Q(e) {
1264
- let [t, n] = H(2), [r, i] = H(null), [a, o] = H(e.input), [s, c] = H(String(e.input)), l = e.submitLabel === void 0, u = e.resetButton !== !1, d = e.enableEnterKey !== !1, f = V(null), p = l && !d, m = p && t === 1 || !p && t === 0 || l && t === 1 || !l && t === 0;
1265
- function h(e) {
1320
+ // src/LabelledInput.tsx
1321
+ function $(e) {
1322
+ let [t, n] = l(2), [r, i] = l(null), [a, o] = l(e.input), [s, u] = l(String(e.input)), d = e.submitLabel === void 0, f = e.resetButton !== !1, p = e.enableEnterKey !== !1, m = c(null), h = d && !p, g = h && t === 1 || !h && t === 0 || d && t === 1 || !d && t === 0;
1323
+ function _(e) {
1266
1324
  n(0);
1267
1325
  let t = e.currentTarget.value;
1268
- c(t), p && g(t);
1326
+ u(t), h && v(t);
1269
1327
  }
1270
- function g(t) {
1328
+ function v(t) {
1271
1329
  if (n(0), e.isValid !== void 0) {
1272
1330
  let [r, c] = e.isValid(t ?? s);
1273
1331
  if (r) {
@@ -1280,49 +1338,49 @@ function Q(e) {
1280
1338
  e.updateValue(n), o(n), i(r);
1281
1339
  }
1282
1340
  }
1283
- let _ = (e) => {
1284
- d && e.key === "Enter" && g(f.current?.value);
1341
+ let y = (e) => {
1342
+ p && e.key === "Enter" && v(m.current?.value);
1285
1343
  };
1286
- function v() {
1344
+ function b() {
1287
1345
  n(0), console.log("previous value is ", r), r !== null && (n(2), e.updateValue(r), o(r), console.log("setting value, ", r));
1288
1346
  }
1289
- return /* @__PURE__ */ K(G, { children: /* @__PURE__ */ q("div", {
1290
- className: Sn.top,
1347
+ return /* @__PURE__ */ J(q, { children: /* @__PURE__ */ Y("div", {
1348
+ className: Tn.top,
1291
1349
  children: [
1292
- t === 1 && /* @__PURE__ */ q("div", {
1293
- className: Sn.error,
1350
+ t === 1 && /* @__PURE__ */ Y("div", {
1351
+ className: Tn.error,
1294
1352
  children: [
1295
1353
  "\"",
1296
1354
  s,
1297
1355
  "\" is invalid"
1298
1356
  ]
1299
1357
  }),
1300
- /* @__PURE__ */ q("label", {
1301
- className: Sn.label,
1358
+ /* @__PURE__ */ Y("label", {
1359
+ className: Tn.label,
1302
1360
  htmlFor: "labelled-input",
1303
1361
  children: [e.label, ":"]
1304
1362
  }),
1305
- u && /* @__PURE__ */ K("button", {
1306
- onClick: v,
1363
+ f && /* @__PURE__ */ J("button", {
1364
+ onClick: b,
1307
1365
  disabled: e.disabled,
1308
- children: /* @__PURE__ */ K(Ve, {})
1366
+ children: /* @__PURE__ */ J(Re, {})
1309
1367
  }),
1310
- /* @__PURE__ */ K("input", {
1368
+ /* @__PURE__ */ J("input", {
1311
1369
  id: "labelled-input",
1312
- ref: f,
1313
- onChange: h,
1314
- onKeyDown: _,
1370
+ ref: m,
1371
+ onChange: _,
1372
+ onKeyDown: y,
1315
1373
  required: !0,
1316
- value: m ? s : String(typeof a == "number" && e.decimalPlaces ? a.toPrecision(e.decimalPlaces) : a),
1374
+ value: g ? s : String(typeof a == "number" && e.decimalPlaces ? a.toPrecision(e.decimalPlaces) : a),
1317
1375
  disabled: e.disabled,
1318
1376
  onBlur: () => {
1319
- g(f.current?.value);
1377
+ v(m.current?.value);
1320
1378
  },
1321
1379
  ...e.inputAttribs
1322
1380
  }),
1323
- !l && /* @__PURE__ */ K("button", {
1381
+ !d && /* @__PURE__ */ J("button", {
1324
1382
  onClick: () => {
1325
- g(void 0);
1383
+ v(void 0);
1326
1384
  },
1327
1385
  disabled: e.disabled,
1328
1386
  children: e.submitLabel
@@ -1330,128 +1388,126 @@ function Q(e) {
1330
1388
  ]
1331
1389
  }) });
1332
1390
  }
1333
- var $ = {
1334
- modal: "_modal_ftojl_1",
1335
- modal_content: "_modal_content_ftojl_7",
1336
- modal_header: "_modal_header_ftojl_16",
1337
- modal_footer: "_modal_footer_ftojl_17",
1338
- modal_title: "_modal_title_ftojl_22",
1339
- modal_body: "_modal_body_ftojl_26",
1340
- close_button: "_close_button_ftojl_32",
1341
- aspect: "_aspect_ftojl_38",
1342
- btn: "_btn_ftojl_44"
1391
+ var En = {
1392
+ modal: "_modal_1tg1a_1",
1393
+ modal_content: "_modal_content_1tg1a_7",
1394
+ modal_header: "_modal_header_1tg1a_16",
1395
+ modal_footer: "_modal_footer_1tg1a_17",
1396
+ modal_title: "_modal_title_1tg1a_22",
1397
+ modal_body: "_modal_body_1tg1a_26",
1398
+ close_button: "_close_button_1tg1a_36",
1399
+ aspect: "_aspect_1tg1a_42",
1400
+ btn: "_btn_1tg1a_48"
1343
1401
  };
1344
- //#endregion
1345
- //#region src/Modal.tsx
1346
- function Cn(e) {
1347
- let { title: t, hideToggle: n = !1 } = e, r = V(null), [i, a] = H(!1);
1348
- _e(r, (e) => {
1402
+ // src/Modal.tsx
1403
+ function Dn(e) {
1404
+ let { title: n, hideToggle: r = !1 } = e, i = c(null), [a, o] = l(!1);
1405
+ he(i, (e) => {
1349
1406
  e.stopPropagation();
1350
- }), ve("Escape", () => {
1351
- a(!1);
1407
+ }), ge("Escape", () => {
1408
+ o(!1);
1352
1409
  });
1353
- let o = t + "-toggle", s = e.button ? /* @__PURE__ */ K("button", {
1354
- title: t,
1355
- className: $.btn,
1356
- onClick: () => a(!0),
1357
- hidden: n,
1410
+ let s = n + "-toggle", u = e.button ? /* @__PURE__ */ J("button", {
1411
+ title: n,
1412
+ className: En.btn,
1413
+ onClick: () => o(!0),
1414
+ hidden: r,
1358
1415
  children: e.button
1359
- }, o) : /* @__PURE__ */ K(ee, {
1360
- label: t,
1416
+ }, s) : /* @__PURE__ */ J(ee, {
1417
+ label: n,
1361
1418
  Icon: e.icon,
1362
1419
  onToggle: () => {
1363
- a(!0);
1420
+ o(!0);
1364
1421
  },
1365
1422
  value: !1,
1366
- hidden: n
1367
- }, o);
1368
- return /* @__PURE__ */ q(L, { children: [!n && s, i && e.children && /* @__PURE__ */ K(He, {
1423
+ hidden: r
1424
+ }, s);
1425
+ return /* @__PURE__ */ Y(t, { children: [!r && u, a && e.children && /* @__PURE__ */ J(ze, {
1369
1426
  handle: "strong",
1370
- nodeRef: r,
1371
- children: /* @__PURE__ */ K("div", {
1372
- hidden: !i,
1373
- className: $.modal,
1374
- ref: r,
1375
- children: /* @__PURE__ */ q("div", {
1376
- className: $.modal_content,
1427
+ nodeRef: i,
1428
+ children: /* @__PURE__ */ J("div", {
1429
+ hidden: !a,
1430
+ className: En.modal,
1431
+ ref: i,
1432
+ children: /* @__PURE__ */ Y("div", {
1433
+ className: En.modal_content,
1377
1434
  onClick: (e) => e.stopPropagation(),
1378
1435
  children: [
1379
- /* @__PURE__ */ K("strong", {
1436
+ /* @__PURE__ */ J("strong", {
1380
1437
  className: "cursor",
1381
- children: /* @__PURE__ */ K("div", {
1382
- className: $.modal_header,
1383
- children: /* @__PURE__ */ q("h4", {
1384
- className: $.modal_title,
1385
- children: [t, /* @__PURE__ */ K("button", {
1438
+ children: /* @__PURE__ */ J("div", {
1439
+ className: En.modal_header,
1440
+ children: /* @__PURE__ */ Y("h4", {
1441
+ className: En.modal_title,
1442
+ children: [n, /* @__PURE__ */ J("button", {
1386
1443
  onClick: () => {
1387
- a(!1);
1444
+ o(!1);
1388
1445
  },
1389
- className: $.close_button,
1446
+ className: En.close_button,
1390
1447
  children: "X"
1391
1448
  })]
1392
1449
  })
1393
1450
  })
1394
1451
  }),
1395
- /* @__PURE__ */ q("div", {
1396
- className: $.modal_body,
1452
+ /* @__PURE__ */ Y("div", {
1453
+ className: En.modal_body,
1397
1454
  children: [
1398
1455
  " ",
1399
1456
  e.children,
1400
1457
  " "
1401
1458
  ]
1402
1459
  }),
1403
- /* @__PURE__ */ K("div", { className: $.modal_footer })
1460
+ /* @__PURE__ */ J("div", { className: En.modal_footer })
1404
1461
  ]
1405
1462
  })
1406
1463
  })
1407
- }, t)] }, "Modal-" + t);
1464
+ }, n)] }, "Modal-" + n);
1408
1465
  }
1409
- //#endregion
1410
- //#region src/AspectConfigModal.tsx
1411
- function wn(e) {
1412
- let { aspect: t, setAspect: n, children: r } = e, [i, a] = H("number"), [o, s] = H(2), c = B(() => wt(t), [t]);
1413
- c != i && (console.log("Set initial type", e), a(c), c === "number" && s(t));
1414
- function l(e) {
1466
+ // src/AspectConfigModal.tsx
1467
+ function On(e) {
1468
+ let { aspect: t, setAspect: n, children: r } = e, [i, a] = l("number"), [o, c] = l(2), u = s(() => St(t), [t]);
1469
+ u != i && (console.log("Set initial type", e), a(u), u === "number" && t !== o && c(t));
1470
+ function d(e) {
1415
1471
  a(e), n(e === "number" ? o : e);
1416
1472
  }
1417
- return Cn({
1473
+ return Dn({
1418
1474
  title: "Aspect ratio",
1419
- icon: Ee,
1475
+ icon: we,
1420
1476
  hideToggle: e.hideToggle,
1421
- children: /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K("div", {
1422
- className: $.aspect,
1423
- children: /* @__PURE__ */ K(Q, {
1477
+ children: /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("div", {
1478
+ className: En.aspect,
1479
+ children: /* @__PURE__ */ J($, {
1424
1480
  disabled: i !== "number",
1425
1481
  label: "aspect ratio",
1426
1482
  input: o,
1427
- isValid: (e) => Et(e, 10),
1483
+ isValid: (e) => Tt(e, 10),
1428
1484
  inputAttribs: {
1429
1485
  name: "digits",
1430
1486
  pattern: "^\\d+|\\d+.\\d*$",
1431
1487
  size: 3
1432
1488
  },
1433
1489
  updateValue: (e) => {
1434
- s(e), n(e);
1490
+ c(e), n(e);
1435
1491
  },
1436
1492
  submitLabel: "update ratio"
1437
1493
  }, "0")
1438
- }), /* @__PURE__ */ q("div", {
1439
- className: $.aspect,
1440
- children: [/* @__PURE__ */ q(j, {
1494
+ }), /* @__PURE__ */ Y("div", {
1495
+ className: En.aspect,
1496
+ children: [/* @__PURE__ */ Y(B, {
1441
1497
  role: "radiogroup",
1442
1498
  ariaLabel: "aspect",
1443
1499
  value: i,
1444
- onChange: l,
1500
+ onChange: d,
1445
1501
  children: [
1446
- /* @__PURE__ */ K(j.Btn, {
1502
+ /* @__PURE__ */ J(B.Btn, {
1447
1503
  label: "number",
1448
1504
  value: "number"
1449
1505
  }),
1450
- /* @__PURE__ */ K(j.Btn, {
1506
+ /* @__PURE__ */ J(B.Btn, {
1451
1507
  label: "auto",
1452
1508
  value: "auto"
1453
1509
  }),
1454
- /* @__PURE__ */ K(j.Btn, {
1510
+ /* @__PURE__ */ J(B.Btn, {
1455
1511
  label: "equal",
1456
1512
  value: "equal"
1457
1513
  })
@@ -1460,155 +1516,154 @@ function wn(e) {
1460
1516
  })] })
1461
1517
  });
1462
1518
  }
1463
- var Tn = {
1519
+ var kn = {
1464
1520
  root: "_root_h18us_1",
1465
1521
  sliderContainer: "_sliderContainer_h18us_8",
1466
1522
  slider: "_slider_h18us_8",
1467
1523
  tools: "_tools_h18us_27",
1468
1524
  toolsInner: "_toolsInner_h18us_37"
1469
1525
  };
1470
- Ue(".3~e");
1471
- function En(e) {
1526
+ Be(".3~e");
1527
+ function An(e) {
1472
1528
  let { id: t, domainProps: n, children: r } = e;
1473
- return /* @__PURE__ */ K("div", {
1529
+ return /* @__PURE__ */ J("div", {
1474
1530
  id: t,
1475
- className: Tn.tools,
1531
+ className: kn.tools,
1476
1532
  role: "dialog",
1477
1533
  "aria-label": "Edit domain",
1478
- children: /* @__PURE__ */ q("div", {
1479
- className: Tn.toolsInner,
1480
- children: [r, /* @__PURE__ */ K(f, { ...n })]
1534
+ children: /* @__PURE__ */ Y("div", {
1535
+ className: kn.toolsInner,
1536
+ children: [r, /* @__PURE__ */ J(x, { ...n })]
1481
1537
  })
1482
1538
  });
1483
1539
  }
1484
- var Dn = "domain-tools";
1485
- function On(e) {
1486
- let { dataDomain: t, customDomain: n, scaleType: r, onCustomDomainChange: i, histogramGetter: a } = e, [o, s] = H(!1), c = ce(n, t), l = B(() => a && a(), [a]), u = B(() => o ? n : c, [
1487
- o,
1540
+ var jn = "domain-tools";
1541
+ function Mn(e) {
1542
+ let { dataDomain: t, customDomain: n, scaleType: r, onCustomDomainChange: i, histogramGetter: o } = e, [u, d] = l(!1), f = le(n, t), p = s(() => o && o(), [o]), m = s(() => u ? n : f, [
1543
+ u,
1488
1544
  n,
1489
- c
1545
+ f
1490
1546
  ]);
1491
- z(() => {
1492
- o || i(t);
1547
+ a(() => {
1548
+ u || i(t);
1493
1549
  }, [
1494
1550
  t,
1495
- o,
1551
+ u,
1496
1552
  i
1497
1553
  ]);
1498
- let [d, f] = F(c, t, r ?? T.Linear), [m, h] = H(c), g = u[0] === null, _ = u[1] === null, [y, b] = Se(!1), [x, S] = Se(!1), C = y || x;
1499
- function w(e) {
1500
- b(e), S(e);
1554
+ let [h, g] = se(f, t, r ?? P.Linear), [_, v] = l(f), y = m[0] === null, b = m[1] === null, [x, C] = be(!1), [w, T] = be(!1), E = x || w;
1555
+ function O(e) {
1556
+ C(e), T(e);
1501
1557
  }
1502
- function E() {
1503
- C && w(!1);
1558
+ function k() {
1559
+ E && O(!1);
1504
1560
  }
1505
- let D = V(null);
1506
- _e(D, E), ve("Escape", () => {
1507
- E();
1561
+ let A = c(null);
1562
+ he(A, k), ge("Escape", () => {
1563
+ k();
1508
1564
  });
1509
- let O = {
1510
- sliderDomain: m,
1565
+ let j = {
1566
+ sliderDomain: _,
1511
1567
  dataDomain: t,
1512
- errors: f,
1513
- isAutoMin: g,
1514
- isAutoMax: _,
1568
+ errors: g,
1569
+ isAutoMin: y,
1570
+ isAutoMax: b,
1515
1571
  onAutoMinToggle: () => {
1516
- let e = g ? t[0] : null;
1517
- i([e, u[1]]), g || b(!1);
1572
+ let e = y ? t[0] : null;
1573
+ i([e, m[1]]), y || C(!1);
1518
1574
  },
1519
1575
  onAutoMaxToggle: () => {
1520
- let e = _ ? t[1] : null;
1521
- i([u[0], e]), _ || S(!1);
1576
+ let e = b ? t[1] : null;
1577
+ i([m[0], e]), b || T(!1);
1522
1578
  },
1523
- isEditingMin: y,
1524
- isEditingMax: x,
1525
- onEditMin: b,
1526
- onEditMax: S,
1527
- onChangeMin: (e) => i([e, u[1]]),
1528
- onChangeMax: (e) => i([u[0], e]),
1529
- onSwap: () => i([u[1], u[0]])
1579
+ isEditingMin: x,
1580
+ isEditingMax: w,
1581
+ onEditMin: C,
1582
+ onEditMax: T,
1583
+ onChangeMin: (e) => i([e, m[1]]),
1584
+ onChangeMax: (e) => i([m[0], e]),
1585
+ onSwap: () => i([m[1], m[0]])
1530
1586
  };
1531
- return /* @__PURE__ */ q("div", {
1532
- ref: D,
1533
- className: Tn.root,
1587
+ return /* @__PURE__ */ Y("div", {
1588
+ ref: A,
1589
+ className: kn.root,
1534
1590
  children: [
1535
- !l && /* @__PURE__ */ K("div", {
1536
- className: Tn.sliderContainer,
1537
- children: /* @__PURE__ */ K(p, {
1538
- value: m,
1539
- safeVisDomain: d,
1591
+ !p && /* @__PURE__ */ J("div", {
1592
+ className: kn.sliderContainer,
1593
+ children: /* @__PURE__ */ J(S, {
1594
+ value: _,
1595
+ safeVisDomain: h,
1540
1596
  dataDomain: t,
1541
- scaleType: r ?? T.Linear,
1542
- errors: f,
1543
- isAutoMin: g,
1544
- isAutoMax: _,
1597
+ scaleType: r ?? P.Linear,
1598
+ errors: g,
1599
+ isAutoMin: y,
1600
+ isAutoMax: b,
1545
1601
  onChange: (e) => {
1546
- h(e), w(!1);
1602
+ v(e), O(!1);
1547
1603
  },
1548
1604
  onAfterChange: (e, t) => {
1549
- i([e ? m[0] : u[0], t ? m[1] : u[1]]);
1605
+ i([e ? _[0] : m[0], t ? _[1] : m[1]]);
1550
1606
  }
1551
1607
  })
1552
1608
  }),
1553
- /* @__PURE__ */ K(En, {
1554
- id: Dn,
1555
- domainProps: O,
1556
- children: l && /* @__PURE__ */ K(v, {
1609
+ /* @__PURE__ */ J(An, {
1610
+ id: jn,
1611
+ domainProps: j,
1612
+ children: p && /* @__PURE__ */ J(D, {
1557
1613
  dataDomain: t,
1558
- value: m,
1559
- scaleType: r ?? T.Linear,
1560
- onChangeMin: (e) => i([e, u[1]]),
1561
- onChangeMax: (e) => i([u[0], e]),
1562
- ...l
1614
+ value: _,
1615
+ scaleType: r ?? P.Linear,
1616
+ onChangeMin: (e) => i([e, m[1]]),
1617
+ onChangeMax: (e) => i([m[0], e]),
1618
+ ...p
1563
1619
  })
1564
1620
  }),
1565
- /* @__PURE__ */ q("label", { children: [/* @__PURE__ */ K("input", {
1621
+ /* @__PURE__ */ Y("label", { children: [/* @__PURE__ */ J("input", {
1566
1622
  type: "checkbox",
1567
- checked: o,
1623
+ checked: u,
1568
1624
  onChange: () => {
1569
- s((e) => !e);
1625
+ d((e) => !e);
1570
1626
  }
1571
1627
  }), "Lock domain?"] })
1572
1628
  ]
1573
1629
  });
1574
1630
  }
1575
- On.displayName = "DomainConfig";
1576
- //#endregion
1577
- //#region src/AxisConfigModal.tsx
1578
- function kn(e) {
1579
- let t = e.label && e.setLabel && /* @__PURE__ */ K(Q, {
1631
+ Mn.displayName = "DomainConfig";
1632
+ // src/AxisConfigModal.tsx
1633
+ function Nn(e) {
1634
+ let t = e.label && e.setLabel && /* @__PURE__ */ J($, {
1580
1635
  label: "label",
1581
1636
  input: e.label,
1582
1637
  updateValue: e.setLabel,
1583
1638
  enableEnterKey: !1
1584
- }, "label"), n = e.scaleType && e.setScaleType && /* @__PURE__ */ K(C, {
1639
+ }, "label"), n = e.scaleType && e.setScaleType && /* @__PURE__ */ J(M, {
1585
1640
  label: "scale",
1586
1641
  value: e.scaleType,
1587
1642
  onScaleChange: e.setScaleType,
1588
1643
  options: e.scaleOptions
1589
- }), r = e.colourMap && e.setColourMap && e.invertColourMap !== void 0 && e.toggleColourMapInversion !== void 0 && /* @__PURE__ */ K(s, {
1644
+ }), r = e.colourMap && e.setColourMap && e.invertColourMap !== void 0 && e.toggleColourMapInversion !== void 0 && /* @__PURE__ */ J(g, {
1590
1645
  value: e.colourMap,
1591
1646
  onValueChange: e.setColourMap,
1592
1647
  invert: e.invertColourMap,
1593
1648
  onInversionChange: e.toggleColourMapInversion
1594
- }), i = e.domain && e.histogramGetter && e.customDomain && e.setCustomDomain && /* @__PURE__ */ K(On, {
1649
+ }), i = e.domain && e.histogramGetter && e.customDomain && e.setCustomDomain && /* @__PURE__ */ J(Mn, {
1595
1650
  dataDomain: e.domain,
1596
1651
  customDomain: e.customDomain,
1597
1652
  scaleType: e.scaleType,
1598
1653
  onCustomDomainChange: e.setCustomDomain,
1599
1654
  histogramGetter: e.histogramGetter
1600
- }), a = e.scatterPointSize !== void 0 && e.setScatterPointSize && /* @__PURE__ */ K(Q, {
1655
+ }), a = e.scatterPointSize !== void 0 && e.setScatterPointSize && /* @__PURE__ */ J($, {
1601
1656
  label: "point size",
1602
1657
  input: e.scatterPointSize,
1603
1658
  updateValue: e.setScatterPointSize,
1604
1659
  decimalPlaces: 2,
1605
- isValid: (e) => Dt(e, !1),
1660
+ isValid: (e) => Et(e, !1),
1606
1661
  disabled: !e?.hasBaton
1607
- }, "point size"), c = e.colourMap ? /* @__PURE__ */ K(o, { colorMap: e.colourMap }) : void 0;
1608
- return /* @__PURE__ */ q(Cn, {
1662
+ }, "point size"), o = e.colourMap ? /* @__PURE__ */ J(h, { colorMap: e.colourMap }) : void 0;
1663
+ return /* @__PURE__ */ Y(Dn, {
1609
1664
  title: e.title,
1610
1665
  icon: e.icon,
1611
- button: c,
1666
+ button: o,
1612
1667
  hideToggle: e.hideToggle,
1613
1668
  children: [
1614
1669
  t,
@@ -1620,110 +1675,107 @@ function kn(e) {
1620
1675
  ]
1621
1676
  });
1622
1677
  }
1623
- //#endregion
1624
- //#region src/BatonConfigModal.tsx
1625
- function An(e) {
1626
- let { batonUuid: t, uuid: n, others: i, hasBaton: a, offerBaton: o, requestBaton: s } = e, c = t + "*", l = B(() => a ? i.map((e) => /* @__PURE__ */ K("div", {
1678
+ // src/BatonConfigModal.tsx
1679
+ function Pn(e) {
1680
+ let { batonUuid: t, uuid: n, others: r, hasBaton: i, offerBaton: a, requestBaton: o } = e, c = t + "*", l = s(() => i ? r.map((e) => /* @__PURE__ */ J("div", {
1627
1681
  title: "Pass baton on",
1628
- children: /* @__PURE__ */ K(r, {
1682
+ children: /* @__PURE__ */ J(f, {
1629
1683
  label: e,
1630
- onClick: () => o(e)
1684
+ onClick: () => a(e)
1631
1685
  }, e)
1632
- }, e)) : i.map((e) => t == e ? /* @__PURE__ */ K("div", {
1686
+ }, e)) : r.map((e) => t == e ? /* @__PURE__ */ J("div", {
1633
1687
  title: "Request baton",
1634
- children: /* @__PURE__ */ K(r, {
1688
+ children: /* @__PURE__ */ J(f, {
1635
1689
  label: c,
1636
- onClick: () => s()
1690
+ onClick: () => o()
1637
1691
  })
1638
- }, t) : /* @__PURE__ */ K("p", { children: e }, e)), [
1692
+ }, t) : /* @__PURE__ */ J("p", { children: e }, e)), [
1639
1693
  c,
1640
1694
  t,
1641
- a,
1642
- o,
1643
1695
  i,
1644
- s
1696
+ a,
1697
+ r,
1698
+ o
1645
1699
  ]);
1646
- return Cn({
1700
+ return Dn({
1647
1701
  title: "Baton info",
1648
- icon: We,
1702
+ icon: Ve,
1649
1703
  hideToggle: !n,
1650
- children: /* @__PURE__ */ q("div", {
1704
+ children: /* @__PURE__ */ Y("div", {
1651
1705
  style: {
1652
1706
  lineHeight: "80%",
1653
1707
  width: "10em"
1654
1708
  },
1655
1709
  children: [
1656
- /* @__PURE__ */ K("p", { children: /* @__PURE__ */ q("strong", { children: [
1710
+ /* @__PURE__ */ J("p", { children: /* @__PURE__ */ Y("strong", { children: [
1657
1711
  "Client (",
1658
- a ? c : n,
1712
+ i ? c : n,
1659
1713
  ")"
1660
1714
  ] }) }),
1661
- !a && l && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ q("p", { children: ["Other client", l.length > 1 ? "s" : ""] }), l] }),
1662
- a && t && l
1715
+ !i && l && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y("p", { children: ["Other client", l.length > 1 ? "s" : ""] }), l] }),
1716
+ i && t && l
1663
1717
  ]
1664
1718
  })
1665
1719
  });
1666
1720
  }
1667
- //#endregion
1668
- //#region src/ClearSelectionsBtn.tsx
1669
- function jn(e) {
1721
+ // src/ClearSelectionsBtn.tsx
1722
+ function Fn(e) {
1670
1723
  function t() {
1671
1724
  e.updateSelection && e.updateSelection(null, !1, !0), e.updateCurrentSelectionID(null);
1672
1725
  }
1673
- return /* @__PURE__ */ K(r, {
1726
+ return /* @__PURE__ */ J(f, {
1674
1727
  label: "Clear all selections",
1675
1728
  onClick: () => {
1676
- window.confirm("Clear all selections?") && t();
1729
+ window.confirm(e.popupText) && t();
1677
1730
  },
1678
1731
  disabled: e.disabled
1679
1732
  });
1680
1733
  }
1681
- //#endregion
1682
- //#region src/InteractionModeToggle.tsx
1683
- function Mn(e) {
1734
+ // src/InteractionModeToggle.tsx
1735
+ function In(e) {
1684
1736
  let { value: t, onModeChange: n, hasBaton: r, canSelect: i } = e;
1685
- return z(() => {
1737
+ return a(() => {
1686
1738
  !r && t === X.selectRegion && n(X.panAndWheelZoom);
1687
1739
  }, [
1688
1740
  t,
1689
1741
  n,
1690
1742
  r
1691
- ]), /* @__PURE__ */ K(G, { children: /* @__PURE__ */ q(j, {
1743
+ ]), /* @__PURE__ */ J(q, { children: /* @__PURE__ */ Y(B, {
1692
1744
  role: "radiogroup",
1693
1745
  ariaLabel: "mode",
1694
1746
  value: t,
1695
1747
  onChange: (e) => n(e),
1696
1748
  children: [
1697
- /* @__PURE__ */ K(j.Btn, {
1749
+ /* @__PURE__ */ J(B.Btn, {
1698
1750
  label: "pan & wheel zoom\n alt: x-only\n shift: y-only",
1699
1751
  iconOnly: !0,
1700
- icon: Be,
1752
+ icon: Le,
1701
1753
  value: X.panAndWheelZoom
1702
1754
  }),
1703
- /* @__PURE__ */ K(j.Btn, {
1755
+ /* @__PURE__ */ J(B.Btn, {
1704
1756
  label: "select to zoom\n alt: x-only\n shift: y-only",
1705
1757
  iconOnly: !0,
1706
- icon: ze,
1758
+ icon: Ie,
1707
1759
  value: X.selectToZoom
1708
1760
  }),
1709
- i ? /* @__PURE__ */ K("div", {
1761
+ i ? /* @__PURE__ */ J("div", {
1710
1762
  style: {
1711
1763
  pointerEvents: r ? "inherit" : "auto",
1712
1764
  display: "inline-flex"
1713
1765
  },
1714
1766
  title: r ? "" : "need baton",
1715
- children: /* @__PURE__ */ K(j.Btn, {
1767
+ children: /* @__PURE__ */ J(B.Btn, {
1716
1768
  label: "select region",
1717
1769
  iconOnly: !0,
1718
- icon: Ge,
1770
+ icon: He,
1719
1771
  value: X.selectRegion,
1720
1772
  disabled: !r
1721
1773
  })
1722
- }) : /* @__PURE__ */ K(G, {})
1774
+ }) : /* @__PURE__ */ J(q, {})
1723
1775
  ]
1724
1776
  }) });
1725
1777
  }
1726
- var Nn = {
1778
+ var Ln = {
1727
1779
  modeless: "_modeless_1im3t_1",
1728
1780
  modeless_content: "_modeless_content_1im3t_7",
1729
1781
  modeless_header: "_modeless_header_1im3t_16",
@@ -1734,95 +1786,93 @@ var Nn = {
1734
1786
  aspect: "_aspect_1im3t_40",
1735
1787
  btn: "_btn_1im3t_46"
1736
1788
  };
1737
- //#endregion
1738
- //#region src/Modeless.tsx
1739
- function Pn(e) {
1740
- let { showModeless: t, setShowModeless: n, title: r } = e, i = V(null);
1741
- return ve("Escape", () => {
1789
+ // src/Modeless.tsx
1790
+ function Rn(e) {
1791
+ let { showModeless: t, setShowModeless: n, title: r } = e, i = c(null);
1792
+ return ge("Escape", () => {
1742
1793
  n(!1);
1743
- }), [t && e.children ? /* @__PURE__ */ K(He, {
1794
+ }), [t && e.children ? /* @__PURE__ */ J(ze, {
1744
1795
  handle: "strong",
1745
1796
  nodeRef: i,
1746
- children: /* @__PURE__ */ K("div", {
1797
+ children: /* @__PURE__ */ J("div", {
1747
1798
  hidden: !t,
1748
1799
  ref: i,
1749
- className: Nn.modeless,
1750
- children: /* @__PURE__ */ q("div", {
1751
- className: Nn.modeless_content,
1800
+ className: Ln.modeless,
1801
+ children: /* @__PURE__ */ Y("div", {
1802
+ className: Ln.modeless_content,
1752
1803
  onClick: (e) => e.stopPropagation(),
1753
1804
  children: [
1754
- /* @__PURE__ */ K("strong", {
1805
+ /* @__PURE__ */ J("strong", {
1755
1806
  className: "cursor",
1756
- children: /* @__PURE__ */ K("div", {
1757
- className: Nn.modeless_header,
1758
- children: /* @__PURE__ */ q("h4", {
1759
- className: Nn.modeless_title,
1760
- children: [e.title, /* @__PURE__ */ K("button", {
1807
+ children: /* @__PURE__ */ J("div", {
1808
+ className: Ln.modeless_header,
1809
+ children: /* @__PURE__ */ Y("h4", {
1810
+ className: Ln.modeless_title,
1811
+ children: [e.title, /* @__PURE__ */ J("button", {
1761
1812
  onClick: () => {
1762
1813
  n(!1);
1763
1814
  },
1764
- className: Nn.close_button,
1815
+ className: Ln.close_button,
1765
1816
  children: "X"
1766
1817
  })]
1767
1818
  })
1768
1819
  })
1769
1820
  }),
1770
- /* @__PURE__ */ q("div", {
1771
- className: Nn.modeless_body,
1821
+ /* @__PURE__ */ Y("div", {
1822
+ className: Ln.modeless_body,
1772
1823
  children: [
1773
1824
  " ",
1774
1825
  e.children,
1775
1826
  " "
1776
1827
  ]
1777
1828
  }),
1778
- /* @__PURE__ */ K("div", { className: Nn.modeless_footer })
1829
+ /* @__PURE__ */ J("div", { className: Ln.modeless_footer })
1779
1830
  ]
1780
1831
  })
1781
1832
  })
1782
1833
  }, r) : null];
1783
1834
  }
1784
- var Fn = { colourLabel: "_colourLabel_1evqd_1" };
1785
- //#endregion
1786
- //#region src/GlyphTypeToggle.tsx
1787
- function In(e) {
1835
+ var zn = { colourLabel: "_colourLabel_1evqd_1" };
1836
+ // src/GlyphTypeToggle.tsx
1837
+ function Bn(e) {
1788
1838
  let t = e.value ?? "Circle", n = e.onGlyphTypeChange, r = e.hasBaton;
1789
- return /* @__PURE__ */ K(G, { children: /* @__PURE__ */ q(j, {
1839
+ return /* @__PURE__ */ J(q, { children: /* @__PURE__ */ Y(B, {
1790
1840
  role: "radiogroup",
1791
1841
  ariaLabel: "mode",
1792
1842
  value: t,
1793
1843
  onChange: (e) => n(e),
1794
1844
  children: [
1795
- /* @__PURE__ */ K(j.Btn, {
1845
+ /* @__PURE__ */ J(B.Btn, {
1796
1846
  label: "Circle",
1797
1847
  iconOnly: !0,
1798
- icon: qe,
1848
+ icon: We,
1799
1849
  value: "Circle",
1800
1850
  disabled: !r
1801
1851
  }),
1802
- /* @__PURE__ */ K(j.Btn, {
1852
+ /* @__PURE__ */ J(B.Btn, {
1803
1853
  label: "Cross",
1804
1854
  iconOnly: !0,
1805
- icon: Je,
1855
+ icon: Ge,
1806
1856
  value: "Cross",
1807
1857
  disabled: !r
1808
1858
  }),
1809
- /* @__PURE__ */ K(j.Btn, {
1859
+ /* @__PURE__ */ J(B.Btn, {
1810
1860
  label: "Square",
1811
1861
  iconOnly: !0,
1812
- icon: Ye,
1862
+ icon: Ke,
1813
1863
  value: "Square",
1814
1864
  disabled: !r
1815
1865
  }),
1816
- /* @__PURE__ */ K("div", {
1866
+ /* @__PURE__ */ J("div", {
1817
1867
  style: {
1818
1868
  pointerEvents: r ? "inherit" : "auto",
1819
1869
  display: "inline-flex"
1820
1870
  },
1821
1871
  title: r ? "" : "need baton",
1822
- children: /* @__PURE__ */ K(j.Btn, {
1872
+ children: /* @__PURE__ */ J(B.Btn, {
1823
1873
  label: "Cap",
1824
1874
  iconOnly: !0,
1825
- icon: Oe,
1875
+ icon: Ee,
1826
1876
  value: "Cap",
1827
1877
  disabled: !r
1828
1878
  })
@@ -1830,113 +1880,111 @@ function In(e) {
1830
1880
  ]
1831
1881
  }) });
1832
1882
  }
1833
- //#endregion
1834
- //#region src/LineConfig.tsx
1835
- function Ln(e) {
1836
- let { currentLineKey: t, allLineParams: n, updateLineParams: r, hasBaton: i } = e;
1837
- if (console.log("currentLineKey is ", t), t == null || !n.has(t)) return null;
1838
- let a = n.get(t);
1839
- if (a == null) return null;
1840
- let o = a.colour ?? "#000000";
1841
- return /* @__PURE__ */ q(Pn, {
1883
+ // src/LineConfig.tsx
1884
+ function Vn(e) {
1885
+ let { currentLineKey: n, allLineParams: r, updateLineParams: i, hasBaton: a } = e;
1886
+ if (console.log("currentLineKey is ", n), n == null || !r.has(n)) return null;
1887
+ let o = r.get(n);
1888
+ if (o == null) return null;
1889
+ let s = o.colour ?? "#000000";
1890
+ return /* @__PURE__ */ Y(Rn, {
1842
1891
  title: "Line",
1843
1892
  showModeless: e.showLineConfig,
1844
1893
  setShowModeless: e.updateShowLineConfig,
1845
1894
  children: [
1846
- /* @__PURE__ */ q(L, { children: [
1847
- /* @__PURE__ */ K("div", {
1848
- className: Fn.colourLabel,
1849
- style: { borderLeftColor: o },
1850
- children: o
1895
+ /* @__PURE__ */ Y(t, { children: [
1896
+ /* @__PURE__ */ J("div", {
1897
+ className: zn.colourLabel,
1898
+ style: { borderLeftColor: s },
1899
+ children: s
1851
1900
  }, "colour text"),
1852
- /* @__PURE__ */ K("br", {}, "colour spacer"),
1853
- i && /* @__PURE__ */ K(Ke, {
1854
- color: o,
1901
+ /* @__PURE__ */ J("br", {}, "colour spacer"),
1902
+ a && /* @__PURE__ */ J(Ue, {
1903
+ color: s,
1855
1904
  onChange: (e) => {
1856
- e !== a.colour && r(t, {
1857
- ...a,
1905
+ e !== o.colour && i(n, {
1906
+ ...o,
1858
1907
  colour: e
1859
1908
  });
1860
1909
  }
1861
1910
  }, "colour picker")
1862
1911
  ] }, "line colour"),
1863
- /* @__PURE__ */ K(Q, {
1912
+ /* @__PURE__ */ J($, {
1864
1913
  label: "colour",
1865
- input: a.colour ?? "",
1914
+ input: o.colour ?? "",
1866
1915
  updateValue: (e) => {
1867
- e !== a.colour && r(t, {
1868
- ...a,
1916
+ e !== o.colour && i(n, {
1917
+ ...o,
1869
1918
  colour: e
1870
1919
  });
1871
1920
  },
1872
- disabled: !i
1921
+ disabled: !a
1873
1922
  }, "colour input"),
1874
- /* @__PURE__ */ K(Q, {
1923
+ /* @__PURE__ */ J($, {
1875
1924
  label: "line width",
1876
- input: a.width ?? 1,
1925
+ input: o.width ?? 1,
1877
1926
  updateValue: (e) => {
1878
- e !== a.width && e >= 0 && r(t, {
1879
- ...a,
1927
+ e !== o.width && e >= 0 && i(n, {
1928
+ ...o,
1880
1929
  width: e
1881
1930
  });
1882
1931
  },
1883
- isValid: (e) => Dt(e, a.lineOn),
1884
- disabled: !i
1932
+ isValid: (e) => Et(e, o.lineOn),
1933
+ disabled: !a
1885
1934
  }, "line width"),
1886
- /* @__PURE__ */ K(Q, {
1935
+ /* @__PURE__ */ J($, {
1887
1936
  label: "name",
1888
- input: a.name,
1937
+ input: o.name,
1889
1938
  updateValue: (e) => {
1890
- e !== a.name && r(t, {
1891
- ...a,
1939
+ e !== o.name && i(n, {
1940
+ ...o,
1892
1941
  name: e
1893
1942
  });
1894
1943
  },
1895
- disabled: !i
1944
+ disabled: !a
1896
1945
  }, "name"),
1897
- /* @__PURE__ */ K(ee, {
1946
+ /* @__PURE__ */ J(ee, {
1898
1947
  label: "Line on",
1899
- value: a.lineOn,
1948
+ value: o.lineOn,
1900
1949
  onToggle: () => {
1901
- (a.pointSize || !a.lineOn) && r(t, {
1902
- ...a,
1903
- lineOn: !a.lineOn
1950
+ (o.pointSize || !o.lineOn) && i(n, {
1951
+ ...o,
1952
+ lineOn: !o.lineOn
1904
1953
  });
1905
1954
  },
1906
- disabled: !i || a.pointSize == null || a.pointSize == 0
1955
+ disabled: !a || o.pointSize == null || o.pointSize == 0
1907
1956
  }, "line on"),
1908
- /* @__PURE__ */ K(In, {
1909
- value: a.glyphType ?? g.Circle,
1957
+ /* @__PURE__ */ J(Bn, {
1958
+ value: o.glyphType ?? T.Circle,
1910
1959
  onGlyphTypeChange: (e) => {
1911
- console.log("calling onGlyphTypeChange with cLine ", t), e !== a.glyphType && r(t, {
1912
- ...a,
1960
+ console.log("calling onGlyphTypeChange with cLine ", n), e !== o.glyphType && i(n, {
1961
+ ...o,
1913
1962
  glyphType: e
1914
1963
  });
1915
1964
  },
1916
- hasBaton: i
1965
+ hasBaton: a
1917
1966
  }, "glyph type"),
1918
- /* @__PURE__ */ K(Q, {
1967
+ /* @__PURE__ */ J($, {
1919
1968
  label: "point size",
1920
- input: a.pointSize ?? 0,
1969
+ input: o.pointSize ?? 0,
1921
1970
  updateValue: (e) => {
1922
- e !== a.pointSize && (e == 0 && a.lineOn ? r(t, {
1923
- ...a,
1971
+ e !== o.pointSize && (e == 0 && o.lineOn ? i(n, {
1972
+ ...o,
1924
1973
  pointSize: void 0
1925
- }) : e >= 0 && r(t, {
1926
- ...a,
1974
+ }) : e >= 0 && i(n, {
1975
+ ...o,
1927
1976
  pointSize: e
1928
1977
  }));
1929
1978
  },
1930
1979
  decimalPlaces: 2,
1931
- isValid: (e) => Dt(e, a.lineOn),
1932
- disabled: !i
1980
+ isValid: (e) => Et(e, o.lineOn),
1981
+ disabled: !a
1933
1982
  }, "point size")
1934
1983
  ]
1935
1984
  });
1936
1985
  }
1937
- //#endregion
1938
- //#region src/LineKeyDropdown.tsx
1939
- function Rn(e) {
1986
+ // src/LineKeyDropdown.tsx
1987
+ function Hn(e) {
1940
1988
  let { allLineParams: t, lineKey: n, onLineKeyChange: r } = e, i = [...t.keys()];
1941
1989
  function a() {
1942
1990
  n === "" && i.length > 0 && r(i[0]);
@@ -1959,7 +2007,7 @@ function Rn(e) {
1959
2007
  label: c(e),
1960
2008
  bgcolour: o(e)
1961
2009
  }));
1962
- return /* @__PURE__ */ K(Xe, {
2010
+ return /* @__PURE__ */ J(qe, {
1963
2011
  styles: l,
1964
2012
  value: {
1965
2013
  value: n,
@@ -1975,59 +2023,59 @@ function Rn(e) {
1975
2023
  }
1976
2024
  });
1977
2025
  }
1978
- var zn = {
2026
+ var Un = {
1979
2027
  option: "_option_1qhtz_1",
1980
2028
  icon: "_icon_1qhtz_6"
1981
- }, Bn = {
2029
+ }, Wn = {
1982
2030
  [Z.line]: {
1983
- Icon: Te,
2031
+ Icon: Ce,
1984
2032
  label: "Line"
1985
2033
  },
1986
2034
  [Z.rectangle]: {
1987
- Icon: Ae,
2035
+ Icon: Oe,
1988
2036
  label: "Rectangle"
1989
2037
  },
1990
2038
  [Z.polyline]: {
1991
- Icon: ke,
2039
+ Icon: De,
1992
2040
  label: "Polyline"
1993
2041
  },
1994
2042
  [Z.polygon]: {
1995
- Icon: Le,
2043
+ Icon: Pe,
1996
2044
  label: "Polygon"
1997
2045
  },
1998
2046
  [Z.circle]: {
1999
- Icon: Pe,
2047
+ Icon: je,
2000
2048
  label: "Circle"
2001
2049
  },
2002
2050
  [Z.ellipse]: {
2003
- Icon: Ie,
2051
+ Icon: Ne,
2004
2052
  label: "Ellipse"
2005
2053
  },
2006
2054
  [Z.sector]: {
2007
- Icon: $e,
2055
+ Icon: Xe,
2008
2056
  label: "Sector"
2009
2057
  },
2010
2058
  [Z.horizontalAxis]: {
2011
- Icon: Qe,
2059
+ Icon: Ye,
2012
2060
  label: "Horizontal Axis"
2013
2061
  },
2014
2062
  [Z.verticalAxis]: {
2015
- Icon: Ze,
2063
+ Icon: Je,
2016
2064
  label: "Vertical Axis"
2017
2065
  },
2018
2066
  [Z.unknown]: {
2019
- Icon: Re,
2067
+ Icon: Fe,
2020
2068
  label: "Unknown"
2021
2069
  }
2022
2070
  };
2023
- function Vn(e) {
2024
- let { option: t } = e, { Icon: n, label: r } = Bn[t];
2025
- return /* @__PURE__ */ q("div", {
2026
- className: zn.option,
2027
- children: [/* @__PURE__ */ K(n, { className: zn.icon }), /* @__PURE__ */ K("span", { children: r })]
2071
+ function Gn(e) {
2072
+ let { option: t } = e, { Icon: n, label: r } = Wn[t];
2073
+ return /* @__PURE__ */ Y("div", {
2074
+ className: Un.option,
2075
+ children: [/* @__PURE__ */ J(n, { className: Un.icon }), /* @__PURE__ */ J("span", { children: r })]
2028
2076
  });
2029
2077
  }
2030
- function Hn(e) {
2078
+ function Kn(e) {
2031
2079
  let { value: t, onSelectionTypeChange: n, disabled: r, options: i = [
2032
2080
  Z.line,
2033
2081
  Z.rectangle,
@@ -2036,19 +2084,18 @@ function Hn(e) {
2036
2084
  Z.polygon,
2037
2085
  Z.polyline
2038
2086
  ] } = e;
2039
- return /* @__PURE__ */ K(D, {
2087
+ return /* @__PURE__ */ J(I, {
2040
2088
  value: t,
2041
2089
  onChange: n,
2042
2090
  options: i,
2043
- renderOption: (e) => /* @__PURE__ */ K(Vn, { option: e }),
2091
+ renderOption: (e) => /* @__PURE__ */ J(Gn, { option: e }),
2044
2092
  disabled: r
2045
2093
  });
2046
2094
  }
2047
- //#endregion
2048
- //#region src/SelectionConfigComponents.tsx
2049
- function Un(e) {
2095
+ // src/SelectionConfigComponents.tsx
2096
+ function qn(e) {
2050
2097
  let { selection: t, updateSelection: n, disabled: r } = e;
2051
- return /* @__PURE__ */ K(Q, {
2098
+ return /* @__PURE__ */ J($, {
2052
2099
  label: "angle",
2053
2100
  input: t.angle * 180 / Math.PI,
2054
2101
  decimalPlaces: 5,
@@ -2058,187 +2105,183 @@ function Un(e) {
2058
2105
  t.setAngle(r), n(t);
2059
2106
  }
2060
2107
  },
2061
- isValid: (e) => Y(e),
2108
+ isValid: (e) => Ct(e),
2062
2109
  disabled: r
2063
2110
  }, "angle");
2064
2111
  }
2065
- function Wn(e) {
2112
+ function Jn(e) {
2066
2113
  let { selection: t, updateSelection: n, disabled: r } = e;
2067
- return /* @__PURE__ */ K(Q, {
2114
+ return /* @__PURE__ */ J($, {
2068
2115
  label: "x",
2069
2116
  input: t.start[0],
2070
2117
  decimalPlaces: 8,
2071
2118
  updateValue: (e) => {
2072
2119
  n && (t.setStart(0, e), n(t));
2073
2120
  },
2074
- isValid: (e) => Y(e),
2121
+ isValid: (e) => Ct(e),
2075
2122
  disabled: r
2076
2123
  }, "x");
2077
2124
  }
2078
- function Gn(e) {
2125
+ function Yn(e) {
2079
2126
  let { selection: t, updateSelection: n, disabled: r } = e;
2080
- return /* @__PURE__ */ K(Q, {
2127
+ return /* @__PURE__ */ J($, {
2081
2128
  label: "y",
2082
2129
  input: t.start[1],
2083
2130
  decimalPlaces: 8,
2084
2131
  updateValue: (e) => {
2085
2132
  n && (t.setStart(1, e), n(t));
2086
2133
  },
2087
- isValid: (e) => Y(e),
2134
+ isValid: (e) => Ct(e),
2088
2135
  disabled: r
2089
2136
  }, "y");
2090
2137
  }
2091
- function Kn(e) {
2138
+ function Xn(e) {
2092
2139
  let { i: t, point: n, updatePoint: r, disabled: i } = e, a = `x${t}`;
2093
- return /* @__PURE__ */ K(Q, {
2140
+ return /* @__PURE__ */ J($, {
2094
2141
  label: a,
2095
2142
  input: n[0],
2096
2143
  decimalPlaces: 8,
2097
2144
  updateValue: (e) => {
2098
2145
  r([e, n[1]]);
2099
2146
  },
2100
- isValid: (e) => Y(e),
2147
+ isValid: (e) => Ct(e),
2101
2148
  disabled: i
2102
2149
  }, a);
2103
2150
  }
2104
- function qn(e) {
2151
+ function Zn(e) {
2105
2152
  let { i: t, point: n, updatePoint: r, disabled: i } = e, a = `y${t}`;
2106
- return /* @__PURE__ */ K(Q, {
2153
+ return /* @__PURE__ */ J($, {
2107
2154
  label: a,
2108
2155
  input: n[1],
2109
2156
  decimalPlaces: 8,
2110
2157
  updateValue: (e) => {
2111
2158
  r([n[0], e]);
2112
2159
  },
2113
- isValid: (e) => Y(e),
2160
+ isValid: (e) => Ct(e),
2114
2161
  disabled: i
2115
2162
  }, a);
2116
2163
  }
2117
- //#endregion
2118
- //#region src/AxialSelectionConfig.tsx
2119
- function Jn(e) {
2120
- let { selection: t, updateSelection: n, disabled: r } = e;
2121
- return t.dimension === 0 ? /* @__PURE__ */ q(L, { children: [/* @__PURE__ */ K(Wn, {
2122
- selection: t,
2123
- updateSelection: n,
2124
- disabled: r
2125
- }, `XInput${t._vStart.x}`), /* @__PURE__ */ K(Q, {
2164
+ // src/AxialSelectionConfig.tsx
2165
+ function Qn(e) {
2166
+ let { selection: n, updateSelection: r, disabled: i } = e;
2167
+ return n.dimension === 0 ? /* @__PURE__ */ Y(t, { children: [/* @__PURE__ */ J(Jn, {
2168
+ selection: n,
2169
+ updateSelection: r,
2170
+ disabled: i
2171
+ }, `XInput${n._vStart.x}`), /* @__PURE__ */ J($, {
2126
2172
  label: "x length",
2127
- input: t.length,
2173
+ input: n.length,
2128
2174
  updateValue: (e) => {
2129
- if (n) {
2130
- let r = Ht.createFromSelection(t);
2131
- r.length = e, n(r);
2175
+ if (r) {
2176
+ let t = Ht.createFromSelection(n);
2177
+ t.length = e, r(t);
2132
2178
  }
2133
2179
  },
2134
2180
  decimalPlaces: 8,
2135
- isValid: (e) => Y(e),
2136
- disabled: r
2137
- }, `XLength${t.length}`)] }, "axis x") : /* @__PURE__ */ q(L, { children: [/* @__PURE__ */ K(Gn, {
2138
- selection: t,
2139
- updateSelection: n,
2140
- disabled: r
2141
- }, `YInput${t._vStart.y}`), /* @__PURE__ */ K(Q, {
2181
+ isValid: (e) => Ct(e),
2182
+ disabled: i
2183
+ }, `XLength${n.length}`)] }, "axis x") : /* @__PURE__ */ Y(t, { children: [/* @__PURE__ */ J(Yn, {
2184
+ selection: n,
2185
+ updateSelection: r,
2186
+ disabled: i
2187
+ }, `YInput${n._vStart.y}`), /* @__PURE__ */ J($, {
2142
2188
  label: "y length",
2143
- input: t.length,
2189
+ input: n.length,
2144
2190
  updateValue: (e) => {
2145
- if (n) {
2146
- let r = Ht.createFromSelection(t);
2147
- r.length = e, n(r);
2191
+ if (r) {
2192
+ let t = Ht.createFromSelection(n);
2193
+ t.length = e, r(t);
2148
2194
  }
2149
2195
  },
2150
2196
  decimalPlaces: 8,
2151
- isValid: (e) => Y(e),
2152
- disabled: r
2153
- }, `YLength${t.length}`)] }, "axis y");
2154
- }
2155
- //#endregion
2156
- //#region src/LinearSelectionConfig.tsx
2157
- function Yn(e) {
2158
- let { selection: t, updateSelection: n, disabled: r } = e;
2159
- return /* @__PURE__ */ q(L, { children: [
2160
- /* @__PURE__ */ K(Wn, {
2161
- selection: t,
2162
- updateSelection: n,
2163
- disabled: r
2164
- }, `XInput${t._vStart.x}`),
2165
- /* @__PURE__ */ K(Gn, {
2166
- selection: t,
2167
- updateSelection: n,
2168
- disabled: r
2169
- }, `YInput${t._vStart.y}`),
2170
- /* @__PURE__ */ K(Un, {
2171
- selection: t,
2172
- updateSelection: n,
2173
- disabled: r
2174
- }, `Angle${t.angle}`),
2175
- /* @__PURE__ */ K(Q, {
2197
+ isValid: (e) => Ct(e),
2198
+ disabled: i
2199
+ }, `YLength${n.length}`)] }, "axis y");
2200
+ }
2201
+ // src/LinearSelectionConfig.tsx
2202
+ function $n(e) {
2203
+ let { selection: n, updateSelection: r, disabled: i } = e;
2204
+ return /* @__PURE__ */ Y(t, { children: [
2205
+ /* @__PURE__ */ J(Jn, {
2206
+ selection: n,
2207
+ updateSelection: r,
2208
+ disabled: i
2209
+ }, `XInput${n._vStart.x}`),
2210
+ /* @__PURE__ */ J(Yn, {
2211
+ selection: n,
2212
+ updateSelection: r,
2213
+ disabled: i
2214
+ }, `YInput${n._vStart.y}`),
2215
+ /* @__PURE__ */ J(qn, {
2216
+ selection: n,
2217
+ updateSelection: r,
2218
+ disabled: i
2219
+ }, `Angle${n.angle}`),
2220
+ /* @__PURE__ */ J($, {
2176
2221
  label: "length",
2177
- input: t.length,
2222
+ input: n.length,
2178
2223
  updateValue: (e) => {
2179
- if (n) {
2180
- let r = qt.createFromSelection(t);
2181
- r.length = e, n(r);
2224
+ if (r) {
2225
+ let t = qt.createFromSelection(n);
2226
+ t.length = e, r(t);
2182
2227
  }
2183
2228
  },
2184
2229
  decimalPlaces: 8,
2185
- isValid: (e) => Y(e),
2186
- disabled: r
2187
- }, `Length${t.length}`)
2230
+ isValid: (e) => Ct(e),
2231
+ disabled: i
2232
+ }, `Length${n.length}`)
2188
2233
  ] }, "line");
2189
2234
  }
2190
- //#endregion
2191
- //#region src/RectangularSelectionConfig.tsx
2192
- function Xn(e) {
2193
- let { selection: t, updateSelection: n, disabled: r } = e;
2194
- return /* @__PURE__ */ q(L, { children: [
2195
- /* @__PURE__ */ K(Wn, {
2196
- selection: t,
2197
- updateSelection: n,
2198
- disabled: r
2199
- }, `XInput${t._vStart.x}`),
2200
- /* @__PURE__ */ K(Gn, {
2201
- selection: t,
2202
- updateSelection: n,
2203
- disabled: r
2204
- }, `YInput${t._vStart.y}`),
2205
- /* @__PURE__ */ K(Un, {
2206
- selection: t,
2207
- updateSelection: n,
2208
- disabled: r
2209
- }, `Angle${t.angle}`),
2210
- /* @__PURE__ */ K(Q, {
2235
+ // src/RectangularSelectionConfig.tsx
2236
+ function er(e) {
2237
+ let { selection: n, updateSelection: r, disabled: i } = e;
2238
+ return /* @__PURE__ */ Y(t, { children: [
2239
+ /* @__PURE__ */ J(Jn, {
2240
+ selection: n,
2241
+ updateSelection: r,
2242
+ disabled: i
2243
+ }, `XInput${n._vStart.x}`),
2244
+ /* @__PURE__ */ J(Yn, {
2245
+ selection: n,
2246
+ updateSelection: r,
2247
+ disabled: i
2248
+ }, `YInput${n._vStart.y}`),
2249
+ /* @__PURE__ */ J(qn, {
2250
+ selection: n,
2251
+ updateSelection: r,
2252
+ disabled: i
2253
+ }, `Angle${n.angle}`),
2254
+ /* @__PURE__ */ J($, {
2211
2255
  label: "x length",
2212
- input: t.lengths[0],
2256
+ input: n.lengths[0],
2213
2257
  updateValue: (e) => {
2214
- if (n) {
2215
- let r = Yt.createFromSelection(t);
2216
- r.lengths = [e, t.lengths[1]], n(r);
2258
+ if (r) {
2259
+ let t = Yt.createFromSelection(n);
2260
+ t.lengths = [e, n.lengths[1]], r(t);
2217
2261
  }
2218
2262
  },
2219
2263
  decimalPlaces: 8,
2220
- isValid: (e) => Y(e),
2221
- disabled: r
2222
- }, `XLength${t.lengths[0]}`),
2223
- /* @__PURE__ */ K(Q, {
2264
+ isValid: (e) => Ct(e),
2265
+ disabled: i
2266
+ }, `XLength${n.lengths[0]}`),
2267
+ /* @__PURE__ */ J($, {
2224
2268
  label: "y length",
2225
- input: t.lengths[1],
2269
+ input: n.lengths[1],
2226
2270
  updateValue: (e) => {
2227
- if (n) {
2228
- let r = Yt.createFromSelection(t);
2229
- r.lengths = [t.lengths[0], e], n(r);
2271
+ if (r) {
2272
+ let t = Yt.createFromSelection(n);
2273
+ t.lengths = [n.lengths[0], e], r(t);
2230
2274
  }
2231
2275
  },
2232
2276
  decimalPlaces: 8,
2233
- isValid: (e) => Y(e),
2234
- disabled: r
2235
- }, `YLength${t.lengths[1]}`)
2277
+ isValid: (e) => Ct(e),
2278
+ disabled: i
2279
+ }, `YLength${n.lengths[1]}`)
2236
2280
  ] }, "rectangle");
2237
2281
  }
2238
- var Zn = { scrollContainer: "_scrollContainer_a4950_1" };
2239
- //#endregion
2240
- //#region src/PolygonalSelectionConfig.tsx
2241
- function Qn(e) {
2282
+ var tr = { scrollContainer: "_scrollContainer_a4950_1" };
2283
+ // src/PolygonalSelectionConfig.tsx
2284
+ function nr(e) {
2242
2285
  let { selection: t, updateSelection: n, disabled: r } = e;
2243
2286
  function i(e, r) {
2244
2287
  if (n) {
@@ -2248,25 +2291,24 @@ function Qn(e) {
2248
2291
  a.points = i, n(a);
2249
2292
  }
2250
2293
  }
2251
- let a = t.points.map((e, t) => [/* @__PURE__ */ K(Kn, {
2294
+ let a = t.points.map((e, t) => [/* @__PURE__ */ J(Xn, {
2252
2295
  i: t,
2253
2296
  point: e,
2254
2297
  updatePoint: (e) => i(e, t),
2255
2298
  disabled: r
2256
- }, `px${t}${e[0]}`), /* @__PURE__ */ K(qn, {
2299
+ }, `px${t}${e[0]}`), /* @__PURE__ */ J(Zn, {
2257
2300
  i: t,
2258
2301
  point: e,
2259
2302
  updatePoint: (e) => i(e, t),
2260
2303
  disabled: r
2261
2304
  }, `py${t}${e[1]}`)]);
2262
- return /* @__PURE__ */ K("div", {
2263
- className: Zn.scrollContainer,
2305
+ return /* @__PURE__ */ J("div", {
2306
+ className: tr.scrollContainer,
2264
2307
  children: a.flat()
2265
2308
  }, "polygon");
2266
2309
  }
2267
- //#endregion
2268
- //#region src/SelectionConfig.tsx
2269
- var $n = {
2310
+ // src/SelectionConfig.tsx
2311
+ var rr = {
2270
2312
  line: "—",
2271
2313
  rectangle: "▭",
2272
2314
  polyline: "⦚",
@@ -2278,102 +2320,101 @@ var $n = {
2278
2320
  verticalAxis: "↕",
2279
2321
  unknown: " "
2280
2322
  };
2281
- function er(e) {
2282
- let { currentSelectionID: t, updateCurrentSelectionID: n, selections: i, updateSelection: a, hasBaton: o } = e, s = R(() => {
2283
- if (t) {
2284
- let e = i.find((e) => e.id === t);
2323
+ function ir(e) {
2324
+ let { currentSelectionID: n, updateCurrentSelectionID: i, selections: a, updateSelection: o, hasBaton: s } = e, c = r(() => {
2325
+ if (n) {
2326
+ let e = a.find((e) => e.id === n);
2285
2327
  if (e) {
2286
- let r;
2287
- if (Object.hasOwn(i, "findLast")) r = i.findLast((e) => e.id !== t);
2328
+ let t;
2329
+ if (Object.hasOwn(a, "findLast")) t = a.findLast((e) => e.id !== n);
2288
2330
  else {
2289
- let e = i.filter((e) => e.id !== t), n = e.length - 1;
2290
- n >= 0 && (r = e[n]);
2331
+ let e = a.filter((e) => e.id !== n), r = e.length - 1;
2332
+ r >= 0 && (t = e[r]);
2291
2333
  }
2292
- a && a(e, !1, !0), r && n(r.id);
2334
+ o && o(e, !1, !0), t && i(t.id);
2293
2335
  }
2294
2336
  }
2295
2337
  }, [
2296
- t,
2297
- i,
2298
2338
  n,
2299
- a
2300
- ]), c = [];
2301
- if (t && i.length > 0) {
2302
- let e = i.find((e) => e.id === t) ?? i[0];
2303
- c.push(/* @__PURE__ */ K("h4", { children: ln(e, $n) }, `ID${t}`)), c.push(/* @__PURE__ */ q(L, { children: [
2304
- /* @__PURE__ */ K("div", {
2305
- className: Fn.colourLabel,
2339
+ a,
2340
+ i,
2341
+ o
2342
+ ]), l = [];
2343
+ if (n && a.length > 0) {
2344
+ let e = a.find((e) => e.id === n) ?? a[0];
2345
+ l.push(/* @__PURE__ */ J("h4", { children: ln(e, rr) }, `ID${n}`)), l.push(/* @__PURE__ */ Y(t, { children: [
2346
+ /* @__PURE__ */ J("div", {
2347
+ className: zn.colourLabel,
2306
2348
  style: { borderLeftColor: e.colour },
2307
2349
  children: e.colour
2308
2350
  }, `Colour${e.colour}`),
2309
- /* @__PURE__ */ K("br", {}, "colour spacer"),
2310
- o && /* @__PURE__ */ K(Ke, {
2351
+ /* @__PURE__ */ J("br", {}, "colour spacer"),
2352
+ s && /* @__PURE__ */ J(Ue, {
2311
2353
  color: e.colour,
2312
2354
  onChange: (t) => {
2313
- if (a) {
2355
+ if (o) {
2314
2356
  let n = $t(e);
2315
- n && (n.colour = t, a(n));
2357
+ n && (n.colour = t, o(n));
2316
2358
  }
2317
2359
  }
2318
2360
  }, `Picker${e.colour}`)
2319
2361
  ] }, "colour"));
2320
- let n = !o;
2321
- c.push(/* @__PURE__ */ K(Q, {
2362
+ let r = !s;
2363
+ l.push(/* @__PURE__ */ J($, {
2322
2364
  label: "name",
2323
2365
  input: e.name,
2324
2366
  updateValue: (t) => {
2325
- if (a) {
2367
+ if (o) {
2326
2368
  let n = $t(e);
2327
- n && (n.name = t, a(n));
2369
+ n && (n.name = t, o(n));
2328
2370
  }
2329
2371
  },
2330
- disabled: n
2331
- }, `Name${e.name}`)), c.push(/* @__PURE__ */ K(Q, {
2372
+ disabled: r
2373
+ }, `Name${e.name}`)), l.push(/* @__PURE__ */ J($, {
2332
2374
  label: "alpha",
2333
2375
  input: e.alpha,
2334
2376
  updateValue: (t) => {
2335
- if (t <= 1 && t >= 0 && a) {
2377
+ if (t <= 1 && t >= 0 && o) {
2336
2378
  let n = $t(e);
2337
- n && (n.alpha = t, a(n));
2379
+ n && (n.alpha = t, o(n));
2338
2380
  }
2339
2381
  },
2340
2382
  decimalPlaces: 2,
2341
- isValid: (e) => Et(e, 1, !0),
2342
- disabled: n
2343
- }, `Alpha${e.alpha}`)), Ht.isShape(e) ? c.push(Jn({
2383
+ isValid: (e) => Tt(e, 1, !0),
2384
+ disabled: r
2385
+ }, `Alpha${e.alpha}`)), Ht.isShape(e) ? l.push(Qn({
2344
2386
  selection: e,
2345
- updateSelection: a,
2346
- disabled: n
2347
- })) : qt.isShape(e) ? c.push(Yn({
2387
+ updateSelection: o,
2388
+ disabled: r
2389
+ })) : qt.isShape(e) ? l.push($n({
2348
2390
  selection: e,
2349
- updateSelection: a,
2350
- disabled: n
2351
- })) : Yt.isShape(e) ? c.push(Xn({
2391
+ updateSelection: o,
2392
+ disabled: r
2393
+ })) : Yt.isShape(e) ? l.push(er({
2352
2394
  selection: e,
2353
- updateSelection: a,
2354
- disabled: n
2355
- })) : Jt.isShape(e) && c.push(Qn({
2395
+ updateSelection: o,
2396
+ disabled: r
2397
+ })) : Jt.isShape(e) && l.push(nr({
2356
2398
  selection: e,
2357
- updateSelection: a,
2358
- disabled: n
2359
- })), c.push(/* @__PURE__ */ K(r, {
2399
+ updateSelection: o,
2400
+ disabled: r
2401
+ })), l.push(/* @__PURE__ */ J(f, {
2360
2402
  label: "Clear Selection",
2361
- disabled: n,
2403
+ disabled: r || e.permanent,
2362
2404
  onClick: () => {
2363
- window.confirm("Clear selection?") && s();
2405
+ window.confirm("Clear selection?") && c();
2364
2406
  }
2365
2407
  }, "clear selection"));
2366
2408
  }
2367
- return Pn({
2409
+ return Rn({
2368
2410
  title: "Selections",
2369
2411
  showModeless: e.showSelectionConfig,
2370
2412
  setShowModeless: e.updateShowSelectionConfig,
2371
- children: c
2413
+ children: l
2372
2414
  });
2373
2415
  }
2374
- //#endregion
2375
- //#region src/SelectionIDDropdown.tsx
2376
- function tr(e) {
2416
+ // src/SelectionIDDropdown.tsx
2417
+ function ar(e) {
2377
2418
  let { selectionID: t, onSelectionIDChange: n, options: r = e.selections.map((e) => e.id) } = e;
2378
2419
  t === "" && e.selections.length > 0 && (console.log("Setting selectionID to default selection: ", e.selections[0]), n(e.selections[0].id));
2379
2420
  function i(t) {
@@ -2384,14 +2425,14 @@ function tr(e) {
2384
2425
  backgroundColor: t.data.bgcolour
2385
2426
  }) }, o = r.map((t) => ({
2386
2427
  value: t,
2387
- label: un(e.selections, t, $n),
2428
+ label: un(e.selections, t, rr),
2388
2429
  bgcolour: i(t)
2389
2430
  }));
2390
- return /* @__PURE__ */ K(Xe, {
2431
+ return /* @__PURE__ */ J(qe, {
2391
2432
  styles: a,
2392
2433
  value: {
2393
2434
  value: t,
2394
- label: un(e.selections, t, $n),
2435
+ label: un(e.selections, t, rr),
2395
2436
  bgcolour: i(t ?? "")
2396
2437
  },
2397
2438
  options: o,
@@ -2400,266 +2441,269 @@ function tr(e) {
2400
2441
  }
2401
2442
  });
2402
2443
  }
2403
- //#endregion
2404
- //#region src/PlotToolbar.tsx
2405
- function nr(e) {
2406
- return Cn({
2444
+ // src/PlotToolbar.tsx
2445
+ function or(e) {
2446
+ return Dn({
2407
2447
  title: "Set title",
2408
- icon: we,
2409
- children: /* @__PURE__ */ K(Q, {
2448
+ icon: Se,
2449
+ children: /* @__PURE__ */ J($, {
2410
2450
  label: "title-label",
2411
2451
  input: e.label ?? "",
2412
2452
  updateValue: e.setLabel
2413
2453
  }, "title-label")
2414
2454
  });
2415
2455
  }
2416
- function rr(e) {
2417
- let { children: n } = e, r = yn(), { plotType: a, updateSelection: o } = r, { selections: s, canSelect: c, setCurrentLineKey: l } = r, [u, d] = H(null), f = B(() => c && s.length > 0 ? s[s.length - 1].id : null, [c, s]);
2418
- f && u === null && (console.log("Setting first selection", f), d(f));
2419
- let [p, m] = H(!1), [h, g] = H(!1), _ = r.batonProps.hasBaton, v = c && _;
2420
- if (c) {
2421
- if (s.map((e) => mn(e)), u === null) {
2422
- if (s.length > 0) {
2423
- let e = s[s.length - 1];
2424
- console.log("Setting current selection", e.id), d(e.id), p && hn(e);
2456
+ function sr(e) {
2457
+ let { batonProps: n } = vn(), { children: i } = e, o = Q(), { plotType: c, canEditSelections: d, updateSelection: f, selections: m, canSelect: h, setCurrentLineKey: g } = o, [_, v] = l(null), y = s(() => h && m.length > 0 ? m[m.length - 1].id : null, [h, m]);
2458
+ y && _ === null && (console.log("Setting first selection", y), v(y));
2459
+ let [b, x] = l(!1), [S, C] = l(!1), w = n.hasBaton, T = h && w;
2460
+ if (h) {
2461
+ if (m.map((e) => mn(e)), _ === null) {
2462
+ if (m.length > 0) {
2463
+ let e = m[m.length - 1];
2464
+ console.log("Setting current selection", e.id), v(e.id), b && hn(e);
2425
2465
  }
2426
- } else if (p) {
2427
- let e = s.find((e) => e.id === u);
2466
+ } else if (b) {
2467
+ let e = m.find((e) => e.id === _);
2428
2468
  e && hn(e);
2429
2469
  }
2430
2470
  }
2431
- let y = a === "Line", b = a === "Heatmap", x = b || a === "Image", S = a === "Surface", C = a === "Scatter", w = C || b || S, T = [
2432
- kn({
2471
+ let E = c === "Line", D = c === "Heatmap", O = D || c === "Image", k = c === "Surface", A = c === "Scatter", j = A || D || k, M = [
2472
+ Nn({
2433
2473
  title: "X axis",
2434
- icon: Me,
2435
- label: r.xLabel,
2436
- setLabel: r.setXLabel,
2437
- scaleType: r.xScaleType,
2438
- scaleOptions: t,
2439
- setScaleType: r.setXScaleType,
2440
- domain: r.xDomain,
2441
- customDomain: r.xCustomDomain,
2442
- setCustomDomain: r.setXCustomDomain
2474
+ icon: ke,
2475
+ label: o.xLabel,
2476
+ setLabel: o.setXLabel,
2477
+ scaleType: o.xScaleType,
2478
+ scaleOptions: u,
2479
+ setScaleType: o.setXScaleType,
2480
+ domain: o.xDomain,
2481
+ customDomain: o.xCustomDomain,
2482
+ setCustomDomain: o.setXCustomDomain
2443
2483
  }),
2444
- kn({
2484
+ Nn({
2445
2485
  title: "Y axis",
2446
- icon: Ne,
2447
- label: r.yLabel,
2448
- setLabel: r.setYLabel,
2449
- scaleType: r.yScaleType,
2450
- scaleOptions: t,
2451
- setScaleType: r.setYScaleType,
2452
- domain: r.yDomain,
2453
- customDomain: r.yCustomDomain,
2454
- setCustomDomain: r.setYCustomDomain
2486
+ icon: Ae,
2487
+ label: o.yLabel,
2488
+ setLabel: o.setYLabel,
2489
+ scaleType: o.yScaleType,
2490
+ scaleOptions: u,
2491
+ setScaleType: o.setYScaleType,
2492
+ domain: o.yDomain,
2493
+ customDomain: o.yCustomDomain,
2494
+ setCustomDomain: o.setYCustomDomain
2455
2495
  }),
2456
- wn({
2457
- aspect: r.aspect,
2458
- setAspect: r.setAspect,
2459
- hideToggle: !x
2496
+ On({
2497
+ aspect: o.aspect,
2498
+ setAspect: o.setAspect,
2499
+ hideToggle: !O
2460
2500
  }),
2461
- nr({
2462
- label: r.title,
2463
- setLabel: r.setTitle
2501
+ or({
2502
+ label: o.title,
2503
+ setLabel: o.setTitle
2464
2504
  }),
2465
- /* @__PURE__ */ K(ee, {
2505
+ /* @__PURE__ */ J(ee, {
2466
2506
  label: "Grid toggle",
2467
- Icon: De,
2468
- value: r.showGrid,
2469
- onToggle: r.toggleShowGrid
2507
+ Icon: Te,
2508
+ value: o.showGrid,
2509
+ onToggle: o.toggleShowGrid
2470
2510
  }, "Grid toggle"),
2471
- An({ ...r.batonProps })
2472
- ], E = [], D = B(() => {
2473
- let e = r.selectionOptions;
2511
+ Pn({ ...n })
2512
+ ], N = [], P = s(() => {
2513
+ let e = o.selectionOptions;
2474
2514
  if (e !== void 0) return Object.keys(e).map((e) => Xt(e));
2475
- }, [r.selectionOptions]), k = D === void 0 || D.length !== 0, A = r.selectionType;
2476
- c && r.selectionType !== void 0 && (A === Z.unknown && D === void 0 && (A = Z.line), k && E.push(/* @__PURE__ */ K(Hn, {
2477
- value: A,
2478
- onSelectionTypeChange: r.setSelectionType,
2479
- disabled: r.mode !== X.selectRegion,
2480
- options: D
2481
- }, "Selection type"))), z(() => {
2482
- k && r.setSelectionType(A);
2515
+ }, [o.selectionOptions]), F = P === void 0 || P.length !== 0, I = o.selectionType;
2516
+ h && o.selectionType !== void 0 && (I === Z.unknown && P === void 0 && (I = Z.line), F && N.push(/* @__PURE__ */ J(Kn, {
2517
+ value: I,
2518
+ onSelectionTypeChange: o.setSelectionType,
2519
+ disabled: o.mode !== X.selectRegion,
2520
+ options: P
2521
+ }, "Selection type"))), a(() => {
2522
+ F && o.setSelectionType(I);
2483
2523
  }, [
2484
- k,
2485
- A,
2486
- r
2524
+ F,
2525
+ I,
2526
+ o
2487
2527
  ]);
2488
- let j = r.allLineParams, ne = R((e) => {
2489
- j.has(e) && l(e), g(!0);
2490
- }, [j, l]);
2491
- E.push(/* @__PURE__ */ K(ee, {
2528
+ let R = o.allLineParams, z = r((e) => {
2529
+ R.has(e) && g(e), C(!0);
2530
+ }, [R, g]);
2531
+ N.push(/* @__PURE__ */ J(ee, {
2492
2532
  label: "Show points",
2493
- Icon: Fe,
2533
+ Icon: Me,
2494
2534
  iconOnly: !0,
2495
- value: r.showPoints,
2496
- onToggle: r.toggleShowPoints,
2497
- hidden: !S
2498
- }, "show points")), S && E.push(/* @__PURE__ */ K(O, {}, "Show point separator")), E.push(kn({
2535
+ value: o.showPoints,
2536
+ onToggle: o.toggleShowPoints,
2537
+ hidden: !k
2538
+ }, "show points")), k && N.push(/* @__PURE__ */ J(L, {}, "Show point separator")), N.push(Nn({
2499
2539
  title: "Colour mapping",
2500
- scaleType: r.dScaleType,
2501
- setScaleType: r.setDScaleType,
2502
- scaleOptions: i,
2503
- colourMap: r.colourMap,
2504
- setColourMap: r.setColourMap,
2505
- invertColourMap: r.invertColourMap,
2506
- toggleColourMapInversion: r.toggleInvertColourMap,
2507
- domain: r.dDomain,
2508
- customDomain: r.dCustomDomain,
2509
- setCustomDomain: r.setDCustomDomain,
2510
- histogramGetter: r.histogramGetter,
2511
- scatterPointSize: C ? r.scatterPointSize : void 0,
2512
- setScatterPointSize: r.setScatterPointSize,
2513
- hasBaton: _,
2514
- hideToggle: !w
2515
- })), w && E.push(/* @__PURE__ */ K(O, {}, "Colour mapping separator"));
2516
- let M = [];
2517
- j.size && (console.log("Add line key dropdown", [...j.keys()]), M.push(/* @__PURE__ */ K(Rn, {
2518
- allLineParams: j,
2519
- lineKey: r.currentLineKey,
2520
- onLineKeyChange: ne
2540
+ scaleType: o.dScaleType,
2541
+ setScaleType: o.setDScaleType,
2542
+ scaleOptions: p,
2543
+ colourMap: o.colourMap,
2544
+ setColourMap: o.setColourMap,
2545
+ invertColourMap: o.invertColourMap,
2546
+ toggleColourMapInversion: o.toggleInvertColourMap,
2547
+ domain: o.dDomain,
2548
+ customDomain: o.dCustomDomain,
2549
+ setCustomDomain: o.setDCustomDomain,
2550
+ histogramGetter: o.histogramGetter,
2551
+ scatterPointSize: A ? o.scatterPointSize : void 0,
2552
+ setScatterPointSize: o.setScatterPointSize,
2553
+ hasBaton: w,
2554
+ hideToggle: !j
2555
+ })), j && N.push(/* @__PURE__ */ J(L, {}, "Colour mapping separator"));
2556
+ let B = [];
2557
+ R.size && (console.log("Add line key dropdown", [...R.keys()]), B.push(/* @__PURE__ */ J(Hn, {
2558
+ allLineParams: R,
2559
+ lineKey: o.currentLineKey,
2560
+ onLineKeyChange: z
2521
2561
  }, "key dropdown")));
2522
- let N = R((e) => {
2523
- if (c) {
2524
- let t = s.find((t) => t.id === e);
2525
- t !== void 0 && (d(e), c && o(t)), m(!0);
2562
+ let H = r((e) => {
2563
+ if (h) {
2564
+ let t = m.find((t) => t.id === e);
2565
+ t !== void 0 && (v(e), h && d && f(t)), x(!0);
2526
2566
  }
2527
2567
  }, [
2528
- c,
2529
- s,
2530
- o
2568
+ h,
2569
+ m,
2570
+ f,
2571
+ d
2531
2572
  ]);
2532
- return c && s.length > 0 && (M.push(/* @__PURE__ */ K(tr, {
2533
- selections: s,
2534
- selectionID: u,
2535
- onSelectionIDChange: N
2536
- }, "ID dropdown")), M.push(/* @__PURE__ */ K(jn, {
2537
- updateSelection: o,
2538
- updateCurrentSelectionID: d,
2539
- disabled: !v
2540
- }, "Clear all selections"))), /* @__PURE__ */ q(te, {
2541
- overflowChildren: T.concat(M),
2573
+ if (h && m.length > 0) {
2574
+ B.push(/* @__PURE__ */ J(ar, {
2575
+ selections: m,
2576
+ selectionID: _,
2577
+ onSelectionIDChange: H
2578
+ }, "ID dropdown"));
2579
+ let e = m.filter((e) => e.permanent).length, t = m.length - e, n = e === 0 ? "Clear all selections?" : t === 1 ? "Clear single selection?" : `Clear ${t}/${m.length} selections?`;
2580
+ B.push(/* @__PURE__ */ J(Fn, {
2581
+ updateSelection: d ? f : void 0,
2582
+ updateCurrentSelectionID: v,
2583
+ disabled: !T || t === 0,
2584
+ popupText: n
2585
+ }, "Clear all selections"));
2586
+ }
2587
+ return /* @__PURE__ */ Y(V, {
2588
+ overflowChildren: M.concat(B),
2542
2589
  children: [
2543
- /* @__PURE__ */ K(Mn, {
2544
- value: r.mode,
2545
- onModeChange: r.setMode,
2546
- hasBaton: v,
2547
- canSelect: k
2590
+ /* @__PURE__ */ J(In, {
2591
+ value: o.mode,
2592
+ onModeChange: o.setMode,
2593
+ hasBaton: T,
2594
+ canSelect: F
2548
2595
  }, "Interaction toggle"),
2549
- c && k && /* @__PURE__ */ K(O, {}, "Interaction separator"),
2550
- E,
2551
- c && /* @__PURE__ */ K(L, { children: /* @__PURE__ */ K(er, {
2552
- selections: s,
2553
- updateSelection: o,
2554
- currentSelectionID: u,
2555
- updateCurrentSelectionID: d,
2556
- icon: je,
2557
- domain: r.dDomain,
2558
- customDomain: r.dCustomDomain,
2559
- showSelectionConfig: p,
2560
- updateShowSelectionConfig: m,
2561
- hasBaton: v
2596
+ h && F && /* @__PURE__ */ J(L, {}, "Interaction separator"),
2597
+ N,
2598
+ h && /* @__PURE__ */ J(t, { children: /* @__PURE__ */ J(ir, {
2599
+ selections: m,
2600
+ updateSelection: d ? f : void 0,
2601
+ currentSelectionID: _,
2602
+ updateCurrentSelectionID: v,
2603
+ showSelectionConfig: b,
2604
+ updateShowSelectionConfig: x,
2605
+ hasBaton: T
2562
2606
  }) }, "Selection config"),
2563
- y && /* @__PURE__ */ K(L, { children: /* @__PURE__ */ K(Ln, {
2564
- allLineParams: j,
2565
- updateLineParams: r.updateLineParams,
2566
- currentLineKey: r.currentLineKey,
2567
- showLineConfig: h,
2568
- updateShowLineConfig: g,
2569
- hasBaton: _
2607
+ E && /* @__PURE__ */ J(t, { children: /* @__PURE__ */ J(Vn, {
2608
+ allLineParams: R,
2609
+ updateLineParams: o.updateLineParams,
2610
+ currentLineKey: o.currentLineKey,
2611
+ showLineConfig: S,
2612
+ updateShowLineConfig: C,
2613
+ hasBaton: w
2570
2614
  }) }, "Line config"),
2571
- n
2615
+ i
2572
2616
  ]
2573
2617
  });
2574
2618
  }
2575
- function ir(e) {
2576
- return e.children !== null && (e.children === void 0 ? /* @__PURE__ */ K(rr, { children: e.extraChildren }) : /* @__PURE__ */ K(te, { children: e.children }));
2577
- }
2578
- //#endregion
2579
- //#region src/HeatmapPlot.tsx
2580
- function ar({ xValues: e, yValues: t, values: n }) {
2581
- let { title: r, showGrid: i, xLabel: a, yLabel: o, mode: s, aspect: c, batonProps: l, canSelect: u, selectionMax: d, selectionType: f, updateSelection: p, selections: m, dDomain: h, dCustomDomain: g, colourMap: v, invertColourMap: y, dScaleType: b, updateHistogramGetter: x } = yn(), S = Ot(s);
2582
- return z(() => {
2583
- x(() => At(n.data, h, v, y));
2619
+ function cr(e) {
2620
+ return e.children !== null && (e.children === void 0 ? /* @__PURE__ */ J(sr, { children: e.extraChildren }) : /* @__PURE__ */ J(V, { children: e.children }));
2621
+ }
2622
+ var lr = {
2623
+ any_plot: "_any_plot_v4794_1",
2624
+ plot_container: "_plot_container_v4794_14",
2625
+ table_container: "_table_container_v4794_29"
2626
+ };
2627
+ // src/HeatmapPlot.tsx
2628
+ function ur({ xValues: e, yValues: t, values: n }) {
2629
+ let { title: r, showGrid: i, xLabel: o, yLabel: s, mode: c, aspect: l, canSelect: u, selectionMax: d, selectionType: f, updateSelection: p, selections: m, dDomain: h, dCustomDomain: g, colourMap: _, invertColourMap: v, dScaleType: y, updateHistogramGetter: b } = Q(), x = Dt(c);
2630
+ return a(() => {
2631
+ b(() => At(n.data, h, _, v));
2584
2632
  }, [
2585
2633
  n.data,
2586
2634
  h,
2635
+ _,
2587
2636
  v,
2588
- y,
2589
- x
2590
- ]), /* @__PURE__ */ K(_, {
2637
+ b
2638
+ ]), /* @__PURE__ */ J(E, {
2591
2639
  dataArray: n,
2592
- domain: P(g, h),
2593
- colorMap: v,
2594
- invertColorMap: y,
2595
- scaleType: b,
2596
- aspect: c,
2640
+ domain: U(g, h),
2641
+ colorMap: _,
2642
+ invertColorMap: v,
2643
+ scaleType: y,
2644
+ aspect: l,
2597
2645
  showGrid: i,
2598
2646
  title: r,
2599
2647
  abscissaParams: {
2600
- label: a,
2648
+ label: o,
2601
2649
  value: e?.data
2602
2650
  },
2603
2651
  ordinateParams: {
2604
- label: o,
2652
+ label: s,
2605
2653
  value: t?.data
2606
2654
  },
2607
- interactions: S,
2655
+ interactions: x,
2608
2656
  flipYAxis: !0,
2609
- children: u && /* @__PURE__ */ K(gn, {
2657
+ children: u && /* @__PURE__ */ J(bn, {
2610
2658
  modifierKey: [],
2611
- disabled: s !== X.selectRegion,
2659
+ disabled: c !== X.selectRegion,
2612
2660
  selectionMax: d,
2613
2661
  selectionType: f,
2614
- batonProps: l,
2615
2662
  updateSelection: p,
2616
2663
  selections: m
2617
2664
  })
2618
2665
  });
2619
2666
  }
2620
- function or(e) {
2621
- return /* @__PURE__ */ K("div", {
2622
- style: {
2623
- display: "grid",
2624
- position: "relative"
2625
- },
2626
- children: /* @__PURE__ */ q(xn, {
2627
- ...e,
2628
- children: [/* @__PURE__ */ K(ir, { children: e.customToolbarChildren }), /* @__PURE__ */ K(ar, {
2629
- xValues: e.plotConfig.xValues,
2630
- yValues: e.plotConfig.yValues,
2631
- values: e.values
2632
- })]
2633
- })
2667
+ function dr(e) {
2668
+ return /* @__PURE__ */ J("div", {
2669
+ className: lr.plot_container,
2670
+ children: /* @__PURE__ */ J(wn, { children: /* @__PURE__ */ J(fr, { ...e }) })
2634
2671
  });
2635
2672
  }
2636
- //#endregion
2637
- //#region src/ImagePlot.tsx
2638
- var sr = {
2673
+ function fr(e) {
2674
+ let { updateHeatmapContext: t, updateSelectionContext: n } = Q();
2675
+ return n(e), t(e, e.plotConfig), /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(cr, { children: e.customToolbarChildren }), /* @__PURE__ */ J(ur, {
2676
+ xValues: e.plotConfig.xValues,
2677
+ yValues: e.plotConfig.yValues,
2678
+ values: e.values
2679
+ })] });
2680
+ }
2681
+ // src/ImagePlot.tsx
2682
+ var pr = {
2639
2683
  left: 80,
2640
2684
  right: 24,
2641
2685
  top: 16,
2642
2686
  bottom: 34
2643
- }, cr = 28, lr = 24;
2644
- function ur(e = {}) {
2645
- let { left: t, right: n, top: r, bottom: i } = sr;
2687
+ }, mr = 28, hr = 24;
2688
+ function gr(e = {}) {
2689
+ let { left: t, right: n, top: r, bottom: i } = pr;
2646
2690
  return {
2647
- left: t + (e.left ? lr : 0),
2691
+ left: t + (e.left ? hr : 0),
2648
2692
  right: n,
2649
- top: r + (e.top ? cr : 0),
2650
- bottom: i + (e.bottom ? lr : 0)
2693
+ top: r + (e.top ? mr : 0),
2694
+ bottom: i + (e.bottom ? hr : 0)
2651
2695
  };
2652
2696
  }
2653
- function dr(e) {
2697
+ function _r(e) {
2654
2698
  let t = e.shape;
2655
- if (t.length == 2) return tt(et(e), [
2699
+ if (t.length == 2) return Qe(Ze(e), [
2656
2700
  1,
2657
2701
  1,
2658
2702
  3
2659
2703
  ]);
2660
2704
  if (t.length == 3) {
2661
2705
  let n = t[2];
2662
- if (n == 1) return tt(e, [
2706
+ if (n == 1) return Qe(e, [
2663
2707
  1,
2664
2708
  1,
2665
2709
  3
@@ -2668,10 +2712,10 @@ function dr(e) {
2668
2712
  }
2669
2713
  return console.log("Shape of array is not compatible with RGB array:", t), null;
2670
2714
  }
2671
- function fr({ xValues: e, yValues: t, values: n }) {
2672
- let { title: r, showGrid: i, xLabel: a, yLabel: o, mode: s, aspect: c, batonProps: l, canSelect: u, selectionMax: d, selectionType: f, updateSelection: p, selections: m } = yn(), h = Ot(s), g = dr(n);
2673
- return g && /* @__PURE__ */ K(S, {
2674
- dataArray: g,
2715
+ function vr({ xValues: e, yValues: t, values: n }) {
2716
+ let { title: r, showGrid: i, xLabel: a, yLabel: o, mode: s, aspect: c, canSelect: l, selectionMax: u, selectionType: d, updateSelection: f, selections: p } = Q(), m = Dt(s), h = _r(n);
2717
+ return h && /* @__PURE__ */ J(j, {
2718
+ dataArray: h,
2675
2719
  aspect: c,
2676
2720
  showGrid: i,
2677
2721
  title: r,
@@ -2683,26 +2727,28 @@ function fr({ xValues: e, yValues: t, values: n }) {
2683
2727
  label: o,
2684
2728
  value: t?.data
2685
2729
  },
2686
- interactions: h,
2730
+ interactions: m,
2687
2731
  flipYAxis: !0,
2688
- children: u && /* @__PURE__ */ K(gn, {
2732
+ children: l && /* @__PURE__ */ J(bn, {
2689
2733
  modifierKey: [],
2690
2734
  disabled: s !== X.selectRegion,
2691
- selectionMax: d,
2692
- selectionType: f,
2693
- batonProps: l,
2694
- updateSelection: p,
2695
- selections: m
2735
+ selectionMax: u,
2736
+ selectionType: d,
2737
+ updateSelection: f,
2738
+ selections: p
2696
2739
  })
2697
2740
  });
2698
2741
  }
2699
- function pr(e) {
2700
- let t = V(null), n = V(null), [r, i] = H(), a = !(e.tightAxes && e.aspect == "equal");
2701
- return a && r != "auto" && i("auto"), me(() => {
2742
+ function yr(e) {
2743
+ return /* @__PURE__ */ J(wn, { children: /* @__PURE__ */ J(br, { ...e }) });
2744
+ }
2745
+ function br(e) {
2746
+ let t = c(null), n = c(null), [r, i] = l(), a = !(e.tightAxes && e.aspect == "equal");
2747
+ a && r != "auto" && i("auto"), o(() => {
2702
2748
  if (a) return;
2703
2749
  let o = () => {
2704
2750
  if (t.current == null) return;
2705
- let a = n.current?.offsetHeight || 0, o = t.current.offsetWidth, s = e.values.shape[1] / e.values.shape[0], c = ur({
2751
+ let a = n.current?.offsetHeight || 0, o = t.current.offsetWidth, s = e.values.shape[1] / e.values.shape[0], c = gr({
2706
2752
  left: !!e.plotConfig.yLabel,
2707
2753
  bottom: !!e.plotConfig.xLabel,
2708
2754
  top: !!e.plotConfig.title
@@ -2722,34 +2768,25 @@ function pr(e) {
2722
2768
  e.plotConfig.yLabel,
2723
2769
  r,
2724
2770
  i
2725
- ]), /* @__PURE__ */ K("div", {
2771
+ ]);
2772
+ let { updateImageContext: s, updateSelectionContext: u } = Q();
2773
+ return u(e), s(e, e.plotConfig), /* @__PURE__ */ Y("div", {
2726
2774
  ref: t,
2727
- style: {
2728
- aspectRatio: r,
2729
- display: "grid",
2730
- position: "relative",
2731
- minWidth: 0,
2732
- minHeight: 0,
2733
- maxHeight: "100%",
2734
- maxWidth: "100%"
2735
- },
2736
- children: /* @__PURE__ */ q(xn, {
2737
- ...e,
2738
- children: [/* @__PURE__ */ K("div", {
2739
- ref: n,
2740
- style: { minWidth: 0 },
2741
- children: /* @__PURE__ */ K(ir, { children: e.customToolbarChildren })
2742
- }), /* @__PURE__ */ K(fr, {
2743
- xValues: e.plotConfig.xValues,
2744
- yValues: e.plotConfig.yValues,
2745
- values: e.values
2746
- })]
2747
- })
2775
+ className: lr.plot_container,
2776
+ style: { aspectRatio: r },
2777
+ children: [/* @__PURE__ */ J("div", {
2778
+ ref: n,
2779
+ style: { minWidth: 0 },
2780
+ children: /* @__PURE__ */ J(cr, { children: e.customToolbarChildren })
2781
+ }), /* @__PURE__ */ J(vr, {
2782
+ xValues: e.plotConfig.xValues,
2783
+ yValues: e.plotConfig.yValues,
2784
+ values: e.values
2785
+ })]
2748
2786
  });
2749
2787
  }
2750
- //#endregion
2751
- //#region src/LinePlot.tsx
2752
- function mr(e, t, n) {
2788
+ // src/LinePlot.tsx
2789
+ function xr(e, t, n) {
2753
2790
  let r = [
2754
2791
  "rgb(0, 0, 0)",
2755
2792
  "rgb(0, 158, 115)",
@@ -2759,94 +2796,90 @@ function mr(e, t, n) {
2759
2796
  "rgb(0, 114, 178)",
2760
2797
  "rgb(213, 94, 0)",
2761
2798
  "rgb(204, 121, 167)"
2762
- ], i = !0, a = c.LineAndGlyphs;
2763
- t.pointSize ? t.lineOn || (a = c.GlyphsOnly) : (t.pointSize = 0, t.lineOn ? a = c.LineOnly : i = !1);
2799
+ ], i = !0, a = _.LineAndGlyphs;
2800
+ t.pointSize ? t.lineOn || (a = _.GlyphsOnly) : (t.pointSize = 0, t.lineOn ? a = _.LineOnly : i = !1);
2764
2801
  let o = t.colour ?? r[n % r.length];
2765
- return /* @__PURE__ */ K(l, {
2802
+ return /* @__PURE__ */ J(v, {
2766
2803
  abscissas: e.x.data,
2767
2804
  ordinates: e.y.data,
2768
2805
  color: o,
2769
2806
  curveType: a,
2770
- glyphType: t.glyphType ?? g.Circle,
2807
+ glyphType: t.glyphType ?? T.Circle,
2771
2808
  glyphSize: t.pointSize,
2772
2809
  width: t.width ?? 1,
2773
2810
  visible: i
2774
2811
  }, `data_curve_${n}`);
2775
2812
  }
2776
- function hr(e) {
2777
- let { title: t, showGrid: n, xCustomDomain: r, xDomain: i, xScaleType: a, xLabel: o, yCustomDomain: s, yDomain: c, yScaleType: l, yLabel: u, mode: f, allLineParams: p, setAllLineParams: m, currentLineKey: h, setCurrentLineKey: g, batonProps: _, canSelect: v, selectionMax: y, selectionType: b, updateSelection: S, selections: C } = yn(), w = e.lineData, T = B(() => {
2813
+ function Sr(e) {
2814
+ let { title: t, showGrid: n, xCustomDomain: r, xDomain: i, xScaleType: o, xLabel: c, yCustomDomain: l, yDomain: u, yScaleType: d, yLabel: f, mode: p, allLineParams: m, setAllLineParams: h, currentLineKey: g, setCurrentLineKey: _, canSelect: v, selectionMax: y, selectionType: x, updateSelection: S, selections: C } = Q(), w = e.lineData, T = s(() => {
2778
2815
  let e = /* @__PURE__ */ new Map();
2779
2816
  return w.forEach((t) => {
2780
2817
  e.set(t.key, t.lineParams);
2781
2818
  }), e;
2782
2819
  }, [w]);
2783
- z(() => {
2784
- if (h == null && T.size) {
2820
+ a(() => {
2821
+ if (g == null && T.size) {
2785
2822
  let e = T.keys().next().value;
2786
- g(e);
2823
+ _(e);
2787
2824
  }
2788
- m(T);
2825
+ h(T);
2789
2826
  }, [
2790
- h,
2827
+ g,
2791
2828
  T,
2792
- m,
2793
- g
2829
+ h,
2830
+ _
2794
2831
  ]);
2795
- let E = Ot(f), D = (e, t) => /* @__PURE__ */ q("p", { children: [
2832
+ let E = Dt(p), D = (e, t) => /* @__PURE__ */ Y("p", { children: [
2796
2833
  e.toPrecision(8),
2797
2834
  ", ",
2798
2835
  t.toPrecision(8)
2799
- ] }), O = B(() => P(r, i), [r, i]), k = B(() => P(s, c), [s, c]);
2800
- return /* @__PURE__ */ q(M, {
2836
+ ] }), O = s(() => U(r, i), [r, i]), k = s(() => U(l, u), [l, u]);
2837
+ return /* @__PURE__ */ Y(te, {
2801
2838
  title: t ?? "",
2802
2839
  abscissaConfig: {
2803
2840
  visDomain: O,
2804
2841
  showGrid: n,
2805
- scaleType: a,
2806
- label: o,
2842
+ scaleType: o,
2843
+ label: c,
2807
2844
  nice: !0
2808
2845
  },
2809
2846
  ordinateConfig: {
2810
2847
  visDomain: k,
2811
2848
  showGrid: n,
2812
- scaleType: l,
2813
- label: u,
2849
+ scaleType: d,
2850
+ label: f,
2814
2851
  nice: !0
2815
2852
  },
2816
2853
  children: [
2817
- /* @__PURE__ */ K(d, { ...E }),
2818
- /* @__PURE__ */ K(x, {}),
2819
- /* @__PURE__ */ K(ne, { renderTooltip: D }),
2820
- w.map((e, t) => mr(e, p.get(e.key) ?? e.lineParams, t)),
2821
- v && /* @__PURE__ */ K(gn, {
2854
+ /* @__PURE__ */ J(b, { ...E }),
2855
+ /* @__PURE__ */ J(A, {}),
2856
+ /* @__PURE__ */ J(H, { renderTooltip: D }),
2857
+ w.map((e, t) => xr(e, m.get(e.key) ?? e.lineParams, t)),
2858
+ v && /* @__PURE__ */ J(bn, {
2822
2859
  modifierKey: [],
2823
- batonProps: _,
2824
- disabled: f !== X.selectRegion,
2860
+ disabled: p !== X.selectRegion,
2825
2861
  selectionMax: y,
2826
- selectionType: b,
2862
+ selectionType: x,
2827
2863
  updateSelection: S,
2828
2864
  selections: C
2829
2865
  })
2830
2866
  ]
2831
2867
  });
2832
2868
  }
2833
- function gr(e) {
2834
- return /* @__PURE__ */ K("div", {
2835
- style: {
2836
- display: "grid",
2837
- position: "relative"
2838
- },
2839
- children: /* @__PURE__ */ q(xn, {
2840
- ...e,
2841
- children: [/* @__PURE__ */ K(ir, { children: e.customToolbarChildren }), /* @__PURE__ */ K(hr, { lineData: e.lineData })]
2842
- })
2869
+ function Cr(e) {
2870
+ return /* @__PURE__ */ J("div", {
2871
+ className: lr.plot_container,
2872
+ children: /* @__PURE__ */ J(wn, { children: /* @__PURE__ */ J(wr, { ...e }) })
2843
2873
  });
2844
2874
  }
2845
- //#endregion
2846
- //#region src/ScatterPlot.tsx
2847
- function _r({ x: e, y: t, values: n }) {
2848
- let { title: r, showGrid: i, xLabel: a, xScaleType: o, yLabel: s, yScaleType: c, mode: l, batonProps: u, canSelect: d, selectionMax: f, selectionType: p, updateSelection: m, selections: h, dDomain: g, dCustomDomain: _, colourMap: v, invertColourMap: y, dScaleType: b, scatterPointSize: x, updateHistogramGetter: S } = yn(), C = Ot(l);
2849
- return z(() => {
2875
+ function wr(e) {
2876
+ let { updateLineContext: t, updateSelectionContext: n } = Q();
2877
+ return n(e), t(e.xDomain, e.yDomain, e.plotConfig), /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(cr, { children: e.customToolbarChildren }), /* @__PURE__ */ J(Sr, { lineData: e.lineData })] });
2878
+ }
2879
+ // src/ScatterPlot.tsx
2880
+ function Tr({ x: e, y: t, values: n }) {
2881
+ let { title: r, showGrid: i, xLabel: o, xScaleType: s, yLabel: c, yScaleType: l, mode: u, canSelect: d, selectionMax: f, selectionType: p, updateSelection: m, selections: h, dDomain: g, dCustomDomain: _, colourMap: v, invertColourMap: y, dScaleType: b, scatterPointSize: x, updateHistogramGetter: S } = Q(), C = Dt(u);
2882
+ return a(() => {
2850
2883
  S(() => At(n.data, g, v, y));
2851
2884
  }, [
2852
2885
  n.data,
@@ -2854,9 +2887,9 @@ function _r({ x: e, y: t, values: n }) {
2854
2887
  v,
2855
2888
  y,
2856
2889
  S
2857
- ]), /* @__PURE__ */ K(E, {
2890
+ ]), /* @__PURE__ */ J(F, {
2858
2891
  dataArray: n,
2859
- domain: P(_, g),
2892
+ domain: U(_, g),
2860
2893
  colorMap: v,
2861
2894
  invertColorMap: y,
2862
2895
  scaleType: b,
@@ -2864,80 +2897,73 @@ function _r({ x: e, y: t, values: n }) {
2864
2897
  size: x,
2865
2898
  title: r,
2866
2899
  abscissaParams: {
2867
- label: a,
2900
+ label: o,
2868
2901
  value: e.data,
2869
- scaleType: o
2902
+ scaleType: s
2870
2903
  },
2871
2904
  ordinateParams: {
2872
- label: s,
2905
+ label: c,
2873
2906
  value: t.data,
2874
- scaleType: c
2907
+ scaleType: l
2875
2908
  },
2876
2909
  interactions: C,
2877
- children: d && /* @__PURE__ */ K(gn, {
2910
+ children: d && /* @__PURE__ */ J(bn, {
2878
2911
  modifierKey: [],
2879
- disabled: l !== X.selectRegion,
2912
+ disabled: u !== X.selectRegion,
2880
2913
  selectionMax: f,
2881
2914
  selectionType: p,
2882
- batonProps: u,
2883
2915
  updateSelection: m,
2884
2916
  selections: h
2885
2917
  })
2886
2918
  });
2887
2919
  }
2888
- function vr(e) {
2889
- return /* @__PURE__ */ K("div", {
2890
- style: {
2891
- display: "grid",
2892
- position: "relative"
2893
- },
2894
- children: /* @__PURE__ */ q(xn, {
2895
- ...e,
2896
- children: [/* @__PURE__ */ K(ir, { children: e.customToolbarChildren }), /* @__PURE__ */ K(_r, {
2897
- x: e.x,
2898
- y: e.y,
2899
- values: e.pointValues
2900
- })]
2901
- })
2920
+ function Er(e) {
2921
+ return /* @__PURE__ */ J("div", {
2922
+ className: lr.plot_container,
2923
+ children: /* @__PURE__ */ J(wn, { children: /* @__PURE__ */ J(Dr, { ...e }) })
2902
2924
  });
2903
2925
  }
2904
- //#endregion
2905
- //#region src/SurfacePlot.tsx
2906
- function yr(e) {
2907
- let { values: t, children: n } = e, { dDomain: r, dCustomDomain: i, colourMap: a, invertColourMap: o, dScaleType: s, showPoints: c, updateHistogramGetter: l } = yn(), u = B(() => P(i, r), [i, r]);
2908
- return z(() => {
2909
- l(() => At(t.data, r, a, o));
2926
+ function Dr(e) {
2927
+ let { updateScatterContext: t, updateSelectionContext: n } = Q();
2928
+ return n(e), t(e, e.plotConfig), /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(cr, { children: e.customToolbarChildren }), /* @__PURE__ */ J(Tr, {
2929
+ x: e.x,
2930
+ y: e.y,
2931
+ values: e.pointValues
2932
+ })] });
2933
+ }
2934
+ // src/SurfacePlot.tsx
2935
+ function Or(e) {
2936
+ let { values: t, children: n } = e, { dDomain: r, dCustomDomain: i, colourMap: o, invertColourMap: c, dScaleType: l, showPoints: u, updateHistogramGetter: d } = Q(), f = s(() => U(i, r), [i, r]);
2937
+ return a(() => {
2938
+ d(() => At(t.data, r, o, c));
2910
2939
  }, [
2911
2940
  t.data,
2912
2941
  r,
2913
- a,
2914
2942
  o,
2915
- l
2916
- ]), /* @__PURE__ */ q(k, {
2943
+ c,
2944
+ d
2945
+ ]), /* @__PURE__ */ Y(R, {
2917
2946
  dataArray: t,
2918
- domain: u,
2919
- colorMap: a,
2920
- invertColorMap: o,
2921
- scaleType: s,
2922
- showPoints: c,
2923
- children: [/* @__PURE__ */ K(nt, {}), n]
2947
+ domain: f,
2948
+ colorMap: o,
2949
+ invertColorMap: c,
2950
+ scaleType: l,
2951
+ showPoints: u,
2952
+ children: [/* @__PURE__ */ J($e, {}), n]
2924
2953
  });
2925
2954
  }
2926
- function br(e) {
2927
- return /* @__PURE__ */ K("div", {
2928
- style: {
2929
- display: "grid",
2930
- position: "relative"
2931
- },
2932
- children: /* @__PURE__ */ q(xn, {
2933
- ...e,
2934
- children: [/* @__PURE__ */ K(ir, { children: e.customToolbarChildren }), /* @__PURE__ */ K(yr, { values: e.heightValues })]
2935
- })
2955
+ function kr(e) {
2956
+ return /* @__PURE__ */ J("div", {
2957
+ className: lr.plot_container,
2958
+ children: /* @__PURE__ */ J(wn, { children: /* @__PURE__ */ J(Ar, { ...e }) })
2936
2959
  });
2937
2960
  }
2938
- //#endregion
2939
- //#region src/TableDisplay.tsx
2940
- function xr(e) {
2961
+ function Ar(e) {
2962
+ let { updateSurfaceContext: t } = Q();
2963
+ return t(e, e.plotConfig), /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(cr, { children: e.customToolbarChildren }), /* @__PURE__ */ J(Or, { values: e.heightValues })] });
2964
+ }
2965
+ // src/TableDisplay.tsx
2966
+ function jr(e) {
2941
2967
  function t(e, t) {
2942
2968
  let n = e === "standard";
2943
2969
  return new Intl.NumberFormat("en", {
@@ -2946,96 +2972,117 @@ function xr(e) {
2946
2972
  maximumSignificantDigits: n ? void 0 : Math.max(t, 1)
2947
2973
  });
2948
2974
  }
2949
- let [n, r] = H(e.displayParams?.displayType ?? "standard"), [i, o] = H(e.displayParams?.numberDigits ?? 2), [s, c] = H(e.cellWidth), [l, u] = H(null);
2950
- l ?? u(t(n, i));
2975
+ let [n, r] = l(e.displayParams?.displayType ?? "standard"), [i, a] = l(e.displayParams?.numberDigits ?? 2), [o, s] = l(e.cellWidth), [c, u] = l(null);
2976
+ c ?? u(t(n, i));
2951
2977
  function d(e) {
2952
2978
  r(e);
2953
2979
  }
2954
- return /* @__PURE__ */ q("div", {
2955
- style: {
2956
- display: "grid",
2957
- position: "relative"
2958
- },
2959
- children: [/* @__PURE__ */ q(te, { children: [
2960
- /* @__PURE__ */ K(a, {
2961
- value: s,
2980
+ return /* @__PURE__ */ Y("div", {
2981
+ className: `${lr.plot_container} ${lr.table_container}`,
2982
+ children: [/* @__PURE__ */ Y(V, { children: [
2983
+ /* @__PURE__ */ J(m, {
2984
+ value: o,
2962
2985
  defaultValue: 120,
2963
- onChange: c
2986
+ onChange: s
2964
2987
  }, "cell width input"),
2965
- /* @__PURE__ */ K(O, {}),
2966
- /* @__PURE__ */ q(j, {
2988
+ /* @__PURE__ */ J(L, {}),
2989
+ /* @__PURE__ */ Y(B, {
2967
2990
  role: "radiogroup",
2968
2991
  ariaLabel: "displayStyle",
2969
2992
  value: n,
2970
2993
  onChange: d,
2971
- children: [/* @__PURE__ */ K(j.Btn, {
2994
+ children: [/* @__PURE__ */ J(B.Btn, {
2972
2995
  label: "standard",
2973
2996
  value: "standard"
2974
- }), /* @__PURE__ */ K(j.Btn, {
2997
+ }), /* @__PURE__ */ J(B.Btn, {
2975
2998
  label: "scientific",
2976
2999
  value: "scientific"
2977
3000
  })]
2978
3001
  }, "display style toggle"),
2979
- /* @__PURE__ */ K(O, {}),
2980
- /* @__PURE__ */ K(Q, {
3002
+ /* @__PURE__ */ J(L, {}),
3003
+ /* @__PURE__ */ J($, {
2981
3004
  label: "digits",
2982
3005
  input: i,
2983
- isValid: (e) => Tt(e, n === "standard" ? 0 : 1, 10),
3006
+ isValid: (e) => wt(e, n === "standard" ? 0 : 1, 10),
2984
3007
  inputAttribs: {
2985
3008
  name: "digits",
2986
3009
  pattern: "^\\d$",
2987
3010
  size: 1
2988
3011
  },
2989
- updateValue: o
3012
+ updateValue: a
2990
3013
  }, "0"),
2991
- /* @__PURE__ */ K(O, {})
2992
- ] }), /* @__PURE__ */ K(y, {
2993
- cellWidth: s ?? 120,
3014
+ /* @__PURE__ */ J(L, {})
3015
+ ] }), /* @__PURE__ */ J(O, {
3016
+ cellWidth: o ?? 120,
2994
3017
  dims: e.cellValues.shape,
2995
3018
  cellFormatter: (t, n) => {
2996
3019
  let r = e.cellValues.get(t, n);
2997
- return l?.format(r) || "";
3020
+ return c?.format(r) || "";
2998
3021
  }
2999
3022
  })]
3000
3023
  });
3001
3024
  }
3002
- //#endregion
3003
- //#region src/AnyPlot.tsx
3004
- function Sr(e) {
3005
- let t = null;
3006
- return "lineData" in e && e.lineData.length !== 0 ? t = /* @__PURE__ */ K(hr, { lineData: e.lineData }) : "values" in e ? t = "heatmapScale" in e ? /* @__PURE__ */ K(ar, {
3025
+ // src/AnyPlot.tsx
3026
+ function Mr(e) {
3027
+ let { updateLineContext: t, updateHeatmapContext: n, updateImageContext: r, updateSelectionContext: i, updateSurfaceContext: o, updateScatterContext: s } = Q(), c = "lineData" in e && e.lineData.length !== 0, l = "heatmapScale" in e, u = !l && "values" in e, d = "heightValues" in e, f = "pointValues" in e, p = "cellWidth" in e;
3028
+ a(() => {
3029
+ if (!(d || p)) {
3030
+ let { canEditSelections: t, selections: n, selectionOptions: r, selectionsListener: a } = e, o = {
3031
+ canEditSelections: t,
3032
+ selections: n,
3033
+ selectionOptions: r,
3034
+ selectionsListener: a
3035
+ };
3036
+ Object.values(o).every((e) => e === void 0) || (console.log("USC", o), i(o));
3037
+ }
3038
+ }, [
3039
+ d,
3040
+ p,
3041
+ i,
3042
+ e
3043
+ ]), a(() => {
3044
+ c ? t(e.xDomain, e.yDomain, e.plotConfig) : l ? n(e, e.plotConfig) : u ? r(e, e.plotConfig) : d ? o(e, e.plotConfig) : f && s(e, e.plotConfig);
3045
+ }, [
3046
+ c,
3047
+ l,
3048
+ u,
3049
+ d,
3050
+ f,
3051
+ t,
3052
+ n,
3053
+ r,
3054
+ o,
3055
+ s,
3056
+ e
3057
+ ]);
3058
+ let m = null;
3059
+ return c ? m = /* @__PURE__ */ J(Sr, { lineData: e.lineData }) : l ? m = /* @__PURE__ */ J(ur, {
3007
3060
  xValues: e.plotConfig.xValues,
3008
3061
  yValues: e.plotConfig.yValues,
3009
3062
  values: e.values
3010
- }) : /* @__PURE__ */ K(fr, {
3063
+ }) : u ? m = /* @__PURE__ */ J(vr, {
3011
3064
  xValues: e.plotConfig.xValues,
3012
3065
  yValues: e.plotConfig.yValues,
3013
3066
  values: e.values
3014
- }) : "heightValues" in e ? t = /* @__PURE__ */ K(yr, { values: e.heightValues }) : "pointValues" in e && (t = /* @__PURE__ */ K(_r, {
3067
+ }) : d ? m = /* @__PURE__ */ J(Or, { values: e.heightValues }) : f ? m = /* @__PURE__ */ J(Tr, {
3015
3068
  x: e.x,
3016
3069
  y: e.y,
3017
3070
  values: e.pointValues
3018
- })), t;
3071
+ }) : p && (m = /* @__PURE__ */ J(jr, { ...e })), m;
3019
3072
  }
3020
- function Cr(t) {
3073
+ function Nr(t) {
3021
3074
  let n = jt();
3022
- return e(() => {
3075
+ e(() => {
3023
3076
  n.end();
3024
- }), "cellWidth" in t ? /* @__PURE__ */ K(xr, { ...t }) : /* @__PURE__ */ K("div", {
3025
- className: "any_plot",
3026
- style: {
3027
- display: "grid",
3028
- position: "relative"
3029
- },
3030
- children: /* @__PURE__ */ q(xn, {
3031
- ...t,
3032
- children: [/* @__PURE__ */ K(ir, { children: t.customToolbarChildren }), /* @__PURE__ */ K(Sr, { ...t })]
3033
- })
3077
+ });
3078
+ let r = "cellWidth" in t;
3079
+ return /* @__PURE__ */ J("div", {
3080
+ className: lr.any_plot,
3081
+ children: /* @__PURE__ */ Y(wn, { children: [!r && /* @__PURE__ */ J(cr, { children: t.customToolbarChildren }), /* @__PURE__ */ J(Mr, { ...t })] })
3034
3082
  });
3035
3083
  }
3036
- //#endregion
3037
- //#region src/ConnectedPlot.tsx
3038
- var { default: wr = st } = st, Tr = {
3084
+ // src/ConnectedPlot.tsx
3085
+ var { default: Pr = it } = it, Fr = {
3039
3086
  xScale: void 0,
3040
3087
  yScale: void 0,
3041
3088
  xLabel: void 0,
@@ -3044,90 +3091,136 @@ var { default: wr = st } = st, Tr = {
3044
3091
  yValues: void 0,
3045
3092
  title: void 0
3046
3093
  };
3047
- function Er({ plotId: t = "plot_0", hostname: n = "127.0.0.1", port: r = "80", source: i = void 0, events: a = [], uuid: o, tightAxes: s = !1, customToolbarChildren: c = void 0, depends_on: l = "" }) {
3048
- let [u, d] = H(), [f, p] = H([]), [m, h] = H(Tr), [g, _] = H(), [v, y] = H(), [b, x] = H(), S = V(""), C = l ? "/" + l : "", { sendMessage: w, lastMessage: T, readyState: E, getWebSocket: D } = wr(`ws://${n}:${r}/plot/${o}/${t}` + C, {
3094
+ function Ir({ uuid: e, plotId: t = "plot_0", hostname: n = "127.0.0.1", port: r = "80", baseUrl: i, source: a = void 0, events: o = [], tightAxes: s = !1, customToolbarChildren: c = void 0, depends_on: l = "", canEditSelections: u, selections: d, selectionsListener: f, selectionOptions: p, initialSelections: m }) {
3095
+ let h = l ? "/" + l : "", g = {
3096
+ plotId: t,
3097
+ uuid: e,
3098
+ plotServerURL: `${i ?? `ws://${n}:${r}`}/plot/${e}/${t}${h}`,
3099
+ source: a,
3100
+ events: o,
3101
+ tightAxes: s,
3102
+ customToolbarChildren: c,
3103
+ canEditSelections: u,
3104
+ selections: d,
3105
+ selectionsListener: f,
3106
+ selectionOptions: p,
3107
+ initialSelections: m
3108
+ };
3109
+ return /* @__PURE__ */ J(wn, { children: /* @__PURE__ */ J(Lr, { ...g }) });
3110
+ }
3111
+ function Lr({ uuid: t, plotId: n, plotServerURL: i, source: o, events: s, tightAxes: u = !1, customToolbarChildren: d = void 0, canEditSelections: f, selections: p, selectionsListener: m, selectionOptions: h, initialSelections: g }) {
3112
+ let _ = c(""), v = c(!1), [y, b] = l(), [x, S] = l([]), [C, w] = l(Fr), [T, E] = l(), [D, O] = l(), k = c(), { sendMessage: A, lastMessage: j, readyState: M, getWebSocket: N } = Pr(i, {
3049
3113
  onOpen: () => {
3050
- console.log("%s: WebSocket connected", t);
3114
+ console.log("%s: WebSocket connected", n);
3051
3115
  },
3052
3116
  onClose: () => {
3053
- console.log("%s: WebSocket disconnected", t);
3117
+ console.log("%s: WebSocket disconnected", n);
3054
3118
  },
3055
3119
  reconnectAttempts: 5,
3056
3120
  reconnectInterval: 5e3,
3057
- shouldReconnect: (e) => S.current !== "unmounted"
3058
- });
3059
- z(() => (S.current = "initial", () => {
3060
- S.current = "unmounted";
3061
- }), []), i !== void 0 && i != v && (console.log("Setting src", i, v), y(i)), a.length > 0 && a !== b && (console.log("Setting evt", a, b), x(a));
3062
- let O = R((e) => {
3063
- console.log("%s: sending", t, e), w(ot(e));
3064
- }, [t, w]), k = R((e) => {
3065
- O({ status: e });
3066
- }, [O]), A = () => {
3067
- O({ requester: o });
3068
- }, ee = (e) => {
3069
- O({ receiver: e });
3070
- }, [j, te] = H({
3071
- uuid: o,
3072
- batonUuid: "",
3073
- others: [],
3074
- hasBaton: !1,
3075
- requestBaton: A,
3076
- offerBaton: ee
3077
- }), { selections: ne, updateSelection: M, setSelections: N } = pn(void 0, (e, t, n) => {
3078
- t || (e === fn.removed ? O({ selectionIds: n ? [n.id] : [] }) : n && O({ selection: en(n) }));
3121
+ shouldReconnect: (e) => _.current !== "unmounted"
3079
3122
  });
3080
- z(() => {
3081
- if (E === ct.OPEN) {
3082
- let e = D();
3083
- e && e.binaryType !== "arraybuffer" && (e.binaryType = "arraybuffer", console.log("%s: WebSocket set binaryType", t)), k("ready");
3123
+ a(() => (_.current = "initial", () => {
3124
+ _.current = "unmounted";
3125
+ }), []);
3126
+ let P = r((e) => {
3127
+ console.log("%s: sending", n, e), A(rt(e));
3128
+ }, [n, A]), F = r((e) => {
3129
+ P({ status: e });
3130
+ }, [P]), I = r(() => {
3131
+ P({ requester: t });
3132
+ }, [t, P]), L = r((e) => {
3133
+ P({ receiver: e });
3134
+ }, [P]), { selections: R, setSelections: z, setSelectionsListener: ee, updateSelectionContext: B } = Q();
3135
+ a(() => {
3136
+ let e = {
3137
+ canEditSelections: f,
3138
+ selections: p,
3139
+ selectionOptions: h,
3140
+ selectionsListener: m
3141
+ };
3142
+ Object.values(e).every((e) => e === void 0) || (console.log("CP", e), B(e));
3143
+ }, [
3144
+ B,
3145
+ f,
3146
+ p,
3147
+ h,
3148
+ m
3149
+ ]);
3150
+ let { batonProps: V, setBatonProps: H } = vn();
3151
+ a(() => {
3152
+ H && V.uuid !== t && H({
3153
+ uuid: t,
3154
+ batonUuid: "",
3155
+ others: [],
3156
+ hasBaton: !1,
3157
+ requestBaton: I,
3158
+ offerBaton: L
3159
+ });
3160
+ }, []), ee((e, t, n) => {
3161
+ console.log(t), O(void 0), e === fn.removed ? P({ selectionIds: n ? [n.id] : [] }) : n && P({ selection: en(n) });
3162
+ }), a(() => {
3163
+ if (M === at.OPEN) {
3164
+ let e = N();
3165
+ e && e.binaryType !== "arraybuffer" && (e.binaryType = "arraybuffer", console.log("%s: WebSocket set binaryType", n)), F("ready");
3084
3166
  }
3085
3167
  }, [
3086
- D,
3087
- t,
3088
- E,
3089
- k
3090
- ]), z(() => {
3091
- E === ct.OPEN && j.hasBaton && (v || b) && O({
3092
- source: v,
3093
- events: b
3168
+ N,
3169
+ n,
3170
+ M,
3171
+ F
3172
+ ]), a(() => {
3173
+ M === at.OPEN && V.hasBaton && (o || s) && P({
3174
+ source: o,
3175
+ events: s
3094
3176
  });
3095
3177
  }, [
3096
- b,
3097
- E,
3098
- v,
3099
- j.hasBaton,
3100
- O
3178
+ s,
3179
+ M,
3180
+ o,
3181
+ V.hasBaton,
3182
+ P
3101
3183
  ]);
3102
- let re = () => {
3103
- p([]), h(Tr), d(null), N([]);
3104
- }, P = () => {
3105
- re(), console.log("%s: data cleared", t, Object.keys(m));
3184
+ let te = () => {
3185
+ S([]), w(Fr), b(null), z([]);
3186
+ }, ne = () => {
3187
+ te(), console.log("%s: data cleared", n, Object.keys(C));
3106
3188
  };
3107
- z(() => {
3108
- if (j.batonUuid) {
3109
- let e = j.hasBaton ? "Baton gained" : "Baton lost";
3110
- S.current === "initial" && (e = j.hasBaton ? "Taken baton" : "Another client has baton", S.current = ""), lt(e, {
3111
- toastId: o,
3189
+ a(() => {
3190
+ if (V.batonUuid) {
3191
+ let e = V.hasBaton ? "Baton gained" : "Baton lost";
3192
+ _.current === "initial" && (e = V.hasBaton ? "Taken baton" : "Another client has baton", _.current = ""), ot(e, {
3193
+ toastId: t,
3112
3194
  position: "bottom-center",
3113
3195
  autoClose: 2e3,
3114
3196
  theme: "light"
3115
3197
  });
3116
3198
  }
3117
3199
  }, [
3118
- j.hasBaton,
3119
- j.batonUuid,
3120
- o
3200
+ V.hasBaton,
3201
+ V.batonUuid,
3202
+ t
3203
+ ]), a(() => {
3204
+ let e = k.current;
3205
+ if (y && e && M === at.OPEN && V.hasBaton) {
3206
+ k.current = void 0;
3207
+ for (let t of e) P({ selection: en(t) });
3208
+ }
3209
+ }, [
3210
+ y,
3211
+ M,
3212
+ V.hasBaton,
3213
+ P
3121
3214
  ]);
3122
- let ie = (e) => {
3123
- lt(/* @__PURE__ */ K(() => /* @__PURE__ */ K("div", { children: /* @__PURE__ */ q("h3", { children: [
3215
+ let re = (e) => {
3216
+ ot(/* @__PURE__ */ J(() => /* @__PURE__ */ J("div", { children: /* @__PURE__ */ Y("h3", { children: [
3124
3217
  "Baton requested from ",
3125
3218
  e.requester,
3126
3219
  " ",
3127
- /* @__PURE__ */ K("br", {}),
3128
- /* @__PURE__ */ K("button", {
3220
+ /* @__PURE__ */ J("br", {}),
3221
+ /* @__PURE__ */ J("button", {
3129
3222
  onClick: () => {
3130
- ee(e.requester);
3223
+ L(e.requester);
3131
3224
  },
3132
3225
  children: "Approve"
3133
3226
  })
@@ -3142,163 +3235,192 @@ function Er({ plotId: t = "plot_0", hostname: n = "127.0.0.1", port: r = "80", s
3142
3235
  progress: void 0,
3143
3236
  theme: "light"
3144
3237
  });
3145
- }, ae = (e, t, n = !0) => {
3238
+ }, U = (e, t, n = !0) => {
3146
3239
  console.log("Finding old line with key", e);
3147
- let r = f.findIndex((t) => t.key === e);
3148
- if (r === -1) return console.log("Line with key", e, "cannot be found"), f;
3149
- let i = [...f];
3240
+ let r = x.findIndex((t) => t.key === e);
3241
+ if (r === -1) return console.log("Line with key", e, "cannot be found"), x;
3242
+ let i = [...x];
3150
3243
  return console.debug("Replacing old line params with", t), i[r] = {
3151
3244
  ...i[r],
3152
3245
  ...t
3153
- }, n && O({
3246
+ }, n && P({
3154
3247
  key: e,
3155
3248
  lineParams: t
3156
3249
  }), i;
3157
- }, oe = (e, t = !0) => {
3158
- g != null && _({
3159
- ...g,
3250
+ }, ie = (e, t = !0) => {
3251
+ T != null && E({
3252
+ ...T,
3160
3253
  pointSize: e
3161
- }), t && O({ pointSize: e });
3162
- }, F = (e, n) => {
3163
- let r = ft(e), i = pt(e);
3164
- console.log("%s: setting line state with domains", t, r, i);
3165
- let a = n ?? m;
3166
- p(e), h(a), d({
3254
+ }), t && P({ pointSize: e });
3255
+ }, ae = (e, t) => {
3256
+ let r = lt(e), i = ut(e);
3257
+ console.log("%s: setting line state with domains", n, r, i);
3258
+ let a = t ?? C;
3259
+ S(e), w(a), b({
3167
3260
  lineData: e,
3168
3261
  xDomain: r,
3169
3262
  yDomain: i,
3170
3263
  plotConfig: a,
3171
- updateLineParams: ae
3264
+ updateLineParams: U
3172
3265
  });
3266
+ }, oe = (e) => {
3267
+ let t = e.mlData.map((e) => ht(e));
3268
+ console.log("%s: appending line data", n, Object.keys(t));
3269
+ let r = Math.max(x.length, t.length), i = [];
3270
+ for (let e = 0; e < r; e++) i.push(ct(x[e], t[e]));
3271
+ ae(i);
3173
3272
  }, se = (e) => {
3174
- let n = e.mlData.map((e) => vt(e));
3175
- console.log("%s: appending line data", t, Object.keys(n));
3176
- let r = Math.max(f.length, n.length), i = [];
3177
- for (let e = 0; e < r; e++) i.push(dt(f[e], n[e]));
3178
- F(i);
3179
- }, ce = (e) => {
3180
- let n = _t(e.plotConfig);
3181
- if (e.append) se(e);
3273
+ let t = mt(e.plotConfig);
3274
+ if (e.append) oe(e);
3182
3275
  else {
3183
- let r = e.mlData.map((e) => vt(e)).filter((e) => e !== null);
3184
- console.log("%s: new line data", t, r.map((e) => e.key)), F(r, n);
3276
+ let r = e.mlData.map((e) => ht(e)).filter((e) => e !== null);
3277
+ console.log("%s: new line data", n, r.map((e) => e.key)), ae(r, t);
3185
3278
  }
3186
- }, I = (e) => {
3187
- let n = mt(e.imData), r = _t(e.plotConfig);
3188
- if (Ct(n)) {
3189
- let e = n;
3190
- console.log("%s: new heatmap data", t, Object.keys(e)), d({
3279
+ }, ce = (e) => {
3280
+ let t = dt(e.imData), r = mt(e.plotConfig);
3281
+ if (g && !v.current) {
3282
+ let e = g(r);
3283
+ e.length > 0 && (v.current = !0, O(e), k.current = e);
3284
+ }
3285
+ if (xt(t)) {
3286
+ let e = t;
3287
+ console.log("%s: new heatmap data", n, Object.keys(e)), b({
3191
3288
  ...e,
3192
3289
  plotConfig: r
3193
3290
  });
3194
- } else console.log("%s: new image data", t, Object.keys(n)), d({
3195
- ...n,
3291
+ } else console.log("%s: new image data", n, Object.keys(t)), b({
3292
+ ...t,
3196
3293
  plotConfig: r
3197
3294
  });
3198
3295
  }, le = (e) => {
3199
- let n = yt(e.scData);
3200
- console.log("%s: new scatter data", t, Object.keys(n));
3201
- let r = _t(e.plotConfig);
3202
- _(n), d({
3203
- ...n,
3296
+ let t = gt(e.scData);
3297
+ console.log("%s: new scatter data", n, Object.keys(t));
3298
+ let r = mt(e.plotConfig);
3299
+ E(t), b({
3300
+ ...t,
3204
3301
  plotConfig: r,
3205
- setPointSize: oe
3302
+ setPointSize: ie
3206
3303
  });
3207
3304
  }, ue = (e) => {
3208
- let n = ht(e.suData);
3209
- console.log("%s: new surface data", t, Object.keys(n));
3210
- let r = _t(e.plotConfig);
3211
- d({
3212
- ...n,
3305
+ let t = ft(e.suData);
3306
+ console.log("%s: new surface data", n, Object.keys(t));
3307
+ let r = mt(e.plotConfig);
3308
+ b({
3309
+ ...t,
3213
3310
  plotConfig: r
3214
3311
  });
3312
+ }, W = (e) => {
3313
+ let t = pt(e.taData);
3314
+ console.log("%s: new table data", n, Object.keys(t)), b({ ...t });
3215
3315
  }, de = (e) => {
3216
- let n = gt(e.taData);
3217
- console.log("%s: new table data", t, Object.keys(n)), d({ ...n });
3218
- }, L = (e) => {
3219
- let n = e.setSelections.map((e) => $t(e)).filter((e) => e !== null);
3220
- e.update ? (console.log("%s: update selections", t, n), N((e) => {
3221
- let t = [...e];
3222
- for (let e of n) {
3223
- let n = e.id, r = t.findIndex((e) => e.id === n);
3224
- r === -1 ? t.push(e) : t[r] = e;
3225
- }
3226
- return t;
3227
- })) : (console.log("%s: new selections", t, n), N(n));
3228
- }, fe = (e) => {
3229
- let n = e.selectionIds;
3230
- console.log("%s: clear selections", t, n), n.length === 0 ? N(() => []) : N((e) => {
3231
- let t = [];
3232
- for (let r of e) n.includes(r.id) || t.push(r);
3233
- return t;
3316
+ let t = e.selectionIds;
3317
+ console.log("%s: clear selections", n, t), t.length === 0 ? O(() => []) : O((e) => {
3318
+ let n = [];
3319
+ for (let r of e ?? []) t.includes(r.id) || n.push(r);
3320
+ return n;
3234
3321
  });
3235
- }, pe = (e) => {
3236
- console.log("%s: updating baton with msg:", t, e, "for", o);
3237
- let n = e.baton;
3238
- te((t) => ({
3239
- ...t,
3240
- batonUuid: n,
3241
- others: e.uuids.filter((e) => e !== o),
3242
- hasBaton: n === o
3243
- }));
3244
- }, [me, B] = H(T);
3245
- if (me != T && T != null) {
3246
- E !== ct.OPEN && console.log("%s: still not open", t);
3247
- let n = T.data;
3248
- if (n instanceof Blob) {
3249
- console.log("Message was a blob:", n);
3322
+ }, fe = (e) => {
3323
+ let t = e.setSelections.map((e) => $t(e)).filter((e) => e !== null);
3324
+ e.update ? (console.log("%s: update selections", n, t), O((e) => {
3325
+ let n = e ? [...e] : [];
3326
+ for (let e of t) {
3327
+ let t = e.id, r = n.findIndex((e) => e.id === t);
3328
+ r === -1 ? n.push(e) : n[r] = e;
3329
+ }
3330
+ return n;
3331
+ })) : t !== D && (console.log("%s: new selections", n, t, "cf", R), O(t));
3332
+ };
3333
+ a(() => {
3334
+ D !== void 0 && D !== R && (console.log("CP set to new", R, D), z(D));
3335
+ }, [
3336
+ D,
3337
+ R,
3338
+ z
3339
+ ]);
3340
+ let [G, K] = l();
3341
+ a(() => {
3342
+ let e = V.uuid;
3343
+ if (H && e && G) {
3344
+ let { baton: t, uuids: n } = G, r = n.filter((t) => t !== e), i = t === e;
3345
+ if (t !== V.batonUuid || !Ot(r, V.others) || i !== V.hasBaton) {
3346
+ let e = {
3347
+ ...V,
3348
+ batonUuid: t,
3349
+ others: r,
3350
+ hasBaton: i
3351
+ };
3352
+ H(e);
3353
+ }
3354
+ }
3355
+ }, [
3356
+ G,
3357
+ V,
3358
+ H
3359
+ ]), a(() => {
3360
+ if (j === null) return;
3361
+ let t = j.data;
3362
+ if (t instanceof Blob) {
3363
+ console.log("Message was a blob:", t);
3250
3364
  return;
3251
3365
  }
3252
- let r = at(n);
3253
- console.log("%s: decodedMessage", t, Object.keys(r));
3366
+ let r = nt(t);
3367
+ console.log("%s: decodedMessage", n, Object.keys(r));
3254
3368
  let i = jt();
3255
3369
  e(() => {
3256
3370
  i.end();
3257
3371
  });
3258
3372
  let a = !0;
3259
- "mlData" in r ? ce(r) : "imData" in r ? I(r) : "scData" in r ? le(r) : "suData" in r ? ue(r) : "taData" in r ? de(r) : "selectionIds" in r ? fe(r) : "setSelections" in r ? L(r) : "baton" in r ? pe(r) : "requester" in r ? ie(r) : "plotId" in r ? P() : (a = !1, console.log("%s: new message type unknown", t)), a && k(`ready ${performance.getEntriesByType("measure").shift()?.duration}`), B(T);
3260
- }
3261
- let U = u;
3262
- return U &&= {
3263
- ...U,
3264
- batonProps: j,
3265
- updateSelection: M,
3266
- selections: ne,
3267
- tightAxes: s,
3268
- customToolbarChildren: c
3269
- }, U && console.log("%s: plotprops", t, Object.keys(U)), ne.length && console.log("%s: selections", t, ne.length), !E || E === ct.UNINSTANTIATED ? /* @__PURE__ */ K("h2", { children: "Waiting for plot server connection" }) : E === ct.CLOSING ? /* @__PURE__ */ K("h2", { children: "Closing plot server connection" }) : E === ct.CLOSED ? /* @__PURE__ */ K("h2", { children: "Plot server connection closed" }) : U ? /* @__PURE__ */ K(Cr, { ...U }) : /* @__PURE__ */ K("h2", { children: "Awaiting command from plot server" });
3270
- }
3271
- //#endregion
3272
- //#region src/VideoPlot.tsx
3273
- function Dr(e) {
3274
- let { setFrameloop: t } = ge(), n = rt(e.sourceUrl), r = n.source.data, i = r.height, a = r.width;
3275
- return z(() => {
3276
- e.setSize([i, a]);
3373
+ if (K(void 0), "mlData" in r ? se(r) : "imData" in r ? ce(r) : "scData" in r ? le(r) : "suData" in r ? ue(r) : "taData" in r ? W(r) : "selectionIds" in r ? de(r) : "setSelections" in r ? fe(r) : "baton" in r ? K(r) : "requester" in r ? re(r) : "plotId" in r ? ne() : (a = !1, console.log("%s: new message type unknown", n)), a) {
3374
+ let e = performance.getEntriesByType("measure").shift();
3375
+ F(`ready ${e?.duration}`);
3376
+ }
3377
+ }, [j]);
3378
+ let pe = y;
3379
+ return pe && (pe = {
3380
+ ...pe,
3381
+ tightAxes: u,
3382
+ customToolbarChildren: d
3383
+ }, pe && console.log("%s: plotprops", n, Object.keys(pe))), !M || M === at.UNINSTANTIATED ? /* @__PURE__ */ J("h2", { children: "Waiting for plot server connection" }) : M === at.CLOSING ? /* @__PURE__ */ J("h2", { children: "Closing plot server connection" }) : M === at.CLOSED ? /* @__PURE__ */ J("h2", { children: "Plot server connection closed" }) : pe ? /* @__PURE__ */ Y("div", {
3384
+ className: "connected_plot",
3385
+ style: {
3386
+ display: "grid",
3387
+ position: "relative",
3388
+ height: "100%",
3389
+ minHeight: 0
3390
+ },
3391
+ children: [/* @__PURE__ */ J(cr, { children: d }), /* @__PURE__ */ J(Mr, { ...pe })]
3392
+ }) : /* @__PURE__ */ J("h2", { children: "Awaiting command from plot server" });
3393
+ }
3394
+ // src/VideoPlot.tsx
3395
+ function Rr(e) {
3396
+ let { setFrameloop: t } = me(), n = et(e.sourceUrl), r = n.source.data, i = r.height, o = r.width;
3397
+ return a(() => {
3398
+ e.setSize([i, o]);
3277
3399
  }, [
3278
3400
  i,
3279
- a,
3401
+ o,
3280
3402
  e
3281
- ]), z(() => () => {
3403
+ ]), a(() => () => {
3282
3404
  t("demand");
3283
- }, []), z(() => {
3405
+ }, []), a(() => {
3284
3406
  r.complete && t("demand");
3285
- }, [r.complete, t]), z(() => {
3407
+ }, [r.complete, t]), a(() => {
3286
3408
  t(e.play ? "always" : "demand");
3287
- }, [e.play, t]), he(() => n.needsUpdate = e.play), /* @__PURE__ */ K("meshBasicMaterial", { map: n });
3409
+ }, [e.play, t]), pe(() => n.needsUpdate = e.play), /* @__PURE__ */ J("meshBasicMaterial", { map: n });
3288
3410
  }
3289
- function Or(e) {
3290
- let { setFrameloop: t } = ge(), n = it(e.sourceUrl), r = n.source.data;
3291
- z(() => (r.pause(), () => {
3411
+ function zr(e) {
3412
+ let { setFrameloop: t } = me(), n = tt(e.sourceUrl), r = n.source.data;
3413
+ a(() => (r.pause(), () => {
3292
3414
  t("demand");
3293
3415
  }), []);
3294
- let i = r.videoHeight, a = r.videoWidth;
3295
- return z(() => {
3296
- e.setSize([i, a]);
3416
+ let i = r.videoHeight, o = r.videoWidth;
3417
+ return a(() => {
3418
+ e.setSize([i, o]);
3297
3419
  }, [
3298
3420
  i,
3299
- a,
3421
+ o,
3300
3422
  e
3301
- ]), z(() => {
3423
+ ]), a(() => {
3302
3424
  e.play ? r.play().catch((e) => {
3303
3425
  console.log("Could not play: %s", e);
3304
3426
  }) : r.pause(), t(e.play ? "always" : "demand");
@@ -3306,82 +3428,77 @@ function Or(e) {
3306
3428
  r,
3307
3429
  e.play,
3308
3430
  t
3309
- ]), /* @__PURE__ */ K("meshBasicMaterial", { map: n });
3431
+ ]), /* @__PURE__ */ J("meshBasicMaterial", { map: n });
3310
3432
  }
3311
- function kr(e) {
3312
- return /* @__PURE__ */ K(m, { children: /* @__PURE__ */ K("button", {
3433
+ function Br(e) {
3434
+ return /* @__PURE__ */ J(C, { children: /* @__PURE__ */ J("button", {
3313
3435
  type: "button",
3314
3436
  onClick: () => e.clickPlay(),
3315
- children: /* @__PURE__ */ K("span", { children: e.text })
3437
+ children: /* @__PURE__ */ J("span", { children: e.text })
3316
3438
  }) });
3317
3439
  }
3318
- function Ar(e) {
3319
- let { title: t, showGrid: n, xCustomDomain: r, setXCustomDomain: i, xDomain: a, xLabel: o, yCustomDomain: s, setYCustomDomain: c, yDomain: l, yLabel: u, mode: f, batonProps: p, canSelect: m, selectionMax: h, selectionType: g, updateSelection: _, selections: v } = yn(), { sourceURL: y, isImage: b = !1 } = { ...e }, [S, C] = H(!1), w = Ot(f), T = (e, t) => /* @__PURE__ */ q("p", { children: [
3440
+ function Vr(e) {
3441
+ let { title: t, showGrid: n, xCustomDomain: r, setXCustomDomain: i, xDomain: o, xLabel: c, yCustomDomain: u, setYCustomDomain: d, yDomain: f, yLabel: p, mode: m, canSelect: h, selectionMax: g, selectionType: _, updateSelection: v, selections: y } = Q(), { sourceURL: x, isImage: S = !1 } = { ...e }, [C, w] = l(!1), T = Dt(m), E = (e, t) => /* @__PURE__ */ Y("p", { children: [
3320
3442
  e.toPrecision(8),
3321
3443
  ", ",
3322
3444
  t.toPrecision(8)
3323
- ] }), [E, D] = H([1, 1]);
3324
- z(() => {
3325
- i([0, E[1]]), c([0, E[0]]);
3445
+ ] }), [D, O] = l([1, 1]);
3446
+ a(() => {
3447
+ i([0, D[1]]), d([0, D[0]]);
3326
3448
  }, [
3327
- E,
3449
+ D,
3328
3450
  i,
3329
- c
3451
+ d
3330
3452
  ]);
3331
- let O = B(() => P(r, a), [r, a]), k = B(() => P(s, l), [s, l]);
3332
- return /* @__PURE__ */ q(M, {
3453
+ let k = s(() => U(r, o), [r, o]), j = s(() => U(u, f), [u, f]);
3454
+ return /* @__PURE__ */ Y(te, {
3333
3455
  title: t ?? "",
3334
3456
  aspect: "equal",
3335
3457
  abscissaConfig: {
3336
- visDomain: O,
3458
+ visDomain: k,
3337
3459
  showGrid: n,
3338
3460
  isIndexAxis: !0,
3339
- label: o,
3461
+ label: c,
3340
3462
  nice: !0
3341
3463
  },
3342
3464
  ordinateConfig: {
3343
- visDomain: k,
3465
+ visDomain: j,
3344
3466
  showGrid: n,
3345
3467
  isIndexAxis: !0,
3346
- label: u,
3468
+ label: p,
3347
3469
  nice: !0
3348
3470
  },
3349
3471
  children: [
3350
- /* @__PURE__ */ K(d, { ...w }),
3351
- /* @__PURE__ */ K(x, {}),
3352
- /* @__PURE__ */ K(kr, {
3353
- clickPlay: () => C((e) => !e),
3354
- text: S ? "Pause" : "Play"
3472
+ /* @__PURE__ */ J(b, { ...T }),
3473
+ /* @__PURE__ */ J(A, {}),
3474
+ /* @__PURE__ */ J(Br, {
3475
+ clickPlay: () => w((e) => !e),
3476
+ text: C ? "Pause" : "Play"
3355
3477
  }),
3356
- /* @__PURE__ */ K(ne, { renderTooltip: T }),
3357
- /* @__PURE__ */ K(N, { children: K(b ? Dr : Or, {
3358
- sourceUrl: y,
3359
- play: S,
3360
- setSize: D
3478
+ /* @__PURE__ */ J(H, { renderTooltip: E }),
3479
+ /* @__PURE__ */ J(ne, { children: J(S ? Rr : zr, {
3480
+ sourceUrl: x,
3481
+ play: C,
3482
+ setSize: O
3361
3483
  }) }),
3362
- m && /* @__PURE__ */ K(gn, {
3484
+ h && /* @__PURE__ */ J(bn, {
3363
3485
  modifierKey: [],
3364
- batonProps: p,
3365
- disabled: f !== X.selectRegion,
3366
- selectionMax: h,
3367
- selectionType: g,
3368
- updateSelection: _,
3369
- selections: v
3486
+ disabled: m !== X.selectRegion,
3487
+ selectionMax: g,
3488
+ selectionType: _,
3489
+ updateSelection: v,
3490
+ selections: y
3370
3491
  })
3371
3492
  ]
3372
3493
  });
3373
3494
  }
3374
- function jr(e) {
3375
- return /* @__PURE__ */ K("div", {
3495
+ function Hr(e) {
3496
+ return /* @__PURE__ */ J("div", {
3376
3497
  style: {
3377
3498
  display: "grid",
3378
3499
  position: "relative"
3379
3500
  },
3380
- children: /* @__PURE__ */ q(xn, {
3381
- ...e,
3382
- children: [/* @__PURE__ */ K(ir, { children: e.customToolbarChildren }), /* @__PURE__ */ K(Ar, { ...e })]
3383
- })
3501
+ children: /* @__PURE__ */ Y(wn, { children: [/* @__PURE__ */ J(cr, { children: e.customToolbarChildren }), /* @__PURE__ */ J(Vr, { ...e })] })
3384
3502
  });
3385
3503
  }
3386
- //#endregion
3387
- export { Cr as AnyPlot, ir as AnyToolbar, Ht as AxialSelection, Vt as BaseSelection, Wt as CircularSectorialSelection, Ut as CircularSelection, Er as ConnectedPlot, Kt as EllipticalSelection, h as GlyphType, or as HeatmapPlot, pr as ImagePlot, X as InteractionModeType, gr as LinePlot, qt as LinearSelection, Gt as OrientableSelection, xn as PlotCustomizationContextProvider, rr as PlotToolbar, Jt as PolygonalSelection, Yt as RectangularSelection, w as ScaleType, vr as ScatterPlot, Z as SelectionType, br as SurfacePlot, xr as TableDisplay, jr as VideoPlot, yn as usePlotCustomizationContext, pn as useSelections };
3504
+ export { Nr as AnyPlot, cr as AnyToolbar, Ht as AxialSelection, Vt as BaseSelection, yn as BatonContextProvider, Wt as CircularSectorialSelection, Ut as CircularSelection, Ir as ConnectedPlot, Kt as EllipticalSelection, w as GlyphType, dr as HeatmapPlot, yr as ImagePlot, X as InteractionModeType, Cr as LinePlot, qt as LinearSelection, Gt as OrientableSelection, wn as PlotCustomizationContextProvider, sr as PlotToolbar, Jt as PolygonalSelection, Yt as RectangularSelection, N as ScaleType, Er as ScatterPlot, Z as SelectionType, kr as SurfacePlot, jr as TableDisplay, Hr as VideoPlot, vn as useBatonContext, Q as usePlotCustomizationContext, pn as useSelections };