@soomo/text-annotator 3.4.10-staging.0 → 3.4.12-staging.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,19 @@
1
- import { UAParser as Ee } from "ua-parser-js";
2
- import { OS as Ce } from "ua-parser-js/enums";
3
- import le from "debounce";
4
- import { UserSelectAction as Se, serializeW3CBodies as Ae, parseW3CBodies as we, parseW3CUser as Re, createStore as ve, createSelectionState as Te, createHoverState as xe, createViewportState as Le, Origin as K, createAnonymousGuest as Ne, createUndoStack as Oe, createLifecycleObserver as Be, createBaseAnnotator as ke } from "@annotorious/core";
5
- import { Origin as Ft, UserSelectAction as Vt, createBody as Yt } from "@annotorious/core";
1
+ import de from "debounce";
2
+ import { UserSelectAction as Ce, serializeW3CBodies as Se, parseW3CBodies as Ae, parseW3CUser as we, createStore as Re, createSelectionState as Te, createHoverState as ve, createViewportState as xe, Origin as K, createAnonymousGuest as Le, createUndoStack as Ne, createLifecycleObserver as Oe, createBaseAnnotator as Be } from "@annotorious/core";
3
+ import { Origin as Ut, UserSelectAction as Kt, createBody as Wt } from "@annotorious/core";
6
4
  import { colord as ne } from "colord";
7
- import { dequal as Me } from "dequal/lite";
8
- import { v4 as de } from "uuid";
9
- import Ie from "rbush";
10
- import { createNanoEvents as _e } from "nanoevents";
5
+ import { dequal as ke } from "dequal/lite";
6
+ import { v4 as ue } from "uuid";
7
+ import Me from "rbush";
8
+ import { createNanoEvents as Ie } from "nanoevents";
11
9
  import q from "hotkeys-js";
12
- import { poll as He } from "poll";
13
- const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t instanceof HTMLElement ? t.closest(W) : t.parentElement?.closest(W)) : !0, fe = (e, t) => {
10
+ import { poll as _e } from "poll";
11
+ const fe = "not-annotatable", $ = `.${fe}`, W = (e, t) => e.contains(t) ? !!(t instanceof HTMLElement ? t.closest($) : t.parentElement?.closest($)) : !0, ge = (e, t) => {
14
12
  const n = t.commonAncestorContainer;
15
- return !G(e, n);
16
- }, Pe = (e) => e.addEventListener("click", (t) => {
13
+ return !W(e, n);
14
+ }, He = (e) => e.addEventListener("click", (t) => {
17
15
  // Allow clicks within not-annotatable elements
18
- !t.target.closest(W) && !t.target.closest("a") && t.preventDefault();
16
+ !t.target.closest($) && !t.target.closest("a") && t.preventDefault();
19
17
  }), J = (e) => ({
20
18
  ...e,
21
19
  type: e.type,
@@ -42,7 +40,7 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
42
40
  pointerId: e.pointerId,
43
41
  pointerType: e.pointerType,
44
42
  timeStamp: e.timeStamp
45
- }), j = (e) => ({
43
+ }), G = (e) => ({
46
44
  ...e,
47
45
  type: e.type,
48
46
  key: e.key,
@@ -63,9 +61,9 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
63
61
  return ((...r) => {
64
62
  clearTimeout(n), n = setTimeout(() => e.apply(void 0, r), t);
65
63
  });
66
- }, De = Ee(), ge = De.os.is(Ce.MACOS), Ue = (e) => {
64
+ }, me = typeof navigator < "u" && navigator.platform.startsWith("Mac"), De = (e) => {
67
65
  (!e.hasAttribute("tabindex") || e.tabIndex < -1) && e.setAttribute("tabindex", "-1"), e.classList.add("no-focus-outline");
68
- }, Ke = (e) => {
66
+ }, Pe = (e) => {
69
67
  const t = [], n = document.createNodeIterator(
70
68
  e.commonAncestorContainer,
71
69
  NodeFilter.SHOW_TEXT
@@ -80,19 +78,19 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
80
78
  if (i.selectNode(s), e.startContainer.nodeType === Node.TEXT_NODE)
81
79
  i.setStart(s, e.startOffset);
82
80
  else {
83
- const g = e.startContainer.childNodes[e.startOffset];
84
- g ? i.setStartBefore(g) : i.setStartAfter(e.startContainer);
81
+ const f = e.startContainer.childNodes[e.startOffset];
82
+ f ? i.setStartBefore(f) : i.setStartAfter(e.startContainer);
85
83
  }
86
84
  const c = document.createRange();
87
85
  if (c.selectNode(o), e.endContainer.nodeType === Node.TEXT_NODE)
88
86
  c.setEnd(o, e.endOffset);
89
87
  else {
90
- const g = e.endContainer.childNodes[e.endOffset];
91
- g ? c.setEndBefore(g) : c.setEndAfter(e.endContainer);
88
+ const f = e.endContainer.childNodes[e.endOffset];
89
+ f ? c.setEndBefore(f) : c.setEndAfter(e.endContainer);
92
90
  }
93
- const l = (g) => {
94
- const d = document.createRange();
95
- return d.selectNode(g), Array.from(d.getClientRects());
91
+ const l = (f) => {
92
+ const u = document.createRange();
93
+ return u.selectNode(f), Array.from(u.getClientRects());
96
94
  };
97
95
  return [
98
96
  ...Array.from(i.getClientRects()),
@@ -100,20 +98,20 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
100
98
  ...Array.from(c.getClientRects())
101
99
  ];
102
100
  }
103
- }, We = function* (e) {
101
+ }, Ue = function* (e) {
104
102
  const t = document.createNodeIterator(
105
103
  e.commonAncestorContainer,
106
104
  NodeFilter.SHOW_ELEMENT,
107
- (r) => r instanceof HTMLElement && r.classList.contains(ue) && !r.parentElement.closest(W) && e.intersectsNode(r) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
105
+ (r) => r instanceof HTMLElement && r.classList.contains(fe) && !r.parentElement.closest($) && e.intersectsNode(r) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
108
106
  );
109
107
  let n;
110
108
  for (; n = t.nextNode(); )
111
109
  n instanceof HTMLElement && (yield n);
112
- }, $e = (e, t) => {
113
- if (!fe(e, t)) return [];
110
+ }, Ke = (e, t) => {
111
+ if (!ge(e, t)) return [];
114
112
  const n = [];
115
113
  let r = null;
116
- for (const s of We(t)) {
114
+ for (const s of Ue(t)) {
117
115
  let o;
118
116
  r ? (o = document.createRange(), o.setStartAfter(r), o.setEndBefore(s)) : (o = t.cloneRange(), o.setEndBefore(s)), o.collapsed || n.push(o), r = s;
119
117
  }
@@ -124,18 +122,18 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
124
122
  return n.length > 0 ? n : [t];
125
123
  }, oe = (e) => {
126
124
  const t = e.cloneContents();
127
- return t.querySelectorAll(W).forEach((n) => n.remove()), t;
128
- }, Fe = (e, t, n = 10, r) => {
125
+ return t.querySelectorAll($).forEach((n) => n.remove()), t;
126
+ }, ie = new Intl.Segmenter(void 0, { granularity: "grapheme" }), We = (e, t, n = 10, r) => {
129
127
  const s = r ? e.startContainer.parentElement.closest(r) : t, o = document.createRange();
130
128
  o.setStart(s, 0), o.setEnd(e.startContainer, e.startOffset);
131
129
  const i = oe(o).textContent, c = document.createRange();
132
130
  c.setStart(e.endContainer, e.endOffset), s === document.body ? c.setEnd(s, s.childNodes.length) : c.setEndAfter(s);
133
- const l = oe(c).textContent;
131
+ const l = oe(c).textContent, f = [...ie.segment(i)], u = [...ie.segment(l)];
134
132
  return {
135
- prefix: i.substring(i.length - n),
136
- suffix: l.substring(0, n)
133
+ prefix: f.slice(-n).map((d) => d.segment).join(""),
134
+ suffix: u.slice(0, n).map((d) => d.segment).join("")
137
135
  };
138
- }, I = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), me = /^\s*$/, Ve = (e) => me.test(e.toString()), Ht = (e) => me.test(e.textContent || ""), Ye = (e, t, n, r) => {
136
+ }, I = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), pe = /^\s*$/, $e = (e) => pe.test(e.toString()), kt = (e) => pe.test(e.textContent || ""), Fe = (e, t, n, r) => {
139
137
  const s = (c) => Math.round(c * 10) / 10, o = {
140
138
  top: s(e.top),
141
139
  bottom: s(e.bottom),
@@ -159,38 +157,38 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
159
157
  return "block-contains";
160
158
  } else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
161
159
  return "block-is-contained";
162
- }, Xe = (e, t) => {
160
+ }, Ve = (e, t) => {
163
161
  const n = Math.min(e.left, t.left), r = Math.max(e.right, t.right), s = Math.min(e.top, t.top), o = Math.max(e.bottom, t.bottom);
164
162
  return new DOMRect(n, s, r - n, o - s);
165
- }, ze = (e, t = 0.5, n = 0.5) => e.reduce((r, s) => {
163
+ }, Ye = (e, t = 0.5, n = 0.5) => e.reduce((r, s) => {
166
164
  if (s.width === 0 || s.height === 0)
167
165
  return r;
168
166
  let o = [...r], i = !1;
169
167
  for (const c of r) {
170
- const l = Ye(s, c, t, n);
168
+ const l = Fe(s, c, t, n);
171
169
  if (l === "inline-adjacent") {
172
- o = o.map((g) => g === c ? Xe(s, c) : g), i = !0;
170
+ o = o.map((f) => f === c ? Ve(s, c) : f), i = !0;
173
171
  break;
174
172
  } else if (l === "inline-contains") {
175
- o = o.map((g) => g === c ? s : g), i = !0;
173
+ o = o.map((f) => f === c ? s : f), i = !0;
176
174
  break;
177
175
  } else if (l === "inline-is-contained") {
178
176
  i = !0;
179
177
  break;
180
178
  } else if (l === "block-contains" || l === "block-is-contained") {
181
- s.width < c.width && (o = o.map((g) => g === c ? s : g)), s.width === c.width && s.height < c.width && (o = o.map((g) => g === c ? s : g)), i = !0;
179
+ s.width < c.width && (o = o.map((f) => f === c ? s : f)), s.width === c.width && s.height < c.width && (o = o.map((f) => f === c ? s : f)), i = !0;
182
180
  break;
183
181
  }
184
182
  }
185
183
  return i ? o : [...o, s];
186
- }, []), Pt = (e) => ({
184
+ }, []), Mt = (e) => ({
187
185
  length: e.length,
188
186
  item: (t) => e[t],
189
187
  [Symbol.iterator]: function* () {
190
188
  for (let t = 0; t < this.length; t++)
191
189
  yield this.item(t);
192
190
  }
193
- }), qe = (e) => {
191
+ }), Xe = (e) => {
194
192
  if (e.length === 0) return [];
195
193
  if (e.length === 1) return [e[0]];
196
194
  e.sort((s, o) => {
@@ -199,46 +197,46 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
199
197
  });
200
198
  const [t, ...n] = e, r = n.reduce((s, o) => s.current.compareBoundaryPoints(Range.START_TO_END, o) >= 0 ? (s.current.compareBoundaryPoints(Range.END_TO_END, o) < 0 && s.current.setEnd(o.endContainer, o.endOffset), s) : (s.merged.push(s.current), s.current = o.cloneRange(), s), { merged: [], current: t.cloneRange() });
201
199
  return [...r.merged, r.current];
202
- }, je = (e, t, n) => {
200
+ }, ze = (e, t, n) => {
203
201
  const r = document.createRange(), s = n ? e.startContainer.parentElement.closest(n) : t;
204
202
  r.setStart(s, 0), r.setEnd(e.startContainer, e.startOffset);
205
203
  const o = oe(r).textContent, i = e.toString(), c = o.length || 0, l = c + i.length;
206
204
  return n ? { quote: i, start: c, end: l, range: e, offsetReference: s } : { quote: i, start: c, end: l, range: e };
207
- }, Ge = (e, t) => {
205
+ }, je = (e, t) => {
208
206
  const { left: n, top: r, right: s, bottom: o } = e;
209
207
  return new DOMRect(n - t.left, r - t.top, s - n, o - r);
210
- }, Dt = (e, t) => {
208
+ }, It = (e, t) => {
211
209
  const { left: n, top: r, right: s, bottom: o } = e;
212
210
  return new DOMRect(n + t.left, r + t.top, s - n, o - r);
213
- }, pe = (e, t) => {
211
+ }, he = (e, t) => {
214
212
  const { start: n, end: r } = e, s = e.offsetReference || t, o = document.createNodeIterator(
215
213
  t,
216
214
  NodeFilter.SHOW_TEXT,
217
- (d) => d.parentElement?.closest(W) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT
215
+ (u) => u.parentElement?.closest($) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT
218
216
  );
219
217
  let i = 0;
220
218
  const c = document.createRange();
221
219
  let l = o.nextNode();
222
220
  l === null && console.error("Could not revive annotation target. Content missing.");
223
- let g = !s;
221
+ let f = !s;
224
222
  for (; l !== null; ) {
225
- if (g ||= typeof s?.contains == "function" ? s.contains(l) : !1, g) {
226
- const d = l.textContent?.length || 0;
227
- if (i + d > n) {
223
+ if (f ||= typeof s?.contains == "function" ? s.contains(l) : !1, f) {
224
+ const u = l.textContent?.length || 0;
225
+ if (i + u > n) {
228
226
  c.setStart(l, n - i);
229
227
  break;
230
228
  }
231
- i += d;
229
+ i += u;
232
230
  }
233
231
  l = o.nextNode();
234
232
  }
235
233
  for (; l !== null; ) {
236
- const d = l.textContent?.length || 0;
237
- if (i + d >= r) {
234
+ const u = l.textContent?.length || 0;
235
+ if (i + u >= r) {
238
236
  c.setEnd(l, r - i);
239
237
  break;
240
238
  }
241
- i += d, l = o.nextNode();
239
+ i += u, l = o.nextNode();
242
240
  }
243
241
  return {
244
242
  ...e,
@@ -246,20 +244,20 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
246
244
  };
247
245
  }, Q = (e, t) => I(e.selector) ? e : {
248
246
  ...e,
249
- selector: e.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : pe(n, t))
250
- }, te = (e, t) => I(e.target.selector) ? e : { ...e, target: Q(e.target, t) }, Qe = (e, t) => {
247
+ selector: e.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : he(n, t))
248
+ }, te = (e, t) => I(e.target.selector) ? e : { ...e, target: Q(e.target, t) }, qe = (e, t) => {
251
249
  const n = e.cloneRange();
252
250
  return t.contains(n.startContainer) || n.setStart(t, 0), t.contains(n.endContainer) || n.setEnd(t, t.childNodes.length), n;
253
- }, he = (e) => {
251
+ }, ye = (e) => {
254
252
  if (!e)
255
253
  return document.scrollingElement;
256
254
  const { overflowY: t } = window.getComputedStyle(e);
257
- return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : he(e.parentElement);
258
- }, ie = (e, t, n) => {
259
- const r = n.getBoundingClientRect(), s = n.clientHeight, o = n.clientWidth, i = t.selector[0].range.getBoundingClientRect(), { width: c, height: l } = e.getAnnotationBounds(t.annotation), g = i.top - r.top, d = i.left - r.left, u = n.parentElement ? n.scrollTop : 0, y = n.parentElement ? n.scrollLeft : 0, w = g + u - (s - l) / 2, f = d + y - (o - c) / 2;
260
- n.scroll({ top: w, left: f, behavior: "smooth" });
261
- }, Ze = (e, t) => (n, r) => {
262
- const s = typeof n == "string" ? n : n.id, o = r ? typeof r == "string" ? document.getElementById(r) : r : he(e);
255
+ return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : ye(e.parentElement);
256
+ }, ae = (e, t, n) => {
257
+ const r = n.getBoundingClientRect(), s = n.clientHeight, o = n.clientWidth, i = t.selector[0].range.getBoundingClientRect(), { width: c, height: l } = e.getAnnotationBounds(t.annotation), f = i.top - r.top, u = i.left - r.left, d = n.parentElement ? n.scrollTop : 0, y = n.parentElement ? n.scrollLeft : 0, w = f + d - (s - l) / 2, g = u + y - (o - c) / 2;
258
+ n.scroll({ top: w, left: g, behavior: "smooth" });
259
+ }, Ge = (e, t) => (n, r) => {
260
+ const s = typeof n == "string" ? n : n.id, o = r ? typeof r == "string" ? document.getElementById(r) : r : ye(e);
263
261
  if (!o)
264
262
  return console.warn(`The scroll parent is missing for the annotation: ${s}`, { container: e }), !1;
265
263
  const i = t.getAnnotation(s);
@@ -267,19 +265,19 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
267
265
  return console.warn(`The annotation is missing in the store: ${s}`), !1;
268
266
  const { range: c } = i.target.selector[0];
269
267
  if (c && !c.collapsed)
270
- return ie(t, i.target, o), !0;
271
- const l = Q(i.target, e), { range: g } = l.selector[0];
272
- return g && !g.collapsed ? (ie(t, l, o), !0) : !1;
268
+ return ae(t, i.target, o), !0;
269
+ const l = Q(i.target, e), { range: f } = l.selector[0];
270
+ return f && !f.collapsed ? (ae(t, l, o), !0) : !1;
273
271
  }, _ = {
274
272
  fill: "rgb(0, 128, 255)",
275
273
  fillOpacity: 0.18
276
274
  }, Z = {
277
275
  fill: "rgb(0, 128, 255)",
278
276
  fillOpacity: 0.45
279
- }, Je = (e) => {
277
+ }, Qe = (e) => {
280
278
  const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: r, innerHeight: s } = window, o = -n, i = -t, c = r - n, l = s - t;
281
279
  return { top: t, left: n, minX: o, minY: i, maxX: c, maxY: l };
282
- }, et = (e) => {
280
+ }, Ze = (e) => {
283
281
  let t = /* @__PURE__ */ new Set();
284
282
  return (r) => {
285
283
  const s = r.map((o) => o.id);
@@ -287,35 +285,35 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
287
285
  };
288
286
  }, se = (e, t, n, r) => {
289
287
  const { store: s, selection: o, hover: i } = t;
290
- let c, l, g;
291
- const d = et(n), u = (A) => {
292
- const { x: T, y: N } = e.getBoundingClientRect(), O = s.getAt(A.clientX - T, A.clientY - N, !1, l);
293
- O && t.selection.evalSelectAction(O) !== Se.NONE ? i.current !== O.id && (e.classList.add("hovered"), i.set(O.id)) : i.current && (e.classList.remove("hovered"), i.set(null));
288
+ let c, l, f;
289
+ const u = Ze(n), d = (A) => {
290
+ const { x: v, y: N } = e.getBoundingClientRect(), O = s.getAt(A.clientX - v, A.clientY - N, !1, l);
291
+ O && t.selection.evalSelectAction(O) !== Ce.NONE ? i.current !== O.id && (e.classList.add("hovered"), i.set(O.id)) : i.current && (e.classList.remove("hovered"), i.set(null));
294
292
  };
295
- e.addEventListener("pointermove", u);
293
+ e.addEventListener("pointermove", d);
296
294
  const y = ee((A = !1) => requestAnimationFrame(() => {
297
- g && g.clear();
298
- const T = Je(e), { minX: N, minY: O, maxX: D, maxY: Y } = T, X = l ? s.getIntersecting(N, O, D, Y).filter(({ annotation: h }) => l(h)) : s.getIntersecting(N, O, D, Y), $ = o.selected.map(({ id: h }) => h), re = X.map(({ annotation: h, rects: v }) => {
299
- const k = $.includes(h.id), U = h.id === i.current;
295
+ f && f.clear();
296
+ const v = Qe(e), { minX: N, minY: O, maxX: P, maxY: X } = v, z = l ? s.getIntersecting(N, O, P, X).filter(({ annotation: p }) => l(p)) : s.getIntersecting(N, O, P, X), F = o.selected.map(({ id: p }) => p), re = z.map(({ annotation: p, rects: T }) => {
297
+ const k = F.includes(p.id), U = p.id === i.current;
300
298
  return {
301
- annotation: h,
302
- rects: v,
299
+ annotation: p,
300
+ rects: T,
303
301
  state: { selected: k, hovered: U }
304
302
  };
305
303
  });
306
- r.redraw(re, T, c, g, A), setTimeout(() => d(X.map(({ annotation: h }) => h)), 1);
304
+ r.redraw(re, v, c, f, A), setTimeout(() => u(z.map(({ annotation: p }) => p)), 1);
307
305
  }), 10), w = (A) => {
308
- g = A, y();
309
- }, f = (A) => {
306
+ f = A, y();
307
+ }, g = (A) => {
310
308
  c = A, y();
311
309
  }, x = (A) => {
312
310
  l = A, y(!1);
313
311
  }, R = () => y();
314
312
  s.observe(R);
315
- const b = o.subscribe(() => y()), p = i.subscribe(() => y()), S = () => y(!0);
313
+ const b = o.subscribe(() => y()), h = i.subscribe(() => y()), S = () => y(!0);
316
314
  document.addEventListener("scroll", S, { capture: !0, passive: !0 });
317
315
  const E = ee(() => {
318
- s.recalculatePositions(), g?.reset(), y();
316
+ s.recalculatePositions(), f?.reset(), y();
319
317
  }, 10);
320
318
  window.addEventListener("resize", E);
321
319
  const m = new ResizeObserver(E);
@@ -325,48 +323,48 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
325
323
  }, 150));
326
324
  return C.observe(document.body, a), {
327
325
  destroy: () => {
328
- e.removeEventListener("pointermove", u), r.destroy(), s.unobserve(R), b(), p(), document.removeEventListener("scroll", S), window.removeEventListener("resize", E), m.disconnect(), C.disconnect();
326
+ e.removeEventListener("pointermove", d), r.destroy(), s.unobserve(R), b(), h(), document.removeEventListener("scroll", S), window.removeEventListener("resize", E), m.disconnect(), C.disconnect();
329
327
  },
330
328
  redraw: y,
331
- setStyle: f,
329
+ setStyle: g,
332
330
  setFilter: x,
333
331
  setPainter: w,
334
332
  setVisible: r.setVisible
335
333
  };
336
- }, tt = () => {
334
+ }, Je = () => {
337
335
  const e = document.createElement("canvas");
338
336
  return e.width = window.innerWidth, e.height = window.innerHeight, e.className = "r6o-canvas-highlight-layer bg", e;
339
- }, nt = (e, t) => {
337
+ }, et = (e, t) => {
340
338
  e.width = window.innerWidth, e.height = window.innerHeight;
341
- }, ot = (e) => {
339
+ }, tt = (e) => {
342
340
  console.warn('WARNING! Canvas renderer is deprecated and will be removed in the next major release. Please use the default "SPANS" renderer instead.'), e.classList.add("r6o-annotatable");
343
- const t = tt(), n = t.getContext("2d");
341
+ const t = Je(), n = t.getContext("2d");
344
342
  document.body.appendChild(t);
345
- const r = (c, l, g, d) => requestAnimationFrame(() => {
346
- const { width: u, height: y } = t;
347
- n.clearRect(-0.5, -0.5, u + 1, y + 1), d && d.clear();
348
- const { top: w, left: f } = l;
343
+ const r = (c, l, f, u) => requestAnimationFrame(() => {
344
+ const { width: d, height: y } = t;
345
+ n.clearRect(-0.5, -0.5, d + 1, y + 1), u && u.clear();
346
+ const { top: w, left: g } = l;
349
347
  [...c].sort((R, b) => {
350
- const { annotation: { target: { created: p } } } = R, { annotation: { target: { created: S } } } = b;
351
- return p.getTime() - S.getTime();
348
+ const { annotation: { target: { created: h } } } = R, { annotation: { target: { created: S } } } = b;
349
+ return h.getTime() - S.getTime();
352
350
  }).forEach((R) => {
353
- const b = g ? typeof g == "function" ? g(R.annotation, R.state) : g : R.state?.selected ? Z : _, p = d && d.paint(R, l) || b, S = R.rects.map(({ x: E, y: m, width: a, height: C }) => ({
354
- x: E + f,
351
+ const b = f ? typeof f == "function" ? f(R.annotation, R.state) : f : R.state?.selected ? Z : _, h = u && u.paint(R, l) || b, S = R.rects.map(({ x: E, y: m, width: a, height: C }) => ({
352
+ x: E + g,
355
353
  y: m + w,
356
354
  width: a,
357
355
  height: C
358
356
  }));
359
- if (n.fillStyle = p.fill, n.globalAlpha = p.fillOpacity || 1, S.forEach(
357
+ if (n.fillStyle = h.fill, n.globalAlpha = h.fillOpacity || 1, S.forEach(
360
358
  ({ x: E, y: m, width: a, height: C }) => n.fillRect(E, m, a, C)
361
- ), p.underlineColor) {
362
- n.globalAlpha = 1, n.strokeStyle = p.underlineColor, n.lineWidth = p.underlineThickness ?? 1;
363
- const E = p.underlineOffset ?? 0;
359
+ ), h.underlineColor) {
360
+ n.globalAlpha = 1, n.strokeStyle = h.underlineColor, n.lineWidth = h.underlineThickness ?? 1;
361
+ const E = h.underlineOffset ?? 0;
364
362
  S.forEach(({ x: m, y: a, width: C, height: L }) => {
365
363
  n.beginPath(), n.moveTo(m, a + L + E), n.lineTo(m + C, a + L + E), n.stroke();
366
364
  });
367
365
  }
368
366
  });
369
- }), s = le(() => nt(t), 10);
367
+ }), s = de(() => et(t), 10);
370
368
  return window.addEventListener("resize", s), {
371
369
  destroy: () => {
372
370
  t.remove(), s.clear(), window.removeEventListener("resize", s);
@@ -376,13 +374,13 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
376
374
  },
377
375
  redraw: r
378
376
  };
379
- }, st = (e, t, n) => se(e, t, n, ot(e)), rt = (e) => [
377
+ }, nt = (e, t, n) => se(e, t, n, tt(e)), ot = (e) => [
380
378
  `background-color:${ne(e?.fill || _.fill).alpha(e?.fillOpacity === void 0 ? _.fillOpacity : e.fillOpacity).toHex()}`,
381
379
  e?.underlineThickness ? "text-decoration:underline" : void 0,
382
380
  e?.underlineColor ? `text-decoration-color:${e.underlineColor}` : void 0,
383
381
  e?.underlineOffset ? `text-underline-offset:${e.underlineOffset}px` : void 0,
384
382
  e?.underlineThickness ? `text-decoration-thickness:${e.underlineThickness}px` : void 0
385
- ].filter(Boolean).join(";"), it = () => {
383
+ ].filter(Boolean).join(";"), st = () => {
386
384
  const e = document.createElement("style");
387
385
  document.getElementsByTagName("head")[0].appendChild(e);
388
386
  let t = /* @__PURE__ */ new Set();
@@ -395,26 +393,26 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
395
393
  },
396
394
  redraw: (o, i, c, l) => {
397
395
  l && l.clear();
398
- const g = new Set(o.map((u) => u.annotation.id));
399
- Array.from(t).filter((u) => !g.has(u));
400
- const d = o.map((u) => {
401
- const y = c ? typeof c == "function" ? c(u.annotation, u.state) : c : u.state?.selected ? Z : _, w = l && l.paint(u, i) || y;
402
- return `::highlight(_${u.annotation.id}) { ${rt(w)} }`;
396
+ const f = new Set(o.map((d) => d.annotation.id));
397
+ Array.from(t).filter((d) => !f.has(d));
398
+ const u = o.map((d) => {
399
+ const y = c ? typeof c == "function" ? c(d.annotation, d.state) : c : d.state?.selected ? Z : _, w = l && l.paint(d, i) || y;
400
+ return `::highlight(_${d.annotation.id}) { ${ot(w)} }`;
403
401
  });
404
- e.innerHTML = d.join(`
405
- `), CSS.highlights.clear(), o.forEach(({ annotation: u }) => {
406
- const y = u.target.selector.map((f) => f.range), w = new Highlight(...y);
407
- CSS.highlights.set(`_${u.id}`, w);
408
- }), t = g;
402
+ e.innerHTML = u.join(`
403
+ `), CSS.highlights.clear(), o.forEach(({ annotation: d }) => {
404
+ const y = d.target.selector.map((g) => g.range), w = new Highlight(...y);
405
+ CSS.highlights.set(`_${d.id}`, w);
406
+ }), t = f;
409
407
  }
410
408
  };
411
- }, at = (e, t, n) => se(e, t, n, it()), ct = (e) => e?.fillOpacity !== void 0 ? ne(e?.fill || _.fill).alpha(e.fillOpacity).toHex() : e?.fill ? e.fill : ne(_.fill).alpha(_.fillOpacity).toHex(), lt = (e, t, n, r, s) => {
409
+ }, rt = (e, t, n) => se(e, t, n, st()), it = (e) => e?.fillOpacity !== void 0 ? ne(e?.fill || _.fill).alpha(e.fillOpacity).toHex() : e?.fill ? e.fill : ne(_.fill).alpha(_.fillOpacity).toHex(), at = (e, t, n, r, s) => {
412
410
  const o = n ? typeof n == "function" ? n(e.annotation, e.state, s) || (e.state?.selected ? Z : _) : n : e.state?.selected ? Z : _;
413
411
  return r && r.paint(e, t) || o;
414
- }, dt = (e, t) => {
412
+ }, ct = (e, t) => {
415
413
  const n = (o, i) => o.x <= i.x + i.width && o.x + o.width >= i.x && o.y <= i.y + i.height && o.y + o.height >= i.y, r = (o) => o.rects.reduce((i, c) => i + c.width, 0), s = t.filter(({ rects: o }) => o.some((i) => n(e, i)));
416
414
  return s.sort((o, i) => r(i) - r(o)), s.findIndex((o) => o.rects.includes(e));
417
- }, ut = (e) => {
415
+ }, lt = (e) => {
418
416
  e.classList.add("r6o-annotatable");
419
417
  const t = document.createElement("div");
420
418
  t.className = "r6o-span-highlight-layer", e.insertBefore(t, e.firstChild);
@@ -423,18 +421,18 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
423
421
  destroy: () => {
424
422
  t.remove();
425
423
  },
426
- redraw: (i, c, l, g, d) => {
427
- const y = !(Me(n, i) && d);
428
- if (!g && !y) return;
429
- y && (t.innerHTML = ""), [...i].sort((f, x) => {
430
- const { annotation: { target: { created: R } } } = f, { annotation: { target: { created: b } } } = x;
424
+ redraw: (i, c, l, f, u) => {
425
+ const y = !(ke(n, i) && u);
426
+ if (!f && !y) return;
427
+ y && (t.innerHTML = ""), [...i].sort((g, x) => {
428
+ const { annotation: { target: { created: R } } } = g, { annotation: { target: { created: b } } } = x;
431
429
  return R && b ? R.getTime() - b.getTime() : 0;
432
- }).forEach((f) => {
433
- f.rects.map((x) => {
434
- const R = dt(x, i), b = lt(f, c, l, g, R);
430
+ }).forEach((g) => {
431
+ g.rects.map((x) => {
432
+ const R = ct(x, i), b = at(g, c, l, f, R);
435
433
  if (y) {
436
- const p = document.createElement("span");
437
- p.className = "r6o-annotation", p.dataset.annotation = f.annotation.id, p.style.left = `${x.x}px`, p.style.top = `${x.y}px`, p.style.width = `${x.width}px`, p.style.height = `${x.height}px`, p.style.backgroundColor = ct(b), b.underlineStyle && (p.style.borderStyle = b.underlineStyle), b.underlineColor && (p.style.borderColor = b.underlineColor), b.underlineThickness && (p.style.borderBottomWidth = `${b.underlineThickness}px`), b.underlineOffset && (p.style.paddingBottom = `${b.underlineOffset}px`), t.appendChild(p);
434
+ const h = document.createElement("span");
435
+ h.className = "r6o-annotation", h.dataset.annotation = g.annotation.id, h.style.left = `${x.x}px`, h.style.top = `${x.y}px`, h.style.width = `${x.width}px`, h.style.height = `${x.height}px`, h.style.backgroundColor = it(b), b.underlineStyle && (h.style.borderStyle = b.underlineStyle), b.underlineColor && (h.style.borderColor = b.underlineColor), b.underlineThickness && (h.style.borderBottomWidth = `${b.underlineThickness}px`), b.underlineOffset && (h.style.paddingBottom = `${b.underlineOffset}px`), t.appendChild(h);
438
436
  }
439
437
  });
440
438
  }), n = i;
@@ -443,10 +441,10 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
443
441
  i ? t.classList.remove("hidden") : t.classList.add("hidden");
444
442
  }
445
443
  };
446
- }, ft = (e, t, n) => se(e, t, n, ut(e)), Ut = (e, t) => ({
447
- parse: (n) => pt(n),
448
- serialize: (n) => ht(n, e, t)
449
- }), gt = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, mt = (e) => {
444
+ }, dt = (e, t, n) => se(e, t, n, lt(e)), _t = (e, t) => ({
445
+ parse: (n) => gt(n),
446
+ serialize: (n) => mt(n, e, t)
447
+ }), ut = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, ft = (e) => {
450
448
  const {
451
449
  id: t,
452
450
  creator: n,
@@ -457,7 +455,7 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
457
455
  if (i.length === 0)
458
456
  return { error: Error(`No targets found for annotation: ${e.id}`) };
459
457
  const c = {
460
- creator: Re(n),
458
+ creator: we(n),
461
459
  created: r ? new Date(r) : void 0,
462
460
  updated: s ? new Date(s) : void 0,
463
461
  annotation: t,
@@ -466,43 +464,43 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
466
464
  styleClass: "styleClass" in i[0] ? i[0].styleClass : void 0
467
465
  };
468
466
  for (const l of i) {
469
- const d = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((u, y) => {
467
+ const u = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((d, y) => {
470
468
  switch (y.type) {
471
469
  case "TextQuoteSelector":
472
- u.quote = y.exact;
470
+ d.quote = y.exact;
473
471
  break;
474
472
  case "TextPositionSelector":
475
- u.start = y.start, u.end = y.end;
473
+ d.start = y.start, d.end = y.end;
476
474
  break;
477
475
  }
478
- return u;
476
+ return d;
479
477
  }, {});
480
- if (c.outdated ||= "outdated" in l ? l.outdated : void 0, gt(d))
478
+ if (c.outdated ||= "outdated" in l ? l.outdated : void 0, ut(u))
481
479
  c.selector.push(
482
480
  {
483
- ...d,
481
+ ...u,
484
482
  id: l.id,
485
483
  // @ts-expect-error: `scope` is not part of the core `TextSelector` type
486
484
  scope: l.scope
487
485
  }
488
486
  );
489
487
  else {
490
- const u = [
491
- d.start ? void 0 : "TextPositionSelector",
492
- d.quote ? void 0 : "TextQuoteSelector"
488
+ const d = [
489
+ u.start ? void 0 : "TextPositionSelector",
490
+ u.quote ? void 0 : "TextQuoteSelector"
493
491
  ].filter(Boolean);
494
- return { error: Error(`Missing selector types: ${u.join(" and ")} for annotation: ${e.id}`) };
492
+ return { error: Error(`Missing selector types: ${d.join(" and ")} for annotation: ${e.id}`) };
495
493
  }
496
494
  }
497
495
  return { parsed: c };
498
- }, pt = (e) => {
499
- const t = e.id || de(), {
496
+ }, gt = (e) => {
497
+ const t = e.id || ue(), {
500
498
  creator: n,
501
499
  created: r,
502
500
  modified: s,
503
501
  body: o,
504
502
  ...i
505
- } = e, c = we(o, t), l = mt(e);
503
+ } = e, c = Ae(o, t), l = ft(e);
506
504
  return "error" in l ? { error: l.error } : {
507
505
  parsed: {
508
506
  ...i,
@@ -511,21 +509,21 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
511
509
  target: l.parsed
512
510
  }
513
511
  };
514
- }, ht = (e, t, n) => {
512
+ }, mt = (e, t, n) => {
515
513
  const { bodies: r, target: s, ...o } = e, {
516
514
  selector: i,
517
515
  creator: c,
518
516
  created: l,
519
- updated: g,
520
- ...d
521
- } = s, u = i.map((y) => {
522
- const { id: w, quote: f, start: x, end: R, range: b } = y, p = {
517
+ updated: f,
518
+ ...u
519
+ } = s, d = i.map((y) => {
520
+ const { id: w, quote: g, start: x, end: R, range: b } = y, h = {
523
521
  type: "TextQuoteSelector",
524
- exact: f
522
+ exact: g
525
523
  };
526
524
  if (n) {
527
- const { prefix: E, suffix: m } = Fe(b, n);
528
- p.prefix = E, p.suffix = m;
525
+ const { prefix: E, suffix: m } = We(b, n);
526
+ h.prefix = E, h.suffix = m;
529
527
  }
530
528
  const S = {
531
529
  type: "TextPositionSelector",
@@ -533,12 +531,12 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
533
531
  end: R
534
532
  };
535
533
  return {
536
- ...d,
534
+ ...u,
537
535
  id: w,
538
536
  // @ts-expect-error: `scope` is not part of the core `TextSelector` type
539
537
  scope: "scope" in y ? y.scope : void 0,
540
538
  source: t,
541
- selector: [p, S]
539
+ selector: [h, S]
542
540
  };
543
541
  });
544
542
  return {
@@ -546,39 +544,39 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
546
544
  "@context": "http://www.w3.org/ns/anno.jsonld",
547
545
  id: e.id,
548
546
  type: "Annotation",
549
- body: Ae(e.bodies),
547
+ body: Se(e.bodies),
550
548
  creator: c,
551
549
  created: l?.toISOString(),
552
- modified: g?.toISOString(),
553
- target: u
550
+ modified: f?.toISOString(),
551
+ target: d
554
552
  };
555
- }, yt = () => {
553
+ }, pt = () => {
556
554
  const e = document.createElement("canvas");
557
555
  e.width = 2 * window.innerWidth, e.height = 2 * window.innerHeight, e.className = "r6o-presence-layer";
558
556
  const t = e.getContext("2d");
559
557
  return t.scale(2, 2), t.translate(0.5, 0.5), e;
560
- }, bt = (e, t = {}) => {
561
- const n = yt(), r = n.getContext("2d");
558
+ }, ht = (e, t = {}) => {
559
+ const n = pt(), r = n.getContext("2d");
562
560
  document.body.appendChild(n);
563
- const s = /* @__PURE__ */ new Map(), o = (d) => Array.from(s.entries()).filter(([u, y]) => y.presenceKey === d.presenceKey).map(([u, y]) => u);
564
- return e.on("selectionChange", (d, u) => {
565
- o(d).forEach((w) => s.delete(w)), u && u.forEach((w) => s.set(w, d));
561
+ const s = /* @__PURE__ */ new Map(), o = (u) => Array.from(s.entries()).filter(([d, y]) => y.presenceKey === u.presenceKey).map(([d, y]) => d);
562
+ return e.on("selectionChange", (u, d) => {
563
+ o(u).forEach((w) => s.delete(w)), d && d.forEach((w) => s.set(w, u));
566
564
  }), {
567
565
  clear: () => {
568
- const { width: d, height: u } = n;
569
- r.clearRect(-0.5, -0.5, d + 1, u + 1);
566
+ const { width: u, height: d } = n;
567
+ r.clearRect(-0.5, -0.5, u + 1, d + 1);
570
568
  },
571
569
  destroy: () => {
572
570
  n.remove();
573
571
  },
574
- paint: (d, u, y) => {
572
+ paint: (u, d, y) => {
575
573
  t.font && (r.font = t.font);
576
- const w = s.get(d.annotation.id);
574
+ const w = s.get(u.annotation.id);
577
575
  if (w) {
578
- const { height: f } = d.rects[0], x = d.rects[0].x + u.left, R = d.rects[0].y + u.top;
579
- r.fillStyle = w.appearance.color, r.fillRect(x - 2, R - 2.5, 2, f + 5);
580
- const b = r.measureText(w.appearance.label), p = b.width + 6, S = b.actualBoundingBoxAscent + b.actualBoundingBoxDescent + 8, E = b.fontBoundingBoxAscent ? 8 : 6.5;
581
- return r.fillRect(x - 2, R - 2.5 - S, p, S), r.fillStyle = "#fff", r.fillText(w.appearance.label, x + 1, R - E), {
576
+ const { height: g } = u.rects[0], x = u.rects[0].x + d.left, R = u.rects[0].y + d.top;
577
+ r.fillStyle = w.appearance.color, r.fillRect(x - 2, R - 2.5, 2, g + 5);
578
+ const b = r.measureText(w.appearance.label), h = b.width + 6, S = b.actualBoundingBoxAscent + b.actualBoundingBoxDescent + 8, E = b.fontBoundingBoxAscent ? 8 : 6.5;
579
+ return r.fillRect(x - 2, R - 2.5 - S, h, S), r.fillStyle = "#fff", r.fillText(w.appearance.label, x + 1, R - E), {
582
580
  fill: w.appearance.color,
583
581
  fillOpacity: y ? 0.45 : 0.18
584
582
  };
@@ -586,169 +584,169 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
586
584
  },
587
585
  reset: () => {
588
586
  n.width = 2 * window.innerWidth, n.height = 2 * window.innerHeight;
589
- const d = n.getContext("2d");
590
- d.scale(2, 2), d.translate(0.5, 0.5);
587
+ const u = n.getContext("2d");
588
+ u.scale(2, 2), u.translate(0.5, 0.5);
591
589
  }
592
590
  };
593
- }, Et = (e, t, n, r) => {
594
- const s = new Ie(), o = /* @__PURE__ */ new Map(), i = _e(), c = (m, a) => {
591
+ }, yt = (e, t, n, r) => {
592
+ const s = new Me(), o = /* @__PURE__ */ new Map(), i = Ie(), c = (m, a) => {
595
593
  const C = m.selector.flatMap((A) => {
596
- const T = I([A]) ? A.range : pe(A, t).range;
597
- return Ke(T);
598
- }), L = ze(C, n, r).map((A) => Ge(A, a));
594
+ const v = I([A]) ? A.range : he(A, t).range;
595
+ return Pe(v);
596
+ }), L = Ye(C, n, r).map((A) => je(A, a));
599
597
  return L.map((A) => {
600
- const { x: T, y: N, width: O, height: D } = A;
598
+ const { x: v, y: N, width: O, height: P } = A;
601
599
  return {
602
- minX: T,
600
+ minX: v,
603
601
  minY: N,
604
- maxX: T + O,
605
- maxY: N + D,
602
+ maxX: v + O,
603
+ maxY: N + P,
606
604
  annotation: {
607
605
  id: m.annotation,
608
606
  rects: L
609
607
  }
610
608
  };
611
609
  });
612
- }, l = () => [...o.values()], g = () => {
610
+ }, l = () => [...o.values()], f = () => {
613
611
  s.clear(), o.clear();
614
- }, d = (m) => {
612
+ }, u = (m) => {
615
613
  const a = c(m, t.getBoundingClientRect());
616
614
  a.length !== 0 && (a.forEach((C) => s.insert(C)), o.set(m.annotation, a));
617
- }, u = (m) => {
615
+ }, d = (m) => {
618
616
  const a = o.get(m.annotation);
619
617
  a && (a.forEach((C) => s.remove(C)), o.delete(m.annotation));
620
618
  }, y = (m) => {
621
- u(m), d(m);
619
+ d(m), u(m);
622
620
  }, w = (m, a = !0) => {
623
- a && g();
624
- const C = t.getBoundingClientRect(), L = m.map((T) => ({ target: T, rects: c(T, C) }));
625
- L.forEach(({ target: T, rects: N }) => {
626
- N.length > 0 && o.set(T.annotation, N);
621
+ a && f();
622
+ const C = t.getBoundingClientRect(), L = m.map((v) => ({ target: v, rects: c(v, C) }));
623
+ L.forEach(({ target: v, rects: N }) => {
624
+ N.length > 0 && o.set(v.annotation, N);
627
625
  });
628
- const A = L.flatMap(({ rects: T }) => T);
626
+ const A = L.flatMap(({ rects: v }) => v);
629
627
  s.load(A);
630
- }, f = (m, a, C = !1) => {
628
+ }, g = (m, a, C = !1) => {
631
629
  const L = s.search({
632
630
  minX: m,
633
631
  minY: a,
634
632
  maxX: m,
635
633
  maxY: a
636
- }), A = (T) => T.annotation.rects.reduce((N, O) => N + O.width * O.height, 0);
637
- return L.length > 0 ? (L.sort((T, N) => A(T) - A(N)), C ? L.map((T) => T.annotation.id) : [L[0].annotation.id]) : [];
634
+ }), A = (v) => v.annotation.rects.reduce((N, O) => N + O.width * O.height, 0);
635
+ return L.length > 0 ? (L.sort((v, N) => A(v) - A(N)), C ? L.map((v) => v.annotation.id) : [L[0].annotation.id]) : [];
638
636
  }, x = (m) => {
639
637
  const a = R(m);
640
638
  if (a.length === 0)
641
639
  return;
642
- let C = a[0].left, L = a[0].top, A = a[0].right, T = a[0].bottom;
640
+ let C = a[0].left, L = a[0].top, A = a[0].right, v = a[0].bottom;
643
641
  for (let N = 1; N < a.length; N++) {
644
642
  const O = a[N];
645
- C = Math.min(C, O.left), L = Math.min(L, O.top), A = Math.max(A, O.right), T = Math.max(T, O.bottom);
643
+ C = Math.min(C, O.left), L = Math.min(L, O.top), A = Math.max(A, O.right), v = Math.max(v, O.bottom);
646
644
  }
647
- return new DOMRect(C, L, A - C, T - L);
645
+ return new DOMRect(C, L, A - C, v - L);
648
646
  }, R = (m) => {
649
647
  const a = o.get(m);
650
648
  return a ? a[0].annotation.rects : [];
651
649
  };
652
650
  return {
653
651
  all: l,
654
- clear: g,
655
- getAt: f,
652
+ clear: f,
653
+ getAt: g,
656
654
  getAnnotationBounds: x,
657
655
  getAnnotationRects: R,
658
656
  getIntersecting: (m, a, C, L) => {
659
- const A = s.search({ minX: m, minY: a, maxX: C, maxY: L }), T = new Set(A.map((N) => N.annotation.id));
660
- return Array.from(T).map((N) => ({
657
+ const A = s.search({ minX: m, minY: a, maxX: C, maxY: L }), v = new Set(A.map((N) => N.annotation.id));
658
+ return Array.from(v).map((N) => ({
661
659
  annotation: e.getAnnotation(N),
662
660
  rects: R(N)
663
661
  })).filter((N) => !!N.annotation);
664
662
  },
665
- insert: d,
663
+ insert: u,
666
664
  recalculate: () => {
667
665
  w(e.all().map((m) => m.target), !0), i.emit("recalculate");
668
666
  },
669
- remove: u,
667
+ remove: d,
670
668
  set: w,
671
669
  size: () => s.all().length,
672
670
  update: y,
673
671
  on: (m, a) => i.on(m, a)
674
672
  };
675
- }, Ct = (e, t) => {
676
- const n = ve(), r = Et(n, e, t.mergeHighlights?.horizontalTolerance, t.mergeHighlights?.verticalTolerance), s = Te(n, t.userSelectAction, t.adapter), o = xe(n), i = Le(), c = (p, S = K.LOCAL) => {
677
- const E = te(p, e), m = I(E.target.selector);
673
+ }, bt = (e, t) => {
674
+ const n = Re(), r = yt(n, e, t.mergeHighlights?.horizontalTolerance, t.mergeHighlights?.verticalTolerance), s = Te(n, t.userSelectAction, t.adapter), o = ve(n), i = xe(), c = (h, S = K.LOCAL) => {
675
+ const E = te(h, e), m = I(E.target.selector);
678
676
  return m && n.addAnnotation(E, S), m;
679
- }, l = (p, S = !0, E = K.LOCAL) => {
680
- const m = p.map((C) => te(C, e)), a = m.filter((C) => !I(C.target.selector));
677
+ }, l = (h, S = !0, E = K.LOCAL) => {
678
+ const m = h.map((C) => te(C, e)), a = m.filter((C) => !I(C.target.selector));
681
679
  return n.bulkAddAnnotations(m, S, E), a;
682
- }, g = (p, S = K.LOCAL) => {
683
- const E = p.map((a) => te(a, e)), m = E.filter((a) => !I(a.target.selector));
680
+ }, f = (h, S = K.LOCAL) => {
681
+ const E = h.map((a) => te(a, e)), m = E.filter((a) => !I(a.target.selector));
684
682
  return E.forEach((a) => {
685
683
  n.getAnnotation(a.id) ? n.updateAnnotation(a, S) : n.addAnnotation(a, S);
686
684
  }), m;
687
- }, d = (p, S = K.LOCAL) => {
688
- const E = Q(p, e);
685
+ }, u = (h, S = K.LOCAL) => {
686
+ const E = Q(h, e);
689
687
  n.updateTarget(E, S);
690
- }, u = (p, S = K.LOCAL) => {
691
- const E = p.map((m) => Q(m, e));
688
+ }, d = (h, S = K.LOCAL) => {
689
+ const E = h.map((m) => Q(m, e));
692
690
  n.bulkUpdateTargets(E, S);
693
691
  };
694
- function y(p, S, E, m) {
695
- const a = E || !!m, C = r.getAt(p, S, a).map((A) => n.getAnnotation(A)), L = m ? C.filter(m) : C;
692
+ function y(h, S, E, m) {
693
+ const a = E || !!m, C = r.getAt(h, S, a).map((A) => n.getAnnotation(A)), L = m ? C.filter(m) : C;
696
694
  if (L.length !== 0)
697
695
  return E ? L : L[0];
698
696
  }
699
- const w = (p) => r.getAnnotationRects(p).length > 0 ? r.getAnnotationBounds(p) : void 0, f = (p, S, E, m) => r.getIntersecting(p, S, E, m), x = (p) => r.getAnnotationRects(p), R = () => r.recalculate(), b = (p) => r.on("recalculate", p);
700
- return n.observe(({ changes: p }) => {
701
- const S = (p.deleted || []).filter((a) => I(a.target.selector)), E = (p.created || []).filter((a) => I(a.target.selector)), m = (p.updated || []).filter((a) => I(a.newValue.target.selector));
697
+ const w = (h) => r.getAnnotationRects(h).length > 0 ? r.getAnnotationBounds(h) : void 0, g = (h, S, E, m) => r.getIntersecting(h, S, E, m), x = (h) => r.getAnnotationRects(h), R = () => r.recalculate(), b = (h) => r.on("recalculate", h);
698
+ return n.observe(({ changes: h }) => {
699
+ const S = (h.deleted || []).filter((a) => I(a.target.selector)), E = (h.created || []).filter((a) => I(a.target.selector)), m = (h.updated || []).filter((a) => I(a.newValue.target.selector));
702
700
  S?.length > 0 && S.forEach((a) => r.remove(a.target)), E.length > 0 && r.set(E.map((a) => a.target), !1), m?.length > 0 && m.forEach(({ newValue: a }) => r.update(a.target));
703
701
  }), {
704
702
  store: {
705
703
  ...n,
706
704
  addAnnotation: c,
707
705
  bulkAddAnnotations: l,
708
- bulkUpdateTargets: u,
709
- bulkUpsertAnnotations: g,
706
+ bulkUpdateTargets: d,
707
+ bulkUpsertAnnotations: f,
710
708
  getAnnotationBounds: w,
711
709
  getAnnotationRects: x,
712
- getIntersecting: f,
710
+ getIntersecting: g,
713
711
  getAt: y,
714
712
  recalculatePositions: R,
715
713
  onRecalculatePositions: b,
716
- updateTarget: d
714
+ updateTarget: u
717
715
  },
718
716
  selection: s,
719
717
  hover: o,
720
718
  viewport: i
721
719
  };
722
- }, ae = 300, ye = ["up", "down", "left", "right"], be = ge ? "⌘+a" : "ctrl+a", St = [
723
- ...ye.map((e) => `shift+${e}`),
724
- be
725
- ], At = (e, t, n, r) => {
720
+ }, ce = 300, be = ["up", "down", "left", "right"], Ee = me ? "⌘+a" : "ctrl+a", Et = [
721
+ ...be.map((e) => `shift+${e}`),
722
+ Ee
723
+ ], Ct = (e, t, n, r) => {
726
724
  const { store: s, selection: o } = t;
727
725
  let i;
728
726
  const {
729
727
  annotatingEnabled: c,
730
728
  offsetReferenceSelector: l,
731
- selectionMode: g,
732
- dismissOnNotAnnotatable: d = "NEVER"
729
+ selectionMode: f,
730
+ dismissOnNotAnnotatable: u = "NEVER"
733
731
  } = r;
734
- let u, y = c, w = "CREATE_NEW", f, x, R, b;
735
- const p = (h) => {
736
- y = h, L.clear(), h || (x = void 0, f = void 0, R = void 0, b = void 0);
737
- }, S = (h) => w = h || "CREATE_NEW", E = (h) => u = h, m = (h) => i = h, a = (h) => {
732
+ let d, y = c, w = "CREATE_NEW", g, x, R, b;
733
+ const h = (p) => {
734
+ y = p, L.clear(), p || (x = void 0, g = void 0, R = void 0, b = void 0);
735
+ }, S = (p) => w = p || "CREATE_NEW", E = (p) => d = p, m = (p) => i = p, a = (p) => {
738
736
  if (w === "ADD_TO_CURRENT")
739
737
  return !0;
740
738
  if (r.allowModifierSelect) {
741
- const v = h;
742
- return ge ? v.metaKey : v.ctrlKey;
739
+ const T = p;
740
+ return me ? T.metaKey : T.ctrlKey;
743
741
  } else
744
742
  return !1;
745
743
  }, C = () => {
746
744
  if (!y || R === !1) return;
747
- const { selected: h } = o;
748
- if ((a(b) || w === "REPLACE_CURRENT") && h.length === 1 && h[0].editable) {
749
- const k = s.getAnnotation(h[0].id);
745
+ const { selected: p } = o;
746
+ if ((a(b) || w === "REPLACE_CURRENT") && p.length === 1 && p[0].editable) {
747
+ const k = s.getAnnotation(p[0].id);
750
748
  if (k?.target) {
751
- x = k.target, f = {
749
+ x = k.target, g = {
752
750
  annotation: k.id,
753
751
  selector: [],
754
752
  created: x.created,
@@ -759,227 +757,227 @@ const ue = "not-annotatable", W = `.${ue}`, G = (e, t) => e.contains(t) ? !!(t i
759
757
  return;
760
758
  }
761
759
  }
762
- x = void 0, f = {
763
- annotation: de(),
760
+ x = void 0, g = {
761
+ annotation: ue(),
764
762
  selector: [],
765
763
  created: /* @__PURE__ */ new Date(),
766
764
  creator: i
767
765
  };
768
- }, L = le((h) => {
766
+ }, L = de((p) => {
769
767
  if (!y) return;
770
- const v = document.getSelection();
771
- if (!v?.anchorNode) return;
772
- const k = Array.from(Array(v.rangeCount).keys()).map((B) => v.getRangeAt(B));
773
- if (k.every((B) => !fe(e, B))) {
774
- f = void 0;
768
+ const T = document.getSelection();
769
+ if (!T?.anchorNode) return;
770
+ const k = Array.from(Array(T.rangeCount).keys()).map((B) => T.getRangeAt(B));
771
+ if (k.every((B) => !ge(e, B))) {
772
+ g = void 0;
775
773
  return;
776
774
  }
777
- const U = h.timeStamp - (b?.timeStamp || h.timeStamp);
778
- if (b?.type === "pointerdown" && (U < 1e3 && !f || v.isCollapsed && U < ae) && C(), !f && (C(), !f))
775
+ const U = p.timeStamp - (b?.timeStamp || p.timeStamp);
776
+ if (b?.type === "pointerdown" && (U < 1e3 && !g || T.isCollapsed && U < ce) && C(), !g && (C(), !g))
779
777
  return;
780
- if (v.isCollapsed) {
781
- s.getAnnotation(f.annotation) && !(a(b) || w === "REPLACE_CURRENT") && (o.clear(), s.deleteAnnotation(f.annotation));
778
+ if (T.isCollapsed) {
779
+ s.getAnnotation(g.annotation) && !(a(b) || w === "REPLACE_CURRENT") && (o.clear(), s.deleteAnnotation(g.annotation));
782
780
  return;
783
781
  }
784
- const H = k.map((B) => Qe(B, e));
785
- if (H.every((B) => Ve(B))) return;
786
- const M = H.flatMap((B) => $e(e, B.cloneRange()));
787
- if (!(M.length > 0 && !f || M.length !== f.selector.length || M.some((B, F) => B.toString() !== f.selector[F]?.quote))) return;
788
- const z = a(b) && x ? qe([
782
+ const H = k.map((B) => qe(B, e));
783
+ if (H.every((B) => $e(B))) return;
784
+ const M = H.flatMap((B) => Ke(e, B.cloneRange()));
785
+ if (!(M.length > 0 && !g || M.length !== g.selector.length || M.some((B, V) => B.toString() !== g.selector[V]?.quote))) return;
786
+ const j = a(b) && x ? Xe([
789
787
  ...x.selector.map((B) => B.range),
790
788
  ...M
791
789
  ]) : M;
792
- f = {
793
- ...f,
794
- selector: z.map((B) => je(B, e, l)),
790
+ g = {
791
+ ...g,
792
+ selector: j.map((B) => ze(B, e, l)),
795
793
  updated: /* @__PURE__ */ new Date()
796
- }, !(a(b) || w === "REPLACE_CURRENT") && (s.getAnnotation(f.annotation) ? s.updateTarget(f, K.LOCAL) : o.clear());
797
- }, 10), A = (h) => {
798
- b = J(h), R = b.button === 0;
799
- }, T = async (h) => {
794
+ }, !(a(b) || w === "REPLACE_CURRENT") && (s.getAnnotation(g.annotation) ? s.updateTarget(g, K.LOCAL) : o.clear());
795
+ }, 10), A = (p) => {
796
+ b = J(p), R = b.button === 0;
797
+ }, v = async (p) => {
800
798
  if (!R) return;
801
- const v = J(h), k = () => {
799
+ const T = J(p), k = () => {
802
800
  const { x: H, y: M } = e.getBoundingClientRect();
803
- if (G(e, v.target)) {
804
- (typeof d == "function" ? d(v, e) : d === "ALWAYS") && o.clear();
801
+ if (W(e, T.target)) {
802
+ (typeof u == "function" ? u(T, e) : u === "ALWAYS") && o.clear();
805
803
  return;
806
804
  }
807
- const P = v.target instanceof Node && e.contains(v.target) && s.getAt(
808
- v.clientX - H,
809
- v.clientY - M,
810
- g === "all",
811
- u
805
+ const D = T.target instanceof Node && e.contains(T.target) && s.getAt(
806
+ T.clientX - H,
807
+ T.clientY - M,
808
+ f === "all",
809
+ d
812
810
  );
813
- if (P) {
814
- const { selected: z } = o, B = new Set(z.map((V) => V.id)), F = Array.isArray(P) ? P.map((V) => V.id) : [P.id];
815
- (B.size !== F.length || !F.every((V) => B.has(V))) && (n.emit("clickAnnotation", P), o.userSelect(F, v));
811
+ if (D) {
812
+ const { selected: j } = o, B = new Set(j.map((Y) => Y.id)), V = Array.isArray(D) ? D.map((Y) => Y.id) : [D.id];
813
+ (B.size !== V.length || !V.every((Y) => B.has(Y))) && (n.emit("clickAnnotation", D), o.userSelect(V, T));
816
814
  } else
817
815
  o.clear();
818
816
  };
819
- if (v.timeStamp - b.timeStamp < ae) {
817
+ if (T.timeStamp - b.timeStamp < ce) {
820
818
  await N();
821
- const H = document.getSelection(), M = G(e, b.target), P = G(e, v.target);
822
- if (H?.isCollapsed || M && P) {
823
- f = void 0, k();
819
+ const H = document.getSelection(), M = W(e, b.target), D = W(e, T.target);
820
+ if (H?.isCollapsed || M && D) {
821
+ g = void 0, k();
824
822
  return;
825
823
  }
826
824
  }
827
- f && f.selector.length > 0 && ($(), o.userSelect(f.annotation, v));
825
+ g && g.selector.length > 0 && (F(), o.userSelect(g.annotation, T));
828
826
  }, N = async () => {
829
- const h = document.getSelection();
830
- let v = !1, k = h?.isCollapsed;
831
- const U = () => k || v, H = 1;
832
- return setTimeout(() => v = !0, 50), He(() => k = h?.isCollapsed, H, U);
833
- }, O = (h) => {
834
- document.getSelection()?.isCollapsed || ((!f || f.selector.length === 0) && L(h), f && ($(), o.userSelect(f.annotation, J(h))));
835
- }, D = (h) => {
836
- y && h.key === "Shift" && f && (document.getSelection().isCollapsed || ($(), o.userSelect(f.annotation, j(h))));
837
- }, Y = (h) => {
838
- const v = () => setTimeout(() => {
839
- f?.selector.length > 0 && (o.clear(), s.addAnnotation({
840
- id: f.annotation,
827
+ const p = document.getSelection();
828
+ let T = !1, k = p?.isCollapsed;
829
+ const U = () => k || T, H = 1;
830
+ return setTimeout(() => T = !0, 50), _e(() => k = p?.isCollapsed, H, U);
831
+ }, O = (p) => {
832
+ document.getSelection()?.isCollapsed || ((!g || g.selector.length === 0) && L(p), g && (F(), o.userSelect(g.annotation, J(p))));
833
+ }, P = (p) => {
834
+ y && (p.repeat || p.target instanceof Node && W(e, p.target) && p.target !== document.body || p.key === "Shift" && g && (document.getSelection().isCollapsed || (F(), o.userSelect(g.annotation, G(p)))));
835
+ }, X = (p) => {
836
+ const T = () => setTimeout(() => {
837
+ g?.selector.length > 0 && (o.clear(), s.addAnnotation({
838
+ id: g.annotation,
841
839
  bodies: [],
842
- target: f
843
- }), o.userSelect(f.annotation, j(h))), document.removeEventListener("selectionchange", v);
840
+ target: g
841
+ }), o.userSelect(g.annotation, G(p))), document.removeEventListener("selectionchange", T);
844
842
  }, 100);
845
- document.addEventListener("selectionchange", v), C();
843
+ document.addEventListener("selectionchange", T), C();
846
844
  };
847
- q(St.join(","), { element: e, keydown: !0, keyup: !1 }, (h) => {
848
- h.repeat || (b = j(h));
849
- }), q(be, { keydown: !0, keyup: !1 }, (h) => {
850
- b = j(h), Y(h);
845
+ q(Et.join(","), { element: e, keydown: !0, keyup: !1 }, (p) => {
846
+ p.repeat || (b = G(p));
847
+ }), q(Ee, { keydown: !0, keyup: !1 }, (p) => {
848
+ b = G(p), X(p);
851
849
  });
852
- const X = (h) => {
853
- h.repeat || h.target !== e && h.target !== document.body || (f = void 0, o.clear());
850
+ const z = (p) => {
851
+ p.repeat || p.target instanceof Node && W(e, p.target) && p.target !== document.body || (g = void 0, o.clear());
854
852
  };
855
- q(ye.join(","), { keydown: !0, keyup: !1 }, X);
856
- const $ = () => {
857
- const h = s.getAnnotation(f.annotation);
858
- if (!h)
853
+ q(be.join(","), { keydown: !0, keyup: !1 }, z);
854
+ const F = () => {
855
+ const p = s.getAnnotation(g.annotation);
856
+ if (!p)
859
857
  s.addAnnotation({
860
- id: f.annotation,
858
+ id: g.annotation,
861
859
  bodies: [],
862
- target: f
860
+ target: g
863
861
  });
864
862
  else {
865
- const { target: { updated: v } } = h, { updated: k } = f;
866
- (!v || !k || v < k) && s.updateTarget(f);
863
+ const { target: { updated: T } } = p, { updated: k } = g;
864
+ (!T || !k || T < k) && s.updateTarget(g);
867
865
  }
868
866
  };
869
- return document.addEventListener("pointerdown", A), document.addEventListener("pointerup", T), document.addEventListener("contextmenu", O), e.addEventListener("keyup", D), e.addEventListener("selectstart", C), document.addEventListener("selectionchange", L), {
867
+ return document.addEventListener("pointerdown", A), document.addEventListener("pointerup", v), document.addEventListener("contextmenu", O), document.addEventListener("keyup", P), e.addEventListener("selectstart", C), document.addEventListener("selectionchange", L), {
870
868
  destroy: () => {
871
- f = void 0, x = void 0, R = void 0, b = void 0, L.clear(), document.removeEventListener("pointerdown", A), document.removeEventListener("pointerup", T), document.removeEventListener("contextmenu", O), e.removeEventListener("keyup", D), e.removeEventListener("selectstart", C), document.removeEventListener("selectionchange", L), q.unbind();
869
+ g = void 0, x = void 0, R = void 0, b = void 0, L.clear(), document.removeEventListener("pointerdown", A), document.removeEventListener("pointerup", v), document.removeEventListener("contextmenu", O), document.removeEventListener("keyup", P), e.removeEventListener("selectstart", C), document.removeEventListener("selectionchange", L), q.unbind();
872
870
  },
873
871
  setFilter: E,
874
872
  setUser: m,
875
- setAnnotatingEnabled: p,
873
+ setAnnotatingEnabled: h,
876
874
  setAnnotatingMode: S
877
875
  };
878
- }, wt = (e, t) => ({
876
+ }, St = (e, t) => ({
879
877
  ...e,
880
878
  annotatingEnabled: e.annotatingEnabled ?? t.annotatingEnabled,
881
879
  user: e.user || t.user
882
- }), ce = "SPANS", Kt = (e, t = {}) => {
883
- Pe(e), Ue(e);
884
- const n = wt(t, {
880
+ }), le = "SPANS", Ht = (e, t = {}) => {
881
+ He(e), De(e);
882
+ const n = St(t, {
885
883
  annotatingEnabled: !0,
886
- user: Ne()
887
- }), r = Ct(e, n), { selection: s, viewport: o } = r, i = r.store, c = Oe(i), l = Be(r, c, n.adapter);
888
- let g = n.user;
889
- const d = typeof n.renderer != "function" ? n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ce : n.renderer || ce : null, u = d === null ? n.renderer(e, r, o) : d === "SPANS" ? ft(e, r, o) : d === "CSS_HIGHLIGHTS" ? at(e, r, o) : d === "CANVAS" ? st(e, r, o) : void 0;
890
- if (!u)
884
+ user: Le()
885
+ }), r = bt(e, n), { selection: s, viewport: o } = r, i = r.store, c = Ne(i), l = Oe(r, c, n.adapter);
886
+ let f = n.user;
887
+ const u = typeof n.renderer != "function" ? n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : le : n.renderer || le : null, d = u === null ? n.renderer(e, r, o) : u === "SPANS" ? dt(e, r, o) : u === "CSS_HIGHLIGHTS" ? rt(e, r, o) : u === "CANVAS" ? nt(e, r, o) : void 0;
888
+ if (!d)
891
889
  throw `Unknown renderer implementation: ${n.renderer}`;
892
- console.debug(d ? `Using ${d} renderer` : "Using custom renderer implementation"), n.style && u.setStyle(n.style);
893
- const y = At(e, r, l, n);
894
- y.setUser(g);
895
- const w = ke(r, c, n.adapter), f = () => g, x = (a) => {
890
+ console.debug(u ? `Using ${u} renderer` : "Using custom renderer implementation"), n.style && d.setStyle(n.style);
891
+ const y = Ct(e, r, l, n);
892
+ y.setUser(f);
893
+ const w = Be(r, c, n.adapter), g = () => f, x = (a) => {
896
894
  y.setAnnotatingEnabled(
897
895
  a === void 0 ? !0 : a
898
896
  );
899
897
  }, R = (a) => {
900
898
  y.setAnnotatingMode(a);
901
899
  }, b = (a) => {
902
- u.setFilter(a), y.setFilter(a);
903
- }, p = (a) => {
904
- g = a, y.setUser(a);
900
+ d.setFilter(a), y.setFilter(a);
901
+ }, h = (a) => {
902
+ f = a, y.setUser(a);
905
903
  }, S = (a) => {
906
- a && (u.setPainter(bt(a, n.presence)), a.on("selectionChange", () => u.redraw()));
904
+ a && (d.setPainter(ht(a, n.presence)), a.on("selectionChange", () => d.redraw()));
907
905
  }, E = (a) => {
908
906
  a ? s.setSelected(a) : s.clear();
909
907
  };
910
908
  return {
911
909
  ...w,
912
910
  destroy: () => {
913
- u.destroy(), y.destroy(), c.destroy();
911
+ d.destroy(), y.destroy(), c.destroy();
914
912
  },
915
913
  element: e,
916
- getUser: f,
914
+ getUser: g,
917
915
  setAnnotatingEnabled: x,
918
916
  setAnnotatingMode: R,
919
917
  setFilter: b,
920
- setStyle: u.setStyle.bind(u),
921
- redraw: u.redraw.bind(u),
922
- setUser: p,
918
+ setStyle: d.setStyle.bind(d),
919
+ redraw: d.redraw.bind(d),
920
+ setUser: h,
923
921
  setSelected: E,
924
922
  setPresenceProvider: S,
925
- setVisible: u.setVisible.bind(u),
923
+ setVisible: d.setVisible.bind(d),
926
924
  on: l.on,
927
925
  off: l.off,
928
- scrollIntoView: Ze(e, i),
926
+ scrollIntoView: Ge(e, i),
929
927
  state: r
930
928
  };
931
929
  };
932
930
  export {
933
931
  Z as DEFAULT_SELECTED_STYLE,
934
932
  _ as DEFAULT_STYLE,
935
- ue as NOT_ANNOTATABLE_CLASS,
936
- W as NOT_ANNOTATABLE_SELECTOR,
937
- Ft as Origin,
938
- Vt as UserSelectAction,
939
- Ut as W3CTextFormat,
940
- Pe as cancelSingleClickEvents,
941
- j as cloneKeyboardEvent,
933
+ fe as NOT_ANNOTATABLE_CLASS,
934
+ $ as NOT_ANNOTATABLE_SELECTOR,
935
+ Ut as Origin,
936
+ Kt as UserSelectAction,
937
+ _t as W3CTextFormat,
938
+ He as cancelSingleClickEvents,
939
+ G as cloneKeyboardEvent,
942
940
  J as clonePointerEvent,
943
941
  se as createBaseRenderer,
944
- Yt as createBody,
945
- st as createCanvasRenderer,
946
- at as createHighlightsRenderer,
947
- bt as createPresencePainter,
948
- it as createRenderer,
949
- At as createSelectionHandler,
950
- ft as createSpansRenderer,
951
- Kt as createTextAnnotator,
952
- Ct as createTextAnnotatorState,
942
+ Wt as createBody,
943
+ nt as createCanvasRenderer,
944
+ rt as createHighlightsRenderer,
945
+ ht as createPresencePainter,
946
+ st as createRenderer,
947
+ Ct as createSelectionHandler,
948
+ dt as createSpansRenderer,
949
+ Ht as createTextAnnotator,
950
+ bt as createTextAnnotatorState,
953
951
  ee as debounce,
954
- wt as fillDefaults,
955
- ct as getBackgroundColor,
956
- Ke as getHighlightClientRects,
957
- Fe as getQuoteContext,
952
+ St as fillDefaults,
953
+ it as getBackgroundColor,
954
+ Pe as getHighlightClientRects,
955
+ We as getQuoteContext,
958
956
  oe as getRangeAnnotatableContents,
959
- Je as getViewportBounds,
960
- ge as isMac,
961
- Ht as isNodeWhitespaceOrEmpty,
962
- G as isNotAnnotatable,
963
- fe as isRangeAnnotatable,
964
- Ve as isRangeWhitespaceOrEmpty,
957
+ Qe as getViewportBounds,
958
+ me as isMac,
959
+ kt as isNodeWhitespaceOrEmpty,
960
+ W as isNotAnnotatable,
961
+ ge as isRangeAnnotatable,
962
+ $e as isRangeWhitespaceOrEmpty,
965
963
  I as isRevived,
966
- ze as mergeClientRects,
967
- qe as mergeRanges,
968
- lt as paint,
969
- pt as parseW3CTextAnnotation,
970
- Ue as programmaticallyFocusable,
971
- je as rangeToSelector,
964
+ Ye as mergeClientRects,
965
+ Xe as mergeRanges,
966
+ at as paint,
967
+ gt as parseW3CTextAnnotation,
968
+ De as programmaticallyFocusable,
969
+ ze as rangeToSelector,
972
970
  te as reviveAnnotation,
973
- pe as reviveSelector,
971
+ he as reviveSelector,
974
972
  Q as reviveTarget,
975
- Ze as scrollIntoView,
976
- ht as serializeW3CTextAnnotation,
977
- $e as splitAnnotatableRanges,
978
- Pt as toDomRectList,
979
- Ge as toParentBounds,
980
- Dt as toViewportBounds,
981
- et as trackViewport,
982
- Qe as trimRangeToContainer,
983
- me as whitespaceOrEmptyRegex
973
+ Ge as scrollIntoView,
974
+ mt as serializeW3CTextAnnotation,
975
+ Ke as splitAnnotatableRanges,
976
+ Mt as toDomRectList,
977
+ je as toParentBounds,
978
+ It as toViewportBounds,
979
+ Ze as trackViewport,
980
+ qe as trimRangeToContainer,
981
+ pe as whitespaceOrEmptyRegex
984
982
  };
985
983
  //# sourceMappingURL=text-annotator.es.js.map