@annotorious/annotorious 3.5.0 → 3.5.1

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.
@@ -1,5 +1,5 @@
1
- var Ri = Object.defineProperty;
2
- var ki = (e, t, n) => t in e ? Ri(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
1
+ var Li = Object.defineProperty;
2
+ var ki = (e, t, n) => t in e ? Li(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var se = (e, t, n) => ki(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  function te() {
5
5
  }
@@ -97,7 +97,7 @@ function Ge(e, t) {
97
97
  for (let n = 0; n < e.length; n += 1)
98
98
  e[n] && e[n].d(t);
99
99
  }
100
- function R(e) {
100
+ function L(e) {
101
101
  return document.createElementNS("http://www.w3.org/2000/svg", e);
102
102
  }
103
103
  function li(e) {
@@ -338,7 +338,7 @@ class Oe {
338
338
  }
339
339
  const Gi = "4";
340
340
  typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Gi);
341
- var ee = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.MULTIPOLYGLON = "MULTIPOLYGON", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e.LINE = "LINE", e))(ee || {});
341
+ var ee = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.MULTIPOLYGON = "MULTIPOLYGON", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e.LINE = "LINE", e))(ee || {});
342
342
  function zi(e) {
343
343
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
344
344
  }
@@ -480,7 +480,7 @@ const Ji = {
480
480
  }
481
481
  };
482
482
  };
483
- ut(ee.MULTIPOLYGLON, Ji);
483
+ ut(ee.MULTIPOLYGON, Ji);
484
484
  const eo = {
485
485
  area: (e) => {
486
486
  const t = e.geometry.points;
@@ -587,7 +587,7 @@ function Wt([e, t], n) {
587
587
  e * Math.sin(n) + t * Math.cos(n)
588
588
  ];
589
589
  }
590
- function Le(...e) {
590
+ function Re(...e) {
591
591
  for (let t = 0; t < e.length; t++)
592
592
  if (typeof e[t] != "number")
593
593
  throw new Error(`assertNumbers arguments[${t}] is not a number. ${typeof e[t]} == typeof ${e[t]}`);
@@ -609,7 +609,7 @@ function tn(e, t, n) {
609
609
  e.cX = g[0] + (t + s) / 2, e.cY = g[1] + (n + r) / 2, e.phi1 = Math.atan2((u - p) / o, (a - y) / i), e.phi2 = Math.atan2((-u - p) / o, (-a - y) / i), e.sweepFlag === 0 && e.phi2 > e.phi1 && (e.phi2 -= 2 * He), e.sweepFlag === 1 && e.phi2 < e.phi1 && (e.phi2 += 2 * He), e.phi1 *= 180 / He, e.phi2 *= 180 / He;
610
610
  }
611
611
  function cn(e, t, n) {
612
- Le(e, t, n);
612
+ Re(e, t, n);
613
613
  const i = e * e + t * t - n * n;
614
614
  if (0 > i)
615
615
  return [];
@@ -799,7 +799,7 @@ function gt(e) {
799
799
  return t && i.push({ type: A.CLOSE_PATH }), i;
800
800
  }
801
801
  function fo(e = 1e13) {
802
- Le(e);
802
+ Re(e);
803
803
  function t(n) {
804
804
  return Math.round(n * e) / e;
805
805
  }
@@ -808,13 +808,13 @@ function fo(e = 1e13) {
808
808
  };
809
809
  }
810
810
  function yi() {
811
- return Re((e, t, n) => (e.relative && (typeof e.x1 < "u" && (e.x1 += t), typeof e.y1 < "u" && (e.y1 += n), typeof e.x2 < "u" && (e.x2 += t), typeof e.y2 < "u" && (e.y2 += n), typeof e.x < "u" && (e.x += t), typeof e.y < "u" && (e.y += n), e.relative = !1), e));
811
+ return Le((e, t, n) => (e.relative && (typeof e.x1 < "u" && (e.x1 += t), typeof e.y1 < "u" && (e.y1 += n), typeof e.x2 < "u" && (e.x2 += t), typeof e.y2 < "u" && (e.y2 += n), typeof e.x < "u" && (e.x += t), typeof e.y < "u" && (e.y += n), e.relative = !1), e));
812
812
  }
813
813
  function co() {
814
- return Re((e, t, n) => (e.relative || (typeof e.x1 < "u" && (e.x1 -= t), typeof e.y1 < "u" && (e.y1 -= n), typeof e.x2 < "u" && (e.x2 -= t), typeof e.y2 < "u" && (e.y2 -= n), typeof e.x < "u" && (e.x -= t), typeof e.y < "u" && (e.y -= n), e.relative = !0), e));
814
+ return Le((e, t, n) => (e.relative || (typeof e.x1 < "u" && (e.x1 -= t), typeof e.y1 < "u" && (e.y1 -= n), typeof e.x2 < "u" && (e.x2 -= t), typeof e.y2 < "u" && (e.y2 -= n), typeof e.x < "u" && (e.x -= t), typeof e.y < "u" && (e.y -= n), e.relative = !0), e));
815
815
  }
816
816
  function ho(e = !0, t = !0, n = !0, i = !0) {
817
- return Re((o, s, r, l, a) => {
817
+ return Le((o, s, r, l, a) => {
818
818
  if (isNaN(l) && !(o.type & A.MOVE_TO))
819
819
  throw new Error("path must start with moveto");
820
820
  if (t && o.type & A.HORIZ_LINE_TO && (o.type = A.LINE_TO, o.y = o.relative ? 0 : r), n && o.type & A.VERT_LINE_TO && (o.type = A.LINE_TO, o.x = o.relative ? 0 : s), e && o.type & A.CLOSE_PATH && (o.type = A.LINE_TO, o.x = o.relative ? l - s : l, o.y = o.relative ? a - r : a), o.type & A.ARC && (o.rX === 0 || o.rY === 0) && (o.type = A.LINE_TO, delete o.rX, delete o.rY, delete o.xRot, delete o.lArcFlag, delete o.sweepFlag), i && o.type & A.QUAD_TO) {
@@ -830,11 +830,11 @@ function ho(e = !0, t = !0, n = !0, i = !0) {
830
830
  }
831
831
  function _i() {
832
832
  let e = NaN, t = NaN, n = NaN, i = NaN;
833
- return Re((o, s, r) => (o.type & A.SMOOTH_CURVE_TO && (o.type = A.CURVE_TO, e = isNaN(e) ? s : e, t = isNaN(t) ? r : t, o.x1 = o.relative ? s - e : 2 * s - e, o.y1 = o.relative ? r - t : 2 * r - t), o.type & A.CURVE_TO ? (e = o.relative ? s + o.x2 : o.x2, t = o.relative ? r + o.y2 : o.y2) : (e = NaN, t = NaN), o.type & A.SMOOTH_QUAD_TO && (o.type = A.QUAD_TO, n = isNaN(n) ? s : n, i = isNaN(i) ? r : i, o.x1 = o.relative ? s - n : 2 * s - n, o.y1 = o.relative ? r - i : 2 * r - i), o.type & A.QUAD_TO ? (n = o.relative ? s + o.x1 : o.x1, i = o.relative ? r + o.y1 : o.y1) : (n = NaN, i = NaN), o));
833
+ return Le((o, s, r) => (o.type & A.SMOOTH_CURVE_TO && (o.type = A.CURVE_TO, e = isNaN(e) ? s : e, t = isNaN(t) ? r : t, o.x1 = o.relative ? s - e : 2 * s - e, o.y1 = o.relative ? r - t : 2 * r - t), o.type & A.CURVE_TO ? (e = o.relative ? s + o.x2 : o.x2, t = o.relative ? r + o.y2 : o.y2) : (e = NaN, t = NaN), o.type & A.SMOOTH_QUAD_TO && (o.type = A.QUAD_TO, n = isNaN(n) ? s : n, i = isNaN(i) ? r : i, o.x1 = o.relative ? s - n : 2 * s - n, o.y1 = o.relative ? r - i : 2 * r - i), o.type & A.QUAD_TO ? (n = o.relative ? s + o.x1 : o.x1, i = o.relative ? r + o.y1 : o.y1) : (n = NaN, i = NaN), o));
834
834
  }
835
835
  function mi() {
836
836
  let e = NaN, t = NaN;
837
- return Re((n, i, o) => {
837
+ return Le((n, i, o) => {
838
838
  if (n.type & A.SMOOTH_QUAD_TO && (n.type = A.QUAD_TO, e = isNaN(e) ? i : e, t = isNaN(t) ? o : t, n.x1 = n.relative ? i - e : 2 * i - e, n.y1 = n.relative ? o - t : 2 * o - t), n.type & A.QUAD_TO) {
839
839
  e = n.relative ? i + n.x1 : n.x1, t = n.relative ? o + n.y1 : n.y1;
840
840
  const s = n.x1, r = n.y1;
@@ -844,7 +844,7 @@ function mi() {
844
844
  return n;
845
845
  });
846
846
  }
847
- function Re(e) {
847
+ function Le(e) {
848
848
  let t = 0, n = 0, i = NaN, o = NaN;
849
849
  return function(r) {
850
850
  if (isNaN(i) && !(r.type & A.MOVE_TO))
@@ -854,9 +854,9 @@ function Re(e) {
854
854
  };
855
855
  }
856
856
  function go(e = 0) {
857
- Le(e);
857
+ Re(e);
858
858
  let t = NaN, n = NaN, i = NaN, o = NaN;
859
- return Re((s, r, l, a, u) => {
859
+ return Le((s, r, l, a, u) => {
860
860
  const h = Math.abs;
861
861
  let c = !1, d = 0, y = 0;
862
862
  if (s.type & A.SMOOTH_CURVE_TO && (d = isNaN(t) ? 0 : r - t, y = isNaN(n) ? 0 : l - n), s.type & (A.CURVE_TO | A.SMOOTH_CURVE_TO) ? (t = s.relative ? r + s.x2 : s.x2, n = s.relative ? l + s.y2 : s.y2) : (t = NaN, n = NaN), s.type & A.SMOOTH_QUAD_TO ? (i = isNaN(i) ? r : 2 * r - i, o = isNaN(o) ? l : 2 * l - o) : s.type & A.QUAD_TO ? (i = s.relative ? r + s.x1 : s.x1, o = s.relative ? l + s.y1 : s.y2) : (i = NaN, o = NaN), s.type & A.LINE_COMMANDS || s.type & A.ARC && (s.rX === 0 || s.rY === 0 || !s.lArcFlag) || s.type & A.CURVE_TO || s.type & A.SMOOTH_CURVE_TO || s.type & A.QUAD_TO || s.type & A.SMOOTH_QUAD_TO) {
@@ -869,7 +869,7 @@ function go(e = 0) {
869
869
  });
870
870
  }
871
871
  function Xe(e, t, n, i, o, s) {
872
- return Le(e, t, n, i, o, s), Re((r, l, a, u) => {
872
+ return Re(e, t, n, i, o, s), Le((r, l, a, u) => {
873
873
  const h = r.x1, c = r.x2, d = r.relative && !isNaN(u), y = typeof r.x < "u" ? r.x : d ? 0 : l, p = typeof r.y < "u" ? r.y : d ? 0 : a;
874
874
  r.type & A.HORIZ_LINE_TO && t !== 0 && (r.type = A.LINE_TO, r.y = r.relative ? 0 : a), r.type & A.VERT_LINE_TO && n !== 0 && (r.type = A.LINE_TO, r.x = r.relative ? 0 : l), typeof r.x < "u" && (r.x = r.x * e + p * n + (d ? 0 : o)), typeof r.y < "u" && (r.y = y * t + r.y * i + (d ? 0 : s)), typeof r.x1 < "u" && (r.x1 = r.x1 * e + r.y1 * n + (d ? 0 : o)), typeof r.y1 < "u" && (r.y1 = h * t + r.y1 * i + (d ? 0 : s)), typeof r.x2 < "u" && (r.x2 = r.x2 * e + r.y2 * n + (d ? 0 : o)), typeof r.y2 < "u" && (r.y2 = c * t + r.y2 * i + (d ? 0 : s));
875
875
  function g(_) {
@@ -887,39 +887,39 @@ function Xe(e, t, n, i, o, s) {
887
887
  });
888
888
  }
889
889
  function po(e, t = 0, n = 0) {
890
- Le(e, t, n);
890
+ Re(e, t, n);
891
891
  const i = Math.sin(e), o = Math.cos(e);
892
892
  return Xe(o, i, -i, o, t - t * o + n * i, n - t * i - n * o);
893
893
  }
894
894
  function yo(e, t = 0) {
895
- return Le(e, t), Xe(1, 0, 0, 1, e, t);
895
+ return Re(e, t), Xe(1, 0, 0, 1, e, t);
896
896
  }
897
897
  function _o(e, t = e) {
898
- return Le(e, t), Xe(e, 0, 0, t, 0, 0);
898
+ return Re(e, t), Xe(e, 0, 0, t, 0, 0);
899
899
  }
900
900
  function mo(e) {
901
- return Le(e), Xe(1, 0, Math.tan(e), 1, 0, 0);
901
+ return Re(e), Xe(1, 0, Math.tan(e), 1, 0, 0);
902
902
  }
903
903
  function wo(e) {
904
- return Le(e), Xe(1, Math.tan(e), 0, 1, 0, 0);
904
+ return Re(e), Xe(1, Math.tan(e), 0, 1, 0, 0);
905
905
  }
906
906
  function Eo(e = 0) {
907
- return Le(e), Xe(-1, 0, 0, 1, e, 0);
907
+ return Re(e), Xe(-1, 0, 0, 1, e, 0);
908
908
  }
909
909
  function bo(e = 0) {
910
- return Le(e), Xe(1, 0, 0, -1, 0, e);
910
+ return Re(e), Xe(1, 0, 0, -1, 0, e);
911
911
  }
912
912
  function To() {
913
- return Re((e, t, n) => A.ARC === e.type ? lo(e, e.relative ? 0 : t, e.relative ? 0 : n) : e);
913
+ return Le((e, t, n) => A.ARC === e.type ? lo(e, e.relative ? 0 : t, e.relative ? 0 : n) : e);
914
914
  }
915
915
  function Ao() {
916
- return Re((e, t, n) => (e.relative && (t = 0, n = 0), A.ARC === e.type && tn(e, t, n), e));
916
+ return Le((e, t, n) => (e.relative && (t = 0, n = 0), A.ARC === e.type && tn(e, t, n), e));
917
917
  }
918
918
  function wi() {
919
919
  return (e) => ({ ...e });
920
920
  }
921
921
  function Oo() {
922
- const e = wi(), t = yi(), n = mi(), i = _i(), o = Re((s, r, l) => {
922
+ const e = wi(), t = yi(), n = mi(), i = _i(), o = Le((s, r, l) => {
923
923
  const a = i(n(t(e(s))));
924
924
  function u(c) {
925
925
  c > o.maxX && (o.maxX = c), c < o.minX && (o.minX = c);
@@ -959,7 +959,7 @@ const ae = {
959
959
  NORMALIZE_HVZ: ho,
960
960
  NORMALIZE_ST: _i,
961
961
  QT_TO_C: mi,
962
- INFO: Re,
962
+ INFO: Le,
963
963
  SANITIZE: go,
964
964
  MATRIX: Xe,
965
965
  ROTATE: po,
@@ -1303,7 +1303,7 @@ const So = {
1303
1303
  bounds: r
1304
1304
  }
1305
1305
  };
1306
- }, Lo = (e) => {
1306
+ }, Ro = (e) => {
1307
1307
  const t = en(e), n = parseFloat(t.getAttribute("x1")), i = parseFloat(t.getAttribute("x2")), o = parseFloat(t.getAttribute("y1")), s = parseFloat(t.getAttribute("y2")), r = {
1308
1308
  minX: Math.min(n, i),
1309
1309
  minY: Math.min(o, s),
@@ -1317,7 +1317,7 @@ const So = {
1317
1317
  bounds: r
1318
1318
  }
1319
1319
  };
1320
- }, Ro = (e) => {
1320
+ }, Lo = (e) => {
1321
1321
  const t = en(e), o = (t.nodeName === "path" ? [t] : Array.from(t.querySelectorAll("path"))).map((a) => a.getAttribute("d") || "").map((a) => No(a)).filter(Boolean), s = o.reduce((a, u) => [...a, ...u.rings[0].points], []), r = Ee(s);
1322
1322
  return o.length === 1 && o[0].rings.length === 1 ? {
1323
1323
  type: ee.POLYGON,
@@ -1326,7 +1326,7 @@ const So = {
1326
1326
  bounds: r
1327
1327
  }
1328
1328
  } : {
1329
- type: ee.MULTIPOLYGLON,
1329
+ type: ee.MULTIPOLYGON,
1330
1330
  geometry: {
1331
1331
  polygons: o,
1332
1332
  bounds: r
@@ -1337,11 +1337,11 @@ const So = {
1337
1337
  if (t.includes("<polygon points="))
1338
1338
  return Co(t);
1339
1339
  if (t.includes("<path "))
1340
- return Ro(t);
1340
+ return Lo(t);
1341
1341
  if (t.includes("<ellipse "))
1342
1342
  return Io(t);
1343
1343
  if (t.includes("<line "))
1344
- return Lo(t);
1344
+ return Ro(t);
1345
1345
  throw "Unsupported SVG shape: " + t;
1346
1346
  }, Do = (e) => `<g>${e.polygons.map((n) => `<path fill-rule="evenodd" d="${De(n)}" />`).join("")}</g>`, Po = (e) => {
1347
1347
  let t;
@@ -1356,7 +1356,7 @@ const So = {
1356
1356
  t = `<svg><ellipse cx="${n.cx}" cy="${n.cy}" rx="${n.rx}" ry="${n.ry}" /></svg>`;
1357
1357
  break;
1358
1358
  }
1359
- case ee.MULTIPOLYGLON: {
1359
+ case ee.MULTIPOLYGON: {
1360
1360
  const n = e.geometry;
1361
1361
  t = `<svg>${Do(n)}</svg>`;
1362
1362
  break;
@@ -1376,15 +1376,15 @@ for (let e = 0; e < 256; ++e)
1376
1376
  function Uo(e, t = 0) {
1377
1377
  return (ye[e[t + 0]] + ye[e[t + 1]] + ye[e[t + 2]] + ye[e[t + 3]] + "-" + ye[e[t + 4]] + ye[e[t + 5]] + "-" + ye[e[t + 6]] + ye[e[t + 7]] + "-" + ye[e[t + 8]] + ye[e[t + 9]] + "-" + ye[e[t + 10]] + ye[e[t + 11]] + ye[e[t + 12]] + ye[e[t + 13]] + ye[e[t + 14]] + ye[e[t + 15]]).toLowerCase();
1378
1378
  }
1379
- let Lt;
1379
+ let Rt;
1380
1380
  const Ho = new Uint8Array(16);
1381
1381
  function Vo() {
1382
- if (!Lt) {
1382
+ if (!Rt) {
1383
1383
  if (typeof crypto > "u" || !crypto.getRandomValues)
1384
1384
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1385
- Lt = crypto.getRandomValues.bind(crypto);
1385
+ Rt = crypto.getRandomValues.bind(crypto);
1386
1386
  }
1387
- return Lt(Ho);
1387
+ return Rt(Ho);
1388
1388
  }
1389
1389
  const Yo = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), _n = { randomUUID: Yo };
1390
1390
  function bi(e, t, n) {
@@ -1418,13 +1418,13 @@ function Ve(e, t) {
1418
1418
  }
1419
1419
  return e !== e && t !== t;
1420
1420
  }
1421
- function Rt() {
1421
+ function Lt() {
1422
1422
  }
1423
1423
  function Bo(e, t) {
1424
1424
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
1425
1425
  }
1426
1426
  const Ze = [];
1427
- function nn(e, t = Rt) {
1427
+ function nn(e, t = Lt) {
1428
1428
  let n;
1429
1429
  const i = /* @__PURE__ */ new Set();
1430
1430
  function o(l) {
@@ -1442,9 +1442,9 @@ function nn(e, t = Rt) {
1442
1442
  function s(l) {
1443
1443
  o(l(e));
1444
1444
  }
1445
- function r(l, a = Rt) {
1445
+ function r(l, a = Lt) {
1446
1446
  const u = [l, a];
1447
- return i.add(u), i.size === 1 && (n = t(o, s) || Rt), l(e), () => {
1447
+ return i.add(u), i.size === 1 && (n = t(o, s) || Lt), l(e), () => {
1448
1448
  i.delete(u), i.size === 0 && n && (n(), n = null);
1449
1449
  };
1450
1450
  }
@@ -1688,25 +1688,25 @@ const Jo = (e, t) => {
1688
1688
  e.set(m.id, m), m.bodies.forEach((E) => t.set(E.id, m.id)), s(T, { created: [m] });
1689
1689
  }
1690
1690
  }, l = (w, T) => {
1691
- const m = yt(typeof w == "string" ? T : w), E = typeof w == "string" ? w : w.id, L = E && e.get(E);
1692
- if (L) {
1693
- const C = Oi(L, m);
1694
- return E === m.id ? e.set(E, m) : (e.delete(E), e.set(m.id, m)), L.bodies.forEach((P) => t.delete(P.id)), m.bodies.forEach((P) => t.set(P.id, m.id)), C;
1691
+ const m = yt(typeof w == "string" ? T : w), E = typeof w == "string" ? w : w.id, R = E && e.get(E);
1692
+ if (R) {
1693
+ const C = Oi(R, m);
1694
+ return E === m.id ? e.set(E, m) : (e.delete(E), e.set(m.id, m)), R.bodies.forEach((P) => t.delete(P.id)), m.bodies.forEach((P) => t.set(P.id, m.id)), C;
1695
1695
  } else
1696
1696
  console.warn(`Cannot update annotation ${E} - does not exist`);
1697
1697
  }, a = (w, T = oe.LOCAL, m = oe.LOCAL) => {
1698
- const E = es(T) ? m : T, L = l(w, T);
1699
- L && s(E, { updated: [L] });
1698
+ const E = es(T) ? m : T, R = l(w, T);
1699
+ R && s(E, { updated: [R] });
1700
1700
  }, u = (w, T = oe.LOCAL) => {
1701
1701
  e.get(w.id) ? a(w, T) : r(w, T);
1702
1702
  }, h = (w, T = oe.LOCAL) => {
1703
- const m = w.reduce((E, L) => {
1704
- const C = l(L);
1703
+ const m = w.reduce((E, R) => {
1704
+ const C = l(R);
1705
1705
  return C ? [...E, C] : E;
1706
1706
  }, []);
1707
1707
  m.length > 0 && s(T, { updated: m });
1708
1708
  }, c = (w, T = oe.LOCAL) => {
1709
- const m = w.map(yt), { toAdd: E, toUpdate: L } = m.reduce((P, z) => e.get(z.id) ? { ...P, toUpdate: [...P.toUpdate, z] } : { ...P, toAdd: [...P.toAdd, z] }, { toAdd: [], toUpdate: [] }), C = L.map((P) => l(P, T)).filter(Boolean);
1709
+ const m = w.map(yt), { toAdd: E, toUpdate: R } = m.reduce((P, z) => e.get(z.id) ? { ...P, toUpdate: [...P.toUpdate, z] } : { ...P, toAdd: [...P.toAdd, z] }, { toAdd: [], toUpdate: [] }), C = R.map((P) => l(P, T)).filter(Boolean);
1710
1710
  E.forEach((P) => {
1711
1711
  e.set(P.id, P), P.bodies.forEach((z) => t.set(z.id, P.id));
1712
1712
  }), s(T, { created: E, updated: C });
@@ -1730,17 +1730,17 @@ const Jo = (e, t) => {
1730
1730
  }, g = (w, T = !0, m = oe.LOCAL) => {
1731
1731
  const E = w.map(yt);
1732
1732
  if (T) {
1733
- const L = [...e.values()];
1733
+ const R = [...e.values()];
1734
1734
  e.clear(), t.clear(), E.forEach((C) => {
1735
1735
  e.set(C.id, C), C.bodies.forEach((P) => t.set(P.id, C.id));
1736
- }), s(m, { created: E, deleted: L });
1736
+ }), s(m, { created: E, deleted: R });
1737
1737
  } else {
1738
- const L = w.reduce((C, P) => {
1738
+ const R = w.reduce((C, P) => {
1739
1739
  const z = P.id && e.get(P.id);
1740
1740
  return z ? [...C, z] : C;
1741
1741
  }, []);
1742
- if (L.length > 0)
1743
- throw Error(`Bulk insert would overwrite the following annotations: ${L.map((C) => C.id).join(", ")}`);
1742
+ if (R.length > 0)
1743
+ throw Error(`Bulk insert would overwrite the following annotations: ${R.map((C) => C.id).join(", ")}`);
1744
1744
  E.forEach((C) => {
1745
1745
  e.set(C.id, C), C.bodies.forEach((P) => t.set(P.id, C.id));
1746
1746
  }), s(m, { created: E });
@@ -1754,8 +1754,8 @@ const Jo = (e, t) => {
1754
1754
  const m = O(w);
1755
1755
  m && s(T, { deleted: [m] });
1756
1756
  }, M = (w, T = oe.LOCAL) => {
1757
- const m = w.reduce((E, L) => {
1758
- const C = O(L);
1757
+ const m = w.reduce((E, R) => {
1758
+ const C = O(R);
1759
1759
  return C ? [...E, C] : E;
1760
1760
  }, []);
1761
1761
  m.length > 0 && s(T, { deleted: m });
@@ -1767,7 +1767,7 @@ const Jo = (e, t) => {
1767
1767
  t.delete(m.id);
1768
1768
  const E = {
1769
1769
  ...T,
1770
- bodies: T.bodies.filter((L) => L.id !== w.id)
1770
+ bodies: T.bodies.filter((R) => R.id !== w.id)
1771
1771
  };
1772
1772
  return e.set(T.id, E), {
1773
1773
  oldValue: T,
@@ -1801,13 +1801,13 @@ const Jo = (e, t) => {
1801
1801
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
1802
1802
  const m = e.get(w.annotation);
1803
1803
  if (m) {
1804
- const E = m.bodies.find((C) => C.id === w.id), L = {
1804
+ const E = m.bodies.find((C) => C.id === w.id), R = {
1805
1805
  ...m,
1806
1806
  bodies: m.bodies.map((C) => C.id === E.id ? T : C)
1807
1807
  };
1808
- return e.set(m.id, L), E.id !== T.id && (t.delete(E.id), t.set(T.id, L.id)), {
1808
+ return e.set(m.id, R), E.id !== T.id && (t.delete(E.id), t.set(T.id, R.id)), {
1809
1809
  oldValue: m,
1810
- newValue: L,
1810
+ newValue: R,
1811
1811
  bodiesUpdated: [{ oldBody: E, newBody: T }]
1812
1812
  };
1813
1813
  } else
@@ -2309,7 +2309,7 @@ function vs(e) {
2309
2309
  );
2310
2310
  return {
2311
2311
  c() {
2312
- t = R("g"), r && r.c(), f(t, "class", "a9s-annotation selected");
2312
+ t = L("g"), r && r.c(), f(t, "class", "a9s-annotation selected");
2313
2313
  },
2314
2314
  m(l, a) {
2315
2315
  H(l, t, a), r && r.m(t, null), n = !0, i || (o = [
@@ -2411,7 +2411,7 @@ function Ns(e) {
2411
2411
  );
2412
2412
  return {
2413
2413
  c() {
2414
- t = R("g"), n = R("circle"), u && u.c(), o = R("circle"), f(n, "class", "a9s-handle-buffer"), f(
2414
+ t = L("g"), n = L("circle"), u && u.c(), o = L("circle"), f(n, "class", "a9s-handle-buffer"), f(
2415
2415
  n,
2416
2416
  "cx",
2417
2417
  /*x*/
@@ -2532,7 +2532,7 @@ function Cs(e) {
2532
2532
  let t, n, i, o, s, r, l, a, u;
2533
2533
  return {
2534
2534
  c() {
2535
- t = R("g"), n = R("circle"), o = R("circle"), r = R("circle"), f(
2535
+ t = L("g"), n = L("circle"), o = L("circle"), r = L("circle"), f(
2536
2536
  n,
2537
2537
  "cx",
2538
2538
  /*x*/
@@ -2664,7 +2664,7 @@ function bn(e) {
2664
2664
  let t, n;
2665
2665
  return {
2666
2666
  c() {
2667
- t = R("circle"), f(t, "class", "a9s-handle-selected"), f(
2667
+ t = L("circle"), f(t, "class", "a9s-handle-selected"), f(
2668
2668
  t,
2669
2669
  "cx",
2670
2670
  /*x*/
@@ -2727,7 +2727,7 @@ function Is(e) {
2727
2727
  }
2728
2728
  };
2729
2729
  }
2730
- function Ls(e, t, n) {
2730
+ function Rs(e, t, n) {
2731
2731
  let i, { x: o } = t, { y: s } = t, { scale: r } = t, { selected: l = void 0 } = t, a = !1;
2732
2732
  const u = (_) => {
2733
2733
  _.pointerType === "touch" && n(4, a = !0);
@@ -2775,14 +2775,14 @@ function Ls(e, t, n) {
2775
2775
  }
2776
2776
  class $e extends Oe {
2777
2777
  constructor(t) {
2778
- super(), Ae(this, t, Ls, Is, fe, { x: 0, y: 1, scale: 2, selected: 3 });
2778
+ super(), Ae(this, t, Rs, Is, fe, { x: 0, y: 1, scale: 2, selected: 3 });
2779
2779
  }
2780
2780
  }
2781
- function Rs(e) {
2781
+ function Ls(e) {
2782
2782
  let t, n, i, o, s, r, l;
2783
2783
  return {
2784
2784
  c() {
2785
- t = R("g"), n = R("circle"), o = R("circle"), s = R("circle"), f(n, "class", "a9s-polygon-midpoint-buffer svelte-12ykj76"), f(
2785
+ t = L("g"), n = L("circle"), o = L("circle"), s = L("circle"), f(n, "class", "a9s-polygon-midpoint-buffer svelte-12ykj76"), f(
2786
2786
  n,
2787
2787
  "cx",
2788
2788
  /*x*/
@@ -2903,7 +2903,7 @@ function ks(e) {
2903
2903
  let t;
2904
2904
  return {
2905
2905
  c() {
2906
- t = R("circle"), f(
2906
+ t = L("circle"), f(
2907
2907
  t,
2908
2908
  "cx",
2909
2909
  /*x*/
@@ -2952,7 +2952,7 @@ function ks(e) {
2952
2952
  function Ds(e) {
2953
2953
  let t;
2954
2954
  function n(s, r) {
2955
- return Ye ? ks : Rs;
2955
+ return Ye ? ks : Ls;
2956
2956
  }
2957
2957
  let o = n()(e);
2958
2958
  return {
@@ -3030,7 +3030,7 @@ function An(e) {
3030
3030
  let t, n, i, o;
3031
3031
  return {
3032
3032
  c() {
3033
- t = R("circle"), f(t, "cx", n = /*point*/
3033
+ t = L("circle"), f(t, "cx", n = /*point*/
3034
3034
  e[28][0]), f(t, "cy", i = /*point*/
3035
3035
  e[28][1]), f(t, "r", o = lt / /*viewportScale*/
3036
3036
  e[3]), f(t, "class", "svelte-1h2slbm");
@@ -3056,7 +3056,7 @@ function On(e) {
3056
3056
  let t, n, i, o, s, r, l, a, u, h;
3057
3057
  return {
3058
3058
  c() {
3059
- t = R("mask"), n = R("rect"), l = R("circle"), f(n, "x", i = /*mask*/
3059
+ t = L("mask"), n = L("rect"), l = L("circle"), f(n, "x", i = /*mask*/
3060
3060
  e[9].x), f(n, "y", o = /*mask*/
3061
3061
  e[9].y), f(n, "width", s = /*mask*/
3062
3062
  e[9].w), f(n, "height", r = /*mask*/
@@ -3258,7 +3258,7 @@ function Us(e) {
3258
3258
  );
3259
3259
  return {
3260
3260
  c() {
3261
- t = R("defs"), n = R("mask"), i = R("rect"), a = R("polygon"), I && I.c(), N && N.c(), h = Me(), c = R("polygon"), y = Me(), p = R("polygon"), O = Me();
3261
+ t = L("defs"), n = L("mask"), i = L("rect"), a = L("polygon"), I && I.c(), N && N.c(), h = Me(), c = L("polygon"), y = Me(), p = L("polygon"), O = Me();
3262
3262
  for (let w = 0; w < k.length; w += 1)
3263
3263
  k[w].c();
3264
3264
  _ = Me(), G && G.c(), M = Ne(), f(i, "x", o = /*mask*/
@@ -3461,7 +3461,7 @@ function Xs(e, t, n) {
3461
3461
  n(6, d = void 0);
3462
3462
  return;
3463
3463
  }
3464
- const [E, L] = u.elementToImage(m.offsetX, m.offsetY), C = (Z) => Math.pow(Z[0] - E, 2) + Math.pow(Z[1] - L, 2), P = i.points.reduce((Z, x) => C(x) < C(Z) ? x : Z), z = o.filter((Z) => Z.visible).reduce((Z, x) => C(x.point) < C(Z.point) ? x : Z), F = Math.pow(Ys / h, 2);
3464
+ const [E, R] = u.elementToImage(m.offsetX, m.offsetY), C = (Z) => Math.pow(Z[0] - E, 2) + Math.pow(Z[1] - R, 2), P = i.points.reduce((Z, x) => C(x) < C(Z) ? x : Z), z = o.filter((Z) => Z.visible).reduce((Z, x) => C(x.point) < C(Z.point) ? x : Z), F = Math.pow(Ys / h, 2);
3465
3465
  C(P) < F || C(z.point) < F ? n(6, d = o.indexOf(z)) : n(6, d = void 0);
3466
3466
  }, b = () => {
3467
3467
  document.activeElement !== c && c.focus();
@@ -3471,23 +3471,23 @@ function Xs(e, t, n) {
3471
3471
  n(7, y = !0), m.preventDefault(), m.stopPropagation(), p = performance.now();
3472
3472
  }, I = (m) => (E) => {
3473
3473
  if (!p || Ye || performance.now() - p > Vs) return;
3474
- const L = g.includes(m);
3475
- E.metaKey || E.ctrlKey || E.shiftKey ? L ? n(8, g = g.filter((C) => C !== m)) : n(8, g = [...g, m]) : L && g.length > 1 ? n(8, g = [m]) : L ? n(8, g = []) : n(8, g = [m]), b();
3476
- }, N = (m, E, L) => {
3474
+ const R = g.includes(m);
3475
+ E.metaKey || E.ctrlKey || E.shiftKey ? R ? n(8, g = g.filter((C) => C !== m)) : n(8, g = [...g, m]) : R && g.length > 1 ? n(8, g = [m]) : R ? n(8, g = []) : n(8, g = [m]), b();
3476
+ }, N = (m, E, R) => {
3477
3477
  b();
3478
3478
  let C;
3479
3479
  const P = m.geometry;
3480
- g.length > 1 ? C = P.points.map(([F, K], Z) => g.includes(Z) ? [F + L[0], K + L[1]] : [F, K]) : E === "SHAPE" ? C = P.points.map(([F, K]) => [F + L[0], K + L[1]]) : C = P.points.map(([F, K], Z) => E === `HANDLE-${Z}` ? [F + L[0], K + L[1]] : [F, K]);
3480
+ g.length > 1 ? C = P.points.map(([F, K], Z) => g.includes(Z) ? [F + R[0], K + R[1]] : [F, K]) : E === "SHAPE" ? C = P.points.map(([F, K]) => [F + R[0], K + R[1]]) : C = P.points.map(([F, K], Z) => E === `HANDLE-${Z}` ? [F + R[0], K + R[1]] : [F, K]);
3481
3481
  const z = Ee(C);
3482
3482
  return { ...m, geometry: { points: C, bounds: z } };
3483
3483
  }, D = (m) => async (E) => {
3484
3484
  E.stopPropagation();
3485
- const L = [
3485
+ const R = [
3486
3486
  ...i.points.slice(0, m + 1),
3487
3487
  o[m].point,
3488
3488
  ...i.points.slice(m + 1)
3489
- ], C = Ee(L);
3490
- r("change", { ...l, geometry: { points: L, bounds: C } }), await ci();
3489
+ ], C = Ee(R);
3490
+ r("change", { ...l, geometry: { points: R, bounds: C } }), await ci();
3491
3491
  const P = [...document.querySelectorAll(".a9s-handle")][m + 1];
3492
3492
  if (P != null && P.firstChild) {
3493
3493
  const z = new PointerEvent(
@@ -3507,7 +3507,7 @@ function Xs(e, t, n) {
3507
3507
  }
3508
3508
  }, k = () => {
3509
3509
  if (i.points.length - g.length < 3) return;
3510
- const m = i.points.filter((L, C) => !g.includes(C)), E = Ee(m);
3510
+ const m = i.points.filter((R, C) => !g.includes(C)), E = Ee(m);
3511
3511
  r("change", { ...l, geometry: { points: m, bounds: E } }), n(8, g = []);
3512
3512
  };
3513
3513
  ze(() => {
@@ -3535,7 +3535,7 @@ function Xs(e, t, n) {
3535
3535
  e.$$.dirty[0] & /*shape*/
3536
3536
  1 && n(5, i = l.geometry), e.$$.dirty[0] & /*geom, viewportScale*/
3537
3537
  40 && n(10, o = Ye ? [] : i.points.map((m, E) => {
3538
- const L = E === i.points.length - 1 ? i.points[0] : i.points[E + 1], C = (m[0] + L[0]) / 2, P = (m[1] + L[1]) / 2, F = Math.sqrt(Math.pow(L[0] - C, 2) + Math.pow(L[1] - P, 2)) > Bs / h;
3538
+ const R = E === i.points.length - 1 ? i.points[0] : i.points[E + 1], C = (m[0] + R[0]) / 2, P = (m[1] + R[1]) / 2, F = Math.sqrt(Math.pow(R[0] - C, 2) + Math.pow(R[1] - P, 2)) > Bs / h;
3539
3539
  return { point: [C, P], visible: F };
3540
3540
  })), e.$$.dirty[0] & /*geom, viewportScale*/
3541
3541
  40 && n(9, s = vt(i.bounds, lt / h));
@@ -3586,7 +3586,7 @@ class Fs extends Oe {
3586
3586
  }
3587
3587
  }
3588
3588
  function js(e) {
3589
- let t, n, i, o, s, r, l, a, u, h, c, d, y, p, g, O, _, M, b, v, S, I, N, D, k, j, G, w, T, m, E, L, C, P, z, F, K, Z, x, ie, re, ve, Ie, B, ce, $, pe, me, Qe, Pe, St, Ue, W, Nt, rn;
3589
+ let t, n, i, o, s, r, l, a, u, h, c, d, y, p, g, O, _, M, b, v, S, I, N, D, k, j, G, w, T, m, E, R, C, P, z, F, K, Z, x, ie, re, ve, Ie, B, ce, $, pe, me, Qe, Pe, St, Ue, W, Nt, rn;
3590
3590
  return $ = new $e({
3591
3591
  props: {
3592
3592
  class: "a9s-corner-handle-topleft",
@@ -3677,7 +3677,7 @@ function js(e) {
3677
3677
  ) && e[12]("BOTTOM_LEFT").apply(this, arguments);
3678
3678
  }), {
3679
3679
  c() {
3680
- t = R("defs"), n = R("mask"), i = R("rect"), a = R("rect"), y = Me(), p = R("rect"), b = Me(), v = R("rect"), k = Me(), j = R("rect"), m = Me(), E = R("rect"), z = Me(), F = R("rect"), ie = Me(), re = R("rect"), ce = Me(), ge($.$$.fragment), pe = Me(), ge(me.$$.fragment), Qe = Me(), ge(Pe.$$.fragment), St = Me(), ge(Ue.$$.fragment), f(i, "class", "rect-mask-bg svelte-1njczvj"), f(i, "x", o = /*mask*/
3680
+ t = L("defs"), n = L("mask"), i = L("rect"), a = L("rect"), y = Me(), p = L("rect"), b = Me(), v = L("rect"), k = Me(), j = L("rect"), m = Me(), E = L("rect"), z = Me(), F = L("rect"), ie = Me(), re = L("rect"), ce = Me(), ge($.$$.fragment), pe = Me(), ge(me.$$.fragment), Qe = Me(), ge(Pe.$$.fragment), St = Me(), ge(Ue.$$.fragment), f(i, "class", "rect-mask-bg svelte-1njczvj"), f(i, "x", o = /*mask*/
3681
3681
  e[6].x), f(i, "y", s = /*mask*/
3682
3682
  e[6].y), f(i, "width", r = /*mask*/
3683
3683
  e[6].w), f(i, "height", l = /*mask*/
@@ -3707,7 +3707,7 @@ function js(e) {
3707
3707
  e[5].h), f(j, "class", "a9s-edge-handle a9s-edge-handle-top"), f(j, "x", G = /*geom*/
3708
3708
  e[5].x), f(j, "y", w = /*geom*/
3709
3709
  e[5].y), f(j, "height", 1), f(j, "width", T = /*geom*/
3710
- e[5].w), f(E, "class", "a9s-edge-handle a9s-edge-handle-right"), f(E, "x", L = /*geom*/
3710
+ e[5].w), f(E, "class", "a9s-edge-handle a9s-edge-handle-right"), f(E, "x", R = /*geom*/
3711
3711
  e[5].x + /*geom*/
3712
3712
  e[5].w), f(E, "y", C = /*geom*/
3713
3713
  e[5].y), f(E, "height", P = /*geom*/
@@ -3806,9 +3806,9 @@ function js(e) {
3806
3806
  e[5].y)) && f(j, "y", w), (!W || V & /*geom*/
3807
3807
  32 && T !== (T = /*geom*/
3808
3808
  e[5].w)) && f(j, "width", T), (!W || V & /*geom*/
3809
- 32 && L !== (L = /*geom*/
3809
+ 32 && R !== (R = /*geom*/
3810
3810
  e[5].x + /*geom*/
3811
- e[5].w)) && f(E, "x", L), (!W || V & /*geom*/
3811
+ e[5].w)) && f(E, "x", R), (!W || V & /*geom*/
3812
3812
  32 && C !== (C = /*geom*/
3813
3813
  e[5].y)) && f(E, "y", C), (!W || V & /*geom*/
3814
3814
  32 && P !== (P = /*geom*/
@@ -4083,11 +4083,11 @@ function Vt(e) {
4083
4083
  );
4084
4084
  return t[29] = n.point, t;
4085
4085
  }
4086
- function Ln(e, t, n) {
4086
+ function Rn(e, t, n) {
4087
4087
  const i = e.slice();
4088
4088
  return i[30] = t[n], i[32] = n, i;
4089
4089
  }
4090
- function Rn(e, t, n) {
4090
+ function Ln(e, t, n) {
4091
4091
  const i = e.slice();
4092
4092
  return i[33] = t[n], i[35] = n, i;
4093
4093
  }
@@ -4119,7 +4119,7 @@ function Dn(e) {
4119
4119
  let t, n, i, o;
4120
4120
  return {
4121
4121
  c() {
4122
- t = R("circle"), f(t, "cx", n = /*point*/
4122
+ t = L("circle"), f(t, "cx", n = /*point*/
4123
4123
  e[29][0]), f(t, "cy", i = /*point*/
4124
4124
  e[29][1]), f(t, "r", o = at / /*viewportScale*/
4125
4125
  e[3]), f(t, "class", "svelte-1vxo6dc");
@@ -4145,7 +4145,7 @@ function Pn(e) {
4145
4145
  let t, n, i, o, s, r, l, a, u, h;
4146
4146
  return {
4147
4147
  c() {
4148
- t = R("mask"), n = R("rect"), l = R("circle"), f(n, "x", i = /*mask*/
4148
+ t = L("mask"), n = L("rect"), l = L("circle"), f(n, "x", i = /*mask*/
4149
4149
  e[9].x), f(n, "y", o = /*mask*/
4150
4150
  e[9].y), f(n, "width", s = /*mask*/
4151
4151
  e[9].w), f(n, "height", r = /*mask*/
@@ -4352,13 +4352,13 @@ function Vn(e) {
4352
4352
  e[30].rings
4353
4353
  ), S = [];
4354
4354
  for (let N = 0; N < v.length; N += 1)
4355
- S[N] = Hn(Rn(e, v, N));
4355
+ S[N] = Hn(Ln(e, v, N));
4356
4356
  const I = (N) => X(S[N], 1, 1, () => {
4357
4357
  S[N] = null;
4358
4358
  });
4359
4359
  return {
4360
4360
  c() {
4361
- t = R("g"), n = R("defs"), i = R("mask"), o = R("rect"), u = R("path"), M && M.c(), b && b.c(), c = R("path"), y = R("path");
4361
+ t = L("g"), n = L("defs"), i = L("mask"), o = L("rect"), u = L("path"), M && M.c(), b && b.c(), c = L("path"), y = L("path");
4362
4362
  for (let N = 0; N < S.length; N += 1)
4363
4363
  S[N].c();
4364
4364
  f(o, "x", s = /*mask*/
@@ -4457,7 +4457,7 @@ function Vn(e) {
4457
4457
  );
4458
4458
  let k;
4459
4459
  for (k = 0; k < v.length; k += 1) {
4460
- const j = Rn(e, v, k);
4460
+ const j = Ln(e, v, k);
4461
4461
  S[k] ? (S[k].p(j, D), Y(S[k], 1)) : (S[k] = Hn(j), S[k].c(), Y(S[k], 1), S[k].m(t, null));
4462
4462
  }
4463
4463
  for (be(), k = v.length; k < S.length; k += 1)
@@ -4546,7 +4546,7 @@ function Ks(e) {
4546
4546
  e[5].polygons
4547
4547
  ), s = [];
4548
4548
  for (let a = 0; a < o.length; a += 1)
4549
- s[a] = Vn(Ln(e, o, a));
4549
+ s[a] = Vn(Rn(e, o, a));
4550
4550
  const r = (a) => X(s[a], 1, 1, () => {
4551
4551
  s[a] = null;
4552
4552
  });
@@ -4575,7 +4575,7 @@ function Ks(e) {
4575
4575
  );
4576
4576
  let h;
4577
4577
  for (h = 0; h < o.length; h += 1) {
4578
- const c = Ln(a, o, h);
4578
+ const c = Rn(a, o, h);
4579
4579
  s[h] ? (s[h].p(c, u), Y(s[h], 1)) : (s[h] = Vn(c), s[h].c(), Y(s[h], 1), s[h].m(t.parentNode, t));
4580
4580
  }
4581
4581
  for (be(), h = o.length; h < s.length; h += 1)
@@ -4688,7 +4688,7 @@ function $s(e, t, n) {
4688
4688
  n(6, d = void 0);
4689
4689
  return;
4690
4690
  }
4691
- const [L, C] = u.elementToImage(E.offsetX, E.offsetY), P = (x) => Math.pow(x[0] - L, 2) + Math.pow(x[1] - C, 2), z = $i(i).reduce((x, ie) => P(ie) < P(x) ? ie : x), F = o.filter((x) => x.visible).reduce((x, ie) => P(ie.point) < P(x.point) ? ie : x), K = Math.pow(Js / h, 2);
4691
+ const [R, C] = u.elementToImage(E.offsetX, E.offsetY), P = (x) => Math.pow(x[0] - R, 2) + Math.pow(x[1] - C, 2), z = $i(i).reduce((x, ie) => P(ie) < P(x) ? ie : x), F = o.filter((x) => x.visible).reduce((x, ie) => P(ie.point) < P(x.point) ? ie : x), K = Math.pow(Js / h, 2);
4692
4692
  P(z) < K || P(F.point) < K ? n(6, d = o.indexOf(F)) : n(6, d = void 0);
4693
4693
  }, b = () => {
4694
4694
  document.activeElement !== c && c.focus();
@@ -4696,21 +4696,21 @@ function $s(e, t, n) {
4696
4696
  n(8, g = []), b();
4697
4697
  }, S = (E) => {
4698
4698
  n(7, y = !0), E.preventDefault(), E.stopPropagation(), p = performance.now();
4699
- }, I = (E, L, C) => (P) => {
4699
+ }, I = (E, R, C) => (P) => {
4700
4700
  if (!p || Ye || performance.now() - p > Ws) return;
4701
- const z = (K) => K.polygon === E && K.ring === L && K.point === C, F = g.some(z);
4702
- P.metaKey || P.ctrlKey || P.shiftKey ? F ? n(8, g = g.filter((K) => !z(K))) : n(8, g = [...g, { polygon: E, ring: L, point: C }]) : F && g.length > 1 ? n(8, g = [{ polygon: E, ring: L, point: C }]) : F ? n(8, g = []) : n(8, g = [{ polygon: E, ring: L, point: C }]), b();
4703
- }, N = (E, L, C) => {
4701
+ const z = (K) => K.polygon === E && K.ring === R && K.point === C, F = g.some(z);
4702
+ P.metaKey || P.ctrlKey || P.shiftKey ? F ? n(8, g = g.filter((K) => !z(K))) : n(8, g = [...g, { polygon: E, ring: R, point: C }]) : F && g.length > 1 ? n(8, g = [{ polygon: E, ring: R, point: C }]) : F ? n(8, g = []) : n(8, g = [{ polygon: E, ring: R, point: C }]), b();
4703
+ }, N = (E, R, C) => {
4704
4704
  b();
4705
4705
  const P = E.geometry.polygons;
4706
4706
  let z;
4707
- if (L === "SHAPE")
4707
+ if (R === "SHAPE")
4708
4708
  z = P.map((F) => {
4709
4709
  const K = F.rings.map((x, ie) => ({ points: x.points.map((ve, Ie) => [ve[0] + C[0], ve[1] + C[1]]) })), Z = Ee(K[0].points);
4710
4710
  return { rings: K, bounds: Z };
4711
4711
  });
4712
4712
  else {
4713
- const [F, K, Z, x] = L.split("-").map((ie) => parseInt(ie));
4713
+ const [F, K, Z, x] = R.split("-").map((ie) => parseInt(ie));
4714
4714
  z = P.map((ie, re) => {
4715
4715
  if (re === K) {
4716
4716
  const ve = ie.rings.map((B, ce) => ce === Z ? { points: B.points.map((pe, me) => me === x ? [pe[0] + C[0], pe[1] + C[1]] : pe) } : B), Ie = Ee(ve[0].points);
@@ -4726,8 +4726,8 @@ function $s(e, t, n) {
4726
4726
  bounds: bt(z)
4727
4727
  }
4728
4728
  };
4729
- }, D = (E) => async (L) => {
4730
- L.stopPropagation();
4729
+ }, D = (E) => async (R) => {
4730
+ R.stopPropagation();
4731
4731
  const C = o[E], P = i.polygons.map((F, K) => {
4732
4732
  if (K === C.elementIdx) {
4733
4733
  const Z = F.rings.map((ie, re) => re === C.ringIdx ? { points: [
@@ -4753,12 +4753,12 @@ function $s(e, t, n) {
4753
4753
  {
4754
4754
  bubbles: !0,
4755
4755
  cancelable: !0,
4756
- clientX: L.clientX,
4757
- clientY: L.clientY,
4758
- pointerId: L.pointerId,
4759
- pointerType: L.pointerType,
4760
- isPrimary: L.isPrimary,
4761
- buttons: L.buttons
4756
+ clientX: R.clientX,
4757
+ clientY: R.clientY,
4758
+ pointerId: R.pointerId,
4759
+ pointerType: R.pointerType,
4760
+ isPrimary: R.isPrimary,
4761
+ buttons: R.buttons
4762
4762
  }
4763
4763
  );
4764
4764
  z.firstChild.dispatchEvent(F);
@@ -4784,14 +4784,14 @@ function $s(e, t, n) {
4784
4784
  };
4785
4785
  ze(() => {
4786
4786
  if (Ye) return;
4787
- const E = (L) => {
4788
- (L.key === "Delete" || L.key === "Backspace") && (L.preventDefault(), k());
4787
+ const E = (R) => {
4788
+ (R.key === "Delete" || R.key === "Backspace") && (R.preventDefault(), k());
4789
4789
  };
4790
4790
  return c.addEventListener("pointermove", M), c.addEventListener("keydown", E), () => {
4791
4791
  c.removeEventListener("pointermove", M), c.removeEventListener("keydown", E);
4792
4792
  };
4793
4793
  });
4794
- const j = `polygon-mask-${Math.random().toString(36).substring(2, 12)}`, G = (E, L, C, { polygon: P, ring: z, point: F }) => P === E && z === L && F === C;
4794
+ const j = `polygon-mask-${Math.random().toString(36).substring(2, 12)}`, G = (E, R, C, { polygon: P, ring: z, point: F }) => P === E && z === R && F === C;
4795
4795
  function w(E) {
4796
4796
  we.call(this, e, E);
4797
4797
  }
@@ -4857,7 +4857,7 @@ class er extends Oe {
4857
4857
  const Si = /* @__PURE__ */ new Map([
4858
4858
  [ee.RECTANGLE, Qs],
4859
4859
  [ee.POLYGON, Fs],
4860
- [ee.MULTIPOLYGLON, er]
4860
+ [ee.MULTIPOLYGON, er]
4861
4861
  ]), tr = (e) => Si.get(e.type), nr = (e, t) => Si.set(e, t);
4862
4862
  function ir(e, t, n) {
4863
4863
  let i;
@@ -4949,7 +4949,7 @@ function Bn(e) {
4949
4949
  let t, n, i, o, s, r, l, a, u, h;
4950
4950
  return {
4951
4951
  c() {
4952
- t = R("defs"), n = R("mask"), i = R("rect"), a = R("rect"), u = R("rect"), h = R("rect"), f(i, "class", "rect-mask-bg svelte-1a76qe7"), f(i, "x", o = /*x*/
4952
+ t = L("defs"), n = L("mask"), i = L("rect"), a = L("rect"), u = L("rect"), h = L("rect"), f(i, "class", "rect-mask-bg svelte-1a76qe7"), f(i, "x", o = /*x*/
4953
4953
  e[1] - /*buffer*/
4954
4954
  e[5]), f(i, "y", s = /*y*/
4955
4955
  e[2] - /*buffer*/
@@ -5127,7 +5127,7 @@ function lr(e) {
5127
5127
  );
5128
5128
  return {
5129
5129
  c() {
5130
- t = R("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
5130
+ t = L("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
5131
5131
  },
5132
5132
  m(i, o) {
5133
5133
  H(i, t, o), n && n.m(t, null);
@@ -5227,7 +5227,7 @@ function Xn(e) {
5227
5227
  );
5228
5228
  return {
5229
5229
  c() {
5230
- t = R("defs"), n = R("mask"), i = R("rect"), a = R("polygon"), h = R("polygon"), d = R("polygon"), g && g.c(), p = Ne(), f(i, "x", o = /*mask*/
5230
+ t = L("defs"), n = L("mask"), i = L("rect"), a = L("polygon"), h = L("polygon"), d = L("polygon"), g && g.c(), p = Ne(), f(i, "x", o = /*mask*/
5231
5231
  e[3].x), f(i, "y", s = /*mask*/
5232
5232
  e[3].y), f(i, "width", r = /*mask*/
5233
5233
  e[3].w), f(i, "height", l = /*mask*/
@@ -5272,7 +5272,7 @@ function Fn(e) {
5272
5272
  let t, n, i;
5273
5273
  return {
5274
5274
  c() {
5275
- t = R("circle"), f(t, "class", "a9s-handle svelte-18wrg3t"), f(t, "cx", n = /*points*/
5275
+ t = L("circle"), f(t, "class", "a9s-handle svelte-18wrg3t"), f(t, "cx", n = /*points*/
5276
5276
  e[0][0][0]), f(t, "cy", i = /*points*/
5277
5277
  e[0][0][1]), f(
5278
5278
  t,
@@ -5309,7 +5309,7 @@ function fr(e) {
5309
5309
  );
5310
5310
  return {
5311
5311
  c() {
5312
- t = R("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
5312
+ t = L("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
5313
5313
  },
5314
5314
  m(i, o) {
5315
5315
  H(i, t, o), n && n.m(t, null);
@@ -5434,7 +5434,7 @@ function yr(e) {
5434
5434
  let t, n, i, o, s;
5435
5435
  return {
5436
5436
  c() {
5437
- t = R("g"), n = R("ellipse"), o = R("ellipse"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5437
+ t = L("g"), n = L("ellipse"), o = L("ellipse"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5438
5438
  e[1] ? "display:none;" : void 0), f(
5439
5439
  n,
5440
5440
  "cx",
@@ -5529,7 +5529,7 @@ function Gn(e) {
5529
5529
  let t, n, i;
5530
5530
  return {
5531
5531
  c() {
5532
- t = R("path"), i = R("path"), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
5532
+ t = L("path"), i = L("path"), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
5533
5533
  e[1] ? "display:none;" : void 0), f(t, "fill-rule", "evenodd"), f(t, "d", De(
5534
5534
  /*polygonElement*/
5535
5535
  e[5]
@@ -5571,7 +5571,7 @@ function wr(e) {
5571
5571
  o[s] = Gn(jn(e, i, s));
5572
5572
  return {
5573
5573
  c() {
5574
- t = R("g");
5574
+ t = L("g");
5575
5575
  for (let s = 0; s < o.length; s += 1)
5576
5576
  o[s].c();
5577
5577
  f(t, "class", "a9s-annotation"), f(t, "data-id", n = /*annotation*/
@@ -5628,7 +5628,7 @@ function Tr(e) {
5628
5628
  let t, n, i, o, s;
5629
5629
  return {
5630
5630
  c() {
5631
- t = R("g"), n = R("polygon"), o = R("polygon"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5631
+ t = L("g"), n = L("polygon"), o = L("polygon"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5632
5632
  e[1] ? "display:none;" : void 0), f(
5633
5633
  n,
5634
5634
  "points",
@@ -5690,7 +5690,7 @@ function Sr(e) {
5690
5690
  let t, n, i, o, s;
5691
5691
  return {
5692
5692
  c() {
5693
- t = R("g"), n = R("rect"), o = R("rect"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5693
+ t = L("g"), n = L("rect"), o = L("rect"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5694
5694
  e[5] ? "display:none;" : void 0), f(
5695
5695
  n,
5696
5696
  "x",
@@ -5829,7 +5829,7 @@ function Ir(e) {
5829
5829
  let t, n, i, o, s;
5830
5830
  return {
5831
5831
  c() {
5832
- t = R("g"), n = R("line"), o = R("line"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5832
+ t = L("g"), n = L("line"), o = L("line"), f(n, "class", "a9s-outer"), f(n, "style", i = /*computedStyle*/
5833
5833
  e[1] ? "display:none;" : void 0), f(
5834
5834
  n,
5835
5835
  "x1",
@@ -5901,7 +5901,7 @@ function Ir(e) {
5901
5901
  }
5902
5902
  };
5903
5903
  }
5904
- function Lr(e, t, n) {
5904
+ function Rr(e, t, n) {
5905
5905
  let i, { annotation: o } = t, { geom: s } = t, { style: r } = t;
5906
5906
  const { points: l } = s, [[a, u], [h, c]] = l;
5907
5907
  return e.$$set = (d) => {
@@ -5911,9 +5911,9 @@ function Lr(e, t, n) {
5911
5911
  129 && n(1, i = tt(o, r));
5912
5912
  }, [o, i, a, u, h, c, s, r];
5913
5913
  }
5914
- class Rr extends Oe {
5914
+ class Lr extends Oe {
5915
5915
  constructor(t) {
5916
- super(), Ae(this, t, Lr, Ir, fe, { annotation: 0, geom: 6, style: 7 });
5916
+ super(), Ae(this, t, Rr, Ir, fe, { annotation: 0, geom: 6, style: 7 });
5917
5917
  }
5918
5918
  }
5919
5919
  const gl = {
@@ -5991,7 +5991,7 @@ function qn(e) {
5991
5991
  }
5992
5992
  function Ur(e) {
5993
5993
  let t, n;
5994
- return t = new Rr({
5994
+ return t = new Lr({
5995
5995
  props: {
5996
5996
  annotation: (
5997
5997
  /*annotation*/
@@ -6235,7 +6235,7 @@ function Zn(e) {
6235
6235
  /*selector*/
6236
6236
  ((d = a[46]) == null ? void 0 : d.type) === ee.POLYGON ? 2 : (
6237
6237
  /*selector*/
6238
- ((y = a[46]) == null ? void 0 : y.type) === ee.MULTIPOLYGLON ? 3 : (
6238
+ ((y = a[46]) == null ? void 0 : y.type) === ee.MULTIPOLYGON ? 3 : (
6239
6239
  /*selector*/
6240
6240
  ((p = a[46]) == null ? void 0 : p.type) === ee.LINE ? 4 : -1
6241
6241
  )
@@ -6649,10 +6649,10 @@ function jr(e) {
6649
6649
  );
6650
6650
  return {
6651
6651
  c() {
6652
- t = R("svg"), n = R("g");
6652
+ t = L("svg"), n = L("g");
6653
6653
  for (let c = 0; c < a.length; c += 1)
6654
6654
  a[c].c();
6655
- i = R("g"), h && h.c(), f(i, "class", "drawing"), f(t, "role", "application"), f(t, "tabindex", 0), f(t, "class", "a9s-annotationlayer"), ke(
6655
+ i = L("g"), h && h.c(), f(i, "class", "drawing"), f(t, "role", "application"), f(t, "tabindex", 0), f(t, "class", "a9s-annotationlayer"), ke(
6656
6656
  t,
6657
6657
  "drawing",
6658
6658
  /*tool*/
@@ -6765,8 +6765,8 @@ function Gr(e, t, n) {
6765
6765
  const k = () => n(5, D += 1), j = () => S, G = () => O;
6766
6766
  let w, T, m;
6767
6767
  ze(() => g(n(7, m = Os(_, T))));
6768
- const { hover: E, selection: L, store: C } = b;
6769
- Ct(e, E, (B) => n(15, h = B)), Ct(e, L, (B) => n(33, c = B)), Ct(e, C, (B) => n(16, d = B));
6768
+ const { hover: E, selection: R, store: C } = b;
6769
+ Ct(e, E, (B) => n(15, h = B)), Ct(e, R, (B) => n(33, c = B)), Ct(e, C, (B) => n(16, d = B));
6770
6770
  let P, z;
6771
6771
  const F = (B) => {
6772
6772
  P && C.unobserve(P);
@@ -6786,7 +6786,7 @@ function Gr(e, t, n) {
6786
6786
  created: /* @__PURE__ */ new Date()
6787
6787
  }
6788
6788
  };
6789
- C.addAnnotation($), L.setSelected($.id);
6789
+ C.addAnnotation($), R.setSelected($.id);
6790
6790
  }, Z = (B) => (ce) => {
6791
6791
  var Qe;
6792
6792
  const { target: $ } = B, pe = 10 * 60 * 1e3, me = ((Qe = $.creator) == null ? void 0 : Qe.id) !== I.id || !$.created || (/* @__PURE__ */ new Date()).getTime() - $.created.getTime() > pe;
@@ -6842,7 +6842,7 @@ function Gr(e, t, n) {
6842
6842
  d,
6843
6843
  y,
6844
6844
  E,
6845
- L,
6845
+ R,
6846
6846
  C,
6847
6847
  K,
6848
6848
  Z,
@@ -6897,11 +6897,11 @@ class zr extends Oe {
6897
6897
  return this.$$.ctx[31];
6898
6898
  }
6899
6899
  }
6900
- function Li(e, t, n = 0, i = e.length - 1, o = Qr) {
6900
+ function Ri(e, t, n = 0, i = e.length - 1, o = Qr) {
6901
6901
  for (; i > n; ) {
6902
6902
  if (i - n > 600) {
6903
6903
  const a = i - n + 1, u = t - n + 1, h = Math.log(a), c = 0.5 * Math.exp(2 * h / 3), d = 0.5 * Math.sqrt(h * c * (a - c) / a) * (u - a / 2 < 0 ? -1 : 1), y = Math.max(n, Math.floor(t - u * c / a + d)), p = Math.min(i, Math.floor(t + (a - u) * c / a + d));
6904
- Li(e, t, y, p, o);
6904
+ Ri(e, t, y, p, o);
6905
6905
  }
6906
6906
  const s = e[t];
6907
6907
  let r = n, l = i;
@@ -7162,7 +7162,7 @@ function ti(e, t, n, i, o) {
7162
7162
  for (; s.length; ) {
7163
7163
  if (n = s.pop(), t = s.pop(), n - t <= i) continue;
7164
7164
  const r = t + Math.ceil((n - t) / i / 2) * i;
7165
- Li(e, r, t, n, o), s.push(t, r, r, n);
7165
+ Ri(e, r, t, n, o), s.push(t, r, r, n);
7166
7166
  }
7167
7167
  }
7168
7168
  const $r = () => {