@recogito/text-annotator 3.0.0-rc.5 → 3.0.0-rc.7
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.
|
@@ -32,41 +32,41 @@ const mt = (e, t = 10) => {
|
|
|
32
32
|
let a, r, d = nt;
|
|
33
33
|
const u = pt(n);
|
|
34
34
|
e.classList.add("r6o-annotatable");
|
|
35
|
-
const b = j("r6o-highlight-layer bg"), h = j("r6o-highlight-layer fg", !0),
|
|
36
|
-
e.insertBefore(b, e.firstChild), e.appendChild(h), e.addEventListener("pointermove", (
|
|
37
|
-
const { x: T, y: L } = e.getBoundingClientRect(), f = o.getAt(
|
|
35
|
+
const b = j("r6o-highlight-layer bg"), h = j("r6o-highlight-layer fg", !0), v = b.getContext("2d"), m = h.getContext("2d");
|
|
36
|
+
e.insertBefore(b, e.firstChild), e.appendChild(h), e.addEventListener("pointermove", (E) => {
|
|
37
|
+
const { x: T, y: L } = e.getBoundingClientRect(), f = o.getAt(E.clientX - T, E.clientY - L);
|
|
38
38
|
f && (!r || r(f)) ? s.current !== f.id && (e.classList.add("hovered"), s.set(f.id)) : s.current && (e.classList.remove("hovered"), s.set(null));
|
|
39
39
|
});
|
|
40
|
-
const
|
|
41
|
-
const { top:
|
|
42
|
-
return { top:
|
|
43
|
-
},
|
|
44
|
-
document.addEventListener("scroll",
|
|
45
|
-
const
|
|
40
|
+
const x = () => {
|
|
41
|
+
const { top: E, left: T } = e.getBoundingClientRect(), { innerWidth: L, innerHeight: f } = window, w = -T, A = -E, B = L - T, S = f - E;
|
|
42
|
+
return { top: E, left: T, minX: w, minY: A, maxX: B, maxY: S };
|
|
43
|
+
}, M = () => c();
|
|
44
|
+
document.addEventListener("scroll", M, { capture: !0, passive: !0 });
|
|
45
|
+
const y = mt(() => {
|
|
46
46
|
Z(b), Z(h, !0), o.recalculatePositions(), c();
|
|
47
47
|
});
|
|
48
|
-
window.addEventListener("resize",
|
|
48
|
+
window.addEventListener("resize", y), new ResizeObserver(y).observe(e);
|
|
49
49
|
const c = () => requestAnimationFrame(() => {
|
|
50
|
-
const { top:
|
|
51
|
-
m.clearRect(-0.5, -0.5, S + 1, R + 1),
|
|
50
|
+
const { top: E, left: T, minX: L, minY: f, maxX: w, maxY: A } = x(), B = r ? o.getIntersectingRects(L, f, w, A).filter(({ annotation: Y }) => r(Y)) : o.getIntersectingRects(L, f, w, A), { width: S, height: R } = h, X = new Set(i.selected.map(({ id: Y }) => Y));
|
|
51
|
+
m.clearRect(-0.5, -0.5, S + 1, R + 1), v.clearRect(-0.5, -0.5, S + 1, R + 1), B.forEach(({ annotation: Y, rects: at }) => {
|
|
52
52
|
const rt = at.map(({ x: ct, y: dt, width: ut, height: ht }) => ({
|
|
53
53
|
x: ct + T,
|
|
54
|
-
y: dt +
|
|
54
|
+
y: dt + E,
|
|
55
55
|
width: ut,
|
|
56
56
|
height: ht
|
|
57
|
-
})), lt = X.has(
|
|
58
|
-
d.paint(
|
|
59
|
-
}), setTimeout(() => u(B.map(({ annotation:
|
|
57
|
+
})), lt = X.has(Y.id);
|
|
58
|
+
d.paint(Y, rt, v, m, lt, a);
|
|
59
|
+
}), setTimeout(() => u(B.map(({ annotation: Y }) => Y)), 1);
|
|
60
60
|
});
|
|
61
61
|
return o.observe(() => c()), i.subscribe(() => c()), {
|
|
62
62
|
redraw: c,
|
|
63
|
-
setDrawingStyle: (
|
|
64
|
-
a =
|
|
63
|
+
setDrawingStyle: (E) => {
|
|
64
|
+
a = E, c();
|
|
65
65
|
},
|
|
66
|
-
setFilter: (
|
|
67
|
-
r =
|
|
66
|
+
setFilter: (E) => {
|
|
67
|
+
r = E, c();
|
|
68
68
|
},
|
|
69
|
-
setPainter: (
|
|
69
|
+
setPainter: (E) => d = E
|
|
70
70
|
};
|
|
71
71
|
}, k = (e, t) => {
|
|
72
72
|
const { start: n, end: o } = e.selector, i = e.selector.offsetReference ? e.selector.offsetReference : t;
|
|
@@ -104,7 +104,7 @@ const mt = (e, t = 10) => {
|
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
106
|
var Q = Object.prototype.hasOwnProperty;
|
|
107
|
-
function
|
|
107
|
+
function U(e, t) {
|
|
108
108
|
var n, o;
|
|
109
109
|
if (e === t)
|
|
110
110
|
return !0;
|
|
@@ -115,14 +115,14 @@ function Y(e, t) {
|
|
|
115
115
|
return e.toString() === t.toString();
|
|
116
116
|
if (n === Array) {
|
|
117
117
|
if ((o = e.length) === t.length)
|
|
118
|
-
for (; o-- &&
|
|
118
|
+
for (; o-- && U(e[o], t[o]); )
|
|
119
119
|
;
|
|
120
120
|
return o === -1;
|
|
121
121
|
}
|
|
122
122
|
if (!n || typeof e == "object") {
|
|
123
123
|
o = 0;
|
|
124
124
|
for (n in e)
|
|
125
|
-
if (Q.call(e, n) && ++o && !Q.call(t, n) || !(n in t) || !
|
|
125
|
+
if (Q.call(e, n) && ++o && !Q.call(t, n) || !(n in t) || !U(e[n], t[n]))
|
|
126
126
|
return !1;
|
|
127
127
|
return Object.keys(t).length === o;
|
|
128
128
|
}
|
|
@@ -155,19 +155,19 @@ function J(e, t = W) {
|
|
|
155
155
|
}
|
|
156
156
|
function a(r, d = W) {
|
|
157
157
|
const u = [r, d];
|
|
158
|
-
return o.add(u), o.size === 1 && (n = t(i) || W), r(e), () => {
|
|
158
|
+
return o.add(u), o.size === 1 && (n = t(i, s) || W), r(e), () => {
|
|
159
159
|
o.delete(u), o.size === 0 && n && (n(), n = null);
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
return { set: i, update: s, subscribe: a };
|
|
163
163
|
}
|
|
164
|
-
const
|
|
165
|
-
const { subscribe: t, set: n } = J(
|
|
166
|
-
let o
|
|
164
|
+
const wt = (e) => {
|
|
165
|
+
const { subscribe: t, set: n } = J();
|
|
166
|
+
let o;
|
|
167
167
|
return t((i) => o = i), e.observe(({ changes: i }) => {
|
|
168
168
|
if (o) {
|
|
169
|
-
i.deleted.some((a) => a.id === o) && n(
|
|
170
|
-
const s = i.updated.find(({ oldValue: a }) => a.id === o);
|
|
169
|
+
(i.deleted || []).some((a) => a.id === o) && n(void 0);
|
|
170
|
+
const s = (i.updated || []).find(({ oldValue: a }) => a.id === o);
|
|
171
171
|
s && n(s.newValue.id);
|
|
172
172
|
}
|
|
173
173
|
}), {
|
|
@@ -177,7 +177,7 @@ const xt = (e) => {
|
|
|
177
177
|
subscribe: t,
|
|
178
178
|
set: n
|
|
179
179
|
};
|
|
180
|
-
}, q = { selected: [] },
|
|
180
|
+
}, q = { selected: [] }, xt = (e, t = "EDIT") => {
|
|
181
181
|
const { subscribe: n, set: o } = J(q);
|
|
182
182
|
let i = q;
|
|
183
183
|
n((h) => i = h);
|
|
@@ -187,25 +187,25 @@ const xt = (e) => {
|
|
|
187
187
|
}, r = (h) => {
|
|
188
188
|
if (i.selected.length === 0)
|
|
189
189
|
return !1;
|
|
190
|
-
const
|
|
191
|
-
return i.selected.some((m) => m.id ===
|
|
192
|
-
}, d = (h,
|
|
190
|
+
const v = typeof h == "string" ? h : h.id;
|
|
191
|
+
return i.selected.some((m) => m.id === v);
|
|
192
|
+
}, d = (h, v) => {
|
|
193
193
|
const m = e.getAnnotation(h);
|
|
194
194
|
if (m) {
|
|
195
|
-
const
|
|
196
|
-
o(
|
|
195
|
+
const x = yt(m, t);
|
|
196
|
+
o(x === "EDIT" ? { selected: [{ id: h, editable: !0 }], pointerEvent: v } : x === "SELECT" ? { selected: [{ id: h }], pointerEvent: v } : { selected: [], pointerEvent: v });
|
|
197
197
|
} else
|
|
198
198
|
console.warn("Invalid selection: " + h);
|
|
199
|
-
}, u = (h,
|
|
200
|
-
const m = Array.isArray(h) ? h : [h],
|
|
201
|
-
o({ selected:
|
|
199
|
+
}, u = (h, v = !0) => {
|
|
200
|
+
const m = Array.isArray(h) ? h : [h], x = m.map((M) => e.getAnnotation(M)).filter(Boolean);
|
|
201
|
+
o({ selected: x.map(({ id: M }) => ({ id: M, editable: v })) }), x.length !== m.length && console.warn("Invalid selection", h);
|
|
202
202
|
}, b = (h) => {
|
|
203
203
|
if (i.selected.length === 0)
|
|
204
204
|
return !1;
|
|
205
|
-
const { selected:
|
|
206
|
-
|
|
205
|
+
const { selected: v } = i;
|
|
206
|
+
v.filter(({ id: m }) => h.includes(m)).length > 0 && o({ selected: v.filter(({ id: m }) => !h.includes(m)) });
|
|
207
207
|
};
|
|
208
|
-
return e.observe(({ changes: h }) => b(h.deleted.map((
|
|
208
|
+
return e.observe(({ changes: h }) => b((h.deleted || []).map((v) => v.id))), {
|
|
209
209
|
clear: s,
|
|
210
210
|
clickSelect: d,
|
|
211
211
|
get selected() {
|
|
@@ -219,11 +219,11 @@ const xt = (e) => {
|
|
|
219
219
|
setSelected: u,
|
|
220
220
|
subscribe: n
|
|
221
221
|
};
|
|
222
|
-
},
|
|
222
|
+
}, yt = (e, t) => typeof t == "function" ? t(e) || "EDIT" : t || "EDIT", Et = [];
|
|
223
223
|
for (let e = 0; e < 256; ++e)
|
|
224
|
-
|
|
224
|
+
Et.push((e + 256).toString(16).slice(1));
|
|
225
225
|
typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
226
|
-
const
|
|
226
|
+
const vt = (e, t) => {
|
|
227
227
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
228
228
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
229
229
|
}, Tt = (e, t) => {
|
|
@@ -231,9 +231,9 @@ const Et = (e, t) => {
|
|
|
231
231
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
232
232
|
}, Bt = (e, t) => t.bodies.map((n) => {
|
|
233
233
|
const o = e.bodies.find((i) => i.id === n.id);
|
|
234
|
-
return { newBody: n, oldBody: o && !
|
|
235
|
-
}).filter(({ oldBody: n }) => n), St = (e, t) => !
|
|
236
|
-
const n =
|
|
234
|
+
return { newBody: n, oldBody: o && !U(o, n) ? o : void 0 };
|
|
235
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), St = (e, t) => !U(e.target, t.target), ot = (e, t) => {
|
|
236
|
+
const n = vt(e, t), o = Tt(e, t), i = Bt(e, t);
|
|
237
237
|
return {
|
|
238
238
|
oldValue: e,
|
|
239
239
|
newValue: t,
|
|
@@ -243,14 +243,14 @@ const Et = (e, t) => {
|
|
|
243
243
|
targetUpdated: St(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
|
|
244
244
|
};
|
|
245
245
|
};
|
|
246
|
-
var
|
|
247
|
-
const
|
|
246
|
+
var C = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(C || {});
|
|
247
|
+
const Mt = (e, t) => {
|
|
248
248
|
var n, o;
|
|
249
249
|
const { changes: i, origin: s } = t;
|
|
250
250
|
if (!(!e.options.origin || e.options.origin === s))
|
|
251
251
|
return !1;
|
|
252
252
|
if (e.options.ignore) {
|
|
253
|
-
const { ignore: a } = e.options, r = (d) =>
|
|
253
|
+
const { ignore: a } = e.options, r = (d) => d && d.length > 0;
|
|
254
254
|
if (!(r(i.created) || r(i.deleted))) {
|
|
255
255
|
const d = (n = i.updated) == null ? void 0 : n.some((b) => r(b.bodiesCreated) || r(b.bodiesDeleted) || r(b.bodiesUpdated)), u = (o = i.updated) == null ? void 0 : o.some((b) => b.targetUpdated);
|
|
256
256
|
if (a === "BODY_ONLY" && d && !u || a === "TARGET_ONLY" && u && !d)
|
|
@@ -259,88 +259,88 @@ const Ct = (e, t) => {
|
|
|
259
259
|
}
|
|
260
260
|
if (e.options.annotations) {
|
|
261
261
|
const a = /* @__PURE__ */ new Set([
|
|
262
|
-
...i.created.map((r) => r.id),
|
|
263
|
-
...i.deleted.map((r) => r.id),
|
|
264
|
-
...i.updated.map(({ oldValue: r }) => r.id)
|
|
262
|
+
...(i.created || []).map((r) => r.id),
|
|
263
|
+
...(i.deleted || []).map((r) => r.id),
|
|
264
|
+
...(i.updated || []).map(({ oldValue: r }) => r.id)
|
|
265
265
|
]);
|
|
266
266
|
return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((r) => a.has(r));
|
|
267
267
|
} else
|
|
268
268
|
return !0;
|
|
269
269
|
}, Lt = (e, t) => {
|
|
270
270
|
const n = new Set((e.created || []).map((h) => h.id)), o = new Set((e.updated || []).map(({ newValue: h }) => h.id)), i = new Set((t.created || []).map((h) => h.id)), s = new Set((t.deleted || []).map((h) => h.id)), a = new Set((t.updated || []).map(({ oldValue: h }) => h.id)), r = new Set((t.updated || []).filter(({ oldValue: h }) => n.has(h.id) || o.has(h.id)).map(({ oldValue: h }) => h.id)), d = [
|
|
271
|
-
...(e.created || []).filter((h) => !s.has(h.id)).map((h) => a.has(h.id) ? t.updated.find(({ oldValue:
|
|
271
|
+
...(e.created || []).filter((h) => !s.has(h.id)).map((h) => a.has(h.id) ? t.updated.find(({ oldValue: v }) => v.id === h.id).newValue : h),
|
|
272
272
|
...t.created || []
|
|
273
273
|
], u = [
|
|
274
274
|
...(e.deleted || []).filter((h) => !i.has(h.id)),
|
|
275
275
|
...(t.deleted || []).filter((h) => !n.has(h.id))
|
|
276
276
|
], b = [
|
|
277
277
|
...(e.updated || []).filter(({ newValue: h }) => !s.has(h.id)).map((h) => {
|
|
278
|
-
const { oldValue:
|
|
278
|
+
const { oldValue: v, newValue: m } = h;
|
|
279
279
|
if (a.has(m.id)) {
|
|
280
|
-
const
|
|
281
|
-
return ot(
|
|
280
|
+
const x = t.updated.find((M) => M.oldValue.id === m.id).newValue;
|
|
281
|
+
return ot(v, x);
|
|
282
282
|
} else
|
|
283
283
|
return h;
|
|
284
284
|
}),
|
|
285
285
|
...(t.updated || []).filter(({ oldValue: h }) => !r.has(h.id))
|
|
286
286
|
];
|
|
287
287
|
return { created: d, deleted: u, updated: b };
|
|
288
|
-
},
|
|
289
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (f,
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
}, s = (f,
|
|
288
|
+
}, Ct = (e) => e.id !== void 0, Rt = () => {
|
|
289
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (f, w = {}) => n.push({ onChange: f, options: w }), i = (f) => {
|
|
290
|
+
const w = n.findIndex((A) => A.onChange == f);
|
|
291
|
+
w > -1 && n.splice(w, 1);
|
|
292
|
+
}, s = (f, w) => {
|
|
293
293
|
const A = {
|
|
294
294
|
origin: f,
|
|
295
295
|
changes: {
|
|
296
|
-
created:
|
|
297
|
-
updated:
|
|
298
|
-
deleted:
|
|
296
|
+
created: w.created || [],
|
|
297
|
+
updated: w.updated || [],
|
|
298
|
+
deleted: w.deleted || []
|
|
299
299
|
},
|
|
300
300
|
state: [...e.values()]
|
|
301
301
|
};
|
|
302
302
|
n.forEach((B) => {
|
|
303
|
-
|
|
303
|
+
Mt(B, A) && B.onChange(A);
|
|
304
304
|
});
|
|
305
|
-
}, a = (f,
|
|
305
|
+
}, a = (f, w = C.LOCAL) => {
|
|
306
306
|
if (e.get(f.id))
|
|
307
307
|
throw Error(`Cannot add annotation ${f.id} - exists already`);
|
|
308
|
-
e.set(f.id, f), f.bodies.forEach((A) => t.set(A.id, f.id)), s(
|
|
309
|
-
}, r = (f,
|
|
310
|
-
const A = typeof f == "string" ?
|
|
308
|
+
e.set(f.id, f), f.bodies.forEach((A) => t.set(A.id, f.id)), s(w, { created: [f] });
|
|
309
|
+
}, r = (f, w) => {
|
|
310
|
+
const A = typeof f == "string" ? w : f, B = typeof f == "string" ? f : f.id, S = e.get(B);
|
|
311
311
|
if (S) {
|
|
312
312
|
const R = ot(S, A);
|
|
313
313
|
return B === A.id ? e.set(B, A) : (e.delete(B), e.set(A.id, A)), S.bodies.forEach((X) => t.delete(X.id)), A.bodies.forEach((X) => t.set(X.id, A.id)), R;
|
|
314
314
|
} else
|
|
315
315
|
console.warn(`Cannot update annotation ${B} - does not exist`);
|
|
316
|
-
}, d = (f,
|
|
317
|
-
const B =
|
|
316
|
+
}, d = (f, w = C.LOCAL, A = C.LOCAL) => {
|
|
317
|
+
const B = Ct(w) ? A : w, S = r(f, w);
|
|
318
318
|
S && s(B, { updated: [S] });
|
|
319
|
-
}, u = (f,
|
|
319
|
+
}, u = (f, w = C.LOCAL) => {
|
|
320
320
|
const A = f.reduce((B, S) => {
|
|
321
321
|
const R = r(S);
|
|
322
322
|
return R ? [...B, R] : B;
|
|
323
323
|
}, []);
|
|
324
|
-
A.length > 0 && s(
|
|
325
|
-
}, b = (f,
|
|
324
|
+
A.length > 0 && s(w, { updated: A });
|
|
325
|
+
}, b = (f, w = C.LOCAL) => {
|
|
326
326
|
const A = e.get(f.annotation);
|
|
327
327
|
if (A) {
|
|
328
328
|
const B = {
|
|
329
329
|
...A,
|
|
330
330
|
bodies: [...A.bodies, f]
|
|
331
331
|
};
|
|
332
|
-
e.set(A.id, B), t.set(f.id, B.id), s(
|
|
332
|
+
e.set(A.id, B), t.set(f.id, B.id), s(w, { updated: [{
|
|
333
333
|
oldValue: A,
|
|
334
334
|
newValue: B,
|
|
335
335
|
bodiesCreated: [f]
|
|
336
336
|
}] });
|
|
337
337
|
} else
|
|
338
338
|
console.warn(`Attempt to add body to missing annotation: ${f.annotation}`);
|
|
339
|
-
}, h = () => [...e.values()],
|
|
340
|
-
const
|
|
341
|
-
e.clear(), t.clear(), s(f, { deleted:
|
|
342
|
-
}, m = (f,
|
|
343
|
-
if (
|
|
339
|
+
}, h = () => [...e.values()], v = (f = C.LOCAL) => {
|
|
340
|
+
const w = [...e.values()];
|
|
341
|
+
e.clear(), t.clear(), s(f, { deleted: w });
|
|
342
|
+
}, m = (f, w = !0, A = C.LOCAL) => {
|
|
343
|
+
if (w) {
|
|
344
344
|
const B = [...e.values()];
|
|
345
345
|
e.clear(), t.clear(), f.forEach((S) => {
|
|
346
346
|
e.set(S.id, S), S.bodies.forEach((R) => t.set(R.id, S.id));
|
|
@@ -356,21 +356,21 @@ const Ct = (e, t) => {
|
|
|
356
356
|
e.set(S.id, S), S.bodies.forEach((R) => t.set(R.id, S.id));
|
|
357
357
|
}), s(A, { created: f });
|
|
358
358
|
}
|
|
359
|
-
},
|
|
360
|
-
const
|
|
359
|
+
}, x = (f) => {
|
|
360
|
+
const w = typeof f == "string" ? f : f.id, A = e.get(w);
|
|
361
361
|
if (A)
|
|
362
|
-
return e.delete(
|
|
363
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
364
|
-
},
|
|
365
|
-
const A =
|
|
366
|
-
A && s(
|
|
367
|
-
},
|
|
362
|
+
return e.delete(w), A.bodies.forEach((B) => t.delete(B.id)), A;
|
|
363
|
+
console.warn(`Attempt to delete missing annotation: ${w}`);
|
|
364
|
+
}, M = (f, w = C.LOCAL) => {
|
|
365
|
+
const A = x(f);
|
|
366
|
+
A && s(w, { deleted: [A] });
|
|
367
|
+
}, y = (f, w = C.LOCAL) => {
|
|
368
368
|
const A = f.reduce((B, S) => {
|
|
369
|
-
const R =
|
|
369
|
+
const R = x(S);
|
|
370
370
|
return R ? [...B, R] : B;
|
|
371
371
|
}, []);
|
|
372
|
-
A.length > 0 && s(
|
|
373
|
-
}, l = (f,
|
|
372
|
+
A.length > 0 && s(w, { deleted: A });
|
|
373
|
+
}, l = (f, w = C.LOCAL) => {
|
|
374
374
|
const A = e.get(f.annotation);
|
|
375
375
|
if (A) {
|
|
376
376
|
const B = A.bodies.find((S) => S.id === f.id);
|
|
@@ -380,7 +380,7 @@ const Ct = (e, t) => {
|
|
|
380
380
|
...A,
|
|
381
381
|
bodies: A.bodies.filter((R) => R.id !== f.id)
|
|
382
382
|
};
|
|
383
|
-
e.set(A.id, S), s(
|
|
383
|
+
e.set(A.id, S), s(w, { updated: [{
|
|
384
384
|
oldValue: A,
|
|
385
385
|
newValue: S,
|
|
386
386
|
bodiesDeleted: [B]
|
|
@@ -390,54 +390,54 @@ const Ct = (e, t) => {
|
|
|
390
390
|
} else
|
|
391
391
|
console.warn(`Attempt to delete body from missing annotation ${f.annotation}`);
|
|
392
392
|
}, c = (f) => {
|
|
393
|
-
const
|
|
394
|
-
return
|
|
393
|
+
const w = e.get(f);
|
|
394
|
+
return w ? { ...w } : void 0;
|
|
395
395
|
}, g = (f) => {
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
398
|
-
const A = c(
|
|
396
|
+
const w = t.get(f);
|
|
397
|
+
if (w) {
|
|
398
|
+
const A = c(w).bodies.find((B) => B.id === f);
|
|
399
399
|
if (A)
|
|
400
400
|
return A;
|
|
401
401
|
console.error(`Store integrity error: body ${f} in index, but not in annotation`);
|
|
402
402
|
} else
|
|
403
403
|
console.warn(`Attempt to retrieve missing body: ${f}`);
|
|
404
|
-
}, p = (f,
|
|
405
|
-
if (f.annotation !==
|
|
404
|
+
}, p = (f, w) => {
|
|
405
|
+
if (f.annotation !== w.annotation)
|
|
406
406
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
407
407
|
const A = e.get(f.annotation);
|
|
408
408
|
if (A) {
|
|
409
409
|
const B = A.bodies.find((R) => R.id === f.id), S = {
|
|
410
410
|
...A,
|
|
411
|
-
bodies: A.bodies.map((R) => R.id === B.id ?
|
|
411
|
+
bodies: A.bodies.map((R) => R.id === B.id ? w : R)
|
|
412
412
|
};
|
|
413
|
-
return e.set(A.id, S), B.id !==
|
|
413
|
+
return e.set(A.id, S), B.id !== w.id && (t.delete(B.id), t.set(w.id, S.id)), {
|
|
414
414
|
oldValue: A,
|
|
415
415
|
newValue: S,
|
|
416
|
-
bodiesUpdated: [{ oldBody: B, newBody:
|
|
416
|
+
bodiesUpdated: [{ oldBody: B, newBody: w }]
|
|
417
417
|
};
|
|
418
418
|
} else
|
|
419
419
|
console.warn(`Attempt to add body to missing annotation ${f.annotation}`);
|
|
420
|
-
},
|
|
421
|
-
const B = p(f,
|
|
422
|
-
s(A, { updated: [B] });
|
|
423
|
-
}, T = (f,
|
|
424
|
-
const A = f.map((B) => p({ id: B.id, annotation: B.annotation }, B));
|
|
425
|
-
s(
|
|
420
|
+
}, E = (f, w, A = C.LOCAL) => {
|
|
421
|
+
const B = p(f, w);
|
|
422
|
+
B && s(A, { updated: [B] });
|
|
423
|
+
}, T = (f, w = C.LOCAL) => {
|
|
424
|
+
const A = f.map((B) => p({ id: B.id, annotation: B.annotation }, B)).filter(Boolean);
|
|
425
|
+
s(w, { updated: A });
|
|
426
426
|
}, L = (f) => {
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
427
|
+
const w = e.get(f.annotation);
|
|
428
|
+
if (w) {
|
|
429
429
|
const A = {
|
|
430
|
-
...
|
|
430
|
+
...w,
|
|
431
431
|
target: {
|
|
432
|
-
...
|
|
432
|
+
...w.target,
|
|
433
433
|
...f
|
|
434
434
|
}
|
|
435
435
|
};
|
|
436
|
-
return e.set(
|
|
437
|
-
oldValue:
|
|
436
|
+
return e.set(w.id, A), {
|
|
437
|
+
oldValue: w,
|
|
438
438
|
newValue: A,
|
|
439
439
|
targetUpdated: {
|
|
440
|
-
oldTarget:
|
|
440
|
+
oldTarget: w.target,
|
|
441
441
|
newTarget: f
|
|
442
442
|
}
|
|
443
443
|
};
|
|
@@ -449,82 +449,81 @@ const Ct = (e, t) => {
|
|
|
449
449
|
addBody: b,
|
|
450
450
|
all: h,
|
|
451
451
|
bulkAddAnnotation: m,
|
|
452
|
-
bulkDeleteAnnotation:
|
|
452
|
+
bulkDeleteAnnotation: y,
|
|
453
453
|
bulkUpdateAnnotation: u,
|
|
454
454
|
bulkUpdateBodies: T,
|
|
455
|
-
bulkUpdateTargets: (f,
|
|
456
|
-
const A = f.map(
|
|
457
|
-
A.length > 0 && s(
|
|
455
|
+
bulkUpdateTargets: (f, w = C.LOCAL) => {
|
|
456
|
+
const A = f.map((B) => L(B)).filter(Boolean);
|
|
457
|
+
A.length > 0 && s(w, { updated: A });
|
|
458
458
|
},
|
|
459
|
-
clear:
|
|
460
|
-
deleteAnnotation:
|
|
459
|
+
clear: v,
|
|
460
|
+
deleteAnnotation: M,
|
|
461
461
|
deleteBody: l,
|
|
462
462
|
getAnnotation: c,
|
|
463
463
|
getBody: g,
|
|
464
464
|
observe: o,
|
|
465
465
|
unobserve: i,
|
|
466
466
|
updateAnnotation: d,
|
|
467
|
-
updateBody:
|
|
468
|
-
updateTarget: (f,
|
|
467
|
+
updateBody: E,
|
|
468
|
+
updateTarget: (f, w = C.LOCAL) => {
|
|
469
469
|
const A = L(f);
|
|
470
|
-
A && s(
|
|
470
|
+
A && s(w, { updated: [A] });
|
|
471
471
|
}
|
|
472
472
|
};
|
|
473
473
|
};
|
|
474
474
|
let Ot = () => ({
|
|
475
475
|
emit(e, ...t) {
|
|
476
|
-
let n = this.events[e] || [];
|
|
477
|
-
|
|
478
|
-
n[o](...t);
|
|
476
|
+
for (let n = 0, o = this.events[e] || [], i = o.length; n < i; n++)
|
|
477
|
+
o[n](...t);
|
|
479
478
|
},
|
|
480
479
|
events: {},
|
|
481
480
|
on(e, t) {
|
|
482
481
|
var n;
|
|
483
|
-
return (n = this.events[e]
|
|
482
|
+
return ((n = this.events)[e] || (n[e] = [])).push(t), () => {
|
|
484
483
|
var o;
|
|
485
484
|
this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
|
|
486
485
|
};
|
|
487
486
|
}
|
|
488
487
|
});
|
|
489
|
-
const Xt = 250,
|
|
488
|
+
const Xt = 250, Yt = (e) => {
|
|
490
489
|
const t = Ot(), n = [];
|
|
491
490
|
let o = -1, i = !1, s = 0;
|
|
492
491
|
const a = (m) => {
|
|
493
492
|
if (!i) {
|
|
494
|
-
const { changes:
|
|
495
|
-
if (
|
|
496
|
-
n.splice(o + 1), n.push(
|
|
493
|
+
const { changes: x } = m, M = performance.now();
|
|
494
|
+
if (M - s > Xt)
|
|
495
|
+
n.splice(o + 1), n.push(x), o = n.length - 1;
|
|
497
496
|
else {
|
|
498
|
-
const
|
|
499
|
-
n[
|
|
497
|
+
const y = n.length - 1;
|
|
498
|
+
n[y] = Lt(n[y], x);
|
|
500
499
|
}
|
|
501
|
-
s =
|
|
500
|
+
s = M;
|
|
502
501
|
}
|
|
503
502
|
i = !1;
|
|
504
503
|
};
|
|
505
|
-
e.observe(a, { origin:
|
|
506
|
-
const r = (m) =>
|
|
504
|
+
e.observe(a, { origin: C.LOCAL });
|
|
505
|
+
const r = (m) => m && m.length > 0 && e.bulkDeleteAnnotation(m), d = (m) => m && m.length > 0 && e.bulkAddAnnotation(m, !1), u = (m) => m && m.length > 0 && e.bulkUpdateAnnotation(m.map(({ oldValue: x }) => x)), b = (m) => m && m.length > 0 && e.bulkUpdateAnnotation(m.map(({ newValue: x }) => x)), h = (m) => m && m.length > 0 && e.bulkAddAnnotation(m, !1), v = (m) => m && m.length > 0 && e.bulkDeleteAnnotation(m);
|
|
507
506
|
return {
|
|
508
507
|
canRedo: () => n.length - 1 > o,
|
|
509
508
|
canUndo: () => o > -1,
|
|
510
509
|
destroy: () => e.unobserve(a),
|
|
511
|
-
on: (m,
|
|
510
|
+
on: (m, x) => t.on(m, x),
|
|
512
511
|
redo: () => {
|
|
513
512
|
if (n.length - 1 > o) {
|
|
514
513
|
i = !0;
|
|
515
|
-
const { created: m, updated:
|
|
516
|
-
d(m), b(
|
|
514
|
+
const { created: m, updated: x, deleted: M } = n[o + 1];
|
|
515
|
+
d(m), b(x), v(M), t.emit("redo", n[o + 1]), o += 1;
|
|
517
516
|
}
|
|
518
517
|
},
|
|
519
518
|
undo: () => {
|
|
520
519
|
if (o > -1) {
|
|
521
520
|
i = !0;
|
|
522
|
-
const { created: m, updated:
|
|
523
|
-
r(m), u(
|
|
521
|
+
const { created: m, updated: x, deleted: M } = n[o];
|
|
522
|
+
r(m), u(x), h(M), t.emit("undo", n[o]), o -= 1;
|
|
524
523
|
}
|
|
525
524
|
}
|
|
526
525
|
};
|
|
527
|
-
},
|
|
526
|
+
}, Ut = () => {
|
|
528
527
|
const { subscribe: e, set: t } = J([]);
|
|
529
528
|
return {
|
|
530
529
|
subscribe: e,
|
|
@@ -533,27 +532,27 @@ const Xt = 250, Ut = (e) => {
|
|
|
533
532
|
}, Dt = (e, t, n, o) => {
|
|
534
533
|
const { store: i, selection: s, hover: a, viewport: r } = e, d = /* @__PURE__ */ new Map();
|
|
535
534
|
let u = [], b, h;
|
|
536
|
-
const
|
|
535
|
+
const v = (l, c) => {
|
|
537
536
|
d.has(l) ? d.get(l).push(c) : d.set(l, [c]);
|
|
538
537
|
}, m = (l, c) => {
|
|
539
538
|
const g = d.get(l);
|
|
540
539
|
g && g.indexOf(c) > 0 && g.splice(g.indexOf(c), 1);
|
|
541
|
-
},
|
|
540
|
+
}, x = (l, c, g) => {
|
|
542
541
|
d.has(l) && setTimeout(() => {
|
|
543
542
|
d.get(l).forEach((p) => {
|
|
544
543
|
if (n) {
|
|
545
|
-
const
|
|
546
|
-
p(
|
|
544
|
+
const E = Array.isArray(c) ? c.map((L) => n.serialize(L)) : n.serialize(c), T = g ? g instanceof PointerEvent ? g : n.serialize(g) : void 0;
|
|
545
|
+
p(E, T);
|
|
547
546
|
} else
|
|
548
547
|
p(c, g);
|
|
549
548
|
});
|
|
550
549
|
}, 1);
|
|
551
|
-
},
|
|
552
|
-
const { selected: l } = s, c = l.map(({ id: g }) => i.getAnnotation(g));
|
|
550
|
+
}, M = () => {
|
|
551
|
+
const { selected: l } = s, c = (l || []).map(({ id: g }) => i.getAnnotation(g));
|
|
553
552
|
c.forEach((g) => {
|
|
554
|
-
const p = u.find((
|
|
555
|
-
(!p || !
|
|
556
|
-
}), u = u.map((g) => c.find(({ id:
|
|
553
|
+
const p = u.find((E) => E.id === g.id);
|
|
554
|
+
(!p || !U(p, g)) && x("updateAnnotation", g, p);
|
|
555
|
+
}), u = u.map((g) => c.find(({ id: E }) => E === g.id) || g);
|
|
557
556
|
};
|
|
558
557
|
s.subscribe(({ selected: l }) => {
|
|
559
558
|
if (!(u.length === 0 && l.length === 0)) {
|
|
@@ -562,13 +561,13 @@ const Xt = 250, Ut = (e) => {
|
|
|
562
561
|
else if (u.length > 0 && l.length === 0)
|
|
563
562
|
u.forEach((c) => {
|
|
564
563
|
const g = i.getAnnotation(c.id);
|
|
565
|
-
g && !
|
|
564
|
+
g && !U(g, c) && x("updateAnnotation", g, c);
|
|
566
565
|
}), u = [];
|
|
567
566
|
else {
|
|
568
567
|
const c = new Set(u.map((p) => p.id)), g = new Set(l.map(({ id: p }) => p));
|
|
569
568
|
u.filter((p) => !g.has(p.id)).forEach((p) => {
|
|
570
|
-
const
|
|
571
|
-
|
|
569
|
+
const E = i.getAnnotation(p.id);
|
|
570
|
+
E && !U(E, p) && x("updateAnnotation", E, p);
|
|
572
571
|
}), u = [
|
|
573
572
|
// Remove annotations that were deselected
|
|
574
573
|
...u.filter((p) => g.has(p.id)),
|
|
@@ -576,78 +575,82 @@ const Xt = 250, Ut = (e) => {
|
|
|
576
575
|
...l.filter(({ id: p }) => !c.has(p)).map(({ id: p }) => i.getAnnotation(p))
|
|
577
576
|
];
|
|
578
577
|
}
|
|
579
|
-
|
|
578
|
+
x("selectionChanged", u);
|
|
580
579
|
}
|
|
581
580
|
}), a.subscribe((l) => {
|
|
582
|
-
!b && l ?
|
|
583
|
-
}), r == null || r.subscribe((l) =>
|
|
584
|
-
o && (h && clearTimeout(h), h = setTimeout(
|
|
581
|
+
!b && l ? x("mouseEnterAnnotation", i.getAnnotation(l)) : b && !l ? x("mouseLeaveAnnotation", i.getAnnotation(b)) : b && l && (x("mouseLeaveAnnotation", i.getAnnotation(b)), x("mouseEnterAnnotation", i.getAnnotation(l))), b = l;
|
|
582
|
+
}), r == null || r.subscribe((l) => x("viewportIntersect", l.map((c) => i.getAnnotation(c)))), i.observe((l) => {
|
|
583
|
+
o && (h && clearTimeout(h), h = setTimeout(M, 1e3));
|
|
585
584
|
const { created: c, deleted: g } = l.changes;
|
|
586
|
-
c.forEach((p) =>
|
|
585
|
+
(c || []).forEach((p) => x("createAnnotation", p)), (g || []).forEach((p) => x("deleteAnnotation", p)), (l.changes.updated || []).filter((p) => [
|
|
587
586
|
...p.bodiesCreated || [],
|
|
588
587
|
...p.bodiesDeleted || [],
|
|
589
588
|
...p.bodiesUpdated || []
|
|
590
|
-
].length > 0).forEach(({ oldValue: p, newValue:
|
|
589
|
+
].length > 0).forEach(({ oldValue: p, newValue: E }) => {
|
|
591
590
|
const T = u.find((L) => L.id === p.id) || p;
|
|
592
|
-
u = u.map((L) => L.id === p.id ?
|
|
591
|
+
u = u.map((L) => L.id === p.id ? E : L), x("updateAnnotation", E, T);
|
|
593
592
|
});
|
|
594
|
-
}, { origin:
|
|
593
|
+
}, { origin: C.LOCAL }), i.observe((l) => {
|
|
595
594
|
if (u) {
|
|
596
|
-
const c = new Set(u.map((p) => p.id)), g = l.changes.updated.filter(({ newValue: p }) => c.has(p.id)).map(({ newValue: p }) => p);
|
|
595
|
+
const c = new Set(u.map((p) => p.id)), g = (l.changes.updated || []).filter(({ newValue: p }) => c.has(p.id)).map(({ newValue: p }) => p);
|
|
597
596
|
g.length > 0 && (u = u.map((p) => g.find((T) => T.id === p.id) || p));
|
|
598
597
|
}
|
|
599
|
-
}, { origin:
|
|
600
|
-
const
|
|
601
|
-
const { created: g, deleted: p, updated:
|
|
602
|
-
g.forEach((T) =>
|
|
598
|
+
}, { origin: C.REMOTE });
|
|
599
|
+
const y = (l) => (c) => {
|
|
600
|
+
const { created: g, deleted: p, updated: E } = c;
|
|
601
|
+
(g || []).forEach((T) => x("createAnnotation", T)), (p || []).forEach((T) => x("deleteAnnotation", T)), l ? (E || []).forEach((T) => x("updateAnnotation", T.oldValue, T.newValue)) : (E || []).forEach((T) => x("updateAnnotation", T.newValue, T.oldValue));
|
|
603
602
|
};
|
|
604
|
-
return t.on("undo",
|
|
603
|
+
return t.on("undo", y(!0)), t.on("redo", y(!1)), { on: v, off: m, emit: x };
|
|
605
604
|
}, It = (e) => (t) => t.reduce((n, o) => {
|
|
606
605
|
const { parsed: i, error: s } = e.parse(o);
|
|
607
606
|
return s ? {
|
|
608
607
|
parsed: n.parsed,
|
|
609
608
|
failed: [...n.failed, o]
|
|
610
|
-
} : {
|
|
609
|
+
} : i ? {
|
|
611
610
|
parsed: [...n.parsed, i],
|
|
612
611
|
failed: n.failed
|
|
612
|
+
} : {
|
|
613
|
+
...n
|
|
613
614
|
};
|
|
614
615
|
}, { parsed: [], failed: [] }), Vt = (e, t, n) => {
|
|
615
|
-
const { store: o, selection: i } = e, s = (
|
|
616
|
+
const { store: o, selection: i } = e, s = (y) => {
|
|
616
617
|
if (n) {
|
|
617
|
-
const { parsed: l, error: c } = n.parse(
|
|
618
|
-
l ? o.addAnnotation(l,
|
|
618
|
+
const { parsed: l, error: c } = n.parse(y);
|
|
619
|
+
l ? o.addAnnotation(l, C.REMOTE) : console.error(c);
|
|
619
620
|
} else
|
|
620
|
-
o.addAnnotation(
|
|
621
|
-
}, a = () => i.clear(), r = () => o.clear(), d = (
|
|
622
|
-
const l = o.getAnnotation(
|
|
621
|
+
o.addAnnotation(y, C.REMOTE);
|
|
622
|
+
}, a = () => i.clear(), r = () => o.clear(), d = (y) => {
|
|
623
|
+
const l = o.getAnnotation(y);
|
|
623
624
|
return n && l ? n.serialize(l) : l;
|
|
624
625
|
}, u = () => n ? o.all().map(n.serialize) : o.all(), b = () => {
|
|
625
|
-
var
|
|
626
|
-
const l = (((
|
|
626
|
+
var y;
|
|
627
|
+
const l = (((y = i.selected) == null ? void 0 : y.map((c) => c.id)) || []).map((c) => o.getAnnotation(c)).filter(Boolean);
|
|
627
628
|
return n ? l.map(n.serialize) : l;
|
|
628
|
-
}, h = (
|
|
629
|
-
if (typeof
|
|
630
|
-
const l = o.getAnnotation(
|
|
631
|
-
|
|
629
|
+
}, h = (y) => fetch(y).then((l) => l.json()).then((l) => (m(l), l)), v = (y) => {
|
|
630
|
+
if (typeof y == "string") {
|
|
631
|
+
const l = o.getAnnotation(y);
|
|
632
|
+
if (o.deleteAnnotation(y), l)
|
|
633
|
+
return n ? n.serialize(l) : l;
|
|
632
634
|
} else {
|
|
633
|
-
const l = n ? n.parse(
|
|
634
|
-
|
|
635
|
+
const l = n ? n.parse(y).parsed : y;
|
|
636
|
+
if (l)
|
|
637
|
+
return o.deleteAnnotation(l), y;
|
|
635
638
|
}
|
|
636
|
-
}, m = (
|
|
639
|
+
}, m = (y) => {
|
|
637
640
|
if (n) {
|
|
638
|
-
const { parsed: l, failed: c } = It(n)(
|
|
639
|
-
c.length > 0 && console.warn(`Discarded ${c.length} invalid annotations`, c), o.bulkAddAnnotation(l, !0,
|
|
641
|
+
const { parsed: l, failed: c } = It(n)(y);
|
|
642
|
+
c.length > 0 && console.warn(`Discarded ${c.length} invalid annotations`, c), o.bulkAddAnnotation(l, !0, C.REMOTE);
|
|
640
643
|
} else
|
|
641
|
-
o.bulkAddAnnotation(
|
|
642
|
-
},
|
|
643
|
-
|
|
644
|
-
},
|
|
644
|
+
o.bulkAddAnnotation(y, !0, C.REMOTE);
|
|
645
|
+
}, x = (y) => {
|
|
646
|
+
y ? i.setSelected(y) : i.clear();
|
|
647
|
+
}, M = (y) => {
|
|
645
648
|
if (n) {
|
|
646
|
-
const l = n.parse(
|
|
649
|
+
const l = n.parse(y).parsed, c = n.serialize(o.getAnnotation(l.id));
|
|
647
650
|
return o.updateAnnotation(l), c;
|
|
648
651
|
} else {
|
|
649
|
-
const l = o.getAnnotation(
|
|
650
|
-
return o.updateAnnotation(
|
|
652
|
+
const l = o.getAnnotation(y.id);
|
|
653
|
+
return o.updateAnnotation(y), l;
|
|
651
654
|
}
|
|
652
655
|
};
|
|
653
656
|
return {
|
|
@@ -661,11 +664,11 @@ const Xt = 250, Ut = (e) => {
|
|
|
661
664
|
getSelected: b,
|
|
662
665
|
loadAnnotations: h,
|
|
663
666
|
redo: t.redo,
|
|
664
|
-
removeAnnotation:
|
|
667
|
+
removeAnnotation: v,
|
|
665
668
|
setAnnotations: m,
|
|
666
|
-
setSelected:
|
|
669
|
+
setSelected: x,
|
|
667
670
|
undo: t.undo,
|
|
668
|
-
updateAnnotation:
|
|
671
|
+
updateAnnotation: M
|
|
669
672
|
};
|
|
670
673
|
};
|
|
671
674
|
let _t = (e) => crypto.getRandomValues(new Uint8Array(e)), kt = (e, t, n) => {
|
|
@@ -691,14 +694,14 @@ function it(e, t, n, o, i) {
|
|
|
691
694
|
var s = o - n + 1, a = t - n + 1, r = Math.log(s), d = 0.5 * Math.exp(2 * r / 3), u = 0.5 * Math.sqrt(r * d * (s - d) / s) * (a - s / 2 < 0 ? -1 : 1), b = Math.max(n, Math.floor(t - a * d / s + u)), h = Math.min(o, Math.floor(t + (s - a) * d / s + u));
|
|
692
695
|
it(e, t, b, h, i);
|
|
693
696
|
}
|
|
694
|
-
var
|
|
695
|
-
for (_(e, n, t), i(e[o],
|
|
696
|
-
for (_(e, m,
|
|
697
|
+
var v = e[t], m = n, x = o;
|
|
698
|
+
for (_(e, n, t), i(e[o], v) > 0 && _(e, n, o); m < x; ) {
|
|
699
|
+
for (_(e, m, x), m++, x--; i(e[m], v) < 0; )
|
|
697
700
|
m++;
|
|
698
|
-
for (; i(e[
|
|
699
|
-
|
|
701
|
+
for (; i(e[x], v) > 0; )
|
|
702
|
+
x--;
|
|
700
703
|
}
|
|
701
|
-
i(e[n],
|
|
704
|
+
i(e[n], v) === 0 ? _(e, n, x) : (x++, _(e, x, o)), x <= t && (n = x + 1), t <= x && (o = x - 1);
|
|
702
705
|
}
|
|
703
706
|
}
|
|
704
707
|
function _(e, t, n) {
|
|
@@ -724,7 +727,7 @@ class $t {
|
|
|
724
727
|
for (; n; ) {
|
|
725
728
|
for (let a = 0; a < n.children.length; a++) {
|
|
726
729
|
const r = n.children[a], d = n.leaf ? i(r) : r;
|
|
727
|
-
H(t, d) && (n.leaf ? o.push(r) :
|
|
730
|
+
H(t, d) && (n.leaf ? o.push(r) : K(t, d) ? this._all(r, o) : s.push(r));
|
|
728
731
|
}
|
|
729
732
|
n = s.pop();
|
|
730
733
|
}
|
|
@@ -739,7 +742,7 @@ class $t {
|
|
|
739
742
|
for (let i = 0; i < n.children.length; i++) {
|
|
740
743
|
const s = n.children[i], a = n.leaf ? this.toBBox(s) : s;
|
|
741
744
|
if (H(t, a)) {
|
|
742
|
-
if (n.leaf ||
|
|
745
|
+
if (n.leaf || K(t, a))
|
|
743
746
|
return !0;
|
|
744
747
|
o.push(s);
|
|
745
748
|
}
|
|
@@ -788,7 +791,7 @@ class $t {
|
|
|
788
791
|
if (b !== -1)
|
|
789
792
|
return o.children.splice(b, 1), s.push(o), this._condense(s), this;
|
|
790
793
|
}
|
|
791
|
-
!u && !o.leaf &&
|
|
794
|
+
!u && !o.leaf && K(o, i) ? (s.push(o), a.push(r), r = 0, d = o, o = o.children[0]) : d ? (r++, o = d.children[r], u = !1) : o = null;
|
|
792
795
|
}
|
|
793
796
|
return this;
|
|
794
797
|
}
|
|
@@ -824,9 +827,9 @@ class $t {
|
|
|
824
827
|
for (let b = n; b <= o; b += u) {
|
|
825
828
|
const h = Math.min(b + u - 1, o);
|
|
826
829
|
tt(t, b, h, d, this.compareMinY);
|
|
827
|
-
for (let
|
|
828
|
-
const m = Math.min(
|
|
829
|
-
r.children.push(this._build(t,
|
|
830
|
+
for (let v = b; v <= h; v += d) {
|
|
831
|
+
const m = Math.min(v + d - 1, h);
|
|
832
|
+
r.children.push(this._build(t, v, m, i - 1));
|
|
830
833
|
}
|
|
831
834
|
}
|
|
832
835
|
return I(r, this.toBBox), r;
|
|
@@ -835,7 +838,7 @@ class $t {
|
|
|
835
838
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
836
839
|
let s = 1 / 0, a = 1 / 0, r;
|
|
837
840
|
for (let d = 0; d < n.children.length; d++) {
|
|
838
|
-
const u = n.children[d], b =
|
|
841
|
+
const u = n.children[d], b = G(u), h = Kt(t, u) - b;
|
|
839
842
|
h < a ? (a = h, s = b < s ? b : s, r = u) : h === a && b < s && (s = b, r = u);
|
|
840
843
|
}
|
|
841
844
|
n = r || n.children[0];
|
|
@@ -861,14 +864,14 @@ class $t {
|
|
|
861
864
|
_chooseSplitIndex(t, n, o) {
|
|
862
865
|
let i, s = 1 / 0, a = 1 / 0;
|
|
863
866
|
for (let r = n; r <= o - n; r++) {
|
|
864
|
-
const d = N(t, 0, r, this.toBBox), u = N(t, r, o, this.toBBox), b = Jt(d, u), h =
|
|
867
|
+
const d = N(t, 0, r, this.toBBox), u = N(t, r, o, this.toBBox), b = Jt(d, u), h = G(d) + G(u);
|
|
865
868
|
b < s ? (s = b, i = r, a = h < a ? h : a) : b === s && h < a && (a = h, i = r);
|
|
866
869
|
}
|
|
867
870
|
return i || o - n;
|
|
868
871
|
}
|
|
869
872
|
// sorts node children by the best axis for split
|
|
870
873
|
_chooseSplitAxis(t, n, o) {
|
|
871
|
-
const i = t.leaf ? this.compareMinX : qt, s = t.leaf ? this.compareMinY :
|
|
874
|
+
const i = t.leaf ? this.compareMinX : qt, s = t.leaf ? this.compareMinY : Gt, a = this._allDistMargin(t, n, o, i), r = this._allDistMargin(t, n, o, s);
|
|
872
875
|
a < r && t.children.sort(i);
|
|
873
876
|
}
|
|
874
877
|
// total margin of all possible split distributions where each node is at least m full
|
|
@@ -920,23 +923,23 @@ function P(e, t) {
|
|
|
920
923
|
function qt(e, t) {
|
|
921
924
|
return e.minX - t.minX;
|
|
922
925
|
}
|
|
923
|
-
function
|
|
926
|
+
function Gt(e, t) {
|
|
924
927
|
return e.minY - t.minY;
|
|
925
928
|
}
|
|
926
|
-
function
|
|
929
|
+
function G(e) {
|
|
927
930
|
return (e.maxX - e.minX) * (e.maxY - e.minY);
|
|
928
931
|
}
|
|
929
932
|
function z(e) {
|
|
930
933
|
return e.maxX - e.minX + (e.maxY - e.minY);
|
|
931
934
|
}
|
|
932
|
-
function
|
|
935
|
+
function Kt(e, t) {
|
|
933
936
|
return (Math.max(t.maxX, e.maxX) - Math.min(t.minX, e.minX)) * (Math.max(t.maxY, e.maxY) - Math.min(t.minY, e.minY));
|
|
934
937
|
}
|
|
935
938
|
function Jt(e, t) {
|
|
936
939
|
const n = Math.max(e.minX, t.minX), o = Math.max(e.minY, t.minY), i = Math.min(e.maxX, t.maxX), s = Math.min(e.maxY, t.maxY);
|
|
937
940
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
938
941
|
}
|
|
939
|
-
function
|
|
942
|
+
function K(e, t) {
|
|
940
943
|
return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
|
|
941
944
|
}
|
|
942
945
|
function H(e, t) {
|
|
@@ -1025,14 +1028,14 @@ const jt = (e, t) => {
|
|
|
1025
1028
|
return e;
|
|
1026
1029
|
}, ee = (e, t) => {
|
|
1027
1030
|
const n = new $t(), o = /* @__PURE__ */ new Map(), i = (l) => {
|
|
1028
|
-
const c = t.getBoundingClientRect(), p = l.selector.range instanceof Range && !l.selector.range.collapsed && l.selector.range.startContainer.nodeType === Node.TEXT_NODE && l.selector.range.endContainer.nodeType === Node.TEXT_NODE ? l : k(l, t),
|
|
1031
|
+
const c = t.getBoundingClientRect(), p = l.selector.range instanceof Range && !l.selector.range.collapsed && l.selector.range.startContainer.nodeType === Node.TEXT_NODE && l.selector.range.endContainer.nodeType === Node.TEXT_NODE ? l : k(l, t), E = Array.from(p.selector.range.getClientRects()), T = Qt(E);
|
|
1029
1032
|
return T.map((L) => {
|
|
1030
|
-
const { x: f, y:
|
|
1033
|
+
const { x: f, y: w, width: A, height: B } = L;
|
|
1031
1034
|
return {
|
|
1032
1035
|
minX: f - c.x,
|
|
1033
|
-
minY:
|
|
1036
|
+
minY: w - c.y,
|
|
1034
1037
|
maxX: f - c.x + A,
|
|
1035
|
-
maxY:
|
|
1038
|
+
maxY: w - c.y + B,
|
|
1036
1039
|
annotation: {
|
|
1037
1040
|
id: l.annotation,
|
|
1038
1041
|
rects: T
|
|
@@ -1050,9 +1053,9 @@ const jt = (e, t) => {
|
|
|
1050
1053
|
d(l), r(l);
|
|
1051
1054
|
}, b = (l, c = !0) => {
|
|
1052
1055
|
c && a();
|
|
1053
|
-
const g = l.map((
|
|
1054
|
-
g.forEach(({ target:
|
|
1055
|
-
const p = g.reduce((
|
|
1056
|
+
const g = l.map((E) => ({ target: E, rects: i(E) }));
|
|
1057
|
+
g.forEach(({ target: E, rects: T }) => o.set(E.annotation, T));
|
|
1058
|
+
const p = g.reduce((E, { rects: T }) => [...E, ...T], []);
|
|
1056
1059
|
n.load(p);
|
|
1057
1060
|
}, h = (l, c) => {
|
|
1058
1061
|
const g = n.search({
|
|
@@ -1060,19 +1063,19 @@ const jt = (e, t) => {
|
|
|
1060
1063
|
minY: c,
|
|
1061
1064
|
maxX: l,
|
|
1062
1065
|
maxY: c
|
|
1063
|
-
}), p = (
|
|
1066
|
+
}), p = (E) => E.annotation.rects.reduce((T, L) => T + L.width * L.height, 0);
|
|
1064
1067
|
if (g.length > 0)
|
|
1065
|
-
return g.sort((
|
|
1066
|
-
},
|
|
1068
|
+
return g.sort((E, T) => p(E) - p(T)), g[0].annotation.id;
|
|
1069
|
+
}, v = (l) => {
|
|
1067
1070
|
const c = m(l);
|
|
1068
1071
|
if (c.length === 0)
|
|
1069
1072
|
return;
|
|
1070
|
-
let g = c[0].left, p = c[0].top,
|
|
1073
|
+
let g = c[0].left, p = c[0].top, E = c[0].right, T = c[0].bottom;
|
|
1071
1074
|
for (let L = 1; L < c.length; L++) {
|
|
1072
1075
|
const f = c[L];
|
|
1073
|
-
g = Math.min(g, f.left), p = Math.min(p, f.top),
|
|
1076
|
+
g = Math.min(g, f.left), p = Math.min(p, f.top), E = Math.max(E, f.right), T = Math.max(T, f.bottom);
|
|
1074
1077
|
}
|
|
1075
|
-
return new DOMRect(g, p,
|
|
1078
|
+
return new DOMRect(g, p, E - g, T - p);
|
|
1076
1079
|
}, m = (l) => {
|
|
1077
1080
|
const c = o.get(l);
|
|
1078
1081
|
return c ? c[0].annotation.rects : [];
|
|
@@ -1081,7 +1084,7 @@ const jt = (e, t) => {
|
|
|
1081
1084
|
all: s,
|
|
1082
1085
|
clear: a,
|
|
1083
1086
|
getAt: h,
|
|
1084
|
-
getBoundsForAnnotation:
|
|
1087
|
+
getBoundsForAnnotation: v,
|
|
1085
1088
|
getDOMRectsForAnnotation: m,
|
|
1086
1089
|
getIntersectingRects: (l, c, g, p) => n.search({ minX: l, minY: c, maxX: g, maxY: p }),
|
|
1087
1090
|
insert: r,
|
|
@@ -1095,47 +1098,47 @@ const jt = (e, t) => {
|
|
|
1095
1098
|
const { range: t } = e.target.selector;
|
|
1096
1099
|
return t instanceof Range && !t.collapsed;
|
|
1097
1100
|
}, ne = (e, t) => {
|
|
1098
|
-
const n = Rt(), o = ee(n, e), i =
|
|
1099
|
-
const c =
|
|
1101
|
+
const n = Rt(), o = ee(n, e), i = xt(n, t), s = wt(n), a = Ut(), r = (y, l = C.LOCAL) => {
|
|
1102
|
+
const c = y.target.selector.range instanceof Range ? y : { ...y, target: k(y.target, e) }, { range: g } = c.target.selector, p = g && !g.collapsed;
|
|
1100
1103
|
return p && n.addAnnotation(c, l), p;
|
|
1101
|
-
}, d = (
|
|
1102
|
-
const g =
|
|
1103
|
-
if (g.some((
|
|
1104
|
-
const
|
|
1105
|
-
return console.warn("Could not revive all targets"), console.warn(
|
|
1104
|
+
}, d = (y, l = !0, c = C.LOCAL) => {
|
|
1105
|
+
const g = y.map((E) => F(E) ? E : { ...E, target: k(E.target, e) });
|
|
1106
|
+
if (g.some((E) => E.target.selector.range.collapsed)) {
|
|
1107
|
+
const E = g.filter((T) => T.target.selector.range.collapsed);
|
|
1108
|
+
return console.warn("Could not revive all targets"), console.warn(E), n.bulkAddAnnotation(g, l, c), E;
|
|
1106
1109
|
} else
|
|
1107
1110
|
return n.bulkAddAnnotation(g, l, c), [];
|
|
1108
|
-
}, u = (
|
|
1109
|
-
const c =
|
|
1111
|
+
}, u = (y, l = C.LOCAL) => {
|
|
1112
|
+
const c = y.selector.range instanceof Range ? y : k(y, e);
|
|
1110
1113
|
n.updateTarget(c, l);
|
|
1111
|
-
}, b = (
|
|
1112
|
-
const c =
|
|
1114
|
+
}, b = (y, l = C.LOCAL) => {
|
|
1115
|
+
const c = y.map((g) => g.selector.range instanceof Range ? g : k(g, e));
|
|
1113
1116
|
n.bulkUpdateTargets(c, l);
|
|
1114
|
-
}, h = (
|
|
1115
|
-
const c = o.getAt(
|
|
1117
|
+
}, h = (y, l) => {
|
|
1118
|
+
const c = o.getAt(y, l);
|
|
1116
1119
|
return c ? n.getAnnotation(c) : void 0;
|
|
1117
|
-
},
|
|
1118
|
-
const p = o.getIntersectingRects(
|
|
1120
|
+
}, v = (y, l, c, g) => {
|
|
1121
|
+
const p = o.getIntersectingRects(y, l, c, g);
|
|
1119
1122
|
return Array.from(new Set(p.map((T) => T.annotation.id))).map((T) => n.getAnnotation(T)).filter((T) => T);
|
|
1120
|
-
}, m = (
|
|
1121
|
-
const p = o.getDOMRectsForAnnotation(
|
|
1123
|
+
}, m = (y, l, c, g = 5) => {
|
|
1124
|
+
const p = o.getDOMRectsForAnnotation(y);
|
|
1122
1125
|
if (p.length > 0) {
|
|
1123
1126
|
if (l && c) {
|
|
1124
|
-
const
|
|
1125
|
-
if (
|
|
1126
|
-
return
|
|
1127
|
+
const E = p.find(({ top: T, right: L, bottom: f, left: w }) => l >= w - g && l <= L + g && c >= T - g && c <= f + g);
|
|
1128
|
+
if (E)
|
|
1129
|
+
return E;
|
|
1127
1130
|
}
|
|
1128
|
-
return o.getBoundsForAnnotation(
|
|
1131
|
+
return o.getBoundsForAnnotation(y);
|
|
1129
1132
|
}
|
|
1130
|
-
},
|
|
1131
|
-
const
|
|
1132
|
-
return Object.entries(
|
|
1133
|
+
}, x = (y, l, c, g) => {
|
|
1134
|
+
const E = o.getIntersectingRects(y, l, c, g).reduce((T, L) => ((T[L.annotation.id] = T[L.annotation.id] || []).push(L), T), {});
|
|
1135
|
+
return Object.entries(E).map(([T, L]) => ({
|
|
1133
1136
|
annotation: n.getAnnotation(T),
|
|
1134
|
-
rects: L.map(({ minX: f, minY:
|
|
1137
|
+
rects: L.map(({ minX: f, minY: w, maxX: A, maxY: B }) => ({ x: f, y: w, width: A - f, height: B - w }))
|
|
1135
1138
|
}));
|
|
1136
|
-
},
|
|
1137
|
-
return n.observe(({ changes:
|
|
1138
|
-
const l = (
|
|
1139
|
+
}, M = () => o.recalculate();
|
|
1140
|
+
return n.observe(({ changes: y }) => {
|
|
1141
|
+
const l = (y.created || []).filter(F), c = (y.deleted || []).filter(F), g = (y.updated || []).filter((p) => F(p.newValue));
|
|
1139
1142
|
l.length > 0 && o.set(l.map((p) => p.target), !1), (c == null ? void 0 : c.length) > 0 && c.forEach((p) => o.remove(p.target)), (g == null ? void 0 : g.length) > 0 && g.forEach(({ newValue: p }) => o.update(p.target));
|
|
1140
1143
|
}), {
|
|
1141
1144
|
store: {
|
|
@@ -1145,9 +1148,9 @@ const jt = (e, t) => {
|
|
|
1145
1148
|
bulkUpdateTargets: b,
|
|
1146
1149
|
getAnnotationBounds: m,
|
|
1147
1150
|
getAt: h,
|
|
1148
|
-
getIntersecting:
|
|
1149
|
-
getIntersectingRects:
|
|
1150
|
-
recalculatePositions:
|
|
1151
|
+
getIntersecting: v,
|
|
1152
|
+
getIntersectingRects: x,
|
|
1153
|
+
recalculatePositions: M,
|
|
1151
1154
|
updateTarget: u
|
|
1152
1155
|
},
|
|
1153
1156
|
selection: i,
|
|
@@ -1162,21 +1165,26 @@ const jt = (e, t) => {
|
|
|
1162
1165
|
t.font && (d.font = t.font);
|
|
1163
1166
|
const h = n.get(s.id);
|
|
1164
1167
|
if (h) {
|
|
1165
|
-
const { x:
|
|
1166
|
-
d.fillStyle = h.appearance.color, d.fillRect(
|
|
1167
|
-
const
|
|
1168
|
-
d.fillRect(
|
|
1168
|
+
const { x: v, y: m, height: x } = a[0];
|
|
1169
|
+
d.fillStyle = h.appearance.color, d.fillRect(v - 2, m - 2.5, 2, x + 5);
|
|
1170
|
+
const M = d.measureText(h.appearance.label), y = M.width + 6, l = M.actualBoundingBoxAscent + M.actualBoundingBoxDescent + 8, c = M.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1171
|
+
d.fillRect(v - 2, m - 2.5 - l, y, l), d.fillStyle = "#fff", d.fillText(h.appearance.label, v + 1, m - c), r.fillStyle = h.appearance.color, r.globalAlpha = u ? 0.45 : 0.18, a.forEach(({ x: g, y: p, width: E, height: T }) => r.fillRect(g, p - 2.5, E, T + 5));
|
|
1169
1172
|
} else
|
|
1170
1173
|
nt.paint(s, a, r, d, u, b);
|
|
1171
1174
|
} };
|
|
1172
|
-
}, st = (e) =>
|
|
1175
|
+
}, st = (e) => {
|
|
1176
|
+
if (e === null)
|
|
1177
|
+
return document.scrollingElement;
|
|
1178
|
+
const { overflowY: t } = window.getComputedStyle(e);
|
|
1179
|
+
return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : st(e.parentElement);
|
|
1180
|
+
}, ie = (e, t) => (n) => {
|
|
1173
1181
|
const o = st(e);
|
|
1174
1182
|
if (o) {
|
|
1175
1183
|
const i = t.getAnnotation(n.id), { range: s } = i.target.selector;
|
|
1176
1184
|
if (!s || s.collapsed)
|
|
1177
1185
|
return !1;
|
|
1178
|
-
const a = o.getBoundingClientRect(), r = o.clientHeight, d = o.clientWidth, u = i.target.selector.range.getBoundingClientRect(), { width: b, height: h } = t.getAnnotationBounds(n.id),
|
|
1179
|
-
return o.scroll({ top:
|
|
1186
|
+
const a = o.getBoundingClientRect(), r = o.clientHeight, d = o.clientWidth, u = i.target.selector.range.getBoundingClientRect(), { width: b, height: h } = t.getAnnotationBounds(n.id), v = u.top - a.top, m = u.left - a.left, x = o.parentElement ? o.scrollTop : 0, M = o.parentElement ? o.scrollLeft : 0, y = v + x - (r - h) / 2, l = m + M - (d - b) / 2;
|
|
1187
|
+
return o.scroll({ top: y, left: l, behavior: "smooth" }), !0;
|
|
1180
1188
|
}
|
|
1181
1189
|
};
|
|
1182
1190
|
let $;
|
|
@@ -1216,12 +1224,12 @@ const de = (e, t, n) => {
|
|
|
1216
1224
|
}, ue = (e, t, n) => {
|
|
1217
1225
|
const { store: o, selection: i } = t;
|
|
1218
1226
|
let s, a = null;
|
|
1219
|
-
const r = (
|
|
1227
|
+
const r = (v) => s = v;
|
|
1220
1228
|
let d = !1, u;
|
|
1221
|
-
e.addEventListener("selectstart", (
|
|
1229
|
+
e.addEventListener("selectstart", (v) => {
|
|
1222
1230
|
if (!d)
|
|
1223
1231
|
return;
|
|
1224
|
-
!
|
|
1232
|
+
!v.target.parentElement.closest(".not-annotatable") ? a = {
|
|
1225
1233
|
annotation: ce(),
|
|
1226
1234
|
selector: void 0,
|
|
1227
1235
|
creator: s,
|
|
@@ -1229,36 +1237,36 @@ const de = (e, t, n) => {
|
|
|
1229
1237
|
} : (a = null, u = void 0);
|
|
1230
1238
|
});
|
|
1231
1239
|
let b;
|
|
1232
|
-
document.addEventListener("selectionchange", (
|
|
1240
|
+
document.addEventListener("selectionchange", (v) => {
|
|
1233
1241
|
b && clearTimeout(b), b = setTimeout(() => h(), 50);
|
|
1234
1242
|
});
|
|
1235
1243
|
const h = () => {
|
|
1236
|
-
var m,
|
|
1237
|
-
const
|
|
1238
|
-
if (!
|
|
1239
|
-
const
|
|
1240
|
-
te(
|
|
1244
|
+
var m, x;
|
|
1245
|
+
const v = document.getSelection();
|
|
1246
|
+
if (!v.isCollapsed && d && a) {
|
|
1247
|
+
const M = Array.from(Array(v.rangeCount).keys()).map((c) => v.getRangeAt(c));
|
|
1248
|
+
te(M[0]).toString() !== ((x = (m = a.selector) == null ? void 0 : m.range) == null ? void 0 : x.toString()) && (a = {
|
|
1241
1249
|
...a,
|
|
1242
|
-
selector: de(
|
|
1243
|
-
}, o.getAnnotation(a.annotation) ? o.updateTarget(a,
|
|
1250
|
+
selector: de(M[0], e, n)
|
|
1251
|
+
}, o.getAnnotation(a.annotation) ? o.updateTarget(a, C.LOCAL) : (o.addAnnotation({
|
|
1244
1252
|
id: a.annotation,
|
|
1245
1253
|
bodies: [],
|
|
1246
1254
|
target: a
|
|
1247
1255
|
}), i.clickSelect(a.annotation, u)));
|
|
1248
1256
|
}
|
|
1249
1257
|
};
|
|
1250
|
-
return e.addEventListener("pointerdown", (
|
|
1251
|
-
u =
|
|
1252
|
-
}), document.addEventListener("pointerup", (
|
|
1253
|
-
var
|
|
1254
|
-
u =
|
|
1258
|
+
return e.addEventListener("pointerdown", (v) => {
|
|
1259
|
+
u = v, d = v.button === 0;
|
|
1260
|
+
}), document.addEventListener("pointerup", (v) => {
|
|
1261
|
+
var x;
|
|
1262
|
+
u = v, !((x = v.target.parentElement) != null && x.closest(".not-annotatable") || !d) && setTimeout(() => {
|
|
1255
1263
|
if (a != null && a.selector)
|
|
1256
|
-
o.updateTarget(a,
|
|
1264
|
+
o.updateTarget(a, C.LOCAL), i.clickSelect(a.annotation, v), a = null, u = void 0;
|
|
1257
1265
|
else {
|
|
1258
|
-
const { x:
|
|
1266
|
+
const { x: M, y } = e.getBoundingClientRect(), l = o.getAt(v.clientX - M, v.clientY - y);
|
|
1259
1267
|
if (l) {
|
|
1260
1268
|
const { selected: c } = i;
|
|
1261
|
-
(c.length !== 1 || c[0].id !== l.id) && (i.clickSelect(l.id,
|
|
1269
|
+
(c.length !== 1 || c[0].id !== l.id) && (i.clickSelect(l.id, v), u = void 0);
|
|
1262
1270
|
} else
|
|
1263
1271
|
i.isEmpty() || i.clear();
|
|
1264
1272
|
}
|
|
@@ -1268,7 +1276,7 @@ const de = (e, t, n) => {
|
|
|
1268
1276
|
};
|
|
1269
1277
|
};
|
|
1270
1278
|
const he = (e, t = {}) => {
|
|
1271
|
-
const n = ne(e, t.pointerAction), { selection: o, viewport: i } = n, s = n.store, a =
|
|
1279
|
+
const n = ne(e, t.pointerAction), { selection: o, viewport: i } = n, s = n.store, a = Yt(s), r = Dt(
|
|
1272
1280
|
n,
|
|
1273
1281
|
a,
|
|
1274
1282
|
t.adapter
|
|
@@ -1302,7 +1310,7 @@ const he = (e, t = {}) => {
|
|
|
1302
1310
|
};
|
|
1303
1311
|
};
|
|
1304
1312
|
export {
|
|
1305
|
-
|
|
1313
|
+
C as Origin,
|
|
1306
1314
|
bt as createHighlightLayer,
|
|
1307
1315
|
he as createTextAnnotator,
|
|
1308
1316
|
ne as createTextAnnotatorState,
|