@soomo/text-annotator 3.0.0-staging.34 → 3.0.0-staging.36

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.
@@ -4,24 +4,24 @@ const q = {
4
4
  }, gt = {
5
5
  fill: "rgb(0, 128, 255)",
6
6
  fillOpacity: 0.45
7
- }, Se = (e, t, n, o, i) => {
7
+ }, ve = (e, t, n, o, i) => {
8
8
  var s, a;
9
9
  const r = n ? typeof n == "function" ? n(e.annotation, e.state, i) || ((s = e.state) != null && s.selected ? gt : q) : n : (a = e.state) != null && a.selected ? gt : q;
10
10
  return o && o.paint(e, t) || r;
11
- }, ne = "not-annotatable", Y = `.${ne}`, Ce = (e) => {
11
+ }, ne = "not-annotatable", X = `.${ne}`, Ce = (e) => {
12
12
  var n;
13
13
  const t = e.commonAncestorContainer;
14
- return t instanceof HTMLElement ? !t.closest(Y) : !((n = t.parentElement) != null && n.closest(Y));
14
+ return t instanceof HTMLElement ? !t.closest(X) : !((n = t.parentElement) != null && n.closest(X));
15
15
  }, xe = function* (e) {
16
16
  const t = document.createNodeIterator(
17
17
  e.commonAncestorContainer,
18
18
  NodeFilter.SHOW_ELEMENT,
19
- (o) => o instanceof HTMLElement && o.classList.contains(ne) && !o.parentElement.closest(Y) && e.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
19
+ (o) => o instanceof HTMLElement && o.classList.contains(ne) && !o.parentElement.closest(X) && e.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
20
20
  );
21
21
  let n;
22
22
  for (; n = t.nextNode(); )
23
23
  n instanceof HTMLElement && (yield n);
24
- }, Le = (e) => {
24
+ }, Ee = (e) => {
25
25
  if (!Ce(e)) return [];
26
26
  const t = [];
27
27
  let n = null;
@@ -34,22 +34,22 @@ const q = {
34
34
  o.setStartAfter(n), o.collapsed || t.push(o);
35
35
  }
36
36
  return t.length > 0 ? t : [e];
37
- }, Rt = (e) => {
37
+ }, kt = (e) => {
38
38
  const t = e.cloneContents();
39
- return t.querySelectorAll(Y).forEach((n) => n.remove()), t;
40
- }, Ee = (e) => e.addEventListener("click", (t) => {
39
+ return t.querySelectorAll(X).forEach((n) => n.remove()), t;
40
+ }, Le = (e) => e.addEventListener("click", (t) => {
41
41
  // Allow clicks within not-annotatable elements
42
- !t.target.closest(Y) && !t.target.closest("a") && t.preventDefault();
42
+ !t.target.closest(X) && !t.target.closest("a") && t.preventDefault();
43
43
  }), Te = (e) => {
44
44
  !e.hasAttribute("tabindex") && e.tabIndex < 0 && e.setAttribute("tabindex", "-1"), e.classList.add("no-focus-outline");
45
- }, It = (e, t = 10) => {
45
+ }, Nt = (e, t = 10) => {
46
46
  let n;
47
47
  return (...o) => {
48
48
  clearTimeout(n), n = setTimeout(() => e.apply(void 0, o), t);
49
49
  };
50
50
  }, vo = (e) => {
51
51
  const t = e.cloneContents();
52
- return t.querySelectorAll(Y).forEach((n) => n.remove()), t;
52
+ return t.querySelectorAll(X).forEach((n) => n.remove()), t;
53
53
  }, Dt = (e, t) => {
54
54
  const n = document.createNodeIterator(t);
55
55
  let o = 0, i = n.nextNode();
@@ -90,12 +90,12 @@ const q = {
90
90
  l.selectNodeContents(n), l.setStart(n, o);
91
91
  const m = g(l), c = document.createRange();
92
92
  c.selectNode(i), c.setEnd(i, r);
93
- const v = g(c), w = Be(e).reverse().map((p) => {
93
+ const S = g(c), w = Be(e).reverse().map((p) => {
94
94
  var A;
95
95
  const u = document.createElement("SPAN");
96
96
  return (A = p.parentNode) == null || A.insertBefore(u, p), u.appendChild(p), u;
97
97
  });
98
- return { unwrap: f, nodes: [m, ...w, v] };
98
+ return { unwrap: f, nodes: [m, ...w, S] };
99
99
  }
100
100
  }, Be = (e) => {
101
101
  const {
@@ -108,7 +108,7 @@ const q = {
108
108
  for (; r != null; )
109
109
  r === o && (s = !1), s && a.push(r), r === n && (s = !0), r = i.nextNode();
110
110
  return a;
111
- }, So = (e) => {
111
+ }, Co = (e) => {
112
112
  const { startContainer: t, endContainer: n } = e;
113
113
  if (t === n)
114
114
  return Array.from(e.getClientRects());
@@ -116,17 +116,17 @@ const q = {
116
116
  const { unwrap: o, nodes: i } = Me(e), r = i.reduce((s, a) => [...s, ...a.getClientRects()], []);
117
117
  return o(), r;
118
118
  }
119
- }, ke = (e, t, n = 10, o) => {
119
+ }, Re = (e, t, n = 10, o) => {
120
120
  const i = o ? e.startContainer.parentElement.closest(o) : t, r = document.createRange();
121
121
  r.setStart(i, 0), r.setEnd(e.startContainer, e.startOffset);
122
- const s = Rt(r).textContent, a = document.createRange();
122
+ const s = kt(r).textContent, a = document.createRange();
123
123
  a.setStart(e.endContainer, e.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
124
- const d = Rt(a).textContent;
124
+ const d = kt(a).textContent;
125
125
  return {
126
126
  prefix: s.substring(s.length - n),
127
127
  suffix: d.substring(0, n)
128
128
  };
129
- }, Re = /^\s*$/, Ve = (e) => Re.test(e.toString()), W = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), Oe = (e, t) => {
129
+ }, ke = /^\s*$/, Ve = (e) => ke.test(e.toString()), z = (e) => e.every((t) => t.range instanceof Range && !t.range.collapsed), Oe = (e, t) => {
130
130
  const n = (r) => Math.round(r * 10) / 10, o = {
131
131
  top: n(e.top),
132
132
  bottom: n(e.bottom),
@@ -150,17 +150,17 @@ const q = {
150
150
  return "block-contains";
151
151
  } else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
152
152
  return "block-is-contained";
153
- }, Ie = (e, t) => {
153
+ }, Ne = (e, t) => {
154
154
  const n = Math.min(e.left, t.left), o = Math.max(e.right, t.right), i = Math.min(e.top, t.top), r = Math.max(e.bottom, t.bottom);
155
155
  return new DOMRect(n, i, o - n, r - i);
156
- }, Ne = (e) => e.reduce((t, n) => {
156
+ }, Ie = (e) => e.reduce((t, n) => {
157
157
  if (n.width === 0 || n.height === 0)
158
158
  return t;
159
159
  let o = [...t], i = !1;
160
160
  for (const r of t) {
161
161
  const s = Oe(n, r);
162
162
  if (s === "inline-adjacent") {
163
- o = o.map((a) => a === r ? Ie(n, r) : a), i = !0;
163
+ o = o.map((a) => a === r ? Ne(n, r) : a), i = !0;
164
164
  break;
165
165
  } else if (s === "inline-contains") {
166
166
  o = o.map((a) => a === r ? n : a), i = !0;
@@ -174,7 +174,7 @@ const q = {
174
174
  }
175
175
  }
176
176
  return i ? o : [...o, n];
177
- }, []), Co = (e) => ({
177
+ }, []), xo = (e) => ({
178
178
  length: e.length,
179
179
  item: (t) => e[t],
180
180
  [Symbol.iterator]: function* () {
@@ -184,7 +184,7 @@ const q = {
184
184
  }), Fe = (e, t, n) => {
185
185
  const o = document.createRange(), i = n ? e.startContainer.parentElement.closest(n) : t;
186
186
  o.setStart(i, 0), o.setEnd(e.startContainer, e.startOffset);
187
- const r = Rt(o).textContent, s = e.toString(), a = r.length || 0, d = a + s.length;
187
+ const r = kt(o).textContent, s = e.toString(), a = r.length || 0, d = a + s.length;
188
188
  return n ? { quote: s, start: a, end: d, range: e, offsetReference: i } : { quote: s, start: a, end: d, range: e };
189
189
  }, oe = (e, t) => {
190
190
  var g, l;
@@ -193,7 +193,7 @@ const q = {
193
193
  NodeFilter.SHOW_TEXT,
194
194
  (m) => {
195
195
  var c;
196
- return (c = m.parentElement) != null && c.closest(Y) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
196
+ return (c = m.parentElement) != null && c.closest(X) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
197
197
  }
198
198
  );
199
199
  let s = 0;
@@ -224,16 +224,19 @@ const q = {
224
224
  ...e,
225
225
  range: a
226
226
  };
227
- }, mt = (e, t) => W(e.selector) ? e : {
227
+ }, mt = (e, t) => z(e.selector) ? e : {
228
228
  ...e,
229
229
  selector: e.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : oe(n, t))
230
- }, bt = (e, t) => W(e.target.selector) ? e : { ...e, target: mt(e.target, t) }, Pe = (e, t) => {
230
+ }, bt = (e, t) => z(e.target.selector) ? e : { ...e, target: mt(e.target, t) }, Pe = (e, t) => {
231
+ const n = e.cloneRange();
232
+ return t.contains(n.startContainer) || n.setStart(t, 0), t.contains(n.endContainer) || n.setEnd(t, t.childNodes.length), n;
233
+ }, De = (e, t) => {
231
234
  const { left: n, top: o, right: i, bottom: r } = e;
232
235
  return new DOMRect(n - t.left, o - t.top, i - n, r - o);
233
- }, xo = (e, t) => {
236
+ }, Eo = (e, t) => {
234
237
  const { left: n, top: o, right: i, bottom: r } = e;
235
238
  return new DOMRect(n + t.left, o + t.top, i - n, r - o);
236
- }, De = (e) => ({
239
+ }, ye = (e) => ({
237
240
  ...e,
238
241
  type: e.type,
239
242
  x: e.x,
@@ -259,7 +262,7 @@ const q = {
259
262
  pointerId: e.pointerId,
260
263
  pointerType: e.pointerType,
261
264
  timeStamp: e.timeStamp
262
- }), ye = (e) => ({
265
+ }), Ue = (e) => ({
263
266
  ...e,
264
267
  type: e.type,
265
268
  key: e.key,
@@ -275,95 +278,95 @@ const q = {
275
278
  defaultPrevented: e.defaultPrevented,
276
279
  detail: e.detail,
277
280
  timeStamp: e.timeStamp
278
- }), Ue = (e) => {
281
+ }), He = (e) => {
279
282
  const { top: t, left: n } = e.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, s = -t, a = o - n, d = i - t;
280
283
  return { top: t, left: n, minX: r, minY: s, maxX: a, maxY: d };
281
- }, He = (e) => {
284
+ }, _e = (e) => {
282
285
  let t = /* @__PURE__ */ new Set();
283
286
  return (o) => {
284
287
  const i = o.map((r) => r.id);
285
288
  (t.size !== i.length || i.some((r) => !t.has(r))) && e.set(i), t = new Set(i);
286
289
  };
287
- }, Nt = (e, t, n, o) => {
290
+ }, It = (e, t, n, o) => {
288
291
  const { store: i, selection: r, hover: s } = t;
289
292
  let a, d, f;
290
- const g = He(n), l = (T) => {
291
- const { x: k, y: b } = e.getBoundingClientRect(), S = i.getAt(T.clientX - k, T.clientY - b, d);
292
- S ? s.current !== S.id && (e.classList.add("hovered"), s.set(S.id)) : s.current && (e.classList.remove("hovered"), s.set(null));
293
+ const g = _e(n), l = (T) => {
294
+ const { x: M, y: b } = e.getBoundingClientRect(), C = i.getAt(T.clientX - M, T.clientY - b, d);
295
+ C ? s.current !== C.id && (e.classList.add("hovered"), s.set(C.id)) : s.current && (e.classList.remove("hovered"), s.set(null));
293
296
  };
294
297
  e.addEventListener("pointermove", l);
295
298
  const m = (T = !1) => {
296
299
  f && f.clear();
297
- const k = Ue(e), { minX: b, minY: S, maxX: x, maxY: E } = k, B = d ? i.getIntersecting(b, S, x, E).filter(({ annotation: $ }) => d($)) : i.getIntersecting(b, S, x, E), N = r.selected.map(({ id: $ }) => $), z = B.map(({ annotation: $, rects: we }) => {
298
- const Ae = N.includes($.id), ve = $.id === s.current;
299
- return { annotation: $, rects: we, state: { selected: Ae, hover: ve } };
300
+ const M = He(e), { minX: b, minY: C, maxX: x, maxY: L } = M, R = d ? i.getIntersecting(b, C, x, L).filter(({ annotation: j }) => d(j)) : i.getIntersecting(b, C, x, L), I = r.selected.map(({ id: j }) => j), _ = R.map(({ annotation: j, rects: we }) => {
301
+ const Ae = I.includes(j.id), Se = j.id === s.current;
302
+ return { annotation: j, rects: we, state: { selected: Ae, hover: Se } };
300
303
  });
301
- o.redraw(z, k, a, f, T), setTimeout(() => g(B.map(({ annotation: $ }) => $)), 1);
304
+ o.redraw(_, M, a, f, T), setTimeout(() => g(R.map(({ annotation: j }) => j)), 1);
302
305
  }, c = (T) => {
303
306
  f = T, m();
304
- }, v = (T) => {
307
+ }, S = (T) => {
305
308
  a = T, m();
306
- }, C = (T) => {
309
+ }, v = (T) => {
307
310
  d = T, m(!1);
308
311
  }, w = () => m();
309
312
  i.observe(w);
310
313
  const p = r.subscribe(() => m()), u = () => m(!0);
311
314
  document.addEventListener("scroll", u, { capture: !0, passive: !0 });
312
- const A = It(() => {
315
+ const A = Nt(() => {
313
316
  i.recalculatePositions(), f && f.reset(), m();
314
317
  });
315
318
  window.addEventListener("resize", A);
316
319
  const h = new ResizeObserver(A);
317
320
  h.observe(e);
318
- const L = { attributes: !0, childList: !0, subtree: !0 }, M = new MutationObserver((T) => {
321
+ const E = { attributes: !0, childList: !0, subtree: !0 }, B = new MutationObserver((T) => {
319
322
  T.every((b) => b.target === e || e.contains(b.target)) || m(!0);
320
323
  });
321
- return M.observe(document.body, L), {
324
+ return B.observe(document.body, E), {
322
325
  destroy: () => {
323
- e.removeEventListener("pointermove", l), o.destroy(), i.unobserve(w), p(), document.removeEventListener("scroll", u), window.removeEventListener("resize", A), h.disconnect(), M.disconnect();
326
+ e.removeEventListener("pointermove", l), o.destroy(), i.unobserve(w), p(), document.removeEventListener("scroll", u), window.removeEventListener("resize", A), h.disconnect(), B.disconnect();
324
327
  },
325
328
  redraw: m,
326
- setStyle: v,
327
- setFilter: C,
329
+ setStyle: S,
330
+ setFilter: v,
328
331
  setPainter: c,
329
332
  setVisible: o.setVisible
330
333
  };
331
- }, _e = () => {
334
+ }, Ye = () => {
332
335
  const e = document.createElement("canvas");
333
336
  return e.width = window.innerWidth, e.height = window.innerHeight, e.className = "r6o-canvas-highlight-layer bg", e;
334
- }, Ye = (e, t) => {
337
+ }, Xe = (e, t) => {
335
338
  e.width = window.innerWidth, e.height = window.innerHeight;
336
- }, Xe = (e) => {
339
+ }, $e = (e) => {
337
340
  e.classList.add("r6o-annotatable");
338
- const t = _e(), n = t.getContext("2d");
341
+ const t = Ye(), n = t.getContext("2d");
339
342
  document.body.appendChild(t);
340
343
  const o = (a, d, f, g) => requestAnimationFrame(() => {
341
344
  const { width: l, height: m } = t;
342
345
  n.clearRect(-0.5, -0.5, l + 1, m + 1), g && g.clear();
343
- const { top: c, left: v } = d;
346
+ const { top: c, left: S } = d;
344
347
  [...a].sort((w, p) => {
345
348
  const { annotation: { target: { created: u } } } = w, { annotation: { target: { created: A } } } = p;
346
349
  return u.getTime() - A.getTime();
347
350
  }).forEach((w) => {
348
351
  var h;
349
- const p = f ? typeof f == "function" ? f(w.annotation, w.state) : f : (h = w.state) != null && h.selected ? gt : q, u = g && g.paint(w, d) || p, A = w.rects.map(({ x: L, y: M, width: R, height: T }) => ({
350
- x: L + v,
351
- y: M + c,
352
- width: R,
352
+ const p = f ? typeof f == "function" ? f(w.annotation, w.state) : f : (h = w.state) != null && h.selected ? gt : q, u = g && g.paint(w, d) || p, A = w.rects.map(({ x: E, y: B, width: k, height: T }) => ({
353
+ x: E + S,
354
+ y: B + c,
355
+ width: k,
353
356
  height: T
354
357
  }));
355
358
  if (n.fillStyle = u.fill, n.globalAlpha = u.fillOpacity || 1, A.forEach(
356
- ({ x: L, y: M, width: R, height: T }) => n.fillRect(L, M, R, T)
359
+ ({ x: E, y: B, width: k, height: T }) => n.fillRect(E, B, k, T)
357
360
  ), u.underlineColor) {
358
361
  n.globalAlpha = 1, n.strokeStyle = u.underlineColor, n.lineWidth = u.underlineThickness ?? 1;
359
- const L = u.underlineOffset ?? 0;
360
- A.forEach(({ x: M, y: R, width: T, height: k }) => {
361
- n.beginPath(), n.moveTo(M, R + k + L), n.lineTo(M + T, R + k + L), n.stroke();
362
+ const E = u.underlineOffset ?? 0;
363
+ A.forEach(({ x: B, y: k, width: T, height: M }) => {
364
+ n.beginPath(), n.moveTo(B, k + M + E), n.lineTo(B + T, k + M + E), n.stroke();
362
365
  });
363
366
  }
364
367
  });
365
- }), i = It(() => {
366
- Ye(t);
368
+ }), i = Nt(() => {
369
+ Xe(t);
367
370
  });
368
371
  return window.addEventListener("resize", i), {
369
372
  destroy: () => {
@@ -374,8 +377,8 @@ const q = {
374
377
  },
375
378
  redraw: o
376
379
  };
377
- }, $e = (e, t, n) => Nt(e, t, n, Xe(e));
378
- var je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(e) {
380
+ }, je = (e, t, n) => It(e, t, n, $e(e));
381
+ var Ge = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, G = function(e) {
379
382
  return typeof e == "string" ? e.length > 0 : typeof e == "number";
380
383
  }, F = function(e, t, n) {
381
384
  return t === void 0 && (t = 0), n === void 0 && (n = Math.pow(10, t)), Math.round(n * e) / n + 0;
@@ -387,7 +390,7 @@ var je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(e) {
387
390
  return { r: H(e.r, 0, 255), g: H(e.g, 0, 255), b: H(e.b, 0, 255), a: H(e.a) };
388
391
  }, wt = function(e) {
389
392
  return { r: F(e.r), g: F(e.g), b: F(e.b), a: F(e.a, 3) };
390
- }, Ge = /^#([0-9a-f]{3,8})$/i, ct = function(e) {
393
+ }, We = /^#([0-9a-f]{3,8})$/i, ct = function(e) {
391
394
  var t = e.toString(16);
392
395
  return t.length < 2 ? "0" + t : t;
393
396
  }, re = function(e) {
@@ -408,28 +411,28 @@ var je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(e) {
408
411
  }, it = function(e) {
409
412
  return { h: (t = re(e)).h, s: (i = (200 - (n = t.s)) * (o = t.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: t.a };
410
413
  var t, n, o, i;
411
- }, We = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ze = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, qe = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ze = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Xt = { string: [[function(e) {
412
- var t = Ge.exec(e);
414
+ }, ze = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, qe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ze = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Je = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Xt = { string: [[function(e) {
415
+ var t = We.exec(e);
413
416
  return t ? (e = t[1]).length <= 4 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: e.length === 4 ? F(parseInt(e[3] + e[3], 16) / 255, 2) : 1 } : e.length === 6 || e.length === 8 ? { r: parseInt(e.substr(0, 2), 16), g: parseInt(e.substr(2, 2), 16), b: parseInt(e.substr(4, 2), 16), a: e.length === 8 ? F(parseInt(e.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
414
417
  }, "hex"], [function(e) {
415
- var t = qe.exec(e) || Ze.exec(e);
418
+ var t = Ze.exec(e) || Je.exec(e);
416
419
  return t ? t[2] !== t[4] || t[4] !== t[6] ? null : Ut({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: t[7] === void 0 ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
417
420
  }, "rgb"], [function(e) {
418
- var t = We.exec(e) || ze.exec(e);
421
+ var t = ze.exec(e) || qe.exec(e);
419
422
  if (!t) return null;
420
- var n, o, i = Ht({ h: (n = t[1], o = t[2], o === void 0 && (o = "deg"), Number(n) * (je[o] || 1)), s: Number(t[3]), l: Number(t[4]), a: t[5] === void 0 ? 1 : Number(t[5]) / (t[6] ? 100 : 1) });
423
+ var n, o, i = Ht({ h: (n = t[1], o = t[2], o === void 0 && (o = "deg"), Number(n) * (Ge[o] || 1)), s: Number(t[3]), l: Number(t[4]), a: t[5] === void 0 ? 1 : Number(t[5]) / (t[6] ? 100 : 1) });
421
424
  return Yt(i);
422
425
  }, "hsl"]], object: [[function(e) {
423
426
  var t = e.r, n = e.g, o = e.b, i = e.a, r = i === void 0 ? 1 : i;
424
- return j(t) && j(n) && j(o) ? Ut({ r: Number(t), g: Number(n), b: Number(o), a: Number(r) }) : null;
427
+ return G(t) && G(n) && G(o) ? Ut({ r: Number(t), g: Number(n), b: Number(o), a: Number(r) }) : null;
425
428
  }, "rgb"], [function(e) {
426
429
  var t = e.h, n = e.s, o = e.l, i = e.a, r = i === void 0 ? 1 : i;
427
- if (!j(t) || !j(n) || !j(o)) return null;
430
+ if (!G(t) || !G(n) || !G(o)) return null;
428
431
  var s = Ht({ h: Number(t), s: Number(n), l: Number(o), a: Number(r) });
429
432
  return Yt(s);
430
433
  }, "hsl"], [function(e) {
431
434
  var t = e.h, n = e.s, o = e.v, i = e.a, r = i === void 0 ? 1 : i;
432
- if (!j(t) || !j(n) || !j(o)) return null;
435
+ if (!G(t) || !G(n) || !G(o)) return null;
433
436
  var s = function(a) {
434
437
  return { h: ie(a.h), s: H(a.s, 0, 100), v: H(a.v, 0, 100), a: H(a.a) };
435
438
  }({ h: Number(t), s: Number(n), v: Number(o), a: Number(r) });
@@ -440,28 +443,28 @@ var je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(e) {
440
443
  if (o) return [o, t[n][1]];
441
444
  }
442
445
  return [null, void 0];
443
- }, Je = function(e) {
446
+ }, Qe = function(e) {
444
447
  return typeof e == "string" ? $t(e.trim(), Xt.string) : typeof e == "object" && e !== null ? $t(e, Xt.object) : [null, void 0];
445
448
  }, At = function(e, t) {
446
449
  var n = it(e);
447
450
  return { h: n.h, s: H(n.s + 100 * t, 0, 100), l: n.l, a: n.a };
448
- }, vt = function(e) {
451
+ }, St = function(e) {
449
452
  return (299 * e.r + 587 * e.g + 114 * e.b) / 1e3 / 255;
450
453
  }, jt = function(e, t) {
451
454
  var n = it(e);
452
455
  return { h: n.h, s: n.s, l: H(n.l + 100 * t, 0, 100), a: n.a };
453
456
  }, Gt = function() {
454
457
  function e(t) {
455
- this.parsed = Je(t)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
458
+ this.parsed = Qe(t)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
456
459
  }
457
460
  return e.prototype.isValid = function() {
458
461
  return this.parsed !== null;
459
462
  }, e.prototype.brightness = function() {
460
- return F(vt(this.rgba), 2);
463
+ return F(St(this.rgba), 2);
461
464
  }, e.prototype.isDark = function() {
462
- return vt(this.rgba) < 0.5;
465
+ return St(this.rgba) < 0.5;
463
466
  }, e.prototype.isLight = function() {
464
- return vt(this.rgba) >= 0.5;
467
+ return St(this.rgba) >= 0.5;
465
468
  }, e.prototype.toHex = function() {
466
469
  return t = wt(this.rgba), n = t.r, o = t.g, i = t.b, s = (r = t.a) < 1 ? ct(F(255 * r)) : "", "#" + ct(n) + ct(o) + ct(i) + s;
467
470
  var t, n, o, i, r, s;
@@ -479,39 +482,39 @@ var je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(e) {
479
482
  return t = re(this.rgba), { h: F(t.h), s: F(t.s), v: F(t.v), a: F(t.a, 3) };
480
483
  var t;
481
484
  }, e.prototype.invert = function() {
482
- return _({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
485
+ return Y({ r: 255 - (t = this.rgba).r, g: 255 - t.g, b: 255 - t.b, a: t.a });
483
486
  var t;
484
487
  }, e.prototype.saturate = function(t) {
485
- return t === void 0 && (t = 0.1), _(At(this.rgba, t));
488
+ return t === void 0 && (t = 0.1), Y(At(this.rgba, t));
486
489
  }, e.prototype.desaturate = function(t) {
487
- return t === void 0 && (t = 0.1), _(At(this.rgba, -t));
490
+ return t === void 0 && (t = 0.1), Y(At(this.rgba, -t));
488
491
  }, e.prototype.grayscale = function() {
489
- return _(At(this.rgba, -1));
492
+ return Y(At(this.rgba, -1));
490
493
  }, e.prototype.lighten = function(t) {
491
- return t === void 0 && (t = 0.1), _(jt(this.rgba, t));
494
+ return t === void 0 && (t = 0.1), Y(jt(this.rgba, t));
492
495
  }, e.prototype.darken = function(t) {
493
- return t === void 0 && (t = 0.1), _(jt(this.rgba, -t));
496
+ return t === void 0 && (t = 0.1), Y(jt(this.rgba, -t));
494
497
  }, e.prototype.rotate = function(t) {
495
498
  return t === void 0 && (t = 15), this.hue(this.hue() + t);
496
499
  }, e.prototype.alpha = function(t) {
497
- return typeof t == "number" ? _({ r: (n = this.rgba).r, g: n.g, b: n.b, a: t }) : F(this.rgba.a, 3);
500
+ return typeof t == "number" ? Y({ r: (n = this.rgba).r, g: n.g, b: n.b, a: t }) : F(this.rgba.a, 3);
498
501
  var n;
499
502
  }, e.prototype.hue = function(t) {
500
503
  var n = it(this.rgba);
501
- return typeof t == "number" ? _({ h: t, s: n.s, l: n.l, a: n.a }) : F(n.h);
504
+ return typeof t == "number" ? Y({ h: t, s: n.s, l: n.l, a: n.a }) : F(n.h);
502
505
  }, e.prototype.isEqual = function(t) {
503
- return this.toHex() === _(t).toHex();
506
+ return this.toHex() === Y(t).toHex();
504
507
  }, e;
505
- }(), _ = function(e) {
508
+ }(), Y = function(e) {
506
509
  return e instanceof Gt ? e : new Gt(e);
507
510
  };
508
- const Qe = (e) => [
509
- `background-color:${_((e == null ? void 0 : e.fill) || q.fill).alpha((e == null ? void 0 : e.fillOpacity) === void 0 ? q.fillOpacity : e.fillOpacity).toHex()}`,
511
+ const Ke = (e) => [
512
+ `background-color:${Y((e == null ? void 0 : e.fill) || q.fill).alpha((e == null ? void 0 : e.fillOpacity) === void 0 ? q.fillOpacity : e.fillOpacity).toHex()}`,
510
513
  e != null && e.underlineThickness ? "text-decoration:underline" : void 0,
511
514
  e != null && e.underlineColor ? `text-decoration-color:${e.underlineColor}` : void 0,
512
515
  e != null && e.underlineOffset ? `text-underline-offset:${e.underlineOffset}px` : void 0,
513
516
  e != null && e.underlineThickness ? `text-decoration-thickness:${e.underlineThickness}px` : void 0
514
- ].filter(Boolean).join(";"), Ke = () => {
517
+ ].filter(Boolean).join(";"), tn = () => {
515
518
  const e = document.createElement("style");
516
519
  document.getElementsByTagName("head")[0].appendChild(e);
517
520
  let t = /* @__PURE__ */ new Set();
@@ -527,18 +530,18 @@ const Qe = (e) => [
527
530
  const f = new Set(r.map((l) => l.annotation.id));
528
531
  Array.from(t).filter((l) => !f.has(l));
529
532
  const g = r.map((l) => {
530
- var v;
531
- const m = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (v = l.state) != null && v.selected ? gt : q, c = d && d.paint(l, s) || m;
532
- return `::highlight(_${l.annotation.id}) { ${Qe(c)} }`;
533
+ var S;
534
+ const m = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (S = l.state) != null && S.selected ? gt : q, c = d && d.paint(l, s) || m;
535
+ return `::highlight(_${l.annotation.id}) { ${Ke(c)} }`;
533
536
  });
534
537
  e.innerHTML = g.join(`
535
538
  `), CSS.highlights.clear(), r.forEach(({ annotation: l }) => {
536
- const m = l.target.selector.map((v) => v.range), c = new Highlight(...m);
539
+ const m = l.target.selector.map((S) => S.range), c = new Highlight(...m);
537
540
  CSS.highlights.set(`_${l.id}`, c);
538
541
  }), t = f;
539
542
  }
540
543
  };
541
- }, tn = (e, t, n) => Nt(e, t, n, Ke());
544
+ }, en = (e, t, n) => It(e, t, n, tn());
542
545
  var Wt = Object.prototype.hasOwnProperty;
543
546
  function Vt(e, t) {
544
547
  var n, o;
@@ -560,10 +563,10 @@ function Vt(e, t) {
560
563
  }
561
564
  return e !== e && t !== t;
562
565
  }
563
- const en = (e, t) => {
566
+ const nn = (e, t) => {
564
567
  const n = (r, s) => r.x <= s.x + s.width && r.x + r.width >= s.x && r.y <= s.y + s.height && r.y + r.height >= s.y, o = (r) => r.rects.reduce((s, a) => s + a.width, 0), i = t.filter(({ rects: r }) => r.some((s) => n(e, s)));
565
568
  return i.sort((r, s) => o(s) - o(r)), i.findIndex((r) => r.rects.includes(e));
566
- }, nn = (e) => {
569
+ }, on = (e) => {
567
570
  e.classList.add("r6o-annotatable");
568
571
  const t = document.createElement("div");
569
572
  t.className = "r6o-span-highlight-layer", e.insertBefore(t, e.firstChild);
@@ -575,11 +578,11 @@ const en = (e, t) => {
575
578
  redraw: (s, a, d, f, g) => {
576
579
  const m = !(Vt(n, s) && g);
577
580
  !f && !m || (m && (t.innerHTML = ""), s.forEach((c) => {
578
- c.rects.map((v) => {
579
- const C = en(v, s), w = Se(c, a, d, f, C);
581
+ c.rects.map((S) => {
582
+ const v = nn(S, s), w = ve(c, a, d, f, v);
580
583
  if (m) {
581
584
  const p = document.createElement("span");
582
- p.className = "r6o-annotation", p.dataset.annotation = c.annotation.id, p.style.left = `${v.x}px`, p.style.top = `${v.y}px`, p.style.width = `${v.width}px`, p.style.height = `${v.height}px`, p.style.backgroundColor = _((w == null ? void 0 : w.fill) || q.fill).alpha((w == null ? void 0 : w.fillOpacity) === void 0 ? q.fillOpacity : w.fillOpacity).toHex(), w.underlineStyle && (p.style.borderStyle = w.underlineStyle), w.underlineColor && (p.style.borderColor = w.underlineColor), w.underlineThickness && (p.style.borderBottomWidth = `${w.underlineThickness}px`), w.underlineOffset && (p.style.paddingBottom = `${w.underlineOffset}px`), t.appendChild(p);
585
+ p.className = "r6o-annotation", p.dataset.annotation = c.annotation.id, p.style.left = `${S.x}px`, p.style.top = `${S.y}px`, p.style.width = `${S.width}px`, p.style.height = `${S.height}px`, p.style.backgroundColor = Y((w == null ? void 0 : w.fill) || q.fill).alpha((w == null ? void 0 : w.fillOpacity) === void 0 ? q.fillOpacity : w.fillOpacity).toHex(), w.underlineStyle && (p.style.borderStyle = w.underlineStyle), w.underlineColor && (p.style.borderColor = w.underlineColor), w.underlineThickness && (p.style.borderBottomWidth = `${w.underlineThickness}px`), w.underlineOffset && (p.style.paddingBottom = `${w.underlineOffset}px`), t.appendChild(p);
583
586
  }
584
587
  });
585
588
  }), n = s);
@@ -588,29 +591,29 @@ const en = (e, t) => {
588
591
  s ? t.classList.remove("hidden") : t.classList.add("hidden");
589
592
  }
590
593
  };
591
- }, on = (e, t, n) => Nt(e, t, n, nn(e));
594
+ }, rn = (e, t, n) => It(e, t, n, on(e));
592
595
  var P = [];
593
- for (var St = 0; St < 256; ++St)
594
- P.push((St + 256).toString(16).slice(1));
595
- function rn(e, t = 0) {
596
+ for (var vt = 0; vt < 256; ++vt)
597
+ P.push((vt + 256).toString(16).slice(1));
598
+ function an(e, t = 0) {
596
599
  return (P[e[t + 0]] + P[e[t + 1]] + P[e[t + 2]] + P[e[t + 3]] + "-" + P[e[t + 4]] + P[e[t + 5]] + "-" + P[e[t + 6]] + P[e[t + 7]] + "-" + P[e[t + 8]] + P[e[t + 9]] + "-" + P[e[t + 10]] + P[e[t + 11]] + P[e[t + 12]] + P[e[t + 13]] + P[e[t + 14]] + P[e[t + 15]]).toLowerCase();
597
600
  }
598
- var dt, an = new Uint8Array(16);
599
- function sn() {
601
+ var dt, sn = new Uint8Array(16);
602
+ function ln() {
600
603
  if (!dt && (dt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !dt))
601
604
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
602
- return dt(an);
605
+ return dt(sn);
603
606
  }
604
- var ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
607
+ var cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
605
608
  const zt = {
606
- randomUUID: ln
609
+ randomUUID: cn
607
610
  };
608
611
  function se(e, t, n) {
609
612
  if (zt.randomUUID && !t && !e)
610
613
  return zt.randomUUID();
611
614
  e = e || {};
612
- var o = e.random || (e.rng || sn)();
613
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, rn(o);
615
+ var o = e.random || (e.rng || ln)();
616
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, an(o);
614
617
  }
615
618
  var qt = Object.prototype.hasOwnProperty;
616
619
  function K(e, t) {
@@ -635,7 +638,7 @@ function K(e, t) {
635
638
  }
636
639
  function Ct() {
637
640
  }
638
- function cn(e, t) {
641
+ function dn(e, t) {
639
642
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
640
643
  }
641
644
  const Z = [];
@@ -643,7 +646,7 @@ function Ft(e, t = Ct) {
643
646
  let n;
644
647
  const o = /* @__PURE__ */ new Set();
645
648
  function i(a) {
646
- if (cn(e, a) && (e = a, n)) {
649
+ if (dn(e, a) && (e = a, n)) {
647
650
  const d = !Z.length;
648
651
  for (const f of o)
649
652
  f[1](), Z.push(f, e);
@@ -665,7 +668,7 @@ function Ft(e, t = Ct) {
665
668
  }
666
669
  return { set: i, update: r, subscribe: s };
667
670
  }
668
- const dn = (e) => {
671
+ const un = (e) => {
669
672
  const { subscribe: t, set: n } = Ft();
670
673
  let o;
671
674
  return t((i) => o = i), e.observe(({ changes: i }) => {
@@ -682,8 +685,8 @@ const dn = (e) => {
682
685
  set: n
683
686
  };
684
687
  };
685
- var un = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(un || {});
686
- const xt = { selected: [] }, fn = (e, t = "EDIT") => {
688
+ var fn = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(fn || {});
689
+ const xt = { selected: [] }, pn = (e, t = "EDIT") => {
687
690
  const { subscribe: n, set: o } = Ft(xt);
688
691
  let i = t, r = xt;
689
692
  n((c) => r = c);
@@ -693,40 +696,40 @@ const xt = { selected: [] }, fn = (e, t = "EDIT") => {
693
696
  }, d = (c) => {
694
697
  if (a())
695
698
  return !1;
696
- const v = typeof c == "string" ? c : c.id;
697
- return r.selected.some((C) => C.id === v);
698
- }, f = (c, v) => {
699
- const C = e.getAnnotation(c);
700
- if (!C) {
699
+ const S = typeof c == "string" ? c : c.id;
700
+ return r.selected.some((v) => v.id === S);
701
+ }, f = (c, S) => {
702
+ const v = e.getAnnotation(c);
703
+ if (!v) {
701
704
  console.warn("Invalid selection: " + c);
702
705
  return;
703
706
  }
704
- switch (Zt(C, i)) {
707
+ switch (Zt(v, i)) {
705
708
  case "EDIT":
706
- o({ selected: [{ id: c, editable: !0 }], event: v });
709
+ o({ selected: [{ id: c, editable: !0 }], event: S });
707
710
  break;
708
711
  case "SELECT":
709
- o({ selected: [{ id: c }], event: v });
712
+ o({ selected: [{ id: c }], event: S });
710
713
  break;
711
714
  default:
712
- o({ selected: [], event: v });
715
+ o({ selected: [], event: S });
713
716
  }
714
- }, g = (c, v) => {
715
- const C = Array.isArray(c) ? c : [c], w = C.map((p) => e.getAnnotation(p)).filter((p) => !!p);
717
+ }, g = (c, S) => {
718
+ const v = Array.isArray(c) ? c : [c], w = v.map((p) => e.getAnnotation(p)).filter((p) => !!p);
716
719
  o({
717
720
  selected: w.map((p) => {
718
- const u = v === void 0 ? Zt(p, i) === "EDIT" : v;
721
+ const u = S === void 0 ? Zt(p, i) === "EDIT" : S;
719
722
  return { id: p.id, editable: u };
720
723
  })
721
- }), w.length !== C.length && console.warn("Invalid selection", c);
724
+ }), w.length !== v.length && console.warn("Invalid selection", c);
722
725
  }, l = (c) => {
723
726
  if (a())
724
727
  return !1;
725
- const { selected: v } = r;
726
- v.some(({ id: C }) => c.includes(C)) && o({ selected: v.filter(({ id: C }) => !c.includes(C)) });
728
+ const { selected: S } = r;
729
+ S.some(({ id: v }) => c.includes(v)) && o({ selected: S.filter(({ id: v }) => !c.includes(v)) });
727
730
  }, m = (c) => i = c;
728
731
  return e.observe(
729
- ({ changes: c }) => l((c.deleted || []).map((v) => v.id))
732
+ ({ changes: c }) => l((c.deleted || []).map((S) => S.id))
730
733
  ), {
731
734
  get event() {
732
735
  return r ? r.event : null;
@@ -744,56 +747,56 @@ const xt = { selected: [] }, fn = (e, t = "EDIT") => {
744
747
  };
745
748
  }, Zt = (e, t) => typeof t == "function" ? t(e) : t || "EDIT";
746
749
  var D = [];
747
- for (var Lt = 0; Lt < 256; ++Lt)
748
- D.push((Lt + 256).toString(16).slice(1));
749
- function pn(e, t = 0) {
750
+ for (var Et = 0; Et < 256; ++Et)
751
+ D.push((Et + 256).toString(16).slice(1));
752
+ function hn(e, t = 0) {
750
753
  return (D[e[t + 0]] + D[e[t + 1]] + D[e[t + 2]] + D[e[t + 3]] + "-" + D[e[t + 4]] + D[e[t + 5]] + "-" + D[e[t + 6]] + D[e[t + 7]] + "-" + D[e[t + 8]] + D[e[t + 9]] + "-" + D[e[t + 10]] + D[e[t + 11]] + D[e[t + 12]] + D[e[t + 13]] + D[e[t + 14]] + D[e[t + 15]]).toLowerCase();
751
754
  }
752
- var ut, hn = new Uint8Array(16);
753
- function gn() {
755
+ var ut, gn = new Uint8Array(16);
756
+ function mn() {
754
757
  if (!ut && (ut = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ut))
755
758
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
756
- return ut(hn);
759
+ return ut(gn);
757
760
  }
758
- var mn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
761
+ var bn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
759
762
  const Jt = {
760
- randomUUID: mn
763
+ randomUUID: bn
761
764
  };
762
- function bn(e, t, n) {
765
+ function wn(e, t, n) {
763
766
  if (Jt.randomUUID && !t && !e)
764
767
  return Jt.randomUUID();
765
768
  e = e || {};
766
- var o = e.random || (e.rng || gn)();
767
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, pn(o);
769
+ var o = e.random || (e.rng || mn)();
770
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, hn(o);
768
771
  }
769
772
  const Lo = (e, t, n, o) => ({
770
- id: bn(),
773
+ id: wn(),
771
774
  annotation: typeof e == "string" ? e : e.id,
772
775
  created: n || /* @__PURE__ */ new Date(),
773
776
  creator: o,
774
777
  ...t
775
- }), wn = (e, t) => {
778
+ }), An = (e, t) => {
776
779
  const n = new Set(e.bodies.map((o) => o.id));
777
780
  return t.bodies.filter((o) => !n.has(o.id));
778
- }, An = (e, t) => {
781
+ }, Sn = (e, t) => {
779
782
  const n = new Set(t.bodies.map((o) => o.id));
780
783
  return e.bodies.filter((o) => !n.has(o.id));
781
784
  }, vn = (e, t) => t.bodies.map((n) => {
782
785
  const o = e.bodies.find((i) => i.id === n.id);
783
786
  return { newBody: n, oldBody: o && !K(o, n) ? o : void 0 };
784
- }).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Sn = (e, t) => !K(e.target, t.target), le = (e, t) => {
785
- const n = wn(e, t), o = An(e, t), i = vn(e, t);
787
+ }).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Cn = (e, t) => !K(e.target, t.target), le = (e, t) => {
788
+ const n = An(e, t), o = Sn(e, t), i = vn(e, t);
786
789
  return {
787
790
  oldValue: e,
788
791
  newValue: t,
789
792
  bodiesCreated: n.length > 0 ? n : void 0,
790
793
  bodiesDeleted: o.length > 0 ? o : void 0,
791
794
  bodiesUpdated: i.length > 0 ? i : void 0,
792
- targetUpdated: Sn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
795
+ targetUpdated: Cn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
793
796
  };
794
797
  };
795
798
  var V = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(V || {});
796
- const Cn = (e, t) => {
799
+ const xn = (e, t) => {
797
800
  var n, o;
798
801
  const { changes: i, origin: r } = t;
799
802
  if (!(!e.options.origin || e.options.origin === r))
@@ -815,7 +818,7 @@ const Cn = (e, t) => {
815
818
  return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((a) => s.has(a));
816
819
  } else
817
820
  return !0;
818
- }, xn = (e, t) => {
821
+ }, En = (e, t) => {
819
822
  const n = new Set((e.created || []).map((l) => l.id)), o = new Set((e.updated || []).map(({ newValue: l }) => l.id)), i = new Set((t.created || []).map((l) => l.id)), r = new Set((t.deleted || []).map((l) => l.id)), s = new Set((t.updated || []).map(({ oldValue: l }) => l.id)), a = new Set((t.updated || []).filter(({ oldValue: l }) => n.has(l.id) || o.has(l.id)).map(({ oldValue: l }) => l.id)), d = [
820
823
  ...(e.created || []).filter((l) => !r.has(l.id)).map((l) => s.has(l.id) ? t.updated.find(({ oldValue: m }) => m.id === l.id).newValue : l),
821
824
  ...t.created || []
@@ -826,173 +829,173 @@ const Cn = (e, t) => {
826
829
  ...(e.updated || []).filter(({ newValue: l }) => !r.has(l.id)).map((l) => {
827
830
  const { oldValue: m, newValue: c } = l;
828
831
  if (s.has(c.id)) {
829
- const v = t.updated.find((C) => C.oldValue.id === c.id).newValue;
830
- return le(m, v);
832
+ const S = t.updated.find((v) => v.oldValue.id === c.id).newValue;
833
+ return le(m, S);
831
834
  } else
832
835
  return l;
833
836
  }),
834
837
  ...(t.updated || []).filter(({ oldValue: l }) => !a.has(l.id))
835
838
  ];
836
839
  return { created: d, deleted: f, updated: g };
837
- }, Ln = (e) => e.id !== void 0, En = () => {
838
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (b, S = {}) => n.push({ onChange: b, options: S }), i = (b) => {
839
- const S = n.findIndex((x) => x.onChange == b);
840
- S > -1 && n.splice(S, 1);
841
- }, r = (b, S) => {
840
+ }, Ln = (e) => e.id !== void 0, Tn = () => {
841
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (b, C = {}) => n.push({ onChange: b, options: C }), i = (b) => {
842
+ const C = n.findIndex((x) => x.onChange == b);
843
+ C > -1 && n.splice(C, 1);
844
+ }, r = (b, C) => {
842
845
  const x = {
843
846
  origin: b,
844
847
  changes: {
845
- created: S.created || [],
846
- updated: S.updated || [],
847
- deleted: S.deleted || []
848
+ created: C.created || [],
849
+ updated: C.updated || [],
850
+ deleted: C.deleted || []
848
851
  },
849
852
  state: [...e.values()]
850
853
  };
851
- n.forEach((E) => {
852
- Cn(E, x) && E.onChange(x);
854
+ n.forEach((L) => {
855
+ xn(L, x) && L.onChange(x);
853
856
  });
854
- }, s = (b, S = V.LOCAL) => {
857
+ }, s = (b, C = V.LOCAL) => {
855
858
  if (e.get(b.id))
856
859
  throw Error(`Cannot add annotation ${b.id} - exists already`);
857
- e.set(b.id, b), b.bodies.forEach((x) => t.set(x.id, b.id)), r(S, { created: [b] });
858
- }, a = (b, S) => {
859
- const x = typeof b == "string" ? S : b, E = typeof b == "string" ? b : b.id, B = e.get(E);
860
- if (B) {
861
- const N = le(B, x);
862
- return E === x.id ? e.set(E, x) : (e.delete(E), e.set(x.id, x)), B.bodies.forEach((z) => t.delete(z.id)), x.bodies.forEach((z) => t.set(z.id, x.id)), N;
860
+ e.set(b.id, b), b.bodies.forEach((x) => t.set(x.id, b.id)), r(C, { created: [b] });
861
+ }, a = (b, C) => {
862
+ const x = typeof b == "string" ? C : b, L = typeof b == "string" ? b : b.id, R = e.get(L);
863
+ if (R) {
864
+ const I = le(R, x);
865
+ return L === x.id ? e.set(L, x) : (e.delete(L), e.set(x.id, x)), R.bodies.forEach((_) => t.delete(_.id)), x.bodies.forEach((_) => t.set(_.id, x.id)), I;
863
866
  } else
864
- console.warn(`Cannot update annotation ${E} - does not exist`);
865
- }, d = (b, S = V.LOCAL, x = V.LOCAL) => {
866
- const E = Ln(S) ? x : S, B = a(b, S);
867
- B && r(E, { updated: [B] });
868
- }, f = (b, S = V.LOCAL) => {
869
- const x = b.reduce((E, B) => {
870
- const N = a(B);
871
- return N ? [...E, N] : E;
867
+ console.warn(`Cannot update annotation ${L} - does not exist`);
868
+ }, d = (b, C = V.LOCAL, x = V.LOCAL) => {
869
+ const L = Ln(C) ? x : C, R = a(b, C);
870
+ R && r(L, { updated: [R] });
871
+ }, f = (b, C = V.LOCAL) => {
872
+ const x = b.reduce((L, R) => {
873
+ const I = a(R);
874
+ return I ? [...L, I] : L;
872
875
  }, []);
873
- x.length > 0 && r(S, { updated: x });
874
- }, g = (b, S = V.LOCAL) => {
876
+ x.length > 0 && r(C, { updated: x });
877
+ }, g = (b, C = V.LOCAL) => {
875
878
  const x = e.get(b.annotation);
876
879
  if (x) {
877
- const E = {
880
+ const L = {
878
881
  ...x,
879
882
  bodies: [...x.bodies, b]
880
883
  };
881
- e.set(x.id, E), t.set(b.id, E.id), r(S, { updated: [{
884
+ e.set(x.id, L), t.set(b.id, L.id), r(C, { updated: [{
882
885
  oldValue: x,
883
- newValue: E,
886
+ newValue: L,
884
887
  bodiesCreated: [b]
885
888
  }] });
886
889
  } else
887
890
  console.warn(`Attempt to add body to missing annotation: ${b.annotation}`);
888
891
  }, l = () => [...e.values()], m = (b = V.LOCAL) => {
889
- const S = [...e.values()];
890
- e.clear(), t.clear(), r(b, { deleted: S });
891
- }, c = (b, S = !0, x = V.LOCAL) => {
892
- if (S) {
893
- const E = [...e.values()];
894
- e.clear(), t.clear(), b.forEach((B) => {
895
- e.set(B.id, B), B.bodies.forEach((N) => t.set(N.id, B.id));
896
- }), r(x, { created: b, deleted: E });
892
+ const C = [...e.values()];
893
+ e.clear(), t.clear(), r(b, { deleted: C });
894
+ }, c = (b, C = !0, x = V.LOCAL) => {
895
+ if (C) {
896
+ const L = [...e.values()];
897
+ e.clear(), t.clear(), b.forEach((R) => {
898
+ e.set(R.id, R), R.bodies.forEach((I) => t.set(I.id, R.id));
899
+ }), r(x, { created: b, deleted: L });
897
900
  } else {
898
- const E = b.reduce((B, N) => {
899
- const z = e.get(N.id);
900
- return z ? [...B, z] : B;
901
+ const L = b.reduce((R, I) => {
902
+ const _ = e.get(I.id);
903
+ return _ ? [...R, _] : R;
901
904
  }, []);
902
- if (E.length > 0)
903
- throw Error(`Bulk insert would overwrite the following annotations: ${E.map((B) => B.id).join(", ")}`);
904
- b.forEach((B) => {
905
- e.set(B.id, B), B.bodies.forEach((N) => t.set(N.id, B.id));
905
+ if (L.length > 0)
906
+ throw Error(`Bulk insert would overwrite the following annotations: ${L.map((R) => R.id).join(", ")}`);
907
+ b.forEach((R) => {
908
+ e.set(R.id, R), R.bodies.forEach((I) => t.set(I.id, R.id));
906
909
  }), r(x, { created: b });
907
910
  }
908
- }, v = (b) => {
909
- const S = typeof b == "string" ? b : b.id, x = e.get(S);
911
+ }, S = (b) => {
912
+ const C = typeof b == "string" ? b : b.id, x = e.get(C);
910
913
  if (x)
911
- return e.delete(S), x.bodies.forEach((E) => t.delete(E.id)), x;
912
- console.warn(`Attempt to delete missing annotation: ${S}`);
913
- }, C = (b, S = V.LOCAL) => {
914
- const x = v(b);
915
- x && r(S, { deleted: [x] });
916
- }, w = (b, S = V.LOCAL) => {
917
- const x = b.reduce((E, B) => {
918
- const N = v(B);
919
- return N ? [...E, N] : E;
914
+ return e.delete(C), x.bodies.forEach((L) => t.delete(L.id)), x;
915
+ console.warn(`Attempt to delete missing annotation: ${C}`);
916
+ }, v = (b, C = V.LOCAL) => {
917
+ const x = S(b);
918
+ x && r(C, { deleted: [x] });
919
+ }, w = (b, C = V.LOCAL) => {
920
+ const x = b.reduce((L, R) => {
921
+ const I = S(R);
922
+ return I ? [...L, I] : L;
920
923
  }, []);
921
- x.length > 0 && r(S, { deleted: x });
924
+ x.length > 0 && r(C, { deleted: x });
922
925
  }, p = (b) => {
923
- const S = e.get(b.annotation);
924
- if (S) {
925
- const x = S.bodies.find((E) => E.id === b.id);
926
+ const C = e.get(b.annotation);
927
+ if (C) {
928
+ const x = C.bodies.find((L) => L.id === b.id);
926
929
  if (x) {
927
930
  t.delete(x.id);
928
- const E = {
929
- ...S,
930
- bodies: S.bodies.filter((B) => B.id !== b.id)
931
+ const L = {
932
+ ...C,
933
+ bodies: C.bodies.filter((R) => R.id !== b.id)
931
934
  };
932
- return e.set(S.id, E), {
933
- oldValue: S,
934
- newValue: E,
935
+ return e.set(C.id, L), {
936
+ oldValue: C,
937
+ newValue: L,
935
938
  bodiesDeleted: [x]
936
939
  };
937
940
  } else
938
941
  console.warn(`Attempt to delete missing body ${b.id} from annotation ${b.annotation}`);
939
942
  } else
940
943
  console.warn(`Attempt to delete body from missing annotation ${b.annotation}`);
941
- }, u = (b, S = V.LOCAL) => {
944
+ }, u = (b, C = V.LOCAL) => {
942
945
  const x = p(b);
943
- x && r(S, { updated: [x] });
944
- }, A = (b, S = V.LOCAL) => {
945
- const x = b.map((E) => p(E)).filter(Boolean);
946
- x.length > 0 && r(S, { updated: x });
946
+ x && r(C, { updated: [x] });
947
+ }, A = (b, C = V.LOCAL) => {
948
+ const x = b.map((L) => p(L)).filter(Boolean);
949
+ x.length > 0 && r(C, { updated: x });
947
950
  }, h = (b) => {
948
- const S = e.get(b);
949
- return S ? { ...S } : void 0;
950
- }, L = (b) => {
951
- const S = t.get(b);
952
- if (S) {
953
- const x = h(S).bodies.find((E) => E.id === b);
951
+ const C = e.get(b);
952
+ return C ? { ...C } : void 0;
953
+ }, E = (b) => {
954
+ const C = t.get(b);
955
+ if (C) {
956
+ const x = h(C).bodies.find((L) => L.id === b);
954
957
  if (x)
955
958
  return x;
956
959
  console.error(`Store integrity error: body ${b} in index, but not in annotation`);
957
960
  } else
958
961
  console.warn(`Attempt to retrieve missing body: ${b}`);
959
- }, M = (b, S) => {
960
- if (b.annotation !== S.annotation)
962
+ }, B = (b, C) => {
963
+ if (b.annotation !== C.annotation)
961
964
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
962
965
  const x = e.get(b.annotation);
963
966
  if (x) {
964
- const E = x.bodies.find((N) => N.id === b.id), B = {
967
+ const L = x.bodies.find((I) => I.id === b.id), R = {
965
968
  ...x,
966
- bodies: x.bodies.map((N) => N.id === E.id ? S : N)
969
+ bodies: x.bodies.map((I) => I.id === L.id ? C : I)
967
970
  };
968
- return e.set(x.id, B), E.id !== S.id && (t.delete(E.id), t.set(S.id, B.id)), {
971
+ return e.set(x.id, R), L.id !== C.id && (t.delete(L.id), t.set(C.id, R.id)), {
969
972
  oldValue: x,
970
- newValue: B,
971
- bodiesUpdated: [{ oldBody: E, newBody: S }]
973
+ newValue: R,
974
+ bodiesUpdated: [{ oldBody: L, newBody: C }]
972
975
  };
973
976
  } else
974
977
  console.warn(`Attempt to add body to missing annotation ${b.annotation}`);
975
- }, R = (b, S, x = V.LOCAL) => {
976
- const E = M(b, S);
977
- E && r(x, { updated: [E] });
978
- }, T = (b, S = V.LOCAL) => {
979
- const x = b.map((E) => M({ id: E.id, annotation: E.annotation }, E)).filter(Boolean);
980
- r(S, { updated: x });
981
- }, k = (b) => {
982
- const S = e.get(b.annotation);
983
- if (S) {
978
+ }, k = (b, C, x = V.LOCAL) => {
979
+ const L = B(b, C);
980
+ L && r(x, { updated: [L] });
981
+ }, T = (b, C = V.LOCAL) => {
982
+ const x = b.map((L) => B({ id: L.id, annotation: L.annotation }, L)).filter(Boolean);
983
+ r(C, { updated: x });
984
+ }, M = (b) => {
985
+ const C = e.get(b.annotation);
986
+ if (C) {
984
987
  const x = {
985
- ...S,
988
+ ...C,
986
989
  target: {
987
- ...S.target,
990
+ ...C.target,
988
991
  ...b
989
992
  }
990
993
  };
991
- return e.set(S.id, x), {
992
- oldValue: S,
994
+ return e.set(C.id, x), {
995
+ oldValue: C,
993
996
  newValue: x,
994
997
  targetUpdated: {
995
- oldTarget: S.target,
998
+ oldTarget: C.target,
996
999
  newTarget: b
997
1000
  }
998
1001
  };
@@ -1008,26 +1011,26 @@ const Cn = (e, t) => {
1008
1011
  bulkDeleteBodies: A,
1009
1012
  bulkUpdateAnnotation: f,
1010
1013
  bulkUpdateBodies: T,
1011
- bulkUpdateTargets: (b, S = V.LOCAL) => {
1012
- const x = b.map((E) => k(E)).filter(Boolean);
1013
- x.length > 0 && r(S, { updated: x });
1014
+ bulkUpdateTargets: (b, C = V.LOCAL) => {
1015
+ const x = b.map((L) => M(L)).filter(Boolean);
1016
+ x.length > 0 && r(C, { updated: x });
1014
1017
  },
1015
1018
  clear: m,
1016
- deleteAnnotation: C,
1019
+ deleteAnnotation: v,
1017
1020
  deleteBody: u,
1018
1021
  getAnnotation: h,
1019
- getBody: L,
1022
+ getBody: E,
1020
1023
  observe: o,
1021
1024
  unobserve: i,
1022
1025
  updateAnnotation: d,
1023
- updateBody: R,
1024
- updateTarget: (b, S = V.LOCAL) => {
1025
- const x = k(b);
1026
- x && r(S, { updated: [x] });
1026
+ updateBody: k,
1027
+ updateTarget: (b, C = V.LOCAL) => {
1028
+ const x = M(b);
1029
+ x && r(C, { updated: [x] });
1027
1030
  }
1028
1031
  };
1029
1032
  };
1030
- let Tn = () => ({
1033
+ let Mn = () => ({
1031
1034
  emit(e, ...t) {
1032
1035
  for (let n = 0, o = this.events[e] || [], i = o.length; n < i; n++)
1033
1036
  o[n](...t);
@@ -1041,41 +1044,41 @@ let Tn = () => ({
1041
1044
  };
1042
1045
  }
1043
1046
  });
1044
- const Mn = 250, Bn = (e) => {
1045
- const t = Tn(), n = [];
1047
+ const Bn = 250, Rn = (e) => {
1048
+ const t = Mn(), n = [];
1046
1049
  let o = -1, i = !1, r = 0;
1047
1050
  const s = (c) => {
1048
1051
  if (!i) {
1049
- const { changes: v } = c, C = performance.now();
1050
- if (C - r > Mn)
1051
- n.splice(o + 1), n.push(v), o = n.length - 1;
1052
+ const { changes: S } = c, v = performance.now();
1053
+ if (v - r > Bn)
1054
+ n.splice(o + 1), n.push(S), o = n.length - 1;
1052
1055
  else {
1053
1056
  const w = n.length - 1;
1054
- n[w] = xn(n[w], v);
1057
+ n[w] = En(n[w], S);
1055
1058
  }
1056
- r = C;
1059
+ r = v;
1057
1060
  }
1058
1061
  i = !1;
1059
1062
  };
1060
1063
  e.observe(s, { origin: V.LOCAL });
1061
- const a = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c), d = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), f = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ oldValue: v }) => v)), g = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ newValue: v }) => v)), l = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), m = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c);
1064
+ const a = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c), d = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), f = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ oldValue: S }) => S)), g = (c) => c && c.length > 0 && e.bulkUpdateAnnotation(c.map(({ newValue: S }) => S)), l = (c) => c && c.length > 0 && e.bulkAddAnnotation(c, !1), m = (c) => c && c.length > 0 && e.bulkDeleteAnnotation(c);
1062
1065
  return {
1063
1066
  canRedo: () => n.length - 1 > o,
1064
1067
  canUndo: () => o > -1,
1065
1068
  destroy: () => e.unobserve(s),
1066
- on: (c, v) => t.on(c, v),
1069
+ on: (c, S) => t.on(c, S),
1067
1070
  redo: () => {
1068
1071
  if (n.length - 1 > o) {
1069
1072
  i = !0;
1070
- const { created: c, updated: v, deleted: C } = n[o + 1];
1071
- d(c), g(v), m(C), t.emit("redo", n[o + 1]), o += 1;
1073
+ const { created: c, updated: S, deleted: v } = n[o + 1];
1074
+ d(c), g(S), m(v), t.emit("redo", n[o + 1]), o += 1;
1072
1075
  }
1073
1076
  },
1074
1077
  undo: () => {
1075
1078
  if (o > -1) {
1076
1079
  i = !0;
1077
- const { created: c, updated: v, deleted: C } = n[o];
1078
- a(c), f(v), l(C), t.emit("undo", n[o]), o -= 1;
1080
+ const { created: c, updated: S, deleted: v } = n[o];
1081
+ a(c), f(S), l(v), t.emit("undo", n[o]), o -= 1;
1079
1082
  }
1080
1083
  }
1081
1084
  };
@@ -1085,39 +1088,39 @@ const Mn = 250, Bn = (e) => {
1085
1088
  subscribe: e,
1086
1089
  set: t
1087
1090
  };
1088
- }, Rn = (e, t, n, o) => {
1091
+ }, Vn = (e, t, n, o) => {
1089
1092
  const { store: i, selection: r, hover: s, viewport: a } = e, d = /* @__PURE__ */ new Map();
1090
1093
  let f = [], g;
1091
- const l = (C, w) => {
1092
- d.has(C) ? d.get(C).push(w) : d.set(C, [w]);
1093
- }, m = (C, w) => {
1094
- const p = d.get(C);
1094
+ const l = (v, w) => {
1095
+ d.has(v) ? d.get(v).push(w) : d.set(v, [w]);
1096
+ }, m = (v, w) => {
1097
+ const p = d.get(v);
1095
1098
  if (p) {
1096
1099
  const u = p.indexOf(w);
1097
1100
  u !== -1 && p.splice(u, 1);
1098
1101
  }
1099
- }, c = (C, w, p) => {
1100
- d.has(C) && setTimeout(() => {
1101
- d.get(C).forEach((u) => {
1102
+ }, c = (v, w, p) => {
1103
+ d.has(v) && setTimeout(() => {
1104
+ d.get(v).forEach((u) => {
1102
1105
  if (n) {
1103
- const A = Array.isArray(w) ? w.map((L) => n.serialize(L)) : n.serialize(w), h = p ? p instanceof PointerEvent ? p : n.serialize(p) : void 0;
1106
+ const A = Array.isArray(w) ? w.map((E) => n.serialize(E)) : n.serialize(w), h = p ? p instanceof PointerEvent ? p : n.serialize(p) : void 0;
1104
1107
  u(A, h);
1105
1108
  } else
1106
1109
  u(w, p);
1107
1110
  });
1108
1111
  }, 1);
1109
1112
  };
1110
- r.subscribe(({ selected: C }) => {
1111
- if (!(f.length === 0 && C.length === 0)) {
1112
- if (f.length === 0 && C.length > 0)
1113
- f = C.map(({ id: w }) => i.getAnnotation(w));
1114
- else if (f.length > 0 && C.length === 0)
1113
+ r.subscribe(({ selected: v }) => {
1114
+ if (!(f.length === 0 && v.length === 0)) {
1115
+ if (f.length === 0 && v.length > 0)
1116
+ f = v.map(({ id: w }) => i.getAnnotation(w));
1117
+ else if (f.length > 0 && v.length === 0)
1115
1118
  f.forEach((w) => {
1116
1119
  const p = i.getAnnotation(w.id);
1117
1120
  p && !K(p, w) && c("updateAnnotation", p, w);
1118
1121
  }), f = [];
1119
1122
  else {
1120
- const w = new Set(f.map((u) => u.id)), p = new Set(C.map(({ id: u }) => u));
1123
+ const w = new Set(f.map((u) => u.id)), p = new Set(v.map(({ id: u }) => u));
1121
1124
  f.filter((u) => !p.has(u.id)).forEach((u) => {
1122
1125
  const A = i.getAnnotation(u.id);
1123
1126
  A && !K(A, u) && c("updateAnnotation", A, u);
@@ -1125,35 +1128,35 @@ const Mn = 250, Bn = (e) => {
1125
1128
  // Remove annotations that were deselected
1126
1129
  ...f.filter((u) => p.has(u.id)),
1127
1130
  // Add editable annotations that were selected
1128
- ...C.filter(({ id: u }) => !w.has(u)).map(({ id: u }) => i.getAnnotation(u))
1131
+ ...v.filter(({ id: u }) => !w.has(u)).map(({ id: u }) => i.getAnnotation(u))
1129
1132
  ];
1130
1133
  }
1131
1134
  c("selectionChanged", f);
1132
1135
  }
1133
- }), s.subscribe((C) => {
1134
- !g && C ? c("mouseEnterAnnotation", i.getAnnotation(C)) : g && !C ? c("mouseLeaveAnnotation", i.getAnnotation(g)) : g && C && (c("mouseLeaveAnnotation", i.getAnnotation(g)), c("mouseEnterAnnotation", i.getAnnotation(C))), g = C;
1135
- }), a == null || a.subscribe((C) => c("viewportIntersect", C.map((w) => i.getAnnotation(w)))), i.observe((C) => {
1136
- const { created: w, deleted: p } = C.changes;
1137
- (w || []).forEach((u) => c("createAnnotation", u)), (p || []).forEach((u) => c("deleteAnnotation", u)), (C.changes.updated || []).filter((u) => [
1136
+ }), s.subscribe((v) => {
1137
+ !g && v ? c("mouseEnterAnnotation", i.getAnnotation(v)) : g && !v ? c("mouseLeaveAnnotation", i.getAnnotation(g)) : g && v && (c("mouseLeaveAnnotation", i.getAnnotation(g)), c("mouseEnterAnnotation", i.getAnnotation(v))), g = v;
1138
+ }), a == null || a.subscribe((v) => c("viewportIntersect", v.map((w) => i.getAnnotation(w)))), i.observe((v) => {
1139
+ const { created: w, deleted: p } = v.changes;
1140
+ (w || []).forEach((u) => c("createAnnotation", u)), (p || []).forEach((u) => c("deleteAnnotation", u)), (v.changes.updated || []).filter((u) => [
1138
1141
  ...u.bodiesCreated || [],
1139
1142
  ...u.bodiesDeleted || [],
1140
1143
  ...u.bodiesUpdated || []
1141
1144
  ].length > 0).forEach(({ oldValue: u, newValue: A }) => {
1142
- const h = f.find((L) => L.id === u.id) || u;
1143
- f = f.map((L) => L.id === u.id ? A : L), c("updateAnnotation", A, h);
1145
+ const h = f.find((E) => E.id === u.id) || u;
1146
+ f = f.map((E) => E.id === u.id ? A : E), c("updateAnnotation", A, h);
1144
1147
  });
1145
- }, { origin: V.LOCAL }), i.observe((C) => {
1148
+ }, { origin: V.LOCAL }), i.observe((v) => {
1146
1149
  if (f) {
1147
- const w = new Set(f.map((u) => u.id)), p = (C.changes.updated || []).filter(({ newValue: u }) => w.has(u.id)).map(({ newValue: u }) => u);
1150
+ const w = new Set(f.map((u) => u.id)), p = (v.changes.updated || []).filter(({ newValue: u }) => w.has(u.id)).map(({ newValue: u }) => u);
1148
1151
  p.length > 0 && (f = f.map((u) => p.find((h) => h.id === u.id) || u));
1149
1152
  }
1150
1153
  }, { origin: V.REMOTE });
1151
- const v = (C) => (w) => {
1154
+ const S = (v) => (w) => {
1152
1155
  const { updated: p } = w;
1153
- C ? (p || []).forEach((u) => c("updateAnnotation", u.oldValue, u.newValue)) : (p || []).forEach((u) => c("updateAnnotation", u.newValue, u.oldValue));
1156
+ v ? (p || []).forEach((u) => c("updateAnnotation", u.oldValue, u.newValue)) : (p || []).forEach((u) => c("updateAnnotation", u.newValue, u.oldValue));
1154
1157
  };
1155
- return t.on("undo", v(!0)), t.on("redo", v(!1)), { on: l, off: m, emit: c };
1156
- }, Vn = (e) => (t) => t.reduce((n, o) => {
1158
+ return t.on("undo", S(!0)), t.on("redo", S(!1)), { on: l, off: m, emit: c };
1159
+ }, On = (e) => (t) => t.reduce((n, o) => {
1157
1160
  const { parsed: i, error: r } = e.parse(o);
1158
1161
  return r ? {
1159
1162
  parsed: n.parsed,
@@ -1164,7 +1167,7 @@ const Mn = 250, Bn = (e) => {
1164
1167
  } : {
1165
1168
  ...n
1166
1169
  };
1167
- }, { parsed: [], failed: [] }), On = (e, t, n) => {
1170
+ }, { parsed: [], failed: [] }), Nn = (e, t, n) => {
1168
1171
  const { store: o, selection: i } = e, r = (p) => {
1169
1172
  if (n) {
1170
1173
  const { parsed: u, error: A } = n.parse(p);
@@ -1190,13 +1193,13 @@ const Mn = 250, Bn = (e) => {
1190
1193
  }
1191
1194
  }, c = (p, u = !0) => {
1192
1195
  if (n) {
1193
- const { parsed: A, failed: h } = Vn(n)(p);
1196
+ const { parsed: A, failed: h } = On(n)(p);
1194
1197
  h.length > 0 && console.warn(`Discarded ${h.length} invalid annotations`, h), o.bulkAddAnnotation(A, u, V.REMOTE);
1195
1198
  } else
1196
1199
  o.bulkAddAnnotation(p, u, V.REMOTE);
1197
- }, v = (p, u) => {
1200
+ }, S = (p, u) => {
1198
1201
  p ? i.setSelected(p, u) : i.clear();
1199
- }, C = (p) => {
1202
+ }, v = (p) => {
1200
1203
  i.clear(), i.setUserSelectAction(p);
1201
1204
  }, w = (p) => {
1202
1205
  if (n) {
@@ -1220,13 +1223,13 @@ const Mn = 250, Bn = (e) => {
1220
1223
  redo: t.redo,
1221
1224
  removeAnnotation: m,
1222
1225
  setAnnotations: c,
1223
- setSelected: v,
1224
- setUserSelectAction: C,
1226
+ setSelected: S,
1227
+ setUserSelectAction: v,
1225
1228
  undo: t.undo,
1226
1229
  updateAnnotation: w
1227
1230
  };
1228
1231
  }, In = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
1229
- let Nn = (e) => crypto.getRandomValues(new Uint8Array(e)), Fn = (e, t, n) => {
1232
+ let Fn = (e) => crypto.getRandomValues(new Uint8Array(e)), Pn = (e, t, n) => {
1230
1233
  let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * t / e.length);
1231
1234
  return (r = t) => {
1232
1235
  let s = "";
@@ -1236,13 +1239,13 @@ let Nn = (e) => crypto.getRandomValues(new Uint8Array(e)), Fn = (e, t, n) => {
1236
1239
  if (s += e[a[d] & o] || "", s.length === r) return s;
1237
1240
  }
1238
1241
  };
1239
- }, Pn = (e, t = 21) => Fn(e, t, Nn), Dn = (e = 21) => {
1242
+ }, Dn = (e, t = 21) => Pn(e, t, Fn), yn = (e = 21) => {
1240
1243
  let t = "", n = crypto.getRandomValues(new Uint8Array(e));
1241
1244
  for (; e--; )
1242
1245
  t += In[n[e] & 63];
1243
1246
  return t;
1244
1247
  };
1245
- const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Un = (e) => {
1248
+ const Un = () => ({ isGuest: !0, id: Dn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Hn = (e) => {
1246
1249
  const t = JSON.stringify(e);
1247
1250
  let n = 0;
1248
1251
  for (let o = 0, i = t.length; o < i; o++) {
@@ -1250,10 +1253,10 @@ const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABC
1250
1253
  n = (n << 5) - n + r, n |= 0;
1251
1254
  }
1252
1255
  return `${n}`;
1253
- }, ce = (e) => e ? typeof e == "object" ? { ...e } : e : void 0, Hn = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
1256
+ }, ce = (e) => e ? typeof e == "object" ? { ...e } : e : void 0, _n = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
1254
1257
  const { id: o, type: i, purpose: r, value: s, created: a, modified: d, creator: f, ...g } = n;
1255
1258
  return {
1256
- id: o || `temp-${Un(n)}`,
1259
+ id: o || `temp-${Hn(n)}`,
1257
1260
  annotation: t,
1258
1261
  type: i,
1259
1262
  purpose: r,
@@ -1263,7 +1266,7 @@ const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABC
1263
1266
  updated: d ? new Date(d) : void 0,
1264
1267
  ...g
1265
1268
  };
1266
- }), _n = (e) => e.map((t) => {
1269
+ }), Yn = (e) => e.map((t) => {
1267
1270
  var n;
1268
1271
  const { annotation: o, created: i, updated: r, ...s } = t, a = {
1269
1272
  ...s,
@@ -1272,11 +1275,11 @@ const yn = () => ({ isGuest: !0, id: Pn("1234567890abcdefghijklmnopqrstuvwxyzABC
1272
1275
  };
1273
1276
  return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
1274
1277
  });
1275
- Dn();
1276
- const Eo = (e, t) => ({
1277
- parse: (n) => $n(n),
1278
- serialize: (n) => jn(n, e, t)
1279
- }), Yn = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, Xn = (e) => {
1278
+ yn();
1279
+ const To = (e, t) => ({
1280
+ parse: (n) => jn(n),
1281
+ serialize: (n) => Gn(n, e, t)
1282
+ }), Xn = (e) => e.quote !== void 0 && e.start !== void 0 && e.end !== void 0, $n = (e) => {
1280
1283
  const {
1281
1284
  id: t,
1282
1285
  creator: n,
@@ -1306,7 +1309,7 @@ const Eo = (e, t) => ({
1306
1309
  }
1307
1310
  return l;
1308
1311
  }, {});
1309
- if (Yn(g))
1312
+ if (Xn(g))
1310
1313
  a.selector.push({ id: d.id, ...g });
1311
1314
  else {
1312
1315
  const l = [
@@ -1317,14 +1320,14 @@ const Eo = (e, t) => ({
1317
1320
  }
1318
1321
  }
1319
1322
  return { parsed: a };
1320
- }, $n = (e) => {
1323
+ }, jn = (e) => {
1321
1324
  const t = e.id || se(), {
1322
1325
  creator: n,
1323
1326
  created: o,
1324
1327
  modified: i,
1325
1328
  body: r,
1326
1329
  ...s
1327
- } = e, a = Hn(r, t), d = Xn(e);
1330
+ } = e, a = _n(r, t), d = $n(e);
1328
1331
  return "error" in d ? { error: d.error } : {
1329
1332
  parsed: {
1330
1333
  ...s,
@@ -1333,7 +1336,7 @@ const Eo = (e, t) => ({
1333
1336
  target: d.parsed
1334
1337
  }
1335
1338
  };
1336
- }, jn = (e, t, n) => {
1339
+ }, Gn = (e, t, n) => {
1337
1340
  const { bodies: o, target: i, ...r } = e, {
1338
1341
  selector: s,
1339
1342
  creator: a,
@@ -1341,15 +1344,15 @@ const Eo = (e, t) => ({
1341
1344
  updated: f,
1342
1345
  ...g
1343
1346
  } = i, l = s.map((m) => {
1344
- const { quote: c, start: v, end: C, range: w } = m, { prefix: p, suffix: u } = ke(w, n), A = [{
1347
+ const { quote: c, start: S, end: v, range: w } = m, { prefix: p, suffix: u } = Re(w, n), A = [{
1345
1348
  type: "TextQuoteSelector",
1346
1349
  exact: c,
1347
1350
  prefix: p,
1348
1351
  suffix: u
1349
1352
  }, {
1350
1353
  type: "TextPositionSelector",
1351
- start: v,
1352
- end: C
1354
+ start: S,
1355
+ end: v
1353
1356
  }];
1354
1357
  return {
1355
1358
  ...g,
@@ -1363,15 +1366,15 @@ const Eo = (e, t) => ({
1363
1366
  "@context": "http://www.w3.org/ns/anno.jsonld",
1364
1367
  id: e.id,
1365
1368
  type: "Annotation",
1366
- body: _n(e.bodies),
1369
+ body: Yn(e.bodies),
1367
1370
  creator: a,
1368
1371
  created: d == null ? void 0 : d.toISOString(),
1369
1372
  modified: f == null ? void 0 : f.toISOString(),
1370
1373
  target: l
1371
1374
  };
1372
1375
  };
1373
- function Gn(e, t, n, o, i) {
1374
- de(e, t, n || 0, o || e.length - 1, i || Wn);
1376
+ function Wn(e, t, n, o, i) {
1377
+ de(e, t, n || 0, o || e.length - 1, i || zn);
1375
1378
  }
1376
1379
  function de(e, t, n, o, i) {
1377
1380
  for (; o > n; ) {
@@ -1379,22 +1382,22 @@ function de(e, t, n, o, i) {
1379
1382
  var r = o - n + 1, s = t - n + 1, a = Math.log(r), d = 0.5 * Math.exp(2 * a / 3), f = 0.5 * Math.sqrt(a * d * (r - d) / r) * (s - r / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(t - s * d / r + f)), l = Math.min(o, Math.floor(t + (r - s) * d / r + f));
1380
1383
  de(e, t, g, l, i);
1381
1384
  }
1382
- var m = e[t], c = n, v = o;
1383
- for (tt(e, n, t), i(e[o], m) > 0 && tt(e, n, o); c < v; ) {
1384
- for (tt(e, c, v), c++, v--; i(e[c], m) < 0; ) c++;
1385
- for (; i(e[v], m) > 0; ) v--;
1385
+ var m = e[t], c = n, S = o;
1386
+ for (tt(e, n, t), i(e[o], m) > 0 && tt(e, n, o); c < S; ) {
1387
+ for (tt(e, c, S), c++, S--; i(e[c], m) < 0; ) c++;
1388
+ for (; i(e[S], m) > 0; ) S--;
1386
1389
  }
1387
- i(e[n], m) === 0 ? tt(e, n, v) : (v++, tt(e, v, o)), v <= t && (n = v + 1), t <= v && (o = v - 1);
1390
+ i(e[n], m) === 0 ? tt(e, n, S) : (S++, tt(e, S, o)), S <= t && (n = S + 1), t <= S && (o = S - 1);
1388
1391
  }
1389
1392
  }
1390
1393
  function tt(e, t, n) {
1391
1394
  var o = e[t];
1392
1395
  e[t] = e[n], e[n] = o;
1393
1396
  }
1394
- function Wn(e, t) {
1397
+ function zn(e, t) {
1395
1398
  return e < t ? -1 : e > t ? 1 : 0;
1396
1399
  }
1397
- class zn {
1400
+ class qn {
1398
1401
  constructor(t = 9) {
1399
1402
  this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
1400
1403
  }
@@ -1465,7 +1468,7 @@ class zn {
1465
1468
  let a, d, f;
1466
1469
  for (; o || r.length; ) {
1467
1470
  if (o || (o = r.pop(), d = r[r.length - 1], a = s.pop(), f = !0), o.leaf) {
1468
- const g = qn(t, o.children, n);
1471
+ const g = Zn(t, o.children, n);
1469
1472
  if (g !== -1)
1470
1473
  return o.children.splice(g, 1), r.push(o), this._condense(r), this;
1471
1474
  }
@@ -1516,7 +1519,7 @@ class zn {
1516
1519
  for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
1517
1520
  let r = 1 / 0, s = 1 / 0, a;
1518
1521
  for (let d = 0; d < n.children.length; d++) {
1519
- const f = n.children[d], g = Et(f), l = Qn(t, f) - g;
1522
+ const f = n.children[d], g = Lt(f), l = Kn(t, f) - g;
1520
1523
  l < s ? (s = l, r = g < r ? g : r, a = f) : l === s && g < r && (r = g, a = f);
1521
1524
  }
1522
1525
  n = a || n.children[0];
@@ -1542,14 +1545,14 @@ class zn {
1542
1545
  _chooseSplitIndex(t, n, o) {
1543
1546
  let i, r = 1 / 0, s = 1 / 0;
1544
1547
  for (let a = n; a <= o - n; a++) {
1545
- const d = nt(t, 0, a, this.toBBox), f = nt(t, a, o, this.toBBox), g = Kn(d, f), l = Et(d) + Et(f);
1548
+ const d = nt(t, 0, a, this.toBBox), f = nt(t, a, o, this.toBBox), g = to(d, f), l = Lt(d) + Lt(f);
1546
1549
  g < r ? (r = g, i = a, s = l < s ? l : s) : g === r && l < s && (s = l, i = a);
1547
1550
  }
1548
1551
  return i || o - n;
1549
1552
  }
1550
1553
  // sorts node children by the best axis for split
1551
1554
  _chooseSplitAxis(t, n, o) {
1552
- const i = t.leaf ? this.compareMinX : Zn, r = t.leaf ? this.compareMinY : Jn, s = this._allDistMargin(t, n, o, i), a = this._allDistMargin(t, n, o, r);
1555
+ const i = t.leaf ? this.compareMinX : Jn, r = t.leaf ? this.compareMinY : Qn, s = this._allDistMargin(t, n, o, i), a = this._allDistMargin(t, n, o, r);
1553
1556
  s < a && t.children.sort(i);
1554
1557
  }
1555
1558
  // total margin of all possible split distributions where each node is at least m full
@@ -1576,7 +1579,7 @@ class zn {
1576
1579
  t[n].children.length === 0 ? n > 0 ? (o = t[n - 1].children, o.splice(o.indexOf(t[n]), 1)) : this.clear() : J(t[n], this.toBBox);
1577
1580
  }
1578
1581
  }
1579
- function qn(e, t, n) {
1582
+ function Zn(e, t, n) {
1580
1583
  if (!n) return t.indexOf(e);
1581
1584
  for (let o = 0; o < t.length; o++)
1582
1585
  if (n(e, t[o])) return o;
@@ -1596,22 +1599,22 @@ function nt(e, t, n, o, i) {
1596
1599
  function ot(e, t) {
1597
1600
  return e.minX = Math.min(e.minX, t.minX), e.minY = Math.min(e.minY, t.minY), e.maxX = Math.max(e.maxX, t.maxX), e.maxY = Math.max(e.maxY, t.maxY), e;
1598
1601
  }
1599
- function Zn(e, t) {
1602
+ function Jn(e, t) {
1600
1603
  return e.minX - t.minX;
1601
1604
  }
1602
- function Jn(e, t) {
1605
+ function Qn(e, t) {
1603
1606
  return e.minY - t.minY;
1604
1607
  }
1605
- function Et(e) {
1608
+ function Lt(e) {
1606
1609
  return (e.maxX - e.minX) * (e.maxY - e.minY);
1607
1610
  }
1608
1611
  function ft(e) {
1609
1612
  return e.maxX - e.minX + (e.maxY - e.minY);
1610
1613
  }
1611
- function Qn(e, t) {
1614
+ function Kn(e, t) {
1612
1615
  return (Math.max(t.maxX, e.maxX) - Math.min(t.minX, e.minX)) * (Math.max(t.maxY, e.maxY) - Math.min(t.minY, e.minY));
1613
1616
  }
1614
- function Kn(e, t) {
1617
+ function to(e, t) {
1615
1618
  const n = Math.max(e.minX, t.minX), o = Math.max(e.minY, t.minY), i = Math.min(e.maxX, t.maxX), r = Math.min(e.maxY, t.maxY);
1616
1619
  return Math.max(0, i - n) * Math.max(0, r - o);
1617
1620
  }
@@ -1637,10 +1640,10 @@ function Qt(e, t, n, o, i) {
1637
1640
  for (; r.length; ) {
1638
1641
  if (n = r.pop(), t = r.pop(), n - t <= o) continue;
1639
1642
  const s = t + Math.ceil((n - t) / o / 2) * o;
1640
- Gn(e, s, t, n, i), r.push(t, s, s, n);
1643
+ Wn(e, s, t, n, i), r.push(t, s, s, n);
1641
1644
  }
1642
1645
  }
1643
- let to = () => ({
1646
+ let eo = () => ({
1644
1647
  emit(e, ...t) {
1645
1648
  for (let n = 0, o = this.events[e] || [], i = o.length; n < i; n++)
1646
1649
  o[n](...t);
@@ -1654,22 +1657,22 @@ let to = () => ({
1654
1657
  };
1655
1658
  }
1656
1659
  });
1657
- const eo = (e, t) => {
1658
- const n = new zn(), o = /* @__PURE__ */ new Map(), i = to(), r = (A, h) => {
1659
- const L = A.selector.flatMap((R) => {
1660
- const T = W([R]) ? R.range : oe(R, t).range;
1660
+ const no = (e, t) => {
1661
+ const n = new qn(), o = /* @__PURE__ */ new Map(), i = eo(), r = (A, h) => {
1662
+ const E = A.selector.flatMap((k) => {
1663
+ const T = z([k]) ? k.range : oe(k, t).range;
1661
1664
  return Array.from(T.getClientRects());
1662
- }), M = Ne(L).map((R) => Pe(R, h));
1663
- return M.map((R) => {
1664
- const { x: T, y: k, width: b, height: S } = R;
1665
+ }), B = Ie(E).map((k) => De(k, h));
1666
+ return B.map((k) => {
1667
+ const { x: T, y: M, width: b, height: C } = k;
1665
1668
  return {
1666
1669
  minX: T,
1667
- minY: k,
1670
+ minY: M,
1668
1671
  maxX: T + b,
1669
- maxY: k + S,
1672
+ maxY: M + C,
1670
1673
  annotation: {
1671
1674
  id: A.annotation,
1672
- rects: M
1675
+ rects: B
1673
1676
  }
1674
1677
  };
1675
1678
  });
@@ -1677,37 +1680,37 @@ const eo = (e, t) => {
1677
1680
  n.clear(), o.clear();
1678
1681
  }, d = (A) => {
1679
1682
  const h = r(A, t.getBoundingClientRect());
1680
- h.forEach((L) => n.insert(L)), o.set(A.annotation, h);
1683
+ h.forEach((E) => n.insert(E)), o.set(A.annotation, h);
1681
1684
  }, f = (A) => {
1682
1685
  const h = o.get(A.annotation);
1683
- h && (h.forEach((L) => n.remove(L)), o.delete(A.annotation));
1686
+ h && (h.forEach((E) => n.remove(E)), o.delete(A.annotation));
1684
1687
  }, g = (A) => {
1685
1688
  f(A), d(A);
1686
1689
  }, l = (A, h = !0) => {
1687
1690
  h && a();
1688
- const L = t.getBoundingClientRect(), M = A.map((T) => ({ target: T, rects: r(T, L) }));
1689
- M.forEach(({ target: T, rects: k }) => o.set(T.annotation, k));
1690
- const R = M.flatMap(({ rects: T }) => T);
1691
- n.load(R);
1692
- }, m = (A, h, L = !1) => {
1693
- const M = n.search({
1691
+ const E = t.getBoundingClientRect(), B = A.map((T) => ({ target: T, rects: r(T, E) }));
1692
+ B.forEach(({ target: T, rects: M }) => o.set(T.annotation, M));
1693
+ const k = B.flatMap(({ rects: T }) => T);
1694
+ n.load(k);
1695
+ }, m = (A, h, E = !1) => {
1696
+ const B = n.search({
1694
1697
  minX: A,
1695
1698
  minY: h,
1696
1699
  maxX: A,
1697
1700
  maxY: h
1698
- }), R = (T) => T.annotation.rects.reduce((k, b) => k + b.width * b.height, 0);
1699
- return M.length > 0 ? (M.sort((T, k) => R(T) - R(k)), L ? M.map((T) => T.annotation.id) : [M[0].annotation.id]) : [];
1701
+ }), k = (T) => T.annotation.rects.reduce((M, b) => M + b.width * b.height, 0);
1702
+ return B.length > 0 ? (B.sort((T, M) => k(T) - k(M)), E ? B.map((T) => T.annotation.id) : [B[0].annotation.id]) : [];
1700
1703
  }, c = (A) => {
1701
- const h = v(A);
1704
+ const h = S(A);
1702
1705
  if (h.length === 0)
1703
1706
  return;
1704
- let L = h[0].left, M = h[0].top, R = h[0].right, T = h[0].bottom;
1705
- for (let k = 1; k < h.length; k++) {
1706
- const b = h[k];
1707
- L = Math.min(L, b.left), M = Math.min(M, b.top), R = Math.max(R, b.right), T = Math.max(T, b.bottom);
1707
+ let E = h[0].left, B = h[0].top, k = h[0].right, T = h[0].bottom;
1708
+ for (let M = 1; M < h.length; M++) {
1709
+ const b = h[M];
1710
+ E = Math.min(E, b.left), B = Math.min(B, b.top), k = Math.max(k, b.right), T = Math.max(T, b.bottom);
1708
1711
  }
1709
- return new DOMRect(L, M, R - L, T - M);
1710
- }, v = (A) => {
1712
+ return new DOMRect(E, B, k - E, T - B);
1713
+ }, S = (A) => {
1711
1714
  const h = o.get(A);
1712
1715
  return h ? h[0].annotation.rects : [];
1713
1716
  };
@@ -1716,13 +1719,13 @@ const eo = (e, t) => {
1716
1719
  clear: a,
1717
1720
  getAt: m,
1718
1721
  getAnnotationBounds: c,
1719
- getAnnotationRects: v,
1720
- getIntersecting: (A, h, L, M) => {
1721
- const R = n.search({ minX: A, minY: h, maxX: L, maxY: M }), T = new Set(R.map((k) => k.annotation.id));
1722
- return Array.from(T).map((k) => ({
1723
- annotation: e.getAnnotation(k),
1724
- rects: v(k)
1725
- })).filter((k) => !!k.annotation);
1722
+ getAnnotationRects: S,
1723
+ getIntersecting: (A, h, E, B) => {
1724
+ const k = n.search({ minX: A, minY: h, maxX: E, maxY: B }), T = new Set(k.map((M) => M.annotation.id));
1725
+ return Array.from(T).map((M) => ({
1726
+ annotation: e.getAnnotation(M),
1727
+ rects: S(M)
1728
+ })).filter((M) => !!M.annotation);
1726
1729
  },
1727
1730
  insert: d,
1728
1731
  recalculate: () => {
@@ -1734,15 +1737,15 @@ const eo = (e, t) => {
1734
1737
  update: g,
1735
1738
  on: (A, h) => i.on(A, h)
1736
1739
  };
1737
- }, no = (e, t) => {
1738
- const n = En(), o = eo(n, e), i = fn(n, t), r = dn(n), s = kn(), a = (w, p = V.LOCAL) => {
1739
- const u = bt(w, e), A = W(u.target.selector);
1740
+ }, oo = (e, t) => {
1741
+ const n = Tn(), o = no(n, e), i = pn(n, t), r = un(n), s = kn(), a = (w, p = V.LOCAL) => {
1742
+ const u = bt(w, e), A = z(u.target.selector);
1740
1743
  return A && n.addAnnotation(u, p), A;
1741
1744
  }, d = (w, p = !0, u = V.LOCAL) => {
1742
- const A = w.map((L) => bt(L, e)), h = A.filter((L) => !W(L.target.selector));
1745
+ const A = w.map((E) => bt(E, e)), h = A.filter((E) => !z(E.target.selector));
1743
1746
  return h.length > 0 ? (console.warn("Could not revive all targets for these annotations:", h), n.bulkAddAnnotation(A, p, u), h) : (n.bulkAddAnnotation(A, p, u), []);
1744
1747
  }, f = (w, p = V.LOCAL) => {
1745
- const u = w.map((h) => bt(h, e)), A = u.filter((h) => !W(h.target.selector));
1748
+ const u = w.map((h) => bt(h, e)), A = u.filter((h) => !z(h.target.selector));
1746
1749
  return A.length > 0 && console.warn("Could not revive all targets for these annotations:", A), u.forEach((h) => {
1747
1750
  n.getAnnotation(h.id) ? n.updateAnnotation(h, p) : n.addAnnotation(h, p);
1748
1751
  }), A;
@@ -1753,20 +1756,20 @@ const eo = (e, t) => {
1753
1756
  const u = w.map((A) => mt(A, e));
1754
1757
  n.bulkUpdateTargets(u, p);
1755
1758
  }, m = (w, p, u) => {
1756
- const A = o.getAt(w, p, !!u).map((L) => n.getAnnotation(L)), h = u ? A.filter(u) : A;
1759
+ const A = o.getAt(w, p, !!u).map((E) => n.getAnnotation(E)), h = u ? A.filter(u) : A;
1757
1760
  return h.length > 0 ? h[0] : void 0;
1758
1761
  }, c = (w, p, u, A = 5) => {
1759
1762
  const h = o.getAnnotationRects(w);
1760
1763
  if (h.length !== 0) {
1761
1764
  if (p && u) {
1762
- const L = h.find(({ top: M, right: R, bottom: T, left: k }) => p >= k - A && p <= R + A && u >= M - A && u <= T + A);
1763
- if (L) return L;
1765
+ const E = h.find(({ top: B, right: k, bottom: T, left: M }) => p >= M - A && p <= k + A && u >= B - A && u <= T + A);
1766
+ if (E) return E;
1764
1767
  }
1765
1768
  return o.getAnnotationBounds(w);
1766
1769
  }
1767
- }, v = () => o.recalculate(), C = (w) => o.on("recalculate", w);
1770
+ }, S = () => o.recalculate(), v = (w) => o.on("recalculate", w);
1768
1771
  return n.observe(({ changes: w }) => {
1769
- const p = (w.deleted || []).filter((h) => W(h.target.selector)), u = (w.created || []).filter((h) => W(h.target.selector)), A = (w.updated || []).filter((h) => W(h.newValue.target.selector));
1772
+ const p = (w.deleted || []).filter((h) => z(h.target.selector)), u = (w.created || []).filter((h) => z(h.target.selector)), A = (w.updated || []).filter((h) => z(h.newValue.target.selector));
1770
1773
  (p == null ? void 0 : p.length) > 0 && p.forEach((h) => o.remove(h.target)), u.length > 0 && o.set(u.map((h) => h.target), !1), (A == null ? void 0 : A.length) > 0 && A.forEach(({ newValue: h }) => o.update(h.target));
1771
1774
  }), {
1772
1775
  store: {
@@ -1779,25 +1782,25 @@ const eo = (e, t) => {
1779
1782
  getAt: m,
1780
1783
  getIntersecting: o.getIntersecting.bind(o),
1781
1784
  getAnnotationRects: o.getAnnotationRects.bind(o),
1782
- recalculatePositions: v,
1783
- onRecalculatePositions: C,
1785
+ recalculatePositions: S,
1786
+ onRecalculatePositions: v,
1784
1787
  updateTarget: g
1785
1788
  },
1786
1789
  selection: i,
1787
1790
  hover: r,
1788
1791
  viewport: s
1789
1792
  };
1790
- }, oo = () => {
1793
+ }, io = () => {
1791
1794
  const e = document.createElement("canvas");
1792
1795
  e.width = 2 * window.innerWidth, e.height = 2 * window.innerHeight, e.className = "r6o-presence-layer";
1793
1796
  const t = e.getContext("2d");
1794
1797
  return t.scale(2, 2), t.translate(0.5, 0.5), e;
1795
- }, io = (e, t, n = {}) => {
1796
- const o = oo(), i = o.getContext("2d");
1798
+ }, ro = (e, t, n = {}) => {
1799
+ const o = io(), i = o.getContext("2d");
1797
1800
  document.body.appendChild(o);
1798
1801
  const r = /* @__PURE__ */ new Map(), s = (l) => Array.from(r.entries()).filter(([m, c]) => c.presenceKey === l.presenceKey).map(([m, c]) => m);
1799
1802
  return t.on("selectionChange", (l, m) => {
1800
- s(l).forEach((v) => r.delete(v)), m && m.forEach((v) => r.set(v, l));
1803
+ s(l).forEach((S) => r.delete(S)), m && m.forEach((S) => r.set(S, l));
1801
1804
  }), {
1802
1805
  clear: () => {
1803
1806
  const { width: l, height: m } = o;
@@ -1808,13 +1811,13 @@ const eo = (e, t) => {
1808
1811
  },
1809
1812
  paint: (l, m, c) => {
1810
1813
  n.font && (i.font = n.font);
1811
- const v = r.get(l.annotation.id);
1812
- if (v) {
1813
- const { height: C } = l.rects[0], w = l.rects[0].x + m.left, p = l.rects[0].y + m.top;
1814
- i.fillStyle = v.appearance.color, i.fillRect(w - 2, p - 2.5, 2, C + 5);
1815
- const u = i.measureText(v.appearance.label), A = u.width + 6, h = u.actualBoundingBoxAscent + u.actualBoundingBoxDescent + 8, L = u.fontBoundingBoxAscent ? 8 : 6.5;
1816
- return i.fillRect(w - 2, p - 2.5 - h, A, h), i.fillStyle = "#fff", i.fillText(v.appearance.label, w + 1, p - L), {
1817
- fill: v.appearance.color,
1814
+ const S = r.get(l.annotation.id);
1815
+ if (S) {
1816
+ const { height: v } = l.rects[0], w = l.rects[0].x + m.left, p = l.rects[0].y + m.top;
1817
+ i.fillStyle = S.appearance.color, i.fillRect(w - 2, p - 2.5, 2, v + 5);
1818
+ const u = i.measureText(S.appearance.label), A = u.width + 6, h = u.actualBoundingBoxAscent + u.actualBoundingBoxDescent + 8, E = u.fontBoundingBoxAscent ? 8 : 6.5;
1819
+ return i.fillRect(w - 2, p - 2.5 - h, A, h), i.fillStyle = "#fff", i.fillText(S.appearance.label, w + 1, p - E), {
1820
+ fill: S.appearance.color,
1818
1821
  fillOpacity: c ? 0.45 : 0.18
1819
1822
  };
1820
1823
  }
@@ -1830,9 +1833,9 @@ const eo = (e, t) => {
1830
1833
  return document.scrollingElement;
1831
1834
  const { overflowY: t } = window.getComputedStyle(e);
1832
1835
  return t !== "visible" && t !== "hidden" && e.scrollHeight > e.clientHeight ? e : ue(e.parentElement);
1833
- }, ro = (e, t) => (n) => {
1836
+ }, ao = (e, t) => (n) => {
1834
1837
  const o = typeof n == "string" ? n : n.id, i = (s) => {
1835
- const a = r.getBoundingClientRect(), d = r.clientHeight, f = r.clientWidth, g = s.selector[0].range.getBoundingClientRect(), { width: l, height: m } = t.getAnnotationBounds(o), c = g.top - a.top, v = g.left - a.left, C = r.parentElement ? r.scrollTop : 0, w = r.parentElement ? r.scrollLeft : 0, p = c + C - (d - m) / 2, u = v + w - (f - l) / 2;
1838
+ const a = r.getBoundingClientRect(), d = r.clientHeight, f = r.clientWidth, g = s.selector[0].range.getBoundingClientRect(), { width: l, height: m } = t.getAnnotationBounds(o), c = g.top - a.top, S = g.left - a.left, v = r.parentElement ? r.scrollTop : 0, w = r.parentElement ? r.scrollLeft : 0, p = c + v - (d - m) / 2, u = S + w - (f - l) / 2;
1836
1839
  r.scroll({ top: p, left: u, behavior: "smooth" });
1837
1840
  }, r = ue(e);
1838
1841
  if (r) {
@@ -1846,7 +1849,7 @@ const eo = (e, t) => {
1846
1849
  }
1847
1850
  }
1848
1851
  return !1;
1849
- }, ao = (e, t) => ({
1852
+ }, so = (e, t) => ({
1850
1853
  ...e,
1851
1854
  annotatingEnabled: e.annotatingEnabled ?? t.annotatingEnabled,
1852
1855
  user: e.user || t.user
@@ -1870,7 +1873,7 @@ function pe(e) {
1870
1873
  t[n - 1] += ",", t.splice(n, 1), n = t.lastIndexOf("");
1871
1874
  return t;
1872
1875
  }
1873
- function so(e, t) {
1876
+ function lo(e, t) {
1874
1877
  const n = e.length >= t.length ? e : t, o = e.length >= t.length ? t : e;
1875
1878
  let i = !0;
1876
1879
  for (let r = 0; r < n.length; r++)
@@ -1929,7 +1932,7 @@ const at = {
1929
1932
  "[": 219,
1930
1933
  "]": 221,
1931
1934
  "\\": 220
1932
- }, X = {
1935
+ }, $ = {
1933
1936
  // shiftKey
1934
1937
  "⇧": 16,
1935
1938
  shift: 16,
@@ -1959,27 +1962,27 @@ const at = {
1959
1962
  18: !1,
1960
1963
  17: !1,
1961
1964
  91: !1
1962
- }, I = {};
1965
+ }, N = {};
1963
1966
  for (let e = 1; e < 20; e++)
1964
1967
  at["f".concat(e)] = 111 + e;
1965
1968
  let O = [], rt = null, he = "all";
1966
- const G = /* @__PURE__ */ new Map(), lt = (e) => at[e.toLowerCase()] || X[e.toLowerCase()] || e.toUpperCase().charCodeAt(0), lo = (e) => Object.keys(at).find((t) => at[t] === e), co = (e) => Object.keys(X).find((t) => X[t] === e);
1969
+ const W = /* @__PURE__ */ new Map(), lt = (e) => at[e.toLowerCase()] || $[e.toLowerCase()] || e.toUpperCase().charCodeAt(0), co = (e) => Object.keys(at).find((t) => at[t] === e), uo = (e) => Object.keys($).find((t) => $[t] === e);
1967
1970
  function ge(e) {
1968
1971
  he = e || "all";
1969
1972
  }
1970
1973
  function st() {
1971
1974
  return he || "all";
1972
1975
  }
1973
- function uo() {
1974
- return O.slice(0);
1975
- }
1976
1976
  function fo() {
1977
- return O.map((e) => lo(e) || co(e) || String.fromCharCode(e));
1977
+ return O.slice(0);
1978
1978
  }
1979
1979
  function po() {
1980
+ return O.map((e) => co(e) || uo(e) || String.fromCharCode(e));
1981
+ }
1982
+ function ho() {
1980
1983
  const e = [];
1981
- return Object.keys(I).forEach((t) => {
1982
- I[t].forEach((n) => {
1984
+ return Object.keys(N).forEach((t) => {
1985
+ N[t].forEach((n) => {
1983
1986
  let {
1984
1987
  key: o,
1985
1988
  scope: i,
@@ -1995,7 +1998,7 @@ function po() {
1995
1998
  });
1996
1999
  }), e;
1997
2000
  }
1998
- function ho(e) {
2001
+ function go(e) {
1999
2002
  const t = e.target || e.srcElement, {
2000
2003
  tagName: n
2001
2004
  } = t;
@@ -2003,15 +2006,15 @@ function ho(e) {
2003
2006
  const i = n === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(t.type);
2004
2007
  return (t.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !t.readOnly) && (o = !1), o;
2005
2008
  }
2006
- function go(e) {
2009
+ function mo(e) {
2007
2010
  return typeof e == "string" && (e = lt(e)), O.indexOf(e) !== -1;
2008
2011
  }
2009
- function mo(e, t) {
2012
+ function bo(e, t) {
2010
2013
  let n, o;
2011
2014
  e || (e = st());
2012
- for (const i in I)
2013
- if (Object.prototype.hasOwnProperty.call(I, i))
2014
- for (n = I[i], o = 0; o < n.length; )
2015
+ for (const i in N)
2016
+ if (Object.prototype.hasOwnProperty.call(N, i))
2017
+ for (n = N[i], o = 0; o < n.length; )
2015
2018
  n[o].scope === e ? n.splice(o, 1).forEach((s) => {
2016
2019
  let {
2017
2020
  element: a
@@ -2020,18 +2023,18 @@ function mo(e, t) {
2020
2023
  }) : o++;
2021
2024
  st() === e && ge(t || "all");
2022
2025
  }
2023
- function bo(e) {
2026
+ function wo(e) {
2024
2027
  let t = e.keyCode || e.which || e.charCode;
2025
2028
  const n = O.indexOf(t);
2026
2029
  if (n >= 0 && O.splice(n, 1), e.key && e.key.toLowerCase() === "meta" && O.splice(0, O.length), (t === 93 || t === 224) && (t = 91), t in y) {
2027
2030
  y[t] = !1;
2028
- for (const o in X) X[o] === t && (U[o] = !1);
2031
+ for (const o in $) $[o] === t && (U[o] = !1);
2029
2032
  }
2030
2033
  }
2031
2034
  function me(e) {
2032
2035
  if (typeof e > "u")
2033
- Object.keys(I).forEach((i) => {
2034
- Array.isArray(I[i]) && I[i].forEach((r) => ht(r)), delete I[i];
2036
+ Object.keys(N).forEach((i) => {
2037
+ Array.isArray(N[i]) && N[i].forEach((r) => ht(r)), delete N[i];
2035
2038
  }), Pt(null);
2036
2039
  else if (Array.isArray(e))
2037
2040
  e.forEach((i) => {
@@ -2060,12 +2063,12 @@ const ht = (e) => {
2060
2063
  } = e;
2061
2064
  pe(t).forEach((s) => {
2062
2065
  const a = s.split(i), d = a.length, f = a[d - 1], g = f === "*" ? "*" : lt(f);
2063
- if (!I[g]) return;
2066
+ if (!N[g]) return;
2064
2067
  n || (n = st());
2065
- const l = d > 1 ? fe(X, a) : [], m = [];
2066
- I[g] = I[g].filter((c) => {
2067
- const C = (o ? c.method === o : !0) && c.scope === n && so(c.mods, l);
2068
- return C && m.push(c.element), !C;
2068
+ const l = d > 1 ? fe($, a) : [], m = [];
2069
+ N[g] = N[g].filter((c) => {
2070
+ const v = (o ? c.method === o : !0) && c.scope === n && lo(c.mods, l);
2071
+ return v && m.push(c.element), !v;
2069
2072
  }), m.forEach((c) => Pt(c));
2070
2073
  });
2071
2074
  };
@@ -2081,7 +2084,7 @@ function Kt(e, t, n, o) {
2081
2084
  }
2082
2085
  }
2083
2086
  function te(e, t) {
2084
- const n = I["*"];
2087
+ const n = N["*"];
2085
2088
  let o = e.keyCode || e.which || e.charCode;
2086
2089
  if (!U.filter.call(this, e)) return;
2087
2090
  if ((o === 93 || o === 224) && (o = 91), O.indexOf(o) === -1 && o !== 229 && O.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((a) => {
@@ -2089,8 +2092,8 @@ function te(e, t) {
2089
2092
  e[a] && O.indexOf(d) === -1 ? O.push(d) : !e[a] && O.indexOf(d) > -1 ? O.splice(O.indexOf(d), 1) : a === "metaKey" && e[a] && O.length === 3 && (e.ctrlKey || e.shiftKey || e.altKey || (O = O.slice(O.indexOf(d))));
2090
2093
  }), o in y) {
2091
2094
  y[o] = !0;
2092
- for (const a in X)
2093
- X[a] === o && (U[a] = !0);
2095
+ for (const a in $)
2096
+ $[a] === o && (U[a] = !0);
2094
2097
  if (!n) return;
2095
2098
  }
2096
2099
  for (const a in y)
@@ -2100,8 +2103,8 @@ function te(e, t) {
2100
2103
  if (n)
2101
2104
  for (let a = 0; a < n.length; a++)
2102
2105
  n[a].scope === i && (e.type === "keydown" && n[a].keydown || e.type === "keyup" && n[a].keyup) && Kt(e, n[a], i, t);
2103
- if (!(o in I)) return;
2104
- const r = I[o], s = r.length;
2106
+ if (!(o in N)) return;
2107
+ const r = N[o], s = r.length;
2105
2108
  for (let a = 0; a < s; a++)
2106
2109
  if ((e.type === "keydown" && r[a].keydown || e.type === "keyup" && r[a].keyup) && r[a].key) {
2107
2110
  const d = r[a], {
@@ -2117,7 +2120,7 @@ function U(e, t, n) {
2117
2120
  const o = pe(e);
2118
2121
  let i = [], r = "all", s = document, a = 0, d = !1, f = !0, g = "+", l = !1, m = !1;
2119
2122
  for (n === void 0 && typeof t == "function" && (n = t), Object.prototype.toString.call(t) === "[object Object]" && (t.scope && (r = t.scope), t.element && (s = t.element), t.keyup && (d = t.keyup), t.keydown !== void 0 && (f = t.keydown), t.capture !== void 0 && (l = t.capture), typeof t.splitKey == "string" && (g = t.splitKey), t.single === !0 && (m = !0)), typeof t == "string" && (r = t), m && me(e, r); a < o.length; a++)
2120
- e = o[a].split(g), i = [], e.length > 1 && (i = fe(X, e)), e = e[e.length - 1], e = e === "*" ? "*" : lt(e), e in I || (I[e] = []), I[e].push({
2123
+ e = o[a].split(g), i = [], e.length > 1 && (i = fe($, e)), e = e[e.length - 1], e = e === "*" ? "*" : lt(e), e in N || (N[e] = []), N[e].push({
2121
2124
  keyup: d,
2122
2125
  keydown: f,
2123
2126
  scope: r,
@@ -2129,19 +2132,19 @@ function U(e, t, n) {
2129
2132
  element: s
2130
2133
  });
2131
2134
  if (typeof s < "u" && window) {
2132
- if (!G.has(s)) {
2135
+ if (!W.has(s)) {
2133
2136
  const c = function() {
2134
- let C = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2135
- return te(C, s);
2136
- }, v = function() {
2137
- let C = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2138
- te(C, s), bo(C);
2137
+ let v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2138
+ return te(v, s);
2139
+ }, S = function() {
2140
+ let v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2141
+ te(v, s), wo(v);
2139
2142
  };
2140
- G.set(s, {
2143
+ W.set(s, {
2141
2144
  keydownListener: c,
2142
- keyupListenr: v,
2145
+ keyupListenr: S,
2143
2146
  capture: l
2144
- }), Bt(s, "keydown", c, l), Bt(s, "keyup", v, l);
2147
+ }), Bt(s, "keydown", c, l), Bt(s, "keyup", S, l);
2145
2148
  }
2146
2149
  if (!rt) {
2147
2150
  const c = () => {
@@ -2154,16 +2157,16 @@ function U(e, t, n) {
2154
2157
  }
2155
2158
  }
2156
2159
  }
2157
- function wo(e) {
2160
+ function Ao(e) {
2158
2161
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
2159
- Object.keys(I).forEach((n) => {
2160
- I[n].filter((i) => i.scope === t && i.shortcut === e).forEach((i) => {
2162
+ Object.keys(N).forEach((n) => {
2163
+ N[n].filter((i) => i.scope === t && i.shortcut === e).forEach((i) => {
2161
2164
  i && i.method && i.method();
2162
2165
  });
2163
2166
  });
2164
2167
  }
2165
2168
  function Pt(e) {
2166
- const t = Object.values(I).flat();
2169
+ const t = Object.values(N).flat();
2167
2170
  if (t.findIndex((o) => {
2168
2171
  let {
2169
2172
  element: i
@@ -2174,17 +2177,17 @@ function Pt(e) {
2174
2177
  keydownListener: o,
2175
2178
  keyupListenr: i,
2176
2179
  capture: r
2177
- } = G.get(e) || {};
2178
- o && i && (et(e, "keyup", i, r), et(e, "keydown", o, r), G.delete(e));
2180
+ } = W.get(e) || {};
2181
+ o && i && (et(e, "keyup", i, r), et(e, "keydown", o, r), W.delete(e));
2179
2182
  }
2180
- if ((t.length <= 0 || G.size <= 0) && (Object.keys(G).forEach((i) => {
2183
+ if ((t.length <= 0 || W.size <= 0) && (Object.keys(W).forEach((i) => {
2181
2184
  const {
2182
2185
  keydownListener: r,
2183
2186
  keyupListenr: s,
2184
2187
  capture: a
2185
- } = G.get(i) || {};
2186
- r && s && (et(i, "keyup", s, a), et(i, "keydown", r, a), G.delete(i));
2187
- }), G.clear(), Object.keys(I).forEach((i) => delete I[i]), rt)) {
2188
+ } = W.get(i) || {};
2189
+ r && s && (et(i, "keyup", s, a), et(i, "keydown", r, a), W.delete(i));
2190
+ }), W.clear(), Object.keys(N).forEach((i) => delete N[i]), rt)) {
2188
2191
  const {
2189
2192
  listener: i,
2190
2193
  capture: r
@@ -2192,23 +2195,23 @@ function Pt(e) {
2192
2195
  et(window, "focus", i, r), rt = null;
2193
2196
  }
2194
2197
  }
2195
- const kt = {
2196
- getPressedKeyString: fo,
2198
+ const Rt = {
2199
+ getPressedKeyString: po,
2197
2200
  setScope: ge,
2198
2201
  getScope: st,
2199
- deleteScope: mo,
2200
- getPressedKeyCodes: uo,
2201
- getAllKeyCodes: po,
2202
- isPressed: go,
2203
- filter: ho,
2204
- trigger: wo,
2202
+ deleteScope: bo,
2203
+ getPressedKeyCodes: fo,
2204
+ getAllKeyCodes: ho,
2205
+ isPressed: mo,
2206
+ filter: go,
2207
+ trigger: Ao,
2205
2208
  unbind: me,
2206
2209
  keyMap: at,
2207
- modifier: X,
2210
+ modifier: $,
2208
2211
  modifierMap: Ot
2209
2212
  };
2210
- for (const e in kt)
2211
- Object.prototype.hasOwnProperty.call(kt, e) && (U[e] = kt[e]);
2213
+ for (const e in Rt)
2214
+ Object.prototype.hasOwnProperty.call(Rt, e) && (U[e] = Rt[e]);
2212
2215
  if (typeof window < "u") {
2213
2216
  const e = window.hotkeys;
2214
2217
  U.noConflict = (t) => (t && window.hotkeys === U && (window.hotkeys = e), U), window.hotkeys = U;
@@ -2219,7 +2222,7 @@ var be = {};
2219
2222
  t.Unidentified = "Unidentified", t.Alt = "Alt", t.AltGraph = "AltGraph", t.CapsLock = "CapsLock", t.Control = "Control", t.Fn = "Fn", t.FnLock = "FnLock", t.Hyper = "Hyper", t.Meta = "Meta", t.NumLock = "NumLock", t.ScrollLock = "ScrollLock", t.Shift = "Shift", t.Super = "Super", t.Symbol = "Symbol", t.SymbolLock = "SymbolLock", t.Enter = "Enter", t.Tab = "Tab", t.ArrowDown = "ArrowDown", t.ArrowLeft = "ArrowLeft", t.ArrowRight = "ArrowRight", t.ArrowUp = "ArrowUp", t.End = "End", t.Home = "Home", t.PageDown = "PageDown", t.PageUp = "PageUp", t.Backspace = "Backspace", t.Clear = "Clear", t.Copy = "Copy", t.CrSel = "CrSel", t.Cut = "Cut", t.Delete = "Delete", t.EraseEof = "EraseEof", t.ExSel = "ExSel", t.Insert = "Insert", t.Paste = "Paste", t.Redo = "Redo", t.Undo = "Undo", t.Accept = "Accept", t.Again = "Again", t.Attn = "Attn", t.Cancel = "Cancel", t.ContextMenu = "ContextMenu", t.Escape = "Escape", t.Execute = "Execute", t.Find = "Find", t.Finish = "Finish", t.Help = "Help", t.Pause = "Pause", t.Play = "Play", t.Props = "Props", t.Select = "Select", t.ZoomIn = "ZoomIn", t.ZoomOut = "ZoomOut", t.BrightnessDown = "BrightnessDown", t.BrightnessUp = "BrightnessUp", t.Eject = "Eject", t.LogOff = "LogOff", t.Power = "Power", t.PowerOff = "PowerOff", t.PrintScreen = "PrintScreen", t.Hibernate = "Hibernate", t.Standby = "Standby", t.WakeUp = "WakeUp", t.AllCandidates = "AllCandidates", t.Alphanumeric = "Alphanumeric", t.CodeInput = "CodeInput", t.Compose = "Compose", t.Convert = "Convert", t.Dead = "Dead", t.FinalMode = "FinalMode", t.GroupFirst = "GroupFirst", t.GroupLast = "GroupLast", t.GroupNext = "GroupNext", t.GroupPrevious = "GroupPrevious", t.ModeChange = "ModeChange", t.NextCandidate = "NextCandidate", t.NonConvert = "NonConvert", t.PreviousCandidate = "PreviousCandidate", t.Process = "Process", t.SingleCandidate = "SingleCandidate", t.HangulMode = "HangulMode", t.HanjaMode = "HanjaMode", t.JunjaMode = "JunjaMode", t.Eisu = "Eisu", t.Hankaku = "Hankaku", t.Hiragana = "Hiragana", t.HiraganaKatakana = "HiraganaKatakana", t.KanaMode = "KanaMode", t.KanjiMode = "KanjiMode", t.Katakana = "Katakana", t.Romaji = "Romaji", t.Zenkaku = "Zenkaku", t.ZenkakuHanaku = "ZenkakuHanaku", t.F1 = "F1", t.F2 = "F2", t.F3 = "F3", t.F4 = "F4", t.F5 = "F5", t.F6 = "F6", t.F7 = "F7", t.F8 = "F8", t.F9 = "F9", t.F10 = "F10", t.F11 = "F11", t.F12 = "F12", t.F13 = "F13", t.F14 = "F14", t.F15 = "F15", t.F16 = "F16", t.F17 = "F17", t.F18 = "F18", t.F19 = "F19", t.F20 = "F20", t.Soft1 = "Soft1", t.Soft2 = "Soft2", t.Soft3 = "Soft3", t.Soft4 = "Soft4", t.AppSwitch = "AppSwitch", t.Call = "Call", t.Camera = "Camera", t.CameraFocus = "CameraFocus", t.EndCall = "EndCall", t.GoBack = "GoBack", t.GoHome = "GoHome", t.HeadsetHook = "HeadsetHook", t.LastNumberRedial = "LastNumberRedial", t.Notification = "Notification", t.MannerMode = "MannerMode", t.VoiceDial = "VoiceDial", t.ChannelDown = "ChannelDown", t.ChannelUp = "ChannelUp", t.MediaFastForward = "MediaFastForward", t.MediaPause = "MediaPause", t.MediaPlay = "MediaPlay", t.MediaPlayPause = "MediaPlayPause", t.MediaRecord = "MediaRecord", t.MediaRewind = "MediaRewind", t.MediaStop = "MediaStop", t.MediaTrackNext = "MediaTrackNext", t.MediaTrackPrevious = "MediaTrackPrevious", t.AudioBalanceLeft = "AudioBalanceLeft", t.AudioBalanceRight = "AudioBalanceRight", t.AudioBassDown = "AudioBassDown", t.AudioBassBoostDown = "AudioBassBoostDown", t.AudioBassBoostToggle = "AudioBassBoostToggle", t.AudioBassBoostUp = "AudioBassBoostUp", t.AudioBassUp = "AudioBassUp", t.AudioFaderFront = "AudioFaderFront", t.AudioFaderRear = "AudioFaderRear", t.AudioSurroundModeNext = "AudioSurroundModeNext", t.AudioTrebleDown = "AudioTrebleDown", t.AudioTrebleUp = "AudioTrebleUp", t.AudioVolumeDown = "AudioVolumeDown", t.AudioVolumeMute = "AudioVolumeMute", t.AudioVolumeUp = "AudioVolumeUp", t.MicrophoneToggle = "MicrophoneToggle", t.MicrophoneVolumeDown = "MicrophoneVolumeDown", t.MicrophoneVolumeMute = "MicrophoneVolumeMute", t.MicrophoneVolumeUp = "MicrophoneVolumeUp", t.TV = "TV", t.TV3DMode = "TV3DMode", t.TVAntennaCable = "TVAntennaCable", t.TVAudioDescription = "TVAudioDescription", t.TVAudioDescriptionMixDown = "TVAudioDescriptionMixDown", t.TVAudioDescriptionMixUp = "TVAudioDescriptionMixUp", t.TVContentsMenu = "TVContentsMenu", t.TVDataService = "TVDataService", t.TVInput = "TVInput", t.TVInputComponent1 = "TVInputComponent1", t.TVInputComponent2 = "TVInputComponent2", t.TVInputComposite1 = "TVInputComposite1", t.TVInputComposite2 = "TVInputComposite2", t.TVInputHDMI1 = "TVInputHDMI1", t.TVInputHDMI2 = "TVInputHDMI2", t.TVInputHDMI3 = "TVInputHDMI3", t.TVInputHDMI4 = "TVInputHDMI4", t.TVInputVGA1 = "TVInputVGA1", t.TVMediaContext = "TVMediaContext", t.TVNetwork = "TVNetwork", t.TVNumberEntry = "TVNumberEntry", t.TVPower = "TVPower", t.TVRadioService = "TVRadioService", t.TVSatellite = "TVSatellite", t.TVSatelliteBS = "TVSatelliteBS", t.TVSatelliteCS = "TVSatelliteCS", t.TVSatelliteToggle = "TVSatelliteToggle", t.TVTerrestrialAnalog = "TVTerrestrialAnalog", t.TVTerrestrialDigital = "TVTerrestrialDigital", t.TVTimer = "TVTimer", t.AVRInput = "AVRInput", t.AVRPower = "AVRPower", t.ColorF0Red = "ColorF0Red", t.ColorF1Green = "ColorF1Green", t.ColorF2Yellow = "ColorF2Yellow", t.ColorF3Blue = "ColorF3Blue", t.ColorF4Grey = "ColorF4Grey", t.ColorF5Brown = "ColorF5Brown", t.ClosedCaptionToggle = "ClosedCaptionToggle", t.Dimmer = "Dimmer", t.DisplaySwap = "DisplaySwap", t.DVR = "DVR", t.Exit = "Exit", t.FavoriteClear0 = "FavoriteClear0", t.FavoriteClear1 = "FavoriteClear1", t.FavoriteClear2 = "FavoriteClear2", t.FavoriteClear3 = "FavoriteClear3", t.FavoriteRecall0 = "FavoriteRecall0", t.FavoriteRecall1 = "FavoriteRecall1", t.FavoriteRecall2 = "FavoriteRecall2", t.FavoriteRecall3 = "FavoriteRecall3", t.FavoriteStore0 = "FavoriteStore0", t.FavoriteStore1 = "FavoriteStore1", t.FavoriteStore2 = "FavoriteStore2", t.FavoriteStore3 = "FavoriteStore3", t.Guide = "Guide", t.GuideNextDay = "GuideNextDay", t.GuidePreviousDay = "GuidePreviousDay", t.Info = "Info", t.InstantReplay = "InstantReplay", t.Link = "Link", t.ListProgram = "ListProgram", t.LiveContent = "LiveContent", t.Lock = "Lock", t.MediaApps = "MediaApps", t.MediaAudioTrack = "MediaAudioTrack", t.MediaLast = "MediaLast", t.MediaSkipBackward = "MediaSkipBackward", t.MediaSkipForward = "MediaSkipForward", t.MediaStepBackward = "MediaStepBackward", t.MediaStepForward = "MediaStepForward", t.MediaTopMenu = "MediaTopMenu", t.NavigateIn = "NavigateIn", t.NavigateNext = "NavigateNext", t.NavigateOut = "NavigateOut", t.NavigatePrevious = "NavigatePrevious", t.NextFavoriteChannel = "NextFavoriteChannel", t.NextUserProfile = "NextUserProfile", t.OnDemand = "OnDemand", t.Pairing = "Pairing", t.PinPDown = "PinPDown", t.PinPMove = "PinPMove", t.PinPToggle = "PinPToggle", t.PinPUp = "PinPUp", t.PlaySpeedDown = "PlaySpeedDown", t.PlaySpeedReset = "PlaySpeedReset", t.PlaySpeedUp = "PlaySpeedUp", t.RandomToggle = "RandomToggle", t.RcLowBattery = "RcLowBattery", t.RecordSpeedNext = "RecordSpeedNext", t.RfBypass = "RfBypass", t.ScanChannelsToggle = "ScanChannelsToggle", t.ScreenModeNext = "ScreenModeNext", t.Settings = "Settings", t.SplitScreenToggle = "SplitScreenToggle", t.STBInput = "STBInput", t.STBPower = "STBPower", t.Subtitle = "Subtitle", t.Teletext = "Teletext", t.VideoModeNext = "VideoModeNext", t.Wink = "Wink", t.ZoomToggle = "ZoomToggle", t.SpeechCorrectionList = "SpeechCorrectionList", t.SpeechInputToggle = "SpeechInputToggle", t.Close = "Close", t.New = "New", t.Open = "Open", t.Print = "Print", t.Save = "Save", t.SpellCheck = "SpellCheck", t.MailForward = "MailForward", t.MailReply = "MailReply", t.MailSend = "MailSend", t.LaunchCalculator = "LaunchCalculator", t.LaunchCalendar = "LaunchCalendar", t.LaunchContacts = "LaunchContacts", t.LaunchMail = "LaunchMail", t.LaunchMediaPlayer = "LaunchMediaPlayer", t.LaunchMusicPlayer = "LaunchMusicPlayer", t.LaunchMyComputer = "LaunchMyComputer", t.LaunchPhone = "LaunchPhone", t.LaunchScreenSaver = "LaunchScreenSaver", t.LaunchSpreadsheet = "LaunchSpreadsheet", t.LaunchWebBrowser = "LaunchWebBrowser", t.LaunchWebCam = "LaunchWebCam", t.LaunchWordProcessor = "LaunchWordProcessor", t.LaunchApplication1 = "LaunchApplication1", t.LaunchApplication2 = "LaunchApplication2", t.LaunchApplication3 = "LaunchApplication3", t.LaunchApplication4 = "LaunchApplication4", t.LaunchApplication5 = "LaunchApplication5", t.LaunchApplication6 = "LaunchApplication6", t.LaunchApplication7 = "LaunchApplication7", t.LaunchApplication8 = "LaunchApplication8", t.LaunchApplication9 = "LaunchApplication9", t.LaunchApplication10 = "LaunchApplication10", t.LaunchApplication11 = "LaunchApplication11", t.LaunchApplication12 = "LaunchApplication12", t.LaunchApplication13 = "LaunchApplication13", t.LaunchApplication14 = "LaunchApplication14", t.LaunchApplication15 = "LaunchApplication15", t.LaunchApplication16 = "LaunchApplication16", t.BrowserBack = "BrowserBack", t.BrowserFavorites = "BrowserFavorites", t.BrowserForward = "BrowserForward", t.BrowserHome = "BrowserHome", t.BrowserRefresh = "BrowserRefresh", t.BrowserSearch = "BrowserSearch", t.BrowserStop = "BrowserStop", t.Decimal = "Decimal", t.Key11 = "Key11", t.Key12 = "Key12", t.Multiply = "Multiply", t.Add = "Add", t.Divide = "Divide", t.Subtract = "Subtract", t.Separator = "Separator";
2220
2223
  }(e.Key || (e.Key = {}));
2221
2224
  })(be);
2222
- const Ao = (e, t, n) => {
2225
+ const So = (e, t, n) => {
2223
2226
  let o;
2224
2227
  const i = (h) => o = h;
2225
2228
  let r;
@@ -2227,37 +2230,37 @@ const Ao = (e, t, n) => {
2227
2230
  let a = !0;
2228
2231
  const d = (h) => a = h, { store: f, selection: g } = t;
2229
2232
  let l, m, c;
2230
- const v = (h) => {
2231
- var M;
2233
+ const S = (h) => {
2234
+ var B;
2232
2235
  if (!a || m === !1)
2233
2236
  return;
2234
- l = !((M = h.target.parentElement) != null && M.closest(Y)) ? {
2237
+ l = !((B = h.target.parentElement) != null && B.closest(X)) ? {
2235
2238
  annotation: se(),
2236
2239
  selector: [],
2237
2240
  creator: o,
2238
2241
  created: /* @__PURE__ */ new Date()
2239
2242
  } : void 0;
2240
2243
  };
2241
- e.addEventListener("selectstart", v);
2242
- const C = It((h) => {
2243
- var b, S;
2244
+ e.addEventListener("selectstart", S);
2245
+ const v = Nt((h) => {
2246
+ var x, L;
2244
2247
  if (!a) return;
2245
- const L = document.getSelection();
2246
- if (!!((S = (b = L.anchorNode) == null ? void 0 : b.parentElement) != null && S.closest(Y))) {
2248
+ const E = document.getSelection();
2249
+ if (!!((L = (x = E.anchorNode) == null ? void 0 : x.parentElement) != null && L.closest(X))) {
2247
2250
  l = void 0;
2248
2251
  return;
2249
2252
  }
2250
- if (h.timeStamp - ((c == null ? void 0 : c.timeStamp) || h.timeStamp) < 1e3 && !l && v(c || h), L.isCollapsed || !l || m === !1)
2253
+ if (h.timeStamp - ((c == null ? void 0 : c.timeStamp) || h.timeStamp) < 1e3 && !l && S(c || h), E.isCollapsed || !l || m === !1)
2251
2254
  return;
2252
- const R = L.getRangeAt(0);
2253
- if (Ve(R)) return;
2254
- const T = Le(R.cloneRange());
2255
- (T.length !== l.selector.length || T.some((x, E) => {
2256
- var B;
2257
- return x.toString() !== ((B = l.selector[E]) == null ? void 0 : B.quote);
2255
+ const T = E.getRangeAt(0), M = Pe(T, e);
2256
+ if (Ve(M)) return;
2257
+ const b = Ee(M.cloneRange());
2258
+ (b.length !== l.selector.length || b.some((R, I) => {
2259
+ var _;
2260
+ return R.toString() !== ((_ = l.selector[I]) == null ? void 0 : _.quote);
2258
2261
  })) && (l = {
2259
2262
  ...l,
2260
- selector: T.map((x) => Fe(x, e, n)),
2263
+ selector: b.map((R) => Fe(R, e, n)),
2261
2264
  updated: /* @__PURE__ */ new Date()
2262
2265
  }, f.getAnnotation(l.annotation) ? f.updateTarget(l, V.LOCAL) : (g.clear(), f.addAnnotation({
2263
2266
  id: l.annotation,
@@ -2265,26 +2268,29 @@ const Ao = (e, t, n) => {
2265
2268
  target: l
2266
2269
  }, V.LOCAL), g.userSelect(l.annotation, c)));
2267
2270
  });
2268
- document.addEventListener("selectionchange", C);
2271
+ document.addEventListener("selectionchange", v);
2269
2272
  const w = (h) => {
2270
- c = De(h), m = c.button === 0;
2273
+ c = ye(h), m = c.button === 0;
2271
2274
  };
2272
- e.addEventListener("pointerdown", w);
2275
+ document.addEventListener("pointerdown", w);
2273
2276
  const p = (h) => {
2274
2277
  var T;
2275
- if (!!((T = h.target.parentElement) != null && T.closest(Y)) || !m)
2278
+ if (!!((T = h.target.parentElement) != null && T.closest(X)) || !m)
2276
2279
  return;
2277
- const M = () => {
2278
- const { x: k, y: b } = e.getBoundingClientRect(), S = f.getAt(h.clientX - k, h.clientY - b, r);
2279
- if (S) {
2280
+ const B = () => {
2281
+ const { x: M, y: b } = e.getBoundingClientRect(), C = h.target instanceof Node && e.contains(h.target) && f.getAt(h.clientX - M, h.clientY - b, r);
2282
+ if (C) {
2280
2283
  const { selected: x } = g;
2281
- (x.length !== 1 || x[0].id !== S.id) && g.userSelect(S.id, h);
2284
+ (x.length !== 1 || x[0].id !== C.id) && g.userSelect(C.id, h);
2282
2285
  } else g.isEmpty() || g.clear();
2283
- }, R = h.timeStamp - c.timeStamp;
2284
- document.getSelection().isCollapsed && R < 300 ? (l = void 0, M()) : l && g.userSelect(l.annotation, h);
2286
+ }, k = h.timeStamp - c.timeStamp;
2287
+ setTimeout(() => {
2288
+ const { isCollapsed: M } = document.getSelection();
2289
+ M && k < 300 ? (l = void 0, B()) : l && g.userSelect(l.annotation, h);
2290
+ });
2285
2291
  };
2286
- document.addEventListener("pointerup", p), U("*", { element: e, keyup: !1, keydown: !0 }, (h, L) => {
2287
- h.repeat || (c = ye(h));
2292
+ document.addEventListener("pointerup", p), U("*", { element: e, keyup: !1, keydown: !0 }, (h, E) => {
2293
+ h.repeat || (c = Ue(h));
2288
2294
  }), U("*", { keyup: !0, keydown: !1 }, (h) => {
2289
2295
  U.shift && h.key === be.Key.Shift && !h.repeat && l && g.userSelect(l.annotation, h);
2290
2296
  });
@@ -2295,35 +2301,35 @@ const Ao = (e, t, n) => {
2295
2301
  u && !h.repeat && l && g.userSelect(l.annotation, h), u = !1;
2296
2302
  }), {
2297
2303
  destroy: () => {
2298
- e.removeEventListener("selectstart", v), document.removeEventListener("selectionchange", C), e.removeEventListener("pointerdown", w), document.removeEventListener("pointerup", p), U.unbind();
2304
+ e.removeEventListener("selectstart", S), document.removeEventListener("selectionchange", v), document.removeEventListener("pointerdown", w), document.removeEventListener("pointerup", p), U.unbind();
2299
2305
  },
2300
2306
  setFilter: s,
2301
2307
  setUser: i,
2302
2308
  setAnnotatingEnabled: d
2303
2309
  };
2304
- }, ee = "SPANS", To = (e, t = {}) => {
2305
- Ee(e), Te(e);
2306
- const n = ao(t, {
2310
+ }, ee = "SPANS", Mo = (e, t = {}) => {
2311
+ Le(e), Te(e);
2312
+ const n = so(t, {
2307
2313
  annotatingEnabled: !0,
2308
- user: yn()
2309
- }), o = no(e, n.userSelectAction), { selection: i, viewport: r } = o, s = o.store, a = Bn(s), d = Rn(o, a, n.adapter);
2314
+ user: Un()
2315
+ }), o = oo(e, n.userSelectAction), { selection: i, viewport: r } = o, s = o.store, a = Rn(s), d = Vn(o, a, n.adapter);
2310
2316
  let f = n.user;
2311
- const g = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ee : n.renderer || ee, l = g === "SPANS" ? on(e, o, r) : g === "CSS_HIGHLIGHTS" ? tn(e, o, r) : g === "CANVAS" ? $e(e, o, r) : void 0;
2317
+ const g = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ee : n.renderer || ee, l = g === "SPANS" ? rn(e, o, r) : g === "CSS_HIGHLIGHTS" ? en(e, o, r) : g === "CANVAS" ? je(e, o, r) : void 0;
2312
2318
  if (!l)
2313
2319
  throw `Unknown renderer implementation: ${g}`;
2314
2320
  console.debug(`Using ${g} renderer`), n.style && l.setStyle(n.style);
2315
- const m = Ao(e, o, n.offsetReferenceSelector);
2321
+ const m = So(e, o, n.offsetReferenceSelector);
2316
2322
  m.setUser(f), m.setAnnotatingEnabled(n.annotatingEnabled);
2317
- const c = On(o, a, n.adapter), v = () => f, C = (L) => {
2318
- m.setAnnotatingEnabled(L);
2319
- }, w = (L) => {
2320
- l.setFilter(L), m.setFilter(L);
2321
- }, p = (L) => {
2322
- f = L, m.setUser(L);
2323
- }, u = (L) => {
2324
- L && (l.setPainter(io(e, L, n.presence)), L.on("selectionChange", () => l.redraw()));
2325
- }, A = (L) => {
2326
- L ? i.setSelected(L) : i.clear();
2323
+ const c = Nn(o, a, n.adapter), S = () => f, v = (E) => {
2324
+ m.setAnnotatingEnabled(E);
2325
+ }, w = (E) => {
2326
+ l.setFilter(E), m.setFilter(E);
2327
+ }, p = (E) => {
2328
+ f = E, m.setUser(E);
2329
+ }, u = (E) => {
2330
+ E && (l.setPainter(ro(e, E, n.presence)), E.on("selectionChange", () => l.redraw()));
2331
+ }, A = (E) => {
2332
+ E ? i.setSelected(E) : i.clear();
2327
2333
  };
2328
2334
  return {
2329
2335
  ...c,
@@ -2331,8 +2337,8 @@ const Ao = (e, t, n) => {
2331
2337
  l.destroy(), m.destroy(), a.destroy();
2332
2338
  },
2333
2339
  element: e,
2334
- getUser: v,
2335
- setAnnotatingEnabled: C,
2340
+ getUser: S,
2341
+ setAnnotatingEnabled: v,
2336
2342
  setFilter: w,
2337
2343
  setStyle: l.setStyle.bind(l),
2338
2344
  redraw: l.redraw.bind(l),
@@ -2342,7 +2348,7 @@ const Ao = (e, t, n) => {
2342
2348
  setVisible: l.setVisible.bind(l),
2343
2349
  on: d.on,
2344
2350
  off: d.off,
2345
- scrollIntoView: ro(e, s),
2351
+ scrollIntoView: ao(e, s),
2346
2352
  state: o
2347
2353
  };
2348
2354
  };
@@ -2350,41 +2356,42 @@ export {
2350
2356
  gt as DEFAULT_SELECTED_STYLE,
2351
2357
  q as DEFAULT_STYLE,
2352
2358
  ne as NOT_ANNOTATABLE_CLASS,
2353
- Y as NOT_ANNOTATABLE_SELECTOR,
2359
+ X as NOT_ANNOTATABLE_SELECTOR,
2354
2360
  V as Origin,
2355
- un as UserSelectAction,
2356
- Eo as W3CTextFormat,
2357
- Ee as cancelSingleClickEvents,
2358
- ye as cloneKeyboardEvent,
2359
- De as clonePointerEvent,
2361
+ fn as UserSelectAction,
2362
+ To as W3CTextFormat,
2363
+ Le as cancelSingleClickEvents,
2364
+ Ue as cloneKeyboardEvent,
2365
+ ye as clonePointerEvent,
2360
2366
  Lo as createBody,
2361
- $e as createCanvasRenderer,
2362
- tn as createHighlightsRenderer,
2363
- Ke as createRenderer,
2364
- on as createSpansRenderer,
2365
- To as createTextAnnotator,
2366
- no as createTextAnnotatorState,
2367
- It as debounce,
2368
- xo as denormalizeRectWithOffset,
2369
- ao as fillDefaults,
2367
+ je as createCanvasRenderer,
2368
+ en as createHighlightsRenderer,
2369
+ tn as createRenderer,
2370
+ rn as createSpansRenderer,
2371
+ Mo as createTextAnnotator,
2372
+ oo as createTextAnnotatorState,
2373
+ Nt as debounce,
2374
+ Eo as denormalizeRectWithOffset,
2375
+ so as fillDefaults,
2370
2376
  vo as getAnnotatableFragment,
2371
- So as getClientRectsPonyfill,
2372
- ke as getQuoteContext,
2373
- Rt as getRangeAnnotatableContents,
2374
- W as isRevived,
2377
+ Co as getClientRectsPonyfill,
2378
+ Re as getQuoteContext,
2379
+ kt as getRangeAnnotatableContents,
2380
+ z as isRevived,
2375
2381
  Ve as isWhitespaceOrEmpty,
2376
- Ne as mergeClientRects,
2377
- Pe as normalizeRectWithOffset,
2378
- Se as paint,
2379
- $n as parseW3CTextAnnotation,
2382
+ Ie as mergeClientRects,
2383
+ De as normalizeRectWithOffset,
2384
+ ve as paint,
2385
+ jn as parseW3CTextAnnotation,
2380
2386
  Te as programmaticallyFocusable,
2381
2387
  Fe as rangeToSelector,
2382
2388
  bt as reviveAnnotation,
2383
2389
  oe as reviveSelector,
2384
2390
  mt as reviveTarget,
2385
- jn as serializeW3CTextAnnotation,
2386
- Le as splitAnnotatableRanges,
2387
- Co as toDomRectList,
2388
- Re as whitespaceOrEmptyRegex
2391
+ Gn as serializeW3CTextAnnotation,
2392
+ Ee as splitAnnotatableRanges,
2393
+ xo as toDomRectList,
2394
+ Pe as trimRangeToContainer,
2395
+ ke as whitespaceOrEmptyRegex
2389
2396
  };
2390
2397
  //# sourceMappingURL=text-annotator.es.js.map