@annotorious/react 3.0.0-rc.4 → 3.0.0-rc.5

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,18 +1,18 @@
1
- function U() {
1
+ function G() {
2
2
  }
3
- function Ke(t, e) {
3
+ function Qe(t, e) {
4
4
  for (const n in e)
5
5
  t[n] = e[n];
6
6
  return t;
7
7
  }
8
- function Oe(t) {
8
+ function Ve(t) {
9
9
  return t();
10
10
  }
11
- function le() {
11
+ function ce() {
12
12
  return /* @__PURE__ */ Object.create(null);
13
13
  }
14
14
  function it(t) {
15
- t.forEach(Oe);
15
+ t.forEach(Ve);
16
16
  }
17
17
  function H(t) {
18
18
  return typeof t == "function";
@@ -20,28 +20,28 @@ function H(t) {
20
20
  function K(t, e) {
21
21
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
22
22
  }
23
- function Je(t) {
23
+ function Ze(t) {
24
24
  return Object.keys(t).length === 0;
25
25
  }
26
- function Ve(t, ...e) {
26
+ function De(t, ...e) {
27
27
  if (t == null)
28
- return U;
28
+ return G;
29
29
  const n = t.subscribe(...e);
30
30
  return n.unsubscribe ? () => n.unsubscribe() : n;
31
31
  }
32
- function de(t, e, n) {
33
- t.$$.on_destroy.push(Ve(e, n));
32
+ function ue(t, e, n) {
33
+ t.$$.on_destroy.push(De(e, n));
34
34
  }
35
- function Qe(t, e, n, o) {
35
+ function tn(t, e, n, o) {
36
36
  if (t) {
37
- const r = ke(t, e, n, o);
37
+ const r = Ce(t, e, n, o);
38
38
  return t[0](r);
39
39
  }
40
40
  }
41
- function ke(t, e, n, o) {
42
- return t[1] && o ? Ke(n.ctx.slice(), t[1](o(e))) : n.ctx;
41
+ function Ce(t, e, n, o) {
42
+ return t[1] && o ? Qe(n.ctx.slice(), t[1](o(e))) : n.ctx;
43
43
  }
44
- function Ze(t, e, n, o) {
44
+ function en(t, e, n, o) {
45
45
  if (t[2] && o) {
46
46
  const r = t[2](o(n));
47
47
  if (e.dirty === void 0)
@@ -56,13 +56,13 @@ function Ze(t, e, n, o) {
56
56
  }
57
57
  return e.dirty;
58
58
  }
59
- function tn(t, e, n, o, r, i) {
59
+ function nn(t, e, n, o, r, i) {
60
60
  if (r) {
61
- const a = ke(e, n, o, i);
61
+ const a = Ce(e, n, o, i);
62
62
  t.p(a, r);
63
63
  }
64
64
  }
65
- function en(t) {
65
+ function on(t) {
66
66
  if (t.ctx.length > 32) {
67
67
  const e = [], n = t.ctx.length / 32;
68
68
  for (let o = 0; o < n; o++)
@@ -74,62 +74,62 @@ function en(t) {
74
74
  function dt(t, e) {
75
75
  t.appendChild(e);
76
76
  }
77
- function B(t, e, n) {
77
+ function Y(t, e, n) {
78
78
  t.insertBefore(e, n || null);
79
79
  }
80
80
  function L(t) {
81
81
  t.parentNode && t.parentNode.removeChild(t);
82
82
  }
83
- function oe(t, e) {
83
+ function re(t, e) {
84
84
  for (let n = 0; n < t.length; n += 1)
85
85
  t[n] && t[n].d(e);
86
86
  }
87
- function O(t) {
87
+ function N(t) {
88
88
  return document.createElementNS("http://www.w3.org/2000/svg", t);
89
89
  }
90
- function Ne(t) {
90
+ function Ue(t) {
91
91
  return document.createTextNode(t);
92
92
  }
93
93
  function tt() {
94
- return Ne(" ");
94
+ return Ue(" ");
95
95
  }
96
96
  function at() {
97
- return Ne("");
97
+ return Ue("");
98
98
  }
99
- function R(t, e, n, o) {
99
+ function z(t, e, n, o) {
100
100
  return t.addEventListener(e, n, o), () => t.removeEventListener(e, n, o);
101
101
  }
102
102
  function u(t, e, n) {
103
103
  n == null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n);
104
104
  }
105
- function nn(t) {
105
+ function rn(t) {
106
106
  return Array.from(t.childNodes);
107
107
  }
108
- function ce(t, e, n) {
108
+ function he(t, e, n) {
109
109
  t.classList[n ? "add" : "remove"](e);
110
110
  }
111
- function on(t, e, { bubbles: n = !1, cancelable: o = !1 } = {}) {
111
+ function an(t, e, { bubbles: n = !1, cancelable: o = !1 } = {}) {
112
112
  const r = document.createEvent("CustomEvent");
113
113
  return r.initCustomEvent(t, n, o, e), r;
114
114
  }
115
- let Xt;
116
- function Bt(t) {
117
- Xt = t;
115
+ let It;
116
+ function _t(t) {
117
+ It = t;
118
118
  }
119
- function De() {
120
- if (!Xt)
119
+ function Ge() {
120
+ if (!It)
121
121
  throw new Error("Function called outside component initialization");
122
- return Xt;
122
+ return It;
123
123
  }
124
- function It(t) {
125
- De().$$.on_mount.push(t);
124
+ function Mt(t) {
125
+ Ge().$$.on_mount.push(t);
126
126
  }
127
- function At() {
128
- const t = De();
127
+ function Tt() {
128
+ const t = Ge();
129
129
  return (e, n, { cancelable: o = !1 } = {}) => {
130
130
  const r = t.$$.callbacks[e];
131
131
  if (r) {
132
- const i = on(e, n, { cancelable: o });
132
+ const i = an(e, n, { cancelable: o });
133
133
  return r.slice().forEach((a) => {
134
134
  a.call(t, i);
135
135
  }), !i.defaultPrevented;
@@ -141,55 +141,55 @@ function vt(t, e) {
141
141
  const n = t.$$.callbacks[e.type];
142
142
  n && n.slice().forEach((o) => o.call(this, e));
143
143
  }
144
- const xt = [], Dt = [];
145
- let Et = [];
146
- const ue = [], rn = /* @__PURE__ */ Promise.resolve();
147
- let te = !1;
148
- function an() {
149
- te || (te = !0, rn.then(Ge));
144
+ const bt = [], Ut = [];
145
+ let At = [];
146
+ const pe = [], sn = /* @__PURE__ */ Promise.resolve();
147
+ let ee = !1;
148
+ function ln() {
149
+ ee || (ee = !0, sn.then(Fe));
150
150
  }
151
- function ee(t) {
152
- Et.push(t);
151
+ function ne(t) {
152
+ At.push(t);
153
153
  }
154
- const Rt = /* @__PURE__ */ new Set();
154
+ const zt = /* @__PURE__ */ new Set();
155
155
  let yt = 0;
156
- function Ge() {
156
+ function Fe() {
157
157
  if (yt !== 0)
158
158
  return;
159
- const t = Xt;
159
+ const t = It;
160
160
  do {
161
161
  try {
162
- for (; yt < xt.length; ) {
163
- const e = xt[yt];
164
- yt++, Bt(e), sn(e.$$);
162
+ for (; yt < bt.length; ) {
163
+ const e = bt[yt];
164
+ yt++, _t(e), dn(e.$$);
165
165
  }
166
166
  } catch (e) {
167
- throw xt.length = 0, yt = 0, e;
167
+ throw bt.length = 0, yt = 0, e;
168
168
  }
169
- for (Bt(null), xt.length = 0, yt = 0; Dt.length; )
170
- Dt.pop()();
171
- for (let e = 0; e < Et.length; e += 1) {
172
- const n = Et[e];
173
- Rt.has(n) || (Rt.add(n), n());
169
+ for (_t(null), bt.length = 0, yt = 0; Ut.length; )
170
+ Ut.pop()();
171
+ for (let e = 0; e < At.length; e += 1) {
172
+ const n = At[e];
173
+ zt.has(n) || (zt.add(n), n());
174
174
  }
175
- Et.length = 0;
176
- } while (xt.length);
177
- for (; ue.length; )
178
- ue.pop()();
179
- te = !1, Rt.clear(), Bt(t);
175
+ At.length = 0;
176
+ } while (bt.length);
177
+ for (; pe.length; )
178
+ pe.pop()();
179
+ ee = !1, zt.clear(), _t(t);
180
180
  }
181
- function sn(t) {
181
+ function dn(t) {
182
182
  if (t.fragment !== null) {
183
183
  t.update(), it(t.before_update);
184
184
  const e = t.dirty;
185
- t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(ee);
185
+ t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(ne);
186
186
  }
187
187
  }
188
- function ln(t) {
188
+ function cn(t) {
189
189
  const e = [], n = [];
190
- Et.forEach((o) => t.indexOf(o) === -1 ? e.push(o) : n.push(o)), n.forEach((o) => o()), Et = e;
190
+ At.forEach((o) => t.indexOf(o) === -1 ? e.push(o) : n.push(o)), n.forEach((o) => o()), At = e;
191
191
  }
192
- const Nt = /* @__PURE__ */ new Set();
192
+ const Ct = /* @__PURE__ */ new Set();
193
193
  let ht;
194
194
  function ot() {
195
195
  ht = {
@@ -202,47 +202,47 @@ function ot() {
202
202
  function rt() {
203
203
  ht.r || it(ht.c), ht = ht.p;
204
204
  }
205
- function V(t, e) {
206
- t && t.i && (Nt.delete(t), t.i(e));
205
+ function k(t, e) {
206
+ t && t.i && (Ct.delete(t), t.i(e));
207
207
  }
208
- function k(t, e, n, o) {
208
+ function V(t, e, n, o) {
209
209
  if (t && t.o) {
210
- if (Nt.has(t))
210
+ if (Ct.has(t))
211
211
  return;
212
- Nt.add(t), ht.c.push(() => {
213
- Nt.delete(t), o && (n && t.d(1), o());
212
+ Ct.add(t), ht.c.push(() => {
213
+ Ct.delete(t), o && (n && t.d(1), o());
214
214
  }), t.o(e);
215
215
  } else
216
216
  o && o();
217
217
  }
218
- function ft(t) {
218
+ function gt(t) {
219
219
  t && t.c();
220
220
  }
221
221
  function ct(t, e, n, o) {
222
222
  const { fragment: r, after_update: i } = t.$$;
223
- r && r.m(e, n), o || ee(() => {
224
- const a = t.$$.on_mount.map(Oe).filter(H);
223
+ r && r.m(e, n), o || ne(() => {
224
+ const a = t.$$.on_mount.map(Ve).filter(H);
225
225
  t.$$.on_destroy ? t.$$.on_destroy.push(...a) : it(a), t.$$.on_mount = [];
226
- }), i.forEach(ee);
226
+ }), i.forEach(ne);
227
227
  }
228
228
  function ut(t, e) {
229
229
  const n = t.$$;
230
- n.fragment !== null && (ln(n.after_update), it(n.on_destroy), n.fragment && n.fragment.d(e), n.on_destroy = n.fragment = null, n.ctx = []);
230
+ n.fragment !== null && (cn(n.after_update), it(n.on_destroy), n.fragment && n.fragment.d(e), n.on_destroy = n.fragment = null, n.ctx = []);
231
231
  }
232
- function dn(t, e) {
233
- t.$$.dirty[0] === -1 && (xt.push(t), an(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
232
+ function un(t, e) {
233
+ t.$$.dirty[0] === -1 && (bt.push(t), ln(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
234
234
  }
235
235
  function et(t, e, n, o, r, i, a, s = [-1]) {
236
- const l = Xt;
237
- Bt(t);
236
+ const l = It;
237
+ _t(t);
238
238
  const d = t.$$ = {
239
239
  fragment: null,
240
240
  ctx: [],
241
241
  // state
242
242
  props: i,
243
- update: U,
243
+ update: G,
244
244
  not_equal: r,
245
- bound: le(),
245
+ bound: ce(),
246
246
  // lifecycle
247
247
  on_mount: [],
248
248
  on_destroy: [],
@@ -251,33 +251,33 @@ function et(t, e, n, o, r, i, a, s = [-1]) {
251
251
  after_update: [],
252
252
  context: new Map(e.context || (l ? l.$$.context : [])),
253
253
  // everything else
254
- callbacks: le(),
254
+ callbacks: ce(),
255
255
  dirty: s,
256
256
  skip_bound: !1,
257
257
  root: e.target || l.$$.root
258
258
  };
259
259
  a && a(d.root);
260
260
  let p = !1;
261
- if (d.ctx = n ? n(t, e.props || {}, (c, f, ...h) => {
262
- const m = h.length ? h[0] : f;
263
- return d.ctx && r(d.ctx[c], d.ctx[c] = m) && (!d.skip_bound && d.bound[c] && d.bound[c](m), p && dn(t, c)), f;
261
+ if (d.ctx = n ? n(t, e.props || {}, (c, g, ...h) => {
262
+ const m = h.length ? h[0] : g;
263
+ return d.ctx && r(d.ctx[c], d.ctx[c] = m) && (!d.skip_bound && d.bound[c] && d.bound[c](m), p && un(t, c)), g;
264
264
  }) : [], d.update(), p = !0, it(d.before_update), d.fragment = o ? o(d.ctx) : !1, e.target) {
265
265
  if (e.hydrate) {
266
- const c = nn(e.target);
266
+ const c = rn(e.target);
267
267
  d.fragment && d.fragment.l(c), c.forEach(L);
268
268
  } else
269
269
  d.fragment && d.fragment.c();
270
- e.intro && V(t.$$.fragment), ct(t, e.target, e.anchor, e.customElement), Ge();
270
+ e.intro && k(t.$$.fragment), ct(t, e.target, e.anchor, e.customElement), Fe();
271
271
  }
272
- Bt(l);
272
+ _t(l);
273
273
  }
274
274
  class nt {
275
275
  $destroy() {
276
- ut(this, 1), this.$destroy = U;
276
+ ut(this, 1), this.$destroy = G;
277
277
  }
278
278
  $on(e, n) {
279
279
  if (!H(n))
280
- return U;
280
+ return G;
281
281
  const o = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
282
282
  return o.push(n), () => {
283
283
  const r = o.indexOf(n);
@@ -285,24 +285,24 @@ class nt {
285
285
  };
286
286
  }
287
287
  $set(e) {
288
- this.$$set && !Je(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
288
+ this.$$set && !Ze(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
289
289
  }
290
290
  }
291
291
  var F = /* @__PURE__ */ ((t) => (t.ELLIPSE = "ELLIPSE", t.POLYGON = "POLYGON", t.RECTANGLE = "RECTANGLE", t))(F || {});
292
- const re = {}, ie = (t, e) => re[t] = e, ne = (t) => re[t.type].area(t), cn = (t, e, n) => re[t.type].intersects(t, e, n), Gt = (t) => {
292
+ const ie = {}, ae = (t, e) => ie[t] = e, oe = (t) => ie[t.type].area(t), hn = (t, e, n) => ie[t.type].intersects(t, e, n), Gt = (t) => {
293
293
  let e = 1 / 0, n = 1 / 0, o = -1 / 0, r = -1 / 0;
294
294
  return t.forEach(([i, a]) => {
295
295
  e = Math.min(e, i), n = Math.min(n, a), o = Math.max(o, i), r = Math.max(r, a);
296
296
  }), { minX: e, minY: n, maxX: o, maxY: r };
297
- }, un = {
297
+ }, pn = {
298
298
  area: (t) => Math.PI * t.geometry.rx * t.geometry.ry,
299
299
  intersects: (t, e, n) => {
300
- const { cx: o, cy: r, rx: i, ry: a } = t.geometry, s = 0, l = Math.cos(s), d = Math.sin(s), p = e - o, c = n - r, f = l * p + d * c, h = d * p - l * c;
301
- return f * f / (i * i) + h * h / (a * a) <= 1;
300
+ const { cx: o, cy: r, rx: i, ry: a } = t.geometry, s = 0, l = Math.cos(s), d = Math.sin(s), p = e - o, c = n - r, g = l * p + d * c, h = d * p - l * c;
301
+ return g * g / (i * i) + h * h / (a * a) <= 1;
302
302
  }
303
303
  };
304
- ie(F.ELLIPSE, un);
305
- const hn = {
304
+ ae(F.ELLIPSE, pn);
305
+ const gn = {
306
306
  area: (t) => {
307
307
  const { points: e } = t.geometry;
308
308
  let n = 0, o = e.length - 1;
@@ -320,55 +320,55 @@ const hn = {
320
320
  return r;
321
321
  }
322
322
  };
323
- ie(F.POLYGON, hn);
324
- const pn = {
323
+ ae(F.POLYGON, gn);
324
+ const fn = {
325
325
  area: (t) => t.geometry.w * t.geometry.h,
326
326
  intersects: (t, e, n) => e >= t.geometry.x && e <= t.geometry.x + t.geometry.w && n >= t.geometry.y && n <= t.geometry.y + t.geometry.h
327
327
  };
328
- ie(F.RECTANGLE, pn);
329
- const fn = (t, e = !1) => {
328
+ ae(F.RECTANGLE, fn);
329
+ const mn = (t, e = !1) => {
330
330
  const n = typeof t == "string" ? t : t.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, r = [...n.matchAll(o)][0], [i, a, s, l, d, p, c] = r;
331
331
  if (a !== "xywh")
332
332
  throw new Error("Unsupported MediaFragment: " + n);
333
333
  if (s && s !== "pixel")
334
334
  throw new Error(`Unsupported MediaFragment unit: ${s}`);
335
- const [f, h, m, x] = [l, d, p, c].map(parseFloat);
335
+ const [g, h, m, x] = [l, d, p, c].map(parseFloat);
336
336
  return {
337
337
  type: F.RECTANGLE,
338
338
  geometry: {
339
- x: f,
339
+ x: g,
340
340
  y: h,
341
341
  w: m,
342
342
  h: x,
343
343
  bounds: {
344
- minX: f,
344
+ minX: g,
345
345
  minY: e ? h - x : h,
346
- maxX: f + m,
346
+ maxX: g + m,
347
347
  maxY: e ? h : h + x
348
348
  }
349
349
  }
350
350
  };
351
- }, gn = (t) => {
351
+ }, yn = (t) => {
352
352
  const { x: e, y: n, w: o, h: r } = t;
353
353
  return {
354
354
  type: "FragmentSelector",
355
355
  conformsTo: "http://www.w3.org/TR/media-frags/",
356
356
  value: `xywh=pixel:${e},${n},${o},${r}`
357
357
  };
358
- }, Ue = "http://www.w3.org/2000/svg", he = (t) => {
358
+ }, He = "http://www.w3.org/2000/svg", ge = (t) => {
359
359
  const e = (o) => {
360
360
  Array.from(o.attributes).forEach((r) => {
361
361
  r.name.startsWith("on") && o.removeAttribute(r.name);
362
362
  });
363
363
  }, n = t.getElementsByTagName("script");
364
364
  return Array.from(n).reverse().forEach((o) => o.parentNode.removeChild(o)), Array.from(t.querySelectorAll("*")).forEach(e), t;
365
- }, mn = (t) => {
366
- const e = new XMLSerializer().serializeToString(t.documentElement).replace("<svg>", `<svg xmlns="${Ue}">`);
365
+ }, wn = (t) => {
366
+ const e = new XMLSerializer().serializeToString(t.documentElement).replace("<svg>", `<svg xmlns="${He}">`);
367
367
  return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
368
- }, yn = (t) => {
369
- const e = new DOMParser().parseFromString(t, "image/svg+xml"), n = e.lookupPrefix(Ue), o = e.lookupNamespaceURI(null);
370
- return n || o ? he(e).firstChild : he(mn(e)).firstChild;
371
368
  }, $n = (t) => {
369
+ const e = new DOMParser().parseFromString(t, "image/svg+xml"), n = e.lookupPrefix(He), o = e.lookupNamespaceURI(null);
370
+ return n || o ? ge(e).firstChild : ge(wn(e)).firstChild;
371
+ }, xn = (t) => {
372
372
  const [e, n, o] = t.match(/(<polygon points=["|'])([^("|')]*)/) || [];
373
373
  if (!o)
374
374
  return;
@@ -380,8 +380,8 @@ const fn = (t, e = !1) => {
380
380
  bounds: Gt(r)
381
381
  }
382
382
  };
383
- }, wn = (t) => {
384
- const e = yn(t), n = parseFloat(e.getAttribute("cx")), o = parseFloat(e.getAttribute("cy")), r = parseFloat(e.getAttribute("rx")), i = parseFloat(e.getAttribute("ry")), a = {
383
+ }, bn = (t) => {
384
+ const e = $n(t), n = parseFloat(e.getAttribute("cx")), o = parseFloat(e.getAttribute("cy")), r = parseFloat(e.getAttribute("rx")), i = parseFloat(e.getAttribute("ry")), a = {
385
385
  minX: n - r,
386
386
  minY: o - i,
387
387
  maxX: n + r,
@@ -397,13 +397,13 @@ const fn = (t, e = !1) => {
397
397
  bounds: a
398
398
  }
399
399
  };
400
- }, xn = (t) => {
400
+ }, En = (t) => {
401
401
  const e = typeof t == "string" ? t : t.value;
402
402
  if (e.includes("<polygon points="))
403
- return $n(e);
403
+ return xn(e);
404
404
  if (e.includes("<ellipse "))
405
- return wn(e);
406
- }, bn = (t) => {
405
+ return bn(e);
406
+ }, vn = (t) => {
407
407
  let e;
408
408
  if (t.type === F.POLYGON) {
409
409
  const n = t.geometry, { points: o } = n;
@@ -416,36 +416,36 @@ const fn = (t, e = !1) => {
416
416
  return { type: "SvgSelector", value: e };
417
417
  throw `Unsupported shape type: ${t.type}`;
418
418
  };
419
- let Ot;
420
- const vn = new Uint8Array(16);
421
- function En() {
422
- if (!Ot && (Ot = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Ot))
419
+ let kt;
420
+ const An = new Uint8Array(16);
421
+ function Tn() {
422
+ if (!kt && (kt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !kt))
423
423
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
424
- return Ot(vn);
424
+ return kt(An);
425
425
  }
426
- const z = [];
426
+ const P = [];
427
427
  for (let t = 0; t < 256; ++t)
428
- z.push((t + 256).toString(16).slice(1));
429
- function An(t, e = 0) {
430
- return z[t[e + 0]] + z[t[e + 1]] + z[t[e + 2]] + z[t[e + 3]] + "-" + z[t[e + 4]] + z[t[e + 5]] + "-" + z[t[e + 6]] + z[t[e + 7]] + "-" + z[t[e + 8]] + z[t[e + 9]] + "-" + z[t[e + 10]] + z[t[e + 11]] + z[t[e + 12]] + z[t[e + 13]] + z[t[e + 14]] + z[t[e + 15]];
428
+ P.push((t + 256).toString(16).slice(1));
429
+ function Sn(t, e = 0) {
430
+ return P[t[e + 0]] + P[t[e + 1]] + P[t[e + 2]] + P[t[e + 3]] + "-" + P[t[e + 4]] + P[t[e + 5]] + "-" + P[t[e + 6]] + P[t[e + 7]] + "-" + P[t[e + 8]] + P[t[e + 9]] + "-" + P[t[e + 10]] + P[t[e + 11]] + P[t[e + 12]] + P[t[e + 13]] + P[t[e + 14]] + P[t[e + 15]];
431
431
  }
432
- const Tn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), pe = {
433
- randomUUID: Tn
432
+ const On = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), fe = {
433
+ randomUUID: On
434
434
  };
435
- function Fe(t, e, n) {
436
- if (pe.randomUUID && !e && !t)
437
- return pe.randomUUID();
435
+ function je(t, e, n) {
436
+ if (fe.randomUUID && !e && !t)
437
+ return fe.randomUUID();
438
438
  t = t || {};
439
- const o = t.random || (t.rng || En)();
439
+ const o = t.random || (t.rng || Tn)();
440
440
  if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, e) {
441
441
  n = n || 0;
442
442
  for (let r = 0; r < 16; ++r)
443
443
  e[n + r] = o[r];
444
444
  return e;
445
445
  }
446
- return An(o);
446
+ return Sn(o);
447
447
  }
448
- var fe = Object.prototype.hasOwnProperty;
448
+ var me = Object.prototype.hasOwnProperty;
449
449
  function pt(t, e) {
450
450
  var n, o;
451
451
  if (t === e)
@@ -464,42 +464,47 @@ function pt(t, e) {
464
464
  if (!n || typeof t == "object") {
465
465
  o = 0;
466
466
  for (n in t)
467
- if (fe.call(t, n) && ++o && !fe.call(e, n) || !(n in e) || !pt(t[n], e[n]))
467
+ if (me.call(t, n) && ++o && !me.call(e, n) || !(n in e) || !pt(t[n], e[n]))
468
468
  return !1;
469
469
  return Object.keys(e).length === o;
470
470
  }
471
471
  }
472
472
  return t !== t && e !== e;
473
473
  }
474
- const $t = [];
475
- function Ut(t, e = U) {
474
+ function qt() {
475
+ }
476
+ function Ln(t, e) {
477
+ return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
478
+ }
479
+ const wt = [];
480
+ function se(t, e = qt) {
476
481
  let n;
477
482
  const o = /* @__PURE__ */ new Set();
478
483
  function r(s) {
479
- if (K(t, s) && (t = s, n)) {
480
- const l = !$t.length;
484
+ if (Ln(t, s) && (t = s, n)) {
485
+ const l = !wt.length;
481
486
  for (const d of o)
482
- d[1](), $t.push(d, t);
487
+ d[1](), wt.push(d, t);
483
488
  if (l) {
484
- for (let d = 0; d < $t.length; d += 2)
485
- $t[d][0]($t[d + 1]);
486
- $t.length = 0;
489
+ for (let d = 0; d < wt.length; d += 2)
490
+ wt[d][0](wt[d + 1]);
491
+ wt.length = 0;
487
492
  }
488
493
  }
489
494
  }
490
495
  function i(s) {
491
496
  r(s(t));
492
497
  }
493
- function a(s, l = U) {
498
+ function a(s, l = qt) {
494
499
  const d = [s, l];
495
- return o.add(d), o.size === 1 && (n = e(r) || U), s(t), () => {
500
+ return o.add(d), o.size === 1 && (n = e(r) || qt), s(t), () => {
496
501
  o.delete(d), o.size === 0 && n && (n(), n = null);
497
502
  };
498
503
  }
499
504
  return { set: r, update: i, subscribe: a };
500
505
  }
501
- const Sn = (t) => {
502
- const { subscribe: e, set: n } = Ut(null);
506
+ const Yn = (t) => {
507
+ const { subscribe: e, set: n } = se(null);
503
508
  let o = null;
504
509
  return e((r) => o = r), t.observe(({ changes: r }) => {
505
510
  if (o) {
@@ -515,36 +520,36 @@ const Sn = (t) => {
515
520
  set: n
516
521
  };
517
522
  };
518
- var He = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(He || {});
519
- const qt = { selected: [] }, Mn = (t, e = "EDIT") => {
520
- const { subscribe: n, set: o } = Ut(qt);
521
- let r = qt;
523
+ var Pe = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(Pe || {});
524
+ const Wt = { selected: [] }, _n = (t, e = "EDIT") => {
525
+ const { subscribe: n, set: o } = se(Wt);
526
+ let r = Wt;
522
527
  n((c) => r = c);
523
- const i = () => o(qt), a = () => {
528
+ const i = () => o(Wt), a = () => {
524
529
  var c;
525
530
  return ((c = r.selected) == null ? void 0 : c.length) === 0;
526
531
  }, s = (c) => {
527
532
  if (r.selected.length === 0)
528
533
  return !1;
529
- const f = typeof c == "string" ? c : c.id;
530
- return r.selected.some((h) => h.id === f);
531
- }, l = (c, f) => {
534
+ const g = typeof c == "string" ? c : c.id;
535
+ return r.selected.some((h) => h.id === g);
536
+ }, l = (c, g) => {
532
537
  const h = t.getAnnotation(c);
533
538
  if (h) {
534
- const m = Ln(h, e);
535
- o(m === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: f } : m === "SELECT" ? { selected: [{ id: c }], pointerEvent: f } : { selected: [], pointerEvent: f });
539
+ const m = In(h, e);
540
+ o(m === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: g } : m === "SELECT" ? { selected: [{ id: c }], pointerEvent: g } : { selected: [], pointerEvent: g });
536
541
  } else
537
542
  console.warn("Invalid selection: " + c);
538
- }, d = (c, f = !0) => {
543
+ }, d = (c, g = !0) => {
539
544
  const h = Array.isArray(c) ? c : [c], m = h.map((x) => t.getAnnotation(x)).filter((x) => x);
540
- o({ selected: m.map(({ id: x }) => ({ id: x, editable: f })) }), m.length !== h.length && console.warn("Invalid selection", c);
545
+ o({ selected: m.map(({ id: x }) => ({ id: x, editable: g })) }), m.length !== h.length && console.warn("Invalid selection", c);
541
546
  }, p = (c) => {
542
547
  if (r.selected.length === 0)
543
548
  return !1;
544
- const { selected: f } = r;
545
- f.filter(({ id: h }) => c.includes(h)).length > 0 && o({ selected: f.filter(({ id: h }) => !c.includes(h)) });
549
+ const { selected: g } = r;
550
+ g.filter(({ id: h }) => c.includes(h)).length > 0 && o({ selected: g.filter(({ id: h }) => !c.includes(h)) });
546
551
  };
547
- return t.observe(({ changes: c }) => p(c.deleted.map((f) => f.id))), {
552
+ return t.observe(({ changes: c }) => p(c.deleted.map((g) => g.id))), {
548
553
  clear: i,
549
554
  clickSelect: l,
550
555
  get selected() {
@@ -558,28 +563,32 @@ const qt = { selected: [] }, Mn = (t, e = "EDIT") => {
558
563
  setSelected: d,
559
564
  subscribe: n
560
565
  };
561
- }, Ln = (t, e) => typeof e == "function" ? e(t) || "EDIT" : e || "EDIT", Bn = (t, e) => {
566
+ }, In = (t, e) => typeof e == "function" ? e(t) || "EDIT" : e || "EDIT", Mn = [];
567
+ for (let t = 0; t < 256; ++t)
568
+ Mn.push((t + 256).toString(16).slice(1));
569
+ typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
570
+ const Bn = (t, e) => {
562
571
  const n = new Set(t.bodies.map((o) => o.id));
563
572
  return e.bodies.filter((o) => !n.has(o.id));
564
573
  }, Xn = (t, e) => {
565
574
  const n = new Set(e.bodies.map((o) => o.id));
566
575
  return t.bodies.filter((o) => !n.has(o.id));
567
- }, In = (t, e) => e.bodies.map((n) => {
576
+ }, Rn = (t, e) => e.bodies.map((n) => {
568
577
  const o = t.bodies.find((r) => r.id === n.id);
569
578
  return { newBody: n, oldBody: o && !pt(o, n) ? o : void 0 };
570
- }).filter(({ oldBody: n }) => n), Yn = (t, e) => !pt(t.target, e.target), je = (t, e) => {
571
- const n = Bn(t, e), o = Xn(t, e), r = In(t, e);
579
+ }).filter(({ oldBody: n }) => n), Nn = (t, e) => !pt(t.target, e.target), ze = (t, e) => {
580
+ const n = Bn(t, e), o = Xn(t, e), r = Rn(t, e);
572
581
  return {
573
582
  oldValue: t,
574
583
  newValue: e,
575
584
  bodiesCreated: n.length > 0 ? n : void 0,
576
585
  bodiesDeleted: o.length > 0 ? o : void 0,
577
586
  bodiesUpdated: r.length > 0 ? r : void 0,
578
- targetUpdated: Yn(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
587
+ targetUpdated: Nn(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
579
588
  };
580
589
  };
581
- var D = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(D || {});
582
- const _n = (t, e) => {
590
+ var C = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(C || {});
591
+ const kn = (t, e) => {
583
592
  var n, o;
584
593
  const { changes: r, origin: i } = e;
585
594
  if (!(!t.options.origin || t.options.origin === i))
@@ -601,32 +610,32 @@ const _n = (t, e) => {
601
610
  return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((s) => a.has(s));
602
611
  } else
603
612
  return !0;
604
- }, Cn = (t, e) => {
613
+ }, Vn = (t, e) => {
605
614
  const n = new Set((t.created || []).map((c) => c.id)), o = new Set((t.updated || []).map(({ newValue: c }) => c.id)), r = new Set((e.created || []).map((c) => c.id)), i = new Set((e.deleted || []).map((c) => c.id)), a = new Set((e.updated || []).map(({ oldValue: c }) => c.id)), s = new Set((e.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), l = [
606
- ...(t.created || []).filter((c) => !i.has(c.id)).map((c) => a.has(c.id) ? e.updated.find(({ oldValue: f }) => f.id === c.id).newValue : c),
615
+ ...(t.created || []).filter((c) => !i.has(c.id)).map((c) => a.has(c.id) ? e.updated.find(({ oldValue: g }) => g.id === c.id).newValue : c),
607
616
  ...e.created || []
608
617
  ], d = [
609
618
  ...(t.deleted || []).filter((c) => !r.has(c.id)),
610
619
  ...(e.deleted || []).filter((c) => !n.has(c.id))
611
620
  ], p = [
612
621
  ...(t.updated || []).filter(({ newValue: c }) => !i.has(c.id)).map((c) => {
613
- const { oldValue: f, newValue: h } = c;
622
+ const { oldValue: g, newValue: h } = c;
614
623
  if (a.has(h.id)) {
615
624
  const m = e.updated.find((x) => x.oldValue.id === h.id).newValue;
616
- return je(f, m);
625
+ return ze(g, m);
617
626
  } else
618
627
  return c;
619
628
  }),
620
629
  ...(e.updated || []).filter(({ oldValue: c }) => !s.has(c.id))
621
630
  ];
622
631
  return { created: l, deleted: d, updated: p };
623
- }, Pn = (t) => t.id !== void 0, On = () => {
624
- const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (g, b = {}) => n.push({ onChange: g, options: b }), r = (g) => {
625
- const b = n.findIndex((w) => w.onChange == g);
632
+ }, Dn = (t) => t.id !== void 0, Cn = () => {
633
+ const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (f, b = {}) => n.push({ onChange: f, options: b }), r = (f) => {
634
+ const b = n.findIndex(($) => $.onChange == f);
626
635
  b > -1 && n.splice(b, 1);
627
- }, i = (g, b) => {
628
- const w = {
629
- origin: g,
636
+ }, i = (f, b) => {
637
+ const $ = {
638
+ origin: f,
630
639
  changes: {
631
640
  created: b.created || [],
632
641
  updated: b.updated || [],
@@ -635,149 +644,149 @@ const _n = (t, e) => {
635
644
  state: [...t.values()]
636
645
  };
637
646
  n.forEach((T) => {
638
- _n(T, w) && T.onChange(w);
647
+ kn(T, $) && T.onChange($);
639
648
  });
640
- }, a = (g, b = D.LOCAL) => {
641
- if (t.get(g.id))
642
- throw Error(`Cannot add annotation ${g.id} - exists already`);
643
- t.set(g.id, g), g.bodies.forEach((w) => e.set(w.id, g.id)), i(b, { created: [g] });
644
- }, s = (g, b) => {
645
- const w = typeof g == "string" ? b : g, T = typeof g == "string" ? g : g.id, X = t.get(T);
646
- if (X) {
647
- const P = je(X, w);
648
- return T === w.id ? t.set(T, w) : (t.delete(T), t.set(w.id, w)), X.bodies.forEach((J) => e.delete(J.id)), w.bodies.forEach((J) => e.set(J.id, w.id)), P;
649
+ }, a = (f, b = C.LOCAL) => {
650
+ if (t.get(f.id))
651
+ throw Error(`Cannot add annotation ${f.id} - exists already`);
652
+ t.set(f.id, f), f.bodies.forEach(($) => e.set($.id, f.id)), i(b, { created: [f] });
653
+ }, s = (f, b) => {
654
+ const $ = typeof f == "string" ? b : f, T = typeof f == "string" ? f : f.id, _ = t.get(T);
655
+ if (_) {
656
+ const X = ze(_, $);
657
+ return T === $.id ? t.set(T, $) : (t.delete(T), t.set($.id, $)), _.bodies.forEach((J) => e.delete(J.id)), $.bodies.forEach((J) => e.set(J.id, $.id)), X;
649
658
  } else
650
659
  console.warn(`Cannot update annotation ${T} - does not exist`);
651
- }, l = (g, b = D.LOCAL, w = D.LOCAL) => {
652
- const T = Pn(b) ? w : b, X = s(g, b);
653
- X && i(T, { updated: [X] });
654
- }, d = (g, b = D.LOCAL) => {
655
- const w = g.reduce((T, X) => {
656
- const P = s(X);
657
- return P ? [...T, P] : T;
660
+ }, l = (f, b = C.LOCAL, $ = C.LOCAL) => {
661
+ const T = Dn(b) ? $ : b, _ = s(f, b);
662
+ _ && i(T, { updated: [_] });
663
+ }, d = (f, b = C.LOCAL) => {
664
+ const $ = f.reduce((T, _) => {
665
+ const X = s(_);
666
+ return X ? [...T, X] : T;
658
667
  }, []);
659
- w.length > 0 && i(b, { updated: w });
660
- }, p = (g, b = D.LOCAL) => {
661
- const w = t.get(g.annotation);
662
- if (w) {
668
+ $.length > 0 && i(b, { updated: $ });
669
+ }, p = (f, b = C.LOCAL) => {
670
+ const $ = t.get(f.annotation);
671
+ if ($) {
663
672
  const T = {
664
- ...w,
665
- bodies: [...w.bodies, g]
673
+ ...$,
674
+ bodies: [...$.bodies, f]
666
675
  };
667
- t.set(w.id, T), e.set(g.id, T.id), i(b, { updated: [{
668
- oldValue: w,
676
+ t.set($.id, T), e.set(f.id, T.id), i(b, { updated: [{
677
+ oldValue: $,
669
678
  newValue: T,
670
- bodiesCreated: [g]
679
+ bodiesCreated: [f]
671
680
  }] });
672
681
  } else
673
- console.warn(`Attempt to add body to missing annotation: ${g.annotation}`);
674
- }, c = () => [...t.values()], f = (g = D.LOCAL) => {
682
+ console.warn(`Attempt to add body to missing annotation: ${f.annotation}`);
683
+ }, c = () => [...t.values()], g = (f = C.LOCAL) => {
675
684
  const b = [...t.values()];
676
- t.clear(), e.clear(), i(g, { deleted: b });
677
- }, h = (g, b = !0, w = D.LOCAL) => {
685
+ t.clear(), e.clear(), i(f, { deleted: b });
686
+ }, h = (f, b = !0, $ = C.LOCAL) => {
678
687
  if (b) {
679
688
  const T = [...t.values()];
680
- t.clear(), e.clear(), g.forEach((X) => {
681
- t.set(X.id, X), X.bodies.forEach((P) => e.set(P.id, X.id));
682
- }), i(w, { created: g, deleted: T });
689
+ t.clear(), e.clear(), f.forEach((_) => {
690
+ t.set(_.id, _), _.bodies.forEach((X) => e.set(X.id, _.id));
691
+ }), i($, { created: f, deleted: T });
683
692
  } else {
684
- const T = g.reduce((X, P) => {
685
- const J = t.get(P.id);
686
- return J ? [...X, J] : X;
693
+ const T = f.reduce((_, X) => {
694
+ const J = t.get(X.id);
695
+ return J ? [..._, J] : _;
687
696
  }, []);
688
697
  if (T.length > 0)
689
- throw Error(`Bulk insert would overwrite the following annotations: ${T.map((X) => X.id).join(", ")}`);
690
- g.forEach((X) => {
691
- t.set(X.id, X), X.bodies.forEach((P) => e.set(P.id, X.id));
692
- }), i(w, { created: g });
693
- }
694
- }, m = (g) => {
695
- const b = typeof g == "string" ? g : g.id, w = t.get(b);
696
- if (w)
697
- return t.delete(b), w.bodies.forEach((T) => e.delete(T.id)), w;
698
+ throw Error(`Bulk insert would overwrite the following annotations: ${T.map((_) => _.id).join(", ")}`);
699
+ f.forEach((_) => {
700
+ t.set(_.id, _), _.bodies.forEach((X) => e.set(X.id, _.id));
701
+ }), i($, { created: f });
702
+ }
703
+ }, m = (f) => {
704
+ const b = typeof f == "string" ? f : f.id, $ = t.get(b);
705
+ if ($)
706
+ return t.delete(b), $.bodies.forEach((T) => e.delete(T.id)), $;
698
707
  console.warn(`Attempt to delete missing annotation: ${b}`);
699
- }, x = (g, b = D.LOCAL) => {
700
- const w = m(g);
701
- w && i(b, { deleted: [w] });
702
- }, A = (g, b = D.LOCAL) => {
703
- const w = g.reduce((T, X) => {
704
- const P = m(X);
705
- return P ? [...T, P] : T;
708
+ }, x = (f, b = C.LOCAL) => {
709
+ const $ = m(f);
710
+ $ && i(b, { deleted: [$] });
711
+ }, A = (f, b = C.LOCAL) => {
712
+ const $ = f.reduce((T, _) => {
713
+ const X = m(_);
714
+ return X ? [...T, X] : T;
706
715
  }, []);
707
- w.length > 0 && i(b, { deleted: w });
708
- }, $ = (g, b = D.LOCAL) => {
709
- const w = t.get(g.annotation);
710
- if (w) {
711
- const T = w.bodies.find((X) => X.id === g.id);
716
+ $.length > 0 && i(b, { deleted: $ });
717
+ }, w = (f, b = C.LOCAL) => {
718
+ const $ = t.get(f.annotation);
719
+ if ($) {
720
+ const T = $.bodies.find((_) => _.id === f.id);
712
721
  if (T) {
713
722
  e.delete(T.id);
714
- const X = {
715
- ...w,
716
- bodies: w.bodies.filter((P) => P.id !== g.id)
723
+ const _ = {
724
+ ...$,
725
+ bodies: $.bodies.filter((X) => X.id !== f.id)
717
726
  };
718
- t.set(w.id, X), i(b, { updated: [{
719
- oldValue: w,
720
- newValue: X,
727
+ t.set($.id, _), i(b, { updated: [{
728
+ oldValue: $,
729
+ newValue: _,
721
730
  bodiesDeleted: [T]
722
731
  }] });
723
732
  } else
724
- console.warn(`Attempt to delete missing body ${g.id} from annotation ${g.annotation}`);
733
+ console.warn(`Attempt to delete missing body ${f.id} from annotation ${f.annotation}`);
725
734
  } else
726
- console.warn(`Attempt to delete body from missing annotation ${g.annotation}`);
727
- }, y = (g) => {
728
- const b = t.get(g);
735
+ console.warn(`Attempt to delete body from missing annotation ${f.annotation}`);
736
+ }, y = (f) => {
737
+ const b = t.get(f);
729
738
  return b ? { ...b } : void 0;
730
- }, v = (g) => {
731
- const b = e.get(g);
739
+ }, E = (f) => {
740
+ const b = e.get(f);
732
741
  if (b) {
733
- const w = y(b).bodies.find((T) => T.id === g);
734
- if (w)
735
- return w;
736
- console.error(`Store integrity error: body ${g} in index, but not in annotation`);
742
+ const $ = y(b).bodies.find((T) => T.id === f);
743
+ if ($)
744
+ return $;
745
+ console.error(`Store integrity error: body ${f} in index, but not in annotation`);
737
746
  } else
738
- console.warn(`Attempt to retrieve missing body: ${g}`);
739
- }, E = (g, b) => {
740
- if (g.annotation !== b.annotation)
747
+ console.warn(`Attempt to retrieve missing body: ${f}`);
748
+ }, v = (f, b) => {
749
+ if (f.annotation !== b.annotation)
741
750
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
742
- const w = t.get(g.annotation);
743
- if (w) {
744
- const T = w.bodies.find((P) => P.id === g.id), X = {
745
- ...w,
746
- bodies: w.bodies.map((P) => P.id === T.id ? b : P)
751
+ const $ = t.get(f.annotation);
752
+ if ($) {
753
+ const T = $.bodies.find((X) => X.id === f.id), _ = {
754
+ ...$,
755
+ bodies: $.bodies.map((X) => X.id === T.id ? b : X)
747
756
  };
748
- return t.set(w.id, X), T.id !== b.id && (e.delete(T.id), e.set(b.id, X.id)), {
749
- oldValue: w,
750
- newValue: X,
757
+ return t.set($.id, _), T.id !== b.id && (e.delete(T.id), e.set(b.id, _.id)), {
758
+ oldValue: $,
759
+ newValue: _,
751
760
  bodiesUpdated: [{ oldBody: T, newBody: b }]
752
761
  };
753
762
  } else
754
- console.warn(`Attempt to add body to missing annotation ${g.annotation}`);
755
- }, _ = (g, b, w = D.LOCAL) => {
756
- const T = E(g, b);
757
- i(w, { updated: [T] });
758
- }, C = (g, b = D.LOCAL) => {
759
- const w = g.map((T) => E({ id: T.id, annotation: T.annotation }, T));
760
- i(b, { updated: w });
761
- }, N = (g) => {
762
- const b = t.get(g.annotation);
763
+ console.warn(`Attempt to add body to missing annotation ${f.annotation}`);
764
+ }, B = (f, b, $ = C.LOCAL) => {
765
+ const T = v(f, b);
766
+ i($, { updated: [T] });
767
+ }, R = (f, b = C.LOCAL) => {
768
+ const $ = f.map((T) => v({ id: T.id, annotation: T.annotation }, T));
769
+ i(b, { updated: $ });
770
+ }, D = (f) => {
771
+ const b = t.get(f.annotation);
763
772
  if (b) {
764
- const w = {
773
+ const $ = {
765
774
  ...b,
766
775
  target: {
767
776
  ...b.target,
768
- ...g
777
+ ...f
769
778
  }
770
779
  };
771
- return t.set(b.id, w), {
780
+ return t.set(b.id, $), {
772
781
  oldValue: b,
773
- newValue: w,
782
+ newValue: $,
774
783
  targetUpdated: {
775
784
  oldTarget: b.target,
776
- newTarget: g
785
+ newTarget: f
777
786
  }
778
787
  };
779
788
  } else
780
- console.warn(`Attempt to update target on missing annotation: ${g.annotation}`);
789
+ console.warn(`Attempt to update target on missing annotation: ${f.annotation}`);
781
790
  };
782
791
  return {
783
792
  addAnnotation: a,
@@ -786,33 +795,33 @@ const _n = (t, e) => {
786
795
  bulkAddAnnotation: h,
787
796
  bulkDeleteAnnotation: A,
788
797
  bulkUpdateAnnotation: d,
789
- bulkUpdateBodies: C,
790
- bulkUpdateTargets: (g, b = D.LOCAL) => {
791
- const w = g.map(N).filter((T) => T);
792
- w.length > 0 && i(b, { updated: w });
798
+ bulkUpdateBodies: R,
799
+ bulkUpdateTargets: (f, b = C.LOCAL) => {
800
+ const $ = f.map(D).filter((T) => T);
801
+ $.length > 0 && i(b, { updated: $ });
793
802
  },
794
- clear: f,
803
+ clear: g,
795
804
  deleteAnnotation: x,
796
- deleteBody: $,
805
+ deleteBody: w,
797
806
  getAnnotation: y,
798
- getBody: v,
807
+ getBody: E,
799
808
  observe: o,
800
809
  unobserve: r,
801
810
  updateAnnotation: l,
802
- updateBody: _,
803
- updateTarget: (g, b = D.LOCAL) => {
804
- const w = N(g);
805
- w && i(b, { updated: [w] });
811
+ updateBody: B,
812
+ updateTarget: (f, b = C.LOCAL) => {
813
+ const $ = D(f);
814
+ $ && i(b, { updated: [$] });
806
815
  }
807
816
  };
808
- }, Vn = (t) => ({
817
+ }, Un = (t) => ({
809
818
  ...t,
810
819
  subscribe: (e) => {
811
820
  const n = (o) => e(o.state);
812
821
  return t.observe(n), e(t.all()), () => t.unobserve(n);
813
822
  }
814
823
  });
815
- let kn = () => ({
824
+ let Gn = () => ({
816
825
  emit(t, ...e) {
817
826
  let n = this.events[t] || [];
818
827
  for (let o = 0, r = n.length; o < r; o++)
@@ -827,24 +836,24 @@ let kn = () => ({
827
836
  };
828
837
  }
829
838
  });
830
- const Nn = 250, Dn = (t) => {
831
- const e = kn(), n = [];
839
+ const Fn = 250, Hn = (t) => {
840
+ const e = Gn(), n = [];
832
841
  let o = -1, r = !1, i = 0;
833
842
  const a = (h) => {
834
843
  if (!r) {
835
844
  const { changes: m } = h, x = performance.now();
836
- if (x - i > Nn)
845
+ if (x - i > Fn)
837
846
  n.splice(o + 1), n.push(m), o = n.length - 1;
838
847
  else {
839
848
  const A = n.length - 1;
840
- n[A] = Cn(n[A], m);
849
+ n[A] = Vn(n[A], m);
841
850
  }
842
851
  i = x;
843
852
  }
844
853
  r = !1;
845
854
  };
846
- t.observe(a, { origin: D.LOCAL });
847
- const s = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkDeleteAnnotation(h), l = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkAddAnnotation(h, !1), d = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkUpdateAnnotation(h.map(({ oldValue: m }) => m)), p = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkUpdateAnnotation(h.map(({ newValue: m }) => m)), c = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkAddAnnotation(h, !1), f = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkDeleteAnnotation(h);
855
+ t.observe(a, { origin: C.LOCAL });
856
+ const s = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkDeleteAnnotation(h), l = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkAddAnnotation(h, !1), d = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkUpdateAnnotation(h.map(({ oldValue: m }) => m)), p = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkUpdateAnnotation(h.map(({ newValue: m }) => m)), c = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkAddAnnotation(h, !1), g = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkDeleteAnnotation(h);
848
857
  return {
849
858
  canRedo: () => n.length - 1 > o,
850
859
  canUndo: () => o > -1,
@@ -854,7 +863,7 @@ const Nn = 250, Dn = (t) => {
854
863
  if (n.length - 1 > o) {
855
864
  r = !0;
856
865
  const { created: h, updated: m, deleted: x } = n[o + 1];
857
- l(h), p(m), f(x), e.emit("redo", n[o + 1]), o += 1;
866
+ l(h), p(m), g(x), e.emit("redo", n[o + 1]), o += 1;
858
867
  }
859
868
  },
860
869
  undo: () => {
@@ -865,85 +874,85 @@ const Nn = 250, Dn = (t) => {
865
874
  }
866
875
  }
867
876
  };
868
- }, Gn = () => {
869
- const { subscribe: t, set: e } = Ut([]);
877
+ }, jn = () => {
878
+ const { subscribe: t, set: e } = se([]);
870
879
  return {
871
880
  subscribe: t,
872
881
  set: e
873
882
  };
874
- }, Un = (t, e, n, o) => {
883
+ }, Pn = (t, e, n, o) => {
875
884
  const { store: r, selection: i, hover: a, viewport: s } = t, l = /* @__PURE__ */ new Map();
876
885
  let d = [], p, c;
877
- const f = ($, y) => {
878
- l.has($) ? l.get($).push(y) : l.set($, [y]);
879
- }, h = ($, y) => {
880
- const v = l.get($);
881
- v && v.indexOf(y) > 0 && v.splice(v.indexOf(y), 1);
882
- }, m = ($, y, v) => {
883
- l.has($) && setTimeout(() => {
884
- l.get($).forEach((E) => {
886
+ const g = (w, y) => {
887
+ l.has(w) ? l.get(w).push(y) : l.set(w, [y]);
888
+ }, h = (w, y) => {
889
+ const E = l.get(w);
890
+ E && E.indexOf(y) > 0 && E.splice(E.indexOf(y), 1);
891
+ }, m = (w, y, E) => {
892
+ l.has(w) && setTimeout(() => {
893
+ l.get(w).forEach((v) => {
885
894
  if (n) {
886
- const _ = Array.isArray(y) ? y.map((N) => n.serialize(N)) : n.serialize(y), C = v ? v instanceof PointerEvent ? v : n.serialize(v) : void 0;
887
- E(_, C);
895
+ const B = Array.isArray(y) ? y.map((D) => n.serialize(D)) : n.serialize(y), R = E ? E instanceof PointerEvent ? E : n.serialize(E) : void 0;
896
+ v(B, R);
888
897
  } else
889
- E(y, v);
898
+ v(y, E);
890
899
  });
891
900
  }, 1);
892
901
  }, x = () => {
893
- const { selected: $ } = i, y = $.map(({ id: v }) => r.getAnnotation(v));
894
- y.forEach((v) => {
895
- const E = d.find((_) => _.id === v.id);
896
- (!E || !pt(E, v)) && m("updateAnnotation", v, E);
897
- }), d = d.map((v) => y.find(({ id: _ }) => _ === v.id) || v);
898
- };
899
- i.subscribe(({ selected: $ }) => {
900
- if (!(d.length === 0 && $.length === 0)) {
901
- if (d.length === 0 && $.length > 0)
902
- d = $.map(({ id: y }) => r.getAnnotation(y));
903
- else if (d.length > 0 && $.length === 0)
902
+ const { selected: w } = i, y = w.map(({ id: E }) => r.getAnnotation(E));
903
+ y.forEach((E) => {
904
+ const v = d.find((B) => B.id === E.id);
905
+ (!v || !pt(v, E)) && m("updateAnnotation", E, v);
906
+ }), d = d.map((E) => y.find(({ id: v }) => v === E.id) || E);
907
+ };
908
+ i.subscribe(({ selected: w }) => {
909
+ if (!(d.length === 0 && w.length === 0)) {
910
+ if (d.length === 0 && w.length > 0)
911
+ d = w.map(({ id: y }) => r.getAnnotation(y));
912
+ else if (d.length > 0 && w.length === 0)
904
913
  d.forEach((y) => {
905
- const v = r.getAnnotation(y.id);
906
- v && !pt(v, y) && m("updateAnnotation", v, y);
914
+ const E = r.getAnnotation(y.id);
915
+ E && !pt(E, y) && m("updateAnnotation", E, y);
907
916
  }), d = [];
908
917
  else {
909
- const y = new Set(d.map((E) => E.id)), v = new Set($.map(({ id: E }) => E));
910
- d.filter((E) => !v.has(E.id)).forEach((E) => {
911
- const _ = r.getAnnotation(E.id);
912
- _ && !pt(_, E) && m("updateAnnotation", _, E);
918
+ const y = new Set(d.map((v) => v.id)), E = new Set(w.map(({ id: v }) => v));
919
+ d.filter((v) => !E.has(v.id)).forEach((v) => {
920
+ const B = r.getAnnotation(v.id);
921
+ B && !pt(B, v) && m("updateAnnotation", B, v);
913
922
  }), d = [
914
923
  // Remove annotations that were deselected
915
- ...d.filter((E) => v.has(E.id)),
924
+ ...d.filter((v) => E.has(v.id)),
916
925
  // Add editable annotations that were selected
917
- ...$.filter(({ id: E }) => !y.has(E)).map(({ id: E }) => r.getAnnotation(E))
926
+ ...w.filter(({ id: v }) => !y.has(v)).map(({ id: v }) => r.getAnnotation(v))
918
927
  ];
919
928
  }
920
929
  m("selectionChanged", d);
921
930
  }
922
- }), a.subscribe(($) => {
923
- !p && $ ? m("mouseEnterAnnotation", r.getAnnotation($)) : p && !$ ? m("mouseLeaveAnnotation", r.getAnnotation(p)) : p && $ && (m("mouseLeaveAnnotation", r.getAnnotation(p)), m("mouseEnterAnnotation", r.getAnnotation($))), p = $;
924
- }), s == null || s.subscribe(($) => m("viewportIntersect", $.map(r.getAnnotation))), r.observe(($) => {
931
+ }), a.subscribe((w) => {
932
+ !p && w ? m("mouseEnterAnnotation", r.getAnnotation(w)) : p && !w ? m("mouseLeaveAnnotation", r.getAnnotation(p)) : p && w && (m("mouseLeaveAnnotation", r.getAnnotation(p)), m("mouseEnterAnnotation", r.getAnnotation(w))), p = w;
933
+ }), s == null || s.subscribe((w) => m("viewportIntersect", w.map(r.getAnnotation))), r.observe((w) => {
925
934
  o && (c && clearTimeout(c), c = setTimeout(x, 1e3));
926
- const { created: y, deleted: v } = $.changes;
927
- y.forEach((E) => m("createAnnotation", E)), v.forEach((E) => m("deleteAnnotation", E)), $.changes.updated.filter((E) => [
928
- ...E.bodiesCreated || [],
929
- ...E.bodiesDeleted || [],
930
- ...E.bodiesUpdated || []
931
- ].length > 0).forEach(({ oldValue: E, newValue: _ }) => {
932
- const C = d.find((N) => N.id === E.id) || E;
933
- d = d.map((N) => N.id === E.id ? _ : N), m("updateAnnotation", _, C);
935
+ const { created: y, deleted: E } = w.changes;
936
+ y.forEach((v) => m("createAnnotation", v)), E.forEach((v) => m("deleteAnnotation", v)), w.changes.updated.filter((v) => [
937
+ ...v.bodiesCreated || [],
938
+ ...v.bodiesDeleted || [],
939
+ ...v.bodiesUpdated || []
940
+ ].length > 0).forEach(({ oldValue: v, newValue: B }) => {
941
+ const R = d.find((D) => D.id === v.id) || v;
942
+ d = d.map((D) => D.id === v.id ? B : D), m("updateAnnotation", B, R);
934
943
  });
935
- }, { origin: D.LOCAL }), r.observe(($) => {
944
+ }, { origin: C.LOCAL }), r.observe((w) => {
936
945
  if (d) {
937
- const y = new Set(d.map((E) => E.id)), v = $.changes.updated.filter(({ newValue: E }) => y.has(E.id)).map(({ newValue: E }) => E);
938
- v.length > 0 && (d = d.map((E) => v.find((C) => C.id === E.id) || E));
946
+ const y = new Set(d.map((v) => v.id)), E = w.changes.updated.filter(({ newValue: v }) => y.has(v.id)).map(({ newValue: v }) => v);
947
+ E.length > 0 && (d = d.map((v) => E.find((B) => B.id === v.id) || v));
939
948
  }
940
- }, { origin: D.REMOTE });
941
- const A = ($) => (y) => {
942
- const { created: v, deleted: E, updated: _ } = y;
943
- v.forEach((C) => m("createAnnotation", C)), E.forEach((C) => m("deleteAnnotation", C)), $ ? _.forEach((C) => m("updateAnnotation", C.oldValue, C.newValue)) : _.forEach((C) => m("updateAnnotation", C.newValue, C.oldValue));
949
+ }, { origin: C.REMOTE });
950
+ const A = (w) => (y) => {
951
+ const { created: E, deleted: v, updated: B } = y;
952
+ E.forEach((R) => m("createAnnotation", R)), v.forEach((R) => m("deleteAnnotation", R)), w ? B.forEach((R) => m("updateAnnotation", R.oldValue, R.newValue)) : B.forEach((R) => m("updateAnnotation", R.newValue, R.oldValue));
944
953
  };
945
- return e.on("undo", A(!0)), e.on("redo", A(!1)), { on: f, off: h, emit: m };
946
- }, Fn = (t) => (e) => e.reduce((n, o) => {
954
+ return e.on("undo", A(!0)), e.on("redo", A(!1)), { on: g, off: h, emit: m };
955
+ }, zn = (t) => (e) => e.reduce((n, o) => {
947
956
  const { parsed: r, error: i } = t.parse(o);
948
957
  return i ? {
949
958
  parsed: n.parsed,
@@ -952,43 +961,43 @@ const Nn = 250, Dn = (t) => {
952
961
  parsed: [...n.parsed, r],
953
962
  failed: n.failed
954
963
  };
955
- }, { parsed: [], failed: [] }), Hn = (t, e, n) => {
964
+ }, { parsed: [], failed: [] }), qn = (t, e, n) => {
956
965
  const { store: o, selection: r } = t, i = (A) => {
957
966
  if (n) {
958
- const { parsed: $, error: y } = n.parse(A);
959
- $ ? o.addAnnotation($, D.REMOTE) : console.error(y);
967
+ const { parsed: w, error: y } = n.parse(A);
968
+ w ? o.addAnnotation(w, C.REMOTE) : console.error(y);
960
969
  } else
961
- o.addAnnotation(A, D.REMOTE);
970
+ o.addAnnotation(A, C.REMOTE);
962
971
  }, a = () => r.clear(), s = () => o.clear(), l = (A) => {
963
- const $ = o.getAnnotation(A);
964
- return n && $ ? n.serialize($) : $;
972
+ const w = o.getAnnotation(A);
973
+ return n && w ? n.serialize(w) : w;
965
974
  }, d = () => n ? o.all().map(n.serialize) : o.all(), p = () => {
966
975
  var A;
967
- const $ = (((A = r.selected) == null ? void 0 : A.map((y) => y.id)) || []).map((y) => o.getAnnotation(y));
968
- return n ? $.map(n.serialize) : $;
969
- }, c = (A) => fetch(A).then(($) => $.json()).then(($) => (h($), $)), f = (A) => {
976
+ const w = (((A = r.selected) == null ? void 0 : A.map((y) => y.id)) || []).map((y) => o.getAnnotation(y));
977
+ return n ? w.map(n.serialize) : w;
978
+ }, c = (A) => fetch(A).then((w) => w.json()).then((w) => (h(w), w)), g = (A) => {
970
979
  if (typeof A == "string") {
971
- const $ = o.getAnnotation(A);
972
- return o.deleteAnnotation(A), n ? n.serialize($) : $;
980
+ const w = o.getAnnotation(A);
981
+ return o.deleteAnnotation(A), n ? n.serialize(w) : w;
973
982
  } else {
974
- const $ = n ? n.parse(A).parsed : A;
975
- return o.deleteAnnotation($), A;
983
+ const w = n ? n.parse(A).parsed : A;
984
+ return o.deleteAnnotation(w), A;
976
985
  }
977
986
  }, h = (A) => {
978
987
  if (n) {
979
- const { parsed: $, failed: y } = Fn(n)(A);
980
- y.length > 0 && console.warn(`Discarded ${y.length} invalid annotations`, y), o.bulkAddAnnotation($, !0, D.REMOTE);
988
+ const { parsed: w, failed: y } = zn(n)(A);
989
+ y.length > 0 && console.warn(`Discarded ${y.length} invalid annotations`, y), o.bulkAddAnnotation(w, !0, C.REMOTE);
981
990
  } else
982
- o.bulkAddAnnotation(A, !0, D.REMOTE);
991
+ o.bulkAddAnnotation(A, !0, C.REMOTE);
983
992
  }, m = (A) => {
984
993
  A ? r.setSelected(A) : r.clear();
985
994
  }, x = (A) => {
986
995
  if (n) {
987
- const $ = n.parse(A).parsed, y = n.serialize(o.getAnnotation($.id));
988
- return o.updateAnnotation($), y;
996
+ const w = n.parse(A).parsed, y = n.serialize(o.getAnnotation(w.id));
997
+ return o.updateAnnotation(w), y;
989
998
  } else {
990
- const $ = o.getAnnotation(A.id);
991
- return o.updateAnnotation(A), $;
999
+ const w = o.getAnnotation(A.id);
1000
+ return o.updateAnnotation(A), w;
992
1001
  }
993
1002
  };
994
1003
  return {
@@ -1002,14 +1011,14 @@ const Nn = 250, Dn = (t) => {
1002
1011
  getSelected: p,
1003
1012
  loadAnnotations: c,
1004
1013
  redo: e.redo,
1005
- removeAnnotation: f,
1014
+ removeAnnotation: g,
1006
1015
  setAnnotations: h,
1007
1016
  setSelected: m,
1008
1017
  undo: e.undo,
1009
1018
  updateAnnotation: x
1010
1019
  };
1011
1020
  };
1012
- let jn = (t) => crypto.getRandomValues(new Uint8Array(t)), zn = (t, e, n) => {
1021
+ let Wn = (t) => crypto.getRandomValues(new Uint8Array(t)), Kn = (t, e, n) => {
1013
1022
  let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, r = -~(1.6 * o * e / t.length);
1014
1023
  return (i = e) => {
1015
1024
  let a = "";
@@ -1020,8 +1029,8 @@ let jn = (t) => crypto.getRandomValues(new Uint8Array(t)), zn = (t, e, n) => {
1020
1029
  return a;
1021
1030
  }
1022
1031
  };
1023
- }, Rn = (t, e = 21) => zn(t, e, jn), qn = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
1024
- const Wn = () => ({ isGuest: !0, id: Rn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Kn = (t) => {
1032
+ }, Jn = (t, e = 21) => Kn(t, e, Wn), Qn = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
1033
+ const Zn = () => ({ isGuest: !0, id: Jn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), to = (t) => {
1025
1034
  const e = JSON.stringify(t);
1026
1035
  let n = 0;
1027
1036
  for (let o = 0, r = e.length; o < r; o++) {
@@ -1029,10 +1038,10 @@ const Wn = () => ({ isGuest: !0, id: Rn("1234567890abcdefghijklmnopqrstuvwxyzABC
1029
1038
  n = (n << 5) - n + i, n |= 0;
1030
1039
  }
1031
1040
  return `${n}`;
1032
- }, Jn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
1041
+ }, eo = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
1033
1042
  const { id: o, type: r, purpose: i, value: a, created: s, creator: l, ...d } = n;
1034
1043
  return {
1035
- id: o || `temp-${Kn(n)}`,
1044
+ id: o || `temp-${to(n)}`,
1036
1045
  annotation: e,
1037
1046
  type: r,
1038
1047
  purpose: i,
@@ -1041,20 +1050,21 @@ const Wn = () => ({ isGuest: !0, id: Rn("1234567890abcdefghijklmnopqrstuvwxyzABC
1041
1050
  creator: l ? typeof l == "object" ? { ...l } : l : void 0,
1042
1051
  ...d
1043
1052
  };
1044
- }), Qn = (t) => t.map((e) => {
1053
+ }), no = (t) => t.map((e) => {
1045
1054
  var n;
1046
1055
  const o = { ...e };
1047
1056
  return delete o.annotation, (n = o.id) != null && n.startsWith("temp-") && delete o.id, o;
1048
1057
  });
1049
- qn();
1050
- const pr = (t, e = !1) => ({ parse: (n) => Zn(n, e), serialize: (n) => to(n, t) }), Zn = (t, e = !1) => {
1051
- const n = t.id || Fe(), { body: o, ...r } = t, i = Jn(o, n), a = Array.isArray(t.target) ? t.target[0] : t.target, s = Array.isArray(a.selector) ? a.selector[0] : a.selector, l = s.type === "FragmentSelector" ? fn(s, e) : s.type === "SvgSelector" ? xn(s) : void 0;
1058
+ Qn();
1059
+ const $r = (t, e = !1) => ({ parse: (n) => oo(n, e), serialize: (n) => ro(n, t) }), oo = (t, e = !1) => {
1060
+ const n = t.id || je(), { body: o, ...r } = t, i = eo(o, n), a = Array.isArray(t.target) ? t.target[0] : t.target, s = Array.isArray(a.selector) ? a.selector[0] : a.selector, l = s.type === "FragmentSelector" ? mn(s, e) : s.type === "SvgSelector" ? En(s) : void 0;
1052
1061
  return l ? {
1053
1062
  parsed: {
1054
1063
  ...r,
1055
1064
  id: n,
1056
1065
  bodies: i,
1057
1066
  target: {
1067
+ ...r.target,
1058
1068
  annotation: n,
1059
1069
  selector: l
1060
1070
  }
@@ -1062,29 +1072,29 @@ const pr = (t, e = !1) => ({ parse: (n) => Zn(n, e), serialize: (n) => to(n, t)
1062
1072
  } : {
1063
1073
  error: Error(`Unknown selector type: ${s.type}`)
1064
1074
  };
1065
- }, to = (t, e) => {
1066
- const n = t.target.selector, o = n.type == F.RECTANGLE ? gn(n.geometry) : bn(n);
1075
+ }, ro = (t, e) => {
1076
+ const n = t.target.selector, o = n.type == F.RECTANGLE ? yn(n.geometry) : vn(n);
1067
1077
  return {
1068
1078
  ...t,
1069
1079
  "@context": "http://www.w3.org/ns/anno.jsonld",
1070
1080
  id: t.id,
1071
1081
  type: "Annotation",
1072
- body: Qn(t.bodies),
1082
+ body: no(t.bodies),
1073
1083
  target: {
1074
1084
  source: e,
1075
1085
  selector: o
1076
1086
  }
1077
1087
  };
1078
1088
  };
1079
- function ge(t, e, n) {
1089
+ function ye(t, e, n) {
1080
1090
  const o = t.slice();
1081
1091
  return o[11] = e[n], o[13] = n, o;
1082
1092
  }
1083
- function me(t) {
1093
+ function we(t) {
1084
1094
  let e, n, o, r, i;
1085
1095
  return {
1086
1096
  c() {
1087
- e = O("rect"), u(e, "class", "a9s-corner-handle"), u(e, "x", n = /*point*/
1097
+ e = N("rect"), u(e, "class", "a9s-corner-handle"), u(e, "x", n = /*point*/
1088
1098
  t[11][0] - /*handleSize*/
1089
1099
  t[3] / 2), u(e, "y", o = /*point*/
1090
1100
  t[11][1] - /*handleSize*/
@@ -1101,14 +1111,14 @@ function me(t) {
1101
1111
  );
1102
1112
  },
1103
1113
  m(a, s) {
1104
- B(a, e, s), r || (i = R(e, "pointerdown", function() {
1114
+ Y(a, e, s), r || (i = z(e, "pointerdown", function() {
1105
1115
  H(
1106
1116
  /*grab*/
1107
- t[10](M(
1117
+ t[10](O(
1108
1118
  /*idx*/
1109
1119
  t[13]
1110
1120
  ))
1111
- ) && t[10](M(
1121
+ ) && t[10](O(
1112
1122
  /*idx*/
1113
1123
  t[13]
1114
1124
  )).apply(this, arguments);
@@ -1140,44 +1150,44 @@ function me(t) {
1140
1150
  }
1141
1151
  };
1142
1152
  }
1143
- function eo(t) {
1153
+ function io(t) {
1144
1154
  let e, n, o, r, i, a, s, l, d, p, c = (
1145
1155
  /*geom*/
1146
1156
  t[4].points
1147
- ), f = [];
1157
+ ), g = [];
1148
1158
  for (let h = 0; h < c.length; h += 1)
1149
- f[h] = me(ge(t, c, h));
1159
+ g[h] = we(ye(t, c, h));
1150
1160
  return {
1151
1161
  c() {
1152
- e = O("polygon"), r = tt(), i = O("polygon"), s = tt();
1153
- for (let h = 0; h < f.length; h += 1)
1154
- f[h].c();
1162
+ e = N("polygon"), r = tt(), i = N("polygon"), s = tt();
1163
+ for (let h = 0; h < g.length; h += 1)
1164
+ g[h].c();
1155
1165
  l = at(), u(e, "class", "a9s-outer"), u(e, "style", n = /*computedStyle*/
1156
1166
  t[1] ? "display:none;" : void 0), u(e, "points", o = /*geom*/
1157
- t[4].points.map(ye).join(" ")), u(i, "class", "a9s-inner a9s-shape-handle"), u(
1167
+ t[4].points.map($e).join(" ")), u(i, "class", "a9s-inner a9s-shape-handle"), u(
1158
1168
  i,
1159
1169
  "style",
1160
1170
  /*computedStyle*/
1161
1171
  t[1]
1162
1172
  ), u(i, "points", a = /*geom*/
1163
- t[4].points.map($e).join(" "));
1173
+ t[4].points.map(xe).join(" "));
1164
1174
  },
1165
1175
  m(h, m) {
1166
- B(h, e, m), B(h, r, m), B(h, i, m), B(h, s, m);
1167
- for (let x = 0; x < f.length; x += 1)
1168
- f[x] && f[x].m(h, m);
1169
- B(h, l, m), d || (p = [
1170
- R(e, "pointerdown", function() {
1176
+ Y(h, e, m), Y(h, r, m), Y(h, i, m), Y(h, s, m);
1177
+ for (let x = 0; x < g.length; x += 1)
1178
+ g[x] && g[x].m(h, m);
1179
+ Y(h, l, m), d || (p = [
1180
+ z(e, "pointerdown", function() {
1171
1181
  H(
1172
1182
  /*grab*/
1173
- t[10](M.SHAPE)
1174
- ) && t[10](M.SHAPE).apply(this, arguments);
1183
+ t[10](O.SHAPE)
1184
+ ) && t[10](O.SHAPE).apply(this, arguments);
1175
1185
  }),
1176
- R(i, "pointerdown", function() {
1186
+ z(i, "pointerdown", function() {
1177
1187
  H(
1178
1188
  /*grab*/
1179
- t[10](M.SHAPE)
1180
- ) && t[10](M.SHAPE).apply(this, arguments);
1189
+ t[10](O.SHAPE)
1190
+ ) && t[10](O.SHAPE).apply(this, arguments);
1181
1191
  })
1182
1192
  ], d = !0);
1183
1193
  },
@@ -1186,7 +1196,7 @@ function eo(t) {
1186
1196
  2 && n !== (n = /*computedStyle*/
1187
1197
  t[1] ? "display:none;" : void 0) && u(e, "style", n), m & /*geom*/
1188
1198
  16 && o !== (o = /*geom*/
1189
- t[4].points.map(ye).join(" ")) && u(e, "points", o), m & /*computedStyle*/
1199
+ t[4].points.map($e).join(" ")) && u(e, "points", o), m & /*computedStyle*/
1190
1200
  2 && u(
1191
1201
  i,
1192
1202
  "style",
@@ -1194,28 +1204,28 @@ function eo(t) {
1194
1204
  t[1]
1195
1205
  ), m & /*geom*/
1196
1206
  16 && a !== (a = /*geom*/
1197
- t[4].points.map($e).join(" ")) && u(i, "points", a), m & /*geom, handleSize, grab, Handle*/
1207
+ t[4].points.map(xe).join(" ")) && u(i, "points", a), m & /*geom, handleSize, grab, Handle*/
1198
1208
  1048) {
1199
1209
  c = /*geom*/
1200
1210
  t[4].points;
1201
1211
  let x;
1202
1212
  for (x = 0; x < c.length; x += 1) {
1203
- const A = ge(t, c, x);
1204
- f[x] ? f[x].p(A, m) : (f[x] = me(A), f[x].c(), f[x].m(l.parentNode, l));
1213
+ const A = ye(t, c, x);
1214
+ g[x] ? g[x].p(A, m) : (g[x] = we(A), g[x].c(), g[x].m(l.parentNode, l));
1205
1215
  }
1206
- for (; x < f.length; x += 1)
1207
- f[x].d(1);
1208
- f.length = c.length;
1216
+ for (; x < g.length; x += 1)
1217
+ g[x].d(1);
1218
+ g.length = c.length;
1209
1219
  }
1210
1220
  },
1211
1221
  d(h) {
1212
- h && L(e), h && L(r), h && L(i), h && L(s), oe(f, h), h && L(l), d = !1, it(p);
1222
+ h && L(e), h && L(r), h && L(i), h && L(s), re(g, h), h && L(l), d = !1, it(p);
1213
1223
  }
1214
1224
  };
1215
1225
  }
1216
- function no(t) {
1226
+ function ao(t) {
1217
1227
  let e, n;
1218
- return e = new Re({
1228
+ return e = new We({
1219
1229
  props: {
1220
1230
  shape: (
1221
1231
  /*shape*/
@@ -1231,7 +1241,7 @@ function no(t) {
1231
1241
  ),
1232
1242
  $$slots: {
1233
1243
  default: [
1234
- eo,
1244
+ io,
1235
1245
  ({ grab: o }) => ({ 10: o }),
1236
1246
  ({ grab: o }) => o ? 1024 : 0
1237
1247
  ]
@@ -1252,7 +1262,7 @@ function no(t) {
1252
1262
  t[9]
1253
1263
  ), {
1254
1264
  c() {
1255
- ft(e.$$.fragment);
1265
+ gt(e.$$.fragment);
1256
1266
  },
1257
1267
  m(o, r) {
1258
1268
  ct(e, o, r), n = !0;
@@ -1267,24 +1277,24 @@ function no(t) {
1267
1277
  17434 && (i.$$scope = { dirty: r, ctx: o }), e.$set(i);
1268
1278
  },
1269
1279
  i(o) {
1270
- n || (V(e.$$.fragment, o), n = !0);
1280
+ n || (k(e.$$.fragment, o), n = !0);
1271
1281
  },
1272
1282
  o(o) {
1273
- k(e.$$.fragment, o), n = !1;
1283
+ V(e.$$.fragment, o), n = !1;
1274
1284
  },
1275
1285
  d(o) {
1276
1286
  ut(e, o);
1277
1287
  }
1278
1288
  };
1279
1289
  }
1280
- const ye = (t) => t.join(","), $e = (t) => t.join(",");
1281
- function oo(t, e, n) {
1290
+ const $e = (t) => t.join(","), xe = (t) => t.join(",");
1291
+ function so(t, e, n) {
1282
1292
  let o, r, { shape: i } = e, { computedStyle: a = void 0 } = e, { transform: s } = e, { viewportScale: l = 1 } = e;
1283
1293
  const d = (h, m, x) => {
1284
1294
  let A;
1285
- m === M.SHAPE ? A = h.geometry.points.map(([y, v]) => [y + x[0], v + x[1]]) : A = h.geometry.points.map(([y, v], E) => m === M(E) ? [y + x[0], v + x[1]] : [y, v]);
1286
- const $ = Gt(A);
1287
- return { ...h, geometry: { points: A, bounds: $ } };
1295
+ m === O.SHAPE ? A = h.geometry.points.map(([y, E]) => [y + x[0], E + x[1]]) : A = h.geometry.points.map(([y, E], v) => m === O(v) ? [y + x[0], E + x[1]] : [y, E]);
1296
+ const w = Gt(A);
1297
+ return { ...h, geometry: { points: A, bounds: w } };
1288
1298
  };
1289
1299
  function p(h) {
1290
1300
  vt.call(this, t, h);
@@ -1292,7 +1302,7 @@ function oo(t, e, n) {
1292
1302
  function c(h) {
1293
1303
  vt.call(this, t, h);
1294
1304
  }
1295
- function f(h) {
1305
+ function g(h) {
1296
1306
  vt.call(this, t, h);
1297
1307
  }
1298
1308
  return t.$$set = (h) => {
@@ -1311,12 +1321,12 @@ function oo(t, e, n) {
1311
1321
  l,
1312
1322
  p,
1313
1323
  c,
1314
- f
1324
+ g
1315
1325
  ];
1316
1326
  }
1317
- class ro extends nt {
1327
+ class lo extends nt {
1318
1328
  constructor(e) {
1319
- super(), et(this, e, oo, no, K, {
1329
+ super(), et(this, e, so, ao, K, {
1320
1330
  shape: 0,
1321
1331
  computedStyle: 1,
1322
1332
  transform: 2,
@@ -1324,11 +1334,11 @@ class ro extends nt {
1324
1334
  });
1325
1335
  }
1326
1336
  }
1327
- function io(t) {
1328
- let e, n, o, r, i, a, s, l, d, p, c, f, h, m, x, A, $, y, v, E, _, C, N, g, b, w, T, X, P, J, gt, mt, Tt, W, I, q, j, G, st, lt, Ht, Q, Yt, _t, jt, Z, Ct, Pt, zt, se;
1337
+ function co(t) {
1338
+ let e, n, o, r, i, a, s, l, d, p, c, g, h, m, x, A, w, y, E, v, B, R, D, f, b, $, T, _, X, J, ft, mt, St, W, I, q, j, U, st, lt, Ht, Q, Bt, Xt, jt, Z, Rt, Nt, Pt, de;
1329
1339
  return {
1330
1340
  c() {
1331
- e = O("rect"), s = tt(), l = O("rect"), h = tt(), m = O("rect"), y = tt(), v = O("rect"), N = tt(), g = O("rect"), X = tt(), P = O("rect"), Tt = tt(), W = O("rect"), j = tt(), G = O("rect"), Ht = tt(), Q = O("rect"), jt = tt(), Z = O("rect"), u(e, "class", "a9s-outer"), u(e, "style", n = /*computedStyle*/
1341
+ e = N("rect"), s = tt(), l = N("rect"), h = tt(), m = N("rect"), y = tt(), E = N("rect"), D = tt(), f = N("rect"), _ = tt(), X = N("rect"), St = tt(), W = N("rect"), j = tt(), U = N("rect"), Ht = tt(), Q = N("rect"), jt = tt(), Z = N("rect"), u(e, "class", "a9s-outer"), u(e, "style", n = /*computedStyle*/
1332
1342
  t[1] ? "display:none;" : void 0), u(e, "x", o = /*geom*/
1333
1343
  t[4].x), u(e, "y", r = /*geom*/
1334
1344
  t[4].y), u(e, "width", i = /*geom*/
@@ -1341,22 +1351,22 @@ function io(t) {
1341
1351
  ), u(l, "x", d = /*geom*/
1342
1352
  t[4].x), u(l, "y", p = /*geom*/
1343
1353
  t[4].y), u(l, "width", c = /*geom*/
1344
- t[4].w), u(l, "height", f = /*geom*/
1354
+ t[4].w), u(l, "height", g = /*geom*/
1345
1355
  t[4].h), u(m, "class", "a9s-edge-handle a9s-edge-handle-top"), u(m, "x", x = /*geom*/
1346
1356
  t[4].x), u(m, "y", A = /*geom*/
1347
- t[4].y), u(m, "height", 1), u(m, "width", $ = /*geom*/
1348
- t[4].w), u(v, "class", "a9s-edge-handle a9s-edge-handle-right"), u(v, "x", E = /*geom*/
1357
+ t[4].y), u(m, "height", 1), u(m, "width", w = /*geom*/
1358
+ t[4].w), u(E, "class", "a9s-edge-handle a9s-edge-handle-right"), u(E, "x", v = /*geom*/
1349
1359
  t[4].x + /*geom*/
1350
- t[4].w), u(v, "y", _ = /*geom*/
1351
- t[4].y), u(v, "height", C = /*geom*/
1352
- t[4].h), u(v, "width", 1), u(g, "class", "a9s-edge-handle a9s-edge-handle-bottom"), u(g, "x", b = /*geom*/
1353
- t[4].x), u(g, "y", w = /*geom*/
1360
+ t[4].w), u(E, "y", B = /*geom*/
1361
+ t[4].y), u(E, "height", R = /*geom*/
1362
+ t[4].h), u(E, "width", 1), u(f, "class", "a9s-edge-handle a9s-edge-handle-bottom"), u(f, "x", b = /*geom*/
1363
+ t[4].x), u(f, "y", $ = /*geom*/
1354
1364
  t[4].y + /*geom*/
1355
- t[4].h), u(g, "height", 1), u(g, "width", T = /*geom*/
1356
- t[4].w), u(P, "class", "a9s-edge-handle a9s-edge-handle-left"), u(P, "x", J = /*geom*/
1357
- t[4].x), u(P, "y", gt = /*geom*/
1358
- t[4].y), u(P, "height", mt = /*geom*/
1359
- t[4].h), u(P, "width", 1), u(W, "class", "a9s-corner-handle a9s-corner-handle-topleft"), u(W, "x", I = /*geom*/
1365
+ t[4].h), u(f, "height", 1), u(f, "width", T = /*geom*/
1366
+ t[4].w), u(X, "class", "a9s-edge-handle a9s-edge-handle-left"), u(X, "x", J = /*geom*/
1367
+ t[4].x), u(X, "y", ft = /*geom*/
1368
+ t[4].y), u(X, "height", mt = /*geom*/
1369
+ t[4].h), u(X, "width", 1), u(W, "class", "a9s-corner-handle a9s-corner-handle-topleft"), u(W, "x", I = /*geom*/
1360
1370
  t[4].x - /*handleSize*/
1361
1371
  t[3] / 2), u(W, "y", q = /*geom*/
1362
1372
  t[4].y - /*handleSize*/
@@ -1370,25 +1380,25 @@ function io(t) {
1370
1380
  "width",
1371
1381
  /*handleSize*/
1372
1382
  t[3]
1373
- ), u(G, "class", "a9s-corner-handle a9s-corner-handle-topright"), u(G, "x", st = /*geom*/
1383
+ ), u(U, "class", "a9s-corner-handle a9s-corner-handle-topright"), u(U, "x", st = /*geom*/
1374
1384
  t[4].x + /*geom*/
1375
1385
  t[4].w - /*handleSize*/
1376
- t[3] / 2), u(G, "y", lt = /*geom*/
1386
+ t[3] / 2), u(U, "y", lt = /*geom*/
1377
1387
  t[4].y - /*handleSize*/
1378
1388
  t[3] / 2), u(
1379
- G,
1389
+ U,
1380
1390
  "height",
1381
1391
  /*handleSize*/
1382
1392
  t[3]
1383
1393
  ), u(
1384
- G,
1394
+ U,
1385
1395
  "width",
1386
1396
  /*handleSize*/
1387
1397
  t[3]
1388
- ), u(Q, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), u(Q, "x", Yt = /*geom*/
1398
+ ), u(Q, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), u(Q, "x", Bt = /*geom*/
1389
1399
  t[4].x + /*geom*/
1390
1400
  t[4].w - /*handleSize*/
1391
- t[3] / 2), u(Q, "y", _t = /*geom*/
1401
+ t[3] / 2), u(Q, "y", Xt = /*geom*/
1392
1402
  t[4].y + /*geom*/
1393
1403
  t[4].h - /*handleSize*/
1394
1404
  t[3] / 2), u(
@@ -1401,9 +1411,9 @@ function io(t) {
1401
1411
  "width",
1402
1412
  /*handleSize*/
1403
1413
  t[3]
1404
- ), u(Z, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), u(Z, "x", Ct = /*geom*/
1414
+ ), u(Z, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), u(Z, "x", Rt = /*geom*/
1405
1415
  t[4].x - /*handleSize*/
1406
- t[3] / 2), u(Z, "y", Pt = /*geom*/
1416
+ t[3] / 2), u(Z, "y", Nt = /*geom*/
1407
1417
  t[4].y + /*geom*/
1408
1418
  t[4].h - /*handleSize*/
1409
1419
  t[3] / 2), u(
@@ -1418,72 +1428,72 @@ function io(t) {
1418
1428
  t[3]
1419
1429
  );
1420
1430
  },
1421
- m(Y, S) {
1422
- B(Y, e, S), B(Y, s, S), B(Y, l, S), B(Y, h, S), B(Y, m, S), B(Y, y, S), B(Y, v, S), B(Y, N, S), B(Y, g, S), B(Y, X, S), B(Y, P, S), B(Y, Tt, S), B(Y, W, S), B(Y, j, S), B(Y, G, S), B(Y, Ht, S), B(Y, Q, S), B(Y, jt, S), B(Y, Z, S), zt || (se = [
1423
- R(e, "pointerdown", function() {
1431
+ m(M, S) {
1432
+ Y(M, e, S), Y(M, s, S), Y(M, l, S), Y(M, h, S), Y(M, m, S), Y(M, y, S), Y(M, E, S), Y(M, D, S), Y(M, f, S), Y(M, _, S), Y(M, X, S), Y(M, St, S), Y(M, W, S), Y(M, j, S), Y(M, U, S), Y(M, Ht, S), Y(M, Q, S), Y(M, jt, S), Y(M, Z, S), Pt || (de = [
1433
+ z(e, "pointerdown", function() {
1424
1434
  H(
1425
1435
  /*grab*/
1426
- t[10](M.SHAPE)
1427
- ) && t[10](M.SHAPE).apply(this, arguments);
1436
+ t[10](O.SHAPE)
1437
+ ) && t[10](O.SHAPE).apply(this, arguments);
1428
1438
  }),
1429
- R(l, "pointerdown", function() {
1439
+ z(l, "pointerdown", function() {
1430
1440
  H(
1431
1441
  /*grab*/
1432
- t[10](M.SHAPE)
1433
- ) && t[10](M.SHAPE).apply(this, arguments);
1442
+ t[10](O.SHAPE)
1443
+ ) && t[10](O.SHAPE).apply(this, arguments);
1434
1444
  }),
1435
- R(m, "pointerdown", function() {
1445
+ z(m, "pointerdown", function() {
1436
1446
  H(
1437
1447
  /*grab*/
1438
- t[10](M.TOP)
1439
- ) && t[10](M.TOP).apply(this, arguments);
1448
+ t[10](O.TOP)
1449
+ ) && t[10](O.TOP).apply(this, arguments);
1440
1450
  }),
1441
- R(v, "pointerdown", function() {
1451
+ z(E, "pointerdown", function() {
1442
1452
  H(
1443
1453
  /*grab*/
1444
- t[10](M.RIGHT)
1445
- ) && t[10](M.RIGHT).apply(this, arguments);
1454
+ t[10](O.RIGHT)
1455
+ ) && t[10](O.RIGHT).apply(this, arguments);
1446
1456
  }),
1447
- R(g, "pointerdown", function() {
1457
+ z(f, "pointerdown", function() {
1448
1458
  H(
1449
1459
  /*grab*/
1450
- t[10](M.BOTTOM)
1451
- ) && t[10](M.BOTTOM).apply(this, arguments);
1460
+ t[10](O.BOTTOM)
1461
+ ) && t[10](O.BOTTOM).apply(this, arguments);
1452
1462
  }),
1453
- R(P, "pointerdown", function() {
1463
+ z(X, "pointerdown", function() {
1454
1464
  H(
1455
1465
  /*grab*/
1456
- t[10](M.LEFT)
1457
- ) && t[10](M.LEFT).apply(this, arguments);
1466
+ t[10](O.LEFT)
1467
+ ) && t[10](O.LEFT).apply(this, arguments);
1458
1468
  }),
1459
- R(W, "pointerdown", function() {
1469
+ z(W, "pointerdown", function() {
1460
1470
  H(
1461
1471
  /*grab*/
1462
- t[10](M.TOP_LEFT)
1463
- ) && t[10](M.TOP_LEFT).apply(this, arguments);
1472
+ t[10](O.TOP_LEFT)
1473
+ ) && t[10](O.TOP_LEFT).apply(this, arguments);
1464
1474
  }),
1465
- R(G, "pointerdown", function() {
1475
+ z(U, "pointerdown", function() {
1466
1476
  H(
1467
1477
  /*grab*/
1468
- t[10](M.TOP_RIGHT)
1469
- ) && t[10](M.TOP_RIGHT).apply(this, arguments);
1478
+ t[10](O.TOP_RIGHT)
1479
+ ) && t[10](O.TOP_RIGHT).apply(this, arguments);
1470
1480
  }),
1471
- R(Q, "pointerdown", function() {
1481
+ z(Q, "pointerdown", function() {
1472
1482
  H(
1473
1483
  /*grab*/
1474
- t[10](M.BOTTOM_RIGHT)
1475
- ) && t[10](M.BOTTOM_RIGHT).apply(this, arguments);
1484
+ t[10](O.BOTTOM_RIGHT)
1485
+ ) && t[10](O.BOTTOM_RIGHT).apply(this, arguments);
1476
1486
  }),
1477
- R(Z, "pointerdown", function() {
1487
+ z(Z, "pointerdown", function() {
1478
1488
  H(
1479
1489
  /*grab*/
1480
- t[10](M.BOTTOM_LEFT)
1481
- ) && t[10](M.BOTTOM_LEFT).apply(this, arguments);
1490
+ t[10](O.BOTTOM_LEFT)
1491
+ ) && t[10](O.BOTTOM_LEFT).apply(this, arguments);
1482
1492
  })
1483
- ], zt = !0);
1493
+ ], Pt = !0);
1484
1494
  },
1485
- p(Y, S) {
1486
- t = Y, S & /*computedStyle*/
1495
+ p(M, S) {
1496
+ t = M, S & /*computedStyle*/
1487
1497
  2 && n !== (n = /*computedStyle*/
1488
1498
  t[1] ? "display:none;" : void 0) && u(e, "style", n), S & /*geom*/
1489
1499
  16 && o !== (o = /*geom*/
@@ -1506,34 +1516,34 @@ function io(t) {
1506
1516
  t[4].y) && u(l, "y", p), S & /*geom*/
1507
1517
  16 && c !== (c = /*geom*/
1508
1518
  t[4].w) && u(l, "width", c), S & /*geom*/
1509
- 16 && f !== (f = /*geom*/
1510
- t[4].h) && u(l, "height", f), S & /*geom*/
1519
+ 16 && g !== (g = /*geom*/
1520
+ t[4].h) && u(l, "height", g), S & /*geom*/
1511
1521
  16 && x !== (x = /*geom*/
1512
1522
  t[4].x) && u(m, "x", x), S & /*geom*/
1513
1523
  16 && A !== (A = /*geom*/
1514
1524
  t[4].y) && u(m, "y", A), S & /*geom*/
1515
- 16 && $ !== ($ = /*geom*/
1516
- t[4].w) && u(m, "width", $), S & /*geom*/
1517
- 16 && E !== (E = /*geom*/
1525
+ 16 && w !== (w = /*geom*/
1526
+ t[4].w) && u(m, "width", w), S & /*geom*/
1527
+ 16 && v !== (v = /*geom*/
1518
1528
  t[4].x + /*geom*/
1519
- t[4].w) && u(v, "x", E), S & /*geom*/
1520
- 16 && _ !== (_ = /*geom*/
1521
- t[4].y) && u(v, "y", _), S & /*geom*/
1522
- 16 && C !== (C = /*geom*/
1523
- t[4].h) && u(v, "height", C), S & /*geom*/
1529
+ t[4].w) && u(E, "x", v), S & /*geom*/
1530
+ 16 && B !== (B = /*geom*/
1531
+ t[4].y) && u(E, "y", B), S & /*geom*/
1532
+ 16 && R !== (R = /*geom*/
1533
+ t[4].h) && u(E, "height", R), S & /*geom*/
1524
1534
  16 && b !== (b = /*geom*/
1525
- t[4].x) && u(g, "x", b), S & /*geom*/
1526
- 16 && w !== (w = /*geom*/
1535
+ t[4].x) && u(f, "x", b), S & /*geom*/
1536
+ 16 && $ !== ($ = /*geom*/
1527
1537
  t[4].y + /*geom*/
1528
- t[4].h) && u(g, "y", w), S & /*geom*/
1538
+ t[4].h) && u(f, "y", $), S & /*geom*/
1529
1539
  16 && T !== (T = /*geom*/
1530
- t[4].w) && u(g, "width", T), S & /*geom*/
1540
+ t[4].w) && u(f, "width", T), S & /*geom*/
1531
1541
  16 && J !== (J = /*geom*/
1532
- t[4].x) && u(P, "x", J), S & /*geom*/
1533
- 16 && gt !== (gt = /*geom*/
1534
- t[4].y) && u(P, "y", gt), S & /*geom*/
1542
+ t[4].x) && u(X, "x", J), S & /*geom*/
1543
+ 16 && ft !== (ft = /*geom*/
1544
+ t[4].y) && u(X, "y", ft), S & /*geom*/
1535
1545
  16 && mt !== (mt = /*geom*/
1536
- t[4].h) && u(P, "height", mt), S & /*geom, handleSize*/
1546
+ t[4].h) && u(X, "height", mt), S & /*geom, handleSize*/
1537
1547
  24 && I !== (I = /*geom*/
1538
1548
  t[4].x - /*handleSize*/
1539
1549
  t[3] / 2) && u(W, "x", I), S & /*geom, handleSize*/
@@ -1555,30 +1565,30 @@ function io(t) {
1555
1565
  24 && st !== (st = /*geom*/
1556
1566
  t[4].x + /*geom*/
1557
1567
  t[4].w - /*handleSize*/
1558
- t[3] / 2) && u(G, "x", st), S & /*geom, handleSize*/
1568
+ t[3] / 2) && u(U, "x", st), S & /*geom, handleSize*/
1559
1569
  24 && lt !== (lt = /*geom*/
1560
1570
  t[4].y - /*handleSize*/
1561
- t[3] / 2) && u(G, "y", lt), S & /*handleSize*/
1571
+ t[3] / 2) && u(U, "y", lt), S & /*handleSize*/
1562
1572
  8 && u(
1563
- G,
1573
+ U,
1564
1574
  "height",
1565
1575
  /*handleSize*/
1566
1576
  t[3]
1567
1577
  ), S & /*handleSize*/
1568
1578
  8 && u(
1569
- G,
1579
+ U,
1570
1580
  "width",
1571
1581
  /*handleSize*/
1572
1582
  t[3]
1573
1583
  ), S & /*geom, handleSize*/
1574
- 24 && Yt !== (Yt = /*geom*/
1584
+ 24 && Bt !== (Bt = /*geom*/
1575
1585
  t[4].x + /*geom*/
1576
1586
  t[4].w - /*handleSize*/
1577
- t[3] / 2) && u(Q, "x", Yt), S & /*geom, handleSize*/
1578
- 24 && _t !== (_t = /*geom*/
1587
+ t[3] / 2) && u(Q, "x", Bt), S & /*geom, handleSize*/
1588
+ 24 && Xt !== (Xt = /*geom*/
1579
1589
  t[4].y + /*geom*/
1580
1590
  t[4].h - /*handleSize*/
1581
- t[3] / 2) && u(Q, "y", _t), S & /*handleSize*/
1591
+ t[3] / 2) && u(Q, "y", Xt), S & /*handleSize*/
1582
1592
  8 && u(
1583
1593
  Q,
1584
1594
  "height",
@@ -1591,13 +1601,13 @@ function io(t) {
1591
1601
  /*handleSize*/
1592
1602
  t[3]
1593
1603
  ), S & /*geom, handleSize*/
1594
- 24 && Ct !== (Ct = /*geom*/
1604
+ 24 && Rt !== (Rt = /*geom*/
1595
1605
  t[4].x - /*handleSize*/
1596
- t[3] / 2) && u(Z, "x", Ct), S & /*geom, handleSize*/
1597
- 24 && Pt !== (Pt = /*geom*/
1606
+ t[3] / 2) && u(Z, "x", Rt), S & /*geom, handleSize*/
1607
+ 24 && Nt !== (Nt = /*geom*/
1598
1608
  t[4].y + /*geom*/
1599
1609
  t[4].h - /*handleSize*/
1600
- t[3] / 2) && u(Z, "y", Pt), S & /*handleSize*/
1610
+ t[3] / 2) && u(Z, "y", Nt), S & /*handleSize*/
1601
1611
  8 && u(
1602
1612
  Z,
1603
1613
  "height",
@@ -1611,14 +1621,14 @@ function io(t) {
1611
1621
  t[3]
1612
1622
  );
1613
1623
  },
1614
- d(Y) {
1615
- Y && L(e), Y && L(s), Y && L(l), Y && L(h), Y && L(m), Y && L(y), Y && L(v), Y && L(N), Y && L(g), Y && L(X), Y && L(P), Y && L(Tt), Y && L(W), Y && L(j), Y && L(G), Y && L(Ht), Y && L(Q), Y && L(jt), Y && L(Z), zt = !1, it(se);
1624
+ d(M) {
1625
+ M && L(e), M && L(s), M && L(l), M && L(h), M && L(m), M && L(y), M && L(E), M && L(D), M && L(f), M && L(_), M && L(X), M && L(St), M && L(W), M && L(j), M && L(U), M && L(Ht), M && L(Q), M && L(jt), M && L(Z), Pt = !1, it(de);
1616
1626
  }
1617
1627
  };
1618
1628
  }
1619
- function ao(t) {
1629
+ function uo(t) {
1620
1630
  let e, n;
1621
- return e = new Re({
1631
+ return e = new We({
1622
1632
  props: {
1623
1633
  shape: (
1624
1634
  /*shape*/
@@ -1634,7 +1644,7 @@ function ao(t) {
1634
1644
  ),
1635
1645
  $$slots: {
1636
1646
  default: [
1637
- io,
1647
+ co,
1638
1648
  ({ grab: o }) => ({ 10: o }),
1639
1649
  ({ grab: o }) => o ? 1024 : 0
1640
1650
  ]
@@ -1655,7 +1665,7 @@ function ao(t) {
1655
1665
  t[9]
1656
1666
  ), {
1657
1667
  c() {
1658
- ft(e.$$.fragment);
1668
+ gt(e.$$.fragment);
1659
1669
  },
1660
1670
  m(o, r) {
1661
1671
  ct(e, o, r), n = !0;
@@ -1670,67 +1680,67 @@ function ao(t) {
1670
1680
  3098 && (i.$$scope = { dirty: r, ctx: o }), e.$set(i);
1671
1681
  },
1672
1682
  i(o) {
1673
- n || (V(e.$$.fragment, o), n = !0);
1683
+ n || (k(e.$$.fragment, o), n = !0);
1674
1684
  },
1675
1685
  o(o) {
1676
- k(e.$$.fragment, o), n = !1;
1686
+ V(e.$$.fragment, o), n = !1;
1677
1687
  },
1678
1688
  d(o) {
1679
1689
  ut(e, o);
1680
1690
  }
1681
1691
  };
1682
1692
  }
1683
- function so(t, e, n) {
1693
+ function ho(t, e, n) {
1684
1694
  let o, r, { shape: i } = e, { computedStyle: a = void 0 } = e, { transform: s } = e, { viewportScale: l = 1 } = e;
1685
1695
  const d = (h, m, x) => {
1686
1696
  const A = h.geometry.bounds;
1687
- let [$, y] = [A.minX, A.minY], [v, E] = [A.maxX, A.maxY];
1688
- const [_, C] = x;
1689
- if (m === M.SHAPE)
1690
- $ += _, v += _, y += C, E += C;
1697
+ let [w, y] = [A.minX, A.minY], [E, v] = [A.maxX, A.maxY];
1698
+ const [B, R] = x;
1699
+ if (m === O.SHAPE)
1700
+ w += B, E += B, y += R, v += R;
1691
1701
  else {
1692
1702
  switch (m) {
1693
- case M.TOP:
1694
- case M.TOP_LEFT:
1695
- case M.TOP_RIGHT: {
1696
- y += C;
1703
+ case O.TOP:
1704
+ case O.TOP_LEFT:
1705
+ case O.TOP_RIGHT: {
1706
+ y += R;
1697
1707
  break;
1698
1708
  }
1699
- case M.BOTTOM:
1700
- case M.BOTTOM_LEFT:
1701
- case M.BOTTOM_RIGHT: {
1702
- E += C;
1709
+ case O.BOTTOM:
1710
+ case O.BOTTOM_LEFT:
1711
+ case O.BOTTOM_RIGHT: {
1712
+ v += R;
1703
1713
  break;
1704
1714
  }
1705
1715
  }
1706
1716
  switch (m) {
1707
- case M.LEFT:
1708
- case M.TOP_LEFT:
1709
- case M.BOTTOM_LEFT: {
1710
- $ += _;
1717
+ case O.LEFT:
1718
+ case O.TOP_LEFT:
1719
+ case O.BOTTOM_LEFT: {
1720
+ w += B;
1711
1721
  break;
1712
1722
  }
1713
- case M.RIGHT:
1714
- case M.TOP_RIGHT:
1715
- case M.BOTTOM_RIGHT: {
1716
- v += _;
1723
+ case O.RIGHT:
1724
+ case O.TOP_RIGHT:
1725
+ case O.BOTTOM_RIGHT: {
1726
+ E += B;
1717
1727
  break;
1718
1728
  }
1719
1729
  }
1720
1730
  }
1721
- const N = Math.min($, v), g = Math.min(y, E), b = Math.abs(v - $), w = Math.abs(E - y);
1731
+ const D = Math.min(w, E), f = Math.min(y, v), b = Math.abs(E - w), $ = Math.abs(v - y);
1722
1732
  return {
1723
1733
  ...h,
1724
1734
  geometry: {
1725
- x: N,
1726
- y: g,
1735
+ x: D,
1736
+ y: f,
1727
1737
  w: b,
1728
- h: w,
1738
+ h: $,
1729
1739
  bounds: {
1730
- minX: N,
1731
- minY: g,
1732
- maxX: N + b,
1733
- maxY: g + w
1740
+ minX: D,
1741
+ minY: f,
1742
+ maxX: D + b,
1743
+ maxY: f + $
1734
1744
  }
1735
1745
  }
1736
1746
  };
@@ -1741,7 +1751,7 @@ function so(t, e, n) {
1741
1751
  function c(h) {
1742
1752
  vt.call(this, t, h);
1743
1753
  }
1744
- function f(h) {
1754
+ function g(h) {
1745
1755
  vt.call(this, t, h);
1746
1756
  }
1747
1757
  return t.$$set = (h) => {
@@ -1760,12 +1770,12 @@ function so(t, e, n) {
1760
1770
  l,
1761
1771
  p,
1762
1772
  c,
1763
- f
1773
+ g
1764
1774
  ];
1765
1775
  }
1766
- class lo extends nt {
1776
+ class po extends nt {
1767
1777
  constructor(e) {
1768
- super(), et(this, e, so, ao, K, {
1778
+ super(), et(this, e, ho, uo, K, {
1769
1779
  shape: 0,
1770
1780
  computedStyle: 1,
1771
1781
  transform: 2,
@@ -1773,48 +1783,48 @@ class lo extends nt {
1773
1783
  });
1774
1784
  }
1775
1785
  }
1776
- const ze = /* @__PURE__ */ new Map([
1777
- [F.RECTANGLE, lo],
1778
- [F.POLYGON, ro]
1779
- ]), we = (t) => ze.get(t.type), co = (t, e) => ze.set(t, e), M = (t) => `HANDLE-${t}`;
1780
- M.SHAPE = "SHAPE";
1781
- M.TOP = "TOP";
1782
- M.RIGHT = "RIGHT";
1783
- M.BOTTOM = "BOTTOM";
1784
- M.LEFT = "LEFT";
1785
- M.TOP_LEFT = "TOP_LEFT";
1786
- M.TOP_RIGHT = "TOP_RIGHT";
1787
- M.BOTTOM_RIGHT = "BOTTOM_RIGHT";
1788
- M.BOTTOM_LEFT = "BOTTOM_LEFT";
1789
- const uo = (t) => ({}), xe = (t) => ({ grab: (
1786
+ const qe = /* @__PURE__ */ new Map([
1787
+ [F.RECTANGLE, po],
1788
+ [F.POLYGON, lo]
1789
+ ]), be = (t) => qe.get(t.type), go = (t, e) => qe.set(t, e), O = (t) => `HANDLE-${t}`;
1790
+ O.SHAPE = "SHAPE";
1791
+ O.TOP = "TOP";
1792
+ O.RIGHT = "RIGHT";
1793
+ O.BOTTOM = "BOTTOM";
1794
+ O.LEFT = "LEFT";
1795
+ O.TOP_LEFT = "TOP_LEFT";
1796
+ O.TOP_RIGHT = "TOP_RIGHT";
1797
+ O.BOTTOM_RIGHT = "BOTTOM_RIGHT";
1798
+ O.BOTTOM_LEFT = "BOTTOM_LEFT";
1799
+ const fo = (t) => ({}), Ee = (t) => ({ grab: (
1790
1800
  /*onGrab*/
1791
1801
  t[0]
1792
1802
  ) });
1793
- function ho(t) {
1803
+ function mo(t) {
1794
1804
  let e, n, o, r;
1795
1805
  const i = (
1796
1806
  /*#slots*/
1797
1807
  t[7].default
1798
- ), a = Qe(
1808
+ ), a = tn(
1799
1809
  i,
1800
1810
  t,
1801
1811
  /*$$scope*/
1802
1812
  t[6],
1803
- xe
1813
+ Ee
1804
1814
  );
1805
1815
  return {
1806
1816
  c() {
1807
- e = O("g"), a && a.c(), u(e, "class", "a9s-annotation selected");
1817
+ e = N("g"), a && a.c(), u(e, "class", "a9s-annotation selected");
1808
1818
  },
1809
1819
  m(s, l) {
1810
- B(s, e, l), a && a.m(e, null), n = !0, o || (r = [
1811
- R(
1820
+ Y(s, e, l), a && a.m(e, null), n = !0, o || (r = [
1821
+ z(
1812
1822
  e,
1813
1823
  "pointerup",
1814
1824
  /*onRelease*/
1815
1825
  t[2]
1816
1826
  ),
1817
- R(
1827
+ z(
1818
1828
  e,
1819
1829
  "pointermove",
1820
1830
  /*onPointerMove*/
@@ -1824,45 +1834,45 @@ function ho(t) {
1824
1834
  },
1825
1835
  p(s, [l]) {
1826
1836
  a && a.p && (!n || l & /*$$scope*/
1827
- 64) && tn(
1837
+ 64) && nn(
1828
1838
  a,
1829
1839
  i,
1830
1840
  s,
1831
1841
  /*$$scope*/
1832
1842
  s[6],
1833
- n ? Ze(
1843
+ n ? en(
1834
1844
  i,
1835
1845
  /*$$scope*/
1836
1846
  s[6],
1837
1847
  l,
1838
- uo
1839
- ) : en(
1848
+ fo
1849
+ ) : on(
1840
1850
  /*$$scope*/
1841
1851
  s[6]
1842
1852
  ),
1843
- xe
1853
+ Ee
1844
1854
  );
1845
1855
  },
1846
1856
  i(s) {
1847
- n || (V(a, s), n = !0);
1857
+ n || (k(a, s), n = !0);
1848
1858
  },
1849
1859
  o(s) {
1850
- k(a, s), n = !1;
1860
+ V(a, s), n = !1;
1851
1861
  },
1852
1862
  d(s) {
1853
1863
  s && L(e), a && a.d(s), o = !1, it(r);
1854
1864
  }
1855
1865
  };
1856
1866
  }
1857
- function po(t, e, n) {
1867
+ function yo(t, e, n) {
1858
1868
  let { $$slots: o = {}, $$scope: r } = e;
1859
- const i = At();
1869
+ const i = Tt();
1860
1870
  let { shape: a } = e, { editor: s } = e, { transform: l } = e, d = null, p, c = null;
1861
- const f = (x) => (A) => {
1871
+ const g = (x) => (A) => {
1862
1872
  d = x, p = l.elementToImage(A.offsetX, A.offsetY), c = a, A.target.setPointerCapture(A.pointerId), i("grab");
1863
1873
  }, h = (x) => {
1864
1874
  if (d) {
1865
- const [A, $] = l.elementToImage(x.offsetX, x.offsetY), y = [A - p[0], $ - p[1]];
1875
+ const [A, w] = l.elementToImage(x.offsetX, x.offsetY), y = [A - p[0], w - p[1]];
1866
1876
  n(3, a = s(c, d, y)), i("change", a);
1867
1877
  }
1868
1878
  }, m = (x) => {
@@ -1870,11 +1880,11 @@ function po(t, e, n) {
1870
1880
  };
1871
1881
  return t.$$set = (x) => {
1872
1882
  "shape" in x && n(3, a = x.shape), "editor" in x && n(4, s = x.editor), "transform" in x && n(5, l = x.transform), "$$scope" in x && n(6, r = x.$$scope);
1873
- }, [f, h, m, a, s, l, r, o];
1883
+ }, [g, h, m, a, s, l, r, o];
1874
1884
  }
1875
- class Re extends nt {
1885
+ class We extends nt {
1876
1886
  constructor(e) {
1877
- super(), et(this, e, po, ho, K, { shape: 3, editor: 4, transform: 5 });
1887
+ super(), et(this, e, yo, mo, K, { shape: 3, editor: 4, transform: 5 });
1878
1888
  }
1879
1889
  }
1880
1890
  const Ft = (t, e) => {
@@ -1885,11 +1895,11 @@ const Ft = (t, e) => {
1885
1895
  return o && (i += `fill:${o};stroke:${o};`), i += `fill-opacity:${r || "0.25"};`, i;
1886
1896
  }
1887
1897
  };
1888
- function fo(t, e, n) {
1898
+ function wo(t, e, n) {
1889
1899
  let o;
1890
- const r = At();
1900
+ const r = Tt();
1891
1901
  let { annotation: i } = e, { editor: a } = e, { style: s = void 0 } = e, { target: l } = e, { transform: d } = e, { viewportScale: p } = e, c;
1892
- return It(() => (n(6, c = new a({
1902
+ return Mt(() => (n(6, c = new a({
1893
1903
  target: l,
1894
1904
  props: {
1895
1905
  shape: i.target.selector,
@@ -1897,12 +1907,12 @@ function fo(t, e, n) {
1897
1907
  transform: d,
1898
1908
  viewportScale: p
1899
1909
  }
1900
- })), c.$on("change", (f) => {
1901
- c.$$set({ shape: f.detail }), r("change", f.detail);
1902
- }), c.$on("grab", (f) => r("grab", f.detail)), c.$on("release", (f) => r("release", f.detail)), () => {
1910
+ })), c.$on("change", (g) => {
1911
+ c.$$set({ shape: g.detail }), r("change", g.detail);
1912
+ }), c.$on("grab", (g) => r("grab", g.detail)), c.$on("release", (g) => r("release", g.detail)), () => {
1903
1913
  c.$destroy();
1904
- })), t.$$set = (f) => {
1905
- "annotation" in f && n(0, i = f.annotation), "editor" in f && n(1, a = f.editor), "style" in f && n(2, s = f.style), "target" in f && n(3, l = f.target), "transform" in f && n(4, d = f.transform), "viewportScale" in f && n(5, p = f.viewportScale);
1914
+ })), t.$$set = (g) => {
1915
+ "annotation" in g && n(0, i = g.annotation), "editor" in g && n(1, a = g.editor), "style" in g && n(2, s = g.style), "target" in g && n(3, l = g.target), "transform" in g && n(4, d = g.transform), "viewportScale" in g && n(5, p = g.viewportScale);
1906
1916
  }, t.$$.update = () => {
1907
1917
  t.$$.dirty & /*annotation, style*/
1908
1918
  5 && (o = Ft(i, s)), t.$$.dirty & /*annotation, editorComponent*/
@@ -1911,9 +1921,9 @@ function fo(t, e, n) {
1911
1921
  96 && c && c.$set({ viewportScale: p });
1912
1922
  }, [i, a, s, l, d, p, c];
1913
1923
  }
1914
- class go extends nt {
1924
+ class $o extends nt {
1915
1925
  constructor(e) {
1916
- super(), et(this, e, fo, null, K, {
1926
+ super(), et(this, e, wo, null, K, {
1917
1927
  annotation: 0,
1918
1928
  editor: 1,
1919
1929
  style: 2,
@@ -1923,17 +1933,17 @@ class go extends nt {
1923
1933
  });
1924
1934
  }
1925
1935
  }
1926
- function mo(t, e, n) {
1927
- const o = At();
1936
+ function xo(t, e, n) {
1937
+ const o = Tt();
1928
1938
  let { drawingMode: r } = e, { target: i } = e, { tool: a } = e, { transform: s } = e, { viewportScale: l } = e, d;
1929
- return It(() => {
1930
- const p = i.closest("svg"), c = [], f = (h, m, x) => {
1939
+ return Mt(() => {
1940
+ const p = i.closest("svg"), c = [], g = (h, m, x) => {
1931
1941
  p.addEventListener(h, m, x), c.push(() => p.removeEventListener(h, m, x));
1932
1942
  };
1933
1943
  return n(5, d = new a({
1934
1944
  target: i,
1935
1945
  props: {
1936
- addEventListener: f,
1946
+ addEventListener: g,
1937
1947
  drawingMode: r,
1938
1948
  transform: s,
1939
1949
  viewportScale: l
@@ -1949,9 +1959,9 @@ function mo(t, e, n) {
1949
1959
  48 && d && d.$set({ viewportScale: l });
1950
1960
  }, [r, i, a, s, l, d];
1951
1961
  }
1952
- class yo extends nt {
1962
+ class bo extends nt {
1953
1963
  constructor(e) {
1954
- super(), et(this, e, mo, null, K, {
1964
+ super(), et(this, e, xo, null, K, {
1955
1965
  drawingMode: 0,
1956
1966
  target: 1,
1957
1967
  tool: 2,
@@ -1960,11 +1970,11 @@ class yo extends nt {
1960
1970
  });
1961
1971
  }
1962
1972
  }
1963
- function be(t) {
1973
+ function ve(t) {
1964
1974
  let e, n;
1965
1975
  return {
1966
1976
  c() {
1967
- e = O("rect"), n = O("rect"), u(e, "class", "a9s-outer"), u(
1977
+ e = N("rect"), n = N("rect"), u(e, "class", "a9s-outer"), u(
1968
1978
  e,
1969
1979
  "x",
1970
1980
  /*x*/
@@ -2007,7 +2017,7 @@ function be(t) {
2007
2017
  );
2008
2018
  },
2009
2019
  m(o, r) {
2010
- B(o, e, r), B(o, n, r);
2020
+ Y(o, e, r), Y(o, n, r);
2011
2021
  },
2012
2022
  p(o, r) {
2013
2023
  r & /*x*/
@@ -2065,57 +2075,57 @@ function be(t) {
2065
2075
  }
2066
2076
  };
2067
2077
  }
2068
- function $o(t) {
2078
+ function Eo(t) {
2069
2079
  let e, n = (
2070
2080
  /*origin*/
2071
- t[0] && be(t)
2081
+ t[0] && ve(t)
2072
2082
  );
2073
2083
  return {
2074
2084
  c() {
2075
- e = O("g"), n && n.c(), u(e, "class", "a9s-annotation a9s-rubberband");
2085
+ e = N("g"), n && n.c(), u(e, "class", "a9s-annotation a9s-rubberband");
2076
2086
  },
2077
2087
  m(o, r) {
2078
- B(o, e, r), n && n.m(e, null);
2088
+ Y(o, e, r), n && n.m(e, null);
2079
2089
  },
2080
2090
  p(o, [r]) {
2081
- o[0] ? n ? n.p(o, r) : (n = be(o), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
2091
+ o[0] ? n ? n.p(o, r) : (n = ve(o), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
2082
2092
  },
2083
- i: U,
2084
- o: U,
2093
+ i: G,
2094
+ o: G,
2085
2095
  d(o) {
2086
2096
  o && L(e), n && n.d();
2087
2097
  }
2088
2098
  };
2089
2099
  }
2090
- function wo(t, e, n) {
2091
- const o = At();
2092
- let { addEventListener: r } = e, { drawingMode: i } = e, { transform: a } = e, s, l, d, p, c, f, h;
2100
+ function vo(t, e, n) {
2101
+ const o = Tt();
2102
+ let { addEventListener: r } = e, { drawingMode: i } = e, { transform: a } = e, s, l, d, p, c, g, h;
2093
2103
  const m = (y) => {
2094
- s = performance.now(), i === "drag" && (n(0, l = a.elementToImage(y.offsetX, y.offsetY)), d = l, n(1, p = l[0]), n(2, c = l[1]), n(3, f = 1), n(4, h = 1));
2104
+ s = performance.now(), i === "drag" && (n(0, l = a.elementToImage(y.offsetX, y.offsetY)), d = l, n(1, p = l[0]), n(2, c = l[1]), n(3, g = 1), n(4, h = 1));
2095
2105
  }, x = (y) => {
2096
- l && (d = a.elementToImage(y.offsetX, y.offsetY), n(1, p = Math.min(d[0], l[0])), n(2, c = Math.min(d[1], l[1])), n(3, f = Math.abs(d[0] - l[0])), n(4, h = Math.abs(d[1] - l[1])));
2106
+ l && (d = a.elementToImage(y.offsetX, y.offsetY), n(1, p = 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, h = Math.abs(d[1] - l[1])));
2097
2107
  }, A = (y) => {
2098
- const v = performance.now() - s;
2108
+ const E = performance.now() - s;
2099
2109
  if (i === "click") {
2100
- if (v > 300)
2110
+ if (E > 300)
2101
2111
  return;
2102
- y.stopPropagation(), l ? $() : (n(0, l = a.elementToImage(y.offsetX, y.offsetY)), d = l, n(1, p = l[0]), n(2, c = l[1]), n(3, f = 1), n(4, h = 1));
2112
+ y.stopPropagation(), l ? w() : (n(0, l = a.elementToImage(y.offsetX, y.offsetY)), d = l, n(1, p = l[0]), n(2, c = l[1]), n(3, g = 1), n(4, h = 1));
2103
2113
  } else
2104
- l && (v > 300 || f * h > 100 ? (y.stopPropagation(), $()) : (n(0, l = null), d = null));
2105
- }, $ = () => {
2106
- if (f * h > 15) {
2114
+ l && (E > 300 || g * h > 100 ? (y.stopPropagation(), w()) : (n(0, l = null), d = null));
2115
+ }, w = () => {
2116
+ if (g * h > 15) {
2107
2117
  const y = {
2108
2118
  type: F.RECTANGLE,
2109
2119
  geometry: {
2110
2120
  bounds: {
2111
2121
  minX: p,
2112
2122
  minY: c,
2113
- maxX: p + f,
2123
+ maxX: p + g,
2114
2124
  maxY: c + h
2115
2125
  },
2116
2126
  x: p,
2117
2127
  y: c,
2118
- w: f,
2128
+ w: g,
2119
2129
  h
2120
2130
  }
2121
2131
  };
@@ -2123,25 +2133,52 @@ function wo(t, e, n) {
2123
2133
  }
2124
2134
  n(0, l = null), d = null;
2125
2135
  };
2126
- return It(() => {
2136
+ return Mt(() => {
2127
2137
  r("pointerdown", m), r("pointermove", x), r("pointerup", A, !0);
2128
2138
  }), t.$$set = (y) => {
2129
2139
  "addEventListener" in y && n(5, r = y.addEventListener), "drawingMode" in y && n(6, i = y.drawingMode), "transform" in y && n(7, a = y.transform);
2130
- }, [l, p, c, f, h, r, i, a];
2140
+ }, [l, p, c, g, h, r, i, a];
2131
2141
  }
2132
- class xo extends nt {
2142
+ class Ao extends nt {
2133
2143
  constructor(e) {
2134
- super(), et(this, e, wo, $o, K, {
2144
+ super(), et(this, e, vo, Eo, K, {
2135
2145
  addEventListener: 5,
2136
2146
  drawingMode: 6,
2137
2147
  transform: 7
2138
2148
  });
2139
2149
  }
2140
2150
  }
2141
- const Wt = (t, e) => {
2151
+ const Kt = (t, e) => {
2142
2152
  const n = Math.abs(e[0] - t[0]), o = Math.abs(e[1] - t[1]);
2143
2153
  return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
2144
- }, bo = (t, e) => {
2154
+ }, $t = [];
2155
+ function To(t, e = G) {
2156
+ let n;
2157
+ const o = /* @__PURE__ */ new Set();
2158
+ function r(s) {
2159
+ if (K(t, s) && (t = s, n)) {
2160
+ const l = !$t.length;
2161
+ for (const d of o)
2162
+ d[1](), $t.push(d, t);
2163
+ if (l) {
2164
+ for (let d = 0; d < $t.length; d += 2)
2165
+ $t[d][0]($t[d + 1]);
2166
+ $t.length = 0;
2167
+ }
2168
+ }
2169
+ }
2170
+ function i(s) {
2171
+ r(s(t));
2172
+ }
2173
+ function a(s, l = G) {
2174
+ const d = [s, l];
2175
+ return o.add(d), o.size === 1 && (n = e(r) || G), s(t), () => {
2176
+ o.delete(d), o.size === 0 && n && (n(), n = null);
2177
+ };
2178
+ }
2179
+ return { set: r, update: i, subscribe: a };
2180
+ }
2181
+ const So = (t, e) => {
2145
2182
  const { naturalWidth: n, naturalHeight: o } = t;
2146
2183
  if (!n && !o) {
2147
2184
  const { width: r, height: i } = t;
@@ -2151,9 +2188,9 @@ const Wt = (t, e) => {
2151
2188
  });
2152
2189
  } else
2153
2190
  e.setAttribute("viewBox", `0 0 ${n} ${o}`);
2154
- }, vo = (t, e) => {
2155
- bo(t, e);
2156
- const { subscribe: n, set: o } = Ut(1);
2191
+ }, Oo = (t, e) => {
2192
+ So(t, e);
2193
+ const { subscribe: n, set: o } = To(1);
2157
2194
  let r;
2158
2195
  return window.ResizeObserver && (r = new ResizeObserver(() => {
2159
2196
  const i = e.getBoundingClientRect(), { width: a, height: s } = e.viewBox.baseVal, l = Math.max(
@@ -2165,7 +2202,7 @@ const Wt = (t, e) => {
2165
2202
  r && r.disconnect();
2166
2203
  }, subscribe: n };
2167
2204
  };
2168
- function Kt(t) {
2205
+ function Jt(t) {
2169
2206
  const e = t.slice(), n = (
2170
2207
  /*isClosable*/
2171
2208
  (e[2] ? (
@@ -2180,19 +2217,19 @@ function Kt(t) {
2180
2217
  );
2181
2218
  return e[15] = n, e;
2182
2219
  }
2183
- function ve(t) {
2220
+ function Ae(t) {
2184
2221
  let e, n, o, r, i, a = (
2185
2222
  /*isClosable*/
2186
- t[2] && Ee(t)
2223
+ t[2] && Te(t)
2187
2224
  );
2188
2225
  return {
2189
2226
  c() {
2190
- e = O("polygon"), o = O("polygon"), a && a.c(), i = at(), u(e, "class", "a9s-outer"), u(e, "points", n = /*coords*/
2227
+ e = N("polygon"), o = N("polygon"), a && a.c(), i = at(), u(e, "class", "a9s-outer"), u(e, "points", n = /*coords*/
2191
2228
  t[15]), u(o, "class", "a9s-inner"), u(o, "points", r = /*coords*/
2192
2229
  t[15]);
2193
2230
  },
2194
2231
  m(s, l) {
2195
- B(s, e, l), B(s, o, l), a && a.m(s, l), B(s, i, l);
2232
+ Y(s, e, l), Y(s, o, l), a && a.m(s, l), Y(s, i, l);
2196
2233
  },
2197
2234
  p(s, l) {
2198
2235
  l & /*isClosable, points, cursor*/
@@ -2200,18 +2237,18 @@ function ve(t) {
2200
2237
  s[15]) && u(e, "points", n), l & /*isClosable, points, cursor*/
2201
2238
  7 && r !== (r = /*coords*/
2202
2239
  s[15]) && u(o, "points", r), /*isClosable*/
2203
- s[2] ? a ? a.p(s, l) : (a = Ee(s), a.c(), a.m(i.parentNode, i)) : a && (a.d(1), a = null);
2240
+ s[2] ? a ? a.p(s, l) : (a = Te(s), a.c(), a.m(i.parentNode, i)) : a && (a.d(1), a = null);
2204
2241
  },
2205
2242
  d(s) {
2206
2243
  s && L(e), s && L(o), a && a.d(s), s && L(i);
2207
2244
  }
2208
2245
  };
2209
2246
  }
2210
- function Ee(t) {
2247
+ function Te(t) {
2211
2248
  let e, n, o;
2212
2249
  return {
2213
2250
  c() {
2214
- e = O("rect"), u(e, "class", "a9s-corner-handle"), u(e, "x", n = /*points*/
2251
+ e = N("rect"), u(e, "class", "a9s-corner-handle"), u(e, "x", n = /*points*/
2215
2252
  t[0][0][0] - /*handleSize*/
2216
2253
  t[3] / 2), u(e, "y", o = /*points*/
2217
2254
  t[0][0][1] - /*handleSize*/
@@ -2228,7 +2265,7 @@ function Ee(t) {
2228
2265
  );
2229
2266
  },
2230
2267
  m(r, i) {
2231
- B(r, e, i);
2268
+ Y(r, e, i);
2232
2269
  },
2233
2270
  p(r, i) {
2234
2271
  i & /*points, handleSize*/
@@ -2256,70 +2293,70 @@ function Ee(t) {
2256
2293
  }
2257
2294
  };
2258
2295
  }
2259
- function Eo(t) {
2296
+ function Lo(t) {
2260
2297
  let e, n = (
2261
2298
  /*cursor*/
2262
- t[1] && ve(Kt(t))
2299
+ t[1] && Ae(Jt(t))
2263
2300
  );
2264
2301
  return {
2265
2302
  c() {
2266
- e = O("g"), n && n.c(), u(e, "class", "a9s-annotation a9s-rubberband");
2303
+ e = N("g"), n && n.c(), u(e, "class", "a9s-annotation a9s-rubberband");
2267
2304
  },
2268
2305
  m(o, r) {
2269
- B(o, e, r), n && n.m(e, null);
2306
+ Y(o, e, r), n && n.m(e, null);
2270
2307
  },
2271
2308
  p(o, [r]) {
2272
- o[1] ? n ? n.p(Kt(o), r) : (n = ve(Kt(o)), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
2309
+ o[1] ? n ? n.p(Jt(o), r) : (n = Ae(Jt(o)), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
2273
2310
  },
2274
- i: U,
2275
- o: U,
2311
+ i: G,
2312
+ o: G,
2276
2313
  d(o) {
2277
2314
  o && L(e), n && n.d();
2278
2315
  }
2279
2316
  };
2280
2317
  }
2281
- const Ao = 20;
2282
- function To(t, e, n) {
2318
+ const Yo = 20;
2319
+ function _o(t, e, n) {
2283
2320
  let o;
2284
- const r = At();
2285
- let { addEventListener: i } = e, { drawingMode: a } = e, { transform: s } = e, { viewportScale: l = 1 } = e, d, p = [], c = null, f = !1;
2321
+ const r = Tt();
2322
+ let { addEventListener: i } = e, { drawingMode: a } = e, { transform: s } = e, { viewportScale: l = 1 } = e, d, p = [], c = null, g = !1;
2286
2323
  const h = (y) => {
2287
- const { timeStamp: v, offsetX: E, offsetY: _ } = y;
2288
- if (d = { timeStamp: v, offsetX: E, offsetY: _ }, a === "drag" && p.length === 0) {
2289
- const C = s.elementToImage(y.offsetX, y.offsetY);
2290
- p.push(C), n(1, c = C);
2324
+ const { timeStamp: E, offsetX: v, offsetY: B } = y;
2325
+ if (d = { timeStamp: E, offsetX: v, offsetY: B }, a === "drag" && p.length === 0) {
2326
+ const R = s.elementToImage(y.offsetX, y.offsetY);
2327
+ p.push(R), n(1, c = R);
2291
2328
  }
2292
2329
  }, m = (y) => {
2293
2330
  if (p.length > 0 && (n(1, c = s.elementToImage(y.offsetX, y.offsetY)), p.length > 2)) {
2294
- const v = Wt(c, p[0]) * l;
2295
- n(2, f = v < Ao);
2331
+ const E = Kt(c, p[0]) * l;
2332
+ n(2, g = E < Yo);
2296
2333
  }
2297
2334
  }, x = (y) => {
2298
2335
  if (a === "click") {
2299
- const v = y.timeStamp - d.timeStamp, E = Wt([d.offsetX, d.offsetY], [y.offsetX, y.offsetY]);
2300
- if (v > 300 || E > 15)
2336
+ const E = y.timeStamp - d.timeStamp, v = Kt([d.offsetX, d.offsetY], [y.offsetX, y.offsetY]);
2337
+ if (E > 300 || v > 15)
2301
2338
  return;
2302
- if (f)
2303
- $();
2339
+ if (g)
2340
+ w();
2304
2341
  else if (p.length === 0) {
2305
- const _ = s.elementToImage(y.offsetX, y.offsetY);
2306
- p.push(_), n(1, c = _);
2342
+ const B = s.elementToImage(y.offsetX, y.offsetY);
2343
+ p.push(B), n(1, c = B);
2307
2344
  } else
2308
2345
  p.push(c);
2309
2346
  } else {
2310
- if (p.length === 1 && Wt(p[0], c) <= 4) {
2347
+ if (p.length === 1 && Kt(p[0], c) <= 4) {
2311
2348
  n(0, p = []), n(1, c = null);
2312
2349
  return;
2313
2350
  }
2314
- y.stopImmediatePropagation(), f ? $() : p.push(c);
2351
+ y.stopImmediatePropagation(), g ? w() : p.push(c);
2315
2352
  }
2316
2353
  }, A = () => {
2317
- const y = [...p, c], v = {
2354
+ const y = [...p, c], E = {
2318
2355
  type: F.POLYGON,
2319
2356
  geometry: { bounds: Gt(y), points: y }
2320
2357
  };
2321
- ne(v) > 4 && (n(0, p = []), n(1, c = null), r("create", v));
2322
- }, $ = () => {
2358
+ oe(E) > 4 && (n(0, p = []), n(1, c = null), r("create", E));
2359
+ }, w = () => {
2323
2360
  const y = {
2324
2361
  type: F.POLYGON,
2325
2362
  geometry: {
@@ -2329,7 +2366,7 @@ function To(t, e, n) {
2329
2366
  };
2330
2367
  n(0, p = []), n(1, c = null), r("create", y);
2331
2368
  };
2332
- return It(() => {
2369
+ return Mt(() => {
2333
2370
  i("pointerdown", h, !0), i("pointermove", m), i("pointerup", x, !0), i("dblclick", A, !0);
2334
2371
  }), t.$$set = (y) => {
2335
2372
  "addEventListener" in y && n(4, i = y.addEventListener), "drawingMode" in y && n(5, a = y.drawingMode), "transform" in y && n(6, s = y.transform), "viewportScale" in y && n(7, l = y.viewportScale);
@@ -2339,7 +2376,7 @@ function To(t, e, n) {
2339
2376
  }, [
2340
2377
  p,
2341
2378
  c,
2342
- f,
2379
+ g,
2343
2380
  o,
2344
2381
  i,
2345
2382
  a,
@@ -2347,9 +2384,9 @@ function To(t, e, n) {
2347
2384
  l
2348
2385
  ];
2349
2386
  }
2350
- class So extends nt {
2387
+ class Io extends nt {
2351
2388
  constructor(e) {
2352
- super(), et(this, e, To, Eo, K, {
2389
+ super(), et(this, e, _o, Lo, K, {
2353
2390
  addEventListener: 4,
2354
2391
  drawingMode: 5,
2355
2392
  transform: 6,
@@ -2357,15 +2394,15 @@ class So extends nt {
2357
2394
  });
2358
2395
  }
2359
2396
  }
2360
- const ae = /* @__PURE__ */ new Map([
2361
- ["rectangle", { tool: xo }],
2362
- ["polygon", { tool: So }]
2363
- ]), Mo = () => [...ae.keys()], qe = (t) => ae.get(t), Lo = (t, e, n) => ae.set(t, { tool: e, opts: n });
2364
- function Bo(t) {
2397
+ const le = /* @__PURE__ */ new Map([
2398
+ ["rectangle", { tool: Ao }],
2399
+ ["polygon", { tool: Io }]
2400
+ ]), Mo = () => [...le.keys()], Ke = (t) => le.get(t), Bo = (t, e, n) => le.set(t, { tool: e, opts: n });
2401
+ function Xo(t) {
2365
2402
  let e, n, o, r, i;
2366
2403
  return {
2367
2404
  c() {
2368
- e = O("g"), n = O("ellipse"), r = O("ellipse"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2405
+ e = N("g"), n = N("ellipse"), r = N("ellipse"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2369
2406
  t[1] ? "display:none;" : void 0), u(
2370
2407
  n,
2371
2408
  "cx",
@@ -2415,7 +2452,7 @@ function Bo(t) {
2415
2452
  t[0].id);
2416
2453
  },
2417
2454
  m(a, s) {
2418
- B(a, e, s), dt(e, n), dt(e, r);
2455
+ Y(a, e, s), dt(e, n), dt(e, r);
2419
2456
  },
2420
2457
  p(a, [s]) {
2421
2458
  s & /*computedStyle*/
@@ -2430,14 +2467,14 @@ function Bo(t) {
2430
2467
  1 && i !== (i = /*annotation*/
2431
2468
  a[0].id) && u(e, "data-id", i);
2432
2469
  },
2433
- i: U,
2434
- o: U,
2470
+ i: G,
2471
+ o: G,
2435
2472
  d(a) {
2436
2473
  a && L(e);
2437
2474
  }
2438
2475
  };
2439
2476
  }
2440
- function Xo(t, e, n) {
2477
+ function Ro(t, e, n) {
2441
2478
  let o, { annotation: r } = e, { geom: i } = e, { style: a = void 0 } = e;
2442
2479
  const { cx: s, cy: l, rx: d, ry: p } = i;
2443
2480
  return t.$$set = (c) => {
@@ -2447,21 +2484,21 @@ function Xo(t, e, n) {
2447
2484
  129 && n(1, o = Ft(r, a));
2448
2485
  }, [r, o, s, l, d, p, i, a];
2449
2486
  }
2450
- class Io extends nt {
2487
+ class No extends nt {
2451
2488
  constructor(e) {
2452
- super(), et(this, e, Xo, Bo, K, { annotation: 0, geom: 6, style: 7 });
2489
+ super(), et(this, e, Ro, Xo, K, { annotation: 0, geom: 6, style: 7 });
2453
2490
  }
2454
2491
  }
2455
- function Yo(t) {
2492
+ function ko(t) {
2456
2493
  let e, n, o, r, i;
2457
2494
  return {
2458
2495
  c() {
2459
- e = O("g"), n = O("polygon"), r = O("polygon"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2496
+ e = N("g"), n = N("polygon"), r = N("polygon"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2460
2497
  t[1] ? "display:none;" : void 0), u(
2461
2498
  n,
2462
2499
  "points",
2463
2500
  /*points*/
2464
- t[2].map(_o).join(" ")
2501
+ t[2].map(Vo).join(" ")
2465
2502
  ), u(r, "class", "a9s-inner"), u(
2466
2503
  r,
2467
2504
  "style",
@@ -2471,12 +2508,12 @@ function Yo(t) {
2471
2508
  r,
2472
2509
  "points",
2473
2510
  /*points*/
2474
- t[2].map(Co).join(" ")
2511
+ t[2].map(Do).join(" ")
2475
2512
  ), u(e, "data-id", i = /*annotation*/
2476
2513
  t[0].id);
2477
2514
  },
2478
2515
  m(a, s) {
2479
- B(a, e, s), dt(e, n), dt(e, r);
2516
+ Y(a, e, s), dt(e, n), dt(e, r);
2480
2517
  },
2481
2518
  p(a, [s]) {
2482
2519
  s & /*computedStyle*/
@@ -2491,15 +2528,15 @@ function Yo(t) {
2491
2528
  1 && i !== (i = /*annotation*/
2492
2529
  a[0].id) && u(e, "data-id", i);
2493
2530
  },
2494
- i: U,
2495
- o: U,
2531
+ i: G,
2532
+ o: G,
2496
2533
  d(a) {
2497
2534
  a && L(e);
2498
2535
  }
2499
2536
  };
2500
2537
  }
2501
- const _o = (t) => t.join(","), Co = (t) => t.join(",");
2502
- function Po(t, e, n) {
2538
+ const Vo = (t) => t.join(","), Do = (t) => t.join(",");
2539
+ function Co(t, e, n) {
2503
2540
  let o, { annotation: r } = e, { geom: i } = e, { style: a = void 0 } = e;
2504
2541
  const { points: s } = i;
2505
2542
  return t.$$set = (l) => {
@@ -2509,16 +2546,16 @@ function Po(t, e, n) {
2509
2546
  17 && n(1, o = Ft(r, a));
2510
2547
  }, [r, o, s, i, a];
2511
2548
  }
2512
- class Oo extends nt {
2549
+ class Uo extends nt {
2513
2550
  constructor(e) {
2514
- super(), et(this, e, Po, Yo, K, { annotation: 0, geom: 3, style: 4 });
2551
+ super(), et(this, e, Co, ko, K, { annotation: 0, geom: 3, style: 4 });
2515
2552
  }
2516
2553
  }
2517
- function Vo(t) {
2554
+ function Go(t) {
2518
2555
  let e, n, o, r, i;
2519
2556
  return {
2520
2557
  c() {
2521
- e = O("g"), n = O("rect"), r = O("rect"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2558
+ e = N("g"), n = N("rect"), r = N("rect"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
2522
2559
  t[5] ? "display:none;" : void 0), u(
2523
2560
  n,
2524
2561
  "x",
@@ -2568,7 +2605,7 @@ function Vo(t) {
2568
2605
  t[0].id);
2569
2606
  },
2570
2607
  m(a, s) {
2571
- B(a, e, s), dt(e, n), dt(e, r);
2608
+ Y(a, e, s), dt(e, n), dt(e, r);
2572
2609
  },
2573
2610
  p(a, [s]) {
2574
2611
  s & /*computedStyle*/
@@ -2631,14 +2668,14 @@ function Vo(t) {
2631
2668
  1 && i !== (i = /*annotation*/
2632
2669
  a[0].id) && u(e, "data-id", i);
2633
2670
  },
2634
- i: U,
2635
- o: U,
2671
+ i: G,
2672
+ o: G,
2636
2673
  d(a) {
2637
2674
  a && L(e);
2638
2675
  }
2639
2676
  };
2640
2677
  }
2641
- function ko(t, e, n) {
2678
+ function Fo(t, e, n) {
2642
2679
  let o, r, i, a, s, { annotation: l } = e, { geom: d } = e, { style: p = void 0 } = e;
2643
2680
  return t.$$set = (c) => {
2644
2681
  "annotation" in c && n(0, l = c.annotation), "geom" in c && n(6, d = c.geom), "style" in c && n(7, p = c.style);
@@ -2648,77 +2685,77 @@ function ko(t, e, n) {
2648
2685
  64 && n(4, { x: r, y: i, w: a, h: s } = d, r, (n(3, i), n(6, d)), (n(2, a), n(6, d)), (n(1, s), n(6, d)));
2649
2686
  }, [l, s, a, i, r, o, d, p];
2650
2687
  }
2651
- class No extends nt {
2688
+ class Ho extends nt {
2652
2689
  constructor(e) {
2653
- super(), et(this, e, ko, Vo, K, { annotation: 0, geom: 6, style: 7 });
2690
+ super(), et(this, e, Fo, Go, K, { annotation: 0, geom: 6, style: 7 });
2654
2691
  }
2655
2692
  }
2656
- const Do = (t) => ({
2693
+ const jo = (t) => ({
2657
2694
  elementToImage: (e, n) => {
2658
2695
  const o = t.getBoundingClientRect(), r = t.createSVGPoint();
2659
2696
  r.x = e + o.x, r.y = n + o.y;
2660
2697
  const { x: i, y: a } = r.matrixTransform(t.getScreenCTM().inverse());
2661
2698
  return [i, a];
2662
2699
  }
2663
- }), Go = 250, Uo = (t, e) => {
2664
- const n = At();
2700
+ }), Po = 250, zo = (t, e) => {
2701
+ const n = Tt();
2665
2702
  let o;
2666
2703
  return { onPointerDown: () => o = performance.now(), onPointerUp: (r) => {
2667
- if (performance.now() - o < Go) {
2668
- const { x: i, y: a } = Fo(r, t), s = e.getAt(i, a);
2704
+ if (performance.now() - o < Po) {
2705
+ const { x: i, y: a } = qo(r, t), s = e.getAt(i, a);
2669
2706
  s ? n("click", { originalEvent: r, annotation: s }) : n("click", { originalEvent: r });
2670
2707
  }
2671
2708
  } };
2672
- }, Fo = (t, e) => {
2709
+ }, qo = (t, e) => {
2673
2710
  const n = e.createSVGPoint(), o = e.getBoundingClientRect(), r = t.clientX - o.x, i = t.clientY - o.y, { left: a, top: s } = e.getBoundingClientRect();
2674
2711
  return n.x = r + a, n.y = i + s, n.matrixTransform(e.getScreenCTM().inverse());
2675
2712
  };
2676
- function Ae(t, e, n) {
2713
+ function Se(t, e, n) {
2677
2714
  const o = t.slice();
2678
2715
  return o[28] = e[n], o;
2679
2716
  }
2680
- function Te(t, e, n) {
2717
+ function Oe(t, e, n) {
2681
2718
  const o = t.slice();
2682
2719
  return o[31] = e[n], o;
2683
2720
  }
2684
- function Jt(t) {
2721
+ function Qt(t) {
2685
2722
  const e = t.slice(), n = (
2686
2723
  /*annotation*/
2687
2724
  e[31].target.selector
2688
2725
  );
2689
2726
  return e[34] = n, e;
2690
2727
  }
2691
- function Se(t) {
2728
+ function Le(t) {
2692
2729
  let e = (
2693
2730
  /*annotation*/
2694
2731
  t[31].id
2695
- ), n, o, r = Me(t);
2732
+ ), n, o, r = Ye(t);
2696
2733
  return {
2697
2734
  c() {
2698
2735
  r.c(), n = at();
2699
2736
  },
2700
2737
  m(i, a) {
2701
- r.m(i, a), B(i, n, a), o = !0;
2738
+ r.m(i, a), Y(i, n, a), o = !0;
2702
2739
  },
2703
2740
  p(i, a) {
2704
2741
  a[0] & /*$store*/
2705
2742
  4096 && K(e, e = /*annotation*/
2706
- i[31].id) ? (ot(), k(r, 1, 1, U), rt(), r = Me(i), r.c(), V(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
2743
+ i[31].id) ? (ot(), V(r, 1, 1, G), rt(), r = Ye(i), r.c(), k(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
2707
2744
  },
2708
2745
  i(i) {
2709
- o || (V(r), o = !0);
2746
+ o || (k(r), o = !0);
2710
2747
  },
2711
2748
  o(i) {
2712
- k(r), o = !1;
2749
+ V(r), o = !1;
2713
2750
  },
2714
2751
  d(i) {
2715
2752
  i && L(n), r.d(i);
2716
2753
  }
2717
2754
  };
2718
2755
  }
2719
- function Ho(t) {
2756
+ function Wo(t) {
2720
2757
  let e, n;
2721
- return e = new Oo({
2758
+ return e = new Uo({
2722
2759
  props: {
2723
2760
  annotation: (
2724
2761
  /*annotation*/
@@ -2735,7 +2772,7 @@ function Ho(t) {
2735
2772
  }
2736
2773
  }), {
2737
2774
  c() {
2738
- ft(e.$$.fragment);
2775
+ gt(e.$$.fragment);
2739
2776
  },
2740
2777
  m(o, r) {
2741
2778
  ct(e, o, r), n = !0;
@@ -2751,19 +2788,19 @@ function Ho(t) {
2751
2788
  o[1]), e.$set(i);
2752
2789
  },
2753
2790
  i(o) {
2754
- n || (V(e.$$.fragment, o), n = !0);
2791
+ n || (k(e.$$.fragment, o), n = !0);
2755
2792
  },
2756
2793
  o(o) {
2757
- k(e.$$.fragment, o), n = !1;
2794
+ V(e.$$.fragment, o), n = !1;
2758
2795
  },
2759
2796
  d(o) {
2760
2797
  ut(e, o);
2761
2798
  }
2762
2799
  };
2763
2800
  }
2764
- function jo(t) {
2801
+ function Ko(t) {
2765
2802
  let e, n;
2766
- return e = new No({
2803
+ return e = new Ho({
2767
2804
  props: {
2768
2805
  annotation: (
2769
2806
  /*annotation*/
@@ -2780,7 +2817,7 @@ function jo(t) {
2780
2817
  }
2781
2818
  }), {
2782
2819
  c() {
2783
- ft(e.$$.fragment);
2820
+ gt(e.$$.fragment);
2784
2821
  },
2785
2822
  m(o, r) {
2786
2823
  ct(e, o, r), n = !0;
@@ -2796,19 +2833,19 @@ function jo(t) {
2796
2833
  o[1]), e.$set(i);
2797
2834
  },
2798
2835
  i(o) {
2799
- n || (V(e.$$.fragment, o), n = !0);
2836
+ n || (k(e.$$.fragment, o), n = !0);
2800
2837
  },
2801
2838
  o(o) {
2802
- k(e.$$.fragment, o), n = !1;
2839
+ V(e.$$.fragment, o), n = !1;
2803
2840
  },
2804
2841
  d(o) {
2805
2842
  ut(e, o);
2806
2843
  }
2807
2844
  };
2808
2845
  }
2809
- function zo(t) {
2846
+ function Jo(t) {
2810
2847
  let e, n;
2811
- return e = new Io({
2848
+ return e = new No({
2812
2849
  props: {
2813
2850
  annotation: (
2814
2851
  /*annotation*/
@@ -2825,7 +2862,7 @@ function zo(t) {
2825
2862
  }
2826
2863
  }), {
2827
2864
  c() {
2828
- ft(e.$$.fragment);
2865
+ gt(e.$$.fragment);
2829
2866
  },
2830
2867
  m(o, r) {
2831
2868
  ct(e, o, r), n = !0;
@@ -2841,19 +2878,19 @@ function zo(t) {
2841
2878
  o[1]), e.$set(i);
2842
2879
  },
2843
2880
  i(o) {
2844
- n || (V(e.$$.fragment, o), n = !0);
2881
+ n || (k(e.$$.fragment, o), n = !0);
2845
2882
  },
2846
2883
  o(o) {
2847
- k(e.$$.fragment, o), n = !1;
2884
+ V(e.$$.fragment, o), n = !1;
2848
2885
  },
2849
2886
  d(o) {
2850
2887
  ut(e, o);
2851
2888
  }
2852
2889
  };
2853
2890
  }
2854
- function Me(t) {
2891
+ function Ye(t) {
2855
2892
  let e, n, o, r;
2856
- const i = [zo, jo, Ho], a = [];
2893
+ const i = [Jo, Ko, Wo], a = [];
2857
2894
  function s(l, d) {
2858
2895
  return (
2859
2896
  /*selector*/
@@ -2871,37 +2908,37 @@ function Me(t) {
2871
2908
  n && n.c(), o = at();
2872
2909
  },
2873
2910
  m(l, d) {
2874
- ~e && a[e].m(l, d), B(l, o, d), r = !0;
2911
+ ~e && a[e].m(l, d), Y(l, o, d), r = !0;
2875
2912
  },
2876
2913
  p(l, d) {
2877
2914
  let p = e;
2878
- e = s(l), e === p ? ~e && a[e].p(l, d) : (n && (ot(), k(a[p], 1, 1, () => {
2915
+ e = s(l), e === p ? ~e && a[e].p(l, d) : (n && (ot(), V(a[p], 1, 1, () => {
2879
2916
  a[p] = null;
2880
- }), rt()), ~e ? (n = a[e], n ? n.p(l, d) : (n = a[e] = i[e](l), n.c()), V(n, 1), n.m(o.parentNode, o)) : n = null);
2917
+ }), rt()), ~e ? (n = a[e], n ? n.p(l, d) : (n = a[e] = i[e](l), n.c()), k(n, 1), n.m(o.parentNode, o)) : n = null);
2881
2918
  },
2882
2919
  i(l) {
2883
- r || (V(n), r = !0);
2920
+ r || (k(n), r = !0);
2884
2921
  },
2885
2922
  o(l) {
2886
- k(n), r = !1;
2923
+ V(n), r = !1;
2887
2924
  },
2888
2925
  d(l) {
2889
2926
  ~e && a[e].d(l), l && L(o);
2890
2927
  }
2891
2928
  };
2892
2929
  }
2893
- function Le(t) {
2930
+ function _e(t) {
2894
2931
  let e = !/*isEditable*/
2895
2932
  t[7](
2896
2933
  /*annotation*/
2897
2934
  t[31]
2898
- ), n, o, r = e && Se(Jt(t));
2935
+ ), n, o, r = e && Le(Qt(t));
2899
2936
  return {
2900
2937
  c() {
2901
2938
  r && r.c(), n = at();
2902
2939
  },
2903
2940
  m(i, a) {
2904
- r && r.m(i, a), B(i, n, a), o = !0;
2941
+ r && r.m(i, a), Y(i, n, a), o = !0;
2905
2942
  },
2906
2943
  p(i, a) {
2907
2944
  a[0] & /*isEditable, $store*/
@@ -2909,25 +2946,25 @@ function Le(t) {
2909
2946
  i[7](
2910
2947
  /*annotation*/
2911
2948
  i[31]
2912
- )), e ? r ? (r.p(Jt(i), a), a[0] & /*isEditable, $store*/
2913
- 4224 && V(r, 1)) : (r = Se(Jt(i)), r.c(), V(r, 1), r.m(n.parentNode, n)) : r && (ot(), k(r, 1, 1, () => {
2949
+ )), e ? r ? (r.p(Qt(i), a), a[0] & /*isEditable, $store*/
2950
+ 4224 && k(r, 1)) : (r = Le(Qt(i)), r.c(), k(r, 1), r.m(n.parentNode, n)) : r && (ot(), V(r, 1, 1, () => {
2914
2951
  r = null;
2915
2952
  }), rt());
2916
2953
  },
2917
2954
  i(i) {
2918
- o || (V(r), o = !0);
2955
+ o || (k(r), o = !0);
2919
2956
  },
2920
2957
  o(i) {
2921
- k(r), o = !1;
2958
+ V(r), o = !1;
2922
2959
  },
2923
2960
  d(i) {
2924
2961
  r && r.d(i), i && L(n);
2925
2962
  }
2926
2963
  };
2927
2964
  }
2928
- function Be(t) {
2965
+ function Ie(t) {
2929
2966
  let e, n, o, r;
2930
- const i = [qo, Ro], a = [];
2967
+ const i = [Zo, Qo], a = [];
2931
2968
  function s(l, d) {
2932
2969
  return (
2933
2970
  /*editableAnnotations*/
@@ -2943,61 +2980,61 @@ function Be(t) {
2943
2980
  n && n.c(), o = at();
2944
2981
  },
2945
2982
  m(l, d) {
2946
- ~e && a[e].m(l, d), B(l, o, d), r = !0;
2983
+ ~e && a[e].m(l, d), Y(l, o, d), r = !0;
2947
2984
  },
2948
2985
  p(l, d) {
2949
2986
  let p = e;
2950
- e = s(l), e === p ? ~e && a[e].p(l, d) : (n && (ot(), k(a[p], 1, 1, () => {
2987
+ e = s(l), e === p ? ~e && a[e].p(l, d) : (n && (ot(), V(a[p], 1, 1, () => {
2951
2988
  a[p] = null;
2952
- }), rt()), ~e ? (n = a[e], n ? n.p(l, d) : (n = a[e] = i[e](l), n.c()), V(n, 1), n.m(o.parentNode, o)) : n = null);
2989
+ }), rt()), ~e ? (n = a[e], n ? n.p(l, d) : (n = a[e] = i[e](l), n.c()), k(n, 1), n.m(o.parentNode, o)) : n = null);
2953
2990
  },
2954
2991
  i(l) {
2955
- r || (V(n), r = !0);
2992
+ r || (k(n), r = !0);
2956
2993
  },
2957
2994
  o(l) {
2958
- k(n), r = !1;
2995
+ V(n), r = !1;
2959
2996
  },
2960
2997
  d(l) {
2961
2998
  ~e && a[e].d(l), l && L(o);
2962
2999
  }
2963
3000
  };
2964
3001
  }
2965
- function Ro(t) {
3002
+ function Qo(t) {
2966
3003
  let e = (
2967
3004
  /*tool*/
2968
3005
  t[2]
2969
- ), n, o, r = Xe(t);
3006
+ ), n, o, r = Me(t);
2970
3007
  return {
2971
3008
  c() {
2972
3009
  r.c(), n = at();
2973
3010
  },
2974
3011
  m(i, a) {
2975
- r.m(i, a), B(i, n, a), o = !0;
3012
+ r.m(i, a), Y(i, n, a), o = !0;
2976
3013
  },
2977
3014
  p(i, a) {
2978
3015
  a[0] & /*tool*/
2979
3016
  4 && K(e, e = /*tool*/
2980
- i[2]) ? (ot(), k(r, 1, 1, U), rt(), r = Xe(i), r.c(), V(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
3017
+ i[2]) ? (ot(), V(r, 1, 1, G), rt(), r = Me(i), r.c(), k(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
2981
3018
  },
2982
3019
  i(i) {
2983
- o || (V(r), o = !0);
3020
+ o || (k(r), o = !0);
2984
3021
  },
2985
3022
  o(i) {
2986
- k(r), o = !1;
3023
+ V(r), o = !1;
2987
3024
  },
2988
3025
  d(i) {
2989
3026
  i && L(n), r.d(i);
2990
3027
  }
2991
3028
  };
2992
3029
  }
2993
- function qo(t) {
3030
+ function Zo(t) {
2994
3031
  let e, n, o = (
2995
3032
  /*editableAnnotations*/
2996
3033
  t[6]
2997
3034
  ), r = [];
2998
3035
  for (let a = 0; a < o.length; a += 1)
2999
- r[a] = Ye(Ae(t, o, a));
3000
- const i = (a) => k(r[a], 1, 1, () => {
3036
+ r[a] = Xe(Se(t, o, a));
3037
+ const i = (a) => V(r[a], 1, 1, () => {
3001
3038
  r[a] = null;
3002
3039
  });
3003
3040
  return {
@@ -3009,7 +3046,7 @@ function qo(t) {
3009
3046
  m(a, s) {
3010
3047
  for (let l = 0; l < r.length; l += 1)
3011
3048
  r[l] && r[l].m(a, s);
3012
- B(a, e, s), n = !0;
3049
+ Y(a, e, s), n = !0;
3013
3050
  },
3014
3051
  p(a, s) {
3015
3052
  if (s[0] & /*editableAnnotations, drawingEl, style, transform, $scale, onChangeSelected*/
@@ -3018,8 +3055,8 @@ function qo(t) {
3018
3055
  a[6];
3019
3056
  let l;
3020
3057
  for (l = 0; l < o.length; l += 1) {
3021
- const d = Ae(a, o, l);
3022
- r[l] ? (r[l].p(d, s), V(r[l], 1)) : (r[l] = Ye(d), r[l].c(), V(r[l], 1), r[l].m(e.parentNode, e));
3058
+ const d = Se(a, o, l);
3059
+ r[l] ? (r[l].p(d, s), k(r[l], 1)) : (r[l] = Xe(d), r[l].c(), k(r[l], 1), r[l].m(e.parentNode, e));
3023
3060
  }
3024
3061
  for (ot(), l = o.length; l < r.length; l += 1)
3025
3062
  i(l);
@@ -3029,24 +3066,24 @@ function qo(t) {
3029
3066
  i(a) {
3030
3067
  if (!n) {
3031
3068
  for (let s = 0; s < o.length; s += 1)
3032
- V(r[s]);
3069
+ k(r[s]);
3033
3070
  n = !0;
3034
3071
  }
3035
3072
  },
3036
3073
  o(a) {
3037
3074
  r = r.filter(Boolean);
3038
3075
  for (let s = 0; s < r.length; s += 1)
3039
- k(r[s]);
3076
+ V(r[s]);
3040
3077
  n = !1;
3041
3078
  },
3042
3079
  d(a) {
3043
- oe(r, a), a && L(e);
3080
+ re(r, a), a && L(e);
3044
3081
  }
3045
3082
  };
3046
3083
  }
3047
- function Xe(t) {
3084
+ function Me(t) {
3048
3085
  let e, n;
3049
- return e = new yo({
3086
+ return e = new bo({
3050
3087
  props: {
3051
3088
  target: (
3052
3089
  /*drawingEl*/
@@ -3075,7 +3112,7 @@ function Xe(t) {
3075
3112
  t[16]
3076
3113
  ), {
3077
3114
  c() {
3078
- ft(e.$$.fragment);
3115
+ gt(e.$$.fragment);
3079
3116
  },
3080
3117
  m(o, r) {
3081
3118
  ct(e, o, r), n = !0;
@@ -3095,25 +3132,25 @@ function Xe(t) {
3095
3132
  o[13]), e.$set(i);
3096
3133
  },
3097
3134
  i(o) {
3098
- n || (V(e.$$.fragment, o), n = !0);
3135
+ n || (k(e.$$.fragment, o), n = !0);
3099
3136
  },
3100
3137
  o(o) {
3101
- k(e.$$.fragment, o), n = !1;
3138
+ V(e.$$.fragment, o), n = !1;
3102
3139
  },
3103
3140
  d(o) {
3104
3141
  ut(e, o);
3105
3142
  }
3106
3143
  };
3107
3144
  }
3108
- function Ie(t) {
3145
+ function Be(t) {
3109
3146
  let e, n;
3110
- return e = new go({
3147
+ return e = new $o({
3111
3148
  props: {
3112
3149
  target: (
3113
3150
  /*drawingEl*/
3114
3151
  t[4]
3115
3152
  ),
3116
- editor: we(
3153
+ editor: be(
3117
3154
  /*editable*/
3118
3155
  t[28].target.selector
3119
3156
  ),
@@ -3147,7 +3184,7 @@ function Ie(t) {
3147
3184
  ).apply(this, arguments);
3148
3185
  }), {
3149
3186
  c() {
3150
- ft(e.$$.fragment);
3187
+ gt(e.$$.fragment);
3151
3188
  },
3152
3189
  m(o, r) {
3153
3190
  ct(e, o, r), n = !0;
@@ -3158,7 +3195,7 @@ function Ie(t) {
3158
3195
  r[0] & /*drawingEl*/
3159
3196
  16 && (i.target = /*drawingEl*/
3160
3197
  t[4]), r[0] & /*editableAnnotations*/
3161
- 64 && (i.editor = we(
3198
+ 64 && (i.editor = be(
3162
3199
  /*editable*/
3163
3200
  t[28].target.selector
3164
3201
  )), r[0] & /*editableAnnotations*/
@@ -3172,82 +3209,82 @@ function Ie(t) {
3172
3209
  t[13]), e.$set(i);
3173
3210
  },
3174
3211
  i(o) {
3175
- n || (V(e.$$.fragment, o), n = !0);
3212
+ n || (k(e.$$.fragment, o), n = !0);
3176
3213
  },
3177
3214
  o(o) {
3178
- k(e.$$.fragment, o), n = !1;
3215
+ V(e.$$.fragment, o), n = !1;
3179
3216
  },
3180
3217
  d(o) {
3181
3218
  ut(e, o);
3182
3219
  }
3183
3220
  };
3184
3221
  }
3185
- function Ye(t) {
3222
+ function Xe(t) {
3186
3223
  let e = (
3187
3224
  /*editable*/
3188
3225
  t[28].id
3189
- ), n, o, r = Ie(t);
3226
+ ), n, o, r = Be(t);
3190
3227
  return {
3191
3228
  c() {
3192
3229
  r.c(), n = at();
3193
3230
  },
3194
3231
  m(i, a) {
3195
- r.m(i, a), B(i, n, a), o = !0;
3232
+ r.m(i, a), Y(i, n, a), o = !0;
3196
3233
  },
3197
3234
  p(i, a) {
3198
3235
  a[0] & /*editableAnnotations*/
3199
3236
  64 && K(e, e = /*editable*/
3200
- i[28].id) ? (ot(), k(r, 1, 1, U), rt(), r = Ie(i), r.c(), V(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
3237
+ i[28].id) ? (ot(), V(r, 1, 1, G), rt(), r = Be(i), r.c(), k(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
3201
3238
  },
3202
3239
  i(i) {
3203
- o || (V(r), o = !0);
3240
+ o || (k(r), o = !0);
3204
3241
  },
3205
3242
  o(i) {
3206
- k(r), o = !1;
3243
+ V(r), o = !1;
3207
3244
  },
3208
3245
  d(i) {
3209
3246
  i && L(n), r.d(i);
3210
3247
  }
3211
3248
  };
3212
3249
  }
3213
- function Wo(t) {
3250
+ function tr(t) {
3214
3251
  let e, n, o, r, i, a, s = (
3215
3252
  /*$store*/
3216
3253
  t[12]
3217
3254
  ), l = [];
3218
3255
  for (let c = 0; c < s.length; c += 1)
3219
- l[c] = Le(Te(t, s, c));
3220
- const d = (c) => k(l[c], 1, 1, () => {
3256
+ l[c] = _e(Oe(t, s, c));
3257
+ const d = (c) => V(l[c], 1, 1, () => {
3221
3258
  l[c] = null;
3222
3259
  });
3223
3260
  let p = (
3224
3261
  /*drawingEl*/
3225
- t[4] && Be(t)
3262
+ t[4] && Ie(t)
3226
3263
  );
3227
3264
  return {
3228
3265
  c() {
3229
- e = O("svg"), n = O("g");
3266
+ e = N("svg"), n = N("g");
3230
3267
  for (let c = 0; c < l.length; c += 1)
3231
3268
  l[c].c();
3232
- o = O("g"), p && p.c(), u(o, "class", "drawing"), u(e, "class", "a9s-annotationlayer"), ce(
3269
+ o = N("g"), p && p.c(), u(o, "class", "drawing"), u(e, "class", "a9s-annotationlayer"), he(
3233
3270
  e,
3234
3271
  "drawing",
3235
3272
  /*tool*/
3236
3273
  t[2]
3237
3274
  );
3238
3275
  },
3239
- m(c, f) {
3240
- B(c, e, f), dt(e, n);
3276
+ m(c, g) {
3277
+ Y(c, e, g), dt(e, n);
3241
3278
  for (let h = 0; h < l.length; h += 1)
3242
3279
  l[h] && l[h].m(n, null);
3243
3280
  dt(e, o), p && p.m(o, null), t[24](o), t[25](e), r = !0, i || (a = [
3244
- R(e, "pointerup", function() {
3281
+ z(e, "pointerup", function() {
3245
3282
  H(
3246
3283
  /*onPointerUp*/
3247
3284
  t[8]
3248
3285
  ) && t[8].apply(this, arguments);
3249
3286
  }),
3250
- R(e, "pointerdown", function() {
3287
+ z(e, "pointerdown", function() {
3251
3288
  H(
3252
3289
  /*onPointerDown*/
3253
3290
  t[9]
@@ -3255,25 +3292,25 @@ function Wo(t) {
3255
3292
  })
3256
3293
  ], i = !0);
3257
3294
  },
3258
- p(c, f) {
3259
- if (t = c, f[0] & /*$store, style, isEditable*/
3295
+ p(c, g) {
3296
+ if (t = c, g[0] & /*$store, style, isEditable*/
3260
3297
  4226) {
3261
3298
  s = /*$store*/
3262
3299
  t[12];
3263
3300
  let h;
3264
3301
  for (h = 0; h < s.length; h += 1) {
3265
- const m = Te(t, s, h);
3266
- l[h] ? (l[h].p(m, f), V(l[h], 1)) : (l[h] = Le(m), l[h].c(), V(l[h], 1), l[h].m(n, null));
3302
+ const m = Oe(t, s, h);
3303
+ l[h] ? (l[h].p(m, g), k(l[h], 1)) : (l[h] = _e(m), l[h].c(), k(l[h], 1), l[h].m(n, null));
3267
3304
  }
3268
3305
  for (ot(), h = s.length; h < l.length; h += 1)
3269
3306
  d(h);
3270
3307
  rt();
3271
3308
  }
3272
- t[4] ? p ? (p.p(t, f), f[0] & /*drawingEl*/
3273
- 16 && V(p, 1)) : (p = Be(t), p.c(), V(p, 1), p.m(o, null)) : p && (ot(), k(p, 1, 1, () => {
3309
+ t[4] ? p ? (p.p(t, g), g[0] & /*drawingEl*/
3310
+ 16 && k(p, 1)) : (p = Ie(t), p.c(), k(p, 1), p.m(o, null)) : p && (ot(), V(p, 1, 1, () => {
3274
3311
  p = null;
3275
- }), rt()), (!r || f[0] & /*tool*/
3276
- 4) && ce(
3312
+ }), rt()), (!r || g[0] & /*tool*/
3313
+ 4) && he(
3277
3314
  e,
3278
3315
  "drawing",
3279
3316
  /*tool*/
@@ -3282,87 +3319,87 @@ function Wo(t) {
3282
3319
  },
3283
3320
  i(c) {
3284
3321
  if (!r) {
3285
- for (let f = 0; f < s.length; f += 1)
3286
- V(l[f]);
3287
- V(p), r = !0;
3322
+ for (let g = 0; g < s.length; g += 1)
3323
+ k(l[g]);
3324
+ k(p), r = !0;
3288
3325
  }
3289
3326
  },
3290
3327
  o(c) {
3291
3328
  l = l.filter(Boolean);
3292
- for (let f = 0; f < l.length; f += 1)
3293
- k(l[f]);
3294
- k(p), r = !1;
3329
+ for (let g = 0; g < l.length; g += 1)
3330
+ V(l[g]);
3331
+ V(p), r = !1;
3295
3332
  },
3296
3333
  d(c) {
3297
- c && L(e), oe(l, c), p && p.d(), t[24](null), t[25](null), i = !1, it(a);
3334
+ c && L(e), re(l, c), p && p.d(), t[24](null), t[25](null), i = !1, it(a);
3298
3335
  }
3299
3336
  };
3300
3337
  }
3301
- function Ko(t, e, n) {
3302
- let o, r, i, a, s, l, d, p, c = U, f = () => (c(), c = Ve(b, (I) => n(13, p = I)), b);
3338
+ function er(t, e, n) {
3339
+ let o, r, i, a, s, l, d, p, c = G, g = () => (c(), c = De(b, (I) => n(13, p = I)), b);
3303
3340
  t.$$.on_destroy.push(() => c());
3304
- let { drawingEnabled: h } = e, { image: m } = e, { preferredDrawingMode: x } = e, { state: A } = e, { style: $ = void 0 } = e, { tool: y, opts: v } = qe("rectangle"), { tool: E = y, opts: _ = v } = e, { user: C } = e, N, g, b;
3305
- It(() => f(n(5, b = vo(m, g))));
3306
- const { selection: w, store: T } = A;
3307
- de(t, w, (I) => n(23, l = I)), de(t, T, (I) => n(12, d = I));
3308
- let X = null, P = null;
3341
+ let { drawingEnabled: h } = e, { image: m } = e, { preferredDrawingMode: x } = e, { state: A } = e, { style: w = void 0 } = e, { tool: y, opts: E } = Ke("rectangle"), { tool: v = y, opts: B = E } = e, { user: R } = e, D, f, b;
3342
+ Mt(() => g(n(5, b = Oo(m, f))));
3343
+ const { selection: $, store: T } = A;
3344
+ ue(t, $, (I) => n(23, l = I)), ue(t, T, (I) => n(12, d = I));
3345
+ let _ = null, X = null;
3309
3346
  const J = (I) => {
3310
- T.unobserve(X);
3347
+ T.unobserve(_);
3311
3348
  const q = I.filter(({ editable: j }) => j).map(({ id: j }) => j);
3312
- q.length > 0 ? (n(6, P = q.map((j) => T.getAnnotation(j))), X = (j) => {
3313
- const { updated: G } = j.changes;
3314
- n(6, P = G.map((st) => st.newValue));
3315
- }, T.observe(X, { annotations: q })) : n(6, P = null);
3316
- }, gt = (I) => {
3317
- const q = Fe(), j = {
3349
+ q.length > 0 ? (n(6, X = q.map((j) => T.getAnnotation(j))), _ = (j) => {
3350
+ const { updated: U } = j.changes;
3351
+ n(6, X = U.map((st) => st.newValue));
3352
+ }, T.observe(_, { annotations: q })) : n(6, X = null);
3353
+ }, ft = (I) => {
3354
+ const q = je(), j = {
3318
3355
  id: q,
3319
3356
  bodies: [],
3320
3357
  target: {
3321
3358
  annotation: q,
3322
3359
  selector: I.detail,
3323
- creator: C,
3360
+ creator: R,
3324
3361
  created: /* @__PURE__ */ new Date()
3325
3362
  }
3326
3363
  };
3327
- T.addAnnotation(j), w.setSelected(j.id);
3364
+ T.addAnnotation(j), $.setSelected(j.id);
3328
3365
  }, mt = (I) => (q) => {
3329
3366
  var j;
3330
- const { target: G } = I, st = 10 * 60 * 1e3, lt = ((j = G.creator) == null ? void 0 : j.id) !== C.id || !G.created || (/* @__PURE__ */ new Date()).getTime() - G.created.getTime() > st;
3367
+ const { target: U } = I, st = 10 * 60 * 1e3, lt = ((j = U.creator) == null ? void 0 : j.id) !== R.id || !U.created || (/* @__PURE__ */ new Date()).getTime() - U.created.getTime() > st;
3331
3368
  T.updateTarget({
3332
- ...G,
3369
+ ...U,
3333
3370
  selector: q.detail,
3334
- created: lt ? G.created : /* @__PURE__ */ new Date(),
3371
+ created: lt ? U.created : /* @__PURE__ */ new Date(),
3335
3372
  updated: lt ? /* @__PURE__ */ new Date() : null,
3336
- updatedBy: lt ? C : null
3373
+ updatedBy: lt ? R : null
3337
3374
  });
3338
3375
  };
3339
- function Tt(I) {
3340
- Dt[I ? "unshift" : "push"](() => {
3341
- N = I, n(4, N);
3376
+ function St(I) {
3377
+ Ut[I ? "unshift" : "push"](() => {
3378
+ D = I, n(4, D);
3342
3379
  });
3343
3380
  }
3344
3381
  function W(I) {
3345
- Dt[I ? "unshift" : "push"](() => {
3346
- g = I, n(3, g);
3382
+ Ut[I ? "unshift" : "push"](() => {
3383
+ f = I, n(3, f);
3347
3384
  });
3348
3385
  }
3349
3386
  return t.$$set = (I) => {
3350
- "drawingEnabled" in I && n(0, h = I.drawingEnabled), "image" in I && n(18, m = I.image), "preferredDrawingMode" in I && n(19, x = I.preferredDrawingMode), "state" in I && n(20, A = I.state), "style" in I && n(1, $ = I.style), "tool" in I && n(2, E = I.tool), "opts" in I && n(21, _ = I.opts), "user" in I && n(22, C = I.user);
3387
+ "drawingEnabled" in I && n(0, h = I.drawingEnabled), "image" in I && n(18, m = I.image), "preferredDrawingMode" in I && n(19, x = I.preferredDrawingMode), "state" in I && n(20, A = I.state), "style" in I && n(1, w = I.style), "tool" in I && n(2, v = I.tool), "opts" in I && n(21, B = I.opts), "user" in I && n(22, R = I.user);
3351
3388
  }, t.$$.update = () => {
3352
3389
  t.$$.dirty[0] & /*opts, preferredDrawingMode*/
3353
- 2621440 && n(11, o = (_ == null ? void 0 : _.drawingMode) || x), t.$$.dirty[0] & /*svgEl*/
3354
- 8 && n(10, r = Do(g)), t.$$.dirty[0] & /*svgEl*/
3355
- 8 && n(9, { onPointerDown: i, onPointerUp: a } = Uo(g, T), i, (n(8, a), n(3, g))), t.$$.dirty[0] & /*$selection*/
3390
+ 2621440 && n(11, o = (B == null ? void 0 : B.drawingMode) || x), t.$$.dirty[0] & /*svgEl*/
3391
+ 8 && n(10, r = jo(f)), t.$$.dirty[0] & /*svgEl*/
3392
+ 8 && n(9, { onPointerDown: i, onPointerUp: a } = zo(f, T), i, (n(8, a), n(3, f))), t.$$.dirty[0] & /*$selection*/
3356
3393
  8388608 && n(7, s = (I) => l.selected.find((q) => q.id === I.id && q.editable)), t.$$.dirty[0] & /*$selection*/
3357
3394
  8388608 && J(l.selected);
3358
3395
  }, [
3359
3396
  h,
3360
- $,
3361
- E,
3362
- g,
3363
- N,
3397
+ w,
3398
+ v,
3399
+ f,
3400
+ D,
3364
3401
  b,
3365
- P,
3402
+ X,
3366
3403
  s,
3367
3404
  a,
3368
3405
  i,
@@ -3370,27 +3407,27 @@ function Ko(t, e, n) {
3370
3407
  o,
3371
3408
  d,
3372
3409
  p,
3373
- w,
3410
+ $,
3374
3411
  T,
3375
- gt,
3412
+ ft,
3376
3413
  mt,
3377
3414
  m,
3378
3415
  x,
3379
3416
  A,
3380
- _,
3381
- C,
3417
+ B,
3418
+ R,
3382
3419
  l,
3383
- Tt,
3420
+ St,
3384
3421
  W
3385
3422
  ];
3386
3423
  }
3387
- class Jo extends nt {
3424
+ class nr extends nt {
3388
3425
  constructor(e) {
3389
3426
  super(), et(
3390
3427
  this,
3391
3428
  e,
3392
- Ko,
3393
- Wo,
3429
+ er,
3430
+ tr,
3394
3431
  K,
3395
3432
  {
3396
3433
  drawingEnabled: 0,
@@ -3407,33 +3444,33 @@ class Jo extends nt {
3407
3444
  );
3408
3445
  }
3409
3446
  }
3410
- function Qo(t, e, n, o, r) {
3411
- We(t, e, n || 0, o || t.length - 1, r || Zo);
3447
+ function or(t, e, n, o, r) {
3448
+ Je(t, e, n || 0, o || t.length - 1, r || rr);
3412
3449
  }
3413
- function We(t, e, n, o, r) {
3450
+ function Je(t, e, n, o, r) {
3414
3451
  for (; o > n; ) {
3415
3452
  if (o - n > 600) {
3416
3453
  var i = o - n + 1, a = e - n + 1, s = Math.log(i), l = 0.5 * Math.exp(2 * s / 3), d = 0.5 * Math.sqrt(s * l * (i - l) / i) * (a - i / 2 < 0 ? -1 : 1), p = Math.max(n, Math.floor(e - a * l / i + d)), c = Math.min(o, Math.floor(e + (i - a) * l / i + d));
3417
- We(t, e, p, c, r);
3454
+ Je(t, e, p, c, r);
3418
3455
  }
3419
- var f = t[e], h = n, m = o;
3420
- for (St(t, n, e), r(t[o], f) > 0 && St(t, n, o); h < m; ) {
3421
- for (St(t, h, m), h++, m--; r(t[h], f) < 0; )
3456
+ var g = t[e], h = n, m = o;
3457
+ for (Ot(t, n, e), r(t[o], g) > 0 && Ot(t, n, o); h < m; ) {
3458
+ for (Ot(t, h, m), h++, m--; r(t[h], g) < 0; )
3422
3459
  h++;
3423
- for (; r(t[m], f) > 0; )
3460
+ for (; r(t[m], g) > 0; )
3424
3461
  m--;
3425
3462
  }
3426
- r(t[n], f) === 0 ? St(t, n, m) : (m++, St(t, m, o)), m <= e && (n = m + 1), e <= m && (o = m - 1);
3463
+ r(t[n], g) === 0 ? Ot(t, n, m) : (m++, Ot(t, m, o)), m <= e && (n = m + 1), e <= m && (o = m - 1);
3427
3464
  }
3428
3465
  }
3429
- function St(t, e, n) {
3466
+ function Ot(t, e, n) {
3430
3467
  var o = t[e];
3431
3468
  t[e] = t[n], t[n] = o;
3432
3469
  }
3433
- function Zo(t, e) {
3470
+ function rr(t, e) {
3434
3471
  return t < e ? -1 : t > e ? 1 : 0;
3435
3472
  }
3436
- class tr {
3473
+ class ir {
3437
3474
  constructor(e = 9) {
3438
3475
  this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
3439
3476
  }
@@ -3443,13 +3480,13 @@ class tr {
3443
3480
  search(e) {
3444
3481
  let n = this.data;
3445
3482
  const o = [];
3446
- if (!kt(e, n))
3483
+ if (!Dt(e, n))
3447
3484
  return o;
3448
3485
  const r = this.toBBox, i = [];
3449
3486
  for (; n; ) {
3450
3487
  for (let a = 0; a < n.children.length; a++) {
3451
3488
  const s = n.children[a], l = n.leaf ? r(s) : s;
3452
- kt(e, l) && (n.leaf ? o.push(s) : Zt(e, l) ? this._all(s, o) : i.push(s));
3489
+ Dt(e, l) && (n.leaf ? o.push(s) : te(e, l) ? this._all(s, o) : i.push(s));
3453
3490
  }
3454
3491
  n = i.pop();
3455
3492
  }
@@ -3457,14 +3494,14 @@ class tr {
3457
3494
  }
3458
3495
  collides(e) {
3459
3496
  let n = this.data;
3460
- if (!kt(e, n))
3497
+ if (!Dt(e, n))
3461
3498
  return !1;
3462
3499
  const o = [];
3463
3500
  for (; n; ) {
3464
3501
  for (let r = 0; r < n.children.length; r++) {
3465
3502
  const i = n.children[r], a = n.leaf ? this.toBBox(i) : i;
3466
- if (kt(e, a)) {
3467
- if (n.leaf || Zt(e, a))
3503
+ if (Dt(e, a)) {
3504
+ if (n.leaf || te(e, a))
3468
3505
  return !0;
3469
3506
  o.push(i);
3470
3507
  }
@@ -3499,7 +3536,7 @@ class tr {
3499
3536
  return e && this._insert(e, this.data.height - 1), this;
3500
3537
  }
3501
3538
  clear() {
3502
- return this.data = bt([]), this;
3539
+ return this.data = Et([]), this;
3503
3540
  }
3504
3541
  remove(e, n) {
3505
3542
  if (!e)
@@ -3509,11 +3546,11 @@ class tr {
3509
3546
  let s, l, d;
3510
3547
  for (; o || i.length; ) {
3511
3548
  if (o || (o = i.pop(), l = i[i.length - 1], s = a.pop(), d = !0), o.leaf) {
3512
- const p = er(e, o.children, n);
3549
+ const p = ar(e, o.children, n);
3513
3550
  if (p !== -1)
3514
3551
  return o.children.splice(p, 1), i.push(o), this._condense(i), this;
3515
3552
  }
3516
- !d && !o.leaf && Zt(o, r) ? (i.push(o), a.push(s), s = 0, l = o, o = o.children[0]) : l ? (s++, o = l.children[s], d = !1) : o = null;
3553
+ !d && !o.leaf && te(o, r) ? (i.push(o), a.push(s), s = 0, l = o, o = o.children[0]) : l ? (s++, o = l.children[s], d = !1) : o = null;
3517
3554
  }
3518
3555
  return this;
3519
3556
  }
@@ -3542,25 +3579,25 @@ class tr {
3542
3579
  const i = o - n + 1;
3543
3580
  let a = this._maxEntries, s;
3544
3581
  if (i <= a)
3545
- return s = bt(e.slice(n, o + 1)), wt(s, this.toBBox), s;
3546
- r || (r = Math.ceil(Math.log(i) / Math.log(a)), a = Math.ceil(i / Math.pow(a, r - 1))), s = bt([]), s.leaf = !1, s.height = r;
3582
+ return s = Et(e.slice(n, o + 1)), xt(s, this.toBBox), s;
3583
+ r || (r = Math.ceil(Math.log(i) / Math.log(a)), a = Math.ceil(i / Math.pow(a, r - 1))), s = Et([]), s.leaf = !1, s.height = r;
3547
3584
  const l = Math.ceil(i / a), d = l * Math.ceil(Math.sqrt(a));
3548
- _e(e, n, o, d, this.compareMinX);
3585
+ Re(e, n, o, d, this.compareMinX);
3549
3586
  for (let p = n; p <= o; p += d) {
3550
3587
  const c = Math.min(p + d - 1, o);
3551
- _e(e, p, c, l, this.compareMinY);
3552
- for (let f = p; f <= c; f += l) {
3553
- const h = Math.min(f + l - 1, c);
3554
- s.children.push(this._build(e, f, h, r - 1));
3588
+ Re(e, p, c, l, this.compareMinY);
3589
+ for (let g = p; g <= c; g += l) {
3590
+ const h = Math.min(g + l - 1, c);
3591
+ s.children.push(this._build(e, g, h, r - 1));
3555
3592
  }
3556
3593
  }
3557
- return wt(s, this.toBBox), s;
3594
+ return xt(s, this.toBBox), s;
3558
3595
  }
3559
3596
  _chooseSubtree(e, n, o, r) {
3560
3597
  for (; r.push(n), !(n.leaf || r.length - 1 === o); ) {
3561
3598
  let i = 1 / 0, a = 1 / 0, s;
3562
3599
  for (let l = 0; l < n.children.length; l++) {
3563
- const d = n.children[l], p = Qt(d), c = rr(e, d) - p;
3600
+ const d = n.children[l], p = Zt(d), c = dr(e, d) - p;
3564
3601
  c < a ? (a = c, i = p < i ? p : i, s = d) : c === a && p < i && (i = p, s = d);
3565
3602
  }
3566
3603
  n = s || n.children[0];
@@ -3569,7 +3606,7 @@ class tr {
3569
3606
  }
3570
3607
  _insert(e, n, o) {
3571
3608
  const r = o ? e : this.toBBox(e), i = [], a = this._chooseSubtree(r, this.data, n, i);
3572
- for (a.children.push(e), Lt(a, r); n >= 0 && i[n].children.length > this._maxEntries; )
3609
+ for (a.children.push(e), Yt(a, r); n >= 0 && i[n].children.length > this._maxEntries; )
3573
3610
  this._split(i, n), n--;
3574
3611
  this._adjustParentBBoxes(r, i, n);
3575
3612
  }
@@ -3577,50 +3614,50 @@ class tr {
3577
3614
  _split(e, n) {
3578
3615
  const o = e[n], r = o.children.length, i = this._minEntries;
3579
3616
  this._chooseSplitAxis(o, i, r);
3580
- const a = this._chooseSplitIndex(o, i, r), s = bt(o.children.splice(a, o.children.length - a));
3581
- s.height = o.height, s.leaf = o.leaf, wt(o, this.toBBox), wt(s, this.toBBox), n ? e[n - 1].children.push(s) : this._splitRoot(o, s);
3617
+ const a = this._chooseSplitIndex(o, i, r), s = Et(o.children.splice(a, o.children.length - a));
3618
+ s.height = o.height, s.leaf = o.leaf, xt(o, this.toBBox), xt(s, this.toBBox), n ? e[n - 1].children.push(s) : this._splitRoot(o, s);
3582
3619
  }
3583
3620
  _splitRoot(e, n) {
3584
- this.data = bt([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, wt(this.data, this.toBBox);
3621
+ this.data = Et([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, xt(this.data, this.toBBox);
3585
3622
  }
3586
3623
  _chooseSplitIndex(e, n, o) {
3587
3624
  let r, i = 1 / 0, a = 1 / 0;
3588
3625
  for (let s = n; s <= o - n; s++) {
3589
- const l = Mt(e, 0, s, this.toBBox), d = Mt(e, s, o, this.toBBox), p = ir(l, d), c = Qt(l) + Qt(d);
3626
+ const l = Lt(e, 0, s, this.toBBox), d = Lt(e, s, o, this.toBBox), p = cr(l, d), c = Zt(l) + Zt(d);
3590
3627
  p < i ? (i = p, r = s, a = c < a ? c : a) : p === i && c < a && (a = c, r = s);
3591
3628
  }
3592
3629
  return r || o - n;
3593
3630
  }
3594
3631
  // sorts node children by the best axis for split
3595
3632
  _chooseSplitAxis(e, n, o) {
3596
- const r = e.leaf ? this.compareMinX : nr, i = e.leaf ? this.compareMinY : or, a = this._allDistMargin(e, n, o, r), s = this._allDistMargin(e, n, o, i);
3633
+ const r = e.leaf ? this.compareMinX : sr, i = e.leaf ? this.compareMinY : lr, a = this._allDistMargin(e, n, o, r), s = this._allDistMargin(e, n, o, i);
3597
3634
  a < s && e.children.sort(r);
3598
3635
  }
3599
3636
  // total margin of all possible split distributions where each node is at least m full
3600
3637
  _allDistMargin(e, n, o, r) {
3601
3638
  e.children.sort(r);
3602
- const i = this.toBBox, a = Mt(e, 0, n, i), s = Mt(e, o - n, o, i);
3639
+ const i = this.toBBox, a = Lt(e, 0, n, i), s = Lt(e, o - n, o, i);
3603
3640
  let l = Vt(a) + Vt(s);
3604
3641
  for (let d = n; d < o - n; d++) {
3605
3642
  const p = e.children[d];
3606
- Lt(a, e.leaf ? i(p) : p), l += Vt(a);
3643
+ Yt(a, e.leaf ? i(p) : p), l += Vt(a);
3607
3644
  }
3608
3645
  for (let d = o - n - 1; d >= n; d--) {
3609
3646
  const p = e.children[d];
3610
- Lt(s, e.leaf ? i(p) : p), l += Vt(s);
3647
+ Yt(s, e.leaf ? i(p) : p), l += Vt(s);
3611
3648
  }
3612
3649
  return l;
3613
3650
  }
3614
3651
  _adjustParentBBoxes(e, n, o) {
3615
3652
  for (let r = o; r >= 0; r--)
3616
- Lt(n[r], e);
3653
+ Yt(n[r], e);
3617
3654
  }
3618
3655
  _condense(e) {
3619
3656
  for (let n = e.length - 1, o; n >= 0; n--)
3620
- e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : wt(e[n], this.toBBox);
3657
+ e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : xt(e[n], this.toBBox);
3621
3658
  }
3622
3659
  }
3623
- function er(t, e, n) {
3660
+ function ar(t, e, n) {
3624
3661
  if (!n)
3625
3662
  return e.indexOf(t);
3626
3663
  for (let o = 0; o < e.length; o++)
@@ -3628,46 +3665,46 @@ function er(t, e, n) {
3628
3665
  return o;
3629
3666
  return -1;
3630
3667
  }
3631
- function wt(t, e) {
3632
- Mt(t, 0, t.children.length, e, t);
3668
+ function xt(t, e) {
3669
+ Lt(t, 0, t.children.length, e, t);
3633
3670
  }
3634
- function Mt(t, e, n, o, r) {
3635
- r || (r = bt(null)), r.minX = 1 / 0, r.minY = 1 / 0, r.maxX = -1 / 0, r.maxY = -1 / 0;
3671
+ function Lt(t, e, n, o, r) {
3672
+ r || (r = Et(null)), r.minX = 1 / 0, r.minY = 1 / 0, r.maxX = -1 / 0, r.maxY = -1 / 0;
3636
3673
  for (let i = e; i < n; i++) {
3637
3674
  const a = t.children[i];
3638
- Lt(r, t.leaf ? o(a) : a);
3675
+ Yt(r, t.leaf ? o(a) : a);
3639
3676
  }
3640
3677
  return r;
3641
3678
  }
3642
- function Lt(t, e) {
3679
+ function Yt(t, e) {
3643
3680
  return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
3644
3681
  }
3645
- function nr(t, e) {
3682
+ function sr(t, e) {
3646
3683
  return t.minX - e.minX;
3647
3684
  }
3648
- function or(t, e) {
3685
+ function lr(t, e) {
3649
3686
  return t.minY - e.minY;
3650
3687
  }
3651
- function Qt(t) {
3688
+ function Zt(t) {
3652
3689
  return (t.maxX - t.minX) * (t.maxY - t.minY);
3653
3690
  }
3654
3691
  function Vt(t) {
3655
3692
  return t.maxX - t.minX + (t.maxY - t.minY);
3656
3693
  }
3657
- function rr(t, e) {
3694
+ function dr(t, e) {
3658
3695
  return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
3659
3696
  }
3660
- function ir(t, e) {
3697
+ function cr(t, e) {
3661
3698
  const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), r = Math.min(t.maxX, e.maxX), i = Math.min(t.maxY, e.maxY);
3662
3699
  return Math.max(0, r - n) * Math.max(0, i - o);
3663
3700
  }
3664
- function Zt(t, e) {
3701
+ function te(t, e) {
3665
3702
  return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
3666
3703
  }
3667
- function kt(t, e) {
3704
+ function Dt(t, e) {
3668
3705
  return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
3669
3706
  }
3670
- function bt(t) {
3707
+ function Et(t) {
3671
3708
  return {
3672
3709
  children: t,
3673
3710
  height: 1,
@@ -3678,17 +3715,17 @@ function bt(t) {
3678
3715
  maxY: -1 / 0
3679
3716
  };
3680
3717
  }
3681
- function _e(t, e, n, o, r) {
3718
+ function Re(t, e, n, o, r) {
3682
3719
  const i = [e, n];
3683
3720
  for (; i.length; ) {
3684
3721
  if (n = i.pop(), e = i.pop(), n - e <= o)
3685
3722
  continue;
3686
3723
  const a = e + Math.ceil((n - e) / o / 2) * o;
3687
- Qo(t, a, e, n, r), i.push(e, a, a, n);
3724
+ or(t, a, e, n, r), i.push(e, a, a, n);
3688
3725
  }
3689
3726
  }
3690
- const ar = () => {
3691
- const t = new tr(), e = /* @__PURE__ */ new Map(), n = () => [...e.values()], o = () => {
3727
+ const ur = () => {
3728
+ const t = new ir(), e = /* @__PURE__ */ new Map(), n = () => [...e.values()], o = () => {
3692
3729
  t.clear(), e.clear();
3693
3730
  }, r = (a) => {
3694
3731
  const { minX: s, minY: l, maxX: d, maxY: p } = a.selector.geometry.bounds, c = { minX: s, minY: l, maxX: d, maxY: p, target: a };
@@ -3706,9 +3743,9 @@ const ar = () => {
3706
3743
  minY: s,
3707
3744
  maxX: a,
3708
3745
  maxY: s
3709
- }).map((d) => d.target).filter((d) => d.selector.type === F.RECTANGLE || cn(d.selector, a, s));
3746
+ }).map((d) => d.target).filter((d) => d.selector.type === F.RECTANGLE || hn(d.selector, a, s));
3710
3747
  if (l.length > 0)
3711
- return l.sort((d, p) => ne(d.selector) - ne(p.selector)), l[0];
3748
+ return l.sort((d, p) => oe(d.selector) - oe(p.selector)), l[0];
3712
3749
  },
3713
3750
  getIntersecting: (a, s, l, d) => t.search({
3714
3751
  minX: a,
@@ -3721,8 +3758,8 @@ const ar = () => {
3721
3758
  set: (a, s = !0) => {
3722
3759
  s && o();
3723
3760
  const l = a.map((d) => {
3724
- const { minX: p, minY: c, maxX: f, maxY: h } = d.selector.geometry.bounds;
3725
- return { minX: p, minY: c, maxX: f, maxY: h, target: d };
3761
+ const { minX: p, minY: c, maxX: g, maxY: h } = d.selector.geometry.bounds;
3762
+ return { minX: p, minY: c, maxX: g, maxY: h, target: d };
3726
3763
  });
3727
3764
  l.forEach((d) => e.set(d.target.annotation, d)), t.load(l);
3728
3765
  },
@@ -3731,8 +3768,8 @@ const ar = () => {
3731
3768
  i(a), r(s);
3732
3769
  }
3733
3770
  };
3734
- }, sr = (t) => {
3735
- const e = On(), n = ar(), o = Mn(e, t.pointerSelectAction), r = Sn(e), i = Gn();
3771
+ }, hr = (t) => {
3772
+ const e = Cn(), n = ur(), o = _n(e, t.pointerSelectAction), r = Yn(e), i = jn();
3736
3773
  return e.observe(({ changes: a }) => {
3737
3774
  n.set(a.created.map((s) => s.target), !1), a.deleted.forEach((s) => n.remove(s.target)), a.updated.forEach(({ oldValue: s, newValue: l }) => n.update(s.target, l.target));
3738
3775
  }), {
@@ -3748,13 +3785,13 @@ const ar = () => {
3748
3785
  hover: r,
3749
3786
  viewport: i
3750
3787
  };
3751
- }, lr = (t) => {
3752
- const e = sr(t);
3788
+ }, pr = (t) => {
3789
+ const e = hr(t);
3753
3790
  return {
3754
3791
  ...e,
3755
- store: Vn(e.store)
3792
+ store: Un(e.store)
3756
3793
  };
3757
- }, dr = (t) => {
3794
+ }, gr = (t) => {
3758
3795
  let e, n;
3759
3796
  if (t.nodeName === "CANVAS")
3760
3797
  e = t, n = e.getContext("2d", { willReadFrequently: !0 });
@@ -3769,40 +3806,40 @@ const ar = () => {
3769
3806
  o += d;
3770
3807
  }
3771
3808
  return o / 81;
3772
- }, cr = (t) => {
3773
- const e = dr(t), n = e > 0.6 ? "dark" : "light";
3809
+ }, fr = (t) => {
3810
+ const e = gr(t), n = e > 0.6 ? "dark" : "light";
3774
3811
  return console.log(`[Annotorious] Image brightness: ${e.toFixed(1)}. Setting ${n} theme.`), n;
3775
- }, Ce = (t, e, n) => e.setAttribute("data-theme", n === "auto" ? cr(t) : n), ur = (t) => ({
3812
+ }, Ne = (t, e, n) => e.setAttribute("data-theme", n === "auto" ? fr(t) : n), mr = (t) => ({
3776
3813
  ...t,
3777
3814
  drawingEnabled: t.drawingEnabled === void 0 ? !0 : t.drawingEnabled,
3778
3815
  drawingMode: t.drawingMode || "drag",
3779
- pointerSelectAction: t.pointerSelectAction || He.EDIT,
3816
+ pointerSelectAction: t.pointerSelectAction || Pe.EDIT,
3780
3817
  theme: t.theme || "light"
3781
- }), Pe = navigator.userAgent.indexOf("Mac OS X") !== -1, hr = (t, e) => {
3818
+ }), ke = navigator.userAgent.indexOf("Mac OS X") !== -1, yr = (t, e) => {
3782
3819
  const n = e || document, o = (a) => {
3783
3820
  a.key === "Z" && a.ctrlKey ? t.undo() : a.key === "Y" && a.ctrlKey && t.redo();
3784
3821
  }, r = (a) => {
3785
3822
  a.key === "z" && a.metaKey && (a.shiftKey ? t.redo() : t.undo());
3786
3823
  }, i = () => {
3787
- Pe ? n.removeEventListener("keydown", r) : n.removeEventListener("keydown", o);
3824
+ ke ? n.removeEventListener("keydown", r) : n.removeEventListener("keydown", o);
3788
3825
  };
3789
- return Pe ? n.addEventListener("keydown", r) : n.addEventListener("keydown", o), {
3826
+ return ke ? n.addEventListener("keydown", r) : n.addEventListener("keydown", o), {
3790
3827
  destroy: i
3791
3828
  };
3792
- }, fr = (t, e = {}) => {
3829
+ }, xr = (t, e = {}) => {
3793
3830
  if (!t)
3794
3831
  throw "Missing argument: image";
3795
- const n = typeof t == "string" ? document.getElementById(t) : t, o = ur(e), r = lr(o), { selection: i, store: a } = r, s = Dn(a), l = Un(
3832
+ const n = typeof t == "string" ? document.getElementById(t) : t, o = mr(e), r = pr(o), { selection: i, store: a } = r, s = Hn(a), l = Pn(
3796
3833
  r,
3797
3834
  s,
3798
3835
  o.adapter,
3799
3836
  o.autoSave
3800
3837
  ), d = document.createElement("DIV");
3801
3838
  d.style.position = "relative", d.style.display = "inline-block", n.style.display = "block", n.parentNode.insertBefore(d, n), d.appendChild(n);
3802
- const p = hr(s);
3803
- let c = Wn();
3804
- Ce(n, d, o.theme);
3805
- const f = new Jo({
3839
+ const p = yr(s);
3840
+ let c = Zn();
3841
+ Ne(n, d, o.theme);
3842
+ const g = new nr({
3806
3843
  target: d,
3807
3844
  props: {
3808
3845
  drawingEnabled: o.drawingEnabled,
@@ -3813,19 +3850,19 @@ const ar = () => {
3813
3850
  user: c
3814
3851
  }
3815
3852
  });
3816
- f.$on("click", (g) => {
3817
- const { originalEvent: b, annotation: w } = g.detail;
3818
- w ? i.clickSelect(w.id, b) : i.isEmpty() || i.clear();
3853
+ g.$on("click", (f) => {
3854
+ const { originalEvent: b, annotation: $ } = f.detail;
3855
+ $ ? i.clickSelect($.id, b) : i.isEmpty() || i.clear();
3819
3856
  });
3820
- const h = Hn(r, s, o.adapter), m = () => {
3821
- f.$destroy(), d.parentNode.insertBefore(n, d), d.parentNode.removeChild(d), p.destroy(), s.destroy();
3822
- }, x = () => c, A = (g, b, w) => Lo(g, b, w), $ = (g, b) => co(g, b), y = (g) => {
3823
- const { tool: b, opts: w } = qe(g);
3824
- f.$set({ tool: b, opts: w });
3825
- }, v = (g) => f.$set({ drawingEnabled: g }), E = (g) => {
3857
+ const h = qn(r, s, o.adapter), m = () => {
3858
+ g.$destroy(), d.parentNode.insertBefore(n, d), d.parentNode.removeChild(d), p.destroy(), s.destroy();
3859
+ }, x = () => c, A = (f, b, $) => Bo(f, b, $), w = (f, b) => go(f, b), y = (f) => {
3860
+ const { tool: b, opts: $ } = Ke(f);
3861
+ g.$set({ tool: b, opts: $ });
3862
+ }, E = (f) => g.$set({ drawingEnabled: f }), v = (f) => {
3826
3863
  console.warn("Filter not implemented yet");
3827
- }, _ = (g) => f.$set({ style: g }), C = (g) => Ce(n, d, g), N = (g) => {
3828
- c = g, f.$set({ user: g });
3864
+ }, B = (f) => g.$set({ style: f }), R = (f) => Ne(n, d, f), D = (f) => {
3865
+ c = f, g.$set({ user: f });
3829
3866
  };
3830
3867
  return {
3831
3868
  ...h,
@@ -3835,62 +3872,56 @@ const ar = () => {
3835
3872
  on: l.on,
3836
3873
  off: l.off,
3837
3874
  registerDrawingTool: A,
3838
- registerShapeEditor: $,
3839
- setDrawingEnabled: v,
3875
+ registerShapeEditor: w,
3876
+ setDrawingEnabled: E,
3840
3877
  setDrawingTool: y,
3841
- setFilter: E,
3842
- setStyle: _,
3843
- setTheme: C,
3844
- setUser: N,
3878
+ setFilter: v,
3879
+ setStyle: B,
3880
+ setTheme: R,
3881
+ setUser: D,
3845
3882
  state: r
3846
3883
  };
3847
3884
  };
3885
+ let wr = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
3886
+ wr();
3848
3887
  export {
3849
- Re as Editor,
3850
- go as EditorMount,
3851
- M as Handle,
3852
- D as Origin,
3853
- He as PointerSelectAction,
3854
- ro as PolygonEditor,
3855
- lo as RectangleEditor,
3856
- pn as RectangleUtil,
3857
- xo as RubberbandRectangle,
3858
- Jo as SVGAnnotationLayer,
3888
+ We as Editor,
3889
+ $o as EditorMount,
3890
+ O as Handle,
3891
+ lo as PolygonEditor,
3892
+ po as RectangleEditor,
3893
+ fn as RectangleUtil,
3894
+ Ao as RubberbandRectangle,
3895
+ nr as SVGAnnotationLayer,
3859
3896
  F as ShapeType,
3860
- yo as ToolMount,
3861
- pr as W3CImageFormat,
3862
- Uo as addEventListeners,
3897
+ bo as ToolMount,
3898
+ $r as W3CImageFormat,
3899
+ zo as addEventListeners,
3863
3900
  Gt as boundsFromPoints,
3864
- ne as computeArea,
3865
- Wn as createAnonymousGuest,
3866
- Hn as createBaseAnnotator,
3867
- fr as createImageAnnotator,
3868
- sr as createImageAnnotatorState,
3869
- Do as createSVGTransform,
3870
- lr as createSvelteImageAnnotatorState,
3871
- cr as detectTheme,
3872
- je as diffAnnotations,
3873
- Wt as distance,
3874
- vo as enableResponsive,
3875
- ur as fillDefaults,
3876
- we as getEditor,
3877
- qe as getTool,
3878
- hr as initKeyboardCommands,
3879
- cn as intersects,
3901
+ oe as computeArea,
3902
+ xr as createImageAnnotator,
3903
+ hr as createImageAnnotatorState,
3904
+ jo as createSVGTransform,
3905
+ pr as createSvelteImageAnnotatorState,
3906
+ fr as detectTheme,
3907
+ Kt as distance,
3908
+ Oo as enableResponsive,
3909
+ mr as fillDefaults,
3910
+ be as getEditor,
3911
+ Ke as getTool,
3912
+ yr as initKeyboardCommands,
3913
+ hn as intersects,
3880
3914
  Mo as listDrawingTools,
3881
- Fn as parseAll,
3882
- fn as parseFragmentSelector,
3883
- xn as parseSVGSelector,
3884
- Jn as parseW3CBodies,
3885
- Zn as parseW3CImageAnnotation,
3886
- co as registerEditor,
3887
- ie as registerShapeUtil,
3888
- Lo as registerTool,
3889
- dr as sampleBrightness,
3890
- gn as serializeFragmentSelector,
3891
- bn as serializeSVGSelector,
3892
- Qn as serializeW3CBodies,
3893
- to as serializeW3CImageAnnotation,
3894
- Ce as setTheme
3915
+ mn as parseFragmentSelector,
3916
+ En as parseSVGSelector,
3917
+ oo as parseW3CImageAnnotation,
3918
+ go as registerEditor,
3919
+ ae as registerShapeUtil,
3920
+ Bo as registerTool,
3921
+ gr as sampleBrightness,
3922
+ yn as serializeFragmentSelector,
3923
+ vn as serializeSVGSelector,
3924
+ ro as serializeW3CImageAnnotation,
3925
+ Ne as setTheme
3895
3926
  };
3896
3927
  //# sourceMappingURL=annotorious-react.es18.js.map