@soomo/text-annotator 3.1.0-staging.15 → 3.1.0-staging.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/SelectionHandler.d.ts +2 -1
- package/dist/src/TextAnnotatorOptions.d.ts +1 -0
- package/dist/src/state/TextAnnotationStore.d.ts +3 -1
- package/dist/text-annotator.es.js +1088 -1081
- 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 +4 -4
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
const
|
|
1
|
+
const de = "not-annotatable", et = `.${de}`, st = (t) => {
|
|
2
2
|
var n;
|
|
3
|
-
return !!(t instanceof HTMLElement ? t.closest(
|
|
4
|
-
},
|
|
3
|
+
return !!(t instanceof HTMLElement ? t.closest(et) : (n = t.parentElement) == null ? void 0 : n.closest(et));
|
|
4
|
+
}, Me = (t) => {
|
|
5
5
|
const e = t.commonAncestorContainer;
|
|
6
|
-
return !
|
|
7
|
-
},
|
|
6
|
+
return !st(e);
|
|
7
|
+
}, Be = (t) => t.addEventListener("click", (e) => {
|
|
8
8
|
// Allow clicks within not-annotatable elements
|
|
9
|
-
!e.target.closest(
|
|
10
|
-
}),
|
|
9
|
+
!e.target.closest(et) && !e.target.closest("a") && e.preventDefault();
|
|
10
|
+
}), ke = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Ie = (t) => {
|
|
11
11
|
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
12
|
-
},
|
|
12
|
+
}, Ne = function* (t) {
|
|
13
13
|
const e = document.createNodeIterator(
|
|
14
14
|
t.commonAncestorContainer,
|
|
15
15
|
NodeFilter.SHOW_ELEMENT,
|
|
16
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
16
|
+
(o) => o instanceof HTMLElement && o.classList.contains(de) && !o.parentElement.closest(et) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
17
17
|
);
|
|
18
18
|
let n;
|
|
19
19
|
for (; n = e.nextNode(); )
|
|
20
20
|
n instanceof HTMLElement && (yield n);
|
|
21
|
-
},
|
|
22
|
-
if (!
|
|
21
|
+
}, _e = (t) => {
|
|
22
|
+
if (!Me(t)) return [];
|
|
23
23
|
const e = [];
|
|
24
24
|
let n = null;
|
|
25
|
-
for (const o of
|
|
25
|
+
for (const o of Ne(t)) {
|
|
26
26
|
let i;
|
|
27
27
|
n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
|
|
28
28
|
}
|
|
@@ -31,20 +31,20 @@ const ae = "not-annotatable", Z = `.${ae}`, nt = (t) => {
|
|
|
31
31
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
32
32
|
}
|
|
33
33
|
return e.length > 0 ? e : [t];
|
|
34
|
-
},
|
|
34
|
+
}, Vt = (t) => {
|
|
35
35
|
const e = t.cloneContents();
|
|
36
|
-
return e.querySelectorAll(
|
|
37
|
-
},
|
|
36
|
+
return e.querySelectorAll(et).forEach((n) => n.remove()), e;
|
|
37
|
+
}, Ue = (t, e, n = 10, o) => {
|
|
38
38
|
const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();
|
|
39
39
|
s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
|
|
40
|
-
const r =
|
|
40
|
+
const r = Vt(s).textContent, a = document.createRange();
|
|
41
41
|
a.setStart(t.endContainer, t.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
|
|
42
|
-
const l =
|
|
42
|
+
const l = Vt(a).textContent;
|
|
43
43
|
return {
|
|
44
44
|
prefix: r.substring(r.length - n),
|
|
45
45
|
suffix: l.substring(0, n)
|
|
46
46
|
};
|
|
47
|
-
}, F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed),
|
|
47
|
+
}, F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), De = /^\s*$/, Ve = (t) => De.test(t.toString()), Ye = (t, e) => {
|
|
48
48
|
const n = (s) => Math.round(s * 10) / 10, o = {
|
|
49
49
|
top: n(t.top),
|
|
50
50
|
bottom: n(t.bottom),
|
|
@@ -71,12 +71,12 @@ const ae = "not-annotatable", Z = `.${ae}`, nt = (t) => {
|
|
|
71
71
|
}, Ke = (t, e) => {
|
|
72
72
|
const n = Math.min(t.left, e.left), o = Math.max(t.right, e.right), i = Math.min(t.top, e.top), s = Math.max(t.bottom, e.bottom);
|
|
73
73
|
return new DOMRect(n, i, o - n, s - i);
|
|
74
|
-
},
|
|
74
|
+
}, Xe = (t) => t.reduce((e, n) => {
|
|
75
75
|
if (n.width === 0 || n.height === 0)
|
|
76
76
|
return e;
|
|
77
77
|
let o = [...e], i = !1;
|
|
78
78
|
for (const s of e) {
|
|
79
|
-
const r =
|
|
79
|
+
const r = Ye(n, s);
|
|
80
80
|
if (r === "inline-adjacent") {
|
|
81
81
|
o = o.map((a) => a === s ? Ke(n, s) : a), i = !0;
|
|
82
82
|
break;
|
|
@@ -92,73 +92,73 @@ const ae = "not-annotatable", Z = `.${ae}`, nt = (t) => {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
return i ? o : [...o, n];
|
|
95
|
-
}, []),
|
|
95
|
+
}, []), Mo = (t) => ({
|
|
96
96
|
length: t.length,
|
|
97
97
|
item: (e) => t[e],
|
|
98
98
|
[Symbol.iterator]: function* () {
|
|
99
99
|
for (let e = 0; e < this.length; e++)
|
|
100
100
|
yield this.item(e);
|
|
101
101
|
}
|
|
102
|
-
}),
|
|
102
|
+
}), Pe = (t, e, n) => {
|
|
103
103
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
104
104
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
105
|
-
const s =
|
|
105
|
+
const s = Vt(o).textContent, r = t.toString(), a = s.length || 0, l = a + r.length;
|
|
106
106
|
return n ? { quote: r, start: a, end: l, range: t, offsetReference: i } : { quote: r, start: a, end: l, range: t };
|
|
107
|
-
},
|
|
108
|
-
var
|
|
107
|
+
}, ue = (t, e) => {
|
|
108
|
+
var p, d;
|
|
109
109
|
const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
|
|
110
110
|
e,
|
|
111
111
|
NodeFilter.SHOW_TEXT,
|
|
112
|
-
(
|
|
113
|
-
var
|
|
114
|
-
return (
|
|
112
|
+
(h) => {
|
|
113
|
+
var g;
|
|
114
|
+
return (g = h.parentElement) != null && g.closest(et) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
let r = 0;
|
|
118
118
|
const a = document.createRange();
|
|
119
119
|
let l = s.nextNode();
|
|
120
120
|
l === null && console.error("Could not revive annotation target. Content missing.");
|
|
121
|
-
let
|
|
121
|
+
let f = !i;
|
|
122
122
|
for (; l !== null; ) {
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
if (r +
|
|
123
|
+
if (f || (f = i == null ? void 0 : i.contains(l)), f) {
|
|
124
|
+
const h = ((p = l.textContent) == null ? void 0 : p.length) || 0;
|
|
125
|
+
if (r + h > n) {
|
|
126
126
|
a.setStart(l, n - r);
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
|
-
r +=
|
|
129
|
+
r += h;
|
|
130
130
|
}
|
|
131
131
|
l = s.nextNode();
|
|
132
132
|
}
|
|
133
133
|
for (; l !== null; ) {
|
|
134
|
-
const
|
|
135
|
-
if (r +
|
|
134
|
+
const h = ((d = l.textContent) == null ? void 0 : d.length) || 0;
|
|
135
|
+
if (r + h >= o) {
|
|
136
136
|
a.setEnd(l, o - r);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
|
-
r +=
|
|
139
|
+
r += h, l = s.nextNode();
|
|
140
140
|
}
|
|
141
141
|
return {
|
|
142
142
|
...t,
|
|
143
143
|
range: a
|
|
144
144
|
};
|
|
145
|
-
},
|
|
145
|
+
}, At = (t, e) => F(t.selector) ? t : {
|
|
146
146
|
...t,
|
|
147
|
-
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
148
|
-
},
|
|
147
|
+
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : ue(n, e))
|
|
148
|
+
}, Et = (t, e) => F(t.target.selector) ? t : { ...t, target: At(t.target, e) }, fe = (t, e) => {
|
|
149
149
|
if (t.isEqualNode(e))
|
|
150
150
|
return !0;
|
|
151
151
|
for (let n of t.childNodes)
|
|
152
|
-
if (
|
|
152
|
+
if (fe(n, e))
|
|
153
153
|
return !0;
|
|
154
154
|
return !1;
|
|
155
|
-
}, Pe = (t, e) => {
|
|
156
|
-
const n = t.cloneContents();
|
|
157
|
-
return le(n, e);
|
|
158
155
|
}, $e = (t, e) => {
|
|
156
|
+
const n = t.cloneContents();
|
|
157
|
+
return fe(n, e);
|
|
158
|
+
}, je = (t, e) => {
|
|
159
159
|
const n = t.cloneRange(), o = e.contains(n.startContainer), i = e.contains(n.endContainer);
|
|
160
|
-
return !o && !i &&
|
|
161
|
-
},
|
|
160
|
+
return !o && !i && !$e(n, e) ? (n.collapse(), n) : (o || n.setStart(e, 0), i || n.setEnd(e, e.childNodes.length), n);
|
|
161
|
+
}, St = (t) => ({
|
|
162
162
|
...t,
|
|
163
163
|
type: t.type,
|
|
164
164
|
x: t.x,
|
|
@@ -184,7 +184,7 @@ const ae = "not-annotatable", Z = `.${ae}`, nt = (t) => {
|
|
|
184
184
|
pointerId: t.pointerId,
|
|
185
185
|
pointerType: t.pointerType,
|
|
186
186
|
timeStamp: t.timeStamp
|
|
187
|
-
}),
|
|
187
|
+
}), pt = (t) => ({
|
|
188
188
|
...t,
|
|
189
189
|
type: t.type,
|
|
190
190
|
key: t.key,
|
|
@@ -200,169 +200,169 @@ const ae = "not-annotatable", Z = `.${ae}`, nt = (t) => {
|
|
|
200
200
|
defaultPrevented: t.defaultPrevented,
|
|
201
201
|
detail: t.detail,
|
|
202
202
|
timeStamp: t.timeStamp
|
|
203
|
-
}),
|
|
203
|
+
}), He = (t, e) => {
|
|
204
204
|
const { left: n, top: o, right: i, bottom: s } = t;
|
|
205
205
|
return new DOMRect(n - e.left, o - e.top, i - n, s - o);
|
|
206
|
-
},
|
|
206
|
+
}, Bo = (t, e) => {
|
|
207
207
|
const { left: n, top: o, right: i, bottom: s } = t;
|
|
208
208
|
return new DOMRect(n + e.left, o + e.top, i - n, s - o);
|
|
209
|
-
},
|
|
209
|
+
}, he = (t) => {
|
|
210
210
|
if (t === null)
|
|
211
211
|
return document.scrollingElement;
|
|
212
212
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
213
|
-
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
214
|
-
},
|
|
213
|
+
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : he(t.parentElement);
|
|
214
|
+
}, ze = (t, e) => (n) => {
|
|
215
215
|
const o = typeof n == "string" ? n : n.id, i = (r) => {
|
|
216
|
-
const a = s.getBoundingClientRect(), l = s.clientHeight,
|
|
217
|
-
s.scroll({ top:
|
|
218
|
-
}, s =
|
|
216
|
+
const a = s.getBoundingClientRect(), l = s.clientHeight, f = s.clientWidth, p = r.selector[0].range.getBoundingClientRect(), { width: d, height: h } = e.getAnnotationBounds(o), g = p.top - a.top, b = p.left - a.left, A = s.parentElement ? s.scrollTop : 0, C = s.parentElement ? s.scrollLeft : 0, m = g + A - (l - h) / 2, c = b + C - (f - d) / 2;
|
|
217
|
+
s.scroll({ top: m, left: c, behavior: "smooth" });
|
|
218
|
+
}, s = he(t);
|
|
219
219
|
if (s) {
|
|
220
220
|
const r = e.getAnnotation(o), { range: a } = r.target.selector[0];
|
|
221
221
|
if (a && !a.collapsed)
|
|
222
222
|
return i(r.target), !0;
|
|
223
223
|
{
|
|
224
|
-
const l =
|
|
225
|
-
if (
|
|
224
|
+
const l = At(r.target, t), { range: f } = l.selector[0];
|
|
225
|
+
if (f && !f.collapsed)
|
|
226
226
|
return i(l), !0;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
return !1;
|
|
230
|
-
},
|
|
230
|
+
}, q = {
|
|
231
231
|
fill: "rgb(0, 128, 255)",
|
|
232
232
|
fillOpacity: 0.18
|
|
233
|
-
},
|
|
233
|
+
}, xt = {
|
|
234
234
|
fill: "rgb(0, 128, 255)",
|
|
235
235
|
fillOpacity: 0.45
|
|
236
|
-
},
|
|
236
|
+
}, Fe = (t, e, n, o, i) => {
|
|
237
237
|
var r, a;
|
|
238
|
-
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ?
|
|
238
|
+
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((r = t.state) != null && r.selected ? xt : q) : n : (a = t.state) != null && a.selected ? xt : q;
|
|
239
239
|
return o && o.paint(t, e) || s;
|
|
240
240
|
};
|
|
241
|
-
function
|
|
241
|
+
function We(t) {
|
|
242
242
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
243
243
|
}
|
|
244
|
-
var
|
|
245
|
-
function
|
|
244
|
+
var Xt = { exports: {} };
|
|
245
|
+
function pe(t, e = 100, n = {}) {
|
|
246
246
|
if (typeof t != "function")
|
|
247
247
|
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof t}\`.`);
|
|
248
248
|
if (e < 0)
|
|
249
249
|
throw new RangeError("`wait` must not be negative.");
|
|
250
250
|
const { immediate: o } = typeof n == "boolean" ? { immediate: n } : n;
|
|
251
251
|
let i, s, r, a, l;
|
|
252
|
-
function c() {
|
|
253
|
-
const m = i, p = s;
|
|
254
|
-
return i = void 0, s = void 0, l = t.apply(m, p), l;
|
|
255
|
-
}
|
|
256
252
|
function f() {
|
|
257
|
-
const
|
|
258
|
-
|
|
253
|
+
const h = i, g = s;
|
|
254
|
+
return i = void 0, s = void 0, l = t.apply(h, g), l;
|
|
255
|
+
}
|
|
256
|
+
function p() {
|
|
257
|
+
const h = Date.now() - a;
|
|
258
|
+
h < e && h >= 0 ? r = setTimeout(p, e - h) : (r = void 0, o || (l = f()));
|
|
259
259
|
}
|
|
260
|
-
const d = function(...
|
|
260
|
+
const d = function(...h) {
|
|
261
261
|
if (i && this !== i && Object.getPrototypeOf(this) === Object.getPrototypeOf(i))
|
|
262
262
|
throw new Error("Debounced method called with different contexts of the same prototype.");
|
|
263
|
-
i = this, s =
|
|
264
|
-
const
|
|
265
|
-
return r || (r = setTimeout(
|
|
263
|
+
i = this, s = h, a = Date.now();
|
|
264
|
+
const g = o && !r;
|
|
265
|
+
return r || (r = setTimeout(p, e)), g && (l = f()), l;
|
|
266
266
|
};
|
|
267
267
|
return d.clear = () => {
|
|
268
268
|
r && (clearTimeout(r), r = void 0);
|
|
269
269
|
}, d.flush = () => {
|
|
270
270
|
r && d.trigger();
|
|
271
271
|
}, d.trigger = () => {
|
|
272
|
-
l =
|
|
272
|
+
l = f(), d.clear();
|
|
273
273
|
}, d;
|
|
274
274
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
var
|
|
278
|
-
const
|
|
275
|
+
Xt.exports.debounce = pe;
|
|
276
|
+
Xt.exports = pe;
|
|
277
|
+
var qe = Xt.exports;
|
|
278
|
+
const Pt = /* @__PURE__ */ We(qe), Ge = (t) => {
|
|
279
279
|
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, r = -e, a = o - n, l = i - e;
|
|
280
280
|
return { top: e, left: n, minX: s, minY: r, maxX: a, maxY: l };
|
|
281
|
-
},
|
|
281
|
+
}, Qe = (t) => {
|
|
282
282
|
let e = /* @__PURE__ */ new Set();
|
|
283
283
|
return (o) => {
|
|
284
284
|
const i = o.map((s) => s.id);
|
|
285
285
|
(e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);
|
|
286
286
|
};
|
|
287
|
-
},
|
|
287
|
+
}, $t = (t, e, n, o) => {
|
|
288
288
|
const { store: i, selection: s, hover: r } = e;
|
|
289
|
-
let a, l,
|
|
290
|
-
const
|
|
291
|
-
const { x:
|
|
292
|
-
|
|
289
|
+
let a, l, f;
|
|
290
|
+
const p = Qe(n), d = (T) => {
|
|
291
|
+
const { x: M, y: w } = t.getBoundingClientRect(), v = i.getAt(T.clientX - M, T.clientY - w, !1, l);
|
|
292
|
+
v ? r.current !== v.id && (t.classList.add("hovered"), r.set(v.id)) : r.current && (t.classList.remove("hovered"), r.set(null));
|
|
293
293
|
};
|
|
294
294
|
t.addEventListener("pointermove", d);
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
const
|
|
299
|
-
return { annotation:
|
|
295
|
+
const h = (T = !1) => {
|
|
296
|
+
f && f.clear();
|
|
297
|
+
const M = Ge(t), { minX: w, minY: v, maxX: u, maxY: E } = M, B = l ? i.getIntersecting(w, v, u, E).filter(({ annotation: _ }) => l(_)) : i.getIntersecting(w, v, u, E), R = s.selected.map(({ id: _ }) => _), U = B.map(({ annotation: _, rects: ht }) => {
|
|
298
|
+
const W = R.includes(_.id), G = _.id === r.current;
|
|
299
|
+
return { annotation: _, rects: ht, state: { selected: W, hover: G } };
|
|
300
300
|
});
|
|
301
|
-
o.redraw(
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
}, v = (T) => {
|
|
305
|
-
a = T, m();
|
|
301
|
+
o.redraw(U, M, a, f, T), setTimeout(() => p(B.map(({ annotation: _ }) => _)), 1);
|
|
302
|
+
}, g = (T) => {
|
|
303
|
+
f = T, h();
|
|
306
304
|
}, b = (T) => {
|
|
307
|
-
|
|
308
|
-
},
|
|
305
|
+
a = T, h();
|
|
306
|
+
}, A = (T) => {
|
|
307
|
+
l = T, h(!1);
|
|
308
|
+
}, C = () => h();
|
|
309
309
|
i.observe(C);
|
|
310
|
-
const
|
|
311
|
-
document.addEventListener("scroll",
|
|
312
|
-
const y =
|
|
313
|
-
i.recalculatePositions(),
|
|
310
|
+
const m = s.subscribe(() => h()), c = () => h(!0);
|
|
311
|
+
document.addEventListener("scroll", c, { capture: !0, passive: !0 });
|
|
312
|
+
const y = Pt(() => {
|
|
313
|
+
i.recalculatePositions(), f == null || f.reset(), h();
|
|
314
314
|
}, 10);
|
|
315
315
|
window.addEventListener("resize", y);
|
|
316
316
|
const S = new ResizeObserver(y);
|
|
317
317
|
S.observe(t);
|
|
318
|
-
const
|
|
319
|
-
T.every((
|
|
318
|
+
const x = { attributes: !0, childList: !0, subtree: !0 }, L = new MutationObserver((T) => {
|
|
319
|
+
T.every((w) => w.target === t || t.contains(w.target)) || h(!0);
|
|
320
320
|
});
|
|
321
|
-
return
|
|
321
|
+
return L.observe(document.body, x), {
|
|
322
322
|
destroy: () => {
|
|
323
|
-
t.removeEventListener("pointermove", d), o.destroy(), i.unobserve(C),
|
|
323
|
+
t.removeEventListener("pointermove", d), o.destroy(), i.unobserve(C), m(), document.removeEventListener("scroll", c), y.clear(), window.removeEventListener("resize", y), S.disconnect(), L.disconnect();
|
|
324
324
|
},
|
|
325
|
-
redraw:
|
|
326
|
-
setStyle:
|
|
327
|
-
setFilter:
|
|
328
|
-
setPainter:
|
|
325
|
+
redraw: h,
|
|
326
|
+
setStyle: b,
|
|
327
|
+
setFilter: A,
|
|
328
|
+
setPainter: g,
|
|
329
329
|
setVisible: o.setVisible
|
|
330
330
|
};
|
|
331
|
-
},
|
|
331
|
+
}, Je = () => {
|
|
332
332
|
const t = document.createElement("canvas");
|
|
333
333
|
return t.width = window.innerWidth, t.height = window.innerHeight, t.className = "r6o-canvas-highlight-layer bg", t;
|
|
334
|
-
},
|
|
334
|
+
}, Ze = (t, e) => {
|
|
335
335
|
t.width = window.innerWidth, t.height = window.innerHeight;
|
|
336
|
-
},
|
|
336
|
+
}, tn = (t) => {
|
|
337
337
|
t.classList.add("r6o-annotatable");
|
|
338
|
-
const e =
|
|
338
|
+
const e = Je(), n = e.getContext("2d");
|
|
339
339
|
document.body.appendChild(e);
|
|
340
|
-
const o = (a, l,
|
|
341
|
-
const { width: d, height:
|
|
342
|
-
n.clearRect(-0.5, -0.5, d + 1,
|
|
343
|
-
const { top:
|
|
344
|
-
[...a].sort((C,
|
|
345
|
-
const { annotation: { target: { created:
|
|
346
|
-
return
|
|
340
|
+
const o = (a, l, f, p) => requestAnimationFrame(() => {
|
|
341
|
+
const { width: d, height: h } = e;
|
|
342
|
+
n.clearRect(-0.5, -0.5, d + 1, h + 1), p && p.clear();
|
|
343
|
+
const { top: g, left: b } = l;
|
|
344
|
+
[...a].sort((C, m) => {
|
|
345
|
+
const { annotation: { target: { created: c } } } = C, { annotation: { target: { created: y } } } = m;
|
|
346
|
+
return c.getTime() - y.getTime();
|
|
347
347
|
}).forEach((C) => {
|
|
348
348
|
var S;
|
|
349
|
-
const
|
|
350
|
-
x:
|
|
351
|
-
y:
|
|
352
|
-
width:
|
|
349
|
+
const m = f ? typeof f == "function" ? f(C.annotation, C.state) : f : (S = C.state) != null && S.selected ? xt : q, c = p && p.paint(C, l) || m, y = C.rects.map(({ x, y: L, width: O, height: T }) => ({
|
|
350
|
+
x: x + b,
|
|
351
|
+
y: L + g,
|
|
352
|
+
width: O,
|
|
353
353
|
height: T
|
|
354
354
|
}));
|
|
355
|
-
if (n.fillStyle =
|
|
356
|
-
({ x
|
|
357
|
-
),
|
|
358
|
-
n.globalAlpha = 1, n.strokeStyle =
|
|
359
|
-
const
|
|
360
|
-
y.forEach(({ x:
|
|
361
|
-
n.beginPath(), n.moveTo(
|
|
355
|
+
if (n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1, y.forEach(
|
|
356
|
+
({ x, y: L, width: O, height: T }) => n.fillRect(x, L, O, T)
|
|
357
|
+
), c.underlineColor) {
|
|
358
|
+
n.globalAlpha = 1, n.strokeStyle = c.underlineColor, n.lineWidth = c.underlineThickness ?? 1;
|
|
359
|
+
const x = c.underlineOffset ?? 0;
|
|
360
|
+
y.forEach(({ x: L, y: O, width: T, height: M }) => {
|
|
361
|
+
n.beginPath(), n.moveTo(L, O + M + x), n.lineTo(L + T, O + M + x), n.stroke();
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
|
-
}), i =
|
|
365
|
+
}), i = Pt(() => Ze(e), 10);
|
|
366
366
|
return window.addEventListener("resize", i), {
|
|
367
367
|
destroy: () => {
|
|
368
368
|
e.remove(), i.clear(), window.removeEventListener("resize", i);
|
|
@@ -372,144 +372,144 @@ const Kt = /* @__PURE__ */ Fe(We), qe = (t) => {
|
|
|
372
372
|
},
|
|
373
373
|
redraw: o
|
|
374
374
|
};
|
|
375
|
-
},
|
|
376
|
-
var
|
|
375
|
+
}, en = (t, e, n) => $t(t, e, n, tn(t));
|
|
376
|
+
var nn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, H = function(t) {
|
|
377
377
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
378
|
-
},
|
|
378
|
+
}, D = function(t, e, n) {
|
|
379
379
|
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
|
|
380
380
|
}, X = function(t, e, n) {
|
|
381
381
|
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
|
|
382
|
-
},
|
|
382
|
+
}, ge = function(t) {
|
|
383
383
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
384
|
-
},
|
|
384
|
+
}, zt = function(t) {
|
|
385
385
|
return { r: X(t.r, 0, 255), g: X(t.g, 0, 255), b: X(t.b, 0, 255), a: X(t.a) };
|
|
386
|
-
},
|
|
387
|
-
return { r:
|
|
388
|
-
},
|
|
386
|
+
}, Ct = function(t) {
|
|
387
|
+
return { r: D(t.r), g: D(t.g), b: D(t.b), a: D(t.a, 3) };
|
|
388
|
+
}, on = /^#([0-9a-f]{3,8})$/i, gt = function(t) {
|
|
389
389
|
var e = t.toString(16);
|
|
390
390
|
return e.length < 2 ? "0" + e : e;
|
|
391
|
-
},
|
|
391
|
+
}, me = function(t) {
|
|
392
392
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = Math.max(e, n, o), r = s - Math.min(e, n, o), a = r ? s === e ? (n - o) / r : s === n ? 2 + (o - e) / r : 4 + (e - n) / r : 0;
|
|
393
393
|
return { h: 60 * (a < 0 ? a + 6 : a), s: s ? r / s * 100 : 0, v: s / 255 * 100, a: i };
|
|
394
|
-
},
|
|
394
|
+
}, ye = function(t) {
|
|
395
395
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
396
396
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
397
|
-
var s = Math.floor(e), r = o * (1 - n), a = o * (1 - (e - s) * n), l = o * (1 - (1 - e + s) * n),
|
|
398
|
-
return { r: 255 * [o, a, r, r, l, o][
|
|
399
|
-
},
|
|
400
|
-
return { h:
|
|
401
|
-
},
|
|
402
|
-
return { h:
|
|
403
|
-
},
|
|
404
|
-
return
|
|
397
|
+
var s = Math.floor(e), r = o * (1 - n), a = o * (1 - (e - s) * n), l = o * (1 - (1 - e + s) * n), f = s % 6;
|
|
398
|
+
return { r: 255 * [o, a, r, r, l, o][f], g: 255 * [l, o, o, a, r, r][f], b: 255 * [r, r, l, o, o, a][f], a: i };
|
|
399
|
+
}, Ft = function(t) {
|
|
400
|
+
return { h: ge(t.h), s: X(t.s, 0, 100), l: X(t.l, 0, 100), a: X(t.a) };
|
|
401
|
+
}, Wt = function(t) {
|
|
402
|
+
return { h: D(t.h), s: D(t.s), l: D(t.l), a: D(t.a, 3) };
|
|
403
|
+
}, qt = function(t) {
|
|
404
|
+
return ye((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
|
|
405
405
|
var e, n, o;
|
|
406
|
-
},
|
|
407
|
-
return { h: (e =
|
|
406
|
+
}, ct = function(t) {
|
|
407
|
+
return { h: (e = me(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
|
|
408
408
|
var e, n, o, i;
|
|
409
|
-
},
|
|
410
|
-
var e =
|
|
411
|
-
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ?
|
|
409
|
+
}, sn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, rn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, an = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, cn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Gt = { string: [[function(t) {
|
|
410
|
+
var e = on.exec(t);
|
|
411
|
+
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? D(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? D(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
412
412
|
}, "hex"], [function(t) {
|
|
413
|
-
var e =
|
|
414
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null :
|
|
413
|
+
var e = an.exec(t) || cn.exec(t);
|
|
414
|
+
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : zt({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
|
|
415
415
|
}, "rgb"], [function(t) {
|
|
416
|
-
var e =
|
|
416
|
+
var e = sn.exec(t) || rn.exec(t);
|
|
417
417
|
if (!e) return null;
|
|
418
|
-
var n, o, i =
|
|
419
|
-
return
|
|
418
|
+
var n, o, i = Ft({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (nn[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
|
|
419
|
+
return qt(i);
|
|
420
420
|
}, "hsl"]], object: [[function(t) {
|
|
421
421
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;
|
|
422
|
-
return H(e) && H(n) && H(o) ?
|
|
422
|
+
return H(e) && H(n) && H(o) ? zt({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;
|
|
423
423
|
}, "rgb"], [function(t) {
|
|
424
424
|
var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;
|
|
425
425
|
if (!H(e) || !H(n) || !H(o)) return null;
|
|
426
|
-
var r =
|
|
427
|
-
return
|
|
426
|
+
var r = Ft({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });
|
|
427
|
+
return qt(r);
|
|
428
428
|
}, "hsl"], [function(t) {
|
|
429
429
|
var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;
|
|
430
430
|
if (!H(e) || !H(n) || !H(o)) return null;
|
|
431
431
|
var r = function(a) {
|
|
432
|
-
return { h:
|
|
432
|
+
return { h: ge(a.h), s: X(a.s, 0, 100), v: X(a.v, 0, 100), a: X(a.a) };
|
|
433
433
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });
|
|
434
|
-
return
|
|
435
|
-
}, "hsv"]] },
|
|
434
|
+
return ye(r);
|
|
435
|
+
}, "hsv"]] }, Qt = function(t, e) {
|
|
436
436
|
for (var n = 0; n < e.length; n++) {
|
|
437
437
|
var o = e[n][0](t);
|
|
438
438
|
if (o) return [o, e[n][1]];
|
|
439
439
|
}
|
|
440
440
|
return [null, void 0];
|
|
441
|
-
},
|
|
442
|
-
return typeof t == "string" ?
|
|
443
|
-
},
|
|
444
|
-
var n =
|
|
441
|
+
}, ln = function(t) {
|
|
442
|
+
return typeof t == "string" ? Qt(t.trim(), Gt.string) : typeof t == "object" && t !== null ? Qt(t, Gt.object) : [null, void 0];
|
|
443
|
+
}, Lt = function(t, e) {
|
|
444
|
+
var n = ct(t);
|
|
445
445
|
return { h: n.h, s: X(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
446
|
-
},
|
|
446
|
+
}, Tt = function(t) {
|
|
447
447
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
448
|
-
},
|
|
449
|
-
var n =
|
|
448
|
+
}, Jt = function(t, e) {
|
|
449
|
+
var n = ct(t);
|
|
450
450
|
return { h: n.h, s: n.s, l: X(n.l + 100 * e, 0, 100), a: n.a };
|
|
451
|
-
},
|
|
451
|
+
}, Zt = function() {
|
|
452
452
|
function t(e) {
|
|
453
|
-
this.parsed =
|
|
453
|
+
this.parsed = ln(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
454
454
|
}
|
|
455
455
|
return t.prototype.isValid = function() {
|
|
456
456
|
return this.parsed !== null;
|
|
457
457
|
}, t.prototype.brightness = function() {
|
|
458
|
-
return
|
|
458
|
+
return D(Tt(this.rgba), 2);
|
|
459
459
|
}, t.prototype.isDark = function() {
|
|
460
|
-
return
|
|
460
|
+
return Tt(this.rgba) < 0.5;
|
|
461
461
|
}, t.prototype.isLight = function() {
|
|
462
|
-
return
|
|
462
|
+
return Tt(this.rgba) >= 0.5;
|
|
463
463
|
}, t.prototype.toHex = function() {
|
|
464
|
-
return e =
|
|
464
|
+
return e = Ct(this.rgba), n = e.r, o = e.g, i = e.b, r = (s = e.a) < 1 ? gt(D(255 * s)) : "", "#" + gt(n) + gt(o) + gt(i) + r;
|
|
465
465
|
var e, n, o, i, s, r;
|
|
466
466
|
}, t.prototype.toRgb = function() {
|
|
467
|
-
return
|
|
467
|
+
return Ct(this.rgba);
|
|
468
468
|
}, t.prototype.toRgbString = function() {
|
|
469
|
-
return e =
|
|
469
|
+
return e = Ct(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + s + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
470
470
|
var e, n, o, i, s;
|
|
471
471
|
}, t.prototype.toHsl = function() {
|
|
472
|
-
return
|
|
472
|
+
return Wt(ct(this.rgba));
|
|
473
473
|
}, t.prototype.toHslString = function() {
|
|
474
|
-
return e =
|
|
474
|
+
return e = Wt(ct(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + s + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
|
|
475
475
|
var e, n, o, i, s;
|
|
476
476
|
}, t.prototype.toHsv = function() {
|
|
477
|
-
return e =
|
|
477
|
+
return e = me(this.rgba), { h: D(e.h), s: D(e.s), v: D(e.v), a: D(e.a, 3) };
|
|
478
478
|
var e;
|
|
479
479
|
}, t.prototype.invert = function() {
|
|
480
480
|
return $({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
481
481
|
var e;
|
|
482
482
|
}, t.prototype.saturate = function(e) {
|
|
483
|
-
return e === void 0 && (e = 0.1), $(
|
|
483
|
+
return e === void 0 && (e = 0.1), $(Lt(this.rgba, e));
|
|
484
484
|
}, t.prototype.desaturate = function(e) {
|
|
485
|
-
return e === void 0 && (e = 0.1), $(
|
|
485
|
+
return e === void 0 && (e = 0.1), $(Lt(this.rgba, -e));
|
|
486
486
|
}, t.prototype.grayscale = function() {
|
|
487
|
-
return $(
|
|
487
|
+
return $(Lt(this.rgba, -1));
|
|
488
488
|
}, t.prototype.lighten = function(e) {
|
|
489
|
-
return e === void 0 && (e = 0.1), $(
|
|
489
|
+
return e === void 0 && (e = 0.1), $(Jt(this.rgba, e));
|
|
490
490
|
}, t.prototype.darken = function(e) {
|
|
491
|
-
return e === void 0 && (e = 0.1), $(
|
|
491
|
+
return e === void 0 && (e = 0.1), $(Jt(this.rgba, -e));
|
|
492
492
|
}, t.prototype.rotate = function(e) {
|
|
493
493
|
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
494
494
|
}, t.prototype.alpha = function(e) {
|
|
495
|
-
return typeof e == "number" ? $({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) :
|
|
495
|
+
return typeof e == "number" ? $({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : D(this.rgba.a, 3);
|
|
496
496
|
var n;
|
|
497
497
|
}, t.prototype.hue = function(e) {
|
|
498
|
-
var n =
|
|
499
|
-
return typeof e == "number" ? $({ h: e, s: n.s, l: n.l, a: n.a }) :
|
|
498
|
+
var n = ct(this.rgba);
|
|
499
|
+
return typeof e == "number" ? $({ h: e, s: n.s, l: n.l, a: n.a }) : D(n.h);
|
|
500
500
|
}, t.prototype.isEqual = function(e) {
|
|
501
501
|
return this.toHex() === $(e).toHex();
|
|
502
502
|
}, t;
|
|
503
503
|
}(), $ = function(t) {
|
|
504
|
-
return t instanceof
|
|
504
|
+
return t instanceof Zt ? t : new Zt(t);
|
|
505
505
|
};
|
|
506
|
-
const
|
|
507
|
-
`background-color:${$((t == null ? void 0 : t.fill) ||
|
|
506
|
+
const dn = (t) => [
|
|
507
|
+
`background-color:${$((t == null ? void 0 : t.fill) || q.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? q.fillOpacity : t.fillOpacity).toHex()}`,
|
|
508
508
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
509
509
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
510
510
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
511
511
|
t != null && t.underlineThickness ? `text-decoration-thickness:${t.underlineThickness}px` : void 0
|
|
512
|
-
].filter(Boolean).join(";"),
|
|
512
|
+
].filter(Boolean).join(";"), un = () => {
|
|
513
513
|
const t = document.createElement("style");
|
|
514
514
|
document.getElementsByTagName("head")[0].appendChild(t);
|
|
515
515
|
let e = /* @__PURE__ */ new Set();
|
|
@@ -522,23 +522,23 @@ const ln = (t) => [
|
|
|
522
522
|
},
|
|
523
523
|
redraw: (s, r, a, l) => {
|
|
524
524
|
l && l.clear();
|
|
525
|
-
const
|
|
526
|
-
Array.from(e).filter((d) => !
|
|
527
|
-
const
|
|
528
|
-
var
|
|
529
|
-
const
|
|
530
|
-
return `::highlight(_${d.annotation.id}) { ${
|
|
525
|
+
const f = new Set(s.map((d) => d.annotation.id));
|
|
526
|
+
Array.from(e).filter((d) => !f.has(d));
|
|
527
|
+
const p = s.map((d) => {
|
|
528
|
+
var b;
|
|
529
|
+
const h = a ? typeof a == "function" ? a(d.annotation, d.state) : a : (b = d.state) != null && b.selected ? xt : q, g = l && l.paint(d, r) || h;
|
|
530
|
+
return `::highlight(_${d.annotation.id}) { ${dn(g)} }`;
|
|
531
531
|
});
|
|
532
|
-
t.innerHTML =
|
|
532
|
+
t.innerHTML = p.join(`
|
|
533
533
|
`), CSS.highlights.clear(), s.forEach(({ annotation: d }) => {
|
|
534
|
-
const
|
|
535
|
-
CSS.highlights.set(`_${d.id}`,
|
|
536
|
-
}), e =
|
|
534
|
+
const h = d.target.selector.map((b) => b.range), g = new Highlight(...h);
|
|
535
|
+
CSS.highlights.set(`_${d.id}`, g);
|
|
536
|
+
}), e = f;
|
|
537
537
|
}
|
|
538
538
|
};
|
|
539
|
-
},
|
|
540
|
-
var
|
|
541
|
-
function
|
|
539
|
+
}, fn = (t, e, n) => $t(t, e, n, un());
|
|
540
|
+
var te = Object.prototype.hasOwnProperty;
|
|
541
|
+
function Yt(t, e) {
|
|
542
542
|
var n, o;
|
|
543
543
|
if (t === e) return !0;
|
|
544
544
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -546,22 +546,22 @@ function Ut(t, e) {
|
|
|
546
546
|
if (n === RegExp) return t.toString() === e.toString();
|
|
547
547
|
if (n === Array) {
|
|
548
548
|
if ((o = t.length) === e.length)
|
|
549
|
-
for (; o-- &&
|
|
549
|
+
for (; o-- && Yt(t[o], e[o]); ) ;
|
|
550
550
|
return o === -1;
|
|
551
551
|
}
|
|
552
552
|
if (!n || typeof t == "object") {
|
|
553
553
|
o = 0;
|
|
554
554
|
for (n in t)
|
|
555
|
-
if (
|
|
555
|
+
if (te.call(t, n) && ++o && !te.call(e, n) || !(n in e) || !Yt(t[n], e[n])) return !1;
|
|
556
556
|
return Object.keys(e).length === o;
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
return t !== t && e !== e;
|
|
560
560
|
}
|
|
561
|
-
const
|
|
561
|
+
const hn = (t, e) => {
|
|
562
562
|
const n = (s, r) => s.x <= r.x + r.width && s.x + s.width >= r.x && s.y <= r.y + r.height && s.y + s.height >= r.y, o = (s) => s.rects.reduce((r, a) => r + a.width, 0), i = e.filter(({ rects: s }) => s.some((r) => n(t, r)));
|
|
563
563
|
return i.sort((s, r) => o(r) - o(s)), i.findIndex((s) => s.rects.includes(t));
|
|
564
|
-
},
|
|
564
|
+
}, pn = (t) => {
|
|
565
565
|
t.classList.add("r6o-annotatable");
|
|
566
566
|
const e = document.createElement("div");
|
|
567
567
|
e.className = "r6o-span-highlight-layer", t.insertBefore(e, t.firstChild);
|
|
@@ -570,18 +570,18 @@ const fn = (t, e) => {
|
|
|
570
570
|
destroy: () => {
|
|
571
571
|
e.remove();
|
|
572
572
|
},
|
|
573
|
-
redraw: (r, a, l,
|
|
574
|
-
const
|
|
575
|
-
if (!
|
|
576
|
-
|
|
577
|
-
const { annotation: { target: { created: C } } } =
|
|
578
|
-
return C &&
|
|
579
|
-
}).forEach((
|
|
580
|
-
|
|
581
|
-
const C =
|
|
582
|
-
if (
|
|
583
|
-
const
|
|
584
|
-
|
|
573
|
+
redraw: (r, a, l, f, p) => {
|
|
574
|
+
const h = !(Yt(n, r) && p);
|
|
575
|
+
if (!f && !h) return;
|
|
576
|
+
h && (e.innerHTML = ""), [...r].sort((b, A) => {
|
|
577
|
+
const { annotation: { target: { created: C } } } = b, { annotation: { target: { created: m } } } = A;
|
|
578
|
+
return C && m ? C.getTime() - m.getTime() : 0;
|
|
579
|
+
}).forEach((b) => {
|
|
580
|
+
b.rects.map((A) => {
|
|
581
|
+
const C = hn(A, r), m = Fe(b, a, l, f, C);
|
|
582
|
+
if (h) {
|
|
583
|
+
const c = document.createElement("span");
|
|
584
|
+
c.className = "r6o-annotation", c.dataset.annotation = b.annotation.id, c.style.left = `${A.x}px`, c.style.top = `${A.y}px`, c.style.width = `${A.width}px`, c.style.height = `${A.height}px`, c.style.backgroundColor = $((m == null ? void 0 : m.fill) || q.fill).alpha((m == null ? void 0 : m.fillOpacity) === void 0 ? q.fillOpacity : m.fillOpacity).toHex(), m.underlineStyle && (c.style.borderStyle = m.underlineStyle), m.underlineColor && (c.style.borderColor = m.underlineColor), m.underlineThickness && (c.style.borderBottomWidth = `${m.underlineThickness}px`), m.underlineOffset && (c.style.paddingBottom = `${m.underlineOffset}px`), e.appendChild(c);
|
|
585
585
|
}
|
|
586
586
|
});
|
|
587
587
|
}), n = r;
|
|
@@ -590,32 +590,32 @@ const fn = (t, e) => {
|
|
|
590
590
|
r ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
591
591
|
}
|
|
592
592
|
};
|
|
593
|
-
},
|
|
593
|
+
}, gn = (t, e, n) => $t(t, e, n, pn(t)), V = [];
|
|
594
594
|
for (let t = 0; t < 256; ++t)
|
|
595
|
-
|
|
596
|
-
function
|
|
597
|
-
return (
|
|
595
|
+
V.push((t + 256).toString(16).slice(1));
|
|
596
|
+
function mn(t, e = 0) {
|
|
597
|
+
return (V[t[e + 0]] + V[t[e + 1]] + V[t[e + 2]] + V[t[e + 3]] + "-" + V[t[e + 4]] + V[t[e + 5]] + "-" + V[t[e + 6]] + V[t[e + 7]] + "-" + V[t[e + 8]] + V[t[e + 9]] + "-" + V[t[e + 10]] + V[t[e + 11]] + V[t[e + 12]] + V[t[e + 13]] + V[t[e + 14]] + V[t[e + 15]]).toLowerCase();
|
|
598
598
|
}
|
|
599
|
-
let
|
|
600
|
-
const
|
|
601
|
-
function
|
|
602
|
-
if (!
|
|
599
|
+
let Ot;
|
|
600
|
+
const yn = new Uint8Array(16);
|
|
601
|
+
function bn() {
|
|
602
|
+
if (!Ot) {
|
|
603
603
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
604
604
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
605
|
-
|
|
605
|
+
Ot = crypto.getRandomValues.bind(crypto);
|
|
606
606
|
}
|
|
607
|
-
return
|
|
607
|
+
return Ot(yn);
|
|
608
608
|
}
|
|
609
|
-
const
|
|
610
|
-
function
|
|
611
|
-
if (
|
|
612
|
-
return
|
|
609
|
+
const wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ee = { randomUUID: wn };
|
|
610
|
+
function be(t, e, n) {
|
|
611
|
+
if (ee.randomUUID && !e && !t)
|
|
612
|
+
return ee.randomUUID();
|
|
613
613
|
t = t || {};
|
|
614
|
-
const o = t.random || (t.rng ||
|
|
615
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
614
|
+
const o = t.random || (t.rng || bn)();
|
|
615
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, mn(o);
|
|
616
616
|
}
|
|
617
|
-
var
|
|
618
|
-
function
|
|
617
|
+
var ne = Object.prototype.hasOwnProperty;
|
|
618
|
+
function Q(t, e) {
|
|
619
619
|
var n, o;
|
|
620
620
|
if (t === e) return !0;
|
|
621
621
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -623,52 +623,52 @@ function q(t, e) {
|
|
|
623
623
|
if (n === RegExp) return t.toString() === e.toString();
|
|
624
624
|
if (n === Array) {
|
|
625
625
|
if ((o = t.length) === e.length)
|
|
626
|
-
for (; o-- &&
|
|
626
|
+
for (; o-- && Q(t[o], e[o]); ) ;
|
|
627
627
|
return o === -1;
|
|
628
628
|
}
|
|
629
629
|
if (!n || typeof t == "object") {
|
|
630
630
|
o = 0;
|
|
631
631
|
for (n in t)
|
|
632
|
-
if (
|
|
632
|
+
if (ne.call(t, n) && ++o && !ne.call(e, n) || !(n in e) || !Q(t[n], e[n])) return !1;
|
|
633
633
|
return Object.keys(e).length === o;
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
return t !== t && e !== e;
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function Rt() {
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function An(t, e) {
|
|
641
641
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
642
642
|
}
|
|
643
|
-
const
|
|
644
|
-
function
|
|
643
|
+
const J = [];
|
|
644
|
+
function jt(t, e = Rt) {
|
|
645
645
|
let n;
|
|
646
646
|
const o = /* @__PURE__ */ new Set();
|
|
647
647
|
function i(a) {
|
|
648
|
-
if (
|
|
649
|
-
const l = !
|
|
650
|
-
for (const
|
|
651
|
-
|
|
648
|
+
if (An(t, a) && (t = a, n)) {
|
|
649
|
+
const l = !J.length;
|
|
650
|
+
for (const f of o)
|
|
651
|
+
f[1](), J.push(f, t);
|
|
652
652
|
if (l) {
|
|
653
|
-
for (let
|
|
654
|
-
|
|
655
|
-
|
|
653
|
+
for (let f = 0; f < J.length; f += 2)
|
|
654
|
+
J[f][0](J[f + 1]);
|
|
655
|
+
J.length = 0;
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
659
|
function s(a) {
|
|
660
660
|
i(a(t));
|
|
661
661
|
}
|
|
662
|
-
function r(a, l =
|
|
663
|
-
const
|
|
664
|
-
return o.add(
|
|
665
|
-
o.delete(
|
|
662
|
+
function r(a, l = Rt) {
|
|
663
|
+
const f = [a, l];
|
|
664
|
+
return o.add(f), o.size === 1 && (n = e(i, s) || Rt), a(t), () => {
|
|
665
|
+
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
668
|
return { set: i, update: s, subscribe: r };
|
|
669
669
|
}
|
|
670
|
-
const
|
|
671
|
-
const { subscribe: e, set: n } =
|
|
670
|
+
const xn = (t) => {
|
|
671
|
+
const { subscribe: e, set: n } = jt();
|
|
672
672
|
let o;
|
|
673
673
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
674
674
|
if (o) {
|
|
@@ -684,53 +684,57 @@ const vn = (t) => {
|
|
|
684
684
|
set: n
|
|
685
685
|
};
|
|
686
686
|
};
|
|
687
|
-
var
|
|
688
|
-
const
|
|
689
|
-
const { subscribe: o, set: i } =
|
|
690
|
-
let s = e, r =
|
|
691
|
-
o((
|
|
687
|
+
var vn = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(vn || {});
|
|
688
|
+
const mt = { selected: [] }, En = (t, e, n) => {
|
|
689
|
+
const { subscribe: o, set: i } = jt(mt);
|
|
690
|
+
let s = e, r = mt;
|
|
691
|
+
o((b) => r = b);
|
|
692
692
|
const a = () => {
|
|
693
|
-
|
|
693
|
+
Q(r, mt) || i(mt);
|
|
694
694
|
}, l = () => {
|
|
695
|
-
var
|
|
696
|
-
return ((
|
|
697
|
-
},
|
|
695
|
+
var b;
|
|
696
|
+
return ((b = r.selected) == null ? void 0 : b.length) === 0;
|
|
697
|
+
}, f = (b) => {
|
|
698
698
|
if (l())
|
|
699
699
|
return !1;
|
|
700
|
-
const
|
|
701
|
-
return r.selected.some((C) => C.id ===
|
|
702
|
-
},
|
|
703
|
-
|
|
704
|
-
if (
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
i({ selected: [], event: b });
|
|
700
|
+
const A = typeof b == "string" ? b : b.id;
|
|
701
|
+
return r.selected.some((C) => C.id === A);
|
|
702
|
+
}, p = (b, A) => {
|
|
703
|
+
let C;
|
|
704
|
+
if (Array.isArray(b)) {
|
|
705
|
+
if (C = b.map((c) => t.getAnnotation(c)).filter(Boolean), C.length < b.length) {
|
|
706
|
+
console.warn("Invalid selection: " + b.filter((c) => !C.some((y) => y.id === c)));
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
} else {
|
|
710
|
+
const c = t.getAnnotation(b);
|
|
711
|
+
if (!c) {
|
|
712
|
+
console.warn("Invalid selection: " + b);
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
C = [c];
|
|
717
716
|
}
|
|
718
|
-
|
|
719
|
-
|
|
717
|
+
const m = C.reduce((c, y) => {
|
|
718
|
+
const S = oe(y, s);
|
|
719
|
+
return S === "EDIT" ? [...c, { id: y.id, editable: !0 }] : S === "SELECT" ? [...c, { id: y.id }] : c;
|
|
720
|
+
}, []);
|
|
721
|
+
i({ selected: m, event: A });
|
|
722
|
+
}, d = (b, A) => {
|
|
723
|
+
const C = Array.isArray(b) ? b : [b], m = C.map((c) => t.getAnnotation(c)).filter((c) => !!c);
|
|
720
724
|
i({
|
|
721
|
-
selected:
|
|
722
|
-
const y =
|
|
723
|
-
return { id:
|
|
725
|
+
selected: m.map((c) => {
|
|
726
|
+
const y = A === void 0 ? oe(c, s) === "EDIT" : A;
|
|
727
|
+
return { id: c.id, editable: y };
|
|
724
728
|
})
|
|
725
|
-
}),
|
|
726
|
-
},
|
|
729
|
+
}), m.length !== C.length && console.warn("Invalid selection", b);
|
|
730
|
+
}, h = (b) => {
|
|
727
731
|
if (l())
|
|
728
732
|
return !1;
|
|
729
|
-
const { selected:
|
|
730
|
-
|
|
731
|
-
},
|
|
733
|
+
const { selected: A } = r;
|
|
734
|
+
A.some(({ id: C }) => b.includes(C)) && i({ selected: A.filter(({ id: C }) => !b.includes(C)) });
|
|
735
|
+
}, g = (b) => s = b;
|
|
732
736
|
return t.observe(
|
|
733
|
-
({ changes:
|
|
737
|
+
({ changes: b }) => h((b.deleted || []).map((A) => A.id))
|
|
734
738
|
), {
|
|
735
739
|
get event() {
|
|
736
740
|
return r ? r.event : null;
|
|
@@ -743,37 +747,37 @@ const ht = { selected: [] }, xn = (t, e, n) => {
|
|
|
743
747
|
},
|
|
744
748
|
clear: a,
|
|
745
749
|
isEmpty: l,
|
|
746
|
-
isSelected:
|
|
750
|
+
isSelected: f,
|
|
747
751
|
setSelected: d,
|
|
748
|
-
setUserSelectAction:
|
|
752
|
+
setUserSelectAction: g,
|
|
749
753
|
subscribe: o,
|
|
750
|
-
userSelect:
|
|
754
|
+
userSelect: p
|
|
751
755
|
};
|
|
752
|
-
},
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
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();
|
|
756
|
+
}, oe = (t, e, n) => typeof e == "function" ? e(t) : e || "EDIT", Y = [];
|
|
757
|
+
for (let t = 0; t < 256; ++t)
|
|
758
|
+
Y.push((t + 256).toString(16).slice(1));
|
|
759
|
+
function Sn(t, e = 0) {
|
|
760
|
+
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();
|
|
758
761
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
762
|
+
let Mt;
|
|
763
|
+
const Cn = new Uint8Array(16);
|
|
764
|
+
function Ln() {
|
|
765
|
+
if (!Mt) {
|
|
766
|
+
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
767
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
768
|
+
Mt = crypto.getRandomValues.bind(crypto);
|
|
769
|
+
}
|
|
770
|
+
return Mt(Cn);
|
|
764
771
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
randomUUID
|
|
768
|
-
|
|
769
|
-
function me(t, e, n) {
|
|
770
|
-
if (ee.randomUUID && !e && !t)
|
|
771
|
-
return ee.randomUUID();
|
|
772
|
+
const Tn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ie = { randomUUID: Tn };
|
|
773
|
+
function we(t, e, n) {
|
|
774
|
+
if (ie.randomUUID && !e && !t)
|
|
775
|
+
return ie.randomUUID();
|
|
772
776
|
t = t || {};
|
|
773
|
-
|
|
774
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
777
|
+
const o = t.random || (t.rng || Ln)();
|
|
778
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Sn(o);
|
|
775
779
|
}
|
|
776
|
-
const
|
|
780
|
+
const Bt = (t) => {
|
|
777
781
|
const e = (n) => {
|
|
778
782
|
const o = { ...n };
|
|
779
783
|
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;
|
|
@@ -783,8 +787,8 @@ const Tt = (t) => {
|
|
|
783
787
|
bodies: (t.bodies || []).map(e),
|
|
784
788
|
target: e(t.target)
|
|
785
789
|
};
|
|
786
|
-
},
|
|
787
|
-
id:
|
|
790
|
+
}, ko = (t, e, n, o) => ({
|
|
791
|
+
id: we(),
|
|
788
792
|
annotation: typeof t == "string" ? t : t.id,
|
|
789
793
|
created: n || /* @__PURE__ */ new Date(),
|
|
790
794
|
creator: o,
|
|
@@ -792,25 +796,25 @@ const Tt = (t) => {
|
|
|
792
796
|
}), On = (t, e) => {
|
|
793
797
|
const n = new Set(t.bodies.map((o) => o.id));
|
|
794
798
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
795
|
-
},
|
|
799
|
+
}, Rn = (t, e) => {
|
|
796
800
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
797
801
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
798
|
-
},
|
|
802
|
+
}, Mn = (t, e) => e.bodies.map((n) => {
|
|
799
803
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
800
|
-
return { newBody: n, oldBody: o && !
|
|
801
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })),
|
|
802
|
-
const n = On(t, e), o =
|
|
804
|
+
return { newBody: n, oldBody: o && !Q(o, n) ? o : void 0 };
|
|
805
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Bn = (t, e) => !Q(t.target, e.target), Ae = (t, e) => {
|
|
806
|
+
const n = On(t, e), o = Rn(t, e), i = Mn(t, e);
|
|
803
807
|
return {
|
|
804
808
|
oldValue: t,
|
|
805
809
|
newValue: e,
|
|
806
810
|
bodiesCreated: n.length > 0 ? n : void 0,
|
|
807
811
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
808
812
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
809
|
-
targetUpdated:
|
|
813
|
+
targetUpdated: Bn(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
810
814
|
};
|
|
811
815
|
};
|
|
812
816
|
var k = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t.SILENT = "SILENT", t))(k || {});
|
|
813
|
-
const
|
|
817
|
+
const kn = (t, e) => {
|
|
814
818
|
var n, o;
|
|
815
819
|
const { changes: i, origin: s } = e;
|
|
816
820
|
if (!(t.options.origin ? t.options.origin === s : s !== "SILENT"))
|
|
@@ -818,8 +822,8 @@ const Bn = (t, e) => {
|
|
|
818
822
|
if (t.options.ignore) {
|
|
819
823
|
const { ignore: r } = t.options, a = (l) => l && l.length > 0;
|
|
820
824
|
if (!(a(i.created) || a(i.deleted))) {
|
|
821
|
-
const l = (n = i.updated) == null ? void 0 : n.some((
|
|
822
|
-
if (r === "BODY_ONLY" && l && !
|
|
825
|
+
const l = (n = i.updated) == null ? void 0 : n.some((p) => a(p.bodiesCreated) || a(p.bodiesDeleted) || a(p.bodiesUpdated)), f = (o = i.updated) == null ? void 0 : o.some((p) => p.targetUpdated);
|
|
826
|
+
if (r === "BODY_ONLY" && l && !f || r === "TARGET_ONLY" && f && !l)
|
|
823
827
|
return !1;
|
|
824
828
|
}
|
|
825
829
|
}
|
|
@@ -832,27 +836,27 @@ const Bn = (t, e) => {
|
|
|
832
836
|
return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((a) => r.has(a));
|
|
833
837
|
} else
|
|
834
838
|
return !0;
|
|
835
|
-
},
|
|
839
|
+
}, In = (t, e) => {
|
|
836
840
|
const n = new Set((t.created || []).map((d) => d.id)), o = new Set((t.updated || []).map(({ newValue: d }) => d.id)), i = new Set((e.created || []).map((d) => d.id)), s = new Set((e.deleted || []).map((d) => d.id)), r = new Set((e.updated || []).map(({ oldValue: d }) => d.id)), a = new Set((e.updated || []).filter(({ oldValue: d }) => n.has(d.id) || o.has(d.id)).map(({ oldValue: d }) => d.id)), l = [
|
|
837
|
-
...(t.created || []).filter((d) => !s.has(d.id)).map((d) => r.has(d.id) ? e.updated.find(({ oldValue:
|
|
841
|
+
...(t.created || []).filter((d) => !s.has(d.id)).map((d) => r.has(d.id) ? e.updated.find(({ oldValue: h }) => h.id === d.id).newValue : d),
|
|
838
842
|
...e.created || []
|
|
839
|
-
],
|
|
843
|
+
], f = [
|
|
840
844
|
...(t.deleted || []).filter((d) => !i.has(d.id)),
|
|
841
845
|
...(e.deleted || []).filter((d) => !n.has(d.id))
|
|
842
|
-
],
|
|
846
|
+
], p = [
|
|
843
847
|
...(t.updated || []).filter(({ newValue: d }) => !s.has(d.id)).map((d) => {
|
|
844
|
-
const { oldValue:
|
|
845
|
-
if (r.has(
|
|
846
|
-
const
|
|
847
|
-
return
|
|
848
|
+
const { oldValue: h, newValue: g } = d;
|
|
849
|
+
if (r.has(g.id)) {
|
|
850
|
+
const b = e.updated.find((A) => A.oldValue.id === g.id).newValue;
|
|
851
|
+
return Ae(h, b);
|
|
848
852
|
} else
|
|
849
853
|
return d;
|
|
850
854
|
}),
|
|
851
855
|
...(e.updated || []).filter(({ oldValue: d }) => !a.has(d.id))
|
|
852
856
|
];
|
|
853
|
-
return { created: l, deleted:
|
|
854
|
-
},
|
|
855
|
-
const e = t.id === void 0 ?
|
|
857
|
+
return { created: l, deleted: f, updated: p };
|
|
858
|
+
}, kt = (t) => {
|
|
859
|
+
const e = t.id === void 0 ? we() : t.id;
|
|
856
860
|
return {
|
|
857
861
|
...t,
|
|
858
862
|
id: e,
|
|
@@ -865,209 +869,209 @@ const Bn = (t, e) => {
|
|
|
865
869
|
annotation: e
|
|
866
870
|
}
|
|
867
871
|
};
|
|
868
|
-
},
|
|
869
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (
|
|
870
|
-
n.push({ onChange:
|
|
871
|
-
}, i = (
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
}, s = (
|
|
875
|
-
const
|
|
876
|
-
origin:
|
|
872
|
+
}, Nn = (t) => t.id !== void 0, _n = () => {
|
|
873
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (w, v = {}) => {
|
|
874
|
+
n.push({ onChange: w, options: v });
|
|
875
|
+
}, i = (w) => {
|
|
876
|
+
const v = n.findIndex((u) => u.onChange == w);
|
|
877
|
+
v > -1 && n.splice(v, 1);
|
|
878
|
+
}, s = (w, v) => {
|
|
879
|
+
const u = {
|
|
880
|
+
origin: w,
|
|
877
881
|
changes: {
|
|
878
|
-
created:
|
|
879
|
-
updated:
|
|
880
|
-
deleted:
|
|
882
|
+
created: v.created || [],
|
|
883
|
+
updated: v.updated || [],
|
|
884
|
+
deleted: v.deleted || []
|
|
881
885
|
},
|
|
882
886
|
state: [...t.values()]
|
|
883
887
|
};
|
|
884
|
-
n.forEach((
|
|
885
|
-
|
|
888
|
+
n.forEach((E) => {
|
|
889
|
+
kn(E, u) && E.onChange(u);
|
|
886
890
|
});
|
|
887
|
-
}, r = (
|
|
888
|
-
if (
|
|
889
|
-
throw Error(`Cannot add annotation ${
|
|
891
|
+
}, r = (w, v = k.LOCAL) => {
|
|
892
|
+
if (w.id && t.get(w.id))
|
|
893
|
+
throw Error(`Cannot add annotation ${w.id} - exists already`);
|
|
890
894
|
{
|
|
891
|
-
const
|
|
892
|
-
t.set(
|
|
895
|
+
const u = kt(w);
|
|
896
|
+
t.set(u.id, u), u.bodies.forEach((E) => e.set(E.id, u.id)), s(v, { created: [u] });
|
|
893
897
|
}
|
|
894
|
-
}, a = (
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
897
|
-
const
|
|
898
|
-
return
|
|
898
|
+
}, a = (w, v) => {
|
|
899
|
+
const u = kt(typeof w == "string" ? v : w), E = typeof w == "string" ? w : w.id, B = E && t.get(E);
|
|
900
|
+
if (B) {
|
|
901
|
+
const R = Ae(B, u);
|
|
902
|
+
return E === u.id ? t.set(E, u) : (t.delete(E), t.set(u.id, u)), B.bodies.forEach((U) => e.delete(U.id)), u.bodies.forEach((U) => e.set(U.id, u.id)), R;
|
|
899
903
|
} else
|
|
900
|
-
console.warn(`Cannot update annotation ${
|
|
901
|
-
}, l = (
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
},
|
|
905
|
-
const
|
|
906
|
-
const
|
|
907
|
-
return
|
|
904
|
+
console.warn(`Cannot update annotation ${E} - does not exist`);
|
|
905
|
+
}, l = (w, v = k.LOCAL, u = k.LOCAL) => {
|
|
906
|
+
const E = Nn(v) ? u : v, B = a(w, v);
|
|
907
|
+
B && s(E, { updated: [B] });
|
|
908
|
+
}, f = (w, v = k.LOCAL) => {
|
|
909
|
+
const u = w.reduce((E, B) => {
|
|
910
|
+
const R = a(B);
|
|
911
|
+
return R ? [...E, R] : E;
|
|
908
912
|
}, []);
|
|
909
|
-
|
|
910
|
-
},
|
|
911
|
-
const
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
...
|
|
915
|
-
bodies: [...
|
|
913
|
+
u.length > 0 && s(v, { updated: u });
|
|
914
|
+
}, p = (w, v = k.LOCAL) => {
|
|
915
|
+
const u = t.get(w.annotation);
|
|
916
|
+
if (u) {
|
|
917
|
+
const E = {
|
|
918
|
+
...u,
|
|
919
|
+
bodies: [...u.bodies, w]
|
|
916
920
|
};
|
|
917
|
-
t.set(
|
|
918
|
-
oldValue:
|
|
919
|
-
newValue:
|
|
920
|
-
bodiesCreated: [
|
|
921
|
+
t.set(u.id, E), e.set(w.id, E.id), s(v, { updated: [{
|
|
922
|
+
oldValue: u,
|
|
923
|
+
newValue: E,
|
|
924
|
+
bodiesCreated: [w]
|
|
921
925
|
}] });
|
|
922
926
|
} else
|
|
923
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
924
|
-
}, d = () => [...t.values()],
|
|
925
|
-
const
|
|
926
|
-
t.clear(), e.clear(), s(
|
|
927
|
-
},
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
const
|
|
931
|
-
t.clear(), e.clear(),
|
|
932
|
-
t.set(
|
|
933
|
-
}), s(
|
|
927
|
+
console.warn(`Attempt to add body to missing annotation: ${w.annotation}`);
|
|
928
|
+
}, d = () => [...t.values()], h = (w = k.LOCAL) => {
|
|
929
|
+
const v = [...t.values()];
|
|
930
|
+
t.clear(), e.clear(), s(w, { deleted: v });
|
|
931
|
+
}, g = (w, v = !0, u = k.LOCAL) => {
|
|
932
|
+
const E = w.map(kt);
|
|
933
|
+
if (v) {
|
|
934
|
+
const B = [...t.values()];
|
|
935
|
+
t.clear(), e.clear(), E.forEach((R) => {
|
|
936
|
+
t.set(R.id, R), R.bodies.forEach((U) => e.set(U.id, R.id));
|
|
937
|
+
}), s(u, { created: E, deleted: B });
|
|
934
938
|
} else {
|
|
935
|
-
const
|
|
936
|
-
const
|
|
937
|
-
return
|
|
939
|
+
const B = w.reduce((R, U) => {
|
|
940
|
+
const _ = U.id && t.get(U.id);
|
|
941
|
+
return _ ? [...R, _] : R;
|
|
938
942
|
}, []);
|
|
939
|
-
if (
|
|
940
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${
|
|
941
|
-
|
|
942
|
-
t.set(
|
|
943
|
-
}), s(
|
|
943
|
+
if (B.length > 0)
|
|
944
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${B.map((R) => R.id).join(", ")}`);
|
|
945
|
+
E.forEach((R) => {
|
|
946
|
+
t.set(R.id, R), R.bodies.forEach((U) => e.set(U.id, R.id));
|
|
947
|
+
}), s(u, { created: E });
|
|
944
948
|
}
|
|
945
|
-
},
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
return t.delete(
|
|
949
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
950
|
-
},
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
}, C = (
|
|
954
|
-
const
|
|
955
|
-
const
|
|
956
|
-
return
|
|
949
|
+
}, b = (w) => {
|
|
950
|
+
const v = typeof w == "string" ? w : w.id, u = t.get(v);
|
|
951
|
+
if (u)
|
|
952
|
+
return t.delete(v), u.bodies.forEach((E) => e.delete(E.id)), u;
|
|
953
|
+
console.warn(`Attempt to delete missing annotation: ${v}`);
|
|
954
|
+
}, A = (w, v = k.LOCAL) => {
|
|
955
|
+
const u = b(w);
|
|
956
|
+
u && s(v, { deleted: [u] });
|
|
957
|
+
}, C = (w, v = k.LOCAL) => {
|
|
958
|
+
const u = w.reduce((E, B) => {
|
|
959
|
+
const R = b(B);
|
|
960
|
+
return R ? [...E, R] : E;
|
|
957
961
|
}, []);
|
|
958
|
-
|
|
959
|
-
},
|
|
960
|
-
const
|
|
961
|
-
if (
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
e.delete(
|
|
965
|
-
const
|
|
966
|
-
...
|
|
967
|
-
bodies:
|
|
962
|
+
u.length > 0 && s(v, { deleted: u });
|
|
963
|
+
}, m = (w) => {
|
|
964
|
+
const v = t.get(w.annotation);
|
|
965
|
+
if (v) {
|
|
966
|
+
const u = v.bodies.find((E) => E.id === w.id);
|
|
967
|
+
if (u) {
|
|
968
|
+
e.delete(u.id);
|
|
969
|
+
const E = {
|
|
970
|
+
...v,
|
|
971
|
+
bodies: v.bodies.filter((B) => B.id !== w.id)
|
|
968
972
|
};
|
|
969
|
-
return t.set(
|
|
970
|
-
oldValue:
|
|
971
|
-
newValue:
|
|
972
|
-
bodiesDeleted: [
|
|
973
|
+
return t.set(v.id, E), {
|
|
974
|
+
oldValue: v,
|
|
975
|
+
newValue: E,
|
|
976
|
+
bodiesDeleted: [u]
|
|
973
977
|
};
|
|
974
978
|
} else
|
|
975
|
-
console.warn(`Attempt to delete missing body ${
|
|
979
|
+
console.warn(`Attempt to delete missing body ${w.id} from annotation ${w.annotation}`);
|
|
976
980
|
} else
|
|
977
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
978
|
-
},
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
}, y = (
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
}, S = (
|
|
985
|
-
const
|
|
986
|
-
return
|
|
987
|
-
},
|
|
988
|
-
const
|
|
989
|
-
if (
|
|
990
|
-
const
|
|
991
|
-
if (
|
|
992
|
-
return
|
|
993
|
-
console.error(`Store integrity error: body ${
|
|
981
|
+
console.warn(`Attempt to delete body from missing annotation ${w.annotation}`);
|
|
982
|
+
}, c = (w, v = k.LOCAL) => {
|
|
983
|
+
const u = m(w);
|
|
984
|
+
u && s(v, { updated: [u] });
|
|
985
|
+
}, y = (w, v = k.LOCAL) => {
|
|
986
|
+
const u = w.map((E) => m(E)).filter(Boolean);
|
|
987
|
+
u.length > 0 && s(v, { updated: u });
|
|
988
|
+
}, S = (w) => {
|
|
989
|
+
const v = t.get(w);
|
|
990
|
+
return v ? { ...v } : void 0;
|
|
991
|
+
}, x = (w) => {
|
|
992
|
+
const v = e.get(w);
|
|
993
|
+
if (v) {
|
|
994
|
+
const u = S(v).bodies.find((E) => E.id === w);
|
|
995
|
+
if (u)
|
|
996
|
+
return u;
|
|
997
|
+
console.error(`Store integrity error: body ${w} in index, but not in annotation`);
|
|
994
998
|
} else
|
|
995
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
996
|
-
},
|
|
997
|
-
if (
|
|
999
|
+
console.warn(`Attempt to retrieve missing body: ${w}`);
|
|
1000
|
+
}, L = (w, v) => {
|
|
1001
|
+
if (w.annotation !== v.annotation)
|
|
998
1002
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
999
|
-
const
|
|
1000
|
-
if (
|
|
1001
|
-
const
|
|
1002
|
-
...
|
|
1003
|
-
bodies:
|
|
1003
|
+
const u = t.get(w.annotation);
|
|
1004
|
+
if (u) {
|
|
1005
|
+
const E = u.bodies.find((R) => R.id === w.id), B = {
|
|
1006
|
+
...u,
|
|
1007
|
+
bodies: u.bodies.map((R) => R.id === E.id ? v : R)
|
|
1004
1008
|
};
|
|
1005
|
-
return t.set(
|
|
1006
|
-
oldValue:
|
|
1007
|
-
newValue:
|
|
1008
|
-
bodiesUpdated: [{ oldBody:
|
|
1009
|
+
return t.set(u.id, B), E.id !== v.id && (e.delete(E.id), e.set(v.id, B.id)), {
|
|
1010
|
+
oldValue: u,
|
|
1011
|
+
newValue: B,
|
|
1012
|
+
bodiesUpdated: [{ oldBody: E, newBody: v }]
|
|
1009
1013
|
};
|
|
1010
1014
|
} else
|
|
1011
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
1012
|
-
},
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1015
|
-
}, T = (
|
|
1016
|
-
const
|
|
1017
|
-
s(
|
|
1018
|
-
},
|
|
1019
|
-
const
|
|
1020
|
-
if (
|
|
1021
|
-
const
|
|
1022
|
-
...
|
|
1015
|
+
console.warn(`Attempt to add body to missing annotation ${w.annotation}`);
|
|
1016
|
+
}, O = (w, v, u = k.LOCAL) => {
|
|
1017
|
+
const E = L(w, v);
|
|
1018
|
+
E && s(u, { updated: [E] });
|
|
1019
|
+
}, T = (w, v = k.LOCAL) => {
|
|
1020
|
+
const u = w.map((E) => L({ id: E.id, annotation: E.annotation }, E)).filter(Boolean);
|
|
1021
|
+
s(v, { updated: u });
|
|
1022
|
+
}, M = (w) => {
|
|
1023
|
+
const v = t.get(w.annotation);
|
|
1024
|
+
if (v) {
|
|
1025
|
+
const u = {
|
|
1026
|
+
...v,
|
|
1023
1027
|
target: {
|
|
1024
|
-
...
|
|
1025
|
-
...
|
|
1028
|
+
...v.target,
|
|
1029
|
+
...w
|
|
1026
1030
|
}
|
|
1027
1031
|
};
|
|
1028
|
-
return t.set(
|
|
1029
|
-
oldValue:
|
|
1030
|
-
newValue:
|
|
1032
|
+
return t.set(v.id, u), {
|
|
1033
|
+
oldValue: v,
|
|
1034
|
+
newValue: u,
|
|
1031
1035
|
targetUpdated: {
|
|
1032
|
-
oldTarget:
|
|
1033
|
-
newTarget:
|
|
1036
|
+
oldTarget: v.target,
|
|
1037
|
+
newTarget: w
|
|
1034
1038
|
}
|
|
1035
1039
|
};
|
|
1036
1040
|
} else
|
|
1037
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
1041
|
+
console.warn(`Attempt to update target on missing annotation: ${w.annotation}`);
|
|
1038
1042
|
};
|
|
1039
1043
|
return {
|
|
1040
1044
|
addAnnotation: r,
|
|
1041
|
-
addBody:
|
|
1045
|
+
addBody: p,
|
|
1042
1046
|
all: d,
|
|
1043
|
-
bulkAddAnnotation:
|
|
1047
|
+
bulkAddAnnotation: g,
|
|
1044
1048
|
bulkDeleteAnnotation: C,
|
|
1045
1049
|
bulkDeleteBodies: y,
|
|
1046
|
-
bulkUpdateAnnotation:
|
|
1050
|
+
bulkUpdateAnnotation: f,
|
|
1047
1051
|
bulkUpdateBodies: T,
|
|
1048
|
-
bulkUpdateTargets: (
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1052
|
+
bulkUpdateTargets: (w, v = k.LOCAL) => {
|
|
1053
|
+
const u = w.map((E) => M(E)).filter(Boolean);
|
|
1054
|
+
u.length > 0 && s(v, { updated: u });
|
|
1051
1055
|
},
|
|
1052
|
-
clear:
|
|
1053
|
-
deleteAnnotation:
|
|
1054
|
-
deleteBody:
|
|
1056
|
+
clear: h,
|
|
1057
|
+
deleteAnnotation: A,
|
|
1058
|
+
deleteBody: c,
|
|
1055
1059
|
getAnnotation: S,
|
|
1056
|
-
getBody:
|
|
1060
|
+
getBody: x,
|
|
1057
1061
|
observe: o,
|
|
1058
1062
|
unobserve: i,
|
|
1059
1063
|
updateAnnotation: l,
|
|
1060
|
-
updateBody:
|
|
1061
|
-
updateTarget: (
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
+
updateBody: O,
|
|
1065
|
+
updateTarget: (w, v = k.LOCAL) => {
|
|
1066
|
+
const u = M(w);
|
|
1067
|
+
u && s(v, { updated: [u] });
|
|
1064
1068
|
}
|
|
1065
1069
|
};
|
|
1066
1070
|
};
|
|
1067
|
-
let
|
|
1071
|
+
let Un = () => ({
|
|
1068
1072
|
emit(t, ...e) {
|
|
1069
|
-
for (let n =
|
|
1070
|
-
o
|
|
1073
|
+
for (let n = this.events[t] || [], o = 0, i = n.length; o < i; o++)
|
|
1074
|
+
n[o](...e);
|
|
1071
1075
|
},
|
|
1072
1076
|
events: {},
|
|
1073
1077
|
on(t, e) {
|
|
@@ -1078,119 +1082,119 @@ let _n = () => ({
|
|
|
1078
1082
|
};
|
|
1079
1083
|
}
|
|
1080
1084
|
});
|
|
1081
|
-
const
|
|
1082
|
-
const e =
|
|
1085
|
+
const Dn = 250, Vn = (t) => {
|
|
1086
|
+
const e = Un(), n = [];
|
|
1083
1087
|
let o = -1, i = !1, s = 0;
|
|
1084
|
-
const r = (
|
|
1088
|
+
const r = (g) => {
|
|
1085
1089
|
if (!i) {
|
|
1086
|
-
const { changes:
|
|
1087
|
-
if (
|
|
1088
|
-
n.splice(o + 1), n.push(
|
|
1090
|
+
const { changes: b } = g, A = performance.now();
|
|
1091
|
+
if (A - s > Dn)
|
|
1092
|
+
n.splice(o + 1), n.push(b), o = n.length - 1;
|
|
1089
1093
|
else {
|
|
1090
1094
|
const C = n.length - 1;
|
|
1091
|
-
n[C] =
|
|
1095
|
+
n[C] = In(n[C], b);
|
|
1092
1096
|
}
|
|
1093
|
-
s =
|
|
1097
|
+
s = A;
|
|
1094
1098
|
}
|
|
1095
1099
|
i = !1;
|
|
1096
1100
|
};
|
|
1097
1101
|
t.observe(r, { origin: k.LOCAL });
|
|
1098
|
-
const a = (
|
|
1102
|
+
const a = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g), l = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), f = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ oldValue: b }) => b)), p = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ newValue: b }) => b)), d = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), h = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g);
|
|
1099
1103
|
return {
|
|
1100
1104
|
canRedo: () => n.length - 1 > o,
|
|
1101
1105
|
canUndo: () => o > -1,
|
|
1102
1106
|
destroy: () => t.unobserve(r),
|
|
1103
|
-
on: (
|
|
1107
|
+
on: (g, b) => e.on(g, b),
|
|
1104
1108
|
redo: () => {
|
|
1105
1109
|
if (n.length - 1 > o) {
|
|
1106
1110
|
i = !0;
|
|
1107
|
-
const { created:
|
|
1108
|
-
l(
|
|
1111
|
+
const { created: g, updated: b, deleted: A } = n[o + 1];
|
|
1112
|
+
l(g), p(b), h(A), e.emit("redo", n[o + 1]), o += 1;
|
|
1109
1113
|
}
|
|
1110
1114
|
},
|
|
1111
1115
|
undo: () => {
|
|
1112
1116
|
if (o > -1) {
|
|
1113
1117
|
i = !0;
|
|
1114
|
-
const { created:
|
|
1115
|
-
a(
|
|
1118
|
+
const { created: g, updated: b, deleted: A } = n[o];
|
|
1119
|
+
a(g), f(b), d(A), e.emit("undo", n[o]), o -= 1;
|
|
1116
1120
|
}
|
|
1117
1121
|
}
|
|
1118
1122
|
};
|
|
1119
|
-
},
|
|
1120
|
-
const { subscribe: t, set: e } =
|
|
1123
|
+
}, Yn = () => {
|
|
1124
|
+
const { subscribe: t, set: e } = jt([]);
|
|
1121
1125
|
return {
|
|
1122
1126
|
subscribe: t,
|
|
1123
1127
|
set: e
|
|
1124
1128
|
};
|
|
1125
1129
|
}, Kn = (t, e, n, o) => {
|
|
1126
1130
|
const { hover: i, selection: s, store: r, viewport: a } = t, l = /* @__PURE__ */ new Map();
|
|
1127
|
-
let
|
|
1128
|
-
const d = (
|
|
1129
|
-
l.has(
|
|
1130
|
-
},
|
|
1131
|
-
const
|
|
1132
|
-
if (
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1131
|
+
let f = [], p;
|
|
1132
|
+
const d = (A, C) => {
|
|
1133
|
+
l.has(A) ? l.get(A).push(C) : l.set(A, [C]);
|
|
1134
|
+
}, h = (A, C) => {
|
|
1135
|
+
const m = l.get(A);
|
|
1136
|
+
if (m) {
|
|
1137
|
+
const c = m.indexOf(C);
|
|
1138
|
+
c !== -1 && m.splice(c, 1);
|
|
1135
1139
|
}
|
|
1136
|
-
},
|
|
1137
|
-
l.has(
|
|
1138
|
-
l.get(
|
|
1140
|
+
}, g = (A, C, m) => {
|
|
1141
|
+
l.has(A) && setTimeout(() => {
|
|
1142
|
+
l.get(A).forEach((c) => {
|
|
1139
1143
|
if (n) {
|
|
1140
|
-
const y = Array.isArray(C) ? C.map((
|
|
1141
|
-
|
|
1144
|
+
const y = Array.isArray(C) ? C.map((x) => n.serialize(x)) : n.serialize(C), S = m ? m instanceof PointerEvent ? m : n.serialize(m) : void 0;
|
|
1145
|
+
c(y, S);
|
|
1142
1146
|
} else
|
|
1143
|
-
|
|
1147
|
+
c(C, m);
|
|
1144
1148
|
});
|
|
1145
1149
|
}, 1);
|
|
1146
1150
|
};
|
|
1147
|
-
s.subscribe(({ selected:
|
|
1148
|
-
if (!(
|
|
1149
|
-
if (
|
|
1150
|
-
|
|
1151
|
-
else if (
|
|
1152
|
-
|
|
1153
|
-
const
|
|
1154
|
-
|
|
1155
|
-
}),
|
|
1151
|
+
s.subscribe(({ selected: A }) => {
|
|
1152
|
+
if (!(f.length === 0 && A.length === 0)) {
|
|
1153
|
+
if (f.length === 0 && A.length > 0)
|
|
1154
|
+
f = A.map(({ id: C }) => r.getAnnotation(C));
|
|
1155
|
+
else if (f.length > 0 && A.length === 0)
|
|
1156
|
+
f.forEach((C) => {
|
|
1157
|
+
const m = r.getAnnotation(C.id);
|
|
1158
|
+
m && !Q(m, C) && g("updateAnnotation", m, C);
|
|
1159
|
+
}), f = [];
|
|
1156
1160
|
else {
|
|
1157
|
-
const C = new Set(
|
|
1158
|
-
|
|
1159
|
-
const y = r.getAnnotation(
|
|
1160
|
-
y && !
|
|
1161
|
-
}),
|
|
1161
|
+
const C = new Set(f.map((c) => c.id)), m = new Set(A.map(({ id: c }) => c));
|
|
1162
|
+
f.filter((c) => !m.has(c.id)).forEach((c) => {
|
|
1163
|
+
const y = r.getAnnotation(c.id);
|
|
1164
|
+
y && !Q(y, c) && g("updateAnnotation", y, c);
|
|
1165
|
+
}), f = [
|
|
1162
1166
|
// Remove annotations that were deselected
|
|
1163
|
-
...
|
|
1167
|
+
...f.filter((c) => m.has(c.id)),
|
|
1164
1168
|
// Add editable annotations that were selected
|
|
1165
|
-
...
|
|
1169
|
+
...A.filter(({ id: c }) => !C.has(c)).map(({ id: c }) => r.getAnnotation(c))
|
|
1166
1170
|
];
|
|
1167
1171
|
}
|
|
1168
|
-
|
|
1172
|
+
g("selectionChanged", f);
|
|
1169
1173
|
}
|
|
1170
|
-
}), i.subscribe((
|
|
1171
|
-
!
|
|
1172
|
-
}), a == null || a.subscribe((
|
|
1173
|
-
const { created: C, deleted:
|
|
1174
|
-
(C || []).forEach((
|
|
1175
|
-
...
|
|
1176
|
-
...
|
|
1177
|
-
...
|
|
1178
|
-
].length > 0).forEach(({ oldValue:
|
|
1179
|
-
const S =
|
|
1180
|
-
|
|
1174
|
+
}), i.subscribe((A) => {
|
|
1175
|
+
!p && A ? g("mouseEnterAnnotation", r.getAnnotation(A)) : p && !A ? g("mouseLeaveAnnotation", r.getAnnotation(p)) : p && A && (g("mouseLeaveAnnotation", r.getAnnotation(p)), g("mouseEnterAnnotation", r.getAnnotation(A))), p = A;
|
|
1176
|
+
}), a == null || a.subscribe((A) => g("viewportIntersect", A.map((C) => r.getAnnotation(C)))), r.observe((A) => {
|
|
1177
|
+
const { created: C, deleted: m } = A.changes;
|
|
1178
|
+
(C || []).forEach((c) => g("createAnnotation", c)), (m || []).forEach((c) => g("deleteAnnotation", c)), (A.changes.updated || []).filter((c) => [
|
|
1179
|
+
...c.bodiesCreated || [],
|
|
1180
|
+
...c.bodiesDeleted || [],
|
|
1181
|
+
...c.bodiesUpdated || []
|
|
1182
|
+
].length > 0).forEach(({ oldValue: c, newValue: y }) => {
|
|
1183
|
+
const S = f.find((x) => x.id === c.id) || c;
|
|
1184
|
+
f = f.map((x) => x.id === c.id ? y : x), g("updateAnnotation", y, S);
|
|
1181
1185
|
});
|
|
1182
|
-
}, { origin: k.LOCAL }), r.observe((
|
|
1183
|
-
if (
|
|
1184
|
-
const C = new Set(
|
|
1185
|
-
|
|
1186
|
+
}, { origin: k.LOCAL }), r.observe((A) => {
|
|
1187
|
+
if (f) {
|
|
1188
|
+
const C = new Set(f.map((c) => c.id)), m = (A.changes.updated || []).filter(({ newValue: c }) => C.has(c.id)).map(({ newValue: c }) => c);
|
|
1189
|
+
m.length > 0 && (f = f.map((c) => m.find((S) => S.id === c.id) || c));
|
|
1186
1190
|
}
|
|
1187
1191
|
}, { origin: k.REMOTE });
|
|
1188
|
-
const
|
|
1189
|
-
const { updated:
|
|
1190
|
-
|
|
1192
|
+
const b = (A) => (C) => {
|
|
1193
|
+
const { updated: m } = C;
|
|
1194
|
+
A ? (m || []).forEach((c) => g("updateAnnotation", c.oldValue, c.newValue)) : (m || []).forEach((c) => g("updateAnnotation", c.newValue, c.oldValue));
|
|
1191
1195
|
};
|
|
1192
|
-
return e.on("undo",
|
|
1193
|
-
},
|
|
1196
|
+
return e.on("undo", b(!0)), e.on("redo", b(!1)), { on: d, off: h, emit: g };
|
|
1197
|
+
}, Xn = (t) => (e) => e.reduce((n, o) => {
|
|
1194
1198
|
const { parsed: i, error: s } = t.parse(o);
|
|
1195
1199
|
return s ? {
|
|
1196
1200
|
parsed: n.parsed,
|
|
@@ -1201,47 +1205,47 @@ const Un = 250, Dn = (t) => {
|
|
|
1201
1205
|
} : {
|
|
1202
1206
|
...n
|
|
1203
1207
|
};
|
|
1204
|
-
}, { parsed: [], failed: [] }),
|
|
1205
|
-
const { store: o, selection: i } = t, s = (
|
|
1208
|
+
}, { parsed: [], failed: [] }), Pn = (t, e, n) => {
|
|
1209
|
+
const { store: o, selection: i } = t, s = (m) => {
|
|
1206
1210
|
if (n) {
|
|
1207
|
-
const { parsed:
|
|
1208
|
-
|
|
1211
|
+
const { parsed: c, error: y } = n.parse(m);
|
|
1212
|
+
c ? o.addAnnotation(c, k.REMOTE) : console.error(y);
|
|
1209
1213
|
} else
|
|
1210
|
-
o.addAnnotation(
|
|
1211
|
-
}, r = () => i.clear(), a = () => o.clear(), l = (
|
|
1212
|
-
const
|
|
1213
|
-
return n &&
|
|
1214
|
-
},
|
|
1215
|
-
var
|
|
1216
|
-
const
|
|
1217
|
-
return n ?
|
|
1218
|
-
}, d = (
|
|
1219
|
-
if (typeof
|
|
1220
|
-
const
|
|
1221
|
-
if (o.deleteAnnotation(
|
|
1222
|
-
return n ? n.serialize(
|
|
1214
|
+
o.addAnnotation(Bt(m), k.REMOTE);
|
|
1215
|
+
}, r = () => i.clear(), a = () => o.clear(), l = (m) => {
|
|
1216
|
+
const c = o.getAnnotation(m);
|
|
1217
|
+
return n && c ? n.serialize(c) : c;
|
|
1218
|
+
}, f = () => n ? o.all().map(n.serialize) : o.all(), p = () => {
|
|
1219
|
+
var m;
|
|
1220
|
+
const c = (((m = i.selected) == null ? void 0 : m.map((y) => y.id)) || []).map((y) => o.getAnnotation(y)).filter(Boolean);
|
|
1221
|
+
return n ? c.map(n.serialize) : c;
|
|
1222
|
+
}, d = (m, c = !0) => fetch(m).then((y) => y.json()).then((y) => (g(y, c), y)), h = (m) => {
|
|
1223
|
+
if (typeof m == "string") {
|
|
1224
|
+
const c = o.getAnnotation(m);
|
|
1225
|
+
if (o.deleteAnnotation(m), c)
|
|
1226
|
+
return n ? n.serialize(c) : c;
|
|
1223
1227
|
} else {
|
|
1224
|
-
const
|
|
1225
|
-
if (
|
|
1226
|
-
return o.deleteAnnotation(
|
|
1228
|
+
const c = n ? n.parse(m).parsed : m;
|
|
1229
|
+
if (c)
|
|
1230
|
+
return o.deleteAnnotation(c), m;
|
|
1227
1231
|
}
|
|
1228
|
-
},
|
|
1232
|
+
}, g = (m, c = !0) => {
|
|
1229
1233
|
if (n) {
|
|
1230
|
-
const y = n.parseAll ||
|
|
1231
|
-
|
|
1234
|
+
const y = n.parseAll || Xn(n), { parsed: S, failed: x } = y(m);
|
|
1235
|
+
x.length > 0 && console.warn(`Discarded ${x.length} invalid annotations`, x), o.bulkAddAnnotation(S, c, k.REMOTE);
|
|
1232
1236
|
} else
|
|
1233
|
-
o.bulkAddAnnotation(
|
|
1234
|
-
},
|
|
1235
|
-
|
|
1236
|
-
},
|
|
1237
|
-
i.clear(), i.setUserSelectAction(
|
|
1238
|
-
}, C = (
|
|
1237
|
+
o.bulkAddAnnotation(m.map(Bt), c, k.REMOTE);
|
|
1238
|
+
}, b = (m, c) => {
|
|
1239
|
+
m ? i.setSelected(m, c) : i.clear();
|
|
1240
|
+
}, A = (m) => {
|
|
1241
|
+
i.clear(), i.setUserSelectAction(m);
|
|
1242
|
+
}, C = (m) => {
|
|
1239
1243
|
if (n) {
|
|
1240
|
-
const
|
|
1241
|
-
return o.updateAnnotation(
|
|
1244
|
+
const c = n.parse(m).parsed, y = n.serialize(o.getAnnotation(c.id));
|
|
1245
|
+
return o.updateAnnotation(c), y;
|
|
1242
1246
|
} else {
|
|
1243
|
-
const
|
|
1244
|
-
return o.updateAnnotation(
|
|
1247
|
+
const c = o.getAnnotation(m.id);
|
|
1248
|
+
return o.updateAnnotation(Bt(m)), c;
|
|
1245
1249
|
}
|
|
1246
1250
|
};
|
|
1247
1251
|
return {
|
|
@@ -1251,20 +1255,20 @@ const Un = 250, Dn = (t) => {
|
|
|
1251
1255
|
canUndo: e.canUndo,
|
|
1252
1256
|
clearAnnotations: a,
|
|
1253
1257
|
getAnnotationById: l,
|
|
1254
|
-
getAnnotations:
|
|
1255
|
-
getSelected:
|
|
1258
|
+
getAnnotations: f,
|
|
1259
|
+
getSelected: p,
|
|
1256
1260
|
loadAnnotations: d,
|
|
1257
1261
|
redo: e.redo,
|
|
1258
|
-
removeAnnotation:
|
|
1259
|
-
setAnnotations:
|
|
1260
|
-
setSelected:
|
|
1261
|
-
setUserSelectAction:
|
|
1262
|
+
removeAnnotation: h,
|
|
1263
|
+
setAnnotations: g,
|
|
1264
|
+
setSelected: b,
|
|
1265
|
+
setUserSelectAction: A,
|
|
1262
1266
|
undo: e.undo,
|
|
1263
1267
|
updateAnnotation: C
|
|
1264
1268
|
};
|
|
1265
|
-
},
|
|
1266
|
-
let
|
|
1267
|
-
let o = (2 << Math.
|
|
1269
|
+
}, $n = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1270
|
+
let jn = (t) => crypto.getRandomValues(new Uint8Array(t)), Hn = (t, e, n) => {
|
|
1271
|
+
let o = (2 << Math.log2(t.length - 1)) - 1, i = -~(1.6 * o * e / t.length);
|
|
1268
1272
|
return (s = e) => {
|
|
1269
1273
|
let r = "";
|
|
1270
1274
|
for (; ; ) {
|
|
@@ -1273,13 +1277,13 @@ let $n = (t) => crypto.getRandomValues(new Uint8Array(t)), jn = (t, e, n) => {
|
|
|
1273
1277
|
if (r += t[a[l] & o] || "", r.length === s) return r;
|
|
1274
1278
|
}
|
|
1275
1279
|
};
|
|
1276
|
-
},
|
|
1280
|
+
}, zn = (t, e = 21) => Hn(t, e, jn), Fn = (t = 21) => {
|
|
1277
1281
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t));
|
|
1278
1282
|
for (; t--; )
|
|
1279
|
-
e +=
|
|
1283
|
+
e += $n[n[t] & 63];
|
|
1280
1284
|
return e;
|
|
1281
1285
|
};
|
|
1282
|
-
const
|
|
1286
|
+
const Wn = () => ({ isGuest: !0, id: zn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), qn = (t) => {
|
|
1283
1287
|
const e = JSON.stringify(t);
|
|
1284
1288
|
let n = 0;
|
|
1285
1289
|
for (let o = 0, i = e.length; o < i; o++) {
|
|
@@ -1287,20 +1291,20 @@ const Fn = () => ({ isGuest: !0, id: Hn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1287
1291
|
n = (n << 5) - n + s, n |= 0;
|
|
1288
1292
|
}
|
|
1289
1293
|
return `${n}`;
|
|
1290
|
-
},
|
|
1291
|
-
const { id: o, type: i, purpose: s, value: r, created: a, modified: l, creator:
|
|
1294
|
+
}, xe = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Gn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1295
|
+
const { id: o, type: i, purpose: s, value: r, created: a, modified: l, creator: f, ...p } = n;
|
|
1292
1296
|
return {
|
|
1293
|
-
id: o || `temp-${
|
|
1297
|
+
id: o || `temp-${qn(n)}`,
|
|
1294
1298
|
annotation: e,
|
|
1295
1299
|
type: i,
|
|
1296
1300
|
purpose: s,
|
|
1297
1301
|
value: r,
|
|
1298
|
-
creator:
|
|
1302
|
+
creator: xe(f),
|
|
1299
1303
|
created: a ? new Date(a) : void 0,
|
|
1300
1304
|
updated: l ? new Date(l) : void 0,
|
|
1301
|
-
...
|
|
1305
|
+
...p
|
|
1302
1306
|
};
|
|
1303
|
-
}),
|
|
1307
|
+
}), Qn = (t) => t.map((e) => {
|
|
1304
1308
|
var n;
|
|
1305
1309
|
const { annotation: o, created: i, updated: s, ...r } = e, a = {
|
|
1306
1310
|
...r,
|
|
@@ -1309,11 +1313,11 @@ const Fn = () => ({ isGuest: !0, id: Hn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1309
1313
|
};
|
|
1310
1314
|
return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
|
|
1311
1315
|
});
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
parse: (n) =>
|
|
1315
|
-
serialize: (n) =>
|
|
1316
|
-
}),
|
|
1316
|
+
Fn();
|
|
1317
|
+
const Io = (t, e) => ({
|
|
1318
|
+
parse: (n) => to(n),
|
|
1319
|
+
serialize: (n) => eo(n, t, e)
|
|
1320
|
+
}), Jn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, Zn = (t) => {
|
|
1317
1321
|
const {
|
|
1318
1322
|
id: e,
|
|
1319
1323
|
creator: n,
|
|
@@ -1324,7 +1328,7 @@ const ko = (t, e) => ({
|
|
|
1324
1328
|
if (r.length === 0)
|
|
1325
1329
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
1326
1330
|
const a = {
|
|
1327
|
-
creator:
|
|
1331
|
+
creator: xe(n),
|
|
1328
1332
|
created: o ? new Date(o) : void 0,
|
|
1329
1333
|
updated: i ? new Date(i) : void 0,
|
|
1330
1334
|
annotation: e,
|
|
@@ -1333,21 +1337,21 @@ const ko = (t, e) => ({
|
|
|
1333
1337
|
styleClass: "styleClass" in r[0] ? r[0].styleClass : void 0
|
|
1334
1338
|
};
|
|
1335
1339
|
for (const l of r) {
|
|
1336
|
-
const
|
|
1337
|
-
switch (
|
|
1340
|
+
const p = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((d, h) => {
|
|
1341
|
+
switch (h.type) {
|
|
1338
1342
|
case "TextQuoteSelector":
|
|
1339
|
-
d.quote =
|
|
1343
|
+
d.quote = h.exact;
|
|
1340
1344
|
break;
|
|
1341
1345
|
case "TextPositionSelector":
|
|
1342
|
-
d.start =
|
|
1346
|
+
d.start = h.start, d.end = h.end;
|
|
1343
1347
|
break;
|
|
1344
1348
|
}
|
|
1345
1349
|
return d;
|
|
1346
1350
|
}, {});
|
|
1347
|
-
if (
|
|
1351
|
+
if (Jn(p))
|
|
1348
1352
|
a.selector.push(
|
|
1349
1353
|
{
|
|
1350
|
-
...
|
|
1354
|
+
...p,
|
|
1351
1355
|
id: l.id,
|
|
1352
1356
|
// @ts-expect-error: `scope` is not part of the core `TextSelector` type
|
|
1353
1357
|
scope: l.scope
|
|
@@ -1355,21 +1359,21 @@ const ko = (t, e) => ({
|
|
|
1355
1359
|
);
|
|
1356
1360
|
else {
|
|
1357
1361
|
const d = [
|
|
1358
|
-
|
|
1359
|
-
|
|
1362
|
+
p.start ? void 0 : "TextPositionSelector",
|
|
1363
|
+
p.quote ? void 0 : "TextQuoteSelector"
|
|
1360
1364
|
].filter(Boolean);
|
|
1361
1365
|
return { error: Error(`Missing selector types: ${d.join(" and ")} for annotation: ${t.id}`) };
|
|
1362
1366
|
}
|
|
1363
1367
|
}
|
|
1364
1368
|
return { parsed: a };
|
|
1365
|
-
},
|
|
1366
|
-
const e = t.id ||
|
|
1369
|
+
}, to = (t) => {
|
|
1370
|
+
const e = t.id || be(), {
|
|
1367
1371
|
creator: n,
|
|
1368
1372
|
created: o,
|
|
1369
1373
|
modified: i,
|
|
1370
1374
|
body: s,
|
|
1371
1375
|
...r
|
|
1372
|
-
} = t, a =
|
|
1376
|
+
} = t, a = Gn(s, e), l = Zn(t);
|
|
1373
1377
|
return "error" in l ? { error: l.error } : {
|
|
1374
1378
|
parsed: {
|
|
1375
1379
|
...r,
|
|
@@ -1378,29 +1382,29 @@ const ko = (t, e) => ({
|
|
|
1378
1382
|
target: l.parsed
|
|
1379
1383
|
}
|
|
1380
1384
|
};
|
|
1381
|
-
},
|
|
1385
|
+
}, eo = (t, e, n) => {
|
|
1382
1386
|
const { bodies: o, target: i, ...s } = t, {
|
|
1383
1387
|
selector: r,
|
|
1384
1388
|
creator: a,
|
|
1385
1389
|
created: l,
|
|
1386
|
-
updated:
|
|
1387
|
-
...
|
|
1388
|
-
} = i, d = r.map((
|
|
1389
|
-
const { id:
|
|
1390
|
+
updated: f,
|
|
1391
|
+
...p
|
|
1392
|
+
} = i, d = r.map((h) => {
|
|
1393
|
+
const { id: g, quote: b, start: A, end: C, range: m } = h, { prefix: c, suffix: y } = Ue(m, n), S = [{
|
|
1390
1394
|
type: "TextQuoteSelector",
|
|
1391
|
-
exact:
|
|
1392
|
-
prefix:
|
|
1395
|
+
exact: b,
|
|
1396
|
+
prefix: c,
|
|
1393
1397
|
suffix: y
|
|
1394
1398
|
}, {
|
|
1395
1399
|
type: "TextPositionSelector",
|
|
1396
|
-
start:
|
|
1400
|
+
start: A,
|
|
1397
1401
|
end: C
|
|
1398
1402
|
}];
|
|
1399
1403
|
return {
|
|
1400
|
-
...
|
|
1401
|
-
id:
|
|
1404
|
+
...p,
|
|
1405
|
+
id: g,
|
|
1402
1406
|
// @ts-expect-error: `scope` is not part of the core `TextSelector` type
|
|
1403
|
-
scope: "scope" in
|
|
1407
|
+
scope: "scope" in h ? h.scope : void 0,
|
|
1404
1408
|
source: e,
|
|
1405
1409
|
selector: S
|
|
1406
1410
|
};
|
|
@@ -1410,36 +1414,36 @@ const ko = (t, e) => ({
|
|
|
1410
1414
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1411
1415
|
id: t.id,
|
|
1412
1416
|
type: "Annotation",
|
|
1413
|
-
body:
|
|
1417
|
+
body: Qn(t.bodies),
|
|
1414
1418
|
creator: a,
|
|
1415
1419
|
created: l == null ? void 0 : l.toISOString(),
|
|
1416
|
-
modified:
|
|
1420
|
+
modified: f == null ? void 0 : f.toISOString(),
|
|
1417
1421
|
target: d
|
|
1418
1422
|
};
|
|
1419
1423
|
};
|
|
1420
|
-
function
|
|
1424
|
+
function ve(t, e, n = 0, o = t.length - 1, i = no) {
|
|
1421
1425
|
for (; o > n; ) {
|
|
1422
1426
|
if (o - n > 600) {
|
|
1423
|
-
const l = o - n + 1,
|
|
1424
|
-
|
|
1427
|
+
const l = o - n + 1, f = e - n + 1, p = Math.log(l), d = 0.5 * Math.exp(2 * p / 3), h = 0.5 * Math.sqrt(p * d * (l - d) / l) * (f - l / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - f * d / l + h)), b = Math.min(o, Math.floor(e + (l - f) * d / l + h));
|
|
1428
|
+
ve(t, e, g, b, i);
|
|
1425
1429
|
}
|
|
1426
1430
|
const s = t[e];
|
|
1427
1431
|
let r = n, a = o;
|
|
1428
|
-
for (
|
|
1429
|
-
for (
|
|
1432
|
+
for (ot(t, n, e), i(t[o], s) > 0 && ot(t, n, o); r < a; ) {
|
|
1433
|
+
for (ot(t, r, a), r++, a--; i(t[r], s) < 0; ) r++;
|
|
1430
1434
|
for (; i(t[a], s) > 0; ) a--;
|
|
1431
1435
|
}
|
|
1432
|
-
i(t[n], s) === 0 ?
|
|
1436
|
+
i(t[n], s) === 0 ? ot(t, n, a) : (a++, ot(t, a, o)), a <= e && (n = a + 1), e <= a && (o = a - 1);
|
|
1433
1437
|
}
|
|
1434
1438
|
}
|
|
1435
|
-
function
|
|
1439
|
+
function ot(t, e, n) {
|
|
1436
1440
|
const o = t[e];
|
|
1437
1441
|
t[e] = t[n], t[n] = o;
|
|
1438
1442
|
}
|
|
1439
|
-
function
|
|
1443
|
+
function no(t, e) {
|
|
1440
1444
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1441
1445
|
}
|
|
1442
|
-
class
|
|
1446
|
+
class oo {
|
|
1443
1447
|
constructor(e = 9) {
|
|
1444
1448
|
this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
|
|
1445
1449
|
}
|
|
@@ -1449,12 +1453,12 @@ class no {
|
|
|
1449
1453
|
search(e) {
|
|
1450
1454
|
let n = this.data;
|
|
1451
1455
|
const o = [];
|
|
1452
|
-
if (!
|
|
1456
|
+
if (!bt(e, n)) return o;
|
|
1453
1457
|
const i = this.toBBox, s = [];
|
|
1454
1458
|
for (; n; ) {
|
|
1455
1459
|
for (let r = 0; r < n.children.length; r++) {
|
|
1456
1460
|
const a = n.children[r], l = n.leaf ? i(a) : a;
|
|
1457
|
-
|
|
1461
|
+
bt(e, l) && (n.leaf ? o.push(a) : Nt(e, l) ? this._all(a, o) : s.push(a));
|
|
1458
1462
|
}
|
|
1459
1463
|
n = s.pop();
|
|
1460
1464
|
}
|
|
@@ -1462,13 +1466,13 @@ class no {
|
|
|
1462
1466
|
}
|
|
1463
1467
|
collides(e) {
|
|
1464
1468
|
let n = this.data;
|
|
1465
|
-
if (!
|
|
1469
|
+
if (!bt(e, n)) return !1;
|
|
1466
1470
|
const o = [];
|
|
1467
1471
|
for (; n; ) {
|
|
1468
1472
|
for (let i = 0; i < n.children.length; i++) {
|
|
1469
1473
|
const s = n.children[i], r = n.leaf ? this.toBBox(s) : s;
|
|
1470
|
-
if (
|
|
1471
|
-
if (n.leaf ||
|
|
1474
|
+
if (bt(e, r)) {
|
|
1475
|
+
if (n.leaf || Nt(e, r)) return !0;
|
|
1472
1476
|
o.push(s);
|
|
1473
1477
|
}
|
|
1474
1478
|
}
|
|
@@ -1501,20 +1505,20 @@ class no {
|
|
|
1501
1505
|
return e && this._insert(e, this.data.height - 1), this;
|
|
1502
1506
|
}
|
|
1503
1507
|
clear() {
|
|
1504
|
-
return this.data =
|
|
1508
|
+
return this.data = tt([]), this;
|
|
1505
1509
|
}
|
|
1506
1510
|
remove(e, n) {
|
|
1507
1511
|
if (!e) return this;
|
|
1508
1512
|
let o = this.data;
|
|
1509
1513
|
const i = this.toBBox(e), s = [], r = [];
|
|
1510
|
-
let a, l,
|
|
1514
|
+
let a, l, f;
|
|
1511
1515
|
for (; o || s.length; ) {
|
|
1512
|
-
if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(),
|
|
1513
|
-
const
|
|
1514
|
-
if (
|
|
1515
|
-
return o.children.splice(
|
|
1516
|
+
if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(), f = !0), o.leaf) {
|
|
1517
|
+
const p = io(e, o.children, n);
|
|
1518
|
+
if (p !== -1)
|
|
1519
|
+
return o.children.splice(p, 1), s.push(o), this._condense(s), this;
|
|
1516
1520
|
}
|
|
1517
|
-
!
|
|
1521
|
+
!f && !o.leaf && Nt(o, i) ? (s.push(o), r.push(a), a = 0, l = o, o = o.children[0]) : l ? (a++, o = l.children[a], f = !1) : o = null;
|
|
1518
1522
|
}
|
|
1519
1523
|
return this;
|
|
1520
1524
|
}
|
|
@@ -1543,26 +1547,26 @@ class no {
|
|
|
1543
1547
|
const s = o - n + 1;
|
|
1544
1548
|
let r = this._maxEntries, a;
|
|
1545
1549
|
if (s <= r)
|
|
1546
|
-
return a =
|
|
1547
|
-
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a =
|
|
1548
|
-
const l = Math.ceil(s / r),
|
|
1549
|
-
|
|
1550
|
-
for (let
|
|
1551
|
-
const d = Math.min(
|
|
1552
|
-
|
|
1553
|
-
for (let
|
|
1554
|
-
const
|
|
1555
|
-
a.children.push(this._build(e,
|
|
1550
|
+
return a = tt(e.slice(n, o + 1)), Z(a, this.toBBox), a;
|
|
1551
|
+
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = tt([]), a.leaf = !1, a.height = i;
|
|
1552
|
+
const l = Math.ceil(s / r), f = l * Math.ceil(Math.sqrt(r));
|
|
1553
|
+
se(e, n, o, f, this.compareMinX);
|
|
1554
|
+
for (let p = n; p <= o; p += f) {
|
|
1555
|
+
const d = Math.min(p + f - 1, o);
|
|
1556
|
+
se(e, p, d, l, this.compareMinY);
|
|
1557
|
+
for (let h = p; h <= d; h += l) {
|
|
1558
|
+
const g = Math.min(h + l - 1, d);
|
|
1559
|
+
a.children.push(this._build(e, h, g, i - 1));
|
|
1556
1560
|
}
|
|
1557
1561
|
}
|
|
1558
|
-
return
|
|
1562
|
+
return Z(a, this.toBBox), a;
|
|
1559
1563
|
}
|
|
1560
1564
|
_chooseSubtree(e, n, o, i) {
|
|
1561
1565
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1562
1566
|
let s = 1 / 0, r = 1 / 0, a;
|
|
1563
1567
|
for (let l = 0; l < n.children.length; l++) {
|
|
1564
|
-
const
|
|
1565
|
-
d < r ? (r = d, s =
|
|
1568
|
+
const f = n.children[l], p = It(f), d = ao(e, f) - p;
|
|
1569
|
+
d < r ? (r = d, s = p < s ? p : s, a = f) : d === r && p < s && (s = p, a = f);
|
|
1566
1570
|
}
|
|
1567
1571
|
n = a || n.children[0];
|
|
1568
1572
|
}
|
|
@@ -1570,7 +1574,7 @@ class no {
|
|
|
1570
1574
|
}
|
|
1571
1575
|
_insert(e, n, o) {
|
|
1572
1576
|
const i = o ? e : this.toBBox(e), s = [], r = this._chooseSubtree(i, this.data, n, s);
|
|
1573
|
-
for (r.children.push(e),
|
|
1577
|
+
for (r.children.push(e), at(r, i); n >= 0 && s[n].children.length > this._maxEntries; )
|
|
1574
1578
|
this._split(s, n), n--;
|
|
1575
1579
|
this._adjustParentBBoxes(i, s, n);
|
|
1576
1580
|
}
|
|
@@ -1578,95 +1582,95 @@ class no {
|
|
|
1578
1582
|
_split(e, n) {
|
|
1579
1583
|
const o = e[n], i = o.children.length, s = this._minEntries;
|
|
1580
1584
|
this._chooseSplitAxis(o, s, i);
|
|
1581
|
-
const r = this._chooseSplitIndex(o, s, i), a =
|
|
1582
|
-
a.height = o.height, a.leaf = o.leaf,
|
|
1585
|
+
const r = this._chooseSplitIndex(o, s, i), a = tt(o.children.splice(r, o.children.length - r));
|
|
1586
|
+
a.height = o.height, a.leaf = o.leaf, Z(o, this.toBBox), Z(a, this.toBBox), n ? e[n - 1].children.push(a) : this._splitRoot(o, a);
|
|
1583
1587
|
}
|
|
1584
1588
|
_splitRoot(e, n) {
|
|
1585
|
-
this.data =
|
|
1589
|
+
this.data = tt([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, Z(this.data, this.toBBox);
|
|
1586
1590
|
}
|
|
1587
1591
|
_chooseSplitIndex(e, n, o) {
|
|
1588
1592
|
let i, s = 1 / 0, r = 1 / 0;
|
|
1589
1593
|
for (let a = n; a <= o - n; a++) {
|
|
1590
|
-
const l =
|
|
1591
|
-
|
|
1594
|
+
const l = rt(e, 0, a, this.toBBox), f = rt(e, a, o, this.toBBox), p = co(l, f), d = It(l) + It(f);
|
|
1595
|
+
p < s ? (s = p, i = a, r = d < r ? d : r) : p === s && d < r && (r = d, i = a);
|
|
1592
1596
|
}
|
|
1593
1597
|
return i || o - n;
|
|
1594
1598
|
}
|
|
1595
1599
|
// sorts node children by the best axis for split
|
|
1596
1600
|
_chooseSplitAxis(e, n, o) {
|
|
1597
|
-
const i = e.leaf ? this.compareMinX :
|
|
1601
|
+
const i = e.leaf ? this.compareMinX : so, s = e.leaf ? this.compareMinY : ro, r = this._allDistMargin(e, n, o, i), a = this._allDistMargin(e, n, o, s);
|
|
1598
1602
|
r < a && e.children.sort(i);
|
|
1599
1603
|
}
|
|
1600
1604
|
// total margin of all possible split distributions where each node is at least m full
|
|
1601
1605
|
_allDistMargin(e, n, o, i) {
|
|
1602
1606
|
e.children.sort(i);
|
|
1603
|
-
const s = this.toBBox, r =
|
|
1604
|
-
let l =
|
|
1605
|
-
for (let
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1607
|
+
const s = this.toBBox, r = rt(e, 0, n, s), a = rt(e, o - n, o, s);
|
|
1608
|
+
let l = yt(r) + yt(a);
|
|
1609
|
+
for (let f = n; f < o - n; f++) {
|
|
1610
|
+
const p = e.children[f];
|
|
1611
|
+
at(r, e.leaf ? s(p) : p), l += yt(r);
|
|
1608
1612
|
}
|
|
1609
|
-
for (let
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1613
|
+
for (let f = o - n - 1; f >= n; f--) {
|
|
1614
|
+
const p = e.children[f];
|
|
1615
|
+
at(a, e.leaf ? s(p) : p), l += yt(a);
|
|
1612
1616
|
}
|
|
1613
1617
|
return l;
|
|
1614
1618
|
}
|
|
1615
1619
|
_adjustParentBBoxes(e, n, o) {
|
|
1616
1620
|
for (let i = o; i >= 0; i--)
|
|
1617
|
-
|
|
1621
|
+
at(n[i], e);
|
|
1618
1622
|
}
|
|
1619
1623
|
_condense(e) {
|
|
1620
1624
|
for (let n = e.length - 1, o; n >= 0; n--)
|
|
1621
|
-
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() :
|
|
1625
|
+
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : Z(e[n], this.toBBox);
|
|
1622
1626
|
}
|
|
1623
1627
|
}
|
|
1624
|
-
function
|
|
1628
|
+
function io(t, e, n) {
|
|
1625
1629
|
if (!n) return e.indexOf(t);
|
|
1626
1630
|
for (let o = 0; o < e.length; o++)
|
|
1627
1631
|
if (n(t, e[o])) return o;
|
|
1628
1632
|
return -1;
|
|
1629
1633
|
}
|
|
1630
|
-
function
|
|
1631
|
-
|
|
1634
|
+
function Z(t, e) {
|
|
1635
|
+
rt(t, 0, t.children.length, e, t);
|
|
1632
1636
|
}
|
|
1633
|
-
function
|
|
1634
|
-
i || (i =
|
|
1637
|
+
function rt(t, e, n, o, i) {
|
|
1638
|
+
i || (i = tt(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
1635
1639
|
for (let s = e; s < n; s++) {
|
|
1636
1640
|
const r = t.children[s];
|
|
1637
|
-
|
|
1641
|
+
at(i, t.leaf ? o(r) : r);
|
|
1638
1642
|
}
|
|
1639
1643
|
return i;
|
|
1640
1644
|
}
|
|
1641
|
-
function
|
|
1645
|
+
function at(t, e) {
|
|
1642
1646
|
return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
|
|
1643
1647
|
}
|
|
1644
|
-
function
|
|
1648
|
+
function so(t, e) {
|
|
1645
1649
|
return t.minX - e.minX;
|
|
1646
1650
|
}
|
|
1647
|
-
function
|
|
1651
|
+
function ro(t, e) {
|
|
1648
1652
|
return t.minY - e.minY;
|
|
1649
1653
|
}
|
|
1650
|
-
function
|
|
1654
|
+
function It(t) {
|
|
1651
1655
|
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
1652
1656
|
}
|
|
1653
|
-
function
|
|
1657
|
+
function yt(t) {
|
|
1654
1658
|
return t.maxX - t.minX + (t.maxY - t.minY);
|
|
1655
1659
|
}
|
|
1656
|
-
function
|
|
1660
|
+
function ao(t, e) {
|
|
1657
1661
|
return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
|
|
1658
1662
|
}
|
|
1659
|
-
function
|
|
1663
|
+
function co(t, e) {
|
|
1660
1664
|
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);
|
|
1661
1665
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
1662
1666
|
}
|
|
1663
|
-
function
|
|
1667
|
+
function Nt(t, e) {
|
|
1664
1668
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1665
1669
|
}
|
|
1666
|
-
function
|
|
1670
|
+
function bt(t, e) {
|
|
1667
1671
|
return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
|
|
1668
1672
|
}
|
|
1669
|
-
function
|
|
1673
|
+
function tt(t) {
|
|
1670
1674
|
return {
|
|
1671
1675
|
children: t,
|
|
1672
1676
|
height: 1,
|
|
@@ -1677,15 +1681,15 @@ function J(t) {
|
|
|
1677
1681
|
maxY: -1 / 0
|
|
1678
1682
|
};
|
|
1679
1683
|
}
|
|
1680
|
-
function
|
|
1684
|
+
function se(t, e, n, o, i) {
|
|
1681
1685
|
const s = [e, n];
|
|
1682
1686
|
for (; s.length; ) {
|
|
1683
1687
|
if (n = s.pop(), e = s.pop(), n - e <= o) continue;
|
|
1684
1688
|
const r = e + Math.ceil((n - e) / o / 2) * o;
|
|
1685
|
-
|
|
1689
|
+
ve(t, r, e, n, i), s.push(e, r, r, n);
|
|
1686
1690
|
}
|
|
1687
1691
|
}
|
|
1688
|
-
let
|
|
1692
|
+
let lo = () => ({
|
|
1689
1693
|
emit(t, ...e) {
|
|
1690
1694
|
for (let n = 0, o = this.events[t] || [], i = o.length; n < i; n++)
|
|
1691
1695
|
o[n](...e);
|
|
@@ -1699,22 +1703,22 @@ let co = () => ({
|
|
|
1699
1703
|
};
|
|
1700
1704
|
}
|
|
1701
1705
|
});
|
|
1702
|
-
const
|
|
1703
|
-
const n = new
|
|
1704
|
-
const
|
|
1705
|
-
const T = F([
|
|
1706
|
+
const uo = (t, e) => {
|
|
1707
|
+
const n = new oo(), o = /* @__PURE__ */ new Map(), i = lo(), s = (y, S) => {
|
|
1708
|
+
const x = y.selector.flatMap((O) => {
|
|
1709
|
+
const T = F([O]) ? O.range : ue(O, e).range;
|
|
1706
1710
|
return Array.from(T.getClientRects());
|
|
1707
|
-
}),
|
|
1708
|
-
return
|
|
1709
|
-
const { x: T, y:
|
|
1711
|
+
}), L = Xe(x).map((O) => He(O, S));
|
|
1712
|
+
return L.map((O) => {
|
|
1713
|
+
const { x: T, y: M, width: w, height: v } = O;
|
|
1710
1714
|
return {
|
|
1711
1715
|
minX: T,
|
|
1712
|
-
minY:
|
|
1713
|
-
maxX: T +
|
|
1714
|
-
maxY:
|
|
1716
|
+
minY: M,
|
|
1717
|
+
maxX: T + w,
|
|
1718
|
+
maxY: M + v,
|
|
1715
1719
|
annotation: {
|
|
1716
1720
|
id: y.annotation,
|
|
1717
|
-
rects:
|
|
1721
|
+
rects: L
|
|
1718
1722
|
}
|
|
1719
1723
|
};
|
|
1720
1724
|
});
|
|
@@ -1722,169 +1726,172 @@ const lo = (t, e) => {
|
|
|
1722
1726
|
n.clear(), o.clear();
|
|
1723
1727
|
}, l = (y) => {
|
|
1724
1728
|
const S = s(y, e.getBoundingClientRect());
|
|
1725
|
-
S.forEach((
|
|
1726
|
-
}, c = (y) => {
|
|
1727
|
-
const S = o.get(y.annotation);
|
|
1728
|
-
S && (S.forEach((E) => n.remove(E)), o.delete(y.annotation));
|
|
1729
|
+
S.forEach((x) => n.insert(x)), o.set(y.annotation, S);
|
|
1729
1730
|
}, f = (y) => {
|
|
1730
|
-
|
|
1731
|
+
const S = o.get(y.annotation);
|
|
1732
|
+
S && (S.forEach((x) => n.remove(x)), o.delete(y.annotation));
|
|
1733
|
+
}, p = (y) => {
|
|
1734
|
+
f(y), l(y);
|
|
1731
1735
|
}, d = (y, S = !0) => {
|
|
1732
1736
|
S && a();
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1735
|
-
const
|
|
1736
|
-
n.load(
|
|
1737
|
-
},
|
|
1738
|
-
const
|
|
1737
|
+
const x = e.getBoundingClientRect(), L = y.map((T) => ({ target: T, rects: s(T, x) }));
|
|
1738
|
+
L.forEach(({ target: T, rects: M }) => o.set(T.annotation, M));
|
|
1739
|
+
const O = L.flatMap(({ rects: T }) => T);
|
|
1740
|
+
n.load(O);
|
|
1741
|
+
}, h = (y, S, x = !1) => {
|
|
1742
|
+
const L = n.search({
|
|
1739
1743
|
minX: y,
|
|
1740
1744
|
minY: S,
|
|
1741
1745
|
maxX: y,
|
|
1742
1746
|
maxY: S
|
|
1743
|
-
}),
|
|
1744
|
-
return
|
|
1745
|
-
},
|
|
1746
|
-
const S =
|
|
1747
|
+
}), O = (T) => T.annotation.rects.reduce((M, w) => M + w.width * w.height, 0);
|
|
1748
|
+
return L.length > 0 ? (L.sort((T, M) => O(T) - O(M)), x ? L.map((T) => T.annotation.id) : [L[0].annotation.id]) : [];
|
|
1749
|
+
}, g = (y) => {
|
|
1750
|
+
const S = b(y);
|
|
1747
1751
|
if (S.length === 0)
|
|
1748
1752
|
return;
|
|
1749
|
-
let
|
|
1750
|
-
for (let
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
+
let x = S[0].left, L = S[0].top, O = S[0].right, T = S[0].bottom;
|
|
1754
|
+
for (let M = 1; M < S.length; M++) {
|
|
1755
|
+
const w = S[M];
|
|
1756
|
+
x = Math.min(x, w.left), L = Math.min(L, w.top), O = Math.max(O, w.right), T = Math.max(T, w.bottom);
|
|
1753
1757
|
}
|
|
1754
|
-
return new DOMRect(
|
|
1755
|
-
},
|
|
1758
|
+
return new DOMRect(x, L, O - x, T - L);
|
|
1759
|
+
}, b = (y) => {
|
|
1756
1760
|
const S = o.get(y);
|
|
1757
1761
|
return S[0] ? S[0].annotation.rects : [];
|
|
1758
1762
|
};
|
|
1759
1763
|
return {
|
|
1760
1764
|
all: r,
|
|
1761
1765
|
clear: a,
|
|
1762
|
-
getAt:
|
|
1763
|
-
getAnnotationBounds:
|
|
1764
|
-
getAnnotationRects:
|
|
1765
|
-
getIntersecting: (y, S,
|
|
1766
|
-
const
|
|
1767
|
-
return Array.from(T).map((
|
|
1768
|
-
annotation: t.getAnnotation(
|
|
1769
|
-
rects:
|
|
1770
|
-
})).filter((
|
|
1766
|
+
getAt: h,
|
|
1767
|
+
getAnnotationBounds: g,
|
|
1768
|
+
getAnnotationRects: b,
|
|
1769
|
+
getIntersecting: (y, S, x, L) => {
|
|
1770
|
+
const O = n.search({ minX: y, minY: S, maxX: x, maxY: L }), T = new Set(O.map((M) => M.annotation.id));
|
|
1771
|
+
return Array.from(T).map((M) => ({
|
|
1772
|
+
annotation: t.getAnnotation(M),
|
|
1773
|
+
rects: b(M)
|
|
1774
|
+
})).filter((M) => !!M.annotation);
|
|
1771
1775
|
},
|
|
1772
1776
|
insert: l,
|
|
1773
1777
|
recalculate: () => {
|
|
1774
1778
|
d(t.all().map((y) => y.target), !0), i.emit("recalculate");
|
|
1775
1779
|
},
|
|
1776
|
-
remove:
|
|
1780
|
+
remove: f,
|
|
1777
1781
|
set: d,
|
|
1778
1782
|
size: () => n.all().length,
|
|
1779
|
-
update:
|
|
1783
|
+
update: p,
|
|
1780
1784
|
on: (y, S) => i.on(y, S)
|
|
1781
1785
|
};
|
|
1782
|
-
},
|
|
1783
|
-
const n =
|
|
1786
|
+
}, fo = (t, e) => {
|
|
1787
|
+
const n = _n(), o = uo(n, t), i = En(n);
|
|
1784
1788
|
i.setUserSelectAction(e);
|
|
1785
|
-
const s =
|
|
1786
|
-
const S =
|
|
1787
|
-
return
|
|
1788
|
-
}, l = (
|
|
1789
|
-
const
|
|
1790
|
-
return n.bulkAddAnnotation(
|
|
1791
|
-
},
|
|
1792
|
-
const S =
|
|
1793
|
-
return S.forEach((
|
|
1794
|
-
n.getAnnotation(
|
|
1795
|
-
}),
|
|
1796
|
-
},
|
|
1797
|
-
const S =
|
|
1789
|
+
const s = xn(n), r = Yn(), a = (c, y = k.LOCAL) => {
|
|
1790
|
+
const S = Et(c, t), x = F(S.target.selector);
|
|
1791
|
+
return x && n.addAnnotation(S, y), x;
|
|
1792
|
+
}, l = (c, y = !0, S = k.LOCAL) => {
|
|
1793
|
+
const x = c.map((O) => Et(O, t)), L = x.filter((O) => !F(O.target.selector));
|
|
1794
|
+
return n.bulkAddAnnotation(x, y, S), L;
|
|
1795
|
+
}, f = (c, y = k.LOCAL) => {
|
|
1796
|
+
const S = c.map((L) => Et(L, t)), x = S.filter((L) => !F(L.target.selector));
|
|
1797
|
+
return S.forEach((L) => {
|
|
1798
|
+
n.getAnnotation(L.id) ? n.updateAnnotation(L, y) : n.addAnnotation(L, y);
|
|
1799
|
+
}), x;
|
|
1800
|
+
}, p = (c, y = k.LOCAL) => {
|
|
1801
|
+
const S = At(c, t);
|
|
1798
1802
|
n.updateTarget(S, y);
|
|
1799
|
-
}, d = (
|
|
1800
|
-
const S =
|
|
1803
|
+
}, d = (c, y = k.LOCAL) => {
|
|
1804
|
+
const S = c.map((x) => At(x, t));
|
|
1801
1805
|
n.bulkUpdateTargets(S, y);
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1806
|
+
};
|
|
1807
|
+
function h(c, y, S, x) {
|
|
1808
|
+
const L = S || !!x, O = o.getAt(c, y, L).map((M) => n.getAnnotation(M)), T = x ? O.filter(x) : O;
|
|
1809
|
+
if (T.length !== 0)
|
|
1810
|
+
return S ? T : T[0];
|
|
1811
|
+
}
|
|
1812
|
+
const g = (c, y, S, x = 5) => {
|
|
1813
|
+
const L = o.getAnnotationRects(c);
|
|
1814
|
+
if (L.length !== 0) {
|
|
1808
1815
|
if (y && S) {
|
|
1809
|
-
const
|
|
1810
|
-
if (
|
|
1816
|
+
const O = L.find(({ top: T, right: M, bottom: w, left: v }) => y >= v - x && y <= M + x && S >= T - x && S <= w + x);
|
|
1817
|
+
if (O) return O;
|
|
1811
1818
|
}
|
|
1812
|
-
return o.getAnnotationBounds(
|
|
1819
|
+
return o.getAnnotationBounds(c);
|
|
1813
1820
|
}
|
|
1814
|
-
},
|
|
1815
|
-
return n.observe(({ changes:
|
|
1816
|
-
const y = (
|
|
1817
|
-
(y == null ? void 0 : y.length) > 0 && y.forEach((
|
|
1821
|
+
}, b = (c, y, S, x) => o.getIntersecting(c, y, S, x), A = (c) => o.getAnnotationRects(c), C = () => o.recalculate(), m = (c) => o.on("recalculate", c);
|
|
1822
|
+
return n.observe(({ changes: c }) => {
|
|
1823
|
+
const y = (c.deleted || []).filter((L) => F(L.target.selector)), S = (c.created || []).filter((L) => F(L.target.selector)), x = (c.updated || []).filter((L) => F(L.newValue.target.selector));
|
|
1824
|
+
(y == null ? void 0 : y.length) > 0 && y.forEach((L) => o.remove(L.target)), S.length > 0 && o.set(S.map((L) => L.target), !1), (x == null ? void 0 : x.length) > 0 && x.forEach(({ newValue: L }) => o.update(L.target));
|
|
1818
1825
|
}), {
|
|
1819
1826
|
store: {
|
|
1820
1827
|
...n,
|
|
1821
1828
|
addAnnotation: a,
|
|
1822
1829
|
bulkAddAnnotation: l,
|
|
1823
1830
|
bulkUpdateTargets: d,
|
|
1824
|
-
bulkUpsertAnnotations:
|
|
1825
|
-
getAnnotationBounds:
|
|
1826
|
-
getAnnotationRects:
|
|
1827
|
-
getIntersecting:
|
|
1828
|
-
getAt:
|
|
1831
|
+
bulkUpsertAnnotations: f,
|
|
1832
|
+
getAnnotationBounds: g,
|
|
1833
|
+
getAnnotationRects: A,
|
|
1834
|
+
getIntersecting: b,
|
|
1835
|
+
getAt: h,
|
|
1829
1836
|
recalculatePositions: C,
|
|
1830
|
-
onRecalculatePositions:
|
|
1831
|
-
updateTarget:
|
|
1837
|
+
onRecalculatePositions: m,
|
|
1838
|
+
updateTarget: p
|
|
1832
1839
|
},
|
|
1833
1840
|
selection: i,
|
|
1834
1841
|
hover: s,
|
|
1835
1842
|
viewport: r
|
|
1836
1843
|
};
|
|
1837
|
-
},
|
|
1844
|
+
}, ho = () => {
|
|
1838
1845
|
const t = document.createElement("canvas");
|
|
1839
1846
|
t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = "r6o-presence-layer";
|
|
1840
1847
|
const e = t.getContext("2d");
|
|
1841
1848
|
return e.scale(2, 2), e.translate(0.5, 0.5), t;
|
|
1842
|
-
},
|
|
1843
|
-
const n =
|
|
1849
|
+
}, po = (t, e = {}) => {
|
|
1850
|
+
const n = ho(), o = n.getContext("2d");
|
|
1844
1851
|
document.body.appendChild(n);
|
|
1845
|
-
const i = /* @__PURE__ */ new Map(), s = (
|
|
1846
|
-
return t.on("selectionChange", (
|
|
1847
|
-
s(
|
|
1852
|
+
const i = /* @__PURE__ */ new Map(), s = (p) => Array.from(i.entries()).filter(([d, h]) => h.presenceKey === p.presenceKey).map(([d, h]) => d);
|
|
1853
|
+
return t.on("selectionChange", (p, d) => {
|
|
1854
|
+
s(p).forEach((g) => i.delete(g)), d && d.forEach((g) => i.set(g, p));
|
|
1848
1855
|
}), {
|
|
1849
1856
|
clear: () => {
|
|
1850
|
-
const { width:
|
|
1851
|
-
o.clearRect(-0.5, -0.5,
|
|
1857
|
+
const { width: p, height: d } = n;
|
|
1858
|
+
o.clearRect(-0.5, -0.5, p + 1, d + 1);
|
|
1852
1859
|
},
|
|
1853
1860
|
destroy: () => {
|
|
1854
1861
|
n.remove();
|
|
1855
1862
|
},
|
|
1856
|
-
paint: (
|
|
1863
|
+
paint: (p, d, h) => {
|
|
1857
1864
|
e.font && (o.font = e.font);
|
|
1858
|
-
const
|
|
1859
|
-
if (
|
|
1860
|
-
const { height:
|
|
1861
|
-
o.fillStyle =
|
|
1862
|
-
const
|
|
1863
|
-
return o.fillRect(
|
|
1864
|
-
fill:
|
|
1865
|
-
fillOpacity:
|
|
1865
|
+
const g = i.get(p.annotation.id);
|
|
1866
|
+
if (g) {
|
|
1867
|
+
const { height: b } = p.rects[0], A = p.rects[0].x + d.left, C = p.rects[0].y + d.top;
|
|
1868
|
+
o.fillStyle = g.appearance.color, o.fillRect(A - 2, C - 2.5, 2, b + 5);
|
|
1869
|
+
const m = o.measureText(g.appearance.label), c = m.width + 6, y = m.actualBoundingBoxAscent + m.actualBoundingBoxDescent + 8, S = m.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1870
|
+
return o.fillRect(A - 2, C - 2.5 - y, c, y), o.fillStyle = "#fff", o.fillText(g.appearance.label, A + 1, C - S), {
|
|
1871
|
+
fill: g.appearance.color,
|
|
1872
|
+
fillOpacity: h ? 0.45 : 0.18
|
|
1866
1873
|
};
|
|
1867
1874
|
}
|
|
1868
1875
|
},
|
|
1869
1876
|
reset: () => {
|
|
1870
1877
|
n.width = 2 * window.innerWidth, n.height = 2 * window.innerHeight;
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1878
|
+
const p = n.getContext("2d");
|
|
1879
|
+
p.scale(2, 2), p.translate(0.5, 0.5);
|
|
1873
1880
|
}
|
|
1874
1881
|
};
|
|
1875
|
-
},
|
|
1876
|
-
function
|
|
1882
|
+
}, _t = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1;
|
|
1883
|
+
function Ut(t, e, n, o) {
|
|
1877
1884
|
t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent("on".concat(e), n);
|
|
1878
1885
|
}
|
|
1879
|
-
function
|
|
1886
|
+
function it(t, e, n, o) {
|
|
1880
1887
|
t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent("on".concat(e), n);
|
|
1881
1888
|
}
|
|
1882
|
-
function
|
|
1889
|
+
function Ee(t, e) {
|
|
1883
1890
|
const n = e.slice(0, e.length - 1);
|
|
1884
1891
|
for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];
|
|
1885
1892
|
return n;
|
|
1886
1893
|
}
|
|
1887
|
-
function
|
|
1894
|
+
function Se(t) {
|
|
1888
1895
|
typeof t != "string" && (t = ""), t = t.replace(/\s/g, "");
|
|
1889
1896
|
const e = t.split(",");
|
|
1890
1897
|
let n = e.lastIndexOf("");
|
|
@@ -1892,14 +1899,14 @@ function Ae(t) {
|
|
|
1892
1899
|
e[n - 1] += ",", e.splice(n, 1), n = e.lastIndexOf("");
|
|
1893
1900
|
return e;
|
|
1894
1901
|
}
|
|
1895
|
-
function
|
|
1902
|
+
function go(t, e) {
|
|
1896
1903
|
const n = t.length >= e.length ? t : e, o = t.length >= e.length ? e : t;
|
|
1897
1904
|
let i = !0;
|
|
1898
1905
|
for (let s = 0; s < n.length; s++)
|
|
1899
1906
|
o.indexOf(n[s]) === -1 && (i = !1);
|
|
1900
1907
|
return i;
|
|
1901
1908
|
}
|
|
1902
|
-
const
|
|
1909
|
+
const dt = {
|
|
1903
1910
|
backspace: 8,
|
|
1904
1911
|
"⌫": 8,
|
|
1905
1912
|
tab: 9,
|
|
@@ -1944,9 +1951,9 @@ const at = {
|
|
|
1944
1951
|
".": 190,
|
|
1945
1952
|
"/": 191,
|
|
1946
1953
|
"`": 192,
|
|
1947
|
-
"-":
|
|
1948
|
-
"=":
|
|
1949
|
-
";":
|
|
1954
|
+
"-": _t ? 173 : 189,
|
|
1955
|
+
"=": _t ? 61 : 187,
|
|
1956
|
+
";": _t ? 59 : 186,
|
|
1950
1957
|
"'": 222,
|
|
1951
1958
|
"[": 219,
|
|
1952
1959
|
"]": 221,
|
|
@@ -1967,7 +1974,7 @@ const at = {
|
|
|
1967
1974
|
"⌘": 91,
|
|
1968
1975
|
cmd: 91,
|
|
1969
1976
|
command: 91
|
|
1970
|
-
},
|
|
1977
|
+
}, Kt = {
|
|
1971
1978
|
16: "shiftKey",
|
|
1972
1979
|
18: "altKey",
|
|
1973
1980
|
17: "ctrlKey",
|
|
@@ -1976,29 +1983,29 @@ const at = {
|
|
|
1976
1983
|
ctrlKey: 17,
|
|
1977
1984
|
altKey: 18,
|
|
1978
1985
|
metaKey: 91
|
|
1979
|
-
},
|
|
1986
|
+
}, K = {
|
|
1980
1987
|
16: !1,
|
|
1981
1988
|
18: !1,
|
|
1982
1989
|
17: !1,
|
|
1983
1990
|
91: !1
|
|
1984
1991
|
}, N = {};
|
|
1985
1992
|
for (let t = 1; t < 20; t++)
|
|
1986
|
-
|
|
1987
|
-
let I = [],
|
|
1988
|
-
const z = /* @__PURE__ */ new Map(),
|
|
1989
|
-
function
|
|
1990
|
-
|
|
1993
|
+
dt["f".concat(t)] = 111 + t;
|
|
1994
|
+
let I = [], lt = null, Ce = "all";
|
|
1995
|
+
const z = /* @__PURE__ */ new Map(), ft = (t) => dt[t.toLowerCase()] || j[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), mo = (t) => Object.keys(dt).find((e) => dt[e] === t), yo = (t) => Object.keys(j).find((e) => j[e] === t);
|
|
1996
|
+
function Le(t) {
|
|
1997
|
+
Ce = t || "all";
|
|
1991
1998
|
}
|
|
1992
|
-
function
|
|
1993
|
-
return
|
|
1994
|
-
}
|
|
1995
|
-
function yo() {
|
|
1996
|
-
return I.slice(0);
|
|
1999
|
+
function ut() {
|
|
2000
|
+
return Ce || "all";
|
|
1997
2001
|
}
|
|
1998
2002
|
function bo() {
|
|
1999
|
-
return I.
|
|
2003
|
+
return I.slice(0);
|
|
2000
2004
|
}
|
|
2001
2005
|
function wo() {
|
|
2006
|
+
return I.map((t) => mo(t) || yo(t) || String.fromCharCode(t));
|
|
2007
|
+
}
|
|
2008
|
+
function Ao() {
|
|
2002
2009
|
const t = [];
|
|
2003
2010
|
return Object.keys(N).forEach((e) => {
|
|
2004
2011
|
N[e].forEach((n) => {
|
|
@@ -2012,12 +2019,12 @@ function wo() {
|
|
|
2012
2019
|
scope: i,
|
|
2013
2020
|
shortcut: r,
|
|
2014
2021
|
mods: s,
|
|
2015
|
-
keys: o.split("+").map((a) =>
|
|
2022
|
+
keys: o.split("+").map((a) => ft(a))
|
|
2016
2023
|
});
|
|
2017
2024
|
});
|
|
2018
2025
|
}), t;
|
|
2019
2026
|
}
|
|
2020
|
-
function
|
|
2027
|
+
function xo(t) {
|
|
2021
2028
|
const e = t.target || t.srcElement, {
|
|
2022
2029
|
tagName: n
|
|
2023
2030
|
} = e;
|
|
@@ -2025,12 +2032,12 @@ function vo(t) {
|
|
|
2025
2032
|
const i = n === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(e.type);
|
|
2026
2033
|
return (e.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !e.readOnly) && (o = !1), o;
|
|
2027
2034
|
}
|
|
2028
|
-
function
|
|
2029
|
-
return typeof t == "string" && (t =
|
|
2035
|
+
function vo(t) {
|
|
2036
|
+
return typeof t == "string" && (t = ft(t)), I.indexOf(t) !== -1;
|
|
2030
2037
|
}
|
|
2031
|
-
function
|
|
2038
|
+
function Eo(t, e) {
|
|
2032
2039
|
let n, o;
|
|
2033
|
-
t || (t =
|
|
2040
|
+
t || (t = ut());
|
|
2034
2041
|
for (const i in N)
|
|
2035
2042
|
if (Object.prototype.hasOwnProperty.call(N, i))
|
|
2036
2043
|
for (n = N[i], o = 0; o < n.length; )
|
|
@@ -2038,34 +2045,34 @@ function xo(t, e) {
|
|
|
2038
2045
|
let {
|
|
2039
2046
|
element: a
|
|
2040
2047
|
} = r;
|
|
2041
|
-
return
|
|
2048
|
+
return Ht(a);
|
|
2042
2049
|
}) : o++;
|
|
2043
|
-
|
|
2050
|
+
ut() === t && Le(e || "all");
|
|
2044
2051
|
}
|
|
2045
|
-
function
|
|
2052
|
+
function So(t) {
|
|
2046
2053
|
let e = t.keyCode || t.which || t.charCode;
|
|
2047
2054
|
const n = I.indexOf(e);
|
|
2048
|
-
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
|
|
2049
|
-
|
|
2055
|
+
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) {
|
|
2056
|
+
K[e] = !1;
|
|
2050
2057
|
for (const o in j) j[o] === e && (P[o] = !1);
|
|
2051
2058
|
}
|
|
2052
2059
|
}
|
|
2053
|
-
function
|
|
2060
|
+
function Te(t) {
|
|
2054
2061
|
if (typeof t > "u")
|
|
2055
2062
|
Object.keys(N).forEach((i) => {
|
|
2056
|
-
Array.isArray(N[i]) && N[i].forEach((s) =>
|
|
2057
|
-
}),
|
|
2063
|
+
Array.isArray(N[i]) && N[i].forEach((s) => wt(s)), delete N[i];
|
|
2064
|
+
}), Ht(null);
|
|
2058
2065
|
else if (Array.isArray(t))
|
|
2059
2066
|
t.forEach((i) => {
|
|
2060
|
-
i.key &&
|
|
2067
|
+
i.key && wt(i);
|
|
2061
2068
|
});
|
|
2062
2069
|
else if (typeof t == "object")
|
|
2063
|
-
t.key &&
|
|
2070
|
+
t.key && wt(t);
|
|
2064
2071
|
else if (typeof t == "string") {
|
|
2065
2072
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++)
|
|
2066
2073
|
n[o - 1] = arguments[o];
|
|
2067
2074
|
let [i, s] = n;
|
|
2068
|
-
typeof i == "function" && (s = i, i = ""),
|
|
2075
|
+
typeof i == "function" && (s = i, i = ""), wt({
|
|
2069
2076
|
key: t,
|
|
2070
2077
|
scope: i,
|
|
2071
2078
|
method: s,
|
|
@@ -2073,110 +2080,110 @@ function Se(t) {
|
|
|
2073
2080
|
});
|
|
2074
2081
|
}
|
|
2075
2082
|
}
|
|
2076
|
-
const
|
|
2083
|
+
const wt = (t) => {
|
|
2077
2084
|
let {
|
|
2078
2085
|
key: e,
|
|
2079
2086
|
scope: n,
|
|
2080
2087
|
method: o,
|
|
2081
2088
|
splitKey: i = "+"
|
|
2082
2089
|
} = t;
|
|
2083
|
-
|
|
2084
|
-
const a = r.split(i), l = a.length,
|
|
2085
|
-
if (!N[
|
|
2086
|
-
n || (n =
|
|
2087
|
-
const d = l > 1 ?
|
|
2088
|
-
N[
|
|
2089
|
-
const
|
|
2090
|
-
return
|
|
2091
|
-
}),
|
|
2090
|
+
Se(e).forEach((r) => {
|
|
2091
|
+
const a = r.split(i), l = a.length, f = a[l - 1], p = f === "*" ? "*" : ft(f);
|
|
2092
|
+
if (!N[p]) return;
|
|
2093
|
+
n || (n = ut());
|
|
2094
|
+
const d = l > 1 ? Ee(j, a) : [], h = [];
|
|
2095
|
+
N[p] = N[p].filter((g) => {
|
|
2096
|
+
const A = (o ? g.method === o : !0) && g.scope === n && go(g.mods, d);
|
|
2097
|
+
return A && h.push(g.element), !A;
|
|
2098
|
+
}), h.forEach((g) => Ht(g));
|
|
2092
2099
|
});
|
|
2093
2100
|
};
|
|
2094
|
-
function
|
|
2101
|
+
function re(t, e, n, o) {
|
|
2095
2102
|
if (e.element !== o)
|
|
2096
2103
|
return;
|
|
2097
2104
|
let i;
|
|
2098
2105
|
if (e.scope === n || e.scope === "all") {
|
|
2099
2106
|
i = e.mods.length > 0;
|
|
2100
|
-
for (const s in
|
|
2101
|
-
Object.prototype.hasOwnProperty.call(
|
|
2102
|
-
(e.mods.length === 0 && !
|
|
2107
|
+
for (const s in K)
|
|
2108
|
+
Object.prototype.hasOwnProperty.call(K, s) && (!K[s] && e.mods.indexOf(+s) > -1 || K[s] && e.mods.indexOf(+s) === -1) && (i = !1);
|
|
2109
|
+
(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)));
|
|
2103
2110
|
}
|
|
2104
2111
|
}
|
|
2105
|
-
function
|
|
2112
|
+
function ae(t, e) {
|
|
2106
2113
|
const n = N["*"];
|
|
2107
2114
|
let o = t.keyCode || t.which || t.charCode;
|
|
2108
2115
|
if (!P.filter.call(this, t)) return;
|
|
2109
2116
|
if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
|
|
2110
|
-
const l =
|
|
2117
|
+
const l = Kt[a];
|
|
2111
2118
|
t[a] && I.indexOf(l) === -1 ? I.push(l) : !t[a] && I.indexOf(l) > -1 ? I.splice(I.indexOf(l), 1) : a === "metaKey" && t[a] && I.length === 3 && (t.ctrlKey || t.shiftKey || t.altKey || (I = I.slice(I.indexOf(l))));
|
|
2112
|
-
}), o in
|
|
2113
|
-
|
|
2119
|
+
}), o in K) {
|
|
2120
|
+
K[o] = !0;
|
|
2114
2121
|
for (const a in j)
|
|
2115
2122
|
j[a] === o && (P[a] = !0);
|
|
2116
2123
|
if (!n) return;
|
|
2117
2124
|
}
|
|
2118
|
-
for (const a in
|
|
2119
|
-
Object.prototype.hasOwnProperty.call(
|
|
2120
|
-
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18),
|
|
2121
|
-
const i =
|
|
2125
|
+
for (const a in K)
|
|
2126
|
+
Object.prototype.hasOwnProperty.call(K, a) && (K[a] = t[Kt[a]]);
|
|
2127
|
+
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);
|
|
2128
|
+
const i = ut();
|
|
2122
2129
|
if (n)
|
|
2123
2130
|
for (let a = 0; a < n.length; a++)
|
|
2124
|
-
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) &&
|
|
2131
|
+
n[a].scope === i && (t.type === "keydown" && n[a].keydown || t.type === "keyup" && n[a].keyup) && re(t, n[a], i, e);
|
|
2125
2132
|
if (!(o in N)) return;
|
|
2126
2133
|
const s = N[o], r = s.length;
|
|
2127
2134
|
for (let a = 0; a < r; a++)
|
|
2128
2135
|
if ((t.type === "keydown" && s[a].keydown || t.type === "keyup" && s[a].keyup) && s[a].key) {
|
|
2129
2136
|
const l = s[a], {
|
|
2130
|
-
splitKey:
|
|
2131
|
-
} = l,
|
|
2132
|
-
for (let
|
|
2133
|
-
d.push(
|
|
2134
|
-
d.sort().join("") === I.sort().join("") &&
|
|
2137
|
+
splitKey: f
|
|
2138
|
+
} = l, p = l.key.split(f), d = [];
|
|
2139
|
+
for (let h = 0; h < p.length; h++)
|
|
2140
|
+
d.push(ft(p[h]));
|
|
2141
|
+
d.sort().join("") === I.sort().join("") && re(t, l, i, e);
|
|
2135
2142
|
}
|
|
2136
2143
|
}
|
|
2137
2144
|
function P(t, e, n) {
|
|
2138
2145
|
I = [];
|
|
2139
|
-
const o =
|
|
2140
|
-
let i = [], s = "all", r = document, a = 0, l = !1,
|
|
2141
|
-
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (r = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (
|
|
2142
|
-
t = o[a].split(
|
|
2146
|
+
const o = Se(t);
|
|
2147
|
+
let i = [], s = "all", r = document, a = 0, l = !1, f = !0, p = "+", d = !1, h = !1;
|
|
2148
|
+
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (r = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (f = e.keydown), e.capture !== void 0 && (d = e.capture), typeof e.splitKey == "string" && (p = e.splitKey), e.single === !0 && (h = !0)), typeof e == "string" && (s = e), h && Te(t, s); a < o.length; a++)
|
|
2149
|
+
t = o[a].split(p), i = [], t.length > 1 && (i = Ee(j, t)), t = t[t.length - 1], t = t === "*" ? "*" : ft(t), t in N || (N[t] = []), N[t].push({
|
|
2143
2150
|
keyup: l,
|
|
2144
|
-
keydown:
|
|
2151
|
+
keydown: f,
|
|
2145
2152
|
scope: s,
|
|
2146
2153
|
mods: i,
|
|
2147
2154
|
shortcut: o[a],
|
|
2148
2155
|
method: n,
|
|
2149
2156
|
key: o[a],
|
|
2150
|
-
splitKey:
|
|
2157
|
+
splitKey: p,
|
|
2151
2158
|
element: r
|
|
2152
2159
|
});
|
|
2153
2160
|
if (typeof r < "u" && window) {
|
|
2154
2161
|
if (!z.has(r)) {
|
|
2155
|
-
const
|
|
2156
|
-
let
|
|
2157
|
-
return
|
|
2158
|
-
},
|
|
2159
|
-
let
|
|
2160
|
-
|
|
2162
|
+
const g = function() {
|
|
2163
|
+
let A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2164
|
+
return ae(A, r);
|
|
2165
|
+
}, b = function() {
|
|
2166
|
+
let A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2167
|
+
ae(A, r), So(A);
|
|
2161
2168
|
};
|
|
2162
2169
|
z.set(r, {
|
|
2163
|
-
keydownListener:
|
|
2164
|
-
keyupListenr:
|
|
2170
|
+
keydownListener: g,
|
|
2171
|
+
keyupListenr: b,
|
|
2165
2172
|
capture: d
|
|
2166
|
-
}),
|
|
2173
|
+
}), Ut(r, "keydown", g, d), Ut(r, "keyup", b, d);
|
|
2167
2174
|
}
|
|
2168
|
-
if (!
|
|
2169
|
-
const
|
|
2175
|
+
if (!lt) {
|
|
2176
|
+
const g = () => {
|
|
2170
2177
|
I = [];
|
|
2171
2178
|
};
|
|
2172
|
-
|
|
2173
|
-
listener:
|
|
2179
|
+
lt = {
|
|
2180
|
+
listener: g,
|
|
2174
2181
|
capture: d
|
|
2175
|
-
},
|
|
2182
|
+
}, Ut(window, "focus", g, d);
|
|
2176
2183
|
}
|
|
2177
2184
|
}
|
|
2178
2185
|
}
|
|
2179
|
-
function
|
|
2186
|
+
function Co(t) {
|
|
2180
2187
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
|
|
2181
2188
|
Object.keys(N).forEach((n) => {
|
|
2182
2189
|
N[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {
|
|
@@ -2184,7 +2191,7 @@ function So(t) {
|
|
|
2184
2191
|
});
|
|
2185
2192
|
});
|
|
2186
2193
|
}
|
|
2187
|
-
function
|
|
2194
|
+
function Ht(t) {
|
|
2188
2195
|
const e = Object.values(N).flat();
|
|
2189
2196
|
if (e.findIndex((o) => {
|
|
2190
2197
|
let {
|
|
@@ -2197,7 +2204,7 @@ function Pt(t) {
|
|
|
2197
2204
|
keyupListenr: i,
|
|
2198
2205
|
capture: s
|
|
2199
2206
|
} = z.get(t) || {};
|
|
2200
|
-
o && i && (
|
|
2207
|
+
o && i && (it(t, "keyup", i, s), it(t, "keydown", o, s), z.delete(t));
|
|
2201
2208
|
}
|
|
2202
2209
|
if ((e.length <= 0 || z.size <= 0) && (Object.keys(z).forEach((i) => {
|
|
2203
2210
|
const {
|
|
@@ -2205,254 +2212,254 @@ function Pt(t) {
|
|
|
2205
2212
|
keyupListenr: r,
|
|
2206
2213
|
capture: a
|
|
2207
2214
|
} = z.get(i) || {};
|
|
2208
|
-
s && r && (
|
|
2209
|
-
}), z.clear(), Object.keys(N).forEach((i) => delete N[i]),
|
|
2215
|
+
s && r && (it(i, "keyup", r, a), it(i, "keydown", s, a), z.delete(i));
|
|
2216
|
+
}), z.clear(), Object.keys(N).forEach((i) => delete N[i]), lt)) {
|
|
2210
2217
|
const {
|
|
2211
2218
|
listener: i,
|
|
2212
2219
|
capture: s
|
|
2213
|
-
} =
|
|
2214
|
-
|
|
2220
|
+
} = lt;
|
|
2221
|
+
it(window, "focus", i, s), lt = null;
|
|
2215
2222
|
}
|
|
2216
2223
|
}
|
|
2217
|
-
const
|
|
2218
|
-
getPressedKeyString:
|
|
2219
|
-
setScope:
|
|
2220
|
-
getScope:
|
|
2221
|
-
deleteScope:
|
|
2222
|
-
getPressedKeyCodes:
|
|
2223
|
-
getAllKeyCodes:
|
|
2224
|
-
isPressed:
|
|
2225
|
-
filter:
|
|
2226
|
-
trigger:
|
|
2227
|
-
unbind:
|
|
2228
|
-
keyMap:
|
|
2224
|
+
const Dt = {
|
|
2225
|
+
getPressedKeyString: wo,
|
|
2226
|
+
setScope: Le,
|
|
2227
|
+
getScope: ut,
|
|
2228
|
+
deleteScope: Eo,
|
|
2229
|
+
getPressedKeyCodes: bo,
|
|
2230
|
+
getAllKeyCodes: Ao,
|
|
2231
|
+
isPressed: vo,
|
|
2232
|
+
filter: xo,
|
|
2233
|
+
trigger: Co,
|
|
2234
|
+
unbind: Te,
|
|
2235
|
+
keyMap: dt,
|
|
2229
2236
|
modifier: j,
|
|
2230
|
-
modifierMap:
|
|
2237
|
+
modifierMap: Kt
|
|
2231
2238
|
};
|
|
2232
|
-
for (const t in
|
|
2233
|
-
Object.prototype.hasOwnProperty.call(
|
|
2239
|
+
for (const t in Dt)
|
|
2240
|
+
Object.prototype.hasOwnProperty.call(Dt, t) && (P[t] = Dt[t]);
|
|
2234
2241
|
if (typeof window < "u") {
|
|
2235
2242
|
const t = window.hotkeys;
|
|
2236
2243
|
P.noConflict = (e) => (e && window.hotkeys === P && (window.hotkeys = t), P), window.hotkeys = P;
|
|
2237
2244
|
}
|
|
2238
|
-
async function
|
|
2245
|
+
async function Lo(t, e, n = () => !1) {
|
|
2239
2246
|
do {
|
|
2240
2247
|
if (await t(), await n()) break;
|
|
2241
2248
|
const o = e;
|
|
2242
2249
|
await new Promise((i) => setTimeout(i, Math.max(0, o)));
|
|
2243
2250
|
} while (!await n());
|
|
2244
2251
|
}
|
|
2245
|
-
const
|
|
2246
|
-
...
|
|
2247
|
-
|
|
2252
|
+
const ce = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+a", To = [
|
|
2253
|
+
...Oe.map((t) => `shift+${t}`),
|
|
2254
|
+
Re
|
|
2248
2255
|
], Oo = (t, e, n) => {
|
|
2249
2256
|
const { store: o, selection: i } = e;
|
|
2250
2257
|
let s;
|
|
2251
|
-
const r = (
|
|
2252
|
-
let
|
|
2253
|
-
const
|
|
2254
|
-
let
|
|
2255
|
-
const
|
|
2256
|
-
|
|
2257
|
-
},
|
|
2258
|
-
|
|
2259
|
-
annotation:
|
|
2258
|
+
const { annotatingEnabled: r, offsetReferenceSelector: a, selectionMode: l } = n, f = (u) => s = u;
|
|
2259
|
+
let p;
|
|
2260
|
+
const d = (u) => p = u;
|
|
2261
|
+
let h, g, b, A = r;
|
|
2262
|
+
const C = (u) => {
|
|
2263
|
+
A = u, c.clear(), u || (h = void 0, g = void 0, b = void 0);
|
|
2264
|
+
}, m = (u) => {
|
|
2265
|
+
A && g !== !1 && (h = st(u.target) ? void 0 : {
|
|
2266
|
+
annotation: be(),
|
|
2260
2267
|
selector: [],
|
|
2261
2268
|
creator: s,
|
|
2262
2269
|
created: /* @__PURE__ */ new Date()
|
|
2263
2270
|
});
|
|
2264
|
-
},
|
|
2265
|
-
if (!
|
|
2266
|
-
const
|
|
2267
|
-
if (!(
|
|
2271
|
+
}, c = Pt((u) => {
|
|
2272
|
+
if (!A) return;
|
|
2273
|
+
const E = document.getSelection();
|
|
2274
|
+
if (!(E != null && E.anchorNode))
|
|
2268
2275
|
return;
|
|
2269
|
-
if (
|
|
2270
|
-
|
|
2276
|
+
if (st(E.anchorNode)) {
|
|
2277
|
+
h = void 0;
|
|
2271
2278
|
return;
|
|
2272
2279
|
}
|
|
2273
|
-
const
|
|
2274
|
-
if ((
|
|
2275
|
-
if (
|
|
2276
|
-
o.getAnnotation(
|
|
2280
|
+
const B = u.timeStamp - ((b == null ? void 0 : b.timeStamp) || u.timeStamp);
|
|
2281
|
+
if ((b == null ? void 0 : b.type) === "pointerdown" && (B < 1e3 && !h || E.isCollapsed && B < ce) && m(b || u), !h) return;
|
|
2282
|
+
if (E.isCollapsed) {
|
|
2283
|
+
o.getAnnotation(h.annotation) && (i.clear(), o.deleteAnnotation(h.annotation));
|
|
2277
2284
|
return;
|
|
2278
2285
|
}
|
|
2279
|
-
const
|
|
2280
|
-
if (
|
|
2281
|
-
const
|
|
2282
|
-
(
|
|
2283
|
-
var
|
|
2284
|
-
return
|
|
2285
|
-
})) && (
|
|
2286
|
-
...
|
|
2287
|
-
selector:
|
|
2286
|
+
const R = E.getRangeAt(0), U = je(R, t);
|
|
2287
|
+
if (Ve(U)) return;
|
|
2288
|
+
const _ = _e(U.cloneRange());
|
|
2289
|
+
(_.length !== h.selector.length || _.some((W, G) => {
|
|
2290
|
+
var vt;
|
|
2291
|
+
return W.toString() !== ((vt = h.selector[G]) == null ? void 0 : vt.quote);
|
|
2292
|
+
})) && (h = {
|
|
2293
|
+
...h,
|
|
2294
|
+
selector: _.map((W) => Pe(W, t, a)),
|
|
2288
2295
|
updated: /* @__PURE__ */ new Date()
|
|
2289
|
-
}, o.getAnnotation(
|
|
2290
|
-
}, 10),
|
|
2291
|
-
|
|
2292
|
-
},
|
|
2293
|
-
if (
|
|
2294
|
-
const
|
|
2295
|
-
const { x, y:
|
|
2296
|
-
if (
|
|
2297
|
-
const { selected:
|
|
2298
|
-
(
|
|
2296
|
+
}, o.getAnnotation(h.annotation) ? o.updateTarget(h, k.LOCAL) : i.clear());
|
|
2297
|
+
}, 10), y = (u) => {
|
|
2298
|
+
st(u.target) || (b = St(u), g = b.button === 0);
|
|
2299
|
+
}, S = async (u) => {
|
|
2300
|
+
if (st(u.target) || !g) return;
|
|
2301
|
+
const E = () => {
|
|
2302
|
+
const { x: R, y: U } = t.getBoundingClientRect(), _ = u.target instanceof Node && t.contains(u.target) && o.getAt(u.clientX - R, u.clientY - U, l === "all", p);
|
|
2303
|
+
if (_) {
|
|
2304
|
+
const { selected: ht } = i, W = new Set(ht.map((nt) => nt.id)), G = Array.isArray(_) ? _.map((nt) => nt.id) : [_.id];
|
|
2305
|
+
(W.size !== G.length || !G.every((nt) => W.has(nt))) && i.userSelect(G, u);
|
|
2299
2306
|
} else
|
|
2300
2307
|
i.clear();
|
|
2301
2308
|
};
|
|
2302
|
-
if (
|
|
2303
|
-
await
|
|
2304
|
-
const
|
|
2305
|
-
if (
|
|
2306
|
-
|
|
2309
|
+
if (u.timeStamp - b.timeStamp < ce) {
|
|
2310
|
+
await x();
|
|
2311
|
+
const R = document.getSelection();
|
|
2312
|
+
if (R != null && R.isCollapsed) {
|
|
2313
|
+
h = void 0, E();
|
|
2307
2314
|
return;
|
|
2308
2315
|
}
|
|
2309
2316
|
}
|
|
2310
|
-
|
|
2311
|
-
},
|
|
2312
|
-
const
|
|
2313
|
-
let
|
|
2314
|
-
const
|
|
2315
|
-
return setTimeout(() =>
|
|
2316
|
-
},
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2319
|
-
},
|
|
2320
|
-
|
|
2321
|
-
},
|
|
2322
|
-
const
|
|
2323
|
-
(
|
|
2324
|
-
id:
|
|
2317
|
+
h && h.selector.length > 0 && (w(), i.userSelect(h.annotation, St(u)));
|
|
2318
|
+
}, x = async () => {
|
|
2319
|
+
const u = document.getSelection();
|
|
2320
|
+
let E = !1, B = u == null ? void 0 : u.isCollapsed;
|
|
2321
|
+
const R = () => B || E, U = 1;
|
|
2322
|
+
return setTimeout(() => E = !0, 50), Lo(() => B = u == null ? void 0 : u.isCollapsed, U, R);
|
|
2323
|
+
}, L = (u) => {
|
|
2324
|
+
const E = document.getSelection();
|
|
2325
|
+
E != null && E.isCollapsed || ((!h || h.selector.length === 0) && c(u), w(), i.userSelect(h.annotation, St(u)));
|
|
2326
|
+
}, O = (u) => {
|
|
2327
|
+
A && u.key === "Shift" && h && (document.getSelection().isCollapsed || (w(), i.userSelect(h.annotation, pt(u))));
|
|
2328
|
+
}, T = (u) => {
|
|
2329
|
+
const E = () => setTimeout(() => {
|
|
2330
|
+
(h == null ? void 0 : h.selector.length) > 0 && (i.clear(), o.addAnnotation({
|
|
2331
|
+
id: h.annotation,
|
|
2325
2332
|
bodies: [],
|
|
2326
|
-
target:
|
|
2327
|
-
}), i.userSelect(
|
|
2333
|
+
target: h
|
|
2334
|
+
}), i.userSelect(h.annotation, pt(u))), document.removeEventListener("selectionchange", E);
|
|
2328
2335
|
}, 100);
|
|
2329
|
-
document.addEventListener("selectionchange",
|
|
2336
|
+
document.addEventListener("selectionchange", E), m(u);
|
|
2330
2337
|
};
|
|
2331
|
-
P(
|
|
2332
|
-
|
|
2333
|
-
}), P(
|
|
2334
|
-
|
|
2338
|
+
P(To.join(","), { element: t, keydown: !0, keyup: !1 }, (u) => {
|
|
2339
|
+
u.repeat || (b = pt(u));
|
|
2340
|
+
}), P(Re, { keydown: !0, keyup: !1 }, (u) => {
|
|
2341
|
+
b = pt(u), T(u);
|
|
2335
2342
|
});
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2343
|
+
const M = (u) => {
|
|
2344
|
+
u.repeat || u.target !== t && u.target !== document.body || (h = void 0, i.clear());
|
|
2338
2345
|
};
|
|
2339
|
-
P(
|
|
2340
|
-
const
|
|
2341
|
-
const
|
|
2342
|
-
if (!
|
|
2346
|
+
P(Oe.join(","), { keydown: !0, keyup: !1 }, M);
|
|
2347
|
+
const w = () => {
|
|
2348
|
+
const u = o.getAnnotation(h.annotation);
|
|
2349
|
+
if (!u) {
|
|
2343
2350
|
o.addAnnotation({
|
|
2344
|
-
id:
|
|
2351
|
+
id: h.annotation,
|
|
2345
2352
|
bodies: [],
|
|
2346
|
-
target:
|
|
2353
|
+
target: h
|
|
2347
2354
|
});
|
|
2348
2355
|
return;
|
|
2349
2356
|
}
|
|
2350
|
-
const { target: { updated:
|
|
2351
|
-
(!
|
|
2357
|
+
const { target: { updated: E } } = u, { updated: B } = h;
|
|
2358
|
+
(!E || !B || E < B) && o.updateTarget(h);
|
|
2352
2359
|
};
|
|
2353
|
-
return document.addEventListener("pointerdown",
|
|
2360
|
+
return document.addEventListener("pointerdown", y), document.addEventListener("pointerup", S), document.addEventListener("contextmenu", L), t.addEventListener("keyup", O), t.addEventListener("selectstart", m), document.addEventListener("selectionchange", c), {
|
|
2354
2361
|
destroy: () => {
|
|
2355
|
-
|
|
2362
|
+
h = void 0, g = void 0, b = void 0, c.clear(), document.removeEventListener("pointerdown", y), document.removeEventListener("pointerup", S), document.removeEventListener("contextmenu", L), t.removeEventListener("keyup", O), t.removeEventListener("selectstart", m), document.removeEventListener("selectionchange", c), P.unbind();
|
|
2356
2363
|
},
|
|
2357
|
-
setFilter:
|
|
2358
|
-
setUser:
|
|
2359
|
-
setAnnotatingEnabled:
|
|
2364
|
+
setFilter: d,
|
|
2365
|
+
setUser: f,
|
|
2366
|
+
setAnnotatingEnabled: C
|
|
2360
2367
|
};
|
|
2361
|
-
},
|
|
2368
|
+
}, Ro = (t, e) => ({
|
|
2362
2369
|
...t,
|
|
2363
2370
|
annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
|
|
2364
2371
|
user: t.user || e.user
|
|
2365
|
-
}),
|
|
2366
|
-
|
|
2367
|
-
const n =
|
|
2372
|
+
}), le = "SPANS", No = (t, e = {}) => {
|
|
2373
|
+
Be(t), Ie(t);
|
|
2374
|
+
const n = Ro(e, {
|
|
2368
2375
|
annotatingEnabled: !0,
|
|
2369
|
-
user:
|
|
2370
|
-
}), o =
|
|
2371
|
-
let
|
|
2372
|
-
const
|
|
2376
|
+
user: Wn()
|
|
2377
|
+
}), o = fo(t, n.userSelectAction), { selection: i, viewport: s } = o, r = o.store, a = Vn(r), l = Kn(o, a, n.adapter);
|
|
2378
|
+
let f = n.user;
|
|
2379
|
+
const p = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : le : n.renderer || le, d = p === "SPANS" ? gn(t, o, s) : p === "CSS_HIGHLIGHTS" ? fn(t, o, s) : p === "CANVAS" ? en(t, o, s) : void 0;
|
|
2373
2380
|
if (!d)
|
|
2374
|
-
throw `Unknown renderer implementation: ${
|
|
2375
|
-
console.debug(`Using ${
|
|
2376
|
-
const
|
|
2377
|
-
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
+
throw `Unknown renderer implementation: ${p}`;
|
|
2382
|
+
console.debug(`Using ${p} renderer`), n.style && d.setStyle(n.style);
|
|
2383
|
+
const h = Oo(t, o, n);
|
|
2384
|
+
h.setUser(f), h.setAnnotatingEnabled(n.annotatingEnabled);
|
|
2385
|
+
const g = Pn(o, a, n.adapter), b = () => f, A = (x) => {
|
|
2386
|
+
h.setAnnotatingEnabled(
|
|
2387
|
+
x === void 0 ? !0 : x
|
|
2381
2388
|
);
|
|
2382
|
-
}, C = (
|
|
2383
|
-
d.setFilter(
|
|
2384
|
-
},
|
|
2385
|
-
|
|
2386
|
-
},
|
|
2387
|
-
|
|
2388
|
-
}, y = (
|
|
2389
|
-
|
|
2389
|
+
}, C = (x) => {
|
|
2390
|
+
d.setFilter(x), h.setFilter(x);
|
|
2391
|
+
}, m = (x) => {
|
|
2392
|
+
f = x, h.setUser(x);
|
|
2393
|
+
}, c = (x) => {
|
|
2394
|
+
x && (d.setPainter(po(x, n.presence)), x.on("selectionChange", () => d.redraw()));
|
|
2395
|
+
}, y = (x) => {
|
|
2396
|
+
x ? i.setSelected(x) : i.clear();
|
|
2390
2397
|
};
|
|
2391
2398
|
return {
|
|
2392
|
-
...
|
|
2399
|
+
...g,
|
|
2393
2400
|
destroy: () => {
|
|
2394
|
-
d.destroy(),
|
|
2401
|
+
d.destroy(), h.destroy(), a.destroy();
|
|
2395
2402
|
},
|
|
2396
2403
|
element: t,
|
|
2397
|
-
getUser:
|
|
2398
|
-
setAnnotatingEnabled:
|
|
2404
|
+
getUser: b,
|
|
2405
|
+
setAnnotatingEnabled: A,
|
|
2399
2406
|
setFilter: C,
|
|
2400
2407
|
setStyle: d.setStyle.bind(d),
|
|
2401
2408
|
redraw: d.redraw.bind(d),
|
|
2402
|
-
setUser:
|
|
2409
|
+
setUser: m,
|
|
2403
2410
|
setSelected: y,
|
|
2404
|
-
setPresenceProvider:
|
|
2411
|
+
setPresenceProvider: c,
|
|
2405
2412
|
setVisible: d.setVisible.bind(d),
|
|
2406
2413
|
on: l.on,
|
|
2407
2414
|
off: l.off,
|
|
2408
|
-
scrollIntoView:
|
|
2415
|
+
scrollIntoView: ze(t, r),
|
|
2409
2416
|
state: o
|
|
2410
2417
|
};
|
|
2411
2418
|
};
|
|
2412
2419
|
export {
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2420
|
+
xt as DEFAULT_SELECTED_STYLE,
|
|
2421
|
+
q as DEFAULT_STYLE,
|
|
2422
|
+
de as NOT_ANNOTATABLE_CLASS,
|
|
2423
|
+
et as NOT_ANNOTATABLE_SELECTOR,
|
|
2417
2424
|
k as Origin,
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2425
|
+
vn as UserSelectAction,
|
|
2426
|
+
Io as W3CTextFormat,
|
|
2427
|
+
Be as cancelSingleClickEvents,
|
|
2428
|
+
pt as cloneKeyboardEvent,
|
|
2429
|
+
St as clonePointerEvent,
|
|
2430
|
+
ko as createBody,
|
|
2431
|
+
en as createCanvasRenderer,
|
|
2432
|
+
fn as createHighlightsRenderer,
|
|
2433
|
+
po as createPresencePainter,
|
|
2434
|
+
un as createRenderer,
|
|
2428
2435
|
Oo as createSelectionHandler,
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2436
|
+
gn as createSpansRenderer,
|
|
2437
|
+
No as createTextAnnotator,
|
|
2438
|
+
fo as createTextAnnotatorState,
|
|
2439
|
+
Bo as denormalizeRectWithOffset,
|
|
2440
|
+
Ro as fillDefaults,
|
|
2441
|
+
Ue as getQuoteContext,
|
|
2442
|
+
Vt as getRangeAnnotatableContents,
|
|
2443
|
+
ke as isMac,
|
|
2444
|
+
st as isNotAnnotatable,
|
|
2445
|
+
Me as isRangeAnnotatable,
|
|
2439
2446
|
F as isRevived,
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2447
|
+
Ve as isWhitespaceOrEmpty,
|
|
2448
|
+
Xe as mergeClientRects,
|
|
2449
|
+
He as normalizeRectWithOffset,
|
|
2450
|
+
Fe as paint,
|
|
2451
|
+
to as parseW3CTextAnnotation,
|
|
2452
|
+
Ie as programmaticallyFocusable,
|
|
2453
|
+
$e as rangeContains,
|
|
2454
|
+
Pe as rangeToSelector,
|
|
2455
|
+
Et as reviveAnnotation,
|
|
2456
|
+
ue as reviveSelector,
|
|
2457
|
+
At as reviveTarget,
|
|
2458
|
+
ze as scrollIntoView,
|
|
2459
|
+
eo as serializeW3CTextAnnotation,
|
|
2460
|
+
_e as splitAnnotatableRanges,
|
|
2461
|
+
Mo as toDomRectList,
|
|
2462
|
+
je as trimRangeToContainer,
|
|
2463
|
+
De as whitespaceOrEmptyRegex
|
|
2457
2464
|
};
|
|
2458
2465
|
//# sourceMappingURL=text-annotator.es.js.map
|