@opentiny/vue-hooks 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,2269 @@
1
+ import { hooks } from '@opentiny/vue-common';
2
+
3
+ var _excluded = ["mainAxis", "crossAxis", "fallbackPlacements", "fallbackStrategy", "fallbackAxisSideDirection", "flipAlignment"], _excluded2 = ["strategy"], _excluded3 = ["mainAxis", "crossAxis", "limiter"];
4
+ function _objectWithoutPropertiesLoose(r, e) {
5
+ if (null == r)
6
+ return {};
7
+ var t = {};
8
+ for (var n in r)
9
+ if ({}.hasOwnProperty.call(r, n)) {
10
+ if (e.includes(n))
11
+ continue;
12
+ t[n] = r[n];
13
+ }
14
+ return t;
15
+ }
16
+ function _regeneratorRuntime() {
17
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
18
+ _regeneratorRuntime = function _regeneratorRuntime2() {
19
+ return e;
20
+ };
21
+ var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) {
22
+ t2[e2] = r2.value;
23
+ }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag";
24
+ function define(t2, e2, r2) {
25
+ return Object.defineProperty(t2, e2, { value: r2, enumerable: true, configurable: true, writable: true }), t2[e2];
26
+ }
27
+ try {
28
+ define({}, "");
29
+ } catch (t2) {
30
+ define = function define2(t3, e2, r2) {
31
+ return t3[e2] = r2;
32
+ };
33
+ }
34
+ function wrap(t2, e2, r2, n2) {
35
+ var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []);
36
+ return o(a2, "_invoke", { value: makeInvokeMethod(t2, r2, c2) }), a2;
37
+ }
38
+ function tryCatch(t2, e2, r2) {
39
+ try {
40
+ return { type: "normal", arg: t2.call(e2, r2) };
41
+ } catch (t3) {
42
+ return { type: "throw", arg: t3 };
43
+ }
44
+ }
45
+ e.wrap = wrap;
46
+ var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {};
47
+ function Generator() {
48
+ }
49
+ function GeneratorFunction() {
50
+ }
51
+ function GeneratorFunctionPrototype() {
52
+ }
53
+ var p = {};
54
+ define(p, a, function() {
55
+ return this;
56
+ });
57
+ var d = Object.getPrototypeOf, v = d && d(d(values([])));
58
+ v && v !== r && n.call(v, a) && (p = v);
59
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
60
+ function defineIteratorMethods(t2) {
61
+ ["next", "throw", "return"].forEach(function(e2) {
62
+ define(t2, e2, function(t3) {
63
+ return this._invoke(e2, t3);
64
+ });
65
+ });
66
+ }
67
+ function AsyncIterator(t2, e2) {
68
+ function invoke(r3, o2, i2, a2) {
69
+ var c2 = tryCatch(t2[r3], t2, o2);
70
+ if ("throw" !== c2.type) {
71
+ var u2 = c2.arg, h2 = u2.value;
72
+ return h2 && "object" == typeof h2 && n.call(h2, "__await") ? e2.resolve(h2.__await).then(function(t3) {
73
+ invoke("next", t3, i2, a2);
74
+ }, function(t3) {
75
+ invoke("throw", t3, i2, a2);
76
+ }) : e2.resolve(h2).then(function(t3) {
77
+ u2.value = t3, i2(u2);
78
+ }, function(t3) {
79
+ return invoke("throw", t3, i2, a2);
80
+ });
81
+ }
82
+ a2(c2.arg);
83
+ }
84
+ var r2;
85
+ o(this, "_invoke", { value: function value(t3, n2) {
86
+ function callInvokeWithMethodAndArg() {
87
+ return new e2(function(e3, r3) {
88
+ invoke(t3, n2, e3, r3);
89
+ });
90
+ }
91
+ return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
92
+ } });
93
+ }
94
+ function makeInvokeMethod(e2, r2, n2) {
95
+ var o2 = h;
96
+ return function(i2, a2) {
97
+ if (o2 === f)
98
+ throw Error("Generator is already running");
99
+ if (o2 === s) {
100
+ if ("throw" === i2)
101
+ throw a2;
102
+ return { value: t, done: true };
103
+ }
104
+ for (n2.method = i2, n2.arg = a2; ; ) {
105
+ var c2 = n2.delegate;
106
+ if (c2) {
107
+ var u2 = maybeInvokeDelegate(c2, n2);
108
+ if (u2) {
109
+ if (u2 === y)
110
+ continue;
111
+ return u2;
112
+ }
113
+ }
114
+ if ("next" === n2.method)
115
+ n2.sent = n2._sent = n2.arg;
116
+ else if ("throw" === n2.method) {
117
+ if (o2 === h)
118
+ throw o2 = s, n2.arg;
119
+ n2.dispatchException(n2.arg);
120
+ } else
121
+ "return" === n2.method && n2.abrupt("return", n2.arg);
122
+ o2 = f;
123
+ var p2 = tryCatch(e2, r2, n2);
124
+ if ("normal" === p2.type) {
125
+ if (o2 = n2.done ? s : l, p2.arg === y)
126
+ continue;
127
+ return { value: p2.arg, done: n2.done };
128
+ }
129
+ "throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg);
130
+ }
131
+ };
132
+ }
133
+ function maybeInvokeDelegate(e2, r2) {
134
+ var n2 = r2.method, o2 = e2.iterator[n2];
135
+ if (o2 === t)
136
+ return r2.delegate = null, "throw" === n2 && e2.iterator.return && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y;
137
+ var i2 = tryCatch(o2, e2.iterator, r2.arg);
138
+ if ("throw" === i2.type)
139
+ return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y;
140
+ var a2 = i2.arg;
141
+ return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y);
142
+ }
143
+ function pushTryEntry(t2) {
144
+ var e2 = { tryLoc: t2[0] };
145
+ 1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2);
146
+ }
147
+ function resetTryEntry(t2) {
148
+ var e2 = t2.completion || {};
149
+ e2.type = "normal", delete e2.arg, t2.completion = e2;
150
+ }
151
+ function Context(t2) {
152
+ this.tryEntries = [{ tryLoc: "root" }], t2.forEach(pushTryEntry, this), this.reset(true);
153
+ }
154
+ function values(e2) {
155
+ if (e2 || "" === e2) {
156
+ var r2 = e2[a];
157
+ if (r2)
158
+ return r2.call(e2);
159
+ if ("function" == typeof e2.next)
160
+ return e2;
161
+ if (!isNaN(e2.length)) {
162
+ var o2 = -1, i2 = function next() {
163
+ for (; ++o2 < e2.length; )
164
+ if (n.call(e2, o2))
165
+ return next.value = e2[o2], next.done = false, next;
166
+ return next.value = t, next.done = true, next;
167
+ };
168
+ return i2.next = i2;
169
+ }
170
+ }
171
+ throw new TypeError(typeof e2 + " is not iterable");
172
+ }
173
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: true }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) {
174
+ var e2 = "function" == typeof t2 && t2.constructor;
175
+ return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name));
176
+ }, e.mark = function(t2) {
177
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2;
178
+ }, e.awrap = function(t2) {
179
+ return { __await: t2 };
180
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function() {
181
+ return this;
182
+ }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) {
183
+ void 0 === i2 && (i2 = Promise);
184
+ var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2);
185
+ return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) {
186
+ return t3.done ? t3.value : a2.next();
187
+ });
188
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function() {
189
+ return this;
190
+ }), define(g, "toString", function() {
191
+ return "[object Generator]";
192
+ }), e.keys = function(t2) {
193
+ var e2 = Object(t2), r2 = [];
194
+ for (var n2 in e2)
195
+ r2.push(n2);
196
+ return r2.reverse(), function next() {
197
+ for (; r2.length; ) {
198
+ var t3 = r2.pop();
199
+ if (t3 in e2)
200
+ return next.value = t3, next.done = false, next;
201
+ }
202
+ return next.done = true, next;
203
+ };
204
+ }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e2) {
205
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2)
206
+ for (var r2 in this)
207
+ "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t);
208
+ }, stop: function stop() {
209
+ this.done = true;
210
+ var t2 = this.tryEntries[0].completion;
211
+ if ("throw" === t2.type)
212
+ throw t2.arg;
213
+ return this.rval;
214
+ }, dispatchException: function dispatchException(e2) {
215
+ if (this.done)
216
+ throw e2;
217
+ var r2 = this;
218
+ function handle(n2, o3) {
219
+ return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3;
220
+ }
221
+ for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) {
222
+ var i2 = this.tryEntries[o2], a2 = i2.completion;
223
+ if ("root" === i2.tryLoc)
224
+ return handle("end");
225
+ if (i2.tryLoc <= this.prev) {
226
+ var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc");
227
+ if (c2 && u2) {
228
+ if (this.prev < i2.catchLoc)
229
+ return handle(i2.catchLoc, true);
230
+ if (this.prev < i2.finallyLoc)
231
+ return handle(i2.finallyLoc);
232
+ } else if (c2) {
233
+ if (this.prev < i2.catchLoc)
234
+ return handle(i2.catchLoc, true);
235
+ } else {
236
+ if (!u2)
237
+ throw Error("try statement without catch or finally");
238
+ if (this.prev < i2.finallyLoc)
239
+ return handle(i2.finallyLoc);
240
+ }
241
+ }
242
+ }
243
+ }, abrupt: function abrupt(t2, e2) {
244
+ for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) {
245
+ var o2 = this.tryEntries[r2];
246
+ if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) {
247
+ var i2 = o2;
248
+ break;
249
+ }
250
+ }
251
+ i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null);
252
+ var a2 = i2 ? i2.completion : {};
253
+ return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2);
254
+ }, complete: function complete(t2, e2) {
255
+ if ("throw" === t2.type)
256
+ throw t2.arg;
257
+ return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y;
258
+ }, finish: function finish(t2) {
259
+ for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
260
+ var r2 = this.tryEntries[e2];
261
+ if (r2.finallyLoc === t2)
262
+ return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y;
263
+ }
264
+ }, catch: function _catch(t2) {
265
+ for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
266
+ var r2 = this.tryEntries[e2];
267
+ if (r2.tryLoc === t2) {
268
+ var n2 = r2.completion;
269
+ if ("throw" === n2.type) {
270
+ var o2 = n2.arg;
271
+ resetTryEntry(r2);
272
+ }
273
+ return o2;
274
+ }
275
+ }
276
+ throw Error("illegal catch attempt");
277
+ }, delegateYield: function delegateYield(e2, r2, n2) {
278
+ return this.delegate = { iterator: values(e2), resultName: r2, nextLoc: n2 }, "next" === this.method && (this.arg = t), y;
279
+ } }, e;
280
+ }
281
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
282
+ try {
283
+ var i = n[a](c), u = i.value;
284
+ } catch (n2) {
285
+ return void e(n2);
286
+ }
287
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
288
+ }
289
+ function _asyncToGenerator(n) {
290
+ return function() {
291
+ var t = this, e = arguments;
292
+ return new Promise(function(r, o) {
293
+ var a = n.apply(t, e);
294
+ function _next(n2) {
295
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n2);
296
+ }
297
+ function _throw(n2) {
298
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2);
299
+ }
300
+ _next(void 0);
301
+ });
302
+ };
303
+ }
304
+ function _extends() {
305
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
306
+ for (var e = 1; e < arguments.length; e++) {
307
+ var t = arguments[e];
308
+ for (var r in t)
309
+ ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
310
+ }
311
+ return n;
312
+ }, _extends.apply(null, arguments);
313
+ }
314
+ var sides = ["top", "right", "bottom", "left"];
315
+ var min = Math.min;
316
+ var max = Math.max;
317
+ var round = Math.round;
318
+ var floor = Math.floor;
319
+ var createCoords = function createCoords2(v) {
320
+ return {
321
+ x: v,
322
+ y: v
323
+ };
324
+ };
325
+ var oppositeSideMap = {
326
+ left: "right",
327
+ right: "left",
328
+ bottom: "top",
329
+ top: "bottom"
330
+ };
331
+ var oppositeAlignmentMap = {
332
+ start: "end",
333
+ end: "start"
334
+ };
335
+ function clamp(start, value, end) {
336
+ return max(start, min(value, end));
337
+ }
338
+ function evaluate(value, param) {
339
+ return typeof value === "function" ? value(param) : value;
340
+ }
341
+ function getSide(placement) {
342
+ return placement.split("-")[0];
343
+ }
344
+ function getAlignment(placement) {
345
+ return placement.split("-")[1];
346
+ }
347
+ function getOppositeAxis(axis) {
348
+ return axis === "x" ? "y" : "x";
349
+ }
350
+ function getAxisLength(axis) {
351
+ return axis === "y" ? "height" : "width";
352
+ }
353
+ function getSideAxis(placement) {
354
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
355
+ }
356
+ function getAlignmentAxis(placement) {
357
+ return getOppositeAxis(getSideAxis(placement));
358
+ }
359
+ function getAlignmentSides(placement, rects, rtl) {
360
+ if (rtl === void 0) {
361
+ rtl = false;
362
+ }
363
+ var alignment = getAlignment(placement);
364
+ var alignmentAxis = getAlignmentAxis(placement);
365
+ var length = getAxisLength(alignmentAxis);
366
+ var mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
367
+ if (rects.reference[length] > rects.floating[length]) {
368
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
369
+ }
370
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
371
+ }
372
+ function getExpandedPlacements(placement) {
373
+ var oppositePlacement = getOppositePlacement(placement);
374
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
375
+ }
376
+ function getOppositeAlignmentPlacement(placement) {
377
+ return placement.replace(/start|end/g, function(alignment) {
378
+ return oppositeAlignmentMap[alignment];
379
+ });
380
+ }
381
+ function getSideList(side, isStart, rtl) {
382
+ var lr = ["left", "right"];
383
+ var rl = ["right", "left"];
384
+ var tb = ["top", "bottom"];
385
+ var bt = ["bottom", "top"];
386
+ switch (side) {
387
+ case "top":
388
+ case "bottom":
389
+ if (rtl)
390
+ return isStart ? rl : lr;
391
+ return isStart ? lr : rl;
392
+ case "left":
393
+ case "right":
394
+ return isStart ? tb : bt;
395
+ default:
396
+ return [];
397
+ }
398
+ }
399
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
400
+ var alignment = getAlignment(placement);
401
+ var list = getSideList(getSide(placement), direction === "start", rtl);
402
+ if (alignment) {
403
+ list = list.map(function(side) {
404
+ return side + "-" + alignment;
405
+ });
406
+ if (flipAlignment) {
407
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
408
+ }
409
+ }
410
+ return list;
411
+ }
412
+ function getOppositePlacement(placement) {
413
+ return placement.replace(/left|right|bottom|top/g, function(side) {
414
+ return oppositeSideMap[side];
415
+ });
416
+ }
417
+ function expandPaddingObject(padding) {
418
+ return _extends({
419
+ top: 0,
420
+ right: 0,
421
+ bottom: 0,
422
+ left: 0
423
+ }, padding);
424
+ }
425
+ function getPaddingObject(padding) {
426
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
427
+ top: padding,
428
+ right: padding,
429
+ bottom: padding,
430
+ left: padding
431
+ };
432
+ }
433
+ function rectToClientRect(rect) {
434
+ var x = rect.x, y = rect.y, width = rect.width, height = rect.height;
435
+ return {
436
+ width,
437
+ height,
438
+ top: y,
439
+ left: x,
440
+ right: x + width,
441
+ bottom: y + height,
442
+ x,
443
+ y
444
+ };
445
+ }
446
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
447
+ var reference = _ref.reference, floating = _ref.floating;
448
+ var sideAxis = getSideAxis(placement);
449
+ var alignmentAxis = getAlignmentAxis(placement);
450
+ var alignLength = getAxisLength(alignmentAxis);
451
+ var side = getSide(placement);
452
+ var isVertical = sideAxis === "y";
453
+ var commonX = reference.x + reference.width / 2 - floating.width / 2;
454
+ var commonY = reference.y + reference.height / 2 - floating.height / 2;
455
+ var commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
456
+ var coords;
457
+ switch (side) {
458
+ case "top":
459
+ coords = {
460
+ x: commonX,
461
+ y: reference.y - floating.height
462
+ };
463
+ break;
464
+ case "bottom":
465
+ coords = {
466
+ x: commonX,
467
+ y: reference.y + reference.height
468
+ };
469
+ break;
470
+ case "right":
471
+ coords = {
472
+ x: reference.x + reference.width,
473
+ y: commonY
474
+ };
475
+ break;
476
+ case "left":
477
+ coords = {
478
+ x: reference.x - floating.width,
479
+ y: commonY
480
+ };
481
+ break;
482
+ default:
483
+ coords = {
484
+ x: reference.x,
485
+ y: reference.y
486
+ };
487
+ }
488
+ switch (getAlignment(placement)) {
489
+ case "start":
490
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
491
+ break;
492
+ case "end":
493
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
494
+ break;
495
+ }
496
+ return coords;
497
+ }
498
+ var computePosition$1 = /* @__PURE__ */ function() {
499
+ var _ref2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(reference, floating, config) {
500
+ var _config$placement, placement, _config$strategy, strategy, _config$middleware, middleware, platform2, validMiddleware, rtl, rects, _computeCoordsFromPla, x, y, statefulPlacement, middlewareData, resetCount, i, _extends2, _validMiddleware$i2, name, fn, _yield$fn2, nextX, nextY, data, reset, _computeCoordsFromPla2;
501
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
502
+ while (1)
503
+ switch (_context.prev = _context.next) {
504
+ case 0:
505
+ _config$placement = config.placement, placement = _config$placement === void 0 ? "bottom" : _config$placement, _config$strategy = config.strategy, strategy = _config$strategy === void 0 ? "absolute" : _config$strategy, _config$middleware = config.middleware, middleware = _config$middleware === void 0 ? [] : _config$middleware, platform2 = config.platform;
506
+ validMiddleware = middleware.filter(Boolean);
507
+ _context.next = 4;
508
+ return platform2.isRTL == null ? void 0 : platform2.isRTL(floating);
509
+ case 4:
510
+ rtl = _context.sent;
511
+ _context.next = 7;
512
+ return platform2.getElementRects({
513
+ reference,
514
+ floating,
515
+ strategy
516
+ });
517
+ case 7:
518
+ rects = _context.sent;
519
+ _computeCoordsFromPla = computeCoordsFromPlacement(rects, placement, rtl), x = _computeCoordsFromPla.x, y = _computeCoordsFromPla.y;
520
+ statefulPlacement = placement;
521
+ middlewareData = {};
522
+ resetCount = 0;
523
+ i = 0;
524
+ case 13:
525
+ if (!(i < validMiddleware.length)) {
526
+ _context.next = 45;
527
+ break;
528
+ }
529
+ _validMiddleware$i2 = validMiddleware[i], name = _validMiddleware$i2.name, fn = _validMiddleware$i2.fn;
530
+ _context.next = 17;
531
+ return fn({
532
+ x,
533
+ y,
534
+ initialPlacement: placement,
535
+ placement: statefulPlacement,
536
+ strategy,
537
+ middlewareData,
538
+ rects,
539
+ platform: platform2,
540
+ elements: {
541
+ reference,
542
+ floating
543
+ }
544
+ });
545
+ case 17:
546
+ _yield$fn2 = _context.sent;
547
+ nextX = _yield$fn2.x;
548
+ nextY = _yield$fn2.y;
549
+ data = _yield$fn2.data;
550
+ reset = _yield$fn2.reset;
551
+ x = nextX != null ? nextX : x;
552
+ y = nextY != null ? nextY : y;
553
+ middlewareData = _extends({}, middlewareData, (_extends2 = {}, _extends2[name] = _extends({}, middlewareData[name], data), _extends2));
554
+ if (!(reset && resetCount <= 50)) {
555
+ _context.next = 42;
556
+ break;
557
+ }
558
+ resetCount++;
559
+ if (!(typeof reset === "object")) {
560
+ _context.next = 41;
561
+ break;
562
+ }
563
+ if (reset.placement) {
564
+ statefulPlacement = reset.placement;
565
+ }
566
+ if (!reset.rects) {
567
+ _context.next = 38;
568
+ break;
569
+ }
570
+ if (!(reset.rects === true)) {
571
+ _context.next = 36;
572
+ break;
573
+ }
574
+ _context.next = 33;
575
+ return platform2.getElementRects({
576
+ reference,
577
+ floating,
578
+ strategy
579
+ });
580
+ case 33:
581
+ _context.t0 = _context.sent;
582
+ _context.next = 37;
583
+ break;
584
+ case 36:
585
+ _context.t0 = reset.rects;
586
+ case 37:
587
+ rects = _context.t0;
588
+ case 38:
589
+ _computeCoordsFromPla2 = computeCoordsFromPlacement(rects, statefulPlacement, rtl);
590
+ x = _computeCoordsFromPla2.x;
591
+ y = _computeCoordsFromPla2.y;
592
+ case 41:
593
+ i = -1;
594
+ case 42:
595
+ i++;
596
+ _context.next = 13;
597
+ break;
598
+ case 45:
599
+ return _context.abrupt("return", {
600
+ x,
601
+ y,
602
+ placement: statefulPlacement,
603
+ strategy,
604
+ middlewareData
605
+ });
606
+ case 46:
607
+ case "end":
608
+ return _context.stop();
609
+ }
610
+ }, _callee);
611
+ }));
612
+ return function computePosition$12(_x, _x2, _x3) {
613
+ return _ref2.apply(this, arguments);
614
+ };
615
+ }();
616
+ function detectOverflow(_x4, _x5) {
617
+ return _detectOverflow.apply(this, arguments);
618
+ }
619
+ function _detectOverflow() {
620
+ _detectOverflow = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee8(state, options) {
621
+ var _await$platform$isEle, x, y, platform2, rects, elements, strategy, _evaluate5, _evaluate5$boundary, boundary, _evaluate5$rootBounda, rootBoundary, _evaluate5$elementCon, elementContext, _evaluate5$altBoundar, altBoundary, _evaluate5$padding, padding, paddingObject, altContext, element, clippingClientRect, rect, offsetParent, offsetScale, elementClientRect;
622
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
623
+ while (1)
624
+ switch (_context8.prev = _context8.next) {
625
+ case 0:
626
+ if (options === void 0) {
627
+ options = {};
628
+ }
629
+ x = state.x, y = state.y, platform2 = state.platform, rects = state.rects, elements = state.elements, strategy = state.strategy;
630
+ _evaluate5 = evaluate(options, state), _evaluate5$boundary = _evaluate5.boundary, boundary = _evaluate5$boundary === void 0 ? "clippingAncestors" : _evaluate5$boundary, _evaluate5$rootBounda = _evaluate5.rootBoundary, rootBoundary = _evaluate5$rootBounda === void 0 ? "viewport" : _evaluate5$rootBounda, _evaluate5$elementCon = _evaluate5.elementContext, elementContext = _evaluate5$elementCon === void 0 ? "floating" : _evaluate5$elementCon, _evaluate5$altBoundar = _evaluate5.altBoundary, altBoundary = _evaluate5$altBoundar === void 0 ? false : _evaluate5$altBoundar, _evaluate5$padding = _evaluate5.padding, padding = _evaluate5$padding === void 0 ? 0 : _evaluate5$padding;
631
+ paddingObject = getPaddingObject(padding);
632
+ altContext = elementContext === "floating" ? "reference" : "floating";
633
+ element = elements[altBoundary ? altContext : elementContext];
634
+ _context8.t0 = rectToClientRect;
635
+ _context8.t1 = platform2;
636
+ _context8.next = 10;
637
+ return platform2.isElement == null ? void 0 : platform2.isElement(element);
638
+ case 10:
639
+ _context8.t2 = _await$platform$isEle = _context8.sent;
640
+ if (!(_context8.t2 != null)) {
641
+ _context8.next = 15;
642
+ break;
643
+ }
644
+ _context8.t3 = _await$platform$isEle;
645
+ _context8.next = 16;
646
+ break;
647
+ case 15:
648
+ _context8.t3 = true;
649
+ case 16:
650
+ if (!_context8.t3) {
651
+ _context8.next = 20;
652
+ break;
653
+ }
654
+ _context8.t4 = element;
655
+ _context8.next = 26;
656
+ break;
657
+ case 20:
658
+ _context8.t5 = element.contextElement;
659
+ if (_context8.t5) {
660
+ _context8.next = 25;
661
+ break;
662
+ }
663
+ _context8.next = 24;
664
+ return platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating);
665
+ case 24:
666
+ _context8.t5 = _context8.sent;
667
+ case 25:
668
+ _context8.t4 = _context8.t5;
669
+ case 26:
670
+ _context8.t6 = _context8.t4;
671
+ _context8.t7 = boundary;
672
+ _context8.t8 = rootBoundary;
673
+ _context8.t9 = strategy;
674
+ _context8.t10 = {
675
+ element: _context8.t6,
676
+ boundary: _context8.t7,
677
+ rootBoundary: _context8.t8,
678
+ strategy: _context8.t9
679
+ };
680
+ _context8.next = 33;
681
+ return _context8.t1.getClippingRect.call(_context8.t1, _context8.t10);
682
+ case 33:
683
+ _context8.t11 = _context8.sent;
684
+ clippingClientRect = (0, _context8.t0)(_context8.t11);
685
+ rect = elementContext === "floating" ? {
686
+ x,
687
+ y,
688
+ width: rects.floating.width,
689
+ height: rects.floating.height
690
+ } : rects.reference;
691
+ _context8.next = 38;
692
+ return platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating);
693
+ case 38:
694
+ offsetParent = _context8.sent;
695
+ _context8.next = 41;
696
+ return platform2.isElement == null ? void 0 : platform2.isElement(offsetParent);
697
+ case 41:
698
+ if (!_context8.sent) {
699
+ _context8.next = 50;
700
+ break;
701
+ }
702
+ _context8.next = 44;
703
+ return platform2.getScale == null ? void 0 : platform2.getScale(offsetParent);
704
+ case 44:
705
+ _context8.t13 = _context8.sent;
706
+ if (_context8.t13) {
707
+ _context8.next = 47;
708
+ break;
709
+ }
710
+ _context8.t13 = {
711
+ x: 1,
712
+ y: 1
713
+ };
714
+ case 47:
715
+ _context8.t12 = _context8.t13;
716
+ _context8.next = 51;
717
+ break;
718
+ case 50:
719
+ _context8.t12 = {
720
+ x: 1,
721
+ y: 1
722
+ };
723
+ case 51:
724
+ offsetScale = _context8.t12;
725
+ _context8.t14 = rectToClientRect;
726
+ if (!platform2.convertOffsetParentRelativeRectToViewportRelativeRect) {
727
+ _context8.next = 59;
728
+ break;
729
+ }
730
+ _context8.next = 56;
731
+ return platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
732
+ elements,
733
+ rect,
734
+ offsetParent,
735
+ strategy
736
+ });
737
+ case 56:
738
+ _context8.t15 = _context8.sent;
739
+ _context8.next = 60;
740
+ break;
741
+ case 59:
742
+ _context8.t15 = rect;
743
+ case 60:
744
+ _context8.t16 = _context8.t15;
745
+ elementClientRect = (0, _context8.t14)(_context8.t16);
746
+ return _context8.abrupt("return", {
747
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
748
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
749
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
750
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
751
+ });
752
+ case 63:
753
+ case "end":
754
+ return _context8.stop();
755
+ }
756
+ }, _callee8);
757
+ }));
758
+ return _detectOverflow.apply(this, arguments);
759
+ }
760
+ var arrow$1 = function arrow$12(options) {
761
+ return {
762
+ name: "arrow",
763
+ options,
764
+ fn: function fn(state) {
765
+ return _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2() {
766
+ var _extends3, _ref4;
767
+ var x, y, placement, rects, platform2, elements, middlewareData, _ref3, element, _ref3$padding, padding, paddingObject, coords, axis, length, arrowDimensions, isYAxis, minProp, maxProp, clientProp, endDiff, startDiff, arrowOffsetParent, clientSize, centerToReference, largestPossiblePadding, minPadding, maxPadding, min$1, max2, center, offset2, shouldAddOffset, alignmentOffset;
768
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
769
+ while (1)
770
+ switch (_context2.prev = _context2.next) {
771
+ case 0:
772
+ x = state.x, y = state.y, placement = state.placement, rects = state.rects, platform2 = state.platform, elements = state.elements, middlewareData = state.middlewareData;
773
+ _ref3 = evaluate(options, state) || {}, element = _ref3.element, _ref3$padding = _ref3.padding, padding = _ref3$padding === void 0 ? 0 : _ref3$padding;
774
+ if (!(element == null)) {
775
+ _context2.next = 4;
776
+ break;
777
+ }
778
+ return _context2.abrupt("return", {});
779
+ case 4:
780
+ paddingObject = getPaddingObject(padding);
781
+ coords = {
782
+ x,
783
+ y
784
+ };
785
+ axis = getAlignmentAxis(placement);
786
+ length = getAxisLength(axis);
787
+ _context2.next = 10;
788
+ return platform2.getDimensions(element);
789
+ case 10:
790
+ arrowDimensions = _context2.sent;
791
+ isYAxis = axis === "y";
792
+ minProp = isYAxis ? "top" : "left";
793
+ maxProp = isYAxis ? "bottom" : "right";
794
+ clientProp = isYAxis ? "clientHeight" : "clientWidth";
795
+ endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
796
+ startDiff = coords[axis] - rects.reference[axis];
797
+ _context2.next = 19;
798
+ return platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element);
799
+ case 19:
800
+ arrowOffsetParent = _context2.sent;
801
+ clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
802
+ _context2.t0 = !clientSize;
803
+ if (_context2.t0) {
804
+ _context2.next = 26;
805
+ break;
806
+ }
807
+ _context2.next = 25;
808
+ return platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent);
809
+ case 25:
810
+ _context2.t0 = !_context2.sent;
811
+ case 26:
812
+ if (!_context2.t0) {
813
+ _context2.next = 28;
814
+ break;
815
+ }
816
+ clientSize = elements.floating[clientProp] || rects.floating[length];
817
+ case 28:
818
+ centerToReference = endDiff / 2 - startDiff / 2;
819
+ largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
820
+ minPadding = min(paddingObject[minProp], largestPossiblePadding);
821
+ maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
822
+ min$1 = minPadding;
823
+ max2 = clientSize - arrowDimensions[length] - maxPadding;
824
+ center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
825
+ offset2 = clamp(min$1, center, max2);
826
+ shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
827
+ alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
828
+ return _context2.abrupt("return", (_ref4 = {}, _ref4[axis] = coords[axis] + alignmentOffset, _ref4.data = _extends((_extends3 = {}, _extends3[axis] = offset2, _extends3.centerOffset = center - offset2 - alignmentOffset, _extends3), shouldAddOffset && {
829
+ alignmentOffset
830
+ }), _ref4.reset = shouldAddOffset, _ref4));
831
+ case 39:
832
+ case "end":
833
+ return _context2.stop();
834
+ }
835
+ }, _callee2);
836
+ }))();
837
+ }
838
+ };
839
+ };
840
+ var flip$1 = function flip$12(options) {
841
+ if (options === void 0) {
842
+ options = {};
843
+ }
844
+ return {
845
+ name: "flip",
846
+ options,
847
+ fn: function fn(state) {
848
+ return _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3() {
849
+ var _middlewareData$arrow, _middlewareData$flip, placement, middlewareData, rects, initialPlacement, platform2, elements, _evaluate, _evaluate$mainAxis, checkMainAxis, _evaluate$crossAxis, checkCrossAxis, specifiedFallbackPlacements, _evaluate$fallbackStr, fallbackStrategy, _evaluate$fallbackAxi, fallbackAxisSideDirection, _evaluate$flipAlignme, flipAlignment, detectOverflowOptions, side, initialSideAxis, isBasePlacement, rtl, fallbackPlacements, hasFallbackAxisSideDirection, placements, overflow, overflows, overflowsData, _sides, _middlewareData$flip2, _overflowsData$filter, nextIndex, nextPlacement, resetPlacement, _overflowsData$filter2, _placement;
850
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
851
+ while (1)
852
+ switch (_context3.prev = _context3.next) {
853
+ case 0:
854
+ placement = state.placement, middlewareData = state.middlewareData, rects = state.rects, initialPlacement = state.initialPlacement, platform2 = state.platform, elements = state.elements;
855
+ _evaluate = evaluate(options, state), _evaluate$mainAxis = _evaluate.mainAxis, checkMainAxis = _evaluate$mainAxis === void 0 ? true : _evaluate$mainAxis, _evaluate$crossAxis = _evaluate.crossAxis, checkCrossAxis = _evaluate$crossAxis === void 0 ? true : _evaluate$crossAxis, specifiedFallbackPlacements = _evaluate.fallbackPlacements, _evaluate$fallbackStr = _evaluate.fallbackStrategy, fallbackStrategy = _evaluate$fallbackStr === void 0 ? "bestFit" : _evaluate$fallbackStr, _evaluate$fallbackAxi = _evaluate.fallbackAxisSideDirection, fallbackAxisSideDirection = _evaluate$fallbackAxi === void 0 ? "none" : _evaluate$fallbackAxi, _evaluate$flipAlignme = _evaluate.flipAlignment, flipAlignment = _evaluate$flipAlignme === void 0 ? true : _evaluate$flipAlignme, detectOverflowOptions = _objectWithoutPropertiesLoose(_evaluate, _excluded);
856
+ if (!((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset)) {
857
+ _context3.next = 4;
858
+ break;
859
+ }
860
+ return _context3.abrupt("return", {});
861
+ case 4:
862
+ side = getSide(placement);
863
+ initialSideAxis = getSideAxis(initialPlacement);
864
+ isBasePlacement = getSide(initialPlacement) === initialPlacement;
865
+ _context3.next = 9;
866
+ return platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating);
867
+ case 9:
868
+ rtl = _context3.sent;
869
+ fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
870
+ hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
871
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
872
+ fallbackPlacements.push.apply(fallbackPlacements, getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
873
+ }
874
+ placements = [initialPlacement].concat(fallbackPlacements);
875
+ _context3.next = 16;
876
+ return detectOverflow(state, detectOverflowOptions);
877
+ case 16:
878
+ overflow = _context3.sent;
879
+ overflows = [];
880
+ overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
881
+ if (checkMainAxis) {
882
+ overflows.push(overflow[side]);
883
+ }
884
+ if (checkCrossAxis) {
885
+ _sides = getAlignmentSides(placement, rects, rtl);
886
+ overflows.push(overflow[_sides[0]], overflow[_sides[1]]);
887
+ }
888
+ overflowsData = [].concat(overflowsData, [{
889
+ placement,
890
+ overflows
891
+ }]);
892
+ if (overflows.every(function(side2) {
893
+ return side2 <= 0;
894
+ })) {
895
+ _context3.next = 39;
896
+ break;
897
+ }
898
+ nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
899
+ nextPlacement = placements[nextIndex];
900
+ if (!nextPlacement) {
901
+ _context3.next = 27;
902
+ break;
903
+ }
904
+ return _context3.abrupt("return", {
905
+ data: {
906
+ index: nextIndex,
907
+ overflows: overflowsData
908
+ },
909
+ reset: {
910
+ placement: nextPlacement
911
+ }
912
+ });
913
+ case 27:
914
+ resetPlacement = (_overflowsData$filter = overflowsData.filter(function(d) {
915
+ return d.overflows[0] <= 0;
916
+ }).sort(function(a, b) {
917
+ return a.overflows[1] - b.overflows[1];
918
+ })[0]) == null ? void 0 : _overflowsData$filter.placement;
919
+ if (resetPlacement) {
920
+ _context3.next = 37;
921
+ break;
922
+ }
923
+ _context3.t0 = fallbackStrategy;
924
+ _context3.next = _context3.t0 === "bestFit" ? 32 : _context3.t0 === "initialPlacement" ? 35 : 37;
925
+ break;
926
+ case 32:
927
+ _placement = (_overflowsData$filter2 = overflowsData.filter(function(d) {
928
+ if (hasFallbackAxisSideDirection) {
929
+ var currentSideAxis = getSideAxis(d.placement);
930
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
931
+ // reading directions favoring greater width.
932
+ currentSideAxis === "y";
933
+ }
934
+ return true;
935
+ }).map(function(d) {
936
+ return [d.placement, d.overflows.filter(function(overflow2) {
937
+ return overflow2 > 0;
938
+ }).reduce(function(acc, overflow2) {
939
+ return acc + overflow2;
940
+ }, 0)];
941
+ }).sort(function(a, b) {
942
+ return a[1] - b[1];
943
+ })[0]) == null ? void 0 : _overflowsData$filter2[0];
944
+ if (_placement) {
945
+ resetPlacement = _placement;
946
+ }
947
+ return _context3.abrupt("break", 37);
948
+ case 35:
949
+ resetPlacement = initialPlacement;
950
+ return _context3.abrupt("break", 37);
951
+ case 37:
952
+ if (!(placement !== resetPlacement)) {
953
+ _context3.next = 39;
954
+ break;
955
+ }
956
+ return _context3.abrupt("return", {
957
+ reset: {
958
+ placement: resetPlacement
959
+ }
960
+ });
961
+ case 39:
962
+ return _context3.abrupt("return", {});
963
+ case 40:
964
+ case "end":
965
+ return _context3.stop();
966
+ }
967
+ }, _callee3);
968
+ }))();
969
+ }
970
+ };
971
+ };
972
+ function getSideOffsets(overflow, rect) {
973
+ return {
974
+ top: overflow.top - rect.height,
975
+ right: overflow.right - rect.width,
976
+ bottom: overflow.bottom - rect.height,
977
+ left: overflow.left - rect.width
978
+ };
979
+ }
980
+ function isAnySideFullyClipped(overflow) {
981
+ return sides.some(function(side) {
982
+ return overflow[side] >= 0;
983
+ });
984
+ }
985
+ var hide$1 = function hide$12(options) {
986
+ if (options === void 0) {
987
+ options = {};
988
+ }
989
+ return {
990
+ name: "hide",
991
+ options,
992
+ fn: function fn(state) {
993
+ return _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4() {
994
+ var rects, _evaluate2, _evaluate2$strategy, strategy, detectOverflowOptions, overflow, offsets, _overflow, _offsets;
995
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
996
+ while (1)
997
+ switch (_context4.prev = _context4.next) {
998
+ case 0:
999
+ rects = state.rects;
1000
+ _evaluate2 = evaluate(options, state), _evaluate2$strategy = _evaluate2.strategy, strategy = _evaluate2$strategy === void 0 ? "referenceHidden" : _evaluate2$strategy, detectOverflowOptions = _objectWithoutPropertiesLoose(_evaluate2, _excluded2);
1001
+ _context4.t0 = strategy;
1002
+ _context4.next = _context4.t0 === "referenceHidden" ? 5 : _context4.t0 === "escaped" ? 10 : 15;
1003
+ break;
1004
+ case 5:
1005
+ _context4.next = 7;
1006
+ return detectOverflow(state, _extends({}, detectOverflowOptions, {
1007
+ elementContext: "reference"
1008
+ }));
1009
+ case 7:
1010
+ overflow = _context4.sent;
1011
+ offsets = getSideOffsets(overflow, rects.reference);
1012
+ return _context4.abrupt("return", {
1013
+ data: {
1014
+ referenceHiddenOffsets: offsets,
1015
+ referenceHidden: isAnySideFullyClipped(offsets)
1016
+ }
1017
+ });
1018
+ case 10:
1019
+ _context4.next = 12;
1020
+ return detectOverflow(state, _extends({}, detectOverflowOptions, {
1021
+ altBoundary: true
1022
+ }));
1023
+ case 12:
1024
+ _overflow = _context4.sent;
1025
+ _offsets = getSideOffsets(_overflow, rects.floating);
1026
+ return _context4.abrupt("return", {
1027
+ data: {
1028
+ escapedOffsets: _offsets,
1029
+ escaped: isAnySideFullyClipped(_offsets)
1030
+ }
1031
+ });
1032
+ case 15:
1033
+ return _context4.abrupt("return", {});
1034
+ case 16:
1035
+ case "end":
1036
+ return _context4.stop();
1037
+ }
1038
+ }, _callee4);
1039
+ }))();
1040
+ }
1041
+ };
1042
+ };
1043
+ function convertValueToCoords(_x6, _x7) {
1044
+ return _convertValueToCoords.apply(this, arguments);
1045
+ }
1046
+ function _convertValueToCoords() {
1047
+ _convertValueToCoords = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee9(state, options) {
1048
+ var placement, platform2, elements, rtl, side, alignment, isVertical, mainAxisMulti, crossAxisMulti, rawValue, _ref7, mainAxis, crossAxis, alignmentAxis;
1049
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1050
+ while (1)
1051
+ switch (_context9.prev = _context9.next) {
1052
+ case 0:
1053
+ placement = state.placement, platform2 = state.platform, elements = state.elements;
1054
+ _context9.next = 3;
1055
+ return platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating);
1056
+ case 3:
1057
+ rtl = _context9.sent;
1058
+ side = getSide(placement);
1059
+ alignment = getAlignment(placement);
1060
+ isVertical = getSideAxis(placement) === "y";
1061
+ mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
1062
+ crossAxisMulti = rtl && isVertical ? -1 : 1;
1063
+ rawValue = evaluate(options, state);
1064
+ _ref7 = typeof rawValue === "number" ? {
1065
+ mainAxis: rawValue,
1066
+ crossAxis: 0,
1067
+ alignmentAxis: null
1068
+ } : {
1069
+ mainAxis: rawValue.mainAxis || 0,
1070
+ crossAxis: rawValue.crossAxis || 0,
1071
+ alignmentAxis: rawValue.alignmentAxis
1072
+ }, mainAxis = _ref7.mainAxis, crossAxis = _ref7.crossAxis, alignmentAxis = _ref7.alignmentAxis;
1073
+ if (alignment && typeof alignmentAxis === "number") {
1074
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1075
+ }
1076
+ return _context9.abrupt("return", isVertical ? {
1077
+ x: crossAxis * crossAxisMulti,
1078
+ y: mainAxis * mainAxisMulti
1079
+ } : {
1080
+ x: mainAxis * mainAxisMulti,
1081
+ y: crossAxis * crossAxisMulti
1082
+ });
1083
+ case 13:
1084
+ case "end":
1085
+ return _context9.stop();
1086
+ }
1087
+ }, _callee9);
1088
+ }));
1089
+ return _convertValueToCoords.apply(this, arguments);
1090
+ }
1091
+ var offset$1 = function offset$12(options) {
1092
+ if (options === void 0) {
1093
+ options = 0;
1094
+ }
1095
+ return {
1096
+ name: "offset",
1097
+ options,
1098
+ fn: function fn(state) {
1099
+ return _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee5() {
1100
+ var _middlewareData$offse, _middlewareData$arrow, x, y, placement, middlewareData, diffCoords;
1101
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1102
+ while (1)
1103
+ switch (_context5.prev = _context5.next) {
1104
+ case 0:
1105
+ x = state.x, y = state.y, placement = state.placement, middlewareData = state.middlewareData;
1106
+ _context5.next = 3;
1107
+ return convertValueToCoords(state, options);
1108
+ case 3:
1109
+ diffCoords = _context5.sent;
1110
+ if (!(placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset)) {
1111
+ _context5.next = 6;
1112
+ break;
1113
+ }
1114
+ return _context5.abrupt("return", {});
1115
+ case 6:
1116
+ return _context5.abrupt("return", {
1117
+ x: x + diffCoords.x,
1118
+ y: y + diffCoords.y,
1119
+ data: _extends({}, diffCoords, {
1120
+ placement
1121
+ })
1122
+ });
1123
+ case 7:
1124
+ case "end":
1125
+ return _context5.stop();
1126
+ }
1127
+ }, _callee5);
1128
+ }))();
1129
+ }
1130
+ };
1131
+ };
1132
+ var shift$1 = function shift$12(options) {
1133
+ if (options === void 0) {
1134
+ options = {};
1135
+ }
1136
+ return {
1137
+ name: "shift",
1138
+ options,
1139
+ fn: function fn(state) {
1140
+ return _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee6() {
1141
+ var _extends4, _enabled;
1142
+ var x, y, placement, _evaluate3, _evaluate3$mainAxis, checkMainAxis, _evaluate3$crossAxis, checkCrossAxis, _evaluate3$limiter, limiter, detectOverflowOptions, coords, overflow, crossAxis, mainAxis, mainAxisCoord, crossAxisCoord, minSide, maxSide, _min, _max, _minSide, _maxSide, _min2, _max2, limitedCoords;
1143
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1144
+ while (1)
1145
+ switch (_context6.prev = _context6.next) {
1146
+ case 0:
1147
+ x = state.x, y = state.y, placement = state.placement;
1148
+ _evaluate3 = evaluate(options, state), _evaluate3$mainAxis = _evaluate3.mainAxis, checkMainAxis = _evaluate3$mainAxis === void 0 ? true : _evaluate3$mainAxis, _evaluate3$crossAxis = _evaluate3.crossAxis, checkCrossAxis = _evaluate3$crossAxis === void 0 ? false : _evaluate3$crossAxis, _evaluate3$limiter = _evaluate3.limiter, limiter = _evaluate3$limiter === void 0 ? {
1149
+ fn: function fn2(_ref) {
1150
+ var x2 = _ref.x, y2 = _ref.y;
1151
+ return {
1152
+ x: x2,
1153
+ y: y2
1154
+ };
1155
+ }
1156
+ } : _evaluate3$limiter, detectOverflowOptions = _objectWithoutPropertiesLoose(_evaluate3, _excluded3);
1157
+ coords = {
1158
+ x,
1159
+ y
1160
+ };
1161
+ _context6.next = 5;
1162
+ return detectOverflow(state, detectOverflowOptions);
1163
+ case 5:
1164
+ overflow = _context6.sent;
1165
+ crossAxis = getSideAxis(getSide(placement));
1166
+ mainAxis = getOppositeAxis(crossAxis);
1167
+ mainAxisCoord = coords[mainAxis];
1168
+ crossAxisCoord = coords[crossAxis];
1169
+ if (checkMainAxis) {
1170
+ minSide = mainAxis === "y" ? "top" : "left";
1171
+ maxSide = mainAxis === "y" ? "bottom" : "right";
1172
+ _min = mainAxisCoord + overflow[minSide];
1173
+ _max = mainAxisCoord - overflow[maxSide];
1174
+ mainAxisCoord = clamp(_min, mainAxisCoord, _max);
1175
+ }
1176
+ if (checkCrossAxis) {
1177
+ _minSide = crossAxis === "y" ? "top" : "left";
1178
+ _maxSide = crossAxis === "y" ? "bottom" : "right";
1179
+ _min2 = crossAxisCoord + overflow[_minSide];
1180
+ _max2 = crossAxisCoord - overflow[_maxSide];
1181
+ crossAxisCoord = clamp(_min2, crossAxisCoord, _max2);
1182
+ }
1183
+ limitedCoords = limiter.fn(_extends({}, state, (_extends4 = {}, _extends4[mainAxis] = mainAxisCoord, _extends4[crossAxis] = crossAxisCoord, _extends4)));
1184
+ return _context6.abrupt("return", _extends({}, limitedCoords, {
1185
+ data: {
1186
+ x: limitedCoords.x - x,
1187
+ y: limitedCoords.y - y,
1188
+ enabled: (_enabled = {}, _enabled[mainAxis] = checkMainAxis, _enabled[crossAxis] = checkCrossAxis, _enabled)
1189
+ }
1190
+ }));
1191
+ case 14:
1192
+ case "end":
1193
+ return _context6.stop();
1194
+ }
1195
+ }, _callee6);
1196
+ }))();
1197
+ }
1198
+ };
1199
+ };
1200
+ var limitShift$1 = function limitShift$12(options) {
1201
+ if (options === void 0) {
1202
+ options = {};
1203
+ }
1204
+ return {
1205
+ options,
1206
+ fn: function fn(state) {
1207
+ var _ref5;
1208
+ var x = state.x, y = state.y, placement = state.placement, rects = state.rects, middlewareData = state.middlewareData;
1209
+ var _evaluate4 = evaluate(options, state), _evaluate4$offset = _evaluate4.offset, offset2 = _evaluate4$offset === void 0 ? 0 : _evaluate4$offset, _evaluate4$mainAxis = _evaluate4.mainAxis, checkMainAxis = _evaluate4$mainAxis === void 0 ? true : _evaluate4$mainAxis, _evaluate4$crossAxis = _evaluate4.crossAxis, checkCrossAxis = _evaluate4$crossAxis === void 0 ? true : _evaluate4$crossAxis;
1210
+ var coords = {
1211
+ x,
1212
+ y
1213
+ };
1214
+ var crossAxis = getSideAxis(placement);
1215
+ var mainAxis = getOppositeAxis(crossAxis);
1216
+ var mainAxisCoord = coords[mainAxis];
1217
+ var crossAxisCoord = coords[crossAxis];
1218
+ var rawOffset = evaluate(offset2, state);
1219
+ var computedOffset = typeof rawOffset === "number" ? {
1220
+ mainAxis: rawOffset,
1221
+ crossAxis: 0
1222
+ } : _extends({
1223
+ mainAxis: 0,
1224
+ crossAxis: 0
1225
+ }, rawOffset);
1226
+ if (checkMainAxis) {
1227
+ var len = mainAxis === "y" ? "height" : "width";
1228
+ var limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1229
+ var limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1230
+ if (mainAxisCoord < limitMin) {
1231
+ mainAxisCoord = limitMin;
1232
+ } else if (mainAxisCoord > limitMax) {
1233
+ mainAxisCoord = limitMax;
1234
+ }
1235
+ }
1236
+ if (checkCrossAxis) {
1237
+ var _middlewareData$offse, _middlewareData$offse2;
1238
+ var _len = mainAxis === "y" ? "width" : "height";
1239
+ var isOriginSide = ["top", "left"].includes(getSide(placement));
1240
+ var _limitMin = rects.reference[crossAxis] - rects.floating[_len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1241
+ var _limitMax = rects.reference[crossAxis] + rects.reference[_len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1242
+ if (crossAxisCoord < _limitMin) {
1243
+ crossAxisCoord = _limitMin;
1244
+ } else if (crossAxisCoord > _limitMax) {
1245
+ crossAxisCoord = _limitMax;
1246
+ }
1247
+ }
1248
+ return _ref5 = {}, _ref5[mainAxis] = mainAxisCoord, _ref5[crossAxis] = crossAxisCoord, _ref5;
1249
+ }
1250
+ };
1251
+ };
1252
+ function hasWindow() {
1253
+ return typeof window !== "undefined";
1254
+ }
1255
+ function getNodeName(node) {
1256
+ if (isNode(node)) {
1257
+ return (node.nodeName || "").toLowerCase();
1258
+ }
1259
+ return "#document";
1260
+ }
1261
+ function getWindow(node) {
1262
+ var _node$ownerDocument;
1263
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1264
+ }
1265
+ function getDocumentElement(node) {
1266
+ var _ref;
1267
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1268
+ }
1269
+ function isNode(value) {
1270
+ if (!hasWindow()) {
1271
+ return false;
1272
+ }
1273
+ return value instanceof Node || value instanceof getWindow(value).Node;
1274
+ }
1275
+ function isElement(value) {
1276
+ if (!hasWindow()) {
1277
+ return false;
1278
+ }
1279
+ return value instanceof Element || value instanceof getWindow(value).Element;
1280
+ }
1281
+ function isHTMLElement(value) {
1282
+ if (!hasWindow()) {
1283
+ return false;
1284
+ }
1285
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1286
+ }
1287
+ function isShadowRoot(value) {
1288
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
1289
+ return false;
1290
+ }
1291
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1292
+ }
1293
+ function isOverflowElement(element) {
1294
+ var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY, display = _getComputedStyle.display;
1295
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
1296
+ }
1297
+ function isTableElement(element) {
1298
+ return ["table", "td", "th"].includes(getNodeName(element));
1299
+ }
1300
+ function isTopLayer(element) {
1301
+ return [":popover-open", ":modal"].some(function(selector) {
1302
+ try {
1303
+ return element.matches(selector);
1304
+ } catch (e) {
1305
+ return false;
1306
+ }
1307
+ });
1308
+ }
1309
+ function isContainingBlock(elementOrCss) {
1310
+ var webkit = isWebKit();
1311
+ var css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
1312
+ 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(function(value) {
1313
+ return (css.willChange || "").includes(value);
1314
+ }) || ["paint", "layout", "strict", "content"].some(function(value) {
1315
+ return (css.contain || "").includes(value);
1316
+ });
1317
+ }
1318
+ function getContainingBlock(element) {
1319
+ var currentNode = getParentNode(element);
1320
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1321
+ if (isContainingBlock(currentNode)) {
1322
+ return currentNode;
1323
+ } else if (isTopLayer(currentNode)) {
1324
+ return null;
1325
+ }
1326
+ currentNode = getParentNode(currentNode);
1327
+ }
1328
+ return null;
1329
+ }
1330
+ function isWebKit() {
1331
+ if (typeof CSS === "undefined" || !CSS.supports)
1332
+ return false;
1333
+ return CSS.supports("-webkit-backdrop-filter", "none");
1334
+ }
1335
+ function isLastTraversableNode(node) {
1336
+ return ["html", "body", "#document"].includes(getNodeName(node));
1337
+ }
1338
+ function getComputedStyle(element) {
1339
+ return getWindow(element).getComputedStyle(element);
1340
+ }
1341
+ function getNodeScroll(element) {
1342
+ if (isElement(element)) {
1343
+ return {
1344
+ scrollLeft: element.scrollLeft,
1345
+ scrollTop: element.scrollTop
1346
+ };
1347
+ }
1348
+ return {
1349
+ scrollLeft: element.scrollX,
1350
+ scrollTop: element.scrollY
1351
+ };
1352
+ }
1353
+ function getParentNode(node) {
1354
+ if (getNodeName(node) === "html") {
1355
+ return node;
1356
+ }
1357
+ var result = (
1358
+ // Step into the shadow DOM of the parent of a slotted node.
1359
+ node.assignedSlot || // DOM Element detected.
1360
+ node.parentNode || // ShadowRoot detected.
1361
+ isShadowRoot(node) && node.host || // Fallback.
1362
+ getDocumentElement(node)
1363
+ );
1364
+ return isShadowRoot(result) ? result.host : result;
1365
+ }
1366
+ function getNearestOverflowAncestor(node) {
1367
+ var parentNode = getParentNode(node);
1368
+ if (isLastTraversableNode(parentNode)) {
1369
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1370
+ }
1371
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1372
+ return parentNode;
1373
+ }
1374
+ return getNearestOverflowAncestor(parentNode);
1375
+ }
1376
+ function getOverflowAncestors(node, list, traverseIframes) {
1377
+ var _node$ownerDocument2;
1378
+ if (list === void 0) {
1379
+ list = [];
1380
+ }
1381
+ if (traverseIframes === void 0) {
1382
+ traverseIframes = true;
1383
+ }
1384
+ var scrollableAncestor = getNearestOverflowAncestor(node);
1385
+ var isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1386
+ var win = getWindow(scrollableAncestor);
1387
+ if (isBody) {
1388
+ var frameElement = getFrameElement(win);
1389
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1390
+ }
1391
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1392
+ }
1393
+ function getFrameElement(win) {
1394
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1395
+ }
1396
+ function getCssDimensions(element) {
1397
+ var css = getComputedStyle(element);
1398
+ var width = parseFloat(css.width) || 0;
1399
+ var height = parseFloat(css.height) || 0;
1400
+ var hasOffset = isHTMLElement(element);
1401
+ var offsetWidth = hasOffset ? element.offsetWidth : width;
1402
+ var offsetHeight = hasOffset ? element.offsetHeight : height;
1403
+ var shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1404
+ if (shouldFallback) {
1405
+ width = offsetWidth;
1406
+ height = offsetHeight;
1407
+ }
1408
+ return {
1409
+ width,
1410
+ height,
1411
+ $: shouldFallback
1412
+ };
1413
+ }
1414
+ function unwrapElement(element) {
1415
+ return !isElement(element) ? element.contextElement : element;
1416
+ }
1417
+ function getScale(element) {
1418
+ var domElement = unwrapElement(element);
1419
+ if (!isHTMLElement(domElement)) {
1420
+ return createCoords(1);
1421
+ }
1422
+ var rect = domElement.getBoundingClientRect();
1423
+ var _getCssDimensions = getCssDimensions(domElement), width = _getCssDimensions.width, height = _getCssDimensions.height, $ = _getCssDimensions.$;
1424
+ var x = ($ ? round(rect.width) : rect.width) / width;
1425
+ var y = ($ ? round(rect.height) : rect.height) / height;
1426
+ if (!x || !Number.isFinite(x)) {
1427
+ x = 1;
1428
+ }
1429
+ if (!y || !Number.isFinite(y)) {
1430
+ y = 1;
1431
+ }
1432
+ return {
1433
+ x,
1434
+ y
1435
+ };
1436
+ }
1437
+ var noOffsets = /* @__PURE__ */ createCoords(0);
1438
+ function getVisualOffsets(element) {
1439
+ var win = getWindow(element);
1440
+ if (!isWebKit() || !win.visualViewport) {
1441
+ return noOffsets;
1442
+ }
1443
+ return {
1444
+ x: win.visualViewport.offsetLeft,
1445
+ y: win.visualViewport.offsetTop
1446
+ };
1447
+ }
1448
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1449
+ if (isFixed === void 0) {
1450
+ isFixed = false;
1451
+ }
1452
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1453
+ return false;
1454
+ }
1455
+ return isFixed;
1456
+ }
1457
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1458
+ if (includeScale === void 0) {
1459
+ includeScale = false;
1460
+ }
1461
+ if (isFixedStrategy === void 0) {
1462
+ isFixedStrategy = false;
1463
+ }
1464
+ var clientRect = element.getBoundingClientRect();
1465
+ var domElement = unwrapElement(element);
1466
+ var scale = createCoords(1);
1467
+ if (includeScale) {
1468
+ if (offsetParent) {
1469
+ if (isElement(offsetParent)) {
1470
+ scale = getScale(offsetParent);
1471
+ }
1472
+ } else {
1473
+ scale = getScale(element);
1474
+ }
1475
+ }
1476
+ var visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1477
+ var x = (clientRect.left + visualOffsets.x) / scale.x;
1478
+ var y = (clientRect.top + visualOffsets.y) / scale.y;
1479
+ var width = clientRect.width / scale.x;
1480
+ var height = clientRect.height / scale.y;
1481
+ if (domElement) {
1482
+ var win = getWindow(domElement);
1483
+ var offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1484
+ var currentWin = win;
1485
+ var currentIFrame = getFrameElement(currentWin);
1486
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1487
+ var iframeScale = getScale(currentIFrame);
1488
+ var iframeRect = currentIFrame.getBoundingClientRect();
1489
+ var css = getComputedStyle(currentIFrame);
1490
+ var left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1491
+ var top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1492
+ x *= iframeScale.x;
1493
+ y *= iframeScale.y;
1494
+ width *= iframeScale.x;
1495
+ height *= iframeScale.y;
1496
+ x += left;
1497
+ y += top;
1498
+ currentWin = getWindow(currentIFrame);
1499
+ currentIFrame = getFrameElement(currentWin);
1500
+ }
1501
+ }
1502
+ return rectToClientRect({
1503
+ width,
1504
+ height,
1505
+ x,
1506
+ y
1507
+ });
1508
+ }
1509
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1510
+ var elements = _ref.elements, rect = _ref.rect, offsetParent = _ref.offsetParent, strategy = _ref.strategy;
1511
+ var isFixed = strategy === "fixed";
1512
+ var documentElement = getDocumentElement(offsetParent);
1513
+ var topLayer = elements ? isTopLayer(elements.floating) : false;
1514
+ if (offsetParent === documentElement || topLayer && isFixed) {
1515
+ return rect;
1516
+ }
1517
+ var scroll = {
1518
+ scrollLeft: 0,
1519
+ scrollTop: 0
1520
+ };
1521
+ var scale = createCoords(1);
1522
+ var offsets = createCoords(0);
1523
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1524
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1525
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1526
+ scroll = getNodeScroll(offsetParent);
1527
+ }
1528
+ if (isHTMLElement(offsetParent)) {
1529
+ var offsetRect = getBoundingClientRect(offsetParent);
1530
+ scale = getScale(offsetParent);
1531
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1532
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1533
+ }
1534
+ }
1535
+ return {
1536
+ width: rect.width * scale.x,
1537
+ height: rect.height * scale.y,
1538
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1539
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1540
+ };
1541
+ }
1542
+ function getClientRects(element) {
1543
+ return Array.from(element.getClientRects());
1544
+ }
1545
+ function getWindowScrollBarX(element) {
1546
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1547
+ }
1548
+ function getDocumentRect(element) {
1549
+ var html = getDocumentElement(element);
1550
+ var scroll = getNodeScroll(element);
1551
+ var body = element.ownerDocument.body;
1552
+ var width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1553
+ var height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1554
+ var x = -scroll.scrollLeft + getWindowScrollBarX(element);
1555
+ var y = -scroll.scrollTop;
1556
+ if (getComputedStyle(body).direction === "rtl") {
1557
+ x += max(html.clientWidth, body.clientWidth) - width;
1558
+ }
1559
+ return {
1560
+ width,
1561
+ height,
1562
+ x,
1563
+ y
1564
+ };
1565
+ }
1566
+ function getViewportRect(element, strategy) {
1567
+ var win = getWindow(element);
1568
+ var html = getDocumentElement(element);
1569
+ var visualViewport = win.visualViewport;
1570
+ var width = html.clientWidth;
1571
+ var height = html.clientHeight;
1572
+ var x = 0;
1573
+ var y = 0;
1574
+ if (visualViewport) {
1575
+ width = visualViewport.width;
1576
+ height = visualViewport.height;
1577
+ var visualViewportBased = isWebKit();
1578
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
1579
+ x = visualViewport.offsetLeft;
1580
+ y = visualViewport.offsetTop;
1581
+ }
1582
+ }
1583
+ return {
1584
+ width,
1585
+ height,
1586
+ x,
1587
+ y
1588
+ };
1589
+ }
1590
+ function getInnerBoundingClientRect(element, strategy) {
1591
+ var clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1592
+ var top = clientRect.top + element.clientTop;
1593
+ var left = clientRect.left + element.clientLeft;
1594
+ var scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1595
+ var width = element.clientWidth * scale.x;
1596
+ var height = element.clientHeight * scale.y;
1597
+ var x = left * scale.x;
1598
+ var y = top * scale.y;
1599
+ return {
1600
+ width,
1601
+ height,
1602
+ x,
1603
+ y
1604
+ };
1605
+ }
1606
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1607
+ var rect;
1608
+ if (clippingAncestor === "viewport") {
1609
+ rect = getViewportRect(element, strategy);
1610
+ } else if (clippingAncestor === "document") {
1611
+ rect = getDocumentRect(getDocumentElement(element));
1612
+ } else if (isElement(clippingAncestor)) {
1613
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1614
+ } else {
1615
+ var visualOffsets = getVisualOffsets(element);
1616
+ rect = _extends({}, clippingAncestor, {
1617
+ x: clippingAncestor.x - visualOffsets.x,
1618
+ y: clippingAncestor.y - visualOffsets.y
1619
+ });
1620
+ }
1621
+ return rectToClientRect(rect);
1622
+ }
1623
+ function hasFixedPositionAncestor(element, stopNode) {
1624
+ var parentNode = getParentNode(element);
1625
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1626
+ return false;
1627
+ }
1628
+ return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
1629
+ }
1630
+ function getClippingElementAncestors(element, cache) {
1631
+ var cachedResult = cache.get(element);
1632
+ if (cachedResult) {
1633
+ return cachedResult;
1634
+ }
1635
+ var result = getOverflowAncestors(element, [], false).filter(function(el) {
1636
+ return isElement(el) && getNodeName(el) !== "body";
1637
+ });
1638
+ var currentContainingBlockComputedStyle = null;
1639
+ var elementIsFixed = getComputedStyle(element).position === "fixed";
1640
+ var currentNode = elementIsFixed ? getParentNode(element) : element;
1641
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1642
+ var computedStyle = getComputedStyle(currentNode);
1643
+ var currentNodeIsContaining = isContainingBlock(currentNode);
1644
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
1645
+ currentContainingBlockComputedStyle = null;
1646
+ }
1647
+ var shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1648
+ if (shouldDropCurrentNode) {
1649
+ result = result.filter(function(ancestor) {
1650
+ return ancestor !== currentNode;
1651
+ });
1652
+ } else {
1653
+ currentContainingBlockComputedStyle = computedStyle;
1654
+ }
1655
+ currentNode = getParentNode(currentNode);
1656
+ }
1657
+ cache.set(element, result);
1658
+ return result;
1659
+ }
1660
+ function getClippingRect(_ref) {
1661
+ var element = _ref.element, boundary = _ref.boundary, rootBoundary = _ref.rootBoundary, strategy = _ref.strategy;
1662
+ var elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1663
+ var clippingAncestors = [].concat(elementClippingAncestors, [rootBoundary]);
1664
+ var firstClippingAncestor = clippingAncestors[0];
1665
+ var clippingRect = clippingAncestors.reduce(function(accRect, clippingAncestor) {
1666
+ var rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1667
+ accRect.top = max(rect.top, accRect.top);
1668
+ accRect.right = min(rect.right, accRect.right);
1669
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1670
+ accRect.left = max(rect.left, accRect.left);
1671
+ return accRect;
1672
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1673
+ return {
1674
+ width: clippingRect.right - clippingRect.left,
1675
+ height: clippingRect.bottom - clippingRect.top,
1676
+ x: clippingRect.left,
1677
+ y: clippingRect.top
1678
+ };
1679
+ }
1680
+ function getDimensions(element) {
1681
+ var _getCssDimensions2 = getCssDimensions(element), width = _getCssDimensions2.width, height = _getCssDimensions2.height;
1682
+ return {
1683
+ width,
1684
+ height
1685
+ };
1686
+ }
1687
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1688
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1689
+ var documentElement = getDocumentElement(offsetParent);
1690
+ var isFixed = strategy === "fixed";
1691
+ var rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1692
+ var scroll = {
1693
+ scrollLeft: 0,
1694
+ scrollTop: 0
1695
+ };
1696
+ var offsets = createCoords(0);
1697
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1698
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1699
+ scroll = getNodeScroll(offsetParent);
1700
+ }
1701
+ if (isOffsetParentAnElement) {
1702
+ var offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1703
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1704
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1705
+ } else if (documentElement) {
1706
+ offsets.x = getWindowScrollBarX(documentElement);
1707
+ }
1708
+ }
1709
+ var x = rect.left + scroll.scrollLeft - offsets.x;
1710
+ var y = rect.top + scroll.scrollTop - offsets.y;
1711
+ return {
1712
+ x,
1713
+ y,
1714
+ width: rect.width,
1715
+ height: rect.height
1716
+ };
1717
+ }
1718
+ function isStaticPositioned(element) {
1719
+ return getComputedStyle(element).position === "static";
1720
+ }
1721
+ function getTrueOffsetParent(element, polyfill) {
1722
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
1723
+ return null;
1724
+ }
1725
+ if (polyfill) {
1726
+ return polyfill(element);
1727
+ }
1728
+ return element.offsetParent;
1729
+ }
1730
+ function getOffsetParent(element, polyfill) {
1731
+ var win = getWindow(element);
1732
+ if (isTopLayer(element)) {
1733
+ return win;
1734
+ }
1735
+ if (!isHTMLElement(element)) {
1736
+ var svgOffsetParent = getParentNode(element);
1737
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1738
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1739
+ return svgOffsetParent;
1740
+ }
1741
+ svgOffsetParent = getParentNode(svgOffsetParent);
1742
+ }
1743
+ return win;
1744
+ }
1745
+ var offsetParent = getTrueOffsetParent(element, polyfill);
1746
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1747
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1748
+ }
1749
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1750
+ return win;
1751
+ }
1752
+ return offsetParent || getContainingBlock(element) || win;
1753
+ }
1754
+ var getElementRects = /* @__PURE__ */ function() {
1755
+ var _ref6 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee7(data) {
1756
+ var getOffsetParentFn, getDimensionsFn, floatingDimensions;
1757
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1758
+ while (1)
1759
+ switch (_context7.prev = _context7.next) {
1760
+ case 0:
1761
+ getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1762
+ getDimensionsFn = this.getDimensions;
1763
+ _context7.next = 4;
1764
+ return getDimensionsFn(data.floating);
1765
+ case 4:
1766
+ floatingDimensions = _context7.sent;
1767
+ _context7.t0 = getRectRelativeToOffsetParent;
1768
+ _context7.t1 = data.reference;
1769
+ _context7.next = 9;
1770
+ return getOffsetParentFn(data.floating);
1771
+ case 9:
1772
+ _context7.t2 = _context7.sent;
1773
+ _context7.t3 = data.strategy;
1774
+ _context7.t4 = (0, _context7.t0)(_context7.t1, _context7.t2, _context7.t3);
1775
+ _context7.t5 = {
1776
+ x: 0,
1777
+ y: 0,
1778
+ width: floatingDimensions.width,
1779
+ height: floatingDimensions.height
1780
+ };
1781
+ return _context7.abrupt("return", {
1782
+ reference: _context7.t4,
1783
+ floating: _context7.t5
1784
+ });
1785
+ case 14:
1786
+ case "end":
1787
+ return _context7.stop();
1788
+ }
1789
+ }, _callee7, this);
1790
+ }));
1791
+ return function getElementRects2(_x8) {
1792
+ return _ref6.apply(this, arguments);
1793
+ };
1794
+ }();
1795
+ function isRTL(element) {
1796
+ return getComputedStyle(element).direction === "rtl";
1797
+ }
1798
+ var platform = {
1799
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1800
+ getDocumentElement,
1801
+ getClippingRect,
1802
+ getOffsetParent,
1803
+ getElementRects,
1804
+ getClientRects,
1805
+ getDimensions,
1806
+ getScale,
1807
+ isElement,
1808
+ isRTL
1809
+ };
1810
+ function observeMove(element, onMove) {
1811
+ var io = null;
1812
+ var timeoutId;
1813
+ var root = getDocumentElement(element);
1814
+ function cleanup() {
1815
+ var _io;
1816
+ clearTimeout(timeoutId);
1817
+ (_io = io) == null || _io.disconnect();
1818
+ io = null;
1819
+ }
1820
+ function refresh(skip, threshold) {
1821
+ if (skip === void 0) {
1822
+ skip = false;
1823
+ }
1824
+ if (threshold === void 0) {
1825
+ threshold = 1;
1826
+ }
1827
+ cleanup();
1828
+ var _element$getBoundingC = element.getBoundingClientRect(), left = _element$getBoundingC.left, top = _element$getBoundingC.top, width = _element$getBoundingC.width, height = _element$getBoundingC.height;
1829
+ if (!skip) {
1830
+ onMove();
1831
+ }
1832
+ if (!width || !height) {
1833
+ return;
1834
+ }
1835
+ var insetTop = floor(top);
1836
+ var insetRight = floor(root.clientWidth - (left + width));
1837
+ var insetBottom = floor(root.clientHeight - (top + height));
1838
+ var insetLeft = floor(left);
1839
+ var rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1840
+ var options = {
1841
+ rootMargin,
1842
+ threshold: max(0, min(1, threshold)) || 1
1843
+ };
1844
+ var isFirstUpdate = true;
1845
+ function handleObserve(entries) {
1846
+ var ratio = entries[0].intersectionRatio;
1847
+ if (ratio !== threshold) {
1848
+ if (!isFirstUpdate) {
1849
+ return refresh();
1850
+ }
1851
+ if (!ratio) {
1852
+ timeoutId = setTimeout(function() {
1853
+ refresh(false, 1e-7);
1854
+ }, 1e3);
1855
+ } else {
1856
+ refresh(false, ratio);
1857
+ }
1858
+ }
1859
+ isFirstUpdate = false;
1860
+ }
1861
+ try {
1862
+ io = new IntersectionObserver(handleObserve, _extends({}, options, {
1863
+ // Handle <iframe>s
1864
+ root: root.ownerDocument
1865
+ }));
1866
+ } catch (e) {
1867
+ io = new IntersectionObserver(handleObserve, options);
1868
+ }
1869
+ io.observe(element);
1870
+ }
1871
+ refresh(true);
1872
+ return cleanup;
1873
+ }
1874
+ function autoUpdate(reference, floating, update, options) {
1875
+ if (options === void 0) {
1876
+ options = {};
1877
+ }
1878
+ var _options = options, _options$ancestorScro = _options.ancestorScroll, ancestorScroll = _options$ancestorScro === void 0 ? true : _options$ancestorScro, _options$ancestorResi = _options.ancestorResize, ancestorResize = _options$ancestorResi === void 0 ? true : _options$ancestorResi, _options$elementResiz = _options.elementResize, elementResize = _options$elementResiz === void 0 ? typeof ResizeObserver === "function" : _options$elementResiz, _options$layoutShift = _options.layoutShift, layoutShift = _options$layoutShift === void 0 ? typeof IntersectionObserver === "function" : _options$layoutShift, _options$animationFra = _options.animationFrame, animationFrame = _options$animationFra === void 0 ? false : _options$animationFra;
1879
+ var referenceEl = unwrapElement(reference);
1880
+ var ancestors = ancestorScroll || ancestorResize ? [].concat(referenceEl ? getOverflowAncestors(referenceEl) : [], getOverflowAncestors(floating)) : [];
1881
+ ancestors.forEach(function(ancestor) {
1882
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
1883
+ passive: true
1884
+ });
1885
+ ancestorResize && ancestor.addEventListener("resize", update);
1886
+ });
1887
+ var cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1888
+ var reobserveFrame = -1;
1889
+ var resizeObserver = null;
1890
+ if (elementResize) {
1891
+ resizeObserver = new ResizeObserver(function(_ref) {
1892
+ var firstEntry = _ref[0];
1893
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1894
+ resizeObserver.unobserve(floating);
1895
+ cancelAnimationFrame(reobserveFrame);
1896
+ reobserveFrame = requestAnimationFrame(function() {
1897
+ var _resizeObserver;
1898
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1899
+ });
1900
+ }
1901
+ update();
1902
+ });
1903
+ if (referenceEl && !animationFrame) {
1904
+ resizeObserver.observe(referenceEl);
1905
+ }
1906
+ resizeObserver.observe(floating);
1907
+ }
1908
+ var frameId;
1909
+ var prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1910
+ if (animationFrame) {
1911
+ frameLoop();
1912
+ }
1913
+ function frameLoop() {
1914
+ var nextRefRect = getBoundingClientRect(reference);
1915
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1916
+ update();
1917
+ }
1918
+ prevRefRect = nextRefRect;
1919
+ frameId = requestAnimationFrame(frameLoop);
1920
+ }
1921
+ update();
1922
+ return function() {
1923
+ var _resizeObserver2;
1924
+ ancestors.forEach(function(ancestor) {
1925
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
1926
+ ancestorResize && ancestor.removeEventListener("resize", update);
1927
+ });
1928
+ cleanupIo == null || cleanupIo();
1929
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1930
+ resizeObserver = null;
1931
+ if (animationFrame) {
1932
+ cancelAnimationFrame(frameId);
1933
+ }
1934
+ };
1935
+ }
1936
+ var offset = offset$1;
1937
+ var shift = shift$1;
1938
+ var flip = flip$1;
1939
+ var hide = hide$1;
1940
+ var arrow = arrow$1;
1941
+ var limitShift = limitShift$1;
1942
+ var computePosition = function computePosition2(reference, floating, options) {
1943
+ var cache = /* @__PURE__ */ new Map();
1944
+ var mergedOptions = _extends({
1945
+ platform
1946
+ }, options);
1947
+ var platformWithCache = _extends({}, mergedOptions.platform, {
1948
+ _c: cache
1949
+ });
1950
+ return computePosition$1(reference, floating, _extends({}, mergedOptions, {
1951
+ platform: platformWithCache
1952
+ }));
1953
+ };
1954
+
1955
+ var reactive = hooks.reactive, watch$1 = hooks.watch, markRaw = hooks.markRaw, onBeforeUnmount = hooks.onBeforeUnmount;
1956
+ var defaultOption = {
1957
+ reference: null,
1958
+ popper: null,
1959
+ show: false,
1960
+ autoUpdate: true,
1961
+ strategy: "absolute",
1962
+ placement: "bottom",
1963
+ offset: 6,
1964
+ arrowVisible: true,
1965
+ rootBoundary: "viewport",
1966
+ boundary: "clippingAncestors",
1967
+ boundaryPadding: 5,
1968
+ syncHide: true,
1969
+ autoHide: false,
1970
+ gpuAcceleration: false,
1971
+ animate: true,
1972
+ animateName: "fade-in-linear",
1973
+ appendToBody: false,
1974
+ customClass: "",
1975
+ flipAble: true,
1976
+ shiftAble: true
1977
+ };
1978
+ var oppositeSidesMap = {
1979
+ top: "bottom",
1980
+ right: "left",
1981
+ bottom: "top",
1982
+ left: "right"
1983
+ };
1984
+ var toMs = function toMs2(s) {
1985
+ if (s === "auto")
1986
+ return 0;
1987
+ return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
1988
+ };
1989
+ var getTransitionInfo = function getTransitionInfo2(el) {
1990
+ var styles = window.getComputedStyle(el);
1991
+ var timeout = toMs(styles.transitionDelay) + toMs(styles.transitionDuration);
1992
+ if (timeout)
1993
+ return timeout;
1994
+ timeout = toMs(styles.animationDelay) + toMs(styles.animationDuration);
1995
+ if (timeout)
1996
+ return timeout;
1997
+ return 0;
1998
+ };
1999
+ var applyClass = function applyClass2(el, classes, force) {
2000
+ classes.split(" ").forEach(function(c) {
2001
+ return c && el.classList.toggle(c, force);
2002
+ });
2003
+ };
2004
+ var updatePopper = function updatePopper2(state) {
2005
+ var middleware = [offset(state.offset)];
2006
+ state.flipAble && middleware.push(flip({
2007
+ rootBoundary: state.rootBoundary,
2008
+ boundary: state.boundary,
2009
+ padding: state.boundaryPadding
2010
+ }));
2011
+ state.shiftAble && middleware.push(shift({
2012
+ limiter: limitShift()
2013
+ }));
2014
+ state.arrowVisible && middleware.push(arrow({
2015
+ element: state.popper.querySelector(".tiny-popper__arrow"),
2016
+ padding: 8
2017
+ }));
2018
+ middleware.push(hide());
2019
+ computePosition(state.reference, state.popper, {
2020
+ placement: state.placement,
2021
+ strategy: state.strategy,
2022
+ middleware
2023
+ }).then(function(_ref) {
2024
+ var _state$_last;
2025
+ var x = _ref.x, y = _ref.y, placement = _ref.placement, strategy = _ref.strategy, middlewareData = _ref.middlewareData;
2026
+ if (state.autoHide && state._last.show) {
2027
+ var timestamp = /* @__PURE__ */ (/* @__PURE__ */ new Date()).getTime();
2028
+ if (timestamp > state._last.timestamp + 300) {
2029
+ state.show = false;
2030
+ return;
2031
+ }
2032
+ }
2033
+ var finalStyles = {};
2034
+ Object.assign(finalStyles, {
2035
+ position: strategy
2036
+ });
2037
+ if (state.gpuAcceleration) {
2038
+ Object.assign(finalStyles, {
2039
+ transform: "translate(" + x + "px," + y + "px)",
2040
+ left: "0",
2041
+ top: "0"
2042
+ });
2043
+ } else {
2044
+ Object.assign(finalStyles, {
2045
+ left: x + "px",
2046
+ top: y + "px"
2047
+ });
2048
+ }
2049
+ if (state.syncHide) {
2050
+ if (middlewareData.hide) {
2051
+ Object.assign(finalStyles, {
2052
+ visibility: middlewareData.hide.referenceHidden ? "hidden" : "visible"
2053
+ });
2054
+ }
2055
+ }
2056
+ Object.assign(state.popper.style, finalStyles);
2057
+ if (state._last.customClass && state._last.customClass !== state.customClass) {
2058
+ applyClass(state.popper, state._last.customClass, false);
2059
+ }
2060
+ if (state.customClass && ((_state$_last = state._last) == null ? void 0 : _state$_last.customClass) !== state.customClass) {
2061
+ applyClass(state.popper, state.customClass, true);
2062
+ state._last.customClass = state.customClass;
2063
+ }
2064
+ if (state.arrowVisible) {
2065
+ var _arrowStyle;
2066
+ var _middlewareData$arrow2 = middlewareData.arrow, arrowX = _middlewareData$arrow2.x, arrowY = _middlewareData$arrow2.y;
2067
+ var arrowElement = state._last.arrowEl;
2068
+ var staticSide = oppositeSidesMap[placement.split("-")[0]];
2069
+ var arrowStyle = (_arrowStyle = {
2070
+ left: arrowX !== null ? arrowX + "px" : "",
2071
+ top: arrowY !== null ? arrowY + "px" : "",
2072
+ right: "",
2073
+ bottom: ""
2074
+ }, _arrowStyle[staticSide] = "-4px", _arrowStyle.display = "block", _arrowStyle);
2075
+ Object.assign(arrowElement.style, arrowStyle);
2076
+ } else {
2077
+ if (state._last.arrowInserted) {
2078
+ state._last.arrowEl.style.display = "none";
2079
+ }
2080
+ }
2081
+ emit(state, "update", {
2082
+ x,
2083
+ y,
2084
+ placement,
2085
+ strategy,
2086
+ middlewareData
2087
+ });
2088
+ });
2089
+ };
2090
+ var autoUpdatePopper = function autoUpdatePopper2(state) {
2091
+ return autoUpdate(state.reference, state.popper, function() {
2092
+ updatePopper(state);
2093
+ });
2094
+ };
2095
+ var appendPopper = function appendPopper2(state) {
2096
+ if (state._last.show && state._last.popper === state.popper)
2097
+ return;
2098
+ if (state._last.popper && state._last.popper !== state.popper) {
2099
+ if (state._last.appendToBody) {
2100
+ state._last.popper.remove();
2101
+ } else {
2102
+ state._last.popper.style.display = "none";
2103
+ }
2104
+ state._last.arrowInserted = false;
2105
+ state._last.arrowEl = null;
2106
+ }
2107
+ if (state.popper) {
2108
+ if (state.appendToBody) {
2109
+ document.body.append(state.popper);
2110
+ } else {
2111
+ state.popper.style.display = "block";
2112
+ }
2113
+ if (!state._last.arrowInserted) {
2114
+ var arrowEl = document.createElement("div");
2115
+ arrowEl.className = "tiny-popper__arrow";
2116
+ state.popper.append(arrowEl);
2117
+ state._last.arrowInserted = true;
2118
+ state._last.arrowEl = arrowEl;
2119
+ }
2120
+ if (state.animate) {
2121
+ var enterName = state.animateName + "-enter-from";
2122
+ var activeName = state.animateName + "-enter-active";
2123
+ state.popper.classList.add(enterName, activeName);
2124
+ setTimeout(function() {
2125
+ state.popper.classList.remove(enterName);
2126
+ }, 0);
2127
+ var timeout = getTransitionInfo(state.popper);
2128
+ setTimeout(function() {
2129
+ state.popper.classList.remove(activeName);
2130
+ }, timeout);
2131
+ }
2132
+ emit(state, "show");
2133
+ }
2134
+ };
2135
+ var closePopper = function closePopper2(state) {
2136
+ if (!state._last.show)
2137
+ return;
2138
+ if (state.popper) {
2139
+ if (state.animate && state.animateName) {
2140
+ var leaveName = state.animateName + "-leave-to";
2141
+ var activeName = state.animateName + "-leave-active";
2142
+ state.popper.classList.add(leaveName, activeName);
2143
+ var timeout = getTransitionInfo(state.popper);
2144
+ setTimeout(function() {
2145
+ state.popper.classList.remove(leaveName, activeName);
2146
+ if (state.appendToBody) {
2147
+ state.popper.remove();
2148
+ } else {
2149
+ state.popper.style.display = "none";
2150
+ }
2151
+ emit(state, "hide");
2152
+ }, timeout);
2153
+ } else {
2154
+ if (state.appendToBody) {
2155
+ state.popper.remove();
2156
+ } else {
2157
+ state.popper.style.display = "none";
2158
+ }
2159
+ emit(state, "hide");
2160
+ }
2161
+ }
2162
+ };
2163
+ var emit = function emit2(state, eventName, params) {
2164
+ state._events[eventName].forEach(function(cb) {
2165
+ return cb(params);
2166
+ });
2167
+ };
2168
+ var virtualEl = function virtualEl2(x, y, w, h) {
2169
+ if (w === void 0) {
2170
+ w = 0;
2171
+ }
2172
+ if (h === void 0) {
2173
+ h = 0;
2174
+ }
2175
+ return {
2176
+ getBoundingClientRect: function getBoundingClientRect() {
2177
+ return {
2178
+ width: 0,
2179
+ height: 0,
2180
+ x,
2181
+ y,
2182
+ top: y,
2183
+ left: x,
2184
+ right: x + w,
2185
+ bottom: y + h
2186
+ };
2187
+ }
2188
+ };
2189
+ };
2190
+ var useFloating = function useFloating2(option) {
2191
+ if (option === void 0) {
2192
+ option = {};
2193
+ }
2194
+ var state = reactive(option);
2195
+ var cleanup = null;
2196
+ Object.keys(defaultOption).forEach(function(key) {
2197
+ if (!Object.prototype.hasOwnProperty.call(state, key)) {
2198
+ state[key] = defaultOption[key];
2199
+ }
2200
+ });
2201
+ state._last = markRaw({});
2202
+ state._events = markRaw({
2203
+ show: [],
2204
+ hide: [],
2205
+ update: []
2206
+ });
2207
+ var watchState = function watchState2() {
2208
+ if (state.popper && state.reference) {
2209
+ if (state.show) {
2210
+ appendPopper(state);
2211
+ if (state.autoUpdate) {
2212
+ cleanup && cleanup();
2213
+ cleanup = autoUpdatePopper(state);
2214
+ } else {
2215
+ updatePopper(state);
2216
+ }
2217
+ } else {
2218
+ cleanup && cleanup();
2219
+ closePopper(state);
2220
+ }
2221
+ } else {
2222
+ cleanup && cleanup();
2223
+ closePopper(state);
2224
+ }
2225
+ state._last.popper = state.popper;
2226
+ state._last.reference = state.reference;
2227
+ state._last.show = state.show && state.popper && state.reference;
2228
+ state._last.appendToBody = state.appendToBody;
2229
+ state._last.timestamp = /* @__PURE__ */ (/* @__PURE__ */ new Date()).getTime();
2230
+ };
2231
+ watch$1(state, watchState, {
2232
+ immediate: true
2233
+ });
2234
+ var on = function on2(eventName, cb) {
2235
+ return state._events[eventName].push(cb);
2236
+ };
2237
+ var off = function off2(eventName, cb) {
2238
+ return state._events[eventName] = state._events[eventName].filter(function(i) {
2239
+ return i !== cb;
2240
+ });
2241
+ };
2242
+ onBeforeUnmount(function() {
2243
+ cleanup && cleanup();
2244
+ closePopper(state);
2245
+ });
2246
+ return {
2247
+ state,
2248
+ on,
2249
+ off,
2250
+ virtualEl,
2251
+ forceUpdate: watchState
2252
+ };
2253
+ };
2254
+ var ref = hooks.ref, watch = hooks.watch, isRef = hooks.isRef;
2255
+ var useLazyShow = function useLazyShow2(show) {
2256
+ var lazyShow = ref(isRef(show) ? show.value : show);
2257
+ if (!lazyShow.value) {
2258
+ var stop = watch(show, function(v) {
2259
+ return v && (lazyShow.value = true) && stop();
2260
+ }, {
2261
+ flush: "sync"
2262
+ });
2263
+ }
2264
+ return {
2265
+ lazyShow
2266
+ };
2267
+ };
2268
+
2269
+ export { useFloating, useLazyShow };