@soomo/text-annotator 3.2.0-staging.0 → 3.2.0-staging.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,29 @@
1
- const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
1
+ const fe = "not-annotatable", nt = `.${fe}`, rt = (t) => {
2
2
  var n;
3
3
  return !!(t instanceof HTMLElement ? t.closest(nt) : (n = t.parentElement) == null ? void 0 : n.closest(nt));
4
- }, Me = (t) => {
4
+ }, Be = (t) => {
5
5
  const e = t.commonAncestorContainer;
6
6
  return !rt(e);
7
- }, Be = (t) => t.addEventListener("click", (e) => {
7
+ }, ke = (t) => t.addEventListener("click", (e) => {
8
8
  // Allow clicks within not-annotatable elements
9
9
  !e.target.closest(nt) && !e.target.closest("a") && e.preventDefault();
10
- }), ke = typeof navigator < "u" && // @ts-ignore
11
- /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Ie = (t) => {
10
+ }), Ie = typeof navigator < "u" && // @ts-ignore
11
+ /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Ne = (t) => {
12
12
  !t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
13
- }, Ne = function* (t) {
13
+ }, _e = function* (t) {
14
14
  const e = document.createNodeIterator(
15
15
  t.commonAncestorContainer,
16
16
  NodeFilter.SHOW_ELEMENT,
17
- (o) => o instanceof HTMLElement && o.classList.contains(ue) && !o.parentElement.closest(nt) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
17
+ (o) => o instanceof HTMLElement && o.classList.contains(fe) && !o.parentElement.closest(nt) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
18
18
  );
19
19
  let n;
20
20
  for (; n = e.nextNode(); )
21
21
  n instanceof HTMLElement && (yield n);
22
- }, _e = (t) => {
23
- if (!Me(t)) return [];
22
+ }, Ue = (t) => {
23
+ if (!Be(t)) return [];
24
24
  const e = [];
25
25
  let n = null;
26
- for (const o of Ne(t)) {
26
+ for (const o of _e(t)) {
27
27
  let i;
28
28
  n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
29
29
  }
@@ -35,7 +35,7 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
35
35
  }, Kt = (t) => {
36
36
  const e = t.cloneContents();
37
37
  return e.querySelectorAll(nt).forEach((n) => n.remove()), e;
38
- }, Ue = (t, e, n = 10, o) => {
38
+ }, De = (t, e, n = 10, o) => {
39
39
  const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();
40
40
  s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
41
41
  const a = Kt(s).textContent, r = document.createRange();
@@ -45,7 +45,7 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
45
45
  prefix: a.substring(a.length - n),
46
46
  suffix: l.substring(0, n)
47
47
  };
48
- }, q = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), De = /^\s*$/, Ve = (t) => De.test(t.toString()), Ye = (t, e) => {
48
+ }, q = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), Ve = /^\s*$/, Ye = (t) => Ve.test(t.toString()), Ke = (t, e) => {
49
49
  const n = (s) => Math.round(s * 10) / 10, o = {
50
50
  top: n(t.top),
51
51
  bottom: n(t.bottom),
@@ -69,7 +69,7 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
69
69
  return "block-contains";
70
70
  } else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
71
71
  return "block-is-contained";
72
- }, Ke = (t, e) => {
72
+ }, Xe = (t, e) => {
73
73
  const n = Math.min(t.left, e.left), o = Math.max(t.right, e.right), i = Math.min(t.top, e.top), s = Math.max(t.bottom, e.bottom);
74
74
  return new DOMRect(n, i, o - n, s - i);
75
75
  }, Pe = (t) => t.reduce((e, n) => {
@@ -77,9 +77,9 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
77
77
  return e;
78
78
  let o = [...e], i = !1;
79
79
  for (const s of e) {
80
- const a = Ye(n, s);
80
+ const a = Ke(n, s);
81
81
  if (a === "inline-adjacent") {
82
- o = o.map((r) => r === s ? Ke(n, s) : r), i = !0;
82
+ o = o.map((r) => r === s ? Xe(n, s) : r), i = !0;
83
83
  break;
84
84
  } else if (a === "inline-contains") {
85
85
  o = o.map((r) => r === s ? n : r), i = !0;
@@ -93,19 +93,19 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
93
93
  }
94
94
  }
95
95
  return i ? o : [...o, n];
96
- }, []), Bo = (t) => ({
96
+ }, []), ko = (t) => ({
97
97
  length: t.length,
98
98
  item: (e) => t[e],
99
99
  [Symbol.iterator]: function* () {
100
100
  for (let e = 0; e < this.length; e++)
101
101
  yield this.item(e);
102
102
  }
103
- }), Xe = (t, e, n) => {
103
+ }), $e = (t, e, n) => {
104
104
  const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
105
105
  o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
106
106
  const s = Kt(o).textContent, a = t.toString(), r = s.length || 0, l = r + a.length;
107
107
  return n ? { quote: a, start: r, end: l, range: t, offsetReference: i } : { quote: a, start: r, end: l, range: t };
108
- }, fe = (t, e) => {
108
+ }, he = (t, e) => {
109
109
  var g, u;
110
110
  const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
111
111
  e,
@@ -145,20 +145,20 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
145
145
  };
146
146
  }, vt = (t, e) => q(t.selector) ? t : {
147
147
  ...t,
148
- selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : fe(n, e))
149
- }, Lt = (t, e) => q(t.target.selector) ? t : { ...t, target: vt(t.target, e) }, he = (t, e) => {
148
+ selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : he(n, e))
149
+ }, Lt = (t, e) => q(t.target.selector) ? t : { ...t, target: vt(t.target, e) }, pe = (t, e) => {
150
150
  if (t.isEqualNode(e))
151
151
  return !0;
152
152
  for (let n of t.childNodes)
153
- if (he(n, e))
153
+ if (pe(n, e))
154
154
  return !0;
155
155
  return !1;
156
- }, $e = (t, e) => {
157
- const n = t.cloneContents();
158
- return he(n, e);
159
156
  }, He = (t, e) => {
157
+ const n = t.cloneContents();
158
+ return pe(n, e);
159
+ }, je = (t, e) => {
160
160
  const n = t.cloneRange(), o = e.contains(n.startContainer), i = e.contains(n.endContainer);
161
- return !o && !i && !$e(n, e) ? (n.collapse(), n) : (o || n.setStart(e, 0), i || n.setEnd(e, e.childNodes.length), n);
161
+ return !o && !i && !He(n, e) ? (n.collapse(), n) : (o || n.setStart(e, 0), i || n.setEnd(e, e.childNodes.length), n);
162
162
  }, Tt = (t) => ({
163
163
  ...t,
164
164
  type: t.type,
@@ -201,30 +201,30 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
201
201
  defaultPrevented: t.defaultPrevented,
202
202
  detail: t.detail,
203
203
  timeStamp: t.timeStamp
204
- }), je = (t, e) => {
204
+ }), ze = (t, e) => {
205
205
  const { left: n, top: o, right: i, bottom: s } = t;
206
206
  return new DOMRect(n - e.left, o - e.top, i - n, s - o);
207
- }, ko = (t, e) => {
207
+ }, Io = (t, e) => {
208
208
  const { left: n, top: o, right: i, bottom: s } = t;
209
209
  return new DOMRect(n + e.left, o + e.top, i - n, s - o);
210
- }, pe = (t) => {
211
- if (t === null)
210
+ }, ge = (t) => {
211
+ if (!t)
212
212
  return document.scrollingElement;
213
213
  const { overflowY: e } = window.getComputedStyle(t);
214
- return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : pe(t.parentElement);
215
- }, ze = (t, e) => (n) => {
216
- const o = typeof n == "string" ? n : n.id, i = (a) => {
217
- const r = s.getBoundingClientRect(), l = s.clientHeight, d = s.clientWidth, g = a.selector[0].range.getBoundingClientRect(), { width: u, height: h } = e.getAnnotationBounds(o), x = g.top - r.top, p = g.left - r.left, w = s.parentElement ? s.scrollTop : 0, E = s.parentElement ? s.scrollLeft : 0, m = x + w - (l - h) / 2, c = p + E - (d - u) / 2;
218
- s.scroll({ top: m, left: c, behavior: "smooth" });
219
- }, s = pe(t);
214
+ return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : ge(t.parentElement);
215
+ }, zt = (t, e, n) => {
216
+ const o = n.getBoundingClientRect(), i = n.clientHeight, s = n.clientWidth, a = e.selector[0].range.getBoundingClientRect(), { width: r, height: l } = t.getAnnotationBounds(e.annotation), d = a.top - o.top, g = a.left - o.left, u = n.parentElement ? n.scrollTop : 0, h = n.parentElement ? n.scrollLeft : 0, x = d + u - (i - l) / 2, p = g + h - (s - r) / 2;
217
+ n.scroll({ top: x, left: p, behavior: "smooth" });
218
+ }, Fe = (t, e) => (n, o) => {
219
+ const i = typeof n == "string" ? n : n.id, s = o ? typeof o == "string" ? document.getElementById(o) : o : ge(t);
220
220
  if (s) {
221
- const a = e.getAnnotation(o), { range: r } = a.target.selector[0];
221
+ const a = e.getAnnotation(i), { range: r } = a.target.selector[0];
222
222
  if (r && !r.collapsed)
223
- return i(a.target), !0;
223
+ return zt(e, a.target, s), !0;
224
224
  {
225
225
  const l = vt(a.target, t), { range: d } = l.selector[0];
226
226
  if (d && !d.collapsed)
227
- return i(l), !0;
227
+ return zt(e, l, s), !0;
228
228
  }
229
229
  }
230
230
  return !1;
@@ -234,18 +234,18 @@ const ue = "not-annotatable", nt = `.${ue}`, rt = (t) => {
234
234
  }, St = {
235
235
  fill: "rgb(0, 128, 255)",
236
236
  fillOpacity: 0.45
237
- }, Fe = (t, e, n, o, i) => {
237
+ }, We = (t, e, n, o, i) => {
238
238
  var a, r;
239
239
  const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ? St : G) : n : (r = t.state) != null && r.selected ? St : G;
240
240
  return o && o.paint(t, e) || s;
241
241
  };
242
- function We(t) {
242
+ function qe(t) {
243
243
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
244
244
  }
245
- var gt = { exports: {} }, zt;
246
- function qe() {
247
- if (zt) return gt.exports;
248
- zt = 1;
245
+ var gt = { exports: {} }, Ft;
246
+ function Ge() {
247
+ if (Ft) return gt.exports;
248
+ Ft = 1;
249
249
  function t(e, n = 100, o = {}) {
250
250
  if (typeof e != "function")
251
251
  throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);
@@ -282,11 +282,11 @@ function qe() {
282
282
  }
283
283
  return gt.exports.debounce = t, gt.exports = t, gt.exports;
284
284
  }
285
- var Ge = /* @__PURE__ */ qe();
286
- const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
285
+ var Qe = /* @__PURE__ */ Ge();
286
+ const Pt = /* @__PURE__ */ qe(Qe), Je = (t) => {
287
287
  const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, a = -e, r = o - n, l = i - e;
288
288
  return { top: e, left: n, minX: s, minY: a, maxX: r, maxY: l };
289
- }, Je = (t) => {
289
+ }, Ze = (t) => {
290
290
  let e = /* @__PURE__ */ new Set();
291
291
  return (o) => {
292
292
  const i = o.map((s) => s.id);
@@ -295,14 +295,14 @@ const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
295
295
  }, $t = (t, e, n, o) => {
296
296
  const { store: i, selection: s, hover: a } = e;
297
297
  let r, l, d;
298
- const g = Je(n), u = (T) => {
299
- const { x: M, y: _ } = t.getBoundingClientRect(), X = i.getAt(T.clientX - M, T.clientY - _, !1, l);
300
- X ? a.current !== X.id && (t.classList.add("hovered"), a.set(X.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
298
+ const g = Ze(n), u = (T) => {
299
+ const { x: M, y: _ } = t.getBoundingClientRect(), P = i.getAt(T.clientX - M, T.clientY - _, !1, l);
300
+ P ? a.current !== P.id && (t.classList.add("hovered"), a.set(P.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
301
301
  };
302
302
  t.addEventListener("pointermove", u);
303
303
  const h = (T = !1) => {
304
304
  d && d.clear();
305
- const M = Qe(t), { minX: _, minY: X, maxX: f, maxY: b } = M, A = l ? i.getIntersecting(_, X, f, b).filter(({ annotation: O }) => l(O)) : i.getIntersecting(_, X, f, b), C = s.selected.map(({ id: O }) => O), B = A.map(({ annotation: O, rects: I }) => {
305
+ const M = Je(t), { minX: _, minY: P, maxX: f, maxY: b } = M, A = l ? i.getIntersecting(_, P, f, b).filter(({ annotation: O }) => l(O)) : i.getIntersecting(_, P, f, b), C = s.selected.map(({ id: O }) => O), B = A.map(({ annotation: O, rects: I }) => {
306
306
  const V = C.includes(O.id), Q = O.id === a.current;
307
307
  return { annotation: O, rects: I, state: { selected: V, hover: Q } };
308
308
  });
@@ -317,7 +317,7 @@ const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
317
317
  i.observe(E);
318
318
  const m = s.subscribe(() => h()), c = () => h(!0);
319
319
  document.addEventListener("scroll", c, { capture: !0, passive: !0 });
320
- const y = Xt(() => {
320
+ const y = Pt(() => {
321
321
  i.recalculatePositions(), d == null || d.reset(), h();
322
322
  }, 10);
323
323
  window.addEventListener("resize", y);
@@ -336,14 +336,14 @@ const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
336
336
  setPainter: x,
337
337
  setVisible: o.setVisible
338
338
  };
339
- }, Ze = () => {
339
+ }, tn = () => {
340
340
  const t = document.createElement("canvas");
341
341
  return t.width = window.innerWidth, t.height = window.innerHeight, t.className = "r6o-canvas-highlight-layer bg", t;
342
- }, tn = (t, e) => {
342
+ }, en = (t, e) => {
343
343
  t.width = window.innerWidth, t.height = window.innerHeight;
344
- }, en = (t) => {
344
+ }, nn = (t) => {
345
345
  t.classList.add("r6o-annotatable");
346
- const e = Ze(), n = e.getContext("2d");
346
+ const e = tn(), n = e.getContext("2d");
347
347
  document.body.appendChild(e);
348
348
  const o = (r, l, d, g) => requestAnimationFrame(() => {
349
349
  const { width: u, height: h } = e;
@@ -370,7 +370,7 @@ const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
370
370
  });
371
371
  }
372
372
  });
373
- }), i = Xt(() => tn(e), 10);
373
+ }), i = Pt(() => en(e), 10);
374
374
  return window.addEventListener("resize", i), {
375
375
  destroy: () => {
376
376
  e.remove(), i.clear(), window.removeEventListener("resize", i);
@@ -380,85 +380,85 @@ const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
380
380
  },
381
381
  redraw: o
382
382
  };
383
- }, nn = (t, e, n) => $t(t, e, n, en(t));
384
- var on = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, F = function(t) {
383
+ }, on = (t, e, n) => $t(t, e, n, nn(t));
384
+ var sn = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, F = function(t) {
385
385
  return typeof t == "string" ? t.length > 0 : typeof t == "number";
386
386
  }, D = function(t, e, n) {
387
387
  return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
388
388
  }, $ = function(t, e, n) {
389
389
  return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
390
- }, ge = function(t) {
390
+ }, me = function(t) {
391
391
  return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
392
- }, Ft = function(t) {
392
+ }, Wt = function(t) {
393
393
  return { r: $(t.r, 0, 255), g: $(t.g, 0, 255), b: $(t.b, 0, 255), a: $(t.a) };
394
394
  }, Ot = function(t) {
395
395
  return { r: D(t.r), g: D(t.g), b: D(t.b), a: D(t.a, 3) };
396
- }, sn = /^#([0-9a-f]{3,8})$/i, mt = function(t) {
396
+ }, rn = /^#([0-9a-f]{3,8})$/i, mt = function(t) {
397
397
  var e = t.toString(16);
398
398
  return e.length < 2 ? "0" + e : e;
399
- }, me = function(t) {
399
+ }, ye = function(t) {
400
400
  var e = t.r, n = t.g, o = t.b, i = t.a, s = Math.max(e, n, o), a = s - Math.min(e, n, o), r = a ? s === e ? (n - o) / a : s === n ? 2 + (o - e) / a : 4 + (e - n) / a : 0;
401
401
  return { h: 60 * (r < 0 ? r + 6 : r), s: s ? a / s * 100 : 0, v: s / 255 * 100, a: i };
402
- }, ye = function(t) {
402
+ }, be = function(t) {
403
403
  var e = t.h, n = t.s, o = t.v, i = t.a;
404
404
  e = e / 360 * 6, n /= 100, o /= 100;
405
405
  var s = Math.floor(e), a = o * (1 - n), r = o * (1 - (e - s) * n), l = o * (1 - (1 - e + s) * n), d = s % 6;
406
406
  return { r: 255 * [o, r, a, a, l, o][d], g: 255 * [l, o, o, r, a, a][d], b: 255 * [a, a, l, o, o, r][d], a: i };
407
- }, Wt = function(t) {
408
- return { h: ge(t.h), s: $(t.s, 0, 100), l: $(t.l, 0, 100), a: $(t.a) };
409
407
  }, qt = function(t) {
410
- return { h: D(t.h), s: D(t.s), l: D(t.l), a: D(t.a, 3) };
408
+ return { h: me(t.h), s: $(t.s, 0, 100), l: $(t.l, 0, 100), a: $(t.a) };
411
409
  }, Gt = function(t) {
412
- return ye((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
410
+ return { h: D(t.h), s: D(t.s), l: D(t.l), a: D(t.a, 3) };
411
+ }, Qt = function(t) {
412
+ return be((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
413
413
  var e, n, o;
414
414
  }, lt = function(t) {
415
- return { h: (e = me(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
415
+ return { h: (e = ye(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
416
416
  var e, n, o, i;
417
- }, rn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, an = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, cn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ln = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Qt = { string: [[function(t) {
418
- var e = sn.exec(t);
417
+ }, an = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, cn = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ln = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, dn = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Jt = { string: [[function(t) {
418
+ var e = rn.exec(t);
419
419
  return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? D(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? D(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
420
420
  }, "hex"], [function(t) {
421
- var e = cn.exec(t) || ln.exec(t);
422
- return e ? e[2] !== e[4] || e[4] !== e[6] ? null : Ft({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
421
+ var e = ln.exec(t) || dn.exec(t);
422
+ return e ? e[2] !== e[4] || e[4] !== e[6] ? null : Wt({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
423
423
  }, "rgb"], [function(t) {
424
- var e = rn.exec(t) || an.exec(t);
424
+ var e = an.exec(t) || cn.exec(t);
425
425
  if (!e) return null;
426
- var n, o, i = Wt({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (on[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
427
- return Gt(i);
426
+ var n, o, i = qt({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (sn[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
427
+ return Qt(i);
428
428
  }, "hsl"]], object: [[function(t) {
429
429
  var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;
430
- return F(e) && F(n) && F(o) ? Ft({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;
430
+ return F(e) && F(n) && F(o) ? Wt({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;
431
431
  }, "rgb"], [function(t) {
432
432
  var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;
433
433
  if (!F(e) || !F(n) || !F(o)) return null;
434
- var a = Wt({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });
435
- return Gt(a);
434
+ var a = qt({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });
435
+ return Qt(a);
436
436
  }, "hsl"], [function(t) {
437
437
  var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;
438
438
  if (!F(e) || !F(n) || !F(o)) return null;
439
439
  var a = function(r) {
440
- return { h: ge(r.h), s: $(r.s, 0, 100), v: $(r.v, 0, 100), a: $(r.a) };
440
+ return { h: me(r.h), s: $(r.s, 0, 100), v: $(r.v, 0, 100), a: $(r.a) };
441
441
  }({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });
442
- return ye(a);
443
- }, "hsv"]] }, Jt = function(t, e) {
442
+ return be(a);
443
+ }, "hsv"]] }, Zt = function(t, e) {
444
444
  for (var n = 0; n < e.length; n++) {
445
445
  var o = e[n][0](t);
446
446
  if (o) return [o, e[n][1]];
447
447
  }
448
448
  return [null, void 0];
449
- }, dn = function(t) {
450
- return typeof t == "string" ? Jt(t.trim(), Qt.string) : typeof t == "object" && t !== null ? Jt(t, Qt.object) : [null, void 0];
449
+ }, un = function(t) {
450
+ return typeof t == "string" ? Zt(t.trim(), Jt.string) : typeof t == "object" && t !== null ? Zt(t, Jt.object) : [null, void 0];
451
451
  }, Rt = function(t, e) {
452
452
  var n = lt(t);
453
453
  return { h: n.h, s: $(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
454
454
  }, Mt = function(t) {
455
455
  return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
456
- }, Zt = function(t, e) {
456
+ }, te = function(t, e) {
457
457
  var n = lt(t);
458
458
  return { h: n.h, s: n.s, l: $(n.l + 100 * e, 0, 100), a: n.a };
459
- }, te = function() {
459
+ }, ee = function() {
460
460
  function t(e) {
461
- this.parsed = dn(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
461
+ this.parsed = un(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
462
462
  }
463
463
  return t.prototype.isValid = function() {
464
464
  return this.parsed !== null;
@@ -477,12 +477,12 @@ var on = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, F = function(t) {
477
477
  return e = Ot(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + s + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
478
478
  var e, n, o, i, s;
479
479
  }, t.prototype.toHsl = function() {
480
- return qt(lt(this.rgba));
480
+ return Gt(lt(this.rgba));
481
481
  }, t.prototype.toHslString = function() {
482
- return e = qt(lt(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + s + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
482
+ return e = Gt(lt(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + s + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
483
483
  var e, n, o, i, s;
484
484
  }, t.prototype.toHsv = function() {
485
- return e = me(this.rgba), { h: D(e.h), s: D(e.s), v: D(e.v), a: D(e.a, 3) };
485
+ return e = ye(this.rgba), { h: D(e.h), s: D(e.s), v: D(e.v), a: D(e.a, 3) };
486
486
  var e;
487
487
  }, t.prototype.invert = function() {
488
488
  return j({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
@@ -494,9 +494,9 @@ var on = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, F = function(t) {
494
494
  }, t.prototype.grayscale = function() {
495
495
  return j(Rt(this.rgba, -1));
496
496
  }, t.prototype.lighten = function(e) {
497
- return e === void 0 && (e = 0.1), j(Zt(this.rgba, e));
497
+ return e === void 0 && (e = 0.1), j(te(this.rgba, e));
498
498
  }, t.prototype.darken = function(e) {
499
- return e === void 0 && (e = 0.1), j(Zt(this.rgba, -e));
499
+ return e === void 0 && (e = 0.1), j(te(this.rgba, -e));
500
500
  }, t.prototype.rotate = function(e) {
501
501
  return e === void 0 && (e = 15), this.hue(this.hue() + e);
502
502
  }, t.prototype.alpha = function(e) {
@@ -509,15 +509,15 @@ var on = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, F = function(t) {
509
509
  return this.toHex() === j(e).toHex();
510
510
  }, t;
511
511
  }(), j = function(t) {
512
- return t instanceof te ? t : new te(t);
512
+ return t instanceof ee ? t : new ee(t);
513
513
  };
514
- const un = (t) => [
514
+ const fn = (t) => [
515
515
  `background-color:${j((t == null ? void 0 : t.fill) || G.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? G.fillOpacity : t.fillOpacity).toHex()}`,
516
516
  t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
517
517
  t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
518
518
  t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
519
519
  t != null && t.underlineThickness ? `text-decoration-thickness:${t.underlineThickness}px` : void 0
520
- ].filter(Boolean).join(";"), fn = () => {
520
+ ].filter(Boolean).join(";"), hn = () => {
521
521
  const t = document.createElement("style");
522
522
  document.getElementsByTagName("head")[0].appendChild(t);
523
523
  let e = /* @__PURE__ */ new Set();
@@ -535,7 +535,7 @@ const un = (t) => [
535
535
  const g = s.map((u) => {
536
536
  var p;
537
537
  const h = r ? typeof r == "function" ? r(u.annotation, u.state) : r : (p = u.state) != null && p.selected ? St : G, x = l && l.paint(u, a) || h;
538
- return `::highlight(_${u.annotation.id}) { ${un(x)} }`;
538
+ return `::highlight(_${u.annotation.id}) { ${fn(x)} }`;
539
539
  });
540
540
  t.innerHTML = g.join(`
541
541
  `), CSS.highlights.clear(), s.forEach(({ annotation: u }) => {
@@ -544,9 +544,9 @@ const un = (t) => [
544
544
  }), e = d;
545
545
  }
546
546
  };
547
- }, hn = (t, e, n) => $t(t, e, n, fn());
548
- var ee = Object.prototype.hasOwnProperty;
549
- function Pt(t, e) {
547
+ }, pn = (t, e, n) => $t(t, e, n, hn());
548
+ var ne = Object.prototype.hasOwnProperty;
549
+ function Xt(t, e) {
550
550
  var n, o;
551
551
  if (t === e) return !0;
552
552
  if (t && e && (n = t.constructor) === e.constructor) {
@@ -554,22 +554,22 @@ function Pt(t, e) {
554
554
  if (n === RegExp) return t.toString() === e.toString();
555
555
  if (n === Array) {
556
556
  if ((o = t.length) === e.length)
557
- for (; o-- && Pt(t[o], e[o]); ) ;
557
+ for (; o-- && Xt(t[o], e[o]); ) ;
558
558
  return o === -1;
559
559
  }
560
560
  if (!n || typeof t == "object") {
561
561
  o = 0;
562
562
  for (n in t)
563
- if (ee.call(t, n) && ++o && !ee.call(e, n) || !(n in e) || !Pt(t[n], e[n])) return !1;
563
+ if (ne.call(t, n) && ++o && !ne.call(e, n) || !(n in e) || !Xt(t[n], e[n])) return !1;
564
564
  return Object.keys(e).length === o;
565
565
  }
566
566
  }
567
567
  return t !== t && e !== e;
568
568
  }
569
- const pn = (t, e) => {
569
+ const gn = (t, e) => {
570
570
  const n = (s, a) => s.x <= a.x + a.width && s.x + s.width >= a.x && s.y <= a.y + a.height && s.y + s.height >= a.y, o = (s) => s.rects.reduce((a, r) => a + r.width, 0), i = e.filter(({ rects: s }) => s.some((a) => n(t, a)));
571
571
  return i.sort((s, a) => o(a) - o(s)), i.findIndex((s) => s.rects.includes(t));
572
- }, gn = (t) => {
572
+ }, mn = (t) => {
573
573
  t.classList.add("r6o-annotatable");
574
574
  const e = document.createElement("div");
575
575
  e.className = "r6o-span-highlight-layer", t.insertBefore(e, t.firstChild);
@@ -579,14 +579,14 @@ const pn = (t, e) => {
579
579
  e.remove();
580
580
  },
581
581
  redraw: (a, r, l, d, g) => {
582
- const h = !(Pt(n, a) && g);
582
+ const h = !(Xt(n, a) && g);
583
583
  if (!d && !h) return;
584
584
  h && (e.innerHTML = ""), [...a].sort((p, w) => {
585
585
  const { annotation: { target: { created: E } } } = p, { annotation: { target: { created: m } } } = w;
586
586
  return E && m ? E.getTime() - m.getTime() : 0;
587
587
  }).forEach((p) => {
588
588
  p.rects.map((w) => {
589
- const E = pn(w, a), m = Fe(p, r, l, d, E);
589
+ const E = gn(w, a), m = We(p, r, l, d, E);
590
590
  if (h) {
591
591
  const c = document.createElement("span");
592
592
  c.className = "r6o-annotation", c.dataset.annotation = p.annotation.id, c.style.left = `${w.x}px`, c.style.top = `${w.y}px`, c.style.width = `${w.width}px`, c.style.height = `${w.height}px`, c.style.backgroundColor = j((m == null ? void 0 : m.fill) || G.fill).alpha((m == null ? void 0 : m.fillOpacity) === void 0 ? G.fillOpacity : m.fillOpacity).toHex(), m.underlineStyle && (c.style.borderStyle = m.underlineStyle), m.underlineColor && (c.style.borderColor = m.underlineColor), m.underlineThickness && (c.style.borderBottomWidth = `${m.underlineThickness}px`), m.underlineOffset && (c.style.paddingBottom = `${m.underlineOffset}px`), e.appendChild(c);
@@ -598,34 +598,34 @@ const pn = (t, e) => {
598
598
  a ? e.classList.remove("hidden") : e.classList.add("hidden");
599
599
  }
600
600
  };
601
- }, mn = (t, e, n) => $t(t, e, n, gn(t)), Y = [];
601
+ }, yn = (t, e, n) => $t(t, e, n, mn(t)), Y = [];
602
602
  for (let t = 0; t < 256; ++t)
603
603
  Y.push((t + 256).toString(16).slice(1));
604
- function yn(t, e = 0) {
604
+ function bn(t, e = 0) {
605
605
  return (Y[t[e + 0]] + Y[t[e + 1]] + Y[t[e + 2]] + Y[t[e + 3]] + "-" + Y[t[e + 4]] + Y[t[e + 5]] + "-" + Y[t[e + 6]] + Y[t[e + 7]] + "-" + Y[t[e + 8]] + Y[t[e + 9]] + "-" + Y[t[e + 10]] + Y[t[e + 11]] + Y[t[e + 12]] + Y[t[e + 13]] + Y[t[e + 14]] + Y[t[e + 15]]).toLowerCase();
606
606
  }
607
607
  let Bt;
608
- const bn = new Uint8Array(16);
609
- function wn() {
608
+ const wn = new Uint8Array(16);
609
+ function An() {
610
610
  if (!Bt) {
611
611
  if (typeof crypto > "u" || !crypto.getRandomValues)
612
612
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
613
613
  Bt = crypto.getRandomValues.bind(crypto);
614
614
  }
615
- return Bt(bn);
615
+ return Bt(wn);
616
616
  }
617
- const An = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ne = { randomUUID: An };
618
- function be(t, e, n) {
617
+ const xn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), oe = { randomUUID: xn };
618
+ function we(t, e, n) {
619
619
  var i;
620
- if (ne.randomUUID && !t)
621
- return ne.randomUUID();
620
+ if (oe.randomUUID && !t)
621
+ return oe.randomUUID();
622
622
  t = t || {};
623
- const o = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? wn();
623
+ const o = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? An();
624
624
  if (o.length < 16)
625
625
  throw new Error("Random bytes length must be >= 16");
626
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, yn(o);
626
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, bn(o);
627
627
  }
628
- var oe = Object.prototype.hasOwnProperty;
628
+ var ie = Object.prototype.hasOwnProperty;
629
629
  function J(t, e) {
630
630
  var n, o;
631
631
  if (t === e) return !0;
@@ -640,7 +640,7 @@ function J(t, e) {
640
640
  if (!n || typeof t == "object") {
641
641
  o = 0;
642
642
  for (n in t)
643
- if (oe.call(t, n) && ++o && !oe.call(e, n) || !(n in e) || !J(t[n], e[n])) return !1;
643
+ if (ie.call(t, n) && ++o && !ie.call(e, n) || !(n in e) || !J(t[n], e[n])) return !1;
644
644
  return Object.keys(e).length === o;
645
645
  }
646
646
  }
@@ -648,7 +648,7 @@ function J(t, e) {
648
648
  }
649
649
  function kt() {
650
650
  }
651
- function xn(t, e) {
651
+ function En(t, e) {
652
652
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
653
653
  }
654
654
  const Z = [];
@@ -656,7 +656,7 @@ function Ht(t, e = kt) {
656
656
  let n;
657
657
  const o = /* @__PURE__ */ new Set();
658
658
  function i(r) {
659
- if (xn(t, r) && (t = r, n)) {
659
+ if (En(t, r) && (t = r, n)) {
660
660
  const l = !Z.length;
661
661
  for (const d of o)
662
662
  d[1](), Z.push(d, t);
@@ -678,7 +678,7 @@ function Ht(t, e = kt) {
678
678
  }
679
679
  return { set: i, update: s, subscribe: a };
680
680
  }
681
- const En = (t) => {
681
+ const vn = (t) => {
682
682
  const { subscribe: e, set: n } = Ht();
683
683
  let o;
684
684
  return e((i) => o = i), t.observe(({ changes: i }) => {
@@ -695,8 +695,8 @@ const En = (t) => {
695
695
  set: n
696
696
  };
697
697
  };
698
- var vn = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(vn || {});
699
- const yt = { selected: [] }, Sn = (t, e, n) => {
698
+ var Sn = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(Sn || {});
699
+ const yt = { selected: [] }, Cn = (t, e, n) => {
700
700
  const { subscribe: o, set: i } = Ht(yt);
701
701
  let s = e, a = yt;
702
702
  o((p) => a = p);
@@ -726,7 +726,7 @@ const yt = { selected: [] }, Sn = (t, e, n) => {
726
726
  E = [c];
727
727
  }
728
728
  const m = E.reduce((c, y) => {
729
- const S = ie(y, s, n);
729
+ const S = se(y, s, n);
730
730
  return S === "EDIT" ? [...c, { id: y.id, editable: !0 }] : S === "SELECT" ? [...c, { id: y.id }] : c;
731
731
  }, []);
732
732
  i({ selected: m, event: w });
@@ -734,7 +734,7 @@ const yt = { selected: [] }, Sn = (t, e, n) => {
734
734
  const E = Array.isArray(p) ? p : [p], m = E.map((c) => t.getAnnotation(c)).filter((c) => !!c);
735
735
  i({
736
736
  selected: m.map((c) => {
737
- const y = w === void 0 ? ie(c, s, n) === "EDIT" : w;
737
+ const y = w === void 0 ? se(c, s, n) === "EDIT" : w;
738
738
  return { id: c.id, editable: y };
739
739
  })
740
740
  }), m.length !== E.length && console.warn("Invalid selection", p);
@@ -766,35 +766,35 @@ const yt = { selected: [] }, Sn = (t, e, n) => {
766
766
  subscribe: o,
767
767
  userSelect: g
768
768
  };
769
- }, ie = (t, e, n) => {
769
+ }, se = (t, e, n) => {
770
770
  const o = n ? n.serialize(t) : t;
771
771
  return typeof e == "function" ? e(o) : e || "EDIT";
772
772
  }, K = [];
773
773
  for (let t = 0; t < 256; ++t)
774
774
  K.push((t + 256).toString(16).slice(1));
775
- function Cn(t, e = 0) {
775
+ function Ln(t, e = 0) {
776
776
  return (K[t[e + 0]] + K[t[e + 1]] + K[t[e + 2]] + K[t[e + 3]] + "-" + K[t[e + 4]] + K[t[e + 5]] + "-" + K[t[e + 6]] + K[t[e + 7]] + "-" + K[t[e + 8]] + K[t[e + 9]] + "-" + K[t[e + 10]] + K[t[e + 11]] + K[t[e + 12]] + K[t[e + 13]] + K[t[e + 14]] + K[t[e + 15]]).toLowerCase();
777
777
  }
778
778
  let It;
779
- const Ln = new Uint8Array(16);
780
- function Tn() {
779
+ const Tn = new Uint8Array(16);
780
+ function On() {
781
781
  if (!It) {
782
782
  if (typeof crypto > "u" || !crypto.getRandomValues)
783
783
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
784
784
  It = crypto.getRandomValues.bind(crypto);
785
785
  }
786
- return It(Ln);
786
+ return It(Tn);
787
787
  }
788
- const On = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), se = { randomUUID: On };
789
- function we(t, e, n) {
788
+ const Rn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), re = { randomUUID: Rn };
789
+ function Ae(t, e, n) {
790
790
  var o;
791
- if (se.randomUUID && !t)
792
- return se.randomUUID();
791
+ if (re.randomUUID && !t)
792
+ return re.randomUUID();
793
793
  t = t || {};
794
- const i = t.random ?? ((o = t.rng) == null ? void 0 : o.call(t)) ?? Tn();
794
+ const i = t.random ?? ((o = t.rng) == null ? void 0 : o.call(t)) ?? On();
795
795
  if (i.length < 16)
796
796
  throw new Error("Random bytes length must be >= 16");
797
- return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Cn(i);
797
+ return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Ln(i);
798
798
  }
799
799
  const Nt = (t) => {
800
800
  const e = (n) => {
@@ -806,34 +806,34 @@ const Nt = (t) => {
806
806
  bodies: (t.bodies || []).map(e),
807
807
  target: e(t.target)
808
808
  };
809
- }, Io = (t, e, n, o) => ({
810
- id: we(),
809
+ }, No = (t, e, n, o) => ({
810
+ id: Ae(),
811
811
  annotation: typeof t == "string" ? t : t.id,
812
812
  created: n || /* @__PURE__ */ new Date(),
813
813
  creator: o,
814
814
  ...e
815
- }), Rn = (t, e) => {
815
+ }), Mn = (t, e) => {
816
816
  const n = new Set(t.bodies.map((o) => o.id));
817
817
  return e.bodies.filter((o) => !n.has(o.id));
818
- }, Mn = (t, e) => {
818
+ }, Bn = (t, e) => {
819
819
  const n = new Set(e.bodies.map((o) => o.id));
820
820
  return t.bodies.filter((o) => !n.has(o.id));
821
- }, Bn = (t, e) => e.bodies.map((n) => {
821
+ }, kn = (t, e) => e.bodies.map((n) => {
822
822
  const o = t.bodies.find((i) => i.id === n.id);
823
823
  return { newBody: n, oldBody: o && !J(o, n) ? o : void 0 };
824
- }).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), kn = (t, e) => !J(t.target, e.target), Ae = (t, e) => {
825
- const n = Rn(t, e), o = Mn(t, e), i = Bn(t, e);
824
+ }).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), In = (t, e) => !J(t.target, e.target), xe = (t, e) => {
825
+ const n = Mn(t, e), o = Bn(t, e), i = kn(t, e);
826
826
  return {
827
827
  oldValue: t,
828
828
  newValue: e,
829
829
  bodiesCreated: n.length > 0 ? n : void 0,
830
830
  bodiesDeleted: o.length > 0 ? o : void 0,
831
831
  bodiesUpdated: i.length > 0 ? i : void 0,
832
- targetUpdated: kn(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
832
+ targetUpdated: In(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
833
833
  };
834
834
  };
835
835
  var k = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t.SILENT = "SILENT", t))(k || {});
836
- const In = (t, e) => {
836
+ const Nn = (t, e) => {
837
837
  var n, o;
838
838
  const { changes: i, origin: s } = e;
839
839
  if (!(t.options.origin ? t.options.origin === s : s !== "SILENT"))
@@ -855,7 +855,7 @@ const In = (t, e) => {
855
855
  return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((r) => a.has(r));
856
856
  } else
857
857
  return !0;
858
- }, Nn = (t, e) => {
858
+ }, _n = (t, e) => {
859
859
  const n = new Set((t.created || []).map((u) => u.id)), o = new Set((t.updated || []).map(({ newValue: u }) => u.id)), i = new Set((e.created || []).map((u) => u.id)), s = new Set((e.deleted || []).map((u) => u.id)), a = new Set((e.updated || []).map(({ oldValue: u }) => u.id)), r = new Set((e.updated || []).filter(({ oldValue: u }) => n.has(u.id) || o.has(u.id)).map(({ oldValue: u }) => u.id)), l = [
860
860
  ...(t.created || []).filter((u) => !s.has(u.id)).map((u) => a.has(u.id) ? e.updated.find(({ oldValue: h }) => h.id === u.id).newValue : u),
861
861
  ...e.created || []
@@ -867,7 +867,7 @@ const In = (t, e) => {
867
867
  const { oldValue: h, newValue: x } = u;
868
868
  if (a.has(x.id)) {
869
869
  const p = e.updated.find((w) => w.oldValue.id === x.id).newValue;
870
- return Ae(h, p);
870
+ return xe(h, p);
871
871
  } else
872
872
  return u;
873
873
  }),
@@ -875,7 +875,7 @@ const In = (t, e) => {
875
875
  ];
876
876
  return { created: l, deleted: d, updated: g };
877
877
  }, bt = (t) => {
878
- const e = t.id === void 0 ? we() : t.id;
878
+ const e = t.id === void 0 ? Ae() : t.id;
879
879
  return {
880
880
  ...t,
881
881
  id: e,
@@ -888,7 +888,7 @@ const In = (t, e) => {
888
888
  annotation: e
889
889
  }
890
890
  };
891
- }, _n = (t) => t.id !== void 0, Un = () => {
891
+ }, Un = (t) => t.id !== void 0, Dn = () => {
892
892
  const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (f, b = {}) => {
893
893
  n.push({ onChange: f, options: b });
894
894
  }, i = (f) => {
@@ -905,7 +905,7 @@ const In = (t, e) => {
905
905
  state: [...t.values()]
906
906
  };
907
907
  n.forEach((C) => {
908
- In(C, A) && C.onChange(A);
908
+ Nn(C, A) && C.onChange(A);
909
909
  });
910
910
  }, a = (f, b = k.LOCAL) => {
911
911
  if (f.id && t.get(f.id))
@@ -917,12 +917,12 @@ const In = (t, e) => {
917
917
  }, r = (f, b) => {
918
918
  const A = bt(typeof f == "string" ? b : f), C = typeof f == "string" ? f : f.id, B = C && t.get(C);
919
919
  if (B) {
920
- const O = Ae(B, A);
920
+ const O = xe(B, A);
921
921
  return C === A.id ? t.set(C, A) : (t.delete(C), t.set(A.id, A)), B.bodies.forEach((I) => e.delete(I.id)), A.bodies.forEach((I) => e.set(I.id, A.id)), O;
922
922
  } else
923
923
  console.warn(`Cannot update annotation ${C} - does not exist`);
924
924
  }, l = (f, b = k.LOCAL, A = k.LOCAL) => {
925
- const C = _n(b) ? A : b, B = r(f, b);
925
+ const C = Un(b) ? A : b, B = r(f, b);
926
926
  B && s(C, { updated: [B] });
927
927
  }, d = (f, b = k.LOCAL) => {
928
928
  t.get(f.id) ? l(f, b) : a(f, b);
@@ -1045,7 +1045,7 @@ const In = (t, e) => {
1045
1045
  }, _ = (f, b = k.LOCAL) => {
1046
1046
  const A = f.map((C) => T({ id: C.id, annotation: C.annotation }, C)).filter(Boolean);
1047
1047
  s(b, { updated: A });
1048
- }, X = (f) => {
1048
+ }, P = (f) => {
1049
1049
  const b = t.get(f.annotation);
1050
1050
  if (b) {
1051
1051
  const A = {
@@ -1076,7 +1076,7 @@ const In = (t, e) => {
1076
1076
  bulkUpdateAnnotations: g,
1077
1077
  bulkUpdateBodies: _,
1078
1078
  bulkUpdateTargets: (f, b = k.LOCAL) => {
1079
- const A = f.map((C) => X(C)).filter(Boolean);
1079
+ const A = f.map((C) => P(C)).filter(Boolean);
1080
1080
  A.length > 0 && s(b, { updated: A });
1081
1081
  },
1082
1082
  bulkUpsertAnnotations: u,
@@ -1090,13 +1090,13 @@ const In = (t, e) => {
1090
1090
  updateAnnotation: l,
1091
1091
  updateBody: M,
1092
1092
  updateTarget: (f, b = k.LOCAL) => {
1093
- const A = X(f);
1093
+ const A = P(f);
1094
1094
  A && s(b, { updated: [A] });
1095
1095
  },
1096
1096
  upsertAnnotation: d
1097
1097
  };
1098
1098
  };
1099
- let Dn = () => ({
1099
+ let Vn = () => ({
1100
1100
  emit(t, ...e) {
1101
1101
  for (let n = this.events[t] || [], o = 0, i = n.length; o < i; o++)
1102
1102
  n[o](...e);
@@ -1110,17 +1110,17 @@ let Dn = () => ({
1110
1110
  };
1111
1111
  }
1112
1112
  });
1113
- const Vn = 250, Yn = (t, e) => {
1114
- const n = Dn(), o = [];
1113
+ const Yn = 250, Kn = (t, e) => {
1114
+ const n = Vn(), o = [];
1115
1115
  let i = -1, s = !1, a = 0;
1116
1116
  const r = (p) => {
1117
1117
  if (!s) {
1118
1118
  const { changes: w } = p, E = performance.now();
1119
- if (E - a > Vn)
1119
+ if (E - a > Yn)
1120
1120
  o.splice(i + 1), o.push(w), i = o.length - 1;
1121
1121
  else {
1122
1122
  const m = o.length - 1;
1123
- o[m] = Nn(o[m], w);
1123
+ o[m] = _n(o[m], w);
1124
1124
  }
1125
1125
  a = E;
1126
1126
  }
@@ -1149,7 +1149,7 @@ const Vn = 250, Yn = (t, e) => {
1149
1149
  }
1150
1150
  }
1151
1151
  };
1152
- }, Kn = () => {
1152
+ }, Xn = () => {
1153
1153
  const { subscribe: t, set: e } = Ht([]);
1154
1154
  return {
1155
1155
  subscribe: t,
@@ -1223,7 +1223,7 @@ const Vn = 250, Yn = (t, e) => {
1223
1223
  w ? (m || []).forEach((c) => x("updateAnnotation", c.oldValue, c.newValue)) : (m || []).forEach((c) => x("updateAnnotation", c.newValue, c.oldValue));
1224
1224
  };
1225
1225
  return e.on("undo", p(!0)), e.on("redo", p(!1)), { on: u, off: h, emit: x };
1226
- }, Xn = (t) => (e) => e.reduce((n, o) => {
1226
+ }, $n = (t) => (e) => e.reduce((n, o) => {
1227
1227
  const { parsed: i, error: s } = t.parse(o);
1228
1228
  return s ? {
1229
1229
  parsed: n.parsed,
@@ -1234,7 +1234,7 @@ const Vn = 250, Yn = (t, e) => {
1234
1234
  } : {
1235
1235
  ...n
1236
1236
  };
1237
- }, { parsed: [], failed: [] }), $n = (t, e, n) => {
1237
+ }, { parsed: [], failed: [] }), Hn = (t, e, n) => {
1238
1238
  const { store: o, selection: i } = t, s = (m) => {
1239
1239
  if (n) {
1240
1240
  const { parsed: c, error: y } = n.parse(m);
@@ -1260,7 +1260,7 @@ const Vn = 250, Yn = (t, e) => {
1260
1260
  }
1261
1261
  }, x = (m, c = !0) => {
1262
1262
  if (n) {
1263
- const y = n.parseAll || Xn(n), { parsed: S, failed: v } = y(m);
1263
+ const y = n.parseAll || $n(n), { parsed: S, failed: v } = y(m);
1264
1264
  v.length > 0 && console.warn(`Discarded ${v.length} invalid annotations`, v), o.bulkAddAnnotations(S, c, k.REMOTE);
1265
1265
  } else
1266
1266
  o.bulkAddAnnotations(m.map(Nt), c, k.REMOTE);
@@ -1296,8 +1296,8 @@ const Vn = 250, Yn = (t, e) => {
1296
1296
  undo: e.undo,
1297
1297
  updateAnnotation: E
1298
1298
  };
1299
- }, Hn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
1300
- let jn = (t) => crypto.getRandomValues(new Uint8Array(t)), zn = (t, e, n) => {
1299
+ }, jn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
1300
+ let zn = (t) => crypto.getRandomValues(new Uint8Array(t)), Fn = (t, e, n) => {
1301
1301
  let o = (2 << Math.log2(t.length - 1)) - 1, i = -~(1.6 * o * e / t.length);
1302
1302
  return (s = e) => {
1303
1303
  let a = "";
@@ -1307,13 +1307,13 @@ let jn = (t) => crypto.getRandomValues(new Uint8Array(t)), zn = (t, e, n) => {
1307
1307
  if (a += t[r[l] & o] || "", a.length >= s) return a;
1308
1308
  }
1309
1309
  };
1310
- }, Fn = (t, e = 21) => zn(t, e | 0, jn), Wn = (t = 21) => {
1310
+ }, Wn = (t, e = 21) => Fn(t, e | 0, zn), qn = (t = 21) => {
1311
1311
  let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
1312
1312
  for (; t--; )
1313
- e += Hn[n[t] & 63];
1313
+ e += jn[n[t] & 63];
1314
1314
  return e;
1315
1315
  };
1316
- const qn = () => ({ isGuest: !0, id: Fn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Gn = (t) => {
1316
+ const Gn = () => ({ isGuest: !0, id: Wn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Qn = (t) => {
1317
1317
  const e = JSON.stringify(t);
1318
1318
  let n = 0;
1319
1319
  for (let o = 0, i = e.length; o < i; o++) {
@@ -1321,20 +1321,20 @@ const qn = () => ({ isGuest: !0, id: Fn("1234567890abcdefghijklmnopqrstuvwxyzABC
1321
1321
  n = (n << 5) - n + s, n |= 0;
1322
1322
  }
1323
1323
  return `${n}`;
1324
- }, xe = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Qn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
1324
+ }, Ee = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Jn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
1325
1325
  const { id: o, type: i, purpose: s, value: a, created: r, modified: l, creator: d, ...g } = n;
1326
1326
  return {
1327
- id: o || `temp-${Gn(n)}`,
1327
+ id: o || `temp-${Qn(n)}`,
1328
1328
  annotation: e,
1329
1329
  type: i,
1330
1330
  purpose: s,
1331
1331
  value: a,
1332
- creator: xe(d),
1332
+ creator: Ee(d),
1333
1333
  created: r ? new Date(r) : void 0,
1334
1334
  updated: l ? new Date(l) : void 0,
1335
1335
  ...g
1336
1336
  };
1337
- }), Jn = (t) => t.map((e) => {
1337
+ }), Zn = (t) => t.map((e) => {
1338
1338
  var n;
1339
1339
  const { annotation: o, created: i, updated: s, ...a } = e, r = {
1340
1340
  ...a,
@@ -1343,11 +1343,11 @@ const qn = () => ({ isGuest: !0, id: Fn("1234567890abcdefghijklmnopqrstuvwxyzABC
1343
1343
  };
1344
1344
  return (n = r.id) != null && n.startsWith("temp-") && delete r.id, r;
1345
1345
  });
1346
- Wn();
1347
- const No = (t, e) => ({
1348
- parse: (n) => eo(n),
1349
- serialize: (n) => no(n, t, e)
1350
- }), Zn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, to = (t) => {
1346
+ qn();
1347
+ const _o = (t, e) => ({
1348
+ parse: (n) => no(n),
1349
+ serialize: (n) => oo(n, t, e)
1350
+ }), to = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, eo = (t) => {
1351
1351
  const {
1352
1352
  id: e,
1353
1353
  creator: n,
@@ -1358,7 +1358,7 @@ const No = (t, e) => ({
1358
1358
  if (a.length === 0)
1359
1359
  return { error: Error(`No targets found for annotation: ${t.id}`) };
1360
1360
  const r = {
1361
- creator: xe(n),
1361
+ creator: Ee(n),
1362
1362
  created: o ? new Date(o) : void 0,
1363
1363
  updated: i ? new Date(i) : void 0,
1364
1364
  annotation: e,
@@ -1378,7 +1378,7 @@ const No = (t, e) => ({
1378
1378
  }
1379
1379
  return u;
1380
1380
  }, {});
1381
- if (r.outdated || (r.outdated = "outdated" in l ? l.outdated : void 0), Zn(g))
1381
+ if (r.outdated || (r.outdated = "outdated" in l ? l.outdated : void 0), to(g))
1382
1382
  r.selector.push(
1383
1383
  {
1384
1384
  ...g,
@@ -1396,14 +1396,14 @@ const No = (t, e) => ({
1396
1396
  }
1397
1397
  }
1398
1398
  return { parsed: r };
1399
- }, eo = (t) => {
1400
- const e = t.id || be(), {
1399
+ }, no = (t) => {
1400
+ const e = t.id || we(), {
1401
1401
  creator: n,
1402
1402
  created: o,
1403
1403
  modified: i,
1404
1404
  body: s,
1405
1405
  ...a
1406
- } = t, r = Qn(s, e), l = to(t);
1406
+ } = t, r = Jn(s, e), l = eo(t);
1407
1407
  return "error" in l ? { error: l.error } : {
1408
1408
  parsed: {
1409
1409
  ...a,
@@ -1412,7 +1412,7 @@ const No = (t, e) => ({
1412
1412
  target: l.parsed
1413
1413
  }
1414
1414
  };
1415
- }, no = (t, e, n) => {
1415
+ }, oo = (t, e, n) => {
1416
1416
  const { bodies: o, target: i, ...s } = t, {
1417
1417
  selector: a,
1418
1418
  creator: r,
@@ -1425,7 +1425,7 @@ const No = (t, e) => ({
1425
1425
  exact: p
1426
1426
  };
1427
1427
  if (n) {
1428
- const { prefix: S, suffix: v } = Ue(m, n);
1428
+ const { prefix: S, suffix: v } = De(m, n);
1429
1429
  c.prefix = S, c.suffix = v;
1430
1430
  }
1431
1431
  const y = {
@@ -1447,18 +1447,18 @@ const No = (t, e) => ({
1447
1447
  "@context": "http://www.w3.org/ns/anno.jsonld",
1448
1448
  id: t.id,
1449
1449
  type: "Annotation",
1450
- body: Jn(t.bodies),
1450
+ body: Zn(t.bodies),
1451
1451
  creator: r,
1452
1452
  created: l == null ? void 0 : l.toISOString(),
1453
1453
  modified: d == null ? void 0 : d.toISOString(),
1454
1454
  target: u
1455
1455
  };
1456
1456
  };
1457
- function Ee(t, e, n = 0, o = t.length - 1, i = oo) {
1457
+ function ve(t, e, n = 0, o = t.length - 1, i = io) {
1458
1458
  for (; o > n; ) {
1459
1459
  if (o - n > 600) {
1460
1460
  const l = o - n + 1, d = e - n + 1, g = Math.log(l), u = 0.5 * Math.exp(2 * g / 3), h = 0.5 * Math.sqrt(g * u * (l - u) / l) * (d - l / 2 < 0 ? -1 : 1), x = Math.max(n, Math.floor(e - d * u / l + h)), p = Math.min(o, Math.floor(e + (l - d) * u / l + h));
1461
- Ee(t, e, x, p, i);
1461
+ ve(t, e, x, p, i);
1462
1462
  }
1463
1463
  const s = t[e];
1464
1464
  let a = n, r = o;
@@ -1473,10 +1473,10 @@ function it(t, e, n) {
1473
1473
  const o = t[e];
1474
1474
  t[e] = t[n], t[n] = o;
1475
1475
  }
1476
- function oo(t, e) {
1476
+ function io(t, e) {
1477
1477
  return t < e ? -1 : t > e ? 1 : 0;
1478
1478
  }
1479
- class io {
1479
+ class so {
1480
1480
  constructor(e = 9) {
1481
1481
  this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
1482
1482
  }
@@ -1547,7 +1547,7 @@ class io {
1547
1547
  let r, l, d;
1548
1548
  for (; o || s.length; ) {
1549
1549
  if (o || (o = s.pop(), l = s[s.length - 1], r = a.pop(), d = !0), o.leaf) {
1550
- const g = so(e, o.children, n);
1550
+ const g = ro(e, o.children, n);
1551
1551
  if (g !== -1)
1552
1552
  return o.children.splice(g, 1), s.push(o), this._condense(s), this;
1553
1553
  }
@@ -1583,10 +1583,10 @@ class io {
1583
1583
  return r = et(e.slice(n, o + 1)), tt(r, this.toBBox), r;
1584
1584
  i || (i = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, i - 1))), r = et([]), r.leaf = !1, r.height = i;
1585
1585
  const l = Math.ceil(s / a), d = l * Math.ceil(Math.sqrt(a));
1586
- re(e, n, o, d, this.compareMinX);
1586
+ ae(e, n, o, d, this.compareMinX);
1587
1587
  for (let g = n; g <= o; g += d) {
1588
1588
  const u = Math.min(g + d - 1, o);
1589
- re(e, g, u, l, this.compareMinY);
1589
+ ae(e, g, u, l, this.compareMinY);
1590
1590
  for (let h = g; h <= u; h += l) {
1591
1591
  const x = Math.min(h + l - 1, u);
1592
1592
  r.children.push(this._build(e, h, x, i - 1));
@@ -1598,7 +1598,7 @@ class io {
1598
1598
  for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
1599
1599
  let s = 1 / 0, a = 1 / 0, r;
1600
1600
  for (let l = 0; l < n.children.length; l++) {
1601
- const d = n.children[l], g = _t(d), u = co(e, d) - g;
1601
+ const d = n.children[l], g = _t(d), u = lo(e, d) - g;
1602
1602
  u < a ? (a = u, s = g < s ? g : s, r = d) : u === a && g < s && (s = g, r = d);
1603
1603
  }
1604
1604
  n = r || n.children[0];
@@ -1624,14 +1624,14 @@ class io {
1624
1624
  _chooseSplitIndex(e, n, o) {
1625
1625
  let i, s = 1 / 0, a = 1 / 0;
1626
1626
  for (let r = n; r <= o - n; r++) {
1627
- const l = at(e, 0, r, this.toBBox), d = at(e, r, o, this.toBBox), g = lo(l, d), u = _t(l) + _t(d);
1627
+ const l = at(e, 0, r, this.toBBox), d = at(e, r, o, this.toBBox), g = uo(l, d), u = _t(l) + _t(d);
1628
1628
  g < s ? (s = g, i = r, a = u < a ? u : a) : g === s && u < a && (a = u, i = r);
1629
1629
  }
1630
1630
  return i || o - n;
1631
1631
  }
1632
1632
  // sorts node children by the best axis for split
1633
1633
  _chooseSplitAxis(e, n, o) {
1634
- const i = e.leaf ? this.compareMinX : ro, s = e.leaf ? this.compareMinY : ao, a = this._allDistMargin(e, n, o, i), r = this._allDistMargin(e, n, o, s);
1634
+ const i = e.leaf ? this.compareMinX : ao, s = e.leaf ? this.compareMinY : co, a = this._allDistMargin(e, n, o, i), r = this._allDistMargin(e, n, o, s);
1635
1635
  a < r && e.children.sort(i);
1636
1636
  }
1637
1637
  // total margin of all possible split distributions where each node is at least m full
@@ -1658,7 +1658,7 @@ class io {
1658
1658
  e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : tt(e[n], this.toBBox);
1659
1659
  }
1660
1660
  }
1661
- function so(t, e, n) {
1661
+ function ro(t, e, n) {
1662
1662
  if (!n) return e.indexOf(t);
1663
1663
  for (let o = 0; o < e.length; o++)
1664
1664
  if (n(t, e[o])) return o;
@@ -1678,10 +1678,10 @@ function at(t, e, n, o, i) {
1678
1678
  function ct(t, e) {
1679
1679
  return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
1680
1680
  }
1681
- function ro(t, e) {
1681
+ function ao(t, e) {
1682
1682
  return t.minX - e.minX;
1683
1683
  }
1684
- function ao(t, e) {
1684
+ function co(t, e) {
1685
1685
  return t.minY - e.minY;
1686
1686
  }
1687
1687
  function _t(t) {
@@ -1690,10 +1690,10 @@ function _t(t) {
1690
1690
  function wt(t) {
1691
1691
  return t.maxX - t.minX + (t.maxY - t.minY);
1692
1692
  }
1693
- function co(t, e) {
1693
+ function lo(t, e) {
1694
1694
  return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
1695
1695
  }
1696
- function lo(t, e) {
1696
+ function uo(t, e) {
1697
1697
  const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), s = Math.min(t.maxY, e.maxY);
1698
1698
  return Math.max(0, i - n) * Math.max(0, s - o);
1699
1699
  }
@@ -1714,15 +1714,15 @@ function et(t) {
1714
1714
  maxY: -1 / 0
1715
1715
  };
1716
1716
  }
1717
- function re(t, e, n, o, i) {
1717
+ function ae(t, e, n, o, i) {
1718
1718
  const s = [e, n];
1719
1719
  for (; s.length; ) {
1720
1720
  if (n = s.pop(), e = s.pop(), n - e <= o) continue;
1721
1721
  const a = e + Math.ceil((n - e) / o / 2) * o;
1722
- Ee(t, a, e, n, i), s.push(e, a, a, n);
1722
+ ve(t, a, e, n, i), s.push(e, a, a, n);
1723
1723
  }
1724
1724
  }
1725
- let uo = () => ({
1725
+ let fo = () => ({
1726
1726
  emit(t, ...e) {
1727
1727
  for (let n = this.events[t] || [], o = 0, i = n.length; o < i; o++)
1728
1728
  n[o](...e);
@@ -1736,19 +1736,19 @@ let uo = () => ({
1736
1736
  };
1737
1737
  }
1738
1738
  });
1739
- const fo = (t, e) => {
1740
- const n = new io(), o = /* @__PURE__ */ new Map(), i = uo(), s = (y, S) => {
1739
+ const ho = (t, e) => {
1740
+ const n = new so(), o = /* @__PURE__ */ new Map(), i = fo(), s = (y, S) => {
1741
1741
  const v = y.selector.flatMap((R) => {
1742
- const T = q([R]) ? R.range : fe(R, e).range;
1742
+ const T = q([R]) ? R.range : he(R, e).range;
1743
1743
  return Array.from(T.getClientRects());
1744
- }), L = Pe(v).map((R) => je(R, S));
1744
+ }), L = Pe(v).map((R) => ze(R, S));
1745
1745
  return L.map((R) => {
1746
- const { x: T, y: M, width: _, height: X } = R;
1746
+ const { x: T, y: M, width: _, height: P } = R;
1747
1747
  return {
1748
1748
  minX: T,
1749
1749
  minY: M,
1750
1750
  maxX: T + _,
1751
- maxY: M + X,
1751
+ maxY: M + P,
1752
1752
  annotation: {
1753
1753
  id: y.annotation,
1754
1754
  rects: L
@@ -1818,8 +1818,8 @@ const fo = (t, e) => {
1818
1818
  update: g,
1819
1819
  on: (y, S) => i.on(y, S)
1820
1820
  };
1821
- }, ho = (t, e) => {
1822
- const n = Un(), o = fo(n, t), i = Sn(n, e.userSelectAction, e.adapter), s = En(n), a = Kn(), r = (c, y = k.LOCAL) => {
1821
+ }, po = (t, e) => {
1822
+ const n = Dn(), o = ho(n, t), i = Cn(n, e.userSelectAction, e.adapter), s = vn(n), a = Xn(), r = (c, y = k.LOCAL) => {
1823
1823
  const S = Lt(c, t), v = q(S.target.selector);
1824
1824
  return v && n.addAnnotation(S, y), v;
1825
1825
  }, l = (c, y = !0, S = k.LOCAL) => {
@@ -1865,13 +1865,13 @@ const fo = (t, e) => {
1865
1865
  hover: s,
1866
1866
  viewport: a
1867
1867
  };
1868
- }, po = () => {
1868
+ }, go = () => {
1869
1869
  const t = document.createElement("canvas");
1870
1870
  t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = "r6o-presence-layer";
1871
1871
  const e = t.getContext("2d");
1872
1872
  return e.scale(2, 2), e.translate(0.5, 0.5), t;
1873
- }, go = (t, e = {}) => {
1874
- const n = po(), o = n.getContext("2d");
1873
+ }, mo = (t, e = {}) => {
1874
+ const n = go(), o = n.getContext("2d");
1875
1875
  document.body.appendChild(n);
1876
1876
  const i = /* @__PURE__ */ new Map(), s = (g) => Array.from(i.entries()).filter(([u, h]) => h.presenceKey === g.presenceKey).map(([u, h]) => u);
1877
1877
  return t.on("selectionChange", (g, u) => {
@@ -1910,12 +1910,12 @@ function Vt(t, e, n, o) {
1910
1910
  function st(t, e, n, o) {
1911
1911
  t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent("on".concat(e), n);
1912
1912
  }
1913
- function ve(t, e) {
1913
+ function Se(t, e) {
1914
1914
  const n = e.slice(0, e.length - 1);
1915
1915
  for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];
1916
1916
  return n;
1917
1917
  }
1918
- function Se(t) {
1918
+ function Ce(t) {
1919
1919
  typeof t != "string" && (t = ""), t = t.replace(/\s/g, "");
1920
1920
  const e = t.split(",");
1921
1921
  let n = e.lastIndexOf("");
@@ -1923,7 +1923,7 @@ function Se(t) {
1923
1923
  e[n - 1] += ",", e.splice(n, 1), n = e.lastIndexOf("");
1924
1924
  return e;
1925
1925
  }
1926
- function mo(t, e) {
1926
+ function yo(t, e) {
1927
1927
  const n = t.length >= e.length ? t : e, o = t.length >= e.length ? e : t;
1928
1928
  let i = !0;
1929
1929
  for (let s = 0; s < n.length; s++)
@@ -2007,7 +2007,7 @@ const ut = {
2007
2007
  ctrlKey: 17,
2008
2008
  altKey: 18,
2009
2009
  metaKey: 91
2010
- }, P = {
2010
+ }, X = {
2011
2011
  16: !1,
2012
2012
  18: !1,
2013
2013
  17: !1,
@@ -2015,21 +2015,21 @@ const ut = {
2015
2015
  }, U = {};
2016
2016
  for (let t = 1; t < 20; t++)
2017
2017
  ut["f".concat(t)] = 111 + t;
2018
- let N = [], dt = null, Ce = "all";
2019
- const W = /* @__PURE__ */ new Map(), ht = (t) => ut[t.toLowerCase()] || z[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), yo = (t) => Object.keys(ut).find((e) => ut[e] === t), bo = (t) => Object.keys(z).find((e) => z[e] === t);
2020
- function Le(t) {
2021
- Ce = t || "all";
2018
+ let N = [], dt = null, Le = "all";
2019
+ const W = /* @__PURE__ */ new Map(), ht = (t) => ut[t.toLowerCase()] || z[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), bo = (t) => Object.keys(ut).find((e) => ut[e] === t), wo = (t) => Object.keys(z).find((e) => z[e] === t);
2020
+ function Te(t) {
2021
+ Le = t || "all";
2022
2022
  }
2023
2023
  function ft() {
2024
- return Ce || "all";
2025
- }
2026
- function wo() {
2027
- return N.slice(0);
2024
+ return Le || "all";
2028
2025
  }
2029
2026
  function Ao() {
2030
- return N.map((t) => yo(t) || bo(t) || String.fromCharCode(t));
2027
+ return N.slice(0);
2031
2028
  }
2032
2029
  function xo() {
2030
+ return N.map((t) => bo(t) || wo(t) || String.fromCharCode(t));
2031
+ }
2032
+ function Eo() {
2033
2033
  const t = [];
2034
2034
  return Object.keys(U).forEach((e) => {
2035
2035
  U[e].forEach((n) => {
@@ -2048,7 +2048,7 @@ function xo() {
2048
2048
  });
2049
2049
  }), t;
2050
2050
  }
2051
- function Eo(t) {
2051
+ function vo(t) {
2052
2052
  const e = t.target || t.srcElement, {
2053
2053
  tagName: n
2054
2054
  } = e;
@@ -2056,10 +2056,10 @@ function Eo(t) {
2056
2056
  const i = n === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(e.type);
2057
2057
  return (e.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !e.readOnly) && (o = !1), o;
2058
2058
  }
2059
- function vo(t) {
2059
+ function So(t) {
2060
2060
  return typeof t == "string" && (t = ht(t)), N.indexOf(t) !== -1;
2061
2061
  }
2062
- function So(t, e) {
2062
+ function Co(t, e) {
2063
2063
  let n, o;
2064
2064
  t || (t = ft());
2065
2065
  for (const i in U)
@@ -2071,17 +2071,17 @@ function So(t, e) {
2071
2071
  } = a;
2072
2072
  return jt(r);
2073
2073
  }) : o++;
2074
- ft() === t && Le(e || "all");
2074
+ ft() === t && Te(e || "all");
2075
2075
  }
2076
- function Co(t) {
2076
+ function Lo(t) {
2077
2077
  let e = t.keyCode || t.which || t.charCode;
2078
2078
  const n = N.indexOf(e);
2079
- if (n >= 0 && N.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && N.splice(0, N.length), (e === 93 || e === 224) && (e = 91), e in P) {
2080
- P[e] = !1;
2079
+ if (n >= 0 && N.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && N.splice(0, N.length), (e === 93 || e === 224) && (e = 91), e in X) {
2080
+ X[e] = !1;
2081
2081
  for (const o in z) z[o] === e && (H[o] = !1);
2082
2082
  }
2083
2083
  }
2084
- function Te(t) {
2084
+ function Oe(t) {
2085
2085
  if (typeof t > "u")
2086
2086
  Object.keys(U).forEach((i) => {
2087
2087
  Array.isArray(U[i]) && U[i].forEach((s) => xt(s)), delete U[i];
@@ -2111,48 +2111,48 @@ const xt = (t) => {
2111
2111
  method: o,
2112
2112
  splitKey: i = "+"
2113
2113
  } = t;
2114
- Se(e).forEach((a) => {
2114
+ Ce(e).forEach((a) => {
2115
2115
  const r = a.split(i), l = r.length, d = r[l - 1], g = d === "*" ? "*" : ht(d);
2116
2116
  if (!U[g]) return;
2117
2117
  n || (n = ft());
2118
- const u = l > 1 ? ve(z, r) : [], h = [];
2118
+ const u = l > 1 ? Se(z, r) : [], h = [];
2119
2119
  U[g] = U[g].filter((x) => {
2120
- const w = (o ? x.method === o : !0) && x.scope === n && mo(x.mods, u);
2120
+ const w = (o ? x.method === o : !0) && x.scope === n && yo(x.mods, u);
2121
2121
  return w && h.push(x.element), !w;
2122
2122
  }), h.forEach((x) => jt(x));
2123
2123
  });
2124
2124
  };
2125
- function ae(t, e, n, o) {
2125
+ function ce(t, e, n, o) {
2126
2126
  if (e.element !== o)
2127
2127
  return;
2128
2128
  let i;
2129
2129
  if (e.scope === n || e.scope === "all") {
2130
2130
  i = e.mods.length > 0;
2131
- for (const s in P)
2132
- Object.prototype.hasOwnProperty.call(P, s) && (!P[s] && e.mods.indexOf(+s) > -1 || P[s] && e.mods.indexOf(+s) === -1) && (i = !1);
2133
- (e.mods.length === 0 && !P[16] && !P[18] && !P[17] && !P[91] || i || e.shortcut === "*") && (e.keys = [], e.keys = e.keys.concat(N), e.method(t, e) === !1 && (t.preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = !0)));
2131
+ for (const s in X)
2132
+ Object.prototype.hasOwnProperty.call(X, s) && (!X[s] && e.mods.indexOf(+s) > -1 || X[s] && e.mods.indexOf(+s) === -1) && (i = !1);
2133
+ (e.mods.length === 0 && !X[16] && !X[18] && !X[17] && !X[91] || i || e.shortcut === "*") && (e.keys = [], e.keys = e.keys.concat(N), e.method(t, e) === !1 && (t.preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = !0)));
2134
2134
  }
2135
2135
  }
2136
- function ce(t, e) {
2136
+ function le(t, e) {
2137
2137
  const n = U["*"];
2138
2138
  let o = t.keyCode || t.which || t.charCode;
2139
2139
  if (!H.filter.call(this, t)) return;
2140
2140
  if ((o === 93 || o === 224) && (o = 91), N.indexOf(o) === -1 && o !== 229 && N.push(o), ["metaKey", "ctrlKey", "altKey", "shiftKey"].forEach((r) => {
2141
2141
  const l = Et[r];
2142
2142
  t[r] && N.indexOf(l) === -1 ? N.push(l) : !t[r] && N.indexOf(l) > -1 ? N.splice(N.indexOf(l), 1) : r === "metaKey" && t[r] && (N = N.filter((d) => d in Et || d === o));
2143
- }), o in P) {
2144
- P[o] = !0;
2143
+ }), o in X) {
2144
+ X[o] = !0;
2145
2145
  for (const r in z)
2146
2146
  z[r] === o && (H[r] = !0);
2147
2147
  if (!n) return;
2148
2148
  }
2149
- for (const r in P)
2150
- Object.prototype.hasOwnProperty.call(P, r) && (P[r] = t[Et[r]]);
2151
- t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (N.indexOf(17) === -1 && N.push(17), N.indexOf(18) === -1 && N.push(18), P[17] = !0, P[18] = !0);
2149
+ for (const r in X)
2150
+ Object.prototype.hasOwnProperty.call(X, r) && (X[r] = t[Et[r]]);
2151
+ t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (N.indexOf(17) === -1 && N.push(17), N.indexOf(18) === -1 && N.push(18), X[17] = !0, X[18] = !0);
2152
2152
  const i = ft();
2153
2153
  if (n)
2154
2154
  for (let r = 0; r < n.length; r++)
2155
- n[r].scope === i && (t.type === "keydown" && n[r].keydown || t.type === "keyup" && n[r].keyup) && ae(t, n[r], i, e);
2155
+ n[r].scope === i && (t.type === "keydown" && n[r].keydown || t.type === "keyup" && n[r].keyup) && ce(t, n[r], i, e);
2156
2156
  if (!(o in U)) return;
2157
2157
  const s = U[o], a = s.length;
2158
2158
  for (let r = 0; r < a; r++)
@@ -2162,15 +2162,15 @@ function ce(t, e) {
2162
2162
  } = l, g = l.key.split(d), u = [];
2163
2163
  for (let h = 0; h < g.length; h++)
2164
2164
  u.push(ht(g[h]));
2165
- u.sort().join("") === N.sort().join("") && ae(t, l, i, e);
2165
+ u.sort().join("") === N.sort().join("") && ce(t, l, i, e);
2166
2166
  }
2167
2167
  }
2168
2168
  function H(t, e, n) {
2169
2169
  N = [];
2170
- const o = Se(t);
2170
+ const o = Ce(t);
2171
2171
  let i = [], s = "all", a = document, r = 0, l = !1, d = !0, g = "+", u = !1, h = !1;
2172
- for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (a = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (d = e.keydown), e.capture !== void 0 && (u = e.capture), typeof e.splitKey == "string" && (g = e.splitKey), e.single === !0 && (h = !0)), typeof e == "string" && (s = e), h && Te(t, s); r < o.length; r++)
2173
- t = o[r].split(g), i = [], t.length > 1 && (i = ve(z, t)), t = t[t.length - 1], t = t === "*" ? "*" : ht(t), t in U || (U[t] = []), U[t].push({
2172
+ for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (a = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (d = e.keydown), e.capture !== void 0 && (u = e.capture), typeof e.splitKey == "string" && (g = e.splitKey), e.single === !0 && (h = !0)), typeof e == "string" && (s = e), h && Oe(t, s); r < o.length; r++)
2173
+ t = o[r].split(g), i = [], t.length > 1 && (i = Se(z, t)), t = t[t.length - 1], t = t === "*" ? "*" : ht(t), t in U || (U[t] = []), U[t].push({
2174
2174
  keyup: l,
2175
2175
  keydown: d,
2176
2176
  scope: s,
@@ -2185,10 +2185,10 @@ function H(t, e, n) {
2185
2185
  if (!W.has(a)) {
2186
2186
  const x = function() {
2187
2187
  let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2188
- return ce(w, a);
2188
+ return le(w, a);
2189
2189
  }, p = function() {
2190
2190
  let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
2191
- ce(w, a), Co(w);
2191
+ le(w, a), Lo(w);
2192
2192
  };
2193
2193
  W.set(a, {
2194
2194
  keydownListener: x,
@@ -2207,7 +2207,7 @@ function H(t, e, n) {
2207
2207
  }
2208
2208
  }
2209
2209
  }
2210
- function Lo(t) {
2210
+ function To(t) {
2211
2211
  let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
2212
2212
  Object.keys(U).forEach((n) => {
2213
2213
  U[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {
@@ -2246,16 +2246,16 @@ function jt(t) {
2246
2246
  }
2247
2247
  }
2248
2248
  const Yt = {
2249
- getPressedKeyString: Ao,
2250
- setScope: Le,
2249
+ getPressedKeyString: xo,
2250
+ setScope: Te,
2251
2251
  getScope: ft,
2252
- deleteScope: So,
2253
- getPressedKeyCodes: wo,
2254
- getAllKeyCodes: xo,
2255
- isPressed: vo,
2256
- filter: Eo,
2257
- trigger: Lo,
2258
- unbind: Te,
2252
+ deleteScope: Co,
2253
+ getPressedKeyCodes: Ao,
2254
+ getAllKeyCodes: Eo,
2255
+ isPressed: So,
2256
+ filter: vo,
2257
+ trigger: To,
2258
+ unbind: Oe,
2259
2259
  keyMap: ut,
2260
2260
  modifier: z,
2261
2261
  modifierMap: Et
@@ -2266,17 +2266,17 @@ if (typeof window < "u") {
2266
2266
  const t = window.hotkeys;
2267
2267
  H.noConflict = (e) => (e && window.hotkeys === H && (window.hotkeys = t), H), window.hotkeys = H;
2268
2268
  }
2269
- async function To(t, e, n = () => !1) {
2269
+ async function Oo(t, e, n = () => !1) {
2270
2270
  do {
2271
2271
  if (await t(), await n()) break;
2272
2272
  const o = e;
2273
2273
  await new Promise((i) => setTimeout(i, Math.max(0, o)));
2274
2274
  } while (!await n());
2275
2275
  }
2276
- const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+a", Oo = [
2277
- ...Oe.map((t) => `shift+${t}`),
2278
- Re
2279
- ], Ro = (t, e, n) => {
2276
+ const de = 300, Re = ["up", "down", "left", "right"], Me = Ie ? "⌘+a" : "ctrl+a", Ro = [
2277
+ ...Re.map((t) => `shift+${t}`),
2278
+ Me
2279
+ ], Mo = (t, e, n) => {
2280
2280
  const { store: o, selection: i } = e;
2281
2281
  let s;
2282
2282
  const { annotatingEnabled: a, offsetReferenceSelector: r, selectionMode: l } = n, d = (f) => s = f;
@@ -2287,12 +2287,12 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2287
2287
  w = f, c.clear(), f || (h = void 0, x = void 0, p = void 0);
2288
2288
  }, m = (f) => {
2289
2289
  w && x !== !1 && (h = rt(f.target) ? void 0 : {
2290
- annotation: be(),
2290
+ annotation: we(),
2291
2291
  selector: [],
2292
2292
  creator: s,
2293
2293
  created: /* @__PURE__ */ new Date()
2294
2294
  });
2295
- }, c = Xt((f) => {
2295
+ }, c = Pt((f) => {
2296
2296
  if (!w) return;
2297
2297
  const b = document.getSelection();
2298
2298
  if (!(b != null && b.anchorNode))
@@ -2302,20 +2302,20 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2302
2302
  return;
2303
2303
  }
2304
2304
  const A = f.timeStamp - ((p == null ? void 0 : p.timeStamp) || f.timeStamp);
2305
- if ((p == null ? void 0 : p.type) === "pointerdown" && (A < 1e3 && !h || b.isCollapsed && A < le) && m(p || f), !h) return;
2305
+ if ((p == null ? void 0 : p.type) === "pointerdown" && (A < 1e3 && !h || b.isCollapsed && A < de) && m(p || f), !h) return;
2306
2306
  if (b.isCollapsed) {
2307
2307
  o.getAnnotation(h.annotation) && (i.clear(), o.deleteAnnotation(h.annotation));
2308
2308
  return;
2309
2309
  }
2310
- const C = b.getRangeAt(0), B = He(C, t);
2311
- if (Ve(B)) return;
2312
- const O = _e(B.cloneRange());
2310
+ const C = b.getRangeAt(0), B = je(C, t);
2311
+ if (Ye(B)) return;
2312
+ const O = Ue(B.cloneRange());
2313
2313
  (O.length !== h.selector.length || O.some((V, Q) => {
2314
2314
  var Ct;
2315
2315
  return V.toString() !== ((Ct = h.selector[Q]) == null ? void 0 : Ct.quote);
2316
2316
  })) && (h = {
2317
2317
  ...h,
2318
- selector: O.map((V) => Xe(V, t, r)),
2318
+ selector: O.map((V) => $e(V, t, r)),
2319
2319
  updated: /* @__PURE__ */ new Date()
2320
2320
  }, o.getAnnotation(h.annotation) ? o.updateTarget(h, k.LOCAL) : i.clear());
2321
2321
  }, 10), y = (f) => {
@@ -2330,7 +2330,7 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2330
2330
  } else
2331
2331
  i.clear();
2332
2332
  };
2333
- if (f.timeStamp - p.timeStamp < le) {
2333
+ if (f.timeStamp - p.timeStamp < de) {
2334
2334
  await v();
2335
2335
  const C = document.getSelection();
2336
2336
  if (C != null && C.isCollapsed) {
@@ -2343,7 +2343,7 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2343
2343
  const f = document.getSelection();
2344
2344
  let b = !1, A = f == null ? void 0 : f.isCollapsed;
2345
2345
  const C = () => A || b, B = 1;
2346
- return setTimeout(() => b = !0, 50), To(() => A = f == null ? void 0 : f.isCollapsed, B, C);
2346
+ return setTimeout(() => b = !0, 50), Oo(() => A = f == null ? void 0 : f.isCollapsed, B, C);
2347
2347
  }, L = (f) => {
2348
2348
  const b = document.getSelection();
2349
2349
  b != null && b.isCollapsed || ((!h || h.selector.length === 0) && c(f), _(), i.userSelect(h.annotation, Tt(f)));
@@ -2359,15 +2359,15 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2359
2359
  }, 100);
2360
2360
  document.addEventListener("selectionchange", b), m(f);
2361
2361
  };
2362
- H(Oo.join(","), { element: t, keydown: !0, keyup: !1 }, (f) => {
2362
+ H(Ro.join(","), { element: t, keydown: !0, keyup: !1 }, (f) => {
2363
2363
  f.repeat || (p = pt(f));
2364
- }), H(Re, { keydown: !0, keyup: !1 }, (f) => {
2364
+ }), H(Me, { keydown: !0, keyup: !1 }, (f) => {
2365
2365
  p = pt(f), T(f);
2366
2366
  });
2367
2367
  const M = (f) => {
2368
2368
  f.repeat || f.target !== t && f.target !== document.body || (h = void 0, i.clear());
2369
2369
  };
2370
- H(Oe.join(","), { keydown: !0, keyup: !1 }, M);
2370
+ H(Re.join(","), { keydown: !0, keyup: !1 }, M);
2371
2371
  const _ = () => {
2372
2372
  const f = o.getAnnotation(h.annotation);
2373
2373
  if (!f) {
@@ -2389,24 +2389,24 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2389
2389
  setUser: d,
2390
2390
  setAnnotatingEnabled: E
2391
2391
  };
2392
- }, Mo = (t, e) => ({
2392
+ }, Bo = (t, e) => ({
2393
2393
  ...t,
2394
2394
  annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
2395
2395
  user: t.user || e.user
2396
- }), de = "SPANS", _o = (t, e = {}) => {
2397
- Be(t), Ie(t);
2398
- const n = Mo(e, {
2396
+ }), ue = "SPANS", Uo = (t, e = {}) => {
2397
+ ke(t), Ne(t);
2398
+ const n = Bo(e, {
2399
2399
  annotatingEnabled: !0,
2400
- user: qn()
2401
- }), o = ho(t, n), { selection: i, viewport: s } = o, a = o.store, r = Yn(a), l = Pn(o, r, n.adapter);
2400
+ user: Gn()
2401
+ }), o = po(t, n), { selection: i, viewport: s } = o, a = o.store, r = Kn(a), l = Pn(o, r, n.adapter);
2402
2402
  let d = n.user;
2403
- const g = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : de : n.renderer || de, u = g === "SPANS" ? mn(t, o, s) : g === "CSS_HIGHLIGHTS" ? hn(t, o, s) : g === "CANVAS" ? nn(t, o, s) : void 0;
2403
+ const g = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ue : n.renderer || ue, u = g === "SPANS" ? yn(t, o, s) : g === "CSS_HIGHLIGHTS" ? pn(t, o, s) : g === "CANVAS" ? on(t, o, s) : void 0;
2404
2404
  if (!u)
2405
2405
  throw `Unknown renderer implementation: ${g}`;
2406
2406
  console.debug(`Using ${g} renderer`), n.style && u.setStyle(n.style);
2407
- const h = Ro(t, o, n);
2407
+ const h = Mo(t, o, n);
2408
2408
  h.setUser(d), h.setAnnotatingEnabled(n.annotatingEnabled);
2409
- const x = $n(o, r, n.adapter), p = () => d, w = (v) => {
2409
+ const x = Hn(o, r, n.adapter), p = () => d, w = (v) => {
2410
2410
  h.setAnnotatingEnabled(
2411
2411
  v === void 0 ? !0 : v
2412
2412
  );
@@ -2415,7 +2415,7 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2415
2415
  }, m = (v) => {
2416
2416
  d = v, h.setUser(v);
2417
2417
  }, c = (v) => {
2418
- v && (u.setPainter(go(v, n.presence)), v.on("selectionChange", () => u.redraw()));
2418
+ v && (u.setPainter(mo(v, n.presence)), v.on("selectionChange", () => u.redraw()));
2419
2419
  }, y = (v) => {
2420
2420
  v ? i.setSelected(v) : i.clear();
2421
2421
  };
@@ -2436,54 +2436,54 @@ const le = 300, Oe = ["up", "down", "left", "right"], Re = ke ? "⌘+a" : "ctrl+
2436
2436
  setVisible: u.setVisible.bind(u),
2437
2437
  on: l.on,
2438
2438
  off: l.off,
2439
- scrollIntoView: ze(t, a),
2439
+ scrollIntoView: Fe(t, a),
2440
2440
  state: o
2441
2441
  };
2442
2442
  };
2443
2443
  export {
2444
2444
  St as DEFAULT_SELECTED_STYLE,
2445
2445
  G as DEFAULT_STYLE,
2446
- ue as NOT_ANNOTATABLE_CLASS,
2446
+ fe as NOT_ANNOTATABLE_CLASS,
2447
2447
  nt as NOT_ANNOTATABLE_SELECTOR,
2448
2448
  k as Origin,
2449
- vn as UserSelectAction,
2450
- No as W3CTextFormat,
2451
- Be as cancelSingleClickEvents,
2449
+ Sn as UserSelectAction,
2450
+ _o as W3CTextFormat,
2451
+ ke as cancelSingleClickEvents,
2452
2452
  pt as cloneKeyboardEvent,
2453
2453
  Tt as clonePointerEvent,
2454
- Io as createBody,
2455
- nn as createCanvasRenderer,
2456
- hn as createHighlightsRenderer,
2457
- go as createPresencePainter,
2458
- fn as createRenderer,
2459
- Ro as createSelectionHandler,
2460
- mn as createSpansRenderer,
2461
- _o as createTextAnnotator,
2462
- ho as createTextAnnotatorState,
2463
- Mo as fillDefaults,
2464
- Ue as getQuoteContext,
2454
+ No as createBody,
2455
+ on as createCanvasRenderer,
2456
+ pn as createHighlightsRenderer,
2457
+ mo as createPresencePainter,
2458
+ hn as createRenderer,
2459
+ Mo as createSelectionHandler,
2460
+ yn as createSpansRenderer,
2461
+ Uo as createTextAnnotator,
2462
+ po as createTextAnnotatorState,
2463
+ Bo as fillDefaults,
2464
+ De as getQuoteContext,
2465
2465
  Kt as getRangeAnnotatableContents,
2466
- ke as isMac,
2466
+ Ie as isMac,
2467
2467
  rt as isNotAnnotatable,
2468
- Me as isRangeAnnotatable,
2468
+ Be as isRangeAnnotatable,
2469
2469
  q as isRevived,
2470
- Ve as isWhitespaceOrEmpty,
2470
+ Ye as isWhitespaceOrEmpty,
2471
2471
  Pe as mergeClientRects,
2472
- Fe as paint,
2473
- eo as parseW3CTextAnnotation,
2474
- Ie as programmaticallyFocusable,
2475
- $e as rangeContains,
2476
- Xe as rangeToSelector,
2472
+ We as paint,
2473
+ no as parseW3CTextAnnotation,
2474
+ Ne as programmaticallyFocusable,
2475
+ He as rangeContains,
2476
+ $e as rangeToSelector,
2477
2477
  Lt as reviveAnnotation,
2478
- fe as reviveSelector,
2478
+ he as reviveSelector,
2479
2479
  vt as reviveTarget,
2480
- ze as scrollIntoView,
2481
- no as serializeW3CTextAnnotation,
2482
- _e as splitAnnotatableRanges,
2483
- Bo as toDomRectList,
2484
- je as toParentBounds,
2485
- ko as toViewportBounds,
2486
- He as trimRangeToContainer,
2487
- De as whitespaceOrEmptyRegex
2480
+ Fe as scrollIntoView,
2481
+ oo as serializeW3CTextAnnotation,
2482
+ Ue as splitAnnotatableRanges,
2483
+ ko as toDomRectList,
2484
+ ze as toParentBounds,
2485
+ Io as toViewportBounds,
2486
+ je as trimRangeToContainer,
2487
+ Ve as whitespaceOrEmptyRegex
2488
2488
  };
2489
2489
  //# sourceMappingURL=text-annotator.es.js.map