@annotorious/annotorious 3.0.0-rc.21 → 3.0.0-rc.23

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.
Files changed (40) hide show
  1. package/dist/Annotorious.d.ts +7 -10
  2. package/dist/Annotorious.d.ts.map +1 -1
  3. package/dist/AnnotoriousOpts.d.ts +3 -2
  4. package/dist/annotation/SVGAnnotationLayerPointerEvent.d.ts +3 -2
  5. package/dist/annotation/editors/editorsRegistry.d.ts +3 -2
  6. package/dist/annotation/tools/DrawingToolConfig.d.ts +2 -1
  7. package/dist/annotation/tools/drawingToolsRegistry.d.ts +3 -2
  8. package/dist/annotation/utils/responsive.d.ts +1 -1
  9. package/dist/annotation/utils/styling.d.ts +4 -3
  10. package/dist/annotation/utils/styling.d.ts.map +1 -1
  11. package/dist/annotorious.css +1 -1
  12. package/dist/annotorious.es.js +1082 -1079
  13. package/dist/annotorious.es.js.map +1 -1
  14. package/dist/annotorious.js +1 -1
  15. package/dist/annotorious.js.map +1 -1
  16. package/dist/keyboardCommands.d.ts +2 -1
  17. package/dist/model/core/ImageAnnotation.d.ts +3 -2
  18. package/dist/model/core/Shape.d.ts +2 -1
  19. package/dist/model/core/ellipse/Ellipse.d.ts +2 -1
  20. package/dist/model/core/polygon/Polygon.d.ts +2 -1
  21. package/dist/model/core/rectangle/Rectangle.d.ts +2 -1
  22. package/dist/model/core/rectangle/rectangleUtils.d.ts +3 -2
  23. package/dist/model/core/shapeUtils.d.ts +2 -1
  24. package/dist/model/w3c/W3CImageAnnotation.d.ts +4 -3
  25. package/dist/model/w3c/W3CImageFormatAdapter.d.ts +4 -3
  26. package/dist/model/w3c/fragment/FragmentSelector.d.ts +2 -1
  27. package/dist/model/w3c/svg/SVGSelector.d.ts +2 -1
  28. package/dist/state/ImageAnnotationStore.d.ts +3 -2
  29. package/dist/state/ImageAnnotatorState.d.ts +5 -4
  30. package/dist/state/spatialTree.d.ts +2 -1
  31. package/dist/themes/smart/setTheme.d.ts +2 -1
  32. package/package.json +11 -11
  33. package/src/Annotorious.css +4 -0
  34. package/src/Annotorious.ts +8 -2
  35. package/src/annotation/SVGAnnotationLayer.svelte +4 -2
  36. package/src/annotation/editors/EditorMount.svelte +2 -2
  37. package/src/annotation/shapes/Ellipse.svelte +2 -2
  38. package/src/annotation/shapes/Polygon.svelte +2 -2
  39. package/src/annotation/shapes/Rectangle.svelte +2 -2
  40. package/src/annotation/utils/styling.ts +5 -2
@@ -1,7 +1,7 @@
1
1
  var nn = Object.defineProperty;
2
2
  var on = (e, t, n) => t in e ? nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Ke = (e, t, n) => (on(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- function V() {
4
+ function G() {
5
5
  }
6
6
  function nt(e, t) {
7
7
  for (const n in t)
@@ -17,13 +17,13 @@ function Nt(e) {
17
17
  function dt() {
18
18
  return /* @__PURE__ */ Object.create(null);
19
19
  }
20
- function ae(e) {
20
+ function le(e) {
21
21
  e.forEach(Nt);
22
22
  }
23
- function q(e) {
23
+ function j(e) {
24
24
  return typeof e == "function";
25
25
  }
26
- function W(e, t) {
26
+ function K(e, t) {
27
27
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
28
28
  }
29
29
  function sn(e) {
@@ -33,7 +33,7 @@ function Vt(e, ...t) {
33
33
  if (e == null) {
34
34
  for (const o of t)
35
35
  o(void 0);
36
- return V;
36
+ return G;
37
37
  }
38
38
  const n = e.subscribe(...t);
39
39
  return n.unsubscribe ? () => n.unsubscribe() : n;
@@ -86,63 +86,63 @@ function gt(e) {
86
86
  n[0] !== "$" && (t[n] = e[n]);
87
87
  return t;
88
88
  }
89
- function Ge(e) {
89
+ function ze(e) {
90
90
  return e ?? "";
91
91
  }
92
92
  const fn = typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : (
93
93
  // @ts-ignore Node typings have this
94
94
  global
95
95
  );
96
- function se(e, t) {
96
+ function ie(e, t) {
97
97
  e.appendChild(t);
98
98
  }
99
- function O(e, t, n) {
99
+ function B(e, t, n) {
100
100
  e.insertBefore(t, n || null);
101
101
  }
102
- function L(e) {
102
+ function k(e) {
103
103
  e.parentNode && e.parentNode.removeChild(e);
104
104
  }
105
105
  function rt(e, t) {
106
106
  for (let n = 0; n < e.length; n += 1)
107
107
  e[n] && e[n].d(t);
108
108
  }
109
- function R(e) {
109
+ function X(e) {
110
110
  return document.createElementNS("http://www.w3.org/2000/svg", e);
111
111
  }
112
112
  function zt(e) {
113
113
  return document.createTextNode(e);
114
114
  }
115
- function oe() {
115
+ function ne() {
116
116
  return zt(" ");
117
117
  }
118
- function ce() {
118
+ function ae() {
119
119
  return zt("");
120
120
  }
121
- function F(e, t, n, o) {
121
+ function H(e, t, n, o) {
122
122
  return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
123
123
  }
124
- function d(e, t, n) {
124
+ function h(e, t, n) {
125
125
  n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
126
126
  }
127
127
  function un(e) {
128
128
  return Array.from(e.childNodes);
129
129
  }
130
- function ze(e, t, n) {
130
+ function Ee(e, t, n) {
131
131
  e.classList.toggle(t, !!n);
132
132
  }
133
133
  function dn(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
134
134
  return new CustomEvent(e, { detail: t, bubbles: n, cancelable: o });
135
135
  }
136
- let Ie;
137
- function Be(e) {
138
- Ie = e;
136
+ let Pe;
137
+ function Ie(e) {
138
+ Pe = e;
139
139
  }
140
140
  function Ht() {
141
- if (!Ie)
141
+ if (!Pe)
142
142
  throw new Error("Function called outside component initialization");
143
- return Ie;
143
+ return Pe;
144
144
  }
145
- function Pe(e) {
145
+ function Ye(e) {
146
146
  Ht().$$.on_mount.push(e);
147
147
  }
148
148
  function Te() {
@@ -163,11 +163,11 @@ function Te() {
163
163
  return !0;
164
164
  };
165
165
  }
166
- function ue(e, t) {
166
+ function fe(e, t) {
167
167
  const n = e.$$.callbacks[t.type];
168
168
  n && n.slice().forEach((o) => o.call(this, t));
169
169
  }
170
- const be = [], He = [];
170
+ const we = [], He = [];
171
171
  let Ae = [];
172
172
  const mt = [], hn = /* @__PURE__ */ Promise.resolve();
173
173
  let ot = !1;
@@ -178,35 +178,35 @@ function it(e) {
178
178
  Ae.push(e);
179
179
  }
180
180
  const We = /* @__PURE__ */ new Set();
181
- let pe = 0;
181
+ let me = 0;
182
182
  function Ft() {
183
- if (pe !== 0)
183
+ if (me !== 0)
184
184
  return;
185
- const e = Ie;
185
+ const e = Pe;
186
186
  do {
187
187
  try {
188
- for (; pe < be.length; ) {
189
- const t = be[pe];
190
- pe++, Be(t), mn(t.$$);
188
+ for (; me < we.length; ) {
189
+ const t = we[me];
190
+ me++, Ie(t), mn(t.$$);
191
191
  }
192
192
  } catch (t) {
193
- throw be.length = 0, pe = 0, t;
193
+ throw we.length = 0, me = 0, t;
194
194
  }
195
- for (Be(null), be.length = 0, pe = 0; He.length; )
195
+ for (Ie(null), we.length = 0, me = 0; He.length; )
196
196
  He.pop()();
197
197
  for (let t = 0; t < Ae.length; t += 1) {
198
198
  const n = Ae[t];
199
199
  We.has(n) || (We.add(n), n());
200
200
  }
201
201
  Ae.length = 0;
202
- } while (be.length);
202
+ } while (we.length);
203
203
  for (; mt.length; )
204
204
  mt.pop()();
205
- ot = !1, We.clear(), Be(e);
205
+ ot = !1, We.clear(), Ie(e);
206
206
  }
207
207
  function mn(e) {
208
208
  if (e.fragment !== null) {
209
- e.update(), ae(e.before_update);
209
+ e.update(), le(e.before_update);
210
210
  const t = e.dirty;
211
211
  e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(it);
212
212
  }
@@ -215,28 +215,28 @@ function pn(e) {
215
215
  const t = [], n = [];
216
216
  Ae.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Ae = t;
217
217
  }
218
- const Ve = /* @__PURE__ */ new Set();
219
- let de;
220
- function re() {
221
- de = {
218
+ const Ge = /* @__PURE__ */ new Set();
219
+ let ue;
220
+ function se() {
221
+ ue = {
222
222
  r: 0,
223
223
  c: [],
224
- p: de
224
+ p: ue
225
225
  // parent group
226
226
  };
227
227
  }
228
- function le() {
229
- de.r || ae(de.c), de = de.p;
228
+ function re() {
229
+ ue.r || le(ue.c), ue = ue.p;
230
230
  }
231
231
  function P(e, t) {
232
- e && e.i && (Ve.delete(e), e.i(t));
232
+ e && e.i && (Ge.delete(e), e.i(t));
233
233
  }
234
234
  function D(e, t, n, o) {
235
235
  if (e && e.o) {
236
- if (Ve.has(e))
236
+ if (Ge.has(e))
237
237
  return;
238
- Ve.add(e), de.c.push(() => {
239
- Ve.delete(e), o && (n && e.d(1), o());
238
+ Ge.add(e), ue.c.push(() => {
239
+ Ge.delete(e), o && (n && e.d(1), o());
240
240
  }), e.o(t);
241
241
  } else
242
242
  o && o();
@@ -250,26 +250,26 @@ function $(e) {
250
250
  function Q(e, t, n) {
251
251
  const { fragment: o, after_update: i } = e.$$;
252
252
  o && o.m(t, n), it(() => {
253
- const s = e.$$.on_mount.map(Nt).filter(q);
254
- e.$$.on_destroy ? e.$$.on_destroy.push(...s) : ae(s), e.$$.on_mount = [];
253
+ const s = e.$$.on_mount.map(Nt).filter(j);
254
+ e.$$.on_destroy ? e.$$.on_destroy.push(...s) : le(s), e.$$.on_mount = [];
255
255
  }), i.forEach(it);
256
256
  }
257
257
  function x(e, t) {
258
258
  const n = e.$$;
259
- n.fragment !== null && (pn(n.after_update), ae(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
259
+ n.fragment !== null && (pn(n.after_update), le(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
260
260
  }
261
261
  function yn(e, t) {
262
- e.$$.dirty[0] === -1 && (be.push(e), gn(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
262
+ e.$$.dirty[0] === -1 && (we.push(e), gn(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
263
263
  }
264
264
  function ee(e, t, n, o, i, s, r = null, l = [-1]) {
265
- const a = Ie;
266
- Be(e);
265
+ const a = Pe;
266
+ Ie(e);
267
267
  const c = e.$$ = {
268
268
  fragment: null,
269
269
  ctx: [],
270
270
  // state
271
271
  props: s,
272
- update: V,
272
+ update: G,
273
273
  not_equal: i,
274
274
  bound: dt(),
275
275
  // lifecycle
@@ -287,18 +287,18 @@ function ee(e, t, n, o, i, s, r = null, l = [-1]) {
287
287
  };
288
288
  r && r(c.root);
289
289
  let u = !1;
290
- if (c.ctx = n ? n(e, t.props || {}, (f, h, ...g) => {
291
- const m = g.length ? g[0] : h;
292
- return c.ctx && i(c.ctx[f], c.ctx[f] = m) && (!c.skip_bound && c.bound[f] && c.bound[f](m), u && yn(e, f)), h;
293
- }) : [], c.update(), u = !0, ae(c.before_update), c.fragment = o ? o(c.ctx) : !1, t.target) {
290
+ if (c.ctx = n ? n(e, t.props || {}, (f, d, ...g) => {
291
+ const m = g.length ? g[0] : d;
292
+ return c.ctx && i(c.ctx[f], c.ctx[f] = m) && (!c.skip_bound && c.bound[f] && c.bound[f](m), u && yn(e, f)), d;
293
+ }) : [], c.update(), u = !0, le(c.before_update), c.fragment = o ? o(c.ctx) : !1, t.target) {
294
294
  if (t.hydrate) {
295
295
  const f = un(t.target);
296
- c.fragment && c.fragment.l(f), f.forEach(L);
296
+ c.fragment && c.fragment.l(f), f.forEach(k);
297
297
  } else
298
298
  c.fragment && c.fragment.c();
299
299
  t.intro && P(e.$$.fragment), Q(e, t.target, t.anchor), Ft();
300
300
  }
301
- Be(a);
301
+ Ie(a);
302
302
  }
303
303
  class te {
304
304
  constructor() {
@@ -321,7 +321,7 @@ class te {
321
321
  }
322
322
  /** @returns {void} */
323
323
  $destroy() {
324
- x(this, 1), this.$destroy = V;
324
+ x(this, 1), this.$destroy = G;
325
325
  }
326
326
  /**
327
327
  * @template {Extract<keyof Events, string>} K
@@ -330,8 +330,8 @@ class te {
330
330
  * @returns {() => void}
331
331
  */
332
332
  $on(t, n) {
333
- if (!q(n))
334
- return V;
333
+ if (!j(n))
334
+ return G;
335
335
  const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
336
336
  return o.push(n), () => {
337
337
  const i = o.indexOf(n);
@@ -348,7 +348,7 @@ class te {
348
348
  }
349
349
  const _n = "4";
350
350
  typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(_n);
351
- var j = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(j || {});
351
+ var F = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(F || {});
352
352
  const lt = {}, at = (e, t) => lt[e] = t, st = (e) => lt[e.type].area(e), wn = (e, t, n) => lt[e.type].intersects(e, t, n), Fe = (e) => {
353
353
  let t = 1 / 0, n = 1 / 0, o = -1 / 0, i = -1 / 0;
354
354
  return e.forEach(([s, r]) => {
@@ -357,11 +357,11 @@ const lt = {}, at = (e, t) => lt[e] = t, st = (e) => lt[e.type].area(e), wn = (e
357
357
  }, bn = {
358
358
  area: (e) => Math.PI * e.geometry.rx * e.geometry.ry,
359
359
  intersects: (e, t, n) => {
360
- const { cx: o, cy: i, rx: s, ry: r } = e.geometry, l = 0, a = Math.cos(l), c = Math.sin(l), u = t - o, f = n - i, h = a * u + c * f, g = c * u - a * f;
361
- return h * h / (s * s) + g * g / (r * r) <= 1;
360
+ const { cx: o, cy: i, rx: s, ry: r } = e.geometry, l = 0, a = Math.cos(l), c = Math.sin(l), u = t - o, f = n - i, d = a * u + c * f, g = c * u - a * f;
361
+ return d * d / (s * s) + g * g / (r * r) <= 1;
362
362
  }
363
363
  };
364
- at(j.ELLIPSE, bn);
364
+ at(F.ELLIPSE, bn);
365
365
  const En = {
366
366
  area: (e) => {
367
367
  const { points: t } = e.geometry;
@@ -380,31 +380,31 @@ const En = {
380
380
  return i;
381
381
  }
382
382
  };
383
- at(j.POLYGON, En);
383
+ at(F.POLYGON, En);
384
384
  const An = {
385
385
  area: (e) => e.geometry.w * e.geometry.h,
386
386
  intersects: (e, t, n) => t >= e.geometry.x && t <= e.geometry.x + e.geometry.w && n >= e.geometry.y && n <= e.geometry.y + e.geometry.h
387
387
  };
388
- at(j.RECTANGLE, An);
388
+ at(F.RECTANGLE, An);
389
389
  const Sn = (e, t = !1) => {
390
390
  const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, l, a, c, u, f] = i;
391
391
  if (r !== "xywh")
392
392
  throw new Error("Unsupported MediaFragment: " + n);
393
393
  if (l && l !== "pixel")
394
394
  throw new Error(`Unsupported MediaFragment unit: ${l}`);
395
- const [h, g, m, _] = [a, c, u, f].map(parseFloat);
395
+ const [d, g, m, y] = [a, c, u, f].map(parseFloat);
396
396
  return {
397
- type: j.RECTANGLE,
397
+ type: F.RECTANGLE,
398
398
  geometry: {
399
- x: h,
399
+ x: d,
400
400
  y: g,
401
401
  w: m,
402
- h: _,
402
+ h: y,
403
403
  bounds: {
404
- minX: h,
405
- minY: t ? g - _ : g,
406
- maxX: h + m,
407
- maxY: t ? g : g + _
404
+ minX: d,
405
+ minY: t ? g - y : g,
406
+ maxX: d + m,
407
+ maxY: t ? g : g + y
408
408
  }
409
409
  }
410
410
  };
@@ -431,7 +431,7 @@ const Sn = (e, t = !1) => {
431
431
  }, Ln = (e) => {
432
432
  const [t, n, o] = e.match(/(<polygon points=["|'])([^("|')]*)/) || [], i = o.split(" ").map((s) => s.split(",").map(parseFloat));
433
433
  return {
434
- type: j.POLYGON,
434
+ type: F.POLYGON,
435
435
  geometry: {
436
436
  points: i,
437
437
  bounds: Fe(i)
@@ -445,7 +445,7 @@ const Sn = (e, t = !1) => {
445
445
  maxY: o + s
446
446
  };
447
447
  return {
448
- type: j.ELLIPSE,
448
+ type: F.ELLIPSE,
449
449
  geometry: {
450
450
  cx: n,
451
451
  cy: o,
@@ -463,10 +463,10 @@ const Sn = (e, t = !1) => {
463
463
  throw "Unsupported SVG shape: " + t;
464
464
  }, Bn = (e) => {
465
465
  let t;
466
- if (e.type === j.POLYGON) {
466
+ if (e.type === F.POLYGON) {
467
467
  const n = e.geometry, { points: o } = n;
468
468
  t = `<svg><polygon points="${o.map((i) => i.join(",")).join(" ")}" /></svg>`;
469
- } else if (e.type === j.ELLIPSE) {
469
+ } else if (e.type === F.ELLIPSE) {
470
470
  const n = e.geometry;
471
471
  t = `<svg><ellipse cx="${n.cx}" cy="${n.cy}" rx="${n.rx}" ry="${n.ry}" /></svg>`;
472
472
  }
@@ -474,18 +474,18 @@ const Sn = (e, t = !1) => {
474
474
  return { type: "SvgSelector", value: t };
475
475
  throw `Unsupported shape type: ${e.type}`;
476
476
  };
477
- let Re;
477
+ let Ue;
478
478
  const In = new Uint8Array(16);
479
479
  function Pn() {
480
- if (!Re && (Re = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Re))
480
+ if (!Ue && (Ue = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Ue))
481
481
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
482
- return Re(In);
482
+ return Ue(In);
483
483
  }
484
- const K = [];
484
+ const q = [];
485
485
  for (let e = 0; e < 256; ++e)
486
- K.push((e + 256).toString(16).slice(1));
486
+ q.push((e + 256).toString(16).slice(1));
487
487
  function Yn(e, t = 0) {
488
- return K[e[t + 0]] + K[e[t + 1]] + K[e[t + 2]] + K[e[t + 3]] + "-" + K[e[t + 4]] + K[e[t + 5]] + "-" + K[e[t + 6]] + K[e[t + 7]] + "-" + K[e[t + 8]] + K[e[t + 9]] + "-" + K[e[t + 10]] + K[e[t + 11]] + K[e[t + 12]] + K[e[t + 13]] + K[e[t + 14]] + K[e[t + 15]];
488
+ return q[e[t + 0]] + q[e[t + 1]] + q[e[t + 2]] + q[e[t + 3]] + "-" + q[e[t + 4]] + q[e[t + 5]] + "-" + q[e[t + 6]] + q[e[t + 7]] + "-" + q[e[t + 8]] + q[e[t + 9]] + "-" + q[e[t + 10]] + q[e[t + 11]] + q[e[t + 12]] + q[e[t + 13]] + q[e[t + 14]] + q[e[t + 15]];
489
489
  }
490
490
  const Cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), yt = {
491
491
  randomUUID: Cn
@@ -495,16 +495,10 @@ function qt(e, t, n) {
495
495
  return yt.randomUUID();
496
496
  e = e || {};
497
497
  const o = e.random || (e.rng || Pn)();
498
- if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
499
- n = n || 0;
500
- for (let i = 0; i < 16; ++i)
501
- t[n + i] = o[i];
502
- return t;
503
- }
504
- return Yn(o);
498
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Yn(o);
505
499
  }
506
500
  var _t = Object.prototype.hasOwnProperty;
507
- function he(e, t) {
501
+ function de(e, t) {
508
502
  var n, o;
509
503
  if (e === t)
510
504
  return !0;
@@ -515,14 +509,14 @@ function he(e, t) {
515
509
  return e.toString() === t.toString();
516
510
  if (n === Array) {
517
511
  if ((o = e.length) === t.length)
518
- for (; o-- && he(e[o], t[o]); )
512
+ for (; o-- && de(e[o], t[o]); )
519
513
  ;
520
514
  return o === -1;
521
515
  }
522
516
  if (!n || typeof e == "object") {
523
517
  o = 0;
524
518
  for (n in e)
525
- if (_t.call(e, n) && ++o && !_t.call(t, n) || !(n in t) || !he(e[n], t[n]))
519
+ if (_t.call(e, n) && ++o && !_t.call(t, n) || !(n in t) || !de(e[n], t[n]))
526
520
  return !1;
527
521
  return Object.keys(t).length === o;
528
522
  }
@@ -534,19 +528,19 @@ function Je() {
534
528
  function Dn(e, t) {
535
529
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
536
530
  }
537
- const ye = [];
531
+ const pe = [];
538
532
  function ct(e, t = Je) {
539
533
  let n;
540
534
  const o = /* @__PURE__ */ new Set();
541
535
  function i(l) {
542
536
  if (Dn(e, l) && (e = l, n)) {
543
- const a = !ye.length;
537
+ const a = !pe.length;
544
538
  for (const c of o)
545
- c[1](), ye.push(c, e);
539
+ c[1](), pe.push(c, e);
546
540
  if (a) {
547
- for (let c = 0; c < ye.length; c += 2)
548
- ye[c][0](ye[c + 1]);
549
- ye.length = 0;
541
+ for (let c = 0; c < pe.length; c += 2)
542
+ pe[c][0](pe[c + 1]);
543
+ pe.length = 0;
550
544
  }
551
545
  }
552
546
  }
@@ -589,25 +583,25 @@ const Ze = { selected: [] }, Rn = (e, t = "EDIT") => {
589
583
  }, l = (f) => {
590
584
  if (i.selected.length === 0)
591
585
  return !1;
592
- const h = typeof f == "string" ? f : f.id;
593
- return i.selected.some((g) => g.id === h);
594
- }, a = (f, h) => {
586
+ const d = typeof f == "string" ? f : f.id;
587
+ return i.selected.some((g) => g.id === d);
588
+ }, a = (f, d) => {
595
589
  const g = e.getAnnotation(f);
596
590
  if (g) {
597
591
  const m = Un(g, t);
598
- o(m === "EDIT" ? { selected: [{ id: f, editable: !0 }], pointerEvent: h } : m === "SELECT" ? { selected: [{ id: f }], pointerEvent: h } : { selected: [], pointerEvent: h });
592
+ o(m === "EDIT" ? { selected: [{ id: f, editable: !0 }], pointerEvent: d } : m === "SELECT" ? { selected: [{ id: f }], pointerEvent: d } : { selected: [], pointerEvent: d });
599
593
  } else
600
594
  console.warn("Invalid selection: " + f);
601
- }, c = (f, h = !0) => {
602
- const g = Array.isArray(f) ? f : [f], m = g.map((_) => e.getAnnotation(_)).filter(Boolean);
603
- o({ selected: m.map(({ id: _ }) => ({ id: _, editable: h })) }), m.length !== g.length && console.warn("Invalid selection", f);
595
+ }, c = (f, d = !0) => {
596
+ const g = Array.isArray(f) ? f : [f], m = g.map((y) => e.getAnnotation(y)).filter(Boolean);
597
+ o({ selected: m.map(({ id: y }) => ({ id: y, editable: d })) }), m.length !== g.length && console.warn("Invalid selection", f);
604
598
  }, u = (f) => {
605
599
  if (i.selected.length === 0)
606
600
  return !1;
607
- const { selected: h } = i;
608
- h.filter(({ id: g }) => f.includes(g)).length > 0 && o({ selected: h.filter(({ id: g }) => !f.includes(g)) });
601
+ const { selected: d } = i;
602
+ d.filter(({ id: g }) => f.includes(g)).length > 0 && o({ selected: d.filter(({ id: g }) => !f.includes(g)) });
609
603
  };
610
- return e.observe(({ changes: f }) => u((f.deleted || []).map((h) => h.id))), {
604
+ return e.observe(({ changes: f }) => u((f.deleted || []).map((d) => d.id))), {
611
605
  clear: s,
612
606
  clickSelect: a,
613
607
  get selected() {
@@ -633,8 +627,8 @@ const Vn = (e, t) => {
633
627
  return e.bodies.filter((o) => !n.has(o.id));
634
628
  }, zn = (e, t) => t.bodies.map((n) => {
635
629
  const o = e.bodies.find((i) => i.id === n.id);
636
- return { newBody: n, oldBody: o && !he(o, n) ? o : void 0 };
637
- }).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Hn = (e, t) => !he(e.target, t.target), Wt = (e, t) => {
630
+ return { newBody: n, oldBody: o && !de(o, n) ? o : void 0 };
631
+ }).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Hn = (e, t) => !de(e.target, t.target), Wt = (e, t) => {
638
632
  const n = Vn(e, t), o = Gn(e, t), i = zn(e, t);
639
633
  return {
640
634
  oldValue: e,
@@ -645,7 +639,7 @@ const Vn = (e, t) => {
645
639
  targetUpdated: Hn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
646
640
  };
647
641
  };
648
- var G = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(G || {});
642
+ var z = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(z || {});
649
643
  const Fn = (e, t) => {
650
644
  var n, o;
651
645
  const { changes: i, origin: s } = t;
@@ -670,17 +664,17 @@ const Fn = (e, t) => {
670
664
  return !0;
671
665
  }, jn = (e, t) => {
672
666
  const n = new Set((e.created || []).map((f) => f.id)), o = new Set((e.updated || []).map(({ newValue: f }) => f.id)), i = new Set((t.created || []).map((f) => f.id)), s = new Set((t.deleted || []).map((f) => f.id)), r = new Set((t.updated || []).map(({ oldValue: f }) => f.id)), l = new Set((t.updated || []).filter(({ oldValue: f }) => n.has(f.id) || o.has(f.id)).map(({ oldValue: f }) => f.id)), a = [
673
- ...(e.created || []).filter((f) => !s.has(f.id)).map((f) => r.has(f.id) ? t.updated.find(({ oldValue: h }) => h.id === f.id).newValue : f),
667
+ ...(e.created || []).filter((f) => !s.has(f.id)).map((f) => r.has(f.id) ? t.updated.find(({ oldValue: d }) => d.id === f.id).newValue : f),
674
668
  ...t.created || []
675
669
  ], c = [
676
670
  ...(e.deleted || []).filter((f) => !i.has(f.id)),
677
671
  ...(t.deleted || []).filter((f) => !n.has(f.id))
678
672
  ], u = [
679
673
  ...(e.updated || []).filter(({ newValue: f }) => !s.has(f.id)).map((f) => {
680
- const { oldValue: h, newValue: g } = f;
674
+ const { oldValue: d, newValue: g } = f;
681
675
  if (r.has(g.id)) {
682
- const m = t.updated.find((_) => _.oldValue.id === g.id).newValue;
683
- return Wt(h, m);
676
+ const m = t.updated.find((y) => y.oldValue.id === g.id).newValue;
677
+ return Wt(d, m);
684
678
  } else
685
679
  return f;
686
680
  }),
@@ -688,188 +682,188 @@ const Fn = (e, t) => {
688
682
  ];
689
683
  return { created: a, deleted: c, updated: u };
690
684
  }, qn = (e) => e.id !== void 0, Kn = () => {
691
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (p, T = {}) => n.push({ onChange: p, options: T }), i = (p) => {
692
- const T = n.findIndex((S) => S.onChange == p);
693
- T > -1 && n.splice(T, 1);
694
- }, s = (p, T) => {
695
- const S = {
696
- origin: p,
685
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (_, b = {}) => n.push({ onChange: _, options: b }), i = (_) => {
686
+ const b = n.findIndex((T) => T.onChange == _);
687
+ b > -1 && n.splice(b, 1);
688
+ }, s = (_, b) => {
689
+ const T = {
690
+ origin: _,
697
691
  changes: {
698
- created: T.created || [],
699
- updated: T.updated || [],
700
- deleted: T.deleted || []
692
+ created: b.created || [],
693
+ updated: b.updated || [],
694
+ deleted: b.deleted || []
701
695
  },
702
696
  state: [...e.values()]
703
697
  };
704
698
  n.forEach((M) => {
705
- Fn(M, S) && M.onChange(S);
699
+ Fn(M, T) && M.onChange(T);
706
700
  });
707
- }, r = (p, T = G.LOCAL) => {
708
- if (e.get(p.id))
709
- throw Error(`Cannot add annotation ${p.id} - exists already`);
710
- e.set(p.id, p), p.bodies.forEach((S) => t.set(S.id, p.id)), s(T, { created: [p] });
711
- }, l = (p, T) => {
712
- const S = typeof p == "string" ? T : p, M = typeof p == "string" ? p : p.id, k = e.get(M);
713
- if (k) {
714
- const C = Wt(k, S);
715
- return M === S.id ? e.set(M, S) : (e.delete(M), e.set(S.id, S)), k.bodies.forEach((Z) => t.delete(Z.id)), S.bodies.forEach((Z) => t.set(Z.id, S.id)), C;
701
+ }, r = (_, b = z.LOCAL) => {
702
+ if (e.get(_.id))
703
+ throw Error(`Cannot add annotation ${_.id} - exists already`);
704
+ e.set(_.id, _), _.bodies.forEach((T) => t.set(T.id, _.id)), s(b, { created: [_] });
705
+ }, l = (_, b) => {
706
+ const T = typeof _ == "string" ? b : _, M = typeof _ == "string" ? _ : _.id, O = e.get(M);
707
+ if (O) {
708
+ const Y = Wt(O, T);
709
+ return M === T.id ? e.set(M, T) : (e.delete(M), e.set(T.id, T)), O.bodies.forEach((Z) => t.delete(Z.id)), T.bodies.forEach((Z) => t.set(Z.id, T.id)), Y;
716
710
  } else
717
711
  console.warn(`Cannot update annotation ${M} - does not exist`);
718
- }, a = (p, T = G.LOCAL, S = G.LOCAL) => {
719
- const M = qn(T) ? S : T, k = l(p, T);
720
- k && s(M, { updated: [k] });
721
- }, c = (p, T = G.LOCAL) => {
722
- const S = p.reduce((M, k) => {
723
- const C = l(k);
724
- return C ? [...M, C] : M;
712
+ }, a = (_, b = z.LOCAL, T = z.LOCAL) => {
713
+ const M = qn(b) ? T : b, O = l(_, b);
714
+ O && s(M, { updated: [O] });
715
+ }, c = (_, b = z.LOCAL) => {
716
+ const T = _.reduce((M, O) => {
717
+ const Y = l(O);
718
+ return Y ? [...M, Y] : M;
725
719
  }, []);
726
- S.length > 0 && s(T, { updated: S });
727
- }, u = (p, T = G.LOCAL) => {
728
- const S = e.get(p.annotation);
729
- if (S) {
720
+ T.length > 0 && s(b, { updated: T });
721
+ }, u = (_, b = z.LOCAL) => {
722
+ const T = e.get(_.annotation);
723
+ if (T) {
730
724
  const M = {
731
- ...S,
732
- bodies: [...S.bodies, p]
725
+ ...T,
726
+ bodies: [...T.bodies, _]
733
727
  };
734
- e.set(S.id, M), t.set(p.id, M.id), s(T, { updated: [{
735
- oldValue: S,
728
+ e.set(T.id, M), t.set(_.id, M.id), s(b, { updated: [{
729
+ oldValue: T,
736
730
  newValue: M,
737
- bodiesCreated: [p]
731
+ bodiesCreated: [_]
738
732
  }] });
739
733
  } else
740
- console.warn(`Attempt to add body to missing annotation: ${p.annotation}`);
741
- }, f = () => [...e.values()], h = (p = G.LOCAL) => {
742
- const T = [...e.values()];
743
- e.clear(), t.clear(), s(p, { deleted: T });
744
- }, g = (p, T = !0, S = G.LOCAL) => {
745
- if (T) {
734
+ console.warn(`Attempt to add body to missing annotation: ${_.annotation}`);
735
+ }, f = () => [...e.values()], d = (_ = z.LOCAL) => {
736
+ const b = [...e.values()];
737
+ e.clear(), t.clear(), s(_, { deleted: b });
738
+ }, g = (_, b = !0, T = z.LOCAL) => {
739
+ if (b) {
746
740
  const M = [...e.values()];
747
- e.clear(), t.clear(), p.forEach((k) => {
748
- e.set(k.id, k), k.bodies.forEach((C) => t.set(C.id, k.id));
749
- }), s(S, { created: p, deleted: M });
741
+ e.clear(), t.clear(), _.forEach((O) => {
742
+ e.set(O.id, O), O.bodies.forEach((Y) => t.set(Y.id, O.id));
743
+ }), s(T, { created: _, deleted: M });
750
744
  } else {
751
- const M = p.reduce((k, C) => {
752
- const Z = e.get(C.id);
753
- return Z ? [...k, Z] : k;
745
+ const M = _.reduce((O, Y) => {
746
+ const Z = e.get(Y.id);
747
+ return Z ? [...O, Z] : O;
754
748
  }, []);
755
749
  if (M.length > 0)
756
- throw Error(`Bulk insert would overwrite the following annotations: ${M.map((k) => k.id).join(", ")}`);
757
- p.forEach((k) => {
758
- e.set(k.id, k), k.bodies.forEach((C) => t.set(C.id, k.id));
759
- }), s(S, { created: p });
750
+ throw Error(`Bulk insert would overwrite the following annotations: ${M.map((O) => O.id).join(", ")}`);
751
+ _.forEach((O) => {
752
+ e.set(O.id, O), O.bodies.forEach((Y) => t.set(Y.id, O.id));
753
+ }), s(T, { created: _ });
760
754
  }
761
- }, m = (p) => {
762
- const T = typeof p == "string" ? p : p.id, S = e.get(T);
763
- if (S)
764
- return e.delete(T), S.bodies.forEach((M) => t.delete(M.id)), S;
765
- console.warn(`Attempt to delete missing annotation: ${T}`);
766
- }, _ = (p, T = G.LOCAL) => {
767
- const S = m(p);
768
- S && s(T, { deleted: [S] });
769
- }, b = (p, T = G.LOCAL) => {
770
- const S = p.reduce((M, k) => {
771
- const C = m(k);
772
- return C ? [...M, C] : M;
755
+ }, m = (_) => {
756
+ const b = typeof _ == "string" ? _ : _.id, T = e.get(b);
757
+ if (T)
758
+ return e.delete(b), T.bodies.forEach((M) => t.delete(M.id)), T;
759
+ console.warn(`Attempt to delete missing annotation: ${b}`);
760
+ }, y = (_, b = z.LOCAL) => {
761
+ const T = m(_);
762
+ T && s(b, { deleted: [T] });
763
+ }, E = (_, b = z.LOCAL) => {
764
+ const T = _.reduce((M, O) => {
765
+ const Y = m(O);
766
+ return Y ? [...M, Y] : M;
773
767
  }, []);
774
- S.length > 0 && s(T, { deleted: S });
775
- }, y = (p, T = G.LOCAL) => {
776
- const S = e.get(p.annotation);
777
- if (S) {
778
- const M = S.bodies.find((k) => k.id === p.id);
768
+ T.length > 0 && s(b, { deleted: T });
769
+ }, p = (_, b = z.LOCAL) => {
770
+ const T = e.get(_.annotation);
771
+ if (T) {
772
+ const M = T.bodies.find((O) => O.id === _.id);
779
773
  if (M) {
780
774
  t.delete(M.id);
781
- const k = {
782
- ...S,
783
- bodies: S.bodies.filter((C) => C.id !== p.id)
775
+ const O = {
776
+ ...T,
777
+ bodies: T.bodies.filter((Y) => Y.id !== _.id)
784
778
  };
785
- e.set(S.id, k), s(T, { updated: [{
786
- oldValue: S,
787
- newValue: k,
779
+ e.set(T.id, O), s(b, { updated: [{
780
+ oldValue: T,
781
+ newValue: O,
788
782
  bodiesDeleted: [M]
789
783
  }] });
790
784
  } else
791
- console.warn(`Attempt to delete missing body ${p.id} from annotation ${p.annotation}`);
785
+ console.warn(`Attempt to delete missing body ${_.id} from annotation ${_.annotation}`);
792
786
  } else
793
- console.warn(`Attempt to delete body from missing annotation ${p.annotation}`);
794
- }, A = (p) => {
795
- const T = e.get(p);
796
- return T ? { ...T } : void 0;
797
- }, w = (p) => {
798
- const T = t.get(p);
799
- if (T) {
800
- const S = A(T).bodies.find((M) => M.id === p);
801
- if (S)
802
- return S;
803
- console.error(`Store integrity error: body ${p} in index, but not in annotation`);
787
+ console.warn(`Attempt to delete body from missing annotation ${_.annotation}`);
788
+ }, S = (_) => {
789
+ const b = e.get(_);
790
+ return b ? { ...b } : void 0;
791
+ }, w = (_) => {
792
+ const b = t.get(_);
793
+ if (b) {
794
+ const T = S(b).bodies.find((M) => M.id === _);
795
+ if (T)
796
+ return T;
797
+ console.error(`Store integrity error: body ${_} in index, but not in annotation`);
804
798
  } else
805
- console.warn(`Attempt to retrieve missing body: ${p}`);
806
- }, E = (p, T) => {
807
- if (p.annotation !== T.annotation)
799
+ console.warn(`Attempt to retrieve missing body: ${_}`);
800
+ }, A = (_, b) => {
801
+ if (_.annotation !== b.annotation)
808
802
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
809
- const S = e.get(p.annotation);
810
- if (S) {
811
- const M = S.bodies.find((C) => C.id === p.id), k = {
812
- ...S,
813
- bodies: S.bodies.map((C) => C.id === M.id ? T : C)
803
+ const T = e.get(_.annotation);
804
+ if (T) {
805
+ const M = T.bodies.find((Y) => Y.id === _.id), O = {
806
+ ...T,
807
+ bodies: T.bodies.map((Y) => Y.id === M.id ? b : Y)
814
808
  };
815
- return e.set(S.id, k), M.id !== T.id && (t.delete(M.id), t.set(T.id, k.id)), {
816
- oldValue: S,
817
- newValue: k,
818
- bodiesUpdated: [{ oldBody: M, newBody: T }]
809
+ return e.set(T.id, O), M.id !== b.id && (t.delete(M.id), t.set(b.id, O.id)), {
810
+ oldValue: T,
811
+ newValue: O,
812
+ bodiesUpdated: [{ oldBody: M, newBody: b }]
819
813
  };
820
814
  } else
821
- console.warn(`Attempt to add body to missing annotation ${p.annotation}`);
822
- }, B = (p, T, S = G.LOCAL) => {
823
- const M = E(p, T);
824
- M && s(S, { updated: [M] });
825
- }, U = (p, T = G.LOCAL) => {
826
- const S = p.map((M) => E({ id: M.id, annotation: M.annotation }, M)).filter(Boolean);
827
- s(T, { updated: S });
828
- }, X = (p) => {
829
- const T = e.get(p.annotation);
830
- if (T) {
831
- const S = {
832
- ...T,
815
+ console.warn(`Attempt to add body to missing annotation ${_.annotation}`);
816
+ }, I = (_, b, T = z.LOCAL) => {
817
+ const M = A(_, b);
818
+ M && s(T, { updated: [M] });
819
+ }, N = (_, b = z.LOCAL) => {
820
+ const T = _.map((M) => A({ id: M.id, annotation: M.annotation }, M)).filter(Boolean);
821
+ s(b, { updated: T });
822
+ }, U = (_) => {
823
+ const b = e.get(_.annotation);
824
+ if (b) {
825
+ const T = {
826
+ ...b,
833
827
  target: {
834
- ...T.target,
835
- ...p
828
+ ...b.target,
829
+ ..._
836
830
  }
837
831
  };
838
- return e.set(T.id, S), {
839
- oldValue: T,
840
- newValue: S,
832
+ return e.set(b.id, T), {
833
+ oldValue: b,
834
+ newValue: T,
841
835
  targetUpdated: {
842
- oldTarget: T.target,
843
- newTarget: p
836
+ oldTarget: b.target,
837
+ newTarget: _
844
838
  }
845
839
  };
846
840
  } else
847
- console.warn(`Attempt to update target on missing annotation: ${p.annotation}`);
841
+ console.warn(`Attempt to update target on missing annotation: ${_.annotation}`);
848
842
  };
849
843
  return {
850
844
  addAnnotation: r,
851
845
  addBody: u,
852
846
  all: f,
853
847
  bulkAddAnnotation: g,
854
- bulkDeleteAnnotation: b,
848
+ bulkDeleteAnnotation: E,
855
849
  bulkUpdateAnnotation: c,
856
- bulkUpdateBodies: U,
857
- bulkUpdateTargets: (p, T = G.LOCAL) => {
858
- const S = p.map((M) => X(M)).filter(Boolean);
859
- S.length > 0 && s(T, { updated: S });
860
- },
861
- clear: h,
862
- deleteAnnotation: _,
863
- deleteBody: y,
864
- getAnnotation: A,
850
+ bulkUpdateBodies: N,
851
+ bulkUpdateTargets: (_, b = z.LOCAL) => {
852
+ const T = _.map((M) => U(M)).filter(Boolean);
853
+ T.length > 0 && s(b, { updated: T });
854
+ },
855
+ clear: d,
856
+ deleteAnnotation: y,
857
+ deleteBody: p,
858
+ getAnnotation: S,
865
859
  getBody: w,
866
860
  observe: o,
867
861
  unobserve: i,
868
862
  updateAnnotation: a,
869
- updateBody: B,
870
- updateTarget: (p, T = G.LOCAL) => {
871
- const S = X(p);
872
- S && s(T, { updated: [S] });
863
+ updateBody: I,
864
+ updateTarget: (_, b = z.LOCAL) => {
865
+ const T = U(_);
866
+ T && s(b, { updated: [T] });
873
867
  }
874
868
  };
875
869
  }, Wn = (e) => ({
@@ -898,19 +892,19 @@ const Zn = 250, Qn = (e) => {
898
892
  let o = -1, i = !1, s = 0;
899
893
  const r = (g) => {
900
894
  if (!i) {
901
- const { changes: m } = g, _ = performance.now();
902
- if (_ - s > Zn)
895
+ const { changes: m } = g, y = performance.now();
896
+ if (y - s > Zn)
903
897
  n.splice(o + 1), n.push(m), o = n.length - 1;
904
898
  else {
905
- const b = n.length - 1;
906
- n[b] = jn(n[b], m);
899
+ const E = n.length - 1;
900
+ n[E] = jn(n[E], m);
907
901
  }
908
- s = _;
902
+ s = y;
909
903
  }
910
904
  i = !1;
911
905
  };
912
- e.observe(r, { origin: G.LOCAL });
913
- const l = (g) => g && g.length > 0 && e.bulkDeleteAnnotation(g), a = (g) => g && g.length > 0 && e.bulkAddAnnotation(g, !1), c = (g) => g && g.length > 0 && e.bulkUpdateAnnotation(g.map(({ oldValue: m }) => m)), u = (g) => g && g.length > 0 && e.bulkUpdateAnnotation(g.map(({ newValue: m }) => m)), f = (g) => g && g.length > 0 && e.bulkAddAnnotation(g, !1), h = (g) => g && g.length > 0 && e.bulkDeleteAnnotation(g);
906
+ e.observe(r, { origin: z.LOCAL });
907
+ const l = (g) => g && g.length > 0 && e.bulkDeleteAnnotation(g), a = (g) => g && g.length > 0 && e.bulkAddAnnotation(g, !1), c = (g) => g && g.length > 0 && e.bulkUpdateAnnotation(g.map(({ oldValue: m }) => m)), u = (g) => g && g.length > 0 && e.bulkUpdateAnnotation(g.map(({ newValue: m }) => m)), f = (g) => g && g.length > 0 && e.bulkAddAnnotation(g, !1), d = (g) => g && g.length > 0 && e.bulkDeleteAnnotation(g);
914
908
  return {
915
909
  canRedo: () => n.length - 1 > o,
916
910
  canUndo: () => o > -1,
@@ -919,15 +913,15 @@ const Zn = 250, Qn = (e) => {
919
913
  redo: () => {
920
914
  if (n.length - 1 > o) {
921
915
  i = !0;
922
- const { created: g, updated: m, deleted: _ } = n[o + 1];
923
- a(g), u(m), h(_), t.emit("redo", n[o + 1]), o += 1;
916
+ const { created: g, updated: m, deleted: y } = n[o + 1];
917
+ a(g), u(m), d(y), t.emit("redo", n[o + 1]), o += 1;
924
918
  }
925
919
  },
926
920
  undo: () => {
927
921
  if (o > -1) {
928
922
  i = !0;
929
- const { created: g, updated: m, deleted: _ } = n[o];
930
- l(g), c(m), f(_), t.emit("undo", n[o]), o -= 1;
923
+ const { created: g, updated: m, deleted: y } = n[o];
924
+ l(g), c(m), f(y), t.emit("undo", n[o]), o -= 1;
931
925
  }
932
926
  }
933
927
  };
@@ -940,75 +934,75 @@ const Zn = 250, Qn = (e) => {
940
934
  }, $n = (e, t, n, o) => {
941
935
  const { store: i, selection: s, hover: r, viewport: l } = e, a = /* @__PURE__ */ new Map();
942
936
  let c = [], u, f;
943
- const h = (y, A) => {
944
- a.has(y) ? a.get(y).push(A) : a.set(y, [A]);
945
- }, g = (y, A) => {
946
- const w = a.get(y);
947
- w && w.indexOf(A) > 0 && w.splice(w.indexOf(A), 1);
948
- }, m = (y, A, w) => {
949
- a.has(y) && setTimeout(() => {
950
- a.get(y).forEach((E) => {
937
+ const d = (p, S) => {
938
+ a.has(p) ? a.get(p).push(S) : a.set(p, [S]);
939
+ }, g = (p, S) => {
940
+ const w = a.get(p);
941
+ w && w.indexOf(S) > 0 && w.splice(w.indexOf(S), 1);
942
+ }, m = (p, S, w) => {
943
+ a.has(p) && setTimeout(() => {
944
+ a.get(p).forEach((A) => {
951
945
  if (n) {
952
- const B = Array.isArray(A) ? A.map((X) => n.serialize(X)) : n.serialize(A), U = w ? w instanceof PointerEvent ? w : n.serialize(w) : void 0;
953
- E(B, U);
946
+ const I = Array.isArray(S) ? S.map((U) => n.serialize(U)) : n.serialize(S), N = w ? w instanceof PointerEvent ? w : n.serialize(w) : void 0;
947
+ A(I, N);
954
948
  } else
955
- E(A, w);
949
+ A(S, w);
956
950
  });
957
951
  }, 1);
958
- }, _ = () => {
959
- const { selected: y } = s, A = (y || []).map(({ id: w }) => i.getAnnotation(w));
960
- A.forEach((w) => {
961
- const E = c.find((B) => B.id === w.id);
962
- (!E || !he(E, w)) && m("updateAnnotation", w, E);
963
- }), c = c.map((w) => A.find(({ id: B }) => B === w.id) || w);
952
+ }, y = () => {
953
+ const { selected: p } = s, S = (p || []).map(({ id: w }) => i.getAnnotation(w));
954
+ S.forEach((w) => {
955
+ const A = c.find((I) => I.id === w.id);
956
+ (!A || !de(A, w)) && m("updateAnnotation", w, A);
957
+ }), c = c.map((w) => S.find(({ id: I }) => I === w.id) || w);
964
958
  };
965
- s.subscribe(({ selected: y }) => {
966
- if (!(c.length === 0 && y.length === 0)) {
967
- if (c.length === 0 && y.length > 0)
968
- c = y.map(({ id: A }) => i.getAnnotation(A));
969
- else if (c.length > 0 && y.length === 0)
970
- c.forEach((A) => {
971
- const w = i.getAnnotation(A.id);
972
- w && !he(w, A) && m("updateAnnotation", w, A);
959
+ s.subscribe(({ selected: p }) => {
960
+ if (!(c.length === 0 && p.length === 0)) {
961
+ if (c.length === 0 && p.length > 0)
962
+ c = p.map(({ id: S }) => i.getAnnotation(S));
963
+ else if (c.length > 0 && p.length === 0)
964
+ c.forEach((S) => {
965
+ const w = i.getAnnotation(S.id);
966
+ w && !de(w, S) && m("updateAnnotation", w, S);
973
967
  }), c = [];
974
968
  else {
975
- const A = new Set(c.map((E) => E.id)), w = new Set(y.map(({ id: E }) => E));
976
- c.filter((E) => !w.has(E.id)).forEach((E) => {
977
- const B = i.getAnnotation(E.id);
978
- B && !he(B, E) && m("updateAnnotation", B, E);
969
+ const S = new Set(c.map((A) => A.id)), w = new Set(p.map(({ id: A }) => A));
970
+ c.filter((A) => !w.has(A.id)).forEach((A) => {
971
+ const I = i.getAnnotation(A.id);
972
+ I && !de(I, A) && m("updateAnnotation", I, A);
979
973
  }), c = [
980
974
  // Remove annotations that were deselected
981
- ...c.filter((E) => w.has(E.id)),
975
+ ...c.filter((A) => w.has(A.id)),
982
976
  // Add editable annotations that were selected
983
- ...y.filter(({ id: E }) => !A.has(E)).map(({ id: E }) => i.getAnnotation(E))
977
+ ...p.filter(({ id: A }) => !S.has(A)).map(({ id: A }) => i.getAnnotation(A))
984
978
  ];
985
979
  }
986
980
  m("selectionChanged", c);
987
981
  }
988
- }), r.subscribe((y) => {
989
- !u && y ? m("mouseEnterAnnotation", i.getAnnotation(y)) : u && !y ? m("mouseLeaveAnnotation", i.getAnnotation(u)) : u && y && (m("mouseLeaveAnnotation", i.getAnnotation(u)), m("mouseEnterAnnotation", i.getAnnotation(y))), u = y;
990
- }), l == null || l.subscribe((y) => m("viewportIntersect", y.map((A) => i.getAnnotation(A)))), i.observe((y) => {
991
- o && (f && clearTimeout(f), f = setTimeout(_, 1e3));
992
- const { created: A, deleted: w } = y.changes;
993
- (A || []).forEach((E) => m("createAnnotation", E)), (w || []).forEach((E) => m("deleteAnnotation", E)), (y.changes.updated || []).filter((E) => [
994
- ...E.bodiesCreated || [],
995
- ...E.bodiesDeleted || [],
996
- ...E.bodiesUpdated || []
997
- ].length > 0).forEach(({ oldValue: E, newValue: B }) => {
998
- const U = c.find((X) => X.id === E.id) || E;
999
- c = c.map((X) => X.id === E.id ? B : X), m("updateAnnotation", B, U);
982
+ }), r.subscribe((p) => {
983
+ !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;
984
+ }), l == null || l.subscribe((p) => m("viewportIntersect", p.map((S) => i.getAnnotation(S)))), i.observe((p) => {
985
+ o && (f && clearTimeout(f), f = setTimeout(y, 1e3));
986
+ const { created: S, deleted: w } = p.changes;
987
+ (S || []).forEach((A) => m("createAnnotation", A)), (w || []).forEach((A) => m("deleteAnnotation", A)), (p.changes.updated || []).filter((A) => [
988
+ ...A.bodiesCreated || [],
989
+ ...A.bodiesDeleted || [],
990
+ ...A.bodiesUpdated || []
991
+ ].length > 0).forEach(({ oldValue: A, newValue: I }) => {
992
+ const N = c.find((U) => U.id === A.id) || A;
993
+ c = c.map((U) => U.id === A.id ? I : U), m("updateAnnotation", I, N);
1000
994
  });
1001
- }, { origin: G.LOCAL }), i.observe((y) => {
995
+ }, { origin: z.LOCAL }), i.observe((p) => {
1002
996
  if (c) {
1003
- const A = new Set(c.map((E) => E.id)), w = (y.changes.updated || []).filter(({ newValue: E }) => A.has(E.id)).map(({ newValue: E }) => E);
1004
- w.length > 0 && (c = c.map((E) => w.find((U) => U.id === E.id) || E));
997
+ const S = new Set(c.map((A) => A.id)), w = (p.changes.updated || []).filter(({ newValue: A }) => S.has(A.id)).map(({ newValue: A }) => A);
998
+ w.length > 0 && (c = c.map((A) => w.find((N) => N.id === A.id) || A));
1005
999
  }
1006
- }, { origin: G.REMOTE });
1007
- const b = (y) => (A) => {
1008
- const { updated: w } = A;
1009
- y ? (w || []).forEach((E) => m("updateAnnotation", E.oldValue, E.newValue)) : (w || []).forEach((E) => m("updateAnnotation", E.newValue, E.oldValue));
1000
+ }, { origin: z.REMOTE });
1001
+ const E = (p) => (S) => {
1002
+ const { updated: w } = S;
1003
+ p ? (w || []).forEach((A) => m("updateAnnotation", A.oldValue, A.newValue)) : (w || []).forEach((A) => m("updateAnnotation", A.newValue, A.oldValue));
1010
1004
  };
1011
- return t.on("undo", b(!0)), t.on("redo", b(!1)), { on: h, off: g, emit: m };
1005
+ return t.on("undo", E(!0)), t.on("redo", E(!1)), { on: d, off: g, emit: m };
1012
1006
  }, eo = (e) => (t) => t.reduce((n, o) => {
1013
1007
  const { parsed: i, error: s } = e.parse(o);
1014
1008
  return s ? {
@@ -1021,44 +1015,44 @@ const Zn = 250, Qn = (e) => {
1021
1015
  ...n
1022
1016
  };
1023
1017
  }, { parsed: [], failed: [] }), to = (e, t, n) => {
1024
- const { store: o, selection: i } = e, s = (b) => {
1018
+ const { store: o, selection: i } = e, s = (E) => {
1025
1019
  if (n) {
1026
- const { parsed: y, error: A } = n.parse(b);
1027
- y ? o.addAnnotation(y, G.REMOTE) : console.error(A);
1020
+ const { parsed: p, error: S } = n.parse(E);
1021
+ p ? o.addAnnotation(p, z.REMOTE) : console.error(S);
1028
1022
  } else
1029
- o.addAnnotation(b, G.REMOTE);
1030
- }, r = () => i.clear(), l = () => o.clear(), a = (b) => {
1031
- const y = o.getAnnotation(b);
1032
- return n && y ? n.serialize(y) : y;
1023
+ o.addAnnotation(E, z.REMOTE);
1024
+ }, r = () => i.clear(), l = () => o.clear(), a = (E) => {
1025
+ const p = o.getAnnotation(E);
1026
+ return n && p ? n.serialize(p) : p;
1033
1027
  }, c = () => n ? o.all().map(n.serialize) : o.all(), u = () => {
1034
- var b;
1035
- const y = (((b = i.selected) == null ? void 0 : b.map((A) => A.id)) || []).map((A) => o.getAnnotation(A)).filter(Boolean);
1036
- return n ? y.map(n.serialize) : y;
1037
- }, f = (b, y = !0) => fetch(b).then((A) => A.json()).then((A) => (g(A, y), A)), h = (b) => {
1038
- if (typeof b == "string") {
1039
- const y = o.getAnnotation(b);
1040
- if (o.deleteAnnotation(b), y)
1041
- return n ? n.serialize(y) : y;
1028
+ var E;
1029
+ const p = (((E = i.selected) == null ? void 0 : E.map((S) => S.id)) || []).map((S) => o.getAnnotation(S)).filter(Boolean);
1030
+ return n ? p.map(n.serialize) : p;
1031
+ }, f = (E, p = !0) => fetch(E).then((S) => S.json()).then((S) => (g(S, p), S)), d = (E) => {
1032
+ if (typeof E == "string") {
1033
+ const p = o.getAnnotation(E);
1034
+ if (o.deleteAnnotation(E), p)
1035
+ return n ? n.serialize(p) : p;
1042
1036
  } else {
1043
- const y = n ? n.parse(b).parsed : b;
1044
- if (y)
1045
- return o.deleteAnnotation(y), b;
1037
+ const p = n ? n.parse(E).parsed : E;
1038
+ if (p)
1039
+ return o.deleteAnnotation(p), E;
1046
1040
  }
1047
- }, g = (b, y = !0) => {
1041
+ }, g = (E, p = !0) => {
1048
1042
  if (n) {
1049
- const { parsed: A, failed: w } = eo(n)(b);
1050
- w.length > 0 && console.warn(`Discarded ${w.length} invalid annotations`, w), o.bulkAddAnnotation(A, y, G.REMOTE);
1043
+ const { parsed: S, failed: w } = eo(n)(E);
1044
+ w.length > 0 && console.warn(`Discarded ${w.length} invalid annotations`, w), o.bulkAddAnnotation(S, p, z.REMOTE);
1051
1045
  } else
1052
- o.bulkAddAnnotation(b, y, G.REMOTE);
1053
- }, m = (b) => {
1054
- b ? i.setSelected(b) : i.clear();
1055
- }, _ = (b) => {
1046
+ o.bulkAddAnnotation(E, p, z.REMOTE);
1047
+ }, m = (E) => {
1048
+ E ? i.setSelected(E) : i.clear();
1049
+ }, y = (E) => {
1056
1050
  if (n) {
1057
- const y = n.parse(b).parsed, A = n.serialize(o.getAnnotation(y.id));
1058
- return o.updateAnnotation(y), A;
1051
+ const p = n.parse(E).parsed, S = n.serialize(o.getAnnotation(p.id));
1052
+ return o.updateAnnotation(p), S;
1059
1053
  } else {
1060
- const y = o.getAnnotation(b.id);
1061
- return o.updateAnnotation(b), y;
1054
+ const p = o.getAnnotation(E.id);
1055
+ return o.updateAnnotation(E), p;
1062
1056
  }
1063
1057
  };
1064
1058
  return {
@@ -1072,11 +1066,11 @@ const Zn = 250, Qn = (e) => {
1072
1066
  getSelected: u,
1073
1067
  loadAnnotations: f,
1074
1068
  redo: t.redo,
1075
- removeAnnotation: h,
1069
+ removeAnnotation: d,
1076
1070
  setAnnotations: g,
1077
1071
  setSelected: m,
1078
1072
  undo: t.undo,
1079
- updateAnnotation: _
1073
+ updateAnnotation: y
1080
1074
  };
1081
1075
  }, no = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
1082
1076
  let oo = (e) => crypto.getRandomValues(new Uint8Array(e)), io = (e, t, n) => {
@@ -1156,7 +1150,7 @@ const Yi = (e, t = !1) => ({ parse: (i) => uo(i, t), serialize: (i) => ho(i, e)
1156
1150
  updatedBy: r,
1157
1151
  // Excluded from serialization
1158
1152
  ...l
1159
- } = e.target, a = n.type == j.RECTANGLE ? Tn(n.geometry) : Bn(n), c = {
1153
+ } = e.target, a = n.type == F.RECTANGLE ? Tn(n.geometry) : Bn(n), c = {
1160
1154
  ...e,
1161
1155
  "@context": "http://www.w3.org/ns/anno.jsonld",
1162
1156
  id: e.id,
@@ -1179,7 +1173,7 @@ function wt(e, t, n) {
1179
1173
  }
1180
1174
  function bt(e) {
1181
1175
  let t, n;
1182
- return t = new Le({
1176
+ return t = new ke({
1183
1177
  props: {
1184
1178
  x: (
1185
1179
  /*point*/
@@ -1195,7 +1189,7 @@ function bt(e) {
1195
1189
  )
1196
1190
  }
1197
1191
  }), t.$on("pointerdown", function() {
1198
- q(
1192
+ j(
1199
1193
  /*grab*/
1200
1194
  e[9](`HANDLE-${/*idx*/
1201
1195
  e[12]}`)
@@ -1231,93 +1225,93 @@ function bt(e) {
1231
1225
  };
1232
1226
  }
1233
1227
  function go(e) {
1234
- let t, n, o, i, s, r, l, a, c, u, f, h = Se(
1228
+ let t, n, o, i, s, r, l, a, c, u, f, d = Se(
1235
1229
  /*geom*/
1236
1230
  e[4].points
1237
1231
  ), g = [];
1238
- for (let _ = 0; _ < h.length; _ += 1)
1239
- g[_] = bt(wt(e, h, _));
1240
- const m = (_) => D(g[_], 1, 1, () => {
1241
- g[_] = null;
1232
+ for (let y = 0; y < d.length; y += 1)
1233
+ g[y] = bt(wt(e, d, y));
1234
+ const m = (y) => D(g[y], 1, 1, () => {
1235
+ g[y] = null;
1242
1236
  });
1243
1237
  return {
1244
1238
  c() {
1245
- t = R("polygon"), i = oe(), s = R("polygon"), l = oe();
1246
- for (let _ = 0; _ < g.length; _ += 1)
1247
- g[_].c();
1248
- a = ce(), d(t, "class", "a9s-outer"), d(t, "style", n = /*computedStyle*/
1249
- e[1] ? "display:none;" : void 0), d(t, "points", o = /*geom*/
1250
- e[4].points.map(Et).join(" ")), d(s, "class", "a9s-inner a9s-shape-handle"), d(
1239
+ t = X("polygon"), i = ne(), s = X("polygon"), l = ne();
1240
+ for (let y = 0; y < g.length; y += 1)
1241
+ g[y].c();
1242
+ a = ae(), h(t, "class", "a9s-outer"), h(t, "style", n = /*computedStyle*/
1243
+ e[1] ? "display:none;" : void 0), h(t, "points", o = /*geom*/
1244
+ e[4].points.map(Et).join(" ")), h(s, "class", "a9s-inner a9s-shape-handle"), h(
1251
1245
  s,
1252
1246
  "style",
1253
1247
  /*computedStyle*/
1254
1248
  e[1]
1255
- ), d(s, "points", r = /*geom*/
1249
+ ), h(s, "points", r = /*geom*/
1256
1250
  e[4].points.map(At).join(" "));
1257
1251
  },
1258
- m(_, b) {
1259
- O(_, t, b), O(_, i, b), O(_, s, b), O(_, l, b);
1260
- for (let y = 0; y < g.length; y += 1)
1261
- g[y] && g[y].m(_, b);
1262
- O(_, a, b), c = !0, u || (f = [
1263
- F(t, "pointerdown", function() {
1264
- q(
1252
+ m(y, E) {
1253
+ B(y, t, E), B(y, i, E), B(y, s, E), B(y, l, E);
1254
+ for (let p = 0; p < g.length; p += 1)
1255
+ g[p] && g[p].m(y, E);
1256
+ B(y, a, E), c = !0, u || (f = [
1257
+ H(t, "pointerdown", function() {
1258
+ j(
1265
1259
  /*grab*/
1266
1260
  e[9]("SHAPE")
1267
1261
  ) && e[9]("SHAPE").apply(this, arguments);
1268
1262
  }),
1269
- F(s, "pointerdown", function() {
1270
- q(
1263
+ H(s, "pointerdown", function() {
1264
+ j(
1271
1265
  /*grab*/
1272
1266
  e[9]("SHAPE")
1273
1267
  ) && e[9]("SHAPE").apply(this, arguments);
1274
1268
  })
1275
1269
  ], u = !0);
1276
1270
  },
1277
- p(_, b) {
1278
- if (e = _, (!c || b & /*computedStyle*/
1271
+ p(y, E) {
1272
+ if (e = y, (!c || E & /*computedStyle*/
1279
1273
  2 && n !== (n = /*computedStyle*/
1280
- e[1] ? "display:none;" : void 0)) && d(t, "style", n), (!c || b & /*geom*/
1274
+ e[1] ? "display:none;" : void 0)) && h(t, "style", n), (!c || E & /*geom*/
1281
1275
  16 && o !== (o = /*geom*/
1282
- e[4].points.map(Et).join(" "))) && d(t, "points", o), (!c || b & /*computedStyle*/
1283
- 2) && d(
1276
+ e[4].points.map(Et).join(" "))) && h(t, "points", o), (!c || E & /*computedStyle*/
1277
+ 2) && h(
1284
1278
  s,
1285
1279
  "style",
1286
1280
  /*computedStyle*/
1287
1281
  e[1]
1288
- ), (!c || b & /*geom*/
1282
+ ), (!c || E & /*geom*/
1289
1283
  16 && r !== (r = /*geom*/
1290
- e[4].points.map(At).join(" "))) && d(s, "points", r), b & /*geom, viewportScale, grab*/
1284
+ e[4].points.map(At).join(" "))) && h(s, "points", r), E & /*geom, viewportScale, grab*/
1291
1285
  536) {
1292
- h = Se(
1286
+ d = Se(
1293
1287
  /*geom*/
1294
1288
  e[4].points
1295
1289
  );
1296
- let y;
1297
- for (y = 0; y < h.length; y += 1) {
1298
- const A = wt(e, h, y);
1299
- g[y] ? (g[y].p(A, b), P(g[y], 1)) : (g[y] = bt(A), g[y].c(), P(g[y], 1), g[y].m(a.parentNode, a));
1290
+ let p;
1291
+ for (p = 0; p < d.length; p += 1) {
1292
+ const S = wt(e, d, p);
1293
+ g[p] ? (g[p].p(S, E), P(g[p], 1)) : (g[p] = bt(S), g[p].c(), P(g[p], 1), g[p].m(a.parentNode, a));
1300
1294
  }
1301
- for (re(), y = h.length; y < g.length; y += 1)
1302
- m(y);
1303
- le();
1295
+ for (se(), p = d.length; p < g.length; p += 1)
1296
+ m(p);
1297
+ re();
1304
1298
  }
1305
1299
  },
1306
- i(_) {
1300
+ i(y) {
1307
1301
  if (!c) {
1308
- for (let b = 0; b < h.length; b += 1)
1309
- P(g[b]);
1302
+ for (let E = 0; E < d.length; E += 1)
1303
+ P(g[E]);
1310
1304
  c = !0;
1311
1305
  }
1312
1306
  },
1313
- o(_) {
1307
+ o(y) {
1314
1308
  g = g.filter(Boolean);
1315
- for (let b = 0; b < g.length; b += 1)
1316
- D(g[b]);
1309
+ for (let E = 0; E < g.length; E += 1)
1310
+ D(g[E]);
1317
1311
  c = !1;
1318
1312
  },
1319
- d(_) {
1320
- _ && (L(t), L(i), L(s), L(l), L(a)), rt(g, _), u = !1, ae(f);
1313
+ d(y) {
1314
+ y && (k(t), k(i), k(s), k(l), k(a)), rt(g, y), u = !1, le(f);
1321
1315
  }
1322
1316
  };
1323
1317
  }
@@ -1388,24 +1382,24 @@ function mo(e) {
1388
1382
  const Et = (e) => e.join(","), At = (e) => e.join(",");
1389
1383
  function po(e, t, n) {
1390
1384
  let o, { shape: i } = t, { computedStyle: s } = t, { transform: r } = t, { viewportScale: l = 1 } = t;
1391
- const a = (h, g, m) => {
1392
- let _;
1393
- const b = h.geometry;
1394
- g === "SHAPE" ? _ = b.points.map(([A, w]) => [A + m[0], w + m[1]]) : _ = b.points.map(([A, w], E) => g === `HANDLE-${E}` ? [A + m[0], w + m[1]] : [A, w]);
1395
- const y = Fe(_);
1396
- return { ...h, geometry: { points: _, bounds: y } };
1385
+ const a = (d, g, m) => {
1386
+ let y;
1387
+ const E = d.geometry;
1388
+ g === "SHAPE" ? y = E.points.map(([S, w]) => [S + m[0], w + m[1]]) : y = E.points.map(([S, w], A) => g === `HANDLE-${A}` ? [S + m[0], w + m[1]] : [S, w]);
1389
+ const p = Fe(y);
1390
+ return { ...d, geometry: { points: y, bounds: p } };
1397
1391
  };
1398
- function c(h) {
1399
- ue.call(this, e, h);
1392
+ function c(d) {
1393
+ fe.call(this, e, d);
1400
1394
  }
1401
- function u(h) {
1402
- ue.call(this, e, h);
1395
+ function u(d) {
1396
+ fe.call(this, e, d);
1403
1397
  }
1404
- function f(h) {
1405
- ue.call(this, e, h);
1398
+ function f(d) {
1399
+ fe.call(this, e, d);
1406
1400
  }
1407
- return e.$$set = (h) => {
1408
- "shape" in h && n(0, i = h.shape), "computedStyle" in h && n(1, s = h.computedStyle), "transform" in h && n(2, r = h.transform), "viewportScale" in h && n(3, l = h.viewportScale);
1401
+ return e.$$set = (d) => {
1402
+ "shape" in d && n(0, i = d.shape), "computedStyle" in d && n(1, s = d.computedStyle), "transform" in d && n(2, r = d.transform), "viewportScale" in d && n(3, l = d.viewportScale);
1409
1403
  }, e.$$.update = () => {
1410
1404
  e.$$.dirty & /*shape*/
1411
1405
  1 && n(4, o = i.geometry);
@@ -1423,7 +1417,7 @@ function po(e, t, n) {
1423
1417
  }
1424
1418
  class yo extends te {
1425
1419
  constructor(t) {
1426
- super(), ee(this, t, po, mo, W, {
1420
+ super(), ee(this, t, po, mo, K, {
1427
1421
  shape: 0,
1428
1422
  computedStyle: 1,
1429
1423
  transform: 2,
@@ -1434,28 +1428,28 @@ class yo extends te {
1434
1428
  const Qe = (e, t) => {
1435
1429
  const n = Math.abs(t[0] - e[0]), o = Math.abs(t[1] - e[1]);
1436
1430
  return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
1437
- }, _e = [];
1438
- function _o(e, t = V) {
1431
+ }, ye = [];
1432
+ function _o(e, t = G) {
1439
1433
  let n;
1440
1434
  const o = /* @__PURE__ */ new Set();
1441
1435
  function i(l) {
1442
- if (W(e, l) && (e = l, n)) {
1443
- const a = !_e.length;
1436
+ if (K(e, l) && (e = l, n)) {
1437
+ const a = !ye.length;
1444
1438
  for (const c of o)
1445
- c[1](), _e.push(c, e);
1439
+ c[1](), ye.push(c, e);
1446
1440
  if (a) {
1447
- for (let c = 0; c < _e.length; c += 2)
1448
- _e[c][0](_e[c + 1]);
1449
- _e.length = 0;
1441
+ for (let c = 0; c < ye.length; c += 2)
1442
+ ye[c][0](ye[c + 1]);
1443
+ ye.length = 0;
1450
1444
  }
1451
1445
  }
1452
1446
  }
1453
1447
  function s(l) {
1454
1448
  i(l(e));
1455
1449
  }
1456
- function r(l, a = V) {
1450
+ function r(l, a = G) {
1457
1451
  const c = [l, a];
1458
- return o.add(c), o.size === 1 && (n = t(i, s) || V), l(e), () => {
1452
+ return o.add(c), o.size === 1 && (n = t(i, s) || G), l(e), () => {
1459
1453
  o.delete(c), o.size === 0 && n && (n(), n = null);
1460
1454
  };
1461
1455
  }
@@ -1489,17 +1483,17 @@ function Ao(e) {
1489
1483
  let t, n, o, i, s, r;
1490
1484
  return {
1491
1485
  c() {
1492
- t = R("rect"), d(t, "class", n = Ge(`a9s-handle ${/*$$props*/
1493
- e[8].class || ""}`.trim()) + " svelte-1sgkh33"), d(t, "x", o = /*x*/
1486
+ t = X("rect"), h(t, "class", n = ze(`a9s-handle ${/*$$props*/
1487
+ e[8].class || ""}`.trim()) + " svelte-1sgkh33"), h(t, "x", o = /*x*/
1494
1488
  e[0] - /*handleSize*/
1495
- e[5] / 2), d(t, "y", i = /*y*/
1489
+ e[5] / 2), h(t, "y", i = /*y*/
1496
1490
  e[1] - /*handleSize*/
1497
- e[5] / 2), d(
1491
+ e[5] / 2), h(
1498
1492
  t,
1499
1493
  "width",
1500
1494
  /*handleSize*/
1501
1495
  e[5]
1502
- ), d(
1496
+ ), h(
1503
1497
  t,
1504
1498
  "height",
1505
1499
  /*handleSize*/
@@ -1507,7 +1501,7 @@ function Ao(e) {
1507
1501
  );
1508
1502
  },
1509
1503
  m(l, a) {
1510
- O(l, t, a), s || (r = F(
1504
+ B(l, t, a), s || (r = H(
1511
1505
  t,
1512
1506
  "pointerdown",
1513
1507
  /*pointerdown_handler_2*/
@@ -1516,21 +1510,21 @@ function Ao(e) {
1516
1510
  },
1517
1511
  p(l, a) {
1518
1512
  a & /*$$props*/
1519
- 256 && n !== (n = Ge(`a9s-handle ${/*$$props*/
1520
- l[8].class || ""}`.trim()) + " svelte-1sgkh33") && d(t, "class", n), a & /*x, handleSize*/
1513
+ 256 && n !== (n = ze(`a9s-handle ${/*$$props*/
1514
+ l[8].class || ""}`.trim()) + " svelte-1sgkh33") && h(t, "class", n), a & /*x, handleSize*/
1521
1515
  33 && o !== (o = /*x*/
1522
1516
  l[0] - /*handleSize*/
1523
- l[5] / 2) && d(t, "x", o), a & /*y, handleSize*/
1517
+ l[5] / 2) && h(t, "x", o), a & /*y, handleSize*/
1524
1518
  34 && i !== (i = /*y*/
1525
1519
  l[1] - /*handleSize*/
1526
- l[5] / 2) && d(t, "y", i), a & /*handleSize*/
1527
- 32 && d(
1520
+ l[5] / 2) && h(t, "y", i), a & /*handleSize*/
1521
+ 32 && h(
1528
1522
  t,
1529
1523
  "width",
1530
1524
  /*handleSize*/
1531
1525
  l[5]
1532
1526
  ), a & /*handleSize*/
1533
- 32 && d(
1527
+ 32 && h(
1534
1528
  t,
1535
1529
  "height",
1536
1530
  /*handleSize*/
@@ -1538,7 +1532,7 @@ function Ao(e) {
1538
1532
  );
1539
1533
  },
1540
1534
  d(l) {
1541
- l && L(t), s = !1, r();
1535
+ l && k(t), s = !1, r();
1542
1536
  }
1543
1537
  };
1544
1538
  }
@@ -1546,73 +1540,73 @@ function So(e) {
1546
1540
  let t, n, o, i, s, r, l, a, c;
1547
1541
  return {
1548
1542
  c() {
1549
- t = R("g"), n = R("circle"), i = R("rect"), d(
1543
+ t = X("g"), n = X("circle"), i = X("rect"), h(
1550
1544
  n,
1551
1545
  "cx",
1552
1546
  /*x*/
1553
1547
  e[0]
1554
- ), d(
1548
+ ), h(
1555
1549
  n,
1556
1550
  "cy",
1557
1551
  /*y*/
1558
1552
  e[1]
1559
- ), d(n, "r", o = /*radius*/
1553
+ ), h(n, "r", o = /*radius*/
1560
1554
  e[3] / /*scale*/
1561
- e[2]), d(n, "class", "a9s-touch-halo svelte-1sgkh33"), ze(
1555
+ e[2]), h(n, "class", "a9s-touch-halo svelte-1sgkh33"), Ee(
1562
1556
  n,
1563
1557
  "touched",
1564
1558
  /*touched*/
1565
1559
  e[4]
1566
- ), d(i, "class", s = Ge(`a9s-handle ${/*$$props*/
1567
- e[8].class || ""}`.trim()) + " svelte-1sgkh33"), d(i, "x", r = /*x*/
1560
+ ), h(i, "class", s = ze(`a9s-handle ${/*$$props*/
1561
+ e[8].class || ""}`.trim()) + " svelte-1sgkh33"), h(i, "x", r = /*x*/
1568
1562
  e[0] - /*handleSize*/
1569
- e[5] / 2), d(i, "y", l = /*y*/
1563
+ e[5] / 2), h(i, "y", l = /*y*/
1570
1564
  e[1] - /*handleSize*/
1571
- e[5] / 2), d(
1565
+ e[5] / 2), h(
1572
1566
  i,
1573
1567
  "width",
1574
1568
  /*handleSize*/
1575
1569
  e[5]
1576
- ), d(
1570
+ ), h(
1577
1571
  i,
1578
1572
  "height",
1579
1573
  /*handleSize*/
1580
1574
  e[5]
1581
- ), d(t, "class", "a9s-touch-handle");
1575
+ ), h(t, "class", "a9s-touch-handle");
1582
1576
  },
1583
1577
  m(u, f) {
1584
- O(u, t, f), se(t, n), se(t, i), a || (c = [
1585
- F(
1578
+ B(u, t, f), ie(t, n), ie(t, i), a || (c = [
1579
+ H(
1586
1580
  n,
1587
1581
  "pointerdown",
1588
1582
  /*pointerdown_handler*/
1589
1583
  e[10]
1590
1584
  ),
1591
- F(
1585
+ H(
1592
1586
  n,
1593
1587
  "pointerdown",
1594
1588
  /*onPointerDown*/
1595
1589
  e[6]
1596
1590
  ),
1597
- F(
1591
+ H(
1598
1592
  n,
1599
1593
  "pointerup",
1600
1594
  /*onPointerUp*/
1601
1595
  e[7]
1602
1596
  ),
1603
- F(
1597
+ H(
1604
1598
  i,
1605
1599
  "pointerdown",
1606
1600
  /*pointerdown_handler_1*/
1607
1601
  e[9]
1608
1602
  ),
1609
- F(
1603
+ H(
1610
1604
  i,
1611
1605
  "pointerdown",
1612
1606
  /*onPointerDown*/
1613
1607
  e[6]
1614
1608
  ),
1615
- F(
1609
+ H(
1616
1610
  i,
1617
1611
  "pointerup",
1618
1612
  /*onPointerUp*/
@@ -1622,13 +1616,13 @@ function So(e) {
1622
1616
  },
1623
1617
  p(u, f) {
1624
1618
  f & /*x*/
1625
- 1 && d(
1619
+ 1 && h(
1626
1620
  n,
1627
1621
  "cx",
1628
1622
  /*x*/
1629
1623
  u[0]
1630
1624
  ), f & /*y*/
1631
- 2 && d(
1625
+ 2 && h(
1632
1626
  n,
1633
1627
  "cy",
1634
1628
  /*y*/
@@ -1636,28 +1630,28 @@ function So(e) {
1636
1630
  ), f & /*radius, scale*/
1637
1631
  12 && o !== (o = /*radius*/
1638
1632
  u[3] / /*scale*/
1639
- u[2]) && d(n, "r", o), f & /*touched*/
1640
- 16 && ze(
1633
+ u[2]) && h(n, "r", o), f & /*touched*/
1634
+ 16 && Ee(
1641
1635
  n,
1642
1636
  "touched",
1643
1637
  /*touched*/
1644
1638
  u[4]
1645
1639
  ), f & /*$$props*/
1646
- 256 && s !== (s = Ge(`a9s-handle ${/*$$props*/
1647
- u[8].class || ""}`.trim()) + " svelte-1sgkh33") && d(i, "class", s), f & /*x, handleSize*/
1640
+ 256 && s !== (s = ze(`a9s-handle ${/*$$props*/
1641
+ u[8].class || ""}`.trim()) + " svelte-1sgkh33") && h(i, "class", s), f & /*x, handleSize*/
1648
1642
  33 && r !== (r = /*x*/
1649
1643
  u[0] - /*handleSize*/
1650
- u[5] / 2) && d(i, "x", r), f & /*y, handleSize*/
1644
+ u[5] / 2) && h(i, "x", r), f & /*y, handleSize*/
1651
1645
  34 && l !== (l = /*y*/
1652
1646
  u[1] - /*handleSize*/
1653
- u[5] / 2) && d(i, "y", l), f & /*handleSize*/
1654
- 32 && d(
1647
+ u[5] / 2) && h(i, "y", l), f & /*handleSize*/
1648
+ 32 && h(
1655
1649
  i,
1656
1650
  "width",
1657
1651
  /*handleSize*/
1658
1652
  u[5]
1659
1653
  ), f & /*handleSize*/
1660
- 32 && d(
1654
+ 32 && h(
1661
1655
  i,
1662
1656
  "height",
1663
1657
  /*handleSize*/
@@ -1665,7 +1659,7 @@ function So(e) {
1665
1659
  );
1666
1660
  },
1667
1661
  d(u) {
1668
- u && L(t), a = !1, ae(c);
1662
+ u && k(t), a = !1, le(c);
1669
1663
  }
1670
1664
  };
1671
1665
  }
@@ -1677,18 +1671,18 @@ function To(e) {
1677
1671
  let i = n()(e);
1678
1672
  return {
1679
1673
  c() {
1680
- i.c(), t = ce();
1674
+ i.c(), t = ae();
1681
1675
  },
1682
1676
  m(s, r) {
1683
- i.m(s, r), O(s, t, r);
1677
+ i.m(s, r), B(s, t, r);
1684
1678
  },
1685
1679
  p(s, [r]) {
1686
1680
  i.p(s, r);
1687
1681
  },
1688
- i: V,
1689
- o: V,
1682
+ i: G,
1683
+ o: G,
1690
1684
  d(s) {
1691
- s && L(t), i.d(s);
1685
+ s && k(t), i.d(s);
1692
1686
  }
1693
1687
  };
1694
1688
  }
@@ -1698,13 +1692,13 @@ function Mo(e, t, n) {
1698
1692
  m.pointerType === "touch" && n(4, a = !0);
1699
1693
  }, u = () => n(4, a = !1);
1700
1694
  function f(m) {
1701
- ue.call(this, e, m);
1695
+ fe.call(this, e, m);
1702
1696
  }
1703
- function h(m) {
1704
- ue.call(this, e, m);
1697
+ function d(m) {
1698
+ fe.call(this, e, m);
1705
1699
  }
1706
1700
  function g(m) {
1707
- ue.call(this, e, m);
1701
+ fe.call(this, e, m);
1708
1702
  }
1709
1703
  return e.$$set = (m) => {
1710
1704
  n(8, t = nt(nt({}, t), gt(m))), "x" in m && n(0, i = m.x), "y" in m && n(1, s = m.y), "scale" in m && n(2, r = m.scale), "radius" in m && n(3, l = m.radius);
@@ -1722,18 +1716,18 @@ function Mo(e, t, n) {
1722
1716
  u,
1723
1717
  t,
1724
1718
  f,
1725
- h,
1719
+ d,
1726
1720
  g
1727
1721
  ];
1728
1722
  }
1729
- class Le extends te {
1723
+ class ke extends te {
1730
1724
  constructor(t) {
1731
- super(), ee(this, t, Mo, To, W, { x: 0, y: 1, scale: 2, radius: 3 });
1725
+ super(), ee(this, t, Mo, To, K, { x: 0, y: 1, scale: 2, radius: 3 });
1732
1726
  }
1733
1727
  }
1734
1728
  function vo(e) {
1735
- let t, n, o, i, s, r, l, a, c, u, f, h, g, m, _, b, y, A, w, E, B, U, X, p, T, S, M, k, C, Z, ge, me, Me, ie, I, z, H, J, fe, ne, N, qe, ut;
1736
- return ie = new Le({
1729
+ let t, n, o, i, s, r, l, a, c, u, f, d, g, m, y, E, p, S, w, A, I, N, U, _, b, T, M, O, Y, Z, he, ge, Me, oe, ve, L, W, V, ce, J, R, qe, ut;
1730
+ return oe = new ke({
1737
1731
  props: {
1738
1732
  class: "a9s-corner-handle-topleft",
1739
1733
  x: (
@@ -1749,12 +1743,12 @@ function vo(e) {
1749
1743
  e[3]
1750
1744
  )
1751
1745
  }
1752
- }), ie.$on("pointerdown", function() {
1753
- q(
1746
+ }), oe.$on("pointerdown", function() {
1747
+ j(
1754
1748
  /*grab*/
1755
1749
  e[9]("TOP_LEFT")
1756
1750
  ) && e[9]("TOP_LEFT").apply(this, arguments);
1757
- }), z = new Le({
1751
+ }), L = new ke({
1758
1752
  props: {
1759
1753
  class: "a9s-corner-handle-topright",
1760
1754
  x: (
@@ -1771,12 +1765,12 @@ function vo(e) {
1771
1765
  e[3]
1772
1766
  )
1773
1767
  }
1774
- }), z.$on("pointerdown", function() {
1775
- q(
1768
+ }), L.$on("pointerdown", function() {
1769
+ j(
1776
1770
  /*grab*/
1777
1771
  e[9]("TOP_RIGHT")
1778
1772
  ) && e[9]("TOP_RIGHT").apply(this, arguments);
1779
- }), J = new Le({
1773
+ }), V = new ke({
1780
1774
  props: {
1781
1775
  class: "a9s-corner-handle-bottomright",
1782
1776
  x: (
@@ -1794,12 +1788,12 @@ function vo(e) {
1794
1788
  e[3]
1795
1789
  )
1796
1790
  }
1797
- }), J.$on("pointerdown", function() {
1798
- q(
1791
+ }), V.$on("pointerdown", function() {
1792
+ j(
1799
1793
  /*grab*/
1800
1794
  e[9]("BOTTOM_RIGHT")
1801
1795
  ) && e[9]("BOTTOM_RIGHT").apply(this, arguments);
1802
- }), ne = new Le({
1796
+ }), J = new ke({
1803
1797
  props: {
1804
1798
  class: "a9s-corner-handle-bottomleft",
1805
1799
  x: (
@@ -1816,180 +1810,180 @@ function vo(e) {
1816
1810
  e[3]
1817
1811
  )
1818
1812
  }
1819
- }), ne.$on("pointerdown", function() {
1820
- q(
1813
+ }), J.$on("pointerdown", function() {
1814
+ j(
1821
1815
  /*grab*/
1822
1816
  e[9]("BOTTOM_LEFT")
1823
1817
  ) && e[9]("BOTTOM_LEFT").apply(this, arguments);
1824
1818
  }), {
1825
1819
  c() {
1826
- t = R("rect"), l = oe(), a = R("rect"), g = oe(), m = R("rect"), A = oe(), w = R("rect"), X = oe(), p = R("rect"), k = oe(), C = R("rect"), Me = oe(), $(ie.$$.fragment), I = oe(), $(z.$$.fragment), H = oe(), $(J.$$.fragment), fe = oe(), $(ne.$$.fragment), d(t, "class", "a9s-outer"), d(t, "style", n = /*computedStyle*/
1827
- e[1] ? "display:none;" : void 0), d(t, "x", o = /*geom*/
1828
- e[4].x), d(t, "y", i = /*geom*/
1829
- e[4].y), d(t, "width", s = /*geom*/
1830
- e[4].w), d(t, "height", r = /*geom*/
1831
- e[4].h), d(a, "class", "a9s-inner a9s-shape-handle"), d(
1820
+ t = X("rect"), l = ne(), a = X("rect"), g = ne(), m = X("rect"), S = ne(), w = X("rect"), U = ne(), _ = X("rect"), O = ne(), Y = X("rect"), Me = ne(), $(oe.$$.fragment), ve = ne(), $(L.$$.fragment), W = ne(), $(V.$$.fragment), ce = ne(), $(J.$$.fragment), h(t, "class", "a9s-outer"), h(t, "style", n = /*computedStyle*/
1821
+ e[1] ? "display:none;" : void 0), h(t, "x", o = /*geom*/
1822
+ e[4].x), h(t, "y", i = /*geom*/
1823
+ e[4].y), h(t, "width", s = /*geom*/
1824
+ e[4].w), h(t, "height", r = /*geom*/
1825
+ e[4].h), h(a, "class", "a9s-inner a9s-shape-handle"), h(
1832
1826
  a,
1833
1827
  "style",
1834
1828
  /*computedStyle*/
1835
1829
  e[1]
1836
- ), d(a, "x", c = /*geom*/
1837
- e[4].x), d(a, "y", u = /*geom*/
1838
- e[4].y), d(a, "width", f = /*geom*/
1839
- e[4].w), d(a, "height", h = /*geom*/
1840
- e[4].h), d(m, "class", "a9s-edge-handle a9s-edge-handle-top"), d(m, "x", _ = /*geom*/
1841
- e[4].x), d(m, "y", b = /*geom*/
1842
- e[4].y), d(m, "height", 1), d(m, "width", y = /*geom*/
1843
- e[4].w), d(w, "class", "a9s-edge-handle a9s-edge-handle-right"), d(w, "x", E = /*geom*/
1830
+ ), h(a, "x", c = /*geom*/
1831
+ e[4].x), h(a, "y", u = /*geom*/
1832
+ e[4].y), h(a, "width", f = /*geom*/
1833
+ e[4].w), h(a, "height", d = /*geom*/
1834
+ e[4].h), h(m, "class", "a9s-edge-handle a9s-edge-handle-top"), h(m, "x", y = /*geom*/
1835
+ e[4].x), h(m, "y", E = /*geom*/
1836
+ e[4].y), h(m, "height", 1), h(m, "width", p = /*geom*/
1837
+ e[4].w), h(w, "class", "a9s-edge-handle a9s-edge-handle-right"), h(w, "x", A = /*geom*/
1844
1838
  e[4].x + /*geom*/
1845
- e[4].w), d(w, "y", B = /*geom*/
1846
- e[4].y), d(w, "height", U = /*geom*/
1847
- e[4].h), d(w, "width", 1), d(p, "class", "a9s-edge-handle a9s-edge-handle-bottom"), d(p, "x", T = /*geom*/
1848
- e[4].x), d(p, "y", S = /*geom*/
1839
+ e[4].w), h(w, "y", I = /*geom*/
1840
+ e[4].y), h(w, "height", N = /*geom*/
1841
+ e[4].h), h(w, "width", 1), h(_, "class", "a9s-edge-handle a9s-edge-handle-bottom"), h(_, "x", b = /*geom*/
1842
+ e[4].x), h(_, "y", T = /*geom*/
1849
1843
  e[4].y + /*geom*/
1850
- e[4].h), d(p, "height", 1), d(p, "width", M = /*geom*/
1851
- e[4].w), d(C, "class", "a9s-edge-handle a9s-edge-handle-left"), d(C, "x", Z = /*geom*/
1852
- e[4].x), d(C, "y", ge = /*geom*/
1853
- e[4].y), d(C, "height", me = /*geom*/
1854
- e[4].h), d(C, "width", 1);
1855
- },
1856
- m(Y, v) {
1857
- O(Y, t, v), O(Y, l, v), O(Y, a, v), O(Y, g, v), O(Y, m, v), O(Y, A, v), O(Y, w, v), O(Y, X, v), O(Y, p, v), O(Y, k, v), O(Y, C, v), O(Y, Me, v), Q(ie, Y, v), O(Y, I, v), Q(z, Y, v), O(Y, H, v), Q(J, Y, v), O(Y, fe, v), Q(ne, Y, v), N = !0, qe || (ut = [
1858
- F(t, "pointerdown", function() {
1859
- q(
1844
+ e[4].h), h(_, "height", 1), h(_, "width", M = /*geom*/
1845
+ e[4].w), h(Y, "class", "a9s-edge-handle a9s-edge-handle-left"), h(Y, "x", Z = /*geom*/
1846
+ e[4].x), h(Y, "y", he = /*geom*/
1847
+ e[4].y), h(Y, "height", ge = /*geom*/
1848
+ e[4].h), h(Y, "width", 1);
1849
+ },
1850
+ m(C, v) {
1851
+ B(C, t, v), B(C, l, v), B(C, a, v), B(C, g, v), B(C, m, v), B(C, S, v), B(C, w, v), B(C, U, v), B(C, _, v), B(C, O, v), B(C, Y, v), B(C, Me, v), Q(oe, C, v), B(C, ve, v), Q(L, C, v), B(C, W, v), Q(V, C, v), B(C, ce, v), Q(J, C, v), R = !0, qe || (ut = [
1852
+ H(t, "pointerdown", function() {
1853
+ j(
1860
1854
  /*grab*/
1861
1855
  e[9]("SHAPE")
1862
1856
  ) && e[9]("SHAPE").apply(this, arguments);
1863
1857
  }),
1864
- F(a, "pointerdown", function() {
1865
- q(
1858
+ H(a, "pointerdown", function() {
1859
+ j(
1866
1860
  /*grab*/
1867
1861
  e[9]("SHAPE")
1868
1862
  ) && e[9]("SHAPE").apply(this, arguments);
1869
1863
  }),
1870
- F(m, "pointerdown", function() {
1871
- q(
1864
+ H(m, "pointerdown", function() {
1865
+ j(
1872
1866
  /*grab*/
1873
1867
  e[9]("TOP")
1874
1868
  ) && e[9]("TOP").apply(this, arguments);
1875
1869
  }),
1876
- F(w, "pointerdown", function() {
1877
- q(
1870
+ H(w, "pointerdown", function() {
1871
+ j(
1878
1872
  /*grab*/
1879
1873
  e[9]("RIGHT")
1880
1874
  ) && e[9]("RIGHT").apply(this, arguments);
1881
1875
  }),
1882
- F(p, "pointerdown", function() {
1883
- q(
1876
+ H(_, "pointerdown", function() {
1877
+ j(
1884
1878
  /*grab*/
1885
1879
  e[9]("BOTTOM")
1886
1880
  ) && e[9]("BOTTOM").apply(this, arguments);
1887
1881
  }),
1888
- F(C, "pointerdown", function() {
1889
- q(
1882
+ H(Y, "pointerdown", function() {
1883
+ j(
1890
1884
  /*grab*/
1891
1885
  e[9]("LEFT")
1892
1886
  ) && e[9]("LEFT").apply(this, arguments);
1893
1887
  })
1894
1888
  ], qe = !0);
1895
1889
  },
1896
- p(Y, v) {
1897
- e = Y, (!N || v & /*computedStyle*/
1890
+ p(C, v) {
1891
+ e = C, (!R || v & /*computedStyle*/
1898
1892
  2 && n !== (n = /*computedStyle*/
1899
- e[1] ? "display:none;" : void 0)) && d(t, "style", n), (!N || v & /*geom*/
1893
+ e[1] ? "display:none;" : void 0)) && h(t, "style", n), (!R || v & /*geom*/
1900
1894
  16 && o !== (o = /*geom*/
1901
- e[4].x)) && d(t, "x", o), (!N || v & /*geom*/
1895
+ e[4].x)) && h(t, "x", o), (!R || v & /*geom*/
1902
1896
  16 && i !== (i = /*geom*/
1903
- e[4].y)) && d(t, "y", i), (!N || v & /*geom*/
1897
+ e[4].y)) && h(t, "y", i), (!R || v & /*geom*/
1904
1898
  16 && s !== (s = /*geom*/
1905
- e[4].w)) && d(t, "width", s), (!N || v & /*geom*/
1899
+ e[4].w)) && h(t, "width", s), (!R || v & /*geom*/
1906
1900
  16 && r !== (r = /*geom*/
1907
- e[4].h)) && d(t, "height", r), (!N || v & /*computedStyle*/
1908
- 2) && d(
1901
+ e[4].h)) && h(t, "height", r), (!R || v & /*computedStyle*/
1902
+ 2) && h(
1909
1903
  a,
1910
1904
  "style",
1911
1905
  /*computedStyle*/
1912
1906
  e[1]
1913
- ), (!N || v & /*geom*/
1907
+ ), (!R || v & /*geom*/
1914
1908
  16 && c !== (c = /*geom*/
1915
- e[4].x)) && d(a, "x", c), (!N || v & /*geom*/
1909
+ e[4].x)) && h(a, "x", c), (!R || v & /*geom*/
1916
1910
  16 && u !== (u = /*geom*/
1917
- e[4].y)) && d(a, "y", u), (!N || v & /*geom*/
1911
+ e[4].y)) && h(a, "y", u), (!R || v & /*geom*/
1918
1912
  16 && f !== (f = /*geom*/
1919
- e[4].w)) && d(a, "width", f), (!N || v & /*geom*/
1920
- 16 && h !== (h = /*geom*/
1921
- e[4].h)) && d(a, "height", h), (!N || v & /*geom*/
1922
- 16 && _ !== (_ = /*geom*/
1923
- e[4].x)) && d(m, "x", _), (!N || v & /*geom*/
1924
- 16 && b !== (b = /*geom*/
1925
- e[4].y)) && d(m, "y", b), (!N || v & /*geom*/
1913
+ e[4].w)) && h(a, "width", f), (!R || v & /*geom*/
1914
+ 16 && d !== (d = /*geom*/
1915
+ e[4].h)) && h(a, "height", d), (!R || v & /*geom*/
1926
1916
  16 && y !== (y = /*geom*/
1927
- e[4].w)) && d(m, "width", y), (!N || v & /*geom*/
1917
+ e[4].x)) && h(m, "x", y), (!R || v & /*geom*/
1928
1918
  16 && E !== (E = /*geom*/
1919
+ e[4].y)) && h(m, "y", E), (!R || v & /*geom*/
1920
+ 16 && p !== (p = /*geom*/
1921
+ e[4].w)) && h(m, "width", p), (!R || v & /*geom*/
1922
+ 16 && A !== (A = /*geom*/
1929
1923
  e[4].x + /*geom*/
1930
- e[4].w)) && d(w, "x", E), (!N || v & /*geom*/
1931
- 16 && B !== (B = /*geom*/
1932
- e[4].y)) && d(w, "y", B), (!N || v & /*geom*/
1933
- 16 && U !== (U = /*geom*/
1934
- e[4].h)) && d(w, "height", U), (!N || v & /*geom*/
1924
+ e[4].w)) && h(w, "x", A), (!R || v & /*geom*/
1925
+ 16 && I !== (I = /*geom*/
1926
+ e[4].y)) && h(w, "y", I), (!R || v & /*geom*/
1927
+ 16 && N !== (N = /*geom*/
1928
+ e[4].h)) && h(w, "height", N), (!R || v & /*geom*/
1929
+ 16 && b !== (b = /*geom*/
1930
+ e[4].x)) && h(_, "x", b), (!R || v & /*geom*/
1935
1931
  16 && T !== (T = /*geom*/
1936
- e[4].x)) && d(p, "x", T), (!N || v & /*geom*/
1937
- 16 && S !== (S = /*geom*/
1938
1932
  e[4].y + /*geom*/
1939
- e[4].h)) && d(p, "y", S), (!N || v & /*geom*/
1933
+ e[4].h)) && h(_, "y", T), (!R || v & /*geom*/
1940
1934
  16 && M !== (M = /*geom*/
1941
- e[4].w)) && d(p, "width", M), (!N || v & /*geom*/
1935
+ e[4].w)) && h(_, "width", M), (!R || v & /*geom*/
1942
1936
  16 && Z !== (Z = /*geom*/
1943
- e[4].x)) && d(C, "x", Z), (!N || v & /*geom*/
1937
+ e[4].x)) && h(Y, "x", Z), (!R || v & /*geom*/
1938
+ 16 && he !== (he = /*geom*/
1939
+ e[4].y)) && h(Y, "y", he), (!R || v & /*geom*/
1944
1940
  16 && ge !== (ge = /*geom*/
1945
- e[4].y)) && d(C, "y", ge), (!N || v & /*geom*/
1946
- 16 && me !== (me = /*geom*/
1947
- e[4].h)) && d(C, "height", me);
1948
- const Ye = {};
1949
- v & /*geom*/
1950
- 16 && (Ye.x = /*geom*/
1951
- e[4].x), v & /*geom*/
1952
- 16 && (Ye.y = /*geom*/
1953
- e[4].y), v & /*viewportScale*/
1954
- 8 && (Ye.scale = /*viewportScale*/
1955
- e[3]), ie.$set(Ye);
1941
+ e[4].h)) && h(Y, "height", ge);
1956
1942
  const Ce = {};
1957
1943
  v & /*geom*/
1958
1944
  16 && (Ce.x = /*geom*/
1959
- e[4].x + /*geom*/
1960
- e[4].w), v & /*geom*/
1945
+ e[4].x), v & /*geom*/
1961
1946
  16 && (Ce.y = /*geom*/
1962
1947
  e[4].y), v & /*viewportScale*/
1963
1948
  8 && (Ce.scale = /*viewportScale*/
1964
- e[3]), z.$set(Ce);
1949
+ e[3]), oe.$set(Ce);
1965
1950
  const De = {};
1966
1951
  v & /*geom*/
1967
1952
  16 && (De.x = /*geom*/
1968
1953
  e[4].x + /*geom*/
1969
1954
  e[4].w), v & /*geom*/
1970
1955
  16 && (De.y = /*geom*/
1971
- e[4].y + /*geom*/
1972
- e[4].h), v & /*viewportScale*/
1956
+ e[4].y), v & /*viewportScale*/
1973
1957
  8 && (De.scale = /*viewportScale*/
1974
- e[3]), J.$set(De);
1958
+ e[3]), L.$set(De);
1975
1959
  const Xe = {};
1976
1960
  v & /*geom*/
1977
1961
  16 && (Xe.x = /*geom*/
1978
- e[4].x), v & /*geom*/
1962
+ e[4].x + /*geom*/
1963
+ e[4].w), v & /*geom*/
1979
1964
  16 && (Xe.y = /*geom*/
1980
1965
  e[4].y + /*geom*/
1981
1966
  e[4].h), v & /*viewportScale*/
1982
1967
  8 && (Xe.scale = /*viewportScale*/
1983
- e[3]), ne.$set(Xe);
1968
+ e[3]), V.$set(Xe);
1969
+ const Re = {};
1970
+ v & /*geom*/
1971
+ 16 && (Re.x = /*geom*/
1972
+ e[4].x), v & /*geom*/
1973
+ 16 && (Re.y = /*geom*/
1974
+ e[4].y + /*geom*/
1975
+ e[4].h), v & /*viewportScale*/
1976
+ 8 && (Re.scale = /*viewportScale*/
1977
+ e[3]), J.$set(Re);
1984
1978
  },
1985
- i(Y) {
1986
- N || (P(ie.$$.fragment, Y), P(z.$$.fragment, Y), P(J.$$.fragment, Y), P(ne.$$.fragment, Y), N = !0);
1979
+ i(C) {
1980
+ R || (P(oe.$$.fragment, C), P(L.$$.fragment, C), P(V.$$.fragment, C), P(J.$$.fragment, C), R = !0);
1987
1981
  },
1988
- o(Y) {
1989
- D(ie.$$.fragment, Y), D(z.$$.fragment, Y), D(J.$$.fragment, Y), D(ne.$$.fragment, Y), N = !1;
1982
+ o(C) {
1983
+ D(oe.$$.fragment, C), D(L.$$.fragment, C), D(V.$$.fragment, C), D(J.$$.fragment, C), R = !1;
1990
1984
  },
1991
- d(Y) {
1992
- Y && (L(t), L(l), L(a), L(g), L(m), L(A), L(w), L(X), L(p), L(k), L(C), L(Me), L(I), L(H), L(fe)), x(ie, Y), x(z, Y), x(J, Y), x(ne, Y), qe = !1, ae(ut);
1985
+ d(C) {
1986
+ C && (k(t), k(l), k(a), k(g), k(m), k(S), k(w), k(U), k(_), k(O), k(Y), k(Me), k(ve), k(W), k(ce)), x(oe, C), x(L, C), x(V, C), x(J, C), qe = !1, le(ut);
1993
1987
  }
1994
1988
  };
1995
1989
  }
@@ -2059,24 +2053,24 @@ function Lo(e) {
2059
2053
  }
2060
2054
  function ko(e, t, n) {
2061
2055
  let o, { shape: i } = t, { computedStyle: s } = t, { transform: r } = t, { viewportScale: l = 1 } = t;
2062
- const a = (h, g, m) => {
2063
- const _ = h.geometry.bounds;
2064
- let [b, y] = [_.minX, _.minY], [A, w] = [_.maxX, _.maxY];
2065
- const [E, B] = m;
2056
+ const a = (d, g, m) => {
2057
+ const y = d.geometry.bounds;
2058
+ let [E, p] = [y.minX, y.minY], [S, w] = [y.maxX, y.maxY];
2059
+ const [A, I] = m;
2066
2060
  if (g === "SHAPE")
2067
- b += E, A += E, y += B, w += B;
2061
+ E += A, S += A, p += I, w += I;
2068
2062
  else {
2069
2063
  switch (g) {
2070
2064
  case "TOP":
2071
2065
  case "TOP_LEFT":
2072
2066
  case "TOP_RIGHT": {
2073
- y += B;
2067
+ p += I;
2074
2068
  break;
2075
2069
  }
2076
2070
  case "BOTTOM":
2077
2071
  case "BOTTOM_LEFT":
2078
2072
  case "BOTTOM_RIGHT": {
2079
- w += B;
2073
+ w += I;
2080
2074
  break;
2081
2075
  }
2082
2076
  }
@@ -2084,45 +2078,45 @@ function ko(e, t, n) {
2084
2078
  case "LEFT":
2085
2079
  case "TOP_LEFT":
2086
2080
  case "BOTTOM_LEFT": {
2087
- b += E;
2081
+ E += A;
2088
2082
  break;
2089
2083
  }
2090
2084
  case "RIGHT":
2091
2085
  case "TOP_RIGHT":
2092
2086
  case "BOTTOM_RIGHT": {
2093
- A += E;
2087
+ S += A;
2094
2088
  break;
2095
2089
  }
2096
2090
  }
2097
2091
  }
2098
- const U = Math.min(b, A), X = Math.min(y, w), p = Math.abs(A - b), T = Math.abs(w - y);
2092
+ const N = Math.min(E, S), U = Math.min(p, w), _ = Math.abs(S - E), b = Math.abs(w - p);
2099
2093
  return {
2100
- ...h,
2094
+ ...d,
2101
2095
  geometry: {
2102
- x: U,
2103
- y: X,
2104
- w: p,
2105
- h: T,
2096
+ x: N,
2097
+ y: U,
2098
+ w: _,
2099
+ h: b,
2106
2100
  bounds: {
2107
- minX: U,
2108
- minY: X,
2109
- maxX: U + p,
2110
- maxY: X + T
2101
+ minX: N,
2102
+ minY: U,
2103
+ maxX: N + _,
2104
+ maxY: U + b
2111
2105
  }
2112
2106
  }
2113
2107
  };
2114
2108
  };
2115
- function c(h) {
2116
- ue.call(this, e, h);
2109
+ function c(d) {
2110
+ fe.call(this, e, d);
2117
2111
  }
2118
- function u(h) {
2119
- ue.call(this, e, h);
2112
+ function u(d) {
2113
+ fe.call(this, e, d);
2120
2114
  }
2121
- function f(h) {
2122
- ue.call(this, e, h);
2115
+ function f(d) {
2116
+ fe.call(this, e, d);
2123
2117
  }
2124
- return e.$$set = (h) => {
2125
- "shape" in h && n(0, i = h.shape), "computedStyle" in h && n(1, s = h.computedStyle), "transform" in h && n(2, r = h.transform), "viewportScale" in h && n(3, l = h.viewportScale);
2118
+ return e.$$set = (d) => {
2119
+ "shape" in d && n(0, i = d.shape), "computedStyle" in d && n(1, s = d.computedStyle), "transform" in d && n(2, r = d.transform), "viewportScale" in d && n(3, l = d.viewportScale);
2126
2120
  }, e.$$.update = () => {
2127
2121
  e.$$.dirty & /*shape*/
2128
2122
  1 && n(4, o = i.geometry);
@@ -2140,7 +2134,7 @@ function ko(e, t, n) {
2140
2134
  }
2141
2135
  class Oo extends te {
2142
2136
  constructor(t) {
2143
- super(), ee(this, t, ko, Lo, W, {
2137
+ super(), ee(this, t, ko, Lo, K, {
2144
2138
  shape: 0,
2145
2139
  computedStyle: 1,
2146
2140
  transform: 2,
@@ -2149,8 +2143,8 @@ class Oo extends te {
2149
2143
  }
2150
2144
  }
2151
2145
  const Zt = /* @__PURE__ */ new Map([
2152
- [j.RECTANGLE, Oo],
2153
- [j.POLYGON, yo]
2146
+ [F.RECTANGLE, Oo],
2147
+ [F.POLYGON, yo]
2154
2148
  ]), Bo = (e) => Zt.get(e.type), Io = (e, t) => Zt.set(e, t), Po = (e) => ({}), St = (e) => ({ grab: (
2155
2149
  /*onGrab*/
2156
2150
  e[0]
@@ -2169,17 +2163,17 @@ function Yo(e) {
2169
2163
  );
2170
2164
  return {
2171
2165
  c() {
2172
- t = R("g"), r && r.c(), d(t, "class", "a9s-annotation selected");
2166
+ t = X("g"), r && r.c(), h(t, "class", "a9s-annotation selected");
2173
2167
  },
2174
2168
  m(l, a) {
2175
- O(l, t, a), r && r.m(t, null), n = !0, o || (i = [
2176
- F(
2169
+ B(l, t, a), r && r.m(t, null), n = !0, o || (i = [
2170
+ H(
2177
2171
  t,
2178
2172
  "pointerup",
2179
2173
  /*onRelease*/
2180
2174
  e[2]
2181
2175
  ),
2182
- F(
2176
+ H(
2183
2177
  t,
2184
2178
  "pointermove",
2185
2179
  /*onPointerMove*/
@@ -2215,7 +2209,7 @@ function Yo(e) {
2215
2209
  D(r, l), n = !1;
2216
2210
  },
2217
2211
  d(l) {
2218
- l && L(t), r && r.d(l), o = !1, ae(i);
2212
+ l && k(t), r && r.d(l), o = !1, le(i);
2219
2213
  }
2220
2214
  };
2221
2215
  }
@@ -2223,23 +2217,23 @@ function Co(e, t, n) {
2223
2217
  let { $$slots: o = {}, $$scope: i } = t;
2224
2218
  const s = Te();
2225
2219
  let { shape: r } = t, { editor: l } = t, { transform: a } = t, c, u, f;
2226
- const h = (_) => (b) => {
2227
- c = _, u = a.elementToImage(b.offsetX, b.offsetY), f = r, b.target.setPointerCapture(b.pointerId), s("grab", b);
2228
- }, g = (_) => {
2220
+ const d = (y) => (E) => {
2221
+ c = y, u = a.elementToImage(E.offsetX, E.offsetY), f = r, E.target.setPointerCapture(E.pointerId), s("grab", E);
2222
+ }, g = (y) => {
2229
2223
  if (c) {
2230
- const [b, y] = a.elementToImage(_.offsetX, _.offsetY), A = [b - u[0], y - u[1]];
2231
- n(3, r = l(f, c, A)), s("change", r);
2224
+ const [E, p] = a.elementToImage(y.offsetX, y.offsetY), S = [E - u[0], p - u[1]];
2225
+ n(3, r = l(f, c, S)), s("change", r);
2232
2226
  }
2233
- }, m = (_) => {
2234
- _.target.releasePointerCapture(_.pointerId), c = void 0, f = r, s("release", _);
2227
+ }, m = (y) => {
2228
+ y.target.releasePointerCapture(y.pointerId), c = void 0, f = r, s("release", y);
2235
2229
  };
2236
- return e.$$set = (_) => {
2237
- "shape" in _ && n(3, r = _.shape), "editor" in _ && n(4, l = _.editor), "transform" in _ && n(5, a = _.transform), "$$scope" in _ && n(6, i = _.$$scope);
2238
- }, [h, g, m, r, l, a, i, o];
2230
+ return e.$$set = (y) => {
2231
+ "shape" in y && n(3, r = y.shape), "editor" in y && n(4, l = y.editor), "transform" in y && n(5, a = y.transform), "$$scope" in y && n(6, i = y.$$scope);
2232
+ }, [d, g, m, r, l, a, i, o];
2239
2233
  }
2240
2234
  class Qt extends te {
2241
2235
  constructor(t) {
2242
- super(), ee(this, t, Co, Yo, W, { shape: 3, editor: 4, transform: 5 });
2236
+ super(), ee(this, t, Co, Yo, K, { shape: 3, editor: 4, transform: 5 });
2243
2237
  }
2244
2238
  }
2245
2239
  const je = (e, t) => {
@@ -2254,7 +2248,7 @@ function Do(e, t, n) {
2254
2248
  let o;
2255
2249
  const i = Te();
2256
2250
  let { annotation: s } = t, { editor: r } = t, { style: l } = t, { target: a } = t, { transform: c } = t, { viewportScale: u } = t, f;
2257
- return Pe(() => (n(6, f = new r({
2251
+ return Ye(() => (n(6, f = new r({
2258
2252
  target: a,
2259
2253
  props: {
2260
2254
  shape: s.target.selector,
@@ -2262,12 +2256,12 @@ function Do(e, t, n) {
2262
2256
  transform: c,
2263
2257
  viewportScale: u
2264
2258
  }
2265
- })), f.$on("change", (h) => {
2266
- f.$$set({ shape: h.detail }), i("change", h.detail);
2267
- }), f.$on("grab", (h) => i("grab", h.detail)), f.$on("release", (h) => i("release", h.detail)), () => {
2259
+ })), f.$on("change", (d) => {
2260
+ f.$$set({ shape: d.detail }), i("change", d.detail);
2261
+ }), f.$on("grab", (d) => i("grab", d.detail)), f.$on("release", (d) => i("release", d.detail)), () => {
2268
2262
  f.$destroy();
2269
- })), e.$$set = (h) => {
2270
- "annotation" in h && n(0, s = h.annotation), "editor" in h && n(1, r = h.editor), "style" in h && n(2, l = h.style), "target" in h && n(3, a = h.target), "transform" in h && n(4, c = h.transform), "viewportScale" in h && n(5, u = h.viewportScale);
2263
+ })), e.$$set = (d) => {
2264
+ "annotation" in d && n(0, s = d.annotation), "editor" in d && n(1, r = d.editor), "style" in d && n(2, l = d.style), "target" in d && n(3, a = d.target), "transform" in d && n(4, c = d.transform), "viewportScale" in d && n(5, u = d.viewportScale);
2271
2265
  }, e.$$.update = () => {
2272
2266
  e.$$.dirty & /*annotation, style*/
2273
2267
  5 && (o = je(s, l)), e.$$.dirty & /*annotation, editorComponent*/
@@ -2278,7 +2272,7 @@ function Do(e, t, n) {
2278
2272
  }
2279
2273
  class Xo extends te {
2280
2274
  constructor(t) {
2281
- super(), ee(this, t, Do, null, W, {
2275
+ super(), ee(this, t, Do, null, K, {
2282
2276
  annotation: 0,
2283
2277
  editor: 1,
2284
2278
  style: 2,
@@ -2291,14 +2285,14 @@ class Xo extends te {
2291
2285
  function Ro(e, t, n) {
2292
2286
  const o = Te();
2293
2287
  let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: l } = t, { viewportScale: a } = t, c;
2294
- return Pe(() => {
2295
- const u = s.closest("svg"), f = [], h = (g, m, _) => {
2296
- u == null || u.addEventListener(g, m, _), f.push(() => u == null ? void 0 : u.removeEventListener(g, m, _));
2288
+ return Ye(() => {
2289
+ const u = s.closest("svg"), f = [], d = (g, m, y) => {
2290
+ u == null || u.addEventListener(g, m, y), f.push(() => u == null ? void 0 : u.removeEventListener(g, m, y));
2297
2291
  };
2298
2292
  return n(5, c = new r({
2299
2293
  target: s,
2300
2294
  props: {
2301
- addEventListener: h,
2295
+ addEventListener: d,
2302
2296
  drawingMode: i,
2303
2297
  transform: l,
2304
2298
  viewportScale: a
@@ -2316,7 +2310,7 @@ function Ro(e, t, n) {
2316
2310
  }
2317
2311
  class Uo extends te {
2318
2312
  constructor(t) {
2319
- super(), ee(this, t, Ro, null, W, {
2313
+ super(), ee(this, t, Ro, null, K, {
2320
2314
  drawingMode: 0,
2321
2315
  target: 1,
2322
2316
  tool: 2,
@@ -2329,42 +2323,42 @@ function Tt(e) {
2329
2323
  let t, n;
2330
2324
  return {
2331
2325
  c() {
2332
- t = R("rect"), n = R("rect"), d(t, "class", "a9s-outer"), d(
2326
+ t = X("rect"), n = X("rect"), h(t, "class", "a9s-outer"), h(
2333
2327
  t,
2334
2328
  "x",
2335
2329
  /*x*/
2336
2330
  e[1]
2337
- ), d(
2331
+ ), h(
2338
2332
  t,
2339
2333
  "y",
2340
2334
  /*y*/
2341
2335
  e[2]
2342
- ), d(
2336
+ ), h(
2343
2337
  t,
2344
2338
  "width",
2345
2339
  /*w*/
2346
2340
  e[3]
2347
- ), d(
2341
+ ), h(
2348
2342
  t,
2349
2343
  "height",
2350
2344
  /*h*/
2351
2345
  e[4]
2352
- ), d(n, "class", "a9s-inner"), d(
2346
+ ), h(n, "class", "a9s-inner"), h(
2353
2347
  n,
2354
2348
  "x",
2355
2349
  /*x*/
2356
2350
  e[1]
2357
- ), d(
2351
+ ), h(
2358
2352
  n,
2359
2353
  "y",
2360
2354
  /*y*/
2361
2355
  e[2]
2362
- ), d(
2356
+ ), h(
2363
2357
  n,
2364
2358
  "width",
2365
2359
  /*w*/
2366
2360
  e[3]
2367
- ), d(
2361
+ ), h(
2368
2362
  n,
2369
2363
  "height",
2370
2364
  /*h*/
@@ -2372,53 +2366,53 @@ function Tt(e) {
2372
2366
  );
2373
2367
  },
2374
2368
  m(o, i) {
2375
- O(o, t, i), O(o, n, i);
2369
+ B(o, t, i), B(o, n, i);
2376
2370
  },
2377
2371
  p(o, i) {
2378
2372
  i & /*x*/
2379
- 2 && d(
2373
+ 2 && h(
2380
2374
  t,
2381
2375
  "x",
2382
2376
  /*x*/
2383
2377
  o[1]
2384
2378
  ), i & /*y*/
2385
- 4 && d(
2379
+ 4 && h(
2386
2380
  t,
2387
2381
  "y",
2388
2382
  /*y*/
2389
2383
  o[2]
2390
2384
  ), i & /*w*/
2391
- 8 && d(
2385
+ 8 && h(
2392
2386
  t,
2393
2387
  "width",
2394
2388
  /*w*/
2395
2389
  o[3]
2396
2390
  ), i & /*h*/
2397
- 16 && d(
2391
+ 16 && h(
2398
2392
  t,
2399
2393
  "height",
2400
2394
  /*h*/
2401
2395
  o[4]
2402
2396
  ), i & /*x*/
2403
- 2 && d(
2397
+ 2 && h(
2404
2398
  n,
2405
2399
  "x",
2406
2400
  /*x*/
2407
2401
  o[1]
2408
2402
  ), i & /*y*/
2409
- 4 && d(
2403
+ 4 && h(
2410
2404
  n,
2411
2405
  "y",
2412
2406
  /*y*/
2413
2407
  o[2]
2414
2408
  ), i & /*w*/
2415
- 8 && d(
2409
+ 8 && h(
2416
2410
  n,
2417
2411
  "width",
2418
2412
  /*w*/
2419
2413
  o[3]
2420
2414
  ), i & /*h*/
2421
- 16 && d(
2415
+ 16 && h(
2422
2416
  n,
2423
2417
  "height",
2424
2418
  /*h*/
@@ -2426,7 +2420,7 @@ function Tt(e) {
2426
2420
  );
2427
2421
  },
2428
2422
  d(o) {
2429
- o && (L(t), L(n));
2423
+ o && (k(t), k(n));
2430
2424
  }
2431
2425
  };
2432
2426
  }
@@ -2437,69 +2431,69 @@ function No(e) {
2437
2431
  );
2438
2432
  return {
2439
2433
  c() {
2440
- t = R("g"), n && n.c(), d(t, "class", "a9s-annotation a9s-rubberband");
2434
+ t = X("g"), n && n.c(), h(t, "class", "a9s-annotation a9s-rubberband");
2441
2435
  },
2442
2436
  m(o, i) {
2443
- O(o, t, i), n && n.m(t, null);
2437
+ B(o, t, i), n && n.m(t, null);
2444
2438
  },
2445
2439
  p(o, [i]) {
2446
2440
  /*origin*/
2447
2441
  o[0] ? n ? n.p(o, i) : (n = Tt(o), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2448
2442
  },
2449
- i: V,
2450
- o: V,
2443
+ i: G,
2444
+ o: G,
2451
2445
  d(o) {
2452
- o && L(t), n && n.d();
2446
+ o && k(t), n && n.d();
2453
2447
  }
2454
2448
  };
2455
2449
  }
2456
2450
  function Vo(e, t, n) {
2457
2451
  const o = Te();
2458
- let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, l, a, c, u, f, h, g;
2459
- const m = (A) => {
2460
- const w = A;
2461
- 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, h = 1), n(4, g = 1));
2462
- }, _ = (A) => {
2463
- const w = A;
2464
- 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, h = Math.abs(c[0] - a[0])), n(4, g = Math.abs(c[1] - a[1])));
2465
- }, b = (A) => {
2466
- const w = A, E = performance.now() - l;
2452
+ let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, l, a, c, u, f, d, g;
2453
+ const m = (S) => {
2454
+ const w = S;
2455
+ 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));
2456
+ }, y = (S) => {
2457
+ const w = S;
2458
+ 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])));
2459
+ }, E = (S) => {
2460
+ const w = S, A = performance.now() - l;
2467
2461
  if (s === "click") {
2468
- if (E > 300)
2462
+ if (A > 300)
2469
2463
  return;
2470
- w.stopPropagation(), a ? y() : (n(0, a = r.elementToImage(w.offsetX, w.offsetY)), c = a, n(1, u = a[0]), n(2, f = a[1]), n(3, h = 1), n(4, g = 1));
2464
+ w.stopPropagation(), 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
2465
  } else
2472
- a && (E > 300 || h * g > 100 ? (w.stopPropagation(), y()) : (n(0, a = void 0), c = void 0));
2473
- }, y = () => {
2474
- if (h * g > 15) {
2475
- const A = {
2476
- type: j.RECTANGLE,
2466
+ a && (A > 300 || d * g > 100 ? (w.stopPropagation(), p()) : (n(0, a = void 0), c = void 0));
2467
+ }, p = () => {
2468
+ if (d * g > 15) {
2469
+ const S = {
2470
+ type: F.RECTANGLE,
2477
2471
  geometry: {
2478
2472
  bounds: {
2479
2473
  minX: u,
2480
2474
  minY: f,
2481
- maxX: u + h,
2475
+ maxX: u + d,
2482
2476
  maxY: f + g
2483
2477
  },
2484
2478
  x: u,
2485
2479
  y: f,
2486
- w: h,
2480
+ w: d,
2487
2481
  h: g
2488
2482
  }
2489
2483
  };
2490
- o("create", A);
2484
+ o("create", S);
2491
2485
  }
2492
2486
  n(0, a = void 0), c = void 0;
2493
2487
  };
2494
- return Pe(() => {
2495
- i("pointerdown", m), i("pointermove", _), i("pointerup", b, !0);
2496
- }), e.$$set = (A) => {
2497
- "addEventListener" in A && n(5, i = A.addEventListener), "drawingMode" in A && n(6, s = A.drawingMode), "transform" in A && n(7, r = A.transform);
2498
- }, [a, u, f, h, g, i, s, r];
2488
+ return Ye(() => {
2489
+ i("pointerdown", m), i("pointermove", y), i("pointerup", E, !0);
2490
+ }), e.$$set = (S) => {
2491
+ "addEventListener" in S && n(5, i = S.addEventListener), "drawingMode" in S && n(6, s = S.drawingMode), "transform" in S && n(7, r = S.transform);
2492
+ }, [a, u, f, d, g, i, s, r];
2499
2493
  }
2500
2494
  class Go extends te {
2501
2495
  constructor(t) {
2502
- super(), ee(this, t, Vo, No, W, {
2496
+ super(), ee(this, t, Vo, No, K, {
2503
2497
  addEventListener: 5,
2504
2498
  drawingMode: 6,
2505
2499
  transform: 7
@@ -2528,23 +2522,23 @@ function Mt(e) {
2528
2522
  );
2529
2523
  return {
2530
2524
  c() {
2531
- t = R("polygon"), o = R("polygon"), r && r.c(), s = ce(), d(t, "class", "a9s-outer"), d(t, "points", n = /*coords*/
2532
- e[16]), d(o, "class", "a9s-inner"), d(o, "points", i = /*coords*/
2525
+ t = X("polygon"), o = X("polygon"), r && r.c(), s = ae(), h(t, "class", "a9s-outer"), h(t, "points", n = /*coords*/
2526
+ e[16]), h(o, "class", "a9s-inner"), h(o, "points", i = /*coords*/
2533
2527
  e[16]);
2534
2528
  },
2535
2529
  m(l, a) {
2536
- O(l, t, a), O(l, o, a), r && r.m(l, a), O(l, s, a);
2530
+ B(l, t, a), B(l, o, a), r && r.m(l, a), B(l, s, a);
2537
2531
  },
2538
2532
  p(l, a) {
2539
2533
  a & /*isClosable, points, cursor*/
2540
2534
  7 && n !== (n = /*coords*/
2541
- l[16]) && d(t, "points", n), a & /*isClosable, points, cursor*/
2535
+ l[16]) && h(t, "points", n), a & /*isClosable, points, cursor*/
2542
2536
  7 && i !== (i = /*coords*/
2543
- l[16]) && d(o, "points", i), /*isClosable*/
2537
+ l[16]) && h(o, "points", i), /*isClosable*/
2544
2538
  l[2] ? r ? r.p(l, a) : (r = vt(l), r.c(), r.m(s.parentNode, s)) : r && (r.d(1), r = null);
2545
2539
  },
2546
2540
  d(l) {
2547
- l && (L(t), L(o), L(s)), r && r.d(l);
2541
+ l && (k(t), k(o), k(s)), r && r.d(l);
2548
2542
  }
2549
2543
  };
2550
2544
  }
@@ -2552,16 +2546,16 @@ function vt(e) {
2552
2546
  let t, n, o;
2553
2547
  return {
2554
2548
  c() {
2555
- t = R("rect"), d(t, "class", "a9s-corner-handle"), d(t, "x", n = /*points*/
2549
+ t = X("rect"), h(t, "class", "a9s-corner-handle"), h(t, "x", n = /*points*/
2556
2550
  e[0][0][0] - /*handleSize*/
2557
- e[3] / 2), d(t, "y", o = /*points*/
2551
+ e[3] / 2), h(t, "y", o = /*points*/
2558
2552
  e[0][0][1] - /*handleSize*/
2559
- e[3] / 2), d(
2553
+ e[3] / 2), h(
2560
2554
  t,
2561
2555
  "height",
2562
2556
  /*handleSize*/
2563
2557
  e[3]
2564
- ), d(
2558
+ ), h(
2565
2559
  t,
2566
2560
  "width",
2567
2561
  /*handleSize*/
@@ -2569,23 +2563,23 @@ function vt(e) {
2569
2563
  );
2570
2564
  },
2571
2565
  m(i, s) {
2572
- O(i, t, s);
2566
+ B(i, t, s);
2573
2567
  },
2574
2568
  p(i, s) {
2575
2569
  s & /*points, handleSize*/
2576
2570
  9 && n !== (n = /*points*/
2577
2571
  i[0][0][0] - /*handleSize*/
2578
- i[3] / 2) && d(t, "x", n), s & /*points, handleSize*/
2572
+ i[3] / 2) && h(t, "x", n), s & /*points, handleSize*/
2579
2573
  9 && o !== (o = /*points*/
2580
2574
  i[0][0][1] - /*handleSize*/
2581
- i[3] / 2) && d(t, "y", o), s & /*handleSize*/
2582
- 8 && d(
2575
+ i[3] / 2) && h(t, "y", o), s & /*handleSize*/
2576
+ 8 && h(
2583
2577
  t,
2584
2578
  "height",
2585
2579
  /*handleSize*/
2586
2580
  i[3]
2587
2581
  ), s & /*handleSize*/
2588
- 8 && d(
2582
+ 8 && h(
2589
2583
  t,
2590
2584
  "width",
2591
2585
  /*handleSize*/
@@ -2593,7 +2587,7 @@ function vt(e) {
2593
2587
  );
2594
2588
  },
2595
2589
  d(i) {
2596
- i && L(t);
2590
+ i && k(t);
2597
2591
  }
2598
2592
  };
2599
2593
  }
@@ -2604,19 +2598,19 @@ function zo(e) {
2604
2598
  );
2605
2599
  return {
2606
2600
  c() {
2607
- t = R("g"), n && n.c(), d(t, "class", "a9s-annotation a9s-rubberband");
2601
+ t = X("g"), n && n.c(), h(t, "class", "a9s-annotation a9s-rubberband");
2608
2602
  },
2609
2603
  m(o, i) {
2610
- O(o, t, i), n && n.m(t, null);
2604
+ B(o, t, i), n && n.m(t, null);
2611
2605
  },
2612
2606
  p(o, [i]) {
2613
2607
  /*cursor*/
2614
2608
  o[1] ? n ? n.p(xe(o), i) : (n = Mt(xe(o)), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2615
2609
  },
2616
- i: V,
2617
- o: V,
2610
+ i: G,
2611
+ o: G,
2618
2612
  d(o) {
2619
- o && L(t), n && n.d();
2613
+ o && k(t), n && n.d();
2620
2614
  }
2621
2615
  };
2622
2616
  }
@@ -2624,38 +2618,38 @@ const Ho = 20, Fo = 1500;
2624
2618
  function jo(e, t, n) {
2625
2619
  let o;
2626
2620
  const i = Te();
2627
- let { addEventListener: s } = t, { drawingMode: r } = t, { transform: l } = t, { viewportScale: a = 1 } = t, c, u = [], f, h, g = !1;
2621
+ let { addEventListener: s } = t, { drawingMode: r } = t, { transform: l } = t, { viewportScale: a = 1 } = t, c, u = [], f, d, g = !1;
2628
2622
  const m = (w) => {
2629
- const E = w, { timeStamp: B, offsetX: U, offsetY: X } = E;
2630
- if (c = { timeStamp: B, offsetX: U, offsetY: X }, r === "drag" && u.length === 0) {
2631
- const p = l.elementToImage(E.offsetX, E.offsetY);
2632
- u.push(p), n(1, f = p);
2623
+ const A = w, { timeStamp: I, offsetX: N, offsetY: U } = A;
2624
+ if (c = { timeStamp: I, offsetX: N, offsetY: U }, r === "drag" && u.length === 0) {
2625
+ const _ = l.elementToImage(A.offsetX, A.offsetY);
2626
+ u.push(_), n(1, f = _);
2633
2627
  }
2634
- }, _ = (w) => {
2635
- const E = w;
2636
- if (h && clearTimeout(h), u.length > 0) {
2637
- if (n(1, f = l.elementToImage(E.offsetX, E.offsetY)), u.length > 2) {
2638
- const B = Qe(f, u[0]) * a;
2639
- n(2, g = B < Ho);
2628
+ }, y = (w) => {
2629
+ const A = w;
2630
+ if (d && clearTimeout(d), u.length > 0) {
2631
+ if (n(1, f = l.elementToImage(A.offsetX, A.offsetY)), u.length > 2) {
2632
+ const I = Qe(f, u[0]) * a;
2633
+ n(2, g = I < Ho);
2640
2634
  }
2641
- E.pointerType === "touch" && (h = setTimeout(
2635
+ A.pointerType === "touch" && (d = setTimeout(
2642
2636
  () => {
2643
- y();
2637
+ p();
2644
2638
  },
2645
2639
  Fo
2646
2640
  ));
2647
2641
  }
2648
- }, b = (w) => {
2649
- const E = w;
2650
- if (h && clearTimeout(h), r === "click") {
2651
- const B = E.timeStamp - c.timeStamp, U = Qe([c.offsetX, c.offsetY], [E.offsetX, E.offsetY]);
2652
- if (B > 300 || U > 15)
2642
+ }, E = (w) => {
2643
+ const A = w;
2644
+ if (d && clearTimeout(d), r === "click") {
2645
+ const I = A.timeStamp - c.timeStamp, N = Qe([c.offsetX, c.offsetY], [A.offsetX, A.offsetY]);
2646
+ if (I > 300 || N > 15)
2653
2647
  return;
2654
2648
  if (g)
2655
- A();
2649
+ S();
2656
2650
  else if (u.length === 0) {
2657
- const X = l.elementToImage(E.offsetX, E.offsetY);
2658
- u.push(X), n(1, f = X);
2651
+ const U = l.elementToImage(A.offsetX, A.offsetY);
2652
+ u.push(U), n(1, f = U);
2659
2653
  } else
2660
2654
  u.push(f);
2661
2655
  } else {
@@ -2663,19 +2657,19 @@ function jo(e, t, n) {
2663
2657
  n(0, u = []), n(1, f = void 0);
2664
2658
  return;
2665
2659
  }
2666
- E.stopImmediatePropagation(), g ? A() : u.push(f);
2660
+ A.stopImmediatePropagation(), g ? S() : u.push(f);
2667
2661
  }
2668
- }, y = () => {
2662
+ }, p = () => {
2669
2663
  if (!f)
2670
2664
  return;
2671
- const w = [...u, f], E = {
2672
- type: j.POLYGON,
2665
+ const w = [...u, f], A = {
2666
+ type: F.POLYGON,
2673
2667
  geometry: { bounds: Fe(w), points: w }
2674
2668
  };
2675
- st(E) > 4 && (n(0, u = []), n(1, f = void 0), i("create", E));
2676
- }, A = () => {
2669
+ st(A) > 4 && (n(0, u = []), n(1, f = void 0), i("create", A));
2670
+ }, S = () => {
2677
2671
  const w = {
2678
- type: j.POLYGON,
2672
+ type: F.POLYGON,
2679
2673
  geometry: {
2680
2674
  bounds: Fe(u),
2681
2675
  points: [...u]
@@ -2683,8 +2677,8 @@ function jo(e, t, n) {
2683
2677
  };
2684
2678
  n(0, u = []), n(1, f = void 0), i("create", w);
2685
2679
  };
2686
- return Pe(() => {
2687
- s("pointerdown", m, !0), s("pointermove", _), s("pointerup", b, !0), s("dblclick", y, !0);
2680
+ return Ye(() => {
2681
+ s("pointerdown", m, !0), s("pointermove", y), s("pointerup", E, !0), s("dblclick", p, !0);
2688
2682
  }), e.$$set = (w) => {
2689
2683
  "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);
2690
2684
  }, e.$$.update = () => {
@@ -2703,7 +2697,7 @@ function jo(e, t, n) {
2703
2697
  }
2704
2698
  class qo extends te {
2705
2699
  constructor(t) {
2706
- super(), ee(this, t, jo, zo, W, {
2700
+ super(), ee(this, t, jo, zo, K, {
2707
2701
  addEventListener: 4,
2708
2702
  drawingMode: 5,
2709
2703
  transform: 6,
@@ -2719,75 +2713,75 @@ function Wo(e) {
2719
2713
  let t, n, o, i, s;
2720
2714
  return {
2721
2715
  c() {
2722
- t = R("g"), n = R("ellipse"), i = R("ellipse"), d(n, "class", "a9s-outer"), d(n, "style", o = /*computedStyle*/
2723
- e[1] ? "display:none;" : void 0), d(
2716
+ t = X("g"), n = X("ellipse"), i = X("ellipse"), h(n, "class", "a9s-outer"), h(n, "style", o = /*computedStyle*/
2717
+ e[1] ? "display:none;" : void 0), h(
2724
2718
  n,
2725
2719
  "cx",
2726
2720
  /*cx*/
2727
2721
  e[2]
2728
- ), d(
2722
+ ), h(
2729
2723
  n,
2730
2724
  "cy",
2731
2725
  /*cy*/
2732
2726
  e[3]
2733
- ), d(
2727
+ ), h(
2734
2728
  n,
2735
2729
  "rx",
2736
2730
  /*rx*/
2737
2731
  e[4]
2738
- ), d(
2732
+ ), h(
2739
2733
  n,
2740
2734
  "ry",
2741
2735
  /*ry*/
2742
2736
  e[5]
2743
- ), d(i, "class", "a9s-inner"), d(
2737
+ ), h(i, "class", "a9s-inner"), h(
2744
2738
  i,
2745
2739
  "style",
2746
2740
  /*computedStyle*/
2747
2741
  e[1]
2748
- ), d(
2742
+ ), h(
2749
2743
  i,
2750
2744
  "cx",
2751
2745
  /*cx*/
2752
2746
  e[2]
2753
- ), d(
2747
+ ), h(
2754
2748
  i,
2755
2749
  "cy",
2756
2750
  /*cy*/
2757
2751
  e[3]
2758
- ), d(
2752
+ ), h(
2759
2753
  i,
2760
2754
  "rx",
2761
2755
  /*rx*/
2762
2756
  e[4]
2763
- ), d(
2757
+ ), h(
2764
2758
  i,
2765
2759
  "ry",
2766
2760
  /*ry*/
2767
2761
  e[5]
2768
- ), d(t, "data-id", s = /*annotation*/
2762
+ ), h(t, "data-id", s = /*annotation*/
2769
2763
  e[0].id);
2770
2764
  },
2771
2765
  m(r, l) {
2772
- O(r, t, l), se(t, n), se(t, i);
2766
+ B(r, t, l), ie(t, n), ie(t, i);
2773
2767
  },
2774
2768
  p(r, [l]) {
2775
2769
  l & /*computedStyle*/
2776
2770
  2 && o !== (o = /*computedStyle*/
2777
- r[1] ? "display:none;" : void 0) && d(n, "style", o), l & /*computedStyle*/
2778
- 2 && d(
2771
+ r[1] ? "display:none;" : void 0) && h(n, "style", o), l & /*computedStyle*/
2772
+ 2 && h(
2779
2773
  i,
2780
2774
  "style",
2781
2775
  /*computedStyle*/
2782
2776
  r[1]
2783
2777
  ), l & /*annotation*/
2784
2778
  1 && s !== (s = /*annotation*/
2785
- r[0].id) && d(t, "data-id", s);
2779
+ r[0].id) && h(t, "data-id", s);
2786
2780
  },
2787
- i: V,
2788
- o: V,
2781
+ i: G,
2782
+ o: G,
2789
2783
  d(r) {
2790
- r && L(t);
2784
+ r && k(t);
2791
2785
  }
2792
2786
  };
2793
2787
  }
@@ -2803,52 +2797,52 @@ function Jo(e, t, n) {
2803
2797
  }
2804
2798
  class Zo extends te {
2805
2799
  constructor(t) {
2806
- super(), ee(this, t, Jo, Wo, W, { annotation: 0, geom: 6, style: 7 });
2800
+ super(), ee(this, t, Jo, Wo, K, { annotation: 0, geom: 6, style: 7 });
2807
2801
  }
2808
2802
  }
2809
2803
  function Qo(e) {
2810
2804
  let t, n, o, i, s;
2811
2805
  return {
2812
2806
  c() {
2813
- t = R("g"), n = R("polygon"), i = R("polygon"), d(n, "class", "a9s-outer"), d(n, "style", o = /*computedStyle*/
2814
- e[1] ? "display:none;" : void 0), d(
2807
+ t = X("g"), n = X("polygon"), i = X("polygon"), h(n, "class", "a9s-outer"), h(n, "style", o = /*computedStyle*/
2808
+ e[1] ? "display:none;" : void 0), h(
2815
2809
  n,
2816
2810
  "points",
2817
2811
  /*points*/
2818
2812
  e[2].map(xo).join(" ")
2819
- ), d(i, "class", "a9s-inner"), d(
2813
+ ), h(i, "class", "a9s-inner"), h(
2820
2814
  i,
2821
2815
  "style",
2822
2816
  /*computedStyle*/
2823
2817
  e[1]
2824
- ), d(
2818
+ ), h(
2825
2819
  i,
2826
2820
  "points",
2827
2821
  /*points*/
2828
2822
  e[2].map($o).join(" ")
2829
- ), d(t, "data-id", s = /*annotation*/
2823
+ ), h(t, "data-id", s = /*annotation*/
2830
2824
  e[0].id);
2831
2825
  },
2832
2826
  m(r, l) {
2833
- O(r, t, l), se(t, n), se(t, i);
2827
+ B(r, t, l), ie(t, n), ie(t, i);
2834
2828
  },
2835
2829
  p(r, [l]) {
2836
2830
  l & /*computedStyle*/
2837
2831
  2 && o !== (o = /*computedStyle*/
2838
- r[1] ? "display:none;" : void 0) && d(n, "style", o), l & /*computedStyle*/
2839
- 2 && d(
2832
+ r[1] ? "display:none;" : void 0) && h(n, "style", o), l & /*computedStyle*/
2833
+ 2 && h(
2840
2834
  i,
2841
2835
  "style",
2842
2836
  /*computedStyle*/
2843
2837
  r[1]
2844
2838
  ), l & /*annotation*/
2845
2839
  1 && s !== (s = /*annotation*/
2846
- r[0].id) && d(t, "data-id", s);
2840
+ r[0].id) && h(t, "data-id", s);
2847
2841
  },
2848
- i: V,
2849
- o: V,
2842
+ i: G,
2843
+ o: G,
2850
2844
  d(r) {
2851
- r && L(t);
2845
+ r && k(t);
2852
2846
  }
2853
2847
  };
2854
2848
  }
@@ -2865,130 +2859,130 @@ function ei(e, t, n) {
2865
2859
  }
2866
2860
  class ti extends te {
2867
2861
  constructor(t) {
2868
- super(), ee(this, t, ei, Qo, W, { annotation: 0, geom: 3, style: 4 });
2862
+ super(), ee(this, t, ei, Qo, K, { annotation: 0, geom: 3, style: 4 });
2869
2863
  }
2870
2864
  }
2871
2865
  function ni(e) {
2872
2866
  let t, n, o, i, s;
2873
2867
  return {
2874
2868
  c() {
2875
- t = R("g"), n = R("rect"), i = R("rect"), d(n, "class", "a9s-outer"), d(n, "style", o = /*computedStyle*/
2876
- e[5] ? "display:none;" : void 0), d(
2869
+ t = X("g"), n = X("rect"), i = X("rect"), h(n, "class", "a9s-outer"), h(n, "style", o = /*computedStyle*/
2870
+ e[5] ? "display:none;" : void 0), h(
2877
2871
  n,
2878
2872
  "x",
2879
2873
  /*x*/
2880
2874
  e[4]
2881
- ), d(
2875
+ ), h(
2882
2876
  n,
2883
2877
  "y",
2884
2878
  /*y*/
2885
2879
  e[3]
2886
- ), d(
2880
+ ), h(
2887
2881
  n,
2888
2882
  "width",
2889
2883
  /*w*/
2890
2884
  e[2]
2891
- ), d(
2885
+ ), h(
2892
2886
  n,
2893
2887
  "height",
2894
2888
  /*h*/
2895
2889
  e[1]
2896
- ), d(i, "class", "a9s-inner"), d(
2890
+ ), h(i, "class", "a9s-inner"), h(
2897
2891
  i,
2898
2892
  "style",
2899
2893
  /*computedStyle*/
2900
2894
  e[5]
2901
- ), d(
2895
+ ), h(
2902
2896
  i,
2903
2897
  "x",
2904
2898
  /*x*/
2905
2899
  e[4]
2906
- ), d(
2900
+ ), h(
2907
2901
  i,
2908
2902
  "y",
2909
2903
  /*y*/
2910
2904
  e[3]
2911
- ), d(
2905
+ ), h(
2912
2906
  i,
2913
2907
  "width",
2914
2908
  /*w*/
2915
2909
  e[2]
2916
- ), d(
2910
+ ), h(
2917
2911
  i,
2918
2912
  "height",
2919
2913
  /*h*/
2920
2914
  e[1]
2921
- ), d(t, "data-id", s = /*annotation*/
2915
+ ), h(t, "data-id", s = /*annotation*/
2922
2916
  e[0].id);
2923
2917
  },
2924
2918
  m(r, l) {
2925
- O(r, t, l), se(t, n), se(t, i);
2919
+ B(r, t, l), ie(t, n), ie(t, i);
2926
2920
  },
2927
2921
  p(r, [l]) {
2928
2922
  l & /*computedStyle*/
2929
2923
  32 && o !== (o = /*computedStyle*/
2930
- r[5] ? "display:none;" : void 0) && d(n, "style", o), l & /*x*/
2931
- 16 && d(
2924
+ r[5] ? "display:none;" : void 0) && h(n, "style", o), l & /*x*/
2925
+ 16 && h(
2932
2926
  n,
2933
2927
  "x",
2934
2928
  /*x*/
2935
2929
  r[4]
2936
2930
  ), l & /*y*/
2937
- 8 && d(
2931
+ 8 && h(
2938
2932
  n,
2939
2933
  "y",
2940
2934
  /*y*/
2941
2935
  r[3]
2942
2936
  ), l & /*w*/
2943
- 4 && d(
2937
+ 4 && h(
2944
2938
  n,
2945
2939
  "width",
2946
2940
  /*w*/
2947
2941
  r[2]
2948
2942
  ), l & /*h*/
2949
- 2 && d(
2943
+ 2 && h(
2950
2944
  n,
2951
2945
  "height",
2952
2946
  /*h*/
2953
2947
  r[1]
2954
2948
  ), l & /*computedStyle*/
2955
- 32 && d(
2949
+ 32 && h(
2956
2950
  i,
2957
2951
  "style",
2958
2952
  /*computedStyle*/
2959
2953
  r[5]
2960
2954
  ), l & /*x*/
2961
- 16 && d(
2955
+ 16 && h(
2962
2956
  i,
2963
2957
  "x",
2964
2958
  /*x*/
2965
2959
  r[4]
2966
2960
  ), l & /*y*/
2967
- 8 && d(
2961
+ 8 && h(
2968
2962
  i,
2969
2963
  "y",
2970
2964
  /*y*/
2971
2965
  r[3]
2972
2966
  ), l & /*w*/
2973
- 4 && d(
2967
+ 4 && h(
2974
2968
  i,
2975
2969
  "width",
2976
2970
  /*w*/
2977
2971
  r[2]
2978
2972
  ), l & /*h*/
2979
- 2 && d(
2973
+ 2 && h(
2980
2974
  i,
2981
2975
  "height",
2982
2976
  /*h*/
2983
2977
  r[1]
2984
2978
  ), l & /*annotation*/
2985
2979
  1 && s !== (s = /*annotation*/
2986
- r[0].id) && d(t, "data-id", s);
2980
+ r[0].id) && h(t, "data-id", s);
2987
2981
  },
2988
- i: V,
2989
- o: V,
2982
+ i: G,
2983
+ o: G,
2990
2984
  d(r) {
2991
- r && L(t);
2985
+ r && k(t);
2992
2986
  }
2993
2987
  };
2994
2988
  }
@@ -3004,7 +2998,7 @@ function oi(e, t, n) {
3004
2998
  }
3005
2999
  class ii extends te {
3006
3000
  constructor(t) {
3007
- super(), ee(this, t, oi, ni, W, { annotation: 0, geom: 6, style: 7 });
3001
+ super(), ee(this, t, oi, ni, K, { annotation: 0, geom: 6, style: 7 });
3008
3002
  }
3009
3003
  }
3010
3004
  const Ci = {
@@ -3031,35 +3025,35 @@ const Ci = {
3031
3025
  }, { Boolean: en } = fn;
3032
3026
  function Lt(e, t, n) {
3033
3027
  const o = e.slice();
3034
- return o[30] = t[n], o;
3028
+ return o[31] = t[n], o;
3035
3029
  }
3036
3030
  function kt(e, t, n) {
3037
3031
  const o = e.slice();
3038
- return o[33] = t[n], o;
3032
+ return o[34] = t[n], o;
3039
3033
  }
3040
3034
  function $e(e) {
3041
3035
  const t = e.slice(), n = (
3042
3036
  /*annotation*/
3043
- t[33].target.selector
3037
+ t[34].target.selector
3044
3038
  );
3045
- return t[36] = n, t;
3039
+ return t[37] = n, t;
3046
3040
  }
3047
3041
  function Ot(e) {
3048
3042
  let t = (
3049
3043
  /*annotation*/
3050
- e[33].id
3044
+ e[34].id
3051
3045
  ), n, o, i = Bt(e);
3052
3046
  return {
3053
3047
  c() {
3054
- i.c(), n = ce();
3048
+ i.c(), n = ae();
3055
3049
  },
3056
3050
  m(s, r) {
3057
- i.m(s, r), O(s, n, r), o = !0;
3051
+ i.m(s, r), B(s, n, r), o = !0;
3058
3052
  },
3059
3053
  p(s, r) {
3060
3054
  r[0] & /*$store*/
3061
- 8192 && W(t, t = /*annotation*/
3062
- s[33].id) ? (re(), D(i, 1, 1, V), le(), i = Bt(s), i.c(), P(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3055
+ 16384 && K(t, t = /*annotation*/
3056
+ s[34].id) ? (se(), D(i, 1, 1, G), re(), i = Bt(s), i.c(), P(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3063
3057
  },
3064
3058
  i(s) {
3065
3059
  o || (P(i), o = !0);
@@ -3068,7 +3062,7 @@ function Ot(e) {
3068
3062
  D(i), o = !1;
3069
3063
  },
3070
3064
  d(s) {
3071
- s && L(n), i.d(s);
3065
+ s && k(n), i.d(s);
3072
3066
  }
3073
3067
  };
3074
3068
  }
@@ -3078,11 +3072,11 @@ function ci(e) {
3078
3072
  props: {
3079
3073
  annotation: (
3080
3074
  /*annotation*/
3081
- e[33]
3075
+ e[34]
3082
3076
  ),
3083
3077
  geom: (
3084
3078
  /*selector*/
3085
- e[36].geometry
3079
+ e[37].geometry
3086
3080
  ),
3087
3081
  style: (
3088
3082
  /*style*/
@@ -3099,10 +3093,10 @@ function ci(e) {
3099
3093
  p(o, i) {
3100
3094
  const s = {};
3101
3095
  i[0] & /*$store*/
3102
- 8192 && (s.annotation = /*annotation*/
3103
- o[33]), i[0] & /*$store*/
3104
- 8192 && (s.geom = /*selector*/
3105
- o[36].geometry), i[0] & /*style*/
3096
+ 16384 && (s.annotation = /*annotation*/
3097
+ o[34]), i[0] & /*$store*/
3098
+ 16384 && (s.geom = /*selector*/
3099
+ o[37].geometry), i[0] & /*style*/
3106
3100
  2 && (s.style = /*style*/
3107
3101
  o[1]), t.$set(s);
3108
3102
  },
@@ -3123,11 +3117,11 @@ function fi(e) {
3123
3117
  props: {
3124
3118
  annotation: (
3125
3119
  /*annotation*/
3126
- e[33]
3120
+ e[34]
3127
3121
  ),
3128
3122
  geom: (
3129
3123
  /*selector*/
3130
- e[36].geometry
3124
+ e[37].geometry
3131
3125
  ),
3132
3126
  style: (
3133
3127
  /*style*/
@@ -3144,10 +3138,10 @@ function fi(e) {
3144
3138
  p(o, i) {
3145
3139
  const s = {};
3146
3140
  i[0] & /*$store*/
3147
- 8192 && (s.annotation = /*annotation*/
3148
- o[33]), i[0] & /*$store*/
3149
- 8192 && (s.geom = /*selector*/
3150
- o[36].geometry), i[0] & /*style*/
3141
+ 16384 && (s.annotation = /*annotation*/
3142
+ o[34]), i[0] & /*$store*/
3143
+ 16384 && (s.geom = /*selector*/
3144
+ o[37].geometry), i[0] & /*style*/
3151
3145
  2 && (s.style = /*style*/
3152
3146
  o[1]), t.$set(s);
3153
3147
  },
@@ -3168,11 +3162,11 @@ function ui(e) {
3168
3162
  props: {
3169
3163
  annotation: (
3170
3164
  /*annotation*/
3171
- e[33]
3165
+ e[34]
3172
3166
  ),
3173
3167
  geom: (
3174
3168
  /*selector*/
3175
- e[36].geometry
3169
+ e[37].geometry
3176
3170
  ),
3177
3171
  style: (
3178
3172
  /*style*/
@@ -3189,10 +3183,10 @@ function ui(e) {
3189
3183
  p(o, i) {
3190
3184
  const s = {};
3191
3185
  i[0] & /*$store*/
3192
- 8192 && (s.annotation = /*annotation*/
3193
- o[33]), i[0] & /*$store*/
3194
- 8192 && (s.geom = /*selector*/
3195
- o[36].geometry), i[0] & /*style*/
3186
+ 16384 && (s.annotation = /*annotation*/
3187
+ o[34]), i[0] & /*$store*/
3188
+ 16384 && (s.geom = /*selector*/
3189
+ o[37].geometry), i[0] & /*style*/
3196
3190
  2 && (s.style = /*style*/
3197
3191
  o[1]), t.$set(s);
3198
3192
  },
@@ -3213,27 +3207,27 @@ function Bt(e) {
3213
3207
  function l(a, c) {
3214
3208
  return (
3215
3209
  /*selector*/
3216
- a[36].type === j.ELLIPSE ? 0 : (
3210
+ a[37].type === F.ELLIPSE ? 0 : (
3217
3211
  /*selector*/
3218
- a[36].type === j.RECTANGLE ? 1 : (
3212
+ a[37].type === F.RECTANGLE ? 1 : (
3219
3213
  /*selector*/
3220
- a[36].type === j.POLYGON ? 2 : -1
3214
+ a[37].type === F.POLYGON ? 2 : -1
3221
3215
  )
3222
3216
  )
3223
3217
  );
3224
3218
  }
3225
3219
  return ~(t = l(e)) && (n = r[t] = s[t](e)), {
3226
3220
  c() {
3227
- n && n.c(), o = ce();
3221
+ n && n.c(), o = ae();
3228
3222
  },
3229
3223
  m(a, c) {
3230
- ~t && r[t].m(a, c), O(a, o, c), i = !0;
3224
+ ~t && r[t].m(a, c), B(a, o, c), i = !0;
3231
3225
  },
3232
3226
  p(a, c) {
3233
3227
  let u = t;
3234
- t = l(a), t === u ? ~t && r[t].p(a, c) : (n && (re(), D(r[u], 1, 1, () => {
3228
+ t = l(a), t === u ? ~t && r[t].p(a, c) : (n && (se(), D(r[u], 1, 1, () => {
3235
3229
  r[u] = null;
3236
- }), le()), ~t ? (n = r[t], n ? n.p(a, c) : (n = r[t] = s[t](a), n.c()), P(n, 1), n.m(o.parentNode, o)) : n = null);
3230
+ }), re()), ~t ? (n = r[t], n ? n.p(a, c) : (n = r[t] = s[t](a), n.c()), P(n, 1), n.m(o.parentNode, o)) : n = null);
3237
3231
  },
3238
3232
  i(a) {
3239
3233
  i || (P(n), i = !0);
@@ -3242,33 +3236,33 @@ function Bt(e) {
3242
3236
  D(n), i = !1;
3243
3237
  },
3244
3238
  d(a) {
3245
- a && L(o), ~t && r[t].d(a);
3239
+ a && k(o), ~t && r[t].d(a);
3246
3240
  }
3247
3241
  };
3248
3242
  }
3249
3243
  function It(e) {
3250
3244
  let t = !/*isEditable*/
3251
- e[7](
3245
+ e[8](
3252
3246
  /*annotation*/
3253
- e[33]
3247
+ e[34]
3254
3248
  ), n, o, i = t && Ot($e(e));
3255
3249
  return {
3256
3250
  c() {
3257
- i && i.c(), n = ce();
3251
+ i && i.c(), n = ae();
3258
3252
  },
3259
3253
  m(s, r) {
3260
- i && i.m(s, r), O(s, n, r), o = !0;
3254
+ i && i.m(s, r), B(s, n, r), o = !0;
3261
3255
  },
3262
3256
  p(s, r) {
3263
3257
  r[0] & /*isEditable, $store*/
3264
- 8320 && (t = !/*isEditable*/
3265
- s[7](
3258
+ 16640 && (t = !/*isEditable*/
3259
+ s[8](
3266
3260
  /*annotation*/
3267
- s[33]
3261
+ s[34]
3268
3262
  )), t ? i ? (i.p($e(s), r), r[0] & /*isEditable, $store*/
3269
- 8320 && P(i, 1)) : (i = Ot($e(s)), i.c(), P(i, 1), i.m(n.parentNode, n)) : i && (re(), D(i, 1, 1, () => {
3263
+ 16640 && P(i, 1)) : (i = Ot($e(s)), i.c(), P(i, 1), i.m(n.parentNode, n)) : i && (se(), D(i, 1, 1, () => {
3270
3264
  i = null;
3271
- }), le());
3265
+ }), re());
3272
3266
  },
3273
3267
  i(s) {
3274
3268
  o || (P(i), o = !0);
@@ -3277,7 +3271,7 @@ function It(e) {
3277
3271
  D(i), o = !1;
3278
3272
  },
3279
3273
  d(s) {
3280
- s && L(n), i && i.d(s);
3274
+ s && k(n), i && i.d(s);
3281
3275
  }
3282
3276
  };
3283
3277
  }
@@ -3287,25 +3281,25 @@ function Pt(e) {
3287
3281
  function l(a, c) {
3288
3282
  return (
3289
3283
  /*editableAnnotations*/
3290
- a[6] ? 0 : (
3284
+ a[7] ? 0 : (
3291
3285
  /*tool*/
3292
- a[12] && /*drawingEnabled*/
3286
+ a[13] && /*drawingEnabled*/
3293
3287
  a[0] ? 1 : -1
3294
3288
  )
3295
3289
  );
3296
3290
  }
3297
3291
  return ~(t = l(e)) && (n = r[t] = s[t](e)), {
3298
3292
  c() {
3299
- n && n.c(), o = ce();
3293
+ n && n.c(), o = ae();
3300
3294
  },
3301
3295
  m(a, c) {
3302
- ~t && r[t].m(a, c), O(a, o, c), i = !0;
3296
+ ~t && r[t].m(a, c), B(a, o, c), i = !0;
3303
3297
  },
3304
3298
  p(a, c) {
3305
3299
  let u = t;
3306
- t = l(a), t === u ? ~t && r[t].p(a, c) : (n && (re(), D(r[u], 1, 1, () => {
3300
+ t = l(a), t === u ? ~t && r[t].p(a, c) : (n && (se(), D(r[u], 1, 1, () => {
3307
3301
  r[u] = null;
3308
- }), le()), ~t ? (n = r[t], n ? n.p(a, c) : (n = r[t] = s[t](a), n.c()), P(n, 1), n.m(o.parentNode, o)) : n = null);
3302
+ }), re()), ~t ? (n = r[t], n ? n.p(a, c) : (n = r[t] = s[t](a), n.c()), P(n, 1), n.m(o.parentNode, o)) : n = null);
3309
3303
  },
3310
3304
  i(a) {
3311
3305
  i || (P(n), i = !0);
@@ -3314,7 +3308,7 @@ function Pt(e) {
3314
3308
  D(n), i = !1;
3315
3309
  },
3316
3310
  d(a) {
3317
- a && L(o), ~t && r[t].d(a);
3311
+ a && k(o), ~t && r[t].d(a);
3318
3312
  }
3319
3313
  };
3320
3314
  }
@@ -3325,15 +3319,15 @@ function di(e) {
3325
3319
  ), n, o, i = Yt(e);
3326
3320
  return {
3327
3321
  c() {
3328
- i.c(), n = ce();
3322
+ i.c(), n = ae();
3329
3323
  },
3330
3324
  m(s, r) {
3331
- i.m(s, r), O(s, n, r), o = !0;
3325
+ i.m(s, r), B(s, n, r), o = !0;
3332
3326
  },
3333
3327
  p(s, r) {
3334
3328
  r[0] & /*toolName*/
3335
- 4 && W(t, t = /*toolName*/
3336
- s[2]) ? (re(), D(i, 1, 1, V), le(), i = Yt(s), i.c(), P(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3329
+ 4 && K(t, t = /*toolName*/
3330
+ s[2]) ? (se(), D(i, 1, 1, G), re(), i = Yt(s), i.c(), P(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3337
3331
  },
3338
3332
  i(s) {
3339
3333
  o || (P(i), o = !0);
@@ -3342,14 +3336,14 @@ function di(e) {
3342
3336
  D(i), o = !1;
3343
3337
  },
3344
3338
  d(s) {
3345
- s && L(n), i.d(s);
3339
+ s && k(n), i.d(s);
3346
3340
  }
3347
3341
  };
3348
3342
  }
3349
3343
  function hi(e) {
3350
3344
  let t, n, o = Se(
3351
3345
  /*editableAnnotations*/
3352
- e[6]
3346
+ e[7]
3353
3347
  ), i = [];
3354
3348
  for (let r = 0; r < o.length; r += 1)
3355
3349
  i[r] = Dt(Lt(e, o, r));
@@ -3360,28 +3354,28 @@ function hi(e) {
3360
3354
  c() {
3361
3355
  for (let r = 0; r < i.length; r += 1)
3362
3356
  i[r].c();
3363
- t = ce();
3357
+ t = ae();
3364
3358
  },
3365
3359
  m(r, l) {
3366
3360
  for (let a = 0; a < i.length; a += 1)
3367
3361
  i[a] && i[a].m(r, l);
3368
- O(r, t, l), n = !0;
3362
+ B(r, t, l), n = !0;
3369
3363
  },
3370
3364
  p(r, l) {
3371
3365
  if (l[0] & /*editableAnnotations, drawingEl, getEditor, style, transform, $scale, onChangeSelected*/
3372
- 803922) {
3366
+ 1607842) {
3373
3367
  o = Se(
3374
3368
  /*editableAnnotations*/
3375
- r[6]
3369
+ r[7]
3376
3370
  );
3377
3371
  let a;
3378
3372
  for (a = 0; a < o.length; a += 1) {
3379
3373
  const c = Lt(r, o, a);
3380
3374
  i[a] ? (i[a].p(c, l), P(i[a], 1)) : (i[a] = Dt(c), i[a].c(), P(i[a], 1), i[a].m(t.parentNode, t));
3381
3375
  }
3382
- for (re(), a = o.length; a < i.length; a += 1)
3376
+ for (se(), a = o.length; a < i.length; a += 1)
3383
3377
  s(a);
3384
- le();
3378
+ re();
3385
3379
  }
3386
3380
  },
3387
3381
  i(r) {
@@ -3398,7 +3392,7 @@ function hi(e) {
3398
3392
  n = !1;
3399
3393
  },
3400
3394
  d(r) {
3401
- r && L(t), rt(i, r);
3395
+ r && k(t), rt(i, r);
3402
3396
  }
3403
3397
  };
3404
3398
  }
@@ -3408,29 +3402,29 @@ function Yt(e) {
3408
3402
  props: {
3409
3403
  target: (
3410
3404
  /*drawingEl*/
3411
- e[4]
3405
+ e[5]
3412
3406
  ),
3413
3407
  tool: (
3414
3408
  /*tool*/
3415
- e[12]
3409
+ e[13]
3416
3410
  ),
3417
3411
  drawingMode: (
3418
3412
  /*drawingMode*/
3419
- e[11]
3413
+ e[12]
3420
3414
  ),
3421
3415
  transform: (
3422
3416
  /*transform*/
3423
- e[10]
3417
+ e[11]
3424
3418
  ),
3425
3419
  viewportScale: (
3426
3420
  /*$scale*/
3427
- e[14]
3421
+ e[15]
3428
3422
  )
3429
3423
  }
3430
3424
  }), t.$on(
3431
3425
  "create",
3432
3426
  /*onSelectionCreated*/
3433
- e[17]
3427
+ e[18]
3434
3428
  ), {
3435
3429
  c() {
3436
3430
  $(t.$$.fragment);
@@ -3441,16 +3435,16 @@ function Yt(e) {
3441
3435
  p(o, i) {
3442
3436
  const s = {};
3443
3437
  i[0] & /*drawingEl*/
3444
- 16 && (s.target = /*drawingEl*/
3445
- o[4]), i[0] & /*tool*/
3446
- 4096 && (s.tool = /*tool*/
3447
- o[12]), i[0] & /*drawingMode*/
3448
- 2048 && (s.drawingMode = /*drawingMode*/
3449
- o[11]), i[0] & /*transform*/
3450
- 1024 && (s.transform = /*transform*/
3451
- o[10]), i[0] & /*$scale*/
3452
- 16384 && (s.viewportScale = /*$scale*/
3453
- o[14]), t.$set(s);
3438
+ 32 && (s.target = /*drawingEl*/
3439
+ o[5]), i[0] & /*tool*/
3440
+ 8192 && (s.tool = /*tool*/
3441
+ o[13]), i[0] & /*drawingMode*/
3442
+ 4096 && (s.drawingMode = /*drawingMode*/
3443
+ o[12]), i[0] & /*transform*/
3444
+ 2048 && (s.transform = /*transform*/
3445
+ o[11]), i[0] & /*$scale*/
3446
+ 32768 && (s.viewportScale = /*$scale*/
3447
+ o[15]), t.$set(s);
3454
3448
  },
3455
3449
  i(o) {
3456
3450
  n || (P(t.$$.fragment, o), n = !0);
@@ -3469,18 +3463,18 @@ function Ct(e) {
3469
3463
  props: {
3470
3464
  target: (
3471
3465
  /*drawingEl*/
3472
- e[4]
3466
+ e[5]
3473
3467
  ),
3474
3468
  editor: (
3475
3469
  /*getEditor*/
3476
- e[19](
3470
+ e[20](
3477
3471
  /*editable*/
3478
- e[30].target.selector
3472
+ e[31].target.selector
3479
3473
  )
3480
3474
  ),
3481
3475
  annotation: (
3482
3476
  /*editable*/
3483
- e[30]
3477
+ e[31]
3484
3478
  ),
3485
3479
  style: (
3486
3480
  /*style*/
@@ -3488,23 +3482,23 @@ function Ct(e) {
3488
3482
  ),
3489
3483
  transform: (
3490
3484
  /*transform*/
3491
- e[10]
3485
+ e[11]
3492
3486
  ),
3493
3487
  viewportScale: (
3494
3488
  /*$scale*/
3495
- e[14]
3489
+ e[15]
3496
3490
  )
3497
3491
  }
3498
3492
  }), t.$on("change", function() {
3499
- q(
3493
+ j(
3500
3494
  /*onChangeSelected*/
3501
- e[18](
3495
+ e[19](
3502
3496
  /*editable*/
3503
- e[30]
3497
+ e[31]
3504
3498
  )
3505
- ) && e[18](
3499
+ ) && e[19](
3506
3500
  /*editable*/
3507
- e[30]
3501
+ e[31]
3508
3502
  ).apply(this, arguments);
3509
3503
  }), {
3510
3504
  c() {
@@ -3517,21 +3511,21 @@ function Ct(e) {
3517
3511
  e = o;
3518
3512
  const s = {};
3519
3513
  i[0] & /*drawingEl*/
3520
- 16 && (s.target = /*drawingEl*/
3521
- e[4]), i[0] & /*editableAnnotations*/
3522
- 64 && (s.editor = /*getEditor*/
3523
- e[19](
3514
+ 32 && (s.target = /*drawingEl*/
3515
+ e[5]), i[0] & /*editableAnnotations*/
3516
+ 128 && (s.editor = /*getEditor*/
3517
+ e[20](
3524
3518
  /*editable*/
3525
- e[30].target.selector
3519
+ e[31].target.selector
3526
3520
  )), i[0] & /*editableAnnotations*/
3527
- 64 && (s.annotation = /*editable*/
3528
- e[30]), i[0] & /*style*/
3521
+ 128 && (s.annotation = /*editable*/
3522
+ e[31]), i[0] & /*style*/
3529
3523
  2 && (s.style = /*style*/
3530
3524
  e[1]), i[0] & /*transform*/
3531
- 1024 && (s.transform = /*transform*/
3532
- e[10]), i[0] & /*$scale*/
3533
- 16384 && (s.viewportScale = /*$scale*/
3534
- e[14]), t.$set(s);
3525
+ 2048 && (s.transform = /*transform*/
3526
+ e[11]), i[0] & /*$scale*/
3527
+ 32768 && (s.viewportScale = /*$scale*/
3528
+ e[15]), t.$set(s);
3535
3529
  },
3536
3530
  i(o) {
3537
3531
  n || (P(t.$$.fragment, o), n = !0);
@@ -3547,19 +3541,19 @@ function Ct(e) {
3547
3541
  function Dt(e) {
3548
3542
  let t = (
3549
3543
  /*editable*/
3550
- e[30].id
3544
+ e[31].id
3551
3545
  ), n, o, i = Ct(e);
3552
3546
  return {
3553
3547
  c() {
3554
- i.c(), n = ce();
3548
+ i.c(), n = ae();
3555
3549
  },
3556
3550
  m(s, r) {
3557
- i.m(s, r), O(s, n, r), o = !0;
3551
+ i.m(s, r), B(s, n, r), o = !0;
3558
3552
  },
3559
3553
  p(s, r) {
3560
3554
  r[0] & /*editableAnnotations*/
3561
- 64 && W(t, t = /*editable*/
3562
- s[30].id) ? (re(), D(i, 1, 1, V), le(), i = Ct(s), i.c(), P(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3555
+ 128 && K(t, t = /*editable*/
3556
+ s[31].id) ? (se(), D(i, 1, 1, G), re(), i = Ct(s), i.c(), P(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3563
3557
  },
3564
3558
  i(s) {
3565
3559
  o || (P(i), o = !0);
@@ -3568,14 +3562,14 @@ function Dt(e) {
3568
3562
  D(i), o = !1;
3569
3563
  },
3570
3564
  d(s) {
3571
- s && L(n), i.d(s);
3565
+ s && k(n), i.d(s);
3572
3566
  }
3573
3567
  };
3574
3568
  }
3575
3569
  function gi(e) {
3576
3570
  let t, n, o, i, s, r, l = Se(
3577
3571
  /*$store*/
3578
- e[13]
3572
+ e[14]
3579
3573
  ), a = [];
3580
3574
  for (let f = 0; f < l.length; f += 1)
3581
3575
  a[f] = It(kt(e, l, f));
@@ -3584,151 +3578,155 @@ function gi(e) {
3584
3578
  });
3585
3579
  let u = (
3586
3580
  /*drawingEl*/
3587
- e[4] && Pt(e)
3581
+ e[5] && Pt(e)
3588
3582
  );
3589
3583
  return {
3590
3584
  c() {
3591
- t = R("svg"), n = R("g");
3585
+ t = X("svg"), n = X("g");
3592
3586
  for (let f = 0; f < a.length; f += 1)
3593
3587
  a[f].c();
3594
- o = R("g"), u && u.c(), d(o, "class", "drawing"), d(t, "class", "a9s-annotationlayer"), ze(
3588
+ o = X("g"), u && u.c(), h(o, "class", "drawing"), h(t, "class", "a9s-annotationlayer"), Ee(
3595
3589
  t,
3596
3590
  "drawing",
3597
3591
  /*tool*/
3598
- e[12]
3599
- );
3592
+ e[13]
3593
+ ), Ee(t, "hidden", !/*visible*/
3594
+ e[3]);
3600
3595
  },
3601
- m(f, h) {
3602
- O(f, t, h), se(t, n);
3596
+ m(f, d) {
3597
+ B(f, t, d), ie(t, n);
3603
3598
  for (let g = 0; g < a.length; g += 1)
3604
3599
  a[g] && a[g].m(n, null);
3605
- se(t, o), u && u.m(o, null), e[26](o), e[27](t), i = !0, s || (r = [
3606
- F(t, "pointerup", function() {
3607
- q(
3600
+ ie(t, o), u && u.m(o, null), e[27](o), e[28](t), i = !0, s || (r = [
3601
+ H(t, "pointerup", function() {
3602
+ j(
3608
3603
  /*onPointerUp*/
3609
- e[8]
3610
- ) && e[8].apply(this, arguments);
3611
- }),
3612
- F(t, "pointerdown", function() {
3613
- q(
3614
- /*onPointerDown*/
3615
3604
  e[9]
3616
3605
  ) && e[9].apply(this, arguments);
3606
+ }),
3607
+ H(t, "pointerdown", function() {
3608
+ j(
3609
+ /*onPointerDown*/
3610
+ e[10]
3611
+ ) && e[10].apply(this, arguments);
3617
3612
  })
3618
3613
  ], s = !0);
3619
3614
  },
3620
- p(f, h) {
3621
- if (e = f, h[0] & /*$store, style, isEditable*/
3622
- 8322) {
3615
+ p(f, d) {
3616
+ if (e = f, d[0] & /*$store, style, isEditable*/
3617
+ 16642) {
3623
3618
  l = Se(
3624
3619
  /*$store*/
3625
- e[13]
3620
+ e[14]
3626
3621
  );
3627
3622
  let g;
3628
3623
  for (g = 0; g < l.length; g += 1) {
3629
3624
  const m = kt(e, l, g);
3630
- a[g] ? (a[g].p(m, h), P(a[g], 1)) : (a[g] = It(m), a[g].c(), P(a[g], 1), a[g].m(n, null));
3625
+ a[g] ? (a[g].p(m, d), P(a[g], 1)) : (a[g] = It(m), a[g].c(), P(a[g], 1), a[g].m(n, null));
3631
3626
  }
3632
- for (re(), g = l.length; g < a.length; g += 1)
3627
+ for (se(), g = l.length; g < a.length; g += 1)
3633
3628
  c(g);
3634
- le();
3629
+ re();
3635
3630
  }
3636
3631
  /*drawingEl*/
3637
- e[4] ? u ? (u.p(e, h), h[0] & /*drawingEl*/
3638
- 16 && P(u, 1)) : (u = Pt(e), u.c(), P(u, 1), u.m(o, null)) : u && (re(), D(u, 1, 1, () => {
3632
+ e[5] ? u ? (u.p(e, d), d[0] & /*drawingEl*/
3633
+ 32 && P(u, 1)) : (u = Pt(e), u.c(), P(u, 1), u.m(o, null)) : u && (se(), D(u, 1, 1, () => {
3639
3634
  u = null;
3640
- }), le()), (!i || h[0] & /*tool*/
3641
- 4096) && ze(
3635
+ }), re()), (!i || d[0] & /*tool*/
3636
+ 8192) && Ee(
3642
3637
  t,
3643
3638
  "drawing",
3644
3639
  /*tool*/
3645
- e[12]
3646
- );
3640
+ e[13]
3641
+ ), (!i || d[0] & /*visible*/
3642
+ 8) && Ee(t, "hidden", !/*visible*/
3643
+ e[3]);
3647
3644
  },
3648
3645
  i(f) {
3649
3646
  if (!i) {
3650
- for (let h = 0; h < l.length; h += 1)
3651
- P(a[h]);
3647
+ for (let d = 0; d < l.length; d += 1)
3648
+ P(a[d]);
3652
3649
  P(u), i = !0;
3653
3650
  }
3654
3651
  },
3655
3652
  o(f) {
3656
3653
  a = a.filter(en);
3657
- for (let h = 0; h < a.length; h += 1)
3658
- D(a[h]);
3654
+ for (let d = 0; d < a.length; d += 1)
3655
+ D(a[d]);
3659
3656
  D(u), i = !1;
3660
3657
  },
3661
3658
  d(f) {
3662
- f && L(t), rt(a, f), u && u.d(), e[26](null), e[27](null), s = !1, ae(r);
3659
+ f && k(t), rt(a, f), u && u.d(), e[27](null), e[28](null), s = !1, le(r);
3663
3660
  }
3664
3661
  };
3665
3662
  }
3666
3663
  function mi(e, t, n) {
3667
- let o, i, s, r, l, a, c, u, f, h, g = V, m = () => (g(), g = Vt(p, (I) => n(14, h = I)), p);
3664
+ let o, i, s, r, l, a, c, u, f, d, g = G, m = () => (g(), g = Vt(b, (L) => n(15, d = L)), b);
3668
3665
  e.$$.on_destroy.push(() => g());
3669
- let { drawingEnabled: _ } = t, { image: b } = t, { preferredDrawingMode: y } = t, { state: A } = t, { style: w = void 0 } = t, { toolName: E = xt()[0] } = t, { user: B } = t, U, X, p;
3670
- Pe(() => m(n(5, p = bo(b, X))));
3671
- const { selection: T, store: S } = A;
3672
- ht(e, T, (I) => n(25, u = I)), ht(e, S, (I) => n(13, f = I));
3673
- let M, k;
3674
- const C = (I) => {
3675
- M && S.unobserve(M);
3676
- const z = I.filter(({ editable: H }) => H).map(({ id: H }) => H);
3677
- z.length > 0 ? (n(6, k = z.map((H) => S.getAnnotation(H)).filter(Boolean)), M = (H) => {
3678
- const { updated: J } = H.changes;
3679
- n(6, k = J == null ? void 0 : J.map((fe) => fe.newValue));
3680
- }, S.observe(M, { annotations: z })) : n(6, k = void 0);
3681
- }, Z = (I) => {
3682
- const z = qt(), H = {
3683
- id: z,
3666
+ let { drawingEnabled: y } = t, { image: E } = t, { preferredDrawingMode: p } = t, { state: S } = t, { style: w = void 0 } = t, { toolName: A = xt()[0] } = t, { user: I } = t, { visible: N = !0 } = t, U, _, b;
3667
+ Ye(() => m(n(6, b = bo(E, _))));
3668
+ const { selection: T, store: M } = S;
3669
+ ht(e, T, (L) => n(26, u = L)), ht(e, M, (L) => n(14, f = L));
3670
+ let O, Y;
3671
+ const Z = (L) => {
3672
+ O && M.unobserve(O);
3673
+ const W = L.filter(({ editable: V }) => V).map(({ id: V }) => V);
3674
+ W.length > 0 ? (n(7, Y = W.map((V) => M.getAnnotation(V)).filter(Boolean)), O = (V) => {
3675
+ const { updated: ce } = V.changes;
3676
+ n(7, Y = ce == null ? void 0 : ce.map((J) => J.newValue));
3677
+ }, M.observe(O, { annotations: W })) : n(7, Y = void 0);
3678
+ }, he = (L) => {
3679
+ const W = qt(), V = {
3680
+ id: W,
3684
3681
  bodies: [],
3685
3682
  target: {
3686
- annotation: z,
3687
- selector: I.detail,
3688
- creator: B,
3683
+ annotation: W,
3684
+ selector: L.detail,
3685
+ creator: I,
3689
3686
  created: /* @__PURE__ */ new Date()
3690
3687
  }
3691
3688
  };
3692
- S.addAnnotation(H), T.setSelected(H.id);
3693
- }, ge = (I) => (z) => {
3694
- var ne;
3695
- const { target: H } = I, J = 10 * 60 * 1e3, fe = ((ne = H.creator) == null ? void 0 : ne.id) !== B.id || !H.created || (/* @__PURE__ */ new Date()).getTime() - H.created.getTime() > J;
3696
- S.updateTarget({
3697
- ...H,
3698
- selector: z.detail,
3699
- created: fe ? H.created : /* @__PURE__ */ new Date(),
3700
- updated: fe ? /* @__PURE__ */ new Date() : void 0,
3701
- updatedBy: fe ? B : void 0
3689
+ M.addAnnotation(V), T.setSelected(V.id);
3690
+ }, ge = (L) => (W) => {
3691
+ var R;
3692
+ const { target: V } = L, ce = 10 * 60 * 1e3, J = ((R = V.creator) == null ? void 0 : R.id) !== I.id || !V.created || (/* @__PURE__ */ new Date()).getTime() - V.created.getTime() > ce;
3693
+ M.updateTarget({
3694
+ ...V,
3695
+ selector: W.detail,
3696
+ created: J ? V.created : /* @__PURE__ */ new Date(),
3697
+ updated: J ? /* @__PURE__ */ new Date() : void 0,
3698
+ updatedBy: J ? I : void 0
3702
3699
  });
3703
- }, me = (I) => Bo(I);
3704
- function Me(I) {
3705
- He[I ? "unshift" : "push"](() => {
3706
- U = I, n(4, U);
3700
+ }, Me = (L) => Bo(L);
3701
+ function oe(L) {
3702
+ He[L ? "unshift" : "push"](() => {
3703
+ U = L, n(5, U);
3707
3704
  });
3708
3705
  }
3709
- function ie(I) {
3710
- He[I ? "unshift" : "push"](() => {
3711
- X = I, n(3, X);
3706
+ function ve(L) {
3707
+ He[L ? "unshift" : "push"](() => {
3708
+ _ = L, n(4, _);
3712
3709
  });
3713
3710
  }
3714
- return e.$$set = (I) => {
3715
- "drawingEnabled" in I && n(0, _ = I.drawingEnabled), "image" in I && n(20, b = I.image), "preferredDrawingMode" in I && n(21, y = I.preferredDrawingMode), "state" in I && n(22, A = I.state), "style" in I && n(1, w = I.style), "toolName" in I && n(2, E = I.toolName), "user" in I && n(23, B = I.user);
3711
+ return e.$$set = (L) => {
3712
+ "drawingEnabled" in L && n(0, y = L.drawingEnabled), "image" in L && n(21, E = L.image), "preferredDrawingMode" in L && n(22, p = L.preferredDrawingMode), "state" in L && n(23, S = L.state), "style" in L && n(1, w = L.style), "toolName" in L && n(2, A = L.toolName), "user" in L && n(24, I = L.user), "visible" in L && n(3, N = L.visible);
3716
3713
  }, e.$$.update = () => {
3717
3714
  e.$$.dirty[0] & /*toolName*/
3718
- 4 && n(12, { tool: o, opts: i } = $t(E) || { tool: void 0, opts: void 0 }, o, (n(24, i), n(2, E))), e.$$.dirty[0] & /*opts, preferredDrawingMode*/
3719
- 18874368 && n(11, s = (i == null ? void 0 : i.drawingMode) || y), e.$$.dirty[0] & /*svgEl*/
3720
- 8 && n(10, r = si(X)), e.$$.dirty[0] & /*svgEl*/
3721
- 8 && n(9, { onPointerDown: l, onPointerUp: a } = li(X, S), l, (n(8, a), n(3, X))), e.$$.dirty[0] & /*$selection*/
3722
- 33554432 && n(7, c = (I) => u.selected.find((z) => z.id === I.id && z.editable)), e.$$.dirty[0] & /*$selection*/
3723
- 33554432 && C(u.selected);
3715
+ 4 && n(13, { tool: o, opts: i } = $t(A) || { tool: void 0, opts: void 0 }, o, (n(25, i), n(2, A))), e.$$.dirty[0] & /*opts, preferredDrawingMode*/
3716
+ 37748736 && n(12, s = (i == null ? void 0 : i.drawingMode) || p), e.$$.dirty[0] & /*svgEl*/
3717
+ 16 && n(11, r = si(_)), e.$$.dirty[0] & /*svgEl*/
3718
+ 16 && n(10, { onPointerDown: l, onPointerUp: a } = li(_, M), l, (n(9, a), n(4, _))), e.$$.dirty[0] & /*$selection*/
3719
+ 67108864 && n(8, c = (L) => u.selected.find((W) => W.id === L.id && W.editable)), e.$$.dirty[0] & /*$selection*/
3720
+ 67108864 && Z(u.selected);
3724
3721
  }, [
3725
- _,
3722
+ y,
3726
3723
  w,
3727
- E,
3728
- X,
3724
+ A,
3725
+ N,
3726
+ _,
3729
3727
  U,
3730
- p,
3731
- k,
3728
+ b,
3729
+ Y,
3732
3730
  c,
3733
3731
  a,
3734
3732
  l,
@@ -3736,20 +3734,20 @@ function mi(e, t, n) {
3736
3734
  s,
3737
3735
  o,
3738
3736
  f,
3739
- h,
3737
+ d,
3740
3738
  T,
3741
- S,
3742
- Z,
3739
+ M,
3740
+ he,
3743
3741
  ge,
3744
- me,
3745
- b,
3746
- y,
3747
- A,
3748
- B,
3742
+ Me,
3743
+ E,
3744
+ p,
3745
+ S,
3746
+ I,
3749
3747
  i,
3750
3748
  u,
3751
- Me,
3752
- ie
3749
+ oe,
3750
+ ve
3753
3751
  ];
3754
3752
  }
3755
3753
  class pi extends te {
@@ -3759,15 +3757,16 @@ class pi extends te {
3759
3757
  t,
3760
3758
  mi,
3761
3759
  gi,
3762
- W,
3760
+ K,
3763
3761
  {
3764
3762
  drawingEnabled: 0,
3765
- image: 20,
3766
- preferredDrawingMode: 21,
3767
- state: 22,
3763
+ image: 21,
3764
+ preferredDrawingMode: 22,
3765
+ state: 23,
3768
3766
  style: 1,
3769
3767
  toolName: 2,
3770
- user: 23
3768
+ user: 24,
3769
+ visible: 3
3771
3770
  },
3772
3771
  null,
3773
3772
  [-1, -1]
@@ -3783,17 +3782,17 @@ function tn(e, t, n, o, i) {
3783
3782
  var s = o - n + 1, r = t - n + 1, l = Math.log(s), a = 0.5 * Math.exp(2 * l / 3), c = 0.5 * Math.sqrt(l * a * (s - a) / s) * (r - s / 2 < 0 ? -1 : 1), u = Math.max(n, Math.floor(t - r * a / s + c)), f = Math.min(o, Math.floor(t + (s - r) * a / s + c));
3784
3783
  tn(e, t, u, f, i);
3785
3784
  }
3786
- var h = e[t], g = n, m = o;
3787
- for (ve(e, n, t), i(e[o], h) > 0 && ve(e, n, o); g < m; ) {
3788
- for (ve(e, g, m), g++, m--; i(e[g], h) < 0; )
3785
+ var d = e[t], g = n, m = o;
3786
+ for (Le(e, n, t), i(e[o], d) > 0 && Le(e, n, o); g < m; ) {
3787
+ for (Le(e, g, m), g++, m--; i(e[g], d) < 0; )
3789
3788
  g++;
3790
- for (; i(e[m], h) > 0; )
3789
+ for (; i(e[m], d) > 0; )
3791
3790
  m--;
3792
3791
  }
3793
- i(e[n], h) === 0 ? ve(e, n, m) : (m++, ve(e, m, o)), m <= t && (n = m + 1), t <= m && (o = m - 1);
3792
+ i(e[n], d) === 0 ? Le(e, n, m) : (m++, Le(e, m, o)), m <= t && (n = m + 1), t <= m && (o = m - 1);
3794
3793
  }
3795
3794
  }
3796
- function ve(e, t, n) {
3795
+ function Le(e, t, n) {
3797
3796
  var o = e[t];
3798
3797
  e[t] = e[n], e[n] = o;
3799
3798
  }
@@ -3810,13 +3809,13 @@ class wi {
3810
3809
  search(t) {
3811
3810
  let n = this.data;
3812
3811
  const o = [];
3813
- if (!Ne(t, n))
3812
+ if (!Ve(t, n))
3814
3813
  return o;
3815
3814
  const i = this.toBBox, s = [];
3816
3815
  for (; n; ) {
3817
3816
  for (let r = 0; r < n.children.length; r++) {
3818
3817
  const l = n.children[r], a = n.leaf ? i(l) : l;
3819
- Ne(t, a) && (n.leaf ? o.push(l) : tt(t, a) ? this._all(l, o) : s.push(l));
3818
+ Ve(t, a) && (n.leaf ? o.push(l) : tt(t, a) ? this._all(l, o) : s.push(l));
3820
3819
  }
3821
3820
  n = s.pop();
3822
3821
  }
@@ -3824,13 +3823,13 @@ class wi {
3824
3823
  }
3825
3824
  collides(t) {
3826
3825
  let n = this.data;
3827
- if (!Ne(t, n))
3826
+ if (!Ve(t, n))
3828
3827
  return !1;
3829
3828
  const o = [];
3830
3829
  for (; n; ) {
3831
3830
  for (let i = 0; i < n.children.length; i++) {
3832
3831
  const s = n.children[i], r = n.leaf ? this.toBBox(s) : s;
3833
- if (Ne(t, r)) {
3832
+ if (Ve(t, r)) {
3834
3833
  if (n.leaf || tt(t, r))
3835
3834
  return !0;
3836
3835
  o.push(s);
@@ -3866,7 +3865,7 @@ class wi {
3866
3865
  return t && this._insert(t, this.data.height - 1), this;
3867
3866
  }
3868
3867
  clear() {
3869
- return this.data = Ee([]), this;
3868
+ return this.data = be([]), this;
3870
3869
  }
3871
3870
  remove(t, n) {
3872
3871
  if (!t)
@@ -3909,19 +3908,19 @@ class wi {
3909
3908
  const s = o - n + 1;
3910
3909
  let r = this._maxEntries, l;
3911
3910
  if (s <= r)
3912
- return l = Ee(t.slice(n, o + 1)), we(l, this.toBBox), l;
3913
- i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), l = Ee([]), l.leaf = !1, l.height = i;
3911
+ return l = be(t.slice(n, o + 1)), _e(l, this.toBBox), l;
3912
+ i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), l = be([]), l.leaf = !1, l.height = i;
3914
3913
  const a = Math.ceil(s / r), c = a * Math.ceil(Math.sqrt(r));
3915
3914
  Xt(t, n, o, c, this.compareMinX);
3916
3915
  for (let u = n; u <= o; u += c) {
3917
3916
  const f = Math.min(u + c - 1, o);
3918
3917
  Xt(t, u, f, a, this.compareMinY);
3919
- for (let h = u; h <= f; h += a) {
3920
- const g = Math.min(h + a - 1, f);
3921
- l.children.push(this._build(t, h, g, i - 1));
3918
+ for (let d = u; d <= f; d += a) {
3919
+ const g = Math.min(d + a - 1, f);
3920
+ l.children.push(this._build(t, d, g, i - 1));
3922
3921
  }
3923
3922
  }
3924
- return we(l, this.toBBox), l;
3923
+ return _e(l, this.toBBox), l;
3925
3924
  }
3926
3925
  _chooseSubtree(t, n, o, i) {
3927
3926
  for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
@@ -3936,7 +3935,7 @@ class wi {
3936
3935
  }
3937
3936
  _insert(t, n, o) {
3938
3937
  const i = o ? t : this.toBBox(t), s = [], r = this._chooseSubtree(i, this.data, n, s);
3939
- for (r.children.push(t), Oe(r, i); n >= 0 && s[n].children.length > this._maxEntries; )
3938
+ for (r.children.push(t), Be(r, i); n >= 0 && s[n].children.length > this._maxEntries; )
3940
3939
  this._split(s, n), n--;
3941
3940
  this._adjustParentBBoxes(i, s, n);
3942
3941
  }
@@ -3944,16 +3943,16 @@ class wi {
3944
3943
  _split(t, n) {
3945
3944
  const o = t[n], i = o.children.length, s = this._minEntries;
3946
3945
  this._chooseSplitAxis(o, s, i);
3947
- const r = this._chooseSplitIndex(o, s, i), l = Ee(o.children.splice(r, o.children.length - r));
3948
- l.height = o.height, l.leaf = o.leaf, we(o, this.toBBox), we(l, this.toBBox), n ? t[n - 1].children.push(l) : this._splitRoot(o, l);
3946
+ const r = this._chooseSplitIndex(o, s, i), l = be(o.children.splice(r, o.children.length - r));
3947
+ l.height = o.height, l.leaf = o.leaf, _e(o, this.toBBox), _e(l, this.toBBox), n ? t[n - 1].children.push(l) : this._splitRoot(o, l);
3949
3948
  }
3950
3949
  _splitRoot(t, n) {
3951
- this.data = Ee([t, n]), this.data.height = t.height + 1, this.data.leaf = !1, we(this.data, this.toBBox);
3950
+ this.data = be([t, n]), this.data.height = t.height + 1, this.data.leaf = !1, _e(this.data, this.toBBox);
3952
3951
  }
3953
3952
  _chooseSplitIndex(t, n, o) {
3954
3953
  let i, s = 1 / 0, r = 1 / 0;
3955
3954
  for (let l = n; l <= o - n; l++) {
3956
- const a = ke(t, 0, l, this.toBBox), c = ke(t, l, o, this.toBBox), u = Ti(a, c), f = et(a) + et(c);
3955
+ const a = Oe(t, 0, l, this.toBBox), c = Oe(t, l, o, this.toBBox), u = Ti(a, c), f = et(a) + et(c);
3957
3956
  u < s ? (s = u, i = l, r = f < r ? f : r) : u === s && f < r && (r = f, i = l);
3958
3957
  }
3959
3958
  return i || o - n;
@@ -3966,25 +3965,25 @@ class wi {
3966
3965
  // total margin of all possible split distributions where each node is at least m full
3967
3966
  _allDistMargin(t, n, o, i) {
3968
3967
  t.children.sort(i);
3969
- const s = this.toBBox, r = ke(t, 0, n, s), l = ke(t, o - n, o, s);
3970
- let a = Ue(r) + Ue(l);
3968
+ const s = this.toBBox, r = Oe(t, 0, n, s), l = Oe(t, o - n, o, s);
3969
+ let a = Ne(r) + Ne(l);
3971
3970
  for (let c = n; c < o - n; c++) {
3972
3971
  const u = t.children[c];
3973
- Oe(r, t.leaf ? s(u) : u), a += Ue(r);
3972
+ Be(r, t.leaf ? s(u) : u), a += Ne(r);
3974
3973
  }
3975
3974
  for (let c = o - n - 1; c >= n; c--) {
3976
3975
  const u = t.children[c];
3977
- Oe(l, t.leaf ? s(u) : u), a += Ue(l);
3976
+ Be(l, t.leaf ? s(u) : u), a += Ne(l);
3978
3977
  }
3979
3978
  return a;
3980
3979
  }
3981
3980
  _adjustParentBBoxes(t, n, o) {
3982
3981
  for (let i = o; i >= 0; i--)
3983
- Oe(n[i], t);
3982
+ Be(n[i], t);
3984
3983
  }
3985
3984
  _condense(t) {
3986
3985
  for (let n = t.length - 1, o; n >= 0; n--)
3987
- t[n].children.length === 0 ? n > 0 ? (o = t[n - 1].children, o.splice(o.indexOf(t[n]), 1)) : this.clear() : we(t[n], this.toBBox);
3986
+ t[n].children.length === 0 ? n > 0 ? (o = t[n - 1].children, o.splice(o.indexOf(t[n]), 1)) : this.clear() : _e(t[n], this.toBBox);
3988
3987
  }
3989
3988
  }
3990
3989
  function bi(e, t, n) {
@@ -3995,18 +3994,18 @@ function bi(e, t, n) {
3995
3994
  return o;
3996
3995
  return -1;
3997
3996
  }
3998
- function we(e, t) {
3999
- ke(e, 0, e.children.length, t, e);
3997
+ function _e(e, t) {
3998
+ Oe(e, 0, e.children.length, t, e);
4000
3999
  }
4001
- function ke(e, t, n, o, i) {
4002
- i || (i = Ee(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
4000
+ function Oe(e, t, n, o, i) {
4001
+ i || (i = be(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
4003
4002
  for (let s = t; s < n; s++) {
4004
4003
  const r = e.children[s];
4005
- Oe(i, e.leaf ? o(r) : r);
4004
+ Be(i, e.leaf ? o(r) : r);
4006
4005
  }
4007
4006
  return i;
4008
4007
  }
4009
- function Oe(e, t) {
4008
+ function Be(e, t) {
4010
4009
  return e.minX = Math.min(e.minX, t.minX), e.minY = Math.min(e.minY, t.minY), e.maxX = Math.max(e.maxX, t.maxX), e.maxY = Math.max(e.maxY, t.maxY), e;
4011
4010
  }
4012
4011
  function Ei(e, t) {
@@ -4018,7 +4017,7 @@ function Ai(e, t) {
4018
4017
  function et(e) {
4019
4018
  return (e.maxX - e.minX) * (e.maxY - e.minY);
4020
4019
  }
4021
- function Ue(e) {
4020
+ function Ne(e) {
4022
4021
  return e.maxX - e.minX + (e.maxY - e.minY);
4023
4022
  }
4024
4023
  function Si(e, t) {
@@ -4031,10 +4030,10 @@ function Ti(e, t) {
4031
4030
  function tt(e, t) {
4032
4031
  return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
4033
4032
  }
4034
- function Ne(e, t) {
4033
+ function Ve(e, t) {
4035
4034
  return t.minX <= e.maxX && t.minY <= e.maxY && t.maxX >= e.minX && t.maxY >= e.minY;
4036
4035
  }
4037
- function Ee(e) {
4036
+ function be(e) {
4038
4037
  return {
4039
4038
  children: e,
4040
4039
  height: 1,
@@ -4058,44 +4057,44 @@ const Mi = () => {
4058
4057
  const e = new wi(), t = /* @__PURE__ */ new Map(), n = () => [...t.values()], o = () => {
4059
4058
  e.clear(), t.clear();
4060
4059
  }, i = (f) => {
4061
- const { minX: h, minY: g, maxX: m, maxY: _ } = f.selector.geometry.bounds, b = { minX: h, minY: g, maxX: m, maxY: _, target: f };
4062
- e.insert(b), t.set(f.annotation, b);
4060
+ const { minX: d, minY: g, maxX: m, maxY: y } = f.selector.geometry.bounds, E = { minX: d, minY: g, maxX: m, maxY: y, target: f };
4061
+ e.insert(E), t.set(f.annotation, E);
4063
4062
  }, s = (f) => {
4064
- const h = t.get(f.annotation);
4065
- h && e.remove(h), t.delete(f.annotation);
4063
+ const d = t.get(f.annotation);
4064
+ d && e.remove(d), t.delete(f.annotation);
4066
4065
  };
4067
4066
  return {
4068
4067
  all: n,
4069
4068
  clear: o,
4070
- getAt: (f, h) => {
4069
+ getAt: (f, d) => {
4071
4070
  const m = e.search({
4072
4071
  minX: f,
4073
- minY: h,
4072
+ minY: d,
4074
4073
  maxX: f,
4075
- maxY: h
4076
- }).map((_) => _.target).filter((_) => _.selector.type === j.RECTANGLE || wn(_.selector, f, h));
4074
+ maxY: d
4075
+ }).map((y) => y.target).filter((y) => y.selector.type === F.RECTANGLE || wn(y.selector, f, d));
4077
4076
  if (m.length > 0)
4078
- return m.sort((_, b) => st(_.selector) - st(b.selector)), m[0];
4077
+ return m.sort((y, E) => st(y.selector) - st(E.selector)), m[0];
4079
4078
  },
4080
- getIntersecting: (f, h, g, m) => e.search({
4079
+ getIntersecting: (f, d, g, m) => e.search({
4081
4080
  minX: f,
4082
- minY: h,
4081
+ minY: d,
4083
4082
  maxX: f + g,
4084
- maxY: h + m
4085
- }).map((_) => _.target),
4083
+ maxY: d + m
4084
+ }).map((y) => y.target),
4086
4085
  insert: i,
4087
4086
  remove: s,
4088
- set: (f, h = !0) => {
4089
- h && o();
4087
+ set: (f, d = !0) => {
4088
+ d && o();
4090
4089
  const g = f.map((m) => {
4091
- const { minX: _, minY: b, maxX: y, maxY: A } = m.selector.geometry.bounds;
4092
- return { minX: _, minY: b, maxX: y, maxY: A, target: m };
4090
+ const { minX: y, minY: E, maxX: p, maxY: S } = m.selector.geometry.bounds;
4091
+ return { minX: y, minY: E, maxX: p, maxY: S, target: m };
4093
4092
  });
4094
4093
  g.forEach((m) => t.set(m.target.annotation, m)), e.load(g);
4095
4094
  },
4096
4095
  size: () => e.all().length,
4097
- update: (f, h) => {
4098
- s(f), i(h);
4096
+ update: (f, d) => {
4097
+ s(f), i(d);
4099
4098
  }
4100
4099
  };
4101
4100
  }, vi = (e) => {
@@ -4109,7 +4108,7 @@ const Mi = () => {
4109
4108
  const u = n.getAt(a, c);
4110
4109
  return u ? t.getAnnotation(u.annotation) : void 0;
4111
4110
  },
4112
- getIntersecting: (a, c, u, f) => n.getIntersecting(a, c, u, f).map((h) => t.getAnnotation(h.annotation))
4111
+ getIntersecting: (a, c, u, f) => n.getIntersecting(a, c, u, f).map((d) => t.getAnnotation(d.annotation))
4113
4112
  },
4114
4113
  selection: o,
4115
4114
  hover: i,
@@ -4176,7 +4175,7 @@ const Mi = () => {
4176
4175
  const u = Ii(l);
4177
4176
  let f = lo();
4178
4177
  Rt(n, c, o.theme);
4179
- const h = new pi({
4178
+ const d = new pi({
4180
4179
  target: c,
4181
4180
  props: {
4182
4181
  drawingEnabled: !!o.drawingEnabled,
@@ -4187,50 +4186,54 @@ const Mi = () => {
4187
4186
  user: f
4188
4187
  }
4189
4188
  });
4190
- h.$on("click", (p) => {
4191
- const { originalEvent: T, annotation: S } = p.detail;
4192
- S ? s.clickSelect(S.id, T) : s.isEmpty() || s.clear();
4189
+ d.$on("click", (b) => {
4190
+ const { originalEvent: T, annotation: M } = b.detail;
4191
+ M ? s.clickSelect(M.id, T) : s.isEmpty() || s.clear();
4193
4192
  });
4194
4193
  const g = to(i, l, o.adapter), m = () => {
4195
- h.$destroy(), c.parentNode.insertBefore(n, c), c.parentNode.removeChild(c), u.destroy(), l.destroy();
4196
- }, _ = () => f, b = (p, T, S) => Ko(p, T, S), y = (p, T) => Io(p, T), A = (p) => {
4197
- if (!$t(p))
4198
- throw `No drawing tool named ${p}`;
4199
- h.$set({ toolName: p });
4200
- }, w = (p) => h.$set({ drawingEnabled: p }), E = (p) => {
4194
+ d.$destroy(), c.parentNode.insertBefore(n, c), c.parentNode.removeChild(c), u.destroy(), l.destroy();
4195
+ }, y = () => f, E = (b, T, M) => Ko(b, T, M), p = (b, T) => Io(b, T), S = (b) => {
4196
+ if (!$t(b))
4197
+ throw `No drawing tool named ${b}`;
4198
+ d.$set({ toolName: b });
4199
+ }, w = (b) => d.$set({ drawingEnabled: b }), A = (b) => {
4201
4200
  console.warn("Filter not implemented yet");
4202
- }, B = (p) => h.$set({ style: p }), U = (p) => Rt(n, c, p), X = (p) => {
4203
- f = p, h.$set({ user: p });
4204
- };
4201
+ }, I = (b) => d.$set({ style: b }), N = (b) => Rt(n, c, b), U = (b) => {
4202
+ f = b, d.$set({ user: b });
4203
+ }, _ = (b) => (
4204
+ // @ts-ignore
4205
+ d.$set({ visible: b })
4206
+ );
4205
4207
  return {
4206
4208
  ...g,
4207
4209
  destroy: m,
4208
- getUser: _,
4210
+ getUser: y,
4209
4211
  listDrawingTools: xt,
4210
4212
  on: a.on,
4211
4213
  off: a.off,
4212
- registerDrawingTool: b,
4213
- registerShapeEditor: y,
4214
+ registerDrawingTool: E,
4215
+ registerShapeEditor: p,
4214
4216
  setDrawingEnabled: w,
4215
- setDrawingTool: A,
4216
- setFilter: E,
4217
- setStyle: B,
4218
- setTheme: U,
4219
- setUser: X,
4217
+ setDrawingTool: S,
4218
+ setFilter: A,
4219
+ setStyle: I,
4220
+ setTheme: N,
4221
+ setUser: U,
4222
+ setVisible: _,
4220
4223
  state: i
4221
4224
  };
4222
4225
  };
4223
4226
  export {
4224
4227
  Qt as Editor,
4225
4228
  Xo as EditorMount,
4226
- Le as Handle,
4229
+ ke as Handle,
4227
4230
  Ci as IdentityTransform,
4228
4231
  yo as PolygonEditor,
4229
4232
  Oo as RectangleEditor,
4230
4233
  An as RectangleUtil,
4231
4234
  Go as RubberbandRectangle,
4232
4235
  pi as SVGAnnotationLayer,
4233
- j as ShapeType,
4236
+ F as ShapeType,
4234
4237
  Uo as ToolMount,
4235
4238
  Yi as W3CImageFormat,
4236
4239
  li as addEventListeners,