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