@soomo/react-text-annotator 3.2.0-staging.4 → 3.2.0-staging.6
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/TextAnnotationPopup/TextAnnotationPopup.d.ts.map +1 -1
- package/dist/TextAnnotationPopup/useAnnotationQuoteIdle.d.ts +4 -0
- package/dist/TextAnnotationPopup/useAnnotationQuoteIdle.d.ts.map +1 -0
- package/dist/TextAnnotationPopup/useAnnouncePopupNavigation.d.ts.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react-text-annotator.css +1 -31
- package/dist/react-text-annotator.es.js +211 -25
- package/dist/react-text-annotator.es.js.map +1 -1
- package/package.json +14 -13
- package/dist/hooks/index.d.ts +0 -3
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/useAnnotationQuoteIdling.d.ts +0 -4
- package/dist/hooks/useAnnotationQuoteIdling.d.ts.map +0 -1
- package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +0 -1
- package/dist/react-text-annotator.es10.js +0 -85
- package/dist/react-text-annotator.es10.js.map +0 -1
- package/dist/react-text-annotator.es11.js +0 -48
- package/dist/react-text-annotator.es11.js.map +0 -1
- package/dist/react-text-annotator.es12.js +0 -28
- package/dist/react-text-annotator.es12.js.map +0 -1
- package/dist/react-text-annotator.es13.js +0 -1646
- package/dist/react-text-annotator.es13.js.map +0 -1
- package/dist/react-text-annotator.es14.js +0 -13
- package/dist/react-text-annotator.es14.js.map +0 -1
- package/dist/react-text-annotator.es16.js +0 -607
- package/dist/react-text-annotator.es16.js.map +0 -1
- package/dist/react-text-annotator.es17.js +0 -285
- package/dist/react-text-annotator.es17.js.map +0 -1
- package/dist/react-text-annotator.es18.js +0 -504
- package/dist/react-text-annotator.es18.js.map +0 -1
- package/dist/react-text-annotator.es19.js +0 -18
- package/dist/react-text-annotator.es19.js.map +0 -1
- package/dist/react-text-annotator.es2.js +0 -67
- package/dist/react-text-annotator.es2.js.map +0 -1
- package/dist/react-text-annotator.es20.js +0 -5
- package/dist/react-text-annotator.es20.js.map +0 -1
- package/dist/react-text-annotator.es21.js +0 -34
- package/dist/react-text-annotator.es21.js.map +0 -1
- package/dist/react-text-annotator.es22.js +0 -891
- package/dist/react-text-annotator.es22.js.map +0 -1
- package/dist/react-text-annotator.es23.js +0 -5
- package/dist/react-text-annotator.es23.js.map +0 -1
- package/dist/react-text-annotator.es24.js +0 -5
- package/dist/react-text-annotator.es24.js.map +0 -1
- package/dist/react-text-annotator.es25.js +0 -130
- package/dist/react-text-annotator.es25.js.map +0 -1
- package/dist/react-text-annotator.es26.js +0 -167
- package/dist/react-text-annotator.es26.js.map +0 -1
- package/dist/react-text-annotator.es27.js +0 -314
- package/dist/react-text-annotator.es27.js.map +0 -1
- package/dist/react-text-annotator.es28.js +0 -117
- package/dist/react-text-annotator.es28.js.map +0 -1
- package/dist/react-text-annotator.es29.js +0 -312
- package/dist/react-text-annotator.es29.js.map +0 -1
- package/dist/react-text-annotator.es3.js +0 -29
- package/dist/react-text-annotator.es3.js.map +0 -1
- package/dist/react-text-annotator.es30.js +0 -61
- package/dist/react-text-annotator.es30.js.map +0 -1
- package/dist/react-text-annotator.es31.js +0 -23
- package/dist/react-text-annotator.es31.js.map +0 -1
- package/dist/react-text-annotator.es32.js +0 -152
- package/dist/react-text-annotator.es32.js.map +0 -1
- package/dist/react-text-annotator.es33.js +0 -629
- package/dist/react-text-annotator.es33.js.map +0 -1
- package/dist/react-text-annotator.es4.js +0 -43
- package/dist/react-text-annotator.es4.js.map +0 -1
- package/dist/react-text-annotator.es5.js +0 -48
- package/dist/react-text-annotator.es5.js.map +0 -1
- package/dist/react-text-annotator.es6.js +0 -29
- package/dist/react-text-annotator.es6.js.map +0 -1
- package/dist/react-text-annotator.es7.js +0 -143
- package/dist/react-text-annotator.es7.js.map +0 -1
- package/dist/react-text-annotator.es8.js +0 -6
- package/dist/react-text-annotator.es8.js.map +0 -1
- /package/dist/{hooks → TextAnnotationPopup}/useAnnouncePopupNavigation.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAnnotationPopup.d.ts","sourceRoot":"","sources":["../../src/TextAnnotationPopup/TextAnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAqD,MAAM,OAAO,CAAC;AAEhG,OAAO,
|
|
1
|
+
{"version":3,"file":"TextAnnotationPopup.d.ts","sourceRoot":"","sources":["../../src/TextAnnotationPopup/TextAnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAqD,MAAM,OAAO,CAAC;AAEhG,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAKL,kBAAkB,EAUnB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,2BAA2B,CAAC;AAEnC,UAAU,wBAAwB;IAEhC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,UAAU,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC;IAEzD,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,GAAG,aAAa,CAAC;CAEtC;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAmJ5D,CAAC;AAEF;;;;;;;;;;EAUE;AAEF,mCAAmC;AACnC,kDAAkD;AAClD,eAAO,MAAM,kBAAkB,GAAI,OAAO,wBAAwB,4CAOjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnnotationQuoteIdle.d.ts","sourceRoot":"","sources":["../../src/TextAnnotationPopup/useAnnotationQuoteIdle.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,GACjC,cAAc,MAAM,GAAG,SAAS,EAChC,UAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAqB,YA0ChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnnouncePopupNavigation.d.ts","sourceRoot":"","sources":["../../src/TextAnnotationPopup/useAnnouncePopupNavigation.ts"],"names":[],"mappings":"AAOA,UAAU,wBAAwB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,0BAA0B,GAAI,MAAM,wBAAwB,SA2DxE,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAGtC,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,KAAK,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,SAAS,EACT,cAAc,EACd,KAAK,EACL,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,IAAI,EACJ,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,UAAU,EACV,MAAM,EACN,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACN,iBAAiB,EACjB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,cAAc,EACd,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,aAAa,IAAI,qBAAqB,EACtC,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
.r6o-
|
|
2
|
-
/*
|
|
3
|
-
* Close message should be visible only to the keyboard
|
|
4
|
-
* or the screen reader users as the popup behavior hint
|
|
5
|
-
* Inspired by https://gist.github.com/ffoodd/000b59f431e3e64e4ce1a24d5bb36034
|
|
6
|
-
*/
|
|
7
|
-
.r6o-popup-sr-only {
|
|
8
|
-
border: 0 !important;
|
|
9
|
-
clip: rect(1px, 1px, 1px, 1px);
|
|
10
|
-
-webkit-clip-path: inset(50%);
|
|
11
|
-
clip-path: inset(50%);
|
|
12
|
-
height: 1px;
|
|
13
|
-
margin: -1px;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
padding: 0;
|
|
16
|
-
position: absolute;
|
|
17
|
-
width: 1px;
|
|
18
|
-
white-space: nowrap;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.r6o-popup-sr-only:focus,
|
|
22
|
-
.r6o-popup-sr-only:active {
|
|
23
|
-
clip: auto;
|
|
24
|
-
-webkit-clip-path: none;
|
|
25
|
-
clip-path: none;
|
|
26
|
-
height: auto;
|
|
27
|
-
margin: auto;
|
|
28
|
-
overflow: visible;
|
|
29
|
-
width: auto;
|
|
30
|
-
white-space: normal;
|
|
31
|
-
}
|
|
1
|
+
.r6o-popup-sr-only{border:0!important;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.r6o-popup-sr-only:focus,.r6o-popup-sr-only:active{clip:auto;-webkit-clip-path:none;clip-path:none;height:auto;margin:auto;overflow:visible;width:auto;white-space:normal}
|
|
@@ -1,28 +1,214 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { W3CTextFormat, parseW3CTextAnnotation, serializeW3CTextAnnotation } from "@soomo/text-annotator";
|
|
10
|
-
import
|
|
1
|
+
import { jsx as g, Fragment as U, jsxs as W } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as y, useEffect as c, useContext as P, useCallback as x, Children as _, cloneElement as j, useState as S, useMemo as D } from "react";
|
|
3
|
+
import H from "CETEIcean";
|
|
4
|
+
import { AnnotoriousContext as R, useAnnotationStore as Q, Origin as z, useAnnotator as V, useSelection as Y } from "@annotorious/react";
|
|
5
|
+
import { AnnotoriousPlugin as Oe } from "@annotorious/react";
|
|
6
|
+
import { TEIPlugin as $ } from "@recogito/text-annotator-tei";
|
|
7
|
+
import { serializeW3CTEIAnnotation as Pe } from "@recogito/text-annotator-tei";
|
|
8
|
+
import { createTextAnnotator as I, toViewportBounds as F, toDomRectList as J, NOT_ANNOTATABLE_CLASS as q } from "@soomo/text-annotator";
|
|
9
|
+
import { W3CTextFormat as Ie, parseW3CTextAnnotation as Be, serializeW3CTextAnnotation as Ne } from "@soomo/text-annotator";
|
|
10
|
+
import "@soomo/text-annotator/dist/text-annotator.css";
|
|
11
|
+
import { useFloating as G, autoUpdate as K, inline as X, offset as Z, flip as ee, shift as te, arrow as ne, useDismiss as oe, useRole as re, useInteractions as se, FloatingPortal as ie, FloatingFocusManager as le, FloatingArrow as ce } from "@floating-ui/react";
|
|
12
|
+
import { Ignore as ae } from "@annotorious/core";
|
|
13
|
+
import { Origin as ke, UserSelectAction as Ue, createBody as We } from "@annotorious/core";
|
|
14
|
+
const O = {
|
|
15
|
+
tei: {
|
|
16
|
+
ref: (e) => {
|
|
17
|
+
const r = document.createElement("a");
|
|
18
|
+
for (; e.firstChild; )
|
|
19
|
+
r.appendChild(e.removeChild(e.firstChild));
|
|
20
|
+
r.setAttribute("href", e.getAttribute("target")), e.appendChild(r);
|
|
21
|
+
},
|
|
22
|
+
// Cf. https://github.com/TEIC/CETEIcean/issues/67
|
|
23
|
+
graphic: (e) => {
|
|
24
|
+
var l;
|
|
25
|
+
const r = new Image();
|
|
26
|
+
r.src = (l = e.getAttribute("url")) == null ? void 0 : l.trim(), e.hasAttribute("width") && r.setAttribute("width", e.getAttribute("width")), e.hasAttribute("height") && r.setAttribute("height", e.getAttribute("height")), e.appendChild(r);
|
|
27
|
+
},
|
|
28
|
+
list: null,
|
|
29
|
+
note: null,
|
|
30
|
+
table: null,
|
|
31
|
+
teiHeader: (e) => {
|
|
32
|
+
e.hidden = !0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, ve = (e) => {
|
|
36
|
+
const r = y(null);
|
|
37
|
+
return c(() => {
|
|
38
|
+
var l;
|
|
39
|
+
if (e.tei) {
|
|
40
|
+
const n = new H(e.initArgs);
|
|
41
|
+
n.addBehaviors({
|
|
42
|
+
...O,
|
|
43
|
+
...e.behaviors || {},
|
|
44
|
+
tei: {
|
|
45
|
+
...O.tei,
|
|
46
|
+
...((l = e.behaviors) == null ? void 0 : l.tei) || {}
|
|
47
|
+
}
|
|
48
|
+
}), n.makeHTML5(e.tei, (s) => {
|
|
49
|
+
r.current.appendChild(s), e.onLoad(r.current);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return () => {
|
|
53
|
+
r.current.innerHTML = "";
|
|
54
|
+
};
|
|
55
|
+
}, [e.tei, JSON.stringify(e.initArgs), e.onLoad]), /* @__PURE__ */ g(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
ref: r,
|
|
59
|
+
className: "tei-container"
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}, xe = (e) => {
|
|
63
|
+
const { children: r, ...l } = e, { anno: n, setAnno: s } = P(R), i = x((t) => {
|
|
64
|
+
const a = $(I(t, l));
|
|
65
|
+
s(a);
|
|
66
|
+
}, []);
|
|
67
|
+
return c(() => {
|
|
68
|
+
n && n.setStyle(e.style);
|
|
69
|
+
}, [e.style]), c(() => {
|
|
70
|
+
n && n.setFilter(e.filter);
|
|
71
|
+
}, [e.filter]), e.children ? /* @__PURE__ */ g(U, { children: _.toArray(e.children).map((t) => j(t, { onLoad: i })) }) : null;
|
|
72
|
+
}, Se = (e) => {
|
|
73
|
+
const r = y(null), { className: l, children: n, ...s } = e, { style: i, filter: t, user: a, annotatingEnabled: u, userSelectAction: A } = s, { anno: o, setAnno: f } = P(R);
|
|
74
|
+
return c(() => {
|
|
75
|
+
if (!f) return;
|
|
76
|
+
const p = typeof s.adapter == "function" ? s.adapter(r.current) : s.adapter, m = I(r.current, { ...s, adapter: p });
|
|
77
|
+
return f(m), () => m.destroy();
|
|
78
|
+
}, [f]), c(() => o == null ? void 0 : o.setStyle(i), [o, i]), c(() => o == null ? void 0 : o.setFilter(t), [o, t]), c(() => o == null ? void 0 : o.setFilter(t), [o, t]), c(() => o == null ? void 0 : o.setUserSelectAction(A), [o, A]), c(() => o == null ? void 0 : o.setUser(a), [o, a]), c(() => o == null ? void 0 : o.setAnnotatingEnabled(u), [o, u]), /* @__PURE__ */ g("div", { ref: r, className: `r6o-annotatable no-focus-outline ${l}`, children: n });
|
|
79
|
+
}, L = () => {
|
|
80
|
+
if (typeof navigator > "u") return !1;
|
|
81
|
+
var e = navigator.userAgent || navigator.vendor || (window == null ? void 0 : window.opera);
|
|
82
|
+
return !!(/android/i.test(e) || /iPad|iPhone/.test(e) && !window.MSStream);
|
|
83
|
+
}, v = (e, r = { timeout: 250 }) => {
|
|
84
|
+
const l = Q(), [n, s] = S(!0);
|
|
85
|
+
return c(() => {
|
|
86
|
+
if (!l || !e) return;
|
|
87
|
+
let i;
|
|
88
|
+
const t = (a) => {
|
|
89
|
+
const { changes: { updated: u } } = a;
|
|
90
|
+
(u == null ? void 0 : u.some((o) => {
|
|
91
|
+
const { targetUpdated: f } = o;
|
|
92
|
+
if (f) {
|
|
93
|
+
const { oldTarget: p, newTarget: m } = f;
|
|
94
|
+
return ue(p, m);
|
|
95
|
+
}
|
|
96
|
+
})) && (s(!1), clearTimeout(i), i = setTimeout(() => s(!0), r.timeout));
|
|
97
|
+
};
|
|
98
|
+
return l.observe(t, {
|
|
99
|
+
annotations: e,
|
|
100
|
+
ignore: ae.BODY_ONLY,
|
|
101
|
+
origin: z.LOCAL
|
|
102
|
+
}), () => {
|
|
103
|
+
clearTimeout(i), l.unobserve(t);
|
|
104
|
+
};
|
|
105
|
+
}, [l, e, r.timeout]), n;
|
|
106
|
+
}, ue = (e, r) => {
|
|
107
|
+
const { selector: l } = e, n = l.map(({ quote: t }) => t), { selector: s } = r, i = s.map(({ quote: t }) => t);
|
|
108
|
+
return n.join() !== i.join();
|
|
109
|
+
}, de = (e) => {
|
|
110
|
+
var E;
|
|
111
|
+
const { popup: r, ariaNavigationMessage: l } = e, n = V(), { selected: s, event: i } = Y(), t = (E = s[0]) == null ? void 0 : E.annotation;
|
|
112
|
+
v(t == null ? void 0 : t.id);
|
|
113
|
+
const [a, u] = S((s == null ? void 0 : s.length) > 0), A = () => n == null ? void 0 : n.cancelSelected(), [o, f] = S(!1);
|
|
114
|
+
x(() => f(!0), []);
|
|
115
|
+
const p = x(() => f(!1), []);
|
|
116
|
+
c(() => {
|
|
117
|
+
a || p();
|
|
118
|
+
}, [a, p]);
|
|
119
|
+
const m = y(null), { refs: T, floatingStyles: B, update: C, context: w } = G({
|
|
120
|
+
placement: L() ? "bottom" : "top",
|
|
121
|
+
open: a,
|
|
122
|
+
onOpenChange: (d, h, b) => {
|
|
123
|
+
!d && (b === "escape-key" || b === "focus-out") && (u(d), A());
|
|
124
|
+
},
|
|
125
|
+
middleware: [
|
|
126
|
+
X(),
|
|
127
|
+
Z(10),
|
|
128
|
+
ee({ crossAxis: !0 }),
|
|
129
|
+
te({ crossAxis: !0, padding: 10 }),
|
|
130
|
+
ne({ element: m })
|
|
131
|
+
],
|
|
132
|
+
whileElementsMounted: K
|
|
133
|
+
}), N = oe(w), M = re(w, { role: "dialog" }), { getFloatingProps: fe } = se([N, M]);
|
|
134
|
+
c(() => {
|
|
135
|
+
if (!n) return;
|
|
136
|
+
const d = t == null ? void 0 : t.id, h = t == null ? void 0 : t.target.selector.length;
|
|
137
|
+
if (d && h > 0 && v) {
|
|
138
|
+
const b = n == null ? void 0 : n.state.store.getAnnotationBounds(t.id);
|
|
139
|
+
u(!!b);
|
|
140
|
+
} else
|
|
141
|
+
u(!1);
|
|
142
|
+
}, [t == null ? void 0 : t.id, t == null ? void 0 : t.target.selector, v, n == null ? void 0 : n.state.store]), c(() => {
|
|
143
|
+
n && (a && (t != null && t.id) ? T.setPositionReference({
|
|
144
|
+
getBoundingClientRect: () => {
|
|
145
|
+
const d = n.state.store.getAnnotationBounds(t.id);
|
|
146
|
+
return d ? F(d, n.element.getBoundingClientRect()) : new DOMRect();
|
|
147
|
+
},
|
|
148
|
+
getClientRects: () => {
|
|
149
|
+
const h = n.state.store.getAnnotationRects(t.id).map(
|
|
150
|
+
(b) => F(b, n.element.getBoundingClientRect())
|
|
151
|
+
);
|
|
152
|
+
return J(h);
|
|
153
|
+
}
|
|
154
|
+
}) : T.setPositionReference(null));
|
|
155
|
+
}, [a, t == null ? void 0 : t.id, t == null ? void 0 : t.target, n]), c(() => {
|
|
156
|
+
const d = { attributes: !0, childList: !0, subtree: !0 }, h = new MutationObserver(() => C());
|
|
157
|
+
return h.observe(document.body, d), window.document.addEventListener("scroll", C, !0), () => {
|
|
158
|
+
h.disconnect(), window.document.removeEventListener("scroll", C, !0);
|
|
159
|
+
};
|
|
160
|
+
}, [C]);
|
|
161
|
+
const k = D(() => (i == null ? void 0 : i.type) === "keyup" || (i == null ? void 0 : i.type) === "contextmenu" || L() ? -1 : 0, [i]);
|
|
162
|
+
return a && t ? /* @__PURE__ */ g(ie, { children: /* @__PURE__ */ g(
|
|
163
|
+
le,
|
|
164
|
+
{
|
|
165
|
+
context: w,
|
|
166
|
+
modal: !1,
|
|
167
|
+
closeOnFocusOut: !0,
|
|
168
|
+
returnFocus: !1,
|
|
169
|
+
initialFocus: k,
|
|
170
|
+
children: /* @__PURE__ */ W(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
className: `a9s-popup r6o-popup annotation-popup r6o-text-popup ${q}`,
|
|
174
|
+
ref: T.setFloating,
|
|
175
|
+
style: B,
|
|
176
|
+
children: [
|
|
177
|
+
e.popup({
|
|
178
|
+
annotation: s[0].annotation,
|
|
179
|
+
editable: s[0].editable,
|
|
180
|
+
event: i
|
|
181
|
+
}),
|
|
182
|
+
e.arrow && /* @__PURE__ */ g(
|
|
183
|
+
ce,
|
|
184
|
+
{
|
|
185
|
+
ref: m,
|
|
186
|
+
context: w,
|
|
187
|
+
...e.arrowProps || {}
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ g("button", { className: "r6o-popup-sr-only", "aria-live": "assertive", onClick: A, children: e.ariaCloseWarning || "Click or leave this dialog to close it." })
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
) }) : null;
|
|
196
|
+
}, ye = (e) => (c(() => {
|
|
197
|
+
console.warn("TextAnnotatorPopup is deprecated and will be removed in a future version. Please use TextAnnotationPopup instead.");
|
|
198
|
+
}, []), /* @__PURE__ */ g(de, { ...e }));
|
|
11
199
|
export {
|
|
12
|
-
AnnotoriousPlugin,
|
|
13
|
-
CETEIcean,
|
|
14
|
-
Origin,
|
|
15
|
-
TEIAnnotator,
|
|
16
|
-
TextAnnotationPopup,
|
|
17
|
-
TextAnnotator,
|
|
18
|
-
TextAnnotatorPopup,
|
|
19
|
-
UserSelectAction,
|
|
20
|
-
W3CTextFormat,
|
|
21
|
-
createBody,
|
|
22
|
-
parseW3CTextAnnotation,
|
|
23
|
-
serializeW3CTEIAnnotation,
|
|
24
|
-
serializeW3CTextAnnotation
|
|
25
|
-
useAnnotationQuoteIdling,
|
|
26
|
-
useAnnouncePopupNavigation
|
|
200
|
+
Oe as AnnotoriousPlugin,
|
|
201
|
+
ve as CETEIcean,
|
|
202
|
+
ke as Origin,
|
|
203
|
+
xe as TEIAnnotator,
|
|
204
|
+
de as TextAnnotationPopup,
|
|
205
|
+
Se as TextAnnotator,
|
|
206
|
+
ye as TextAnnotatorPopup,
|
|
207
|
+
Ue as UserSelectAction,
|
|
208
|
+
Ie as W3CTextFormat,
|
|
209
|
+
We as createBody,
|
|
210
|
+
Be as parseW3CTextAnnotation,
|
|
211
|
+
Pe as serializeW3CTEIAnnotation,
|
|
212
|
+
Ne as serializeW3CTextAnnotation
|
|
27
213
|
};
|
|
28
214
|
//# sourceMappingURL=react-text-annotator.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"react-text-annotator.es.js","sources":["../src/tei/CETEIcean.tsx","../src/tei/TEIAnnotator.tsx","../src/TextAnnotator.tsx","../src/TextAnnotationPopup/isMobile.ts","../src/TextAnnotationPopup/useAnnotationQuoteIdle.ts","../src/TextAnnotationPopup/TextAnnotationPopup.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport CETEI from 'CETEIcean';\n\ninterface CETEIceanProps {\n\n initArgs?: any;\n\n tei?: string;\n\n onLoad?(element: Element): void;\n\n behaviors?: any;\n\n}\n\n// Override default list, note, table, and ref behaviors \n// so they don't introduce text into the DOM that interferes\n// with annotation. Apply a patch to graphics for robustness.\nconst PRESET_BEHAVIORS = {\n tei: {\n ref: (elem: Element) => {\n const a = document.createElement('a');\n\n while(elem.firstChild) {\n a.appendChild(elem.removeChild(elem.firstChild));\n }\n\n a.setAttribute('href', elem.getAttribute('target'));\n\n elem.appendChild(a);\n },\n // Cf. https://github.com/TEIC/CETEIcean/issues/67\n graphic: (elem: Element) => {\n const content = new Image();\n content.src = elem.getAttribute('url')?.trim();\n\n if (elem.hasAttribute('width'))\n content.setAttribute('width', elem.getAttribute('width'));\n\n if (elem.hasAttribute('height'))\n content.setAttribute('height', elem.getAttribute('height'));\n\n elem.appendChild(content);\n },\n list: null,\n note: null,\n table: null,\n teiHeader: (elem: HTMLElement) => {\n elem.hidden = true;\n }\n }\n}\n\nexport const CETEIcean = (props: CETEIceanProps) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (props.tei) {\n const ceteicean = new CETEI(props.initArgs);\n\n ceteicean.addBehaviors({\n ...PRESET_BEHAVIORS,\n ...(props.behaviors || {}),\n tei: {\n ...PRESET_BEHAVIORS.tei,\n ...(props.behaviors?.tei || {})\n }\n });\n\n ceteicean.makeHTML5(props.tei, (data: Element) => {\n el.current.appendChild(data);\n props.onLoad(el.current);\n });\n }\n\n return () => {\n el.current.innerHTML = '';\n }\n }, [props.tei, JSON.stringify(props.initArgs), props.onLoad]);\n\n return (\n <div \n ref={el}\n className=\"tei-container\" />\n )\n\n}","import { Children, JSX, ReactElement, ReactNode, cloneElement, useCallback, useContext, useEffect } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport { TEIPlugin } from '@recogito/text-annotator-tei';\nimport { createTextAnnotator, HighlightStyleExpression } from '@soomo/text-annotator';\nimport type { TextAnnotatorOptions } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport type TEIAnnotatorProps = TextAnnotatorOptions & {\n\n children?: ReactNode | JSX.Element;\n\n filter?: Filter;\n\n style?: HighlightStyleExpression\n\n}\n\nexport const TEIAnnotator = (props: TEIAnnotatorProps) => {\n\n const { children, ...opts } = props;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n const onLoad = useCallback((element: HTMLElement) => {\n const anno = TEIPlugin(createTextAnnotator(element, opts));\n setAnno(anno);\n }, []);\n\n useEffect(() => {\n if (!anno)\n return;\n \n anno.setStyle(props.style);\n }, [props.style]);\n\n useEffect(() => {\n if (!anno)\n return;\n \n anno.setFilter(props.filter);\n }, [props.filter]);\n\n return props.children ? (\n <>\n {Children.toArray(props.children).map(child => \n cloneElement(child as ReactElement, { onLoad } as any))}\n </>\n ) : null;\n\n}\n","import { JSX, ReactNode, useContext, useEffect, useRef } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport type { FormatAdapter } from '@annotorious/core';\nimport type { HighlightStyleExpression, TextAnnotation, TextAnnotatorOptions } from '@soomo/text-annotator';\nimport { createTextAnnotator } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport interface TextAnnotatorProps<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends Omit<TextAnnotatorOptions<I, E>, 'adapter'> {\n\n children?: ReactNode | JSX.Element;\n\n adapter?: FormatAdapter<I, E> | ((container: HTMLElement) => FormatAdapter<I, E>) | null;\n\n filter?: Filter<I>;\n\n style?: HighlightStyleExpression;\n\n className?: string;\n\n}\n\nexport const TextAnnotator = <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(\n props: TextAnnotatorProps<I, E>\n) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n const { className, children, ...opts } = props;\n const { style, filter, user, annotatingEnabled, userSelectAction } = opts;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n useEffect(() => {\n if (!setAnno) return;\n\n const adapter = typeof opts.adapter === 'function' ? opts.adapter(el.current) : opts.adapter;\n\n const anno = createTextAnnotator(el.current, { ...opts, adapter });\n setAnno(anno);\n\n return () => anno.destroy();\n }, [setAnno]);\n\n useEffect(() => anno?.setStyle(style), [anno, style]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setUserSelectAction(userSelectAction), [anno, userSelectAction]);\n\n useEffect(() => anno?.setUser(user), [anno, user]);\n\n useEffect(() => anno?.setAnnotatingEnabled(annotatingEnabled), [anno, annotatingEnabled]);\n\n return (\n <div ref={el} className={`r6o-annotatable no-focus-outline ${className}`}>\n {children}\n </div>\n );\n\n};\n","// https://stackoverflow.com/questions/21741841/detecting-ios-android-operating-system\nexport const isMobile = () => {\n if (typeof navigator === 'undefined') return false;\n\n // @ts-ignore\n var userAgent: string = navigator.userAgent || navigator.vendor || window?.opera;\n\n if (/android/i.test(userAgent)) \n return true;\n\n // @ts-ignore\n // Note: as of recently, this NO LONGER DETECTS FIREFOX ON iOS!\n // This means FF/iOS will behave like on the desktop, and loose\n // selection handlebars after the popup opens.\n if (/iPad|iPhone/.test(userAgent) && !window.MSStream)\n return true;\n\n return false;\n}","import { useEffect, useState } from 'react';\nimport { Origin, useAnnotationStore } from '@annotorious/react';\nimport { Ignore, type StoreChangeEvent } from '@annotorious/core';\nimport type { TextAnnotation, TextAnnotationStore, TextAnnotationTarget } from '@soomo/text-annotator';\n\nexport const useAnnotationQuoteIdle = (\n annotationId: string | undefined,\n options: { timeout: number } = { timeout: 250 }\n) => {\n const store = useAnnotationStore<TextAnnotationStore>();\n\n const [isIdle, setIsIdle] = useState(true);\n\n useEffect(() => {\n if (!store || !annotationId) return;\n\n let idleTimeout: ReturnType<typeof setTimeout>;\n\n const scheduleSetIsIdle = (event: StoreChangeEvent<TextAnnotation>) => {\n const { changes: { updated } } = event;\n\n const hasChanged = updated?.some(update => {\n const { targetUpdated } = update;\n if (targetUpdated) {\n const { oldTarget, newTarget } = targetUpdated;\n return hasQuoteChanged(oldTarget, newTarget);\n }\n });\n\n if (hasChanged) {\n setIsIdle(false);\n clearTimeout(idleTimeout);\n idleTimeout = setTimeout(() => setIsIdle(true), options.timeout);\n }\n };\n\n store.observe(scheduleSetIsIdle, {\n annotations: annotationId,\n ignore: Ignore.BODY_ONLY,\n origin: Origin.LOCAL\n });\n\n return () => {\n clearTimeout(idleTimeout);\n store.unobserve(scheduleSetIsIdle);\n };\n }, [store, annotationId, options.timeout]);\n\n return isIdle;\n};\n\nconst hasQuoteChanged = (oldValue: TextAnnotationTarget, newValue: TextAnnotationTarget) => {\n const { selector: oldSelector } = oldValue;\n const oldQuotes = oldSelector.map(({ quote }) => quote);\n\n const { selector: newSelector } = newValue;\n const newQuotes = newSelector.map(({ quote }) => quote);\n\n return oldQuotes.join() !== newQuotes.join();\n};\n","import React, { FC, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useAnnotator, useSelection } from '@annotorious/react';\nimport {\n NOT_ANNOTATABLE_CLASS,\n type TextAnnotation,\n type TextAnnotator,\n toDomRectList,\n toViewportBounds\n} from '@soomo/text-annotator';\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';\nimport { isMobile } from './isMobile';\nimport { useAnnotationQuoteIdle } from './useAnnotationQuoteIdle';\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 isAnnotationQuoteIdle = useAnnotationQuoteIdle(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 && useAnnotationQuoteIdle) {\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, useAnnotationQuoteIdle, 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":["PRESET_BEHAVIORS","elem","a","content","_a","CETEIcean","props","el","useRef","useEffect","ceteicean","CETEI","data","jsx","TEIAnnotator","children","opts","anno","setAnno","useContext","AnnotoriousContext","onLoad","useCallback","element","TEIPlugin","createTextAnnotator","Fragment","Children","child","cloneElement","TextAnnotator","className","style","filter","user","annotatingEnabled","userSelectAction","adapter","isMobile","userAgent","useAnnotationQuoteIdle","annotationId","options","store","useAnnotationStore","isIdle","setIsIdle","useState","idleTimeout","scheduleSetIsIdle","event","updated","update","targetUpdated","oldTarget","newTarget","hasQuoteChanged","Ignore","Origin","oldValue","newValue","oldSelector","oldQuotes","quote","newSelector","newQuotes","TextAnnotationPopup","popup","ariaNavigationMessage","r","useAnnotator","selected","useSelection","annotation","isOpen","setOpen","handleClose","isFocused","setFocused","handleBlur","arrowRef","refs","floatingStyles","context","useFloating","open","_event","reason","inline","offset","flip","shift","arrow","autoUpdate","dismiss","useDismiss","role","useRole","getFloatingProps","useInteractions","annotationSelectorsLength","bounds","toViewportBounds","denormalizedRects","rect","toDomRectList","config","mutationObserver","initialFocus","useMemo","FloatingPortal","FloatingFocusManager","jsxs","NOT_ANNOTATABLE_CLASS","FloatingArrow","TextAnnotatorPopup"],"mappings":";;;;;;;;;;;;;AAkBA,MAAMA,IA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AAClI,GAAG,EAAE,GAEE,gBAAAI,EAACqD,IAAqB,EAAA,GAAG5D,EAAO,CAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soomo/react-text-annotator",
|
|
3
|
-
"version": "3.2.0-staging.
|
|
3
|
+
"version": "3.2.0-staging.6",
|
|
4
4
|
"description": "Recogito Text Annotator React bindings",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -24,14 +24,15 @@
|
|
|
24
24
|
"module": "./dist/react-text-annotator.es.js",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/react": "^19.1.
|
|
28
|
-
"@types/react-dom": "^19.1.
|
|
29
|
-
"@vitejs/plugin-react": "^4.
|
|
27
|
+
"@types/react": "^19.1.4",
|
|
28
|
+
"@types/react-dom": "^19.1.5",
|
|
29
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
30
30
|
"react": "^18.3.1",
|
|
31
31
|
"react-dom": "^18.3.1",
|
|
32
|
-
"typescript": "5.8.
|
|
33
|
-
"vite": "^6.
|
|
34
|
-
"vite-plugin-dts": "^4.5.
|
|
32
|
+
"typescript": "5.8.3",
|
|
33
|
+
"vite": "^6.3.5",
|
|
34
|
+
"vite-plugin-dts": "^4.5.4",
|
|
35
|
+
"vite-plugin-externalize-deps": "^0.9.0",
|
|
35
36
|
"vite-tsconfig-paths": "^5.1.4"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
@@ -45,13 +46,13 @@
|
|
|
45
46
|
}
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@annotorious/core": "^3.3.
|
|
49
|
-
"@annotorious/react": "^3.3.
|
|
50
|
-
"@floating-ui/react": "^0.27.
|
|
49
|
+
"@annotorious/core": "^3.3.6",
|
|
50
|
+
"@annotorious/react": "^3.3.6",
|
|
51
|
+
"@floating-ui/react": "^0.27.8",
|
|
51
52
|
"@react-aria/live-announcer": "^3.3.4",
|
|
52
|
-
"@soomo/text-annotator": "3.2.0-staging.
|
|
53
|
-
"@recogito/text-annotator-tei": "3.0.
|
|
54
|
-
"CETEIcean": "^1.9.
|
|
53
|
+
"@soomo/text-annotator": "3.2.0-staging.6",
|
|
54
|
+
"@recogito/text-annotator-tei": "3.0.3",
|
|
55
|
+
"CETEIcean": "^1.9.4",
|
|
55
56
|
"dequal": "^2.0.3",
|
|
56
57
|
"unique-random": "^4.0.0"
|
|
57
58
|
}
|
package/dist/hooks/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnnotationQuoteIdling.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnnotationQuoteIdling.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,wBAAwB,GACnC,cAAc,MAAM,GAAG,SAAS,EAChC,UAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAqB,YA2ChD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnnouncePopupNavigation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnnouncePopupNavigation.ts"],"names":[],"mappings":"AAOA,UAAU,wBAAwB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,0BAA0B,GAAI,MAAM,wBAAwB,SA2DxE,CAAC"}
|
|
@@ -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.es10.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es10.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,oCAAqC;AAQ/E,QAAI,EAAE,OAAO,6BAA6B,YAAY,2BAA2B,OAAO,SAAS,aAAc,YAAW,MAAI;AAC1H,UAAI,wCAAwC,QAAQ,wCAAwC,SAAS,SAAS,oCAAoC,aAAc,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,QAAS;AAC7C,0CAAsC;AAAA,EAC9C;AACA;AAOA,MAAM,oCAAoC;AAAA,EACtC,aAAa;AACT,QAAI;AACJ,YAAQ,aAAa,KAAK,UAAU,QAAQ,eAAe,SAAS,SAAS,WAAW;AAAA,EAChG;AAAA,EACI,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,EACf;AAAA,EACI,UAAU;AACN,QAAI,CAAC,KAAK,KAAM;AAChB,aAAS,KAAK,YAAY,KAAK,IAAI;AACnC,SAAK,OAAO;AAAA,EACpB;AAAA,EACI,SAAS,SAAS,gBAAgB,aAAa,UAAU,gDAAgD;AACrG,QAAI,oBA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KAAK,YAAY,KAAK,SAAS;AACpC,eAAS,KAAK,QAAQ,KAAK,IAAI;AAAA,IAC3C;AAAA,EACA;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
function* range(minimum, maximum) {
|
|
2
|
-
for (let number = minimum; number <= maximum; number++) {
|
|
3
|
-
yield number;
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
function randomInteger(minimum, maximum) {
|
|
7
|
-
return Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
|
|
8
|
-
}
|
|
9
|
-
function randomIntegerWithout(minimum, maximum, excludedValue) {
|
|
10
|
-
const number = randomInteger(minimum, maximum - 1);
|
|
11
|
-
return number >= excludedValue ? number + 1 : number;
|
|
12
|
-
}
|
|
13
|
-
function makeCallable(generator) {
|
|
14
|
-
const iterator = generator();
|
|
15
|
-
function random() {
|
|
16
|
-
return iterator.next().value;
|
|
17
|
-
}
|
|
18
|
-
random[Symbol.iterator] = function* () {
|
|
19
|
-
while (true) {
|
|
20
|
-
yield random();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return random;
|
|
24
|
-
}
|
|
25
|
-
function exhaustiveUniqueRandom(minimum, maximum) {
|
|
26
|
-
return makeCallable(function* () {
|
|
27
|
-
let unconsumedValues = [...range(minimum, maximum)];
|
|
28
|
-
while (true) {
|
|
29
|
-
while (unconsumedValues.length > 1) {
|
|
30
|
-
yield unconsumedValues.splice(
|
|
31
|
-
randomInteger(0, unconsumedValues.length - 1),
|
|
32
|
-
1
|
|
33
|
-
)[0];
|
|
34
|
-
}
|
|
35
|
-
const [previousValue] = unconsumedValues;
|
|
36
|
-
yield previousValue;
|
|
37
|
-
unconsumedValues = [...range(minimum, maximum)];
|
|
38
|
-
yield unconsumedValues.splice(
|
|
39
|
-
randomIntegerWithout(0, unconsumedValues.length - 1, previousValue - minimum),
|
|
40
|
-
1
|
|
41
|
-
)[0];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
exhaustiveUniqueRandom
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=react-text-annotator.es11.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es11.js","sources":["../../../node_modules/unique-random/index.js"],"sourcesContent":["function * range(minimum, maximum) {\n\tfor (let number = minimum; number <= maximum; number++) {\n\t\tyield number;\n\t}\n}\n\nfunction randomInteger(minimum, maximum) {\n\treturn Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;\n}\n\nfunction randomIntegerWithout(minimum, maximum, excludedValue) {\n\tconst number = randomInteger(minimum, maximum - 1);\n\n\treturn number >= excludedValue ? number + 1 : number;\n}\n\nfunction makeCallable(generator) {\n\tconst iterator = generator();\n\n\tfunction random() {\n\t\treturn iterator.next().value;\n\t}\n\n\trandom[Symbol.iterator] = function * () {\n\t\twhile (true) {\n\t\t\tyield random();\n\t\t}\n\t};\n\n\treturn random;\n}\n\nexport function consecutiveUniqueRandom(minimum, maximum) {\n\treturn makeCallable(function * () {\n\t\tif (minimum === maximum) {\n\t\t\twhile (true) {\n\t\t\t\tyield minimum;\n\t\t\t}\n\t\t}\n\n\t\tlet previousValue = randomInteger(minimum, maximum);\n\t\tyield previousValue;\n\n\t\twhile (true) {\n\t\t\tpreviousValue = randomIntegerWithout(minimum, maximum, previousValue);\n\t\t\tyield previousValue;\n\t\t}\n\t});\n}\n\nexport function exhaustiveUniqueRandom(minimum, maximum) {\n\treturn makeCallable(function * () {\n\t\tif (minimum === maximum) {\n\t\t\twhile (true) {\n\t\t\t\tyield minimum;\n\t\t\t}\n\t\t}\n\n\t\tlet unconsumedValues = [...range(minimum, maximum)];\n\n\t\twhile (true) {\n\t\t\twhile (unconsumedValues.length > 1) {\n\t\t\t\tyield unconsumedValues.splice(\n\t\t\t\t\trandomInteger(0, unconsumedValues.length - 1),\n\t\t\t\t\t1,\n\t\t\t\t)[0];\n\t\t\t}\n\n\t\t\tconst [previousValue] = unconsumedValues;\n\n\t\t\tyield previousValue;\n\n\t\t\tunconsumedValues = [...range(minimum, maximum)];\n\n\t\t\tyield unconsumedValues.splice(\n\t\t\t\trandomIntegerWithout(0, unconsumedValues.length - 1, previousValue - minimum),\n\t\t\t\t1,\n\t\t\t)[0];\n\t\t}\n\t});\n}\n"],"names":[],"mappings":"AAAA,UAAW,MAAM,SAAS,SAAS;AAClC,WAAS,SAAS,SAAS,UAAU,SAAS,UAAU;AACvD,UAAM;AAAA,EACR;AACA;AAEA,SAAS,cAAc,SAAS,SAAS;AACxC,SAAO,KAAK,MAAM,KAAK,OAAM,KAAM,UAAU,UAAU,EAAE,IAAI;AAC9D;AAEA,SAAS,qBAAqB,SAAS,SAAS,eAAe;AAC9D,QAAM,SAAS,cAAc,SAAS,UAAU,CAAC;AAEjD,SAAO,UAAU,gBAAgB,SAAS,IAAI;AAC/C;AAEA,SAAS,aAAa,WAAW;AAChC,QAAM,WAAW,UAAW;AAE5B,WAAS,SAAS;AACjB,WAAO,SAAS,KAAI,EAAG;AAAA,EACzB;AAEC,SAAO,OAAO,QAAQ,IAAI,aAAc;AACvC,WAAO,MAAM;AACZ,YAAM,OAAQ;AAAA,IACjB;AAAA,EACE;AAED,SAAO;AACR;AAoBO,SAAS,uBAAuB,SAAS,SAAS;AACxD,SAAO,aAAa,aAAc;AAOjC,QAAI,mBAAmB,CAAC,GAAG,MAAM,SAAS,OAAO,CAAC;AAElD,WAAO,MAAM;AACZ,aAAO,iBAAiB,SAAS,GAAG;AACnC,cAAM,iBAAiB;AAAA,UACtB,cAAc,GAAG,iBAAiB,SAAS,CAAC;AAAA,UAC5C;AAAA,QACA,EAAC,CAAC;AAAA,MACP;AAEG,YAAM,CAAC,aAAa,IAAI;AAExB,YAAM;AAEN,yBAAmB,CAAC,GAAG,MAAM,SAAS,OAAO,CAAC;AAE9C,YAAM,iBAAiB;AAAA,QACtB,qBAAqB,GAAG,iBAAiB,SAAS,GAAG,gBAAgB,OAAO;AAAA,QAC5E;AAAA,MACA,EAAC,CAAC;AAAA,IACN;AAAA,EACA,CAAE;AACF;","x_google_ignoreList":[0]}
|