@annotorious/annotorious 3.0.0-rc.5 → 3.0.0-rc.7

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 V() {
1
+ function z() {
2
2
  }
3
- function tn(e, t) {
3
+ function nn(e, t) {
4
4
  for (const n in t)
5
5
  e[n] = t[n];
6
6
  return e;
7
7
  }
8
- function zt(e) {
8
+ function Ft(e) {
9
9
  return e();
10
10
  }
11
- function ht() {
11
+ function gt() {
12
12
  return /* @__PURE__ */ Object.create(null);
13
13
  }
14
- function re(e) {
15
- e.forEach(zt);
14
+ function ie(e) {
15
+ e.forEach(Ft);
16
16
  }
17
- function H(e) {
17
+ function j(e) {
18
18
  return typeof e == "function";
19
19
  }
20
- function Z(e, t) {
20
+ function K(e, t) {
21
21
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
22
22
  }
23
- function nn(e) {
23
+ function on(e) {
24
24
  return Object.keys(e).length === 0;
25
25
  }
26
- function Ft(e, ...t) {
26
+ function Ht(e, ...t) {
27
27
  if (e == null)
28
- return V;
28
+ return z;
29
29
  const n = e.subscribe(...t);
30
30
  return n.unsubscribe ? () => n.unsubscribe() : n;
31
31
  }
32
- function gt(e, t, n) {
33
- e.$$.on_destroy.push(Ft(t, n));
32
+ function mt(e, t, n) {
33
+ e.$$.on_destroy.push(Ht(t, n));
34
34
  }
35
- function on(e, t, n, o) {
35
+ function sn(e, t, n, o) {
36
36
  if (e) {
37
- const i = Ht(e, t, n, o);
37
+ const i = jt(e, t, n, o);
38
38
  return e[0](i);
39
39
  }
40
40
  }
41
- function Ht(e, t, n, o) {
42
- return e[1] && o ? tn(n.ctx.slice(), e[1](o(t))) : n.ctx;
41
+ function jt(e, t, n, o) {
42
+ return e[1] && o ? nn(n.ctx.slice(), e[1](o(t))) : n.ctx;
43
43
  }
44
- function sn(e, t, n, o) {
44
+ function rn(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 sn(e, t, n, o) {
56
56
  }
57
57
  return t.dirty;
58
58
  }
59
- function rn(e, t, n, o, i, s) {
59
+ function ln(e, t, n, o, i, s) {
60
60
  if (i) {
61
- const r = Ht(t, n, o, s);
61
+ const r = jt(t, n, o, s);
62
62
  e.p(r, i);
63
63
  }
64
64
  }
65
- function ln(e) {
65
+ function an(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++)
@@ -71,30 +71,30 @@ function ln(e) {
71
71
  }
72
72
  return -1;
73
73
  }
74
- function ae(e, t) {
74
+ function re(e, t) {
75
75
  e.appendChild(t);
76
76
  }
77
- function k(e, t, n) {
77
+ function B(e, t, n) {
78
78
  e.insertBefore(t, n || null);
79
79
  }
80
- function L(e) {
80
+ function k(e) {
81
81
  e.parentNode && e.parentNode.removeChild(e);
82
82
  }
83
- function rt(e, t) {
83
+ function lt(e, t) {
84
84
  for (let n = 0; n < e.length; n += 1)
85
85
  e[n] && e[n].d(t);
86
86
  }
87
87
  function U(e) {
88
88
  return document.createElementNS("http://www.w3.org/2000/svg", e);
89
89
  }
90
- function jt(e) {
90
+ function qt(e) {
91
91
  return document.createTextNode(e);
92
92
  }
93
- function ee() {
94
- return jt(" ");
93
+ function $() {
94
+ return qt(" ");
95
95
  }
96
- function le() {
97
- return jt("");
96
+ function se() {
97
+ return qt("");
98
98
  }
99
99
  function W(e, t, n, o) {
100
100
  return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
@@ -102,34 +102,34 @@ function W(e, t, n, o) {
102
102
  function f(e, t, n) {
103
103
  n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
104
104
  }
105
- function an(e) {
105
+ function cn(e) {
106
106
  return Array.from(e.childNodes);
107
107
  }
108
- function mt(e, t, n) {
108
+ function pt(e, t, n) {
109
109
  e.classList[n ? "add" : "remove"](t);
110
110
  }
111
- function cn(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
111
+ function dn(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
  }
115
- let Ce;
116
- function Ie(e) {
117
- Ce = e;
115
+ let Ie;
116
+ function Be(e) {
117
+ Ie = e;
118
118
  }
119
- function qt() {
120
- if (!Ce)
119
+ function Wt() {
120
+ if (!Ie)
121
121
  throw new Error("Function called outside component initialization");
122
- return Ce;
122
+ return Ie;
123
123
  }
124
- function Pe(e) {
125
- qt().$$.on_mount.push(e);
124
+ function Ce(e) {
125
+ Wt().$$.on_mount.push(e);
126
126
  }
127
- function ve() {
128
- const e = qt();
127
+ function Se() {
128
+ const e = Wt();
129
129
  return (t, n, { cancelable: o = !1 } = {}) => {
130
130
  const i = e.$$.callbacks[t];
131
131
  if (i) {
132
- const s = cn(t, n, { cancelable: o });
132
+ const s = dn(t, n, { cancelable: o });
133
133
  return i.slice().forEach((r) => {
134
134
  r.call(e, s);
135
135
  }), !s.defaultPrevented;
@@ -137,112 +137,112 @@ function ve() {
137
137
  return !0;
138
138
  };
139
139
  }
140
- function Te(e, t) {
140
+ function Ae(e, t) {
141
141
  const n = e.$$.callbacks[t.type];
142
142
  n && n.slice().forEach((o) => o.call(this, t));
143
143
  }
144
- const Ee = [], ze = [];
145
- let Se = [];
146
- const pt = [], dn = /* @__PURE__ */ Promise.resolve();
144
+ const be = [], ze = [];
145
+ let Te = [];
146
+ const yt = [], un = /* @__PURE__ */ Promise.resolve();
147
147
  let ot = !1;
148
- function un() {
149
- ot || (ot = !0, dn.then(Wt));
148
+ function fn() {
149
+ ot || (ot = !0, un.then(Jt));
150
150
  }
151
151
  function it(e) {
152
- Se.push(e);
152
+ Te.push(e);
153
153
  }
154
154
  const Ke = /* @__PURE__ */ new Set();
155
- let ye = 0;
156
- function Wt() {
157
- if (ye !== 0)
155
+ let pe = 0;
156
+ function Jt() {
157
+ if (pe !== 0)
158
158
  return;
159
- const e = Ce;
159
+ const e = Ie;
160
160
  do {
161
161
  try {
162
- for (; ye < Ee.length; ) {
163
- const t = Ee[ye];
164
- ye++, Ie(t), fn(t.$$);
162
+ for (; pe < be.length; ) {
163
+ const t = be[pe];
164
+ pe++, Be(t), hn(t.$$);
165
165
  }
166
166
  } catch (t) {
167
- throw Ee.length = 0, ye = 0, t;
167
+ throw be.length = 0, pe = 0, t;
168
168
  }
169
- for (Ie(null), Ee.length = 0, ye = 0; ze.length; )
169
+ for (Be(null), be.length = 0, pe = 0; ze.length; )
170
170
  ze.pop()();
171
- for (let t = 0; t < Se.length; t += 1) {
172
- const n = Se[t];
171
+ for (let t = 0; t < Te.length; t += 1) {
172
+ const n = Te[t];
173
173
  Ke.has(n) || (Ke.add(n), n());
174
174
  }
175
- Se.length = 0;
176
- } while (Ee.length);
177
- for (; pt.length; )
178
- pt.pop()();
179
- ot = !1, Ke.clear(), Ie(e);
175
+ Te.length = 0;
176
+ } while (be.length);
177
+ for (; yt.length; )
178
+ yt.pop()();
179
+ ot = !1, Ke.clear(), Be(e);
180
180
  }
181
- function fn(e) {
181
+ function hn(e) {
182
182
  if (e.fragment !== null) {
183
- e.update(), re(e.before_update);
183
+ e.update(), ie(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(it);
186
186
  }
187
187
  }
188
- function hn(e) {
188
+ function gn(e) {
189
189
  const t = [], n = [];
190
- Se.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Se = t;
190
+ Te.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Te = t;
191
191
  }
192
192
  const Ve = /* @__PURE__ */ new Set();
193
- let fe;
194
- function ie() {
195
- fe = {
193
+ let ue;
194
+ function ne() {
195
+ ue = {
196
196
  r: 0,
197
197
  c: [],
198
- p: fe
198
+ p: ue
199
199
  // parent group
200
200
  };
201
201
  }
202
- function se() {
203
- fe.r || re(fe.c), fe = fe.p;
202
+ function oe() {
203
+ ue.r || ie(ue.c), ue = ue.p;
204
204
  }
205
205
  function D(e, t) {
206
206
  e && e.i && (Ve.delete(e), e.i(t));
207
207
  }
208
- function X(e, t, n, o) {
208
+ function N(e, t, n, o) {
209
209
  if (e && e.o) {
210
210
  if (Ve.has(e))
211
211
  return;
212
- Ve.add(e), fe.c.push(() => {
212
+ Ve.add(e), ue.c.push(() => {
213
213
  Ve.delete(e), o && (n && e.d(1), o());
214
214
  }), e.o(t);
215
215
  } else
216
216
  o && o();
217
217
  }
218
- function ge(e) {
218
+ function he(e) {
219
219
  e && e.c();
220
220
  }
221
- function ce(e, t, n, o) {
221
+ function le(e, t, n, o) {
222
222
  const { fragment: i, after_update: s } = e.$$;
223
223
  i && i.m(t, n), o || it(() => {
224
- const r = e.$$.on_mount.map(zt).filter(H);
225
- e.$$.on_destroy ? e.$$.on_destroy.push(...r) : re(r), e.$$.on_mount = [];
224
+ const r = e.$$.on_mount.map(Ft).filter(j);
225
+ e.$$.on_destroy ? e.$$.on_destroy.push(...r) : ie(r), e.$$.on_mount = [];
226
226
  }), s.forEach(it);
227
227
  }
228
- function de(e, t) {
228
+ function ae(e, t) {
229
229
  const n = e.$$;
230
- n.fragment !== null && (hn(n.after_update), re(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
230
+ n.fragment !== null && (gn(n.after_update), ie(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
231
231
  }
232
- function gn(e, t) {
233
- e.$$.dirty[0] === -1 && (Ee.push(e), un(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
232
+ function mn(e, t) {
233
+ e.$$.dirty[0] === -1 && (be.push(e), fn(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
234
234
  }
235
- function te(e, t, n, o, i, s, r, a = [-1]) {
236
- const l = Ce;
237
- Ie(e);
235
+ function ee(e, t, n, o, i, s, r, a = [-1]) {
236
+ const l = Ie;
237
+ Be(e);
238
238
  const d = e.$$ = {
239
239
  fragment: null,
240
240
  ctx: [],
241
241
  // state
242
242
  props: s,
243
- update: V,
243
+ update: z,
244
244
  not_equal: i,
245
- bound: ht(),
245
+ bound: gt(),
246
246
  // lifecycle
247
247
  on_mount: [],
248
248
  on_destroy: [],
@@ -251,7 +251,7 @@ function te(e, t, n, o, i, s, r, a = [-1]) {
251
251
  after_update: [],
252
252
  context: new Map(t.context || (l ? l.$$.context : [])),
253
253
  // everything else
254
- callbacks: ht(),
254
+ callbacks: gt(),
255
255
  dirty: a,
256
256
  skip_bound: !1,
257
257
  root: t.target || l.$$.root
@@ -260,24 +260,24 @@ function te(e, t, n, o, i, s, r, a = [-1]) {
260
260
  let h = !1;
261
261
  if (d.ctx = n ? n(e, t.props || {}, (c, g, ...u) => {
262
262
  const m = u.length ? u[0] : g;
263
- return d.ctx && i(d.ctx[c], d.ctx[c] = m) && (!d.skip_bound && d.bound[c] && d.bound[c](m), h && gn(e, c)), g;
264
- }) : [], d.update(), h = !0, re(d.before_update), d.fragment = o ? o(d.ctx) : !1, t.target) {
263
+ return d.ctx && i(d.ctx[c], d.ctx[c] = m) && (!d.skip_bound && d.bound[c] && d.bound[c](m), h && mn(e, c)), g;
264
+ }) : [], d.update(), h = !0, ie(d.before_update), d.fragment = o ? o(d.ctx) : !1, t.target) {
265
265
  if (t.hydrate) {
266
- const c = an(t.target);
267
- d.fragment && d.fragment.l(c), c.forEach(L);
266
+ const c = cn(t.target);
267
+ d.fragment && d.fragment.l(c), c.forEach(k);
268
268
  } else
269
269
  d.fragment && d.fragment.c();
270
- t.intro && D(e.$$.fragment), ce(e, t.target, t.anchor, t.customElement), Wt();
270
+ t.intro && D(e.$$.fragment), le(e, t.target, t.anchor, t.customElement), Jt();
271
271
  }
272
- Ie(l);
272
+ Be(l);
273
273
  }
274
- class ne {
274
+ class te {
275
275
  $destroy() {
276
- de(this, 1), this.$destroy = V;
276
+ ae(this, 1), this.$destroy = z;
277
277
  }
278
278
  $on(t, n) {
279
- if (!H(n))
280
- return V;
279
+ if (!j(n))
280
+ return z;
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 ne {
285
285
  };
286
286
  }
287
287
  $set(t) {
288
- this.$$set && !nn(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
288
+ this.$$set && !on(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
289
289
  }
290
290
  }
291
- var F = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(F || {});
292
- const lt = {}, at = (e, t) => lt[e] = t, st = (e) => lt[e.type].area(e), mn = (e, t, n) => lt[e.type].intersects(e, t, n), Fe = (e) => {
291
+ var H = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(H || {});
292
+ const at = {}, ct = (e, t) => at[e] = t, st = (e) => at[e.type].area(e), pn = (e, t, n) => at[e.type].intersects(e, t, n), Fe = (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
- }, pn = {
297
+ }, yn = {
298
298
  area: (e) => Math.PI * e.geometry.rx * e.geometry.ry,
299
299
  intersects: (e, t, n) => {
300
300
  const { cx: o, cy: i, rx: s, ry: r } = e.geometry, a = 0, l = Math.cos(a), d = Math.sin(a), h = t - o, c = n - i, g = l * h + d * c, u = d * h - l * c;
301
301
  return g * g / (s * s) + u * u / (r * r) <= 1;
302
302
  }
303
303
  };
304
- at(F.ELLIPSE, pn);
305
- const yn = {
304
+ ct(H.ELLIPSE, yn);
305
+ const _n = {
306
306
  area: (e) => {
307
307
  const { points: t } = e.geometry;
308
308
  let n = 0, o = t.length - 1;
@@ -320,13 +320,13 @@ const yn = {
320
320
  return i;
321
321
  }
322
322
  };
323
- at(F.POLYGON, yn);
324
- const _n = {
323
+ ct(H.POLYGON, _n);
324
+ const wn = {
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
- at(F.RECTANGLE, _n);
329
- const wn = (e, t = !1) => {
328
+ ct(H.RECTANGLE, wn);
329
+ const bn = (e, t = !1) => {
330
330
  const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, a, l, d, h, c] = i;
331
331
  if (r !== "xywh")
332
332
  throw new Error("Unsupported MediaFragment: " + n);
@@ -334,7 +334,7 @@ const wn = (e, t = !1) => {
334
334
  throw new Error(`Unsupported MediaFragment unit: ${a}`);
335
335
  const [g, u, m, w] = [l, d, h, c].map(parseFloat);
336
336
  return {
337
- type: F.RECTANGLE,
337
+ type: H.RECTANGLE,
338
338
  geometry: {
339
339
  x: g,
340
340
  y: u,
@@ -348,47 +348,47 @@ const wn = (e, t = !1) => {
348
348
  }
349
349
  }
350
350
  };
351
- }, bn = (e) => {
351
+ }, En = (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
- }, Jt = "http://www.w3.org/2000/svg", yt = (e) => {
358
+ }, Kt = "http://www.w3.org/2000/svg", _t = (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
- }, En = (e) => {
366
- const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${Jt}">`);
367
- return new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
368
365
  }, An = (e) => {
369
- const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(Jt), i = n.lookupNamespaceURI(null);
370
- return o || i ? yt(n).firstChild : yt(En(n)).firstChild;
366
+ const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${Kt}">`);
367
+ return new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
371
368
  }, Tn = (e) => {
369
+ const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(Kt), i = n.lookupNamespaceURI(null);
370
+ return o || i ? _t(n).firstChild : _t(An(n)).firstChild;
371
+ }, Sn = (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: F.POLYGON,
377
+ type: H.POLYGON,
378
378
  geometry: {
379
379
  points: i,
380
380
  bounds: Fe(i)
381
381
  }
382
382
  };
383
- }, Sn = (e) => {
384
- const t = An(e), n = parseFloat(t.getAttribute("cx")), o = parseFloat(t.getAttribute("cy")), i = parseFloat(t.getAttribute("rx")), s = parseFloat(t.getAttribute("ry")), r = {
383
+ }, Mn = (e) => {
384
+ const t = Tn(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: F.ELLIPSE,
391
+ type: H.ELLIPSE,
392
392
  geometry: {
393
393
  cx: n,
394
394
  cy: o,
@@ -400,15 +400,15 @@ const wn = (e, t = !1) => {
400
400
  }, vn = (e) => {
401
401
  const t = typeof e == "string" ? e : e.value;
402
402
  if (t.includes("<polygon points="))
403
- return Tn(t);
404
- if (t.includes("<ellipse "))
405
403
  return Sn(t);
406
- }, Mn = (e) => {
404
+ if (t.includes("<ellipse "))
405
+ return Mn(t);
406
+ }, On = (e) => {
407
407
  let t;
408
- if (e.type === F.POLYGON) {
408
+ if (e.type === H.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 === F.ELLIPSE) {
411
+ } else if (e.type === H.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,36 +417,36 @@ const wn = (e, t = !1) => {
417
417
  throw `Unsupported shape type: ${e.type}`;
418
418
  };
419
419
  let Xe;
420
- const On = new Uint8Array(16);
421
- function Ln() {
420
+ const Ln = new Uint8Array(16);
421
+ function kn() {
422
422
  if (!Xe && (Xe = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Xe))
423
423
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
424
- return Xe(On);
424
+ return Xe(Ln);
425
425
  }
426
426
  const q = [];
427
427
  for (let e = 0; e < 256; ++e)
428
428
  q.push((e + 256).toString(16).slice(1));
429
- function kn(e, t = 0) {
429
+ function Bn(e, t = 0) {
430
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]];
431
431
  }
432
- const Bn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), _t = {
433
- randomUUID: Bn
432
+ const In = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), wt = {
433
+ randomUUID: In
434
434
  };
435
- function ct(e, t, n) {
436
- if (_t.randomUUID && !t && !e)
437
- return _t.randomUUID();
435
+ function dt(e, t, n) {
436
+ if (wt.randomUUID && !t && !e)
437
+ return wt.randomUUID();
438
438
  e = e || {};
439
- const o = e.random || (e.rng || Ln)();
439
+ const o = e.random || (e.rng || kn)();
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 kn(o);
446
+ return Bn(o);
447
447
  }
448
- var wt = Object.prototype.hasOwnProperty;
449
- function he(e, t) {
448
+ var bt = Object.prototype.hasOwnProperty;
449
+ function fe(e, t) {
450
450
  var n, o;
451
451
  if (e === t)
452
452
  return !0;
@@ -457,14 +457,14 @@ function he(e, t) {
457
457
  return e.toString() === t.toString();
458
458
  if (n === Array) {
459
459
  if ((o = e.length) === t.length)
460
- for (; o-- && he(e[o], t[o]); )
460
+ for (; o-- && fe(e[o], t[o]); )
461
461
  ;
462
462
  return o === -1;
463
463
  }
464
464
  if (!n || typeof e == "object") {
465
465
  o = 0;
466
466
  for (n in e)
467
- if (wt.call(e, n) && ++o && !wt.call(t, n) || !(n in t) || !he(e[n], t[n]))
467
+ if (bt.call(e, n) && ++o && !bt.call(t, n) || !(n in t) || !fe(e[n], t[n]))
468
468
  return !1;
469
469
  return Object.keys(t).length === o;
470
470
  }
@@ -473,22 +473,22 @@ function he(e, t) {
473
473
  }
474
474
  function Ze() {
475
475
  }
476
- function In(e, t) {
476
+ function Cn(e, t) {
477
477
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
478
478
  }
479
- const _e = [];
480
- function dt(e, t = Ze) {
479
+ const ye = [];
480
+ function ut(e, t = Ze) {
481
481
  let n;
482
482
  const o = /* @__PURE__ */ new Set();
483
483
  function i(a) {
484
- if (In(e, a) && (e = a, n)) {
485
- const l = !_e.length;
484
+ if (Cn(e, a) && (e = a, n)) {
485
+ const l = !ye.length;
486
486
  for (const d of o)
487
- d[1](), _e.push(d, e);
487
+ d[1](), ye.push(d, e);
488
488
  if (l) {
489
- for (let d = 0; d < _e.length; d += 2)
490
- _e[d][0](_e[d + 1]);
491
- _e.length = 0;
489
+ for (let d = 0; d < ye.length; d += 2)
490
+ ye[d][0](ye[d + 1]);
491
+ ye.length = 0;
492
492
  }
493
493
  }
494
494
  }
@@ -503,8 +503,8 @@ function dt(e, t = Ze) {
503
503
  }
504
504
  return { set: i, update: s, subscribe: r };
505
505
  }
506
- const Cn = (e) => {
507
- const { subscribe: t, set: n } = dt(null);
506
+ const Pn = (e) => {
507
+ const { subscribe: t, set: n } = ut(null);
508
508
  let o = null;
509
509
  return t((i) => o = i), e.observe(({ changes: i }) => {
510
510
  if (o) {
@@ -520,9 +520,9 @@ const Cn = (e) => {
520
520
  set: n
521
521
  };
522
522
  };
523
- var Kt = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(Kt || {});
524
- const Qe = { selected: [] }, Pn = (e, t = "EDIT") => {
525
- const { subscribe: n, set: o } = dt(Qe);
523
+ var Zt = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(Zt || {});
524
+ const Qe = { selected: [] }, Rn = (e, t = "EDIT") => {
525
+ const { subscribe: n, set: o } = ut(Qe);
526
526
  let i = Qe;
527
527
  n((c) => i = c);
528
528
  const s = () => o(Qe), r = () => {
@@ -536,7 +536,7 @@ const Qe = { selected: [] }, Pn = (e, t = "EDIT") => {
536
536
  }, l = (c, g) => {
537
537
  const u = e.getAnnotation(c);
538
538
  if (u) {
539
- const m = Rn(u, t);
539
+ const m = Yn(u, t);
540
540
  o(m === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: g } : m === "SELECT" ? { selected: [{ id: c }], pointerEvent: g } : { selected: [], pointerEvent: g });
541
541
  } else
542
542
  console.warn("Invalid selection: " + c);
@@ -563,32 +563,32 @@ const Qe = { selected: [] }, Pn = (e, t = "EDIT") => {
563
563
  setSelected: d,
564
564
  subscribe: n
565
565
  };
566
- }, Rn = (e, t) => typeof t == "function" ? t(e) || "EDIT" : t || "EDIT", Yn = [];
566
+ }, Yn = (e, t) => typeof t == "function" ? t(e) || "EDIT" : t || "EDIT", Un = [];
567
567
  for (let e = 0; e < 256; ++e)
568
- Yn.push((e + 256).toString(16).slice(1));
568
+ Un.push((e + 256).toString(16).slice(1));
569
569
  typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
570
- const Un = (e, t) => {
570
+ const Dn = (e, t) => {
571
571
  const n = new Set(e.bodies.map((o) => o.id));
572
572
  return t.bodies.filter((o) => !n.has(o.id));
573
- }, Dn = (e, t) => {
573
+ }, Xn = (e, t) => {
574
574
  const n = new Set(t.bodies.map((o) => o.id));
575
575
  return e.bodies.filter((o) => !n.has(o.id));
576
- }, Xn = (e, t) => t.bodies.map((n) => {
576
+ }, Nn = (e, t) => t.bodies.map((n) => {
577
577
  const o = e.bodies.find((i) => i.id === n.id);
578
- return { newBody: n, oldBody: o && !he(o, n) ? o : void 0 };
579
- }).filter(({ oldBody: n }) => n), Nn = (e, t) => !he(e.target, t.target), Zt = (e, t) => {
580
- const n = Un(e, t), o = Dn(e, t), i = Xn(e, t);
578
+ return { newBody: n, oldBody: o && !fe(o, n) ? o : void 0 };
579
+ }).filter(({ oldBody: n }) => n), Gn = (e, t) => !fe(e.target, t.target), Qt = (e, t) => {
580
+ const n = Dn(e, t), o = Xn(e, t), i = Nn(e, t);
581
581
  return {
582
582
  oldValue: e,
583
583
  newValue: t,
584
584
  bodiesCreated: n.length > 0 ? n : void 0,
585
585
  bodiesDeleted: o.length > 0 ? o : void 0,
586
586
  bodiesUpdated: i.length > 0 ? i : void 0,
587
- targetUpdated: Nn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
587
+ targetUpdated: Gn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
588
588
  };
589
589
  };
590
590
  var G = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(G || {});
591
- const Gn = (e, t) => {
591
+ const Vn = (e, t) => {
592
592
  var n, o;
593
593
  const { changes: i, origin: s } = t;
594
594
  if (!(!e.options.origin || e.options.origin === s))
@@ -610,7 +610,7 @@ const Gn = (e, t) => {
610
610
  return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((a) => r.has(a));
611
611
  } else
612
612
  return !0;
613
- }, Vn = (e, t) => {
613
+ }, zn = (e, t) => {
614
614
  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 = [
615
615
  ...(e.created || []).filter((c) => !s.has(c.id)).map((c) => r.has(c.id) ? t.updated.find(({ oldValue: g }) => g.id === c.id).newValue : c),
616
616
  ...t.created || []
@@ -622,58 +622,58 @@ const Gn = (e, t) => {
622
622
  const { oldValue: g, newValue: u } = c;
623
623
  if (r.has(u.id)) {
624
624
  const m = t.updated.find((w) => w.oldValue.id === u.id).newValue;
625
- return Zt(g, m);
625
+ return Qt(g, m);
626
626
  } else
627
627
  return c;
628
628
  }),
629
629
  ...(t.updated || []).filter(({ oldValue: c }) => !a.has(c.id))
630
630
  ];
631
631
  return { created: l, deleted: d, updated: h };
632
- }, zn = (e) => e.id !== void 0, Fn = () => {
633
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (y, A = {}) => n.push({ onChange: y, options: A }), i = (y) => {
634
- const A = n.findIndex((E) => E.onChange == y);
635
- A > -1 && n.splice(A, 1);
636
- }, s = (y, A) => {
632
+ }, Fn = (e) => e.id !== void 0, Hn = () => {
633
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (y, T = {}) => n.push({ onChange: y, options: T }), i = (y) => {
634
+ const T = n.findIndex((E) => E.onChange == y);
635
+ T > -1 && n.splice(T, 1);
636
+ }, s = (y, T) => {
637
637
  const E = {
638
638
  origin: y,
639
639
  changes: {
640
- created: A.created || [],
641
- updated: A.updated || [],
642
- deleted: A.deleted || []
640
+ created: T.created || [],
641
+ updated: T.updated || [],
642
+ deleted: T.deleted || []
643
643
  },
644
644
  state: [...e.values()]
645
645
  };
646
646
  n.forEach((v) => {
647
- Gn(v, E) && v.onChange(E);
647
+ Vn(v, E) && v.onChange(E);
648
648
  });
649
- }, r = (y, A = G.LOCAL) => {
649
+ }, r = (y, T = G.LOCAL) => {
650
650
  if (e.get(y.id))
651
651
  throw Error(`Cannot add annotation ${y.id} - exists already`);
652
- e.set(y.id, y), y.bodies.forEach((E) => t.set(E.id, y.id)), s(A, { created: [y] });
653
- }, a = (y, A) => {
654
- const E = typeof y == "string" ? A : y, v = typeof y == "string" ? y : y.id, B = e.get(v);
655
- if (B) {
656
- const Y = Zt(B, E);
657
- return v === E.id ? e.set(v, E) : (e.delete(v), e.set(E.id, E)), B.bodies.forEach((Q) => t.delete(Q.id)), E.bodies.forEach((Q) => t.set(Q.id, E.id)), Y;
652
+ e.set(y.id, y), y.bodies.forEach((E) => t.set(E.id, y.id)), s(T, { created: [y] });
653
+ }, a = (y, T) => {
654
+ const E = typeof y == "string" ? T : y, v = typeof y == "string" ? y : y.id, I = e.get(v);
655
+ if (I) {
656
+ const Y = Qt(I, E);
657
+ return v === E.id ? e.set(v, E) : (e.delete(v), e.set(E.id, E)), I.bodies.forEach((Z) => t.delete(Z.id)), E.bodies.forEach((Z) => t.set(Z.id, E.id)), Y;
658
658
  } else
659
659
  console.warn(`Cannot update annotation ${v} - does not exist`);
660
- }, l = (y, A = G.LOCAL, E = G.LOCAL) => {
661
- const v = zn(A) ? E : A, B = a(y, A);
662
- B && s(v, { updated: [B] });
663
- }, d = (y, A = G.LOCAL) => {
664
- const E = y.reduce((v, B) => {
665
- const Y = a(B);
660
+ }, l = (y, T = G.LOCAL, E = G.LOCAL) => {
661
+ const v = Fn(T) ? E : T, I = a(y, T);
662
+ I && s(v, { updated: [I] });
663
+ }, d = (y, T = G.LOCAL) => {
664
+ const E = y.reduce((v, I) => {
665
+ const Y = a(I);
666
666
  return Y ? [...v, Y] : v;
667
667
  }, []);
668
- E.length > 0 && s(A, { updated: E });
669
- }, h = (y, A = G.LOCAL) => {
668
+ E.length > 0 && s(T, { updated: E });
669
+ }, h = (y, T = G.LOCAL) => {
670
670
  const E = e.get(y.annotation);
671
671
  if (E) {
672
672
  const v = {
673
673
  ...E,
674
674
  bodies: [...E.bodies, y]
675
675
  };
676
- e.set(E.id, v), t.set(y.id, v.id), s(A, { updated: [{
676
+ e.set(E.id, v), t.set(y.id, v.id), s(T, { updated: [{
677
677
  oldValue: E,
678
678
  newValue: v,
679
679
  bodiesCreated: [y]
@@ -681,52 +681,52 @@ const Gn = (e, t) => {
681
681
  } else
682
682
  console.warn(`Attempt to add body to missing annotation: ${y.annotation}`);
683
683
  }, c = () => [...e.values()], g = (y = G.LOCAL) => {
684
- const A = [...e.values()];
685
- e.clear(), t.clear(), s(y, { deleted: A });
686
- }, u = (y, A = !0, E = G.LOCAL) => {
687
- if (A) {
684
+ const T = [...e.values()];
685
+ e.clear(), t.clear(), s(y, { deleted: T });
686
+ }, u = (y, T = !0, E = G.LOCAL) => {
687
+ if (T) {
688
688
  const v = [...e.values()];
689
- e.clear(), t.clear(), y.forEach((B) => {
690
- e.set(B.id, B), B.bodies.forEach((Y) => t.set(Y.id, B.id));
689
+ e.clear(), t.clear(), y.forEach((I) => {
690
+ e.set(I.id, I), I.bodies.forEach((Y) => t.set(Y.id, I.id));
691
691
  }), s(E, { created: y, deleted: v });
692
692
  } else {
693
- const v = y.reduce((B, Y) => {
694
- const Q = e.get(Y.id);
695
- return Q ? [...B, Q] : B;
693
+ const v = y.reduce((I, Y) => {
694
+ const Z = e.get(Y.id);
695
+ return Z ? [...I, Z] : I;
696
696
  }, []);
697
697
  if (v.length > 0)
698
- throw Error(`Bulk insert would overwrite the following annotations: ${v.map((B) => B.id).join(", ")}`);
699
- y.forEach((B) => {
700
- e.set(B.id, B), B.bodies.forEach((Y) => t.set(Y.id, B.id));
698
+ throw Error(`Bulk insert would overwrite the following annotations: ${v.map((I) => I.id).join(", ")}`);
699
+ y.forEach((I) => {
700
+ e.set(I.id, I), I.bodies.forEach((Y) => t.set(Y.id, I.id));
701
701
  }), s(E, { created: y });
702
702
  }
703
703
  }, m = (y) => {
704
- const A = typeof y == "string" ? y : y.id, E = e.get(A);
704
+ const T = typeof y == "string" ? y : y.id, E = e.get(T);
705
705
  if (E)
706
- return e.delete(A), E.bodies.forEach((v) => t.delete(v.id)), E;
707
- console.warn(`Attempt to delete missing annotation: ${A}`);
708
- }, w = (y, A = G.LOCAL) => {
706
+ return e.delete(T), E.bodies.forEach((v) => t.delete(v.id)), E;
707
+ console.warn(`Attempt to delete missing annotation: ${T}`);
708
+ }, w = (y, T = G.LOCAL) => {
709
709
  const E = m(y);
710
- E && s(A, { deleted: [E] });
711
- }, b = (y, A = G.LOCAL) => {
712
- const E = y.reduce((v, B) => {
713
- const Y = m(B);
710
+ E && s(T, { deleted: [E] });
711
+ }, b = (y, T = G.LOCAL) => {
712
+ const E = y.reduce((v, I) => {
713
+ const Y = m(I);
714
714
  return Y ? [...v, Y] : v;
715
715
  }, []);
716
- E.length > 0 && s(A, { deleted: E });
717
- }, _ = (y, A = G.LOCAL) => {
716
+ E.length > 0 && s(T, { deleted: E });
717
+ }, _ = (y, T = G.LOCAL) => {
718
718
  const E = e.get(y.annotation);
719
719
  if (E) {
720
- const v = E.bodies.find((B) => B.id === y.id);
720
+ const v = E.bodies.find((I) => I.id === y.id);
721
721
  if (v) {
722
722
  t.delete(v.id);
723
- const B = {
723
+ const I = {
724
724
  ...E,
725
725
  bodies: E.bodies.filter((Y) => Y.id !== y.id)
726
726
  };
727
- e.set(E.id, B), s(A, { updated: [{
727
+ e.set(E.id, I), s(T, { updated: [{
728
728
  oldValue: E,
729
- newValue: B,
729
+ newValue: I,
730
730
  bodiesDeleted: [v]
731
731
  }] });
732
732
  } else
@@ -734,54 +734,54 @@ const Gn = (e, t) => {
734
734
  } else
735
735
  console.warn(`Attempt to delete body from missing annotation ${y.annotation}`);
736
736
  }, p = (y) => {
737
- const A = e.get(y);
738
- return A ? { ...A } : void 0;
739
- }, T = (y) => {
740
- const A = t.get(y);
741
- if (A) {
742
- const E = p(A).bodies.find((v) => v.id === y);
737
+ const T = e.get(y);
738
+ return T ? { ...T } : void 0;
739
+ }, A = (y) => {
740
+ const T = t.get(y);
741
+ if (T) {
742
+ const E = p(T).bodies.find((v) => v.id === y);
743
743
  if (E)
744
744
  return E;
745
745
  console.error(`Store integrity error: body ${y} in index, but not in annotation`);
746
746
  } else
747
747
  console.warn(`Attempt to retrieve missing body: ${y}`);
748
- }, S = (y, A) => {
749
- if (y.annotation !== A.annotation)
748
+ }, S = (y, T) => {
749
+ if (y.annotation !== T.annotation)
750
750
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
751
751
  const E = e.get(y.annotation);
752
752
  if (E) {
753
- const v = E.bodies.find((Y) => Y.id === y.id), B = {
753
+ const v = E.bodies.find((Y) => Y.id === y.id), I = {
754
754
  ...E,
755
- bodies: E.bodies.map((Y) => Y.id === v.id ? A : Y)
755
+ bodies: E.bodies.map((Y) => Y.id === v.id ? T : Y)
756
756
  };
757
- return e.set(E.id, B), v.id !== A.id && (t.delete(v.id), t.set(A.id, B.id)), {
757
+ return e.set(E.id, I), v.id !== T.id && (t.delete(v.id), t.set(T.id, I.id)), {
758
758
  oldValue: E,
759
- newValue: B,
760
- bodiesUpdated: [{ oldBody: v, newBody: A }]
759
+ newValue: I,
760
+ bodiesUpdated: [{ oldBody: v, newBody: T }]
761
761
  };
762
762
  } else
763
763
  console.warn(`Attempt to add body to missing annotation ${y.annotation}`);
764
- }, I = (y, A, E = G.LOCAL) => {
765
- const v = S(y, A);
764
+ }, C = (y, T, E = G.LOCAL) => {
765
+ const v = S(y, T);
766
766
  s(E, { updated: [v] });
767
- }, R = (y, A = G.LOCAL) => {
767
+ }, R = (y, T = G.LOCAL) => {
768
768
  const E = y.map((v) => S({ id: v.id, annotation: v.annotation }, v));
769
- s(A, { updated: E });
770
- }, N = (y) => {
771
- const A = e.get(y.annotation);
772
- if (A) {
769
+ s(T, { updated: E });
770
+ }, X = (y) => {
771
+ const T = e.get(y.annotation);
772
+ if (T) {
773
773
  const E = {
774
- ...A,
774
+ ...T,
775
775
  target: {
776
- ...A.target,
776
+ ...T.target,
777
777
  ...y
778
778
  }
779
779
  };
780
- return e.set(A.id, E), {
781
- oldValue: A,
780
+ return e.set(T.id, E), {
781
+ oldValue: T,
782
782
  newValue: E,
783
783
  targetUpdated: {
784
- oldTarget: A.target,
784
+ oldTarget: T.target,
785
785
  newTarget: y
786
786
  }
787
787
  };
@@ -796,32 +796,32 @@ const Gn = (e, t) => {
796
796
  bulkDeleteAnnotation: b,
797
797
  bulkUpdateAnnotation: d,
798
798
  bulkUpdateBodies: R,
799
- bulkUpdateTargets: (y, A = G.LOCAL) => {
800
- const E = y.map(N).filter((v) => v);
801
- E.length > 0 && s(A, { updated: E });
799
+ bulkUpdateTargets: (y, T = G.LOCAL) => {
800
+ const E = y.map(X).filter((v) => v);
801
+ E.length > 0 && s(T, { updated: E });
802
802
  },
803
803
  clear: g,
804
804
  deleteAnnotation: w,
805
805
  deleteBody: _,
806
806
  getAnnotation: p,
807
- getBody: T,
807
+ getBody: A,
808
808
  observe: o,
809
809
  unobserve: i,
810
810
  updateAnnotation: l,
811
- updateBody: I,
812
- updateTarget: (y, A = G.LOCAL) => {
813
- const E = N(y);
814
- E && s(A, { updated: [E] });
811
+ updateBody: C,
812
+ updateTarget: (y, T = G.LOCAL) => {
813
+ const E = X(y);
814
+ E && s(T, { updated: [E] });
815
815
  }
816
816
  };
817
- }, Hn = (e) => ({
817
+ }, jn = (e) => ({
818
818
  ...e,
819
819
  subscribe: (t) => {
820
820
  const n = (o) => t(o.state);
821
821
  return e.observe(n), t(e.all()), () => e.unobserve(n);
822
822
  }
823
823
  });
824
- let jn = () => ({
824
+ let qn = () => ({
825
825
  emit(e, ...t) {
826
826
  let n = this.events[e] || [];
827
827
  for (let o = 0, i = n.length; o < i; o++)
@@ -836,17 +836,17 @@ let jn = () => ({
836
836
  };
837
837
  }
838
838
  });
839
- const qn = 250, Wn = (e) => {
840
- const t = jn(), n = [];
839
+ const Wn = 250, Jn = (e) => {
840
+ const t = qn(), n = [];
841
841
  let o = -1, i = !1, s = 0;
842
842
  const r = (u) => {
843
843
  if (!i) {
844
844
  const { changes: m } = u, w = performance.now();
845
- if (w - s > qn)
845
+ if (w - s > Wn)
846
846
  n.splice(o + 1), n.push(m), o = n.length - 1;
847
847
  else {
848
848
  const b = n.length - 1;
849
- n[b] = Vn(n[b], m);
849
+ n[b] = zn(n[b], m);
850
850
  }
851
851
  s = w;
852
852
  }
@@ -874,36 +874,36 @@ const qn = 250, Wn = (e) => {
874
874
  }
875
875
  }
876
876
  };
877
- }, Jn = () => {
878
- const { subscribe: e, set: t } = dt([]);
877
+ }, Kn = () => {
878
+ const { subscribe: e, set: t } = ut([]);
879
879
  return {
880
880
  subscribe: e,
881
881
  set: t
882
882
  };
883
- }, Kn = (e, t, n, o) => {
883
+ }, Zn = (e, t, n, o) => {
884
884
  const { store: i, selection: s, hover: r, viewport: a } = e, l = /* @__PURE__ */ new Map();
885
885
  let d = [], h, c;
886
886
  const g = (_, p) => {
887
887
  l.has(_) ? l.get(_).push(p) : l.set(_, [p]);
888
888
  }, u = (_, p) => {
889
- const T = l.get(_);
890
- T && T.indexOf(p) > 0 && T.splice(T.indexOf(p), 1);
891
- }, m = (_, p, T) => {
889
+ const A = l.get(_);
890
+ A && A.indexOf(p) > 0 && A.splice(A.indexOf(p), 1);
891
+ }, m = (_, p, A) => {
892
892
  l.has(_) && setTimeout(() => {
893
893
  l.get(_).forEach((S) => {
894
894
  if (n) {
895
- const I = Array.isArray(p) ? p.map((N) => n.serialize(N)) : n.serialize(p), R = T ? T instanceof PointerEvent ? T : n.serialize(T) : void 0;
896
- S(I, R);
895
+ const C = Array.isArray(p) ? p.map((X) => n.serialize(X)) : n.serialize(p), R = A ? A instanceof PointerEvent ? A : n.serialize(A) : void 0;
896
+ S(C, R);
897
897
  } else
898
- S(p, T);
898
+ S(p, A);
899
899
  });
900
900
  }, 1);
901
901
  }, w = () => {
902
- const { selected: _ } = s, p = _.map(({ id: T }) => i.getAnnotation(T));
903
- p.forEach((T) => {
904
- const S = d.find((I) => I.id === T.id);
905
- (!S || !he(S, T)) && m("updateAnnotation", T, S);
906
- }), d = d.map((T) => p.find(({ id: I }) => I === T.id) || T);
902
+ const { selected: _ } = s, p = _.map(({ id: A }) => i.getAnnotation(A));
903
+ p.forEach((A) => {
904
+ const S = d.find((C) => C.id === A.id);
905
+ (!S || !fe(S, A)) && m("updateAnnotation", A, S);
906
+ }), d = d.map((A) => p.find(({ id: C }) => C === A.id) || A);
907
907
  };
908
908
  s.subscribe(({ selected: _ }) => {
909
909
  if (!(d.length === 0 && _.length === 0)) {
@@ -911,17 +911,17 @@ const qn = 250, Wn = (e) => {
911
911
  d = _.map(({ id: p }) => i.getAnnotation(p));
912
912
  else if (d.length > 0 && _.length === 0)
913
913
  d.forEach((p) => {
914
- const T = i.getAnnotation(p.id);
915
- T && !he(T, p) && m("updateAnnotation", T, p);
914
+ const A = i.getAnnotation(p.id);
915
+ A && !fe(A, p) && m("updateAnnotation", A, p);
916
916
  }), d = [];
917
917
  else {
918
- const p = new Set(d.map((S) => S.id)), T = new Set(_.map(({ id: S }) => S));
919
- d.filter((S) => !T.has(S.id)).forEach((S) => {
920
- const I = i.getAnnotation(S.id);
921
- I && !he(I, S) && m("updateAnnotation", I, S);
918
+ const p = new Set(d.map((S) => S.id)), A = new Set(_.map(({ id: S }) => S));
919
+ d.filter((S) => !A.has(S.id)).forEach((S) => {
920
+ const C = i.getAnnotation(S.id);
921
+ C && !fe(C, S) && m("updateAnnotation", C, S);
922
922
  }), d = [
923
923
  // Remove annotations that were deselected
924
- ...d.filter((S) => T.has(S.id)),
924
+ ...d.filter((S) => A.has(S.id)),
925
925
  // Add editable annotations that were selected
926
926
  ..._.filter(({ id: S }) => !p.has(S)).map(({ id: S }) => i.getAnnotation(S))
927
927
  ];
@@ -932,27 +932,27 @@ const qn = 250, Wn = (e) => {
932
932
  !h && _ ? m("mouseEnterAnnotation", i.getAnnotation(_)) : h && !_ ? m("mouseLeaveAnnotation", i.getAnnotation(h)) : h && _ && (m("mouseLeaveAnnotation", i.getAnnotation(h)), m("mouseEnterAnnotation", i.getAnnotation(_))), h = _;
933
933
  }), a == null || a.subscribe((_) => m("viewportIntersect", _.map(i.getAnnotation))), i.observe((_) => {
934
934
  o && (c && clearTimeout(c), c = setTimeout(w, 1e3));
935
- const { created: p, deleted: T } = _.changes;
936
- p.forEach((S) => m("createAnnotation", S)), T.forEach((S) => m("deleteAnnotation", S)), _.changes.updated.filter((S) => [
935
+ const { created: p, deleted: A } = _.changes;
936
+ p.forEach((S) => m("createAnnotation", S)), A.forEach((S) => m("deleteAnnotation", S)), _.changes.updated.filter((S) => [
937
937
  ...S.bodiesCreated || [],
938
938
  ...S.bodiesDeleted || [],
939
939
  ...S.bodiesUpdated || []
940
- ].length > 0).forEach(({ oldValue: S, newValue: I }) => {
941
- const R = d.find((N) => N.id === S.id) || S;
942
- d = d.map((N) => N.id === S.id ? I : N), m("updateAnnotation", I, R);
940
+ ].length > 0).forEach(({ oldValue: S, newValue: C }) => {
941
+ const R = d.find((X) => X.id === S.id) || S;
942
+ d = d.map((X) => X.id === S.id ? C : X), m("updateAnnotation", C, R);
943
943
  });
944
944
  }, { origin: G.LOCAL }), i.observe((_) => {
945
945
  if (d) {
946
- const p = new Set(d.map((S) => S.id)), T = _.changes.updated.filter(({ newValue: S }) => p.has(S.id)).map(({ newValue: S }) => S);
947
- T.length > 0 && (d = d.map((S) => T.find((R) => R.id === S.id) || S));
946
+ const p = new Set(d.map((S) => S.id)), A = _.changes.updated.filter(({ newValue: S }) => p.has(S.id)).map(({ newValue: S }) => S);
947
+ A.length > 0 && (d = d.map((S) => A.find((R) => R.id === S.id) || S));
948
948
  }
949
949
  }, { origin: G.REMOTE });
950
950
  const b = (_) => (p) => {
951
- const { created: T, deleted: S, updated: I } = p;
952
- T.forEach((R) => m("createAnnotation", R)), S.forEach((R) => m("deleteAnnotation", R)), _ ? I.forEach((R) => m("updateAnnotation", R.oldValue, R.newValue)) : I.forEach((R) => m("updateAnnotation", R.newValue, R.oldValue));
951
+ const { created: A, deleted: S, updated: C } = p;
952
+ A.forEach((R) => m("createAnnotation", R)), S.forEach((R) => m("deleteAnnotation", R)), _ ? C.forEach((R) => m("updateAnnotation", R.oldValue, R.newValue)) : C.forEach((R) => m("updateAnnotation", R.newValue, R.oldValue));
953
953
  };
954
954
  return t.on("undo", b(!0)), t.on("redo", b(!1)), { on: g, off: u, emit: m };
955
- }, Zn = (e) => (t) => t.reduce((n, o) => {
955
+ }, Qn = (e) => (t) => t.reduce((n, o) => {
956
956
  const { parsed: i, error: s } = e.parse(o);
957
957
  return s ? {
958
958
  parsed: n.parsed,
@@ -961,7 +961,7 @@ const qn = 250, Wn = (e) => {
961
961
  parsed: [...n.parsed, i],
962
962
  failed: n.failed
963
963
  };
964
- }, { parsed: [], failed: [] }), Qn = (e, t, n) => {
964
+ }, { parsed: [], failed: [] }), xn = (e, t, n) => {
965
965
  const { store: o, selection: i } = e, s = (b) => {
966
966
  if (n) {
967
967
  const { parsed: _, error: p } = n.parse(b);
@@ -985,7 +985,7 @@ const qn = 250, Wn = (e) => {
985
985
  }
986
986
  }, u = (b) => {
987
987
  if (n) {
988
- const { parsed: _, failed: p } = Zn(n)(b);
988
+ const { parsed: _, failed: p } = Qn(n)(b);
989
989
  p.length > 0 && console.warn(`Discarded ${p.length} invalid annotations`, p), o.bulkAddAnnotation(_, !0, G.REMOTE);
990
990
  } else
991
991
  o.bulkAddAnnotation(b, !0, G.REMOTE);
@@ -1018,7 +1018,7 @@ const qn = 250, Wn = (e) => {
1018
1018
  updateAnnotation: w
1019
1019
  };
1020
1020
  };
1021
- let xn = (e) => crypto.getRandomValues(new Uint8Array(e)), $n = (e, t, n) => {
1021
+ let $n = (e) => crypto.getRandomValues(new Uint8Array(e)), eo = (e, t, n) => {
1022
1022
  let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * t / e.length);
1023
1023
  return (s = t) => {
1024
1024
  let r = "";
@@ -1029,8 +1029,8 @@ let xn = (e) => crypto.getRandomValues(new Uint8Array(e)), $n = (e, t, n) => {
1029
1029
  return r;
1030
1030
  }
1031
1031
  };
1032
- }, eo = (e, t = 21) => $n(e, t, xn), to = (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), "");
1033
- const no = () => ({ isGuest: !0, id: eo("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), oo = (e) => {
1032
+ }, to = (e, t = 21) => eo(e, t, $n), no = (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), "");
1033
+ const oo = () => ({ isGuest: !0, id: to("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), io = (e) => {
1034
1034
  const t = JSON.stringify(e);
1035
1035
  let n = 0;
1036
1036
  for (let o = 0, i = t.length; o < i; o++) {
@@ -1038,10 +1038,10 @@ const no = () => ({ isGuest: !0, id: eo("1234567890abcdefghijklmnopqrstuvwxyzABC
1038
1038
  n = (n << 5) - n + s, n |= 0;
1039
1039
  }
1040
1040
  return `${n}`;
1041
- }, io = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
1041
+ }, so = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
1042
1042
  const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...d } = n;
1043
1043
  return {
1044
- id: o || `temp-${oo(n)}`,
1044
+ id: o || `temp-${io(n)}`,
1045
1045
  annotation: t,
1046
1046
  type: i,
1047
1047
  purpose: s,
@@ -1050,14 +1050,14 @@ const no = () => ({ isGuest: !0, id: eo("1234567890abcdefghijklmnopqrstuvwxyzABC
1050
1050
  creator: l ? typeof l == "object" ? { ...l } : l : void 0,
1051
1051
  ...d
1052
1052
  };
1053
- }), so = (e) => e.map((t) => {
1053
+ }), ro = (e) => e.map((t) => {
1054
1054
  var n;
1055
1055
  const o = { ...t };
1056
1056
  return delete o.annotation, (n = o.id) != null && n.startsWith("temp-") && delete o.id, o;
1057
1057
  });
1058
- to();
1059
- const Di = (e, t = !1) => ({ parse: (i) => ro(i, t), serialize: (i) => lo(i, e) }), ro = (e, t = !1) => {
1060
- const n = e.id || ct(), { body: o, ...i } = e, s = io(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" ? wn(a, t) : a.type === "SvgSelector" ? vn(a) : void 0;
1058
+ no();
1059
+ const Di = (e, t = !1) => ({ parse: (i) => lo(i, t), serialize: (i) => ao(i, e) }), lo = (e, t = !1) => {
1060
+ const n = e.id || dt(), { body: o, ...i } = e, s = so(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" ? bn(a, t) : a.type === "SvgSelector" ? vn(a) : void 0;
1061
1061
  return l ? {
1062
1062
  parsed: {
1063
1063
  ...i,
@@ -1072,25 +1072,25 @@ const Di = (e, t = !1) => ({ parse: (i) => ro(i, t), serialize: (i) => lo(i, e)
1072
1072
  } : {
1073
1073
  error: Error(`Unknown selector type: ${a.type}`)
1074
1074
  };
1075
- }, lo = (e, t) => {
1076
- const n = e.target.selector, o = n.type == F.RECTANGLE ? bn(n.geometry) : Mn(n);
1075
+ }, ao = (e, t) => {
1076
+ const n = e.target.selector, o = n.type == H.RECTANGLE ? En(n.geometry) : On(n);
1077
1077
  return {
1078
1078
  ...e,
1079
1079
  "@context": "http://www.w3.org/ns/anno.jsonld",
1080
1080
  id: e.id,
1081
1081
  type: "Annotation",
1082
- body: so(e.bodies),
1082
+ body: ro(e.bodies),
1083
1083
  target: {
1084
1084
  source: t,
1085
1085
  selector: o
1086
1086
  }
1087
1087
  };
1088
1088
  };
1089
- function bt(e, t, n) {
1089
+ function Et(e, t, n) {
1090
1090
  const o = e.slice();
1091
1091
  return o[11] = t[n], o[13] = n, o;
1092
1092
  }
1093
- function Et(e) {
1093
+ function At(e) {
1094
1094
  let t, n, o, i, s;
1095
1095
  return {
1096
1096
  c() {
@@ -1111,8 +1111,8 @@ function Et(e) {
1111
1111
  );
1112
1112
  },
1113
1113
  m(r, a) {
1114
- k(r, t, a), i || (s = W(t, "pointerdown", function() {
1115
- H(
1114
+ B(r, t, a), i || (s = W(t, "pointerdown", function() {
1115
+ j(
1116
1116
  /*grab*/
1117
1117
  e[10](O(
1118
1118
  /*idx*/
@@ -1146,45 +1146,45 @@ function Et(e) {
1146
1146
  );
1147
1147
  },
1148
1148
  d(r) {
1149
- r && L(t), i = !1, s();
1149
+ r && k(t), i = !1, s();
1150
1150
  }
1151
1151
  };
1152
1152
  }
1153
- function ao(e) {
1153
+ function co(e) {
1154
1154
  let t, n, o, i, s, r, a, l, d, h, c = (
1155
1155
  /*geom*/
1156
1156
  e[4].points
1157
1157
  ), g = [];
1158
1158
  for (let u = 0; u < c.length; u += 1)
1159
- g[u] = Et(bt(e, c, u));
1159
+ g[u] = At(Et(e, c, u));
1160
1160
  return {
1161
1161
  c() {
1162
- t = U("polygon"), i = ee(), s = U("polygon"), a = ee();
1162
+ t = U("polygon"), i = $(), s = U("polygon"), a = $();
1163
1163
  for (let u = 0; u < g.length; u += 1)
1164
1164
  g[u].c();
1165
- l = le(), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
1165
+ l = se(), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
1166
1166
  e[1] ? "display:none;" : void 0), f(t, "points", o = /*geom*/
1167
- e[4].points.map(At).join(" ")), f(s, "class", "a9s-inner a9s-shape-handle"), f(
1167
+ e[4].points.map(Tt).join(" ")), f(s, "class", "a9s-inner a9s-shape-handle"), f(
1168
1168
  s,
1169
1169
  "style",
1170
1170
  /*computedStyle*/
1171
1171
  e[1]
1172
1172
  ), f(s, "points", r = /*geom*/
1173
- e[4].points.map(Tt).join(" "));
1173
+ e[4].points.map(St).join(" "));
1174
1174
  },
1175
1175
  m(u, m) {
1176
- k(u, t, m), k(u, i, m), k(u, s, m), k(u, a, m);
1176
+ B(u, t, m), B(u, i, m), B(u, s, m), B(u, a, m);
1177
1177
  for (let w = 0; w < g.length; w += 1)
1178
1178
  g[w] && g[w].m(u, m);
1179
- k(u, l, m), d || (h = [
1179
+ B(u, l, m), d || (h = [
1180
1180
  W(t, "pointerdown", function() {
1181
- H(
1181
+ j(
1182
1182
  /*grab*/
1183
1183
  e[10](O.SHAPE)
1184
1184
  ) && e[10](O.SHAPE).apply(this, arguments);
1185
1185
  }),
1186
1186
  W(s, "pointerdown", function() {
1187
- H(
1187
+ j(
1188
1188
  /*grab*/
1189
1189
  e[10](O.SHAPE)
1190
1190
  ) && e[10](O.SHAPE).apply(this, arguments);
@@ -1196,7 +1196,7 @@ function ao(e) {
1196
1196
  2 && n !== (n = /*computedStyle*/
1197
1197
  e[1] ? "display:none;" : void 0) && f(t, "style", n), m & /*geom*/
1198
1198
  16 && o !== (o = /*geom*/
1199
- e[4].points.map(At).join(" ")) && f(t, "points", o), m & /*computedStyle*/
1199
+ e[4].points.map(Tt).join(" ")) && f(t, "points", o), m & /*computedStyle*/
1200
1200
  2 && f(
1201
1201
  s,
1202
1202
  "style",
@@ -1204,14 +1204,14 @@ function ao(e) {
1204
1204
  e[1]
1205
1205
  ), m & /*geom*/
1206
1206
  16 && r !== (r = /*geom*/
1207
- e[4].points.map(Tt).join(" ")) && f(s, "points", r), m & /*geom, handleSize, grab, Handle*/
1207
+ e[4].points.map(St).join(" ")) && f(s, "points", r), m & /*geom, handleSize, grab, Handle*/
1208
1208
  1048) {
1209
1209
  c = /*geom*/
1210
1210
  e[4].points;
1211
1211
  let w;
1212
1212
  for (w = 0; w < c.length; w += 1) {
1213
- const b = bt(e, c, w);
1214
- g[w] ? g[w].p(b, m) : (g[w] = Et(b), g[w].c(), g[w].m(l.parentNode, l));
1213
+ const b = Et(e, c, w);
1214
+ g[w] ? g[w].p(b, m) : (g[w] = At(b), g[w].c(), g[w].m(l.parentNode, l));
1215
1215
  }
1216
1216
  for (; w < g.length; w += 1)
1217
1217
  g[w].d(1);
@@ -1219,13 +1219,13 @@ function ao(e) {
1219
1219
  }
1220
1220
  },
1221
1221
  d(u) {
1222
- u && L(t), u && L(i), u && L(s), u && L(a), rt(g, u), u && L(l), d = !1, re(h);
1222
+ u && k(t), u && k(i), u && k(s), u && k(a), lt(g, u), u && k(l), d = !1, ie(h);
1223
1223
  }
1224
1224
  };
1225
1225
  }
1226
- function co(e) {
1226
+ function uo(e) {
1227
1227
  let t, n;
1228
- return t = new xt({
1228
+ return t = new $t({
1229
1229
  props: {
1230
1230
  shape: (
1231
1231
  /*shape*/
@@ -1241,7 +1241,7 @@ function co(e) {
1241
1241
  ),
1242
1242
  $$slots: {
1243
1243
  default: [
1244
- ao,
1244
+ co,
1245
1245
  ({ grab: o }) => ({ 10: o }),
1246
1246
  ({ grab: o }) => o ? 1024 : 0
1247
1247
  ]
@@ -1262,10 +1262,10 @@ function co(e) {
1262
1262
  e[9]
1263
1263
  ), {
1264
1264
  c() {
1265
- ge(t.$$.fragment);
1265
+ he(t.$$.fragment);
1266
1266
  },
1267
1267
  m(o, i) {
1268
- ce(t, o, i), n = !0;
1268
+ le(t, o, i), n = !0;
1269
1269
  },
1270
1270
  p(o, [i]) {
1271
1271
  const s = {};
@@ -1280,30 +1280,30 @@ function co(e) {
1280
1280
  n || (D(t.$$.fragment, o), n = !0);
1281
1281
  },
1282
1282
  o(o) {
1283
- X(t.$$.fragment, o), n = !1;
1283
+ N(t.$$.fragment, o), n = !1;
1284
1284
  },
1285
1285
  d(o) {
1286
- de(t, o);
1286
+ ae(t, o);
1287
1287
  }
1288
1288
  };
1289
1289
  }
1290
- const At = (e) => e.join(","), Tt = (e) => e.join(",");
1291
- function uo(e, t, n) {
1290
+ const Tt = (e) => e.join(","), St = (e) => e.join(",");
1291
+ function fo(e, t, n) {
1292
1292
  let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
1293
1293
  const d = (u, m, w) => {
1294
1294
  let b;
1295
- m === O.SHAPE ? b = u.geometry.points.map(([p, T]) => [p + w[0], T + w[1]]) : b = u.geometry.points.map(([p, T], S) => m === O(S) ? [p + w[0], T + w[1]] : [p, T]);
1295
+ m === O.SHAPE ? b = u.geometry.points.map(([p, A]) => [p + w[0], A + w[1]]) : b = u.geometry.points.map(([p, A], S) => m === O(S) ? [p + w[0], A + w[1]] : [p, A]);
1296
1296
  const _ = Fe(b);
1297
1297
  return { ...u, geometry: { points: b, bounds: _ } };
1298
1298
  };
1299
1299
  function h(u) {
1300
- Te.call(this, e, u);
1300
+ Ae.call(this, e, u);
1301
1301
  }
1302
1302
  function c(u) {
1303
- Te.call(this, e, u);
1303
+ Ae.call(this, e, u);
1304
1304
  }
1305
1305
  function g(u) {
1306
- Te.call(this, e, u);
1306
+ Ae.call(this, e, u);
1307
1307
  }
1308
1308
  return e.$$set = (u) => {
1309
1309
  "shape" in u && n(0, s = u.shape), "computedStyle" in u && n(1, r = u.computedStyle), "transform" in u && n(2, a = u.transform), "viewportScale" in u && n(6, l = u.viewportScale);
@@ -1324,9 +1324,9 @@ function uo(e, t, n) {
1324
1324
  g
1325
1325
  ];
1326
1326
  }
1327
- class fo extends ne {
1327
+ class ho extends te {
1328
1328
  constructor(t) {
1329
- super(), te(this, t, uo, co, Z, {
1329
+ super(), ee(this, t, fo, uo, K, {
1330
1330
  shape: 0,
1331
1331
  computedStyle: 1,
1332
1332
  transform: 2,
@@ -1334,11 +1334,11 @@ class fo extends ne {
1334
1334
  });
1335
1335
  }
1336
1336
  }
1337
- function ho(e) {
1338
- let t, n, o, i, s, r, a, l, d, h, c, g, u, m, w, b, _, p, T, S, I, R, N, y, A, E, v, B, Y, Q, me, pe, Me, K, C, J, z, j, oe, ue, qe, x, Re, Ye, We, $, Ue, De, Je, ft;
1337
+ function go(e) {
1338
+ let t, n, o, i, s, r, a, l, d, h, c, g, u, m, w, b, _, p, A, S, C, R, X, y, T, E, v, I, Y, Z, ge, me, Me, L, J, V, ce, F, de, Pe, qe, Q, Re, Ye, We, x, Ue, De, Je, ht;
1339
1339
  return {
1340
1340
  c() {
1341
- t = U("rect"), a = ee(), l = U("rect"), u = ee(), m = U("rect"), p = ee(), T = U("rect"), N = ee(), y = U("rect"), B = ee(), Y = U("rect"), Me = ee(), K = U("rect"), z = ee(), j = U("rect"), qe = ee(), x = U("rect"), We = ee(), $ = U("rect"), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
1341
+ t = U("rect"), a = $(), l = U("rect"), u = $(), m = U("rect"), p = $(), A = U("rect"), X = $(), y = U("rect"), I = $(), Y = U("rect"), Me = $(), L = U("rect"), ce = $(), F = U("rect"), qe = $(), Q = U("rect"), We = $(), x = U("rect"), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
1342
1342
  e[1] ? "display:none;" : void 0), f(t, "x", o = /*geom*/
1343
1343
  e[4].x), f(t, "y", i = /*geom*/
1344
1344
  e[4].y), f(t, "width", s = /*geom*/
@@ -1355,137 +1355,137 @@ function ho(e) {
1355
1355
  e[4].h), f(m, "class", "a9s-edge-handle a9s-edge-handle-top"), f(m, "x", w = /*geom*/
1356
1356
  e[4].x), f(m, "y", b = /*geom*/
1357
1357
  e[4].y), f(m, "height", 1), f(m, "width", _ = /*geom*/
1358
- e[4].w), f(T, "class", "a9s-edge-handle a9s-edge-handle-right"), f(T, "x", S = /*geom*/
1358
+ e[4].w), f(A, "class", "a9s-edge-handle a9s-edge-handle-right"), f(A, "x", S = /*geom*/
1359
1359
  e[4].x + /*geom*/
1360
- e[4].w), f(T, "y", I = /*geom*/
1361
- e[4].y), f(T, "height", R = /*geom*/
1362
- e[4].h), f(T, "width", 1), f(y, "class", "a9s-edge-handle a9s-edge-handle-bottom"), f(y, "x", A = /*geom*/
1360
+ e[4].w), f(A, "y", C = /*geom*/
1361
+ e[4].y), f(A, "height", R = /*geom*/
1362
+ e[4].h), f(A, "width", 1), f(y, "class", "a9s-edge-handle a9s-edge-handle-bottom"), f(y, "x", T = /*geom*/
1363
1363
  e[4].x), f(y, "y", E = /*geom*/
1364
1364
  e[4].y + /*geom*/
1365
1365
  e[4].h), f(y, "height", 1), f(y, "width", v = /*geom*/
1366
- e[4].w), f(Y, "class", "a9s-edge-handle a9s-edge-handle-left"), f(Y, "x", Q = /*geom*/
1367
- e[4].x), f(Y, "y", me = /*geom*/
1368
- e[4].y), f(Y, "height", pe = /*geom*/
1369
- e[4].h), f(Y, "width", 1), f(K, "class", "a9s-corner-handle a9s-corner-handle-topleft"), f(K, "x", C = /*geom*/
1366
+ e[4].w), f(Y, "class", "a9s-edge-handle a9s-edge-handle-left"), f(Y, "x", Z = /*geom*/
1367
+ e[4].x), f(Y, "y", ge = /*geom*/
1368
+ e[4].y), f(Y, "height", me = /*geom*/
1369
+ e[4].h), f(Y, "width", 1), f(L, "class", "a9s-corner-handle a9s-corner-handle-topleft"), f(L, "x", J = /*geom*/
1370
1370
  e[4].x - /*handleSize*/
1371
- e[3] / 2), f(K, "y", J = /*geom*/
1371
+ e[3] / 2), f(L, "y", V = /*geom*/
1372
1372
  e[4].y - /*handleSize*/
1373
1373
  e[3] / 2), f(
1374
- K,
1374
+ L,
1375
1375
  "height",
1376
1376
  /*handleSize*/
1377
1377
  e[3]
1378
1378
  ), f(
1379
- K,
1379
+ L,
1380
1380
  "width",
1381
1381
  /*handleSize*/
1382
1382
  e[3]
1383
- ), f(j, "class", "a9s-corner-handle a9s-corner-handle-topright"), f(j, "x", oe = /*geom*/
1383
+ ), f(F, "class", "a9s-corner-handle a9s-corner-handle-topright"), f(F, "x", de = /*geom*/
1384
1384
  e[4].x + /*geom*/
1385
1385
  e[4].w - /*handleSize*/
1386
- e[3] / 2), f(j, "y", ue = /*geom*/
1386
+ e[3] / 2), f(F, "y", Pe = /*geom*/
1387
1387
  e[4].y - /*handleSize*/
1388
1388
  e[3] / 2), f(
1389
- j,
1389
+ F,
1390
1390
  "height",
1391
1391
  /*handleSize*/
1392
1392
  e[3]
1393
1393
  ), f(
1394
- j,
1394
+ F,
1395
1395
  "width",
1396
1396
  /*handleSize*/
1397
1397
  e[3]
1398
- ), f(x, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), f(x, "x", Re = /*geom*/
1398
+ ), f(Q, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), f(Q, "x", Re = /*geom*/
1399
1399
  e[4].x + /*geom*/
1400
1400
  e[4].w - /*handleSize*/
1401
- e[3] / 2), f(x, "y", Ye = /*geom*/
1401
+ e[3] / 2), f(Q, "y", Ye = /*geom*/
1402
1402
  e[4].y + /*geom*/
1403
1403
  e[4].h - /*handleSize*/
1404
1404
  e[3] / 2), f(
1405
- x,
1405
+ Q,
1406
1406
  "height",
1407
1407
  /*handleSize*/
1408
1408
  e[3]
1409
1409
  ), f(
1410
- x,
1410
+ Q,
1411
1411
  "width",
1412
1412
  /*handleSize*/
1413
1413
  e[3]
1414
- ), f($, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), f($, "x", Ue = /*geom*/
1414
+ ), f(x, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), f(x, "x", Ue = /*geom*/
1415
1415
  e[4].x - /*handleSize*/
1416
- e[3] / 2), f($, "y", De = /*geom*/
1416
+ e[3] / 2), f(x, "y", De = /*geom*/
1417
1417
  e[4].y + /*geom*/
1418
1418
  e[4].h - /*handleSize*/
1419
1419
  e[3] / 2), f(
1420
- $,
1420
+ x,
1421
1421
  "height",
1422
1422
  /*handleSize*/
1423
1423
  e[3]
1424
1424
  ), f(
1425
- $,
1425
+ x,
1426
1426
  "width",
1427
1427
  /*handleSize*/
1428
1428
  e[3]
1429
1429
  );
1430
1430
  },
1431
1431
  m(P, M) {
1432
- k(P, t, M), k(P, a, M), k(P, l, M), k(P, u, M), k(P, m, M), k(P, p, M), k(P, T, M), k(P, N, M), k(P, y, M), k(P, B, M), k(P, Y, M), k(P, Me, M), k(P, K, M), k(P, z, M), k(P, j, M), k(P, qe, M), k(P, x, M), k(P, We, M), k(P, $, M), Je || (ft = [
1432
+ B(P, t, M), B(P, a, M), B(P, l, M), B(P, u, M), B(P, m, M), B(P, p, M), B(P, A, M), B(P, X, M), B(P, y, M), B(P, I, M), B(P, Y, M), B(P, Me, M), B(P, L, M), B(P, ce, M), B(P, F, M), B(P, qe, M), B(P, Q, M), B(P, We, M), B(P, x, M), Je || (ht = [
1433
1433
  W(t, "pointerdown", function() {
1434
- H(
1434
+ j(
1435
1435
  /*grab*/
1436
1436
  e[10](O.SHAPE)
1437
1437
  ) && e[10](O.SHAPE).apply(this, arguments);
1438
1438
  }),
1439
1439
  W(l, "pointerdown", function() {
1440
- H(
1440
+ j(
1441
1441
  /*grab*/
1442
1442
  e[10](O.SHAPE)
1443
1443
  ) && e[10](O.SHAPE).apply(this, arguments);
1444
1444
  }),
1445
1445
  W(m, "pointerdown", function() {
1446
- H(
1446
+ j(
1447
1447
  /*grab*/
1448
1448
  e[10](O.TOP)
1449
1449
  ) && e[10](O.TOP).apply(this, arguments);
1450
1450
  }),
1451
- W(T, "pointerdown", function() {
1452
- H(
1451
+ W(A, "pointerdown", function() {
1452
+ j(
1453
1453
  /*grab*/
1454
1454
  e[10](O.RIGHT)
1455
1455
  ) && e[10](O.RIGHT).apply(this, arguments);
1456
1456
  }),
1457
1457
  W(y, "pointerdown", function() {
1458
- H(
1458
+ j(
1459
1459
  /*grab*/
1460
1460
  e[10](O.BOTTOM)
1461
1461
  ) && e[10](O.BOTTOM).apply(this, arguments);
1462
1462
  }),
1463
1463
  W(Y, "pointerdown", function() {
1464
- H(
1464
+ j(
1465
1465
  /*grab*/
1466
1466
  e[10](O.LEFT)
1467
1467
  ) && e[10](O.LEFT).apply(this, arguments);
1468
1468
  }),
1469
- W(K, "pointerdown", function() {
1470
- H(
1469
+ W(L, "pointerdown", function() {
1470
+ j(
1471
1471
  /*grab*/
1472
1472
  e[10](O.TOP_LEFT)
1473
1473
  ) && e[10](O.TOP_LEFT).apply(this, arguments);
1474
1474
  }),
1475
- W(j, "pointerdown", function() {
1476
- H(
1475
+ W(F, "pointerdown", function() {
1476
+ j(
1477
1477
  /*grab*/
1478
1478
  e[10](O.TOP_RIGHT)
1479
1479
  ) && e[10](O.TOP_RIGHT).apply(this, arguments);
1480
1480
  }),
1481
- W(x, "pointerdown", function() {
1482
- H(
1481
+ W(Q, "pointerdown", function() {
1482
+ j(
1483
1483
  /*grab*/
1484
1484
  e[10](O.BOTTOM_RIGHT)
1485
1485
  ) && e[10](O.BOTTOM_RIGHT).apply(this, arguments);
1486
1486
  }),
1487
- W($, "pointerdown", function() {
1488
- H(
1487
+ W(x, "pointerdown", function() {
1488
+ j(
1489
1489
  /*grab*/
1490
1490
  e[10](O.BOTTOM_LEFT)
1491
1491
  ) && e[10](O.BOTTOM_LEFT).apply(this, arguments);
@@ -1526,57 +1526,57 @@ function ho(e) {
1526
1526
  e[4].w) && f(m, "width", _), M & /*geom*/
1527
1527
  16 && S !== (S = /*geom*/
1528
1528
  e[4].x + /*geom*/
1529
- e[4].w) && f(T, "x", S), M & /*geom*/
1530
- 16 && I !== (I = /*geom*/
1531
- e[4].y) && f(T, "y", I), M & /*geom*/
1529
+ e[4].w) && f(A, "x", S), M & /*geom*/
1530
+ 16 && C !== (C = /*geom*/
1531
+ e[4].y) && f(A, "y", C), M & /*geom*/
1532
1532
  16 && R !== (R = /*geom*/
1533
- e[4].h) && f(T, "height", R), M & /*geom*/
1534
- 16 && A !== (A = /*geom*/
1535
- e[4].x) && f(y, "x", A), M & /*geom*/
1533
+ e[4].h) && f(A, "height", R), M & /*geom*/
1534
+ 16 && T !== (T = /*geom*/
1535
+ e[4].x) && f(y, "x", T), M & /*geom*/
1536
1536
  16 && E !== (E = /*geom*/
1537
1537
  e[4].y + /*geom*/
1538
1538
  e[4].h) && f(y, "y", E), M & /*geom*/
1539
1539
  16 && v !== (v = /*geom*/
1540
1540
  e[4].w) && f(y, "width", v), M & /*geom*/
1541
- 16 && Q !== (Q = /*geom*/
1542
- e[4].x) && f(Y, "x", Q), M & /*geom*/
1541
+ 16 && Z !== (Z = /*geom*/
1542
+ e[4].x) && f(Y, "x", Z), M & /*geom*/
1543
+ 16 && ge !== (ge = /*geom*/
1544
+ e[4].y) && f(Y, "y", ge), M & /*geom*/
1543
1545
  16 && me !== (me = /*geom*/
1544
- e[4].y) && f(Y, "y", me), M & /*geom*/
1545
- 16 && pe !== (pe = /*geom*/
1546
- e[4].h) && f(Y, "height", pe), M & /*geom, handleSize*/
1547
- 24 && C !== (C = /*geom*/
1548
- e[4].x - /*handleSize*/
1549
- e[3] / 2) && f(K, "x", C), M & /*geom, handleSize*/
1546
+ e[4].h) && f(Y, "height", me), M & /*geom, handleSize*/
1550
1547
  24 && J !== (J = /*geom*/
1548
+ e[4].x - /*handleSize*/
1549
+ e[3] / 2) && f(L, "x", J), M & /*geom, handleSize*/
1550
+ 24 && V !== (V = /*geom*/
1551
1551
  e[4].y - /*handleSize*/
1552
- e[3] / 2) && f(K, "y", J), M & /*handleSize*/
1552
+ e[3] / 2) && f(L, "y", V), M & /*handleSize*/
1553
1553
  8 && f(
1554
- K,
1554
+ L,
1555
1555
  "height",
1556
1556
  /*handleSize*/
1557
1557
  e[3]
1558
1558
  ), M & /*handleSize*/
1559
1559
  8 && f(
1560
- K,
1560
+ L,
1561
1561
  "width",
1562
1562
  /*handleSize*/
1563
1563
  e[3]
1564
1564
  ), M & /*geom, handleSize*/
1565
- 24 && oe !== (oe = /*geom*/
1565
+ 24 && de !== (de = /*geom*/
1566
1566
  e[4].x + /*geom*/
1567
1567
  e[4].w - /*handleSize*/
1568
- e[3] / 2) && f(j, "x", oe), M & /*geom, handleSize*/
1569
- 24 && ue !== (ue = /*geom*/
1568
+ e[3] / 2) && f(F, "x", de), M & /*geom, handleSize*/
1569
+ 24 && Pe !== (Pe = /*geom*/
1570
1570
  e[4].y - /*handleSize*/
1571
- e[3] / 2) && f(j, "y", ue), M & /*handleSize*/
1571
+ e[3] / 2) && f(F, "y", Pe), M & /*handleSize*/
1572
1572
  8 && f(
1573
- j,
1573
+ F,
1574
1574
  "height",
1575
1575
  /*handleSize*/
1576
1576
  e[3]
1577
1577
  ), M & /*handleSize*/
1578
1578
  8 && f(
1579
- j,
1579
+ F,
1580
1580
  "width",
1581
1581
  /*handleSize*/
1582
1582
  e[3]
@@ -1584,51 +1584,51 @@ function ho(e) {
1584
1584
  24 && Re !== (Re = /*geom*/
1585
1585
  e[4].x + /*geom*/
1586
1586
  e[4].w - /*handleSize*/
1587
- e[3] / 2) && f(x, "x", Re), M & /*geom, handleSize*/
1587
+ e[3] / 2) && f(Q, "x", Re), M & /*geom, handleSize*/
1588
1588
  24 && Ye !== (Ye = /*geom*/
1589
1589
  e[4].y + /*geom*/
1590
1590
  e[4].h - /*handleSize*/
1591
- e[3] / 2) && f(x, "y", Ye), M & /*handleSize*/
1591
+ e[3] / 2) && f(Q, "y", Ye), M & /*handleSize*/
1592
1592
  8 && f(
1593
- x,
1593
+ Q,
1594
1594
  "height",
1595
1595
  /*handleSize*/
1596
1596
  e[3]
1597
1597
  ), M & /*handleSize*/
1598
1598
  8 && f(
1599
- x,
1599
+ Q,
1600
1600
  "width",
1601
1601
  /*handleSize*/
1602
1602
  e[3]
1603
1603
  ), M & /*geom, handleSize*/
1604
1604
  24 && Ue !== (Ue = /*geom*/
1605
1605
  e[4].x - /*handleSize*/
1606
- e[3] / 2) && f($, "x", Ue), M & /*geom, handleSize*/
1606
+ e[3] / 2) && f(x, "x", Ue), M & /*geom, handleSize*/
1607
1607
  24 && De !== (De = /*geom*/
1608
1608
  e[4].y + /*geom*/
1609
1609
  e[4].h - /*handleSize*/
1610
- e[3] / 2) && f($, "y", De), M & /*handleSize*/
1610
+ e[3] / 2) && f(x, "y", De), M & /*handleSize*/
1611
1611
  8 && f(
1612
- $,
1612
+ x,
1613
1613
  "height",
1614
1614
  /*handleSize*/
1615
1615
  e[3]
1616
1616
  ), M & /*handleSize*/
1617
1617
  8 && f(
1618
- $,
1618
+ x,
1619
1619
  "width",
1620
1620
  /*handleSize*/
1621
1621
  e[3]
1622
1622
  );
1623
1623
  },
1624
1624
  d(P) {
1625
- P && L(t), P && L(a), P && L(l), P && L(u), P && L(m), P && L(p), P && L(T), P && L(N), P && L(y), P && L(B), P && L(Y), P && L(Me), P && L(K), P && L(z), P && L(j), P && L(qe), P && L(x), P && L(We), P && L($), Je = !1, re(ft);
1625
+ P && k(t), P && k(a), P && k(l), P && k(u), P && k(m), P && k(p), P && k(A), P && k(X), P && k(y), P && k(I), P && k(Y), P && k(Me), P && k(L), P && k(ce), P && k(F), P && k(qe), P && k(Q), P && k(We), P && k(x), Je = !1, ie(ht);
1626
1626
  }
1627
1627
  };
1628
1628
  }
1629
- function go(e) {
1629
+ function mo(e) {
1630
1630
  let t, n;
1631
- return t = new xt({
1631
+ return t = new $t({
1632
1632
  props: {
1633
1633
  shape: (
1634
1634
  /*shape*/
@@ -1644,7 +1644,7 @@ function go(e) {
1644
1644
  ),
1645
1645
  $$slots: {
1646
1646
  default: [
1647
- ho,
1647
+ go,
1648
1648
  ({ grab: o }) => ({ 10: o }),
1649
1649
  ({ grab: o }) => o ? 1024 : 0
1650
1650
  ]
@@ -1665,10 +1665,10 @@ function go(e) {
1665
1665
  e[9]
1666
1666
  ), {
1667
1667
  c() {
1668
- ge(t.$$.fragment);
1668
+ he(t.$$.fragment);
1669
1669
  },
1670
1670
  m(o, i) {
1671
- ce(t, o, i), n = !0;
1671
+ le(t, o, i), n = !0;
1672
1672
  },
1673
1673
  p(o, [i]) {
1674
1674
  const s = {};
@@ -1683,21 +1683,21 @@ function go(e) {
1683
1683
  n || (D(t.$$.fragment, o), n = !0);
1684
1684
  },
1685
1685
  o(o) {
1686
- X(t.$$.fragment, o), n = !1;
1686
+ N(t.$$.fragment, o), n = !1;
1687
1687
  },
1688
1688
  d(o) {
1689
- de(t, o);
1689
+ ae(t, o);
1690
1690
  }
1691
1691
  };
1692
1692
  }
1693
- function mo(e, t, n) {
1693
+ function po(e, t, n) {
1694
1694
  let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
1695
1695
  const d = (u, m, w) => {
1696
1696
  const b = u.geometry.bounds;
1697
- let [_, p] = [b.minX, b.minY], [T, S] = [b.maxX, b.maxY];
1698
- const [I, R] = w;
1697
+ let [_, p] = [b.minX, b.minY], [A, S] = [b.maxX, b.maxY];
1698
+ const [C, R] = w;
1699
1699
  if (m === O.SHAPE)
1700
- _ += I, T += I, p += R, S += R;
1700
+ _ += C, A += C, p += R, S += R;
1701
1701
  else {
1702
1702
  switch (m) {
1703
1703
  case O.TOP:
@@ -1717,42 +1717,42 @@ function mo(e, t, n) {
1717
1717
  case O.LEFT:
1718
1718
  case O.TOP_LEFT:
1719
1719
  case O.BOTTOM_LEFT: {
1720
- _ += I;
1720
+ _ += C;
1721
1721
  break;
1722
1722
  }
1723
1723
  case O.RIGHT:
1724
1724
  case O.TOP_RIGHT:
1725
1725
  case O.BOTTOM_RIGHT: {
1726
- T += I;
1726
+ A += C;
1727
1727
  break;
1728
1728
  }
1729
1729
  }
1730
1730
  }
1731
- const N = Math.min(_, T), y = Math.min(p, S), A = Math.abs(T - _), E = Math.abs(S - p);
1731
+ const X = Math.min(_, A), y = Math.min(p, S), T = Math.abs(A - _), E = Math.abs(S - p);
1732
1732
  return {
1733
1733
  ...u,
1734
1734
  geometry: {
1735
- x: N,
1735
+ x: X,
1736
1736
  y,
1737
- w: A,
1737
+ w: T,
1738
1738
  h: E,
1739
1739
  bounds: {
1740
- minX: N,
1740
+ minX: X,
1741
1741
  minY: y,
1742
- maxX: N + A,
1742
+ maxX: X + T,
1743
1743
  maxY: y + E
1744
1744
  }
1745
1745
  }
1746
1746
  };
1747
1747
  };
1748
1748
  function h(u) {
1749
- Te.call(this, e, u);
1749
+ Ae.call(this, e, u);
1750
1750
  }
1751
1751
  function c(u) {
1752
- Te.call(this, e, u);
1752
+ Ae.call(this, e, u);
1753
1753
  }
1754
1754
  function g(u) {
1755
- Te.call(this, e, u);
1755
+ Ae.call(this, e, u);
1756
1756
  }
1757
1757
  return e.$$set = (u) => {
1758
1758
  "shape" in u && n(0, s = u.shape), "computedStyle" in u && n(1, r = u.computedStyle), "transform" in u && n(2, a = u.transform), "viewportScale" in u && n(6, l = u.viewportScale);
@@ -1773,9 +1773,9 @@ function mo(e, t, n) {
1773
1773
  g
1774
1774
  ];
1775
1775
  }
1776
- class po extends ne {
1776
+ class yo extends te {
1777
1777
  constructor(t) {
1778
- super(), te(this, t, mo, go, Z, {
1778
+ super(), ee(this, t, po, mo, K, {
1779
1779
  shape: 0,
1780
1780
  computedStyle: 1,
1781
1781
  transform: 2,
@@ -1783,10 +1783,10 @@ class po extends ne {
1783
1783
  });
1784
1784
  }
1785
1785
  }
1786
- const Qt = /* @__PURE__ */ new Map([
1787
- [F.RECTANGLE, po],
1788
- [F.POLYGON, fo]
1789
- ]), St = (e) => Qt.get(e.type), yo = (e, t) => Qt.set(e, t), O = (e) => `HANDLE-${e}`;
1786
+ const xt = /* @__PURE__ */ new Map([
1787
+ [H.RECTANGLE, yo],
1788
+ [H.POLYGON, ho]
1789
+ ]), Mt = (e) => xt.get(e.type), _o = (e, t) => xt.set(e, t), O = (e) => `HANDLE-${e}`;
1790
1790
  O.SHAPE = "SHAPE";
1791
1791
  O.TOP = "TOP";
1792
1792
  O.RIGHT = "RIGHT";
@@ -1796,16 +1796,16 @@ O.TOP_LEFT = "TOP_LEFT";
1796
1796
  O.TOP_RIGHT = "TOP_RIGHT";
1797
1797
  O.BOTTOM_RIGHT = "BOTTOM_RIGHT";
1798
1798
  O.BOTTOM_LEFT = "BOTTOM_LEFT";
1799
- const _o = (e) => ({}), vt = (e) => ({ grab: (
1799
+ const wo = (e) => ({}), vt = (e) => ({ grab: (
1800
1800
  /*onGrab*/
1801
1801
  e[0]
1802
1802
  ) });
1803
- function wo(e) {
1803
+ function bo(e) {
1804
1804
  let t, n, o, i;
1805
1805
  const s = (
1806
1806
  /*#slots*/
1807
1807
  e[7].default
1808
- ), r = on(
1808
+ ), r = sn(
1809
1809
  s,
1810
1810
  e,
1811
1811
  /*$$scope*/
@@ -1817,7 +1817,7 @@ function wo(e) {
1817
1817
  t = U("g"), r && r.c(), f(t, "class", "a9s-annotation selected");
1818
1818
  },
1819
1819
  m(a, l) {
1820
- k(a, t, l), r && r.m(t, null), n = !0, o || (i = [
1820
+ B(a, t, l), r && r.m(t, null), n = !0, o || (i = [
1821
1821
  W(
1822
1822
  t,
1823
1823
  "pointerup",
@@ -1834,19 +1834,19 @@ function wo(e) {
1834
1834
  },
1835
1835
  p(a, [l]) {
1836
1836
  r && r.p && (!n || l & /*$$scope*/
1837
- 64) && rn(
1837
+ 64) && ln(
1838
1838
  r,
1839
1839
  s,
1840
1840
  a,
1841
1841
  /*$$scope*/
1842
1842
  a[6],
1843
- n ? sn(
1843
+ n ? rn(
1844
1844
  s,
1845
1845
  /*$$scope*/
1846
1846
  a[6],
1847
1847
  l,
1848
- _o
1849
- ) : ln(
1848
+ wo
1849
+ ) : an(
1850
1850
  /*$$scope*/
1851
1851
  a[6]
1852
1852
  ),
@@ -1857,16 +1857,16 @@ function wo(e) {
1857
1857
  n || (D(r, a), n = !0);
1858
1858
  },
1859
1859
  o(a) {
1860
- X(r, a), n = !1;
1860
+ N(r, a), n = !1;
1861
1861
  },
1862
1862
  d(a) {
1863
- a && L(t), r && r.d(a), o = !1, re(i);
1863
+ a && k(t), r && r.d(a), o = !1, ie(i);
1864
1864
  }
1865
1865
  };
1866
1866
  }
1867
- function bo(e, t, n) {
1867
+ function Eo(e, t, n) {
1868
1868
  let { $$slots: o = {}, $$scope: i } = t;
1869
- const s = ve();
1869
+ const s = Se();
1870
1870
  let { shape: r } = t, { editor: a } = t, { transform: l } = t, d = null, h, c = null;
1871
1871
  const g = (w) => (b) => {
1872
1872
  d = w, h = l.elementToImage(b.offsetX, b.offsetY), c = r, b.target.setPointerCapture(b.pointerId), s("grab");
@@ -1882,9 +1882,9 @@ function bo(e, t, n) {
1882
1882
  "shape" in w && n(3, r = w.shape), "editor" in w && n(4, a = w.editor), "transform" in w && n(5, l = w.transform), "$$scope" in w && n(6, i = w.$$scope);
1883
1883
  }, [g, u, m, r, a, l, i, o];
1884
1884
  }
1885
- class xt extends ne {
1885
+ class $t extends te {
1886
1886
  constructor(t) {
1887
- super(), te(this, t, bo, wo, Z, { shape: 3, editor: 4, transform: 5 });
1887
+ super(), ee(this, t, Eo, bo, K, { shape: 3, editor: 4, transform: 5 });
1888
1888
  }
1889
1889
  }
1890
1890
  const je = (e, t) => {
@@ -1895,11 +1895,11 @@ const je = (e, t) => {
1895
1895
  return o && (s += `fill:${o};stroke:${o};`), s += `fill-opacity:${i || "0.25"};`, s;
1896
1896
  }
1897
1897
  };
1898
- function Eo(e, t, n) {
1898
+ function Ao(e, t, n) {
1899
1899
  let o;
1900
- const i = ve();
1900
+ const i = Se();
1901
1901
  let { annotation: s } = t, { editor: r } = t, { style: a = void 0 } = t, { target: l } = t, { transform: d } = t, { viewportScale: h } = t, c;
1902
- return Pe(() => (n(6, c = new r({
1902
+ return Ce(() => (n(6, c = new r({
1903
1903
  target: l,
1904
1904
  props: {
1905
1905
  shape: s.target.selector,
@@ -1921,9 +1921,9 @@ function Eo(e, t, n) {
1921
1921
  96 && c && c.$set({ viewportScale: h });
1922
1922
  }, [s, r, a, l, d, h, c];
1923
1923
  }
1924
- class Ao extends ne {
1924
+ class To extends te {
1925
1925
  constructor(t) {
1926
- super(), te(this, t, Eo, null, Z, {
1926
+ super(), ee(this, t, Ao, null, K, {
1927
1927
  annotation: 0,
1928
1928
  editor: 1,
1929
1929
  style: 2,
@@ -1933,10 +1933,10 @@ class Ao extends ne {
1933
1933
  });
1934
1934
  }
1935
1935
  }
1936
- function To(e, t, n) {
1937
- const o = ve();
1936
+ function So(e, t, n) {
1937
+ const o = Se();
1938
1938
  let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: a } = t, { viewportScale: l } = t, d;
1939
- return Pe(() => {
1939
+ return Ce(() => {
1940
1940
  const h = s.closest("svg"), c = [], g = (u, m, w) => {
1941
1941
  h.addEventListener(u, m, w), c.push(() => h.removeEventListener(u, m, w));
1942
1942
  };
@@ -1959,9 +1959,9 @@ function To(e, t, n) {
1959
1959
  48 && d && d.$set({ viewportScale: l });
1960
1960
  }, [i, s, r, a, l, d];
1961
1961
  }
1962
- class So extends ne {
1962
+ class Mo extends te {
1963
1963
  constructor(t) {
1964
- super(), te(this, t, To, null, Z, {
1964
+ super(), ee(this, t, So, null, K, {
1965
1965
  drawingMode: 0,
1966
1966
  target: 1,
1967
1967
  tool: 2,
@@ -1970,7 +1970,7 @@ class So extends ne {
1970
1970
  });
1971
1971
  }
1972
1972
  }
1973
- function Mt(e) {
1973
+ function Ot(e) {
1974
1974
  let t, n;
1975
1975
  return {
1976
1976
  c() {
@@ -2017,7 +2017,7 @@ function Mt(e) {
2017
2017
  );
2018
2018
  },
2019
2019
  m(o, i) {
2020
- k(o, t, i), k(o, n, i);
2020
+ B(o, t, i), B(o, n, i);
2021
2021
  },
2022
2022
  p(o, i) {
2023
2023
  i & /*x*/
@@ -2071,52 +2071,52 @@ function Mt(e) {
2071
2071
  );
2072
2072
  },
2073
2073
  d(o) {
2074
- o && L(t), o && L(n);
2074
+ o && k(t), o && k(n);
2075
2075
  }
2076
2076
  };
2077
2077
  }
2078
2078
  function vo(e) {
2079
2079
  let t, n = (
2080
2080
  /*origin*/
2081
- e[0] && Mt(e)
2081
+ e[0] && Ot(e)
2082
2082
  );
2083
2083
  return {
2084
2084
  c() {
2085
2085
  t = U("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
2086
2086
  },
2087
2087
  m(o, i) {
2088
- k(o, t, i), n && n.m(t, null);
2088
+ B(o, t, i), n && n.m(t, null);
2089
2089
  },
2090
2090
  p(o, [i]) {
2091
2091
  /*origin*/
2092
- o[0] ? n ? n.p(o, i) : (n = Mt(o), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2092
+ o[0] ? n ? n.p(o, i) : (n = Ot(o), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2093
2093
  },
2094
- i: V,
2095
- o: V,
2094
+ i: z,
2095
+ o: z,
2096
2096
  d(o) {
2097
- o && L(t), n && n.d();
2097
+ o && k(t), n && n.d();
2098
2098
  }
2099
2099
  };
2100
2100
  }
2101
- function Mo(e, t, n) {
2102
- const o = ve();
2101
+ function Oo(e, t, n) {
2102
+ const o = Se();
2103
2103
  let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, a, l, d, h, c, g, u;
2104
2104
  const m = (p) => {
2105
2105
  a = performance.now(), s === "drag" && (n(0, l = r.elementToImage(p.offsetX, p.offsetY)), d = l, n(1, h = l[0]), n(2, c = l[1]), n(3, g = 1), n(4, u = 1));
2106
2106
  }, w = (p) => {
2107
2107
  l && (d = r.elementToImage(p.offsetX, p.offsetY), n(1, h = Math.min(d[0], l[0])), n(2, c = Math.min(d[1], l[1])), n(3, g = Math.abs(d[0] - l[0])), n(4, u = Math.abs(d[1] - l[1])));
2108
2108
  }, b = (p) => {
2109
- const T = performance.now() - a;
2109
+ const A = performance.now() - a;
2110
2110
  if (s === "click") {
2111
- if (T > 300)
2111
+ if (A > 300)
2112
2112
  return;
2113
2113
  p.stopPropagation(), l ? _() : (n(0, l = r.elementToImage(p.offsetX, p.offsetY)), d = l, n(1, h = l[0]), n(2, c = l[1]), n(3, g = 1), n(4, u = 1));
2114
2114
  } else
2115
- l && (T > 300 || g * u > 100 ? (p.stopPropagation(), _()) : (n(0, l = null), d = null));
2115
+ l && (A > 300 || g * u > 100 ? (p.stopPropagation(), _()) : (n(0, l = null), d = null));
2116
2116
  }, _ = () => {
2117
2117
  if (g * u > 15) {
2118
2118
  const p = {
2119
- type: F.RECTANGLE,
2119
+ type: H.RECTANGLE,
2120
2120
  geometry: {
2121
2121
  bounds: {
2122
2122
  minX: h,
@@ -2134,15 +2134,15 @@ function Mo(e, t, n) {
2134
2134
  }
2135
2135
  n(0, l = null), d = null;
2136
2136
  };
2137
- return Pe(() => {
2137
+ return Ce(() => {
2138
2138
  i("pointerdown", m), i("pointermove", w), i("pointerup", b, !0);
2139
2139
  }), e.$$set = (p) => {
2140
2140
  "addEventListener" in p && n(5, i = p.addEventListener), "drawingMode" in p && n(6, s = p.drawingMode), "transform" in p && n(7, r = p.transform);
2141
2141
  }, [l, h, c, g, u, i, s, r];
2142
2142
  }
2143
- class Oo extends ne {
2143
+ class Lo extends te {
2144
2144
  constructor(t) {
2145
- super(), te(this, t, Mo, vo, Z, {
2145
+ super(), ee(this, t, Oo, vo, K, {
2146
2146
  addEventListener: 5,
2147
2147
  drawingMode: 6,
2148
2148
  transform: 7
@@ -2152,34 +2152,34 @@ class Oo extends ne {
2152
2152
  const xe = (e, t) => {
2153
2153
  const n = Math.abs(t[0] - e[0]), o = Math.abs(t[1] - e[1]);
2154
2154
  return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
2155
- }, we = [];
2156
- function Lo(e, t = V) {
2155
+ }, _e = [];
2156
+ function ko(e, t = z) {
2157
2157
  let n;
2158
2158
  const o = /* @__PURE__ */ new Set();
2159
2159
  function i(a) {
2160
- if (Z(e, a) && (e = a, n)) {
2161
- const l = !we.length;
2160
+ if (K(e, a) && (e = a, n)) {
2161
+ const l = !_e.length;
2162
2162
  for (const d of o)
2163
- d[1](), we.push(d, e);
2163
+ d[1](), _e.push(d, e);
2164
2164
  if (l) {
2165
- for (let d = 0; d < we.length; d += 2)
2166
- we[d][0](we[d + 1]);
2167
- we.length = 0;
2165
+ for (let d = 0; d < _e.length; d += 2)
2166
+ _e[d][0](_e[d + 1]);
2167
+ _e.length = 0;
2168
2168
  }
2169
2169
  }
2170
2170
  }
2171
2171
  function s(a) {
2172
2172
  i(a(e));
2173
2173
  }
2174
- function r(a, l = V) {
2174
+ function r(a, l = z) {
2175
2175
  const d = [a, l];
2176
- return o.add(d), o.size === 1 && (n = t(i) || V), a(e), () => {
2176
+ return o.add(d), o.size === 1 && (n = t(i) || z), a(e), () => {
2177
2177
  o.delete(d), o.size === 0 && n && (n(), n = null);
2178
2178
  };
2179
2179
  }
2180
2180
  return { set: i, update: s, subscribe: r };
2181
2181
  }
2182
- const ko = (e, t) => {
2182
+ const Bo = (e, t) => {
2183
2183
  const { naturalWidth: n, naturalHeight: o } = e;
2184
2184
  if (!n && !o) {
2185
2185
  const { width: i, height: s } = e;
@@ -2189,9 +2189,9 @@ const ko = (e, t) => {
2189
2189
  });
2190
2190
  } else
2191
2191
  t.setAttribute("viewBox", `0 0 ${n} ${o}`);
2192
- }, Bo = (e, t) => {
2193
- ko(e, t);
2194
- const { subscribe: n, set: o } = Lo(1);
2192
+ }, Io = (e, t) => {
2193
+ Bo(e, t);
2194
+ const { subscribe: n, set: o } = ko(1);
2195
2195
  let i;
2196
2196
  return window.ResizeObserver && (i = new ResizeObserver(() => {
2197
2197
  const r = t.getBoundingClientRect(), { width: a, height: l } = t.viewBox.baseVal, d = Math.max(
@@ -2218,19 +2218,19 @@ function $e(e) {
2218
2218
  );
2219
2219
  return t[15] = n, t;
2220
2220
  }
2221
- function Ot(e) {
2221
+ function Lt(e) {
2222
2222
  let t, n, o, i, s, r = (
2223
2223
  /*isClosable*/
2224
- e[2] && Lt(e)
2224
+ e[2] && kt(e)
2225
2225
  );
2226
2226
  return {
2227
2227
  c() {
2228
- t = U("polygon"), o = U("polygon"), r && r.c(), s = le(), f(t, "class", "a9s-outer"), f(t, "points", n = /*coords*/
2228
+ t = U("polygon"), o = U("polygon"), r && r.c(), s = se(), f(t, "class", "a9s-outer"), f(t, "points", n = /*coords*/
2229
2229
  e[15]), f(o, "class", "a9s-inner"), f(o, "points", i = /*coords*/
2230
2230
  e[15]);
2231
2231
  },
2232
2232
  m(a, l) {
2233
- k(a, t, l), k(a, o, l), r && r.m(a, l), k(a, s, l);
2233
+ B(a, t, l), B(a, o, l), r && r.m(a, l), B(a, s, l);
2234
2234
  },
2235
2235
  p(a, l) {
2236
2236
  l & /*isClosable, points, cursor*/
@@ -2238,14 +2238,14 @@ function Ot(e) {
2238
2238
  a[15]) && f(t, "points", n), l & /*isClosable, points, cursor*/
2239
2239
  7 && i !== (i = /*coords*/
2240
2240
  a[15]) && f(o, "points", i), /*isClosable*/
2241
- a[2] ? r ? r.p(a, l) : (r = Lt(a), r.c(), r.m(s.parentNode, s)) : r && (r.d(1), r = null);
2241
+ a[2] ? r ? r.p(a, l) : (r = kt(a), r.c(), r.m(s.parentNode, s)) : r && (r.d(1), r = null);
2242
2242
  },
2243
2243
  d(a) {
2244
- a && L(t), a && L(o), r && r.d(a), a && L(s);
2244
+ a && k(t), a && k(o), r && r.d(a), a && k(s);
2245
2245
  }
2246
2246
  };
2247
2247
  }
2248
- function Lt(e) {
2248
+ function kt(e) {
2249
2249
  let t, n, o;
2250
2250
  return {
2251
2251
  c() {
@@ -2266,7 +2266,7 @@ function Lt(e) {
2266
2266
  );
2267
2267
  },
2268
2268
  m(i, s) {
2269
- k(i, t, s);
2269
+ B(i, t, s);
2270
2270
  },
2271
2271
  p(i, s) {
2272
2272
  s & /*points, handleSize*/
@@ -2290,59 +2290,59 @@ function Lt(e) {
2290
2290
  );
2291
2291
  },
2292
2292
  d(i) {
2293
- i && L(t);
2293
+ i && k(t);
2294
2294
  }
2295
2295
  };
2296
2296
  }
2297
- function Io(e) {
2297
+ function Co(e) {
2298
2298
  let t, n = (
2299
2299
  /*cursor*/
2300
- e[1] && Ot($e(e))
2300
+ e[1] && Lt($e(e))
2301
2301
  );
2302
2302
  return {
2303
2303
  c() {
2304
2304
  t = U("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
2305
2305
  },
2306
2306
  m(o, i) {
2307
- k(o, t, i), n && n.m(t, null);
2307
+ B(o, t, i), n && n.m(t, null);
2308
2308
  },
2309
2309
  p(o, [i]) {
2310
2310
  /*cursor*/
2311
- o[1] ? n ? n.p($e(o), i) : (n = Ot($e(o)), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2311
+ o[1] ? n ? n.p($e(o), i) : (n = Lt($e(o)), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
2312
2312
  },
2313
- i: V,
2314
- o: V,
2313
+ i: z,
2314
+ o: z,
2315
2315
  d(o) {
2316
- o && L(t), n && n.d();
2316
+ o && k(t), n && n.d();
2317
2317
  }
2318
2318
  };
2319
2319
  }
2320
- const Co = 20;
2321
- function Po(e, t, n) {
2320
+ const Po = 20;
2321
+ function Ro(e, t, n) {
2322
2322
  let o;
2323
- const i = ve();
2323
+ const i = Se();
2324
2324
  let { addEventListener: s } = t, { drawingMode: r } = t, { transform: a } = t, { viewportScale: l = 1 } = t, d, h = [], c = null, g = !1;
2325
2325
  const u = (p) => {
2326
- const { timeStamp: T, offsetX: S, offsetY: I } = p;
2327
- if (d = { timeStamp: T, offsetX: S, offsetY: I }, r === "drag" && h.length === 0) {
2326
+ const { timeStamp: A, offsetX: S, offsetY: C } = p;
2327
+ if (d = { timeStamp: A, offsetX: S, offsetY: C }, r === "drag" && h.length === 0) {
2328
2328
  const R = a.elementToImage(p.offsetX, p.offsetY);
2329
2329
  h.push(R), n(1, c = R);
2330
2330
  }
2331
2331
  }, m = (p) => {
2332
2332
  if (h.length > 0 && (n(1, c = a.elementToImage(p.offsetX, p.offsetY)), h.length > 2)) {
2333
- const T = xe(c, h[0]) * l;
2334
- n(2, g = T < Co);
2333
+ const A = xe(c, h[0]) * l;
2334
+ n(2, g = A < Po);
2335
2335
  }
2336
2336
  }, w = (p) => {
2337
2337
  if (r === "click") {
2338
- const T = p.timeStamp - d.timeStamp, S = xe([d.offsetX, d.offsetY], [p.offsetX, p.offsetY]);
2339
- if (T > 300 || S > 15)
2338
+ const A = p.timeStamp - d.timeStamp, S = xe([d.offsetX, d.offsetY], [p.offsetX, p.offsetY]);
2339
+ if (A > 300 || S > 15)
2340
2340
  return;
2341
2341
  if (g)
2342
2342
  _();
2343
2343
  else if (h.length === 0) {
2344
- const I = a.elementToImage(p.offsetX, p.offsetY);
2345
- h.push(I), n(1, c = I);
2344
+ const C = a.elementToImage(p.offsetX, p.offsetY);
2345
+ h.push(C), n(1, c = C);
2346
2346
  } else
2347
2347
  h.push(c);
2348
2348
  } else {
@@ -2353,14 +2353,14 @@ function Po(e, t, n) {
2353
2353
  p.stopImmediatePropagation(), g ? _() : h.push(c);
2354
2354
  }
2355
2355
  }, b = () => {
2356
- const p = [...h, c], T = {
2357
- type: F.POLYGON,
2356
+ const p = [...h, c], A = {
2357
+ type: H.POLYGON,
2358
2358
  geometry: { bounds: Fe(p), points: p }
2359
2359
  };
2360
- st(T) > 4 && (n(0, h = []), n(1, c = null), i("create", T));
2360
+ st(A) > 4 && (n(0, h = []), n(1, c = null), i("create", A));
2361
2361
  }, _ = () => {
2362
2362
  const p = {
2363
- type: F.POLYGON,
2363
+ type: H.POLYGON,
2364
2364
  geometry: {
2365
2365
  bounds: Fe(h),
2366
2366
  points: [...h]
@@ -2368,7 +2368,7 @@ function Po(e, t, n) {
2368
2368
  };
2369
2369
  n(0, h = []), n(1, c = null), i("create", p);
2370
2370
  };
2371
- return Pe(() => {
2371
+ return Ce(() => {
2372
2372
  s("pointerdown", u, !0), s("pointermove", m), s("pointerup", w, !0), s("dblclick", b, !0);
2373
2373
  }), e.$$set = (p) => {
2374
2374
  "addEventListener" in p && n(4, s = p.addEventListener), "drawingMode" in p && n(5, r = p.drawingMode), "transform" in p && n(6, a = p.transform), "viewportScale" in p && n(7, l = p.viewportScale);
@@ -2386,9 +2386,9 @@ function Po(e, t, n) {
2386
2386
  l
2387
2387
  ];
2388
2388
  }
2389
- class Ro extends ne {
2389
+ class Yo extends te {
2390
2390
  constructor(t) {
2391
- super(), te(this, t, Po, Io, Z, {
2391
+ super(), ee(this, t, Ro, Co, K, {
2392
2392
  addEventListener: 4,
2393
2393
  drawingMode: 5,
2394
2394
  transform: 6,
@@ -2396,10 +2396,10 @@ class Ro extends ne {
2396
2396
  });
2397
2397
  }
2398
2398
  }
2399
- const ut = /* @__PURE__ */ new Map([
2400
- ["rectangle", { tool: Oo }],
2401
- ["polygon", { tool: Ro }]
2402
- ]), Yo = () => [...ut.keys()], $t = (e) => ut.get(e), Uo = (e, t, n) => ut.set(e, { tool: t, opts: n });
2399
+ const ft = /* @__PURE__ */ new Map([
2400
+ ["rectangle", { tool: Lo }],
2401
+ ["polygon", { tool: Yo }]
2402
+ ]), rt = () => [...ft.keys()], en = (e) => ft.get(e), Uo = (e, t, n) => ft.set(e, { tool: t, opts: n });
2403
2403
  function Do(e) {
2404
2404
  let t, n, o, i, s;
2405
2405
  return {
@@ -2454,7 +2454,7 @@ function Do(e) {
2454
2454
  e[0].id);
2455
2455
  },
2456
2456
  m(r, a) {
2457
- k(r, t, a), ae(t, n), ae(t, i);
2457
+ B(r, t, a), re(t, n), re(t, i);
2458
2458
  },
2459
2459
  p(r, [a]) {
2460
2460
  a & /*computedStyle*/
@@ -2469,10 +2469,10 @@ function Do(e) {
2469
2469
  1 && s !== (s = /*annotation*/
2470
2470
  r[0].id) && f(t, "data-id", s);
2471
2471
  },
2472
- i: V,
2473
- o: V,
2472
+ i: z,
2473
+ o: z,
2474
2474
  d(r) {
2475
- r && L(t);
2475
+ r && k(t);
2476
2476
  }
2477
2477
  };
2478
2478
  }
@@ -2486,9 +2486,9 @@ function Xo(e, t, n) {
2486
2486
  129 && n(1, o = je(i, r));
2487
2487
  }, [i, o, a, l, d, h, s, r];
2488
2488
  }
2489
- class No extends ne {
2489
+ class No extends te {
2490
2490
  constructor(t) {
2491
- super(), te(this, t, Xo, Do, Z, { annotation: 0, geom: 6, style: 7 });
2491
+ super(), ee(this, t, Xo, Do, K, { annotation: 0, geom: 6, style: 7 });
2492
2492
  }
2493
2493
  }
2494
2494
  function Go(e) {
@@ -2515,7 +2515,7 @@ function Go(e) {
2515
2515
  e[0].id);
2516
2516
  },
2517
2517
  m(r, a) {
2518
- k(r, t, a), ae(t, n), ae(t, i);
2518
+ B(r, t, a), re(t, n), re(t, i);
2519
2519
  },
2520
2520
  p(r, [a]) {
2521
2521
  a & /*computedStyle*/
@@ -2530,10 +2530,10 @@ function Go(e) {
2530
2530
  1 && s !== (s = /*annotation*/
2531
2531
  r[0].id) && f(t, "data-id", s);
2532
2532
  },
2533
- i: V,
2534
- o: V,
2533
+ i: z,
2534
+ o: z,
2535
2535
  d(r) {
2536
- r && L(t);
2536
+ r && k(t);
2537
2537
  }
2538
2538
  };
2539
2539
  }
@@ -2548,9 +2548,9 @@ function Fo(e, t, n) {
2548
2548
  17 && n(1, o = je(i, r));
2549
2549
  }, [i, o, a, s, r];
2550
2550
  }
2551
- class Ho extends ne {
2551
+ class Ho extends te {
2552
2552
  constructor(t) {
2553
- super(), te(this, t, Fo, Go, Z, { annotation: 0, geom: 3, style: 4 });
2553
+ super(), ee(this, t, Fo, Go, K, { annotation: 0, geom: 3, style: 4 });
2554
2554
  }
2555
2555
  }
2556
2556
  function jo(e) {
@@ -2607,7 +2607,7 @@ function jo(e) {
2607
2607
  e[0].id);
2608
2608
  },
2609
2609
  m(r, a) {
2610
- k(r, t, a), ae(t, n), ae(t, i);
2610
+ B(r, t, a), re(t, n), re(t, i);
2611
2611
  },
2612
2612
  p(r, [a]) {
2613
2613
  a & /*computedStyle*/
@@ -2670,10 +2670,10 @@ function jo(e) {
2670
2670
  1 && s !== (s = /*annotation*/
2671
2671
  r[0].id) && f(t, "data-id", s);
2672
2672
  },
2673
- i: V,
2674
- o: V,
2673
+ i: z,
2674
+ o: z,
2675
2675
  d(r) {
2676
- r && L(t);
2676
+ r && k(t);
2677
2677
  }
2678
2678
  };
2679
2679
  }
@@ -2687,9 +2687,9 @@ function qo(e, t, n) {
2687
2687
  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)));
2688
2688
  }, [l, a, r, s, i, o, d, h];
2689
2689
  }
2690
- class Wo extends ne {
2690
+ class Wo extends te {
2691
2691
  constructor(t) {
2692
- super(), te(this, t, qo, jo, Z, { annotation: 0, geom: 6, style: 7 });
2692
+ super(), ee(this, t, qo, jo, K, { annotation: 0, geom: 6, style: 7 });
2693
2693
  }
2694
2694
  }
2695
2695
  const Ni = {
@@ -2702,7 +2702,7 @@ const Ni = {
2702
2702
  return [s, r];
2703
2703
  }
2704
2704
  }), Ko = 250, Zo = (e, t) => {
2705
- const n = ve();
2705
+ const n = Se();
2706
2706
  let o;
2707
2707
  return { onPointerDown: () => o = performance.now(), onPointerUp: (r) => {
2708
2708
  if (performance.now() - o < Ko) {
@@ -2714,46 +2714,46 @@ const Ni = {
2714
2714
  const n = t.createSVGPoint(), o = t.getBoundingClientRect(), i = e.clientX - o.x, s = e.clientY - o.y, { left: r, top: a } = t.getBoundingClientRect();
2715
2715
  return n.x = i + r, n.y = s + a, n.matrixTransform(t.getScreenCTM().inverse());
2716
2716
  };
2717
- function kt(e, t, n) {
2717
+ function Bt(e, t, n) {
2718
2718
  const o = e.slice();
2719
- return o[28] = t[n], o;
2719
+ return o[29] = t[n], o;
2720
2720
  }
2721
- function Bt(e, t, n) {
2721
+ function It(e, t, n) {
2722
2722
  const o = e.slice();
2723
- return o[31] = t[n], o;
2723
+ return o[32] = t[n], o;
2724
2724
  }
2725
2725
  function et(e) {
2726
2726
  const t = e.slice(), n = (
2727
2727
  /*annotation*/
2728
- t[31].target.selector
2728
+ t[32].target.selector
2729
2729
  );
2730
- return t[34] = n, t;
2730
+ return t[35] = n, t;
2731
2731
  }
2732
- function It(e) {
2732
+ function Ct(e) {
2733
2733
  let t = (
2734
2734
  /*annotation*/
2735
- e[31].id
2736
- ), n, o, i = Ct(e);
2735
+ e[32].id
2736
+ ), n, o, i = Pt(e);
2737
2737
  return {
2738
2738
  c() {
2739
- i.c(), n = le();
2739
+ i.c(), n = se();
2740
2740
  },
2741
2741
  m(s, r) {
2742
- i.m(s, r), k(s, n, r), o = !0;
2742
+ i.m(s, r), B(s, n, r), o = !0;
2743
2743
  },
2744
2744
  p(s, r) {
2745
2745
  r[0] & /*$store*/
2746
- 4096 && Z(t, t = /*annotation*/
2747
- s[31].id) ? (ie(), X(i, 1, 1, V), se(), i = Ct(s), i.c(), D(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
2746
+ 8192 && K(t, t = /*annotation*/
2747
+ s[32].id) ? (ne(), N(i, 1, 1, z), oe(), i = Pt(s), i.c(), D(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
2748
2748
  },
2749
2749
  i(s) {
2750
2750
  o || (D(i), o = !0);
2751
2751
  },
2752
2752
  o(s) {
2753
- X(i), o = !1;
2753
+ N(i), o = !1;
2754
2754
  },
2755
2755
  d(s) {
2756
- s && L(n), i.d(s);
2756
+ s && k(n), i.d(s);
2757
2757
  }
2758
2758
  };
2759
2759
  }
@@ -2763,11 +2763,11 @@ function xo(e) {
2763
2763
  props: {
2764
2764
  annotation: (
2765
2765
  /*annotation*/
2766
- e[31]
2766
+ e[32]
2767
2767
  ),
2768
2768
  geom: (
2769
2769
  /*selector*/
2770
- e[34].geometry
2770
+ e[35].geometry
2771
2771
  ),
2772
2772
  style: (
2773
2773
  /*style*/
@@ -2776,18 +2776,18 @@ function xo(e) {
2776
2776
  }
2777
2777
  }), {
2778
2778
  c() {
2779
- ge(t.$$.fragment);
2779
+ he(t.$$.fragment);
2780
2780
  },
2781
2781
  m(o, i) {
2782
- ce(t, o, i), n = !0;
2782
+ le(t, o, i), n = !0;
2783
2783
  },
2784
2784
  p(o, i) {
2785
2785
  const s = {};
2786
2786
  i[0] & /*$store*/
2787
- 4096 && (s.annotation = /*annotation*/
2788
- o[31]), i[0] & /*$store*/
2789
- 4096 && (s.geom = /*selector*/
2790
- o[34].geometry), i[0] & /*style*/
2787
+ 8192 && (s.annotation = /*annotation*/
2788
+ o[32]), i[0] & /*$store*/
2789
+ 8192 && (s.geom = /*selector*/
2790
+ o[35].geometry), i[0] & /*style*/
2791
2791
  2 && (s.style = /*style*/
2792
2792
  o[1]), t.$set(s);
2793
2793
  },
@@ -2795,10 +2795,10 @@ function xo(e) {
2795
2795
  n || (D(t.$$.fragment, o), n = !0);
2796
2796
  },
2797
2797
  o(o) {
2798
- X(t.$$.fragment, o), n = !1;
2798
+ N(t.$$.fragment, o), n = !1;
2799
2799
  },
2800
2800
  d(o) {
2801
- de(t, o);
2801
+ ae(t, o);
2802
2802
  }
2803
2803
  };
2804
2804
  }
@@ -2808,11 +2808,11 @@ function $o(e) {
2808
2808
  props: {
2809
2809
  annotation: (
2810
2810
  /*annotation*/
2811
- e[31]
2811
+ e[32]
2812
2812
  ),
2813
2813
  geom: (
2814
2814
  /*selector*/
2815
- e[34].geometry
2815
+ e[35].geometry
2816
2816
  ),
2817
2817
  style: (
2818
2818
  /*style*/
@@ -2821,18 +2821,18 @@ function $o(e) {
2821
2821
  }
2822
2822
  }), {
2823
2823
  c() {
2824
- ge(t.$$.fragment);
2824
+ he(t.$$.fragment);
2825
2825
  },
2826
2826
  m(o, i) {
2827
- ce(t, o, i), n = !0;
2827
+ le(t, o, i), n = !0;
2828
2828
  },
2829
2829
  p(o, i) {
2830
2830
  const s = {};
2831
2831
  i[0] & /*$store*/
2832
- 4096 && (s.annotation = /*annotation*/
2833
- o[31]), i[0] & /*$store*/
2834
- 4096 && (s.geom = /*selector*/
2835
- o[34].geometry), i[0] & /*style*/
2832
+ 8192 && (s.annotation = /*annotation*/
2833
+ o[32]), i[0] & /*$store*/
2834
+ 8192 && (s.geom = /*selector*/
2835
+ o[35].geometry), i[0] & /*style*/
2836
2836
  2 && (s.style = /*style*/
2837
2837
  o[1]), t.$set(s);
2838
2838
  },
@@ -2840,10 +2840,10 @@ function $o(e) {
2840
2840
  n || (D(t.$$.fragment, o), n = !0);
2841
2841
  },
2842
2842
  o(o) {
2843
- X(t.$$.fragment, o), n = !1;
2843
+ N(t.$$.fragment, o), n = !1;
2844
2844
  },
2845
2845
  d(o) {
2846
- de(t, o);
2846
+ ae(t, o);
2847
2847
  }
2848
2848
  };
2849
2849
  }
@@ -2853,11 +2853,11 @@ function ei(e) {
2853
2853
  props: {
2854
2854
  annotation: (
2855
2855
  /*annotation*/
2856
- e[31]
2856
+ e[32]
2857
2857
  ),
2858
2858
  geom: (
2859
2859
  /*selector*/
2860
- e[34].geometry
2860
+ e[35].geometry
2861
2861
  ),
2862
2862
  style: (
2863
2863
  /*style*/
@@ -2866,18 +2866,18 @@ function ei(e) {
2866
2866
  }
2867
2867
  }), {
2868
2868
  c() {
2869
- ge(t.$$.fragment);
2869
+ he(t.$$.fragment);
2870
2870
  },
2871
2871
  m(o, i) {
2872
- ce(t, o, i), n = !0;
2872
+ le(t, o, i), n = !0;
2873
2873
  },
2874
2874
  p(o, i) {
2875
2875
  const s = {};
2876
2876
  i[0] & /*$store*/
2877
- 4096 && (s.annotation = /*annotation*/
2878
- o[31]), i[0] & /*$store*/
2879
- 4096 && (s.geom = /*selector*/
2880
- o[34].geometry), i[0] & /*style*/
2877
+ 8192 && (s.annotation = /*annotation*/
2878
+ o[32]), i[0] & /*$store*/
2879
+ 8192 && (s.geom = /*selector*/
2880
+ o[35].geometry), i[0] & /*style*/
2881
2881
  2 && (s.style = /*style*/
2882
2882
  o[1]), t.$set(s);
2883
2883
  },
@@ -2885,88 +2885,88 @@ function ei(e) {
2885
2885
  n || (D(t.$$.fragment, o), n = !0);
2886
2886
  },
2887
2887
  o(o) {
2888
- X(t.$$.fragment, o), n = !1;
2888
+ N(t.$$.fragment, o), n = !1;
2889
2889
  },
2890
2890
  d(o) {
2891
- de(t, o);
2891
+ ae(t, o);
2892
2892
  }
2893
2893
  };
2894
2894
  }
2895
- function Ct(e) {
2895
+ function Pt(e) {
2896
2896
  let t, n, o, i;
2897
2897
  const s = [ei, $o, xo], r = [];
2898
2898
  function a(l, d) {
2899
2899
  return (
2900
2900
  /*selector*/
2901
- l[34].type === F.ELLIPSE ? 0 : (
2901
+ l[35].type === H.ELLIPSE ? 0 : (
2902
2902
  /*selector*/
2903
- l[34].type === F.RECTANGLE ? 1 : (
2903
+ l[35].type === H.RECTANGLE ? 1 : (
2904
2904
  /*selector*/
2905
- l[34].type === F.POLYGON ? 2 : -1
2905
+ l[35].type === H.POLYGON ? 2 : -1
2906
2906
  )
2907
2907
  )
2908
2908
  );
2909
2909
  }
2910
2910
  return ~(t = a(e)) && (n = r[t] = s[t](e)), {
2911
2911
  c() {
2912
- n && n.c(), o = le();
2912
+ n && n.c(), o = se();
2913
2913
  },
2914
2914
  m(l, d) {
2915
- ~t && r[t].m(l, d), k(l, o, d), i = !0;
2915
+ ~t && r[t].m(l, d), B(l, o, d), i = !0;
2916
2916
  },
2917
2917
  p(l, d) {
2918
2918
  let h = t;
2919
- t = a(l), t === h ? ~t && r[t].p(l, d) : (n && (ie(), X(r[h], 1, 1, () => {
2919
+ t = a(l), t === h ? ~t && r[t].p(l, d) : (n && (ne(), N(r[h], 1, 1, () => {
2920
2920
  r[h] = null;
2921
- }), se()), ~t ? (n = r[t], n ? n.p(l, d) : (n = r[t] = s[t](l), n.c()), D(n, 1), n.m(o.parentNode, o)) : n = null);
2921
+ }), oe()), ~t ? (n = r[t], n ? n.p(l, d) : (n = r[t] = s[t](l), n.c()), D(n, 1), n.m(o.parentNode, o)) : n = null);
2922
2922
  },
2923
2923
  i(l) {
2924
2924
  i || (D(n), i = !0);
2925
2925
  },
2926
2926
  o(l) {
2927
- X(n), i = !1;
2927
+ N(n), i = !1;
2928
2928
  },
2929
2929
  d(l) {
2930
- ~t && r[t].d(l), l && L(o);
2930
+ ~t && r[t].d(l), l && k(o);
2931
2931
  }
2932
2932
  };
2933
2933
  }
2934
- function Pt(e) {
2934
+ function Rt(e) {
2935
2935
  let t = !/*isEditable*/
2936
2936
  e[7](
2937
2937
  /*annotation*/
2938
- e[31]
2939
- ), n, o, i = t && It(et(e));
2938
+ e[32]
2939
+ ), n, o, i = t && Ct(et(e));
2940
2940
  return {
2941
2941
  c() {
2942
- i && i.c(), n = le();
2942
+ i && i.c(), n = se();
2943
2943
  },
2944
2944
  m(s, r) {
2945
- i && i.m(s, r), k(s, n, r), o = !0;
2945
+ i && i.m(s, r), B(s, n, r), o = !0;
2946
2946
  },
2947
2947
  p(s, r) {
2948
2948
  r[0] & /*isEditable, $store*/
2949
- 4224 && (t = !/*isEditable*/
2949
+ 8320 && (t = !/*isEditable*/
2950
2950
  s[7](
2951
2951
  /*annotation*/
2952
- s[31]
2952
+ s[32]
2953
2953
  )), t ? i ? (i.p(et(s), r), r[0] & /*isEditable, $store*/
2954
- 4224 && D(i, 1)) : (i = It(et(s)), i.c(), D(i, 1), i.m(n.parentNode, n)) : i && (ie(), X(i, 1, 1, () => {
2954
+ 8320 && D(i, 1)) : (i = Ct(et(s)), i.c(), D(i, 1), i.m(n.parentNode, n)) : i && (ne(), N(i, 1, 1, () => {
2955
2955
  i = null;
2956
- }), se());
2956
+ }), oe());
2957
2957
  },
2958
2958
  i(s) {
2959
2959
  o || (D(i), o = !0);
2960
2960
  },
2961
2961
  o(s) {
2962
- X(i), o = !1;
2962
+ N(i), o = !1;
2963
2963
  },
2964
2964
  d(s) {
2965
- i && i.d(s), s && L(n);
2965
+ i && i.d(s), s && k(n);
2966
2966
  }
2967
2967
  };
2968
2968
  }
2969
- function Rt(e) {
2969
+ function Yt(e) {
2970
2970
  let t, n, o, i;
2971
2971
  const s = [ni, ti], r = [];
2972
2972
  function a(l, d) {
@@ -2974,60 +2974,60 @@ function Rt(e) {
2974
2974
  /*editableAnnotations*/
2975
2975
  l[6] ? 0 : (
2976
2976
  /*tool*/
2977
- l[2] && /*drawingEnabled*/
2977
+ l[12] && /*drawingEnabled*/
2978
2978
  l[0] ? 1 : -1
2979
2979
  )
2980
2980
  );
2981
2981
  }
2982
2982
  return ~(t = a(e)) && (n = r[t] = s[t](e)), {
2983
2983
  c() {
2984
- n && n.c(), o = le();
2984
+ n && n.c(), o = se();
2985
2985
  },
2986
2986
  m(l, d) {
2987
- ~t && r[t].m(l, d), k(l, o, d), i = !0;
2987
+ ~t && r[t].m(l, d), B(l, o, d), i = !0;
2988
2988
  },
2989
2989
  p(l, d) {
2990
2990
  let h = t;
2991
- t = a(l), t === h ? ~t && r[t].p(l, d) : (n && (ie(), X(r[h], 1, 1, () => {
2991
+ t = a(l), t === h ? ~t && r[t].p(l, d) : (n && (ne(), N(r[h], 1, 1, () => {
2992
2992
  r[h] = null;
2993
- }), se()), ~t ? (n = r[t], n ? n.p(l, d) : (n = r[t] = s[t](l), n.c()), D(n, 1), n.m(o.parentNode, o)) : n = null);
2993
+ }), oe()), ~t ? (n = r[t], n ? n.p(l, d) : (n = r[t] = s[t](l), n.c()), D(n, 1), n.m(o.parentNode, o)) : n = null);
2994
2994
  },
2995
2995
  i(l) {
2996
2996
  i || (D(n), i = !0);
2997
2997
  },
2998
2998
  o(l) {
2999
- X(n), i = !1;
2999
+ N(n), i = !1;
3000
3000
  },
3001
3001
  d(l) {
3002
- ~t && r[t].d(l), l && L(o);
3002
+ ~t && r[t].d(l), l && k(o);
3003
3003
  }
3004
3004
  };
3005
3005
  }
3006
3006
  function ti(e) {
3007
3007
  let t = (
3008
- /*tool*/
3008
+ /*toolName*/
3009
3009
  e[2]
3010
- ), n, o, i = Yt(e);
3010
+ ), n, o, i = Ut(e);
3011
3011
  return {
3012
3012
  c() {
3013
- i.c(), n = le();
3013
+ i.c(), n = se();
3014
3014
  },
3015
3015
  m(s, r) {
3016
- i.m(s, r), k(s, n, r), o = !0;
3016
+ i.m(s, r), B(s, n, r), o = !0;
3017
3017
  },
3018
3018
  p(s, r) {
3019
- r[0] & /*tool*/
3020
- 4 && Z(t, t = /*tool*/
3021
- s[2]) ? (ie(), X(i, 1, 1, V), se(), i = Yt(s), i.c(), D(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3019
+ r[0] & /*toolName*/
3020
+ 4 && K(t, t = /*toolName*/
3021
+ s[2]) ? (ne(), N(i, 1, 1, z), oe(), i = Ut(s), i.c(), D(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3022
3022
  },
3023
3023
  i(s) {
3024
3024
  o || (D(i), o = !0);
3025
3025
  },
3026
3026
  o(s) {
3027
- X(i), o = !1;
3027
+ N(i), o = !1;
3028
3028
  },
3029
3029
  d(s) {
3030
- s && L(n), i.d(s);
3030
+ s && k(n), i.d(s);
3031
3031
  }
3032
3032
  };
3033
3033
  }
@@ -3037,34 +3037,34 @@ function ni(e) {
3037
3037
  e[6]
3038
3038
  ), i = [];
3039
3039
  for (let r = 0; r < o.length; r += 1)
3040
- i[r] = Dt(kt(e, o, r));
3041
- const s = (r) => X(i[r], 1, 1, () => {
3040
+ i[r] = Xt(Bt(e, o, r));
3041
+ const s = (r) => N(i[r], 1, 1, () => {
3042
3042
  i[r] = null;
3043
3043
  });
3044
3044
  return {
3045
3045
  c() {
3046
3046
  for (let r = 0; r < i.length; r += 1)
3047
3047
  i[r].c();
3048
- t = le();
3048
+ t = se();
3049
3049
  },
3050
3050
  m(r, a) {
3051
3051
  for (let l = 0; l < i.length; l += 1)
3052
3052
  i[l] && i[l].m(r, a);
3053
- k(r, t, a), n = !0;
3053
+ B(r, t, a), n = !0;
3054
3054
  },
3055
3055
  p(r, a) {
3056
3056
  if (a[0] & /*editableAnnotations, drawingEl, style, transform, $scale, onChangeSelected*/
3057
- 140370) {
3057
+ 279634) {
3058
3058
  o = /*editableAnnotations*/
3059
3059
  r[6];
3060
3060
  let l;
3061
3061
  for (l = 0; l < o.length; l += 1) {
3062
- const d = kt(r, o, l);
3063
- i[l] ? (i[l].p(d, a), D(i[l], 1)) : (i[l] = Dt(d), i[l].c(), D(i[l], 1), i[l].m(t.parentNode, t));
3062
+ const d = Bt(r, o, l);
3063
+ i[l] ? (i[l].p(d, a), D(i[l], 1)) : (i[l] = Xt(d), i[l].c(), D(i[l], 1), i[l].m(t.parentNode, t));
3064
3064
  }
3065
- for (ie(), l = o.length; l < i.length; l += 1)
3065
+ for (ne(), l = o.length; l < i.length; l += 1)
3066
3066
  s(l);
3067
- se();
3067
+ oe();
3068
3068
  }
3069
3069
  },
3070
3070
  i(r) {
@@ -3077,17 +3077,17 @@ function ni(e) {
3077
3077
  o(r) {
3078
3078
  i = i.filter(Boolean);
3079
3079
  for (let a = 0; a < i.length; a += 1)
3080
- X(i[a]);
3080
+ N(i[a]);
3081
3081
  n = !1;
3082
3082
  },
3083
3083
  d(r) {
3084
- rt(i, r), r && L(t);
3084
+ lt(i, r), r && k(t);
3085
3085
  }
3086
3086
  };
3087
3087
  }
3088
- function Yt(e) {
3088
+ function Ut(e) {
3089
3089
  let t, n;
3090
- return t = new So({
3090
+ return t = new Mo({
3091
3091
  props: {
3092
3092
  target: (
3093
3093
  /*drawingEl*/
@@ -3095,7 +3095,7 @@ function Yt(e) {
3095
3095
  ),
3096
3096
  tool: (
3097
3097
  /*tool*/
3098
- e[2]
3098
+ e[12]
3099
3099
  ),
3100
3100
  drawingMode: (
3101
3101
  /*drawingMode*/
@@ -3107,60 +3107,60 @@ function Yt(e) {
3107
3107
  ),
3108
3108
  viewportScale: (
3109
3109
  /*$scale*/
3110
- e[13]
3110
+ e[14]
3111
3111
  )
3112
3112
  }
3113
3113
  }), t.$on(
3114
3114
  "create",
3115
3115
  /*onSelectionCreated*/
3116
- e[16]
3116
+ e[17]
3117
3117
  ), {
3118
3118
  c() {
3119
- ge(t.$$.fragment);
3119
+ he(t.$$.fragment);
3120
3120
  },
3121
3121
  m(o, i) {
3122
- ce(t, o, i), n = !0;
3122
+ le(t, o, i), n = !0;
3123
3123
  },
3124
3124
  p(o, i) {
3125
3125
  const s = {};
3126
3126
  i[0] & /*drawingEl*/
3127
3127
  16 && (s.target = /*drawingEl*/
3128
3128
  o[4]), i[0] & /*tool*/
3129
- 4 && (s.tool = /*tool*/
3130
- o[2]), i[0] & /*drawingMode*/
3129
+ 4096 && (s.tool = /*tool*/
3130
+ o[12]), i[0] & /*drawingMode*/
3131
3131
  2048 && (s.drawingMode = /*drawingMode*/
3132
3132
  o[11]), i[0] & /*transform*/
3133
3133
  1024 && (s.transform = /*transform*/
3134
3134
  o[10]), i[0] & /*$scale*/
3135
- 8192 && (s.viewportScale = /*$scale*/
3136
- o[13]), t.$set(s);
3135
+ 16384 && (s.viewportScale = /*$scale*/
3136
+ o[14]), t.$set(s);
3137
3137
  },
3138
3138
  i(o) {
3139
3139
  n || (D(t.$$.fragment, o), n = !0);
3140
3140
  },
3141
3141
  o(o) {
3142
- X(t.$$.fragment, o), n = !1;
3142
+ N(t.$$.fragment, o), n = !1;
3143
3143
  },
3144
3144
  d(o) {
3145
- de(t, o);
3145
+ ae(t, o);
3146
3146
  }
3147
3147
  };
3148
3148
  }
3149
- function Ut(e) {
3149
+ function Dt(e) {
3150
3150
  let t, n;
3151
- return t = new Ao({
3151
+ return t = new To({
3152
3152
  props: {
3153
3153
  target: (
3154
3154
  /*drawingEl*/
3155
3155
  e[4]
3156
3156
  ),
3157
- editor: St(
3157
+ editor: Mt(
3158
3158
  /*editable*/
3159
- e[28].target.selector
3159
+ e[29].target.selector
3160
3160
  ),
3161
3161
  annotation: (
3162
3162
  /*editable*/
3163
- e[28]
3163
+ e[29]
3164
3164
  ),
3165
3165
  style: (
3166
3166
  /*style*/
@@ -3172,26 +3172,26 @@ function Ut(e) {
3172
3172
  ),
3173
3173
  viewportScale: (
3174
3174
  /*$scale*/
3175
- e[13]
3175
+ e[14]
3176
3176
  )
3177
3177
  }
3178
3178
  }), t.$on("change", function() {
3179
- H(
3179
+ j(
3180
3180
  /*onChangeSelected*/
3181
- e[17](
3181
+ e[18](
3182
3182
  /*editable*/
3183
- e[28]
3183
+ e[29]
3184
3184
  )
3185
- ) && e[17](
3185
+ ) && e[18](
3186
3186
  /*editable*/
3187
- e[28]
3187
+ e[29]
3188
3188
  ).apply(this, arguments);
3189
3189
  }), {
3190
3190
  c() {
3191
- ge(t.$$.fragment);
3191
+ he(t.$$.fragment);
3192
3192
  },
3193
3193
  m(o, i) {
3194
- ce(t, o, i), n = !0;
3194
+ le(t, o, i), n = !0;
3195
3195
  },
3196
3196
  p(o, i) {
3197
3197
  e = o;
@@ -3199,97 +3199,97 @@ function Ut(e) {
3199
3199
  i[0] & /*drawingEl*/
3200
3200
  16 && (s.target = /*drawingEl*/
3201
3201
  e[4]), i[0] & /*editableAnnotations*/
3202
- 64 && (s.editor = St(
3202
+ 64 && (s.editor = Mt(
3203
3203
  /*editable*/
3204
- e[28].target.selector
3204
+ e[29].target.selector
3205
3205
  )), i[0] & /*editableAnnotations*/
3206
3206
  64 && (s.annotation = /*editable*/
3207
- e[28]), i[0] & /*style*/
3207
+ e[29]), i[0] & /*style*/
3208
3208
  2 && (s.style = /*style*/
3209
3209
  e[1]), i[0] & /*transform*/
3210
3210
  1024 && (s.transform = /*transform*/
3211
3211
  e[10]), i[0] & /*$scale*/
3212
- 8192 && (s.viewportScale = /*$scale*/
3213
- e[13]), t.$set(s);
3212
+ 16384 && (s.viewportScale = /*$scale*/
3213
+ e[14]), t.$set(s);
3214
3214
  },
3215
3215
  i(o) {
3216
3216
  n || (D(t.$$.fragment, o), n = !0);
3217
3217
  },
3218
3218
  o(o) {
3219
- X(t.$$.fragment, o), n = !1;
3219
+ N(t.$$.fragment, o), n = !1;
3220
3220
  },
3221
3221
  d(o) {
3222
- de(t, o);
3222
+ ae(t, o);
3223
3223
  }
3224
3224
  };
3225
3225
  }
3226
- function Dt(e) {
3226
+ function Xt(e) {
3227
3227
  let t = (
3228
3228
  /*editable*/
3229
- e[28].id
3230
- ), n, o, i = Ut(e);
3229
+ e[29].id
3230
+ ), n, o, i = Dt(e);
3231
3231
  return {
3232
3232
  c() {
3233
- i.c(), n = le();
3233
+ i.c(), n = se();
3234
3234
  },
3235
3235
  m(s, r) {
3236
- i.m(s, r), k(s, n, r), o = !0;
3236
+ i.m(s, r), B(s, n, r), o = !0;
3237
3237
  },
3238
3238
  p(s, r) {
3239
3239
  r[0] & /*editableAnnotations*/
3240
- 64 && Z(t, t = /*editable*/
3241
- s[28].id) ? (ie(), X(i, 1, 1, V), se(), i = Ut(s), i.c(), D(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3240
+ 64 && K(t, t = /*editable*/
3241
+ s[29].id) ? (ne(), N(i, 1, 1, z), oe(), i = Dt(s), i.c(), D(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
3242
3242
  },
3243
3243
  i(s) {
3244
3244
  o || (D(i), o = !0);
3245
3245
  },
3246
3246
  o(s) {
3247
- X(i), o = !1;
3247
+ N(i), o = !1;
3248
3248
  },
3249
3249
  d(s) {
3250
- s && L(n), i.d(s);
3250
+ s && k(n), i.d(s);
3251
3251
  }
3252
3252
  };
3253
3253
  }
3254
3254
  function oi(e) {
3255
3255
  let t, n, o, i, s, r, a = (
3256
3256
  /*$store*/
3257
- e[12]
3257
+ e[13]
3258
3258
  ), l = [];
3259
3259
  for (let c = 0; c < a.length; c += 1)
3260
- l[c] = Pt(Bt(e, a, c));
3261
- const d = (c) => X(l[c], 1, 1, () => {
3260
+ l[c] = Rt(It(e, a, c));
3261
+ const d = (c) => N(l[c], 1, 1, () => {
3262
3262
  l[c] = null;
3263
3263
  });
3264
3264
  let h = (
3265
3265
  /*drawingEl*/
3266
- e[4] && Rt(e)
3266
+ e[4] && Yt(e)
3267
3267
  );
3268
3268
  return {
3269
3269
  c() {
3270
3270
  t = U("svg"), n = U("g");
3271
3271
  for (let c = 0; c < l.length; c += 1)
3272
3272
  l[c].c();
3273
- o = U("g"), h && h.c(), f(o, "class", "drawing"), f(t, "class", "a9s-annotationlayer"), mt(
3273
+ o = U("g"), h && h.c(), f(o, "class", "drawing"), f(t, "class", "a9s-annotationlayer"), pt(
3274
3274
  t,
3275
3275
  "drawing",
3276
3276
  /*tool*/
3277
- e[2]
3277
+ e[12]
3278
3278
  );
3279
3279
  },
3280
3280
  m(c, g) {
3281
- k(c, t, g), ae(t, n);
3281
+ B(c, t, g), re(t, n);
3282
3282
  for (let u = 0; u < l.length; u += 1)
3283
3283
  l[u] && l[u].m(n, null);
3284
- ae(t, o), h && h.m(o, null), e[24](o), e[25](t), i = !0, s || (r = [
3284
+ re(t, o), h && h.m(o, null), e[25](o), e[26](t), i = !0, s || (r = [
3285
3285
  W(t, "pointerup", function() {
3286
- H(
3286
+ j(
3287
3287
  /*onPointerUp*/
3288
3288
  e[8]
3289
3289
  ) && e[8].apply(this, arguments);
3290
3290
  }),
3291
3291
  W(t, "pointerdown", function() {
3292
- H(
3292
+ j(
3293
3293
  /*onPointerDown*/
3294
3294
  e[9]
3295
3295
  ) && e[9].apply(this, arguments);
@@ -3298,28 +3298,28 @@ function oi(e) {
3298
3298
  },
3299
3299
  p(c, g) {
3300
3300
  if (e = c, g[0] & /*$store, style, isEditable*/
3301
- 4226) {
3301
+ 8322) {
3302
3302
  a = /*$store*/
3303
- e[12];
3303
+ e[13];
3304
3304
  let u;
3305
3305
  for (u = 0; u < a.length; u += 1) {
3306
- const m = Bt(e, a, u);
3307
- l[u] ? (l[u].p(m, g), D(l[u], 1)) : (l[u] = Pt(m), l[u].c(), D(l[u], 1), l[u].m(n, null));
3306
+ const m = It(e, a, u);
3307
+ l[u] ? (l[u].p(m, g), D(l[u], 1)) : (l[u] = Rt(m), l[u].c(), D(l[u], 1), l[u].m(n, null));
3308
3308
  }
3309
- for (ie(), u = a.length; u < l.length; u += 1)
3309
+ for (ne(), u = a.length; u < l.length; u += 1)
3310
3310
  d(u);
3311
- se();
3311
+ oe();
3312
3312
  }
3313
3313
  /*drawingEl*/
3314
3314
  e[4] ? h ? (h.p(e, g), g[0] & /*drawingEl*/
3315
- 16 && D(h, 1)) : (h = Rt(e), h.c(), D(h, 1), h.m(o, null)) : h && (ie(), X(h, 1, 1, () => {
3315
+ 16 && D(h, 1)) : (h = Yt(e), h.c(), D(h, 1), h.m(o, null)) : h && (ne(), N(h, 1, 1, () => {
3316
3316
  h = null;
3317
- }), se()), (!i || g[0] & /*tool*/
3318
- 4) && mt(
3317
+ }), oe()), (!i || g[0] & /*tool*/
3318
+ 4096) && pt(
3319
3319
  t,
3320
3320
  "drawing",
3321
3321
  /*tool*/
3322
- e[2]
3322
+ e[12]
3323
3323
  );
3324
3324
  },
3325
3325
  i(c) {
@@ -3332,116 +3332,117 @@ function oi(e) {
3332
3332
  o(c) {
3333
3333
  l = l.filter(Boolean);
3334
3334
  for (let g = 0; g < l.length; g += 1)
3335
- X(l[g]);
3336
- X(h), i = !1;
3335
+ N(l[g]);
3336
+ N(h), i = !1;
3337
3337
  },
3338
3338
  d(c) {
3339
- c && L(t), rt(l, c), h && h.d(), e[24](null), e[25](null), s = !1, re(r);
3339
+ c && k(t), lt(l, c), h && h.d(), e[25](null), e[26](null), s = !1, ie(r);
3340
3340
  }
3341
3341
  };
3342
3342
  }
3343
3343
  function ii(e, t, n) {
3344
- let o, i, s, r, a, l, d, h, c = V, g = () => (c(), c = Ft(A, (C) => n(13, h = C)), A);
3345
- e.$$.on_destroy.push(() => c());
3346
- let { drawingEnabled: u } = t, { image: m } = t, { preferredDrawingMode: w } = t, { state: b } = t, { style: _ = void 0 } = t, { tool: p, opts: T } = $t("rectangle"), { tool: S = p, opts: I = T } = t, { user: R } = t, N, y, A;
3347
- Pe(() => g(n(5, A = Bo(m, y))));
3348
- const { selection: E, store: v } = b;
3349
- gt(e, E, (C) => n(23, l = C)), gt(e, v, (C) => n(12, d = C));
3350
- let B = null, Y = null;
3351
- const Q = (C) => {
3352
- v.unobserve(B);
3353
- const J = C.filter(({ editable: z }) => z).map(({ id: z }) => z);
3354
- J.length > 0 ? (n(6, Y = J.map((z) => v.getAnnotation(z))), B = (z) => {
3355
- const { updated: j } = z.changes;
3356
- n(6, Y = j.map((oe) => oe.newValue));
3357
- }, v.observe(B, { annotations: J })) : n(6, Y = null);
3358
- }, me = (C) => {
3359
- const J = ct(), z = {
3344
+ let o, i, s, r, a, l, d, h, c, g, u = z, m = () => (u(), u = Ht(y, (L) => n(14, g = L)), y);
3345
+ e.$$.on_destroy.push(() => u());
3346
+ let { drawingEnabled: w } = t, { image: b } = t, { preferredDrawingMode: _ } = t, { state: p } = t, { style: A = void 0 } = t, { toolName: S = rt().length > 0 ? rt()[0] : void 0 } = t, { user: C } = t, R, X, y;
3347
+ Ce(() => m(n(5, y = Io(b, X))));
3348
+ const { selection: T, store: E } = p;
3349
+ mt(e, T, (L) => n(24, h = L)), mt(e, E, (L) => n(13, c = L));
3350
+ let v = null, I = null;
3351
+ const Y = (L) => {
3352
+ E.unobserve(v);
3353
+ const J = L.filter(({ editable: V }) => V).map(({ id: V }) => V);
3354
+ J.length > 0 ? (n(6, I = J.map((V) => E.getAnnotation(V))), v = (V) => {
3355
+ const { updated: ce } = V.changes;
3356
+ n(6, I = ce.map((F) => F.newValue));
3357
+ }, E.observe(v, { annotations: J })) : n(6, I = null);
3358
+ }, Z = (L) => {
3359
+ const J = dt(), V = {
3360
3360
  id: J,
3361
3361
  bodies: [],
3362
3362
  target: {
3363
3363
  annotation: J,
3364
- selector: C.detail,
3365
- creator: R,
3364
+ selector: L.detail,
3365
+ creator: C,
3366
3366
  created: /* @__PURE__ */ new Date()
3367
3367
  }
3368
3368
  };
3369
- v.addAnnotation(z), E.setSelected(z.id);
3370
- }, pe = (C) => (J) => {
3371
- var ue;
3372
- const { target: z } = C, j = 10 * 60 * 1e3, oe = ((ue = z.creator) == null ? void 0 : ue.id) !== R.id || !z.created || (/* @__PURE__ */ new Date()).getTime() - z.created.getTime() > j;
3373
- v.updateTarget({
3374
- ...z,
3369
+ E.addAnnotation(V), T.setSelected(V.id);
3370
+ }, ge = (L) => (J) => {
3371
+ var de;
3372
+ const { target: V } = L, ce = 10 * 60 * 1e3, F = ((de = V.creator) == null ? void 0 : de.id) !== C.id || !V.created || (/* @__PURE__ */ new Date()).getTime() - V.created.getTime() > ce;
3373
+ E.updateTarget({
3374
+ ...V,
3375
3375
  selector: J.detail,
3376
- created: oe ? z.created : /* @__PURE__ */ new Date(),
3377
- updated: oe ? /* @__PURE__ */ new Date() : null,
3378
- updatedBy: oe ? R : null
3376
+ created: F ? V.created : /* @__PURE__ */ new Date(),
3377
+ updated: F ? /* @__PURE__ */ new Date() : null,
3378
+ updatedBy: F ? C : null
3379
3379
  });
3380
3380
  };
3381
- function Me(C) {
3382
- ze[C ? "unshift" : "push"](() => {
3383
- N = C, n(4, N);
3381
+ function me(L) {
3382
+ ze[L ? "unshift" : "push"](() => {
3383
+ R = L, n(4, R);
3384
3384
  });
3385
3385
  }
3386
- function K(C) {
3387
- ze[C ? "unshift" : "push"](() => {
3388
- y = C, n(3, y);
3386
+ function Me(L) {
3387
+ ze[L ? "unshift" : "push"](() => {
3388
+ X = L, n(3, X);
3389
3389
  });
3390
3390
  }
3391
- return e.$$set = (C) => {
3392
- "drawingEnabled" in C && n(0, u = C.drawingEnabled), "image" in C && n(18, m = C.image), "preferredDrawingMode" in C && n(19, w = C.preferredDrawingMode), "state" in C && n(20, b = C.state), "style" in C && n(1, _ = C.style), "tool" in C && n(2, S = C.tool), "opts" in C && n(21, I = C.opts), "user" in C && n(22, R = C.user);
3391
+ return e.$$set = (L) => {
3392
+ "drawingEnabled" in L && n(0, w = L.drawingEnabled), "image" in L && n(19, b = L.image), "preferredDrawingMode" in L && n(20, _ = L.preferredDrawingMode), "state" in L && n(21, p = L.state), "style" in L && n(1, A = L.style), "toolName" in L && n(2, S = L.toolName), "user" in L && n(22, C = L.user);
3393
3393
  }, e.$$.update = () => {
3394
- e.$$.dirty[0] & /*opts, preferredDrawingMode*/
3395
- 2621440 && n(11, o = (I == null ? void 0 : I.drawingMode) || w), e.$$.dirty[0] & /*svgEl*/
3396
- 8 && n(10, i = Jo(y)), e.$$.dirty[0] & /*svgEl*/
3397
- 8 && n(9, { onPointerDown: s, onPointerUp: r } = Zo(y, v), s, (n(8, r), n(3, y))), e.$$.dirty[0] & /*$selection*/
3398
- 8388608 && n(7, a = (C) => l.selected.find((J) => J.id === C.id && J.editable)), e.$$.dirty[0] & /*$selection*/
3399
- 8388608 && Q(l.selected);
3394
+ e.$$.dirty[0] & /*toolName*/
3395
+ 4 && n(12, { tool: o, opts: i } = en(S), o, (n(23, i), n(2, S))), e.$$.dirty[0] & /*opts, preferredDrawingMode*/
3396
+ 9437184 && n(11, s = (i == null ? void 0 : i.drawingMode) || _), e.$$.dirty[0] & /*svgEl*/
3397
+ 8 && n(10, r = Jo(X)), e.$$.dirty[0] & /*svgEl*/
3398
+ 8 && n(9, { onPointerDown: a, onPointerUp: l } = Zo(X, E), a, (n(8, l), n(3, X))), e.$$.dirty[0] & /*$selection*/
3399
+ 16777216 && n(7, d = (L) => h.selected.find((J) => J.id === L.id && J.editable)), e.$$.dirty[0] & /*$selection*/
3400
+ 16777216 && Y(h.selected);
3400
3401
  }, [
3401
- u,
3402
- _,
3402
+ w,
3403
+ A,
3403
3404
  S,
3405
+ X,
3406
+ R,
3404
3407
  y,
3405
- N,
3406
- A,
3407
- Y,
3408
+ I,
3409
+ d,
3410
+ l,
3408
3411
  a,
3409
3412
  r,
3410
3413
  s,
3411
- i,
3412
3414
  o,
3413
- d,
3414
- h,
3415
+ c,
3416
+ g,
3417
+ T,
3415
3418
  E,
3416
- v,
3417
- me,
3418
- pe,
3419
- m,
3420
- w,
3419
+ Z,
3420
+ ge,
3421
3421
  b,
3422
- I,
3423
- R,
3424
- l,
3425
- Me,
3426
- K
3422
+ _,
3423
+ p,
3424
+ C,
3425
+ i,
3426
+ h,
3427
+ me,
3428
+ Me
3427
3429
  ];
3428
3430
  }
3429
- class si extends ne {
3431
+ class si extends te {
3430
3432
  constructor(t) {
3431
- super(), te(
3433
+ super(), ee(
3432
3434
  this,
3433
3435
  t,
3434
3436
  ii,
3435
3437
  oi,
3436
- Z,
3438
+ K,
3437
3439
  {
3438
3440
  drawingEnabled: 0,
3439
- image: 18,
3440
- preferredDrawingMode: 19,
3441
- state: 20,
3441
+ image: 19,
3442
+ preferredDrawingMode: 20,
3443
+ state: 21,
3442
3444
  style: 1,
3443
- tool: 2,
3444
- opts: 21,
3445
+ toolName: 2,
3445
3446
  user: 22
3446
3447
  },
3447
3448
  null,
@@ -3450,25 +3451,25 @@ class si extends ne {
3450
3451
  }
3451
3452
  }
3452
3453
  function ri(e, t, n, o, i) {
3453
- en(e, t, n || 0, o || e.length - 1, i || li);
3454
+ tn(e, t, n || 0, o || e.length - 1, i || li);
3454
3455
  }
3455
- function en(e, t, n, o, i) {
3456
+ function tn(e, t, n, o, i) {
3456
3457
  for (; o > n; ) {
3457
3458
  if (o - n > 600) {
3458
3459
  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), h = Math.max(n, Math.floor(t - r * l / s + d)), c = Math.min(o, Math.floor(t + (s - r) * l / s + d));
3459
- en(e, t, h, c, i);
3460
+ tn(e, t, h, c, i);
3460
3461
  }
3461
3462
  var g = e[t], u = n, m = o;
3462
- for (Oe(e, n, t), i(e[o], g) > 0 && Oe(e, n, o); u < m; ) {
3463
- for (Oe(e, u, m), u++, m--; i(e[u], g) < 0; )
3463
+ for (ve(e, n, t), i(e[o], g) > 0 && ve(e, n, o); u < m; ) {
3464
+ for (ve(e, u, m), u++, m--; i(e[u], g) < 0; )
3464
3465
  u++;
3465
3466
  for (; i(e[m], g) > 0; )
3466
3467
  m--;
3467
3468
  }
3468
- i(e[n], g) === 0 ? Oe(e, n, m) : (m++, Oe(e, m, o)), m <= t && (n = m + 1), t <= m && (o = m - 1);
3469
+ i(e[n], g) === 0 ? ve(e, n, m) : (m++, ve(e, m, o)), m <= t && (n = m + 1), t <= m && (o = m - 1);
3469
3470
  }
3470
3471
  }
3471
- function Oe(e, t, n) {
3472
+ function ve(e, t, n) {
3472
3473
  var o = e[t];
3473
3474
  e[t] = e[n], e[n] = o;
3474
3475
  }
@@ -3541,7 +3542,7 @@ class ai {
3541
3542
  return t && this._insert(t, this.data.height - 1), this;
3542
3543
  }
3543
3544
  clear() {
3544
- return this.data = Ae([]), this;
3545
+ return this.data = Ee([]), this;
3545
3546
  }
3546
3547
  remove(t, n) {
3547
3548
  if (!t)
@@ -3584,19 +3585,19 @@ class ai {
3584
3585
  const s = o - n + 1;
3585
3586
  let r = this._maxEntries, a;
3586
3587
  if (s <= r)
3587
- return a = Ae(t.slice(n, o + 1)), be(a, this.toBBox), a;
3588
- i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = Ae([]), a.leaf = !1, a.height = i;
3588
+ return a = Ee(t.slice(n, o + 1)), we(a, this.toBBox), a;
3589
+ 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;
3589
3590
  const l = Math.ceil(s / r), d = l * Math.ceil(Math.sqrt(r));
3590
- Xt(t, n, o, d, this.compareMinX);
3591
+ Nt(t, n, o, d, this.compareMinX);
3591
3592
  for (let h = n; h <= o; h += d) {
3592
3593
  const c = Math.min(h + d - 1, o);
3593
- Xt(t, h, c, l, this.compareMinY);
3594
+ Nt(t, h, c, l, this.compareMinY);
3594
3595
  for (let g = h; g <= c; g += l) {
3595
3596
  const u = Math.min(g + l - 1, c);
3596
3597
  a.children.push(this._build(t, g, u, i - 1));
3597
3598
  }
3598
3599
  }
3599
- return be(a, this.toBBox), a;
3600
+ return we(a, this.toBBox), a;
3600
3601
  }
3601
3602
  _chooseSubtree(t, n, o, i) {
3602
3603
  for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
@@ -3611,7 +3612,7 @@ class ai {
3611
3612
  }
3612
3613
  _insert(t, n, o) {
3613
3614
  const i = o ? t : this.toBBox(t), s = [], r = this._chooseSubtree(i, this.data, n, s);
3614
- for (r.children.push(t), ke(r, i); n >= 0 && s[n].children.length > this._maxEntries; )
3615
+ for (r.children.push(t), Le(r, i); n >= 0 && s[n].children.length > this._maxEntries; )
3615
3616
  this._split(s, n), n--;
3616
3617
  this._adjustParentBBoxes(i, s, n);
3617
3618
  }
@@ -3619,16 +3620,16 @@ class ai {
3619
3620
  _split(t, n) {
3620
3621
  const o = t[n], i = o.children.length, s = this._minEntries;
3621
3622
  this._chooseSplitAxis(o, s, i);
3622
- const r = this._chooseSplitIndex(o, s, i), a = Ae(o.children.splice(r, o.children.length - r));
3623
- a.height = o.height, a.leaf = o.leaf, be(o, this.toBBox), be(a, this.toBBox), n ? t[n - 1].children.push(a) : this._splitRoot(o, a);
3623
+ const r = this._chooseSplitIndex(o, s, i), a = Ee(o.children.splice(r, o.children.length - r));
3624
+ a.height = o.height, a.leaf = o.leaf, we(o, this.toBBox), we(a, this.toBBox), n ? t[n - 1].children.push(a) : this._splitRoot(o, a);
3624
3625
  }
3625
3626
  _splitRoot(t, n) {
3626
- this.data = Ae([t, n]), this.data.height = t.height + 1, this.data.leaf = !1, be(this.data, this.toBBox);
3627
+ this.data = Ee([t, n]), this.data.height = t.height + 1, this.data.leaf = !1, we(this.data, this.toBBox);
3627
3628
  }
3628
3629
  _chooseSplitIndex(t, n, o) {
3629
3630
  let i, s = 1 / 0, r = 1 / 0;
3630
3631
  for (let a = n; a <= o - n; a++) {
3631
- const l = Le(t, 0, a, this.toBBox), d = Le(t, a, o, this.toBBox), h = hi(l, d), c = tt(l) + tt(d);
3632
+ const l = Oe(t, 0, a, this.toBBox), d = Oe(t, a, o, this.toBBox), h = hi(l, d), c = tt(l) + tt(d);
3632
3633
  h < s ? (s = h, i = a, r = c < r ? c : r) : h === s && c < r && (r = c, i = a);
3633
3634
  }
3634
3635
  return i || o - n;
@@ -3641,25 +3642,25 @@ class ai {
3641
3642
  // total margin of all possible split distributions where each node is at least m full
3642
3643
  _allDistMargin(t, n, o, i) {
3643
3644
  t.children.sort(i);
3644
- const s = this.toBBox, r = Le(t, 0, n, s), a = Le(t, o - n, o, s);
3645
+ const s = this.toBBox, r = Oe(t, 0, n, s), a = Oe(t, o - n, o, s);
3645
3646
  let l = Ne(r) + Ne(a);
3646
3647
  for (let d = n; d < o - n; d++) {
3647
3648
  const h = t.children[d];
3648
- ke(r, t.leaf ? s(h) : h), l += Ne(r);
3649
+ Le(r, t.leaf ? s(h) : h), l += Ne(r);
3649
3650
  }
3650
3651
  for (let d = o - n - 1; d >= n; d--) {
3651
3652
  const h = t.children[d];
3652
- ke(a, t.leaf ? s(h) : h), l += Ne(a);
3653
+ Le(a, t.leaf ? s(h) : h), l += Ne(a);
3653
3654
  }
3654
3655
  return l;
3655
3656
  }
3656
3657
  _adjustParentBBoxes(t, n, o) {
3657
3658
  for (let i = o; i >= 0; i--)
3658
- ke(n[i], t);
3659
+ Le(n[i], t);
3659
3660
  }
3660
3661
  _condense(t) {
3661
3662
  for (let n = t.length - 1, o; n >= 0; n--)
3662
- t[n].children.length === 0 ? n > 0 ? (o = t[n - 1].children, o.splice(o.indexOf(t[n]), 1)) : this.clear() : be(t[n], this.toBBox);
3663
+ 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);
3663
3664
  }
3664
3665
  }
3665
3666
  function ci(e, t, n) {
@@ -3670,18 +3671,18 @@ function ci(e, t, n) {
3670
3671
  return o;
3671
3672
  return -1;
3672
3673
  }
3673
- function be(e, t) {
3674
- Le(e, 0, e.children.length, t, e);
3674
+ function we(e, t) {
3675
+ Oe(e, 0, e.children.length, t, e);
3675
3676
  }
3676
- function Le(e, t, n, o, i) {
3677
- i || (i = Ae(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
3677
+ function Oe(e, t, n, o, i) {
3678
+ i || (i = Ee(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
3678
3679
  for (let s = t; s < n; s++) {
3679
3680
  const r = e.children[s];
3680
- ke(i, e.leaf ? o(r) : r);
3681
+ Le(i, e.leaf ? o(r) : r);
3681
3682
  }
3682
3683
  return i;
3683
3684
  }
3684
- function ke(e, t) {
3685
+ function Le(e, t) {
3685
3686
  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;
3686
3687
  }
3687
3688
  function di(e, t) {
@@ -3709,7 +3710,7 @@ function nt(e, t) {
3709
3710
  function Ge(e, t) {
3710
3711
  return t.minX <= e.maxX && t.minY <= e.maxY && t.maxX >= e.minX && t.maxY >= e.minY;
3711
3712
  }
3712
- function Ae(e) {
3713
+ function Ee(e) {
3713
3714
  return {
3714
3715
  children: e,
3715
3716
  height: 1,
@@ -3720,7 +3721,7 @@ function Ae(e) {
3720
3721
  maxY: -1 / 0
3721
3722
  };
3722
3723
  }
3723
- function Xt(e, t, n, o, i) {
3724
+ function Nt(e, t, n, o, i) {
3724
3725
  const s = [t, n];
3725
3726
  for (; s.length; ) {
3726
3727
  if (n = s.pop(), t = s.pop(), n - t <= o)
@@ -3748,7 +3749,7 @@ const gi = () => {
3748
3749
  minY: g,
3749
3750
  maxX: c,
3750
3751
  maxY: g
3751
- }).map((w) => w.target).filter((w) => w.selector.type === F.RECTANGLE || mn(w.selector, c, g));
3752
+ }).map((w) => w.target).filter((w) => w.selector.type === H.RECTANGLE || pn(w.selector, c, g));
3752
3753
  if (m.length > 0)
3753
3754
  return m.sort((w, b) => st(w.selector) - st(b.selector)), m[0];
3754
3755
  },
@@ -3774,7 +3775,7 @@ const gi = () => {
3774
3775
  }
3775
3776
  };
3776
3777
  }, mi = (e) => {
3777
- const t = Fn(), n = gi(), o = Pn(t, e.pointerSelectAction), i = Cn(t), s = Jn();
3778
+ const t = Hn(), n = gi(), o = Rn(t, e.pointerSelectAction), i = Pn(t), s = Kn();
3778
3779
  return t.observe(({ changes: l }) => {
3779
3780
  n.set(l.created.map((d) => d.target), !1), l.deleted.forEach((d) => n.remove(d.target)), l.updated.forEach(({ oldValue: d, newValue: h }) => n.update(d.target, h.target));
3780
3781
  }), {
@@ -3794,7 +3795,7 @@ const gi = () => {
3794
3795
  const t = mi(e);
3795
3796
  return {
3796
3797
  ...t,
3797
- store: Hn(t.store)
3798
+ store: jn(t.store)
3798
3799
  };
3799
3800
  }, yi = (e) => {
3800
3801
  let t, n;
@@ -3814,28 +3815,28 @@ const gi = () => {
3814
3815
  }, _i = (e) => {
3815
3816
  const t = yi(e), n = t > 0.6 ? "dark" : "light";
3816
3817
  return console.log(`[Annotorious] Image brightness: ${t.toFixed(1)}. Setting ${n} theme.`), n;
3817
- }, Nt = (e, t, n) => t.setAttribute("data-theme", n === "auto" ? _i(e) : n), wi = (e) => ({
3818
+ }, Gt = (e, t, n) => t.setAttribute("data-theme", n === "auto" ? _i(e) : n), wi = (e) => ({
3818
3819
  ...e,
3819
3820
  drawingEnabled: e.drawingEnabled === void 0 ? !0 : e.drawingEnabled,
3820
3821
  drawingMode: e.drawingMode || "drag",
3821
- pointerSelectAction: e.pointerSelectAction || Kt.EDIT,
3822
+ pointerSelectAction: e.pointerSelectAction || Zt.EDIT,
3822
3823
  theme: e.theme || "light"
3823
- }), Gt = navigator.userAgent.indexOf("Mac OS X") !== -1, bi = (e, t) => {
3824
+ }), Vt = navigator.userAgent.indexOf("Mac OS X") !== -1, bi = (e, t) => {
3824
3825
  const n = t || document, o = (r) => {
3825
3826
  r.key === "Z" && r.ctrlKey ? e.undo() : r.key === "Y" && r.ctrlKey && e.redo();
3826
3827
  }, i = (r) => {
3827
3828
  r.key === "z" && r.metaKey && (r.shiftKey ? e.redo() : e.undo());
3828
3829
  }, s = () => {
3829
- Gt ? n.removeEventListener("keydown", i) : n.removeEventListener("keydown", o);
3830
+ Vt ? n.removeEventListener("keydown", i) : n.removeEventListener("keydown", o);
3830
3831
  };
3831
- return Gt ? n.addEventListener("keydown", i) : n.addEventListener("keydown", o), {
3832
+ return Vt ? n.addEventListener("keydown", i) : n.addEventListener("keydown", o), {
3832
3833
  destroy: s
3833
3834
  };
3834
3835
  };
3835
3836
  const Gi = (e, t = {}) => {
3836
3837
  if (!e)
3837
3838
  throw "Missing argument: image";
3838
- const n = typeof e == "string" ? document.getElementById(e) : e, o = wi(t), i = pi(o), { selection: s, store: r } = i, a = Wn(r), l = Kn(
3839
+ const n = typeof e == "string" ? document.getElementById(e) : e, o = wi(t), i = pi(o), { selection: s, store: r } = i, a = Jn(r), l = Zn(
3839
3840
  i,
3840
3841
  a,
3841
3842
  o.adapter,
@@ -3843,8 +3844,8 @@ const Gi = (e, t = {}) => {
3843
3844
  ), d = document.createElement("DIV");
3844
3845
  d.style.position = "relative", d.style.display = "inline-block", n.style.display = "block", n.parentNode.insertBefore(d, n), d.appendChild(n);
3845
3846
  const h = bi(a);
3846
- let c = no();
3847
- Nt(n, d, o.theme);
3847
+ let c = oo();
3848
+ Gt(n, d, o.theme);
3848
3849
  const g = new si({
3849
3850
  target: d,
3850
3851
  props: {
@@ -3857,34 +3858,35 @@ const Gi = (e, t = {}) => {
3857
3858
  }
3858
3859
  });
3859
3860
  g.$on("click", (y) => {
3860
- const { originalEvent: A, annotation: E } = y.detail;
3861
- E ? s.clickSelect(E.id, A) : s.isEmpty() || s.clear();
3861
+ const { originalEvent: T, annotation: E } = y.detail;
3862
+ E ? s.clickSelect(E.id, T) : s.isEmpty() || s.clear();
3862
3863
  });
3863
- const u = Qn(i, a, o.adapter), m = () => {
3864
+ const u = xn(i, a, o.adapter), m = () => {
3864
3865
  g.$destroy(), d.parentNode.insertBefore(n, d), d.parentNode.removeChild(d), h.destroy(), a.destroy();
3865
- }, w = () => c, b = (y, A, E) => Uo(y, A, E), _ = (y, A) => yo(y, A), p = (y) => {
3866
- const { tool: A, opts: E } = $t(y);
3867
- g.$set({ tool: A, opts: E });
3868
- }, T = (y) => g.$set({ drawingEnabled: y }), S = (y) => {
3866
+ }, w = () => c, b = (y, T, E) => Uo(y, T, E), _ = (y, T) => _o(y, T), p = (y) => {
3867
+ if (!en(y))
3868
+ throw `No drawing tool named ${y}`;
3869
+ g.$set({ toolName: y });
3870
+ }, A = (y) => g.$set({ drawingEnabled: y }), S = (y) => {
3869
3871
  console.warn("Filter not implemented yet");
3870
- }, I = (y) => g.$set({ style: y }), R = (y) => Nt(n, d, y), N = (y) => {
3872
+ }, C = (y) => g.$set({ style: y }), R = (y) => Gt(n, d, y), X = (y) => {
3871
3873
  c = y, g.$set({ user: y });
3872
3874
  };
3873
3875
  return {
3874
3876
  ...u,
3875
3877
  destroy: m,
3876
3878
  getUser: w,
3877
- listDrawingTools: Yo,
3879
+ listDrawingTools: rt,
3878
3880
  on: l.on,
3879
3881
  off: l.off,
3880
3882
  registerDrawingTool: b,
3881
3883
  registerShapeEditor: _,
3882
- setDrawingEnabled: T,
3884
+ setDrawingEnabled: A,
3883
3885
  setDrawingTool: p,
3884
3886
  setFilter: S,
3885
- setStyle: I,
3887
+ setStyle: C,
3886
3888
  setTheme: R,
3887
- setUser: N,
3889
+ setUser: X,
3888
3890
  state: i
3889
3891
  };
3890
3892
  };
@@ -3897,13 +3899,13 @@ const Vi = (e) => {
3897
3899
  ...o
3898
3900
  ].filter((i) => i);
3899
3901
  }, zi = (e, t, n, o) => ({
3900
- id: ct(),
3902
+ id: dt(),
3901
3903
  annotation: e.id,
3902
3904
  created: n || /* @__PURE__ */ new Date(),
3903
3905
  creator: o,
3904
3906
  ...t
3905
3907
  });
3906
- var Vt = Object.prototype.hasOwnProperty;
3908
+ var zt = Object.prototype.hasOwnProperty;
3907
3909
  function He(e, t) {
3908
3910
  var n, o;
3909
3911
  if (e === t)
@@ -3922,7 +3924,7 @@ function He(e, t) {
3922
3924
  if (!n || typeof e == "object") {
3923
3925
  o = 0;
3924
3926
  for (n in e)
3925
- if (Vt.call(e, n) && ++o && !Vt.call(t, n) || !(n in t) || !He(e[n], t[n]))
3927
+ if (zt.call(e, n) && ++o && !zt.call(t, n) || !(n in t) || !He(e[n], t[n]))
3926
3928
  return !1;
3927
3929
  return Object.keys(t).length === o;
3928
3930
  }
@@ -3938,7 +3940,7 @@ const Ai = (e, t) => {
3938
3940
  }, Si = (e, t) => t.bodies.map((n) => {
3939
3941
  const o = e.bodies.find((i) => i.id === n.id);
3940
3942
  return { newBody: n, oldBody: o && !He(o, n) ? o : void 0 };
3941
- }).filter(({ oldBody: n }) => n), vi = (e, t) => !He(e.target, t.target), Fi = (e, t) => {
3943
+ }).filter(({ oldBody: n }) => n), Mi = (e, t) => !He(e.target, t.target), Fi = (e, t) => {
3942
3944
  const n = Ai(e, t), o = Ti(e, t), i = Si(e, t);
3943
3945
  return {
3944
3946
  oldValue: e,
@@ -3946,11 +3948,11 @@ const Ai = (e, t) => {
3946
3948
  bodiesCreated: n.length > 0 ? n : void 0,
3947
3949
  bodiesDeleted: o.length > 0 ? o : void 0,
3948
3950
  bodiesUpdated: i.length > 0 ? i : void 0,
3949
- targetUpdated: vi(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
3951
+ targetUpdated: Mi(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
3950
3952
  };
3951
3953
  };
3952
- var Be = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(Be || {});
3953
- let Mi = () => ({
3954
+ var ke = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(ke || {});
3955
+ let vi = () => ({
3954
3956
  emit(e, ...t) {
3955
3957
  let n = this.events[e] || [];
3956
3958
  for (let o = 0, i = n.length; o < i; o++)
@@ -3978,15 +3980,15 @@ const Hi = (e) => (t) => t.map((n) => e.serialize(n)), Oi = (e) => (t) => t.redu
3978
3980
  const { store: o, selection: i } = e, s = (b) => {
3979
3981
  if (n) {
3980
3982
  const { parsed: _, error: p } = n.parse(b);
3981
- _ ? o.addAnnotation(_, Be.REMOTE) : console.error(p);
3983
+ _ ? o.addAnnotation(_, ke.REMOTE) : console.error(p);
3982
3984
  } else
3983
- o.addAnnotation(b, Be.REMOTE);
3985
+ o.addAnnotation(b, ke.REMOTE);
3984
3986
  }, r = () => i.clear(), a = () => o.clear(), l = (b) => {
3985
3987
  const _ = o.getAnnotation(b);
3986
3988
  return n && _ ? n.serialize(_) : _;
3987
3989
  }, d = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
3988
3990
  var p;
3989
- const _ = (((p = i.selected) == null ? void 0 : p.map((T) => T.id)) || []).map((T) => o.getAnnotation(T));
3991
+ const _ = (((p = i.selected) == null ? void 0 : p.map((A) => A.id)) || []).map((A) => o.getAnnotation(A));
3990
3992
  return n ? _.map(n.serialize) : _;
3991
3993
  }, c = (b) => fetch(b).then((_) => _.json()).then((_) => (u(_), _)), g = (b) => {
3992
3994
  if (typeof b == "string") {
@@ -3999,9 +4001,9 @@ const Hi = (e) => (t) => t.map((n) => e.serialize(n)), Oi = (e) => (t) => t.redu
3999
4001
  }, u = (b) => {
4000
4002
  if (n) {
4001
4003
  const { parsed: _, failed: p } = Oi(n)(b);
4002
- p.length > 0 && console.warn(`Discarded ${p.length} invalid annotations`, p), o.bulkAddAnnotation(_, !0, Be.REMOTE);
4004
+ p.length > 0 && console.warn(`Discarded ${p.length} invalid annotations`, p), o.bulkAddAnnotation(_, !0, ke.REMOTE);
4003
4005
  } else
4004
- o.bulkAddAnnotation(b, !0, Be.REMOTE);
4006
+ o.bulkAddAnnotation(b, !0, ke.REMOTE);
4005
4007
  }, m = (b) => {
4006
4008
  b ? i.setSelected(b) : i.clear();
4007
4009
  }, w = (b) => {
@@ -4103,7 +4105,7 @@ const qi = () => ({ isGuest: !0, id: Bi("1234567890abcdefghijklmnopqrstuvwxyzABC
4103
4105
  };
4104
4106
  }, removeUser: (o) => e.releaseColor(o.appearance.color) };
4105
4107
  }, Ui = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(n)), Ki = Ii(), Zi = (e = Yi()) => {
4106
- const t = Mi(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (c, g) => {
4108
+ const t = vi(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (c, g) => {
4107
4109
  if (n.has(c)) {
4108
4110
  console.warn("Attempt to add user that is already present", c, g);
4109
4111
  return;
@@ -4152,20 +4154,20 @@ const qi = () => ({ isGuest: !0, id: Bi("1234567890abcdefghijklmnopqrstuvwxyzABC
4152
4154
  };
4153
4155
  };
4154
4156
  export {
4155
- xt as Editor,
4156
- Ao as EditorMount,
4157
+ $t as Editor,
4158
+ To as EditorMount,
4157
4159
  O as Handle,
4158
4160
  Ni as IdentityTransform,
4159
- Be as Origin,
4161
+ ke as Origin,
4160
4162
  Ki as PRESENCE_KEY,
4161
4163
  Ei as PointerSelectAction,
4162
- fo as PolygonEditor,
4163
- po as RectangleEditor,
4164
- _n as RectangleUtil,
4165
- Oo as RubberbandRectangle,
4164
+ ho as PolygonEditor,
4165
+ yo as RectangleEditor,
4166
+ wn as RectangleUtil,
4167
+ Lo as RubberbandRectangle,
4166
4168
  si as SVGAnnotationLayer,
4167
- F as ShapeType,
4168
- So as ToolMount,
4169
+ H as ShapeType,
4170
+ Mo as ToolMount,
4169
4171
  Di as W3CImageFormat,
4170
4172
  Zo as addEventListeners,
4171
4173
  Fe as boundsFromPoints,
@@ -4183,29 +4185,29 @@ export {
4183
4185
  _i as detectTheme,
4184
4186
  Fi as diffAnnotations,
4185
4187
  xe as distance,
4186
- Bo as enableResponsive,
4188
+ Io as enableResponsive,
4187
4189
  wi as fillDefaults,
4188
4190
  Vi as getContributors,
4189
- St as getEditor,
4190
- $t as getTool,
4191
+ Mt as getEditor,
4192
+ en as getTool,
4191
4193
  bi as initKeyboardCommands,
4192
- mn as intersects,
4194
+ pn as intersects,
4193
4195
  Xi as isTouch,
4194
- Yo as listDrawingTools,
4196
+ rt as listDrawingTools,
4195
4197
  Oi as parseAll,
4196
- wn as parseFragmentSelector,
4198
+ bn as parseFragmentSelector,
4197
4199
  vn as parseSVGSelector,
4198
4200
  Wi as parseW3CBodies,
4199
- ro as parseW3CImageAnnotation,
4200
- yo as registerEditor,
4201
- at as registerShapeUtil,
4201
+ lo as parseW3CImageAnnotation,
4202
+ _o as registerEditor,
4203
+ ct as registerShapeUtil,
4202
4204
  Uo as registerTool,
4203
4205
  yi as sampleBrightness,
4204
4206
  Hi as serializeAll,
4205
- bn as serializeFragmentSelector,
4206
- Mn as serializeSVGSelector,
4207
+ En as serializeFragmentSelector,
4208
+ On as serializeSVGSelector,
4207
4209
  Ji as serializeW3CBodies,
4208
- lo as serializeW3CImageAnnotation,
4209
- Nt as setTheme
4210
+ ao as serializeW3CImageAnnotation,
4211
+ Gt as setTheme
4210
4212
  };
4211
4213
  //# sourceMappingURL=annotorious.es.js.map