@servantcdh/ez-planet-labeling 0.2.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -68,8 +68,8 @@ const Q = () => Xe, Rt = (e) => {
68
68
  return () => {
69
69
  };
70
70
  const n = Vn.map((s) => {
71
- const o = `label:${s}`, a = (i) => {
72
- e(s, i.data);
71
+ const o = `label:${s}`, a = (c) => {
72
+ e(s, c.data);
73
73
  };
74
74
  return t.on(o, a), { eventName: o, handler: a };
75
75
  });
@@ -100,7 +100,7 @@ const Q = () => Xe, Rt = (e) => {
100
100
  ({ info: r }) => r === it
101
101
  )
102
102
  );
103
- const i = {
103
+ const c = {
104
104
  info: it,
105
105
  left: -100,
106
106
  top: -100,
@@ -116,33 +116,33 @@ const Q = () => Xe, Rt = (e) => {
116
116
  originX: "center",
117
117
  originY: "center",
118
118
  selectable: !1
119
- }, c = e.lineCap === "round" ? new s(i) : new o(i), l = (r) => {
119
+ }, i = e.lineCap === "round" ? new s(c) : new o(c), l = (r) => {
120
120
  if (!r && !a.x)
121
121
  return;
122
122
  const m = r == null ? void 0 : r.e, { x: v, y: g } = m ? n.getScenePoint(m) : a;
123
- a.x = v, a.y = g, c.set({ top: g, left: v }), c.setCoords(), n.renderAll();
123
+ a.x = v, a.y = g, i.set({ top: g, left: v }), i.setCoords(), n.renderAll();
124
124
  }, h = (r) => {
125
125
  l(r);
126
126
  }, u = () => {
127
127
  Un("init");
128
128
  };
129
- return l(), { brushCursor: c, handleOnMouseMove: h, handleOnMouseUp: u };
129
+ return l(), { brushCursor: i, handleOnMouseMove: h, handleOnMouseUp: u };
130
130
  }, Ot = ({ colorCode: e, callback: t }, n, s = !1) => {
131
131
  const o = pe(), a = Gt();
132
132
  s && (n = s, o.getObjects().forEach((r) => r.set({ visible: !1 })), o.renderAll());
133
- let i = 0, c = 0;
133
+ let c = 0, i = 0;
134
134
  const l = function(r) {
135
135
  const m = r.scenePoint ?? r.pointer;
136
136
  if (!m)
137
137
  return;
138
138
  const { x: v, y: g } = st(m);
139
- i = v, c = g;
139
+ c = v, i = g;
140
140
  }, h = function(r) {
141
141
  const m = r.scenePoint ?? r.pointer;
142
142
  if (!m)
143
143
  return;
144
- const { x: v, y: g } = st(m), b = v - i, f = g - c;
145
- let p = Math.abs(b), N = Math.abs(f), Z = b > 0 ? i : v, V = f > 0 ? c : g;
144
+ const { x: v, y: g } = st(m), b = v - c, f = g - i;
145
+ let p = Math.abs(b), N = Math.abs(f), Z = b > 0 ? c : v, V = f > 0 ? i : g;
146
146
  const D = Z < 0, k = V < 0;
147
147
  p = D ? p + Z : p, N = k ? N + V : N, Z = D ? 0 : Z, V = k ? 0 : V;
148
148
  const H = o.getZoom(), w = Number(o.width ?? 0) / H, C = Number(o.height ?? 0) / H, E = Z + p > w, _ = V + N > C;
@@ -196,24 +196,24 @@ const Q = () => Xe, Rt = (e) => {
196
196
  }, Qt = () => ({ id: "brush", init: ({ brush: t, colorCode: n }) => {
197
197
  const s = pe(), o = Tn();
198
198
  s.isDrawingMode = !0, s.freeDrawingBrush = new o(s), s.freeDrawingBrush.color = n, s.freeDrawingBrush.strokeLineCap = t.lineCap, s.freeDrawingBrush.width = t.lineWidth;
199
- const { brushCursor: a, handleOnMouseMove: i, handleOnMouseUp: c } = kt(t, n), l = function() {
199
+ const { brushCursor: a, handleOnMouseMove: c, handleOnMouseUp: i } = kt(t, n), l = function() {
200
200
  s.add(a);
201
201
  }, h = function() {
202
202
  s.remove(a);
203
203
  };
204
- return s.add(a), s.on("mouse:over", I(l)), s.on("mouse:out", I(h)), s.on("mouse:move", I(i)), s.on("mouse:up", I(c)), () => {
205
- s.remove(a), s.off("mouse:over", I(l)), s.off("mouse:out", I(h)), s.off("mouse:move", I(i)), s.off("mouse:up", I(c)), s.isDrawingMode = !1;
204
+ return s.add(a), s.on("mouse:over", I(l)), s.on("mouse:out", I(h)), s.on("mouse:move", I(c)), s.on("mouse:up", I(i)), () => {
205
+ s.remove(a), s.off("mouse:over", I(l)), s.off("mouse:out", I(h)), s.off("mouse:move", I(c)), s.off("mouse:up", I(i)), s.isDrawingMode = !1;
206
206
  };
207
207
  } }), en = () => ({ id: "eraser", init: async ({ brush: t }) => {
208
208
  const n = pe(), { EraserBrush: s } = await import("./index-DDn_Fjhx.js");
209
209
  n.freeDrawingBrush = new s(n), n.isDrawingMode = !0, n.freeDrawingBrush.strokeLineCap = t.lineCap, n.freeDrawingBrush.width = t.lineWidth;
210
- const { brushCursor: o, handleOnMouseMove: a, handleOnMouseUp: i } = kt(t), c = function() {
210
+ const { brushCursor: o, handleOnMouseMove: a, handleOnMouseUp: c } = kt(t), i = function() {
211
211
  n.add(o);
212
212
  }, l = function() {
213
213
  n.remove(o);
214
214
  };
215
- return n.add(o), n.on("mouse:over", I(c)), n.on("mouse:out", I(l)), n.on("mouse:move", I(a)), n.on("mouse:up", I(i)), () => {
216
- n.remove(o), n.off("mouse:over", I(c)), n.off("mouse:out", I(l)), n.off("mouse:move", I(a)), n.off("mouse:up", I(i)), n.isDrawingMode = !1;
215
+ return n.add(o), n.on("mouse:over", I(i)), n.on("mouse:out", I(l)), n.on("mouse:move", I(a)), n.on("mouse:up", I(c)), () => {
216
+ n.remove(o), n.off("mouse:over", I(i)), n.off("mouse:out", I(l)), n.off("mouse:move", I(a)), n.off("mouse:up", I(c)), n.isDrawingMode = !1;
217
217
  };
218
218
  } }), At = (e, t, n = 0) => {
219
219
  const s = 10 ** n;
@@ -231,39 +231,39 @@ const Q = () => Xe, Rt = (e) => {
231
231
  const n = t.length === 8;
232
232
  if (t.length !== 6 && !n)
233
233
  return null;
234
- const s = parseInt(t.substring(0, 6), 16), o = s >> 16 & 255, a = s >> 8 & 255, i = s & 255, c = n ? parseInt(t.substring(6), 16) / 255 : 1;
235
- return { r: o, g: a, b: i, a: c };
234
+ const s = parseInt(t.substring(0, 6), 16), o = s >> 16 & 255, a = s >> 8 & 255, c = s & 255, i = n ? parseInt(t.substring(6), 16) / 255 : 1;
235
+ return { r: o, g: a, b: c, a: i };
236
236
  }, ct = (e) => {
237
237
  const t = { hex: "000000", alpha: "100%" };
238
238
  if (!e)
239
239
  return t;
240
240
  const n = e.trim();
241
241
  if (n.startsWith("rgba(")) {
242
- const [o, a, i, c] = Pt(n);
242
+ const [o, a, c, i] = Pt(n);
243
243
  return {
244
- hex: `${Be(o)}${Be(a)}${Be(i)}`,
245
- alpha: `${At(c, 100, 0)}%`
244
+ hex: `${Be(o)}${Be(a)}${Be(c)}`,
245
+ alpha: `${At(i, 100, 0)}%`
246
246
  };
247
247
  }
248
248
  if (n.startsWith("rgb(")) {
249
- const o = n.substring(4, n.length - 1).split(",").map((l) => +l), [a = 0, i = 0, c = 0] = o;
249
+ const o = n.substring(4, n.length - 1).split(",").map((l) => +l), [a = 0, c = 0, i = 0] = o;
250
250
  return {
251
- hex: `${Be(a)}${Be(i)}${Be(c)}`,
251
+ hex: `${Be(a)}${Be(c)}${Be(i)}`,
252
252
  alpha: "100%"
253
253
  };
254
254
  }
255
255
  const s = Yn(n);
256
256
  if (s) {
257
- const { r: o, g: a, b: i, a: c } = s;
257
+ const { r: o, g: a, b: c, a: i } = s;
258
258
  return {
259
- hex: `${Be(o)}${Be(a)}${Be(i)}`,
260
- alpha: `${At(c, 100, 0)}%`
259
+ hex: `${Be(o)}${Be(a)}${Be(c)}`,
260
+ alpha: `${At(i, 100, 0)}%`
261
261
  };
262
262
  }
263
263
  return t;
264
264
  }, qa = (e) => {
265
- const [t, n, s, o] = Pt(e), a = Math.round(t).toString(16).padStart(2, "0"), i = Math.round(n).toString(16).padStart(2, "0"), c = Math.round(s).toString(16).padStart(2, "0"), l = Math.round(o * 255).toString(16).padStart(2, "0");
266
- return `#${a}${i}${c}${l}`;
265
+ const [t, n, s, o] = Pt(e), a = Math.round(t).toString(16).padStart(2, "0"), c = Math.round(n).toString(16).padStart(2, "0"), i = Math.round(s).toString(16).padStart(2, "0"), l = Math.round(o * 255).toString(16).padStart(2, "0");
266
+ return `#${a}${c}${i}${l}`;
267
267
  }, nn = (e) => new Promise((t) => {
268
268
  const n = new Image();
269
269
  n.src = e, n.setAttribute("crossOrigin", ""), n.onload = () => t(n);
@@ -286,7 +286,7 @@ const Q = () => Xe, Rt = (e) => {
286
286
  }, n = document.createElement("canvas"), s = n.getContext("2d");
287
287
  if (!s)
288
288
  return { canvas: n, minX: 0, minY: 0 };
289
- const { minX: o, minY: a, maxX: i, maxY: c } = t(e), l = i - o + 1, h = c - a + 1, u = s.createImageData(l, h);
289
+ const { minX: o, minY: a, maxX: c, maxY: i } = t(e), l = c - o + 1, h = i - a + 1, u = s.createImageData(l, h);
290
290
  for (let r = 0; r < h; r += 1)
291
291
  for (let m = 0; m < l; m += 1) {
292
292
  const v = ((a + r) * e.width + o + m) * 4, g = (r * l + m) * 4;
@@ -309,7 +309,7 @@ const Ja = (e) => {
309
309
  );
310
310
  return;
311
311
  }
312
- const a = pe(), i = Kt(), c = ke(), l = oe(), h = () => {
312
+ const a = pe(), c = Kt(), i = ke(), l = oe(), h = () => {
313
313
  a.contextContainer && a.renderAll();
314
314
  };
315
315
  a.defaultCursor = "crosshair", a.hoverCursor = "crosshair";
@@ -348,7 +348,7 @@ const Ja = (e) => {
348
348
  const be = se.map((F) => {
349
349
  const ne = F.points.map(({ x: ye, y: X }) => {
350
350
  const K = ye * de, Te = X * Me;
351
- return te = Math.min(te, K), W = Math.min(W, Te), new c(K, Te);
351
+ return te = Math.min(te, K), W = Math.min(W, Te), new i(K, Te);
352
352
  });
353
353
  return { inner: F.inner, points: ne };
354
354
  });
@@ -356,11 +356,11 @@ const Ja = (e) => {
356
356
  const me = { x: te, y: W }, Ie = be.map((F) => ({
357
357
  inner: F.inner,
358
358
  points: F.points.map(
359
- ({ x: ne, y: ye }) => new c(ne - me.x, ye - me.y)
359
+ ({ x: ne, y: ye }) => new i(ne - me.x, ye - me.y)
360
360
  )
361
361
  })).sort((F, ne) => Number(F.inner) - Number(ne.inner)), je = Ie.findIndex(
362
362
  ({ inner: F }) => !F
363
- ), Re = je >= 0 ? je : 0, Pe = Ie[Re] ?? Ie[0], Qe = (Pe == null ? void 0 : Pe.points.map(({ x: F, y: ne }) => new c(F, ne))) ?? [], De = [];
363
+ ), Re = je >= 0 ? je : 0, Pe = Ie[Re] ?? Ie[0], Qe = (Pe == null ? void 0 : Pe.points.map(({ x: F, y: ne }) => new i(F, ne))) ?? [], De = [];
364
364
  return Ie.forEach(({ points: F }) => {
365
365
  if (!F.length) return;
366
366
  const [ne, ...ye] = F;
@@ -376,7 +376,7 @@ const Ja = (e) => {
376
376
  selectable: !1,
377
377
  evented: !0,
378
378
  fillRule: "evenodd",
379
- pathOffset: new c(0, 0),
379
+ pathOffset: new i(0, 0),
380
380
  points: Qe,
381
381
  pathContours: Ie,
382
382
  pathBaseOffset: me,
@@ -427,7 +427,7 @@ const Ja = (e) => {
427
427
  if (!v) return;
428
428
  const x = B, P = R, T = y.toDataURL();
429
429
  y.remove();
430
- const L = await i.fromURL(T, {}, {
430
+ const L = await c.fromURL(T, {}, {
431
431
  left: x,
432
432
  top: P,
433
433
  objectCaching: !1,
@@ -471,24 +471,24 @@ const Ja = (e) => {
471
471
  };
472
472
  } }), sn = () => ({ id: "pen", init: ({ colorCode: t }) => {
473
473
  const n = pe(), s = ke(), o = qt(), a = Pn();
474
- let i = [], c = [], l = !1;
474
+ let c = [], i = [], l = !1;
475
475
  const h = function(g, b) {
476
- if (!c.length)
476
+ if (!i.length)
477
477
  return !1;
478
- const f = c[0];
478
+ const f = i[0];
479
479
  if (f.x1 === void 0 || f.y1 === void 0)
480
480
  return !1;
481
481
  const p = n.getScenePoint(g), N = f.x1 ?? 0, Z = f.y1 ?? 0, { x: V, y: D } = p;
482
482
  return Math.abs(N - V) <= b && Math.abs(Z - D) <= b;
483
483
  }, u = function(g) {
484
- g.preventDefault(), n.remove(...c), c = [];
484
+ g.preventDefault(), n.remove(...i), i = [];
485
485
  }, r = function(g) {
486
486
  const b = g.e;
487
487
  if (b && h(b, 10)) {
488
488
  l = !0;
489
489
  return;
490
490
  }
491
- const f = n.getScenePoint(b), p = c.length ? c[c.length - 1] : null;
491
+ const f = n.getScenePoint(b), p = i.length ? i[i.length - 1] : null;
492
492
  if (!p || p.x2) {
493
493
  const N = new a(
494
494
  [f.x, f.y, f.x, f.y],
@@ -500,14 +500,14 @@ const Ja = (e) => {
500
500
  evented: !1
501
501
  }
502
502
  );
503
- N.replaced = !0, n.add(N), c.push(N);
503
+ N.replaced = !0, n.add(N), i.push(N);
504
504
  } else
505
505
  p.set({ x2: f.x, y2: f.y });
506
- i.push(new s(f.x, f.y));
506
+ c.push(new s(f.x, f.y));
507
507
  }, m = function(g) {
508
508
  if (l)
509
509
  return;
510
- const b = c.length ? c[c.length - 1] : null;
510
+ const b = i.length ? i[i.length - 1] : null;
511
511
  if (b) {
512
512
  const f = g.e;
513
513
  if (!f)
@@ -517,19 +517,19 @@ const Ja = (e) => {
517
517
  }
518
518
  }, v = function() {
519
519
  if (l) {
520
- n.remove(...c);
521
- const g = new o(i, {
520
+ n.remove(...i);
521
+ const g = new o(c, {
522
522
  fill: t,
523
523
  objectCaching: !1,
524
524
  selectable: !1,
525
525
  evented: !0,
526
526
  info: wn
527
527
  });
528
- n.add(g), n.renderAll(), i = [], c = [], l = !1;
528
+ n.add(g), n.renderAll(), c = [], i = [], l = !1;
529
529
  }
530
530
  };
531
531
  return n.defaultCursor = "crosshair", document.addEventListener("contextmenu", u), n.on("mouse:down", I(r)), n.on("mouse:move", I(m)), n.on("mouse:up", I(v)), () => {
532
- document.removeEventListener("contextmenu", u), n.defaultCursor = "default", n.off("mouse:down", I(r)), n.off("mouse:move", I(m)), n.off("mouse:up", I(v)), n.remove(...c), c = [];
532
+ document.removeEventListener("contextmenu", u), n.defaultCursor = "default", n.off("mouse:down", I(r)), n.off("mouse:move", I(m)), n.off("mouse:up", I(v)), n.remove(...i), i = [];
533
533
  };
534
534
  } }), zn = (e) => {
535
535
  if (!e)
@@ -549,17 +549,17 @@ const Ja = (e) => {
549
549
  s[o].points = n.points.map(
550
550
  ({ x: l, y: h }) => new a(l, h)
551
551
  );
552
- const i = [];
552
+ const c = [];
553
553
  s.forEach(({ points: l }) => {
554
554
  if (!l.length)
555
555
  return;
556
556
  const [h, ...u] = l;
557
- i.push(`M ${h.x} ${h.y}`), u.forEach(({ x: r, y: m }) => {
558
- i.push(`L ${r} ${m}`);
559
- }), i.push("Z");
557
+ c.push(`M ${h.x} ${h.y}`), u.forEach(({ x: r, y: m }) => {
558
+ c.push(`L ${r} ${m}`);
559
+ }), c.push("Z");
560
560
  });
561
- const c = new t.Path(i.join(" "));
562
- n.set({ path: c.path }), n.pathContours = s, n.dirty = !0, n.setCoords();
561
+ const i = new t.Path(c.join(" "));
562
+ n.set({ path: i.path }), n.pathContours = s, n.dirty = !0, n.setCoords();
563
563
  }, an = (e) => {
564
564
  const t = ke(), n = e.strokeWidth ?? 0, s = (e.strokeUniform ? 1 / (e.scaleX ?? 1) : 1) * n, o = (e.strokeUniform ? 1 / (e.scaleY ?? 1) : 1) * n;
565
565
  return new t(
@@ -572,8 +572,8 @@ const Ja = (e) => {
572
572
  }, $n = (e, t) => {
573
573
  let n = !1;
574
574
  for (let s = 0, o = t.length - 1; s < t.length; o = s++) {
575
- const a = t[s].x, i = t[s].y, c = t[o].x, l = t[o].y;
576
- i > e.y != l > e.y && e.x < (c - a) * (e.y - i) / (l - i + Number.EPSILON) + a && (n = !n);
575
+ const a = t[s].x, c = t[s].y, i = t[o].x, l = t[o].y;
576
+ c > e.y != l > e.y && e.x < (i - a) * (e.y - c) / (l - c + Number.EPSILON) + a && (n = !n);
577
577
  }
578
578
  return n;
579
579
  }, Gn = (e) => {
@@ -581,15 +581,15 @@ const Ja = (e) => {
581
581
  return 0;
582
582
  let t = 0;
583
583
  for (let n = 0; n < e.length; n += 1) {
584
- const { x: s, y: o } = e[n], { x: a, y: i } = e[(n + 1) % e.length];
585
- t += s * i - a * o;
584
+ const { x: s, y: o } = e[n], { x: a, y: c } = e[(n + 1) % e.length];
585
+ t += s * c - a * o;
586
586
  }
587
587
  return Math.abs(t / 2);
588
588
  }, qn = function(e, t, n) {
589
589
  var l;
590
- const s = ke(), o = oe().util, a = n.points[this.pointIndex ?? 0], i = a.x - n.pathOffset.x, c = a.y - n.pathOffset.y;
590
+ const s = ke(), o = oe().util, a = n.points[this.pointIndex ?? 0], c = a.x - n.pathOffset.x, i = a.y - n.pathOffset.y;
591
591
  return o.transformPoint(
592
- new s(i, c),
592
+ new s(c, i),
593
593
  o.multiplyTransformMatrices(
594
594
  ((l = n.canvas) == null ? void 0 : l.viewportTransform) ?? [1, 0, 0, 1, 0, 0],
595
595
  n.calcTransformMatrix()
@@ -602,49 +602,49 @@ const Ja = (e) => {
602
602
  return [];
603
603
  const s = e.calcTransformMatrix(), o = (a = e.canvas) != null && a.viewportTransform ? n.multiplyTransformMatrices(e.canvas.viewportTransform, s) : s;
604
604
  return e.points.map(
605
- (i) => n.transformPoint(
606
- new t(i.x - e.pathOffset.x, i.y - e.pathOffset.y),
605
+ (c) => n.transformPoint(
606
+ new t(c.x - e.pathOffset.x, c.y - e.pathOffset.y),
607
607
  o
608
608
  )
609
609
  );
610
610
  }, Kn = function(e, t, n, s) {
611
611
  var v;
612
- const o = ke(), a = oe(), i = t.target;
613
- if (!i || !i.points || !i.pathOffset)
612
+ const o = ke(), a = oe(), c = t.target;
613
+ if (!c || !c.points || !c.pathOffset)
614
614
  return !1;
615
- const c = (v = i.controls) == null ? void 0 : v[i.__corner ?? ""];
616
- if (!c)
615
+ const i = (v = c.controls) == null ? void 0 : v[c.__corner ?? ""];
616
+ if (!i)
617
617
  return !1;
618
- const l = c.pointIndex ?? 0, h = i.toLocalPoint(
618
+ const l = i.pointIndex ?? 0, h = c.toLocalPoint(
619
619
  new o(n, s),
620
620
  "center",
621
621
  "center"
622
- ), u = an(i), r = i._getTransformedDimensions(0, 0), m = {
623
- x: h.x * u.x / r.x + i.pathOffset.x,
624
- y: h.y * u.y / r.y + i.pathOffset.y
622
+ ), u = an(c), r = c._getTransformedDimensions(0, 0), m = {
623
+ x: h.x * u.x / r.x + c.pathOffset.x,
624
+ y: h.y * u.y / r.y + c.pathOffset.y
625
625
  };
626
- return i.points[l] = m, i instanceof a.Path && Fn(i), !0;
626
+ return c.points[l] = m, c instanceof a.Path && Fn(c), !0;
627
627
  }, Jn = function(e, t) {
628
628
  return function(n, s, o, a) {
629
629
  var Z;
630
- const i = ke(), c = s.target;
631
- if (!c.points || !c.pathOffset)
630
+ const c = ke(), i = s.target;
631
+ if (!i.points || !i.pathOffset)
632
632
  return !1;
633
- const l = c.controls, h = typeof c.__corner == "string" ? c.__corner : "", u = l == null ? void 0 : l[h], r = (u == null ? void 0 : u.pointIndex) ?? e, v = oe().util.transformPoint(
634
- new i(
635
- c.points[e].x - c.pathOffset.x,
636
- c.points[e].y - c.pathOffset.y
633
+ const l = i.controls, h = typeof i.__corner == "string" ? i.__corner : "", u = l == null ? void 0 : l[h], r = (u == null ? void 0 : u.pointIndex) ?? e, v = oe().util.transformPoint(
634
+ new c(
635
+ i.points[e].x - i.pathOffset.x,
636
+ i.points[e].y - i.pathOffset.y
637
637
  ),
638
- c.calcTransformMatrix()
639
- ), g = t(n, s, o, a), b = an(c), f = (c.points[e].x - c.pathOffset.x) / b.x, p = (c.points[e].y - c.pathOffset.y) / b.y;
640
- Xn(c), c.setPositionByOrigin(
638
+ i.calcTransformMatrix()
639
+ ), g = t(n, s, o, a), b = an(i), f = (i.points[e].x - i.pathOffset.x) / b.x, p = (i.points[e].y - i.pathOffset.y) / b.y;
640
+ Xn(i), i.setPositionByOrigin(
641
641
  v,
642
642
  f + 0.5,
643
643
  p + 0.5
644
644
  );
645
- const N = c.editSnapshot;
645
+ const N = i.editSnapshot;
646
646
  if ((Z = N == null ? void 0 : N.absolutePoints) != null && Z.length) {
647
- const D = cn(c).map((k, H) => {
647
+ const D = cn(i).map((k, H) => {
648
648
  if (H === r)
649
649
  return null;
650
650
  const w = N.absolutePoints[H];
@@ -657,10 +657,10 @@ const Ja = (e) => {
657
657
  );
658
658
  if (D.length) {
659
659
  const k = D.reduce((w, { dx: C }) => w + C, 0) / D.length, H = D.reduce((w, { dy: C }) => w + C, 0) / D.length;
660
- (k !== 0 || H !== 0) && (c.set({
661
- left: (c.left ?? 0) + k,
662
- top: (c.top ?? 0) + H
663
- }), c.setCoords());
660
+ (k !== 0 || H !== 0) && (i.set({
661
+ left: (i.left ?? 0) + k,
662
+ top: (i.top ?? 0) + H
663
+ }), i.setCoords());
664
664
  }
665
665
  }
666
666
  return g;
@@ -685,9 +685,9 @@ const Ja = (e) => {
685
685
  ),
686
686
  area: Gn(r)
687
687
  })
688
- ), c = ((h = a.filter(({ inside: r }) => r).sort((r, m) => r.area - m.area)[0]) == null ? void 0 : h.index) ?? ((u = a.sort((r, m) => r.distance - m.distance)[0]) == null ? void 0 : u.index) ?? 0;
689
- e.pathEditableContourIndex = c;
690
- const l = e.pathContours[c];
688
+ ), i = ((h = a.filter(({ inside: r }) => r).sort((r, m) => r.area - m.area)[0]) == null ? void 0 : h.index) ?? ((u = a.sort((r, m) => r.distance - m.distance)[0]) == null ? void 0 : u.index) ?? 0;
689
+ e.pathEditableContourIndex = i;
690
+ const l = e.pathContours[i];
691
691
  l && (e.points = l.points.map(
692
692
  ({ x: r, y: m }) => new s(r, m)
693
693
  ));
@@ -695,20 +695,20 @@ const Ja = (e) => {
695
695
  var s;
696
696
  const t = En(), n = (((s = e.points) == null ? void 0 : s.length) ?? 1) - 1;
697
697
  e.controls = (e.points ?? []).reduce(
698
- function(o, a, i) {
699
- const c = () => (e.editSnapshot = {
700
- dragIndex: i,
698
+ function(o, a, c) {
699
+ const i = () => (e.editSnapshot = {
700
+ dragIndex: c,
701
701
  absolutePoints: cn(e)
702
702
  }, !1), l = () => (delete e.editSnapshot, !1);
703
- return o["p" + i] = new t({
703
+ return o["p" + c] = new t({
704
704
  positionHandler: qn,
705
705
  actionHandler: Jn(
706
- i > 0 ? i - 1 : n,
706
+ c > 0 ? c - 1 : n,
707
707
  Kn
708
708
  ),
709
709
  actionName: "editPolygon",
710
- pointIndex: i,
711
- mouseDownHandler: c,
710
+ pointIndex: c,
711
+ mouseDownHandler: i,
712
712
  mouseUpHandler: l
713
713
  }), o;
714
714
  },
@@ -738,12 +738,12 @@ const Ja = (e) => {
738
738
  a.forEach((w) => {
739
739
  w.selectable = !0, w.evented = !0;
740
740
  });
741
- let i = null;
742
- const c = (w = !1) => {
743
- i && (xt(o), i = null, w && o.discardActiveObject(), Ne(o));
741
+ let c = null;
742
+ const i = (w = !1) => {
743
+ c && (xt(o), c = null, w && o.discardActiveObject(), Ne(o));
744
744
  }, l = function(w) {
745
745
  const C = w.scenePoint ?? w.absolutePointer, E = w.target;
746
- i && E !== i && c(!E), C && (t = !0, s.x = C.x, s.y = C.y);
746
+ c && E !== c && i(!E), C && (t = !0, s.x = C.x, s.y = C.y);
747
747
  }, h = function(w) {
748
748
  t && a.forEach((C) => {
749
749
  C.info === Fe && (C.selectable = !1);
@@ -757,7 +757,7 @@ const Ja = (e) => {
757
757
  }, m = function() {
758
758
  }, v = function(w) {
759
759
  if (w.key === "Escape" || w.code === "Escape") {
760
- c(!0);
760
+ i(!0);
761
761
  return;
762
762
  }
763
763
  n = w.shiftKey;
@@ -769,16 +769,16 @@ const Ja = (e) => {
769
769
  w.target ?? null,
770
770
  C
771
771
  );
772
- E && (i = E, o.setActiveObject(E));
772
+ E && (c = E, o.setActiveObject(E));
773
773
  }, f = He(l), p = He(h), N = He(u), Z = He(r), V = He(m), D = He(b), k = () => {
774
- c();
774
+ i();
775
775
  };
776
776
  o.on("mouse:down", I(f)), o.on("mouse:move", I(p)), o.on("mouse:up", I(N)), o.on("mouse:over", I(Z)), o.on("mouse:out", I(V)), o.on("mouse:dblclick", I(D)), o.on("selection:cleared", k), document.addEventListener("keydown", v), document.addEventListener("keyup", g);
777
777
  const H = we(o).find(
778
778
  ({ info: w }) => w === it
779
779
  );
780
780
  return H && (o.remove(H), Ne(o)), () => {
781
- c(), o.defaultCursor = "default", o.hoverCursor = "default", o.moveCursor = "default", o.selection = !1, o.discardActiveObject(), Ne(o), o.off("mouse:down", I(f)), o.off("mouse:move", I(p)), o.off("mouse:up", I(N)), o.off("mouse:over", I(Z)), o.off("mouse:out", I(V)), o.off("mouse:dblclick", I(D)), o.off("selection:cleared", k), document.removeEventListener("keydown", v), document.removeEventListener("keyup", g), a.forEach((w) => {
781
+ i(), o.defaultCursor = "default", o.hoverCursor = "default", o.moveCursor = "default", o.selection = !1, o.discardActiveObject(), Ne(o), o.off("mouse:down", I(f)), o.off("mouse:move", I(p)), o.off("mouse:up", I(N)), o.off("mouse:over", I(Z)), o.off("mouse:out", I(V)), o.off("mouse:dblclick", I(D)), o.off("selection:cleared", k), document.removeEventListener("keydown", v), document.removeEventListener("keyup", g), a.forEach((w) => {
782
782
  w.selectable = !1, w.evented = !1;
783
783
  });
784
784
  };
@@ -798,7 +798,7 @@ const ja = (e) => {
798
798
  );
799
799
  return;
800
800
  }
801
- const a = pe(), i = Kt(), c = ke(), l = oe();
801
+ const a = pe(), c = Kt(), i = ke(), l = oe();
802
802
  a.defaultCursor = "crosshair", a.hoverCursor = "crosshair";
803
803
  const h = !o || o.id !== "superpixel", u = await nn(t), { width: r, height: m } = u, v = we(a).filter(({ info: x }) => x === _e).pop(), g = (v == null ? void 0 : v.index) ?? 0, b = h ? g + 1 : g, f = document.createElement("canvas").getContext("2d");
804
804
  if (!f) return;
@@ -817,7 +817,7 @@ const ja = (e) => {
817
817
  f.canvas.remove();
818
818
  let w = setTimeout(async () => {
819
819
  w && clearTimeout(w), w = null;
820
- const x = await i.fromURL(H, {}, {
820
+ const x = await c.fromURL(H, {}, {
821
821
  left: 0,
822
822
  top: 0,
823
823
  objectCaching: !1,
@@ -861,9 +861,9 @@ const ja = (e) => {
861
861
  const Re = { x: me, y: Ie }, Pe = je.map((X) => ({
862
862
  inner: X.inner,
863
863
  points: X.points.map(
864
- ({ x: K, y: Te }) => new c(K - Re.x, Te - Re.y)
864
+ ({ x: K, y: Te }) => new i(K - Re.x, Te - Re.y)
865
865
  )
866
- })).sort((X, K) => Number(X.inner) - Number(K.inner)), Qe = Pe.findIndex(({ inner: X }) => !X), De = Qe >= 0 ? Qe : 0, F = Pe[De] ?? Pe[0], ne = (F == null ? void 0 : F.points.map(({ x: X, y: K }) => new c(X, K))) ?? [], ye = [];
866
+ })).sort((X, K) => Number(X.inner) - Number(K.inner)), Qe = Pe.findIndex(({ inner: X }) => !X), De = Qe >= 0 ? Qe : 0, F = Pe[De] ?? Pe[0], ne = (F == null ? void 0 : F.points.map(({ x: X, y: K }) => new i(X, K))) ?? [], ye = [];
867
867
  return Pe.forEach(({ points: X }) => {
868
868
  if (!X.length) return;
869
869
  const [K, ...Te] = X;
@@ -877,7 +877,7 @@ const ja = (e) => {
877
877
  selectable: !1,
878
878
  evented: !0,
879
879
  fillRule: "evenodd",
880
- pathOffset: new c(0, 0),
880
+ pathOffset: new i(0, 0),
881
881
  points: ne,
882
882
  pathContours: Pe,
883
883
  pathBaseOffset: Re,
@@ -978,7 +978,7 @@ const ja = (e) => {
978
978
  const t = e.info ?? "";
979
979
  return oo.has(t) ? "box" : "segmentation";
980
980
  }, ao = (e, t, n) => {
981
- const s = nt(e.left), o = nt(e.top), a = nt(e.width), i = nt(e.height), c = rt(e.scaleX), l = rt(e.scaleY), h = a * c, u = i * l;
981
+ const s = nt(e.left), o = nt(e.top), a = nt(e.width), c = nt(e.height), i = rt(e.scaleX), l = rt(e.scaleY), h = a * i, u = c * l;
982
982
  return {
983
983
  type: "box",
984
984
  x: t > 0 ? s / t : s,
@@ -996,17 +996,17 @@ const ja = (e) => {
996
996
  Math.round((t == null ? void 0 : t.height) ?? (e.height ?? 0) * rt(e.scaleY))
997
997
  ), o = Rn(), a = document.createElement("canvas");
998
998
  a.width = n, a.height = s;
999
- const i = new o(a, {
999
+ const c = new o(a, {
1000
1000
  width: n,
1001
1001
  height: s,
1002
1002
  renderOnAddRemove: !1
1003
- }), c = await io(e), l = (t == null ? void 0 : t.left) ?? 0, h = (t == null ? void 0 : t.top) ?? 0;
1004
- c.set({
1005
- left: (c.left ?? 0) - l,
1006
- top: (c.top ?? 0) - h
1007
- }), i.add(c), i.renderAll();
1008
- const u = i.toDataURL({ format: "png", multiplier: 1 });
1009
- return i.dispose(), a.remove(), u;
1003
+ }), i = await io(e), l = (t == null ? void 0 : t.left) ?? 0, h = (t == null ? void 0 : t.top) ?? 0;
1004
+ i.set({
1005
+ left: (i.left ?? 0) - l,
1006
+ top: (i.top ?? 0) - h
1007
+ }), c.add(i), c.renderAll();
1008
+ const u = c.toDataURL({ format: "png", multiplier: 1 });
1009
+ return c.dispose(), a.remove(), u;
1010
1010
  }, ro = async (e) => {
1011
1011
  const t = await co(e);
1012
1012
  if (!t) return null;
@@ -1027,11 +1027,11 @@ const ja = (e) => {
1027
1027
  const o = so(e);
1028
1028
  let a = null;
1029
1029
  o === "box" ? a = ao(e, t, n) : a = await ro(e);
1030
- const i = lo(e), c = {
1030
+ const c = lo(e), i = {
1031
1031
  name: e.class ?? "",
1032
1032
  index: $e(e.seq) ? e.seq : 0
1033
1033
  };
1034
- return { id: s, type: o, label: c, style: i, geometry: a };
1034
+ return { id: s, type: o, label: i, style: c, geometry: a };
1035
1035
  }, un = async (e, t, n) => {
1036
1036
  const s = [];
1037
1037
  for (const o of e) {
@@ -1040,19 +1040,19 @@ const ja = (e) => {
1040
1040
  }
1041
1041
  return s;
1042
1042
  }, hn = (e, t, n) => {
1043
- const { id: s, type: o, label: a, style: i, geometry: c } = e, l = {
1043
+ const { id: s, type: o, label: a, style: c, geometry: i } = e, l = {
1044
1044
  unique: s,
1045
1045
  class: a.name,
1046
1046
  seq: a.index,
1047
- hex: i.color.replace("#", ""),
1048
- alpha: `${Math.round(i.opacity * 100)}%`,
1049
- opacity: i.opacity,
1047
+ hex: c.color.replace("#", ""),
1048
+ alpha: `${Math.round(c.opacity * 100)}%`,
1049
+ opacity: c.opacity,
1050
1050
  objectCaching: !1,
1051
1051
  selectable: !1,
1052
1052
  evented: !0
1053
1053
  };
1054
- if (i.lineColor && (l.stroke = i.lineColor), o === "box" && (c == null ? void 0 : c.type) === "box") {
1055
- const h = c;
1054
+ if (c.lineColor && (l.stroke = c.lineColor), o === "box" && (i == null ? void 0 : i.type) === "box") {
1055
+ const h = i;
1056
1056
  return {
1057
1057
  ...l,
1058
1058
  type: "rect",
@@ -1060,13 +1060,13 @@ const ja = (e) => {
1060
1060
  top: h.y * n,
1061
1061
  width: h.width * t,
1062
1062
  height: h.height * n,
1063
- fill: i.lineColor ? "" : tn(i.color.replace("#", ""), i.opacity),
1064
- stroke: i.lineColor ?? void 0,
1065
- info: i.lineColor ? Fe : It
1063
+ fill: c.lineColor ? "" : tn(c.color.replace("#", ""), c.opacity),
1064
+ stroke: c.lineColor ?? void 0,
1065
+ info: c.lineColor ? Fe : It
1066
1066
  };
1067
1067
  }
1068
- if (o === "segmentation" && (c == null ? void 0 : c.type) === "segmentation") {
1069
- const h = c;
1068
+ if (o === "segmentation" && (i == null ? void 0 : i.type) === "segmentation") {
1069
+ const h = i;
1070
1070
  if (h.vector)
1071
1071
  try {
1072
1072
  return {
@@ -1091,8 +1091,8 @@ const ja = (e) => {
1091
1091
  const m = t;
1092
1092
  t = u ?? (typeof r != "object" || r === null) ? r : Object.assign({}, t, r), n.forEach((v) => v(t, m));
1093
1093
  }
1094
- }, o = () => t, c = { setState: s, getState: o, getInitialState: () => l, subscribe: (h) => (n.add(h), () => n.delete(h)) }, l = t = e(s, o, c);
1095
- return c;
1094
+ }, o = () => t, i = { setState: s, getState: o, getInitialState: () => l, subscribe: (h) => (n.add(h), () => n.delete(h)) }, l = t = e(s, o, i);
1095
+ return i;
1096
1096
  }, fn = (e) => e ? Ht(e) : Ht, ho = (e) => e;
1097
1097
  function fo(e, t = ho) {
1098
1098
  const n = tt.useSyncExternalStore(
@@ -1165,10 +1165,10 @@ const _t = (e) => {
1165
1165
  var Zt = (e, t, n) => (o, a) => ({
1166
1166
  pastStates: (n == null ? void 0 : n.pastStates) || [],
1167
1167
  futureStates: (n == null ? void 0 : n.futureStates) || [],
1168
- undo: (i = 1) => {
1169
- var c, l;
1168
+ undo: (c = 1) => {
1169
+ var i, l;
1170
1170
  if (a().pastStates.length) {
1171
- const h = ((c = n == null ? void 0 : n.partialize) == null ? void 0 : c.call(n, t())) || t(), u = a().pastStates.splice(-i, i), r = u.shift();
1171
+ const h = ((i = n == null ? void 0 : n.partialize) == null ? void 0 : i.call(n, t())) || t(), u = a().pastStates.splice(-c, c), r = u.shift();
1172
1172
  e(r), o({
1173
1173
  pastStates: a().pastStates,
1174
1174
  futureStates: a().futureStates.concat(
@@ -1178,10 +1178,10 @@ var Zt = (e, t, n) => (o, a) => ({
1178
1178
  });
1179
1179
  }
1180
1180
  },
1181
- redo: (i = 1) => {
1182
- var c, l;
1181
+ redo: (c = 1) => {
1182
+ var i, l;
1183
1183
  if (a().futureStates.length) {
1184
- const h = ((c = n == null ? void 0 : n.partialize) == null ? void 0 : c.call(n, t())) || t(), u = a().futureStates.splice(-i, i), r = u.shift();
1184
+ const h = ((i = n == null ? void 0 : n.partialize) == null ? void 0 : i.call(n, t())) || t(), u = a().futureStates.splice(-c, c), r = u.shift();
1185
1185
  e(r), o({
1186
1186
  pastStates: a().pastStates.concat(
1187
1187
  ((l = n == null ? void 0 : n.diff) == null ? void 0 : l.call(n, h, r)) || h,
@@ -1195,13 +1195,13 @@ var Zt = (e, t, n) => (o, a) => ({
1195
1195
  isTracking: !0,
1196
1196
  pause: () => o({ isTracking: !1 }),
1197
1197
  resume: () => o({ isTracking: !0 }),
1198
- setOnSave: (i) => o({ _onSave: i }),
1198
+ setOnSave: (c) => o({ _onSave: c }),
1199
1199
  // Internal properties
1200
1200
  _onSave: n == null ? void 0 : n.onSave,
1201
- _handleSet: (i, c, l, h) => {
1201
+ _handleSet: (c, i, l, h) => {
1202
1202
  var u, r;
1203
- n != null && n.limit && a().pastStates.length >= (n == null ? void 0 : n.limit) && a().pastStates.shift(), (r = (u = a())._onSave) == null || r.call(u, i, l), o({
1204
- pastStates: a().pastStates.concat(h || i),
1203
+ n != null && n.limit && a().pastStates.length >= (n == null ? void 0 : n.limit) && a().pastStates.shift(), (r = (u = a())._onSave) == null || r.call(u, c, l), o({
1204
+ pastStates: a().pastStates.concat(h || c),
1205
1205
  futureStates: []
1206
1206
  });
1207
1207
  }
@@ -1210,16 +1210,16 @@ var Zt = (e, t, n) => (o, a) => ({
1210
1210
  a.temporal = fn(
1211
1211
  ((h = t == null ? void 0 : t.wrapTemporal) == null ? void 0 : h.call(t, Zt(s, o, t))) || Zt(s, o, t)
1212
1212
  );
1213
- const i = ((u = t == null ? void 0 : t.handleSet) == null ? void 0 : u.call(
1213
+ const c = ((u = t == null ? void 0 : t.handleSet) == null ? void 0 : u.call(
1214
1214
  t,
1215
1215
  a.temporal.getState()._handleSet
1216
- )) || a.temporal.getState()._handleSet, c = (r) => {
1216
+ )) || a.temporal.getState()._handleSet, i = (r) => {
1217
1217
  var g, b, f;
1218
1218
  if (!a.temporal.getState().isTracking) return;
1219
1219
  const m = ((g = t == null ? void 0 : t.partialize) == null ? void 0 : g.call(t, o())) || o(), v = (b = t == null ? void 0 : t.diff) == null ? void 0 : b.call(t, r, m);
1220
1220
  // If the user has provided a diff function but nothing has been changed, deltaState will be null
1221
1221
  v === null || // If the user has provided an equality function, use it
1222
- (f = t == null ? void 0 : t.equality) != null && f.call(t, r, m) || i(
1222
+ (f = t == null ? void 0 : t.equality) != null && f.call(t, r, m) || c(
1223
1223
  r,
1224
1224
  void 0,
1225
1225
  m,
@@ -1229,13 +1229,13 @@ var Zt = (e, t, n) => (o, a) => ({
1229
1229
  return a.setState = (...r) => {
1230
1230
  var v;
1231
1231
  const m = ((v = t == null ? void 0 : t.partialize) == null ? void 0 : v.call(t, o())) || o();
1232
- l(...r), c(m);
1232
+ l(...r), i(m);
1233
1233
  }, e(
1234
1234
  // Modify the set function to call the userlandSet function
1235
1235
  (...r) => {
1236
1236
  var v;
1237
1237
  const m = ((v = t == null ? void 0 : t.partialize) == null ? void 0 : v.call(t, o())) || o();
1238
- s(...r), c(m);
1238
+ s(...r), i(m);
1239
1239
  },
1240
1240
  o,
1241
1241
  a
@@ -1266,7 +1266,7 @@ const ei = () => j()(
1266
1266
  setMode: (n) => e({ mode: n }),
1267
1267
  cycleMode: () => {
1268
1268
  const n = t().mode, s = mt.findIndex(
1269
- (a) => a.length === n.length && a.every((i, c) => i === n[c])
1269
+ (a) => a.length === n.length && a.every((c, i) => c === n[i])
1270
1270
  ), o = s >= 0 ? mt[(s + 1) % mt.length] : le.NORMAL;
1271
1271
  e({ mode: o });
1272
1272
  }
@@ -1460,8 +1460,8 @@ function bo({
1460
1460
  viewMode: s,
1461
1461
  onViewModeChange: o,
1462
1462
  availableViewModes: a = ["Image"],
1463
- textContent: i,
1464
- numberContent: c,
1463
+ textContent: c,
1464
+ numberContent: i,
1465
1465
  fileContent: l,
1466
1466
  records: h,
1467
1467
  activeRecordId: u,
@@ -1506,8 +1506,8 @@ function bo({
1506
1506
  viewMode: se,
1507
1507
  onViewModeChange: de,
1508
1508
  availableViewModes: a,
1509
- textContent: i,
1510
- numberContent: c,
1509
+ textContent: c,
1510
+ numberContent: i,
1511
1511
  fileContent: l,
1512
1512
  records: h,
1513
1513
  activeRecordId: u,
@@ -1547,8 +1547,8 @@ function bo({
1547
1547
  se,
1548
1548
  de,
1549
1549
  a,
1550
- i,
1551
1550
  c,
1551
+ i,
1552
1552
  l,
1553
1553
  h,
1554
1554
  u,
@@ -1582,7 +1582,7 @@ function bo({
1582
1582
  const W = {};
1583
1583
  return O.primary && (W["--lc-primary"] = O.primary), O.background && (W["--lc-background"] = O.background), O.surface && (W["--lc-surface"] = O.surface), O.border && (W["--lc-border"] = O.border), O.text && (W["--lc-text"] = O.text), O.textSecondary && (W["--lc-text-secondary"] = O.textSecondary), O.hover && (W["--lc-hover"] = O.hover), O.fontFamily && (W["--lc-font-family"] = O.fontFamily), Object.keys(W).length > 0 ? W : void 0;
1584
1584
  }, [O]);
1585
- return /* @__PURE__ */ d(Cn.Provider, { value: Oe, children: /* @__PURE__ */ d("div", { style: ue, children: B }) });
1585
+ return /* @__PURE__ */ d(Cn.Provider, { value: Oe, children: /* @__PURE__ */ d("div", { style: { width: "100%", height: "100%", ...ue }, children: B }) });
1586
1586
  }
1587
1587
  const yo = [
1588
1588
  // ─── Labeling Tools ───
@@ -1798,7 +1798,7 @@ function fe({
1798
1798
  clipRule: "evenodd",
1799
1799
  className: n,
1800
1800
  style: s,
1801
- children: o.d.map((i, c) => /* @__PURE__ */ d("path", { d: i }, c))
1801
+ children: o.d.map((c, i) => /* @__PURE__ */ d("path", { d: c }, i))
1802
1802
  }
1803
1803
  );
1804
1804
  }
@@ -1841,8 +1841,8 @@ function Yo({
1841
1841
  mode: s = "labeling",
1842
1842
  onModeChange: o,
1843
1843
  onSave: a,
1844
- onSaveToRecord: i,
1845
- isSaving: c = !1,
1844
+ onSaveToRecord: c,
1845
+ isSaving: i = !1,
1846
1846
  onNavigateLeft: l,
1847
1847
  onNavigateRight: h,
1848
1848
  canNavigateLeft: u = !1,
@@ -1888,8 +1888,8 @@ function Yo({
1888
1888
  Go,
1889
1889
  {
1890
1890
  onSave: a,
1891
- onSaveToRecord: i,
1892
- isSaving: c
1891
+ onSaveToRecord: c,
1892
+ isSaving: i
1893
1893
  }
1894
1894
  ),
1895
1895
  o && /* @__PURE__ */ d(
@@ -1922,9 +1922,9 @@ function zo({
1922
1922
  )) });
1923
1923
  }
1924
1924
  function Fo({ viewMode: e }) {
1925
- const t = Ee((l) => l.tool), n = mn((l) => l.objects), s = gn((l) => l.selectedSegment), o = vn((l) => l.selectedSegment), a = We((l) => l.colorCode), i = lt((l) => l.opacity), c = t ? Wo[t.id] ?? t.id : "—";
1925
+ const t = Ee((l) => l.tool), n = mn((l) => l.objects), s = gn((l) => l.selectedSegment), o = vn((l) => l.selectedSegment), a = We((l) => l.colorCode), c = lt((l) => l.opacity), i = t ? Wo[t.id] ?? t.id : "—";
1926
1926
  return e === "Record" || e === "File" ? null : /* @__PURE__ */ S("div", { className: U.metaInfo, children: [
1927
- /* @__PURE__ */ d("div", { className: U.metaItem, children: /* @__PURE__ */ d("em", { children: c }) }),
1927
+ /* @__PURE__ */ d("div", { className: U.metaItem, children: /* @__PURE__ */ d("em", { children: i }) }),
1928
1928
  /* @__PURE__ */ d("div", { className: U.metaDivider }),
1929
1929
  e === "Image" && /* @__PURE__ */ d(Xo, { objects: n }),
1930
1930
  e === "Text" && s && /* @__PURE__ */ S("div", { className: U.metaItem, children: [
@@ -1953,7 +1953,7 @@ function Fo({ viewMode: e }) {
1953
1953
  ),
1954
1954
  /* @__PURE__ */ d("em", { children: a }),
1955
1955
  /* @__PURE__ */ S("span", { children: [
1956
- Math.round(i * 100),
1956
+ Math.round(c * 100),
1957
1957
  "%"
1958
1958
  ] })
1959
1959
  ] })
@@ -1989,19 +1989,19 @@ function $o() {
1989
1989
  n(`${s}%`);
1990
1990
  }, [s]);
1991
1991
  const o = $(
1992
- (i) => {
1993
- const c = Math.max(0.1, Math.min(5, i));
1992
+ (c) => {
1993
+ const i = Math.max(0.1, Math.min(5, c));
1994
1994
  e.setZoom({
1995
- level: c,
1995
+ level: i,
1996
1996
  width: e.width,
1997
1997
  height: e.height
1998
1998
  });
1999
1999
  },
2000
2000
  [e]
2001
- ), a = (i) => {
2002
- if (i.key === "Enter") {
2003
- const c = parseInt(t, 10);
2004
- isNaN(c) || o(c / 100), i.target.blur();
2001
+ ), a = (c) => {
2002
+ if (c.key === "Enter") {
2003
+ const i = parseInt(t, 10);
2004
+ isNaN(i) || o(i / 100), c.target.blur();
2005
2005
  }
2006
2006
  };
2007
2007
  return /* @__PURE__ */ S("div", { className: U.zoomControls, children: [
@@ -2019,7 +2019,7 @@ function $o() {
2019
2019
  {
2020
2020
  className: U.zoomInput,
2021
2021
  value: t,
2022
- onChange: (i) => n(i.target.value),
2022
+ onChange: (c) => n(c.target.value),
2023
2023
  onKeyDown: a,
2024
2024
  onBlur: () => n(`${s}%`)
2025
2025
  }
@@ -2043,10 +2043,10 @@ function Go({
2043
2043
  const [s, o] = re(!1), a = Ce(null);
2044
2044
  return ce(() => {
2045
2045
  if (!s) return;
2046
- const i = (c) => {
2047
- a.current && !a.current.contains(c.target) && o(!1);
2046
+ const c = (i) => {
2047
+ a.current && !a.current.contains(i.target) && o(!1);
2048
2048
  };
2049
- return window.addEventListener("mousedown", i), () => window.removeEventListener("mousedown", i);
2049
+ return window.addEventListener("mousedown", c), () => window.removeEventListener("mousedown", c);
2050
2050
  }, [s]), t ? /* @__PURE__ */ S("div", { className: U.saveDropdownWrapper, ref: a, children: [
2051
2051
  /* @__PURE__ */ S("div", { className: U.controlBtnGroup, children: [
2052
2052
  /* @__PURE__ */ S(
@@ -2065,7 +2065,7 @@ function Go({
2065
2065
  "button",
2066
2066
  {
2067
2067
  className: U.controlBtnPrimary,
2068
- onClick: () => o((i) => !i),
2068
+ onClick: () => o((c) => !c),
2069
2069
  disabled: n,
2070
2070
  children: /* @__PURE__ */ d(fe, { iconType: "icon-down", size: "xxs" })
2071
2071
  }
@@ -2119,46 +2119,46 @@ function qo() {
2119
2119
  }
2120
2120
  );
2121
2121
  }
2122
- function Ko(e, t) {
2123
- const n = Ce(null), s = Ce(null), o = Ce(t);
2124
- return o.current = t, ce(() => {
2122
+ function Ko(e, t, n = !1) {
2123
+ const s = Ce(null), o = Ce(null), a = Ce(t);
2124
+ return a.current = t, ce(() => {
2125
2125
  if (!Q()) return;
2126
- if (n.current && (n.current(), n.current = null), !e) {
2127
- s.current = null;
2126
+ if (s.current && (s.current(), s.current = null), !e) {
2127
+ o.current = null;
2128
2128
  return;
2129
2129
  }
2130
- const i = o.current;
2131
- let c = !1;
2132
- const l = async () => {
2133
- let h;
2130
+ const i = a.current;
2131
+ let l = !1;
2132
+ const h = async () => {
2133
+ let u;
2134
2134
  switch (e.id) {
2135
2135
  case "selection":
2136
- h = await e.init();
2136
+ u = await e.init();
2137
2137
  break;
2138
2138
  case "brush":
2139
- h = await e.init({
2139
+ u = await e.init({
2140
2140
  brush: i.brush,
2141
2141
  colorCode: i.colorCode
2142
2142
  });
2143
2143
  break;
2144
2144
  case "bounded-box":
2145
2145
  case "filled-box":
2146
- h = await e.init({
2146
+ u = await e.init({
2147
2147
  colorCode: i.colorCode
2148
2148
  });
2149
2149
  break;
2150
2150
  case "pen":
2151
- h = await e.init({
2151
+ u = await e.init({
2152
2152
  colorCode: i.colorCode
2153
2153
  });
2154
2154
  break;
2155
2155
  case "eraser":
2156
- h = await e.init({
2156
+ u = await e.init({
2157
2157
  brush: i.brush
2158
2158
  });
2159
2159
  break;
2160
2160
  case "magic-brush":
2161
- h = await e.init({
2161
+ u = await e.init({
2162
2162
  src: i.imageUrl ?? "",
2163
2163
  colorCode: i.colorCode,
2164
2164
  brush: i.brush,
@@ -2169,7 +2169,7 @@ function Ko(e, t) {
2169
2169
  });
2170
2170
  break;
2171
2171
  case "superpixel":
2172
- h = await e.init({
2172
+ u = await e.init({
2173
2173
  src: i.imageUrl ?? "",
2174
2174
  colorCode: i.colorCode,
2175
2175
  superpixelConfig: i.superpixelConfig ?? {},
@@ -2177,20 +2177,20 @@ function Ko(e, t) {
2177
2177
  });
2178
2178
  break;
2179
2179
  case "seg-anything":
2180
- h = await e.init({
2180
+ u = await e.init({
2181
2181
  callback: i.segAnythingCallback
2182
2182
  });
2183
2183
  break;
2184
2184
  default:
2185
- h = await e.init(i);
2185
+ u = await e.init(i);
2186
2186
  break;
2187
2187
  }
2188
- !c && typeof h == "function" && (n.current = h);
2188
+ !l && typeof u == "function" && (s.current = u);
2189
2189
  };
2190
- return s.current = e.id, l(), () => {
2191
- c = !0, n.current && (n.current(), n.current = null);
2190
+ return o.current = e.id, h(), () => {
2191
+ l = !0, s.current && (s.current(), s.current = null);
2192
2192
  };
2193
- }, [e]), { activeToolId: s.current };
2193
+ }, [e, n]), { activeToolId: o.current };
2194
2194
  }
2195
2195
  const J = {
2196
2196
  common: {
@@ -2240,7 +2240,7 @@ function Qo({
2240
2240
  onRedo: o,
2241
2241
  disabled: a = !1
2242
2242
  }) {
2243
- const i = Se((h) => h.cycleMode), c = Co((h) => h.toggleActive), l = Ge();
2243
+ const c = Se((h) => h.cycleMode), i = Co((h) => h.toggleActive), l = Ge();
2244
2244
  ce(() => {
2245
2245
  if (a) return;
2246
2246
  const h = (u) => {
@@ -2287,11 +2287,11 @@ function Qo({
2287
2287
  return;
2288
2288
  }
2289
2289
  if (r === m.layerToggle) {
2290
- i();
2290
+ c();
2291
2291
  return;
2292
2292
  }
2293
2293
  if (r === m.navigationToggle) {
2294
- c();
2294
+ i();
2295
2295
  return;
2296
2296
  }
2297
2297
  if (!t && e === "Image") {
@@ -2328,8 +2328,8 @@ function Qo({
2328
2328
  s,
2329
2329
  o,
2330
2330
  a,
2331
- i,
2332
2331
  c,
2332
+ i,
2333
2333
  l
2334
2334
  ]);
2335
2335
  }
@@ -2345,7 +2345,7 @@ const es = {
2345
2345
  segAnything: no
2346
2346
  };
2347
2347
  function ts() {
2348
- const e = Ee((r) => r.tool), t = Ee((r) => r.setTool), n = We((r) => r.colorCode), s = We((r) => r.setColorCode), o = lt((r) => r.opacity), a = lt((r) => r.setOpacity), i = wt((r) => r.brush), c = wt((r) => r.setBrush), l = $(
2348
+ const e = Ee((r) => r.tool), t = Ee((r) => r.setTool), n = We((r) => r.colorCode), s = We((r) => r.setColorCode), o = lt((r) => r.opacity), a = lt((r) => r.setOpacity), c = wt((r) => r.brush), i = wt((r) => r.setBrush), l = $(
2349
2349
  (r) => {
2350
2350
  const m = es[r];
2351
2351
  m && t(m());
@@ -2364,10 +2364,10 @@ function ts() {
2364
2364
  setColorCode: s,
2365
2365
  opacity: o,
2366
2366
  setOpacity: a,
2367
- brush: i,
2368
- setBrush: c
2367
+ brush: c,
2368
+ setBrush: i
2369
2369
  }),
2370
- [u, e, l, h, n, s, o, a, i, c]
2370
+ [u, e, l, h, n, s, o, a, c, i]
2371
2371
  );
2372
2372
  }
2373
2373
  const ns = "lc-workspace-8csim", os = "lc-mainSection-uZv5Q", ss = "lc-canvasArea-zoUW1", as = "lc-canvasSection-aUKNP", is = "lc-imagePanel-ghGQ6", cs = "lc-sidePanel-3s3Nv", Ze = {
@@ -2386,7 +2386,7 @@ function Ft({
2386
2386
  width: o,
2387
2387
  height: a
2388
2388
  }) {
2389
- const i = Ce(null), c = Ce(null), [l, h] = re(!1), [u, r] = re({ width: 0, height: 0 }), m = Ce(t);
2389
+ const c = Ce(null), i = Ce(null), [l, h] = re(!1), [u, r] = re({ width: 0, height: 0 }), m = Ce(t);
2390
2390
  m.current = t;
2391
2391
  const v = Ce(n);
2392
2392
  v.current = n;
@@ -2395,7 +2395,7 @@ function Ft({
2395
2395
  colorCode: N,
2396
2396
  brush: Z,
2397
2397
  imageUrl: w
2398
- }), Qo({
2398
+ }, l), Qo({
2399
2399
  viewMode: V,
2400
2400
  isValidationMode: D,
2401
2401
  setTool: H,
@@ -2448,7 +2448,7 @@ function Ft({
2448
2448
  });
2449
2449
  };
2450
2450
  document.addEventListener("keydown", O), document.addEventListener("keyup", y), document.addEventListener("mousedown", B), document.addEventListener("mousemove", R), document.addEventListener("mouseup", x);
2451
- const T = c.current;
2451
+ const T = i.current;
2452
2452
  return T == null || T.addEventListener("wheel", P, { passive: !1 }), () => {
2453
2453
  document.removeEventListener("keydown", O), document.removeEventListener("keyup", y), document.removeEventListener("mousedown", B), document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", x), T == null || T.removeEventListener("wheel", P);
2454
2454
  };
@@ -2456,8 +2456,8 @@ function Ft({
2456
2456
  if (typeof document > "u") return;
2457
2457
  let C = !1;
2458
2458
  return (async () => {
2459
- if (await On(), C || !i.current) return;
2460
- const _ = await import("fabric"), A = new _.Canvas(i.current, {
2459
+ if (await On(), C || !c.current) return;
2460
+ const _ = await import("fabric"), A = new _.Canvas(c.current, {
2461
2461
  selection: !s,
2462
2462
  preserveObjectStacking: !0
2463
2463
  });
@@ -2466,7 +2466,7 @@ function Ft({
2466
2466
  if (C) return;
2467
2467
  const y = typeof e == "object" ? e.width : O.width ?? 0, B = typeof e == "object" ? e.height : O.height ?? 0;
2468
2468
  r({ width: y, height: B });
2469
- const R = c.current, x = o ?? (R == null ? void 0 : R.clientWidth) ?? y, P = a ?? (R == null ? void 0 : R.clientHeight) ?? B, T = Math.min(x / (y || 1), P / (B || 1), 1), L = Math.round(y * T), M = Math.round(B * T);
2469
+ const R = i.current, x = o ?? (R == null ? void 0 : R.clientWidth) ?? y, P = a ?? (R == null ? void 0 : R.clientHeight) ?? B, T = Math.min(x / (y || 1), P / (B || 1), 1), L = Math.round(y * T), M = Math.round(B * T);
2470
2470
  A.setDimensions({ width: L, height: M }), A.setZoom(T), O.set({ selectable: !1, evented: !1 }), A.backgroundImage = O, A.renderAll(), b({ level: T, width: L, height: M });
2471
2471
  })(), () => {
2472
2472
  C = !0;
@@ -2533,7 +2533,7 @@ function Ft({
2533
2533
  if (l)
2534
2534
  return Zn(() => {
2535
2535
  });
2536
- }, [l]), /* @__PURE__ */ d("div", { ref: c, className: Ze.canvasSection, children: /* @__PURE__ */ d("div", { className: Ze.imagePanel, children: /* @__PURE__ */ d("canvas", { ref: i }) }) });
2536
+ }, [l]), /* @__PURE__ */ d("div", { ref: i, className: Ze.canvasSection, children: /* @__PURE__ */ d("div", { className: Ze.imagePanel, children: /* @__PURE__ */ d("canvas", { ref: c }) }) });
2537
2537
  }
2538
2538
  const rs = "lc-textSection-pEESB", ls = "lc-textContent-JGJR8", ds = "lc-segment-RaLhM", us = "lc-emptyState-G-skG", Ye = {
2539
2539
  textSection: rs,
@@ -2546,7 +2546,7 @@ function hs({
2546
2546
  readOnly: t = !1,
2547
2547
  segments: n = []
2548
2548
  }) {
2549
- const s = Ce(null), o = gn((h) => h.setSelectedSegment), a = We((h) => h.colorCode), i = lt((h) => h.opacity), c = $(() => {
2549
+ const s = Ce(null), o = gn((h) => h.setSelectedSegment), a = We((h) => h.colorCode), c = lt((h) => h.opacity), i = $(() => {
2550
2550
  if (t) return;
2551
2551
  const h = window.getSelection();
2552
2552
  if (!h || h.isCollapsed || !s.current) return;
@@ -2563,9 +2563,9 @@ function hs({
2563
2563
  end: b,
2564
2564
  text: g,
2565
2565
  color: a,
2566
- opacity: i
2566
+ opacity: c
2567
2567
  }), h.removeAllRanges();
2568
- }, [t, o, a, i]);
2568
+ }, [t, o, a, c]);
2569
2569
  if (!e)
2570
2570
  return /* @__PURE__ */ d("div", { className: Ye.textSection, children: /* @__PURE__ */ d("div", { className: Ye.emptyState, children: "No text content" }) });
2571
2571
  const l = fs(e.value, n);
@@ -2574,14 +2574,14 @@ function hs({
2574
2574
  {
2575
2575
  ref: s,
2576
2576
  className: Ye.textContent,
2577
- onMouseUp: c,
2577
+ onMouseUp: i,
2578
2578
  children: l
2579
2579
  }
2580
2580
  ) });
2581
2581
  }
2582
2582
  function fs(e, t) {
2583
2583
  if (!t.length) return e;
2584
- const n = [...t].sort((a, i) => a.start - i.start), s = [];
2584
+ const n = [...t].sort((a, c) => a.start - c.start), s = [];
2585
2585
  let o = 0;
2586
2586
  for (const a of n)
2587
2587
  a.start > o && s.push(e.slice(o, a.start)), s.push(
@@ -2627,7 +2627,7 @@ function bs({
2627
2627
  );
2628
2628
  if (!e)
2629
2629
  return /* @__PURE__ */ d("div", { className: Ae.numberSection, children: /* @__PURE__ */ d("div", { className: Ae.emptyState, children: "No number content" }) });
2630
- const { source: i } = e, c = i.columns, l = i.rows;
2630
+ const { source: c } = e, i = c.columns, l = c.rows;
2631
2631
  return /* @__PURE__ */ S("div", { className: Ae.numberSection, children: [
2632
2632
  /* @__PURE__ */ d("div", { className: Ae.chartArea, children: e.canRender ? /* @__PURE__ */ S("div", { className: Ae.chartPlaceholder, children: [
2633
2633
  "Chart (",
@@ -2637,7 +2637,7 @@ function bs({
2637
2637
  l.length > 0 && /* @__PURE__ */ d("div", { className: Ae.dataTable, children: /* @__PURE__ */ S("table", { children: [
2638
2638
  /* @__PURE__ */ d("thead", { children: /* @__PURE__ */ S("tr", { children: [
2639
2639
  /* @__PURE__ */ d("th", { children: "#" }),
2640
- c.map((h) => /* @__PURE__ */ d("th", { children: h.label }, h.key))
2640
+ i.map((h) => /* @__PURE__ */ d("th", { children: h.label }, h.key))
2641
2641
  ] }) }),
2642
2642
  /* @__PURE__ */ d("tbody", { children: l.map((h, u) => {
2643
2643
  const r = n.some(
@@ -2651,7 +2651,7 @@ function bs({
2651
2651
  style: { cursor: t ? "default" : "pointer" },
2652
2652
  children: [
2653
2653
  /* @__PURE__ */ d("td", { children: u + 1 }),
2654
- c.map((m) => /* @__PURE__ */ d("td", { children: String(h[m.key] ?? "") }, m.key))
2654
+ i.map((m) => /* @__PURE__ */ d("td", { children: String(h[m.key] ?? "") }, m.key))
2655
2655
  ]
2656
2656
  },
2657
2657
  u
@@ -2676,13 +2676,13 @@ function ks({
2676
2676
  onFileUpload: n
2677
2677
  }) {
2678
2678
  const s = Ce(null), o = $(() => {
2679
- var i;
2680
- (i = s.current) == null || i.click();
2679
+ var c;
2680
+ (c = s.current) == null || c.click();
2681
2681
  }, []), a = $(
2682
- (i) => {
2682
+ (c) => {
2683
2683
  var l;
2684
- const c = (l = i.target.files) == null ? void 0 : l[0];
2685
- c && (n == null || n(c)), i.target.value = "";
2684
+ const i = (l = c.target.files) == null ? void 0 : l[0];
2685
+ i && (n == null || n(i)), c.target.value = "";
2686
2686
  },
2687
2687
  [n]
2688
2688
  );
@@ -2717,8 +2717,8 @@ function Os({
2717
2717
  onChange: s,
2718
2718
  readOnly: o = !1,
2719
2719
  textContent: a,
2720
- numberContent: i,
2721
- fileContent: c,
2720
+ numberContent: c,
2721
+ fileContent: i,
2722
2722
  onFileUpload: l,
2723
2723
  children: h
2724
2724
  }) {
@@ -2745,7 +2745,7 @@ function Os({
2745
2745
  return /* @__PURE__ */ d(
2746
2746
  bs,
2747
2747
  {
2748
- content: i,
2748
+ content: c,
2749
2749
  readOnly: o
2750
2750
  }
2751
2751
  );
@@ -2753,7 +2753,7 @@ function Os({
2753
2753
  return /* @__PURE__ */ d(
2754
2754
  ks,
2755
2755
  {
2756
- content: c,
2756
+ content: i,
2757
2757
  readOnly: o,
2758
2758
  onFileUpload: l
2759
2759
  }
@@ -2795,17 +2795,17 @@ function Xt({
2795
2795
  onDirectionChange: o,
2796
2796
  hidden: a = !1
2797
2797
  }) {
2798
- const [i, c] = re(""), l = ve(() => {
2799
- if (!i.trim()) return e;
2800
- const r = i.trim().toLowerCase();
2798
+ const [c, i] = re(""), l = ve(() => {
2799
+ if (!c.trim()) return e;
2800
+ const r = c.trim().toLowerCase();
2801
2801
  return e.filter(
2802
2802
  (m) => {
2803
2803
  var v;
2804
2804
  return m.title.toLowerCase().includes(r) || ((v = m.children) == null ? void 0 : v.some((g) => g.title.toLowerCase().includes(r)));
2805
2805
  }
2806
2806
  );
2807
- }, [e, i]), h = $((r) => {
2808
- c(r.target.value);
2807
+ }, [e, c]), h = $((r) => {
2808
+ i(r.target.value);
2809
2809
  }, []), u = s === "vertical" ? "bottom" : "left";
2810
2810
  return /* @__PURE__ */ S(
2811
2811
  "div",
@@ -2846,7 +2846,7 @@ function Xt({
2846
2846
  className: he.searchInput,
2847
2847
  type: "text",
2848
2848
  placeholder: "Search records...",
2849
- value: i,
2849
+ value: c,
2850
2850
  onChange: h
2851
2851
  }
2852
2852
  ),
@@ -2869,8 +2869,8 @@ function pn({
2869
2869
  activeRecordId: t,
2870
2870
  onRecordSelect: n
2871
2871
  }) {
2872
- const s = e.id === t, o = e.children && e.children.length > 0, [a, i] = re(s || !1), c = $(() => {
2873
- o && i((l) => !l), n(e);
2872
+ const s = e.id === t, o = e.children && e.children.length > 0, [a, c] = re(s || !1), i = $(() => {
2873
+ o && c((l) => !l), n(e);
2874
2874
  }, [o, n, e]);
2875
2875
  return /* @__PURE__ */ S(Mt, { children: [
2876
2876
  /* @__PURE__ */ S(
@@ -2878,7 +2878,7 @@ function pn({
2878
2878
  {
2879
2879
  className: he.recordItem,
2880
2880
  "data-active": s || void 0,
2881
- onClick: c,
2881
+ onClick: i,
2882
2882
  children: [
2883
2883
  e.thumbnail && /* @__PURE__ */ d(
2884
2884
  "img",
@@ -2940,10 +2940,10 @@ function ia({
2940
2940
  onClassSelect: s,
2941
2941
  onAnnotationSelect: o,
2942
2942
  onAnnotationDelete: a,
2943
- disabled: i = !1
2943
+ disabled: c = !1
2944
2944
  }) {
2945
2945
  var v;
2946
- const [c, l] = re("class"), [h, u] = re(((v = e[0]) == null ? void 0 : v.id) ?? "");
2946
+ const [i, l] = re("class"), [h, u] = re(((v = e[0]) == null ? void 0 : v.id) ?? "");
2947
2947
  ce(() => {
2948
2948
  e.length > 0 && !e.find((g) => g.id === h) && u(e[0].id);
2949
2949
  }, [e, h]);
@@ -2956,13 +2956,13 @@ function ia({
2956
2956
  return g;
2957
2957
  }, [e]), m = $(
2958
2958
  (g) => {
2959
- i || (u(g.id), s == null || s(g));
2959
+ c || (u(g.id), s == null || s(g));
2960
2960
  },
2961
- [i, s]
2961
+ [c, s]
2962
2962
  );
2963
2963
  return ce(() => {
2964
2964
  const g = (b) => {
2965
- if (i) return;
2965
+ if (c) return;
2966
2966
  const f = b.target;
2967
2967
  if (f instanceof HTMLElement && (f.tagName === "INPUT" || f.tagName === "TEXTAREA" || f.tagName === "SELECT" || f.isContentEditable))
2968
2968
  return;
@@ -2970,13 +2970,13 @@ function ia({
2970
2970
  N && (b.preventDefault(), m(N));
2971
2971
  };
2972
2972
  return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
2973
- }, [e, i, m]), /* @__PURE__ */ d("div", { className: ae.infoPanel, children: /* @__PURE__ */ S("div", { className: ae.section, children: [
2973
+ }, [e, c, m]), /* @__PURE__ */ d("div", { className: ae.infoPanel, children: /* @__PURE__ */ S("div", { className: ae.section, children: [
2974
2974
  /* @__PURE__ */ d("div", { className: ae.sectionTitle, children: /* @__PURE__ */ S("div", { className: ae.tabs, children: [
2975
2975
  /* @__PURE__ */ d(
2976
2976
  "button",
2977
2977
  {
2978
2978
  className: ae.tab,
2979
- "data-active": c === "class" || void 0,
2979
+ "data-active": i === "class" || void 0,
2980
2980
  onClick: () => l("class"),
2981
2981
  children: "Class"
2982
2982
  }
@@ -2985,20 +2985,20 @@ function ia({
2985
2985
  "button",
2986
2986
  {
2987
2987
  className: ae.tab,
2988
- "data-active": c === "label" || void 0,
2988
+ "data-active": i === "label" || void 0,
2989
2989
  onClick: () => l("label"),
2990
2990
  children: "Label"
2991
2991
  }
2992
2992
  )
2993
2993
  ] }) }),
2994
- c === "class" && /* @__PURE__ */ d("div", { className: ae.sectionContent, children: /* @__PURE__ */ d("div", { className: ae.classList, children: Array.from(r.entries()).map(([g, b]) => /* @__PURE__ */ S("div", { children: [
2994
+ i === "class" && /* @__PURE__ */ d("div", { className: ae.sectionContent, children: /* @__PURE__ */ d("div", { className: ae.classList, children: Array.from(r.entries()).map(([g, b]) => /* @__PURE__ */ S("div", { children: [
2995
2995
  g && /* @__PURE__ */ d("div", { style: { fontSize: "0.75rem", fontWeight: 600, color: "#64748b", padding: "0.25rem 0", marginTop: "0.25rem" }, children: g }),
2996
2996
  b.map((f) => /* @__PURE__ */ S(
2997
2997
  "button",
2998
2998
  {
2999
2999
  className: ae.classButton,
3000
3000
  "data-active": h === f.id || void 0,
3001
- disabled: i,
3001
+ disabled: c,
3002
3002
  onClick: () => m(f),
3003
3003
  children: [
3004
3004
  /* @__PURE__ */ d(
@@ -3015,7 +3015,7 @@ function ia({
3015
3015
  f.id
3016
3016
  ))
3017
3017
  ] }, g || "__default")) }) }),
3018
- c === "label" && /* @__PURE__ */ d("div", { className: ae.sectionContent, children: t.length === 0 ? /* @__PURE__ */ d("div", { style: { fontSize: "0.8125rem", color: "#64748b", padding: "1rem 0", textAlign: "center" }, children: "No labels yet" }) : /* @__PURE__ */ d("div", { className: ae.labelList, children: t.map((g) => /* @__PURE__ */ S(
3018
+ i === "label" && /* @__PURE__ */ d("div", { className: ae.sectionContent, children: t.length === 0 ? /* @__PURE__ */ d("div", { style: { fontSize: "0.8125rem", color: "#64748b", padding: "1rem 0", textAlign: "center" }, children: "No labels yet" }) : /* @__PURE__ */ d("div", { className: ae.labelList, children: t.map((g) => /* @__PURE__ */ S(
3019
3019
  "div",
3020
3020
  {
3021
3021
  className: ae.labelItem,
@@ -3059,7 +3059,7 @@ function Le(e, t = "sm") {
3059
3059
  return Je(fe, { iconType: e, size: t });
3060
3060
  }
3061
3061
  function ra() {
3062
- const e = Ke((u) => u.tool), t = Ke((u) => u.setTool), n = Se((u) => u.mode), s = Se((u) => u.cycleMode), o = (e == null ? void 0 : e.id) ?? "selection", i = ["magic-brush", "superpixel", "seg-anything"].includes(o), c = o === "superpixel" ? "icon-superpixel" : o === "seg-anything" ? "icon-seg-anything" : "icon-magic-wand", l = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3062
+ const e = Ke((u) => u.tool), t = Ke((u) => u.setTool), n = Se((u) => u.mode), s = Se((u) => u.cycleMode), o = (e == null ? void 0 : e.id) ?? "selection", c = ["magic-brush", "superpixel", "seg-anything"].includes(o), i = o === "superpixel" ? "icon-superpixel" : o === "seg-anything" ? "icon-seg-anything" : "icon-magic-wand", l = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3063
3063
  return { toolbar: [
3064
3064
  // Selection
3065
3065
  {
@@ -3107,9 +3107,9 @@ function ra() {
3107
3107
  variant: "radio",
3108
3108
  id: ca,
3109
3109
  name: "tool",
3110
- icon: Le(c),
3110
+ icon: Le(i),
3111
3111
  title: "Intelligent Tools",
3112
- checked: i,
3112
+ checked: c,
3113
3113
  subButtonItems: [
3114
3114
  {
3115
3115
  variant: "radio",
@@ -3142,7 +3142,7 @@ function ra() {
3142
3142
  }
3143
3143
  ],
3144
3144
  onClick: () => {
3145
- i || t(yt());
3145
+ c || t(yt());
3146
3146
  }
3147
3147
  },
3148
3148
  // Dropdown toggle (slim)
@@ -3180,7 +3180,7 @@ function ot(e) {
3180
3180
  return Je(fe, { iconType: e, size: "sm" });
3181
3181
  }
3182
3182
  function la() {
3183
- const e = Yt((l) => l.tool), t = Yt((l) => l.setTool), n = Se((l) => l.mode), s = Se((l) => l.cycleMode), o = vo(), a = (e == null ? void 0 : e.id) ?? "selection", i = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3183
+ const e = Yt((l) => l.tool), t = Yt((l) => l.setTool), n = Se((l) => l.mode), s = Se((l) => l.cycleMode), o = vo(), a = (e == null ? void 0 : e.id) ?? "selection", c = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3184
3184
  return { toolbar: [
3185
3185
  {
3186
3186
  variant: "radio",
@@ -3238,7 +3238,7 @@ function la() {
3238
3238
  {
3239
3239
  variant: "button",
3240
3240
  id: "layer-mode",
3241
- icon: ot(i),
3241
+ icon: ot(c),
3242
3242
  title: ee("Layer", J.common.layerToggle),
3243
3243
  onClick: s
3244
3244
  }
@@ -3248,7 +3248,7 @@ function gt(e) {
3248
3248
  return Je(fe, { iconType: e, size: "sm" });
3249
3249
  }
3250
3250
  function da() {
3251
- const e = zt((c) => c.tool), t = zt((c) => c.setTool), n = Se((c) => c.mode), s = Se((c) => c.cycleMode), o = (e == null ? void 0 : e.id) ?? "selection", a = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3251
+ const e = zt((i) => i.tool), t = zt((i) => i.setTool), n = Se((i) => i.mode), s = Se((i) => i.cycleMode), o = (e == null ? void 0 : e.id) ?? "selection", a = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3252
3252
  return { toolbar: [
3253
3253
  {
3254
3254
  variant: "radio",
@@ -3312,7 +3312,7 @@ function vt(e) {
3312
3312
  return Je(fe, { iconType: e, size: "sm" });
3313
3313
  }
3314
3314
  function fa() {
3315
- const e = Ke((l) => l.tool), t = Ke((l) => l.setTool), n = Se((l) => l.mode), s = Se((l) => l.cycleMode), o = St((l) => l.toggle), a = (e == null ? void 0 : e.id) ?? "selection", i = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3315
+ const e = Ke((l) => l.tool), t = Ke((l) => l.setTool), n = Se((l) => l.mode), s = Se((l) => l.cycleMode), o = St((l) => l.toggle), a = (e == null ? void 0 : e.id) ?? "selection", c = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
3316
3316
  return { toolbar: [
3317
3317
  {
3318
3318
  variant: "radio",
@@ -3335,16 +3335,16 @@ function fa() {
3335
3335
  {
3336
3336
  variant: "button",
3337
3337
  id: "layer-mode",
3338
- icon: vt(i),
3338
+ icon: vt(c),
3339
3339
  title: ee("Layer", J.common.layerToggle),
3340
3340
  onClick: s
3341
3341
  }
3342
3342
  ] };
3343
3343
  }
3344
3344
  function ma(e, t) {
3345
- const n = ra(), s = la(), o = da(), a = ua(), i = ha(), c = fa();
3345
+ const n = ra(), s = la(), o = da(), a = ua(), c = ha(), i = fa();
3346
3346
  if (t)
3347
- return c;
3347
+ return i;
3348
3348
  switch (e) {
3349
3349
  case "Image":
3350
3350
  return n;
@@ -3355,7 +3355,7 @@ function ma(e, t) {
3355
3355
  case "Record":
3356
3356
  return a;
3357
3357
  case "File":
3358
- return i;
3358
+ return c;
3359
3359
  default:
3360
3360
  return n;
3361
3361
  }
@@ -3444,12 +3444,12 @@ function Ma({ item: e }) {
3444
3444
  disabled: e.disabled,
3445
3445
  onClick: () => {
3446
3446
  var a;
3447
- (a = e.onClick) == null || a.call(e), n((i) => !i);
3447
+ (a = e.onClick) == null || a.call(e), n((c) => !c);
3448
3448
  },
3449
3449
  children: e.icon
3450
3450
  }
3451
3451
  ),
3452
- t && e.subItems && /* @__PURE__ */ d("div", { className: ge.subToolbar, children: e.subItems.map((a, i) => /* @__PURE__ */ d(bn, { item: a }, i)) })
3452
+ t && e.subItems && /* @__PURE__ */ d("div", { className: ge.subToolbar, children: e.subItems.map((a, c) => /* @__PURE__ */ d(bn, { item: a }, c)) })
3453
3453
  ] });
3454
3454
  }
3455
3455
  function Ia({ children: e }) {
@@ -3653,9 +3653,9 @@ function ci({
3653
3653
  onAnnotationSelect: s,
3654
3654
  onValidate: o,
3655
3655
  onValidationUpdate: a,
3656
- onValidationDelete: i
3656
+ onValidationDelete: c
3657
3657
  }) {
3658
- const [c, l] = re(""), [h, u] = re(null), r = t.filter((f) => !f.result).length, m = $(async () => {
3658
+ const [i, l] = re(""), [h, u] = re(null), r = t.filter((f) => !f.result).length, m = $(async () => {
3659
3659
  n && await (o == null ? void 0 : o({
3660
3660
  annotationIds: [n],
3661
3661
  result: !0
@@ -3664,13 +3664,13 @@ function ci({
3664
3664
  n && (await (o == null ? void 0 : o({
3665
3665
  annotationIds: [n],
3666
3666
  result: !1,
3667
- reason: c || void 0
3667
+ reason: i || void 0
3668
3668
  })), l(""));
3669
- }, [n, c, o]), g = $(
3669
+ }, [n, i, o]), g = $(
3670
3670
  async (f) => {
3671
- await (i == null ? void 0 : i({ ids: [f] }));
3671
+ await (c == null ? void 0 : c({ ids: [f] }));
3672
3672
  },
3673
- [i]
3673
+ [c]
3674
3674
  ), b = $(
3675
3675
  (f) => f.annotationId ? e.find((p) => p.id === f.annotationId) ?? null : null,
3676
3676
  [e]
@@ -3708,7 +3708,7 @@ function ci({
3708
3708
  ] }),
3709
3709
  f.reason && /* @__PURE__ */ d("p", { className: ie.issueReason, children: f.reason }),
3710
3710
  f.validatedAt && /* @__PURE__ */ d("span", { className: ie.issueDate, children: f.validatedAt }),
3711
- i && /* @__PURE__ */ d(
3711
+ c && /* @__PURE__ */ d(
3712
3712
  "button",
3713
3713
  {
3714
3714
  className: ie.validateButton,
@@ -3730,7 +3730,7 @@ function ci({
3730
3730
  {
3731
3731
  className: ie.reasonInput,
3732
3732
  placeholder: "Reason (optional)...",
3733
- value: c,
3733
+ value: i,
3734
3734
  onChange: (f) => l(f.target.value)
3735
3735
  }
3736
3736
  ) }),
@@ -3775,7 +3775,7 @@ function ri() {
3775
3775
  p === "rect" ? f = new b.Rect(g) : p === "polygon" && g.points ? f = new b.Polygon(g.points, g) : p === "path" && g.path ? f = new b.Path(g.path, g) : p === "image" && typeof g.src == "string" && (f = await b.FabricImage.fromURL(g.src, { crossOrigin: "anonymous" }), f.set(g)), f && (v.add(f), Ne(v), t(v.getObjects()));
3776
3776
  },
3777
3777
  [t]
3778
- ), i = $(
3778
+ ), c = $(
3779
3779
  (u) => {
3780
3780
  const r = Q();
3781
3781
  if (!r) return;
@@ -3783,7 +3783,7 @@ function ri() {
3783
3783
  v && (r.remove(v), Ne(r), t(r.getObjects()));
3784
3784
  },
3785
3785
  [t]
3786
- ), c = $(() => {
3786
+ ), i = $(() => {
3787
3787
  const u = Q();
3788
3788
  if (!u) return;
3789
3789
  const r = u.getObjects();
@@ -3813,16 +3813,16 @@ function ri() {
3813
3813
  zoom: n,
3814
3814
  getAnnotations: o,
3815
3815
  addAnnotation: a,
3816
- removeAnnotation: i,
3817
- clearCanvas: c,
3816
+ removeAnnotation: c,
3817
+ clearCanvas: i,
3818
3818
  exportState: l,
3819
3819
  setZoomLevel: h
3820
3820
  }),
3821
- [e, n, o, a, i, c, l, h]
3821
+ [e, n, o, a, c, i, l, h]
3822
3822
  );
3823
3823
  }
3824
3824
  function li() {
3825
- const e = Ee((r) => r.undoStack), t = Ee((r) => r.redoStack), n = Ee((r) => r.setUndoStack), s = Ee((r) => r.setRedoStack), o = dt((r) => r.setObjects), a = e.length > 0, i = t.length > 0, c = $(() => {
3825
+ const e = Ee((r) => r.undoStack), t = Ee((r) => r.redoStack), n = Ee((r) => r.setUndoStack), s = Ee((r) => r.setRedoStack), o = dt((r) => r.setObjects), a = e.length > 0, c = t.length > 0, i = $(() => {
3826
3826
  const r = Ue(), m = JSON.stringify(r);
3827
3827
  n([...e, m]), s([]);
3828
3828
  }, [e, n, s]), l = $(async () => {
@@ -3834,26 +3834,26 @@ function li() {
3834
3834
  const v = [...e], g = v.pop();
3835
3835
  n(v), await r.loadFromJSON(g), Ne(r), o(r.getObjects());
3836
3836
  }, [a, e, t, n, s, o]), h = $(async () => {
3837
- if (!i) return;
3837
+ if (!c) return;
3838
3838
  const r = Q();
3839
3839
  if (!r) return;
3840
3840
  const m = JSON.stringify(Ue());
3841
3841
  n([...e, m]);
3842
3842
  const v = [...t], g = v.pop();
3843
3843
  s(v), await r.loadFromJSON(g), Ne(r), o(r.getObjects());
3844
- }, [i, e, t, n, s, o]), u = $(() => {
3844
+ }, [c, e, t, n, s, o]), u = $(() => {
3845
3845
  n([]), s([]);
3846
3846
  }, [n, s]);
3847
3847
  return ve(
3848
3848
  () => ({
3849
3849
  canUndo: a,
3850
- canRedo: i,
3850
+ canRedo: c,
3851
3851
  undo: l,
3852
3852
  redo: h,
3853
- pushSnapshot: c,
3853
+ pushSnapshot: i,
3854
3854
  clear: u
3855
3855
  }),
3856
- [a, i, l, h, c, u]
3856
+ [a, c, l, h, i, u]
3857
3857
  );
3858
3858
  }
3859
3859
  function di(e) {
@@ -3863,8 +3863,8 @@ function di(e) {
3863
3863
  annotations: s,
3864
3864
  selectedIds: o,
3865
3865
  activeTool: a,
3866
- addAnnotations: i,
3867
- updateAnnotation: c,
3866
+ addAnnotations: c,
3867
+ updateAnnotation: i,
3868
3868
  removeAnnotations: l,
3869
3869
  setTool: h
3870
3870
  } = e, u = ve(
@@ -3882,8 +3882,8 @@ function di(e) {
3882
3882
  annotations: s,
3883
3883
  selectedIds: o,
3884
3884
  activeTool: a,
3885
- addAnnotations: i,
3886
- updateAnnotation: c,
3885
+ addAnnotations: c,
3886
+ updateAnnotation: i,
3887
3887
  removeAnnotations: l,
3888
3888
  setTool: h,
3889
3889
  canvas: {
@@ -3894,7 +3894,7 @@ function di(e) {
3894
3894
  }
3895
3895
  }
3896
3896
  }),
3897
- [n, s, o, a, i, c, l, h]
3897
+ [n, s, o, a, c, i, l, h]
3898
3898
  ), g = ve(
3899
3899
  () => u.find((f) => f.id === a),
3900
3900
  [u, a]