@zag-js/popper 0.0.0-dev-20220413175519 → 0.0.0-dev-20220415160434

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -18,19 +16,6 @@ var __spreadValues = (a, b) => {
18
16
  }
19
17
  return a;
20
18
  };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- var __objRest = (source, exclude) => {
23
- var target = {};
24
- for (var prop in source)
25
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
- target[prop] = source[prop];
27
- if (source != null && __getOwnPropSymbols)
28
- for (var prop of __getOwnPropSymbols(source)) {
29
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
- target[prop] = source[prop];
31
- }
32
- return target;
33
- };
34
19
  var __export = (target, all) => {
35
20
  for (var name in all)
36
21
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -44,26 +29,6 @@ var __copyProps = (to, from, except, desc) => {
44
29
  return to;
45
30
  };
46
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
47
- var __async = (__this, __arguments, generator) => {
48
- return new Promise((resolve, reject) => {
49
- var fulfilled = (value) => {
50
- try {
51
- step(generator.next(value));
52
- } catch (e) {
53
- reject(e);
54
- }
55
- };
56
- var rejected = (value) => {
57
- try {
58
- step(generator.throw(value));
59
- } catch (e) {
60
- reject(e);
61
- }
62
- };
63
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
64
- step((generator = generator.apply(__this, __arguments)).next());
65
- });
66
- };
67
32
 
68
33
  // src/index.ts
69
34
  var src_exports = {};
@@ -73,1047 +38,52 @@ __export(src_exports, {
73
38
  });
74
39
  module.exports = __toCommonJS(src_exports);
75
40
 
76
- // ../../../node_modules/@floating-ui/core/dist/floating-ui.core.esm.js
77
- function getSide(placement) {
78
- return placement.split("-")[0];
79
- }
80
- function getAlignment(placement) {
81
- return placement.split("-")[1];
82
- }
83
- function getMainAxisFromPlacement(placement) {
84
- return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
85
- }
86
- function getLengthFromAxis(axis) {
87
- return axis === "y" ? "height" : "width";
88
- }
89
- function computeCoordsFromPlacement(_ref, placement, rtl) {
90
- let {
91
- reference,
92
- floating
93
- } = _ref;
94
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
95
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
96
- const mainAxis = getMainAxisFromPlacement(placement);
97
- const length = getLengthFromAxis(mainAxis);
98
- const commonAlign = reference[length] / 2 - floating[length] / 2;
99
- const side = getSide(placement);
100
- const isVertical = mainAxis === "x";
101
- let coords;
102
- switch (side) {
103
- case "top":
104
- coords = {
105
- x: commonX,
106
- y: reference.y - floating.height
107
- };
108
- break;
109
- case "bottom":
110
- coords = {
111
- x: commonX,
112
- y: reference.y + reference.height
113
- };
114
- break;
115
- case "right":
116
- coords = {
117
- x: reference.x + reference.width,
118
- y: commonY
119
- };
120
- break;
121
- case "left":
122
- coords = {
123
- x: reference.x - floating.width,
124
- y: commonY
125
- };
126
- break;
127
- default:
128
- coords = {
129
- x: reference.x,
130
- y: reference.y
131
- };
132
- }
133
- switch (getAlignment(placement)) {
134
- case "start":
135
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
136
- break;
137
- case "end":
138
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
139
- break;
140
- }
141
- return coords;
142
- }
143
- var computePosition = (reference, floating, config) => __async(void 0, null, function* () {
144
- const {
145
- placement = "bottom",
146
- strategy = "absolute",
147
- middleware = [],
148
- platform: platform2
149
- } = config;
150
- const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(floating);
151
- if (void 0 !== "production") {
152
- if (platform2 == null) {
153
- console.error(["Floating UI: `platform` property was not passed to config. If you", "want to use Floating UI on the web, install @floating-ui/dom", "instead of the /core package. Otherwise, you can create your own", "`platform`: https://floating-ui.com/docs/platform"].join(" "));
154
- }
155
- if (middleware.filter((_ref) => {
156
- let {
157
- name
158
- } = _ref;
159
- return name === "autoPlacement" || name === "flip";
160
- }).length > 1) {
161
- throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement`", "middleware detected. This will lead to an infinite loop. Ensure only", "one of either has been passed to the `middleware` array."].join(" "));
162
- }
163
- }
164
- let rects = yield platform2.getElementRects({
165
- reference,
166
- floating,
167
- strategy
168
- });
169
- let {
170
- x,
171
- y
172
- } = computeCoordsFromPlacement(rects, placement, rtl);
173
- let statefulPlacement = placement;
174
- let middlewareData = {};
175
- let _debug_loop_count_ = 0;
176
- for (let i = 0; i < middleware.length; i++) {
177
- if (void 0 !== "production") {
178
- _debug_loop_count_++;
179
- if (_debug_loop_count_ > 100) {
180
- throw new Error(["Floating UI: The middleware lifecycle appears to be", "running in an infinite loop. This is usually caused by a `reset`", "continually being returned without a break condition."].join(" "));
181
- }
182
- }
183
- const {
184
- name,
185
- fn
186
- } = middleware[i];
187
- const {
188
- x: nextX,
189
- y: nextY,
190
- data,
191
- reset
192
- } = yield fn({
193
- x,
194
- y,
195
- initialPlacement: placement,
196
- placement: statefulPlacement,
197
- strategy,
198
- middlewareData,
199
- rects,
200
- platform: platform2,
201
- elements: {
202
- reference,
203
- floating
204
- }
205
- });
206
- x = nextX != null ? nextX : x;
207
- y = nextY != null ? nextY : y;
208
- middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
209
- [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
210
- });
211
- if (reset) {
212
- if (typeof reset === "object") {
213
- if (reset.placement) {
214
- statefulPlacement = reset.placement;
215
- }
216
- if (reset.rects) {
217
- rects = reset.rects === true ? yield platform2.getElementRects({
218
- reference,
219
- floating,
220
- strategy
221
- }) : reset.rects;
222
- }
223
- ({
224
- x,
225
- y
226
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
227
- }
228
- i = -1;
229
- continue;
230
- }
231
- }
232
- return {
233
- x,
234
- y,
235
- placement: statefulPlacement,
236
- strategy,
237
- middlewareData
238
- };
239
- });
240
- function expandPaddingObject(padding) {
241
- return __spreadValues({
242
- top: 0,
243
- right: 0,
244
- bottom: 0,
245
- left: 0
246
- }, padding);
247
- }
248
- function getSideObjectFromPadding(padding) {
249
- return typeof padding !== "number" ? expandPaddingObject(padding) : {
250
- top: padding,
251
- right: padding,
252
- bottom: padding,
253
- left: padding
254
- };
255
- }
256
- function rectToClientRect(rect) {
257
- return __spreadProps(__spreadValues({}, rect), {
258
- top: rect.y,
259
- left: rect.x,
260
- right: rect.x + rect.width,
261
- bottom: rect.y + rect.height
262
- });
263
- }
264
- function detectOverflow(middlewareArguments, options) {
265
- return __async(this, null, function* () {
266
- var _await$platform$isEle;
267
- if (options === void 0) {
268
- options = {};
269
- }
270
- const {
271
- x,
272
- y,
273
- platform: platform2,
274
- rects,
275
- elements,
276
- strategy
277
- } = middlewareArguments;
278
- const {
279
- boundary = "clippingAncestors",
280
- rootBoundary = "viewport",
281
- elementContext = "floating",
282
- altBoundary = false,
283
- padding = 0
284
- } = options;
285
- const paddingObject = getSideObjectFromPadding(padding);
286
- const altContext = elementContext === "floating" ? "reference" : "floating";
287
- const element = elements[altBoundary ? altContext : elementContext];
288
- const clippingClientRect = rectToClientRect(yield platform2.getClippingRect({
289
- element: ((_await$platform$isEle = yield platform2.isElement == null ? void 0 : platform2.isElement(element)) != null ? _await$platform$isEle : true) ? element : element.contextElement || (yield platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
290
- boundary,
291
- rootBoundary,
292
- strategy
293
- }));
294
- const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? yield platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
295
- rect: elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
296
- x,
297
- y
298
- }) : rects.reference,
299
- offsetParent: yield platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating),
300
- strategy
301
- }) : rects[elementContext]);
302
- return {
303
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
304
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
305
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
306
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
307
- };
308
- });
309
- }
310
- var min = Math.min;
311
- var max = Math.max;
312
- function within(min$1, value, max$1) {
313
- return max(min$1, min(value, max$1));
314
- }
315
- var arrow = (options) => ({
316
- name: "arrow",
317
- options,
318
- fn(middlewareArguments) {
319
- return __async(this, null, function* () {
320
- const {
321
- element,
322
- padding = 0
323
- } = options != null ? options : {};
324
- const {
325
- x,
326
- y,
327
- placement,
328
- rects,
329
- platform: platform2
330
- } = middlewareArguments;
331
- if (element == null) {
332
- if (void 0 !== "production") {
333
- console.warn("Floating UI: No `element` was passed to the `arrow` middleware.");
334
- }
335
- return {};
336
- }
337
- const paddingObject = getSideObjectFromPadding(padding);
338
- const coords = {
339
- x,
340
- y
341
- };
342
- const axis = getMainAxisFromPlacement(placement);
343
- const length = getLengthFromAxis(axis);
344
- const arrowDimensions = yield platform2.getDimensions(element);
345
- const minProp = axis === "y" ? "top" : "left";
346
- const maxProp = axis === "y" ? "bottom" : "right";
347
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
348
- const startDiff = coords[axis] - rects.reference[axis];
349
- const arrowOffsetParent = yield platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element);
350
- const clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
351
- const centerToReference = endDiff / 2 - startDiff / 2;
352
- const min3 = paddingObject[minProp];
353
- const max3 = clientSize - arrowDimensions[length] - paddingObject[maxProp];
354
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
355
- const offset2 = within(min3, center, max3);
356
- return {
357
- data: {
358
- [axis]: offset2,
359
- centerOffset: center - offset2
360
- }
361
- };
362
- });
363
- }
364
- });
365
- var hash$1 = {
366
- left: "right",
367
- right: "left",
368
- bottom: "top",
369
- top: "bottom"
370
- };
371
- function getOppositePlacement(placement) {
372
- return placement.replace(/left|right|bottom|top/g, (matched) => hash$1[matched]);
373
- }
374
- function getAlignmentSides(placement, rects, rtl) {
375
- if (rtl === void 0) {
376
- rtl = false;
377
- }
378
- const alignment = getAlignment(placement);
379
- const mainAxis = getMainAxisFromPlacement(placement);
380
- const length = getLengthFromAxis(mainAxis);
381
- let mainAlignmentSide = mainAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
382
- if (rects.reference[length] > rects.floating[length]) {
383
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
384
- }
385
- return {
386
- main: mainAlignmentSide,
387
- cross: getOppositePlacement(mainAlignmentSide)
388
- };
389
- }
390
- var hash = {
391
- start: "end",
392
- end: "start"
393
- };
394
- function getOppositeAlignmentPlacement(placement) {
395
- return placement.replace(/start|end/g, (matched) => hash[matched]);
396
- }
397
- function getExpandedPlacements(placement) {
398
- const oppositePlacement = getOppositePlacement(placement);
399
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
400
- }
401
- var flip = function(options) {
402
- if (options === void 0) {
403
- options = {};
404
- }
405
- return {
406
- name: "flip",
407
- options,
408
- fn(middlewareArguments) {
409
- return __async(this, null, function* () {
410
- var _middlewareData$flip;
411
- const {
412
- placement,
413
- middlewareData,
414
- rects,
415
- initialPlacement,
416
- platform: platform2,
417
- elements
418
- } = middlewareArguments;
419
- const _a2 = options, {
420
- mainAxis: checkMainAxis = true,
421
- crossAxis: checkCrossAxis = true,
422
- fallbackPlacements: specifiedFallbackPlacements,
423
- fallbackStrategy = "bestFit",
424
- flipAlignment = true
425
- } = _a2, detectOverflowOptions = __objRest(_a2, [
426
- "mainAxis",
427
- "crossAxis",
428
- "fallbackPlacements",
429
- "fallbackStrategy",
430
- "flipAlignment"
431
- ]);
432
- const side = getSide(placement);
433
- const isBasePlacement = side === initialPlacement;
434
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
435
- const placements = [initialPlacement, ...fallbackPlacements];
436
- const overflow = yield detectOverflow(middlewareArguments, detectOverflowOptions);
437
- const overflows = [];
438
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
439
- if (checkMainAxis) {
440
- overflows.push(overflow[side]);
441
- }
442
- if (checkCrossAxis) {
443
- const {
444
- main,
445
- cross
446
- } = getAlignmentSides(placement, rects, yield platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
447
- overflows.push(overflow[main], overflow[cross]);
448
- }
449
- overflowsData = [...overflowsData, {
450
- placement,
451
- overflows
452
- }];
453
- if (!overflows.every((side2) => side2 <= 0)) {
454
- var _middlewareData$flip$, _middlewareData$flip2;
455
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
456
- const nextPlacement = placements[nextIndex];
457
- if (nextPlacement) {
458
- return {
459
- data: {
460
- index: nextIndex,
461
- overflows: overflowsData
462
- },
463
- reset: {
464
- placement: nextPlacement
465
- }
466
- };
467
- }
468
- let resetPlacement = "bottom";
469
- switch (fallbackStrategy) {
470
- case "bestFit": {
471
- var _overflowsData$slice$;
472
- const placement2 = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0) - b.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;
473
- if (placement2) {
474
- resetPlacement = placement2;
475
- }
476
- break;
477
- }
478
- case "initialPlacement":
479
- resetPlacement = initialPlacement;
480
- break;
481
- }
482
- if (placement !== resetPlacement) {
483
- return {
484
- reset: {
485
- placement: resetPlacement
486
- }
487
- };
488
- }
489
- }
490
- return {};
491
- });
492
- }
493
- };
494
- };
495
- function convertValueToCoords(placement, rects, value, rtl) {
496
- if (rtl === void 0) {
497
- rtl = false;
498
- }
499
- const side = getSide(placement);
500
- const alignment = getAlignment(placement);
501
- const isVertical = getMainAxisFromPlacement(placement) === "x";
502
- const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
503
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
504
- const rawValue = typeof value === "function" ? value(__spreadProps(__spreadValues({}, rects), {
505
- placement
506
- })) : value;
507
- const isNumber = typeof rawValue === "number";
508
- let {
509
- mainAxis,
510
- crossAxis,
511
- alignmentAxis
512
- } = isNumber ? {
513
- mainAxis: rawValue,
514
- crossAxis: 0,
515
- alignmentAxis: null
516
- } : __spreadValues({
517
- mainAxis: 0,
518
- crossAxis: 0,
519
- alignmentAxis: null
520
- }, rawValue);
521
- if (alignment && typeof alignmentAxis === "number") {
522
- crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
523
- }
524
- return isVertical ? {
525
- x: crossAxis * crossAxisMulti,
526
- y: mainAxis * mainAxisMulti
527
- } : {
528
- x: mainAxis * mainAxisMulti,
529
- y: crossAxis * crossAxisMulti
530
- };
531
- }
532
- var offset = function(value) {
533
- if (value === void 0) {
534
- value = 0;
535
- }
536
- return {
537
- name: "offset",
538
- options: value,
539
- fn(middlewareArguments) {
540
- return __async(this, null, function* () {
541
- const {
542
- x,
543
- y,
544
- placement,
545
- rects,
546
- platform: platform2,
547
- elements
548
- } = middlewareArguments;
549
- const diffCoords = convertValueToCoords(placement, rects, value, yield platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
550
- return {
551
- x: x + diffCoords.x,
552
- y: y + diffCoords.y,
553
- data: diffCoords
554
- };
555
- });
556
- }
557
- };
558
- };
559
- function getCrossAxis(axis) {
560
- return axis === "x" ? "y" : "x";
561
- }
562
- var shift = function(options) {
563
- if (options === void 0) {
564
- options = {};
565
- }
566
- return {
567
- name: "shift",
568
- options,
569
- fn(middlewareArguments) {
570
- return __async(this, null, function* () {
571
- const {
572
- x,
573
- y,
574
- placement
575
- } = middlewareArguments;
576
- const _a2 = options, {
577
- mainAxis: checkMainAxis = true,
578
- crossAxis: checkCrossAxis = false,
579
- limiter = {
580
- fn: (_ref) => {
581
- let {
582
- x: x2,
583
- y: y2
584
- } = _ref;
585
- return {
586
- x: x2,
587
- y: y2
588
- };
589
- }
590
- }
591
- } = _a2, detectOverflowOptions = __objRest(_a2, [
592
- "mainAxis",
593
- "crossAxis",
594
- "limiter"
595
- ]);
596
- const coords = {
597
- x,
598
- y
599
- };
600
- const overflow = yield detectOverflow(middlewareArguments, detectOverflowOptions);
601
- const mainAxis = getMainAxisFromPlacement(getSide(placement));
602
- const crossAxis = getCrossAxis(mainAxis);
603
- let mainAxisCoord = coords[mainAxis];
604
- let crossAxisCoord = coords[crossAxis];
605
- if (checkMainAxis) {
606
- const minSide = mainAxis === "y" ? "top" : "left";
607
- const maxSide = mainAxis === "y" ? "bottom" : "right";
608
- const min3 = mainAxisCoord + overflow[minSide];
609
- const max3 = mainAxisCoord - overflow[maxSide];
610
- mainAxisCoord = within(min3, mainAxisCoord, max3);
611
- }
612
- if (checkCrossAxis) {
613
- const minSide = crossAxis === "y" ? "top" : "left";
614
- const maxSide = crossAxis === "y" ? "bottom" : "right";
615
- const min3 = crossAxisCoord + overflow[minSide];
616
- const max3 = crossAxisCoord - overflow[maxSide];
617
- crossAxisCoord = within(min3, crossAxisCoord, max3);
618
- }
619
- const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, middlewareArguments), {
620
- [mainAxis]: mainAxisCoord,
621
- [crossAxis]: crossAxisCoord
622
- }));
623
- return __spreadProps(__spreadValues({}, limitedCoords), {
624
- data: {
625
- x: limitedCoords.x - x,
626
- y: limitedCoords.y - y
627
- }
628
- });
629
- });
630
- }
631
- };
632
- };
633
- var size = function(options) {
634
- if (options === void 0) {
635
- options = {};
636
- }
637
- return {
638
- name: "size",
639
- options,
640
- fn(middlewareArguments) {
641
- return __async(this, null, function* () {
642
- const {
643
- placement,
644
- rects,
645
- platform: platform2,
646
- elements
647
- } = middlewareArguments;
648
- const _a2 = options, {
649
- apply
650
- } = _a2, detectOverflowOptions = __objRest(_a2, [
651
- "apply"
652
- ]);
653
- const overflow = yield detectOverflow(middlewareArguments, detectOverflowOptions);
654
- const side = getSide(placement);
655
- const alignment = getAlignment(placement);
656
- let heightSide;
657
- let widthSide;
658
- if (side === "top" || side === "bottom") {
659
- heightSide = side;
660
- widthSide = alignment === ((yield platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
661
- } else {
662
- widthSide = side;
663
- heightSide = alignment === "end" ? "top" : "bottom";
664
- }
665
- const xMin = max(overflow.left, 0);
666
- const xMax = max(overflow.right, 0);
667
- const yMin = max(overflow.top, 0);
668
- const yMax = max(overflow.bottom, 0);
669
- const dimensions = {
670
- height: rects.floating.height - (["left", "right"].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)) : overflow[heightSide]),
671
- width: rects.floating.width - (["top", "bottom"].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)) : overflow[widthSide])
672
- };
673
- const prevDimensions = yield platform2.getDimensions(elements.floating);
674
- apply == null ? void 0 : apply(__spreadValues(__spreadValues({}, dimensions), rects));
675
- const nextDimensions = yield platform2.getDimensions(elements.floating);
676
- if (prevDimensions.width !== nextDimensions.width || prevDimensions.height !== nextDimensions.height) {
677
- return {
678
- reset: {
679
- rects: true
680
- }
681
- };
682
- }
683
- return {};
684
- });
685
- }
686
- };
687
- };
688
-
689
- // ../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js
690
- function isWindow(value) {
691
- return value && value.document && value.location && value.alert && value.setInterval;
692
- }
693
- function getWindow(node) {
694
- if (node == null) {
695
- return window;
696
- }
697
- if (!isWindow(node)) {
698
- const ownerDocument = node.ownerDocument;
699
- return ownerDocument ? ownerDocument.defaultView || window : window;
700
- }
701
- return node;
702
- }
703
- function getComputedStyle$1(element) {
704
- return getWindow(element).getComputedStyle(element);
705
- }
706
- function getNodeName(node) {
707
- return isWindow(node) ? "" : node ? (node.nodeName || "").toLowerCase() : "";
708
- }
709
- function isHTMLElement(value) {
710
- return value instanceof getWindow(value).HTMLElement;
711
- }
712
- function isElement(value) {
713
- return value instanceof getWindow(value).Element;
714
- }
715
- function isNode(value) {
716
- return value instanceof getWindow(value).Node;
717
- }
718
- function isShadowRoot(node) {
719
- const OwnElement = getWindow(node).ShadowRoot;
720
- return node instanceof OwnElement || node instanceof ShadowRoot;
721
- }
722
- function isOverflowElement(element) {
723
- const {
724
- overflow,
725
- overflowX,
726
- overflowY
727
- } = getComputedStyle$1(element);
728
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
729
- }
730
- function isTableElement(element) {
731
- return ["table", "td", "th"].includes(getNodeName(element));
732
- }
733
- function isContainingBlock(element) {
734
- const isFirefox = navigator.userAgent.toLowerCase().includes("firefox");
735
- const css = getComputedStyle$1(element);
736
- return css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].includes(css.willChange) || isFirefox && css.willChange === "filter" || isFirefox && (css.filter ? css.filter !== "none" : false);
737
- }
738
- function isLayoutViewport() {
739
- return !/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
740
- }
741
- var min2 = Math.min;
742
- var max2 = Math.max;
743
- var round = Math.round;
744
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
745
- if (includeScale === void 0) {
746
- includeScale = false;
747
- }
748
- if (isFixedStrategy === void 0) {
749
- isFixedStrategy = false;
750
- }
751
- const clientRect = element.getBoundingClientRect();
752
- let scaleX = 1;
753
- let scaleY = 1;
754
- if (includeScale && isHTMLElement(element)) {
755
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
756
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
757
- }
758
- const win = isElement(element) ? getWindow(element) : window;
759
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
760
- const x = (clientRect.left + (addVisualOffsets ? win.visualViewport.offsetLeft : 0)) / scaleX;
761
- const y = (clientRect.top + (addVisualOffsets ? win.visualViewport.offsetTop : 0)) / scaleY;
762
- const width = clientRect.width / scaleX;
763
- const height = clientRect.height / scaleY;
764
- return {
765
- width,
766
- height,
767
- top: y,
768
- right: x + width,
769
- bottom: y + height,
770
- left: x,
771
- x,
772
- y
773
- };
774
- }
775
- function getDocumentElement(node) {
776
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
777
- }
778
- function getNodeScroll(element) {
779
- if (isElement(element)) {
780
- return {
781
- scrollLeft: element.scrollLeft,
782
- scrollTop: element.scrollTop
783
- };
784
- }
785
- return {
786
- scrollLeft: element.pageXOffset,
787
- scrollTop: element.pageYOffset
788
- };
789
- }
790
- function getWindowScrollBarX(element) {
791
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
792
- }
793
- function isScaled(element) {
794
- const rect = getBoundingClientRect(element);
795
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
796
- }
797
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
798
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
799
- const documentElement = getDocumentElement(offsetParent);
800
- const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent), strategy === "fixed");
801
- let scroll = {
802
- scrollLeft: 0,
803
- scrollTop: 0
804
- };
805
- const offsets = {
806
- x: 0,
807
- y: 0
808
- };
809
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
810
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
811
- scroll = getNodeScroll(offsetParent);
812
- }
813
- if (isHTMLElement(offsetParent)) {
814
- const offsetRect = getBoundingClientRect(offsetParent, true);
815
- offsets.x = offsetRect.x + offsetParent.clientLeft;
816
- offsets.y = offsetRect.y + offsetParent.clientTop;
817
- } else if (documentElement) {
818
- offsets.x = getWindowScrollBarX(documentElement);
819
- }
820
- }
821
- return {
822
- x: rect.left + scroll.scrollLeft - offsets.x,
823
- y: rect.top + scroll.scrollTop - offsets.y,
824
- width: rect.width,
825
- height: rect.height
826
- };
827
- }
828
- function getParentNode(node) {
829
- if (getNodeName(node) === "html") {
830
- return node;
831
- }
832
- return node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
833
- }
834
- function getTrueOffsetParent(element) {
835
- if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
836
- return null;
837
- }
838
- return element.offsetParent;
839
- }
840
- function getContainingBlock(element) {
841
- let currentNode = getParentNode(element);
842
- if (isShadowRoot(currentNode)) {
843
- currentNode = currentNode.host;
844
- }
845
- while (isHTMLElement(currentNode) && !["html", "body"].includes(getNodeName(currentNode))) {
846
- if (isContainingBlock(currentNode)) {
847
- return currentNode;
848
- } else {
849
- currentNode = currentNode.parentNode;
850
- }
851
- }
852
- return null;
853
- }
854
- function getOffsetParent(element) {
855
- const window2 = getWindow(element);
856
- let offsetParent = getTrueOffsetParent(element);
857
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
858
- offsetParent = getTrueOffsetParent(offsetParent);
859
- }
860
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
861
- return window2;
862
- }
863
- return offsetParent || getContainingBlock(element) || window2;
864
- }
865
- function getDimensions(element) {
866
- if (isHTMLElement(element)) {
867
- return {
868
- width: element.offsetWidth,
869
- height: element.offsetHeight
870
- };
871
- }
872
- const rect = getBoundingClientRect(element);
873
- return {
874
- width: rect.width,
875
- height: rect.height
876
- };
877
- }
878
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
879
- let {
880
- rect,
881
- offsetParent,
882
- strategy
883
- } = _ref;
884
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
885
- const documentElement = getDocumentElement(offsetParent);
886
- if (offsetParent === documentElement) {
887
- return rect;
888
- }
889
- let scroll = {
890
- scrollLeft: 0,
891
- scrollTop: 0
892
- };
893
- const offsets = {
894
- x: 0,
895
- y: 0
896
- };
897
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
898
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
899
- scroll = getNodeScroll(offsetParent);
900
- }
901
- if (isHTMLElement(offsetParent)) {
902
- const offsetRect = getBoundingClientRect(offsetParent, true);
903
- offsets.x = offsetRect.x + offsetParent.clientLeft;
904
- offsets.y = offsetRect.y + offsetParent.clientTop;
905
- }
906
- }
907
- return __spreadProps(__spreadValues({}, rect), {
908
- x: rect.x - scroll.scrollLeft + offsets.x,
909
- y: rect.y - scroll.scrollTop + offsets.y
910
- });
911
- }
912
- function getViewportRect(element, strategy) {
913
- const win = getWindow(element);
914
- const html = getDocumentElement(element);
915
- const visualViewport = win.visualViewport;
916
- let width = html.clientWidth;
917
- let height = html.clientHeight;
918
- let x = 0;
919
- let y = 0;
920
- if (visualViewport) {
921
- width = visualViewport.width;
922
- height = visualViewport.height;
923
- const layoutViewport = isLayoutViewport();
924
- if (layoutViewport || !layoutViewport && strategy === "fixed") {
925
- x = visualViewport.offsetLeft;
926
- y = visualViewport.offsetTop;
927
- }
928
- }
929
- return {
930
- width,
931
- height,
932
- x,
933
- y
934
- };
935
- }
936
- function getDocumentRect(element) {
937
- var _element$ownerDocumen;
938
- const html = getDocumentElement(element);
939
- const scroll = getNodeScroll(element);
940
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
941
- const width = max2(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
942
- const height = max2(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
943
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
944
- const y = -scroll.scrollTop;
945
- if (getComputedStyle$1(body || html).direction === "rtl") {
946
- x += max2(html.clientWidth, body ? body.clientWidth : 0) - width;
947
- }
948
- return {
949
- width,
950
- height,
951
- x,
952
- y
953
- };
954
- }
955
- function getNearestOverflowAncestor(node) {
956
- const parentNode = getParentNode(node);
957
- if (["html", "body", "#document"].includes(getNodeName(parentNode))) {
958
- return node.ownerDocument.body;
959
- }
960
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
961
- return parentNode;
962
- }
963
- return getNearestOverflowAncestor(parentNode);
964
- }
965
- function getOverflowAncestors(node, list) {
966
- var _node$ownerDocument;
967
- if (list === void 0) {
968
- list = [];
969
- }
970
- const scrollableAncestor = getNearestOverflowAncestor(node);
971
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
972
- const win = getWindow(scrollableAncestor);
973
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
974
- const updatedList = list.concat(target);
975
- return isBody ? updatedList : updatedList.concat(getOverflowAncestors(getParentNode(target)));
976
- }
977
- function contains(parent, child) {
978
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
979
- if (parent.contains(child)) {
980
- return true;
981
- } else if (rootNode && isShadowRoot(rootNode)) {
982
- let next = child;
983
- do {
984
- if (next && parent === next) {
985
- return true;
986
- }
987
- next = next.parentNode || next.host;
988
- } while (next);
989
- }
990
- return false;
991
- }
992
- function getInnerBoundingClientRect(element, strategy) {
993
- const clientRect = getBoundingClientRect(element, false, strategy === "fixed");
994
- const top = clientRect.top + element.clientTop;
995
- const left = clientRect.left + element.clientLeft;
996
- return {
997
- top,
998
- left,
999
- x: left,
1000
- y: top,
1001
- right: left + element.clientWidth,
1002
- bottom: top + element.clientHeight,
1003
- width: element.clientWidth,
1004
- height: element.clientHeight
1005
- };
1006
- }
1007
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
1008
- if (clippingParent === "viewport") {
1009
- return rectToClientRect(getViewportRect(element, strategy));
1010
- }
1011
- if (isElement(clippingParent)) {
1012
- return getInnerBoundingClientRect(clippingParent, strategy);
1013
- }
1014
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1015
- }
1016
- function getClippingAncestors(element) {
1017
- const clippingAncestors = getOverflowAncestors(element);
1018
- const canEscapeClipping = ["absolute", "fixed"].includes(getComputedStyle$1(element).position);
1019
- const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1020
- if (!isElement(clipperElement)) {
1021
- return [];
1022
- }
1023
- return clippingAncestors.filter((clippingAncestors2) => isElement(clippingAncestors2) && contains(clippingAncestors2, clipperElement) && getNodeName(clippingAncestors2) !== "body");
1024
- }
1025
- function getClippingRect(_ref) {
1026
- let {
1027
- element,
1028
- boundary,
1029
- rootBoundary,
1030
- strategy
1031
- } = _ref;
1032
- const mainClippingAncestors = boundary === "clippingAncestors" ? getClippingAncestors(element) : [].concat(boundary);
1033
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1034
- const firstClippingAncestor = clippingAncestors[0];
1035
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1036
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1037
- accRect.top = max2(rect.top, accRect.top);
1038
- accRect.right = min2(rect.right, accRect.right);
1039
- accRect.bottom = min2(rect.bottom, accRect.bottom);
1040
- accRect.left = max2(rect.left, accRect.left);
1041
- return accRect;
1042
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1043
- return {
1044
- width: clippingRect.right - clippingRect.left,
1045
- height: clippingRect.bottom - clippingRect.top,
1046
- x: clippingRect.left,
1047
- y: clippingRect.top
1048
- };
1049
- }
1050
- var platform = {
1051
- getClippingRect,
1052
- convertOffsetParentRelativeRectToViewportRelativeRect,
1053
- isElement,
1054
- getDimensions,
1055
- getOffsetParent,
1056
- getDocumentElement,
1057
- getElementRects: (_ref) => {
1058
- let {
1059
- reference,
1060
- floating,
1061
- strategy
1062
- } = _ref;
1063
- return {
1064
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1065
- floating: __spreadProps(__spreadValues({}, getDimensions(floating)), {
1066
- x: 0,
1067
- y: 0
1068
- })
1069
- };
1070
- },
1071
- getClientRects: (element) => Array.from(element.getClientRects()),
1072
- isRTL: (element) => getComputedStyle$1(element).direction === "rtl"
1073
- };
1074
- var computePosition2 = (reference, floating, options) => computePosition(reference, floating, __spreadValues({
1075
- platform
1076
- }, options));
41
+ // src/get-placement.ts
42
+ var import_dom2 = require("@floating-ui/dom");
1077
43
 
1078
- // ../core/src/functions.ts
44
+ // ../dom/dist/index.mjs
1079
45
  var noop = () => {
1080
46
  };
1081
- var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
1082
-
1083
- // ../core/src/guard.ts
1084
- var isBoolean = (v) => v === true || v === false;
1085
-
1086
- // ../dom/src/event-bus.ts
1087
- var listenerElements = /* @__PURE__ */ new Map();
1088
- var listenerCache = /* @__PURE__ */ new Map();
47
+ function getListenerElements() {
48
+ ;
49
+ globalThis.__listenerElements__ = globalThis.__listenerElements__ || /* @__PURE__ */ new Map();
50
+ return globalThis.__listenerElements__;
51
+ }
52
+ function getListenerCache() {
53
+ ;
54
+ globalThis.__listenerCache__ = globalThis.__listenerCache__ || /* @__PURE__ */ new Map();
55
+ return globalThis.__listenerCache__;
56
+ }
1089
57
  function globalEventBus(node, type, handler, options) {
1090
58
  var _a;
1091
59
  if (!node)
1092
60
  return noop;
1093
- const hash2 = JSON.stringify({ type, options });
61
+ const hash = JSON.stringify({ type, options });
62
+ const listenerElements = getListenerElements();
63
+ const listenerCache = getListenerCache();
1094
64
  const group = listenerElements.get(node);
1095
65
  if (!listenerElements.has(node)) {
1096
- const group2 = /* @__PURE__ */ new Map([[hash2, /* @__PURE__ */ new Set([handler])]]);
66
+ const group2 = /* @__PURE__ */ new Map([[hash, /* @__PURE__ */ new Set([handler])]]);
1097
67
  listenerElements.set(node, group2);
1098
- } else if (group == null ? void 0 : group.has(hash2)) {
1099
- (_a = group == null ? void 0 : group.get(hash2)) == null ? void 0 : _a.add(handler);
68
+ } else if (group == null ? void 0 : group.has(hash)) {
69
+ (_a = group == null ? void 0 : group.get(hash)) == null ? void 0 : _a.add(handler);
1100
70
  } else {
1101
- group == null ? void 0 : group.set(hash2, /* @__PURE__ */ new Set([handler]));
71
+ group == null ? void 0 : group.set(hash, /* @__PURE__ */ new Set([handler]));
1102
72
  }
1103
73
  function attach(node2) {
1104
74
  var _a2, _b;
1105
75
  function listener(event) {
1106
76
  var _a3;
1107
77
  const group2 = listenerElements.get(node2);
1108
- (_a3 = group2 == null ? void 0 : group2.get(hash2)) == null ? void 0 : _a3.forEach((fn) => fn(event));
78
+ (_a3 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a3.forEach((fn) => fn(event));
1109
79
  }
1110
80
  if (!(listenerCache == null ? void 0 : listenerCache.has(node2))) {
1111
- listenerCache.set(node2, /* @__PURE__ */ new Map([[hash2, listener]]));
81
+ listenerCache.set(node2, /* @__PURE__ */ new Map([[hash, listener]]));
1112
82
  node2.addEventListener(type, listener, options);
1113
83
  return;
1114
84
  }
1115
- if (!((_a2 = listenerCache == null ? void 0 : listenerCache.get(node2)) == null ? void 0 : _a2.has(hash2))) {
1116
- (_b = listenerCache.get(node2)) == null ? void 0 : _b.set(hash2, listener);
85
+ if (!((_a2 = listenerCache == null ? void 0 : listenerCache.get(node2)) == null ? void 0 : _a2.has(hash))) {
86
+ (_b = listenerCache.get(node2)) == null ? void 0 : _b.set(hash, listener);
1117
87
  node2.addEventListener(type, listener, options);
1118
88
  }
1119
89
  }
@@ -1123,12 +93,12 @@ function globalEventBus(node, type, handler, options) {
1123
93
  if (!listenerElements.has(node))
1124
94
  return;
1125
95
  const group2 = listenerElements.get(node);
1126
- (_a2 = group2 == null ? void 0 : group2.get(hash2)) == null ? void 0 : _a2.delete(handler);
1127
- if (((_b = group2 == null ? void 0 : group2.get(hash2)) == null ? void 0 : _b.size) === 0) {
1128
- const listener = (_c = listenerCache.get(node)) == null ? void 0 : _c.get(hash2);
96
+ (_a2 = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _a2.delete(handler);
97
+ if (((_b = group2 == null ? void 0 : group2.get(hash)) == null ? void 0 : _b.size) === 0) {
98
+ const listener = (_c = listenerCache.get(node)) == null ? void 0 : _c.get(hash);
1129
99
  node.removeEventListener(type, listener, options);
1130
- group2 == null ? void 0 : group2.delete(hash2);
1131
- (_d = listenerCache.get(node)) == null ? void 0 : _d.delete(hash2);
100
+ group2 == null ? void 0 : group2.delete(hash);
101
+ (_d = listenerCache.get(node)) == null ? void 0 : _d.delete(hash);
1132
102
  if ((group2 == null ? void 0 : group2.size) === 0) {
1133
103
  listenerElements.delete(node);
1134
104
  listenerCache.delete(node);
@@ -1136,8 +106,6 @@ function globalEventBus(node, type, handler, options) {
1136
106
  }
1137
107
  };
1138
108
  }
1139
-
1140
- // ../dom/src/listener.ts
1141
109
  var t = (v) => Object.prototype.toString.call(v).slice(8, -1);
1142
110
  var isRef = (v) => t(v) === "Object" && "current" in v;
1143
111
  var runIfFn = (fn) => t(fn) === "Function" ? fn() : fn;
@@ -1145,24 +113,25 @@ function addDomEvent(target, event, listener, options) {
1145
113
  const node = isRef(target) ? target.current : runIfFn(target);
1146
114
  return globalEventBus(node, event, listener, options);
1147
115
  }
1148
-
1149
- // ../dom/src/query.ts
1150
116
  function getOwnerDocument(el) {
1151
117
  var _a;
1152
- if (isWindow2(el))
118
+ if (isWindow(el))
1153
119
  return el.document;
1154
120
  return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
1155
121
  }
1156
- function isHTMLElement2(v) {
122
+ function isHTMLElement(v) {
1157
123
  return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
1158
124
  }
1159
- function isWindow2(value) {
125
+ function isWindow(value) {
1160
126
  return (value == null ? void 0 : value.toString()) === "[object Window]";
1161
127
  }
1162
-
1163
- // ../dom/src/rect-observer.ts
1164
- var observedElements = /* @__PURE__ */ new Map();
128
+ function getObservedElements() {
129
+ ;
130
+ globalThis.__rectObserverMap__ = globalThis.__rectObserverMap__ || /* @__PURE__ */ new Map();
131
+ return globalThis.__rectObserverMap__;
132
+ }
1165
133
  function observeElementRect(el, fn) {
134
+ const observedElements = getObservedElements();
1166
135
  const data = observedElements.get(el);
1167
136
  if (!data) {
1168
137
  observedElements.set(el, { rect: {}, callbacks: [fn] });
@@ -1191,6 +160,7 @@ function observeElementRect(el, fn) {
1191
160
  }
1192
161
  var rafId;
1193
162
  function runLoop() {
163
+ const observedElements = getObservedElements();
1194
164
  const changedRectsData = [];
1195
165
  observedElements.forEach((data, element) => {
1196
166
  const newRect = element.getBoundingClientRect();
@@ -1208,7 +178,14 @@ function isEqual(rect1, rect2) {
1208
178
  return rect1.width === rect2.width && rect1.height === rect2.height && rect1.top === rect2.top && rect1.right === rect2.right && rect1.bottom === rect2.bottom && rect1.left === rect2.left;
1209
179
  }
1210
180
 
181
+ // ../core/dist/index.mjs
182
+ var noop2 = () => {
183
+ };
184
+ var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
185
+ var isBoolean = (v) => v === true || v === false;
186
+
1211
187
  // src/auto-update.ts
188
+ var import_dom = require("@floating-ui/dom");
1212
189
  function resolveOptions(option) {
1213
190
  if (isBoolean(option))
1214
191
  return { ancestorResize: option, ancestorScroll: option, referenceResize: option };
@@ -1218,12 +195,12 @@ function autoUpdate(reference, floating, update, options = false) {
1218
195
  const { ancestorScroll, ancestorResize, referenceResize } = resolveOptions(options);
1219
196
  const useAncestors = ancestorScroll || ancestorResize;
1220
197
  const ancestors = [];
1221
- if (useAncestors && isHTMLElement2(reference)) {
1222
- ancestors.push(...getOverflowAncestors(reference));
198
+ if (useAncestors && isHTMLElement(reference)) {
199
+ ancestors.push(...(0, import_dom.getOverflowAncestors)(reference));
1223
200
  }
1224
201
  function addResizeListeners() {
1225
202
  let cleanups = [observeElementRect(floating, update)];
1226
- if (referenceResize && isHTMLElement2(reference)) {
203
+ if (referenceResize && isHTMLElement(reference)) {
1227
204
  cleanups.push(observeElementRect(reference, update));
1228
205
  }
1229
206
  cleanups.push(pipe(...ancestors.map((el) => addDomEvent(el, "resize", update))));
@@ -1314,24 +291,24 @@ var defaultOptions = {
1314
291
  function getPlacement(reference, floating, options = {}) {
1315
292
  var _a;
1316
293
  if (reference == null || floating == null)
1317
- return noop;
294
+ return noop2;
1318
295
  options = Object.assign({}, defaultOptions, options);
1319
296
  const middleware = [transformOrigin];
1320
297
  if (options.flip) {
1321
- middleware.push(flip({ boundary: options.boundary, padding: 8 }));
298
+ middleware.push((0, import_dom2.flip)({ boundary: options.boundary, padding: 8 }));
1322
299
  }
1323
300
  if (options.gutter || options.offset) {
1324
301
  const data = options.gutter ? { mainAxis: options.gutter } : options.offset;
1325
- middleware.push(offset(data));
302
+ middleware.push((0, import_dom2.offset)(data));
1326
303
  }
1327
- middleware.push(shift({ boundary: options.boundary }));
304
+ middleware.push((0, import_dom2.shift)({ boundary: options.boundary }));
1328
305
  const doc = getOwnerDocument(floating);
1329
306
  const arrowEl = doc.querySelector("[data-part=arrow]");
1330
307
  if (arrowEl) {
1331
- middleware.push(arrow({ element: arrowEl, padding: 8 }), shiftArrow({ element: arrowEl }));
308
+ middleware.push((0, import_dom2.arrow)({ element: arrowEl, padding: 8 }), shiftArrow({ element: arrowEl }));
1332
309
  }
1333
310
  if (options.sameWidth) {
1334
- middleware.push(size({
311
+ middleware.push((0, import_dom2.size)({
1335
312
  apply(data) {
1336
313
  const { width } = data.reference;
1337
314
  Object.assign(floating.style, { width: `${width}px`, minWidth: "unset" });
@@ -1342,7 +319,7 @@ function getPlacement(reference, floating, options = {}) {
1342
319
  if (reference == null || floating == null)
1343
320
  return;
1344
321
  const { placement, strategy } = options;
1345
- computePosition2(reference, floating, { placement, middleware, strategy }).then((data) => {
322
+ (0, import_dom2.computePosition)(reference, floating, { placement, middleware, strategy }).then((data) => {
1346
323
  const { x, y, strategy: strategy2 } = data;
1347
324
  Object.assign(floating.style, { left: `${x}px`, top: `${y}px`, position: strategy2 });
1348
325
  return data;
@@ -1352,7 +329,7 @@ function getPlacement(reference, floating, options = {}) {
1352
329
  });
1353
330
  }
1354
331
  compute();
1355
- return pipe(autoUpdate(reference, floating, compute, options.listeners), (_a = options.onCleanup) != null ? _a : noop);
332
+ return pipe(autoUpdate(reference, floating, compute, options.listeners), (_a = options.onCleanup) != null ? _a : noop2);
1356
333
  }
1357
334
 
1358
335
  // src/get-styles.ts