@recogito/text-annotator 3.0.0-rc.52 → 3.0.0-rc.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/TextAnnotator.d.ts +1 -1
- package/dist/src/highlight/HighlightStyle.d.ts +1 -1
- package/dist/src/model/w3c/W3CTextFormatAdapter.d.ts +4 -4
- package/dist/src/state/TextAnnotationStore.d.ts +2 -1
- package/dist/src/utils/mergeClientRects.d.ts +1 -0
- package/dist/text-annotator.es.js +739 -731
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +2 -2
- package/dist/text-annotator.umd.js.map +1 -1
- package/package.json +6 -6
|
@@ -7,7 +7,7 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
7
7
|
}, Le = (t) => t.addEventListener("click", (e) => {
|
|
8
8
|
// Allow clicks within not-annotatable elements
|
|
9
9
|
!e.target.closest(tt) && !e.target.closest("a") && e.preventDefault();
|
|
10
|
-
}),
|
|
10
|
+
}), xt = (t) => ({
|
|
11
11
|
...t,
|
|
12
12
|
type: t.type,
|
|
13
13
|
x: t.x,
|
|
@@ -56,7 +56,7 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
56
56
|
return (...o) => {
|
|
57
57
|
clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);
|
|
58
58
|
};
|
|
59
|
-
},
|
|
59
|
+
}, Be = function* (t) {
|
|
60
60
|
const e = document.createNodeIterator(
|
|
61
61
|
t.commonAncestorContainer,
|
|
62
62
|
NodeFilter.SHOW_ELEMENT,
|
|
@@ -65,11 +65,11 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
65
65
|
let n;
|
|
66
66
|
for (; n = e.nextNode(); )
|
|
67
67
|
n instanceof HTMLElement && (yield n);
|
|
68
|
-
},
|
|
68
|
+
}, Me = (t) => {
|
|
69
69
|
if (!Ce(t)) return [];
|
|
70
70
|
const e = [];
|
|
71
71
|
let n = null;
|
|
72
|
-
for (const o of
|
|
72
|
+
for (const o of Be(t)) {
|
|
73
73
|
let i;
|
|
74
74
|
n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
|
|
75
75
|
}
|
|
@@ -78,18 +78,18 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
78
78
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
79
79
|
}
|
|
80
80
|
return e.length > 0 ? e : [t];
|
|
81
|
-
},
|
|
81
|
+
}, Ut = (t) => {
|
|
82
82
|
const e = t.cloneContents();
|
|
83
83
|
return e.querySelectorAll(tt).forEach((n) => n.remove()), e;
|
|
84
84
|
}, Re = (t, e, n = 10, o) => {
|
|
85
85
|
const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();
|
|
86
86
|
s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
|
|
87
|
-
const a =
|
|
87
|
+
const a = Ut(s).textContent, r = document.createRange();
|
|
88
88
|
r.setStart(t.endContainer, t.endOffset), i === document.body ? r.setEnd(i, i.childNodes.length) : r.setEndAfter(i);
|
|
89
|
-
const
|
|
89
|
+
const d = Ut(r).textContent;
|
|
90
90
|
return {
|
|
91
91
|
prefix: a.substring(a.length - n),
|
|
92
|
-
suffix:
|
|
92
|
+
suffix: d.substring(0, n)
|
|
93
93
|
};
|
|
94
94
|
}, F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), ke = /^\s*$/, Ie = (t) => ke.test(t.toString()), _e = (t, e) => {
|
|
95
95
|
const n = (s) => Math.round(s * 10) / 10, o = {
|
|
@@ -139,53 +139,60 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
return i ? o : [...o, n];
|
|
142
|
-
}, []),
|
|
142
|
+
}, []), wo = (t) => ({
|
|
143
|
+
length: t.length,
|
|
144
|
+
item: (e) => t[e],
|
|
145
|
+
[Symbol.iterator]: function* () {
|
|
146
|
+
for (let e = 0; e < this.length; e++)
|
|
147
|
+
yield this.item(e);
|
|
148
|
+
}
|
|
149
|
+
}), Ve = (t, e, n) => {
|
|
143
150
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
144
151
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
145
|
-
const s =
|
|
146
|
-
return n ? { quote: a, start: r, end:
|
|
152
|
+
const s = Ut(o).textContent, a = t.toString(), r = s.length || 0, d = r + a.length;
|
|
153
|
+
return n ? { quote: a, start: r, end: d, range: t, offsetReference: i } : { quote: a, start: r, end: d, range: t };
|
|
147
154
|
}, ae = (t, e) => {
|
|
148
155
|
var h, u;
|
|
149
156
|
const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
|
|
150
157
|
e,
|
|
151
158
|
NodeFilter.SHOW_TEXT,
|
|
152
|
-
(
|
|
153
|
-
var
|
|
154
|
-
return (
|
|
159
|
+
(g) => {
|
|
160
|
+
var v;
|
|
161
|
+
return (v = g.parentElement) != null && v.closest(tt) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
155
162
|
}
|
|
156
163
|
);
|
|
157
164
|
let a = 0;
|
|
158
165
|
const r = document.createRange();
|
|
159
|
-
let
|
|
160
|
-
|
|
166
|
+
let d = s.nextNode();
|
|
167
|
+
d === null && console.error("Could not revive annotation target. Content missing.");
|
|
161
168
|
let f = !i;
|
|
162
|
-
for (;
|
|
163
|
-
if (f || (f = i == null ? void 0 : i.contains(
|
|
164
|
-
const
|
|
165
|
-
if (a +
|
|
166
|
-
r.setStart(
|
|
169
|
+
for (; d !== null; ) {
|
|
170
|
+
if (f || (f = i == null ? void 0 : i.contains(d)), f) {
|
|
171
|
+
const g = ((h = d.textContent) == null ? void 0 : h.length) || 0;
|
|
172
|
+
if (a + g > n) {
|
|
173
|
+
r.setStart(d, n - a);
|
|
167
174
|
break;
|
|
168
175
|
}
|
|
169
|
-
a +=
|
|
176
|
+
a += g;
|
|
170
177
|
}
|
|
171
|
-
|
|
178
|
+
d = s.nextNode();
|
|
172
179
|
}
|
|
173
|
-
for (;
|
|
174
|
-
const
|
|
175
|
-
if (a +
|
|
176
|
-
r.setEnd(
|
|
180
|
+
for (; d !== null; ) {
|
|
181
|
+
const g = ((u = d.textContent) == null ? void 0 : u.length) || 0;
|
|
182
|
+
if (a + g >= o) {
|
|
183
|
+
r.setEnd(d, o - a);
|
|
177
184
|
break;
|
|
178
185
|
}
|
|
179
|
-
a +=
|
|
186
|
+
a += g, d = s.nextNode();
|
|
180
187
|
}
|
|
181
188
|
return {
|
|
182
189
|
...t,
|
|
183
190
|
range: r
|
|
184
191
|
};
|
|
185
|
-
},
|
|
192
|
+
}, wt = (t, e) => F(t.selector) ? t : {
|
|
186
193
|
...t,
|
|
187
194
|
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : ae(n, e))
|
|
188
|
-
},
|
|
195
|
+
}, vt = (t, e) => F(t.target.selector) ? t : { ...t, target: wt(t.target, e) }, Ye = (t, e) => {
|
|
189
196
|
const n = t.cloneRange();
|
|
190
197
|
return e.contains(n.startContainer) || n.setStart(e, 0), e.contains(n.endContainer) || n.setEnd(e, e.childNodes.length), n;
|
|
191
198
|
}, ce = (t) => {
|
|
@@ -193,83 +200,83 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
193
200
|
return document.scrollingElement;
|
|
194
201
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
195
202
|
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : ce(t.parentElement);
|
|
196
|
-
},
|
|
203
|
+
}, De = (t, e) => (n) => {
|
|
197
204
|
const o = typeof n == "string" ? n : n.id, i = (a) => {
|
|
198
|
-
const r = s.getBoundingClientRect(),
|
|
199
|
-
s.scroll({ top:
|
|
205
|
+
const r = s.getBoundingClientRect(), d = s.clientHeight, f = s.clientWidth, h = a.selector[0].range.getBoundingClientRect(), { width: u, height: g } = e.getAnnotationBounds(o), v = h.top - r.top, p = h.left - r.left, y = s.parentElement ? s.scrollTop : 0, x = s.parentElement ? s.scrollLeft : 0, l = v + y - (d - g) / 2, c = p + x - (f - u) / 2;
|
|
206
|
+
s.scroll({ top: l, left: c, behavior: "smooth" });
|
|
200
207
|
}, s = ce(t);
|
|
201
208
|
if (s) {
|
|
202
209
|
const a = e.getAnnotation(o), { range: r } = a.target.selector[0];
|
|
203
210
|
if (r && !r.collapsed)
|
|
204
211
|
return i(a.target), !0;
|
|
205
212
|
{
|
|
206
|
-
const
|
|
213
|
+
const d = wt(a.target, t), { range: f } = d.selector[0];
|
|
207
214
|
if (f && !f.collapsed)
|
|
208
|
-
return i(
|
|
215
|
+
return i(d), !0;
|
|
209
216
|
}
|
|
210
217
|
}
|
|
211
218
|
return !1;
|
|
212
219
|
}, W = {
|
|
213
220
|
fill: "rgb(0, 128, 255)",
|
|
214
221
|
fillOpacity: 0.18
|
|
215
|
-
},
|
|
222
|
+
}, At = {
|
|
216
223
|
fill: "rgb(0, 128, 255)",
|
|
217
224
|
fillOpacity: 0.45
|
|
218
|
-
},
|
|
225
|
+
}, Ke = (t, e, n, o, i) => {
|
|
219
226
|
var a, r;
|
|
220
|
-
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ?
|
|
227
|
+
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ? At : W) : n : (r = t.state) != null && r.selected ? At : W;
|
|
221
228
|
return o && o.paint(t, e) || s;
|
|
222
229
|
}, Xe = (t) => {
|
|
223
|
-
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, a = -e, r = o - n,
|
|
224
|
-
return { top: e, left: n, minX: s, minY: a, maxX: r, maxY:
|
|
230
|
+
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, a = -e, r = o - n, d = i - e;
|
|
231
|
+
return { top: e, left: n, minX: s, minY: a, maxX: r, maxY: d };
|
|
225
232
|
}, Pe = (t) => {
|
|
226
233
|
let e = /* @__PURE__ */ new Set();
|
|
227
234
|
return (o) => {
|
|
228
235
|
const i = o.map((s) => s.id);
|
|
229
236
|
(e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);
|
|
230
237
|
};
|
|
231
|
-
},
|
|
238
|
+
}, Dt = (t, e, n, o) => {
|
|
232
239
|
const { store: i, selection: s, hover: a } = e;
|
|
233
|
-
let r,
|
|
234
|
-
const h = Pe(n), u = (
|
|
235
|
-
const { x:
|
|
236
|
-
|
|
240
|
+
let r, d, f;
|
|
241
|
+
const h = Pe(n), u = (B) => {
|
|
242
|
+
const { x: T, y: m } = t.getBoundingClientRect(), A = i.getAt(B.clientX - T, B.clientY - m, !1, d);
|
|
243
|
+
A ? a.current !== A.id && (t.classList.add("hovered"), a.set(A.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
|
|
237
244
|
};
|
|
238
245
|
t.addEventListener("pointermove", u);
|
|
239
|
-
const
|
|
246
|
+
const g = (B = !1) => {
|
|
240
247
|
f && f.clear();
|
|
241
|
-
const
|
|
248
|
+
const T = Xe(t), { minX: m, minY: A, maxX: w, maxY: L } = T, M = d ? i.getIntersecting(m, A, w, L).filter(({ annotation: U }) => d(U)) : i.getIntersecting(m, A, w, L), R = s.selected.map(({ id: U }) => U), N = M.map(({ annotation: U, rects: et }) => {
|
|
242
249
|
const q = R.includes(U.id), Se = U.id === a.current;
|
|
243
250
|
return { annotation: U, rects: et, state: { selected: q, hover: Se } };
|
|
244
251
|
});
|
|
245
|
-
o.redraw(N,
|
|
246
|
-
},
|
|
247
|
-
f =
|
|
248
|
-
},
|
|
249
|
-
r =
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
},
|
|
253
|
-
i.observe(
|
|
254
|
-
const
|
|
252
|
+
o.redraw(N, T, r, f, B), setTimeout(() => h(M.map(({ annotation: U }) => U)), 1);
|
|
253
|
+
}, v = (B) => {
|
|
254
|
+
f = B, g();
|
|
255
|
+
}, p = (B) => {
|
|
256
|
+
r = B, g();
|
|
257
|
+
}, y = (B) => {
|
|
258
|
+
d = B, g(!1);
|
|
259
|
+
}, x = () => g();
|
|
260
|
+
i.observe(x);
|
|
261
|
+
const l = s.subscribe(() => g()), c = () => g(!0);
|
|
255
262
|
document.addEventListener("scroll", c, { capture: !0, passive: !0 });
|
|
256
|
-
const
|
|
257
|
-
i.recalculatePositions(), f && f.reset(),
|
|
263
|
+
const b = Yt(() => {
|
|
264
|
+
i.recalculatePositions(), f && f.reset(), g();
|
|
258
265
|
});
|
|
259
|
-
window.addEventListener("resize",
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
|
|
266
|
+
window.addEventListener("resize", b);
|
|
267
|
+
const S = new ResizeObserver(b);
|
|
268
|
+
S.observe(t);
|
|
269
|
+
const E = { attributes: !0, childList: !0, subtree: !0 }, C = new MutationObserver((B) => {
|
|
270
|
+
B.every((m) => m.target === t || t.contains(m.target)) || g(!0);
|
|
264
271
|
});
|
|
265
|
-
return
|
|
272
|
+
return C.observe(document.body, E), {
|
|
266
273
|
destroy: () => {
|
|
267
|
-
t.removeEventListener("pointermove", u), o.destroy(), i.unobserve(
|
|
274
|
+
t.removeEventListener("pointermove", u), o.destroy(), i.unobserve(x), l(), document.removeEventListener("scroll", c), window.removeEventListener("resize", b), S.disconnect(), C.disconnect();
|
|
268
275
|
},
|
|
269
|
-
redraw:
|
|
270
|
-
setStyle:
|
|
271
|
-
setFilter:
|
|
272
|
-
setPainter:
|
|
276
|
+
redraw: g,
|
|
277
|
+
setStyle: p,
|
|
278
|
+
setFilter: y,
|
|
279
|
+
setPainter: v,
|
|
273
280
|
setVisible: o.setVisible
|
|
274
281
|
};
|
|
275
282
|
}, $e = () => {
|
|
@@ -281,28 +288,28 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
281
288
|
t.classList.add("r6o-annotatable");
|
|
282
289
|
const e = $e(), n = e.getContext("2d");
|
|
283
290
|
document.body.appendChild(e);
|
|
284
|
-
const o = (r,
|
|
285
|
-
const { width: u, height:
|
|
286
|
-
n.clearRect(-0.5, -0.5, u + 1,
|
|
287
|
-
const { top:
|
|
288
|
-
[...r].sort((
|
|
289
|
-
const { annotation: { target: { created: c } } } =
|
|
290
|
-
return c.getTime() -
|
|
291
|
-
}).forEach((
|
|
292
|
-
var
|
|
293
|
-
const
|
|
294
|
-
x:
|
|
295
|
-
y:
|
|
291
|
+
const o = (r, d, f, h) => requestAnimationFrame(() => {
|
|
292
|
+
const { width: u, height: g } = e;
|
|
293
|
+
n.clearRect(-0.5, -0.5, u + 1, g + 1), h && h.clear();
|
|
294
|
+
const { top: v, left: p } = d;
|
|
295
|
+
[...r].sort((x, l) => {
|
|
296
|
+
const { annotation: { target: { created: c } } } = x, { annotation: { target: { created: b } } } = l;
|
|
297
|
+
return c.getTime() - b.getTime();
|
|
298
|
+
}).forEach((x) => {
|
|
299
|
+
var S;
|
|
300
|
+
const l = f ? typeof f == "function" ? f(x.annotation, x.state) : f : (S = x.state) != null && S.selected ? At : W, c = h && h.paint(x, d) || l, b = x.rects.map(({ x: E, y: C, width: O, height: B }) => ({
|
|
301
|
+
x: E + p,
|
|
302
|
+
y: C + v,
|
|
296
303
|
width: O,
|
|
297
|
-
height:
|
|
304
|
+
height: B
|
|
298
305
|
}));
|
|
299
|
-
if (n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1,
|
|
300
|
-
({ x:
|
|
306
|
+
if (n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1, b.forEach(
|
|
307
|
+
({ x: E, y: C, width: O, height: B }) => n.fillRect(E, C, O, B)
|
|
301
308
|
), c.underlineColor) {
|
|
302
309
|
n.globalAlpha = 1, n.strokeStyle = c.underlineColor, n.lineWidth = c.underlineThickness ?? 1;
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
n.beginPath(), n.moveTo(
|
|
310
|
+
const E = c.underlineOffset ?? 0;
|
|
311
|
+
b.forEach(({ x: C, y: O, width: B, height: T }) => {
|
|
312
|
+
n.beginPath(), n.moveTo(C, O + T + E), n.lineTo(C + B, O + T + E), n.stroke();
|
|
306
313
|
});
|
|
307
314
|
}
|
|
308
315
|
});
|
|
@@ -318,7 +325,7 @@ const re = "not-annotatable", tt = `.${re}`, it = (t) => {
|
|
|
318
325
|
},
|
|
319
326
|
redraw: o
|
|
320
327
|
};
|
|
321
|
-
}, ze = (t, e, n) =>
|
|
328
|
+
}, ze = (t, e, n) => Dt(t, e, n, je(t));
|
|
322
329
|
var Fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(t) {
|
|
323
330
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
324
331
|
}, V = function(t, e, n) {
|
|
@@ -329,7 +336,7 @@ var Fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(t) {
|
|
|
329
336
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
330
337
|
}, Pt = function(t) {
|
|
331
338
|
return { r: X(t.r, 0, 255), g: X(t.g, 0, 255), b: X(t.b, 0, 255), a: X(t.a) };
|
|
332
|
-
},
|
|
339
|
+
}, Et = function(t) {
|
|
333
340
|
return { r: V(t.r), g: V(t.g), b: V(t.b), a: V(t.a, 3) };
|
|
334
341
|
}, We = /^#([0-9a-f]{3,8})$/i, ht = function(t) {
|
|
335
342
|
var e = t.toString(16);
|
|
@@ -340,8 +347,8 @@ var Fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(t) {
|
|
|
340
347
|
}, ue = function(t) {
|
|
341
348
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
342
349
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
343
|
-
var s = Math.floor(e), a = o * (1 - n), r = o * (1 - (e - s) * n),
|
|
344
|
-
return { r: 255 * [o, r, a, a,
|
|
350
|
+
var s = Math.floor(e), a = o * (1 - n), r = o * (1 - (e - s) * n), d = o * (1 - (1 - e + s) * n), f = s % 6;
|
|
351
|
+
return { r: 255 * [o, r, a, a, d, o][f], g: 255 * [d, o, o, r, a, a][f], b: 255 * [a, a, d, o, o, r][f], a: i };
|
|
345
352
|
}, $t = function(t) {
|
|
346
353
|
return { h: le(t.h), s: X(t.s, 0, 100), l: X(t.l, 0, 100), a: X(t.a) };
|
|
347
354
|
}, Ht = function(t) {
|
|
@@ -386,10 +393,10 @@ var Fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(t) {
|
|
|
386
393
|
return [null, void 0];
|
|
387
394
|
}, Ze = function(t) {
|
|
388
395
|
return typeof t == "string" ? Ft(t.trim(), zt.string) : typeof t == "object" && t !== null ? Ft(t, zt.object) : [null, void 0];
|
|
389
|
-
},
|
|
396
|
+
}, St = function(t, e) {
|
|
390
397
|
var n = at(t);
|
|
391
398
|
return { h: n.h, s: X(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
392
|
-
},
|
|
399
|
+
}, Ct = function(t) {
|
|
393
400
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
394
401
|
}, Wt = function(t, e) {
|
|
395
402
|
var n = at(t);
|
|
@@ -401,18 +408,18 @@ var Fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(t) {
|
|
|
401
408
|
return t.prototype.isValid = function() {
|
|
402
409
|
return this.parsed !== null;
|
|
403
410
|
}, t.prototype.brightness = function() {
|
|
404
|
-
return V(
|
|
411
|
+
return V(Ct(this.rgba), 2);
|
|
405
412
|
}, t.prototype.isDark = function() {
|
|
406
|
-
return
|
|
413
|
+
return Ct(this.rgba) < 0.5;
|
|
407
414
|
}, t.prototype.isLight = function() {
|
|
408
|
-
return
|
|
415
|
+
return Ct(this.rgba) >= 0.5;
|
|
409
416
|
}, t.prototype.toHex = function() {
|
|
410
|
-
return e =
|
|
417
|
+
return e = Et(this.rgba), n = e.r, o = e.g, i = e.b, a = (s = e.a) < 1 ? ht(V(255 * s)) : "", "#" + ht(n) + ht(o) + ht(i) + a;
|
|
411
418
|
var e, n, o, i, s, a;
|
|
412
419
|
}, t.prototype.toRgb = function() {
|
|
413
|
-
return
|
|
420
|
+
return Et(this.rgba);
|
|
414
421
|
}, t.prototype.toRgbString = function() {
|
|
415
|
-
return e =
|
|
422
|
+
return e = Et(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + s + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
416
423
|
var e, n, o, i, s;
|
|
417
424
|
}, t.prototype.toHsl = function() {
|
|
418
425
|
return Ht(at(this.rgba));
|
|
@@ -426,11 +433,11 @@ var Fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(t) {
|
|
|
426
433
|
return $({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
427
434
|
var e;
|
|
428
435
|
}, t.prototype.saturate = function(e) {
|
|
429
|
-
return e === void 0 && (e = 0.1), $(
|
|
436
|
+
return e === void 0 && (e = 0.1), $(St(this.rgba, e));
|
|
430
437
|
}, t.prototype.desaturate = function(e) {
|
|
431
|
-
return e === void 0 && (e = 0.1), $(
|
|
438
|
+
return e === void 0 && (e = 0.1), $(St(this.rgba, -e));
|
|
432
439
|
}, t.prototype.grayscale = function() {
|
|
433
|
-
return $(
|
|
440
|
+
return $(St(this.rgba, -1));
|
|
434
441
|
}, t.prototype.lighten = function(e) {
|
|
435
442
|
return e === void 0 && (e = 0.1), $(Wt(this.rgba, e));
|
|
436
443
|
}, t.prototype.darken = function(e) {
|
|
@@ -466,25 +473,25 @@ const tn = (t) => [
|
|
|
466
473
|
setVisible: (s) => {
|
|
467
474
|
console.log("setVisible not implemented on CSS Custom Highlights renderer");
|
|
468
475
|
},
|
|
469
|
-
redraw: (s, a, r,
|
|
470
|
-
|
|
476
|
+
redraw: (s, a, r, d) => {
|
|
477
|
+
d && d.clear();
|
|
471
478
|
const f = new Set(s.map((u) => u.annotation.id));
|
|
472
479
|
Array.from(e).filter((u) => !f.has(u));
|
|
473
480
|
const h = s.map((u) => {
|
|
474
|
-
var
|
|
475
|
-
const
|
|
476
|
-
return `::highlight(_${u.annotation.id}) { ${tn(
|
|
481
|
+
var p;
|
|
482
|
+
const g = r ? typeof r == "function" ? r(u.annotation, u.state) : r : (p = u.state) != null && p.selected ? At : W, v = d && d.paint(u, a) || g;
|
|
483
|
+
return `::highlight(_${u.annotation.id}) { ${tn(v)} }`;
|
|
477
484
|
});
|
|
478
485
|
t.innerHTML = h.join(`
|
|
479
486
|
`), CSS.highlights.clear(), s.forEach(({ annotation: u }) => {
|
|
480
|
-
const
|
|
481
|
-
CSS.highlights.set(`_${u.id}`,
|
|
487
|
+
const g = u.target.selector.map((p) => p.range), v = new Highlight(...g);
|
|
488
|
+
CSS.highlights.set(`_${u.id}`, v);
|
|
482
489
|
}), e = f;
|
|
483
490
|
}
|
|
484
491
|
};
|
|
485
|
-
}, nn = (t, e, n) =>
|
|
492
|
+
}, nn = (t, e, n) => Dt(t, e, n, en());
|
|
486
493
|
var Gt = Object.prototype.hasOwnProperty;
|
|
487
|
-
function
|
|
494
|
+
function Vt(t, e) {
|
|
488
495
|
var n, o;
|
|
489
496
|
if (t === e) return !0;
|
|
490
497
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -492,13 +499,13 @@ function Ut(t, e) {
|
|
|
492
499
|
if (n === RegExp) return t.toString() === e.toString();
|
|
493
500
|
if (n === Array) {
|
|
494
501
|
if ((o = t.length) === e.length)
|
|
495
|
-
for (; o-- &&
|
|
502
|
+
for (; o-- && Vt(t[o], e[o]); ) ;
|
|
496
503
|
return o === -1;
|
|
497
504
|
}
|
|
498
505
|
if (!n || typeof t == "object") {
|
|
499
506
|
o = 0;
|
|
500
507
|
for (n in t)
|
|
501
|
-
if (Gt.call(t, n) && ++o && !Gt.call(e, n) || !(n in e) || !
|
|
508
|
+
if (Gt.call(t, n) && ++o && !Gt.call(e, n) || !(n in e) || !Vt(t[n], e[n])) return !1;
|
|
502
509
|
return Object.keys(e).length === o;
|
|
503
510
|
}
|
|
504
511
|
}
|
|
@@ -516,18 +523,18 @@ const on = (t, e) => {
|
|
|
516
523
|
destroy: () => {
|
|
517
524
|
e.remove();
|
|
518
525
|
},
|
|
519
|
-
redraw: (a, r,
|
|
520
|
-
const
|
|
521
|
-
if (!f && !
|
|
522
|
-
|
|
523
|
-
const { annotation: { target: { created:
|
|
524
|
-
return
|
|
525
|
-
}).forEach((
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
if (
|
|
526
|
+
redraw: (a, r, d, f, h) => {
|
|
527
|
+
const g = !(Vt(n, a) && h);
|
|
528
|
+
if (!f && !g) return;
|
|
529
|
+
g && (e.innerHTML = ""), [...a].sort((p, y) => {
|
|
530
|
+
const { annotation: { target: { created: x } } } = p, { annotation: { target: { created: l } } } = y;
|
|
531
|
+
return x && l ? x.getTime() - l.getTime() : 0;
|
|
532
|
+
}).forEach((p) => {
|
|
533
|
+
p.rects.map((y) => {
|
|
534
|
+
const x = on(y, a), l = Ke(p, r, d, f, x);
|
|
535
|
+
if (g) {
|
|
529
536
|
const c = document.createElement("span");
|
|
530
|
-
c.className = "r6o-annotation", c.dataset.annotation =
|
|
537
|
+
c.className = "r6o-annotation", c.dataset.annotation = p.annotation.id, c.style.left = `${y.x}px`, c.style.top = `${y.y}px`, c.style.width = `${y.width}px`, c.style.height = `${y.height}px`, c.style.backgroundColor = $((l == null ? void 0 : l.fill) || W.fill).alpha((l == null ? void 0 : l.fillOpacity) === void 0 ? W.fillOpacity : l.fillOpacity).toHex(), l.underlineStyle && (c.style.borderStyle = l.underlineStyle), l.underlineColor && (c.style.borderColor = l.underlineColor), l.underlineThickness && (c.style.borderBottomWidth = `${l.underlineThickness}px`), l.underlineOffset && (c.style.paddingBottom = `${l.underlineOffset}px`), e.appendChild(c);
|
|
531
538
|
}
|
|
532
539
|
});
|
|
533
540
|
}), n = a;
|
|
@@ -536,21 +543,21 @@ const on = (t, e) => {
|
|
|
536
543
|
a ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
537
544
|
}
|
|
538
545
|
};
|
|
539
|
-
}, rn = (t, e, n) =>
|
|
546
|
+
}, rn = (t, e, n) => Dt(t, e, n, sn(t)), Y = [];
|
|
540
547
|
for (let t = 0; t < 256; ++t)
|
|
541
548
|
Y.push((t + 256).toString(16).slice(1));
|
|
542
549
|
function an(t, e = 0) {
|
|
543
550
|
return (Y[t[e + 0]] + Y[t[e + 1]] + Y[t[e + 2]] + Y[t[e + 3]] + "-" + Y[t[e + 4]] + Y[t[e + 5]] + "-" + Y[t[e + 6]] + Y[t[e + 7]] + "-" + Y[t[e + 8]] + Y[t[e + 9]] + "-" + Y[t[e + 10]] + Y[t[e + 11]] + Y[t[e + 12]] + Y[t[e + 13]] + Y[t[e + 14]] + Y[t[e + 15]]).toLowerCase();
|
|
544
551
|
}
|
|
545
|
-
let
|
|
552
|
+
let Lt;
|
|
546
553
|
const cn = new Uint8Array(16);
|
|
547
554
|
function ln() {
|
|
548
|
-
if (!
|
|
555
|
+
if (!Lt) {
|
|
549
556
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
550
557
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
551
|
-
|
|
558
|
+
Lt = crypto.getRandomValues.bind(crypto);
|
|
552
559
|
}
|
|
553
|
-
return
|
|
560
|
+
return Lt(cn);
|
|
554
561
|
}
|
|
555
562
|
const dn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Qt = { randomUUID: dn };
|
|
556
563
|
function fe(t, e, n) {
|
|
@@ -581,21 +588,21 @@ function G(t, e) {
|
|
|
581
588
|
}
|
|
582
589
|
return t !== t && e !== e;
|
|
583
590
|
}
|
|
584
|
-
function
|
|
591
|
+
function Tt() {
|
|
585
592
|
}
|
|
586
593
|
function un(t, e) {
|
|
587
594
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
588
595
|
}
|
|
589
596
|
const Q = [];
|
|
590
|
-
function
|
|
597
|
+
function Kt(t, e = Tt) {
|
|
591
598
|
let n;
|
|
592
599
|
const o = /* @__PURE__ */ new Set();
|
|
593
600
|
function i(r) {
|
|
594
601
|
if (un(t, r) && (t = r, n)) {
|
|
595
|
-
const
|
|
602
|
+
const d = !Q.length;
|
|
596
603
|
for (const f of o)
|
|
597
604
|
f[1](), Q.push(f, t);
|
|
598
|
-
if (
|
|
605
|
+
if (d) {
|
|
599
606
|
for (let f = 0; f < Q.length; f += 2)
|
|
600
607
|
Q[f][0](Q[f + 1]);
|
|
601
608
|
Q.length = 0;
|
|
@@ -605,16 +612,16 @@ function Dt(t, e = Lt) {
|
|
|
605
612
|
function s(r) {
|
|
606
613
|
i(r(t));
|
|
607
614
|
}
|
|
608
|
-
function a(r,
|
|
609
|
-
const f = [r,
|
|
610
|
-
return o.add(f), o.size === 1 && (n = e(i, s) ||
|
|
615
|
+
function a(r, d = Tt) {
|
|
616
|
+
const f = [r, d];
|
|
617
|
+
return o.add(f), o.size === 1 && (n = e(i, s) || Tt), r(t), () => {
|
|
611
618
|
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
612
619
|
};
|
|
613
620
|
}
|
|
614
621
|
return { set: i, update: s, subscribe: a };
|
|
615
622
|
}
|
|
616
623
|
const fn = (t) => {
|
|
617
|
-
const { subscribe: e, set: n } =
|
|
624
|
+
const { subscribe: e, set: n } = Kt();
|
|
618
625
|
let o;
|
|
619
626
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
620
627
|
if (o) {
|
|
@@ -631,56 +638,56 @@ const fn = (t) => {
|
|
|
631
638
|
};
|
|
632
639
|
};
|
|
633
640
|
var hn = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(hn || {});
|
|
634
|
-
const
|
|
635
|
-
const { subscribe: o, set: i } =
|
|
636
|
-
let s = e, a =
|
|
637
|
-
o((
|
|
641
|
+
const gt = { selected: [] }, gn = (t, e, n) => {
|
|
642
|
+
const { subscribe: o, set: i } = Kt(gt);
|
|
643
|
+
let s = e, a = gt;
|
|
644
|
+
o((p) => a = p);
|
|
638
645
|
const r = () => {
|
|
639
|
-
G(a,
|
|
640
|
-
},
|
|
641
|
-
var
|
|
642
|
-
return ((
|
|
643
|
-
}, f = (
|
|
644
|
-
if (
|
|
646
|
+
G(a, gt) || i(gt);
|
|
647
|
+
}, d = () => {
|
|
648
|
+
var p;
|
|
649
|
+
return ((p = a.selected) == null ? void 0 : p.length) === 0;
|
|
650
|
+
}, f = (p) => {
|
|
651
|
+
if (d())
|
|
645
652
|
return !1;
|
|
646
|
-
const
|
|
647
|
-
return a.selected.some((
|
|
648
|
-
}, h = (
|
|
649
|
-
let
|
|
650
|
-
if (Array.isArray(
|
|
651
|
-
if (
|
|
652
|
-
console.warn("Invalid selection: " +
|
|
653
|
+
const y = typeof p == "string" ? p : p.id;
|
|
654
|
+
return a.selected.some((x) => x.id === y);
|
|
655
|
+
}, h = (p, y) => {
|
|
656
|
+
let x;
|
|
657
|
+
if (Array.isArray(p)) {
|
|
658
|
+
if (x = p.map((c) => t.getAnnotation(c)).filter(Boolean), x.length < p.length) {
|
|
659
|
+
console.warn("Invalid selection: " + p.filter((c) => !x.some((b) => b.id === c)));
|
|
653
660
|
return;
|
|
654
661
|
}
|
|
655
662
|
} else {
|
|
656
|
-
const c = t.getAnnotation(
|
|
663
|
+
const c = t.getAnnotation(p);
|
|
657
664
|
if (!c) {
|
|
658
|
-
console.warn("Invalid selection: " +
|
|
665
|
+
console.warn("Invalid selection: " + p);
|
|
659
666
|
return;
|
|
660
667
|
}
|
|
661
|
-
|
|
668
|
+
x = [c];
|
|
662
669
|
}
|
|
663
|
-
const
|
|
664
|
-
const
|
|
665
|
-
return
|
|
670
|
+
const l = x.reduce((c, b) => {
|
|
671
|
+
const S = Zt(b, s);
|
|
672
|
+
return S === "EDIT" ? [...c, { id: b.id, editable: !0 }] : S === "SELECT" ? [...c, { id: b.id }] : c;
|
|
666
673
|
}, []);
|
|
667
|
-
i({ selected:
|
|
668
|
-
}, u = (
|
|
669
|
-
const
|
|
674
|
+
i({ selected: l, event: y });
|
|
675
|
+
}, u = (p, y) => {
|
|
676
|
+
const x = Array.isArray(p) ? p : [p], l = x.map((c) => t.getAnnotation(c)).filter((c) => !!c);
|
|
670
677
|
i({
|
|
671
|
-
selected:
|
|
672
|
-
const
|
|
673
|
-
return { id: c.id, editable:
|
|
678
|
+
selected: l.map((c) => {
|
|
679
|
+
const b = y === void 0 ? Zt(c, s) === "EDIT" : y;
|
|
680
|
+
return { id: c.id, editable: b };
|
|
674
681
|
})
|
|
675
|
-
}),
|
|
676
|
-
},
|
|
677
|
-
if (
|
|
682
|
+
}), l.length !== x.length && console.warn("Invalid selection", p);
|
|
683
|
+
}, g = (p) => {
|
|
684
|
+
if (d())
|
|
678
685
|
return !1;
|
|
679
|
-
const { selected:
|
|
680
|
-
|
|
681
|
-
},
|
|
686
|
+
const { selected: y } = a;
|
|
687
|
+
y.some(({ id: x }) => p.includes(x)) && i({ selected: y.filter(({ id: x }) => !p.includes(x)) });
|
|
688
|
+
}, v = (p) => s = p;
|
|
682
689
|
return t.observe(
|
|
683
|
-
({ changes:
|
|
690
|
+
({ changes: p }) => g((p.deleted || []).map((y) => y.id))
|
|
684
691
|
), {
|
|
685
692
|
get event() {
|
|
686
693
|
return a ? a.event : null;
|
|
@@ -692,28 +699,28 @@ const pt = { selected: [] }, pn = (t, e, n) => {
|
|
|
692
699
|
return s;
|
|
693
700
|
},
|
|
694
701
|
clear: r,
|
|
695
|
-
isEmpty:
|
|
702
|
+
isEmpty: d,
|
|
696
703
|
isSelected: f,
|
|
697
704
|
setSelected: u,
|
|
698
|
-
setUserSelectAction:
|
|
705
|
+
setUserSelectAction: v,
|
|
699
706
|
subscribe: o,
|
|
700
707
|
userSelect: h
|
|
701
708
|
};
|
|
702
|
-
}, Zt = (t, e, n) => typeof e == "function" ? e(t) : e || "EDIT",
|
|
709
|
+
}, Zt = (t, e, n) => typeof e == "function" ? e(t) : e || "EDIT", D = [];
|
|
703
710
|
for (let t = 0; t < 256; ++t)
|
|
704
|
-
|
|
705
|
-
function
|
|
706
|
-
return (
|
|
711
|
+
D.push((t + 256).toString(16).slice(1));
|
|
712
|
+
function pn(t, e = 0) {
|
|
713
|
+
return (D[t[e + 0]] + D[t[e + 1]] + D[t[e + 2]] + D[t[e + 3]] + "-" + D[t[e + 4]] + D[t[e + 5]] + "-" + D[t[e + 6]] + D[t[e + 7]] + "-" + D[t[e + 8]] + D[t[e + 9]] + "-" + D[t[e + 10]] + D[t[e + 11]] + D[t[e + 12]] + D[t[e + 13]] + D[t[e + 14]] + D[t[e + 15]]).toLowerCase();
|
|
707
714
|
}
|
|
708
|
-
let
|
|
715
|
+
let Ot;
|
|
709
716
|
const mn = new Uint8Array(16);
|
|
710
717
|
function yn() {
|
|
711
|
-
if (!
|
|
718
|
+
if (!Ot) {
|
|
712
719
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
713
720
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
714
|
-
|
|
721
|
+
Ot = crypto.getRandomValues.bind(crypto);
|
|
715
722
|
}
|
|
716
|
-
return
|
|
723
|
+
return Ot(mn);
|
|
717
724
|
}
|
|
718
725
|
const bn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), te = { randomUUID: bn };
|
|
719
726
|
function he(t, e, n) {
|
|
@@ -721,9 +728,9 @@ function he(t, e, n) {
|
|
|
721
728
|
return te.randomUUID();
|
|
722
729
|
t = t || {};
|
|
723
730
|
const o = t.random || (t.rng || yn)();
|
|
724
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
731
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, pn(o);
|
|
725
732
|
}
|
|
726
|
-
const
|
|
733
|
+
const Bt = (t) => {
|
|
727
734
|
const e = (n) => {
|
|
728
735
|
const o = { ...n };
|
|
729
736
|
return n.created && typeof n.created == "string" && (o.created = new Date(n.created)), n.updated && typeof n.updated == "string" && (o.updated = new Date(n.updated)), o;
|
|
@@ -733,7 +740,7 @@ const Ot = (t) => {
|
|
|
733
740
|
bodies: (t.bodies || []).map(e),
|
|
734
741
|
target: e(t.target)
|
|
735
742
|
};
|
|
736
|
-
},
|
|
743
|
+
}, Ao = (t, e, n, o) => ({
|
|
737
744
|
id: he(),
|
|
738
745
|
annotation: typeof t == "string" ? t : t.id,
|
|
739
746
|
created: n || /* @__PURE__ */ new Date(),
|
|
@@ -748,7 +755,7 @@ const Ot = (t) => {
|
|
|
748
755
|
}, xn = (t, e) => e.bodies.map((n) => {
|
|
749
756
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
750
757
|
return { newBody: n, oldBody: o && !G(o, n) ? o : void 0 };
|
|
751
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), vn = (t, e) => !G(t.target, e.target),
|
|
758
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), vn = (t, e) => !G(t.target, e.target), ge = (t, e) => {
|
|
752
759
|
const n = wn(t, e), o = An(t, e), i = xn(t, e);
|
|
753
760
|
return {
|
|
754
761
|
oldValue: t,
|
|
@@ -766,10 +773,10 @@ const En = (t, e) => {
|
|
|
766
773
|
if (!(t.options.origin ? t.options.origin === s : s !== "SILENT"))
|
|
767
774
|
return !1;
|
|
768
775
|
if (t.options.ignore) {
|
|
769
|
-
const { ignore: a } = t.options, r = (
|
|
776
|
+
const { ignore: a } = t.options, r = (d) => d && d.length > 0;
|
|
770
777
|
if (!(r(i.created) || r(i.deleted))) {
|
|
771
|
-
const
|
|
772
|
-
if (a === "BODY_ONLY" &&
|
|
778
|
+
const d = (n = i.updated) == null ? void 0 : n.some((h) => r(h.bodiesCreated) || r(h.bodiesDeleted) || r(h.bodiesUpdated)), f = (o = i.updated) == null ? void 0 : o.some((h) => h.targetUpdated);
|
|
779
|
+
if (a === "BODY_ONLY" && d && !f || a === "TARGET_ONLY" && f && !d)
|
|
773
780
|
return !1;
|
|
774
781
|
}
|
|
775
782
|
}
|
|
@@ -783,24 +790,24 @@ const En = (t, e) => {
|
|
|
783
790
|
} else
|
|
784
791
|
return !0;
|
|
785
792
|
}, Sn = (t, e) => {
|
|
786
|
-
const n = new Set((t.created || []).map((u) => u.id)), o = new Set((t.updated || []).map(({ newValue: u }) => u.id)), i = new Set((e.created || []).map((u) => u.id)), s = new Set((e.deleted || []).map((u) => u.id)), a = new Set((e.updated || []).map(({ oldValue: u }) => u.id)), r = new Set((e.updated || []).filter(({ oldValue: u }) => n.has(u.id) || o.has(u.id)).map(({ oldValue: u }) => u.id)),
|
|
787
|
-
...(t.created || []).filter((u) => !s.has(u.id)).map((u) => a.has(u.id) ? e.updated.find(({ oldValue:
|
|
793
|
+
const n = new Set((t.created || []).map((u) => u.id)), o = new Set((t.updated || []).map(({ newValue: u }) => u.id)), i = new Set((e.created || []).map((u) => u.id)), s = new Set((e.deleted || []).map((u) => u.id)), a = new Set((e.updated || []).map(({ oldValue: u }) => u.id)), r = new Set((e.updated || []).filter(({ oldValue: u }) => n.has(u.id) || o.has(u.id)).map(({ oldValue: u }) => u.id)), d = [
|
|
794
|
+
...(t.created || []).filter((u) => !s.has(u.id)).map((u) => a.has(u.id) ? e.updated.find(({ oldValue: g }) => g.id === u.id).newValue : u),
|
|
788
795
|
...e.created || []
|
|
789
796
|
], f = [
|
|
790
797
|
...(t.deleted || []).filter((u) => !i.has(u.id)),
|
|
791
798
|
...(e.deleted || []).filter((u) => !n.has(u.id))
|
|
792
799
|
], h = [
|
|
793
800
|
...(t.updated || []).filter(({ newValue: u }) => !s.has(u.id)).map((u) => {
|
|
794
|
-
const { oldValue:
|
|
795
|
-
if (a.has(
|
|
796
|
-
const
|
|
797
|
-
return
|
|
801
|
+
const { oldValue: g, newValue: v } = u;
|
|
802
|
+
if (a.has(v.id)) {
|
|
803
|
+
const p = e.updated.find((y) => y.oldValue.id === v.id).newValue;
|
|
804
|
+
return ge(g, p);
|
|
798
805
|
} else
|
|
799
806
|
return u;
|
|
800
807
|
}),
|
|
801
808
|
...(e.updated || []).filter(({ oldValue: u }) => !r.has(u.id))
|
|
802
809
|
];
|
|
803
|
-
return { created:
|
|
810
|
+
return { created: d, deleted: f, updated: h };
|
|
804
811
|
}, Mt = (t) => {
|
|
805
812
|
const e = t.id === void 0 ? he() : t.id;
|
|
806
813
|
return {
|
|
@@ -816,170 +823,170 @@ const En = (t, e) => {
|
|
|
816
823
|
}
|
|
817
824
|
};
|
|
818
825
|
}, Cn = (t) => t.id !== void 0, Ln = () => {
|
|
819
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (m,
|
|
820
|
-
n.push({ onChange: m, options:
|
|
826
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (m, A = {}) => {
|
|
827
|
+
n.push({ onChange: m, options: A });
|
|
821
828
|
}, i = (m) => {
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
}, s = (m,
|
|
825
|
-
const
|
|
829
|
+
const A = n.findIndex((w) => w.onChange == m);
|
|
830
|
+
A > -1 && n.splice(A, 1);
|
|
831
|
+
}, s = (m, A) => {
|
|
832
|
+
const w = {
|
|
826
833
|
origin: m,
|
|
827
834
|
changes: {
|
|
828
|
-
created:
|
|
829
|
-
updated:
|
|
830
|
-
deleted:
|
|
835
|
+
created: A.created || [],
|
|
836
|
+
updated: A.updated || [],
|
|
837
|
+
deleted: A.deleted || []
|
|
831
838
|
},
|
|
832
839
|
state: [...t.values()]
|
|
833
840
|
};
|
|
834
|
-
n.forEach((
|
|
835
|
-
En(
|
|
841
|
+
n.forEach((L) => {
|
|
842
|
+
En(L, w) && L.onChange(w);
|
|
836
843
|
});
|
|
837
|
-
}, a = (m,
|
|
844
|
+
}, a = (m, A = k.LOCAL) => {
|
|
838
845
|
if (m.id && t.get(m.id))
|
|
839
846
|
throw Error(`Cannot add annotation ${m.id} - exists already`);
|
|
840
847
|
{
|
|
841
|
-
const
|
|
842
|
-
t.set(
|
|
848
|
+
const w = Mt(m);
|
|
849
|
+
t.set(w.id, w), w.bodies.forEach((L) => e.set(L.id, w.id)), s(A, { created: [w] });
|
|
843
850
|
}
|
|
844
|
-
}, r = (m,
|
|
845
|
-
const
|
|
846
|
-
if (
|
|
847
|
-
const R =
|
|
848
|
-
return
|
|
851
|
+
}, r = (m, A) => {
|
|
852
|
+
const w = Mt(typeof m == "string" ? A : m), L = typeof m == "string" ? m : m.id, M = L && t.get(L);
|
|
853
|
+
if (M) {
|
|
854
|
+
const R = ge(M, w);
|
|
855
|
+
return L === w.id ? t.set(L, w) : (t.delete(L), t.set(w.id, w)), M.bodies.forEach((N) => e.delete(N.id)), w.bodies.forEach((N) => e.set(N.id, w.id)), R;
|
|
849
856
|
} else
|
|
850
|
-
console.warn(`Cannot update annotation ${
|
|
851
|
-
},
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
}, f = (m,
|
|
855
|
-
const
|
|
856
|
-
const R = r(
|
|
857
|
-
return R ? [...
|
|
857
|
+
console.warn(`Cannot update annotation ${L} - does not exist`);
|
|
858
|
+
}, d = (m, A = k.LOCAL, w = k.LOCAL) => {
|
|
859
|
+
const L = Cn(A) ? w : A, M = r(m, A);
|
|
860
|
+
M && s(L, { updated: [M] });
|
|
861
|
+
}, f = (m, A = k.LOCAL) => {
|
|
862
|
+
const w = m.reduce((L, M) => {
|
|
863
|
+
const R = r(M);
|
|
864
|
+
return R ? [...L, R] : L;
|
|
858
865
|
}, []);
|
|
859
|
-
|
|
860
|
-
}, h = (m,
|
|
861
|
-
const
|
|
862
|
-
if (
|
|
863
|
-
const
|
|
864
|
-
...
|
|
865
|
-
bodies: [...
|
|
866
|
+
w.length > 0 && s(A, { updated: w });
|
|
867
|
+
}, h = (m, A = k.LOCAL) => {
|
|
868
|
+
const w = t.get(m.annotation);
|
|
869
|
+
if (w) {
|
|
870
|
+
const L = {
|
|
871
|
+
...w,
|
|
872
|
+
bodies: [...w.bodies, m]
|
|
866
873
|
};
|
|
867
|
-
t.set(
|
|
868
|
-
oldValue:
|
|
869
|
-
newValue:
|
|
874
|
+
t.set(w.id, L), e.set(m.id, L.id), s(A, { updated: [{
|
|
875
|
+
oldValue: w,
|
|
876
|
+
newValue: L,
|
|
870
877
|
bodiesCreated: [m]
|
|
871
878
|
}] });
|
|
872
879
|
} else
|
|
873
880
|
console.warn(`Attempt to add body to missing annotation: ${m.annotation}`);
|
|
874
|
-
}, u = () => [...t.values()],
|
|
875
|
-
const
|
|
876
|
-
t.clear(), e.clear(), s(m, { deleted:
|
|
877
|
-
},
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
const
|
|
881
|
-
t.clear(), e.clear(),
|
|
881
|
+
}, u = () => [...t.values()], g = (m = k.LOCAL) => {
|
|
882
|
+
const A = [...t.values()];
|
|
883
|
+
t.clear(), e.clear(), s(m, { deleted: A });
|
|
884
|
+
}, v = (m, A = !0, w = k.LOCAL) => {
|
|
885
|
+
const L = m.map(Mt);
|
|
886
|
+
if (A) {
|
|
887
|
+
const M = [...t.values()];
|
|
888
|
+
t.clear(), e.clear(), L.forEach((R) => {
|
|
882
889
|
t.set(R.id, R), R.bodies.forEach((N) => e.set(N.id, R.id));
|
|
883
|
-
}), s(
|
|
890
|
+
}), s(w, { created: L, deleted: M });
|
|
884
891
|
} else {
|
|
885
|
-
const
|
|
892
|
+
const M = m.reduce((R, N) => {
|
|
886
893
|
const U = N.id && t.get(N.id);
|
|
887
894
|
return U ? [...R, U] : R;
|
|
888
895
|
}, []);
|
|
889
|
-
if (
|
|
890
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${
|
|
891
|
-
|
|
896
|
+
if (M.length > 0)
|
|
897
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${M.map((R) => R.id).join(", ")}`);
|
|
898
|
+
L.forEach((R) => {
|
|
892
899
|
t.set(R.id, R), R.bodies.forEach((N) => e.set(N.id, R.id));
|
|
893
|
-
}), s(
|
|
900
|
+
}), s(w, { created: L });
|
|
894
901
|
}
|
|
895
|
-
},
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
return t.delete(
|
|
899
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
900
|
-
},
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
},
|
|
904
|
-
const
|
|
905
|
-
const R =
|
|
906
|
-
return R ? [...
|
|
902
|
+
}, p = (m) => {
|
|
903
|
+
const A = typeof m == "string" ? m : m.id, w = t.get(A);
|
|
904
|
+
if (w)
|
|
905
|
+
return t.delete(A), w.bodies.forEach((L) => e.delete(L.id)), w;
|
|
906
|
+
console.warn(`Attempt to delete missing annotation: ${A}`);
|
|
907
|
+
}, y = (m, A = k.LOCAL) => {
|
|
908
|
+
const w = p(m);
|
|
909
|
+
w && s(A, { deleted: [w] });
|
|
910
|
+
}, x = (m, A = k.LOCAL) => {
|
|
911
|
+
const w = m.reduce((L, M) => {
|
|
912
|
+
const R = p(M);
|
|
913
|
+
return R ? [...L, R] : L;
|
|
907
914
|
}, []);
|
|
908
|
-
|
|
909
|
-
},
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
const
|
|
913
|
-
if (
|
|
914
|
-
e.delete(
|
|
915
|
-
const
|
|
916
|
-
...
|
|
917
|
-
bodies:
|
|
915
|
+
w.length > 0 && s(A, { deleted: w });
|
|
916
|
+
}, l = (m) => {
|
|
917
|
+
const A = t.get(m.annotation);
|
|
918
|
+
if (A) {
|
|
919
|
+
const w = A.bodies.find((L) => L.id === m.id);
|
|
920
|
+
if (w) {
|
|
921
|
+
e.delete(w.id);
|
|
922
|
+
const L = {
|
|
923
|
+
...A,
|
|
924
|
+
bodies: A.bodies.filter((M) => M.id !== m.id)
|
|
918
925
|
};
|
|
919
|
-
return t.set(
|
|
920
|
-
oldValue:
|
|
921
|
-
newValue:
|
|
922
|
-
bodiesDeleted: [
|
|
926
|
+
return t.set(A.id, L), {
|
|
927
|
+
oldValue: A,
|
|
928
|
+
newValue: L,
|
|
929
|
+
bodiesDeleted: [w]
|
|
923
930
|
};
|
|
924
931
|
} else
|
|
925
932
|
console.warn(`Attempt to delete missing body ${m.id} from annotation ${m.annotation}`);
|
|
926
933
|
} else
|
|
927
934
|
console.warn(`Attempt to delete body from missing annotation ${m.annotation}`);
|
|
928
|
-
}, c = (m,
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
},
|
|
932
|
-
const
|
|
933
|
-
|
|
935
|
+
}, c = (m, A = k.LOCAL) => {
|
|
936
|
+
const w = l(m);
|
|
937
|
+
w && s(A, { updated: [w] });
|
|
938
|
+
}, b = (m, A = k.LOCAL) => {
|
|
939
|
+
const w = m.map((L) => l(L)).filter(Boolean);
|
|
940
|
+
w.length > 0 && s(A, { updated: w });
|
|
941
|
+
}, S = (m) => {
|
|
942
|
+
const A = t.get(m);
|
|
943
|
+
return A ? { ...A } : void 0;
|
|
934
944
|
}, E = (m) => {
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
const x = E(v).bodies.find((C) => C.id === m);
|
|
941
|
-
if (x)
|
|
942
|
-
return x;
|
|
945
|
+
const A = e.get(m);
|
|
946
|
+
if (A) {
|
|
947
|
+
const w = S(A).bodies.find((L) => L.id === m);
|
|
948
|
+
if (w)
|
|
949
|
+
return w;
|
|
943
950
|
console.error(`Store integrity error: body ${m} in index, but not in annotation`);
|
|
944
951
|
} else
|
|
945
952
|
console.warn(`Attempt to retrieve missing body: ${m}`);
|
|
946
|
-
},
|
|
947
|
-
if (m.annotation !==
|
|
953
|
+
}, C = (m, A) => {
|
|
954
|
+
if (m.annotation !== A.annotation)
|
|
948
955
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
949
|
-
const
|
|
950
|
-
if (
|
|
951
|
-
const
|
|
952
|
-
...
|
|
953
|
-
bodies:
|
|
956
|
+
const w = t.get(m.annotation);
|
|
957
|
+
if (w) {
|
|
958
|
+
const L = w.bodies.find((R) => R.id === m.id), M = {
|
|
959
|
+
...w,
|
|
960
|
+
bodies: w.bodies.map((R) => R.id === L.id ? A : R)
|
|
954
961
|
};
|
|
955
|
-
return t.set(
|
|
956
|
-
oldValue:
|
|
957
|
-
newValue:
|
|
958
|
-
bodiesUpdated: [{ oldBody:
|
|
962
|
+
return t.set(w.id, M), L.id !== A.id && (e.delete(L.id), e.set(A.id, M.id)), {
|
|
963
|
+
oldValue: w,
|
|
964
|
+
newValue: M,
|
|
965
|
+
bodiesUpdated: [{ oldBody: L, newBody: A }]
|
|
959
966
|
};
|
|
960
967
|
} else
|
|
961
968
|
console.warn(`Attempt to add body to missing annotation ${m.annotation}`);
|
|
962
|
-
}, O = (m,
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
},
|
|
966
|
-
const
|
|
967
|
-
s(
|
|
968
|
-
},
|
|
969
|
-
const
|
|
970
|
-
if (
|
|
971
|
-
const
|
|
972
|
-
...
|
|
969
|
+
}, O = (m, A, w = k.LOCAL) => {
|
|
970
|
+
const L = C(m, A);
|
|
971
|
+
L && s(w, { updated: [L] });
|
|
972
|
+
}, B = (m, A = k.LOCAL) => {
|
|
973
|
+
const w = m.map((L) => C({ id: L.id, annotation: L.annotation }, L)).filter(Boolean);
|
|
974
|
+
s(A, { updated: w });
|
|
975
|
+
}, T = (m) => {
|
|
976
|
+
const A = t.get(m.annotation);
|
|
977
|
+
if (A) {
|
|
978
|
+
const w = {
|
|
979
|
+
...A,
|
|
973
980
|
target: {
|
|
974
|
-
...
|
|
981
|
+
...A.target,
|
|
975
982
|
...m
|
|
976
983
|
}
|
|
977
984
|
};
|
|
978
|
-
return t.set(
|
|
979
|
-
oldValue:
|
|
980
|
-
newValue:
|
|
985
|
+
return t.set(A.id, w), {
|
|
986
|
+
oldValue: A,
|
|
987
|
+
newValue: w,
|
|
981
988
|
targetUpdated: {
|
|
982
|
-
oldTarget:
|
|
989
|
+
oldTarget: A.target,
|
|
983
990
|
newTarget: m
|
|
984
991
|
}
|
|
985
992
|
};
|
|
@@ -990,27 +997,27 @@ const En = (t, e) => {
|
|
|
990
997
|
addAnnotation: a,
|
|
991
998
|
addBody: h,
|
|
992
999
|
all: u,
|
|
993
|
-
bulkAddAnnotation:
|
|
994
|
-
bulkDeleteAnnotation:
|
|
995
|
-
bulkDeleteBodies:
|
|
1000
|
+
bulkAddAnnotation: v,
|
|
1001
|
+
bulkDeleteAnnotation: x,
|
|
1002
|
+
bulkDeleteBodies: b,
|
|
996
1003
|
bulkUpdateAnnotation: f,
|
|
997
|
-
bulkUpdateBodies:
|
|
998
|
-
bulkUpdateTargets: (m,
|
|
999
|
-
const
|
|
1000
|
-
|
|
1004
|
+
bulkUpdateBodies: B,
|
|
1005
|
+
bulkUpdateTargets: (m, A = k.LOCAL) => {
|
|
1006
|
+
const w = m.map((L) => T(L)).filter(Boolean);
|
|
1007
|
+
w.length > 0 && s(A, { updated: w });
|
|
1001
1008
|
},
|
|
1002
|
-
clear:
|
|
1003
|
-
deleteAnnotation:
|
|
1009
|
+
clear: g,
|
|
1010
|
+
deleteAnnotation: y,
|
|
1004
1011
|
deleteBody: c,
|
|
1005
|
-
getAnnotation:
|
|
1006
|
-
getBody:
|
|
1012
|
+
getAnnotation: S,
|
|
1013
|
+
getBody: E,
|
|
1007
1014
|
observe: o,
|
|
1008
1015
|
unobserve: i,
|
|
1009
|
-
updateAnnotation:
|
|
1016
|
+
updateAnnotation: d,
|
|
1010
1017
|
updateBody: O,
|
|
1011
|
-
updateTarget: (m,
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1018
|
+
updateTarget: (m, A = k.LOCAL) => {
|
|
1019
|
+
const w = T(m);
|
|
1020
|
+
w && s(A, { updated: [w] });
|
|
1014
1021
|
}
|
|
1015
1022
|
};
|
|
1016
1023
|
};
|
|
@@ -1028,118 +1035,119 @@ let Tn = () => ({
|
|
|
1028
1035
|
};
|
|
1029
1036
|
}
|
|
1030
1037
|
});
|
|
1031
|
-
const On = 250,
|
|
1032
|
-
const
|
|
1033
|
-
let
|
|
1034
|
-
const
|
|
1035
|
-
if (!
|
|
1036
|
-
const { changes:
|
|
1037
|
-
if (
|
|
1038
|
-
|
|
1038
|
+
const On = 250, Bn = (t, e) => {
|
|
1039
|
+
const n = Tn(), o = [];
|
|
1040
|
+
let i = -1, s = !1, a = 0;
|
|
1041
|
+
const r = (p) => {
|
|
1042
|
+
if (!s) {
|
|
1043
|
+
const { changes: y } = p, x = performance.now();
|
|
1044
|
+
if (x - a > On)
|
|
1045
|
+
o.splice(i + 1), o.push(y), i = o.length - 1;
|
|
1039
1046
|
else {
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1047
|
+
const l = o.length - 1;
|
|
1048
|
+
o[l] = Sn(o[l], y);
|
|
1042
1049
|
}
|
|
1043
|
-
|
|
1050
|
+
a = x;
|
|
1044
1051
|
}
|
|
1045
|
-
|
|
1052
|
+
s = !1;
|
|
1046
1053
|
};
|
|
1047
|
-
t.observe(
|
|
1048
|
-
const
|
|
1054
|
+
t.observe(r, { origin: k.LOCAL });
|
|
1055
|
+
const d = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), f = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), h = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: y }) => y)), u = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: y }) => y)), g = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), v = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);
|
|
1049
1056
|
return {
|
|
1050
|
-
canRedo: () =>
|
|
1051
|
-
canUndo: () =>
|
|
1052
|
-
destroy: () => t.unobserve(
|
|
1053
|
-
|
|
1057
|
+
canRedo: () => o.length - 1 > i,
|
|
1058
|
+
canUndo: () => i > -1,
|
|
1059
|
+
destroy: () => t.unobserve(r),
|
|
1060
|
+
getHistory: () => ({ changes: [...o], pointer: i }),
|
|
1061
|
+
on: (p, y) => n.on(p, y),
|
|
1054
1062
|
redo: () => {
|
|
1055
|
-
if (
|
|
1056
|
-
|
|
1057
|
-
const { created:
|
|
1058
|
-
|
|
1063
|
+
if (o.length - 1 > i) {
|
|
1064
|
+
s = !0;
|
|
1065
|
+
const { created: p, updated: y, deleted: x } = o[i + 1];
|
|
1066
|
+
f(p), u(y), v(x), n.emit("redo", o[i + 1]), i += 1;
|
|
1059
1067
|
}
|
|
1060
1068
|
},
|
|
1061
1069
|
undo: () => {
|
|
1062
|
-
if (
|
|
1063
|
-
|
|
1064
|
-
const { created:
|
|
1065
|
-
|
|
1070
|
+
if (i > -1) {
|
|
1071
|
+
s = !0;
|
|
1072
|
+
const { created: p, updated: y, deleted: x } = o[i];
|
|
1073
|
+
d(p), h(y), g(x), n.emit("undo", o[i]), i -= 1;
|
|
1066
1074
|
}
|
|
1067
1075
|
}
|
|
1068
1076
|
};
|
|
1069
|
-
},
|
|
1070
|
-
const { subscribe: t, set: e } =
|
|
1077
|
+
}, Mn = () => {
|
|
1078
|
+
const { subscribe: t, set: e } = Kt([]);
|
|
1071
1079
|
return {
|
|
1072
1080
|
subscribe: t,
|
|
1073
1081
|
set: e
|
|
1074
1082
|
};
|
|
1075
1083
|
}, Rn = (t, e, n, o) => {
|
|
1076
|
-
const { hover: i, selection: s, store: a, viewport: r } = t,
|
|
1084
|
+
const { hover: i, selection: s, store: a, viewport: r } = t, d = /* @__PURE__ */ new Map();
|
|
1077
1085
|
let f = [], h;
|
|
1078
|
-
const u = (
|
|
1079
|
-
|
|
1080
|
-
},
|
|
1081
|
-
const
|
|
1082
|
-
if (
|
|
1083
|
-
const c =
|
|
1084
|
-
c !== -1 &&
|
|
1086
|
+
const u = (y, x) => {
|
|
1087
|
+
d.has(y) ? d.get(y).push(x) : d.set(y, [x]);
|
|
1088
|
+
}, g = (y, x) => {
|
|
1089
|
+
const l = d.get(y);
|
|
1090
|
+
if (l) {
|
|
1091
|
+
const c = l.indexOf(x);
|
|
1092
|
+
c !== -1 && l.splice(c, 1);
|
|
1085
1093
|
}
|
|
1086
|
-
},
|
|
1087
|
-
|
|
1088
|
-
|
|
1094
|
+
}, v = (y, x, l) => {
|
|
1095
|
+
d.has(y) && setTimeout(() => {
|
|
1096
|
+
d.get(y).forEach((c) => {
|
|
1089
1097
|
if (n) {
|
|
1090
|
-
const
|
|
1091
|
-
c(
|
|
1098
|
+
const b = Array.isArray(x) ? x.map((E) => n.serialize(E)) : n.serialize(x), S = l ? l instanceof PointerEvent ? l : n.serialize(l) : void 0;
|
|
1099
|
+
c(b, S);
|
|
1092
1100
|
} else
|
|
1093
|
-
c(
|
|
1101
|
+
c(x, l);
|
|
1094
1102
|
});
|
|
1095
1103
|
}, 1);
|
|
1096
1104
|
};
|
|
1097
|
-
s.subscribe(({ selected:
|
|
1098
|
-
if (!(f.length === 0 &&
|
|
1099
|
-
if (f.length === 0 &&
|
|
1100
|
-
f =
|
|
1101
|
-
else if (f.length > 0 &&
|
|
1102
|
-
f.forEach((
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
+
s.subscribe(({ selected: y }) => {
|
|
1106
|
+
if (!(f.length === 0 && y.length === 0)) {
|
|
1107
|
+
if (f.length === 0 && y.length > 0)
|
|
1108
|
+
f = y.map(({ id: x }) => a.getAnnotation(x));
|
|
1109
|
+
else if (f.length > 0 && y.length === 0)
|
|
1110
|
+
f.forEach((x) => {
|
|
1111
|
+
const l = a.getAnnotation(x.id);
|
|
1112
|
+
l && !G(l, x) && v("updateAnnotation", l, x);
|
|
1105
1113
|
}), f = [];
|
|
1106
1114
|
else {
|
|
1107
|
-
const
|
|
1108
|
-
f.filter((c) => !
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1115
|
+
const x = new Set(f.map((c) => c.id)), l = new Set(y.map(({ id: c }) => c));
|
|
1116
|
+
f.filter((c) => !l.has(c.id)).forEach((c) => {
|
|
1117
|
+
const b = a.getAnnotation(c.id);
|
|
1118
|
+
b && !G(b, c) && v("updateAnnotation", b, c);
|
|
1111
1119
|
}), f = [
|
|
1112
1120
|
// Remove annotations that were deselected
|
|
1113
|
-
...f.filter((c) =>
|
|
1121
|
+
...f.filter((c) => l.has(c.id)),
|
|
1114
1122
|
// Add editable annotations that were selected
|
|
1115
|
-
...
|
|
1123
|
+
...y.filter(({ id: c }) => !x.has(c)).map(({ id: c }) => a.getAnnotation(c))
|
|
1116
1124
|
];
|
|
1117
1125
|
}
|
|
1118
|
-
|
|
1126
|
+
v("selectionChanged", f);
|
|
1119
1127
|
}
|
|
1120
|
-
}), i.subscribe((
|
|
1121
|
-
!h &&
|
|
1122
|
-
}), r == null || r.subscribe((
|
|
1123
|
-
const { created:
|
|
1124
|
-
(
|
|
1128
|
+
}), i.subscribe((y) => {
|
|
1129
|
+
!h && y ? v("mouseEnterAnnotation", a.getAnnotation(y)) : h && !y ? v("mouseLeaveAnnotation", a.getAnnotation(h)) : h && y && (v("mouseLeaveAnnotation", a.getAnnotation(h)), v("mouseEnterAnnotation", a.getAnnotation(y))), h = y;
|
|
1130
|
+
}), r == null || r.subscribe((y) => v("viewportIntersect", y.map((x) => a.getAnnotation(x)))), a.observe((y) => {
|
|
1131
|
+
const { created: x, deleted: l } = y.changes;
|
|
1132
|
+
(x || []).forEach((c) => v("createAnnotation", c)), (l || []).forEach((c) => v("deleteAnnotation", c)), (y.changes.updated || []).filter((c) => [
|
|
1125
1133
|
...c.bodiesCreated || [],
|
|
1126
1134
|
...c.bodiesDeleted || [],
|
|
1127
1135
|
...c.bodiesUpdated || []
|
|
1128
|
-
].length > 0).forEach(({ oldValue: c, newValue:
|
|
1129
|
-
const
|
|
1130
|
-
f = f.map((
|
|
1136
|
+
].length > 0).forEach(({ oldValue: c, newValue: b }) => {
|
|
1137
|
+
const S = f.find((E) => E.id === c.id) || c;
|
|
1138
|
+
f = f.map((E) => E.id === c.id ? b : E), v("updateAnnotation", b, S);
|
|
1131
1139
|
});
|
|
1132
|
-
}, { origin: k.LOCAL }), a.observe((
|
|
1140
|
+
}, { origin: k.LOCAL }), a.observe((y) => {
|
|
1133
1141
|
if (f) {
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1142
|
+
const x = new Set(f.map((c) => c.id)), l = (y.changes.updated || []).filter(({ newValue: c }) => x.has(c.id)).map(({ newValue: c }) => c);
|
|
1143
|
+
l.length > 0 && (f = f.map((c) => l.find((S) => S.id === c.id) || c));
|
|
1136
1144
|
}
|
|
1137
1145
|
}, { origin: k.REMOTE });
|
|
1138
|
-
const
|
|
1139
|
-
const { updated:
|
|
1140
|
-
|
|
1146
|
+
const p = (y) => (x) => {
|
|
1147
|
+
const { updated: l } = x;
|
|
1148
|
+
y ? (l || []).forEach((c) => v("updateAnnotation", c.oldValue, c.newValue)) : (l || []).forEach((c) => v("updateAnnotation", c.newValue, c.oldValue));
|
|
1141
1149
|
};
|
|
1142
|
-
return e.on("undo",
|
|
1150
|
+
return e.on("undo", p(!0)), e.on("redo", p(!1)), { on: u, off: g, emit: v };
|
|
1143
1151
|
}, kn = (t) => (e) => e.reduce((n, o) => {
|
|
1144
1152
|
const { parsed: i, error: s } = t.parse(o);
|
|
1145
1153
|
return s ? {
|
|
@@ -1152,46 +1160,46 @@ const On = 250, Mn = (t) => {
|
|
|
1152
1160
|
...n
|
|
1153
1161
|
};
|
|
1154
1162
|
}, { parsed: [], failed: [] }), In = (t, e, n) => {
|
|
1155
|
-
const { store: o, selection: i } = t, s = (
|
|
1163
|
+
const { store: o, selection: i } = t, s = (l) => {
|
|
1156
1164
|
if (n) {
|
|
1157
|
-
const { parsed: c, error:
|
|
1158
|
-
c ? o.addAnnotation(c, k.REMOTE) : console.error(
|
|
1165
|
+
const { parsed: c, error: b } = n.parse(l);
|
|
1166
|
+
c ? o.addAnnotation(c, k.REMOTE) : console.error(b);
|
|
1159
1167
|
} else
|
|
1160
|
-
o.addAnnotation(
|
|
1161
|
-
}, a = () => i.clear(), r = () => o.clear(),
|
|
1162
|
-
const c = o.getAnnotation(
|
|
1168
|
+
o.addAnnotation(Bt(l), k.REMOTE);
|
|
1169
|
+
}, a = () => i.clear(), r = () => o.clear(), d = (l) => {
|
|
1170
|
+
const c = o.getAnnotation(l);
|
|
1163
1171
|
return n && c ? n.serialize(c) : c;
|
|
1164
1172
|
}, f = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
|
|
1165
|
-
var
|
|
1166
|
-
const c = (((
|
|
1173
|
+
var l;
|
|
1174
|
+
const c = (((l = i.selected) == null ? void 0 : l.map((b) => b.id)) || []).map((b) => o.getAnnotation(b)).filter(Boolean);
|
|
1167
1175
|
return n ? c.map(n.serialize) : c;
|
|
1168
|
-
}, u = (
|
|
1169
|
-
if (typeof
|
|
1170
|
-
const c = o.getAnnotation(
|
|
1171
|
-
if (o.deleteAnnotation(
|
|
1176
|
+
}, u = (l, c = !0) => fetch(l).then((b) => b.json()).then((b) => (v(b, c), b)), g = (l) => {
|
|
1177
|
+
if (typeof l == "string") {
|
|
1178
|
+
const c = o.getAnnotation(l);
|
|
1179
|
+
if (o.deleteAnnotation(l), c)
|
|
1172
1180
|
return n ? n.serialize(c) : c;
|
|
1173
1181
|
} else {
|
|
1174
|
-
const c = n ? n.parse(
|
|
1182
|
+
const c = n ? n.parse(l).parsed : l;
|
|
1175
1183
|
if (c)
|
|
1176
|
-
return o.deleteAnnotation(c),
|
|
1184
|
+
return o.deleteAnnotation(c), l;
|
|
1177
1185
|
}
|
|
1178
|
-
},
|
|
1186
|
+
}, v = (l, c = !0) => {
|
|
1179
1187
|
if (n) {
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1188
|
+
const b = n.parseAll || kn(n), { parsed: S, failed: E } = b(l);
|
|
1189
|
+
E.length > 0 && console.warn(`Discarded ${E.length} invalid annotations`, E), o.bulkAddAnnotation(S, c, k.REMOTE);
|
|
1182
1190
|
} else
|
|
1183
|
-
o.bulkAddAnnotation(
|
|
1184
|
-
},
|
|
1185
|
-
|
|
1186
|
-
},
|
|
1187
|
-
i.clear(), i.setUserSelectAction(
|
|
1188
|
-
},
|
|
1191
|
+
o.bulkAddAnnotation(l.map(Bt), c, k.REMOTE);
|
|
1192
|
+
}, p = (l, c) => {
|
|
1193
|
+
l ? i.setSelected(l, c) : i.clear();
|
|
1194
|
+
}, y = (l) => {
|
|
1195
|
+
i.clear(), i.setUserSelectAction(l);
|
|
1196
|
+
}, x = (l) => {
|
|
1189
1197
|
if (n) {
|
|
1190
|
-
const c = n.parse(
|
|
1191
|
-
return o.updateAnnotation(c),
|
|
1198
|
+
const c = n.parse(l).parsed, b = n.serialize(o.getAnnotation(c.id));
|
|
1199
|
+
return o.updateAnnotation(c), b;
|
|
1192
1200
|
} else {
|
|
1193
|
-
const c = o.getAnnotation(
|
|
1194
|
-
return o.updateAnnotation(
|
|
1201
|
+
const c = o.getAnnotation(l.id);
|
|
1202
|
+
return o.updateAnnotation(Bt(l)), c;
|
|
1195
1203
|
}
|
|
1196
1204
|
};
|
|
1197
1205
|
return {
|
|
@@ -1200,17 +1208,18 @@ const On = 250, Mn = (t) => {
|
|
|
1200
1208
|
canRedo: e.canRedo,
|
|
1201
1209
|
canUndo: e.canUndo,
|
|
1202
1210
|
clearAnnotations: r,
|
|
1203
|
-
getAnnotationById:
|
|
1211
|
+
getAnnotationById: d,
|
|
1204
1212
|
getAnnotations: f,
|
|
1213
|
+
getHistory: e.getHistory,
|
|
1205
1214
|
getSelected: h,
|
|
1206
1215
|
loadAnnotations: u,
|
|
1207
1216
|
redo: e.redo,
|
|
1208
|
-
removeAnnotation:
|
|
1209
|
-
setAnnotations:
|
|
1210
|
-
setSelected:
|
|
1211
|
-
setUserSelectAction:
|
|
1217
|
+
removeAnnotation: g,
|
|
1218
|
+
setAnnotations: v,
|
|
1219
|
+
setSelected: p,
|
|
1220
|
+
setUserSelectAction: y,
|
|
1212
1221
|
undo: e.undo,
|
|
1213
|
-
updateAnnotation:
|
|
1222
|
+
updateAnnotation: x
|
|
1214
1223
|
};
|
|
1215
1224
|
}, _n = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1216
1225
|
let Nn = (t) => crypto.getRandomValues(new Uint8Array(t)), Un = (t, e, n) => {
|
|
@@ -1218,18 +1227,18 @@ let Nn = (t) => crypto.getRandomValues(new Uint8Array(t)), Un = (t, e, n) => {
|
|
|
1218
1227
|
return (s = e) => {
|
|
1219
1228
|
let a = "";
|
|
1220
1229
|
for (; ; ) {
|
|
1221
|
-
let r = n(i),
|
|
1222
|
-
for (;
|
|
1223
|
-
if (a += t[r[
|
|
1230
|
+
let r = n(i), d = i | 0;
|
|
1231
|
+
for (; d--; )
|
|
1232
|
+
if (a += t[r[d] & o] || "", a.length >= s) return a;
|
|
1224
1233
|
}
|
|
1225
1234
|
};
|
|
1226
|
-
}, Vn = (t, e = 21) => Un(t, e, Nn), Yn = (t = 21) => {
|
|
1227
|
-
let e = "", n = crypto.getRandomValues(new Uint8Array(t));
|
|
1235
|
+
}, Vn = (t, e = 21) => Un(t, e | 0, Nn), Yn = (t = 21) => {
|
|
1236
|
+
let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
1228
1237
|
for (; t--; )
|
|
1229
1238
|
e += _n[n[t] & 63];
|
|
1230
1239
|
return e;
|
|
1231
1240
|
};
|
|
1232
|
-
const
|
|
1241
|
+
const Dn = () => ({ isGuest: !0, id: Vn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Kn = (t) => {
|
|
1233
1242
|
const e = JSON.stringify(t);
|
|
1234
1243
|
let n = 0;
|
|
1235
1244
|
for (let o = 0, i = e.length; o < i; o++) {
|
|
@@ -1237,17 +1246,17 @@ const Kn = () => ({ isGuest: !0, id: Vn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1237
1246
|
n = (n << 5) - n + s, n |= 0;
|
|
1238
1247
|
}
|
|
1239
1248
|
return `${n}`;
|
|
1240
|
-
},
|
|
1241
|
-
const { id: o, type: i, purpose: s, value: a, created: r, modified:
|
|
1249
|
+
}, pe = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Xn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1250
|
+
const { id: o, type: i, purpose: s, value: a, created: r, modified: d, creator: f, ...h } = n;
|
|
1242
1251
|
return {
|
|
1243
|
-
id: o || `temp-${
|
|
1252
|
+
id: o || `temp-${Kn(n)}`,
|
|
1244
1253
|
annotation: e,
|
|
1245
1254
|
type: i,
|
|
1246
1255
|
purpose: s,
|
|
1247
1256
|
value: a,
|
|
1248
|
-
creator:
|
|
1257
|
+
creator: pe(f),
|
|
1249
1258
|
created: r ? new Date(r) : void 0,
|
|
1250
|
-
updated:
|
|
1259
|
+
updated: d ? new Date(d) : void 0,
|
|
1251
1260
|
...h
|
|
1252
1261
|
};
|
|
1253
1262
|
}), Pn = (t) => t.map((e) => {
|
|
@@ -1260,7 +1269,7 @@ const Kn = () => ({ isGuest: !0, id: Vn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1260
1269
|
return (n = r.id) != null && n.startsWith("temp-") && delete r.id, r;
|
|
1261
1270
|
});
|
|
1262
1271
|
Yn();
|
|
1263
|
-
const
|
|
1272
|
+
const xo = (t, e) => ({
|
|
1264
1273
|
parse: (n) => jn(n),
|
|
1265
1274
|
serialize: (n) => zn(n, t, e)
|
|
1266
1275
|
}), $n = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, Hn = (t) => {
|
|
@@ -1274,7 +1283,7 @@ const Ao = (t, e) => ({
|
|
|
1274
1283
|
if (a.length === 0)
|
|
1275
1284
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
1276
1285
|
const r = {
|
|
1277
|
-
creator:
|
|
1286
|
+
creator: pe(n),
|
|
1278
1287
|
created: o ? new Date(o) : void 0,
|
|
1279
1288
|
updated: i ? new Date(i) : void 0,
|
|
1280
1289
|
annotation: e,
|
|
@@ -1282,14 +1291,14 @@ const Ao = (t, e) => ({
|
|
|
1282
1291
|
// @ts-expect-error: `styleClass` is not part of the core `TextAnnotationTarget` type
|
|
1283
1292
|
styleClass: "styleClass" in a[0] ? a[0].styleClass : void 0
|
|
1284
1293
|
};
|
|
1285
|
-
for (const
|
|
1286
|
-
const h = (Array.isArray(
|
|
1287
|
-
switch (
|
|
1294
|
+
for (const d of a) {
|
|
1295
|
+
const h = (Array.isArray(d.selector) ? d.selector : [d.selector]).reduce((u, g) => {
|
|
1296
|
+
switch (g.type) {
|
|
1288
1297
|
case "TextQuoteSelector":
|
|
1289
|
-
u.quote =
|
|
1298
|
+
u.quote = g.exact;
|
|
1290
1299
|
break;
|
|
1291
1300
|
case "TextPositionSelector":
|
|
1292
|
-
u.start =
|
|
1301
|
+
u.start = g.start, u.end = g.end;
|
|
1293
1302
|
break;
|
|
1294
1303
|
}
|
|
1295
1304
|
return u;
|
|
@@ -1298,9 +1307,9 @@ const Ao = (t, e) => ({
|
|
|
1298
1307
|
r.selector.push(
|
|
1299
1308
|
{
|
|
1300
1309
|
...h,
|
|
1301
|
-
id:
|
|
1310
|
+
id: d.id,
|
|
1302
1311
|
// @ts-expect-error: `scope` is not part of the core `TextSelector` type
|
|
1303
|
-
scope:
|
|
1312
|
+
scope: d.scope
|
|
1304
1313
|
}
|
|
1305
1314
|
);
|
|
1306
1315
|
else {
|
|
@@ -1319,40 +1328,40 @@ const Ao = (t, e) => ({
|
|
|
1319
1328
|
modified: i,
|
|
1320
1329
|
body: s,
|
|
1321
1330
|
...a
|
|
1322
|
-
} = t, r = Xn(s, e),
|
|
1323
|
-
return "error" in
|
|
1331
|
+
} = t, r = Xn(s, e), d = Hn(t);
|
|
1332
|
+
return "error" in d ? { error: d.error } : {
|
|
1324
1333
|
parsed: {
|
|
1325
1334
|
...a,
|
|
1326
1335
|
id: e,
|
|
1327
1336
|
bodies: r,
|
|
1328
|
-
target:
|
|
1337
|
+
target: d.parsed
|
|
1329
1338
|
}
|
|
1330
1339
|
};
|
|
1331
1340
|
}, zn = (t, e, n) => {
|
|
1332
1341
|
const { bodies: o, target: i, ...s } = t, {
|
|
1333
1342
|
selector: a,
|
|
1334
1343
|
creator: r,
|
|
1335
|
-
created:
|
|
1344
|
+
created: d,
|
|
1336
1345
|
updated: f,
|
|
1337
1346
|
...h
|
|
1338
|
-
} = i, u = a.map((
|
|
1339
|
-
const { id:
|
|
1347
|
+
} = i, u = a.map((g) => {
|
|
1348
|
+
const { id: v, quote: p, start: y, end: x, range: l } = g, { prefix: c, suffix: b } = Re(l, n), S = [{
|
|
1340
1349
|
type: "TextQuoteSelector",
|
|
1341
|
-
exact:
|
|
1350
|
+
exact: p,
|
|
1342
1351
|
prefix: c,
|
|
1343
|
-
suffix:
|
|
1352
|
+
suffix: b
|
|
1344
1353
|
}, {
|
|
1345
1354
|
type: "TextPositionSelector",
|
|
1346
|
-
start:
|
|
1347
|
-
end:
|
|
1355
|
+
start: y,
|
|
1356
|
+
end: x
|
|
1348
1357
|
}];
|
|
1349
1358
|
return {
|
|
1350
1359
|
...h,
|
|
1351
|
-
id:
|
|
1360
|
+
id: v,
|
|
1352
1361
|
// @ts-expect-error: `scope` is not part of the core `TextSelector` type
|
|
1353
|
-
scope: "scope" in
|
|
1362
|
+
scope: "scope" in g ? g.scope : void 0,
|
|
1354
1363
|
source: e,
|
|
1355
|
-
selector:
|
|
1364
|
+
selector: S
|
|
1356
1365
|
};
|
|
1357
1366
|
});
|
|
1358
1367
|
return {
|
|
@@ -1362,7 +1371,7 @@ const Ao = (t, e) => ({
|
|
|
1362
1371
|
type: "Annotation",
|
|
1363
1372
|
body: Pn(t.bodies),
|
|
1364
1373
|
creator: r,
|
|
1365
|
-
created:
|
|
1374
|
+
created: d == null ? void 0 : d.toISOString(),
|
|
1366
1375
|
modified: f == null ? void 0 : f.toISOString(),
|
|
1367
1376
|
target: u
|
|
1368
1377
|
};
|
|
@@ -1370,8 +1379,8 @@ const Ao = (t, e) => ({
|
|
|
1370
1379
|
function me(t, e, n = 0, o = t.length - 1, i = Fn) {
|
|
1371
1380
|
for (; o > n; ) {
|
|
1372
1381
|
if (o - n > 600) {
|
|
1373
|
-
const
|
|
1374
|
-
me(t, e,
|
|
1382
|
+
const d = o - n + 1, f = e - n + 1, h = Math.log(d), u = 0.5 * Math.exp(2 * h / 3), g = 0.5 * Math.sqrt(h * u * (d - u) / d) * (f - d / 2 < 0 ? -1 : 1), v = Math.max(n, Math.floor(e - f * u / d + g)), p = Math.min(o, Math.floor(e + (d - f) * u / d + g));
|
|
1383
|
+
me(t, e, v, p, i);
|
|
1375
1384
|
}
|
|
1376
1385
|
const s = t[e];
|
|
1377
1386
|
let a = n, r = o;
|
|
@@ -1403,8 +1412,8 @@ class Wn {
|
|
|
1403
1412
|
const i = this.toBBox, s = [];
|
|
1404
1413
|
for (; n; ) {
|
|
1405
1414
|
for (let a = 0; a < n.children.length; a++) {
|
|
1406
|
-
const r = n.children[a],
|
|
1407
|
-
mt(e,
|
|
1415
|
+
const r = n.children[a], d = n.leaf ? i(r) : r;
|
|
1416
|
+
mt(e, d) && (n.leaf ? o.push(r) : kt(e, d) ? this._all(r, o) : s.push(r));
|
|
1408
1417
|
}
|
|
1409
1418
|
n = s.pop();
|
|
1410
1419
|
}
|
|
@@ -1418,7 +1427,7 @@ class Wn {
|
|
|
1418
1427
|
for (let i = 0; i < n.children.length; i++) {
|
|
1419
1428
|
const s = n.children[i], a = n.leaf ? this.toBBox(s) : s;
|
|
1420
1429
|
if (mt(e, a)) {
|
|
1421
|
-
if (n.leaf ||
|
|
1430
|
+
if (n.leaf || kt(e, a)) return !0;
|
|
1422
1431
|
o.push(s);
|
|
1423
1432
|
}
|
|
1424
1433
|
}
|
|
@@ -1457,14 +1466,14 @@ class Wn {
|
|
|
1457
1466
|
if (!e) return this;
|
|
1458
1467
|
let o = this.data;
|
|
1459
1468
|
const i = this.toBBox(e), s = [], a = [];
|
|
1460
|
-
let r,
|
|
1469
|
+
let r, d, f;
|
|
1461
1470
|
for (; o || s.length; ) {
|
|
1462
|
-
if (o || (o = s.pop(),
|
|
1471
|
+
if (o || (o = s.pop(), d = s[s.length - 1], r = a.pop(), f = !0), o.leaf) {
|
|
1463
1472
|
const h = qn(e, o.children, n);
|
|
1464
1473
|
if (h !== -1)
|
|
1465
1474
|
return o.children.splice(h, 1), s.push(o), this._condense(s), this;
|
|
1466
1475
|
}
|
|
1467
|
-
!f && !o.leaf &&
|
|
1476
|
+
!f && !o.leaf && kt(o, i) ? (s.push(o), a.push(r), r = 0, d = o, o = o.children[0]) : d ? (r++, o = d.children[r], f = !1) : o = null;
|
|
1468
1477
|
}
|
|
1469
1478
|
return this;
|
|
1470
1479
|
}
|
|
@@ -1495,14 +1504,14 @@ class Wn {
|
|
|
1495
1504
|
if (s <= a)
|
|
1496
1505
|
return r = Z(e.slice(n, o + 1)), J(r, this.toBBox), r;
|
|
1497
1506
|
i || (i = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, i - 1))), r = Z([]), r.leaf = !1, r.height = i;
|
|
1498
|
-
const
|
|
1507
|
+
const d = Math.ceil(s / a), f = d * Math.ceil(Math.sqrt(a));
|
|
1499
1508
|
ee(e, n, o, f, this.compareMinX);
|
|
1500
1509
|
for (let h = n; h <= o; h += f) {
|
|
1501
1510
|
const u = Math.min(h + f - 1, o);
|
|
1502
|
-
ee(e, h, u,
|
|
1503
|
-
for (let
|
|
1504
|
-
const
|
|
1505
|
-
r.children.push(this._build(e,
|
|
1511
|
+
ee(e, h, u, d, this.compareMinY);
|
|
1512
|
+
for (let g = h; g <= u; g += d) {
|
|
1513
|
+
const v = Math.min(g + d - 1, u);
|
|
1514
|
+
r.children.push(this._build(e, g, v, i - 1));
|
|
1506
1515
|
}
|
|
1507
1516
|
}
|
|
1508
1517
|
return J(r, this.toBBox), r;
|
|
@@ -1510,8 +1519,8 @@ class Wn {
|
|
|
1510
1519
|
_chooseSubtree(e, n, o, i) {
|
|
1511
1520
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1512
1521
|
let s = 1 / 0, a = 1 / 0, r;
|
|
1513
|
-
for (let
|
|
1514
|
-
const f = n.children[
|
|
1522
|
+
for (let d = 0; d < n.children.length; d++) {
|
|
1523
|
+
const f = n.children[d], h = Rt(f), u = Jn(e, f) - h;
|
|
1515
1524
|
u < a ? (a = u, s = h < s ? h : s, r = f) : u === a && h < s && (s = h, r = f);
|
|
1516
1525
|
}
|
|
1517
1526
|
n = r || n.children[0];
|
|
@@ -1537,7 +1546,7 @@ class Wn {
|
|
|
1537
1546
|
_chooseSplitIndex(e, n, o) {
|
|
1538
1547
|
let i, s = 1 / 0, a = 1 / 0;
|
|
1539
1548
|
for (let r = n; r <= o - n; r++) {
|
|
1540
|
-
const
|
|
1549
|
+
const d = st(e, 0, r, this.toBBox), f = st(e, r, o, this.toBBox), h = Zn(d, f), u = Rt(d) + Rt(f);
|
|
1541
1550
|
h < s ? (s = h, i = r, a = u < a ? u : a) : h === s && u < a && (a = u, i = r);
|
|
1542
1551
|
}
|
|
1543
1552
|
return i || o - n;
|
|
@@ -1551,16 +1560,16 @@ class Wn {
|
|
|
1551
1560
|
_allDistMargin(e, n, o, i) {
|
|
1552
1561
|
e.children.sort(i);
|
|
1553
1562
|
const s = this.toBBox, a = st(e, 0, n, s), r = st(e, o - n, o, s);
|
|
1554
|
-
let
|
|
1563
|
+
let d = pt(a) + pt(r);
|
|
1555
1564
|
for (let f = n; f < o - n; f++) {
|
|
1556
1565
|
const h = e.children[f];
|
|
1557
|
-
rt(a, e.leaf ? s(h) : h),
|
|
1566
|
+
rt(a, e.leaf ? s(h) : h), d += pt(a);
|
|
1558
1567
|
}
|
|
1559
1568
|
for (let f = o - n - 1; f >= n; f--) {
|
|
1560
1569
|
const h = e.children[f];
|
|
1561
|
-
rt(r, e.leaf ? s(h) : h),
|
|
1570
|
+
rt(r, e.leaf ? s(h) : h), d += pt(r);
|
|
1562
1571
|
}
|
|
1563
|
-
return
|
|
1572
|
+
return d;
|
|
1564
1573
|
}
|
|
1565
1574
|
_adjustParentBBoxes(e, n, o) {
|
|
1566
1575
|
for (let i = o; i >= 0; i--)
|
|
@@ -1597,10 +1606,10 @@ function Gn(t, e) {
|
|
|
1597
1606
|
function Qn(t, e) {
|
|
1598
1607
|
return t.minY - e.minY;
|
|
1599
1608
|
}
|
|
1600
|
-
function
|
|
1609
|
+
function Rt(t) {
|
|
1601
1610
|
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
1602
1611
|
}
|
|
1603
|
-
function
|
|
1612
|
+
function pt(t) {
|
|
1604
1613
|
return t.maxX - t.minX + (t.maxY - t.minY);
|
|
1605
1614
|
}
|
|
1606
1615
|
function Jn(t, e) {
|
|
@@ -1610,7 +1619,7 @@ function Zn(t, e) {
|
|
|
1610
1619
|
const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), s = Math.min(t.maxY, e.maxY);
|
|
1611
1620
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
1612
1621
|
}
|
|
1613
|
-
function
|
|
1622
|
+
function kt(t, e) {
|
|
1614
1623
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1615
1624
|
}
|
|
1616
1625
|
function mt(t, e) {
|
|
@@ -1636,133 +1645,129 @@ function ee(t, e, n, o, i) {
|
|
|
1636
1645
|
}
|
|
1637
1646
|
}
|
|
1638
1647
|
const to = (t, e) => {
|
|
1639
|
-
const n = new Wn(), o = /* @__PURE__ */ new Map(), i = (
|
|
1640
|
-
const
|
|
1641
|
-
const
|
|
1642
|
-
return Array.from(
|
|
1643
|
-
}),
|
|
1644
|
-
return
|
|
1645
|
-
const { x:
|
|
1648
|
+
const n = new Wn(), o = /* @__PURE__ */ new Map(), i = (l, c) => {
|
|
1649
|
+
const b = l.selector.flatMap((E) => {
|
|
1650
|
+
const C = F([E]) ? E.range : ae(E, e).range;
|
|
1651
|
+
return Array.from(C.getClientRects());
|
|
1652
|
+
}), S = Ue(b).map(({ left: E, top: C, right: O, bottom: B }) => new DOMRect(E - c.left, C - c.top, O - E, B - C));
|
|
1653
|
+
return S.map((E) => {
|
|
1654
|
+
const { x: C, y: O, width: B, height: T } = E;
|
|
1646
1655
|
return {
|
|
1647
|
-
minX:
|
|
1656
|
+
minX: C,
|
|
1648
1657
|
minY: O,
|
|
1649
|
-
maxX:
|
|
1650
|
-
maxY: O +
|
|
1658
|
+
maxX: C + B,
|
|
1659
|
+
maxY: O + T,
|
|
1651
1660
|
annotation: {
|
|
1652
|
-
id:
|
|
1653
|
-
rects:
|
|
1661
|
+
id: l.annotation,
|
|
1662
|
+
rects: S
|
|
1654
1663
|
}
|
|
1655
1664
|
};
|
|
1656
1665
|
});
|
|
1657
1666
|
}, s = () => [...o.values()], a = () => {
|
|
1658
1667
|
n.clear(), o.clear();
|
|
1659
|
-
}, r = (
|
|
1660
|
-
const c = i(
|
|
1661
|
-
c.forEach((
|
|
1662
|
-
},
|
|
1663
|
-
const c = o.get(
|
|
1664
|
-
c && (c.forEach((
|
|
1665
|
-
}, f = (
|
|
1666
|
-
l
|
|
1667
|
-
}, h = (
|
|
1668
|
+
}, r = (l) => {
|
|
1669
|
+
const c = i(l, e.getBoundingClientRect());
|
|
1670
|
+
c.length !== 0 && (c.forEach((b) => n.insert(b)), o.set(l.annotation, c));
|
|
1671
|
+
}, d = (l) => {
|
|
1672
|
+
const c = o.get(l.annotation);
|
|
1673
|
+
c && (c.forEach((b) => n.remove(b)), o.delete(l.annotation));
|
|
1674
|
+
}, f = (l) => {
|
|
1675
|
+
d(l), r(l);
|
|
1676
|
+
}, h = (l, c = !0) => {
|
|
1668
1677
|
c && a();
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1678
|
+
const b = e.getBoundingClientRect(), S = l.map((C) => ({ target: C, rects: i(C, b) }));
|
|
1679
|
+
S.forEach(({ target: C, rects: O }) => {
|
|
1680
|
+
O.length > 0 && o.set(C.annotation, O);
|
|
1681
|
+
});
|
|
1682
|
+
const E = S.flatMap(({ rects: C }) => C);
|
|
1683
|
+
n.load(E);
|
|
1684
|
+
}, u = (l, c, b = !1) => {
|
|
1685
|
+
const S = n.search({
|
|
1686
|
+
minX: l,
|
|
1676
1687
|
minY: c,
|
|
1677
|
-
maxX:
|
|
1688
|
+
maxX: l,
|
|
1678
1689
|
maxY: c
|
|
1679
|
-
}),
|
|
1680
|
-
return
|
|
1681
|
-
},
|
|
1682
|
-
const c =
|
|
1690
|
+
}), E = (C) => C.annotation.rects.reduce((O, B) => O + B.width * B.height, 0);
|
|
1691
|
+
return S.length > 0 ? (S.sort((C, O) => E(C) - E(O)), b ? S.map((C) => C.annotation.id) : [S[0].annotation.id]) : [];
|
|
1692
|
+
}, g = (l) => {
|
|
1693
|
+
const c = v(l);
|
|
1683
1694
|
if (c.length === 0)
|
|
1684
1695
|
return;
|
|
1685
|
-
let
|
|
1696
|
+
let b = c[0].left, S = c[0].top, E = c[0].right, C = c[0].bottom;
|
|
1686
1697
|
for (let O = 1; O < c.length; O++) {
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1698
|
+
const B = c[O];
|
|
1699
|
+
b = Math.min(b, B.left), S = Math.min(S, B.top), E = Math.max(E, B.right), C = Math.max(C, B.bottom);
|
|
1689
1700
|
}
|
|
1690
|
-
return new DOMRect(
|
|
1691
|
-
},
|
|
1692
|
-
const c = o.get(
|
|
1701
|
+
return new DOMRect(b, S, E - b, C - S);
|
|
1702
|
+
}, v = (l) => {
|
|
1703
|
+
const c = o.get(l);
|
|
1693
1704
|
return c ? c[0].annotation.rects : [];
|
|
1694
1705
|
};
|
|
1695
1706
|
return {
|
|
1696
1707
|
all: s,
|
|
1697
1708
|
clear: a,
|
|
1698
1709
|
getAt: u,
|
|
1699
|
-
getAnnotationBounds:
|
|
1700
|
-
getAnnotationRects:
|
|
1701
|
-
getIntersecting: (
|
|
1702
|
-
const
|
|
1703
|
-
return Array.from(
|
|
1710
|
+
getAnnotationBounds: g,
|
|
1711
|
+
getAnnotationRects: v,
|
|
1712
|
+
getIntersecting: (l, c, b, S) => {
|
|
1713
|
+
const E = n.search({ minX: l, minY: c, maxX: b, maxY: S }), C = new Set(E.map((O) => O.annotation.id));
|
|
1714
|
+
return Array.from(C).map((O) => ({
|
|
1704
1715
|
annotation: t.getAnnotation(O),
|
|
1705
|
-
rects:
|
|
1716
|
+
rects: v(O)
|
|
1706
1717
|
})).filter((O) => !!O.annotation);
|
|
1707
1718
|
},
|
|
1708
1719
|
insert: r,
|
|
1709
|
-
recalculate: () => h(t.all().map((
|
|
1710
|
-
remove:
|
|
1720
|
+
recalculate: () => h(t.all().map((l) => l.target), !0),
|
|
1721
|
+
remove: d,
|
|
1711
1722
|
set: h,
|
|
1712
1723
|
size: () => n.all().length,
|
|
1713
1724
|
update: f
|
|
1714
1725
|
};
|
|
1715
1726
|
}, eo = (t, e) => {
|
|
1716
|
-
const n = Ln(), o = to(n, t), i =
|
|
1727
|
+
const n = Ln(), o = to(n, t), i = gn(n);
|
|
1717
1728
|
i.setUserSelectAction(e);
|
|
1718
|
-
const s = fn(n), a =
|
|
1719
|
-
const
|
|
1720
|
-
return
|
|
1721
|
-
},
|
|
1722
|
-
const
|
|
1723
|
-
return n.bulkAddAnnotation(
|
|
1724
|
-
}, f = (
|
|
1725
|
-
const
|
|
1726
|
-
return
|
|
1727
|
-
n.getAnnotation(E.id) ? n.updateAnnotation(E,
|
|
1728
|
-
}),
|
|
1729
|
-
}, h = (
|
|
1730
|
-
const
|
|
1731
|
-
n.updateTarget(
|
|
1732
|
-
}, u = (
|
|
1733
|
-
const
|
|
1734
|
-
n.bulkUpdateTargets(
|
|
1729
|
+
const s = fn(n), a = Mn(), r = (l, c = k.LOCAL) => {
|
|
1730
|
+
const b = vt(l, t), S = F(b.target.selector);
|
|
1731
|
+
return S && n.addAnnotation(b, c), S;
|
|
1732
|
+
}, d = (l, c = !0, b = k.LOCAL) => {
|
|
1733
|
+
const S = l.map((C) => vt(C, t)), E = S.filter((C) => !F(C.target.selector));
|
|
1734
|
+
return n.bulkAddAnnotation(S, c, b), E;
|
|
1735
|
+
}, f = (l, c = k.LOCAL) => {
|
|
1736
|
+
const b = l.map((E) => vt(E, t)), S = b.filter((E) => !F(E.target.selector));
|
|
1737
|
+
return b.forEach((E) => {
|
|
1738
|
+
n.getAnnotation(E.id) ? n.updateAnnotation(E, c) : n.addAnnotation(E, c);
|
|
1739
|
+
}), S;
|
|
1740
|
+
}, h = (l, c = k.LOCAL) => {
|
|
1741
|
+
const b = wt(l, t);
|
|
1742
|
+
n.updateTarget(b, c);
|
|
1743
|
+
}, u = (l, c = k.LOCAL) => {
|
|
1744
|
+
const b = l.map((S) => wt(S, t));
|
|
1745
|
+
n.bulkUpdateTargets(b, c);
|
|
1735
1746
|
};
|
|
1736
|
-
function
|
|
1737
|
-
const E =
|
|
1738
|
-
if (
|
|
1739
|
-
return
|
|
1747
|
+
function g(l, c, b, S) {
|
|
1748
|
+
const E = b || !!S, C = o.getAt(l, c, E).map((B) => n.getAnnotation(B)), O = S ? C.filter(S) : C;
|
|
1749
|
+
if (O.length !== 0)
|
|
1750
|
+
return b ? O : O[0];
|
|
1740
1751
|
}
|
|
1741
|
-
const
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
return o.getAnnotationBounds(y);
|
|
1749
|
-
}
|
|
1750
|
-
}, b = (y) => o.getAnnotationRects(y), w = () => o.recalculate();
|
|
1751
|
-
return n.observe(({ changes: y }) => {
|
|
1752
|
-
const d = (y.deleted || []).filter((E) => F(E.target.selector)), c = (y.created || []).filter((E) => F(E.target.selector)), A = (y.updated || []).filter((E) => F(E.newValue.target.selector));
|
|
1753
|
-
(d == null ? void 0 : d.length) > 0 && d.forEach((E) => o.remove(E.target)), c.length > 0 && o.set(c.map((E) => E.target), !1), (A == null ? void 0 : A.length) > 0 && A.forEach(({ newValue: E }) => o.update(E.target));
|
|
1752
|
+
const v = (l) => {
|
|
1753
|
+
if (o.getAnnotationRects(l).length !== 0)
|
|
1754
|
+
return o.getAnnotationBounds(l);
|
|
1755
|
+
}, p = (l, c, b, S) => o.getIntersecting(l, c, b, S), y = (l) => o.getAnnotationRects(l), x = () => o.recalculate();
|
|
1756
|
+
return n.observe(({ changes: l }) => {
|
|
1757
|
+
const c = (l.deleted || []).filter((E) => F(E.target.selector)), b = (l.created || []).filter((E) => F(E.target.selector)), S = (l.updated || []).filter((E) => F(E.newValue.target.selector));
|
|
1758
|
+
(c == null ? void 0 : c.length) > 0 && c.forEach((E) => o.remove(E.target)), b.length > 0 && o.set(b.map((E) => E.target), !1), (S == null ? void 0 : S.length) > 0 && S.forEach(({ newValue: E }) => o.update(E.target));
|
|
1754
1759
|
}), {
|
|
1755
1760
|
store: {
|
|
1756
1761
|
...n,
|
|
1757
1762
|
addAnnotation: r,
|
|
1758
|
-
bulkAddAnnotation:
|
|
1763
|
+
bulkAddAnnotation: d,
|
|
1759
1764
|
bulkUpdateTargets: u,
|
|
1760
1765
|
bulkUpsertAnnotations: f,
|
|
1761
|
-
getAnnotationBounds:
|
|
1762
|
-
getAnnotationRects:
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
recalculatePositions:
|
|
1766
|
+
getAnnotationBounds: v,
|
|
1767
|
+
getAnnotationRects: y,
|
|
1768
|
+
getIntersecting: p,
|
|
1769
|
+
getAt: g,
|
|
1770
|
+
recalculatePositions: x,
|
|
1766
1771
|
updateTarget: h
|
|
1767
1772
|
},
|
|
1768
1773
|
selection: i,
|
|
@@ -1777,9 +1782,9 @@ const to = (t, e) => {
|
|
|
1777
1782
|
}, oo = (t, e = {}) => {
|
|
1778
1783
|
const n = no(), o = n.getContext("2d");
|
|
1779
1784
|
document.body.appendChild(n);
|
|
1780
|
-
const i = /* @__PURE__ */ new Map(), s = (h) => Array.from(i.entries()).filter(([u,
|
|
1785
|
+
const i = /* @__PURE__ */ new Map(), s = (h) => Array.from(i.entries()).filter(([u, g]) => g.presenceKey === h.presenceKey).map(([u, g]) => u);
|
|
1781
1786
|
return t.on("selectionChange", (h, u) => {
|
|
1782
|
-
s(h).forEach((
|
|
1787
|
+
s(h).forEach((v) => i.delete(v)), u && u.forEach((v) => i.set(v, h));
|
|
1783
1788
|
}), {
|
|
1784
1789
|
clear: () => {
|
|
1785
1790
|
const { width: h, height: u } = n;
|
|
@@ -1788,16 +1793,16 @@ const to = (t, e) => {
|
|
|
1788
1793
|
destroy: () => {
|
|
1789
1794
|
n.remove();
|
|
1790
1795
|
},
|
|
1791
|
-
paint: (h, u,
|
|
1796
|
+
paint: (h, u, g) => {
|
|
1792
1797
|
e.font && (o.font = e.font);
|
|
1793
|
-
const
|
|
1794
|
-
if (
|
|
1795
|
-
const { height:
|
|
1796
|
-
o.fillStyle =
|
|
1797
|
-
const
|
|
1798
|
-
return o.fillRect(
|
|
1799
|
-
fill:
|
|
1800
|
-
fillOpacity:
|
|
1798
|
+
const v = i.get(h.annotation.id);
|
|
1799
|
+
if (v) {
|
|
1800
|
+
const { height: p } = h.rects[0], y = h.rects[0].x + u.left, x = h.rects[0].y + u.top;
|
|
1801
|
+
o.fillStyle = v.appearance.color, o.fillRect(y - 2, x - 2.5, 2, p + 5);
|
|
1802
|
+
const l = o.measureText(v.appearance.label), c = l.width + 6, b = l.actualBoundingBoxAscent + l.actualBoundingBoxDescent + 8, S = l.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1803
|
+
return o.fillRect(y - 2, x - 2.5 - b, c, b), o.fillStyle = "#fff", o.fillText(v.appearance.label, y + 1, x - S), {
|
|
1804
|
+
fill: v.appearance.color,
|
|
1805
|
+
fillOpacity: g ? 0.45 : 0.18
|
|
1801
1806
|
};
|
|
1802
1807
|
}
|
|
1803
1808
|
},
|
|
@@ -1807,8 +1812,8 @@ const to = (t, e) => {
|
|
|
1807
1812
|
h.scale(2, 2), h.translate(0.5, 0.5);
|
|
1808
1813
|
}
|
|
1809
1814
|
};
|
|
1810
|
-
},
|
|
1811
|
-
function
|
|
1815
|
+
}, It = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1;
|
|
1816
|
+
function _t(t, e, n, o) {
|
|
1812
1817
|
t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent("on".concat(e), n);
|
|
1813
1818
|
}
|
|
1814
1819
|
function ot(t, e, n, o) {
|
|
@@ -1879,9 +1884,9 @@ const lt = {
|
|
|
1879
1884
|
".": 190,
|
|
1880
1885
|
"/": 191,
|
|
1881
1886
|
"`": 192,
|
|
1882
|
-
"-":
|
|
1883
|
-
"=":
|
|
1884
|
-
";":
|
|
1887
|
+
"-": It ? 173 : 189,
|
|
1888
|
+
"=": It ? 61 : 187,
|
|
1889
|
+
";": It ? 59 : 186,
|
|
1885
1890
|
"'": 222,
|
|
1886
1891
|
"[": 219,
|
|
1887
1892
|
"]": 221,
|
|
@@ -1902,7 +1907,7 @@ const lt = {
|
|
|
1902
1907
|
"⌘": 91,
|
|
1903
1908
|
cmd: 91,
|
|
1904
1909
|
command: 91
|
|
1905
|
-
},
|
|
1910
|
+
}, bt = {
|
|
1906
1911
|
16: "shiftKey",
|
|
1907
1912
|
18: "altKey",
|
|
1908
1913
|
17: "ctrlKey",
|
|
@@ -1911,7 +1916,7 @@ const lt = {
|
|
|
1911
1916
|
ctrlKey: 17,
|
|
1912
1917
|
altKey: 18,
|
|
1913
1918
|
metaKey: 91
|
|
1914
|
-
},
|
|
1919
|
+
}, K = {
|
|
1915
1920
|
16: !1,
|
|
1916
1921
|
18: !1,
|
|
1917
1922
|
17: !1,
|
|
@@ -1977,11 +1982,11 @@ function ho(t, e) {
|
|
|
1977
1982
|
}) : o++;
|
|
1978
1983
|
dt() === t && Ae(e || "all");
|
|
1979
1984
|
}
|
|
1980
|
-
function
|
|
1985
|
+
function go(t) {
|
|
1981
1986
|
let e = t.keyCode || t.which || t.charCode;
|
|
1982
1987
|
const n = I.indexOf(e);
|
|
1983
|
-
if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in
|
|
1984
|
-
|
|
1988
|
+
if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in K) {
|
|
1989
|
+
K[e] = !1;
|
|
1985
1990
|
for (const o in H) H[o] === e && (P[o] = !1);
|
|
1986
1991
|
}
|
|
1987
1992
|
}
|
|
@@ -2016,14 +2021,14 @@ const yt = (t) => {
|
|
|
2016
2021
|
splitKey: i = "+"
|
|
2017
2022
|
} = t;
|
|
2018
2023
|
be(e).forEach((a) => {
|
|
2019
|
-
const r = a.split(i),
|
|
2024
|
+
const r = a.split(i), d = r.length, f = r[d - 1], h = f === "*" ? "*" : ut(f);
|
|
2020
2025
|
if (!_[h]) return;
|
|
2021
2026
|
n || (n = dt());
|
|
2022
|
-
const u =
|
|
2023
|
-
_[h] = _[h].filter((
|
|
2024
|
-
const
|
|
2025
|
-
return
|
|
2026
|
-
}),
|
|
2027
|
+
const u = d > 1 ? ye(H, r) : [], g = [];
|
|
2028
|
+
_[h] = _[h].filter((v) => {
|
|
2029
|
+
const y = (o ? v.method === o : !0) && v.scope === n && io(v.mods, u);
|
|
2030
|
+
return y && g.push(v.element), !y;
|
|
2031
|
+
}), g.forEach((v) => Xt(v));
|
|
2027
2032
|
});
|
|
2028
2033
|
};
|
|
2029
2034
|
function ne(t, e, n, o) {
|
|
@@ -2032,27 +2037,27 @@ function ne(t, e, n, o) {
|
|
|
2032
2037
|
let i;
|
|
2033
2038
|
if (e.scope === n || e.scope === "all") {
|
|
2034
2039
|
i = e.mods.length > 0;
|
|
2035
|
-
for (const s in
|
|
2036
|
-
Object.prototype.hasOwnProperty.call(
|
|
2037
|
-
(e.mods.length === 0 && !
|
|
2040
|
+
for (const s in K)
|
|
2041
|
+
Object.prototype.hasOwnProperty.call(K, s) && (!K[s] && e.mods.indexOf(+s) > -1 || K[s] && e.mods.indexOf(+s) === -1) && (i = !1);
|
|
2042
|
+
(e.mods.length === 0 && !K[16] && !K[18] && !K[17] && !K[91] || i || e.shortcut === "*") && (e.keys = [], e.keys = e.keys.concat(I), e.method(t, e) === !1 && (t.preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = !0)));
|
|
2038
2043
|
}
|
|
2039
2044
|
}
|
|
2040
2045
|
function oe(t, e) {
|
|
2041
2046
|
const n = _["*"];
|
|
2042
2047
|
let o = t.keyCode || t.which || t.charCode;
|
|
2043
2048
|
if (!P.filter.call(this, t)) return;
|
|
2044
|
-
if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["
|
|
2045
|
-
const
|
|
2046
|
-
t[r] && I.indexOf(
|
|
2047
|
-
}), o in
|
|
2048
|
-
|
|
2049
|
+
if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["metaKey", "ctrlKey", "altKey", "shiftKey"].forEach((r) => {
|
|
2050
|
+
const d = bt[r];
|
|
2051
|
+
t[r] && I.indexOf(d) === -1 ? I.push(d) : !t[r] && I.indexOf(d) > -1 ? I.splice(I.indexOf(d), 1) : r === "metaKey" && t[r] && (I = I.filter((f) => f in bt || f === o));
|
|
2052
|
+
}), o in K) {
|
|
2053
|
+
K[o] = !0;
|
|
2049
2054
|
for (const r in H)
|
|
2050
2055
|
H[r] === o && (P[r] = !0);
|
|
2051
2056
|
if (!n) return;
|
|
2052
2057
|
}
|
|
2053
|
-
for (const r in
|
|
2054
|
-
Object.prototype.hasOwnProperty.call(
|
|
2055
|
-
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18),
|
|
2058
|
+
for (const r in K)
|
|
2059
|
+
Object.prototype.hasOwnProperty.call(K, r) && (K[r] = t[bt[r]]);
|
|
2060
|
+
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18), K[17] = !0, K[18] = !0);
|
|
2056
2061
|
const i = dt();
|
|
2057
2062
|
if (n)
|
|
2058
2063
|
for (let r = 0; r < n.length; r++)
|
|
@@ -2061,21 +2066,21 @@ function oe(t, e) {
|
|
|
2061
2066
|
const s = _[o], a = s.length;
|
|
2062
2067
|
for (let r = 0; r < a; r++)
|
|
2063
2068
|
if ((t.type === "keydown" && s[r].keydown || t.type === "keyup" && s[r].keyup) && s[r].key) {
|
|
2064
|
-
const
|
|
2069
|
+
const d = s[r], {
|
|
2065
2070
|
splitKey: f
|
|
2066
|
-
} =
|
|
2067
|
-
for (let
|
|
2068
|
-
u.push(ut(h[
|
|
2069
|
-
u.sort().join("") === I.sort().join("") && ne(t,
|
|
2071
|
+
} = d, h = d.key.split(f), u = [];
|
|
2072
|
+
for (let g = 0; g < h.length; g++)
|
|
2073
|
+
u.push(ut(h[g]));
|
|
2074
|
+
u.sort().join("") === I.sort().join("") && ne(t, d, i, e);
|
|
2070
2075
|
}
|
|
2071
2076
|
}
|
|
2072
2077
|
function P(t, e, n) {
|
|
2073
2078
|
I = [];
|
|
2074
2079
|
const o = be(t);
|
|
2075
|
-
let i = [], s = "all", a = document, r = 0,
|
|
2076
|
-
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (a = e.element), e.keyup && (
|
|
2080
|
+
let i = [], s = "all", a = document, r = 0, d = !1, f = !0, h = "+", u = !1, g = !1;
|
|
2081
|
+
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (a = e.element), e.keyup && (d = e.keyup), e.keydown !== void 0 && (f = e.keydown), e.capture !== void 0 && (u = e.capture), typeof e.splitKey == "string" && (h = e.splitKey), e.single === !0 && (g = !0)), typeof e == "string" && (s = e), g && xe(t, s); r < o.length; r++)
|
|
2077
2082
|
t = o[r].split(h), i = [], t.length > 1 && (i = ye(H, t)), t = t[t.length - 1], t = t === "*" ? "*" : ut(t), t in _ || (_[t] = []), _[t].push({
|
|
2078
|
-
keyup:
|
|
2083
|
+
keyup: d,
|
|
2079
2084
|
keydown: f,
|
|
2080
2085
|
scope: s,
|
|
2081
2086
|
mods: i,
|
|
@@ -2087,31 +2092,31 @@ function P(t, e, n) {
|
|
|
2087
2092
|
});
|
|
2088
2093
|
if (typeof a < "u" && window) {
|
|
2089
2094
|
if (!z.has(a)) {
|
|
2090
|
-
const
|
|
2091
|
-
let
|
|
2092
|
-
return oe(
|
|
2093
|
-
},
|
|
2094
|
-
let
|
|
2095
|
-
oe(
|
|
2095
|
+
const v = function() {
|
|
2096
|
+
let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2097
|
+
return oe(y, a);
|
|
2098
|
+
}, p = function() {
|
|
2099
|
+
let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2100
|
+
oe(y, a), go(y);
|
|
2096
2101
|
};
|
|
2097
2102
|
z.set(a, {
|
|
2098
|
-
keydownListener:
|
|
2099
|
-
keyupListenr:
|
|
2103
|
+
keydownListener: v,
|
|
2104
|
+
keyupListenr: p,
|
|
2100
2105
|
capture: u
|
|
2101
|
-
}),
|
|
2106
|
+
}), _t(a, "keydown", v, u), _t(a, "keyup", p, u);
|
|
2102
2107
|
}
|
|
2103
2108
|
if (!ct) {
|
|
2104
|
-
const
|
|
2109
|
+
const v = () => {
|
|
2105
2110
|
I = [];
|
|
2106
2111
|
};
|
|
2107
2112
|
ct = {
|
|
2108
|
-
listener:
|
|
2113
|
+
listener: v,
|
|
2109
2114
|
capture: u
|
|
2110
|
-
},
|
|
2115
|
+
}, _t(window, "focus", v, u);
|
|
2111
2116
|
}
|
|
2112
2117
|
}
|
|
2113
2118
|
}
|
|
2114
|
-
function
|
|
2119
|
+
function po(t) {
|
|
2115
2120
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
|
|
2116
2121
|
Object.keys(_).forEach((n) => {
|
|
2117
2122
|
_[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {
|
|
@@ -2149,7 +2154,7 @@ function Xt(t) {
|
|
|
2149
2154
|
ot(window, "focus", i, s), ct = null;
|
|
2150
2155
|
}
|
|
2151
2156
|
}
|
|
2152
|
-
const
|
|
2157
|
+
const Nt = {
|
|
2153
2158
|
getPressedKeyString: co,
|
|
2154
2159
|
setScope: Ae,
|
|
2155
2160
|
getScope: dt,
|
|
@@ -2158,14 +2163,14 @@ const _t = {
|
|
|
2158
2163
|
getAllKeyCodes: lo,
|
|
2159
2164
|
isPressed: fo,
|
|
2160
2165
|
filter: uo,
|
|
2161
|
-
trigger:
|
|
2166
|
+
trigger: po,
|
|
2162
2167
|
unbind: xe,
|
|
2163
2168
|
keyMap: lt,
|
|
2164
2169
|
modifier: H,
|
|
2165
|
-
modifierMap:
|
|
2170
|
+
modifierMap: bt
|
|
2166
2171
|
};
|
|
2167
|
-
for (const t in
|
|
2168
|
-
Object.prototype.hasOwnProperty.call(
|
|
2172
|
+
for (const t in Nt)
|
|
2173
|
+
Object.prototype.hasOwnProperty.call(Nt, t) && (P[t] = Nt[t]);
|
|
2169
2174
|
if (typeof window < "u") {
|
|
2170
2175
|
const t = window.hotkeys;
|
|
2171
2176
|
P.noConflict = (e) => (e && window.hotkeys === P && (window.hotkeys = t), P), window.hotkeys = P;
|
|
@@ -2175,96 +2180,98 @@ const ie = 300, ve = ["up", "down", "left", "right"], Ee = Te ? "⌘+a" : "ctrl+
|
|
|
2175
2180
|
Ee
|
|
2176
2181
|
], yo = (t, e, n) => {
|
|
2177
2182
|
let o;
|
|
2178
|
-
const { annotatingEnabled: i, offsetReferenceSelector: s, selectionMode: a } = n, r = (
|
|
2179
|
-
let
|
|
2180
|
-
const f = (
|
|
2181
|
-
let
|
|
2182
|
-
const
|
|
2183
|
-
|
|
2183
|
+
const { annotatingEnabled: i, offsetReferenceSelector: s, selectionMode: a } = n, r = (T) => o = T;
|
|
2184
|
+
let d;
|
|
2185
|
+
const f = (T) => d = T, { store: h, selection: u } = e;
|
|
2186
|
+
let g, v, p;
|
|
2187
|
+
const y = (T) => {
|
|
2188
|
+
v !== !1 && (g = it(T.target) ? void 0 : {
|
|
2184
2189
|
annotation: fe(),
|
|
2185
2190
|
selector: [],
|
|
2186
2191
|
creator: o,
|
|
2187
2192
|
created: /* @__PURE__ */ new Date()
|
|
2188
2193
|
});
|
|
2189
|
-
},
|
|
2194
|
+
}, x = Yt((T) => {
|
|
2190
2195
|
const m = document.getSelection();
|
|
2196
|
+
if (!(m != null && m.anchorNode))
|
|
2197
|
+
return;
|
|
2191
2198
|
if (it(m.anchorNode)) {
|
|
2192
|
-
|
|
2199
|
+
g = void 0;
|
|
2193
2200
|
return;
|
|
2194
2201
|
}
|
|
2195
|
-
const
|
|
2196
|
-
if ((
|
|
2202
|
+
const A = T.timeStamp - ((p == null ? void 0 : p.timeStamp) || T.timeStamp);
|
|
2203
|
+
if ((p == null ? void 0 : p.type) === "pointerdown" && (A < 1e3 && !g || m.isCollapsed && A < ie) && y(p || T), !g) return;
|
|
2197
2204
|
if (m.isCollapsed) {
|
|
2198
|
-
h.getAnnotation(
|
|
2205
|
+
h.getAnnotation(g.annotation) && (u.clear(), h.deleteAnnotation(g.annotation));
|
|
2199
2206
|
return;
|
|
2200
2207
|
}
|
|
2201
|
-
const
|
|
2202
|
-
if (Ie(
|
|
2203
|
-
const
|
|
2204
|
-
(
|
|
2208
|
+
const w = m.getRangeAt(0), L = Ye(w, t);
|
|
2209
|
+
if (Ie(L)) return;
|
|
2210
|
+
const M = Me(L.cloneRange());
|
|
2211
|
+
(M.length !== g.selector.length || M.some((N, U) => {
|
|
2205
2212
|
var et;
|
|
2206
|
-
return N.toString() !== ((et =
|
|
2207
|
-
})) && (
|
|
2208
|
-
...
|
|
2209
|
-
selector:
|
|
2213
|
+
return N.toString() !== ((et = g.selector[U]) == null ? void 0 : et.quote);
|
|
2214
|
+
})) && (g = {
|
|
2215
|
+
...g,
|
|
2216
|
+
selector: M.map((N) => Ve(N, t, s)),
|
|
2210
2217
|
updated: /* @__PURE__ */ new Date()
|
|
2211
|
-
}, h.getAnnotation(
|
|
2212
|
-
}),
|
|
2213
|
-
it(
|
|
2214
|
-
}, c = (
|
|
2215
|
-
if (it(
|
|
2218
|
+
}, h.getAnnotation(g.annotation) ? h.updateTarget(g, k.LOCAL) : u.clear());
|
|
2219
|
+
}), l = (T) => {
|
|
2220
|
+
it(T.target) || (p = xt(T), v = p.button === 0);
|
|
2221
|
+
}, c = (T) => {
|
|
2222
|
+
if (it(T.target) || !v) return;
|
|
2216
2223
|
const m = () => {
|
|
2217
|
-
const { x, y:
|
|
2218
|
-
if (
|
|
2219
|
-
const { selected: R } = u, N = new Set(R.map((q) => q.id)), U = Array.isArray(
|
|
2220
|
-
(N.size !== U.length || !U.every((q) => N.has(q))) && u.userSelect(U,
|
|
2224
|
+
const { x: w, y: L } = t.getBoundingClientRect(), M = T.target instanceof Node && t.contains(T.target) && h.getAt(T.clientX - w, T.clientY - L, a === "all", d);
|
|
2225
|
+
if (M) {
|
|
2226
|
+
const { selected: R } = u, N = new Set(R.map((q) => q.id)), U = Array.isArray(M) ? M.map((q) => q.id) : [M.id];
|
|
2227
|
+
(N.size !== U.length || !U.every((q) => N.has(q))) && u.userSelect(U, T);
|
|
2221
2228
|
} else
|
|
2222
2229
|
u.clear();
|
|
2223
|
-
},
|
|
2230
|
+
}, A = T.timeStamp - p.timeStamp;
|
|
2224
2231
|
setTimeout(() => {
|
|
2225
|
-
const
|
|
2226
|
-
|
|
2232
|
+
const w = document.getSelection();
|
|
2233
|
+
w != null && w.isCollapsed && A < ie ? (g = void 0, m()) : g && g.selector.length > 0 && (O(), u.userSelect(g.annotation, xt(T)));
|
|
2227
2234
|
});
|
|
2228
|
-
},
|
|
2235
|
+
}, b = (T) => {
|
|
2229
2236
|
const m = document.getSelection();
|
|
2230
|
-
m != null && m.isCollapsed || ((!
|
|
2231
|
-
},
|
|
2232
|
-
|
|
2233
|
-
},
|
|
2237
|
+
m != null && m.isCollapsed || ((!g || g.selector.length === 0) && x(T), O(), u.userSelect(g.annotation, xt(T)));
|
|
2238
|
+
}, S = (T) => {
|
|
2239
|
+
T.key === "Shift" && g && (document.getSelection().isCollapsed || (O(), u.userSelect(g.annotation, ft(T))));
|
|
2240
|
+
}, E = (T) => {
|
|
2234
2241
|
const m = () => setTimeout(() => {
|
|
2235
|
-
(
|
|
2236
|
-
id:
|
|
2242
|
+
(g == null ? void 0 : g.selector.length) > 0 && (u.clear(), h.addAnnotation({
|
|
2243
|
+
id: g.annotation,
|
|
2237
2244
|
bodies: [],
|
|
2238
|
-
target:
|
|
2239
|
-
}), u.userSelect(
|
|
2245
|
+
target: g
|
|
2246
|
+
}), u.userSelect(g.annotation, ft(T))), document.removeEventListener("selectionchange", m);
|
|
2240
2247
|
}, 100);
|
|
2241
|
-
document.addEventListener("selectionchange", m),
|
|
2248
|
+
document.addEventListener("selectionchange", m), y(T);
|
|
2242
2249
|
};
|
|
2243
|
-
P(mo.join(","), { element: t, keydown: !0, keyup: !1 }, (
|
|
2244
|
-
|
|
2245
|
-
}), P(Ee, { keydown: !0, keyup: !1 }, (
|
|
2246
|
-
|
|
2250
|
+
P(mo.join(","), { element: t, keydown: !0, keyup: !1 }, (T) => {
|
|
2251
|
+
T.repeat || (p = ft(T));
|
|
2252
|
+
}), P(Ee, { keydown: !0, keyup: !1 }, (T) => {
|
|
2253
|
+
p = ft(T), E(T);
|
|
2247
2254
|
});
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2255
|
+
const C = (T) => {
|
|
2256
|
+
T.repeat || T.target !== t && T.target !== document.body || (g = void 0, u.clear());
|
|
2250
2257
|
};
|
|
2251
|
-
P(ve.join(","), { keydown: !0, keyup: !1 },
|
|
2258
|
+
P(ve.join(","), { keydown: !0, keyup: !1 }, C);
|
|
2252
2259
|
const O = () => {
|
|
2253
|
-
const
|
|
2254
|
-
if (!
|
|
2260
|
+
const T = h.getAnnotation(g.annotation);
|
|
2261
|
+
if (!T) {
|
|
2255
2262
|
h.addAnnotation({
|
|
2256
|
-
id:
|
|
2263
|
+
id: g.annotation,
|
|
2257
2264
|
bodies: [],
|
|
2258
|
-
target:
|
|
2265
|
+
target: g
|
|
2259
2266
|
});
|
|
2260
2267
|
return;
|
|
2261
2268
|
}
|
|
2262
|
-
const { target: { updated: m } } =
|
|
2263
|
-
(!m || !
|
|
2269
|
+
const { target: { updated: m } } = T, { updated: A } = g;
|
|
2270
|
+
(!m || !A || m < A) && h.updateTarget(g);
|
|
2264
2271
|
};
|
|
2265
|
-
return t.addEventListener("pointerdown",
|
|
2272
|
+
return t.addEventListener("pointerdown", l), document.addEventListener("pointerup", c), document.addEventListener("contextmenu", b), i && (t.addEventListener("keyup", S), t.addEventListener("selectstart", y), document.addEventListener("selectionchange", x)), {
|
|
2266
2273
|
destroy: () => {
|
|
2267
|
-
t.removeEventListener("pointerdown",
|
|
2274
|
+
t.removeEventListener("pointerdown", l), document.removeEventListener("pointerup", c), document.removeEventListener("contextmenu", b), t.removeEventListener("keyup", S), t.removeEventListener("selectstart", y), document.removeEventListener("selectionchange", x), P.unbind();
|
|
2268
2275
|
},
|
|
2269
2276
|
setFilter: f,
|
|
2270
2277
|
setUser: r
|
|
@@ -2273,85 +2280,86 @@ const ie = 300, ve = ["up", "down", "left", "right"], Ee = Te ? "⌘+a" : "ctrl+
|
|
|
2273
2280
|
...t,
|
|
2274
2281
|
annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
|
|
2275
2282
|
user: t.user || e.user
|
|
2276
|
-
}), se = "SPANS",
|
|
2283
|
+
}), se = "SPANS", vo = (t, e = {}) => {
|
|
2277
2284
|
Le(t), Oe(t);
|
|
2278
2285
|
const n = bo(e, {
|
|
2279
2286
|
annotatingEnabled: !0,
|
|
2280
|
-
user:
|
|
2281
|
-
}), o = eo(t, n.userSelectAction), { selection: i, viewport: s } = o, a = o.store, r =
|
|
2287
|
+
user: Dn()
|
|
2288
|
+
}), o = eo(t, n.userSelectAction), { selection: i, viewport: s } = o, a = o.store, r = Bn(a), d = Rn(o, r, n.adapter);
|
|
2282
2289
|
let f = n.user;
|
|
2283
2290
|
const h = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : se : n.renderer || se, u = h === "SPANS" ? rn(t, o, s) : h === "CSS_HIGHLIGHTS" ? nn(t, o, s) : h === "CANVAS" ? ze(t, o, s) : void 0;
|
|
2284
2291
|
if (!u)
|
|
2285
2292
|
throw `Unknown renderer implementation: ${h}`;
|
|
2286
2293
|
console.debug(`Using ${h} renderer`), n.style && u.setStyle(n.style);
|
|
2287
|
-
const
|
|
2288
|
-
return
|
|
2294
|
+
const g = yo(t, o, n);
|
|
2295
|
+
return g.setUser(f), {
|
|
2289
2296
|
...In(o, r, n.adapter),
|
|
2290
2297
|
destroy: () => {
|
|
2291
|
-
u.destroy(),
|
|
2298
|
+
u.destroy(), g.destroy(), r.destroy();
|
|
2292
2299
|
},
|
|
2293
2300
|
element: t,
|
|
2294
2301
|
getUser: () => f,
|
|
2295
|
-
setFilter: (
|
|
2296
|
-
u.setFilter(
|
|
2302
|
+
setFilter: (C) => {
|
|
2303
|
+
u.setFilter(C), g.setFilter(C);
|
|
2297
2304
|
},
|
|
2298
|
-
setStyle: (
|
|
2299
|
-
setUser: (
|
|
2300
|
-
f =
|
|
2305
|
+
setStyle: (C) => u.setStyle(C),
|
|
2306
|
+
setUser: (C) => {
|
|
2307
|
+
f = C, g.setUser(C);
|
|
2301
2308
|
},
|
|
2302
|
-
setSelected: (
|
|
2303
|
-
|
|
2309
|
+
setSelected: (C) => {
|
|
2310
|
+
C ? i.setSelected(C) : i.clear();
|
|
2304
2311
|
},
|
|
2305
|
-
setPresenceProvider: (
|
|
2306
|
-
|
|
2312
|
+
setPresenceProvider: (C) => {
|
|
2313
|
+
C && (u.setPainter(oo(C, n.presence)), C.on("selectionChange", () => u.redraw()));
|
|
2307
2314
|
},
|
|
2308
|
-
setVisible: (
|
|
2309
|
-
on:
|
|
2310
|
-
off:
|
|
2311
|
-
scrollIntoView:
|
|
2315
|
+
setVisible: (C) => u.setVisible(C),
|
|
2316
|
+
on: d.on,
|
|
2317
|
+
off: d.off,
|
|
2318
|
+
scrollIntoView: De(t, a),
|
|
2312
2319
|
state: o
|
|
2313
2320
|
};
|
|
2314
2321
|
};
|
|
2315
2322
|
export {
|
|
2316
|
-
|
|
2323
|
+
At as DEFAULT_SELECTED_STYLE,
|
|
2317
2324
|
W as DEFAULT_STYLE,
|
|
2318
2325
|
re as NOT_ANNOTATABLE_CLASS,
|
|
2319
2326
|
tt as NOT_ANNOTATABLE_SELECTOR,
|
|
2320
2327
|
k as Origin,
|
|
2321
2328
|
yo as SelectionHandler,
|
|
2322
2329
|
hn as UserSelectAction,
|
|
2323
|
-
|
|
2330
|
+
xo as W3CTextFormat,
|
|
2324
2331
|
Le as cancelSingleClickEvents,
|
|
2325
2332
|
ft as cloneKeyboardEvent,
|
|
2326
|
-
|
|
2327
|
-
|
|
2333
|
+
xt as clonePointerEvent,
|
|
2334
|
+
Ao as createBody,
|
|
2328
2335
|
ze as createCanvasRenderer,
|
|
2329
2336
|
nn as createHighlightsRenderer,
|
|
2330
2337
|
oo as createPresencePainter,
|
|
2331
2338
|
en as createRenderer,
|
|
2332
2339
|
rn as createSpansRenderer,
|
|
2333
|
-
|
|
2340
|
+
vo as createTextAnnotator,
|
|
2334
2341
|
eo as createTextAnnotatorState,
|
|
2335
2342
|
Yt as debounce,
|
|
2336
2343
|
bo as fillDefaults,
|
|
2337
2344
|
Re as getQuoteContext,
|
|
2338
|
-
|
|
2345
|
+
Ut as getRangeAnnotatableContents,
|
|
2339
2346
|
Te as isMac,
|
|
2340
2347
|
it as isNotAnnotatable,
|
|
2341
2348
|
Ce as isRangeAnnotatable,
|
|
2342
2349
|
F as isRevived,
|
|
2343
2350
|
Ie as isWhitespaceOrEmpty,
|
|
2344
2351
|
Ue as mergeClientRects,
|
|
2345
|
-
|
|
2352
|
+
Ke as paint,
|
|
2346
2353
|
jn as parseW3CTextAnnotation,
|
|
2347
2354
|
Oe as programmaticallyFocusable,
|
|
2348
2355
|
Ve as rangeToSelector,
|
|
2349
|
-
|
|
2356
|
+
vt as reviveAnnotation,
|
|
2350
2357
|
ae as reviveSelector,
|
|
2351
|
-
|
|
2352
|
-
|
|
2358
|
+
wt as reviveTarget,
|
|
2359
|
+
De as scrollIntoView,
|
|
2353
2360
|
zn as serializeW3CTextAnnotation,
|
|
2354
|
-
|
|
2361
|
+
Me as splitAnnotatableRanges,
|
|
2362
|
+
wo as toDomRectList,
|
|
2355
2363
|
Ye as trimRangeToContainer,
|
|
2356
2364
|
ke as whitespaceOrEmptyRegex
|
|
2357
2365
|
};
|