@recogito/text-annotator 3.0.0-rc.7 → 3.0.0-rc.9
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/api/scrollIntoView.d.ts +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/utils/getContext.d.ts +4 -0
- package/dist/text-annotator.css +1 -1
- package/dist/text-annotator.es.js +278 -273
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +1 -1
- package/dist/text-annotator.umd.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const ft = { fill: "rgb(0, 128, 255", fillOpacity: 0.18 }, gt = { fill: "rgb(0, 128, 255)", fillOpacity: 0.45 }, nt = {
|
|
2
2
|
paint: (e, t, n, o, i, s) => {
|
|
3
|
-
const
|
|
4
|
-
n.fillStyle =
|
|
3
|
+
const r = s ? typeof s == "function" ? s(e, i) : s : i ? gt : ft;
|
|
4
|
+
n.fillStyle = r.fill, n.globalAlpha = r.fillOpacity || 1, t.forEach(({ x: a, y: d, width: u, height: b }) => n.fillRect(a, d - 2.5, u, b + 5));
|
|
5
5
|
}
|
|
6
6
|
}, pt = (e) => {
|
|
7
7
|
let t = /* @__PURE__ */ new Set();
|
|
@@ -9,8 +9,7 @@ const ft = { fill: "rgb(0, 128, 255", fillOpacity: 0.18 }, gt = { fill: "rgb(0,
|
|
|
9
9
|
const i = o.map((s) => s.id);
|
|
10
10
|
(t.size !== i.length || i.some((s) => !t.has(s))) && e.set(i), t = new Set(i);
|
|
11
11
|
};
|
|
12
|
-
}
|
|
13
|
-
const mt = (e, t = 10) => {
|
|
12
|
+
}, mt = (e, t = 10) => {
|
|
14
13
|
let n;
|
|
15
14
|
return (...o) => {
|
|
16
15
|
clearTimeout(n), n = setTimeout(() => e.apply(void 0, o), t);
|
|
@@ -29,17 +28,17 @@ const mt = (e, t = 10) => {
|
|
|
29
28
|
}
|
|
30
29
|
}, bt = (e, t, n) => {
|
|
31
30
|
const { store: o, selection: i, hover: s } = t;
|
|
32
|
-
let
|
|
31
|
+
let r, a, d = nt;
|
|
33
32
|
const u = pt(n);
|
|
34
33
|
e.classList.add("r6o-annotatable");
|
|
35
34
|
const b = j("r6o-highlight-layer bg"), h = j("r6o-highlight-layer fg", !0), v = b.getContext("2d"), m = h.getContext("2d");
|
|
36
35
|
e.insertBefore(b, e.firstChild), e.appendChild(h), e.addEventListener("pointermove", (E) => {
|
|
37
36
|
const { x: T, y: L } = e.getBoundingClientRect(), f = o.getAt(E.clientX - T, E.clientY - L);
|
|
38
|
-
f && (!
|
|
37
|
+
f && (!a || a(f)) ? s.current !== f.id && (e.classList.add("hovered"), s.set(f.id)) : s.current && (e.classList.remove("hovered"), s.set(null));
|
|
39
38
|
});
|
|
40
39
|
const x = () => {
|
|
41
|
-
const { top: E, left: T } = e.getBoundingClientRect(), { innerWidth: L, innerHeight: f } = window,
|
|
42
|
-
return { top: E, left: T, minX:
|
|
40
|
+
const { top: E, left: T } = e.getBoundingClientRect(), { innerWidth: L, innerHeight: f } = window, A = -T, w = -E, B = L - T, S = f - E;
|
|
41
|
+
return { top: E, left: T, minX: A, minY: w, maxX: B, maxY: S };
|
|
43
42
|
}, M = () => c();
|
|
44
43
|
document.addEventListener("scroll", M, { capture: !0, passive: !0 });
|
|
45
44
|
const y = mt(() => {
|
|
@@ -47,59 +46,59 @@ const mt = (e, t = 10) => {
|
|
|
47
46
|
});
|
|
48
47
|
window.addEventListener("resize", y), new ResizeObserver(y).observe(e);
|
|
49
48
|
const c = () => requestAnimationFrame(() => {
|
|
50
|
-
const { top: E, left: T, minX: L, minY: f, maxX:
|
|
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:
|
|
52
|
-
const
|
|
49
|
+
const { top: E, left: T, minX: L, minY: f, maxX: A, maxY: w } = x(), B = a ? o.getIntersectingRects(L, f, A, w).filter(({ annotation: Y }) => a(Y)) : o.getIntersectingRects(L, f, A, w), { width: S, height: R } = h, X = new Set(i.selected.map(({ id: Y }) => Y));
|
|
50
|
+
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: rt }) => {
|
|
51
|
+
const at = rt.map(({ x: ct, y: dt, width: ut, height: ht }) => ({
|
|
53
52
|
x: ct + T,
|
|
54
53
|
y: dt + E,
|
|
55
54
|
width: ut,
|
|
56
55
|
height: ht
|
|
57
56
|
})), lt = X.has(Y.id);
|
|
58
|
-
d.paint(Y,
|
|
57
|
+
d.paint(Y, at, v, m, lt, r);
|
|
59
58
|
}), setTimeout(() => u(B.map(({ annotation: Y }) => Y)), 1);
|
|
60
59
|
});
|
|
61
60
|
return o.observe(() => c()), i.subscribe(() => c()), {
|
|
62
61
|
redraw: c,
|
|
63
62
|
setDrawingStyle: (E) => {
|
|
64
|
-
|
|
63
|
+
r = E, c();
|
|
65
64
|
},
|
|
66
65
|
setFilter: (E) => {
|
|
67
|
-
|
|
66
|
+
a = E, c();
|
|
68
67
|
},
|
|
69
68
|
setPainter: (E) => d = E
|
|
70
69
|
};
|
|
71
|
-
},
|
|
70
|
+
}, _ = (e, t) => {
|
|
72
71
|
const { start: n, end: o } = e.selector, i = e.selector.offsetReference ? e.selector.offsetReference : t;
|
|
73
72
|
if (!i)
|
|
74
73
|
return e;
|
|
75
74
|
const s = document.createNodeIterator(t, NodeFilter.SHOW_TEXT);
|
|
76
|
-
let
|
|
75
|
+
let r = 0, a = document.createRange(), d = s.nextNode();
|
|
77
76
|
d === null && console.error("Could not revive annotation target. Content missing.");
|
|
78
77
|
let u = !i;
|
|
79
78
|
for (; d !== null; ) {
|
|
80
79
|
const b = d.textContent.length;
|
|
81
80
|
if (!u && i && (u = i.contains(d)), u) {
|
|
82
|
-
if (
|
|
83
|
-
|
|
81
|
+
if (r + b > n) {
|
|
82
|
+
a.setStart(d, n - r);
|
|
84
83
|
break;
|
|
85
84
|
}
|
|
86
|
-
|
|
85
|
+
r += b;
|
|
87
86
|
}
|
|
88
87
|
d = s.nextNode();
|
|
89
88
|
}
|
|
90
89
|
for (; d !== null; ) {
|
|
91
90
|
const b = d.textContent.length;
|
|
92
|
-
if (
|
|
93
|
-
|
|
91
|
+
if (r + b > o) {
|
|
92
|
+
a.setEnd(d, o - r);
|
|
94
93
|
break;
|
|
95
94
|
}
|
|
96
|
-
|
|
95
|
+
r += b, d = s.nextNode();
|
|
97
96
|
}
|
|
98
97
|
return {
|
|
99
98
|
...e,
|
|
100
99
|
selector: {
|
|
101
100
|
...e.selector,
|
|
102
|
-
range:
|
|
101
|
+
range: a
|
|
103
102
|
}
|
|
104
103
|
};
|
|
105
104
|
};
|
|
@@ -131,15 +130,15 @@ function U(e, t) {
|
|
|
131
130
|
}
|
|
132
131
|
function W() {
|
|
133
132
|
}
|
|
134
|
-
function
|
|
133
|
+
function wt(e, t) {
|
|
135
134
|
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
|
|
136
135
|
}
|
|
137
136
|
const D = [];
|
|
138
137
|
function J(e, t = W) {
|
|
139
138
|
let n;
|
|
140
139
|
const o = /* @__PURE__ */ new Set();
|
|
141
|
-
function i(
|
|
142
|
-
if (
|
|
140
|
+
function i(a) {
|
|
141
|
+
if (wt(e, a) && (e = a, n)) {
|
|
143
142
|
const d = !D.length;
|
|
144
143
|
for (const u of o)
|
|
145
144
|
u[1](), D.push(u, e);
|
|
@@ -150,24 +149,24 @@ function J(e, t = W) {
|
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
|
-
function s(
|
|
154
|
-
i(
|
|
152
|
+
function s(a) {
|
|
153
|
+
i(a(e));
|
|
155
154
|
}
|
|
156
|
-
function a
|
|
157
|
-
const u = [
|
|
158
|
-
return o.add(u), o.size === 1 && (n = t(i, s) || W),
|
|
155
|
+
function r(a, d = W) {
|
|
156
|
+
const u = [a, d];
|
|
157
|
+
return o.add(u), o.size === 1 && (n = t(i, s) || W), a(e), () => {
|
|
159
158
|
o.delete(u), o.size === 0 && n && (n(), n = null);
|
|
160
159
|
};
|
|
161
160
|
}
|
|
162
|
-
return { set: i, update: s, subscribe:
|
|
161
|
+
return { set: i, update: s, subscribe: r };
|
|
163
162
|
}
|
|
164
|
-
const
|
|
163
|
+
const At = (e) => {
|
|
165
164
|
const { subscribe: t, set: n } = J();
|
|
166
165
|
let o;
|
|
167
166
|
return t((i) => o = i), e.observe(({ changes: i }) => {
|
|
168
167
|
if (o) {
|
|
169
|
-
(i.deleted || []).some((
|
|
170
|
-
const s = (i.updated || []).find(({ oldValue:
|
|
168
|
+
(i.deleted || []).some((r) => r.id === o) && n(void 0);
|
|
169
|
+
const s = (i.updated || []).find(({ oldValue: r }) => r.id === o);
|
|
171
170
|
s && n(s.newValue.id);
|
|
172
171
|
}
|
|
173
172
|
}), {
|
|
@@ -181,10 +180,10 @@ const wt = (e) => {
|
|
|
181
180
|
const { subscribe: n, set: o } = J(q);
|
|
182
181
|
let i = q;
|
|
183
182
|
n((h) => i = h);
|
|
184
|
-
const s = () => o(q),
|
|
183
|
+
const s = () => o(q), r = () => {
|
|
185
184
|
var h;
|
|
186
185
|
return ((h = i.selected) == null ? void 0 : h.length) === 0;
|
|
187
|
-
},
|
|
186
|
+
}, a = (h) => {
|
|
188
187
|
if (i.selected.length === 0)
|
|
189
188
|
return !1;
|
|
190
189
|
const v = typeof h == "string" ? h : h.id;
|
|
@@ -214,8 +213,8 @@ const wt = (e) => {
|
|
|
214
213
|
get pointerEvent() {
|
|
215
214
|
return i ? i.pointerEvent : null;
|
|
216
215
|
},
|
|
217
|
-
isEmpty:
|
|
218
|
-
isSelected:
|
|
216
|
+
isEmpty: r,
|
|
217
|
+
isSelected: a,
|
|
219
218
|
setSelected: u,
|
|
220
219
|
subscribe: n
|
|
221
220
|
};
|
|
@@ -250,25 +249,25 @@ const Mt = (e, t) => {
|
|
|
250
249
|
if (!(!e.options.origin || e.options.origin === s))
|
|
251
250
|
return !1;
|
|
252
251
|
if (e.options.ignore) {
|
|
253
|
-
const { ignore:
|
|
254
|
-
if (!(
|
|
255
|
-
const d = (n = i.updated) == null ? void 0 : n.some((b) =>
|
|
256
|
-
if (
|
|
252
|
+
const { ignore: r } = e.options, a = (d) => d && d.length > 0;
|
|
253
|
+
if (!(a(i.created) || a(i.deleted))) {
|
|
254
|
+
const d = (n = i.updated) == null ? void 0 : n.some((b) => a(b.bodiesCreated) || a(b.bodiesDeleted) || a(b.bodiesUpdated)), u = (o = i.updated) == null ? void 0 : o.some((b) => b.targetUpdated);
|
|
255
|
+
if (r === "BODY_ONLY" && d && !u || r === "TARGET_ONLY" && u && !d)
|
|
257
256
|
return !1;
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
259
|
if (e.options.annotations) {
|
|
261
|
-
const
|
|
262
|
-
...(i.created || []).map((
|
|
263
|
-
...(i.deleted || []).map((
|
|
264
|
-
...(i.updated || []).map(({ oldValue:
|
|
260
|
+
const r = /* @__PURE__ */ new Set([
|
|
261
|
+
...(i.created || []).map((a) => a.id),
|
|
262
|
+
...(i.deleted || []).map((a) => a.id),
|
|
263
|
+
...(i.updated || []).map(({ oldValue: a }) => a.id)
|
|
265
264
|
]);
|
|
266
|
-
return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((
|
|
265
|
+
return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((a) => r.has(a));
|
|
267
266
|
} else
|
|
268
267
|
return !0;
|
|
269
268
|
}, Lt = (e, t) => {
|
|
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)),
|
|
271
|
-
...(e.created || []).filter((h) => !s.has(h.id)).map((h) =>
|
|
269
|
+
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)), r = new Set((t.updated || []).map(({ oldValue: h }) => h.id)), a = new Set((t.updated || []).filter(({ oldValue: h }) => n.has(h.id) || o.has(h.id)).map(({ oldValue: h }) => h.id)), d = [
|
|
270
|
+
...(e.created || []).filter((h) => !s.has(h.id)).map((h) => r.has(h.id) ? t.updated.find(({ oldValue: v }) => v.id === h.id).newValue : h),
|
|
272
271
|
...t.created || []
|
|
273
272
|
], u = [
|
|
274
273
|
...(e.deleted || []).filter((h) => !i.has(h.id)),
|
|
@@ -276,75 +275,75 @@ const Mt = (e, t) => {
|
|
|
276
275
|
], b = [
|
|
277
276
|
...(e.updated || []).filter(({ newValue: h }) => !s.has(h.id)).map((h) => {
|
|
278
277
|
const { oldValue: v, newValue: m } = h;
|
|
279
|
-
if (
|
|
278
|
+
if (r.has(m.id)) {
|
|
280
279
|
const x = t.updated.find((M) => M.oldValue.id === m.id).newValue;
|
|
281
280
|
return ot(v, x);
|
|
282
281
|
} else
|
|
283
282
|
return h;
|
|
284
283
|
}),
|
|
285
|
-
...(t.updated || []).filter(({ oldValue: h }) => !
|
|
284
|
+
...(t.updated || []).filter(({ oldValue: h }) => !a.has(h.id))
|
|
286
285
|
];
|
|
287
286
|
return { created: d, deleted: u, updated: b };
|
|
288
287
|
}, Ct = (e) => e.id !== void 0, Rt = () => {
|
|
289
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (f,
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
}, s = (f,
|
|
293
|
-
const
|
|
288
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (f, A = {}) => n.push({ onChange: f, options: A }), i = (f) => {
|
|
289
|
+
const A = n.findIndex((w) => w.onChange == f);
|
|
290
|
+
A > -1 && n.splice(A, 1);
|
|
291
|
+
}, s = (f, A) => {
|
|
292
|
+
const w = {
|
|
294
293
|
origin: f,
|
|
295
294
|
changes: {
|
|
296
|
-
created:
|
|
297
|
-
updated:
|
|
298
|
-
deleted:
|
|
295
|
+
created: A.created || [],
|
|
296
|
+
updated: A.updated || [],
|
|
297
|
+
deleted: A.deleted || []
|
|
299
298
|
},
|
|
300
299
|
state: [...e.values()]
|
|
301
300
|
};
|
|
302
301
|
n.forEach((B) => {
|
|
303
|
-
Mt(B,
|
|
302
|
+
Mt(B, w) && B.onChange(w);
|
|
304
303
|
});
|
|
305
|
-
},
|
|
304
|
+
}, r = (f, A = C.LOCAL) => {
|
|
306
305
|
if (e.get(f.id))
|
|
307
306
|
throw Error(`Cannot add annotation ${f.id} - exists already`);
|
|
308
|
-
e.set(f.id, f), f.bodies.forEach((
|
|
309
|
-
},
|
|
310
|
-
const
|
|
307
|
+
e.set(f.id, f), f.bodies.forEach((w) => t.set(w.id, f.id)), s(A, { created: [f] });
|
|
308
|
+
}, a = (f, A) => {
|
|
309
|
+
const w = typeof f == "string" ? A : f, B = typeof f == "string" ? f : f.id, S = e.get(B);
|
|
311
310
|
if (S) {
|
|
312
|
-
const R = ot(S,
|
|
313
|
-
return B ===
|
|
311
|
+
const R = ot(S, w);
|
|
312
|
+
return B === w.id ? e.set(B, w) : (e.delete(B), e.set(w.id, w)), S.bodies.forEach((X) => t.delete(X.id)), w.bodies.forEach((X) => t.set(X.id, w.id)), R;
|
|
314
313
|
} else
|
|
315
314
|
console.warn(`Cannot update annotation ${B} - does not exist`);
|
|
316
|
-
}, d = (f,
|
|
317
|
-
const B = Ct(
|
|
315
|
+
}, d = (f, A = C.LOCAL, w = C.LOCAL) => {
|
|
316
|
+
const B = Ct(A) ? w : A, S = a(f, A);
|
|
318
317
|
S && s(B, { updated: [S] });
|
|
319
|
-
}, u = (f,
|
|
320
|
-
const
|
|
321
|
-
const R =
|
|
318
|
+
}, u = (f, A = C.LOCAL) => {
|
|
319
|
+
const w = f.reduce((B, S) => {
|
|
320
|
+
const R = a(S);
|
|
322
321
|
return R ? [...B, R] : B;
|
|
323
322
|
}, []);
|
|
324
|
-
|
|
325
|
-
}, b = (f,
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
323
|
+
w.length > 0 && s(A, { updated: w });
|
|
324
|
+
}, b = (f, A = C.LOCAL) => {
|
|
325
|
+
const w = e.get(f.annotation);
|
|
326
|
+
if (w) {
|
|
328
327
|
const B = {
|
|
329
|
-
...
|
|
330
|
-
bodies: [...
|
|
328
|
+
...w,
|
|
329
|
+
bodies: [...w.bodies, f]
|
|
331
330
|
};
|
|
332
|
-
e.set(
|
|
333
|
-
oldValue:
|
|
331
|
+
e.set(w.id, B), t.set(f.id, B.id), s(A, { updated: [{
|
|
332
|
+
oldValue: w,
|
|
334
333
|
newValue: B,
|
|
335
334
|
bodiesCreated: [f]
|
|
336
335
|
}] });
|
|
337
336
|
} else
|
|
338
337
|
console.warn(`Attempt to add body to missing annotation: ${f.annotation}`);
|
|
339
338
|
}, h = () => [...e.values()], v = (f = C.LOCAL) => {
|
|
340
|
-
const
|
|
341
|
-
e.clear(), t.clear(), s(f, { deleted:
|
|
342
|
-
}, m = (f,
|
|
343
|
-
if (
|
|
339
|
+
const A = [...e.values()];
|
|
340
|
+
e.clear(), t.clear(), s(f, { deleted: A });
|
|
341
|
+
}, m = (f, A = !0, w = C.LOCAL) => {
|
|
342
|
+
if (A) {
|
|
344
343
|
const B = [...e.values()];
|
|
345
344
|
e.clear(), t.clear(), f.forEach((S) => {
|
|
346
345
|
e.set(S.id, S), S.bodies.forEach((R) => t.set(R.id, S.id));
|
|
347
|
-
}), s(
|
|
346
|
+
}), s(w, { created: f, deleted: B });
|
|
348
347
|
} else {
|
|
349
348
|
const B = f.reduce((S, R) => {
|
|
350
349
|
const X = e.get(R.id);
|
|
@@ -354,34 +353,34 @@ const Mt = (e, t) => {
|
|
|
354
353
|
throw Error(`Bulk insert would overwrite the following annotations: ${B.map((S) => S.id).join(", ")}`);
|
|
355
354
|
f.forEach((S) => {
|
|
356
355
|
e.set(S.id, S), S.bodies.forEach((R) => t.set(R.id, S.id));
|
|
357
|
-
}), s(
|
|
356
|
+
}), s(w, { created: f });
|
|
358
357
|
}
|
|
359
358
|
}, x = (f) => {
|
|
360
|
-
const
|
|
361
|
-
if (
|
|
362
|
-
return e.delete(
|
|
363
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
364
|
-
}, M = (f,
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
}, y = (f,
|
|
368
|
-
const
|
|
359
|
+
const A = typeof f == "string" ? f : f.id, w = e.get(A);
|
|
360
|
+
if (w)
|
|
361
|
+
return e.delete(A), w.bodies.forEach((B) => t.delete(B.id)), w;
|
|
362
|
+
console.warn(`Attempt to delete missing annotation: ${A}`);
|
|
363
|
+
}, M = (f, A = C.LOCAL) => {
|
|
364
|
+
const w = x(f);
|
|
365
|
+
w && s(A, { deleted: [w] });
|
|
366
|
+
}, y = (f, A = C.LOCAL) => {
|
|
367
|
+
const w = f.reduce((B, S) => {
|
|
369
368
|
const R = x(S);
|
|
370
369
|
return R ? [...B, R] : B;
|
|
371
370
|
}, []);
|
|
372
|
-
|
|
373
|
-
}, l = (f,
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
376
|
-
const B =
|
|
371
|
+
w.length > 0 && s(A, { deleted: w });
|
|
372
|
+
}, l = (f, A = C.LOCAL) => {
|
|
373
|
+
const w = e.get(f.annotation);
|
|
374
|
+
if (w) {
|
|
375
|
+
const B = w.bodies.find((S) => S.id === f.id);
|
|
377
376
|
if (B) {
|
|
378
377
|
t.delete(B.id);
|
|
379
378
|
const S = {
|
|
380
|
-
...
|
|
381
|
-
bodies:
|
|
379
|
+
...w,
|
|
380
|
+
bodies: w.bodies.filter((R) => R.id !== f.id)
|
|
382
381
|
};
|
|
383
|
-
e.set(
|
|
384
|
-
oldValue:
|
|
382
|
+
e.set(w.id, S), s(A, { updated: [{
|
|
383
|
+
oldValue: w,
|
|
385
384
|
newValue: S,
|
|
386
385
|
bodiesDeleted: [B]
|
|
387
386
|
}] });
|
|
@@ -390,54 +389,54 @@ const Mt = (e, t) => {
|
|
|
390
389
|
} else
|
|
391
390
|
console.warn(`Attempt to delete body from missing annotation ${f.annotation}`);
|
|
392
391
|
}, c = (f) => {
|
|
393
|
-
const
|
|
394
|
-
return
|
|
392
|
+
const A = e.get(f);
|
|
393
|
+
return A ? { ...A } : void 0;
|
|
395
394
|
}, g = (f) => {
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
395
|
+
const A = t.get(f);
|
|
396
|
+
if (A) {
|
|
397
|
+
const w = c(A).bodies.find((B) => B.id === f);
|
|
398
|
+
if (w)
|
|
399
|
+
return w;
|
|
401
400
|
console.error(`Store integrity error: body ${f} in index, but not in annotation`);
|
|
402
401
|
} else
|
|
403
402
|
console.warn(`Attempt to retrieve missing body: ${f}`);
|
|
404
|
-
}, p = (f,
|
|
405
|
-
if (f.annotation !==
|
|
403
|
+
}, p = (f, A) => {
|
|
404
|
+
if (f.annotation !== A.annotation)
|
|
406
405
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
409
|
-
const B =
|
|
410
|
-
...
|
|
411
|
-
bodies:
|
|
406
|
+
const w = e.get(f.annotation);
|
|
407
|
+
if (w) {
|
|
408
|
+
const B = w.bodies.find((R) => R.id === f.id), S = {
|
|
409
|
+
...w,
|
|
410
|
+
bodies: w.bodies.map((R) => R.id === B.id ? A : R)
|
|
412
411
|
};
|
|
413
|
-
return e.set(
|
|
414
|
-
oldValue:
|
|
412
|
+
return e.set(w.id, S), B.id !== A.id && (t.delete(B.id), t.set(A.id, S.id)), {
|
|
413
|
+
oldValue: w,
|
|
415
414
|
newValue: S,
|
|
416
|
-
bodiesUpdated: [{ oldBody: B, newBody:
|
|
415
|
+
bodiesUpdated: [{ oldBody: B, newBody: A }]
|
|
417
416
|
};
|
|
418
417
|
} else
|
|
419
418
|
console.warn(`Attempt to add body to missing annotation ${f.annotation}`);
|
|
420
|
-
}, E = (f,
|
|
421
|
-
const B = p(f,
|
|
422
|
-
B && s(
|
|
423
|
-
}, T = (f,
|
|
424
|
-
const
|
|
425
|
-
s(
|
|
419
|
+
}, E = (f, A, w = C.LOCAL) => {
|
|
420
|
+
const B = p(f, A);
|
|
421
|
+
B && s(w, { updated: [B] });
|
|
422
|
+
}, T = (f, A = C.LOCAL) => {
|
|
423
|
+
const w = f.map((B) => p({ id: B.id, annotation: B.annotation }, B)).filter(Boolean);
|
|
424
|
+
s(A, { updated: w });
|
|
426
425
|
}, L = (f) => {
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
429
|
-
const
|
|
430
|
-
...
|
|
426
|
+
const A = e.get(f.annotation);
|
|
427
|
+
if (A) {
|
|
428
|
+
const w = {
|
|
429
|
+
...A,
|
|
431
430
|
target: {
|
|
432
|
-
...
|
|
431
|
+
...A.target,
|
|
433
432
|
...f
|
|
434
433
|
}
|
|
435
434
|
};
|
|
436
|
-
return e.set(
|
|
437
|
-
oldValue:
|
|
438
|
-
newValue:
|
|
435
|
+
return e.set(A.id, w), {
|
|
436
|
+
oldValue: A,
|
|
437
|
+
newValue: w,
|
|
439
438
|
targetUpdated: {
|
|
440
|
-
oldTarget:
|
|
439
|
+
oldTarget: A.target,
|
|
441
440
|
newTarget: f
|
|
442
441
|
}
|
|
443
442
|
};
|
|
@@ -445,16 +444,16 @@ const Mt = (e, t) => {
|
|
|
445
444
|
console.warn(`Attempt to update target on missing annotation: ${f.annotation}`);
|
|
446
445
|
};
|
|
447
446
|
return {
|
|
448
|
-
addAnnotation:
|
|
447
|
+
addAnnotation: r,
|
|
449
448
|
addBody: b,
|
|
450
449
|
all: h,
|
|
451
450
|
bulkAddAnnotation: m,
|
|
452
451
|
bulkDeleteAnnotation: y,
|
|
453
452
|
bulkUpdateAnnotation: u,
|
|
454
453
|
bulkUpdateBodies: T,
|
|
455
|
-
bulkUpdateTargets: (f,
|
|
456
|
-
const
|
|
457
|
-
|
|
454
|
+
bulkUpdateTargets: (f, A = C.LOCAL) => {
|
|
455
|
+
const w = f.map((B) => L(B)).filter(Boolean);
|
|
456
|
+
w.length > 0 && s(A, { updated: w });
|
|
458
457
|
},
|
|
459
458
|
clear: v,
|
|
460
459
|
deleteAnnotation: M,
|
|
@@ -465,9 +464,9 @@ const Mt = (e, t) => {
|
|
|
465
464
|
unobserve: i,
|
|
466
465
|
updateAnnotation: d,
|
|
467
466
|
updateBody: E,
|
|
468
|
-
updateTarget: (f,
|
|
469
|
-
const
|
|
470
|
-
|
|
467
|
+
updateTarget: (f, A = C.LOCAL) => {
|
|
468
|
+
const w = L(f);
|
|
469
|
+
w && s(A, { updated: [w] });
|
|
471
470
|
}
|
|
472
471
|
};
|
|
473
472
|
};
|
|
@@ -488,7 +487,7 @@ let Ot = () => ({
|
|
|
488
487
|
const Xt = 250, Yt = (e) => {
|
|
489
488
|
const t = Ot(), n = [];
|
|
490
489
|
let o = -1, i = !1, s = 0;
|
|
491
|
-
const
|
|
490
|
+
const r = (m) => {
|
|
492
491
|
if (!i) {
|
|
493
492
|
const { changes: x } = m, M = performance.now();
|
|
494
493
|
if (M - s > Xt)
|
|
@@ -501,12 +500,12 @@ const Xt = 250, Yt = (e) => {
|
|
|
501
500
|
}
|
|
502
501
|
i = !1;
|
|
503
502
|
};
|
|
504
|
-
e.observe(
|
|
505
|
-
const
|
|
503
|
+
e.observe(r, { origin: C.LOCAL });
|
|
504
|
+
const a = (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);
|
|
506
505
|
return {
|
|
507
506
|
canRedo: () => n.length - 1 > o,
|
|
508
507
|
canUndo: () => o > -1,
|
|
509
|
-
destroy: () => e.unobserve(
|
|
508
|
+
destroy: () => e.unobserve(r),
|
|
510
509
|
on: (m, x) => t.on(m, x),
|
|
511
510
|
redo: () => {
|
|
512
511
|
if (n.length - 1 > o) {
|
|
@@ -519,7 +518,7 @@ const Xt = 250, Yt = (e) => {
|
|
|
519
518
|
if (o > -1) {
|
|
520
519
|
i = !0;
|
|
521
520
|
const { created: m, updated: x, deleted: M } = n[o];
|
|
522
|
-
|
|
521
|
+
a(m), u(x), h(M), t.emit("undo", n[o]), o -= 1;
|
|
523
522
|
}
|
|
524
523
|
}
|
|
525
524
|
};
|
|
@@ -530,7 +529,7 @@ const Xt = 250, Yt = (e) => {
|
|
|
530
529
|
set: t
|
|
531
530
|
};
|
|
532
531
|
}, Dt = (e, t, n, o) => {
|
|
533
|
-
const { store: i, selection: s, hover:
|
|
532
|
+
const { store: i, selection: s, hover: r, viewport: a } = e, d = /* @__PURE__ */ new Map();
|
|
534
533
|
let u = [], b, h;
|
|
535
534
|
const v = (l, c) => {
|
|
536
535
|
d.has(l) ? d.get(l).push(c) : d.set(l, [c]);
|
|
@@ -577,9 +576,9 @@ const Xt = 250, Yt = (e) => {
|
|
|
577
576
|
}
|
|
578
577
|
x("selectionChanged", u);
|
|
579
578
|
}
|
|
580
|
-
}),
|
|
579
|
+
}), r.subscribe((l) => {
|
|
581
580
|
!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
|
-
}),
|
|
581
|
+
}), a == null || a.subscribe((l) => x("viewportIntersect", l.map((c) => i.getAnnotation(c)))), i.observe((l) => {
|
|
583
582
|
o && (h && clearTimeout(h), h = setTimeout(M, 1e3));
|
|
584
583
|
const { created: c, deleted: g } = l.changes;
|
|
585
584
|
(c || []).forEach((p) => x("createAnnotation", p)), (g || []).forEach((p) => x("deleteAnnotation", p)), (l.changes.updated || []).filter((p) => [
|
|
@@ -619,7 +618,7 @@ const Xt = 250, Yt = (e) => {
|
|
|
619
618
|
l ? o.addAnnotation(l, C.REMOTE) : console.error(c);
|
|
620
619
|
} else
|
|
621
620
|
o.addAnnotation(y, C.REMOTE);
|
|
622
|
-
},
|
|
621
|
+
}, r = () => i.clear(), a = () => o.clear(), d = (y) => {
|
|
623
622
|
const l = o.getAnnotation(y);
|
|
624
623
|
return n && l ? n.serialize(l) : l;
|
|
625
624
|
}, u = () => n ? o.all().map(n.serialize) : o.all(), b = () => {
|
|
@@ -655,10 +654,10 @@ const Xt = 250, Yt = (e) => {
|
|
|
655
654
|
};
|
|
656
655
|
return {
|
|
657
656
|
addAnnotation: s,
|
|
658
|
-
cancelSelected:
|
|
657
|
+
cancelSelected: r,
|
|
659
658
|
canRedo: t.canRedo,
|
|
660
659
|
canUndo: t.canUndo,
|
|
661
|
-
clearAnnotations:
|
|
660
|
+
clearAnnotations: a,
|
|
662
661
|
getAnnotationById: d,
|
|
663
662
|
getAnnotations: u,
|
|
664
663
|
getSelected: b,
|
|
@@ -674,12 +673,12 @@ const Xt = 250, Yt = (e) => {
|
|
|
674
673
|
let _t = (e) => crypto.getRandomValues(new Uint8Array(e)), kt = (e, t, n) => {
|
|
675
674
|
let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * t / e.length);
|
|
676
675
|
return (s = t) => {
|
|
677
|
-
let
|
|
676
|
+
let r = "";
|
|
678
677
|
for (; ; ) {
|
|
679
|
-
let
|
|
678
|
+
let a = n(i), d = i;
|
|
680
679
|
for (; d--; )
|
|
681
|
-
if (
|
|
682
|
-
return
|
|
680
|
+
if (r += e[a[d] & o] || "", r.length === s)
|
|
681
|
+
return r;
|
|
683
682
|
}
|
|
684
683
|
};
|
|
685
684
|
}, Nt = (e, t = 21) => kt(e, t, _t), Pt = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
|
|
@@ -691,20 +690,20 @@ function Ht(e, t, n, o, i) {
|
|
|
691
690
|
function it(e, t, n, o, i) {
|
|
692
691
|
for (; o > n; ) {
|
|
693
692
|
if (o - n > 600) {
|
|
694
|
-
var s = o - n + 1,
|
|
693
|
+
var s = o - n + 1, r = t - n + 1, a = Math.log(s), d = 0.5 * Math.exp(2 * a / 3), u = 0.5 * Math.sqrt(a * d * (s - d) / s) * (r - s / 2 < 0 ? -1 : 1), b = Math.max(n, Math.floor(t - r * d / s + u)), h = Math.min(o, Math.floor(t + (s - r) * d / s + u));
|
|
695
694
|
it(e, t, b, h, i);
|
|
696
695
|
}
|
|
697
696
|
var v = e[t], m = n, x = o;
|
|
698
|
-
for (
|
|
699
|
-
for (
|
|
697
|
+
for (k(e, n, t), i(e[o], v) > 0 && k(e, n, o); m < x; ) {
|
|
698
|
+
for (k(e, m, x), m++, x--; i(e[m], v) < 0; )
|
|
700
699
|
m++;
|
|
701
700
|
for (; i(e[x], v) > 0; )
|
|
702
701
|
x--;
|
|
703
702
|
}
|
|
704
|
-
i(e[n], v) === 0 ?
|
|
703
|
+
i(e[n], v) === 0 ? k(e, n, x) : (x++, k(e, x, o)), x <= t && (n = x + 1), t <= x && (o = x - 1);
|
|
705
704
|
}
|
|
706
705
|
}
|
|
707
|
-
function
|
|
706
|
+
function k(e, t, n) {
|
|
708
707
|
var o = e[t];
|
|
709
708
|
e[t] = e[n], e[n] = o;
|
|
710
709
|
}
|
|
@@ -725,9 +724,9 @@ class $t {
|
|
|
725
724
|
return o;
|
|
726
725
|
const i = this.toBBox, s = [];
|
|
727
726
|
for (; n; ) {
|
|
728
|
-
for (let
|
|
729
|
-
const
|
|
730
|
-
H(t, d) && (n.leaf ? o.push(
|
|
727
|
+
for (let r = 0; r < n.children.length; r++) {
|
|
728
|
+
const a = n.children[r], d = n.leaf ? i(a) : a;
|
|
729
|
+
H(t, d) && (n.leaf ? o.push(a) : K(t, d) ? this._all(a, o) : s.push(a));
|
|
731
730
|
}
|
|
732
731
|
n = s.pop();
|
|
733
732
|
}
|
|
@@ -740,9 +739,9 @@ class $t {
|
|
|
740
739
|
const o = [];
|
|
741
740
|
for (; n; ) {
|
|
742
741
|
for (let i = 0; i < n.children.length; i++) {
|
|
743
|
-
const s = n.children[i],
|
|
744
|
-
if (H(t,
|
|
745
|
-
if (n.leaf || K(t,
|
|
742
|
+
const s = n.children[i], r = n.leaf ? this.toBBox(s) : s;
|
|
743
|
+
if (H(t, r)) {
|
|
744
|
+
if (n.leaf || K(t, r))
|
|
746
745
|
return !0;
|
|
747
746
|
o.push(s);
|
|
748
747
|
}
|
|
@@ -783,15 +782,15 @@ class $t {
|
|
|
783
782
|
if (!t)
|
|
784
783
|
return this;
|
|
785
784
|
let o = this.data;
|
|
786
|
-
const i = this.toBBox(t), s = [],
|
|
787
|
-
let
|
|
785
|
+
const i = this.toBBox(t), s = [], r = [];
|
|
786
|
+
let a, d, u;
|
|
788
787
|
for (; o || s.length; ) {
|
|
789
|
-
if (o || (o = s.pop(), d = s[s.length - 1],
|
|
788
|
+
if (o || (o = s.pop(), d = s[s.length - 1], a = r.pop(), u = !0), o.leaf) {
|
|
790
789
|
const b = Wt(t, o.children, n);
|
|
791
790
|
if (b !== -1)
|
|
792
791
|
return o.children.splice(b, 1), s.push(o), this._condense(s), this;
|
|
793
792
|
}
|
|
794
|
-
!u && !o.leaf && K(o, i) ? (s.push(o),
|
|
793
|
+
!u && !o.leaf && K(o, i) ? (s.push(o), r.push(a), a = 0, d = o, o = o.children[0]) : d ? (a++, o = d.children[a], u = !1) : o = null;
|
|
795
794
|
}
|
|
796
795
|
return this;
|
|
797
796
|
}
|
|
@@ -818,36 +817,36 @@ class $t {
|
|
|
818
817
|
}
|
|
819
818
|
_build(t, n, o, i) {
|
|
820
819
|
const s = o - n + 1;
|
|
821
|
-
let
|
|
822
|
-
if (s <=
|
|
823
|
-
return
|
|
824
|
-
i || (i = Math.ceil(Math.log(s) / Math.log(
|
|
825
|
-
const d = Math.ceil(s /
|
|
820
|
+
let r = this._maxEntries, a;
|
|
821
|
+
if (s <= r)
|
|
822
|
+
return a = V(t.slice(n, o + 1)), I(a, this.toBBox), a;
|
|
823
|
+
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = V([]), a.leaf = !1, a.height = i;
|
|
824
|
+
const d = Math.ceil(s / r), u = d * Math.ceil(Math.sqrt(r));
|
|
826
825
|
tt(t, n, o, u, this.compareMinX);
|
|
827
826
|
for (let b = n; b <= o; b += u) {
|
|
828
827
|
const h = Math.min(b + u - 1, o);
|
|
829
828
|
tt(t, b, h, d, this.compareMinY);
|
|
830
829
|
for (let v = b; v <= h; v += d) {
|
|
831
830
|
const m = Math.min(v + d - 1, h);
|
|
832
|
-
|
|
831
|
+
a.children.push(this._build(t, v, m, i - 1));
|
|
833
832
|
}
|
|
834
833
|
}
|
|
835
|
-
return I(
|
|
834
|
+
return I(a, this.toBBox), a;
|
|
836
835
|
}
|
|
837
836
|
_chooseSubtree(t, n, o, i) {
|
|
838
837
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
839
|
-
let s = 1 / 0,
|
|
838
|
+
let s = 1 / 0, r = 1 / 0, a;
|
|
840
839
|
for (let d = 0; d < n.children.length; d++) {
|
|
841
840
|
const u = n.children[d], b = G(u), h = Kt(t, u) - b;
|
|
842
|
-
h <
|
|
841
|
+
h < r ? (r = h, s = b < s ? b : s, a = u) : h === r && b < s && (s = b, a = u);
|
|
843
842
|
}
|
|
844
|
-
n =
|
|
843
|
+
n = a || n.children[0];
|
|
845
844
|
}
|
|
846
845
|
return n;
|
|
847
846
|
}
|
|
848
847
|
_insert(t, n, o) {
|
|
849
|
-
const i = o ? t : this.toBBox(t), s = [],
|
|
850
|
-
for (
|
|
848
|
+
const i = o ? t : this.toBBox(t), s = [], r = this._chooseSubtree(i, this.data, n, s);
|
|
849
|
+
for (r.children.push(t), P(r, i); n >= 0 && s[n].children.length > this._maxEntries; )
|
|
851
850
|
this._split(s, n), n--;
|
|
852
851
|
this._adjustParentBBoxes(i, s, n);
|
|
853
852
|
}
|
|
@@ -855,37 +854,37 @@ class $t {
|
|
|
855
854
|
_split(t, n) {
|
|
856
855
|
const o = t[n], i = o.children.length, s = this._minEntries;
|
|
857
856
|
this._chooseSplitAxis(o, s, i);
|
|
858
|
-
const
|
|
859
|
-
|
|
857
|
+
const r = this._chooseSplitIndex(o, s, i), a = V(o.children.splice(r, o.children.length - r));
|
|
858
|
+
a.height = o.height, a.leaf = o.leaf, I(o, this.toBBox), I(a, this.toBBox), n ? t[n - 1].children.push(a) : this._splitRoot(o, a);
|
|
860
859
|
}
|
|
861
860
|
_splitRoot(t, n) {
|
|
862
861
|
this.data = V([t, n]), this.data.height = t.height + 1, this.data.leaf = !1, I(this.data, this.toBBox);
|
|
863
862
|
}
|
|
864
863
|
_chooseSplitIndex(t, n, o) {
|
|
865
|
-
let i, s = 1 / 0,
|
|
866
|
-
for (let
|
|
867
|
-
const d = N(t, 0,
|
|
868
|
-
b < s ? (s = b, i =
|
|
864
|
+
let i, s = 1 / 0, r = 1 / 0;
|
|
865
|
+
for (let a = n; a <= o - n; a++) {
|
|
866
|
+
const d = N(t, 0, a, this.toBBox), u = N(t, a, o, this.toBBox), b = Jt(d, u), h = G(d) + G(u);
|
|
867
|
+
b < s ? (s = b, i = a, r = h < r ? h : r) : b === s && h < r && (r = h, i = a);
|
|
869
868
|
}
|
|
870
869
|
return i || o - n;
|
|
871
870
|
}
|
|
872
871
|
// sorts node children by the best axis for split
|
|
873
872
|
_chooseSplitAxis(t, n, o) {
|
|
874
|
-
const i = t.leaf ? this.compareMinX : qt, s = t.leaf ? this.compareMinY : Gt,
|
|
875
|
-
|
|
873
|
+
const i = t.leaf ? this.compareMinX : qt, s = t.leaf ? this.compareMinY : Gt, r = this._allDistMargin(t, n, o, i), a = this._allDistMargin(t, n, o, s);
|
|
874
|
+
r < a && t.children.sort(i);
|
|
876
875
|
}
|
|
877
876
|
// total margin of all possible split distributions where each node is at least m full
|
|
878
877
|
_allDistMargin(t, n, o, i) {
|
|
879
878
|
t.children.sort(i);
|
|
880
|
-
const s = this.toBBox,
|
|
881
|
-
let d = z(
|
|
879
|
+
const s = this.toBBox, r = N(t, 0, n, s), a = N(t, o - n, o, s);
|
|
880
|
+
let d = z(r) + z(a);
|
|
882
881
|
for (let u = n; u < o - n; u++) {
|
|
883
882
|
const b = t.children[u];
|
|
884
|
-
P(
|
|
883
|
+
P(r, t.leaf ? s(b) : b), d += z(r);
|
|
885
884
|
}
|
|
886
885
|
for (let u = o - n - 1; u >= n; u--) {
|
|
887
886
|
const b = t.children[u];
|
|
888
|
-
P(
|
|
887
|
+
P(a, t.leaf ? s(b) : b), d += z(a);
|
|
889
888
|
}
|
|
890
889
|
return d;
|
|
891
890
|
}
|
|
@@ -912,8 +911,8 @@ function I(e, t) {
|
|
|
912
911
|
function N(e, t, n, o, i) {
|
|
913
912
|
i || (i = V(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
914
913
|
for (let s = t; s < n; s++) {
|
|
915
|
-
const
|
|
916
|
-
P(i, e.leaf ? o(
|
|
914
|
+
const r = e.children[s];
|
|
915
|
+
P(i, e.leaf ? o(r) : r);
|
|
917
916
|
}
|
|
918
917
|
return i;
|
|
919
918
|
}
|
|
@@ -961,8 +960,8 @@ function tt(e, t, n, o, i) {
|
|
|
961
960
|
for (; s.length; ) {
|
|
962
961
|
if (n = s.pop(), t = s.pop(), n - t <= o)
|
|
963
962
|
continue;
|
|
964
|
-
const
|
|
965
|
-
Ht(e,
|
|
963
|
+
const r = t + Math.ceil((n - t) / o / 2) * o;
|
|
964
|
+
Ht(e, r, t, n, i), s.push(t, r, r, n);
|
|
966
965
|
}
|
|
967
966
|
}
|
|
968
967
|
const jt = (e, t) => {
|
|
@@ -997,18 +996,18 @@ const jt = (e, t) => {
|
|
|
997
996
|
return t;
|
|
998
997
|
let o = [...t], i = !1;
|
|
999
998
|
for (const s of t) {
|
|
1000
|
-
const
|
|
1001
|
-
if (
|
|
1002
|
-
o = o.map((
|
|
999
|
+
const r = jt(n, s);
|
|
1000
|
+
if (r === "inline-adjacent") {
|
|
1001
|
+
o = o.map((a) => a === s ? Zt(n, s) : a), i = !0;
|
|
1003
1002
|
break;
|
|
1004
|
-
} else if (
|
|
1005
|
-
o = o.map((
|
|
1003
|
+
} else if (r === "inline-contains") {
|
|
1004
|
+
o = o.map((a) => a === s ? n : a), i = !0;
|
|
1006
1005
|
break;
|
|
1007
|
-
} else if (
|
|
1006
|
+
} else if (r === "inline-is-contained") {
|
|
1008
1007
|
i = !0;
|
|
1009
1008
|
break;
|
|
1010
|
-
} else if (
|
|
1011
|
-
n.width < s.width && (o = o.map((
|
|
1009
|
+
} else if (r === "block-contains" || r === "block-is-contained") {
|
|
1010
|
+
n.width < s.width && (o = o.map((a) => a === s ? n : a)), i = !0;
|
|
1012
1011
|
break;
|
|
1013
1012
|
}
|
|
1014
1013
|
}
|
|
@@ -1018,41 +1017,41 @@ const jt = (e, t) => {
|
|
|
1018
1017
|
if (t.nodeType === Node.TEXT_NODE && n.nodeType === Node.TEXT_NODE)
|
|
1019
1018
|
return e;
|
|
1020
1019
|
if (t.nodeType !== Node.TEXT_NODE) {
|
|
1021
|
-
const i = t.nextSibling || t.parentNode, s = i.nodeType === Node.TEXT_NODE ? i : Array.from(i.childNodes).filter((
|
|
1020
|
+
const i = t.nextSibling || t.parentNode, s = i.nodeType === Node.TEXT_NODE ? i : Array.from(i.childNodes).filter((r) => r.nodeType === Node.TEXT_NODE).shift();
|
|
1022
1021
|
e.setEnd(s, 0);
|
|
1023
1022
|
}
|
|
1024
1023
|
if (n.nodeType !== Node.TEXT_NODE) {
|
|
1025
|
-
const i = n.previousSibling || n.parentNode, s = i.nodeType === Node.TEXT_NODE ? i : Array.from(i.childNodes).filter((
|
|
1024
|
+
const i = n.previousSibling || n.parentNode, s = i.nodeType === Node.TEXT_NODE ? i : Array.from(i.childNodes).filter((r) => r.nodeType === Node.TEXT_NODE).pop();
|
|
1026
1025
|
e.setEnd(s, s.textContent.length);
|
|
1027
1026
|
}
|
|
1028
1027
|
return e;
|
|
1029
1028
|
}, ee = (e, t) => {
|
|
1030
1029
|
const n = new $t(), o = /* @__PURE__ */ new Map(), i = (l) => {
|
|
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 :
|
|
1030
|
+
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 : _(l, t), E = Array.from(p.selector.range.getClientRects()), T = Qt(E);
|
|
1032
1031
|
return T.map((L) => {
|
|
1033
|
-
const { x: f, y:
|
|
1032
|
+
const { x: f, y: A, width: w, height: B } = L;
|
|
1034
1033
|
return {
|
|
1035
1034
|
minX: f - c.x,
|
|
1036
|
-
minY:
|
|
1037
|
-
maxX: f - c.x +
|
|
1038
|
-
maxY:
|
|
1035
|
+
minY: A - c.y,
|
|
1036
|
+
maxX: f - c.x + w,
|
|
1037
|
+
maxY: A - c.y + B,
|
|
1039
1038
|
annotation: {
|
|
1040
1039
|
id: l.annotation,
|
|
1041
1040
|
rects: T
|
|
1042
1041
|
}
|
|
1043
1042
|
};
|
|
1044
1043
|
});
|
|
1045
|
-
}, s = () => [...o.values()],
|
|
1044
|
+
}, s = () => [...o.values()], r = () => {
|
|
1046
1045
|
n.clear(), o.clear();
|
|
1047
|
-
},
|
|
1046
|
+
}, a = (l) => {
|
|
1048
1047
|
const c = i(l);
|
|
1049
1048
|
c.forEach((g) => n.insert(g)), o.set(l.annotation, c);
|
|
1050
1049
|
}, d = (l) => {
|
|
1051
1050
|
o.get(l.annotation).forEach((g) => n.remove(g)), o.delete(l.annotation);
|
|
1052
1051
|
}, u = (l) => {
|
|
1053
|
-
d(l),
|
|
1052
|
+
d(l), a(l);
|
|
1054
1053
|
}, b = (l, c = !0) => {
|
|
1055
|
-
c &&
|
|
1054
|
+
c && r();
|
|
1056
1055
|
const g = l.map((E) => ({ target: E, rects: i(E) }));
|
|
1057
1056
|
g.forEach(({ target: E, rects: T }) => o.set(E.annotation, T));
|
|
1058
1057
|
const p = g.reduce((E, { rects: T }) => [...E, ...T], []);
|
|
@@ -1082,12 +1081,12 @@ const jt = (e, t) => {
|
|
|
1082
1081
|
};
|
|
1083
1082
|
return {
|
|
1084
1083
|
all: s,
|
|
1085
|
-
clear:
|
|
1084
|
+
clear: r,
|
|
1086
1085
|
getAt: h,
|
|
1087
1086
|
getBoundsForAnnotation: v,
|
|
1088
1087
|
getDOMRectsForAnnotation: m,
|
|
1089
1088
|
getIntersectingRects: (l, c, g, p) => n.search({ minX: l, minY: c, maxX: g, maxY: p }),
|
|
1090
|
-
insert:
|
|
1089
|
+
insert: a,
|
|
1091
1090
|
recalculate: () => b(e.all().map((l) => l.target), !0),
|
|
1092
1091
|
remove: d,
|
|
1093
1092
|
set: b,
|
|
@@ -1098,21 +1097,21 @@ const jt = (e, t) => {
|
|
|
1098
1097
|
const { range: t } = e.target.selector;
|
|
1099
1098
|
return t instanceof Range && !t.collapsed;
|
|
1100
1099
|
}, ne = (e, t) => {
|
|
1101
|
-
const n = Rt(), o = ee(n, e), i = xt(n, t), s =
|
|
1102
|
-
const c = y.target.selector.range instanceof Range ? y : { ...y, target:
|
|
1100
|
+
const n = Rt(), o = ee(n, e), i = xt(n, t), s = At(n), r = Ut(), a = (y, l = C.LOCAL) => {
|
|
1101
|
+
const c = y.target.selector.range instanceof Range ? y : { ...y, target: _(y.target, e) }, { range: g } = c.target.selector, p = g && !g.collapsed;
|
|
1103
1102
|
return p && n.addAnnotation(c, l), p;
|
|
1104
1103
|
}, d = (y, l = !0, c = C.LOCAL) => {
|
|
1105
|
-
const g = y.map((E) => F(E) ? E : { ...E, target:
|
|
1104
|
+
const g = y.map((E) => F(E) ? E : { ...E, target: _(E.target, e) });
|
|
1106
1105
|
if (g.some((E) => E.target.selector.range.collapsed)) {
|
|
1107
1106
|
const E = g.filter((T) => T.target.selector.range.collapsed);
|
|
1108
1107
|
return console.warn("Could not revive all targets"), console.warn(E), n.bulkAddAnnotation(g, l, c), E;
|
|
1109
1108
|
} else
|
|
1110
1109
|
return n.bulkAddAnnotation(g, l, c), [];
|
|
1111
1110
|
}, u = (y, l = C.LOCAL) => {
|
|
1112
|
-
const c = y.selector.range instanceof Range ? y :
|
|
1111
|
+
const c = y.selector.range instanceof Range ? y : _(y, e);
|
|
1113
1112
|
n.updateTarget(c, l);
|
|
1114
1113
|
}, b = (y, l = C.LOCAL) => {
|
|
1115
|
-
const c = y.map((g) => g.selector.range instanceof Range ? g :
|
|
1114
|
+
const c = y.map((g) => g.selector.range instanceof Range ? g : _(g, e));
|
|
1116
1115
|
n.bulkUpdateTargets(c, l);
|
|
1117
1116
|
}, h = (y, l) => {
|
|
1118
1117
|
const c = o.getAt(y, l);
|
|
@@ -1124,7 +1123,7 @@ const jt = (e, t) => {
|
|
|
1124
1123
|
const p = o.getDOMRectsForAnnotation(y);
|
|
1125
1124
|
if (p.length > 0) {
|
|
1126
1125
|
if (l && c) {
|
|
1127
|
-
const E = p.find(({ top: T, right: L, bottom: f, left:
|
|
1126
|
+
const E = p.find(({ top: T, right: L, bottom: f, left: A }) => l >= A - g && l <= L + g && c >= T - g && c <= f + g);
|
|
1128
1127
|
if (E)
|
|
1129
1128
|
return E;
|
|
1130
1129
|
}
|
|
@@ -1134,7 +1133,7 @@ const jt = (e, t) => {
|
|
|
1134
1133
|
const E = o.getIntersectingRects(y, l, c, g).reduce((T, L) => ((T[L.annotation.id] = T[L.annotation.id] || []).push(L), T), {});
|
|
1135
1134
|
return Object.entries(E).map(([T, L]) => ({
|
|
1136
1135
|
annotation: n.getAnnotation(T),
|
|
1137
|
-
rects: L.map(({ minX: f, minY:
|
|
1136
|
+
rects: L.map(({ minX: f, minY: A, maxX: w, maxY: B }) => ({ x: f, y: A, width: w - f, height: B - A }))
|
|
1138
1137
|
}));
|
|
1139
1138
|
}, M = () => o.recalculate();
|
|
1140
1139
|
return n.observe(({ changes: y }) => {
|
|
@@ -1143,7 +1142,7 @@ const jt = (e, t) => {
|
|
|
1143
1142
|
}), {
|
|
1144
1143
|
store: {
|
|
1145
1144
|
...n,
|
|
1146
|
-
addAnnotation:
|
|
1145
|
+
addAnnotation: a,
|
|
1147
1146
|
bulkAddAnnotation: d,
|
|
1148
1147
|
bulkUpdateTargets: b,
|
|
1149
1148
|
getAnnotationBounds: m,
|
|
@@ -1155,22 +1154,22 @@ const jt = (e, t) => {
|
|
|
1155
1154
|
},
|
|
1156
1155
|
selection: i,
|
|
1157
1156
|
hover: s,
|
|
1158
|
-
viewport:
|
|
1157
|
+
viewport: r
|
|
1159
1158
|
};
|
|
1160
1159
|
}, oe = (e, t = {}) => {
|
|
1161
|
-
const n = /* @__PURE__ */ new Map(), o = (s) => Array.from(n.entries()).filter(([
|
|
1162
|
-
return e.on("selectionChange", (s,
|
|
1163
|
-
o(s).forEach((d) => n.delete(d)),
|
|
1164
|
-
}), { paint: (s,
|
|
1160
|
+
const n = /* @__PURE__ */ new Map(), o = (s) => Array.from(n.entries()).filter(([r, a]) => a.presenceKey === s.presenceKey).map(([r, a]) => r);
|
|
1161
|
+
return e.on("selectionChange", (s, r) => {
|
|
1162
|
+
o(s).forEach((d) => n.delete(d)), r && r.forEach((d) => n.set(d, s));
|
|
1163
|
+
}), { paint: (s, r, a, d, u, b) => {
|
|
1165
1164
|
t.font && (d.font = t.font);
|
|
1166
1165
|
const h = n.get(s.id);
|
|
1167
1166
|
if (h) {
|
|
1168
|
-
const { x: v, y: m, height: x } =
|
|
1167
|
+
const { x: v, y: m, height: x } = r[0];
|
|
1169
1168
|
d.fillStyle = h.appearance.color, d.fillRect(v - 2, m - 2.5, 2, x + 5);
|
|
1170
1169
|
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),
|
|
1170
|
+
d.fillRect(v - 2, m - 2.5 - l, y, l), d.fillStyle = "#fff", d.fillText(h.appearance.label, v + 1, m - c), a.fillStyle = h.appearance.color, a.globalAlpha = u ? 0.45 : 0.18, r.forEach(({ x: g, y: p, width: E, height: T }) => a.fillRect(g, p - 2.5, E, T + 5));
|
|
1172
1171
|
} else
|
|
1173
|
-
nt.paint(s,
|
|
1172
|
+
nt.paint(s, r, a, d, u, b);
|
|
1174
1173
|
} };
|
|
1175
1174
|
}, st = (e) => {
|
|
1176
1175
|
if (e === null)
|
|
@@ -1178,18 +1177,25 @@ const jt = (e, t) => {
|
|
|
1178
1177
|
const { overflowY: t } = window.getComputedStyle(e);
|
|
1179
1178
|
return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : st(e.parentElement);
|
|
1180
1179
|
}, ie = (e, t) => (n) => {
|
|
1181
|
-
const o =
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1180
|
+
const o = (s) => {
|
|
1181
|
+
const r = i.getBoundingClientRect(), a = i.clientHeight, d = i.clientWidth, u = s.selector.range.getBoundingClientRect(), { width: b, height: h } = t.getAnnotationBounds(n.id), v = u.top - r.top, m = u.left - r.left, x = i.parentElement ? i.scrollTop : 0, M = i.parentElement ? i.scrollLeft : 0, y = v + x - (a - h) / 2, l = m + M - (d - b) / 2;
|
|
1182
|
+
i.scroll({ top: y, left: l, behavior: "smooth" });
|
|
1183
|
+
}, i = st(e);
|
|
1184
|
+
if (i) {
|
|
1185
|
+
const s = t.getAnnotation(n.id), { range: r } = s.target.selector;
|
|
1186
|
+
if (r && !r.collapsed)
|
|
1187
|
+
return o(s.target), !0;
|
|
1188
|
+
{
|
|
1189
|
+
const a = _(s.target, e);
|
|
1190
|
+
if (a.selector.range && !a.selector.range.collapsed)
|
|
1191
|
+
return console.log("scrolling revived"), o(a), !0;
|
|
1192
|
+
}
|
|
1188
1193
|
}
|
|
1194
|
+
return !1;
|
|
1189
1195
|
};
|
|
1190
1196
|
let $;
|
|
1191
1197
|
const se = new Uint8Array(16);
|
|
1192
|
-
function
|
|
1198
|
+
function re() {
|
|
1193
1199
|
if (!$ && ($ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !$))
|
|
1194
1200
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1195
1201
|
return $(se);
|
|
@@ -1197,7 +1203,7 @@ function ae() {
|
|
|
1197
1203
|
const O = [];
|
|
1198
1204
|
for (let e = 0; e < 256; ++e)
|
|
1199
1205
|
O.push((e + 256).toString(16).slice(1));
|
|
1200
|
-
function
|
|
1206
|
+
function ae(e, t = 0) {
|
|
1201
1207
|
return O[e[t + 0]] + O[e[t + 1]] + O[e[t + 2]] + O[e[t + 3]] + "-" + O[e[t + 4]] + O[e[t + 5]] + "-" + O[e[t + 6]] + O[e[t + 7]] + "-" + O[e[t + 8]] + O[e[t + 9]] + "-" + O[e[t + 10]] + O[e[t + 11]] + O[e[t + 12]] + O[e[t + 13]] + O[e[t + 14]] + O[e[t + 15]];
|
|
1202
1208
|
}
|
|
1203
1209
|
const le = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), et = {
|
|
@@ -1207,34 +1213,34 @@ function ce(e, t, n) {
|
|
|
1207
1213
|
if (et.randomUUID && !t && !e)
|
|
1208
1214
|
return et.randomUUID();
|
|
1209
1215
|
e = e || {};
|
|
1210
|
-
const o = e.random || (e.rng ||
|
|
1216
|
+
const o = e.random || (e.rng || re)();
|
|
1211
1217
|
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
|
|
1212
1218
|
n = n || 0;
|
|
1213
1219
|
for (let i = 0; i < 16; ++i)
|
|
1214
1220
|
t[n + i] = o[i];
|
|
1215
1221
|
return t;
|
|
1216
1222
|
}
|
|
1217
|
-
return
|
|
1223
|
+
return ae(o);
|
|
1218
1224
|
}
|
|
1219
1225
|
const de = (e, t, n) => {
|
|
1220
1226
|
const o = document.createRange(), i = n ? e.startContainer.parentElement.closest(n) : t;
|
|
1221
1227
|
o.setStart(i, 0), o.setEnd(e.startContainer, e.startOffset);
|
|
1222
|
-
const s = e.toString(),
|
|
1223
|
-
return n ? { quote: s, start:
|
|
1228
|
+
const s = e.toString(), r = o.toString().length, a = r + s.length;
|
|
1229
|
+
return n ? { quote: s, start: r, end: a, range: e, offsetReference: i } : { quote: s, start: r, end: a, range: e };
|
|
1224
1230
|
}, ue = (e, t, n) => {
|
|
1225
1231
|
const { store: o, selection: i } = t;
|
|
1226
|
-
let s,
|
|
1227
|
-
const
|
|
1232
|
+
let s, r = null;
|
|
1233
|
+
const a = (v) => s = v;
|
|
1228
1234
|
let d = !1, u;
|
|
1229
1235
|
e.addEventListener("selectstart", (v) => {
|
|
1230
1236
|
if (!d)
|
|
1231
1237
|
return;
|
|
1232
|
-
!v.target.parentElement.closest(".not-annotatable") ?
|
|
1238
|
+
!v.target.parentElement.closest(".not-annotatable") ? r = {
|
|
1233
1239
|
annotation: ce(),
|
|
1234
1240
|
selector: void 0,
|
|
1235
1241
|
creator: s,
|
|
1236
1242
|
created: /* @__PURE__ */ new Date()
|
|
1237
|
-
} : (
|
|
1243
|
+
} : (r = null, u = void 0);
|
|
1238
1244
|
});
|
|
1239
1245
|
let b;
|
|
1240
1246
|
document.addEventListener("selectionchange", (v) => {
|
|
@@ -1243,16 +1249,16 @@ const de = (e, t, n) => {
|
|
|
1243
1249
|
const h = () => {
|
|
1244
1250
|
var m, x;
|
|
1245
1251
|
const v = document.getSelection();
|
|
1246
|
-
if (!v.isCollapsed && d &&
|
|
1252
|
+
if (!v.isCollapsed && d && r) {
|
|
1247
1253
|
const M = Array.from(Array(v.rangeCount).keys()).map((c) => v.getRangeAt(c));
|
|
1248
|
-
te(M[0]).toString() !== ((x = (m =
|
|
1249
|
-
...
|
|
1254
|
+
te(M[0]).toString() !== ((x = (m = r.selector) == null ? void 0 : m.range) == null ? void 0 : x.toString()) && (r = {
|
|
1255
|
+
...r,
|
|
1250
1256
|
selector: de(M[0], e, n)
|
|
1251
|
-
}, o.getAnnotation(
|
|
1252
|
-
id:
|
|
1257
|
+
}, o.getAnnotation(r.annotation) ? o.updateTarget(r, C.LOCAL) : (o.addAnnotation({
|
|
1258
|
+
id: r.annotation,
|
|
1253
1259
|
bodies: [],
|
|
1254
|
-
target:
|
|
1255
|
-
}), i.clickSelect(
|
|
1260
|
+
target: r
|
|
1261
|
+
}), i.clickSelect(r.annotation, u)));
|
|
1256
1262
|
}
|
|
1257
1263
|
};
|
|
1258
1264
|
return e.addEventListener("pointerdown", (v) => {
|
|
@@ -1260,8 +1266,8 @@ const de = (e, t, n) => {
|
|
|
1260
1266
|
}), document.addEventListener("pointerup", (v) => {
|
|
1261
1267
|
var x;
|
|
1262
1268
|
u = v, !((x = v.target.parentElement) != null && x.closest(".not-annotatable") || !d) && setTimeout(() => {
|
|
1263
|
-
if (
|
|
1264
|
-
o.updateTarget(
|
|
1269
|
+
if (r != null && r.selector)
|
|
1270
|
+
o.updateTarget(r, C.LOCAL), i.clickSelect(r.annotation, v), r = null, u = void 0;
|
|
1265
1271
|
else {
|
|
1266
1272
|
const { x: M, y } = e.getBoundingClientRect(), l = o.getAt(v.clientX - M, v.clientY - y);
|
|
1267
1273
|
if (l) {
|
|
@@ -1272,13 +1278,12 @@ const de = (e, t, n) => {
|
|
|
1272
1278
|
}
|
|
1273
1279
|
}, 50);
|
|
1274
1280
|
}), {
|
|
1275
|
-
setUser:
|
|
1281
|
+
setUser: a
|
|
1276
1282
|
};
|
|
1277
|
-
}
|
|
1278
|
-
const
|
|
1279
|
-
const n = ne(e, t.pointerAction), { selection: o, viewport: i } = n, s = n.store, a = Yt(s), r = Dt(
|
|
1283
|
+
}, he = (e, t = {}) => {
|
|
1284
|
+
const n = ne(e, t.pointerAction), { selection: o, viewport: i } = n, s = n.store, r = Yt(s), a = Dt(
|
|
1280
1285
|
n,
|
|
1281
|
-
|
|
1286
|
+
r,
|
|
1282
1287
|
t.adapter
|
|
1283
1288
|
);
|
|
1284
1289
|
let d = zt();
|
|
@@ -1286,7 +1291,7 @@ const he = (e, t = {}) => {
|
|
|
1286
1291
|
t.style && u.setDrawingStyle(t.style);
|
|
1287
1292
|
const b = ue(e, n, t.offsetReferenceSelector);
|
|
1288
1293
|
return b.setUser(d), {
|
|
1289
|
-
...Vt(n,
|
|
1294
|
+
...Vt(n, r, t.adapter),
|
|
1290
1295
|
destroy: () => {
|
|
1291
1296
|
throw "Not implemented yet";
|
|
1292
1297
|
},
|
|
@@ -1303,8 +1308,8 @@ const he = (e, t = {}) => {
|
|
|
1303
1308
|
setPresenceProvider: (g) => {
|
|
1304
1309
|
g && (u.setPainter(oe(g, t.presence)), g.on("selectionChange", () => u.redraw()));
|
|
1305
1310
|
},
|
|
1306
|
-
on:
|
|
1307
|
-
off:
|
|
1311
|
+
on: a.on,
|
|
1312
|
+
off: a.off,
|
|
1308
1313
|
scrollIntoView: ie(e, s),
|
|
1309
1314
|
state: n
|
|
1310
1315
|
};
|
|
@@ -1315,6 +1320,6 @@ export {
|
|
|
1315
1320
|
he as createTextAnnotator,
|
|
1316
1321
|
ne as createTextAnnotatorState,
|
|
1317
1322
|
nt as defaultPainter,
|
|
1318
|
-
|
|
1323
|
+
_ as reviveTarget
|
|
1319
1324
|
};
|
|
1320
1325
|
//# sourceMappingURL=text-annotator.es.js.map
|