@addsign/moje-agenda-shared-lib 2.0.11 → 2.0.12

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 (145) hide show
  1. package/dist/Dialog-4hkwYHTJ.js +424 -0
  2. package/dist/Dialog-4hkwYHTJ.js.map +1 -0
  3. package/dist/Dialog-CrRXl-G2.js +424 -0
  4. package/dist/Dialog-CrRXl-G2.js.map +1 -0
  5. package/dist/Dialog-D9rsAQnn.js +424 -0
  6. package/dist/Dialog-D9rsAQnn.js.map +1 -0
  7. package/dist/Dialog-v5zgZE_G.js +424 -0
  8. package/dist/Dialog-v5zgZE_G.js.map +1 -0
  9. package/dist/assets/style.css +192 -0
  10. package/dist/components/datatable/DataTable.js +2 -1
  11. package/dist/components/datatable/DataTable.js.map +1 -1
  12. package/dist/components/datatable/DataTableServer.js +2 -1
  13. package/dist/components/datatable/DataTableServer.js.map +1 -1
  14. package/dist/components/form/AutocompleteSearchBar.js +2 -1
  15. package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
  16. package/dist/components/form/AutocompleteSearchBarServer.js +2 -1
  17. package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
  18. package/dist/components/form/FileInput.js +3 -2
  19. package/dist/components/form/FileInput.js.map +1 -1
  20. package/dist/components/form/FileInputMultiple.js +5 -3
  21. package/dist/components/form/FileInputMultiple.js.map +1 -1
  22. package/dist/components/form/FormField.js +2 -1
  23. package/dist/components/form/FormField.js.map +1 -1
  24. package/dist/components/form/PositionsSelectorSingle.js +2 -1
  25. package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
  26. package/dist/components/form/SelectField.js +2 -1
  27. package/dist/components/form/SelectField.js.map +1 -1
  28. package/dist/components/layout/CollapsibleSection.d.ts +11 -0
  29. package/dist/components/layout/CollapsibleSection.js +35 -0
  30. package/dist/components/layout/CollapsibleSection.js.map +1 -0
  31. package/dist/components/profiles/ProfileOverview.js +2 -1
  32. package/dist/components/profiles/ProfileOverview.js.map +1 -1
  33. package/dist/components/ui/Dialog.js +1 -1
  34. package/dist/components/ui/ScrollArea.js +1 -1
  35. package/dist/components/ui/checkbox.js +1 -1
  36. package/dist/components/ui/command.js +2 -2
  37. package/dist/components/ui/label.js +1 -1
  38. package/dist/components/ui/popover.js +5 -4
  39. package/dist/components/ui/popover.js.map +1 -1
  40. package/dist/components/ui/radioGroup.js +1 -1
  41. package/dist/components/ui/select.js +7 -5
  42. package/dist/components/ui/select.js.map +1 -1
  43. package/dist/components/ui/separator.js +1 -1
  44. package/dist/components/ui/sonner.d.ts +5 -0
  45. package/dist/components/ui/sonner.js +27 -0
  46. package/dist/components/ui/sonner.js.map +1 -0
  47. package/dist/components/ui/toast.d.ts +15 -0
  48. package/dist/components/ui/toast.js +742 -0
  49. package/dist/components/ui/toast.js.map +1 -0
  50. package/dist/components/ui/tooltip.js +4 -4
  51. package/dist/index-B4D9tlF2.js +37 -0
  52. package/dist/index-B4D9tlF2.js.map +1 -0
  53. package/dist/index-BIGXjoju.js +1162 -0
  54. package/dist/index-BIGXjoju.js.map +1 -0
  55. package/dist/index-BM2wqH4l.js +270 -0
  56. package/dist/index-BM2wqH4l.js.map +1 -0
  57. package/dist/index-BkUJPEGE.js +43 -0
  58. package/dist/index-BkUJPEGE.js.map +1 -0
  59. package/dist/index-BqfaqJMm.js +43 -0
  60. package/dist/index-BqfaqJMm.js.map +1 -0
  61. package/dist/index-BvG0B6Se.js +43 -0
  62. package/dist/index-BvG0B6Se.js.map +1 -0
  63. package/dist/index-ByYhNx4V.js +2204 -0
  64. package/dist/index-ByYhNx4V.js.map +1 -0
  65. package/dist/index-C1NhngpB.js +2212 -0
  66. package/dist/index-C1NhngpB.js.map +1 -0
  67. package/dist/index-C5uX_8yI.js +36 -0
  68. package/dist/index-C5uX_8yI.js.map +1 -0
  69. package/dist/index-CEVipgcd.js +234 -0
  70. package/dist/index-CEVipgcd.js.map +1 -0
  71. package/dist/index-CFdw_5ue.js +2204 -0
  72. package/dist/index-CFdw_5ue.js.map +1 -0
  73. package/dist/index-CQ3u2ZB9.js +28845 -0
  74. package/dist/index-CQ3u2ZB9.js.map +1 -0
  75. package/dist/index-CcUZ0rsE.js +2397 -0
  76. package/dist/index-CcUZ0rsE.js.map +1 -0
  77. package/dist/index-CmEWEow1.js +304 -0
  78. package/dist/index-CmEWEow1.js.map +1 -0
  79. package/dist/index-CwJgIvMz.js +43 -0
  80. package/dist/index-CwJgIvMz.js.map +1 -0
  81. package/dist/index-CxRvlMsQ.js +1162 -0
  82. package/dist/index-CxRvlMsQ.js.map +1 -0
  83. package/dist/index-Cxv2lY-3.js +234 -0
  84. package/dist/index-Cxv2lY-3.js.map +1 -0
  85. package/dist/index-CzU-7Pp-.js +1162 -0
  86. package/dist/index-CzU-7Pp-.js.map +1 -0
  87. package/dist/index-D2vw2lEy.js +2266 -0
  88. package/dist/index-D2vw2lEy.js.map +1 -0
  89. package/dist/index-D71KqwUL.js +28839 -0
  90. package/dist/index-D71KqwUL.js.map +1 -0
  91. package/dist/index-DVCdWg5e.js +36 -0
  92. package/dist/index-DVCdWg5e.js.map +1 -0
  93. package/dist/index-DWPKrsrN.js +234 -0
  94. package/dist/index-DWPKrsrN.js.map +1 -0
  95. package/dist/index-DiJxz9_S.js +36 -0
  96. package/dist/index-DiJxz9_S.js.map +1 -0
  97. package/dist/index-DjS0QG2f.js +28845 -0
  98. package/dist/index-DjS0QG2f.js.map +1 -0
  99. package/dist/index-FMLr5tN7.js +19 -0
  100. package/dist/index-FMLr5tN7.js.map +1 -0
  101. package/dist/index-GT3w9A2i.js +19 -0
  102. package/dist/index-GT3w9A2i.js.map +1 -0
  103. package/dist/index-Gbap2fMl.js +304 -0
  104. package/dist/index-Gbap2fMl.js.map +1 -0
  105. package/dist/index-R1AkuSsS.js +2204 -0
  106. package/dist/index-R1AkuSsS.js.map +1 -0
  107. package/dist/index-VCw-BbEd.js +36 -0
  108. package/dist/index-VCw-BbEd.js.map +1 -0
  109. package/dist/index-WjZKx4Rq.js +2266 -0
  110. package/dist/index-WjZKx4Rq.js.map +1 -0
  111. package/dist/index-XoubH6QK.js +19 -0
  112. package/dist/index-XoubH6QK.js.map +1 -0
  113. package/dist/index-cAAySw6z.js +19 -0
  114. package/dist/index-cAAySw6z.js.map +1 -0
  115. package/dist/index-eb1oES0O.js +234 -0
  116. package/dist/index-eb1oES0O.js.map +1 -0
  117. package/dist/index-efRbPAF9.js +304 -0
  118. package/dist/index-efRbPAF9.js.map +1 -0
  119. package/dist/index-g4PMBWfd.js +1162 -0
  120. package/dist/index-g4PMBWfd.js.map +1 -0
  121. package/dist/index-kx4d2yA2.js +2204 -0
  122. package/dist/index-kx4d2yA2.js.map +1 -0
  123. package/dist/index-tDQ16jIS.js +304 -0
  124. package/dist/index-tDQ16jIS.js.map +1 -0
  125. package/dist/index-u7IL3f7h.js +28811 -0
  126. package/dist/index-u7IL3f7h.js.map +1 -0
  127. package/dist/index.es-CORXX5Cy.js +9594 -0
  128. package/dist/index.es-CORXX5Cy.js.map +1 -0
  129. package/dist/jspdf.plugin.autotable-f-NQ-KEg.js +11475 -0
  130. package/dist/jspdf.plugin.autotable-f-NQ-KEg.js.map +1 -0
  131. package/dist/main.d.ts +2 -0
  132. package/dist/main.js +21 -15
  133. package/dist/main.js.map +1 -1
  134. package/dist/types.d.ts +1 -0
  135. package/dist/types.js.map +1 -1
  136. package/dist/utils/handleErrors.js +2 -1
  137. package/dist/utils/handleErrors.js.map +1 -1
  138. package/lib/components/form/FileInputMultiple.tsx +1 -0
  139. package/lib/components/layout/CollapsibleSection.tsx +48 -0
  140. package/lib/components/ui/sonner.tsx +31 -0
  141. package/lib/components/ui/toast.tsx +129 -0
  142. package/lib/main.ts +5 -0
  143. package/lib/types.ts +1 -0
  144. package/lib/utils/handleErrors.ts +2 -1
  145. package/package.json +4 -1
@@ -0,0 +1,2204 @@
1
+ import * as React from "react";
2
+ import { useLayoutEffect, useEffect } from "react";
3
+ import { r as reactDomExports } from "./index-DjS0QG2f.js";
4
+ import { P as Primitive } from "./index-CwJgIvMz.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { u as useComposedRefs } from "./index-D9mvqz1C.js";
7
+ import { a as useCallbackRef, u as useLayoutEffect2 } from "./index-CDCkSjVs.js";
8
+ import { u as useSize } from "./index-pLFWXSOv.js";
9
+ const sides = ["top", "right", "bottom", "left"];
10
+ const min = Math.min;
11
+ const max = Math.max;
12
+ const round = Math.round;
13
+ const floor = Math.floor;
14
+ const createCoords = (v) => ({
15
+ x: v,
16
+ y: v
17
+ });
18
+ const oppositeSideMap = {
19
+ left: "right",
20
+ right: "left",
21
+ bottom: "top",
22
+ top: "bottom"
23
+ };
24
+ const oppositeAlignmentMap = {
25
+ start: "end",
26
+ end: "start"
27
+ };
28
+ function clamp(start, value, end) {
29
+ return max(start, min(value, end));
30
+ }
31
+ function evaluate(value, param) {
32
+ return typeof value === "function" ? value(param) : value;
33
+ }
34
+ function getSide(placement) {
35
+ return placement.split("-")[0];
36
+ }
37
+ function getAlignment(placement) {
38
+ return placement.split("-")[1];
39
+ }
40
+ function getOppositeAxis(axis) {
41
+ return axis === "x" ? "y" : "x";
42
+ }
43
+ function getAxisLength(axis) {
44
+ return axis === "y" ? "height" : "width";
45
+ }
46
+ function getSideAxis(placement) {
47
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
48
+ }
49
+ function getAlignmentAxis(placement) {
50
+ return getOppositeAxis(getSideAxis(placement));
51
+ }
52
+ function getAlignmentSides(placement, rects, rtl) {
53
+ if (rtl === void 0) {
54
+ rtl = false;
55
+ }
56
+ const alignment = getAlignment(placement);
57
+ const alignmentAxis = getAlignmentAxis(placement);
58
+ const length = getAxisLength(alignmentAxis);
59
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
60
+ if (rects.reference[length] > rects.floating[length]) {
61
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
62
+ }
63
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
64
+ }
65
+ function getExpandedPlacements(placement) {
66
+ const oppositePlacement = getOppositePlacement(placement);
67
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
68
+ }
69
+ function getOppositeAlignmentPlacement(placement) {
70
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
71
+ }
72
+ function getSideList(side, isStart, rtl) {
73
+ const lr = ["left", "right"];
74
+ const rl = ["right", "left"];
75
+ const tb = ["top", "bottom"];
76
+ const bt = ["bottom", "top"];
77
+ switch (side) {
78
+ case "top":
79
+ case "bottom":
80
+ if (rtl)
81
+ return isStart ? rl : lr;
82
+ return isStart ? lr : rl;
83
+ case "left":
84
+ case "right":
85
+ return isStart ? tb : bt;
86
+ default:
87
+ return [];
88
+ }
89
+ }
90
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
91
+ const alignment = getAlignment(placement);
92
+ let list = getSideList(getSide(placement), direction === "start", rtl);
93
+ if (alignment) {
94
+ list = list.map((side) => side + "-" + alignment);
95
+ if (flipAlignment) {
96
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
97
+ }
98
+ }
99
+ return list;
100
+ }
101
+ function getOppositePlacement(placement) {
102
+ return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
103
+ }
104
+ function expandPaddingObject(padding) {
105
+ return {
106
+ top: 0,
107
+ right: 0,
108
+ bottom: 0,
109
+ left: 0,
110
+ ...padding
111
+ };
112
+ }
113
+ function getPaddingObject(padding) {
114
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
115
+ top: padding,
116
+ right: padding,
117
+ bottom: padding,
118
+ left: padding
119
+ };
120
+ }
121
+ function rectToClientRect(rect) {
122
+ const {
123
+ x,
124
+ y,
125
+ width,
126
+ height
127
+ } = rect;
128
+ return {
129
+ width,
130
+ height,
131
+ top: y,
132
+ left: x,
133
+ right: x + width,
134
+ bottom: y + height,
135
+ x,
136
+ y
137
+ };
138
+ }
139
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
140
+ let {
141
+ reference,
142
+ floating
143
+ } = _ref;
144
+ const sideAxis = getSideAxis(placement);
145
+ const alignmentAxis = getAlignmentAxis(placement);
146
+ const alignLength = getAxisLength(alignmentAxis);
147
+ const side = getSide(placement);
148
+ const isVertical = sideAxis === "y";
149
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
150
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
151
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
152
+ let coords;
153
+ switch (side) {
154
+ case "top":
155
+ coords = {
156
+ x: commonX,
157
+ y: reference.y - floating.height
158
+ };
159
+ break;
160
+ case "bottom":
161
+ coords = {
162
+ x: commonX,
163
+ y: reference.y + reference.height
164
+ };
165
+ break;
166
+ case "right":
167
+ coords = {
168
+ x: reference.x + reference.width,
169
+ y: commonY
170
+ };
171
+ break;
172
+ case "left":
173
+ coords = {
174
+ x: reference.x - floating.width,
175
+ y: commonY
176
+ };
177
+ break;
178
+ default:
179
+ coords = {
180
+ x: reference.x,
181
+ y: reference.y
182
+ };
183
+ }
184
+ switch (getAlignment(placement)) {
185
+ case "start":
186
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
187
+ break;
188
+ case "end":
189
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
190
+ break;
191
+ }
192
+ return coords;
193
+ }
194
+ const computePosition$1 = async (reference, floating, config) => {
195
+ const {
196
+ placement = "bottom",
197
+ strategy = "absolute",
198
+ middleware = [],
199
+ platform: platform2
200
+ } = config;
201
+ const validMiddleware = middleware.filter(Boolean);
202
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
203
+ let rects = await platform2.getElementRects({
204
+ reference,
205
+ floating,
206
+ strategy
207
+ });
208
+ let {
209
+ x,
210
+ y
211
+ } = computeCoordsFromPlacement(rects, placement, rtl);
212
+ let statefulPlacement = placement;
213
+ let middlewareData = {};
214
+ let resetCount = 0;
215
+ for (let i = 0; i < validMiddleware.length; i++) {
216
+ const {
217
+ name,
218
+ fn
219
+ } = validMiddleware[i];
220
+ const {
221
+ x: nextX,
222
+ y: nextY,
223
+ data,
224
+ reset
225
+ } = await fn({
226
+ x,
227
+ y,
228
+ initialPlacement: placement,
229
+ placement: statefulPlacement,
230
+ strategy,
231
+ middlewareData,
232
+ rects,
233
+ platform: platform2,
234
+ elements: {
235
+ reference,
236
+ floating
237
+ }
238
+ });
239
+ x = nextX != null ? nextX : x;
240
+ y = nextY != null ? nextY : y;
241
+ middlewareData = {
242
+ ...middlewareData,
243
+ [name]: {
244
+ ...middlewareData[name],
245
+ ...data
246
+ }
247
+ };
248
+ if (reset && resetCount <= 50) {
249
+ resetCount++;
250
+ if (typeof reset === "object") {
251
+ if (reset.placement) {
252
+ statefulPlacement = reset.placement;
253
+ }
254
+ if (reset.rects) {
255
+ rects = reset.rects === true ? await platform2.getElementRects({
256
+ reference,
257
+ floating,
258
+ strategy
259
+ }) : reset.rects;
260
+ }
261
+ ({
262
+ x,
263
+ y
264
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
265
+ }
266
+ i = -1;
267
+ }
268
+ }
269
+ return {
270
+ x,
271
+ y,
272
+ placement: statefulPlacement,
273
+ strategy,
274
+ middlewareData
275
+ };
276
+ };
277
+ async function detectOverflow(state, options) {
278
+ var _await$platform$isEle;
279
+ if (options === void 0) {
280
+ options = {};
281
+ }
282
+ const {
283
+ x,
284
+ y,
285
+ platform: platform2,
286
+ rects,
287
+ elements,
288
+ strategy
289
+ } = state;
290
+ const {
291
+ boundary = "clippingAncestors",
292
+ rootBoundary = "viewport",
293
+ elementContext = "floating",
294
+ altBoundary = false,
295
+ padding = 0
296
+ } = evaluate(options, state);
297
+ const paddingObject = getPaddingObject(padding);
298
+ const altContext = elementContext === "floating" ? "reference" : "floating";
299
+ const element = elements[altBoundary ? altContext : elementContext];
300
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
301
+ 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)),
302
+ boundary,
303
+ rootBoundary,
304
+ strategy
305
+ }));
306
+ const rect = elementContext === "floating" ? {
307
+ x,
308
+ y,
309
+ width: rects.floating.width,
310
+ height: rects.floating.height
311
+ } : rects.reference;
312
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
313
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
314
+ x: 1,
315
+ y: 1
316
+ } : {
317
+ x: 1,
318
+ y: 1
319
+ };
320
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
321
+ elements,
322
+ rect,
323
+ offsetParent,
324
+ strategy
325
+ }) : rect);
326
+ return {
327
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
328
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
329
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
330
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
331
+ };
332
+ }
333
+ const arrow$3 = (options) => ({
334
+ name: "arrow",
335
+ options,
336
+ async fn(state) {
337
+ const {
338
+ x,
339
+ y,
340
+ placement,
341
+ rects,
342
+ platform: platform2,
343
+ elements,
344
+ middlewareData
345
+ } = state;
346
+ const {
347
+ element,
348
+ padding = 0
349
+ } = evaluate(options, state) || {};
350
+ if (element == null) {
351
+ return {};
352
+ }
353
+ const paddingObject = getPaddingObject(padding);
354
+ const coords = {
355
+ x,
356
+ y
357
+ };
358
+ const axis = getAlignmentAxis(placement);
359
+ const length = getAxisLength(axis);
360
+ const arrowDimensions = await platform2.getDimensions(element);
361
+ const isYAxis = axis === "y";
362
+ const minProp = isYAxis ? "top" : "left";
363
+ const maxProp = isYAxis ? "bottom" : "right";
364
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
365
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
366
+ const startDiff = coords[axis] - rects.reference[axis];
367
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
368
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
369
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
370
+ clientSize = elements.floating[clientProp] || rects.floating[length];
371
+ }
372
+ const centerToReference = endDiff / 2 - startDiff / 2;
373
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
374
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
375
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
376
+ const min$1 = minPadding;
377
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
378
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
379
+ const offset2 = clamp(min$1, center, max2);
380
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
381
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
382
+ return {
383
+ [axis]: coords[axis] + alignmentOffset,
384
+ data: {
385
+ [axis]: offset2,
386
+ centerOffset: center - offset2 - alignmentOffset,
387
+ ...shouldAddOffset && {
388
+ alignmentOffset
389
+ }
390
+ },
391
+ reset: shouldAddOffset
392
+ };
393
+ }
394
+ });
395
+ const flip$2 = function(options) {
396
+ if (options === void 0) {
397
+ options = {};
398
+ }
399
+ return {
400
+ name: "flip",
401
+ options,
402
+ async fn(state) {
403
+ var _middlewareData$arrow, _middlewareData$flip;
404
+ const {
405
+ placement,
406
+ middlewareData,
407
+ rects,
408
+ initialPlacement,
409
+ platform: platform2,
410
+ elements
411
+ } = state;
412
+ const {
413
+ mainAxis: checkMainAxis = true,
414
+ crossAxis: checkCrossAxis = true,
415
+ fallbackPlacements: specifiedFallbackPlacements,
416
+ fallbackStrategy = "bestFit",
417
+ fallbackAxisSideDirection = "none",
418
+ flipAlignment = true,
419
+ ...detectOverflowOptions
420
+ } = evaluate(options, state);
421
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
422
+ return {};
423
+ }
424
+ const side = getSide(placement);
425
+ const initialSideAxis = getSideAxis(initialPlacement);
426
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
427
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
428
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
429
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
430
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
431
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
432
+ }
433
+ const placements = [initialPlacement, ...fallbackPlacements];
434
+ const overflow = await detectOverflow(state, detectOverflowOptions);
435
+ const overflows = [];
436
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
437
+ if (checkMainAxis) {
438
+ overflows.push(overflow[side]);
439
+ }
440
+ if (checkCrossAxis) {
441
+ const sides2 = getAlignmentSides(placement, rects, rtl);
442
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
443
+ }
444
+ overflowsData = [...overflowsData, {
445
+ placement,
446
+ overflows
447
+ }];
448
+ if (!overflows.every((side2) => side2 <= 0)) {
449
+ var _middlewareData$flip2, _overflowsData$filter;
450
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
451
+ const nextPlacement = placements[nextIndex];
452
+ if (nextPlacement) {
453
+ return {
454
+ data: {
455
+ index: nextIndex,
456
+ overflows: overflowsData
457
+ },
458
+ reset: {
459
+ placement: nextPlacement
460
+ }
461
+ };
462
+ }
463
+ 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;
464
+ if (!resetPlacement) {
465
+ switch (fallbackStrategy) {
466
+ case "bestFit": {
467
+ var _overflowsData$filter2;
468
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
469
+ if (hasFallbackAxisSideDirection) {
470
+ const currentSideAxis = getSideAxis(d.placement);
471
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
472
+ // reading directions favoring greater width.
473
+ currentSideAxis === "y";
474
+ }
475
+ return true;
476
+ }).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];
477
+ if (placement2) {
478
+ resetPlacement = placement2;
479
+ }
480
+ break;
481
+ }
482
+ case "initialPlacement":
483
+ resetPlacement = initialPlacement;
484
+ break;
485
+ }
486
+ }
487
+ if (placement !== resetPlacement) {
488
+ return {
489
+ reset: {
490
+ placement: resetPlacement
491
+ }
492
+ };
493
+ }
494
+ }
495
+ return {};
496
+ }
497
+ };
498
+ };
499
+ function getSideOffsets(overflow, rect) {
500
+ return {
501
+ top: overflow.top - rect.height,
502
+ right: overflow.right - rect.width,
503
+ bottom: overflow.bottom - rect.height,
504
+ left: overflow.left - rect.width
505
+ };
506
+ }
507
+ function isAnySideFullyClipped(overflow) {
508
+ return sides.some((side) => overflow[side] >= 0);
509
+ }
510
+ const hide$2 = function(options) {
511
+ if (options === void 0) {
512
+ options = {};
513
+ }
514
+ return {
515
+ name: "hide",
516
+ options,
517
+ async fn(state) {
518
+ const {
519
+ rects
520
+ } = state;
521
+ const {
522
+ strategy = "referenceHidden",
523
+ ...detectOverflowOptions
524
+ } = evaluate(options, state);
525
+ switch (strategy) {
526
+ case "referenceHidden": {
527
+ const overflow = await detectOverflow(state, {
528
+ ...detectOverflowOptions,
529
+ elementContext: "reference"
530
+ });
531
+ const offsets = getSideOffsets(overflow, rects.reference);
532
+ return {
533
+ data: {
534
+ referenceHiddenOffsets: offsets,
535
+ referenceHidden: isAnySideFullyClipped(offsets)
536
+ }
537
+ };
538
+ }
539
+ case "escaped": {
540
+ const overflow = await detectOverflow(state, {
541
+ ...detectOverflowOptions,
542
+ altBoundary: true
543
+ });
544
+ const offsets = getSideOffsets(overflow, rects.floating);
545
+ return {
546
+ data: {
547
+ escapedOffsets: offsets,
548
+ escaped: isAnySideFullyClipped(offsets)
549
+ }
550
+ };
551
+ }
552
+ default: {
553
+ return {};
554
+ }
555
+ }
556
+ }
557
+ };
558
+ };
559
+ async function convertValueToCoords(state, options) {
560
+ const {
561
+ placement,
562
+ platform: platform2,
563
+ elements
564
+ } = state;
565
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
566
+ const side = getSide(placement);
567
+ const alignment = getAlignment(placement);
568
+ const isVertical = getSideAxis(placement) === "y";
569
+ const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
570
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
571
+ const rawValue = evaluate(options, state);
572
+ let {
573
+ mainAxis,
574
+ crossAxis,
575
+ alignmentAxis
576
+ } = typeof rawValue === "number" ? {
577
+ mainAxis: rawValue,
578
+ crossAxis: 0,
579
+ alignmentAxis: null
580
+ } : {
581
+ mainAxis: rawValue.mainAxis || 0,
582
+ crossAxis: rawValue.crossAxis || 0,
583
+ alignmentAxis: rawValue.alignmentAxis
584
+ };
585
+ if (alignment && typeof alignmentAxis === "number") {
586
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
587
+ }
588
+ return isVertical ? {
589
+ x: crossAxis * crossAxisMulti,
590
+ y: mainAxis * mainAxisMulti
591
+ } : {
592
+ x: mainAxis * mainAxisMulti,
593
+ y: crossAxis * crossAxisMulti
594
+ };
595
+ }
596
+ const offset$2 = function(options) {
597
+ if (options === void 0) {
598
+ options = 0;
599
+ }
600
+ return {
601
+ name: "offset",
602
+ options,
603
+ async fn(state) {
604
+ var _middlewareData$offse, _middlewareData$arrow;
605
+ const {
606
+ x,
607
+ y,
608
+ placement,
609
+ middlewareData
610
+ } = state;
611
+ const diffCoords = await convertValueToCoords(state, options);
612
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
613
+ return {};
614
+ }
615
+ return {
616
+ x: x + diffCoords.x,
617
+ y: y + diffCoords.y,
618
+ data: {
619
+ ...diffCoords,
620
+ placement
621
+ }
622
+ };
623
+ }
624
+ };
625
+ };
626
+ const shift$2 = function(options) {
627
+ if (options === void 0) {
628
+ options = {};
629
+ }
630
+ return {
631
+ name: "shift",
632
+ options,
633
+ async fn(state) {
634
+ const {
635
+ x,
636
+ y,
637
+ placement
638
+ } = state;
639
+ const {
640
+ mainAxis: checkMainAxis = true,
641
+ crossAxis: checkCrossAxis = false,
642
+ limiter = {
643
+ fn: (_ref) => {
644
+ let {
645
+ x: x2,
646
+ y: y2
647
+ } = _ref;
648
+ return {
649
+ x: x2,
650
+ y: y2
651
+ };
652
+ }
653
+ },
654
+ ...detectOverflowOptions
655
+ } = evaluate(options, state);
656
+ const coords = {
657
+ x,
658
+ y
659
+ };
660
+ const overflow = await detectOverflow(state, detectOverflowOptions);
661
+ const crossAxis = getSideAxis(getSide(placement));
662
+ const mainAxis = getOppositeAxis(crossAxis);
663
+ let mainAxisCoord = coords[mainAxis];
664
+ let crossAxisCoord = coords[crossAxis];
665
+ if (checkMainAxis) {
666
+ const minSide = mainAxis === "y" ? "top" : "left";
667
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
668
+ const min2 = mainAxisCoord + overflow[minSide];
669
+ const max2 = mainAxisCoord - overflow[maxSide];
670
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
671
+ }
672
+ if (checkCrossAxis) {
673
+ const minSide = crossAxis === "y" ? "top" : "left";
674
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
675
+ const min2 = crossAxisCoord + overflow[minSide];
676
+ const max2 = crossAxisCoord - overflow[maxSide];
677
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
678
+ }
679
+ const limitedCoords = limiter.fn({
680
+ ...state,
681
+ [mainAxis]: mainAxisCoord,
682
+ [crossAxis]: crossAxisCoord
683
+ });
684
+ return {
685
+ ...limitedCoords,
686
+ data: {
687
+ x: limitedCoords.x - x,
688
+ y: limitedCoords.y - y,
689
+ enabled: {
690
+ [mainAxis]: checkMainAxis,
691
+ [crossAxis]: checkCrossAxis
692
+ }
693
+ }
694
+ };
695
+ }
696
+ };
697
+ };
698
+ const limitShift$2 = function(options) {
699
+ if (options === void 0) {
700
+ options = {};
701
+ }
702
+ return {
703
+ options,
704
+ fn(state) {
705
+ const {
706
+ x,
707
+ y,
708
+ placement,
709
+ rects,
710
+ middlewareData
711
+ } = state;
712
+ const {
713
+ offset: offset2 = 0,
714
+ mainAxis: checkMainAxis = true,
715
+ crossAxis: checkCrossAxis = true
716
+ } = evaluate(options, state);
717
+ const coords = {
718
+ x,
719
+ y
720
+ };
721
+ const crossAxis = getSideAxis(placement);
722
+ const mainAxis = getOppositeAxis(crossAxis);
723
+ let mainAxisCoord = coords[mainAxis];
724
+ let crossAxisCoord = coords[crossAxis];
725
+ const rawOffset = evaluate(offset2, state);
726
+ const computedOffset = typeof rawOffset === "number" ? {
727
+ mainAxis: rawOffset,
728
+ crossAxis: 0
729
+ } : {
730
+ mainAxis: 0,
731
+ crossAxis: 0,
732
+ ...rawOffset
733
+ };
734
+ if (checkMainAxis) {
735
+ const len = mainAxis === "y" ? "height" : "width";
736
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
737
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
738
+ if (mainAxisCoord < limitMin) {
739
+ mainAxisCoord = limitMin;
740
+ } else if (mainAxisCoord > limitMax) {
741
+ mainAxisCoord = limitMax;
742
+ }
743
+ }
744
+ if (checkCrossAxis) {
745
+ var _middlewareData$offse, _middlewareData$offse2;
746
+ const len = mainAxis === "y" ? "width" : "height";
747
+ const isOriginSide = ["top", "left"].includes(getSide(placement));
748
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
749
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
750
+ if (crossAxisCoord < limitMin) {
751
+ crossAxisCoord = limitMin;
752
+ } else if (crossAxisCoord > limitMax) {
753
+ crossAxisCoord = limitMax;
754
+ }
755
+ }
756
+ return {
757
+ [mainAxis]: mainAxisCoord,
758
+ [crossAxis]: crossAxisCoord
759
+ };
760
+ }
761
+ };
762
+ };
763
+ const size$2 = function(options) {
764
+ if (options === void 0) {
765
+ options = {};
766
+ }
767
+ return {
768
+ name: "size",
769
+ options,
770
+ async fn(state) {
771
+ var _state$middlewareData, _state$middlewareData2;
772
+ const {
773
+ placement,
774
+ rects,
775
+ platform: platform2,
776
+ elements
777
+ } = state;
778
+ const {
779
+ apply = () => {
780
+ },
781
+ ...detectOverflowOptions
782
+ } = evaluate(options, state);
783
+ const overflow = await detectOverflow(state, detectOverflowOptions);
784
+ const side = getSide(placement);
785
+ const alignment = getAlignment(placement);
786
+ const isYAxis = getSideAxis(placement) === "y";
787
+ const {
788
+ width,
789
+ height
790
+ } = rects.floating;
791
+ let heightSide;
792
+ let widthSide;
793
+ if (side === "top" || side === "bottom") {
794
+ heightSide = side;
795
+ widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
796
+ } else {
797
+ widthSide = side;
798
+ heightSide = alignment === "end" ? "top" : "bottom";
799
+ }
800
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
801
+ const maximumClippingWidth = width - overflow.left - overflow.right;
802
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
803
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
804
+ const noShift = !state.middlewareData.shift;
805
+ let availableHeight = overflowAvailableHeight;
806
+ let availableWidth = overflowAvailableWidth;
807
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
808
+ availableWidth = maximumClippingWidth;
809
+ }
810
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
811
+ availableHeight = maximumClippingHeight;
812
+ }
813
+ if (noShift && !alignment) {
814
+ const xMin = max(overflow.left, 0);
815
+ const xMax = max(overflow.right, 0);
816
+ const yMin = max(overflow.top, 0);
817
+ const yMax = max(overflow.bottom, 0);
818
+ if (isYAxis) {
819
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
820
+ } else {
821
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
822
+ }
823
+ }
824
+ await apply({
825
+ ...state,
826
+ availableWidth,
827
+ availableHeight
828
+ });
829
+ const nextDimensions = await platform2.getDimensions(elements.floating);
830
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
831
+ return {
832
+ reset: {
833
+ rects: true
834
+ }
835
+ };
836
+ }
837
+ return {};
838
+ }
839
+ };
840
+ };
841
+ function hasWindow() {
842
+ return typeof window !== "undefined";
843
+ }
844
+ function getNodeName(node) {
845
+ if (isNode(node)) {
846
+ return (node.nodeName || "").toLowerCase();
847
+ }
848
+ return "#document";
849
+ }
850
+ function getWindow(node) {
851
+ var _node$ownerDocument;
852
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
853
+ }
854
+ function getDocumentElement(node) {
855
+ var _ref;
856
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
857
+ }
858
+ function isNode(value) {
859
+ if (!hasWindow()) {
860
+ return false;
861
+ }
862
+ return value instanceof Node || value instanceof getWindow(value).Node;
863
+ }
864
+ function isElement(value) {
865
+ if (!hasWindow()) {
866
+ return false;
867
+ }
868
+ return value instanceof Element || value instanceof getWindow(value).Element;
869
+ }
870
+ function isHTMLElement(value) {
871
+ if (!hasWindow()) {
872
+ return false;
873
+ }
874
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
875
+ }
876
+ function isShadowRoot(value) {
877
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
878
+ return false;
879
+ }
880
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
881
+ }
882
+ function isOverflowElement(element) {
883
+ const {
884
+ overflow,
885
+ overflowX,
886
+ overflowY,
887
+ display
888
+ } = getComputedStyle(element);
889
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
890
+ }
891
+ function isTableElement(element) {
892
+ return ["table", "td", "th"].includes(getNodeName(element));
893
+ }
894
+ function isTopLayer(element) {
895
+ return [":popover-open", ":modal"].some((selector) => {
896
+ try {
897
+ return element.matches(selector);
898
+ } catch (e) {
899
+ return false;
900
+ }
901
+ });
902
+ }
903
+ function isContainingBlock(elementOrCss) {
904
+ const webkit = isWebKit();
905
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
906
+ return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
907
+ }
908
+ function getContainingBlock(element) {
909
+ let currentNode = getParentNode(element);
910
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
911
+ if (isContainingBlock(currentNode)) {
912
+ return currentNode;
913
+ } else if (isTopLayer(currentNode)) {
914
+ return null;
915
+ }
916
+ currentNode = getParentNode(currentNode);
917
+ }
918
+ return null;
919
+ }
920
+ function isWebKit() {
921
+ if (typeof CSS === "undefined" || !CSS.supports)
922
+ return false;
923
+ return CSS.supports("-webkit-backdrop-filter", "none");
924
+ }
925
+ function isLastTraversableNode(node) {
926
+ return ["html", "body", "#document"].includes(getNodeName(node));
927
+ }
928
+ function getComputedStyle(element) {
929
+ return getWindow(element).getComputedStyle(element);
930
+ }
931
+ function getNodeScroll(element) {
932
+ if (isElement(element)) {
933
+ return {
934
+ scrollLeft: element.scrollLeft,
935
+ scrollTop: element.scrollTop
936
+ };
937
+ }
938
+ return {
939
+ scrollLeft: element.scrollX,
940
+ scrollTop: element.scrollY
941
+ };
942
+ }
943
+ function getParentNode(node) {
944
+ if (getNodeName(node) === "html") {
945
+ return node;
946
+ }
947
+ const result = (
948
+ // Step into the shadow DOM of the parent of a slotted node.
949
+ node.assignedSlot || // DOM Element detected.
950
+ node.parentNode || // ShadowRoot detected.
951
+ isShadowRoot(node) && node.host || // Fallback.
952
+ getDocumentElement(node)
953
+ );
954
+ return isShadowRoot(result) ? result.host : result;
955
+ }
956
+ function getNearestOverflowAncestor(node) {
957
+ const parentNode = getParentNode(node);
958
+ if (isLastTraversableNode(parentNode)) {
959
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
960
+ }
961
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
962
+ return parentNode;
963
+ }
964
+ return getNearestOverflowAncestor(parentNode);
965
+ }
966
+ function getOverflowAncestors(node, list, traverseIframes) {
967
+ var _node$ownerDocument2;
968
+ if (list === void 0) {
969
+ list = [];
970
+ }
971
+ if (traverseIframes === void 0) {
972
+ traverseIframes = true;
973
+ }
974
+ const scrollableAncestor = getNearestOverflowAncestor(node);
975
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
976
+ const win = getWindow(scrollableAncestor);
977
+ if (isBody) {
978
+ const frameElement = getFrameElement(win);
979
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
980
+ }
981
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
982
+ }
983
+ function getFrameElement(win) {
984
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
985
+ }
986
+ function getCssDimensions(element) {
987
+ const css = getComputedStyle(element);
988
+ let width = parseFloat(css.width) || 0;
989
+ let height = parseFloat(css.height) || 0;
990
+ const hasOffset = isHTMLElement(element);
991
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
992
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
993
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
994
+ if (shouldFallback) {
995
+ width = offsetWidth;
996
+ height = offsetHeight;
997
+ }
998
+ return {
999
+ width,
1000
+ height,
1001
+ $: shouldFallback
1002
+ };
1003
+ }
1004
+ function unwrapElement(element) {
1005
+ return !isElement(element) ? element.contextElement : element;
1006
+ }
1007
+ function getScale(element) {
1008
+ const domElement = unwrapElement(element);
1009
+ if (!isHTMLElement(domElement)) {
1010
+ return createCoords(1);
1011
+ }
1012
+ const rect = domElement.getBoundingClientRect();
1013
+ const {
1014
+ width,
1015
+ height,
1016
+ $
1017
+ } = getCssDimensions(domElement);
1018
+ let x = ($ ? round(rect.width) : rect.width) / width;
1019
+ let y = ($ ? round(rect.height) : rect.height) / height;
1020
+ if (!x || !Number.isFinite(x)) {
1021
+ x = 1;
1022
+ }
1023
+ if (!y || !Number.isFinite(y)) {
1024
+ y = 1;
1025
+ }
1026
+ return {
1027
+ x,
1028
+ y
1029
+ };
1030
+ }
1031
+ const noOffsets = /* @__PURE__ */ createCoords(0);
1032
+ function getVisualOffsets(element) {
1033
+ const win = getWindow(element);
1034
+ if (!isWebKit() || !win.visualViewport) {
1035
+ return noOffsets;
1036
+ }
1037
+ return {
1038
+ x: win.visualViewport.offsetLeft,
1039
+ y: win.visualViewport.offsetTop
1040
+ };
1041
+ }
1042
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1043
+ if (isFixed === void 0) {
1044
+ isFixed = false;
1045
+ }
1046
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1047
+ return false;
1048
+ }
1049
+ return isFixed;
1050
+ }
1051
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1052
+ if (includeScale === void 0) {
1053
+ includeScale = false;
1054
+ }
1055
+ if (isFixedStrategy === void 0) {
1056
+ isFixedStrategy = false;
1057
+ }
1058
+ const clientRect = element.getBoundingClientRect();
1059
+ const domElement = unwrapElement(element);
1060
+ let scale = createCoords(1);
1061
+ if (includeScale) {
1062
+ if (offsetParent) {
1063
+ if (isElement(offsetParent)) {
1064
+ scale = getScale(offsetParent);
1065
+ }
1066
+ } else {
1067
+ scale = getScale(element);
1068
+ }
1069
+ }
1070
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1071
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1072
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1073
+ let width = clientRect.width / scale.x;
1074
+ let height = clientRect.height / scale.y;
1075
+ if (domElement) {
1076
+ const win = getWindow(domElement);
1077
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1078
+ let currentWin = win;
1079
+ let currentIFrame = getFrameElement(currentWin);
1080
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1081
+ const iframeScale = getScale(currentIFrame);
1082
+ const iframeRect = currentIFrame.getBoundingClientRect();
1083
+ const css = getComputedStyle(currentIFrame);
1084
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1085
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1086
+ x *= iframeScale.x;
1087
+ y *= iframeScale.y;
1088
+ width *= iframeScale.x;
1089
+ height *= iframeScale.y;
1090
+ x += left;
1091
+ y += top;
1092
+ currentWin = getWindow(currentIFrame);
1093
+ currentIFrame = getFrameElement(currentWin);
1094
+ }
1095
+ }
1096
+ return rectToClientRect({
1097
+ width,
1098
+ height,
1099
+ x,
1100
+ y
1101
+ });
1102
+ }
1103
+ function getWindowScrollBarX(element, rect) {
1104
+ const leftScroll = getNodeScroll(element).scrollLeft;
1105
+ if (!rect) {
1106
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1107
+ }
1108
+ return rect.left + leftScroll;
1109
+ }
1110
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1111
+ if (ignoreScrollbarX === void 0) {
1112
+ ignoreScrollbarX = false;
1113
+ }
1114
+ const htmlRect = documentElement.getBoundingClientRect();
1115
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
1116
+ // RTL <body> scrollbar.
1117
+ getWindowScrollBarX(documentElement, htmlRect)
1118
+ ));
1119
+ const y = htmlRect.top + scroll.scrollTop;
1120
+ return {
1121
+ x,
1122
+ y
1123
+ };
1124
+ }
1125
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1126
+ let {
1127
+ elements,
1128
+ rect,
1129
+ offsetParent,
1130
+ strategy
1131
+ } = _ref;
1132
+ const isFixed = strategy === "fixed";
1133
+ const documentElement = getDocumentElement(offsetParent);
1134
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1135
+ if (offsetParent === documentElement || topLayer && isFixed) {
1136
+ return rect;
1137
+ }
1138
+ let scroll = {
1139
+ scrollLeft: 0,
1140
+ scrollTop: 0
1141
+ };
1142
+ let scale = createCoords(1);
1143
+ const offsets = createCoords(0);
1144
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1145
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1146
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1147
+ scroll = getNodeScroll(offsetParent);
1148
+ }
1149
+ if (isHTMLElement(offsetParent)) {
1150
+ const offsetRect = getBoundingClientRect(offsetParent);
1151
+ scale = getScale(offsetParent);
1152
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1153
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1154
+ }
1155
+ }
1156
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1157
+ return {
1158
+ width: rect.width * scale.x,
1159
+ height: rect.height * scale.y,
1160
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1161
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1162
+ };
1163
+ }
1164
+ function getClientRects(element) {
1165
+ return Array.from(element.getClientRects());
1166
+ }
1167
+ function getDocumentRect(element) {
1168
+ const html = getDocumentElement(element);
1169
+ const scroll = getNodeScroll(element);
1170
+ const body = element.ownerDocument.body;
1171
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1172
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1173
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1174
+ const y = -scroll.scrollTop;
1175
+ if (getComputedStyle(body).direction === "rtl") {
1176
+ x += max(html.clientWidth, body.clientWidth) - width;
1177
+ }
1178
+ return {
1179
+ width,
1180
+ height,
1181
+ x,
1182
+ y
1183
+ };
1184
+ }
1185
+ function getViewportRect(element, strategy) {
1186
+ const win = getWindow(element);
1187
+ const html = getDocumentElement(element);
1188
+ const visualViewport = win.visualViewport;
1189
+ let width = html.clientWidth;
1190
+ let height = html.clientHeight;
1191
+ let x = 0;
1192
+ let y = 0;
1193
+ if (visualViewport) {
1194
+ width = visualViewport.width;
1195
+ height = visualViewport.height;
1196
+ const visualViewportBased = isWebKit();
1197
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
1198
+ x = visualViewport.offsetLeft;
1199
+ y = visualViewport.offsetTop;
1200
+ }
1201
+ }
1202
+ return {
1203
+ width,
1204
+ height,
1205
+ x,
1206
+ y
1207
+ };
1208
+ }
1209
+ function getInnerBoundingClientRect(element, strategy) {
1210
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1211
+ const top = clientRect.top + element.clientTop;
1212
+ const left = clientRect.left + element.clientLeft;
1213
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1214
+ const width = element.clientWidth * scale.x;
1215
+ const height = element.clientHeight * scale.y;
1216
+ const x = left * scale.x;
1217
+ const y = top * scale.y;
1218
+ return {
1219
+ width,
1220
+ height,
1221
+ x,
1222
+ y
1223
+ };
1224
+ }
1225
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1226
+ let rect;
1227
+ if (clippingAncestor === "viewport") {
1228
+ rect = getViewportRect(element, strategy);
1229
+ } else if (clippingAncestor === "document") {
1230
+ rect = getDocumentRect(getDocumentElement(element));
1231
+ } else if (isElement(clippingAncestor)) {
1232
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1233
+ } else {
1234
+ const visualOffsets = getVisualOffsets(element);
1235
+ rect = {
1236
+ x: clippingAncestor.x - visualOffsets.x,
1237
+ y: clippingAncestor.y - visualOffsets.y,
1238
+ width: clippingAncestor.width,
1239
+ height: clippingAncestor.height
1240
+ };
1241
+ }
1242
+ return rectToClientRect(rect);
1243
+ }
1244
+ function hasFixedPositionAncestor(element, stopNode) {
1245
+ const parentNode = getParentNode(element);
1246
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1247
+ return false;
1248
+ }
1249
+ return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
1250
+ }
1251
+ function getClippingElementAncestors(element, cache) {
1252
+ const cachedResult = cache.get(element);
1253
+ if (cachedResult) {
1254
+ return cachedResult;
1255
+ }
1256
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
1257
+ let currentContainingBlockComputedStyle = null;
1258
+ const elementIsFixed = getComputedStyle(element).position === "fixed";
1259
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1260
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1261
+ const computedStyle = getComputedStyle(currentNode);
1262
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1263
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
1264
+ currentContainingBlockComputedStyle = null;
1265
+ }
1266
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1267
+ if (shouldDropCurrentNode) {
1268
+ result = result.filter((ancestor) => ancestor !== currentNode);
1269
+ } else {
1270
+ currentContainingBlockComputedStyle = computedStyle;
1271
+ }
1272
+ currentNode = getParentNode(currentNode);
1273
+ }
1274
+ cache.set(element, result);
1275
+ return result;
1276
+ }
1277
+ function getClippingRect(_ref) {
1278
+ let {
1279
+ element,
1280
+ boundary,
1281
+ rootBoundary,
1282
+ strategy
1283
+ } = _ref;
1284
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1285
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1286
+ const firstClippingAncestor = clippingAncestors[0];
1287
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1288
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1289
+ accRect.top = max(rect.top, accRect.top);
1290
+ accRect.right = min(rect.right, accRect.right);
1291
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1292
+ accRect.left = max(rect.left, accRect.left);
1293
+ return accRect;
1294
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1295
+ return {
1296
+ width: clippingRect.right - clippingRect.left,
1297
+ height: clippingRect.bottom - clippingRect.top,
1298
+ x: clippingRect.left,
1299
+ y: clippingRect.top
1300
+ };
1301
+ }
1302
+ function getDimensions(element) {
1303
+ const {
1304
+ width,
1305
+ height
1306
+ } = getCssDimensions(element);
1307
+ return {
1308
+ width,
1309
+ height
1310
+ };
1311
+ }
1312
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1313
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1314
+ const documentElement = getDocumentElement(offsetParent);
1315
+ const isFixed = strategy === "fixed";
1316
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1317
+ let scroll = {
1318
+ scrollLeft: 0,
1319
+ scrollTop: 0
1320
+ };
1321
+ const offsets = createCoords(0);
1322
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1323
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1324
+ scroll = getNodeScroll(offsetParent);
1325
+ }
1326
+ if (isOffsetParentAnElement) {
1327
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1328
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1329
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1330
+ } else if (documentElement) {
1331
+ offsets.x = getWindowScrollBarX(documentElement);
1332
+ }
1333
+ }
1334
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1335
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1336
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1337
+ return {
1338
+ x,
1339
+ y,
1340
+ width: rect.width,
1341
+ height: rect.height
1342
+ };
1343
+ }
1344
+ function isStaticPositioned(element) {
1345
+ return getComputedStyle(element).position === "static";
1346
+ }
1347
+ function getTrueOffsetParent(element, polyfill) {
1348
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
1349
+ return null;
1350
+ }
1351
+ if (polyfill) {
1352
+ return polyfill(element);
1353
+ }
1354
+ let rawOffsetParent = element.offsetParent;
1355
+ if (getDocumentElement(element) === rawOffsetParent) {
1356
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1357
+ }
1358
+ return rawOffsetParent;
1359
+ }
1360
+ function getOffsetParent(element, polyfill) {
1361
+ const win = getWindow(element);
1362
+ if (isTopLayer(element)) {
1363
+ return win;
1364
+ }
1365
+ if (!isHTMLElement(element)) {
1366
+ let svgOffsetParent = getParentNode(element);
1367
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1368
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1369
+ return svgOffsetParent;
1370
+ }
1371
+ svgOffsetParent = getParentNode(svgOffsetParent);
1372
+ }
1373
+ return win;
1374
+ }
1375
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1376
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1377
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1378
+ }
1379
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1380
+ return win;
1381
+ }
1382
+ return offsetParent || getContainingBlock(element) || win;
1383
+ }
1384
+ const getElementRects = async function(data) {
1385
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1386
+ const getDimensionsFn = this.getDimensions;
1387
+ const floatingDimensions = await getDimensionsFn(data.floating);
1388
+ return {
1389
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1390
+ floating: {
1391
+ x: 0,
1392
+ y: 0,
1393
+ width: floatingDimensions.width,
1394
+ height: floatingDimensions.height
1395
+ }
1396
+ };
1397
+ };
1398
+ function isRTL(element) {
1399
+ return getComputedStyle(element).direction === "rtl";
1400
+ }
1401
+ const platform = {
1402
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1403
+ getDocumentElement,
1404
+ getClippingRect,
1405
+ getOffsetParent,
1406
+ getElementRects,
1407
+ getClientRects,
1408
+ getDimensions,
1409
+ getScale,
1410
+ isElement,
1411
+ isRTL
1412
+ };
1413
+ function observeMove(element, onMove) {
1414
+ let io = null;
1415
+ let timeoutId;
1416
+ const root = getDocumentElement(element);
1417
+ function cleanup() {
1418
+ var _io;
1419
+ clearTimeout(timeoutId);
1420
+ (_io = io) == null || _io.disconnect();
1421
+ io = null;
1422
+ }
1423
+ function refresh(skip, threshold) {
1424
+ if (skip === void 0) {
1425
+ skip = false;
1426
+ }
1427
+ if (threshold === void 0) {
1428
+ threshold = 1;
1429
+ }
1430
+ cleanup();
1431
+ const {
1432
+ left,
1433
+ top,
1434
+ width,
1435
+ height
1436
+ } = element.getBoundingClientRect();
1437
+ if (!skip) {
1438
+ onMove();
1439
+ }
1440
+ if (!width || !height) {
1441
+ return;
1442
+ }
1443
+ const insetTop = floor(top);
1444
+ const insetRight = floor(root.clientWidth - (left + width));
1445
+ const insetBottom = floor(root.clientHeight - (top + height));
1446
+ const insetLeft = floor(left);
1447
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1448
+ const options = {
1449
+ rootMargin,
1450
+ threshold: max(0, min(1, threshold)) || 1
1451
+ };
1452
+ let isFirstUpdate = true;
1453
+ function handleObserve(entries) {
1454
+ const ratio = entries[0].intersectionRatio;
1455
+ if (ratio !== threshold) {
1456
+ if (!isFirstUpdate) {
1457
+ return refresh();
1458
+ }
1459
+ if (!ratio) {
1460
+ timeoutId = setTimeout(() => {
1461
+ refresh(false, 1e-7);
1462
+ }, 1e3);
1463
+ } else {
1464
+ refresh(false, ratio);
1465
+ }
1466
+ }
1467
+ isFirstUpdate = false;
1468
+ }
1469
+ try {
1470
+ io = new IntersectionObserver(handleObserve, {
1471
+ ...options,
1472
+ // Handle <iframe>s
1473
+ root: root.ownerDocument
1474
+ });
1475
+ } catch (e) {
1476
+ io = new IntersectionObserver(handleObserve, options);
1477
+ }
1478
+ io.observe(element);
1479
+ }
1480
+ refresh(true);
1481
+ return cleanup;
1482
+ }
1483
+ function autoUpdate(reference, floating, update, options) {
1484
+ if (options === void 0) {
1485
+ options = {};
1486
+ }
1487
+ const {
1488
+ ancestorScroll = true,
1489
+ ancestorResize = true,
1490
+ elementResize = typeof ResizeObserver === "function",
1491
+ layoutShift = typeof IntersectionObserver === "function",
1492
+ animationFrame = false
1493
+ } = options;
1494
+ const referenceEl = unwrapElement(reference);
1495
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
1496
+ ancestors.forEach((ancestor) => {
1497
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
1498
+ passive: true
1499
+ });
1500
+ ancestorResize && ancestor.addEventListener("resize", update);
1501
+ });
1502
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1503
+ let reobserveFrame = -1;
1504
+ let resizeObserver = null;
1505
+ if (elementResize) {
1506
+ resizeObserver = new ResizeObserver((_ref) => {
1507
+ let [firstEntry] = _ref;
1508
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1509
+ resizeObserver.unobserve(floating);
1510
+ cancelAnimationFrame(reobserveFrame);
1511
+ reobserveFrame = requestAnimationFrame(() => {
1512
+ var _resizeObserver;
1513
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1514
+ });
1515
+ }
1516
+ update();
1517
+ });
1518
+ if (referenceEl && !animationFrame) {
1519
+ resizeObserver.observe(referenceEl);
1520
+ }
1521
+ resizeObserver.observe(floating);
1522
+ }
1523
+ let frameId;
1524
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1525
+ if (animationFrame) {
1526
+ frameLoop();
1527
+ }
1528
+ function frameLoop() {
1529
+ const nextRefRect = getBoundingClientRect(reference);
1530
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1531
+ update();
1532
+ }
1533
+ prevRefRect = nextRefRect;
1534
+ frameId = requestAnimationFrame(frameLoop);
1535
+ }
1536
+ update();
1537
+ return () => {
1538
+ var _resizeObserver2;
1539
+ ancestors.forEach((ancestor) => {
1540
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
1541
+ ancestorResize && ancestor.removeEventListener("resize", update);
1542
+ });
1543
+ cleanupIo == null || cleanupIo();
1544
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1545
+ resizeObserver = null;
1546
+ if (animationFrame) {
1547
+ cancelAnimationFrame(frameId);
1548
+ }
1549
+ };
1550
+ }
1551
+ const offset$1 = offset$2;
1552
+ const shift$1 = shift$2;
1553
+ const flip$1 = flip$2;
1554
+ const size$1 = size$2;
1555
+ const hide$1 = hide$2;
1556
+ const arrow$2 = arrow$3;
1557
+ const limitShift$1 = limitShift$2;
1558
+ const computePosition = (reference, floating, options) => {
1559
+ const cache = /* @__PURE__ */ new Map();
1560
+ const mergedOptions = {
1561
+ platform,
1562
+ ...options
1563
+ };
1564
+ const platformWithCache = {
1565
+ ...mergedOptions.platform,
1566
+ _c: cache
1567
+ };
1568
+ return computePosition$1(reference, floating, {
1569
+ ...mergedOptions,
1570
+ platform: platformWithCache
1571
+ });
1572
+ };
1573
+ var index = typeof document !== "undefined" ? useLayoutEffect : useEffect;
1574
+ function deepEqual(a, b) {
1575
+ if (a === b) {
1576
+ return true;
1577
+ }
1578
+ if (typeof a !== typeof b) {
1579
+ return false;
1580
+ }
1581
+ if (typeof a === "function" && a.toString() === b.toString()) {
1582
+ return true;
1583
+ }
1584
+ let length;
1585
+ let i;
1586
+ let keys;
1587
+ if (a && b && typeof a === "object") {
1588
+ if (Array.isArray(a)) {
1589
+ length = a.length;
1590
+ if (length !== b.length)
1591
+ return false;
1592
+ for (i = length; i-- !== 0; ) {
1593
+ if (!deepEqual(a[i], b[i])) {
1594
+ return false;
1595
+ }
1596
+ }
1597
+ return true;
1598
+ }
1599
+ keys = Object.keys(a);
1600
+ length = keys.length;
1601
+ if (length !== Object.keys(b).length) {
1602
+ return false;
1603
+ }
1604
+ for (i = length; i-- !== 0; ) {
1605
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
1606
+ return false;
1607
+ }
1608
+ }
1609
+ for (i = length; i-- !== 0; ) {
1610
+ const key = keys[i];
1611
+ if (key === "_owner" && a.$$typeof) {
1612
+ continue;
1613
+ }
1614
+ if (!deepEqual(a[key], b[key])) {
1615
+ return false;
1616
+ }
1617
+ }
1618
+ return true;
1619
+ }
1620
+ return a !== a && b !== b;
1621
+ }
1622
+ function getDPR(element) {
1623
+ if (typeof window === "undefined") {
1624
+ return 1;
1625
+ }
1626
+ const win = element.ownerDocument.defaultView || window;
1627
+ return win.devicePixelRatio || 1;
1628
+ }
1629
+ function roundByDPR(element, value) {
1630
+ const dpr = getDPR(element);
1631
+ return Math.round(value * dpr) / dpr;
1632
+ }
1633
+ function useLatestRef(value) {
1634
+ const ref = React.useRef(value);
1635
+ index(() => {
1636
+ ref.current = value;
1637
+ });
1638
+ return ref;
1639
+ }
1640
+ function useFloating(options) {
1641
+ if (options === void 0) {
1642
+ options = {};
1643
+ }
1644
+ const {
1645
+ placement = "bottom",
1646
+ strategy = "absolute",
1647
+ middleware = [],
1648
+ platform: platform2,
1649
+ elements: {
1650
+ reference: externalReference,
1651
+ floating: externalFloating
1652
+ } = {},
1653
+ transform = true,
1654
+ whileElementsMounted,
1655
+ open
1656
+ } = options;
1657
+ const [data, setData] = React.useState({
1658
+ x: 0,
1659
+ y: 0,
1660
+ strategy,
1661
+ placement,
1662
+ middlewareData: {},
1663
+ isPositioned: false
1664
+ });
1665
+ const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
1666
+ if (!deepEqual(latestMiddleware, middleware)) {
1667
+ setLatestMiddleware(middleware);
1668
+ }
1669
+ const [_reference, _setReference] = React.useState(null);
1670
+ const [_floating, _setFloating] = React.useState(null);
1671
+ const setReference = React.useCallback((node) => {
1672
+ if (node !== referenceRef.current) {
1673
+ referenceRef.current = node;
1674
+ _setReference(node);
1675
+ }
1676
+ }, []);
1677
+ const setFloating = React.useCallback((node) => {
1678
+ if (node !== floatingRef.current) {
1679
+ floatingRef.current = node;
1680
+ _setFloating(node);
1681
+ }
1682
+ }, []);
1683
+ const referenceEl = externalReference || _reference;
1684
+ const floatingEl = externalFloating || _floating;
1685
+ const referenceRef = React.useRef(null);
1686
+ const floatingRef = React.useRef(null);
1687
+ const dataRef = React.useRef(data);
1688
+ const hasWhileElementsMounted = whileElementsMounted != null;
1689
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
1690
+ const platformRef = useLatestRef(platform2);
1691
+ const openRef = useLatestRef(open);
1692
+ const update = React.useCallback(() => {
1693
+ if (!referenceRef.current || !floatingRef.current) {
1694
+ return;
1695
+ }
1696
+ const config = {
1697
+ placement,
1698
+ strategy,
1699
+ middleware: latestMiddleware
1700
+ };
1701
+ if (platformRef.current) {
1702
+ config.platform = platformRef.current;
1703
+ }
1704
+ computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
1705
+ const fullData = {
1706
+ ...data2,
1707
+ // The floating element's position may be recomputed while it's closed
1708
+ // but still mounted (such as when transitioning out). To ensure
1709
+ // `isPositioned` will be `false` initially on the next open, avoid
1710
+ // setting it to `true` when `open === false` (must be specified).
1711
+ isPositioned: openRef.current !== false
1712
+ };
1713
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
1714
+ dataRef.current = fullData;
1715
+ reactDomExports.flushSync(() => {
1716
+ setData(fullData);
1717
+ });
1718
+ }
1719
+ });
1720
+ }, [latestMiddleware, placement, strategy, platformRef, openRef]);
1721
+ index(() => {
1722
+ if (open === false && dataRef.current.isPositioned) {
1723
+ dataRef.current.isPositioned = false;
1724
+ setData((data2) => ({
1725
+ ...data2,
1726
+ isPositioned: false
1727
+ }));
1728
+ }
1729
+ }, [open]);
1730
+ const isMountedRef = React.useRef(false);
1731
+ index(() => {
1732
+ isMountedRef.current = true;
1733
+ return () => {
1734
+ isMountedRef.current = false;
1735
+ };
1736
+ }, []);
1737
+ index(() => {
1738
+ if (referenceEl)
1739
+ referenceRef.current = referenceEl;
1740
+ if (floatingEl)
1741
+ floatingRef.current = floatingEl;
1742
+ if (referenceEl && floatingEl) {
1743
+ if (whileElementsMountedRef.current) {
1744
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
1745
+ }
1746
+ update();
1747
+ }
1748
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
1749
+ const refs = React.useMemo(() => ({
1750
+ reference: referenceRef,
1751
+ floating: floatingRef,
1752
+ setReference,
1753
+ setFloating
1754
+ }), [setReference, setFloating]);
1755
+ const elements = React.useMemo(() => ({
1756
+ reference: referenceEl,
1757
+ floating: floatingEl
1758
+ }), [referenceEl, floatingEl]);
1759
+ const floatingStyles = React.useMemo(() => {
1760
+ const initialStyles = {
1761
+ position: strategy,
1762
+ left: 0,
1763
+ top: 0
1764
+ };
1765
+ if (!elements.floating) {
1766
+ return initialStyles;
1767
+ }
1768
+ const x = roundByDPR(elements.floating, data.x);
1769
+ const y = roundByDPR(elements.floating, data.y);
1770
+ if (transform) {
1771
+ return {
1772
+ ...initialStyles,
1773
+ transform: "translate(" + x + "px, " + y + "px)",
1774
+ ...getDPR(elements.floating) >= 1.5 && {
1775
+ willChange: "transform"
1776
+ }
1777
+ };
1778
+ }
1779
+ return {
1780
+ position: strategy,
1781
+ left: x,
1782
+ top: y
1783
+ };
1784
+ }, [strategy, transform, elements.floating, data.x, data.y]);
1785
+ return React.useMemo(() => ({
1786
+ ...data,
1787
+ update,
1788
+ refs,
1789
+ elements,
1790
+ floatingStyles
1791
+ }), [data, update, refs, elements, floatingStyles]);
1792
+ }
1793
+ const arrow$1 = (options) => {
1794
+ function isRef(value) {
1795
+ return {}.hasOwnProperty.call(value, "current");
1796
+ }
1797
+ return {
1798
+ name: "arrow",
1799
+ options,
1800
+ fn(state) {
1801
+ const {
1802
+ element,
1803
+ padding
1804
+ } = typeof options === "function" ? options(state) : options;
1805
+ if (element && isRef(element)) {
1806
+ if (element.current != null) {
1807
+ return arrow$2({
1808
+ element: element.current,
1809
+ padding
1810
+ }).fn(state);
1811
+ }
1812
+ return {};
1813
+ }
1814
+ if (element) {
1815
+ return arrow$2({
1816
+ element,
1817
+ padding
1818
+ }).fn(state);
1819
+ }
1820
+ return {};
1821
+ }
1822
+ };
1823
+ };
1824
+ const offset = (options, deps) => ({
1825
+ ...offset$1(options),
1826
+ options: [options, deps]
1827
+ });
1828
+ const shift = (options, deps) => ({
1829
+ ...shift$1(options),
1830
+ options: [options, deps]
1831
+ });
1832
+ const limitShift = (options, deps) => ({
1833
+ ...limitShift$1(options),
1834
+ options: [options, deps]
1835
+ });
1836
+ const flip = (options, deps) => ({
1837
+ ...flip$1(options),
1838
+ options: [options, deps]
1839
+ });
1840
+ const size = (options, deps) => ({
1841
+ ...size$1(options),
1842
+ options: [options, deps]
1843
+ });
1844
+ const hide = (options, deps) => ({
1845
+ ...hide$1(options),
1846
+ options: [options, deps]
1847
+ });
1848
+ const arrow = (options, deps) => ({
1849
+ ...arrow$1(options),
1850
+ options: [options, deps]
1851
+ });
1852
+ var NAME = "Arrow";
1853
+ var Arrow$1 = React.forwardRef((props, forwardedRef) => {
1854
+ const { children, width = 10, height = 5, ...arrowProps } = props;
1855
+ return /* @__PURE__ */ jsx(
1856
+ Primitive.svg,
1857
+ {
1858
+ ...arrowProps,
1859
+ ref: forwardedRef,
1860
+ width,
1861
+ height,
1862
+ viewBox: "0 0 30 10",
1863
+ preserveAspectRatio: "none",
1864
+ children: props.asChild ? children : /* @__PURE__ */ jsx("polygon", { points: "0,0 30,0 15,10" })
1865
+ }
1866
+ );
1867
+ });
1868
+ Arrow$1.displayName = NAME;
1869
+ var Root = Arrow$1;
1870
+ function createContextScope(scopeName, createContextScopeDeps = []) {
1871
+ let defaultContexts = [];
1872
+ function createContext3(rootComponentName, defaultContext) {
1873
+ const BaseContext = React.createContext(defaultContext);
1874
+ const index2 = defaultContexts.length;
1875
+ defaultContexts = [...defaultContexts, defaultContext];
1876
+ function Provider(props) {
1877
+ const { scope, children, ...context } = props;
1878
+ const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
1879
+ const value = React.useMemo(() => context, Object.values(context));
1880
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
1881
+ }
1882
+ function useContext2(consumerName, scope) {
1883
+ const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
1884
+ const context = React.useContext(Context);
1885
+ if (context)
1886
+ return context;
1887
+ if (defaultContext !== void 0)
1888
+ return defaultContext;
1889
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
1890
+ }
1891
+ Provider.displayName = rootComponentName + "Provider";
1892
+ return [Provider, useContext2];
1893
+ }
1894
+ const createScope = () => {
1895
+ const scopeContexts = defaultContexts.map((defaultContext) => {
1896
+ return React.createContext(defaultContext);
1897
+ });
1898
+ return function useScope(scope) {
1899
+ const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
1900
+ return React.useMemo(
1901
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
1902
+ [scope, contexts]
1903
+ );
1904
+ };
1905
+ };
1906
+ createScope.scopeName = scopeName;
1907
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
1908
+ }
1909
+ function composeContextScopes(...scopes) {
1910
+ const baseScope = scopes[0];
1911
+ if (scopes.length === 1)
1912
+ return baseScope;
1913
+ const createScope = () => {
1914
+ const scopeHooks = scopes.map((createScope2) => ({
1915
+ useScope: createScope2(),
1916
+ scopeName: createScope2.scopeName
1917
+ }));
1918
+ return function useComposedScopes(overrideScopes) {
1919
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
1920
+ const scopeProps = useScope(overrideScopes);
1921
+ const currentScope = scopeProps[`__scope${scopeName}`];
1922
+ return { ...nextScopes2, ...currentScope };
1923
+ }, {});
1924
+ return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
1925
+ };
1926
+ };
1927
+ createScope.scopeName = baseScope.scopeName;
1928
+ return createScope;
1929
+ }
1930
+ var POPPER_NAME = "Popper";
1931
+ var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
1932
+ var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
1933
+ var Popper = (props) => {
1934
+ const { __scopePopper, children } = props;
1935
+ const [anchor, setAnchor] = React.useState(null);
1936
+ return /* @__PURE__ */ jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
1937
+ };
1938
+ Popper.displayName = POPPER_NAME;
1939
+ var ANCHOR_NAME = "PopperAnchor";
1940
+ var PopperAnchor = React.forwardRef(
1941
+ (props, forwardedRef) => {
1942
+ const { __scopePopper, virtualRef, ...anchorProps } = props;
1943
+ const context = usePopperContext(ANCHOR_NAME, __scopePopper);
1944
+ const ref = React.useRef(null);
1945
+ const composedRefs = useComposedRefs(forwardedRef, ref);
1946
+ React.useEffect(() => {
1947
+ context.onAnchorChange((virtualRef == null ? void 0 : virtualRef.current) || ref.current);
1948
+ });
1949
+ return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
1950
+ }
1951
+ );
1952
+ PopperAnchor.displayName = ANCHOR_NAME;
1953
+ var CONTENT_NAME = "PopperContent";
1954
+ var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
1955
+ var PopperContent = React.forwardRef(
1956
+ (props, forwardedRef) => {
1957
+ var _a, _b, _c, _d, _e, _f;
1958
+ const {
1959
+ __scopePopper,
1960
+ side = "bottom",
1961
+ sideOffset = 0,
1962
+ align = "center",
1963
+ alignOffset = 0,
1964
+ arrowPadding = 0,
1965
+ avoidCollisions = true,
1966
+ collisionBoundary = [],
1967
+ collisionPadding: collisionPaddingProp = 0,
1968
+ sticky = "partial",
1969
+ hideWhenDetached = false,
1970
+ updatePositionStrategy = "optimized",
1971
+ onPlaced,
1972
+ ...contentProps
1973
+ } = props;
1974
+ const context = usePopperContext(CONTENT_NAME, __scopePopper);
1975
+ const [content, setContent] = React.useState(null);
1976
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
1977
+ const [arrow$12, setArrow] = React.useState(null);
1978
+ const arrowSize = useSize(arrow$12);
1979
+ const arrowWidth = (arrowSize == null ? void 0 : arrowSize.width) ?? 0;
1980
+ const arrowHeight = (arrowSize == null ? void 0 : arrowSize.height) ?? 0;
1981
+ const desiredPlacement = side + (align !== "center" ? "-" + align : "");
1982
+ const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
1983
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
1984
+ const hasExplicitBoundaries = boundary.length > 0;
1985
+ const detectOverflowOptions = {
1986
+ padding: collisionPadding,
1987
+ boundary: boundary.filter(isNotNull),
1988
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
1989
+ altBoundary: hasExplicitBoundaries
1990
+ };
1991
+ const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
1992
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
1993
+ strategy: "fixed",
1994
+ placement: desiredPlacement,
1995
+ whileElementsMounted: (...args) => {
1996
+ const cleanup = autoUpdate(...args, {
1997
+ animationFrame: updatePositionStrategy === "always"
1998
+ });
1999
+ return cleanup;
2000
+ },
2001
+ elements: {
2002
+ reference: context.anchor
2003
+ },
2004
+ middleware: [
2005
+ offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
2006
+ avoidCollisions && shift({
2007
+ mainAxis: true,
2008
+ crossAxis: false,
2009
+ limiter: sticky === "partial" ? limitShift() : void 0,
2010
+ ...detectOverflowOptions
2011
+ }),
2012
+ avoidCollisions && flip({ ...detectOverflowOptions }),
2013
+ size({
2014
+ ...detectOverflowOptions,
2015
+ apply: ({ elements, rects, availableWidth, availableHeight }) => {
2016
+ const { width: anchorWidth, height: anchorHeight } = rects.reference;
2017
+ const contentStyle = elements.floating.style;
2018
+ contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
2019
+ contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
2020
+ contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
2021
+ contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
2022
+ }
2023
+ }),
2024
+ arrow$12 && arrow({ element: arrow$12, padding: arrowPadding }),
2025
+ transformOrigin({ arrowWidth, arrowHeight }),
2026
+ hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
2027
+ ]
2028
+ });
2029
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
2030
+ const handlePlaced = useCallbackRef(onPlaced);
2031
+ useLayoutEffect2(() => {
2032
+ if (isPositioned) {
2033
+ handlePlaced == null ? void 0 : handlePlaced();
2034
+ }
2035
+ }, [isPositioned, handlePlaced]);
2036
+ const arrowX = (_a = middlewareData.arrow) == null ? void 0 : _a.x;
2037
+ const arrowY = (_b = middlewareData.arrow) == null ? void 0 : _b.y;
2038
+ const cannotCenterArrow = ((_c = middlewareData.arrow) == null ? void 0 : _c.centerOffset) !== 0;
2039
+ const [contentZIndex, setContentZIndex] = React.useState();
2040
+ useLayoutEffect2(() => {
2041
+ if (content)
2042
+ setContentZIndex(window.getComputedStyle(content).zIndex);
2043
+ }, [content]);
2044
+ return /* @__PURE__ */ jsx(
2045
+ "div",
2046
+ {
2047
+ ref: refs.setFloating,
2048
+ "data-radix-popper-content-wrapper": "",
2049
+ style: {
2050
+ ...floatingStyles,
2051
+ transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
2052
+ // keep off the page when measuring
2053
+ minWidth: "max-content",
2054
+ zIndex: contentZIndex,
2055
+ ["--radix-popper-transform-origin"]: [
2056
+ (_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
2057
+ (_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
2058
+ ].join(" "),
2059
+ // hide the content if using the hide middleware and should be hidden
2060
+ // set visibility to hidden and disable pointer events so the UI behaves
2061
+ // as if the PopperContent isn't there at all
2062
+ ...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
2063
+ visibility: "hidden",
2064
+ pointerEvents: "none"
2065
+ }
2066
+ },
2067
+ dir: props.dir,
2068
+ children: /* @__PURE__ */ jsx(
2069
+ PopperContentProvider,
2070
+ {
2071
+ scope: __scopePopper,
2072
+ placedSide,
2073
+ onArrowChange: setArrow,
2074
+ arrowX,
2075
+ arrowY,
2076
+ shouldHideArrow: cannotCenterArrow,
2077
+ children: /* @__PURE__ */ jsx(
2078
+ Primitive.div,
2079
+ {
2080
+ "data-side": placedSide,
2081
+ "data-align": placedAlign,
2082
+ ...contentProps,
2083
+ ref: composedRefs,
2084
+ style: {
2085
+ ...contentProps.style,
2086
+ // if the PopperContent hasn't been placed yet (not all measurements done)
2087
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
2088
+ animation: !isPositioned ? "none" : void 0
2089
+ }
2090
+ }
2091
+ )
2092
+ }
2093
+ )
2094
+ }
2095
+ );
2096
+ }
2097
+ );
2098
+ PopperContent.displayName = CONTENT_NAME;
2099
+ var ARROW_NAME = "PopperArrow";
2100
+ var OPPOSITE_SIDE = {
2101
+ top: "bottom",
2102
+ right: "left",
2103
+ bottom: "top",
2104
+ left: "right"
2105
+ };
2106
+ var PopperArrow = React.forwardRef(function PopperArrow2(props, forwardedRef) {
2107
+ const { __scopePopper, ...arrowProps } = props;
2108
+ const contentContext = useContentContext(ARROW_NAME, __scopePopper);
2109
+ const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
2110
+ return (
2111
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
2112
+ // doesn't report size as we'd expect on SVG elements.
2113
+ // it reports their bounding box which is effectively the largest path inside the SVG.
2114
+ /* @__PURE__ */ jsx(
2115
+ "span",
2116
+ {
2117
+ ref: contentContext.onArrowChange,
2118
+ style: {
2119
+ position: "absolute",
2120
+ left: contentContext.arrowX,
2121
+ top: contentContext.arrowY,
2122
+ [baseSide]: 0,
2123
+ transformOrigin: {
2124
+ top: "",
2125
+ right: "0 0",
2126
+ bottom: "center 0",
2127
+ left: "100% 0"
2128
+ }[contentContext.placedSide],
2129
+ transform: {
2130
+ top: "translateY(100%)",
2131
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
2132
+ bottom: `rotate(180deg)`,
2133
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
2134
+ }[contentContext.placedSide],
2135
+ visibility: contentContext.shouldHideArrow ? "hidden" : void 0
2136
+ },
2137
+ children: /* @__PURE__ */ jsx(
2138
+ Root,
2139
+ {
2140
+ ...arrowProps,
2141
+ ref: forwardedRef,
2142
+ style: {
2143
+ ...arrowProps.style,
2144
+ // ensures the element can be measured correctly (mostly for if SVG)
2145
+ display: "block"
2146
+ }
2147
+ }
2148
+ )
2149
+ }
2150
+ )
2151
+ );
2152
+ });
2153
+ PopperArrow.displayName = ARROW_NAME;
2154
+ function isNotNull(value) {
2155
+ return value !== null;
2156
+ }
2157
+ var transformOrigin = (options) => ({
2158
+ name: "transformOrigin",
2159
+ options,
2160
+ fn(data) {
2161
+ var _a, _b, _c;
2162
+ const { placement, rects, middlewareData } = data;
2163
+ const cannotCenterArrow = ((_a = middlewareData.arrow) == null ? void 0 : _a.centerOffset) !== 0;
2164
+ const isArrowHidden = cannotCenterArrow;
2165
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
2166
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
2167
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
2168
+ const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
2169
+ const arrowXCenter = (((_b = middlewareData.arrow) == null ? void 0 : _b.x) ?? 0) + arrowWidth / 2;
2170
+ const arrowYCenter = (((_c = middlewareData.arrow) == null ? void 0 : _c.y) ?? 0) + arrowHeight / 2;
2171
+ let x = "";
2172
+ let y = "";
2173
+ if (placedSide === "bottom") {
2174
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2175
+ y = `${-arrowHeight}px`;
2176
+ } else if (placedSide === "top") {
2177
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2178
+ y = `${rects.floating.height + arrowHeight}px`;
2179
+ } else if (placedSide === "right") {
2180
+ x = `${-arrowHeight}px`;
2181
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2182
+ } else if (placedSide === "left") {
2183
+ x = `${rects.floating.width + arrowHeight}px`;
2184
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2185
+ }
2186
+ return { data: { x, y } };
2187
+ }
2188
+ });
2189
+ function getSideAndAlignFromPlacement(placement) {
2190
+ const [side, align = "center"] = placement.split("-");
2191
+ return [side, align];
2192
+ }
2193
+ var Root2 = Popper;
2194
+ var Anchor = PopperAnchor;
2195
+ var Content = PopperContent;
2196
+ var Arrow = PopperArrow;
2197
+ export {
2198
+ Anchor as A,
2199
+ Content as C,
2200
+ Root2 as R,
2201
+ Arrow as a,
2202
+ createPopperScope as c
2203
+ };
2204
+ //# sourceMappingURL=index-CFdw_5ue.js.map