@soomo/react-text-annotator 3.0.0-staging.8 → 3.1.0-staging.0

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 (78) hide show
  1. package/dist/TextAnnotator.d.ts +4 -5
  2. package/dist/TextAnnotator.d.ts.map +1 -1
  3. package/dist/TextAnnotatorPlugin.d.ts +1 -2
  4. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts +15 -0
  5. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +1 -0
  6. package/dist/TextAnnotatorPopup/index.d.ts +2 -0
  7. package/dist/TextAnnotatorPopup/index.d.ts.map +1 -0
  8. package/dist/TextAnnotatorPopup/isMobile.d.ts +2 -0
  9. package/dist/TextAnnotatorPopup/isMobile.d.ts.map +1 -0
  10. package/dist/hooks/index.d.ts +2 -0
  11. package/dist/hooks/index.d.ts.map +1 -0
  12. package/dist/hooks/useAnnouncePopupNavigation.d.ts +10 -0
  13. package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +1 -0
  14. package/dist/index.d.ts +6 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/react-text-annotator.css +31 -1
  17. package/dist/react-text-annotator.es.js +9 -5
  18. package/dist/react-text-annotator.es.js.map +1 -1
  19. package/dist/react-text-annotator.es10.js +486 -34
  20. package/dist/react-text-annotator.es10.js.map +1 -1
  21. package/dist/react-text-annotator.es11.js +9 -884
  22. package/dist/react-text-annotator.es11.js.map +1 -1
  23. package/dist/react-text-annotator.es12.js +1448 -2
  24. package/dist/react-text-annotator.es12.js.map +1 -1
  25. package/dist/react-text-annotator.es14.js +241 -109
  26. package/dist/react-text-annotator.es14.js.map +1 -1
  27. package/dist/react-text-annotator.es15.js +540 -264
  28. package/dist/react-text-annotator.es15.js.map +1 -1
  29. package/dist/react-text-annotator.es16.js +73 -49
  30. package/dist/react-text-annotator.es16.js.map +1 -1
  31. package/dist/react-text-annotator.es17.js +41 -16
  32. package/dist/react-text-annotator.es17.js.map +1 -1
  33. package/dist/{react-text-annotator.es9.js → react-text-annotator.es18.js} +1 -1
  34. package/dist/react-text-annotator.es18.js.map +1 -0
  35. package/dist/react-text-annotator.es19.js +34 -0
  36. package/dist/react-text-annotator.es19.js.map +1 -0
  37. package/dist/react-text-annotator.es2.js +2 -2
  38. package/dist/react-text-annotator.es20.js +901 -0
  39. package/dist/react-text-annotator.es20.js.map +1 -0
  40. package/dist/react-text-annotator.es21.js +5 -0
  41. package/dist/react-text-annotator.es21.js.map +1 -0
  42. package/dist/{react-text-annotator.es13.js → react-text-annotator.es22.js} +1 -1
  43. package/dist/react-text-annotator.es22.js.map +1 -0
  44. package/dist/react-text-annotator.es23.js +117 -0
  45. package/dist/react-text-annotator.es23.js.map +1 -0
  46. package/dist/react-text-annotator.es24.js +312 -0
  47. package/dist/react-text-annotator.es24.js.map +1 -0
  48. package/dist/react-text-annotator.es25.js +61 -0
  49. package/dist/react-text-annotator.es25.js.map +1 -0
  50. package/dist/react-text-annotator.es26.js +23 -0
  51. package/dist/react-text-annotator.es26.js.map +1 -0
  52. package/dist/react-text-annotator.es27.js +130 -0
  53. package/dist/react-text-annotator.es27.js.map +1 -0
  54. package/dist/react-text-annotator.es28.js +167 -0
  55. package/dist/react-text-annotator.es28.js.map +1 -0
  56. package/dist/react-text-annotator.es29.js +314 -0
  57. package/dist/react-text-annotator.es29.js.map +1 -0
  58. package/dist/react-text-annotator.es3.js +2 -2
  59. package/dist/react-text-annotator.es30.js +152 -0
  60. package/dist/react-text-annotator.es30.js.map +1 -0
  61. package/dist/react-text-annotator.es31.js +566 -0
  62. package/dist/react-text-annotator.es31.js.map +1 -0
  63. package/dist/react-text-annotator.es4.js +38 -28
  64. package/dist/react-text-annotator.es4.js.map +1 -1
  65. package/dist/react-text-annotator.es5.js +23 -47
  66. package/dist/react-text-annotator.es5.js.map +1 -1
  67. package/dist/react-text-annotator.es6.js +127 -10
  68. package/dist/react-text-annotator.es6.js.map +1 -1
  69. package/dist/react-text-annotator.es7.js +546 -1
  70. package/dist/react-text-annotator.es7.js.map +1 -1
  71. package/dist/react-text-annotator.es8.js +9 -487
  72. package/dist/react-text-annotator.es8.js.map +1 -1
  73. package/dist/tei/TEIAnnotator.d.ts +2 -3
  74. package/package.json +23 -16
  75. package/dist/TextAnnotatorPopup.d.ts +0 -14
  76. package/dist/TextAnnotatorPopup.d.ts.map +0 -1
  77. package/dist/react-text-annotator.es13.js.map +0 -1
  78. package/dist/react-text-annotator.es9.js.map +0 -1
@@ -1,117 +1,249 @@
1
- const defaultBehaviors = {
2
- "namespaces": {
3
- "tei": "http://www.tei-c.org/ns/1.0",
4
- "teieg": "http://www.tei-c.org/ns/Examples",
5
- "rng": "http://relaxng.org/ns/structure/1.0"
6
- },
7
- "tei": {
8
- "eg": ["<pre>", "</pre>"],
9
- // inserts a link inside <ptr> using the @target; the link in the
10
- // @href is piped through the rw (rewrite) function before insertion
11
- "ptr": ['<a href="$rw@target">$@target</a>'],
12
- // wraps the content of the <ref> in an HTML link with the @target in
13
- // the @href. If there are multiple @targets, only the first is used.
14
- "ref": [
15
- ["[target]", ['<a href="$rw@target">', "</a>"]]
16
- ],
17
- // creates an img tag with the @url as the src attribute
18
- "graphic": function(elt) {
19
- let content = new Image();
20
- content.src = this.rw(elt.getAttribute("url"));
21
- if (elt.hasAttribute("width")) {
22
- content.setAttribute("width", elt.getAttribute("width"));
1
+ import { computePosition, offset as offset$1, shift as shift$1, flip as flip$1, inline as inline$1 } from "./react-text-annotator.es15.js";
2
+ import { autoUpdate, platform } from "./react-text-annotator.es15.js";
3
+ import * as React from "react";
4
+ import { useLayoutEffect, useEffect } from "react";
5
+ import * as ReactDOM from "react-dom";
6
+ var index = typeof document !== "undefined" ? useLayoutEffect : useEffect;
7
+ function deepEqual(a, b) {
8
+ if (a === b) {
9
+ return true;
10
+ }
11
+ if (typeof a !== typeof b) {
12
+ return false;
13
+ }
14
+ if (typeof a === "function" && a.toString() === b.toString()) {
15
+ return true;
16
+ }
17
+ let length;
18
+ let i;
19
+ let keys;
20
+ if (a && b && typeof a === "object") {
21
+ if (Array.isArray(a)) {
22
+ length = a.length;
23
+ if (length !== b.length) return false;
24
+ for (i = length; i-- !== 0; ) {
25
+ if (!deepEqual(a[i], b[i])) {
26
+ return false;
27
+ }
23
28
  }
24
- if (elt.hasAttribute("height")) {
25
- content.setAttribute("height", elt.getAttribute("height"));
29
+ return true;
30
+ }
31
+ keys = Object.keys(a);
32
+ length = keys.length;
33
+ if (length !== Object.keys(b).length) {
34
+ return false;
35
+ }
36
+ for (i = length; i-- !== 0; ) {
37
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
38
+ return false;
26
39
  }
27
- return content;
28
- },
29
- "list": [
30
- // will only run on a list where @type="gloss"
31
- [
32
- "[type=gloss]",
33
- function(elt) {
34
- const doc = elt.ownerDocument;
35
- let dl = doc.createElement("dl");
36
- for (let child of Array.from(elt.children)) {
37
- if (child.nodeType == 1) {
38
- if (child.localName == "tei-label") {
39
- let dt = doc.createElement("dt");
40
- dt.innerHTML = child.innerHTML;
41
- dl.appendChild(dt);
42
- }
43
- if (child.localName == "tei-item") {
44
- let dd = doc.createElement("dd");
45
- dd.innerHTML = child.innerHTML;
46
- dl.appendChild(dd);
47
- }
48
- }
49
- }
50
- return dl;
51
- }
52
- ]
53
- ],
54
- "note": [
55
- // Make endnotes
56
- ["[place=end]", function(elt) {
57
- const doc = elt.ownerDocument;
58
- if (!this.noteIndex) {
59
- this["noteIndex"] = 1;
60
- } else {
61
- this.noteIndex++;
62
- }
63
- let id = "_note_" + this.noteIndex;
64
- let link = doc.createElement("a");
65
- link.setAttribute("id", "src" + id);
66
- link.setAttribute("href", "#" + id);
67
- link.innerHTML = this.noteIndex;
68
- let content = doc.createElement("sup");
69
- content.appendChild(link);
70
- let notes = doc.querySelector("ol.notes");
71
- if (!notes) {
72
- notes = doc.createElement("ol");
73
- notes.setAttribute("class", "notes");
74
- this.dom.appendChild(notes);
75
- }
76
- let note = doc.createElement("li");
77
- note.id = id;
78
- note.innerHTML = elt.innerHTML;
79
- notes.appendChild(note);
80
- return content;
81
- }],
82
- ["_", ["(", ")"]]
83
- ],
84
- // Hide the teiHeader by default
85
- "teiHeader": function(e) {
86
- this.hideContent(e, false);
87
- },
88
- // Make the title element the HTML title
89
- "title": [
90
- ["tei-titlestmt>tei-title", function(elt) {
91
- const doc = elt.ownerDocument;
92
- let title = doc.createElement("title");
93
- title.innerHTML = elt.innerText;
94
- doc.querySelector("head").appendChild(title);
95
- }]
96
- ]
97
- },
98
- "teieg": {
99
- "egXML": function(elt) {
100
- const doc = elt.ownerDocument;
101
- let pre = doc.createElement("pre");
102
- let code = doc.createElement("code");
103
- pre.appendChild(code);
104
- let content = this.serialize(elt, true).replace(/</g, "&lt;");
105
- let ws = content.match(/^[\t ]+/);
106
- if (ws) {
107
- content = content.replace(new RegExp("^" + ws[0], "mg"), "");
40
+ }
41
+ for (i = length; i-- !== 0; ) {
42
+ const key = keys[i];
43
+ if (key === "_owner" && a.$$typeof) {
44
+ continue;
45
+ }
46
+ if (!deepEqual(a[key], b[key])) {
47
+ return false;
108
48
  }
109
- code.innerHTML = content;
110
- return pre;
111
49
  }
50
+ return true;
112
51
  }
113
- };
52
+ return a !== a && b !== b;
53
+ }
54
+ function getDPR(element) {
55
+ if (typeof window === "undefined") {
56
+ return 1;
57
+ }
58
+ const win = element.ownerDocument.defaultView || window;
59
+ return win.devicePixelRatio || 1;
60
+ }
61
+ function roundByDPR(element, value) {
62
+ const dpr = getDPR(element);
63
+ return Math.round(value * dpr) / dpr;
64
+ }
65
+ function useLatestRef(value) {
66
+ const ref = React.useRef(value);
67
+ index(() => {
68
+ ref.current = value;
69
+ });
70
+ return ref;
71
+ }
72
+ function useFloating(options) {
73
+ if (options === void 0) {
74
+ options = {};
75
+ }
76
+ const {
77
+ placement = "bottom",
78
+ strategy = "absolute",
79
+ middleware = [],
80
+ platform: platform2,
81
+ elements: {
82
+ reference: externalReference,
83
+ floating: externalFloating
84
+ } = {},
85
+ transform = true,
86
+ whileElementsMounted,
87
+ open
88
+ } = options;
89
+ const [data, setData] = React.useState({
90
+ x: 0,
91
+ y: 0,
92
+ strategy,
93
+ placement,
94
+ middlewareData: {},
95
+ isPositioned: false
96
+ });
97
+ const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
98
+ if (!deepEqual(latestMiddleware, middleware)) {
99
+ setLatestMiddleware(middleware);
100
+ }
101
+ const [_reference, _setReference] = React.useState(null);
102
+ const [_floating, _setFloating] = React.useState(null);
103
+ const setReference = React.useCallback((node) => {
104
+ if (node !== referenceRef.current) {
105
+ referenceRef.current = node;
106
+ _setReference(node);
107
+ }
108
+ }, []);
109
+ const setFloating = React.useCallback((node) => {
110
+ if (node !== floatingRef.current) {
111
+ floatingRef.current = node;
112
+ _setFloating(node);
113
+ }
114
+ }, []);
115
+ const referenceEl = externalReference || _reference;
116
+ const floatingEl = externalFloating || _floating;
117
+ const referenceRef = React.useRef(null);
118
+ const floatingRef = React.useRef(null);
119
+ const dataRef = React.useRef(data);
120
+ const hasWhileElementsMounted = whileElementsMounted != null;
121
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
122
+ const platformRef = useLatestRef(platform2);
123
+ const openRef = useLatestRef(open);
124
+ const update = React.useCallback(() => {
125
+ if (!referenceRef.current || !floatingRef.current) {
126
+ return;
127
+ }
128
+ const config = {
129
+ placement,
130
+ strategy,
131
+ middleware: latestMiddleware
132
+ };
133
+ if (platformRef.current) {
134
+ config.platform = platformRef.current;
135
+ }
136
+ computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
137
+ const fullData = {
138
+ ...data2,
139
+ // The floating element's position may be recomputed while it's closed
140
+ // but still mounted (such as when transitioning out). To ensure
141
+ // `isPositioned` will be `false` initially on the next open, avoid
142
+ // setting it to `true` when `open === false` (must be specified).
143
+ isPositioned: openRef.current !== false
144
+ };
145
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
146
+ dataRef.current = fullData;
147
+ ReactDOM.flushSync(() => {
148
+ setData(fullData);
149
+ });
150
+ }
151
+ });
152
+ }, [latestMiddleware, placement, strategy, platformRef, openRef]);
153
+ index(() => {
154
+ if (open === false && dataRef.current.isPositioned) {
155
+ dataRef.current.isPositioned = false;
156
+ setData((data2) => ({
157
+ ...data2,
158
+ isPositioned: false
159
+ }));
160
+ }
161
+ }, [open]);
162
+ const isMountedRef = React.useRef(false);
163
+ index(() => {
164
+ isMountedRef.current = true;
165
+ return () => {
166
+ isMountedRef.current = false;
167
+ };
168
+ }, []);
169
+ index(() => {
170
+ if (referenceEl) referenceRef.current = referenceEl;
171
+ if (floatingEl) floatingRef.current = floatingEl;
172
+ if (referenceEl && floatingEl) {
173
+ if (whileElementsMountedRef.current) {
174
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
175
+ }
176
+ update();
177
+ }
178
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
179
+ const refs = React.useMemo(() => ({
180
+ reference: referenceRef,
181
+ floating: floatingRef,
182
+ setReference,
183
+ setFloating
184
+ }), [setReference, setFloating]);
185
+ const elements = React.useMemo(() => ({
186
+ reference: referenceEl,
187
+ floating: floatingEl
188
+ }), [referenceEl, floatingEl]);
189
+ const floatingStyles = React.useMemo(() => {
190
+ const initialStyles = {
191
+ position: strategy,
192
+ left: 0,
193
+ top: 0
194
+ };
195
+ if (!elements.floating) {
196
+ return initialStyles;
197
+ }
198
+ const x = roundByDPR(elements.floating, data.x);
199
+ const y = roundByDPR(elements.floating, data.y);
200
+ if (transform) {
201
+ return {
202
+ ...initialStyles,
203
+ transform: "translate(" + x + "px, " + y + "px)",
204
+ ...getDPR(elements.floating) >= 1.5 && {
205
+ willChange: "transform"
206
+ }
207
+ };
208
+ }
209
+ return {
210
+ position: strategy,
211
+ left: x,
212
+ top: y
213
+ };
214
+ }, [strategy, transform, elements.floating, data.x, data.y]);
215
+ return React.useMemo(() => ({
216
+ ...data,
217
+ update,
218
+ refs,
219
+ elements,
220
+ floatingStyles
221
+ }), [data, update, refs, elements, floatingStyles]);
222
+ }
223
+ const offset = (options, deps) => ({
224
+ ...offset$1(options),
225
+ options: [options, deps]
226
+ });
227
+ const shift = (options, deps) => ({
228
+ ...shift$1(options),
229
+ options: [options, deps]
230
+ });
231
+ const flip = (options, deps) => ({
232
+ ...flip$1(options),
233
+ options: [options, deps]
234
+ });
235
+ const inline = (options, deps) => ({
236
+ ...inline$1(options),
237
+ options: [options, deps]
238
+ });
114
239
  export {
115
- defaultBehaviors as default
240
+ autoUpdate,
241
+ computePosition,
242
+ flip,
243
+ inline,
244
+ offset,
245
+ platform,
246
+ shift,
247
+ useFloating
116
248
  };
117
249
  //# sourceMappingURL=react-text-annotator.es14.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es14.js","sources":["../../../node_modules/CETEIcean/src/defaultBehaviors.js"],"sourcesContent":["export default {\n \"namespaces\": {\n \"tei\": \"http://www.tei-c.org/ns/1.0\",\n \"teieg\": \"http://www.tei-c.org/ns/Examples\",\n \"rng\": \"http://relaxng.org/ns/structure/1.0\" \n },\n \"tei\": {\n \"eg\": [\"<pre>\",\"</pre>\"],\n // inserts a link inside <ptr> using the @target; the link in the\n // @href is piped through the rw (rewrite) function before insertion\n \"ptr\": [\"<a href=\\\"$rw@target\\\">$@target</a>\"],\n // wraps the content of the <ref> in an HTML link with the @target in \n // the @href. If there are multiple @targets, only the first is used.\n \"ref\": [\n [\"[target]\", [\"<a href=\\\"$rw@target\\\">\",\"</a>\"]]\n ],\n // creates an img tag with the @url as the src attribute\n \"graphic\": function(elt) {\n let content = new Image();\n content.src = this.rw(elt.getAttribute(\"url\"));\n if (elt.hasAttribute(\"width\")) {\n content.setAttribute(\"width\",elt.getAttribute(\"width\"));\n }\n if (elt.hasAttribute(\"height\")) {\n content.setAttribute(\"height\",elt.getAttribute(\"height\"));\n }\n return content;\n },\n \"list\": [\n // will only run on a list where @type=\"gloss\"\n [\"[type=gloss]\", function(elt) {\n const doc = elt.ownerDocument;\n let dl = doc.createElement(\"dl\");\n for (let child of Array.from(elt.children)) {\n // nodeType 1 is Node.ELEMENT_NODE\n if (child.nodeType == 1) {\n if (child.localName == \"tei-label\") {\n let dt = doc.createElement(\"dt\");\n dt.innerHTML = child.innerHTML;\n dl.appendChild(dt);\n }\n if (child.localName == \"tei-item\") {\n let dd = doc.createElement(\"dd\");\n dd.innerHTML = child.innerHTML;\n dl.appendChild(dd);\n }\n }\n }\n return dl;\n }\n ]],\n \"note\": [\n // Make endnotes\n [\"[place=end]\", function(elt){\n const doc = elt.ownerDocument;\n if (!this.noteIndex){\n this[\"noteIndex\"] = 1;\n } else {\n this.noteIndex++;\n }\n let id = \"_note_\" + this.noteIndex;\n let link = doc.createElement(\"a\");\n link.setAttribute(\"id\", \"src\" + id);\n link.setAttribute(\"href\", \"#\" + id);\n link.innerHTML = this.noteIndex;\n let content = doc.createElement(\"sup\");\n content.appendChild(link);\n let notes = doc.querySelector(\"ol.notes\");\n if (!notes) {\n notes = doc.createElement(\"ol\");\n notes.setAttribute(\"class\", \"notes\");\n this.dom.appendChild(notes);\n }\n let note = doc.createElement(\"li\");\n note.id = id;\n note.innerHTML = elt.innerHTML;\n notes.appendChild(note);\n return content;\n }],\n [\"_\", [\"(\",\")\"]]\n ],\n // Hide the teiHeader by default\n \"teiHeader\": function(e) {\n this.hideContent(e, false);\n },\n // Make the title element the HTML title\n \"title\": [\n [\"tei-titlestmt>tei-title\", function(elt) {\n const doc = elt.ownerDocument;\n let title = doc.createElement(\"title\");\n title.innerHTML = elt.innerText;\n doc.querySelector(\"head\").appendChild(title);\n }]\n ],\n },\n \"teieg\": {\n \"egXML\": function(elt) {\n const doc = elt.ownerDocument;\n let pre = doc.createElement(\"pre\");\n let code = doc.createElement(\"code\");\n pre.appendChild(code);\n let content = this.serialize(elt, true).replace(/</g, \"&lt;\");\n let ws = content.match(/^[\\t ]+/);\n if (ws) {\n content = content.replace(new RegExp(\"^\" + ws[0], \"mg\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,YAAY,IAAI;AACpB,UAAI,UAAU,KAAK,UAAU,KAAK,IAAI,EAAE,QAAQ,MAAM,MAAM;AAC5D,UAAI,KAAK,QAAQ,MAAM,SAAS;AAChC,UAAI,IAAI;AACN,kBAAU,QAAQ,QAAQ,IAAI,OAAO,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,EAAE;AAAA,MAC5D;AACD,WAAK,YAAY;AACjB,aAAO;AAAA,IACR;AAAA,EACF;AACH;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"react-text-annotator.es14.js","sources":["../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs"],"sourcesContent":["import { computePosition, arrow as arrow$2, offset as offset$1, shift as shift$1, limitShift as limitShift$1, flip as flip$1, size as size$1, autoPlacement as autoPlacement$1, hide as hide$1, inline as inline$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect, useEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => ({\n ...offset$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => ({\n ...shift$1(options),\n options: [options, deps]\n});\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => ({\n ...limitShift$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => ({\n ...flip$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => ({\n ...size$1(options),\n options: [options, deps]\n});\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => ({\n ...autoPlacement$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => ({\n ...hide$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => ({\n ...inline$1(options),\n options: [options, deps]\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => ({\n ...arrow$1(options),\n options: [options, deps]\n});\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n"],"names":["platform","data"],"mappings":";;;;;AAMA,IAAI,QAAQ,OAAO,aAAa,cAAc,kBAAkB;AAIhE,SAAS,UAAU,GAAG,GAAG;AACvB,MAAI,MAAM,GAAG;AACX,WAAO;AAAA,EACR;AACD,MAAI,OAAO,MAAM,OAAO,GAAG;AACzB,WAAO;AAAA,EACR;AACD,MAAI,OAAO,MAAM,cAAc,EAAE,eAAe,EAAE,YAAY;AAC5D,WAAO;AAAA,EACR;AACD,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI,KAAK,KAAK,OAAO,MAAM,UAAU;AACnC,QAAI,MAAM,QAAQ,CAAC,GAAG;AACpB,eAAS,EAAE;AACX,UAAI,WAAW,EAAE,OAAQ,QAAO;AAChC,WAAK,IAAI,QAAQ,QAAQ,KAAI;AAC3B,YAAI,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG;AAC1B,iBAAO;AAAA,QACR;AAAA,MACF;AACD,aAAO;AAAA,IACR;AACD,WAAO,OAAO,KAAK,CAAC;AACpB,aAAS,KAAK;AACd,QAAI,WAAW,OAAO,KAAK,CAAC,EAAE,QAA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