@soomo/text-annotator 3.0.0-staging.10 → 3.0.0-staging.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const
|
|
1
|
+
const $ = {
|
|
2
2
|
fill: "rgb(0, 128, 255)",
|
|
3
3
|
fillOpacity: 0.18
|
|
4
|
-
},
|
|
4
|
+
}, et = {
|
|
5
5
|
fill: "rgb(0, 128, 255)",
|
|
6
6
|
fillOpacity: 0.45
|
|
7
7
|
}, qt = (t, e, n, o, i) => {
|
|
8
8
|
var a, s;
|
|
9
|
-
const r = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ?
|
|
9
|
+
const r = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ? et : $) : n : (s = t.state) != null && s.selected ? et : $;
|
|
10
10
|
return o && o.paint(t, e) || r;
|
|
11
|
-
},
|
|
11
|
+
}, Ot = "not-annotatable", k = `.${Ot}`, jt = (t) => {
|
|
12
12
|
var n;
|
|
13
13
|
const e = t.commonAncestorContainer;
|
|
14
|
-
return e instanceof HTMLElement ? !e.closest(
|
|
14
|
+
return e instanceof HTMLElement ? !e.closest(k) : !((n = e.parentElement) != null && n.closest(k));
|
|
15
15
|
}, Gt = function* (t) {
|
|
16
16
|
const e = document.createNodeIterator(
|
|
17
17
|
t.commonAncestorContainer,
|
|
18
18
|
NodeFilter.SHOW_ELEMENT,
|
|
19
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
19
|
+
(o) => o instanceof HTMLElement && o.classList.contains(Ot) && !o.parentElement.closest(k) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
20
20
|
);
|
|
21
21
|
let n;
|
|
22
22
|
for (; n = e.nextNode(); )
|
|
@@ -35,23 +35,23 @@ const P = {
|
|
|
35
35
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
36
36
|
}
|
|
37
37
|
return e.length > 0 ? e : [t];
|
|
38
|
-
},
|
|
38
|
+
}, ut = (t) => {
|
|
39
39
|
const e = t.cloneContents();
|
|
40
|
-
return e.querySelectorAll(
|
|
40
|
+
return e.querySelectorAll(k).forEach((n) => n.remove()), e;
|
|
41
41
|
}, Qt = (t) => {
|
|
42
42
|
t.addEventListener("click", (e) => {
|
|
43
43
|
// Allow clicks within not-annotatable elements
|
|
44
|
-
!e.target.closest(
|
|
44
|
+
!e.target.closest(k) && !e.target.closest("a") && e.preventDefault();
|
|
45
45
|
});
|
|
46
|
-
},
|
|
46
|
+
}, ft = (t, e = 10) => {
|
|
47
47
|
let n;
|
|
48
48
|
return (...o) => {
|
|
49
49
|
clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);
|
|
50
50
|
};
|
|
51
|
-
},
|
|
51
|
+
}, In = (t) => {
|
|
52
52
|
const e = t.cloneContents();
|
|
53
|
-
return e.querySelectorAll(
|
|
54
|
-
},
|
|
53
|
+
return e.querySelectorAll(k).forEach((n) => n.remove()), e;
|
|
54
|
+
}, mt = (t, e) => {
|
|
55
55
|
const n = document.createNodeIterator(e);
|
|
56
56
|
let o = 0, i = n.nextNode();
|
|
57
57
|
for (; i !== null; ) {
|
|
@@ -59,7 +59,7 @@ const P = {
|
|
|
59
59
|
return o;
|
|
60
60
|
o += 1, i = n.nextNode();
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, bt = (t, e) => {
|
|
63
63
|
const n = document.createNodeIterator(e);
|
|
64
64
|
let o = null;
|
|
65
65
|
for (let i = 0; i < t + 1; i++)
|
|
@@ -72,31 +72,31 @@ const P = {
|
|
|
72
72
|
startOffset: o,
|
|
73
73
|
endContainer: i,
|
|
74
74
|
endOffset: r
|
|
75
|
-
} = t, a = Array.from(e.childNodes).map((
|
|
76
|
-
const
|
|
77
|
-
return
|
|
78
|
-
}), s =
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
return t.setStart(
|
|
83
|
-
},
|
|
84
|
-
const
|
|
85
|
-
return
|
|
75
|
+
} = t, a = Array.from(e.childNodes).map((c) => {
|
|
76
|
+
const m = c.cloneNode(!0);
|
|
77
|
+
return c.nodeName === "CANVAS" ? c : m;
|
|
78
|
+
}), s = mt(n, e), h = mt(i, e), f = () => {
|
|
79
|
+
const c = e;
|
|
80
|
+
c.replaceChildren(...a);
|
|
81
|
+
const m = bt(s, c), g = bt(h, c);
|
|
82
|
+
return t.setStart(m, o), t.setEnd(g, r), t;
|
|
83
|
+
}, b = (c) => {
|
|
84
|
+
const m = document.createElement("SPAN");
|
|
85
|
+
return c.surroundContents(m), m;
|
|
86
86
|
};
|
|
87
87
|
if (n === i)
|
|
88
88
|
throw "Not implemented";
|
|
89
89
|
{
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
const
|
|
90
|
+
const c = document.createRange();
|
|
91
|
+
c.selectNodeContents(n), c.setStart(n, o);
|
|
92
|
+
const m = b(c), g = document.createRange();
|
|
93
93
|
g.selectNode(i), g.setEnd(i, r);
|
|
94
|
-
const x =
|
|
94
|
+
const x = b(g), d = Zt(t).reverse().map((u) => {
|
|
95
95
|
var v;
|
|
96
|
-
const
|
|
97
|
-
return (v =
|
|
96
|
+
const l = document.createElement("SPAN");
|
|
97
|
+
return (v = u.parentNode) == null || v.insertBefore(l, u), l.appendChild(u), l;
|
|
98
98
|
});
|
|
99
|
-
return { unwrap: f, nodes: [
|
|
99
|
+
return { unwrap: f, nodes: [m, ...d, x] };
|
|
100
100
|
}
|
|
101
101
|
}, Zt = (t) => {
|
|
102
102
|
const {
|
|
@@ -120,14 +120,14 @@ const P = {
|
|
|
120
120
|
}, te = (t, e, n = 10, o) => {
|
|
121
121
|
const i = o ? t.startContainer.parentElement.closest(o) : e, r = document.createRange();
|
|
122
122
|
r.setStart(i, 0), r.setEnd(t.startContainer, t.startOffset);
|
|
123
|
-
const a =
|
|
123
|
+
const a = ut(r).textContent, s = document.createRange();
|
|
124
124
|
s.setStart(t.endContainer, t.endOffset), i === document.body ? s.setEnd(i, i.childNodes.length) : s.setEndAfter(i);
|
|
125
|
-
const h =
|
|
125
|
+
const h = ut(s).textContent;
|
|
126
126
|
return {
|
|
127
127
|
prefix: a.substring(a.length - n),
|
|
128
128
|
suffix: h.substring(0, n)
|
|
129
129
|
};
|
|
130
|
-
}, ee = /^\s*$/, ne = (t) => ee.test(t.toString()),
|
|
130
|
+
}, ee = /^\s*$/, ne = (t) => ee.test(t.toString()), D = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), oe = (t, e) => {
|
|
131
131
|
const n = (r) => Math.round(r * 10) / 10, o = {
|
|
132
132
|
top: n(t.top),
|
|
133
133
|
bottom: n(t.bottom),
|
|
@@ -178,16 +178,16 @@ const P = {
|
|
|
178
178
|
}, []), se = (t, e, n) => {
|
|
179
179
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
180
180
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
181
|
-
const r =
|
|
181
|
+
const r = ut(o).textContent, a = t.toString(), s = r.length || 0, h = s + a.length;
|
|
182
182
|
return n ? { quote: a, start: s, end: h, range: t, offsetReference: i } : { quote: a, start: s, end: h, range: t };
|
|
183
|
-
},
|
|
184
|
-
var
|
|
183
|
+
}, Nt = (t, e) => {
|
|
184
|
+
var b, c;
|
|
185
185
|
const { start: n, end: o } = t, i = t.offsetReference || e, r = document.createNodeIterator(
|
|
186
186
|
e,
|
|
187
187
|
NodeFilter.SHOW_TEXT,
|
|
188
|
-
(
|
|
188
|
+
(m) => {
|
|
189
189
|
var g;
|
|
190
|
-
return (g =
|
|
190
|
+
return (g = m.parentElement) != null && g.closest(k) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
191
191
|
}
|
|
192
192
|
);
|
|
193
193
|
let a = 0;
|
|
@@ -197,125 +197,125 @@ const P = {
|
|
|
197
197
|
let f = !i;
|
|
198
198
|
for (; h !== null; ) {
|
|
199
199
|
if (f || (f = i == null ? void 0 : i.contains(h)), f) {
|
|
200
|
-
const
|
|
201
|
-
if (a +
|
|
200
|
+
const m = ((b = h.textContent) == null ? void 0 : b.length) || 0;
|
|
201
|
+
if (a + m > n) {
|
|
202
202
|
s.setStart(h, n - a);
|
|
203
203
|
break;
|
|
204
204
|
}
|
|
205
|
-
a +=
|
|
205
|
+
a += m;
|
|
206
206
|
}
|
|
207
207
|
h = r.nextNode();
|
|
208
208
|
}
|
|
209
209
|
for (; h !== null; ) {
|
|
210
|
-
const
|
|
211
|
-
if (a +
|
|
210
|
+
const m = ((c = h.textContent) == null ? void 0 : c.length) || 0;
|
|
211
|
+
if (a + m >= o) {
|
|
212
212
|
s.setEnd(h, o - a);
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
|
-
a +=
|
|
215
|
+
a += m, h = r.nextNode();
|
|
216
216
|
}
|
|
217
217
|
return {
|
|
218
218
|
...t,
|
|
219
219
|
range: s
|
|
220
220
|
};
|
|
221
|
-
},
|
|
221
|
+
}, nt = (t, e) => D(t.selector) ? t : {
|
|
222
222
|
...t,
|
|
223
|
-
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
224
|
-
},
|
|
223
|
+
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : Nt(n, e))
|
|
224
|
+
}, ot = (t, e) => D(t.target.selector) ? t : { ...t, target: nt(t.target, e) }, ae = (t) => {
|
|
225
225
|
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, a = -e, s = o - n, h = i - e;
|
|
226
226
|
return { top: e, left: n, minX: r, minY: a, maxX: s, maxY: h };
|
|
227
|
-
},
|
|
227
|
+
}, le = (t) => {
|
|
228
228
|
let e = /* @__PURE__ */ new Set();
|
|
229
229
|
return (o) => {
|
|
230
230
|
const i = o.map((r) => r.id);
|
|
231
231
|
(e.size !== i.length || i.some((r) => !e.has(r))) && t.set(i), e = new Set(i);
|
|
232
232
|
};
|
|
233
|
-
},
|
|
233
|
+
}, gt = (t, e, n, o) => {
|
|
234
234
|
const { store: i, selection: r, hover: a } = e;
|
|
235
235
|
let s, h, f;
|
|
236
|
-
const
|
|
237
|
-
const { x:
|
|
238
|
-
|
|
236
|
+
const b = le(n), c = (p) => {
|
|
237
|
+
const { x: A, y: w } = t.getBoundingClientRect(), S = i.getAt(p.clientX - A, p.clientY - w);
|
|
238
|
+
S && (!h || h(S)) ? a.current !== S.id && (t.classList.add("hovered"), a.set(S.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
|
|
239
239
|
};
|
|
240
|
-
t.addEventListener("pointermove",
|
|
241
|
-
const
|
|
240
|
+
t.addEventListener("pointermove", c);
|
|
241
|
+
const m = (p = !1) => {
|
|
242
242
|
f && f.clear();
|
|
243
|
-
const
|
|
244
|
-
const Ft =
|
|
245
|
-
return { annotation:
|
|
243
|
+
const A = ae(t), { minX: w, minY: S, maxX: B, maxY: I } = A, Y = h ? i.getIntersecting(w, S, B, I).filter(({ annotation: _ }) => h(_)) : i.getIntersecting(w, S, B, I), Ht = r.selected.map(({ id: _ }) => _), Pt = Y.map(({ annotation: _, rects: zt }) => {
|
|
244
|
+
const Ft = Ht.includes(_.id), Wt = _.id === a.current;
|
|
245
|
+
return { annotation: _, rects: zt, state: { selected: Ft, hover: Wt, custom: {} } };
|
|
246
246
|
});
|
|
247
|
-
o.redraw(
|
|
248
|
-
}, g = (
|
|
249
|
-
f =
|
|
250
|
-
}, x = (
|
|
251
|
-
s =
|
|
252
|
-
}, y = (
|
|
253
|
-
h =
|
|
254
|
-
},
|
|
255
|
-
i.observe(
|
|
256
|
-
const
|
|
257
|
-
document.addEventListener("scroll",
|
|
258
|
-
const v =
|
|
259
|
-
i.recalculatePositions(), f && f.reset(),
|
|
247
|
+
o.redraw(Pt, A, s, f, p), setTimeout(() => b(Y.map(({ annotation: _ }) => _)), 1);
|
|
248
|
+
}, g = (p) => {
|
|
249
|
+
f = p, m();
|
|
250
|
+
}, x = (p) => {
|
|
251
|
+
s = p, m();
|
|
252
|
+
}, y = (p) => {
|
|
253
|
+
h = p, m(!1);
|
|
254
|
+
}, d = () => m();
|
|
255
|
+
i.observe(d);
|
|
256
|
+
const u = r.subscribe(() => m()), l = () => m(!0);
|
|
257
|
+
document.addEventListener("scroll", l, { capture: !0, passive: !0 });
|
|
258
|
+
const v = ft(() => {
|
|
259
|
+
i.recalculatePositions(), f && f.reset(), m();
|
|
260
260
|
});
|
|
261
261
|
window.addEventListener("resize", v);
|
|
262
262
|
const C = new ResizeObserver(v);
|
|
263
263
|
C.observe(t);
|
|
264
|
-
const L = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((
|
|
265
|
-
|
|
264
|
+
const L = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((p) => {
|
|
265
|
+
p.every((w) => w.target === t || t.contains(w.target)) || m(!0);
|
|
266
266
|
});
|
|
267
267
|
return E.observe(document.body, L), {
|
|
268
268
|
destroy: () => {
|
|
269
|
-
t.removeEventListener("pointermove",
|
|
269
|
+
t.removeEventListener("pointermove", c), o.destroy(), i.unobserve(d), u(), document.removeEventListener("scroll", l), window.removeEventListener("resize", v), C.disconnect(), E.disconnect();
|
|
270
270
|
},
|
|
271
|
-
redraw:
|
|
271
|
+
redraw: m,
|
|
272
272
|
setStyle: x,
|
|
273
273
|
setFilter: y,
|
|
274
274
|
setPainter: g,
|
|
275
275
|
setVisible: o.setVisible
|
|
276
276
|
};
|
|
277
|
-
},
|
|
277
|
+
}, ce = () => {
|
|
278
278
|
const t = document.createElement("canvas");
|
|
279
279
|
return t.width = window.innerWidth, t.height = window.innerHeight, t.className = "r6o-highlight-layer bg", t;
|
|
280
280
|
}, de = (t, e) => {
|
|
281
281
|
t.width = window.innerWidth, t.height = window.innerHeight;
|
|
282
282
|
}, ue = (t) => {
|
|
283
283
|
t.classList.add("r6o-annotatable");
|
|
284
|
-
const e =
|
|
284
|
+
const e = ce(), n = e.getContext("2d");
|
|
285
285
|
t.insertBefore(e, t.firstChild);
|
|
286
|
-
const o = (s, h, f,
|
|
287
|
-
const { width:
|
|
288
|
-
n.clearRect(-0.5, -0.5,
|
|
286
|
+
const o = (s, h, f, b) => requestAnimationFrame(() => {
|
|
287
|
+
const { width: c, height: m } = e;
|
|
288
|
+
n.clearRect(-0.5, -0.5, c + 1, m + 1), b && b.clear();
|
|
289
289
|
const { top: g, left: x } = h;
|
|
290
|
-
[...s].sort((
|
|
291
|
-
const { annotation: { target: { created:
|
|
292
|
-
return
|
|
293
|
-
}).forEach((
|
|
290
|
+
[...s].sort((d, u) => {
|
|
291
|
+
const { annotation: { target: { created: l } } } = d, { annotation: { target: { created: v } } } = u;
|
|
292
|
+
return l.getTime() - v.getTime();
|
|
293
|
+
}).forEach((d) => {
|
|
294
294
|
var L;
|
|
295
|
-
const
|
|
295
|
+
const u = f ? typeof f == "function" ? f(d.annotation, d.state) : f : (L = d.state) != null && L.selected ? et : $, l = b && b.paint(d, h) || u, v = d.rects.map(({ x: E, y: T, width: p, height: A }) => ({
|
|
296
296
|
x: E + x,
|
|
297
|
-
y:
|
|
298
|
-
width:
|
|
299
|
-
height:
|
|
297
|
+
y: T + g,
|
|
298
|
+
width: p,
|
|
299
|
+
height: A
|
|
300
300
|
}));
|
|
301
|
-
n.fillStyle =
|
|
301
|
+
n.fillStyle = l.fill, n.globalAlpha = l.fillOpacity || 1;
|
|
302
302
|
const C = 5;
|
|
303
303
|
if (v.forEach(
|
|
304
|
-
({ x: E, y:
|
|
304
|
+
({ x: E, y: T, width: p, height: A }) => n.fillRect(
|
|
305
305
|
E,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
T - C / 2,
|
|
307
|
+
p,
|
|
308
|
+
A + C
|
|
309
309
|
)
|
|
310
|
-
),
|
|
311
|
-
n.globalAlpha = 1, n.strokeStyle =
|
|
312
|
-
const E = C / 2 + (
|
|
313
|
-
v.forEach(({ x:
|
|
314
|
-
n.beginPath(), n.moveTo(
|
|
310
|
+
), l.underlineColor) {
|
|
311
|
+
n.globalAlpha = 1, n.strokeStyle = l.underlineColor, n.lineWidth = l.underlineThickness ?? 1;
|
|
312
|
+
const E = C / 2 + (l.underlineOffset ?? 0);
|
|
313
|
+
v.forEach(({ x: T, y: p, width: A, height: w }) => {
|
|
314
|
+
n.beginPath(), n.moveTo(T, p + w + E), n.lineTo(T + A, p + w + E), n.stroke();
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
|
-
}), i =
|
|
318
|
+
}), i = ft(() => {
|
|
319
319
|
de(e);
|
|
320
320
|
});
|
|
321
321
|
return window.addEventListener("resize", i), {
|
|
@@ -327,70 +327,70 @@ const P = {
|
|
|
327
327
|
},
|
|
328
328
|
redraw: o
|
|
329
329
|
};
|
|
330
|
-
}, he = (t, e, n) =>
|
|
330
|
+
}, he = (t, e, n) => gt(t, e, n, ue(t));
|
|
331
331
|
var fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
332
332
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
333
|
-
},
|
|
333
|
+
}, M = function(t, e, n) {
|
|
334
334
|
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
|
|
335
|
-
},
|
|
335
|
+
}, U = function(t, e, n) {
|
|
336
336
|
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
|
|
337
|
-
},
|
|
337
|
+
}, Ut = function(t) {
|
|
338
338
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
339
|
-
},
|
|
340
|
-
return { r:
|
|
341
|
-
},
|
|
342
|
-
return { r:
|
|
343
|
-
}, ge = /^#([0-9a-f]{3,8})$/i,
|
|
339
|
+
}, vt = function(t) {
|
|
340
|
+
return { r: U(t.r, 0, 255), g: U(t.g, 0, 255), b: U(t.b, 0, 255), a: U(t.a) };
|
|
341
|
+
}, it = function(t) {
|
|
342
|
+
return { r: M(t.r), g: M(t.g), b: M(t.b), a: M(t.a, 3) };
|
|
343
|
+
}, ge = /^#([0-9a-f]{3,8})$/i, K = function(t) {
|
|
344
344
|
var e = t.toString(16);
|
|
345
345
|
return e.length < 2 ? "0" + e : e;
|
|
346
|
-
},
|
|
346
|
+
}, Vt = function(t) {
|
|
347
347
|
var e = t.r, n = t.g, o = t.b, i = t.a, r = Math.max(e, n, o), a = r - Math.min(e, n, o), s = a ? r === e ? (n - o) / a : r === n ? 2 + (o - e) / a : 4 + (e - n) / a : 0;
|
|
348
348
|
return { h: 60 * (s < 0 ? s + 6 : s), s: r ? a / r * 100 : 0, v: r / 255 * 100, a: i };
|
|
349
|
-
},
|
|
349
|
+
}, kt = function(t) {
|
|
350
350
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
351
351
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
352
352
|
var r = Math.floor(e), a = o * (1 - n), s = o * (1 - (e - r) * n), h = o * (1 - (1 - e + r) * n), f = r % 6;
|
|
353
353
|
return { r: 255 * [o, s, a, a, h, o][f], g: 255 * [h, o, o, s, a, a][f], b: 255 * [a, a, h, o, o, s][f], a: i };
|
|
354
|
+
}, yt = function(t) {
|
|
355
|
+
return { h: Ut(t.h), s: U(t.s, 0, 100), l: U(t.l, 0, 100), a: U(t.a) };
|
|
356
|
+
}, wt = function(t) {
|
|
357
|
+
return { h: M(t.h), s: M(t.s), l: M(t.l), a: M(t.a, 3) };
|
|
354
358
|
}, xt = function(t) {
|
|
355
|
-
return { h:
|
|
356
|
-
}, At = function(t) {
|
|
357
|
-
return { h: I(t.h), s: I(t.s), l: I(t.l), a: I(t.a, 3) };
|
|
358
|
-
}, Et = function(t) {
|
|
359
|
-
return _t((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
|
|
359
|
+
return kt((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
|
|
360
360
|
var e, n, o;
|
|
361
|
-
},
|
|
362
|
-
return { h: (e =
|
|
361
|
+
}, G = function(t) {
|
|
362
|
+
return { h: (e = Vt(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
|
|
363
363
|
var e, n, o, i;
|
|
364
|
-
}, pe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, me = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, be = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ve = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,
|
|
364
|
+
}, pe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, me = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, be = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ve = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, At = { string: [[function(t) {
|
|
365
365
|
var e = ge.exec(t);
|
|
366
|
-
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ?
|
|
366
|
+
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? M(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? M(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
367
367
|
}, "hex"], [function(t) {
|
|
368
368
|
var e = be.exec(t) || ve.exec(t);
|
|
369
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null :
|
|
369
|
+
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : vt({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
|
|
370
370
|
}, "rgb"], [function(t) {
|
|
371
371
|
var e = pe.exec(t) || me.exec(t);
|
|
372
372
|
if (!e)
|
|
373
373
|
return null;
|
|
374
|
-
var n, o, i =
|
|
375
|
-
return
|
|
374
|
+
var n, o, i = yt({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (fe[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
|
|
375
|
+
return xt(i);
|
|
376
376
|
}, "hsl"]], object: [[function(t) {
|
|
377
377
|
var e = t.r, n = t.g, o = t.b, i = t.a, r = i === void 0 ? 1 : i;
|
|
378
|
-
return X(e) && X(n) && X(o) ?
|
|
378
|
+
return X(e) && X(n) && X(o) ? vt({ r: Number(e), g: Number(n), b: Number(o), a: Number(r) }) : null;
|
|
379
379
|
}, "rgb"], [function(t) {
|
|
380
380
|
var e = t.h, n = t.s, o = t.l, i = t.a, r = i === void 0 ? 1 : i;
|
|
381
381
|
if (!X(e) || !X(n) || !X(o))
|
|
382
382
|
return null;
|
|
383
|
-
var a =
|
|
384
|
-
return
|
|
383
|
+
var a = yt({ h: Number(e), s: Number(n), l: Number(o), a: Number(r) });
|
|
384
|
+
return xt(a);
|
|
385
385
|
}, "hsl"], [function(t) {
|
|
386
386
|
var e = t.h, n = t.s, o = t.v, i = t.a, r = i === void 0 ? 1 : i;
|
|
387
387
|
if (!X(e) || !X(n) || !X(o))
|
|
388
388
|
return null;
|
|
389
389
|
var a = function(s) {
|
|
390
|
-
return { h:
|
|
390
|
+
return { h: Ut(s.h), s: U(s.s, 0, 100), v: U(s.v, 0, 100), a: U(s.a) };
|
|
391
391
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(r) });
|
|
392
|
-
return
|
|
393
|
-
}, "hsv"]] },
|
|
392
|
+
return kt(a);
|
|
393
|
+
}, "hsv"]] }, Et = function(t, e) {
|
|
394
394
|
for (var n = 0; n < e.length; n++) {
|
|
395
395
|
var o = e[n][0](t);
|
|
396
396
|
if (o)
|
|
@@ -398,72 +398,72 @@ var fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
|
398
398
|
}
|
|
399
399
|
return [null, void 0];
|
|
400
400
|
}, ye = function(t) {
|
|
401
|
-
return typeof t == "string" ?
|
|
402
|
-
},
|
|
403
|
-
var n =
|
|
404
|
-
return { h: n.h, s:
|
|
405
|
-
},
|
|
401
|
+
return typeof t == "string" ? Et(t.trim(), At.string) : typeof t == "object" && t !== null ? Et(t, At.object) : [null, void 0];
|
|
402
|
+
}, rt = function(t, e) {
|
|
403
|
+
var n = G(t);
|
|
404
|
+
return { h: n.h, s: U(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
405
|
+
}, st = function(t) {
|
|
406
406
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
407
|
-
},
|
|
408
|
-
var n =
|
|
409
|
-
return { h: n.h, s: n.s, l:
|
|
410
|
-
},
|
|
407
|
+
}, St = function(t, e) {
|
|
408
|
+
var n = G(t);
|
|
409
|
+
return { h: n.h, s: n.s, l: U(n.l + 100 * e, 0, 100), a: n.a };
|
|
410
|
+
}, Ct = function() {
|
|
411
411
|
function t(e) {
|
|
412
412
|
this.parsed = ye(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
413
413
|
}
|
|
414
414
|
return t.prototype.isValid = function() {
|
|
415
415
|
return this.parsed !== null;
|
|
416
416
|
}, t.prototype.brightness = function() {
|
|
417
|
-
return
|
|
417
|
+
return M(st(this.rgba), 2);
|
|
418
418
|
}, t.prototype.isDark = function() {
|
|
419
|
-
return
|
|
419
|
+
return st(this.rgba) < 0.5;
|
|
420
420
|
}, t.prototype.isLight = function() {
|
|
421
|
-
return
|
|
421
|
+
return st(this.rgba) >= 0.5;
|
|
422
422
|
}, t.prototype.toHex = function() {
|
|
423
|
-
return e =
|
|
423
|
+
return e = it(this.rgba), n = e.r, o = e.g, i = e.b, a = (r = e.a) < 1 ? K(M(255 * r)) : "", "#" + K(n) + K(o) + K(i) + a;
|
|
424
424
|
var e, n, o, i, r, a;
|
|
425
425
|
}, t.prototype.toRgb = function() {
|
|
426
|
-
return
|
|
426
|
+
return it(this.rgba);
|
|
427
427
|
}, t.prototype.toRgbString = function() {
|
|
428
|
-
return e =
|
|
428
|
+
return e = it(this.rgba), n = e.r, o = e.g, i = e.b, (r = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + r + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
429
429
|
var e, n, o, i, r;
|
|
430
430
|
}, t.prototype.toHsl = function() {
|
|
431
|
-
return
|
|
431
|
+
return wt(G(this.rgba));
|
|
432
432
|
}, t.prototype.toHslString = function() {
|
|
433
|
-
return e =
|
|
433
|
+
return e = wt(G(this.rgba)), n = e.h, o = e.s, i = e.l, (r = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + r + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
|
|
434
434
|
var e, n, o, i, r;
|
|
435
435
|
}, t.prototype.toHsv = function() {
|
|
436
|
-
return e =
|
|
436
|
+
return e = Vt(this.rgba), { h: M(e.h), s: M(e.s), v: M(e.v), a: M(e.a, 3) };
|
|
437
437
|
var e;
|
|
438
438
|
}, t.prototype.invert = function() {
|
|
439
|
-
return
|
|
439
|
+
return V({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
440
440
|
var e;
|
|
441
441
|
}, t.prototype.saturate = function(e) {
|
|
442
|
-
return e === void 0 && (e = 0.1),
|
|
442
|
+
return e === void 0 && (e = 0.1), V(rt(this.rgba, e));
|
|
443
443
|
}, t.prototype.desaturate = function(e) {
|
|
444
|
-
return e === void 0 && (e = 0.1),
|
|
444
|
+
return e === void 0 && (e = 0.1), V(rt(this.rgba, -e));
|
|
445
445
|
}, t.prototype.grayscale = function() {
|
|
446
|
-
return
|
|
446
|
+
return V(rt(this.rgba, -1));
|
|
447
447
|
}, t.prototype.lighten = function(e) {
|
|
448
|
-
return e === void 0 && (e = 0.1),
|
|
448
|
+
return e === void 0 && (e = 0.1), V(St(this.rgba, e));
|
|
449
449
|
}, t.prototype.darken = function(e) {
|
|
450
|
-
return e === void 0 && (e = 0.1),
|
|
450
|
+
return e === void 0 && (e = 0.1), V(St(this.rgba, -e));
|
|
451
451
|
}, t.prototype.rotate = function(e) {
|
|
452
452
|
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
453
453
|
}, t.prototype.alpha = function(e) {
|
|
454
|
-
return typeof e == "number" ?
|
|
454
|
+
return typeof e == "number" ? V({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : M(this.rgba.a, 3);
|
|
455
455
|
var n;
|
|
456
456
|
}, t.prototype.hue = function(e) {
|
|
457
|
-
var n =
|
|
458
|
-
return typeof e == "number" ?
|
|
457
|
+
var n = G(this.rgba);
|
|
458
|
+
return typeof e == "number" ? V({ h: e, s: n.s, l: n.l, a: n.a }) : M(n.h);
|
|
459
459
|
}, t.prototype.isEqual = function(e) {
|
|
460
|
-
return this.toHex() ===
|
|
460
|
+
return this.toHex() === V(e).toHex();
|
|
461
461
|
}, t;
|
|
462
|
-
}(),
|
|
463
|
-
return t instanceof
|
|
462
|
+
}(), V = function(t) {
|
|
463
|
+
return t instanceof Ct ? t : new Ct(t);
|
|
464
464
|
};
|
|
465
465
|
const we = (t) => [
|
|
466
|
-
`background-color:${
|
|
466
|
+
`background-color:${V((t == null ? void 0 : t.fill) || $.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? $.fillOpacity : t.fillOpacity).toHex()}`,
|
|
467
467
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
468
468
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
469
469
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
@@ -481,23 +481,23 @@ const we = (t) => [
|
|
|
481
481
|
},
|
|
482
482
|
redraw: (r, a, s, h) => {
|
|
483
483
|
h && h.clear();
|
|
484
|
-
const f = new Set(r.map((
|
|
485
|
-
Array.from(e).filter((
|
|
486
|
-
const
|
|
484
|
+
const f = new Set(r.map((c) => c.annotation.id));
|
|
485
|
+
Array.from(e).filter((c) => !f.has(c));
|
|
486
|
+
const b = r.map((c) => {
|
|
487
487
|
var x;
|
|
488
|
-
const
|
|
489
|
-
return `::highlight(_${
|
|
488
|
+
const m = s ? typeof s == "function" ? s(c.annotation, c.state) : s : (x = c.state) != null && x.selected ? et : $, g = h && h.paint(c, a) || m;
|
|
489
|
+
return `::highlight(_${c.annotation.id}) { ${we(g)} }`;
|
|
490
490
|
});
|
|
491
|
-
t.innerHTML =
|
|
492
|
-
`), CSS.highlights.clear(), r.forEach(({ annotation:
|
|
493
|
-
const
|
|
494
|
-
CSS.highlights.set(`_${
|
|
491
|
+
t.innerHTML = b.join(`
|
|
492
|
+
`), CSS.highlights.clear(), r.forEach(({ annotation: c }) => {
|
|
493
|
+
const m = c.target.selector.map((x) => x.range), g = new Highlight(...m);
|
|
494
|
+
CSS.highlights.set(`_${c.id}`, g);
|
|
495
495
|
}), e = f;
|
|
496
496
|
}
|
|
497
497
|
};
|
|
498
|
-
}, Ae = (t, e, n) =>
|
|
499
|
-
var
|
|
500
|
-
function
|
|
498
|
+
}, Ae = (t, e, n) => gt(t, e, n, xe());
|
|
499
|
+
var Lt = Object.prototype.hasOwnProperty;
|
|
500
|
+
function ht(t, e) {
|
|
501
501
|
var n, o;
|
|
502
502
|
if (t === e)
|
|
503
503
|
return !0;
|
|
@@ -508,14 +508,14 @@ function gt(t, e) {
|
|
|
508
508
|
return t.toString() === e.toString();
|
|
509
509
|
if (n === Array) {
|
|
510
510
|
if ((o = t.length) === e.length)
|
|
511
|
-
for (; o-- &&
|
|
511
|
+
for (; o-- && ht(t[o], e[o]); )
|
|
512
512
|
;
|
|
513
513
|
return o === -1;
|
|
514
514
|
}
|
|
515
515
|
if (!n || typeof t == "object") {
|
|
516
516
|
o = 0;
|
|
517
517
|
for (n in t)
|
|
518
|
-
if (
|
|
518
|
+
if (Lt.call(t, n) && ++o && !Lt.call(e, n) || !(n in e) || !ht(t[n], e[n]))
|
|
519
519
|
return !1;
|
|
520
520
|
return Object.keys(e).length === o;
|
|
521
521
|
}
|
|
@@ -534,17 +534,17 @@ const Ee = (t, e) => {
|
|
|
534
534
|
destroy: () => {
|
|
535
535
|
e.remove();
|
|
536
536
|
},
|
|
537
|
-
redraw: (a, s, h, f,
|
|
538
|
-
if (
|
|
537
|
+
redraw: (a, s, h, f, b) => {
|
|
538
|
+
if (ht(n, a) && b)
|
|
539
539
|
return;
|
|
540
540
|
e.innerHTML = "";
|
|
541
|
-
const
|
|
541
|
+
const m = a.reduce((g, { rects: x }) => [...g, ...x], []);
|
|
542
542
|
a.forEach((g) => {
|
|
543
543
|
const x = g.rects.map((y) => {
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
const
|
|
547
|
-
return
|
|
544
|
+
const d = document.createElement("span");
|
|
545
|
+
d.className = "r6o-annotation", d.dataset.annotation = g.annotation.id, d.style.left = `${y.x}px`, d.style.top = `${y.y}px`, d.style.width = `${y.width}px`, d.style.height = `${y.height}px`;
|
|
546
|
+
const u = Ee(y, m), l = qt(g, s, h, f, u), v = V((l == null ? void 0 : l.fill) || $.fill).alpha((l == null ? void 0 : l.fillOpacity) === void 0 ? $.fillOpacity : l.fillOpacity).toHex();
|
|
547
|
+
return d.style.backgroundColor = v, l.underlineStyle && (d.style.borderStyle = l.underlineStyle), l.underlineColor && (d.style.borderColor = l.underlineColor), l.underlineThickness && (d.style.borderBottomWidth = `${l.underlineThickness}px`), l.underlineOffset && (d.style.paddingBottom = `${l.underlineOffset}px`), e.appendChild(d), d;
|
|
548
548
|
});
|
|
549
549
|
return { id: g.annotation.id, spans: x };
|
|
550
550
|
}), n = a;
|
|
@@ -553,32 +553,32 @@ const Ee = (t, e) => {
|
|
|
553
553
|
a ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
554
554
|
}
|
|
555
555
|
};
|
|
556
|
-
}, Ce = (t, e, n) =>
|
|
557
|
-
let
|
|
556
|
+
}, Ce = (t, e, n) => gt(t, e, n, Se(t));
|
|
557
|
+
let Q;
|
|
558
558
|
const Le = new Uint8Array(16);
|
|
559
|
-
function
|
|
560
|
-
if (!
|
|
559
|
+
function Te() {
|
|
560
|
+
if (!Q && (Q = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Q))
|
|
561
561
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
562
|
-
return
|
|
562
|
+
return Q(Le);
|
|
563
563
|
}
|
|
564
|
-
const
|
|
564
|
+
const O = [];
|
|
565
565
|
for (let t = 0; t < 256; ++t)
|
|
566
|
-
|
|
567
|
-
function
|
|
568
|
-
return
|
|
566
|
+
O.push((t + 256).toString(16).slice(1));
|
|
567
|
+
function Be(t, e = 0) {
|
|
568
|
+
return O[t[e + 0]] + O[t[e + 1]] + O[t[e + 2]] + O[t[e + 3]] + "-" + O[t[e + 4]] + O[t[e + 5]] + "-" + O[t[e + 6]] + O[t[e + 7]] + "-" + O[t[e + 8]] + O[t[e + 9]] + "-" + O[t[e + 10]] + O[t[e + 11]] + O[t[e + 12]] + O[t[e + 13]] + O[t[e + 14]] + O[t[e + 15]];
|
|
569
569
|
}
|
|
570
|
-
const Re = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
570
|
+
const Re = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Tt = {
|
|
571
571
|
randomUUID: Re
|
|
572
572
|
};
|
|
573
|
-
function
|
|
574
|
-
if (
|
|
575
|
-
return
|
|
573
|
+
function Yt(t, e, n) {
|
|
574
|
+
if (Tt.randomUUID && !e && !t)
|
|
575
|
+
return Tt.randomUUID();
|
|
576
576
|
t = t || {};
|
|
577
|
-
const o = t.random || (t.rng ||
|
|
578
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
577
|
+
const o = t.random || (t.rng || Te)();
|
|
578
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Be(o);
|
|
579
579
|
}
|
|
580
|
-
var
|
|
581
|
-
function
|
|
580
|
+
var Bt = Object.prototype.hasOwnProperty;
|
|
581
|
+
function F(t, e) {
|
|
582
582
|
var n, o;
|
|
583
583
|
if (t === e)
|
|
584
584
|
return !0;
|
|
@@ -589,54 +589,54 @@ function q(t, e) {
|
|
|
589
589
|
return t.toString() === e.toString();
|
|
590
590
|
if (n === Array) {
|
|
591
591
|
if ((o = t.length) === e.length)
|
|
592
|
-
for (; o-- &&
|
|
592
|
+
for (; o-- && F(t[o], e[o]); )
|
|
593
593
|
;
|
|
594
594
|
return o === -1;
|
|
595
595
|
}
|
|
596
596
|
if (!n || typeof t == "object") {
|
|
597
597
|
o = 0;
|
|
598
598
|
for (n in t)
|
|
599
|
-
if (
|
|
599
|
+
if (Bt.call(t, n) && ++o && !Bt.call(e, n) || !(n in e) || !F(t[n], e[n]))
|
|
600
600
|
return !1;
|
|
601
601
|
return Object.keys(e).length === o;
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
return t !== t && e !== e;
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function at() {
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Ie(t, e) {
|
|
609
609
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
610
610
|
}
|
|
611
|
-
const
|
|
612
|
-
function
|
|
611
|
+
const H = [];
|
|
612
|
+
function pt(t, e = at) {
|
|
613
613
|
let n;
|
|
614
614
|
const o = /* @__PURE__ */ new Set();
|
|
615
615
|
function i(s) {
|
|
616
|
-
if (
|
|
617
|
-
const h = !
|
|
616
|
+
if (Ie(t, s) && (t = s, n)) {
|
|
617
|
+
const h = !H.length;
|
|
618
618
|
for (const f of o)
|
|
619
|
-
f[1](),
|
|
619
|
+
f[1](), H.push(f, t);
|
|
620
620
|
if (h) {
|
|
621
|
-
for (let f = 0; f <
|
|
622
|
-
|
|
623
|
-
|
|
621
|
+
for (let f = 0; f < H.length; f += 2)
|
|
622
|
+
H[f][0](H[f + 1]);
|
|
623
|
+
H.length = 0;
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
function r(s) {
|
|
628
628
|
i(s(t));
|
|
629
629
|
}
|
|
630
|
-
function a(s, h =
|
|
630
|
+
function a(s, h = at) {
|
|
631
631
|
const f = [s, h];
|
|
632
|
-
return o.add(f), o.size === 1 && (n = e(i, r) ||
|
|
632
|
+
return o.add(f), o.size === 1 && (n = e(i, r) || at), s(t), () => {
|
|
633
633
|
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
636
|
return { set: i, update: r, subscribe: a };
|
|
637
637
|
}
|
|
638
638
|
const Me = (t) => {
|
|
639
|
-
const { subscribe: e, set: n } =
|
|
639
|
+
const { subscribe: e, set: n } = pt();
|
|
640
640
|
let o;
|
|
641
641
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
642
642
|
if (o) {
|
|
@@ -653,35 +653,35 @@ const Me = (t) => {
|
|
|
653
653
|
};
|
|
654
654
|
};
|
|
655
655
|
var Oe = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(Oe || {});
|
|
656
|
-
const
|
|
657
|
-
const { subscribe: n, set: o } =
|
|
658
|
-
let i =
|
|
659
|
-
n((
|
|
660
|
-
const r = () => o(
|
|
661
|
-
var
|
|
662
|
-
return ((
|
|
663
|
-
}, s = (
|
|
656
|
+
const lt = { selected: [] }, Ne = (t, e = "EDIT") => {
|
|
657
|
+
const { subscribe: n, set: o } = pt(lt);
|
|
658
|
+
let i = lt;
|
|
659
|
+
n((c) => i = c);
|
|
660
|
+
const r = () => o(lt), a = () => {
|
|
661
|
+
var c;
|
|
662
|
+
return ((c = i.selected) == null ? void 0 : c.length) === 0;
|
|
663
|
+
}, s = (c) => {
|
|
664
664
|
if (i.selected.length === 0)
|
|
665
665
|
return !1;
|
|
666
|
-
const
|
|
667
|
-
return i.selected.some((g) => g.id ===
|
|
668
|
-
}, h = (
|
|
669
|
-
const g = t.getAnnotation(
|
|
666
|
+
const m = typeof c == "string" ? c : c.id;
|
|
667
|
+
return i.selected.some((g) => g.id === m);
|
|
668
|
+
}, h = (c, m) => {
|
|
669
|
+
const g = t.getAnnotation(c);
|
|
670
670
|
if (g) {
|
|
671
|
-
const x =
|
|
672
|
-
o(x === "EDIT" ? { selected: [{ id:
|
|
671
|
+
const x = Ue(g, e);
|
|
672
|
+
o(x === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: m } : x === "SELECT" ? { selected: [{ id: c }], pointerEvent: m } : { selected: [], pointerEvent: m });
|
|
673
673
|
} else
|
|
674
|
-
console.warn("Invalid selection: " +
|
|
675
|
-
}, f = (
|
|
676
|
-
const g = Array.isArray(
|
|
677
|
-
o({ selected: x.map(({ id: y }) => ({ id: y, editable:
|
|
678
|
-
},
|
|
674
|
+
console.warn("Invalid selection: " + c);
|
|
675
|
+
}, f = (c, m = !0) => {
|
|
676
|
+
const g = Array.isArray(c) ? c : [c], x = g.map((y) => t.getAnnotation(y)).filter(Boolean);
|
|
677
|
+
o({ selected: x.map(({ id: y }) => ({ id: y, editable: m })) }), x.length !== g.length && console.warn("Invalid selection", c);
|
|
678
|
+
}, b = (c) => {
|
|
679
679
|
if (i.selected.length === 0)
|
|
680
680
|
return !1;
|
|
681
|
-
const { selected:
|
|
682
|
-
|
|
681
|
+
const { selected: m } = i;
|
|
682
|
+
m.filter(({ id: g }) => c.includes(g)).length > 0 && o({ selected: m.filter(({ id: g }) => !c.includes(g)) });
|
|
683
683
|
};
|
|
684
|
-
return t.observe(({ changes:
|
|
684
|
+
return t.observe(({ changes: c }) => b((c.deleted || []).map((m) => m.id))), {
|
|
685
685
|
clear: r,
|
|
686
686
|
clickSelect: h,
|
|
687
687
|
get selected() {
|
|
@@ -695,37 +695,37 @@ const dt = { selected: [] }, Ie = (t, e = "EDIT") => {
|
|
|
695
695
|
setSelected: f,
|
|
696
696
|
subscribe: n
|
|
697
697
|
};
|
|
698
|
-
},
|
|
699
|
-
let
|
|
700
|
-
const
|
|
698
|
+
}, Ue = (t, e) => typeof e == "function" ? e(t) || "EDIT" : e || "EDIT";
|
|
699
|
+
let J;
|
|
700
|
+
const Ve = new Uint8Array(16);
|
|
701
701
|
function ke() {
|
|
702
|
-
if (!
|
|
702
|
+
if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
|
|
703
703
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
704
|
-
return
|
|
704
|
+
return J(Ve);
|
|
705
705
|
}
|
|
706
|
-
const
|
|
706
|
+
const N = [];
|
|
707
707
|
for (let t = 0; t < 256; ++t)
|
|
708
|
-
|
|
708
|
+
N.push((t + 256).toString(16).slice(1));
|
|
709
709
|
function Ye(t, e = 0) {
|
|
710
|
-
return
|
|
710
|
+
return N[t[e + 0]] + N[t[e + 1]] + N[t[e + 2]] + N[t[e + 3]] + "-" + N[t[e + 4]] + N[t[e + 5]] + "-" + N[t[e + 6]] + N[t[e + 7]] + "-" + N[t[e + 8]] + N[t[e + 9]] + "-" + N[t[e + 10]] + N[t[e + 11]] + N[t[e + 12]] + N[t[e + 13]] + N[t[e + 14]] + N[t[e + 15]];
|
|
711
711
|
}
|
|
712
|
-
const _e = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
712
|
+
const _e = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Rt = {
|
|
713
713
|
randomUUID: _e
|
|
714
714
|
};
|
|
715
|
-
function
|
|
716
|
-
if (
|
|
717
|
-
return
|
|
715
|
+
function Xe(t, e, n) {
|
|
716
|
+
if (Rt.randomUUID && !e && !t)
|
|
717
|
+
return Rt.randomUUID();
|
|
718
718
|
t = t || {};
|
|
719
719
|
const o = t.random || (t.rng || ke)();
|
|
720
720
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Ye(o);
|
|
721
721
|
}
|
|
722
722
|
const On = (t, e, n, o) => ({
|
|
723
|
-
id:
|
|
723
|
+
id: Xe(),
|
|
724
724
|
annotation: t.id,
|
|
725
725
|
created: n || /* @__PURE__ */ new Date(),
|
|
726
726
|
creator: o,
|
|
727
727
|
...e
|
|
728
|
-
}),
|
|
728
|
+
}), De = (t, e) => {
|
|
729
729
|
const n = new Set(t.bodies.map((o) => o.id));
|
|
730
730
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
731
731
|
}, $e = (t, e) => {
|
|
@@ -733,9 +733,9 @@ const On = (t, e, n, o) => ({
|
|
|
733
733
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
734
734
|
}, He = (t, e) => e.bodies.map((n) => {
|
|
735
735
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
736
|
-
return { newBody: n, oldBody: o && !
|
|
737
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Pe = (t, e) => !
|
|
738
|
-
const n =
|
|
736
|
+
return { newBody: n, oldBody: o && !F(o, n) ? o : void 0 };
|
|
737
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Pe = (t, e) => !F(t.target, e.target), _t = (t, e) => {
|
|
738
|
+
const n = De(t, e), o = $e(t, e), i = He(t, e);
|
|
739
739
|
return {
|
|
740
740
|
oldValue: t,
|
|
741
741
|
newValue: e,
|
|
@@ -745,7 +745,7 @@ const On = (t, e, n, o) => ({
|
|
|
745
745
|
targetUpdated: Pe(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
746
746
|
};
|
|
747
747
|
};
|
|
748
|
-
var
|
|
748
|
+
var R = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(R || {});
|
|
749
749
|
const ze = (t, e) => {
|
|
750
750
|
var n, o;
|
|
751
751
|
const { changes: i, origin: r } = e;
|
|
@@ -754,7 +754,7 @@ const ze = (t, e) => {
|
|
|
754
754
|
if (t.options.ignore) {
|
|
755
755
|
const { ignore: a } = t.options, s = (h) => h && h.length > 0;
|
|
756
756
|
if (!(s(i.created) || s(i.deleted))) {
|
|
757
|
-
const h = (n = i.updated) == null ? void 0 : n.some((
|
|
757
|
+
const h = (n = i.updated) == null ? void 0 : n.some((b) => s(b.bodiesCreated) || s(b.bodiesDeleted) || s(b.bodiesUpdated)), f = (o = i.updated) == null ? void 0 : o.some((b) => b.targetUpdated);
|
|
758
758
|
if (a === "BODY_ONLY" && h && !f || a === "TARGET_ONLY" && f && !h)
|
|
759
759
|
return !1;
|
|
760
760
|
}
|
|
@@ -769,214 +769,207 @@ const ze = (t, e) => {
|
|
|
769
769
|
} else
|
|
770
770
|
return !0;
|
|
771
771
|
}, Fe = (t, e) => {
|
|
772
|
-
const n = new Set((t.created || []).map((
|
|
773
|
-
...(t.created || []).filter((
|
|
772
|
+
const n = new Set((t.created || []).map((c) => c.id)), o = new Set((t.updated || []).map(({ newValue: c }) => c.id)), i = new Set((e.created || []).map((c) => c.id)), r = new Set((e.deleted || []).map((c) => c.id)), a = new Set((e.updated || []).map(({ oldValue: c }) => c.id)), s = new Set((e.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), h = [
|
|
773
|
+
...(t.created || []).filter((c) => !r.has(c.id)).map((c) => a.has(c.id) ? e.updated.find(({ oldValue: m }) => m.id === c.id).newValue : c),
|
|
774
774
|
...e.created || []
|
|
775
775
|
], f = [
|
|
776
|
-
...(t.deleted || []).filter((
|
|
777
|
-
...(e.deleted || []).filter((
|
|
778
|
-
],
|
|
779
|
-
...(t.updated || []).filter(({ newValue:
|
|
780
|
-
const { oldValue:
|
|
776
|
+
...(t.deleted || []).filter((c) => !i.has(c.id)),
|
|
777
|
+
...(e.deleted || []).filter((c) => !n.has(c.id))
|
|
778
|
+
], b = [
|
|
779
|
+
...(t.updated || []).filter(({ newValue: c }) => !r.has(c.id)).map((c) => {
|
|
780
|
+
const { oldValue: m, newValue: g } = c;
|
|
781
781
|
if (a.has(g.id)) {
|
|
782
782
|
const x = e.updated.find((y) => y.oldValue.id === g.id).newValue;
|
|
783
|
-
return
|
|
783
|
+
return _t(m, x);
|
|
784
784
|
} else
|
|
785
|
-
return
|
|
785
|
+
return c;
|
|
786
786
|
}),
|
|
787
|
-
...(e.updated || []).filter(({ oldValue:
|
|
787
|
+
...(e.updated || []).filter(({ oldValue: c }) => !s.has(c.id))
|
|
788
788
|
];
|
|
789
|
-
return { created: h, deleted: f, updated:
|
|
789
|
+
return { created: h, deleted: f, updated: b };
|
|
790
790
|
}, We = (t) => t.id !== void 0, qe = () => {
|
|
791
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
}, r = (
|
|
795
|
-
const
|
|
796
|
-
origin:
|
|
791
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (p, A = {}) => n.push({ onChange: p, options: A }), i = (p) => {
|
|
792
|
+
const A = n.findIndex((w) => w.onChange == p);
|
|
793
|
+
A > -1 && n.splice(A, 1);
|
|
794
|
+
}, r = (p, A) => {
|
|
795
|
+
const w = {
|
|
796
|
+
origin: p,
|
|
797
797
|
changes: {
|
|
798
|
-
created:
|
|
799
|
-
updated:
|
|
800
|
-
deleted:
|
|
798
|
+
created: A.created || [],
|
|
799
|
+
updated: A.updated || [],
|
|
800
|
+
deleted: A.deleted || []
|
|
801
801
|
},
|
|
802
802
|
state: [...t.values()]
|
|
803
803
|
};
|
|
804
804
|
n.forEach((S) => {
|
|
805
|
-
ze(S,
|
|
805
|
+
ze(S, w) && S.onChange(w);
|
|
806
806
|
});
|
|
807
|
-
}, a = (
|
|
808
|
-
if (t.get(
|
|
809
|
-
throw Error(`Cannot add annotation ${
|
|
810
|
-
t.set(
|
|
811
|
-
}, s = (
|
|
812
|
-
const
|
|
813
|
-
if (
|
|
814
|
-
const
|
|
815
|
-
return S ===
|
|
807
|
+
}, a = (p, A = R.LOCAL) => {
|
|
808
|
+
if (t.get(p.id))
|
|
809
|
+
throw Error(`Cannot add annotation ${p.id} - exists already`);
|
|
810
|
+
t.set(p.id, p), p.bodies.forEach((w) => e.set(w.id, p.id)), r(A, { created: [p] });
|
|
811
|
+
}, s = (p, A) => {
|
|
812
|
+
const w = typeof p == "string" ? A : p, S = typeof p == "string" ? p : p.id, B = t.get(S);
|
|
813
|
+
if (B) {
|
|
814
|
+
const I = _t(B, w);
|
|
815
|
+
return S === w.id ? t.set(S, w) : (t.delete(S), t.set(w.id, w)), B.bodies.forEach((Y) => e.delete(Y.id)), w.bodies.forEach((Y) => e.set(Y.id, w.id)), I;
|
|
816
816
|
} else
|
|
817
817
|
console.warn(`Cannot update annotation ${S} - does not exist`);
|
|
818
|
-
}, h = (
|
|
819
|
-
const S = We(
|
|
820
|
-
|
|
821
|
-
}, f = (
|
|
822
|
-
const
|
|
823
|
-
const
|
|
824
|
-
return
|
|
818
|
+
}, h = (p, A = R.LOCAL, w = R.LOCAL) => {
|
|
819
|
+
const S = We(A) ? w : A, B = s(p, A);
|
|
820
|
+
B && r(S, { updated: [B] });
|
|
821
|
+
}, f = (p, A = R.LOCAL) => {
|
|
822
|
+
const w = p.reduce((S, B) => {
|
|
823
|
+
const I = s(B);
|
|
824
|
+
return I ? [...S, I] : S;
|
|
825
825
|
}, []);
|
|
826
|
-
|
|
827
|
-
},
|
|
828
|
-
const
|
|
829
|
-
if (
|
|
826
|
+
w.length > 0 && r(A, { updated: w });
|
|
827
|
+
}, b = (p, A = R.LOCAL) => {
|
|
828
|
+
const w = t.get(p.annotation);
|
|
829
|
+
if (w) {
|
|
830
830
|
const S = {
|
|
831
|
-
...
|
|
832
|
-
bodies: [...
|
|
831
|
+
...w,
|
|
832
|
+
bodies: [...w.bodies, p]
|
|
833
833
|
};
|
|
834
|
-
t.set(
|
|
835
|
-
oldValue:
|
|
834
|
+
t.set(w.id, S), e.set(p.id, S.id), r(A, { updated: [{
|
|
835
|
+
oldValue: w,
|
|
836
836
|
newValue: S,
|
|
837
|
-
bodiesCreated: [
|
|
837
|
+
bodiesCreated: [p]
|
|
838
838
|
}] });
|
|
839
839
|
} else
|
|
840
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
841
|
-
},
|
|
842
|
-
const
|
|
843
|
-
t.clear(), e.clear(), r(
|
|
844
|
-
}, g = (
|
|
845
|
-
if (
|
|
840
|
+
console.warn(`Attempt to add body to missing annotation: ${p.annotation}`);
|
|
841
|
+
}, c = () => [...t.values()], m = (p = R.LOCAL) => {
|
|
842
|
+
const A = [...t.values()];
|
|
843
|
+
t.clear(), e.clear(), r(p, { deleted: A });
|
|
844
|
+
}, g = (p, A = !0, w = R.LOCAL) => {
|
|
845
|
+
if (A) {
|
|
846
846
|
const S = [...t.values()];
|
|
847
|
-
t.clear(), e.clear(),
|
|
848
|
-
t.set(
|
|
849
|
-
}), r(
|
|
847
|
+
t.clear(), e.clear(), p.forEach((B) => {
|
|
848
|
+
t.set(B.id, B), B.bodies.forEach((I) => e.set(I.id, B.id));
|
|
849
|
+
}), r(w, { created: p, deleted: S });
|
|
850
850
|
} else {
|
|
851
|
-
const S =
|
|
852
|
-
const
|
|
853
|
-
return
|
|
851
|
+
const S = p.reduce((B, I) => {
|
|
852
|
+
const Y = t.get(I.id);
|
|
853
|
+
return Y ? [...B, Y] : B;
|
|
854
854
|
}, []);
|
|
855
855
|
if (S.length > 0)
|
|
856
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${S.map((
|
|
857
|
-
|
|
858
|
-
t.set(
|
|
859
|
-
}), r(
|
|
856
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${S.map((B) => B.id).join(", ")}`);
|
|
857
|
+
p.forEach((B) => {
|
|
858
|
+
t.set(B.id, B), B.bodies.forEach((I) => e.set(I.id, B.id));
|
|
859
|
+
}), r(w, { created: p });
|
|
860
860
|
}
|
|
861
|
-
}, x = (
|
|
862
|
-
const
|
|
863
|
-
if (
|
|
864
|
-
return t.delete(
|
|
865
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
866
|
-
}, y = (
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
},
|
|
870
|
-
const
|
|
871
|
-
const
|
|
872
|
-
return
|
|
861
|
+
}, x = (p) => {
|
|
862
|
+
const A = typeof p == "string" ? p : p.id, w = t.get(A);
|
|
863
|
+
if (w)
|
|
864
|
+
return t.delete(A), w.bodies.forEach((S) => e.delete(S.id)), w;
|
|
865
|
+
console.warn(`Attempt to delete missing annotation: ${A}`);
|
|
866
|
+
}, y = (p, A = R.LOCAL) => {
|
|
867
|
+
const w = x(p);
|
|
868
|
+
w && r(A, { deleted: [w] });
|
|
869
|
+
}, d = (p, A = R.LOCAL) => {
|
|
870
|
+
const w = p.reduce((S, B) => {
|
|
871
|
+
const I = x(B);
|
|
872
|
+
return I ? [...S, I] : S;
|
|
873
873
|
}, []);
|
|
874
|
-
|
|
875
|
-
},
|
|
876
|
-
const w = t.get(
|
|
874
|
+
w.length > 0 && r(A, { deleted: w });
|
|
875
|
+
}, u = (p, A = R.LOCAL) => {
|
|
876
|
+
const w = t.get(p.annotation);
|
|
877
877
|
if (w) {
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
e.delete(
|
|
881
|
-
const
|
|
878
|
+
const S = w.bodies.find((B) => B.id === p.id);
|
|
879
|
+
if (S) {
|
|
880
|
+
e.delete(S.id);
|
|
881
|
+
const B = {
|
|
882
882
|
...w,
|
|
883
|
-
bodies: w.bodies.filter((
|
|
883
|
+
bodies: w.bodies.filter((I) => I.id !== p.id)
|
|
884
884
|
};
|
|
885
|
-
|
|
885
|
+
t.set(w.id, B), r(A, { updated: [{
|
|
886
886
|
oldValue: w,
|
|
887
|
-
newValue:
|
|
888
|
-
bodiesDeleted: [
|
|
889
|
-
};
|
|
887
|
+
newValue: B,
|
|
888
|
+
bodiesDeleted: [S]
|
|
889
|
+
}] });
|
|
890
890
|
} else
|
|
891
|
-
console.warn(`Attempt to delete missing body ${
|
|
891
|
+
console.warn(`Attempt to delete missing body ${p.id} from annotation ${p.annotation}`);
|
|
892
892
|
} else
|
|
893
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
894
|
-
},
|
|
895
|
-
const A =
|
|
896
|
-
A
|
|
897
|
-
}, v = (
|
|
898
|
-
const A =
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
const w = e.get(b);
|
|
905
|
-
if (w) {
|
|
906
|
-
const A = C(w).bodies.find((S) => S.id === b);
|
|
907
|
-
if (A)
|
|
908
|
-
return A;
|
|
909
|
-
console.error(`Store integrity error: body ${b} in index, but not in annotation`);
|
|
893
|
+
console.warn(`Attempt to delete body from missing annotation ${p.annotation}`);
|
|
894
|
+
}, l = (p) => {
|
|
895
|
+
const A = t.get(p);
|
|
896
|
+
return A ? { ...A } : void 0;
|
|
897
|
+
}, v = (p) => {
|
|
898
|
+
const A = e.get(p);
|
|
899
|
+
if (A) {
|
|
900
|
+
const w = l(A).bodies.find((S) => S.id === p);
|
|
901
|
+
if (w)
|
|
902
|
+
return w;
|
|
903
|
+
console.error(`Store integrity error: body ${p} in index, but not in annotation`);
|
|
910
904
|
} else
|
|
911
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
912
|
-
},
|
|
913
|
-
if (
|
|
905
|
+
console.warn(`Attempt to retrieve missing body: ${p}`);
|
|
906
|
+
}, C = (p, A) => {
|
|
907
|
+
if (p.annotation !== A.annotation)
|
|
914
908
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
const S =
|
|
918
|
-
...
|
|
919
|
-
bodies:
|
|
909
|
+
const w = t.get(p.annotation);
|
|
910
|
+
if (w) {
|
|
911
|
+
const S = w.bodies.find((I) => I.id === p.id), B = {
|
|
912
|
+
...w,
|
|
913
|
+
bodies: w.bodies.map((I) => I.id === S.id ? A : I)
|
|
920
914
|
};
|
|
921
|
-
return t.set(
|
|
922
|
-
oldValue:
|
|
923
|
-
newValue:
|
|
924
|
-
bodiesUpdated: [{ oldBody: S, newBody:
|
|
915
|
+
return t.set(w.id, B), S.id !== A.id && (e.delete(S.id), e.set(A.id, B.id)), {
|
|
916
|
+
oldValue: w,
|
|
917
|
+
newValue: B,
|
|
918
|
+
bodiesUpdated: [{ oldBody: S, newBody: A }]
|
|
925
919
|
};
|
|
926
920
|
} else
|
|
927
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
928
|
-
},
|
|
929
|
-
const S =
|
|
930
|
-
S && r(
|
|
931
|
-
},
|
|
932
|
-
const
|
|
933
|
-
r(
|
|
934
|
-
},
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
937
|
-
const
|
|
938
|
-
...
|
|
921
|
+
console.warn(`Attempt to add body to missing annotation ${p.annotation}`);
|
|
922
|
+
}, L = (p, A, w = R.LOCAL) => {
|
|
923
|
+
const S = C(p, A);
|
|
924
|
+
S && r(w, { updated: [S] });
|
|
925
|
+
}, E = (p, A = R.LOCAL) => {
|
|
926
|
+
const w = p.map((S) => C({ id: S.id, annotation: S.annotation }, S)).filter(Boolean);
|
|
927
|
+
r(A, { updated: w });
|
|
928
|
+
}, T = (p) => {
|
|
929
|
+
const A = t.get(p.annotation);
|
|
930
|
+
if (A) {
|
|
931
|
+
const w = {
|
|
932
|
+
...A,
|
|
939
933
|
target: {
|
|
940
|
-
...
|
|
941
|
-
...
|
|
934
|
+
...A.target,
|
|
935
|
+
...p
|
|
942
936
|
}
|
|
943
937
|
};
|
|
944
|
-
return t.set(
|
|
945
|
-
oldValue:
|
|
946
|
-
newValue:
|
|
938
|
+
return t.set(A.id, w), {
|
|
939
|
+
oldValue: A,
|
|
940
|
+
newValue: w,
|
|
947
941
|
targetUpdated: {
|
|
948
|
-
oldTarget:
|
|
949
|
-
newTarget:
|
|
942
|
+
oldTarget: A.target,
|
|
943
|
+
newTarget: p
|
|
950
944
|
}
|
|
951
945
|
};
|
|
952
946
|
} else
|
|
953
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
947
|
+
console.warn(`Attempt to update target on missing annotation: ${p.annotation}`);
|
|
954
948
|
};
|
|
955
949
|
return {
|
|
956
950
|
addAnnotation: a,
|
|
957
|
-
addBody:
|
|
958
|
-
all:
|
|
951
|
+
addBody: b,
|
|
952
|
+
all: c,
|
|
959
953
|
bulkAddAnnotation: g,
|
|
960
|
-
bulkDeleteAnnotation:
|
|
961
|
-
bulkDeleteBodies: v,
|
|
954
|
+
bulkDeleteAnnotation: d,
|
|
962
955
|
bulkUpdateAnnotation: f,
|
|
963
|
-
bulkUpdateBodies:
|
|
964
|
-
bulkUpdateTargets: (
|
|
965
|
-
const
|
|
966
|
-
|
|
956
|
+
bulkUpdateBodies: E,
|
|
957
|
+
bulkUpdateTargets: (p, A = R.LOCAL) => {
|
|
958
|
+
const w = p.map((S) => T(S)).filter(Boolean);
|
|
959
|
+
w.length > 0 && r(A, { updated: w });
|
|
967
960
|
},
|
|
968
|
-
clear:
|
|
961
|
+
clear: m,
|
|
969
962
|
deleteAnnotation: y,
|
|
970
|
-
deleteBody:
|
|
971
|
-
getAnnotation:
|
|
972
|
-
getBody:
|
|
963
|
+
deleteBody: u,
|
|
964
|
+
getAnnotation: l,
|
|
965
|
+
getBody: v,
|
|
973
966
|
observe: o,
|
|
974
967
|
unobserve: i,
|
|
975
968
|
updateAnnotation: h,
|
|
976
|
-
updateBody:
|
|
977
|
-
updateTarget: (
|
|
978
|
-
const
|
|
979
|
-
|
|
969
|
+
updateBody: L,
|
|
970
|
+
updateTarget: (p, A = R.LOCAL) => {
|
|
971
|
+
const w = T(p);
|
|
972
|
+
w && r(A, { updated: [w] });
|
|
980
973
|
}
|
|
981
974
|
};
|
|
982
975
|
};
|
|
@@ -1003,15 +996,15 @@ const Ge = 250, Ke = (t) => {
|
|
|
1003
996
|
if (y - r > Ge)
|
|
1004
997
|
n.splice(o + 1), n.push(x), o = n.length - 1;
|
|
1005
998
|
else {
|
|
1006
|
-
const
|
|
1007
|
-
n[
|
|
999
|
+
const d = n.length - 1;
|
|
1000
|
+
n[d] = Fe(n[d], x);
|
|
1008
1001
|
}
|
|
1009
1002
|
r = y;
|
|
1010
1003
|
}
|
|
1011
1004
|
i = !1;
|
|
1012
1005
|
};
|
|
1013
|
-
t.observe(a, { origin:
|
|
1014
|
-
const s = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g), h = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), f = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ oldValue: x }) => x)),
|
|
1006
|
+
t.observe(a, { origin: R.LOCAL });
|
|
1007
|
+
const s = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g), h = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), f = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ oldValue: x }) => x)), b = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ newValue: x }) => x)), c = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), m = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g);
|
|
1015
1008
|
return {
|
|
1016
1009
|
canRedo: () => n.length - 1 > o,
|
|
1017
1010
|
canUndo: () => o > -1,
|
|
@@ -1021,88 +1014,88 @@ const Ge = 250, Ke = (t) => {
|
|
|
1021
1014
|
if (n.length - 1 > o) {
|
|
1022
1015
|
i = !0;
|
|
1023
1016
|
const { created: g, updated: x, deleted: y } = n[o + 1];
|
|
1024
|
-
h(g),
|
|
1017
|
+
h(g), b(x), m(y), e.emit("redo", n[o + 1]), o += 1;
|
|
1025
1018
|
}
|
|
1026
1019
|
},
|
|
1027
1020
|
undo: () => {
|
|
1028
1021
|
if (o > -1) {
|
|
1029
1022
|
i = !0;
|
|
1030
1023
|
const { created: g, updated: x, deleted: y } = n[o];
|
|
1031
|
-
s(g), f(x),
|
|
1024
|
+
s(g), f(x), c(y), e.emit("undo", n[o]), o -= 1;
|
|
1032
1025
|
}
|
|
1033
1026
|
}
|
|
1034
1027
|
};
|
|
1035
1028
|
}, Qe = () => {
|
|
1036
|
-
const { subscribe: t, set: e } =
|
|
1029
|
+
const { subscribe: t, set: e } = pt([]);
|
|
1037
1030
|
return {
|
|
1038
1031
|
subscribe: t,
|
|
1039
1032
|
set: e
|
|
1040
1033
|
};
|
|
1041
1034
|
}, Je = (t, e, n, o) => {
|
|
1042
1035
|
const { store: i, selection: r, hover: a, viewport: s } = t, h = /* @__PURE__ */ new Map();
|
|
1043
|
-
let f = [],
|
|
1044
|
-
const
|
|
1045
|
-
h.has(y) ? h.get(y).push(
|
|
1046
|
-
},
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1049
|
-
}, g = (y,
|
|
1036
|
+
let f = [], b;
|
|
1037
|
+
const c = (y, d) => {
|
|
1038
|
+
h.has(y) ? h.get(y).push(d) : h.set(y, [d]);
|
|
1039
|
+
}, m = (y, d) => {
|
|
1040
|
+
const u = h.get(y);
|
|
1041
|
+
u && u.indexOf(d) > 0 && u.splice(u.indexOf(d), 1);
|
|
1042
|
+
}, g = (y, d, u) => {
|
|
1050
1043
|
h.has(y) && setTimeout(() => {
|
|
1051
|
-
h.get(y).forEach((
|
|
1044
|
+
h.get(y).forEach((l) => {
|
|
1052
1045
|
if (n) {
|
|
1053
|
-
const v = Array.isArray(
|
|
1054
|
-
|
|
1046
|
+
const v = Array.isArray(d) ? d.map((L) => n.serialize(L)) : n.serialize(d), C = u ? u instanceof PointerEvent ? u : n.serialize(u) : void 0;
|
|
1047
|
+
l(v, C);
|
|
1055
1048
|
} else
|
|
1056
|
-
|
|
1049
|
+
l(d, u);
|
|
1057
1050
|
});
|
|
1058
1051
|
}, 1);
|
|
1059
1052
|
};
|
|
1060
1053
|
r.subscribe(({ selected: y }) => {
|
|
1061
1054
|
if (!(f.length === 0 && y.length === 0)) {
|
|
1062
1055
|
if (f.length === 0 && y.length > 0)
|
|
1063
|
-
f = y.map(({ id:
|
|
1056
|
+
f = y.map(({ id: d }) => i.getAnnotation(d));
|
|
1064
1057
|
else if (f.length > 0 && y.length === 0)
|
|
1065
|
-
f.forEach((
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1058
|
+
f.forEach((d) => {
|
|
1059
|
+
const u = i.getAnnotation(d.id);
|
|
1060
|
+
u && !F(u, d) && g("updateAnnotation", u, d);
|
|
1068
1061
|
}), f = [];
|
|
1069
1062
|
else {
|
|
1070
|
-
const
|
|
1071
|
-
f.filter((
|
|
1072
|
-
const v = i.getAnnotation(
|
|
1073
|
-
v && !
|
|
1063
|
+
const d = new Set(f.map((l) => l.id)), u = new Set(y.map(({ id: l }) => l));
|
|
1064
|
+
f.filter((l) => !u.has(l.id)).forEach((l) => {
|
|
1065
|
+
const v = i.getAnnotation(l.id);
|
|
1066
|
+
v && !F(v, l) && g("updateAnnotation", v, l);
|
|
1074
1067
|
}), f = [
|
|
1075
1068
|
// Remove annotations that were deselected
|
|
1076
|
-
...f.filter((
|
|
1069
|
+
...f.filter((l) => u.has(l.id)),
|
|
1077
1070
|
// Add editable annotations that were selected
|
|
1078
|
-
...y.filter(({ id:
|
|
1071
|
+
...y.filter(({ id: l }) => !d.has(l)).map(({ id: l }) => i.getAnnotation(l))
|
|
1079
1072
|
];
|
|
1080
1073
|
}
|
|
1081
1074
|
g("selectionChanged", f);
|
|
1082
1075
|
}
|
|
1083
1076
|
}), a.subscribe((y) => {
|
|
1084
|
-
!
|
|
1085
|
-
}), s == null || s.subscribe((y) => g("viewportIntersect", y.map((
|
|
1086
|
-
const { created:
|
|
1087
|
-
(
|
|
1088
|
-
...
|
|
1089
|
-
...
|
|
1090
|
-
...
|
|
1091
|
-
].length > 0).forEach(({ oldValue:
|
|
1092
|
-
const C = f.find((L) => L.id ===
|
|
1093
|
-
f = f.map((L) => L.id ===
|
|
1077
|
+
!b && y ? g("mouseEnterAnnotation", i.getAnnotation(y)) : b && !y ? g("mouseLeaveAnnotation", i.getAnnotation(b)) : b && y && (g("mouseLeaveAnnotation", i.getAnnotation(b)), g("mouseEnterAnnotation", i.getAnnotation(y))), b = y;
|
|
1078
|
+
}), s == null || s.subscribe((y) => g("viewportIntersect", y.map((d) => i.getAnnotation(d)))), i.observe((y) => {
|
|
1079
|
+
const { created: d, deleted: u } = y.changes;
|
|
1080
|
+
(d || []).forEach((l) => g("createAnnotation", l)), (u || []).forEach((l) => g("deleteAnnotation", l)), (y.changes.updated || []).filter((l) => [
|
|
1081
|
+
...l.bodiesCreated || [],
|
|
1082
|
+
...l.bodiesDeleted || [],
|
|
1083
|
+
...l.bodiesUpdated || []
|
|
1084
|
+
].length > 0).forEach(({ oldValue: l, newValue: v }) => {
|
|
1085
|
+
const C = f.find((L) => L.id === l.id) || l;
|
|
1086
|
+
f = f.map((L) => L.id === l.id ? v : L), g("updateAnnotation", v, C);
|
|
1094
1087
|
});
|
|
1095
|
-
}, { origin:
|
|
1088
|
+
}, { origin: R.LOCAL }), i.observe((y) => {
|
|
1096
1089
|
if (f) {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1090
|
+
const d = new Set(f.map((l) => l.id)), u = (y.changes.updated || []).filter(({ newValue: l }) => d.has(l.id)).map(({ newValue: l }) => l);
|
|
1091
|
+
u.length > 0 && (f = f.map((l) => u.find((C) => C.id === l.id) || l));
|
|
1099
1092
|
}
|
|
1100
|
-
}, { origin:
|
|
1101
|
-
const x = (y) => (
|
|
1102
|
-
const { updated:
|
|
1103
|
-
y ? (
|
|
1093
|
+
}, { origin: R.REMOTE });
|
|
1094
|
+
const x = (y) => (d) => {
|
|
1095
|
+
const { updated: u } = d;
|
|
1096
|
+
y ? (u || []).forEach((l) => g("updateAnnotation", l.oldValue, l.newValue)) : (u || []).forEach((l) => g("updateAnnotation", l.newValue, l.oldValue));
|
|
1104
1097
|
};
|
|
1105
|
-
return e.on("undo", x(!0)), e.on("redo", x(!1)), { on:
|
|
1098
|
+
return e.on("undo", x(!0)), e.on("redo", x(!1)), { on: c, off: m, emit: g };
|
|
1106
1099
|
}, Ze = (t) => (e) => e.reduce((n, o) => {
|
|
1107
1100
|
const { parsed: i, error: r } = t.parse(o);
|
|
1108
1101
|
return r ? {
|
|
@@ -1115,44 +1108,44 @@ const Ge = 250, Ke = (t) => {
|
|
|
1115
1108
|
...n
|
|
1116
1109
|
};
|
|
1117
1110
|
}, { parsed: [], failed: [] }), tn = (t, e, n) => {
|
|
1118
|
-
const { store: o, selection: i } = t, r = (
|
|
1111
|
+
const { store: o, selection: i } = t, r = (d) => {
|
|
1119
1112
|
if (n) {
|
|
1120
|
-
const { parsed:
|
|
1121
|
-
|
|
1113
|
+
const { parsed: u, error: l } = n.parse(d);
|
|
1114
|
+
u ? o.addAnnotation(u, R.REMOTE) : console.error(l);
|
|
1122
1115
|
} else
|
|
1123
|
-
o.addAnnotation(
|
|
1124
|
-
}, a = () => i.clear(), s = () => o.clear(), h = (
|
|
1125
|
-
const
|
|
1126
|
-
return n &&
|
|
1127
|
-
}, f = () => n ? o.all().map(n.serialize) : o.all(),
|
|
1128
|
-
var
|
|
1129
|
-
const
|
|
1130
|
-
return n ?
|
|
1131
|
-
},
|
|
1132
|
-
if (typeof
|
|
1133
|
-
const
|
|
1134
|
-
if (o.deleteAnnotation(
|
|
1135
|
-
return n ? n.serialize(
|
|
1116
|
+
o.addAnnotation(d, R.REMOTE);
|
|
1117
|
+
}, a = () => i.clear(), s = () => o.clear(), h = (d) => {
|
|
1118
|
+
const u = o.getAnnotation(d);
|
|
1119
|
+
return n && u ? n.serialize(u) : u;
|
|
1120
|
+
}, f = () => n ? o.all().map(n.serialize) : o.all(), b = () => {
|
|
1121
|
+
var d;
|
|
1122
|
+
const u = (((d = i.selected) == null ? void 0 : d.map((l) => l.id)) || []).map((l) => o.getAnnotation(l)).filter(Boolean);
|
|
1123
|
+
return n ? u.map(n.serialize) : u;
|
|
1124
|
+
}, c = (d, u = !0) => fetch(d).then((l) => l.json()).then((l) => (g(l, u), l)), m = (d) => {
|
|
1125
|
+
if (typeof d == "string") {
|
|
1126
|
+
const u = o.getAnnotation(d);
|
|
1127
|
+
if (o.deleteAnnotation(d), u)
|
|
1128
|
+
return n ? n.serialize(u) : u;
|
|
1136
1129
|
} else {
|
|
1137
|
-
const
|
|
1138
|
-
if (
|
|
1139
|
-
return o.deleteAnnotation(
|
|
1130
|
+
const u = n ? n.parse(d).parsed : d;
|
|
1131
|
+
if (u)
|
|
1132
|
+
return o.deleteAnnotation(u), d;
|
|
1140
1133
|
}
|
|
1141
|
-
}, g = (
|
|
1134
|
+
}, g = (d, u = !0) => {
|
|
1142
1135
|
if (n) {
|
|
1143
|
-
const { parsed:
|
|
1144
|
-
v.length > 0 && console.warn(`Discarded ${v.length} invalid annotations`, v), o.bulkAddAnnotation(
|
|
1136
|
+
const { parsed: l, failed: v } = Ze(n)(d);
|
|
1137
|
+
v.length > 0 && console.warn(`Discarded ${v.length} invalid annotations`, v), o.bulkAddAnnotation(l, u, R.REMOTE);
|
|
1145
1138
|
} else
|
|
1146
|
-
o.bulkAddAnnotation(
|
|
1147
|
-
}, x = (
|
|
1148
|
-
|
|
1149
|
-
}, y = (
|
|
1139
|
+
o.bulkAddAnnotation(d, u, R.REMOTE);
|
|
1140
|
+
}, x = (d) => {
|
|
1141
|
+
d ? i.setSelected(d) : i.clear();
|
|
1142
|
+
}, y = (d) => {
|
|
1150
1143
|
if (n) {
|
|
1151
|
-
const
|
|
1152
|
-
return o.updateAnnotation(
|
|
1144
|
+
const u = n.parse(d).parsed, l = n.serialize(o.getAnnotation(u.id));
|
|
1145
|
+
return o.updateAnnotation(u), l;
|
|
1153
1146
|
} else {
|
|
1154
|
-
const
|
|
1155
|
-
return o.updateAnnotation(
|
|
1147
|
+
const u = o.getAnnotation(d.id);
|
|
1148
|
+
return o.updateAnnotation(d), u;
|
|
1156
1149
|
}
|
|
1157
1150
|
};
|
|
1158
1151
|
return {
|
|
@@ -1163,10 +1156,10 @@ const Ge = 250, Ke = (t) => {
|
|
|
1163
1156
|
clearAnnotations: s,
|
|
1164
1157
|
getAnnotationById: h,
|
|
1165
1158
|
getAnnotations: f,
|
|
1166
|
-
getSelected:
|
|
1167
|
-
loadAnnotations:
|
|
1159
|
+
getSelected: b,
|
|
1160
|
+
loadAnnotations: c,
|
|
1168
1161
|
redo: e.redo,
|
|
1169
|
-
removeAnnotation:
|
|
1162
|
+
removeAnnotation: m,
|
|
1170
1163
|
setAnnotations: g,
|
|
1171
1164
|
setSelected: x,
|
|
1172
1165
|
undo: e.undo,
|
|
@@ -1190,7 +1183,7 @@ let nn = (t) => crypto.getRandomValues(new Uint8Array(t)), on = (t, e, n) => {
|
|
|
1190
1183
|
e += en[n[t] & 63];
|
|
1191
1184
|
return e;
|
|
1192
1185
|
};
|
|
1193
|
-
const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }),
|
|
1186
|
+
const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), ln = (t) => {
|
|
1194
1187
|
const e = JSON.stringify(t);
|
|
1195
1188
|
let n = 0;
|
|
1196
1189
|
for (let o = 0, i = e.length; o < i; o++) {
|
|
@@ -1198,16 +1191,16 @@ const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1198
1191
|
n = (n << 5) - n + r, n |= 0;
|
|
1199
1192
|
}
|
|
1200
1193
|
return `${n}`;
|
|
1201
|
-
},
|
|
1194
|
+
}, Xt = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, cn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1202
1195
|
const { id: o, type: i, purpose: r, value: a, created: s, creator: h, ...f } = n;
|
|
1203
1196
|
return {
|
|
1204
|
-
id: o || `temp-${
|
|
1197
|
+
id: o || `temp-${ln(n)}`,
|
|
1205
1198
|
annotation: e,
|
|
1206
1199
|
type: i,
|
|
1207
1200
|
purpose: r,
|
|
1208
1201
|
value: a,
|
|
1209
1202
|
created: s ? new Date(s) : void 0,
|
|
1210
|
-
creator:
|
|
1203
|
+
creator: Xt(h),
|
|
1211
1204
|
...f
|
|
1212
1205
|
};
|
|
1213
1206
|
}), dn = (t) => t.map((e) => {
|
|
@@ -1216,7 +1209,7 @@ const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1216
1209
|
return delete i.annotation, (n = i.id) != null && n.startsWith("temp-") && delete i.id, { ...i, created: (o = i.created) == null ? void 0 : o.toISOString() };
|
|
1217
1210
|
});
|
|
1218
1211
|
sn();
|
|
1219
|
-
const
|
|
1212
|
+
const Nn = (t, e) => ({
|
|
1220
1213
|
parse: (n) => fn(n),
|
|
1221
1214
|
serialize: (n) => gn(n, t, e)
|
|
1222
1215
|
}), un = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, hn = (t) => {
|
|
@@ -1230,7 +1223,7 @@ const In = (t, e) => ({
|
|
|
1230
1223
|
if (a.length === 0)
|
|
1231
1224
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
1232
1225
|
const s = {
|
|
1233
|
-
creator:
|
|
1226
|
+
creator: Xt(n),
|
|
1234
1227
|
created: o ? new Date(o) : void 0,
|
|
1235
1228
|
updated: i ? new Date(i) : void 0,
|
|
1236
1229
|
annotation: e,
|
|
@@ -1238,36 +1231,36 @@ const In = (t, e) => ({
|
|
|
1238
1231
|
styleClass: a[0].styleClass
|
|
1239
1232
|
};
|
|
1240
1233
|
for (const h of a) {
|
|
1241
|
-
const
|
|
1242
|
-
switch (
|
|
1234
|
+
const b = (Array.isArray(h.selector) ? h.selector : [h.selector]).reduce((c, m) => {
|
|
1235
|
+
switch (m.type) {
|
|
1243
1236
|
case "TextQuoteSelector":
|
|
1244
|
-
|
|
1237
|
+
c.quote = m.exact;
|
|
1245
1238
|
break;
|
|
1246
1239
|
case "TextPositionSelector":
|
|
1247
|
-
|
|
1240
|
+
c.start = m.start, c.end = m.end;
|
|
1248
1241
|
break;
|
|
1249
1242
|
}
|
|
1250
|
-
return
|
|
1243
|
+
return c;
|
|
1251
1244
|
}, {});
|
|
1252
|
-
if (un(
|
|
1253
|
-
s.selector.push({ id: h.id, ...
|
|
1245
|
+
if (un(b))
|
|
1246
|
+
s.selector.push({ id: h.id, ...b });
|
|
1254
1247
|
else {
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1257
|
-
|
|
1248
|
+
const c = [
|
|
1249
|
+
b.start ? void 0 : "TextPositionSelector",
|
|
1250
|
+
b.quote ? void 0 : "TextQuoteSelector"
|
|
1258
1251
|
].filter(Boolean);
|
|
1259
|
-
return { error: Error(`Missing selector types: ${
|
|
1252
|
+
return { error: Error(`Missing selector types: ${c.join(" and ")} for annotation: ${t.id}`) };
|
|
1260
1253
|
}
|
|
1261
1254
|
}
|
|
1262
1255
|
return { parsed: s };
|
|
1263
1256
|
}, fn = (t) => {
|
|
1264
|
-
const e = t.id ||
|
|
1257
|
+
const e = t.id || Yt(), {
|
|
1265
1258
|
creator: n,
|
|
1266
1259
|
created: o,
|
|
1267
1260
|
modified: i,
|
|
1268
1261
|
body: r,
|
|
1269
1262
|
...a
|
|
1270
|
-
} = t, s =
|
|
1263
|
+
} = t, s = cn(r, e), h = hn(t);
|
|
1271
1264
|
return "error" in h ? { error: h.error } : {
|
|
1272
1265
|
parsed: {
|
|
1273
1266
|
...a,
|
|
@@ -1282,21 +1275,21 @@ const In = (t, e) => ({
|
|
|
1282
1275
|
creator: s,
|
|
1283
1276
|
created: h,
|
|
1284
1277
|
updated: f,
|
|
1285
|
-
...
|
|
1286
|
-
} = i,
|
|
1287
|
-
const { quote: g, start: x, end: y, range:
|
|
1278
|
+
...b
|
|
1279
|
+
} = i, c = a.map((m) => {
|
|
1280
|
+
const { quote: g, start: x, end: y, range: d } = m, { prefix: u, suffix: l } = te(d, n), v = [{
|
|
1288
1281
|
type: "TextQuoteSelector",
|
|
1289
1282
|
exact: g,
|
|
1290
|
-
prefix:
|
|
1291
|
-
suffix:
|
|
1283
|
+
prefix: u,
|
|
1284
|
+
suffix: l
|
|
1292
1285
|
}, {
|
|
1293
1286
|
type: "TextPositionSelector",
|
|
1294
1287
|
start: x,
|
|
1295
1288
|
end: y
|
|
1296
1289
|
}];
|
|
1297
1290
|
return {
|
|
1298
|
-
...
|
|
1299
|
-
id:
|
|
1291
|
+
...b,
|
|
1292
|
+
id: m.id,
|
|
1300
1293
|
source: e,
|
|
1301
1294
|
selector: v
|
|
1302
1295
|
};
|
|
@@ -1310,29 +1303,29 @@ const In = (t, e) => ({
|
|
|
1310
1303
|
creator: s,
|
|
1311
1304
|
created: h == null ? void 0 : h.toISOString(),
|
|
1312
1305
|
modified: f == null ? void 0 : f.toISOString(),
|
|
1313
|
-
target:
|
|
1306
|
+
target: c
|
|
1314
1307
|
};
|
|
1315
1308
|
};
|
|
1316
1309
|
function pn(t, e, n, o, i) {
|
|
1317
|
-
|
|
1310
|
+
Dt(t, e, n || 0, o || t.length - 1, i || mn);
|
|
1318
1311
|
}
|
|
1319
|
-
function
|
|
1312
|
+
function Dt(t, e, n, o, i) {
|
|
1320
1313
|
for (; o > n; ) {
|
|
1321
1314
|
if (o - n > 600) {
|
|
1322
|
-
var r = o - n + 1, a = e - n + 1, s = Math.log(r), h = 0.5 * Math.exp(2 * s / 3), f = 0.5 * Math.sqrt(s * h * (r - h) / r) * (a - r / 2 < 0 ? -1 : 1),
|
|
1323
|
-
|
|
1315
|
+
var r = o - n + 1, a = e - n + 1, s = Math.log(r), h = 0.5 * Math.exp(2 * s / 3), f = 0.5 * Math.sqrt(s * h * (r - h) / r) * (a - r / 2 < 0 ? -1 : 1), b = Math.max(n, Math.floor(e - a * h / r + f)), c = Math.min(o, Math.floor(e + (r - a) * h / r + f));
|
|
1316
|
+
Dt(t, e, b, c, i);
|
|
1324
1317
|
}
|
|
1325
|
-
var
|
|
1326
|
-
for (
|
|
1327
|
-
for (
|
|
1318
|
+
var m = t[e], g = n, x = o;
|
|
1319
|
+
for (W(t, n, e), i(t[o], m) > 0 && W(t, n, o); g < x; ) {
|
|
1320
|
+
for (W(t, g, x), g++, x--; i(t[g], m) < 0; )
|
|
1328
1321
|
g++;
|
|
1329
|
-
for (; i(t[x],
|
|
1322
|
+
for (; i(t[x], m) > 0; )
|
|
1330
1323
|
x--;
|
|
1331
1324
|
}
|
|
1332
|
-
i(t[n],
|
|
1325
|
+
i(t[n], m) === 0 ? W(t, n, x) : (x++, W(t, x, o)), x <= e && (n = x + 1), e <= x && (o = x - 1);
|
|
1333
1326
|
}
|
|
1334
1327
|
}
|
|
1335
|
-
function
|
|
1328
|
+
function W(t, e, n) {
|
|
1336
1329
|
var o = t[e];
|
|
1337
1330
|
t[e] = t[n], t[n] = o;
|
|
1338
1331
|
}
|
|
@@ -1349,13 +1342,13 @@ class bn {
|
|
|
1349
1342
|
search(e) {
|
|
1350
1343
|
let n = this.data;
|
|
1351
1344
|
const o = [];
|
|
1352
|
-
if (!
|
|
1345
|
+
if (!tt(e, n))
|
|
1353
1346
|
return o;
|
|
1354
1347
|
const i = this.toBBox, r = [];
|
|
1355
1348
|
for (; n; ) {
|
|
1356
1349
|
for (let a = 0; a < n.children.length; a++) {
|
|
1357
1350
|
const s = n.children[a], h = n.leaf ? i(s) : s;
|
|
1358
|
-
|
|
1351
|
+
tt(e, h) && (n.leaf ? o.push(s) : dt(e, h) ? this._all(s, o) : r.push(s));
|
|
1359
1352
|
}
|
|
1360
1353
|
n = r.pop();
|
|
1361
1354
|
}
|
|
@@ -1363,14 +1356,14 @@ class bn {
|
|
|
1363
1356
|
}
|
|
1364
1357
|
collides(e) {
|
|
1365
1358
|
let n = this.data;
|
|
1366
|
-
if (!
|
|
1359
|
+
if (!tt(e, n))
|
|
1367
1360
|
return !1;
|
|
1368
1361
|
const o = [];
|
|
1369
1362
|
for (; n; ) {
|
|
1370
1363
|
for (let i = 0; i < n.children.length; i++) {
|
|
1371
1364
|
const r = n.children[i], a = n.leaf ? this.toBBox(r) : r;
|
|
1372
|
-
if (
|
|
1373
|
-
if (n.leaf ||
|
|
1365
|
+
if (tt(e, a)) {
|
|
1366
|
+
if (n.leaf || dt(e, a))
|
|
1374
1367
|
return !0;
|
|
1375
1368
|
o.push(r);
|
|
1376
1369
|
}
|
|
@@ -1405,7 +1398,7 @@ class bn {
|
|
|
1405
1398
|
return e && this._insert(e, this.data.height - 1), this;
|
|
1406
1399
|
}
|
|
1407
1400
|
clear() {
|
|
1408
|
-
return this.data =
|
|
1401
|
+
return this.data = z([]), this;
|
|
1409
1402
|
}
|
|
1410
1403
|
remove(e, n) {
|
|
1411
1404
|
if (!e)
|
|
@@ -1415,11 +1408,11 @@ class bn {
|
|
|
1415
1408
|
let s, h, f;
|
|
1416
1409
|
for (; o || r.length; ) {
|
|
1417
1410
|
if (o || (o = r.pop(), h = r[r.length - 1], s = a.pop(), f = !0), o.leaf) {
|
|
1418
|
-
const
|
|
1419
|
-
if (
|
|
1420
|
-
return o.children.splice(
|
|
1411
|
+
const b = vn(e, o.children, n);
|
|
1412
|
+
if (b !== -1)
|
|
1413
|
+
return o.children.splice(b, 1), r.push(o), this._condense(r), this;
|
|
1421
1414
|
}
|
|
1422
|
-
!f && !o.leaf &&
|
|
1415
|
+
!f && !o.leaf && dt(o, i) ? (r.push(o), a.push(s), s = 0, h = o, o = o.children[0]) : h ? (s++, o = h.children[s], f = !1) : o = null;
|
|
1423
1416
|
}
|
|
1424
1417
|
return this;
|
|
1425
1418
|
}
|
|
@@ -1448,26 +1441,26 @@ class bn {
|
|
|
1448
1441
|
const r = o - n + 1;
|
|
1449
1442
|
let a = this._maxEntries, s;
|
|
1450
1443
|
if (r <= a)
|
|
1451
|
-
return s =
|
|
1452
|
-
i || (i = Math.ceil(Math.log(r) / Math.log(a)), a = Math.ceil(r / Math.pow(a, i - 1))), s =
|
|
1444
|
+
return s = z(e.slice(n, o + 1)), P(s, this.toBBox), s;
|
|
1445
|
+
i || (i = Math.ceil(Math.log(r) / Math.log(a)), a = Math.ceil(r / Math.pow(a, i - 1))), s = z([]), s.leaf = !1, s.height = i;
|
|
1453
1446
|
const h = Math.ceil(r / a), f = h * Math.ceil(Math.sqrt(a));
|
|
1454
|
-
|
|
1455
|
-
for (let
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1458
|
-
for (let
|
|
1459
|
-
const g = Math.min(
|
|
1460
|
-
s.children.push(this._build(e,
|
|
1447
|
+
It(e, n, o, f, this.compareMinX);
|
|
1448
|
+
for (let b = n; b <= o; b += f) {
|
|
1449
|
+
const c = Math.min(b + f - 1, o);
|
|
1450
|
+
It(e, b, c, h, this.compareMinY);
|
|
1451
|
+
for (let m = b; m <= c; m += h) {
|
|
1452
|
+
const g = Math.min(m + h - 1, c);
|
|
1453
|
+
s.children.push(this._build(e, m, g, i - 1));
|
|
1461
1454
|
}
|
|
1462
1455
|
}
|
|
1463
|
-
return
|
|
1456
|
+
return P(s, this.toBBox), s;
|
|
1464
1457
|
}
|
|
1465
1458
|
_chooseSubtree(e, n, o, i) {
|
|
1466
1459
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1467
1460
|
let r = 1 / 0, a = 1 / 0, s;
|
|
1468
1461
|
for (let h = 0; h < n.children.length; h++) {
|
|
1469
|
-
const f = n.children[h],
|
|
1470
|
-
|
|
1462
|
+
const f = n.children[h], b = ct(f), c = xn(e, f) - b;
|
|
1463
|
+
c < a ? (a = c, r = b < r ? b : r, s = f) : c === a && b < r && (r = b, s = f);
|
|
1471
1464
|
}
|
|
1472
1465
|
n = s || n.children[0];
|
|
1473
1466
|
}
|
|
@@ -1475,7 +1468,7 @@ class bn {
|
|
|
1475
1468
|
}
|
|
1476
1469
|
_insert(e, n, o) {
|
|
1477
1470
|
const i = o ? e : this.toBBox(e), r = [], a = this._chooseSubtree(i, this.data, n, r);
|
|
1478
|
-
for (a.children.push(e),
|
|
1471
|
+
for (a.children.push(e), j(a, i); n >= 0 && r[n].children.length > this._maxEntries; )
|
|
1479
1472
|
this._split(r, n), n--;
|
|
1480
1473
|
this._adjustParentBBoxes(i, r, n);
|
|
1481
1474
|
}
|
|
@@ -1483,17 +1476,17 @@ class bn {
|
|
|
1483
1476
|
_split(e, n) {
|
|
1484
1477
|
const o = e[n], i = o.children.length, r = this._minEntries;
|
|
1485
1478
|
this._chooseSplitAxis(o, r, i);
|
|
1486
|
-
const a = this._chooseSplitIndex(o, r, i), s =
|
|
1487
|
-
s.height = o.height, s.leaf = o.leaf,
|
|
1479
|
+
const a = this._chooseSplitIndex(o, r, i), s = z(o.children.splice(a, o.children.length - a));
|
|
1480
|
+
s.height = o.height, s.leaf = o.leaf, P(o, this.toBBox), P(s, this.toBBox), n ? e[n - 1].children.push(s) : this._splitRoot(o, s);
|
|
1488
1481
|
}
|
|
1489
1482
|
_splitRoot(e, n) {
|
|
1490
|
-
this.data =
|
|
1483
|
+
this.data = z([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, P(this.data, this.toBBox);
|
|
1491
1484
|
}
|
|
1492
1485
|
_chooseSplitIndex(e, n, o) {
|
|
1493
1486
|
let i, r = 1 / 0, a = 1 / 0;
|
|
1494
1487
|
for (let s = n; s <= o - n; s++) {
|
|
1495
|
-
const h =
|
|
1496
|
-
|
|
1488
|
+
const h = q(e, 0, s, this.toBBox), f = q(e, s, o, this.toBBox), b = An(h, f), c = ct(h) + ct(f);
|
|
1489
|
+
b < r ? (r = b, i = s, a = c < a ? c : a) : b === r && c < a && (a = c, i = s);
|
|
1497
1490
|
}
|
|
1498
1491
|
return i || o - n;
|
|
1499
1492
|
}
|
|
@@ -1505,25 +1498,25 @@ class bn {
|
|
|
1505
1498
|
// total margin of all possible split distributions where each node is at least m full
|
|
1506
1499
|
_allDistMargin(e, n, o, i) {
|
|
1507
1500
|
e.children.sort(i);
|
|
1508
|
-
const r = this.toBBox, a =
|
|
1509
|
-
let h =
|
|
1501
|
+
const r = this.toBBox, a = q(e, 0, n, r), s = q(e, o - n, o, r);
|
|
1502
|
+
let h = Z(a) + Z(s);
|
|
1510
1503
|
for (let f = n; f < o - n; f++) {
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1504
|
+
const b = e.children[f];
|
|
1505
|
+
j(a, e.leaf ? r(b) : b), h += Z(a);
|
|
1513
1506
|
}
|
|
1514
1507
|
for (let f = o - n - 1; f >= n; f--) {
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1508
|
+
const b = e.children[f];
|
|
1509
|
+
j(s, e.leaf ? r(b) : b), h += Z(s);
|
|
1517
1510
|
}
|
|
1518
1511
|
return h;
|
|
1519
1512
|
}
|
|
1520
1513
|
_adjustParentBBoxes(e, n, o) {
|
|
1521
1514
|
for (let i = o; i >= 0; i--)
|
|
1522
|
-
|
|
1515
|
+
j(n[i], e);
|
|
1523
1516
|
}
|
|
1524
1517
|
_condense(e) {
|
|
1525
1518
|
for (let n = e.length - 1, o; n >= 0; n--)
|
|
1526
|
-
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() :
|
|
1519
|
+
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : P(e[n], this.toBBox);
|
|
1527
1520
|
}
|
|
1528
1521
|
}
|
|
1529
1522
|
function vn(t, e, n) {
|
|
@@ -1534,18 +1527,18 @@ function vn(t, e, n) {
|
|
|
1534
1527
|
return o;
|
|
1535
1528
|
return -1;
|
|
1536
1529
|
}
|
|
1537
|
-
function
|
|
1538
|
-
|
|
1530
|
+
function P(t, e) {
|
|
1531
|
+
q(t, 0, t.children.length, e, t);
|
|
1539
1532
|
}
|
|
1540
|
-
function
|
|
1541
|
-
i || (i =
|
|
1533
|
+
function q(t, e, n, o, i) {
|
|
1534
|
+
i || (i = z(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
1542
1535
|
for (let r = e; r < n; r++) {
|
|
1543
1536
|
const a = t.children[r];
|
|
1544
|
-
|
|
1537
|
+
j(i, t.leaf ? o(a) : a);
|
|
1545
1538
|
}
|
|
1546
1539
|
return i;
|
|
1547
1540
|
}
|
|
1548
|
-
function
|
|
1541
|
+
function j(t, e) {
|
|
1549
1542
|
return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
|
|
1550
1543
|
}
|
|
1551
1544
|
function yn(t, e) {
|
|
@@ -1554,10 +1547,10 @@ function yn(t, e) {
|
|
|
1554
1547
|
function wn(t, e) {
|
|
1555
1548
|
return t.minY - e.minY;
|
|
1556
1549
|
}
|
|
1557
|
-
function
|
|
1550
|
+
function ct(t) {
|
|
1558
1551
|
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
1559
1552
|
}
|
|
1560
|
-
function
|
|
1553
|
+
function Z(t) {
|
|
1561
1554
|
return t.maxX - t.minX + (t.maxY - t.minY);
|
|
1562
1555
|
}
|
|
1563
1556
|
function xn(t, e) {
|
|
@@ -1567,13 +1560,13 @@ function An(t, e) {
|
|
|
1567
1560
|
const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), r = Math.min(t.maxY, e.maxY);
|
|
1568
1561
|
return Math.max(0, i - n) * Math.max(0, r - o);
|
|
1569
1562
|
}
|
|
1570
|
-
function
|
|
1563
|
+
function dt(t, e) {
|
|
1571
1564
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1572
1565
|
}
|
|
1573
|
-
function
|
|
1566
|
+
function tt(t, e) {
|
|
1574
1567
|
return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
|
|
1575
1568
|
}
|
|
1576
|
-
function
|
|
1569
|
+
function z(t) {
|
|
1577
1570
|
return {
|
|
1578
1571
|
children: t,
|
|
1579
1572
|
height: 1,
|
|
@@ -1584,7 +1577,7 @@ function W(t) {
|
|
|
1584
1577
|
maxY: -1 / 0
|
|
1585
1578
|
};
|
|
1586
1579
|
}
|
|
1587
|
-
function
|
|
1580
|
+
function It(t, e, n, o, i) {
|
|
1588
1581
|
const r = [e, n];
|
|
1589
1582
|
for (; r.length; ) {
|
|
1590
1583
|
if (n = r.pop(), e = r.pop(), n - e <= o)
|
|
@@ -1594,109 +1587,109 @@ function Ot(t, e, n, o, i) {
|
|
|
1594
1587
|
}
|
|
1595
1588
|
}
|
|
1596
1589
|
const En = (t, e) => {
|
|
1597
|
-
const n = new bn(), o = /* @__PURE__ */ new Map(), i = (
|
|
1598
|
-
const v =
|
|
1599
|
-
const E =
|
|
1590
|
+
const n = new bn(), o = /* @__PURE__ */ new Map(), i = (u, l) => {
|
|
1591
|
+
const v = u.selector.flatMap((L) => {
|
|
1592
|
+
const E = D([L]) ? L.range : Nt(L, e).range;
|
|
1600
1593
|
return Array.from(E.getClientRects());
|
|
1601
|
-
}), C = re(v).map(({ left: L, top: E, right:
|
|
1594
|
+
}), C = re(v).map(({ left: L, top: E, right: T, bottom: p }) => new DOMRect(L - l.left, E - l.top, T - L, p - E));
|
|
1602
1595
|
return C.map((L) => {
|
|
1603
|
-
const { x: E, y:
|
|
1596
|
+
const { x: E, y: T, width: p, height: A } = L;
|
|
1604
1597
|
return {
|
|
1605
1598
|
minX: E,
|
|
1606
|
-
minY:
|
|
1607
|
-
maxX: E +
|
|
1608
|
-
maxY:
|
|
1599
|
+
minY: T,
|
|
1600
|
+
maxX: E + p,
|
|
1601
|
+
maxY: T + A,
|
|
1609
1602
|
annotation: {
|
|
1610
|
-
id:
|
|
1603
|
+
id: u.annotation,
|
|
1611
1604
|
rects: C
|
|
1612
1605
|
}
|
|
1613
1606
|
};
|
|
1614
1607
|
});
|
|
1615
1608
|
}, r = () => [...o.values()], a = () => {
|
|
1616
1609
|
n.clear(), o.clear();
|
|
1617
|
-
}, s = (
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
}, h = (
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1623
|
-
}, f = (
|
|
1624
|
-
h(
|
|
1625
|
-
},
|
|
1626
|
-
|
|
1627
|
-
const v = e.getBoundingClientRect(), C =
|
|
1628
|
-
C.forEach(({ target: E, rects:
|
|
1629
|
-
const L = C.reduce((E, { rects:
|
|
1610
|
+
}, s = (u) => {
|
|
1611
|
+
const l = i(u, e.getBoundingClientRect());
|
|
1612
|
+
l.forEach((v) => n.insert(v)), o.set(u.annotation, l);
|
|
1613
|
+
}, h = (u) => {
|
|
1614
|
+
const l = o.get(u.annotation);
|
|
1615
|
+
l && (l.forEach((v) => n.remove(v)), o.delete(u.annotation));
|
|
1616
|
+
}, f = (u) => {
|
|
1617
|
+
h(u), s(u);
|
|
1618
|
+
}, b = (u, l = !0) => {
|
|
1619
|
+
l && a();
|
|
1620
|
+
const v = e.getBoundingClientRect(), C = u.map((E) => ({ target: E, rects: i(E, v) }));
|
|
1621
|
+
C.forEach(({ target: E, rects: T }) => o.set(E.annotation, T));
|
|
1622
|
+
const L = C.reduce((E, { rects: T }) => [...E, ...T], []);
|
|
1630
1623
|
n.load(L);
|
|
1631
|
-
},
|
|
1624
|
+
}, c = (u, l) => {
|
|
1632
1625
|
const v = n.search({
|
|
1633
|
-
minX:
|
|
1634
|
-
minY:
|
|
1635
|
-
maxX:
|
|
1636
|
-
maxY:
|
|
1637
|
-
}), C = (L) => L.annotation.rects.reduce((E,
|
|
1626
|
+
minX: u,
|
|
1627
|
+
minY: l,
|
|
1628
|
+
maxX: u,
|
|
1629
|
+
maxY: l
|
|
1630
|
+
}), C = (L) => L.annotation.rects.reduce((E, T) => E + T.width * T.height, 0);
|
|
1638
1631
|
if (v.length > 0)
|
|
1639
1632
|
return v.sort((L, E) => C(L) - C(E)), v[0].annotation.id;
|
|
1640
|
-
},
|
|
1641
|
-
const
|
|
1642
|
-
if (
|
|
1633
|
+
}, m = (u) => {
|
|
1634
|
+
const l = g(u);
|
|
1635
|
+
if (l.length === 0)
|
|
1643
1636
|
return;
|
|
1644
|
-
let v =
|
|
1645
|
-
for (let
|
|
1646
|
-
const
|
|
1647
|
-
v = Math.min(v,
|
|
1637
|
+
let v = l[0].left, C = l[0].top, L = l[0].right, E = l[0].bottom;
|
|
1638
|
+
for (let T = 1; T < l.length; T++) {
|
|
1639
|
+
const p = l[T];
|
|
1640
|
+
v = Math.min(v, p.left), C = Math.min(C, p.top), L = Math.max(L, p.right), E = Math.max(E, p.bottom);
|
|
1648
1641
|
}
|
|
1649
1642
|
return new DOMRect(v, C, L - v, E - C);
|
|
1650
|
-
}, g = (
|
|
1651
|
-
const
|
|
1652
|
-
return
|
|
1643
|
+
}, g = (u) => {
|
|
1644
|
+
const l = o.get(u);
|
|
1645
|
+
return l ? l[0].annotation.rects : [];
|
|
1653
1646
|
};
|
|
1654
1647
|
return {
|
|
1655
1648
|
all: r,
|
|
1656
1649
|
clear: a,
|
|
1657
|
-
getAt:
|
|
1658
|
-
getAnnotationBounds:
|
|
1650
|
+
getAt: c,
|
|
1651
|
+
getAnnotationBounds: m,
|
|
1659
1652
|
getAnnotationRects: g,
|
|
1660
|
-
getIntersecting: (
|
|
1661
|
-
const L = n.search({ minX:
|
|
1662
|
-
return Array.from(E).map((
|
|
1663
|
-
annotation: t.getAnnotation(
|
|
1664
|
-
rects: g(
|
|
1665
|
-
})).filter((
|
|
1653
|
+
getIntersecting: (u, l, v, C) => {
|
|
1654
|
+
const L = n.search({ minX: u, minY: l, maxX: v, maxY: C }), E = new Set(L.reduce((T, p) => [...T, p.annotation.id], []));
|
|
1655
|
+
return Array.from(E).map((T) => ({
|
|
1656
|
+
annotation: t.getAnnotation(T),
|
|
1657
|
+
rects: g(T)
|
|
1658
|
+
})).filter((T) => !!T.annotation);
|
|
1666
1659
|
},
|
|
1667
1660
|
insert: s,
|
|
1668
|
-
recalculate: () =>
|
|
1661
|
+
recalculate: () => b(t.all().map((u) => u.target), !0),
|
|
1669
1662
|
remove: h,
|
|
1670
|
-
set:
|
|
1663
|
+
set: b,
|
|
1671
1664
|
size: () => n.all().length,
|
|
1672
1665
|
update: f
|
|
1673
1666
|
};
|
|
1674
1667
|
}, Sn = (t, e) => {
|
|
1675
|
-
const n = qe(), o = En(n, t), i =
|
|
1676
|
-
const
|
|
1677
|
-
return
|
|
1678
|
-
}, h = (y,
|
|
1679
|
-
const
|
|
1680
|
-
return v.length > 0 ? (console.warn("Could not revive all targets for these annotations:", v), n.bulkAddAnnotation(
|
|
1681
|
-
}, f = (y,
|
|
1682
|
-
const
|
|
1683
|
-
return
|
|
1684
|
-
n.getAnnotation(v.id) ? n.updateAnnotation(v,
|
|
1685
|
-
}),
|
|
1686
|
-
},
|
|
1687
|
-
const
|
|
1688
|
-
n.updateTarget(
|
|
1689
|
-
},
|
|
1690
|
-
const
|
|
1691
|
-
n.bulkUpdateTargets(
|
|
1692
|
-
},
|
|
1693
|
-
const
|
|
1694
|
-
return
|
|
1695
|
-
}, g = (y,
|
|
1668
|
+
const n = qe(), o = En(n, t), i = Ne(n, e), r = Me(n), a = Qe(), s = (y, d = R.LOCAL) => {
|
|
1669
|
+
const u = ot(y, t), l = D(u.target.selector);
|
|
1670
|
+
return l && n.addAnnotation(u, d), l;
|
|
1671
|
+
}, h = (y, d = !0, u = R.LOCAL) => {
|
|
1672
|
+
const l = y.map((C) => ot(C, t)), v = l.filter((C) => !D(C.target.selector));
|
|
1673
|
+
return v.length > 0 ? (console.warn("Could not revive all targets for these annotations:", v), n.bulkAddAnnotation(l, d, u), v) : (n.bulkAddAnnotation(l, d, u), []);
|
|
1674
|
+
}, f = (y, d = R.LOCAL) => {
|
|
1675
|
+
const u = y.map((v) => ot(v, t)), l = u.filter((v) => !D(v.target.selector));
|
|
1676
|
+
return l.length > 0 && console.warn("Could not revive all targets for these annotations:", l), u.forEach((v) => {
|
|
1677
|
+
n.getAnnotation(v.id) ? n.updateAnnotation(v, d) : n.addAnnotation(v, d);
|
|
1678
|
+
}), l;
|
|
1679
|
+
}, b = (y, d = R.LOCAL) => {
|
|
1680
|
+
const u = nt(y, t);
|
|
1681
|
+
n.updateTarget(u, d);
|
|
1682
|
+
}, c = (y, d = R.LOCAL) => {
|
|
1683
|
+
const u = y.map((l) => nt(l, t));
|
|
1684
|
+
n.bulkUpdateTargets(u, d);
|
|
1685
|
+
}, m = (y, d) => {
|
|
1686
|
+
const u = o.getAt(y, d);
|
|
1687
|
+
return u ? n.getAnnotation(u) : void 0;
|
|
1688
|
+
}, g = (y, d, u, l = 5) => {
|
|
1696
1689
|
const v = o.getAnnotationRects(y);
|
|
1697
1690
|
if (v.length !== 0) {
|
|
1698
|
-
if (
|
|
1699
|
-
const C = v.find(({ top: L, right: E, bottom:
|
|
1691
|
+
if (d && u) {
|
|
1692
|
+
const C = v.find(({ top: L, right: E, bottom: T, left: p }) => d >= p - l && d <= E + l && u >= L - l && u <= T + l);
|
|
1700
1693
|
if (C)
|
|
1701
1694
|
return C;
|
|
1702
1695
|
}
|
|
@@ -1704,20 +1697,20 @@ const En = (t, e) => {
|
|
|
1704
1697
|
}
|
|
1705
1698
|
}, x = () => o.recalculate();
|
|
1706
1699
|
return n.observe(({ changes: y }) => {
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1700
|
+
const d = (y.created || []).filter((v) => D(v.target.selector)), u = (y.deleted || []).filter((v) => D(v.target.selector)), l = (y.updated || []).filter((v) => D(v.newValue.target.selector));
|
|
1701
|
+
d.length > 0 && o.set(d.map((v) => v.target), !1), (u == null ? void 0 : u.length) > 0 && u.forEach((v) => o.remove(v.target)), (l == null ? void 0 : l.length) > 0 && l.forEach(({ newValue: v }) => o.update(v.target));
|
|
1709
1702
|
}), {
|
|
1710
1703
|
store: {
|
|
1711
1704
|
...n,
|
|
1712
1705
|
addAnnotation: s,
|
|
1713
1706
|
bulkAddAnnotation: h,
|
|
1714
|
-
bulkUpdateTargets:
|
|
1707
|
+
bulkUpdateTargets: c,
|
|
1715
1708
|
bulkUpsertAnnotations: f,
|
|
1716
1709
|
getAnnotationBounds: g,
|
|
1717
|
-
getAt:
|
|
1710
|
+
getAt: m,
|
|
1718
1711
|
getIntersecting: o.getIntersecting,
|
|
1719
1712
|
recalculatePositions: x,
|
|
1720
|
-
updateTarget:
|
|
1713
|
+
updateTarget: b
|
|
1721
1714
|
},
|
|
1722
1715
|
selection: i,
|
|
1723
1716
|
hover: r,
|
|
@@ -1731,25 +1724,25 @@ const En = (t, e) => {
|
|
|
1731
1724
|
}, Ln = (t, e, n = {}) => {
|
|
1732
1725
|
const o = Cn(), i = o.getContext("2d");
|
|
1733
1726
|
t.appendChild(o);
|
|
1734
|
-
const r = /* @__PURE__ */ new Map(), a = (
|
|
1735
|
-
return e.on("selectionChange", (
|
|
1736
|
-
a(
|
|
1727
|
+
const r = /* @__PURE__ */ new Map(), a = (c) => Array.from(r.entries()).filter(([m, g]) => g.presenceKey === c.presenceKey).map(([m, g]) => m);
|
|
1728
|
+
return e.on("selectionChange", (c, m) => {
|
|
1729
|
+
a(c).forEach((x) => r.delete(x)), m && m.forEach((x) => r.set(x, c));
|
|
1737
1730
|
}), {
|
|
1738
1731
|
clear: () => {
|
|
1739
|
-
const { width:
|
|
1740
|
-
i.clearRect(-0.5, -0.5,
|
|
1732
|
+
const { width: c, height: m } = o;
|
|
1733
|
+
i.clearRect(-0.5, -0.5, c + 1, m + 1);
|
|
1741
1734
|
},
|
|
1742
1735
|
destroy: () => {
|
|
1743
1736
|
o.remove();
|
|
1744
1737
|
},
|
|
1745
|
-
paint: (
|
|
1738
|
+
paint: (c, m, g) => {
|
|
1746
1739
|
n.font && (i.font = n.font);
|
|
1747
|
-
const x = r.get(
|
|
1740
|
+
const x = r.get(c.annotation.id);
|
|
1748
1741
|
if (x) {
|
|
1749
|
-
const { height: y } =
|
|
1750
|
-
i.fillStyle = x.appearance.color, i.fillRect(
|
|
1751
|
-
const
|
|
1752
|
-
return i.fillRect(
|
|
1742
|
+
const { height: y } = c.rects[0], d = c.rects[0].x + m.left, u = c.rects[0].y + m.top;
|
|
1743
|
+
i.fillStyle = x.appearance.color, i.fillRect(d - 2, u - 2.5, 2, y + 5);
|
|
1744
|
+
const l = i.measureText(x.appearance.label), v = l.width + 6, C = l.actualBoundingBoxAscent + l.actualBoundingBoxDescent + 8, L = l.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1745
|
+
return i.fillRect(d - 2, u - 2.5 - C, v, C), i.fillStyle = "#fff", i.fillText(x.appearance.label, d + 1, u - L), {
|
|
1753
1746
|
fill: x.appearance.color,
|
|
1754
1747
|
fillOpacity: g ? 0.45 : 0.18
|
|
1755
1748
|
};
|
|
@@ -1757,169 +1750,169 @@ const En = (t, e) => {
|
|
|
1757
1750
|
},
|
|
1758
1751
|
reset: () => {
|
|
1759
1752
|
o.width = 2 * window.innerWidth, o.height = 2 * window.innerHeight;
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1753
|
+
const c = o.getContext("2d");
|
|
1754
|
+
c.scale(2, 2), c.translate(0.5, 0.5);
|
|
1762
1755
|
}
|
|
1763
1756
|
};
|
|
1764
|
-
},
|
|
1757
|
+
}, $t = (t) => {
|
|
1765
1758
|
if (t === null)
|
|
1766
1759
|
return document.scrollingElement;
|
|
1767
1760
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
1768
|
-
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
1769
|
-
},
|
|
1761
|
+
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : $t(t.parentElement);
|
|
1762
|
+
}, Tn = (t, e) => (n) => {
|
|
1770
1763
|
const o = (r) => {
|
|
1771
|
-
const a = i.getBoundingClientRect(), s = i.clientHeight, h = i.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width:
|
|
1772
|
-
i.scroll({ top:
|
|
1773
|
-
}, i =
|
|
1764
|
+
const a = i.getBoundingClientRect(), s = i.clientHeight, h = i.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: b, height: c } = e.getAnnotationBounds(n.id), m = f.top - a.top, g = f.left - a.left, x = i.parentElement ? i.scrollTop : 0, y = i.parentElement ? i.scrollLeft : 0, d = m + x - (s - c) / 2, u = g + y - (h - b) / 2;
|
|
1765
|
+
i.scroll({ top: d, left: u, behavior: "smooth" });
|
|
1766
|
+
}, i = $t(t);
|
|
1774
1767
|
if (i) {
|
|
1775
1768
|
const r = e.getAnnotation(n.id), { range: a } = r.target.selector[0];
|
|
1776
1769
|
if (a && !a.collapsed)
|
|
1777
1770
|
return o(r.target), !0;
|
|
1778
1771
|
{
|
|
1779
|
-
const s =
|
|
1772
|
+
const s = nt(r.target, t), { range: h } = s.selector[0];
|
|
1780
1773
|
if (h && !h.collapsed)
|
|
1781
1774
|
return o(s), !0;
|
|
1782
1775
|
}
|
|
1783
1776
|
}
|
|
1784
1777
|
return !1;
|
|
1785
|
-
},
|
|
1778
|
+
}, Bn = (t, e) => ({
|
|
1786
1779
|
...t,
|
|
1787
1780
|
annotationEnabled: t.annotationEnabled === void 0 ? e.annotationEnabled : t.annotationEnabled
|
|
1788
1781
|
}), Rn = (t, e, n, o) => {
|
|
1789
1782
|
const { store: i, selection: r } = e;
|
|
1790
1783
|
let a, s;
|
|
1791
|
-
const h = (
|
|
1792
|
-
let f = !1,
|
|
1793
|
-
const
|
|
1794
|
-
var
|
|
1784
|
+
const h = (d) => a = d;
|
|
1785
|
+
let f = !1, b;
|
|
1786
|
+
const c = (d) => {
|
|
1787
|
+
var l;
|
|
1795
1788
|
if (!f)
|
|
1796
1789
|
return;
|
|
1797
|
-
!((
|
|
1798
|
-
annotation:
|
|
1790
|
+
!((l = d.target.parentElement) != null && l.closest(k)) ? s = {
|
|
1791
|
+
annotation: Yt(),
|
|
1799
1792
|
selector: [],
|
|
1800
1793
|
creator: a,
|
|
1801
1794
|
created: /* @__PURE__ */ new Date()
|
|
1802
1795
|
} : s = void 0;
|
|
1803
1796
|
};
|
|
1804
|
-
n && t.addEventListener("selectstart",
|
|
1805
|
-
const
|
|
1806
|
-
var E;
|
|
1807
|
-
const
|
|
1808
|
-
if (!!((E =
|
|
1797
|
+
n && t.addEventListener("selectstart", c);
|
|
1798
|
+
const m = ft((d) => {
|
|
1799
|
+
var E, T;
|
|
1800
|
+
const u = document.getSelection();
|
|
1801
|
+
if (!!((T = (E = u.anchorNode) == null ? void 0 : E.parentElement) != null && T.closest(k))) {
|
|
1809
1802
|
s = void 0;
|
|
1810
1803
|
return;
|
|
1811
1804
|
}
|
|
1812
|
-
if (
|
|
1805
|
+
if (d.timeStamp - ((b == null ? void 0 : b.timeStamp) || d.timeStamp) < 1e3 && !s && c(b), u.isCollapsed || !f || !s)
|
|
1813
1806
|
return;
|
|
1814
|
-
const v =
|
|
1807
|
+
const v = u.getRangeAt(0);
|
|
1815
1808
|
if (ne(v))
|
|
1816
1809
|
return;
|
|
1817
1810
|
const C = Kt(v.cloneRange());
|
|
1818
|
-
(C.length !== s.selector.length || C.some((
|
|
1819
|
-
var
|
|
1820
|
-
return
|
|
1811
|
+
(C.length !== s.selector.length || C.some((p, A) => {
|
|
1812
|
+
var w;
|
|
1813
|
+
return p.toString() !== ((w = s.selector[A]) == null ? void 0 : w.quote);
|
|
1821
1814
|
})) && (s = {
|
|
1822
1815
|
...s,
|
|
1823
|
-
selector: C.map((
|
|
1824
|
-
}, i.getAnnotation(s.annotation) ? i.updateTarget(s,
|
|
1816
|
+
selector: C.map((p) => se(p, t, o))
|
|
1817
|
+
}, i.getAnnotation(s.annotation) ? i.updateTarget(s, R.LOCAL) : (i.addAnnotation({
|
|
1825
1818
|
id: s.annotation,
|
|
1826
1819
|
bodies: [],
|
|
1827
1820
|
target: s
|
|
1828
|
-
},
|
|
1821
|
+
}, R.LOCAL), r.clickSelect(s.annotation, b)));
|
|
1829
1822
|
});
|
|
1830
|
-
n && document.addEventListener("selectionchange",
|
|
1831
|
-
const g = (
|
|
1832
|
-
const { target:
|
|
1833
|
-
|
|
1823
|
+
n && document.addEventListener("selectionchange", m);
|
|
1824
|
+
const g = (d) => {
|
|
1825
|
+
const { target: u, timeStamp: l, offsetX: v, offsetY: C, type: L } = d;
|
|
1826
|
+
b = { ...d, target: u, timeStamp: l, offsetX: v, offsetY: C, type: L }, f = d.button === 0;
|
|
1834
1827
|
};
|
|
1835
1828
|
t.addEventListener("pointerdown", g);
|
|
1836
|
-
const x = (
|
|
1829
|
+
const x = (d) => {
|
|
1837
1830
|
var C;
|
|
1838
|
-
if (!!((C =
|
|
1831
|
+
if (!!((C = d.target.parentElement) != null && C.closest(k)) || !f)
|
|
1839
1832
|
return;
|
|
1840
|
-
const
|
|
1841
|
-
const { x: L, y: E } = t.getBoundingClientRect(),
|
|
1842
|
-
if (
|
|
1843
|
-
const { selected:
|
|
1844
|
-
(
|
|
1833
|
+
const l = () => {
|
|
1834
|
+
const { x: L, y: E } = t.getBoundingClientRect(), T = i.getAt(d.clientX - L, d.clientY - E);
|
|
1835
|
+
if (T) {
|
|
1836
|
+
const { selected: p } = r;
|
|
1837
|
+
(p.length !== 1 || p[0].id !== T.id) && r.clickSelect(T.id, d);
|
|
1845
1838
|
} else
|
|
1846
1839
|
r.isEmpty() || r.clear();
|
|
1847
|
-
}, v =
|
|
1848
|
-
document.getSelection().isCollapsed && v < 300 ? (s = void 0,
|
|
1840
|
+
}, v = d.timeStamp - b.timeStamp;
|
|
1841
|
+
document.getSelection().isCollapsed && v < 300 ? (s = void 0, l()) : s && r.clickSelect(s.annotation, d);
|
|
1849
1842
|
};
|
|
1850
1843
|
return document.addEventListener("pointerup", x), {
|
|
1851
1844
|
destroy: () => {
|
|
1852
|
-
t.removeEventListener("selectstart",
|
|
1845
|
+
t.removeEventListener("selectstart", c), document.removeEventListener("selectionchange", m), t.removeEventListener("pointerdown", g), document.removeEventListener("pointerup", x);
|
|
1853
1846
|
},
|
|
1854
1847
|
setUser: h
|
|
1855
1848
|
};
|
|
1856
|
-
},
|
|
1849
|
+
}, Mt = "SPANS", Un = (t, e = {}) => {
|
|
1857
1850
|
Qt(t);
|
|
1858
|
-
const n =
|
|
1851
|
+
const n = Bn(e, {
|
|
1859
1852
|
annotationEnabled: !0
|
|
1860
1853
|
}), o = Sn(t, n.pointerAction), { selection: i, viewport: r } = o, a = o.store, s = Ke(a), h = Je(o, s, n.adapter);
|
|
1861
1854
|
let f = an();
|
|
1862
|
-
const
|
|
1863
|
-
if (!
|
|
1864
|
-
throw `Unknown renderer implementation: ${
|
|
1865
|
-
console.debug(`Using ${
|
|
1866
|
-
const
|
|
1867
|
-
return
|
|
1855
|
+
const b = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : Mt : n.renderer || Mt, c = b === "SPANS" ? Ce(t, o, r) : b === "CSS_HIGHLIGHTS" ? Ae(t, o, r) : b === "CANVAS" ? he(t, o, r) : void 0;
|
|
1856
|
+
if (!c)
|
|
1857
|
+
throw `Unknown renderer implementation: ${b}`;
|
|
1858
|
+
console.debug(`Using ${b} renderer`), n.style && c.setStyle(n.style);
|
|
1859
|
+
const m = Rn(t, o, n.annotationEnabled, n.offsetReferenceSelector);
|
|
1860
|
+
return m.setUser(f), {
|
|
1868
1861
|
...tn(o, s, n.adapter),
|
|
1869
1862
|
destroy: () => {
|
|
1870
|
-
|
|
1863
|
+
c.destroy(), m.destroy(), s.destroy();
|
|
1871
1864
|
},
|
|
1872
1865
|
element: t,
|
|
1873
1866
|
getUser: () => f,
|
|
1874
|
-
setFilter: (E) =>
|
|
1875
|
-
setStyle: (E) =>
|
|
1867
|
+
setFilter: (E) => c.setFilter(E),
|
|
1868
|
+
setStyle: (E) => c.setStyle(E),
|
|
1876
1869
|
setUser: (E) => {
|
|
1877
|
-
f = E,
|
|
1870
|
+
f = E, m.setUser(E);
|
|
1878
1871
|
},
|
|
1879
1872
|
setSelected: (E) => {
|
|
1880
1873
|
E ? i.setSelected(E) : i.clear();
|
|
1881
1874
|
},
|
|
1882
1875
|
setPresenceProvider: (E) => {
|
|
1883
|
-
E && (
|
|
1876
|
+
E && (c.setPainter(Ln(t, E, n.presence)), E.on("selectionChange", () => c.redraw()));
|
|
1884
1877
|
},
|
|
1885
|
-
setVisible: (E) =>
|
|
1878
|
+
setVisible: (E) => c.setVisible(E),
|
|
1886
1879
|
on: h.on,
|
|
1887
1880
|
off: h.off,
|
|
1888
|
-
scrollIntoView:
|
|
1881
|
+
scrollIntoView: Tn(t, a),
|
|
1889
1882
|
state: o
|
|
1890
1883
|
};
|
|
1891
1884
|
};
|
|
1892
1885
|
export {
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1886
|
+
et as DEFAULT_SELECTED_STYLE,
|
|
1887
|
+
$ as DEFAULT_STYLE,
|
|
1888
|
+
Ot as NOT_ANNOTATABLE_CLASS,
|
|
1889
|
+
k as NOT_ANNOTATABLE_SELECTOR,
|
|
1890
|
+
R as Origin,
|
|
1898
1891
|
Oe as PointerSelectAction,
|
|
1899
|
-
|
|
1892
|
+
Nn as W3CTextFormat,
|
|
1900
1893
|
Qt as cancelSingleClickEvents,
|
|
1901
1894
|
On as createBody,
|
|
1902
1895
|
he as createCanvasRenderer,
|
|
1903
1896
|
Ae as createHighlightsRenderer,
|
|
1904
1897
|
xe as createRenderer,
|
|
1905
1898
|
Ce as createSpansRenderer,
|
|
1906
|
-
|
|
1899
|
+
Un as createTextAnnotator,
|
|
1907
1900
|
Sn as createTextAnnotatorState,
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1901
|
+
ft as debounce,
|
|
1902
|
+
Bn as fillDefaults,
|
|
1903
|
+
In as getAnnotatableFragment,
|
|
1911
1904
|
Mn as getClientRectsPonyfill,
|
|
1912
1905
|
te as getQuoteContext,
|
|
1913
|
-
|
|
1914
|
-
|
|
1906
|
+
ut as getRangeAnnotatableContents,
|
|
1907
|
+
D as isRevived,
|
|
1915
1908
|
ne as isWhitespaceOrEmpty,
|
|
1916
1909
|
re as mergeClientRects,
|
|
1917
1910
|
qt as paint,
|
|
1918
1911
|
fn as parseW3CTextAnnotation,
|
|
1919
1912
|
se as rangeToSelector,
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1913
|
+
ot as reviveAnnotation,
|
|
1914
|
+
Nt as reviveSelector,
|
|
1915
|
+
nt as reviveTarget,
|
|
1923
1916
|
gn as serializeW3CTextAnnotation,
|
|
1924
1917
|
Kt as splitAnnotatableRanges,
|
|
1925
1918
|
ee as whitespaceOrEmptyRegex
|