@soomo/react-text-annotator 3.0.0-staging.3 → 3.0.0-staging.30
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.
- package/dist/TextAnnotator.d.ts +3 -3
- package/dist/TextAnnotator.d.ts.map +1 -1
- package/dist/TextAnnotatorPlugin.d.ts +1 -2
- package/dist/TextAnnotatorPlugin.d.ts.map +1 -1
- package/dist/TextAnnotatorPopup.d.ts +6 -5
- package/dist/TextAnnotatorPopup.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/react-text-annotator.css +1 -1
- package/dist/react-text-annotator.es.js +8 -2
- package/dist/react-text-annotator.es.js.map +1 -1
- package/dist/react-text-annotator.es10.js +234 -33
- package/dist/react-text-annotator.es10.js.map +1 -1
- package/dist/react-text-annotator.es11.js +566 -888
- package/dist/react-text-annotator.es11.js.map +1 -1
- package/dist/react-text-annotator.es12.js +487 -2
- package/dist/react-text-annotator.es12.js.map +1 -1
- package/dist/react-text-annotator.es13.js +2 -2
- package/dist/react-text-annotator.es14.js +30 -113
- package/dist/react-text-annotator.es14.js.map +1 -1
- package/dist/react-text-annotator.es15.js +886 -297
- package/dist/react-text-annotator.es15.js.map +1 -1
- package/dist/react-text-annotator.es16.js +42 -49
- package/dist/react-text-annotator.es16.js.map +1 -1
- package/dist/react-text-annotator.es17.js +142 -15
- package/dist/react-text-annotator.es17.js.map +1 -1
- package/dist/react-text-annotator.es18.js +5 -0
- package/dist/react-text-annotator.es18.js.map +1 -0
- package/dist/react-text-annotator.es19.js +5 -0
- package/dist/react-text-annotator.es19.js.map +1 -0
- package/dist/react-text-annotator.es2.js +2 -2
- package/dist/react-text-annotator.es20.js +117 -0
- package/dist/react-text-annotator.es20.js.map +1 -0
- package/dist/react-text-annotator.es21.js +312 -0
- package/dist/react-text-annotator.es21.js.map +1 -0
- package/dist/react-text-annotator.es22.js +61 -0
- package/dist/react-text-annotator.es22.js.map +1 -0
- package/dist/react-text-annotator.es23.js +23 -0
- package/dist/react-text-annotator.es23.js.map +1 -0
- package/dist/react-text-annotator.es24.js +86 -0
- package/dist/react-text-annotator.es24.js.map +1 -0
- package/dist/react-text-annotator.es25.js +458 -0
- package/dist/react-text-annotator.es25.js.map +1 -0
- package/dist/react-text-annotator.es3.js +2 -2
- package/dist/react-text-annotator.es4.js +7 -14
- package/dist/react-text-annotator.es4.js.map +1 -1
- package/dist/react-text-annotator.es5.js +54 -38
- package/dist/react-text-annotator.es5.js.map +1 -1
- package/dist/react-text-annotator.es6.js +178 -9
- package/dist/react-text-annotator.es6.js.map +1 -1
- package/dist/react-text-annotator.es7.js +12 -1
- package/dist/react-text-annotator.es7.js.map +1 -1
- package/dist/react-text-annotator.es9.js +669 -2
- package/dist/react-text-annotator.es9.js.map +1 -1
- package/dist/tei/TEIAnnotator.d.ts +2 -2
- package/package.json +21 -15
- package/dist/react-text-annotator.es8.js +0 -491
- package/dist/react-text-annotator.es8.js.map +0 -1
|
@@ -1,50 +1,66 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./react-text-annotator.
|
|
2
|
-
import {
|
|
3
|
-
import { useRef, useState, useEffect } from "react";
|
|
1
|
+
import { j as jsxRuntimeExports } from "./react-text-annotator.es7.js";
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
4
3
|
import { useAnnotator, useSelection } from "@annotorious/react";
|
|
4
|
+
import { useFloating, useDismiss, useRole, useInteractions } from "./react-text-annotator.es9.js";
|
|
5
|
+
import { offset, inline, shift } from "./react-text-annotator.es10.js";
|
|
6
|
+
import { autoUpdate } from "./react-text-annotator.es11.js";
|
|
5
7
|
const TextAnnotatorPopup = (props) => {
|
|
6
|
-
|
|
8
|
+
var _a;
|
|
7
9
|
const r = useAnnotator();
|
|
8
|
-
const [open, setOpen] = useState(false);
|
|
9
10
|
const { selected, pointerEvent } = useSelection();
|
|
11
|
+
const annotation = (_a = selected[0]) == null ? void 0 : _a.annotation;
|
|
12
|
+
const [isOpen, setOpen] = useState((selected == null ? void 0 : selected.length) > 0);
|
|
13
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
14
|
+
placement: "top",
|
|
15
|
+
open: isOpen,
|
|
16
|
+
onOpenChange: (open, _event, reason) => {
|
|
17
|
+
setOpen(open);
|
|
18
|
+
if (!open && reason === "escape-key") {
|
|
19
|
+
r == null ? void 0 : r.cancelSelected();
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
middleware: [
|
|
23
|
+
offset(10),
|
|
24
|
+
inline(),
|
|
25
|
+
shift({ mainAxis: false, crossAxis: true, padding: 10 })
|
|
26
|
+
],
|
|
27
|
+
whileElementsMounted: autoUpdate
|
|
28
|
+
});
|
|
29
|
+
const dismiss = useDismiss(context);
|
|
30
|
+
const role = useRole(context, { role: "tooltip" });
|
|
31
|
+
const { getFloatingProps } = useInteractions([dismiss, role]);
|
|
32
|
+
const selectedKey = selected.map((a) => a.annotation.id).join("-");
|
|
10
33
|
useEffect(() => {
|
|
11
34
|
if (pointerEvent) {
|
|
12
|
-
|
|
13
|
-
setOpen(true);
|
|
14
|
-
} else {
|
|
15
|
-
setOpen(false);
|
|
16
|
-
}
|
|
35
|
+
setOpen(selected.length > 0 && pointerEvent.type === "pointerup");
|
|
17
36
|
}
|
|
18
|
-
}, [pointerEvent
|
|
37
|
+
}, [pointerEvent == null ? void 0 : pointerEvent.type, selectedKey]);
|
|
19
38
|
useEffect(() => {
|
|
20
|
-
if (!
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let y = pointerEvent.clientY - top;
|
|
25
|
-
const { id } = selected[0].annotation;
|
|
26
|
-
const { offsetX, offsetY } = pointerEvent;
|
|
27
|
-
const bounds = r.state.store.getAnnotationBounds(id, offsetX, offsetY);
|
|
28
|
-
if (bounds) {
|
|
29
|
-
x = Math.max(x, bounds.x - left);
|
|
30
|
-
x = Math.min(x, bounds.right - left);
|
|
31
|
-
}
|
|
32
|
-
el.current.style.left = `${x}px`;
|
|
33
|
-
el.current.style.top = `${y}px`;
|
|
34
|
-
}, [open, pointerEvent, r == null ? void 0 : r.element]);
|
|
35
|
-
const onPointerUp = (evt) => evt.stopPropagation();
|
|
36
|
-
return open && selected.length > 0 ? createPortal(
|
|
37
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
38
|
-
"div",
|
|
39
|
-
{
|
|
40
|
-
ref: el,
|
|
41
|
-
className: "a9s-popup r6o-popup not-annotatable",
|
|
42
|
-
style: { position: "absolute" },
|
|
43
|
-
onPointerUp,
|
|
44
|
-
children: props.popup({ selected })
|
|
39
|
+
if (!isOpen || !annotation) return;
|
|
40
|
+
const {
|
|
41
|
+
target: {
|
|
42
|
+
selector: [{ range }]
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
} = annotation;
|
|
45
|
+
refs.setPositionReference({
|
|
46
|
+
getBoundingClientRect: range.getBoundingClientRect.bind(range),
|
|
47
|
+
getClientRects: range.getClientRects.bind(range)
|
|
48
|
+
});
|
|
49
|
+
}, [isOpen, annotation, refs]);
|
|
50
|
+
const getStopEventsPropagationProps = useCallback(
|
|
51
|
+
() => ({ onPointerUp: (event) => event.stopPropagation() }),
|
|
52
|
+
[]
|
|
53
|
+
);
|
|
54
|
+
return isOpen && selected.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "annotation-popup text-annotation-popup not-annotatable",
|
|
58
|
+
ref: refs.setFloating,
|
|
59
|
+
style: floatingStyles,
|
|
60
|
+
...getFloatingProps(),
|
|
61
|
+
...getStopEventsPropagationProps(),
|
|
62
|
+
children: props.popup({ selected })
|
|
63
|
+
}
|
|
48
64
|
) : null;
|
|
49
65
|
};
|
|
50
66
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es5.js","sources":["../src/TextAnnotatorPopup.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"react-text-annotator.es5.js","sources":["../src/TextAnnotatorPopup.tsx"],"sourcesContent":["import { ReactNode, useCallback, useEffect, useState, PointerEvent } from 'react';\nimport { useAnnotator, useSelection } from '@annotorious/react';\nimport { type TextAnnotation, type TextAnnotator } from '@soomo/text-annotator';\nimport {\n autoUpdate,\n inline,\n offset,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useRole\n} from '@floating-ui/react';\n\ninterface TextAnnotationPopupProps {\n\n popup(props: TextAnnotatorPopupProps): ReactNode;\n\n}\n\nexport interface TextAnnotatorPopupProps {\n\n selected: { annotation: TextAnnotation, editable?: boolean }[];\n\n}\n\nexport const TextAnnotatorPopup = (props: TextAnnotationPopupProps) => {\n const r = useAnnotator<TextAnnotator>();\n\n const { selected, pointerEvent } = useSelection<TextAnnotation>();\n\n const annotation = selected[0]?.annotation;\n\n const [isOpen, setOpen] = useState(selected?.length > 0);\n\n const { refs, floatingStyles, context } = useFloating({\n placement: 'top',\n open: isOpen,\n onOpenChange: (open, _event, reason) => {\n setOpen(open);\n if (!open && reason === 'escape-key') {\n r?.cancelSelected();\n }\n },\n middleware: [\n offset(10),\n inline(),\n\n shift({ mainAxis: false, crossAxis: true, padding: 10 })\n ],\n whileElementsMounted: autoUpdate\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context, { role: 'tooltip' });\n const { getFloatingProps } = useInteractions([dismiss, role]);\n\n const selectedKey = selected.map(a => a.annotation.id).join('-');\n useEffect(() => {\n // Ignore all selection changes except those accompanied by a pointer event.\n if (pointerEvent) {\n setOpen(selected.length > 0 && pointerEvent.type === 'pointerup');\n }\n }, [pointerEvent?.type, selectedKey]);\n\n useEffect(() => {\n if (!isOpen || !annotation) return;\n\n const {\n target: {\n selector: [{ range }]\n }\n } = annotation;\n\n refs.setPositionReference({\n getBoundingClientRect: range.getBoundingClientRect.bind(range),\n getClientRects: range.getClientRects.bind(range)\n });\n }, [isOpen, annotation, refs]);\n\n // Prevent text-annotator from handling the irrelevant events triggered from the popup\n const getStopEventsPropagationProps = useCallback(\n () => ({ onPointerUp: (event: PointerEvent<HTMLDivElement>) => event.stopPropagation() }),\n []\n );\n\n return isOpen && selected.length > 0 ? (\n <div\n className=\"annotation-popup text-annotation-popup not-annotatable\"\n ref={refs.setFloating}\n style={floatingStyles}\n {...getFloatingProps()}\n {...getStopEventsPropagationProps()}>\n {props.popup({ selected })}\n </div>\n ) : null;\n\n}\n"],"names":["jsx"],"mappings":";;;;;;AA0Ba,MAAA,qBAAqB,CAAC,UAAoC;;AACrE,QAAM,IAAI;AAEV,QAAM,EAAE,UAAU,aAAa,IAAI,aAA6B;AAE1D,QAAA,cAAa,cAAS,CAAC,MAAV,mBAAa;AAEhC,QAAM,CAAC,QAAQ,OAAO,IAAI,UAAS,qCAAU,UAAS,CAAC;AAEvD,QAAM,EAAE,MAAM,gBAAgB,QAAA,IAAY,YAAY;AAAA,IACpD,WAAW;AAAA,IACX,MAAM;AAAA,IACN,cAAc,CAAC,MAAM,QAAQ,WAAW;AACtC,cAAQ,IAAI;AACR,UAAA,CAAC,QAAQ,WAAW,cAAc;AACpC,+BAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV,OAAO,EAAE;AAAA,MACT,OAAO;AAAA,MAEP,MAAM,EAAE,UAAU,OAAO,WAAW,MAAM,SAAS,IAAI;AAAA,IACzD;AAAA,IACA,sBAAsB;AAAA,EAAA,CACvB;AAEK,QAAA,UAAU,WAAW,OAAO;AAClC,QAAM,OAAO,QAAQ,SAAS,EAAE,MAAM,WAAW;AACjD,QAAM,EAAE,iBAAiB,IAAI,gBAAgB,CAAC,SAAS,IAAI,CAAC;AAEtD,QAAA,cAAc,SAAS,IAAI,CAAA,MAAK,EAAE,WAAW,EAAE,EAAE,KAAK,GAAG;AAC/D,YAAU,MAAM;AAEd,QAAI,cAAc;AAChB,cAAQ,SAAS,SAAS,KAAK,aAAa,SAAS,WAAW;AAAA,IAClE;AAAA,EACC,GAAA,CAAC,6CAAc,MAAM,WAAW,CAAC;AAEpC,YAAU,MAAM;AACV,QAAA,CAAC,UAAU,CAAC,WAAY;AAEtB,UAAA;AAAA,MACJ,QAAQ;AAAA,QACN,UAAU,CAAC,EAAE,OAAO;AAAA,MACtB;AAAA,IACE,IAAA;AAEJ,SAAK,qBAAqB;AAAA,MACxB,uBAAuB,MAAM,sBAAsB,KAAK,KAAK;AAAA,MAC7D,gBAAgB,MAAM,eAAe,KAAK,KAAK;AAAA,IAAA,CAChD;AAAA,EACA,GAAA,CAAC,QAAQ,YAAY,IAAI,CAAC;AAG7B,QAAM,gCAAgC;AAAA,IACpC,OAAO,EAAE,aAAa,CAAC,UAAwC,MAAM,gBAAkB,EAAA;AAAA,IACvF,CAAC;AAAA,EAAA;AAGI,SAAA,UAAU,SAAS,SAAS,IACjCA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,KAAK,KAAK;AAAA,MACV,OAAO;AAAA,MACN,GAAG,iBAAiB;AAAA,MACpB,GAAG,8BAA8B;AAAA,MACjC,UAAM,MAAA,MAAM,EAAE,SAAA,CAAU;AAAA,IAAA;AAAA,EAEzB,IAAA;AAEN;"}
|
|
@@ -1,13 +1,182 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const Yt = "not-annotatable", D = `.${Yt}`, gt = (t) => {
|
|
2
|
+
const e = t.cloneContents();
|
|
3
|
+
return e.querySelectorAll(D).forEach((n) => n.remove()), e;
|
|
4
|
+
}, oe = (t, e, n = 10, o) => {
|
|
5
|
+
const i = e, r = document.createRange();
|
|
6
|
+
r.setStart(i, 0), r.setEnd(t.startContainer, t.startOffset);
|
|
7
|
+
const s = gt(r).textContent, a = document.createRange();
|
|
8
|
+
a.setStart(t.endContainer, t.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
|
|
9
|
+
const u = gt(a).textContent;
|
|
10
|
+
return {
|
|
11
|
+
prefix: s.substring(s.length - n),
|
|
12
|
+
suffix: u.substring(0, n)
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
var V = [];
|
|
16
|
+
for (var lt = 0; lt < 256; ++lt)
|
|
17
|
+
V.push((lt + 256).toString(16).slice(1));
|
|
18
|
+
function Re(t, e = 0) {
|
|
19
|
+
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();
|
|
20
|
+
}
|
|
21
|
+
var Z, Ne = new Uint8Array(16);
|
|
22
|
+
function Me() {
|
|
23
|
+
if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))
|
|
24
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
25
|
+
return Z(Ne);
|
|
26
|
+
}
|
|
27
|
+
var Oe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
28
|
+
const Mt = {
|
|
29
|
+
randomUUID: Oe
|
|
30
|
+
};
|
|
31
|
+
function Ht(t, e, n) {
|
|
32
|
+
if (Mt.randomUUID && !e && !t)
|
|
33
|
+
return Mt.randomUUID();
|
|
34
|
+
t = t || {};
|
|
35
|
+
var o = t.random || (t.rng || Me)();
|
|
36
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Re(o);
|
|
8
37
|
}
|
|
9
|
-
var
|
|
38
|
+
var U = [];
|
|
39
|
+
for (var ht = 0; ht < 256; ++ht)
|
|
40
|
+
U.push((ht + 256).toString(16).slice(1));
|
|
41
|
+
typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
42
|
+
const on = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
43
|
+
let cn = (t = 21) => {
|
|
44
|
+
let e = "", n = crypto.getRandomValues(new Uint8Array(t));
|
|
45
|
+
for (; t--; )
|
|
46
|
+
e += on[n[t] & 63];
|
|
47
|
+
return e;
|
|
48
|
+
};
|
|
49
|
+
const dn = (t) => {
|
|
50
|
+
const e = JSON.stringify(t);
|
|
51
|
+
let n = 0;
|
|
52
|
+
for (let o = 0, i = e.length; o < i; o++) {
|
|
53
|
+
let r = e.charCodeAt(o);
|
|
54
|
+
n = (n << 5) - n + r, n |= 0;
|
|
55
|
+
}
|
|
56
|
+
return `${n}`;
|
|
57
|
+
}, Ft = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, un = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
58
|
+
const { id: o, type: i, purpose: r, value: s, created: a, modified: u, creator: h, ...m } = n;
|
|
59
|
+
return {
|
|
60
|
+
id: o || `temp-${dn(n)}`,
|
|
61
|
+
annotation: e,
|
|
62
|
+
type: i,
|
|
63
|
+
purpose: r,
|
|
64
|
+
value: s,
|
|
65
|
+
creator: Ft(h),
|
|
66
|
+
created: a ? new Date(a) : void 0,
|
|
67
|
+
updated: u ? new Date(u) : void 0,
|
|
68
|
+
...m
|
|
69
|
+
};
|
|
70
|
+
}), hn = (t) => t.map((e) => {
|
|
71
|
+
var n;
|
|
72
|
+
const { annotation: o, created: i, updated: r, ...s } = e, a = {
|
|
73
|
+
...s,
|
|
74
|
+
created: i == null ? void 0 : i.toISOString(),
|
|
75
|
+
modified: r == null ? void 0 : r.toISOString()
|
|
76
|
+
};
|
|
77
|
+
return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
|
|
78
|
+
});
|
|
79
|
+
cn();
|
|
80
|
+
const Un = (t, e) => ({
|
|
81
|
+
parse: (n) => gn(n),
|
|
82
|
+
serialize: (n) => mn(n, t, e)
|
|
83
|
+
}), fn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, pn = (t) => {
|
|
84
|
+
const {
|
|
85
|
+
id: e,
|
|
86
|
+
creator: n,
|
|
87
|
+
created: o,
|
|
88
|
+
modified: i,
|
|
89
|
+
target: r
|
|
90
|
+
} = t, s = Array.isArray(r) ? r : [r], a = {
|
|
91
|
+
creator: Ft(n),
|
|
92
|
+
created: o ? new Date(o) : void 0,
|
|
93
|
+
updated: i ? new Date(i) : void 0,
|
|
94
|
+
annotation: e,
|
|
95
|
+
selector: []
|
|
96
|
+
};
|
|
97
|
+
for (const u of s) {
|
|
98
|
+
const m = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((l, g) => {
|
|
99
|
+
switch (g.type) {
|
|
100
|
+
case "TextQuoteSelector":
|
|
101
|
+
l.quote = g.exact;
|
|
102
|
+
break;
|
|
103
|
+
case "TextPositionSelector":
|
|
104
|
+
l.start = g.start, l.end = g.end;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
return l;
|
|
108
|
+
}, {});
|
|
109
|
+
if (fn(m))
|
|
110
|
+
a.selector.push({ id: u.id, ...m });
|
|
111
|
+
else {
|
|
112
|
+
const l = [
|
|
113
|
+
m.start ? void 0 : "TextPositionSelector",
|
|
114
|
+
m.quote ? void 0 : "TextQuoteSelector"
|
|
115
|
+
].filter(Boolean);
|
|
116
|
+
return { error: Error(`Missing selector types: ${l.join(" and ")} for annotation: ${t.id}`) };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return { parsed: a };
|
|
120
|
+
}, gn = (t) => {
|
|
121
|
+
const e = t.id || Ht(), {
|
|
122
|
+
creator: n,
|
|
123
|
+
created: o,
|
|
124
|
+
modified: i,
|
|
125
|
+
body: r,
|
|
126
|
+
...s
|
|
127
|
+
} = t, a = un(r, e), u = pn(t);
|
|
128
|
+
return "error" in u ? { error: u.error } : {
|
|
129
|
+
parsed: {
|
|
130
|
+
...s,
|
|
131
|
+
id: e,
|
|
132
|
+
bodies: a,
|
|
133
|
+
target: u.parsed
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}, mn = (t, e, n) => {
|
|
137
|
+
const { bodies: o, target: i, ...r } = t, {
|
|
138
|
+
selector: s,
|
|
139
|
+
creator: a,
|
|
140
|
+
created: u,
|
|
141
|
+
updated: h,
|
|
142
|
+
...m
|
|
143
|
+
} = i, l = s.map((g) => {
|
|
144
|
+
const { quote: p, start: w, end: y, range: f } = g, { prefix: d, suffix: c } = oe(f, n), v = [{
|
|
145
|
+
type: "TextQuoteSelector",
|
|
146
|
+
exact: p,
|
|
147
|
+
prefix: d,
|
|
148
|
+
suffix: c
|
|
149
|
+
}, {
|
|
150
|
+
type: "TextPositionSelector",
|
|
151
|
+
start: w,
|
|
152
|
+
end: y
|
|
153
|
+
}];
|
|
154
|
+
return {
|
|
155
|
+
...m,
|
|
156
|
+
id: g.id,
|
|
157
|
+
source: e,
|
|
158
|
+
selector: v
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
...r,
|
|
163
|
+
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
164
|
+
id: t.id,
|
|
165
|
+
type: "Annotation",
|
|
166
|
+
body: hn(t.bodies),
|
|
167
|
+
creator: a,
|
|
168
|
+
created: u == null ? void 0 : u.toISOString(),
|
|
169
|
+
modified: h == null ? void 0 : h.toISOString(),
|
|
170
|
+
target: l
|
|
171
|
+
};
|
|
172
|
+
};
|
|
10
173
|
export {
|
|
11
|
-
|
|
174
|
+
Yt as NOT_ANNOTATABLE_CLASS,
|
|
175
|
+
D as NOT_ANNOTATABLE_SELECTOR,
|
|
176
|
+
Un as W3CTextFormat,
|
|
177
|
+
oe as getQuoteContext,
|
|
178
|
+
gt as getRangeAnnotatableContents,
|
|
179
|
+
gn as parseW3CTextAnnotation,
|
|
180
|
+
mn as serializeW3CTextAnnotation
|
|
12
181
|
};
|
|
13
182
|
//# sourceMappingURL=react-text-annotator.es6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es6.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.es6.js","sources":["../../../node_modules/@recogito/text-annotator/dist/text-annotator.es.js"],"sourcesContent":["const P = {\n fill: \"rgb(0, 128, 255)\",\n fillOpacity: 0.18\n}, ot = {\n fill: \"rgb(0, 128, 255)\",\n fillOpacity: 0.45\n}, Kt = (t, e, n, o, i) => {\n var s, a;\n const r = n ? typeof n == \"function\" ? n(t.annotation, t.state, i) || ((s = t.state) != null && s.selected ? ot : P) : n : (a = t.state) != null && a.selected ? ot : P;\n return o && o.paint(t, e) || r;\n}, Yt = \"not-annotatable\", D = `.${Yt}`, Qt = (t) => {\n var n;\n const e = t.commonAncestorContainer;\n return e instanceof HTMLElement ? !e.closest(D) : !((n = e.parentElement) != null && n.closest(D));\n}, Jt = function* (t) {\n const e = document.createNodeIterator(\n t.commonAncestorContainer,\n NodeFilter.SHOW_ELEMENT,\n (o) => o instanceof HTMLElement && o.classList.contains(Yt) && !o.parentElement.closest(D) && 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}, Zt = (t) => {\n if (!Qt(t)) return [];\n const e = [];\n let n = null;\n for (const o of Jt(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}, gt = (t) => {\n const e = t.cloneContents();\n return e.querySelectorAll(D).forEach((n) => n.remove()), e;\n}, te = (t) => {\n t.addEventListener(\"click\", (e) => {\n // Allow clicks within not-annotatable elements\n !e.target.closest(D) && !e.target.closest(\"a\") && e.preventDefault();\n });\n}, bt = (t, e = 10) => {\n let n;\n return (...o) => {\n clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);\n };\n}, On = (t) => {\n const e = t.cloneContents();\n return e.querySelectorAll(D).forEach((n) => n.remove()), e;\n}, wt = (t, e) => {\n const n = document.createNodeIterator(e);\n let o = 0, i = n.nextNode();\n for (; i !== null; ) {\n if (i === t)\n return o;\n o += 1, i = n.nextNode();\n }\n}, xt = (t, e) => {\n const n = document.createNodeIterator(e);\n let o = null;\n for (let i = 0; i < t + 1; i++)\n o = n.nextNode();\n return o;\n}, ee = (t) => {\n const {\n commonAncestorContainer: e,\n startContainer: n,\n startOffset: o,\n endContainer: i,\n endOffset: r\n } = t, s = Array.from(e.childNodes).map((l) => {\n const g = l.cloneNode(!0);\n return l.nodeName === \"CANVAS\" ? l : g;\n }), a = wt(n, e), u = wt(i, e), h = () => {\n const l = e;\n l.replaceChildren(...s);\n const g = xt(a, l), p = xt(u, l);\n return t.setStart(g, o), t.setEnd(p, r), t;\n }, m = (l) => {\n const g = document.createElement(\"SPAN\");\n return l.surroundContents(g), g;\n };\n if (n === i)\n throw \"Not implemented\";\n {\n const l = document.createRange();\n l.selectNodeContents(n), l.setStart(n, o);\n const g = m(l), p = document.createRange();\n p.selectNode(i), p.setEnd(i, r);\n const w = m(p), f = ne(t).reverse().map((d) => {\n var v;\n const c = document.createElement(\"SPAN\");\n return (v = d.parentNode) == null || v.insertBefore(c, d), c.appendChild(d), c;\n });\n return { unwrap: h, nodes: [g, ...f, w] };\n }\n}, ne = (t) => {\n const {\n commonAncestorContainer: e,\n startContainer: n,\n endContainer: o\n } = t, i = document.createNodeIterator(e, NodeFilter.SHOW_TEXT);\n let r = i.nextNode(), s = !1;\n const a = [];\n for (; r != null; )\n r === o && (s = !1), s && a.push(r), r === n && (s = !0), r = i.nextNode();\n return a;\n}, In = (t) => {\n const { startContainer: e, endContainer: n } = t;\n if (e === n)\n return Array.from(t.getClientRects());\n {\n const { unwrap: o, nodes: i } = ee(t), r = i.reduce((s, a) => [...s, ...a.getClientRects()], []);\n return o(), r;\n }\n}, oe = (t, e, n = 10, o) => {\n const i = o ? t.startContainer.parentElement.closest(o) : e, r = document.createRange();\n r.setStart(i, 0), r.setEnd(t.startContainer, t.startOffset);\n const s = gt(r).textContent, a = document.createRange();\n a.setStart(t.endContainer, t.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);\n const u = gt(a).textContent;\n return {\n prefix: s.substring(s.length - n),\n suffix: u.substring(0, n)\n };\n}, ie = /^\\s*$/, re = (t) => ie.test(t.toString()), $ = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), se = (t, e) => {\n const n = (r) => Math.round(r * 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}, ae = (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), r = Math.max(t.bottom, e.bottom);\n return new DOMRect(n, i, o - n, r - i);\n}, ce = (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 r of e) {\n const s = se(n, r);\n if (s === \"inline-adjacent\") {\n o = o.map((a) => a === r ? ae(n, r) : a), i = !0;\n break;\n } else if (s === \"inline-contains\") {\n o = o.map((a) => a === r ? n : a), i = !0;\n break;\n } else if (s === \"inline-is-contained\") {\n i = !0;\n break;\n } else if (s === \"block-contains\" || s === \"block-is-contained\") {\n n.width < r.width && (o = o.map((a) => a === r ? n : a)), i = !0;\n break;\n }\n }\n return i ? o : [...o, n];\n}, []), le = (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 r = gt(o).textContent, s = t.toString(), a = r.length || 0, u = a + s.length;\n return n ? { quote: s, start: a, end: u, range: t, offsetReference: i } : { quote: s, start: a, end: u, range: t };\n}, Dt = (t, e) => {\n var m, l;\n const { start: n, end: o } = t, i = t.offsetReference || e, r = document.createNodeIterator(\n e,\n NodeFilter.SHOW_TEXT,\n (g) => {\n var p;\n return (p = g.parentElement) != null && p.closest(D) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;\n }\n );\n let s = 0;\n const a = document.createRange();\n let u = r.nextNode();\n u === null && console.error(\"Could not revive annotation target. Content missing.\");\n let h = !i;\n for (; u !== null; ) {\n if (h || (h = i == null ? void 0 : i.contains(u)), h) {\n const g = ((m = u.textContent) == null ? void 0 : m.length) || 0;\n if (s + g > n) {\n a.setStart(u, n - s);\n break;\n }\n s += g;\n }\n u = r.nextNode();\n }\n for (; u !== null; ) {\n const g = ((l = u.textContent) == null ? void 0 : l.length) || 0;\n if (s + g >= o) {\n a.setEnd(u, o - s);\n break;\n }\n s += g, u = r.nextNode();\n }\n return {\n ...t,\n range: a\n };\n}, it = (t, e) => $(t.selector) ? t : {\n ...t,\n selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : Dt(n, e))\n}, rt = (t, e) => $(t.target.selector) ? t : { ...t, target: it(t.target, e) }, de = (t) => {\n const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, s = -e, a = o - n, u = i - e;\n return { top: e, left: n, minX: r, minY: s, maxX: a, maxY: u };\n}, ue = (t) => {\n let e = /* @__PURE__ */ new Set();\n return (o) => {\n const i = o.map((r) => r.id);\n (e.size !== i.length || i.some((r) => !e.has(r))) && t.set(i), e = new Set(i);\n };\n}, vt = (t, e, n, o) => {\n const { store: i, selection: r, hover: s } = e;\n let a, u, h;\n const m = ue(n), l = (B) => {\n const { x: M, y: b } = t.getBoundingClientRect(), x = i.getAt(B.clientX - M, B.clientY - b, u);\n x ? s.current !== x.id && (t.classList.add(\"hovered\"), s.set(x.id)) : s.current && (t.classList.remove(\"hovered\"), s.set(null));\n };\n t.addEventListener(\"pointermove\", l);\n const g = (B = !1) => {\n h && h.clear();\n const M = de(t), { minX: b, minY: x, maxX: A, maxY: C } = M, R = u ? i.getIntersecting(b, x, A, C).filter(({ annotation: _ }) => u(_)) : i.getIntersecting(b, x, A, C), O = r.selected.map(({ id: _ }) => _), H = R.map(({ annotation: _, rects: qt }) => {\n const jt = O.includes(_.id), Gt = _.id === s.current;\n return { annotation: _, rects: qt, state: { selected: jt, hover: Gt } };\n });\n o.redraw(H, M, a, h, B), setTimeout(() => m(R.map(({ annotation: _ }) => _)), 1);\n }, p = (B) => {\n h = B, g();\n }, w = (B) => {\n a = B, g();\n }, y = (B) => {\n u = B, g(!1);\n }, f = () => g();\n i.observe(f);\n const d = r.subscribe(() => g()), c = () => g(!0);\n document.addEventListener(\"scroll\", c, { capture: !0, passive: !0 });\n const v = bt(() => {\n i.recalculatePositions(), h && h.reset(), g();\n });\n window.addEventListener(\"resize\", v);\n const S = new ResizeObserver(v);\n S.observe(t);\n const L = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((B) => {\n B.every((b) => b.target === t || t.contains(b.target)) || g(!0);\n });\n return E.observe(document.body, L), {\n destroy: () => {\n t.removeEventListener(\"pointermove\", l), o.destroy(), i.unobserve(f), d(), document.removeEventListener(\"scroll\", c), window.removeEventListener(\"resize\", v), S.disconnect(), E.disconnect();\n },\n redraw: g,\n setStyle: w,\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}, fe = (t, e) => {\n t.width = window.innerWidth, t.height = window.innerHeight;\n}, pe = (t) => {\n t.classList.add(\"r6o-annotatable\");\n const e = he(), n = e.getContext(\"2d\");\n document.body.appendChild(e);\n const o = (a, u, h, m) => requestAnimationFrame(() => {\n const { width: l, height: g } = e;\n n.clearRect(-0.5, -0.5, l + 1, g + 1), m && m.clear();\n const { top: p, left: w } = u;\n [...a].sort((f, d) => {\n const { annotation: { target: { created: c } } } = f, { annotation: { target: { created: v } } } = d;\n return c.getTime() - v.getTime();\n }).forEach((f) => {\n var S;\n const d = h ? typeof h == \"function\" ? h(f.annotation, f.state) : h : (S = f.state) != null && S.selected ? ot : P, c = m && m.paint(f, u) || d, v = f.rects.map(({ x: L, y: E, width: T, height: B }) => ({\n x: L + w,\n y: E + p,\n width: T,\n height: B\n }));\n if (n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1, v.forEach(\n ({ x: L, y: E, width: T, height: B }) => n.fillRect(L, E, T, B)\n ), c.underlineColor) {\n n.globalAlpha = 1, n.strokeStyle = c.underlineColor, n.lineWidth = c.underlineThickness ?? 1;\n const L = c.underlineOffset ?? 0;\n v.forEach(({ x: E, y: T, width: B, height: M }) => {\n n.beginPath(), n.moveTo(E, T + M + L), n.lineTo(E + B, T + M + L), n.stroke();\n });\n }\n });\n }), i = bt(() => {\n fe(e);\n });\n return window.addEventListener(\"resize\", i), {\n destroy: () => {\n e.remove(), window.removeEventListener(\"resize\", i);\n },\n setVisible: (a) => {\n console.log(\"setVisible not implemented on Canvas renderer\");\n },\n redraw: o\n };\n}, ge = (t, e, n) => vt(t, e, n, pe(t));\nvar me = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {\n return typeof t == \"string\" ? t.length > 0 : typeof t == \"number\";\n}, I = 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}, k = function(t, e, n) {\n return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;\n}, _t = function(t) {\n return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;\n}, At = function(t) {\n return { r: k(t.r, 0, 255), g: k(t.g, 0, 255), b: k(t.b, 0, 255), a: k(t.a) };\n}, st = function(t) {\n return { r: I(t.r), g: I(t.g), b: I(t.b), a: I(t.a, 3) };\n}, be = /^#([0-9a-f]{3,8})$/i, J = function(t) {\n var e = t.toString(16);\n return e.length < 2 ? \"0\" + e : e;\n}, Xt = function(t) {\n var e = t.r, n = t.g, o = t.b, i = t.a, r = Math.max(e, n, o), s = r - Math.min(e, n, o), a = s ? r === e ? (n - o) / s : r === n ? 2 + (o - e) / s : 4 + (e - n) / s : 0;\n return { h: 60 * (a < 0 ? a + 6 : a), s: r ? s / r * 100 : 0, v: r / 255 * 100, a: i };\n}, $t = 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 r = Math.floor(e), s = o * (1 - n), a = o * (1 - (e - r) * n), u = o * (1 - (1 - e + r) * n), h = r % 6;\n return { r: 255 * [o, a, s, s, u, o][h], g: 255 * [u, o, o, a, s, s][h], b: 255 * [s, s, u, o, o, a][h], a: i };\n}, Et = function(t) {\n return { h: _t(t.h), s: k(t.s, 0, 100), l: k(t.l, 0, 100), a: k(t.a) };\n}, St = function(t) {\n return { h: I(t.h), s: I(t.s), l: I(t.l), a: I(t.a, 3) };\n}, Ct = function(t) {\n return $t((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}, Q = function(t) {\n return { h: (e = Xt(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}, ve = /^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*,\\s*([+-]?\\d*\\.?\\d+)%\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, ye = /^hsla?\\(\\s*([+-]?\\d*\\.?\\d+)(deg|rad|grad|turn)?\\s+([+-]?\\d*\\.?\\d+)%\\s+([+-]?\\d*\\.?\\d+)%\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, we = /^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*(?:,\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, xe = /^rgba?\\(\\s*([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s+([+-]?\\d*\\.?\\d+)(%)?\\s*(?:\\/\\s*([+-]?\\d*\\.?\\d+)(%)?\\s*)?\\)$/i, Lt = { string: [[function(t) {\n var e = be.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 ? I(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 ? I(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;\n}, \"hex\"], [function(t) {\n var e = we.exec(t) || xe.exec(t);\n return e ? e[2] !== e[4] || e[4] !== e[6] ? null : At({ 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 = ve.exec(t) || ye.exec(t);\n if (!e) return null;\n var n, o, i = Et({ h: (n = e[1], o = e[2], o === void 0 && (o = \"deg\"), Number(n) * (me[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 Ct(i);\n}, \"hsl\"]], object: [[function(t) {\n var e = t.r, n = t.g, o = t.b, i = t.a, r = i === void 0 ? 1 : i;\n return X(e) && X(n) && X(o) ? At({ r: Number(e), g: Number(n), b: Number(o), a: Number(r) }) : null;\n}, \"rgb\"], [function(t) {\n var e = t.h, n = t.s, o = t.l, i = t.a, r = i === void 0 ? 1 : i;\n if (!X(e) || !X(n) || !X(o)) return null;\n var s = Et({ h: Number(e), s: Number(n), l: Number(o), a: Number(r) });\n return Ct(s);\n}, \"hsl\"], [function(t) {\n var e = t.h, n = t.s, o = t.v, i = t.a, r = i === void 0 ? 1 : i;\n if (!X(e) || !X(n) || !X(o)) return null;\n var s = function(a) {\n return { h: _t(a.h), s: k(a.s, 0, 100), v: k(a.v, 0, 100), a: k(a.a) };\n }({ h: Number(e), s: Number(n), v: Number(o), a: Number(r) });\n return $t(s);\n}, \"hsv\"]] }, Bt = 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}, Ae = function(t) {\n return typeof t == \"string\" ? Bt(t.trim(), Lt.string) : typeof t == \"object\" && t !== null ? Bt(t, Lt.object) : [null, void 0];\n}, at = function(t, e) {\n var n = Q(t);\n return { h: n.h, s: k(n.s + 100 * e, 0, 100), l: n.l, a: n.a };\n}, ct = function(t) {\n return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;\n}, Tt = function(t, e) {\n var n = Q(t);\n return { h: n.h, s: n.s, l: k(n.l + 100 * e, 0, 100), a: n.a };\n}, Rt = function() {\n function t(e) {\n this.parsed = Ae(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 I(ct(this.rgba), 2);\n }, t.prototype.isDark = function() {\n return ct(this.rgba) < 0.5;\n }, t.prototype.isLight = function() {\n return ct(this.rgba) >= 0.5;\n }, t.prototype.toHex = function() {\n return e = st(this.rgba), n = e.r, o = e.g, i = e.b, s = (r = e.a) < 1 ? J(I(255 * r)) : \"\", \"#\" + J(n) + J(o) + J(i) + s;\n var e, n, o, i, r, s;\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, (r = e.a) < 1 ? \"rgba(\" + n + \", \" + o + \", \" + i + \", \" + r + \")\" : \"rgb(\" + n + \", \" + o + \", \" + i + \")\";\n var e, n, o, i, r;\n }, t.prototype.toHsl = function() {\n return St(Q(this.rgba));\n }, t.prototype.toHslString = function() {\n return e = St(Q(this.rgba)), n = e.h, o = e.s, i = e.l, (r = e.a) < 1 ? \"hsla(\" + n + \", \" + o + \"%, \" + i + \"%, \" + r + \")\" : \"hsl(\" + n + \", \" + o + \"%, \" + i + \"%)\";\n var e, n, o, i, r;\n }, t.prototype.toHsv = function() {\n return e = Xt(this.rgba), { h: I(e.h), s: I(e.s), v: I(e.v), a: I(e.a, 3) };\n var e;\n }, t.prototype.invert = function() {\n return Y({ 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), Y(at(this.rgba, e));\n }, t.prototype.desaturate = function(e) {\n return e === void 0 && (e = 0.1), Y(at(this.rgba, -e));\n }, t.prototype.grayscale = function() {\n return Y(at(this.rgba, -1));\n }, t.prototype.lighten = function(e) {\n return e === void 0 && (e = 0.1), Y(Tt(this.rgba, e));\n }, t.prototype.darken = function(e) {\n return e === void 0 && (e = 0.1), Y(Tt(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\" ? Y({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : I(this.rgba.a, 3);\n var n;\n }, t.prototype.hue = function(e) {\n var n = Q(this.rgba);\n return typeof e == \"number\" ? Y({ h: e, s: n.s, l: n.l, a: n.a }) : I(n.h);\n }, t.prototype.isEqual = function(e) {\n return this.toHex() === Y(e).toHex();\n }, t;\n}(), Y = function(t) {\n return t instanceof Rt ? t : new Rt(t);\n};\nconst Ee = (t) => [\n `background-color:${Y((t == null ? void 0 : t.fill) || P.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? P.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(\";\"), Se = () => {\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: (r) => {\n console.log(\"setVisible not implemented on CSS Custom Highlights renderer\");\n },\n redraw: (r, s, a, u) => {\n u && u.clear();\n const h = new Set(r.map((l) => l.annotation.id));\n Array.from(e).filter((l) => !h.has(l));\n const m = r.map((l) => {\n var w;\n const g = a ? typeof a == \"function\" ? a(l.annotation, l.state) : a : (w = l.state) != null && w.selected ? ot : P, p = u && u.paint(l, s) || g;\n return `::highlight(_${l.annotation.id}) { ${Ee(p)} }`;\n });\n t.innerHTML = m.join(`\n`), CSS.highlights.clear(), r.forEach(({ annotation: l }) => {\n const g = l.target.selector.map((w) => w.range), p = new Highlight(...g);\n CSS.highlights.set(`_${l.id}`, p);\n }), e = h;\n }\n };\n}, Ce = (t, e, n) => vt(t, e, n, Se());\nvar Nt = Object.prototype.hasOwnProperty;\nfunction mt(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-- && mt(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 (Nt.call(t, n) && ++o && !Nt.call(e, n) || !(n in e) || !mt(t[n], e[n])) return !1;\n return Object.keys(e).length === o;\n }\n }\n return t !== t && e !== e;\n}\nconst Le = (t, e) => {\n const n = (r, s) => r.x <= s.x + s.width && r.x + r.width >= s.x && r.y <= s.y + s.height && r.y + r.height >= s.y, o = (r) => r.rects.reduce((s, a) => s + a.width, 0), i = e.filter(({ rects: r }) => r.some((s) => n(t, s)));\n return i.sort((r, s) => o(s) - o(r)), i.findIndex((r) => r.rects.includes(t));\n}, Be = (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: (s, a, u, h, m) => {\n const g = !(mt(n, s) && m);\n !h && !g || (g && (e.innerHTML = \"\"), s.forEach((p) => {\n p.rects.map((w) => {\n const y = Le(w, s), f = Kt(p, a, u, h, y);\n if (g) {\n const d = document.createElement(\"span\");\n d.className = \"r6o-annotation\", d.dataset.annotation = p.annotation.id, d.style.left = `${w.x}px`, d.style.top = `${w.y}px`, d.style.width = `${w.width}px`, d.style.height = `${w.height}px`, d.style.backgroundColor = Y((f == null ? void 0 : f.fill) || P.fill).alpha((f == null ? void 0 : f.fillOpacity) === void 0 ? P.fillOpacity : f.fillOpacity).toHex(), f.underlineStyle && (d.style.borderStyle = f.underlineStyle), f.underlineColor && (d.style.borderColor = f.underlineColor), f.underlineThickness && (d.style.borderBottomWidth = `${f.underlineThickness}px`), f.underlineOffset && (d.style.paddingBottom = `${f.underlineOffset}px`), e.appendChild(d);\n }\n });\n }), n = s);\n },\n setVisible: (s) => {\n s ? e.classList.remove(\"hidden\") : e.classList.add(\"hidden\");\n }\n };\n}, Te = (t, e, n) => vt(t, e, n, Be(t));\nvar V = [];\nfor (var lt = 0; lt < 256; ++lt)\n V.push((lt + 256).toString(16).slice(1));\nfunction Re(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 Z, Ne = new Uint8Array(16);\nfunction Me() {\n if (!Z && (Z = typeof crypto < \"u\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))\n throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return Z(Ne);\n}\nvar Oe = typeof crypto < \"u\" && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nconst Mt = {\n randomUUID: Oe\n};\nfunction Ht(t, e, n) {\n if (Mt.randomUUID && !e && !t)\n return Mt.randomUUID();\n t = t || {};\n var o = t.random || (t.rng || Me)();\n return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Re(o);\n}\nvar Ot = Object.prototype.hasOwnProperty;\nfunction q(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-- && q(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 (Ot.call(t, n) && ++o && !Ot.call(e, n) || !(n in e) || !q(t[n], e[n])) return !1;\n return Object.keys(e).length === o;\n }\n }\n return t !== t && e !== e;\n}\nfunction dt() {\n}\nfunction Ie(t, e) {\n return t != t ? e == e : t !== e || t && typeof t == \"object\" || typeof t == \"function\";\n}\nconst F = [];\nfunction yt(t, e = dt) {\n let n;\n const o = /* @__PURE__ */ new Set();\n function i(a) {\n if (Ie(t, a) && (t = a, n)) {\n const u = !F.length;\n for (const h of o)\n h[1](), F.push(h, t);\n if (u) {\n for (let h = 0; h < F.length; h += 2)\n F[h][0](F[h + 1]);\n F.length = 0;\n }\n }\n }\n function r(a) {\n i(a(t));\n }\n function s(a, u = dt) {\n const h = [a, u];\n return o.add(h), o.size === 1 && (n = e(i, r) || dt), a(t), () => {\n o.delete(h), o.size === 0 && n && (n(), n = null);\n };\n }\n return { set: i, update: r, subscribe: s };\n}\nconst Ve = (t) => {\n const { subscribe: e, set: n } = yt();\n let o;\n return e((i) => o = i), t.observe(({ changes: i }) => {\n if (o) {\n (i.deleted || []).some((s) => s.id === o) && n(void 0);\n const r = (i.updated || []).find(({ oldValue: s }) => s.id === o);\n r && n(r.newValue.id);\n }\n }), {\n get current() {\n return o;\n },\n subscribe: e,\n set: n\n };\n};\nvar Ue = /* @__PURE__ */ ((t) => (t.EDIT = \"EDIT\", t.SELECT = \"SELECT\", t.NONE = \"NONE\", t))(Ue || {});\nconst ut = { selected: [] }, ke = (t, e = \"EDIT\") => {\n const { subscribe: n, set: o } = yt(ut);\n let i = ut;\n n((l) => i = l);\n const r = () => o(ut), s = () => {\n var l;\n return ((l = i.selected) == null ? void 0 : l.length) === 0;\n }, a = (l) => {\n if (i.selected.length === 0)\n return !1;\n const g = typeof l == \"string\" ? l : l.id;\n return i.selected.some((p) => p.id === g);\n }, u = (l, g) => {\n const p = t.getAnnotation(l);\n if (p) {\n const w = It(p, e);\n o(w === \"EDIT\" ? { selected: [{ id: l, editable: !0 }], pointerEvent: g } : w === \"SELECT\" ? { selected: [{ id: l }], pointerEvent: g } : { selected: [], pointerEvent: g });\n } else\n console.warn(\"Invalid selection: \" + l);\n }, h = (l, g) => {\n const p = Array.isArray(l) ? l : [l], w = p.map((y) => t.getAnnotation(y)).filter(Boolean);\n o({\n selected: w.map((y) => {\n const f = g === void 0 ? It(y, e) === \"EDIT\" : g;\n return { id: y.id, editable: f };\n })\n }), w.length !== p.length && console.warn(\"Invalid selection\", l);\n }, m = (l) => {\n if (i.selected.length === 0)\n return !1;\n const { selected: g } = i;\n g.filter(({ id: p }) => l.includes(p)).length > 0 && o({ selected: g.filter(({ id: p }) => !l.includes(p)) });\n };\n return t.observe(({ changes: l }) => m((l.deleted || []).map((g) => g.id))), {\n clear: r,\n clickSelect: u,\n get selected() {\n return i ? [...i.selected] : null;\n },\n get pointerEvent() {\n return i ? i.pointerEvent : null;\n },\n isEmpty: s,\n isSelected: a,\n setSelected: h,\n subscribe: n\n };\n}, It = (t, e) => typeof e == \"function\" ? e(t) || \"EDIT\" : e || \"EDIT\";\nvar U = [];\nfor (var ht = 0; ht < 256; ++ht)\n U.push((ht + 256).toString(16).slice(1));\nfunction Ye(t, e = 0) {\n return (U[t[e + 0]] + U[t[e + 1]] + U[t[e + 2]] + U[t[e + 3]] + \"-\" + U[t[e + 4]] + U[t[e + 5]] + \"-\" + U[t[e + 6]] + U[t[e + 7]] + \"-\" + U[t[e + 8]] + U[t[e + 9]] + \"-\" + U[t[e + 10]] + U[t[e + 11]] + U[t[e + 12]] + U[t[e + 13]] + U[t[e + 14]] + U[t[e + 15]]).toLowerCase();\n}\nvar tt, De = new Uint8Array(16);\nfunction _e() {\n if (!tt && (tt = typeof crypto < \"u\" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !tt))\n throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");\n return tt(De);\n}\nvar Xe = typeof crypto < \"u\" && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nconst Vt = {\n randomUUID: Xe\n};\nfunction $e(t, e, n) {\n if (Vt.randomUUID && !e && !t)\n return Vt.randomUUID();\n t = t || {};\n var o = t.random || (t.rng || _e)();\n return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Ye(o);\n}\nconst Vn = (t, e, n, o) => ({\n id: $e(),\n annotation: t.id,\n created: n || /* @__PURE__ */ new Date(),\n creator: o,\n ...e\n}), He = (t, e) => {\n const n = new Set(t.bodies.map((o) => o.id));\n return e.bodies.filter((o) => !n.has(o.id));\n}, Pe = (t, e) => {\n const n = new Set(e.bodies.map((o) => o.id));\n return t.bodies.filter((o) => !n.has(o.id));\n}, Fe = (t, e) => e.bodies.map((n) => {\n const o = t.bodies.find((i) => i.id === n.id);\n return { newBody: n, oldBody: o && !q(o, n) ? o : void 0 };\n}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), ze = (t, e) => !q(t.target, e.target), Pt = (t, e) => {\n const n = He(t, e), o = Pe(t, e), i = Fe(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: ze(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0\n };\n};\nvar N = /* @__PURE__ */ ((t) => (t.LOCAL = \"LOCAL\", t.REMOTE = \"REMOTE\", t))(N || {});\nconst We = (t, e) => {\n var n, o;\n const { changes: i, origin: r } = e;\n if (!(!t.options.origin || t.options.origin === r))\n return !1;\n if (t.options.ignore) {\n const { ignore: s } = t.options, a = (u) => u && u.length > 0;\n if (!(a(i.created) || a(i.deleted))) {\n const u = (n = i.updated) == null ? void 0 : n.some((m) => a(m.bodiesCreated) || a(m.bodiesDeleted) || a(m.bodiesUpdated)), h = (o = i.updated) == null ? void 0 : o.some((m) => m.targetUpdated);\n if (s === \"BODY_ONLY\" && u && !h || s === \"TARGET_ONLY\" && h && !u)\n return !1;\n }\n }\n if (t.options.annotations) {\n const s = /* @__PURE__ */ new Set([\n ...(i.created || []).map((a) => a.id),\n ...(i.deleted || []).map((a) => a.id),\n ...(i.updated || []).map(({ oldValue: a }) => a.id)\n ]);\n return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((a) => s.has(a));\n } else\n return !0;\n}, qe = (t, e) => {\n const n = new Set((t.created || []).map((l) => l.id)), o = new Set((t.updated || []).map(({ newValue: l }) => l.id)), i = new Set((e.created || []).map((l) => l.id)), r = new Set((e.deleted || []).map((l) => l.id)), s = new Set((e.updated || []).map(({ oldValue: l }) => l.id)), a = new Set((e.updated || []).filter(({ oldValue: l }) => n.has(l.id) || o.has(l.id)).map(({ oldValue: l }) => l.id)), u = [\n ...(t.created || []).filter((l) => !r.has(l.id)).map((l) => s.has(l.id) ? e.updated.find(({ oldValue: g }) => g.id === l.id).newValue : l),\n ...e.created || []\n ], h = [\n ...(t.deleted || []).filter((l) => !i.has(l.id)),\n ...(e.deleted || []).filter((l) => !n.has(l.id))\n ], m = [\n ...(t.updated || []).filter(({ newValue: l }) => !r.has(l.id)).map((l) => {\n const { oldValue: g, newValue: p } = l;\n if (s.has(p.id)) {\n const w = e.updated.find((y) => y.oldValue.id === p.id).newValue;\n return Pt(g, w);\n } else\n return l;\n }),\n ...(e.updated || []).filter(({ oldValue: l }) => !a.has(l.id))\n ];\n return { created: u, deleted: h, updated: m };\n}, je = (t) => t.id !== void 0, Ge = () => {\n const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (b, x = {}) => n.push({ onChange: b, options: x }), i = (b) => {\n const x = n.findIndex((A) => A.onChange == b);\n x > -1 && n.splice(x, 1);\n }, r = (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 We(C, A) && C.onChange(A);\n });\n }, s = (b, x = N.LOCAL) => {\n if (t.get(b.id))\n throw Error(`Cannot add annotation ${b.id} - exists already`);\n t.set(b.id, b), b.bodies.forEach((A) => e.set(A.id, b.id)), r(x, { created: [b] });\n }, a = (b, x) => {\n const A = typeof b == \"string\" ? x : b, C = typeof b == \"string\" ? b : b.id, R = t.get(C);\n if (R) {\n const O = Pt(R, A);\n return C === A.id ? t.set(C, A) : (t.delete(C), t.set(A.id, A)), R.bodies.forEach((H) => e.delete(H.id)), A.bodies.forEach((H) => e.set(H.id, A.id)), O;\n } else\n console.warn(`Cannot update annotation ${C} - does not exist`);\n }, u = (b, x = N.LOCAL, A = N.LOCAL) => {\n const C = je(x) ? A : x, R = a(b, x);\n R && r(C, { updated: [R] });\n }, h = (b, x = N.LOCAL) => {\n const A = b.reduce((C, R) => {\n const O = a(R);\n return O ? [...C, O] : C;\n }, []);\n A.length > 0 && r(x, { updated: A });\n }, m = (b, x = N.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), r(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 }, l = () => [...t.values()], g = (b = N.LOCAL) => {\n const x = [...t.values()];\n t.clear(), e.clear(), r(b, { deleted: x });\n }, p = (b, x = !0, A = N.LOCAL) => {\n if (x) {\n const C = [...t.values()];\n t.clear(), e.clear(), b.forEach((R) => {\n t.set(R.id, R), R.bodies.forEach((O) => e.set(O.id, R.id));\n }), r(A, { created: b, deleted: C });\n } else {\n const C = b.reduce((R, O) => {\n const H = t.get(O.id);\n return H ? [...R, H] : R;\n }, []);\n if (C.length > 0)\n throw Error(`Bulk insert would overwrite the following annotations: ${C.map((R) => R.id).join(\", \")}`);\n b.forEach((R) => {\n t.set(R.id, R), R.bodies.forEach((O) => e.set(O.id, R.id));\n }), r(A, { created: b });\n }\n }, w = (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 = N.LOCAL) => {\n const A = w(b);\n A && r(x, { deleted: [A] });\n }, f = (b, x = N.LOCAL) => {\n const A = b.reduce((C, R) => {\n const O = w(R);\n return O ? [...C, O] : C;\n }, []);\n A.length > 0 && r(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((R) => R.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 = N.LOCAL) => {\n const A = d(b);\n A && r(x, { updated: [A] });\n }, v = (b, x = N.LOCAL) => {\n const A = b.map((C) => d(C)).filter(Boolean);\n A.length > 0 && r(x, { updated: A });\n }, S = (b) => {\n const x = t.get(b);\n return x ? { ...x } : void 0;\n }, L = (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 }, E = (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((O) => O.id === b.id), R = {\n ...A,\n bodies: A.bodies.map((O) => O.id === C.id ? x : O)\n };\n return t.set(A.id, R), C.id !== x.id && (e.delete(C.id), e.set(x.id, R.id)), {\n oldValue: A,\n newValue: R,\n bodiesUpdated: [{ oldBody: C, newBody: x }]\n };\n } else\n console.warn(`Attempt to add body to missing annotation ${b.annotation}`);\n }, T = (b, x, A = N.LOCAL) => {\n const C = E(b, x);\n C && r(A, { updated: [C] });\n }, B = (b, x = N.LOCAL) => {\n const A = b.map((C) => E({ id: C.id, annotation: C.annotation }, C)).filter(Boolean);\n r(x, { updated: A });\n }, M = (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: s,\n addBody: m,\n all: l,\n bulkAddAnnotation: p,\n bulkDeleteAnnotation: f,\n bulkDeleteBodies: v,\n bulkUpdateAnnotation: h,\n bulkUpdateBodies: B,\n bulkUpdateTargets: (b, x = N.LOCAL) => {\n const A = b.map((C) => M(C)).filter(Boolean);\n A.length > 0 && r(x, { updated: A });\n },\n clear: g,\n deleteAnnotation: y,\n deleteBody: c,\n getAnnotation: S,\n getBody: L,\n observe: o,\n unobserve: i,\n updateAnnotation: u,\n updateBody: T,\n updateTarget: (b, x = N.LOCAL) => {\n const A = M(b);\n A && r(x, { updated: [A] });\n }\n };\n};\nlet Ke = () => ({\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 Qe = 250, Je = (t) => {\n const e = Ke(), n = [];\n let o = -1, i = !1, r = 0;\n const s = (p) => {\n if (!i) {\n const { changes: w } = p, y = performance.now();\n if (y - r > Qe)\n n.splice(o + 1), n.push(w), o = n.length - 1;\n else {\n const f = n.length - 1;\n n[f] = qe(n[f], w);\n }\n r = y;\n }\n i = !1;\n };\n t.observe(s, { origin: N.LOCAL });\n const a = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), u = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), h = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: w }) => w)), m = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: w }) => w)), l = (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(s),\n on: (p, w) => e.on(p, w),\n redo: () => {\n if (n.length - 1 > o) {\n i = !0;\n const { created: p, updated: w, deleted: y } = n[o + 1];\n u(p), m(w), 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: w, deleted: y } = n[o];\n a(p), h(w), l(y), e.emit(\"undo\", n[o]), o -= 1;\n }\n }\n };\n}, Ze = () => {\n const { subscribe: t, set: e } = yt([]);\n return {\n subscribe: t,\n set: e\n };\n}, tn = (t, e, n, o) => {\n const { store: i, selection: r, hover: s, viewport: a } = t, u = /* @__PURE__ */ new Map();\n let h = [], m;\n const l = (y, f) => {\n u.has(y) ? u.get(y).push(f) : u.set(y, [f]);\n }, g = (y, f) => {\n const d = u.get(y);\n if (d) {\n const c = d.indexOf(f);\n c !== -1 && d.splice(c, 1);\n }\n }, p = (y, f, d) => {\n u.has(y) && setTimeout(() => {\n u.get(y).forEach((c) => {\n if (n) {\n const v = Array.isArray(f) ? f.map((L) => n.serialize(L)) : n.serialize(f), S = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;\n c(v, S);\n } else\n c(f, d);\n });\n }, 1);\n };\n r.subscribe(({ selected: y }) => {\n if (!(h.length === 0 && y.length === 0)) {\n if (h.length === 0 && y.length > 0)\n h = y.map(({ id: f }) => i.getAnnotation(f));\n else if (h.length > 0 && y.length === 0)\n h.forEach((f) => {\n const d = i.getAnnotation(f.id);\n d && !q(d, f) && p(\"updateAnnotation\", d, f);\n }), h = [];\n else {\n const f = new Set(h.map((c) => c.id)), d = new Set(y.map(({ id: c }) => c));\n h.filter((c) => !d.has(c.id)).forEach((c) => {\n const v = i.getAnnotation(c.id);\n v && !q(v, c) && p(\"updateAnnotation\", v, c);\n }), h = [\n // Remove annotations that were deselected\n ...h.filter((c) => d.has(c.id)),\n // Add editable annotations that were selected\n ...y.filter(({ id: c }) => !f.has(c)).map(({ id: c }) => i.getAnnotation(c))\n ];\n }\n p(\"selectionChanged\", h);\n }\n }), s.subscribe((y) => {\n !m && y ? p(\"mouseEnterAnnotation\", i.getAnnotation(y)) : m && !y ? p(\"mouseLeaveAnnotation\", i.getAnnotation(m)) : m && y && (p(\"mouseLeaveAnnotation\", i.getAnnotation(m)), p(\"mouseEnterAnnotation\", i.getAnnotation(y))), m = y;\n }), a == null || a.subscribe((y) => p(\"viewportIntersect\", y.map((f) => i.getAnnotation(f)))), i.observe((y) => {\n const { created: f, deleted: d } = y.changes;\n (f || []).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: v }) => {\n const S = h.find((L) => L.id === c.id) || c;\n h = h.map((L) => L.id === c.id ? v : L), p(\"updateAnnotation\", v, S);\n });\n }, { origin: N.LOCAL }), i.observe((y) => {\n if (h) {\n const f = new Set(h.map((c) => c.id)), d = (y.changes.updated || []).filter(({ newValue: c }) => f.has(c.id)).map(({ newValue: c }) => c);\n d.length > 0 && (h = h.map((c) => d.find((S) => S.id === c.id) || c));\n }\n }, { origin: N.REMOTE });\n const w = (y) => (f) => {\n const { updated: d } = f;\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\", w(!0)), e.on(\"redo\", w(!1)), { on: l, off: g, emit: p };\n}, en = (t) => (e) => e.reduce((n, o) => {\n const { parsed: i, error: r } = t.parse(o);\n return r ? {\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: [] }), nn = (t, e, n) => {\n const { store: o, selection: i } = t, r = (f) => {\n if (n) {\n const { parsed: d, error: c } = n.parse(f);\n d ? o.addAnnotation(d, N.REMOTE) : console.error(c);\n } else\n o.addAnnotation(f, N.REMOTE);\n }, s = () => i.clear(), a = () => o.clear(), u = (f) => {\n const d = o.getAnnotation(f);\n return n && d ? n.serialize(d) : d;\n }, h = () => n ? o.all().map(n.serialize) : o.all(), m = () => {\n var f;\n const d = (((f = i.selected) == null ? void 0 : f.map((c) => c.id)) || []).map((c) => o.getAnnotation(c)).filter(Boolean);\n return n ? d.map(n.serialize) : d;\n }, l = (f, d = !0) => fetch(f).then((c) => c.json()).then((c) => (p(c, d), c)), g = (f) => {\n if (typeof f == \"string\") {\n const d = o.getAnnotation(f);\n if (o.deleteAnnotation(f), d)\n return n ? n.serialize(d) : d;\n } else {\n const d = n ? n.parse(f).parsed : f;\n if (d)\n return o.deleteAnnotation(d), f;\n }\n }, p = (f, d = !0) => {\n if (n) {\n const { parsed: c, failed: v } = en(n)(f);\n v.length > 0 && console.warn(`Discarded ${v.length} invalid annotations`, v), o.bulkAddAnnotation(c, d, N.REMOTE);\n } else\n o.bulkAddAnnotation(f, d, N.REMOTE);\n }, w = (f, d) => {\n f ? i.setSelected(f, d) : i.clear();\n }, y = (f) => {\n if (n) {\n const d = n.parse(f).parsed, c = n.serialize(o.getAnnotation(d.id));\n return o.updateAnnotation(d), c;\n } else {\n const d = o.getAnnotation(f.id);\n return o.updateAnnotation(f), d;\n }\n };\n return {\n addAnnotation: r,\n cancelSelected: s,\n canRedo: e.canRedo,\n canUndo: e.canUndo,\n clearAnnotations: a,\n getAnnotationById: u,\n getAnnotations: h,\n getSelected: m,\n loadAnnotations: l,\n redo: e.redo,\n removeAnnotation: g,\n setAnnotations: p,\n setSelected: w,\n undo: e.undo,\n updateAnnotation: y\n };\n}, on = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nlet rn = (t) => crypto.getRandomValues(new Uint8Array(t)), sn = (t, e, n) => {\n let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * e / t.length);\n return (r = e) => {\n let s = \"\";\n for (; ; ) {\n let a = n(i), u = i;\n for (; u--; )\n if (s += t[a[u] & o] || \"\", s.length === r) return s;\n }\n };\n}, an = (t, e = 21) => sn(t, e, rn), cn = (t = 21) => {\n let e = \"\", n = crypto.getRandomValues(new Uint8Array(t));\n for (; t--; )\n e += on[n[t] & 63];\n return e;\n};\nconst ln = () => ({ isGuest: !0, id: an(\"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_\", 20)() }), dn = (t) => {\n const e = JSON.stringify(t);\n let n = 0;\n for (let o = 0, i = e.length; o < i; o++) {\n let r = e.charCodeAt(o);\n n = (n << 5) - n + r, n |= 0;\n }\n return `${n}`;\n}, Ft = (t) => t ? typeof t == \"object\" ? { ...t } : t : void 0, un = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {\n const { id: o, type: i, purpose: r, value: s, created: a, modified: u, creator: h, ...m } = n;\n return {\n id: o || `temp-${dn(n)}`,\n annotation: e,\n type: i,\n purpose: r,\n value: s,\n creator: Ft(h),\n created: a ? new Date(a) : void 0,\n updated: u ? new Date(u) : void 0,\n ...m\n };\n}), hn = (t) => t.map((e) => {\n var n;\n const { annotation: o, created: i, updated: r, ...s } = e, a = {\n ...s,\n created: i == null ? void 0 : i.toISOString(),\n modified: r == null ? void 0 : r.toISOString()\n };\n return (n = a.id) != null && n.startsWith(\"temp-\") && delete a.id, a;\n});\ncn();\nconst Un = (t, e) => ({\n parse: (n) => gn(n),\n serialize: (n) => mn(n, t, e)\n}), fn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, pn = (t) => {\n const {\n id: e,\n creator: n,\n created: o,\n modified: i,\n target: r\n } = t, s = Array.isArray(r) ? r : [r], a = {\n creator: Ft(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 u of s) {\n const m = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((l, g) => {\n switch (g.type) {\n case \"TextQuoteSelector\":\n l.quote = g.exact;\n break;\n case \"TextPositionSelector\":\n l.start = g.start, l.end = g.end;\n break;\n }\n return l;\n }, {});\n if (fn(m))\n a.selector.push({ id: u.id, ...m });\n else {\n const l = [\n m.start ? void 0 : \"TextPositionSelector\",\n m.quote ? void 0 : \"TextQuoteSelector\"\n ].filter(Boolean);\n return { error: Error(`Missing selector types: ${l.join(\" and \")} for annotation: ${t.id}`) };\n }\n }\n return { parsed: a };\n}, gn = (t) => {\n const e = t.id || Ht(), {\n creator: n,\n created: o,\n modified: i,\n body: r,\n ...s\n } = t, a = un(r, e), u = pn(t);\n return \"error\" in u ? { error: u.error } : {\n parsed: {\n ...s,\n id: e,\n bodies: a,\n target: u.parsed\n }\n };\n}, mn = (t, e, n) => {\n const { bodies: o, target: i, ...r } = t, {\n selector: s,\n creator: a,\n created: u,\n updated: h,\n ...m\n } = i, l = s.map((g) => {\n const { quote: p, start: w, end: y, range: f } = g, { prefix: d, suffix: c } = oe(f, n), v = [{\n type: \"TextQuoteSelector\",\n exact: p,\n prefix: d,\n suffix: c\n }, {\n type: \"TextPositionSelector\",\n start: w,\n end: y\n }];\n return {\n ...m,\n id: g.id,\n source: e,\n selector: v\n };\n });\n return {\n ...r,\n \"@context\": \"http://www.w3.org/ns/anno.jsonld\",\n id: t.id,\n type: \"Annotation\",\n body: hn(t.bodies),\n creator: a,\n created: u == null ? void 0 : u.toISOString(),\n modified: h == null ? void 0 : h.toISOString(),\n target: l\n };\n};\nfunction bn(t, e, n, o, i) {\n zt(t, e, n || 0, o || t.length - 1, i || vn);\n}\nfunction zt(t, e, n, o, i) {\n for (; o > n; ) {\n if (o - n > 600) {\n var r = o - n + 1, s = e - n + 1, a = Math.log(r), u = 0.5 * Math.exp(2 * a / 3), h = 0.5 * Math.sqrt(a * u * (r - u) / r) * (s - r / 2 < 0 ? -1 : 1), m = Math.max(n, Math.floor(e - s * u / r + h)), l = Math.min(o, Math.floor(e + (r - s) * u / r + h));\n zt(t, e, m, l, i);\n }\n var g = t[e], p = n, w = o;\n for (j(t, n, e), i(t[o], g) > 0 && j(t, n, o); p < w; ) {\n for (j(t, p, w), p++, w--; i(t[p], g) < 0; ) p++;\n for (; i(t[w], g) > 0; ) w--;\n }\n i(t[n], g) === 0 ? j(t, n, w) : (w++, j(t, w, o)), w <= e && (n = w + 1), e <= w && (o = w - 1);\n }\n}\nfunction j(t, e, n) {\n var o = t[e];\n t[e] = t[n], t[n] = o;\n}\nfunction vn(t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n}\nclass yn {\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 (!nt(e, n)) return o;\n const i = this.toBBox, r = [];\n for (; n; ) {\n for (let s = 0; s < n.children.length; s++) {\n const a = n.children[s], u = n.leaf ? i(a) : a;\n nt(e, u) && (n.leaf ? o.push(a) : pt(e, u) ? this._all(a, o) : r.push(a));\n }\n n = r.pop();\n }\n return o;\n }\n collides(e) {\n let n = this.data;\n if (!nt(e, n)) return !1;\n const o = [];\n for (; n; ) {\n for (let i = 0; i < n.children.length; i++) {\n const r = n.children[i], s = n.leaf ? this.toBBox(r) : r;\n if (nt(e, s)) {\n if (n.leaf || pt(e, s)) return !0;\n o.push(r);\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 = W([]), this;\n }\n remove(e, n) {\n if (!e) return this;\n let o = this.data;\n const i = this.toBBox(e), r = [], s = [];\n let a, u, h;\n for (; o || r.length; ) {\n if (o || (o = r.pop(), u = r[r.length - 1], a = s.pop(), h = !0), o.leaf) {\n const m = wn(e, o.children, n);\n if (m !== -1)\n return o.children.splice(m, 1), r.push(o), this._condense(r), this;\n }\n !h && !o.leaf && pt(o, i) ? (r.push(o), s.push(a), a = 0, u = o, o = o.children[0]) : u ? (a++, o = u.children[a], h = !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 r = o - n + 1;\n let s = this._maxEntries, a;\n if (r <= s)\n return a = W(e.slice(n, o + 1)), z(a, this.toBBox), a;\n i || (i = Math.ceil(Math.log(r) / Math.log(s)), s = Math.ceil(r / Math.pow(s, i - 1))), a = W([]), a.leaf = !1, a.height = i;\n const u = Math.ceil(r / s), h = u * Math.ceil(Math.sqrt(s));\n Ut(e, n, o, h, this.compareMinX);\n for (let m = n; m <= o; m += h) {\n const l = Math.min(m + h - 1, o);\n Ut(e, m, l, u, this.compareMinY);\n for (let g = m; g <= l; g += u) {\n const p = Math.min(g + u - 1, l);\n a.children.push(this._build(e, g, p, i - 1));\n }\n }\n return z(a, this.toBBox), a;\n }\n _chooseSubtree(e, n, o, i) {\n for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {\n let r = 1 / 0, s = 1 / 0, a;\n for (let u = 0; u < n.children.length; u++) {\n const h = n.children[u], m = ft(h), l = En(e, h) - m;\n l < s ? (s = l, r = m < r ? m : r, a = h) : l === s && m < r && (r = m, a = h);\n }\n n = a || n.children[0];\n }\n return n;\n }\n _insert(e, n, o) {\n const i = o ? e : this.toBBox(e), r = [], s = this._chooseSubtree(i, this.data, n, r);\n for (s.children.push(e), K(s, i); n >= 0 && r[n].children.length > this._maxEntries; )\n this._split(r, n), n--;\n this._adjustParentBBoxes(i, r, n);\n }\n // split overflowed node into two\n _split(e, n) {\n const o = e[n], i = o.children.length, r = this._minEntries;\n this._chooseSplitAxis(o, r, i);\n const s = this._chooseSplitIndex(o, r, i), a = W(o.children.splice(s, o.children.length - s));\n a.height = o.height, a.leaf = o.leaf, z(o, this.toBBox), z(a, this.toBBox), n ? e[n - 1].children.push(a) : this._splitRoot(o, a);\n }\n _splitRoot(e, n) {\n this.data = W([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, z(this.data, this.toBBox);\n }\n _chooseSplitIndex(e, n, o) {\n let i, r = 1 / 0, s = 1 / 0;\n for (let a = n; a <= o - n; a++) {\n const u = G(e, 0, a, this.toBBox), h = G(e, a, o, this.toBBox), m = Sn(u, h), l = ft(u) + ft(h);\n m < r ? (r = m, i = a, s = l < s ? l : s) : m === r && l < s && (s = l, i = a);\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 : xn, r = e.leaf ? this.compareMinY : An, s = this._allDistMargin(e, n, o, i), a = this._allDistMargin(e, n, o, r);\n s < a && 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 r = this.toBBox, s = G(e, 0, n, r), a = G(e, o - n, o, r);\n let u = et(s) + et(a);\n for (let h = n; h < o - n; h++) {\n const m = e.children[h];\n K(s, e.leaf ? r(m) : m), u += et(s);\n }\n for (let h = o - n - 1; h >= n; h--) {\n const m = e.children[h];\n K(a, e.leaf ? r(m) : m), u += et(a);\n }\n return u;\n }\n _adjustParentBBoxes(e, n, o) {\n for (let i = o; i >= 0; i--)\n K(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() : z(e[n], this.toBBox);\n }\n}\nfunction wn(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 z(t, e) {\n G(t, 0, t.children.length, e, t);\n}\nfunction G(t, e, n, o, i) {\n i || (i = W(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;\n for (let r = e; r < n; r++) {\n const s = t.children[r];\n K(i, t.leaf ? o(s) : s);\n }\n return i;\n}\nfunction K(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 xn(t, e) {\n return t.minX - e.minX;\n}\nfunction An(t, e) {\n return t.minY - e.minY;\n}\nfunction ft(t) {\n return (t.maxX - t.minX) * (t.maxY - t.minY);\n}\nfunction et(t) {\n return t.maxX - t.minX + (t.maxY - t.minY);\n}\nfunction En(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 Sn(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), r = Math.min(t.maxY, e.maxY);\n return Math.max(0, i - n) * Math.max(0, r - o);\n}\nfunction pt(t, e) {\n return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;\n}\nfunction nt(t, e) {\n return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;\n}\nfunction W(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 Ut(t, e, n, o, i) {\n const r = [e, n];\n for (; r.length; ) {\n if (n = r.pop(), e = r.pop(), n - e <= o) continue;\n const s = e + Math.ceil((n - e) / o / 2) * o;\n bn(t, s, e, n, i), r.push(e, s, s, n);\n }\n}\nconst Cn = (t, e) => {\n const n = new yn(), o = /* @__PURE__ */ new Map(), i = (d, c) => {\n const v = d.selector.flatMap((L) => {\n const E = $([L]) ? L.range : Dt(L, e).range;\n return Array.from(E.getClientRects());\n }), S = ce(v).map(({ left: L, top: E, right: T, bottom: B }) => new DOMRect(L - c.left, E - c.top, T - L, B - E));\n return S.map((L) => {\n const { x: E, y: T, width: B, height: M } = L;\n return {\n minX: E,\n minY: T,\n maxX: E + B,\n maxY: T + M,\n annotation: {\n id: d.annotation,\n rects: S\n }\n };\n });\n }, r = () => [...o.values()], s = () => {\n n.clear(), o.clear();\n }, a = (d) => {\n const c = i(d, e.getBoundingClientRect());\n c.forEach((v) => n.insert(v)), o.set(d.annotation, c);\n }, u = (d) => {\n const c = o.get(d.annotation);\n c && (c.forEach((v) => n.remove(v)), o.delete(d.annotation));\n }, h = (d) => {\n u(d), a(d);\n }, m = (d, c = !0) => {\n c && s();\n const v = e.getBoundingClientRect(), S = d.map((E) => ({ target: E, rects: i(E, v) }));\n S.forEach(({ target: E, rects: T }) => o.set(E.annotation, T));\n const L = S.flatMap(({ rects: E }) => E);\n n.load(L);\n }, l = (d, c, v = !1) => {\n const S = n.search({\n minX: d,\n minY: c,\n maxX: d,\n maxY: c\n }), L = (E) => E.annotation.rects.reduce((T, B) => T + B.width * B.height, 0);\n return S.length > 0 ? (S.sort((E, T) => L(E) - L(T)), v ? S.map((E) => E.annotation.id) : [S[0].annotation.id]) : [];\n }, g = (d) => {\n const c = p(d);\n if (c.length === 0)\n return;\n let v = c[0].left, S = c[0].top, L = c[0].right, E = c[0].bottom;\n for (let T = 1; T < c.length; T++) {\n const B = c[T];\n v = Math.min(v, B.left), S = Math.min(S, B.top), L = Math.max(L, B.right), E = Math.max(E, B.bottom);\n }\n return new DOMRect(v, S, L - v, E - S);\n }, p = (d) => {\n const c = o.get(d);\n return c ? c[0].annotation.rects : [];\n };\n return {\n all: r,\n clear: s,\n getAt: l,\n getAnnotationBounds: g,\n getAnnotationRects: p,\n getIntersecting: (d, c, v, S) => {\n const L = n.search({ minX: d, minY: c, maxX: v, maxY: S }), E = new Set(L.map((T) => T.annotation.id));\n return Array.from(E).map((T) => ({\n annotation: t.getAnnotation(T),\n rects: p(T)\n })).filter((T) => !!T.annotation);\n },\n insert: a,\n recalculate: () => m(t.all().map((d) => d.target), !0),\n remove: u,\n set: m,\n size: () => n.all().length,\n update: h\n };\n}, Ln = (t, e) => {\n const n = Ge(), o = Cn(n, t), i = ke(n, e), r = Ve(n), s = Ze(), a = (y, f = N.LOCAL) => {\n const d = rt(y, t), c = $(d.target.selector);\n return c && n.addAnnotation(d, f), c;\n }, u = (y, f = !0, d = N.LOCAL) => {\n const c = y.map((S) => rt(S, t)), v = c.filter((S) => !$(S.target.selector));\n return v.length > 0 ? (console.warn(\"Could not revive all targets for these annotations:\", v), n.bulkAddAnnotation(c, f, d), v) : (n.bulkAddAnnotation(c, f, d), []);\n }, h = (y, f = N.LOCAL) => {\n const d = y.map((v) => rt(v, t)), c = d.filter((v) => !$(v.target.selector));\n return c.length > 0 && console.warn(\"Could not revive all targets for these annotations:\", c), d.forEach((v) => {\n n.getAnnotation(v.id) ? n.updateAnnotation(v, f) : n.addAnnotation(v, f);\n }), c;\n }, m = (y, f = N.LOCAL) => {\n const d = it(y, t);\n n.updateTarget(d, f);\n }, l = (y, f = N.LOCAL) => {\n const d = y.map((c) => it(c, t));\n n.bulkUpdateTargets(d, f);\n }, g = (y, f, d) => {\n const c = o.getAt(y, f, !!d).map((S) => n.getAnnotation(S)), v = d ? c.filter(d) : c;\n return v.length > 0 ? v[0] : void 0;\n }, p = (y, f, d, c = 5) => {\n const v = o.getAnnotationRects(y);\n if (v.length !== 0) {\n if (f && d) {\n const S = v.find(({ top: L, right: E, bottom: T, left: B }) => f >= B - c && f <= E + c && d >= L - c && d <= T + c);\n if (S) return S;\n }\n return o.getAnnotationBounds(y);\n }\n }, w = () => o.recalculate();\n return n.observe(({ changes: y }) => {\n const f = (y.deleted || []).filter((v) => $(v.target.selector)), d = (y.created || []).filter((v) => $(v.target.selector)), c = (y.updated || []).filter((v) => $(v.newValue.target.selector));\n (f == null ? void 0 : f.length) > 0 && f.forEach((v) => o.remove(v.target)), d.length > 0 && o.set(d.map((v) => v.target), !1), (c == null ? void 0 : c.length) > 0 && c.forEach(({ newValue: v }) => o.update(v.target));\n }), {\n store: {\n ...n,\n addAnnotation: a,\n bulkAddAnnotation: u,\n bulkUpdateTargets: l,\n bulkUpsertAnnotations: h,\n getAnnotationBounds: p,\n getAt: g,\n getIntersecting: o.getIntersecting,\n recalculatePositions: w,\n updateTarget: m\n },\n selection: i,\n hover: r,\n viewport: s\n };\n}, Bn = () => {\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}, Tn = (t, e, n = {}) => {\n const o = Bn(), i = o.getContext(\"2d\");\n document.body.appendChild(o);\n const r = /* @__PURE__ */ new Map(), s = (l) => Array.from(r.entries()).filter(([g, p]) => p.presenceKey === l.presenceKey).map(([g, p]) => g);\n return e.on(\"selectionChange\", (l, g) => {\n s(l).forEach((w) => r.delete(w)), g && g.forEach((w) => r.set(w, l));\n }), {\n clear: () => {\n const { width: l, height: g } = o;\n i.clearRect(-0.5, -0.5, l + 1, g + 1);\n },\n destroy: () => {\n o.remove();\n },\n paint: (l, g, p) => {\n n.font && (i.font = n.font);\n const w = r.get(l.annotation.id);\n if (w) {\n const { height: y } = l.rects[0], f = l.rects[0].x + g.left, d = l.rects[0].y + g.top;\n i.fillStyle = w.appearance.color, i.fillRect(f - 2, d - 2.5, 2, y + 5);\n const c = i.measureText(w.appearance.label), v = c.width + 6, S = c.actualBoundingBoxAscent + c.actualBoundingBoxDescent + 8, L = c.fontBoundingBoxAscent ? 8 : 6.5;\n return i.fillRect(f - 2, d - 2.5 - S, v, S), i.fillStyle = \"#fff\", i.fillText(w.appearance.label, f + 1, d - L), {\n fill: w.appearance.color,\n fillOpacity: p ? 0.45 : 0.18\n };\n }\n },\n reset: () => {\n o.width = 2 * window.innerWidth, o.height = 2 * window.innerHeight;\n const l = o.getContext(\"2d\");\n l.scale(2, 2), l.translate(0.5, 0.5);\n }\n };\n}, Wt = (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 : Wt(t.parentElement);\n}, Rn = (t, e) => (n) => {\n const o = typeof n == \"string\" ? n : n.id, i = (s) => {\n const a = r.getBoundingClientRect(), u = r.clientHeight, h = r.clientWidth, m = s.selector[0].range.getBoundingClientRect(), { width: l, height: g } = e.getAnnotationBounds(o), p = m.top - a.top, w = m.left - a.left, y = r.parentElement ? r.scrollTop : 0, f = r.parentElement ? r.scrollLeft : 0, d = p + y - (u - g) / 2, c = w + f - (h - l) / 2;\n r.scroll({ top: d, left: c, behavior: \"smooth\" });\n }, r = Wt(t);\n if (r) {\n const s = e.getAnnotation(o), { range: a } = s.target.selector[0];\n if (a && !a.collapsed)\n return i(s.target), !0;\n {\n const u = it(s.target, t), { range: h } = u.selector[0];\n if (h && !h.collapsed)\n return i(u), !0;\n }\n }\n return !1;\n}, Nn = (t, e) => ({\n ...t,\n annotationEnabled: t.annotationEnabled === void 0 ? e.annotationEnabled : t.annotationEnabled\n}), Mn = (t, e, n, o) => {\n let i;\n const r = (c) => i = c;\n let s;\n const a = (c) => s = c, { store: u, selection: h } = e;\n let m, l = !1, g;\n const p = (c) => {\n var S;\n if (!l) return;\n !((S = c.target.parentElement) != null && S.closest(D)) ? m = {\n annotation: Ht(),\n selector: [],\n creator: i,\n created: /* @__PURE__ */ new Date()\n } : m = void 0;\n };\n n && t.addEventListener(\"selectstart\", p);\n const w = bt((c) => {\n var B, M;\n const v = document.getSelection();\n if (!!((M = (B = v.anchorNode) == null ? void 0 : B.parentElement) != null && M.closest(D))) {\n m = void 0;\n return;\n }\n if (c.timeStamp - ((g == null ? void 0 : g.timeStamp) || c.timeStamp) < 1e3 && !m && p(g), v.isCollapsed || !l || !m) return;\n const L = v.getRangeAt(0);\n if (re(L)) return;\n const E = Zt(L.cloneRange());\n (E.length !== m.selector.length || E.some((b, x) => {\n var A;\n return b.toString() !== ((A = m.selector[x]) == null ? void 0 : A.quote);\n })) && (m = {\n ...m,\n selector: E.map((b) => le(b, t, o)),\n updated: /* @__PURE__ */ new Date()\n }, u.getAnnotation(m.annotation) ? u.updateTarget(m, N.LOCAL) : (h.clear(), u.addAnnotation({\n id: m.annotation,\n bodies: [],\n target: m\n }), h.clickSelect(m.annotation, g)));\n });\n n && document.addEventListener(\"selectionchange\", w);\n const y = (c) => {\n const { target: v, timeStamp: S, offsetX: L, offsetY: E, type: T } = c;\n g = { ...c, target: v, timeStamp: S, offsetX: L, offsetY: E, type: T }, l = c.button === 0;\n };\n t.addEventListener(\"pointerdown\", y);\n const f = (c) => {\n var E;\n if (!!((E = c.target.parentElement) != null && E.closest(D)) || !l)\n return;\n const S = () => {\n const { x: T, y: B } = t.getBoundingClientRect(), M = u.getAt(c.clientX - T, c.clientY - B, s);\n if (M) {\n const { selected: b } = h;\n (b.length !== 1 || b[0].id !== M.id) && h.clickSelect(M.id, c);\n } else h.isEmpty() || h.clear();\n }, L = c.timeStamp - g.timeStamp;\n document.getSelection().isCollapsed && L < 300 ? (m = void 0, S()) : m && h.clickSelect(m.annotation, c);\n };\n return document.addEventListener(\"pointerup\", f), {\n destroy: () => {\n t.removeEventListener(\"selectstart\", p), document.removeEventListener(\"selectionchange\", w), t.removeEventListener(\"pointerdown\", y), document.removeEventListener(\"pointerup\", f);\n },\n setFilter: a,\n setUser: r\n };\n}, kt = \"SPANS\", kn = (t, e = {}) => {\n te(t);\n const n = Nn(e, {\n annotationEnabled: !0\n }), o = Ln(t, n.pointerAction), { selection: i, viewport: r } = o, s = o.store, a = Je(s), u = tn(o, a, n.adapter);\n let h = ln();\n const m = n.renderer === \"CSS_HIGHLIGHTS\" ? CSS.highlights ? \"CSS_HIGHLIGHTS\" : kt : n.renderer || kt, l = m === \"SPANS\" ? Te(t, o, r) : m === \"CSS_HIGHLIGHTS\" ? Ce(t, o, r) : m === \"CANVAS\" ? ge(t, o, r) : void 0;\n if (!l)\n throw `Unknown renderer implementation: ${m}`;\n console.debug(`Using ${m} renderer`), n.style && l.setStyle(n.style);\n const g = Mn(t, o, n.annotationEnabled, n.offsetReferenceSelector);\n return g.setUser(h), {\n ...nn(o, a, n.adapter),\n destroy: () => {\n l.destroy(), g.destroy(), a.destroy();\n },\n element: t,\n getUser: () => h,\n setFilter: (E) => {\n l.setFilter(E), g.setFilter(E);\n },\n setStyle: (E) => l.setStyle(E),\n setUser: (E) => {\n h = E, g.setUser(E);\n },\n setSelected: (E) => {\n E ? i.setSelected(E) : i.clear();\n },\n setPresenceProvider: (E) => {\n E && (l.setPainter(Tn(t, E, n.presence)), E.on(\"selectionChange\", () => l.redraw()));\n },\n setVisible: (E) => l.setVisible(E),\n on: u.on,\n off: u.off,\n scrollIntoView: Rn(t, s),\n state: o\n };\n};\nexport {\n ot as DEFAULT_SELECTED_STYLE,\n P as DEFAULT_STYLE,\n Yt as NOT_ANNOTATABLE_CLASS,\n D as NOT_ANNOTATABLE_SELECTOR,\n N as Origin,\n Ue as PointerSelectAction,\n Un as W3CTextFormat,\n te as cancelSingleClickEvents,\n Vn as createBody,\n ge as createCanvasRenderer,\n Ce as createHighlightsRenderer,\n Se as createRenderer,\n Te as createSpansRenderer,\n kn as createTextAnnotator,\n Ln as createTextAnnotatorState,\n bt as debounce,\n Nn as fillDefaults,\n On as getAnnotatableFragment,\n In as getClientRectsPonyfill,\n oe as getQuoteContext,\n gt as getRangeAnnotatableContents,\n $ as isRevived,\n re as isWhitespaceOrEmpty,\n ce as mergeClientRects,\n Kt as paint,\n gn as parseW3CTextAnnotation,\n le as rangeToSelector,\n rt as reviveAnnotation,\n Dt as reviveSelector,\n it as reviveTarget,\n mn as serializeW3CTextAnnotation,\n Zt as splitAnnotatableRanges,\n ie as whitespaceOrEmptyRegex\n};\n//# sourceMappingURL=text-annotator.es.js.map\n"],"names":[],"mappings":"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","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { __module as jsxRuntime } from "./react-text-annotator.es13.js";
|
|
2
|
+
import { __require as requireReactJsxRuntime_production_min } from "./react-text-annotator.es14.js";
|
|
3
|
+
import { __require as requireReactJsxRuntime_development } from "./react-text-annotator.es15.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;
|
|
10
|
+
export {
|
|
11
|
+
jsxRuntimeExports as j
|
|
12
|
+
};
|
|
2
13
|
//# sourceMappingURL=react-text-annotator.es7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es7.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"react-text-annotator.es7.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]}
|