@warp-ds/elements 1.3.3 → 1.4.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/api.js.map +1 -1
  2. package/dist/index.js +1589 -546
  3. package/dist/index.js.map +4 -4
  4. package/dist/packages/affix/index.js +11 -8
  5. package/dist/packages/affix/index.js.map +3 -3
  6. package/dist/packages/alert/index.js +11 -8
  7. package/dist/packages/alert/index.js.map +3 -3
  8. package/dist/packages/attention/index.d.ts +45 -17
  9. package/dist/packages/attention/index.js +1557 -515
  10. package/dist/packages/attention/index.js.map +4 -4
  11. package/dist/packages/badge/index.js +11 -8
  12. package/dist/packages/badge/index.js.map +3 -3
  13. package/dist/packages/box/index.js +11 -8
  14. package/dist/packages/box/index.js.map +3 -3
  15. package/dist/packages/breadcrumbs/index.js +12 -9
  16. package/dist/packages/breadcrumbs/index.js.map +3 -3
  17. package/dist/packages/button/index.js +11 -8
  18. package/dist/packages/button/index.js.map +3 -3
  19. package/dist/packages/card/index.d.ts +2 -2
  20. package/dist/packages/card/index.js +25 -21
  21. package/dist/packages/card/index.js.map +3 -3
  22. package/dist/packages/expandable/index.js +11 -8
  23. package/dist/packages/expandable/index.js.map +3 -3
  24. package/dist/packages/pill/index.js +11 -8
  25. package/dist/packages/pill/index.js.map +3 -3
  26. package/dist/packages/select/index.js +11 -8
  27. package/dist/packages/select/index.js.map +3 -3
  28. package/dist/packages/textfield/index.js +11 -8
  29. package/dist/packages/textfield/index.js.map +3 -3
  30. package/dist/packages/toast/api.d.ts +9 -9
  31. package/dist/packages/toast/index.js +11 -8
  32. package/dist/packages/toast/index.js.map +3 -3
  33. package/package.json +4 -4
@@ -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",
@@ -1060,24 +1060,27 @@ function generateRandomId() {
1060
1060
  return `m${Math.random().toString(36).slice(2)}`;
1061
1061
  }
1062
1062
 
1063
- // node_modules/.pnpm/@warp-ds+css@1.9.1/node_modules/@warp-ds/css/component-classes/index.js
1063
+ // node_modules/.pnpm/@warp-ds+css@1.9.3/node_modules/@warp-ds/css/component-classes/index.js
1064
1064
  var box = {
1065
1065
  box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
1066
1066
  // Relative here enables w-clickable
1067
1067
  bleed: "-mx-16 sm:mx-0 rounded-l-0 rounded-r-0 sm:rounded-8",
1068
1068
  // We target L and R to override the default rounded-8
1069
1069
  info: "s-bg-info-subtle",
1070
- neutral: "bg-[--w-s-color-surface-sunken]",
1070
+ neutral: "s-surface-sunken",
1071
1071
  bordered: "border-2 s-border s-bg",
1072
- infoClickable: "hover:s-bg-info-subtle-hover active:s-bg-info-subtle-hover",
1073
- neutralClickable: "hover:s-bg-subtle-hover active:s-bg-subtle-hover",
1074
- borderedClickable: "hover:s-bg-hover active:s-bg-hover hover:s-border-hover active:s-border-hover"
1072
+ infoClickable: "hover:s-bg-info-subtle-hover active:s-bg-info-subtle-active",
1073
+ // Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
1074
+ neutralClickable: "hover:s-bg-hover active:s-bg-active",
1075
+ // Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
1076
+ borderedClickable: "hover:s-bg-hover active:s-bg-active hover:s-border-hover active:s-border-active"
1077
+ // Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
1075
1078
  };
1076
1079
  var buttonReset = "focus:outline-none appearance-none cursor-pointer bg-transparent border-0 m-0 p-0 inline-block";
1077
1080
  var expandable = {
1078
1081
  expandable: "will-change-height",
1079
1082
  expandableTitle: "font-bold s-text",
1080
- expandableBox: "s-bg-subtle hover:s-bg-subtle-hover py-0 px-0 " + box.box,
1083
+ expandableBox: "s-surface-sunken hover:s-bg-hover active:s-bg-active py-0 px-0 " + box.box,
1081
1084
  expandableInfo: "s-bg-info-subtle! hover:s-bg-info-subtle-hover!",
1082
1085
  expandableBleed: box.bleed,
1083
1086
  chevron: "inline-block align-middle s-icon",
@@ -1118,7 +1121,7 @@ var buttonTypes = {
1118
1121
  utility: `border rounded-4 ${buttonDefaultStyling}`,
1119
1122
  negative: `border-0 rounded-8 ${buttonDefaultStyling}`,
1120
1123
  pill: `p-4 rounded-full border-0 inline-flex items-center justify-center hover:bg-clip-padding ${buttonDefaultStyling}`,
1121
- link: `bg-transparent focusable ease-in-out inline active:underline hover:underline ${buttonColors.link}`
1124
+ link: `bg-transparent focusable ease-in-out inline active:underline hover:underline focus:underline ${buttonColors.link}`
1122
1125
  };
1123
1126
  var buttonSizes = {
1124
1127
  xsmall: "py-6 px-16",
@@ -1208,7 +1211,7 @@ var button = {
1208
1211
  pillSmallLoading: `${buttonSizes.pillSmall} ${buttonTextSizes.xsmall} ${buttonTypes.pill} ${buttonVariants.inProgress}`,
1209
1212
  link: `${buttonSizes.link} ${buttonTextSizes.medium} ${buttonTypes.link}`,
1210
1213
  linkSmall: `${buttonSizes.link} ${buttonTextSizes.xsmall} ${buttonTypes.link}`,
1211
- linkAsButton: "inline-block hover:no-underline text-center",
1214
+ linkAsButton: "inline-block active:no-underline hover:no-underline focus:no-underline text-center",
1212
1215
  a11y: "sr-only",
1213
1216
  fullWidth: "w-full max-w-full",
1214
1217
  contentWidth: "max-w-max"
@@ -1340,417 +1343,1401 @@ var attention = {
1340
1343
  closeBtn: `${buttonTextSizes.medium} ${buttonTypes.pill} ${buttonColors.pill} justify-self-end -mr-8 ml-8`
1341
1344
  };
1342
1345
 
1343
- // node_modules/.pnpm/@floating-ui+core@0.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
1344
- function t(t2) {
1345
- 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 alignments = ["start", "end"];
1349
+ var placements = /* @__PURE__ */ sides.reduce((acc, side2) => acc.concat(side2, side2 + "-" + alignments[0], side2 + "-" + alignments[1]), []);
1350
+ var min = Math.min;
1351
+ var max = Math.max;
1352
+ var round = Math.round;
1353
+ var createCoords = (v) => ({
1354
+ x: v,
1355
+ y: v
1356
+ });
1357
+ var oppositeSideMap = {
1358
+ left: "right",
1359
+ right: "left",
1360
+ bottom: "top",
1361
+ top: "bottom"
1362
+ };
1363
+ var oppositeAlignmentMap = {
1364
+ start: "end",
1365
+ end: "start"
1366
+ };
1367
+ function clamp(start, value, end) {
1368
+ return max(start, min(value, end));
1369
+ }
1370
+ function evaluate(value, param) {
1371
+ return typeof value === "function" ? value(param) : value;
1372
+ }
1373
+ function getSide(placement) {
1374
+ return placement.split("-")[0];
1375
+ }
1376
+ function getAlignment(placement) {
1377
+ return placement.split("-")[1];
1378
+ }
1379
+ function getOppositeAxis(axis) {
1380
+ return axis === "x" ? "y" : "x";
1381
+ }
1382
+ function getAxisLength(axis) {
1383
+ return axis === "y" ? "height" : "width";
1384
+ }
1385
+ function getSideAxis(placement) {
1386
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
1387
+ }
1388
+ function getAlignmentAxis(placement) {
1389
+ return getOppositeAxis(getSideAxis(placement));
1390
+ }
1391
+ function getAlignmentSides(placement, rects, rtl) {
1392
+ if (rtl === void 0) {
1393
+ rtl = false;
1394
+ }
1395
+ const alignment = getAlignment(placement);
1396
+ const alignmentAxis = getAlignmentAxis(placement);
1397
+ const length = getAxisLength(alignmentAxis);
1398
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
1399
+ if (rects.reference[length] > rects.floating[length]) {
1400
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1401
+ }
1402
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
1403
+ }
1404
+ function getExpandedPlacements(placement) {
1405
+ const oppositePlacement = getOppositePlacement(placement);
1406
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1407
+ }
1408
+ function getOppositeAlignmentPlacement(placement) {
1409
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
1410
+ }
1411
+ function getSideList(side2, isStart, rtl) {
1412
+ const lr = ["left", "right"];
1413
+ const rl = ["right", "left"];
1414
+ const tb = ["top", "bottom"];
1415
+ const bt = ["bottom", "top"];
1416
+ switch (side2) {
1417
+ case "top":
1418
+ case "bottom":
1419
+ if (rtl)
1420
+ return isStart ? rl : lr;
1421
+ return isStart ? lr : rl;
1422
+ case "left":
1423
+ case "right":
1424
+ return isStart ? tb : bt;
1425
+ default:
1426
+ return [];
1427
+ }
1428
+ }
1429
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
1430
+ const alignment = getAlignment(placement);
1431
+ let list = getSideList(getSide(placement), direction === "start", rtl);
1432
+ if (alignment) {
1433
+ list = list.map((side2) => side2 + "-" + alignment);
1434
+ if (flipAlignment) {
1435
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
1436
+ }
1437
+ }
1438
+ return list;
1439
+ }
1440
+ function getOppositePlacement(placement) {
1441
+ return placement.replace(/left|right|bottom|top/g, (side2) => oppositeSideMap[side2]);
1346
1442
  }
1347
- function e(t2) {
1348
- return t2.split("-")[1];
1443
+ function expandPaddingObject(padding) {
1444
+ return __spreadValues({
1445
+ top: 0,
1446
+ right: 0,
1447
+ bottom: 0,
1448
+ left: 0
1449
+ }, padding);
1349
1450
  }
1350
- function n(e2) {
1351
- return ["top", "bottom"].includes(t(e2)) ? "x" : "y";
1451
+ function getPaddingObject(padding) {
1452
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
1453
+ top: padding,
1454
+ right: padding,
1455
+ bottom: padding,
1456
+ left: padding
1457
+ };
1352
1458
  }
1353
- function r(t2) {
1354
- return "y" === t2 ? "height" : "width";
1459
+ function rectToClientRect(rect) {
1460
+ return __spreadProps(__spreadValues({}, rect), {
1461
+ top: rect.y,
1462
+ left: rect.x,
1463
+ right: rect.x + rect.width,
1464
+ bottom: rect.y + rect.height
1465
+ });
1355
1466
  }
1356
- function i(i3, o3, a3) {
1357
- let { reference: l3, floating: s3 } = i3;
1358
- 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;
1359
- let p3;
1360
- switch (t(o3)) {
1467
+
1468
+ // node_modules/.pnpm/@floating-ui+core@1.6.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
1469
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
1470
+ let {
1471
+ reference,
1472
+ floating
1473
+ } = _ref;
1474
+ const sideAxis = getSideAxis(placement);
1475
+ const alignmentAxis = getAlignmentAxis(placement);
1476
+ const alignLength = getAxisLength(alignmentAxis);
1477
+ const side2 = getSide(placement);
1478
+ const isVertical = sideAxis === "y";
1479
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
1480
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
1481
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
1482
+ let coords;
1483
+ switch (side2) {
1361
1484
  case "top":
1362
- p3 = { x: c3, y: l3.y - s3.height };
1485
+ coords = {
1486
+ x: commonX,
1487
+ y: reference.y - floating.height
1488
+ };
1363
1489
  break;
1364
1490
  case "bottom":
1365
- p3 = { x: c3, y: l3.y + l3.height };
1491
+ coords = {
1492
+ x: commonX,
1493
+ y: reference.y + reference.height
1494
+ };
1366
1495
  break;
1367
1496
  case "right":
1368
- p3 = { x: l3.x + l3.width, y: f3 };
1497
+ coords = {
1498
+ x: reference.x + reference.width,
1499
+ y: commonY
1500
+ };
1369
1501
  break;
1370
1502
  case "left":
1371
- p3 = { x: l3.x - s3.width, y: f3 };
1503
+ coords = {
1504
+ x: reference.x - floating.width,
1505
+ y: commonY
1506
+ };
1372
1507
  break;
1373
1508
  default:
1374
- p3 = { x: l3.x, y: l3.y };
1509
+ coords = {
1510
+ x: reference.x,
1511
+ y: reference.y
1512
+ };
1375
1513
  }
1376
- switch (e(o3)) {
1514
+ switch (getAlignment(placement)) {
1377
1515
  case "start":
1378
- p3[u3] -= g3 * (a3 && d3 ? -1 : 1);
1516
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1379
1517
  break;
1380
1518
  case "end":
1381
- p3[u3] += g3 * (a3 && d3 ? -1 : 1);
1519
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1520
+ break;
1382
1521
  }
1383
- return p3;
1522
+ return coords;
1384
1523
  }
1385
- var o = async (t2, e2, n3) => {
1386
- const { placement: r3 = "bottom", strategy: o3 = "absolute", middleware: a3 = [], platform: l3 } = n3, s3 = await (null == l3.isRTL ? void 0 : l3.isRTL(e2));
1387
- let c3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: o3 }), { x: f3, y: u3 } = i(c3, r3, s3), m3 = r3, g3 = {}, d3 = 0;
1388
- for (let n4 = 0; n4 < a3.length; n4++) {
1389
- 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 } });
1390
- 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);
1524
+ var computePosition = async (reference, floating, config) => {
1525
+ const {
1526
+ placement = "bottom",
1527
+ strategy = "absolute",
1528
+ middleware = [],
1529
+ platform: platform2
1530
+ } = config;
1531
+ const validMiddleware = middleware.filter(Boolean);
1532
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
1533
+ let rects = await platform2.getElementRects({
1534
+ reference,
1535
+ floating,
1536
+ strategy
1537
+ });
1538
+ let {
1539
+ x,
1540
+ y
1541
+ } = computeCoordsFromPlacement(rects, placement, rtl);
1542
+ let statefulPlacement = placement;
1543
+ let middlewareData = {};
1544
+ let resetCount = 0;
1545
+ for (let i = 0; i < validMiddleware.length; i++) {
1546
+ const {
1547
+ name,
1548
+ fn
1549
+ } = validMiddleware[i];
1550
+ const {
1551
+ x: nextX,
1552
+ y: nextY,
1553
+ data,
1554
+ reset
1555
+ } = await fn({
1556
+ x,
1557
+ y,
1558
+ initialPlacement: placement,
1559
+ placement: statefulPlacement,
1560
+ strategy,
1561
+ middlewareData,
1562
+ rects,
1563
+ platform: platform2,
1564
+ elements: {
1565
+ reference,
1566
+ floating
1567
+ }
1568
+ });
1569
+ x = nextX != null ? nextX : x;
1570
+ y = nextY != null ? nextY : y;
1571
+ middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
1572
+ [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
1573
+ });
1574
+ if (reset && resetCount <= 50) {
1575
+ resetCount++;
1576
+ if (typeof reset === "object") {
1577
+ if (reset.placement) {
1578
+ statefulPlacement = reset.placement;
1579
+ }
1580
+ if (reset.rects) {
1581
+ rects = reset.rects === true ? await platform2.getElementRects({
1582
+ reference,
1583
+ floating,
1584
+ strategy
1585
+ }) : reset.rects;
1586
+ }
1587
+ ({
1588
+ x,
1589
+ y
1590
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1591
+ }
1592
+ i = -1;
1593
+ }
1391
1594
  }
1392
- return { x: f3, y: u3, placement: m3, strategy: o3, middlewareData: g3 };
1595
+ return {
1596
+ x,
1597
+ y,
1598
+ placement: statefulPlacement,
1599
+ strategy,
1600
+ middlewareData
1601
+ };
1393
1602
  };
1394
- function a(t2) {
1395
- return "number" != typeof t2 ? function(t3) {
1396
- return __spreadValues({ top: 0, right: 0, bottom: 0, left: 0 }, t3);
1397
- }(t2) : { top: t2, right: t2, bottom: t2, left: t2 };
1398
- }
1399
- function l(t2) {
1400
- return __spreadProps(__spreadValues({}, t2), { top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height });
1401
- }
1402
- async function s(t2, e2) {
1403
- var n3;
1404
- void 0 === e2 && (e2 = {});
1405
- 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]);
1406
- 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 };
1407
- }
1408
- var c = Math.min;
1409
- var f = Math.max;
1410
- function u(t2, e2, n3) {
1411
- return f(t2, c(e2, n3));
1412
- }
1413
- var m = (t2) => ({ name: "arrow", options: t2, async fn(i3) {
1414
- const { element: o3, padding: l3 = 0 } = null != t2 ? t2 : {}, { x: s3, y: c3, placement: f3, rects: m3, platform: g3 } = i3;
1415
- if (null == o3)
1416
- return {};
1417
- 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));
1418
- let T3 = P2 ? "y" === h3 ? P2.clientHeight || 0 : P2.clientWidth || 0 : 0;
1419
- 0 === T3 && (T3 = m3.floating[x3]);
1420
- 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];
1421
- return { [h3]: p3[h3] - (C2 ? k2 < D3 ? D3 - k2 : L3 - k2 : 0), data: { [h3]: E3, centerOffset: k2 - E3 } };
1422
- } });
1423
- var g = { left: "right", right: "left", bottom: "top", top: "bottom" };
1424
- function d(t2) {
1425
- return t2.replace(/left|right|bottom|top/g, (t3) => g[t3]);
1426
- }
1427
- function p(t2, i3, o3) {
1428
- void 0 === o3 && (o3 = false);
1429
- const a3 = e(t2), l3 = n(t2), s3 = r(l3);
1430
- let c3 = "x" === l3 ? a3 === (o3 ? "end" : "start") ? "right" : "left" : "start" === a3 ? "bottom" : "top";
1431
- return i3.reference[s3] > i3.floating[s3] && (c3 = d(c3)), { main: c3, cross: d(c3) };
1432
- }
1433
- var h = { start: "end", end: "start" };
1434
- function y(t2) {
1435
- return t2.replace(/start|end/g, (t3) => h[t3]);
1436
- }
1437
- var x = ["top", "right", "bottom", "left"];
1438
- var w = x.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
1439
- var b = function(e2) {
1440
- return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(n3) {
1441
- var r3;
1442
- 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) {
1443
- const e3 = d(t2);
1444
- return [y(t2), e3, y(e3)];
1445
- }(l3)), R2 = [l3, ...b3], A = await s(n3, w3), P2 = [];
1446
- let T3 = (null == (r3 = o3.flip) ? void 0 : r3.overflows) || [];
1447
- if (u3 && P2.push(A[v3]), m3) {
1448
- const { main: t2, cross: e3 } = p(i3, a3, await (null == c3.isRTL ? void 0 : c3.isRTL(f3.floating)));
1449
- P2.push(A[t2], A[e3]);
1603
+ async function detectOverflow(state, options) {
1604
+ var _await$platform$isEle;
1605
+ if (options === void 0) {
1606
+ options = {};
1607
+ }
1608
+ const {
1609
+ x,
1610
+ y,
1611
+ platform: platform2,
1612
+ rects,
1613
+ elements,
1614
+ strategy
1615
+ } = state;
1616
+ const {
1617
+ boundary = "clippingAncestors",
1618
+ rootBoundary = "viewport",
1619
+ elementContext = "floating",
1620
+ altBoundary = false,
1621
+ padding = 0
1622
+ } = evaluate(options, state);
1623
+ const paddingObject = getPaddingObject(padding);
1624
+ const altContext = elementContext === "floating" ? "reference" : "floating";
1625
+ const element = elements[altBoundary ? altContext : elementContext];
1626
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
1627
+ 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)),
1628
+ boundary,
1629
+ rootBoundary,
1630
+ strategy
1631
+ }));
1632
+ const rect = elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
1633
+ x,
1634
+ y
1635
+ }) : rects.reference;
1636
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
1637
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
1638
+ x: 1,
1639
+ y: 1
1640
+ } : {
1641
+ x: 1,
1642
+ y: 1
1643
+ };
1644
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
1645
+ elements,
1646
+ rect,
1647
+ offsetParent,
1648
+ strategy
1649
+ }) : rect);
1650
+ return {
1651
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1652
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1653
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1654
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1655
+ };
1656
+ }
1657
+ var arrow = (options) => ({
1658
+ name: "arrow",
1659
+ options,
1660
+ async fn(state) {
1661
+ const {
1662
+ x,
1663
+ y,
1664
+ placement,
1665
+ rects,
1666
+ platform: platform2,
1667
+ elements,
1668
+ middlewareData
1669
+ } = state;
1670
+ const {
1671
+ element,
1672
+ padding = 0
1673
+ } = evaluate(options, state) || {};
1674
+ if (element == null) {
1675
+ return {};
1450
1676
  }
1451
- if (T3 = [...T3, { placement: i3, overflows: P2 }], !P2.every((t2) => t2 <= 0)) {
1452
- var O2, D3;
1453
- const t2 = (null != (O2 = null == (D3 = o3.flip) ? void 0 : D3.index) ? O2 : 0) + 1, e3 = R2[t2];
1454
- if (e3)
1455
- return { data: { index: t2, overflows: T3 }, reset: { placement: e3 } };
1456
- let n4 = "bottom";
1457
- switch (h3) {
1458
- case "bestFit": {
1459
- var L3;
1460
- 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;
1461
- t3 && (n4 = t3);
1462
- break;
1463
- }
1464
- case "initialPlacement":
1465
- n4 = l3;
1677
+ const paddingObject = getPaddingObject(padding);
1678
+ const coords = {
1679
+ x,
1680
+ y
1681
+ };
1682
+ const axis = getAlignmentAxis(placement);
1683
+ const length = getAxisLength(axis);
1684
+ const arrowDimensions = await platform2.getDimensions(element);
1685
+ const isYAxis = axis === "y";
1686
+ const minProp = isYAxis ? "top" : "left";
1687
+ const maxProp = isYAxis ? "bottom" : "right";
1688
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
1689
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1690
+ const startDiff = coords[axis] - rects.reference[axis];
1691
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
1692
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1693
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
1694
+ clientSize = elements.floating[clientProp] || rects.floating[length];
1695
+ }
1696
+ const centerToReference = endDiff / 2 - startDiff / 2;
1697
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1698
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1699
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1700
+ const min$1 = minPadding;
1701
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
1702
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1703
+ const offset2 = clamp(min$1, center, max2);
1704
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1705
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
1706
+ return {
1707
+ [axis]: coords[axis] + alignmentOffset,
1708
+ data: __spreadValues({
1709
+ [axis]: offset2,
1710
+ centerOffset: center - offset2 - alignmentOffset
1711
+ }, shouldAddOffset && {
1712
+ alignmentOffset
1713
+ }),
1714
+ reset: shouldAddOffset
1715
+ };
1716
+ }
1717
+ });
1718
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
1719
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
1720
+ return allowedPlacementsSortedByAlignment.filter((placement) => {
1721
+ if (alignment) {
1722
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
1723
+ }
1724
+ return true;
1725
+ });
1726
+ }
1727
+ var autoPlacement = function(options) {
1728
+ if (options === void 0) {
1729
+ options = {};
1730
+ }
1731
+ return {
1732
+ name: "autoPlacement",
1733
+ options,
1734
+ async fn(state) {
1735
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
1736
+ const {
1737
+ rects,
1738
+ middlewareData,
1739
+ placement,
1740
+ platform: platform2,
1741
+ elements
1742
+ } = state;
1743
+ const _a = evaluate(options, state), {
1744
+ crossAxis = false,
1745
+ alignment,
1746
+ allowedPlacements = placements,
1747
+ autoAlignment = true
1748
+ } = _a, detectOverflowOptions = __objRest(_a, [
1749
+ "crossAxis",
1750
+ "alignment",
1751
+ "allowedPlacements",
1752
+ "autoAlignment"
1753
+ ]);
1754
+ const placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
1755
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1756
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
1757
+ const currentPlacement = placements$1[currentIndex];
1758
+ if (currentPlacement == null) {
1759
+ return {};
1760
+ }
1761
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
1762
+ if (placement !== currentPlacement) {
1763
+ return {
1764
+ reset: {
1765
+ placement: placements$1[0]
1766
+ }
1767
+ };
1768
+ }
1769
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
1770
+ const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
1771
+ placement: currentPlacement,
1772
+ overflows: currentOverflows
1773
+ }];
1774
+ const nextPlacement = placements$1[currentIndex + 1];
1775
+ if (nextPlacement) {
1776
+ return {
1777
+ data: {
1778
+ index: currentIndex + 1,
1779
+ overflows: allOverflows
1780
+ },
1781
+ reset: {
1782
+ placement: nextPlacement
1783
+ }
1784
+ };
1785
+ }
1786
+ const placementsSortedByMostSpace = allOverflows.map((d) => {
1787
+ const alignment2 = getAlignment(d.placement);
1788
+ return [d.placement, alignment2 && crossAxis ? (
1789
+ // Check along the mainAxis and main crossAxis side.
1790
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0)
1791
+ ) : (
1792
+ // Check only the mainAxis.
1793
+ d.overflows[0]
1794
+ ), d.overflows];
1795
+ }).sort((a, b) => a[1] - b[1]);
1796
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d) => d[2].slice(
1797
+ 0,
1798
+ // Aligned placements should not check their opposite crossAxis
1799
+ // side.
1800
+ getAlignment(d[0]) ? 2 : 3
1801
+ ).every((v) => v <= 0));
1802
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
1803
+ if (resetPlacement !== placement) {
1804
+ return {
1805
+ data: {
1806
+ index: currentIndex + 1,
1807
+ overflows: allOverflows
1808
+ },
1809
+ reset: {
1810
+ placement: resetPlacement
1811
+ }
1812
+ };
1466
1813
  }
1467
- if (i3 !== n4)
1468
- return { reset: { placement: n4 } };
1814
+ return {};
1469
1815
  }
1470
- return {};
1471
- } };
1816
+ };
1472
1817
  };
1473
- var T = function(r3) {
1474
- return void 0 === r3 && (r3 = 0), { name: "offset", options: r3, async fn(i3) {
1475
- const { x: o3, y: a3 } = i3, l3 = await async function(r4, i4) {
1476
- 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;
1477
- let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : __spreadValues({ mainAxis: 0, crossAxis: 0, alignmentAxis: null }, d3);
1478
- return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), u3 ? { x: h3 * g3, y: p3 * m3 } : { x: p3 * m3, y: h3 * g3 };
1479
- }(i3, r3);
1480
- return { x: o3 + l3.x, y: a3 + l3.y, data: l3 };
1481
- } };
1818
+ var flip = function(options) {
1819
+ if (options === void 0) {
1820
+ options = {};
1821
+ }
1822
+ return {
1823
+ name: "flip",
1824
+ options,
1825
+ async fn(state) {
1826
+ var _middlewareData$arrow, _middlewareData$flip;
1827
+ const {
1828
+ placement,
1829
+ middlewareData,
1830
+ rects,
1831
+ initialPlacement,
1832
+ platform: platform2,
1833
+ elements
1834
+ } = state;
1835
+ const _a = evaluate(options, state), {
1836
+ mainAxis: checkMainAxis = true,
1837
+ crossAxis: checkCrossAxis = true,
1838
+ fallbackPlacements: specifiedFallbackPlacements,
1839
+ fallbackStrategy = "bestFit",
1840
+ fallbackAxisSideDirection = "none",
1841
+ flipAlignment = true
1842
+ } = _a, detectOverflowOptions = __objRest(_a, [
1843
+ "mainAxis",
1844
+ "crossAxis",
1845
+ "fallbackPlacements",
1846
+ "fallbackStrategy",
1847
+ "fallbackAxisSideDirection",
1848
+ "flipAlignment"
1849
+ ]);
1850
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1851
+ return {};
1852
+ }
1853
+ const side2 = getSide(placement);
1854
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1855
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1856
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1857
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
1858
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1859
+ }
1860
+ const placements2 = [initialPlacement, ...fallbackPlacements];
1861
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1862
+ const overflows = [];
1863
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1864
+ if (checkMainAxis) {
1865
+ overflows.push(overflow[side2]);
1866
+ }
1867
+ if (checkCrossAxis) {
1868
+ const sides2 = getAlignmentSides(placement, rects, rtl);
1869
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
1870
+ }
1871
+ overflowsData = [...overflowsData, {
1872
+ placement,
1873
+ overflows
1874
+ }];
1875
+ if (!overflows.every((side3) => side3 <= 0)) {
1876
+ var _middlewareData$flip2, _overflowsData$filter;
1877
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1878
+ const nextPlacement = placements2[nextIndex];
1879
+ if (nextPlacement) {
1880
+ return {
1881
+ data: {
1882
+ index: nextIndex,
1883
+ overflows: overflowsData
1884
+ },
1885
+ reset: {
1886
+ placement: nextPlacement
1887
+ }
1888
+ };
1889
+ }
1890
+ 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;
1891
+ if (!resetPlacement) {
1892
+ switch (fallbackStrategy) {
1893
+ case "bestFit": {
1894
+ var _overflowsData$map$so;
1895
+ 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];
1896
+ if (placement2) {
1897
+ resetPlacement = placement2;
1898
+ }
1899
+ break;
1900
+ }
1901
+ case "initialPlacement":
1902
+ resetPlacement = initialPlacement;
1903
+ break;
1904
+ }
1905
+ }
1906
+ if (placement !== resetPlacement) {
1907
+ return {
1908
+ reset: {
1909
+ placement: resetPlacement
1910
+ }
1911
+ };
1912
+ }
1913
+ }
1914
+ return {};
1915
+ }
1916
+ };
1482
1917
  };
1483
- function O(t2) {
1484
- return "x" === t2 ? "y" : "x";
1485
- }
1486
- var D = function(e2) {
1487
- return void 0 === e2 && (e2 = {}), { name: "shift", options: e2, async fn(r3) {
1488
- const { x: i3, y: o3, placement: a3 } = r3, _a = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t2) => {
1489
- let { x: e3, y: n3 } = t2;
1490
- return { x: e3, y: n3 };
1491
- } } } = _a, m3 = __objRest(_a, ["mainAxis", "crossAxis", "limiter"]), g3 = { x: i3, y: o3 }, d3 = await s(r3, m3), p3 = n(t(a3)), h3 = O(p3);
1492
- let y3 = g3[p3], x3 = g3[h3];
1493
- if (l3) {
1494
- const t2 = "y" === p3 ? "bottom" : "right";
1495
- y3 = u(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t2]);
1918
+ async function convertValueToCoords(state, options) {
1919
+ const {
1920
+ placement,
1921
+ platform: platform2,
1922
+ elements
1923
+ } = state;
1924
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1925
+ const side2 = getSide(placement);
1926
+ const alignment = getAlignment(placement);
1927
+ const isVertical = getSideAxis(placement) === "y";
1928
+ const mainAxisMulti = ["left", "top"].includes(side2) ? -1 : 1;
1929
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1930
+ const rawValue = evaluate(options, state);
1931
+ let {
1932
+ mainAxis,
1933
+ crossAxis,
1934
+ alignmentAxis
1935
+ } = typeof rawValue === "number" ? {
1936
+ mainAxis: rawValue,
1937
+ crossAxis: 0,
1938
+ alignmentAxis: null
1939
+ } : __spreadValues({
1940
+ mainAxis: 0,
1941
+ crossAxis: 0,
1942
+ alignmentAxis: null
1943
+ }, rawValue);
1944
+ if (alignment && typeof alignmentAxis === "number") {
1945
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1946
+ }
1947
+ return isVertical ? {
1948
+ x: crossAxis * crossAxisMulti,
1949
+ y: mainAxis * mainAxisMulti
1950
+ } : {
1951
+ x: mainAxis * mainAxisMulti,
1952
+ y: crossAxis * crossAxisMulti
1953
+ };
1954
+ }
1955
+ var offset = function(options) {
1956
+ if (options === void 0) {
1957
+ options = 0;
1958
+ }
1959
+ return {
1960
+ name: "offset",
1961
+ options,
1962
+ async fn(state) {
1963
+ var _middlewareData$offse, _middlewareData$arrow;
1964
+ const {
1965
+ x,
1966
+ y,
1967
+ placement,
1968
+ middlewareData
1969
+ } = state;
1970
+ const diffCoords = await convertValueToCoords(state, options);
1971
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1972
+ return {};
1973
+ }
1974
+ return {
1975
+ x: x + diffCoords.x,
1976
+ y: y + diffCoords.y,
1977
+ data: __spreadProps(__spreadValues({}, diffCoords), {
1978
+ placement
1979
+ })
1980
+ };
1496
1981
  }
1497
- if (c3) {
1498
- const t2 = "y" === h3 ? "bottom" : "right";
1499
- x3 = u(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t2]);
1982
+ };
1983
+ };
1984
+ var shift = function(options) {
1985
+ if (options === void 0) {
1986
+ options = {};
1987
+ }
1988
+ return {
1989
+ name: "shift",
1990
+ options,
1991
+ async fn(state) {
1992
+ const {
1993
+ x,
1994
+ y,
1995
+ placement
1996
+ } = state;
1997
+ const _a = evaluate(options, state), {
1998
+ mainAxis: checkMainAxis = true,
1999
+ crossAxis: checkCrossAxis = false,
2000
+ limiter = {
2001
+ fn: (_ref) => {
2002
+ let {
2003
+ x: x2,
2004
+ y: y2
2005
+ } = _ref;
2006
+ return {
2007
+ x: x2,
2008
+ y: y2
2009
+ };
2010
+ }
2011
+ }
2012
+ } = _a, detectOverflowOptions = __objRest(_a, [
2013
+ "mainAxis",
2014
+ "crossAxis",
2015
+ "limiter"
2016
+ ]);
2017
+ const coords = {
2018
+ x,
2019
+ y
2020
+ };
2021
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2022
+ const crossAxis = getSideAxis(getSide(placement));
2023
+ const mainAxis = getOppositeAxis(crossAxis);
2024
+ let mainAxisCoord = coords[mainAxis];
2025
+ let crossAxisCoord = coords[crossAxis];
2026
+ if (checkMainAxis) {
2027
+ const minSide = mainAxis === "y" ? "top" : "left";
2028
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
2029
+ const min2 = mainAxisCoord + overflow[minSide];
2030
+ const max2 = mainAxisCoord - overflow[maxSide];
2031
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
2032
+ }
2033
+ if (checkCrossAxis) {
2034
+ const minSide = crossAxis === "y" ? "top" : "left";
2035
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
2036
+ const min2 = crossAxisCoord + overflow[minSide];
2037
+ const max2 = crossAxisCoord - overflow[maxSide];
2038
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
2039
+ }
2040
+ const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, state), {
2041
+ [mainAxis]: mainAxisCoord,
2042
+ [crossAxis]: crossAxisCoord
2043
+ }));
2044
+ return __spreadProps(__spreadValues({}, limitedCoords), {
2045
+ data: {
2046
+ x: limitedCoords.x - x,
2047
+ y: limitedCoords.y - y
2048
+ }
2049
+ });
1500
2050
  }
1501
- const w3 = f3.fn(__spreadProps(__spreadValues({}, r3), { [p3]: y3, [h3]: x3 }));
1502
- return __spreadProps(__spreadValues({}, w3), { data: { x: w3.x - i3, y: w3.y - o3 } });
1503
- } };
2051
+ };
1504
2052
  };
1505
2053
 
1506
- // node_modules/.pnpm/@floating-ui+dom@0.5.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
1507
- function n2(t2) {
1508
- return t2 && t2.document && t2.location && t2.alert && t2.setInterval;
2054
+ // node_modules/.pnpm/@floating-ui+utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
2055
+ function getNodeName(node) {
2056
+ if (isNode(node)) {
2057
+ return (node.nodeName || "").toLowerCase();
2058
+ }
2059
+ return "#document";
2060
+ }
2061
+ function getWindow(node) {
2062
+ var _node$ownerDocument;
2063
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2064
+ }
2065
+ function getDocumentElement(node) {
2066
+ var _ref;
2067
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2068
+ }
2069
+ function isNode(value) {
2070
+ return value instanceof Node || value instanceof getWindow(value).Node;
2071
+ }
2072
+ function isElement(value) {
2073
+ return value instanceof Element || value instanceof getWindow(value).Element;
2074
+ }
2075
+ function isHTMLElement(value) {
2076
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
2077
+ }
2078
+ function isShadowRoot(value) {
2079
+ if (typeof ShadowRoot === "undefined") {
2080
+ return false;
2081
+ }
2082
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2083
+ }
2084
+ function isOverflowElement(element) {
2085
+ const {
2086
+ overflow,
2087
+ overflowX,
2088
+ overflowY,
2089
+ display
2090
+ } = getComputedStyle(element);
2091
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
2092
+ }
2093
+ function isTableElement(element) {
2094
+ return ["table", "td", "th"].includes(getNodeName(element));
2095
+ }
2096
+ function isContainingBlock(element) {
2097
+ const webkit = isWebKit();
2098
+ const css2 = getComputedStyle(element);
2099
+ 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));
2100
+ }
2101
+ function getContainingBlock(element) {
2102
+ let currentNode = getParentNode(element);
2103
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2104
+ if (isContainingBlock(currentNode)) {
2105
+ return currentNode;
2106
+ } else {
2107
+ currentNode = getParentNode(currentNode);
2108
+ }
2109
+ }
2110
+ return null;
2111
+ }
2112
+ function isWebKit() {
2113
+ if (typeof CSS === "undefined" || !CSS.supports)
2114
+ return false;
2115
+ return CSS.supports("-webkit-backdrop-filter", "none");
1509
2116
  }
1510
- function o2(t2) {
1511
- if (null == t2)
1512
- return window;
1513
- if (!n2(t2)) {
1514
- const e2 = t2.ownerDocument;
1515
- return e2 && e2.defaultView || window;
2117
+ function isLastTraversableNode(node) {
2118
+ return ["html", "body", "#document"].includes(getNodeName(node));
2119
+ }
2120
+ function getComputedStyle(element) {
2121
+ return getWindow(element).getComputedStyle(element);
2122
+ }
2123
+ function getNodeScroll(element) {
2124
+ if (isElement(element)) {
2125
+ return {
2126
+ scrollLeft: element.scrollLeft,
2127
+ scrollTop: element.scrollTop
2128
+ };
2129
+ }
2130
+ return {
2131
+ scrollLeft: element.pageXOffset,
2132
+ scrollTop: element.pageYOffset
2133
+ };
2134
+ }
2135
+ function getParentNode(node) {
2136
+ if (getNodeName(node) === "html") {
2137
+ return node;
2138
+ }
2139
+ const result = (
2140
+ // Step into the shadow DOM of the parent of a slotted node.
2141
+ node.assignedSlot || // DOM Element detected.
2142
+ node.parentNode || // ShadowRoot detected.
2143
+ isShadowRoot(node) && node.host || // Fallback.
2144
+ getDocumentElement(node)
2145
+ );
2146
+ return isShadowRoot(result) ? result.host : result;
2147
+ }
2148
+ function getNearestOverflowAncestor(node) {
2149
+ const parentNode = getParentNode(node);
2150
+ if (isLastTraversableNode(parentNode)) {
2151
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
2152
+ }
2153
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2154
+ return parentNode;
1516
2155
  }
1517
- return t2;
2156
+ return getNearestOverflowAncestor(parentNode);
1518
2157
  }
1519
- function i2(t2) {
1520
- return o2(t2).getComputedStyle(t2);
2158
+ function getOverflowAncestors(node, list, traverseIframes) {
2159
+ var _node$ownerDocument2;
2160
+ if (list === void 0) {
2161
+ list = [];
2162
+ }
2163
+ if (traverseIframes === void 0) {
2164
+ traverseIframes = true;
2165
+ }
2166
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2167
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2168
+ const win = getWindow(scrollableAncestor);
2169
+ if (isBody) {
2170
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
2171
+ }
2172
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1521
2173
  }
1522
- function r2(t2) {
1523
- return n2(t2) ? "" : t2 ? (t2.nodeName || "").toLowerCase() : "";
2174
+
2175
+ // node_modules/.pnpm/@floating-ui+dom@1.6.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
2176
+ function getCssDimensions(element) {
2177
+ const css2 = getComputedStyle(element);
2178
+ let width = parseFloat(css2.width) || 0;
2179
+ let height = parseFloat(css2.height) || 0;
2180
+ const hasOffset = isHTMLElement(element);
2181
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2182
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2183
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2184
+ if (shouldFallback) {
2185
+ width = offsetWidth;
2186
+ height = offsetHeight;
2187
+ }
2188
+ return {
2189
+ width,
2190
+ height,
2191
+ $: shouldFallback
2192
+ };
1524
2193
  }
1525
- function l2() {
1526
- const t2 = navigator.userAgentData;
1527
- return null != t2 && t2.brands ? t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" ") : navigator.userAgent;
2194
+ function unwrapElement(element) {
2195
+ return !isElement(element) ? element.contextElement : element;
1528
2196
  }
1529
- function c2(t2) {
1530
- return t2 instanceof o2(t2).HTMLElement;
2197
+ function getScale(element) {
2198
+ const domElement = unwrapElement(element);
2199
+ if (!isHTMLElement(domElement)) {
2200
+ return createCoords(1);
2201
+ }
2202
+ const rect = domElement.getBoundingClientRect();
2203
+ const {
2204
+ width,
2205
+ height,
2206
+ $
2207
+ } = getCssDimensions(domElement);
2208
+ let x = ($ ? round(rect.width) : rect.width) / width;
2209
+ let y = ($ ? round(rect.height) : rect.height) / height;
2210
+ if (!x || !Number.isFinite(x)) {
2211
+ x = 1;
2212
+ }
2213
+ if (!y || !Number.isFinite(y)) {
2214
+ y = 1;
2215
+ }
2216
+ return {
2217
+ x,
2218
+ y
2219
+ };
1531
2220
  }
1532
- function f2(t2) {
1533
- return t2 instanceof o2(t2).Element;
2221
+ var noOffsets = /* @__PURE__ */ createCoords(0);
2222
+ function getVisualOffsets(element) {
2223
+ const win = getWindow(element);
2224
+ if (!isWebKit() || !win.visualViewport) {
2225
+ return noOffsets;
2226
+ }
2227
+ return {
2228
+ x: win.visualViewport.offsetLeft,
2229
+ y: win.visualViewport.offsetTop
2230
+ };
1534
2231
  }
1535
- function s2(t2) {
1536
- if ("undefined" == typeof ShadowRoot)
2232
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2233
+ if (isFixed === void 0) {
2234
+ isFixed = false;
2235
+ }
2236
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1537
2237
  return false;
1538
- return t2 instanceof o2(t2).ShadowRoot || t2 instanceof ShadowRoot;
1539
- }
1540
- function u2(t2) {
1541
- const { overflow: e2, overflowX: n3, overflowY: o3 } = i2(t2);
1542
- return /auto|scroll|overlay|hidden/.test(e2 + o3 + n3);
1543
- }
1544
- function d2(t2) {
1545
- return ["table", "td", "th"].includes(r2(t2));
1546
- }
1547
- function h2(t2) {
1548
- const e2 = /firefox/i.test(l2()), n3 = i2(t2);
1549
- 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;
1550
- }
1551
- function a2() {
1552
- return !/^((?!chrome|android).)*safari/i.test(l2());
1553
- }
1554
- var g2 = Math.min;
1555
- var p2 = Math.max;
1556
- var m2 = Math.round;
1557
- function w2(t2, e2, n3) {
1558
- var i3, r3, l3, s3;
1559
- void 0 === e2 && (e2 = false), void 0 === n3 && (n3 = false);
1560
- const u3 = t2.getBoundingClientRect();
1561
- let d3 = 1, h3 = 1;
1562
- e2 && c2(t2) && (d3 = t2.offsetWidth > 0 && m2(u3.width) / t2.offsetWidth || 1, h3 = t2.offsetHeight > 0 && m2(u3.height) / t2.offsetHeight || 1);
1563
- 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;
1564
- return { width: y3, height: x3, top: v3, right: w3 + y3, bottom: v3 + x3, left: w3, x: w3, y: v3 };
1565
- }
1566
- function v2(t2) {
1567
- return (e2 = t2, (e2 instanceof o2(e2).Node ? t2.ownerDocument : t2.document) || window.document).documentElement;
1568
- var e2;
1569
- }
1570
- function y2(t2) {
1571
- return f2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
1572
- }
1573
- function x2(t2) {
1574
- return w2(v2(t2)).left + y2(t2).scrollLeft;
1575
- }
1576
- function b2(t2, e2, n3) {
1577
- const o3 = c2(e2), i3 = v2(e2), l3 = w2(t2, o3 && function(t3) {
1578
- const e3 = w2(t3);
1579
- return m2(e3.width) !== t3.offsetWidth || m2(e3.height) !== t3.offsetHeight;
1580
- }(e2), "fixed" === n3);
1581
- let f3 = { scrollLeft: 0, scrollTop: 0 };
1582
- const s3 = { x: 0, y: 0 };
1583
- if (o3 || !o3 && "fixed" !== n3)
1584
- if (("body" !== r2(e2) || u2(i3)) && (f3 = y2(e2)), c2(e2)) {
1585
- const t3 = w2(e2, true);
1586
- s3.x = t3.x + e2.clientLeft, s3.y = t3.y + e2.clientTop;
1587
- } else
1588
- i3 && (s3.x = x2(i3));
1589
- return { x: l3.left + f3.scrollLeft - s3.x, y: l3.top + f3.scrollTop - s3.y, width: l3.width, height: l3.height };
1590
- }
1591
- function L2(t2) {
1592
- return "html" === r2(t2) ? t2 : t2.assignedSlot || t2.parentNode || (s2(t2) ? t2.host : null) || v2(t2);
1593
- }
1594
- function R(t2) {
1595
- return c2(t2) && "fixed" !== getComputedStyle(t2).position ? t2.offsetParent : null;
1596
- }
1597
- function T2(t2) {
1598
- const e2 = o2(t2);
1599
- let n3 = R(t2);
1600
- for (; n3 && d2(n3) && "static" === getComputedStyle(n3).position; )
1601
- n3 = R(n3);
1602
- return n3 && ("html" === r2(n3) || "body" === r2(n3) && "static" === getComputedStyle(n3).position && !h2(n3)) ? e2 : n3 || function(t3) {
1603
- let e3 = L2(t3);
1604
- for (s2(e3) && (e3 = e3.host); c2(e3) && !["html", "body"].includes(r2(e3)); ) {
1605
- if (h2(e3))
1606
- return e3;
1607
- e3 = e3.parentNode;
2238
+ }
2239
+ return isFixed;
2240
+ }
2241
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2242
+ if (includeScale === void 0) {
2243
+ includeScale = false;
2244
+ }
2245
+ if (isFixedStrategy === void 0) {
2246
+ isFixedStrategy = false;
2247
+ }
2248
+ const clientRect = element.getBoundingClientRect();
2249
+ const domElement = unwrapElement(element);
2250
+ let scale = createCoords(1);
2251
+ if (includeScale) {
2252
+ if (offsetParent) {
2253
+ if (isElement(offsetParent)) {
2254
+ scale = getScale(offsetParent);
2255
+ }
2256
+ } else {
2257
+ scale = getScale(element);
1608
2258
  }
1609
- return null;
1610
- }(t2) || e2;
1611
- }
1612
- function W(t2) {
1613
- if (c2(t2))
1614
- return { width: t2.offsetWidth, height: t2.offsetHeight };
1615
- const e2 = w2(t2);
1616
- return { width: e2.width, height: e2.height };
1617
- }
1618
- function E2(t2) {
1619
- const e2 = L2(t2);
1620
- return ["html", "body", "#document"].includes(r2(e2)) ? t2.ownerDocument.body : c2(e2) && u2(e2) ? e2 : E2(e2);
1621
- }
1622
- function H(t2, e2) {
1623
- var n3;
1624
- void 0 === e2 && (e2 = []);
1625
- 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);
1626
- return r3 ? f3 : f3.concat(H(c3));
1627
- }
1628
- function C(e2, n3, r3) {
1629
- return "viewport" === n3 ? l(function(t2, e3) {
1630
- const n4 = o2(t2), i3 = v2(t2), r4 = n4.visualViewport;
1631
- let l3 = i3.clientWidth, c3 = i3.clientHeight, f3 = 0, s3 = 0;
1632
- if (r4) {
1633
- l3 = r4.width, c3 = r4.height;
1634
- const t3 = a2();
1635
- (t3 || !t3 && "fixed" === e3) && (f3 = r4.offsetLeft, s3 = r4.offsetTop);
2259
+ }
2260
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2261
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2262
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2263
+ let width = clientRect.width / scale.x;
2264
+ let height = clientRect.height / scale.y;
2265
+ if (domElement) {
2266
+ const win = getWindow(domElement);
2267
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2268
+ let currentWin = win;
2269
+ let currentIFrame = currentWin.frameElement;
2270
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2271
+ const iframeScale = getScale(currentIFrame);
2272
+ const iframeRect = currentIFrame.getBoundingClientRect();
2273
+ const css2 = getComputedStyle(currentIFrame);
2274
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x;
2275
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
2276
+ x *= iframeScale.x;
2277
+ y *= iframeScale.y;
2278
+ width *= iframeScale.x;
2279
+ height *= iframeScale.y;
2280
+ x += left;
2281
+ y += top;
2282
+ currentWin = getWindow(currentIFrame);
2283
+ currentIFrame = currentWin.frameElement;
2284
+ }
2285
+ }
2286
+ return rectToClientRect({
2287
+ width,
2288
+ height,
2289
+ x,
2290
+ y
2291
+ });
2292
+ }
2293
+ var topLayerSelectors = [":popover-open", ":modal"];
2294
+ function isTopLayer(floating) {
2295
+ return topLayerSelectors.some((selector) => {
2296
+ try {
2297
+ return floating.matches(selector);
2298
+ } catch (e) {
2299
+ return false;
2300
+ }
2301
+ });
2302
+ }
2303
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2304
+ let {
2305
+ elements,
2306
+ rect,
2307
+ offsetParent,
2308
+ strategy
2309
+ } = _ref;
2310
+ const isFixed = strategy === "fixed";
2311
+ const documentElement = getDocumentElement(offsetParent);
2312
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2313
+ if (offsetParent === documentElement || topLayer && isFixed) {
2314
+ return rect;
2315
+ }
2316
+ let scroll = {
2317
+ scrollLeft: 0,
2318
+ scrollTop: 0
2319
+ };
2320
+ let scale = createCoords(1);
2321
+ const offsets = createCoords(0);
2322
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2323
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2324
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
2325
+ scroll = getNodeScroll(offsetParent);
1636
2326
  }
1637
- return { width: l3, height: c3, x: f3, y: s3 };
1638
- }(e2, r3)) : f2(n3) ? function(t2, e3) {
1639
- const n4 = w2(t2, false, "fixed" === e3), o3 = n4.top + t2.clientTop, i3 = n4.left + t2.clientLeft;
1640
- return { top: o3, left: i3, x: i3, y: o3, right: i3 + t2.clientWidth, bottom: o3 + t2.clientHeight, width: t2.clientWidth, height: t2.clientHeight };
1641
- }(n3, r3) : l(function(t2) {
1642
- var e3;
1643
- 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);
1644
- let f3 = -o3.scrollLeft + x2(t2);
1645
- const s3 = -o3.scrollTop;
1646
- return "rtl" === i2(r4 || n4).direction && (f3 += p2(n4.clientWidth, r4 ? r4.clientWidth : 0) - l3), { width: l3, height: c3, x: f3, y: s3 };
1647
- }(v2(e2)));
1648
- }
1649
- function S(t2) {
1650
- const e2 = H(t2), n3 = ["absolute", "fixed"].includes(i2(t2).position) && c2(t2) ? T2(t2) : t2;
1651
- return f2(n3) ? e2.filter((t3) => f2(t3) && function(t4, e3) {
1652
- const n4 = null == e3.getRootNode ? void 0 : e3.getRootNode();
1653
- if (t4.contains(e3))
1654
- return true;
1655
- if (n4 && s2(n4)) {
1656
- let n5 = e3;
1657
- do {
1658
- if (n5 && t4 === n5)
1659
- return true;
1660
- n5 = n5.parentNode || n5.host;
1661
- } while (n5);
2327
+ if (isHTMLElement(offsetParent)) {
2328
+ const offsetRect = getBoundingClientRect(offsetParent);
2329
+ scale = getScale(offsetParent);
2330
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2331
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2332
+ }
2333
+ }
2334
+ return {
2335
+ width: rect.width * scale.x,
2336
+ height: rect.height * scale.y,
2337
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2338
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2339
+ };
2340
+ }
2341
+ function getClientRects(element) {
2342
+ return Array.from(element.getClientRects());
2343
+ }
2344
+ function getWindowScrollBarX(element) {
2345
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2346
+ }
2347
+ function getDocumentRect(element) {
2348
+ const html3 = getDocumentElement(element);
2349
+ const scroll = getNodeScroll(element);
2350
+ const body = element.ownerDocument.body;
2351
+ const width = max(html3.scrollWidth, html3.clientWidth, body.scrollWidth, body.clientWidth);
2352
+ const height = max(html3.scrollHeight, html3.clientHeight, body.scrollHeight, body.clientHeight);
2353
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2354
+ const y = -scroll.scrollTop;
2355
+ if (getComputedStyle(body).direction === "rtl") {
2356
+ x += max(html3.clientWidth, body.clientWidth) - width;
2357
+ }
2358
+ return {
2359
+ width,
2360
+ height,
2361
+ x,
2362
+ y
2363
+ };
2364
+ }
2365
+ function getViewportRect(element, strategy) {
2366
+ const win = getWindow(element);
2367
+ const html3 = getDocumentElement(element);
2368
+ const visualViewport = win.visualViewport;
2369
+ let width = html3.clientWidth;
2370
+ let height = html3.clientHeight;
2371
+ let x = 0;
2372
+ let y = 0;
2373
+ if (visualViewport) {
2374
+ width = visualViewport.width;
2375
+ height = visualViewport.height;
2376
+ const visualViewportBased = isWebKit();
2377
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
2378
+ x = visualViewport.offsetLeft;
2379
+ y = visualViewport.offsetTop;
1662
2380
  }
2381
+ }
2382
+ return {
2383
+ width,
2384
+ height,
2385
+ x,
2386
+ y
2387
+ };
2388
+ }
2389
+ function getInnerBoundingClientRect(element, strategy) {
2390
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
2391
+ const top = clientRect.top + element.clientTop;
2392
+ const left = clientRect.left + element.clientLeft;
2393
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2394
+ const width = element.clientWidth * scale.x;
2395
+ const height = element.clientHeight * scale.y;
2396
+ const x = left * scale.x;
2397
+ const y = top * scale.y;
2398
+ return {
2399
+ width,
2400
+ height,
2401
+ x,
2402
+ y
2403
+ };
2404
+ }
2405
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2406
+ let rect;
2407
+ if (clippingAncestor === "viewport") {
2408
+ rect = getViewportRect(element, strategy);
2409
+ } else if (clippingAncestor === "document") {
2410
+ rect = getDocumentRect(getDocumentElement(element));
2411
+ } else if (isElement(clippingAncestor)) {
2412
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2413
+ } else {
2414
+ const visualOffsets = getVisualOffsets(element);
2415
+ rect = __spreadProps(__spreadValues({}, clippingAncestor), {
2416
+ x: clippingAncestor.x - visualOffsets.x,
2417
+ y: clippingAncestor.y - visualOffsets.y
2418
+ });
2419
+ }
2420
+ return rectToClientRect(rect);
2421
+ }
2422
+ function hasFixedPositionAncestor(element, stopNode) {
2423
+ const parentNode = getParentNode(element);
2424
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1663
2425
  return false;
1664
- }(t3, n3) && "body" !== r2(t3)) : [];
1665
- }
1666
- var D2 = { getClippingRect: function(t2) {
1667
- let { element: e2, boundary: n3, rootBoundary: o3, strategy: i3 } = t2;
1668
- const r3 = [..."clippingAncestors" === n3 ? S(e2) : [].concat(n3), o3], l3 = r3[0], c3 = r3.reduce((t3, n4) => {
1669
- const o4 = C(e2, n4, i3);
1670
- 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;
1671
- }, C(e2, l3, i3));
1672
- return { width: c3.right - c3.left, height: c3.bottom - c3.top, x: c3.left, y: c3.top };
1673
- }, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) {
1674
- let { rect: e2, offsetParent: n3, strategy: o3 } = t2;
1675
- const i3 = c2(n3), l3 = v2(n3);
1676
- if (n3 === l3)
1677
- return e2;
1678
- let f3 = { scrollLeft: 0, scrollTop: 0 };
1679
- const s3 = { x: 0, y: 0 };
1680
- if ((i3 || !i3 && "fixed" !== o3) && (("body" !== r2(n3) || u2(l3)) && (f3 = y2(n3)), c2(n3))) {
1681
- const t3 = w2(n3, true);
1682
- s3.x = t3.x + n3.clientLeft, s3.y = t3.y + n3.clientTop;
1683
- }
1684
- return __spreadProps(__spreadValues({}, e2), { x: e2.x - f3.scrollLeft + s3.x, y: e2.y - f3.scrollTop + s3.y });
1685
- }, isElement: f2, getDimensions: W, getOffsetParent: T2, getDocumentElement: v2, getElementRects: (t2) => {
1686
- let { reference: e2, floating: n3, strategy: o3 } = t2;
1687
- return { reference: b2(e2, T2(n3), o3), floating: __spreadProps(__spreadValues({}, W(n3)), { x: 0, y: 0 }) };
1688
- }, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === i2(t2).direction };
1689
- var z = (t2, n3, o3) => o(t2, n3, __spreadValues({ platform: D2 }, o3));
2426
+ }
2427
+ return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
2428
+ }
2429
+ function getClippingElementAncestors(element, cache2) {
2430
+ const cachedResult = cache2.get(element);
2431
+ if (cachedResult) {
2432
+ return cachedResult;
2433
+ }
2434
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
2435
+ let currentContainingBlockComputedStyle = null;
2436
+ const elementIsFixed = getComputedStyle(element).position === "fixed";
2437
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
2438
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2439
+ const computedStyle = getComputedStyle(currentNode);
2440
+ const currentNodeIsContaining = isContainingBlock(currentNode);
2441
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
2442
+ currentContainingBlockComputedStyle = null;
2443
+ }
2444
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2445
+ if (shouldDropCurrentNode) {
2446
+ result = result.filter((ancestor) => ancestor !== currentNode);
2447
+ } else {
2448
+ currentContainingBlockComputedStyle = computedStyle;
2449
+ }
2450
+ currentNode = getParentNode(currentNode);
2451
+ }
2452
+ cache2.set(element, result);
2453
+ return result;
2454
+ }
2455
+ function getClippingRect(_ref) {
2456
+ let {
2457
+ element,
2458
+ boundary,
2459
+ rootBoundary,
2460
+ strategy
2461
+ } = _ref;
2462
+ const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
2463
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2464
+ const firstClippingAncestor = clippingAncestors[0];
2465
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2466
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2467
+ accRect.top = max(rect.top, accRect.top);
2468
+ accRect.right = min(rect.right, accRect.right);
2469
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2470
+ accRect.left = max(rect.left, accRect.left);
2471
+ return accRect;
2472
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2473
+ return {
2474
+ width: clippingRect.right - clippingRect.left,
2475
+ height: clippingRect.bottom - clippingRect.top,
2476
+ x: clippingRect.left,
2477
+ y: clippingRect.top
2478
+ };
2479
+ }
2480
+ function getDimensions(element) {
2481
+ const {
2482
+ width,
2483
+ height
2484
+ } = getCssDimensions(element);
2485
+ return {
2486
+ width,
2487
+ height
2488
+ };
2489
+ }
2490
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2491
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2492
+ const documentElement = getDocumentElement(offsetParent);
2493
+ const isFixed = strategy === "fixed";
2494
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2495
+ let scroll = {
2496
+ scrollLeft: 0,
2497
+ scrollTop: 0
2498
+ };
2499
+ const offsets = createCoords(0);
2500
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2501
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
2502
+ scroll = getNodeScroll(offsetParent);
2503
+ }
2504
+ if (isOffsetParentAnElement) {
2505
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2506
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2507
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2508
+ } else if (documentElement) {
2509
+ offsets.x = getWindowScrollBarX(documentElement);
2510
+ }
2511
+ }
2512
+ const x = rect.left + scroll.scrollLeft - offsets.x;
2513
+ const y = rect.top + scroll.scrollTop - offsets.y;
2514
+ return {
2515
+ x,
2516
+ y,
2517
+ width: rect.width,
2518
+ height: rect.height
2519
+ };
2520
+ }
2521
+ function getTrueOffsetParent(element, polyfill) {
2522
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
2523
+ return null;
2524
+ }
2525
+ if (polyfill) {
2526
+ return polyfill(element);
2527
+ }
2528
+ return element.offsetParent;
2529
+ }
2530
+ function getOffsetParent(element, polyfill) {
2531
+ const window2 = getWindow(element);
2532
+ if (!isHTMLElement(element) || isTopLayer(element)) {
2533
+ return window2;
2534
+ }
2535
+ let offsetParent = getTrueOffsetParent(element, polyfill);
2536
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
2537
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2538
+ }
2539
+ if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
2540
+ return window2;
2541
+ }
2542
+ return offsetParent || getContainingBlock(element) || window2;
2543
+ }
2544
+ var getElementRects = async function(data) {
2545
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2546
+ const getDimensionsFn = this.getDimensions;
2547
+ return {
2548
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2549
+ floating: __spreadValues({
2550
+ x: 0,
2551
+ y: 0
2552
+ }, await getDimensionsFn(data.floating))
2553
+ };
2554
+ };
2555
+ function isRTL(element) {
2556
+ return getComputedStyle(element).direction === "rtl";
2557
+ }
2558
+ var platform = {
2559
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2560
+ getDocumentElement,
2561
+ getClippingRect,
2562
+ getOffsetParent,
2563
+ getElementRects,
2564
+ getClientRects,
2565
+ getDimensions,
2566
+ getScale,
2567
+ isElement,
2568
+ isRTL
2569
+ };
2570
+ var autoPlacement2 = autoPlacement;
2571
+ var shift2 = shift;
2572
+ var flip2 = flip;
2573
+ var arrow2 = arrow;
2574
+ var computePosition2 = (reference, floating, options) => {
2575
+ const cache2 = /* @__PURE__ */ new Map();
2576
+ const mergedOptions = __spreadValues({
2577
+ platform
2578
+ }, options);
2579
+ const platformWithCache = __spreadProps(__spreadValues({}, mergedOptions.platform), {
2580
+ _c: cache2
2581
+ });
2582
+ return computePosition(reference, floating, __spreadProps(__spreadValues({}, mergedOptions), {
2583
+ platform: platformWithCache
2584
+ }));
2585
+ };
1690
2586
 
1691
- // node_modules/.pnpm/@warp-ds+core@1.0.2/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
2587
+ // node_modules/.pnpm/@warp-ds+core@1.1.0_@floating-ui+dom@1.6.3/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
2588
+ var TOP_START = "top-start";
1692
2589
  var TOP = "top";
2590
+ var TOP_END = "top-end";
2591
+ var RIGHT_START = "right-start";
2592
+ var RIGHT = "right";
2593
+ var RIGHT_END = "right-end";
2594
+ var BOTTOM_START = "bottom-start";
1693
2595
  var BOTTOM = "bottom";
2596
+ var BOTTOM_END = "bottom-end";
2597
+ var LEFT_START = "left-start";
1694
2598
  var LEFT = "left";
1695
- var RIGHT = "right";
2599
+ var LEFT_END = "left-end";
2600
+ var directions = [
2601
+ TOP_START,
2602
+ TOP,
2603
+ TOP_END,
2604
+ RIGHT_START,
2605
+ RIGHT,
2606
+ RIGHT_END,
2607
+ BOTTOM_START,
2608
+ BOTTOM,
2609
+ BOTTOM_END,
2610
+ LEFT_START,
2611
+ LEFT,
2612
+ LEFT_END
2613
+ ];
1696
2614
  var opposites = {
2615
+ [TOP_START]: BOTTOM_START,
1697
2616
  [TOP]: BOTTOM,
2617
+ [TOP_END]: BOTTOM_END,
2618
+ [BOTTOM_START]: TOP_START,
1698
2619
  [BOTTOM]: TOP,
2620
+ [BOTTOM_END]: TOP_END,
2621
+ [LEFT_START]: RIGHT_START,
1699
2622
  [LEFT]: RIGHT,
1700
- [RIGHT]: LEFT
1701
- };
1702
- var arrowLabels = {
1703
- [TOP]: "\u2191",
1704
- [BOTTOM]: "\u2193",
1705
- [LEFT]: "\u2190",
1706
- [RIGHT]: "\u2192"
2623
+ [LEFT_END]: RIGHT_END,
2624
+ [RIGHT_START]: LEFT_START,
2625
+ [RIGHT]: LEFT,
2626
+ [RIGHT_END]: LEFT_END
1707
2627
  };
1708
2628
  var rotation = {
2629
+ [LEFT_START]: -45,
1709
2630
  [LEFT]: -45,
2631
+ [LEFT_END]: -45,
2632
+ [TOP_START]: 45,
1710
2633
  [TOP]: 45,
2634
+ [TOP_END]: 45,
2635
+ [RIGHT_START]: 135,
1711
2636
  [RIGHT]: 135,
1712
- [BOTTOM]: -135
2637
+ [RIGHT_END]: 135,
2638
+ [BOTTOM_START]: -135,
2639
+ [BOTTOM]: -135,
2640
+ [BOTTOM_END]: -135
1713
2641
  };
1714
2642
  var middlePosition = "calc(50% - 7px)";
1715
- var isDirectionVertical = (name) => [TOP, BOTTOM].includes(name);
1716
- function computeCalloutArrow({ actualDirection, directionName, arrowEl }) {
2643
+ var isDirectionVertical = (name) => [TOP_START, TOP, TOP_END, BOTTOM_START, BOTTOM, BOTTOM_END].includes(name);
2644
+ var arrowDirectionClassname = (dir) => {
2645
+ let direction;
2646
+ if (/-/.test(dir)) {
2647
+ direction = dir.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join("");
2648
+ } else {
2649
+ direction = dir.charAt(0).toUpperCase() + dir.slice(1);
2650
+ }
2651
+ return direction;
2652
+ };
2653
+ var side = (dir) => dir.split("-")[0];
2654
+ var staticSide = (dir) => opposites[side(dir)];
2655
+ var arrowDirection = (dir) => opposites[dir];
2656
+ var arrowRotation = (dir) => rotation[arrowDirection(dir)];
2657
+ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
2658
+ Object.assign(arrowEl == null ? void 0 : arrowEl.style, {
2659
+ borderTopLeftRadius: "4px",
2660
+ zIndex: 1,
2661
+ // border alignment is off by a fraction of a pixel, this fixes it
2662
+ [`margin${arrowDirectionClassname(staticSide(dir))}`]: "-0.5px",
2663
+ transform: `rotate(${arrowRotation2}deg)`
2664
+ });
2665
+ };
2666
+ function computeCalloutArrow({ actualDirection, directionName = BOTTOM, arrowEl }) {
1717
2667
  if (!arrowEl)
1718
2668
  return;
1719
2669
  actualDirection = directionName;
1720
2670
  const directionIsVertical = isDirectionVertical(directionName);
1721
- arrowEl.style.left = directionIsVertical ? middlePosition : "";
1722
- arrowEl.style.top = !directionIsVertical ? middlePosition : "";
2671
+ Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
2672
+ left: directionIsVertical ? middlePosition : "",
2673
+ top: !directionIsVertical ? middlePosition : ""
2674
+ });
2675
+ applyArrowStyles(arrowEl, arrowRotation(actualDirection), actualDirection);
1723
2676
  }
1724
2677
  async function useRecompute(state) {
1725
- var _a, _b;
1726
- if (!state.isShowing)
2678
+ var _a, _b, _c;
2679
+ if (!(state == null ? void 0 : state.isShowing))
1727
2680
  return;
1728
- await ((_a = state == null ? void 0 : state.waitForDOM) == null ? void 0 : _a.call(state));
1729
- if (state.isCallout)
2681
+ if (state == null ? void 0 : state.waitForDOM) {
2682
+ await (state == null ? void 0 : state.waitForDOM());
2683
+ }
2684
+ if (state == null ? void 0 : state.isCallout)
1730
2685
  return computeCalloutArrow(state);
1731
- const position = await z(state.targetEl, state.attentionEl, {
1732
- placement: state.directionName,
2686
+ if (!(state == null ? void 0 : state.targetEl) || !(state == null ? void 0 : state.attentionEl))
2687
+ return;
2688
+ const targetEl = state == null ? void 0 : state.targetEl;
2689
+ const attentionEl = state == null ? void 0 : state.attentionEl;
2690
+ computePosition2(targetEl, attentionEl, {
2691
+ placement: (_a = state == null ? void 0 : state.directionName) != null ? _a : BOTTOM,
1733
2692
  middleware: [
1734
- // Should we make this configurable, but have these as sane defaults?
1735
- b(),
1736
- T(8),
1737
- D({ padding: 16 }),
1738
- // @ts-ignore
1739
- m({ element: state.noArrow ? void 0 : state.arrowEl })
1740
- // FIXME
2693
+ offset({ mainAxis: (_b = state == null ? void 0 : state.distance) != null ? _b : 8, crossAxis: (_c = state == null ? void 0 : state.skidding) != null ? _c : 0 }),
2694
+ (state == null ? void 0 : state.flip) && flip2({
2695
+ fallbackAxisSideDirection: "start",
2696
+ fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
2697
+ }),
2698
+ !(state == null ? void 0 : state.flip) && autoPlacement2(),
2699
+ shift2({ padding: 16 }),
2700
+ !(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl })
1741
2701
  ]
2702
+ }).then(({ x, y, middlewareData, placement }) => {
2703
+ state.actualDirection = placement;
2704
+ Object.assign(attentionEl == null ? void 0 : attentionEl.style, {
2705
+ left: `${x}px`,
2706
+ top: `${y}px`
2707
+ });
2708
+ const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
2709
+ const arrowPlacement = arrowDirection(placement).split("-")[1];
2710
+ if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
2711
+ const arrowEl = state == null ? void 0 : state.arrowEl;
2712
+ const { x: x2, y: y2 } = middlewareData == null ? void 0 : middlewareData.arrow;
2713
+ let top = "";
2714
+ let right = "";
2715
+ let bottom = "";
2716
+ let left = "";
2717
+ if (arrowPlacement === "start") {
2718
+ const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2719
+ top = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2720
+ right = isRtl ? value : "";
2721
+ left = isRtl ? "" : value;
2722
+ } else if (arrowPlacement === "end") {
2723
+ const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2724
+ right = isRtl ? "" : value;
2725
+ left = isRtl ? value : "";
2726
+ bottom = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
2727
+ } else {
2728
+ left = typeof x2 === "number" ? `${x2}px` : "";
2729
+ top = typeof y2 === "number" ? `${y2}px` : "";
2730
+ }
2731
+ Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
2732
+ top,
2733
+ right,
2734
+ bottom,
2735
+ left
2736
+ });
2737
+ applyArrowStyles(arrowEl, arrowRotation(placement), placement);
2738
+ }
1742
2739
  });
1743
- state.actualDirection = position.placement;
1744
- Object.assign(((_b = state.attentionEl) == null ? void 0 : _b.style) || {}, {
1745
- left: "0",
1746
- top: "0",
1747
- transform: `translate3d(${Math.round(position.x)}px, ${Math.round(position.y)}px, 0)`
1748
- });
1749
- let { x: x3, y: y3 } = position.middlewareData.arrow;
1750
- if (state.arrowEl) {
1751
- state.arrowEl.style.left = x3 ? x3 + "px" : "";
1752
- state.arrowEl.style.top = y3 ? y3 + "px" : "";
1753
- }
2740
+ return state;
1754
2741
  }
1755
2742
 
1756
2743
  // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
@@ -1778,7 +2765,7 @@ function processTokens(tokens, mapText) {
1778
2765
  return [token.arg, token.key];
1779
2766
  }
1780
2767
  }
1781
- const offset = token.pluralOffset;
2768
+ const offset2 = token.pluralOffset;
1782
2769
  const formatProps = {};
1783
2770
  token.cases.forEach((item) => {
1784
2771
  formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
@@ -1790,16 +2777,16 @@ function processTokens(tokens, mapText) {
1790
2777
  token.arg,
1791
2778
  token.type,
1792
2779
  __spreadValues({
1793
- offset
2780
+ offset: offset2
1794
2781
  }, formatProps)
1795
2782
  ];
1796
2783
  });
1797
2784
  }
1798
- function compileMessage(message, mapText = (v3) => v3) {
2785
+ function compileMessage(message, mapText = (v) => v) {
1799
2786
  try {
1800
2787
  return processTokens((0, import_parser.parse)(message), mapText);
1801
- } catch (e2) {
1802
- console.error(`${e2.message}
2788
+ } catch (e) {
2789
+ console.error(`${e.message}
1803
2790
 
1804
2791
  Message: ${message}`);
1805
2792
  return message;
@@ -1807,8 +2794,8 @@ Message: ${message}`);
1807
2794
  }
1808
2795
 
1809
2796
  // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
1810
- var isString = (s3) => typeof s3 === "string";
1811
- var isFunction = (f3) => typeof f3 === "function";
2797
+ var isString = (s) => typeof s === "string";
2798
+ var isFunction = (f) => typeof f === "function";
1812
2799
  var cache = /* @__PURE__ */ new Map();
1813
2800
  var defaultLocale = "en";
1814
2801
  function normalizeLocales(locales) {
@@ -1832,7 +2819,7 @@ function number(locales, value, format) {
1832
2819
  return formatter.format(value);
1833
2820
  }
1834
2821
  function plural(locales, ordinal, value, _a) {
1835
- var _b = _a, { offset = 0 } = _b, rules = __objRest(_b, ["offset"]);
2822
+ var _b = _a, { offset: offset2 = 0 } = _b, rules = __objRest(_b, ["offset"]);
1836
2823
  var _a2, _b2;
1837
2824
  const _locales = normalizeLocales(locales);
1838
2825
  const plurals = ordinal ? getMemoized(
@@ -1842,7 +2829,7 @@ function plural(locales, ordinal, value, _a) {
1842
2829
  () => cacheKey("plural-cardinal", _locales),
1843
2830
  () => new Intl.PluralRules(_locales, { type: "cardinal" })
1844
2831
  );
1845
- return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset)]) != null ? _b2 : rules.other;
2832
+ return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset2)]) != null ? _b2 : rules.other;
1846
2833
  }
1847
2834
  function getMemoized(getKey, construct) {
1848
2835
  const key = getKey();
@@ -1871,14 +2858,14 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1871
2858
  };
1872
2859
  return {
1873
2860
  plural: (value, cases) => {
1874
- const { offset = 0 } = cases;
2861
+ const { offset: offset2 = 0 } = cases;
1875
2862
  const message = plural(locales, false, value, cases);
1876
- return replaceOctothorpe(value - offset, message);
2863
+ return replaceOctothorpe(value - offset2, message);
1877
2864
  },
1878
2865
  selectordinal: (value, cases) => {
1879
- const { offset = 0 } = cases;
2866
+ const { offset: offset2 = 0 } = cases;
1880
2867
  const message = plural(locales, true, value, cases);
1881
- return replaceOctothorpe(value - offset, message);
2868
+ return replaceOctothorpe(value - offset2, message);
1882
2869
  },
1883
2870
  select: selectFormatter,
1884
2871
  number: (value, format) => number(locales, value, style(format)),
@@ -2140,8 +3127,8 @@ function detectLocale() {
2140
3127
  try {
2141
3128
  const htmlLocale = document.documentElement.lang;
2142
3129
  return getSupportedLocale(htmlLocale);
2143
- } catch (e2) {
2144
- console.warn("could not detect locale, falling back to source locale", e2);
3130
+ } catch (e) {
3131
+ console.warn("could not detect locale, falling back to source locale", e);
2145
3132
  return defaultLocale2;
2146
3133
  }
2147
3134
  }
@@ -2221,8 +3208,8 @@ function detectLocale2() {
2221
3208
  return getSupportedLocale2(hostLocale);
2222
3209
  }
2223
3210
  return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
2224
- } catch (e2) {
2225
- console.warn("could not detect locale, falling back to source locale", e2);
3211
+ } catch (e) {
3212
+ console.warn("could not detect locale, falling back to source locale", e);
2226
3213
  return defaultLocale3;
2227
3214
  }
2228
3215
  }
@@ -2255,30 +3242,128 @@ var WarpAttention = class extends kebabCaseAttributes(WarpElement) {
2255
3242
  constructor() {
2256
3243
  super();
2257
3244
  activateI18n(messages, messages2, messages3);
3245
+ this.handleDone = this.handleDone.bind(this);
2258
3246
  this.show = false;
3247
+ this.placement = "bottom";
2259
3248
  this.tooltip = false;
2260
3249
  this.callout = false;
2261
3250
  this.popover = false;
2262
3251
  this.highlight = false;
2263
3252
  this.canClose = false;
2264
3253
  this.noArrow = false;
3254
+ this.distance = 8;
3255
+ this.skidding = 0;
3256
+ this.flip = false;
3257
+ this._initialPlacement = this.placement;
3258
+ this._actualDirection = this.placement;
2265
3259
  }
2266
3260
  connectedCallback() {
2267
3261
  super.connectedCallback();
2268
- if (!this.placement || !Object.keys(opposites).includes(this.placement)) {
3262
+ if (this.placement && !Object.keys(opposites).includes(this.placement)) {
2269
3263
  throw new Error(`Invalid "placement" attribute. Set its value to one of the following:
2270
3264
  ${JSON.stringify(Object.keys(opposites))}`);
3265
+ }
3266
+ if (this.fallbackPlacements && !this.fallbackPlacements.every((fallbackPlacement) => directions.includes(fallbackPlacement))) {
3267
+ throw new Error(`Invalid "fallbackPlacements" attribute. Set its value to an array with one or more of the following:
3268
+ ${JSON.stringify(directions)}`);
2271
3269
  }
2272
3270
  setTimeout(() => this.requestUpdate(), 0);
3271
+ if (!this.callout) {
3272
+ window.addEventListener("click", this.handleDone);
3273
+ window.addEventListener("scroll", this.handleDone);
3274
+ window.addEventListener("resize", this.handleDone);
3275
+ window.addEventListener("touch", this.handleDone);
3276
+ }
3277
+ if (this.tooltip) {
3278
+ window.addEventListener("mouseover", this.handleDone);
3279
+ window.addEventListener("mouseout", this.handleDone);
3280
+ }
3281
+ }
3282
+ disconnectedCallback() {
3283
+ window.removeEventListener("click", this.handleDone);
3284
+ window.removeEventListener("scroll", this.handleDone);
3285
+ window.removeEventListener("resize", this.handleDone);
3286
+ window.removeEventListener("touch", this.handleDone);
3287
+ window.removeEventListener("mouseover", this.handleDone);
3288
+ window.removeEventListener("mouseout", this.handleDone);
3289
+ super.disconnectedCallback();
3290
+ }
3291
+ handleDone() {
3292
+ window.requestAnimationFrame(() => {
3293
+ if (this.show && this._targetEl && this._attentionEl) {
3294
+ useRecompute(this.attentionState).then((state) => {
3295
+ this._actualDirection = state == null ? void 0 : state.actualDirection;
3296
+ });
3297
+ } else {
3298
+ this._actualDirection = this._initialPlacement;
3299
+ }
3300
+ });
2273
3301
  }
2274
3302
  get _actualDirection() {
2275
3303
  return this.placement;
2276
3304
  }
2277
- set _actualDirection(v3) {
2278
- this.placement = v3;
3305
+ set _actualDirection(v) {
3306
+ this.placement = v;
3307
+ }
3308
+ get _arrowEl() {
3309
+ return this.renderRoot.querySelector("#arrow");
2279
3310
  }
2280
3311
  get _arrowDirection() {
2281
- return opposites[this.placement];
3312
+ return opposites[this._actualDirection];
3313
+ }
3314
+ get _arrowClasses() {
3315
+ return classes({
3316
+ [attention.arrowBase]: true,
3317
+ [attention[`arrowDirection${arrowDirectionClassname(this._arrowDirection)}`]]: true,
3318
+ [this._activeVariantClasses.arrow]: true
3319
+ });
3320
+ }
3321
+ get _arrowHtml() {
3322
+ return this.noArrow ? "" : html2`<div id="arrow" role="img" class="${this._arrowClasses}" />`;
3323
+ }
3324
+ get _activeVariantClasses() {
3325
+ const variantProps = {
3326
+ callout: this.callout,
3327
+ popover: this.popover,
3328
+ tooltip: this.tooltip,
3329
+ highlight: this.highlight
3330
+ };
3331
+ const activeVariant = Object.keys(variantProps).find((b) => !!variantProps[b]) || "";
3332
+ return {
3333
+ wrapper: attention[activeVariant],
3334
+ arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
3335
+ };
3336
+ }
3337
+ get _attentionEl() {
3338
+ return this.renderRoot.querySelector("#attention");
3339
+ }
3340
+ get _targetEl() {
3341
+ const targetSlot = this.renderRoot.querySelector("slot[name='target']");
3342
+ return targetSlot ? targetSlot.assignedNodes()[0] : null;
3343
+ }
3344
+ get _messageEl() {
3345
+ const messageSlot = this.renderRoot.querySelector("slot[name='message']");
3346
+ return messageSlot ? messageSlot.assignedNodes()[0] : null;
3347
+ }
3348
+ get _wrapperClasses() {
3349
+ return classes({
3350
+ [attention.base]: true,
3351
+ [this._activeVariantClasses.wrapper]: true
3352
+ });
3353
+ }
3354
+ get _ariaClose() {
3355
+ return i18n._({
3356
+ id: "attention.aria.close",
3357
+ message: "Close",
3358
+ comment: "Aria label for the close button in attention"
3359
+ });
3360
+ }
3361
+ get _closeBtnHtml() {
3362
+ return html2`
3363
+ <button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
3364
+ <w-icon-close-16 />
3365
+ </button>
3366
+ `;
2282
3367
  }
2283
3368
  updated() {
2284
3369
  if (!this.callout) {
@@ -2292,34 +3377,46 @@ ${JSON.stringify(Object.keys(opposites))}`);
2292
3377
  isCallout: this.callout,
2293
3378
  actualDirection: this._actualDirection,
2294
3379
  directionName: this.placement,
2295
- arrowEl: this.renderRoot.querySelector("#arrow"),
3380
+ arrowEl: this._arrowEl,
2296
3381
  attentionEl: this._attentionEl,
2297
3382
  targetEl: this._targetEl,
2298
- noArrow: this.noArrow
3383
+ noArrow: this.noArrow,
3384
+ distance: this.distance,
3385
+ skidding: this.skidding,
3386
+ flip: this.flip,
3387
+ fallbackPlacements: this.fallbackPlacements
2299
3388
  };
2300
3389
  useRecompute(this.attentionState);
2301
3390
  }
2302
3391
  pointingAtDirection() {
2303
3392
  switch (opposites[this._actualDirection]) {
3393
+ case "top-start":
2304
3394
  case "top":
3395
+ case "top-end":
2305
3396
  return i18n._({
2306
3397
  id: "attention.aria.pointingUp",
2307
3398
  message: "pointing up",
2308
3399
  comment: "Default screenreader message for top direction in the attention component"
2309
3400
  });
3401
+ case "right-start":
2310
3402
  case "right":
3403
+ case "right-end":
2311
3404
  return i18n._({
2312
3405
  id: "attention.aria.pointingRight",
2313
3406
  message: "pointing right",
2314
3407
  comment: "Default screenreader message for right direction in the attention component"
2315
3408
  });
3409
+ case "bottom-start":
2316
3410
  case "bottom":
3411
+ case "bottom-end":
2317
3412
  return i18n._({
2318
3413
  id: "attention.aria.pointingDown",
2319
3414
  message: "pointing down",
2320
3415
  comment: "Default screenreader message for bottom direction in the attention component"
2321
3416
  });
3417
+ case "left-start":
2322
3418
  case "left":
3419
+ case "left-end":
2323
3420
  return i18n._({
2324
3421
  id: "attention.aria.pointingLeft",
2325
3422
  message: "pointing left",
@@ -2368,64 +3465,13 @@ ${JSON.stringify(Object.keys(opposites))}`);
2368
3465
  this._targetEl.setAttribute("aria-details", attentionMessageId);
2369
3466
  }
2370
3467
  }
2371
- get _activeVariantClasses() {
2372
- const variantProps = {
2373
- callout: this.callout,
2374
- popover: this.popover,
2375
- tooltip: this.tooltip,
2376
- highlight: this.highlight
2377
- };
2378
- const activeVariant = Object.keys(variantProps).find((b3) => !!variantProps[b3]) || "";
2379
- return {
2380
- wrapper: attention[activeVariant],
2381
- arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
2382
- };
2383
- }
2384
- get _ariaClose() {
2385
- return i18n._({
2386
- id: "attention.aria.close",
2387
- message: "Close",
2388
- comment: "Aria label for the close button in attention"
2389
- });
2390
- }
2391
3468
  firstUpdated() {
3469
+ this._initialPlacement = this.placement;
2392
3470
  this.setAriaLabels();
2393
3471
  if (this.callout) {
2394
3472
  this._attentionEl.style.position = "relative";
2395
3473
  }
2396
3474
  }
2397
- get _attentionEl() {
2398
- return this.renderRoot.querySelector("#attention");
2399
- }
2400
- get _targetEl() {
2401
- return this.renderRoot.querySelector("slot[name='target']").assignedNodes()[0];
2402
- }
2403
- get _messageEl() {
2404
- return this.renderRoot.querySelector("slot[name='message']").assignedNodes()[0];
2405
- }
2406
- get _wrapperClasses() {
2407
- return classes({
2408
- [attention.base]: true,
2409
- [this._activeVariantClasses.wrapper]: true
2410
- });
2411
- }
2412
- get _arrowClasses() {
2413
- return classes({
2414
- [attention.arrowBase]: true,
2415
- [attention[`arrowDirection${this._arrowDirection.charAt(0).toUpperCase() + this._arrowDirection.slice(1)}`]]: true,
2416
- [this._activeVariantClasses.arrow]: true
2417
- });
2418
- }
2419
- get _arrowHtml() {
2420
- return this.noArrow ? "" : html2`<div
2421
- id="arrow"
2422
- role="img"
2423
- class="${this._arrowClasses}"
2424
- style="transform:rotate(${rotation[this._arrowDirection]}deg);
2425
- margin-${// border alignment is off by a fraction of a pixel, this fixes it
2426
- this._arrowDirection.charAt(0).toLowerCase() + this._arrowDirection.slice(1)}:-0.5px;"
2427
- />`;
2428
- }
2429
3475
  close() {
2430
3476
  const event = new CustomEvent("close", {
2431
3477
  bubbles: true,
@@ -2433,25 +3479,18 @@ ${JSON.stringify(Object.keys(opposites))}`);
2433
3479
  });
2434
3480
  this.updateComplete.then(() => this.dispatchEvent(event));
2435
3481
  }
2436
- keypressed(e2) {
3482
+ keypressed(e) {
2437
3483
  if (!this.canClose)
2438
3484
  return;
2439
- if (e2.key === "Escape") {
2440
- e2.preventDefault();
3485
+ if (e.key === "Escape") {
3486
+ e.preventDefault();
2441
3487
  this.close();
2442
3488
  }
2443
3489
  }
2444
- get _closeBtnHtml() {
2445
- return html2`
2446
- <button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
2447
- <w-icon-close-16 />
2448
- </button>
2449
- `;
2450
- }
2451
3490
  render() {
2452
3491
  return html2`
2453
3492
  <div class=${ifDefined(this.className ? this.className : void 0)}>
2454
- ${this.placement === "right" || this.placement === "bottom" ? html2`
3493
+ ${this.placement === "right-start" || this.placement === "right" || this.placement === "right-end" || this.placement === "bottom-start" || this.placement === "bottom" || this.placement === "bottom-end" ? html2`
2455
3494
  <slot name="target"></slot>
2456
3495
 
2457
3496
  <div id="attention" role="${this.tooltip ? "tooltip" : "img"}" aria-label="${this.defaultAriaLabel()}" class="${this._wrapperClasses}">
@@ -2475,7 +3514,7 @@ __publicField(WarpAttention, "properties", {
2475
3514
  show: { type: Boolean, reflect: true },
2476
3515
  // Placement according to the target element
2477
3516
  // Arrow would be on the opposite side of this position
2478
- placement: { type: String },
3517
+ placement: { type: String, reflect: true },
2479
3518
  // Whether Attention element is rendered as a tooltip
2480
3519
  tooltip: { type: Boolean, reflect: true },
2481
3520
  // Whether Attention element is rendered as an inline callout
@@ -2487,7 +3526,15 @@ __publicField(WarpAttention, "properties", {
2487
3526
  // Render Attention element with a close button
2488
3527
  canClose: { type: Boolean, reflect: true },
2489
3528
  // Render Attention element without an arrow
2490
- noArrow: { type: Boolean, reflect: true }
3529
+ noArrow: { type: Boolean, reflect: true },
3530
+ // Distance from which to offset the attentionEl from the targetEl vertically
3531
+ distance: { type: Number, reflect: true },
3532
+ // Distance from which to offset the attentionEl along its targetEl horizontally
3533
+ skidding: { type: Number, reflect: true },
3534
+ // Whether Attention element should flip its placement in order to keep it in view
3535
+ flip: { type: Boolean, reflect: true },
3536
+ // Choose which preferred placements the Attention element should flip to
3537
+ fallbackPlacements: { type: Array, reflect: true }
2491
3538
  });
2492
3539
  __publicField(WarpAttention, "styles", [
2493
3540
  WarpElement.styles,
@@ -2502,11 +3549,6 @@ __publicField(WarpAttention, "styles", [
2502
3549
  :host([popover]:not(:popover-open):not(dialog[open])) {
2503
3550
  display: contents;
2504
3551
  }
2505
-
2506
- #arrow {
2507
- border-top-left-radius: 4px;
2508
- z-index: 1;
2509
- }
2510
3552
  `
2511
3553
  ]);
2512
3554
  if (!customElements.get("w-attention")) {