@annotorious/svelte 3.0.8 → 3.0.9

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.
@@ -2,11 +2,11 @@ var it = Object.defineProperty;
2
2
  var st = (e, t, n) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var pe = (e, t, n) => st(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { toSvelteStore as lt } from "@annotorious/core";
5
- import { Origin as Ut, UserSelectAction as qt, createAnonymousGuest as zt, createBody as Vt, defaultColorProvider as Wt } from "@annotorious/core";
6
- import { ShapeType as Ft, W3CImageFormat as Gt, createImageAnnotator as Jt } from "@annotorious/annotorious";
5
+ import { Origin as Vt, UserSelectAction as qt, createAnonymousGuest as zt, createBody as Wt, defaultColorProvider as $t } from "@annotorious/core";
6
+ import { ShapeType as Gt, W3CImageFormat as Jt, createImageAnnotator as Kt } from "@annotorious/annotorious";
7
7
  import { createOSDAnnotator as ut } from "@annotorious/openseadragon";
8
8
  import Pe from "openseadragon";
9
- function B() {
9
+ function j() {
10
10
  }
11
11
  function at(e, t) {
12
12
  for (const n in t) e[n] = t[n];
@@ -15,14 +15,14 @@ function at(e, t) {
15
15
  e
16
16
  );
17
17
  }
18
- function Ve(e) {
18
+ function ze(e) {
19
19
  return e();
20
20
  }
21
21
  function Oe() {
22
22
  return /* @__PURE__ */ Object.create(null);
23
23
  }
24
- function I(e) {
25
- e.forEach(Ve);
24
+ function H(e) {
25
+ e.forEach(ze);
26
26
  }
27
27
  function te(e) {
28
28
  return typeof e == "function";
@@ -30,20 +30,20 @@ function te(e) {
30
30
  function we(e, t) {
31
31
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
32
32
  }
33
- function ct(e) {
33
+ function ft(e) {
34
34
  return Object.keys(e).length === 0;
35
35
  }
36
- function ft(e, ...t) {
36
+ function ct(e, ...t) {
37
37
  if (e == null) {
38
38
  for (const o of t)
39
39
  o(void 0);
40
- return B;
40
+ return j;
41
41
  }
42
42
  const n = e.subscribe(...t);
43
43
  return n.unsubscribe ? () => n.unsubscribe() : n;
44
44
  }
45
45
  function We(e, t, n) {
46
- e.$$.on_destroy.push(ft(t, n));
46
+ e.$$.on_destroy.push(ct(t, n));
47
47
  }
48
48
  function $e(e, t, n, o) {
49
49
  if (e) {
@@ -85,7 +85,7 @@ function Ke(e) {
85
85
  return -1;
86
86
  }
87
87
  function dt(e) {
88
- return e && te(e.destroy) ? e.destroy : B;
88
+ return e && te(e.destroy) ? e.destroy : j;
89
89
  }
90
90
  function pt(e, t) {
91
91
  e.appendChild(t);
@@ -105,7 +105,7 @@ function Ze(e) {
105
105
  function Ee() {
106
106
  return Ze("");
107
107
  }
108
- function je(e, t, n, o) {
108
+ function Be(e, t, n, o) {
109
109
  return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
110
110
  }
111
111
  function Z(e, t, n) {
@@ -122,105 +122,105 @@ let $;
122
122
  function W(e) {
123
123
  $ = e;
124
124
  }
125
- function xe() {
125
+ function Se() {
126
126
  if (!$) throw new Error("Function called outside component initialization");
127
127
  return $;
128
128
  }
129
129
  function et(e) {
130
- xe().$$.on_mount.push(e);
130
+ Se().$$.on_mount.push(e);
131
131
  }
132
- function Be(e, t) {
133
- return xe().$$.context.set(e, t), t;
132
+ function je(e, t) {
133
+ return Se().$$.context.set(e, t), t;
134
134
  }
135
135
  function mt(e) {
136
- return xe().$$.context.get(e);
136
+ return Se().$$.context.get(e);
137
137
  }
138
- const X = [], Te = [];
139
- let Y = [];
140
- const Re = [], _t = /* @__PURE__ */ Promise.resolve();
138
+ const R = [], Te = [];
139
+ let X = [];
140
+ const Ie = [], _t = /* @__PURE__ */ Promise.resolve();
141
141
  let ye = !1;
142
142
  function yt() {
143
143
  ye || (ye = !0, _t.then(tt));
144
144
  }
145
- function be(e) {
146
- Y.push(e);
145
+ function ve(e) {
146
+ X.push(e);
147
147
  }
148
148
  const ge = /* @__PURE__ */ new Set();
149
- let R = 0;
149
+ let I = 0;
150
150
  function tt() {
151
- if (R !== 0)
151
+ if (I !== 0)
152
152
  return;
153
153
  const e = $;
154
154
  do {
155
155
  try {
156
- for (; R < X.length; ) {
157
- const t = X[R];
158
- R++, W(t), bt(t.$$);
156
+ for (; I < R.length; ) {
157
+ const t = R[I];
158
+ I++, W(t), vt(t.$$);
159
159
  }
160
160
  } catch (t) {
161
- throw X.length = 0, R = 0, t;
161
+ throw R.length = 0, I = 0, t;
162
162
  }
163
- for (W(null), X.length = 0, R = 0; Te.length; ) Te.pop()();
164
- for (let t = 0; t < Y.length; t += 1) {
165
- const n = Y[t];
163
+ for (W(null), R.length = 0, I = 0; Te.length; ) Te.pop()();
164
+ for (let t = 0; t < X.length; t += 1) {
165
+ const n = X[t];
166
166
  ge.has(n) || (ge.add(n), n());
167
167
  }
168
- Y.length = 0;
169
- } while (X.length);
170
- for (; Re.length; )
171
- Re.pop()();
168
+ X.length = 0;
169
+ } while (R.length);
170
+ for (; Ie.length; )
171
+ Ie.pop()();
172
172
  ye = !1, ge.clear(), W(e);
173
173
  }
174
- function bt(e) {
174
+ function vt(e) {
175
175
  if (e.fragment !== null) {
176
- e.update(), I(e.before_update);
176
+ e.update(), H(e.before_update);
177
177
  const t = e.dirty;
178
- e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(be);
178
+ e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(ve);
179
179
  }
180
180
  }
181
- function vt(e) {
181
+ function bt(e) {
182
182
  const t = [], n = [];
183
- Y.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Y = t;
183
+ X.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), X = t;
184
184
  }
185
185
  const ee = /* @__PURE__ */ new Set();
186
- let j;
186
+ let B;
187
187
  function nt() {
188
- j = {
188
+ B = {
189
189
  r: 0,
190
190
  c: [],
191
- p: j
191
+ p: B
192
192
  // parent group
193
193
  };
194
194
  }
195
195
  function ot() {
196
- j.r || I(j.c), j = j.p;
196
+ B.r || H(B.c), B = B.p;
197
197
  }
198
- function L(e, t) {
198
+ function D(e, t) {
199
199
  e && e.i && (ee.delete(e), e.i(t));
200
200
  }
201
- function H(e, t, n, o) {
201
+ function Y(e, t, n, o) {
202
202
  if (e && e.o) {
203
203
  if (ee.has(e)) return;
204
- ee.add(e), j.c.push(() => {
204
+ ee.add(e), B.c.push(() => {
205
205
  ee.delete(e), o && (n && e.d(1), o());
206
206
  }), e.o(t);
207
207
  } else o && o();
208
208
  }
209
209
  function wt(e, t, n) {
210
210
  const { fragment: o, after_update: r } = e.$$;
211
- o && o.m(t, n), be(() => {
212
- const i = e.$$.on_mount.map(Ve).filter(te);
213
- e.$$.on_destroy ? e.$$.on_destroy.push(...i) : I(i), e.$$.on_mount = [];
214
- }), r.forEach(be);
211
+ o && o.m(t, n), ve(() => {
212
+ const i = e.$$.on_mount.map(ze).filter(te);
213
+ e.$$.on_destroy ? e.$$.on_destroy.push(...i) : H(i), e.$$.on_mount = [];
214
+ }), r.forEach(ve);
215
215
  }
216
216
  function Et(e, t) {
217
217
  const n = e.$$;
218
- n.fragment !== null && (vt(n.after_update), I(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
218
+ n.fragment !== null && (bt(n.after_update), H(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
219
219
  }
220
- function xt(e, t) {
221
- e.$$.dirty[0] === -1 && (X.push(e), yt(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
220
+ function St(e, t) {
221
+ e.$$.dirty[0] === -1 && (R.push(e), yt(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
222
222
  }
223
- function Se(e, t, n, o, r, i, s = null, u = [-1]) {
223
+ function xe(e, t, n, o, r, i, s = null, u = [-1]) {
224
224
  const d = $;
225
225
  W(e);
226
226
  const a = e.$$ = {
@@ -228,7 +228,7 @@ function Se(e, t, n, o, r, i, s = null, u = [-1]) {
228
228
  ctx: [],
229
229
  // state
230
230
  props: i,
231
- update: B,
231
+ update: j,
232
232
  not_equal: r,
233
233
  bound: Oe(),
234
234
  // lifecycle
@@ -246,16 +246,16 @@ function Se(e, t, n, o, r, i, s = null, u = [-1]) {
246
246
  };
247
247
  s && s(a.root);
248
248
  let y = !1;
249
- if (a.ctx = n ? n(e, t.props || {}, (g, m, ...v) => {
250
- const c = v.length ? v[0] : m;
251
- return a.ctx && r(a.ctx[g], a.ctx[g] = c) && (!a.skip_bound && a.bound[g] && a.bound[g](c), y && xt(e, g)), m;
252
- }) : [], a.update(), y = !0, I(a.before_update), a.fragment = o ? o(a.ctx) : !1, t.target) {
249
+ if (a.ctx = n ? n(e, t.props || {}, (g, m, ...b) => {
250
+ const f = b.length ? b[0] : m;
251
+ return a.ctx && r(a.ctx[g], a.ctx[g] = f) && (!a.skip_bound && a.bound[g] && a.bound[g](f), y && St(e, g)), m;
252
+ }) : [], a.update(), y = !0, H(a.before_update), a.fragment = o ? o(a.ctx) : !1, t.target) {
253
253
  if (t.hydrate) {
254
254
  const g = gt(t.target);
255
255
  a.fragment && a.fragment.l(g), g.forEach(U);
256
256
  } else
257
257
  a.fragment && a.fragment.c();
258
- t.intro && L(e.$$.fragment), wt(e, t.target, t.anchor), tt();
258
+ t.intro && D(e.$$.fragment), wt(e, t.target, t.anchor), tt();
259
259
  }
260
260
  W(d);
261
261
  }
@@ -280,7 +280,7 @@ class Ae {
280
280
  }
281
281
  /** @returns {void} */
282
282
  $destroy() {
283
- Et(this, 1), this.$destroy = B;
283
+ Et(this, 1), this.$destroy = j;
284
284
  }
285
285
  /**
286
286
  * @template {Extract<keyof Events, string>} K
@@ -290,7 +290,7 @@ class Ae {
290
290
  */
291
291
  $on(t, n) {
292
292
  if (!te(n))
293
- return B;
293
+ return j;
294
294
  const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
295
295
  return o.push(n), () => {
296
296
  const r = o.indexOf(n);
@@ -302,10 +302,12 @@ class Ae {
302
302
  * @returns {void}
303
303
  */
304
304
  $set(t) {
305
- this.$$set && !ct(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
305
+ this.$$set && !ft(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
306
306
  }
307
307
  }
308
- function Xe(e) {
308
+ const xt = "4";
309
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(xt);
310
+ function Re(e) {
309
311
  let t;
310
312
  const n = (
311
313
  /*#slots*/
@@ -346,20 +348,20 @@ function Xe(e) {
346
348
  );
347
349
  },
348
350
  i(r) {
349
- t || (L(o, r), t = !0);
351
+ t || (D(o, r), t = !0);
350
352
  },
351
353
  o(r) {
352
- H(o, r), t = !1;
354
+ Y(o, r), t = !1;
353
355
  },
354
356
  d(r) {
355
357
  o && o.d(r);
356
358
  }
357
359
  };
358
360
  }
359
- function St(e) {
361
+ function At(e) {
360
362
  let t, n, o = (
361
363
  /*viewer*/
362
- e[0] && Xe(e)
364
+ e[0] && Re(e)
363
365
  );
364
366
  return {
365
367
  c() {
@@ -371,22 +373,22 @@ function St(e) {
371
373
  p(r, [i]) {
372
374
  /*viewer*/
373
375
  r[0] ? o ? (o.p(r, i), i & /*viewer*/
374
- 1 && L(o, 1)) : (o = Xe(r), o.c(), L(o, 1), o.m(t.parentNode, t)) : o && (nt(), H(o, 1, 1, () => {
376
+ 1 && D(o, 1)) : (o = Re(r), o.c(), D(o, 1), o.m(t.parentNode, t)) : o && (nt(), Y(o, 1, 1, () => {
375
377
  o = null;
376
378
  }), ot());
377
379
  },
378
380
  i(r) {
379
- n || (L(o), n = !0);
381
+ n || (D(o), n = !0);
380
382
  },
381
383
  o(r) {
382
- H(o), n = !1;
384
+ Y(o), n = !1;
383
385
  },
384
386
  d(r) {
385
387
  r && U(t), o && o.d(r);
386
388
  }
387
389
  };
388
390
  }
389
- function At(e, t, n) {
391
+ function Ct(e, t, n) {
390
392
  let { $$slots: o = {}, $$scope: r } = t, { viewer: i } = t, { opts: s = {} } = t, { anno: u = void 0 } = t;
391
393
  const d = (a) => {
392
394
  if (a) {
@@ -394,7 +396,7 @@ function At(e, t, n) {
394
396
  ...y,
395
397
  state: { ...y.state, store: g }
396
398
  };
397
- Be("anno", m), Be("viewer", a), n(1, u = m);
399
+ je("anno", m), je("viewer", a), n(1, u = m);
398
400
  }
399
401
  };
400
402
  return e.$$set = (a) => {
@@ -406,16 +408,16 @@ function At(e, t, n) {
406
408
  }
407
409
  class Rt extends Ae {
408
410
  constructor(t) {
409
- super(), Se(this, t, At, St, we, { viewer: 0, opts: 2, anno: 1 });
411
+ super(), xe(this, t, Ct, At, we, { viewer: 0, opts: 2, anno: 1 });
410
412
  }
411
413
  }
412
- var he = { dragStart: !0 }, Ye = (e, t, n) => Math.min(Math.max(e, t), n), me = (e) => typeof e == "string", Ct = ([e, t], n, o) => {
414
+ var he = { dragStart: !0 }, Xe = (e, t, n) => Math.min(Math.max(e, t), n), me = (e) => typeof e == "string", Nt = ([e, t], n, o) => {
413
415
  const r = (i, s) => s === 0 ? 0 : Math.ceil(i / s) * s;
414
416
  return [r(n, e), r(o, t)];
415
- }, He = (e, t) => e.some((n) => t.some((o) => n.contains(o)));
417
+ }, Ye = (e, t) => e.some((n) => t.some((o) => n.contains(o)));
416
418
  function _e(e, t) {
417
419
  if (e === void 0) return;
418
- if (ve(e)) return e.getBoundingClientRect();
420
+ if (be(e)) return e.getBoundingClientRect();
419
421
  if (typeof e == "object") {
420
422
  const { top: o = 0, left: r = 0, right: i = 0, bottom: s = 0 } = e;
421
423
  return { top: o, right: window.innerWidth - i, bottom: window.innerHeight - s, left: r };
@@ -425,93 +427,93 @@ function _e(e, t) {
425
427
  if (n === null) throw new Error("The selector provided for bound doesn't exists in the document.");
426
428
  return n.getBoundingClientRect();
427
429
  }
428
- var Q = (e, t, n) => e.style.setProperty(t, n), ve = (e) => e instanceof HTMLElement, Nt = (e, t = {}) => {
429
- let n, o, { bounds: r, axis: i = "both", gpuAcceleration: s = !0, legacyTranslate: u = !0, transform: d, applyUserSelectHack: a = !0, disabled: y = !1, ignoreMultitouch: g = !1, recomputeBounds: m = he, grid: v, position: c, cancel: A, handle: w, defaultClass: f = "neodrag", defaultClassDragging: S = "neodrag-dragging", defaultClassDragged: C = "neodrag-dragged", defaultPosition: ne = { x: 0, y: 0 }, onDragStart: oe, onDrag: re, onDragEnd: ie } = t, T = !1, N = 0, k = 0, q = 0, z = 0, se = 0, le = 0, { x: G, y: J } = c ? { x: (c == null ? void 0 : c.x) ?? 0, y: (c == null ? void 0 : c.y) ?? 0 } : ne;
430
- ce(G, J);
431
- let M, O, V, ue, Ce, Ne = "", rt = !!c;
430
+ var Q = (e, t, n) => e.style.setProperty(t, n), be = (e) => e instanceof HTMLElement, kt = (e, t = {}) => {
431
+ let n, o, { bounds: r, axis: i = "both", gpuAcceleration: s = !0, legacyTranslate: u = !0, transform: d, applyUserSelectHack: a = !0, disabled: y = !1, ignoreMultitouch: g = !1, recomputeBounds: m = he, grid: b, position: f, cancel: A, handle: w, defaultClass: c = "neodrag", defaultClassDragging: x = "neodrag-dragging", defaultClassDragged: C = "neodrag-dragged", defaultPosition: ne = { x: 0, y: 0 }, onDragStart: oe, onDrag: re, onDragEnd: ie } = t, T = !1, N = 0, k = 0, V = 0, q = 0, se = 0, le = 0, { x: G, y: J } = f ? { x: (f == null ? void 0 : f.x) ?? 0, y: (f == null ? void 0 : f.y) ?? 0 } : ne;
432
+ fe(G, J);
433
+ let L, O, z, ue, Ce, Ne = "", rt = !!f;
432
434
  m = { ...he, ...m };
433
435
  let K = /* @__PURE__ */ new Set();
434
436
  const ae = document.body.style, P = e.classList;
435
- function ce(l = N, h = k) {
437
+ function fe(l = N, h = k) {
436
438
  if (!d) {
437
439
  if (u) {
438
- let b = `${+l}px, ${+h}px`;
439
- return Q(e, "transform", s ? `translate3d(${b}, 0)` : `translate(${b})`);
440
+ let v = `${+l}px, ${+h}px`;
441
+ return Q(e, "transform", s ? `translate3d(${v}, 0)` : `translate(${v})`);
440
442
  }
441
443
  return Q(e, "translate", `${+l}px ${+h}px ${s ? "1px" : ""}`);
442
444
  }
443
445
  const _ = d({ offsetX: l, offsetY: h, rootNode: e });
444
446
  me(_) && Q(e, "transform", _);
445
447
  }
446
- const fe = (l, h) => {
448
+ const ce = (l, h) => {
447
449
  const _ = { offsetX: N, offsetY: k, rootNode: e, currentNode: Ce };
448
450
  e.dispatchEvent(new CustomEvent(l, { detail: _ })), h == null || h(_);
449
451
  }, de = addEventListener;
450
- de("pointerdown", Me, !1), de("pointerup", De, !1), de("pointermove", Le, !1), Q(e, "touch-action", "none");
452
+ de("pointerdown", Le, !1), de("pointerup", Me, !1), de("pointermove", De, !1), Q(e, "touch-action", "none");
451
453
  const ke = () => {
452
454
  let l = e.offsetWidth / O.width;
453
455
  return isNaN(l) && (l = 1), l;
454
456
  };
455
- function Me(l) {
457
+ function Le(l) {
456
458
  if (y || l.button === 2) return;
457
459
  if (K.add(l.pointerId), g && K.size > 1) return l.preventDefault();
458
- if (m.dragStart && (M = _e(r, e)), me(w) && me(A) && w === A) throw new Error("`handle` selector can't be same as `cancel` selector");
459
- if (P.add(f), V = function(p, x) {
460
- if (!p) return [x];
461
- if (ve(p)) return [p];
460
+ if (m.dragStart && (L = _e(r, e)), me(w) && me(A) && w === A) throw new Error("`handle` selector can't be same as `cancel` selector");
461
+ if (P.add(c), z = function(p, S) {
462
+ if (!p) return [S];
463
+ if (be(p)) return [p];
462
464
  if (Array.isArray(p)) return p;
463
- const D = x.querySelectorAll(p);
464
- if (D === null) throw new Error("Selector passed for `handle` option should be child of the element on which the action is applied");
465
- return Array.from(D.values());
466
- }(w, e), ue = function(p, x) {
465
+ const M = S.querySelectorAll(p);
466
+ if (M === null) throw new Error("Selector passed for `handle` option should be child of the element on which the action is applied");
467
+ return Array.from(M.values());
468
+ }(w, e), ue = function(p, S) {
467
469
  if (!p) return [];
468
- if (ve(p)) return [p];
470
+ if (be(p)) return [p];
469
471
  if (Array.isArray(p)) return p;
470
- const D = x.querySelectorAll(p);
471
- if (D === null) throw new Error("Selector passed for `cancel` option should be child of the element on which the action is applied");
472
- return Array.from(D.values());
473
- }(A, e), n = /(both|x)/.test(i), o = /(both|y)/.test(i), He(ue, V)) throw new Error("Element being dragged can't be a child of the element on which `cancel` is applied");
472
+ const M = S.querySelectorAll(p);
473
+ if (M === null) throw new Error("Selector passed for `cancel` option should be child of the element on which the action is applied");
474
+ return Array.from(M.values());
475
+ }(A, e), n = /(both|x)/.test(i), o = /(both|y)/.test(i), Ye(ue, z)) throw new Error("Element being dragged can't be a child of the element on which `cancel` is applied");
474
476
  const h = l.composedPath()[0];
475
- if (!V.some((p) => {
476
- var x;
477
- return p.contains(h) || ((x = p.shadowRoot) == null ? void 0 : x.contains(h));
478
- }) || He(ue, [h])) return;
479
- Ce = V.length === 1 ? e : V.find((p) => p.contains(h)), T = !0, O = e.getBoundingClientRect(), a && (Ne = ae.userSelect, ae.userSelect = "none"), fe("neodrag:start", oe);
480
- const { clientX: _, clientY: b } = l, E = ke();
481
- n && (q = _ - G / E), o && (z = b - J / E), M && (se = _ - O.left, le = b - O.top);
477
+ if (!z.some((p) => {
478
+ var S;
479
+ return p.contains(h) || ((S = p.shadowRoot) == null ? void 0 : S.contains(h));
480
+ }) || Ye(ue, [h])) return;
481
+ Ce = z.length === 1 ? e : z.find((p) => p.contains(h)), T = !0, O = e.getBoundingClientRect(), a && (Ne = ae.userSelect, ae.userSelect = "none"), ce("neodrag:start", oe);
482
+ const { clientX: _, clientY: v } = l, E = ke();
483
+ n && (V = _ - G / E), o && (q = v - J / E), L && (se = _ - O.left, le = v - O.top);
482
484
  }
483
- function De(l) {
484
- K.delete(l.pointerId), T && (m.dragEnd && (M = _e(r, e)), P.remove(S), P.add(C), a && (ae.userSelect = Ne), fe("neodrag:end", ie), n && (q = N), o && (z = k), T = !1);
485
+ function Me(l) {
486
+ K.delete(l.pointerId), T && (m.dragEnd && (L = _e(r, e)), P.remove(x), P.add(C), a && (ae.userSelect = Ne), ce("neodrag:end", ie), n && (V = N), o && (q = k), T = !1);
485
487
  }
486
- function Le(l) {
488
+ function De(l) {
487
489
  if (!T || g && K.size > 1) return;
488
- m.drag && (M = _e(r, e)), P.add(S), l.preventDefault(), O = e.getBoundingClientRect();
490
+ m.drag && (L = _e(r, e)), P.add(x), l.preventDefault(), O = e.getBoundingClientRect();
489
491
  let h = l.clientX, _ = l.clientY;
490
- const b = ke();
491
- if (M) {
492
- const E = { left: M.left + se, top: M.top + le, right: M.right + se - O.width, bottom: M.bottom + le - O.height };
493
- h = Ye(h, E.left, E.right), _ = Ye(_, E.top, E.bottom);
492
+ const v = ke();
493
+ if (L) {
494
+ const E = { left: L.left + se, top: L.top + le, right: L.right + se - O.width, bottom: L.bottom + le - O.height };
495
+ h = Xe(h, E.left, E.right), _ = Xe(_, E.top, E.bottom);
494
496
  }
495
- if (Array.isArray(v)) {
496
- let [E, p] = v;
497
+ if (Array.isArray(b)) {
498
+ let [E, p] = b;
497
499
  if (isNaN(+E) || E < 0) throw new Error("1st argument of `grid` must be a valid positive number");
498
500
  if (isNaN(+p) || p < 0) throw new Error("2nd argument of `grid` must be a valid positive number");
499
- let x = h - q, D = _ - z;
500
- [x, D] = Ct([E / b, p / b], x, D), h = q + x, _ = z + D;
501
+ let S = h - V, M = _ - q;
502
+ [S, M] = Nt([E / v, p / v], S, M), h = V + S, _ = q + M;
501
503
  }
502
- n && (N = Math.round((h - q) * b)), o && (k = Math.round((_ - z) * b)), G = N, J = k, fe("neodrag", re), ce();
504
+ n && (N = Math.round((h - V) * v)), o && (k = Math.round((_ - q) * v)), G = N, J = k, ce("neodrag", re), fe();
503
505
  }
504
506
  return { destroy: () => {
505
507
  const l = removeEventListener;
506
- l("pointerdown", Me, !1), l("pointerup", De, !1), l("pointermove", Le, !1);
508
+ l("pointerdown", Le, !1), l("pointerup", Me, !1), l("pointermove", De, !1);
507
509
  }, update: (l) => {
508
- var _, b;
509
- i = l.axis || "both", y = l.disabled ?? !1, g = l.ignoreMultitouch ?? !1, w = l.handle, r = l.bounds, m = l.recomputeBounds ?? he, A = l.cancel, a = l.applyUserSelectHack ?? !0, v = l.grid, s = l.gpuAcceleration ?? !0, u = l.legacyTranslate ?? !0, d = l.transform;
510
+ var _, v;
511
+ i = l.axis || "both", y = l.disabled ?? !1, g = l.ignoreMultitouch ?? !1, w = l.handle, r = l.bounds, m = l.recomputeBounds ?? he, A = l.cancel, a = l.applyUserSelectHack ?? !0, b = l.grid, s = l.gpuAcceleration ?? !0, u = l.legacyTranslate ?? !0, d = l.transform;
510
512
  const h = P.contains(C);
511
- P.remove(f, C), f = l.defaultClass ?? "neodrag", S = l.defaultClassDragging ?? "neodrag-dragging", C = l.defaultClassDragged ?? "neodrag-dragged", P.add(f), h && P.add(C), rt && (G = N = ((_ = l.position) == null ? void 0 : _.x) ?? N, J = k = ((b = l.position) == null ? void 0 : b.y) ?? k, ce());
513
+ P.remove(c, C), c = l.defaultClass ?? "neodrag", x = l.defaultClassDragging ?? "neodrag-dragging", C = l.defaultClassDragged ?? "neodrag-dragged", P.add(c), h && P.add(C), rt && (G = N = ((_ = l.position) == null ? void 0 : _.x) ?? N, J = k = ((v = l.position) == null ? void 0 : v.y) ?? k, fe());
512
514
  } };
513
515
  };
514
- function Ie(e) {
516
+ function He(e) {
515
517
  let t, n = (
516
518
  /*$selection*/
517
519
  e[0].selected.map(Ue).join(", ") + ""
@@ -522,7 +524,7 @@ function Ie(e) {
522
524
  },
523
525
  m(u, d) {
524
526
  F(u, t, d), pt(t, o), i || (s = [
525
- dt(r = Nt.call(null, t, {
527
+ dt(r = kt.call(null, t, {
526
528
  position: { x: (
527
529
  /*left*/
528
530
  e[1]
@@ -531,13 +533,13 @@ function Ie(e) {
531
533
  e[2]
532
534
  ) }
533
535
  })),
534
- je(
536
+ Be(
535
537
  t,
536
538
  "neodrag:start",
537
539
  /*onDragStart*/
538
540
  e[4]
539
541
  ),
540
- je(
542
+ Be(
541
543
  t,
542
544
  "neodrag:end",
543
545
  /*onDragEnd*/
@@ -560,14 +562,14 @@ function Ie(e) {
560
562
  });
561
563
  },
562
564
  d(u) {
563
- u && U(t), i = !1, I(s);
565
+ u && U(t), i = !1, H(s);
564
566
  }
565
567
  };
566
568
  }
567
- function kt(e) {
569
+ function Lt(e) {
568
570
  let t, n = (
569
571
  /*$selection*/
570
- e[0] && Ie(e)
572
+ e[0] && He(e)
571
573
  );
572
574
  return {
573
575
  c() {
@@ -578,10 +580,10 @@ function kt(e) {
578
580
  },
579
581
  p(o, [r]) {
580
582
  /*$selection*/
581
- o[0] ? n ? n.p(o, r) : (n = Ie(o), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
583
+ o[0] ? n ? n.p(o, r) : (n = He(o), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
582
584
  },
583
- i: B,
584
- o: B,
585
+ i: j,
586
+ o: j,
585
587
  d(o) {
586
588
  o && U(t), n && n.d(o);
587
589
  }
@@ -591,49 +593,49 @@ const Ue = (e) => e.id;
591
593
  function Mt(e, t, n) {
592
594
  let o, { state: r } = t, { viewer: i } = t, s, u, d = !1, a;
593
595
  const { selection: y, store: g } = r;
594
- We(e, y, (f) => n(0, o = f));
595
- const m = (f) => {
596
- var S;
597
- return ((S = f.selected) == null ? void 0 : S.length) > 0;
598
- }, v = () => {
596
+ We(e, y, (c) => n(0, o = c));
597
+ const m = (c) => {
598
+ var x;
599
+ return ((x = c.selected) == null ? void 0 : x.length) > 0;
600
+ }, b = () => {
599
601
  d = !0, i.setMouseNavEnabled(!1);
600
- }, c = () => {
602
+ }, f = () => {
601
603
  i.setMouseNavEnabled(!0);
602
604
  }, A = () => {
603
- a && g.unobserve(a), m(o) && (d = !1, w(o), a = (f) => {
605
+ a && g.unobserve(a), m(o) && (d = !1, w(o), a = (c) => {
604
606
  d || w(o);
605
607
  }, g.observe(a, {
606
- annotations: o.selected.map((f) => f.id)
608
+ annotations: o.selected.map((c) => c.id)
607
609
  }));
608
- }, w = (f) => {
609
- const S = f.selected[0].id, C = g.getAnnotation(S), { minX: ne, minY: oe, maxX: re, maxY: ie } = C.target.selector.geometry.bounds, T = 14, N = i.viewport.imageToViewerElementCoordinates(new Pe.Point(ne, oe)), k = i.viewport.imageToViewerElementCoordinates(new Pe.Point(re, ie));
610
+ }, w = (c) => {
611
+ const x = c.selected[0].id, C = g.getAnnotation(x), { minX: ne, minY: oe, maxX: re, maxY: ie } = C.target.selector.geometry.bounds, T = 14, N = i.viewport.imageToViewerElementCoordinates(new Pe.Point(ne, oe)), k = i.viewport.imageToViewerElementCoordinates(new Pe.Point(re, ie));
610
612
  n(1, s = k.x + T), n(2, u = N.y);
611
613
  };
612
614
  return et(() => {
613
- const f = () => {
615
+ const c = () => {
614
616
  m(o) && !d && w(o);
615
617
  };
616
- return i.addHandler("update-viewport", f), () => {
617
- i.removeHandler("update-viewport", f);
618
+ return i.addHandler("update-viewport", c), () => {
619
+ i.removeHandler("update-viewport", c);
618
620
  };
619
- }), e.$$set = (f) => {
620
- "state" in f && n(6, r = f.state), "viewer" in f && n(7, i = f.viewer);
621
+ }), e.$$set = (c) => {
622
+ "state" in c && n(6, r = c.state), "viewer" in c && n(7, i = c.viewer);
621
623
  }, e.$$.update = () => {
622
624
  e.$$.dirty & /*$selection*/
623
625
  1 && A();
624
- }, [o, s, u, y, v, c, r, i];
626
+ }, [o, s, u, y, b, f, r, i];
625
627
  }
626
628
  class Xt extends Ae {
627
629
  constructor(t) {
628
- super(), Se(this, t, Mt, kt, we, { state: 6, viewer: 7 });
630
+ super(), xe(this, t, Mt, Lt, we, { state: 6, viewer: 7 });
629
631
  }
630
632
  }
631
633
  const Dt = (e) => ({ hovered: e & /*hovered*/
632
- 16 }), qe = (e) => ({ hovered: (
634
+ 16 }), Ve = (e) => ({ hovered: (
633
635
  /*hovered*/
634
636
  e[4]
635
637
  ) });
636
- function ze(e) {
638
+ function qe(e) {
637
639
  let t, n, o;
638
640
  const r = (
639
641
  /*#slots*/
@@ -643,7 +645,7 @@ function ze(e) {
643
645
  e,
644
646
  /*$$scope*/
645
647
  e[7],
646
- qe
648
+ Ve
647
649
  );
648
650
  return {
649
651
  c() {
@@ -672,28 +674,28 @@ function ze(e) {
672
674
  /*$$scope*/
673
675
  s[7]
674
676
  ),
675
- qe
677
+ Ve
676
678
  ), (!o || u & /*left, top*/
677
679
  6 && n !== (n = `left:${/*left*/
678
680
  s[2]}px; top:${/*top*/
679
681
  s[1]}px; position: absolute;`)) && Z(t, "style", n);
680
682
  },
681
683
  i(s) {
682
- o || (L(i, s), o = !0);
684
+ o || (D(i, s), o = !0);
683
685
  },
684
686
  o(s) {
685
- H(i, s), o = !1;
687
+ Y(i, s), o = !1;
686
688
  },
687
689
  d(s) {
688
690
  s && U(t), i && i.d(s);
689
691
  }
690
692
  };
691
693
  }
692
- function Lt(e) {
694
+ function Pt(e) {
693
695
  let t, n, o = (
694
696
  /*$hover*/
695
697
  e[0] && /*show*/
696
- e[3] && ze(e)
698
+ e[3] && qe(e)
697
699
  );
698
700
  return {
699
701
  c() {
@@ -706,61 +708,61 @@ function Lt(e) {
706
708
  /*$hover*/
707
709
  r[0] && /*show*/
708
710
  r[3] ? o ? (o.p(r, i), i & /*$hover, show*/
709
- 9 && L(o, 1)) : (o = ze(r), o.c(), L(o, 1), o.m(t.parentNode, t)) : o && (nt(), H(o, 1, 1, () => {
711
+ 9 && D(o, 1)) : (o = qe(r), o.c(), D(o, 1), o.m(t.parentNode, t)) : o && (nt(), Y(o, 1, 1, () => {
710
712
  o = null;
711
713
  }), ot());
712
714
  },
713
715
  i(r) {
714
- n || (L(o), n = !0);
716
+ n || (D(o), n = !0);
715
717
  },
716
718
  o(r) {
717
- H(o), n = !1;
719
+ Y(o), n = !1;
718
720
  },
719
721
  d(r) {
720
722
  r && U(t), o && o.d(r);
721
723
  }
722
724
  };
723
725
  }
724
- function Pt(e, t, n) {
726
+ function Ot(e, t, n) {
725
727
  let o, r, { $$slots: i = {}, $$scope: s } = t, { container: u } = t;
726
728
  const d = mt("anno"), { store: a, hover: y } = d.state;
727
- We(e, y, (c) => n(0, r = c));
728
- let g, m, v = !0;
729
+ We(e, y, (f) => n(0, r = f));
730
+ let g, m, b = !0;
729
731
  return et(() => {
730
- const c = () => {
731
- n(3, v = !0);
732
- }, A = (f) => {
733
- const { offsetX: S, offsetY: C } = f;
734
- n(2, m = S), n(1, g = C);
732
+ const f = () => {
733
+ n(3, b = !0);
734
+ }, A = (c) => {
735
+ const { offsetX: x, offsetY: C } = c;
736
+ n(2, m = x), n(1, g = C);
735
737
  }, w = () => {
736
- n(3, v = !1);
738
+ n(3, b = !1);
737
739
  };
738
- return u.addEventListener("pointerenter", c), u.addEventListener("pointermove", A), u.addEventListener("pointerleave", w), () => {
739
- u.removeEventListener("pointerenter", c), u.removeEventListener("pointermove", A), u.removeEventListener("pointerleave", w);
740
+ return u.addEventListener("pointerenter", f), u.addEventListener("pointermove", A), u.addEventListener("pointerleave", w), () => {
741
+ u.removeEventListener("pointerenter", f), u.removeEventListener("pointermove", A), u.removeEventListener("pointerleave", w);
740
742
  };
741
- }), e.$$set = (c) => {
742
- "container" in c && n(6, u = c.container), "$$scope" in c && n(7, s = c.$$scope);
743
+ }), e.$$set = (f) => {
744
+ "container" in f && n(6, u = f.container), "$$scope" in f && n(7, s = f.$$scope);
743
745
  }, e.$$.update = () => {
744
746
  e.$$.dirty & /*$hover*/
745
747
  1 && n(4, o = r ? a.getAnnotation(r) : void 0);
746
- }, [r, g, m, v, o, y, u, s, i];
748
+ }, [r, g, m, b, o, y, u, s, i];
747
749
  }
748
750
  class Yt extends Ae {
749
751
  constructor(t) {
750
- super(), Se(this, t, Pt, Lt, we, { container: 6 });
752
+ super(), xe(this, t, Ot, Pt, we, { container: 6 });
751
753
  }
752
754
  }
753
755
  export {
754
756
  Yt as MouseOverTooltip,
755
757
  Rt as OpenSeadragonAnnotator,
756
758
  Xt as OpenSeadragonPopup,
757
- Ut as Origin,
758
- Ft as ShapeType,
759
+ Vt as Origin,
760
+ Gt as ShapeType,
759
761
  qt as UserSelectAction,
760
- Gt as W3CImageFormat,
762
+ Jt as W3CImageFormat,
761
763
  zt as createAnonymousGuest,
762
- Vt as createBody,
763
- Jt as createImageAnnotator,
764
- Wt as defaultColorProvider
764
+ Wt as createBody,
765
+ Kt as createImageAnnotator,
766
+ $t as defaultColorProvider
765
767
  };
766
768
  //# sourceMappingURL=annotorious-svelte.es.js.map