@soomo/text-annotator 3.2.0-staging.9 → 3.3.0-staging.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/TextAnnotatorOptions.d.ts +13 -0
- package/dist/src/utils/isNotAnnotatable.d.ts +2 -2
- package/dist/src/utils/splitAnnotatableRanges.d.ts +1 -1
- package/dist/text-annotator.es.js +550 -541
- 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 +9 -9
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { colord as
|
|
3
|
-
import { dequal as
|
|
4
|
-
import { v4 as
|
|
5
|
-
import { serializeW3CBodies as
|
|
6
|
-
import { Origin as
|
|
7
|
-
import
|
|
8
|
-
import { createNanoEvents as
|
|
1
|
+
import X from "debounce";
|
|
2
|
+
import { colord as ot } from "colord";
|
|
3
|
+
import { dequal as ut } from "dequal/lite";
|
|
4
|
+
import { v4 as st } from "uuid";
|
|
5
|
+
import { serializeW3CBodies as ft, parseW3CBodies as gt, parseW3CUser as mt, createStore as pt, createSelectionState as ht, createHoverState as yt, createViewportState as bt, Origin as $, createAnonymousGuest as St, createUndoStack as Ct, createLifecycleObserver as Et, createBaseAnnotator as wt } from "@annotorious/core";
|
|
6
|
+
import { Origin as Le, UserSelectAction as ke, createBody as Ne } from "@annotorious/core";
|
|
7
|
+
import At from "rbush";
|
|
8
|
+
import { createNanoEvents as vt } from "nanoevents";
|
|
9
9
|
import V from "hotkeys-js";
|
|
10
|
-
import { poll as
|
|
11
|
-
const
|
|
12
|
-
var
|
|
13
|
-
return !!(
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
return !
|
|
10
|
+
import { poll as xt } from "poll";
|
|
11
|
+
const rt = "not-annotatable", _ = `.${rt}`, U = (t, n) => {
|
|
12
|
+
var o;
|
|
13
|
+
return t.contains(n) ? !!(n instanceof HTMLElement ? n.closest(_) : (o = n.parentElement) == null ? void 0 : o.closest(_)) : !0;
|
|
14
|
+
}, Rt = (t, n) => {
|
|
15
|
+
const e = n.commonAncestorContainer;
|
|
16
|
+
return !U(t, e);
|
|
17
17
|
}, Tt = (t) => t.addEventListener("click", (n) => {
|
|
18
18
|
// Allow clicks within not-annotatable elements
|
|
19
|
-
!n.target.closest(
|
|
20
|
-
}),
|
|
21
|
-
/mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform),
|
|
19
|
+
!n.target.closest(_) && !n.target.closest("a") && n.preventDefault();
|
|
20
|
+
}), Lt = typeof navigator < "u" && // @ts-ignore
|
|
21
|
+
/mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), kt = (t) => {
|
|
22
22
|
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
23
|
-
},
|
|
23
|
+
}, Nt = function* (t) {
|
|
24
24
|
const n = document.createNodeIterator(
|
|
25
25
|
t.commonAncestorContainer,
|
|
26
26
|
NodeFilter.SHOW_ELEMENT,
|
|
27
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
27
|
+
(o) => o instanceof HTMLElement && o.classList.contains(rt) && !o.parentElement.closest(_) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
28
28
|
);
|
|
29
29
|
let e;
|
|
30
30
|
for (; e = n.nextNode(); )
|
|
31
31
|
e instanceof HTMLElement && (yield e);
|
|
32
|
-
}, Bt = (t) => {
|
|
33
|
-
if (!
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
for (const
|
|
37
|
-
let
|
|
38
|
-
|
|
32
|
+
}, Bt = (t, n) => {
|
|
33
|
+
if (!Rt(t, n)) return [];
|
|
34
|
+
const e = [];
|
|
35
|
+
let o = null;
|
|
36
|
+
for (const s of Nt(n)) {
|
|
37
|
+
let r;
|
|
38
|
+
o ? (r = document.createRange(), r.setStartAfter(o), r.setEndBefore(s)) : (r = n.cloneRange(), r.setEndBefore(s)), r.collapsed || e.push(r), o = s;
|
|
39
39
|
}
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
40
|
+
if (o) {
|
|
41
|
+
const s = n.cloneRange();
|
|
42
|
+
s.setStartAfter(o), s.collapsed || e.push(s);
|
|
43
43
|
}
|
|
44
|
-
return
|
|
45
|
-
},
|
|
44
|
+
return e.length > 0 ? e : [n];
|
|
45
|
+
}, Z = (t) => {
|
|
46
46
|
const n = t.cloneContents();
|
|
47
|
-
return n.querySelectorAll(
|
|
48
|
-
},
|
|
49
|
-
const s = o ? t.startContainer.parentElement.closest(o) : n,
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const u =
|
|
47
|
+
return n.querySelectorAll(_).forEach((e) => e.remove()), n;
|
|
48
|
+
}, Ot = (t, n, e = 10, o) => {
|
|
49
|
+
const s = o ? t.startContainer.parentElement.closest(o) : n, r = document.createRange();
|
|
50
|
+
r.setStart(s, 0), r.setEnd(t.startContainer, t.startOffset);
|
|
51
|
+
const i = Z(r).textContent, a = document.createRange();
|
|
52
|
+
a.setStart(t.endContainer, t.endOffset), s === document.body ? a.setEnd(s, s.childNodes.length) : a.setEndAfter(s);
|
|
53
|
+
const u = Z(a).textContent;
|
|
54
54
|
return {
|
|
55
|
-
prefix:
|
|
55
|
+
prefix: i.substring(i.length - e),
|
|
56
56
|
suffix: u.substring(0, e)
|
|
57
57
|
};
|
|
58
|
-
}, M = (t) => t.every((n) => n.range instanceof Range && !n.range.collapsed),
|
|
59
|
-
const e = (
|
|
58
|
+
}, M = (t) => t.every((n) => n.range instanceof Range && !n.range.collapsed), It = /^\s*$/, Mt = (t) => It.test(t.toString()), Ht = (t, n) => {
|
|
59
|
+
const e = (r) => Math.round(r * 10) / 10, o = {
|
|
60
60
|
top: e(t.top),
|
|
61
61
|
bottom: e(t.bottom),
|
|
62
62
|
left: e(t.left),
|
|
@@ -79,31 +79,31 @@ const st = "not-annotatable", D = `.${st}`, W = (t) => {
|
|
|
79
79
|
return "block-contains";
|
|
80
80
|
} else if (o.top >= s.top && o.bottom <= s.bottom && o.left >= s.left && o.right <= s.right)
|
|
81
81
|
return "block-is-contained";
|
|
82
|
-
},
|
|
83
|
-
const e = Math.min(t.left, n.left), o = Math.max(t.right, n.right), s = Math.min(t.top, n.top),
|
|
84
|
-
return new DOMRect(e, s, o - e,
|
|
85
|
-
},
|
|
82
|
+
}, Pt = (t, n) => {
|
|
83
|
+
const e = Math.min(t.left, n.left), o = Math.max(t.right, n.right), s = Math.min(t.top, n.top), r = Math.max(t.bottom, n.bottom);
|
|
84
|
+
return new DOMRect(e, s, o - e, r - s);
|
|
85
|
+
}, Dt = (t) => t.reduce((n, e) => {
|
|
86
86
|
if (e.width === 0 || e.height === 0)
|
|
87
87
|
return n;
|
|
88
88
|
let o = [...n], s = !1;
|
|
89
|
-
for (const
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
o = o.map((
|
|
89
|
+
for (const r of n) {
|
|
90
|
+
const i = Ht(e, r);
|
|
91
|
+
if (i === "inline-adjacent") {
|
|
92
|
+
o = o.map((a) => a === r ? Pt(e, r) : a), s = !0;
|
|
93
93
|
break;
|
|
94
|
-
} else if (
|
|
95
|
-
o = o.map((
|
|
94
|
+
} else if (i === "inline-contains") {
|
|
95
|
+
o = o.map((a) => a === r ? e : a), s = !0;
|
|
96
96
|
break;
|
|
97
|
-
} else if (
|
|
97
|
+
} else if (i === "inline-is-contained") {
|
|
98
98
|
s = !0;
|
|
99
99
|
break;
|
|
100
|
-
} else if (
|
|
101
|
-
e.width <
|
|
100
|
+
} else if (i === "block-contains" || i === "block-is-contained") {
|
|
101
|
+
e.width < r.width && (o = o.map((a) => a === r ? e : a)), s = !0;
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
return s ? o : [...o, e];
|
|
106
|
-
}, []),
|
|
106
|
+
}, []), we = (t) => ({
|
|
107
107
|
length: t.length,
|
|
108
108
|
item: (n) => t[n],
|
|
109
109
|
[Symbol.iterator]: function* () {
|
|
@@ -113,63 +113,63 @@ const st = "not-annotatable", D = `.${st}`, W = (t) => {
|
|
|
113
113
|
}), Kt = (t, n, e) => {
|
|
114
114
|
const o = document.createRange(), s = e ? t.startContainer.parentElement.closest(e) : n;
|
|
115
115
|
o.setStart(s, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
116
|
-
const
|
|
117
|
-
return e ? { quote:
|
|
118
|
-
},
|
|
119
|
-
var
|
|
120
|
-
const { start: e, end: o } = t, s = t.offsetReference || n,
|
|
116
|
+
const r = Z(o).textContent, i = t.toString(), a = r.length || 0, u = a + i.length;
|
|
117
|
+
return e ? { quote: i, start: a, end: u, range: t, offsetReference: s } : { quote: i, start: a, end: u, range: t };
|
|
118
|
+
}, it = (t, n) => {
|
|
119
|
+
var b, f;
|
|
120
|
+
const { start: e, end: o } = t, s = t.offsetReference || n, r = document.createNodeIterator(
|
|
121
121
|
n,
|
|
122
122
|
NodeFilter.SHOW_TEXT,
|
|
123
|
-
(
|
|
124
|
-
var
|
|
125
|
-
return (
|
|
123
|
+
(p) => {
|
|
124
|
+
var c;
|
|
125
|
+
return (c = p.parentElement) != null && c.closest(_) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
126
126
|
}
|
|
127
127
|
);
|
|
128
|
-
let
|
|
129
|
-
const
|
|
130
|
-
let u =
|
|
128
|
+
let i = 0;
|
|
129
|
+
const a = document.createRange();
|
|
130
|
+
let u = r.nextNode();
|
|
131
131
|
u === null && console.error("Could not revive annotation target. Content missing.");
|
|
132
|
-
let
|
|
132
|
+
let S = !s;
|
|
133
133
|
for (; u !== null; ) {
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
134
|
+
if (S || (S = typeof (s == null ? void 0 : s.contains) == "function" ? s.contains(u) : !1), S) {
|
|
135
|
+
const p = ((b = u.textContent) == null ? void 0 : b.length) || 0;
|
|
136
|
+
if (i + p > e) {
|
|
137
|
+
a.setStart(u, e - i);
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
i += p;
|
|
141
141
|
}
|
|
142
|
-
u =
|
|
142
|
+
u = r.nextNode();
|
|
143
143
|
}
|
|
144
144
|
for (; u !== null; ) {
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
|
|
145
|
+
const p = ((f = u.textContent) == null ? void 0 : f.length) || 0;
|
|
146
|
+
if (i + p >= o) {
|
|
147
|
+
a.setEnd(u, o - i);
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
i += p, u = r.nextNode();
|
|
151
151
|
}
|
|
152
152
|
return {
|
|
153
153
|
...t,
|
|
154
|
-
range:
|
|
154
|
+
range: a
|
|
155
155
|
};
|
|
156
|
-
},
|
|
156
|
+
}, z = (t, n) => M(t.selector) ? t : {
|
|
157
157
|
...t,
|
|
158
|
-
selector: t.selector.map((e) => e.range instanceof Range && !e.range.collapsed ? e :
|
|
159
|
-
},
|
|
158
|
+
selector: t.selector.map((e) => e.range instanceof Range && !e.range.collapsed ? e : it(e, n))
|
|
159
|
+
}, G = (t, n) => M(t.target.selector) ? t : { ...t, target: z(t.target, n) }, at = (t, n) => {
|
|
160
160
|
if (t.isEqualNode(n))
|
|
161
161
|
return !0;
|
|
162
162
|
for (let e of t.childNodes)
|
|
163
|
-
if (
|
|
163
|
+
if (at(e, n))
|
|
164
164
|
return !0;
|
|
165
165
|
return !1;
|
|
166
166
|
}, $t = (t, n) => {
|
|
167
167
|
const e = t.cloneContents();
|
|
168
|
-
return
|
|
168
|
+
return at(e, n);
|
|
169
169
|
}, _t = (t, n) => {
|
|
170
170
|
const e = t.cloneRange(), o = n.contains(e.startContainer), s = n.contains(e.endContainer);
|
|
171
171
|
return !o && !s && !$t(e, n) ? (e.collapse(), e) : (o || e.setStart(n, 0), s || e.setEnd(n, n.childNodes.length), e);
|
|
172
|
-
},
|
|
172
|
+
}, Q = (t) => ({
|
|
173
173
|
...t,
|
|
174
174
|
type: t.type,
|
|
175
175
|
x: t.x,
|
|
@@ -211,150 +211,150 @@ const st = "not-annotatable", D = `.${st}`, W = (t) => {
|
|
|
211
211
|
defaultPrevented: t.defaultPrevented,
|
|
212
212
|
detail: t.detail,
|
|
213
213
|
timeStamp: t.timeStamp
|
|
214
|
-
}),
|
|
215
|
-
const { left: e, top: o, right: s, bottom:
|
|
216
|
-
return new DOMRect(e - n.left, o - n.top, s - e,
|
|
217
|
-
},
|
|
218
|
-
const { left: e, top: o, right: s, bottom:
|
|
219
|
-
return new DOMRect(e + n.left, o + n.top, s - e,
|
|
220
|
-
},
|
|
214
|
+
}), Ft = (t, n) => {
|
|
215
|
+
const { left: e, top: o, right: s, bottom: r } = t;
|
|
216
|
+
return new DOMRect(e - n.left, o - n.top, s - e, r - o);
|
|
217
|
+
}, Ae = (t, n) => {
|
|
218
|
+
const { left: e, top: o, right: s, bottom: r } = t;
|
|
219
|
+
return new DOMRect(e + n.left, o + n.top, s - e, r - o);
|
|
220
|
+
}, ct = (t) => {
|
|
221
221
|
if (!t)
|
|
222
222
|
return document.scrollingElement;
|
|
223
223
|
const { overflowY: n } = window.getComputedStyle(t);
|
|
224
|
-
return n !== "visible" && n !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
225
|
-
},
|
|
226
|
-
const o = e.getBoundingClientRect(), s = e.clientHeight,
|
|
227
|
-
e.scroll({ top:
|
|
228
|
-
},
|
|
229
|
-
const s = typeof e == "string" ? e : e.id,
|
|
230
|
-
if (!
|
|
224
|
+
return n !== "visible" && n !== "hidden" && t.scrollHeight > t.clientHeight ? t : ct(t.parentElement);
|
|
225
|
+
}, tt = (t, n, e) => {
|
|
226
|
+
const o = e.getBoundingClientRect(), s = e.clientHeight, r = e.clientWidth, i = n.selector[0].range.getBoundingClientRect(), { width: a, height: u } = t.getAnnotationBounds(n.annotation), S = i.top - o.top, b = i.left - o.left, f = e.parentElement ? e.scrollTop : 0, p = e.parentElement ? e.scrollLeft : 0, c = S + f - (s - u) / 2, x = b + p - (r - a) / 2;
|
|
227
|
+
e.scroll({ top: c, left: x, behavior: "smooth" });
|
|
228
|
+
}, Ut = (t, n) => (e, o) => {
|
|
229
|
+
const s = typeof e == "string" ? e : e.id, r = o ? typeof o == "string" ? document.getElementById(o) : o : ct(t);
|
|
230
|
+
if (!r)
|
|
231
231
|
return console.warn(`The scroll parent is missing for the annotation: ${s}`, { container: t }), !1;
|
|
232
|
-
const
|
|
233
|
-
if (!
|
|
232
|
+
const i = n.getAnnotation(s);
|
|
233
|
+
if (!i)
|
|
234
234
|
return console.warn(`The annotation is missing in the store: ${s}`), !1;
|
|
235
|
-
const { range:
|
|
236
|
-
if (
|
|
237
|
-
return
|
|
238
|
-
const u =
|
|
239
|
-
return
|
|
240
|
-
},
|
|
235
|
+
const { range: a } = i.target.selector[0];
|
|
236
|
+
if (a && !a.collapsed)
|
|
237
|
+
return tt(n, i.target, r), !0;
|
|
238
|
+
const u = z(i.target, t), { range: S } = u.selector[0];
|
|
239
|
+
return S && !S.collapsed ? (tt(n, u, r), !0) : !1;
|
|
240
|
+
}, P = {
|
|
241
241
|
fill: "rgb(0, 128, 255)",
|
|
242
242
|
fillOpacity: 0.18
|
|
243
|
-
},
|
|
243
|
+
}, q = {
|
|
244
244
|
fill: "rgb(0, 128, 255)",
|
|
245
245
|
fillOpacity: 0.45
|
|
246
|
-
},
|
|
247
|
-
var
|
|
248
|
-
const
|
|
249
|
-
return o && o.paint(t, n) ||
|
|
250
|
-
}, Wt = (t) => {
|
|
251
|
-
const { top: n, left: e } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: s } = window, i = -e, a = -n, c = o - e, u = s - n;
|
|
252
|
-
return { top: n, left: e, minX: i, minY: a, maxX: c, maxY: u };
|
|
246
|
+
}, Wt = (t, n, e, o, s) => {
|
|
247
|
+
var i, a;
|
|
248
|
+
const r = e ? typeof e == "function" ? e(t.annotation, t.state, s) || ((i = t.state) != null && i.selected ? q : P) : e : (a = t.state) != null && a.selected ? q : P;
|
|
249
|
+
return o && o.paint(t, n) || r;
|
|
253
250
|
}, Vt = (t) => {
|
|
251
|
+
const { top: n, left: e } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: s } = window, r = -e, i = -n, a = o - e, u = s - n;
|
|
252
|
+
return { top: n, left: e, minX: r, minY: i, maxX: a, maxY: u };
|
|
253
|
+
}, Yt = (t) => {
|
|
254
254
|
let n = /* @__PURE__ */ new Set();
|
|
255
255
|
return (o) => {
|
|
256
|
-
const s = o.map((
|
|
257
|
-
(n.size !== s.length || s.some((
|
|
256
|
+
const s = o.map((r) => r.id);
|
|
257
|
+
(n.size !== s.length || s.some((r) => !n.has(r))) && t.set(s), n = new Set(s);
|
|
258
258
|
};
|
|
259
|
-
},
|
|
260
|
-
const { store: s, selection:
|
|
261
|
-
let
|
|
262
|
-
const
|
|
263
|
-
const { x:
|
|
264
|
-
|
|
259
|
+
}, J = (t, n, e, o) => {
|
|
260
|
+
const { store: s, selection: r, hover: i } = n;
|
|
261
|
+
let a, u, S;
|
|
262
|
+
const b = Yt(e), f = (C) => {
|
|
263
|
+
const { x: k, y: B } = t.getBoundingClientRect(), D = s.getAt(C.clientX - k, C.clientY - B, !1, u);
|
|
264
|
+
D ? i.current !== D.id && (t.classList.add("hovered"), i.set(D.id)) : i.current && (t.classList.remove("hovered"), i.set(null));
|
|
265
265
|
};
|
|
266
|
-
t.addEventListener("pointermove",
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
const
|
|
266
|
+
t.addEventListener("pointermove", f);
|
|
267
|
+
const p = (C = !1) => {
|
|
268
|
+
S && S.clear();
|
|
269
|
+
const k = Vt(t), { minX: B, minY: D, maxX: h, maxY: T } = k, O = u ? s.getIntersecting(B, D, h, T).filter(({ annotation: L }) => u(L)) : s.getIntersecting(B, D, h, T), I = r.selected.map(({ id: L }) => L), H = O.map(({ annotation: L, rects: W }) => {
|
|
270
|
+
const N = I.includes(L.id), K = L.id === i.current;
|
|
271
271
|
return {
|
|
272
|
-
annotation:
|
|
273
|
-
rects:
|
|
274
|
-
state: { selected:
|
|
272
|
+
annotation: L,
|
|
273
|
+
rects: W,
|
|
274
|
+
state: { selected: N, hovered: K }
|
|
275
275
|
};
|
|
276
276
|
});
|
|
277
|
-
o.redraw(
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
},
|
|
283
|
-
u =
|
|
284
|
-
},
|
|
285
|
-
s.observe(
|
|
286
|
-
const
|
|
287
|
-
document.addEventListener("scroll",
|
|
288
|
-
const
|
|
289
|
-
s.recalculatePositions(),
|
|
277
|
+
o.redraw(H, k, a, S, C), setTimeout(() => b(O.map(({ annotation: L }) => L)), 1);
|
|
278
|
+
}, c = (C) => {
|
|
279
|
+
S = C, p();
|
|
280
|
+
}, x = (C) => {
|
|
281
|
+
a = C, p();
|
|
282
|
+
}, A = (C) => {
|
|
283
|
+
u = C, p(!1);
|
|
284
|
+
}, R = () => p();
|
|
285
|
+
s.observe(R);
|
|
286
|
+
const E = r.subscribe(() => p()), m = i.subscribe(() => p()), l = () => p(!0);
|
|
287
|
+
document.addEventListener("scroll", l, { capture: !0, passive: !0 });
|
|
288
|
+
const g = X(() => {
|
|
289
|
+
s.recalculatePositions(), S == null || S.reset(), p();
|
|
290
290
|
}, 10);
|
|
291
|
-
window.addEventListener("resize",
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
});
|
|
297
|
-
return w.observe(document.body,
|
|
291
|
+
window.addEventListener("resize", g);
|
|
292
|
+
const d = new ResizeObserver(g);
|
|
293
|
+
d.observe(t);
|
|
294
|
+
const y = { attributes: !0, childList: !0, subtree: !0 }, w = new MutationObserver(X((C) => {
|
|
295
|
+
C.every((B) => B.target === t || t.contains(B.target)) || p(!0);
|
|
296
|
+
}, 150));
|
|
297
|
+
return w.observe(document.body, y), {
|
|
298
298
|
destroy: () => {
|
|
299
|
-
t.removeEventListener("pointermove",
|
|
299
|
+
t.removeEventListener("pointermove", f), o.destroy(), s.unobserve(R), E(), m(), document.removeEventListener("scroll", l), g.clear(), window.removeEventListener("resize", g), d.disconnect(), w.disconnect();
|
|
300
300
|
},
|
|
301
|
-
redraw:
|
|
302
|
-
setStyle:
|
|
303
|
-
setFilter:
|
|
304
|
-
setPainter:
|
|
301
|
+
redraw: p,
|
|
302
|
+
setStyle: x,
|
|
303
|
+
setFilter: A,
|
|
304
|
+
setPainter: c,
|
|
305
305
|
setVisible: o.setVisible
|
|
306
306
|
};
|
|
307
|
-
},
|
|
307
|
+
}, Xt = () => {
|
|
308
308
|
const t = document.createElement("canvas");
|
|
309
309
|
return t.width = window.innerWidth, t.height = window.innerHeight, t.className = "r6o-canvas-highlight-layer bg", t;
|
|
310
|
-
},
|
|
310
|
+
}, zt = (t, n) => {
|
|
311
311
|
t.width = window.innerWidth, t.height = window.innerHeight;
|
|
312
|
-
},
|
|
312
|
+
}, qt = (t) => {
|
|
313
313
|
t.classList.add("r6o-annotatable");
|
|
314
|
-
const n =
|
|
314
|
+
const n = Xt(), e = n.getContext("2d");
|
|
315
315
|
document.body.appendChild(n);
|
|
316
|
-
const o = (
|
|
317
|
-
const { width:
|
|
318
|
-
e.clearRect(-0.5, -0.5,
|
|
319
|
-
const { top:
|
|
320
|
-
[...
|
|
321
|
-
const { annotation: { target: { created: m } } } =
|
|
322
|
-
return m.getTime() -
|
|
323
|
-
}).forEach((
|
|
324
|
-
var
|
|
325
|
-
const
|
|
326
|
-
x:
|
|
327
|
-
y:
|
|
316
|
+
const o = (a, u, S, b) => requestAnimationFrame(() => {
|
|
317
|
+
const { width: f, height: p } = n;
|
|
318
|
+
e.clearRect(-0.5, -0.5, f + 1, p + 1), b && b.clear();
|
|
319
|
+
const { top: c, left: x } = u;
|
|
320
|
+
[...a].sort((R, E) => {
|
|
321
|
+
const { annotation: { target: { created: m } } } = R, { annotation: { target: { created: l } } } = E;
|
|
322
|
+
return m.getTime() - l.getTime();
|
|
323
|
+
}).forEach((R) => {
|
|
324
|
+
var g;
|
|
325
|
+
const E = S ? typeof S == "function" ? S(R.annotation, R.state) : S : (g = R.state) != null && g.selected ? q : P, m = b && b.paint(R, u) || E, l = R.rects.map(({ x: d, y, width: w, height: v }) => ({
|
|
326
|
+
x: d + x,
|
|
327
|
+
y: y + c,
|
|
328
328
|
width: w,
|
|
329
329
|
height: v
|
|
330
330
|
}));
|
|
331
|
-
if (e.fillStyle = m.fill, e.globalAlpha = m.fillOpacity || 1,
|
|
332
|
-
({ x:
|
|
331
|
+
if (e.fillStyle = m.fill, e.globalAlpha = m.fillOpacity || 1, l.forEach(
|
|
332
|
+
({ x: d, y, width: w, height: v }) => e.fillRect(d, y, w, v)
|
|
333
333
|
), m.underlineColor) {
|
|
334
334
|
e.globalAlpha = 1, e.strokeStyle = m.underlineColor, e.lineWidth = m.underlineThickness ?? 1;
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
e.beginPath(), e.moveTo(
|
|
335
|
+
const d = m.underlineOffset ?? 0;
|
|
336
|
+
l.forEach(({ x: y, y: w, width: v, height: C }) => {
|
|
337
|
+
e.beginPath(), e.moveTo(y, w + C + d), e.lineTo(y + v, w + C + d), e.stroke();
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
|
-
}), s =
|
|
341
|
+
}), s = X(() => zt(n), 10);
|
|
342
342
|
return window.addEventListener("resize", s), {
|
|
343
343
|
destroy: () => {
|
|
344
344
|
n.remove(), s.clear(), window.removeEventListener("resize", s);
|
|
345
345
|
},
|
|
346
|
-
setVisible: (
|
|
346
|
+
setVisible: (a) => {
|
|
347
347
|
console.log("setVisible not implemented on Canvas renderer");
|
|
348
348
|
},
|
|
349
349
|
redraw: o
|
|
350
350
|
};
|
|
351
|
-
},
|
|
352
|
-
`background-color:${
|
|
351
|
+
}, jt = (t, n, e) => J(t, n, e, qt(t)), Gt = (t) => [
|
|
352
|
+
`background-color:${ot((t == null ? void 0 : t.fill) || P.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? P.fillOpacity : t.fillOpacity).toHex()}`,
|
|
353
353
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
354
354
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
355
355
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
356
356
|
t != null && t.underlineThickness ? `text-decoration-thickness:${t.underlineThickness}px` : void 0
|
|
357
|
-
].filter(Boolean).join(";"),
|
|
357
|
+
].filter(Boolean).join(";"), Qt = () => {
|
|
358
358
|
const t = document.createElement("style");
|
|
359
359
|
document.getElementsByTagName("head")[0].appendChild(t);
|
|
360
360
|
let n = /* @__PURE__ */ new Set();
|
|
@@ -362,29 +362,29 @@ const st = "not-annotatable", D = `.${st}`, W = (t) => {
|
|
|
362
362
|
destroy: () => {
|
|
363
363
|
CSS.highlights.clear(), t.remove();
|
|
364
364
|
},
|
|
365
|
-
setVisible: (
|
|
365
|
+
setVisible: (r) => {
|
|
366
366
|
console.log("setVisible not implemented on CSS Custom Highlights renderer");
|
|
367
367
|
},
|
|
368
|
-
redraw: (i, a,
|
|
368
|
+
redraw: (r, i, a, u) => {
|
|
369
369
|
u && u.clear();
|
|
370
|
-
const
|
|
371
|
-
Array.from(n).filter((
|
|
372
|
-
const
|
|
373
|
-
var
|
|
374
|
-
const
|
|
375
|
-
return `::highlight(_${
|
|
370
|
+
const S = new Set(r.map((f) => f.annotation.id));
|
|
371
|
+
Array.from(n).filter((f) => !S.has(f));
|
|
372
|
+
const b = r.map((f) => {
|
|
373
|
+
var x;
|
|
374
|
+
const p = a ? typeof a == "function" ? a(f.annotation, f.state) : a : (x = f.state) != null && x.selected ? q : P, c = u && u.paint(f, i) || p;
|
|
375
|
+
return `::highlight(_${f.annotation.id}) { ${Gt(c)} }`;
|
|
376
376
|
});
|
|
377
|
-
t.innerHTML =
|
|
378
|
-
`), CSS.highlights.clear(),
|
|
379
|
-
const
|
|
380
|
-
CSS.highlights.set(`_${
|
|
381
|
-
}), n =
|
|
377
|
+
t.innerHTML = b.join(`
|
|
378
|
+
`), CSS.highlights.clear(), r.forEach(({ annotation: f }) => {
|
|
379
|
+
const p = f.target.selector.map((x) => x.range), c = new Highlight(...p);
|
|
380
|
+
CSS.highlights.set(`_${f.id}`, c);
|
|
381
|
+
}), n = S;
|
|
382
382
|
}
|
|
383
383
|
};
|
|
384
|
-
},
|
|
385
|
-
const e = (
|
|
386
|
-
return s.sort((
|
|
387
|
-
},
|
|
384
|
+
}, Zt = (t, n, e) => J(t, n, e, Qt()), Jt = (t, n) => {
|
|
385
|
+
const e = (r, i) => r.x <= i.x + i.width && r.x + r.width >= i.x && r.y <= i.y + i.height && r.y + r.height >= i.y, o = (r) => r.rects.reduce((i, a) => i + a.width, 0), s = n.filter(({ rects: r }) => r.some((i) => e(t, i)));
|
|
386
|
+
return s.sort((r, i) => o(i) - o(r)), s.findIndex((r) => r.rects.includes(t));
|
|
387
|
+
}, te = (t) => {
|
|
388
388
|
t.classList.add("r6o-annotatable");
|
|
389
389
|
const n = document.createElement("div");
|
|
390
390
|
n.className = "r6o-span-highlight-layer", t.insertBefore(n, t.firstChild);
|
|
@@ -393,513 +393,522 @@ const st = "not-annotatable", D = `.${st}`, W = (t) => {
|
|
|
393
393
|
destroy: () => {
|
|
394
394
|
n.remove();
|
|
395
395
|
},
|
|
396
|
-
redraw: (
|
|
397
|
-
const
|
|
398
|
-
if (!
|
|
399
|
-
|
|
400
|
-
const { annotation: { target: { created:
|
|
401
|
-
return
|
|
402
|
-
}).forEach((
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
396
|
+
redraw: (i, a, u, S, b) => {
|
|
397
|
+
const p = !(ut(e, i) && b);
|
|
398
|
+
if (!S && !p) return;
|
|
399
|
+
p && (n.innerHTML = ""), [...i].sort((x, A) => {
|
|
400
|
+
const { annotation: { target: { created: R } } } = x, { annotation: { target: { created: E } } } = A;
|
|
401
|
+
return R && E ? R.getTime() - E.getTime() : 0;
|
|
402
|
+
}).forEach((x) => {
|
|
403
|
+
x.rects.map((A) => {
|
|
404
|
+
const R = Jt(A, i), E = Wt(x, a, u, S, R);
|
|
405
|
+
if (p) {
|
|
406
406
|
const m = document.createElement("span");
|
|
407
|
-
m.className = "r6o-annotation", m.dataset.annotation =
|
|
407
|
+
m.className = "r6o-annotation", m.dataset.annotation = x.annotation.id, m.style.left = `${A.x}px`, m.style.top = `${A.y}px`, m.style.width = `${A.width}px`, m.style.height = `${A.height}px`, m.style.backgroundColor = ot((E == null ? void 0 : E.fill) || P.fill).alpha((E == null ? void 0 : E.fillOpacity) === void 0 ? P.fillOpacity : E.fillOpacity).toHex(), E.underlineStyle && (m.style.borderStyle = E.underlineStyle), E.underlineColor && (m.style.borderColor = E.underlineColor), E.underlineThickness && (m.style.borderBottomWidth = `${E.underlineThickness}px`), E.underlineOffset && (m.style.paddingBottom = `${E.underlineOffset}px`), n.appendChild(m);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
}), e =
|
|
410
|
+
}), e = i;
|
|
411
411
|
},
|
|
412
|
-
setVisible: (
|
|
413
|
-
|
|
412
|
+
setVisible: (i) => {
|
|
413
|
+
i ? n.classList.remove("hidden") : n.classList.add("hidden");
|
|
414
414
|
}
|
|
415
415
|
};
|
|
416
|
-
},
|
|
417
|
-
parse: (e) =>
|
|
418
|
-
serialize: (e) =>
|
|
419
|
-
}),
|
|
416
|
+
}, ee = (t, n, e) => J(t, n, e, te(t)), ve = (t, n) => ({
|
|
417
|
+
parse: (e) => se(e),
|
|
418
|
+
serialize: (e) => re(e, t, n)
|
|
419
|
+
}), ne = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, oe = (t) => {
|
|
420
420
|
const {
|
|
421
421
|
id: n,
|
|
422
422
|
creator: e,
|
|
423
423
|
created: o,
|
|
424
424
|
modified: s,
|
|
425
|
-
target:
|
|
426
|
-
} = t,
|
|
427
|
-
if (
|
|
425
|
+
target: r
|
|
426
|
+
} = t, i = Array.isArray(r) ? r : [r];
|
|
427
|
+
if (i.length === 0)
|
|
428
428
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
429
|
-
const
|
|
430
|
-
creator:
|
|
429
|
+
const a = {
|
|
430
|
+
creator: mt(e),
|
|
431
431
|
created: o ? new Date(o) : void 0,
|
|
432
432
|
updated: s ? new Date(s) : void 0,
|
|
433
433
|
annotation: n,
|
|
434
434
|
selector: [],
|
|
435
435
|
// @ts-expect-error: `styleClass` is not part of the core `TextAnnotationTarget` type
|
|
436
|
-
styleClass: "styleClass" in
|
|
436
|
+
styleClass: "styleClass" in i[0] ? i[0].styleClass : void 0
|
|
437
437
|
};
|
|
438
|
-
for (const u of
|
|
439
|
-
const
|
|
440
|
-
switch (
|
|
438
|
+
for (const u of i) {
|
|
439
|
+
const b = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((f, p) => {
|
|
440
|
+
switch (p.type) {
|
|
441
441
|
case "TextQuoteSelector":
|
|
442
|
-
|
|
442
|
+
f.quote = p.exact;
|
|
443
443
|
break;
|
|
444
444
|
case "TextPositionSelector":
|
|
445
|
-
|
|
445
|
+
f.start = p.start, f.end = p.end;
|
|
446
446
|
break;
|
|
447
447
|
}
|
|
448
|
-
return
|
|
448
|
+
return f;
|
|
449
449
|
}, {});
|
|
450
|
-
if (
|
|
451
|
-
|
|
450
|
+
if (a.outdated || (a.outdated = "outdated" in u ? u.outdated : void 0), ne(b))
|
|
451
|
+
a.selector.push(
|
|
452
452
|
{
|
|
453
|
-
...
|
|
453
|
+
...b,
|
|
454
454
|
id: u.id,
|
|
455
455
|
// @ts-expect-error: `scope` is not part of the core `TextSelector` type
|
|
456
456
|
scope: u.scope
|
|
457
457
|
}
|
|
458
458
|
);
|
|
459
459
|
else {
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
460
|
+
const f = [
|
|
461
|
+
b.start ? void 0 : "TextPositionSelector",
|
|
462
|
+
b.quote ? void 0 : "TextQuoteSelector"
|
|
463
463
|
].filter(Boolean);
|
|
464
|
-
return { error: Error(`Missing selector types: ${
|
|
464
|
+
return { error: Error(`Missing selector types: ${f.join(" and ")} for annotation: ${t.id}`) };
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
return { parsed:
|
|
468
|
-
},
|
|
469
|
-
const n = t.id ||
|
|
467
|
+
return { parsed: a };
|
|
468
|
+
}, se = (t) => {
|
|
469
|
+
const n = t.id || st(), {
|
|
470
470
|
creator: e,
|
|
471
471
|
created: o,
|
|
472
472
|
modified: s,
|
|
473
|
-
body:
|
|
474
|
-
...
|
|
475
|
-
} = t,
|
|
473
|
+
body: r,
|
|
474
|
+
...i
|
|
475
|
+
} = t, a = gt(r, n), u = oe(t);
|
|
476
476
|
return "error" in u ? { error: u.error } : {
|
|
477
477
|
parsed: {
|
|
478
|
-
...
|
|
478
|
+
...i,
|
|
479
479
|
id: n,
|
|
480
|
-
bodies:
|
|
480
|
+
bodies: a,
|
|
481
481
|
target: u.parsed
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
|
-
},
|
|
485
|
-
const { bodies: o, target: s, ...
|
|
486
|
-
selector:
|
|
487
|
-
creator:
|
|
484
|
+
}, re = (t, n, e) => {
|
|
485
|
+
const { bodies: o, target: s, ...r } = t, {
|
|
486
|
+
selector: i,
|
|
487
|
+
creator: a,
|
|
488
488
|
created: u,
|
|
489
|
-
updated:
|
|
490
|
-
...
|
|
491
|
-
} = s,
|
|
492
|
-
const { id:
|
|
489
|
+
updated: S,
|
|
490
|
+
...b
|
|
491
|
+
} = s, f = i.map((p) => {
|
|
492
|
+
const { id: c, quote: x, start: A, end: R, range: E } = p, m = {
|
|
493
493
|
type: "TextQuoteSelector",
|
|
494
|
-
exact:
|
|
494
|
+
exact: x
|
|
495
495
|
};
|
|
496
496
|
if (e) {
|
|
497
|
-
const { prefix:
|
|
498
|
-
m.prefix =
|
|
497
|
+
const { prefix: g, suffix: d } = Ot(E, e);
|
|
498
|
+
m.prefix = g, m.suffix = d;
|
|
499
499
|
}
|
|
500
|
-
const
|
|
500
|
+
const l = {
|
|
501
501
|
type: "TextPositionSelector",
|
|
502
|
-
start:
|
|
503
|
-
end:
|
|
502
|
+
start: A,
|
|
503
|
+
end: R
|
|
504
504
|
};
|
|
505
505
|
return {
|
|
506
|
-
...
|
|
507
|
-
id:
|
|
506
|
+
...b,
|
|
507
|
+
id: c,
|
|
508
508
|
// @ts-expect-error: `scope` is not part of the core `TextSelector` type
|
|
509
|
-
scope: "scope" in
|
|
509
|
+
scope: "scope" in p ? p.scope : void 0,
|
|
510
510
|
source: n,
|
|
511
|
-
selector: [m,
|
|
511
|
+
selector: [m, l]
|
|
512
512
|
};
|
|
513
513
|
});
|
|
514
514
|
return {
|
|
515
|
-
...
|
|
515
|
+
...r,
|
|
516
516
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
517
517
|
id: t.id,
|
|
518
518
|
type: "Annotation",
|
|
519
|
-
body:
|
|
520
|
-
creator:
|
|
519
|
+
body: ft(t.bodies),
|
|
520
|
+
creator: a,
|
|
521
521
|
created: u == null ? void 0 : u.toISOString(),
|
|
522
|
-
modified:
|
|
523
|
-
target:
|
|
522
|
+
modified: S == null ? void 0 : S.toISOString(),
|
|
523
|
+
target: f
|
|
524
524
|
};
|
|
525
|
-
},
|
|
526
|
-
const e = new
|
|
527
|
-
const
|
|
528
|
-
const v = M([w]) ? w.range :
|
|
525
|
+
}, ie = (t, n) => {
|
|
526
|
+
const e = new At(), o = /* @__PURE__ */ new Map(), s = vt(), r = (l, g) => {
|
|
527
|
+
const d = l.selector.flatMap((w) => {
|
|
528
|
+
const v = M([w]) ? w.range : it(w, n).range;
|
|
529
529
|
return Array.from(v.getClientRects());
|
|
530
|
-
}),
|
|
531
|
-
return
|
|
532
|
-
const { x: v, y:
|
|
530
|
+
}), y = Dt(d).map((w) => Ft(w, g));
|
|
531
|
+
return y.map((w) => {
|
|
532
|
+
const { x: v, y: C, width: k, height: B } = w;
|
|
533
533
|
return {
|
|
534
534
|
minX: v,
|
|
535
|
-
minY:
|
|
536
|
-
maxX: v +
|
|
537
|
-
maxY:
|
|
535
|
+
minY: C,
|
|
536
|
+
maxX: v + k,
|
|
537
|
+
maxY: C + B,
|
|
538
538
|
annotation: {
|
|
539
|
-
id:
|
|
540
|
-
rects:
|
|
539
|
+
id: l.annotation,
|
|
540
|
+
rects: y
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
543
|
});
|
|
544
|
-
},
|
|
544
|
+
}, i = () => [...o.values()], a = () => {
|
|
545
545
|
e.clear(), o.clear();
|
|
546
|
-
}, u = (
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
},
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
},
|
|
553
|
-
|
|
554
|
-
},
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
|
|
546
|
+
}, u = (l) => {
|
|
547
|
+
const g = r(l, n.getBoundingClientRect());
|
|
548
|
+
g.length !== 0 && (g.forEach((d) => e.insert(d)), o.set(l.annotation, g));
|
|
549
|
+
}, S = (l) => {
|
|
550
|
+
const g = o.get(l.annotation);
|
|
551
|
+
g && (g.forEach((d) => e.remove(d)), o.delete(l.annotation));
|
|
552
|
+
}, b = (l) => {
|
|
553
|
+
S(l), u(l);
|
|
554
|
+
}, f = (l, g = !0) => {
|
|
555
|
+
g && a();
|
|
556
|
+
const d = n.getBoundingClientRect(), y = l.map((v) => ({ target: v, rects: r(v, d) }));
|
|
557
|
+
y.forEach(({ target: v, rects: C }) => {
|
|
558
|
+
C.length > 0 && o.set(v.annotation, C);
|
|
559
559
|
});
|
|
560
|
-
const w =
|
|
560
|
+
const w = y.flatMap(({ rects: v }) => v);
|
|
561
561
|
e.load(w);
|
|
562
|
-
},
|
|
563
|
-
const
|
|
564
|
-
minX:
|
|
565
|
-
minY:
|
|
566
|
-
maxX:
|
|
567
|
-
maxY:
|
|
568
|
-
}), w = (v) => v.annotation.rects.reduce((
|
|
569
|
-
return
|
|
570
|
-
},
|
|
571
|
-
const
|
|
572
|
-
if (
|
|
562
|
+
}, p = (l, g, d = !1) => {
|
|
563
|
+
const y = e.search({
|
|
564
|
+
minX: l,
|
|
565
|
+
minY: g,
|
|
566
|
+
maxX: l,
|
|
567
|
+
maxY: g
|
|
568
|
+
}), w = (v) => v.annotation.rects.reduce((C, k) => C + k.width * k.height, 0);
|
|
569
|
+
return y.length > 0 ? (y.sort((v, C) => w(v) - w(C)), d ? y.map((v) => v.annotation.id) : [y[0].annotation.id]) : [];
|
|
570
|
+
}, c = (l) => {
|
|
571
|
+
const g = x(l);
|
|
572
|
+
if (g.length === 0)
|
|
573
573
|
return;
|
|
574
|
-
let
|
|
575
|
-
for (let
|
|
576
|
-
const
|
|
577
|
-
|
|
574
|
+
let d = g[0].left, y = g[0].top, w = g[0].right, v = g[0].bottom;
|
|
575
|
+
for (let C = 1; C < g.length; C++) {
|
|
576
|
+
const k = g[C];
|
|
577
|
+
d = Math.min(d, k.left), y = Math.min(y, k.top), w = Math.max(w, k.right), v = Math.max(v, k.bottom);
|
|
578
578
|
}
|
|
579
|
-
return new DOMRect(
|
|
580
|
-
},
|
|
581
|
-
const
|
|
582
|
-
return
|
|
579
|
+
return new DOMRect(d, y, w - d, v - y);
|
|
580
|
+
}, x = (l) => {
|
|
581
|
+
const g = o.get(l);
|
|
582
|
+
return g ? g[0].annotation.rects : [];
|
|
583
583
|
};
|
|
584
584
|
return {
|
|
585
|
-
all:
|
|
586
|
-
clear:
|
|
587
|
-
getAt:
|
|
588
|
-
getAnnotationBounds:
|
|
589
|
-
getAnnotationRects:
|
|
590
|
-
getIntersecting: (
|
|
591
|
-
const w = e.search({ minX:
|
|
592
|
-
return Array.from(v).map((
|
|
593
|
-
annotation: t.getAnnotation(
|
|
594
|
-
rects:
|
|
595
|
-
})).filter((
|
|
585
|
+
all: i,
|
|
586
|
+
clear: a,
|
|
587
|
+
getAt: p,
|
|
588
|
+
getAnnotationBounds: c,
|
|
589
|
+
getAnnotationRects: x,
|
|
590
|
+
getIntersecting: (l, g, d, y) => {
|
|
591
|
+
const w = e.search({ minX: l, minY: g, maxX: d, maxY: y }), v = new Set(w.map((C) => C.annotation.id));
|
|
592
|
+
return Array.from(v).map((C) => ({
|
|
593
|
+
annotation: t.getAnnotation(C),
|
|
594
|
+
rects: x(C)
|
|
595
|
+
})).filter((C) => !!C.annotation);
|
|
596
596
|
},
|
|
597
597
|
insert: u,
|
|
598
598
|
recalculate: () => {
|
|
599
|
-
|
|
599
|
+
f(t.all().map((l) => l.target), !0), s.emit("recalculate");
|
|
600
600
|
},
|
|
601
|
-
remove:
|
|
602
|
-
set:
|
|
601
|
+
remove: S,
|
|
602
|
+
set: f,
|
|
603
603
|
size: () => e.all().length,
|
|
604
|
-
update:
|
|
605
|
-
on: (
|
|
604
|
+
update: b,
|
|
605
|
+
on: (l, g) => s.on(l, g)
|
|
606
606
|
};
|
|
607
|
-
},
|
|
608
|
-
const e =
|
|
609
|
-
const
|
|
610
|
-
return
|
|
611
|
-
}, u = (m,
|
|
612
|
-
const
|
|
613
|
-
return e.bulkAddAnnotations(
|
|
614
|
-
},
|
|
615
|
-
const
|
|
616
|
-
return
|
|
617
|
-
e.getAnnotation(
|
|
618
|
-
}),
|
|
619
|
-
},
|
|
620
|
-
const
|
|
621
|
-
e.updateTarget(
|
|
622
|
-
},
|
|
623
|
-
const
|
|
624
|
-
e.bulkUpdateTargets(
|
|
607
|
+
}, ae = (t, n) => {
|
|
608
|
+
const e = pt(), o = ie(e, t), s = ht(e, n.userSelectAction, n.adapter), r = yt(e), i = bt(), a = (m, l = $.LOCAL) => {
|
|
609
|
+
const g = G(m, t), d = M(g.target.selector);
|
|
610
|
+
return d && e.addAnnotation(g, l), d;
|
|
611
|
+
}, u = (m, l = !0, g = $.LOCAL) => {
|
|
612
|
+
const d = m.map((w) => G(w, t)), y = d.filter((w) => !M(w.target.selector));
|
|
613
|
+
return e.bulkAddAnnotations(d, l, g), y;
|
|
614
|
+
}, S = (m, l = $.LOCAL) => {
|
|
615
|
+
const g = m.map((y) => G(y, t)), d = g.filter((y) => !M(y.target.selector));
|
|
616
|
+
return g.forEach((y) => {
|
|
617
|
+
e.getAnnotation(y.id) ? e.updateAnnotation(y, l) : e.addAnnotation(y, l);
|
|
618
|
+
}), d;
|
|
619
|
+
}, b = (m, l = $.LOCAL) => {
|
|
620
|
+
const g = z(m, t);
|
|
621
|
+
e.updateTarget(g, l);
|
|
622
|
+
}, f = (m, l = $.LOCAL) => {
|
|
623
|
+
const g = m.map((d) => z(d, t));
|
|
624
|
+
e.bulkUpdateTargets(g, l);
|
|
625
625
|
};
|
|
626
|
-
function
|
|
627
|
-
const
|
|
626
|
+
function p(m, l, g, d) {
|
|
627
|
+
const y = g || !!d, w = o.getAt(m, l, y).map((C) => e.getAnnotation(C)), v = d ? w.filter(d) : w;
|
|
628
628
|
if (v.length !== 0)
|
|
629
|
-
return
|
|
629
|
+
return g ? v : v[0];
|
|
630
630
|
}
|
|
631
|
-
const
|
|
631
|
+
const c = (m) => o.getAnnotationRects(m).length > 0 ? o.getAnnotationBounds(m) : void 0, x = (m, l, g, d) => o.getIntersecting(m, l, g, d), A = (m) => o.getAnnotationRects(m), R = () => o.recalculate(), E = (m) => o.on("recalculate", m);
|
|
632
632
|
return e.observe(({ changes: m }) => {
|
|
633
|
-
const
|
|
634
|
-
(
|
|
633
|
+
const l = (m.deleted || []).filter((y) => M(y.target.selector)), g = (m.created || []).filter((y) => M(y.target.selector)), d = (m.updated || []).filter((y) => M(y.newValue.target.selector));
|
|
634
|
+
(l == null ? void 0 : l.length) > 0 && l.forEach((y) => o.remove(y.target)), g.length > 0 && o.set(g.map((y) => y.target), !1), (d == null ? void 0 : d.length) > 0 && d.forEach(({ newValue: y }) => o.update(y.target));
|
|
635
635
|
}), {
|
|
636
636
|
store: {
|
|
637
637
|
...e,
|
|
638
|
-
addAnnotation:
|
|
638
|
+
addAnnotation: a,
|
|
639
639
|
bulkAddAnnotations: u,
|
|
640
|
-
bulkUpdateTargets:
|
|
641
|
-
bulkUpsertAnnotations:
|
|
642
|
-
getAnnotationBounds:
|
|
643
|
-
getAnnotationRects:
|
|
644
|
-
getIntersecting:
|
|
645
|
-
getAt:
|
|
646
|
-
recalculatePositions:
|
|
647
|
-
onRecalculatePositions:
|
|
648
|
-
updateTarget:
|
|
640
|
+
bulkUpdateTargets: f,
|
|
641
|
+
bulkUpsertAnnotations: S,
|
|
642
|
+
getAnnotationBounds: c,
|
|
643
|
+
getAnnotationRects: A,
|
|
644
|
+
getIntersecting: x,
|
|
645
|
+
getAt: p,
|
|
646
|
+
recalculatePositions: R,
|
|
647
|
+
onRecalculatePositions: E,
|
|
648
|
+
updateTarget: b
|
|
649
649
|
},
|
|
650
650
|
selection: s,
|
|
651
|
-
hover:
|
|
652
|
-
viewport:
|
|
651
|
+
hover: r,
|
|
652
|
+
viewport: i
|
|
653
653
|
};
|
|
654
|
-
},
|
|
654
|
+
}, ce = () => {
|
|
655
655
|
const t = document.createElement("canvas");
|
|
656
656
|
t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = "r6o-presence-layer";
|
|
657
657
|
const n = t.getContext("2d");
|
|
658
658
|
return n.scale(2, 2), n.translate(0.5, 0.5), t;
|
|
659
|
-
},
|
|
660
|
-
const e =
|
|
659
|
+
}, le = (t, n = {}) => {
|
|
660
|
+
const e = ce(), o = e.getContext("2d");
|
|
661
661
|
document.body.appendChild(e);
|
|
662
|
-
const s = /* @__PURE__ */ new Map(),
|
|
663
|
-
return t.on("selectionChange", (
|
|
664
|
-
|
|
662
|
+
const s = /* @__PURE__ */ new Map(), r = (b) => Array.from(s.entries()).filter(([f, p]) => p.presenceKey === b.presenceKey).map(([f, p]) => f);
|
|
663
|
+
return t.on("selectionChange", (b, f) => {
|
|
664
|
+
r(b).forEach((c) => s.delete(c)), f && f.forEach((c) => s.set(c, b));
|
|
665
665
|
}), {
|
|
666
666
|
clear: () => {
|
|
667
|
-
const { width:
|
|
668
|
-
o.clearRect(-0.5, -0.5,
|
|
667
|
+
const { width: b, height: f } = e;
|
|
668
|
+
o.clearRect(-0.5, -0.5, b + 1, f + 1);
|
|
669
669
|
},
|
|
670
670
|
destroy: () => {
|
|
671
671
|
e.remove();
|
|
672
672
|
},
|
|
673
|
-
paint: (
|
|
673
|
+
paint: (b, f, p) => {
|
|
674
674
|
n.font && (o.font = n.font);
|
|
675
|
-
const
|
|
676
|
-
if (
|
|
677
|
-
const { height:
|
|
678
|
-
o.fillStyle =
|
|
679
|
-
const
|
|
680
|
-
return o.fillRect(
|
|
681
|
-
fill:
|
|
682
|
-
fillOpacity:
|
|
675
|
+
const c = s.get(b.annotation.id);
|
|
676
|
+
if (c) {
|
|
677
|
+
const { height: x } = b.rects[0], A = b.rects[0].x + f.left, R = b.rects[0].y + f.top;
|
|
678
|
+
o.fillStyle = c.appearance.color, o.fillRect(A - 2, R - 2.5, 2, x + 5);
|
|
679
|
+
const E = o.measureText(c.appearance.label), m = E.width + 6, l = E.actualBoundingBoxAscent + E.actualBoundingBoxDescent + 8, g = E.fontBoundingBoxAscent ? 8 : 6.5;
|
|
680
|
+
return o.fillRect(A - 2, R - 2.5 - l, m, l), o.fillStyle = "#fff", o.fillText(c.appearance.label, A + 1, R - g), {
|
|
681
|
+
fill: c.appearance.color,
|
|
682
|
+
fillOpacity: p ? 0.45 : 0.18
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
685
|
},
|
|
686
686
|
reset: () => {
|
|
687
687
|
e.width = 2 * window.innerWidth, e.height = 2 * window.innerHeight;
|
|
688
|
-
const
|
|
689
|
-
|
|
688
|
+
const b = e.getContext("2d");
|
|
689
|
+
b.scale(2, 2), b.translate(0.5, 0.5);
|
|
690
690
|
}
|
|
691
691
|
};
|
|
692
|
-
},
|
|
693
|
-
...
|
|
694
|
-
|
|
695
|
-
],
|
|
692
|
+
}, et = 300, lt = ["up", "down", "left", "right"], dt = Lt ? "⌘+a" : "ctrl+a", de = [
|
|
693
|
+
...lt.map((t) => `shift+${t}`),
|
|
694
|
+
dt
|
|
695
|
+
], ue = (t, n, e) => {
|
|
696
696
|
const { store: o, selection: s } = n;
|
|
697
|
-
let
|
|
698
|
-
const {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
697
|
+
let r;
|
|
698
|
+
const {
|
|
699
|
+
annotatingEnabled: i,
|
|
700
|
+
offsetReferenceSelector: a,
|
|
701
|
+
selectionMode: u,
|
|
702
|
+
dismissOnNotAnnotatable: S = "NEVER"
|
|
703
|
+
} = e, b = (h) => r = h;
|
|
704
|
+
let f;
|
|
705
|
+
const p = (h) => f = h;
|
|
706
|
+
let c, x, A, R = i;
|
|
707
|
+
const E = (h) => {
|
|
708
|
+
R = h, l.clear(), h || (c = void 0, x = void 0, A = void 0);
|
|
709
|
+
}, m = (h) => {
|
|
710
|
+
R && x !== !1 && (c = U(t, h.target) ? void 0 : {
|
|
711
|
+
annotation: st(),
|
|
707
712
|
selector: [],
|
|
708
|
-
creator:
|
|
713
|
+
creator: r,
|
|
709
714
|
created: /* @__PURE__ */ new Date()
|
|
710
715
|
});
|
|
711
|
-
},
|
|
712
|
-
if (!
|
|
713
|
-
const
|
|
714
|
-
if (!(
|
|
716
|
+
}, l = X((h) => {
|
|
717
|
+
if (!R) return;
|
|
718
|
+
const T = document.getSelection();
|
|
719
|
+
if (!(T != null && T.anchorNode))
|
|
715
720
|
return;
|
|
716
|
-
if (
|
|
717
|
-
|
|
721
|
+
if (U(t, T.anchorNode)) {
|
|
722
|
+
c = void 0;
|
|
718
723
|
return;
|
|
719
724
|
}
|
|
720
|
-
const
|
|
721
|
-
if ((
|
|
722
|
-
if (
|
|
723
|
-
o.getAnnotation(
|
|
725
|
+
const O = h.timeStamp - ((A == null ? void 0 : A.timeStamp) || h.timeStamp);
|
|
726
|
+
if ((A == null ? void 0 : A.type) === "pointerdown" && (O < 1e3 && !c || T.isCollapsed && O < et) && m(A || h), !c) return;
|
|
727
|
+
if (T.isCollapsed) {
|
|
728
|
+
o.getAnnotation(c.annotation) && (s.clear(), o.deleteAnnotation(c.annotation));
|
|
724
729
|
return;
|
|
725
730
|
}
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
728
|
-
const
|
|
729
|
-
(
|
|
730
|
-
var
|
|
731
|
-
return
|
|
732
|
-
})) && (
|
|
733
|
-
...
|
|
734
|
-
selector:
|
|
731
|
+
const H = Array.from(Array(T.rangeCount).keys()).map((N) => T.getRangeAt(N)).map((N) => _t(N, t));
|
|
732
|
+
if (H.every((N) => Mt(N))) return;
|
|
733
|
+
const L = H.flatMap((N) => Bt(t, N.cloneRange()));
|
|
734
|
+
(L.length !== c.selector.length || L.some((N, K) => {
|
|
735
|
+
var j;
|
|
736
|
+
return N.toString() !== ((j = c.selector[K]) == null ? void 0 : j.quote);
|
|
737
|
+
})) && (c = {
|
|
738
|
+
...c,
|
|
739
|
+
selector: L.map((N) => Kt(N, t, a)),
|
|
735
740
|
updated: /* @__PURE__ */ new Date()
|
|
736
|
-
}, o.getAnnotation(
|
|
737
|
-
}, 10),
|
|
738
|
-
|
|
739
|
-
},
|
|
740
|
-
if (
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
741
|
+
}, o.getAnnotation(c.annotation) ? o.updateTarget(c, $.LOCAL) : s.clear());
|
|
742
|
+
}, 10), g = (h) => {
|
|
743
|
+
U(t, h.target) || (A = Q(h), x = A.button === 0);
|
|
744
|
+
}, d = async (h) => {
|
|
745
|
+
if (!x) return;
|
|
746
|
+
if (U(t, h.target)) {
|
|
747
|
+
(typeof S == "function" ? S(h, t) : S === "ALWAYS") && s.clear();
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
const T = () => {
|
|
751
|
+
const { x: I, y: H } = t.getBoundingClientRect(), L = h.target instanceof Node && t.contains(h.target) && o.getAt(h.clientX - I, h.clientY - H, u === "all", f);
|
|
752
|
+
if (L) {
|
|
753
|
+
const { selected: W } = s, N = new Set(W.map((F) => F.id)), K = Array.isArray(L) ? L.map((F) => F.id) : [L.id];
|
|
754
|
+
(N.size !== K.length || !K.every((F) => N.has(F))) && s.userSelect(K, h);
|
|
746
755
|
} else
|
|
747
756
|
s.clear();
|
|
748
757
|
};
|
|
749
|
-
if (
|
|
750
|
-
await
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
|
|
758
|
+
if (h.timeStamp - A.timeStamp < et) {
|
|
759
|
+
await y();
|
|
760
|
+
const I = document.getSelection();
|
|
761
|
+
if (I != null && I.isCollapsed) {
|
|
762
|
+
c = void 0, T();
|
|
754
763
|
return;
|
|
755
764
|
}
|
|
756
765
|
}
|
|
757
|
-
|
|
758
|
-
},
|
|
759
|
-
const
|
|
760
|
-
let
|
|
761
|
-
const
|
|
762
|
-
return setTimeout(() =>
|
|
763
|
-
},
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
},
|
|
767
|
-
|
|
768
|
-
},
|
|
769
|
-
const
|
|
770
|
-
(
|
|
771
|
-
id:
|
|
766
|
+
c && c.selector.length > 0 && (B(), s.userSelect(c.annotation, Q(h)));
|
|
767
|
+
}, y = async () => {
|
|
768
|
+
const h = document.getSelection();
|
|
769
|
+
let T = !1, O = h == null ? void 0 : h.isCollapsed;
|
|
770
|
+
const I = () => O || T, H = 1;
|
|
771
|
+
return setTimeout(() => T = !0, 50), xt(() => O = h == null ? void 0 : h.isCollapsed, H, I);
|
|
772
|
+
}, w = (h) => {
|
|
773
|
+
const T = document.getSelection();
|
|
774
|
+
T != null && T.isCollapsed || ((!c || c.selector.length === 0) && l(h), c && (B(), s.userSelect(c.annotation, Q(h))));
|
|
775
|
+
}, v = (h) => {
|
|
776
|
+
R && h.key === "Shift" && c && (document.getSelection().isCollapsed || (B(), s.userSelect(c.annotation, Y(h))));
|
|
777
|
+
}, C = (h) => {
|
|
778
|
+
const T = () => setTimeout(() => {
|
|
779
|
+
(c == null ? void 0 : c.selector.length) > 0 && (s.clear(), o.addAnnotation({
|
|
780
|
+
id: c.annotation,
|
|
772
781
|
bodies: [],
|
|
773
|
-
target:
|
|
774
|
-
}), s.userSelect(
|
|
782
|
+
target: c
|
|
783
|
+
}), s.userSelect(c.annotation, Y(h))), document.removeEventListener("selectionchange", T);
|
|
775
784
|
}, 100);
|
|
776
|
-
document.addEventListener("selectionchange",
|
|
785
|
+
document.addEventListener("selectionchange", T), m(h);
|
|
777
786
|
};
|
|
778
|
-
V(
|
|
779
|
-
|
|
780
|
-
}), V(
|
|
781
|
-
|
|
787
|
+
V(de.join(","), { element: t, keydown: !0, keyup: !1 }, (h) => {
|
|
788
|
+
h.repeat || (A = Y(h));
|
|
789
|
+
}), V(dt, { keydown: !0, keyup: !1 }, (h) => {
|
|
790
|
+
A = Y(h), C(h);
|
|
782
791
|
});
|
|
783
|
-
const
|
|
784
|
-
|
|
792
|
+
const k = (h) => {
|
|
793
|
+
h.repeat || h.target !== t && h.target !== document.body || (c = void 0, s.clear());
|
|
785
794
|
};
|
|
786
|
-
V(
|
|
787
|
-
const
|
|
788
|
-
const
|
|
789
|
-
if (!
|
|
795
|
+
V(lt.join(","), { keydown: !0, keyup: !1 }, k);
|
|
796
|
+
const B = () => {
|
|
797
|
+
const h = o.getAnnotation(c.annotation);
|
|
798
|
+
if (!h) {
|
|
790
799
|
o.addAnnotation({
|
|
791
|
-
id:
|
|
800
|
+
id: c.annotation,
|
|
792
801
|
bodies: [],
|
|
793
|
-
target:
|
|
802
|
+
target: c
|
|
794
803
|
});
|
|
795
804
|
return;
|
|
796
805
|
}
|
|
797
|
-
const { target: { updated:
|
|
798
|
-
(!
|
|
806
|
+
const { target: { updated: T } } = h, { updated: O } = c;
|
|
807
|
+
(!T || !O || T < O) && o.updateTarget(c);
|
|
799
808
|
};
|
|
800
|
-
return
|
|
809
|
+
return t.addEventListener("pointerdown", g), document.addEventListener("pointerup", d), document.addEventListener("contextmenu", w), t.addEventListener("keyup", v), t.addEventListener("selectstart", m), document.addEventListener("selectionchange", l), {
|
|
801
810
|
destroy: () => {
|
|
802
|
-
|
|
811
|
+
c = void 0, x = void 0, A = void 0, l.clear(), t.removeEventListener("pointerdown", g), document.removeEventListener("pointerup", d), document.removeEventListener("contextmenu", w), t.removeEventListener("keyup", v), t.removeEventListener("selectstart", m), document.removeEventListener("selectionchange", l), V.unbind();
|
|
803
812
|
},
|
|
804
|
-
setFilter:
|
|
813
|
+
setFilter: p,
|
|
805
814
|
setUser: b,
|
|
806
|
-
setAnnotatingEnabled:
|
|
815
|
+
setAnnotatingEnabled: E
|
|
807
816
|
};
|
|
808
|
-
},
|
|
817
|
+
}, fe = (t, n) => ({
|
|
809
818
|
...t,
|
|
810
819
|
annotatingEnabled: t.annotatingEnabled ?? n.annotatingEnabled,
|
|
811
820
|
user: t.user || n.user
|
|
812
|
-
}),
|
|
813
|
-
Tt(t),
|
|
814
|
-
const e =
|
|
821
|
+
}), nt = "SPANS", xe = (t, n = {}) => {
|
|
822
|
+
Tt(t), kt(t);
|
|
823
|
+
const e = fe(n, {
|
|
815
824
|
annotatingEnabled: !0,
|
|
816
|
-
user:
|
|
817
|
-
}), o =
|
|
818
|
-
let
|
|
819
|
-
const
|
|
820
|
-
if (!
|
|
821
|
-
throw `Unknown renderer implementation: ${
|
|
822
|
-
console.debug(`Using ${
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
|
|
825
|
+
user: St()
|
|
826
|
+
}), o = ae(t, e), { selection: s, viewport: r } = o, i = o.store, a = Ct(i), u = Et(o, a, e.adapter);
|
|
827
|
+
let S = e.user;
|
|
828
|
+
const b = e.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : nt : e.renderer || nt, f = b === "SPANS" ? ee(t, o, r) : b === "CSS_HIGHLIGHTS" ? Zt(t, o, r) : b === "CANVAS" ? jt(t, o, r) : void 0;
|
|
829
|
+
if (!f)
|
|
830
|
+
throw `Unknown renderer implementation: ${b}`;
|
|
831
|
+
console.debug(`Using ${b} renderer`), e.style && f.setStyle(e.style);
|
|
832
|
+
const p = ue(t, o, e);
|
|
833
|
+
p.setUser(S), p.setAnnotatingEnabled(e.annotatingEnabled);
|
|
834
|
+
const c = wt(o, a, e.adapter), x = () => S, A = (d) => {
|
|
835
|
+
p.setAnnotatingEnabled(
|
|
836
|
+
d === void 0 ? !0 : d
|
|
828
837
|
);
|
|
829
|
-
},
|
|
830
|
-
|
|
831
|
-
},
|
|
832
|
-
|
|
833
|
-
}, m = (
|
|
834
|
-
|
|
835
|
-
},
|
|
836
|
-
|
|
838
|
+
}, R = (d) => {
|
|
839
|
+
f.setFilter(d), p.setFilter(d);
|
|
840
|
+
}, E = (d) => {
|
|
841
|
+
S = d, p.setUser(d);
|
|
842
|
+
}, m = (d) => {
|
|
843
|
+
d && (f.setPainter(le(d, e.presence)), d.on("selectionChange", () => f.redraw()));
|
|
844
|
+
}, l = (d) => {
|
|
845
|
+
d ? s.setSelected(d) : s.clear();
|
|
837
846
|
};
|
|
838
847
|
return {
|
|
839
|
-
...
|
|
848
|
+
...c,
|
|
840
849
|
destroy: () => {
|
|
841
|
-
|
|
850
|
+
f.destroy(), p.destroy(), a.destroy();
|
|
842
851
|
},
|
|
843
852
|
element: t,
|
|
844
|
-
getUser:
|
|
845
|
-
setAnnotatingEnabled:
|
|
846
|
-
setFilter:
|
|
847
|
-
setStyle:
|
|
848
|
-
redraw:
|
|
849
|
-
setUser:
|
|
850
|
-
setSelected:
|
|
853
|
+
getUser: x,
|
|
854
|
+
setAnnotatingEnabled: A,
|
|
855
|
+
setFilter: R,
|
|
856
|
+
setStyle: f.setStyle.bind(f),
|
|
857
|
+
redraw: f.redraw.bind(f),
|
|
858
|
+
setUser: E,
|
|
859
|
+
setSelected: l,
|
|
851
860
|
setPresenceProvider: m,
|
|
852
|
-
setVisible:
|
|
861
|
+
setVisible: f.setVisible.bind(f),
|
|
853
862
|
on: u.on,
|
|
854
863
|
off: u.off,
|
|
855
|
-
scrollIntoView:
|
|
864
|
+
scrollIntoView: Ut(t, i),
|
|
856
865
|
state: o
|
|
857
866
|
};
|
|
858
867
|
};
|
|
859
868
|
export {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
869
|
+
q as DEFAULT_SELECTED_STYLE,
|
|
870
|
+
P as DEFAULT_STYLE,
|
|
871
|
+
rt as NOT_ANNOTATABLE_CLASS,
|
|
872
|
+
_ as NOT_ANNOTATABLE_SELECTOR,
|
|
873
|
+
Le as Origin,
|
|
874
|
+
ke as UserSelectAction,
|
|
875
|
+
ve as W3CTextFormat,
|
|
867
876
|
Tt as cancelSingleClickEvents,
|
|
868
877
|
Y as cloneKeyboardEvent,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
878
|
+
Q as clonePointerEvent,
|
|
879
|
+
Ne as createBody,
|
|
880
|
+
jt as createCanvasRenderer,
|
|
881
|
+
Zt as createHighlightsRenderer,
|
|
882
|
+
le as createPresencePainter,
|
|
883
|
+
Qt as createRenderer,
|
|
884
|
+
ue as createSelectionHandler,
|
|
885
|
+
ee as createSpansRenderer,
|
|
886
|
+
xe as createTextAnnotator,
|
|
887
|
+
ae as createTextAnnotatorState,
|
|
888
|
+
fe as fillDefaults,
|
|
889
|
+
Ot as getQuoteContext,
|
|
890
|
+
Z as getRangeAnnotatableContents,
|
|
891
|
+
Lt as isMac,
|
|
892
|
+
U as isNotAnnotatable,
|
|
893
|
+
Rt as isRangeAnnotatable,
|
|
885
894
|
M as isRevived,
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
895
|
+
Mt as isWhitespaceOrEmpty,
|
|
896
|
+
Dt as mergeClientRects,
|
|
897
|
+
Wt as paint,
|
|
898
|
+
se as parseW3CTextAnnotation,
|
|
899
|
+
kt as programmaticallyFocusable,
|
|
891
900
|
$t as rangeContains,
|
|
892
901
|
Kt as rangeToSelector,
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
902
|
+
G as reviveAnnotation,
|
|
903
|
+
it as reviveSelector,
|
|
904
|
+
z as reviveTarget,
|
|
905
|
+
Ut as scrollIntoView,
|
|
906
|
+
re as serializeW3CTextAnnotation,
|
|
898
907
|
Bt as splitAnnotatableRanges,
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
908
|
+
we as toDomRectList,
|
|
909
|
+
Ft as toParentBounds,
|
|
910
|
+
Ae as toViewportBounds,
|
|
902
911
|
_t as trimRangeToContainer,
|
|
903
|
-
|
|
912
|
+
It as whitespaceOrEmptyRegex
|
|
904
913
|
};
|
|
905
914
|
//# sourceMappingURL=text-annotator.es.js.map
|