@annotorious/annotorious 3.0.0-rc.29 → 3.0.0-rc.30

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.
@@ -583,8 +583,8 @@ const Ze = { selected: [] }, Vn = (e, t = "EDIT") => {
583
583
  const g = Array.isArray(f) ? f : [f], m = g.map((y) => e.getAnnotation(y)).filter(Boolean);
584
584
  o({
585
585
  selected: m.map((y) => {
586
- const w = d === void 0 ? Et(y, t) === "EDIT" : d;
587
- return { id: y.id, editable: w };
586
+ const _ = d === void 0 ? Et(y, t) === "EDIT" : d;
587
+ return { id: y.id, editable: _ };
588
588
  })
589
589
  }), m.length !== g.length && console.warn("Invalid selection", f);
590
590
  }, u = (f) => {
@@ -753,7 +753,7 @@ const qn = (e, t) => {
753
753
  }, y = (b, S = H.LOCAL) => {
754
754
  const T = m(b);
755
755
  T && s(S, { deleted: [T] });
756
- }, w = (b, S = H.LOCAL) => {
756
+ }, _ = (b, S = H.LOCAL) => {
757
757
  const T = b.reduce((v, P) => {
758
758
  const G = m(P);
759
759
  return G ? [...v, G] : v;
@@ -781,7 +781,7 @@ const qn = (e, t) => {
781
781
  }, A = (b, S = H.LOCAL) => {
782
782
  const T = p(b);
783
783
  T && s(S, { updated: [T] });
784
- }, _ = (b, S = H.LOCAL) => {
784
+ }, w = (b, S = H.LOCAL) => {
785
785
  const T = b.map((v) => p(v)).filter(Boolean);
786
786
  T.length > 0 && s(S, { updated: T });
787
787
  }, E = (b) => {
@@ -844,8 +844,8 @@ const qn = (e, t) => {
844
844
  addBody: u,
845
845
  all: f,
846
846
  bulkAddAnnotation: g,
847
- bulkDeleteAnnotation: w,
848
- bulkDeleteBodies: _,
847
+ bulkDeleteAnnotation: _,
848
+ bulkDeleteBodies: w,
849
849
  bulkUpdateAnnotation: c,
850
850
  bulkUpdateBodies: R,
851
851
  bulkUpdateTargets: (b, S = H.LOCAL) => {
@@ -896,8 +896,8 @@ const xn = 250, $n = (e) => {
896
896
  if (y - s > xn)
897
897
  n.splice(o + 1), n.push(m), o = n.length - 1;
898
898
  else {
899
- const w = n.length - 1;
900
- n[w] = Kn(n[w], m);
899
+ const _ = n.length - 1;
900
+ n[_] = Kn(n[_], m);
901
901
  }
902
902
  s = y;
903
903
  }
@@ -937,27 +937,27 @@ const xn = 250, $n = (e) => {
937
937
  const d = (p, A) => {
938
938
  a.has(p) ? a.get(p).push(A) : a.set(p, [A]);
939
939
  }, g = (p, A) => {
940
- const _ = a.get(p);
941
- if (_) {
942
- const E = _.indexOf(A);
943
- E !== -1 && _.splice(E, 1);
940
+ const w = a.get(p);
941
+ if (w) {
942
+ const E = w.indexOf(A);
943
+ E !== -1 && w.splice(E, 1);
944
944
  }
945
- }, m = (p, A, _) => {
945
+ }, m = (p, A, w) => {
946
946
  a.has(p) && setTimeout(() => {
947
947
  a.get(p).forEach((E) => {
948
948
  if (n) {
949
- const B = Array.isArray(A) ? A.map((U) => n.serialize(U)) : n.serialize(A), V = _ ? _ instanceof PointerEvent ? _ : n.serialize(_) : void 0;
949
+ const B = Array.isArray(A) ? A.map((U) => n.serialize(U)) : n.serialize(A), V = w ? w instanceof PointerEvent ? w : n.serialize(w) : void 0;
950
950
  E(B, V);
951
951
  } else
952
- E(A, _);
952
+ E(A, w);
953
953
  });
954
954
  }, 1);
955
955
  }, y = () => {
956
- const { selected: p } = s, A = (p || []).map(({ id: _ }) => i.getAnnotation(_));
957
- A.forEach((_) => {
958
- const E = c.find((B) => B.id === _.id);
959
- (!E || !ge(E, _)) && m("updateAnnotation", _, E);
960
- }), c = c.map((_) => A.find(({ id: B }) => B === _.id) || _);
956
+ const { selected: p } = s, A = (p || []).map(({ id: w }) => i.getAnnotation(w));
957
+ A.forEach((w) => {
958
+ const E = c.find((B) => B.id === w.id);
959
+ (!E || !ge(E, w)) && m("updateAnnotation", w, E);
960
+ }), c = c.map((w) => A.find(({ id: B }) => B === w.id) || w);
961
961
  };
962
962
  s.subscribe(({ selected: p }) => {
963
963
  if (!(c.length === 0 && p.length === 0)) {
@@ -965,17 +965,17 @@ const xn = 250, $n = (e) => {
965
965
  c = p.map(({ id: A }) => i.getAnnotation(A));
966
966
  else if (c.length > 0 && p.length === 0)
967
967
  c.forEach((A) => {
968
- const _ = i.getAnnotation(A.id);
969
- _ && !ge(_, A) && m("updateAnnotation", _, A);
968
+ const w = i.getAnnotation(A.id);
969
+ w && !ge(w, A) && m("updateAnnotation", w, A);
970
970
  }), c = [];
971
971
  else {
972
- const A = new Set(c.map((E) => E.id)), _ = new Set(p.map(({ id: E }) => E));
973
- c.filter((E) => !_.has(E.id)).forEach((E) => {
972
+ const A = new Set(c.map((E) => E.id)), w = new Set(p.map(({ id: E }) => E));
973
+ c.filter((E) => !w.has(E.id)).forEach((E) => {
974
974
  const B = i.getAnnotation(E.id);
975
975
  B && !ge(B, E) && m("updateAnnotation", B, E);
976
976
  }), c = [
977
977
  // Remove annotations that were deselected
978
- ...c.filter((E) => _.has(E.id)),
978
+ ...c.filter((E) => w.has(E.id)),
979
979
  // Add editable annotations that were selected
980
980
  ...p.filter(({ id: E }) => !A.has(E)).map(({ id: E }) => i.getAnnotation(E))
981
981
  ];
@@ -986,8 +986,8 @@ const xn = 250, $n = (e) => {
986
986
  !u && p ? m("mouseEnterAnnotation", i.getAnnotation(p)) : u && !p ? m("mouseLeaveAnnotation", i.getAnnotation(u)) : u && p && (m("mouseLeaveAnnotation", i.getAnnotation(u)), m("mouseEnterAnnotation", i.getAnnotation(p))), u = p;
987
987
  }), l == null || l.subscribe((p) => m("viewportIntersect", p.map((A) => i.getAnnotation(A)))), i.observe((p) => {
988
988
  o && (f && clearTimeout(f), f = setTimeout(y, 1e3));
989
- const { created: A, deleted: _ } = p.changes;
990
- (A || []).forEach((E) => m("createAnnotation", E)), (_ || []).forEach((E) => m("deleteAnnotation", E)), (p.changes.updated || []).filter((E) => [
989
+ const { created: A, deleted: w } = p.changes;
990
+ (A || []).forEach((E) => m("createAnnotation", E)), (w || []).forEach((E) => m("deleteAnnotation", E)), (p.changes.updated || []).filter((E) => [
991
991
  ...E.bodiesCreated || [],
992
992
  ...E.bodiesDeleted || [],
993
993
  ...E.bodiesUpdated || []
@@ -997,15 +997,15 @@ const xn = 250, $n = (e) => {
997
997
  });
998
998
  }, { origin: H.LOCAL }), i.observe((p) => {
999
999
  if (c) {
1000
- const A = new Set(c.map((E) => E.id)), _ = (p.changes.updated || []).filter(({ newValue: E }) => A.has(E.id)).map(({ newValue: E }) => E);
1001
- _.length > 0 && (c = c.map((E) => _.find((V) => V.id === E.id) || E));
1000
+ const A = new Set(c.map((E) => E.id)), w = (p.changes.updated || []).filter(({ newValue: E }) => A.has(E.id)).map(({ newValue: E }) => E);
1001
+ w.length > 0 && (c = c.map((E) => w.find((V) => V.id === E.id) || E));
1002
1002
  }
1003
1003
  }, { origin: H.REMOTE });
1004
- const w = (p) => (A) => {
1005
- const { updated: _ } = A;
1006
- p ? (_ || []).forEach((E) => m("updateAnnotation", E.oldValue, E.newValue)) : (_ || []).forEach((E) => m("updateAnnotation", E.newValue, E.oldValue));
1004
+ const _ = (p) => (A) => {
1005
+ const { updated: w } = A;
1006
+ p ? (w || []).forEach((E) => m("updateAnnotation", E.oldValue, E.newValue)) : (w || []).forEach((E) => m("updateAnnotation", E.newValue, E.oldValue));
1007
1007
  };
1008
- return t.on("undo", w(!0)), t.on("redo", w(!1)), { on: d, off: g, emit: m };
1008
+ return t.on("undo", _(!0)), t.on("redo", _(!1)), { on: d, off: g, emit: m };
1009
1009
  }, no = (e) => (t) => t.reduce((n, o) => {
1010
1010
  const { parsed: i, error: s } = e.parse(o);
1011
1011
  return s ? {
@@ -1018,44 +1018,44 @@ const xn = 250, $n = (e) => {
1018
1018
  ...n
1019
1019
  };
1020
1020
  }, { parsed: [], failed: [] }), oo = (e, t, n) => {
1021
- const { store: o, selection: i } = e, s = (w) => {
1021
+ const { store: o, selection: i } = e, s = (_) => {
1022
1022
  if (n) {
1023
- const { parsed: p, error: A } = n.parse(w);
1023
+ const { parsed: p, error: A } = n.parse(_);
1024
1024
  p ? o.addAnnotation(p, H.REMOTE) : console.error(A);
1025
1025
  } else
1026
- o.addAnnotation(w, H.REMOTE);
1027
- }, r = () => i.clear(), l = () => o.clear(), a = (w) => {
1028
- const p = o.getAnnotation(w);
1026
+ o.addAnnotation(_, H.REMOTE);
1027
+ }, r = () => i.clear(), l = () => o.clear(), a = (_) => {
1028
+ const p = o.getAnnotation(_);
1029
1029
  return n && p ? n.serialize(p) : p;
1030
1030
  }, c = () => n ? o.all().map(n.serialize) : o.all(), u = () => {
1031
- var w;
1032
- const p = (((w = i.selected) == null ? void 0 : w.map((A) => A.id)) || []).map((A) => o.getAnnotation(A)).filter(Boolean);
1031
+ var _;
1032
+ const p = (((_ = i.selected) == null ? void 0 : _.map((A) => A.id)) || []).map((A) => o.getAnnotation(A)).filter(Boolean);
1033
1033
  return n ? p.map(n.serialize) : p;
1034
- }, f = (w, p = !0) => fetch(w).then((A) => A.json()).then((A) => (g(A, p), A)), d = (w) => {
1035
- if (typeof w == "string") {
1036
- const p = o.getAnnotation(w);
1037
- if (o.deleteAnnotation(w), p)
1034
+ }, f = (_, p = !0) => fetch(_).then((A) => A.json()).then((A) => (g(A, p), A)), d = (_) => {
1035
+ if (typeof _ == "string") {
1036
+ const p = o.getAnnotation(_);
1037
+ if (o.deleteAnnotation(_), p)
1038
1038
  return n ? n.serialize(p) : p;
1039
1039
  } else {
1040
- const p = n ? n.parse(w).parsed : w;
1040
+ const p = n ? n.parse(_).parsed : _;
1041
1041
  if (p)
1042
- return o.deleteAnnotation(p), w;
1042
+ return o.deleteAnnotation(p), _;
1043
1043
  }
1044
- }, g = (w, p = !0) => {
1044
+ }, g = (_, p = !0) => {
1045
1045
  if (n) {
1046
- const { parsed: A, failed: _ } = no(n)(w);
1047
- _.length > 0 && console.warn(`Discarded ${_.length} invalid annotations`, _), o.bulkAddAnnotation(A, p, H.REMOTE);
1046
+ const { parsed: A, failed: w } = no(n)(_);
1047
+ w.length > 0 && console.warn(`Discarded ${w.length} invalid annotations`, w), o.bulkAddAnnotation(A, p, H.REMOTE);
1048
1048
  } else
1049
- o.bulkAddAnnotation(w, p, H.REMOTE);
1050
- }, m = (w, p) => {
1051
- w ? i.setSelected(w, p) : i.clear();
1052
- }, y = (w) => {
1049
+ o.bulkAddAnnotation(_, p, H.REMOTE);
1050
+ }, m = (_, p) => {
1051
+ _ ? i.setSelected(_, p) : i.clear();
1052
+ }, y = (_) => {
1053
1053
  if (n) {
1054
- const p = n.parse(w).parsed, A = n.serialize(o.getAnnotation(p.id));
1054
+ const p = n.parse(_).parsed, A = n.serialize(o.getAnnotation(p.id));
1055
1055
  return o.updateAnnotation(p), A;
1056
1056
  } else {
1057
- const p = o.getAnnotation(w.id);
1058
- return o.updateAnnotation(w), p;
1057
+ const p = o.getAnnotation(_.id);
1058
+ return o.updateAnnotation(_), p;
1059
1059
  }
1060
1060
  };
1061
1061
  return {
@@ -1256,11 +1256,11 @@ function po(e) {
1256
1256
  ), h(s, "points", r = /*geom*/
1257
1257
  e[4].points.map(vt).join(" "));
1258
1258
  },
1259
- m(y, w) {
1260
- O(y, t, w), O(y, i, w), O(y, s, w), O(y, l, w);
1259
+ m(y, _) {
1260
+ O(y, t, _), O(y, i, _), O(y, s, _), O(y, l, _);
1261
1261
  for (let p = 0; p < g.length; p += 1)
1262
- g[p] && g[p].m(y, w);
1263
- O(y, a, w), c = !0, u || (f = [
1262
+ g[p] && g[p].m(y, _);
1263
+ O(y, a, _), c = !0, u || (f = [
1264
1264
  j(t, "pointerdown", function() {
1265
1265
  K(
1266
1266
  /*grab*/
@@ -1275,20 +1275,20 @@ function po(e) {
1275
1275
  })
1276
1276
  ], u = !0);
1277
1277
  },
1278
- p(y, w) {
1279
- if (e = y, (!c || w & /*computedStyle*/
1278
+ p(y, _) {
1279
+ if (e = y, (!c || _ & /*computedStyle*/
1280
1280
  2 && n !== (n = /*computedStyle*/
1281
- e[1] ? "display:none;" : void 0)) && h(t, "style", n), (!c || w & /*geom*/
1281
+ e[1] ? "display:none;" : void 0)) && h(t, "style", n), (!c || _ & /*geom*/
1282
1282
  16 && o !== (o = /*geom*/
1283
- e[4].points.map(Tt).join(" "))) && h(t, "points", o), (!c || w & /*computedStyle*/
1283
+ e[4].points.map(Tt).join(" "))) && h(t, "points", o), (!c || _ & /*computedStyle*/
1284
1284
  2) && h(
1285
1285
  s,
1286
1286
  "style",
1287
1287
  /*computedStyle*/
1288
1288
  e[1]
1289
- ), (!c || w & /*geom*/
1289
+ ), (!c || _ & /*geom*/
1290
1290
  16 && r !== (r = /*geom*/
1291
- e[4].points.map(vt).join(" "))) && h(s, "points", r), w & /*geom, viewportScale, grab*/
1291
+ e[4].points.map(vt).join(" "))) && h(s, "points", r), _ & /*geom, viewportScale, grab*/
1292
1292
  536) {
1293
1293
  d = Se(
1294
1294
  /*geom*/
@@ -1297,7 +1297,7 @@ function po(e) {
1297
1297
  let p;
1298
1298
  for (p = 0; p < d.length; p += 1) {
1299
1299
  const A = At(e, d, p);
1300
- g[p] ? (g[p].p(A, w), I(g[p], 1)) : (g[p] = St(A), g[p].c(), I(g[p], 1), g[p].m(a.parentNode, a));
1300
+ g[p] ? (g[p].p(A, _), I(g[p], 1)) : (g[p] = St(A), g[p].c(), I(g[p], 1), g[p].m(a.parentNode, a));
1301
1301
  }
1302
1302
  for (le(), p = d.length; p < g.length; p += 1)
1303
1303
  m(p);
@@ -1306,15 +1306,15 @@ function po(e) {
1306
1306
  },
1307
1307
  i(y) {
1308
1308
  if (!c) {
1309
- for (let w = 0; w < d.length; w += 1)
1310
- I(g[w]);
1309
+ for (let _ = 0; _ < d.length; _ += 1)
1310
+ I(g[_]);
1311
1311
  c = !0;
1312
1312
  }
1313
1313
  },
1314
1314
  o(y) {
1315
1315
  g = g.filter(Boolean);
1316
- for (let w = 0; w < g.length; w += 1)
1317
- C(g[w]);
1316
+ for (let _ = 0; _ < g.length; _ += 1)
1317
+ C(g[_]);
1318
1318
  c = !1;
1319
1319
  },
1320
1320
  d(y) {
@@ -1391,8 +1391,8 @@ function _o(e, t, n) {
1391
1391
  let o, { shape: i } = t, { computedStyle: s } = t, { transform: r } = t, { viewportScale: l = 1 } = t;
1392
1392
  const a = (d, g, m) => {
1393
1393
  let y;
1394
- const w = d.geometry;
1395
- g === "SHAPE" ? y = w.points.map(([A, _]) => [A + m[0], _ + m[1]]) : y = w.points.map(([A, _], E) => g === `HANDLE-${E}` ? [A + m[0], _ + m[1]] : [A, _]);
1394
+ const _ = d.geometry;
1395
+ g === "SHAPE" ? y = _.points.map(([A, w]) => [A + m[0], w + m[1]]) : y = _.points.map(([A, w], E) => g === `HANDLE-${E}` ? [A + m[0], w + m[1]] : [A, w]);
1396
1396
  const p = Fe(y);
1397
1397
  return { ...d, geometry: { points: y, bounds: p } };
1398
1398
  };
@@ -1733,7 +1733,7 @@ class ke extends oe {
1733
1733
  }
1734
1734
  }
1735
1735
  function ko(e) {
1736
- let t, n, o, i, s, r, l, a, c, u, f, d, g, m, y, w, p, A, _, E, B, V, U, R, Y, b, S, T, v, P, G, x, ve, se, Me, L, Q, z, ue, Z, N, qe, ht;
1736
+ let t, n, o, i, s, r, l, a, c, u, f, d, g, m, y, _, p, A, w, E, B, V, U, R, Y, b, S, T, v, P, G, x, ve, se, Me, L, Q, z, ue, Z, N, qe, ht;
1737
1737
  return se = new ke({
1738
1738
  props: {
1739
1739
  class: "a9s-corner-handle-topleft",
@@ -1824,7 +1824,7 @@ function ko(e) {
1824
1824
  ) && e[9]("BOTTOM_LEFT").apply(this, arguments);
1825
1825
  }), {
1826
1826
  c() {
1827
- t = X("rect"), l = ie(), a = X("rect"), g = ie(), m = X("rect"), A = ie(), _ = X("rect"), U = ie(), R = X("rect"), T = ie(), v = X("rect"), ve = ie(), te(se.$$.fragment), Me = ie(), te(L.$$.fragment), Q = ie(), te(z.$$.fragment), ue = ie(), te(Z.$$.fragment), h(t, "class", "a9s-outer"), h(t, "style", n = /*computedStyle*/
1827
+ t = X("rect"), l = ie(), a = X("rect"), g = ie(), m = X("rect"), A = ie(), w = X("rect"), U = ie(), R = X("rect"), T = ie(), v = X("rect"), ve = ie(), te(se.$$.fragment), Me = ie(), te(L.$$.fragment), Q = ie(), te(z.$$.fragment), ue = ie(), te(Z.$$.fragment), h(t, "class", "a9s-outer"), h(t, "style", n = /*computedStyle*/
1828
1828
  e[1] ? "display:none;" : void 0), h(t, "x", o = /*geom*/
1829
1829
  e[4].x), h(t, "y", i = /*geom*/
1830
1830
  e[4].y), h(t, "width", s = /*geom*/
@@ -1839,13 +1839,13 @@ function ko(e) {
1839
1839
  e[4].y), h(a, "width", f = /*geom*/
1840
1840
  e[4].w), h(a, "height", d = /*geom*/
1841
1841
  e[4].h), h(m, "class", "a9s-edge-handle a9s-edge-handle-top"), h(m, "x", y = /*geom*/
1842
- e[4].x), h(m, "y", w = /*geom*/
1842
+ e[4].x), h(m, "y", _ = /*geom*/
1843
1843
  e[4].y), h(m, "height", 1), h(m, "width", p = /*geom*/
1844
- e[4].w), h(_, "class", "a9s-edge-handle a9s-edge-handle-right"), h(_, "x", E = /*geom*/
1844
+ e[4].w), h(w, "class", "a9s-edge-handle a9s-edge-handle-right"), h(w, "x", E = /*geom*/
1845
1845
  e[4].x + /*geom*/
1846
- e[4].w), h(_, "y", B = /*geom*/
1847
- e[4].y), h(_, "height", V = /*geom*/
1848
- e[4].h), h(_, "width", 1), h(R, "class", "a9s-edge-handle a9s-edge-handle-bottom"), h(R, "x", Y = /*geom*/
1846
+ e[4].w), h(w, "y", B = /*geom*/
1847
+ e[4].y), h(w, "height", V = /*geom*/
1848
+ e[4].h), h(w, "width", 1), h(R, "class", "a9s-edge-handle a9s-edge-handle-bottom"), h(R, "x", Y = /*geom*/
1849
1849
  e[4].x), h(R, "y", b = /*geom*/
1850
1850
  e[4].y + /*geom*/
1851
1851
  e[4].h), h(R, "height", 1), h(R, "width", S = /*geom*/
@@ -1855,7 +1855,7 @@ function ko(e) {
1855
1855
  e[4].h), h(v, "width", 1);
1856
1856
  },
1857
1857
  m(D, M) {
1858
- O(D, t, M), O(D, l, M), O(D, a, M), O(D, g, M), O(D, m, M), O(D, A, M), O(D, _, M), O(D, U, M), O(D, R, M), O(D, T, M), O(D, v, M), O(D, ve, M), $(se, D, M), O(D, Me, M), $(L, D, M), O(D, Q, M), $(z, D, M), O(D, ue, M), $(Z, D, M), N = !0, qe || (ht = [
1858
+ O(D, t, M), O(D, l, M), O(D, a, M), O(D, g, M), O(D, m, M), O(D, A, M), O(D, w, M), O(D, U, M), O(D, R, M), O(D, T, M), O(D, v, M), O(D, ve, M), $(se, D, M), O(D, Me, M), $(L, D, M), O(D, Q, M), $(z, D, M), O(D, ue, M), $(Z, D, M), N = !0, qe || (ht = [
1859
1859
  j(t, "pointerdown", function() {
1860
1860
  K(
1861
1861
  /*grab*/
@@ -1874,7 +1874,7 @@ function ko(e) {
1874
1874
  e[9]("TOP")
1875
1875
  ) && e[9]("TOP").apply(this, arguments);
1876
1876
  }),
1877
- j(_, "pointerdown", function() {
1877
+ j(w, "pointerdown", function() {
1878
1878
  K(
1879
1879
  /*grab*/
1880
1880
  e[9]("RIGHT")
@@ -1922,17 +1922,17 @@ function ko(e) {
1922
1922
  e[4].h)) && h(a, "height", d), (!N || M & /*geom*/
1923
1923
  16 && y !== (y = /*geom*/
1924
1924
  e[4].x)) && h(m, "x", y), (!N || M & /*geom*/
1925
- 16 && w !== (w = /*geom*/
1926
- e[4].y)) && h(m, "y", w), (!N || M & /*geom*/
1925
+ 16 && _ !== (_ = /*geom*/
1926
+ e[4].y)) && h(m, "y", _), (!N || M & /*geom*/
1927
1927
  16 && p !== (p = /*geom*/
1928
1928
  e[4].w)) && h(m, "width", p), (!N || M & /*geom*/
1929
1929
  16 && E !== (E = /*geom*/
1930
1930
  e[4].x + /*geom*/
1931
- e[4].w)) && h(_, "x", E), (!N || M & /*geom*/
1931
+ e[4].w)) && h(w, "x", E), (!N || M & /*geom*/
1932
1932
  16 && B !== (B = /*geom*/
1933
- e[4].y)) && h(_, "y", B), (!N || M & /*geom*/
1933
+ e[4].y)) && h(w, "y", B), (!N || M & /*geom*/
1934
1934
  16 && V !== (V = /*geom*/
1935
- e[4].h)) && h(_, "height", V), (!N || M & /*geom*/
1935
+ e[4].h)) && h(w, "height", V), (!N || M & /*geom*/
1936
1936
  16 && Y !== (Y = /*geom*/
1937
1937
  e[4].x)) && h(R, "x", Y), (!N || M & /*geom*/
1938
1938
  16 && b !== (b = /*geom*/
@@ -1990,7 +1990,7 @@ function ko(e) {
1990
1990
  C(se.$$.fragment, D), C(L.$$.fragment, D), C(z.$$.fragment, D), C(Z.$$.fragment, D), N = !1;
1991
1991
  },
1992
1992
  d(D) {
1993
- D && (k(t), k(l), k(a), k(g), k(m), k(A), k(_), k(U), k(R), k(T), k(v), k(ve), k(Me), k(Q), k(ue)), ee(se, D), ee(L, D), ee(z, D), ee(Z, D), qe = !1, ce(ht);
1993
+ D && (k(t), k(l), k(a), k(g), k(m), k(A), k(w), k(U), k(R), k(T), k(v), k(ve), k(Me), k(Q), k(ue)), ee(se, D), ee(L, D), ee(z, D), ee(Z, D), qe = !1, ce(ht);
1994
1994
  }
1995
1995
  };
1996
1996
  }
@@ -2062,10 +2062,10 @@ function Bo(e, t, n) {
2062
2062
  let o, { shape: i } = t, { computedStyle: s } = t, { transform: r } = t, { viewportScale: l = 1 } = t;
2063
2063
  const a = (d, g, m) => {
2064
2064
  const y = d.geometry.bounds;
2065
- let [w, p] = [y.minX, y.minY], [A, _] = [y.maxX, y.maxY];
2065
+ let [_, p] = [y.minX, y.minY], [A, w] = [y.maxX, y.maxY];
2066
2066
  const [E, B] = m;
2067
2067
  if (g === "SHAPE")
2068
- w += E, A += E, p += B, _ += B;
2068
+ _ += E, A += E, p += B, w += B;
2069
2069
  else {
2070
2070
  switch (g) {
2071
2071
  case "TOP":
@@ -2077,7 +2077,7 @@ function Bo(e, t, n) {
2077
2077
  case "BOTTOM":
2078
2078
  case "BOTTOM_LEFT":
2079
2079
  case "BOTTOM_RIGHT": {
2080
- _ += B;
2080
+ w += B;
2081
2081
  break;
2082
2082
  }
2083
2083
  }
@@ -2085,7 +2085,7 @@ function Bo(e, t, n) {
2085
2085
  case "LEFT":
2086
2086
  case "TOP_LEFT":
2087
2087
  case "BOTTOM_LEFT": {
2088
- w += E;
2088
+ _ += E;
2089
2089
  break;
2090
2090
  }
2091
2091
  case "RIGHT":
@@ -2096,7 +2096,7 @@ function Bo(e, t, n) {
2096
2096
  }
2097
2097
  }
2098
2098
  }
2099
- const V = Math.min(w, A), U = Math.min(p, _), R = Math.abs(A - w), Y = Math.abs(_ - p);
2099
+ const V = Math.min(_, A), U = Math.min(p, w), R = Math.abs(A - _), Y = Math.abs(w - p);
2100
2100
  return {
2101
2101
  ...d,
2102
2102
  geometry: {
@@ -2224,11 +2224,11 @@ function Xo(e, t, n) {
2224
2224
  let { $$slots: o = {}, $$scope: i } = t;
2225
2225
  const s = Te();
2226
2226
  let { shape: r } = t, { editor: l } = t, { transform: a } = t, c, u, f;
2227
- const d = (y) => (w) => {
2228
- c = y, u = a.elementToImage(w.offsetX, w.offsetY), f = r, w.target.setPointerCapture(w.pointerId), s("grab", w);
2227
+ const d = (y) => (_) => {
2228
+ c = y, u = a.elementToImage(_.offsetX, _.offsetY), f = r, _.target.setPointerCapture(_.pointerId), s("grab", _);
2229
2229
  }, g = (y) => {
2230
2230
  if (c) {
2231
- const [w, p] = a.elementToImage(y.offsetX, y.offsetY), A = [w - u[0], p - u[1]];
2231
+ const [_, p] = a.elementToImage(y.offsetX, y.offsetY), A = [_ - u[0], p - u[1]];
2232
2232
  n(3, r = l(f, c, A)), s("change", r);
2233
2233
  }
2234
2234
  }, m = (y) => {
@@ -2458,17 +2458,17 @@ function zo(e, t, n) {
2458
2458
  const o = Te();
2459
2459
  let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, l, a, c, u, f, d, g;
2460
2460
  const m = (A) => {
2461
- const _ = A;
2462
- l = performance.now(), s === "drag" && (n(0, a = r.elementToImage(_.offsetX, _.offsetY)), c = a, n(1, u = a[0]), n(2, f = a[1]), n(3, d = 1), n(4, g = 1));
2461
+ const w = A;
2462
+ l = performance.now(), s === "drag" && (n(0, a = r.elementToImage(w.offsetX, w.offsetY)), c = a, n(1, u = a[0]), n(2, f = a[1]), n(3, d = 1), n(4, g = 1));
2463
2463
  }, y = (A) => {
2464
- const _ = A;
2465
- a && (c = r.elementToImage(_.offsetX, _.offsetY), n(1, u = Math.min(c[0], a[0])), n(2, f = Math.min(c[1], a[1])), n(3, d = Math.abs(c[0] - a[0])), n(4, g = Math.abs(c[1] - a[1])));
2466
- }, w = (A) => {
2467
- const _ = A, E = performance.now() - l;
2464
+ const w = A;
2465
+ a && (c = r.elementToImage(w.offsetX, w.offsetY), n(1, u = Math.min(c[0], a[0])), n(2, f = Math.min(c[1], a[1])), n(3, d = Math.abs(c[0] - a[0])), n(4, g = Math.abs(c[1] - a[1])));
2466
+ }, _ = (A) => {
2467
+ const w = A, E = performance.now() - l;
2468
2468
  if (s === "click") {
2469
2469
  if (E > 300) return;
2470
- _.stopPropagation(), a ? p() : (n(0, a = r.elementToImage(_.offsetX, _.offsetY)), c = a, n(1, u = a[0]), n(2, f = a[1]), n(3, d = 1), n(4, g = 1));
2471
- } else a && (E > 300 || d * g > 100 ? (_.stopPropagation(), p()) : (n(0, a = void 0), c = void 0));
2470
+ a ? p() : (n(0, a = r.elementToImage(w.offsetX, w.offsetY)), c = a, n(1, u = a[0]), n(2, f = a[1]), n(3, d = 1), n(4, g = 1));
2471
+ } else a && (E > 300 || d * g > 100 ? (w.stopPropagation(), p()) : (n(0, a = void 0), c = void 0));
2472
2472
  }, p = () => {
2473
2473
  if (d * g > 15) {
2474
2474
  const A = {
@@ -2491,7 +2491,7 @@ function zo(e, t, n) {
2491
2491
  n(0, a = void 0), c = void 0;
2492
2492
  };
2493
2493
  return Ye(() => {
2494
- i("pointerdown", m), i("pointermove", y), i("pointerup", w, !0);
2494
+ i("pointerdown", m), i("pointermove", y), i("pointerup", _, !0);
2495
2495
  }), e.$$set = (A) => {
2496
2496
  "addEventListener" in A && n(5, i = A.addEventListener), "drawingMode" in A && n(6, s = A.drawingMode), "transform" in A && n(7, r = A.transform);
2497
2497
  }, [a, u, f, d, g, i, s, r];
@@ -2624,14 +2624,14 @@ function Ko(e, t, n) {
2624
2624
  let o;
2625
2625
  const i = Te();
2626
2626
  let { addEventListener: s } = t, { drawingMode: r } = t, { transform: l } = t, { viewportScale: a = 1 } = t, c, u = [], f, d, g = !1;
2627
- const m = (_) => {
2628
- const E = _, { timeStamp: B, offsetX: V, offsetY: U } = E;
2627
+ const m = (w) => {
2628
+ const E = w, { timeStamp: B, offsetX: V, offsetY: U } = E;
2629
2629
  if (c = { timeStamp: B, offsetX: V, offsetY: U }, r === "drag" && u.length === 0) {
2630
2630
  const R = l.elementToImage(E.offsetX, E.offsetY);
2631
2631
  u.push(R), n(1, f = R);
2632
2632
  }
2633
- }, y = (_) => {
2634
- const E = _;
2633
+ }, y = (w) => {
2634
+ const E = w;
2635
2635
  if (d && clearTimeout(d), u.length > 0) {
2636
2636
  if (n(1, f = l.elementToImage(E.offsetX, E.offsetY)), u.length > 2) {
2637
2637
  const B = $e(f, u[0]) * a;
@@ -2644,8 +2644,8 @@ function Ko(e, t, n) {
2644
2644
  qo
2645
2645
  ));
2646
2646
  }
2647
- }, w = (_) => {
2648
- const E = _;
2647
+ }, _ = (w) => {
2648
+ const E = w;
2649
2649
  if (d && clearTimeout(d), r === "click") {
2650
2650
  const B = E.timeStamp - c.timeStamp, V = $e([c.offsetX, c.offsetY], [E.offsetX, E.offsetY]);
2651
2651
  if (B > 300 || V > 15) return;
@@ -2665,25 +2665,25 @@ function Ko(e, t, n) {
2665
2665
  }
2666
2666
  }, p = () => {
2667
2667
  if (!f) return;
2668
- const _ = [...u, f], E = {
2668
+ const w = [...u, f], E = {
2669
2669
  type: q.POLYGON,
2670
- geometry: { bounds: Fe(_), points: _ }
2670
+ geometry: { bounds: Fe(w), points: w }
2671
2671
  };
2672
2672
  lt(E) > 4 && (n(0, u = []), n(1, f = void 0), i("create", E));
2673
2673
  }, A = () => {
2674
- const _ = {
2674
+ const w = {
2675
2675
  type: q.POLYGON,
2676
2676
  geometry: {
2677
2677
  bounds: Fe(u),
2678
2678
  points: [...u]
2679
2679
  }
2680
2680
  };
2681
- n(0, u = []), n(1, f = void 0), i("create", _);
2681
+ n(0, u = []), n(1, f = void 0), i("create", w);
2682
2682
  };
2683
2683
  return Ye(() => {
2684
- s("pointerdown", m, !0), s("pointermove", y), s("pointerup", w, !0), s("dblclick", p, !0);
2685
- }), e.$$set = (_) => {
2686
- "addEventListener" in _ && n(4, s = _.addEventListener), "drawingMode" in _ && n(5, r = _.drawingMode), "transform" in _ && n(6, l = _.transform), "viewportScale" in _ && n(7, a = _.viewportScale);
2684
+ s("pointerdown", m, !0), s("pointermove", y), s("pointerup", _, !0), s("dblclick", p, !0);
2685
+ }), e.$$set = (w) => {
2686
+ "addEventListener" in w && n(4, s = w.addEventListener), "drawingMode" in w && n(5, r = w.drawingMode), "transform" in w && n(6, l = w.transform), "viewportScale" in w && n(7, a = w.viewportScale);
2687
2687
  }, e.$$.update = () => {
2688
2688
  e.$$.dirty & /*viewportScale*/
2689
2689
  128 && n(3, o = 10 / a);
@@ -3666,8 +3666,8 @@ function pi(e) {
3666
3666
  function yi(e, t, n) {
3667
3667
  let o, i, s, r, l, a, c, u, f, d, g = F, m = () => (g(), g = Ht(Y, (L) => n(15, d = L)), Y);
3668
3668
  e.$$.on_destroy.push(() => g());
3669
- let { drawingEnabled: y } = t, { image: w } = t, { preferredDrawingMode: p } = t, { state: A } = t, { style: _ = void 0 } = t, { toolName: E = tn()[0] } = t, { user: B } = t, { visible: V = !0 } = t, U, R, Y;
3670
- Ye(() => m(n(6, Y = Ao(w, R))));
3669
+ let { drawingEnabled: y } = t, { image: _ } = t, { preferredDrawingMode: p } = t, { state: A } = t, { style: w = void 0 } = t, { toolName: E = tn()[0] } = t, { user: B } = t, { visible: V = !0 } = t, U, R, Y;
3670
+ Ye(() => m(n(6, Y = Ao(_, R))));
3671
3671
  const { selection: b, store: S } = A;
3672
3672
  mt(e, b, (L) => n(26, u = L)), mt(e, S, (L) => n(14, f = L));
3673
3673
  let T, v;
@@ -3712,7 +3712,7 @@ function yi(e, t, n) {
3712
3712
  });
3713
3713
  }
3714
3714
  return e.$$set = (L) => {
3715
- "drawingEnabled" in L && n(0, y = L.drawingEnabled), "image" in L && n(21, w = L.image), "preferredDrawingMode" in L && n(22, p = L.preferredDrawingMode), "state" in L && n(23, A = L.state), "style" in L && n(1, _ = L.style), "toolName" in L && n(2, E = L.toolName), "user" in L && n(24, B = L.user), "visible" in L && n(3, V = L.visible);
3715
+ "drawingEnabled" in L && n(0, y = L.drawingEnabled), "image" in L && n(21, _ = L.image), "preferredDrawingMode" in L && n(22, p = L.preferredDrawingMode), "state" in L && n(23, A = L.state), "style" in L && n(1, w = L.style), "toolName" in L && n(2, E = L.toolName), "user" in L && n(24, B = L.user), "visible" in L && n(3, V = L.visible);
3716
3716
  }, e.$$.update = () => {
3717
3717
  e.$$.dirty[0] & /*toolName*/
3718
3718
  4 && n(13, { tool: o, opts: i } = nn(E) || { tool: void 0, opts: void 0 }, o, (n(25, i), n(2, E))), e.$$.dirty[0] & /*opts, preferredDrawingMode*/
@@ -3723,7 +3723,7 @@ function yi(e, t, n) {
3723
3723
  67108864 && P(u.selected);
3724
3724
  }, [
3725
3725
  y,
3726
- _,
3726
+ w,
3727
3727
  E,
3728
3728
  V,
3729
3729
  R,
@@ -3743,7 +3743,7 @@ function yi(e, t, n) {
3743
3743
  G,
3744
3744
  x,
3745
3745
  ve,
3746
- w,
3746
+ _,
3747
3747
  p,
3748
3748
  A,
3749
3749
  B,
@@ -4050,8 +4050,8 @@ const Li = () => {
4050
4050
  const e = new Ei(), t = /* @__PURE__ */ new Map(), n = () => [...t.values()], o = () => {
4051
4051
  e.clear(), t.clear();
4052
4052
  }, i = (f) => {
4053
- const { minX: d, minY: g, maxX: m, maxY: y } = f.selector.geometry.bounds, w = { minX: d, minY: g, maxX: m, maxY: y, target: f };
4054
- e.insert(w), t.set(f.annotation, w);
4053
+ const { minX: d, minY: g, maxX: m, maxY: y } = f.selector.geometry.bounds, _ = { minX: d, minY: g, maxX: m, maxY: y, target: f };
4054
+ e.insert(_), t.set(f.annotation, _);
4055
4055
  }, s = (f) => {
4056
4056
  const d = t.get(f.annotation);
4057
4057
  d && e.remove(d), t.delete(f.annotation);
@@ -4067,7 +4067,7 @@ const Li = () => {
4067
4067
  maxY: d
4068
4068
  }).map((y) => y.target).filter((y) => y.selector.type === q.RECTANGLE || An(y.selector, f, d));
4069
4069
  if (m.length > 0)
4070
- return m.sort((y, w) => lt(y.selector) - lt(w.selector)), m[0];
4070
+ return m.sort((y, _) => lt(y.selector) - lt(_.selector)), m[0];
4071
4071
  },
4072
4072
  getIntersecting: (f, d, g, m) => e.search({
4073
4073
  minX: f,
@@ -4080,8 +4080,8 @@ const Li = () => {
4080
4080
  set: (f, d = !0) => {
4081
4081
  d && o();
4082
4082
  const g = f.map((m) => {
4083
- const { minX: y, minY: w, maxX: p, maxY: A } = m.selector.geometry.bounds;
4084
- return { minX: y, minY: w, maxX: p, maxY: A, target: m };
4083
+ const { minX: y, minY: _, maxX: p, maxY: A } = m.selector.geometry.bounds;
4084
+ return { minX: y, minY: _, maxX: p, maxY: A, target: m };
4085
4085
  });
4086
4086
  g.forEach((m) => t.set(m.target.annotation, m)), e.load(g);
4087
4087
  },
@@ -4185,11 +4185,11 @@ const Li = () => {
4185
4185
  });
4186
4186
  const g = oo(i, l, o.adapter), m = () => {
4187
4187
  d.$destroy(), c.parentNode.insertBefore(n, c), c.parentNode.removeChild(c), u.destroy(), l.destroy();
4188
- }, y = () => f, w = (Y, b, S) => Jo(Y, b, S), p = (Y, b) => Yo(Y, b), A = (Y) => {
4188
+ }, y = () => f, _ = (Y, b, S) => Jo(Y, b, S), p = (Y, b) => Yo(Y, b), A = (Y) => {
4189
4189
  if (!nn(Y))
4190
4190
  throw `No drawing tool named ${Y}`;
4191
4191
  d.$set({ toolName: Y });
4192
- }, _ = (Y) => d.$set({ drawingEnabled: Y }), E = (Y) => {
4192
+ }, w = (Y) => d.$set({ drawingEnabled: Y }), E = (Y) => {
4193
4193
  console.warn("Filter not implemented yet");
4194
4194
  }, B = (Y) => d.$set({ style: Y }), V = (Y) => Vt(n, c, Y), U = (Y) => {
4195
4195
  f = Y, d.$set({ user: Y });
@@ -4204,9 +4204,9 @@ const Li = () => {
4204
4204
  listDrawingTools: tn,
4205
4205
  on: a.on,
4206
4206
  off: a.off,
4207
- registerDrawingTool: w,
4207
+ registerDrawingTool: _,
4208
4208
  registerShapeEditor: p,
4209
- setDrawingEnabled: _,
4209
+ setDrawingEnabled: w,
4210
4210
  setDrawingTool: A,
4211
4211
  setFilter: E,
4212
4212
  setStyle: B,