@soomo/text-annotator 3.1.0-staging.23 → 3.1.0-staging.25

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.
@@ -109,9 +109,9 @@ const ue = "not-annotatable", et = `.${ue}`, st = (t) => {
109
109
  const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
110
110
  e,
111
111
  NodeFilter.SHOW_TEXT,
112
- (h) => {
112
+ (f) => {
113
113
  var A;
114
- return (A = h.parentElement) != null && A.closest(et) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
114
+ return (A = f.parentElement) != null && A.closest(et) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
115
115
  }
116
116
  );
117
117
  let a = 0;
@@ -121,22 +121,22 @@ const ue = "not-annotatable", et = `.${ue}`, st = (t) => {
121
121
  let d = !i;
122
122
  for (; l !== null; ) {
123
123
  if (d || (d = i == null ? void 0 : i.contains(l)), d) {
124
- const h = ((g = l.textContent) == null ? void 0 : g.length) || 0;
125
- if (a + h > n) {
124
+ const f = ((g = l.textContent) == null ? void 0 : g.length) || 0;
125
+ if (a + f > n) {
126
126
  r.setStart(l, n - a);
127
127
  break;
128
128
  }
129
- a += h;
129
+ a += f;
130
130
  }
131
131
  l = s.nextNode();
132
132
  }
133
133
  for (; l !== null; ) {
134
- const h = ((u = l.textContent) == null ? void 0 : u.length) || 0;
135
- if (a + h >= o) {
134
+ const f = ((u = l.textContent) == null ? void 0 : u.length) || 0;
135
+ if (a + f >= o) {
136
136
  r.setEnd(l, o - a);
137
137
  break;
138
138
  }
139
- a += h, l = s.nextNode();
139
+ a += f, l = s.nextNode();
140
140
  }
141
141
  return {
142
142
  ...t,
@@ -213,7 +213,7 @@ const ue = "not-annotatable", et = `.${ue}`, st = (t) => {
213
213
  return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : pe(t.parentElement);
214
214
  }, ze = (t, e) => (n) => {
215
215
  const o = typeof n == "string" ? n : n.id, i = (a) => {
216
- const r = s.getBoundingClientRect(), l = s.clientHeight, d = s.clientWidth, g = a.selector[0].range.getBoundingClientRect(), { width: u, height: h } = e.getAnnotationBounds(o), A = g.top - r.top, p = g.left - r.left, b = s.parentElement ? s.scrollTop : 0, x = s.parentElement ? s.scrollLeft : 0, m = A + b - (l - h) / 2, c = p + x - (d - u) / 2;
216
+ const r = s.getBoundingClientRect(), l = s.clientHeight, d = s.clientWidth, g = a.selector[0].range.getBoundingClientRect(), { width: u, height: f } = e.getAnnotationBounds(o), A = g.top - r.top, p = g.left - r.left, b = s.parentElement ? s.scrollTop : 0, x = s.parentElement ? s.scrollLeft : 0, m = A + b - (l - f) / 2, c = p + x - (d - u) / 2;
217
217
  s.scroll({ top: m, left: c, behavior: "smooth" });
218
218
  }, s = pe(t);
219
219
  if (s) {
@@ -260,24 +260,24 @@ function qe() {
260
260
  const A = Date.now() - l;
261
261
  A < n && A >= 0 ? r = setTimeout(u, n - A) : (r = void 0, i || (d = g()));
262
262
  }
263
- const h = function(...A) {
263
+ const f = function(...A) {
264
264
  if (s && this !== s && Object.getPrototypeOf(this) === Object.getPrototypeOf(s))
265
265
  throw new Error("Debounced method called with different contexts of the same prototype.");
266
266
  s = this, a = A, l = Date.now();
267
267
  const p = i && !r;
268
268
  return r || (r = setTimeout(u, n)), p && (d = g()), d;
269
269
  };
270
- return Object.defineProperty(h, "isPending", {
270
+ return Object.defineProperty(f, "isPending", {
271
271
  get() {
272
272
  return r !== void 0;
273
273
  }
274
- }), h.clear = () => {
274
+ }), f.clear = () => {
275
275
  r && (clearTimeout(r), r = void 0);
276
- }, h.flush = () => {
277
- r && h.trigger();
278
- }, h.trigger = () => {
279
- d = g(), h.clear();
280
- }, h;
276
+ }, f.flush = () => {
277
+ r && f.trigger();
278
+ }, f.trigger = () => {
279
+ d = g(), f.clear();
280
+ }, f;
281
281
  }
282
282
  return gt.exports.debounce = t, gt.exports = t, gt.exports;
283
283
  }
@@ -299,37 +299,37 @@ const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
299
299
  v ? a.current !== v.id && (t.classList.add("hovered"), a.set(v.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
300
300
  };
301
301
  t.addEventListener("pointermove", u);
302
- const h = (T = !1) => {
302
+ const f = (T = !1) => {
303
303
  d && d.clear();
304
- const R = Qe(t), { minX: w, minY: v, maxX: f, maxY: E } = R, M = l ? i.getIntersecting(w, v, f, E).filter(({ annotation: _ }) => l(_)) : i.getIntersecting(w, v, f, E), O = s.selected.map(({ id: _ }) => _), U = M.map(({ annotation: _, rects: ht }) => {
304
+ const R = Qe(t), { minX: w, minY: v, maxX: h, maxY: E } = R, M = l ? i.getIntersecting(w, v, h, E).filter(({ annotation: _ }) => l(_)) : i.getIntersecting(w, v, h, E), O = s.selected.map(({ id: _ }) => _), U = M.map(({ annotation: _, rects: ht }) => {
305
305
  const W = O.includes(_.id), G = _.id === a.current;
306
306
  return { annotation: _, rects: ht, state: { selected: W, hover: G } };
307
307
  });
308
308
  o.redraw(U, R, r, d, T), setTimeout(() => g(M.map(({ annotation: _ }) => _)), 1);
309
309
  }, A = (T) => {
310
- d = T, h();
310
+ d = T, f();
311
311
  }, p = (T) => {
312
- r = T, h();
312
+ r = T, f();
313
313
  }, b = (T) => {
314
- l = T, h(!1);
315
- }, x = () => h();
314
+ l = T, f(!1);
315
+ }, x = () => f();
316
316
  i.observe(x);
317
- const m = s.subscribe(() => h()), c = () => h(!0);
317
+ const m = s.subscribe(() => f()), c = () => f(!0);
318
318
  document.addEventListener("scroll", c, { capture: !0, passive: !0 });
319
319
  const y = Xt(() => {
320
- i.recalculatePositions(), d == null || d.reset(), h();
320
+ i.recalculatePositions(), d == null || d.reset(), f();
321
321
  }, 10);
322
322
  window.addEventListener("resize", y);
323
323
  const C = new ResizeObserver(y);
324
324
  C.observe(t);
325
325
  const S = { attributes: !0, childList: !0, subtree: !0 }, L = new MutationObserver((T) => {
326
- T.every((w) => w.target === t || t.contains(w.target)) || h(!0);
326
+ T.every((w) => w.target === t || t.contains(w.target)) || f(!0);
327
327
  });
328
328
  return L.observe(document.body, S), {
329
329
  destroy: () => {
330
330
  t.removeEventListener("pointermove", u), o.destroy(), i.unobserve(x), m(), document.removeEventListener("scroll", c), y.clear(), window.removeEventListener("resize", y), C.disconnect(), L.disconnect();
331
331
  },
332
- redraw: h,
332
+ redraw: f,
333
333
  setStyle: p,
334
334
  setFilter: b,
335
335
  setPainter: A,
@@ -345,8 +345,8 @@ const Xt = /* @__PURE__ */ We(Ge), Qe = (t) => {
345
345
  const e = Ze(), n = e.getContext("2d");
346
346
  document.body.appendChild(e);
347
347
  const o = (r, l, d, g) => requestAnimationFrame(() => {
348
- const { width: u, height: h } = e;
349
- n.clearRect(-0.5, -0.5, u + 1, h + 1), g && g.clear();
348
+ const { width: u, height: f } = e;
349
+ n.clearRect(-0.5, -0.5, u + 1, f + 1), g && g.clear();
350
350
  const { top: A, left: p } = l;
351
351
  [...r].sort((x, m) => {
352
352
  const { annotation: { target: { created: c } } } = x, { annotation: { target: { created: y } } } = m;
@@ -533,12 +533,12 @@ const un = (t) => [
533
533
  Array.from(e).filter((u) => !d.has(u));
534
534
  const g = s.map((u) => {
535
535
  var p;
536
- const h = r ? typeof r == "function" ? r(u.annotation, u.state) : r : (p = u.state) != null && p.selected ? Et : q, A = l && l.paint(u, a) || h;
536
+ const f = r ? typeof r == "function" ? r(u.annotation, u.state) : r : (p = u.state) != null && p.selected ? Et : q, A = l && l.paint(u, a) || f;
537
537
  return `::highlight(_${u.annotation.id}) { ${un(A)} }`;
538
538
  });
539
539
  t.innerHTML = g.join(`
540
540
  `), CSS.highlights.clear(), s.forEach(({ annotation: u }) => {
541
- const h = u.target.selector.map((p) => p.range), A = new Highlight(...h);
541
+ const f = u.target.selector.map((p) => p.range), A = new Highlight(...f);
542
542
  CSS.highlights.set(`_${u.id}`, A);
543
543
  }), e = d;
544
544
  }
@@ -578,15 +578,15 @@ const pn = (t, e) => {
578
578
  e.remove();
579
579
  },
580
580
  redraw: (a, r, l, d, g) => {
581
- const h = !(Pt(n, a) && g);
582
- if (!d && !h) return;
583
- h && (e.innerHTML = ""), [...a].sort((p, b) => {
581
+ const f = !(Pt(n, a) && g);
582
+ if (!d && !f) return;
583
+ f && (e.innerHTML = ""), [...a].sort((p, b) => {
584
584
  const { annotation: { target: { created: x } } } = p, { annotation: { target: { created: m } } } = b;
585
585
  return x && m ? x.getTime() - m.getTime() : 0;
586
586
  }).forEach((p) => {
587
587
  p.rects.map((b) => {
588
588
  const x = pn(b, a), m = Fe(p, r, l, d, x);
589
- if (h) {
589
+ if (f) {
590
590
  const c = document.createElement("span");
591
591
  c.className = "r6o-annotation", c.dataset.annotation = p.annotation.id, c.style.left = `${b.x}px`, c.style.top = `${b.y}px`, c.style.width = `${b.width}px`, c.style.height = `${b.height}px`, c.style.backgroundColor = $((m == null ? void 0 : m.fill) || q.fill).alpha((m == null ? void 0 : m.fillOpacity) === void 0 ? q.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);
592
592
  }
@@ -734,14 +734,14 @@ const yt = { selected: [] }, Sn = (t, e, n) => {
734
734
  return { id: c.id, editable: y };
735
735
  })
736
736
  }), m.length !== x.length && console.warn("Invalid selection", p);
737
- }, h = (p) => {
737
+ }, f = (p) => {
738
738
  if (l())
739
739
  return !1;
740
740
  const { selected: b } = a;
741
741
  b.some(({ id: x }) => p.includes(x)) && i({ selected: b.filter(({ id: x }) => !p.includes(x)) });
742
742
  }, A = (p) => s = p;
743
743
  return t.observe(
744
- ({ changes: p }) => h((p.deleted || []).map((b) => b.id))
744
+ ({ changes: p }) => f((p.deleted || []).map((b) => b.id))
745
745
  ), {
746
746
  get event() {
747
747
  return a ? a.event : null;
@@ -848,17 +848,17 @@ const In = (t, e) => {
848
848
  return !0;
849
849
  }, Nn = (t, e) => {
850
850
  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 = [
851
- ...(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),
851
+ ...(t.created || []).filter((u) => !s.has(u.id)).map((u) => a.has(u.id) ? e.updated.find(({ oldValue: f }) => f.id === u.id).newValue : u),
852
852
  ...e.created || []
853
853
  ], d = [
854
854
  ...(t.deleted || []).filter((u) => !i.has(u.id)),
855
855
  ...(e.deleted || []).filter((u) => !n.has(u.id))
856
856
  ], g = [
857
857
  ...(t.updated || []).filter(({ newValue: u }) => !s.has(u.id)).map((u) => {
858
- const { oldValue: h, newValue: A } = u;
858
+ const { oldValue: f, newValue: A } = u;
859
859
  if (a.has(A.id)) {
860
860
  const p = e.updated.find((b) => b.oldValue.id === A.id).newValue;
861
- return Ae(h, p);
861
+ return Ae(f, p);
862
862
  } else
863
863
  return u;
864
864
  }),
@@ -883,10 +883,10 @@ const In = (t, e) => {
883
883
  const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (w, v = {}) => {
884
884
  n.push({ onChange: w, options: v });
885
885
  }, i = (w) => {
886
- const v = n.findIndex((f) => f.onChange == w);
886
+ const v = n.findIndex((h) => h.onChange == w);
887
887
  v > -1 && n.splice(v, 1);
888
888
  }, s = (w, v) => {
889
- const f = {
889
+ const h = {
890
890
  origin: w,
891
891
  changes: {
892
892
  created: v.created || [],
@@ -896,55 +896,55 @@ const In = (t, e) => {
896
896
  state: [...t.values()]
897
897
  };
898
898
  n.forEach((E) => {
899
- In(E, f) && E.onChange(f);
899
+ In(E, h) && E.onChange(h);
900
900
  });
901
901
  }, a = (w, v = k.LOCAL) => {
902
902
  if (w.id && t.get(w.id))
903
903
  throw Error(`Cannot add annotation ${w.id} - exists already`);
904
904
  {
905
- const f = Nt(w);
906
- t.set(f.id, f), f.bodies.forEach((E) => e.set(E.id, f.id)), s(v, { created: [f] });
905
+ const h = Nt(w);
906
+ t.set(h.id, h), h.bodies.forEach((E) => e.set(E.id, h.id)), s(v, { created: [h] });
907
907
  }
908
908
  }, r = (w, v) => {
909
- const f = Nt(typeof w == "string" ? v : w), E = typeof w == "string" ? w : w.id, M = E && t.get(E);
909
+ const h = Nt(typeof w == "string" ? v : w), E = typeof w == "string" ? w : w.id, M = E && t.get(E);
910
910
  if (M) {
911
- const O = Ae(M, f);
912
- return E === f.id ? t.set(E, f) : (t.delete(E), t.set(f.id, f)), M.bodies.forEach((U) => e.delete(U.id)), f.bodies.forEach((U) => e.set(U.id, f.id)), O;
911
+ const O = Ae(M, h);
912
+ return E === h.id ? t.set(E, h) : (t.delete(E), t.set(h.id, h)), M.bodies.forEach((U) => e.delete(U.id)), h.bodies.forEach((U) => e.set(U.id, h.id)), O;
913
913
  } else
914
914
  console.warn(`Cannot update annotation ${E} - does not exist`);
915
- }, l = (w, v = k.LOCAL, f = k.LOCAL) => {
916
- const E = _n(v) ? f : v, M = r(w, v);
915
+ }, l = (w, v = k.LOCAL, h = k.LOCAL) => {
916
+ const E = _n(v) ? h : v, M = r(w, v);
917
917
  M && s(E, { updated: [M] });
918
918
  }, d = (w, v = k.LOCAL) => {
919
- const f = w.reduce((E, M) => {
919
+ const h = w.reduce((E, M) => {
920
920
  const O = r(M);
921
921
  return O ? [...E, O] : E;
922
922
  }, []);
923
- f.length > 0 && s(v, { updated: f });
923
+ h.length > 0 && s(v, { updated: h });
924
924
  }, g = (w, v = k.LOCAL) => {
925
- const f = t.get(w.annotation);
926
- if (f) {
925
+ const h = t.get(w.annotation);
926
+ if (h) {
927
927
  const E = {
928
- ...f,
929
- bodies: [...f.bodies, w]
928
+ ...h,
929
+ bodies: [...h.bodies, w]
930
930
  };
931
- t.set(f.id, E), e.set(w.id, E.id), s(v, { updated: [{
932
- oldValue: f,
931
+ t.set(h.id, E), e.set(w.id, E.id), s(v, { updated: [{
932
+ oldValue: h,
933
933
  newValue: E,
934
934
  bodiesCreated: [w]
935
935
  }] });
936
936
  } else
937
937
  console.warn(`Attempt to add body to missing annotation: ${w.annotation}`);
938
- }, u = () => [...t.values()], h = (w = k.LOCAL) => {
938
+ }, u = () => [...t.values()], f = (w = k.LOCAL) => {
939
939
  const v = [...t.values()];
940
940
  t.clear(), e.clear(), s(w, { deleted: v });
941
- }, A = (w, v = !0, f = k.LOCAL) => {
941
+ }, A = (w, v = !0, h = k.LOCAL) => {
942
942
  const E = w.map(Nt);
943
943
  if (v) {
944
944
  const M = [...t.values()];
945
945
  t.clear(), e.clear(), E.forEach((O) => {
946
946
  t.set(O.id, O), O.bodies.forEach((U) => e.set(U.id, O.id));
947
- }), s(f, { created: E, deleted: M });
947
+ }), s(h, { created: E, deleted: M });
948
948
  } else {
949
949
  const M = w.reduce((O, U) => {
950
950
  const _ = U.id && t.get(U.id);
@@ -954,28 +954,28 @@ const In = (t, e) => {
954
954
  throw Error(`Bulk insert would overwrite the following annotations: ${M.map((O) => O.id).join(", ")}`);
955
955
  E.forEach((O) => {
956
956
  t.set(O.id, O), O.bodies.forEach((U) => e.set(U.id, O.id));
957
- }), s(f, { created: E });
957
+ }), s(h, { created: E });
958
958
  }
959
959
  }, p = (w) => {
960
- const v = typeof w == "string" ? w : w.id, f = t.get(v);
961
- if (f)
962
- return t.delete(v), f.bodies.forEach((E) => e.delete(E.id)), f;
960
+ const v = typeof w == "string" ? w : w.id, h = t.get(v);
961
+ if (h)
962
+ return t.delete(v), h.bodies.forEach((E) => e.delete(E.id)), h;
963
963
  console.warn(`Attempt to delete missing annotation: ${v}`);
964
964
  }, b = (w, v = k.LOCAL) => {
965
- const f = p(w);
966
- f && s(v, { deleted: [f] });
965
+ const h = p(w);
966
+ h && s(v, { deleted: [h] });
967
967
  }, x = (w, v = k.LOCAL) => {
968
- const f = w.reduce((E, M) => {
968
+ const h = w.reduce((E, M) => {
969
969
  const O = p(M);
970
970
  return O ? [...E, O] : E;
971
971
  }, []);
972
- f.length > 0 && s(v, { deleted: f });
972
+ h.length > 0 && s(v, { deleted: h });
973
973
  }, m = (w) => {
974
974
  const v = t.get(w.annotation);
975
975
  if (v) {
976
- const f = v.bodies.find((E) => E.id === w.id);
977
- if (f) {
978
- e.delete(f.id);
976
+ const h = v.bodies.find((E) => E.id === w.id);
977
+ if (h) {
978
+ e.delete(h.id);
979
979
  const E = {
980
980
  ...v,
981
981
  bodies: v.bodies.filter((M) => M.id !== w.id)
@@ -983,65 +983,65 @@ const In = (t, e) => {
983
983
  return t.set(v.id, E), {
984
984
  oldValue: v,
985
985
  newValue: E,
986
- bodiesDeleted: [f]
986
+ bodiesDeleted: [h]
987
987
  };
988
988
  } else
989
989
  console.warn(`Attempt to delete missing body ${w.id} from annotation ${w.annotation}`);
990
990
  } else
991
991
  console.warn(`Attempt to delete body from missing annotation ${w.annotation}`);
992
992
  }, c = (w, v = k.LOCAL) => {
993
- const f = m(w);
994
- f && s(v, { updated: [f] });
993
+ const h = m(w);
994
+ h && s(v, { updated: [h] });
995
995
  }, y = (w, v = k.LOCAL) => {
996
- const f = w.map((E) => m(E)).filter(Boolean);
997
- f.length > 0 && s(v, { updated: f });
996
+ const h = w.map((E) => m(E)).filter(Boolean);
997
+ h.length > 0 && s(v, { updated: h });
998
998
  }, C = (w) => {
999
999
  const v = t.get(w);
1000
1000
  return v ? { ...v } : void 0;
1001
1001
  }, S = (w) => {
1002
1002
  const v = e.get(w);
1003
1003
  if (v) {
1004
- const f = C(v).bodies.find((E) => E.id === w);
1005
- if (f)
1006
- return f;
1004
+ const h = C(v).bodies.find((E) => E.id === w);
1005
+ if (h)
1006
+ return h;
1007
1007
  console.error(`Store integrity error: body ${w} in index, but not in annotation`);
1008
1008
  } else
1009
1009
  console.warn(`Attempt to retrieve missing body: ${w}`);
1010
1010
  }, L = (w, v) => {
1011
1011
  if (w.annotation !== v.annotation)
1012
1012
  throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
1013
- const f = t.get(w.annotation);
1014
- if (f) {
1015
- const E = f.bodies.find((O) => O.id === w.id), M = {
1016
- ...f,
1017
- bodies: f.bodies.map((O) => O.id === E.id ? v : O)
1013
+ const h = t.get(w.annotation);
1014
+ if (h) {
1015
+ const E = h.bodies.find((O) => O.id === w.id), M = {
1016
+ ...h,
1017
+ bodies: h.bodies.map((O) => O.id === E.id ? v : O)
1018
1018
  };
1019
- return t.set(f.id, M), E.id !== v.id && (e.delete(E.id), e.set(v.id, M.id)), {
1020
- oldValue: f,
1019
+ return t.set(h.id, M), E.id !== v.id && (e.delete(E.id), e.set(v.id, M.id)), {
1020
+ oldValue: h,
1021
1021
  newValue: M,
1022
1022
  bodiesUpdated: [{ oldBody: E, newBody: v }]
1023
1023
  };
1024
1024
  } else
1025
1025
  console.warn(`Attempt to add body to missing annotation ${w.annotation}`);
1026
- }, B = (w, v, f = k.LOCAL) => {
1026
+ }, B = (w, v, h = k.LOCAL) => {
1027
1027
  const E = L(w, v);
1028
- E && s(f, { updated: [E] });
1028
+ E && s(h, { updated: [E] });
1029
1029
  }, T = (w, v = k.LOCAL) => {
1030
- const f = w.map((E) => L({ id: E.id, annotation: E.annotation }, E)).filter(Boolean);
1031
- s(v, { updated: f });
1030
+ const h = w.map((E) => L({ id: E.id, annotation: E.annotation }, E)).filter(Boolean);
1031
+ s(v, { updated: h });
1032
1032
  }, R = (w) => {
1033
1033
  const v = t.get(w.annotation);
1034
1034
  if (v) {
1035
- const f = {
1035
+ const h = {
1036
1036
  ...v,
1037
1037
  target: {
1038
1038
  ...v.target,
1039
1039
  ...w
1040
1040
  }
1041
1041
  };
1042
- return t.set(v.id, f), {
1042
+ return t.set(v.id, h), {
1043
1043
  oldValue: v,
1044
- newValue: f,
1044
+ newValue: h,
1045
1045
  targetUpdated: {
1046
1046
  oldTarget: v.target,
1047
1047
  newTarget: w
@@ -1060,10 +1060,10 @@ const In = (t, e) => {
1060
1060
  bulkUpdateAnnotation: d,
1061
1061
  bulkUpdateBodies: T,
1062
1062
  bulkUpdateTargets: (w, v = k.LOCAL) => {
1063
- const f = w.map((E) => R(E)).filter(Boolean);
1064
- f.length > 0 && s(v, { updated: f });
1063
+ const h = w.map((E) => R(E)).filter(Boolean);
1064
+ h.length > 0 && s(v, { updated: h });
1065
1065
  },
1066
- clear: h,
1066
+ clear: f,
1067
1067
  deleteAnnotation: b,
1068
1068
  deleteBody: c,
1069
1069
  getAnnotation: C,
@@ -1073,8 +1073,8 @@ const In = (t, e) => {
1073
1073
  updateAnnotation: l,
1074
1074
  updateBody: B,
1075
1075
  updateTarget: (w, v = k.LOCAL) => {
1076
- const f = R(w);
1077
- f && s(v, { updated: [f] });
1076
+ const h = R(w);
1077
+ h && s(v, { updated: [h] });
1078
1078
  }
1079
1079
  };
1080
1080
  };
@@ -1109,7 +1109,7 @@ const Vn = 250, Yn = (t, e) => {
1109
1109
  s = !1;
1110
1110
  };
1111
1111
  t.observe(r, { origin: k.LOCAL });
1112
- const l = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), d = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), g = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: b }) => b)), u = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: b }) => b)), h = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), A = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);
1112
+ const l = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), d = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), g = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: b }) => b)), u = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: b }) => b)), f = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), A = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);
1113
1113
  return {
1114
1114
  canRedo: () => o.length - 1 > i,
1115
1115
  canUndo: () => i > -1,
@@ -1127,7 +1127,7 @@ const Vn = 250, Yn = (t, e) => {
1127
1127
  if (i > -1) {
1128
1128
  s = !0;
1129
1129
  const { created: p, updated: b, deleted: x } = o[i];
1130
- l(p), g(b), h(x), n.emit("undo", o[i]), i -= 1;
1130
+ l(p), g(b), f(x), n.emit("undo", o[i]), i -= 1;
1131
1131
  }
1132
1132
  }
1133
1133
  };
@@ -1142,7 +1142,7 @@ const Vn = 250, Yn = (t, e) => {
1142
1142
  let d = [], g;
1143
1143
  const u = (b, x) => {
1144
1144
  l.has(b) ? l.get(b).push(x) : l.set(b, [x]);
1145
- }, h = (b, x) => {
1145
+ }, f = (b, x) => {
1146
1146
  const m = l.get(b);
1147
1147
  if (m) {
1148
1148
  const c = m.indexOf(x);
@@ -1204,7 +1204,7 @@ const Vn = 250, Yn = (t, e) => {
1204
1204
  const { updated: m } = x;
1205
1205
  b ? (m || []).forEach((c) => A("updateAnnotation", c.oldValue, c.newValue)) : (m || []).forEach((c) => A("updateAnnotation", c.newValue, c.oldValue));
1206
1206
  };
1207
- return e.on("undo", p(!0)), e.on("redo", p(!1)), { on: u, off: h, emit: A };
1207
+ return e.on("undo", p(!0)), e.on("redo", p(!1)), { on: u, off: f, emit: A };
1208
1208
  }, Xn = (t) => (e) => e.reduce((n, o) => {
1209
1209
  const { parsed: i, error: s } = t.parse(o);
1210
1210
  return s ? {
@@ -1230,7 +1230,7 @@ const Vn = 250, Yn = (t, e) => {
1230
1230
  var m;
1231
1231
  const c = (((m = i.selected) == null ? void 0 : m.map((y) => y.id)) || []).map((y) => o.getAnnotation(y)).filter(Boolean);
1232
1232
  return n ? c.map(n.serialize) : c;
1233
- }, u = (m, c = !0) => fetch(m).then((y) => y.json()).then((y) => (A(y, c), y)), h = (m) => {
1233
+ }, u = (m, c = !0) => fetch(m).then((y) => y.json()).then((y) => (A(y, c), y)), f = (m) => {
1234
1234
  if (typeof m == "string") {
1235
1235
  const c = o.getAnnotation(m);
1236
1236
  if (o.deleteAnnotation(m), c)
@@ -1271,7 +1271,7 @@ const Vn = 250, Yn = (t, e) => {
1271
1271
  getSelected: g,
1272
1272
  loadAnnotations: u,
1273
1273
  redo: e.redo,
1274
- removeAnnotation: h,
1274
+ removeAnnotation: f,
1275
1275
  setAnnotations: A,
1276
1276
  setSelected: p,
1277
1277
  setUserSelectAction: b,
@@ -1349,19 +1349,19 @@ const No = (t, e) => ({
1349
1349
  styleClass: "styleClass" in a[0] ? a[0].styleClass : void 0
1350
1350
  };
1351
1351
  for (const l of a) {
1352
- const g = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((u, h) => {
1353
- switch (h.type) {
1352
+ const g = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((u, f) => {
1353
+ switch (f.type) {
1354
1354
  case "TextQuoteSelector":
1355
- u.quote = h.exact;
1355
+ u.quote = f.exact;
1356
1356
  break;
1357
1357
  case "TextPositionSelector":
1358
- u.start = h.start, u.end = h.end;
1358
+ u.start = f.start, u.end = f.end;
1359
1359
  break;
1360
1360
  }
1361
1361
  return u;
1362
1362
  }, {});
1363
1363
  if (Zn(g))
1364
- r.selector.push(
1364
+ "outdated" in l && l.outdated, r.selector.push(
1365
1365
  {
1366
1366
  ...g,
1367
1367
  id: l.id,
@@ -1401,8 +1401,8 @@ const No = (t, e) => ({
1401
1401
  created: l,
1402
1402
  updated: d,
1403
1403
  ...g
1404
- } = i, u = a.map((h) => {
1405
- const { id: A, quote: p, start: b, end: x, range: m } = h, { prefix: c, suffix: y } = Ue(m, n), C = [{
1404
+ } = i, u = a.map((f) => {
1405
+ const { id: A, quote: p, start: b, end: x, range: m } = f, { prefix: c, suffix: y } = Ue(m, n), C = [{
1406
1406
  type: "TextQuoteSelector",
1407
1407
  exact: p,
1408
1408
  prefix: c,
@@ -1415,8 +1415,10 @@ const No = (t, e) => ({
1415
1415
  return {
1416
1416
  ...g,
1417
1417
  id: A,
1418
+ // @ts-expect-error: `outdated` is not part of the core `TextSelector` type
1419
+ outdated: "outdated" in f ? f.outdated : void 0,
1418
1420
  // @ts-expect-error: `scope` is not part of the core `TextSelector` type
1419
- scope: "scope" in h ? h.scope : void 0,
1421
+ scope: "scope" in f ? f.scope : void 0,
1420
1422
  source: e,
1421
1423
  selector: C
1422
1424
  };
@@ -1436,7 +1438,7 @@ const No = (t, e) => ({
1436
1438
  function ve(t, e, n = 0, o = t.length - 1, i = oo) {
1437
1439
  for (; o > n; ) {
1438
1440
  if (o - n > 600) {
1439
- 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), A = Math.max(n, Math.floor(e - d * u / l + h)), p = Math.min(o, Math.floor(e + (l - d) * u / l + h));
1441
+ const l = o - n + 1, d = e - n + 1, g = Math.log(l), u = 0.5 * Math.exp(2 * g / 3), f = 0.5 * Math.sqrt(g * u * (l - u) / l) * (d - l / 2 < 0 ? -1 : 1), A = Math.max(n, Math.floor(e - d * u / l + f)), p = Math.min(o, Math.floor(e + (l - d) * u / l + f));
1440
1442
  ve(t, e, A, p, i);
1441
1443
  }
1442
1444
  const s = t[e];
@@ -1566,9 +1568,9 @@ class io {
1566
1568
  for (let g = n; g <= o; g += d) {
1567
1569
  const u = Math.min(g + d - 1, o);
1568
1570
  re(e, g, u, l, this.compareMinY);
1569
- for (let h = g; h <= u; h += l) {
1570
- const A = Math.min(h + l - 1, u);
1571
- r.children.push(this._build(e, h, A, i - 1));
1571
+ for (let f = g; f <= u; f += l) {
1572
+ const A = Math.min(f + l - 1, u);
1573
+ r.children.push(this._build(e, f, A, i - 1));
1572
1574
  }
1573
1575
  }
1574
1576
  return Z(r, this.toBBox), r;
@@ -1752,7 +1754,7 @@ const fo = (t, e) => {
1752
1754
  });
1753
1755
  const B = L.flatMap(({ rects: T }) => T);
1754
1756
  n.load(B);
1755
- }, h = (y, C, S = !1) => {
1757
+ }, f = (y, C, S = !1) => {
1756
1758
  const L = n.search({
1757
1759
  minX: y,
1758
1760
  minY: C,
@@ -1777,7 +1779,7 @@ const fo = (t, e) => {
1777
1779
  return {
1778
1780
  all: a,
1779
1781
  clear: r,
1780
- getAt: h,
1782
+ getAt: f,
1781
1783
  getAnnotationBounds: A,
1782
1784
  getAnnotationRects: p,
1783
1785
  getIntersecting: (y, C, S, L) => {
@@ -1816,7 +1818,7 @@ const fo = (t, e) => {
1816
1818
  const C = c.map((S) => vt(S, t));
1817
1819
  n.bulkUpdateTargets(C, y);
1818
1820
  };
1819
- function h(c, y, C, S) {
1821
+ function f(c, y, C, S) {
1820
1822
  const L = C || !!S, B = o.getAt(c, y, L).map((R) => n.getAnnotation(R)), T = S ? B.filter(S) : B;
1821
1823
  if (T.length !== 0)
1822
1824
  return C ? T : T[0];
@@ -1835,7 +1837,7 @@ const fo = (t, e) => {
1835
1837
  getAnnotationBounds: A,
1836
1838
  getAnnotationRects: b,
1837
1839
  getIntersecting: p,
1838
- getAt: h,
1840
+ getAt: f,
1839
1841
  recalculatePositions: x,
1840
1842
  onRecalculatePositions: m,
1841
1843
  updateTarget: g
@@ -1852,7 +1854,7 @@ const fo = (t, e) => {
1852
1854
  }, go = (t, e = {}) => {
1853
1855
  const n = po(), o = n.getContext("2d");
1854
1856
  document.body.appendChild(n);
1855
- const i = /* @__PURE__ */ new Map(), s = (g) => Array.from(i.entries()).filter(([u, h]) => h.presenceKey === g.presenceKey).map(([u, h]) => u);
1857
+ const i = /* @__PURE__ */ new Map(), s = (g) => Array.from(i.entries()).filter(([u, f]) => f.presenceKey === g.presenceKey).map(([u, f]) => u);
1856
1858
  return t.on("selectionChange", (g, u) => {
1857
1859
  s(g).forEach((A) => i.delete(A)), u && u.forEach((A) => i.set(A, g));
1858
1860
  }), {
@@ -1863,7 +1865,7 @@ const fo = (t, e) => {
1863
1865
  destroy: () => {
1864
1866
  n.remove();
1865
1867
  },
1866
- paint: (g, u, h) => {
1868
+ paint: (g, u, f) => {
1867
1869
  e.font && (o.font = e.font);
1868
1870
  const A = i.get(g.annotation.id);
1869
1871
  if (A) {
@@ -1872,7 +1874,7 @@ const fo = (t, e) => {
1872
1874
  const m = o.measureText(A.appearance.label), c = m.width + 6, y = m.actualBoundingBoxAscent + m.actualBoundingBoxDescent + 8, C = m.fontBoundingBoxAscent ? 8 : 6.5;
1873
1875
  return o.fillRect(b - 2, x - 2.5 - y, c, y), o.fillStyle = "#fff", o.fillText(A.appearance.label, b + 1, x - C), {
1874
1876
  fill: A.appearance.color,
1875
- fillOpacity: h ? 0.45 : 0.18
1877
+ fillOpacity: f ? 0.45 : 0.18
1876
1878
  };
1877
1879
  }
1878
1880
  },
@@ -2094,11 +2096,11 @@ const At = (t) => {
2094
2096
  const r = a.split(i), l = r.length, d = r[l - 1], g = d === "*" ? "*" : ft(d);
2095
2097
  if (!N[g]) return;
2096
2098
  n || (n = ut());
2097
- const u = l > 1 ? Ee(H, r) : [], h = [];
2099
+ const u = l > 1 ? Ee(H, r) : [], f = [];
2098
2100
  N[g] = N[g].filter((A) => {
2099
2101
  const b = (o ? A.method === o : !0) && A.scope === n && mo(A.mods, u);
2100
- return b && h.push(A.element), !b;
2101
- }), h.forEach((A) => jt(A));
2102
+ return b && f.push(A.element), !b;
2103
+ }), f.forEach((A) => jt(A));
2102
2104
  });
2103
2105
  };
2104
2106
  function ae(t, e, n, o) {
@@ -2139,16 +2141,16 @@ function ce(t, e) {
2139
2141
  const l = s[r], {
2140
2142
  splitKey: d
2141
2143
  } = l, g = l.key.split(d), u = [];
2142
- for (let h = 0; h < g.length; h++)
2143
- u.push(ft(g[h]));
2144
+ for (let f = 0; f < g.length; f++)
2145
+ u.push(ft(g[f]));
2144
2146
  u.sort().join("") === I.sort().join("") && ae(t, l, i, e);
2145
2147
  }
2146
2148
  }
2147
2149
  function X(t, e, n) {
2148
2150
  I = [];
2149
2151
  const o = Se(t);
2150
- let i = [], s = "all", a = document, r = 0, l = !1, d = !0, g = "+", u = !1, h = !1;
2151
- 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++)
2152
+ let i = [], s = "all", a = document, r = 0, l = !1, d = !0, g = "+", u = !1, f = !1;
2153
+ 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 && (f = !0)), typeof e == "string" && (s = e), f && Te(t, s); r < o.length; r++)
2152
2154
  t = o[r].split(g), i = [], t.length > 1 && (i = Ee(H, t)), t = t[t.length - 1], t = t === "*" ? "*" : ft(t), t in N || (N[t] = []), N[t].push({
2153
2155
  keyup: l,
2154
2156
  keydown: d,
@@ -2258,111 +2260,111 @@ const le = 300, Oe = ["up", "down", "left", "right"], Be = ke ? "⌘+a" : "ctrl+
2258
2260
  ], Bo = (t, e, n) => {
2259
2261
  const { store: o, selection: i } = e;
2260
2262
  let s;
2261
- const { annotatingEnabled: a, offsetReferenceSelector: r, selectionMode: l } = n, d = (f) => s = f;
2263
+ const { annotatingEnabled: a, offsetReferenceSelector: r, selectionMode: l } = n, d = (h) => s = h;
2262
2264
  let g;
2263
- const u = (f) => g = f;
2264
- let h, A, p, b = a;
2265
- const x = (f) => {
2266
- b = f, c.clear(), f || (h = void 0, A = void 0, p = void 0);
2267
- }, m = (f) => {
2268
- b && A !== !1 && (h = st(f.target) ? void 0 : {
2265
+ const u = (h) => g = h;
2266
+ let f, A, p, b = a;
2267
+ const x = (h) => {
2268
+ b = h, c.clear(), h || (f = void 0, A = void 0, p = void 0);
2269
+ }, m = (h) => {
2270
+ b && A !== !1 && (f = st(h.target) ? void 0 : {
2269
2271
  annotation: be(),
2270
2272
  selector: [],
2271
2273
  creator: s,
2272
2274
  created: /* @__PURE__ */ new Date()
2273
2275
  });
2274
- }, c = Xt((f) => {
2276
+ }, c = Xt((h) => {
2275
2277
  if (!b) return;
2276
2278
  const E = document.getSelection();
2277
2279
  if (!(E != null && E.anchorNode))
2278
2280
  return;
2279
2281
  if (st(E.anchorNode)) {
2280
- h = void 0;
2282
+ f = void 0;
2281
2283
  return;
2282
2284
  }
2283
- const M = f.timeStamp - ((p == null ? void 0 : p.timeStamp) || f.timeStamp);
2284
- if ((p == null ? void 0 : p.type) === "pointerdown" && (M < 1e3 && !h || E.isCollapsed && M < le) && m(p || f), !h) return;
2285
+ const M = h.timeStamp - ((p == null ? void 0 : p.timeStamp) || h.timeStamp);
2286
+ if ((p == null ? void 0 : p.type) === "pointerdown" && (M < 1e3 && !f || E.isCollapsed && M < le) && m(p || h), !f) return;
2285
2287
  if (E.isCollapsed) {
2286
- o.getAnnotation(h.annotation) && (i.clear(), o.deleteAnnotation(h.annotation));
2288
+ o.getAnnotation(f.annotation) && (i.clear(), o.deleteAnnotation(f.annotation));
2287
2289
  return;
2288
2290
  }
2289
2291
  const O = E.getRangeAt(0), U = He(O, t);
2290
2292
  if (Ve(U)) return;
2291
2293
  const _ = _e(U.cloneRange());
2292
- (_.length !== h.selector.length || _.some((W, G) => {
2294
+ (_.length !== f.selector.length || _.some((W, G) => {
2293
2295
  var St;
2294
- return W.toString() !== ((St = h.selector[G]) == null ? void 0 : St.quote);
2295
- })) && (h = {
2296
- ...h,
2296
+ return W.toString() !== ((St = f.selector[G]) == null ? void 0 : St.quote);
2297
+ })) && (f = {
2298
+ ...f,
2297
2299
  selector: _.map((W) => Xe(W, t, r)),
2298
2300
  updated: /* @__PURE__ */ new Date()
2299
- }, o.getAnnotation(h.annotation) ? o.updateTarget(h, k.LOCAL) : i.clear());
2300
- }, 10), y = (f) => {
2301
- st(f.target) || (p = Lt(f), A = p.button === 0);
2302
- }, C = async (f) => {
2303
- if (st(f.target) || !A) return;
2301
+ }, o.getAnnotation(f.annotation) ? o.updateTarget(f, k.LOCAL) : i.clear());
2302
+ }, 10), y = (h) => {
2303
+ st(h.target) || (p = Lt(h), A = p.button === 0);
2304
+ }, C = async (h) => {
2305
+ if (st(h.target) || !A) return;
2304
2306
  const E = () => {
2305
- const { x: O, y: U } = t.getBoundingClientRect(), _ = f.target instanceof Node && t.contains(f.target) && o.getAt(f.clientX - O, f.clientY - U, l === "all", g);
2307
+ const { x: O, y: U } = t.getBoundingClientRect(), _ = h.target instanceof Node && t.contains(h.target) && o.getAt(h.clientX - O, h.clientY - U, l === "all", g);
2306
2308
  if (_) {
2307
2309
  const { selected: ht } = i, W = new Set(ht.map((nt) => nt.id)), G = Array.isArray(_) ? _.map((nt) => nt.id) : [_.id];
2308
- (W.size !== G.length || !G.every((nt) => W.has(nt))) && i.userSelect(G, f);
2310
+ (W.size !== G.length || !G.every((nt) => W.has(nt))) && i.userSelect(G, h);
2309
2311
  } else
2310
2312
  i.clear();
2311
2313
  };
2312
- if (f.timeStamp - p.timeStamp < le) {
2314
+ if (h.timeStamp - p.timeStamp < le) {
2313
2315
  await S();
2314
2316
  const O = document.getSelection();
2315
2317
  if (O != null && O.isCollapsed) {
2316
- h = void 0, E();
2318
+ f = void 0, E();
2317
2319
  return;
2318
2320
  }
2319
2321
  }
2320
- h && h.selector.length > 0 && (w(), i.userSelect(h.annotation, Lt(f)));
2322
+ f && f.selector.length > 0 && (w(), i.userSelect(f.annotation, Lt(h)));
2321
2323
  }, S = async () => {
2322
- const f = document.getSelection();
2323
- let E = !1, M = f == null ? void 0 : f.isCollapsed;
2324
+ const h = document.getSelection();
2325
+ let E = !1, M = h == null ? void 0 : h.isCollapsed;
2324
2326
  const O = () => M || E, U = 1;
2325
- return setTimeout(() => E = !0, 50), To(() => M = f == null ? void 0 : f.isCollapsed, U, O);
2326
- }, L = (f) => {
2327
+ return setTimeout(() => E = !0, 50), To(() => M = h == null ? void 0 : h.isCollapsed, U, O);
2328
+ }, L = (h) => {
2327
2329
  const E = document.getSelection();
2328
- E != null && E.isCollapsed || ((!h || h.selector.length === 0) && c(f), w(), i.userSelect(h.annotation, Lt(f)));
2329
- }, B = (f) => {
2330
- b && f.key === "Shift" && h && (document.getSelection().isCollapsed || (w(), i.userSelect(h.annotation, pt(f))));
2331
- }, T = (f) => {
2330
+ E != null && E.isCollapsed || ((!f || f.selector.length === 0) && c(h), w(), i.userSelect(f.annotation, Lt(h)));
2331
+ }, B = (h) => {
2332
+ b && h.key === "Shift" && f && (document.getSelection().isCollapsed || (w(), i.userSelect(f.annotation, pt(h))));
2333
+ }, T = (h) => {
2332
2334
  const E = () => setTimeout(() => {
2333
- (h == null ? void 0 : h.selector.length) > 0 && (i.clear(), o.addAnnotation({
2334
- id: h.annotation,
2335
+ (f == null ? void 0 : f.selector.length) > 0 && (i.clear(), o.addAnnotation({
2336
+ id: f.annotation,
2335
2337
  bodies: [],
2336
- target: h
2337
- }), i.userSelect(h.annotation, pt(f))), document.removeEventListener("selectionchange", E);
2338
+ target: f
2339
+ }), i.userSelect(f.annotation, pt(h))), document.removeEventListener("selectionchange", E);
2338
2340
  }, 100);
2339
- document.addEventListener("selectionchange", E), m(f);
2341
+ document.addEventListener("selectionchange", E), m(h);
2340
2342
  };
2341
- X(Oo.join(","), { element: t, keydown: !0, keyup: !1 }, (f) => {
2342
- f.repeat || (p = pt(f));
2343
- }), X(Be, { keydown: !0, keyup: !1 }, (f) => {
2344
- p = pt(f), T(f);
2343
+ X(Oo.join(","), { element: t, keydown: !0, keyup: !1 }, (h) => {
2344
+ h.repeat || (p = pt(h));
2345
+ }), X(Be, { keydown: !0, keyup: !1 }, (h) => {
2346
+ p = pt(h), T(h);
2345
2347
  });
2346
- const R = (f) => {
2347
- f.repeat || f.target !== t && f.target !== document.body || (h = void 0, i.clear());
2348
+ const R = (h) => {
2349
+ h.repeat || h.target !== t && h.target !== document.body || (f = void 0, i.clear());
2348
2350
  };
2349
2351
  X(Oe.join(","), { keydown: !0, keyup: !1 }, R);
2350
2352
  const w = () => {
2351
- const f = o.getAnnotation(h.annotation);
2352
- if (!f) {
2353
+ const h = o.getAnnotation(f.annotation);
2354
+ if (!h) {
2353
2355
  o.addAnnotation({
2354
- id: h.annotation,
2356
+ id: f.annotation,
2355
2357
  bodies: [],
2356
- target: h
2358
+ target: f
2357
2359
  });
2358
2360
  return;
2359
2361
  }
2360
- const { target: { updated: E } } = f, { updated: M } = h;
2361
- (!E || !M || E < M) && o.updateTarget(h);
2362
+ const { target: { updated: E } } = h, { updated: M } = f;
2363
+ (!E || !M || E < M) && o.updateTarget(f);
2362
2364
  };
2363
2365
  return document.addEventListener("pointerdown", y), document.addEventListener("pointerup", C), document.addEventListener("contextmenu", L), t.addEventListener("keyup", B), t.addEventListener("selectstart", m), document.addEventListener("selectionchange", c), {
2364
2366
  destroy: () => {
2365
- h = void 0, A = void 0, p = void 0, c.clear(), document.removeEventListener("pointerdown", y), document.removeEventListener("pointerup", C), document.removeEventListener("contextmenu", L), t.removeEventListener("keyup", B), t.removeEventListener("selectstart", m), document.removeEventListener("selectionchange", c), X.unbind();
2367
+ f = void 0, A = void 0, p = void 0, c.clear(), document.removeEventListener("pointerdown", y), document.removeEventListener("pointerup", C), document.removeEventListener("contextmenu", L), t.removeEventListener("keyup", B), t.removeEventListener("selectstart", m), document.removeEventListener("selectionchange", c), X.unbind();
2366
2368
  },
2367
2369
  setFilter: u,
2368
2370
  setUser: d,
@@ -2383,16 +2385,16 @@ const le = 300, Oe = ["up", "down", "left", "right"], Be = ke ? "⌘+a" : "ctrl+
2383
2385
  if (!u)
2384
2386
  throw `Unknown renderer implementation: ${g}`;
2385
2387
  console.debug(`Using ${g} renderer`), n.style && u.setStyle(n.style);
2386
- const h = Bo(t, o, n);
2387
- h.setUser(d), h.setAnnotatingEnabled(n.annotatingEnabled);
2388
+ const f = Bo(t, o, n);
2389
+ f.setUser(d), f.setAnnotatingEnabled(n.annotatingEnabled);
2388
2390
  const A = $n(o, r, n.adapter), p = () => d, b = (S) => {
2389
- h.setAnnotatingEnabled(
2391
+ f.setAnnotatingEnabled(
2390
2392
  S === void 0 ? !0 : S
2391
2393
  );
2392
2394
  }, x = (S) => {
2393
- u.setFilter(S), h.setFilter(S);
2395
+ u.setFilter(S), f.setFilter(S);
2394
2396
  }, m = (S) => {
2395
- d = S, h.setUser(S);
2397
+ d = S, f.setUser(S);
2396
2398
  }, c = (S) => {
2397
2399
  S && (u.setPainter(go(S, n.presence)), S.on("selectionChange", () => u.redraw()));
2398
2400
  }, y = (S) => {
@@ -2401,7 +2403,7 @@ const le = 300, Oe = ["up", "down", "left", "right"], Be = ke ? "⌘+a" : "ctrl+
2401
2403
  return {
2402
2404
  ...A,
2403
2405
  destroy: () => {
2404
- u.destroy(), h.destroy(), r.destroy();
2406
+ u.destroy(), f.destroy(), r.destroy();
2405
2407
  },
2406
2408
  element: t,
2407
2409
  getUser: p,