@warp-ds/elements 1.3.4-next.1 → 1.4.0-next.2

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.
@@ -9,18 +9,18 @@ var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
10
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
11
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a3, b3) => {
13
- for (var prop in b3 || (b3 = {}))
14
- if (__hasOwnProp.call(b3, prop))
15
- __defNormalProp(a3, prop, b3[prop]);
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
16
  if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b3)) {
18
- if (__propIsEnum.call(b3, prop))
19
- __defNormalProp(a3, prop, b3[prop]);
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
20
  }
21
- return a3;
21
+ return a;
22
22
  };
23
- var __spreadProps = (a3, b3) => __defProps(a3, __getOwnPropDescs(b3));
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
24
  var __objRest = (source, exclude) => {
25
25
  var target = {};
26
26
  for (var prop in source)
@@ -211,27 +211,27 @@ var require_moo = __commonJS({
211
211
  var hasOwnProperty = Object.prototype.hasOwnProperty;
212
212
  var toString = Object.prototype.toString;
213
213
  var hasSticky = typeof new RegExp().sticky === "boolean";
214
- function isRegExp(o3) {
215
- return o3 && toString.call(o3) === "[object RegExp]";
214
+ function isRegExp(o) {
215
+ return o && toString.call(o) === "[object RegExp]";
216
216
  }
217
- function isObject(o3) {
218
- return o3 && typeof o3 === "object" && !isRegExp(o3) && !Array.isArray(o3);
217
+ function isObject(o) {
218
+ return o && typeof o === "object" && !isRegExp(o) && !Array.isArray(o);
219
219
  }
220
- function reEscape(s3) {
221
- return s3.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
220
+ function reEscape(s) {
221
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
222
222
  }
223
- function reGroups(s3) {
224
- var re = new RegExp("|" + s3);
223
+ function reGroups(s) {
224
+ var re = new RegExp("|" + s);
225
225
  return re.exec("").length - 1;
226
226
  }
227
- function reCapture(s3) {
228
- return "(" + s3 + ")";
227
+ function reCapture(s) {
228
+ return "(" + s + ")";
229
229
  }
230
230
  function reUnion(regexps) {
231
231
  if (!regexps.length)
232
232
  return "(?!)";
233
- var source = regexps.map(function(s3) {
234
- return "(?:" + s3 + ")";
233
+ var source = regexps.map(function(s) {
234
+ return "(?:" + s + ")";
235
235
  }).join("|");
236
236
  return "(?:" + source + ")";
237
237
  }
@@ -252,11 +252,11 @@ var require_moo = __commonJS({
252
252
  throw new Error("Not a pattern: " + obj);
253
253
  }
254
254
  }
255
- function pad(s3, length) {
256
- if (s3.length > length) {
257
- return s3;
255
+ function pad(s, length) {
256
+ if (s.length > length) {
257
+ return s;
258
258
  }
259
- return Array(length - s3.length + 1).join(" ") + s3;
259
+ return Array(length - s.length + 1).join(" ") + s;
260
260
  }
261
261
  function lastNLines(string, numLines) {
262
262
  var position = string.length;
@@ -282,8 +282,8 @@ var require_moo = __commonJS({
282
282
  function objectToRules(object) {
283
283
  var keys = Object.getOwnPropertyNames(object);
284
284
  var result = [];
285
- for (var i3 = 0; i3 < keys.length; i3++) {
286
- var key = keys[i3];
285
+ for (var i = 0; i < keys.length; i++) {
286
+ var key = keys[i];
287
287
  var thing = object[key];
288
288
  var rules = [].concat(thing);
289
289
  if (key === "include") {
@@ -310,8 +310,8 @@ var require_moo = __commonJS({
310
310
  }
311
311
  function arrayToRules(array) {
312
312
  var result = [];
313
- for (var i3 = 0; i3 < array.length; i3++) {
314
- var obj = array[i3];
313
+ for (var i = 0; i < array.length; i++) {
314
+ var obj = array[i];
315
315
  if (obj.include) {
316
316
  var include = [].concat(obj.include);
317
317
  for (var j = 0; j < include.length; j++) {
@@ -355,8 +355,8 @@ var require_moo = __commonJS({
355
355
  }
356
356
  var match = options.match;
357
357
  options.match = Array.isArray(match) ? match : match ? [match] : [];
358
- options.match.sort(function(a3, b3) {
359
- return isRegExp(a3) && isRegExp(b3) ? 0 : isRegExp(b3) ? -1 : isRegExp(a3) ? 1 : b3.length - a3.length;
358
+ options.match.sort(function(a, b) {
359
+ return isRegExp(a) && isRegExp(b) ? 0 : isRegExp(b) ? -1 : isRegExp(a) ? 1 : b.length - a.length;
360
360
  });
361
361
  return options;
362
362
  }
@@ -371,13 +371,13 @@ var require_moo = __commonJS({
371
371
  var unicodeFlag = null;
372
372
  var groups = [];
373
373
  var parts = [];
374
- for (var i3 = 0; i3 < rules.length; i3++) {
375
- if (rules[i3].fallback) {
374
+ for (var i = 0; i < rules.length; i++) {
375
+ if (rules[i].fallback) {
376
376
  fastAllowed = false;
377
377
  }
378
378
  }
379
- for (var i3 = 0; i3 < rules.length; i3++) {
380
- var options = rules[i3];
379
+ for (var i = 0; i < rules.length; i++) {
380
+ var options = rules[i];
381
381
  if (options.include) {
382
382
  throw new Error("Inheritance is not allowed in stateless lexers");
383
383
  }
@@ -448,13 +448,13 @@ var require_moo = __commonJS({
448
448
  var result = compileRules(toRules(rules));
449
449
  return new Lexer({ start: result }, "start");
450
450
  }
451
- function checkStateGroup(g3, name, map) {
452
- var state = g3 && (g3.push || g3.next);
451
+ function checkStateGroup(g, name, map) {
452
+ var state = g && (g.push || g.next);
453
453
  if (state && !map[state]) {
454
- throw new Error("Missing state '" + state + "' (in token '" + g3.defaultType + "' of state '" + name + "')");
454
+ throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')");
455
455
  }
456
- if (g3 && g3.pop && +g3.pop !== 1) {
457
- throw new Error("pop must be 1 (in token '" + g3.defaultType + "' of state '" + name + "')");
456
+ if (g && g.pop && +g.pop !== 1) {
457
+ throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')");
458
458
  }
459
459
  }
460
460
  function compileStates(states, start) {
@@ -464,12 +464,12 @@ var require_moo = __commonJS({
464
464
  if (!start)
465
465
  start = keys[0];
466
466
  var ruleMap = /* @__PURE__ */ Object.create(null);
467
- for (var i3 = 0; i3 < keys.length; i3++) {
468
- var key = keys[i3];
467
+ for (var i = 0; i < keys.length; i++) {
468
+ var key = keys[i];
469
469
  ruleMap[key] = toRules(states[key]).concat(all);
470
470
  }
471
- for (var i3 = 0; i3 < keys.length; i3++) {
472
- var key = keys[i3];
471
+ for (var i = 0; i < keys.length; i++) {
472
+ var key = keys[i];
473
473
  var rules = ruleMap[key];
474
474
  var included = /* @__PURE__ */ Object.create(null);
475
475
  for (var j = 0; j < rules.length; j++) {
@@ -483,8 +483,8 @@ var require_moo = __commonJS({
483
483
  if (!newRules) {
484
484
  throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')");
485
485
  }
486
- for (var k2 = 0; k2 < newRules.length; k2++) {
487
- var newRule = newRules[k2];
486
+ for (var k = 0; k < newRules.length; k++) {
487
+ var newRule = newRules[k];
488
488
  if (rules.indexOf(newRule) !== -1)
489
489
  continue;
490
490
  splice.push(newRule);
@@ -495,12 +495,12 @@ var require_moo = __commonJS({
495
495
  }
496
496
  }
497
497
  var map = /* @__PURE__ */ Object.create(null);
498
- for (var i3 = 0; i3 < keys.length; i3++) {
499
- var key = keys[i3];
498
+ for (var i = 0; i < keys.length; i++) {
499
+ var key = keys[i];
500
500
  map[key] = compileRules(ruleMap[key], true);
501
501
  }
502
- for (var i3 = 0; i3 < keys.length; i3++) {
503
- var name = keys[i3];
502
+ for (var i = 0; i < keys.length; i++) {
503
+ var name = keys[i];
504
504
  var state = map[name];
505
505
  var groups = state.groups;
506
506
  for (var j = 0; j < groups.length; j++) {
@@ -517,8 +517,8 @@ var require_moo = __commonJS({
517
517
  var isMap = typeof Map !== "undefined";
518
518
  var reverseMap = isMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
519
519
  var types = Object.getOwnPropertyNames(map);
520
- for (var i3 = 0; i3 < types.length; i3++) {
521
- var tokenType = types[i3];
520
+ for (var i = 0; i < types.length; i++) {
521
+ var tokenType = types[i];
522
522
  var item = map[tokenType];
523
523
  var keywordList = Array.isArray(item) ? item : [item];
524
524
  keywordList.forEach(function(keyword) {
@@ -532,8 +532,8 @@ var require_moo = __commonJS({
532
532
  }
533
533
  });
534
534
  }
535
- return function(k2) {
536
- return isMap ? reverseMap.get(k2) : reverseMap[k2];
535
+ return function(k) {
536
+ return isMap ? reverseMap.get(k) : reverseMap[k];
537
537
  };
538
538
  }
539
539
  var Lexer = function(states, state) {
@@ -594,9 +594,9 @@ var require_moo = __commonJS({
594
594
  };
595
595
  Lexer.prototype._getGroup = function(match) {
596
596
  var groupCount = this.groups.length;
597
- for (var i3 = 0; i3 < groupCount; i3++) {
598
- if (match[i3 + 1] !== void 0) {
599
- return this.groups[i3];
597
+ for (var i = 0; i < groupCount; i++) {
598
+ if (match[i + 1] !== void 0) {
599
+ return this.groups[i];
600
600
  }
601
601
  }
602
602
  throw new Error("Cannot find token type for matched text");
@@ -636,7 +636,7 @@ var require_moo = __commonJS({
636
636
  }
637
637
  return this._token(group, text, index);
638
638
  };
639
- Lexer.prototype._token = function(group, text, offset) {
639
+ Lexer.prototype._token = function(group, text, offset2) {
640
640
  var lineBreaks = 0;
641
641
  if (group.lineBreaks) {
642
642
  var matchNL = /\n/g;
@@ -655,18 +655,18 @@ var require_moo = __commonJS({
655
655
  value: typeof group.value === "function" ? group.value(text) : text,
656
656
  text,
657
657
  toString: tokenToString,
658
- offset,
658
+ offset: offset2,
659
659
  lineBreaks,
660
660
  line: this.line,
661
661
  col: this.col
662
662
  };
663
- var size = text.length;
664
- this.index += size;
663
+ var size2 = text.length;
664
+ this.index += size2;
665
665
  this.line += lineBreaks;
666
666
  if (lineBreaks !== 0) {
667
- this.col = size - nl + 1;
667
+ this.col = size2 - nl + 1;
668
668
  } else {
669
- this.col += size;
669
+ this.col += size2;
670
670
  }
671
671
  if (group.shouldThrow) {
672
672
  var err = new Error(this.formatError(token, "invalid syntax"));
@@ -717,9 +717,9 @@ var require_moo = __commonJS({
717
717
  var errorLines = [];
718
718
  errorLines.push(message + " at line " + token.line + " col " + token.col + ":");
719
719
  errorLines.push("");
720
- for (var i3 = 0; i3 < displayedLines.length; i3++) {
721
- var line = displayedLines[i3];
722
- var lineNo = firstDisplayedLine + i3;
720
+ for (var i = 0; i < displayedLines.length; i++) {
721
+ var line = displayedLines[i];
722
+ var lineNo = firstDisplayedLine + i;
723
723
  errorLines.push(pad(String(lineNo), lastLineDigits) + " " + line);
724
724
  if (lineNo === token.line) {
725
725
  errorLines.push(pad("", lastLineDigits + token.col + 1) + "^");
@@ -829,12 +829,12 @@ var require_parser = __commonJS({
829
829
  function strictArgStyleParam(lt, param) {
830
830
  let value = "";
831
831
  let text = "";
832
- for (const p3 of param) {
833
- const pText = p3.ctx.text;
832
+ for (const p of param) {
833
+ const pText = p.ctx.text;
834
834
  text += pText;
835
- switch (p3.type) {
835
+ switch (p.type) {
836
836
  case "content":
837
- value += p3.value;
837
+ value += p.value;
838
838
  break;
839
839
  case "argument":
840
840
  case "function":
@@ -845,12 +845,12 @@ var require_parser = __commonJS({
845
845
  throw new ParseError(lt, `Unsupported part in strict mode function arg style: ${pText}`);
846
846
  }
847
847
  }
848
- const c3 = {
848
+ const c = {
849
849
  type: "content",
850
850
  value: value.trim(),
851
851
  ctx: Object.assign({}, param[0].ctx, { text })
852
852
  };
853
- return [c3];
853
+ return [c];
854
854
  }
855
855
  var strictArgTypes = [
856
856
  "number",
@@ -1343,417 +1343,1294 @@ var attention = {
1343
1343
  closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
1344
1344
  };
1345
1345
 
1346
- // node_modules/.pnpm/@floating-ui+core@0.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
1347
- function t(t2) {
1348
- return t2.split("-")[0];
1346
+ // node_modules/.pnpm/@floating-ui+utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
1347
+ var sides = ["top", "right", "bottom", "left"];
1348
+ var min = Math.min;
1349
+ var max = Math.max;
1350
+ var round = Math.round;
1351
+ var createCoords = (v) => ({
1352
+ x: v,
1353
+ y: v
1354
+ });
1355
+ var oppositeSideMap = {
1356
+ left: "right",
1357
+ right: "left",
1358
+ bottom: "top",
1359
+ top: "bottom"
1360
+ };
1361
+ var oppositeAlignmentMap = {
1362
+ start: "end",
1363
+ end: "start"
1364
+ };
1365
+ function clamp(start, value, end) {
1366
+ return max(start, min(value, end));
1367
+ }
1368
+ function evaluate(value, param) {
1369
+ return typeof value === "function" ? value(param) : value;
1370
+ }
1371
+ function getSide(placement) {
1372
+ return placement.split("-")[0];
1373
+ }
1374
+ function getAlignment(placement) {
1375
+ return placement.split("-")[1];
1349
1376
  }
1350
- function e(t2) {
1351
- return t2.split("-")[1];
1377
+ function getOppositeAxis(axis) {
1378
+ return axis === "x" ? "y" : "x";
1352
1379
  }
1353
- function n(e2) {
1354
- return ["top", "bottom"].includes(t(e2)) ? "x" : "y";
1380
+ function getAxisLength(axis) {
1381
+ return axis === "y" ? "height" : "width";
1355
1382
  }
1356
- function r(t2) {
1357
- return "y" === t2 ? "height" : "width";
1383
+ function getSideAxis(placement) {
1384
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
1358
1385
  }
1359
- function i(i3, o3, a3) {
1360
- let { reference: l3, floating: s3 } = i3;
1361
- const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2, u3 = n(o3), m3 = r(u3), g3 = l3[m3] / 2 - s3[m3] / 2, d3 = "x" === u3;
1362
- let p3;
1363
- switch (t(o3)) {
1386
+ function getAlignmentAxis(placement) {
1387
+ return getOppositeAxis(getSideAxis(placement));
1388
+ }
1389
+ function getAlignmentSides(placement, rects, rtl) {
1390
+ if (rtl === void 0) {
1391
+ rtl = false;
1392
+ }
1393
+ const alignment = getAlignment(placement);
1394
+ const alignmentAxis = getAlignmentAxis(placement);
1395
+ const length = getAxisLength(alignmentAxis);
1396
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
1397
+ if (rects.reference[length] > rects.floating[length]) {
1398
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1399
+ }
1400
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
1401
+ }
1402
+ function getExpandedPlacements(placement) {
1403
+ const oppositePlacement = getOppositePlacement(placement);
1404
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1405
+ }
1406
+ function getOppositeAlignmentPlacement(placement) {
1407
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
1408
+ }
1409
+ function getSideList(side2, isStart, rtl) {
1410
+ const lr = ["left", "right"];
1411
+ const rl = ["right", "left"];
1412
+ const tb = ["top", "bottom"];
1413
+ const bt = ["bottom", "top"];
1414
+ switch (side2) {
1364
1415
  case "top":
1365
- p3 = { x: c3, y: l3.y - s3.height };
1416
+ case "bottom":
1417
+ if (rtl)
1418
+ return isStart ? rl : lr;
1419
+ return isStart ? lr : rl;
1420
+ case "left":
1421
+ case "right":
1422
+ return isStart ? tb : bt;
1423
+ default:
1424
+ return [];
1425
+ }
1426
+ }
1427
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
1428
+ const alignment = getAlignment(placement);
1429
+ let list = getSideList(getSide(placement), direction === "start", rtl);
1430
+ if (alignment) {
1431
+ list = list.map((side2) => side2 + "-" + alignment);
1432
+ if (flipAlignment) {
1433
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
1434
+ }
1435
+ }
1436
+ return list;
1437
+ }
1438
+ function getOppositePlacement(placement) {
1439
+ return placement.replace(/left|right|bottom|top/g, (side2) => oppositeSideMap[side2]);
1440
+ }
1441
+ function expandPaddingObject(padding) {
1442
+ return __spreadValues({
1443
+ top: 0,
1444
+ right: 0,
1445
+ bottom: 0,
1446
+ left: 0
1447
+ }, padding);
1448
+ }
1449
+ function getPaddingObject(padding) {
1450
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
1451
+ top: padding,
1452
+ right: padding,
1453
+ bottom: padding,
1454
+ left: padding
1455
+ };
1456
+ }
1457
+ function rectToClientRect(rect) {
1458
+ return __spreadProps(__spreadValues({}, rect), {
1459
+ top: rect.y,
1460
+ left: rect.x,
1461
+ right: rect.x + rect.width,
1462
+ bottom: rect.y + rect.height
1463
+ });
1464
+ }
1465
+
1466
+ // node_modules/.pnpm/@floating-ui+core@1.6.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
1467
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
1468
+ let {
1469
+ reference,
1470
+ floating
1471
+ } = _ref;
1472
+ const sideAxis = getSideAxis(placement);
1473
+ const alignmentAxis = getAlignmentAxis(placement);
1474
+ const alignLength = getAxisLength(alignmentAxis);
1475
+ const side2 = getSide(placement);
1476
+ const isVertical = sideAxis === "y";
1477
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
1478
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
1479
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
1480
+ let coords;
1481
+ switch (side2) {
1482
+ case "top":
1483
+ coords = {
1484
+ x: commonX,
1485
+ y: reference.y - floating.height
1486
+ };
1366
1487
  break;
1367
1488
  case "bottom":
1368
- p3 = { x: c3, y: l3.y + l3.height };
1489
+ coords = {
1490
+ x: commonX,
1491
+ y: reference.y + reference.height
1492
+ };
1369
1493
  break;
1370
1494
  case "right":
1371
- p3 = { x: l3.x + l3.width, y: f3 };
1495
+ coords = {
1496
+ x: reference.x + reference.width,
1497
+ y: commonY
1498
+ };
1372
1499
  break;
1373
1500
  case "left":
1374
- p3 = { x: l3.x - s3.width, y: f3 };
1501
+ coords = {
1502
+ x: reference.x - floating.width,
1503
+ y: commonY
1504
+ };
1375
1505
  break;
1376
1506
  default:
1377
- p3 = { x: l3.x, y: l3.y };
1507
+ coords = {
1508
+ x: reference.x,
1509
+ y: reference.y
1510
+ };
1378
1511
  }
1379
- switch (e(o3)) {
1512
+ switch (getAlignment(placement)) {
1380
1513
  case "start":
1381
- p3[u3] -= g3 * (a3 && d3 ? -1 : 1);
1514
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1382
1515
  break;
1383
1516
  case "end":
1384
- p3[u3] += g3 * (a3 && d3 ? -1 : 1);
1517
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1518
+ break;
1385
1519
  }
1386
- return p3;
1520
+ return coords;
1387
1521
  }
1388
- var o = async (t2, e2, n3) => {
1389
- const { placement: r3 = "bottom", strategy: o3 = "absolute", middleware: a3 = [], platform: l3 } = n3, s3 = await (null == l3.isRTL ? void 0 : l3.isRTL(e2));
1390
- let c3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: o3 }), { x: f3, y: u3 } = i(c3, r3, s3), m3 = r3, g3 = {}, d3 = 0;
1391
- for (let n4 = 0; n4 < a3.length; n4++) {
1392
- const { name: p3, fn: h3 } = a3[n4], { x: y3, y: x3, data: w3, reset: v3 } = await h3({ x: f3, y: u3, initialPlacement: r3, placement: m3, strategy: o3, middlewareData: g3, rects: c3, platform: l3, elements: { reference: t2, floating: e2 } });
1393
- f3 = null != y3 ? y3 : f3, u3 = null != x3 ? x3 : u3, g3 = __spreadProps(__spreadValues({}, g3), { [p3]: __spreadValues(__spreadValues({}, g3[p3]), w3) }), v3 && d3 <= 50 && (d3++, "object" == typeof v3 && (v3.placement && (m3 = v3.placement), v3.rects && (c3 = true === v3.rects ? await l3.getElementRects({ reference: t2, floating: e2, strategy: o3 }) : v3.rects), { x: f3, y: u3 } = i(c3, m3, s3)), n4 = -1);
1522
+ var computePosition = async (reference, floating, config) => {
1523
+ const {
1524
+ placement = "bottom",
1525
+ strategy = "absolute",
1526
+ middleware = [],
1527
+ platform: platform2
1528
+ } = config;
1529
+ const validMiddleware = middleware.filter(Boolean);
1530
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
1531
+ let rects = await platform2.getElementRects({
1532
+ reference,
1533
+ floating,
1534
+ strategy
1535
+ });
1536
+ let {
1537
+ x,
1538
+ y
1539
+ } = computeCoordsFromPlacement(rects, placement, rtl);
1540
+ let statefulPlacement = placement;
1541
+ let middlewareData = {};
1542
+ let resetCount = 0;
1543
+ for (let i = 0; i < validMiddleware.length; i++) {
1544
+ const {
1545
+ name,
1546
+ fn
1547
+ } = validMiddleware[i];
1548
+ const {
1549
+ x: nextX,
1550
+ y: nextY,
1551
+ data,
1552
+ reset
1553
+ } = await fn({
1554
+ x,
1555
+ y,
1556
+ initialPlacement: placement,
1557
+ placement: statefulPlacement,
1558
+ strategy,
1559
+ middlewareData,
1560
+ rects,
1561
+ platform: platform2,
1562
+ elements: {
1563
+ reference,
1564
+ floating
1565
+ }
1566
+ });
1567
+ x = nextX != null ? nextX : x;
1568
+ y = nextY != null ? nextY : y;
1569
+ middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
1570
+ [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
1571
+ });
1572
+ if (reset && resetCount <= 50) {
1573
+ resetCount++;
1574
+ if (typeof reset === "object") {
1575
+ if (reset.placement) {
1576
+ statefulPlacement = reset.placement;
1577
+ }
1578
+ if (reset.rects) {
1579
+ rects = reset.rects === true ? await platform2.getElementRects({
1580
+ reference,
1581
+ floating,
1582
+ strategy
1583
+ }) : reset.rects;
1584
+ }
1585
+ ({
1586
+ x,
1587
+ y
1588
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1589
+ }
1590
+ i = -1;
1591
+ }
1394
1592
  }
1395
- return { x: f3, y: u3, placement: m3, strategy: o3, middlewareData: g3 };
1593
+ return {
1594
+ x,
1595
+ y,
1596
+ placement: statefulPlacement,
1597
+ strategy,
1598
+ middlewareData
1599
+ };
1396
1600
  };
1397
- function a(t2) {
1398
- return "number" != typeof t2 ? function(t3) {
1399
- return __spreadValues({ top: 0, right: 0, bottom: 0, left: 0 }, t3);
1400
- }(t2) : { top: t2, right: t2, bottom: t2, left: t2 };
1401
- }
1402
- function l(t2) {
1403
- return __spreadProps(__spreadValues({}, t2), { top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height });
1404
- }
1405
- async function s(t2, e2) {
1406
- var n3;
1407
- void 0 === e2 && (e2 = {});
1408
- const { x: r3, y: i3, platform: o3, rects: s3, elements: c3, strategy: f3 } = t2, { boundary: u3 = "clippingAncestors", rootBoundary: m3 = "viewport", elementContext: g3 = "floating", altBoundary: d3 = false, padding: p3 = 0 } = e2, h3 = a(p3), y3 = c3[d3 ? "floating" === g3 ? "reference" : "floating" : g3], x3 = l(await o3.getClippingRect({ element: null == (n3 = await (null == o3.isElement ? void 0 : o3.isElement(y3))) || n3 ? y3 : y3.contextElement || await (null == o3.getDocumentElement ? void 0 : o3.getDocumentElement(c3.floating)), boundary: u3, rootBoundary: m3, strategy: f3 })), w3 = l(o3.convertOffsetParentRelativeRectToViewportRelativeRect ? await o3.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: "floating" === g3 ? __spreadProps(__spreadValues({}, s3.floating), { x: r3, y: i3 }) : s3.reference, offsetParent: await (null == o3.getOffsetParent ? void 0 : o3.getOffsetParent(c3.floating)), strategy: f3 }) : s3[g3]);
1409
- return { top: x3.top - w3.top + h3.top, bottom: w3.bottom - x3.bottom + h3.bottom, left: x3.left - w3.left + h3.left, right: w3.right - x3.right + h3.right };
1410
- }
1411
- var c = Math.min;
1412
- var f = Math.max;
1413
- function u(t2, e2, n3) {
1414
- return f(t2, c(e2, n3));
1415
- }
1416
- var m = (t2) => ({ name: "arrow", options: t2, async fn(i3) {
1417
- const { element: o3, padding: l3 = 0 } = null != t2 ? t2 : {}, { x: s3, y: c3, placement: f3, rects: m3, platform: g3 } = i3;
1418
- if (null == o3)
1419
- return {};
1420
- const d3 = a(l3), p3 = { x: s3, y: c3 }, h3 = n(f3), y3 = e(f3), x3 = r(h3), w3 = await g3.getDimensions(o3), v3 = "y" === h3 ? "top" : "left", b3 = "y" === h3 ? "bottom" : "right", R2 = m3.reference[x3] + m3.reference[h3] - p3[h3] - m3.floating[x3], A = p3[h3] - m3.reference[h3], P2 = await (null == g3.getOffsetParent ? void 0 : g3.getOffsetParent(o3));
1421
- let T3 = P2 ? "y" === h3 ? P2.clientHeight || 0 : P2.clientWidth || 0 : 0;
1422
- 0 === T3 && (T3 = m3.floating[x3]);
1423
- const O2 = R2 / 2 - A / 2, D3 = d3[v3], L3 = T3 - w3[x3] - d3[b3], k2 = T3 / 2 - w3[x3] / 2 + O2, E3 = u(D3, k2, L3), C2 = ("start" === y3 ? d3[v3] : d3[b3]) > 0 && k2 !== E3 && m3.reference[x3] <= m3.floating[x3];
1424
- return { [h3]: p3[h3] - (C2 ? k2 < D3 ? D3 - k2 : L3 - k2 : 0), data: { [h3]: E3, centerOffset: k2 - E3 } };
1425
- } });
1426
- var g = { left: "right", right: "left", bottom: "top", top: "bottom" };
1427
- function d(t2) {
1428
- return t2.replace(/left|right|bottom|top/g, (t3) => g[t3]);
1429
- }
1430
- function p(t2, i3, o3) {
1431
- void 0 === o3 && (o3 = false);
1432
- const a3 = e(t2), l3 = n(t2), s3 = r(l3);
1433
- let c3 = "x" === l3 ? a3 === (o3 ? "end" : "start") ? "right" : "left" : "start" === a3 ? "bottom" : "top";
1434
- return i3.reference[s3] > i3.floating[s3] && (c3 = d(c3)), { main: c3, cross: d(c3) };
1435
- }
1436
- var h = { start: "end", end: "start" };
1437
- function y(t2) {
1438
- return t2.replace(/start|end/g, (t3) => h[t3]);
1439
- }
1440
- var x = ["top", "right", "bottom", "left"];
1441
- var w = x.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
1442
- var b = function(e2) {
1443
- return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(n3) {
1444
- var r3;
1445
- const { placement: i3, middlewareData: o3, rects: a3, initialPlacement: l3, platform: c3, elements: f3 } = n3, _a = e2, { mainAxis: u3 = true, crossAxis: m3 = true, fallbackPlacements: g3, fallbackStrategy: h3 = "bestFit", flipAlignment: x3 = true } = _a, w3 = __objRest(_a, ["mainAxis", "crossAxis", "fallbackPlacements", "fallbackStrategy", "flipAlignment"]), v3 = t(i3), b3 = g3 || (v3 === l3 || !x3 ? [d(l3)] : function(t2) {
1446
- const e3 = d(t2);
1447
- return [y(t2), e3, y(e3)];
1448
- }(l3)), R2 = [l3, ...b3], A = await s(n3, w3), P2 = [];
1449
- let T3 = (null == (r3 = o3.flip) ? void 0 : r3.overflows) || [];
1450
- if (u3 && P2.push(A[v3]), m3) {
1451
- const { main: t2, cross: e3 } = p(i3, a3, await (null == c3.isRTL ? void 0 : c3.isRTL(f3.floating)));
1452
- P2.push(A[t2], A[e3]);
1601
+ async function detectOverflow(state, options) {
1602
+ var _await$platform$isEle;
1603
+ if (options === void 0) {
1604
+ options = {};
1605
+ }
1606
+ const {
1607
+ x,
1608
+ y,
1609
+ platform: platform2,
1610
+ rects,
1611
+ elements,
1612
+ strategy
1613
+ } = state;
1614
+ const {
1615
+ boundary = "clippingAncestors",
1616
+ rootBoundary = "viewport",
1617
+ elementContext = "floating",
1618
+ altBoundary = false,
1619
+ padding = 0
1620
+ } = evaluate(options, state);
1621
+ const paddingObject = getPaddingObject(padding);
1622
+ const altContext = elementContext === "floating" ? "reference" : "floating";
1623
+ const element = elements[altBoundary ? altContext : elementContext];
1624
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
1625
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
1626
+ boundary,
1627
+ rootBoundary,
1628
+ strategy
1629
+ }));
1630
+ const rect = elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
1631
+ x,
1632
+ y
1633
+ }) : rects.reference;
1634
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
1635
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
1636
+ x: 1,
1637
+ y: 1
1638
+ } : {
1639
+ x: 1,
1640
+ y: 1
1641
+ };
1642
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
1643
+ elements,
1644
+ rect,
1645
+ offsetParent,
1646
+ strategy
1647
+ }) : rect);
1648
+ return {
1649
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1650
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1651
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1652
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1653
+ };
1654
+ }
1655
+ var arrow = (options) => ({
1656
+ name: "arrow",
1657
+ options,
1658
+ async fn(state) {
1659
+ const {
1660
+ x,
1661
+ y,
1662
+ placement,
1663
+ rects,
1664
+ platform: platform2,
1665
+ elements,
1666
+ middlewareData
1667
+ } = state;
1668
+ const {
1669
+ element,
1670
+ padding = 0
1671
+ } = evaluate(options, state) || {};
1672
+ if (element == null) {
1673
+ return {};
1674
+ }
1675
+ const paddingObject = getPaddingObject(padding);
1676
+ const coords = {
1677
+ x,
1678
+ y
1679
+ };
1680
+ const axis = getAlignmentAxis(placement);
1681
+ const length = getAxisLength(axis);
1682
+ const arrowDimensions = await platform2.getDimensions(element);
1683
+ const isYAxis = axis === "y";
1684
+ const minProp = isYAxis ? "top" : "left";
1685
+ const maxProp = isYAxis ? "bottom" : "right";
1686
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
1687
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1688
+ const startDiff = coords[axis] - rects.reference[axis];
1689
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
1690
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1691
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
1692
+ clientSize = elements.floating[clientProp] || rects.floating[length];
1453
1693
  }
1454
- if (T3 = [...T3, { placement: i3, overflows: P2 }], !P2.every((t2) => t2 <= 0)) {
1455
- var O2, D3;
1456
- const t2 = (null != (O2 = null == (D3 = o3.flip) ? void 0 : D3.index) ? O2 : 0) + 1, e3 = R2[t2];
1457
- if (e3)
1458
- return { data: { index: t2, overflows: T3 }, reset: { placement: e3 } };
1459
- let n4 = "bottom";
1460
- switch (h3) {
1461
- case "bestFit": {
1462
- var L3;
1463
- const t3 = null == (L3 = T3.map((t4) => [t4, t4.overflows.filter((t5) => t5 > 0).reduce((t5, e4) => t5 + e4, 0)]).sort((t4, e4) => t4[1] - e4[1])[0]) ? void 0 : L3[0].placement;
1464
- t3 && (n4 = t3);
1465
- break;
1694
+ const centerToReference = endDiff / 2 - startDiff / 2;
1695
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1696
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1697
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1698
+ const min$1 = minPadding;
1699
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
1700
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1701
+ const offset2 = clamp(min$1, center, max2);
1702
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1703
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
1704
+ return {
1705
+ [axis]: coords[axis] + alignmentOffset,
1706
+ data: __spreadValues({
1707
+ [axis]: offset2,
1708
+ centerOffset: center - offset2 - alignmentOffset
1709
+ }, shouldAddOffset && {
1710
+ alignmentOffset
1711
+ }),
1712
+ reset: shouldAddOffset
1713
+ };
1714
+ }
1715
+ });
1716
+ var flip = function(options) {
1717
+ if (options === void 0) {
1718
+ options = {};
1719
+ }
1720
+ return {
1721
+ name: "flip",
1722
+ options,
1723
+ async fn(state) {
1724
+ var _middlewareData$arrow, _middlewareData$flip;
1725
+ const {
1726
+ placement,
1727
+ middlewareData,
1728
+ rects,
1729
+ initialPlacement,
1730
+ platform: platform2,
1731
+ elements
1732
+ } = state;
1733
+ const _a = evaluate(options, state), {
1734
+ mainAxis: checkMainAxis = true,
1735
+ crossAxis: checkCrossAxis = true,
1736
+ fallbackPlacements: specifiedFallbackPlacements,
1737
+ fallbackStrategy = "bestFit",
1738
+ fallbackAxisSideDirection = "none",
1739
+ flipAlignment = true
1740
+ } = _a, detectOverflowOptions = __objRest(_a, [
1741
+ "mainAxis",
1742
+ "crossAxis",
1743
+ "fallbackPlacements",
1744
+ "fallbackStrategy",
1745
+ "fallbackAxisSideDirection",
1746
+ "flipAlignment"
1747
+ ]);
1748
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1749
+ return {};
1750
+ }
1751
+ const side2 = getSide(placement);
1752
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1753
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1754
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1755
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
1756
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1757
+ }
1758
+ const placements2 = [initialPlacement, ...fallbackPlacements];
1759
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1760
+ const overflows = [];
1761
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1762
+ if (checkMainAxis) {
1763
+ overflows.push(overflow[side2]);
1764
+ }
1765
+ if (checkCrossAxis) {
1766
+ const sides2 = getAlignmentSides(placement, rects, rtl);
1767
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
1768
+ }
1769
+ overflowsData = [...overflowsData, {
1770
+ placement,
1771
+ overflows
1772
+ }];
1773
+ if (!overflows.every((side3) => side3 <= 0)) {
1774
+ var _middlewareData$flip2, _overflowsData$filter;
1775
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1776
+ const nextPlacement = placements2[nextIndex];
1777
+ if (nextPlacement) {
1778
+ return {
1779
+ data: {
1780
+ index: nextIndex,
1781
+ overflows: overflowsData
1782
+ },
1783
+ reset: {
1784
+ placement: nextPlacement
1785
+ }
1786
+ };
1787
+ }
1788
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1789
+ if (!resetPlacement) {
1790
+ switch (fallbackStrategy) {
1791
+ case "bestFit": {
1792
+ var _overflowsData$map$so;
1793
+ const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
1794
+ if (placement2) {
1795
+ resetPlacement = placement2;
1796
+ }
1797
+ break;
1798
+ }
1799
+ case "initialPlacement":
1800
+ resetPlacement = initialPlacement;
1801
+ break;
1802
+ }
1803
+ }
1804
+ if (placement !== resetPlacement) {
1805
+ return {
1806
+ reset: {
1807
+ placement: resetPlacement
1808
+ }
1809
+ };
1466
1810
  }
1467
- case "initialPlacement":
1468
- n4 = l3;
1469
1811
  }
1470
- if (i3 !== n4)
1471
- return { reset: { placement: n4 } };
1812
+ return {};
1472
1813
  }
1473
- return {};
1474
- } };
1475
- };
1476
- var T = function(r3) {
1477
- return void 0 === r3 && (r3 = 0), { name: "offset", options: r3, async fn(i3) {
1478
- const { x: o3, y: a3 } = i3, l3 = await async function(r4, i4) {
1479
- const { placement: o4, platform: a4, elements: l4 } = r4, s3 = await (null == a4.isRTL ? void 0 : a4.isRTL(l4.floating)), c3 = t(o4), f3 = e(o4), u3 = "x" === n(o4), m3 = ["left", "top"].includes(c3) ? -1 : 1, g3 = s3 && u3 ? -1 : 1, d3 = "function" == typeof i4 ? i4(r4) : i4;
1480
- let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : __spreadValues({ mainAxis: 0, crossAxis: 0, alignmentAxis: null }, d3);
1481
- return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), u3 ? { x: h3 * g3, y: p3 * m3 } : { x: p3 * m3, y: h3 * g3 };
1482
- }(i3, r3);
1483
- return { x: o3 + l3.x, y: a3 + l3.y, data: l3 };
1484
- } };
1814
+ };
1485
1815
  };
1486
- function O(t2) {
1487
- return "x" === t2 ? "y" : "x";
1488
- }
1489
- var D = function(e2) {
1490
- return void 0 === e2 && (e2 = {}), { name: "shift", options: e2, async fn(r3) {
1491
- const { x: i3, y: o3, placement: a3 } = r3, _a = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t2) => {
1492
- let { x: e3, y: n3 } = t2;
1493
- return { x: e3, y: n3 };
1494
- } } } = _a, m3 = __objRest(_a, ["mainAxis", "crossAxis", "limiter"]), g3 = { x: i3, y: o3 }, d3 = await s(r3, m3), p3 = n(t(a3)), h3 = O(p3);
1495
- let y3 = g3[p3], x3 = g3[h3];
1496
- if (l3) {
1497
- const t2 = "y" === p3 ? "bottom" : "right";
1498
- y3 = u(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t2]);
1816
+ function getSideOffsets(overflow, rect) {
1817
+ return {
1818
+ top: overflow.top - rect.height,
1819
+ right: overflow.right - rect.width,
1820
+ bottom: overflow.bottom - rect.height,
1821
+ left: overflow.left - rect.width
1822
+ };
1823
+ }
1824
+ function isAnySideFullyClipped(overflow) {
1825
+ return sides.some((side2) => overflow[side2] >= 0);
1826
+ }
1827
+ var hide = function(options) {
1828
+ if (options === void 0) {
1829
+ options = {};
1830
+ }
1831
+ return {
1832
+ name: "hide",
1833
+ options,
1834
+ async fn(state) {
1835
+ const {
1836
+ rects
1837
+ } = state;
1838
+ const _a = evaluate(options, state), {
1839
+ strategy = "referenceHidden"
1840
+ } = _a, detectOverflowOptions = __objRest(_a, [
1841
+ "strategy"
1842
+ ]);
1843
+ switch (strategy) {
1844
+ case "referenceHidden": {
1845
+ const overflow = await detectOverflow(state, __spreadProps(__spreadValues({}, detectOverflowOptions), {
1846
+ elementContext: "reference"
1847
+ }));
1848
+ const offsets = getSideOffsets(overflow, rects.reference);
1849
+ return {
1850
+ data: {
1851
+ referenceHiddenOffsets: offsets,
1852
+ referenceHidden: isAnySideFullyClipped(offsets)
1853
+ }
1854
+ };
1855
+ }
1856
+ case "escaped": {
1857
+ const overflow = await detectOverflow(state, __spreadProps(__spreadValues({}, detectOverflowOptions), {
1858
+ altBoundary: true
1859
+ }));
1860
+ const offsets = getSideOffsets(overflow, rects.floating);
1861
+ return {
1862
+ data: {
1863
+ escapedOffsets: offsets,
1864
+ escaped: isAnySideFullyClipped(offsets)
1865
+ }
1866
+ };
1867
+ }
1868
+ default: {
1869
+ return {};
1870
+ }
1871
+ }
1499
1872
  }
1500
- if (c3) {
1501
- const t2 = "y" === h3 ? "bottom" : "right";
1502
- x3 = u(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t2]);
1873
+ };
1874
+ };
1875
+ async function convertValueToCoords(state, options) {
1876
+ const {
1877
+ placement,
1878
+ platform: platform2,
1879
+ elements
1880
+ } = state;
1881
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1882
+ const side2 = getSide(placement);
1883
+ const alignment = getAlignment(placement);
1884
+ const isVertical = getSideAxis(placement) === "y";
1885
+ const mainAxisMulti = ["left", "top"].includes(side2) ? -1 : 1;
1886
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1887
+ const rawValue = evaluate(options, state);
1888
+ let {
1889
+ mainAxis,
1890
+ crossAxis,
1891
+ alignmentAxis
1892
+ } = typeof rawValue === "number" ? {
1893
+ mainAxis: rawValue,
1894
+ crossAxis: 0,
1895
+ alignmentAxis: null
1896
+ } : __spreadValues({
1897
+ mainAxis: 0,
1898
+ crossAxis: 0,
1899
+ alignmentAxis: null
1900
+ }, rawValue);
1901
+ if (alignment && typeof alignmentAxis === "number") {
1902
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1903
+ }
1904
+ return isVertical ? {
1905
+ x: crossAxis * crossAxisMulti,
1906
+ y: mainAxis * mainAxisMulti
1907
+ } : {
1908
+ x: mainAxis * mainAxisMulti,
1909
+ y: crossAxis * crossAxisMulti
1910
+ };
1911
+ }
1912
+ var offset = function(options) {
1913
+ if (options === void 0) {
1914
+ options = 0;
1915
+ }
1916
+ return {
1917
+ name: "offset",
1918
+ options,
1919
+ async fn(state) {
1920
+ var _middlewareData$offse, _middlewareData$arrow;
1921
+ const {
1922
+ x,
1923
+ y,
1924
+ placement,
1925
+ middlewareData
1926
+ } = state;
1927
+ const diffCoords = await convertValueToCoords(state, options);
1928
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1929
+ return {};
1930
+ }
1931
+ return {
1932
+ x: x + diffCoords.x,
1933
+ y: y + diffCoords.y,
1934
+ data: __spreadProps(__spreadValues({}, diffCoords), {
1935
+ placement
1936
+ })
1937
+ };
1503
1938
  }
1504
- const w3 = f3.fn(__spreadProps(__spreadValues({}, r3), { [p3]: y3, [h3]: x3 }));
1505
- return __spreadProps(__spreadValues({}, w3), { data: { x: w3.x - i3, y: w3.y - o3 } });
1506
- } };
1939
+ };
1507
1940
  };
1508
1941
 
1509
- // node_modules/.pnpm/@floating-ui+dom@0.5.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
1510
- function n2(t2) {
1511
- return t2 && t2.document && t2.location && t2.alert && t2.setInterval;
1942
+ // node_modules/.pnpm/@floating-ui+utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1943
+ function getNodeName(node) {
1944
+ if (isNode(node)) {
1945
+ return (node.nodeName || "").toLowerCase();
1946
+ }
1947
+ return "#document";
1948
+ }
1949
+ function getWindow(node) {
1950
+ var _node$ownerDocument;
1951
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1952
+ }
1953
+ function getDocumentElement(node) {
1954
+ var _ref;
1955
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1956
+ }
1957
+ function isNode(value) {
1958
+ return value instanceof Node || value instanceof getWindow(value).Node;
1959
+ }
1960
+ function isElement(value) {
1961
+ return value instanceof Element || value instanceof getWindow(value).Element;
1962
+ }
1963
+ function isHTMLElement(value) {
1964
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1965
+ }
1966
+ function isShadowRoot(value) {
1967
+ if (typeof ShadowRoot === "undefined") {
1968
+ return false;
1969
+ }
1970
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1971
+ }
1972
+ function isOverflowElement(element) {
1973
+ const {
1974
+ overflow,
1975
+ overflowX,
1976
+ overflowY,
1977
+ display
1978
+ } = getComputedStyle(element);
1979
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
1512
1980
  }
1513
- function o2(t2) {
1514
- if (null == t2)
1515
- return window;
1516
- if (!n2(t2)) {
1517
- const e2 = t2.ownerDocument;
1518
- return e2 && e2.defaultView || window;
1981
+ function isTableElement(element) {
1982
+ return ["table", "td", "th"].includes(getNodeName(element));
1983
+ }
1984
+ function isContainingBlock(element) {
1985
+ const webkit = isWebKit();
1986
+ const css2 = getComputedStyle(element);
1987
+ return css2.transform !== "none" || css2.perspective !== "none" || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit && (css2.filter ? css2.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
1988
+ }
1989
+ function getContainingBlock(element) {
1990
+ let currentNode = getParentNode(element);
1991
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1992
+ if (isContainingBlock(currentNode)) {
1993
+ return currentNode;
1994
+ } else {
1995
+ currentNode = getParentNode(currentNode);
1996
+ }
1519
1997
  }
1520
- return t2;
1998
+ return null;
1999
+ }
2000
+ function isWebKit() {
2001
+ if (typeof CSS === "undefined" || !CSS.supports)
2002
+ return false;
2003
+ return CSS.supports("-webkit-backdrop-filter", "none");
1521
2004
  }
1522
- function i2(t2) {
1523
- return o2(t2).getComputedStyle(t2);
2005
+ function isLastTraversableNode(node) {
2006
+ return ["html", "body", "#document"].includes(getNodeName(node));
2007
+ }
2008
+ function getComputedStyle(element) {
2009
+ return getWindow(element).getComputedStyle(element);
2010
+ }
2011
+ function getNodeScroll(element) {
2012
+ if (isElement(element)) {
2013
+ return {
2014
+ scrollLeft: element.scrollLeft,
2015
+ scrollTop: element.scrollTop
2016
+ };
2017
+ }
2018
+ return {
2019
+ scrollLeft: element.pageXOffset,
2020
+ scrollTop: element.pageYOffset
2021
+ };
2022
+ }
2023
+ function getParentNode(node) {
2024
+ if (getNodeName(node) === "html") {
2025
+ return node;
2026
+ }
2027
+ const result = (
2028
+ // Step into the shadow DOM of the parent of a slotted node.
2029
+ node.assignedSlot || // DOM Element detected.
2030
+ node.parentNode || // ShadowRoot detected.
2031
+ isShadowRoot(node) && node.host || // Fallback.
2032
+ getDocumentElement(node)
2033
+ );
2034
+ return isShadowRoot(result) ? result.host : result;
2035
+ }
2036
+ function getNearestOverflowAncestor(node) {
2037
+ const parentNode = getParentNode(node);
2038
+ if (isLastTraversableNode(parentNode)) {
2039
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
2040
+ }
2041
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2042
+ return parentNode;
2043
+ }
2044
+ return getNearestOverflowAncestor(parentNode);
2045
+ }
2046
+ function getOverflowAncestors(node, list, traverseIframes) {
2047
+ var _node$ownerDocument2;
2048
+ if (list === void 0) {
2049
+ list = [];
2050
+ }
2051
+ if (traverseIframes === void 0) {
2052
+ traverseIframes = true;
2053
+ }
2054
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2055
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2056
+ const win = getWindow(scrollableAncestor);
2057
+ if (isBody) {
2058
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
2059
+ }
2060
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1524
2061
  }
1525
- function r2(t2) {
1526
- return n2(t2) ? "" : t2 ? (t2.nodeName || "").toLowerCase() : "";
2062
+
2063
+ // node_modules/.pnpm/@floating-ui+dom@1.6.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
2064
+ function getCssDimensions(element) {
2065
+ const css2 = getComputedStyle(element);
2066
+ let width = parseFloat(css2.width) || 0;
2067
+ let height = parseFloat(css2.height) || 0;
2068
+ const hasOffset = isHTMLElement(element);
2069
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2070
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2071
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2072
+ if (shouldFallback) {
2073
+ width = offsetWidth;
2074
+ height = offsetHeight;
2075
+ }
2076
+ return {
2077
+ width,
2078
+ height,
2079
+ $: shouldFallback
2080
+ };
1527
2081
  }
1528
- function l2() {
1529
- const t2 = navigator.userAgentData;
1530
- return null != t2 && t2.brands ? t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" ") : navigator.userAgent;
2082
+ function unwrapElement(element) {
2083
+ return !isElement(element) ? element.contextElement : element;
1531
2084
  }
1532
- function c2(t2) {
1533
- return t2 instanceof o2(t2).HTMLElement;
2085
+ function getScale(element) {
2086
+ const domElement = unwrapElement(element);
2087
+ if (!isHTMLElement(domElement)) {
2088
+ return createCoords(1);
2089
+ }
2090
+ const rect = domElement.getBoundingClientRect();
2091
+ const {
2092
+ width,
2093
+ height,
2094
+ $
2095
+ } = getCssDimensions(domElement);
2096
+ let x = ($ ? round(rect.width) : rect.width) / width;
2097
+ let y = ($ ? round(rect.height) : rect.height) / height;
2098
+ if (!x || !Number.isFinite(x)) {
2099
+ x = 1;
2100
+ }
2101
+ if (!y || !Number.isFinite(y)) {
2102
+ y = 1;
2103
+ }
2104
+ return {
2105
+ x,
2106
+ y
2107
+ };
1534
2108
  }
1535
- function f2(t2) {
1536
- return t2 instanceof o2(t2).Element;
2109
+ var noOffsets = /* @__PURE__ */ createCoords(0);
2110
+ function getVisualOffsets(element) {
2111
+ const win = getWindow(element);
2112
+ if (!isWebKit() || !win.visualViewport) {
2113
+ return noOffsets;
2114
+ }
2115
+ return {
2116
+ x: win.visualViewport.offsetLeft,
2117
+ y: win.visualViewport.offsetTop
2118
+ };
1537
2119
  }
1538
- function s2(t2) {
1539
- if ("undefined" == typeof ShadowRoot)
2120
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2121
+ if (isFixed === void 0) {
2122
+ isFixed = false;
2123
+ }
2124
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1540
2125
  return false;
1541
- return t2 instanceof o2(t2).ShadowRoot || t2 instanceof ShadowRoot;
1542
- }
1543
- function u2(t2) {
1544
- const { overflow: e2, overflowX: n3, overflowY: o3 } = i2(t2);
1545
- return /auto|scroll|overlay|hidden/.test(e2 + o3 + n3);
1546
- }
1547
- function d2(t2) {
1548
- return ["table", "td", "th"].includes(r2(t2));
1549
- }
1550
- function h2(t2) {
1551
- const e2 = /firefox/i.test(l2()), n3 = i2(t2);
1552
- return "none" !== n3.transform || "none" !== n3.perspective || "paint" === n3.contain || ["transform", "perspective"].includes(n3.willChange) || e2 && "filter" === n3.willChange || e2 && !!n3.filter && "none" !== n3.filter;
1553
- }
1554
- function a2() {
1555
- return !/^((?!chrome|android).)*safari/i.test(l2());
1556
- }
1557
- var g2 = Math.min;
1558
- var p2 = Math.max;
1559
- var m2 = Math.round;
1560
- function w2(t2, e2, n3) {
1561
- var i3, r3, l3, s3;
1562
- void 0 === e2 && (e2 = false), void 0 === n3 && (n3 = false);
1563
- const u3 = t2.getBoundingClientRect();
1564
- let d3 = 1, h3 = 1;
1565
- e2 && c2(t2) && (d3 = t2.offsetWidth > 0 && m2(u3.width) / t2.offsetWidth || 1, h3 = t2.offsetHeight > 0 && m2(u3.height) / t2.offsetHeight || 1);
1566
- const g3 = f2(t2) ? o2(t2) : window, p3 = !a2() && n3, w3 = (u3.left + (p3 && null != (i3 = null == (r3 = g3.visualViewport) ? void 0 : r3.offsetLeft) ? i3 : 0)) / d3, v3 = (u3.top + (p3 && null != (l3 = null == (s3 = g3.visualViewport) ? void 0 : s3.offsetTop) ? l3 : 0)) / h3, y3 = u3.width / d3, x3 = u3.height / h3;
1567
- return { width: y3, height: x3, top: v3, right: w3 + y3, bottom: v3 + x3, left: w3, x: w3, y: v3 };
1568
- }
1569
- function v2(t2) {
1570
- return (e2 = t2, (e2 instanceof o2(e2).Node ? t2.ownerDocument : t2.document) || window.document).documentElement;
1571
- var e2;
1572
- }
1573
- function y2(t2) {
1574
- return f2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
1575
- }
1576
- function x2(t2) {
1577
- return w2(v2(t2)).left + y2(t2).scrollLeft;
1578
- }
1579
- function b2(t2, e2, n3) {
1580
- const o3 = c2(e2), i3 = v2(e2), l3 = w2(t2, o3 && function(t3) {
1581
- const e3 = w2(t3);
1582
- return m2(e3.width) !== t3.offsetWidth || m2(e3.height) !== t3.offsetHeight;
1583
- }(e2), "fixed" === n3);
1584
- let f3 = { scrollLeft: 0, scrollTop: 0 };
1585
- const s3 = { x: 0, y: 0 };
1586
- if (o3 || !o3 && "fixed" !== n3)
1587
- if (("body" !== r2(e2) || u2(i3)) && (f3 = y2(e2)), c2(e2)) {
1588
- const t3 = w2(e2, true);
1589
- s3.x = t3.x + e2.clientLeft, s3.y = t3.y + e2.clientTop;
1590
- } else
1591
- i3 && (s3.x = x2(i3));
1592
- return { x: l3.left + f3.scrollLeft - s3.x, y: l3.top + f3.scrollTop - s3.y, width: l3.width, height: l3.height };
1593
- }
1594
- function L2(t2) {
1595
- return "html" === r2(t2) ? t2 : t2.assignedSlot || t2.parentNode || (s2(t2) ? t2.host : null) || v2(t2);
1596
- }
1597
- function R(t2) {
1598
- return c2(t2) && "fixed" !== getComputedStyle(t2).position ? t2.offsetParent : null;
1599
- }
1600
- function T2(t2) {
1601
- const e2 = o2(t2);
1602
- let n3 = R(t2);
1603
- for (; n3 && d2(n3) && "static" === getComputedStyle(n3).position; )
1604
- n3 = R(n3);
1605
- return n3 && ("html" === r2(n3) || "body" === r2(n3) && "static" === getComputedStyle(n3).position && !h2(n3)) ? e2 : n3 || function(t3) {
1606
- let e3 = L2(t3);
1607
- for (s2(e3) && (e3 = e3.host); c2(e3) && !["html", "body"].includes(r2(e3)); ) {
1608
- if (h2(e3))
1609
- return e3;
1610
- e3 = e3.parentNode;
2126
+ }
2127
+ return isFixed;
2128
+ }
2129
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2130
+ if (includeScale === void 0) {
2131
+ includeScale = false;
2132
+ }
2133
+ if (isFixedStrategy === void 0) {
2134
+ isFixedStrategy = false;
2135
+ }
2136
+ const clientRect = element.getBoundingClientRect();
2137
+ const domElement = unwrapElement(element);
2138
+ let scale = createCoords(1);
2139
+ if (includeScale) {
2140
+ if (offsetParent) {
2141
+ if (isElement(offsetParent)) {
2142
+ scale = getScale(offsetParent);
2143
+ }
2144
+ } else {
2145
+ scale = getScale(element);
1611
2146
  }
1612
- return null;
1613
- }(t2) || e2;
1614
- }
1615
- function W(t2) {
1616
- if (c2(t2))
1617
- return { width: t2.offsetWidth, height: t2.offsetHeight };
1618
- const e2 = w2(t2);
1619
- return { width: e2.width, height: e2.height };
1620
- }
1621
- function E2(t2) {
1622
- const e2 = L2(t2);
1623
- return ["html", "body", "#document"].includes(r2(e2)) ? t2.ownerDocument.body : c2(e2) && u2(e2) ? e2 : E2(e2);
1624
- }
1625
- function H(t2, e2) {
1626
- var n3;
1627
- void 0 === e2 && (e2 = []);
1628
- const i3 = E2(t2), r3 = i3 === (null == (n3 = t2.ownerDocument) ? void 0 : n3.body), l3 = o2(i3), c3 = r3 ? [l3].concat(l3.visualViewport || [], u2(i3) ? i3 : []) : i3, f3 = e2.concat(c3);
1629
- return r3 ? f3 : f3.concat(H(c3));
1630
- }
1631
- function C(e2, n3, r3) {
1632
- return "viewport" === n3 ? l(function(t2, e3) {
1633
- const n4 = o2(t2), i3 = v2(t2), r4 = n4.visualViewport;
1634
- let l3 = i3.clientWidth, c3 = i3.clientHeight, f3 = 0, s3 = 0;
1635
- if (r4) {
1636
- l3 = r4.width, c3 = r4.height;
1637
- const t3 = a2();
1638
- (t3 || !t3 && "fixed" === e3) && (f3 = r4.offsetLeft, s3 = r4.offsetTop);
2147
+ }
2148
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2149
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2150
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2151
+ let width = clientRect.width / scale.x;
2152
+ let height = clientRect.height / scale.y;
2153
+ if (domElement) {
2154
+ const win = getWindow(domElement);
2155
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2156
+ let currentWin = win;
2157
+ let currentIFrame = currentWin.frameElement;
2158
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2159
+ const iframeScale = getScale(currentIFrame);
2160
+ const iframeRect = currentIFrame.getBoundingClientRect();
2161
+ const css2 = getComputedStyle(currentIFrame);
2162
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x;
2163
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
2164
+ x *= iframeScale.x;
2165
+ y *= iframeScale.y;
2166
+ width *= iframeScale.x;
2167
+ height *= iframeScale.y;
2168
+ x += left;
2169
+ y += top;
2170
+ currentWin = getWindow(currentIFrame);
2171
+ currentIFrame = currentWin.frameElement;
2172
+ }
2173
+ }
2174
+ return rectToClientRect({
2175
+ width,
2176
+ height,
2177
+ x,
2178
+ y
2179
+ });
2180
+ }
2181
+ var topLayerSelectors = [":popover-open", ":modal"];
2182
+ function isTopLayer(floating) {
2183
+ return topLayerSelectors.some((selector) => {
2184
+ try {
2185
+ return floating.matches(selector);
2186
+ } catch (e) {
2187
+ return false;
2188
+ }
2189
+ });
2190
+ }
2191
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2192
+ let {
2193
+ elements,
2194
+ rect,
2195
+ offsetParent,
2196
+ strategy
2197
+ } = _ref;
2198
+ const isFixed = strategy === "fixed";
2199
+ const documentElement = getDocumentElement(offsetParent);
2200
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2201
+ if (offsetParent === documentElement || topLayer && isFixed) {
2202
+ return rect;
2203
+ }
2204
+ let scroll = {
2205
+ scrollLeft: 0,
2206
+ scrollTop: 0
2207
+ };
2208
+ let scale = createCoords(1);
2209
+ const offsets = createCoords(0);
2210
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2211
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2212
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
2213
+ scroll = getNodeScroll(offsetParent);
1639
2214
  }
1640
- return { width: l3, height: c3, x: f3, y: s3 };
1641
- }(e2, r3)) : f2(n3) ? function(t2, e3) {
1642
- const n4 = w2(t2, false, "fixed" === e3), o3 = n4.top + t2.clientTop, i3 = n4.left + t2.clientLeft;
1643
- return { top: o3, left: i3, x: i3, y: o3, right: i3 + t2.clientWidth, bottom: o3 + t2.clientHeight, width: t2.clientWidth, height: t2.clientHeight };
1644
- }(n3, r3) : l(function(t2) {
1645
- var e3;
1646
- const n4 = v2(t2), o3 = y2(t2), r4 = null == (e3 = t2.ownerDocument) ? void 0 : e3.body, l3 = p2(n4.scrollWidth, n4.clientWidth, r4 ? r4.scrollWidth : 0, r4 ? r4.clientWidth : 0), c3 = p2(n4.scrollHeight, n4.clientHeight, r4 ? r4.scrollHeight : 0, r4 ? r4.clientHeight : 0);
1647
- let f3 = -o3.scrollLeft + x2(t2);
1648
- const s3 = -o3.scrollTop;
1649
- return "rtl" === i2(r4 || n4).direction && (f3 += p2(n4.clientWidth, r4 ? r4.clientWidth : 0) - l3), { width: l3, height: c3, x: f3, y: s3 };
1650
- }(v2(e2)));
1651
- }
1652
- function S(t2) {
1653
- const e2 = H(t2), n3 = ["absolute", "fixed"].includes(i2(t2).position) && c2(t2) ? T2(t2) : t2;
1654
- return f2(n3) ? e2.filter((t3) => f2(t3) && function(t4, e3) {
1655
- const n4 = null == e3.getRootNode ? void 0 : e3.getRootNode();
1656
- if (t4.contains(e3))
1657
- return true;
1658
- if (n4 && s2(n4)) {
1659
- let n5 = e3;
1660
- do {
1661
- if (n5 && t4 === n5)
1662
- return true;
1663
- n5 = n5.parentNode || n5.host;
1664
- } while (n5);
2215
+ if (isHTMLElement(offsetParent)) {
2216
+ const offsetRect = getBoundingClientRect(offsetParent);
2217
+ scale = getScale(offsetParent);
2218
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2219
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1665
2220
  }
2221
+ }
2222
+ return {
2223
+ width: rect.width * scale.x,
2224
+ height: rect.height * scale.y,
2225
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2226
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2227
+ };
2228
+ }
2229
+ function getClientRects(element) {
2230
+ return Array.from(element.getClientRects());
2231
+ }
2232
+ function getWindowScrollBarX(element) {
2233
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2234
+ }
2235
+ function getDocumentRect(element) {
2236
+ const html3 = getDocumentElement(element);
2237
+ const scroll = getNodeScroll(element);
2238
+ const body = element.ownerDocument.body;
2239
+ const width = max(html3.scrollWidth, html3.clientWidth, body.scrollWidth, body.clientWidth);
2240
+ const height = max(html3.scrollHeight, html3.clientHeight, body.scrollHeight, body.clientHeight);
2241
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2242
+ const y = -scroll.scrollTop;
2243
+ if (getComputedStyle(body).direction === "rtl") {
2244
+ x += max(html3.clientWidth, body.clientWidth) - width;
2245
+ }
2246
+ return {
2247
+ width,
2248
+ height,
2249
+ x,
2250
+ y
2251
+ };
2252
+ }
2253
+ function getViewportRect(element, strategy) {
2254
+ const win = getWindow(element);
2255
+ const html3 = getDocumentElement(element);
2256
+ const visualViewport = win.visualViewport;
2257
+ let width = html3.clientWidth;
2258
+ let height = html3.clientHeight;
2259
+ let x = 0;
2260
+ let y = 0;
2261
+ if (visualViewport) {
2262
+ width = visualViewport.width;
2263
+ height = visualViewport.height;
2264
+ const visualViewportBased = isWebKit();
2265
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
2266
+ x = visualViewport.offsetLeft;
2267
+ y = visualViewport.offsetTop;
2268
+ }
2269
+ }
2270
+ return {
2271
+ width,
2272
+ height,
2273
+ x,
2274
+ y
2275
+ };
2276
+ }
2277
+ function getInnerBoundingClientRect(element, strategy) {
2278
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
2279
+ const top = clientRect.top + element.clientTop;
2280
+ const left = clientRect.left + element.clientLeft;
2281
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2282
+ const width = element.clientWidth * scale.x;
2283
+ const height = element.clientHeight * scale.y;
2284
+ const x = left * scale.x;
2285
+ const y = top * scale.y;
2286
+ return {
2287
+ width,
2288
+ height,
2289
+ x,
2290
+ y
2291
+ };
2292
+ }
2293
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2294
+ let rect;
2295
+ if (clippingAncestor === "viewport") {
2296
+ rect = getViewportRect(element, strategy);
2297
+ } else if (clippingAncestor === "document") {
2298
+ rect = getDocumentRect(getDocumentElement(element));
2299
+ } else if (isElement(clippingAncestor)) {
2300
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2301
+ } else {
2302
+ const visualOffsets = getVisualOffsets(element);
2303
+ rect = __spreadProps(__spreadValues({}, clippingAncestor), {
2304
+ x: clippingAncestor.x - visualOffsets.x,
2305
+ y: clippingAncestor.y - visualOffsets.y
2306
+ });
2307
+ }
2308
+ return rectToClientRect(rect);
2309
+ }
2310
+ function hasFixedPositionAncestor(element, stopNode) {
2311
+ const parentNode = getParentNode(element);
2312
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1666
2313
  return false;
1667
- }(t3, n3) && "body" !== r2(t3)) : [];
1668
- }
1669
- var D2 = { getClippingRect: function(t2) {
1670
- let { element: e2, boundary: n3, rootBoundary: o3, strategy: i3 } = t2;
1671
- const r3 = [..."clippingAncestors" === n3 ? S(e2) : [].concat(n3), o3], l3 = r3[0], c3 = r3.reduce((t3, n4) => {
1672
- const o4 = C(e2, n4, i3);
1673
- return t3.top = p2(o4.top, t3.top), t3.right = g2(o4.right, t3.right), t3.bottom = g2(o4.bottom, t3.bottom), t3.left = p2(o4.left, t3.left), t3;
1674
- }, C(e2, l3, i3));
1675
- return { width: c3.right - c3.left, height: c3.bottom - c3.top, x: c3.left, y: c3.top };
1676
- }, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) {
1677
- let { rect: e2, offsetParent: n3, strategy: o3 } = t2;
1678
- const i3 = c2(n3), l3 = v2(n3);
1679
- if (n3 === l3)
1680
- return e2;
1681
- let f3 = { scrollLeft: 0, scrollTop: 0 };
1682
- const s3 = { x: 0, y: 0 };
1683
- if ((i3 || !i3 && "fixed" !== o3) && (("body" !== r2(n3) || u2(l3)) && (f3 = y2(n3)), c2(n3))) {
1684
- const t3 = w2(n3, true);
1685
- s3.x = t3.x + n3.clientLeft, s3.y = t3.y + n3.clientTop;
1686
- }
1687
- return __spreadProps(__spreadValues({}, e2), { x: e2.x - f3.scrollLeft + s3.x, y: e2.y - f3.scrollTop + s3.y });
1688
- }, isElement: f2, getDimensions: W, getOffsetParent: T2, getDocumentElement: v2, getElementRects: (t2) => {
1689
- let { reference: e2, floating: n3, strategy: o3 } = t2;
1690
- return { reference: b2(e2, T2(n3), o3), floating: __spreadProps(__spreadValues({}, W(n3)), { x: 0, y: 0 }) };
1691
- }, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === i2(t2).direction };
1692
- var z = (t2, n3, o3) => o(t2, n3, __spreadValues({ platform: D2 }, o3));
2314
+ }
2315
+ return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
2316
+ }
2317
+ function getClippingElementAncestors(element, cache2) {
2318
+ const cachedResult = cache2.get(element);
2319
+ if (cachedResult) {
2320
+ return cachedResult;
2321
+ }
2322
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
2323
+ let currentContainingBlockComputedStyle = null;
2324
+ const elementIsFixed = getComputedStyle(element).position === "fixed";
2325
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
2326
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2327
+ const computedStyle = getComputedStyle(currentNode);
2328
+ const currentNodeIsContaining = isContainingBlock(currentNode);
2329
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
2330
+ currentContainingBlockComputedStyle = null;
2331
+ }
2332
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2333
+ if (shouldDropCurrentNode) {
2334
+ result = result.filter((ancestor) => ancestor !== currentNode);
2335
+ } else {
2336
+ currentContainingBlockComputedStyle = computedStyle;
2337
+ }
2338
+ currentNode = getParentNode(currentNode);
2339
+ }
2340
+ cache2.set(element, result);
2341
+ return result;
2342
+ }
2343
+ function getClippingRect(_ref) {
2344
+ let {
2345
+ element,
2346
+ boundary,
2347
+ rootBoundary,
2348
+ strategy
2349
+ } = _ref;
2350
+ const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
2351
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2352
+ const firstClippingAncestor = clippingAncestors[0];
2353
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2354
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2355
+ accRect.top = max(rect.top, accRect.top);
2356
+ accRect.right = min(rect.right, accRect.right);
2357
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2358
+ accRect.left = max(rect.left, accRect.left);
2359
+ return accRect;
2360
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2361
+ return {
2362
+ width: clippingRect.right - clippingRect.left,
2363
+ height: clippingRect.bottom - clippingRect.top,
2364
+ x: clippingRect.left,
2365
+ y: clippingRect.top
2366
+ };
2367
+ }
2368
+ function getDimensions(element) {
2369
+ const {
2370
+ width,
2371
+ height
2372
+ } = getCssDimensions(element);
2373
+ return {
2374
+ width,
2375
+ height
2376
+ };
2377
+ }
2378
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2379
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2380
+ const documentElement = getDocumentElement(offsetParent);
2381
+ const isFixed = strategy === "fixed";
2382
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2383
+ let scroll = {
2384
+ scrollLeft: 0,
2385
+ scrollTop: 0
2386
+ };
2387
+ const offsets = createCoords(0);
2388
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2389
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
2390
+ scroll = getNodeScroll(offsetParent);
2391
+ }
2392
+ if (isOffsetParentAnElement) {
2393
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2394
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2395
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2396
+ } else if (documentElement) {
2397
+ offsets.x = getWindowScrollBarX(documentElement);
2398
+ }
2399
+ }
2400
+ const x = rect.left + scroll.scrollLeft - offsets.x;
2401
+ const y = rect.top + scroll.scrollTop - offsets.y;
2402
+ return {
2403
+ x,
2404
+ y,
2405
+ width: rect.width,
2406
+ height: rect.height
2407
+ };
2408
+ }
2409
+ function getTrueOffsetParent(element, polyfill) {
2410
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
2411
+ return null;
2412
+ }
2413
+ if (polyfill) {
2414
+ return polyfill(element);
2415
+ }
2416
+ return element.offsetParent;
2417
+ }
2418
+ function getOffsetParent(element, polyfill) {
2419
+ const window2 = getWindow(element);
2420
+ if (!isHTMLElement(element) || isTopLayer(element)) {
2421
+ return window2;
2422
+ }
2423
+ let offsetParent = getTrueOffsetParent(element, polyfill);
2424
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
2425
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2426
+ }
2427
+ if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
2428
+ return window2;
2429
+ }
2430
+ return offsetParent || getContainingBlock(element) || window2;
2431
+ }
2432
+ var getElementRects = async function(data) {
2433
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2434
+ const getDimensionsFn = this.getDimensions;
2435
+ return {
2436
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2437
+ floating: __spreadValues({
2438
+ x: 0,
2439
+ y: 0
2440
+ }, await getDimensionsFn(data.floating))
2441
+ };
2442
+ };
2443
+ function isRTL(element) {
2444
+ return getComputedStyle(element).direction === "rtl";
2445
+ }
2446
+ var platform = {
2447
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2448
+ getDocumentElement,
2449
+ getClippingRect,
2450
+ getOffsetParent,
2451
+ getElementRects,
2452
+ getClientRects,
2453
+ getDimensions,
2454
+ getScale,
2455
+ isElement,
2456
+ isRTL
2457
+ };
2458
+ var flip2 = flip;
2459
+ var hide2 = hide;
2460
+ var arrow2 = arrow;
2461
+ var computePosition2 = (reference, floating, options) => {
2462
+ const cache2 = /* @__PURE__ */ new Map();
2463
+ const mergedOptions = __spreadValues({
2464
+ platform
2465
+ }, options);
2466
+ const platformWithCache = __spreadProps(__spreadValues({}, mergedOptions.platform), {
2467
+ _c: cache2
2468
+ });
2469
+ return computePosition(reference, floating, __spreadProps(__spreadValues({}, mergedOptions), {
2470
+ platform: platformWithCache
2471
+ }));
2472
+ };
1693
2473
 
1694
- // node_modules/.pnpm/@warp-ds+core@1.0.2/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
2474
+ // node_modules/.pnpm/@warp-ds+core@1.1.1_@floating-ui+dom@1.6.3/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
2475
+ var TOP_START = "top-start";
1695
2476
  var TOP = "top";
2477
+ var TOP_END = "top-end";
2478
+ var RIGHT_START = "right-start";
2479
+ var RIGHT = "right";
2480
+ var RIGHT_END = "right-end";
2481
+ var BOTTOM_START = "bottom-start";
1696
2482
  var BOTTOM = "bottom";
2483
+ var BOTTOM_END = "bottom-end";
2484
+ var LEFT_START = "left-start";
1697
2485
  var LEFT = "left";
1698
- var RIGHT = "right";
2486
+ var LEFT_END = "left-end";
2487
+ var directions = [
2488
+ TOP_START,
2489
+ TOP,
2490
+ TOP_END,
2491
+ RIGHT_START,
2492
+ RIGHT,
2493
+ RIGHT_END,
2494
+ BOTTOM_START,
2495
+ BOTTOM,
2496
+ BOTTOM_END,
2497
+ LEFT_START,
2498
+ LEFT,
2499
+ LEFT_END
2500
+ ];
1699
2501
  var opposites = {
2502
+ [TOP_START]: BOTTOM_START,
1700
2503
  [TOP]: BOTTOM,
2504
+ [TOP_END]: BOTTOM_END,
2505
+ [BOTTOM_START]: TOP_START,
1701
2506
  [BOTTOM]: TOP,
2507
+ [BOTTOM_END]: TOP_END,
2508
+ [LEFT_START]: RIGHT_START,
1702
2509
  [LEFT]: RIGHT,
1703
- [RIGHT]: LEFT
1704
- };
1705
- var arrowLabels = {
1706
- [TOP]: "\u2191",
1707
- [BOTTOM]: "\u2193",
1708
- [LEFT]: "\u2190",
1709
- [RIGHT]: "\u2192"
2510
+ [LEFT_END]: RIGHT_END,
2511
+ [RIGHT_START]: LEFT_START,
2512
+ [RIGHT]: LEFT,
2513
+ [RIGHT_END]: LEFT_END
1710
2514
  };
1711
2515
  var rotation = {
2516
+ [LEFT_START]: -45,
1712
2517
  [LEFT]: -45,
2518
+ [LEFT_END]: -45,
2519
+ [TOP_START]: 45,
1713
2520
  [TOP]: 45,
2521
+ [TOP_END]: 45,
2522
+ [RIGHT_START]: 135,
1714
2523
  [RIGHT]: 135,
1715
- [BOTTOM]: -135
2524
+ [RIGHT_END]: 135,
2525
+ [BOTTOM_START]: -135,
2526
+ [BOTTOM]: -135,
2527
+ [BOTTOM_END]: -135
1716
2528
  };
1717
2529
  var middlePosition = "calc(50% - 7px)";
1718
- var isDirectionVertical = (name) => [TOP, BOTTOM].includes(name);
1719
- function computeCalloutArrow({ actualDirection, directionName, arrowEl }) {
2530
+ var isDirectionVertical = (name) => [TOP_START, TOP, TOP_END, BOTTOM_START, BOTTOM, BOTTOM_END].includes(name);
2531
+ var arrowDirectionClassname = (dir) => {
2532
+ let direction;
2533
+ if (/-/.test(dir)) {
2534
+ direction = dir.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join("");
2535
+ } else {
2536
+ direction = dir.charAt(0).toUpperCase() + dir.slice(1);
2537
+ }
2538
+ return direction;
2539
+ };
2540
+ var side = (dir) => dir.split("-")[0];
2541
+ var staticSide = (dir) => opposites[side(dir)];
2542
+ var arrowDirection = (dir) => opposites[dir];
2543
+ var arrowRotation = (dir) => rotation[arrowDirection(dir)];
2544
+ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
2545
+ Object.assign(arrowEl == null ? void 0 : arrowEl.style, {
2546
+ borderTopLeftRadius: "4px",
2547
+ zIndex: 1,
2548
+ // border alignment is off by a fraction of a pixel, this fixes it
2549
+ [`margin${arrowDirectionClassname(staticSide(dir))}`]: "-0.5px",
2550
+ transform: `rotate(${arrowRotation2}deg)`
2551
+ });
2552
+ };
2553
+ function computeCalloutArrow({ actualDirection, directionName = BOTTOM, arrowEl }) {
1720
2554
  if (!arrowEl)
1721
2555
  return;
1722
2556
  actualDirection = directionName;
1723
2557
  const directionIsVertical = isDirectionVertical(directionName);
1724
- arrowEl.style.left = directionIsVertical ? middlePosition : "";
1725
- arrowEl.style.top = !directionIsVertical ? middlePosition : "";
2558
+ Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
2559
+ left: directionIsVertical ? middlePosition : "",
2560
+ top: !directionIsVertical ? middlePosition : ""
2561
+ });
2562
+ applyArrowStyles(arrowEl, arrowRotation(actualDirection), actualDirection);
1726
2563
  }
1727
2564
  async function useRecompute(state) {
1728
- var _a, _b;
1729
- if (!state.isShowing)
2565
+ var _a, _b, _c;
2566
+ if (!(state == null ? void 0 : state.isShowing))
1730
2567
  return;
1731
- await ((_a = state == null ? void 0 : state.waitForDOM) == null ? void 0 : _a.call(state));
1732
- if (state.isCallout)
2568
+ if (state == null ? void 0 : state.waitForDOM) {
2569
+ await (state == null ? void 0 : state.waitForDOM());
2570
+ }
2571
+ if (state == null ? void 0 : state.isCallout)
1733
2572
  return computeCalloutArrow(state);
1734
- const position = await z(state.targetEl, state.attentionEl, {
1735
- placement: state.directionName,
2573
+ if (!(state == null ? void 0 : state.targetEl) || !(state == null ? void 0 : state.attentionEl))
2574
+ return;
2575
+ const targetEl = state == null ? void 0 : state.targetEl;
2576
+ const attentionEl = state == null ? void 0 : state.attentionEl;
2577
+ computePosition2(targetEl, attentionEl, {
2578
+ placement: (_a = state == null ? void 0 : state.directionName) != null ? _a : BOTTOM,
1736
2579
  middleware: [
1737
- // Should we make this configurable, but have these as sane defaults?
1738
- b(),
1739
- T(8),
1740
- D({ padding: 16 }),
1741
- // @ts-ignore
1742
- m({ element: state.noArrow ? void 0 : state.arrowEl })
1743
- // FIXME
2580
+ offset({ mainAxis: (_b = state == null ? void 0 : state.distance) != null ? _b : 8, crossAxis: (_c = state == null ? void 0 : state.skidding) != null ? _c : 0 }),
2581
+ (state == null ? void 0 : state.flip) && flip2({
2582
+ crossAxis: state == null ? void 0 : state.crossAxis,
2583
+ fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
2584
+ }),
2585
+ !(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl }),
2586
+ hide2()
2587
+ //will hide the attentionEl when it appears detached from the targetEl. Can be called multiple times in the middleware-array if you want to use several strategies. Default strategy is 'referenceHidden'.
1744
2588
  ]
2589
+ }).then(({ x, y, middlewareData, placement }) => {
2590
+ state.actualDirection = placement;
2591
+ Object.assign(attentionEl == null ? void 0 : attentionEl.style, {
2592
+ left: `${x}px`,
2593
+ top: `${y}px`
2594
+ });
2595
+ if ((middlewareData == null ? void 0 : middlewareData.hide) && !(state == null ? void 0 : state.isCallout)) {
2596
+ const { referenceHidden } = middlewareData == null ? void 0 : middlewareData.hide;
2597
+ Object.assign(attentionEl == null ? void 0 : attentionEl.style, {
2598
+ visibility: referenceHidden ? "hidden" : ""
2599
+ });
2600
+ }
2601
+ const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
2602
+ const arrowPlacement = arrowDirection(placement).split("-")[1];
2603
+ if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
2604
+ const arrowEl = state == null ? void 0 : state.arrowEl;
2605
+ const { x: x2, y: y2 } = middlewareData == null ? void 0 : middlewareData.arrow;
2606
+ let top = "";
2607
+ let right = "";
2608
+ let bottom = "";
2609
+ let left = "";
2610
+ if (arrowPlacement === "start") {
2611
+ const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2612
+ top = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2613
+ right = isRtl ? value : "";
2614
+ left = isRtl ? "" : value;
2615
+ } else if (arrowPlacement === "end") {
2616
+ const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2617
+ right = isRtl ? "" : value;
2618
+ left = isRtl ? value : "";
2619
+ bottom = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2620
+ } else {
2621
+ left = typeof x2 === "number" ? `${x2}px` : "";
2622
+ top = typeof y2 === "number" ? `${y2}px` : "";
2623
+ }
2624
+ Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
2625
+ top,
2626
+ right,
2627
+ bottom,
2628
+ left
2629
+ });
2630
+ applyArrowStyles(arrowEl, arrowRotation(placement), placement);
2631
+ }
1745
2632
  });
1746
- state.actualDirection = position.placement;
1747
- Object.assign(((_b = state.attentionEl) == null ? void 0 : _b.style) || {}, {
1748
- left: "0",
1749
- top: "0",
1750
- transform: `translate3d(${Math.round(position.x)}px, ${Math.round(position.y)}px, 0)`
1751
- });
1752
- let { x: x3, y: y3 } = position.middlewareData.arrow;
1753
- if (state.arrowEl) {
1754
- state.arrowEl.style.left = x3 ? x3 + "px" : "";
1755
- state.arrowEl.style.top = y3 ? y3 + "px" : "";
1756
- }
2633
+ return state;
1757
2634
  }
1758
2635
 
1759
2636
  // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
@@ -1781,7 +2658,7 @@ function processTokens(tokens, mapText) {
1781
2658
  return [token.arg, token.key];
1782
2659
  }
1783
2660
  }
1784
- const offset = token.pluralOffset;
2661
+ const offset2 = token.pluralOffset;
1785
2662
  const formatProps = {};
1786
2663
  token.cases.forEach((item) => {
1787
2664
  formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
@@ -1793,16 +2670,16 @@ function processTokens(tokens, mapText) {
1793
2670
  token.arg,
1794
2671
  token.type,
1795
2672
  __spreadValues({
1796
- offset
2673
+ offset: offset2
1797
2674
  }, formatProps)
1798
2675
  ];
1799
2676
  });
1800
2677
  }
1801
- function compileMessage(message, mapText = (v3) => v3) {
2678
+ function compileMessage(message, mapText = (v) => v) {
1802
2679
  try {
1803
2680
  return processTokens((0, import_parser.parse)(message), mapText);
1804
- } catch (e2) {
1805
- console.error(`${e2.message}
2681
+ } catch (e) {
2682
+ console.error(`${e.message}
1806
2683
 
1807
2684
  Message: ${message}`);
1808
2685
  return message;
@@ -1810,8 +2687,8 @@ Message: ${message}`);
1810
2687
  }
1811
2688
 
1812
2689
  // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
1813
- var isString = (s3) => typeof s3 === "string";
1814
- var isFunction = (f3) => typeof f3 === "function";
2690
+ var isString = (s) => typeof s === "string";
2691
+ var isFunction = (f) => typeof f === "function";
1815
2692
  var cache = /* @__PURE__ */ new Map();
1816
2693
  var defaultLocale = "en";
1817
2694
  function normalizeLocales(locales) {
@@ -1835,7 +2712,7 @@ function number(locales, value, format) {
1835
2712
  return formatter.format(value);
1836
2713
  }
1837
2714
  function plural(locales, ordinal, value, _a) {
1838
- var _b = _a, { offset = 0 } = _b, rules = __objRest(_b, ["offset"]);
2715
+ var _b = _a, { offset: offset2 = 0 } = _b, rules = __objRest(_b, ["offset"]);
1839
2716
  var _a2, _b2;
1840
2717
  const _locales = normalizeLocales(locales);
1841
2718
  const plurals = ordinal ? getMemoized(
@@ -1845,7 +2722,7 @@ function plural(locales, ordinal, value, _a) {
1845
2722
  () => cacheKey("plural-cardinal", _locales),
1846
2723
  () => new Intl.PluralRules(_locales, { type: "cardinal" })
1847
2724
  );
1848
- return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset)]) != null ? _b2 : rules.other;
2725
+ return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset2)]) != null ? _b2 : rules.other;
1849
2726
  }
1850
2727
  function getMemoized(getKey, construct) {
1851
2728
  const key = getKey();
@@ -1874,14 +2751,14 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1874
2751
  };
1875
2752
  return {
1876
2753
  plural: (value, cases) => {
1877
- const { offset = 0 } = cases;
2754
+ const { offset: offset2 = 0 } = cases;
1878
2755
  const message = plural(locales, false, value, cases);
1879
- return replaceOctothorpe(value - offset, message);
2756
+ return replaceOctothorpe(value - offset2, message);
1880
2757
  },
1881
2758
  selectordinal: (value, cases) => {
1882
- const { offset = 0 } = cases;
2759
+ const { offset: offset2 = 0 } = cases;
1883
2760
  const message = plural(locales, true, value, cases);
1884
- return replaceOctothorpe(value - offset, message);
2761
+ return replaceOctothorpe(value - offset2, message);
1885
2762
  },
1886
2763
  select: selectFormatter,
1887
2764
  number: (value, format) => number(locales, value, style(format)),
@@ -2143,8 +3020,8 @@ function detectLocale() {
2143
3020
  try {
2144
3021
  const htmlLocale = document.documentElement.lang;
2145
3022
  return getSupportedLocale(htmlLocale);
2146
- } catch (e2) {
2147
- console.warn("could not detect locale, falling back to source locale", e2);
3023
+ } catch (e) {
3024
+ console.warn("could not detect locale, falling back to source locale", e);
2148
3025
  return defaultLocale2;
2149
3026
  }
2150
3027
  }
@@ -2224,8 +3101,8 @@ function detectLocale2() {
2224
3101
  return getSupportedLocale2(hostLocale);
2225
3102
  }
2226
3103
  return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
2227
- } catch (e2) {
2228
- console.warn("could not detect locale, falling back to source locale", e2);
3104
+ } catch (e) {
3105
+ console.warn("could not detect locale, falling back to source locale", e);
2229
3106
  return defaultLocale3;
2230
3107
  }
2231
3108
  }
@@ -2258,30 +3135,130 @@ var WarpAttention = class extends kebabCaseAttributes(WarpElement) {
2258
3135
  constructor() {
2259
3136
  super();
2260
3137
  activateI18n(messages, messages2, messages3);
3138
+ this.handleDone = this.handleDone.bind(this);
2261
3139
  this.show = false;
3140
+ this.placement = "bottom";
2262
3141
  this.tooltip = false;
2263
3142
  this.callout = false;
2264
3143
  this.popover = false;
2265
3144
  this.highlight = false;
2266
3145
  this.canClose = false;
2267
3146
  this.noArrow = false;
3147
+ this.distance = 8;
3148
+ this.skidding = 0;
3149
+ this.flip = false;
3150
+ this.crossAxis = false;
3151
+ this._initialPlacement = this.placement;
3152
+ this._actualDirection = this.placement;
2268
3153
  }
2269
3154
  connectedCallback() {
2270
3155
  super.connectedCallback();
2271
- if (!this.placement || !Object.keys(opposites).includes(this.placement)) {
3156
+ if (this.placement && !Object.keys(opposites).includes(this.placement)) {
2272
3157
  throw new Error(`Invalid "placement" attribute. Set its value to one of the following:
2273
3158
  ${JSON.stringify(Object.keys(opposites))}`);
3159
+ }
3160
+ if (this.fallbackPlacements && !this.fallbackPlacements.every((fallbackPlacement) => directions.includes(fallbackPlacement))) {
3161
+ throw new Error(`Invalid "fallbackPlacements" attribute. Set its value to an array with one or more of the following:
3162
+ ${JSON.stringify(directions)}`);
2274
3163
  }
2275
3164
  setTimeout(() => this.requestUpdate(), 0);
3165
+ if (!this.callout) {
3166
+ window.addEventListener("click", this.handleDone);
3167
+ window.addEventListener("scroll", this.handleDone);
3168
+ window.addEventListener("resize", this.handleDone);
3169
+ window.addEventListener("touch", this.handleDone);
3170
+ }
3171
+ if (this.tooltip) {
3172
+ window.addEventListener("mouseover", this.handleDone);
3173
+ window.addEventListener("mouseout", this.handleDone);
3174
+ }
3175
+ }
3176
+ disconnectedCallback() {
3177
+ window.removeEventListener("click", this.handleDone);
3178
+ window.removeEventListener("scroll", this.handleDone);
3179
+ window.removeEventListener("resize", this.handleDone);
3180
+ window.removeEventListener("touch", this.handleDone);
3181
+ window.removeEventListener("mouseover", this.handleDone);
3182
+ window.removeEventListener("mouseout", this.handleDone);
3183
+ super.disconnectedCallback();
3184
+ }
3185
+ handleDone() {
3186
+ window.requestAnimationFrame(() => {
3187
+ if (this.show && this._targetEl && this._attentionEl) {
3188
+ useRecompute(this.attentionState).then((state) => {
3189
+ this._actualDirection = state == null ? void 0 : state.actualDirection;
3190
+ });
3191
+ } else {
3192
+ this._actualDirection = this._initialPlacement;
3193
+ }
3194
+ });
2276
3195
  }
2277
3196
  get _actualDirection() {
2278
3197
  return this.placement;
2279
3198
  }
2280
- set _actualDirection(v3) {
2281
- this.placement = v3;
3199
+ set _actualDirection(v) {
3200
+ this.placement = v;
3201
+ }
3202
+ get _arrowEl() {
3203
+ return this.renderRoot.querySelector("#arrow");
2282
3204
  }
2283
3205
  get _arrowDirection() {
2284
- return opposites[this.placement];
3206
+ return opposites[this._actualDirection];
3207
+ }
3208
+ get _arrowClasses() {
3209
+ return classes({
3210
+ [attention.arrowBase]: true,
3211
+ [attention[`arrowDirection${arrowDirectionClassname(this._arrowDirection)}`]]: true,
3212
+ [this._activeVariantClasses.arrow]: true
3213
+ });
3214
+ }
3215
+ get _arrowHtml() {
3216
+ return this.noArrow ? "" : html2`<div id="arrow" role="img" class="${this._arrowClasses}" />`;
3217
+ }
3218
+ get _activeVariantClasses() {
3219
+ const variantProps = {
3220
+ callout: this.callout,
3221
+ popover: this.popover,
3222
+ tooltip: this.tooltip,
3223
+ highlight: this.highlight
3224
+ };
3225
+ const activeVariant = Object.keys(variantProps).find((b) => !!variantProps[b]) || "";
3226
+ return {
3227
+ wrapper: attention[activeVariant],
3228
+ arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
3229
+ };
3230
+ }
3231
+ get _attentionEl() {
3232
+ return this.renderRoot.querySelector("#attention");
3233
+ }
3234
+ get _targetEl() {
3235
+ var _a;
3236
+ const targetSlot = (_a = this.renderRoot) == null ? void 0 : _a.querySelector("slot[name='target']");
3237
+ return targetSlot ? targetSlot.assignedNodes()[0] : null;
3238
+ }
3239
+ get _messageEl() {
3240
+ const messageSlot = this.renderRoot.querySelector("slot[name='message']");
3241
+ return messageSlot ? messageSlot.assignedNodes()[0] : null;
3242
+ }
3243
+ get _wrapperClasses() {
3244
+ return classes({
3245
+ [attention.base]: true,
3246
+ [this._activeVariantClasses.wrapper]: true
3247
+ });
3248
+ }
3249
+ get _ariaClose() {
3250
+ return i18n._({
3251
+ id: "attention.aria.close",
3252
+ message: "Close",
3253
+ comment: "Aria label for the close button in attention"
3254
+ });
3255
+ }
3256
+ get _closeBtnHtml() {
3257
+ return html2`
3258
+ <button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
3259
+ <w-icon-close-16 />
3260
+ </button>
3261
+ `;
2285
3262
  }
2286
3263
  updated() {
2287
3264
  if (!this.callout) {
@@ -2295,34 +3272,47 @@ ${JSON.stringify(Object.keys(opposites))}`);
2295
3272
  isCallout: this.callout,
2296
3273
  actualDirection: this._actualDirection,
2297
3274
  directionName: this.placement,
2298
- arrowEl: this.renderRoot.querySelector("#arrow"),
3275
+ arrowEl: this._arrowEl,
2299
3276
  attentionEl: this._attentionEl,
2300
3277
  targetEl: this._targetEl,
2301
- noArrow: this.noArrow
3278
+ noArrow: this.noArrow,
3279
+ distance: this.distance,
3280
+ skidding: this.skidding,
3281
+ flip: this.flip,
3282
+ crossAxis: this.crossAxis,
3283
+ fallbackPlacements: this.fallbackPlacements
2302
3284
  };
2303
3285
  useRecompute(this.attentionState);
2304
3286
  }
2305
3287
  pointingAtDirection() {
2306
3288
  switch (opposites[this._actualDirection]) {
3289
+ case "top-start":
2307
3290
  case "top":
3291
+ case "top-end":
2308
3292
  return i18n._({
2309
3293
  id: "attention.aria.pointingUp",
2310
3294
  message: "pointing up",
2311
3295
  comment: "Default screenreader message for top direction in the attention component"
2312
3296
  });
3297
+ case "right-start":
2313
3298
  case "right":
3299
+ case "right-end":
2314
3300
  return i18n._({
2315
3301
  id: "attention.aria.pointingRight",
2316
3302
  message: "pointing right",
2317
3303
  comment: "Default screenreader message for right direction in the attention component"
2318
3304
  });
3305
+ case "bottom-start":
2319
3306
  case "bottom":
3307
+ case "bottom-end":
2320
3308
  return i18n._({
2321
3309
  id: "attention.aria.pointingDown",
2322
3310
  message: "pointing down",
2323
3311
  comment: "Default screenreader message for bottom direction in the attention component"
2324
3312
  });
3313
+ case "left-start":
2325
3314
  case "left":
3315
+ case "left-end":
2326
3316
  return i18n._({
2327
3317
  id: "attention.aria.pointingLeft",
2328
3318
  message: "pointing left",
@@ -2371,64 +3361,13 @@ ${JSON.stringify(Object.keys(opposites))}`);
2371
3361
  this._targetEl.setAttribute("aria-details", attentionMessageId);
2372
3362
  }
2373
3363
  }
2374
- get _activeVariantClasses() {
2375
- const variantProps = {
2376
- callout: this.callout,
2377
- popover: this.popover,
2378
- tooltip: this.tooltip,
2379
- highlight: this.highlight
2380
- };
2381
- const activeVariant = Object.keys(variantProps).find((b3) => !!variantProps[b3]) || "";
2382
- return {
2383
- wrapper: attention[activeVariant],
2384
- arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
2385
- };
2386
- }
2387
- get _ariaClose() {
2388
- return i18n._({
2389
- id: "attention.aria.close",
2390
- message: "Close",
2391
- comment: "Aria label for the close button in attention"
2392
- });
2393
- }
2394
3364
  firstUpdated() {
3365
+ this._initialPlacement = this.placement;
2395
3366
  this.setAriaLabels();
2396
3367
  if (this.callout) {
2397
3368
  this._attentionEl.style.position = "relative";
2398
3369
  }
2399
3370
  }
2400
- get _attentionEl() {
2401
- return this.renderRoot.querySelector("#attention");
2402
- }
2403
- get _targetEl() {
2404
- return this.renderRoot.querySelector("slot[name='target']").assignedNodes()[0];
2405
- }
2406
- get _messageEl() {
2407
- return this.renderRoot.querySelector("slot[name='message']").assignedNodes()[0];
2408
- }
2409
- get _wrapperClasses() {
2410
- return classes({
2411
- [attention.base]: true,
2412
- [this._activeVariantClasses.wrapper]: true
2413
- });
2414
- }
2415
- get _arrowClasses() {
2416
- return classes({
2417
- [attention.arrowBase]: true,
2418
- [attention[`arrowDirection${this._arrowDirection.charAt(0).toUpperCase() + this._arrowDirection.slice(1)}`]]: true,
2419
- [this._activeVariantClasses.arrow]: true
2420
- });
2421
- }
2422
- get _arrowHtml() {
2423
- return this.noArrow ? "" : html2`<div
2424
- id="arrow"
2425
- role="img"
2426
- class="${this._arrowClasses}"
2427
- style="transform:rotate(${rotation[this._arrowDirection]}deg);
2428
- margin-${// border alignment is off by a fraction of a pixel, this fixes it
2429
- this._arrowDirection.charAt(0).toLowerCase() + this._arrowDirection.slice(1)}:-0.5px;"
2430
- />`;
2431
- }
2432
3371
  close() {
2433
3372
  const event = new CustomEvent("close", {
2434
3373
  bubbles: true,
@@ -2436,25 +3375,20 @@ ${JSON.stringify(Object.keys(opposites))}`);
2436
3375
  });
2437
3376
  this.updateComplete.then(() => this.dispatchEvent(event));
2438
3377
  }
2439
- keypressed(e2) {
3378
+ keypressed(e) {
2440
3379
  if (!this.canClose)
2441
3380
  return;
2442
- if (e2.key === "Escape") {
2443
- e2.preventDefault();
3381
+ if (e.key === "Escape") {
3382
+ e.preventDefault();
2444
3383
  this.close();
2445
3384
  }
2446
3385
  }
2447
- get _closeBtnHtml() {
2448
- return html2`
2449
- <button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
2450
- <w-icon-close-16 />
2451
- </button>
2452
- `;
2453
- }
2454
3386
  render() {
3387
+ if (!this.callout && this._targetEl === void 0)
3388
+ return html2``;
2455
3389
  return html2`
2456
3390
  <div class=${ifDefined(this.className ? this.className : void 0)}>
2457
- ${this.placement === "right" || this.placement === "bottom" ? html2`
3391
+ ${this.placement === "right-start" || this.placement === "right" || this.placement === "right-end" || this.placement === "bottom-start" || this.placement === "bottom" || this.placement === "bottom-end" ? html2`
2458
3392
  <slot name="target"></slot>
2459
3393
 
2460
3394
  <div id="attention" role="${this.tooltip ? "tooltip" : "img"}" aria-label="${this.defaultAriaLabel()}" class="${this._wrapperClasses}">
@@ -2478,7 +3412,7 @@ __publicField(WarpAttention, "properties", {
2478
3412
  show: { type: Boolean, reflect: true },
2479
3413
  // Placement according to the target element
2480
3414
  // Arrow would be on the opposite side of this position
2481
- placement: { type: String },
3415
+ placement: { type: String, reflect: true },
2482
3416
  // Whether Attention element is rendered as a tooltip
2483
3417
  tooltip: { type: Boolean, reflect: true },
2484
3418
  // Whether Attention element is rendered as an inline callout
@@ -2490,7 +3424,17 @@ __publicField(WarpAttention, "properties", {
2490
3424
  // Render Attention element with a close button
2491
3425
  canClose: { type: Boolean, reflect: true },
2492
3426
  // Render Attention element without an arrow
2493
- noArrow: { type: Boolean, reflect: true }
3427
+ noArrow: { type: Boolean, reflect: true },
3428
+ // Distance from which to offset the attentionEl from the targetEl vertically
3429
+ distance: { type: Number, reflect: true },
3430
+ // Distance from which to offset the attentionEl along its targetEl horizontally
3431
+ skidding: { type: Number, reflect: true },
3432
+ // Whether Attention element should flip its placement in order to keep it in view
3433
+ flip: { type: Boolean, reflect: true },
3434
+ // Whether Attention element should ignore cross axis overflow when flip is enabled
3435
+ crossAxis: { type: Boolean, reflect: true },
3436
+ // Choose which preferred placements the Attention element should flip to
3437
+ fallbackPlacements: { type: Array, reflect: true }
2494
3438
  });
2495
3439
  __publicField(WarpAttention, "styles", [
2496
3440
  WarpElement.styles,
@@ -2505,11 +3449,6 @@ __publicField(WarpAttention, "styles", [
2505
3449
  :host([popover]:not(:popover-open):not(dialog[open])) {
2506
3450
  display: contents;
2507
3451
  }
2508
-
2509
- #arrow {
2510
- border-top-left-radius: 4px;
2511
- z-index: 1;
2512
- }
2513
3452
  `
2514
3453
  ]);
2515
3454
  if (!customElements.get("w-attention")) {