@annotorious/annotorious 3.0.0-rc.3 → 3.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,47 @@
1
- function H() {
1
+ function F() {
2
2
  }
3
- function Kt(e, t) {
3
+ function Qt(e, t) {
4
4
  for (const n in t)
5
5
  e[n] = t[n];
6
6
  return e;
7
7
  }
8
- function Dt(e) {
8
+ function Xt(e) {
9
9
  return e();
10
10
  }
11
11
  function ct() {
12
12
  return /* @__PURE__ */ Object.create(null);
13
13
  }
14
14
  function ae(e) {
15
- e.forEach(Dt);
15
+ e.forEach(Xt);
16
16
  }
17
- function j(e) {
17
+ function W(e) {
18
18
  return typeof e == "function";
19
19
  }
20
20
  function $(e, t) {
21
21
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
22
22
  }
23
- function Zt(e) {
23
+ function xt(e) {
24
24
  return Object.keys(e).length === 0;
25
25
  }
26
- function Xt(e, ...t) {
26
+ function Ut(e, ...t) {
27
27
  if (e == null)
28
- return H;
28
+ return F;
29
29
  const n = e.subscribe(...t);
30
30
  return n.unsubscribe ? () => n.unsubscribe() : n;
31
31
  }
32
32
  function ft(e, t, n) {
33
- e.$$.on_destroy.push(Xt(t, n));
33
+ e.$$.on_destroy.push(Ut(t, n));
34
34
  }
35
- function Qt(e, t, n, o) {
35
+ function $t(e, t, n, o) {
36
36
  if (e) {
37
- const i = Ut(e, t, n, o);
37
+ const i = Nt(e, t, n, o);
38
38
  return e[0](i);
39
39
  }
40
40
  }
41
- function Ut(e, t, n, o) {
42
- return e[1] && o ? Kt(n.ctx.slice(), e[1](o(t))) : n.ctx;
41
+ function Nt(e, t, n, o) {
42
+ return e[1] && o ? Qt(n.ctx.slice(), e[1](o(t))) : n.ctx;
43
43
  }
44
- function xt(e, t, n, o) {
44
+ function en(e, t, n, o) {
45
45
  if (e[2] && o) {
46
46
  const i = e[2](o(n));
47
47
  if (t.dirty === void 0)
@@ -56,13 +56,13 @@ function xt(e, t, n, o) {
56
56
  }
57
57
  return t.dirty;
58
58
  }
59
- function $t(e, t, n, o, i, s) {
59
+ function tn(e, t, n, o, i, s) {
60
60
  if (i) {
61
- const r = Ut(t, n, o, s);
61
+ const r = Nt(t, n, o, s);
62
62
  e.p(r, i);
63
63
  }
64
64
  }
65
- function en(e) {
65
+ function nn(e) {
66
66
  if (e.ctx.length > 32) {
67
67
  const t = [], n = e.ctx.length / 32;
68
68
  for (let o = 0; o < n; o++)
@@ -74,41 +74,41 @@ function en(e) {
74
74
  function fe(e, t) {
75
75
  e.appendChild(t);
76
76
  }
77
- function v(e, t, n) {
77
+ function C(e, t, n) {
78
78
  e.insertBefore(t, n || null);
79
79
  }
80
- function O(e) {
80
+ function I(e) {
81
81
  e.parentNode && e.parentNode.removeChild(e);
82
82
  }
83
83
  function ot(e, t) {
84
84
  for (let n = 0; n < e.length; n += 1)
85
85
  e[n] && e[n].d(t);
86
86
  }
87
- function I(e) {
87
+ function D(e) {
88
88
  return document.createElementNS("http://www.w3.org/2000/svg", e);
89
89
  }
90
- function Nt(e) {
90
+ function Gt(e) {
91
91
  return document.createTextNode(e);
92
92
  }
93
93
  function ne() {
94
- return Nt(" ");
94
+ return Gt(" ");
95
95
  }
96
96
  function ce() {
97
- return Nt("");
97
+ return Gt("");
98
98
  }
99
- function J(e, t, n, o) {
99
+ function K(e, t, n, o) {
100
100
  return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
101
101
  }
102
102
  function u(e, t, n) {
103
103
  n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
104
104
  }
105
- function tn(e) {
105
+ function on(e) {
106
106
  return Array.from(e.childNodes);
107
107
  }
108
108
  function ut(e, t, n) {
109
109
  e.classList[n ? "add" : "remove"](t);
110
110
  }
111
- function nn(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
111
+ function sn(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
112
112
  const i = document.createEvent("CustomEvent");
113
113
  return i.initCustomEvent(e, n, o, t), i;
114
114
  }
@@ -116,20 +116,20 @@ let Be;
116
116
  function ke(e) {
117
117
  Be = e;
118
118
  }
119
- function Gt() {
119
+ function Ht() {
120
120
  if (!Be)
121
121
  throw new Error("Function called outside component initialization");
122
122
  return Be;
123
123
  }
124
- function Ce(e) {
125
- Gt().$$.on_mount.push(e);
124
+ function Ie(e) {
125
+ Ht().$$.on_mount.push(e);
126
126
  }
127
127
  function Se() {
128
- const e = Gt();
128
+ const e = Ht();
129
129
  return (t, n, { cancelable: o = !1 } = {}) => {
130
130
  const i = e.$$.callbacks[t];
131
131
  if (i) {
132
- const s = nn(t, n, { cancelable: o });
132
+ const s = sn(t, n, { cancelable: o });
133
133
  return i.slice().forEach((r) => {
134
134
  r.call(e, s);
135
135
  }), !s.defaultPrevented;
@@ -143,17 +143,17 @@ function Ae(e, t) {
143
143
  }
144
144
  const be = [], Ge = [];
145
145
  let Te = [];
146
- const dt = [], on = /* @__PURE__ */ Promise.resolve();
146
+ const dt = [], rn = /* @__PURE__ */ Promise.resolve();
147
147
  let et = !1;
148
- function sn() {
149
- et || (et = !0, on.then(Ht));
148
+ function ln() {
149
+ et || (et = !0, rn.then(Ft));
150
150
  }
151
151
  function tt(e) {
152
152
  Te.push(e);
153
153
  }
154
154
  const qe = /* @__PURE__ */ new Set();
155
155
  let _e = 0;
156
- function Ht() {
156
+ function Ft() {
157
157
  if (_e !== 0)
158
158
  return;
159
159
  const e = Be;
@@ -161,7 +161,7 @@ function Ht() {
161
161
  try {
162
162
  for (; _e < be.length; ) {
163
163
  const t = be[_e];
164
- _e++, ke(t), rn(t.$$);
164
+ _e++, ke(t), an(t.$$);
165
165
  }
166
166
  } catch (t) {
167
167
  throw be.length = 0, _e = 0, t;
@@ -178,14 +178,14 @@ function Ht() {
178
178
  dt.pop()();
179
179
  et = !1, qe.clear(), ke(e);
180
180
  }
181
- function rn(e) {
181
+ function an(e) {
182
182
  if (e.fragment !== null) {
183
183
  e.update(), ae(e.before_update);
184
184
  const t = e.dirty;
185
185
  e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(tt);
186
186
  }
187
187
  }
188
- function ln(e) {
188
+ function cn(e) {
189
189
  const t = [], n = [];
190
190
  Te.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Te = t;
191
191
  }
@@ -202,7 +202,7 @@ function re() {
202
202
  function le() {
203
203
  me.r || ae(me.c), me = me.p;
204
204
  }
205
- function Y(e, t) {
205
+ function X(e, t) {
206
206
  e && e.i && (Ne.delete(e), e.i(t));
207
207
  }
208
208
  function N(e, t, n, o) {
@@ -221,26 +221,26 @@ function pe(e) {
221
221
  function ue(e, t, n, o) {
222
222
  const { fragment: i, after_update: s } = e.$$;
223
223
  i && i.m(t, n), o || tt(() => {
224
- const r = e.$$.on_mount.map(Dt).filter(j);
224
+ const r = e.$$.on_mount.map(Xt).filter(W);
225
225
  e.$$.on_destroy ? e.$$.on_destroy.push(...r) : ae(r), e.$$.on_mount = [];
226
226
  }), s.forEach(tt);
227
227
  }
228
228
  function de(e, t) {
229
229
  const n = e.$$;
230
- n.fragment !== null && (ln(n.after_update), ae(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
230
+ n.fragment !== null && (cn(n.after_update), ae(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
231
231
  }
232
- function an(e, t) {
233
- e.$$.dirty[0] === -1 && (be.push(e), sn(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
232
+ function fn(e, t) {
233
+ e.$$.dirty[0] === -1 && (be.push(e), ln(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
234
234
  }
235
235
  function oe(e, t, n, o, i, s, r, a = [-1]) {
236
236
  const l = Be;
237
237
  ke(e);
238
- const d = e.$$ = {
238
+ const f = e.$$ = {
239
239
  fragment: null,
240
240
  ctx: [],
241
241
  // state
242
242
  props: s,
243
- update: H,
243
+ update: F,
244
244
  not_equal: i,
245
245
  bound: ct(),
246
246
  // lifecycle
@@ -256,28 +256,28 @@ function oe(e, t, n, o, i, s, r, a = [-1]) {
256
256
  skip_bound: !1,
257
257
  root: t.target || l.$$.root
258
258
  };
259
- r && r(d.root);
260
- let m = !1;
261
- if (d.ctx = n ? n(e, t.props || {}, (c, f, ...h) => {
262
- const p = h.length ? h[0] : f;
263
- return d.ctx && i(d.ctx[c], d.ctx[c] = p) && (!d.skip_bound && d.bound[c] && d.bound[c](p), m && an(e, c)), f;
264
- }) : [], d.update(), m = !0, ae(d.before_update), d.fragment = o ? o(d.ctx) : !1, t.target) {
259
+ r && r(f.root);
260
+ let h = !1;
261
+ if (f.ctx = n ? n(e, t.props || {}, (c, d, ...m) => {
262
+ const g = m.length ? m[0] : d;
263
+ return f.ctx && i(f.ctx[c], f.ctx[c] = g) && (!f.skip_bound && f.bound[c] && f.bound[c](g), h && fn(e, c)), d;
264
+ }) : [], f.update(), h = !0, ae(f.before_update), f.fragment = o ? o(f.ctx) : !1, t.target) {
265
265
  if (t.hydrate) {
266
- const c = tn(t.target);
267
- d.fragment && d.fragment.l(c), c.forEach(O);
266
+ const c = on(t.target);
267
+ f.fragment && f.fragment.l(c), c.forEach(I);
268
268
  } else
269
- d.fragment && d.fragment.c();
270
- t.intro && Y(e.$$.fragment), ue(e, t.target, t.anchor, t.customElement), Ht();
269
+ f.fragment && f.fragment.c();
270
+ t.intro && X(e.$$.fragment), ue(e, t.target, t.anchor, t.customElement), Ft();
271
271
  }
272
272
  ke(l);
273
273
  }
274
274
  class ie {
275
275
  $destroy() {
276
- de(this, 1), this.$destroy = H;
276
+ de(this, 1), this.$destroy = F;
277
277
  }
278
278
  $on(t, n) {
279
- if (!j(n))
280
- return H;
279
+ if (!W(n))
280
+ return F;
281
281
  const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
282
282
  return o.push(n), () => {
283
283
  const i = o.indexOf(n);
@@ -285,24 +285,24 @@ class ie {
285
285
  };
286
286
  }
287
287
  $set(t) {
288
- this.$$set && !Zt(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
288
+ this.$$set && !xt(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
289
289
  }
290
290
  }
291
- var V = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(V || {});
292
- const it = {}, st = (e, t) => it[e] = t, nt = (e) => it[e.type].area(e), cn = (e, t, n) => it[e.type].intersects(e, t, n), He = (e) => {
291
+ var j = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(j || {});
292
+ const it = {}, st = (e, t) => it[e] = t, nt = (e) => it[e.type].area(e), un = (e, t, n) => it[e.type].intersects(e, t, n), He = (e) => {
293
293
  let t = 1 / 0, n = 1 / 0, o = -1 / 0, i = -1 / 0;
294
294
  return e.forEach(([s, r]) => {
295
295
  t = Math.min(t, s), n = Math.min(n, r), o = Math.max(o, s), i = Math.max(i, r);
296
296
  }), { minX: t, minY: n, maxX: o, maxY: i };
297
- }, fn = {
297
+ }, dn = {
298
298
  area: (e) => Math.PI * e.geometry.rx * e.geometry.ry,
299
299
  intersects: (e, t, n) => {
300
- const { cx: o, cy: i, rx: s, ry: r } = e.geometry, a = 0, l = Math.cos(a), d = Math.sin(a), m = t - o, c = n - i, f = l * m + d * c, h = d * m - l * c;
301
- return f * f / (s * s) + h * h / (r * r) <= 1;
300
+ const { cx: o, cy: i, rx: s, ry: r } = e.geometry, a = 0, l = Math.cos(a), f = Math.sin(a), h = t - o, c = n - i, d = l * h + f * c, m = f * h - l * c;
301
+ return d * d / (s * s) + m * m / (r * r) <= 1;
302
302
  }
303
303
  };
304
- st(V.ELLIPSE, fn);
305
- const un = {
304
+ st(j.ELLIPSE, dn);
305
+ const hn = {
306
306
  area: (e) => {
307
307
  const { points: t } = e.geometry;
308
308
  let n = 0, o = t.length - 1;
@@ -314,81 +314,81 @@ const un = {
314
314
  const { points: o } = e.geometry;
315
315
  let i = !1;
316
316
  for (let s = 0, r = o.length - 1; s < o.length; r = s++) {
317
- const a = o[s][0], l = o[s][1], d = o[r][0], m = o[r][1];
318
- l > n != m > n && t < (d - a) * (n - l) / (m - l) + a && (i = !i);
317
+ const a = o[s][0], l = o[s][1], f = o[r][0], h = o[r][1];
318
+ l > n != h > n && t < (f - a) * (n - l) / (h - l) + a && (i = !i);
319
319
  }
320
320
  return i;
321
321
  }
322
322
  };
323
- st(V.POLYGON, un);
324
- const dn = {
323
+ st(j.POLYGON, hn);
324
+ const mn = {
325
325
  area: (e) => e.geometry.w * e.geometry.h,
326
326
  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
327
327
  };
328
- st(V.RECTANGLE, dn);
329
- const hn = (e, t = !1) => {
330
- const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, a, l, d, m, c] = i;
328
+ st(j.RECTANGLE, mn);
329
+ const gn = (e, t = !1) => {
330
+ const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, a, l, f, h, c] = i;
331
331
  if (r !== "xywh")
332
332
  throw new Error("Unsupported MediaFragment: " + n);
333
333
  if (a && a !== "pixel")
334
334
  throw new Error(`Unsupported MediaFragment unit: ${a}`);
335
- const [f, h, p, g] = [l, d, m, c].map(parseFloat);
335
+ const [d, m, g, y] = [l, f, h, c].map(parseFloat);
336
336
  return {
337
- type: V.RECTANGLE,
337
+ type: j.RECTANGLE,
338
338
  geometry: {
339
- x: f,
340
- y: h,
341
- w: p,
342
- h: g,
339
+ x: d,
340
+ y: m,
341
+ w: g,
342
+ h: y,
343
343
  bounds: {
344
- minX: f,
345
- minY: t ? h - g : h,
346
- maxX: f + p,
347
- maxY: t ? h : h + g
344
+ minX: d,
345
+ minY: t ? m - y : m,
346
+ maxX: d + g,
347
+ maxY: t ? m : m + y
348
348
  }
349
349
  }
350
350
  };
351
- }, mn = (e) => {
351
+ }, pn = (e) => {
352
352
  const { x: t, y: n, w: o, h: i } = e;
353
353
  return {
354
354
  type: "FragmentSelector",
355
355
  conformsTo: "http://www.w3.org/TR/media-frags/",
356
356
  value: `xywh=pixel:${t},${n},${o},${i}`
357
357
  };
358
- }, Ft = "http://www.w3.org/2000/svg", ht = (e) => {
358
+ }, zt = "http://www.w3.org/2000/svg", ht = (e) => {
359
359
  const t = (o) => {
360
360
  Array.from(o.attributes).forEach((i) => {
361
361
  i.name.startsWith("on") && o.removeAttribute(i.name);
362
362
  });
363
363
  }, n = e.getElementsByTagName("script");
364
364
  return Array.from(n).reverse().forEach((o) => o.parentNode.removeChild(o)), Array.from(e.querySelectorAll("*")).forEach(t), e;
365
- }, gn = (e) => {
366
- const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${Ft}">`);
367
- return new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
368
- }, pn = (e) => {
369
- const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(Ft), i = n.lookupNamespaceURI(null);
370
- return o || i ? ht(n).firstChild : ht(gn(n)).firstChild;
371
365
  }, _n = (e) => {
366
+ const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${zt}">`);
367
+ return new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
368
+ }, yn = (e) => {
369
+ const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(zt), i = n.lookupNamespaceURI(null);
370
+ return o || i ? ht(n).firstChild : ht(_n(n)).firstChild;
371
+ }, wn = (e) => {
372
372
  const [t, n, o] = e.match(/(<polygon points=["|'])([^("|')]*)/) || [];
373
373
  if (!o)
374
374
  return;
375
375
  const i = o.split(" ").map((s) => s.split(",").map(parseFloat));
376
376
  return {
377
- type: V.POLYGON,
377
+ type: j.POLYGON,
378
378
  geometry: {
379
379
  points: i,
380
380
  bounds: He(i)
381
381
  }
382
382
  };
383
- }, yn = (e) => {
384
- const t = pn(e), n = parseFloat(t.getAttribute("cx")), o = parseFloat(t.getAttribute("cy")), i = parseFloat(t.getAttribute("rx")), s = parseFloat(t.getAttribute("ry")), r = {
383
+ }, bn = (e) => {
384
+ const t = yn(e), n = parseFloat(t.getAttribute("cx")), o = parseFloat(t.getAttribute("cy")), i = parseFloat(t.getAttribute("rx")), s = parseFloat(t.getAttribute("ry")), r = {
385
385
  minX: n - i,
386
386
  minY: o - s,
387
387
  maxX: n + i,
388
388
  maxY: o + s
389
389
  };
390
390
  return {
391
- type: V.ELLIPSE,
391
+ type: j.ELLIPSE,
392
392
  geometry: {
393
393
  cx: n,
394
394
  cy: o,
@@ -397,18 +397,18 @@ const hn = (e, t = !1) => {
397
397
  bounds: r
398
398
  }
399
399
  };
400
- }, wn = (e) => {
400
+ }, En = (e) => {
401
401
  const t = typeof e == "string" ? e : e.value;
402
402
  if (t.includes("<polygon points="))
403
- return _n(t);
403
+ return wn(t);
404
404
  if (t.includes("<ellipse "))
405
- return yn(t);
406
- }, bn = (e) => {
405
+ return bn(t);
406
+ }, An = (e) => {
407
407
  let t;
408
- if (e.type === V.POLYGON) {
408
+ if (e.type === j.POLYGON) {
409
409
  const n = e.geometry, { points: o } = n;
410
410
  t = `<svg><polygon points="${o.map((i) => i.join(",")).join(" ")}" /></svg>`;
411
- } else if (e.type === V.ELLIPSE) {
411
+ } else if (e.type === j.ELLIPSE) {
412
412
  const n = e.geometry;
413
413
  t = `<svg><ellipse cx="${n.cx}" cy="${n.cy}" rx="${n.rx}" ry="${n.ry}" /></svg>`;
414
414
  }
@@ -417,33 +417,33 @@ const hn = (e, t = !1) => {
417
417
  throw `Unsupported shape type: ${e.type}`;
418
418
  };
419
419
  let De;
420
- const En = new Uint8Array(16);
421
- function An() {
420
+ const Tn = new Uint8Array(16);
421
+ function Sn() {
422
422
  if (!De && (De = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !De))
423
423
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
424
- return De(En);
424
+ return De(Tn);
425
425
  }
426
- const q = [];
426
+ const J = [];
427
427
  for (let e = 0; e < 256; ++e)
428
- q.push((e + 256).toString(16).slice(1));
429
- function Tn(e, t = 0) {
430
- 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]];
428
+ J.push((e + 256).toString(16).slice(1));
429
+ function Mn(e, t = 0) {
430
+ return J[e[t + 0]] + J[e[t + 1]] + J[e[t + 2]] + J[e[t + 3]] + "-" + J[e[t + 4]] + J[e[t + 5]] + "-" + J[e[t + 6]] + J[e[t + 7]] + "-" + J[e[t + 8]] + J[e[t + 9]] + "-" + J[e[t + 10]] + J[e[t + 11]] + J[e[t + 12]] + J[e[t + 13]] + J[e[t + 14]] + J[e[t + 15]];
431
431
  }
432
- const Sn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), mt = {
433
- randomUUID: Sn
432
+ const Ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), mt = {
433
+ randomUUID: Ln
434
434
  };
435
435
  function rt(e, t, n) {
436
436
  if (mt.randomUUID && !t && !e)
437
437
  return mt.randomUUID();
438
438
  e = e || {};
439
- const o = e.random || (e.rng || An)();
439
+ const o = e.random || (e.rng || Sn)();
440
440
  if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
441
441
  n = n || 0;
442
442
  for (let i = 0; i < 16; ++i)
443
443
  t[n + i] = o[i];
444
444
  return t;
445
445
  }
446
- return Tn(o);
446
+ return Mn(o);
447
447
  }
448
448
  var gt = Object.prototype.hasOwnProperty;
449
449
  function ge(e, t) {
@@ -472,17 +472,17 @@ function ge(e, t) {
472
472
  return e !== e && t !== t;
473
473
  }
474
474
  const ye = [];
475
- function Fe(e, t = H) {
475
+ function Fe(e, t = F) {
476
476
  let n;
477
477
  const o = /* @__PURE__ */ new Set();
478
478
  function i(a) {
479
479
  if ($(e, a) && (e = a, n)) {
480
480
  const l = !ye.length;
481
- for (const d of o)
482
- d[1](), ye.push(d, e);
481
+ for (const f of o)
482
+ f[1](), ye.push(f, e);
483
483
  if (l) {
484
- for (let d = 0; d < ye.length; d += 2)
485
- ye[d][0](ye[d + 1]);
484
+ for (let f = 0; f < ye.length; f += 2)
485
+ ye[f][0](ye[f + 1]);
486
486
  ye.length = 0;
487
487
  }
488
488
  }
@@ -490,15 +490,15 @@ function Fe(e, t = H) {
490
490
  function s(a) {
491
491
  i(a(e));
492
492
  }
493
- function r(a, l = H) {
494
- const d = [a, l];
495
- return o.add(d), o.size === 1 && (n = t(i) || H), a(e), () => {
496
- o.delete(d), o.size === 0 && n && (n(), n = null);
493
+ function r(a, l = F) {
494
+ const f = [a, l];
495
+ return o.add(f), o.size === 1 && (n = t(i) || F), a(e), () => {
496
+ o.delete(f), o.size === 0 && n && (n(), n = null);
497
497
  };
498
498
  }
499
499
  return { set: i, update: s, subscribe: r };
500
500
  }
501
- const Mn = (e) => {
501
+ const On = (e) => {
502
502
  const { subscribe: t, set: n } = Fe(null);
503
503
  let o = null;
504
504
  return t((i) => o = i), e.observe(({ changes: i }) => {
@@ -515,8 +515,8 @@ const Mn = (e) => {
515
515
  set: n
516
516
  };
517
517
  };
518
- var zt = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(zt || {});
519
- const Je = { selected: [] }, Ln = (e, t = "EDIT") => {
518
+ var Vt = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(Vt || {});
519
+ const Je = { selected: [] }, vn = (e, t = "EDIT") => {
520
520
  const { subscribe: n, set: o } = Fe(Je);
521
521
  let i = Je;
522
522
  n((c) => i = c);
@@ -526,25 +526,25 @@ const Je = { selected: [] }, Ln = (e, t = "EDIT") => {
526
526
  }, a = (c) => {
527
527
  if (i.selected.length === 0)
528
528
  return !1;
529
- const f = typeof c == "string" ? c : c.id;
530
- return i.selected.some((h) => h.id === f);
531
- }, l = (c, f) => {
532
- const h = e.getAnnotation(c);
533
- if (h) {
534
- const p = On(h, t);
535
- o(p === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: f } : p === "SELECT" ? { selected: [{ id: c }], pointerEvent: f } : { selected: [], pointerEvent: f });
529
+ const d = typeof c == "string" ? c : c.id;
530
+ return i.selected.some((m) => m.id === d);
531
+ }, l = (c, d) => {
532
+ const m = e.getAnnotation(c);
533
+ if (m) {
534
+ const g = kn(m, t);
535
+ o(g === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: d } : g === "SELECT" ? { selected: [{ id: c }], pointerEvent: d } : { selected: [], pointerEvent: d });
536
536
  } else
537
537
  console.warn("Invalid selection: " + c);
538
- }, d = (c, f = !0) => {
539
- const h = Array.isArray(c) ? c : [c], p = h.map((g) => e.getAnnotation(g)).filter((g) => g);
540
- o({ selected: p.map(({ id: g }) => ({ id: g, editable: f })) }), p.length !== h.length && console.warn("Invalid selection", c);
541
- }, m = (c) => {
538
+ }, f = (c, d = !0) => {
539
+ const m = Array.isArray(c) ? c : [c], g = m.map((y) => e.getAnnotation(y)).filter((y) => y);
540
+ o({ selected: g.map(({ id: y }) => ({ id: y, editable: d })) }), g.length !== m.length && console.warn("Invalid selection", c);
541
+ }, h = (c) => {
542
542
  if (i.selected.length === 0)
543
543
  return !1;
544
- const { selected: f } = i;
545
- f.filter(({ id: p }) => c.includes(p)).length > 0 && o({ selected: f.filter(({ id: p }) => !c.includes(p)) });
544
+ const { selected: d } = i;
545
+ d.filter(({ id: g }) => c.includes(g)).length > 0 && o({ selected: d.filter(({ id: g }) => !c.includes(g)) });
546
546
  };
547
- return e.observe(({ changes: c }) => m(c.deleted.map((f) => f.id))), {
547
+ return e.observe(({ changes: c }) => h(c.deleted.map((d) => d.id))), {
548
548
  clear: s,
549
549
  clickSelect: l,
550
550
  get selected() {
@@ -555,390 +555,414 @@ const Je = { selected: [] }, Ln = (e, t = "EDIT") => {
555
555
  },
556
556
  isEmpty: r,
557
557
  isSelected: a,
558
- setSelected: d,
558
+ setSelected: f,
559
559
  subscribe: n
560
560
  };
561
- }, On = (e, t) => typeof t == "function" ? t(e) || "EDIT" : t || "EDIT", pi = (e) => {
561
+ }, kn = (e, t) => typeof t == "function" ? t(e) || "EDIT" : t || "EDIT", _i = (e) => {
562
562
  const { creator: t, updatedBy: n } = e.target, o = e.bodies.reduce((i, s) => [...i, s.creator, s.updatedBy], []);
563
563
  return [
564
564
  t,
565
565
  n,
566
566
  ...o
567
567
  ].filter((i) => i);
568
- }, _i = (e, t, n, o) => ({
568
+ }, yi = (e, t, n, o) => ({
569
569
  id: rt(),
570
570
  annotation: e.id,
571
571
  created: n || /* @__PURE__ */ new Date(),
572
572
  creator: o,
573
573
  ...t
574
- }), vn = (e, t) => {
574
+ }), Bn = (e, t) => {
575
575
  const n = new Set(e.bodies.map((o) => o.id));
576
576
  return t.bodies.filter((o) => !n.has(o.id));
577
- }, kn = (e, t) => {
577
+ }, In = (e, t) => {
578
578
  const n = new Set(t.bodies.map((o) => o.id));
579
579
  return e.bodies.filter((o) => !n.has(o.id));
580
- }, Bn = (e, t) => t.bodies.map((n) => {
580
+ }, Cn = (e, t) => t.bodies.map((n) => {
581
581
  const o = e.bodies.find((i) => i.id === n.id);
582
582
  return { newBody: n, oldBody: o && !ge(o, n) ? o : void 0 };
583
- }).filter(({ oldBody: n }) => n), Cn = (e, t) => !ge(e.target, t.target), Vt = (e, t) => {
584
- const n = vn(e, t), o = kn(e, t), i = Bn(e, t);
583
+ }).filter(({ oldBody: n }) => n), Pn = (e, t) => !ge(e.target, t.target), jt = (e, t) => {
584
+ const n = Bn(e, t), o = In(e, t), i = Cn(e, t);
585
585
  return {
586
586
  oldValue: e,
587
587
  newValue: t,
588
588
  bodiesCreated: n.length > 0 ? n : void 0,
589
589
  bodiesDeleted: o.length > 0 ? o : void 0,
590
590
  bodiesUpdated: i.length > 0 ? i : void 0,
591
- targetUpdated: Cn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
591
+ targetUpdated: Pn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
592
592
  };
593
593
  };
594
594
  var G = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(G || {});
595
- const In = (e, t) => {
595
+ const Yn = (e, t) => {
596
596
  var s, r;
597
597
  const { changes: n, origin: o } = t;
598
598
  if (!(!e.options.origin || e.options.origin === o))
599
599
  return !1;
600
600
  if (e.options.ignore) {
601
- const { ignore: a } = e.options, l = (m) => (m == null ? void 0 : m.length) > 0;
601
+ const { ignore: a } = e.options, l = (h) => (h == null ? void 0 : h.length) > 0;
602
602
  if (!(l(n.created) || l(n.deleted))) {
603
- const m = (s = n.updated) == null ? void 0 : s.some((f) => l(f.bodiesCreated) || l(f.bodiesDeleted) || l(f.bodiesUpdated)), c = (r = n.updated) == null ? void 0 : r.some((f) => f.targetUpdated);
604
- if (a === "BODY_ONLY" && m && !c || a === "TARGET_ONLY" && c && !m)
603
+ const h = (s = n.updated) == null ? void 0 : s.some((d) => l(d.bodiesCreated) || l(d.bodiesDeleted) || l(d.bodiesUpdated)), c = (r = n.updated) == null ? void 0 : r.some((d) => d.targetUpdated);
604
+ if (a === "BODY_ONLY" && h && !c || a === "TARGET_ONLY" && c && !h)
605
605
  return !1;
606
606
  }
607
607
  }
608
608
  if (e.options.annotations) {
609
609
  const a = /* @__PURE__ */ new Set([
610
- ...n.created.map((d) => d.id),
611
- ...n.deleted.map((d) => d.id),
612
- ...n.updated.map(({ oldValue: d }) => d.id)
610
+ ...n.created.map((f) => f.id),
611
+ ...n.deleted.map((f) => f.id),
612
+ ...n.updated.map(({ oldValue: f }) => f.id)
613
613
  ]);
614
- return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((d) => a.has(d));
614
+ return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((f) => a.has(f));
615
615
  } else
616
616
  return !0;
617
- }, Pn = (e, t) => {
617
+ }, Rn = (e, t) => {
618
618
  const n = new Set((e.created || []).map((c) => c.id)), o = new Set((e.updated || []).map(({ newValue: c }) => c.id)), i = new Set((t.created || []).map((c) => c.id)), s = new Set((t.deleted || []).map((c) => c.id)), r = new Set((t.updated || []).map(({ oldValue: c }) => c.id)), a = new Set((t.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), l = [
619
- ...(e.created || []).filter((c) => !s.has(c.id)).map((c) => r.has(c.id) ? t.updated.find(({ oldValue: f }) => f.id === c.id).newValue : c),
619
+ ...(e.created || []).filter((c) => !s.has(c.id)).map((c) => r.has(c.id) ? t.updated.find(({ oldValue: d }) => d.id === c.id).newValue : c),
620
620
  ...t.created || []
621
- ], d = [
621
+ ], f = [
622
622
  ...(e.deleted || []).filter((c) => !i.has(c.id)),
623
623
  ...(t.deleted || []).filter((c) => !n.has(c.id))
624
- ], m = [
624
+ ], h = [
625
625
  ...(e.updated || []).filter(({ newValue: c }) => !s.has(c.id)).map((c) => {
626
- const { oldValue: f, newValue: h } = c;
627
- if (r.has(h.id)) {
628
- const p = t.updated.find((g) => g.oldValue.id === h.id).newValue;
629
- return Vt(f, p);
626
+ const { oldValue: d, newValue: m } = c;
627
+ if (r.has(m.id)) {
628
+ const g = t.updated.find((y) => y.oldValue.id === m.id).newValue;
629
+ return jt(d, g);
630
630
  } else
631
631
  return c;
632
632
  }),
633
633
  ...(t.updated || []).filter(({ oldValue: c }) => !a.has(c.id))
634
634
  ];
635
- return { created: l, deleted: d, updated: m };
636
- }, Yn = (e) => e.id !== void 0, Rn = () => {
637
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (y, b = {}) => n.push({ onChange: y, options: b }), i = (y) => {
638
- const b = n.findIndex((E) => E.onChange == y);
639
- b > -1 && n.splice(b, 1);
640
- }, s = (y, b) => {
641
- const E = {
642
- origin: y,
635
+ return { created: l, deleted: f, updated: h };
636
+ }, Dn = (e) => e.id !== void 0, Xn = () => {
637
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (w, A = {}) => n.push({ onChange: w, options: A }), i = (w) => {
638
+ const A = n.findIndex((T) => T.onChange == w);
639
+ A > -1 && n.splice(A, 1);
640
+ }, s = (w, A) => {
641
+ const T = {
642
+ origin: w,
643
643
  changes: {
644
- created: b.created || [],
645
- updated: b.updated || [],
646
- deleted: b.deleted || []
644
+ created: A.created || [],
645
+ updated: A.updated || [],
646
+ deleted: A.deleted || []
647
647
  },
648
648
  state: [...e.values()]
649
649
  };
650
- n.forEach((A) => {
651
- In(A, E) && A.onChange(E);
650
+ n.forEach((M) => {
651
+ Yn(M, T) && M.onChange(T);
652
652
  });
653
- }, r = (y, b = G.LOCAL) => {
654
- if (e.get(y.id))
655
- throw Error(`Cannot add annotation ${y.id} - exists already`);
656
- e.set(y.id, y), y.bodies.forEach((A) => t.set(A.id, y.id)), s(b, { created: [y] });
657
- }, a = (y, b) => {
658
- const E = typeof y == "string" ? b : y, A = typeof y == "string" ? y : y.id, k = e.get(A);
659
- if (k) {
660
- const U = Vt(k, E);
661
- return A === E.id ? e.set(A, E) : (e.delete(A), e.set(E.id, E)), k.bodies.forEach((Q) => t.delete(Q.id)), E.bodies.forEach((Q) => t.set(Q.id, E.id)), U;
653
+ }, r = (w, A = G.LOCAL) => {
654
+ if (e.get(w.id))
655
+ throw Error(`Cannot add annotation ${w.id} - exists already`);
656
+ e.set(w.id, w), w.bodies.forEach((M) => t.set(M.id, w.id)), s(A, { created: [w] });
657
+ }, a = (w, A) => {
658
+ const T = typeof w == "string" ? A : w, M = typeof w == "string" ? w : w.id, P = e.get(M);
659
+ if (P) {
660
+ const U = jt(P, T);
661
+ return M === T.id ? e.set(M, T) : (e.delete(M), e.set(T.id, T)), P.bodies.forEach((Q) => t.delete(Q.id)), T.bodies.forEach((Q) => t.set(Q.id, T.id)), U;
662
662
  } else
663
- console.warn(`Cannot update annotation ${A} - does not exist`);
664
- }, l = (y, b = G.LOCAL, E = G.LOCAL) => {
665
- const A = Yn(b) ? E : b, k = a(y, b);
666
- k && s(A, { updated: [k] });
667
- }, d = (y, b = G.LOCAL) => {
668
- const E = y.reduce((A, k) => {
669
- const U = a(k);
670
- return U ? [...A, U] : A;
663
+ console.warn(`Cannot update annotation ${M} - does not exist`);
664
+ }, l = (w, A = G.LOCAL, T = G.LOCAL) => {
665
+ const M = Dn(A) ? T : A, P = a(w, A);
666
+ P && s(M, { updated: [P] });
667
+ }, f = (w, A = G.LOCAL) => {
668
+ const T = w.reduce((M, P) => {
669
+ const U = a(P);
670
+ return U ? [...M, U] : M;
671
671
  }, []);
672
- E.length > 0 && s(b, { updated: E });
673
- }, m = (y, b = G.LOCAL) => {
674
- const E = e.get(y.annotation);
675
- if (E) {
676
- const A = {
677
- ...E,
678
- bodies: [...E.bodies, y]
672
+ T.length > 0 && s(A, { updated: T });
673
+ }, h = (w, A = G.LOCAL) => {
674
+ const T = e.get(w.annotation);
675
+ if (T) {
676
+ const M = {
677
+ ...T,
678
+ bodies: [...T.bodies, w]
679
679
  };
680
- e.set(E.id, A), t.set(y.id, A.id), s(b, { updated: [{
681
- oldValue: E,
682
- newValue: A,
683
- bodiesCreated: [y]
680
+ e.set(T.id, M), t.set(w.id, M.id), s(A, { updated: [{
681
+ oldValue: T,
682
+ newValue: M,
683
+ bodiesCreated: [w]
684
684
  }] });
685
685
  } else
686
- console.warn(`Attempt to add body to missing annotation: ${y.annotation}`);
687
- }, c = () => [...e.values()], f = (y = G.LOCAL) => {
688
- const b = [...e.values()];
689
- e.clear(), t.clear(), s(y, { deleted: b });
690
- }, h = (y, b = !0, E = G.LOCAL) => {
691
- if (b) {
692
- const A = [...e.values()];
693
- e.clear(), t.clear(), y.forEach((k) => {
694
- e.set(k.id, k), k.bodies.forEach((U) => t.set(U.id, k.id));
695
- }), s(E, { created: y, deleted: A });
686
+ console.warn(`Attempt to add body to missing annotation: ${w.annotation}`);
687
+ }, c = () => [...e.values()], d = (w = G.LOCAL) => {
688
+ const A = [...e.values()];
689
+ e.clear(), t.clear(), s(w, { deleted: A });
690
+ }, m = (w, A = !0, T = G.LOCAL) => {
691
+ if (A) {
692
+ const M = [...e.values()];
693
+ e.clear(), t.clear(), w.forEach((P) => {
694
+ e.set(P.id, P), P.bodies.forEach((U) => t.set(U.id, P.id));
695
+ }), s(T, { created: w, deleted: M });
696
696
  } else {
697
- const A = y.reduce((k, U) => {
697
+ const M = w.reduce((P, U) => {
698
698
  const Q = e.get(U.id);
699
- return Q ? [...k, Q] : k;
699
+ return Q ? [...P, Q] : P;
700
700
  }, []);
701
- if (A.length > 0)
702
- throw Error(`Bulk insert would overwrite the following annotations: ${A.map((k) => k.id).join(", ")}`);
703
- y.forEach((k) => {
704
- e.set(k.id, k), k.bodies.forEach((U) => t.set(U.id, k.id));
705
- }), s(E, { created: y });
706
- }
707
- }, p = (y) => {
708
- const b = typeof y == "string" ? y : y.id, E = e.get(b);
709
- if (E)
710
- return e.delete(b), E.bodies.forEach((A) => t.delete(A.id)), E;
711
- console.warn(`Attempt to delete missing annotation: ${b}`);
712
- }, g = (y, b = G.LOCAL) => {
713
- const E = p(y);
714
- E && s(b, { deleted: [E] });
715
- }, w = (y, b = G.LOCAL) => {
716
- const E = y.reduce((A, k) => {
717
- const U = p(k);
718
- return U ? [...A, U] : A;
701
+ if (M.length > 0)
702
+ throw Error(`Bulk insert would overwrite the following annotations: ${M.map((P) => P.id).join(", ")}`);
703
+ w.forEach((P) => {
704
+ e.set(P.id, P), P.bodies.forEach((U) => t.set(U.id, P.id));
705
+ }), s(T, { created: w });
706
+ }
707
+ }, g = (w) => {
708
+ const A = typeof w == "string" ? w : w.id, T = e.get(A);
709
+ if (T)
710
+ return e.delete(A), T.bodies.forEach((M) => t.delete(M.id)), T;
711
+ console.warn(`Attempt to delete missing annotation: ${A}`);
712
+ }, y = (w, A = G.LOCAL) => {
713
+ const T = g(w);
714
+ T && s(A, { deleted: [T] });
715
+ }, E = (w, A = G.LOCAL) => {
716
+ const T = w.reduce((M, P) => {
717
+ const U = g(P);
718
+ return U ? [...M, U] : M;
719
719
  }, []);
720
- E.length > 0 && s(b, { deleted: E });
721
- }, T = (y, b = G.LOCAL) => {
722
- const E = e.get(y.annotation);
723
- if (E) {
724
- const A = E.bodies.find((k) => k.id === y.id);
725
- if (A) {
726
- t.delete(A.id);
727
- const k = {
728
- ...E,
729
- bodies: E.bodies.filter((Q) => Q.id !== y.id)
720
+ T.length > 0 && s(A, { deleted: T });
721
+ }, b = (w, A = G.LOCAL) => {
722
+ const T = e.get(w.annotation);
723
+ if (T) {
724
+ const M = T.bodies.find((P) => P.id === w.id);
725
+ if (M) {
726
+ t.delete(M.id);
727
+ const P = {
728
+ ...T,
729
+ bodies: T.bodies.filter((Q) => Q.id !== w.id)
730
730
  };
731
- e.set(E.id, k), s(b, { updated: [{
732
- oldValue: E,
733
- newValue: k,
734
- bodiesDeleted: [A]
731
+ e.set(T.id, P), s(A, { updated: [{
732
+ oldValue: T,
733
+ newValue: P,
734
+ bodiesDeleted: [M]
735
735
  }] });
736
736
  } else
737
- console.warn(`Attempt to delete missing body ${y.id} from annotation ${y.annotation}`);
737
+ console.warn(`Attempt to delete missing body ${w.id} from annotation ${w.annotation}`);
738
738
  } else
739
- console.warn(`Attempt to delete body from missing annotation ${y.annotation}`);
740
- }, _ = (y) => {
741
- const b = e.get(y);
742
- return b ? { ...b } : void 0;
743
- }, M = (y) => {
744
- const b = t.get(y);
745
- if (b) {
746
- const A = _(b).bodies.find((k) => k.id === y);
747
- if (A)
748
- return A;
749
- console.error(`Store integrity error: body ${y} in index, but not in annotation`);
739
+ console.warn(`Attempt to delete body from missing annotation ${w.annotation}`);
740
+ }, _ = (w) => {
741
+ const A = e.get(w);
742
+ return A ? { ...A } : void 0;
743
+ }, p = (w) => {
744
+ const A = t.get(w);
745
+ if (A) {
746
+ const M = _(A).bodies.find((P) => P.id === w);
747
+ if (M)
748
+ return M;
749
+ console.error(`Store integrity error: body ${w} in index, but not in annotation`);
750
750
  } else
751
- console.warn(`Attempt to retrieve missing body: ${y}`);
752
- }, X = (y, b) => {
753
- if (y.annotation !== b.annotation)
751
+ console.warn(`Attempt to retrieve missing body: ${w}`);
752
+ }, L = (w, A) => {
753
+ if (w.annotation !== A.annotation)
754
754
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
755
- const E = e.get(y.annotation);
756
- if (E) {
757
- const A = E.bodies.find((U) => U.id === y.id), k = {
758
- ...E,
759
- bodies: E.bodies.map((U) => U.id === A.id ? b : U)
755
+ const T = e.get(w.annotation);
756
+ if (T) {
757
+ const M = T.bodies.find((U) => U.id === w.id), P = {
758
+ ...T,
759
+ bodies: T.bodies.map((U) => U.id === M.id ? A : U)
760
760
  };
761
- return e.set(E.id, k), A.id !== b.id && (t.delete(A.id), t.set(b.id, k.id)), {
762
- oldValue: E,
763
- newValue: k,
764
- bodiesUpdated: [{ oldBody: A, newBody: b }]
761
+ return e.set(T.id, P), M.id !== A.id && (t.delete(M.id), t.set(A.id, P.id)), {
762
+ oldValue: T,
763
+ newValue: P,
764
+ bodiesUpdated: [{ oldBody: M, newBody: A }]
765
765
  };
766
766
  } else
767
- console.warn(`Attempt to add body to missing annotation ${y.annotation}`);
768
- }, R = (y, b, E = G.LOCAL) => {
769
- const A = X(y, b);
770
- s(E, { updated: [A] });
771
- }, z = (y, b = G.LOCAL) => {
772
- const E = y.map((A) => X({ id: A.id, annotation: A.annotation }, A));
773
- s(b, { updated: E });
774
- }, K = (y) => {
775
- const b = e.get(y.annotation);
776
- if (b) {
777
- const E = {
778
- ...b,
767
+ console.warn(`Attempt to add body to missing annotation ${w.annotation}`);
768
+ }, S = (w, A, T = G.LOCAL) => {
769
+ const M = L(w, A);
770
+ s(T, { updated: [M] });
771
+ }, B = (w, A = G.LOCAL) => {
772
+ const T = w.map((M) => L({ id: M.id, annotation: M.annotation }, M));
773
+ s(A, { updated: T });
774
+ }, z = (w) => {
775
+ const A = e.get(w.annotation);
776
+ if (A) {
777
+ const T = {
778
+ ...A,
779
779
  target: {
780
- ...b.target,
781
- ...y
780
+ ...A.target,
781
+ ...w
782
782
  }
783
783
  };
784
- return e.set(b.id, E), {
785
- oldValue: b,
786
- newValue: E,
784
+ return e.set(A.id, T), {
785
+ oldValue: A,
786
+ newValue: T,
787
787
  targetUpdated: {
788
- oldTarget: b.target,
789
- newTarget: y
788
+ oldTarget: A.target,
789
+ newTarget: w
790
790
  }
791
791
  };
792
792
  } else
793
- console.warn(`Attempt to update target on missing annotation: ${y.annotation}`);
793
+ console.warn(`Attempt to update target on missing annotation: ${w.annotation}`);
794
794
  };
795
795
  return {
796
796
  addAnnotation: r,
797
- addBody: m,
797
+ addBody: h,
798
798
  all: c,
799
- bulkAddAnnotation: h,
800
- bulkDeleteAnnotation: w,
801
- bulkUpdateAnnotation: d,
802
- bulkUpdateBodies: z,
803
- bulkUpdateTargets: (y, b = G.LOCAL) => {
804
- const E = y.map(K).filter((A) => A);
805
- E.length > 0 && s(b, { updated: E });
806
- },
807
- clear: f,
808
- deleteAnnotation: g,
809
- deleteBody: T,
799
+ bulkAddAnnotation: m,
800
+ bulkDeleteAnnotation: E,
801
+ bulkUpdateAnnotation: f,
802
+ bulkUpdateBodies: B,
803
+ bulkUpdateTargets: (w, A = G.LOCAL) => {
804
+ const T = w.map(z).filter((M) => M);
805
+ T.length > 0 && s(A, { updated: T });
806
+ },
807
+ clear: d,
808
+ deleteAnnotation: y,
809
+ deleteBody: b,
810
810
  getAnnotation: _,
811
- getBody: M,
811
+ getBody: p,
812
812
  observe: o,
813
813
  unobserve: i,
814
814
  updateAnnotation: l,
815
- updateBody: R,
816
- updateTarget: (y, b = G.LOCAL) => {
817
- const E = K(y);
818
- E && s(b, { updated: [E] });
815
+ updateBody: S,
816
+ updateTarget: (w, A = G.LOCAL) => {
817
+ const T = z(w);
818
+ T && s(A, { updated: [T] });
819
819
  }
820
820
  };
821
- }, Dn = (e) => ({
821
+ }, Un = (e) => ({
822
822
  ...e,
823
823
  subscribe: (n) => {
824
824
  const o = (i) => n(i.state);
825
825
  return e.observe(o), n(e.all()), () => e.unobserve(o);
826
826
  }
827
- }), Xn = 250, Un = (e) => {
828
- const t = [];
829
- let n = -1, o = !1, i = 0;
830
- const s = (g) => {
831
- if (!o) {
832
- const { changes: w } = g, T = performance.now();
833
- if (T - i > Xn)
834
- t.splice(n + 1), t.push(w), n = t.length - 1;
827
+ });
828
+ let Wt = () => ({
829
+ emit(e, ...t) {
830
+ let n = this.events[e] || [];
831
+ for (let o = 0, i = n.length; o < i; o++)
832
+ n[o](...t);
833
+ },
834
+ events: {},
835
+ on(e, t) {
836
+ var n;
837
+ return (n = this.events[e]) != null && n.push(t) || (this.events[e] = [t]), () => {
838
+ var o;
839
+ this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
840
+ };
841
+ }
842
+ });
843
+ const Nn = 250, Gn = (e) => {
844
+ const t = Wt(), n = [];
845
+ let o = -1, i = !1, s = 0;
846
+ const r = (p) => {
847
+ if (!i) {
848
+ const { changes: L } = p, S = performance.now();
849
+ if (S - s > Nn)
850
+ n.splice(o + 1), n.push(L), o = n.length - 1;
835
851
  else {
836
- const _ = t.length - 1;
837
- t[_] = Pn(t[_], w);
852
+ const B = n.length - 1;
853
+ n[B] = Rn(n[B], L);
838
854
  }
839
- i = T;
855
+ s = S;
840
856
  }
841
- o = !1;
857
+ i = !1;
842
858
  };
843
- e.observe(s, { origin: G.LOCAL });
844
- const r = (g) => (g == null ? void 0 : g.length) > 0 && e.bulkDeleteAnnotation(g), a = (g) => (g == null ? void 0 : g.length) > 0 && e.bulkAddAnnotation(g, !1), l = (g) => (g == null ? void 0 : g.length) > 0 && e.bulkUpdateAnnotation(g.map(({ oldValue: w }) => w)), d = (g) => (g == null ? void 0 : g.length) > 0 && e.bulkUpdateAnnotation(g.map(({ newValue: w }) => w)), m = (g) => (g == null ? void 0 : g.length) > 0 && e.bulkAddAnnotation(g, !1), c = (g) => (g == null ? void 0 : g.length) > 0 && e.bulkDeleteAnnotation(g);
859
+ e.observe(r, { origin: G.LOCAL });
860
+ const a = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkDeleteAnnotation(p), l = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkAddAnnotation(p, !1), f = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkUpdateAnnotation(p.map(({ oldValue: L }) => L)), h = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkUpdateAnnotation(p.map(({ newValue: L }) => L)), c = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkAddAnnotation(p, !1), d = (p) => (p == null ? void 0 : p.length) > 0 && e.bulkDeleteAnnotation(p);
845
861
  return {
846
- destroy: () => e.unobserve(s),
862
+ canRedo: () => n.length - 1 > o,
863
+ canUndo: () => o > -1,
864
+ destroy: () => e.unobserve(r),
865
+ on: (p, L) => t.on(p, L),
847
866
  redo: () => {
848
- if (t.length - 1 > n) {
849
- o = !0;
850
- const { created: g, updated: w, deleted: T } = t[n + 1];
851
- a(g), d(w), c(T), n += 1;
867
+ if (n.length - 1 > o) {
868
+ i = !0;
869
+ const { created: p, updated: L, deleted: S } = n[o + 1];
870
+ l(p), h(L), d(S), t.emit("redo", n[o + 1]), o += 1;
852
871
  }
853
872
  },
854
873
  undo: () => {
855
- if (n > -1) {
856
- o = !0;
857
- const { created: g, updated: w, deleted: T } = t[n];
858
- r(g), l(w), m(T), n -= 1;
874
+ if (o > -1) {
875
+ i = !0;
876
+ const { created: p, updated: L, deleted: S } = n[o];
877
+ a(p), f(L), c(S), t.emit("undo", n[o]), o -= 1;
859
878
  }
860
879
  }
861
880
  };
862
- }, Nn = () => {
881
+ }, Hn = () => {
863
882
  const { subscribe: e, set: t } = Fe([]);
864
883
  return {
865
884
  subscribe: e,
866
885
  set: t
867
886
  };
868
- }, Gn = (e, t, n, o, i, s) => {
869
- const r = /* @__PURE__ */ new Map();
870
- let a = [], l, d;
871
- const m = (p, g) => {
872
- r.has(p) ? r.get(p).push(g) : r.set(p, [g]);
873
- }, c = (p, g) => {
874
- const w = r.get(p);
875
- w && w.indexOf(g) > 0 && w.splice(w.indexOf(g), 1);
876
- }, f = (p, g, w) => {
877
- r.has(p) && setTimeout(() => {
878
- r.get(p).forEach((T) => {
879
- if (i) {
880
- const _ = Array.isArray(g) ? g.map((X) => i.serialize(X)) : i.serialize(g), M = w ? w instanceof PointerEvent ? w : i.serialize(w) : void 0;
881
- T(_, M);
887
+ }, Fn = (e, t, n, o) => {
888
+ const { store: i, selection: s, hover: r, viewport: a } = e, l = /* @__PURE__ */ new Map();
889
+ let f = [], h, c;
890
+ const d = (b, _) => {
891
+ l.has(b) ? l.get(b).push(_) : l.set(b, [_]);
892
+ }, m = (b, _) => {
893
+ const p = l.get(b);
894
+ p && p.indexOf(_) > 0 && p.splice(p.indexOf(_), 1);
895
+ }, g = (b, _, p) => {
896
+ l.has(b) && setTimeout(() => {
897
+ l.get(b).forEach((L) => {
898
+ if (n) {
899
+ const S = Array.isArray(_) ? _.map((z) => n.serialize(z)) : n.serialize(_), B = p ? p instanceof PointerEvent ? p : n.serialize(p) : void 0;
900
+ L(S, B);
882
901
  } else
883
- T(g, w);
902
+ L(_, p);
884
903
  });
885
904
  }, 1);
886
- }, h = () => {
887
- const { selected: p } = t, g = p.map(({ id: w }) => e.getAnnotation(w));
888
- g.forEach((w) => {
889
- const T = a.find((_) => _.id === w.id);
890
- (!T || !ge(T, w)) && f("updateAnnotation", w, T);
891
- }), a = a.map((w) => {
892
- const T = g.find(({ id: _ }) => _ === w.id);
893
- return T || w;
905
+ }, y = () => {
906
+ const { selected: b } = s, _ = b.map(({ id: p }) => i.getAnnotation(p));
907
+ _.forEach((p) => {
908
+ const L = f.find((S) => S.id === p.id);
909
+ (!L || !ge(L, p)) && g("updateAnnotation", p, L);
910
+ }), f = f.map((p) => {
911
+ const L = _.find(({ id: S }) => S === p.id);
912
+ return L || p;
894
913
  });
895
914
  };
896
- return t.subscribe(({ selected: p }) => {
897
- if (!(a.length === 0 && p.length === 0)) {
898
- if (a.length === 0 && p.length > 0)
899
- a = p.map(({ id: g }) => e.getAnnotation(g));
900
- else if (a.length > 0 && p.length === 0)
901
- a.forEach((g) => {
902
- const w = e.getAnnotation(g.id);
903
- w && !ge(w, g) && f("updateAnnotation", w, g);
904
- }), a = [];
915
+ s.subscribe(({ selected: b }) => {
916
+ if (!(f.length === 0 && b.length === 0)) {
917
+ if (f.length === 0 && b.length > 0)
918
+ f = b.map(({ id: _ }) => i.getAnnotation(_));
919
+ else if (f.length > 0 && b.length === 0)
920
+ f.forEach((_) => {
921
+ const p = i.getAnnotation(_.id);
922
+ p && !ge(p, _) && g("updateAnnotation", p, _);
923
+ }), f = [];
905
924
  else {
906
- const g = new Set(a.map((_) => _.id)), w = new Set(p.map(({ id: _ }) => _));
907
- a.filter((_) => !w.has(_.id)).forEach((_) => {
908
- const M = e.getAnnotation(_.id);
909
- M && !ge(M, _) && f("updateAnnotation", M, _);
910
- }), a = [
925
+ const _ = new Set(f.map((S) => S.id)), p = new Set(b.map(({ id: S }) => S));
926
+ f.filter((S) => !p.has(S.id)).forEach((S) => {
927
+ const B = i.getAnnotation(S.id);
928
+ B && !ge(B, S) && g("updateAnnotation", B, S);
929
+ }), f = [
911
930
  // Remove annotations that were deselected
912
- ...a.filter((_) => w.has(_.id)),
931
+ ...f.filter((S) => p.has(S.id)),
913
932
  // Add editable annotations that were selected
914
- ...p.filter(({ id: _ }) => !g.has(_)).map(({ id: _ }) => e.getAnnotation(_))
933
+ ...b.filter(({ id: S }) => !_.has(S)).map(({ id: S }) => i.getAnnotation(S))
915
934
  ];
916
935
  }
917
- f("selectionChanged", a);
918
- }
919
- }), n.subscribe((p) => {
920
- !l && p ? f("mouseEnterAnnotation", e.getAnnotation(p)) : l && !p ? f("mouseLeaveAnnotation", e.getAnnotation(l)) : l && p && (f("mouseLeaveAnnotation", e.getAnnotation(l)), f("mouseEnterAnnotation", e.getAnnotation(p))), l = p;
921
- }), o == null || o.subscribe((p) => f("viewportIntersect", p.map(e.getAnnotation))), e.observe((p) => {
922
- s && (d && clearTimeout(d), d = setTimeout(h, 1e3));
923
- const { created: g, deleted: w } = p.changes;
924
- g.forEach((_) => f("createAnnotation", _)), w.forEach((_) => f("deleteAnnotation", _)), p.changes.updated.filter((_) => [
925
- ..._.bodiesCreated || [],
926
- ..._.bodiesDeleted || [],
927
- ..._.bodiesUpdated || []
928
- ].length > 0).forEach(({ oldValue: _, newValue: M }) => {
929
- const X = a.find((R) => R.id === _.id) || _;
930
- a = a.map((R) => R.id === _.id ? M : R), f("updateAnnotation", M, X);
936
+ g("selectionChanged", f);
937
+ }
938
+ }), r.subscribe((b) => {
939
+ !h && b ? g("mouseEnterAnnotation", i.getAnnotation(b)) : h && !b ? g("mouseLeaveAnnotation", i.getAnnotation(h)) : h && b && (g("mouseLeaveAnnotation", i.getAnnotation(h)), g("mouseEnterAnnotation", i.getAnnotation(b))), h = b;
940
+ }), a == null || a.subscribe((b) => g("viewportIntersect", b.map(i.getAnnotation))), i.observe((b) => {
941
+ o && (c && clearTimeout(c), c = setTimeout(y, 1e3));
942
+ const { created: _, deleted: p } = b.changes;
943
+ _.forEach((S) => g("createAnnotation", S)), p.forEach((S) => g("deleteAnnotation", S)), b.changes.updated.filter((S) => [
944
+ ...S.bodiesCreated || [],
945
+ ...S.bodiesDeleted || [],
946
+ ...S.bodiesUpdated || []
947
+ ].length > 0).forEach(({ oldValue: S, newValue: B }) => {
948
+ const z = f.find((k) => k.id === S.id) || S;
949
+ f = f.map((k) => k.id === S.id ? B : k), g("updateAnnotation", B, z);
931
950
  });
932
- }, { origin: G.LOCAL }), e.observe((p) => {
933
- if (a) {
934
- const g = new Set(a.map((T) => T.id)), w = p.changes.updated.filter(({ newValue: T }) => g.has(T.id)).map(({ newValue: T }) => T);
935
- w.length > 0 && (a = a.map((T) => {
936
- const _ = w.find((M) => M.id === T.id);
937
- return _ || T;
951
+ }, { origin: G.LOCAL }), i.observe((b) => {
952
+ if (f) {
953
+ const _ = new Set(f.map((L) => L.id)), p = b.changes.updated.filter(({ newValue: L }) => _.has(L.id)).map(({ newValue: L }) => L);
954
+ p.length > 0 && (f = f.map((L) => {
955
+ const S = p.find((B) => B.id === L.id);
956
+ return S || L;
938
957
  }));
939
958
  }
940
- }, { origin: G.REMOTE }), { on: m, off: c, emit: f };
941
- }, yi = (e) => (t) => t.map((n) => e.serialize(n)), Hn = (e) => (t) => t.reduce((n, o) => {
959
+ }, { origin: G.REMOTE });
960
+ const E = (b) => (_) => {
961
+ const { created: p, deleted: L, updated: S } = _;
962
+ p.forEach((B) => g("createAnnotation", B)), L.forEach((B) => g("deleteAnnotation", B)), b ? S.forEach((B) => g("updateAnnotation", B.oldValue, B.newValue)) : S.forEach((B) => g("updateAnnotation", B.newValue, B.oldValue));
963
+ };
964
+ return t.on("undo", E(!0)), t.on("redo", E(!1)), { on: d, off: m, emit: g };
965
+ }, wi = (e) => (t) => t.map((n) => e.serialize(n)), zn = (e) => (t) => t.reduce((n, o) => {
942
966
  const { parsed: i, error: s } = e.parse(o);
943
967
  return s ? {
944
968
  parsed: n.parsed,
@@ -947,53 +971,64 @@ const In = (e, t) => {
947
971
  parsed: [...n.parsed, i],
948
972
  failed: n.failed
949
973
  };
950
- }, { parsed: [], failed: [] }), Fn = (e, t, n) => {
951
- const o = (c) => {
974
+ }, { parsed: [], failed: [] }), Vn = (e, t, n) => {
975
+ const { store: o, selection: i } = e, s = (E) => {
952
976
  if (n) {
953
- const { parsed: f, error: h } = n.parse(c);
954
- f ? e.addAnnotation(f, G.REMOTE) : console.error(h);
977
+ const { parsed: b, error: _ } = n.parse(E);
978
+ b ? o.addAnnotation(b, G.REMOTE) : console.error(_);
955
979
  } else
956
- e.addAnnotation(c, G.REMOTE);
957
- }, i = () => e.clear(), s = (c) => {
958
- const f = e.getAnnotation(c);
959
- return n && f ? n.serialize(f) : f;
960
- }, r = () => n ? e.all().map(n.serialize) : e.all(), a = (c) => fetch(c).then((f) => f.json()).then((f) => (d(f), f)), l = (c) => {
961
- if (typeof c == "string") {
962
- const f = e.getAnnotation(c);
963
- return e.deleteAnnotation(c), n ? n.serialize(f) : f;
980
+ o.addAnnotation(E, G.REMOTE);
981
+ }, r = () => i.clear(), a = () => o.clear(), l = (E) => {
982
+ const b = o.getAnnotation(E);
983
+ return n && b ? n.serialize(b) : b;
984
+ }, f = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
985
+ var _;
986
+ const b = (((_ = i.selected) == null ? void 0 : _.map((p) => p.id)) || []).map((p) => o.getAnnotation(p));
987
+ return n ? b.map(n.serialize) : b;
988
+ }, c = (E) => fetch(E).then((b) => b.json()).then((b) => (m(b), b)), d = (E) => {
989
+ if (typeof E == "string") {
990
+ const b = o.getAnnotation(E);
991
+ return o.deleteAnnotation(E), n ? n.serialize(b) : b;
964
992
  } else {
965
- const f = n ? n.parse(c).parsed : c;
966
- return e.deleteAnnotation(f), c;
993
+ const b = n ? n.parse(E).parsed : E;
994
+ return o.deleteAnnotation(b), E;
967
995
  }
968
- }, d = (c) => {
996
+ }, m = (E) => {
969
997
  if (n) {
970
- const { parsed: f, failed: h } = Hn(n)(c);
971
- h.length > 0 && console.warn(`Discarded ${h.length} invalid annotations`, h), e.bulkAddAnnotation(f, !0, G.REMOTE);
998
+ const { parsed: b, failed: _ } = zn(n)(E);
999
+ _.length > 0 && console.warn(`Discarded ${_.length} invalid annotations`, _), o.bulkAddAnnotation(b, !0, G.REMOTE);
972
1000
  } else
973
- e.bulkAddAnnotation(c, !0, G.REMOTE);
974
- }, m = (c) => {
1001
+ o.bulkAddAnnotation(E, !0, G.REMOTE);
1002
+ }, g = (E) => {
1003
+ E ? i.setSelected(E) : i.clear();
1004
+ }, y = (E) => {
975
1005
  if (n) {
976
- const f = n.parse(c).parsed, h = n.serialize(e.getAnnotation(f.id));
977
- return e.updateAnnotation(f), h;
1006
+ const b = n.parse(E).parsed, _ = n.serialize(o.getAnnotation(b.id));
1007
+ return o.updateAnnotation(b), _;
978
1008
  } else {
979
- const f = e.getAnnotation(c.id);
980
- return e.updateAnnotation(c), f;
1009
+ const b = o.getAnnotation(E.id);
1010
+ return o.updateAnnotation(E), b;
981
1011
  }
982
1012
  };
983
1013
  return {
984
- addAnnotation: o,
985
- clearAnnotations: i,
986
- getAnnotationById: s,
987
- getAnnotations: r,
988
- loadAnnotations: a,
1014
+ addAnnotation: s,
1015
+ cancelSelected: r,
1016
+ canRedo: t.canRedo,
1017
+ canUndo: t.canUndo,
1018
+ clearAnnotations: a,
1019
+ getAnnotationById: l,
1020
+ getAnnotations: f,
1021
+ getSelected: h,
1022
+ loadAnnotations: c,
989
1023
  redo: t.redo,
990
- removeAnnotation: l,
991
- setAnnotations: d,
1024
+ removeAnnotation: d,
1025
+ setAnnotations: m,
1026
+ setSelected: g,
992
1027
  undo: t.undo,
993
- updateAnnotation: m
1028
+ updateAnnotation: y
994
1029
  };
995
1030
  };
996
- let zn = (e) => crypto.getRandomValues(new Uint8Array(e)), Vn = (e, t, n) => {
1031
+ let jn = (e) => crypto.getRandomValues(new Uint8Array(e)), Wn = (e, t, n) => {
997
1032
  let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * t / e.length);
998
1033
  return (s = t) => {
999
1034
  let r = "";
@@ -1004,8 +1039,8 @@ let zn = (e) => crypto.getRandomValues(new Uint8Array(e)), Vn = (e, t, n) => {
1004
1039
  return r;
1005
1040
  }
1006
1041
  };
1007
- }, jn = (e, t = 21) => Vn(e, t, zn), Wn = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
1008
- const qn = () => ({ isGuest: !0, id: jn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Jn = (e) => {
1042
+ }, qn = (e, t = 21) => Wn(e, t, jn), Jn = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
1043
+ const Kn = () => ({ isGuest: !0, id: qn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Zn = (e) => {
1009
1044
  const t = JSON.stringify(e);
1010
1045
  let n = 0;
1011
1046
  for (let o = 0, i = t.length; o < i; o++) {
@@ -1013,23 +1048,23 @@ const qn = () => ({ isGuest: !0, id: jn("1234567890abcdefghijklmnopqrstuvwxyzABC
1013
1048
  n = (n << 5) - n + s, n |= 0;
1014
1049
  }
1015
1050
  return `${n}`;
1016
- }, Kn = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
1017
- const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...d } = n;
1051
+ }, Qn = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
1052
+ const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...f } = n;
1018
1053
  return {
1019
- id: o || `temp-${Jn(n)}`,
1054
+ id: o || `temp-${Zn(n)}`,
1020
1055
  annotation: t,
1021
1056
  type: i,
1022
1057
  purpose: s,
1023
1058
  value: r,
1024
1059
  created: a,
1025
1060
  creator: l ? typeof l == "object" ? { ...l } : l : void 0,
1026
- ...d
1061
+ ...f
1027
1062
  };
1028
- }), Zn = (e) => e.map((t) => {
1063
+ }), xn = (e) => e.map((t) => {
1029
1064
  var o;
1030
1065
  const n = { ...t };
1031
1066
  return delete n.annotation, (o = n.id) != null && o.startsWith("temp-") && delete n.id, n;
1032
- }), Qn = [
1067
+ }), $n = [
1033
1068
  "#ff7c00",
1034
1069
  // orange
1035
1070
  "#1ac938",
@@ -1048,14 +1083,14 @@ const qn = () => ({ isGuest: !0, id: jn("1234567890abcdefghijklmnopqrstuvwxyzABC
1048
1083
  // cyan
1049
1084
  "#023eff"
1050
1085
  // blue
1051
- ], xn = () => {
1052
- const e = [...Qn];
1086
+ ], eo = () => {
1087
+ const e = [...$n];
1053
1088
  return { assignRandomColor: () => {
1054
1089
  const o = Math.floor(Math.random() * e.length), i = e[o];
1055
1090
  return e.splice(o, 1), i;
1056
1091
  }, releaseColor: (o) => e.push(o) };
1057
- }, $n = () => {
1058
- const e = xn();
1092
+ }, to = () => {
1093
+ const e = eo();
1059
1094
  return { addUser: (o, i) => {
1060
1095
  const s = e.assignRandomColor();
1061
1096
  return {
@@ -1064,72 +1099,56 @@ const qn = () => ({ isGuest: !0, id: jn("1234567890abcdefghijklmnopqrstuvwxyzABC
1064
1099
  color: s
1065
1100
  };
1066
1101
  }, removeUser: (o) => e.releaseColor(o.appearance.color) };
1067
- };
1068
- let eo = () => ({
1069
- emit(e, ...t) {
1070
- let n = this.events[e] || [];
1071
- for (let o = 0, i = n.length; o < i; o++)
1072
- n[o](...t);
1073
- },
1074
- events: {},
1075
- on(e, t) {
1076
- var n;
1077
- return (n = this.events[e]) != null && n.push(t) || (this.events[e] = [t]), () => {
1078
- var o;
1079
- this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
1080
- };
1081
- }
1082
- });
1083
- const to = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(n)), wi = Wn(), bi = (e = $n()) => {
1084
- const t = eo(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (c, f) => {
1102
+ }, no = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(n)), bi = Jn(), Ei = (e = to()) => {
1103
+ const t = Wt(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (c, d) => {
1085
1104
  if (n.has(c)) {
1086
- console.warn("Attempt to add user that is already present", c, f);
1105
+ console.warn("Attempt to add user that is already present", c, d);
1087
1106
  return;
1088
1107
  }
1089
- const h = e.addUser(c, f);
1108
+ const m = e.addUser(c, d);
1090
1109
  n.set(c, {
1091
- ...f,
1110
+ ...d,
1092
1111
  presenceKey: c,
1093
- appearance: h
1112
+ appearance: m
1094
1113
  });
1095
1114
  }, s = (c) => {
1096
- const f = n.get(c);
1097
- if (!f) {
1115
+ const d = n.get(c);
1116
+ if (!d) {
1098
1117
  console.warn("Attempt to remove user that is not present", c);
1099
1118
  return;
1100
1119
  }
1101
- e.removeUser(f), n.delete(c);
1120
+ e.removeUser(d), n.delete(c);
1102
1121
  }, r = (c) => {
1103
- const f = new Set(c.map((g) => g.presenceKey)), h = c.filter(({ presenceKey: g }) => !n.has(g)), p = Array.from(n.values()).filter((g) => !f.has(g.presenceKey));
1104
- h.forEach(({ presenceKey: g, user: w }) => i(g, w)), p.forEach((g) => {
1105
- const { presenceKey: w } = g;
1106
- o.has(w) && t.emit("selectionChange", g, null), s(w);
1107
- }), (h.length > 0 || p.length > 0) && t.emit("presence", d());
1108
- }, a = (c, f) => {
1109
- const h = n.get(c);
1110
- if (!h) {
1122
+ const d = new Set(c.map((y) => y.presenceKey)), m = c.filter(({ presenceKey: y }) => !n.has(y)), g = Array.from(n.values()).filter((y) => !d.has(y.presenceKey));
1123
+ m.forEach(({ presenceKey: y, user: E }) => i(y, E)), g.forEach((y) => {
1124
+ const { presenceKey: E } = y;
1125
+ o.has(E) && t.emit("selectionChange", y, null), s(E);
1126
+ }), (m.length > 0 || g.length > 0) && t.emit("presence", f());
1127
+ }, a = (c, d) => {
1128
+ const m = n.get(c);
1129
+ if (!m) {
1111
1130
  console.warn("Activity notification from user that is not present");
1112
1131
  return;
1113
1132
  }
1114
- const p = o.get(c);
1115
- (!p || !to(p, f)) && (o.set(c, f), t.emit("selectionChange", h, f));
1116
- }, l = (c, f) => {
1117
- const h = n.get(c);
1118
- if (!h) {
1133
+ const g = o.get(c);
1134
+ (!g || !no(g, d)) && (o.set(c, d), t.emit("selectionChange", m, d));
1135
+ }, l = (c, d) => {
1136
+ const m = n.get(c);
1137
+ if (!m) {
1119
1138
  console.warn("Selection change for user that is not present", c);
1120
1139
  return;
1121
1140
  }
1122
- f ? o.set(c, f) : o.delete(c), t.emit("selectionChange", h, f);
1123
- }, d = () => [...Array.from(n.values())];
1141
+ d ? o.set(c, d) : o.delete(c), t.emit("selectionChange", m, d);
1142
+ }, f = () => [...Array.from(n.values())];
1124
1143
  return {
1125
- getPresentUsers: d,
1144
+ getPresentUsers: f,
1126
1145
  notifyActivity: a,
1127
- on: (c, f) => t.on(c, f),
1146
+ on: (c, d) => t.on(c, d),
1128
1147
  syncUsers: r,
1129
1148
  updateSelection: l
1130
1149
  };
1131
- }, Ei = (e, t = !1) => ({ parse: (i) => no(i, t), serialize: (i) => oo(i, e) }), no = (e, t = !1) => {
1132
- const n = e.id || rt(), { body: o, ...i } = e, s = Kn(o, n), r = Array.isArray(e.target) ? e.target[0] : e.target, a = Array.isArray(r.selector) ? r.selector[0] : r.selector, l = a.type === "FragmentSelector" ? hn(a, t) : a.type === "SvgSelector" ? wn(a) : void 0;
1150
+ }, Ai = (e, t = !1) => ({ parse: (i) => oo(i, t), serialize: (i) => io(i, e) }), oo = (e, t = !1) => {
1151
+ const n = e.id || rt(), { body: o, ...i } = e, s = Qn(o, n), r = Array.isArray(e.target) ? e.target[0] : e.target, a = Array.isArray(r.selector) ? r.selector[0] : r.selector, l = a.type === "FragmentSelector" ? gn(a, t) : a.type === "SvgSelector" ? En(a) : void 0;
1133
1152
  return l ? {
1134
1153
  parsed: {
1135
1154
  ...i,
@@ -1141,16 +1160,16 @@ const to = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(
1141
1160
  }
1142
1161
  }
1143
1162
  } : {
1144
- error: Error(`Unknown selector type: ${l.type}`)
1163
+ error: Error(`Unknown selector type: ${a.type}`)
1145
1164
  };
1146
- }, oo = (e, t) => {
1147
- const n = e.target.selector, o = n.type == V.RECTANGLE ? mn(n.geometry) : bn(n);
1165
+ }, io = (e, t) => {
1166
+ const n = e.target.selector, o = n.type == j.RECTANGLE ? pn(n.geometry) : An(n);
1148
1167
  return {
1149
1168
  ...e,
1150
1169
  "@context": "http://www.w3.org/ns/anno.jsonld",
1151
1170
  id: e.id,
1152
1171
  type: "Annotation",
1153
- body: Zn(e.bodies),
1172
+ body: xn(e.bodies),
1154
1173
  target: {
1155
1174
  source: t,
1156
1175
  selector: o
@@ -1165,7 +1184,7 @@ function _t(e) {
1165
1184
  let t, n, o, i, s;
1166
1185
  return {
1167
1186
  c() {
1168
- t = I("rect"), u(t, "class", "a9s-corner-handle"), u(t, "x", n = /*point*/
1187
+ t = D("rect"), u(t, "class", "a9s-corner-handle"), u(t, "x", n = /*point*/
1169
1188
  e[11][0] - /*handleSize*/
1170
1189
  e[3] / 2), u(t, "y", o = /*point*/
1171
1190
  e[11][1] - /*handleSize*/
@@ -1182,14 +1201,14 @@ function _t(e) {
1182
1201
  );
1183
1202
  },
1184
1203
  m(r, a) {
1185
- v(r, t, a), i || (s = J(t, "pointerdown", function() {
1186
- j(
1204
+ C(r, t, a), i || (s = K(t, "pointerdown", function() {
1205
+ W(
1187
1206
  /*grab*/
1188
- e[10](L(
1207
+ e[10](v(
1189
1208
  /*idx*/
1190
1209
  e[13]
1191
1210
  ))
1192
- ) && e[10](L(
1211
+ ) && e[10](v(
1193
1212
  /*idx*/
1194
1213
  e[13]
1195
1214
  )).apply(this, arguments);
@@ -1217,22 +1236,22 @@ function _t(e) {
1217
1236
  );
1218
1237
  },
1219
1238
  d(r) {
1220
- r && O(t), i = !1, s();
1239
+ r && I(t), i = !1, s();
1221
1240
  }
1222
1241
  };
1223
1242
  }
1224
- function io(e) {
1225
- let t, n, o, i, s, r, a, l, d, m, c = (
1243
+ function so(e) {
1244
+ let t, n, o, i, s, r, a, l, f, h, c = (
1226
1245
  /*geom*/
1227
1246
  e[4].points
1228
- ), f = [];
1229
- for (let h = 0; h < c.length; h += 1)
1230
- f[h] = _t(pt(e, c, h));
1247
+ ), d = [];
1248
+ for (let m = 0; m < c.length; m += 1)
1249
+ d[m] = _t(pt(e, c, m));
1231
1250
  return {
1232
1251
  c() {
1233
- t = I("polygon"), i = ne(), s = I("polygon"), a = ne();
1234
- for (let h = 0; h < f.length; h += 1)
1235
- f[h].c();
1252
+ t = D("polygon"), i = ne(), s = D("polygon"), a = ne();
1253
+ for (let m = 0; m < d.length; m += 1)
1254
+ d[m].c();
1236
1255
  l = ce(), u(t, "class", "a9s-outer"), u(t, "style", n = /*computedStyle*/
1237
1256
  e[1] ? "display:none;" : void 0), u(t, "points", o = /*geom*/
1238
1257
  e[4].points.map(yt).join(" ")), u(s, "class", "a9s-inner a9s-shape-handle"), u(
@@ -1243,60 +1262,60 @@ function io(e) {
1243
1262
  ), u(s, "points", r = /*geom*/
1244
1263
  e[4].points.map(wt).join(" "));
1245
1264
  },
1246
- m(h, p) {
1247
- v(h, t, p), v(h, i, p), v(h, s, p), v(h, a, p);
1248
- for (let g = 0; g < f.length; g += 1)
1249
- f[g] && f[g].m(h, p);
1250
- v(h, l, p), d || (m = [
1251
- J(t, "pointerdown", function() {
1252
- j(
1265
+ m(m, g) {
1266
+ C(m, t, g), C(m, i, g), C(m, s, g), C(m, a, g);
1267
+ for (let y = 0; y < d.length; y += 1)
1268
+ d[y] && d[y].m(m, g);
1269
+ C(m, l, g), f || (h = [
1270
+ K(t, "pointerdown", function() {
1271
+ W(
1253
1272
  /*grab*/
1254
- e[10](L.SHAPE)
1255
- ) && e[10](L.SHAPE).apply(this, arguments);
1273
+ e[10](v.SHAPE)
1274
+ ) && e[10](v.SHAPE).apply(this, arguments);
1256
1275
  }),
1257
- J(s, "pointerdown", function() {
1258
- j(
1276
+ K(s, "pointerdown", function() {
1277
+ W(
1259
1278
  /*grab*/
1260
- e[10](L.SHAPE)
1261
- ) && e[10](L.SHAPE).apply(this, arguments);
1279
+ e[10](v.SHAPE)
1280
+ ) && e[10](v.SHAPE).apply(this, arguments);
1262
1281
  })
1263
- ], d = !0);
1282
+ ], f = !0);
1264
1283
  },
1265
- p(h, p) {
1266
- if (e = h, p & /*computedStyle*/
1284
+ p(m, g) {
1285
+ if (e = m, g & /*computedStyle*/
1267
1286
  2 && n !== (n = /*computedStyle*/
1268
- e[1] ? "display:none;" : void 0) && u(t, "style", n), p & /*geom*/
1287
+ e[1] ? "display:none;" : void 0) && u(t, "style", n), g & /*geom*/
1269
1288
  16 && o !== (o = /*geom*/
1270
- e[4].points.map(yt).join(" ")) && u(t, "points", o), p & /*computedStyle*/
1289
+ e[4].points.map(yt).join(" ")) && u(t, "points", o), g & /*computedStyle*/
1271
1290
  2 && u(
1272
1291
  s,
1273
1292
  "style",
1274
1293
  /*computedStyle*/
1275
1294
  e[1]
1276
- ), p & /*geom*/
1295
+ ), g & /*geom*/
1277
1296
  16 && r !== (r = /*geom*/
1278
- e[4].points.map(wt).join(" ")) && u(s, "points", r), p & /*geom, handleSize, grab, Handle*/
1297
+ e[4].points.map(wt).join(" ")) && u(s, "points", r), g & /*geom, handleSize, grab, Handle*/
1279
1298
  1048) {
1280
1299
  c = /*geom*/
1281
1300
  e[4].points;
1282
- let g;
1283
- for (g = 0; g < c.length; g += 1) {
1284
- const w = pt(e, c, g);
1285
- f[g] ? f[g].p(w, p) : (f[g] = _t(w), f[g].c(), f[g].m(l.parentNode, l));
1301
+ let y;
1302
+ for (y = 0; y < c.length; y += 1) {
1303
+ const E = pt(e, c, y);
1304
+ d[y] ? d[y].p(E, g) : (d[y] = _t(E), d[y].c(), d[y].m(l.parentNode, l));
1286
1305
  }
1287
- for (; g < f.length; g += 1)
1288
- f[g].d(1);
1289
- f.length = c.length;
1306
+ for (; y < d.length; y += 1)
1307
+ d[y].d(1);
1308
+ d.length = c.length;
1290
1309
  }
1291
1310
  },
1292
- d(h) {
1293
- h && O(t), h && O(i), h && O(s), h && O(a), ot(f, h), h && O(l), d = !1, ae(m);
1311
+ d(m) {
1312
+ m && I(t), m && I(i), m && I(s), m && I(a), ot(d, m), m && I(l), f = !1, ae(h);
1294
1313
  }
1295
1314
  };
1296
1315
  }
1297
- function so(e) {
1316
+ function ro(e) {
1298
1317
  let t, n;
1299
- return t = new Wt({
1318
+ return t = new Jt({
1300
1319
  props: {
1301
1320
  shape: (
1302
1321
  /*shape*/
@@ -1312,7 +1331,7 @@ function so(e) {
1312
1331
  ),
1313
1332
  $$slots: {
1314
1333
  default: [
1315
- io,
1334
+ so,
1316
1335
  ({ grab: o }) => ({ 10: o }),
1317
1336
  ({ grab: o }) => o ? 1024 : 0
1318
1337
  ]
@@ -1348,7 +1367,7 @@ function so(e) {
1348
1367
  17434 && (s.$$scope = { dirty: i, ctx: o }), t.$set(s);
1349
1368
  },
1350
1369
  i(o) {
1351
- n || (Y(t.$$.fragment, o), n = !0);
1370
+ n || (X(t.$$.fragment, o), n = !0);
1352
1371
  },
1353
1372
  o(o) {
1354
1373
  N(t.$$.fragment, o), n = !1;
@@ -1359,25 +1378,25 @@ function so(e) {
1359
1378
  };
1360
1379
  }
1361
1380
  const yt = (e) => e.join(","), wt = (e) => e.join(",");
1362
- function ro(e, t, n) {
1381
+ function lo(e, t, n) {
1363
1382
  let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
1364
- const d = (h, p, g) => {
1365
- let w;
1366
- p === L.SHAPE ? w = h.geometry.points.map(([_, M]) => [_ + g[0], M + g[1]]) : w = h.geometry.points.map(([_, M], X) => p === L(X) ? [_ + g[0], M + g[1]] : [_, M]);
1367
- const T = He(w);
1368
- return { ...h, geometry: { points: w, bounds: T } };
1383
+ const f = (m, g, y) => {
1384
+ let E;
1385
+ g === v.SHAPE ? E = m.geometry.points.map(([_, p]) => [_ + y[0], p + y[1]]) : E = m.geometry.points.map(([_, p], L) => g === v(L) ? [_ + y[0], p + y[1]] : [_, p]);
1386
+ const b = He(E);
1387
+ return { ...m, geometry: { points: E, bounds: b } };
1369
1388
  };
1370
- function m(h) {
1371
- Ae.call(this, e, h);
1389
+ function h(m) {
1390
+ Ae.call(this, e, m);
1372
1391
  }
1373
- function c(h) {
1374
- Ae.call(this, e, h);
1392
+ function c(m) {
1393
+ Ae.call(this, e, m);
1375
1394
  }
1376
- function f(h) {
1377
- Ae.call(this, e, h);
1395
+ function d(m) {
1396
+ Ae.call(this, e, m);
1378
1397
  }
1379
- return e.$$set = (h) => {
1380
- "shape" in h && n(0, s = h.shape), "computedStyle" in h && n(1, r = h.computedStyle), "transform" in h && n(2, a = h.transform), "viewportScale" in h && n(6, l = h.viewportScale);
1398
+ return e.$$set = (m) => {
1399
+ "shape" in m && n(0, s = m.shape), "computedStyle" in m && n(1, r = m.computedStyle), "transform" in m && n(2, a = m.transform), "viewportScale" in m && n(6, l = m.viewportScale);
1381
1400
  }, e.$$.update = () => {
1382
1401
  e.$$.dirty & /*shape*/
1383
1402
  1 && n(4, o = s.geometry), e.$$.dirty & /*viewportScale*/
@@ -1388,16 +1407,16 @@ function ro(e, t, n) {
1388
1407
  a,
1389
1408
  i,
1390
1409
  o,
1391
- d,
1410
+ f,
1392
1411
  l,
1393
- m,
1412
+ h,
1394
1413
  c,
1395
- f
1414
+ d
1396
1415
  ];
1397
1416
  }
1398
- class lo extends ie {
1417
+ class ao extends ie {
1399
1418
  constructor(t) {
1400
- super(), oe(this, t, ro, so, $, {
1419
+ super(), oe(this, t, lo, ro, $, {
1401
1420
  shape: 0,
1402
1421
  computedStyle: 1,
1403
1422
  transform: 2,
@@ -1405,11 +1424,11 @@ class lo extends ie {
1405
1424
  });
1406
1425
  }
1407
1426
  }
1408
- function ao(e) {
1409
- let t, n, o, i, s, r, a, l, d, m, c, f, h, p, g, w, T, _, M, X, R, z, K, D, P, y, b, E, A, k, U, Q, Me, x, B, Z, F, W, se, he, Ve, ee, Ie, Pe, je, te, Ye, Re, We, at;
1427
+ function co(e) {
1428
+ let t, n, o, i, s, r, a, l, f, h, c, d, m, g, y, E, b, _, p, L, S, B, z, k, H, w, A, T, M, P, U, Q, Me, x, Y, Z, V, q, se, he, Ve, ee, Ce, Pe, je, te, Ye, Re, We, at;
1410
1429
  return {
1411
1430
  c() {
1412
- t = I("rect"), a = ne(), l = I("rect"), h = ne(), p = I("rect"), _ = ne(), M = I("rect"), K = ne(), D = I("rect"), E = ne(), A = I("rect"), Me = ne(), x = I("rect"), F = ne(), W = I("rect"), Ve = ne(), ee = I("rect"), je = ne(), te = I("rect"), u(t, "class", "a9s-outer"), u(t, "style", n = /*computedStyle*/
1431
+ t = D("rect"), a = ne(), l = D("rect"), m = ne(), g = D("rect"), _ = ne(), p = D("rect"), z = ne(), k = D("rect"), T = ne(), M = D("rect"), Me = ne(), x = D("rect"), V = ne(), q = D("rect"), Ve = ne(), ee = D("rect"), je = ne(), te = D("rect"), u(t, "class", "a9s-outer"), u(t, "style", n = /*computedStyle*/
1413
1432
  e[1] ? "display:none;" : void 0), u(t, "x", o = /*geom*/
1414
1433
  e[4].x), u(t, "y", i = /*geom*/
1415
1434
  e[4].y), u(t, "width", s = /*geom*/
@@ -1419,25 +1438,25 @@ function ao(e) {
1419
1438
  "style",
1420
1439
  /*computedStyle*/
1421
1440
  e[1]
1422
- ), u(l, "x", d = /*geom*/
1423
- e[4].x), u(l, "y", m = /*geom*/
1441
+ ), u(l, "x", f = /*geom*/
1442
+ e[4].x), u(l, "y", h = /*geom*/
1424
1443
  e[4].y), u(l, "width", c = /*geom*/
1425
- e[4].w), u(l, "height", f = /*geom*/
1426
- e[4].h), u(p, "class", "a9s-edge-handle a9s-edge-handle-top"), u(p, "x", g = /*geom*/
1427
- e[4].x), u(p, "y", w = /*geom*/
1428
- e[4].y), u(p, "height", 1), u(p, "width", T = /*geom*/
1429
- e[4].w), u(M, "class", "a9s-edge-handle a9s-edge-handle-right"), u(M, "x", X = /*geom*/
1444
+ e[4].w), u(l, "height", d = /*geom*/
1445
+ e[4].h), u(g, "class", "a9s-edge-handle a9s-edge-handle-top"), u(g, "x", y = /*geom*/
1446
+ e[4].x), u(g, "y", E = /*geom*/
1447
+ e[4].y), u(g, "height", 1), u(g, "width", b = /*geom*/
1448
+ e[4].w), u(p, "class", "a9s-edge-handle a9s-edge-handle-right"), u(p, "x", L = /*geom*/
1430
1449
  e[4].x + /*geom*/
1431
- e[4].w), u(M, "y", R = /*geom*/
1432
- e[4].y), u(M, "height", z = /*geom*/
1433
- e[4].h), u(M, "width", 1), u(D, "class", "a9s-edge-handle a9s-edge-handle-bottom"), u(D, "x", P = /*geom*/
1434
- e[4].x), u(D, "y", y = /*geom*/
1450
+ e[4].w), u(p, "y", S = /*geom*/
1451
+ e[4].y), u(p, "height", B = /*geom*/
1452
+ e[4].h), u(p, "width", 1), u(k, "class", "a9s-edge-handle a9s-edge-handle-bottom"), u(k, "x", H = /*geom*/
1453
+ e[4].x), u(k, "y", w = /*geom*/
1435
1454
  e[4].y + /*geom*/
1436
- e[4].h), u(D, "height", 1), u(D, "width", b = /*geom*/
1437
- e[4].w), u(A, "class", "a9s-edge-handle a9s-edge-handle-left"), u(A, "x", k = /*geom*/
1438
- e[4].x), u(A, "y", U = /*geom*/
1439
- e[4].y), u(A, "height", Q = /*geom*/
1440
- e[4].h), u(A, "width", 1), u(x, "class", "a9s-corner-handle a9s-corner-handle-topleft"), u(x, "x", B = /*geom*/
1455
+ e[4].h), u(k, "height", 1), u(k, "width", A = /*geom*/
1456
+ e[4].w), u(M, "class", "a9s-edge-handle a9s-edge-handle-left"), u(M, "x", P = /*geom*/
1457
+ e[4].x), u(M, "y", U = /*geom*/
1458
+ e[4].y), u(M, "height", Q = /*geom*/
1459
+ e[4].h), u(M, "width", 1), u(x, "class", "a9s-corner-handle a9s-corner-handle-topleft"), u(x, "x", Y = /*geom*/
1441
1460
  e[4].x - /*handleSize*/
1442
1461
  e[3] / 2), u(x, "y", Z = /*geom*/
1443
1462
  e[4].y - /*handleSize*/
@@ -1451,22 +1470,22 @@ function ao(e) {
1451
1470
  "width",
1452
1471
  /*handleSize*/
1453
1472
  e[3]
1454
- ), u(W, "class", "a9s-corner-handle a9s-corner-handle-topright"), u(W, "x", se = /*geom*/
1473
+ ), u(q, "class", "a9s-corner-handle a9s-corner-handle-topright"), u(q, "x", se = /*geom*/
1455
1474
  e[4].x + /*geom*/
1456
1475
  e[4].w - /*handleSize*/
1457
- e[3] / 2), u(W, "y", he = /*geom*/
1476
+ e[3] / 2), u(q, "y", he = /*geom*/
1458
1477
  e[4].y - /*handleSize*/
1459
1478
  e[3] / 2), u(
1460
- W,
1479
+ q,
1461
1480
  "height",
1462
1481
  /*handleSize*/
1463
1482
  e[3]
1464
1483
  ), u(
1465
- W,
1484
+ q,
1466
1485
  "width",
1467
1486
  /*handleSize*/
1468
1487
  e[3]
1469
- ), u(ee, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), u(ee, "x", Ie = /*geom*/
1488
+ ), u(ee, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), u(ee, "x", Ce = /*geom*/
1470
1489
  e[4].x + /*geom*/
1471
1490
  e[4].w - /*handleSize*/
1472
1491
  e[3] / 2), u(ee, "y", Pe = /*geom*/
@@ -1499,192 +1518,192 @@ function ao(e) {
1499
1518
  e[3]
1500
1519
  );
1501
1520
  },
1502
- m(C, S) {
1503
- v(C, t, S), v(C, a, S), v(C, l, S), v(C, h, S), v(C, p, S), v(C, _, S), v(C, M, S), v(C, K, S), v(C, D, S), v(C, E, S), v(C, A, S), v(C, Me, S), v(C, x, S), v(C, F, S), v(C, W, S), v(C, Ve, S), v(C, ee, S), v(C, je, S), v(C, te, S), We || (at = [
1504
- J(t, "pointerdown", function() {
1505
- j(
1521
+ m(R, O) {
1522
+ C(R, t, O), C(R, a, O), C(R, l, O), C(R, m, O), C(R, g, O), C(R, _, O), C(R, p, O), C(R, z, O), C(R, k, O), C(R, T, O), C(R, M, O), C(R, Me, O), C(R, x, O), C(R, V, O), C(R, q, O), C(R, Ve, O), C(R, ee, O), C(R, je, O), C(R, te, O), We || (at = [
1523
+ K(t, "pointerdown", function() {
1524
+ W(
1506
1525
  /*grab*/
1507
- e[10](L.SHAPE)
1508
- ) && e[10](L.SHAPE).apply(this, arguments);
1526
+ e[10](v.SHAPE)
1527
+ ) && e[10](v.SHAPE).apply(this, arguments);
1509
1528
  }),
1510
- J(l, "pointerdown", function() {
1511
- j(
1529
+ K(l, "pointerdown", function() {
1530
+ W(
1512
1531
  /*grab*/
1513
- e[10](L.SHAPE)
1514
- ) && e[10](L.SHAPE).apply(this, arguments);
1532
+ e[10](v.SHAPE)
1533
+ ) && e[10](v.SHAPE).apply(this, arguments);
1515
1534
  }),
1516
- J(p, "pointerdown", function() {
1517
- j(
1535
+ K(g, "pointerdown", function() {
1536
+ W(
1518
1537
  /*grab*/
1519
- e[10](L.TOP)
1520
- ) && e[10](L.TOP).apply(this, arguments);
1538
+ e[10](v.TOP)
1539
+ ) && e[10](v.TOP).apply(this, arguments);
1521
1540
  }),
1522
- J(M, "pointerdown", function() {
1523
- j(
1541
+ K(p, "pointerdown", function() {
1542
+ W(
1524
1543
  /*grab*/
1525
- e[10](L.RIGHT)
1526
- ) && e[10](L.RIGHT).apply(this, arguments);
1544
+ e[10](v.RIGHT)
1545
+ ) && e[10](v.RIGHT).apply(this, arguments);
1527
1546
  }),
1528
- J(D, "pointerdown", function() {
1529
- j(
1547
+ K(k, "pointerdown", function() {
1548
+ W(
1530
1549
  /*grab*/
1531
- e[10](L.BOTTOM)
1532
- ) && e[10](L.BOTTOM).apply(this, arguments);
1550
+ e[10](v.BOTTOM)
1551
+ ) && e[10](v.BOTTOM).apply(this, arguments);
1533
1552
  }),
1534
- J(A, "pointerdown", function() {
1535
- j(
1553
+ K(M, "pointerdown", function() {
1554
+ W(
1536
1555
  /*grab*/
1537
- e[10](L.LEFT)
1538
- ) && e[10](L.LEFT).apply(this, arguments);
1556
+ e[10](v.LEFT)
1557
+ ) && e[10](v.LEFT).apply(this, arguments);
1539
1558
  }),
1540
- J(x, "pointerdown", function() {
1541
- j(
1559
+ K(x, "pointerdown", function() {
1560
+ W(
1542
1561
  /*grab*/
1543
- e[10](L.TOP_LEFT)
1544
- ) && e[10](L.TOP_LEFT).apply(this, arguments);
1562
+ e[10](v.TOP_LEFT)
1563
+ ) && e[10](v.TOP_LEFT).apply(this, arguments);
1545
1564
  }),
1546
- J(W, "pointerdown", function() {
1547
- j(
1565
+ K(q, "pointerdown", function() {
1566
+ W(
1548
1567
  /*grab*/
1549
- e[10](L.TOP_RIGHT)
1550
- ) && e[10](L.TOP_RIGHT).apply(this, arguments);
1568
+ e[10](v.TOP_RIGHT)
1569
+ ) && e[10](v.TOP_RIGHT).apply(this, arguments);
1551
1570
  }),
1552
- J(ee, "pointerdown", function() {
1553
- j(
1571
+ K(ee, "pointerdown", function() {
1572
+ W(
1554
1573
  /*grab*/
1555
- e[10](L.BOTTOM_RIGHT)
1556
- ) && e[10](L.BOTTOM_RIGHT).apply(this, arguments);
1574
+ e[10](v.BOTTOM_RIGHT)
1575
+ ) && e[10](v.BOTTOM_RIGHT).apply(this, arguments);
1557
1576
  }),
1558
- J(te, "pointerdown", function() {
1559
- j(
1577
+ K(te, "pointerdown", function() {
1578
+ W(
1560
1579
  /*grab*/
1561
- e[10](L.BOTTOM_LEFT)
1562
- ) && e[10](L.BOTTOM_LEFT).apply(this, arguments);
1580
+ e[10](v.BOTTOM_LEFT)
1581
+ ) && e[10](v.BOTTOM_LEFT).apply(this, arguments);
1563
1582
  })
1564
1583
  ], We = !0);
1565
1584
  },
1566
- p(C, S) {
1567
- e = C, S & /*computedStyle*/
1585
+ p(R, O) {
1586
+ e = R, O & /*computedStyle*/
1568
1587
  2 && n !== (n = /*computedStyle*/
1569
- e[1] ? "display:none;" : void 0) && u(t, "style", n), S & /*geom*/
1588
+ e[1] ? "display:none;" : void 0) && u(t, "style", n), O & /*geom*/
1570
1589
  16 && o !== (o = /*geom*/
1571
- e[4].x) && u(t, "x", o), S & /*geom*/
1590
+ e[4].x) && u(t, "x", o), O & /*geom*/
1572
1591
  16 && i !== (i = /*geom*/
1573
- e[4].y) && u(t, "y", i), S & /*geom*/
1592
+ e[4].y) && u(t, "y", i), O & /*geom*/
1574
1593
  16 && s !== (s = /*geom*/
1575
- e[4].w) && u(t, "width", s), S & /*geom*/
1594
+ e[4].w) && u(t, "width", s), O & /*geom*/
1576
1595
  16 && r !== (r = /*geom*/
1577
- e[4].h) && u(t, "height", r), S & /*computedStyle*/
1596
+ e[4].h) && u(t, "height", r), O & /*computedStyle*/
1578
1597
  2 && u(
1579
1598
  l,
1580
1599
  "style",
1581
1600
  /*computedStyle*/
1582
1601
  e[1]
1583
- ), S & /*geom*/
1584
- 16 && d !== (d = /*geom*/
1585
- e[4].x) && u(l, "x", d), S & /*geom*/
1586
- 16 && m !== (m = /*geom*/
1587
- e[4].y) && u(l, "y", m), S & /*geom*/
1588
- 16 && c !== (c = /*geom*/
1589
- e[4].w) && u(l, "width", c), S & /*geom*/
1602
+ ), O & /*geom*/
1590
1603
  16 && f !== (f = /*geom*/
1591
- e[4].h) && u(l, "height", f), S & /*geom*/
1592
- 16 && g !== (g = /*geom*/
1593
- e[4].x) && u(p, "x", g), S & /*geom*/
1594
- 16 && w !== (w = /*geom*/
1595
- e[4].y) && u(p, "y", w), S & /*geom*/
1596
- 16 && T !== (T = /*geom*/
1597
- e[4].w) && u(p, "width", T), S & /*geom*/
1598
- 16 && X !== (X = /*geom*/
1599
- e[4].x + /*geom*/
1600
- e[4].w) && u(M, "x", X), S & /*geom*/
1601
- 16 && R !== (R = /*geom*/
1602
- e[4].y) && u(M, "y", R), S & /*geom*/
1603
- 16 && z !== (z = /*geom*/
1604
- e[4].h) && u(M, "height", z), S & /*geom*/
1605
- 16 && P !== (P = /*geom*/
1606
- e[4].x) && u(D, "x", P), S & /*geom*/
1604
+ e[4].x) && u(l, "x", f), O & /*geom*/
1605
+ 16 && h !== (h = /*geom*/
1606
+ e[4].y) && u(l, "y", h), O & /*geom*/
1607
+ 16 && c !== (c = /*geom*/
1608
+ e[4].w) && u(l, "width", c), O & /*geom*/
1609
+ 16 && d !== (d = /*geom*/
1610
+ e[4].h) && u(l, "height", d), O & /*geom*/
1607
1611
  16 && y !== (y = /*geom*/
1608
- e[4].y + /*geom*/
1609
- e[4].h) && u(D, "y", y), S & /*geom*/
1612
+ e[4].x) && u(g, "x", y), O & /*geom*/
1613
+ 16 && E !== (E = /*geom*/
1614
+ e[4].y) && u(g, "y", E), O & /*geom*/
1610
1615
  16 && b !== (b = /*geom*/
1611
- e[4].w) && u(D, "width", b), S & /*geom*/
1612
- 16 && k !== (k = /*geom*/
1613
- e[4].x) && u(A, "x", k), S & /*geom*/
1616
+ e[4].w) && u(g, "width", b), O & /*geom*/
1617
+ 16 && L !== (L = /*geom*/
1618
+ e[4].x + /*geom*/
1619
+ e[4].w) && u(p, "x", L), O & /*geom*/
1620
+ 16 && S !== (S = /*geom*/
1621
+ e[4].y) && u(p, "y", S), O & /*geom*/
1622
+ 16 && B !== (B = /*geom*/
1623
+ e[4].h) && u(p, "height", B), O & /*geom*/
1624
+ 16 && H !== (H = /*geom*/
1625
+ e[4].x) && u(k, "x", H), O & /*geom*/
1626
+ 16 && w !== (w = /*geom*/
1627
+ e[4].y + /*geom*/
1628
+ e[4].h) && u(k, "y", w), O & /*geom*/
1629
+ 16 && A !== (A = /*geom*/
1630
+ e[4].w) && u(k, "width", A), O & /*geom*/
1631
+ 16 && P !== (P = /*geom*/
1632
+ e[4].x) && u(M, "x", P), O & /*geom*/
1614
1633
  16 && U !== (U = /*geom*/
1615
- e[4].y) && u(A, "y", U), S & /*geom*/
1634
+ e[4].y) && u(M, "y", U), O & /*geom*/
1616
1635
  16 && Q !== (Q = /*geom*/
1617
- e[4].h) && u(A, "height", Q), S & /*geom, handleSize*/
1618
- 24 && B !== (B = /*geom*/
1636
+ e[4].h) && u(M, "height", Q), O & /*geom, handleSize*/
1637
+ 24 && Y !== (Y = /*geom*/
1619
1638
  e[4].x - /*handleSize*/
1620
- e[3] / 2) && u(x, "x", B), S & /*geom, handleSize*/
1639
+ e[3] / 2) && u(x, "x", Y), O & /*geom, handleSize*/
1621
1640
  24 && Z !== (Z = /*geom*/
1622
1641
  e[4].y - /*handleSize*/
1623
- e[3] / 2) && u(x, "y", Z), S & /*handleSize*/
1642
+ e[3] / 2) && u(x, "y", Z), O & /*handleSize*/
1624
1643
  8 && u(
1625
1644
  x,
1626
1645
  "height",
1627
1646
  /*handleSize*/
1628
1647
  e[3]
1629
- ), S & /*handleSize*/
1648
+ ), O & /*handleSize*/
1630
1649
  8 && u(
1631
1650
  x,
1632
1651
  "width",
1633
1652
  /*handleSize*/
1634
1653
  e[3]
1635
- ), S & /*geom, handleSize*/
1654
+ ), O & /*geom, handleSize*/
1636
1655
  24 && se !== (se = /*geom*/
1637
1656
  e[4].x + /*geom*/
1638
1657
  e[4].w - /*handleSize*/
1639
- e[3] / 2) && u(W, "x", se), S & /*geom, handleSize*/
1658
+ e[3] / 2) && u(q, "x", se), O & /*geom, handleSize*/
1640
1659
  24 && he !== (he = /*geom*/
1641
1660
  e[4].y - /*handleSize*/
1642
- e[3] / 2) && u(W, "y", he), S & /*handleSize*/
1661
+ e[3] / 2) && u(q, "y", he), O & /*handleSize*/
1643
1662
  8 && u(
1644
- W,
1663
+ q,
1645
1664
  "height",
1646
1665
  /*handleSize*/
1647
1666
  e[3]
1648
- ), S & /*handleSize*/
1667
+ ), O & /*handleSize*/
1649
1668
  8 && u(
1650
- W,
1669
+ q,
1651
1670
  "width",
1652
1671
  /*handleSize*/
1653
1672
  e[3]
1654
- ), S & /*geom, handleSize*/
1655
- 24 && Ie !== (Ie = /*geom*/
1673
+ ), O & /*geom, handleSize*/
1674
+ 24 && Ce !== (Ce = /*geom*/
1656
1675
  e[4].x + /*geom*/
1657
1676
  e[4].w - /*handleSize*/
1658
- e[3] / 2) && u(ee, "x", Ie), S & /*geom, handleSize*/
1677
+ e[3] / 2) && u(ee, "x", Ce), O & /*geom, handleSize*/
1659
1678
  24 && Pe !== (Pe = /*geom*/
1660
1679
  e[4].y + /*geom*/
1661
1680
  e[4].h - /*handleSize*/
1662
- e[3] / 2) && u(ee, "y", Pe), S & /*handleSize*/
1681
+ e[3] / 2) && u(ee, "y", Pe), O & /*handleSize*/
1663
1682
  8 && u(
1664
1683
  ee,
1665
1684
  "height",
1666
1685
  /*handleSize*/
1667
1686
  e[3]
1668
- ), S & /*handleSize*/
1687
+ ), O & /*handleSize*/
1669
1688
  8 && u(
1670
1689
  ee,
1671
1690
  "width",
1672
1691
  /*handleSize*/
1673
1692
  e[3]
1674
- ), S & /*geom, handleSize*/
1693
+ ), O & /*geom, handleSize*/
1675
1694
  24 && Ye !== (Ye = /*geom*/
1676
1695
  e[4].x - /*handleSize*/
1677
- e[3] / 2) && u(te, "x", Ye), S & /*geom, handleSize*/
1696
+ e[3] / 2) && u(te, "x", Ye), O & /*geom, handleSize*/
1678
1697
  24 && Re !== (Re = /*geom*/
1679
1698
  e[4].y + /*geom*/
1680
1699
  e[4].h - /*handleSize*/
1681
- e[3] / 2) && u(te, "y", Re), S & /*handleSize*/
1700
+ e[3] / 2) && u(te, "y", Re), O & /*handleSize*/
1682
1701
  8 && u(
1683
1702
  te,
1684
1703
  "height",
1685
1704
  /*handleSize*/
1686
1705
  e[3]
1687
- ), S & /*handleSize*/
1706
+ ), O & /*handleSize*/
1688
1707
  8 && u(
1689
1708
  te,
1690
1709
  "width",
@@ -1692,14 +1711,14 @@ function ao(e) {
1692
1711
  e[3]
1693
1712
  );
1694
1713
  },
1695
- d(C) {
1696
- C && O(t), C && O(a), C && O(l), C && O(h), C && O(p), C && O(_), C && O(M), C && O(K), C && O(D), C && O(E), C && O(A), C && O(Me), C && O(x), C && O(F), C && O(W), C && O(Ve), C && O(ee), C && O(je), C && O(te), We = !1, ae(at);
1714
+ d(R) {
1715
+ R && I(t), R && I(a), R && I(l), R && I(m), R && I(g), R && I(_), R && I(p), R && I(z), R && I(k), R && I(T), R && I(M), R && I(Me), R && I(x), R && I(V), R && I(q), R && I(Ve), R && I(ee), R && I(je), R && I(te), We = !1, ae(at);
1697
1716
  }
1698
1717
  };
1699
1718
  }
1700
- function co(e) {
1719
+ function fo(e) {
1701
1720
  let t, n;
1702
- return t = new Wt({
1721
+ return t = new Jt({
1703
1722
  props: {
1704
1723
  shape: (
1705
1724
  /*shape*/
@@ -1715,7 +1734,7 @@ function co(e) {
1715
1734
  ),
1716
1735
  $$slots: {
1717
1736
  default: [
1718
- ao,
1737
+ co,
1719
1738
  ({ grab: o }) => ({ 10: o }),
1720
1739
  ({ grab: o }) => o ? 1024 : 0
1721
1740
  ]
@@ -1751,7 +1770,7 @@ function co(e) {
1751
1770
  3098 && (s.$$scope = { dirty: i, ctx: o }), t.$set(s);
1752
1771
  },
1753
1772
  i(o) {
1754
- n || (Y(t.$$.fragment, o), n = !0);
1773
+ n || (X(t.$$.fragment, o), n = !0);
1755
1774
  },
1756
1775
  o(o) {
1757
1776
  N(t.$$.fragment, o), n = !1;
@@ -1761,72 +1780,72 @@ function co(e) {
1761
1780
  }
1762
1781
  };
1763
1782
  }
1764
- function fo(e, t, n) {
1783
+ function uo(e, t, n) {
1765
1784
  let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
1766
- const d = (h, p, g) => {
1767
- const w = h.geometry.bounds;
1768
- let [T, _] = [w.minX, w.minY], [M, X] = [w.maxX, w.maxY];
1769
- const [R, z] = g;
1770
- if (p === L.SHAPE)
1771
- T += R, M += R, _ += z, X += z;
1785
+ const f = (m, g, y) => {
1786
+ const E = m.geometry.bounds;
1787
+ let [b, _] = [E.minX, E.minY], [p, L] = [E.maxX, E.maxY];
1788
+ const [S, B] = y;
1789
+ if (g === v.SHAPE)
1790
+ b += S, p += S, _ += B, L += B;
1772
1791
  else {
1773
- switch (p) {
1774
- case L.TOP:
1775
- case L.TOP_LEFT:
1776
- case L.TOP_RIGHT: {
1777
- _ += z;
1792
+ switch (g) {
1793
+ case v.TOP:
1794
+ case v.TOP_LEFT:
1795
+ case v.TOP_RIGHT: {
1796
+ _ += B;
1778
1797
  break;
1779
1798
  }
1780
- case L.BOTTOM:
1781
- case L.BOTTOM_LEFT:
1782
- case L.BOTTOM_RIGHT: {
1783
- X += z;
1799
+ case v.BOTTOM:
1800
+ case v.BOTTOM_LEFT:
1801
+ case v.BOTTOM_RIGHT: {
1802
+ L += B;
1784
1803
  break;
1785
1804
  }
1786
1805
  }
1787
- switch (p) {
1788
- case L.LEFT:
1789
- case L.TOP_LEFT:
1790
- case L.BOTTOM_LEFT: {
1791
- T += R;
1806
+ switch (g) {
1807
+ case v.LEFT:
1808
+ case v.TOP_LEFT:
1809
+ case v.BOTTOM_LEFT: {
1810
+ b += S;
1792
1811
  break;
1793
1812
  }
1794
- case L.RIGHT:
1795
- case L.TOP_RIGHT:
1796
- case L.BOTTOM_RIGHT: {
1797
- M += R;
1813
+ case v.RIGHT:
1814
+ case v.TOP_RIGHT:
1815
+ case v.BOTTOM_RIGHT: {
1816
+ p += S;
1798
1817
  break;
1799
1818
  }
1800
1819
  }
1801
1820
  }
1802
- const K = Math.min(T, M), D = Math.min(_, X), P = Math.abs(M - T), y = Math.abs(X - _);
1821
+ const z = Math.min(b, p), k = Math.min(_, L), H = Math.abs(p - b), w = Math.abs(L - _);
1803
1822
  return {
1804
- ...h,
1823
+ ...m,
1805
1824
  geometry: {
1806
- x: K,
1807
- y: D,
1808
- w: P,
1809
- h: y,
1825
+ x: z,
1826
+ y: k,
1827
+ w: H,
1828
+ h: w,
1810
1829
  bounds: {
1811
- minX: K,
1812
- minY: D,
1813
- maxX: K + P,
1814
- maxY: D + y
1830
+ minX: z,
1831
+ minY: k,
1832
+ maxX: z + H,
1833
+ maxY: k + w
1815
1834
  }
1816
1835
  }
1817
1836
  };
1818
1837
  };
1819
- function m(h) {
1820
- Ae.call(this, e, h);
1838
+ function h(m) {
1839
+ Ae.call(this, e, m);
1821
1840
  }
1822
- function c(h) {
1823
- Ae.call(this, e, h);
1841
+ function c(m) {
1842
+ Ae.call(this, e, m);
1824
1843
  }
1825
- function f(h) {
1826
- Ae.call(this, e, h);
1844
+ function d(m) {
1845
+ Ae.call(this, e, m);
1827
1846
  }
1828
- return e.$$set = (h) => {
1829
- "shape" in h && n(0, s = h.shape), "computedStyle" in h && n(1, r = h.computedStyle), "transform" in h && n(2, a = h.transform), "viewportScale" in h && n(6, l = h.viewportScale);
1847
+ return e.$$set = (m) => {
1848
+ "shape" in m && n(0, s = m.shape), "computedStyle" in m && n(1, r = m.computedStyle), "transform" in m && n(2, a = m.transform), "viewportScale" in m && n(6, l = m.viewportScale);
1830
1849
  }, e.$$.update = () => {
1831
1850
  e.$$.dirty & /*shape*/
1832
1851
  1 && n(4, o = s.geometry), e.$$.dirty & /*viewportScale*/
@@ -1837,16 +1856,16 @@ function fo(e, t, n) {
1837
1856
  a,
1838
1857
  i,
1839
1858
  o,
1840
- d,
1859
+ f,
1841
1860
  l,
1842
- m,
1861
+ h,
1843
1862
  c,
1844
- f
1863
+ d
1845
1864
  ];
1846
1865
  }
1847
- class uo extends ie {
1866
+ class ho extends ie {
1848
1867
  constructor(t) {
1849
- super(), oe(this, t, fo, co, $, {
1868
+ super(), oe(this, t, uo, fo, $, {
1850
1869
  shape: 0,
1851
1870
  computedStyle: 1,
1852
1871
  transform: 2,
@@ -1854,29 +1873,29 @@ class uo extends ie {
1854
1873
  });
1855
1874
  }
1856
1875
  }
1857
- const jt = /* @__PURE__ */ new Map([
1858
- [V.RECTANGLE, uo],
1859
- [V.POLYGON, lo]
1860
- ]), bt = (e) => jt.get(e.type), ho = (e, t) => jt.set(e, t), L = (e) => `HANDLE-${e}`;
1861
- L.SHAPE = "SHAPE";
1862
- L.TOP = "TOP";
1863
- L.RIGHT = "RIGHT";
1864
- L.BOTTOM = "BOTTOM";
1865
- L.LEFT = "LEFT";
1866
- L.TOP_LEFT = "TOP_LEFT";
1867
- L.TOP_RIGHT = "TOP_RIGHT";
1868
- L.BOTTOM_RIGHT = "BOTTOM_RIGHT";
1869
- L.BOTTOM_LEFT = "BOTTOM_LEFT";
1870
- const mo = (e) => ({}), Et = (e) => ({ grab: (
1876
+ const qt = /* @__PURE__ */ new Map([
1877
+ [j.RECTANGLE, ho],
1878
+ [j.POLYGON, ao]
1879
+ ]), bt = (e) => qt.get(e.type), mo = (e, t) => qt.set(e, t), v = (e) => `HANDLE-${e}`;
1880
+ v.SHAPE = "SHAPE";
1881
+ v.TOP = "TOP";
1882
+ v.RIGHT = "RIGHT";
1883
+ v.BOTTOM = "BOTTOM";
1884
+ v.LEFT = "LEFT";
1885
+ v.TOP_LEFT = "TOP_LEFT";
1886
+ v.TOP_RIGHT = "TOP_RIGHT";
1887
+ v.BOTTOM_RIGHT = "BOTTOM_RIGHT";
1888
+ v.BOTTOM_LEFT = "BOTTOM_LEFT";
1889
+ const go = (e) => ({}), Et = (e) => ({ grab: (
1871
1890
  /*onGrab*/
1872
1891
  e[0]
1873
1892
  ) });
1874
- function go(e) {
1893
+ function po(e) {
1875
1894
  let t, n, o, i;
1876
1895
  const s = (
1877
1896
  /*#slots*/
1878
1897
  e[7].default
1879
- ), r = Qt(
1898
+ ), r = $t(
1880
1899
  s,
1881
1900
  e,
1882
1901
  /*$$scope*/
@@ -1885,17 +1904,17 @@ function go(e) {
1885
1904
  );
1886
1905
  return {
1887
1906
  c() {
1888
- t = I("g"), r && r.c(), u(t, "class", "a9s-annotation selected");
1907
+ t = D("g"), r && r.c(), u(t, "class", "a9s-annotation selected");
1889
1908
  },
1890
1909
  m(a, l) {
1891
- v(a, t, l), r && r.m(t, null), n = !0, o || (i = [
1892
- J(
1910
+ C(a, t, l), r && r.m(t, null), n = !0, o || (i = [
1911
+ K(
1893
1912
  t,
1894
1913
  "pointerup",
1895
1914
  /*onRelease*/
1896
1915
  e[2]
1897
1916
  ),
1898
- J(
1917
+ K(
1899
1918
  t,
1900
1919
  "pointermove",
1901
1920
  /*onPointerMove*/
@@ -1905,19 +1924,19 @@ function go(e) {
1905
1924
  },
1906
1925
  p(a, [l]) {
1907
1926
  r && r.p && (!n || l & /*$$scope*/
1908
- 64) && $t(
1927
+ 64) && tn(
1909
1928
  r,
1910
1929
  s,
1911
1930
  a,
1912
1931
  /*$$scope*/
1913
1932
  a[6],
1914
- n ? xt(
1933
+ n ? en(
1915
1934
  s,
1916
1935
  /*$$scope*/
1917
1936
  a[6],
1918
1937
  l,
1919
- mo
1920
- ) : en(
1938
+ go
1939
+ ) : nn(
1921
1940
  /*$$scope*/
1922
1941
  a[6]
1923
1942
  ),
@@ -1925,37 +1944,37 @@ function go(e) {
1925
1944
  );
1926
1945
  },
1927
1946
  i(a) {
1928
- n || (Y(r, a), n = !0);
1947
+ n || (X(r, a), n = !0);
1929
1948
  },
1930
1949
  o(a) {
1931
1950
  N(r, a), n = !1;
1932
1951
  },
1933
1952
  d(a) {
1934
- a && O(t), r && r.d(a), o = !1, ae(i);
1953
+ a && I(t), r && r.d(a), o = !1, ae(i);
1935
1954
  }
1936
1955
  };
1937
1956
  }
1938
- function po(e, t, n) {
1957
+ function _o(e, t, n) {
1939
1958
  let { $$slots: o = {}, $$scope: i } = t;
1940
1959
  const s = Se();
1941
- let { shape: r } = t, { editor: a } = t, { transform: l } = t, d = null, m, c = null;
1942
- const f = (g) => (w) => {
1943
- d = g, m = l.elementToImage(w.offsetX, w.offsetY), c = r, w.target.setPointerCapture(w.pointerId), s("grab");
1944
- }, h = (g) => {
1945
- if (d) {
1946
- const [w, T] = l.elementToImage(g.offsetX, g.offsetY), _ = [w - m[0], T - m[1]];
1947
- n(3, r = a(c, d, _)), s("change", r);
1948
- }
1949
- }, p = (g) => {
1950
- g.target.releasePointerCapture(g.pointerId), d = null, c = r, s("release");
1951
- };
1952
- return e.$$set = (g) => {
1953
- "shape" in g && n(3, r = g.shape), "editor" in g && n(4, a = g.editor), "transform" in g && n(5, l = g.transform), "$$scope" in g && n(6, i = g.$$scope);
1954
- }, [f, h, p, r, a, l, i, o];
1955
- }
1956
- class Wt extends ie {
1960
+ let { shape: r } = t, { editor: a } = t, { transform: l } = t, f = null, h, c = null;
1961
+ const d = (y) => (E) => {
1962
+ f = y, h = l.elementToImage(E.offsetX, E.offsetY), c = r, E.target.setPointerCapture(E.pointerId), s("grab");
1963
+ }, m = (y) => {
1964
+ if (f) {
1965
+ const [E, b] = l.elementToImage(y.offsetX, y.offsetY), _ = [E - h[0], b - h[1]];
1966
+ n(3, r = a(c, f, _)), s("change", r);
1967
+ }
1968
+ }, g = (y) => {
1969
+ y.target.releasePointerCapture(y.pointerId), f = null, c = r, s("release");
1970
+ };
1971
+ return e.$$set = (y) => {
1972
+ "shape" in y && n(3, r = y.shape), "editor" in y && n(4, a = y.editor), "transform" in y && n(5, l = y.transform), "$$scope" in y && n(6, i = y.$$scope);
1973
+ }, [d, m, g, r, a, l, i, o];
1974
+ }
1975
+ class Jt extends ie {
1957
1976
  constructor(t) {
1958
- super(), oe(this, t, po, go, $, { shape: 3, editor: 4, transform: 5 });
1977
+ super(), oe(this, t, _o, po, $, { shape: 3, editor: 4, transform: 5 });
1959
1978
  }
1960
1979
  }
1961
1980
  const ze = (e, t) => {
@@ -1966,35 +1985,35 @@ const ze = (e, t) => {
1966
1985
  return o && (s += `fill:${o};stroke:${o};`), s += `fill-opacity:${i || "0.25"};`, s;
1967
1986
  }
1968
1987
  };
1969
- function _o(e, t, n) {
1988
+ function yo(e, t, n) {
1970
1989
  let o;
1971
1990
  const i = Se();
1972
- let { annotation: s } = t, { editor: r } = t, { style: a = void 0 } = t, { target: l } = t, { transform: d } = t, { viewportScale: m } = t, c;
1973
- return Ce(() => (n(6, c = new r({
1991
+ let { annotation: s } = t, { editor: r } = t, { style: a = void 0 } = t, { target: l } = t, { transform: f } = t, { viewportScale: h } = t, c;
1992
+ return Ie(() => (n(6, c = new r({
1974
1993
  target: l,
1975
1994
  props: {
1976
1995
  shape: s.target.selector,
1977
1996
  computedStyle: o,
1978
- transform: d,
1979
- viewportScale: m
1997
+ transform: f,
1998
+ viewportScale: h
1980
1999
  }
1981
- })), c.$on("change", (f) => {
1982
- c.$$set({ shape: f.detail }), i("change", f.detail);
1983
- }), c.$on("grab", (f) => i("grab", f.detail)), c.$on("release", (f) => i("release", f.detail)), () => {
2000
+ })), c.$on("change", (d) => {
2001
+ c.$$set({ shape: d.detail }), i("change", d.detail);
2002
+ }), c.$on("grab", (d) => i("grab", d.detail)), c.$on("release", (d) => i("release", d.detail)), () => {
1984
2003
  c.$destroy();
1985
- })), e.$$set = (f) => {
1986
- "annotation" in f && n(0, s = f.annotation), "editor" in f && n(1, r = f.editor), "style" in f && n(2, a = f.style), "target" in f && n(3, l = f.target), "transform" in f && n(4, d = f.transform), "viewportScale" in f && n(5, m = f.viewportScale);
2004
+ })), e.$$set = (d) => {
2005
+ "annotation" in d && n(0, s = d.annotation), "editor" in d && n(1, r = d.editor), "style" in d && n(2, a = d.style), "target" in d && n(3, l = d.target), "transform" in d && n(4, f = d.transform), "viewportScale" in d && n(5, h = d.viewportScale);
1987
2006
  }, e.$$.update = () => {
1988
2007
  e.$$.dirty & /*annotation, style*/
1989
2008
  5 && (o = ze(s, a)), e.$$.dirty & /*annotation, editorComponent*/
1990
2009
  65 && s && (c == null || c.$set({ shape: s.target.selector })), e.$$.dirty & /*editorComponent, transform*/
1991
- 80 && c && c.$set({ transform: d }), e.$$.dirty & /*editorComponent, viewportScale*/
1992
- 96 && c && c.$set({ viewportScale: m });
1993
- }, [s, r, a, l, d, m, c];
2010
+ 80 && c && c.$set({ transform: f }), e.$$.dirty & /*editorComponent, viewportScale*/
2011
+ 96 && c && c.$set({ viewportScale: h });
2012
+ }, [s, r, a, l, f, h, c];
1994
2013
  }
1995
- class yo extends ie {
2014
+ class wo extends ie {
1996
2015
  constructor(t) {
1997
- super(), oe(this, t, _o, null, $, {
2016
+ super(), oe(this, t, yo, null, $, {
1998
2017
  annotation: 0,
1999
2018
  editor: 1,
2000
2019
  style: 2,
@@ -2004,35 +2023,35 @@ class yo extends ie {
2004
2023
  });
2005
2024
  }
2006
2025
  }
2007
- function wo(e, t, n) {
2026
+ function bo(e, t, n) {
2008
2027
  const o = Se();
2009
- let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: a } = t, { viewportScale: l } = t, d;
2010
- return Ce(() => {
2011
- const m = s.closest("svg"), c = [], f = (h, p, g) => {
2012
- m.addEventListener(h, p, g), c.push(() => m.removeEventListener(h, p, g));
2028
+ let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: a } = t, { viewportScale: l } = t, f;
2029
+ return Ie(() => {
2030
+ const h = s.closest("svg"), c = [], d = (m, g, y) => {
2031
+ h.addEventListener(m, g, y), c.push(() => h.removeEventListener(m, g, y));
2013
2032
  };
2014
- return n(5, d = new r({
2033
+ return n(5, f = new r({
2015
2034
  target: s,
2016
2035
  props: {
2017
- addEventListener: f,
2036
+ addEventListener: d,
2018
2037
  drawingMode: i,
2019
2038
  transform: a,
2020
2039
  viewportScale: l
2021
2040
  }
2022
- })), d.$on("create", (h) => o("create", h.detail)), () => {
2023
- c.forEach((h) => h()), d.$destroy();
2041
+ })), f.$on("create", (m) => o("create", m.detail)), () => {
2042
+ c.forEach((m) => m()), f.$destroy();
2024
2043
  };
2025
- }), e.$$set = (m) => {
2026
- "drawingMode" in m && n(0, i = m.drawingMode), "target" in m && n(1, s = m.target), "tool" in m && n(2, r = m.tool), "transform" in m && n(3, a = m.transform), "viewportScale" in m && n(4, l = m.viewportScale);
2044
+ }), e.$$set = (h) => {
2045
+ "drawingMode" in h && n(0, i = h.drawingMode), "target" in h && n(1, s = h.target), "tool" in h && n(2, r = h.tool), "transform" in h && n(3, a = h.transform), "viewportScale" in h && n(4, l = h.viewportScale);
2027
2046
  }, e.$$.update = () => {
2028
2047
  e.$$.dirty & /*toolComponent, transform*/
2029
- 40 && d && d.$set({ transform: a }), e.$$.dirty & /*toolComponent, viewportScale*/
2030
- 48 && d && d.$set({ viewportScale: l });
2031
- }, [i, s, r, a, l, d];
2048
+ 40 && f && f.$set({ transform: a }), e.$$.dirty & /*toolComponent, viewportScale*/
2049
+ 48 && f && f.$set({ viewportScale: l });
2050
+ }, [i, s, r, a, l, f];
2032
2051
  }
2033
- class bo extends ie {
2052
+ class Eo extends ie {
2034
2053
  constructor(t) {
2035
- super(), oe(this, t, wo, null, $, {
2054
+ super(), oe(this, t, bo, null, $, {
2036
2055
  drawingMode: 0,
2037
2056
  target: 1,
2038
2057
  tool: 2,
@@ -2045,7 +2064,7 @@ function At(e) {
2045
2064
  let t, n;
2046
2065
  return {
2047
2066
  c() {
2048
- t = I("rect"), n = I("rect"), u(t, "class", "a9s-outer"), u(
2067
+ t = D("rect"), n = D("rect"), u(t, "class", "a9s-outer"), u(
2049
2068
  t,
2050
2069
  "x",
2051
2070
  /*x*/
@@ -2088,7 +2107,7 @@ function At(e) {
2088
2107
  );
2089
2108
  },
2090
2109
  m(o, i) {
2091
- v(o, t, i), v(o, n, i);
2110
+ C(o, t, i), C(o, n, i);
2092
2111
  },
2093
2112
  p(o, i) {
2094
2113
  i & /*x*/
@@ -2142,78 +2161,78 @@ function At(e) {
2142
2161
  );
2143
2162
  },
2144
2163
  d(o) {
2145
- o && O(t), o && O(n);
2164
+ o && I(t), o && I(n);
2146
2165
  }
2147
2166
  };
2148
2167
  }
2149
- function Eo(e) {
2168
+ function Ao(e) {
2150
2169
  let t, n = (
2151
2170
  /*origin*/
2152
2171
  e[0] && At(e)
2153
2172
  );
2154
2173
  return {
2155
2174
  c() {
2156
- t = I("g"), n && n.c(), u(t, "class", "a9s-annotation a9s-rubberband");
2175
+ t = D("g"), n && n.c(), u(t, "class", "a9s-annotation a9s-rubberband");
2157
2176
  },
2158
2177
  m(o, i) {
2159
- v(o, t, i), n && n.m(t, null);
2178
+ C(o, t, i), n && n.m(t, null);
2160
2179
  },
2161
2180
  p(o, [i]) {
2162
2181
  /*origin*/
2163
2182
  o[0] ? n ? n.p(o, i) : (n = At(o), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2164
2183
  },
2165
- i: H,
2166
- o: H,
2184
+ i: F,
2185
+ o: F,
2167
2186
  d(o) {
2168
- o && O(t), n && n.d();
2187
+ o && I(t), n && n.d();
2169
2188
  }
2170
2189
  };
2171
2190
  }
2172
- function Ao(e, t, n) {
2191
+ function To(e, t, n) {
2173
2192
  const o = Se();
2174
- let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, a, l, d, m, c, f, h;
2175
- const p = (_) => {
2176
- a = performance.now(), s === "drag" && (n(0, l = r.elementToImage(_.offsetX, _.offsetY)), d = l, n(1, m = l[0]), n(2, c = l[1]), n(3, f = 1), n(4, h = 1));
2177
- }, g = (_) => {
2178
- l && (d = r.elementToImage(_.offsetX, _.offsetY), n(1, m = Math.min(d[0], l[0])), n(2, c = Math.min(d[1], l[1])), n(3, f = Math.abs(d[0] - l[0])), n(4, h = Math.abs(d[1] - l[1])));
2179
- }, w = (_) => {
2180
- const M = performance.now() - a;
2193
+ let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, a, l, f, h, c, d, m;
2194
+ const g = (_) => {
2195
+ a = performance.now(), s === "drag" && (n(0, l = r.elementToImage(_.offsetX, _.offsetY)), f = l, n(1, h = l[0]), n(2, c = l[1]), n(3, d = 1), n(4, m = 1));
2196
+ }, y = (_) => {
2197
+ l && (f = r.elementToImage(_.offsetX, _.offsetY), n(1, h = Math.min(f[0], l[0])), n(2, c = Math.min(f[1], l[1])), n(3, d = Math.abs(f[0] - l[0])), n(4, m = Math.abs(f[1] - l[1])));
2198
+ }, E = (_) => {
2199
+ const p = performance.now() - a;
2181
2200
  if (s === "click") {
2182
- if (M > 300)
2201
+ if (p > 300)
2183
2202
  return;
2184
- _.stopPropagation(), l ? T() : (n(0, l = r.elementToImage(_.offsetX, _.offsetY)), d = l, n(1, m = l[0]), n(2, c = l[1]), n(3, f = 1), n(4, h = 1));
2203
+ _.stopPropagation(), l ? b() : (n(0, l = r.elementToImage(_.offsetX, _.offsetY)), f = l, n(1, h = l[0]), n(2, c = l[1]), n(3, d = 1), n(4, m = 1));
2185
2204
  } else
2186
- l && (M > 300 || f * h > 100 ? (_.stopPropagation(), T()) : (n(0, l = null), d = null));
2187
- }, T = () => {
2188
- if (f * h > 15) {
2205
+ l && (p > 300 || d * m > 100 ? (_.stopPropagation(), b()) : (n(0, l = null), f = null));
2206
+ }, b = () => {
2207
+ if (d * m > 15) {
2189
2208
  const _ = {
2190
- type: V.RECTANGLE,
2209
+ type: j.RECTANGLE,
2191
2210
  geometry: {
2192
2211
  bounds: {
2193
- minX: m,
2212
+ minX: h,
2194
2213
  minY: c,
2195
- maxX: m + f,
2196
- maxY: c + h
2214
+ maxX: h + d,
2215
+ maxY: c + m
2197
2216
  },
2198
- x: m,
2217
+ x: h,
2199
2218
  y: c,
2200
- w: f,
2201
- h
2219
+ w: d,
2220
+ h: m
2202
2221
  }
2203
2222
  };
2204
2223
  o("create", _);
2205
2224
  }
2206
- n(0, l = null), d = null;
2225
+ n(0, l = null), f = null;
2207
2226
  };
2208
- return Ce(() => {
2209
- i("pointerdown", p), i("pointermove", g), i("pointerup", w, !0);
2227
+ return Ie(() => {
2228
+ i("pointerdown", g), i("pointermove", y), i("pointerup", E, !0);
2210
2229
  }), e.$$set = (_) => {
2211
2230
  "addEventListener" in _ && n(5, i = _.addEventListener), "drawingMode" in _ && n(6, s = _.drawingMode), "transform" in _ && n(7, r = _.transform);
2212
- }, [l, m, c, f, h, i, s, r];
2231
+ }, [l, h, c, d, m, i, s, r];
2213
2232
  }
2214
- class To extends ie {
2233
+ class So extends ie {
2215
2234
  constructor(t) {
2216
- super(), oe(this, t, Ao, Eo, $, {
2235
+ super(), oe(this, t, To, Ao, $, {
2217
2236
  addEventListener: 5,
2218
2237
  drawingMode: 6,
2219
2238
  transform: 7
@@ -2223,7 +2242,7 @@ class To extends ie {
2223
2242
  const Ke = (e, t) => {
2224
2243
  const n = Math.abs(t[0] - e[0]), o = Math.abs(t[1] - e[1]);
2225
2244
  return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
2226
- }, So = (e, t) => {
2245
+ }, Mo = (e, t) => {
2227
2246
  const { naturalWidth: n, naturalHeight: o } = e;
2228
2247
  if (!n && !o) {
2229
2248
  const { width: i, height: s } = e;
@@ -2233,20 +2252,20 @@ const Ke = (e, t) => {
2233
2252
  });
2234
2253
  } else
2235
2254
  t.setAttribute("viewBox", `0 0 ${n} ${o}`);
2236
- }, Mo = (e, t) => {
2237
- So(e, t);
2255
+ }, Lo = (e, t) => {
2256
+ Mo(e, t);
2238
2257
  const { subscribe: n, set: o } = Fe(1);
2239
2258
  let i;
2240
2259
  return window.ResizeObserver && (i = new ResizeObserver(() => {
2241
- const r = t.getBoundingClientRect(), { width: a, height: l } = t.viewBox.baseVal, d = Math.max(
2260
+ const r = t.getBoundingClientRect(), { width: a, height: l } = t.viewBox.baseVal, f = Math.max(
2242
2261
  r.width / a,
2243
2262
  r.height / l
2244
2263
  );
2245
- o(d);
2264
+ o(f);
2246
2265
  }), i.observe(t.parentElement)), { destroy: () => {
2247
2266
  i && i.disconnect();
2248
2267
  }, subscribe: n };
2249
- }, Ai = "ontouchstart" in window || navigator.maxTouchPoints > 0;
2268
+ }, Ti = "ontouchstart" in window || navigator.maxTouchPoints > 0;
2250
2269
  function Ze(e) {
2251
2270
  const t = e.slice(), n = (
2252
2271
  /*isClosable*/
@@ -2269,12 +2288,12 @@ function Tt(e) {
2269
2288
  );
2270
2289
  return {
2271
2290
  c() {
2272
- t = I("polygon"), o = I("polygon"), r && r.c(), s = ce(), u(t, "class", "a9s-outer"), u(t, "points", n = /*coords*/
2291
+ t = D("polygon"), o = D("polygon"), r && r.c(), s = ce(), u(t, "class", "a9s-outer"), u(t, "points", n = /*coords*/
2273
2292
  e[15]), u(o, "class", "a9s-inner"), u(o, "points", i = /*coords*/
2274
2293
  e[15]);
2275
2294
  },
2276
2295
  m(a, l) {
2277
- v(a, t, l), v(a, o, l), r && r.m(a, l), v(a, s, l);
2296
+ C(a, t, l), C(a, o, l), r && r.m(a, l), C(a, s, l);
2278
2297
  },
2279
2298
  p(a, l) {
2280
2299
  l & /*isClosable, points, cursor*/
@@ -2285,7 +2304,7 @@ function Tt(e) {
2285
2304
  a[2] ? r ? r.p(a, l) : (r = St(a), r.c(), r.m(s.parentNode, s)) : r && (r.d(1), r = null);
2286
2305
  },
2287
2306
  d(a) {
2288
- a && O(t), a && O(o), r && r.d(a), a && O(s);
2307
+ a && I(t), a && I(o), r && r.d(a), a && I(s);
2289
2308
  }
2290
2309
  };
2291
2310
  }
@@ -2293,7 +2312,7 @@ function St(e) {
2293
2312
  let t, n, o;
2294
2313
  return {
2295
2314
  c() {
2296
- t = I("rect"), u(t, "class", "a9s-corner-handle"), u(t, "x", n = /*points*/
2315
+ t = D("rect"), u(t, "class", "a9s-corner-handle"), u(t, "x", n = /*points*/
2297
2316
  e[0][0][0] - /*handleSize*/
2298
2317
  e[3] / 2), u(t, "y", o = /*points*/
2299
2318
  e[0][0][1] - /*handleSize*/
@@ -2310,7 +2329,7 @@ function St(e) {
2310
2329
  );
2311
2330
  },
2312
2331
  m(i, s) {
2313
- v(i, t, s);
2332
+ C(i, t, s);
2314
2333
  },
2315
2334
  p(i, s) {
2316
2335
  s & /*points, handleSize*/
@@ -2334,94 +2353,95 @@ function St(e) {
2334
2353
  );
2335
2354
  },
2336
2355
  d(i) {
2337
- i && O(t);
2356
+ i && I(t);
2338
2357
  }
2339
2358
  };
2340
2359
  }
2341
- function Lo(e) {
2360
+ function Oo(e) {
2342
2361
  let t, n = (
2343
2362
  /*cursor*/
2344
2363
  e[1] && Tt(Ze(e))
2345
2364
  );
2346
2365
  return {
2347
2366
  c() {
2348
- t = I("g"), n && n.c(), u(t, "class", "a9s-annotation a9s-rubberband");
2367
+ t = D("g"), n && n.c(), u(t, "class", "a9s-annotation a9s-rubberband");
2349
2368
  },
2350
2369
  m(o, i) {
2351
- v(o, t, i), n && n.m(t, null);
2370
+ C(o, t, i), n && n.m(t, null);
2352
2371
  },
2353
2372
  p(o, [i]) {
2354
2373
  /*cursor*/
2355
2374
  o[1] ? n ? n.p(Ze(o), i) : (n = Tt(Ze(o)), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2356
2375
  },
2357
- i: H,
2358
- o: H,
2376
+ i: F,
2377
+ o: F,
2359
2378
  d(o) {
2360
- o && O(t), n && n.d();
2379
+ o && I(t), n && n.d();
2361
2380
  }
2362
2381
  };
2363
2382
  }
2364
- const Oo = 20;
2365
- function vo(e, t, n) {
2383
+ const vo = 20;
2384
+ function ko(e, t, n) {
2366
2385
  let o;
2367
2386
  const i = Se();
2368
- let { addEventListener: s } = t, { drawingMode: r } = t, { transform: a } = t, { viewportScale: l = 1 } = t, d, m = [], c = null, f = !1;
2369
- const h = (_) => {
2370
- if (d = { ..._ }, r === "drag" && m.length === 0) {
2371
- const M = a.elementToImage(_.offsetX, _.offsetY);
2372
- m.push(M), n(1, c = M);
2373
- }
2374
- }, p = (_) => {
2375
- if (m.length > 0 && (n(1, c = a.elementToImage(_.offsetX, _.offsetY)), m.length > 2)) {
2376
- const M = Ke(c, m[0]) * l;
2377
- n(2, f = M < Oo);
2387
+ let { addEventListener: s } = t, { drawingMode: r } = t, { transform: a } = t, { viewportScale: l = 1 } = t, f, h = [], c = null, d = !1;
2388
+ const m = (_) => {
2389
+ const { timeStamp: p, offsetX: L, offsetY: S } = _;
2390
+ if (f = { timeStamp: p, offsetX: L, offsetY: S }, r === "drag" && h.length === 0) {
2391
+ const B = a.elementToImage(_.offsetX, _.offsetY);
2392
+ h.push(B), n(1, c = B);
2378
2393
  }
2379
2394
  }, g = (_) => {
2395
+ if (h.length > 0 && (n(1, c = a.elementToImage(_.offsetX, _.offsetY)), h.length > 2)) {
2396
+ const p = Ke(c, h[0]) * l;
2397
+ n(2, d = p < vo);
2398
+ }
2399
+ }, y = (_) => {
2380
2400
  if (r === "click") {
2381
- const M = _.timeStamp - d.timeStamp, X = Ke([d.offsetX, d.offsetY], [_.offsetX, _.offsetY]);
2382
- if (M > 300 || X > 15)
2401
+ const p = _.timeStamp - f.timeStamp, L = Ke([f.offsetX, f.offsetY], [_.offsetX, _.offsetY]);
2402
+ if (p > 300 || L > 15)
2383
2403
  return;
2384
- if (f)
2385
- T();
2386
- else if (m.length === 0) {
2387
- const R = a.elementToImage(_.offsetX, _.offsetY);
2388
- m.push(R), n(1, c = R);
2404
+ if (d)
2405
+ b();
2406
+ else if (h.length === 0) {
2407
+ const S = a.elementToImage(_.offsetX, _.offsetY);
2408
+ h.push(S), n(1, c = S);
2389
2409
  } else
2390
- m.push(c);
2410
+ h.push(c);
2391
2411
  } else {
2392
- if (m.length === 1 && Ke(m[0], c) <= 4) {
2393
- n(0, m = []), n(1, c = null);
2412
+ if (h.length === 1 && Ke(h[0], c) <= 4) {
2413
+ n(0, h = []), n(1, c = null);
2394
2414
  return;
2395
2415
  }
2396
- _.stopImmediatePropagation(), f ? T() : m.push(c);
2416
+ _.stopImmediatePropagation(), d ? b() : h.push(c);
2397
2417
  }
2398
- }, w = () => {
2399
- const _ = [...m, c], M = {
2400
- type: V.POLYGON,
2418
+ }, E = () => {
2419
+ const _ = [...h, c], p = {
2420
+ type: j.POLYGON,
2401
2421
  geometry: { bounds: He(_), points: _ }
2402
2422
  };
2403
- nt(M) > 4 && (n(0, m = []), n(1, c = null), i("create", M));
2404
- }, T = () => {
2423
+ nt(p) > 4 && (n(0, h = []), n(1, c = null), i("create", p));
2424
+ }, b = () => {
2405
2425
  const _ = {
2406
- type: V.POLYGON,
2426
+ type: j.POLYGON,
2407
2427
  geometry: {
2408
- bounds: He(m),
2409
- points: [...m]
2428
+ bounds: He(h),
2429
+ points: [...h]
2410
2430
  }
2411
2431
  };
2412
- n(0, m = []), n(1, c = null), i("create", _);
2432
+ n(0, h = []), n(1, c = null), i("create", _);
2413
2433
  };
2414
- return Ce(() => {
2415
- s("pointerdown", h, !0), s("pointermove", p), s("pointerup", g, !0), s("dblclick", w, !0);
2434
+ return Ie(() => {
2435
+ s("pointerdown", m, !0), s("pointermove", g), s("pointerup", y, !0), s("dblclick", E, !0);
2416
2436
  }), e.$$set = (_) => {
2417
2437
  "addEventListener" in _ && n(4, s = _.addEventListener), "drawingMode" in _ && n(5, r = _.drawingMode), "transform" in _ && n(6, a = _.transform), "viewportScale" in _ && n(7, l = _.viewportScale);
2418
2438
  }, e.$$.update = () => {
2419
2439
  e.$$.dirty & /*viewportScale*/
2420
2440
  128 && n(3, o = 10 / l);
2421
2441
  }, [
2422
- m,
2442
+ h,
2423
2443
  c,
2424
- f,
2444
+ d,
2425
2445
  o,
2426
2446
  s,
2427
2447
  r,
@@ -2429,9 +2449,9 @@ function vo(e, t, n) {
2429
2449
  l
2430
2450
  ];
2431
2451
  }
2432
- class ko extends ie {
2452
+ class Bo extends ie {
2433
2453
  constructor(t) {
2434
- super(), oe(this, t, vo, Lo, $, {
2454
+ super(), oe(this, t, ko, Oo, $, {
2435
2455
  addEventListener: 4,
2436
2456
  drawingMode: 5,
2437
2457
  transform: 6,
@@ -2440,14 +2460,14 @@ class ko extends ie {
2440
2460
  }
2441
2461
  }
2442
2462
  const lt = /* @__PURE__ */ new Map([
2443
- ["rectangle", { tool: To }],
2444
- ["polygon", { tool: ko }]
2445
- ]), Bo = () => [...lt.keys()], qt = (e) => lt.get(e), Co = (e, t, n) => lt.set(e, { tool: t, opts: n });
2446
- function Io(e) {
2463
+ ["rectangle", { tool: So }],
2464
+ ["polygon", { tool: Bo }]
2465
+ ]), Io = () => [...lt.keys()], Kt = (e) => lt.get(e), Co = (e, t, n) => lt.set(e, { tool: t, opts: n });
2466
+ function Po(e) {
2447
2467
  let t, n, o, i, s;
2448
2468
  return {
2449
2469
  c() {
2450
- t = I("g"), n = I("ellipse"), i = I("ellipse"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2470
+ t = D("g"), n = D("ellipse"), i = D("ellipse"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2451
2471
  e[1] ? "display:none;" : void 0), u(
2452
2472
  n,
2453
2473
  "cx",
@@ -2497,7 +2517,7 @@ function Io(e) {
2497
2517
  e[0].id);
2498
2518
  },
2499
2519
  m(r, a) {
2500
- v(r, t, a), fe(t, n), fe(t, i);
2520
+ C(r, t, a), fe(t, n), fe(t, i);
2501
2521
  },
2502
2522
  p(r, [a]) {
2503
2523
  a & /*computedStyle*/
@@ -2512,38 +2532,38 @@ function Io(e) {
2512
2532
  1 && s !== (s = /*annotation*/
2513
2533
  r[0].id) && u(t, "data-id", s);
2514
2534
  },
2515
- i: H,
2516
- o: H,
2535
+ i: F,
2536
+ o: F,
2517
2537
  d(r) {
2518
- r && O(t);
2538
+ r && I(t);
2519
2539
  }
2520
2540
  };
2521
2541
  }
2522
- function Po(e, t, n) {
2542
+ function Yo(e, t, n) {
2523
2543
  let o, { annotation: i } = t, { geom: s } = t, { style: r = void 0 } = t;
2524
- const { cx: a, cy: l, rx: d, ry: m } = s;
2544
+ const { cx: a, cy: l, rx: f, ry: h } = s;
2525
2545
  return e.$$set = (c) => {
2526
2546
  "annotation" in c && n(0, i = c.annotation), "geom" in c && n(6, s = c.geom), "style" in c && n(7, r = c.style);
2527
2547
  }, e.$$.update = () => {
2528
2548
  e.$$.dirty & /*annotation, style*/
2529
2549
  129 && n(1, o = ze(i, r));
2530
- }, [i, o, a, l, d, m, s, r];
2550
+ }, [i, o, a, l, f, h, s, r];
2531
2551
  }
2532
- class Yo extends ie {
2552
+ class Ro extends ie {
2533
2553
  constructor(t) {
2534
- super(), oe(this, t, Po, Io, $, { annotation: 0, geom: 6, style: 7 });
2554
+ super(), oe(this, t, Yo, Po, $, { annotation: 0, geom: 6, style: 7 });
2535
2555
  }
2536
2556
  }
2537
- function Ro(e) {
2557
+ function Do(e) {
2538
2558
  let t, n, o, i, s;
2539
2559
  return {
2540
2560
  c() {
2541
- t = I("g"), n = I("polygon"), i = I("polygon"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2561
+ t = D("g"), n = D("polygon"), i = D("polygon"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2542
2562
  e[1] ? "display:none;" : void 0), u(
2543
2563
  n,
2544
2564
  "points",
2545
2565
  /*points*/
2546
- e[2].map(Do).join(" ")
2566
+ e[2].map(Xo).join(" ")
2547
2567
  ), u(i, "class", "a9s-inner"), u(
2548
2568
  i,
2549
2569
  "style",
@@ -2553,12 +2573,12 @@ function Ro(e) {
2553
2573
  i,
2554
2574
  "points",
2555
2575
  /*points*/
2556
- e[2].map(Xo).join(" ")
2576
+ e[2].map(Uo).join(" ")
2557
2577
  ), u(t, "data-id", s = /*annotation*/
2558
2578
  e[0].id);
2559
2579
  },
2560
2580
  m(r, a) {
2561
- v(r, t, a), fe(t, n), fe(t, i);
2581
+ C(r, t, a), fe(t, n), fe(t, i);
2562
2582
  },
2563
2583
  p(r, [a]) {
2564
2584
  a & /*computedStyle*/
@@ -2573,15 +2593,15 @@ function Ro(e) {
2573
2593
  1 && s !== (s = /*annotation*/
2574
2594
  r[0].id) && u(t, "data-id", s);
2575
2595
  },
2576
- i: H,
2577
- o: H,
2596
+ i: F,
2597
+ o: F,
2578
2598
  d(r) {
2579
- r && O(t);
2599
+ r && I(t);
2580
2600
  }
2581
2601
  };
2582
2602
  }
2583
- const Do = (e) => e.join(","), Xo = (e) => e.join(",");
2584
- function Uo(e, t, n) {
2603
+ const Xo = (e) => e.join(","), Uo = (e) => e.join(",");
2604
+ function No(e, t, n) {
2585
2605
  let o, { annotation: i } = t, { geom: s } = t, { style: r = void 0 } = t;
2586
2606
  const { points: a } = s;
2587
2607
  return e.$$set = (l) => {
@@ -2591,16 +2611,16 @@ function Uo(e, t, n) {
2591
2611
  17 && n(1, o = ze(i, r));
2592
2612
  }, [i, o, a, s, r];
2593
2613
  }
2594
- class No extends ie {
2614
+ class Go extends ie {
2595
2615
  constructor(t) {
2596
- super(), oe(this, t, Uo, Ro, $, { annotation: 0, geom: 3, style: 4 });
2616
+ super(), oe(this, t, No, Do, $, { annotation: 0, geom: 3, style: 4 });
2597
2617
  }
2598
2618
  }
2599
- function Go(e) {
2619
+ function Ho(e) {
2600
2620
  let t, n, o, i, s;
2601
2621
  return {
2602
2622
  c() {
2603
- t = I("g"), n = I("rect"), i = I("rect"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2623
+ t = D("g"), n = D("rect"), i = D("rect"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2604
2624
  e[5] ? "display:none;" : void 0), u(
2605
2625
  n,
2606
2626
  "x",
@@ -2650,7 +2670,7 @@ function Go(e) {
2650
2670
  e[0].id);
2651
2671
  },
2652
2672
  m(r, a) {
2653
- v(r, t, a), fe(t, n), fe(t, i);
2673
+ C(r, t, a), fe(t, n), fe(t, i);
2654
2674
  },
2655
2675
  p(r, [a]) {
2656
2676
  a & /*computedStyle*/
@@ -2713,47 +2733,47 @@ function Go(e) {
2713
2733
  1 && s !== (s = /*annotation*/
2714
2734
  r[0].id) && u(t, "data-id", s);
2715
2735
  },
2716
- i: H,
2717
- o: H,
2736
+ i: F,
2737
+ o: F,
2718
2738
  d(r) {
2719
- r && O(t);
2739
+ r && I(t);
2720
2740
  }
2721
2741
  };
2722
2742
  }
2723
- function Ho(e, t, n) {
2724
- let o, i, s, r, a, { annotation: l } = t, { geom: d } = t, { style: m = void 0 } = t;
2743
+ function Fo(e, t, n) {
2744
+ let o, i, s, r, a, { annotation: l } = t, { geom: f } = t, { style: h = void 0 } = t;
2725
2745
  return e.$$set = (c) => {
2726
- "annotation" in c && n(0, l = c.annotation), "geom" in c && n(6, d = c.geom), "style" in c && n(7, m = c.style);
2746
+ "annotation" in c && n(0, l = c.annotation), "geom" in c && n(6, f = c.geom), "style" in c && n(7, h = c.style);
2727
2747
  }, e.$$.update = () => {
2728
2748
  e.$$.dirty & /*annotation, style*/
2729
- 129 && n(5, o = ze(l, m)), e.$$.dirty & /*geom*/
2730
- 64 && n(4, { x: i, y: s, w: r, h: a } = d, i, (n(3, s), n(6, d)), (n(2, r), n(6, d)), (n(1, a), n(6, d)));
2731
- }, [l, a, r, s, i, o, d, m];
2749
+ 129 && n(5, o = ze(l, h)), e.$$.dirty & /*geom*/
2750
+ 64 && n(4, { x: i, y: s, w: r, h: a } = f, i, (n(3, s), n(6, f)), (n(2, r), n(6, f)), (n(1, a), n(6, f)));
2751
+ }, [l, a, r, s, i, o, f, h];
2732
2752
  }
2733
- class Fo extends ie {
2753
+ class zo extends ie {
2734
2754
  constructor(t) {
2735
- super(), oe(this, t, Ho, Go, $, { annotation: 0, geom: 6, style: 7 });
2755
+ super(), oe(this, t, Fo, Ho, $, { annotation: 0, geom: 6, style: 7 });
2736
2756
  }
2737
2757
  }
2738
- const Ti = {
2758
+ const Si = {
2739
2759
  elementToImage: (e, t) => [e, t]
2740
- }, zo = (e) => ({
2760
+ }, Vo = (e) => ({
2741
2761
  elementToImage: (t, n) => {
2742
2762
  const o = e.getBoundingClientRect(), i = e.createSVGPoint();
2743
2763
  i.x = t + o.x, i.y = n + o.y;
2744
2764
  const { x: s, y: r } = i.matrixTransform(e.getScreenCTM().inverse());
2745
2765
  return [s, r];
2746
2766
  }
2747
- }), Vo = 250, jo = (e, t) => {
2767
+ }), jo = 250, Wo = (e, t) => {
2748
2768
  const n = Se();
2749
2769
  let o;
2750
2770
  return { onPointerDown: () => o = performance.now(), onPointerUp: (r) => {
2751
- if (performance.now() - o < Vo) {
2752
- const { x: l, y: d } = Wo(r, e), m = t.getAt(l, d);
2753
- m ? n("click", { originalEvent: r, annotation: m }) : n("click", { originalEvent: r });
2771
+ if (performance.now() - o < jo) {
2772
+ const { x: l, y: f } = qo(r, e), h = t.getAt(l, f);
2773
+ h ? n("click", { originalEvent: r, annotation: h }) : n("click", { originalEvent: r });
2754
2774
  }
2755
2775
  } };
2756
- }, Wo = (e, t) => {
2776
+ }, qo = (e, t) => {
2757
2777
  const n = t.createSVGPoint(), o = t.getBoundingClientRect(), i = e.clientX - o.x, s = e.clientY - o.y, { left: r, top: a } = t.getBoundingClientRect();
2758
2778
  return n.x = i + r, n.y = s + a, n.matrixTransform(t.getScreenCTM().inverse());
2759
2779
  };
@@ -2782,27 +2802,27 @@ function Ot(e) {
2782
2802
  i.c(), n = ce();
2783
2803
  },
2784
2804
  m(s, r) {
2785
- i.m(s, r), v(s, n, r), o = !0;
2805
+ i.m(s, r), C(s, n, r), o = !0;
2786
2806
  },
2787
2807
  p(s, r) {
2788
2808
  r[0] & /*$store*/
2789
2809
  4096 && $(t, t = /*annotation*/
2790
- s[31].id) ? (re(), N(i, 1, 1, H), le(), i = vt(s), i.c(), Y(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
2810
+ s[31].id) ? (re(), N(i, 1, 1, F), le(), i = vt(s), i.c(), X(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
2791
2811
  },
2792
2812
  i(s) {
2793
- o || (Y(i), o = !0);
2813
+ o || (X(i), o = !0);
2794
2814
  },
2795
2815
  o(s) {
2796
2816
  N(i), o = !1;
2797
2817
  },
2798
2818
  d(s) {
2799
- s && O(n), i.d(s);
2819
+ s && I(n), i.d(s);
2800
2820
  }
2801
2821
  };
2802
2822
  }
2803
- function qo(e) {
2823
+ function Jo(e) {
2804
2824
  let t, n;
2805
- return t = new No({
2825
+ return t = new Go({
2806
2826
  props: {
2807
2827
  annotation: (
2808
2828
  /*annotation*/
@@ -2835,7 +2855,7 @@ function qo(e) {
2835
2855
  o[1]), t.$set(s);
2836
2856
  },
2837
2857
  i(o) {
2838
- n || (Y(t.$$.fragment, o), n = !0);
2858
+ n || (X(t.$$.fragment, o), n = !0);
2839
2859
  },
2840
2860
  o(o) {
2841
2861
  N(t.$$.fragment, o), n = !1;
@@ -2845,9 +2865,9 @@ function qo(e) {
2845
2865
  }
2846
2866
  };
2847
2867
  }
2848
- function Jo(e) {
2868
+ function Ko(e) {
2849
2869
  let t, n;
2850
- return t = new Fo({
2870
+ return t = new zo({
2851
2871
  props: {
2852
2872
  annotation: (
2853
2873
  /*annotation*/
@@ -2880,7 +2900,7 @@ function Jo(e) {
2880
2900
  o[1]), t.$set(s);
2881
2901
  },
2882
2902
  i(o) {
2883
- n || (Y(t.$$.fragment, o), n = !0);
2903
+ n || (X(t.$$.fragment, o), n = !0);
2884
2904
  },
2885
2905
  o(o) {
2886
2906
  N(t.$$.fragment, o), n = !1;
@@ -2890,9 +2910,9 @@ function Jo(e) {
2890
2910
  }
2891
2911
  };
2892
2912
  }
2893
- function Ko(e) {
2913
+ function Zo(e) {
2894
2914
  let t, n;
2895
- return t = new Yo({
2915
+ return t = new Ro({
2896
2916
  props: {
2897
2917
  annotation: (
2898
2918
  /*annotation*/
@@ -2925,7 +2945,7 @@ function Ko(e) {
2925
2945
  o[1]), t.$set(s);
2926
2946
  },
2927
2947
  i(o) {
2928
- n || (Y(t.$$.fragment, o), n = !0);
2948
+ n || (X(t.$$.fragment, o), n = !0);
2929
2949
  },
2930
2950
  o(o) {
2931
2951
  N(t.$$.fragment, o), n = !1;
@@ -2937,15 +2957,15 @@ function Ko(e) {
2937
2957
  }
2938
2958
  function vt(e) {
2939
2959
  let t, n, o, i;
2940
- const s = [Ko, Jo, qo], r = [];
2941
- function a(l, d) {
2960
+ const s = [Zo, Ko, Jo], r = [];
2961
+ function a(l, f) {
2942
2962
  return (
2943
2963
  /*selector*/
2944
- l[34].type === V.ELLIPSE ? 0 : (
2964
+ l[34].type === j.ELLIPSE ? 0 : (
2945
2965
  /*selector*/
2946
- l[34].type === V.RECTANGLE ? 1 : (
2966
+ l[34].type === j.RECTANGLE ? 1 : (
2947
2967
  /*selector*/
2948
- l[34].type === V.POLYGON ? 2 : -1
2968
+ l[34].type === j.POLYGON ? 2 : -1
2949
2969
  )
2950
2970
  )
2951
2971
  );
@@ -2954,23 +2974,23 @@ function vt(e) {
2954
2974
  c() {
2955
2975
  n && n.c(), o = ce();
2956
2976
  },
2957
- m(l, d) {
2958
- ~t && r[t].m(l, d), v(l, o, d), i = !0;
2977
+ m(l, f) {
2978
+ ~t && r[t].m(l, f), C(l, o, f), i = !0;
2959
2979
  },
2960
- p(l, d) {
2961
- let m = t;
2962
- t = a(l), t === m ? ~t && r[t].p(l, d) : (n && (re(), N(r[m], 1, 1, () => {
2963
- r[m] = null;
2964
- }), le()), ~t ? (n = r[t], n ? n.p(l, d) : (n = r[t] = s[t](l), n.c()), Y(n, 1), n.m(o.parentNode, o)) : n = null);
2980
+ p(l, f) {
2981
+ let h = t;
2982
+ t = a(l), t === h ? ~t && r[t].p(l, f) : (n && (re(), N(r[h], 1, 1, () => {
2983
+ r[h] = null;
2984
+ }), le()), ~t ? (n = r[t], n ? n.p(l, f) : (n = r[t] = s[t](l), n.c()), X(n, 1), n.m(o.parentNode, o)) : n = null);
2965
2985
  },
2966
2986
  i(l) {
2967
- i || (Y(n), i = !0);
2987
+ i || (X(n), i = !0);
2968
2988
  },
2969
2989
  o(l) {
2970
2990
  N(n), i = !1;
2971
2991
  },
2972
2992
  d(l) {
2973
- ~t && r[t].d(l), l && O(o);
2993
+ ~t && r[t].d(l), l && I(o);
2974
2994
  }
2975
2995
  };
2976
2996
  }
@@ -2985,7 +3005,7 @@ function kt(e) {
2985
3005
  i && i.c(), n = ce();
2986
3006
  },
2987
3007
  m(s, r) {
2988
- i && i.m(s, r), v(s, n, r), o = !0;
3008
+ i && i.m(s, r), C(s, n, r), o = !0;
2989
3009
  },
2990
3010
  p(s, r) {
2991
3011
  r[0] & /*isEditable, $store*/
@@ -2994,25 +3014,25 @@ function kt(e) {
2994
3014
  /*annotation*/
2995
3015
  s[31]
2996
3016
  )), t ? i ? (i.p(Qe(s), r), r[0] & /*isEditable, $store*/
2997
- 4224 && Y(i, 1)) : (i = Ot(Qe(s)), i.c(), Y(i, 1), i.m(n.parentNode, n)) : i && (re(), N(i, 1, 1, () => {
3017
+ 4224 && X(i, 1)) : (i = Ot(Qe(s)), i.c(), X(i, 1), i.m(n.parentNode, n)) : i && (re(), N(i, 1, 1, () => {
2998
3018
  i = null;
2999
3019
  }), le());
3000
3020
  },
3001
3021
  i(s) {
3002
- o || (Y(i), o = !0);
3022
+ o || (X(i), o = !0);
3003
3023
  },
3004
3024
  o(s) {
3005
3025
  N(i), o = !1;
3006
3026
  },
3007
3027
  d(s) {
3008
- i && i.d(s), s && O(n);
3028
+ i && i.d(s), s && I(n);
3009
3029
  }
3010
3030
  };
3011
3031
  }
3012
3032
  function Bt(e) {
3013
3033
  let t, n, o, i;
3014
- const s = [Qo, Zo], r = [];
3015
- function a(l, d) {
3034
+ const s = [xo, Qo], r = [];
3035
+ function a(l, f) {
3016
3036
  return (
3017
3037
  /*editableAnnotations*/
3018
3038
  l[6] ? 0 : (
@@ -3026,55 +3046,55 @@ function Bt(e) {
3026
3046
  c() {
3027
3047
  n && n.c(), o = ce();
3028
3048
  },
3029
- m(l, d) {
3030
- ~t && r[t].m(l, d), v(l, o, d), i = !0;
3049
+ m(l, f) {
3050
+ ~t && r[t].m(l, f), C(l, o, f), i = !0;
3031
3051
  },
3032
- p(l, d) {
3033
- let m = t;
3034
- t = a(l), t === m ? ~t && r[t].p(l, d) : (n && (re(), N(r[m], 1, 1, () => {
3035
- r[m] = null;
3036
- }), le()), ~t ? (n = r[t], n ? n.p(l, d) : (n = r[t] = s[t](l), n.c()), Y(n, 1), n.m(o.parentNode, o)) : n = null);
3052
+ p(l, f) {
3053
+ let h = t;
3054
+ t = a(l), t === h ? ~t && r[t].p(l, f) : (n && (re(), N(r[h], 1, 1, () => {
3055
+ r[h] = null;
3056
+ }), le()), ~t ? (n = r[t], n ? n.p(l, f) : (n = r[t] = s[t](l), n.c()), X(n, 1), n.m(o.parentNode, o)) : n = null);
3037
3057
  },
3038
3058
  i(l) {
3039
- i || (Y(n), i = !0);
3059
+ i || (X(n), i = !0);
3040
3060
  },
3041
3061
  o(l) {
3042
3062
  N(n), i = !1;
3043
3063
  },
3044
3064
  d(l) {
3045
- ~t && r[t].d(l), l && O(o);
3065
+ ~t && r[t].d(l), l && I(o);
3046
3066
  }
3047
3067
  };
3048
3068
  }
3049
- function Zo(e) {
3069
+ function Qo(e) {
3050
3070
  let t = (
3051
3071
  /*tool*/
3052
3072
  e[2]
3053
- ), n, o, i = Ct(e);
3073
+ ), n, o, i = It(e);
3054
3074
  return {
3055
3075
  c() {
3056
3076
  i.c(), n = ce();
3057
3077
  },
3058
3078
  m(s, r) {
3059
- i.m(s, r), v(s, n, r), o = !0;
3079
+ i.m(s, r), C(s, n, r), o = !0;
3060
3080
  },
3061
3081
  p(s, r) {
3062
3082
  r[0] & /*tool*/
3063
3083
  4 && $(t, t = /*tool*/
3064
- s[2]) ? (re(), N(i, 1, 1, H), le(), i = Ct(s), i.c(), Y(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3084
+ s[2]) ? (re(), N(i, 1, 1, F), le(), i = It(s), i.c(), X(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3065
3085
  },
3066
3086
  i(s) {
3067
- o || (Y(i), o = !0);
3087
+ o || (X(i), o = !0);
3068
3088
  },
3069
3089
  o(s) {
3070
3090
  N(i), o = !1;
3071
3091
  },
3072
3092
  d(s) {
3073
- s && O(n), i.d(s);
3093
+ s && I(n), i.d(s);
3074
3094
  }
3075
3095
  };
3076
3096
  }
3077
- function Qo(e) {
3097
+ function xo(e) {
3078
3098
  let t, n, o = (
3079
3099
  /*editableAnnotations*/
3080
3100
  e[6]
@@ -3093,7 +3113,7 @@ function Qo(e) {
3093
3113
  m(r, a) {
3094
3114
  for (let l = 0; l < i.length; l += 1)
3095
3115
  i[l] && i[l].m(r, a);
3096
- v(r, t, a), n = !0;
3116
+ C(r, t, a), n = !0;
3097
3117
  },
3098
3118
  p(r, a) {
3099
3119
  if (a[0] & /*editableAnnotations, drawingEl, style, transform, $scale, onChangeSelected*/
@@ -3102,8 +3122,8 @@ function Qo(e) {
3102
3122
  r[6];
3103
3123
  let l;
3104
3124
  for (l = 0; l < o.length; l += 1) {
3105
- const d = Mt(r, o, l);
3106
- i[l] ? (i[l].p(d, a), Y(i[l], 1)) : (i[l] = Pt(d), i[l].c(), Y(i[l], 1), i[l].m(t.parentNode, t));
3125
+ const f = Mt(r, o, l);
3126
+ i[l] ? (i[l].p(f, a), X(i[l], 1)) : (i[l] = Pt(f), i[l].c(), X(i[l], 1), i[l].m(t.parentNode, t));
3107
3127
  }
3108
3128
  for (re(), l = o.length; l < i.length; l += 1)
3109
3129
  s(l);
@@ -3113,7 +3133,7 @@ function Qo(e) {
3113
3133
  i(r) {
3114
3134
  if (!n) {
3115
3135
  for (let a = 0; a < o.length; a += 1)
3116
- Y(i[a]);
3136
+ X(i[a]);
3117
3137
  n = !0;
3118
3138
  }
3119
3139
  },
@@ -3124,13 +3144,13 @@ function Qo(e) {
3124
3144
  n = !1;
3125
3145
  },
3126
3146
  d(r) {
3127
- ot(i, r), r && O(t);
3147
+ ot(i, r), r && I(t);
3128
3148
  }
3129
3149
  };
3130
3150
  }
3131
- function Ct(e) {
3151
+ function It(e) {
3132
3152
  let t, n;
3133
- return t = new bo({
3153
+ return t = new Eo({
3134
3154
  props: {
3135
3155
  target: (
3136
3156
  /*drawingEl*/
@@ -3179,7 +3199,7 @@ function Ct(e) {
3179
3199
  o[13]), t.$set(s);
3180
3200
  },
3181
3201
  i(o) {
3182
- n || (Y(t.$$.fragment, o), n = !0);
3202
+ n || (X(t.$$.fragment, o), n = !0);
3183
3203
  },
3184
3204
  o(o) {
3185
3205
  N(t.$$.fragment, o), n = !1;
@@ -3189,9 +3209,9 @@ function Ct(e) {
3189
3209
  }
3190
3210
  };
3191
3211
  }
3192
- function It(e) {
3212
+ function Ct(e) {
3193
3213
  let t, n;
3194
- return t = new yo({
3214
+ return t = new wo({
3195
3215
  props: {
3196
3216
  target: (
3197
3217
  /*drawingEl*/
@@ -3219,7 +3239,7 @@ function It(e) {
3219
3239
  )
3220
3240
  }
3221
3241
  }), t.$on("change", function() {
3222
- j(
3242
+ W(
3223
3243
  /*onChangeSelected*/
3224
3244
  e[17](
3225
3245
  /*editable*/
@@ -3256,7 +3276,7 @@ function It(e) {
3256
3276
  e[13]), t.$set(s);
3257
3277
  },
3258
3278
  i(o) {
3259
- n || (Y(t.$$.fragment, o), n = !0);
3279
+ n || (X(t.$$.fragment, o), n = !0);
3260
3280
  },
3261
3281
  o(o) {
3262
3282
  N(t.$$.fragment, o), n = !1;
@@ -3270,94 +3290,94 @@ function Pt(e) {
3270
3290
  let t = (
3271
3291
  /*editable*/
3272
3292
  e[28].id
3273
- ), n, o, i = It(e);
3293
+ ), n, o, i = Ct(e);
3274
3294
  return {
3275
3295
  c() {
3276
3296
  i.c(), n = ce();
3277
3297
  },
3278
3298
  m(s, r) {
3279
- i.m(s, r), v(s, n, r), o = !0;
3299
+ i.m(s, r), C(s, n, r), o = !0;
3280
3300
  },
3281
3301
  p(s, r) {
3282
3302
  r[0] & /*editableAnnotations*/
3283
3303
  64 && $(t, t = /*editable*/
3284
- s[28].id) ? (re(), N(i, 1, 1, H), le(), i = It(s), i.c(), Y(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3304
+ s[28].id) ? (re(), N(i, 1, 1, F), le(), i = Ct(s), i.c(), X(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3285
3305
  },
3286
3306
  i(s) {
3287
- o || (Y(i), o = !0);
3307
+ o || (X(i), o = !0);
3288
3308
  },
3289
3309
  o(s) {
3290
3310
  N(i), o = !1;
3291
3311
  },
3292
3312
  d(s) {
3293
- s && O(n), i.d(s);
3313
+ s && I(n), i.d(s);
3294
3314
  }
3295
3315
  };
3296
3316
  }
3297
- function xo(e) {
3317
+ function $o(e) {
3298
3318
  let t, n, o, i, s, r, a = (
3299
3319
  /*$store*/
3300
3320
  e[12]
3301
3321
  ), l = [];
3302
3322
  for (let c = 0; c < a.length; c += 1)
3303
3323
  l[c] = kt(Lt(e, a, c));
3304
- const d = (c) => N(l[c], 1, 1, () => {
3324
+ const f = (c) => N(l[c], 1, 1, () => {
3305
3325
  l[c] = null;
3306
3326
  });
3307
- let m = (
3327
+ let h = (
3308
3328
  /*drawingEl*/
3309
3329
  e[4] && Bt(e)
3310
3330
  );
3311
3331
  return {
3312
3332
  c() {
3313
- t = I("svg"), n = I("g");
3333
+ t = D("svg"), n = D("g");
3314
3334
  for (let c = 0; c < l.length; c += 1)
3315
3335
  l[c].c();
3316
- o = I("g"), m && m.c(), u(o, "class", "drawing"), u(t, "class", "a9s-annotationlayer"), ut(
3336
+ o = D("g"), h && h.c(), u(o, "class", "drawing"), u(t, "class", "a9s-annotationlayer"), ut(
3317
3337
  t,
3318
3338
  "drawing",
3319
3339
  /*tool*/
3320
3340
  e[2]
3321
3341
  );
3322
3342
  },
3323
- m(c, f) {
3324
- v(c, t, f), fe(t, n);
3325
- for (let h = 0; h < l.length; h += 1)
3326
- l[h] && l[h].m(n, null);
3327
- fe(t, o), m && m.m(o, null), e[24](o), e[25](t), i = !0, s || (r = [
3328
- J(t, "pointerup", function() {
3329
- j(
3343
+ m(c, d) {
3344
+ C(c, t, d), fe(t, n);
3345
+ for (let m = 0; m < l.length; m += 1)
3346
+ l[m] && l[m].m(n, null);
3347
+ fe(t, o), h && h.m(o, null), e[24](o), e[25](t), i = !0, s || (r = [
3348
+ K(t, "pointerup", function() {
3349
+ W(
3330
3350
  /*onPointerUp*/
3331
3351
  e[8]
3332
3352
  ) && e[8].apply(this, arguments);
3333
3353
  }),
3334
- J(t, "pointerdown", function() {
3335
- j(
3354
+ K(t, "pointerdown", function() {
3355
+ W(
3336
3356
  /*onPointerDown*/
3337
3357
  e[9]
3338
3358
  ) && e[9].apply(this, arguments);
3339
3359
  })
3340
3360
  ], s = !0);
3341
3361
  },
3342
- p(c, f) {
3343
- if (e = c, f[0] & /*$store, style, isEditable*/
3362
+ p(c, d) {
3363
+ if (e = c, d[0] & /*$store, style, isEditable*/
3344
3364
  4226) {
3345
3365
  a = /*$store*/
3346
3366
  e[12];
3347
- let h;
3348
- for (h = 0; h < a.length; h += 1) {
3349
- const p = Lt(e, a, h);
3350
- l[h] ? (l[h].p(p, f), Y(l[h], 1)) : (l[h] = kt(p), l[h].c(), Y(l[h], 1), l[h].m(n, null));
3367
+ let m;
3368
+ for (m = 0; m < a.length; m += 1) {
3369
+ const g = Lt(e, a, m);
3370
+ l[m] ? (l[m].p(g, d), X(l[m], 1)) : (l[m] = kt(g), l[m].c(), X(l[m], 1), l[m].m(n, null));
3351
3371
  }
3352
- for (re(), h = a.length; h < l.length; h += 1)
3353
- d(h);
3372
+ for (re(), m = a.length; m < l.length; m += 1)
3373
+ f(m);
3354
3374
  le();
3355
3375
  }
3356
3376
  /*drawingEl*/
3357
- e[4] ? m ? (m.p(e, f), f[0] & /*drawingEl*/
3358
- 16 && Y(m, 1)) : (m = Bt(e), m.c(), Y(m, 1), m.m(o, null)) : m && (re(), N(m, 1, 1, () => {
3359
- m = null;
3360
- }), le()), (!i || f[0] & /*tool*/
3377
+ e[4] ? h ? (h.p(e, d), d[0] & /*drawingEl*/
3378
+ 16 && X(h, 1)) : (h = Bt(e), h.c(), X(h, 1), h.m(o, null)) : h && (re(), N(h, 1, 1, () => {
3379
+ h = null;
3380
+ }), le()), (!i || d[0] & /*tool*/
3361
3381
  4) && ut(
3362
3382
  t,
3363
3383
  "drawing",
@@ -3367,115 +3387,115 @@ function xo(e) {
3367
3387
  },
3368
3388
  i(c) {
3369
3389
  if (!i) {
3370
- for (let f = 0; f < a.length; f += 1)
3371
- Y(l[f]);
3372
- Y(m), i = !0;
3390
+ for (let d = 0; d < a.length; d += 1)
3391
+ X(l[d]);
3392
+ X(h), i = !0;
3373
3393
  }
3374
3394
  },
3375
3395
  o(c) {
3376
3396
  l = l.filter(Boolean);
3377
- for (let f = 0; f < l.length; f += 1)
3378
- N(l[f]);
3379
- N(m), i = !1;
3397
+ for (let d = 0; d < l.length; d += 1)
3398
+ N(l[d]);
3399
+ N(h), i = !1;
3380
3400
  },
3381
3401
  d(c) {
3382
- c && O(t), ot(l, c), m && m.d(), e[24](null), e[25](null), s = !1, ae(r);
3402
+ c && I(t), ot(l, c), h && h.d(), e[24](null), e[25](null), s = !1, ae(r);
3383
3403
  }
3384
3404
  };
3385
3405
  }
3386
- function $o(e, t, n) {
3387
- let o, i, s, r, a, l, d, m, c = H, f = () => (c(), c = Xt(P, (B) => n(13, m = B)), P);
3406
+ function ei(e, t, n) {
3407
+ let o, i, s, r, a, l, f, h, c = F, d = () => (c(), c = Ut(H, (Y) => n(13, h = Y)), H);
3388
3408
  e.$$.on_destroy.push(() => c());
3389
- let { drawingEnabled: h } = t, { image: p } = t, { preferredDrawingMode: g } = t, { state: w } = t, { style: T = void 0 } = t, { tool: _, opts: M } = qt("rectangle"), { tool: X = _, opts: R = M } = t, { user: z } = t, K, D, P;
3390
- Ce(() => f(n(5, P = Mo(p, D))));
3391
- const { selection: y, store: b } = w;
3392
- ft(e, y, (B) => n(23, l = B)), ft(e, b, (B) => n(12, d = B));
3393
- let E = null, A = null;
3394
- const k = (B) => {
3395
- b.unobserve(E);
3396
- const Z = B.filter(({ editable: F }) => F).map(({ id: F }) => F);
3397
- Z.length > 0 ? (n(6, A = Z.map((F) => b.getAnnotation(F))), E = (F) => {
3398
- const { updated: W } = F.changes;
3399
- n(6, A = W.map((se) => se.newValue));
3400
- }, b.observe(E, { annotations: Z })) : n(6, A = null);
3401
- }, U = (B) => {
3402
- const Z = rt(), F = {
3409
+ let { drawingEnabled: m } = t, { image: g } = t, { preferredDrawingMode: y } = t, { state: E } = t, { style: b = void 0 } = t, { tool: _, opts: p } = Kt("rectangle"), { tool: L = _, opts: S = p } = t, { user: B } = t, z, k, H;
3410
+ Ie(() => d(n(5, H = Lo(g, k))));
3411
+ const { selection: w, store: A } = E;
3412
+ ft(e, w, (Y) => n(23, l = Y)), ft(e, A, (Y) => n(12, f = Y));
3413
+ let T = null, M = null;
3414
+ const P = (Y) => {
3415
+ A.unobserve(T);
3416
+ const Z = Y.filter(({ editable: V }) => V).map(({ id: V }) => V);
3417
+ Z.length > 0 ? (n(6, M = Z.map((V) => A.getAnnotation(V))), T = (V) => {
3418
+ const { updated: q } = V.changes;
3419
+ n(6, M = q.map((se) => se.newValue));
3420
+ }, A.observe(T, { annotations: Z })) : n(6, M = null);
3421
+ }, U = (Y) => {
3422
+ const Z = rt(), V = {
3403
3423
  id: Z,
3404
3424
  bodies: [],
3405
3425
  target: {
3406
3426
  annotation: Z,
3407
- selector: B.detail,
3408
- creator: z,
3427
+ selector: Y.detail,
3428
+ creator: B,
3409
3429
  created: /* @__PURE__ */ new Date()
3410
3430
  }
3411
3431
  };
3412
- b.addAnnotation(F), y.setSelected(F.id);
3413
- }, Q = (B) => (Z) => {
3432
+ A.addAnnotation(V), w.setSelected(V.id);
3433
+ }, Q = (Y) => (Z) => {
3414
3434
  var he;
3415
- const { target: F } = B, W = 10 * 60 * 1e3, se = ((he = F.creator) == null ? void 0 : he.id) !== z.id || !F.created || (/* @__PURE__ */ new Date()).getTime() - F.created.getTime() > W;
3416
- b.updateTarget({
3417
- ...F,
3435
+ const { target: V } = Y, q = 10 * 60 * 1e3, se = ((he = V.creator) == null ? void 0 : he.id) !== B.id || !V.created || (/* @__PURE__ */ new Date()).getTime() - V.created.getTime() > q;
3436
+ A.updateTarget({
3437
+ ...V,
3418
3438
  selector: Z.detail,
3419
- created: se ? F.created : /* @__PURE__ */ new Date(),
3439
+ created: se ? V.created : /* @__PURE__ */ new Date(),
3420
3440
  updated: se ? /* @__PURE__ */ new Date() : null,
3421
- updatedBy: se ? z : null
3441
+ updatedBy: se ? B : null
3422
3442
  });
3423
3443
  };
3424
- function Me(B) {
3425
- Ge[B ? "unshift" : "push"](() => {
3426
- K = B, n(4, K);
3444
+ function Me(Y) {
3445
+ Ge[Y ? "unshift" : "push"](() => {
3446
+ z = Y, n(4, z);
3427
3447
  });
3428
3448
  }
3429
- function x(B) {
3430
- Ge[B ? "unshift" : "push"](() => {
3431
- D = B, n(3, D);
3449
+ function x(Y) {
3450
+ Ge[Y ? "unshift" : "push"](() => {
3451
+ k = Y, n(3, k);
3432
3452
  });
3433
3453
  }
3434
- return e.$$set = (B) => {
3435
- "drawingEnabled" in B && n(0, h = B.drawingEnabled), "image" in B && n(18, p = B.image), "preferredDrawingMode" in B && n(19, g = B.preferredDrawingMode), "state" in B && n(20, w = B.state), "style" in B && n(1, T = B.style), "tool" in B && n(2, X = B.tool), "opts" in B && n(21, R = B.opts), "user" in B && n(22, z = B.user);
3454
+ return e.$$set = (Y) => {
3455
+ "drawingEnabled" in Y && n(0, m = Y.drawingEnabled), "image" in Y && n(18, g = Y.image), "preferredDrawingMode" in Y && n(19, y = Y.preferredDrawingMode), "state" in Y && n(20, E = Y.state), "style" in Y && n(1, b = Y.style), "tool" in Y && n(2, L = Y.tool), "opts" in Y && n(21, S = Y.opts), "user" in Y && n(22, B = Y.user);
3436
3456
  }, e.$$.update = () => {
3437
3457
  e.$$.dirty[0] & /*opts, preferredDrawingMode*/
3438
- 2621440 && n(11, o = (R == null ? void 0 : R.drawingMode) || g), e.$$.dirty[0] & /*svgEl*/
3439
- 8 && n(10, i = zo(D)), e.$$.dirty[0] & /*svgEl*/
3440
- 8 && n(9, { onPointerDown: s, onPointerUp: r } = jo(D, b), s, (n(8, r), n(3, D))), e.$$.dirty[0] & /*$selection*/
3441
- 8388608 && n(7, a = (B) => l.selected.find((Z) => Z.id === B.id && Z.editable)), e.$$.dirty[0] & /*$selection*/
3442
- 8388608 && k(l.selected);
3458
+ 2621440 && n(11, o = (S == null ? void 0 : S.drawingMode) || y), e.$$.dirty[0] & /*svgEl*/
3459
+ 8 && n(10, i = Vo(k)), e.$$.dirty[0] & /*svgEl*/
3460
+ 8 && n(9, { onPointerDown: s, onPointerUp: r } = Wo(k, A), s, (n(8, r), n(3, k))), e.$$.dirty[0] & /*$selection*/
3461
+ 8388608 && n(7, a = (Y) => l.selected.find((Z) => Z.id === Y.id && Z.editable)), e.$$.dirty[0] & /*$selection*/
3462
+ 8388608 && P(l.selected);
3443
3463
  }, [
3444
- h,
3445
- T,
3446
- X,
3447
- D,
3448
- K,
3449
- P,
3450
- A,
3464
+ m,
3465
+ b,
3466
+ L,
3467
+ k,
3468
+ z,
3469
+ H,
3470
+ M,
3451
3471
  a,
3452
3472
  r,
3453
3473
  s,
3454
3474
  i,
3455
3475
  o,
3456
- d,
3457
- m,
3458
- y,
3459
- b,
3476
+ f,
3477
+ h,
3478
+ w,
3479
+ A,
3460
3480
  U,
3461
3481
  Q,
3462
- p,
3463
3482
  g,
3464
- w,
3465
- R,
3466
- z,
3483
+ y,
3484
+ E,
3485
+ S,
3486
+ B,
3467
3487
  l,
3468
3488
  Me,
3469
3489
  x
3470
3490
  ];
3471
3491
  }
3472
- class ei extends ie {
3492
+ class ti extends ie {
3473
3493
  constructor(t) {
3474
3494
  super(), oe(
3475
3495
  this,
3476
3496
  t,
3497
+ ei,
3477
3498
  $o,
3478
- xo,
3479
3499
  $,
3480
3500
  {
3481
3501
  drawingEnabled: 0,
@@ -3492,33 +3512,33 @@ class ei extends ie {
3492
3512
  );
3493
3513
  }
3494
3514
  }
3495
- function ti(e, t, n, o, i) {
3496
- Jt(e, t, n || 0, o || e.length - 1, i || ni);
3515
+ function ni(e, t, n, o, i) {
3516
+ Zt(e, t, n || 0, o || e.length - 1, i || oi);
3497
3517
  }
3498
- function Jt(e, t, n, o, i) {
3518
+ function Zt(e, t, n, o, i) {
3499
3519
  for (; o > n; ) {
3500
3520
  if (o - n > 600) {
3501
- var s = o - n + 1, r = t - n + 1, a = Math.log(s), l = 0.5 * Math.exp(2 * a / 3), d = 0.5 * Math.sqrt(a * l * (s - l) / s) * (r - s / 2 < 0 ? -1 : 1), m = Math.max(n, Math.floor(t - r * l / s + d)), c = Math.min(o, Math.floor(t + (s - r) * l / s + d));
3502
- Jt(e, t, m, c, i);
3521
+ var s = o - n + 1, r = t - n + 1, a = Math.log(s), l = 0.5 * Math.exp(2 * a / 3), f = 0.5 * Math.sqrt(a * l * (s - l) / s) * (r - s / 2 < 0 ? -1 : 1), h = Math.max(n, Math.floor(t - r * l / s + f)), c = Math.min(o, Math.floor(t + (s - r) * l / s + f));
3522
+ Zt(e, t, h, c, i);
3503
3523
  }
3504
- var f = e[t], h = n, p = o;
3505
- for (Le(e, n, t), i(e[o], f) > 0 && Le(e, n, o); h < p; ) {
3506
- for (Le(e, h, p), h++, p--; i(e[h], f) < 0; )
3507
- h++;
3508
- for (; i(e[p], f) > 0; )
3509
- p--;
3524
+ var d = e[t], m = n, g = o;
3525
+ for (Le(e, n, t), i(e[o], d) > 0 && Le(e, n, o); m < g; ) {
3526
+ for (Le(e, m, g), m++, g--; i(e[m], d) < 0; )
3527
+ m++;
3528
+ for (; i(e[g], d) > 0; )
3529
+ g--;
3510
3530
  }
3511
- i(e[n], f) === 0 ? Le(e, n, p) : (p++, Le(e, p, o)), p <= t && (n = p + 1), t <= p && (o = p - 1);
3531
+ i(e[n], d) === 0 ? Le(e, n, g) : (g++, Le(e, g, o)), g <= t && (n = g + 1), t <= g && (o = g - 1);
3512
3532
  }
3513
3533
  }
3514
3534
  function Le(e, t, n) {
3515
3535
  var o = e[t];
3516
3536
  e[t] = e[n], e[n] = o;
3517
3537
  }
3518
- function ni(e, t) {
3538
+ function oi(e, t) {
3519
3539
  return e < t ? -1 : e > t ? 1 : 0;
3520
3540
  }
3521
- class oi {
3541
+ class ii {
3522
3542
  constructor(t = 9) {
3523
3543
  this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
3524
3544
  }
@@ -3591,14 +3611,14 @@ class oi {
3591
3611
  return this;
3592
3612
  let o = this.data;
3593
3613
  const i = this.toBBox(t), s = [], r = [];
3594
- let a, l, d;
3614
+ let a, l, f;
3595
3615
  for (; o || s.length; ) {
3596
- if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(), d = !0), o.leaf) {
3597
- const m = ii(t, o.children, n);
3598
- if (m !== -1)
3599
- return o.children.splice(m, 1), s.push(o), this._condense(s), this;
3616
+ if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(), f = !0), o.leaf) {
3617
+ const h = si(t, o.children, n);
3618
+ if (h !== -1)
3619
+ return o.children.splice(h, 1), s.push(o), this._condense(s), this;
3600
3620
  }
3601
- !d && !o.leaf && $e(o, i) ? (s.push(o), r.push(a), a = 0, l = o, o = o.children[0]) : l ? (a++, o = l.children[a], d = !1) : o = null;
3621
+ !f && !o.leaf && $e(o, i) ? (s.push(o), r.push(a), a = 0, l = o, o = o.children[0]) : l ? (a++, o = l.children[a], f = !1) : o = null;
3602
3622
  }
3603
3623
  return this;
3604
3624
  }
@@ -3629,14 +3649,14 @@ class oi {
3629
3649
  if (s <= r)
3630
3650
  return a = Ee(t.slice(n, o + 1)), we(a, this.toBBox), a;
3631
3651
  i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = Ee([]), a.leaf = !1, a.height = i;
3632
- const l = Math.ceil(s / r), d = l * Math.ceil(Math.sqrt(r));
3633
- Yt(t, n, o, d, this.compareMinX);
3634
- for (let m = n; m <= o; m += d) {
3635
- const c = Math.min(m + d - 1, o);
3636
- Yt(t, m, c, l, this.compareMinY);
3637
- for (let f = m; f <= c; f += l) {
3638
- const h = Math.min(f + l - 1, c);
3639
- a.children.push(this._build(t, f, h, i - 1));
3652
+ const l = Math.ceil(s / r), f = l * Math.ceil(Math.sqrt(r));
3653
+ Yt(t, n, o, f, this.compareMinX);
3654
+ for (let h = n; h <= o; h += f) {
3655
+ const c = Math.min(h + f - 1, o);
3656
+ Yt(t, h, c, l, this.compareMinY);
3657
+ for (let d = h; d <= c; d += l) {
3658
+ const m = Math.min(d + l - 1, c);
3659
+ a.children.push(this._build(t, d, m, i - 1));
3640
3660
  }
3641
3661
  }
3642
3662
  return we(a, this.toBBox), a;
@@ -3645,8 +3665,8 @@ class oi {
3645
3665
  for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
3646
3666
  let s = 1 / 0, r = 1 / 0, a;
3647
3667
  for (let l = 0; l < n.children.length; l++) {
3648
- const d = n.children[l], m = xe(d), c = li(t, d) - m;
3649
- c < r ? (r = c, s = m < s ? m : s, a = d) : c === r && m < s && (s = m, a = d);
3668
+ const f = n.children[l], h = xe(f), c = ai(t, f) - h;
3669
+ c < r ? (r = c, s = h < s ? h : s, a = f) : c === r && h < s && (s = h, a = f);
3650
3670
  }
3651
3671
  n = a || n.children[0];
3652
3672
  }
@@ -3671,14 +3691,14 @@ class oi {
3671
3691
  _chooseSplitIndex(t, n, o) {
3672
3692
  let i, s = 1 / 0, r = 1 / 0;
3673
3693
  for (let a = n; a <= o - n; a++) {
3674
- const l = Oe(t, 0, a, this.toBBox), d = Oe(t, a, o, this.toBBox), m = ai(l, d), c = xe(l) + xe(d);
3675
- m < s ? (s = m, i = a, r = c < r ? c : r) : m === s && c < r && (r = c, i = a);
3694
+ const l = Oe(t, 0, a, this.toBBox), f = Oe(t, a, o, this.toBBox), h = ci(l, f), c = xe(l) + xe(f);
3695
+ h < s ? (s = h, i = a, r = c < r ? c : r) : h === s && c < r && (r = c, i = a);
3676
3696
  }
3677
3697
  return i || o - n;
3678
3698
  }
3679
3699
  // sorts node children by the best axis for split
3680
3700
  _chooseSplitAxis(t, n, o) {
3681
- const i = t.leaf ? this.compareMinX : si, s = t.leaf ? this.compareMinY : ri, r = this._allDistMargin(t, n, o, i), a = this._allDistMargin(t, n, o, s);
3701
+ const i = t.leaf ? this.compareMinX : ri, s = t.leaf ? this.compareMinY : li, r = this._allDistMargin(t, n, o, i), a = this._allDistMargin(t, n, o, s);
3682
3702
  r < a && t.children.sort(i);
3683
3703
  }
3684
3704
  // total margin of all possible split distributions where each node is at least m full
@@ -3686,13 +3706,13 @@ class oi {
3686
3706
  t.children.sort(i);
3687
3707
  const s = this.toBBox, r = Oe(t, 0, n, s), a = Oe(t, o - n, o, s);
3688
3708
  let l = Xe(r) + Xe(a);
3689
- for (let d = n; d < o - n; d++) {
3690
- const m = t.children[d];
3691
- ve(r, t.leaf ? s(m) : m), l += Xe(r);
3709
+ for (let f = n; f < o - n; f++) {
3710
+ const h = t.children[f];
3711
+ ve(r, t.leaf ? s(h) : h), l += Xe(r);
3692
3712
  }
3693
- for (let d = o - n - 1; d >= n; d--) {
3694
- const m = t.children[d];
3695
- ve(a, t.leaf ? s(m) : m), l += Xe(a);
3713
+ for (let f = o - n - 1; f >= n; f--) {
3714
+ const h = t.children[f];
3715
+ ve(a, t.leaf ? s(h) : h), l += Xe(a);
3696
3716
  }
3697
3717
  return l;
3698
3718
  }
@@ -3705,7 +3725,7 @@ class oi {
3705
3725
  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);
3706
3726
  }
3707
3727
  }
3708
- function ii(e, t, n) {
3728
+ function si(e, t, n) {
3709
3729
  if (!n)
3710
3730
  return t.indexOf(e);
3711
3731
  for (let o = 0; o < t.length; o++)
@@ -3727,10 +3747,10 @@ function Oe(e, t, n, o, i) {
3727
3747
  function ve(e, t) {
3728
3748
  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;
3729
3749
  }
3730
- function si(e, t) {
3750
+ function ri(e, t) {
3731
3751
  return e.minX - t.minX;
3732
3752
  }
3733
- function ri(e, t) {
3753
+ function li(e, t) {
3734
3754
  return e.minY - t.minY;
3735
3755
  }
3736
3756
  function xe(e) {
@@ -3739,10 +3759,10 @@ function xe(e) {
3739
3759
  function Xe(e) {
3740
3760
  return e.maxX - e.minX + (e.maxY - e.minY);
3741
3761
  }
3742
- function li(e, t) {
3762
+ function ai(e, t) {
3743
3763
  return (Math.max(t.maxX, e.maxX) - Math.min(t.minX, e.minX)) * (Math.max(t.maxY, e.maxY) - Math.min(t.minY, e.minY));
3744
3764
  }
3745
- function ai(e, t) {
3765
+ function ci(e, t) {
3746
3766
  const n = Math.max(e.minX, t.minX), o = Math.max(e.minY, t.minY), i = Math.min(e.maxX, t.maxX), s = Math.min(e.maxY, t.maxY);
3747
3767
  return Math.max(0, i - n) * Math.max(0, s - o);
3748
3768
  }
@@ -3769,77 +3789,77 @@ function Yt(e, t, n, o, i) {
3769
3789
  if (n = s.pop(), t = s.pop(), n - t <= o)
3770
3790
  continue;
3771
3791
  const r = t + Math.ceil((n - t) / o / 2) * o;
3772
- ti(e, r, t, n, i), s.push(t, r, r, n);
3792
+ ni(e, r, t, n, i), s.push(t, r, r, n);
3773
3793
  }
3774
3794
  }
3775
- const ci = () => {
3776
- const e = new oi(), t = /* @__PURE__ */ new Map(), n = () => [...t.values()], o = () => {
3795
+ const fi = () => {
3796
+ const e = new ii(), t = /* @__PURE__ */ new Map(), n = () => [...t.values()], o = () => {
3777
3797
  e.clear(), t.clear();
3778
3798
  }, i = (c) => {
3779
- const { minX: f, minY: h, maxX: p, maxY: g } = c.selector.geometry.bounds, w = { minX: f, minY: h, maxX: p, maxY: g, target: c };
3780
- e.insert(w), t.set(c.annotation, w);
3799
+ const { minX: d, minY: m, maxX: g, maxY: y } = c.selector.geometry.bounds, E = { minX: d, minY: m, maxX: g, maxY: y, target: c };
3800
+ e.insert(E), t.set(c.annotation, E);
3781
3801
  }, s = (c) => {
3782
- const f = t.get(c.annotation);
3783
- e.remove(f), t.delete(c.annotation);
3802
+ const d = t.get(c.annotation);
3803
+ e.remove(d), t.delete(c.annotation);
3784
3804
  };
3785
3805
  return {
3786
3806
  all: n,
3787
3807
  clear: o,
3788
- getAt: (c, f) => {
3789
- const p = e.search({
3808
+ getAt: (c, d) => {
3809
+ const g = e.search({
3790
3810
  minX: c,
3791
- minY: f,
3811
+ minY: d,
3792
3812
  maxX: c,
3793
- maxY: f
3794
- }).map((g) => g.target).filter((g) => g.selector.type === V.RECTANGLE || cn(g.selector, c, f));
3795
- if (p.length > 0)
3796
- return p.sort((g, w) => nt(g.selector) - nt(w.selector)), p[0];
3813
+ maxY: d
3814
+ }).map((y) => y.target).filter((y) => y.selector.type === j.RECTANGLE || un(y.selector, c, d));
3815
+ if (g.length > 0)
3816
+ return g.sort((y, E) => nt(y.selector) - nt(E.selector)), g[0];
3797
3817
  },
3798
- getIntersecting: (c, f, h, p) => e.search({
3818
+ getIntersecting: (c, d, m, g) => e.search({
3799
3819
  minX: c,
3800
- minY: f,
3801
- maxX: c + h,
3802
- maxY: f + p
3803
- }).map((g) => g.target),
3820
+ minY: d,
3821
+ maxX: c + m,
3822
+ maxY: d + g
3823
+ }).map((y) => y.target),
3804
3824
  insert: i,
3805
3825
  remove: s,
3806
- set: (c, f = !0) => {
3807
- f && o();
3808
- const h = c.map((p) => {
3809
- const { minX: g, minY: w, maxX: T, maxY: _ } = p.selector.geometry.bounds;
3810
- return { minX: g, minY: w, maxX: T, maxY: _, target: p };
3826
+ set: (c, d = !0) => {
3827
+ d && o();
3828
+ const m = c.map((g) => {
3829
+ const { minX: y, minY: E, maxX: b, maxY: _ } = g.selector.geometry.bounds;
3830
+ return { minX: y, minY: E, maxX: b, maxY: _, target: g };
3811
3831
  });
3812
- h.forEach((p) => t.set(p.target.annotation, p)), e.load(h);
3832
+ m.forEach((g) => t.set(g.target.annotation, g)), e.load(m);
3813
3833
  },
3814
3834
  size: () => e.all().length,
3815
- update: (c, f) => {
3816
- s(c), i(f);
3835
+ update: (c, d) => {
3836
+ s(c), i(d);
3817
3837
  }
3818
3838
  };
3819
- }, fi = (e) => {
3820
- const t = Rn(), n = ci(), o = Ln(t, e.pointerSelectAction), i = Mn(t), s = Nn();
3839
+ }, ui = (e) => {
3840
+ const t = Xn(), n = fi(), o = vn(t, e.pointerSelectAction), i = On(t), s = Hn();
3821
3841
  return t.observe(({ changes: l }) => {
3822
- n.set(l.created.map((d) => d.target), !1), l.deleted.forEach((d) => n.remove(d.target)), l.updated.forEach(({ oldValue: d, newValue: m }) => n.update(d.target, m.target));
3842
+ n.set(l.created.map((f) => f.target), !1), l.deleted.forEach((f) => n.remove(f.target)), l.updated.forEach(({ oldValue: f, newValue: h }) => n.update(f.target, h.target));
3823
3843
  }), {
3824
3844
  store: {
3825
3845
  ...t,
3826
- getAt: (l, d) => {
3827
- const m = n.getAt(l, d);
3828
- return m ? t.getAnnotation(m.annotation) : void 0;
3846
+ getAt: (l, f) => {
3847
+ const h = n.getAt(l, f);
3848
+ return h ? t.getAnnotation(h.annotation) : void 0;
3829
3849
  },
3830
- getIntersecting: (l, d, m, c) => n.getIntersecting(l, d, m, c).map((f) => t.getAnnotation(f.annotation))
3850
+ getIntersecting: (l, f, h, c) => n.getIntersecting(l, f, h, c).map((d) => t.getAnnotation(d.annotation))
3831
3851
  },
3832
3852
  selection: o,
3833
3853
  hover: i,
3834
3854
  viewport: s
3835
3855
  };
3836
- }, ui = (e) => {
3837
- const t = fi(e);
3856
+ }, di = (e) => {
3857
+ const t = ui(e);
3838
3858
  return {
3839
3859
  ...t,
3840
- store: Dn(t.store)
3860
+ store: Un(t.store)
3841
3861
  };
3842
- }, di = (e) => {
3862
+ }, hi = (e) => {
3843
3863
  let t, n;
3844
3864
  if (e.nodeName === "CANVAS")
3845
3865
  t = e, n = t.getContext("2d", { willReadFrequently: !0 });
@@ -3850,144 +3870,142 @@ const ci = () => {
3850
3870
  let o = 0;
3851
3871
  for (let i = 1; i < 10; i++)
3852
3872
  for (let s = 1; s < 10; s++) {
3853
- const r = Math.round(s * t.width / 10), a = Math.round(i * t.height / 10), l = n.getImageData(r, a, 1, 1).data, d = (0.299 * l[0] + 0.587 * l[1] + 0.114 * l[2]) / 255;
3854
- o += d;
3873
+ const r = Math.round(s * t.width / 10), a = Math.round(i * t.height / 10), l = n.getImageData(r, a, 1, 1).data, f = (0.299 * l[0] + 0.587 * l[1] + 0.114 * l[2]) / 255;
3874
+ o += f;
3855
3875
  }
3856
3876
  return o / 81;
3857
- }, hi = (e, t) => {
3858
- const n = di(e), o = n > 0.6 ? "dark" : "light";
3859
- console.log(`[Annotorious] Image brightness: ${n.toFixed(1)}. Setting ${o} theme.`), t.setAttribute("data-theme", o);
3860
- }, mi = (e) => ({
3877
+ }, mi = (e) => {
3878
+ const t = hi(e), n = t > 0.6 ? "dark" : "light";
3879
+ return console.log(`[Annotorious] Image brightness: ${t.toFixed(1)}. Setting ${n} theme.`), n;
3880
+ }, Rt = (e, t, n) => t.setAttribute("data-theme", n === "auto" ? mi(e) : n), gi = (e) => ({
3861
3881
  ...e,
3862
3882
  drawingEnabled: e.drawingEnabled === void 0 ? !0 : e.drawingEnabled,
3863
3883
  drawingMode: e.drawingMode || "drag",
3864
- pointerSelectAction: e.pointerSelectAction || zt.EDIT
3865
- }), Rt = navigator.userAgent.indexOf("Mac OS X") !== -1, gi = (e, t) => {
3884
+ pointerSelectAction: e.pointerSelectAction || Vt.EDIT,
3885
+ theme: e.theme || "light"
3886
+ }), Dt = navigator.userAgent.indexOf("Mac OS X") !== -1, pi = (e, t) => {
3866
3887
  const n = t || document, o = (r) => {
3867
3888
  r.key === "Z" && r.ctrlKey ? e.undo() : r.key === "Y" && r.ctrlKey && e.redo();
3868
3889
  }, i = (r) => {
3869
3890
  r.key === "z" && r.metaKey && (r.shiftKey ? e.redo() : e.undo());
3870
3891
  }, s = () => {
3871
- Rt ? n.removeEventListener("keydown", i) : n.removeEventListener("keydown", o);
3892
+ Dt ? n.removeEventListener("keydown", i) : n.removeEventListener("keydown", o);
3872
3893
  };
3873
- return Rt ? n.addEventListener("keydown", i) : n.addEventListener("keydown", o), {
3894
+ return Dt ? n.addEventListener("keydown", i) : n.addEventListener("keydown", o), {
3874
3895
  destroy: s
3875
3896
  };
3876
3897
  };
3877
- const Si = (e, t = {}) => {
3898
+ const Mi = (e, t = {}) => {
3878
3899
  if (!e)
3879
3900
  throw "Missing argument: image";
3880
- const n = typeof e == "string" ? document.getElementById(e) : e, o = mi(t), i = ui(o), { hover: s, selection: r, store: a } = i, l = Gn(
3901
+ const n = typeof e == "string" ? document.getElementById(e) : e, o = gi(t), i = di(o), { selection: s, store: r } = i, a = Gn(r), l = Fn(
3902
+ i,
3881
3903
  a,
3882
- r,
3883
- s,
3884
- void 0,
3885
3904
  o.adapter,
3886
3905
  o.autoSave
3887
- ), d = Un(a), m = document.createElement("DIV");
3888
- m.style.position = "relative", m.style.display = "inline-block", n.style.display = "block", n.parentNode.insertBefore(m, n), m.appendChild(n);
3889
- const c = gi(d);
3890
- let f = qn();
3891
- hi(n, m);
3892
- const h = new ei({
3893
- target: m,
3906
+ ), f = document.createElement("DIV");
3907
+ f.style.position = "relative", f.style.display = "inline-block", n.style.display = "block", n.parentNode.insertBefore(f, n), f.appendChild(n);
3908
+ const h = pi(a);
3909
+ let c = Kn();
3910
+ Rt(n, f, o.theme);
3911
+ const d = new ti({
3912
+ target: f,
3894
3913
  props: {
3895
3914
  drawingEnabled: o.drawingEnabled,
3896
3915
  image: n,
3897
3916
  preferredDrawingMode: o.drawingMode,
3898
3917
  state: i,
3899
3918
  style: o.style,
3900
- user: f
3919
+ user: c
3901
3920
  }
3902
3921
  });
3903
- h.$on("click", (P) => {
3904
- const { originalEvent: y, annotation: b } = P.detail;
3905
- b ? r.clickSelect(b.id, y) : r.isEmpty() || r.clear();
3922
+ d.$on("click", (k) => {
3923
+ const { originalEvent: H, annotation: w } = k.detail;
3924
+ w ? s.clickSelect(w.id, H) : s.isEmpty() || s.clear();
3906
3925
  });
3907
- const p = Fn(a, d, o.adapter), g = () => {
3908
- h.$destroy(), m.parentNode.insertBefore(n, m), m.parentNode.removeChild(m), c.destroy(), d.destroy();
3909
- }, w = () => f, T = (P, y, b) => Co(P, y, b), _ = (P, y) => ho(P, y), M = (P) => {
3910
- const { tool: y, opts: b } = qt(P);
3911
- h.$set({ tool: y, opts: b });
3912
- }, X = (P) => h.$set({ drawingEnabled: P }), R = (P) => {
3926
+ const m = Vn(i, a, o.adapter), g = () => {
3927
+ d.$destroy(), f.parentNode.insertBefore(n, f), f.parentNode.removeChild(f), h.destroy(), a.destroy();
3928
+ }, y = () => c, E = (k, H, w) => Co(k, H, w), b = (k, H) => mo(k, H), _ = (k) => {
3929
+ const { tool: H, opts: w } = Kt(k);
3930
+ d.$set({ tool: H, opts: w });
3931
+ }, p = (k) => d.$set({ drawingEnabled: k }), L = (k) => {
3913
3932
  console.warn("Filter not implemented yet");
3914
- }, z = (P) => {
3915
- P ? r.setSelected(P) : r.clear();
3916
- }, K = (P) => h.$set({ style: P }), D = (P) => {
3917
- f = P, h.$set({ user: P });
3933
+ }, S = (k) => d.$set({ style: k }), B = (k) => Rt(n, f, k), z = (k) => {
3934
+ c = k, d.$set({ user: k });
3918
3935
  };
3919
3936
  return {
3920
- ...p,
3937
+ ...m,
3921
3938
  destroy: g,
3922
- getUser: w,
3923
- listDrawingTools: Bo,
3939
+ getUser: y,
3940
+ listDrawingTools: Io,
3924
3941
  on: l.on,
3925
3942
  off: l.off,
3926
- registerDrawingTool: T,
3927
- registerShapeEditor: _,
3928
- setDrawingEnabled: X,
3929
- setDrawingTool: M,
3930
- setFilter: R,
3931
- setSelected: z,
3932
- setStyle: K,
3933
- setUser: D,
3943
+ registerDrawingTool: E,
3944
+ registerShapeEditor: b,
3945
+ setDrawingEnabled: p,
3946
+ setDrawingTool: _,
3947
+ setFilter: L,
3948
+ setStyle: S,
3949
+ setTheme: B,
3950
+ setUser: z,
3934
3951
  state: i
3935
3952
  };
3936
3953
  };
3937
3954
  export {
3938
- Wt as Editor,
3939
- yo as EditorMount,
3940
- L as Handle,
3941
- Ti as IdentityTransform,
3955
+ Jt as Editor,
3956
+ wo as EditorMount,
3957
+ v as Handle,
3958
+ Si as IdentityTransform,
3942
3959
  G as Origin,
3943
- wi as PRESENCE_KEY,
3944
- zt as PointerSelectAction,
3945
- lo as PolygonEditor,
3946
- uo as RectangleEditor,
3947
- dn as RectangleUtil,
3948
- To as RubberbandRectangle,
3949
- ei as SVGAnnotationLayer,
3950
- V as ShapeType,
3951
- bo as ToolMount,
3952
- Ei as W3CImageFormat,
3953
- jo as addEventListeners,
3960
+ bi as PRESENCE_KEY,
3961
+ Vt as PointerSelectAction,
3962
+ ao as PolygonEditor,
3963
+ ho as RectangleEditor,
3964
+ mn as RectangleUtil,
3965
+ So as RubberbandRectangle,
3966
+ ti as SVGAnnotationLayer,
3967
+ j as ShapeType,
3968
+ Eo as ToolMount,
3969
+ Ai as W3CImageFormat,
3970
+ Wo as addEventListeners,
3954
3971
  He as boundsFromPoints,
3955
3972
  nt as computeArea,
3956
- qn as createAnonymousGuest,
3957
- Fn as createBaseAnnotator,
3958
- _i as createBody,
3959
- $n as createDefaultAppearenceProvider,
3960
- Si as createImageAnnotator,
3961
- fi as createImageAnnotatorState,
3962
- bi as createPresenceState,
3963
- zo as createSVGTransform,
3964
- ui as createSvelteImageAnnotatorState,
3965
- xn as defaultColorProvider,
3966
- Vt as diffAnnotations,
3973
+ Kn as createAnonymousGuest,
3974
+ Vn as createBaseAnnotator,
3975
+ yi as createBody,
3976
+ to as createDefaultAppearenceProvider,
3977
+ Mi as createImageAnnotator,
3978
+ ui as createImageAnnotatorState,
3979
+ Ei as createPresenceState,
3980
+ Vo as createSVGTransform,
3981
+ di as createSvelteImageAnnotatorState,
3982
+ eo as defaultColorProvider,
3983
+ mi as detectTheme,
3984
+ jt as diffAnnotations,
3967
3985
  Ke as distance,
3968
- Mo as enableResponsive,
3969
- mi as fillDefaults,
3970
- pi as getContributors,
3986
+ Lo as enableResponsive,
3987
+ gi as fillDefaults,
3988
+ _i as getContributors,
3971
3989
  bt as getEditor,
3972
- qt as getTool,
3973
- gi as initKeyboardCommands,
3974
- cn as intersects,
3975
- Ai as isTouch,
3976
- Bo as listDrawingTools,
3977
- Hn as parseAll,
3978
- hn as parseFragmentSelector,
3979
- wn as parseSVGSelector,
3980
- Kn as parseW3CBodies,
3981
- no as parseW3CImageAnnotation,
3982
- ho as registerEditor,
3990
+ Kt as getTool,
3991
+ pi as initKeyboardCommands,
3992
+ un as intersects,
3993
+ Ti as isTouch,
3994
+ Io as listDrawingTools,
3995
+ zn as parseAll,
3996
+ gn as parseFragmentSelector,
3997
+ En as parseSVGSelector,
3998
+ Qn as parseW3CBodies,
3999
+ oo as parseW3CImageAnnotation,
4000
+ mo as registerEditor,
3983
4001
  st as registerShapeUtil,
3984
4002
  Co as registerTool,
3985
- di as sampleBrightness,
3986
- yi as serializeAll,
3987
- mn as serializeFragmentSelector,
3988
- bn as serializeSVGSelector,
3989
- Zn as serializeW3CBodies,
3990
- oo as serializeW3CImageAnnotation,
3991
- hi as setTheme
4003
+ hi as sampleBrightness,
4004
+ wi as serializeAll,
4005
+ pn as serializeFragmentSelector,
4006
+ An as serializeSVGSelector,
4007
+ xn as serializeW3CBodies,
4008
+ io as serializeW3CImageAnnotation,
4009
+ Rt as setTheme
3992
4010
  };
3993
4011
  //# sourceMappingURL=annotorious.es.js.map