@annotorious/react-manifold 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/annotorious-react-manifold.es.js +17 -17
  2. package/dist/annotorious-react-manifold.es10.js +599 -8
  3. package/dist/annotorious-react-manifold.es10.js.map +1 -1
  4. package/dist/annotorious-react-manifold.es11.js +2 -8
  5. package/dist/annotorious-react-manifold.es11.js.map +1 -1
  6. package/dist/annotorious-react-manifold.es12.js +2 -16
  7. package/dist/annotorious-react-manifold.es12.js.map +1 -1
  8. package/dist/annotorious-react-manifold.es2.js +17 -13
  9. package/dist/annotorious-react-manifold.es2.js.map +1 -1
  10. package/dist/annotorious-react-manifold.es3.js +14 -58
  11. package/dist/annotorious-react-manifold.es3.js.map +1 -1
  12. package/dist/annotorious-react-manifold.es4.js +12 -50
  13. package/dist/annotorious-react-manifold.es4.js.map +1 -1
  14. package/dist/annotorious-react-manifold.es5.js +59 -19
  15. package/dist/annotorious-react-manifold.es5.js.map +1 -1
  16. package/dist/annotorious-react-manifold.es6.js +48 -14
  17. package/dist/annotorious-react-manifold.es6.js.map +1 -1
  18. package/dist/annotorious-react-manifold.es7.js +3 -3
  19. package/dist/annotorious-react-manifold.es8.js +2 -46
  20. package/dist/annotorious-react-manifold.es8.js.map +1 -1
  21. package/dist/annotorious-react-manifold.es9.js +29 -1116
  22. package/dist/annotorious-react-manifold.es9.js.map +1 -1
  23. package/package.json +2 -5
  24. package/dist/annotorious-react-manifold.es13.js +0 -5
  25. package/dist/annotorious-react-manifold.es13.js.map +0 -1
  26. package/dist/annotorious-react-manifold.es14.js +0 -33
  27. package/dist/annotorious-react-manifold.es14.js.map +0 -1
  28. package/dist/annotorious-react-manifold.es15.js +0 -602
  29. package/dist/annotorious-react-manifold.es15.js.map +0 -1
  30. package/dist/annotorious-react-manifold.es16.js +0 -5
  31. package/dist/annotorious-react-manifold.es16.js.map +0 -1
  32. package/dist/annotorious-react-manifold.es17.js +0 -5
  33. package/dist/annotorious-react-manifold.es17.js.map +0 -1
  34. package/dist/annotorious-react-manifold.es18.js +0 -7
  35. package/dist/annotorious-react-manifold.es18.js.map +0 -1
  36. package/dist/annotorious-react-manifold.es19.js +0 -9
  37. package/dist/annotorious-react-manifold.es19.js.map +0 -1
  38. package/dist/annotorious-react-manifold.es20.js +0 -5
  39. package/dist/annotorious-react-manifold.es20.js.map +0 -1
  40. package/dist/annotorious-react-manifold.es21.js +0 -33
  41. package/dist/annotorious-react-manifold.es21.js.map +0 -1
  42. package/dist/annotorious-react-manifold.es22.js +0 -602
  43. package/dist/annotorious-react-manifold.es22.js.map +0 -1
  44. package/dist/annotorious-react-manifold.es23.js +0 -5
  45. package/dist/annotorious-react-manifold.es23.js.map +0 -1
  46. package/dist/annotorious-react-manifold.es24.js +0 -5
  47. package/dist/annotorious-react-manifold.es24.js.map +0 -1
@@ -1,1120 +1,33 @@
1
- function gt() {
1
+ import { __exports as t } from "./annotorious-react-manifold.es11.js";
2
+ import R from "react";
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var p;
13
+ function v() {
14
+ if (p)
15
+ return t;
16
+ p = 1;
17
+ var s = R, m = Symbol.for("react.element"), l = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, d = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, y = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function i(o, r, u) {
19
+ var e, n = {}, _ = null, f = null;
20
+ u !== void 0 && (_ = "" + u), r.key !== void 0 && (_ = "" + r.key), r.ref !== void 0 && (f = r.ref);
21
+ for (e in r)
22
+ c.call(r, e) && !y.hasOwnProperty(e) && (n[e] = r[e]);
23
+ if (o && o.defaultProps)
24
+ for (e in r = o.defaultProps, r)
25
+ n[e] === void 0 && (n[e] = r[e]);
26
+ return { $$typeof: m, type: o, key: _, ref: f, props: n, _owner: d.current };
27
+ }
28
+ return t.Fragment = l, t.jsx = i, t.jsxs = i, t;
2
29
  }
3
- function Ct(t, n) {
4
- for (const o in n)
5
- t[o] = n[o];
6
- return t;
7
- }
8
- function Bt(t) {
9
- return t();
10
- }
11
- function Lt() {
12
- return /* @__PURE__ */ Object.create(null);
13
- }
14
- function C(t) {
15
- t.forEach(Bt);
16
- }
17
- function S(t) {
18
- return typeof t == "function";
19
- }
20
- function xt(t, n) {
21
- return t != t ? n == n : t !== n || t && typeof t == "object" || typeof t == "function";
22
- }
23
- function Dt(t) {
24
- return Object.keys(t).length === 0;
25
- }
26
- function zt(t, n, o, r) {
27
- if (t) {
28
- const s = Nt(t, n, o, r);
29
- return t[0](s);
30
- }
31
- }
32
- function Nt(t, n, o, r) {
33
- return t[1] && r ? Ct(o.ctx.slice(), t[1](r(n))) : o.ctx;
34
- }
35
- function qt(t, n, o, r) {
36
- if (t[2] && r) {
37
- const s = t[2](r(o));
38
- if (n.dirty === void 0)
39
- return s;
40
- if (typeof s == "object") {
41
- const a = [], c = Math.max(n.dirty.length, s.length);
42
- for (let h = 0; h < c; h += 1)
43
- a[h] = n.dirty[h] | s[h];
44
- return a;
45
- }
46
- return n.dirty | s;
47
- }
48
- return n.dirty;
49
- }
50
- function Kt(t, n, o, r, s, a) {
51
- if (s) {
52
- const c = Nt(n, o, r, a);
53
- t.p(c, s);
54
- }
55
- }
56
- function Vt(t) {
57
- if (t.ctx.length > 32) {
58
- const n = [], o = t.ctx.length / 32;
59
- for (let r = 0; r < o; r++)
60
- n[r] = -1;
61
- return n;
62
- }
63
- return -1;
64
- }
65
- function x(t, n, o) {
66
- t.insertBefore(n, o || null);
67
- }
68
- function T(t) {
69
- t.parentNode && t.parentNode.removeChild(t);
70
- }
71
- function Zt(t, n) {
72
- for (let o = 0; o < t.length; o += 1)
73
- t[o] && t[o].d(n);
74
- }
75
- function L(t) {
76
- return document.createElementNS("http://www.w3.org/2000/svg", t);
77
- }
78
- function kt(t) {
79
- return document.createTextNode(t);
80
- }
81
- function B() {
82
- return kt(" ");
83
- }
84
- function Jt() {
85
- return kt("");
86
- }
87
- function _(t, n, o, r) {
88
- return t.addEventListener(n, o, r), () => t.removeEventListener(n, o, r);
89
- }
90
- function e(t, n, o) {
91
- o == null ? t.removeAttribute(n) : t.getAttribute(n) !== o && t.setAttribute(n, o);
92
- }
93
- function Qt(t) {
94
- return Array.from(t.childNodes);
95
- }
96
- function Wt(t, n, { bubbles: o = !1, cancelable: r = !1 } = {}) {
97
- const s = document.createEvent("CustomEvent");
98
- return s.initCustomEvent(t, o, r, n), s;
99
- }
100
- let J;
101
- function Z(t) {
102
- J = t;
103
- }
104
- function Mt() {
105
- if (!J)
106
- throw new Error("Function called outside component initialization");
107
- return J;
108
- }
109
- function Yt() {
110
- const t = Mt();
111
- return (n, o, { cancelable: r = !1 } = {}) => {
112
- const s = t.$$.callbacks[n];
113
- if (s) {
114
- const a = Wt(n, o, { cancelable: r });
115
- return s.slice().forEach((c) => {
116
- c.call(t, a);
117
- }), !a.defaultPrevented;
118
- }
119
- return !0;
120
- };
121
- }
122
- function q(t, n) {
123
- const o = t.$$.callbacks[n.type];
124
- o && o.slice().forEach((r) => r.call(this, n));
125
- }
126
- const z = [], Ht = [];
127
- let K = [];
128
- const It = [], tn = /* @__PURE__ */ Promise.resolve();
129
- let $t = !1;
130
- function nn() {
131
- $t || ($t = !0, tn.then(Ut));
132
- }
133
- function Tt(t) {
134
- K.push(t);
135
- }
136
- const yt = /* @__PURE__ */ new Set();
137
- let D = 0;
138
- function Ut() {
139
- if (D !== 0)
140
- return;
141
- const t = J;
142
- do {
143
- try {
144
- for (; D < z.length; ) {
145
- const n = z[D];
146
- D++, Z(n), on(n.$$);
147
- }
148
- } catch (n) {
149
- throw z.length = 0, D = 0, n;
150
- }
151
- for (Z(null), z.length = 0, D = 0; Ht.length; )
152
- Ht.pop()();
153
- for (let n = 0; n < K.length; n += 1) {
154
- const o = K[n];
155
- yt.has(o) || (yt.add(o), o());
156
- }
157
- K.length = 0;
158
- } while (z.length);
159
- for (; It.length; )
160
- It.pop()();
161
- $t = !1, yt.clear(), Z(t);
162
- }
163
- function on(t) {
164
- if (t.fragment !== null) {
165
- t.update(), C(t.before_update);
166
- const n = t.dirty;
167
- t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, n), t.after_update.forEach(Tt);
168
- }
169
- }
170
- function rn(t) {
171
- const n = [], o = [];
172
- K.forEach((r) => t.indexOf(r) === -1 ? n.push(r) : o.push(r)), o.forEach((r) => r()), K = n;
173
- }
174
- const ct = /* @__PURE__ */ new Set();
175
- let en;
176
- function lt(t, n) {
177
- t && t.i && (ct.delete(t), t.i(n));
178
- }
179
- function wt(t, n, o, r) {
180
- if (t && t.o) {
181
- if (ct.has(t))
182
- return;
183
- ct.add(t), en.c.push(() => {
184
- ct.delete(t), r && (o && t.d(1), r());
185
- }), t.o(n);
186
- } else
187
- r && r();
188
- }
189
- function jt(t) {
190
- t && t.c();
191
- }
192
- function Et(t, n, o, r) {
193
- const { fragment: s, after_update: a } = t.$$;
194
- s && s.m(n, o), r || Tt(() => {
195
- const c = t.$$.on_mount.map(Bt).filter(S);
196
- t.$$.on_destroy ? t.$$.on_destroy.push(...c) : C(c), t.$$.on_mount = [];
197
- }), a.forEach(Tt);
198
- }
199
- function Ot(t, n) {
200
- const o = t.$$;
201
- o.fragment !== null && (rn(o.after_update), C(o.on_destroy), o.fragment && o.fragment.d(n), o.on_destroy = o.fragment = null, o.ctx = []);
202
- }
203
- function sn(t, n) {
204
- t.$$.dirty[0] === -1 && (z.push(t), nn(), t.$$.dirty.fill(0)), t.$$.dirty[n / 31 | 0] |= 1 << n % 31;
205
- }
206
- function bt(t, n, o, r, s, a, c, h = [-1]) {
207
- const u = J;
208
- Z(t);
209
- const m = t.$$ = {
210
- fragment: null,
211
- ctx: [],
212
- // state
213
- props: a,
214
- update: gt,
215
- not_equal: s,
216
- bound: Lt(),
217
- // lifecycle
218
- on_mount: [],
219
- on_destroy: [],
220
- on_disconnect: [],
221
- before_update: [],
222
- after_update: [],
223
- context: new Map(n.context || (u ? u.$$.context : [])),
224
- // everything else
225
- callbacks: Lt(),
226
- dirty: h,
227
- skip_bound: !1,
228
- root: n.target || u.$$.root
229
- };
230
- c && c(m.root);
231
- let w = !1;
232
- if (m.ctx = o ? o(t, n.props || {}, ($, g, ...i) => {
233
- const y = i.length ? i[0] : g;
234
- return m.ctx && s(m.ctx[$], m.ctx[$] = y) && (!m.skip_bound && m.bound[$] && m.bound[$](y), w && sn(t, $)), g;
235
- }) : [], m.update(), w = !0, C(m.before_update), m.fragment = r ? r(m.ctx) : !1, n.target) {
236
- if (n.hydrate) {
237
- const $ = Qt(n.target);
238
- m.fragment && m.fragment.l($), $.forEach(T);
239
- } else
240
- m.fragment && m.fragment.c();
241
- n.intro && lt(t.$$.fragment), Et(t, n.target, n.anchor, n.customElement), Ut();
242
- }
243
- Z(u);
244
- }
245
- class Pt {
246
- $destroy() {
247
- Ot(this, 1), this.$destroy = gt;
248
- }
249
- $on(n, o) {
250
- if (!S(o))
251
- return gt;
252
- const r = this.$$.callbacks[n] || (this.$$.callbacks[n] = []);
253
- return r.push(o), () => {
254
- const s = r.indexOf(o);
255
- s !== -1 && r.splice(s, 1);
256
- };
257
- }
258
- $set(n) {
259
- this.$$set && !Dt(n) && (this.$$.skip_bound = !0, this.$$set(n), this.$$.skip_bound = !1);
260
- }
261
- }
262
- var V = /* @__PURE__ */ ((t) => (t.ELLIPSE = "ELLIPSE", t.POLYGON = "POLYGON", t.RECTANGLE = "RECTANGLE", t))(V || {});
263
- const St = (t, n) => n, an = (t) => {
264
- let n = 1 / 0, o = 1 / 0, r = -1 / 0, s = -1 / 0;
265
- return t.forEach(([a, c]) => {
266
- n = Math.min(n, a), o = Math.min(o, c), r = Math.max(r, a), s = Math.max(s, c);
267
- }), { minX: n, minY: o, maxX: r, maxY: s };
268
- }, cn = {
269
- area: (t) => Math.PI * t.geometry.rx * t.geometry.ry,
270
- intersects: (t, n, o) => {
271
- const { cx: r, cy: s, rx: a, ry: c } = t.geometry, h = 0, u = Math.cos(h), m = Math.sin(h), w = n - r, $ = o - s, g = u * w + m * $, i = m * w - u * $;
272
- return g * g / (a * a) + i * i / (c * c) <= 1;
273
- }
274
- };
275
- St(V.ELLIPSE, cn);
276
- const ln = {
277
- area: (t) => {
278
- const { points: n } = t.geometry;
279
- let o = 0, r = n.length - 1;
280
- for (let s = 0; s < n.length; s++)
281
- o += (n[r][0] + n[s][0]) * (n[r][1] - n[s][1]), r = s;
282
- return Math.abs(0.5 * o);
283
- },
284
- intersects: (t, n, o) => {
285
- const { points: r } = t.geometry;
286
- let s = !1;
287
- for (let a = 0, c = r.length - 1; a < r.length; c = a++) {
288
- const h = r[a][0], u = r[a][1], m = r[c][0], w = r[c][1];
289
- u > o != w > o && n < (m - h) * (o - u) / (w - u) + h && (s = !s);
290
- }
291
- return s;
292
- }
293
- };
294
- St(V.POLYGON, ln);
295
- const hn = {
296
- area: (t) => t.geometry.w * t.geometry.h,
297
- intersects: (t, n, o) => n >= t.geometry.x && n <= t.geometry.x + t.geometry.w && o >= t.geometry.y && o <= t.geometry.y + t.geometry.h
298
- };
299
- St(V.RECTANGLE, hn);
300
- const un = [];
301
- for (let t = 0; t < 256; ++t)
302
- un.push((t + 256).toString(16).slice(1));
303
- typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
304
- const pn = [];
305
- for (let t = 0; t < 256; ++t)
306
- pn.push((t + 256).toString(16).slice(1));
307
- typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
308
- let fn = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((n, o) => (o &= 63, o < 36 ? n += o.toString(36) : o < 62 ? n += (o - 26).toString(36).toUpperCase() : o > 62 ? n += "-" : n += "_", n), "");
309
- fn();
310
- function vt(t, n, o) {
311
- const r = t.slice();
312
- return r[11] = n[o], r[13] = o, r;
313
- }
314
- function Gt(t) {
315
- let n, o, r, s, a;
316
- return {
317
- c() {
318
- n = L("rect"), e(n, "class", "a9s-corner-handle"), e(n, "x", o = /*point*/
319
- t[11][0] - /*handleSize*/
320
- t[3] / 2), e(n, "y", r = /*point*/
321
- t[11][1] - /*handleSize*/
322
- t[3] / 2), e(
323
- n,
324
- "height",
325
- /*handleSize*/
326
- t[3]
327
- ), e(
328
- n,
329
- "width",
330
- /*handleSize*/
331
- t[3]
332
- );
333
- },
334
- m(c, h) {
335
- x(c, n, h), s || (a = _(n, "pointerdown", function() {
336
- S(
337
- /*grab*/
338
- t[10](p(
339
- /*idx*/
340
- t[13]
341
- ))
342
- ) && t[10](p(
343
- /*idx*/
344
- t[13]
345
- )).apply(this, arguments);
346
- }), s = !0);
347
- },
348
- p(c, h) {
349
- t = c, h & /*geom, handleSize*/
350
- 24 && o !== (o = /*point*/
351
- t[11][0] - /*handleSize*/
352
- t[3] / 2) && e(n, "x", o), h & /*geom, handleSize*/
353
- 24 && r !== (r = /*point*/
354
- t[11][1] - /*handleSize*/
355
- t[3] / 2) && e(n, "y", r), h & /*handleSize*/
356
- 8 && e(
357
- n,
358
- "height",
359
- /*handleSize*/
360
- t[3]
361
- ), h & /*handleSize*/
362
- 8 && e(
363
- n,
364
- "width",
365
- /*handleSize*/
366
- t[3]
367
- );
368
- },
369
- d(c) {
370
- c && T(n), s = !1, a();
371
- }
372
- };
373
- }
374
- function dn(t) {
375
- let n, o, r, s, a, c, h, u, m, w, $ = (
376
- /*geom*/
377
- t[4].points
378
- ), g = [];
379
- for (let i = 0; i < $.length; i += 1)
380
- g[i] = Gt(vt(t, $, i));
381
- return {
382
- c() {
383
- n = L("polygon"), s = B(), a = L("polygon"), h = B();
384
- for (let i = 0; i < g.length; i += 1)
385
- g[i].c();
386
- u = Jt(), e(n, "class", "a9s-outer"), e(n, "style", o = /*computedStyle*/
387
- t[1] ? "display:none;" : void 0), e(n, "points", r = /*geom*/
388
- t[4].points.map(At).join(" ")), e(a, "class", "a9s-inner a9s-shape-handle"), e(
389
- a,
390
- "style",
391
- /*computedStyle*/
392
- t[1]
393
- ), e(a, "points", c = /*geom*/
394
- t[4].points.map(Rt).join(" "));
395
- },
396
- m(i, y) {
397
- x(i, n, y), x(i, s, y), x(i, a, y), x(i, h, y);
398
- for (let f = 0; f < g.length; f += 1)
399
- g[f] && g[f].m(i, y);
400
- x(i, u, y), m || (w = [
401
- _(n, "pointerdown", function() {
402
- S(
403
- /*grab*/
404
- t[10](p.SHAPE)
405
- ) && t[10](p.SHAPE).apply(this, arguments);
406
- }),
407
- _(a, "pointerdown", function() {
408
- S(
409
- /*grab*/
410
- t[10](p.SHAPE)
411
- ) && t[10](p.SHAPE).apply(this, arguments);
412
- })
413
- ], m = !0);
414
- },
415
- p(i, y) {
416
- if (t = i, y & /*computedStyle*/
417
- 2 && o !== (o = /*computedStyle*/
418
- t[1] ? "display:none;" : void 0) && e(n, "style", o), y & /*geom*/
419
- 16 && r !== (r = /*geom*/
420
- t[4].points.map(At).join(" ")) && e(n, "points", r), y & /*computedStyle*/
421
- 2 && e(
422
- a,
423
- "style",
424
- /*computedStyle*/
425
- t[1]
426
- ), y & /*geom*/
427
- 16 && c !== (c = /*geom*/
428
- t[4].points.map(Rt).join(" ")) && e(a, "points", c), y & /*geom, handleSize, grab, Handle*/
429
- 1048) {
430
- $ = /*geom*/
431
- t[4].points;
432
- let f;
433
- for (f = 0; f < $.length; f += 1) {
434
- const E = vt(t, $, f);
435
- g[f] ? g[f].p(E, y) : (g[f] = Gt(E), g[f].c(), g[f].m(u.parentNode, u));
436
- }
437
- for (; f < g.length; f += 1)
438
- g[f].d(1);
439
- g.length = $.length;
440
- }
441
- },
442
- d(i) {
443
- i && T(n), i && T(s), i && T(a), i && T(h), Zt(g, i), i && T(u), m = !1, C(w);
444
- }
445
- };
446
- }
447
- function mn(t) {
448
- let n, o;
449
- return n = new Xt({
450
- props: {
451
- shape: (
452
- /*shape*/
453
- t[0]
454
- ),
455
- transform: (
456
- /*transform*/
457
- t[2]
458
- ),
459
- editor: (
460
- /*editor*/
461
- t[5]
462
- ),
463
- $$slots: {
464
- default: [
465
- dn,
466
- ({ grab: r }) => ({ 10: r }),
467
- ({ grab: r }) => r ? 1024 : 0
468
- ]
469
- },
470
- $$scope: { ctx: t }
471
- }
472
- }), n.$on(
473
- "change",
474
- /*change_handler*/
475
- t[7]
476
- ), n.$on(
477
- "grab",
478
- /*grab_handler*/
479
- t[8]
480
- ), n.$on(
481
- "release",
482
- /*release_handler*/
483
- t[9]
484
- ), {
485
- c() {
486
- jt(n.$$.fragment);
487
- },
488
- m(r, s) {
489
- Et(n, r, s), o = !0;
490
- },
491
- p(r, [s]) {
492
- const a = {};
493
- s & /*shape*/
494
- 1 && (a.shape = /*shape*/
495
- r[0]), s & /*transform*/
496
- 4 && (a.transform = /*transform*/
497
- r[2]), s & /*$$scope, geom, handleSize, grab, computedStyle*/
498
- 17434 && (a.$$scope = { dirty: s, ctx: r }), n.$set(a);
499
- },
500
- i(r) {
501
- o || (lt(n.$$.fragment, r), o = !0);
502
- },
503
- o(r) {
504
- wt(n.$$.fragment, r), o = !1;
505
- },
506
- d(r) {
507
- Ot(n, r);
508
- }
509
- };
510
- }
511
- const At = (t) => t.join(","), Rt = (t) => t.join(",");
512
- function yn(t, n, o) {
513
- let r, s, { shape: a } = n, { computedStyle: c = void 0 } = n, { transform: h } = n, { viewportScale: u = 1 } = n;
514
- const m = (i, y, f) => {
515
- let E;
516
- y === p.SHAPE ? E = i.geometry.points.map(([P, O]) => [P + f[0], O + f[1]]) : E = i.geometry.points.map(([P, O], F) => y === p(F) ? [P + f[0], O + f[1]] : [P, O]);
517
- const H = an(E);
518
- return { ...i, geometry: { points: E, bounds: H } };
519
- };
520
- function w(i) {
521
- q.call(this, t, i);
522
- }
523
- function $(i) {
524
- q.call(this, t, i);
525
- }
526
- function g(i) {
527
- q.call(this, t, i);
528
- }
529
- return t.$$set = (i) => {
530
- "shape" in i && o(0, a = i.shape), "computedStyle" in i && o(1, c = i.computedStyle), "transform" in i && o(2, h = i.transform), "viewportScale" in i && o(6, u = i.viewportScale);
531
- }, t.$$.update = () => {
532
- t.$$.dirty & /*shape*/
533
- 1 && o(4, r = a.geometry), t.$$.dirty & /*viewportScale*/
534
- 64 && o(3, s = 10 / u);
535
- }, [
536
- a,
537
- c,
538
- h,
539
- s,
540
- r,
541
- m,
542
- u,
543
- w,
544
- $,
545
- g
546
- ];
547
- }
548
- class gn extends Pt {
549
- constructor(n) {
550
- super(), bt(this, n, yn, mn, xt, {
551
- shape: 0,
552
- computedStyle: 1,
553
- transform: 2,
554
- viewportScale: 6
555
- });
556
- }
557
- }
558
- function $n(t) {
559
- let n, o, r, s, a, c, h, u, m, w, $, g, i, y, f, E, H, P, O, F, N, k, U, b, j, X, Q, ht, R, W, M, Y, ut, I, tt, nt, pt, v, ot, rt, ft, G, et, st, dt, A, it, at, mt, _t;
560
- return {
561
- c() {
562
- n = L("rect"), h = B(), u = L("rect"), i = B(), y = L("rect"), P = B(), O = L("rect"), U = B(), b = L("rect"), ht = B(), R = L("rect"), ut = B(), I = L("rect"), pt = B(), v = L("rect"), ft = B(), G = L("rect"), dt = B(), A = L("rect"), e(n, "class", "a9s-outer"), e(n, "style", o = /*computedStyle*/
563
- t[1] ? "display:none;" : void 0), e(n, "x", r = /*geom*/
564
- t[4].x), e(n, "y", s = /*geom*/
565
- t[4].y), e(n, "width", a = /*geom*/
566
- t[4].w), e(n, "height", c = /*geom*/
567
- t[4].h), e(u, "class", "a9s-inner a9s-shape-handle"), e(
568
- u,
569
- "style",
570
- /*computedStyle*/
571
- t[1]
572
- ), e(u, "x", m = /*geom*/
573
- t[4].x), e(u, "y", w = /*geom*/
574
- t[4].y), e(u, "width", $ = /*geom*/
575
- t[4].w), e(u, "height", g = /*geom*/
576
- t[4].h), e(y, "class", "a9s-edge-handle a9s-edge-handle-top"), e(y, "x", f = /*geom*/
577
- t[4].x), e(y, "y", E = /*geom*/
578
- t[4].y), e(y, "height", 1), e(y, "width", H = /*geom*/
579
- t[4].w), e(O, "class", "a9s-edge-handle a9s-edge-handle-right"), e(O, "x", F = /*geom*/
580
- t[4].x + /*geom*/
581
- t[4].w), e(O, "y", N = /*geom*/
582
- t[4].y), e(O, "height", k = /*geom*/
583
- t[4].h), e(O, "width", 1), e(b, "class", "a9s-edge-handle a9s-edge-handle-bottom"), e(b, "x", j = /*geom*/
584
- t[4].x), e(b, "y", X = /*geom*/
585
- t[4].y + /*geom*/
586
- t[4].h), e(b, "height", 1), e(b, "width", Q = /*geom*/
587
- t[4].w), e(R, "class", "a9s-edge-handle a9s-edge-handle-left"), e(R, "x", W = /*geom*/
588
- t[4].x), e(R, "y", M = /*geom*/
589
- t[4].y), e(R, "height", Y = /*geom*/
590
- t[4].h), e(R, "width", 1), e(I, "class", "a9s-corner-handle a9s-corner-handle-topleft"), e(I, "x", tt = /*geom*/
591
- t[4].x - /*handleSize*/
592
- t[3] / 2), e(I, "y", nt = /*geom*/
593
- t[4].y - /*handleSize*/
594
- t[3] / 2), e(
595
- I,
596
- "height",
597
- /*handleSize*/
598
- t[3]
599
- ), e(
600
- I,
601
- "width",
602
- /*handleSize*/
603
- t[3]
604
- ), e(v, "class", "a9s-corner-handle a9s-corner-handle-topright"), e(v, "x", ot = /*geom*/
605
- t[4].x + /*geom*/
606
- t[4].w - /*handleSize*/
607
- t[3] / 2), e(v, "y", rt = /*geom*/
608
- t[4].y - /*handleSize*/
609
- t[3] / 2), e(
610
- v,
611
- "height",
612
- /*handleSize*/
613
- t[3]
614
- ), e(
615
- v,
616
- "width",
617
- /*handleSize*/
618
- t[3]
619
- ), e(G, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), e(G, "x", et = /*geom*/
620
- t[4].x + /*geom*/
621
- t[4].w - /*handleSize*/
622
- t[3] / 2), e(G, "y", st = /*geom*/
623
- t[4].y + /*geom*/
624
- t[4].h - /*handleSize*/
625
- t[3] / 2), e(
626
- G,
627
- "height",
628
- /*handleSize*/
629
- t[3]
630
- ), e(
631
- G,
632
- "width",
633
- /*handleSize*/
634
- t[3]
635
- ), e(A, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), e(A, "x", it = /*geom*/
636
- t[4].x - /*handleSize*/
637
- t[3] / 2), e(A, "y", at = /*geom*/
638
- t[4].y + /*geom*/
639
- t[4].h - /*handleSize*/
640
- t[3] / 2), e(
641
- A,
642
- "height",
643
- /*handleSize*/
644
- t[3]
645
- ), e(
646
- A,
647
- "width",
648
- /*handleSize*/
649
- t[3]
650
- );
651
- },
652
- m(d, l) {
653
- x(d, n, l), x(d, h, l), x(d, u, l), x(d, i, l), x(d, y, l), x(d, P, l), x(d, O, l), x(d, U, l), x(d, b, l), x(d, ht, l), x(d, R, l), x(d, ut, l), x(d, I, l), x(d, pt, l), x(d, v, l), x(d, ft, l), x(d, G, l), x(d, dt, l), x(d, A, l), mt || (_t = [
654
- _(n, "pointerdown", function() {
655
- S(
656
- /*grab*/
657
- t[10](p.SHAPE)
658
- ) && t[10](p.SHAPE).apply(this, arguments);
659
- }),
660
- _(u, "pointerdown", function() {
661
- S(
662
- /*grab*/
663
- t[10](p.SHAPE)
664
- ) && t[10](p.SHAPE).apply(this, arguments);
665
- }),
666
- _(y, "pointerdown", function() {
667
- S(
668
- /*grab*/
669
- t[10](p.TOP)
670
- ) && t[10](p.TOP).apply(this, arguments);
671
- }),
672
- _(O, "pointerdown", function() {
673
- S(
674
- /*grab*/
675
- t[10](p.RIGHT)
676
- ) && t[10](p.RIGHT).apply(this, arguments);
677
- }),
678
- _(b, "pointerdown", function() {
679
- S(
680
- /*grab*/
681
- t[10](p.BOTTOM)
682
- ) && t[10](p.BOTTOM).apply(this, arguments);
683
- }),
684
- _(R, "pointerdown", function() {
685
- S(
686
- /*grab*/
687
- t[10](p.LEFT)
688
- ) && t[10](p.LEFT).apply(this, arguments);
689
- }),
690
- _(I, "pointerdown", function() {
691
- S(
692
- /*grab*/
693
- t[10](p.TOP_LEFT)
694
- ) && t[10](p.TOP_LEFT).apply(this, arguments);
695
- }),
696
- _(v, "pointerdown", function() {
697
- S(
698
- /*grab*/
699
- t[10](p.TOP_RIGHT)
700
- ) && t[10](p.TOP_RIGHT).apply(this, arguments);
701
- }),
702
- _(G, "pointerdown", function() {
703
- S(
704
- /*grab*/
705
- t[10](p.BOTTOM_RIGHT)
706
- ) && t[10](p.BOTTOM_RIGHT).apply(this, arguments);
707
- }),
708
- _(A, "pointerdown", function() {
709
- S(
710
- /*grab*/
711
- t[10](p.BOTTOM_LEFT)
712
- ) && t[10](p.BOTTOM_LEFT).apply(this, arguments);
713
- })
714
- ], mt = !0);
715
- },
716
- p(d, l) {
717
- t = d, l & /*computedStyle*/
718
- 2 && o !== (o = /*computedStyle*/
719
- t[1] ? "display:none;" : void 0) && e(n, "style", o), l & /*geom*/
720
- 16 && r !== (r = /*geom*/
721
- t[4].x) && e(n, "x", r), l & /*geom*/
722
- 16 && s !== (s = /*geom*/
723
- t[4].y) && e(n, "y", s), l & /*geom*/
724
- 16 && a !== (a = /*geom*/
725
- t[4].w) && e(n, "width", a), l & /*geom*/
726
- 16 && c !== (c = /*geom*/
727
- t[4].h) && e(n, "height", c), l & /*computedStyle*/
728
- 2 && e(
729
- u,
730
- "style",
731
- /*computedStyle*/
732
- t[1]
733
- ), l & /*geom*/
734
- 16 && m !== (m = /*geom*/
735
- t[4].x) && e(u, "x", m), l & /*geom*/
736
- 16 && w !== (w = /*geom*/
737
- t[4].y) && e(u, "y", w), l & /*geom*/
738
- 16 && $ !== ($ = /*geom*/
739
- t[4].w) && e(u, "width", $), l & /*geom*/
740
- 16 && g !== (g = /*geom*/
741
- t[4].h) && e(u, "height", g), l & /*geom*/
742
- 16 && f !== (f = /*geom*/
743
- t[4].x) && e(y, "x", f), l & /*geom*/
744
- 16 && E !== (E = /*geom*/
745
- t[4].y) && e(y, "y", E), l & /*geom*/
746
- 16 && H !== (H = /*geom*/
747
- t[4].w) && e(y, "width", H), l & /*geom*/
748
- 16 && F !== (F = /*geom*/
749
- t[4].x + /*geom*/
750
- t[4].w) && e(O, "x", F), l & /*geom*/
751
- 16 && N !== (N = /*geom*/
752
- t[4].y) && e(O, "y", N), l & /*geom*/
753
- 16 && k !== (k = /*geom*/
754
- t[4].h) && e(O, "height", k), l & /*geom*/
755
- 16 && j !== (j = /*geom*/
756
- t[4].x) && e(b, "x", j), l & /*geom*/
757
- 16 && X !== (X = /*geom*/
758
- t[4].y + /*geom*/
759
- t[4].h) && e(b, "y", X), l & /*geom*/
760
- 16 && Q !== (Q = /*geom*/
761
- t[4].w) && e(b, "width", Q), l & /*geom*/
762
- 16 && W !== (W = /*geom*/
763
- t[4].x) && e(R, "x", W), l & /*geom*/
764
- 16 && M !== (M = /*geom*/
765
- t[4].y) && e(R, "y", M), l & /*geom*/
766
- 16 && Y !== (Y = /*geom*/
767
- t[4].h) && e(R, "height", Y), l & /*geom, handleSize*/
768
- 24 && tt !== (tt = /*geom*/
769
- t[4].x - /*handleSize*/
770
- t[3] / 2) && e(I, "x", tt), l & /*geom, handleSize*/
771
- 24 && nt !== (nt = /*geom*/
772
- t[4].y - /*handleSize*/
773
- t[3] / 2) && e(I, "y", nt), l & /*handleSize*/
774
- 8 && e(
775
- I,
776
- "height",
777
- /*handleSize*/
778
- t[3]
779
- ), l & /*handleSize*/
780
- 8 && e(
781
- I,
782
- "width",
783
- /*handleSize*/
784
- t[3]
785
- ), l & /*geom, handleSize*/
786
- 24 && ot !== (ot = /*geom*/
787
- t[4].x + /*geom*/
788
- t[4].w - /*handleSize*/
789
- t[3] / 2) && e(v, "x", ot), l & /*geom, handleSize*/
790
- 24 && rt !== (rt = /*geom*/
791
- t[4].y - /*handleSize*/
792
- t[3] / 2) && e(v, "y", rt), l & /*handleSize*/
793
- 8 && e(
794
- v,
795
- "height",
796
- /*handleSize*/
797
- t[3]
798
- ), l & /*handleSize*/
799
- 8 && e(
800
- v,
801
- "width",
802
- /*handleSize*/
803
- t[3]
804
- ), l & /*geom, handleSize*/
805
- 24 && et !== (et = /*geom*/
806
- t[4].x + /*geom*/
807
- t[4].w - /*handleSize*/
808
- t[3] / 2) && e(G, "x", et), l & /*geom, handleSize*/
809
- 24 && st !== (st = /*geom*/
810
- t[4].y + /*geom*/
811
- t[4].h - /*handleSize*/
812
- t[3] / 2) && e(G, "y", st), l & /*handleSize*/
813
- 8 && e(
814
- G,
815
- "height",
816
- /*handleSize*/
817
- t[3]
818
- ), l & /*handleSize*/
819
- 8 && e(
820
- G,
821
- "width",
822
- /*handleSize*/
823
- t[3]
824
- ), l & /*geom, handleSize*/
825
- 24 && it !== (it = /*geom*/
826
- t[4].x - /*handleSize*/
827
- t[3] / 2) && e(A, "x", it), l & /*geom, handleSize*/
828
- 24 && at !== (at = /*geom*/
829
- t[4].y + /*geom*/
830
- t[4].h - /*handleSize*/
831
- t[3] / 2) && e(A, "y", at), l & /*handleSize*/
832
- 8 && e(
833
- A,
834
- "height",
835
- /*handleSize*/
836
- t[3]
837
- ), l & /*handleSize*/
838
- 8 && e(
839
- A,
840
- "width",
841
- /*handleSize*/
842
- t[3]
843
- );
844
- },
845
- d(d) {
846
- d && T(n), d && T(h), d && T(u), d && T(i), d && T(y), d && T(P), d && T(O), d && T(U), d && T(b), d && T(ht), d && T(R), d && T(ut), d && T(I), d && T(pt), d && T(v), d && T(ft), d && T(G), d && T(dt), d && T(A), mt = !1, C(_t);
847
- }
848
- };
849
- }
850
- function Tn(t) {
851
- let n, o;
852
- return n = new Xt({
853
- props: {
854
- shape: (
855
- /*shape*/
856
- t[0]
857
- ),
858
- transform: (
859
- /*transform*/
860
- t[2]
861
- ),
862
- editor: (
863
- /*editor*/
864
- t[5]
865
- ),
866
- $$slots: {
867
- default: [
868
- $n,
869
- ({ grab: r }) => ({ 10: r }),
870
- ({ grab: r }) => r ? 1024 : 0
871
- ]
872
- },
873
- $$scope: { ctx: t }
874
- }
875
- }), n.$on(
876
- "grab",
877
- /*grab_handler*/
878
- t[7]
879
- ), n.$on(
880
- "change",
881
- /*change_handler*/
882
- t[8]
883
- ), n.$on(
884
- "release",
885
- /*release_handler*/
886
- t[9]
887
- ), {
888
- c() {
889
- jt(n.$$.fragment);
890
- },
891
- m(r, s) {
892
- Et(n, r, s), o = !0;
893
- },
894
- p(r, [s]) {
895
- const a = {};
896
- s & /*shape*/
897
- 1 && (a.shape = /*shape*/
898
- r[0]), s & /*transform*/
899
- 4 && (a.transform = /*transform*/
900
- r[2]), s & /*$$scope, geom, handleSize, grab, computedStyle*/
901
- 3098 && (a.$$scope = { dirty: s, ctx: r }), n.$set(a);
902
- },
903
- i(r) {
904
- o || (lt(n.$$.fragment, r), o = !0);
905
- },
906
- o(r) {
907
- wt(n.$$.fragment, r), o = !1;
908
- },
909
- d(r) {
910
- Ot(n, r);
911
- }
912
- };
913
- }
914
- function xn(t, n, o) {
915
- let r, s, { shape: a } = n, { computedStyle: c = void 0 } = n, { transform: h } = n, { viewportScale: u = 1 } = n;
916
- const m = (i, y, f) => {
917
- const E = i.geometry.bounds;
918
- let [H, P] = [E.minX, E.minY], [O, F] = [E.maxX, E.maxY];
919
- const [N, k] = f;
920
- if (y === p.SHAPE)
921
- H += N, O += N, P += k, F += k;
922
- else {
923
- switch (y) {
924
- case p.TOP:
925
- case p.TOP_LEFT:
926
- case p.TOP_RIGHT: {
927
- P += k;
928
- break;
929
- }
930
- case p.BOTTOM:
931
- case p.BOTTOM_LEFT:
932
- case p.BOTTOM_RIGHT: {
933
- F += k;
934
- break;
935
- }
936
- }
937
- switch (y) {
938
- case p.LEFT:
939
- case p.TOP_LEFT:
940
- case p.BOTTOM_LEFT: {
941
- H += N;
942
- break;
943
- }
944
- case p.RIGHT:
945
- case p.TOP_RIGHT:
946
- case p.BOTTOM_RIGHT: {
947
- O += N;
948
- break;
949
- }
950
- }
951
- }
952
- const U = Math.min(H, O), b = Math.min(P, F), j = Math.abs(O - H), X = Math.abs(F - P);
953
- return {
954
- ...i,
955
- geometry: {
956
- x: U,
957
- y: b,
958
- w: j,
959
- h: X,
960
- bounds: {
961
- minX: U,
962
- minY: b,
963
- maxX: U + j,
964
- maxY: b + X
965
- }
966
- }
967
- };
968
- };
969
- function w(i) {
970
- q.call(this, t, i);
971
- }
972
- function $(i) {
973
- q.call(this, t, i);
974
- }
975
- function g(i) {
976
- q.call(this, t, i);
977
- }
978
- return t.$$set = (i) => {
979
- "shape" in i && o(0, a = i.shape), "computedStyle" in i && o(1, c = i.computedStyle), "transform" in i && o(2, h = i.transform), "viewportScale" in i && o(6, u = i.viewportScale);
980
- }, t.$$.update = () => {
981
- t.$$.dirty & /*shape*/
982
- 1 && o(4, r = a.geometry), t.$$.dirty & /*viewportScale*/
983
- 64 && o(3, s = 10 / u);
984
- }, [
985
- a,
986
- c,
987
- h,
988
- s,
989
- r,
990
- m,
991
- u,
992
- w,
993
- $,
994
- g
995
- ];
996
- }
997
- class wn extends Pt {
998
- constructor(n) {
999
- super(), bt(this, n, xn, Tn, xt, {
1000
- shape: 0,
1001
- computedStyle: 1,
1002
- transform: 2,
1003
- viewportScale: 6
1004
- });
1005
- }
1006
- }
1007
- V.RECTANGLE, V.POLYGON;
1008
- const p = (t) => `HANDLE-${t}`;
1009
- p.SHAPE = "SHAPE";
1010
- p.TOP = "TOP";
1011
- p.RIGHT = "RIGHT";
1012
- p.BOTTOM = "BOTTOM";
1013
- p.LEFT = "LEFT";
1014
- p.TOP_LEFT = "TOP_LEFT";
1015
- p.TOP_RIGHT = "TOP_RIGHT";
1016
- p.BOTTOM_RIGHT = "BOTTOM_RIGHT";
1017
- p.BOTTOM_LEFT = "BOTTOM_LEFT";
1018
- const En = (t) => ({}), Ft = (t) => ({ grab: (
1019
- /*onGrab*/
1020
- t[0]
1021
- ) });
1022
- function On(t) {
1023
- let n, o, r, s;
1024
- const a = (
1025
- /*#slots*/
1026
- t[7].default
1027
- ), c = zt(
1028
- a,
1029
- t,
1030
- /*$$scope*/
1031
- t[6],
1032
- Ft
1033
- );
1034
- return {
1035
- c() {
1036
- n = L("g"), c && c.c(), e(n, "class", "a9s-annotation selected");
1037
- },
1038
- m(h, u) {
1039
- x(h, n, u), c && c.m(n, null), o = !0, r || (s = [
1040
- _(
1041
- n,
1042
- "pointerup",
1043
- /*onRelease*/
1044
- t[2]
1045
- ),
1046
- _(
1047
- n,
1048
- "pointermove",
1049
- /*onPointerMove*/
1050
- t[1]
1051
- )
1052
- ], r = !0);
1053
- },
1054
- p(h, [u]) {
1055
- c && c.p && (!o || u & /*$$scope*/
1056
- 64) && Kt(
1057
- c,
1058
- a,
1059
- h,
1060
- /*$$scope*/
1061
- h[6],
1062
- o ? qt(
1063
- a,
1064
- /*$$scope*/
1065
- h[6],
1066
- u,
1067
- En
1068
- ) : Vt(
1069
- /*$$scope*/
1070
- h[6]
1071
- ),
1072
- Ft
1073
- );
1074
- },
1075
- i(h) {
1076
- o || (lt(c, h), o = !0);
1077
- },
1078
- o(h) {
1079
- wt(c, h), o = !1;
1080
- },
1081
- d(h) {
1082
- h && T(n), c && c.d(h), r = !1, C(s);
1083
- }
1084
- };
1085
- }
1086
- function bn(t, n, o) {
1087
- let { $$slots: r = {}, $$scope: s } = n;
1088
- const a = Yt();
1089
- let { shape: c } = n, { editor: h } = n, { transform: u } = n, m = null, w, $ = null;
1090
- const g = (f) => (E) => {
1091
- m = f, w = u.elementToImage(E.offsetX, E.offsetY), $ = c, E.target.setPointerCapture(E.pointerId), a("grab");
1092
- }, i = (f) => {
1093
- if (m) {
1094
- const [E, H] = u.elementToImage(f.offsetX, f.offsetY), P = [E - w[0], H - w[1]];
1095
- o(3, c = h($, m, P)), a("change", c);
1096
- }
1097
- }, y = (f) => {
1098
- f.target.releasePointerCapture(f.pointerId), m = null, $ = c, a("release");
1099
- };
1100
- return t.$$set = (f) => {
1101
- "shape" in f && o(3, c = f.shape), "editor" in f && o(4, h = f.editor), "transform" in f && o(5, u = f.transform), "$$scope" in f && o(6, s = f.$$scope);
1102
- }, [g, i, y, c, h, u, s, r];
1103
- }
1104
- class Xt extends Pt {
1105
- constructor(n) {
1106
- super(), bt(this, n, bn, On, xt, { shape: 3, editor: 4, transform: 5 });
1107
- }
1108
- }
1109
- navigator.userAgent.indexOf("Mac OS X");
1110
30
  export {
1111
- Xt as Editor,
1112
- p as Handle,
1113
- gn as PolygonEditor,
1114
- wn as RectangleEditor,
1115
- hn as RectangleUtil,
1116
- V as ShapeType,
1117
- an as boundsFromPoints,
1118
- St as registerShapeUtil
31
+ v as __require
1119
32
  };
1120
33
  //# sourceMappingURL=annotorious-react-manifold.es9.js.map