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