@soomo/text-annotator 3.1.0-staging.1 → 3.1.0-staging.11
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/src/utils/index.d.ts +2 -2
- package/dist/src/utils/isNotAnnotatable.d.ts +4 -0
- package/dist/src/utils/splitAnnotatableRanges.d.ts +0 -2
- package/dist/text-annotator.es.js +789 -774
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +2 -2
- package/dist/text-annotator.umd.js.map +1 -1
- package/package.json +2 -1
- package/dist/src/utils/getAnnotatableFragment.d.ts +0 -5
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
const
|
|
1
|
+
const le = "not-annotatable", Z = `.${le}`, nt = (t) => {
|
|
2
2
|
var n;
|
|
3
|
+
return !!(t instanceof HTMLElement ? t.closest(Z) : (n = t.parentElement) == null ? void 0 : n.closest(Z));
|
|
4
|
+
}, Me = (t) => {
|
|
3
5
|
const e = t.commonAncestorContainer;
|
|
4
|
-
return
|
|
5
|
-
}, Be =
|
|
6
|
+
return !nt(e);
|
|
7
|
+
}, Be = (t) => t.addEventListener("click", (e) => {
|
|
8
|
+
// Allow clicks within not-annotatable elements
|
|
9
|
+
!e.target.closest(Z) && !e.target.closest("a") && e.preventDefault();
|
|
10
|
+
}), ke = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Ie = (t) => {
|
|
11
|
+
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
12
|
+
}, Ne = function* (t) {
|
|
6
13
|
const e = document.createNodeIterator(
|
|
7
14
|
t.commonAncestorContainer,
|
|
8
15
|
NodeFilter.SHOW_ELEMENT,
|
|
9
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
16
|
+
(o) => o instanceof HTMLElement && o.classList.contains(le) && !o.parentElement.closest(Z) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
10
17
|
);
|
|
11
18
|
let n;
|
|
12
19
|
for (; n = e.nextNode(); )
|
|
13
20
|
n instanceof HTMLElement && (yield n);
|
|
14
|
-
},
|
|
21
|
+
}, _e = (t) => {
|
|
15
22
|
if (!Me(t)) return [];
|
|
16
23
|
const e = [];
|
|
17
24
|
let n = null;
|
|
18
|
-
for (const o of
|
|
25
|
+
for (const o of Ne(t)) {
|
|
19
26
|
let i;
|
|
20
27
|
n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
|
|
21
28
|
}
|
|
@@ -26,15 +33,7 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
26
33
|
return e.length > 0 ? e : [t];
|
|
27
34
|
}, Dt = (t) => {
|
|
28
35
|
const e = t.cloneContents();
|
|
29
|
-
return e.querySelectorAll(
|
|
30
|
-
}, Ie = (t) => t.addEventListener("click", (e) => {
|
|
31
|
-
// Allow clicks within not-annotatable elements
|
|
32
|
-
!e.target.closest(j) && !e.target.closest("a") && e.preventDefault();
|
|
33
|
-
}), _e = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Ne = (t) => {
|
|
34
|
-
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
35
|
-
}, Ro = (t) => {
|
|
36
|
-
const e = t.cloneContents();
|
|
37
|
-
return e.querySelectorAll(j).forEach((n) => n.remove()), e;
|
|
36
|
+
return e.querySelectorAll(Z).forEach((n) => n.remove()), e;
|
|
38
37
|
}, Ue = (t, e, n = 10, o) => {
|
|
39
38
|
const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();
|
|
40
39
|
s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
|
|
@@ -45,7 +44,7 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
45
44
|
prefix: r.substring(r.length - n),
|
|
46
45
|
suffix: d.substring(0, n)
|
|
47
46
|
};
|
|
48
|
-
},
|
|
47
|
+
}, F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), De = /^\s*$/, Ve = (t) => De.test(t.toString()), Ke = (t, e) => {
|
|
49
48
|
const n = (s) => Math.round(s * 10) / 10, o = {
|
|
50
49
|
top: n(t.top),
|
|
51
50
|
bottom: n(t.bottom),
|
|
@@ -100,19 +99,19 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
100
99
|
for (let e = 0; e < this.length; e++)
|
|
101
100
|
yield this.item(e);
|
|
102
101
|
}
|
|
103
|
-
}),
|
|
102
|
+
}), Pe = (t, e, n) => {
|
|
104
103
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
105
104
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
106
105
|
const s = Dt(o).textContent, r = t.toString(), a = s.length || 0, d = a + r.length;
|
|
107
106
|
return n ? { quote: r, start: a, end: d, range: t, offsetReference: i } : { quote: r, start: a, end: d, range: t };
|
|
108
|
-
},
|
|
109
|
-
var
|
|
107
|
+
}, de = (t, e) => {
|
|
108
|
+
var h, l;
|
|
110
109
|
const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
|
|
111
110
|
e,
|
|
112
111
|
NodeFilter.SHOW_TEXT,
|
|
113
|
-
(
|
|
114
|
-
var
|
|
115
|
-
return (
|
|
112
|
+
(g) => {
|
|
113
|
+
var p;
|
|
114
|
+
return (p = g.parentElement) != null && p.closest(Z) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
116
115
|
}
|
|
117
116
|
);
|
|
118
117
|
let r = 0;
|
|
@@ -122,43 +121,43 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
122
121
|
let c = !i;
|
|
123
122
|
for (; d !== null; ) {
|
|
124
123
|
if (c || (c = i == null ? void 0 : i.contains(d)), c) {
|
|
125
|
-
const
|
|
126
|
-
if (r +
|
|
124
|
+
const g = ((h = d.textContent) == null ? void 0 : h.length) || 0;
|
|
125
|
+
if (r + g > n) {
|
|
127
126
|
a.setStart(d, n - r);
|
|
128
127
|
break;
|
|
129
128
|
}
|
|
130
|
-
r +=
|
|
129
|
+
r += g;
|
|
131
130
|
}
|
|
132
131
|
d = s.nextNode();
|
|
133
132
|
}
|
|
134
133
|
for (; d !== null; ) {
|
|
135
|
-
const
|
|
136
|
-
if (r +
|
|
134
|
+
const g = ((l = d.textContent) == null ? void 0 : l.length) || 0;
|
|
135
|
+
if (r + g >= o) {
|
|
137
136
|
a.setEnd(d, o - r);
|
|
138
137
|
break;
|
|
139
138
|
}
|
|
140
|
-
r +=
|
|
139
|
+
r += g, d = s.nextNode();
|
|
141
140
|
}
|
|
142
141
|
return {
|
|
143
142
|
...t,
|
|
144
143
|
range: a
|
|
145
144
|
};
|
|
146
|
-
}, wt = (t, e) =>
|
|
145
|
+
}, wt = (t, e) => F(t.selector) ? t : {
|
|
147
146
|
...t,
|
|
148
|
-
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
149
|
-
}, xt = (t, e) =>
|
|
147
|
+
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : de(n, e))
|
|
148
|
+
}, xt = (t, e) => F(t.target.selector) ? t : { ...t, target: wt(t.target, e) }, ue = (t, e) => {
|
|
150
149
|
if (t.isEqualNode(e))
|
|
151
150
|
return !0;
|
|
152
151
|
for (let n of t.childNodes)
|
|
153
|
-
if (
|
|
152
|
+
if (ue(n, e))
|
|
154
153
|
return !0;
|
|
155
154
|
return !1;
|
|
156
|
-
},
|
|
155
|
+
}, $e = (t, e) => {
|
|
157
156
|
const n = t.cloneContents();
|
|
158
|
-
return
|
|
157
|
+
return ue(n, e);
|
|
159
158
|
}, je = (t, e) => {
|
|
160
159
|
const n = t.cloneRange(), o = e.contains(n.startContainer), i = e.contains(n.endContainer);
|
|
161
|
-
return !o && !i &&
|
|
160
|
+
return !o && !i && !$e(n, e) ? (n.collapse(), n) : (o || n.setStart(e, 0), i || n.setEnd(e, e.childNodes.length), n);
|
|
162
161
|
}, Et = (t) => ({
|
|
163
162
|
...t,
|
|
164
163
|
type: t.type,
|
|
@@ -207,16 +206,16 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
207
206
|
}, Bo = (t, e) => {
|
|
208
207
|
const { left: n, top: o, right: i, bottom: s } = t;
|
|
209
208
|
return new DOMRect(n + e.left, o + e.top, i - n, s - o);
|
|
210
|
-
},
|
|
209
|
+
}, fe = (t) => {
|
|
211
210
|
if (t === null)
|
|
212
211
|
return document.scrollingElement;
|
|
213
212
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
214
|
-
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
213
|
+
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : fe(t.parentElement);
|
|
215
214
|
}, ze = (t, e) => (n) => {
|
|
216
215
|
const o = typeof n == "string" ? n : n.id, i = (r) => {
|
|
217
|
-
const a = s.getBoundingClientRect(), d = s.clientHeight, c = s.clientWidth,
|
|
216
|
+
const a = s.getBoundingClientRect(), d = s.clientHeight, c = s.clientWidth, h = r.selector[0].range.getBoundingClientRect(), { width: l, height: g } = e.getAnnotationBounds(o), p = h.top - a.top, v = h.left - a.left, w = s.parentElement ? s.scrollTop : 0, E = s.parentElement ? s.scrollLeft : 0, m = p + w - (d - g) / 2, u = v + E - (c - l) / 2;
|
|
218
217
|
s.scroll({ top: m, left: u, behavior: "smooth" });
|
|
219
|
-
}, s =
|
|
218
|
+
}, s = fe(t);
|
|
220
219
|
if (s) {
|
|
221
220
|
const r = e.getAnnotation(o), { range: a } = r.target.selector[0];
|
|
222
221
|
if (a && !a.collapsed)
|
|
@@ -228,7 +227,7 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
229
|
return !1;
|
|
231
|
-
},
|
|
230
|
+
}, W = {
|
|
232
231
|
fill: "rgb(0, 128, 255)",
|
|
233
232
|
fillOpacity: 0.18
|
|
234
233
|
}, vt = {
|
|
@@ -236,14 +235,14 @@ const de = "not-annotatable", j = `.${de}`, Me = (t) => {
|
|
|
236
235
|
fillOpacity: 0.45
|
|
237
236
|
}, Fe = (t, e, n, o, i) => {
|
|
238
237
|
var r, a;
|
|
239
|
-
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ? vt :
|
|
238
|
+
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ? vt : W) : n : (a = t.state) != null && a.selected ? vt : W;
|
|
240
239
|
return o && o.paint(t, e) || s;
|
|
241
240
|
};
|
|
242
241
|
function We(t) {
|
|
243
242
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
244
243
|
}
|
|
245
244
|
var Yt = { exports: {} };
|
|
246
|
-
function
|
|
245
|
+
function he(t, e = 100, n = {}) {
|
|
247
246
|
if (typeof t != "function")
|
|
248
247
|
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof t}\`.`);
|
|
249
248
|
if (e < 0)
|
|
@@ -251,19 +250,19 @@ function ge(t, e = 100, n = {}) {
|
|
|
251
250
|
const { immediate: o } = typeof n == "boolean" ? { immediate: n } : n;
|
|
252
251
|
let i, s, r, a, d;
|
|
253
252
|
function c() {
|
|
254
|
-
const
|
|
255
|
-
return i = void 0, s = void 0, d = t.apply(
|
|
253
|
+
const g = i, p = s;
|
|
254
|
+
return i = void 0, s = void 0, d = t.apply(g, p), d;
|
|
256
255
|
}
|
|
257
|
-
function
|
|
258
|
-
const
|
|
259
|
-
|
|
256
|
+
function h() {
|
|
257
|
+
const g = Date.now() - a;
|
|
258
|
+
g < e && g >= 0 ? r = setTimeout(h, e - g) : (r = void 0, o || (d = c()));
|
|
260
259
|
}
|
|
261
|
-
const l = function(...
|
|
260
|
+
const l = function(...g) {
|
|
262
261
|
if (i && this !== i && Object.getPrototypeOf(this) === Object.getPrototypeOf(i))
|
|
263
262
|
throw new Error("Debounced method called with different contexts of the same prototype.");
|
|
264
|
-
i = this, s =
|
|
265
|
-
const
|
|
266
|
-
return r || (r = setTimeout(
|
|
263
|
+
i = this, s = g, a = Date.now();
|
|
264
|
+
const p = o && !r;
|
|
265
|
+
return r || (r = setTimeout(h, e)), p && (d = c()), d;
|
|
267
266
|
};
|
|
268
267
|
return l.clear = () => {
|
|
269
268
|
r && (clearTimeout(r), r = void 0);
|
|
@@ -273,8 +272,8 @@ function ge(t, e = 100, n = {}) {
|
|
|
273
272
|
d = c(), l.clear();
|
|
274
273
|
}, l;
|
|
275
274
|
}
|
|
276
|
-
Yt.exports.debounce =
|
|
277
|
-
Yt.exports =
|
|
275
|
+
Yt.exports.debounce = he;
|
|
276
|
+
Yt.exports = he;
|
|
278
277
|
var qe = Yt.exports;
|
|
279
278
|
const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
280
279
|
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, r = -e, a = o - n, d = i - e;
|
|
@@ -285,48 +284,48 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
285
284
|
const i = o.map((s) => s.id);
|
|
286
285
|
(e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);
|
|
287
286
|
};
|
|
288
|
-
},
|
|
287
|
+
}, Pt = (t, e, n, o) => {
|
|
289
288
|
const { store: i, selection: s, hover: r } = e;
|
|
290
289
|
let a, d, c;
|
|
291
|
-
const
|
|
292
|
-
const { x:
|
|
293
|
-
|
|
290
|
+
const h = Qe(n), l = (O) => {
|
|
291
|
+
const { x: M, y: f } = t.getBoundingClientRect(), y = i.getAt(O.clientX - M, O.clientY - f, d);
|
|
292
|
+
y ? r.current !== y.id && (t.classList.add("hovered"), r.set(y.id)) : r.current && (t.classList.remove("hovered"), r.set(null));
|
|
294
293
|
};
|
|
295
294
|
t.addEventListener("pointermove", l);
|
|
296
|
-
const
|
|
295
|
+
const g = (O = !1) => {
|
|
297
296
|
c && c.clear();
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
return { annotation:
|
|
297
|
+
const M = Ge(t), { minX: f, minY: y, maxX: x, maxY: C } = M, B = d ? i.getIntersecting(f, y, x, C).filter(({ annotation: Y }) => d(Y)) : i.getIntersecting(f, y, x, C), R = s.selected.map(({ id: Y }) => Y), K = B.map(({ annotation: Y, rects: At }) => {
|
|
298
|
+
const dt = R.includes(Y.id), Re = Y.id === r.current;
|
|
299
|
+
return { annotation: Y, rects: At, state: { selected: dt, hover: Re } };
|
|
301
300
|
});
|
|
302
|
-
o.redraw(
|
|
303
|
-
},
|
|
304
|
-
c =
|
|
305
|
-
}, v = (
|
|
306
|
-
a =
|
|
307
|
-
},
|
|
308
|
-
d =
|
|
309
|
-
}, E = () =>
|
|
301
|
+
o.redraw(K, M, a, c, O), setTimeout(() => h(B.map(({ annotation: Y }) => Y)), 1);
|
|
302
|
+
}, p = (O) => {
|
|
303
|
+
c = O, g();
|
|
304
|
+
}, v = (O) => {
|
|
305
|
+
a = O, g();
|
|
306
|
+
}, w = (O) => {
|
|
307
|
+
d = O, g(!1);
|
|
308
|
+
}, E = () => g();
|
|
310
309
|
i.observe(E);
|
|
311
|
-
const m = s.subscribe(() =>
|
|
310
|
+
const m = s.subscribe(() => g()), u = () => g(!0);
|
|
312
311
|
document.addEventListener("scroll", u, { capture: !0, passive: !0 });
|
|
313
|
-
const
|
|
314
|
-
i.recalculatePositions(), c == null || c.reset(),
|
|
312
|
+
const b = Xt(() => {
|
|
313
|
+
i.recalculatePositions(), c == null || c.reset(), g();
|
|
315
314
|
}, 10);
|
|
316
|
-
window.addEventListener("resize",
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const A = { attributes: !0, childList: !0, subtree: !0 }, L = new MutationObserver((
|
|
320
|
-
|
|
315
|
+
window.addEventListener("resize", b);
|
|
316
|
+
const S = new ResizeObserver(b);
|
|
317
|
+
S.observe(t);
|
|
318
|
+
const A = { attributes: !0, childList: !0, subtree: !0 }, L = new MutationObserver((O) => {
|
|
319
|
+
O.every((f) => f.target === t || t.contains(f.target)) || g(!0);
|
|
321
320
|
});
|
|
322
321
|
return L.observe(document.body, A), {
|
|
323
322
|
destroy: () => {
|
|
324
|
-
t.removeEventListener("pointermove", l), o.destroy(), i.unobserve(E), m(), document.removeEventListener("scroll", u),
|
|
323
|
+
t.removeEventListener("pointermove", l), o.destroy(), i.unobserve(E), m(), document.removeEventListener("scroll", u), b.clear(), window.removeEventListener("resize", b), S.disconnect(), L.disconnect();
|
|
325
324
|
},
|
|
326
|
-
redraw:
|
|
325
|
+
redraw: g,
|
|
327
326
|
setStyle: v,
|
|
328
|
-
setFilter:
|
|
329
|
-
setPainter:
|
|
327
|
+
setFilter: w,
|
|
328
|
+
setPainter: p,
|
|
330
329
|
setVisible: o.setVisible
|
|
331
330
|
};
|
|
332
331
|
}, Je = () => {
|
|
@@ -338,28 +337,28 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
338
337
|
t.classList.add("r6o-annotatable");
|
|
339
338
|
const e = Je(), n = e.getContext("2d");
|
|
340
339
|
document.body.appendChild(e);
|
|
341
|
-
const o = (a, d, c,
|
|
342
|
-
const { width: l, height:
|
|
343
|
-
n.clearRect(-0.5, -0.5, l + 1,
|
|
344
|
-
const { top:
|
|
340
|
+
const o = (a, d, c, h) => requestAnimationFrame(() => {
|
|
341
|
+
const { width: l, height: g } = e;
|
|
342
|
+
n.clearRect(-0.5, -0.5, l + 1, g + 1), h && h.clear();
|
|
343
|
+
const { top: p, left: v } = d;
|
|
345
344
|
[...a].sort((E, m) => {
|
|
346
|
-
const { annotation: { target: { created: u } } } = E, { annotation: { target: { created:
|
|
347
|
-
return u.getTime() -
|
|
345
|
+
const { annotation: { target: { created: u } } } = E, { annotation: { target: { created: b } } } = m;
|
|
346
|
+
return u.getTime() - b.getTime();
|
|
348
347
|
}).forEach((E) => {
|
|
349
|
-
var
|
|
350
|
-
const m = c ? typeof c == "function" ? c(E.annotation, E.state) : c : (
|
|
348
|
+
var S;
|
|
349
|
+
const m = c ? typeof c == "function" ? c(E.annotation, E.state) : c : (S = E.state) != null && S.selected ? vt : W, u = h && h.paint(E, d) || m, b = E.rects.map(({ x: A, y: L, width: T, height: O }) => ({
|
|
351
350
|
x: A + v,
|
|
352
|
-
y: L +
|
|
353
|
-
width:
|
|
354
|
-
height:
|
|
351
|
+
y: L + p,
|
|
352
|
+
width: T,
|
|
353
|
+
height: O
|
|
355
354
|
}));
|
|
356
|
-
if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1,
|
|
357
|
-
({ x: A, y: L, width:
|
|
355
|
+
if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1, b.forEach(
|
|
356
|
+
({ x: A, y: L, width: T, height: O }) => n.fillRect(A, L, T, O)
|
|
358
357
|
), u.underlineColor) {
|
|
359
358
|
n.globalAlpha = 1, n.strokeStyle = u.underlineColor, n.lineWidth = u.underlineThickness ?? 1;
|
|
360
359
|
const A = u.underlineOffset ?? 0;
|
|
361
|
-
|
|
362
|
-
n.beginPath(), n.moveTo(L,
|
|
360
|
+
b.forEach(({ x: L, y: T, width: O, height: M }) => {
|
|
361
|
+
n.beginPath(), n.moveTo(L, T + M + A), n.lineTo(L + O, T + M + A), n.stroke();
|
|
363
362
|
});
|
|
364
363
|
}
|
|
365
364
|
});
|
|
@@ -373,96 +372,96 @@ const Xt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
|
373
372
|
},
|
|
374
373
|
redraw: o
|
|
375
374
|
};
|
|
376
|
-
}, en = (t, e, n) =>
|
|
377
|
-
var nn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
375
|
+
}, en = (t, e, n) => Pt(t, e, n, tn(t));
|
|
376
|
+
var nn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, H = function(t) {
|
|
378
377
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
379
|
-
},
|
|
378
|
+
}, _ = function(t, e, n) {
|
|
380
379
|
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
|
|
381
380
|
}, X = function(t, e, n) {
|
|
382
381
|
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
|
|
383
382
|
}, pe = function(t) {
|
|
384
383
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
385
|
-
},
|
|
384
|
+
}, Ht = function(t) {
|
|
386
385
|
return { r: X(t.r, 0, 255), g: X(t.g, 0, 255), b: X(t.b, 0, 255), a: X(t.a) };
|
|
387
386
|
}, St = function(t) {
|
|
388
|
-
return { r:
|
|
387
|
+
return { r: _(t.r), g: _(t.g), b: _(t.b), a: _(t.a, 3) };
|
|
389
388
|
}, on = /^#([0-9a-f]{3,8})$/i, ft = function(t) {
|
|
390
389
|
var e = t.toString(16);
|
|
391
390
|
return e.length < 2 ? "0" + e : e;
|
|
392
|
-
},
|
|
391
|
+
}, ge = function(t) {
|
|
393
392
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = Math.max(e, n, o), r = s - Math.min(e, n, o), a = r ? s === e ? (n - o) / r : s === n ? 2 + (o - e) / r : 4 + (e - n) / r : 0;
|
|
394
393
|
return { h: 60 * (a < 0 ? a + 6 : a), s: s ? r / s * 100 : 0, v: s / 255 * 100, a: i };
|
|
395
|
-
},
|
|
394
|
+
}, me = function(t) {
|
|
396
395
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
397
396
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
398
397
|
var s = Math.floor(e), r = o * (1 - n), a = o * (1 - (e - s) * n), d = o * (1 - (1 - e + s) * n), c = s % 6;
|
|
399
398
|
return { r: 255 * [o, a, r, r, d, o][c], g: 255 * [d, o, o, a, r, r][c], b: 255 * [r, r, d, o, o, a][c], a: i };
|
|
400
|
-
},
|
|
399
|
+
}, zt = function(t) {
|
|
401
400
|
return { h: pe(t.h), s: X(t.s, 0, 100), l: X(t.l, 0, 100), a: X(t.a) };
|
|
401
|
+
}, Ft = function(t) {
|
|
402
|
+
return { h: _(t.h), s: _(t.s), l: _(t.l), a: _(t.a, 3) };
|
|
402
403
|
}, Wt = function(t) {
|
|
403
|
-
return { h:
|
|
404
|
-
}, qt = function(t) {
|
|
405
|
-
return ye((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
|
|
404
|
+
return me((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
|
|
406
405
|
var e, n, o;
|
|
407
406
|
}, st = function(t) {
|
|
408
|
-
return { h: (e =
|
|
407
|
+
return { h: (e = ge(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
|
|
409
408
|
var e, n, o, i;
|
|
410
|
-
}, sn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, rn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, an = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, cn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,
|
|
409
|
+
}, sn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, rn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, an = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, cn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, qt = { string: [[function(t) {
|
|
411
410
|
var e = on.exec(t);
|
|
412
|
-
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ?
|
|
411
|
+
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? _(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? _(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
413
412
|
}, "hex"], [function(t) {
|
|
414
413
|
var e = an.exec(t) || cn.exec(t);
|
|
415
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null :
|
|
414
|
+
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : Ht({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
|
|
416
415
|
}, "rgb"], [function(t) {
|
|
417
416
|
var e = sn.exec(t) || rn.exec(t);
|
|
418
417
|
if (!e) return null;
|
|
419
|
-
var n, o, i =
|
|
420
|
-
return
|
|
418
|
+
var n, o, i = zt({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (nn[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
|
|
419
|
+
return Wt(i);
|
|
421
420
|
}, "hsl"]], object: [[function(t) {
|
|
422
421
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;
|
|
423
|
-
return
|
|
422
|
+
return H(e) && H(n) && H(o) ? Ht({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;
|
|
424
423
|
}, "rgb"], [function(t) {
|
|
425
424
|
var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;
|
|
426
|
-
if (!
|
|
427
|
-
var r =
|
|
428
|
-
return
|
|
425
|
+
if (!H(e) || !H(n) || !H(o)) return null;
|
|
426
|
+
var r = zt({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });
|
|
427
|
+
return Wt(r);
|
|
429
428
|
}, "hsl"], [function(t) {
|
|
430
429
|
var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;
|
|
431
|
-
if (!
|
|
430
|
+
if (!H(e) || !H(n) || !H(o)) return null;
|
|
432
431
|
var r = function(a) {
|
|
433
432
|
return { h: pe(a.h), s: X(a.s, 0, 100), v: X(a.v, 0, 100), a: X(a.a) };
|
|
434
433
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });
|
|
435
|
-
return
|
|
436
|
-
}, "hsv"]] },
|
|
434
|
+
return me(r);
|
|
435
|
+
}, "hsv"]] }, Gt = function(t, e) {
|
|
437
436
|
for (var n = 0; n < e.length; n++) {
|
|
438
437
|
var o = e[n][0](t);
|
|
439
438
|
if (o) return [o, e[n][1]];
|
|
440
439
|
}
|
|
441
440
|
return [null, void 0];
|
|
442
441
|
}, ln = function(t) {
|
|
443
|
-
return typeof t == "string" ?
|
|
442
|
+
return typeof t == "string" ? Gt(t.trim(), qt.string) : typeof t == "object" && t !== null ? Gt(t, qt.object) : [null, void 0];
|
|
444
443
|
}, Ct = function(t, e) {
|
|
445
444
|
var n = st(t);
|
|
446
445
|
return { h: n.h, s: X(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
447
446
|
}, Lt = function(t) {
|
|
448
447
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
449
|
-
},
|
|
448
|
+
}, Qt = function(t, e) {
|
|
450
449
|
var n = st(t);
|
|
451
450
|
return { h: n.h, s: n.s, l: X(n.l + 100 * e, 0, 100), a: n.a };
|
|
452
|
-
},
|
|
451
|
+
}, Jt = function() {
|
|
453
452
|
function t(e) {
|
|
454
453
|
this.parsed = ln(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
455
454
|
}
|
|
456
455
|
return t.prototype.isValid = function() {
|
|
457
456
|
return this.parsed !== null;
|
|
458
457
|
}, t.prototype.brightness = function() {
|
|
459
|
-
return
|
|
458
|
+
return _(Lt(this.rgba), 2);
|
|
460
459
|
}, t.prototype.isDark = function() {
|
|
461
460
|
return Lt(this.rgba) < 0.5;
|
|
462
461
|
}, t.prototype.isLight = function() {
|
|
463
462
|
return Lt(this.rgba) >= 0.5;
|
|
464
463
|
}, t.prototype.toHex = function() {
|
|
465
|
-
return e = St(this.rgba), n = e.r, o = e.g, i = e.b, r = (s = e.a) < 1 ? ft(
|
|
464
|
+
return e = St(this.rgba), n = e.r, o = e.g, i = e.b, r = (s = e.a) < 1 ? ft(_(255 * s)) : "", "#" + ft(n) + ft(o) + ft(i) + r;
|
|
466
465
|
var e, n, o, i, s, r;
|
|
467
466
|
}, t.prototype.toRgb = function() {
|
|
468
467
|
return St(this.rgba);
|
|
@@ -470,42 +469,42 @@ var nn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, z = function(t) {
|
|
|
470
469
|
return e = St(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + s + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
471
470
|
var e, n, o, i, s;
|
|
472
471
|
}, t.prototype.toHsl = function() {
|
|
473
|
-
return
|
|
472
|
+
return Ft(st(this.rgba));
|
|
474
473
|
}, t.prototype.toHslString = function() {
|
|
475
|
-
return e =
|
|
474
|
+
return e = Ft(st(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + s + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
|
|
476
475
|
var e, n, o, i, s;
|
|
477
476
|
}, t.prototype.toHsv = function() {
|
|
478
|
-
return e =
|
|
477
|
+
return e = ge(this.rgba), { h: _(e.h), s: _(e.s), v: _(e.v), a: _(e.a, 3) };
|
|
479
478
|
var e;
|
|
480
479
|
}, t.prototype.invert = function() {
|
|
481
|
-
return
|
|
480
|
+
return $({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
482
481
|
var e;
|
|
483
482
|
}, t.prototype.saturate = function(e) {
|
|
484
|
-
return e === void 0 && (e = 0.1),
|
|
483
|
+
return e === void 0 && (e = 0.1), $(Ct(this.rgba, e));
|
|
485
484
|
}, t.prototype.desaturate = function(e) {
|
|
486
|
-
return e === void 0 && (e = 0.1),
|
|
485
|
+
return e === void 0 && (e = 0.1), $(Ct(this.rgba, -e));
|
|
487
486
|
}, t.prototype.grayscale = function() {
|
|
488
|
-
return
|
|
487
|
+
return $(Ct(this.rgba, -1));
|
|
489
488
|
}, t.prototype.lighten = function(e) {
|
|
490
|
-
return e === void 0 && (e = 0.1),
|
|
489
|
+
return e === void 0 && (e = 0.1), $(Qt(this.rgba, e));
|
|
491
490
|
}, t.prototype.darken = function(e) {
|
|
492
|
-
return e === void 0 && (e = 0.1),
|
|
491
|
+
return e === void 0 && (e = 0.1), $(Qt(this.rgba, -e));
|
|
493
492
|
}, t.prototype.rotate = function(e) {
|
|
494
493
|
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
495
494
|
}, t.prototype.alpha = function(e) {
|
|
496
|
-
return typeof e == "number" ?
|
|
495
|
+
return typeof e == "number" ? $({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : _(this.rgba.a, 3);
|
|
497
496
|
var n;
|
|
498
497
|
}, t.prototype.hue = function(e) {
|
|
499
498
|
var n = st(this.rgba);
|
|
500
|
-
return typeof e == "number" ?
|
|
499
|
+
return typeof e == "number" ? $({ h: e, s: n.s, l: n.l, a: n.a }) : _(n.h);
|
|
501
500
|
}, t.prototype.isEqual = function(e) {
|
|
502
|
-
return this.toHex() ===
|
|
501
|
+
return this.toHex() === $(e).toHex();
|
|
503
502
|
}, t;
|
|
504
|
-
}(),
|
|
505
|
-
return t instanceof
|
|
503
|
+
}(), $ = function(t) {
|
|
504
|
+
return t instanceof Jt ? t : new Jt(t);
|
|
506
505
|
};
|
|
507
506
|
const dn = (t) => [
|
|
508
|
-
`background-color:${
|
|
507
|
+
`background-color:${$((t == null ? void 0 : t.fill) || W.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? W.fillOpacity : t.fillOpacity).toHex()}`,
|
|
509
508
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
510
509
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
511
510
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
@@ -525,20 +524,20 @@ const dn = (t) => [
|
|
|
525
524
|
d && d.clear();
|
|
526
525
|
const c = new Set(s.map((l) => l.annotation.id));
|
|
527
526
|
Array.from(e).filter((l) => !c.has(l));
|
|
528
|
-
const
|
|
527
|
+
const h = s.map((l) => {
|
|
529
528
|
var v;
|
|
530
|
-
const
|
|
531
|
-
return `::highlight(_${l.annotation.id}) { ${dn(
|
|
529
|
+
const g = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (v = l.state) != null && v.selected ? vt : W, p = d && d.paint(l, r) || g;
|
|
530
|
+
return `::highlight(_${l.annotation.id}) { ${dn(p)} }`;
|
|
532
531
|
});
|
|
533
|
-
t.innerHTML =
|
|
532
|
+
t.innerHTML = h.join(`
|
|
534
533
|
`), CSS.highlights.clear(), s.forEach(({ annotation: l }) => {
|
|
535
|
-
const
|
|
536
|
-
CSS.highlights.set(`_${l.id}`,
|
|
534
|
+
const g = l.target.selector.map((v) => v.range), p = new Highlight(...g);
|
|
535
|
+
CSS.highlights.set(`_${l.id}`, p);
|
|
537
536
|
}), e = c;
|
|
538
537
|
}
|
|
539
538
|
};
|
|
540
|
-
}, fn = (t, e, n) =>
|
|
541
|
-
var
|
|
539
|
+
}, fn = (t, e, n) => Pt(t, e, n, un());
|
|
540
|
+
var Zt = Object.prototype.hasOwnProperty;
|
|
542
541
|
function Vt(t, e) {
|
|
543
542
|
var n, o;
|
|
544
543
|
if (t === e) return !0;
|
|
@@ -553,7 +552,7 @@ function Vt(t, e) {
|
|
|
553
552
|
if (!n || typeof t == "object") {
|
|
554
553
|
o = 0;
|
|
555
554
|
for (n in t)
|
|
556
|
-
if (
|
|
555
|
+
if (Zt.call(t, n) && ++o && !Zt.call(e, n) || !(n in e) || !Vt(t[n], e[n])) return !1;
|
|
557
556
|
return Object.keys(e).length === o;
|
|
558
557
|
}
|
|
559
558
|
}
|
|
@@ -562,7 +561,7 @@ function Vt(t, e) {
|
|
|
562
561
|
const hn = (t, e) => {
|
|
563
562
|
const n = (s, r) => s.x <= r.x + r.width && s.x + s.width >= r.x && s.y <= r.y + r.height && s.y + s.height >= r.y, o = (s) => s.rects.reduce((r, a) => r + a.width, 0), i = e.filter(({ rects: s }) => s.some((r) => n(t, r)));
|
|
564
563
|
return i.sort((s, r) => o(r) - o(s)), i.findIndex((s) => s.rects.includes(t));
|
|
565
|
-
},
|
|
564
|
+
}, pn = (t) => {
|
|
566
565
|
t.classList.add("r6o-annotatable");
|
|
567
566
|
const e = document.createElement("div");
|
|
568
567
|
e.className = "r6o-span-highlight-layer", t.insertBefore(e, t.firstChild);
|
|
@@ -571,18 +570,18 @@ const hn = (t, e) => {
|
|
|
571
570
|
destroy: () => {
|
|
572
571
|
e.remove();
|
|
573
572
|
},
|
|
574
|
-
redraw: (r, a, d, c,
|
|
575
|
-
const
|
|
576
|
-
if (!c && !
|
|
577
|
-
|
|
578
|
-
const { annotation: { target: { created: E } } } = v, { annotation: { target: { created: m } } } =
|
|
573
|
+
redraw: (r, a, d, c, h) => {
|
|
574
|
+
const g = !(Vt(n, r) && h);
|
|
575
|
+
if (!c && !g) return;
|
|
576
|
+
g && (e.innerHTML = ""), [...r].sort((v, w) => {
|
|
577
|
+
const { annotation: { target: { created: E } } } = v, { annotation: { target: { created: m } } } = w;
|
|
579
578
|
return E && m ? E.getTime() - m.getTime() : 0;
|
|
580
579
|
}).forEach((v) => {
|
|
581
|
-
v.rects.map((
|
|
582
|
-
const E = hn(
|
|
583
|
-
if (
|
|
580
|
+
v.rects.map((w) => {
|
|
581
|
+
const E = hn(w, r), m = Fe(v, a, d, c, E);
|
|
582
|
+
if (g) {
|
|
584
583
|
const u = document.createElement("span");
|
|
585
|
-
u.className = "r6o-annotation", u.dataset.annotation = v.annotation.id, u.style.left = `${
|
|
584
|
+
u.className = "r6o-annotation", u.dataset.annotation = v.annotation.id, u.style.left = `${w.x}px`, u.style.top = `${w.y}px`, u.style.width = `${w.width}px`, u.style.height = `${w.height}px`, u.style.backgroundColor = $((m == null ? void 0 : m.fill) || W.fill).alpha((m == null ? void 0 : m.fillOpacity) === void 0 ? W.fillOpacity : m.fillOpacity).toHex(), m.underlineStyle && (u.style.borderStyle = m.underlineStyle), m.underlineColor && (u.style.borderColor = m.underlineColor), m.underlineThickness && (u.style.borderBottomWidth = `${m.underlineThickness}px`), m.underlineOffset && (u.style.paddingBottom = `${m.underlineOffset}px`), e.appendChild(u);
|
|
586
585
|
}
|
|
587
586
|
});
|
|
588
587
|
}), n = r;
|
|
@@ -591,12 +590,12 @@ const hn = (t, e) => {
|
|
|
591
590
|
r ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
592
591
|
}
|
|
593
592
|
};
|
|
594
|
-
},
|
|
595
|
-
var
|
|
593
|
+
}, gn = (t, e, n) => Pt(t, e, n, pn(t));
|
|
594
|
+
var U = [];
|
|
596
595
|
for (var Ot = 0; Ot < 256; ++Ot)
|
|
597
|
-
|
|
596
|
+
U.push((Ot + 256).toString(16).slice(1));
|
|
598
597
|
function mn(t, e = 0) {
|
|
599
|
-
return (
|
|
598
|
+
return (U[t[e + 0]] + U[t[e + 1]] + U[t[e + 2]] + U[t[e + 3]] + "-" + U[t[e + 4]] + U[t[e + 5]] + "-" + U[t[e + 6]] + U[t[e + 7]] + "-" + U[t[e + 8]] + U[t[e + 9]] + "-" + U[t[e + 10]] + U[t[e + 11]] + U[t[e + 12]] + U[t[e + 13]] + U[t[e + 14]] + U[t[e + 15]]).toLowerCase();
|
|
600
599
|
}
|
|
601
600
|
var ht, yn = new Uint8Array(16);
|
|
602
601
|
function bn() {
|
|
@@ -605,18 +604,18 @@ function bn() {
|
|
|
605
604
|
return ht(yn);
|
|
606
605
|
}
|
|
607
606
|
var wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
608
|
-
const
|
|
607
|
+
const te = {
|
|
609
608
|
randomUUID: wn
|
|
610
609
|
};
|
|
611
|
-
function
|
|
612
|
-
if (
|
|
613
|
-
return
|
|
610
|
+
function ye(t, e, n) {
|
|
611
|
+
if (te.randomUUID && !e && !t)
|
|
612
|
+
return te.randomUUID();
|
|
614
613
|
t = t || {};
|
|
615
614
|
var o = t.random || (t.rng || bn)();
|
|
616
615
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, mn(o);
|
|
617
616
|
}
|
|
618
|
-
var
|
|
619
|
-
function
|
|
617
|
+
var ee = Object.prototype.hasOwnProperty;
|
|
618
|
+
function q(t, e) {
|
|
620
619
|
var n, o;
|
|
621
620
|
if (t === e) return !0;
|
|
622
621
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -624,13 +623,13 @@ function G(t, e) {
|
|
|
624
623
|
if (n === RegExp) return t.toString() === e.toString();
|
|
625
624
|
if (n === Array) {
|
|
626
625
|
if ((o = t.length) === e.length)
|
|
627
|
-
for (; o-- &&
|
|
626
|
+
for (; o-- && q(t[o], e[o]); ) ;
|
|
628
627
|
return o === -1;
|
|
629
628
|
}
|
|
630
629
|
if (!n || typeof t == "object") {
|
|
631
630
|
o = 0;
|
|
632
631
|
for (n in t)
|
|
633
|
-
if (
|
|
632
|
+
if (ee.call(t, n) && ++o && !ee.call(e, n) || !(n in e) || !q(t[n], e[n])) return !1;
|
|
634
633
|
return Object.keys(e).length === o;
|
|
635
634
|
}
|
|
636
635
|
}
|
|
@@ -641,19 +640,19 @@ function Tt() {
|
|
|
641
640
|
function vn(t, e) {
|
|
642
641
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
643
642
|
}
|
|
644
|
-
const
|
|
645
|
-
function
|
|
643
|
+
const G = [];
|
|
644
|
+
function $t(t, e = Tt) {
|
|
646
645
|
let n;
|
|
647
646
|
const o = /* @__PURE__ */ new Set();
|
|
648
647
|
function i(a) {
|
|
649
648
|
if (vn(t, a) && (t = a, n)) {
|
|
650
|
-
const d = !
|
|
649
|
+
const d = !G.length;
|
|
651
650
|
for (const c of o)
|
|
652
|
-
c[1](),
|
|
651
|
+
c[1](), G.push(c, t);
|
|
653
652
|
if (d) {
|
|
654
|
-
for (let c = 0; c <
|
|
655
|
-
|
|
656
|
-
|
|
653
|
+
for (let c = 0; c < G.length; c += 2)
|
|
654
|
+
G[c][0](G[c + 1]);
|
|
655
|
+
G.length = 0;
|
|
657
656
|
}
|
|
658
657
|
}
|
|
659
658
|
}
|
|
@@ -669,7 +668,7 @@ function Pt(t, e = Tt) {
|
|
|
669
668
|
return { set: i, update: s, subscribe: r };
|
|
670
669
|
}
|
|
671
670
|
const An = (t) => {
|
|
672
|
-
const { subscribe: e, set: n } =
|
|
671
|
+
const { subscribe: e, set: n } = $t();
|
|
673
672
|
let o;
|
|
674
673
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
675
674
|
if (o) {
|
|
@@ -686,52 +685,52 @@ const An = (t) => {
|
|
|
686
685
|
};
|
|
687
686
|
};
|
|
688
687
|
var xn = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(xn || {});
|
|
689
|
-
const
|
|
690
|
-
const { subscribe: o, set: i } =
|
|
691
|
-
let s = e, r =
|
|
688
|
+
const pt = { selected: [] }, En = (t, e, n) => {
|
|
689
|
+
const { subscribe: o, set: i } = $t(pt);
|
|
690
|
+
let s = e, r = pt;
|
|
692
691
|
o((v) => r = v);
|
|
693
692
|
const a = () => {
|
|
694
|
-
|
|
693
|
+
q(r, pt) || i(pt);
|
|
695
694
|
}, d = () => {
|
|
696
695
|
var v;
|
|
697
696
|
return ((v = r.selected) == null ? void 0 : v.length) === 0;
|
|
698
697
|
}, c = (v) => {
|
|
699
698
|
if (d())
|
|
700
699
|
return !1;
|
|
701
|
-
const
|
|
702
|
-
return r.selected.some((E) => E.id ===
|
|
703
|
-
},
|
|
700
|
+
const w = typeof v == "string" ? v : v.id;
|
|
701
|
+
return r.selected.some((E) => E.id === w);
|
|
702
|
+
}, h = (v, w) => {
|
|
704
703
|
const E = t.getAnnotation(v);
|
|
705
704
|
if (!E) {
|
|
706
705
|
console.warn("Invalid selection: " + v);
|
|
707
706
|
return;
|
|
708
707
|
}
|
|
709
|
-
switch (
|
|
708
|
+
switch (ne(E, s)) {
|
|
710
709
|
case "EDIT":
|
|
711
|
-
i({ selected: [{ id: v, editable: !0 }], event:
|
|
710
|
+
i({ selected: [{ id: v, editable: !0 }], event: w });
|
|
712
711
|
break;
|
|
713
712
|
case "SELECT":
|
|
714
|
-
i({ selected: [{ id: v }], event:
|
|
713
|
+
i({ selected: [{ id: v }], event: w });
|
|
715
714
|
break;
|
|
716
715
|
default:
|
|
717
|
-
i({ selected: [], event:
|
|
716
|
+
i({ selected: [], event: w });
|
|
718
717
|
}
|
|
719
|
-
}, l = (v,
|
|
718
|
+
}, l = (v, w) => {
|
|
720
719
|
const E = Array.isArray(v) ? v : [v], m = E.map((u) => t.getAnnotation(u)).filter((u) => !!u);
|
|
721
720
|
i({
|
|
722
721
|
selected: m.map((u) => {
|
|
723
|
-
const
|
|
724
|
-
return { id: u.id, editable:
|
|
722
|
+
const b = w === void 0 ? ne(u, s) === "EDIT" : w;
|
|
723
|
+
return { id: u.id, editable: b };
|
|
725
724
|
})
|
|
726
725
|
}), m.length !== E.length && console.warn("Invalid selection", v);
|
|
727
|
-
},
|
|
726
|
+
}, g = (v) => {
|
|
728
727
|
if (d())
|
|
729
728
|
return !1;
|
|
730
|
-
const { selected:
|
|
731
|
-
|
|
732
|
-
},
|
|
729
|
+
const { selected: w } = r;
|
|
730
|
+
w.some(({ id: E }) => v.includes(E)) && i({ selected: w.filter(({ id: E }) => !v.includes(E)) });
|
|
731
|
+
}, p = (v) => s = v;
|
|
733
732
|
return t.observe(
|
|
734
|
-
({ changes: v }) =>
|
|
733
|
+
({ changes: v }) => g((v.deleted || []).map((w) => w.id))
|
|
735
734
|
), {
|
|
736
735
|
get event() {
|
|
737
736
|
return r ? r.event : null;
|
|
@@ -746,30 +745,30 @@ const gt = { selected: [] }, En = (t, e, n) => {
|
|
|
746
745
|
isEmpty: d,
|
|
747
746
|
isSelected: c,
|
|
748
747
|
setSelected: l,
|
|
749
|
-
setUserSelectAction:
|
|
748
|
+
setUserSelectAction: p,
|
|
750
749
|
subscribe: o,
|
|
751
|
-
userSelect:
|
|
750
|
+
userSelect: h
|
|
752
751
|
};
|
|
753
|
-
},
|
|
754
|
-
var
|
|
752
|
+
}, ne = (t, e, n) => typeof e == "function" ? e(t) : e || "EDIT";
|
|
753
|
+
var D = [];
|
|
755
754
|
for (var Rt = 0; Rt < 256; ++Rt)
|
|
756
|
-
|
|
755
|
+
D.push((Rt + 256).toString(16).slice(1));
|
|
757
756
|
function Sn(t, e = 0) {
|
|
758
|
-
return (
|
|
757
|
+
return (D[t[e + 0]] + D[t[e + 1]] + D[t[e + 2]] + D[t[e + 3]] + "-" + D[t[e + 4]] + D[t[e + 5]] + "-" + D[t[e + 6]] + D[t[e + 7]] + "-" + D[t[e + 8]] + D[t[e + 9]] + "-" + D[t[e + 10]] + D[t[e + 11]] + D[t[e + 12]] + D[t[e + 13]] + D[t[e + 14]] + D[t[e + 15]]).toLowerCase();
|
|
759
758
|
}
|
|
760
|
-
var
|
|
759
|
+
var gt, Cn = new Uint8Array(16);
|
|
761
760
|
function Ln() {
|
|
762
|
-
if (!
|
|
761
|
+
if (!gt && (gt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !gt))
|
|
763
762
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
764
|
-
return
|
|
763
|
+
return gt(Cn);
|
|
765
764
|
}
|
|
766
765
|
var On = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
767
|
-
const
|
|
766
|
+
const oe = {
|
|
768
767
|
randomUUID: On
|
|
769
768
|
};
|
|
770
|
-
function
|
|
771
|
-
if (
|
|
772
|
-
return
|
|
769
|
+
function be(t, e, n) {
|
|
770
|
+
if (oe.randomUUID && !e && !t)
|
|
771
|
+
return oe.randomUUID();
|
|
773
772
|
t = t || {};
|
|
774
773
|
var o = t.random || (t.rng || Ln)();
|
|
775
774
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Sn(o);
|
|
@@ -785,7 +784,7 @@ const Mt = (t) => {
|
|
|
785
784
|
target: e(t.target)
|
|
786
785
|
};
|
|
787
786
|
}, ko = (t, e, n, o) => ({
|
|
788
|
-
id:
|
|
787
|
+
id: be(),
|
|
789
788
|
annotation: typeof t == "string" ? t : t.id,
|
|
790
789
|
created: n || /* @__PURE__ */ new Date(),
|
|
791
790
|
creator: o,
|
|
@@ -798,8 +797,8 @@ const Mt = (t) => {
|
|
|
798
797
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
799
798
|
}, Mn = (t, e) => e.bodies.map((n) => {
|
|
800
799
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
801
|
-
return { newBody: n, oldBody: o && !
|
|
802
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Bn = (t, e) => !
|
|
800
|
+
return { newBody: n, oldBody: o && !q(o, n) ? o : void 0 };
|
|
801
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Bn = (t, e) => !q(t.target, e.target), we = (t, e) => {
|
|
803
802
|
const n = Tn(t, e), o = Rn(t, e), i = Mn(t, e);
|
|
804
803
|
return {
|
|
805
804
|
oldValue: t,
|
|
@@ -819,7 +818,7 @@ const kn = (t, e) => {
|
|
|
819
818
|
if (t.options.ignore) {
|
|
820
819
|
const { ignore: r } = t.options, a = (d) => d && d.length > 0;
|
|
821
820
|
if (!(a(i.created) || a(i.deleted))) {
|
|
822
|
-
const d = (n = i.updated) == null ? void 0 : n.some((
|
|
821
|
+
const d = (n = i.updated) == null ? void 0 : n.some((h) => a(h.bodiesCreated) || a(h.bodiesDeleted) || a(h.bodiesUpdated)), c = (o = i.updated) == null ? void 0 : o.some((h) => h.targetUpdated);
|
|
823
822
|
if (r === "BODY_ONLY" && d && !c || r === "TARGET_ONLY" && c && !d)
|
|
824
823
|
return !1;
|
|
825
824
|
}
|
|
@@ -835,25 +834,25 @@ const kn = (t, e) => {
|
|
|
835
834
|
return !0;
|
|
836
835
|
}, In = (t, e) => {
|
|
837
836
|
const n = new Set((t.created || []).map((l) => l.id)), o = new Set((t.updated || []).map(({ newValue: l }) => l.id)), i = new Set((e.created || []).map((l) => l.id)), s = new Set((e.deleted || []).map((l) => l.id)), r = new Set((e.updated || []).map(({ oldValue: l }) => l.id)), a = new Set((e.updated || []).filter(({ oldValue: l }) => n.has(l.id) || o.has(l.id)).map(({ oldValue: l }) => l.id)), d = [
|
|
838
|
-
...(t.created || []).filter((l) => !s.has(l.id)).map((l) => r.has(l.id) ? e.updated.find(({ oldValue:
|
|
837
|
+
...(t.created || []).filter((l) => !s.has(l.id)).map((l) => r.has(l.id) ? e.updated.find(({ oldValue: g }) => g.id === l.id).newValue : l),
|
|
839
838
|
...e.created || []
|
|
840
839
|
], c = [
|
|
841
840
|
...(t.deleted || []).filter((l) => !i.has(l.id)),
|
|
842
841
|
...(e.deleted || []).filter((l) => !n.has(l.id))
|
|
843
|
-
],
|
|
842
|
+
], h = [
|
|
844
843
|
...(t.updated || []).filter(({ newValue: l }) => !s.has(l.id)).map((l) => {
|
|
845
|
-
const { oldValue:
|
|
846
|
-
if (r.has(
|
|
847
|
-
const v = e.updated.find((
|
|
848
|
-
return
|
|
844
|
+
const { oldValue: g, newValue: p } = l;
|
|
845
|
+
if (r.has(p.id)) {
|
|
846
|
+
const v = e.updated.find((w) => w.oldValue.id === p.id).newValue;
|
|
847
|
+
return we(g, v);
|
|
849
848
|
} else
|
|
850
849
|
return l;
|
|
851
850
|
}),
|
|
852
851
|
...(e.updated || []).filter(({ oldValue: l }) => !a.has(l.id))
|
|
853
852
|
];
|
|
854
|
-
return { created: d, deleted: c, updated:
|
|
853
|
+
return { created: d, deleted: c, updated: h };
|
|
855
854
|
}, Bt = (t) => {
|
|
856
|
-
const e = t.id === void 0 ?
|
|
855
|
+
const e = t.id === void 0 ? be() : t.id;
|
|
857
856
|
return {
|
|
858
857
|
...t,
|
|
859
858
|
id: e,
|
|
@@ -866,202 +865,202 @@ const kn = (t, e) => {
|
|
|
866
865
|
annotation: e
|
|
867
866
|
}
|
|
868
867
|
};
|
|
869
|
-
},
|
|
870
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (
|
|
871
|
-
n.push({ onChange:
|
|
872
|
-
}, i = (
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
}, s = (
|
|
868
|
+
}, Nn = (t) => t.id !== void 0, _n = () => {
|
|
869
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (f, y = {}) => {
|
|
870
|
+
n.push({ onChange: f, options: y });
|
|
871
|
+
}, i = (f) => {
|
|
872
|
+
const y = n.findIndex((x) => x.onChange == f);
|
|
873
|
+
y > -1 && n.splice(y, 1);
|
|
874
|
+
}, s = (f, y) => {
|
|
876
875
|
const x = {
|
|
877
|
-
origin:
|
|
876
|
+
origin: f,
|
|
878
877
|
changes: {
|
|
879
|
-
created:
|
|
880
|
-
updated:
|
|
881
|
-
deleted:
|
|
878
|
+
created: y.created || [],
|
|
879
|
+
updated: y.updated || [],
|
|
880
|
+
deleted: y.deleted || []
|
|
882
881
|
},
|
|
883
882
|
state: [...t.values()]
|
|
884
883
|
};
|
|
885
|
-
n.forEach((
|
|
886
|
-
kn(
|
|
884
|
+
n.forEach((C) => {
|
|
885
|
+
kn(C, x) && C.onChange(x);
|
|
887
886
|
});
|
|
888
|
-
}, r = (
|
|
889
|
-
if (
|
|
890
|
-
throw Error(`Cannot add annotation ${
|
|
887
|
+
}, r = (f, y = k.LOCAL) => {
|
|
888
|
+
if (f.id && t.get(f.id))
|
|
889
|
+
throw Error(`Cannot add annotation ${f.id} - exists already`);
|
|
891
890
|
{
|
|
892
|
-
const x = Bt(
|
|
893
|
-
t.set(x.id, x), x.bodies.forEach((
|
|
891
|
+
const x = Bt(f);
|
|
892
|
+
t.set(x.id, x), x.bodies.forEach((C) => e.set(C.id, x.id)), s(y, { created: [x] });
|
|
894
893
|
}
|
|
895
|
-
}, a = (
|
|
896
|
-
const x = Bt(typeof
|
|
894
|
+
}, a = (f, y) => {
|
|
895
|
+
const x = Bt(typeof f == "string" ? y : f), C = typeof f == "string" ? f : f.id, B = C && t.get(C);
|
|
897
896
|
if (B) {
|
|
898
|
-
const
|
|
899
|
-
return
|
|
897
|
+
const R = we(B, x);
|
|
898
|
+
return C === x.id ? t.set(C, x) : (t.delete(C), t.set(x.id, x)), B.bodies.forEach((K) => e.delete(K.id)), x.bodies.forEach((K) => e.set(K.id, x.id)), R;
|
|
900
899
|
} else
|
|
901
|
-
console.warn(`Cannot update annotation ${
|
|
902
|
-
}, d = (
|
|
903
|
-
const
|
|
904
|
-
B && s(
|
|
905
|
-
}, c = (
|
|
906
|
-
const x =
|
|
907
|
-
const
|
|
908
|
-
return
|
|
900
|
+
console.warn(`Cannot update annotation ${C} - does not exist`);
|
|
901
|
+
}, d = (f, y = k.LOCAL, x = k.LOCAL) => {
|
|
902
|
+
const C = Nn(y) ? x : y, B = a(f, y);
|
|
903
|
+
B && s(C, { updated: [B] });
|
|
904
|
+
}, c = (f, y = k.LOCAL) => {
|
|
905
|
+
const x = f.reduce((C, B) => {
|
|
906
|
+
const R = a(B);
|
|
907
|
+
return R ? [...C, R] : C;
|
|
909
908
|
}, []);
|
|
910
|
-
x.length > 0 && s(
|
|
911
|
-
},
|
|
912
|
-
const x = t.get(
|
|
909
|
+
x.length > 0 && s(y, { updated: x });
|
|
910
|
+
}, h = (f, y = k.LOCAL) => {
|
|
911
|
+
const x = t.get(f.annotation);
|
|
913
912
|
if (x) {
|
|
914
|
-
const
|
|
913
|
+
const C = {
|
|
915
914
|
...x,
|
|
916
|
-
bodies: [...x.bodies,
|
|
915
|
+
bodies: [...x.bodies, f]
|
|
917
916
|
};
|
|
918
|
-
t.set(x.id,
|
|
917
|
+
t.set(x.id, C), e.set(f.id, C.id), s(y, { updated: [{
|
|
919
918
|
oldValue: x,
|
|
920
|
-
newValue:
|
|
921
|
-
bodiesCreated: [
|
|
919
|
+
newValue: C,
|
|
920
|
+
bodiesCreated: [f]
|
|
922
921
|
}] });
|
|
923
922
|
} else
|
|
924
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
925
|
-
}, l = () => [...t.values()],
|
|
926
|
-
const
|
|
927
|
-
t.clear(), e.clear(), s(
|
|
928
|
-
},
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
923
|
+
console.warn(`Attempt to add body to missing annotation: ${f.annotation}`);
|
|
924
|
+
}, l = () => [...t.values()], g = (f = k.LOCAL) => {
|
|
925
|
+
const y = [...t.values()];
|
|
926
|
+
t.clear(), e.clear(), s(f, { deleted: y });
|
|
927
|
+
}, p = (f, y = !0, x = k.LOCAL) => {
|
|
928
|
+
const C = f.map(Bt);
|
|
929
|
+
if (y) {
|
|
931
930
|
const B = [...t.values()];
|
|
932
|
-
t.clear(), e.clear(),
|
|
933
|
-
t.set(
|
|
934
|
-
}), s(x, { created:
|
|
931
|
+
t.clear(), e.clear(), C.forEach((R) => {
|
|
932
|
+
t.set(R.id, R), R.bodies.forEach((K) => e.set(K.id, R.id));
|
|
933
|
+
}), s(x, { created: C, deleted: B });
|
|
935
934
|
} else {
|
|
936
|
-
const B =
|
|
937
|
-
const
|
|
938
|
-
return
|
|
935
|
+
const B = f.reduce((R, K) => {
|
|
936
|
+
const Y = K.id && t.get(K.id);
|
|
937
|
+
return Y ? [...R, Y] : R;
|
|
939
938
|
}, []);
|
|
940
939
|
if (B.length > 0)
|
|
941
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${B.map((
|
|
942
|
-
|
|
943
|
-
t.set(
|
|
944
|
-
}), s(x, { created:
|
|
940
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${B.map((R) => R.id).join(", ")}`);
|
|
941
|
+
C.forEach((R) => {
|
|
942
|
+
t.set(R.id, R), R.bodies.forEach((K) => e.set(K.id, R.id));
|
|
943
|
+
}), s(x, { created: C });
|
|
945
944
|
}
|
|
946
|
-
}, v = (
|
|
947
|
-
const
|
|
945
|
+
}, v = (f) => {
|
|
946
|
+
const y = typeof f == "string" ? f : f.id, x = t.get(y);
|
|
948
947
|
if (x)
|
|
949
|
-
return t.delete(
|
|
950
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
951
|
-
},
|
|
952
|
-
const x = v(
|
|
953
|
-
x && s(
|
|
954
|
-
}, E = (
|
|
955
|
-
const x =
|
|
956
|
-
const
|
|
957
|
-
return
|
|
948
|
+
return t.delete(y), x.bodies.forEach((C) => e.delete(C.id)), x;
|
|
949
|
+
console.warn(`Attempt to delete missing annotation: ${y}`);
|
|
950
|
+
}, w = (f, y = k.LOCAL) => {
|
|
951
|
+
const x = v(f);
|
|
952
|
+
x && s(y, { deleted: [x] });
|
|
953
|
+
}, E = (f, y = k.LOCAL) => {
|
|
954
|
+
const x = f.reduce((C, B) => {
|
|
955
|
+
const R = v(B);
|
|
956
|
+
return R ? [...C, R] : C;
|
|
958
957
|
}, []);
|
|
959
|
-
x.length > 0 && s(
|
|
960
|
-
}, m = (
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
963
|
-
const x =
|
|
958
|
+
x.length > 0 && s(y, { deleted: x });
|
|
959
|
+
}, m = (f) => {
|
|
960
|
+
const y = t.get(f.annotation);
|
|
961
|
+
if (y) {
|
|
962
|
+
const x = y.bodies.find((C) => C.id === f.id);
|
|
964
963
|
if (x) {
|
|
965
964
|
e.delete(x.id);
|
|
966
|
-
const
|
|
967
|
-
...
|
|
968
|
-
bodies:
|
|
965
|
+
const C = {
|
|
966
|
+
...y,
|
|
967
|
+
bodies: y.bodies.filter((B) => B.id !== f.id)
|
|
969
968
|
};
|
|
970
|
-
return t.set(
|
|
971
|
-
oldValue:
|
|
972
|
-
newValue:
|
|
969
|
+
return t.set(y.id, C), {
|
|
970
|
+
oldValue: y,
|
|
971
|
+
newValue: C,
|
|
973
972
|
bodiesDeleted: [x]
|
|
974
973
|
};
|
|
975
974
|
} else
|
|
976
|
-
console.warn(`Attempt to delete missing body ${
|
|
975
|
+
console.warn(`Attempt to delete missing body ${f.id} from annotation ${f.annotation}`);
|
|
977
976
|
} else
|
|
978
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
979
|
-
}, u = (
|
|
980
|
-
const x = m(
|
|
981
|
-
x && s(
|
|
982
|
-
},
|
|
983
|
-
const x =
|
|
984
|
-
x.length > 0 && s(
|
|
985
|
-
},
|
|
986
|
-
const
|
|
987
|
-
return
|
|
988
|
-
}, A = (
|
|
989
|
-
const
|
|
990
|
-
if (
|
|
991
|
-
const x =
|
|
977
|
+
console.warn(`Attempt to delete body from missing annotation ${f.annotation}`);
|
|
978
|
+
}, u = (f, y = k.LOCAL) => {
|
|
979
|
+
const x = m(f);
|
|
980
|
+
x && s(y, { updated: [x] });
|
|
981
|
+
}, b = (f, y = k.LOCAL) => {
|
|
982
|
+
const x = f.map((C) => m(C)).filter(Boolean);
|
|
983
|
+
x.length > 0 && s(y, { updated: x });
|
|
984
|
+
}, S = (f) => {
|
|
985
|
+
const y = t.get(f);
|
|
986
|
+
return y ? { ...y } : void 0;
|
|
987
|
+
}, A = (f) => {
|
|
988
|
+
const y = e.get(f);
|
|
989
|
+
if (y) {
|
|
990
|
+
const x = S(y).bodies.find((C) => C.id === f);
|
|
992
991
|
if (x)
|
|
993
992
|
return x;
|
|
994
|
-
console.error(`Store integrity error: body ${
|
|
993
|
+
console.error(`Store integrity error: body ${f} in index, but not in annotation`);
|
|
995
994
|
} else
|
|
996
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
997
|
-
}, L = (
|
|
998
|
-
if (
|
|
995
|
+
console.warn(`Attempt to retrieve missing body: ${f}`);
|
|
996
|
+
}, L = (f, y) => {
|
|
997
|
+
if (f.annotation !== y.annotation)
|
|
999
998
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
1000
|
-
const x = t.get(
|
|
999
|
+
const x = t.get(f.annotation);
|
|
1001
1000
|
if (x) {
|
|
1002
|
-
const
|
|
1001
|
+
const C = x.bodies.find((R) => R.id === f.id), B = {
|
|
1003
1002
|
...x,
|
|
1004
|
-
bodies: x.bodies.map((
|
|
1003
|
+
bodies: x.bodies.map((R) => R.id === C.id ? y : R)
|
|
1005
1004
|
};
|
|
1006
|
-
return t.set(x.id, B),
|
|
1005
|
+
return t.set(x.id, B), C.id !== y.id && (e.delete(C.id), e.set(y.id, B.id)), {
|
|
1007
1006
|
oldValue: x,
|
|
1008
1007
|
newValue: B,
|
|
1009
|
-
bodiesUpdated: [{ oldBody:
|
|
1008
|
+
bodiesUpdated: [{ oldBody: C, newBody: y }]
|
|
1010
1009
|
};
|
|
1011
1010
|
} else
|
|
1012
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
1013
|
-
},
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
},
|
|
1017
|
-
const x =
|
|
1018
|
-
s(
|
|
1019
|
-
},
|
|
1020
|
-
const
|
|
1021
|
-
if (
|
|
1011
|
+
console.warn(`Attempt to add body to missing annotation ${f.annotation}`);
|
|
1012
|
+
}, T = (f, y, x = k.LOCAL) => {
|
|
1013
|
+
const C = L(f, y);
|
|
1014
|
+
C && s(x, { updated: [C] });
|
|
1015
|
+
}, O = (f, y = k.LOCAL) => {
|
|
1016
|
+
const x = f.map((C) => L({ id: C.id, annotation: C.annotation }, C)).filter(Boolean);
|
|
1017
|
+
s(y, { updated: x });
|
|
1018
|
+
}, M = (f) => {
|
|
1019
|
+
const y = t.get(f.annotation);
|
|
1020
|
+
if (y) {
|
|
1022
1021
|
const x = {
|
|
1023
|
-
...
|
|
1022
|
+
...y,
|
|
1024
1023
|
target: {
|
|
1025
|
-
...
|
|
1026
|
-
...
|
|
1024
|
+
...y.target,
|
|
1025
|
+
...f
|
|
1027
1026
|
}
|
|
1028
1027
|
};
|
|
1029
|
-
return t.set(
|
|
1030
|
-
oldValue:
|
|
1028
|
+
return t.set(y.id, x), {
|
|
1029
|
+
oldValue: y,
|
|
1031
1030
|
newValue: x,
|
|
1032
1031
|
targetUpdated: {
|
|
1033
|
-
oldTarget:
|
|
1034
|
-
newTarget:
|
|
1032
|
+
oldTarget: y.target,
|
|
1033
|
+
newTarget: f
|
|
1035
1034
|
}
|
|
1036
1035
|
};
|
|
1037
1036
|
} else
|
|
1038
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
1037
|
+
console.warn(`Attempt to update target on missing annotation: ${f.annotation}`);
|
|
1039
1038
|
};
|
|
1040
1039
|
return {
|
|
1041
1040
|
addAnnotation: r,
|
|
1042
|
-
addBody:
|
|
1041
|
+
addBody: h,
|
|
1043
1042
|
all: l,
|
|
1044
|
-
bulkAddAnnotation:
|
|
1043
|
+
bulkAddAnnotation: p,
|
|
1045
1044
|
bulkDeleteAnnotation: E,
|
|
1046
|
-
bulkDeleteBodies:
|
|
1045
|
+
bulkDeleteBodies: b,
|
|
1047
1046
|
bulkUpdateAnnotation: c,
|
|
1048
|
-
bulkUpdateBodies:
|
|
1049
|
-
bulkUpdateTargets: (
|
|
1050
|
-
const x =
|
|
1051
|
-
x.length > 0 && s(
|
|
1047
|
+
bulkUpdateBodies: O,
|
|
1048
|
+
bulkUpdateTargets: (f, y = k.LOCAL) => {
|
|
1049
|
+
const x = f.map((C) => M(C)).filter(Boolean);
|
|
1050
|
+
x.length > 0 && s(y, { updated: x });
|
|
1052
1051
|
},
|
|
1053
|
-
clear:
|
|
1054
|
-
deleteAnnotation:
|
|
1052
|
+
clear: g,
|
|
1053
|
+
deleteAnnotation: w,
|
|
1055
1054
|
deleteBody: u,
|
|
1056
|
-
getAnnotation:
|
|
1055
|
+
getAnnotation: S,
|
|
1057
1056
|
getBody: A,
|
|
1058
1057
|
observe: o,
|
|
1059
1058
|
unobserve: i,
|
|
1060
1059
|
updateAnnotation: d,
|
|
1061
|
-
updateBody:
|
|
1062
|
-
updateTarget: (
|
|
1063
|
-
const x =
|
|
1064
|
-
x && s(
|
|
1060
|
+
updateBody: T,
|
|
1061
|
+
updateTarget: (f, y = k.LOCAL) => {
|
|
1062
|
+
const x = M(f);
|
|
1063
|
+
x && s(y, { updated: [x] });
|
|
1065
1064
|
}
|
|
1066
1065
|
};
|
|
1067
1066
|
};
|
|
@@ -1082,115 +1081,115 @@ let Un = () => ({
|
|
|
1082
1081
|
const Dn = 250, Vn = (t) => {
|
|
1083
1082
|
const e = Un(), n = [];
|
|
1084
1083
|
let o = -1, i = !1, s = 0;
|
|
1085
|
-
const r = (
|
|
1084
|
+
const r = (p) => {
|
|
1086
1085
|
if (!i) {
|
|
1087
|
-
const { changes: v } =
|
|
1088
|
-
if (
|
|
1086
|
+
const { changes: v } = p, w = performance.now();
|
|
1087
|
+
if (w - s > Dn)
|
|
1089
1088
|
n.splice(o + 1), n.push(v), o = n.length - 1;
|
|
1090
1089
|
else {
|
|
1091
1090
|
const E = n.length - 1;
|
|
1092
1091
|
n[E] = In(n[E], v);
|
|
1093
1092
|
}
|
|
1094
|
-
s =
|
|
1093
|
+
s = w;
|
|
1095
1094
|
}
|
|
1096
1095
|
i = !1;
|
|
1097
1096
|
};
|
|
1098
1097
|
t.observe(r, { origin: k.LOCAL });
|
|
1099
|
-
const a = (
|
|
1098
|
+
const a = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), d = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), c = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: v }) => v)), h = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: v }) => v)), l = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), g = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);
|
|
1100
1099
|
return {
|
|
1101
1100
|
canRedo: () => n.length - 1 > o,
|
|
1102
1101
|
canUndo: () => o > -1,
|
|
1103
1102
|
destroy: () => t.unobserve(r),
|
|
1104
|
-
on: (
|
|
1103
|
+
on: (p, v) => e.on(p, v),
|
|
1105
1104
|
redo: () => {
|
|
1106
1105
|
if (n.length - 1 > o) {
|
|
1107
1106
|
i = !0;
|
|
1108
|
-
const { created:
|
|
1109
|
-
d(
|
|
1107
|
+
const { created: p, updated: v, deleted: w } = n[o + 1];
|
|
1108
|
+
d(p), h(v), g(w), e.emit("redo", n[o + 1]), o += 1;
|
|
1110
1109
|
}
|
|
1111
1110
|
},
|
|
1112
1111
|
undo: () => {
|
|
1113
1112
|
if (o > -1) {
|
|
1114
1113
|
i = !0;
|
|
1115
|
-
const { created:
|
|
1116
|
-
a(
|
|
1114
|
+
const { created: p, updated: v, deleted: w } = n[o];
|
|
1115
|
+
a(p), c(v), l(w), e.emit("undo", n[o]), o -= 1;
|
|
1117
1116
|
}
|
|
1118
1117
|
}
|
|
1119
1118
|
};
|
|
1120
1119
|
}, Kn = () => {
|
|
1121
|
-
const { subscribe: t, set: e } =
|
|
1120
|
+
const { subscribe: t, set: e } = $t([]);
|
|
1122
1121
|
return {
|
|
1123
1122
|
subscribe: t,
|
|
1124
1123
|
set: e
|
|
1125
1124
|
};
|
|
1126
1125
|
}, Yn = (t, e, n, o) => {
|
|
1127
1126
|
const { hover: i, selection: s, store: r, viewport: a } = t, d = /* @__PURE__ */ new Map();
|
|
1128
|
-
let c = [],
|
|
1129
|
-
const l = (
|
|
1130
|
-
d.has(
|
|
1131
|
-
},
|
|
1132
|
-
const m = d.get(
|
|
1127
|
+
let c = [], h;
|
|
1128
|
+
const l = (w, E) => {
|
|
1129
|
+
d.has(w) ? d.get(w).push(E) : d.set(w, [E]);
|
|
1130
|
+
}, g = (w, E) => {
|
|
1131
|
+
const m = d.get(w);
|
|
1133
1132
|
if (m) {
|
|
1134
1133
|
const u = m.indexOf(E);
|
|
1135
1134
|
u !== -1 && m.splice(u, 1);
|
|
1136
1135
|
}
|
|
1137
|
-
},
|
|
1138
|
-
d.has(
|
|
1139
|
-
d.get(
|
|
1136
|
+
}, p = (w, E, m) => {
|
|
1137
|
+
d.has(w) && setTimeout(() => {
|
|
1138
|
+
d.get(w).forEach((u) => {
|
|
1140
1139
|
if (n) {
|
|
1141
|
-
const
|
|
1142
|
-
u(
|
|
1140
|
+
const b = Array.isArray(E) ? E.map((A) => n.serialize(A)) : n.serialize(E), S = m ? m instanceof PointerEvent ? m : n.serialize(m) : void 0;
|
|
1141
|
+
u(b, S);
|
|
1143
1142
|
} else
|
|
1144
1143
|
u(E, m);
|
|
1145
1144
|
});
|
|
1146
1145
|
}, 1);
|
|
1147
1146
|
};
|
|
1148
|
-
s.subscribe(({ selected:
|
|
1149
|
-
if (!(c.length === 0 &&
|
|
1150
|
-
if (c.length === 0 &&
|
|
1151
|
-
c =
|
|
1152
|
-
else if (c.length > 0 &&
|
|
1147
|
+
s.subscribe(({ selected: w }) => {
|
|
1148
|
+
if (!(c.length === 0 && w.length === 0)) {
|
|
1149
|
+
if (c.length === 0 && w.length > 0)
|
|
1150
|
+
c = w.map(({ id: E }) => r.getAnnotation(E));
|
|
1151
|
+
else if (c.length > 0 && w.length === 0)
|
|
1153
1152
|
c.forEach((E) => {
|
|
1154
1153
|
const m = r.getAnnotation(E.id);
|
|
1155
|
-
m && !
|
|
1154
|
+
m && !q(m, E) && p("updateAnnotation", m, E);
|
|
1156
1155
|
}), c = [];
|
|
1157
1156
|
else {
|
|
1158
|
-
const E = new Set(c.map((u) => u.id)), m = new Set(
|
|
1157
|
+
const E = new Set(c.map((u) => u.id)), m = new Set(w.map(({ id: u }) => u));
|
|
1159
1158
|
c.filter((u) => !m.has(u.id)).forEach((u) => {
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1159
|
+
const b = r.getAnnotation(u.id);
|
|
1160
|
+
b && !q(b, u) && p("updateAnnotation", b, u);
|
|
1162
1161
|
}), c = [
|
|
1163
1162
|
// Remove annotations that were deselected
|
|
1164
1163
|
...c.filter((u) => m.has(u.id)),
|
|
1165
1164
|
// Add editable annotations that were selected
|
|
1166
|
-
...
|
|
1165
|
+
...w.filter(({ id: u }) => !E.has(u)).map(({ id: u }) => r.getAnnotation(u))
|
|
1167
1166
|
];
|
|
1168
1167
|
}
|
|
1169
|
-
|
|
1168
|
+
p("selectionChanged", c);
|
|
1170
1169
|
}
|
|
1171
|
-
}), i.subscribe((
|
|
1172
|
-
!
|
|
1173
|
-
}), a == null || a.subscribe((
|
|
1174
|
-
const { created: E, deleted: m } =
|
|
1175
|
-
(E || []).forEach((u) =>
|
|
1170
|
+
}), i.subscribe((w) => {
|
|
1171
|
+
!h && w ? p("mouseEnterAnnotation", r.getAnnotation(w)) : h && !w ? p("mouseLeaveAnnotation", r.getAnnotation(h)) : h && w && (p("mouseLeaveAnnotation", r.getAnnotation(h)), p("mouseEnterAnnotation", r.getAnnotation(w))), h = w;
|
|
1172
|
+
}), a == null || a.subscribe((w) => p("viewportIntersect", w.map((E) => r.getAnnotation(E)))), r.observe((w) => {
|
|
1173
|
+
const { created: E, deleted: m } = w.changes;
|
|
1174
|
+
(E || []).forEach((u) => p("createAnnotation", u)), (m || []).forEach((u) => p("deleteAnnotation", u)), (w.changes.updated || []).filter((u) => [
|
|
1176
1175
|
...u.bodiesCreated || [],
|
|
1177
1176
|
...u.bodiesDeleted || [],
|
|
1178
1177
|
...u.bodiesUpdated || []
|
|
1179
|
-
].length > 0).forEach(({ oldValue: u, newValue:
|
|
1180
|
-
const
|
|
1181
|
-
c = c.map((A) => A.id === u.id ?
|
|
1178
|
+
].length > 0).forEach(({ oldValue: u, newValue: b }) => {
|
|
1179
|
+
const S = c.find((A) => A.id === u.id) || u;
|
|
1180
|
+
c = c.map((A) => A.id === u.id ? b : A), p("updateAnnotation", b, S);
|
|
1182
1181
|
});
|
|
1183
|
-
}, { origin: k.LOCAL }), r.observe((
|
|
1182
|
+
}, { origin: k.LOCAL }), r.observe((w) => {
|
|
1184
1183
|
if (c) {
|
|
1185
|
-
const E = new Set(c.map((u) => u.id)), m = (
|
|
1186
|
-
m.length > 0 && (c = c.map((u) => m.find((
|
|
1184
|
+
const E = new Set(c.map((u) => u.id)), m = (w.changes.updated || []).filter(({ newValue: u }) => E.has(u.id)).map(({ newValue: u }) => u);
|
|
1185
|
+
m.length > 0 && (c = c.map((u) => m.find((S) => S.id === u.id) || u));
|
|
1187
1186
|
}
|
|
1188
1187
|
}, { origin: k.REMOTE });
|
|
1189
|
-
const v = (
|
|
1188
|
+
const v = (w) => (E) => {
|
|
1190
1189
|
const { updated: m } = E;
|
|
1191
|
-
|
|
1190
|
+
w ? (m || []).forEach((u) => p("updateAnnotation", u.oldValue, u.newValue)) : (m || []).forEach((u) => p("updateAnnotation", u.newValue, u.oldValue));
|
|
1192
1191
|
};
|
|
1193
|
-
return e.on("undo", v(!0)), e.on("redo", v(!1)), { on: l, off:
|
|
1192
|
+
return e.on("undo", v(!0)), e.on("redo", v(!1)), { on: l, off: g, emit: p };
|
|
1194
1193
|
}, Xn = (t) => (e) => e.reduce((n, o) => {
|
|
1195
1194
|
const { parsed: i, error: s } = t.parse(o);
|
|
1196
1195
|
return s ? {
|
|
@@ -1202,21 +1201,21 @@ const Dn = 250, Vn = (t) => {
|
|
|
1202
1201
|
} : {
|
|
1203
1202
|
...n
|
|
1204
1203
|
};
|
|
1205
|
-
}, { parsed: [], failed: [] }),
|
|
1204
|
+
}, { parsed: [], failed: [] }), Pn = (t, e, n) => {
|
|
1206
1205
|
const { store: o, selection: i } = t, s = (m) => {
|
|
1207
1206
|
if (n) {
|
|
1208
|
-
const { parsed: u, error:
|
|
1209
|
-
u ? o.addAnnotation(u, k.REMOTE) : console.error(
|
|
1207
|
+
const { parsed: u, error: b } = n.parse(m);
|
|
1208
|
+
u ? o.addAnnotation(u, k.REMOTE) : console.error(b);
|
|
1210
1209
|
} else
|
|
1211
1210
|
o.addAnnotation(Mt(m), k.REMOTE);
|
|
1212
1211
|
}, r = () => i.clear(), a = () => o.clear(), d = (m) => {
|
|
1213
1212
|
const u = o.getAnnotation(m);
|
|
1214
1213
|
return n && u ? n.serialize(u) : u;
|
|
1215
|
-
}, c = () => n ? o.all().map(n.serialize) : o.all(),
|
|
1214
|
+
}, c = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
|
|
1216
1215
|
var m;
|
|
1217
|
-
const u = (((m = i.selected) == null ? void 0 : m.map((
|
|
1216
|
+
const u = (((m = i.selected) == null ? void 0 : m.map((b) => b.id)) || []).map((b) => o.getAnnotation(b)).filter(Boolean);
|
|
1218
1217
|
return n ? u.map(n.serialize) : u;
|
|
1219
|
-
}, l = (m, u = !0) => fetch(m).then((
|
|
1218
|
+
}, l = (m, u = !0) => fetch(m).then((b) => b.json()).then((b) => (p(b, u), b)), g = (m) => {
|
|
1220
1219
|
if (typeof m == "string") {
|
|
1221
1220
|
const u = o.getAnnotation(m);
|
|
1222
1221
|
if (o.deleteAnnotation(m), u)
|
|
@@ -1226,20 +1225,20 @@ const Dn = 250, Vn = (t) => {
|
|
|
1226
1225
|
if (u)
|
|
1227
1226
|
return o.deleteAnnotation(u), m;
|
|
1228
1227
|
}
|
|
1229
|
-
},
|
|
1228
|
+
}, p = (m, u = !0) => {
|
|
1230
1229
|
if (n) {
|
|
1231
|
-
const
|
|
1232
|
-
A.length > 0 && console.warn(`Discarded ${A.length} invalid annotations`, A), o.bulkAddAnnotation(
|
|
1230
|
+
const b = n.parseAll || Xn(n), { parsed: S, failed: A } = b(m);
|
|
1231
|
+
A.length > 0 && console.warn(`Discarded ${A.length} invalid annotations`, A), o.bulkAddAnnotation(S, u, k.REMOTE);
|
|
1233
1232
|
} else
|
|
1234
1233
|
o.bulkAddAnnotation(m.map(Mt), u, k.REMOTE);
|
|
1235
1234
|
}, v = (m, u) => {
|
|
1236
1235
|
m ? i.setSelected(m, u) : i.clear();
|
|
1237
|
-
},
|
|
1236
|
+
}, w = (m) => {
|
|
1238
1237
|
i.clear(), i.setUserSelectAction(m);
|
|
1239
1238
|
}, E = (m) => {
|
|
1240
1239
|
if (n) {
|
|
1241
|
-
const u = n.parse(m).parsed,
|
|
1242
|
-
return o.updateAnnotation(u),
|
|
1240
|
+
const u = n.parse(m).parsed, b = n.serialize(o.getAnnotation(u.id));
|
|
1241
|
+
return o.updateAnnotation(u), b;
|
|
1243
1242
|
} else {
|
|
1244
1243
|
const u = o.getAnnotation(m.id);
|
|
1245
1244
|
return o.updateAnnotation(Mt(m)), u;
|
|
@@ -1253,17 +1252,17 @@ const Dn = 250, Vn = (t) => {
|
|
|
1253
1252
|
clearAnnotations: a,
|
|
1254
1253
|
getAnnotationById: d,
|
|
1255
1254
|
getAnnotations: c,
|
|
1256
|
-
getSelected:
|
|
1255
|
+
getSelected: h,
|
|
1257
1256
|
loadAnnotations: l,
|
|
1258
1257
|
redo: e.redo,
|
|
1259
|
-
removeAnnotation:
|
|
1260
|
-
setAnnotations:
|
|
1258
|
+
removeAnnotation: g,
|
|
1259
|
+
setAnnotations: p,
|
|
1261
1260
|
setSelected: v,
|
|
1262
|
-
setUserSelectAction:
|
|
1261
|
+
setUserSelectAction: w,
|
|
1263
1262
|
undo: e.undo,
|
|
1264
1263
|
updateAnnotation: E
|
|
1265
1264
|
};
|
|
1266
|
-
},
|
|
1265
|
+
}, $n = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1267
1266
|
let jn = (t) => crypto.getRandomValues(new Uint8Array(t)), Hn = (t, e, n) => {
|
|
1268
1267
|
let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * e / t.length);
|
|
1269
1268
|
return (s = e) => {
|
|
@@ -1277,7 +1276,7 @@ let jn = (t) => crypto.getRandomValues(new Uint8Array(t)), Hn = (t, e, n) => {
|
|
|
1277
1276
|
}, zn = (t, e = 21) => Hn(t, e, jn), Fn = (t = 21) => {
|
|
1278
1277
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t));
|
|
1279
1278
|
for (; t--; )
|
|
1280
|
-
e +=
|
|
1279
|
+
e += $n[n[t] & 63];
|
|
1281
1280
|
return e;
|
|
1282
1281
|
};
|
|
1283
1282
|
const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), qn = (t) => {
|
|
@@ -1288,18 +1287,18 @@ const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1288
1287
|
n = (n << 5) - n + s, n |= 0;
|
|
1289
1288
|
}
|
|
1290
1289
|
return `${n}`;
|
|
1291
|
-
},
|
|
1292
|
-
const { id: o, type: i, purpose: s, value: r, created: a, modified: d, creator: c, ...
|
|
1290
|
+
}, ve = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Gn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1291
|
+
const { id: o, type: i, purpose: s, value: r, created: a, modified: d, creator: c, ...h } = n;
|
|
1293
1292
|
return {
|
|
1294
1293
|
id: o || `temp-${qn(n)}`,
|
|
1295
1294
|
annotation: e,
|
|
1296
1295
|
type: i,
|
|
1297
1296
|
purpose: s,
|
|
1298
1297
|
value: r,
|
|
1299
|
-
creator:
|
|
1298
|
+
creator: ve(c),
|
|
1300
1299
|
created: a ? new Date(a) : void 0,
|
|
1301
1300
|
updated: d ? new Date(d) : void 0,
|
|
1302
|
-
...
|
|
1301
|
+
...h
|
|
1303
1302
|
};
|
|
1304
1303
|
}), Qn = (t) => t.map((e) => {
|
|
1305
1304
|
var n;
|
|
@@ -1325,7 +1324,7 @@ const Io = (t, e) => ({
|
|
|
1325
1324
|
if (r.length === 0)
|
|
1326
1325
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
1327
1326
|
const a = {
|
|
1328
|
-
creator:
|
|
1327
|
+
creator: ve(n),
|
|
1329
1328
|
created: o ? new Date(o) : void 0,
|
|
1330
1329
|
updated: i ? new Date(i) : void 0,
|
|
1331
1330
|
annotation: e,
|
|
@@ -1333,30 +1332,30 @@ const Io = (t, e) => ({
|
|
|
1333
1332
|
styleClass: r[0].styleClass
|
|
1334
1333
|
};
|
|
1335
1334
|
for (const d of r) {
|
|
1336
|
-
const
|
|
1337
|
-
switch (
|
|
1335
|
+
const h = (Array.isArray(d.selector) ? d.selector : [d.selector]).reduce((l, g) => {
|
|
1336
|
+
switch (g.type) {
|
|
1338
1337
|
case "TextQuoteSelector":
|
|
1339
|
-
l.quote =
|
|
1338
|
+
l.quote = g.exact;
|
|
1340
1339
|
break;
|
|
1341
1340
|
case "TextPositionSelector":
|
|
1342
|
-
l.start =
|
|
1341
|
+
l.start = g.start, l.end = g.end;
|
|
1343
1342
|
break;
|
|
1344
1343
|
}
|
|
1345
1344
|
return l;
|
|
1346
1345
|
}, {});
|
|
1347
|
-
if (Jn(
|
|
1348
|
-
a.selector.push({ id: d.id, ...
|
|
1346
|
+
if (Jn(h))
|
|
1347
|
+
a.selector.push({ id: d.id, ...h });
|
|
1349
1348
|
else {
|
|
1350
1349
|
const l = [
|
|
1351
|
-
|
|
1352
|
-
|
|
1350
|
+
h.start ? void 0 : "TextPositionSelector",
|
|
1351
|
+
h.quote ? void 0 : "TextQuoteSelector"
|
|
1353
1352
|
].filter(Boolean);
|
|
1354
1353
|
return { error: Error(`Missing selector types: ${l.join(" and ")} for annotation: ${t.id}`) };
|
|
1355
1354
|
}
|
|
1356
1355
|
}
|
|
1357
1356
|
return { parsed: a };
|
|
1358
1357
|
}, to = (t) => {
|
|
1359
|
-
const e = t.id ||
|
|
1358
|
+
const e = t.id || ye(), {
|
|
1360
1359
|
creator: n,
|
|
1361
1360
|
created: o,
|
|
1362
1361
|
modified: i,
|
|
@@ -1377,23 +1376,23 @@ const Io = (t, e) => ({
|
|
|
1377
1376
|
creator: a,
|
|
1378
1377
|
created: d,
|
|
1379
1378
|
updated: c,
|
|
1380
|
-
...
|
|
1381
|
-
} = i, l = r.map((
|
|
1382
|
-
const { quote:
|
|
1379
|
+
...h
|
|
1380
|
+
} = i, l = r.map((g) => {
|
|
1381
|
+
const { quote: p, start: v, end: w, range: E } = g, { prefix: m, suffix: u } = Ue(E, n), b = [{
|
|
1383
1382
|
type: "TextQuoteSelector",
|
|
1384
|
-
exact:
|
|
1383
|
+
exact: p,
|
|
1385
1384
|
prefix: m,
|
|
1386
1385
|
suffix: u
|
|
1387
1386
|
}, {
|
|
1388
1387
|
type: "TextPositionSelector",
|
|
1389
1388
|
start: v,
|
|
1390
|
-
end:
|
|
1389
|
+
end: w
|
|
1391
1390
|
}];
|
|
1392
1391
|
return {
|
|
1393
|
-
...
|
|
1394
|
-
id:
|
|
1392
|
+
...h,
|
|
1393
|
+
id: g.id,
|
|
1395
1394
|
source: e,
|
|
1396
|
-
selector:
|
|
1395
|
+
selector: b
|
|
1397
1396
|
};
|
|
1398
1397
|
});
|
|
1399
1398
|
return {
|
|
@@ -1408,22 +1407,22 @@ const Io = (t, e) => ({
|
|
|
1408
1407
|
target: l
|
|
1409
1408
|
};
|
|
1410
1409
|
};
|
|
1411
|
-
function
|
|
1410
|
+
function Ae(t, e, n = 0, o = t.length - 1, i = no) {
|
|
1412
1411
|
for (; o > n; ) {
|
|
1413
1412
|
if (o - n > 600) {
|
|
1414
|
-
const d = o - n + 1, c = e - n + 1,
|
|
1415
|
-
|
|
1413
|
+
const d = o - n + 1, c = e - n + 1, h = Math.log(d), l = 0.5 * Math.exp(2 * h / 3), g = 0.5 * Math.sqrt(h * l * (d - l) / d) * (c - d / 2 < 0 ? -1 : 1), p = Math.max(n, Math.floor(e - c * l / d + g)), v = Math.min(o, Math.floor(e + (d - c) * l / d + g));
|
|
1414
|
+
Ae(t, e, p, v, i);
|
|
1416
1415
|
}
|
|
1417
1416
|
const s = t[e];
|
|
1418
1417
|
let r = n, a = o;
|
|
1419
|
-
for (
|
|
1420
|
-
for (
|
|
1418
|
+
for (tt(t, n, e), i(t[o], s) > 0 && tt(t, n, o); r < a; ) {
|
|
1419
|
+
for (tt(t, r, a), r++, a--; i(t[r], s) < 0; ) r++;
|
|
1421
1420
|
for (; i(t[a], s) > 0; ) a--;
|
|
1422
1421
|
}
|
|
1423
|
-
i(t[n], s) === 0 ?
|
|
1422
|
+
i(t[n], s) === 0 ? tt(t, n, a) : (a++, tt(t, a, o)), a <= e && (n = a + 1), e <= a && (o = a - 1);
|
|
1424
1423
|
}
|
|
1425
1424
|
}
|
|
1426
|
-
function
|
|
1425
|
+
function tt(t, e, n) {
|
|
1427
1426
|
const o = t[e];
|
|
1428
1427
|
t[e] = t[n], t[n] = o;
|
|
1429
1428
|
}
|
|
@@ -1492,7 +1491,7 @@ class oo {
|
|
|
1492
1491
|
return e && this._insert(e, this.data.height - 1), this;
|
|
1493
1492
|
}
|
|
1494
1493
|
clear() {
|
|
1495
|
-
return this.data =
|
|
1494
|
+
return this.data = J([]), this;
|
|
1496
1495
|
}
|
|
1497
1496
|
remove(e, n) {
|
|
1498
1497
|
if (!e) return this;
|
|
@@ -1501,9 +1500,9 @@ class oo {
|
|
|
1501
1500
|
let a, d, c;
|
|
1502
1501
|
for (; o || s.length; ) {
|
|
1503
1502
|
if (o || (o = s.pop(), d = s[s.length - 1], a = r.pop(), c = !0), o.leaf) {
|
|
1504
|
-
const
|
|
1505
|
-
if (
|
|
1506
|
-
return o.children.splice(
|
|
1503
|
+
const h = io(e, o.children, n);
|
|
1504
|
+
if (h !== -1)
|
|
1505
|
+
return o.children.splice(h, 1), s.push(o), this._condense(s), this;
|
|
1507
1506
|
}
|
|
1508
1507
|
!c && !o.leaf && It(o, i) ? (s.push(o), r.push(a), a = 0, d = o, o = o.children[0]) : d ? (a++, o = d.children[a], c = !1) : o = null;
|
|
1509
1508
|
}
|
|
@@ -1534,26 +1533,26 @@ class oo {
|
|
|
1534
1533
|
const s = o - n + 1;
|
|
1535
1534
|
let r = this._maxEntries, a;
|
|
1536
1535
|
if (s <= r)
|
|
1537
|
-
return a =
|
|
1538
|
-
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a =
|
|
1536
|
+
return a = J(e.slice(n, o + 1)), Q(a, this.toBBox), a;
|
|
1537
|
+
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = J([]), a.leaf = !1, a.height = i;
|
|
1539
1538
|
const d = Math.ceil(s / r), c = d * Math.ceil(Math.sqrt(r));
|
|
1540
|
-
|
|
1541
|
-
for (let
|
|
1542
|
-
const l = Math.min(
|
|
1543
|
-
|
|
1544
|
-
for (let
|
|
1545
|
-
const
|
|
1546
|
-
a.children.push(this._build(e,
|
|
1539
|
+
ie(e, n, o, c, this.compareMinX);
|
|
1540
|
+
for (let h = n; h <= o; h += c) {
|
|
1541
|
+
const l = Math.min(h + c - 1, o);
|
|
1542
|
+
ie(e, h, l, d, this.compareMinY);
|
|
1543
|
+
for (let g = h; g <= l; g += d) {
|
|
1544
|
+
const p = Math.min(g + d - 1, l);
|
|
1545
|
+
a.children.push(this._build(e, g, p, i - 1));
|
|
1547
1546
|
}
|
|
1548
1547
|
}
|
|
1549
|
-
return
|
|
1548
|
+
return Q(a, this.toBBox), a;
|
|
1550
1549
|
}
|
|
1551
1550
|
_chooseSubtree(e, n, o, i) {
|
|
1552
1551
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1553
1552
|
let s = 1 / 0, r = 1 / 0, a;
|
|
1554
1553
|
for (let d = 0; d < n.children.length; d++) {
|
|
1555
|
-
const c = n.children[d],
|
|
1556
|
-
l < r ? (r = l, s =
|
|
1554
|
+
const c = n.children[d], h = kt(c), l = ao(e, c) - h;
|
|
1555
|
+
l < r ? (r = l, s = h < s ? h : s, a = c) : l === r && h < s && (s = h, a = c);
|
|
1557
1556
|
}
|
|
1558
1557
|
n = a || n.children[0];
|
|
1559
1558
|
}
|
|
@@ -1569,17 +1568,17 @@ class oo {
|
|
|
1569
1568
|
_split(e, n) {
|
|
1570
1569
|
const o = e[n], i = o.children.length, s = this._minEntries;
|
|
1571
1570
|
this._chooseSplitAxis(o, s, i);
|
|
1572
|
-
const r = this._chooseSplitIndex(o, s, i), a =
|
|
1573
|
-
a.height = o.height, a.leaf = o.leaf,
|
|
1571
|
+
const r = this._chooseSplitIndex(o, s, i), a = J(o.children.splice(r, o.children.length - r));
|
|
1572
|
+
a.height = o.height, a.leaf = o.leaf, Q(o, this.toBBox), Q(a, this.toBBox), n ? e[n - 1].children.push(a) : this._splitRoot(o, a);
|
|
1574
1573
|
}
|
|
1575
1574
|
_splitRoot(e, n) {
|
|
1576
|
-
this.data =
|
|
1575
|
+
this.data = J([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, Q(this.data, this.toBBox);
|
|
1577
1576
|
}
|
|
1578
1577
|
_chooseSplitIndex(e, n, o) {
|
|
1579
1578
|
let i, s = 1 / 0, r = 1 / 0;
|
|
1580
1579
|
for (let a = n; a <= o - n; a++) {
|
|
1581
|
-
const d = ot(e, 0, a, this.toBBox), c = ot(e, a, o, this.toBBox),
|
|
1582
|
-
|
|
1580
|
+
const d = ot(e, 0, a, this.toBBox), c = ot(e, a, o, this.toBBox), h = co(d, c), l = kt(d) + kt(c);
|
|
1581
|
+
h < s ? (s = h, i = a, r = l < r ? l : r) : h === s && l < r && (r = l, i = a);
|
|
1583
1582
|
}
|
|
1584
1583
|
return i || o - n;
|
|
1585
1584
|
}
|
|
@@ -1594,12 +1593,12 @@ class oo {
|
|
|
1594
1593
|
const s = this.toBBox, r = ot(e, 0, n, s), a = ot(e, o - n, o, s);
|
|
1595
1594
|
let d = mt(r) + mt(a);
|
|
1596
1595
|
for (let c = n; c < o - n; c++) {
|
|
1597
|
-
const
|
|
1598
|
-
it(r, e.leaf ? s(
|
|
1596
|
+
const h = e.children[c];
|
|
1597
|
+
it(r, e.leaf ? s(h) : h), d += mt(r);
|
|
1599
1598
|
}
|
|
1600
1599
|
for (let c = o - n - 1; c >= n; c--) {
|
|
1601
|
-
const
|
|
1602
|
-
it(a, e.leaf ? s(
|
|
1600
|
+
const h = e.children[c];
|
|
1601
|
+
it(a, e.leaf ? s(h) : h), d += mt(a);
|
|
1603
1602
|
}
|
|
1604
1603
|
return d;
|
|
1605
1604
|
}
|
|
@@ -1609,7 +1608,7 @@ class oo {
|
|
|
1609
1608
|
}
|
|
1610
1609
|
_condense(e) {
|
|
1611
1610
|
for (let n = e.length - 1, o; n >= 0; n--)
|
|
1612
|
-
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() :
|
|
1611
|
+
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : Q(e[n], this.toBBox);
|
|
1613
1612
|
}
|
|
1614
1613
|
}
|
|
1615
1614
|
function io(t, e, n) {
|
|
@@ -1618,11 +1617,11 @@ function io(t, e, n) {
|
|
|
1618
1617
|
if (n(t, e[o])) return o;
|
|
1619
1618
|
return -1;
|
|
1620
1619
|
}
|
|
1621
|
-
function
|
|
1620
|
+
function Q(t, e) {
|
|
1622
1621
|
ot(t, 0, t.children.length, e, t);
|
|
1623
1622
|
}
|
|
1624
1623
|
function ot(t, e, n, o, i) {
|
|
1625
|
-
i || (i =
|
|
1624
|
+
i || (i = J(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
1626
1625
|
for (let s = e; s < n; s++) {
|
|
1627
1626
|
const r = t.children[s];
|
|
1628
1627
|
it(i, t.leaf ? o(r) : r);
|
|
@@ -1657,7 +1656,7 @@ function It(t, e) {
|
|
|
1657
1656
|
function yt(t, e) {
|
|
1658
1657
|
return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
|
|
1659
1658
|
}
|
|
1660
|
-
function
|
|
1659
|
+
function J(t) {
|
|
1661
1660
|
return {
|
|
1662
1661
|
children: t,
|
|
1663
1662
|
height: 1,
|
|
@@ -1668,12 +1667,12 @@ function Z(t) {
|
|
|
1668
1667
|
maxY: -1 / 0
|
|
1669
1668
|
};
|
|
1670
1669
|
}
|
|
1671
|
-
function
|
|
1670
|
+
function ie(t, e, n, o, i) {
|
|
1672
1671
|
const s = [e, n];
|
|
1673
1672
|
for (; s.length; ) {
|
|
1674
1673
|
if (n = s.pop(), e = s.pop(), n - e <= o) continue;
|
|
1675
1674
|
const r = e + Math.ceil((n - e) / o / 2) * o;
|
|
1676
|
-
|
|
1675
|
+
Ae(t, r, e, n, i), s.push(e, r, r, n);
|
|
1677
1676
|
}
|
|
1678
1677
|
}
|
|
1679
1678
|
let lo = () => ({
|
|
@@ -1691,121 +1690,121 @@ let lo = () => ({
|
|
|
1691
1690
|
}
|
|
1692
1691
|
});
|
|
1693
1692
|
const uo = (t, e) => {
|
|
1694
|
-
const n = new oo(), o = /* @__PURE__ */ new Map(), i = lo(), s = (
|
|
1695
|
-
const A =
|
|
1696
|
-
const
|
|
1697
|
-
return Array.from(
|
|
1698
|
-
}), L = Xe(A).map((
|
|
1699
|
-
return L.map((
|
|
1700
|
-
const { x:
|
|
1693
|
+
const n = new oo(), o = /* @__PURE__ */ new Map(), i = lo(), s = (b, S) => {
|
|
1694
|
+
const A = b.selector.flatMap((T) => {
|
|
1695
|
+
const O = F([T]) ? T.range : de(T, e).range;
|
|
1696
|
+
return Array.from(O.getClientRects());
|
|
1697
|
+
}), L = Xe(A).map((T) => He(T, S));
|
|
1698
|
+
return L.map((T) => {
|
|
1699
|
+
const { x: O, y: M, width: f, height: y } = T;
|
|
1701
1700
|
return {
|
|
1702
|
-
minX:
|
|
1703
|
-
minY:
|
|
1704
|
-
maxX:
|
|
1705
|
-
maxY:
|
|
1701
|
+
minX: O,
|
|
1702
|
+
minY: M,
|
|
1703
|
+
maxX: O + f,
|
|
1704
|
+
maxY: M + y,
|
|
1706
1705
|
annotation: {
|
|
1707
|
-
id:
|
|
1706
|
+
id: b.annotation,
|
|
1708
1707
|
rects: L
|
|
1709
1708
|
}
|
|
1710
1709
|
};
|
|
1711
1710
|
});
|
|
1712
1711
|
}, r = () => [...o.values()], a = () => {
|
|
1713
1712
|
n.clear(), o.clear();
|
|
1714
|
-
}, d = (
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
}, c = (
|
|
1718
|
-
const
|
|
1719
|
-
|
|
1720
|
-
},
|
|
1721
|
-
c(
|
|
1722
|
-
}, l = (
|
|
1723
|
-
|
|
1724
|
-
const A = e.getBoundingClientRect(), L =
|
|
1725
|
-
L.forEach(({ target:
|
|
1726
|
-
const
|
|
1727
|
-
n.load(
|
|
1728
|
-
},
|
|
1713
|
+
}, d = (b) => {
|
|
1714
|
+
const S = s(b, e.getBoundingClientRect());
|
|
1715
|
+
S.forEach((A) => n.insert(A)), o.set(b.annotation, S);
|
|
1716
|
+
}, c = (b) => {
|
|
1717
|
+
const S = o.get(b.annotation);
|
|
1718
|
+
S && (S.forEach((A) => n.remove(A)), o.delete(b.annotation));
|
|
1719
|
+
}, h = (b) => {
|
|
1720
|
+
c(b), d(b);
|
|
1721
|
+
}, l = (b, S = !0) => {
|
|
1722
|
+
S && a();
|
|
1723
|
+
const A = e.getBoundingClientRect(), L = b.map((O) => ({ target: O, rects: s(O, A) }));
|
|
1724
|
+
L.forEach(({ target: O, rects: M }) => o.set(O.annotation, M));
|
|
1725
|
+
const T = L.flatMap(({ rects: O }) => O);
|
|
1726
|
+
n.load(T);
|
|
1727
|
+
}, g = (b, S, A = !1) => {
|
|
1729
1728
|
const L = n.search({
|
|
1730
|
-
minX:
|
|
1731
|
-
minY:
|
|
1732
|
-
maxX:
|
|
1733
|
-
maxY:
|
|
1734
|
-
}),
|
|
1735
|
-
return L.length > 0 ? (L.sort((
|
|
1736
|
-
},
|
|
1737
|
-
const
|
|
1738
|
-
if (
|
|
1729
|
+
minX: b,
|
|
1730
|
+
minY: S,
|
|
1731
|
+
maxX: b,
|
|
1732
|
+
maxY: S
|
|
1733
|
+
}), T = (O) => O.annotation.rects.reduce((M, f) => M + f.width * f.height, 0);
|
|
1734
|
+
return L.length > 0 ? (L.sort((O, M) => T(O) - T(M)), A ? L.map((O) => O.annotation.id) : [L[0].annotation.id]) : [];
|
|
1735
|
+
}, p = (b) => {
|
|
1736
|
+
const S = v(b);
|
|
1737
|
+
if (S.length === 0)
|
|
1739
1738
|
return;
|
|
1740
|
-
let A =
|
|
1741
|
-
for (let
|
|
1742
|
-
const
|
|
1743
|
-
A = Math.min(A,
|
|
1739
|
+
let A = S[0].left, L = S[0].top, T = S[0].right, O = S[0].bottom;
|
|
1740
|
+
for (let M = 1; M < S.length; M++) {
|
|
1741
|
+
const f = S[M];
|
|
1742
|
+
A = Math.min(A, f.left), L = Math.min(L, f.top), T = Math.max(T, f.right), O = Math.max(O, f.bottom);
|
|
1744
1743
|
}
|
|
1745
|
-
return new DOMRect(A, L,
|
|
1746
|
-
}, v = (
|
|
1747
|
-
const
|
|
1748
|
-
return
|
|
1744
|
+
return new DOMRect(A, L, T - A, O - L);
|
|
1745
|
+
}, v = (b) => {
|
|
1746
|
+
const S = o.get(b);
|
|
1747
|
+
return S[0] ? S[0].annotation.rects : [];
|
|
1749
1748
|
};
|
|
1750
1749
|
return {
|
|
1751
1750
|
all: r,
|
|
1752
1751
|
clear: a,
|
|
1753
|
-
getAt:
|
|
1754
|
-
getAnnotationBounds:
|
|
1752
|
+
getAt: g,
|
|
1753
|
+
getAnnotationBounds: p,
|
|
1755
1754
|
getAnnotationRects: v,
|
|
1756
|
-
getIntersecting: (
|
|
1757
|
-
const
|
|
1758
|
-
return Array.from(
|
|
1759
|
-
annotation: t.getAnnotation(
|
|
1760
|
-
rects: v(
|
|
1761
|
-
})).filter((
|
|
1755
|
+
getIntersecting: (b, S, A, L) => {
|
|
1756
|
+
const T = n.search({ minX: b, minY: S, maxX: A, maxY: L }), O = new Set(T.map((M) => M.annotation.id));
|
|
1757
|
+
return Array.from(O).map((M) => ({
|
|
1758
|
+
annotation: t.getAnnotation(M),
|
|
1759
|
+
rects: v(M)
|
|
1760
|
+
})).filter((M) => !!M.annotation);
|
|
1762
1761
|
},
|
|
1763
1762
|
insert: d,
|
|
1764
1763
|
recalculate: () => {
|
|
1765
|
-
l(t.all().map((
|
|
1764
|
+
l(t.all().map((b) => b.target), !0), i.emit("recalculate");
|
|
1766
1765
|
},
|
|
1767
1766
|
remove: c,
|
|
1768
1767
|
set: l,
|
|
1769
1768
|
size: () => n.all().length,
|
|
1770
|
-
update:
|
|
1771
|
-
on: (
|
|
1769
|
+
update: h,
|
|
1770
|
+
on: (b, S) => i.on(b, S)
|
|
1772
1771
|
};
|
|
1773
1772
|
}, fo = (t, e) => {
|
|
1774
|
-
const n =
|
|
1773
|
+
const n = _n(), o = uo(n, t), i = En(n);
|
|
1775
1774
|
i.setUserSelectAction(e);
|
|
1776
|
-
const s = An(n), r = Kn(), a = (u,
|
|
1777
|
-
const
|
|
1778
|
-
return A && n.addAnnotation(
|
|
1779
|
-
}, d = (u,
|
|
1780
|
-
const A = u.map((
|
|
1781
|
-
return L.length > 0 ? (console.warn("Could not revive all targets for these annotations:", L), n.bulkAddAnnotation(A,
|
|
1782
|
-
}, c = (u,
|
|
1783
|
-
const
|
|
1784
|
-
return A.length > 0 && console.warn("Could not revive all targets for these annotations:", A),
|
|
1785
|
-
n.getAnnotation(L.id) ? n.updateAnnotation(L,
|
|
1775
|
+
const s = An(n), r = Kn(), a = (u, b = k.LOCAL) => {
|
|
1776
|
+
const S = xt(u, t), A = F(S.target.selector);
|
|
1777
|
+
return A && n.addAnnotation(S, b), A;
|
|
1778
|
+
}, d = (u, b = !0, S = k.LOCAL) => {
|
|
1779
|
+
const A = u.map((T) => xt(T, t)), L = A.filter((T) => !F(T.target.selector));
|
|
1780
|
+
return L.length > 0 ? (console.warn("Could not revive all targets for these annotations:", L), n.bulkAddAnnotation(A, b, S), L) : (n.bulkAddAnnotation(A, b, S), []);
|
|
1781
|
+
}, c = (u, b = k.LOCAL) => {
|
|
1782
|
+
const S = u.map((L) => xt(L, t)), A = S.filter((L) => !F(L.target.selector));
|
|
1783
|
+
return A.length > 0 && console.warn("Could not revive all targets for these annotations:", A), S.forEach((L) => {
|
|
1784
|
+
n.getAnnotation(L.id) ? n.updateAnnotation(L, b) : n.addAnnotation(L, b);
|
|
1786
1785
|
}), A;
|
|
1787
|
-
},
|
|
1788
|
-
const
|
|
1789
|
-
n.updateTarget(
|
|
1790
|
-
}, l = (u,
|
|
1791
|
-
const
|
|
1792
|
-
n.bulkUpdateTargets(
|
|
1793
|
-
},
|
|
1794
|
-
const A = o.getAt(u,
|
|
1786
|
+
}, h = (u, b = k.LOCAL) => {
|
|
1787
|
+
const S = wt(u, t);
|
|
1788
|
+
n.updateTarget(S, b);
|
|
1789
|
+
}, l = (u, b = k.LOCAL) => {
|
|
1790
|
+
const S = u.map((A) => wt(A, t));
|
|
1791
|
+
n.bulkUpdateTargets(S, b);
|
|
1792
|
+
}, g = (u, b, S) => {
|
|
1793
|
+
const A = o.getAt(u, b, !!S).map((T) => n.getAnnotation(T)), L = S ? A.filter(S) : A;
|
|
1795
1794
|
return L.length > 0 ? L[0] : void 0;
|
|
1796
|
-
},
|
|
1795
|
+
}, p = (u, b, S, A = 5) => {
|
|
1797
1796
|
const L = o.getAnnotationRects(u);
|
|
1798
1797
|
if (L.length !== 0) {
|
|
1799
|
-
if (
|
|
1800
|
-
const
|
|
1801
|
-
if (
|
|
1798
|
+
if (b && S) {
|
|
1799
|
+
const T = L.find(({ top: O, right: M, bottom: f, left: y }) => b >= y - A && b <= M + A && S >= O - A && S <= f + A);
|
|
1800
|
+
if (T) return T;
|
|
1802
1801
|
}
|
|
1803
1802
|
return o.getAnnotationBounds(u);
|
|
1804
1803
|
}
|
|
1805
|
-
}, v = (u,
|
|
1804
|
+
}, v = (u, b, S, A) => o.getIntersecting(u, b, S, A), w = (u) => o.getAnnotationRects(u), E = () => o.recalculate(), m = (u) => o.on("recalculate", u);
|
|
1806
1805
|
return n.observe(({ changes: u }) => {
|
|
1807
|
-
const
|
|
1808
|
-
(
|
|
1806
|
+
const b = (u.deleted || []).filter((L) => F(L.target.selector)), S = (u.created || []).filter((L) => F(L.target.selector)), A = (u.updated || []).filter((L) => F(L.newValue.target.selector));
|
|
1807
|
+
(b == null ? void 0 : b.length) > 0 && b.forEach((L) => o.remove(L.target)), S.length > 0 && o.set(S.map((L) => L.target), !1), (A == null ? void 0 : A.length) > 0 && A.forEach(({ newValue: L }) => o.update(L.target));
|
|
1809
1808
|
}), {
|
|
1810
1809
|
store: {
|
|
1811
1810
|
...n,
|
|
@@ -1813,13 +1812,13 @@ const uo = (t, e) => {
|
|
|
1813
1812
|
bulkAddAnnotation: d,
|
|
1814
1813
|
bulkUpdateTargets: l,
|
|
1815
1814
|
bulkUpsertAnnotations: c,
|
|
1816
|
-
getAnnotationBounds:
|
|
1817
|
-
getAnnotationRects:
|
|
1815
|
+
getAnnotationBounds: p,
|
|
1816
|
+
getAnnotationRects: w,
|
|
1818
1817
|
getIntersecting: v,
|
|
1819
|
-
getAt:
|
|
1818
|
+
getAt: g,
|
|
1820
1819
|
recalculatePositions: E,
|
|
1821
1820
|
onRecalculatePositions: m,
|
|
1822
|
-
updateTarget:
|
|
1821
|
+
updateTarget: h
|
|
1823
1822
|
},
|
|
1824
1823
|
selection: i,
|
|
1825
1824
|
hover: s,
|
|
@@ -1830,52 +1829,52 @@ const uo = (t, e) => {
|
|
|
1830
1829
|
t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = "r6o-presence-layer";
|
|
1831
1830
|
const e = t.getContext("2d");
|
|
1832
1831
|
return e.scale(2, 2), e.translate(0.5, 0.5), t;
|
|
1833
|
-
},
|
|
1832
|
+
}, po = (t, e = {}) => {
|
|
1834
1833
|
const n = ho(), o = n.getContext("2d");
|
|
1835
1834
|
document.body.appendChild(n);
|
|
1836
|
-
const i = /* @__PURE__ */ new Map(), s = (
|
|
1837
|
-
return t.on("selectionChange", (
|
|
1838
|
-
s(
|
|
1835
|
+
const i = /* @__PURE__ */ new Map(), s = (h) => Array.from(i.entries()).filter(([l, g]) => g.presenceKey === h.presenceKey).map(([l, g]) => l);
|
|
1836
|
+
return t.on("selectionChange", (h, l) => {
|
|
1837
|
+
s(h).forEach((p) => i.delete(p)), l && l.forEach((p) => i.set(p, h));
|
|
1839
1838
|
}), {
|
|
1840
1839
|
clear: () => {
|
|
1841
|
-
const { width:
|
|
1842
|
-
o.clearRect(-0.5, -0.5,
|
|
1840
|
+
const { width: h, height: l } = n;
|
|
1841
|
+
o.clearRect(-0.5, -0.5, h + 1, l + 1);
|
|
1843
1842
|
},
|
|
1844
1843
|
destroy: () => {
|
|
1845
1844
|
n.remove();
|
|
1846
1845
|
},
|
|
1847
|
-
paint: (
|
|
1846
|
+
paint: (h, l, g) => {
|
|
1848
1847
|
e.font && (o.font = e.font);
|
|
1849
|
-
const
|
|
1850
|
-
if (
|
|
1851
|
-
const { height: v } =
|
|
1852
|
-
o.fillStyle =
|
|
1853
|
-
const m = o.measureText(
|
|
1854
|
-
return o.fillRect(
|
|
1855
|
-
fill:
|
|
1856
|
-
fillOpacity:
|
|
1848
|
+
const p = i.get(h.annotation.id);
|
|
1849
|
+
if (p) {
|
|
1850
|
+
const { height: v } = h.rects[0], w = h.rects[0].x + l.left, E = h.rects[0].y + l.top;
|
|
1851
|
+
o.fillStyle = p.appearance.color, o.fillRect(w - 2, E - 2.5, 2, v + 5);
|
|
1852
|
+
const m = o.measureText(p.appearance.label), u = m.width + 6, b = m.actualBoundingBoxAscent + m.actualBoundingBoxDescent + 8, S = m.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1853
|
+
return o.fillRect(w - 2, E - 2.5 - b, u, b), o.fillStyle = "#fff", o.fillText(p.appearance.label, w + 1, E - S), {
|
|
1854
|
+
fill: p.appearance.color,
|
|
1855
|
+
fillOpacity: g ? 0.45 : 0.18
|
|
1857
1856
|
};
|
|
1858
1857
|
}
|
|
1859
1858
|
},
|
|
1860
1859
|
reset: () => {
|
|
1861
1860
|
n.width = 2 * window.innerWidth, n.height = 2 * window.innerHeight;
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1861
|
+
const h = n.getContext("2d");
|
|
1862
|
+
h.scale(2, 2), h.translate(0.5, 0.5);
|
|
1864
1863
|
}
|
|
1865
1864
|
};
|
|
1866
|
-
},
|
|
1867
|
-
function
|
|
1865
|
+
}, Nt = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1;
|
|
1866
|
+
function _t(t, e, n, o) {
|
|
1868
1867
|
t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent("on".concat(e), n);
|
|
1869
1868
|
}
|
|
1870
|
-
function
|
|
1869
|
+
function et(t, e, n, o) {
|
|
1871
1870
|
t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent("on".concat(e), n);
|
|
1872
1871
|
}
|
|
1873
|
-
function
|
|
1872
|
+
function xe(t, e) {
|
|
1874
1873
|
const n = e.slice(0, e.length - 1);
|
|
1875
1874
|
for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];
|
|
1876
1875
|
return n;
|
|
1877
1876
|
}
|
|
1878
|
-
function
|
|
1877
|
+
function Ee(t) {
|
|
1879
1878
|
typeof t != "string" && (t = ""), t = t.replace(/\s/g, "");
|
|
1880
1879
|
const e = t.split(",");
|
|
1881
1880
|
let n = e.lastIndexOf("");
|
|
@@ -1883,7 +1882,7 @@ function Se(t) {
|
|
|
1883
1882
|
e[n - 1] += ",", e.splice(n, 1), n = e.lastIndexOf("");
|
|
1884
1883
|
return e;
|
|
1885
1884
|
}
|
|
1886
|
-
function
|
|
1885
|
+
function go(t, e) {
|
|
1887
1886
|
const n = t.length >= e.length ? t : e, o = t.length >= e.length ? e : t;
|
|
1888
1887
|
let i = !0;
|
|
1889
1888
|
for (let s = 0; s < n.length; s++)
|
|
@@ -1935,14 +1934,14 @@ const at = {
|
|
|
1935
1934
|
".": 190,
|
|
1936
1935
|
"/": 191,
|
|
1937
1936
|
"`": 192,
|
|
1938
|
-
"-":
|
|
1939
|
-
"=":
|
|
1940
|
-
";":
|
|
1937
|
+
"-": Nt ? 173 : 189,
|
|
1938
|
+
"=": Nt ? 61 : 187,
|
|
1939
|
+
";": Nt ? 59 : 186,
|
|
1941
1940
|
"'": 222,
|
|
1942
1941
|
"[": 219,
|
|
1943
1942
|
"]": 221,
|
|
1944
1943
|
"\\": 220
|
|
1945
|
-
},
|
|
1944
|
+
}, j = {
|
|
1946
1945
|
// shiftKey
|
|
1947
1946
|
"⇧": 16,
|
|
1948
1947
|
shift: 16,
|
|
@@ -1967,21 +1966,21 @@ const at = {
|
|
|
1967
1966
|
ctrlKey: 17,
|
|
1968
1967
|
altKey: 18,
|
|
1969
1968
|
metaKey: 91
|
|
1970
|
-
},
|
|
1969
|
+
}, V = {
|
|
1971
1970
|
16: !1,
|
|
1972
1971
|
18: !1,
|
|
1973
1972
|
17: !1,
|
|
1974
1973
|
91: !1
|
|
1975
|
-
},
|
|
1974
|
+
}, N = {};
|
|
1976
1975
|
for (let t = 1; t < 20; t++)
|
|
1977
1976
|
at["f".concat(t)] = 111 + t;
|
|
1978
|
-
let I = [], rt = null,
|
|
1979
|
-
const
|
|
1980
|
-
function
|
|
1981
|
-
|
|
1977
|
+
let I = [], rt = null, Se = "all";
|
|
1978
|
+
const z = /* @__PURE__ */ new Map(), lt = (t) => at[t.toLowerCase()] || j[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), mo = (t) => Object.keys(at).find((e) => at[e] === t), yo = (t) => Object.keys(j).find((e) => j[e] === t);
|
|
1979
|
+
function Ce(t) {
|
|
1980
|
+
Se = t || "all";
|
|
1982
1981
|
}
|
|
1983
1982
|
function ct() {
|
|
1984
|
-
return
|
|
1983
|
+
return Se || "all";
|
|
1985
1984
|
}
|
|
1986
1985
|
function bo() {
|
|
1987
1986
|
return I.slice(0);
|
|
@@ -1991,8 +1990,8 @@ function wo() {
|
|
|
1991
1990
|
}
|
|
1992
1991
|
function vo() {
|
|
1993
1992
|
const t = [];
|
|
1994
|
-
return Object.keys(
|
|
1995
|
-
|
|
1993
|
+
return Object.keys(N).forEach((e) => {
|
|
1994
|
+
N[e].forEach((n) => {
|
|
1996
1995
|
let {
|
|
1997
1996
|
key: o,
|
|
1998
1997
|
scope: i,
|
|
@@ -2022,29 +2021,29 @@ function xo(t) {
|
|
|
2022
2021
|
function Eo(t, e) {
|
|
2023
2022
|
let n, o;
|
|
2024
2023
|
t || (t = ct());
|
|
2025
|
-
for (const i in
|
|
2026
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
2027
|
-
for (n =
|
|
2024
|
+
for (const i in N)
|
|
2025
|
+
if (Object.prototype.hasOwnProperty.call(N, i))
|
|
2026
|
+
for (n = N[i], o = 0; o < n.length; )
|
|
2028
2027
|
n[o].scope === t ? n.splice(o, 1).forEach((r) => {
|
|
2029
2028
|
let {
|
|
2030
2029
|
element: a
|
|
2031
2030
|
} = r;
|
|
2032
2031
|
return jt(a);
|
|
2033
2032
|
}) : o++;
|
|
2034
|
-
ct() === t &&
|
|
2033
|
+
ct() === t && Ce(e || "all");
|
|
2035
2034
|
}
|
|
2036
2035
|
function So(t) {
|
|
2037
2036
|
let e = t.keyCode || t.which || t.charCode;
|
|
2038
2037
|
const n = I.indexOf(e);
|
|
2039
|
-
if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in
|
|
2040
|
-
|
|
2041
|
-
for (const o in
|
|
2038
|
+
if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in V) {
|
|
2039
|
+
V[e] = !1;
|
|
2040
|
+
for (const o in j) j[o] === e && (P[o] = !1);
|
|
2042
2041
|
}
|
|
2043
2042
|
}
|
|
2044
|
-
function
|
|
2043
|
+
function Le(t) {
|
|
2045
2044
|
if (typeof t > "u")
|
|
2046
|
-
Object.keys(
|
|
2047
|
-
Array.isArray(
|
|
2045
|
+
Object.keys(N).forEach((i) => {
|
|
2046
|
+
Array.isArray(N[i]) && N[i].forEach((s) => bt(s)), delete N[i];
|
|
2048
2047
|
}), jt(null);
|
|
2049
2048
|
else if (Array.isArray(t))
|
|
2050
2049
|
t.forEach((i) => {
|
|
@@ -2071,66 +2070,66 @@ const bt = (t) => {
|
|
|
2071
2070
|
method: o,
|
|
2072
2071
|
splitKey: i = "+"
|
|
2073
2072
|
} = t;
|
|
2074
|
-
|
|
2075
|
-
const a = r.split(i), d = a.length, c = a[d - 1],
|
|
2076
|
-
if (!
|
|
2073
|
+
Ee(e).forEach((r) => {
|
|
2074
|
+
const a = r.split(i), d = a.length, c = a[d - 1], h = c === "*" ? "*" : lt(c);
|
|
2075
|
+
if (!N[h]) return;
|
|
2077
2076
|
n || (n = ct());
|
|
2078
|
-
const l = d > 1 ?
|
|
2079
|
-
|
|
2080
|
-
const
|
|
2081
|
-
return
|
|
2082
|
-
}),
|
|
2077
|
+
const l = d > 1 ? xe(j, a) : [], g = [];
|
|
2078
|
+
N[h] = N[h].filter((p) => {
|
|
2079
|
+
const w = (o ? p.method === o : !0) && p.scope === n && go(p.mods, l);
|
|
2080
|
+
return w && g.push(p.element), !w;
|
|
2081
|
+
}), g.forEach((p) => jt(p));
|
|
2083
2082
|
});
|
|
2084
2083
|
};
|
|
2085
|
-
function
|
|
2084
|
+
function se(t, e, n, o) {
|
|
2086
2085
|
if (e.element !== o)
|
|
2087
2086
|
return;
|
|
2088
2087
|
let i;
|
|
2089
2088
|
if (e.scope === n || e.scope === "all") {
|
|
2090
2089
|
i = e.mods.length > 0;
|
|
2091
|
-
for (const s in
|
|
2092
|
-
Object.prototype.hasOwnProperty.call(
|
|
2093
|
-
(e.mods.length === 0 && !
|
|
2090
|
+
for (const s in V)
|
|
2091
|
+
Object.prototype.hasOwnProperty.call(V, s) && (!V[s] && e.mods.indexOf(+s) > -1 || V[s] && e.mods.indexOf(+s) === -1) && (i = !1);
|
|
2092
|
+
(e.mods.length === 0 && !V[16] && !V[18] && !V[17] && !V[91] || i || e.shortcut === "*") && (e.keys = [], e.keys = e.keys.concat(I), e.method(t, e) === !1 && (t.preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = !0)));
|
|
2094
2093
|
}
|
|
2095
2094
|
}
|
|
2096
|
-
function
|
|
2097
|
-
const n =
|
|
2095
|
+
function re(t, e) {
|
|
2096
|
+
const n = N["*"];
|
|
2098
2097
|
let o = t.keyCode || t.which || t.charCode;
|
|
2099
|
-
if (
|
|
2098
|
+
if (!P.filter.call(this, t)) return;
|
|
2100
2099
|
if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
|
|
2101
2100
|
const d = Kt[a];
|
|
2102
2101
|
t[a] && I.indexOf(d) === -1 ? I.push(d) : !t[a] && I.indexOf(d) > -1 ? I.splice(I.indexOf(d), 1) : a === "metaKey" && t[a] && I.length === 3 && (t.ctrlKey || t.shiftKey || t.altKey || (I = I.slice(I.indexOf(d))));
|
|
2103
|
-
}), o in
|
|
2104
|
-
|
|
2105
|
-
for (const a in
|
|
2106
|
-
|
|
2102
|
+
}), o in V) {
|
|
2103
|
+
V[o] = !0;
|
|
2104
|
+
for (const a in j)
|
|
2105
|
+
j[a] === o && (P[a] = !0);
|
|
2107
2106
|
if (!n) return;
|
|
2108
2107
|
}
|
|
2109
|
-
for (const a in
|
|
2110
|
-
Object.prototype.hasOwnProperty.call(
|
|
2111
|
-
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18),
|
|
2108
|
+
for (const a in V)
|
|
2109
|
+
Object.prototype.hasOwnProperty.call(V, a) && (V[a] = t[Kt[a]]);
|
|
2110
|
+
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18), V[17] = !0, V[18] = !0);
|
|
2112
2111
|
const i = ct();
|
|
2113
2112
|
if (n)
|
|
2114
2113
|
for (let a = 0; a < n.length; a++)
|
|
2115
|
-
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) &&
|
|
2116
|
-
if (!(o in
|
|
2117
|
-
const s =
|
|
2114
|
+
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) && se(t, n[a], i, e);
|
|
2115
|
+
if (!(o in N)) return;
|
|
2116
|
+
const s = N[o], r = s.length;
|
|
2118
2117
|
for (let a = 0; a < r; a++)
|
|
2119
2118
|
if ((t.type === "keydown" && s[a].keydown || t.type === "keyup" && s[a].keyup) && s[a].key) {
|
|
2120
2119
|
const d = s[a], {
|
|
2121
2120
|
splitKey: c
|
|
2122
|
-
} = d,
|
|
2123
|
-
for (let
|
|
2124
|
-
l.push(lt(
|
|
2125
|
-
l.sort().join("") === I.sort().join("") &&
|
|
2121
|
+
} = d, h = d.key.split(c), l = [];
|
|
2122
|
+
for (let g = 0; g < h.length; g++)
|
|
2123
|
+
l.push(lt(h[g]));
|
|
2124
|
+
l.sort().join("") === I.sort().join("") && se(t, d, i, e);
|
|
2126
2125
|
}
|
|
2127
2126
|
}
|
|
2128
|
-
function
|
|
2127
|
+
function P(t, e, n) {
|
|
2129
2128
|
I = [];
|
|
2130
|
-
const o =
|
|
2131
|
-
let i = [], s = "all", r = document, a = 0, d = !1, c = !0,
|
|
2132
|
-
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (r = e.element), e.keyup && (d = e.keyup), e.keydown !== void 0 && (c = e.keydown), e.capture !== void 0 && (l = e.capture), typeof e.splitKey == "string" && (
|
|
2133
|
-
t = o[a].split(
|
|
2129
|
+
const o = Ee(t);
|
|
2130
|
+
let i = [], s = "all", r = document, a = 0, d = !1, c = !0, h = "+", l = !1, g = !1;
|
|
2131
|
+
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (r = e.element), e.keyup && (d = e.keyup), e.keydown !== void 0 && (c = e.keydown), e.capture !== void 0 && (l = e.capture), typeof e.splitKey == "string" && (h = e.splitKey), e.single === !0 && (g = !0)), typeof e == "string" && (s = e), g && Le(t, s); a < o.length; a++)
|
|
2132
|
+
t = o[a].split(h), i = [], t.length > 1 && (i = xe(j, t)), t = t[t.length - 1], t = t === "*" ? "*" : lt(t), t in N || (N[t] = []), N[t].push({
|
|
2134
2133
|
keyup: d,
|
|
2135
2134
|
keydown: c,
|
|
2136
2135
|
scope: s,
|
|
@@ -2138,45 +2137,45 @@ function $(t, e, n) {
|
|
|
2138
2137
|
shortcut: o[a],
|
|
2139
2138
|
method: n,
|
|
2140
2139
|
key: o[a],
|
|
2141
|
-
splitKey:
|
|
2140
|
+
splitKey: h,
|
|
2142
2141
|
element: r
|
|
2143
2142
|
});
|
|
2144
2143
|
if (typeof r < "u" && window) {
|
|
2145
|
-
if (!
|
|
2146
|
-
const
|
|
2147
|
-
let
|
|
2148
|
-
return
|
|
2144
|
+
if (!z.has(r)) {
|
|
2145
|
+
const p = function() {
|
|
2146
|
+
let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2147
|
+
return re(w, r);
|
|
2149
2148
|
}, v = function() {
|
|
2150
|
-
let
|
|
2151
|
-
|
|
2149
|
+
let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2150
|
+
re(w, r), So(w);
|
|
2152
2151
|
};
|
|
2153
|
-
|
|
2154
|
-
keydownListener:
|
|
2152
|
+
z.set(r, {
|
|
2153
|
+
keydownListener: p,
|
|
2155
2154
|
keyupListenr: v,
|
|
2156
2155
|
capture: l
|
|
2157
|
-
}),
|
|
2156
|
+
}), _t(r, "keydown", p, l), _t(r, "keyup", v, l);
|
|
2158
2157
|
}
|
|
2159
2158
|
if (!rt) {
|
|
2160
|
-
const
|
|
2159
|
+
const p = () => {
|
|
2161
2160
|
I = [];
|
|
2162
2161
|
};
|
|
2163
2162
|
rt = {
|
|
2164
|
-
listener:
|
|
2163
|
+
listener: p,
|
|
2165
2164
|
capture: l
|
|
2166
|
-
},
|
|
2165
|
+
}, _t(window, "focus", p, l);
|
|
2167
2166
|
}
|
|
2168
2167
|
}
|
|
2169
2168
|
}
|
|
2170
2169
|
function Co(t) {
|
|
2171
2170
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
|
|
2172
|
-
Object.keys(
|
|
2173
|
-
|
|
2171
|
+
Object.keys(N).forEach((n) => {
|
|
2172
|
+
N[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {
|
|
2174
2173
|
i && i.method && i.method();
|
|
2175
2174
|
});
|
|
2176
2175
|
});
|
|
2177
2176
|
}
|
|
2178
2177
|
function jt(t) {
|
|
2179
|
-
const e = Object.values(
|
|
2178
|
+
const e = Object.values(N).flat();
|
|
2180
2179
|
if (e.findIndex((o) => {
|
|
2181
2180
|
let {
|
|
2182
2181
|
element: i
|
|
@@ -2187,27 +2186,27 @@ function jt(t) {
|
|
|
2187
2186
|
keydownListener: o,
|
|
2188
2187
|
keyupListenr: i,
|
|
2189
2188
|
capture: s
|
|
2190
|
-
} =
|
|
2191
|
-
o && i && (
|
|
2189
|
+
} = z.get(t) || {};
|
|
2190
|
+
o && i && (et(t, "keyup", i, s), et(t, "keydown", o, s), z.delete(t));
|
|
2192
2191
|
}
|
|
2193
|
-
if ((e.length <= 0 ||
|
|
2192
|
+
if ((e.length <= 0 || z.size <= 0) && (Object.keys(z).forEach((i) => {
|
|
2194
2193
|
const {
|
|
2195
2194
|
keydownListener: s,
|
|
2196
2195
|
keyupListenr: r,
|
|
2197
2196
|
capture: a
|
|
2198
|
-
} =
|
|
2199
|
-
s && r && (
|
|
2200
|
-
}),
|
|
2197
|
+
} = z.get(i) || {};
|
|
2198
|
+
s && r && (et(i, "keyup", r, a), et(i, "keydown", s, a), z.delete(i));
|
|
2199
|
+
}), z.clear(), Object.keys(N).forEach((i) => delete N[i]), rt)) {
|
|
2201
2200
|
const {
|
|
2202
2201
|
listener: i,
|
|
2203
2202
|
capture: s
|
|
2204
2203
|
} = rt;
|
|
2205
|
-
|
|
2204
|
+
et(window, "focus", i, s), rt = null;
|
|
2206
2205
|
}
|
|
2207
2206
|
}
|
|
2208
2207
|
const Ut = {
|
|
2209
2208
|
getPressedKeyString: wo,
|
|
2210
|
-
setScope:
|
|
2209
|
+
setScope: Ce,
|
|
2211
2210
|
getScope: ct,
|
|
2212
2211
|
deleteScope: Eo,
|
|
2213
2212
|
getPressedKeyCodes: bo,
|
|
@@ -2215,161 +2214,176 @@ const Ut = {
|
|
|
2215
2214
|
isPressed: xo,
|
|
2216
2215
|
filter: Ao,
|
|
2217
2216
|
trigger: Co,
|
|
2218
|
-
unbind:
|
|
2217
|
+
unbind: Le,
|
|
2219
2218
|
keyMap: at,
|
|
2220
|
-
modifier:
|
|
2219
|
+
modifier: j,
|
|
2221
2220
|
modifierMap: Kt
|
|
2222
2221
|
};
|
|
2223
2222
|
for (const t in Ut)
|
|
2224
|
-
Object.prototype.hasOwnProperty.call(Ut, t) && (
|
|
2223
|
+
Object.prototype.hasOwnProperty.call(Ut, t) && (P[t] = Ut[t]);
|
|
2225
2224
|
if (typeof window < "u") {
|
|
2226
2225
|
const t = window.hotkeys;
|
|
2227
|
-
|
|
2226
|
+
P.noConflict = (e) => (e && window.hotkeys === P && (window.hotkeys = t), P), window.hotkeys = P;
|
|
2227
|
+
}
|
|
2228
|
+
async function Lo(t, e, n = () => !1) {
|
|
2229
|
+
do {
|
|
2230
|
+
if (await t(), await n()) break;
|
|
2231
|
+
const o = e;
|
|
2232
|
+
await new Promise((i) => setTimeout(i, Math.max(0, o)));
|
|
2233
|
+
} while (!await n());
|
|
2228
2234
|
}
|
|
2229
|
-
const
|
|
2230
|
-
...
|
|
2231
|
-
|
|
2232
|
-
],
|
|
2235
|
+
const ae = 300, Oe = ["up", "down", "left", "right"], Te = ke ? "⌘+a" : "ctrl+a", Oo = [
|
|
2236
|
+
...Oe.map((t) => `shift+${t}`),
|
|
2237
|
+
Te
|
|
2238
|
+
], To = (t, e, n) => {
|
|
2233
2239
|
const { store: o, selection: i } = e;
|
|
2234
2240
|
let s;
|
|
2235
|
-
const r = (
|
|
2241
|
+
const r = (f) => s = f;
|
|
2236
2242
|
let a;
|
|
2237
|
-
const d = (
|
|
2238
|
-
let c,
|
|
2239
|
-
const v = (
|
|
2240
|
-
|
|
2241
|
-
},
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
c = !((w = S.target.parentElement) != null && w.closest(j)) ? {
|
|
2245
|
-
annotation: be(),
|
|
2243
|
+
const d = (f) => a = f;
|
|
2244
|
+
let c, h, l, g = !1, p = !0;
|
|
2245
|
+
const v = (f) => {
|
|
2246
|
+
p = f, E.clear(), f || (c = void 0, l = void 0, g = !1);
|
|
2247
|
+
}, w = (f) => {
|
|
2248
|
+
p && (g = !1, h !== !1 && (c = nt(f.target) ? void 0 : {
|
|
2249
|
+
annotation: ye(),
|
|
2246
2250
|
selector: [],
|
|
2247
2251
|
creator: s,
|
|
2248
2252
|
created: /* @__PURE__ */ new Date()
|
|
2249
|
-
}
|
|
2250
|
-
}, E = Xt((
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2253
|
+
}));
|
|
2254
|
+
}, E = Xt((f) => {
|
|
2255
|
+
if (!p) return;
|
|
2256
|
+
const y = document.getSelection();
|
|
2257
|
+
if (!(y != null && y.anchorNode))
|
|
2258
|
+
return;
|
|
2259
|
+
if (nt(y.anchorNode)) {
|
|
2255
2260
|
c = void 0;
|
|
2256
2261
|
return;
|
|
2257
2262
|
}
|
|
2258
|
-
const x =
|
|
2259
|
-
if ((l == null ? void 0 : l.type) === "pointerdown" && (x < 1e3 && !c ||
|
|
2260
|
-
if (
|
|
2263
|
+
const x = f.timeStamp - ((l == null ? void 0 : l.timeStamp) || f.timeStamp);
|
|
2264
|
+
if ((l == null ? void 0 : l.type) === "pointerdown" && (x < 1e3 && !c || y.isCollapsed && x < ae) && w(l || f), !c) return;
|
|
2265
|
+
if (y.isCollapsed) {
|
|
2261
2266
|
o.getAnnotation(c.annotation) && (i.clear(), o.deleteAnnotation(c.annotation));
|
|
2262
2267
|
return;
|
|
2263
2268
|
}
|
|
2264
|
-
const
|
|
2269
|
+
const C = y.getRangeAt(0), B = je(C, t);
|
|
2265
2270
|
if (Ve(B)) return;
|
|
2266
|
-
const
|
|
2267
|
-
(
|
|
2268
|
-
var
|
|
2269
|
-
return
|
|
2271
|
+
const R = _e(B.cloneRange());
|
|
2272
|
+
(R.length !== c.selector.length || R.some((Y, At) => {
|
|
2273
|
+
var dt;
|
|
2274
|
+
return Y.toString() !== ((dt = c.selector[At]) == null ? void 0 : dt.quote);
|
|
2270
2275
|
})) && (c = {
|
|
2271
2276
|
...c,
|
|
2272
|
-
selector:
|
|
2277
|
+
selector: R.map((Y) => Pe(Y, t, n)),
|
|
2273
2278
|
updated: /* @__PURE__ */ new Date()
|
|
2274
|
-
}, o.getAnnotation(c.annotation)
|
|
2275
|
-
}, 10), m = (
|
|
2276
|
-
|
|
2277
|
-
p || (w = S.target.parentElement) != null && w.closest(j) || (l = Et(S), f = l.button === 0);
|
|
2279
|
+
}, o.getAnnotation(c.annotation) ? o.updateTarget(c, k.LOCAL) : i.clear());
|
|
2280
|
+
}, 10), m = (f) => {
|
|
2281
|
+
g || nt(f.target) || (l = Et(f), h = l.button === 0);
|
|
2278
2282
|
}, u = () => {
|
|
2279
2283
|
o.getAnnotation(c.annotation) ? o.updateTarget(c) : o.addAnnotation({
|
|
2280
2284
|
id: c.annotation,
|
|
2281
2285
|
bodies: [],
|
|
2282
2286
|
target: c
|
|
2283
2287
|
});
|
|
2284
|
-
},
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2288
|
+
}, b = async (f) => {
|
|
2289
|
+
if (g || nt(f.target) || !h) return;
|
|
2290
|
+
const y = () => {
|
|
2291
|
+
const { x: C, y: B } = t.getBoundingClientRect(), R = f.target instanceof Node && t.contains(f.target) && o.getAt(f.clientX - C, f.clientY - B, a);
|
|
2292
|
+
if (R) {
|
|
2293
|
+
const { selected: K } = i;
|
|
2294
|
+
(K.length !== 1 || K[0].id !== R.id) && i.userSelect(R.id, f);
|
|
2295
|
+
} else
|
|
2296
|
+
i.clear();
|
|
2297
|
+
};
|
|
2298
|
+
if (f.timeStamp - l.timeStamp < ae) {
|
|
2299
|
+
await S();
|
|
2300
|
+
const C = document.getSelection();
|
|
2301
|
+
if (C != null && C.isCollapsed) {
|
|
2302
|
+
c = void 0, y();
|
|
2303
|
+
return;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
c && c.selector.length > 0 && (i.clear(), u(), i.userSelect(c.annotation, Et(f)));
|
|
2307
|
+
}, S = async () => {
|
|
2308
|
+
const f = document.getSelection();
|
|
2309
|
+
let y = !1, x = f == null ? void 0 : f.isCollapsed;
|
|
2310
|
+
const C = () => x || y, B = 1;
|
|
2311
|
+
return setTimeout(() => y = !0, 50), Lo(() => x = f == null ? void 0 : f.isCollapsed, B, C);
|
|
2312
|
+
}, A = (f) => {
|
|
2313
|
+
g = !0;
|
|
2314
|
+
const y = document.getSelection();
|
|
2315
|
+
y != null && y.isCollapsed || ((!c || c.selector.length === 0) && E(f), u(), i.userSelect(c.annotation, Et(f)));
|
|
2316
|
+
}, L = (f) => {
|
|
2317
|
+
p && f.key === "Shift" && c && (document.getSelection().isCollapsed || (i.clear(), u(), i.userSelect(c.annotation, ut(f))));
|
|
2318
|
+
}, T = (f) => {
|
|
2319
|
+
const y = () => setTimeout(() => {
|
|
2306
2320
|
(c == null ? void 0 : c.selector.length) > 0 && (i.clear(), o.addAnnotation({
|
|
2307
2321
|
id: c.annotation,
|
|
2308
2322
|
bodies: [],
|
|
2309
2323
|
target: c
|
|
2310
|
-
}), i.userSelect(c.annotation, ut(
|
|
2324
|
+
}), i.userSelect(c.annotation, ut(f))), document.removeEventListener("selectionchange", y);
|
|
2311
2325
|
}, 100);
|
|
2312
|
-
document.addEventListener("selectionchange",
|
|
2326
|
+
document.addEventListener("selectionchange", y), w(f);
|
|
2313
2327
|
};
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
}),
|
|
2317
|
-
l = ut(
|
|
2328
|
+
P(Oo.join(","), { element: t, keydown: !0, keyup: !1 }, (f) => {
|
|
2329
|
+
f.repeat || (l = ut(f));
|
|
2330
|
+
}), P(Te, { keydown: !0, keyup: !1 }, (f) => {
|
|
2331
|
+
l = ut(f), T(f);
|
|
2318
2332
|
});
|
|
2319
|
-
const
|
|
2320
|
-
|
|
2333
|
+
const O = (f) => {
|
|
2334
|
+
f.repeat || f.target !== t && f.target !== document.body || (c = void 0, i.clear());
|
|
2321
2335
|
};
|
|
2322
|
-
return
|
|
2336
|
+
return P(Oe.join(","), { keydown: !0, keyup: !1 }, O), document.addEventListener("pointerdown", m), document.addEventListener("pointerup", b), document.addEventListener("contextmenu", A), t.addEventListener("keyup", L), t.addEventListener("selectstart", w), document.addEventListener("selectionchange", E), {
|
|
2323
2337
|
destroy: () => {
|
|
2324
|
-
c = void 0,
|
|
2338
|
+
c = void 0, h = void 0, l = void 0, g = !1, E.clear(), document.removeEventListener("pointerdown", m), document.removeEventListener("pointerup", b), document.removeEventListener("contextmenu", A), t.removeEventListener("keyup", L), t.removeEventListener("selectstart", w), document.removeEventListener("selectionchange", E), P.unbind();
|
|
2325
2339
|
},
|
|
2326
2340
|
setFilter: d,
|
|
2327
2341
|
setUser: r,
|
|
2328
2342
|
setAnnotatingEnabled: v
|
|
2329
2343
|
};
|
|
2330
|
-
},
|
|
2344
|
+
}, Ro = (t, e) => ({
|
|
2331
2345
|
...t,
|
|
2332
2346
|
annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
|
|
2333
2347
|
user: t.user || e.user
|
|
2334
|
-
}),
|
|
2335
|
-
|
|
2336
|
-
const n =
|
|
2348
|
+
}), ce = "SPANS", No = (t, e = {}) => {
|
|
2349
|
+
Be(t), Ie(t);
|
|
2350
|
+
const n = Ro(e, {
|
|
2337
2351
|
annotatingEnabled: !0,
|
|
2338
2352
|
user: Wn()
|
|
2339
2353
|
}), o = fo(t, n.userSelectAction), { selection: i, viewport: s } = o, r = o.store, a = Vn(r), d = Yn(o, a, n.adapter);
|
|
2340
2354
|
let c = n.user;
|
|
2341
|
-
const
|
|
2355
|
+
const h = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ce : n.renderer || ce, l = h === "SPANS" ? gn(t, o, s) : h === "CSS_HIGHLIGHTS" ? fn(t, o, s) : h === "CANVAS" ? en(t, o, s) : void 0;
|
|
2342
2356
|
if (!l)
|
|
2343
|
-
throw `Unknown renderer implementation: ${
|
|
2344
|
-
console.debug(`Using ${
|
|
2345
|
-
const
|
|
2346
|
-
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2357
|
+
throw `Unknown renderer implementation: ${h}`;
|
|
2358
|
+
console.debug(`Using ${h} renderer`), n.style && l.setStyle(n.style);
|
|
2359
|
+
const g = To(t, o, n.offsetReferenceSelector);
|
|
2360
|
+
g.setUser(c), g.setAnnotatingEnabled(n.annotatingEnabled);
|
|
2361
|
+
const p = Pn(o, a, n.adapter), v = () => c, w = (A) => {
|
|
2362
|
+
g.setAnnotatingEnabled(
|
|
2349
2363
|
A === void 0 ? !0 : A
|
|
2350
2364
|
);
|
|
2351
2365
|
}, E = (A) => {
|
|
2352
|
-
l.setFilter(A),
|
|
2366
|
+
l.setFilter(A), g.setFilter(A);
|
|
2353
2367
|
}, m = (A) => {
|
|
2354
|
-
c = A,
|
|
2368
|
+
c = A, g.setUser(A);
|
|
2355
2369
|
}, u = (A) => {
|
|
2356
|
-
A && (l.setPainter(
|
|
2357
|
-
},
|
|
2370
|
+
A && (l.setPainter(po(A, n.presence)), A.on("selectionChange", () => l.redraw()));
|
|
2371
|
+
}, b = (A) => {
|
|
2358
2372
|
A ? i.setSelected(A) : i.clear();
|
|
2359
2373
|
};
|
|
2360
2374
|
return {
|
|
2361
|
-
...
|
|
2375
|
+
...p,
|
|
2362
2376
|
destroy: () => {
|
|
2363
|
-
l.destroy(),
|
|
2377
|
+
l.destroy(), g.destroy(), a.destroy();
|
|
2364
2378
|
},
|
|
2365
2379
|
element: t,
|
|
2366
2380
|
getUser: v,
|
|
2367
|
-
setAnnotatingEnabled:
|
|
2381
|
+
setAnnotatingEnabled: w,
|
|
2368
2382
|
setFilter: E,
|
|
2369
2383
|
setStyle: l.setStyle.bind(l),
|
|
2370
2384
|
redraw: l.redraw.bind(l),
|
|
2371
2385
|
setUser: m,
|
|
2372
|
-
setSelected:
|
|
2386
|
+
setSelected: b,
|
|
2373
2387
|
setPresenceProvider: u,
|
|
2374
2388
|
setVisible: l.setVisible.bind(l),
|
|
2375
2389
|
on: d.on,
|
|
@@ -2380,45 +2394,46 @@ const ce = 300, Te = ["up", "down", "left", "right"], Re = _e ? "⌘+a" : "ctrl+
|
|
|
2380
2394
|
};
|
|
2381
2395
|
export {
|
|
2382
2396
|
vt as DEFAULT_SELECTED_STYLE,
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2397
|
+
W as DEFAULT_STYLE,
|
|
2398
|
+
le as NOT_ANNOTATABLE_CLASS,
|
|
2399
|
+
Z as NOT_ANNOTATABLE_SELECTOR,
|
|
2386
2400
|
k as Origin,
|
|
2387
2401
|
xn as UserSelectAction,
|
|
2388
2402
|
Io as W3CTextFormat,
|
|
2389
|
-
|
|
2403
|
+
Be as cancelSingleClickEvents,
|
|
2390
2404
|
ut as cloneKeyboardEvent,
|
|
2391
2405
|
Et as clonePointerEvent,
|
|
2392
2406
|
ko as createBody,
|
|
2393
2407
|
en as createCanvasRenderer,
|
|
2394
2408
|
fn as createHighlightsRenderer,
|
|
2395
|
-
|
|
2409
|
+
po as createPresencePainter,
|
|
2396
2410
|
un as createRenderer,
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2411
|
+
To as createSelectionHandler,
|
|
2412
|
+
gn as createSpansRenderer,
|
|
2413
|
+
No as createTextAnnotator,
|
|
2400
2414
|
fo as createTextAnnotatorState,
|
|
2401
2415
|
Bo as denormalizeRectWithOffset,
|
|
2402
|
-
|
|
2403
|
-
Ro as getAnnotatableFragment,
|
|
2416
|
+
Ro as fillDefaults,
|
|
2404
2417
|
Ue as getQuoteContext,
|
|
2405
2418
|
Dt as getRangeAnnotatableContents,
|
|
2406
|
-
|
|
2407
|
-
|
|
2419
|
+
ke as isMac,
|
|
2420
|
+
nt as isNotAnnotatable,
|
|
2421
|
+
Me as isRangeAnnotatable,
|
|
2422
|
+
F as isRevived,
|
|
2408
2423
|
Ve as isWhitespaceOrEmpty,
|
|
2409
2424
|
Xe as mergeClientRects,
|
|
2410
2425
|
He as normalizeRectWithOffset,
|
|
2411
2426
|
Fe as paint,
|
|
2412
2427
|
to as parseW3CTextAnnotation,
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2428
|
+
Ie as programmaticallyFocusable,
|
|
2429
|
+
$e as rangeContains,
|
|
2430
|
+
Pe as rangeToSelector,
|
|
2416
2431
|
xt as reviveAnnotation,
|
|
2417
|
-
|
|
2432
|
+
de as reviveSelector,
|
|
2418
2433
|
wt as reviveTarget,
|
|
2419
2434
|
ze as scrollIntoView,
|
|
2420
2435
|
eo as serializeW3CTextAnnotation,
|
|
2421
|
-
|
|
2436
|
+
_e as splitAnnotatableRanges,
|
|
2422
2437
|
Mo as toDomRectList,
|
|
2423
2438
|
je as trimRangeToContainer,
|
|
2424
2439
|
De as whitespaceOrEmptyRegex
|