@frontera-sdk/chat-ui 1.50.40

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 (148) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +348 -0
  3. package/dist/af-DK_CjRn6-OPBHDTNZ.js +197 -0
  4. package/dist/agent-picker.d.ts +38 -0
  5. package/dist/agent-picker.js +8 -0
  6. package/dist/as-BPtSu6VN-O4ZZEAJG.js +11 -0
  7. package/dist/be-CrQ0smca-5HIE5K27.js +11 -0
  8. package/dist/bg-CrQqGwni-3IRVPZQ7.js +11 -0
  9. package/dist/bn-NCLZcWHi-XOZJFNIB.js +11 -0
  10. package/dist/ca-SUf6Y2Om-V6F2EBCA.js +38 -0
  11. package/dist/capture-NO5ZIGP6.js +1652 -0
  12. package/dist/chat.css +3555 -0
  13. package/dist/chat.d.ts +161 -0
  14. package/dist/chat.js +60498 -0
  15. package/dist/chunk-2KEBRV3W.js +191 -0
  16. package/dist/chunk-6BPHEBCF.js +639 -0
  17. package/dist/chunk-6HYPVNVA.js +25 -0
  18. package/dist/chunk-7ADM3CKD.js +10 -0
  19. package/dist/chunk-AFVU5VT6.js +5601 -0
  20. package/dist/chunk-BEJ3HQG4.js +93 -0
  21. package/dist/chunk-CCVPZVFK.js +28 -0
  22. package/dist/chunk-DGDHKMDB.js +10 -0
  23. package/dist/chunk-FXKXDR5K.js +2166 -0
  24. package/dist/chunk-GTQH7MPF.js +129 -0
  25. package/dist/chunk-I7SXWUAN.js +1258 -0
  26. package/dist/chunk-IQRPGFLI.js +234 -0
  27. package/dist/chunk-IXDM5R55.js +23 -0
  28. package/dist/chunk-JD6ETTXC.js +178 -0
  29. package/dist/chunk-OP4MLJDA.js +215 -0
  30. package/dist/chunk-PQZ2CS26.js +2315 -0
  31. package/dist/chunk-PR4QN5HX.js +38 -0
  32. package/dist/chunk-PUIVKDV5.js +271 -0
  33. package/dist/chunk-QSSFBZAS.js +6914 -0
  34. package/dist/chunk-RAKKA3WU.js +5896 -0
  35. package/dist/chunk-RB2Y4NYC.js +681 -0
  36. package/dist/chunk-VDZH5Z3K.js +72 -0
  37. package/dist/chunk-WMN6BPPS.js +49 -0
  38. package/dist/chunk-WO6DJLFE.js +10857 -0
  39. package/dist/chunk-X5E2DJVO.js +47634 -0
  40. package/dist/chunk-XJFTVKLW.js +2687 -0
  41. package/dist/chunk-ZS6PXIZP.js +187 -0
  42. package/dist/client.d.ts +89 -0
  43. package/dist/client.js +20 -0
  44. package/dist/composer.d.ts +23 -0
  45. package/dist/composer.js +89 -0
  46. package/dist/cop-C3sk0IUo-CIZA2H43.js +11 -0
  47. package/dist/credential.d.ts +75 -0
  48. package/dist/credential.js +3 -0
  49. package/dist/cs-CmAteokq-HAKEQPB4.js +17 -0
  50. package/dist/cu-CBUlrW6Y-QTZ6ZLA4.js +32 -0
  51. package/dist/cy-BBPa6z2x-MX6DGDNW.js +11 -0
  52. package/dist/da-CCDXfXtG-5YEOHMG3.js +11 -0
  53. package/dist/de-1901-CWoAOigE-63QFSF2A.js +11 -0
  54. package/dist/de-1996-BL6awyxG-R2PHKMAB.js +11 -0
  55. package/dist/de-ch-1901-hVThVHVb-JSDB53OZ.js +11 -0
  56. package/dist/el-monoton-D3aKqTz2-2V4OOFBB.js +11 -0
  57. package/dist/el-polyton-ogVWcTzh-3U7NGQMT.js +11 -0
  58. package/dist/en-gb-B7Al27b_-UKCBQFSU.js +21 -0
  59. package/dist/es-DcaaHPU_-NOBXSOZK.js +11 -0
  60. package/dist/esm-MHF25KDL.js +3 -0
  61. package/dist/et-B_spaleu-5UAYIW62.js +11 -0
  62. package/dist/eu-Ctv_kq9Z-V5DREOPN.js +11 -0
  63. package/dist/fi-RW5VB8Yp-YSXBK7LW.js +11 -0
  64. package/dist/fr-BC2onEz9-7KH5T76G.js +11 -0
  65. package/dist/frame.d.ts +59 -0
  66. package/dist/frame.js +111 -0
  67. package/dist/fur-AC12wySk-4PD2Y72H.js +11 -0
  68. package/dist/ga-Cn6LkudM-RRAAJT3N.js +58 -0
  69. package/dist/gl-DZGc-K_G-KYSXXTCY.js +11 -0
  70. package/dist/grc-DOlGgO8T-2HXBZVJ5.js +11 -0
  71. package/dist/gu-Bjl0l-cf-4CFSVZHZ.js +11 -0
  72. package/dist/header.d.ts +78 -0
  73. package/dist/header.js +18 -0
  74. package/dist/hi-DsAaTPCC-KMCFBWK7.js +11 -0
  75. package/dist/hr-DT1SBBes-X2TIX6EI.js +11 -0
  76. package/dist/hsb-DC_ITc1e-PXLERA7R.js +46 -0
  77. package/dist/hu-DVk7Y_ka-PJPVU54B.js +11 -0
  78. package/dist/hy-e995ysyO-MZBRFX52.js +11 -0
  79. package/dist/ia-Cr4TJH0c-D3O2FHGP.js +22 -0
  80. package/dist/id-DifDyWg9-MZ2BGHWI.js +58 -0
  81. package/dist/is-BT8UVRze-CZZCKEFI.js +11 -0
  82. package/dist/it-Bt_Meacx-T4Y5JYV6.js +11 -0
  83. package/dist/ka-jyoLzyDE-ES6EXZLW.js +11 -0
  84. package/dist/kmr-Cfwhwuff-TSW2R2KS.js +11 -0
  85. package/dist/kn-C6Lov-DP-B4BL47CE.js +11 -0
  86. package/dist/la-DuvHjUWw-6K7TFU6X.js +11 -0
  87. package/dist/la-x-classic-yTyAOQEt-YWTKMM2L.js +11 -0
  88. package/dist/la-x-liturgic-CXeQb4FY-B772L5E7.js +11 -0
  89. package/dist/lib-3ZKX25RJ.js +4511 -0
  90. package/dist/lt-BBe8DlDF-4YINVOZR.js +11 -0
  91. package/dist/lv-Q2BBHnzp-TMVQ3MX2.js +11 -0
  92. package/dist/message.d.ts +64 -0
  93. package/dist/message.js +18 -0
  94. package/dist/ml-2xLVYkVY-NGZLAPIN.js +11 -0
  95. package/dist/mn-cyrl-lHM4n0oC-DGBYYUT3.js +11 -0
  96. package/dist/mn-cyrl-x-lmc-3aetruI8-QHJABMOO.js +11 -0
  97. package/dist/mr-CjWJPVmH-X5UHV65O.js +11 -0
  98. package/dist/mul-ethi-D_CMSMEq-H7UMQSOQ.js +11 -0
  99. package/dist/nb-DI8u59ch-J4CAVI4Y.js +122 -0
  100. package/dist/new-session-Dw7JOgzu.d.ts +141 -0
  101. package/dist/new-session.d.ts +4 -0
  102. package/dist/new-session.js +10 -0
  103. package/dist/nl-BHQJ6Gvn-7BH55RA7.js +52 -0
  104. package/dist/nn-ntZvarUK-KKNCHHJ4.js +122 -0
  105. package/dist/no-B8ItS0F3-3ZXIRJ6U.js +120 -0
  106. package/dist/oauth-callback.d.ts +35 -0
  107. package/dist/oauth-callback.js +18 -0
  108. package/dist/oc-P_i3-xLA-XZM6E5YZ.js +11 -0
  109. package/dist/or-50rxpoq4-5VELAFMJ.js +11 -0
  110. package/dist/pa-C54UG8eN-WEJPMZ6Z.js +11 -0
  111. package/dist/parts.d.ts +49 -0
  112. package/dist/parts.js +106 -0
  113. package/dist/pdf-cover-thumbnail-inner-4N2Q5AAG.js +36 -0
  114. package/dist/pdf-deck-view-inner-FZVLAEQR.js +575 -0
  115. package/dist/pdf-document-view-inner-6DF54JWK.js +585 -0
  116. package/dist/pdf-viewer-inner-GPES3KG2.js +256 -0
  117. package/dist/pending-cards.d.ts +26 -0
  118. package/dist/pending-cards.js +9 -0
  119. package/dist/pi-B9cgjyG1-GD5ASDDU.js +11 -0
  120. package/dist/pl-9fg-ESVt-UMX7MCJM.js +32 -0
  121. package/dist/platform.css +4013 -0
  122. package/dist/pms-BRGfm5gS-SSE3AUW5.js +11 -0
  123. package/dist/pt-Cum2_NUC-W35JYVR4.js +11 -0
  124. package/dist/rm-C0MIK9N4-IWL4YTNT.js +11 -0
  125. package/dist/ro-0fmdH0HA-46WUTOYH.js +11 -0
  126. package/dist/ru-v4l-ayaq-BUGK6XCN.js +196 -0
  127. package/dist/sa-CKY9c_Vq-4KIJOI5Y.js +11 -0
  128. package/dist/sh-cyrl-BpCRFOmq-DSLQ4UY2.js +128 -0
  129. package/dist/sh-latn-sRy4Tuaj-UNQOR63V.js +128 -0
  130. package/dist/sk-_iOeDNrQ-NCTQKH25.js +17 -0
  131. package/dist/sl-DpiklF-D-6GG5TDVN.js +11 -0
  132. package/dist/sr-cyrl-Dpzrbd0W-4Q5226YJ.js +142 -0
  133. package/dist/sv-CFm5y56M-VTWNPZ7I.js +11 -0
  134. package/dist/ta-BcghgTbD-NRT35DW6.js +11 -0
  135. package/dist/te-B5Spl2Jk-5VE6CLN4.js +11 -0
  136. package/dist/th-DWX5iPSo-N5GMOQOP.js +11 -0
  137. package/dist/theme.d.ts +49 -0
  138. package/dist/theme.js +3 -0
  139. package/dist/tk-BMbKB10q-HGWWY5L3.js +11 -0
  140. package/dist/tr-CIHIuzqc-6ISBNYLV.js +11 -0
  141. package/dist/types-BDqLaBfH.d.ts +60 -0
  142. package/dist/uk-Dir3oxLs-YQ3QZRI4.js +11 -0
  143. package/dist/univer-workbook-BSSUE5TG.css +3555 -0
  144. package/dist/univer-workbook-N5IIN7CH.js +290849 -0
  145. package/dist/vega-chart-block-NQADYNWQ.js +2857 -0
  146. package/dist/zh-latn-pinyin-BdYb-Ey_-RB542AHF.js +11 -0
  147. package/package.json +137 -0
  148. package/src/styles.css +996 -0
@@ -0,0 +1,1258 @@
1
+ 'use client';
2
+ // ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
3
+ var min = Math.min;
4
+ var max = Math.max;
5
+ var round = Math.round;
6
+ var floor = Math.floor;
7
+ var createCoords = (v) => ({
8
+ x: v,
9
+ y: v
10
+ });
11
+ var oppositeSideMap = {
12
+ left: "right",
13
+ right: "left",
14
+ bottom: "top",
15
+ top: "bottom"
16
+ };
17
+ function evaluate(value, param) {
18
+ return typeof value === "function" ? value(param) : value;
19
+ }
20
+ function getSide(placement) {
21
+ return placement.split("-")[0];
22
+ }
23
+ function getAlignment(placement) {
24
+ return placement.split("-")[1];
25
+ }
26
+ function getOppositeAxis(axis) {
27
+ return axis === "x" ? "y" : "x";
28
+ }
29
+ function getAxisLength(axis) {
30
+ return axis === "y" ? "height" : "width";
31
+ }
32
+ function getSideAxis(placement) {
33
+ const firstChar = placement[0];
34
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
35
+ }
36
+ function getAlignmentAxis(placement) {
37
+ return getOppositeAxis(getSideAxis(placement));
38
+ }
39
+ function getAlignmentSides(placement, rects, rtl) {
40
+ if (rtl === void 0) {
41
+ rtl = false;
42
+ }
43
+ const alignment = getAlignment(placement);
44
+ const alignmentAxis = getAlignmentAxis(placement);
45
+ const length = getAxisLength(alignmentAxis);
46
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
47
+ if (rects.reference[length] > rects.floating[length]) {
48
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
49
+ }
50
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
51
+ }
52
+ function getExpandedPlacements(placement) {
53
+ const oppositePlacement = getOppositePlacement(placement);
54
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
55
+ }
56
+ function getOppositeAlignmentPlacement(placement) {
57
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
58
+ }
59
+ var lrPlacement = ["left", "right"];
60
+ var rlPlacement = ["right", "left"];
61
+ var tbPlacement = ["top", "bottom"];
62
+ var btPlacement = ["bottom", "top"];
63
+ function getSideList(side, isStart, rtl) {
64
+ switch (side) {
65
+ case "top":
66
+ case "bottom":
67
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
68
+ return isStart ? lrPlacement : rlPlacement;
69
+ case "left":
70
+ case "right":
71
+ return isStart ? tbPlacement : btPlacement;
72
+ default:
73
+ return [];
74
+ }
75
+ }
76
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
77
+ const alignment = getAlignment(placement);
78
+ let list = getSideList(getSide(placement), direction === "start", rtl);
79
+ if (alignment) {
80
+ list = list.map((side) => side + "-" + alignment);
81
+ if (flipAlignment) {
82
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
83
+ }
84
+ }
85
+ return list;
86
+ }
87
+ function getOppositePlacement(placement) {
88
+ const side = getSide(placement);
89
+ return oppositeSideMap[side] + placement.slice(side.length);
90
+ }
91
+ function expandPaddingObject(padding) {
92
+ var _padding$top, _padding$right, _padding$bottom, _padding$left;
93
+ return {
94
+ top: (_padding$top = padding.top) != null ? _padding$top : 0,
95
+ right: (_padding$right = padding.right) != null ? _padding$right : 0,
96
+ bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
97
+ left: (_padding$left = padding.left) != null ? _padding$left : 0
98
+ };
99
+ }
100
+ function getPaddingObject(padding) {
101
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
102
+ top: padding,
103
+ right: padding,
104
+ bottom: padding,
105
+ left: padding
106
+ };
107
+ }
108
+ function rectToClientRect(rect) {
109
+ const {
110
+ x,
111
+ y,
112
+ width,
113
+ height
114
+ } = rect;
115
+ return {
116
+ width,
117
+ height,
118
+ top: y,
119
+ left: x,
120
+ right: x + width,
121
+ bottom: y + height,
122
+ x,
123
+ y
124
+ };
125
+ }
126
+
127
+ // ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
128
+ function hasWindow() {
129
+ return typeof window !== "undefined";
130
+ }
131
+ function getNodeName(node) {
132
+ if (isNode(node)) {
133
+ return (node.nodeName || "").toLowerCase();
134
+ }
135
+ return "#document";
136
+ }
137
+ function getWindow(node) {
138
+ var _node$ownerDocument;
139
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
140
+ }
141
+ function getDocumentElement(node) {
142
+ var _ref;
143
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
144
+ }
145
+ function isNode(value) {
146
+ if (!hasWindow()) {
147
+ return false;
148
+ }
149
+ return value instanceof Node || value instanceof getWindow(value).Node;
150
+ }
151
+ function isElement(value) {
152
+ if (!hasWindow()) {
153
+ return false;
154
+ }
155
+ return value instanceof Element || value instanceof getWindow(value).Element;
156
+ }
157
+ function isHTMLElement(value) {
158
+ if (!hasWindow()) {
159
+ return false;
160
+ }
161
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
162
+ }
163
+ function isShadowRoot(value) {
164
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
165
+ return false;
166
+ }
167
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
168
+ }
169
+ function isOverflowElement(element) {
170
+ const {
171
+ overflow,
172
+ overflowX,
173
+ overflowY,
174
+ display
175
+ } = getComputedStyle2(element);
176
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
177
+ }
178
+ function isTableElement(element) {
179
+ return /^(table|td|th)$/.test(getNodeName(element));
180
+ }
181
+ function isTopLayer(element) {
182
+ try {
183
+ if (element.matches(":popover-open")) {
184
+ return true;
185
+ }
186
+ } catch (_e) {
187
+ }
188
+ try {
189
+ return element.matches(":modal");
190
+ } catch (_e) {
191
+ return false;
192
+ }
193
+ }
194
+ var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
195
+ var containRe = /paint|layout|strict|content/;
196
+ var isNotNone = (value) => !!value && value !== "none";
197
+ var isWebKitValue;
198
+ function isContainingBlock(elementOrCss) {
199
+ const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
200
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
201
+ }
202
+ function getContainingBlock(element) {
203
+ let currentNode = getParentNode(element);
204
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
205
+ if (isContainingBlock(currentNode)) {
206
+ return currentNode;
207
+ } else if (isTopLayer(currentNode)) {
208
+ return null;
209
+ }
210
+ currentNode = getParentNode(currentNode);
211
+ }
212
+ return null;
213
+ }
214
+ function isWebKit() {
215
+ if (isWebKitValue == null) {
216
+ isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
217
+ }
218
+ return isWebKitValue;
219
+ }
220
+ function isLastTraversableNode(node) {
221
+ return /^(html|body|#document)$/.test(getNodeName(node));
222
+ }
223
+ function getComputedStyle2(element) {
224
+ return getWindow(element).getComputedStyle(element);
225
+ }
226
+ function getNodeScroll(element) {
227
+ if (isElement(element)) {
228
+ return {
229
+ scrollLeft: element.scrollLeft,
230
+ scrollTop: element.scrollTop
231
+ };
232
+ }
233
+ return {
234
+ scrollLeft: element.scrollX,
235
+ scrollTop: element.scrollY
236
+ };
237
+ }
238
+ function getParentNode(node) {
239
+ if (getNodeName(node) === "html") {
240
+ return node;
241
+ }
242
+ const result = (
243
+ // Step into the shadow DOM of the parent of a slotted node.
244
+ node.assignedSlot || // DOM Element detected.
245
+ node.parentNode || // ShadowRoot detected.
246
+ isShadowRoot(node) && node.host || // Fallback.
247
+ getDocumentElement(node)
248
+ );
249
+ return isShadowRoot(result) ? result.host : result;
250
+ }
251
+ function getNearestOverflowAncestor(node) {
252
+ const parentNode = getParentNode(node);
253
+ if (isLastTraversableNode(parentNode)) {
254
+ return (node.ownerDocument || node).body;
255
+ }
256
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
257
+ return parentNode;
258
+ }
259
+ return getNearestOverflowAncestor(parentNode);
260
+ }
261
+ function getOverflowAncestors(node, list, traverseIframes) {
262
+ var _node$ownerDocument2;
263
+ if (list === void 0) {
264
+ list = [];
265
+ }
266
+ if (traverseIframes === void 0) {
267
+ traverseIframes = true;
268
+ }
269
+ const scrollableAncestor = getNearestOverflowAncestor(node);
270
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
271
+ const win = getWindow(scrollableAncestor);
272
+ if (isBody) {
273
+ const frameElement = getFrameElement(win);
274
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
275
+ } else {
276
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
277
+ }
278
+ }
279
+ function getFrameElement(win) {
280
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
281
+ }
282
+
283
+ // ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
284
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
285
+ let {
286
+ reference,
287
+ floating
288
+ } = _ref;
289
+ const sideAxis = getSideAxis(placement);
290
+ const alignmentAxis = getAlignmentAxis(placement);
291
+ const alignLength = getAxisLength(alignmentAxis);
292
+ const side = getSide(placement);
293
+ const isVertical = sideAxis === "y";
294
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
295
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
296
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
297
+ let coords;
298
+ switch (side) {
299
+ case "top":
300
+ coords = {
301
+ x: commonX,
302
+ y: reference.y - floating.height
303
+ };
304
+ break;
305
+ case "bottom":
306
+ coords = {
307
+ x: commonX,
308
+ y: reference.y + reference.height
309
+ };
310
+ break;
311
+ case "right":
312
+ coords = {
313
+ x: reference.x + reference.width,
314
+ y: commonY
315
+ };
316
+ break;
317
+ case "left":
318
+ coords = {
319
+ x: reference.x - floating.width,
320
+ y: commonY
321
+ };
322
+ break;
323
+ default:
324
+ coords = {
325
+ x: reference.x,
326
+ y: reference.y
327
+ };
328
+ }
329
+ const alignment = getAlignment(placement);
330
+ if (alignment) {
331
+ coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
332
+ }
333
+ return coords;
334
+ }
335
+ async function detectOverflow(state, options) {
336
+ var _await$platform$isEle;
337
+ if (options === void 0) {
338
+ options = {};
339
+ }
340
+ const {
341
+ x,
342
+ y,
343
+ platform: platform2,
344
+ rects,
345
+ elements,
346
+ strategy
347
+ } = state;
348
+ const {
349
+ boundary = "clippingAncestors",
350
+ rootBoundary = "viewport",
351
+ elementContext = "floating",
352
+ altBoundary = false,
353
+ padding = 0
354
+ } = evaluate(options, state);
355
+ const paddingObject = getPaddingObject(padding);
356
+ const altContext = elementContext === "floating" ? "reference" : "floating";
357
+ const element = elements[altBoundary ? altContext : elementContext];
358
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
359
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
360
+ boundary,
361
+ rootBoundary,
362
+ strategy
363
+ }));
364
+ const rect = elementContext === "floating" ? {
365
+ x,
366
+ y,
367
+ width: rects.floating.width,
368
+ height: rects.floating.height
369
+ } : rects.reference;
370
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
371
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) && await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
372
+ x: 1,
373
+ y: 1
374
+ };
375
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
376
+ elements,
377
+ rect,
378
+ offsetParent,
379
+ strategy
380
+ }) : rect);
381
+ return {
382
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
383
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
384
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
385
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
386
+ };
387
+ }
388
+ var MAX_RESET_COUNT = 50;
389
+ var computePosition = async (reference, floating, config) => {
390
+ const {
391
+ placement = "bottom",
392
+ strategy = "absolute",
393
+ middleware = [],
394
+ platform: platform2
395
+ } = config;
396
+ const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
397
+ ...platform2,
398
+ detectOverflow
399
+ };
400
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
401
+ let rects = await platform2.getElementRects({
402
+ reference,
403
+ floating,
404
+ strategy
405
+ });
406
+ let {
407
+ x,
408
+ y
409
+ } = computeCoordsFromPlacement(rects, placement, rtl);
410
+ let statefulPlacement = placement;
411
+ let resetCount = 0;
412
+ const middlewareData = {};
413
+ for (let i = 0; i < middleware.length; i++) {
414
+ const currentMiddleware = middleware[i];
415
+ if (!currentMiddleware) {
416
+ continue;
417
+ }
418
+ const {
419
+ name,
420
+ fn
421
+ } = currentMiddleware;
422
+ const {
423
+ x: nextX,
424
+ y: nextY,
425
+ data,
426
+ reset
427
+ } = await fn({
428
+ x,
429
+ y,
430
+ initialPlacement: placement,
431
+ placement: statefulPlacement,
432
+ strategy,
433
+ middlewareData,
434
+ rects,
435
+ platform: platformWithDetectOverflow,
436
+ elements: {
437
+ reference,
438
+ floating
439
+ }
440
+ });
441
+ x = nextX != null ? nextX : x;
442
+ y = nextY != null ? nextY : y;
443
+ middlewareData[name] = {
444
+ ...middlewareData[name],
445
+ ...data
446
+ };
447
+ if (reset && resetCount < MAX_RESET_COUNT) {
448
+ resetCount++;
449
+ if (typeof reset === "object") {
450
+ if (reset.placement) {
451
+ statefulPlacement = reset.placement;
452
+ }
453
+ if (reset.rects) {
454
+ rects = reset.rects === true ? await platform2.getElementRects({
455
+ reference,
456
+ floating,
457
+ strategy
458
+ }) : reset.rects;
459
+ }
460
+ ({
461
+ x,
462
+ y
463
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
464
+ }
465
+ i = -1;
466
+ }
467
+ }
468
+ return {
469
+ x,
470
+ y,
471
+ placement: statefulPlacement,
472
+ strategy,
473
+ middlewareData
474
+ };
475
+ };
476
+ var flip = function(options) {
477
+ if (options === void 0) {
478
+ options = {};
479
+ }
480
+ return {
481
+ name: "flip",
482
+ options,
483
+ async fn(state) {
484
+ var _middlewareData$arrow, _middlewareData$flip;
485
+ const {
486
+ placement,
487
+ middlewareData,
488
+ rects,
489
+ initialPlacement,
490
+ platform: platform2,
491
+ elements
492
+ } = state;
493
+ const {
494
+ mainAxis: checkMainAxis = true,
495
+ crossAxis: checkCrossAxis = true,
496
+ fallbackPlacements: specifiedFallbackPlacements,
497
+ fallbackStrategy = "bestFit",
498
+ fallbackAxisSideDirection = "none",
499
+ flipAlignment = true,
500
+ ...detectOverflowOptions
501
+ } = evaluate(options, state);
502
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
503
+ return {};
504
+ }
505
+ const side = getSide(placement);
506
+ const initialSideAxis = getSideAxis(initialPlacement);
507
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
508
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
509
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
510
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
511
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
512
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
513
+ }
514
+ const placements2 = [initialPlacement, ...fallbackPlacements];
515
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
516
+ const overflows = [];
517
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
518
+ if (checkMainAxis) {
519
+ overflows.push(overflow[side]);
520
+ }
521
+ if (checkCrossAxis) {
522
+ const sides2 = getAlignmentSides(placement, rects, rtl);
523
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
524
+ }
525
+ overflowsData = [...overflowsData, {
526
+ placement,
527
+ overflows
528
+ }];
529
+ if (!overflows.every((side2) => side2 <= 0)) {
530
+ var _middlewareData$flip2, _overflowsData$filter;
531
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
532
+ const nextPlacement = placements2[nextIndex];
533
+ if (nextPlacement) {
534
+ const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
535
+ if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
536
+ // overflows the main axis.
537
+ overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
538
+ return {
539
+ data: {
540
+ index: nextIndex,
541
+ overflows: overflowsData
542
+ },
543
+ reset: {
544
+ placement: nextPlacement
545
+ }
546
+ };
547
+ }
548
+ }
549
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
550
+ if (!resetPlacement) {
551
+ switch (fallbackStrategy) {
552
+ case "bestFit": {
553
+ var _overflowsData$filter2;
554
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
555
+ if (hasFallbackAxisSideDirection) {
556
+ const currentSideAxis = getSideAxis(d.placement);
557
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
558
+ // reading directions favoring greater width.
559
+ currentSideAxis === "y";
560
+ }
561
+ return true;
562
+ }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
563
+ if (placement2) {
564
+ resetPlacement = placement2;
565
+ }
566
+ break;
567
+ }
568
+ case "initialPlacement":
569
+ resetPlacement = initialPlacement;
570
+ break;
571
+ }
572
+ }
573
+ if (placement !== resetPlacement) {
574
+ return {
575
+ reset: {
576
+ placement: resetPlacement
577
+ }
578
+ };
579
+ }
580
+ }
581
+ return {};
582
+ }
583
+ };
584
+ };
585
+ var originSides = /* @__PURE__ */ new Set(["left", "top"]);
586
+ async function convertValueToCoords(state, options) {
587
+ const {
588
+ placement,
589
+ platform: platform2,
590
+ elements
591
+ } = state;
592
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
593
+ const side = getSide(placement);
594
+ const alignment = getAlignment(placement);
595
+ const isVertical = getSideAxis(placement) === "y";
596
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
597
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
598
+ const rawValue = evaluate(options, state);
599
+ let {
600
+ mainAxis,
601
+ crossAxis,
602
+ alignmentAxis
603
+ } = typeof rawValue === "number" ? {
604
+ mainAxis: rawValue,
605
+ crossAxis: 0,
606
+ alignmentAxis: null
607
+ } : {
608
+ mainAxis: rawValue.mainAxis || 0,
609
+ crossAxis: rawValue.crossAxis || 0,
610
+ alignmentAxis: rawValue.alignmentAxis
611
+ };
612
+ if (alignment && typeof alignmentAxis === "number") {
613
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
614
+ }
615
+ return isVertical ? {
616
+ x: crossAxis * crossAxisMulti,
617
+ y: mainAxis * mainAxisMulti
618
+ } : {
619
+ x: mainAxis * mainAxisMulti,
620
+ y: crossAxis * crossAxisMulti
621
+ };
622
+ }
623
+ var offset = function(options) {
624
+ if (options === void 0) {
625
+ options = 0;
626
+ }
627
+ return {
628
+ name: "offset",
629
+ options,
630
+ async fn(state) {
631
+ var _middlewareData$offse, _middlewareData$arrow;
632
+ const {
633
+ x,
634
+ y,
635
+ placement,
636
+ middlewareData
637
+ } = state;
638
+ const diffCoords = await convertValueToCoords(state, options);
639
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
640
+ return {};
641
+ }
642
+ return {
643
+ x: x + diffCoords.x,
644
+ y: y + diffCoords.y,
645
+ data: {
646
+ ...diffCoords,
647
+ placement
648
+ }
649
+ };
650
+ }
651
+ };
652
+ };
653
+
654
+ // ../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
655
+ function getCssDimensions(element) {
656
+ const css = getComputedStyle2(element);
657
+ let width = parseFloat(css.width) || 0;
658
+ let height = parseFloat(css.height) || 0;
659
+ const hasOffset = isHTMLElement(element);
660
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
661
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
662
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
663
+ if (shouldFallback) {
664
+ width = offsetWidth;
665
+ height = offsetHeight;
666
+ }
667
+ return {
668
+ width,
669
+ height,
670
+ $: shouldFallback
671
+ };
672
+ }
673
+ function unwrapElement(element) {
674
+ return !isElement(element) ? element.contextElement : element;
675
+ }
676
+ function getScale(element) {
677
+ const domElement = unwrapElement(element);
678
+ if (!isHTMLElement(domElement)) {
679
+ return createCoords(1);
680
+ }
681
+ const rect = domElement.getBoundingClientRect();
682
+ const {
683
+ width,
684
+ height,
685
+ $
686
+ } = getCssDimensions(domElement);
687
+ let x = ($ ? round(rect.width) : rect.width) / width;
688
+ let y = ($ ? round(rect.height) : rect.height) / height;
689
+ if (!x || !Number.isFinite(x)) {
690
+ x = 1;
691
+ }
692
+ if (!y || !Number.isFinite(y)) {
693
+ y = 1;
694
+ }
695
+ return {
696
+ x,
697
+ y
698
+ };
699
+ }
700
+ var noOffsets = /* @__PURE__ */ createCoords(0);
701
+ function getVisualOffsets(element) {
702
+ const win = getWindow(element);
703
+ if (!isWebKit() || !win.visualViewport) {
704
+ return noOffsets;
705
+ }
706
+ return {
707
+ x: win.visualViewport.offsetLeft,
708
+ y: win.visualViewport.offsetTop
709
+ };
710
+ }
711
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
712
+ if (isFixed === void 0) {
713
+ isFixed = false;
714
+ }
715
+ return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
716
+ }
717
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
718
+ if (includeScale === void 0) {
719
+ includeScale = false;
720
+ }
721
+ if (isFixedStrategy === void 0) {
722
+ isFixedStrategy = false;
723
+ }
724
+ const clientRect = element.getBoundingClientRect();
725
+ const domElement = unwrapElement(element);
726
+ let scale = createCoords(1);
727
+ if (includeScale) {
728
+ if (offsetParent) {
729
+ if (isElement(offsetParent)) {
730
+ scale = getScale(offsetParent);
731
+ }
732
+ } else {
733
+ scale = getScale(element);
734
+ }
735
+ }
736
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
737
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
738
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
739
+ let width = clientRect.width / scale.x;
740
+ let height = clientRect.height / scale.y;
741
+ if (domElement && offsetParent) {
742
+ const win = getWindow(domElement);
743
+ const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
744
+ let currentWin = win;
745
+ let currentIFrame = getFrameElement(currentWin);
746
+ while (currentIFrame && offsetWin !== currentWin) {
747
+ const iframeScale = getScale(currentIFrame);
748
+ const iframeRect = currentIFrame.getBoundingClientRect();
749
+ const css = getComputedStyle2(currentIFrame);
750
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
751
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
752
+ x *= iframeScale.x;
753
+ y *= iframeScale.y;
754
+ width *= iframeScale.x;
755
+ height *= iframeScale.y;
756
+ x += left;
757
+ y += top;
758
+ currentWin = getWindow(currentIFrame);
759
+ currentIFrame = getFrameElement(currentWin);
760
+ }
761
+ }
762
+ return rectToClientRect({
763
+ width,
764
+ height,
765
+ x,
766
+ y
767
+ });
768
+ }
769
+ function getWindowScrollBarX(element, rect) {
770
+ const leftScroll = getNodeScroll(element).scrollLeft;
771
+ if (!rect) {
772
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
773
+ }
774
+ return rect.left + leftScroll;
775
+ }
776
+ function getHTMLOffset(documentElement, scroll) {
777
+ const htmlRect = documentElement.getBoundingClientRect();
778
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
779
+ const y = htmlRect.top + scroll.scrollTop;
780
+ return {
781
+ x,
782
+ y
783
+ };
784
+ }
785
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
786
+ let {
787
+ elements,
788
+ rect,
789
+ offsetParent,
790
+ strategy
791
+ } = _ref;
792
+ const isFixed = strategy === "fixed";
793
+ const documentElement = getDocumentElement(offsetParent);
794
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
795
+ if (offsetParent === documentElement || topLayer && isFixed) {
796
+ return rect;
797
+ }
798
+ let scroll = {
799
+ scrollLeft: 0,
800
+ scrollTop: 0
801
+ };
802
+ let scale = createCoords(1);
803
+ const offsets = createCoords(0);
804
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
805
+ if (isOffsetParentAnElement || !isFixed) {
806
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
807
+ scroll = getNodeScroll(offsetParent);
808
+ }
809
+ if (isOffsetParentAnElement) {
810
+ const offsetRect = getBoundingClientRect(offsetParent);
811
+ scale = getScale(offsetParent);
812
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
813
+ offsets.y = offsetRect.y + offsetParent.clientTop;
814
+ }
815
+ }
816
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
817
+ return {
818
+ width: rect.width * scale.x,
819
+ height: rect.height * scale.y,
820
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
821
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
822
+ };
823
+ }
824
+ function getClientRects(element) {
825
+ return element.getClientRects ? Array.from(element.getClientRects()) : [];
826
+ }
827
+ function getDocumentRect(html) {
828
+ const scroll = getNodeScroll(html);
829
+ const body = html.ownerDocument.body;
830
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
831
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
832
+ let x = -scroll.scrollLeft + getWindowScrollBarX(html);
833
+ const y = -scroll.scrollTop;
834
+ if (getComputedStyle2(body).direction === "rtl") {
835
+ x += max(html.clientWidth, body.clientWidth) - width;
836
+ }
837
+ return {
838
+ width,
839
+ height,
840
+ x,
841
+ y
842
+ };
843
+ }
844
+ var SCROLLBAR_MAX = 25;
845
+ function getViewportRect(element, strategy, rootBoundary) {
846
+ if (rootBoundary === void 0) {
847
+ rootBoundary = "viewport";
848
+ }
849
+ const isLayoutViewport = rootBoundary === "layoutViewport";
850
+ const win = getWindow(element);
851
+ const html = getDocumentElement(element);
852
+ const visualViewport = win.visualViewport;
853
+ let width = html.clientWidth;
854
+ let height = html.clientHeight;
855
+ let x = 0;
856
+ let y = 0;
857
+ if (visualViewport) {
858
+ const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
859
+ if (isLayoutViewport) {
860
+ if (!layoutRelativeClientCoords) {
861
+ x = -visualViewport.offsetLeft;
862
+ y = -visualViewport.offsetTop;
863
+ }
864
+ } else {
865
+ width = visualViewport.width;
866
+ height = visualViewport.height;
867
+ if (layoutRelativeClientCoords) {
868
+ x = visualViewport.offsetLeft;
869
+ y = visualViewport.offsetTop;
870
+ }
871
+ }
872
+ }
873
+ const windowScrollbarX = getWindowScrollBarX(html);
874
+ if (windowScrollbarX <= 0) {
875
+ const doc = html.ownerDocument;
876
+ const body = doc.body;
877
+ const bodyStyles = getComputedStyle(body);
878
+ const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
879
+ const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
880
+ const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
881
+ if (gutter <= SCROLLBAR_MAX) {
882
+ width -= gutter;
883
+ }
884
+ }
885
+ return {
886
+ width,
887
+ height,
888
+ x,
889
+ y
890
+ };
891
+ }
892
+ function getInnerBoundingClientRect(element, strategy) {
893
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
894
+ const top = clientRect.top + element.clientTop;
895
+ const left = clientRect.left + element.clientLeft;
896
+ const scale = getScale(element);
897
+ const width = element.clientWidth * scale.x;
898
+ const height = element.clientHeight * scale.y;
899
+ const x = left * scale.x;
900
+ const y = top * scale.y;
901
+ return {
902
+ width,
903
+ height,
904
+ x,
905
+ y
906
+ };
907
+ }
908
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
909
+ let rect;
910
+ if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") {
911
+ rect = getViewportRect(element, strategy, clippingAncestor);
912
+ } else if (clippingAncestor === "document") {
913
+ rect = getDocumentRect(getDocumentElement(element));
914
+ } else if (isElement(clippingAncestor)) {
915
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
916
+ } else {
917
+ const visualOffsets = getVisualOffsets(element);
918
+ rect = {
919
+ x: clippingAncestor.x - visualOffsets.x,
920
+ y: clippingAncestor.y - visualOffsets.y,
921
+ width: clippingAncestor.width,
922
+ height: clippingAncestor.height
923
+ };
924
+ }
925
+ return rectToClientRect(rect);
926
+ }
927
+ function getClippingElementAncestors(element, cache) {
928
+ const cachedResult = cache.get(element);
929
+ if (cachedResult) {
930
+ return cachedResult;
931
+ }
932
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
933
+ let lastKeptComputedStyle = null;
934
+ const elementIsFixed = getComputedStyle2(element).position === "fixed";
935
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
936
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
937
+ const computedStyle = getComputedStyle2(currentNode);
938
+ const currentNodeIsContaining = isContainingBlock(currentNode);
939
+ const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
940
+ const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static");
941
+ if (shouldDropCurrentNode) {
942
+ result = result.filter((ancestor) => ancestor !== currentNode);
943
+ } else {
944
+ lastKeptComputedStyle = computedStyle;
945
+ }
946
+ currentNode = getParentNode(currentNode);
947
+ }
948
+ cache.set(element, result);
949
+ return result;
950
+ }
951
+ function getClippingRect(_ref) {
952
+ let {
953
+ element,
954
+ boundary,
955
+ rootBoundary,
956
+ strategy
957
+ } = _ref;
958
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
959
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
960
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
961
+ let top = firstRect.top;
962
+ let right = firstRect.right;
963
+ let bottom = firstRect.bottom;
964
+ let left = firstRect.left;
965
+ for (let i = 1; i < clippingAncestors.length; i++) {
966
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
967
+ top = max(rect.top, top);
968
+ right = min(rect.right, right);
969
+ bottom = min(rect.bottom, bottom);
970
+ left = max(rect.left, left);
971
+ }
972
+ return {
973
+ width: right - left,
974
+ height: bottom - top,
975
+ x: left,
976
+ y: top
977
+ };
978
+ }
979
+ function getDimensions(element) {
980
+ const {
981
+ width,
982
+ height
983
+ } = getCssDimensions(element);
984
+ return {
985
+ width,
986
+ height
987
+ };
988
+ }
989
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
990
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
991
+ const documentElement = getDocumentElement(offsetParent);
992
+ const isFixed = strategy === "fixed";
993
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
994
+ let scroll = {
995
+ scrollLeft: 0,
996
+ scrollTop: 0
997
+ };
998
+ const offsets = createCoords(0);
999
+ if (isOffsetParentAnElement || !isFixed) {
1000
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1001
+ scroll = getNodeScroll(offsetParent);
1002
+ }
1003
+ if (isOffsetParentAnElement) {
1004
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1005
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1006
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1007
+ }
1008
+ }
1009
+ if (!isOffsetParentAnElement && documentElement) {
1010
+ offsets.x = getWindowScrollBarX(documentElement);
1011
+ }
1012
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1013
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1014
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1015
+ return {
1016
+ x,
1017
+ y,
1018
+ width: rect.width,
1019
+ height: rect.height
1020
+ };
1021
+ }
1022
+ function isStaticPositioned(element) {
1023
+ return getComputedStyle2(element).position === "static";
1024
+ }
1025
+ function getTrueOffsetParent(element, polyfill) {
1026
+ if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
1027
+ return null;
1028
+ }
1029
+ if (polyfill) {
1030
+ return polyfill(element);
1031
+ }
1032
+ let rawOffsetParent = element.offsetParent;
1033
+ if (getDocumentElement(element) === rawOffsetParent) {
1034
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1035
+ }
1036
+ return rawOffsetParent;
1037
+ }
1038
+ function getOffsetParent(element, polyfill) {
1039
+ const win = getWindow(element);
1040
+ if (isTopLayer(element)) {
1041
+ return win;
1042
+ }
1043
+ if (!isHTMLElement(element)) {
1044
+ let svgOffsetParent = getParentNode(element);
1045
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1046
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1047
+ return svgOffsetParent;
1048
+ }
1049
+ svgOffsetParent = getParentNode(svgOffsetParent);
1050
+ }
1051
+ return win;
1052
+ }
1053
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1054
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1055
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1056
+ }
1057
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1058
+ return win;
1059
+ }
1060
+ return offsetParent || getContainingBlock(element) || win;
1061
+ }
1062
+ var getElementRects = async function(data) {
1063
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1064
+ const getDimensionsFn = this.getDimensions;
1065
+ const floatingDimensions = await getDimensionsFn(data.floating);
1066
+ return {
1067
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1068
+ floating: {
1069
+ x: 0,
1070
+ y: 0,
1071
+ width: floatingDimensions.width,
1072
+ height: floatingDimensions.height
1073
+ }
1074
+ };
1075
+ };
1076
+ function isRTL(element) {
1077
+ return getComputedStyle2(element).direction === "rtl";
1078
+ }
1079
+ var platform = {
1080
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1081
+ getDocumentElement,
1082
+ getClippingRect,
1083
+ getOffsetParent,
1084
+ getElementRects,
1085
+ getClientRects,
1086
+ getDimensions,
1087
+ getScale,
1088
+ isElement,
1089
+ isRTL
1090
+ };
1091
+ function rectsAreEqual(a, b) {
1092
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1093
+ }
1094
+ function observeMove(element, onMove, ancestorResize) {
1095
+ let io = null;
1096
+ let timeoutId;
1097
+ const root = getDocumentElement(element);
1098
+ function cleanup() {
1099
+ var _io;
1100
+ clearTimeout(timeoutId);
1101
+ (_io = io) == null || _io.disconnect();
1102
+ io = null;
1103
+ }
1104
+ function refresh(skip, threshold) {
1105
+ if (skip === void 0) {
1106
+ skip = false;
1107
+ }
1108
+ if (threshold === void 0) {
1109
+ threshold = 1;
1110
+ }
1111
+ cleanup();
1112
+ const elementRectForRootMargin = element.getBoundingClientRect();
1113
+ const {
1114
+ left,
1115
+ top,
1116
+ width,
1117
+ height
1118
+ } = elementRectForRootMargin;
1119
+ if (!skip) {
1120
+ onMove();
1121
+ }
1122
+ if (!width || !height) {
1123
+ return;
1124
+ }
1125
+ const insetTop = floor(top);
1126
+ const insetRight = floor(root.clientWidth - (left + width));
1127
+ const insetBottom = floor(root.clientHeight - (top + height));
1128
+ const insetLeft = floor(left);
1129
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1130
+ const options = {
1131
+ rootMargin,
1132
+ threshold: max(0, min(1, threshold)) || 1
1133
+ };
1134
+ let isFirstUpdate = true;
1135
+ function handleObserve(entries) {
1136
+ const ratio = entries[0].intersectionRatio;
1137
+ if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1138
+ return refresh();
1139
+ }
1140
+ if (ratio !== threshold) {
1141
+ if (!isFirstUpdate) {
1142
+ return refresh();
1143
+ }
1144
+ if (!ratio) {
1145
+ timeoutId = setTimeout(() => {
1146
+ refresh(false, 1e-7);
1147
+ }, 1e3);
1148
+ } else {
1149
+ refresh(false, ratio);
1150
+ }
1151
+ }
1152
+ isFirstUpdate = false;
1153
+ }
1154
+ try {
1155
+ io = new IntersectionObserver(handleObserve, {
1156
+ ...options,
1157
+ // Handle <iframe>s
1158
+ root: root.ownerDocument
1159
+ });
1160
+ } catch (_e) {
1161
+ io = new IntersectionObserver(handleObserve, options);
1162
+ }
1163
+ io.observe(element);
1164
+ }
1165
+ const win = getWindow(element);
1166
+ const handleResize = () => refresh(ancestorResize);
1167
+ win.addEventListener("resize", handleResize);
1168
+ refresh(true);
1169
+ return () => {
1170
+ win.removeEventListener("resize", handleResize);
1171
+ cleanup();
1172
+ };
1173
+ }
1174
+ function autoUpdate(reference, floating, update, options) {
1175
+ if (options === void 0) {
1176
+ options = {};
1177
+ }
1178
+ const {
1179
+ ancestorScroll = true,
1180
+ ancestorResize = true,
1181
+ elementResize = typeof ResizeObserver === "function",
1182
+ layoutShift = typeof IntersectionObserver === "function",
1183
+ animationFrame = false
1184
+ } = options;
1185
+ const referenceEl = unwrapElement(reference);
1186
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
1187
+ ancestors.forEach((ancestor) => {
1188
+ ancestorScroll && ancestor.addEventListener("scroll", update);
1189
+ ancestorResize && ancestor.addEventListener("resize", update);
1190
+ });
1191
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
1192
+ let reobserveFrame = -1;
1193
+ let resizeObserver = null;
1194
+ if (elementResize) {
1195
+ resizeObserver = new ResizeObserver((_ref) => {
1196
+ let [firstEntry] = _ref;
1197
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
1198
+ resizeObserver.unobserve(floating);
1199
+ cancelAnimationFrame(reobserveFrame);
1200
+ reobserveFrame = requestAnimationFrame(() => {
1201
+ var _resizeObserver;
1202
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1203
+ });
1204
+ }
1205
+ update();
1206
+ });
1207
+ if (referenceEl && !animationFrame) {
1208
+ resizeObserver.observe(referenceEl);
1209
+ }
1210
+ if (floating) {
1211
+ resizeObserver.observe(floating);
1212
+ }
1213
+ }
1214
+ let frameId;
1215
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1216
+ if (animationFrame) {
1217
+ frameLoop();
1218
+ }
1219
+ function frameLoop() {
1220
+ const nextRefRect = getBoundingClientRect(reference);
1221
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1222
+ update();
1223
+ }
1224
+ prevRefRect = nextRefRect;
1225
+ frameId = requestAnimationFrame(frameLoop);
1226
+ }
1227
+ update();
1228
+ return () => {
1229
+ var _resizeObserver2;
1230
+ ancestors.forEach((ancestor) => {
1231
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
1232
+ ancestorResize && ancestor.removeEventListener("resize", update);
1233
+ });
1234
+ cleanupIo == null || cleanupIo();
1235
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1236
+ resizeObserver = null;
1237
+ if (animationFrame) {
1238
+ cancelAnimationFrame(frameId);
1239
+ }
1240
+ };
1241
+ }
1242
+ var offset2 = offset;
1243
+ var flip2 = flip;
1244
+ var computePosition2 = (reference, floating, options) => {
1245
+ const cache = /* @__PURE__ */ new Map();
1246
+ const mergedOptions = options != null ? options : {};
1247
+ const platformWithCache = {
1248
+ ...platform,
1249
+ ...mergedOptions.platform,
1250
+ _c: cache
1251
+ };
1252
+ return computePosition(reference, floating, {
1253
+ ...mergedOptions,
1254
+ platform: platformWithCache
1255
+ });
1256
+ };
1257
+
1258
+ export { autoUpdate, computePosition2 as computePosition, flip2 as flip, floor, getDocumentElement, getOverflowAncestors, max, min, offset2 as offset };