@soomo/react-text-annotator 3.1.0-staging.22 → 3.1.0-staging.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/TextAnnotationPopup/TextAnnotationPopup.d.ts.map +1 -1
  2. package/dist/hooks/useAnnotationQuoteIdling.d.ts.map +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/react-text-annotator.css +1 -31
  6. package/dist/react-text-annotator.es.js +245 -21
  7. package/dist/react-text-annotator.es.js.map +1 -1
  8. package/dist/tei/CETEIcean.d.ts +1 -0
  9. package/dist/tei/CETEIcean.d.ts.map +1 -1
  10. package/dist/tei/TEIAnnotator.d.ts.map +1 -1
  11. package/package.json +13 -12
  12. package/dist/react-text-annotator.es11.js +0 -490
  13. package/dist/react-text-annotator.es11.js.map +0 -1
  14. package/dist/react-text-annotator.es12.js +0 -85
  15. package/dist/react-text-annotator.es12.js.map +0 -1
  16. package/dist/react-text-annotator.es13.js +0 -48
  17. package/dist/react-text-annotator.es13.js.map +0 -1
  18. package/dist/react-text-annotator.es14.js +0 -28
  19. package/dist/react-text-annotator.es14.js.map +0 -1
  20. package/dist/react-text-annotator.es15.js +0 -1600
  21. package/dist/react-text-annotator.es15.js.map +0 -1
  22. package/dist/react-text-annotator.es16.js +0 -12
  23. package/dist/react-text-annotator.es16.js.map +0 -1
  24. package/dist/react-text-annotator.es18.js +0 -285
  25. package/dist/react-text-annotator.es18.js.map +0 -1
  26. package/dist/react-text-annotator.es19.js +0 -590
  27. package/dist/react-text-annotator.es19.js.map +0 -1
  28. package/dist/react-text-annotator.es2.js +0 -64
  29. package/dist/react-text-annotator.es2.js.map +0 -1
  30. package/dist/react-text-annotator.es20.js +0 -5
  31. package/dist/react-text-annotator.es20.js.map +0 -1
  32. package/dist/react-text-annotator.es21.js +0 -34
  33. package/dist/react-text-annotator.es21.js.map +0 -1
  34. package/dist/react-text-annotator.es22.js +0 -901
  35. package/dist/react-text-annotator.es22.js.map +0 -1
  36. package/dist/react-text-annotator.es23.js +0 -5
  37. package/dist/react-text-annotator.es23.js.map +0 -1
  38. package/dist/react-text-annotator.es24.js +0 -5
  39. package/dist/react-text-annotator.es24.js.map +0 -1
  40. package/dist/react-text-annotator.es25.js +0 -117
  41. package/dist/react-text-annotator.es25.js.map +0 -1
  42. package/dist/react-text-annotator.es26.js +0 -312
  43. package/dist/react-text-annotator.es26.js.map +0 -1
  44. package/dist/react-text-annotator.es27.js +0 -61
  45. package/dist/react-text-annotator.es27.js.map +0 -1
  46. package/dist/react-text-annotator.es28.js +0 -23
  47. package/dist/react-text-annotator.es28.js.map +0 -1
  48. package/dist/react-text-annotator.es29.js +0 -130
  49. package/dist/react-text-annotator.es29.js.map +0 -1
  50. package/dist/react-text-annotator.es3.js +0 -29
  51. package/dist/react-text-annotator.es3.js.map +0 -1
  52. package/dist/react-text-annotator.es30.js +0 -167
  53. package/dist/react-text-annotator.es30.js.map +0 -1
  54. package/dist/react-text-annotator.es31.js +0 -314
  55. package/dist/react-text-annotator.es31.js.map +0 -1
  56. package/dist/react-text-annotator.es32.js +0 -152
  57. package/dist/react-text-annotator.es32.js.map +0 -1
  58. package/dist/react-text-annotator.es33.js +0 -629
  59. package/dist/react-text-annotator.es33.js.map +0 -1
  60. package/dist/react-text-annotator.es4.js +0 -43
  61. package/dist/react-text-annotator.es4.js.map +0 -1
  62. package/dist/react-text-annotator.es5.js +0 -48
  63. package/dist/react-text-annotator.es5.js.map +0 -1
  64. package/dist/react-text-annotator.es6.js +0 -29
  65. package/dist/react-text-annotator.es6.js.map +0 -1
  66. package/dist/react-text-annotator.es7.js +0 -151
  67. package/dist/react-text-annotator.es7.js.map +0 -1
  68. package/dist/react-text-annotator.es8.js +0 -562
  69. package/dist/react-text-annotator.es8.js.map +0 -1
  70. package/dist/react-text-annotator.es9.js +0 -13
  71. package/dist/react-text-annotator.es9.js.map +0 -1
@@ -1,562 +0,0 @@
1
- const re = "not-annotatable", tt = `.${re}`;
2
- /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform);
3
- const Nt = (t) => {
4
- const e = t.cloneContents();
5
- return e.querySelectorAll(tt).forEach((n) => n.remove()), e;
6
- }, Re = (t, e, n = 10, o) => {
7
- const i = e, s = document.createRange();
8
- s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
9
- const a = Nt(s).textContent, r = document.createRange();
10
- r.setStart(t.endContainer, t.endOffset), i === document.body ? r.setEnd(i, i.childNodes.length) : r.setEndAfter(i);
11
- const l = Nt(r).textContent;
12
- return {
13
- prefix: a.substring(a.length - n),
14
- suffix: l.substring(0, n)
15
- };
16
- };
17
- const Y = [];
18
- for (let t = 0; t < 256; ++t)
19
- Y.push((t + 256).toString(16).slice(1));
20
- function an(t, e = 0) {
21
- return (Y[t[e + 0]] + Y[t[e + 1]] + Y[t[e + 2]] + Y[t[e + 3]] + "-" + Y[t[e + 4]] + Y[t[e + 5]] + "-" + Y[t[e + 6]] + Y[t[e + 7]] + "-" + Y[t[e + 8]] + Y[t[e + 9]] + "-" + Y[t[e + 10]] + Y[t[e + 11]] + Y[t[e + 12]] + Y[t[e + 13]] + Y[t[e + 14]] + Y[t[e + 15]]).toLowerCase();
22
- }
23
- let Ct;
24
- const cn = new Uint8Array(16);
25
- function ln() {
26
- if (!Ct) {
27
- if (typeof crypto > "u" || !crypto.getRandomValues)
28
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
29
- Ct = crypto.getRandomValues.bind(crypto);
30
- }
31
- return Ct(cn);
32
- }
33
- const dn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Qt = { randomUUID: dn };
34
- function fe(t, e, n) {
35
- if (Qt.randomUUID && !e && !t)
36
- return Qt.randomUUID();
37
- t = t || {};
38
- const o = t.random || (t.rng || ln)();
39
- return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, an(o);
40
- }
41
- const K = [];
42
- for (let t = 0; t < 256; ++t)
43
- K.push((t + 256).toString(16).slice(1));
44
- typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
45
- const _n = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
46
- let Yn = (t = 21) => {
47
- let e = "", n = crypto.getRandomValues(new Uint8Array(t));
48
- for (; t--; )
49
- e += _n[n[t] & 63];
50
- return e;
51
- };
52
- const Dn = (t) => {
53
- const e = JSON.stringify(t);
54
- let n = 0;
55
- for (let o = 0, i = e.length; o < i; o++) {
56
- let s = e.charCodeAt(o);
57
- n = (n << 5) - n + s, n |= 0;
58
- }
59
- return `${n}`;
60
- }, ge = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Xn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
61
- const { id: o, type: i, purpose: s, value: a, created: r, modified: l, creator: f, ...h } = n;
62
- return {
63
- id: o || `temp-${Dn(n)}`,
64
- annotation: e,
65
- type: i,
66
- purpose: s,
67
- value: a,
68
- creator: ge(f),
69
- created: r ? new Date(r) : void 0,
70
- updated: l ? new Date(l) : void 0,
71
- ...h
72
- };
73
- }), Pn = (t) => t.map((e) => {
74
- var n;
75
- const { annotation: o, created: i, updated: s, ...a } = e, r = {
76
- ...a,
77
- created: i == null ? void 0 : i.toISOString(),
78
- modified: s == null ? void 0 : s.toISOString()
79
- };
80
- return (n = r.id) != null && n.startsWith("temp-") && delete r.id, r;
81
- });
82
- Yn();
83
- const Ao = (t, e) => ({
84
- parse: (n) => jn(n),
85
- serialize: (n) => zn(n, t, e)
86
- }), $n = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, Hn = (t) => {
87
- const {
88
- id: e,
89
- creator: n,
90
- created: o,
91
- modified: i,
92
- target: s
93
- } = t, a = Array.isArray(s) ? s : [s];
94
- if (a.length === 0)
95
- return { error: Error(`No targets found for annotation: ${t.id}`) };
96
- const r = {
97
- creator: ge(n),
98
- created: o ? new Date(o) : void 0,
99
- updated: i ? new Date(i) : void 0,
100
- annotation: e,
101
- selector: [],
102
- // @ts-expect-error: `styleClass` is not part of the core `TextAnnotationTarget` type
103
- styleClass: "styleClass" in a[0] ? a[0].styleClass : void 0
104
- };
105
- for (const l of a) {
106
- const h = (Array.isArray(l.selector) ? l.selector : [l.selector]).reduce((u, p) => {
107
- switch (p.type) {
108
- case "TextQuoteSelector":
109
- u.quote = p.exact;
110
- break;
111
- case "TextPositionSelector":
112
- u.start = p.start, u.end = p.end;
113
- break;
114
- }
115
- return u;
116
- }, {});
117
- if ($n(h))
118
- r.selector.push(
119
- {
120
- ...h,
121
- id: l.id,
122
- // @ts-expect-error: `scope` is not part of the core `TextSelector` type
123
- scope: l.scope
124
- }
125
- );
126
- else {
127
- const u = [
128
- h.start ? void 0 : "TextPositionSelector",
129
- h.quote ? void 0 : "TextQuoteSelector"
130
- ].filter(Boolean);
131
- return { error: Error(`Missing selector types: ${u.join(" and ")} for annotation: ${t.id}`) };
132
- }
133
- }
134
- return { parsed: r };
135
- }, jn = (t) => {
136
- const e = t.id || fe(), {
137
- creator: n,
138
- created: o,
139
- modified: i,
140
- body: s,
141
- ...a
142
- } = t, r = Xn(s, e), l = Hn(t);
143
- return "error" in l ? { error: l.error } : {
144
- parsed: {
145
- ...a,
146
- id: e,
147
- bodies: r,
148
- target: l.parsed
149
- }
150
- };
151
- }, zn = (t, e, n) => {
152
- const { bodies: o, target: i, ...s } = t, {
153
- selector: a,
154
- creator: r,
155
- created: l,
156
- updated: f,
157
- ...h
158
- } = i, u = a.map((p) => {
159
- const { id: g, quote: b, start: w, end: y, range: d } = p, { prefix: c, suffix: A } = Re(d, n), E = [{
160
- type: "TextQuoteSelector",
161
- exact: b,
162
- prefix: c,
163
- suffix: A
164
- }, {
165
- type: "TextPositionSelector",
166
- start: w,
167
- end: y
168
- }];
169
- return {
170
- ...h,
171
- id: g,
172
- // @ts-expect-error: `scope` is not part of the core `TextSelector` type
173
- scope: "scope" in p ? p.scope : void 0,
174
- source: e,
175
- selector: E
176
- };
177
- });
178
- return {
179
- ...s,
180
- "@context": "http://www.w3.org/ns/anno.jsonld",
181
- id: t.id,
182
- type: "Annotation",
183
- body: Pn(t.bodies),
184
- creator: r,
185
- created: l == null ? void 0 : l.toISOString(),
186
- modified: f == null ? void 0 : f.toISOString(),
187
- target: u
188
- };
189
- };
190
- const kt = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : false;
191
- function It(t, e, n, o) {
192
- t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent("on".concat(e), n);
193
- }
194
- function ot(t, e, n, o) {
195
- t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent("on".concat(e), n);
196
- }
197
- function ye(t, e) {
198
- const n = e.slice(0, e.length - 1);
199
- for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];
200
- return n;
201
- }
202
- function be(t) {
203
- typeof t != "string" && (t = ""), t = t.replace(/\s/g, "");
204
- const e = t.split(",");
205
- let n = e.lastIndexOf("");
206
- for (; n >= 0; )
207
- e[n - 1] += ",", e.splice(n, 1), n = e.lastIndexOf("");
208
- return e;
209
- }
210
- function io(t, e) {
211
- const n = t.length >= e.length ? t : e, o = t.length >= e.length ? e : t;
212
- let i = true;
213
- for (let s = 0; s < n.length; s++)
214
- o.indexOf(n[s]) === -1 && (i = false);
215
- return i;
216
- }
217
- const lt = {
218
- backspace: 8,
219
- "⌫": 8,
220
- tab: 9,
221
- clear: 12,
222
- enter: 13,
223
- "↩": 13,
224
- return: 13,
225
- esc: 27,
226
- escape: 27,
227
- space: 32,
228
- left: 37,
229
- up: 38,
230
- right: 39,
231
- down: 40,
232
- del: 46,
233
- delete: 46,
234
- ins: 45,
235
- insert: 45,
236
- home: 36,
237
- end: 35,
238
- pageup: 33,
239
- pagedown: 34,
240
- capslock: 20,
241
- num_0: 96,
242
- num_1: 97,
243
- num_2: 98,
244
- num_3: 99,
245
- num_4: 100,
246
- num_5: 101,
247
- num_6: 102,
248
- num_7: 103,
249
- num_8: 104,
250
- num_9: 105,
251
- num_multiply: 106,
252
- num_add: 107,
253
- num_enter: 108,
254
- num_subtract: 109,
255
- num_decimal: 110,
256
- num_divide: 111,
257
- "⇪": 20,
258
- ",": 188,
259
- ".": 190,
260
- "/": 191,
261
- "`": 192,
262
- "-": kt ? 173 : 189,
263
- "=": kt ? 61 : 187,
264
- ";": kt ? 59 : 186,
265
- "'": 222,
266
- "[": 219,
267
- "]": 221,
268
- "\\": 220
269
- }, H = {
270
- // shiftKey
271
- "⇧": 16,
272
- shift: 16,
273
- // altKey
274
- "⌥": 18,
275
- alt: 18,
276
- option: 18,
277
- // ctrlKey
278
- "⌃": 17,
279
- ctrl: 17,
280
- control: 17,
281
- // metaKey
282
- "⌘": 91,
283
- cmd: 91,
284
- command: 91
285
- }, Vt = {
286
- 16: "shiftKey",
287
- 18: "altKey",
288
- 17: "ctrlKey",
289
- 91: "metaKey",
290
- shiftKey: 16,
291
- ctrlKey: 17,
292
- altKey: 18,
293
- metaKey: 91
294
- }, D = {
295
- 16: false,
296
- 18: false,
297
- 17: false,
298
- 91: false
299
- }, _ = {};
300
- for (let t = 1; t < 20; t++)
301
- lt["f".concat(t)] = 111 + t;
302
- let I = [], ct = null, we = "all";
303
- const z = /* @__PURE__ */ new Map(), ut = (t) => lt[t.toLowerCase()] || H[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), so = (t) => Object.keys(lt).find((e) => lt[e] === t), ro = (t) => Object.keys(H).find((e) => H[e] === t);
304
- function Ae(t) {
305
- we = t || "all";
306
- }
307
- function dt() {
308
- return we || "all";
309
- }
310
- function ao() {
311
- return I.slice(0);
312
- }
313
- function co() {
314
- return I.map((t) => so(t) || ro(t) || String.fromCharCode(t));
315
- }
316
- function lo() {
317
- const t = [];
318
- return Object.keys(_).forEach((e) => {
319
- _[e].forEach((n) => {
320
- let {
321
- key: o,
322
- scope: i,
323
- mods: s,
324
- shortcut: a
325
- } = n;
326
- t.push({
327
- scope: i,
328
- shortcut: a,
329
- mods: s,
330
- keys: o.split("+").map((r) => ut(r))
331
- });
332
- });
333
- }), t;
334
- }
335
- function uo(t) {
336
- const e = t.target || t.srcElement, {
337
- tagName: n
338
- } = e;
339
- let o = true;
340
- const i = n === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(e.type);
341
- return (e.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !e.readOnly) && (o = false), o;
342
- }
343
- function fo(t) {
344
- return typeof t == "string" && (t = ut(t)), I.indexOf(t) !== -1;
345
- }
346
- function ho(t, e) {
347
- let n, o;
348
- t || (t = dt());
349
- for (const i in _)
350
- if (Object.prototype.hasOwnProperty.call(_, i))
351
- for (n = _[i], o = 0; o < n.length; )
352
- n[o].scope === t ? n.splice(o, 1).forEach((a) => {
353
- let {
354
- element: r
355
- } = a;
356
- return Xt(r);
357
- }) : o++;
358
- dt() === t && Ae(e || "all");
359
- }
360
- function po(t) {
361
- let e = t.keyCode || t.which || t.charCode;
362
- const n = I.indexOf(e);
363
- if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in D) {
364
- D[e] = false;
365
- for (const o in H) H[o] === e && (P[o] = false);
366
- }
367
- }
368
- function xe(t) {
369
- if (typeof t > "u")
370
- Object.keys(_).forEach((i) => {
371
- Array.isArray(_[i]) && _[i].forEach((s) => yt(s)), delete _[i];
372
- }), Xt(null);
373
- else if (Array.isArray(t))
374
- t.forEach((i) => {
375
- i.key && yt(i);
376
- });
377
- else if (typeof t == "object")
378
- t.key && yt(t);
379
- else if (typeof t == "string") {
380
- for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++)
381
- n[o - 1] = arguments[o];
382
- let [i, s] = n;
383
- typeof i == "function" && (s = i, i = ""), yt({
384
- key: t,
385
- scope: i,
386
- method: s,
387
- splitKey: "+"
388
- });
389
- }
390
- }
391
- const yt = (t) => {
392
- let {
393
- key: e,
394
- scope: n,
395
- method: o,
396
- splitKey: i = "+"
397
- } = t;
398
- be(e).forEach((a) => {
399
- const r = a.split(i), l = r.length, f = r[l - 1], h = f === "*" ? "*" : ut(f);
400
- if (!_[h]) return;
401
- n || (n = dt());
402
- const u = l > 1 ? ye(H, r) : [], p = [];
403
- _[h] = _[h].filter((g) => {
404
- const w = (o ? g.method === o : true) && g.scope === n && io(g.mods, u);
405
- return w && p.push(g.element), !w;
406
- }), p.forEach((g) => Xt(g));
407
- });
408
- };
409
- function ne(t, e, n, o) {
410
- if (e.element !== o)
411
- return;
412
- let i;
413
- if (e.scope === n || e.scope === "all") {
414
- i = e.mods.length > 0;
415
- for (const s in D)
416
- Object.prototype.hasOwnProperty.call(D, s) && (!D[s] && e.mods.indexOf(+s) > -1 || D[s] && e.mods.indexOf(+s) === -1) && (i = false);
417
- (e.mods.length === 0 && !D[16] && !D[18] && !D[17] && !D[91] || i || e.shortcut === "*") && (e.keys = [], e.keys = e.keys.concat(I), e.method(t, e) === false && (t.preventDefault ? t.preventDefault() : t.returnValue = false, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = true)));
418
- }
419
- }
420
- function oe(t, e) {
421
- const n = _["*"];
422
- let o = t.keyCode || t.which || t.charCode;
423
- if (!P.filter.call(this, t)) return;
424
- if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((r) => {
425
- const l = Vt[r];
426
- t[r] && I.indexOf(l) === -1 ? I.push(l) : !t[r] && I.indexOf(l) > -1 ? I.splice(I.indexOf(l), 1) : r === "metaKey" && t[r] && I.length === 3 && (t.ctrlKey || t.shiftKey || t.altKey || (I = I.slice(I.indexOf(l))));
427
- }), o in D) {
428
- D[o] = true;
429
- for (const r in H)
430
- H[r] === o && (P[r] = true);
431
- if (!n) return;
432
- }
433
- for (const r in D)
434
- Object.prototype.hasOwnProperty.call(D, r) && (D[r] = t[Vt[r]]);
435
- t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18), D[17] = true, D[18] = true);
436
- const i = dt();
437
- if (n)
438
- for (let r = 0; r < n.length; r++)
439
- n[r].scope === i && (t.type === "keydown" && n[r].keydown || t.type === "keyup" && n[r].keyup) && ne(t, n[r], i, e);
440
- if (!(o in _)) return;
441
- const s = _[o], a = s.length;
442
- for (let r = 0; r < a; r++)
443
- if ((t.type === "keydown" && s[r].keydown || t.type === "keyup" && s[r].keyup) && s[r].key) {
444
- const l = s[r], {
445
- splitKey: f
446
- } = l, h = l.key.split(f), u = [];
447
- for (let p = 0; p < h.length; p++)
448
- u.push(ut(h[p]));
449
- u.sort().join("") === I.sort().join("") && ne(t, l, i, e);
450
- }
451
- }
452
- function P(t, e, n) {
453
- I = [];
454
- const o = be(t);
455
- let i = [], s = "all", a = document, r = 0, l = false, f = true, h = "+", u = false, p = false;
456
- for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (a = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (f = e.keydown), e.capture !== void 0 && (u = e.capture), typeof e.splitKey == "string" && (h = e.splitKey), e.single === true && (p = true)), typeof e == "string" && (s = e), p && xe(t, s); r < o.length; r++)
457
- t = o[r].split(h), i = [], t.length > 1 && (i = ye(H, t)), t = t[t.length - 1], t = t === "*" ? "*" : ut(t), t in _ || (_[t] = []), _[t].push({
458
- keyup: l,
459
- keydown: f,
460
- scope: s,
461
- mods: i,
462
- shortcut: o[r],
463
- method: n,
464
- key: o[r],
465
- splitKey: h,
466
- element: a
467
- });
468
- if (typeof a < "u" && window) {
469
- if (!z.has(a)) {
470
- const g = function() {
471
- let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
472
- return oe(w, a);
473
- }, b = function() {
474
- let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
475
- oe(w, a), po(w);
476
- };
477
- z.set(a, {
478
- keydownListener: g,
479
- keyupListenr: b,
480
- capture: u
481
- }), It(a, "keydown", g, u), It(a, "keyup", b, u);
482
- }
483
- if (!ct) {
484
- const g = () => {
485
- I = [];
486
- };
487
- ct = {
488
- listener: g,
489
- capture: u
490
- }, It(window, "focus", g, u);
491
- }
492
- }
493
- }
494
- function go(t) {
495
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "all";
496
- Object.keys(_).forEach((n) => {
497
- _[n].filter((i) => i.scope === e && i.shortcut === t).forEach((i) => {
498
- i && i.method && i.method();
499
- });
500
- });
501
- }
502
- function Xt(t) {
503
- const e = Object.values(_).flat();
504
- if (e.findIndex((o) => {
505
- let {
506
- element: i
507
- } = o;
508
- return i === t;
509
- }) < 0) {
510
- const {
511
- keydownListener: o,
512
- keyupListenr: i,
513
- capture: s
514
- } = z.get(t) || {};
515
- o && i && (ot(t, "keyup", i, s), ot(t, "keydown", o, s), z.delete(t));
516
- }
517
- if ((e.length <= 0 || z.size <= 0) && (Object.keys(z).forEach((i) => {
518
- const {
519
- keydownListener: s,
520
- keyupListenr: a,
521
- capture: r
522
- } = z.get(i) || {};
523
- s && a && (ot(i, "keyup", a, r), ot(i, "keydown", s, r), z.delete(i));
524
- }), z.clear(), Object.keys(_).forEach((i) => delete _[i]), ct)) {
525
- const {
526
- listener: i,
527
- capture: s
528
- } = ct;
529
- ot(window, "focus", i, s), ct = null;
530
- }
531
- }
532
- const _t = {
533
- getPressedKeyString: co,
534
- setScope: Ae,
535
- getScope: dt,
536
- deleteScope: ho,
537
- getPressedKeyCodes: ao,
538
- getAllKeyCodes: lo,
539
- isPressed: fo,
540
- filter: uo,
541
- trigger: go,
542
- unbind: xe,
543
- keyMap: lt,
544
- modifier: H,
545
- modifierMap: Vt
546
- };
547
- for (const t in _t)
548
- Object.prototype.hasOwnProperty.call(_t, t) && (P[t] = _t[t]);
549
- if (typeof window < "u") {
550
- const t = window.hotkeys;
551
- P.noConflict = (e) => (e && window.hotkeys === P && (window.hotkeys = t), P), window.hotkeys = P;
552
- }
553
- export {
554
- re as NOT_ANNOTATABLE_CLASS,
555
- tt as NOT_ANNOTATABLE_SELECTOR,
556
- Ao as W3CTextFormat,
557
- Re as getQuoteContext,
558
- Nt as getRangeAnnotatableContents,
559
- jn as parseW3CTextAnnotation,
560
- zn as serializeW3CTextAnnotation
561
- };
562
- //# sourceMappingURL=react-text-annotator.es8.js.map