@soomo/react-text-annotator 3.1.0-staging.9 → 3.2.0-staging.1

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.
Files changed (89) hide show
  1. package/dist/TextAnnotationPopup/TextAnnotationPopup.d.ts +32 -0
  2. package/dist/TextAnnotationPopup/TextAnnotationPopup.d.ts.map +1 -0
  3. package/dist/TextAnnotationPopup/index.d.ts +2 -0
  4. package/dist/TextAnnotationPopup/index.d.ts.map +1 -0
  5. package/dist/TextAnnotationPopup/isMobile.d.ts.map +1 -0
  6. package/dist/TextAnnotator.d.ts +5 -5
  7. package/dist/TextAnnotator.d.ts.map +1 -1
  8. package/dist/hooks/index.d.ts +2 -1
  9. package/dist/hooks/index.d.ts.map +1 -1
  10. package/dist/hooks/useAnnotationQuoteIdling.d.ts +4 -0
  11. package/dist/hooks/useAnnotationQuoteIdling.d.ts.map +1 -0
  12. package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +1 -1
  13. package/dist/index.d.ts +4 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/react-text-annotator.es.js +10 -4
  16. package/dist/react-text-annotator.es.js.map +1 -1
  17. package/dist/react-text-annotator.es10.js +24 -10
  18. package/dist/react-text-annotator.es10.js.map +1 -1
  19. package/dist/react-text-annotator.es11.js +82 -9
  20. package/dist/react-text-annotator.es11.js.map +1 -1
  21. package/dist/react-text-annotator.es12.js +33 -1436
  22. package/dist/react-text-annotator.es12.js.map +1 -1
  23. package/dist/react-text-annotator.es13.js +28 -0
  24. package/dist/react-text-annotator.es13.js.map +1 -0
  25. package/dist/react-text-annotator.es14.js +1590 -193
  26. package/dist/react-text-annotator.es14.js.map +1 -1
  27. package/dist/react-text-annotator.es15.js +9 -584
  28. package/dist/react-text-annotator.es15.js.map +1 -1
  29. package/dist/react-text-annotator.es17.js +592 -33
  30. package/dist/react-text-annotator.es17.js.map +1 -1
  31. package/dist/react-text-annotator.es18.js +282 -2
  32. package/dist/react-text-annotator.es18.js.map +1 -1
  33. package/dist/react-text-annotator.es19.js +13 -29
  34. package/dist/react-text-annotator.es19.js.map +1 -1
  35. package/dist/react-text-annotator.es2.js +5 -2
  36. package/dist/react-text-annotator.es2.js.map +1 -1
  37. package/dist/react-text-annotator.es20.js +2 -898
  38. package/dist/react-text-annotator.es20.js.map +1 -1
  39. package/dist/react-text-annotator.es21.js +31 -2
  40. package/dist/react-text-annotator.es21.js.map +1 -1
  41. package/dist/react-text-annotator.es22.js +888 -2
  42. package/dist/react-text-annotator.es22.js.map +1 -1
  43. package/dist/react-text-annotator.es23.js +111 -124
  44. package/dist/react-text-annotator.es23.js.map +1 -1
  45. package/dist/react-text-annotator.es24.js +285 -140
  46. package/dist/react-text-annotator.es24.js.map +1 -1
  47. package/dist/react-text-annotator.es25.js +43 -296
  48. package/dist/react-text-annotator.es25.js.map +1 -1
  49. package/dist/react-text-annotator.es26.js +19 -113
  50. package/dist/react-text-annotator.es26.js.map +1 -1
  51. package/dist/react-text-annotator.es27.js +2 -309
  52. package/dist/react-text-annotator.es27.js.map +1 -1
  53. package/dist/react-text-annotator.es28.js +2 -58
  54. package/dist/react-text-annotator.es28.js.map +1 -1
  55. package/dist/react-text-annotator.es29.js +124 -17
  56. package/dist/react-text-annotator.es29.js.map +1 -1
  57. package/dist/react-text-annotator.es3.js +3 -3
  58. package/dist/react-text-annotator.es3.js.map +1 -1
  59. package/dist/react-text-annotator.es30.js +146 -131
  60. package/dist/react-text-annotator.es30.js.map +1 -1
  61. package/dist/react-text-annotator.es31.js +281 -533
  62. package/dist/react-text-annotator.es31.js.map +1 -1
  63. package/dist/react-text-annotator.es32.js +152 -0
  64. package/dist/react-text-annotator.es32.js.map +1 -0
  65. package/dist/react-text-annotator.es33.js +629 -0
  66. package/dist/react-text-annotator.es33.js.map +1 -0
  67. package/dist/react-text-annotator.es4.js +2 -2
  68. package/dist/react-text-annotator.es4.js.map +1 -1
  69. package/dist/react-text-annotator.es5.js +43 -24
  70. package/dist/react-text-annotator.es5.js.map +1 -1
  71. package/dist/react-text-annotator.es6.js +23 -122
  72. package/dist/react-text-annotator.es6.js.map +1 -1
  73. package/dist/react-text-annotator.es7.js +133 -537
  74. package/dist/react-text-annotator.es7.js.map +1 -1
  75. package/dist/react-text-annotator.es8.js +2 -9
  76. package/dist/react-text-annotator.es8.js.map +1 -1
  77. package/dist/tei/CETEIcean.d.ts +1 -0
  78. package/dist/tei/CETEIcean.d.ts.map +1 -1
  79. package/dist/tei/TEIAnnotator.d.ts +1 -1
  80. package/dist/tei/TEIAnnotator.d.ts.map +1 -1
  81. package/package.json +16 -14
  82. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts +0 -25
  83. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +0 -1
  84. package/dist/TextAnnotatorPopup/index.d.ts +0 -2
  85. package/dist/TextAnnotatorPopup/index.d.ts.map +0 -1
  86. package/dist/TextAnnotatorPopup/isMobile.d.ts.map +0 -1
  87. package/dist/react-text-annotator.es16.js +0 -85
  88. package/dist/react-text-annotator.es16.js.map +0 -1
  89. /package/dist/{TextAnnotatorPopup → TextAnnotationPopup}/isMobile.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es7.js","sources":["../../../node_modules/@recogito/text-annotator/dist/text-annotator.es.js"],"sourcesContent":["const ce = \"not-annotatable\", H = `.${ce}`, Le = (t) => {\n var n;\n const e = t.commonAncestorContainer;\n return e instanceof HTMLElement ? !e.closest(H) : !((n = e.parentElement) != null && n.closest(H));\n}, Te = function* (t) {\n const e = document.createNodeIterator(\n t.commonAncestorContainer,\n NodeFilter.SHOW_ELEMENT,\n (o) => o instanceof HTMLElement && o.classList.contains(ce) && !o.parentElement.closest(H) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP\n );\n let n;\n for (; n = e.nextNode(); )\n n instanceof HTMLElement && (yield n);\n}, Oe = (t) => {\n if (!Le(t)) return [];\n const e = [];\n let n = null;\n for (const o of Te(t)) {\n let i;\n n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;\n }\n if (n) {\n const o = t.cloneRange();\n o.setStartAfter(n), o.collapsed || e.push(o);\n }\n return e.length > 0 ? e : [t];\n}, Vt = (t) => {\n const e = t.cloneContents();\n return e.querySelectorAll(H).forEach((n) => n.remove()), e;\n}, Me = (t) => t.addEventListener(\"click\", (e) => {\n // Allow clicks within not-annotatable elements\n !e.target.closest(H) && !e.target.closest(\"a\") && e.preventDefault();\n}), Re = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Be = (t) => {\n !t.hasAttribute(\"tabindex\") && t.tabIndex < 0 && t.setAttribute(\"tabindex\", \"-1\"), t.classList.add(\"no-focus-outline\");\n}, Dt = (t, e = 10) => {\n let n;\n return (...o) => {\n clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);\n };\n}, vo = (t) => {\n const e = t.cloneContents();\n return e.querySelectorAll(H).forEach((n) => n.remove()), e;\n}, ke = (t, e, n = 10, o) => {\n const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();\n s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);\n const a = Vt(s).textContent, r = document.createRange();\n r.setStart(t.endContainer, t.endOffset), i === document.body ? r.setEnd(i, i.childNodes.length) : r.setEndAfter(i);\n const l = Vt(r).textContent;\n return {\n prefix: a.substring(a.length - n),\n suffix: l.substring(0, n)\n };\n}, Ie = /^\\s*$/, _e = (t) => Ie.test(t.toString()), W = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), Ne = (t, e) => {\n const n = (s) => Math.round(s * 10) / 10, o = {\n top: n(t.top),\n bottom: n(t.bottom),\n left: n(t.left),\n right: n(t.right)\n }, i = {\n top: n(e.top),\n bottom: n(e.bottom),\n left: n(e.left),\n right: n(e.right)\n };\n if (Math.abs(o.top - i.top) < 0.5 && Math.abs(o.bottom - i.bottom) < 0.5) {\n if (Math.abs(o.left - i.right) < 0.5 || Math.abs(o.right - i.left) < 0.5)\n return \"inline-adjacent\";\n if (o.left >= i.left && o.right <= i.right)\n return \"inline-is-contained\";\n if (o.left <= i.left && o.right >= i.right)\n return \"inline-contains\";\n } else if (o.top <= i.top && o.bottom >= i.bottom) {\n if (o.left <= i.left && o.right >= i.right)\n return \"block-contains\";\n } else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)\n return \"block-is-contained\";\n}, Ue = (t, e) => {\n 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);\n return new DOMRect(n, i, o - n, s - i);\n}, Ve = (t) => t.reduce((e, n) => {\n if (n.width === 0 || n.height === 0)\n return e;\n let o = [...e], i = !1;\n for (const s of e) {\n const a = Ne(n, s);\n if (a === \"inline-adjacent\") {\n o = o.map((r) => r === s ? Ue(n, s) : r), i = !0;\n break;\n } else if (a === \"inline-contains\") {\n o = o.map((r) => r === s ? n : r), i = !0;\n break;\n } else if (a === \"inline-is-contained\") {\n i = !0;\n break;\n } else if (a === \"block-contains\" || a === \"block-is-contained\") {\n n.width < s.width && (o = o.map((r) => r === s ? n : r)), i = !0;\n break;\n }\n }\n return i ? o : [...o, n];\n}, []), Ke = (t, e, n) => {\n const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;\n o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);\n const s = Vt(o).textContent, a = t.toString(), r = s.length || 0, l = r + a.length;\n return n ? { quote: a, start: r, end: l, range: t, offsetReference: i } : { quote: a, start: r, end: l, range: t };\n}, le = (t, e) => {\n var u, h;\n const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(\n e,\n NodeFilter.SHOW_TEXT,\n (g) => {\n var p;\n return (p = g.parentElement) != null && p.closest(H) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;\n }\n );\n let a = 0;\n const r = document.createRange();\n let l = s.nextNode();\n l === null && console.error(\"Could not revive annotation target. Content missing.\");\n let f = !i;\n for (; l !== null; ) {\n if (f || (f = i == null ? void 0 : i.contains(l)), f) {\n const g = ((u = l.textContent) == null ? void 0 : u.length) || 0;\n if (a + g > n) {\n r.setStart(l, n - a);\n break;\n }\n a += g;\n }\n l = s.nextNode();\n }\n for (; l !== null; ) {\n const g = ((h = l.textContent) == null ? void 0 : h.length) || 0;\n if (a + g >= o) {\n r.setEnd(l, o - a);\n break;\n }\n a += g, l = s.nextNode();\n }\n return {\n ...t,\n range: r\n };\n}, wt = (t, e) => W(t.selector) ? t : {\n ...t,\n selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : le(n, e))\n}, xt = (t, e) => W(t.target.selector) ? t : { ...t, target: wt(t.target, e) }, Ye = (t, e) => {\n const n = t.cloneRange();\n return e.contains(n.startContainer) || n.setStart(e, 0), e.contains(n.endContainer) || n.setEnd(e, e.childNodes.length), n;\n}, Et = (t) => ({\n ...t,\n type: t.type,\n x: t.x,\n y: t.y,\n clientX: t.clientX,\n clientY: t.clientY,\n offsetX: t.offsetX,\n offsetY: t.offsetY,\n screenX: t.screenX,\n screenY: t.screenY,\n isPrimary: t.isPrimary,\n altKey: t.altKey,\n ctrlKey: t.ctrlKey,\n metaKey: t.metaKey,\n shiftKey: t.shiftKey,\n button: t.button,\n buttons: t.buttons,\n currentTarget: t.currentTarget,\n target: t.target,\n defaultPrevented: t.defaultPrevented,\n detail: t.detail,\n eventPhase: t.eventPhase,\n pointerId: t.pointerId,\n pointerType: t.pointerType,\n timeStamp: t.timeStamp\n}), ut = (t) => ({\n ...t,\n type: t.type,\n key: t.key,\n code: t.code,\n location: t.location,\n repeat: t.repeat,\n altKey: t.altKey,\n ctrlKey: t.ctrlKey,\n metaKey: t.metaKey,\n shiftKey: t.shiftKey,\n currentTarget: t.currentTarget,\n target: t.target,\n defaultPrevented: t.defaultPrevented,\n detail: t.detail,\n timeStamp: t.timeStamp\n}), de = (t) => {\n if (t === null)\n return document.scrollingElement;\n const { overflowY: e } = window.getComputedStyle(t);\n return e !== \"visible\" && e !== \"hidden\" && t.scrollHeight > t.clientHeight ? t : de(t.parentElement);\n}, De = (t, e) => (n) => {\n const o = typeof n == \"string\" ? n : n.id, i = (a) => {\n const r = s.getBoundingClientRect(), l = s.clientHeight, f = s.clientWidth, u = a.selector[0].range.getBoundingClientRect(), { width: h, height: g } = e.getAnnotationBounds(o), p = u.top - r.top, v = u.left - r.left, y = s.parentElement ? s.scrollTop : 0, m = s.parentElement ? s.scrollLeft : 0, d = p + y - (l - g) / 2, c = v + m - (f - h) / 2;\n s.scroll({ top: d, left: c, behavior: \"smooth\" });\n }, s = de(t);\n if (s) {\n const a = e.getAnnotation(o), { range: r } = a.target.selector[0];\n if (r && !r.collapsed)\n return i(a.target), !0;\n {\n const l = wt(a.target, t), { range: f } = l.selector[0];\n if (f && !f.collapsed)\n return i(l), !0;\n }\n }\n return !1;\n}, q = {\n fill: \"rgb(0, 128, 255)\",\n fillOpacity: 0.18\n}, vt = {\n fill: \"rgb(0, 128, 255)\",\n fillOpacity: 0.45\n}, Xe = (t, e, n, o, i) => {\n var a, r;\n const s = n ? typeof n == \"function\" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ? vt : q) : n : (r = t.state) != null && r.selected ? vt : q;\n return o && o.paint(t, e) || s;\n}, Pe = (t) => {\n const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, a = -e, r = o - n, l = i - e;\n return { top: e, left: n, minX: s, minY: a, maxX: r, maxY: l };\n}, $e = (t) => {\n let e = /* @__PURE__ */ new Set();\n return (o) => {\n const i = o.map((s) => s.id);\n (e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);\n };\n}, Xt = (t, e, n, o) => {\n const { store: i, selection: s, hover: a } = e;\n let r, l, f;\n const u = $e(n), h = (E) => {\n const { x: R, y: b } = t.getBoundingClientRect(), x = i.getAt(E.clientX - R, E.clientY - b, l);\n x ? a.current !== x.id && (t.classList.add(\"hovered\"), a.set(x.id)) : a.current && (t.classList.remove(\"hovered\"), a.set(null));\n };\n t.addEventListener(\"pointermove\", h);\n const g = (E = !1) => {\n f && f.clear();\n const R = Pe(t), { minX: b, minY: x, maxX: A, maxY: C } = R, B = l ? i.getIntersecting(b, x, A, C).filter(({ annotation: D }) => l(D)) : i.getIntersecting(b, x, A, C), M = s.selected.map(({ id: D }) => D), N = B.map(({ annotation: D, rects: tt }) => {\n const At = M.includes(D.id), dt = D.id === a.current;\n return { annotation: D, rects: tt, state: { selected: At, hover: dt } };\n });\n o.redraw(N, R, r, f, E), setTimeout(() => u(B.map(({ annotation: D }) => D)), 1);\n }, p = (E) => {\n f = E, g();\n }, v = (E) => {\n r = E, g();\n }, y = (E) => {\n l = E, g(!1);\n }, m = () => g();\n i.observe(m);\n const d = s.subscribe(() => g()), c = () => g(!0);\n document.addEventListener(\"scroll\", c, { capture: !0, passive: !0 });\n const w = Dt(() => {\n i.recalculatePositions(), f && f.reset(), g();\n });\n window.addEventListener(\"resize\", w);\n const S = new ResizeObserver(w);\n S.observe(t);\n const T = { attributes: !0, childList: !0, subtree: !0 }, L = new MutationObserver((E) => {\n E.every((b) => b.target === t || t.contains(b.target)) || g(!0);\n });\n return L.observe(document.body, T), {\n destroy: () => {\n t.removeEventListener(\"pointermove\", h), o.destroy(), i.unobserve(m), d(), document.removeEventListener(\"scroll\", c), window.removeEventListener(\"resize\", w), S.disconnect(), L.disconnect();\n },\n redraw: g,\n setStyle: v,\n setFilter: y,\n setPainter: p,\n setVisible: o.setVisible\n };\n}, He = () => {\n const t = document.createElement(\"canvas\");\n return t.width = window.innerWidth, t.height = window.innerHeight, t.className = \"r6o-canvas-highlight-layer bg\", t;\n}, je = (t, e) => {\n t.width = window.innerWidth, t.height = window.innerHeight;\n}, ze = (t) => {\n t.classList.add(\"r6o-annotatable\");\n const e = He(), n = e.getContext(\"2d\");\n document.body.appendChild(e);\n const o = (r, l, f, u) => requestAnimationFrame(() => {\n const { width: h, height: g } = e;\n n.clearRect(-0.5, -0.5, h + 1, g + 1), u && u.clear();\n const { top: p, left: v } = l;\n [...r].sort((m, d) => {\n const { annotation: { target: { created: c } } } = m, { annotation: { target: { created: w } } } = d;\n return c.getTime() - w.getTime();\n }).forEach((m) => {\n var S;\n const d = f ? typeof f == \"function\" ? f(m.annotation, m.state) : f : (S = m.state) != null && S.selected ? vt : q, c = u && u.paint(m, l) || d, w = m.rects.map(({ x: T, y: L, width: O, height: E }) => ({\n x: T + v,\n y: L + p,\n width: O,\n height: E\n }));\n if (n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1, w.forEach(\n ({ x: T, y: L, width: O, height: E }) => n.fillRect(T, L, O, E)\n ), c.underlineColor) {\n n.globalAlpha = 1, n.strokeStyle = c.underlineColor, n.lineWidth = c.underlineThickness ?? 1;\n const T = c.underlineOffset ?? 0;\n w.forEach(({ x: L, y: O, width: E, height: R }) => {\n n.beginPath(), n.moveTo(L, O + R + T), n.lineTo(L + E, O + R + T), n.stroke();\n });\n }\n });\n }), i = Dt(() => {\n je(e);\n });\n return window.addEventListener(\"resize\", i), {\n destroy: () => {\n e.remove(), window.removeEventListener(\"resize\", i);\n },\n setVisible: (r) => {\n console.log(\"setVisible not implemented on Canvas renderer\");\n },\n redraw: o\n };\n}, Fe = (t, e, n) => Xt(t, e, n, ze(t));\nvar We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, z = function(t) {\n return typeof t == \"string\" ? t.length > 0 : typeof t == \"number\";\n}, U = function(t, e, n) {\n return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;\n}, X = function(t, e, n) {\n return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;\n}, ue = function(t) {\n return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;\n}, Ht = function(t) {\n return { r: X(t.r, 0, 255), g: X(t.g, 0, 255), b: X(t.b, 0, 255), a: X(t.a) };\n}, St = function(t) {\n return { r: U(t.r), g: U(t.g), b: U(t.b), a: U(t.a, 3) };\n}, qe = /^#([0-9a-f]{3,8})$/i, ft = function(t) {\n var e = t.toString(16);\n return e.length < 2 ? \"0\" + e : e;\n}, fe = function(t) {\n 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;\n return { h: 60 * (r < 0 ? r + 6 : r), s: s ? a / s * 100 : 0, v: s / 255 * 100, a: i };\n}, he = function(t) {\n var e = t.h, n = t.s, o = t.v, i = t.a;\n e = e / 360 * 6, n /= 100, o /= 100;\n var s = Math.floor(e), a = o * (1 - n), r = o * (1 - (e - s) * n), l = o * (1 - (1 - e + s) * n), f = s % 6;\n return { r: 255 * [o, r, a, a, l, o][f], g: 255 * [l, o, o, r, a, a][f], b: 255 * [a, a, l, o, o, r][f], a: i };\n}, jt = function(t) {\n return { h: ue(t.h), s: X(t.s, 0, 100), l: X(t.l, 0, 100), a: X(t.a) };\n}, zt = function(t) {\n return { h: U(t.h), s: U(t.s), l: U(t.l), a: U(t.a, 3) };\n}, Ft = function(t) {\n return he((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 }));\n var e, n, o;\n}, st = function(t) {\n return { h: (e = fe(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 };\n var e, n, o, i;\n}, Ge = /^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, Qe = /^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s+([+-]?\\d*\\.?\\d+)%\\s+([+-]?\\d*\\.?\\d+)%\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, Je = /^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, Ze = /^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, Wt = { string: [[function(t) {\n var e = qe.exec(t);\n 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 ? U(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 ? U(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;\n}, \"hex\"], [function(t) {\n var e = Je.exec(t) || Ze.exec(t);\n return e ? e[2] !== e[4] || e[4] !== e[6] ? null : Ht({ 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;\n}, \"rgb\"], [function(t) {\n var e = Ge.exec(t) || Qe.exec(t);\n if (!e) return null;\n var n, o, i = jt({ h: (n = e[1], o = e[2], o === void 0 && (o = \"deg\"), Number(n) * (We[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });\n return Ft(i);\n}, \"hsl\"]], object: [[function(t) {\n var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;\n return z(e) && z(n) && z(o) ? Ht({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;\n}, \"rgb\"], [function(t) {\n var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;\n if (!z(e) || !z(n) || !z(o)) return null;\n var a = jt({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });\n return Ft(a);\n}, \"hsl\"], [function(t) {\n var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;\n if (!z(e) || !z(n) || !z(o)) return null;\n var a = function(r) {\n return { h: ue(r.h), s: X(r.s, 0, 100), v: X(r.v, 0, 100), a: X(r.a) };\n }({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });\n return he(a);\n}, \"hsv\"]] }, qt = function(t, e) {\n for (var n = 0; n < e.length; n++) {\n var o = e[n][0](t);\n if (o) return [o, e[n][1]];\n }\n return [null, void 0];\n}, tn = function(t) {\n return typeof t == \"string\" ? qt(t.trim(), Wt.string) : typeof t == \"object\" && t !== null ? qt(t, Wt.object) : [null, void 0];\n}, Ct = function(t, e) {\n var n = st(t);\n return { h: n.h, s: X(n.s + 100 * e, 0, 100), l: n.l, a: n.a };\n}, Lt = function(t) {\n return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;\n}, Gt = function(t, e) {\n var n = st(t);\n return { h: n.h, s: n.s, l: X(n.l + 100 * e, 0, 100), a: n.a };\n}, Qt = function() {\n function t(e) {\n this.parsed = tn(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };\n }\n return t.prototype.isValid = function() {\n return this.parsed !== null;\n }, t.prototype.brightness = function() {\n return U(Lt(this.rgba), 2);\n }, t.prototype.isDark = function() {\n return Lt(this.rgba) < 0.5;\n }, t.prototype.isLight = function() {\n return Lt(this.rgba) >= 0.5;\n }, t.prototype.toHex = function() {\n return e = St(this.rgba), n = e.r, o = e.g, i = e.b, a = (s = e.a) < 1 ? ft(U(255 * s)) : \"\", \"#\" + ft(n) + ft(o) + ft(i) + a;\n var e, n, o, i, s, a;\n }, t.prototype.toRgb = function() {\n return St(this.rgba);\n }, t.prototype.toRgbString = function() {\n return e = St(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? \"rgba(\" + n + \", \" + o + \", \" + i + \", \" + s + \")\" : \"rgb(\" + n + \", \" + o + \", \" + i + \")\";\n var e, n, o, i, s;\n }, t.prototype.toHsl = function() {\n return zt(st(this.rgba));\n }, t.prototype.toHslString = function() {\n return e = zt(st(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? \"hsla(\" + n + \", \" + o + \"%, \" + i + \"%, \" + s + \")\" : \"hsl(\" + n + \", \" + o + \"%, \" + i + \"%)\";\n var e, n, o, i, s;\n }, t.prototype.toHsv = function() {\n return e = fe(this.rgba), { h: U(e.h), s: U(e.s), v: U(e.v), a: U(e.a, 3) };\n var e;\n }, t.prototype.invert = function() {\n return $({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });\n var e;\n }, t.prototype.saturate = function(e) {\n return e === void 0 && (e = 0.1), $(Ct(this.rgba, e));\n }, t.prototype.desaturate = function(e) {\n return e === void 0 && (e = 0.1), $(Ct(this.rgba, -e));\n }, t.prototype.grayscale = function() {\n return $(Ct(this.rgba, -1));\n }, t.prototype.lighten = function(e) {\n return e === void 0 && (e = 0.1), $(Gt(this.rgba, e));\n }, t.prototype.darken = function(e) {\n return e === void 0 && (e = 0.1), $(Gt(this.rgba, -e));\n }, t.prototype.rotate = function(e) {\n return e === void 0 && (e = 15), this.hue(this.hue() + e);\n }, t.prototype.alpha = function(e) {\n return typeof e == \"number\" ? $({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : U(this.rgba.a, 3);\n var n;\n }, t.prototype.hue = function(e) {\n var n = st(this.rgba);\n return typeof e == \"number\" ? $({ h: e, s: n.s, l: n.l, a: n.a }) : U(n.h);\n }, t.prototype.isEqual = function(e) {\n return this.toHex() === $(e).toHex();\n }, t;\n}(), $ = function(t) {\n return t instanceof Qt ? t : new Qt(t);\n};\nconst en = (t) => [\n `background-color:${$((t == null ? void 0 : t.fill) || q.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? q.fillOpacity : t.fillOpacity).toHex()}`,\n t != null && t.underlineThickness ? \"text-decoration:underline\" : void 0,\n t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,\n t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,\n t != null && t.underlineThickness ? `text-decoration-thickness:${t.underlineThickness}px` : void 0\n].filter(Boolean).join(\";\"), nn = () => {\n const t = document.createElement(\"style\");\n document.getElementsByTagName(\"head\")[0].appendChild(t);\n let e = /* @__PURE__ */ new Set();\n return {\n destroy: () => {\n CSS.highlights.clear(), t.remove();\n },\n setVisible: (s) => {\n console.log(\"setVisible not implemented on CSS Custom Highlights renderer\");\n },\n redraw: (s, a, r, l) => {\n l && l.clear();\n const f = new Set(s.map((h) => h.annotation.id));\n Array.from(e).filter((h) => !f.has(h));\n const u = s.map((h) => {\n var v;\n const g = r ? typeof r == \"function\" ? r(h.annotation, h.state) : r : (v = h.state) != null && v.selected ? vt : q, p = l && l.paint(h, a) || g;\n return `::highlight(_${h.annotation.id}) { ${en(p)} }`;\n });\n t.innerHTML = u.join(`\n`), CSS.highlights.clear(), s.forEach(({ annotation: h }) => {\n const g = h.target.selector.map((v) => v.range), p = new Highlight(...g);\n CSS.highlights.set(`_${h.id}`, p);\n }), e = f;\n }\n };\n}, on = (t, e, n) => Xt(t, e, n, nn());\nvar Jt = Object.prototype.hasOwnProperty;\nfunction Kt(t, e) {\n var n, o;\n if (t === e) return !0;\n if (t && e && (n = t.constructor) === e.constructor) {\n if (n === Date) return t.getTime() === e.getTime();\n if (n === RegExp) return t.toString() === e.toString();\n if (n === Array) {\n if ((o = t.length) === e.length)\n for (; o-- && Kt(t[o], e[o]); ) ;\n return o === -1;\n }\n if (!n || typeof t == \"object\") {\n o = 0;\n for (n in t)\n if (Jt.call(t, n) && ++o && !Jt.call(e, n) || !(n in e) || !Kt(t[n], e[n])) return !1;\n return Object.keys(e).length === o;\n }\n }\n return t !== t && e !== e;\n}\nconst sn = (t, e) => {\n 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)));\n return i.sort((s, a) => o(a) - o(s)), i.findIndex((s) => s.rects.includes(t));\n}, rn = (t) => {\n t.classList.add(\"r6o-annotatable\");\n const e = document.createElement(\"div\");\n e.className = \"r6o-span-highlight-layer\", t.insertBefore(e, t.firstChild);\n let n = [];\n return {\n destroy: () => {\n e.remove();\n },\n redraw: (a, r, l, f, u) => {\n const g = !(Kt(n, a) && u);\n if (!f && !g) return;\n g && (e.innerHTML = \"\"), [...a].sort((v, y) => {\n const { annotation: { target: { created: m } } } = v, { annotation: { target: { created: d } } } = y;\n return m && d ? m.getTime() - d.getTime() : 0;\n }).forEach((v) => {\n v.rects.map((y) => {\n const m = sn(y, a), d = Xe(v, r, l, f, m);\n if (g) {\n const c = document.createElement(\"span\");\n c.className = \"r6o-annotation\", c.dataset.annotation = v.annotation.id, c.style.left = `${y.x}px`, c.style.top = `${y.y}px`, c.style.width = `${y.width}px`, c.style.height = `${y.height}px`, c.style.backgroundColor = $((d == null ? void 0 : d.fill) || q.fill).alpha((d == null ? void 0 : d.fillOpacity) === void 0 ? q.fillOpacity : d.fillOpacity).toHex(), d.underlineStyle && (c.style.borderStyle = d.underlineStyle), d.underlineColor && (c.style.borderColor = d.underlineColor), d.underlineThickness && (c.style.borderBottomWidth = `${d.underlineThickness}px`), d.underlineOffset && (c.style.paddingBottom = `${d.underlineOffset}px`), e.appendChild(c);\n }\n });\n }), n = a;\n },\n setVisible: (a) => {\n a ? e.classList.remove(\"hidden\") : e.classList.add(\"hidden\");\n }\n };\n}, an = (t, e, n) => Xt(t, e, n, rn(t));\nvar V = [];\nfor (var Tt = 0; Tt < 256; ++Tt)\n V.push((Tt + 256).toString(16).slice(1));\nfunction cn(t, e = 0) {\n return (V[t[e + 0]] + V[t[e + 1]] + V[t[e + 2]] + V[t[e + 3]] + \"-\" + V[t[e + 4]] + V[t[e + 5]] + \"-\" + V[t[e + 6]] + V[t[e + 7]] + \"-\" + V[t[e + 8]] + V[t[e + 9]] + \"-\" + V[t[e + 10]] + V[t[e + 11]] + V[t[e + 12]] + V[t[e + 13]] + V[t[e + 14]] + V[t[e + 15]]).toLowerCase();\n}\nvar ht, ln = new Uint8Array(16);\nfunction dn() {\n if (!ht && (ht = typeof crypto < \"u\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ht))\n throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return ht(ln);\n}\nvar un = typeof crypto < \"u\" && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nconst Zt = {\n randomUUID: un\n};\nfunction pe(t, e, n) {\n if (Zt.randomUUID && !e && !t)\n return Zt.randomUUID();\n t = t || {};\n var o = t.random || (t.rng || dn)();\n return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, cn(o);\n}\nvar te = Object.prototype.hasOwnProperty;\nfunction G(t, e) {\n var n, o;\n if (t === e) return !0;\n if (t && e && (n = t.constructor) === e.constructor) {\n if (n === Date) return t.getTime() === e.getTime();\n if (n === RegExp) return t.toString() === e.toString();\n if (n === Array) {\n if ((o = t.length) === e.length)\n for (; o-- && G(t[o], e[o]); ) ;\n return o === -1;\n }\n if (!n || typeof t == \"object\") {\n o = 0;\n for (n in t)\n if (te.call(t, n) && ++o && !te.call(e, n) || !(n in e) || !G(t[n], e[n])) return !1;\n return Object.keys(e).length === o;\n }\n }\n return t !== t && e !== e;\n}\nfunction Ot() {\n}\nfunction fn(t, e) {\n return t != t ? e == e : t !== e || t && typeof t == \"object\" || typeof t == \"function\";\n}\nconst Q = [];\nfunction Pt(t, e = Ot) {\n let n;\n const o = /* @__PURE__ */ new Set();\n function i(r) {\n if (fn(t, r) && (t = r, n)) {\n const l = !Q.length;\n for (const f of o)\n f[1](), Q.push(f, t);\n if (l) {\n for (let f = 0; f < Q.length; f += 2)\n Q[f][0](Q[f + 1]);\n Q.length = 0;\n }\n }\n }\n function s(r) {\n i(r(t));\n }\n function a(r, l = Ot) {\n const f = [r, l];\n return o.add(f), o.size === 1 && (n = e(i, s) || Ot), r(t), () => {\n o.delete(f), o.size === 0 && n && (n(), n = null);\n };\n }\n return { set: i, update: s, subscribe: a };\n}\nconst hn = (t) => {\n const { subscribe: e, set: n } = Pt();\n let o;\n return e((i) => o = i), t.observe(({ changes: i }) => {\n if (o) {\n (i.deleted || []).some((a) => a.id === o) && n(void 0);\n const s = (i.updated || []).find(({ oldValue: a }) => a.id === o);\n s && n(s.newValue.id);\n }\n }), {\n get current() {\n return o;\n },\n subscribe: e,\n set: n\n };\n};\nvar pn = /* @__PURE__ */ ((t) => (t.EDIT = \"EDIT\", t.SELECT = \"SELECT\", t.NONE = \"NONE\", t))(pn || {});\nconst pt = { selected: [] }, gn = (t, e, n) => {\n const { subscribe: o, set: i } = Pt(pt);\n let s = e, a = pt;\n o((v) => a = v);\n const r = () => {\n G(a, pt) || i(pt);\n }, l = () => {\n var v;\n return ((v = a.selected) == null ? void 0 : v.length) === 0;\n }, f = (v) => {\n if (l())\n return !1;\n const y = typeof v == \"string\" ? v : v.id;\n return a.selected.some((m) => m.id === y);\n }, u = (v, y) => {\n const m = t.getAnnotation(v);\n if (!m) {\n console.warn(\"Invalid selection: \" + v);\n return;\n }\n switch (ee(m, s)) {\n case \"EDIT\":\n i({ selected: [{ id: v, editable: !0 }], event: y });\n break;\n case \"SELECT\":\n i({ selected: [{ id: v }], event: y });\n break;\n default:\n i({ selected: [], event: y });\n }\n }, h = (v, y) => {\n const m = Array.isArray(v) ? v : [v], d = m.map((c) => t.getAnnotation(c)).filter((c) => !!c);\n i({\n selected: d.map((c) => {\n const w = y === void 0 ? ee(c, s) === \"EDIT\" : y;\n return { id: c.id, editable: w };\n })\n }), d.length !== m.length && console.warn(\"Invalid selection\", v);\n }, g = (v) => {\n if (l())\n return !1;\n const { selected: y } = a;\n y.some(({ id: m }) => v.includes(m)) && i({ selected: y.filter(({ id: m }) => !v.includes(m)) });\n }, p = (v) => s = v;\n return t.observe(\n ({ changes: v }) => g((v.deleted || []).map((y) => y.id))\n ), {\n get event() {\n return a ? a.event : null;\n },\n get selected() {\n return a ? [...a.selected] : null;\n },\n get userSelectAction() {\n return s;\n },\n clear: r,\n isEmpty: l,\n isSelected: f,\n setSelected: h,\n setUserSelectAction: p,\n subscribe: o,\n userSelect: u\n };\n}, ee = (t, e, n) => typeof e == \"function\" ? e(t) : e || \"EDIT\";\nvar K = [];\nfor (var Mt = 0; Mt < 256; ++Mt)\n K.push((Mt + 256).toString(16).slice(1));\nfunction mn(t, e = 0) {\n 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();\n}\nvar gt, yn = new Uint8Array(16);\nfunction bn() {\n if (!gt && (gt = typeof crypto < \"u\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !gt))\n throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return gt(yn);\n}\nvar wn = typeof crypto < \"u\" && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nconst ne = {\n randomUUID: wn\n};\nfunction ge(t, e, n) {\n if (ne.randomUUID && !e && !t)\n return ne.randomUUID();\n t = t || {};\n var o = t.random || (t.rng || bn)();\n return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, mn(o);\n}\nconst Rt = (t) => {\n const e = (n) => {\n const o = { ...n };\n return n.created && typeof n.created == \"string\" && (o.created = new Date(n.created)), n.updated && typeof n.updated == \"string\" && (o.updated = new Date(n.updated)), o;\n };\n return {\n ...t,\n bodies: (t.bodies || []).map(e),\n target: e(t.target)\n };\n}, Ao = (t, e, n, o) => ({\n id: ge(),\n annotation: typeof t == \"string\" ? t : t.id,\n created: n || /* @__PURE__ */ new Date(),\n creator: o,\n ...e\n}), vn = (t, e) => {\n const n = new Set(t.bodies.map((o) => o.id));\n return e.bodies.filter((o) => !n.has(o.id));\n}, An = (t, e) => {\n const n = new Set(e.bodies.map((o) => o.id));\n return t.bodies.filter((o) => !n.has(o.id));\n}, xn = (t, e) => e.bodies.map((n) => {\n const o = t.bodies.find((i) => i.id === n.id);\n return { newBody: n, oldBody: o && !G(o, n) ? o : void 0 };\n}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), En = (t, e) => !G(t.target, e.target), me = (t, e) => {\n const n = vn(t, e), o = An(t, e), i = xn(t, e);\n return {\n oldValue: t,\n newValue: e,\n bodiesCreated: n.length > 0 ? n : void 0,\n bodiesDeleted: o.length > 0 ? o : void 0,\n bodiesUpdated: i.length > 0 ? i : void 0,\n targetUpdated: En(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0\n };\n};\nvar k = /* @__PURE__ */ ((t) => (t.LOCAL = \"LOCAL\", t.REMOTE = \"REMOTE\", t.SILENT = \"SILENT\", t))(k || {});\nconst Sn = (t, e) => {\n var n, o;\n const { changes: i, origin: s } = e;\n if (!(t.options.origin ? t.options.origin === s : s !== \"SILENT\"))\n return !1;\n if (t.options.ignore) {\n const { ignore: a } = t.options, r = (l) => l && l.length > 0;\n if (!(r(i.created) || r(i.deleted))) {\n const l = (n = i.updated) == null ? void 0 : n.some((u) => r(u.bodiesCreated) || r(u.bodiesDeleted) || r(u.bodiesUpdated)), f = (o = i.updated) == null ? void 0 : o.some((u) => u.targetUpdated);\n if (a === \"BODY_ONLY\" && l && !f || a === \"TARGET_ONLY\" && f && !l)\n return !1;\n }\n }\n if (t.options.annotations) {\n const a = /* @__PURE__ */ new Set([\n ...(i.created || []).map((r) => r.id),\n ...(i.deleted || []).map((r) => r.id),\n ...(i.updated || []).map(({ oldValue: r }) => r.id)\n ]);\n return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((r) => a.has(r));\n } else\n return !0;\n}, Cn = (t, e) => {\n const n = new Set((t.created || []).map((h) => h.id)), o = new Set((t.updated || []).map(({ newValue: h }) => h.id)), i = new Set((e.created || []).map((h) => h.id)), s = new Set((e.deleted || []).map((h) => h.id)), a = new Set((e.updated || []).map(({ oldValue: h }) => h.id)), r = new Set((e.updated || []).filter(({ oldValue: h }) => n.has(h.id) || o.has(h.id)).map(({ oldValue: h }) => h.id)), l = [\n ...(t.created || []).filter((h) => !s.has(h.id)).map((h) => a.has(h.id) ? e.updated.find(({ oldValue: g }) => g.id === h.id).newValue : h),\n ...e.created || []\n ], f = [\n ...(t.deleted || []).filter((h) => !i.has(h.id)),\n ...(e.deleted || []).filter((h) => !n.has(h.id))\n ], u = [\n ...(t.updated || []).filter(({ newValue: h }) => !s.has(h.id)).map((h) => {\n const { oldValue: g, newValue: p } = h;\n if (a.has(p.id)) {\n const v = e.updated.find((y) => y.oldValue.id === p.id).newValue;\n return me(g, v);\n } else\n return h;\n }),\n ...(e.updated || []).filter(({ oldValue: h }) => !r.has(h.id))\n ];\n return { created: l, deleted: f, updated: u };\n}, Bt = (t) => {\n const e = t.id === void 0 ? ge() : t.id;\n return {\n ...t,\n id: e,\n bodies: t.bodies === void 0 ? [] : t.bodies.map((n) => ({\n ...n,\n annotation: e\n })),\n target: {\n ...t.target,\n annotation: e\n }\n };\n}, Ln = (t) => t.id !== void 0, Tn = () => {\n const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (b, x = {}) => {\n n.push({ onChange: b, options: x });\n }, i = (b) => {\n const x = n.findIndex((A) => A.onChange == b);\n x > -1 && n.splice(x, 1);\n }, s = (b, x) => {\n const A = {\n origin: b,\n changes: {\n created: x.created || [],\n updated: x.updated || [],\n deleted: x.deleted || []\n },\n state: [...t.values()]\n };\n n.forEach((C) => {\n Sn(C, A) && C.onChange(A);\n });\n }, a = (b, x = k.LOCAL) => {\n if (b.id && t.get(b.id))\n throw Error(`Cannot add annotation ${b.id} - exists already`);\n {\n const A = Bt(b);\n t.set(A.id, A), A.bodies.forEach((C) => e.set(C.id, A.id)), s(x, { created: [A] });\n }\n }, r = (b, x) => {\n const A = Bt(typeof b == \"string\" ? x : b), C = typeof b == \"string\" ? b : b.id, B = C && t.get(C);\n if (B) {\n const M = me(B, A);\n return C === A.id ? t.set(C, A) : (t.delete(C), t.set(A.id, A)), B.bodies.forEach((N) => e.delete(N.id)), A.bodies.forEach((N) => e.set(N.id, A.id)), M;\n } else\n console.warn(`Cannot update annotation ${C} - does not exist`);\n }, l = (b, x = k.LOCAL, A = k.LOCAL) => {\n const C = Ln(x) ? A : x, B = r(b, x);\n B && s(C, { updated: [B] });\n }, f = (b, x = k.LOCAL) => {\n const A = b.reduce((C, B) => {\n const M = r(B);\n return M ? [...C, M] : C;\n }, []);\n A.length > 0 && s(x, { updated: A });\n }, u = (b, x = k.LOCAL) => {\n const A = t.get(b.annotation);\n if (A) {\n const C = {\n ...A,\n bodies: [...A.bodies, b]\n };\n t.set(A.id, C), e.set(b.id, C.id), s(x, { updated: [{\n oldValue: A,\n newValue: C,\n bodiesCreated: [b]\n }] });\n } else\n console.warn(`Attempt to add body to missing annotation: ${b.annotation}`);\n }, h = () => [...t.values()], g = (b = k.LOCAL) => {\n const x = [...t.values()];\n t.clear(), e.clear(), s(b, { deleted: x });\n }, p = (b, x = !0, A = k.LOCAL) => {\n const C = b.map(Bt);\n if (x) {\n const B = [...t.values()];\n t.clear(), e.clear(), C.forEach((M) => {\n t.set(M.id, M), M.bodies.forEach((N) => e.set(N.id, M.id));\n }), s(A, { created: C, deleted: B });\n } else {\n const B = b.reduce((M, N) => {\n const D = N.id && t.get(N.id);\n return D ? [...M, D] : M;\n }, []);\n if (B.length > 0)\n throw Error(`Bulk insert would overwrite the following annotations: ${B.map((M) => M.id).join(\", \")}`);\n C.forEach((M) => {\n t.set(M.id, M), M.bodies.forEach((N) => e.set(N.id, M.id));\n }), s(A, { created: C });\n }\n }, v = (b) => {\n const x = typeof b == \"string\" ? b : b.id, A = t.get(x);\n if (A)\n return t.delete(x), A.bodies.forEach((C) => e.delete(C.id)), A;\n console.warn(`Attempt to delete missing annotation: ${x}`);\n }, y = (b, x = k.LOCAL) => {\n const A = v(b);\n A && s(x, { deleted: [A] });\n }, m = (b, x = k.LOCAL) => {\n const A = b.reduce((C, B) => {\n const M = v(B);\n return M ? [...C, M] : C;\n }, []);\n A.length > 0 && s(x, { deleted: A });\n }, d = (b) => {\n const x = t.get(b.annotation);\n if (x) {\n const A = x.bodies.find((C) => C.id === b.id);\n if (A) {\n e.delete(A.id);\n const C = {\n ...x,\n bodies: x.bodies.filter((B) => B.id !== b.id)\n };\n return t.set(x.id, C), {\n oldValue: x,\n newValue: C,\n bodiesDeleted: [A]\n };\n } else\n console.warn(`Attempt to delete missing body ${b.id} from annotation ${b.annotation}`);\n } else\n console.warn(`Attempt to delete body from missing annotation ${b.annotation}`);\n }, c = (b, x = k.LOCAL) => {\n const A = d(b);\n A && s(x, { updated: [A] });\n }, w = (b, x = k.LOCAL) => {\n const A = b.map((C) => d(C)).filter(Boolean);\n A.length > 0 && s(x, { updated: A });\n }, S = (b) => {\n const x = t.get(b);\n return x ? { ...x } : void 0;\n }, T = (b) => {\n const x = e.get(b);\n if (x) {\n const A = S(x).bodies.find((C) => C.id === b);\n if (A)\n return A;\n console.error(`Store integrity error: body ${b} in index, but not in annotation`);\n } else\n console.warn(`Attempt to retrieve missing body: ${b}`);\n }, L = (b, x) => {\n if (b.annotation !== x.annotation)\n throw \"Annotation integrity violation: annotation ID must be the same when updating bodies\";\n const A = t.get(b.annotation);\n if (A) {\n const C = A.bodies.find((M) => M.id === b.id), B = {\n ...A,\n bodies: A.bodies.map((M) => M.id === C.id ? x : M)\n };\n return t.set(A.id, B), C.id !== x.id && (e.delete(C.id), e.set(x.id, B.id)), {\n oldValue: A,\n newValue: B,\n bodiesUpdated: [{ oldBody: C, newBody: x }]\n };\n } else\n console.warn(`Attempt to add body to missing annotation ${b.annotation}`);\n }, O = (b, x, A = k.LOCAL) => {\n const C = L(b, x);\n C && s(A, { updated: [C] });\n }, E = (b, x = k.LOCAL) => {\n const A = b.map((C) => L({ id: C.id, annotation: C.annotation }, C)).filter(Boolean);\n s(x, { updated: A });\n }, R = (b) => {\n const x = t.get(b.annotation);\n if (x) {\n const A = {\n ...x,\n target: {\n ...x.target,\n ...b\n }\n };\n return t.set(x.id, A), {\n oldValue: x,\n newValue: A,\n targetUpdated: {\n oldTarget: x.target,\n newTarget: b\n }\n };\n } else\n console.warn(`Attempt to update target on missing annotation: ${b.annotation}`);\n };\n return {\n addAnnotation: a,\n addBody: u,\n all: h,\n bulkAddAnnotation: p,\n bulkDeleteAnnotation: m,\n bulkDeleteBodies: w,\n bulkUpdateAnnotation: f,\n bulkUpdateBodies: E,\n bulkUpdateTargets: (b, x = k.LOCAL) => {\n const A = b.map((C) => R(C)).filter(Boolean);\n A.length > 0 && s(x, { updated: A });\n },\n clear: g,\n deleteAnnotation: y,\n deleteBody: c,\n getAnnotation: S,\n getBody: T,\n observe: o,\n unobserve: i,\n updateAnnotation: l,\n updateBody: O,\n updateTarget: (b, x = k.LOCAL) => {\n const A = R(b);\n A && s(x, { updated: [A] });\n }\n };\n};\nlet On = () => ({\n emit(t, ...e) {\n for (let n = 0, o = this.events[t] || [], i = o.length; n < i; n++)\n o[n](...e);\n },\n events: {},\n on(t, e) {\n var n;\n return ((n = this.events)[t] || (n[t] = [])).push(e), () => {\n var o;\n this.events[t] = (o = this.events[t]) == null ? void 0 : o.filter((i) => e !== i);\n };\n }\n});\nconst Mn = 250, Rn = (t) => {\n const e = On(), n = [];\n let o = -1, i = !1, s = 0;\n const a = (p) => {\n if (!i) {\n const { changes: v } = p, y = performance.now();\n if (y - s > Mn)\n n.splice(o + 1), n.push(v), o = n.length - 1;\n else {\n const m = n.length - 1;\n n[m] = Cn(n[m], v);\n }\n s = y;\n }\n i = !1;\n };\n t.observe(a, { origin: k.LOCAL });\n const r = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), l = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), f = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: v }) => v)), u = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: v }) => v)), h = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), g = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);\n return {\n canRedo: () => n.length - 1 > o,\n canUndo: () => o > -1,\n destroy: () => t.unobserve(a),\n on: (p, v) => e.on(p, v),\n redo: () => {\n if (n.length - 1 > o) {\n i = !0;\n const { created: p, updated: v, deleted: y } = n[o + 1];\n l(p), u(v), g(y), e.emit(\"redo\", n[o + 1]), o += 1;\n }\n },\n undo: () => {\n if (o > -1) {\n i = !0;\n const { created: p, updated: v, deleted: y } = n[o];\n r(p), f(v), h(y), e.emit(\"undo\", n[o]), o -= 1;\n }\n }\n };\n}, Bn = () => {\n const { subscribe: t, set: e } = Pt([]);\n return {\n subscribe: t,\n set: e\n };\n}, kn = (t, e, n, o) => {\n const { hover: i, selection: s, store: a, viewport: r } = t, l = /* @__PURE__ */ new Map();\n let f = [], u;\n const h = (y, m) => {\n l.has(y) ? l.get(y).push(m) : l.set(y, [m]);\n }, g = (y, m) => {\n const d = l.get(y);\n if (d) {\n const c = d.indexOf(m);\n c !== -1 && d.splice(c, 1);\n }\n }, p = (y, m, d) => {\n l.has(y) && setTimeout(() => {\n l.get(y).forEach((c) => {\n if (n) {\n const w = Array.isArray(m) ? m.map((T) => n.serialize(T)) : n.serialize(m), S = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;\n c(w, S);\n } else\n c(m, d);\n });\n }, 1);\n };\n s.subscribe(({ selected: y }) => {\n if (!(f.length === 0 && y.length === 0)) {\n if (f.length === 0 && y.length > 0)\n f = y.map(({ id: m }) => a.getAnnotation(m));\n else if (f.length > 0 && y.length === 0)\n f.forEach((m) => {\n const d = a.getAnnotation(m.id);\n d && !G(d, m) && p(\"updateAnnotation\", d, m);\n }), f = [];\n else {\n const m = new Set(f.map((c) => c.id)), d = new Set(y.map(({ id: c }) => c));\n f.filter((c) => !d.has(c.id)).forEach((c) => {\n const w = a.getAnnotation(c.id);\n w && !G(w, c) && p(\"updateAnnotation\", w, c);\n }), f = [\n // Remove annotations that were deselected\n ...f.filter((c) => d.has(c.id)),\n // Add editable annotations that were selected\n ...y.filter(({ id: c }) => !m.has(c)).map(({ id: c }) => a.getAnnotation(c))\n ];\n }\n p(\"selectionChanged\", f);\n }\n }), i.subscribe((y) => {\n !u && y ? p(\"mouseEnterAnnotation\", a.getAnnotation(y)) : u && !y ? p(\"mouseLeaveAnnotation\", a.getAnnotation(u)) : u && y && (p(\"mouseLeaveAnnotation\", a.getAnnotation(u)), p(\"mouseEnterAnnotation\", a.getAnnotation(y))), u = y;\n }), r == null || r.subscribe((y) => p(\"viewportIntersect\", y.map((m) => a.getAnnotation(m)))), a.observe((y) => {\n const { created: m, deleted: d } = y.changes;\n (m || []).forEach((c) => p(\"createAnnotation\", c)), (d || []).forEach((c) => p(\"deleteAnnotation\", c)), (y.changes.updated || []).filter((c) => [\n ...c.bodiesCreated || [],\n ...c.bodiesDeleted || [],\n ...c.bodiesUpdated || []\n ].length > 0).forEach(({ oldValue: c, newValue: w }) => {\n const S = f.find((T) => T.id === c.id) || c;\n f = f.map((T) => T.id === c.id ? w : T), p(\"updateAnnotation\", w, S);\n });\n }, { origin: k.LOCAL }), a.observe((y) => {\n if (f) {\n const m = new Set(f.map((c) => c.id)), d = (y.changes.updated || []).filter(({ newValue: c }) => m.has(c.id)).map(({ newValue: c }) => c);\n d.length > 0 && (f = f.map((c) => d.find((S) => S.id === c.id) || c));\n }\n }, { origin: k.REMOTE });\n const v = (y) => (m) => {\n const { updated: d } = m;\n y ? (d || []).forEach((c) => p(\"updateAnnotation\", c.oldValue, c.newValue)) : (d || []).forEach((c) => p(\"updateAnnotation\", c.newValue, c.oldValue));\n };\n return e.on(\"undo\", v(!0)), e.on(\"redo\", v(!1)), { on: h, off: g, emit: p };\n}, In = (t) => (e) => e.reduce((n, o) => {\n const { parsed: i, error: s } = t.parse(o);\n return s ? {\n parsed: n.parsed,\n failed: [...n.failed, o]\n } : i ? {\n parsed: [...n.parsed, i],\n failed: n.failed\n } : {\n ...n\n };\n}, { parsed: [], failed: [] }), _n = (t, e, n) => {\n const { store: o, selection: i } = t, s = (d) => {\n if (n) {\n const { parsed: c, error: w } = n.parse(d);\n c ? o.addAnnotation(c, k.REMOTE) : console.error(w);\n } else\n o.addAnnotation(Rt(d), k.REMOTE);\n }, a = () => i.clear(), r = () => o.clear(), l = (d) => {\n const c = o.getAnnotation(d);\n return n && c ? n.serialize(c) : c;\n }, f = () => n ? o.all().map(n.serialize) : o.all(), u = () => {\n var d;\n const c = (((d = i.selected) == null ? void 0 : d.map((w) => w.id)) || []).map((w) => o.getAnnotation(w)).filter(Boolean);\n return n ? c.map(n.serialize) : c;\n }, h = (d, c = !0) => fetch(d).then((w) => w.json()).then((w) => (p(w, c), w)), g = (d) => {\n if (typeof d == \"string\") {\n const c = o.getAnnotation(d);\n if (o.deleteAnnotation(d), c)\n return n ? n.serialize(c) : c;\n } else {\n const c = n ? n.parse(d).parsed : d;\n if (c)\n return o.deleteAnnotation(c), d;\n }\n }, p = (d, c = !0) => {\n if (n) {\n const w = n.parseAll || In(n), { parsed: S, failed: T } = w(d);\n T.length > 0 && console.warn(`Discarded ${T.length} invalid annotations`, T), o.bulkAddAnnotation(S, c, k.REMOTE);\n } else\n o.bulkAddAnnotation(d.map(Rt), c, k.REMOTE);\n }, v = (d, c) => {\n d ? i.setSelected(d, c) : i.clear();\n }, y = (d) => {\n i.clear(), i.setUserSelectAction(d);\n }, m = (d) => {\n if (n) {\n const c = n.parse(d).parsed, w = n.serialize(o.getAnnotation(c.id));\n return o.updateAnnotation(c), w;\n } else {\n const c = o.getAnnotation(d.id);\n return o.updateAnnotation(Rt(d)), c;\n }\n };\n return {\n addAnnotation: s,\n cancelSelected: a,\n canRedo: e.canRedo,\n canUndo: e.canUndo,\n clearAnnotations: r,\n getAnnotationById: l,\n getAnnotations: f,\n getSelected: u,\n loadAnnotations: h,\n redo: e.redo,\n removeAnnotation: g,\n setAnnotations: p,\n setSelected: v,\n setUserSelectAction: y,\n undo: e.undo,\n updateAnnotation: m\n };\n}, Nn = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nlet Un = (t) => crypto.getRandomValues(new Uint8Array(t)), Vn = (t, e, n) => {\n let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * e / t.length);\n return (s = e) => {\n let a = \"\";\n for (; ; ) {\n let r = n(i), l = i;\n for (; l--; )\n if (a += t[r[l] & o] || \"\", a.length === s) return a;\n }\n };\n}, Kn = (t, e = 21) => Vn(t, e, Un), Yn = (t = 21) => {\n let e = \"\", n = crypto.getRandomValues(new Uint8Array(t));\n for (; t--; )\n e += Nn[n[t] & 63];\n return e;\n};\nconst Dn = () => ({ isGuest: !0, id: Kn(\"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_\", 20)() }), Xn = (t) => {\n const e = JSON.stringify(t);\n let n = 0;\n for (let o = 0, i = e.length; o < i; o++) {\n let s = e.charCodeAt(o);\n n = (n << 5) - n + s, n |= 0;\n }\n return `${n}`;\n}, ye = (t) => t ? typeof t == \"object\" ? { ...t } : t : void 0, Pn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {\n const { id: o, type: i, purpose: s, value: a, created: r, modified: l, creator: f, ...u } = n;\n return {\n id: o || `temp-${Xn(n)}`,\n annotation: e,\n type: i,\n purpose: s,\n value: a,\n creator: ye(f),\n created: r ? new Date(r) : void 0,\n updated: l ? new Date(l) : void 0,\n ...u\n };\n}), $n = (t) => t.map((e) => {\n var n;\n const { annotation: o, created: i, updated: s, ...a } = e, r = {\n ...a,\n created: i == null ? void 0 : i.toISOString(),\n modified: s == null ? void 0 : s.toISOString()\n };\n return (n = r.id) != null && n.startsWith(\"temp-\") && delete r.id, r;\n});\nYn();\nconst xo = (t, e) => ({\n parse: (n) => zn(n),\n serialize: (n) => Fn(n, t, e)\n}), Hn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, jn = (t) => {\n const {\n id: e,\n creator: n,\n created: o,\n modified: i,\n target: s\n } = t, a = Array.isArray(s) ? s : [s], r = {\n creator: ye(n),\n created: o ? new Date(o) : void 0,\n updated: i ? new Date(i) : void 0,\n annotation: e,\n selector: []\n };\n for (const l of a) {\n const u = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((h, g) => {\n switch (g.type) {\n case \"TextQuoteSelector\":\n h.quote = g.exact;\n break;\n case \"TextPositionSelector\":\n h.start = g.start, h.end = g.end;\n break;\n }\n return h;\n }, {});\n if (Hn(u))\n r.selector.push({ id: l.id, ...u });\n else {\n const h = [\n u.start ? void 0 : \"TextPositionSelector\",\n u.quote ? void 0 : \"TextQuoteSelector\"\n ].filter(Boolean);\n return { error: Error(`Missing selector types: ${h.join(\" and \")} for annotation: ${t.id}`) };\n }\n }\n return { parsed: r };\n}, zn = (t) => {\n const e = t.id || pe(), {\n creator: n,\n created: o,\n modified: i,\n body: s,\n ...a\n } = t, r = Pn(s, e), l = jn(t);\n return \"error\" in l ? { error: l.error } : {\n parsed: {\n ...a,\n id: e,\n bodies: r,\n target: l.parsed\n }\n };\n}, Fn = (t, e, n) => {\n const { bodies: o, target: i, ...s } = t, {\n selector: a,\n creator: r,\n created: l,\n updated: f,\n ...u\n } = i, h = a.map((g) => {\n const { quote: p, start: v, end: y, range: m } = g, { prefix: d, suffix: c } = ke(m, n), w = [{\n type: \"TextQuoteSelector\",\n exact: p,\n prefix: d,\n suffix: c\n }, {\n type: \"TextPositionSelector\",\n start: v,\n end: y\n }];\n return {\n ...u,\n id: g.id,\n source: e,\n selector: w\n };\n });\n return {\n ...s,\n \"@context\": \"http://www.w3.org/ns/anno.jsonld\",\n id: t.id,\n type: \"Annotation\",\n body: $n(t.bodies),\n creator: r,\n created: l == null ? void 0 : l.toISOString(),\n modified: f == null ? void 0 : f.toISOString(),\n target: h\n };\n};\nfunction be(t, e, n = 0, o = t.length - 1, i = Wn) {\n for (; o > n; ) {\n if (o - n > 600) {\n const l = o - n + 1, f = e - n + 1, u = Math.log(l), h = 0.5 * Math.exp(2 * u / 3), g = 0.5 * Math.sqrt(u * h * (l - h) / l) * (f - l / 2 < 0 ? -1 : 1), p = Math.max(n, Math.floor(e - f * h / l + g)), v = Math.min(o, Math.floor(e + (l - f) * h / l + g));\n be(t, e, p, v, i);\n }\n const s = t[e];\n let a = n, r = o;\n for (et(t, n, e), i(t[o], s) > 0 && et(t, n, o); a < r; ) {\n for (et(t, a, r), a++, r--; i(t[a], s) < 0; ) a++;\n for (; i(t[r], s) > 0; ) r--;\n }\n i(t[n], s) === 0 ? et(t, n, r) : (r++, et(t, r, o)), r <= e && (n = r + 1), e <= r && (o = r - 1);\n }\n}\nfunction et(t, e, n) {\n const o = t[e];\n t[e] = t[n], t[n] = o;\n}\nfunction Wn(t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n}\nclass qn {\n constructor(e = 9) {\n this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();\n }\n all() {\n return this._all(this.data, []);\n }\n search(e) {\n let n = this.data;\n const o = [];\n if (!yt(e, n)) return o;\n const i = this.toBBox, s = [];\n for (; n; ) {\n for (let a = 0; a < n.children.length; a++) {\n const r = n.children[a], l = n.leaf ? i(r) : r;\n yt(e, l) && (n.leaf ? o.push(r) : It(e, l) ? this._all(r, o) : s.push(r));\n }\n n = s.pop();\n }\n return o;\n }\n collides(e) {\n let n = this.data;\n if (!yt(e, n)) return !1;\n const o = [];\n for (; n; ) {\n for (let i = 0; i < n.children.length; i++) {\n const s = n.children[i], a = n.leaf ? this.toBBox(s) : s;\n if (yt(e, a)) {\n if (n.leaf || It(e, a)) return !0;\n o.push(s);\n }\n }\n n = o.pop();\n }\n return !1;\n }\n load(e) {\n if (!(e && e.length)) return this;\n if (e.length < this._minEntries) {\n for (let o = 0; o < e.length; o++)\n this.insert(e[o]);\n return this;\n }\n let n = this._build(e.slice(), 0, e.length - 1, 0);\n if (!this.data.children.length)\n this.data = n;\n else if (this.data.height === n.height)\n this._splitRoot(this.data, n);\n else {\n if (this.data.height < n.height) {\n const o = this.data;\n this.data = n, n = o;\n }\n this._insert(n, this.data.height - n.height - 1, !0);\n }\n return this;\n }\n insert(e) {\n return e && this._insert(e, this.data.height - 1), this;\n }\n clear() {\n return this.data = Z([]), this;\n }\n remove(e, n) {\n if (!e) return this;\n let o = this.data;\n const i = this.toBBox(e), s = [], a = [];\n let r, l, f;\n for (; o || s.length; ) {\n if (o || (o = s.pop(), l = s[s.length - 1], r = a.pop(), f = !0), o.leaf) {\n const u = Gn(e, o.children, n);\n if (u !== -1)\n return o.children.splice(u, 1), s.push(o), this._condense(s), this;\n }\n !f && !o.leaf && It(o, i) ? (s.push(o), a.push(r), r = 0, l = o, o = o.children[0]) : l ? (r++, o = l.children[r], f = !1) : o = null;\n }\n return this;\n }\n toBBox(e) {\n return e;\n }\n compareMinX(e, n) {\n return e.minX - n.minX;\n }\n compareMinY(e, n) {\n return e.minY - n.minY;\n }\n toJSON() {\n return this.data;\n }\n fromJSON(e) {\n return this.data = e, this;\n }\n _all(e, n) {\n const o = [];\n for (; e; )\n e.leaf ? n.push(...e.children) : o.push(...e.children), e = o.pop();\n return n;\n }\n _build(e, n, o, i) {\n const s = o - n + 1;\n let a = this._maxEntries, r;\n if (s <= a)\n return r = Z(e.slice(n, o + 1)), J(r, this.toBBox), r;\n i || (i = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, i - 1))), r = Z([]), r.leaf = !1, r.height = i;\n const l = Math.ceil(s / a), f = l * Math.ceil(Math.sqrt(a));\n oe(e, n, o, f, this.compareMinX);\n for (let u = n; u <= o; u += f) {\n const h = Math.min(u + f - 1, o);\n oe(e, u, h, l, this.compareMinY);\n for (let g = u; g <= h; g += l) {\n const p = Math.min(g + l - 1, h);\n r.children.push(this._build(e, g, p, i - 1));\n }\n }\n return J(r, this.toBBox), r;\n }\n _chooseSubtree(e, n, o, i) {\n for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {\n let s = 1 / 0, a = 1 / 0, r;\n for (let l = 0; l < n.children.length; l++) {\n const f = n.children[l], u = kt(f), h = Zn(e, f) - u;\n h < a ? (a = h, s = u < s ? u : s, r = f) : h === a && u < s && (s = u, r = f);\n }\n n = r || n.children[0];\n }\n return n;\n }\n _insert(e, n, o) {\n const i = o ? e : this.toBBox(e), s = [], a = this._chooseSubtree(i, this.data, n, s);\n for (a.children.push(e), it(a, i); n >= 0 && s[n].children.length > this._maxEntries; )\n this._split(s, n), n--;\n this._adjustParentBBoxes(i, s, n);\n }\n // split overflowed node into two\n _split(e, n) {\n const o = e[n], i = o.children.length, s = this._minEntries;\n this._chooseSplitAxis(o, s, i);\n const a = this._chooseSplitIndex(o, s, i), r = Z(o.children.splice(a, o.children.length - a));\n r.height = o.height, r.leaf = o.leaf, J(o, this.toBBox), J(r, this.toBBox), n ? e[n - 1].children.push(r) : this._splitRoot(o, r);\n }\n _splitRoot(e, n) {\n this.data = Z([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, J(this.data, this.toBBox);\n }\n _chooseSplitIndex(e, n, o) {\n let i, s = 1 / 0, a = 1 / 0;\n for (let r = n; r <= o - n; r++) {\n const l = ot(e, 0, r, this.toBBox), f = ot(e, r, o, this.toBBox), u = to(l, f), h = kt(l) + kt(f);\n u < s ? (s = u, i = r, a = h < a ? h : a) : u === s && h < a && (a = h, i = r);\n }\n return i || o - n;\n }\n // sorts node children by the best axis for split\n _chooseSplitAxis(e, n, o) {\n const i = e.leaf ? this.compareMinX : Qn, s = e.leaf ? this.compareMinY : Jn, a = this._allDistMargin(e, n, o, i), r = this._allDistMargin(e, n, o, s);\n a < r && e.children.sort(i);\n }\n // total margin of all possible split distributions where each node is at least m full\n _allDistMargin(e, n, o, i) {\n e.children.sort(i);\n const s = this.toBBox, a = ot(e, 0, n, s), r = ot(e, o - n, o, s);\n let l = mt(a) + mt(r);\n for (let f = n; f < o - n; f++) {\n const u = e.children[f];\n it(a, e.leaf ? s(u) : u), l += mt(a);\n }\n for (let f = o - n - 1; f >= n; f--) {\n const u = e.children[f];\n it(r, e.leaf ? s(u) : u), l += mt(r);\n }\n return l;\n }\n _adjustParentBBoxes(e, n, o) {\n for (let i = o; i >= 0; i--)\n it(n[i], e);\n }\n _condense(e) {\n for (let n = e.length - 1, o; n >= 0; n--)\n e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : J(e[n], this.toBBox);\n }\n}\nfunction Gn(t, e, n) {\n if (!n) return e.indexOf(t);\n for (let o = 0; o < e.length; o++)\n if (n(t, e[o])) return o;\n return -1;\n}\nfunction J(t, e) {\n ot(t, 0, t.children.length, e, t);\n}\nfunction ot(t, e, n, o, i) {\n i || (i = Z(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;\n for (let s = e; s < n; s++) {\n const a = t.children[s];\n it(i, t.leaf ? o(a) : a);\n }\n return i;\n}\nfunction it(t, e) {\n 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;\n}\nfunction Qn(t, e) {\n return t.minX - e.minX;\n}\nfunction Jn(t, e) {\n return t.minY - e.minY;\n}\nfunction kt(t) {\n return (t.maxX - t.minX) * (t.maxY - t.minY);\n}\nfunction mt(t) {\n return t.maxX - t.minX + (t.maxY - t.minY);\n}\nfunction Zn(t, e) {\n 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));\n}\nfunction to(t, e) {\n 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);\n return Math.max(0, i - n) * Math.max(0, s - o);\n}\nfunction It(t, e) {\n return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;\n}\nfunction yt(t, e) {\n return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;\n}\nfunction Z(t) {\n return {\n children: t,\n height: 1,\n leaf: !0,\n minX: 1 / 0,\n minY: 1 / 0,\n maxX: -1 / 0,\n maxY: -1 / 0\n };\n}\nfunction oe(t, e, n, o, i) {\n const s = [e, n];\n for (; s.length; ) {\n if (n = s.pop(), e = s.pop(), n - e <= o) continue;\n const a = e + Math.ceil((n - e) / o / 2) * o;\n be(t, a, e, n, i), s.push(e, a, a, n);\n }\n}\nconst eo = (t, e) => {\n const n = new qn(), o = /* @__PURE__ */ new Map(), i = (d, c) => {\n const w = d.selector.flatMap((T) => {\n const L = W([T]) ? T.range : le(T, e).range;\n return Array.from(L.getClientRects());\n }), S = Ve(w).map(({ left: T, top: L, right: O, bottom: E }) => new DOMRect(T - c.left, L - c.top, O - T, E - L));\n return S.map((T) => {\n const { x: L, y: O, width: E, height: R } = T;\n return {\n minX: L,\n minY: O,\n maxX: L + E,\n maxY: O + R,\n annotation: {\n id: d.annotation,\n rects: S\n }\n };\n });\n }, s = () => [...o.values()], a = () => {\n n.clear(), o.clear();\n }, r = (d) => {\n const c = i(d, e.getBoundingClientRect());\n c.forEach((w) => n.insert(w)), o.set(d.annotation, c);\n }, l = (d) => {\n const c = o.get(d.annotation);\n c && (c.forEach((w) => n.remove(w)), o.delete(d.annotation));\n }, f = (d) => {\n l(d), r(d);\n }, u = (d, c = !0) => {\n c && a();\n const w = e.getBoundingClientRect(), S = d.map((L) => ({ target: L, rects: i(L, w) }));\n S.forEach(({ target: L, rects: O }) => o.set(L.annotation, O));\n const T = S.flatMap(({ rects: L }) => L);\n n.load(T);\n }, h = (d, c, w = !1) => {\n const S = n.search({\n minX: d,\n minY: c,\n maxX: d,\n maxY: c\n }), T = (L) => L.annotation.rects.reduce((O, E) => O + E.width * E.height, 0);\n return S.length > 0 ? (S.sort((L, O) => T(L) - T(O)), w ? S.map((L) => L.annotation.id) : [S[0].annotation.id]) : [];\n }, g = (d) => {\n const c = p(d);\n if (c.length === 0)\n return;\n let w = c[0].left, S = c[0].top, T = c[0].right, L = c[0].bottom;\n for (let O = 1; O < c.length; O++) {\n const E = c[O];\n w = Math.min(w, E.left), S = Math.min(S, E.top), T = Math.max(T, E.right), L = Math.max(L, E.bottom);\n }\n return new DOMRect(w, S, T - w, L - S);\n }, p = (d) => {\n const c = o.get(d);\n return c ? c[0].annotation.rects : [];\n };\n return {\n all: s,\n clear: a,\n getAt: h,\n getAnnotationBounds: g,\n getAnnotationRects: p,\n getIntersecting: (d, c, w, S) => {\n const T = n.search({ minX: d, minY: c, maxX: w, maxY: S }), L = new Set(T.map((O) => O.annotation.id));\n return Array.from(L).map((O) => ({\n annotation: t.getAnnotation(O),\n rects: p(O)\n })).filter((O) => !!O.annotation);\n },\n insert: r,\n recalculate: () => u(t.all().map((d) => d.target), !0),\n remove: l,\n set: u,\n size: () => n.all().length,\n update: f\n };\n}, no = (t, e) => {\n const n = Tn(), o = eo(n, t), i = gn(n);\n i.setUserSelectAction(e);\n const s = hn(n), a = Bn(), r = (m, d = k.LOCAL) => {\n const c = xt(m, t), w = W(c.target.selector);\n return w && n.addAnnotation(c, d), w;\n }, l = (m, d = !0, c = k.LOCAL) => {\n const w = m.map((T) => xt(T, t)), S = w.filter((T) => !W(T.target.selector));\n return S.length > 0 ? (console.warn(\"Could not revive all targets for these annotations:\", S), n.bulkAddAnnotation(w, d, c), S) : (n.bulkAddAnnotation(w, d, c), []);\n }, f = (m, d = k.LOCAL) => {\n const c = m.map((S) => xt(S, t)), w = c.filter((S) => !W(S.target.selector));\n return w.length > 0 && console.warn(\"Could not revive all targets for these annotations:\", w), c.forEach((S) => {\n n.getAnnotation(S.id) ? n.updateAnnotation(S, d) : n.addAnnotation(S, d);\n }), w;\n }, u = (m, d = k.LOCAL) => {\n const c = wt(m, t);\n n.updateTarget(c, d);\n }, h = (m, d = k.LOCAL) => {\n const c = m.map((w) => wt(w, t));\n n.bulkUpdateTargets(c, d);\n }, g = (m, d, c) => {\n const w = o.getAt(m, d, !!c).map((T) => n.getAnnotation(T)), S = c ? w.filter(c) : w;\n return S.length > 0 ? S[0] : void 0;\n }, p = (m, d, c, w = 5) => {\n const S = o.getAnnotationRects(m);\n if (S.length !== 0) {\n if (d && c) {\n const T = S.find(({ top: L, right: O, bottom: E, left: R }) => d >= R - w && d <= O + w && c >= L - w && c <= E + w);\n if (T) return T;\n }\n return o.getAnnotationBounds(m);\n }\n }, v = (m) => o.getAnnotationRects(m), y = () => o.recalculate();\n return n.observe(({ changes: m }) => {\n const d = (m.deleted || []).filter((S) => W(S.target.selector)), c = (m.created || []).filter((S) => W(S.target.selector)), w = (m.updated || []).filter((S) => W(S.newValue.target.selector));\n (d == null ? void 0 : d.length) > 0 && d.forEach((S) => o.remove(S.target)), c.length > 0 && o.set(c.map((S) => S.target), !1), (w == null ? void 0 : w.length) > 0 && w.forEach(({ newValue: S }) => o.update(S.target));\n }), {\n store: {\n ...n,\n addAnnotation: r,\n bulkAddAnnotation: l,\n bulkUpdateTargets: h,\n bulkUpsertAnnotations: f,\n getAnnotationBounds: p,\n getAnnotationRects: v,\n getAt: g,\n getIntersecting: o.getIntersecting,\n recalculatePositions: y,\n updateTarget: u\n },\n selection: i,\n hover: s,\n viewport: a\n };\n}, oo = () => {\n const t = document.createElement(\"canvas\");\n t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = \"r6o-presence-layer\";\n const e = t.getContext(\"2d\");\n return e.scale(2, 2), e.translate(0.5, 0.5), t;\n}, io = (t, e = {}) => {\n const n = oo(), o = n.getContext(\"2d\");\n document.body.appendChild(n);\n const i = /* @__PURE__ */ new Map(), s = (u) => Array.from(i.entries()).filter(([h, g]) => g.presenceKey === u.presenceKey).map(([h, g]) => h);\n return t.on(\"selectionChange\", (u, h) => {\n s(u).forEach((p) => i.delete(p)), h && h.forEach((p) => i.set(p, u));\n }), {\n clear: () => {\n const { width: u, height: h } = n;\n o.clearRect(-0.5, -0.5, u + 1, h + 1);\n },\n destroy: () => {\n n.remove();\n },\n paint: (u, h, g) => {\n e.font && (o.font = e.font);\n const p = i.get(u.annotation.id);\n if (p) {\n const { height: v } = u.rects[0], y = u.rects[0].x + h.left, m = u.rects[0].y + h.top;\n o.fillStyle = p.appearance.color, o.fillRect(y - 2, m - 2.5, 2, v + 5);\n const d = o.measureText(p.appearance.label), c = d.width + 6, w = d.actualBoundingBoxAscent + d.actualBoundingBoxDescent + 8, S = d.fontBoundingBoxAscent ? 8 : 6.5;\n return o.fillRect(y - 2, m - 2.5 - w, c, w), o.fillStyle = \"#fff\", o.fillText(p.appearance.label, y + 1, m - S), {\n fill: p.appearance.color,\n fillOpacity: g ? 0.45 : 0.18\n };\n }\n },\n reset: () => {\n n.width = 2 * window.innerWidth, n.height = 2 * window.innerHeight;\n const u = n.getContext(\"2d\");\n u.scale(2, 2), u.translate(0.5, 0.5);\n }\n };\n}, _t = typeof navigator < \"u\" ? navigator.userAgent.toLowerCase().indexOf(\"firefox\") > 0 : !1;\nfunction Nt(t, e, n, o) {\n t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent(\"on\".concat(e), n);\n}\nfunction nt(t, e, n, o) {\n t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent(\"on\".concat(e), n);\n}\nfunction we(t, e) {\n const n = e.slice(0, e.length - 1);\n for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];\n return n;\n}\nfunction ve(t) {\n typeof t != \"string\" && (t = \"\"), t = t.replace(/\\s/g, \"\");\n const e = t.split(\",\");\n let n = e.lastIndexOf(\"\");\n for (; n >= 0; )\n e[n - 1] += \",\", e.splice(n, 1), n = e.lastIndexOf(\"\");\n return e;\n}\nfunction so(t, e) {\n const n = t.length >= e.length ? t : e, o = t.length >= e.length ? e : t;\n let i = !0;\n for (let s = 0; s < n.length; s++)\n o.indexOf(n[s]) === -1 && (i = !1);\n return i;\n}\nconst at = {\n backspace: 8,\n \"⌫\": 8,\n tab: 9,\n clear: 12,\n enter: 13,\n \"↩\": 13,\n return: 13,\n esc: 27,\n escape: 27,\n space: 32,\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n del: 46,\n delete: 46,\n ins: 45,\n insert: 45,\n home: 36,\n end: 35,\n pageup: 33,\n pagedown: 34,\n capslock: 20,\n num_0: 96,\n num_1: 97,\n num_2: 98,\n num_3: 99,\n num_4: 100,\n num_5: 101,\n num_6: 102,\n num_7: 103,\n num_8: 104,\n num_9: 105,\n num_multiply: 106,\n num_add: 107,\n num_enter: 108,\n num_subtract: 109,\n num_decimal: 110,\n num_divide: 111,\n \"⇪\": 20,\n \",\": 188,\n \".\": 190,\n \"/\": 191,\n \"`\": 192,\n \"-\": _t ? 173 : 189,\n \"=\": _t ? 61 : 187,\n \";\": _t ? 59 : 186,\n \"'\": 222,\n \"[\": 219,\n \"]\": 221,\n \"\\\\\": 220\n}, j = {\n // shiftKey\n \"⇧\": 16,\n shift: 16,\n // altKey\n \"⌥\": 18,\n alt: 18,\n option: 18,\n // ctrlKey\n \"⌃\": 17,\n ctrl: 17,\n control: 17,\n // metaKey\n \"⌘\": 91,\n cmd: 91,\n command: 91\n}, Yt = {\n 16: \"shiftKey\",\n 18: \"altKey\",\n 17: \"ctrlKey\",\n 91: \"metaKey\",\n shiftKey: 16,\n ctrlKey: 17,\n altKey: 18,\n metaKey: 91\n}, Y = {\n 16: !1,\n 18: !1,\n 17: !1,\n 91: !1\n}, _ = {};\nfor (let t = 1; t < 20; t++)\n at[\"f\".concat(t)] = 111 + t;\nlet I = [], rt = null, Ae = \"all\";\nconst F = /* @__PURE__ */ new Map(), lt = (t) => at[t.toLowerCase()] || j[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), ro = (t) => Object.keys(at).find((e) => at[e] === t), ao = (t) => Object.keys(j).find((e) => j[e] === t);\nfunction xe(t) {\n Ae = t || \"all\";\n}\nfunction ct() {\n return Ae || \"all\";\n}\nfunction co() {\n return I.slice(0);\n}\nfunction lo() {\n return I.map((t) => ro(t) || ao(t) || String.fromCharCode(t));\n}\nfunction uo() {\n const t = [];\n return Object.keys(_).forEach((e) => {\n _[e].forEach((n) => {\n let {\n key: o,\n scope: i,\n mods: s,\n shortcut: a\n } = n;\n t.push({\n scope: i,\n shortcut: a,\n mods: s,\n keys: o.split(\"+\").map((r) => lt(r))\n });\n });\n }), t;\n}\nfunction fo(t) {\n const e = t.target || t.srcElement, {\n tagName: n\n } = e;\n let o = !0;\n const i = n === \"INPUT\" && ![\"checkbox\", \"radio\", \"range\", \"button\", \"file\", \"reset\", \"submit\", \"color\"].includes(e.type);\n return (e.isContentEditable || (i || n === \"TEXTAREA\" || n === \"SELECT\") && !e.readOnly) && (o = !1), o;\n}\nfunction ho(t) {\n return typeof t == \"string\" && (t = lt(t)), I.indexOf(t) !== -1;\n}\nfunction po(t, e) {\n let n, o;\n t || (t = ct());\n for (const i in _)\n if (Object.prototype.hasOwnProperty.call(_, i))\n for (n = _[i], o = 0; o < n.length; )\n n[o].scope === t ? n.splice(o, 1).forEach((a) => {\n let {\n element: r\n } = a;\n return $t(r);\n }) : o++;\n ct() === t && xe(e || \"all\");\n}\nfunction go(t) {\n let e = t.keyCode || t.which || t.charCode;\n const n = I.indexOf(e);\n if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === \"meta\" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in Y) {\n Y[e] = !1;\n for (const o in j) j[o] === e && (P[o] = !1);\n }\n}\nfunction Ee(t) {\n if (typeof t > \"u\")\n Object.keys(_).forEach((i) => {\n Array.isArray(_[i]) && _[i].forEach((s) => bt(s)), delete _[i];\n }), $t(null);\n else if (Array.isArray(t))\n t.forEach((i) => {\n i.key && bt(i);\n });\n else if (typeof t == \"object\")\n t.key && bt(t);\n else if (typeof t == \"string\") {\n for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++)\n n[o - 1] = arguments[o];\n let [i, s] = n;\n typeof i == \"function\" && (s = i, i = \"\"), bt({\n key: t,\n scope: i,\n method: s,\n splitKey: \"+\"\n });\n }\n}\nconst bt = (t) => {\n let {\n key: e,\n scope: n,\n method: o,\n splitKey: i = \"+\"\n } = t;\n ve(e).forEach((a) => {\n const r = a.split(i), l = r.length, f = r[l - 1], u = f === \"*\" ? \"*\" : lt(f);\n if (!_[u]) return;\n n || (n = ct());\n const h = l > 1 ? we(j, r) : [], g = [];\n _[u] = _[u].filter((p) => {\n const y = (o ? p.method === o : !0) && p.scope === n && so(p.mods, h);\n return y && g.push(p.element), !y;\n }), g.forEach((p) => $t(p));\n });\n};\nfunction ie(t, e, n, o) {\n if (e.element !== o)\n return;\n let i;\n if (e.scope === n || e.scope === \"all\") {\n i = e.mods.length > 0;\n for (const s in Y)\n Object.prototype.hasOwnProperty.call(Y, s) && (!Y[s] && e.mods.indexOf(+s) > -1 || Y[s] && e.mods.indexOf(+s) === -1) && (i = !1);\n (e.mods.length === 0 && !Y[16] && !Y[18] && !Y[17] && !Y[91] || i || e.shortcut === \"*\") && (e.keys = [], e.keys = e.keys.concat(I), e.method(t, e) === !1 && (t.preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = !0)));\n }\n}\nfunction se(t, e) {\n const n = _[\"*\"];\n let o = t.keyCode || t.which || t.charCode;\n if (!P.filter.call(this, t)) return;\n if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), [\"ctrlKey\", \"altKey\", \"shiftKey\", \"metaKey\"].forEach((r) => {\n const l = Yt[r];\n t[r] && I.indexOf(l) === -1 ? I.push(l) : !t[r] && I.indexOf(l) > -1 ? I.splice(I.indexOf(l), 1) : r === \"metaKey\" && t[r] && I.length === 3 && (t.ctrlKey || t.shiftKey || t.altKey || (I = I.slice(I.indexOf(l))));\n }), o in Y) {\n Y[o] = !0;\n for (const r in j)\n j[r] === o && (P[r] = !0);\n if (!n) return;\n }\n for (const r in Y)\n Object.prototype.hasOwnProperty.call(Y, r) && (Y[r] = t[Yt[r]]);\n t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState(\"AltGraph\") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18), Y[17] = !0, Y[18] = !0);\n const i = ct();\n if (n)\n for (let r = 0; r < n.length; r++)\n n[r].scope === i && (t.type === \"keydown\" && n[r].keydown || t.type === \"keyup\" && n[r].keyup) && ie(t, n[r], i, e);\n if (!(o in _)) return;\n const s = _[o], a = s.length;\n for (let r = 0; r < a; r++)\n if ((t.type === \"keydown\" && s[r].keydown || t.type === \"keyup\" && s[r].keyup) && s[r].key) {\n const l = s[r], {\n splitKey: f\n } = l, u = l.key.split(f), h = [];\n for (let g = 0; g < u.length; g++)\n h.push(lt(u[g]));\n h.sort().join(\"\") === I.sort().join(\"\") && ie(t, l, i, e);\n }\n}\nfunction P(t, e, n) {\n I = [];\n const o = ve(t);\n let i = [], s = \"all\", a = document, r = 0, l = !1, f = !0, u = \"+\", h = !1, g = !1;\n 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 && (f = e.keydown), e.capture !== void 0 && (h = e.capture), typeof e.splitKey == \"string\" && (u = e.splitKey), e.single === !0 && (g = !0)), typeof e == \"string\" && (s = e), g && Ee(t, s); r < o.length; r++)\n t = o[r].split(u), i = [], t.length > 1 && (i = we(j, t)), t = t[t.length - 1], t = t === \"*\" ? \"*\" : lt(t), t in _ || (_[t] = []), _[t].push({\n keyup: l,\n keydown: f,\n scope: s,\n mods: i,\n shortcut: o[r],\n method: n,\n key: o[r],\n splitKey: u,\n element: a\n });\n if (typeof a < \"u\" && window) {\n if (!F.has(a)) {\n const p = function() {\n let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;\n return se(y, a);\n }, v = function() {\n let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;\n se(y, a), go(y);\n };\n F.set(a, {\n keydownListener: p,\n keyupListenr: v,\n capture: h\n }), Nt(a, \"keydown\", p, h), Nt(a, \"keyup\", v, h);\n }\n if (!rt) {\n const p = () => {\n I = [];\n };\n rt = {\n listener: p,\n capture: h\n }, Nt(window, \"focus\", p, h);\n }\n }\n}\nfunction mo(t) {\n let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"all\";\n Object.keys(_).forEach((n) => {\n _[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {\n i && i.method && i.method();\n });\n });\n}\nfunction $t(t) {\n const e = Object.values(_).flat();\n if (e.findIndex((o) => {\n let {\n element: i\n } = o;\n return i === t;\n }) < 0) {\n const {\n keydownListener: o,\n keyupListenr: i,\n capture: s\n } = F.get(t) || {};\n o && i && (nt(t, \"keyup\", i, s), nt(t, \"keydown\", o, s), F.delete(t));\n }\n if ((e.length <= 0 || F.size <= 0) && (Object.keys(F).forEach((i) => {\n const {\n keydownListener: s,\n keyupListenr: a,\n capture: r\n } = F.get(i) || {};\n s && a && (nt(i, \"keyup\", a, r), nt(i, \"keydown\", s, r), F.delete(i));\n }), F.clear(), Object.keys(_).forEach((i) => delete _[i]), rt)) {\n const {\n listener: i,\n capture: s\n } = rt;\n nt(window, \"focus\", i, s), rt = null;\n }\n}\nconst Ut = {\n getPressedKeyString: lo,\n setScope: xe,\n getScope: ct,\n deleteScope: po,\n getPressedKeyCodes: co,\n getAllKeyCodes: uo,\n isPressed: ho,\n filter: fo,\n trigger: mo,\n unbind: Ee,\n keyMap: at,\n modifier: j,\n modifierMap: Yt\n};\nfor (const t in Ut)\n Object.prototype.hasOwnProperty.call(Ut, t) && (P[t] = Ut[t]);\nif (typeof window < \"u\") {\n const t = window.hotkeys;\n P.noConflict = (e) => (e && window.hotkeys === P && (window.hotkeys = t), P), window.hotkeys = P;\n}\nconst re = 300, Se = [\"up\", \"down\", \"left\", \"right\"], Ce = Re ? \"⌘+a\" : \"ctrl+a\", yo = [\n ...Se.map((t) => `shift+${t}`),\n Ce\n], bo = (t, e, n, o) => {\n let i;\n const s = (E) => i = E;\n let a;\n const r = (E) => a = E, { store: l, selection: f } = e;\n let u, h, g, p = !1;\n const v = (E) => {\n var b;\n if (p = !1, h === !1)\n return;\n u = !((b = E.target.parentElement) != null && b.closest(H)) ? {\n annotation: pe(),\n selector: [],\n creator: i,\n created: /* @__PURE__ */ new Date()\n } : void 0;\n }, y = Dt((E) => {\n var N, D;\n const R = document.getSelection();\n if (!!((D = (N = R.anchorNode) == null ? void 0 : N.parentElement) != null && D.closest(H))) {\n u = void 0;\n return;\n }\n const x = E.timeStamp - ((g == null ? void 0 : g.timeStamp) || E.timeStamp);\n if ((g == null ? void 0 : g.type) === \"pointerdown\" && (x < 1e3 && !u || R.isCollapsed && x < re) && v(g || E), !u) return;\n if (R.isCollapsed) {\n l.getAnnotation(u.annotation) && (f.clear(), l.deleteAnnotation(u.annotation));\n return;\n }\n const A = R.getRangeAt(0), C = Ye(A, t);\n if (_e(C)) return;\n const B = Oe(C.cloneRange());\n (B.length !== u.selector.length || B.some((tt, At) => {\n var dt;\n return tt.toString() !== ((dt = u.selector[At]) == null ? void 0 : dt.quote);\n })) && (u = {\n ...u,\n selector: B.map((tt) => Ke(tt, t, o)),\n updated: /* @__PURE__ */ new Date()\n }, l.getAnnotation(u.annotation) && l.updateTarget(u, k.LOCAL));\n }), m = (E) => {\n var b;\n p || (b = E.target.parentElement) != null && b.closest(H) || (g = Et(E), h = g.button === 0);\n }, d = () => {\n l.getAnnotation(u.annotation) ? l.updateTarget(u) : l.addAnnotation({\n id: u.annotation,\n bodies: [],\n target: u\n });\n }, c = (E) => {\n var A;\n if (p || !!((A = E.target.parentElement) != null && A.closest(H)) || !h) return;\n const b = () => {\n const { x: C, y: B } = t.getBoundingClientRect(), M = E.target instanceof Node && t.contains(E.target) && l.getAt(E.clientX - C, E.clientY - B, a);\n if (M) {\n const { selected: N } = f;\n (N.length !== 1 || N[0].id !== M.id) && f.userSelect(M.id, E);\n } else f.isEmpty() || f.clear();\n }, x = E.timeStamp - g.timeStamp;\n setTimeout(() => {\n const C = document.getSelection();\n C != null && C.isCollapsed && x < re ? (u = void 0, b()) : u && u.selector.length > 0 && (f.clear(), d(), f.userSelect(u.annotation, Et(E)));\n });\n }, w = (E) => {\n p = !0;\n const R = document.getSelection();\n R != null && R.isCollapsed || ((!u || u.selector.length === 0) && y(E), d(), f.userSelect(u.annotation, Et(E)));\n }, S = (E) => {\n E.key === \"Shift\" && u && (document.getSelection().isCollapsed || (f.clear(), d(), f.userSelect(u.annotation, ut(E))));\n }, T = (E) => {\n const R = () => setTimeout(() => {\n (u == null ? void 0 : u.selector.length) > 0 && (f.clear(), l.addAnnotation({\n id: u.annotation,\n bodies: [],\n target: u\n }), f.userSelect(u.annotation, ut(E))), document.removeEventListener(\"selectionchange\", R);\n }, 100);\n document.addEventListener(\"selectionchange\", R), v(E);\n };\n P(yo.join(\",\"), { element: t, keydown: !0, keyup: !1 }, (E) => {\n E.repeat || (g = ut(E));\n }), P(Ce, { keydown: !0, keyup: !1 }, (E) => {\n g = ut(E), T(E);\n });\n const L = (E) => {\n E.repeat || E.target !== t && E.target !== document.body || (u = void 0, f.clear());\n };\n return P(Se.join(\",\"), { keydown: !0, keyup: !1 }, L), t.addEventListener(\"pointerdown\", m), document.addEventListener(\"pointerup\", c), document.addEventListener(\"contextmenu\", w), n && (t.addEventListener(\"keyup\", S), t.addEventListener(\"selectstart\", v), document.addEventListener(\"selectionchange\", y)), {\n destroy: () => {\n t.removeEventListener(\"pointerdown\", m), document.removeEventListener(\"pointerup\", c), document.removeEventListener(\"contextmenu\", w), t.removeEventListener(\"keyup\", S), t.removeEventListener(\"selectstart\", v), document.removeEventListener(\"selectionchange\", y), P.unbind();\n },\n setFilter: r,\n setUser: s\n };\n}, wo = (t, e) => ({\n ...t,\n annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,\n user: t.user || e.user\n}), ae = \"SPANS\", Eo = (t, e = {}) => {\n Me(t), Be(t);\n const n = wo(e, {\n annotatingEnabled: !0,\n user: Dn()\n }), o = no(t, n.userSelectAction), { selection: i, viewport: s } = o, a = o.store, r = Rn(a), l = kn(o, r, n.adapter);\n let f = n.user;\n const u = n.renderer === \"CSS_HIGHLIGHTS\" ? CSS.highlights ? \"CSS_HIGHLIGHTS\" : ae : n.renderer || ae, h = u === \"SPANS\" ? an(t, o, s) : u === \"CSS_HIGHLIGHTS\" ? on(t, o, s) : u === \"CANVAS\" ? Fe(t, o, s) : void 0;\n if (!h)\n throw `Unknown renderer implementation: ${u}`;\n console.debug(`Using ${u} renderer`), n.style && h.setStyle(n.style);\n const g = bo(t, o, n.annotatingEnabled, n.offsetReferenceSelector);\n return g.setUser(f), {\n ..._n(o, r, n.adapter),\n destroy: () => {\n h.destroy(), g.destroy(), r.destroy();\n },\n element: t,\n getUser: () => f,\n setFilter: (L) => {\n h.setFilter(L), g.setFilter(L);\n },\n setStyle: (L) => h.setStyle(L),\n setUser: (L) => {\n f = L, g.setUser(L);\n },\n setSelected: (L) => {\n L ? i.setSelected(L) : i.clear();\n },\n setPresenceProvider: (L) => {\n L && (h.setPainter(io(L, n.presence)), L.on(\"selectionChange\", () => h.redraw()));\n },\n setVisible: (L) => h.setVisible(L),\n on: l.on,\n off: l.off,\n scrollIntoView: De(t, a),\n state: o\n };\n};\nexport {\n vt as DEFAULT_SELECTED_STYLE,\n q as DEFAULT_STYLE,\n ce as NOT_ANNOTATABLE_CLASS,\n H as NOT_ANNOTATABLE_SELECTOR,\n k as Origin,\n bo as SelectionHandler,\n pn as UserSelectAction,\n xo as W3CTextFormat,\n Me as cancelSingleClickEvents,\n ut as cloneKeyboardEvent,\n Et as clonePointerEvent,\n Ao as createBody,\n Fe as createCanvasRenderer,\n on as createHighlightsRenderer,\n io as createPresencePainter,\n nn as createRenderer,\n an as createSpansRenderer,\n Eo as createTextAnnotator,\n no as createTextAnnotatorState,\n Dt as debounce,\n wo as fillDefaults,\n vo as getAnnotatableFragment,\n ke as getQuoteContext,\n Vt as getRangeAnnotatableContents,\n Re as isMac,\n W as isRevived,\n _e as isWhitespaceOrEmpty,\n Ve as mergeClientRects,\n Xe as paint,\n zn as parseW3CTextAnnotation,\n Be as programmaticallyFocusable,\n Ke as rangeToSelector,\n xt as reviveAnnotation,\n le as reviveSelector,\n wt as reviveTarget,\n De as scrollIntoView,\n Fn as serializeW3CTextAnnotation,\n Oe as splitAnnotatableRanges,\n Ye as trimRangeToContainer,\n Ie as whitespaceOrEmptyRegex\n};\n//# sourceMappingURL=text-annotator.es.js.map\n"],"names":[],"mappings":"AAAK,MAAC,KAAK,mBAAmB,IAAI,IAAI,EAAE,IA0BrC,KAAK,CAAC,MAAM;AACb,QAAM,IAAI,EAAE;AACZ,SAAO,EAAE,iBAAiB,CAAC,EA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CAAC,EAAE,QAAQ,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC,GAAG,KAAK;AAC9D,UAAM;AAAA,MACJ,UAAU;AAAA,MACV,SAAS;AAAA,IACV,IAAG;AACJ,OAAG,QAAQ,SAAS,GAAG,CAAC,GAAG,KAAK;AAAA,EACjC;AACH;AACA,MAAM,KAAK;AAAA,EACT,qBAAqB;AAAA,EACrB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,aAAa;AACf;AACA,WAAW,KAAK;AACd,SAAO,UAAU,eAAe,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,GAAG,CAAC;AAC7D,IAAI,OAAO,SAAS,KAAK;AACvB,QAAM,IAAI,OAAO;AACjB,IAAE,aAAa,CAAC,OAAO,KAAK,OAAO,YAAY,MAAM,OAAO,UAAU,IAAI,IAAI,OAAO,UAAU;AACjG;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"react-text-annotator.es7.js","sources":["../src/TextAnnotationPopup/TextAnnotationPopup.tsx"],"sourcesContent":["import React, { FC, ReactNode, useCallback, useRef, useEffect, useMemo, useState } from 'react';\nimport { useAnnotator, useSelection } from '@annotorious/react';\nimport {\n NOT_ANNOTATABLE_CLASS,\n toViewportBounds,\n toDomRectList,\n type TextAnnotation,\n type TextAnnotator,\n} from '@soomo/text-annotator';\n\nimport {\n arrow,\n autoUpdate,\n flip,\n FloatingArrow,\n FloatingArrowProps,\n FloatingFocusManager,\n FloatingPortal,\n inline,\n offset,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useRole\n} from '@floating-ui/react';\n\nimport { isMobile } from './isMobile';\nimport { useAnnouncePopupNavigation, useAnnotationQuoteIdling } from '../hooks';\n\nimport './TextAnnotationPopup.css';\n\ninterface TextAnnotationPopupProps {\n\n ariaNavigationMessage?: string;\n\n ariaCloseWarning?: string;\n\n arrow?: boolean;\n\n arrowProps?: Omit<FloatingArrowProps, 'context' | 'ref'>;\n\n popup(props: TextAnnotationPopupContentProps): ReactNode;\n\n}\n\nexport interface TextAnnotationPopupContentProps {\n\n annotation: TextAnnotation;\n\n editable?: boolean;\n\n event?: PointerEvent | KeyboardEvent;\n\n}\n\nexport const TextAnnotationPopup: FC<TextAnnotationPopupProps> = (props) => {\n\n const { popup, ariaNavigationMessage } = props;\n\n const r = useAnnotator<TextAnnotator>();\n\n const { selected, event } = useSelection<TextAnnotation>();\n const annotation = selected[0]?.annotation;\n\n const isAnnotationQuoteIdling = useAnnotationQuoteIdling(annotation?.id);\n\n const [isOpen, setOpen] = useState(selected?.length > 0);\n const handleClose = () => r?.cancelSelected();\n\n const [isFocused, setFocused] = useState(false);\n const handleFocus = useCallback(() => setFocused(true), []);\n const handleBlur = useCallback(() => setFocused(false), []);\n useEffect(() => {\n if (!isOpen) handleBlur();\n }, [isOpen, handleBlur]);\n\n const arrowRef = useRef(null);\n\n const { refs, floatingStyles, update, context } = useFloating({\n placement: isMobile() ? 'bottom' : 'top',\n open: isOpen,\n onOpenChange: (open, _event, reason) => {\n if (!open && (reason === 'escape-key' || reason === 'focus-out')) {\n setOpen(open);\n handleClose();\n }\n },\n middleware: [\n inline(),\n offset(10),\n flip({ crossAxis: true }),\n shift({ crossAxis: true, padding: 10 }),\n arrow({ element: arrowRef })\n ],\n whileElementsMounted: autoUpdate\n });\n\n const dismiss = useDismiss(context);\n\n const role = useRole(context, { role: 'dialog' });\n\n const { getFloatingProps } = useInteractions([dismiss, role]);\n\n useEffect(() => {\n if (!r) return;\n\n const annotationId = annotation?.id;\n const annotationSelectorsLength = annotation?.target.selector.length;\n\n if (annotationId && annotationSelectorsLength > 0 && isAnnotationQuoteIdling) {\n const bounds = r?.state.store.getAnnotationBounds(annotation.id);\n setOpen(Boolean(bounds));\n } else {\n setOpen(false);\n }\n }, [annotation?.id, annotation?.target.selector, isAnnotationQuoteIdling, r?.state.store]);\n\n useEffect(() => {\n if (!r) return;\n\n if (isOpen && annotation?.id) {\n refs.setPositionReference({\n getBoundingClientRect: () => {\n const bounds = r.state.store.getAnnotationBounds(annotation.id);\n return bounds\n ? toViewportBounds(bounds, r.element.getBoundingClientRect())\n : new DOMRect();\n },\n getClientRects: () => {\n const rects = r.state.store.getAnnotationRects(annotation.id);\n const denormalizedRects = rects.map((rect) =>\n toViewportBounds(rect, r.element.getBoundingClientRect())\n );\n return toDomRectList(denormalizedRects);\n }\n });\n } else {\n refs.setPositionReference(null);\n }\n }, [isOpen, annotation?.id, annotation?.target, r]);\n\n useEffect(() => {\n const config: MutationObserverInit = { attributes: true, childList: true, subtree: true };\n\n const mutationObserver = new MutationObserver(() => update());\n mutationObserver.observe(document.body, config);\n\n window.document.addEventListener('scroll', update, true);\n\n return () => {\n mutationObserver.disconnect();\n window.document.removeEventListener('scroll', update, true);\n };\n }, [update]);\n\n // Don't shift focus to the floating element if selected via keyboard or on mobile.\n const initialFocus = useMemo(() => {\n return (event?.type === 'keyup' || event?.type === 'contextmenu' || isMobile()) ? -1 : 0;\n }, [event]);\n\n /**\n * Announce the navigation hint only on the keyboard selection,\n * because the focus isn't shifted to the popup automatically then\n */\n useAnnouncePopupNavigation({\n disabled: isFocused,\n floatingOpen: isOpen,\n message: ariaNavigationMessage,\n });\n\n return isOpen && annotation ? (\n <FloatingPortal>\n <FloatingFocusManager\n context={context}\n modal={false}\n closeOnFocusOut={true}\n returnFocus={false}\n initialFocus={initialFocus}>\n <div\n className={`a9s-popup r6o-popup annotation-popup r6o-text-popup ${NOT_ANNOTATABLE_CLASS}`}\n ref={refs.setFloating}\n style={floatingStyles}>\n {props.popup({\n annotation: selected[0].annotation,\n editable: selected[0].editable,\n event\n })}\n{props.arrow && (\n <FloatingArrow\n ref={arrowRef}\n context={context}\n {...(props.arrowProps || {})} />\n )}\n\n <button className=\"r6o-popup-sr-only\" aria-live=\"assertive\" onClick={handleClose}>\n {props.ariaCloseWarning || 'Click or leave this dialog to close it.'}\n </button>\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n ) : null;\n\n};\n\n/**\n * Prevent text-annotator from handling the irrelevant events\n * triggered from the popup/toolbar/dialog\n *\nconst getStopEventsPropagationProps = <T extends HTMLElement = HTMLElement>() => ({\n onPointerUp: (event: React.PointerEvent<T>) => event.stopPropagation(),\n onPointerDown: (event: React.PointerEvent<T>) => event.stopPropagation(),\n onMouseDown: (event: React.MouseEvent<T>) => event.stopPropagation(),\n onMouseUp: (event: React.MouseEvent<T>) => event.stopPropagation()\n});\n*/\n\n/** For backwards compatibility **/\n/** @deprecated Use TextAnnotationPopup instead */\nexport const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => {\n\n useEffect(() => {\n console.warn('TextAnnotatorPopup is deprecated and will be removed in a future version. Please use TextAnnotationPopup instead.');\n }, []);\n\n return <TextAnnotationPopup {...props} />;\n};\n"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;;;AAwDa,MAAA,sBAAoD,CAAC,UAAU;;AAEpE,QAAA,EAAE,OAAO,sBAAA,IAA0B;AAEzC,QAAM,IAAI,aAA4B;AAEtC,QAAM,EAAE,UAAU,MAAM,IAAI,aAA6B;AACnD,QAAA,cAAa,cAAS,CAAC,MAAV,mBAAa;AAE1B,QAAA,0BAA0B,yBAAyB,yCAAY,EAAE;AAEvE,QAAM,CAAC,QAAQ,OAAO,IAAI,UAAS,qCAAU,UAAS,CAAC;AACjD,QAAA,cAAc,MAAM,uBAAG;AAE7B,QAAM,CAAC,WAAW,UAAU,IAAI,SAAS,KAAK;AAC1B,cAAY,MAAM,WAAW,IAAI,GAAG,CAAE,CAAA;AAC1D,QAAM,aAAa,YAAY,MAAM,WAAW,KAAK,GAAG,CAAA,CAAE;AAC1D,YAAU,MAAM;AACV,QAAA,CAAC,OAAmB,YAAA;AAAA,EAAA,GACvB,CAAC,QAAQ,UAAU,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A,QAAA;AAAA,UACC,WAAW,uDAAuD,qBAAqB;AAAA,UACvF,KAAK,KAAK;AAAA,UACV,OAAO;AAAA,UACN,UAAA;AAAA,YAAA,MAAM,MAAM;AAAA,cACX,YAAY,SAAS,CAAC,EAAE;AAAA,cACxB,UAAU,SAAS,CAAC,EAAE;AAAA,cACtB;AAAA,YAAA,CACD;AAAA,YACV,MAAM,SACKD,kCAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,KAAK;AAAA,gBACL;AAAA,gBACC,GAAI,MAAM,cAAc,CAAA;AAAA,cAAC;AAAA,YAAI;AAAA,YAGlCA,kCAAAA,IAAC,UAAO,EAAA,WAAU,qBAAoB,aAAU,aAAY,SAAS,aAClE,UAAM,MAAA,oBAAoB,0CAC7B,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,KAEJ,IACE;AAEN;AAgBa,MAAA,qBAAqB,CAAC,UAAoC;AAErE,YAAU,MAAM;AACd,YAAQ,KAAK,mHAAmH;AAAA,EAClI,GAAG,EAAE;AAEE,SAAAA,sCAAC,qBAAqB,EAAA,GAAG,MAAO,CAAA;AACzC;"}
@@ -1,12 +1,5 @@
1
- import { __module as jsxRuntime } from "./react-text-annotator.es18.js";
2
- import { __require as requireReactJsxRuntime_production_min } from "./react-text-annotator.es19.js";
3
- import { __require as requireReactJsxRuntime_development } from "./react-text-annotator.es20.js";
4
- if (process.env.NODE_ENV === "production") {
5
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
6
- } else {
7
- jsxRuntime.exports = requireReactJsxRuntime_development();
8
- }
9
- var jsxRuntimeExports = jsxRuntime.exports;
1
+ import { __require as requireJsxRuntime } from "./react-text-annotator.es19.js";
2
+ var jsxRuntimeExports = requireJsxRuntime();
10
3
  export {
11
4
  jsxRuntimeExports as j
12
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es8.js","sources":["../../../node_modules/react/jsx-runtime.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n"],"names":["jsxRuntimeModule","require$$0","require$$1"],"mappings":";;;AAEA,IAAI,QAAQ,IAAI,aAAa,cAAc;AACzCA,aAAA,UAAiBC;AACnB,OAAO;AACLD,aAAA,UAAiBE;AACnB;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"react-text-annotator.es8.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,4 +1,5 @@
1
1
  interface CETEIceanProps {
2
+ initArgs?: any;
2
3
  tei?: string;
3
4
  onLoad?(element: Element): void;
4
5
  behaviors?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"CETEIcean.d.ts","sourceRoot":"","sources":["../../src/tei/CETEIcean.tsx"],"names":[],"mappings":"AAGA,UAAU,cAAc;IAEtB,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,MAAM,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAEhC,SAAS,CAAC,EAAE,GAAG,CAAC;CAEjB;AAwCD,eAAO,MAAM,SAAS,UAAW,cAAc,4CA8B9C,CAAA"}
1
+ {"version":3,"file":"CETEIcean.d.ts","sourceRoot":"","sources":["../../src/tei/CETEIcean.tsx"],"names":[],"mappings":"AAGA,UAAU,cAAc;IAEtB,QAAQ,CAAC,EAAE,GAAG,CAAC;IAEf,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,MAAM,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAEhC,SAAS,CAAC,EAAE,GAAG,CAAC;CAEjB;AAwCD,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,4CAkC9C,CAAA"}
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { JSX, ReactNode } from 'react';
2
2
  import { Filter } from '@annotorious/react';
3
3
  import { HighlightStyleExpression, TextAnnotatorOptions } from '@soomo/text-annotator';
4
4
  export type TEIAnnotatorProps = TextAnnotatorOptions & {
@@ -1 +1 @@
1
- {"version":3,"file":"TEIAnnotator.d.ts","sourceRoot":"","sources":["../../src/tei/TEIAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,SAAS,EAAyB,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAsB,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAuB,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,+CAA+C,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG;IAErD,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC;IAEnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,wBAAwB,CAAA;CAEjC,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB,4CAgCpD,CAAA"}
1
+ {"version":3,"file":"TEIAnnotator.d.ts","sourceRoot":"","sources":["../../src/tei/TEIAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,GAAG,EAAgB,SAAS,EAAoD,MAAM,OAAO,CAAC;AACjH,OAAO,EAAsB,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAuB,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,+CAA+C,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG;IAErD,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC;IAEnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,wBAAwB,CAAA;CAEjC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CAgCpD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soomo/react-text-annotator",
3
- "version": "3.1.0-staging.9",
3
+ "version": "3.2.0-staging.1",
4
4
  "description": "Recogito Text Annotator React bindings",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -24,19 +24,20 @@
24
24
  "module": "./dist/react-text-annotator.es.js",
25
25
  "types": "./dist/index.d.ts",
26
26
  "devDependencies": {
27
- "@types/react-dom": "^18.3.0",
28
- "@vitejs/plugin-react": "^4.3.2",
27
+ "@types/react": "^19.1.0",
28
+ "@types/react-dom": "^19.1.1",
29
+ "@vitejs/plugin-react": "^4.3.4",
29
30
  "react": "^18.3.1",
30
31
  "react-dom": "^18.3.1",
31
- "typescript": "5.6.2",
32
- "vite": "^5.4.8",
33
- "vite-plugin-dts": "^4.2.3",
34
- "vite-tsconfig-paths": "^5.0.1"
32
+ "typescript": "5.8.2",
33
+ "vite": "^6.2.5",
34
+ "vite-plugin-dts": "^4.5.3",
35
+ "vite-tsconfig-paths": "^5.1.4"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0",
38
- "react": "16.8.0 || >=17.x || >=18.x",
39
- "react-dom": "16.8.0 || >=17.x || >=18.x"
39
+ "react": "16.8.0 || >=17.x || >=18.x || >=19.x",
40
+ "react-dom": "16.8.0 || >=17.x || >=18.x || >=19.x"
40
41
  },
41
42
  "peerDependenciesMeta": {
42
43
  "openseadragon": {
@@ -44,13 +45,14 @@
44
45
  }
45
46
  },
46
47
  "dependencies": {
47
- "@annotorious/core": "^3.0.9",
48
- "@annotorious/react": "^3.0.9",
49
- "@floating-ui/react": "^0.26.24",
48
+ "@annotorious/core": "^3.3.3",
49
+ "@annotorious/react": "^3.3.3",
50
+ "@floating-ui/react": "^0.27.6",
50
51
  "@react-aria/live-announcer": "^3.3.4",
51
- "@soomo/text-annotator": "3.1.0-staging.9",
52
- "@recogito/text-annotator-tei": "3.0.0-rc.49",
52
+ "@soomo/text-annotator": "3.2.0-staging.0",
53
+ "@recogito/text-annotator-tei": "3.0.1",
53
54
  "CETEIcean": "^1.9.3",
55
+ "dequal": "^2.0.3",
54
56
  "unique-random": "^4.0.0"
55
57
  }
56
58
  }
@@ -1,25 +0,0 @@
1
- import { FC, PointerEvent, MouseEvent, ReactNode } from 'react';
2
- import { TextAnnotation } from '@soomo/text-annotator';
3
- interface TextAnnotationPopupProps {
4
- ariaNavigationMessage?: string;
5
- ariaCloseWarning?: string;
6
- popup(props: TextAnnotationPopupContentProps): ReactNode;
7
- }
8
- export interface TextAnnotationPopupContentProps {
9
- annotation: TextAnnotation;
10
- editable?: boolean;
11
- event?: PointerEvent;
12
- }
13
- export declare const TextAnnotatorPopup: FC<TextAnnotationPopupProps>;
14
- /**
15
- * Prevent text-annotator from handling the irrelevant events
16
- * triggered from the popup/toolbar/dialog
17
- */
18
- export declare const getStopEventsPropagationProps: <T extends HTMLElement = HTMLElement>() => {
19
- onPointerUp: (event: PointerEvent<T>) => void;
20
- onPointerDown: (event: PointerEvent<T>) => void;
21
- onMouseDown: (event: MouseEvent<T>) => void;
22
- onMouseUp: (event: MouseEvent<T>) => void;
23
- };
24
- export {};
25
- //# sourceMappingURL=TextAnnotatorPopup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextAnnotatorPopup.d.ts","sourceRoot":"","sources":["../../src/TextAnnotatorPopup/TextAnnotatorPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAA6C,MAAM,OAAO,CAAC;AAiB3G,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,0BAA0B,CAAC;AAElC,UAAU,wBAAwB;IAEhC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,KAAK,CAAC,KAAK,EAAE,+BAA+B,GAAG,SAAS,CAAC;CAE1D;AAED,MAAM,WAAW,+BAA+B;IAE9C,UAAU,EAAE,cAAc,CAAC;IAE3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,CAAC;CAEtB;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,wBAAwB,CAkI3D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GAAI,CAAC,SAAS,WAAW;yBAC5C,YAAY,CAAC,CAAC,CAAC;2BACb,YAAY,CAAC,CAAC,CAAC;yBACjB,UAAU,CAAC,CAAC,CAAC;uBACf,UAAU,CAAC,CAAC,CAAC;CAChC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './TextAnnotatorPopup';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TextAnnotatorPopup/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"isMobile.d.ts","sourceRoot":"","sources":["../../src/TextAnnotatorPopup/isMobile.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,eAepB,CAAA"}
@@ -1,85 +0,0 @@
1
- const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7e3;
2
- let $319e236875307eab$var$liveAnnouncer = null;
3
- function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
4
- if (!$319e236875307eab$var$liveAnnouncer) {
5
- $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();
6
- if (!(typeof IS_REACT_ACT_ENVIRONMENT === "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== "undefined")) setTimeout(() => {
7
- if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
8
- }, 100);
9
- else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
10
- } else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
11
- }
12
- function $319e236875307eab$export$d8686216b8b81b2f() {
13
- if ($319e236875307eab$var$liveAnnouncer) {
14
- $319e236875307eab$var$liveAnnouncer.destroy();
15
- $319e236875307eab$var$liveAnnouncer = null;
16
- }
17
- }
18
- class $319e236875307eab$var$LiveAnnouncer {
19
- isAttached() {
20
- var _this_node;
21
- return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
22
- }
23
- createLog(ariaLive) {
24
- let node = document.createElement("div");
25
- node.setAttribute("role", "log");
26
- node.setAttribute("aria-live", ariaLive);
27
- node.setAttribute("aria-relevant", "additions");
28
- return node;
29
- }
30
- destroy() {
31
- if (!this.node) return;
32
- document.body.removeChild(this.node);
33
- this.node = null;
34
- }
35
- announce(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
36
- var _this_assertiveLog, _this_politeLog;
37
- if (!this.node) return;
38
- let node = document.createElement("div");
39
- if (typeof message === "object") {
40
- node.setAttribute("role", "img");
41
- node.setAttribute("aria-labelledby", message["aria-labelledby"]);
42
- } else node.textContent = message;
43
- if (assertiveness === "assertive") (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);
44
- else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);
45
- if (message !== "") setTimeout(() => {
46
- node.remove();
47
- }, timeout);
48
- }
49
- clear(assertiveness) {
50
- if (!this.node) return;
51
- if ((!assertiveness || assertiveness === "assertive") && this.assertiveLog) this.assertiveLog.innerHTML = "";
52
- if ((!assertiveness || assertiveness === "polite") && this.politeLog) this.politeLog.innerHTML = "";
53
- }
54
- constructor() {
55
- this.node = null;
56
- this.assertiveLog = null;
57
- this.politeLog = null;
58
- if (typeof document !== "undefined") {
59
- this.node = document.createElement("div");
60
- this.node.dataset.liveAnnouncer = "true";
61
- Object.assign(this.node.style, {
62
- border: 0,
63
- clip: "rect(0 0 0 0)",
64
- clipPath: "inset(50%)",
65
- height: "1px",
66
- margin: "-1px",
67
- overflow: "hidden",
68
- padding: 0,
69
- position: "absolute",
70
- width: "1px",
71
- whiteSpace: "nowrap"
72
- });
73
- this.assertiveLog = this.createLog("assertive");
74
- this.node.appendChild(this.assertiveLog);
75
- this.politeLog = this.createLog("polite");
76
- this.node.appendChild(this.politeLog);
77
- document.body.prepend(this.node);
78
- }
79
- }
80
- }
81
- export {
82
- $319e236875307eab$export$a9b970dcc4ae71a9 as announce,
83
- $319e236875307eab$export$d8686216b8b81b2f as destroyAnnouncer
84
- };
85
- //# sourceMappingURL=react-text-annotator.es16.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-text-annotator.es16.js","sources":["../../../node_modules/@react-aria/live-announcer/dist/LiveAnnouncer.mjs"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */ /* Inspired by https://github.com/AlmeroSteyn/react-aria-live */ const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7000;\nlet $319e236875307eab$var$liveAnnouncer = null;\nfunction $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {\n if (!$319e236875307eab$var$liveAnnouncer) {\n $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();\n // wait for the live announcer regions to be added to the dom, then announce\n // otherwise Safari won't announce the message if it's added too quickly\n // found most times less than 100ms were not consistent when announcing with Safari\n // IS_REACT_ACT_ENVIRONMENT is used by React 18. Previous versions checked for the `jest` global.\n // https://github.com/reactwg/react-18/discussions/102\n // if we're in a test environment, announce without waiting\n // @ts-ignore\n if (!(typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== 'undefined')) setTimeout(()=>{\n if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n }, 100);\n else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n } else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n}\nfunction $319e236875307eab$export$d10ae4f68404609a(assertiveness) {\n if ($319e236875307eab$var$liveAnnouncer) $319e236875307eab$var$liveAnnouncer.clear(assertiveness);\n}\nfunction $319e236875307eab$export$d8686216b8b81b2f() {\n if ($319e236875307eab$var$liveAnnouncer) {\n $319e236875307eab$var$liveAnnouncer.destroy();\n $319e236875307eab$var$liveAnnouncer = null;\n }\n}\n// LiveAnnouncer is implemented using vanilla DOM, not React. That's because as of React 18\n// ReactDOM.render is deprecated, and the replacement, ReactDOM.createRoot is moved into a\n// subpath import `react-dom/client`. That makes it hard for us to support multiple React versions.\n// As a global API, we can't use portals without introducing a breaking API change. LiveAnnouncer\n// is simple enough to implement without React, so that's what we do here.\n// See this discussion for more details: https://github.com/reactwg/react-18/discussions/125#discussioncomment-2382638\nclass $319e236875307eab$var$LiveAnnouncer {\n isAttached() {\n var _this_node;\n return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;\n }\n createLog(ariaLive) {\n let node = document.createElement('div');\n node.setAttribute('role', 'log');\n node.setAttribute('aria-live', ariaLive);\n node.setAttribute('aria-relevant', 'additions');\n return node;\n }\n destroy() {\n if (!this.node) return;\n document.body.removeChild(this.node);\n this.node = null;\n }\n announce(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {\n var _this_assertiveLog, _this_politeLog;\n if (!this.node) return;\n let node = document.createElement('div');\n if (typeof message === 'object') {\n // To read an aria-labelledby, the element must have an appropriate role, such as img.\n node.setAttribute('role', 'img');\n node.setAttribute('aria-labelledby', message['aria-labelledby']);\n } else node.textContent = message;\n if (assertiveness === 'assertive') (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);\n else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);\n if (message !== '') setTimeout(()=>{\n node.remove();\n }, timeout);\n }\n clear(assertiveness) {\n if (!this.node) return;\n if ((!assertiveness || assertiveness === 'assertive') && this.assertiveLog) this.assertiveLog.innerHTML = '';\n if ((!assertiveness || assertiveness === 'polite') && this.politeLog) this.politeLog.innerHTML = '';\n }\n constructor(){\n this.node = null;\n this.assertiveLog = null;\n this.politeLog = null;\n if (typeof document !== 'undefined') {\n this.node = document.createElement('div');\n this.node.dataset.liveAnnouncer = 'true';\n // copied from VisuallyHidden\n Object.assign(this.node.style, {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n whiteSpace: 'nowrap'\n });\n this.assertiveLog = this.createLog('assertive');\n this.node.appendChild(this.assertiveLog);\n this.politeLog = this.createLog('polite');\n this.node.appendChild(this.politeLog);\n document.body.prepend(this.node);\n }\n }\n}\n\n\nexport {$319e236875307eab$export$a9b970dcc4ae71a9 as announce, $319e236875307eab$export$d10ae4f68404609a as clearAnnouncer, $319e236875307eab$export$d8686216b8b81b2f as destroyAnnouncer};\n//# sourceMappingURL=LiveAnnouncer.module.js.map\n"],"names":[],"mappings":"AAUqE,MAAM,iDAAiD;AAC5H,IAAI,sCAAsC;AAC1C,SAAS,0CAA0C,SAAS,gBAAgB,aAAa,UAAU,gDAAgD;AAC/I,MAAI,CAAC,qCAAqC;AACtC,0CAAsC,IAAI;AAQ1C,QAAI,EAAE,OAAO,6BAA6B,YAAY,2BAA2B,OAAO,SAAS,aAAc,YAAW,MAAI;AAC1H,UAAI,wCAAwC,QAAQ,wCAAwC,SAAS,SAAS,oCAAoC,WAAU,EAAI,yCAAwC,QAAQ,wCAAwC,SAAS,SAAS,oCAAoC,SAAS,SAAS,eAAe,OAAO;AAAA,IACzV,GAAE,GAAG;AAAA,QACD,qCAAoC,SAAS,SAAS,eAAe,OAAO;AAAA,EACpF,MAAM,qCAAoC,SAAS,SAAS,eAAe,OAAO;AACvF;AAIA,SAAS,4CAA4C;AACjD,MAAI,qCAAqC;AACrC,wCAAoC,QAAO;AAC3C,0CAAsC;AAAA,EACzC;AACL;AAOA,MAAM,oCAAoC;AAAA,EACtC,aAAa;AACT,QAAI;AACJ,YAAQ,aAAa,KAAK,UAAU,QAAQ,eAAe,SAAS,SAAS,WAAW;AAAA,EAC3F;AAAA,EACD,UAAU,UAAU;AAChB,QAAI,OAAO,SAAS,cAAc,KAAK;AACvC,SAAK,aAAa,QAAQ,KAAK;AAC/B,SAAK,aAAa,aAAa,QAAQ;AACvC,SAAK,aAAa,iBAAiB,WAAW;AAC9C,WAAO;AAAA,EACV;AAAA,EACD,UAAU;AACN,QAAI,CAAC,KAAK,KAAM;AAChB,aAAS,KAAK,YAAY,KAAK,IAAI;AACnC,SAAK,OAAO;AAAA,EACf;AAAA,EACD,SAAS,SAAS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