@soomo/text-annotator 3.0.0-staging.32 → 3.0.0-staging.34
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/SelectionHandler.d.ts +2 -1
- package/dist/src/TextAnnotator.d.ts +1 -0
- package/dist/src/TextAnnotatorOptions.d.ts +1 -1
- package/dist/src/state/TextAnnotationStore.d.ts +3 -0
- package/dist/src/state/TextAnnotatorState.d.ts +1 -1
- package/dist/src/state/spatialTree.d.ts +5 -0
- package/dist/text-annotator.es.js +803 -778
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +2 -2
- package/dist/text-annotator.umd.js.map +1 -1
- package/package.json +2 -1
|
@@ -37,17 +37,17 @@ const q = {
|
|
|
37
37
|
}, Rt = (e) => {
|
|
38
38
|
const t = e.cloneContents();
|
|
39
39
|
return t.querySelectorAll(Y).forEach((n) => n.remove()), t;
|
|
40
|
-
},
|
|
40
|
+
}, Ee = (e) => e.addEventListener("click", (t) => {
|
|
41
41
|
// Allow clicks within not-annotatable elements
|
|
42
42
|
!t.target.closest(Y) && !t.target.closest("a") && t.preventDefault();
|
|
43
|
-
}),
|
|
43
|
+
}), Te = (e) => {
|
|
44
44
|
!e.hasAttribute("tabindex") && e.tabIndex < 0 && e.setAttribute("tabindex", "-1"), e.classList.add("no-focus-outline");
|
|
45
45
|
}, It = (e, t = 10) => {
|
|
46
46
|
let n;
|
|
47
47
|
return (...o) => {
|
|
48
48
|
clearTimeout(n), n = setTimeout(() => e.apply(void 0, o), t);
|
|
49
49
|
};
|
|
50
|
-
},
|
|
50
|
+
}, vo = (e) => {
|
|
51
51
|
const t = e.cloneContents();
|
|
52
52
|
return t.querySelectorAll(Y).forEach((n) => n.remove()), t;
|
|
53
53
|
}, Dt = (e, t) => {
|
|
@@ -71,31 +71,31 @@ const q = {
|
|
|
71
71
|
startOffset: o,
|
|
72
72
|
endContainer: i,
|
|
73
73
|
endOffset: r
|
|
74
|
-
} = e, s = Array.from(t.childNodes).map((
|
|
75
|
-
const m =
|
|
76
|
-
return
|
|
77
|
-
}), a = Dt(n, t),
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
const m = yt(a,
|
|
81
|
-
return e.setStart(m, o), e.setEnd(
|
|
82
|
-
},
|
|
74
|
+
} = e, s = Array.from(t.childNodes).map((l) => {
|
|
75
|
+
const m = l.cloneNode(!0);
|
|
76
|
+
return l.nodeName === "CANVAS" ? l : m;
|
|
77
|
+
}), a = Dt(n, t), d = Dt(i, t), f = () => {
|
|
78
|
+
const l = t;
|
|
79
|
+
l.replaceChildren(...s);
|
|
80
|
+
const m = yt(a, l), c = yt(d, l);
|
|
81
|
+
return e.setStart(m, o), e.setEnd(c, r), e;
|
|
82
|
+
}, g = (l) => {
|
|
83
83
|
const m = document.createElement("SPAN");
|
|
84
|
-
return
|
|
84
|
+
return l.surroundContents(m), m;
|
|
85
85
|
};
|
|
86
86
|
if (n === i)
|
|
87
87
|
throw "Not implemented";
|
|
88
88
|
{
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
const m =
|
|
92
|
-
|
|
93
|
-
const v =
|
|
94
|
-
var
|
|
95
|
-
const
|
|
96
|
-
return (
|
|
89
|
+
const l = document.createRange();
|
|
90
|
+
l.selectNodeContents(n), l.setStart(n, o);
|
|
91
|
+
const m = g(l), c = document.createRange();
|
|
92
|
+
c.selectNode(i), c.setEnd(i, r);
|
|
93
|
+
const v = g(c), w = Be(e).reverse().map((p) => {
|
|
94
|
+
var A;
|
|
95
|
+
const u = document.createElement("SPAN");
|
|
96
|
+
return (A = p.parentNode) == null || A.insertBefore(u, p), u.appendChild(p), u;
|
|
97
97
|
});
|
|
98
|
-
return { unwrap:
|
|
98
|
+
return { unwrap: f, nodes: [m, ...w, v] };
|
|
99
99
|
}
|
|
100
100
|
}, Be = (e) => {
|
|
101
101
|
const {
|
|
@@ -108,7 +108,7 @@ const q = {
|
|
|
108
108
|
for (; r != null; )
|
|
109
109
|
r === o && (s = !1), s && a.push(r), r === n && (s = !0), r = i.nextNode();
|
|
110
110
|
return a;
|
|
111
|
-
},
|
|
111
|
+
}, So = (e) => {
|
|
112
112
|
const { startContainer: t, endContainer: n } = e;
|
|
113
113
|
if (t === n)
|
|
114
114
|
return Array.from(e.getClientRects());
|
|
@@ -121,10 +121,10 @@ const q = {
|
|
|
121
121
|
r.setStart(i, 0), r.setEnd(e.startContainer, e.startOffset);
|
|
122
122
|
const s = Rt(r).textContent, a = document.createRange();
|
|
123
123
|
a.setStart(e.endContainer, e.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
|
|
124
|
-
const
|
|
124
|
+
const d = Rt(a).textContent;
|
|
125
125
|
return {
|
|
126
126
|
prefix: s.substring(s.length - n),
|
|
127
|
-
suffix:
|
|
127
|
+
suffix: d.substring(0, n)
|
|
128
128
|
};
|
|
129
129
|
}, Re = /^\s*$/, Ve = (e) => Re.test(e.toString()), W = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), Oe = (e, t) => {
|
|
130
130
|
const n = (r) => Math.round(r * 10) / 10, o = {
|
|
@@ -174,7 +174,7 @@ const q = {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
return i ? o : [...o, n];
|
|
177
|
-
}, []),
|
|
177
|
+
}, []), Co = (e) => ({
|
|
178
178
|
length: e.length,
|
|
179
179
|
item: (t) => e[t],
|
|
180
180
|
[Symbol.iterator]: function* () {
|
|
@@ -184,41 +184,41 @@ const q = {
|
|
|
184
184
|
}), Fe = (e, t, n) => {
|
|
185
185
|
const o = document.createRange(), i = n ? e.startContainer.parentElement.closest(n) : t;
|
|
186
186
|
o.setStart(i, 0), o.setEnd(e.startContainer, e.startOffset);
|
|
187
|
-
const r = Rt(o).textContent, s = e.toString(), a = r.length || 0,
|
|
188
|
-
return n ? { quote: s, start: a, end:
|
|
187
|
+
const r = Rt(o).textContent, s = e.toString(), a = r.length || 0, d = a + s.length;
|
|
188
|
+
return n ? { quote: s, start: a, end: d, range: e, offsetReference: i } : { quote: s, start: a, end: d, range: e };
|
|
189
189
|
}, oe = (e, t) => {
|
|
190
|
-
var
|
|
190
|
+
var g, l;
|
|
191
191
|
const { start: n, end: o } = e, i = e.offsetReference || t, r = document.createNodeIterator(
|
|
192
192
|
t,
|
|
193
193
|
NodeFilter.SHOW_TEXT,
|
|
194
194
|
(m) => {
|
|
195
|
-
var
|
|
196
|
-
return (
|
|
195
|
+
var c;
|
|
196
|
+
return (c = m.parentElement) != null && c.closest(Y) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
197
197
|
}
|
|
198
198
|
);
|
|
199
199
|
let s = 0;
|
|
200
200
|
const a = document.createRange();
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
let
|
|
204
|
-
for (;
|
|
205
|
-
if (
|
|
206
|
-
const m = ((
|
|
201
|
+
let d = r.nextNode();
|
|
202
|
+
d === null && console.error("Could not revive annotation target. Content missing.");
|
|
203
|
+
let f = !i;
|
|
204
|
+
for (; d !== null; ) {
|
|
205
|
+
if (f || (f = i == null ? void 0 : i.contains(d)), f) {
|
|
206
|
+
const m = ((g = d.textContent) == null ? void 0 : g.length) || 0;
|
|
207
207
|
if (s + m > n) {
|
|
208
|
-
a.setStart(
|
|
208
|
+
a.setStart(d, n - s);
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
211
|
s += m;
|
|
212
212
|
}
|
|
213
|
-
|
|
213
|
+
d = r.nextNode();
|
|
214
214
|
}
|
|
215
|
-
for (;
|
|
216
|
-
const m = ((
|
|
215
|
+
for (; d !== null; ) {
|
|
216
|
+
const m = ((l = d.textContent) == null ? void 0 : l.length) || 0;
|
|
217
217
|
if (s + m >= o) {
|
|
218
|
-
a.setEnd(
|
|
218
|
+
a.setEnd(d, o - s);
|
|
219
219
|
break;
|
|
220
220
|
}
|
|
221
|
-
s += m,
|
|
221
|
+
s += m, d = r.nextNode();
|
|
222
222
|
}
|
|
223
223
|
return {
|
|
224
224
|
...e,
|
|
@@ -230,7 +230,7 @@ const q = {
|
|
|
230
230
|
}, bt = (e, t) => W(e.target.selector) ? e : { ...e, target: mt(e.target, t) }, Pe = (e, t) => {
|
|
231
231
|
const { left: n, top: o, right: i, bottom: r } = e;
|
|
232
232
|
return new DOMRect(n - t.left, o - t.top, i - n, r - o);
|
|
233
|
-
},
|
|
233
|
+
}, xo = (e, t) => {
|
|
234
234
|
const { left: n, top: o, right: i, bottom: r } = e;
|
|
235
235
|
return new DOMRect(n + t.left, o + t.top, i - n, r - o);
|
|
236
236
|
}, De = (e) => ({
|
|
@@ -276,8 +276,8 @@ const q = {
|
|
|
276
276
|
detail: e.detail,
|
|
277
277
|
timeStamp: e.timeStamp
|
|
278
278
|
}), Ue = (e) => {
|
|
279
|
-
const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, s = -t, a = o - n,
|
|
280
|
-
return { top: t, left: n, minX: r, minY: s, maxX: a, maxY:
|
|
279
|
+
const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, s = -t, a = o - n, d = i - t;
|
|
280
|
+
return { top: t, left: n, minX: r, minY: s, maxX: a, maxY: d };
|
|
281
281
|
}, He = (e) => {
|
|
282
282
|
let t = /* @__PURE__ */ new Set();
|
|
283
283
|
return (o) => {
|
|
@@ -286,46 +286,46 @@ const q = {
|
|
|
286
286
|
};
|
|
287
287
|
}, Nt = (e, t, n, o) => {
|
|
288
288
|
const { store: i, selection: r, hover: s } = t;
|
|
289
|
-
let a,
|
|
290
|
-
const
|
|
291
|
-
const { x:
|
|
289
|
+
let a, d, f;
|
|
290
|
+
const g = He(n), l = (T) => {
|
|
291
|
+
const { x: k, y: b } = e.getBoundingClientRect(), S = i.getAt(T.clientX - k, T.clientY - b, d);
|
|
292
292
|
S ? s.current !== S.id && (e.classList.add("hovered"), s.set(S.id)) : s.current && (e.classList.remove("hovered"), s.set(null));
|
|
293
293
|
};
|
|
294
|
-
e.addEventListener("pointermove",
|
|
295
|
-
const m = (
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
const Ae =
|
|
294
|
+
e.addEventListener("pointermove", l);
|
|
295
|
+
const m = (T = !1) => {
|
|
296
|
+
f && f.clear();
|
|
297
|
+
const k = Ue(e), { minX: b, minY: S, maxX: x, maxY: E } = k, B = d ? i.getIntersecting(b, S, x, E).filter(({ annotation: $ }) => d($)) : i.getIntersecting(b, S, x, E), N = r.selected.map(({ id: $ }) => $), z = B.map(({ annotation: $, rects: we }) => {
|
|
298
|
+
const Ae = N.includes($.id), ve = $.id === s.current;
|
|
299
299
|
return { annotation: $, rects: we, state: { selected: Ae, hover: ve } };
|
|
300
300
|
});
|
|
301
|
-
o.redraw(z,
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
}, v = (
|
|
305
|
-
a =
|
|
306
|
-
},
|
|
307
|
-
|
|
301
|
+
o.redraw(z, k, a, f, T), setTimeout(() => g(B.map(({ annotation: $ }) => $)), 1);
|
|
302
|
+
}, c = (T) => {
|
|
303
|
+
f = T, m();
|
|
304
|
+
}, v = (T) => {
|
|
305
|
+
a = T, m();
|
|
306
|
+
}, C = (T) => {
|
|
307
|
+
d = T, m(!1);
|
|
308
308
|
}, w = () => m();
|
|
309
309
|
i.observe(w);
|
|
310
|
-
const
|
|
311
|
-
document.addEventListener("scroll",
|
|
312
|
-
const
|
|
313
|
-
i.recalculatePositions(),
|
|
310
|
+
const p = r.subscribe(() => m()), u = () => m(!0);
|
|
311
|
+
document.addEventListener("scroll", u, { capture: !0, passive: !0 });
|
|
312
|
+
const A = It(() => {
|
|
313
|
+
i.recalculatePositions(), f && f.reset(), m();
|
|
314
314
|
});
|
|
315
|
-
window.addEventListener("resize",
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
|
|
315
|
+
window.addEventListener("resize", A);
|
|
316
|
+
const h = new ResizeObserver(A);
|
|
317
|
+
h.observe(e);
|
|
318
|
+
const L = { attributes: !0, childList: !0, subtree: !0 }, M = new MutationObserver((T) => {
|
|
319
|
+
T.every((b) => b.target === e || e.contains(b.target)) || m(!0);
|
|
320
320
|
});
|
|
321
|
-
return
|
|
321
|
+
return M.observe(document.body, L), {
|
|
322
322
|
destroy: () => {
|
|
323
|
-
e.removeEventListener("pointermove",
|
|
323
|
+
e.removeEventListener("pointermove", l), o.destroy(), i.unobserve(w), p(), document.removeEventListener("scroll", u), window.removeEventListener("resize", A), h.disconnect(), M.disconnect();
|
|
324
324
|
},
|
|
325
325
|
redraw: m,
|
|
326
326
|
setStyle: v,
|
|
327
|
-
setFilter:
|
|
328
|
-
setPainter:
|
|
327
|
+
setFilter: C,
|
|
328
|
+
setPainter: c,
|
|
329
329
|
setVisible: o.setVisible
|
|
330
330
|
};
|
|
331
331
|
}, _e = () => {
|
|
@@ -337,28 +337,28 @@ const q = {
|
|
|
337
337
|
e.classList.add("r6o-annotatable");
|
|
338
338
|
const t = _e(), n = t.getContext("2d");
|
|
339
339
|
document.body.appendChild(t);
|
|
340
|
-
const o = (a,
|
|
341
|
-
const { width:
|
|
342
|
-
n.clearRect(-0.5, -0.5,
|
|
343
|
-
const { top:
|
|
344
|
-
[...a].sort((w,
|
|
345
|
-
const { annotation: { target: { created:
|
|
346
|
-
return
|
|
340
|
+
const o = (a, d, f, g) => requestAnimationFrame(() => {
|
|
341
|
+
const { width: l, height: m } = t;
|
|
342
|
+
n.clearRect(-0.5, -0.5, l + 1, m + 1), g && g.clear();
|
|
343
|
+
const { top: c, left: v } = d;
|
|
344
|
+
[...a].sort((w, p) => {
|
|
345
|
+
const { annotation: { target: { created: u } } } = w, { annotation: { target: { created: A } } } = p;
|
|
346
|
+
return u.getTime() - A.getTime();
|
|
347
347
|
}).forEach((w) => {
|
|
348
|
-
var
|
|
349
|
-
const
|
|
350
|
-
x:
|
|
351
|
-
y:
|
|
352
|
-
width:
|
|
353
|
-
height:
|
|
348
|
+
var h;
|
|
349
|
+
const p = f ? typeof f == "function" ? f(w.annotation, w.state) : f : (h = w.state) != null && h.selected ? gt : q, u = g && g.paint(w, d) || p, A = w.rects.map(({ x: L, y: M, width: R, height: T }) => ({
|
|
350
|
+
x: L + v,
|
|
351
|
+
y: M + c,
|
|
352
|
+
width: R,
|
|
353
|
+
height: T
|
|
354
354
|
}));
|
|
355
|
-
if (n.fillStyle =
|
|
356
|
-
({ x:
|
|
357
|
-
),
|
|
358
|
-
n.globalAlpha = 1, n.strokeStyle =
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
n.beginPath(), n.moveTo(
|
|
355
|
+
if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1, A.forEach(
|
|
356
|
+
({ x: L, y: M, width: R, height: T }) => n.fillRect(L, M, R, T)
|
|
357
|
+
), u.underlineColor) {
|
|
358
|
+
n.globalAlpha = 1, n.strokeStyle = u.underlineColor, n.lineWidth = u.underlineThickness ?? 1;
|
|
359
|
+
const L = u.underlineOffset ?? 0;
|
|
360
|
+
A.forEach(({ x: M, y: R, width: T, height: k }) => {
|
|
361
|
+
n.beginPath(), n.moveTo(M, R + k + L), n.lineTo(M + T, R + k + L), n.stroke();
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
});
|
|
@@ -396,8 +396,8 @@ var je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(e) {
|
|
|
396
396
|
}, ae = function(e) {
|
|
397
397
|
var t = e.h, n = e.s, o = e.v, i = e.a;
|
|
398
398
|
t = t / 360 * 6, n /= 100, o /= 100;
|
|
399
|
-
var r = Math.floor(t), s = o * (1 - n), a = o * (1 - (t - r) * n),
|
|
400
|
-
return { r: 255 * [o, a, s, s,
|
|
399
|
+
var r = Math.floor(t), s = o * (1 - n), a = o * (1 - (t - r) * n), d = o * (1 - (1 - t + r) * n), f = r % 6;
|
|
400
|
+
return { r: 255 * [o, a, s, s, d, o][f], g: 255 * [d, o, o, a, s, s][f], b: 255 * [s, s, d, o, o, a][f], a: i };
|
|
401
401
|
}, Ht = function(e) {
|
|
402
402
|
return { h: ie(e.h), s: H(e.s, 0, 100), l: H(e.l, 0, 100), a: H(e.a) };
|
|
403
403
|
}, _t = function(e) {
|
|
@@ -522,20 +522,20 @@ const Qe = (e) => [
|
|
|
522
522
|
setVisible: (r) => {
|
|
523
523
|
console.log("setVisible not implemented on CSS Custom Highlights renderer");
|
|
524
524
|
},
|
|
525
|
-
redraw: (r, s, a,
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
Array.from(t).filter((
|
|
529
|
-
const
|
|
525
|
+
redraw: (r, s, a, d) => {
|
|
526
|
+
d && d.clear();
|
|
527
|
+
const f = new Set(r.map((l) => l.annotation.id));
|
|
528
|
+
Array.from(t).filter((l) => !f.has(l));
|
|
529
|
+
const g = r.map((l) => {
|
|
530
530
|
var v;
|
|
531
|
-
const m = a ? typeof a == "function" ? a(
|
|
532
|
-
return `::highlight(_${
|
|
531
|
+
const m = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (v = l.state) != null && v.selected ? gt : q, c = d && d.paint(l, s) || m;
|
|
532
|
+
return `::highlight(_${l.annotation.id}) { ${Qe(c)} }`;
|
|
533
533
|
});
|
|
534
|
-
e.innerHTML =
|
|
535
|
-
`), CSS.highlights.clear(), r.forEach(({ annotation:
|
|
536
|
-
const m =
|
|
537
|
-
CSS.highlights.set(`_${
|
|
538
|
-
}), t =
|
|
534
|
+
e.innerHTML = g.join(`
|
|
535
|
+
`), CSS.highlights.clear(), r.forEach(({ annotation: l }) => {
|
|
536
|
+
const m = l.target.selector.map((v) => v.range), c = new Highlight(...m);
|
|
537
|
+
CSS.highlights.set(`_${l.id}`, c);
|
|
538
|
+
}), t = f;
|
|
539
539
|
}
|
|
540
540
|
};
|
|
541
541
|
}, tn = (e, t, n) => Nt(e, t, n, Ke());
|
|
@@ -572,14 +572,14 @@ const en = (e, t) => {
|
|
|
572
572
|
destroy: () => {
|
|
573
573
|
t.remove();
|
|
574
574
|
},
|
|
575
|
-
redraw: (s, a,
|
|
576
|
-
const m = !(Vt(n, s) &&
|
|
577
|
-
!
|
|
578
|
-
|
|
579
|
-
const
|
|
575
|
+
redraw: (s, a, d, f, g) => {
|
|
576
|
+
const m = !(Vt(n, s) && g);
|
|
577
|
+
!f && !m || (m && (t.innerHTML = ""), s.forEach((c) => {
|
|
578
|
+
c.rects.map((v) => {
|
|
579
|
+
const C = en(v, s), w = Se(c, a, d, f, C);
|
|
580
580
|
if (m) {
|
|
581
|
-
const
|
|
582
|
-
|
|
581
|
+
const p = document.createElement("span");
|
|
582
|
+
p.className = "r6o-annotation", p.dataset.annotation = c.annotation.id, p.style.left = `${v.x}px`, p.style.top = `${v.y}px`, p.style.width = `${v.width}px`, p.style.height = `${v.height}px`, p.style.backgroundColor = _((w == null ? void 0 : w.fill) || q.fill).alpha((w == null ? void 0 : w.fillOpacity) === void 0 ? q.fillOpacity : w.fillOpacity).toHex(), w.underlineStyle && (p.style.borderStyle = w.underlineStyle), w.underlineColor && (p.style.borderColor = w.underlineColor), w.underlineThickness && (p.style.borderBottomWidth = `${w.underlineThickness}px`), w.underlineOffset && (p.style.paddingBottom = `${w.underlineOffset}px`), t.appendChild(p);
|
|
583
583
|
}
|
|
584
584
|
});
|
|
585
585
|
}), n = s);
|
|
@@ -644,12 +644,12 @@ function Ft(e, t = Ct) {
|
|
|
644
644
|
const o = /* @__PURE__ */ new Set();
|
|
645
645
|
function i(a) {
|
|
646
646
|
if (cn(e, a) && (e = a, n)) {
|
|
647
|
-
const
|
|
648
|
-
for (const
|
|
649
|
-
|
|
650
|
-
if (
|
|
651
|
-
for (let
|
|
652
|
-
Z[
|
|
647
|
+
const d = !Z.length;
|
|
648
|
+
for (const f of o)
|
|
649
|
+
f[1](), Z.push(f, e);
|
|
650
|
+
if (d) {
|
|
651
|
+
for (let f = 0; f < Z.length; f += 2)
|
|
652
|
+
Z[f][0](Z[f + 1]);
|
|
653
653
|
Z.length = 0;
|
|
654
654
|
}
|
|
655
655
|
}
|
|
@@ -657,10 +657,10 @@ function Ft(e, t = Ct) {
|
|
|
657
657
|
function r(a) {
|
|
658
658
|
i(a(e));
|
|
659
659
|
}
|
|
660
|
-
function s(a,
|
|
661
|
-
const
|
|
662
|
-
return o.add(
|
|
663
|
-
o.delete(
|
|
660
|
+
function s(a, d = Ct) {
|
|
661
|
+
const f = [a, d];
|
|
662
|
+
return o.add(f), o.size === 1 && (n = t(i, r) || Ct), a(e), () => {
|
|
663
|
+
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
666
|
return { set: i, update: r, subscribe: s };
|
|
@@ -686,47 +686,47 @@ var un = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE =
|
|
|
686
686
|
const xt = { selected: [] }, fn = (e, t = "EDIT") => {
|
|
687
687
|
const { subscribe: n, set: o } = Ft(xt);
|
|
688
688
|
let i = t, r = xt;
|
|
689
|
-
n((
|
|
689
|
+
n((c) => r = c);
|
|
690
690
|
const s = () => o(xt), a = () => {
|
|
691
|
-
var
|
|
692
|
-
return ((
|
|
693
|
-
},
|
|
691
|
+
var c;
|
|
692
|
+
return ((c = r.selected) == null ? void 0 : c.length) === 0;
|
|
693
|
+
}, d = (c) => {
|
|
694
694
|
if (a())
|
|
695
695
|
return !1;
|
|
696
|
-
const v = typeof
|
|
697
|
-
return r.selected.some((
|
|
698
|
-
},
|
|
699
|
-
const
|
|
700
|
-
if (!
|
|
701
|
-
console.warn("Invalid selection: " +
|
|
696
|
+
const v = typeof c == "string" ? c : c.id;
|
|
697
|
+
return r.selected.some((C) => C.id === v);
|
|
698
|
+
}, f = (c, v) => {
|
|
699
|
+
const C = e.getAnnotation(c);
|
|
700
|
+
if (!C) {
|
|
701
|
+
console.warn("Invalid selection: " + c);
|
|
702
702
|
return;
|
|
703
703
|
}
|
|
704
|
-
switch (Zt(
|
|
704
|
+
switch (Zt(C, i)) {
|
|
705
705
|
case "EDIT":
|
|
706
|
-
o({ selected: [{ id:
|
|
706
|
+
o({ selected: [{ id: c, editable: !0 }], event: v });
|
|
707
707
|
break;
|
|
708
708
|
case "SELECT":
|
|
709
|
-
o({ selected: [{ id:
|
|
709
|
+
o({ selected: [{ id: c }], event: v });
|
|
710
710
|
break;
|
|
711
711
|
default:
|
|
712
712
|
o({ selected: [], event: v });
|
|
713
713
|
}
|
|
714
|
-
},
|
|
715
|
-
const
|
|
714
|
+
}, g = (c, v) => {
|
|
715
|
+
const C = Array.isArray(c) ? c : [c], w = C.map((p) => e.getAnnotation(p)).filter((p) => !!p);
|
|
716
716
|
o({
|
|
717
|
-
selected: w.map((
|
|
718
|
-
const
|
|
719
|
-
return { id:
|
|
717
|
+
selected: w.map((p) => {
|
|
718
|
+
const u = v === void 0 ? Zt(p, i) === "EDIT" : v;
|
|
719
|
+
return { id: p.id, editable: u };
|
|
720
720
|
})
|
|
721
|
-
}), w.length !==
|
|
722
|
-
},
|
|
721
|
+
}), w.length !== C.length && console.warn("Invalid selection", c);
|
|
722
|
+
}, l = (c) => {
|
|
723
723
|
if (a())
|
|
724
724
|
return !1;
|
|
725
725
|
const { selected: v } = r;
|
|
726
|
-
v.some(({ id:
|
|
727
|
-
}, m = (
|
|
726
|
+
v.some(({ id: C }) => c.includes(C)) && o({ selected: v.filter(({ id: C }) => !c.includes(C)) });
|
|
727
|
+
}, m = (c) => i = c;
|
|
728
728
|
return e.observe(
|
|
729
|
-
({ changes:
|
|
729
|
+
({ changes: c }) => l((c.deleted || []).map((v) => v.id))
|
|
730
730
|
), {
|
|
731
731
|
get event() {
|
|
732
732
|
return r ? r.event : null;
|
|
@@ -736,11 +736,11 @@ const xt = { selected: [] }, fn = (e, t = "EDIT") => {
|
|
|
736
736
|
},
|
|
737
737
|
clear: s,
|
|
738
738
|
isEmpty: a,
|
|
739
|
-
isSelected:
|
|
740
|
-
setSelected:
|
|
739
|
+
isSelected: d,
|
|
740
|
+
setSelected: g,
|
|
741
741
|
setUserSelectAction: m,
|
|
742
742
|
subscribe: n,
|
|
743
|
-
userSelect:
|
|
743
|
+
userSelect: f
|
|
744
744
|
};
|
|
745
745
|
}, Zt = (e, t) => typeof t == "function" ? t(e) : t || "EDIT";
|
|
746
746
|
var D = [];
|
|
@@ -766,7 +766,7 @@ function bn(e, t, n) {
|
|
|
766
766
|
var o = e.random || (e.rng || gn)();
|
|
767
767
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, pn(o);
|
|
768
768
|
}
|
|
769
|
-
const
|
|
769
|
+
const Lo = (e, t, n, o) => ({
|
|
770
770
|
id: bn(),
|
|
771
771
|
annotation: typeof e == "string" ? e : e.id,
|
|
772
772
|
created: n || /* @__PURE__ */ new Date(),
|
|
@@ -792,17 +792,17 @@ const xo = (e, t, n, o) => ({
|
|
|
792
792
|
targetUpdated: Sn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
|
|
793
793
|
};
|
|
794
794
|
};
|
|
795
|
-
var
|
|
795
|
+
var V = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(V || {});
|
|
796
796
|
const Cn = (e, t) => {
|
|
797
797
|
var n, o;
|
|
798
798
|
const { changes: i, origin: r } = t;
|
|
799
799
|
if (!(!e.options.origin || e.options.origin === r))
|
|
800
800
|
return !1;
|
|
801
801
|
if (e.options.ignore) {
|
|
802
|
-
const { ignore: s } = e.options, a = (
|
|
802
|
+
const { ignore: s } = e.options, a = (d) => d && d.length > 0;
|
|
803
803
|
if (!(a(i.created) || a(i.deleted))) {
|
|
804
|
-
const
|
|
805
|
-
if (s === "BODY_ONLY" &&
|
|
804
|
+
const d = (n = i.updated) == null ? void 0 : n.some((g) => a(g.bodiesCreated) || a(g.bodiesDeleted) || a(g.bodiesUpdated)), f = (o = i.updated) == null ? void 0 : o.some((g) => g.targetUpdated);
|
|
805
|
+
if (s === "BODY_ONLY" && d && !f || s === "TARGET_ONLY" && f && !d)
|
|
806
806
|
return !1;
|
|
807
807
|
}
|
|
808
808
|
}
|
|
@@ -816,31 +816,31 @@ const Cn = (e, t) => {
|
|
|
816
816
|
} else
|
|
817
817
|
return !0;
|
|
818
818
|
}, xn = (e, t) => {
|
|
819
|
-
const n = new Set((e.created || []).map((
|
|
820
|
-
...(e.created || []).filter((
|
|
819
|
+
const n = new Set((e.created || []).map((l) => l.id)), o = new Set((e.updated || []).map(({ newValue: l }) => l.id)), i = new Set((t.created || []).map((l) => l.id)), r = new Set((t.deleted || []).map((l) => l.id)), s = new Set((t.updated || []).map(({ oldValue: l }) => l.id)), a = new Set((t.updated || []).filter(({ oldValue: l }) => n.has(l.id) || o.has(l.id)).map(({ oldValue: l }) => l.id)), d = [
|
|
820
|
+
...(e.created || []).filter((l) => !r.has(l.id)).map((l) => s.has(l.id) ? t.updated.find(({ oldValue: m }) => m.id === l.id).newValue : l),
|
|
821
821
|
...t.created || []
|
|
822
|
-
],
|
|
823
|
-
...(e.deleted || []).filter((
|
|
824
|
-
...(t.deleted || []).filter((
|
|
825
|
-
],
|
|
826
|
-
...(e.updated || []).filter(({ newValue:
|
|
827
|
-
const { oldValue: m, newValue:
|
|
828
|
-
if (s.has(
|
|
829
|
-
const v = t.updated.find((
|
|
822
|
+
], f = [
|
|
823
|
+
...(e.deleted || []).filter((l) => !i.has(l.id)),
|
|
824
|
+
...(t.deleted || []).filter((l) => !n.has(l.id))
|
|
825
|
+
], g = [
|
|
826
|
+
...(e.updated || []).filter(({ newValue: l }) => !r.has(l.id)).map((l) => {
|
|
827
|
+
const { oldValue: m, newValue: c } = l;
|
|
828
|
+
if (s.has(c.id)) {
|
|
829
|
+
const v = t.updated.find((C) => C.oldValue.id === c.id).newValue;
|
|
830
830
|
return le(m, v);
|
|
831
831
|
} else
|
|
832
|
-
return
|
|
832
|
+
return l;
|
|
833
833
|
}),
|
|
834
|
-
...(t.updated || []).filter(({ oldValue:
|
|
834
|
+
...(t.updated || []).filter(({ oldValue: l }) => !a.has(l.id))
|
|
835
835
|
];
|
|
836
|
-
return { created:
|
|
837
|
-
}, Ln = (e) => e.id !== void 0,
|
|
838
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (
|
|
839
|
-
const S = n.findIndex((
|
|
836
|
+
return { created: d, deleted: f, updated: g };
|
|
837
|
+
}, Ln = (e) => e.id !== void 0, En = () => {
|
|
838
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (b, S = {}) => n.push({ onChange: b, options: S }), i = (b) => {
|
|
839
|
+
const S = n.findIndex((x) => x.onChange == b);
|
|
840
840
|
S > -1 && n.splice(S, 1);
|
|
841
|
-
}, r = (
|
|
842
|
-
const
|
|
843
|
-
origin:
|
|
841
|
+
}, r = (b, S) => {
|
|
842
|
+
const x = {
|
|
843
|
+
origin: b,
|
|
844
844
|
changes: {
|
|
845
845
|
created: S.created || [],
|
|
846
846
|
updated: S.updated || [],
|
|
@@ -848,186 +848,186 @@ const Cn = (e, t) => {
|
|
|
848
848
|
},
|
|
849
849
|
state: [...e.values()]
|
|
850
850
|
};
|
|
851
|
-
n.forEach((
|
|
852
|
-
Cn(
|
|
851
|
+
n.forEach((E) => {
|
|
852
|
+
Cn(E, x) && E.onChange(x);
|
|
853
853
|
});
|
|
854
|
-
}, s = (
|
|
855
|
-
if (e.get(
|
|
856
|
-
throw Error(`Cannot add annotation ${
|
|
857
|
-
e.set(
|
|
858
|
-
}, a = (
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
861
|
-
const
|
|
862
|
-
return
|
|
854
|
+
}, s = (b, S = V.LOCAL) => {
|
|
855
|
+
if (e.get(b.id))
|
|
856
|
+
throw Error(`Cannot add annotation ${b.id} - exists already`);
|
|
857
|
+
e.set(b.id, b), b.bodies.forEach((x) => t.set(x.id, b.id)), r(S, { created: [b] });
|
|
858
|
+
}, a = (b, S) => {
|
|
859
|
+
const x = typeof b == "string" ? S : b, E = typeof b == "string" ? b : b.id, B = e.get(E);
|
|
860
|
+
if (B) {
|
|
861
|
+
const N = le(B, x);
|
|
862
|
+
return E === x.id ? e.set(E, x) : (e.delete(E), e.set(x.id, x)), B.bodies.forEach((z) => t.delete(z.id)), x.bodies.forEach((z) => t.set(z.id, x.id)), N;
|
|
863
863
|
} else
|
|
864
|
-
console.warn(`Cannot update annotation ${
|
|
865
|
-
},
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
},
|
|
869
|
-
const
|
|
870
|
-
const
|
|
871
|
-
return
|
|
864
|
+
console.warn(`Cannot update annotation ${E} - does not exist`);
|
|
865
|
+
}, d = (b, S = V.LOCAL, x = V.LOCAL) => {
|
|
866
|
+
const E = Ln(S) ? x : S, B = a(b, S);
|
|
867
|
+
B && r(E, { updated: [B] });
|
|
868
|
+
}, f = (b, S = V.LOCAL) => {
|
|
869
|
+
const x = b.reduce((E, B) => {
|
|
870
|
+
const N = a(B);
|
|
871
|
+
return N ? [...E, N] : E;
|
|
872
872
|
}, []);
|
|
873
|
-
|
|
874
|
-
},
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
877
|
-
const
|
|
878
|
-
...
|
|
879
|
-
bodies: [...
|
|
873
|
+
x.length > 0 && r(S, { updated: x });
|
|
874
|
+
}, g = (b, S = V.LOCAL) => {
|
|
875
|
+
const x = e.get(b.annotation);
|
|
876
|
+
if (x) {
|
|
877
|
+
const E = {
|
|
878
|
+
...x,
|
|
879
|
+
bodies: [...x.bodies, b]
|
|
880
880
|
};
|
|
881
|
-
e.set(
|
|
882
|
-
oldValue:
|
|
883
|
-
newValue:
|
|
884
|
-
bodiesCreated: [
|
|
881
|
+
e.set(x.id, E), t.set(b.id, E.id), r(S, { updated: [{
|
|
882
|
+
oldValue: x,
|
|
883
|
+
newValue: E,
|
|
884
|
+
bodiesCreated: [b]
|
|
885
885
|
}] });
|
|
886
886
|
} else
|
|
887
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
888
|
-
},
|
|
887
|
+
console.warn(`Attempt to add body to missing annotation: ${b.annotation}`);
|
|
888
|
+
}, l = () => [...e.values()], m = (b = V.LOCAL) => {
|
|
889
889
|
const S = [...e.values()];
|
|
890
|
-
e.clear(), t.clear(), r(
|
|
891
|
-
},
|
|
890
|
+
e.clear(), t.clear(), r(b, { deleted: S });
|
|
891
|
+
}, c = (b, S = !0, x = V.LOCAL) => {
|
|
892
892
|
if (S) {
|
|
893
|
-
const
|
|
894
|
-
e.clear(), t.clear(),
|
|
895
|
-
e.set(
|
|
896
|
-
}), r(
|
|
893
|
+
const E = [...e.values()];
|
|
894
|
+
e.clear(), t.clear(), b.forEach((B) => {
|
|
895
|
+
e.set(B.id, B), B.bodies.forEach((N) => t.set(N.id, B.id));
|
|
896
|
+
}), r(x, { created: b, deleted: E });
|
|
897
897
|
} else {
|
|
898
|
-
const
|
|
899
|
-
const z = e.get(
|
|
900
|
-
return z ? [...
|
|
898
|
+
const E = b.reduce((B, N) => {
|
|
899
|
+
const z = e.get(N.id);
|
|
900
|
+
return z ? [...B, z] : B;
|
|
901
901
|
}, []);
|
|
902
|
-
if (
|
|
903
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${
|
|
904
|
-
|
|
905
|
-
e.set(
|
|
906
|
-
}), r(
|
|
902
|
+
if (E.length > 0)
|
|
903
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${E.map((B) => B.id).join(", ")}`);
|
|
904
|
+
b.forEach((B) => {
|
|
905
|
+
e.set(B.id, B), B.bodies.forEach((N) => t.set(N.id, B.id));
|
|
906
|
+
}), r(x, { created: b });
|
|
907
907
|
}
|
|
908
|
-
}, v = (
|
|
909
|
-
const S = typeof
|
|
910
|
-
if (
|
|
911
|
-
return e.delete(S),
|
|
908
|
+
}, v = (b) => {
|
|
909
|
+
const S = typeof b == "string" ? b : b.id, x = e.get(S);
|
|
910
|
+
if (x)
|
|
911
|
+
return e.delete(S), x.bodies.forEach((E) => t.delete(E.id)), x;
|
|
912
912
|
console.warn(`Attempt to delete missing annotation: ${S}`);
|
|
913
|
-
},
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
}, w = (
|
|
917
|
-
const
|
|
918
|
-
const
|
|
919
|
-
return
|
|
913
|
+
}, C = (b, S = V.LOCAL) => {
|
|
914
|
+
const x = v(b);
|
|
915
|
+
x && r(S, { deleted: [x] });
|
|
916
|
+
}, w = (b, S = V.LOCAL) => {
|
|
917
|
+
const x = b.reduce((E, B) => {
|
|
918
|
+
const N = v(B);
|
|
919
|
+
return N ? [...E, N] : E;
|
|
920
920
|
}, []);
|
|
921
|
-
|
|
922
|
-
},
|
|
923
|
-
const S = e.get(
|
|
921
|
+
x.length > 0 && r(S, { deleted: x });
|
|
922
|
+
}, p = (b) => {
|
|
923
|
+
const S = e.get(b.annotation);
|
|
924
924
|
if (S) {
|
|
925
|
-
const
|
|
926
|
-
if (
|
|
927
|
-
t.delete(
|
|
928
|
-
const
|
|
925
|
+
const x = S.bodies.find((E) => E.id === b.id);
|
|
926
|
+
if (x) {
|
|
927
|
+
t.delete(x.id);
|
|
928
|
+
const E = {
|
|
929
929
|
...S,
|
|
930
|
-
bodies: S.bodies.filter((
|
|
930
|
+
bodies: S.bodies.filter((B) => B.id !== b.id)
|
|
931
931
|
};
|
|
932
|
-
return e.set(S.id,
|
|
932
|
+
return e.set(S.id, E), {
|
|
933
933
|
oldValue: S,
|
|
934
|
-
newValue:
|
|
935
|
-
bodiesDeleted: [
|
|
934
|
+
newValue: E,
|
|
935
|
+
bodiesDeleted: [x]
|
|
936
936
|
};
|
|
937
937
|
} else
|
|
938
|
-
console.warn(`Attempt to delete missing body ${
|
|
938
|
+
console.warn(`Attempt to delete missing body ${b.id} from annotation ${b.annotation}`);
|
|
939
939
|
} else
|
|
940
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
941
|
-
},
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
},
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
},
|
|
948
|
-
const S = e.get(
|
|
940
|
+
console.warn(`Attempt to delete body from missing annotation ${b.annotation}`);
|
|
941
|
+
}, u = (b, S = V.LOCAL) => {
|
|
942
|
+
const x = p(b);
|
|
943
|
+
x && r(S, { updated: [x] });
|
|
944
|
+
}, A = (b, S = V.LOCAL) => {
|
|
945
|
+
const x = b.map((E) => p(E)).filter(Boolean);
|
|
946
|
+
x.length > 0 && r(S, { updated: x });
|
|
947
|
+
}, h = (b) => {
|
|
948
|
+
const S = e.get(b);
|
|
949
949
|
return S ? { ...S } : void 0;
|
|
950
|
-
},
|
|
951
|
-
const S = t.get(
|
|
950
|
+
}, L = (b) => {
|
|
951
|
+
const S = t.get(b);
|
|
952
952
|
if (S) {
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
return
|
|
956
|
-
console.error(`Store integrity error: body ${
|
|
953
|
+
const x = h(S).bodies.find((E) => E.id === b);
|
|
954
|
+
if (x)
|
|
955
|
+
return x;
|
|
956
|
+
console.error(`Store integrity error: body ${b} in index, but not in annotation`);
|
|
957
957
|
} else
|
|
958
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
959
|
-
},
|
|
960
|
-
if (
|
|
958
|
+
console.warn(`Attempt to retrieve missing body: ${b}`);
|
|
959
|
+
}, M = (b, S) => {
|
|
960
|
+
if (b.annotation !== S.annotation)
|
|
961
961
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
const
|
|
965
|
-
...
|
|
966
|
-
bodies:
|
|
962
|
+
const x = e.get(b.annotation);
|
|
963
|
+
if (x) {
|
|
964
|
+
const E = x.bodies.find((N) => N.id === b.id), B = {
|
|
965
|
+
...x,
|
|
966
|
+
bodies: x.bodies.map((N) => N.id === E.id ? S : N)
|
|
967
967
|
};
|
|
968
|
-
return e.set(
|
|
969
|
-
oldValue:
|
|
970
|
-
newValue:
|
|
971
|
-
bodiesUpdated: [{ oldBody:
|
|
968
|
+
return e.set(x.id, B), E.id !== S.id && (t.delete(E.id), t.set(S.id, B.id)), {
|
|
969
|
+
oldValue: x,
|
|
970
|
+
newValue: B,
|
|
971
|
+
bodiesUpdated: [{ oldBody: E, newBody: S }]
|
|
972
972
|
};
|
|
973
973
|
} else
|
|
974
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
975
|
-
},
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
},
|
|
979
|
-
const
|
|
980
|
-
r(S, { updated:
|
|
981
|
-
},
|
|
982
|
-
const S = e.get(
|
|
974
|
+
console.warn(`Attempt to add body to missing annotation ${b.annotation}`);
|
|
975
|
+
}, R = (b, S, x = V.LOCAL) => {
|
|
976
|
+
const E = M(b, S);
|
|
977
|
+
E && r(x, { updated: [E] });
|
|
978
|
+
}, T = (b, S = V.LOCAL) => {
|
|
979
|
+
const x = b.map((E) => M({ id: E.id, annotation: E.annotation }, E)).filter(Boolean);
|
|
980
|
+
r(S, { updated: x });
|
|
981
|
+
}, k = (b) => {
|
|
982
|
+
const S = e.get(b.annotation);
|
|
983
983
|
if (S) {
|
|
984
|
-
const
|
|
984
|
+
const x = {
|
|
985
985
|
...S,
|
|
986
986
|
target: {
|
|
987
987
|
...S.target,
|
|
988
|
-
...
|
|
988
|
+
...b
|
|
989
989
|
}
|
|
990
990
|
};
|
|
991
|
-
return e.set(S.id,
|
|
991
|
+
return e.set(S.id, x), {
|
|
992
992
|
oldValue: S,
|
|
993
|
-
newValue:
|
|
993
|
+
newValue: x,
|
|
994
994
|
targetUpdated: {
|
|
995
995
|
oldTarget: S.target,
|
|
996
|
-
newTarget:
|
|
996
|
+
newTarget: b
|
|
997
997
|
}
|
|
998
998
|
};
|
|
999
999
|
} else
|
|
1000
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
1000
|
+
console.warn(`Attempt to update target on missing annotation: ${b.annotation}`);
|
|
1001
1001
|
};
|
|
1002
1002
|
return {
|
|
1003
1003
|
addAnnotation: s,
|
|
1004
|
-
addBody:
|
|
1005
|
-
all:
|
|
1006
|
-
bulkAddAnnotation:
|
|
1004
|
+
addBody: g,
|
|
1005
|
+
all: l,
|
|
1006
|
+
bulkAddAnnotation: c,
|
|
1007
1007
|
bulkDeleteAnnotation: w,
|
|
1008
|
-
bulkDeleteBodies:
|
|
1009
|
-
bulkUpdateAnnotation:
|
|
1010
|
-
bulkUpdateBodies:
|
|
1011
|
-
bulkUpdateTargets: (
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1008
|
+
bulkDeleteBodies: A,
|
|
1009
|
+
bulkUpdateAnnotation: f,
|
|
1010
|
+
bulkUpdateBodies: T,
|
|
1011
|
+
bulkUpdateTargets: (b, S = V.LOCAL) => {
|
|
1012
|
+
const x = b.map((E) => k(E)).filter(Boolean);
|
|
1013
|
+
x.length > 0 && r(S, { updated: x });
|
|
1014
1014
|
},
|
|
1015
1015
|
clear: m,
|
|
1016
|
-
deleteAnnotation:
|
|
1017
|
-
deleteBody:
|
|
1018
|
-
getAnnotation:
|
|
1019
|
-
getBody:
|
|
1016
|
+
deleteAnnotation: C,
|
|
1017
|
+
deleteBody: u,
|
|
1018
|
+
getAnnotation: h,
|
|
1019
|
+
getBody: L,
|
|
1020
1020
|
observe: o,
|
|
1021
1021
|
unobserve: i,
|
|
1022
|
-
updateAnnotation:
|
|
1023
|
-
updateBody:
|
|
1024
|
-
updateTarget: (
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1022
|
+
updateAnnotation: d,
|
|
1023
|
+
updateBody: R,
|
|
1024
|
+
updateTarget: (b, S = V.LOCAL) => {
|
|
1025
|
+
const x = k(b);
|
|
1026
|
+
x && r(S, { updated: [x] });
|
|
1027
1027
|
}
|
|
1028
1028
|
};
|
|
1029
1029
|
};
|
|
1030
|
-
let
|
|
1030
|
+
let Tn = () => ({
|
|
1031
1031
|
emit(e, ...t) {
|
|
1032
1032
|
for (let n = 0, o = this.events[e] || [], i = o.length; n < i; n++)
|
|
1033
1033
|
o[n](...t);
|
|
@@ -1042,40 +1042,40 @@ let En = () => ({
|
|
|
1042
1042
|
}
|
|
1043
1043
|
});
|
|
1044
1044
|
const Mn = 250, Bn = (e) => {
|
|
1045
|
-
const t =
|
|
1045
|
+
const t = Tn(), n = [];
|
|
1046
1046
|
let o = -1, i = !1, r = 0;
|
|
1047
|
-
const s = (
|
|
1047
|
+
const s = (c) => {
|
|
1048
1048
|
if (!i) {
|
|
1049
|
-
const { changes: v } =
|
|
1050
|
-
if (
|
|
1049
|
+
const { changes: v } = c, C = performance.now();
|
|
1050
|
+
if (C - r > Mn)
|
|
1051
1051
|
n.splice(o + 1), n.push(v), o = n.length - 1;
|
|
1052
1052
|
else {
|
|
1053
1053
|
const w = n.length - 1;
|
|
1054
1054
|
n[w] = xn(n[w], v);
|
|
1055
1055
|
}
|
|
1056
|
-
r =
|
|
1056
|
+
r = C;
|
|
1057
1057
|
}
|
|
1058
1058
|
i = !1;
|
|
1059
1059
|
};
|
|
1060
|
-
e.observe(s, { origin:
|
|
1061
|
-
const a = (
|
|
1060
|
+
e.observe(s, { origin: V.LOCAL });
|
|
1061
|
+
const a = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c), d = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), f = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ oldValue: v }) => v)), g = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ newValue: v }) => v)), l = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), m = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c);
|
|
1062
1062
|
return {
|
|
1063
1063
|
canRedo: () => n.length - 1 > o,
|
|
1064
1064
|
canUndo: () => o > -1,
|
|
1065
1065
|
destroy: () => e.unobserve(s),
|
|
1066
|
-
on: (
|
|
1066
|
+
on: (c, v) => t.on(c, v),
|
|
1067
1067
|
redo: () => {
|
|
1068
1068
|
if (n.length - 1 > o) {
|
|
1069
1069
|
i = !0;
|
|
1070
|
-
const { created:
|
|
1071
|
-
|
|
1070
|
+
const { created: c, updated: v, deleted: C } = n[o + 1];
|
|
1071
|
+
d(c), g(v), m(C), t.emit("redo", n[o + 1]), o += 1;
|
|
1072
1072
|
}
|
|
1073
1073
|
},
|
|
1074
1074
|
undo: () => {
|
|
1075
1075
|
if (o > -1) {
|
|
1076
1076
|
i = !0;
|
|
1077
|
-
const { created:
|
|
1078
|
-
a(
|
|
1077
|
+
const { created: c, updated: v, deleted: C } = n[o];
|
|
1078
|
+
a(c), f(v), l(C), t.emit("undo", n[o]), o -= 1;
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
@@ -1086,73 +1086,73 @@ const Mn = 250, Bn = (e) => {
|
|
|
1086
1086
|
set: t
|
|
1087
1087
|
};
|
|
1088
1088
|
}, Rn = (e, t, n, o) => {
|
|
1089
|
-
const { store: i, selection: r, hover: s, viewport: a } = e,
|
|
1090
|
-
let
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
}, m = (
|
|
1094
|
-
const
|
|
1095
|
-
if (
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1089
|
+
const { store: i, selection: r, hover: s, viewport: a } = e, d = /* @__PURE__ */ new Map();
|
|
1090
|
+
let f = [], g;
|
|
1091
|
+
const l = (C, w) => {
|
|
1092
|
+
d.has(C) ? d.get(C).push(w) : d.set(C, [w]);
|
|
1093
|
+
}, m = (C, w) => {
|
|
1094
|
+
const p = d.get(C);
|
|
1095
|
+
if (p) {
|
|
1096
|
+
const u = p.indexOf(w);
|
|
1097
|
+
u !== -1 && p.splice(u, 1);
|
|
1098
1098
|
}
|
|
1099
|
-
},
|
|
1100
|
-
|
|
1101
|
-
|
|
1099
|
+
}, c = (C, w, p) => {
|
|
1100
|
+
d.has(C) && setTimeout(() => {
|
|
1101
|
+
d.get(C).forEach((u) => {
|
|
1102
1102
|
if (n) {
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1103
|
+
const A = Array.isArray(w) ? w.map((L) => n.serialize(L)) : n.serialize(w), h = p ? p instanceof PointerEvent ? p : n.serialize(p) : void 0;
|
|
1104
|
+
u(A, h);
|
|
1105
1105
|
} else
|
|
1106
|
-
|
|
1106
|
+
u(w, p);
|
|
1107
1107
|
});
|
|
1108
1108
|
}, 1);
|
|
1109
1109
|
};
|
|
1110
|
-
r.subscribe(({ selected:
|
|
1111
|
-
if (!(
|
|
1112
|
-
if (
|
|
1113
|
-
|
|
1114
|
-
else if (
|
|
1115
|
-
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1118
|
-
}),
|
|
1110
|
+
r.subscribe(({ selected: C }) => {
|
|
1111
|
+
if (!(f.length === 0 && C.length === 0)) {
|
|
1112
|
+
if (f.length === 0 && C.length > 0)
|
|
1113
|
+
f = C.map(({ id: w }) => i.getAnnotation(w));
|
|
1114
|
+
else if (f.length > 0 && C.length === 0)
|
|
1115
|
+
f.forEach((w) => {
|
|
1116
|
+
const p = i.getAnnotation(w.id);
|
|
1117
|
+
p && !K(p, w) && c("updateAnnotation", p, w);
|
|
1118
|
+
}), f = [];
|
|
1119
1119
|
else {
|
|
1120
|
-
const w = new Set(
|
|
1121
|
-
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
}),
|
|
1120
|
+
const w = new Set(f.map((u) => u.id)), p = new Set(C.map(({ id: u }) => u));
|
|
1121
|
+
f.filter((u) => !p.has(u.id)).forEach((u) => {
|
|
1122
|
+
const A = i.getAnnotation(u.id);
|
|
1123
|
+
A && !K(A, u) && c("updateAnnotation", A, u);
|
|
1124
|
+
}), f = [
|
|
1125
1125
|
// Remove annotations that were deselected
|
|
1126
|
-
...
|
|
1126
|
+
...f.filter((u) => p.has(u.id)),
|
|
1127
1127
|
// Add editable annotations that were selected
|
|
1128
|
-
...
|
|
1128
|
+
...C.filter(({ id: u }) => !w.has(u)).map(({ id: u }) => i.getAnnotation(u))
|
|
1129
1129
|
];
|
|
1130
1130
|
}
|
|
1131
|
-
|
|
1131
|
+
c("selectionChanged", f);
|
|
1132
1132
|
}
|
|
1133
|
-
}), s.subscribe((
|
|
1134
|
-
!
|
|
1135
|
-
}), a == null || a.subscribe((
|
|
1136
|
-
const { created: w, deleted:
|
|
1137
|
-
(w || []).forEach((
|
|
1138
|
-
...
|
|
1139
|
-
...
|
|
1140
|
-
...
|
|
1141
|
-
].length > 0).forEach(({ oldValue:
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1133
|
+
}), s.subscribe((C) => {
|
|
1134
|
+
!g && C ? c("mouseEnterAnnotation", i.getAnnotation(C)) : g && !C ? c("mouseLeaveAnnotation", i.getAnnotation(g)) : g && C && (c("mouseLeaveAnnotation", i.getAnnotation(g)), c("mouseEnterAnnotation", i.getAnnotation(C))), g = C;
|
|
1135
|
+
}), a == null || a.subscribe((C) => c("viewportIntersect", C.map((w) => i.getAnnotation(w)))), i.observe((C) => {
|
|
1136
|
+
const { created: w, deleted: p } = C.changes;
|
|
1137
|
+
(w || []).forEach((u) => c("createAnnotation", u)), (p || []).forEach((u) => c("deleteAnnotation", u)), (C.changes.updated || []).filter((u) => [
|
|
1138
|
+
...u.bodiesCreated || [],
|
|
1139
|
+
...u.bodiesDeleted || [],
|
|
1140
|
+
...u.bodiesUpdated || []
|
|
1141
|
+
].length > 0).forEach(({ oldValue: u, newValue: A }) => {
|
|
1142
|
+
const h = f.find((L) => L.id === u.id) || u;
|
|
1143
|
+
f = f.map((L) => L.id === u.id ? A : L), c("updateAnnotation", A, h);
|
|
1144
1144
|
});
|
|
1145
|
-
}, { origin:
|
|
1146
|
-
if (
|
|
1147
|
-
const w = new Set(
|
|
1148
|
-
|
|
1145
|
+
}, { origin: V.LOCAL }), i.observe((C) => {
|
|
1146
|
+
if (f) {
|
|
1147
|
+
const w = new Set(f.map((u) => u.id)), p = (C.changes.updated || []).filter(({ newValue: u }) => w.has(u.id)).map(({ newValue: u }) => u);
|
|
1148
|
+
p.length > 0 && (f = f.map((u) => p.find((h) => h.id === u.id) || u));
|
|
1149
1149
|
}
|
|
1150
|
-
}, { origin:
|
|
1151
|
-
const v = (
|
|
1152
|
-
const { updated:
|
|
1153
|
-
|
|
1150
|
+
}, { origin: V.REMOTE });
|
|
1151
|
+
const v = (C) => (w) => {
|
|
1152
|
+
const { updated: p } = w;
|
|
1153
|
+
C ? (p || []).forEach((u) => c("updateAnnotation", u.oldValue, u.newValue)) : (p || []).forEach((u) => c("updateAnnotation", u.newValue, u.oldValue));
|
|
1154
1154
|
};
|
|
1155
|
-
return t.on("undo", v(!0)), t.on("redo", v(!1)), { on:
|
|
1155
|
+
return t.on("undo", v(!0)), t.on("redo", v(!1)), { on: l, off: m, emit: c };
|
|
1156
1156
|
}, Vn = (e) => (t) => t.reduce((n, o) => {
|
|
1157
1157
|
const { parsed: i, error: r } = e.parse(o);
|
|
1158
1158
|
return r ? {
|
|
@@ -1165,46 +1165,46 @@ const Mn = 250, Bn = (e) => {
|
|
|
1165
1165
|
...n
|
|
1166
1166
|
};
|
|
1167
1167
|
}, { parsed: [], failed: [] }), On = (e, t, n) => {
|
|
1168
|
-
const { store: o, selection: i } = e, r = (
|
|
1168
|
+
const { store: o, selection: i } = e, r = (p) => {
|
|
1169
1169
|
if (n) {
|
|
1170
|
-
const { parsed:
|
|
1171
|
-
|
|
1170
|
+
const { parsed: u, error: A } = n.parse(p);
|
|
1171
|
+
u ? o.addAnnotation(u, V.REMOTE) : console.error(A);
|
|
1172
1172
|
} else
|
|
1173
|
-
o.addAnnotation(
|
|
1174
|
-
}, s = () => i.clear(), a = () => o.clear(),
|
|
1175
|
-
const
|
|
1176
|
-
return n &&
|
|
1177
|
-
},
|
|
1178
|
-
var
|
|
1179
|
-
const
|
|
1180
|
-
return n ?
|
|
1181
|
-
},
|
|
1182
|
-
if (typeof
|
|
1183
|
-
const
|
|
1184
|
-
if (o.deleteAnnotation(
|
|
1185
|
-
return n ? n.serialize(
|
|
1173
|
+
o.addAnnotation(p, V.REMOTE);
|
|
1174
|
+
}, s = () => i.clear(), a = () => o.clear(), d = (p) => {
|
|
1175
|
+
const u = o.getAnnotation(p);
|
|
1176
|
+
return n && u ? n.serialize(u) : u;
|
|
1177
|
+
}, f = () => n ? o.all().map(n.serialize) : o.all(), g = () => {
|
|
1178
|
+
var p;
|
|
1179
|
+
const u = (((p = i.selected) == null ? void 0 : p.map((A) => A.id)) || []).map((A) => o.getAnnotation(A)).filter(Boolean);
|
|
1180
|
+
return n ? u.map(n.serialize) : u;
|
|
1181
|
+
}, l = (p, u = !0) => fetch(p).then((A) => A.json()).then((A) => (c(A, u), A)), m = (p) => {
|
|
1182
|
+
if (typeof p == "string") {
|
|
1183
|
+
const u = o.getAnnotation(p);
|
|
1184
|
+
if (o.deleteAnnotation(p), u)
|
|
1185
|
+
return n ? n.serialize(u) : u;
|
|
1186
1186
|
} else {
|
|
1187
|
-
const
|
|
1188
|
-
if (
|
|
1189
|
-
return o.deleteAnnotation(
|
|
1187
|
+
const u = n ? n.parse(p).parsed : p;
|
|
1188
|
+
if (u)
|
|
1189
|
+
return o.deleteAnnotation(u), p;
|
|
1190
1190
|
}
|
|
1191
|
-
},
|
|
1191
|
+
}, c = (p, u = !0) => {
|
|
1192
1192
|
if (n) {
|
|
1193
|
-
const { parsed:
|
|
1194
|
-
|
|
1193
|
+
const { parsed: A, failed: h } = Vn(n)(p);
|
|
1194
|
+
h.length > 0 && console.warn(`Discarded ${h.length} invalid annotations`, h), o.bulkAddAnnotation(A, u, V.REMOTE);
|
|
1195
1195
|
} else
|
|
1196
|
-
o.bulkAddAnnotation(
|
|
1197
|
-
}, v = (
|
|
1198
|
-
|
|
1199
|
-
},
|
|
1200
|
-
i.clear(), i.setUserSelectAction(
|
|
1201
|
-
}, w = (
|
|
1196
|
+
o.bulkAddAnnotation(p, u, V.REMOTE);
|
|
1197
|
+
}, v = (p, u) => {
|
|
1198
|
+
p ? i.setSelected(p, u) : i.clear();
|
|
1199
|
+
}, C = (p) => {
|
|
1200
|
+
i.clear(), i.setUserSelectAction(p);
|
|
1201
|
+
}, w = (p) => {
|
|
1202
1202
|
if (n) {
|
|
1203
|
-
const
|
|
1204
|
-
return o.updateAnnotation(
|
|
1203
|
+
const u = n.parse(p).parsed, A = n.serialize(o.getAnnotation(u.id));
|
|
1204
|
+
return o.updateAnnotation(u), A;
|
|
1205
1205
|
} else {
|
|
1206
|
-
const
|
|
1207
|
-
return o.updateAnnotation(
|
|
1206
|
+
const u = o.getAnnotation(p.id);
|
|
1207
|
+
return o.updateAnnotation(p), u;
|
|
1208
1208
|
}
|
|
1209
1209
|
};
|
|
1210
1210
|
return {
|
|
@@ -1213,15 +1213,15 @@ const Mn = 250, Bn = (e) => {
|
|
|
1213
1213
|
canRedo: t.canRedo,
|
|
1214
1214
|
canUndo: t.canUndo,
|
|
1215
1215
|
clearAnnotations: a,
|
|
1216
|
-
getAnnotationById:
|
|
1217
|
-
getAnnotations:
|
|
1218
|
-
getSelected:
|
|
1219
|
-
loadAnnotations:
|
|
1216
|
+
getAnnotationById: d,
|
|
1217
|
+
getAnnotations: f,
|
|
1218
|
+
getSelected: g,
|
|
1219
|
+
loadAnnotations: l,
|
|
1220
1220
|
redo: t.redo,
|
|
1221
1221
|
removeAnnotation: m,
|
|
1222
|
-
setAnnotations:
|
|
1222
|
+
setAnnotations: c,
|
|
1223
1223
|
setSelected: v,
|
|
1224
|
-
setUserSelectAction:
|
|
1224
|
+
setUserSelectAction: C,
|
|
1225
1225
|
undo: t.undo,
|
|
1226
1226
|
updateAnnotation: w
|
|
1227
1227
|
};
|
|
@@ -1231,9 +1231,9 @@ let Nn = (e) => crypto.getRandomValues(new Uint8Array(e)), Fn = (e, t, n) => {
|
|
|
1231
1231
|
return (r = t) => {
|
|
1232
1232
|
let s = "";
|
|
1233
1233
|
for (; ; ) {
|
|
1234
|
-
let a = n(i),
|
|
1235
|
-
for (;
|
|
1236
|
-
if (s += e[a[
|
|
1234
|
+
let a = n(i), d = i;
|
|
1235
|
+
for (; d--; )
|
|
1236
|
+
if (s += e[a[d] & o] || "", s.length === r) return s;
|
|
1237
1237
|
}
|
|
1238
1238
|
};
|
|
1239
1239
|
}, Pn = (e, t = 21) => Fn(e, t, Nn), Dn = (e = 21) => {
|
|
@@ -1251,17 +1251,17 @@ const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1251
1251
|
}
|
|
1252
1252
|
return `${n}`;
|
|
1253
1253
|
}, ce = (e) => e ? typeof e == "object" ? { ...e } : e : void 0, Hn = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
|
|
1254
|
-
const { id: o, type: i, purpose: r, value: s, created: a, modified:
|
|
1254
|
+
const { id: o, type: i, purpose: r, value: s, created: a, modified: d, creator: f, ...g } = n;
|
|
1255
1255
|
return {
|
|
1256
1256
|
id: o || `temp-${Un(n)}`,
|
|
1257
1257
|
annotation: t,
|
|
1258
1258
|
type: i,
|
|
1259
1259
|
purpose: r,
|
|
1260
1260
|
value: s,
|
|
1261
|
-
creator: ce(
|
|
1261
|
+
creator: ce(f),
|
|
1262
1262
|
created: a ? new Date(a) : void 0,
|
|
1263
|
-
updated:
|
|
1264
|
-
...
|
|
1263
|
+
updated: d ? new Date(d) : void 0,
|
|
1264
|
+
...g
|
|
1265
1265
|
};
|
|
1266
1266
|
}), _n = (e) => e.map((t) => {
|
|
1267
1267
|
var n;
|
|
@@ -1273,7 +1273,7 @@ const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1273
1273
|
return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
|
|
1274
1274
|
});
|
|
1275
1275
|
Dn();
|
|
1276
|
-
const
|
|
1276
|
+
const Eo = (e, t) => ({
|
|
1277
1277
|
parse: (n) => $n(n),
|
|
1278
1278
|
serialize: (n) => jn(n, e, t)
|
|
1279
1279
|
}), Yn = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, Xn = (e) => {
|
|
@@ -1294,26 +1294,26 @@ const Lo = (e, t) => ({
|
|
|
1294
1294
|
selector: [],
|
|
1295
1295
|
styleClass: s[0].styleClass
|
|
1296
1296
|
};
|
|
1297
|
-
for (const
|
|
1298
|
-
const
|
|
1297
|
+
for (const d of s) {
|
|
1298
|
+
const g = (Array.isArray(d.selector) ? d.selector : [d.selector]).reduce((l, m) => {
|
|
1299
1299
|
switch (m.type) {
|
|
1300
1300
|
case "TextQuoteSelector":
|
|
1301
|
-
|
|
1301
|
+
l.quote = m.exact;
|
|
1302
1302
|
break;
|
|
1303
1303
|
case "TextPositionSelector":
|
|
1304
|
-
|
|
1304
|
+
l.start = m.start, l.end = m.end;
|
|
1305
1305
|
break;
|
|
1306
1306
|
}
|
|
1307
|
-
return
|
|
1307
|
+
return l;
|
|
1308
1308
|
}, {});
|
|
1309
|
-
if (Yn(
|
|
1310
|
-
a.selector.push({ id:
|
|
1309
|
+
if (Yn(g))
|
|
1310
|
+
a.selector.push({ id: d.id, ...g });
|
|
1311
1311
|
else {
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1314
|
-
|
|
1312
|
+
const l = [
|
|
1313
|
+
g.start ? void 0 : "TextPositionSelector",
|
|
1314
|
+
g.quote ? void 0 : "TextQuoteSelector"
|
|
1315
1315
|
].filter(Boolean);
|
|
1316
|
-
return { error: Error(`Missing selector types: ${
|
|
1316
|
+
return { error: Error(`Missing selector types: ${l.join(" and ")} for annotation: ${e.id}`) };
|
|
1317
1317
|
}
|
|
1318
1318
|
}
|
|
1319
1319
|
return { parsed: a };
|
|
@@ -1324,38 +1324,38 @@ const Lo = (e, t) => ({
|
|
|
1324
1324
|
modified: i,
|
|
1325
1325
|
body: r,
|
|
1326
1326
|
...s
|
|
1327
|
-
} = e, a = Hn(r, t),
|
|
1328
|
-
return "error" in
|
|
1327
|
+
} = e, a = Hn(r, t), d = Xn(e);
|
|
1328
|
+
return "error" in d ? { error: d.error } : {
|
|
1329
1329
|
parsed: {
|
|
1330
1330
|
...s,
|
|
1331
1331
|
id: t,
|
|
1332
1332
|
bodies: a,
|
|
1333
|
-
target:
|
|
1333
|
+
target: d.parsed
|
|
1334
1334
|
}
|
|
1335
1335
|
};
|
|
1336
1336
|
}, jn = (e, t, n) => {
|
|
1337
1337
|
const { bodies: o, target: i, ...r } = e, {
|
|
1338
1338
|
selector: s,
|
|
1339
1339
|
creator: a,
|
|
1340
|
-
created:
|
|
1341
|
-
updated:
|
|
1342
|
-
...
|
|
1343
|
-
} = i,
|
|
1344
|
-
const { quote:
|
|
1340
|
+
created: d,
|
|
1341
|
+
updated: f,
|
|
1342
|
+
...g
|
|
1343
|
+
} = i, l = s.map((m) => {
|
|
1344
|
+
const { quote: c, start: v, end: C, range: w } = m, { prefix: p, suffix: u } = ke(w, n), A = [{
|
|
1345
1345
|
type: "TextQuoteSelector",
|
|
1346
|
-
exact:
|
|
1347
|
-
prefix:
|
|
1348
|
-
suffix:
|
|
1346
|
+
exact: c,
|
|
1347
|
+
prefix: p,
|
|
1348
|
+
suffix: u
|
|
1349
1349
|
}, {
|
|
1350
1350
|
type: "TextPositionSelector",
|
|
1351
1351
|
start: v,
|
|
1352
|
-
end:
|
|
1352
|
+
end: C
|
|
1353
1353
|
}];
|
|
1354
1354
|
return {
|
|
1355
|
-
...
|
|
1355
|
+
...g,
|
|
1356
1356
|
id: m.id,
|
|
1357
1357
|
source: t,
|
|
1358
|
-
selector:
|
|
1358
|
+
selector: A
|
|
1359
1359
|
};
|
|
1360
1360
|
});
|
|
1361
1361
|
return {
|
|
@@ -1365,9 +1365,9 @@ const Lo = (e, t) => ({
|
|
|
1365
1365
|
type: "Annotation",
|
|
1366
1366
|
body: _n(e.bodies),
|
|
1367
1367
|
creator: a,
|
|
1368
|
-
created:
|
|
1369
|
-
modified:
|
|
1370
|
-
target:
|
|
1368
|
+
created: d == null ? void 0 : d.toISOString(),
|
|
1369
|
+
modified: f == null ? void 0 : f.toISOString(),
|
|
1370
|
+
target: l
|
|
1371
1371
|
};
|
|
1372
1372
|
};
|
|
1373
1373
|
function Gn(e, t, n, o, i) {
|
|
@@ -1376,12 +1376,12 @@ function Gn(e, t, n, o, i) {
|
|
|
1376
1376
|
function de(e, t, n, o, i) {
|
|
1377
1377
|
for (; o > n; ) {
|
|
1378
1378
|
if (o - n > 600) {
|
|
1379
|
-
var r = o - n + 1, s = t - n + 1, a = Math.log(r),
|
|
1380
|
-
de(e, t,
|
|
1379
|
+
var r = o - n + 1, s = t - n + 1, a = Math.log(r), d = 0.5 * Math.exp(2 * a / 3), f = 0.5 * Math.sqrt(a * d * (r - d) / r) * (s - r / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(t - s * d / r + f)), l = Math.min(o, Math.floor(t + (r - s) * d / r + f));
|
|
1380
|
+
de(e, t, g, l, i);
|
|
1381
1381
|
}
|
|
1382
|
-
var m = e[t],
|
|
1383
|
-
for (tt(e, n, t), i(e[o], m) > 0 && tt(e, n, o);
|
|
1384
|
-
for (tt(e,
|
|
1382
|
+
var m = e[t], c = n, v = o;
|
|
1383
|
+
for (tt(e, n, t), i(e[o], m) > 0 && tt(e, n, o); c < v; ) {
|
|
1384
|
+
for (tt(e, c, v), c++, v--; i(e[c], m) < 0; ) c++;
|
|
1385
1385
|
for (; i(e[v], m) > 0; ) v--;
|
|
1386
1386
|
}
|
|
1387
1387
|
i(e[n], m) === 0 ? tt(e, n, v) : (v++, tt(e, v, o)), v <= t && (n = v + 1), t <= v && (o = v - 1);
|
|
@@ -1408,8 +1408,8 @@ class zn {
|
|
|
1408
1408
|
const i = this.toBBox, r = [];
|
|
1409
1409
|
for (; n; ) {
|
|
1410
1410
|
for (let s = 0; s < n.children.length; s++) {
|
|
1411
|
-
const a = n.children[s],
|
|
1412
|
-
pt(t,
|
|
1411
|
+
const a = n.children[s], d = n.leaf ? i(a) : a;
|
|
1412
|
+
pt(t, d) && (n.leaf ? o.push(a) : Tt(t, d) ? this._all(a, o) : r.push(a));
|
|
1413
1413
|
}
|
|
1414
1414
|
n = r.pop();
|
|
1415
1415
|
}
|
|
@@ -1423,7 +1423,7 @@ class zn {
|
|
|
1423
1423
|
for (let i = 0; i < n.children.length; i++) {
|
|
1424
1424
|
const r = n.children[i], s = n.leaf ? this.toBBox(r) : r;
|
|
1425
1425
|
if (pt(t, s)) {
|
|
1426
|
-
if (n.leaf ||
|
|
1426
|
+
if (n.leaf || Tt(t, s)) return !0;
|
|
1427
1427
|
o.push(r);
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
@@ -1462,14 +1462,14 @@ class zn {
|
|
|
1462
1462
|
if (!t) return this;
|
|
1463
1463
|
let o = this.data;
|
|
1464
1464
|
const i = this.toBBox(t), r = [], s = [];
|
|
1465
|
-
let a,
|
|
1465
|
+
let a, d, f;
|
|
1466
1466
|
for (; o || r.length; ) {
|
|
1467
|
-
if (o || (o = r.pop(),
|
|
1468
|
-
const
|
|
1469
|
-
if (
|
|
1470
|
-
return o.children.splice(
|
|
1467
|
+
if (o || (o = r.pop(), d = r[r.length - 1], a = s.pop(), f = !0), o.leaf) {
|
|
1468
|
+
const g = qn(t, o.children, n);
|
|
1469
|
+
if (g !== -1)
|
|
1470
|
+
return o.children.splice(g, 1), r.push(o), this._condense(r), this;
|
|
1471
1471
|
}
|
|
1472
|
-
!
|
|
1472
|
+
!f && !o.leaf && Tt(o, i) ? (r.push(o), s.push(a), a = 0, d = o, o = o.children[0]) : d ? (a++, o = d.children[a], f = !1) : o = null;
|
|
1473
1473
|
}
|
|
1474
1474
|
return this;
|
|
1475
1475
|
}
|
|
@@ -1500,14 +1500,14 @@ class zn {
|
|
|
1500
1500
|
if (r <= s)
|
|
1501
1501
|
return a = Q(t.slice(n, o + 1)), J(a, this.toBBox), a;
|
|
1502
1502
|
i || (i = Math.ceil(Math.log(r) / Math.log(s)), s = Math.ceil(r / Math.pow(s, i - 1))), a = Q([]), a.leaf = !1, a.height = i;
|
|
1503
|
-
const
|
|
1504
|
-
Qt(t, n, o,
|
|
1505
|
-
for (let
|
|
1506
|
-
const
|
|
1507
|
-
Qt(t,
|
|
1508
|
-
for (let m =
|
|
1509
|
-
const
|
|
1510
|
-
a.children.push(this._build(t, m,
|
|
1503
|
+
const d = Math.ceil(r / s), f = d * Math.ceil(Math.sqrt(s));
|
|
1504
|
+
Qt(t, n, o, f, this.compareMinX);
|
|
1505
|
+
for (let g = n; g <= o; g += f) {
|
|
1506
|
+
const l = Math.min(g + f - 1, o);
|
|
1507
|
+
Qt(t, g, l, d, this.compareMinY);
|
|
1508
|
+
for (let m = g; m <= l; m += d) {
|
|
1509
|
+
const c = Math.min(m + d - 1, l);
|
|
1510
|
+
a.children.push(this._build(t, m, c, i - 1));
|
|
1511
1511
|
}
|
|
1512
1512
|
}
|
|
1513
1513
|
return J(a, this.toBBox), a;
|
|
@@ -1515,9 +1515,9 @@ class zn {
|
|
|
1515
1515
|
_chooseSubtree(t, n, o, i) {
|
|
1516
1516
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1517
1517
|
let r = 1 / 0, s = 1 / 0, a;
|
|
1518
|
-
for (let
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1518
|
+
for (let d = 0; d < n.children.length; d++) {
|
|
1519
|
+
const f = n.children[d], g = Et(f), l = Qn(t, f) - g;
|
|
1520
|
+
l < s ? (s = l, r = g < r ? g : r, a = f) : l === s && g < r && (r = g, a = f);
|
|
1521
1521
|
}
|
|
1522
1522
|
n = a || n.children[0];
|
|
1523
1523
|
}
|
|
@@ -1542,8 +1542,8 @@ class zn {
|
|
|
1542
1542
|
_chooseSplitIndex(t, n, o) {
|
|
1543
1543
|
let i, r = 1 / 0, s = 1 / 0;
|
|
1544
1544
|
for (let a = n; a <= o - n; a++) {
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1545
|
+
const d = nt(t, 0, a, this.toBBox), f = nt(t, a, o, this.toBBox), g = Kn(d, f), l = Et(d) + Et(f);
|
|
1546
|
+
g < r ? (r = g, i = a, s = l < s ? l : s) : g === r && l < s && (s = l, i = a);
|
|
1547
1547
|
}
|
|
1548
1548
|
return i || o - n;
|
|
1549
1549
|
}
|
|
@@ -1556,16 +1556,16 @@ class zn {
|
|
|
1556
1556
|
_allDistMargin(t, n, o, i) {
|
|
1557
1557
|
t.children.sort(i);
|
|
1558
1558
|
const r = this.toBBox, s = nt(t, 0, n, r), a = nt(t, o - n, o, r);
|
|
1559
|
-
let
|
|
1560
|
-
for (let
|
|
1561
|
-
const
|
|
1562
|
-
ot(s, t.leaf ? r(
|
|
1559
|
+
let d = ft(s) + ft(a);
|
|
1560
|
+
for (let f = n; f < o - n; f++) {
|
|
1561
|
+
const g = t.children[f];
|
|
1562
|
+
ot(s, t.leaf ? r(g) : g), d += ft(s);
|
|
1563
1563
|
}
|
|
1564
|
-
for (let
|
|
1565
|
-
const
|
|
1566
|
-
ot(a, t.leaf ? r(
|
|
1564
|
+
for (let f = o - n - 1; f >= n; f--) {
|
|
1565
|
+
const g = t.children[f];
|
|
1566
|
+
ot(a, t.leaf ? r(g) : g), d += ft(a);
|
|
1567
1567
|
}
|
|
1568
|
-
return
|
|
1568
|
+
return d;
|
|
1569
1569
|
}
|
|
1570
1570
|
_adjustParentBBoxes(t, n, o) {
|
|
1571
1571
|
for (let i = o; i >= 0; i--)
|
|
@@ -1602,7 +1602,7 @@ function Zn(e, t) {
|
|
|
1602
1602
|
function Jn(e, t) {
|
|
1603
1603
|
return e.minY - t.minY;
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1605
|
+
function Et(e) {
|
|
1606
1606
|
return (e.maxX - e.minX) * (e.maxY - e.minY);
|
|
1607
1607
|
}
|
|
1608
1608
|
function ft(e) {
|
|
@@ -1615,7 +1615,7 @@ function Kn(e, t) {
|
|
|
1615
1615
|
const n = Math.max(e.minX, t.minX), o = Math.max(e.minY, t.minY), i = Math.min(e.maxX, t.maxX), r = Math.min(e.maxY, t.maxY);
|
|
1616
1616
|
return Math.max(0, i - n) * Math.max(0, r - o);
|
|
1617
1617
|
}
|
|
1618
|
-
function
|
|
1618
|
+
function Tt(e, t) {
|
|
1619
1619
|
return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
|
|
1620
1620
|
}
|
|
1621
1621
|
function pt(e, t) {
|
|
@@ -1640,171 +1640,189 @@ function Qt(e, t, n, o, i) {
|
|
|
1640
1640
|
Gn(e, s, t, n, i), r.push(t, s, s, n);
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1643
|
+
let to = () => ({
|
|
1644
|
+
emit(e, ...t) {
|
|
1645
|
+
for (let n = 0, o = this.events[e] || [], i = o.length; n < i; n++)
|
|
1646
|
+
o[n](...t);
|
|
1647
|
+
},
|
|
1648
|
+
events: {},
|
|
1649
|
+
on(e, t) {
|
|
1650
|
+
var n;
|
|
1651
|
+
return ((n = this.events)[e] || (n[e] = [])).push(t), () => {
|
|
1652
|
+
var o;
|
|
1653
|
+
this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
const eo = (e, t) => {
|
|
1658
|
+
const n = new zn(), o = /* @__PURE__ */ new Map(), i = to(), r = (A, h) => {
|
|
1659
|
+
const L = A.selector.flatMap((R) => {
|
|
1660
|
+
const T = W([R]) ? R.range : oe(R, t).range;
|
|
1661
|
+
return Array.from(T.getClientRects());
|
|
1662
|
+
}), M = Ne(L).map((R) => Pe(R, h));
|
|
1663
|
+
return M.map((R) => {
|
|
1664
|
+
const { x: T, y: k, width: b, height: S } = R;
|
|
1651
1665
|
return {
|
|
1652
|
-
minX:
|
|
1653
|
-
minY:
|
|
1654
|
-
maxX:
|
|
1655
|
-
maxY:
|
|
1666
|
+
minX: T,
|
|
1667
|
+
minY: k,
|
|
1668
|
+
maxX: T + b,
|
|
1669
|
+
maxY: k + S,
|
|
1656
1670
|
annotation: {
|
|
1657
|
-
id:
|
|
1658
|
-
rects:
|
|
1671
|
+
id: A.annotation,
|
|
1672
|
+
rects: M
|
|
1659
1673
|
}
|
|
1660
1674
|
};
|
|
1661
1675
|
});
|
|
1662
|
-
},
|
|
1676
|
+
}, s = () => [...o.values()], a = () => {
|
|
1663
1677
|
n.clear(), o.clear();
|
|
1664
|
-
},
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1667
|
-
},
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
},
|
|
1671
|
-
|
|
1672
|
-
},
|
|
1673
|
-
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
n.load(
|
|
1678
|
-
},
|
|
1679
|
-
const
|
|
1680
|
-
minX:
|
|
1681
|
-
minY:
|
|
1682
|
-
maxX:
|
|
1683
|
-
maxY:
|
|
1684
|
-
}),
|
|
1685
|
-
return
|
|
1686
|
-
},
|
|
1687
|
-
const
|
|
1688
|
-
if (
|
|
1678
|
+
}, d = (A) => {
|
|
1679
|
+
const h = r(A, t.getBoundingClientRect());
|
|
1680
|
+
h.forEach((L) => n.insert(L)), o.set(A.annotation, h);
|
|
1681
|
+
}, f = (A) => {
|
|
1682
|
+
const h = o.get(A.annotation);
|
|
1683
|
+
h && (h.forEach((L) => n.remove(L)), o.delete(A.annotation));
|
|
1684
|
+
}, g = (A) => {
|
|
1685
|
+
f(A), d(A);
|
|
1686
|
+
}, l = (A, h = !0) => {
|
|
1687
|
+
h && a();
|
|
1688
|
+
const L = t.getBoundingClientRect(), M = A.map((T) => ({ target: T, rects: r(T, L) }));
|
|
1689
|
+
M.forEach(({ target: T, rects: k }) => o.set(T.annotation, k));
|
|
1690
|
+
const R = M.flatMap(({ rects: T }) => T);
|
|
1691
|
+
n.load(R);
|
|
1692
|
+
}, m = (A, h, L = !1) => {
|
|
1693
|
+
const M = n.search({
|
|
1694
|
+
minX: A,
|
|
1695
|
+
minY: h,
|
|
1696
|
+
maxX: A,
|
|
1697
|
+
maxY: h
|
|
1698
|
+
}), R = (T) => T.annotation.rects.reduce((k, b) => k + b.width * b.height, 0);
|
|
1699
|
+
return M.length > 0 ? (M.sort((T, k) => R(T) - R(k)), L ? M.map((T) => T.annotation.id) : [M[0].annotation.id]) : [];
|
|
1700
|
+
}, c = (A) => {
|
|
1701
|
+
const h = v(A);
|
|
1702
|
+
if (h.length === 0)
|
|
1689
1703
|
return;
|
|
1690
|
-
let
|
|
1691
|
-
for (let
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1704
|
+
let L = h[0].left, M = h[0].top, R = h[0].right, T = h[0].bottom;
|
|
1705
|
+
for (let k = 1; k < h.length; k++) {
|
|
1706
|
+
const b = h[k];
|
|
1707
|
+
L = Math.min(L, b.left), M = Math.min(M, b.top), R = Math.max(R, b.right), T = Math.max(T, b.bottom);
|
|
1694
1708
|
}
|
|
1695
|
-
return new DOMRect(
|
|
1696
|
-
},
|
|
1697
|
-
const
|
|
1698
|
-
return
|
|
1709
|
+
return new DOMRect(L, M, R - L, T - M);
|
|
1710
|
+
}, v = (A) => {
|
|
1711
|
+
const h = o.get(A);
|
|
1712
|
+
return h ? h[0].annotation.rects : [];
|
|
1699
1713
|
};
|
|
1700
1714
|
return {
|
|
1701
|
-
all:
|
|
1702
|
-
clear:
|
|
1703
|
-
getAt:
|
|
1704
|
-
getAnnotationBounds:
|
|
1705
|
-
getAnnotationRects:
|
|
1706
|
-
getIntersecting: (
|
|
1707
|
-
const
|
|
1708
|
-
return Array.from(
|
|
1709
|
-
annotation: e.getAnnotation(
|
|
1710
|
-
rects:
|
|
1711
|
-
})).filter((
|
|
1715
|
+
all: s,
|
|
1716
|
+
clear: a,
|
|
1717
|
+
getAt: m,
|
|
1718
|
+
getAnnotationBounds: c,
|
|
1719
|
+
getAnnotationRects: v,
|
|
1720
|
+
getIntersecting: (A, h, L, M) => {
|
|
1721
|
+
const R = n.search({ minX: A, minY: h, maxX: L, maxY: M }), T = new Set(R.map((k) => k.annotation.id));
|
|
1722
|
+
return Array.from(T).map((k) => ({
|
|
1723
|
+
annotation: e.getAnnotation(k),
|
|
1724
|
+
rects: v(k)
|
|
1725
|
+
})).filter((k) => !!k.annotation);
|
|
1726
|
+
},
|
|
1727
|
+
insert: d,
|
|
1728
|
+
recalculate: () => {
|
|
1729
|
+
l(e.all().map((A) => A.target), !0), i.emit("recalculate");
|
|
1712
1730
|
},
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
remove: u,
|
|
1716
|
-
set: h,
|
|
1731
|
+
remove: f,
|
|
1732
|
+
set: l,
|
|
1717
1733
|
size: () => n.all().length,
|
|
1718
|
-
update:
|
|
1734
|
+
update: g,
|
|
1735
|
+
on: (A, h) => i.on(A, h)
|
|
1719
1736
|
};
|
|
1720
|
-
},
|
|
1721
|
-
const n =
|
|
1722
|
-
const
|
|
1723
|
-
return
|
|
1724
|
-
},
|
|
1725
|
-
const
|
|
1726
|
-
return
|
|
1727
|
-
},
|
|
1728
|
-
const
|
|
1729
|
-
return
|
|
1730
|
-
n.getAnnotation(
|
|
1731
|
-
}),
|
|
1732
|
-
},
|
|
1733
|
-
const
|
|
1734
|
-
n.updateTarget(
|
|
1735
|
-
},
|
|
1736
|
-
const
|
|
1737
|
-
n.bulkUpdateTargets(
|
|
1738
|
-
}, m = (
|
|
1739
|
-
const
|
|
1740
|
-
return
|
|
1741
|
-
},
|
|
1742
|
-
const
|
|
1743
|
-
if (
|
|
1744
|
-
if (
|
|
1745
|
-
const
|
|
1746
|
-
if (
|
|
1737
|
+
}, no = (e, t) => {
|
|
1738
|
+
const n = En(), o = eo(n, e), i = fn(n, t), r = dn(n), s = kn(), a = (w, p = V.LOCAL) => {
|
|
1739
|
+
const u = bt(w, e), A = W(u.target.selector);
|
|
1740
|
+
return A && n.addAnnotation(u, p), A;
|
|
1741
|
+
}, d = (w, p = !0, u = V.LOCAL) => {
|
|
1742
|
+
const A = w.map((L) => bt(L, e)), h = A.filter((L) => !W(L.target.selector));
|
|
1743
|
+
return h.length > 0 ? (console.warn("Could not revive all targets for these annotations:", h), n.bulkAddAnnotation(A, p, u), h) : (n.bulkAddAnnotation(A, p, u), []);
|
|
1744
|
+
}, f = (w, p = V.LOCAL) => {
|
|
1745
|
+
const u = w.map((h) => bt(h, e)), A = u.filter((h) => !W(h.target.selector));
|
|
1746
|
+
return A.length > 0 && console.warn("Could not revive all targets for these annotations:", A), u.forEach((h) => {
|
|
1747
|
+
n.getAnnotation(h.id) ? n.updateAnnotation(h, p) : n.addAnnotation(h, p);
|
|
1748
|
+
}), A;
|
|
1749
|
+
}, g = (w, p = V.LOCAL) => {
|
|
1750
|
+
const u = mt(w, e);
|
|
1751
|
+
n.updateTarget(u, p);
|
|
1752
|
+
}, l = (w, p = V.LOCAL) => {
|
|
1753
|
+
const u = w.map((A) => mt(A, e));
|
|
1754
|
+
n.bulkUpdateTargets(u, p);
|
|
1755
|
+
}, m = (w, p, u) => {
|
|
1756
|
+
const A = o.getAt(w, p, !!u).map((L) => n.getAnnotation(L)), h = u ? A.filter(u) : A;
|
|
1757
|
+
return h.length > 0 ? h[0] : void 0;
|
|
1758
|
+
}, c = (w, p, u, A = 5) => {
|
|
1759
|
+
const h = o.getAnnotationRects(w);
|
|
1760
|
+
if (h.length !== 0) {
|
|
1761
|
+
if (p && u) {
|
|
1762
|
+
const L = h.find(({ top: M, right: R, bottom: T, left: k }) => p >= k - A && p <= R + A && u >= M - A && u <= T + A);
|
|
1763
|
+
if (L) return L;
|
|
1747
1764
|
}
|
|
1748
|
-
return o.getAnnotationBounds(
|
|
1765
|
+
return o.getAnnotationBounds(w);
|
|
1749
1766
|
}
|
|
1750
|
-
}, v = () => o.recalculate();
|
|
1751
|
-
return n.observe(({ changes:
|
|
1752
|
-
const
|
|
1753
|
-
(
|
|
1767
|
+
}, v = () => o.recalculate(), C = (w) => o.on("recalculate", w);
|
|
1768
|
+
return n.observe(({ changes: w }) => {
|
|
1769
|
+
const p = (w.deleted || []).filter((h) => W(h.target.selector)), u = (w.created || []).filter((h) => W(h.target.selector)), A = (w.updated || []).filter((h) => W(h.newValue.target.selector));
|
|
1770
|
+
(p == null ? void 0 : p.length) > 0 && p.forEach((h) => o.remove(h.target)), u.length > 0 && o.set(u.map((h) => h.target), !1), (A == null ? void 0 : A.length) > 0 && A.forEach(({ newValue: h }) => o.update(h.target));
|
|
1754
1771
|
}), {
|
|
1755
1772
|
store: {
|
|
1756
1773
|
...n,
|
|
1757
1774
|
addAnnotation: a,
|
|
1758
|
-
bulkAddAnnotation:
|
|
1759
|
-
bulkUpdateTargets:
|
|
1760
|
-
bulkUpsertAnnotations:
|
|
1761
|
-
getAnnotationBounds:
|
|
1775
|
+
bulkAddAnnotation: d,
|
|
1776
|
+
bulkUpdateTargets: l,
|
|
1777
|
+
bulkUpsertAnnotations: f,
|
|
1778
|
+
getAnnotationBounds: c,
|
|
1762
1779
|
getAt: m,
|
|
1763
1780
|
getIntersecting: o.getIntersecting.bind(o),
|
|
1764
1781
|
getAnnotationRects: o.getAnnotationRects.bind(o),
|
|
1765
1782
|
recalculatePositions: v,
|
|
1766
|
-
|
|
1783
|
+
onRecalculatePositions: C,
|
|
1784
|
+
updateTarget: g
|
|
1767
1785
|
},
|
|
1768
1786
|
selection: i,
|
|
1769
1787
|
hover: r,
|
|
1770
1788
|
viewport: s
|
|
1771
1789
|
};
|
|
1772
|
-
},
|
|
1790
|
+
}, oo = () => {
|
|
1773
1791
|
const e = document.createElement("canvas");
|
|
1774
1792
|
e.width = 2 * window.innerWidth, e.height = 2 * window.innerHeight, e.className = "r6o-presence-layer";
|
|
1775
1793
|
const t = e.getContext("2d");
|
|
1776
1794
|
return t.scale(2, 2), t.translate(0.5, 0.5), e;
|
|
1777
|
-
},
|
|
1778
|
-
const o =
|
|
1795
|
+
}, io = (e, t, n = {}) => {
|
|
1796
|
+
const o = oo(), i = o.getContext("2d");
|
|
1779
1797
|
document.body.appendChild(o);
|
|
1780
|
-
const r = /* @__PURE__ */ new Map(), s = (
|
|
1781
|
-
return t.on("selectionChange", (
|
|
1782
|
-
s(
|
|
1798
|
+
const r = /* @__PURE__ */ new Map(), s = (l) => Array.from(r.entries()).filter(([m, c]) => c.presenceKey === l.presenceKey).map(([m, c]) => m);
|
|
1799
|
+
return t.on("selectionChange", (l, m) => {
|
|
1800
|
+
s(l).forEach((v) => r.delete(v)), m && m.forEach((v) => r.set(v, l));
|
|
1783
1801
|
}), {
|
|
1784
1802
|
clear: () => {
|
|
1785
|
-
const { width:
|
|
1786
|
-
i.clearRect(-0.5, -0.5,
|
|
1803
|
+
const { width: l, height: m } = o;
|
|
1804
|
+
i.clearRect(-0.5, -0.5, l + 1, m + 1);
|
|
1787
1805
|
},
|
|
1788
1806
|
destroy: () => {
|
|
1789
1807
|
o.remove();
|
|
1790
1808
|
},
|
|
1791
|
-
paint: (
|
|
1809
|
+
paint: (l, m, c) => {
|
|
1792
1810
|
n.font && (i.font = n.font);
|
|
1793
|
-
const v = r.get(
|
|
1811
|
+
const v = r.get(l.annotation.id);
|
|
1794
1812
|
if (v) {
|
|
1795
|
-
const { height:
|
|
1796
|
-
i.fillStyle = v.appearance.color, i.fillRect(w - 2,
|
|
1797
|
-
const
|
|
1798
|
-
return i.fillRect(w - 2,
|
|
1813
|
+
const { height: C } = l.rects[0], w = l.rects[0].x + m.left, p = l.rects[0].y + m.top;
|
|
1814
|
+
i.fillStyle = v.appearance.color, i.fillRect(w - 2, p - 2.5, 2, C + 5);
|
|
1815
|
+
const u = i.measureText(v.appearance.label), A = u.width + 6, h = u.actualBoundingBoxAscent + u.actualBoundingBoxDescent + 8, L = u.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1816
|
+
return i.fillRect(w - 2, p - 2.5 - h, A, h), i.fillStyle = "#fff", i.fillText(v.appearance.label, w + 1, p - L), {
|
|
1799
1817
|
fill: v.appearance.color,
|
|
1800
|
-
fillOpacity:
|
|
1818
|
+
fillOpacity: c ? 0.45 : 0.18
|
|
1801
1819
|
};
|
|
1802
1820
|
}
|
|
1803
1821
|
},
|
|
1804
1822
|
reset: () => {
|
|
1805
1823
|
o.width = 2 * window.innerWidth, o.height = 2 * window.innerHeight;
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1824
|
+
const l = o.getContext("2d");
|
|
1825
|
+
l.scale(2, 2), l.translate(0.5, 0.5);
|
|
1808
1826
|
}
|
|
1809
1827
|
};
|
|
1810
1828
|
}, ue = (e) => {
|
|
@@ -1812,23 +1830,23 @@ const to = (e, t) => {
|
|
|
1812
1830
|
return document.scrollingElement;
|
|
1813
1831
|
const { overflowY: t } = window.getComputedStyle(e);
|
|
1814
1832
|
return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : ue(e.parentElement);
|
|
1815
|
-
},
|
|
1833
|
+
}, ro = (e, t) => (n) => {
|
|
1816
1834
|
const o = typeof n == "string" ? n : n.id, i = (s) => {
|
|
1817
|
-
const a = r.getBoundingClientRect(),
|
|
1818
|
-
r.scroll({ top:
|
|
1835
|
+
const a = r.getBoundingClientRect(), d = r.clientHeight, f = r.clientWidth, g = s.selector[0].range.getBoundingClientRect(), { width: l, height: m } = t.getAnnotationBounds(o), c = g.top - a.top, v = g.left - a.left, C = r.parentElement ? r.scrollTop : 0, w = r.parentElement ? r.scrollLeft : 0, p = c + C - (d - m) / 2, u = v + w - (f - l) / 2;
|
|
1836
|
+
r.scroll({ top: p, left: u, behavior: "smooth" });
|
|
1819
1837
|
}, r = ue(e);
|
|
1820
1838
|
if (r) {
|
|
1821
1839
|
const s = t.getAnnotation(o), { range: a } = s.target.selector[0];
|
|
1822
1840
|
if (a && !a.collapsed)
|
|
1823
1841
|
return i(s.target), !0;
|
|
1824
1842
|
{
|
|
1825
|
-
const
|
|
1826
|
-
if (
|
|
1827
|
-
return i(
|
|
1843
|
+
const d = mt(s.target, e), { range: f } = d.selector[0];
|
|
1844
|
+
if (f && !f.collapsed)
|
|
1845
|
+
return i(d), !0;
|
|
1828
1846
|
}
|
|
1829
1847
|
}
|
|
1830
1848
|
return !1;
|
|
1831
|
-
},
|
|
1849
|
+
}, ao = (e, t) => ({
|
|
1832
1850
|
...e,
|
|
1833
1851
|
annotatingEnabled: e.annotatingEnabled ?? t.annotatingEnabled,
|
|
1834
1852
|
user: e.user || t.user
|
|
@@ -1852,7 +1870,7 @@ function pe(e) {
|
|
|
1852
1870
|
t[n - 1] += ",", t.splice(n, 1), n = t.lastIndexOf("");
|
|
1853
1871
|
return t;
|
|
1854
1872
|
}
|
|
1855
|
-
function
|
|
1873
|
+
function so(e, t) {
|
|
1856
1874
|
const n = e.length >= t.length ? e : t, o = e.length >= t.length ? t : e;
|
|
1857
1875
|
let i = !0;
|
|
1858
1876
|
for (let r = 0; r < n.length; r++)
|
|
@@ -1941,27 +1959,27 @@ const at = {
|
|
|
1941
1959
|
18: !1,
|
|
1942
1960
|
17: !1,
|
|
1943
1961
|
91: !1
|
|
1944
|
-
},
|
|
1962
|
+
}, I = {};
|
|
1945
1963
|
for (let e = 1; e < 20; e++)
|
|
1946
1964
|
at["f".concat(e)] = 111 + e;
|
|
1947
|
-
let
|
|
1948
|
-
const G = /* @__PURE__ */ new Map(), lt = (e) => at[e.toLowerCase()] || X[e.toLowerCase()] || e.toUpperCase().charCodeAt(0),
|
|
1965
|
+
let O = [], rt = null, he = "all";
|
|
1966
|
+
const G = /* @__PURE__ */ new Map(), lt = (e) => at[e.toLowerCase()] || X[e.toLowerCase()] || e.toUpperCase().charCodeAt(0), lo = (e) => Object.keys(at).find((t) => at[t] === e), co = (e) => Object.keys(X).find((t) => X[t] === e);
|
|
1949
1967
|
function ge(e) {
|
|
1950
1968
|
he = e || "all";
|
|
1951
1969
|
}
|
|
1952
1970
|
function st() {
|
|
1953
1971
|
return he || "all";
|
|
1954
1972
|
}
|
|
1955
|
-
function co() {
|
|
1956
|
-
return V.slice(0);
|
|
1957
|
-
}
|
|
1958
1973
|
function uo() {
|
|
1959
|
-
return
|
|
1974
|
+
return O.slice(0);
|
|
1960
1975
|
}
|
|
1961
1976
|
function fo() {
|
|
1977
|
+
return O.map((e) => lo(e) || co(e) || String.fromCharCode(e));
|
|
1978
|
+
}
|
|
1979
|
+
function po() {
|
|
1962
1980
|
const e = [];
|
|
1963
|
-
return Object.keys(
|
|
1964
|
-
|
|
1981
|
+
return Object.keys(I).forEach((t) => {
|
|
1982
|
+
I[t].forEach((n) => {
|
|
1965
1983
|
let {
|
|
1966
1984
|
key: o,
|
|
1967
1985
|
scope: i,
|
|
@@ -1977,7 +1995,7 @@ function fo() {
|
|
|
1977
1995
|
});
|
|
1978
1996
|
}), e;
|
|
1979
1997
|
}
|
|
1980
|
-
function
|
|
1998
|
+
function ho(e) {
|
|
1981
1999
|
const t = e.target || e.srcElement, {
|
|
1982
2000
|
tagName: n
|
|
1983
2001
|
} = t;
|
|
@@ -1985,15 +2003,15 @@ function po(e) {
|
|
|
1985
2003
|
const i = n === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(t.type);
|
|
1986
2004
|
return (t.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !t.readOnly) && (o = !1), o;
|
|
1987
2005
|
}
|
|
1988
|
-
function
|
|
1989
|
-
return typeof e == "string" && (e = lt(e)),
|
|
2006
|
+
function go(e) {
|
|
2007
|
+
return typeof e == "string" && (e = lt(e)), O.indexOf(e) !== -1;
|
|
1990
2008
|
}
|
|
1991
|
-
function
|
|
2009
|
+
function mo(e, t) {
|
|
1992
2010
|
let n, o;
|
|
1993
2011
|
e || (e = st());
|
|
1994
|
-
for (const i in
|
|
1995
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1996
|
-
for (n =
|
|
2012
|
+
for (const i in I)
|
|
2013
|
+
if (Object.prototype.hasOwnProperty.call(I, i))
|
|
2014
|
+
for (n = I[i], o = 0; o < n.length; )
|
|
1997
2015
|
n[o].scope === e ? n.splice(o, 1).forEach((s) => {
|
|
1998
2016
|
let {
|
|
1999
2017
|
element: a
|
|
@@ -2002,18 +2020,18 @@ function go(e, t) {
|
|
|
2002
2020
|
}) : o++;
|
|
2003
2021
|
st() === e && ge(t || "all");
|
|
2004
2022
|
}
|
|
2005
|
-
function
|
|
2023
|
+
function bo(e) {
|
|
2006
2024
|
let t = e.keyCode || e.which || e.charCode;
|
|
2007
|
-
const n =
|
|
2008
|
-
if (n >= 0 &&
|
|
2025
|
+
const n = O.indexOf(t);
|
|
2026
|
+
if (n >= 0 && O.splice(n, 1), e.key && e.key.toLowerCase() === "meta" && O.splice(0, O.length), (t === 93 || t === 224) && (t = 91), t in y) {
|
|
2009
2027
|
y[t] = !1;
|
|
2010
2028
|
for (const o in X) X[o] === t && (U[o] = !1);
|
|
2011
2029
|
}
|
|
2012
2030
|
}
|
|
2013
2031
|
function me(e) {
|
|
2014
2032
|
if (typeof e > "u")
|
|
2015
|
-
Object.keys(
|
|
2016
|
-
Array.isArray(
|
|
2033
|
+
Object.keys(I).forEach((i) => {
|
|
2034
|
+
Array.isArray(I[i]) && I[i].forEach((r) => ht(r)), delete I[i];
|
|
2017
2035
|
}), Pt(null);
|
|
2018
2036
|
else if (Array.isArray(e))
|
|
2019
2037
|
e.forEach((i) => {
|
|
@@ -2041,14 +2059,14 @@ const ht = (e) => {
|
|
|
2041
2059
|
splitKey: i = "+"
|
|
2042
2060
|
} = e;
|
|
2043
2061
|
pe(t).forEach((s) => {
|
|
2044
|
-
const a = s.split(i),
|
|
2045
|
-
if (!
|
|
2062
|
+
const a = s.split(i), d = a.length, f = a[d - 1], g = f === "*" ? "*" : lt(f);
|
|
2063
|
+
if (!I[g]) return;
|
|
2046
2064
|
n || (n = st());
|
|
2047
|
-
const
|
|
2048
|
-
|
|
2049
|
-
const
|
|
2050
|
-
return
|
|
2051
|
-
}), m.forEach((
|
|
2065
|
+
const l = d > 1 ? fe(X, a) : [], m = [];
|
|
2066
|
+
I[g] = I[g].filter((c) => {
|
|
2067
|
+
const C = (o ? c.method === o : !0) && c.scope === n && so(c.mods, l);
|
|
2068
|
+
return C && m.push(c.element), !C;
|
|
2069
|
+
}), m.forEach((c) => Pt(c));
|
|
2052
2070
|
});
|
|
2053
2071
|
};
|
|
2054
2072
|
function Kt(e, t, n, o) {
|
|
@@ -2059,16 +2077,16 @@ function Kt(e, t, n, o) {
|
|
|
2059
2077
|
i = t.mods.length > 0;
|
|
2060
2078
|
for (const r in y)
|
|
2061
2079
|
Object.prototype.hasOwnProperty.call(y, r) && (!y[r] && t.mods.indexOf(+r) > -1 || y[r] && t.mods.indexOf(+r) === -1) && (i = !1);
|
|
2062
|
-
(t.mods.length === 0 && !y[16] && !y[18] && !y[17] && !y[91] || i || t.shortcut === "*") && (t.keys = [], t.keys = t.keys.concat(
|
|
2080
|
+
(t.mods.length === 0 && !y[16] && !y[18] && !y[17] && !y[91] || i || t.shortcut === "*") && (t.keys = [], t.keys = t.keys.concat(O), t.method(e, t) === !1 && (e.preventDefault ? e.preventDefault() : e.returnValue = !1, e.stopPropagation && e.stopPropagation(), e.cancelBubble && (e.cancelBubble = !0)));
|
|
2063
2081
|
}
|
|
2064
2082
|
}
|
|
2065
2083
|
function te(e, t) {
|
|
2066
|
-
const n =
|
|
2084
|
+
const n = I["*"];
|
|
2067
2085
|
let o = e.keyCode || e.which || e.charCode;
|
|
2068
2086
|
if (!U.filter.call(this, e)) return;
|
|
2069
|
-
if ((o === 93 || o === 224) && (o = 91),
|
|
2070
|
-
const
|
|
2071
|
-
e[a] &&
|
|
2087
|
+
if ((o === 93 || o === 224) && (o = 91), O.indexOf(o) === -1 && o !== 229 && O.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
|
|
2088
|
+
const d = Ot[a];
|
|
2089
|
+
e[a] && O.indexOf(d) === -1 ? O.push(d) : !e[a] && O.indexOf(d) > -1 ? O.splice(O.indexOf(d), 1) : a === "metaKey" && e[a] && O.length === 3 && (e.ctrlKey || e.shiftKey || e.altKey || (O = O.slice(O.indexOf(d))));
|
|
2072
2090
|
}), o in y) {
|
|
2073
2091
|
y[o] = !0;
|
|
2074
2092
|
for (const a in X)
|
|
@@ -2077,75 +2095,75 @@ function te(e, t) {
|
|
|
2077
2095
|
}
|
|
2078
2096
|
for (const a in y)
|
|
2079
2097
|
Object.prototype.hasOwnProperty.call(y, a) && (y[a] = e[Ot[a]]);
|
|
2080
|
-
e.getModifierState && !(e.altKey && !e.ctrlKey) && e.getModifierState("AltGraph") && (
|
|
2098
|
+
e.getModifierState && !(e.altKey && !e.ctrlKey) && e.getModifierState("AltGraph") && (O.indexOf(17) === -1 && O.push(17), O.indexOf(18) === -1 && O.push(18), y[17] = !0, y[18] = !0);
|
|
2081
2099
|
const i = st();
|
|
2082
2100
|
if (n)
|
|
2083
2101
|
for (let a = 0; a < n.length; a++)
|
|
2084
2102
|
n[a].scope === i && (e.type === "keydown" && n[a].keydown || e.type === "keyup" && n[a].keyup) && Kt(e, n[a], i, t);
|
|
2085
|
-
if (!(o in
|
|
2086
|
-
const r =
|
|
2103
|
+
if (!(o in I)) return;
|
|
2104
|
+
const r = I[o], s = r.length;
|
|
2087
2105
|
for (let a = 0; a < s; a++)
|
|
2088
2106
|
if ((e.type === "keydown" && r[a].keydown || e.type === "keyup" && r[a].keyup) && r[a].key) {
|
|
2089
|
-
const
|
|
2090
|
-
splitKey:
|
|
2091
|
-
} =
|
|
2092
|
-
for (let m = 0; m <
|
|
2093
|
-
|
|
2094
|
-
|
|
2107
|
+
const d = r[a], {
|
|
2108
|
+
splitKey: f
|
|
2109
|
+
} = d, g = d.key.split(f), l = [];
|
|
2110
|
+
for (let m = 0; m < g.length; m++)
|
|
2111
|
+
l.push(lt(g[m]));
|
|
2112
|
+
l.sort().join("") === O.sort().join("") && Kt(e, d, i, t);
|
|
2095
2113
|
}
|
|
2096
2114
|
}
|
|
2097
2115
|
function U(e, t, n) {
|
|
2098
|
-
|
|
2116
|
+
O = [];
|
|
2099
2117
|
const o = pe(e);
|
|
2100
|
-
let i = [], r = "all", s = document, a = 0,
|
|
2101
|
-
for (n === void 0 && typeof t == "function" && (n = t), Object.prototype.toString.call(t) === "[object Object]" && (t.scope && (r = t.scope), t.element && (s = t.element), t.keyup && (
|
|
2102
|
-
e = o[a].split(
|
|
2103
|
-
keyup:
|
|
2104
|
-
keydown:
|
|
2118
|
+
let i = [], r = "all", s = document, a = 0, d = !1, f = !0, g = "+", l = !1, m = !1;
|
|
2119
|
+
for (n === void 0 && typeof t == "function" && (n = t), Object.prototype.toString.call(t) === "[object Object]" && (t.scope && (r = t.scope), t.element && (s = t.element), t.keyup && (d = t.keyup), t.keydown !== void 0 && (f = t.keydown), t.capture !== void 0 && (l = t.capture), typeof t.splitKey == "string" && (g = t.splitKey), t.single === !0 && (m = !0)), typeof t == "string" && (r = t), m && me(e, r); a < o.length; a++)
|
|
2120
|
+
e = o[a].split(g), i = [], e.length > 1 && (i = fe(X, e)), e = e[e.length - 1], e = e === "*" ? "*" : lt(e), e in I || (I[e] = []), I[e].push({
|
|
2121
|
+
keyup: d,
|
|
2122
|
+
keydown: f,
|
|
2105
2123
|
scope: r,
|
|
2106
2124
|
mods: i,
|
|
2107
2125
|
shortcut: o[a],
|
|
2108
2126
|
method: n,
|
|
2109
2127
|
key: o[a],
|
|
2110
|
-
splitKey:
|
|
2128
|
+
splitKey: g,
|
|
2111
2129
|
element: s
|
|
2112
2130
|
});
|
|
2113
2131
|
if (typeof s < "u" && window) {
|
|
2114
2132
|
if (!G.has(s)) {
|
|
2115
|
-
const
|
|
2116
|
-
let
|
|
2117
|
-
return te(
|
|
2133
|
+
const c = function() {
|
|
2134
|
+
let C = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2135
|
+
return te(C, s);
|
|
2118
2136
|
}, v = function() {
|
|
2119
|
-
let
|
|
2120
|
-
te(
|
|
2137
|
+
let C = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2138
|
+
te(C, s), bo(C);
|
|
2121
2139
|
};
|
|
2122
2140
|
G.set(s, {
|
|
2123
|
-
keydownListener:
|
|
2141
|
+
keydownListener: c,
|
|
2124
2142
|
keyupListenr: v,
|
|
2125
|
-
capture:
|
|
2126
|
-
}), Bt(s, "keydown",
|
|
2143
|
+
capture: l
|
|
2144
|
+
}), Bt(s, "keydown", c, l), Bt(s, "keyup", v, l);
|
|
2127
2145
|
}
|
|
2128
2146
|
if (!rt) {
|
|
2129
|
-
const
|
|
2130
|
-
|
|
2147
|
+
const c = () => {
|
|
2148
|
+
O = [];
|
|
2131
2149
|
};
|
|
2132
2150
|
rt = {
|
|
2133
|
-
listener:
|
|
2134
|
-
capture:
|
|
2135
|
-
}, Bt(window, "focus",
|
|
2151
|
+
listener: c,
|
|
2152
|
+
capture: l
|
|
2153
|
+
}, Bt(window, "focus", c, l);
|
|
2136
2154
|
}
|
|
2137
2155
|
}
|
|
2138
2156
|
}
|
|
2139
|
-
function
|
|
2157
|
+
function wo(e) {
|
|
2140
2158
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
|
|
2141
|
-
Object.keys(
|
|
2142
|
-
|
|
2159
|
+
Object.keys(I).forEach((n) => {
|
|
2160
|
+
I[n].filter((i) => i.scope === t && i.shortcut === e).forEach((i) => {
|
|
2143
2161
|
i && i.method && i.method();
|
|
2144
2162
|
});
|
|
2145
2163
|
});
|
|
2146
2164
|
}
|
|
2147
2165
|
function Pt(e) {
|
|
2148
|
-
const t = Object.values(
|
|
2166
|
+
const t = Object.values(I).flat();
|
|
2149
2167
|
if (t.findIndex((o) => {
|
|
2150
2168
|
let {
|
|
2151
2169
|
element: i
|
|
@@ -2166,7 +2184,7 @@ function Pt(e) {
|
|
|
2166
2184
|
capture: a
|
|
2167
2185
|
} = G.get(i) || {};
|
|
2168
2186
|
r && s && (et(i, "keyup", s, a), et(i, "keydown", r, a), G.delete(i));
|
|
2169
|
-
}), G.clear(), Object.keys(
|
|
2187
|
+
}), G.clear(), Object.keys(I).forEach((i) => delete I[i]), rt)) {
|
|
2170
2188
|
const {
|
|
2171
2189
|
listener: i,
|
|
2172
2190
|
capture: r
|
|
@@ -2175,15 +2193,15 @@ function Pt(e) {
|
|
|
2175
2193
|
}
|
|
2176
2194
|
}
|
|
2177
2195
|
const kt = {
|
|
2178
|
-
getPressedKeyString:
|
|
2196
|
+
getPressedKeyString: fo,
|
|
2179
2197
|
setScope: ge,
|
|
2180
2198
|
getScope: st,
|
|
2181
|
-
deleteScope:
|
|
2182
|
-
getPressedKeyCodes:
|
|
2183
|
-
getAllKeyCodes:
|
|
2184
|
-
isPressed:
|
|
2185
|
-
filter:
|
|
2186
|
-
trigger:
|
|
2199
|
+
deleteScope: mo,
|
|
2200
|
+
getPressedKeyCodes: uo,
|
|
2201
|
+
getAllKeyCodes: po,
|
|
2202
|
+
isPressed: go,
|
|
2203
|
+
filter: ho,
|
|
2204
|
+
trigger: wo,
|
|
2187
2205
|
unbind: me,
|
|
2188
2206
|
keyMap: at,
|
|
2189
2207
|
modifier: X,
|
|
@@ -2201,123 +2219,130 @@ var be = {};
|
|
|
2201
2219
|
t.Unidentified = "Unidentified", t.Alt = "Alt", t.AltGraph = "AltGraph", t.CapsLock = "CapsLock", t.Control = "Control", t.Fn = "Fn", t.FnLock = "FnLock", t.Hyper = "Hyper", t.Meta = "Meta", t.NumLock = "NumLock", t.ScrollLock = "ScrollLock", t.Shift = "Shift", t.Super = "Super", t.Symbol = "Symbol", t.SymbolLock = "SymbolLock", t.Enter = "Enter", t.Tab = "Tab", t.ArrowDown = "ArrowDown", t.ArrowLeft = "ArrowLeft", t.ArrowRight = "ArrowRight", t.ArrowUp = "ArrowUp", t.End = "End", t.Home = "Home", t.PageDown = "PageDown", t.PageUp = "PageUp", t.Backspace = "Backspace", t.Clear = "Clear", t.Copy = "Copy", t.CrSel = "CrSel", t.Cut = "Cut", t.Delete = "Delete", t.EraseEof = "EraseEof", t.ExSel = "ExSel", t.Insert = "Insert", t.Paste = "Paste", t.Redo = "Redo", t.Undo = "Undo", t.Accept = "Accept", t.Again = "Again", t.Attn = "Attn", t.Cancel = "Cancel", t.ContextMenu = "ContextMenu", t.Escape = "Escape", t.Execute = "Execute", t.Find = "Find", t.Finish = "Finish", t.Help = "Help", t.Pause = "Pause", t.Play = "Play", t.Props = "Props", t.Select = "Select", t.ZoomIn = "ZoomIn", t.ZoomOut = "ZoomOut", t.BrightnessDown = "BrightnessDown", t.BrightnessUp = "BrightnessUp", t.Eject = "Eject", t.LogOff = "LogOff", t.Power = "Power", t.PowerOff = "PowerOff", t.PrintScreen = "PrintScreen", t.Hibernate = "Hibernate", t.Standby = "Standby", t.WakeUp = "WakeUp", t.AllCandidates = "AllCandidates", t.Alphanumeric = "Alphanumeric", t.CodeInput = "CodeInput", t.Compose = "Compose", t.Convert = "Convert", t.Dead = "Dead", t.FinalMode = "FinalMode", t.GroupFirst = "GroupFirst", t.GroupLast = "GroupLast", t.GroupNext = "GroupNext", t.GroupPrevious = "GroupPrevious", t.ModeChange = "ModeChange", t.NextCandidate = "NextCandidate", t.NonConvert = "NonConvert", t.PreviousCandidate = "PreviousCandidate", t.Process = "Process", t.SingleCandidate = "SingleCandidate", t.HangulMode = "HangulMode", t.HanjaMode = "HanjaMode", t.JunjaMode = "JunjaMode", t.Eisu = "Eisu", t.Hankaku = "Hankaku", t.Hiragana = "Hiragana", t.HiraganaKatakana = "HiraganaKatakana", t.KanaMode = "KanaMode", t.KanjiMode = "KanjiMode", t.Katakana = "Katakana", t.Romaji = "Romaji", t.Zenkaku = "Zenkaku", t.ZenkakuHanaku = "ZenkakuHanaku", t.F1 = "F1", t.F2 = "F2", t.F3 = "F3", t.F4 = "F4", t.F5 = "F5", t.F6 = "F6", t.F7 = "F7", t.F8 = "F8", t.F9 = "F9", t.F10 = "F10", t.F11 = "F11", t.F12 = "F12", t.F13 = "F13", t.F14 = "F14", t.F15 = "F15", t.F16 = "F16", t.F17 = "F17", t.F18 = "F18", t.F19 = "F19", t.F20 = "F20", t.Soft1 = "Soft1", t.Soft2 = "Soft2", t.Soft3 = "Soft3", t.Soft4 = "Soft4", t.AppSwitch = "AppSwitch", t.Call = "Call", t.Camera = "Camera", t.CameraFocus = "CameraFocus", t.EndCall = "EndCall", t.GoBack = "GoBack", t.GoHome = "GoHome", t.HeadsetHook = "HeadsetHook", t.LastNumberRedial = "LastNumberRedial", t.Notification = "Notification", t.MannerMode = "MannerMode", t.VoiceDial = "VoiceDial", t.ChannelDown = "ChannelDown", t.ChannelUp = "ChannelUp", t.MediaFastForward = "MediaFastForward", t.MediaPause = "MediaPause", t.MediaPlay = "MediaPlay", t.MediaPlayPause = "MediaPlayPause", t.MediaRecord = "MediaRecord", t.MediaRewind = "MediaRewind", t.MediaStop = "MediaStop", t.MediaTrackNext = "MediaTrackNext", t.MediaTrackPrevious = "MediaTrackPrevious", t.AudioBalanceLeft = "AudioBalanceLeft", t.AudioBalanceRight = "AudioBalanceRight", t.AudioBassDown = "AudioBassDown", t.AudioBassBoostDown = "AudioBassBoostDown", t.AudioBassBoostToggle = "AudioBassBoostToggle", t.AudioBassBoostUp = "AudioBassBoostUp", t.AudioBassUp = "AudioBassUp", t.AudioFaderFront = "AudioFaderFront", t.AudioFaderRear = "AudioFaderRear", t.AudioSurroundModeNext = "AudioSurroundModeNext", t.AudioTrebleDown = "AudioTrebleDown", t.AudioTrebleUp = "AudioTrebleUp", t.AudioVolumeDown = "AudioVolumeDown", t.AudioVolumeMute = "AudioVolumeMute", t.AudioVolumeUp = "AudioVolumeUp", t.MicrophoneToggle = "MicrophoneToggle", t.MicrophoneVolumeDown = "MicrophoneVolumeDown", t.MicrophoneVolumeMute = "MicrophoneVolumeMute", t.MicrophoneVolumeUp = "MicrophoneVolumeUp", t.TV = "TV", t.TV3DMode = "TV3DMode", t.TVAntennaCable = "TVAntennaCable", t.TVAudioDescription = "TVAudioDescription", t.TVAudioDescriptionMixDown = "TVAudioDescriptionMixDown", t.TVAudioDescriptionMixUp = "TVAudioDescriptionMixUp", t.TVContentsMenu = "TVContentsMenu", t.TVDataService = "TVDataService", t.TVInput = "TVInput", t.TVInputComponent1 = "TVInputComponent1", t.TVInputComponent2 = "TVInputComponent2", t.TVInputComposite1 = "TVInputComposite1", t.TVInputComposite2 = "TVInputComposite2", t.TVInputHDMI1 = "TVInputHDMI1", t.TVInputHDMI2 = "TVInputHDMI2", t.TVInputHDMI3 = "TVInputHDMI3", t.TVInputHDMI4 = "TVInputHDMI4", t.TVInputVGA1 = "TVInputVGA1", t.TVMediaContext = "TVMediaContext", t.TVNetwork = "TVNetwork", t.TVNumberEntry = "TVNumberEntry", t.TVPower = "TVPower", t.TVRadioService = "TVRadioService", t.TVSatellite = "TVSatellite", t.TVSatelliteBS = "TVSatelliteBS", t.TVSatelliteCS = "TVSatelliteCS", t.TVSatelliteToggle = "TVSatelliteToggle", t.TVTerrestrialAnalog = "TVTerrestrialAnalog", t.TVTerrestrialDigital = "TVTerrestrialDigital", t.TVTimer = "TVTimer", t.AVRInput = "AVRInput", t.AVRPower = "AVRPower", t.ColorF0Red = "ColorF0Red", t.ColorF1Green = "ColorF1Green", t.ColorF2Yellow = "ColorF2Yellow", t.ColorF3Blue = "ColorF3Blue", t.ColorF4Grey = "ColorF4Grey", t.ColorF5Brown = "ColorF5Brown", t.ClosedCaptionToggle = "ClosedCaptionToggle", t.Dimmer = "Dimmer", t.DisplaySwap = "DisplaySwap", t.DVR = "DVR", t.Exit = "Exit", t.FavoriteClear0 = "FavoriteClear0", t.FavoriteClear1 = "FavoriteClear1", t.FavoriteClear2 = "FavoriteClear2", t.FavoriteClear3 = "FavoriteClear3", t.FavoriteRecall0 = "FavoriteRecall0", t.FavoriteRecall1 = "FavoriteRecall1", t.FavoriteRecall2 = "FavoriteRecall2", t.FavoriteRecall3 = "FavoriteRecall3", t.FavoriteStore0 = "FavoriteStore0", t.FavoriteStore1 = "FavoriteStore1", t.FavoriteStore2 = "FavoriteStore2", t.FavoriteStore3 = "FavoriteStore3", t.Guide = "Guide", t.GuideNextDay = "GuideNextDay", t.GuidePreviousDay = "GuidePreviousDay", t.Info = "Info", t.InstantReplay = "InstantReplay", t.Link = "Link", t.ListProgram = "ListProgram", t.LiveContent = "LiveContent", t.Lock = "Lock", t.MediaApps = "MediaApps", t.MediaAudioTrack = "MediaAudioTrack", t.MediaLast = "MediaLast", t.MediaSkipBackward = "MediaSkipBackward", t.MediaSkipForward = "MediaSkipForward", t.MediaStepBackward = "MediaStepBackward", t.MediaStepForward = "MediaStepForward", t.MediaTopMenu = "MediaTopMenu", t.NavigateIn = "NavigateIn", t.NavigateNext = "NavigateNext", t.NavigateOut = "NavigateOut", t.NavigatePrevious = "NavigatePrevious", t.NextFavoriteChannel = "NextFavoriteChannel", t.NextUserProfile = "NextUserProfile", t.OnDemand = "OnDemand", t.Pairing = "Pairing", t.PinPDown = "PinPDown", t.PinPMove = "PinPMove", t.PinPToggle = "PinPToggle", t.PinPUp = "PinPUp", t.PlaySpeedDown = "PlaySpeedDown", t.PlaySpeedReset = "PlaySpeedReset", t.PlaySpeedUp = "PlaySpeedUp", t.RandomToggle = "RandomToggle", t.RcLowBattery = "RcLowBattery", t.RecordSpeedNext = "RecordSpeedNext", t.RfBypass = "RfBypass", t.ScanChannelsToggle = "ScanChannelsToggle", t.ScreenModeNext = "ScreenModeNext", t.Settings = "Settings", t.SplitScreenToggle = "SplitScreenToggle", t.STBInput = "STBInput", t.STBPower = "STBPower", t.Subtitle = "Subtitle", t.Teletext = "Teletext", t.VideoModeNext = "VideoModeNext", t.Wink = "Wink", t.ZoomToggle = "ZoomToggle", t.SpeechCorrectionList = "SpeechCorrectionList", t.SpeechInputToggle = "SpeechInputToggle", t.Close = "Close", t.New = "New", t.Open = "Open", t.Print = "Print", t.Save = "Save", t.SpellCheck = "SpellCheck", t.MailForward = "MailForward", t.MailReply = "MailReply", t.MailSend = "MailSend", t.LaunchCalculator = "LaunchCalculator", t.LaunchCalendar = "LaunchCalendar", t.LaunchContacts = "LaunchContacts", t.LaunchMail = "LaunchMail", t.LaunchMediaPlayer = "LaunchMediaPlayer", t.LaunchMusicPlayer = "LaunchMusicPlayer", t.LaunchMyComputer = "LaunchMyComputer", t.LaunchPhone = "LaunchPhone", t.LaunchScreenSaver = "LaunchScreenSaver", t.LaunchSpreadsheet = "LaunchSpreadsheet", t.LaunchWebBrowser = "LaunchWebBrowser", t.LaunchWebCam = "LaunchWebCam", t.LaunchWordProcessor = "LaunchWordProcessor", t.LaunchApplication1 = "LaunchApplication1", t.LaunchApplication2 = "LaunchApplication2", t.LaunchApplication3 = "LaunchApplication3", t.LaunchApplication4 = "LaunchApplication4", t.LaunchApplication5 = "LaunchApplication5", t.LaunchApplication6 = "LaunchApplication6", t.LaunchApplication7 = "LaunchApplication7", t.LaunchApplication8 = "LaunchApplication8", t.LaunchApplication9 = "LaunchApplication9", t.LaunchApplication10 = "LaunchApplication10", t.LaunchApplication11 = "LaunchApplication11", t.LaunchApplication12 = "LaunchApplication12", t.LaunchApplication13 = "LaunchApplication13", t.LaunchApplication14 = "LaunchApplication14", t.LaunchApplication15 = "LaunchApplication15", t.LaunchApplication16 = "LaunchApplication16", t.BrowserBack = "BrowserBack", t.BrowserFavorites = "BrowserFavorites", t.BrowserForward = "BrowserForward", t.BrowserHome = "BrowserHome", t.BrowserRefresh = "BrowserRefresh", t.BrowserSearch = "BrowserSearch", t.BrowserStop = "BrowserStop", t.Decimal = "Decimal", t.Key11 = "Key11", t.Key12 = "Key12", t.Multiply = "Multiply", t.Add = "Add", t.Divide = "Divide", t.Subtract = "Subtract", t.Separator = "Separator";
|
|
2202
2220
|
}(e.Key || (e.Key = {}));
|
|
2203
2221
|
})(be);
|
|
2204
|
-
const
|
|
2205
|
-
let
|
|
2206
|
-
const
|
|
2207
|
-
let
|
|
2208
|
-
const
|
|
2209
|
-
let
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2212
|
-
|
|
2222
|
+
const Ao = (e, t, n) => {
|
|
2223
|
+
let o;
|
|
2224
|
+
const i = (h) => o = h;
|
|
2225
|
+
let r;
|
|
2226
|
+
const s = (h) => r = h;
|
|
2227
|
+
let a = !0;
|
|
2228
|
+
const d = (h) => a = h, { store: f, selection: g } = t;
|
|
2229
|
+
let l, m, c;
|
|
2230
|
+
const v = (h) => {
|
|
2231
|
+
var M;
|
|
2232
|
+
if (!a || m === !1)
|
|
2213
2233
|
return;
|
|
2214
|
-
|
|
2234
|
+
l = !((M = h.target.parentElement) != null && M.closest(Y)) ? {
|
|
2215
2235
|
annotation: se(),
|
|
2216
2236
|
selector: [],
|
|
2217
|
-
creator:
|
|
2237
|
+
creator: o,
|
|
2218
2238
|
created: /* @__PURE__ */ new Date()
|
|
2219
2239
|
} : void 0;
|
|
2220
2240
|
};
|
|
2221
|
-
|
|
2222
|
-
const
|
|
2223
|
-
var
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2241
|
+
e.addEventListener("selectstart", v);
|
|
2242
|
+
const C = It((h) => {
|
|
2243
|
+
var b, S;
|
|
2244
|
+
if (!a) return;
|
|
2245
|
+
const L = document.getSelection();
|
|
2246
|
+
if (!!((S = (b = L.anchorNode) == null ? void 0 : b.parentElement) != null && S.closest(Y))) {
|
|
2247
|
+
l = void 0;
|
|
2227
2248
|
return;
|
|
2228
2249
|
}
|
|
2229
|
-
if (
|
|
2250
|
+
if (h.timeStamp - ((c == null ? void 0 : c.timeStamp) || h.timeStamp) < 1e3 && !l && v(c || h), L.isCollapsed || !l || m === !1)
|
|
2230
2251
|
return;
|
|
2231
|
-
const
|
|
2232
|
-
if (Ve(
|
|
2233
|
-
const
|
|
2234
|
-
(
|
|
2235
|
-
var
|
|
2236
|
-
return
|
|
2237
|
-
})) && (
|
|
2238
|
-
...
|
|
2239
|
-
selector:
|
|
2252
|
+
const R = L.getRangeAt(0);
|
|
2253
|
+
if (Ve(R)) return;
|
|
2254
|
+
const T = Le(R.cloneRange());
|
|
2255
|
+
(T.length !== l.selector.length || T.some((x, E) => {
|
|
2256
|
+
var B;
|
|
2257
|
+
return x.toString() !== ((B = l.selector[E]) == null ? void 0 : B.quote);
|
|
2258
|
+
})) && (l = {
|
|
2259
|
+
...l,
|
|
2260
|
+
selector: T.map((x) => Fe(x, e, n)),
|
|
2240
2261
|
updated: /* @__PURE__ */ new Date()
|
|
2241
|
-
},
|
|
2242
|
-
id:
|
|
2262
|
+
}, f.getAnnotation(l.annotation) ? f.updateTarget(l, V.LOCAL) : (g.clear(), f.addAnnotation({
|
|
2263
|
+
id: l.annotation,
|
|
2243
2264
|
bodies: [],
|
|
2244
|
-
target:
|
|
2245
|
-
},
|
|
2265
|
+
target: l
|
|
2266
|
+
}, V.LOCAL), g.userSelect(l.annotation, c)));
|
|
2246
2267
|
});
|
|
2247
|
-
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2268
|
+
document.addEventListener("selectionchange", C);
|
|
2269
|
+
const w = (h) => {
|
|
2270
|
+
c = De(h), m = c.button === 0;
|
|
2250
2271
|
};
|
|
2251
|
-
e.addEventListener("pointerdown",
|
|
2252
|
-
const
|
|
2253
|
-
var
|
|
2254
|
-
if (!!((
|
|
2272
|
+
e.addEventListener("pointerdown", w);
|
|
2273
|
+
const p = (h) => {
|
|
2274
|
+
var T;
|
|
2275
|
+
if (!!((T = h.target.parentElement) != null && T.closest(Y)) || !m)
|
|
2255
2276
|
return;
|
|
2256
|
-
const
|
|
2257
|
-
const { x:
|
|
2258
|
-
if (
|
|
2259
|
-
const { selected:
|
|
2260
|
-
(
|
|
2261
|
-
} else
|
|
2262
|
-
},
|
|
2263
|
-
document.getSelection().isCollapsed &&
|
|
2277
|
+
const M = () => {
|
|
2278
|
+
const { x: k, y: b } = e.getBoundingClientRect(), S = f.getAt(h.clientX - k, h.clientY - b, r);
|
|
2279
|
+
if (S) {
|
|
2280
|
+
const { selected: x } = g;
|
|
2281
|
+
(x.length !== 1 || x[0].id !== S.id) && g.userSelect(S.id, h);
|
|
2282
|
+
} else g.isEmpty() || g.clear();
|
|
2283
|
+
}, R = h.timeStamp - c.timeStamp;
|
|
2284
|
+
document.getSelection().isCollapsed && R < 300 ? (l = void 0, M()) : l && g.userSelect(l.annotation, h);
|
|
2264
2285
|
};
|
|
2265
|
-
document.addEventListener("pointerup",
|
|
2266
|
-
|
|
2267
|
-
}), U("*", { keyup: !0, keydown: !1 }, (
|
|
2268
|
-
U.shift &&
|
|
2286
|
+
document.addEventListener("pointerup", p), U("*", { element: e, keyup: !1, keydown: !0 }, (h, L) => {
|
|
2287
|
+
h.repeat || (c = ye(h));
|
|
2288
|
+
}), U("*", { keyup: !0, keydown: !1 }, (h) => {
|
|
2289
|
+
U.shift && h.key === be.Key.Shift && !h.repeat && l && g.userSelect(l.annotation, h);
|
|
2269
2290
|
});
|
|
2270
|
-
let
|
|
2291
|
+
let u = !1;
|
|
2271
2292
|
return U("ctrl+a, ⌘+a", { keyup: !1, keydown: !0 }, () => {
|
|
2272
|
-
|
|
2273
|
-
}), U("*", { keyup: !0, keydown: !1 }, (
|
|
2274
|
-
|
|
2293
|
+
u = !0;
|
|
2294
|
+
}), U("*", { keyup: !0, keydown: !1 }, (h) => {
|
|
2295
|
+
u && !h.repeat && l && g.userSelect(l.annotation, h), u = !1;
|
|
2275
2296
|
}), {
|
|
2276
2297
|
destroy: () => {
|
|
2277
|
-
e.removeEventListener("selectstart",
|
|
2298
|
+
e.removeEventListener("selectstart", v), document.removeEventListener("selectionchange", C), e.removeEventListener("pointerdown", w), document.removeEventListener("pointerup", p), U.unbind();
|
|
2278
2299
|
},
|
|
2279
|
-
setFilter:
|
|
2280
|
-
setUser:
|
|
2300
|
+
setFilter: s,
|
|
2301
|
+
setUser: i,
|
|
2302
|
+
setAnnotatingEnabled: d
|
|
2281
2303
|
};
|
|
2282
2304
|
}, ee = "SPANS", To = (e, t = {}) => {
|
|
2283
|
-
|
|
2284
|
-
const n =
|
|
2305
|
+
Ee(e), Te(e);
|
|
2306
|
+
const n = ao(t, {
|
|
2285
2307
|
annotatingEnabled: !0,
|
|
2286
2308
|
user: yn()
|
|
2287
|
-
}), o =
|
|
2288
|
-
let
|
|
2289
|
-
const
|
|
2290
|
-
if (!
|
|
2291
|
-
throw `Unknown renderer implementation: ${
|
|
2292
|
-
console.debug(`Using ${
|
|
2293
|
-
const m =
|
|
2294
|
-
m.setUser(
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
}, w = (
|
|
2298
|
-
|
|
2299
|
-
},
|
|
2300
|
-
|
|
2301
|
-
},
|
|
2302
|
-
|
|
2309
|
+
}), o = no(e, n.userSelectAction), { selection: i, viewport: r } = o, s = o.store, a = Bn(s), d = Rn(o, a, n.adapter);
|
|
2310
|
+
let f = n.user;
|
|
2311
|
+
const g = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ee : n.renderer || ee, l = g === "SPANS" ? on(e, o, r) : g === "CSS_HIGHLIGHTS" ? tn(e, o, r) : g === "CANVAS" ? $e(e, o, r) : void 0;
|
|
2312
|
+
if (!l)
|
|
2313
|
+
throw `Unknown renderer implementation: ${g}`;
|
|
2314
|
+
console.debug(`Using ${g} renderer`), n.style && l.setStyle(n.style);
|
|
2315
|
+
const m = Ao(e, o, n.offsetReferenceSelector);
|
|
2316
|
+
m.setUser(f), m.setAnnotatingEnabled(n.annotatingEnabled);
|
|
2317
|
+
const c = On(o, a, n.adapter), v = () => f, C = (L) => {
|
|
2318
|
+
m.setAnnotatingEnabled(L);
|
|
2319
|
+
}, w = (L) => {
|
|
2320
|
+
l.setFilter(L), m.setFilter(L);
|
|
2321
|
+
}, p = (L) => {
|
|
2322
|
+
f = L, m.setUser(L);
|
|
2323
|
+
}, u = (L) => {
|
|
2324
|
+
L && (l.setPainter(io(e, L, n.presence)), L.on("selectionChange", () => l.redraw()));
|
|
2325
|
+
}, A = (L) => {
|
|
2326
|
+
L ? i.setSelected(L) : i.clear();
|
|
2303
2327
|
};
|
|
2304
2328
|
return {
|
|
2305
|
-
...
|
|
2329
|
+
...c,
|
|
2306
2330
|
destroy: () => {
|
|
2307
|
-
|
|
2331
|
+
l.destroy(), m.destroy(), a.destroy();
|
|
2308
2332
|
},
|
|
2309
2333
|
element: e,
|
|
2310
2334
|
getUser: v,
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2335
|
+
setAnnotatingEnabled: C,
|
|
2336
|
+
setFilter: w,
|
|
2337
|
+
setStyle: l.setStyle.bind(l),
|
|
2338
|
+
redraw: l.redraw.bind(l),
|
|
2339
|
+
setUser: p,
|
|
2340
|
+
setSelected: A,
|
|
2341
|
+
setPresenceProvider: u,
|
|
2342
|
+
setVisible: l.setVisible.bind(l),
|
|
2343
|
+
on: d.on,
|
|
2344
|
+
off: d.off,
|
|
2345
|
+
scrollIntoView: ro(e, s),
|
|
2321
2346
|
state: o
|
|
2322
2347
|
};
|
|
2323
2348
|
};
|
|
@@ -2326,24 +2351,24 @@ export {
|
|
|
2326
2351
|
q as DEFAULT_STYLE,
|
|
2327
2352
|
ne as NOT_ANNOTATABLE_CLASS,
|
|
2328
2353
|
Y as NOT_ANNOTATABLE_SELECTOR,
|
|
2329
|
-
|
|
2354
|
+
V as Origin,
|
|
2330
2355
|
un as UserSelectAction,
|
|
2331
|
-
|
|
2332
|
-
|
|
2356
|
+
Eo as W3CTextFormat,
|
|
2357
|
+
Ee as cancelSingleClickEvents,
|
|
2333
2358
|
ye as cloneKeyboardEvent,
|
|
2334
2359
|
De as clonePointerEvent,
|
|
2335
|
-
|
|
2360
|
+
Lo as createBody,
|
|
2336
2361
|
$e as createCanvasRenderer,
|
|
2337
2362
|
tn as createHighlightsRenderer,
|
|
2338
2363
|
Ke as createRenderer,
|
|
2339
2364
|
on as createSpansRenderer,
|
|
2340
2365
|
To as createTextAnnotator,
|
|
2341
|
-
|
|
2366
|
+
no as createTextAnnotatorState,
|
|
2342
2367
|
It as debounce,
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2368
|
+
xo as denormalizeRectWithOffset,
|
|
2369
|
+
ao as fillDefaults,
|
|
2370
|
+
vo as getAnnotatableFragment,
|
|
2371
|
+
So as getClientRectsPonyfill,
|
|
2347
2372
|
ke as getQuoteContext,
|
|
2348
2373
|
Rt as getRangeAnnotatableContents,
|
|
2349
2374
|
W as isRevived,
|
|
@@ -2352,14 +2377,14 @@ export {
|
|
|
2352
2377
|
Pe as normalizeRectWithOffset,
|
|
2353
2378
|
Se as paint,
|
|
2354
2379
|
$n as parseW3CTextAnnotation,
|
|
2355
|
-
|
|
2380
|
+
Te as programmaticallyFocusable,
|
|
2356
2381
|
Fe as rangeToSelector,
|
|
2357
2382
|
bt as reviveAnnotation,
|
|
2358
2383
|
oe as reviveSelector,
|
|
2359
2384
|
mt as reviveTarget,
|
|
2360
2385
|
jn as serializeW3CTextAnnotation,
|
|
2361
2386
|
Le as splitAnnotatableRanges,
|
|
2362
|
-
|
|
2387
|
+
Co as toDomRectList,
|
|
2363
2388
|
Re as whitespaceOrEmptyRegex
|
|
2364
2389
|
};
|
|
2365
2390
|
//# sourceMappingURL=text-annotator.es.js.map
|