@recogito/text-annotator 3.4.8 → 3.4.9
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.
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { UAParser as
|
|
2
|
-
import { OS as
|
|
3
|
-
import
|
|
4
|
-
import { UserSelectAction as
|
|
5
|
-
import { Origin as Ft, UserSelectAction as
|
|
1
|
+
import { UAParser as be } from "ua-parser-js";
|
|
2
|
+
import { OS as Ee } from "ua-parser-js/enums";
|
|
3
|
+
import le from "debounce";
|
|
4
|
+
import { UserSelectAction as Ce, serializeW3CBodies as Se, parseW3CBodies as Ae, parseW3CUser as we, createStore as Re, createSelectionState as Te, createHoverState as ve, createViewportState as xe, Origin as K, createAnonymousGuest as Le, createUndoStack as Ne, createLifecycleObserver as Oe, createBaseAnnotator as Be } from "@annotorious/core";
|
|
5
|
+
import { Origin as Ft, UserSelectAction as Vt, createBody as Yt } from "@annotorious/core";
|
|
6
6
|
import { colord as ne } from "colord";
|
|
7
|
-
import { dequal as
|
|
8
|
-
import { v4 as
|
|
9
|
-
import
|
|
10
|
-
import { createNanoEvents as
|
|
11
|
-
import
|
|
12
|
-
import { poll as
|
|
13
|
-
const
|
|
7
|
+
import { dequal as ke } from "dequal/lite";
|
|
8
|
+
import { v4 as de } from "uuid";
|
|
9
|
+
import Me from "rbush";
|
|
10
|
+
import { createNanoEvents as Ie } from "nanoevents";
|
|
11
|
+
import q from "hotkeys-js";
|
|
12
|
+
import { poll as _e } from "poll";
|
|
13
|
+
const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t instanceof HTMLElement ? t.closest(W) : t.parentElement?.closest(W)) : !0, He = (e, t) => {
|
|
14
14
|
const n = t.commonAncestorContainer;
|
|
15
|
-
return !
|
|
16
|
-
},
|
|
15
|
+
return !G(e, n);
|
|
16
|
+
}, Pe = (e) => e.addEventListener("click", (t) => {
|
|
17
17
|
// Allow clicks within not-annotatable elements
|
|
18
18
|
!t.target.closest(W) && !t.target.closest("a") && t.preventDefault();
|
|
19
|
-
}),
|
|
19
|
+
}), J = (e) => ({
|
|
20
20
|
...e,
|
|
21
21
|
type: e.type,
|
|
22
22
|
x: e.x,
|
|
@@ -42,7 +42,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
42
42
|
pointerId: e.pointerId,
|
|
43
43
|
pointerType: e.pointerType,
|
|
44
44
|
timeStamp: e.timeStamp
|
|
45
|
-
}),
|
|
45
|
+
}), j = (e) => ({
|
|
46
46
|
...e,
|
|
47
47
|
type: e.type,
|
|
48
48
|
key: e.key,
|
|
@@ -58,9 +58,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
58
58
|
defaultPrevented: e.defaultPrevented,
|
|
59
59
|
detail: e.detail,
|
|
60
60
|
timeStamp: e.timeStamp
|
|
61
|
-
}),
|
|
61
|
+
}), ee = (e, t = 10) => {
|
|
62
|
+
let n;
|
|
63
|
+
return ((...r) => {
|
|
64
|
+
clearTimeout(n), n = setTimeout(() => e.apply(void 0, r), t);
|
|
65
|
+
});
|
|
66
|
+
}, De = be(), fe = De.os.is(Ee.MACOS), Ue = (e) => {
|
|
62
67
|
!e.hasAttribute("tabindex") && e.tabIndex < 0 && e.setAttribute("tabindex", "-1"), e.classList.add("no-focus-outline");
|
|
63
|
-
},
|
|
68
|
+
}, Ke = (e) => {
|
|
64
69
|
const t = [], n = document.createNodeIterator(
|
|
65
70
|
e.commonAncestorContainer,
|
|
66
71
|
NodeFilter.SHOW_TEXT
|
|
@@ -95,20 +100,20 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
95
100
|
...Array.from(c.getClientRects())
|
|
96
101
|
];
|
|
97
102
|
}
|
|
98
|
-
},
|
|
103
|
+
}, We = function* (e) {
|
|
99
104
|
const t = document.createNodeIterator(
|
|
100
105
|
e.commonAncestorContainer,
|
|
101
106
|
NodeFilter.SHOW_ELEMENT,
|
|
102
|
-
(r) => r instanceof HTMLElement && r.classList.contains(
|
|
107
|
+
(r) => r instanceof HTMLElement && r.classList.contains(ue) && !r.parentElement.closest(W) && e.intersectsNode(r) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
103
108
|
);
|
|
104
109
|
let n;
|
|
105
110
|
for (; n = t.nextNode(); )
|
|
106
111
|
n instanceof HTMLElement && (yield n);
|
|
107
|
-
},
|
|
108
|
-
if (!
|
|
112
|
+
}, $e = (e, t) => {
|
|
113
|
+
if (!He(e, t)) return [];
|
|
109
114
|
const n = [];
|
|
110
115
|
let r = null;
|
|
111
|
-
for (const s of
|
|
116
|
+
for (const s of We(t)) {
|
|
112
117
|
let o;
|
|
113
118
|
r ? (o = document.createRange(), o.setStartAfter(r), o.setEndBefore(s)) : (o = t.cloneRange(), o.setEndBefore(s)), o.collapsed || n.push(o), r = s;
|
|
114
119
|
}
|
|
@@ -130,7 +135,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
130
135
|
prefix: i.substring(i.length - n),
|
|
131
136
|
suffix: l.substring(0, n)
|
|
132
137
|
};
|
|
133
|
-
}, I = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed),
|
|
138
|
+
}, I = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), ge = /^\s*$/, Ve = (e) => ge.test(e.toString()), Ht = (e) => ge.test(e.textContent || ""), Ye = (e, t, n, r) => {
|
|
134
139
|
const s = (c) => Math.round(c * 10) / 10, o = {
|
|
135
140
|
top: s(e.top),
|
|
136
141
|
bottom: s(e.bottom),
|
|
@@ -154,17 +159,17 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
154
159
|
return "block-contains";
|
|
155
160
|
} else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
|
|
156
161
|
return "block-is-contained";
|
|
157
|
-
},
|
|
162
|
+
}, Xe = (e, t) => {
|
|
158
163
|
const n = Math.min(e.left, t.left), r = Math.max(e.right, t.right), s = Math.min(e.top, t.top), o = Math.max(e.bottom, t.bottom);
|
|
159
164
|
return new DOMRect(n, s, r - n, o - s);
|
|
160
|
-
},
|
|
165
|
+
}, ze = (e, t = 0.5, n = 0.5) => e.reduce((r, s) => {
|
|
161
166
|
if (s.width === 0 || s.height === 0)
|
|
162
167
|
return r;
|
|
163
168
|
let o = [...r], i = !1;
|
|
164
169
|
for (const c of r) {
|
|
165
|
-
const l =
|
|
170
|
+
const l = Ye(s, c, t, n);
|
|
166
171
|
if (l === "inline-adjacent") {
|
|
167
|
-
o = o.map((f) => f === c ?
|
|
172
|
+
o = o.map((f) => f === c ? Xe(s, c) : f), i = !0;
|
|
168
173
|
break;
|
|
169
174
|
} else if (l === "inline-contains") {
|
|
170
175
|
o = o.map((f) => f === c ? s : f), i = !0;
|
|
@@ -178,14 +183,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
return i ? o : [...o, s];
|
|
181
|
-
}, []),
|
|
186
|
+
}, []), Pt = (e) => ({
|
|
182
187
|
length: e.length,
|
|
183
188
|
item: (t) => e[t],
|
|
184
189
|
[Symbol.iterator]: function* () {
|
|
185
190
|
for (let t = 0; t < this.length; t++)
|
|
186
191
|
yield this.item(t);
|
|
187
192
|
}
|
|
188
|
-
}),
|
|
193
|
+
}), qe = (e) => {
|
|
189
194
|
if (e.length === 0) return [];
|
|
190
195
|
if (e.length === 1) return [e[0]];
|
|
191
196
|
e.sort((s, o) => {
|
|
@@ -194,18 +199,18 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
194
199
|
});
|
|
195
200
|
const [t, ...n] = e, r = n.reduce((s, o) => s.current.compareBoundaryPoints(Range.START_TO_END, o) >= 0 ? (s.current.compareBoundaryPoints(Range.END_TO_END, o) < 0 && s.current.setEnd(o.endContainer, o.endOffset), s) : (s.merged.push(s.current), s.current = o.cloneRange(), s), { merged: [], current: t.cloneRange() });
|
|
196
201
|
return [...r.merged, r.current];
|
|
197
|
-
},
|
|
202
|
+
}, je = (e, t, n) => {
|
|
198
203
|
const r = document.createRange(), s = n ? e.startContainer.parentElement.closest(n) : t;
|
|
199
204
|
r.setStart(s, 0), r.setEnd(e.startContainer, e.startOffset);
|
|
200
205
|
const o = oe(r).textContent, i = e.toString(), c = o.length || 0, l = c + i.length;
|
|
201
206
|
return n ? { quote: i, start: c, end: l, range: e, offsetReference: s } : { quote: i, start: c, end: l, range: e };
|
|
202
|
-
},
|
|
207
|
+
}, Ge = (e, t) => {
|
|
203
208
|
const { left: n, top: r, right: s, bottom: o } = e;
|
|
204
209
|
return new DOMRect(n - t.left, r - t.top, s - n, o - r);
|
|
205
|
-
},
|
|
210
|
+
}, Dt = (e, t) => {
|
|
206
211
|
const { left: n, top: r, right: s, bottom: o } = e;
|
|
207
212
|
return new DOMRect(n + t.left, r + t.top, s - n, o - r);
|
|
208
|
-
},
|
|
213
|
+
}, me = (e, t) => {
|
|
209
214
|
const { start: n, end: r } = e, s = e.offsetReference || t, o = document.createNodeIterator(
|
|
210
215
|
t,
|
|
211
216
|
NodeFilter.SHOW_TEXT,
|
|
@@ -239,22 +244,22 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
239
244
|
...e,
|
|
240
245
|
range: c
|
|
241
246
|
};
|
|
242
|
-
},
|
|
247
|
+
}, Q = (e, t) => I(e.selector) ? e : {
|
|
243
248
|
...e,
|
|
244
|
-
selector: e.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
245
|
-
}, te = (e, t) => I(e.target.selector) ? e : { ...e, target:
|
|
249
|
+
selector: e.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : me(n, t))
|
|
250
|
+
}, te = (e, t) => I(e.target.selector) ? e : { ...e, target: Q(e.target, t) }, Qe = (e, t) => {
|
|
246
251
|
const n = e.cloneRange();
|
|
247
252
|
return t.contains(n.startContainer) || n.setStart(t, 0), t.contains(n.endContainer) || n.setEnd(t, t.childNodes.length), n;
|
|
248
|
-
},
|
|
253
|
+
}, pe = (e) => {
|
|
249
254
|
if (!e)
|
|
250
255
|
return document.scrollingElement;
|
|
251
256
|
const { overflowY: t } = window.getComputedStyle(e);
|
|
252
|
-
return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e :
|
|
257
|
+
return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : pe(e.parentElement);
|
|
253
258
|
}, ie = (e, t, n) => {
|
|
254
259
|
const r = n.getBoundingClientRect(), s = n.clientHeight, o = n.clientWidth, i = t.selector[0].range.getBoundingClientRect(), { width: c, height: l } = e.getAnnotationBounds(t.annotation), f = i.top - r.top, d = i.left - r.left, u = n.parentElement ? n.scrollTop : 0, y = n.parentElement ? n.scrollLeft : 0, w = f + u - (s - l) / 2, g = d + y - (o - c) / 2;
|
|
255
260
|
n.scroll({ top: w, left: g, behavior: "smooth" });
|
|
256
|
-
},
|
|
257
|
-
const s = typeof n == "string" ? n : n.id, o = r ? typeof r == "string" ? document.getElementById(r) : r :
|
|
261
|
+
}, Ze = (e, t) => (n, r) => {
|
|
262
|
+
const s = typeof n == "string" ? n : n.id, o = r ? typeof r == "string" ? document.getElementById(r) : r : pe(e);
|
|
258
263
|
if (!o)
|
|
259
264
|
return console.warn(`The scroll parent is missing for the annotation: ${s}`, { container: e }), !1;
|
|
260
265
|
const i = t.getAnnotation(s);
|
|
@@ -263,18 +268,18 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
263
268
|
const { range: c } = i.target.selector[0];
|
|
264
269
|
if (c && !c.collapsed)
|
|
265
270
|
return ie(t, i.target, o), !0;
|
|
266
|
-
const l =
|
|
271
|
+
const l = Q(i.target, e), { range: f } = l.selector[0];
|
|
267
272
|
return f && !f.collapsed ? (ie(t, l, o), !0) : !1;
|
|
268
273
|
}, _ = {
|
|
269
274
|
fill: "rgb(0, 128, 255)",
|
|
270
275
|
fillOpacity: 0.18
|
|
271
|
-
},
|
|
276
|
+
}, Z = {
|
|
272
277
|
fill: "rgb(0, 128, 255)",
|
|
273
278
|
fillOpacity: 0.45
|
|
274
|
-
},
|
|
279
|
+
}, Je = (e) => {
|
|
275
280
|
const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: r, innerHeight: s } = window, o = -n, i = -t, c = r - n, l = s - t;
|
|
276
281
|
return { top: t, left: n, minX: o, minY: i, maxX: c, maxY: l };
|
|
277
|
-
},
|
|
282
|
+
}, et = (e) => {
|
|
278
283
|
let t = /* @__PURE__ */ new Set();
|
|
279
284
|
return (r) => {
|
|
280
285
|
const s = r.map((o) => o.id);
|
|
@@ -283,22 +288,22 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
283
288
|
}, se = (e, t, n, r) => {
|
|
284
289
|
const { store: s, selection: o, hover: i } = t;
|
|
285
290
|
let c, l, f;
|
|
286
|
-
const d =
|
|
291
|
+
const d = et(n), u = (A) => {
|
|
287
292
|
const { x: v, y: N } = e.getBoundingClientRect(), O = s.getAt(A.clientX - v, A.clientY - N, !1, l);
|
|
288
|
-
O && t.selection.evalSelectAction(O) !==
|
|
293
|
+
O && t.selection.evalSelectAction(O) !== Ce.NONE ? i.current !== O.id && (e.classList.add("hovered"), i.set(O.id)) : i.current && (e.classList.remove("hovered"), i.set(null));
|
|
289
294
|
};
|
|
290
295
|
e.addEventListener("pointermove", u);
|
|
291
|
-
const y =
|
|
296
|
+
const y = ee((A = !1) => requestAnimationFrame(() => {
|
|
292
297
|
f && f.clear();
|
|
293
|
-
const v =
|
|
294
|
-
const k =
|
|
298
|
+
const v = Je(e), { minX: N, minY: O, maxX: D, maxY: Y } = v, X = l ? s.getIntersecting(N, O, D, Y).filter(({ annotation: h }) => l(h)) : s.getIntersecting(N, O, D, Y), $ = o.selected.map(({ id: h }) => h), re = X.map(({ annotation: h, rects: T }) => {
|
|
299
|
+
const k = $.includes(h.id), U = h.id === i.current;
|
|
295
300
|
return {
|
|
296
301
|
annotation: h,
|
|
297
302
|
rects: T,
|
|
298
303
|
state: { selected: k, hovered: U }
|
|
299
304
|
};
|
|
300
305
|
});
|
|
301
|
-
r.redraw(re, v, c, f, A), setTimeout(() => d(
|
|
306
|
+
r.redraw(re, v, c, f, A), setTimeout(() => d(X.map(({ annotation: h }) => h)), 1);
|
|
302
307
|
}), 10), w = (A) => {
|
|
303
308
|
f = A, y();
|
|
304
309
|
}, g = (A) => {
|
|
@@ -309,18 +314,18 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
309
314
|
s.observe(R);
|
|
310
315
|
const b = o.subscribe(() => y()), p = i.subscribe(() => y()), S = () => y(!0);
|
|
311
316
|
document.addEventListener("scroll", S, { capture: !0, passive: !0 });
|
|
312
|
-
const E =
|
|
317
|
+
const E = ee(() => {
|
|
313
318
|
s.recalculatePositions(), f?.reset(), y();
|
|
314
319
|
}, 10);
|
|
315
320
|
window.addEventListener("resize", E);
|
|
316
321
|
const m = new ResizeObserver(E);
|
|
317
322
|
m.observe(e);
|
|
318
|
-
const a = { attributes: !0, childList: !0, subtree: !0 }, C = new MutationObserver(
|
|
323
|
+
const a = { attributes: !0, childList: !0, subtree: !0 }, C = new MutationObserver(ee((A) => {
|
|
319
324
|
A.every((N) => N.target === e || e.contains(N.target)) || y(!0);
|
|
320
325
|
}, 150));
|
|
321
326
|
return C.observe(document.body, a), {
|
|
322
327
|
destroy: () => {
|
|
323
|
-
e.removeEventListener("pointermove", u), r.destroy(), s.unobserve(R), b(), p(), document.removeEventListener("scroll", S),
|
|
328
|
+
e.removeEventListener("pointermove", u), r.destroy(), s.unobserve(R), b(), p(), document.removeEventListener("scroll", S), window.removeEventListener("resize", E), m.disconnect(), C.disconnect();
|
|
324
329
|
},
|
|
325
330
|
redraw: y,
|
|
326
331
|
setStyle: g,
|
|
@@ -328,14 +333,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
328
333
|
setPainter: w,
|
|
329
334
|
setVisible: r.setVisible
|
|
330
335
|
};
|
|
331
|
-
},
|
|
336
|
+
}, tt = () => {
|
|
332
337
|
const e = document.createElement("canvas");
|
|
333
338
|
return e.width = window.innerWidth, e.height = window.innerHeight, e.className = "r6o-canvas-highlight-layer bg", e;
|
|
334
|
-
},
|
|
339
|
+
}, nt = (e, t) => {
|
|
335
340
|
e.width = window.innerWidth, e.height = window.innerHeight;
|
|
336
|
-
},
|
|
341
|
+
}, ot = (e) => {
|
|
337
342
|
console.warn('WARNING! Canvas renderer is deprecated and will be removed in the next major release. Please use the default "SPANS" renderer instead.'), e.classList.add("r6o-annotatable");
|
|
338
|
-
const t =
|
|
343
|
+
const t = tt(), n = t.getContext("2d");
|
|
339
344
|
document.body.appendChild(t);
|
|
340
345
|
const r = (c, l, f, d) => requestAnimationFrame(() => {
|
|
341
346
|
const { width: u, height: y } = t;
|
|
@@ -345,7 +350,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
345
350
|
const { annotation: { target: { created: p } } } = R, { annotation: { target: { created: S } } } = b;
|
|
346
351
|
return p.getTime() - S.getTime();
|
|
347
352
|
}).forEach((R) => {
|
|
348
|
-
const b = f ? typeof f == "function" ? f(R.annotation, R.state) : f : R.state?.selected ?
|
|
353
|
+
const b = f ? typeof f == "function" ? f(R.annotation, R.state) : f : R.state?.selected ? Z : _, p = d && d.paint(R, l) || b, S = R.rects.map(({ x: E, y: m, width: a, height: C }) => ({
|
|
349
354
|
x: E + g,
|
|
350
355
|
y: m + w,
|
|
351
356
|
width: a,
|
|
@@ -361,7 +366,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
361
366
|
});
|
|
362
367
|
}
|
|
363
368
|
});
|
|
364
|
-
}), s =
|
|
369
|
+
}), s = le(() => nt(t), 10);
|
|
365
370
|
return window.addEventListener("resize", s), {
|
|
366
371
|
destroy: () => {
|
|
367
372
|
t.remove(), s.clear(), window.removeEventListener("resize", s);
|
|
@@ -371,13 +376,13 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
371
376
|
},
|
|
372
377
|
redraw: r
|
|
373
378
|
};
|
|
374
|
-
},
|
|
379
|
+
}, st = (e, t, n) => se(e, t, n, ot(e)), rt = (e) => [
|
|
375
380
|
`background-color:${ne(e?.fill || _.fill).alpha(e?.fillOpacity === void 0 ? _.fillOpacity : e.fillOpacity).toHex()}`,
|
|
376
381
|
e?.underlineThickness ? "text-decoration:underline" : void 0,
|
|
377
382
|
e?.underlineColor ? `text-decoration-color:${e.underlineColor}` : void 0,
|
|
378
383
|
e?.underlineOffset ? `text-underline-offset:${e.underlineOffset}px` : void 0,
|
|
379
384
|
e?.underlineThickness ? `text-decoration-thickness:${e.underlineThickness}px` : void 0
|
|
380
|
-
].filter(Boolean).join(";"),
|
|
385
|
+
].filter(Boolean).join(";"), it = () => {
|
|
381
386
|
const e = document.createElement("style");
|
|
382
387
|
document.getElementsByTagName("head")[0].appendChild(e);
|
|
383
388
|
let t = /* @__PURE__ */ new Set();
|
|
@@ -393,8 +398,8 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
393
398
|
const f = new Set(o.map((u) => u.annotation.id));
|
|
394
399
|
Array.from(t).filter((u) => !f.has(u));
|
|
395
400
|
const d = o.map((u) => {
|
|
396
|
-
const y = c ? typeof c == "function" ? c(u.annotation, u.state) : c : u.state?.selected ?
|
|
397
|
-
return `::highlight(_${u.annotation.id}) { ${
|
|
401
|
+
const y = c ? typeof c == "function" ? c(u.annotation, u.state) : c : u.state?.selected ? Z : _, w = l && l.paint(u, i) || y;
|
|
402
|
+
return `::highlight(_${u.annotation.id}) { ${rt(w)} }`;
|
|
398
403
|
});
|
|
399
404
|
e.innerHTML = d.join(`
|
|
400
405
|
`), CSS.highlights.clear(), o.forEach(({ annotation: u }) => {
|
|
@@ -403,13 +408,13 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
403
408
|
}), t = f;
|
|
404
409
|
}
|
|
405
410
|
};
|
|
406
|
-
},
|
|
407
|
-
const o = n ? typeof n == "function" ? n(e.annotation, e.state, s) || (e.state?.selected ?
|
|
411
|
+
}, at = (e, t, n) => se(e, t, n, it()), ct = (e) => e?.fillOpacity !== void 0 ? ne(e?.fill || _.fill).alpha(e.fillOpacity).toHex() : e?.fill ? e.fill : ne(_.fill).alpha(_.fillOpacity).toHex(), lt = (e, t, n, r, s) => {
|
|
412
|
+
const o = n ? typeof n == "function" ? n(e.annotation, e.state, s) || (e.state?.selected ? Z : _) : n : e.state?.selected ? Z : _;
|
|
408
413
|
return r && r.paint(e, t) || o;
|
|
409
|
-
},
|
|
414
|
+
}, dt = (e, t) => {
|
|
410
415
|
const n = (o, i) => o.x <= i.x + i.width && o.x + o.width >= i.x && o.y <= i.y + i.height && o.y + o.height >= i.y, r = (o) => o.rects.reduce((i, c) => i + c.width, 0), s = t.filter(({ rects: o }) => o.some((i) => n(e, i)));
|
|
411
416
|
return s.sort((o, i) => r(i) - r(o)), s.findIndex((o) => o.rects.includes(e));
|
|
412
|
-
},
|
|
417
|
+
}, ut = (e) => {
|
|
413
418
|
e.classList.add("r6o-annotatable");
|
|
414
419
|
const t = document.createElement("div");
|
|
415
420
|
t.className = "r6o-span-highlight-layer", e.insertBefore(t, e.firstChild);
|
|
@@ -419,17 +424,17 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
419
424
|
t.remove();
|
|
420
425
|
},
|
|
421
426
|
redraw: (i, c, l, f, d) => {
|
|
422
|
-
const y = !(
|
|
427
|
+
const y = !(ke(n, i) && d);
|
|
423
428
|
if (!f && !y) return;
|
|
424
429
|
y && (t.innerHTML = ""), [...i].sort((g, x) => {
|
|
425
430
|
const { annotation: { target: { created: R } } } = g, { annotation: { target: { created: b } } } = x;
|
|
426
431
|
return R && b ? R.getTime() - b.getTime() : 0;
|
|
427
432
|
}).forEach((g) => {
|
|
428
433
|
g.rects.map((x) => {
|
|
429
|
-
const R =
|
|
434
|
+
const R = dt(x, i), b = lt(g, c, l, f, R);
|
|
430
435
|
if (y) {
|
|
431
436
|
const p = document.createElement("span");
|
|
432
|
-
p.className = "r6o-annotation", p.dataset.annotation = g.annotation.id, p.style.left = `${x.x}px`, p.style.top = `${x.y}px`, p.style.width = `${x.width}px`, p.style.height = `${x.height}px`, p.style.backgroundColor =
|
|
437
|
+
p.className = "r6o-annotation", p.dataset.annotation = g.annotation.id, p.style.left = `${x.x}px`, p.style.top = `${x.y}px`, p.style.width = `${x.width}px`, p.style.height = `${x.height}px`, p.style.backgroundColor = ct(b), b.underlineStyle && (p.style.borderStyle = b.underlineStyle), b.underlineColor && (p.style.borderColor = b.underlineColor), b.underlineThickness && (p.style.borderBottomWidth = `${b.underlineThickness}px`), b.underlineOffset && (p.style.paddingBottom = `${b.underlineOffset}px`), t.appendChild(p);
|
|
433
438
|
}
|
|
434
439
|
});
|
|
435
440
|
}), n = i;
|
|
@@ -438,10 +443,10 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
438
443
|
i ? t.classList.remove("hidden") : t.classList.add("hidden");
|
|
439
444
|
}
|
|
440
445
|
};
|
|
441
|
-
},
|
|
442
|
-
parse: (n) =>
|
|
443
|
-
serialize: (n) =>
|
|
444
|
-
}),
|
|
446
|
+
}, ft = (e, t, n) => se(e, t, n, ut(e)), Ut = (e, t) => ({
|
|
447
|
+
parse: (n) => pt(n),
|
|
448
|
+
serialize: (n) => ht(n, e, t)
|
|
449
|
+
}), gt = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, mt = (e) => {
|
|
445
450
|
const {
|
|
446
451
|
id: t,
|
|
447
452
|
creator: n,
|
|
@@ -452,7 +457,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
452
457
|
if (i.length === 0)
|
|
453
458
|
return { error: Error(`No targets found for annotation: ${e.id}`) };
|
|
454
459
|
const c = {
|
|
455
|
-
creator:
|
|
460
|
+
creator: we(n),
|
|
456
461
|
created: r ? new Date(r) : void 0,
|
|
457
462
|
updated: s ? new Date(s) : void 0,
|
|
458
463
|
annotation: t,
|
|
@@ -472,7 +477,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
472
477
|
}
|
|
473
478
|
return u;
|
|
474
479
|
}, {});
|
|
475
|
-
if (
|
|
480
|
+
if (gt(d))
|
|
476
481
|
c.selector.push(
|
|
477
482
|
{
|
|
478
483
|
...d,
|
|
@@ -490,14 +495,14 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
490
495
|
}
|
|
491
496
|
}
|
|
492
497
|
return { parsed: c };
|
|
493
|
-
},
|
|
494
|
-
const t = e.id ||
|
|
498
|
+
}, pt = (e) => {
|
|
499
|
+
const t = e.id || de(), {
|
|
495
500
|
creator: n,
|
|
496
501
|
created: r,
|
|
497
502
|
modified: s,
|
|
498
503
|
body: o,
|
|
499
504
|
...i
|
|
500
|
-
} = e, c =
|
|
505
|
+
} = e, c = Ae(o, t), l = mt(e);
|
|
501
506
|
return "error" in l ? { error: l.error } : {
|
|
502
507
|
parsed: {
|
|
503
508
|
...i,
|
|
@@ -506,7 +511,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
506
511
|
target: l.parsed
|
|
507
512
|
}
|
|
508
513
|
};
|
|
509
|
-
},
|
|
514
|
+
}, ht = (e, t, n) => {
|
|
510
515
|
const { bodies: r, target: s, ...o } = e, {
|
|
511
516
|
selector: i,
|
|
512
517
|
creator: c,
|
|
@@ -541,19 +546,19 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
541
546
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
542
547
|
id: e.id,
|
|
543
548
|
type: "Annotation",
|
|
544
|
-
body:
|
|
549
|
+
body: Se(e.bodies),
|
|
545
550
|
creator: c,
|
|
546
551
|
created: l?.toISOString(),
|
|
547
552
|
modified: f?.toISOString(),
|
|
548
553
|
target: u
|
|
549
554
|
};
|
|
550
|
-
},
|
|
555
|
+
}, yt = () => {
|
|
551
556
|
const e = document.createElement("canvas");
|
|
552
557
|
e.width = 2 * window.innerWidth, e.height = 2 * window.innerHeight, e.className = "r6o-presence-layer";
|
|
553
558
|
const t = e.getContext("2d");
|
|
554
559
|
return t.scale(2, 2), t.translate(0.5, 0.5), e;
|
|
555
|
-
},
|
|
556
|
-
const n =
|
|
560
|
+
}, bt = (e, t = {}) => {
|
|
561
|
+
const n = yt(), r = n.getContext("2d");
|
|
557
562
|
document.body.appendChild(n);
|
|
558
563
|
const s = /* @__PURE__ */ new Map(), o = (d) => Array.from(s.entries()).filter(([u, y]) => y.presenceKey === d.presenceKey).map(([u, y]) => u);
|
|
559
564
|
return e.on("selectionChange", (d, u) => {
|
|
@@ -585,12 +590,12 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
585
590
|
d.scale(2, 2), d.translate(0.5, 0.5);
|
|
586
591
|
}
|
|
587
592
|
};
|
|
588
|
-
},
|
|
589
|
-
const s = new
|
|
593
|
+
}, Et = (e, t, n, r) => {
|
|
594
|
+
const s = new Me(), o = /* @__PURE__ */ new Map(), i = Ie(), c = (m, a) => {
|
|
590
595
|
const C = m.selector.flatMap((A) => {
|
|
591
|
-
const v = I([A]) ? A.range :
|
|
592
|
-
return
|
|
593
|
-
}), L =
|
|
596
|
+
const v = I([A]) ? A.range : me(A, t).range;
|
|
597
|
+
return Ke(v);
|
|
598
|
+
}), L = ze(C, n, r).map((A) => Ge(A, a));
|
|
594
599
|
return L.map((A) => {
|
|
595
600
|
const { x: v, y: N, width: O, height: D } = A;
|
|
596
601
|
return {
|
|
@@ -667,8 +672,8 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
667
672
|
update: y,
|
|
668
673
|
on: (m, a) => i.on(m, a)
|
|
669
674
|
};
|
|
670
|
-
},
|
|
671
|
-
const n =
|
|
675
|
+
}, Ct = (e, t) => {
|
|
676
|
+
const n = Re(), r = Et(n, e, t.mergeHighlights?.horizontalTolerance, t.mergeHighlights?.verticalTolerance), s = Te(n, t.userSelectAction, t.adapter), o = ve(n), i = xe(), c = (p, S = K.LOCAL) => {
|
|
672
677
|
const E = te(p, e), m = I(E.target.selector);
|
|
673
678
|
return m && n.addAnnotation(E, S), m;
|
|
674
679
|
}, l = (p, S = !0, E = K.LOCAL) => {
|
|
@@ -680,10 +685,10 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
680
685
|
n.getAnnotation(a.id) ? n.updateAnnotation(a, S) : n.addAnnotation(a, S);
|
|
681
686
|
}), m;
|
|
682
687
|
}, d = (p, S = K.LOCAL) => {
|
|
683
|
-
const E =
|
|
688
|
+
const E = Q(p, e);
|
|
684
689
|
n.updateTarget(E, S);
|
|
685
690
|
}, u = (p, S = K.LOCAL) => {
|
|
686
|
-
const E = p.map((m) =>
|
|
691
|
+
const E = p.map((m) => Q(m, e));
|
|
687
692
|
n.bulkUpdateTargets(E, S);
|
|
688
693
|
};
|
|
689
694
|
function y(p, S, E, m) {
|
|
@@ -714,10 +719,10 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
714
719
|
hover: o,
|
|
715
720
|
viewport: i
|
|
716
721
|
};
|
|
717
|
-
}, ae = 300,
|
|
718
|
-
...
|
|
719
|
-
|
|
720
|
-
],
|
|
722
|
+
}, ae = 300, he = ["up", "down", "left", "right"], ye = fe ? "⌘+a" : "ctrl+a", St = [
|
|
723
|
+
...he.map((e) => `shift+${e}`),
|
|
724
|
+
ye
|
|
725
|
+
], At = (e, t, n, r) => {
|
|
721
726
|
const { store: s, selection: o } = t;
|
|
722
727
|
let i;
|
|
723
728
|
const {
|
|
@@ -734,7 +739,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
734
739
|
return !0;
|
|
735
740
|
if (r.allowModifierSelect) {
|
|
736
741
|
const T = h;
|
|
737
|
-
return
|
|
742
|
+
return fe ? T.metaKey : T.ctrlKey;
|
|
738
743
|
} else
|
|
739
744
|
return !1;
|
|
740
745
|
}, C = () => {
|
|
@@ -755,12 +760,12 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
755
760
|
}
|
|
756
761
|
}
|
|
757
762
|
x = void 0, g = {
|
|
758
|
-
annotation:
|
|
763
|
+
annotation: de(),
|
|
759
764
|
selector: [],
|
|
760
765
|
created: /* @__PURE__ */ new Date(),
|
|
761
766
|
creator: i
|
|
762
767
|
};
|
|
763
|
-
}, L =
|
|
768
|
+
}, L = le((h) => {
|
|
764
769
|
if (!y) return;
|
|
765
770
|
const T = document.getSelection();
|
|
766
771
|
if (!T?.anchorNode) return;
|
|
@@ -774,26 +779,26 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
774
779
|
s.getAnnotation(g.annotation) && !(a(b) || w === "REPLACE_CURRENT") && (o.clear(), s.deleteAnnotation(g.annotation));
|
|
775
780
|
return;
|
|
776
781
|
}
|
|
777
|
-
const H = k.map((B) =>
|
|
778
|
-
if (H.every((B) =>
|
|
779
|
-
const M = H.flatMap((B) =>
|
|
780
|
-
if (!(M.length > 0 && !g || M.length !== g.selector.length || M.some((B,
|
|
781
|
-
const
|
|
782
|
+
const H = k.map((B) => Qe(B, e));
|
|
783
|
+
if (H.every((B) => Ve(B))) return;
|
|
784
|
+
const M = H.flatMap((B) => $e(e, B.cloneRange()));
|
|
785
|
+
if (!(M.length > 0 && !g || M.length !== g.selector.length || M.some((B, F) => B.toString() !== g.selector[F]?.quote))) return;
|
|
786
|
+
const z = a(b) && x ? qe([
|
|
782
787
|
...x.selector.map((B) => B.range),
|
|
783
788
|
...M
|
|
784
789
|
]) : M;
|
|
785
790
|
g = {
|
|
786
791
|
...g,
|
|
787
|
-
selector:
|
|
792
|
+
selector: z.map((B) => je(B, e, l)),
|
|
788
793
|
updated: /* @__PURE__ */ new Date()
|
|
789
794
|
}, !(a(b) || w === "REPLACE_CURRENT") && (s.getAnnotation(g.annotation) ? s.updateTarget(g, K.LOCAL) : o.clear());
|
|
790
795
|
}, 10), A = (h) => {
|
|
791
|
-
b =
|
|
796
|
+
b = J(h), R = b.button === 0;
|
|
792
797
|
}, v = async (h) => {
|
|
793
798
|
if (!R) return;
|
|
794
|
-
const T =
|
|
799
|
+
const T = J(h), k = () => {
|
|
795
800
|
const { x: H, y: M } = e.getBoundingClientRect();
|
|
796
|
-
if (
|
|
801
|
+
if (G(e, T.target)) {
|
|
797
802
|
(typeof d == "function" ? d(T, e) : d === "ALWAYS") && o.clear();
|
|
798
803
|
return;
|
|
799
804
|
}
|
|
@@ -804,49 +809,49 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
804
809
|
u
|
|
805
810
|
);
|
|
806
811
|
if (P) {
|
|
807
|
-
const { selected:
|
|
808
|
-
(B.size !==
|
|
812
|
+
const { selected: z } = o, B = new Set(z.map((V) => V.id)), F = Array.isArray(P) ? P.map((V) => V.id) : [P.id];
|
|
813
|
+
(B.size !== F.length || !F.every((V) => B.has(V))) && (n.emit("clickAnnotation", P), o.userSelect(F, T));
|
|
809
814
|
} else
|
|
810
815
|
o.clear();
|
|
811
816
|
};
|
|
812
817
|
if (T.timeStamp - b.timeStamp < ae) {
|
|
813
818
|
await N();
|
|
814
|
-
const H = document.getSelection(), M =
|
|
819
|
+
const H = document.getSelection(), M = G(e, b.target), P = G(e, T.target);
|
|
815
820
|
if (H?.isCollapsed || M && P) {
|
|
816
821
|
g = void 0, k();
|
|
817
822
|
return;
|
|
818
823
|
}
|
|
819
824
|
}
|
|
820
|
-
g && g.selector.length > 0 && (
|
|
825
|
+
g && g.selector.length > 0 && ($(), o.userSelect(g.annotation, T));
|
|
821
826
|
}, N = async () => {
|
|
822
827
|
const h = document.getSelection();
|
|
823
828
|
let T = !1, k = h?.isCollapsed;
|
|
824
829
|
const U = () => k || T, H = 1;
|
|
825
|
-
return setTimeout(() => T = !0, 50),
|
|
830
|
+
return setTimeout(() => T = !0, 50), _e(() => k = h?.isCollapsed, H, U);
|
|
826
831
|
}, O = (h) => {
|
|
827
|
-
document.getSelection()?.isCollapsed || ((!g || g.selector.length === 0) && L(h), g && (
|
|
832
|
+
document.getSelection()?.isCollapsed || ((!g || g.selector.length === 0) && L(h), g && ($(), o.userSelect(g.annotation, J(h))));
|
|
828
833
|
}, D = (h) => {
|
|
829
|
-
y && h.key === "Shift" && g && (document.getSelection().isCollapsed || (
|
|
830
|
-
},
|
|
834
|
+
y && h.key === "Shift" && g && (document.getSelection().isCollapsed || ($(), o.userSelect(g.annotation, j(h))));
|
|
835
|
+
}, Y = (h) => {
|
|
831
836
|
const T = () => setTimeout(() => {
|
|
832
837
|
g?.selector.length > 0 && (o.clear(), s.addAnnotation({
|
|
833
838
|
id: g.annotation,
|
|
834
839
|
bodies: [],
|
|
835
840
|
target: g
|
|
836
|
-
}), o.userSelect(g.annotation,
|
|
841
|
+
}), o.userSelect(g.annotation, j(h))), document.removeEventListener("selectionchange", T);
|
|
837
842
|
}, 100);
|
|
838
843
|
document.addEventListener("selectionchange", T), C();
|
|
839
844
|
};
|
|
840
|
-
|
|
841
|
-
h.repeat || (b =
|
|
842
|
-
}),
|
|
843
|
-
b =
|
|
845
|
+
q(St.join(","), { element: e, keydown: !0, keyup: !1 }, (h) => {
|
|
846
|
+
h.repeat || (b = j(h));
|
|
847
|
+
}), q(ye, { keydown: !0, keyup: !1 }, (h) => {
|
|
848
|
+
b = j(h), Y(h);
|
|
844
849
|
});
|
|
845
|
-
const
|
|
850
|
+
const X = (h) => {
|
|
846
851
|
h.repeat || h.target !== e && h.target !== document.body || (g = void 0, o.clear());
|
|
847
852
|
};
|
|
848
|
-
|
|
849
|
-
const
|
|
853
|
+
q(he.join(","), { keydown: !0, keyup: !1 }, X);
|
|
854
|
+
const $ = () => {
|
|
850
855
|
const h = s.getAnnotation(g.annotation);
|
|
851
856
|
if (!h)
|
|
852
857
|
s.addAnnotation({
|
|
@@ -861,31 +866,31 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
861
866
|
};
|
|
862
867
|
return document.addEventListener("pointerdown", A), document.addEventListener("pointerup", v), document.addEventListener("contextmenu", O), e.addEventListener("keyup", D), e.addEventListener("selectstart", C), document.addEventListener("selectionchange", L), {
|
|
863
868
|
destroy: () => {
|
|
864
|
-
g = void 0, x = void 0, R = void 0, b = void 0, L.clear(), document.removeEventListener("pointerdown", A), document.removeEventListener("pointerup", v), document.removeEventListener("contextmenu", O), e.removeEventListener("keyup", D), e.removeEventListener("selectstart", C), document.removeEventListener("selectionchange", L),
|
|
869
|
+
g = void 0, x = void 0, R = void 0, b = void 0, L.clear(), document.removeEventListener("pointerdown", A), document.removeEventListener("pointerup", v), document.removeEventListener("contextmenu", O), e.removeEventListener("keyup", D), e.removeEventListener("selectstart", C), document.removeEventListener("selectionchange", L), q.unbind();
|
|
865
870
|
},
|
|
866
871
|
setFilter: E,
|
|
867
872
|
setUser: m,
|
|
868
873
|
setAnnotatingEnabled: p,
|
|
869
874
|
setAnnotatingMode: S
|
|
870
875
|
};
|
|
871
|
-
},
|
|
876
|
+
}, wt = (e, t) => ({
|
|
872
877
|
...e,
|
|
873
878
|
annotatingEnabled: e.annotatingEnabled ?? t.annotatingEnabled,
|
|
874
879
|
user: e.user || t.user
|
|
875
|
-
}), ce = "SPANS",
|
|
876
|
-
|
|
877
|
-
const n =
|
|
880
|
+
}), ce = "SPANS", Kt = (e, t = {}) => {
|
|
881
|
+
Pe(e), Ue(e);
|
|
882
|
+
const n = wt(t, {
|
|
878
883
|
annotatingEnabled: !0,
|
|
879
|
-
user:
|
|
880
|
-
}), r =
|
|
884
|
+
user: Le()
|
|
885
|
+
}), r = Ct(e, n), { selection: s, viewport: o } = r, i = r.store, c = Ne(i), l = Oe(r, c, n.adapter);
|
|
881
886
|
let f = n.user;
|
|
882
|
-
const d = typeof n.renderer != "function" ? n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ce : n.renderer || ce : null, u = d === null ? n.renderer(e, r, o) : d === "SPANS" ?
|
|
887
|
+
const d = typeof n.renderer != "function" ? n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ce : n.renderer || ce : null, u = d === null ? n.renderer(e, r, o) : d === "SPANS" ? ft(e, r, o) : d === "CSS_HIGHLIGHTS" ? at(e, r, o) : d === "CANVAS" ? st(e, r, o) : void 0;
|
|
883
888
|
if (!u)
|
|
884
889
|
throw `Unknown renderer implementation: ${n.renderer}`;
|
|
885
890
|
console.debug(d ? `Using ${d} renderer` : "Using custom renderer implementation"), n.style && u.setStyle(n.style);
|
|
886
|
-
const y =
|
|
891
|
+
const y = At(e, r, l, n);
|
|
887
892
|
y.setUser(f);
|
|
888
|
-
const w =
|
|
893
|
+
const w = Be(r, c, n.adapter), g = () => f, x = (a) => {
|
|
889
894
|
y.setAnnotatingEnabled(
|
|
890
895
|
a === void 0 ? !0 : a
|
|
891
896
|
);
|
|
@@ -896,7 +901,7 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
896
901
|
}, p = (a) => {
|
|
897
902
|
f = a, y.setUser(a);
|
|
898
903
|
}, S = (a) => {
|
|
899
|
-
a && (u.setPainter(
|
|
904
|
+
a && (u.setPainter(bt(a, n.presence)), a.on("selectionChange", () => u.redraw()));
|
|
900
905
|
}, E = (a) => {
|
|
901
906
|
a ? s.setSelected(a) : s.clear();
|
|
902
907
|
};
|
|
@@ -918,60 +923,61 @@ const de = "not-annotatable", W = `.${de}`, Q = (e, t) => e.contains(t) ? !!(t i
|
|
|
918
923
|
setVisible: u.setVisible.bind(u),
|
|
919
924
|
on: l.on,
|
|
920
925
|
off: l.off,
|
|
921
|
-
scrollIntoView:
|
|
926
|
+
scrollIntoView: Ze(e, i),
|
|
922
927
|
state: r
|
|
923
928
|
};
|
|
924
929
|
};
|
|
925
930
|
export {
|
|
926
|
-
|
|
931
|
+
Z as DEFAULT_SELECTED_STYLE,
|
|
927
932
|
_ as DEFAULT_STYLE,
|
|
928
|
-
|
|
933
|
+
ue as NOT_ANNOTATABLE_CLASS,
|
|
929
934
|
W as NOT_ANNOTATABLE_SELECTOR,
|
|
930
935
|
Ft as Origin,
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
+
Vt as UserSelectAction,
|
|
937
|
+
Ut as W3CTextFormat,
|
|
938
|
+
Pe as cancelSingleClickEvents,
|
|
939
|
+
j as cloneKeyboardEvent,
|
|
940
|
+
J as clonePointerEvent,
|
|
936
941
|
se as createBaseRenderer,
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
942
|
+
Yt as createBody,
|
|
943
|
+
st as createCanvasRenderer,
|
|
944
|
+
at as createHighlightsRenderer,
|
|
945
|
+
bt as createPresencePainter,
|
|
946
|
+
it as createRenderer,
|
|
947
|
+
At as createSelectionHandler,
|
|
948
|
+
ft as createSpansRenderer,
|
|
949
|
+
Kt as createTextAnnotator,
|
|
950
|
+
Ct as createTextAnnotatorState,
|
|
951
|
+
ee as debounce,
|
|
952
|
+
wt as fillDefaults,
|
|
953
|
+
ct as getBackgroundColor,
|
|
954
|
+
Ke as getHighlightClientRects,
|
|
949
955
|
Fe as getQuoteContext,
|
|
950
956
|
oe as getRangeAnnotatableContents,
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
+
Je as getViewportBounds,
|
|
958
|
+
fe as isMac,
|
|
959
|
+
Ht as isNodeWhitespaceOrEmpty,
|
|
960
|
+
G as isNotAnnotatable,
|
|
961
|
+
He as isRangeAnnotatable,
|
|
962
|
+
Ve as isRangeWhitespaceOrEmpty,
|
|
957
963
|
I as isRevived,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
+
ze as mergeClientRects,
|
|
965
|
+
qe as mergeRanges,
|
|
966
|
+
lt as paint,
|
|
967
|
+
pt as parseW3CTextAnnotation,
|
|
968
|
+
Ue as programmaticallyFocusable,
|
|
969
|
+
je as rangeToSelector,
|
|
964
970
|
te as reviveAnnotation,
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
971
|
+
me as reviveSelector,
|
|
972
|
+
Q as reviveTarget,
|
|
973
|
+
Ze as scrollIntoView,
|
|
974
|
+
ht as serializeW3CTextAnnotation,
|
|
975
|
+
$e as splitAnnotatableRanges,
|
|
976
|
+
Pt as toDomRectList,
|
|
977
|
+
Ge as toParentBounds,
|
|
978
|
+
Dt as toViewportBounds,
|
|
979
|
+
et as trackViewport,
|
|
980
|
+
Qe as trimRangeToContainer,
|
|
981
|
+
ge as whitespaceOrEmptyRegex
|
|
976
982
|
};
|
|
977
983
|
//# sourceMappingURL=text-annotator.es.js.map
|