@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
package/dist/index.js CHANGED
@@ -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)
@@ -224,27 +224,27 @@ var require_moo = __commonJS({
224
224
  var hasOwnProperty = Object.prototype.hasOwnProperty;
225
225
  var toString = Object.prototype.toString;
226
226
  var hasSticky = typeof new RegExp().sticky === "boolean";
227
- function isRegExp(o3) {
228
- return o3 && toString.call(o3) === "[object RegExp]";
227
+ function isRegExp(o) {
228
+ return o && toString.call(o) === "[object RegExp]";
229
229
  }
230
- function isObject(o3) {
231
- return o3 && typeof o3 === "object" && !isRegExp(o3) && !Array.isArray(o3);
230
+ function isObject(o) {
231
+ return o && typeof o === "object" && !isRegExp(o) && !Array.isArray(o);
232
232
  }
233
- function reEscape(s3) {
234
- return s3.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
233
+ function reEscape(s) {
234
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
235
235
  }
236
- function reGroups(s3) {
237
- var re = new RegExp("|" + s3);
236
+ function reGroups(s) {
237
+ var re = new RegExp("|" + s);
238
238
  return re.exec("").length - 1;
239
239
  }
240
- function reCapture(s3) {
241
- return "(" + s3 + ")";
240
+ function reCapture(s) {
241
+ return "(" + s + ")";
242
242
  }
243
243
  function reUnion(regexps) {
244
244
  if (!regexps.length)
245
245
  return "(?!)";
246
- var source = regexps.map(function(s3) {
247
- return "(?:" + s3 + ")";
246
+ var source = regexps.map(function(s) {
247
+ return "(?:" + s + ")";
248
248
  }).join("|");
249
249
  return "(?:" + source + ")";
250
250
  }
@@ -265,11 +265,11 @@ var require_moo = __commonJS({
265
265
  throw new Error("Not a pattern: " + obj);
266
266
  }
267
267
  }
268
- function pad(s3, length) {
269
- if (s3.length > length) {
270
- return s3;
268
+ function pad(s, length) {
269
+ if (s.length > length) {
270
+ return s;
271
271
  }
272
- return Array(length - s3.length + 1).join(" ") + s3;
272
+ return Array(length - s.length + 1).join(" ") + s;
273
273
  }
274
274
  function lastNLines(string, numLines) {
275
275
  var position = string.length;
@@ -295,8 +295,8 @@ var require_moo = __commonJS({
295
295
  function objectToRules(object) {
296
296
  var keys2 = Object.getOwnPropertyNames(object);
297
297
  var result = [];
298
- for (var i3 = 0; i3 < keys2.length; i3++) {
299
- var key = keys2[i3];
298
+ for (var i = 0; i < keys2.length; i++) {
299
+ var key = keys2[i];
300
300
  var thing = object[key];
301
301
  var rules = [].concat(thing);
302
302
  if (key === "include") {
@@ -323,8 +323,8 @@ var require_moo = __commonJS({
323
323
  }
324
324
  function arrayToRules(array) {
325
325
  var result = [];
326
- for (var i3 = 0; i3 < array.length; i3++) {
327
- var obj = array[i3];
326
+ for (var i = 0; i < array.length; i++) {
327
+ var obj = array[i];
328
328
  if (obj.include) {
329
329
  var include = [].concat(obj.include);
330
330
  for (var j = 0; j < include.length; j++) {
@@ -368,8 +368,8 @@ var require_moo = __commonJS({
368
368
  }
369
369
  var match = options.match;
370
370
  options.match = Array.isArray(match) ? match : match ? [match] : [];
371
- options.match.sort(function(a3, b3) {
372
- return isRegExp(a3) && isRegExp(b3) ? 0 : isRegExp(b3) ? -1 : isRegExp(a3) ? 1 : b3.length - a3.length;
371
+ options.match.sort(function(a, b) {
372
+ return isRegExp(a) && isRegExp(b) ? 0 : isRegExp(b) ? -1 : isRegExp(a) ? 1 : b.length - a.length;
373
373
  });
374
374
  return options;
375
375
  }
@@ -384,13 +384,13 @@ var require_moo = __commonJS({
384
384
  var unicodeFlag = null;
385
385
  var groups = [];
386
386
  var parts = [];
387
- for (var i3 = 0; i3 < rules.length; i3++) {
388
- if (rules[i3].fallback) {
387
+ for (var i = 0; i < rules.length; i++) {
388
+ if (rules[i].fallback) {
389
389
  fastAllowed = false;
390
390
  }
391
391
  }
392
- for (var i3 = 0; i3 < rules.length; i3++) {
393
- var options = rules[i3];
392
+ for (var i = 0; i < rules.length; i++) {
393
+ var options = rules[i];
394
394
  if (options.include) {
395
395
  throw new Error("Inheritance is not allowed in stateless lexers");
396
396
  }
@@ -461,13 +461,13 @@ var require_moo = __commonJS({
461
461
  var result = compileRules(toRules(rules));
462
462
  return new Lexer({ start: result }, "start");
463
463
  }
464
- function checkStateGroup(g3, name, map) {
465
- var state = g3 && (g3.push || g3.next);
464
+ function checkStateGroup(g, name, map) {
465
+ var state = g && (g.push || g.next);
466
466
  if (state && !map[state]) {
467
- throw new Error("Missing state '" + state + "' (in token '" + g3.defaultType + "' of state '" + name + "')");
467
+ throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')");
468
468
  }
469
- if (g3 && g3.pop && +g3.pop !== 1) {
470
- throw new Error("pop must be 1 (in token '" + g3.defaultType + "' of state '" + name + "')");
469
+ if (g && g.pop && +g.pop !== 1) {
470
+ throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')");
471
471
  }
472
472
  }
473
473
  function compileStates(states, start) {
@@ -477,12 +477,12 @@ var require_moo = __commonJS({
477
477
  if (!start)
478
478
  start = keys2[0];
479
479
  var ruleMap = /* @__PURE__ */ Object.create(null);
480
- for (var i3 = 0; i3 < keys2.length; i3++) {
481
- var key = keys2[i3];
480
+ for (var i = 0; i < keys2.length; i++) {
481
+ var key = keys2[i];
482
482
  ruleMap[key] = toRules(states[key]).concat(all);
483
483
  }
484
- for (var i3 = 0; i3 < keys2.length; i3++) {
485
- var key = keys2[i3];
484
+ for (var i = 0; i < keys2.length; i++) {
485
+ var key = keys2[i];
486
486
  var rules = ruleMap[key];
487
487
  var included = /* @__PURE__ */ Object.create(null);
488
488
  for (var j = 0; j < rules.length; j++) {
@@ -496,8 +496,8 @@ var require_moo = __commonJS({
496
496
  if (!newRules) {
497
497
  throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')");
498
498
  }
499
- for (var k2 = 0; k2 < newRules.length; k2++) {
500
- var newRule = newRules[k2];
499
+ for (var k = 0; k < newRules.length; k++) {
500
+ var newRule = newRules[k];
501
501
  if (rules.indexOf(newRule) !== -1)
502
502
  continue;
503
503
  splice.push(newRule);
@@ -508,12 +508,12 @@ var require_moo = __commonJS({
508
508
  }
509
509
  }
510
510
  var map = /* @__PURE__ */ Object.create(null);
511
- for (var i3 = 0; i3 < keys2.length; i3++) {
512
- var key = keys2[i3];
511
+ for (var i = 0; i < keys2.length; i++) {
512
+ var key = keys2[i];
513
513
  map[key] = compileRules(ruleMap[key], true);
514
514
  }
515
- for (var i3 = 0; i3 < keys2.length; i3++) {
516
- var name = keys2[i3];
515
+ for (var i = 0; i < keys2.length; i++) {
516
+ var name = keys2[i];
517
517
  var state = map[name];
518
518
  var groups = state.groups;
519
519
  for (var j = 0; j < groups.length; j++) {
@@ -530,8 +530,8 @@ var require_moo = __commonJS({
530
530
  var isMap = typeof Map !== "undefined";
531
531
  var reverseMap = isMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
532
532
  var types = Object.getOwnPropertyNames(map);
533
- for (var i3 = 0; i3 < types.length; i3++) {
534
- var tokenType = types[i3];
533
+ for (var i = 0; i < types.length; i++) {
534
+ var tokenType = types[i];
535
535
  var item = map[tokenType];
536
536
  var keywordList = Array.isArray(item) ? item : [item];
537
537
  keywordList.forEach(function(keyword) {
@@ -545,8 +545,8 @@ var require_moo = __commonJS({
545
545
  }
546
546
  });
547
547
  }
548
- return function(k2) {
549
- return isMap ? reverseMap.get(k2) : reverseMap[k2];
548
+ return function(k) {
549
+ return isMap ? reverseMap.get(k) : reverseMap[k];
550
550
  };
551
551
  }
552
552
  var Lexer = function(states, state) {
@@ -607,9 +607,9 @@ var require_moo = __commonJS({
607
607
  };
608
608
  Lexer.prototype._getGroup = function(match) {
609
609
  var groupCount = this.groups.length;
610
- for (var i3 = 0; i3 < groupCount; i3++) {
611
- if (match[i3 + 1] !== void 0) {
612
- return this.groups[i3];
610
+ for (var i = 0; i < groupCount; i++) {
611
+ if (match[i + 1] !== void 0) {
612
+ return this.groups[i];
613
613
  }
614
614
  }
615
615
  throw new Error("Cannot find token type for matched text");
@@ -649,7 +649,7 @@ var require_moo = __commonJS({
649
649
  }
650
650
  return this._token(group, text, index);
651
651
  };
652
- Lexer.prototype._token = function(group, text, offset) {
652
+ Lexer.prototype._token = function(group, text, offset2) {
653
653
  var lineBreaks = 0;
654
654
  if (group.lineBreaks) {
655
655
  var matchNL = /\n/g;
@@ -668,18 +668,18 @@ var require_moo = __commonJS({
668
668
  value: typeof group.value === "function" ? group.value(text) : text,
669
669
  text,
670
670
  toString: tokenToString,
671
- offset,
671
+ offset: offset2,
672
672
  lineBreaks,
673
673
  line: this.line,
674
674
  col: this.col
675
675
  };
676
- var size = text.length;
677
- this.index += size;
676
+ var size2 = text.length;
677
+ this.index += size2;
678
678
  this.line += lineBreaks;
679
679
  if (lineBreaks !== 0) {
680
- this.col = size - nl + 1;
680
+ this.col = size2 - nl + 1;
681
681
  } else {
682
- this.col += size;
682
+ this.col += size2;
683
683
  }
684
684
  if (group.shouldThrow) {
685
685
  var err = new Error(this.formatError(token, "invalid syntax"));
@@ -730,9 +730,9 @@ var require_moo = __commonJS({
730
730
  var errorLines = [];
731
731
  errorLines.push(message + " at line " + token.line + " col " + token.col + ":");
732
732
  errorLines.push("");
733
- for (var i3 = 0; i3 < displayedLines.length; i3++) {
734
- var line = displayedLines[i3];
735
- var lineNo = firstDisplayedLine + i3;
733
+ for (var i = 0; i < displayedLines.length; i++) {
734
+ var line = displayedLines[i];
735
+ var lineNo = firstDisplayedLine + i;
736
736
  errorLines.push(pad(String(lineNo), lastLineDigits) + " " + line);
737
737
  if (lineNo === token.line) {
738
738
  errorLines.push(pad("", lastLineDigits + token.col + 1) + "^");
@@ -842,12 +842,12 @@ var require_parser = __commonJS({
842
842
  function strictArgStyleParam(lt, param) {
843
843
  let value = "";
844
844
  let text = "";
845
- for (const p3 of param) {
846
- const pText = p3.ctx.text;
845
+ for (const p of param) {
846
+ const pText = p.ctx.text;
847
847
  text += pText;
848
- switch (p3.type) {
848
+ switch (p.type) {
849
849
  case "content":
850
- value += p3.value;
850
+ value += p.value;
851
851
  break;
852
852
  case "argument":
853
853
  case "function":
@@ -858,12 +858,12 @@ var require_parser = __commonJS({
858
858
  throw new ParseError(lt, `Unsupported part in strict mode function arg style: ${pText}`);
859
859
  }
860
860
  }
861
- const c3 = {
861
+ const c = {
862
862
  type: "content",
863
863
  value: value.trim(),
864
864
  ctx: Object.assign({}, param[0].ctx, { text })
865
865
  };
866
- return [c3];
866
+ return [c];
867
867
  }
868
868
  var strictArgTypes = [
869
869
  "number",
@@ -1045,7 +1045,7 @@ import { html as html3 } from "lit";
1045
1045
  import WarpElement from "@warp-ds/elements-core";
1046
1046
  import { ifDefined } from "lit/directives/if-defined.js";
1047
1047
 
1048
- // node_modules/.pnpm/@warp-ds+css@1.9.1/node_modules/@warp-ds/css/component-classes/index.js
1048
+ // node_modules/.pnpm/@warp-ds+css@1.9.3/node_modules/@warp-ds/css/component-classes/index.js
1049
1049
  var badge = {
1050
1050
  base: "py-4 px-8 border-0 rounded-4 text-xs inline-flex",
1051
1051
  neutral: "bg-[--w-color-badge-neutral-background] s-text",
@@ -1070,11 +1070,14 @@ var box = {
1070
1070
  bleed: "-mx-16 sm:mx-0 rounded-l-0 rounded-r-0 sm:rounded-8",
1071
1071
  // We target L and R to override the default rounded-8
1072
1072
  info: "s-bg-info-subtle",
1073
- neutral: "bg-[--w-s-color-surface-sunken]",
1073
+ neutral: "s-surface-sunken",
1074
1074
  bordered: "border-2 s-border s-bg",
1075
- infoClickable: "hover:s-bg-info-subtle-hover active:s-bg-info-subtle-hover",
1076
- neutralClickable: "hover:s-bg-subtle-hover active:s-bg-subtle-hover",
1077
- borderedClickable: "hover:s-bg-hover active:s-bg-hover hover:s-border-hover active:s-border-hover"
1075
+ infoClickable: "hover:s-bg-info-subtle-hover active:s-bg-info-subtle-active",
1076
+ // Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
1077
+ neutralClickable: "hover:s-bg-hover active:s-bg-active",
1078
+ // Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
1079
+ borderedClickable: "hover:s-bg-hover active:s-bg-active hover:s-border-hover active:s-border-active"
1080
+ // Deprecated - Remove in v2 (after removing Clickable prop in the Box components)
1078
1081
  };
1079
1082
  var pill = {
1080
1083
  pill: "flex items-center",
@@ -1089,15 +1092,16 @@ var pill = {
1089
1092
  };
1090
1093
  var card = {
1091
1094
  card: "cursor-pointer overflow-hidden relative transition-all",
1092
- cardShadow: "rounded-8 shadow-s hover:shadow-m hover:s-bg-subtle-hover tap-highlight-transparent",
1095
+ cardShadow: "group rounded-8 s-surface-elevated-200 hover:s-surface-elevated-200-hover active:s-surface-elevated-200-active",
1096
+ cardUnselected: "",
1097
+ // TODO: Remove in v2 - Not used after introducing surface
1098
+ cardSelected: "!s-bg-selected !hover:s-bg-selected-hover !active:s-bg-selected-active",
1099
+ cardOutline: "absolute border-2 rounded-8 inset-0 transition-all",
1100
+ cardOutlineUnselected: "border-transparent group-active:s-border-active",
1101
+ cardOutlineSelected: "s-border-selected group-hover:s-border-selected-hover group-active:s-border-selected-active",
1093
1102
  cardFlat: "border-2 rounded-4",
1094
- cardFlatUnselected: "s-bg s-border hover:s-bg-hover hover:s-border-hover active:s-bg-active active:s-border-active",
1095
- cardFlatSelected: "s-border-selected s-bg-selected hover:s-bg-selected-hover hover:s-border-selected-hover active:s-border-selected-active active:s-bg-selected-active",
1096
- cardUnselected: "s-bg",
1097
- cardSelected: "s-border-selected s-bg-selected hover:s-border-selected-hover hover:s-bg-selected-hover active:s-border-selected-active active:s-bg-selected-active",
1098
- cardOutline: "active:s-border absolute rounded-8 inset-0 transition-all border-2",
1099
- cardOutlineUnselected: "border-transparent",
1100
- cardOutlineSelected: "s-border-selected hover:s-border-selected-hover",
1103
+ cardFlatUnselected: "s-bg hover:s-bg-hover active:s-bg-active s-border hover:s-border-hover active:s-border-active",
1104
+ cardFlatSelected: "s-bg-selected hover:s-bg-selected-hover active:s-bg-selected-active s-border-selected hover:s-border-selected-hover active:s-border-selected-active",
1101
1105
  a11y: "sr-only"
1102
1106
  };
1103
1107
  var toaster = {
@@ -1123,7 +1127,7 @@ var buttonReset = "focus:outline-none appearance-none cursor-pointer bg-transpar
1123
1127
  var expandable = {
1124
1128
  expandable: "will-change-height",
1125
1129
  expandableTitle: "font-bold s-text",
1126
- expandableBox: "s-bg-subtle hover:s-bg-subtle-hover py-0 px-0 " + box.box,
1130
+ expandableBox: "s-surface-sunken hover:s-bg-hover active:s-bg-active py-0 px-0 " + box.box,
1127
1131
  expandableInfo: "s-bg-info-subtle! hover:s-bg-info-subtle-hover!",
1128
1132
  expandableBleed: box.bleed,
1129
1133
  chevron: "inline-block align-middle s-icon",
@@ -1164,7 +1168,7 @@ var buttonTypes = {
1164
1168
  utility: `border rounded-4 ${buttonDefaultStyling}`,
1165
1169
  negative: `border-0 rounded-8 ${buttonDefaultStyling}`,
1166
1170
  pill: `p-4 rounded-full border-0 inline-flex items-center justify-center hover:bg-clip-padding ${buttonDefaultStyling}`,
1167
- link: `bg-transparent focusable ease-in-out inline active:underline hover:underline ${buttonColors.link}`
1171
+ link: `bg-transparent focusable ease-in-out inline active:underline hover:underline focus:underline ${buttonColors.link}`
1168
1172
  };
1169
1173
  var buttonSizes = {
1170
1174
  xsmall: "py-6 px-16",
@@ -1254,7 +1258,7 @@ var button = {
1254
1258
  pillSmallLoading: `${buttonSizes.pillSmall} ${buttonTextSizes.xsmall} ${buttonTypes.pill} ${buttonVariants.inProgress}`,
1255
1259
  link: `${buttonSizes.link} ${buttonTextSizes.medium} ${buttonTypes.link}`,
1256
1260
  linkSmall: `${buttonSizes.link} ${buttonTextSizes.xsmall} ${buttonTypes.link}`,
1257
- linkAsButton: "inline-block hover:no-underline text-center",
1261
+ linkAsButton: "inline-block active:no-underline hover:no-underline focus:no-underline text-center",
1258
1262
  a11y: "sr-only",
1259
1263
  fullWidth: "w-full max-w-full",
1260
1264
  contentWidth: "max-w-max"
@@ -1466,7 +1470,7 @@ function processTokens(tokens, mapText) {
1466
1470
  return [token.arg, token.key];
1467
1471
  }
1468
1472
  }
1469
- const offset = token.pluralOffset;
1473
+ const offset2 = token.pluralOffset;
1470
1474
  const formatProps = {};
1471
1475
  token.cases.forEach((item) => {
1472
1476
  formatProps[item.key.replace(/^=(.)+/, "$1")] = processTokens(
@@ -1478,16 +1482,16 @@ function processTokens(tokens, mapText) {
1478
1482
  token.arg,
1479
1483
  token.type,
1480
1484
  __spreadValues({
1481
- offset
1485
+ offset: offset2
1482
1486
  }, formatProps)
1483
1487
  ];
1484
1488
  });
1485
1489
  }
1486
- function compileMessage(message, mapText = (v3) => v3) {
1490
+ function compileMessage(message, mapText = (v) => v) {
1487
1491
  try {
1488
1492
  return processTokens((0, import_parser.parse)(message), mapText);
1489
- } catch (e2) {
1490
- console.error(`${e2.message}
1493
+ } catch (e) {
1494
+ console.error(`${e.message}
1491
1495
 
1492
1496
  Message: ${message}`);
1493
1497
  return message;
@@ -1495,8 +1499,8 @@ Message: ${message}`);
1495
1499
  }
1496
1500
 
1497
1501
  // node_modules/.pnpm/@lingui+core@4.7.1/node_modules/@lingui/core/dist/index.mjs
1498
- var isString = (s3) => typeof s3 === "string";
1499
- var isFunction = (f3) => typeof f3 === "function";
1502
+ var isString = (s) => typeof s === "string";
1503
+ var isFunction = (f) => typeof f === "function";
1500
1504
  var cache = /* @__PURE__ */ new Map();
1501
1505
  var defaultLocale = "en";
1502
1506
  function normalizeLocales(locales) {
@@ -1520,7 +1524,7 @@ function number(locales, value, format) {
1520
1524
  return formatter.format(value);
1521
1525
  }
1522
1526
  function plural(locales, ordinal, value, _a) {
1523
- var _b = _a, { offset = 0 } = _b, rules = __objRest(_b, ["offset"]);
1527
+ var _b = _a, { offset: offset2 = 0 } = _b, rules = __objRest(_b, ["offset"]);
1524
1528
  var _a2, _b2;
1525
1529
  const _locales = normalizeLocales(locales);
1526
1530
  const plurals = ordinal ? getMemoized(
@@ -1530,7 +1534,7 @@ function plural(locales, ordinal, value, _a) {
1530
1534
  () => cacheKey("plural-cardinal", _locales),
1531
1535
  () => new Intl.PluralRules(_locales, { type: "cardinal" })
1532
1536
  );
1533
- return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset)]) != null ? _b2 : rules.other;
1537
+ return (_b2 = (_a2 = rules[value]) != null ? _a2 : rules[plurals.select(value - offset2)]) != null ? _b2 : rules.other;
1534
1538
  }
1535
1539
  function getMemoized(getKey, construct) {
1536
1540
  const key = getKey();
@@ -1559,14 +1563,14 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1559
1563
  };
1560
1564
  return {
1561
1565
  plural: (value, cases) => {
1562
- const { offset = 0 } = cases;
1566
+ const { offset: offset2 = 0 } = cases;
1563
1567
  const message = plural(locales, false, value, cases);
1564
- return replaceOctothorpe(value - offset, message);
1568
+ return replaceOctothorpe(value - offset2, message);
1565
1569
  },
1566
1570
  selectordinal: (value, cases) => {
1567
- const { offset = 0 } = cases;
1571
+ const { offset: offset2 = 0 } = cases;
1568
1572
  const message = plural(locales, true, value, cases);
1569
- return replaceOctothorpe(value - offset, message);
1573
+ return replaceOctothorpe(value - offset2, message);
1570
1574
  },
1571
1575
  select: selectFormatter,
1572
1576
  number: (value, format) => number(locales, value, style(format)),
@@ -1863,8 +1867,8 @@ function detectLocale() {
1863
1867
  return getSupportedLocale(hostLocale);
1864
1868
  }
1865
1869
  return getSupportedLocale(htmlLocale != null ? htmlLocale : hostLocale);
1866
- } catch (e2) {
1867
- console.warn("could not detect locale, falling back to source locale", e2);
1870
+ } catch (e) {
1871
+ console.warn("could not detect locale, falling back to source locale", e);
1868
1872
  return defaultLocale2;
1869
1873
  }
1870
1874
  }
@@ -1954,8 +1958,8 @@ function detectLocale2() {
1954
1958
  return getSupportedLocale2(hostLocale);
1955
1959
  }
1956
1960
  return getSupportedLocale2(htmlLocale != null ? htmlLocale : hostLocale);
1957
- } catch (e2) {
1958
- console.warn("could not detect locale, falling back to source locale", e2);
1961
+ } catch (e) {
1962
+ console.warn("could not detect locale, falling back to source locale", e);
1959
1963
  return defaultLocale3;
1960
1964
  }
1961
1965
  }
@@ -2083,11 +2087,11 @@ import { css, html as html8 } from "lit";
2083
2087
 
2084
2088
  // node_modules/.pnpm/@chbphone55+classnames@2.0.0/node_modules/@chbphone55/classnames/dist/index.m.js
2085
2089
  var r = function() {
2086
- for (var t2 = [], n3 = arguments.length; n3--; )
2087
- t2[n3] = arguments[n3];
2088
- return t2.reduce(function(t3, n4) {
2089
- return t3.concat("string" == typeof n4 ? n4 : Array.isArray(n4) ? r.apply(void 0, n4) : "object" == typeof n4 && n4 ? Object.keys(n4).map(function(r4) {
2090
- return n4[r4] ? r4 : "";
2090
+ for (var t = [], n = arguments.length; n--; )
2091
+ t[n] = arguments[n];
2092
+ return t.reduce(function(t2, n2) {
2093
+ return t2.concat("string" == typeof n2 ? n2 : Array.isArray(n2) ? r.apply(void 0, n2) : "object" == typeof n2 && n2 ? Object.keys(n2).map(function(r2) {
2094
+ return n2[r2] ? r2 : "";
2091
2095
  }) : "");
2092
2096
  }, []).join(" ");
2093
2097
  };
@@ -2154,8 +2158,8 @@ function detectLocale3() {
2154
2158
  return getSupportedLocale3(hostLocale);
2155
2159
  }
2156
2160
  return getSupportedLocale3(htmlLocale != null ? htmlLocale : hostLocale);
2157
- } catch (e2) {
2158
- console.warn("could not detect locale, falling back to source locale", e2);
2161
+ } catch (e) {
2162
+ console.warn("could not detect locale, falling back to source locale", e);
2159
2163
  return defaultLocale4;
2160
2164
  }
2161
2165
  }
@@ -2245,8 +2249,8 @@ function detectLocale4() {
2245
2249
  return getSupportedLocale4(hostLocale);
2246
2250
  }
2247
2251
  return getSupportedLocale4(htmlLocale != null ? htmlLocale : hostLocale);
2248
- } catch (e2) {
2249
- console.warn("could not detect locale, falling back to source locale", e2);
2252
+ } catch (e) {
2253
+ console.warn("could not detect locale, falling back to source locale", e);
2250
2254
  return defaultLocale5;
2251
2255
  }
2252
2256
  }
@@ -2336,8 +2340,8 @@ function detectLocale5() {
2336
2340
  return getSupportedLocale5(hostLocale);
2337
2341
  }
2338
2342
  return getSupportedLocale5(htmlLocale != null ? htmlLocale : hostLocale);
2339
- } catch (e2) {
2340
- console.warn("could not detect locale, falling back to source locale", e2);
2343
+ } catch (e) {
2344
+ console.warn("could not detect locale, falling back to source locale", e);
2341
2345
  return defaultLocale6;
2342
2346
  }
2343
2347
  }
@@ -2427,8 +2431,8 @@ function detectLocale6() {
2427
2431
  return getSupportedLocale6(hostLocale);
2428
2432
  }
2429
2433
  return getSupportedLocale6(htmlLocale != null ? htmlLocale : hostLocale);
2430
- } catch (e2) {
2431
- console.warn("could not detect locale, falling back to source locale", e2);
2434
+ } catch (e) {
2435
+ console.warn("could not detect locale, falling back to source locale", e);
2432
2436
  return defaultLocale7;
2433
2437
  }
2434
2438
  }
@@ -2548,417 +2552,1401 @@ import { css as css2, html as html9, nothing } from "lit";
2548
2552
  import WarpElement3 from "@warp-ds/elements-core";
2549
2553
  import { ifDefined as ifDefined2 } from "lit/directives/if-defined.js";
2550
2554
 
2551
- // node_modules/.pnpm/@floating-ui+core@0.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
2552
- function t(t2) {
2553
- return t2.split("-")[0];
2555
+ // node_modules/.pnpm/@floating-ui+utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2556
+ var sides = ["top", "right", "bottom", "left"];
2557
+ var alignments = ["start", "end"];
2558
+ var placements = /* @__PURE__ */ sides.reduce((acc, side2) => acc.concat(side2, side2 + "-" + alignments[0], side2 + "-" + alignments[1]), []);
2559
+ var min = Math.min;
2560
+ var max = Math.max;
2561
+ var round = Math.round;
2562
+ var createCoords = (v) => ({
2563
+ x: v,
2564
+ y: v
2565
+ });
2566
+ var oppositeSideMap = {
2567
+ left: "right",
2568
+ right: "left",
2569
+ bottom: "top",
2570
+ top: "bottom"
2571
+ };
2572
+ var oppositeAlignmentMap = {
2573
+ start: "end",
2574
+ end: "start"
2575
+ };
2576
+ function clamp(start, value, end) {
2577
+ return max(start, min(value, end));
2578
+ }
2579
+ function evaluate(value, param) {
2580
+ return typeof value === "function" ? value(param) : value;
2581
+ }
2582
+ function getSide(placement) {
2583
+ return placement.split("-")[0];
2584
+ }
2585
+ function getAlignment(placement) {
2586
+ return placement.split("-")[1];
2587
+ }
2588
+ function getOppositeAxis(axis) {
2589
+ return axis === "x" ? "y" : "x";
2590
+ }
2591
+ function getAxisLength(axis) {
2592
+ return axis === "y" ? "height" : "width";
2554
2593
  }
2555
- function e(t2) {
2556
- return t2.split("-")[1];
2594
+ function getSideAxis(placement) {
2595
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
2557
2596
  }
2558
- function n(e2) {
2559
- return ["top", "bottom"].includes(t(e2)) ? "x" : "y";
2597
+ function getAlignmentAxis(placement) {
2598
+ return getOppositeAxis(getSideAxis(placement));
2560
2599
  }
2561
- function r2(t2) {
2562
- return "y" === t2 ? "height" : "width";
2600
+ function getAlignmentSides(placement, rects, rtl) {
2601
+ if (rtl === void 0) {
2602
+ rtl = false;
2603
+ }
2604
+ const alignment = getAlignment(placement);
2605
+ const alignmentAxis = getAlignmentAxis(placement);
2606
+ const length = getAxisLength(alignmentAxis);
2607
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2608
+ if (rects.reference[length] > rects.floating[length]) {
2609
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2610
+ }
2611
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2563
2612
  }
2564
- function i(i3, o3, a3) {
2565
- let { reference: l3, floating: s3 } = i3;
2566
- const c3 = l3.x + l3.width / 2 - s3.width / 2, f3 = l3.y + l3.height / 2 - s3.height / 2, u3 = n(o3), m3 = r2(u3), g3 = l3[m3] / 2 - s3[m3] / 2, d3 = "x" === u3;
2567
- let p3;
2568
- switch (t(o3)) {
2613
+ function getExpandedPlacements(placement) {
2614
+ const oppositePlacement = getOppositePlacement(placement);
2615
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2616
+ }
2617
+ function getOppositeAlignmentPlacement(placement) {
2618
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
2619
+ }
2620
+ function getSideList(side2, isStart, rtl) {
2621
+ const lr = ["left", "right"];
2622
+ const rl = ["right", "left"];
2623
+ const tb = ["top", "bottom"];
2624
+ const bt = ["bottom", "top"];
2625
+ switch (side2) {
2569
2626
  case "top":
2570
- p3 = { x: c3, y: l3.y - s3.height };
2627
+ case "bottom":
2628
+ if (rtl)
2629
+ return isStart ? rl : lr;
2630
+ return isStart ? lr : rl;
2631
+ case "left":
2632
+ case "right":
2633
+ return isStart ? tb : bt;
2634
+ default:
2635
+ return [];
2636
+ }
2637
+ }
2638
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2639
+ const alignment = getAlignment(placement);
2640
+ let list = getSideList(getSide(placement), direction === "start", rtl);
2641
+ if (alignment) {
2642
+ list = list.map((side2) => side2 + "-" + alignment);
2643
+ if (flipAlignment) {
2644
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
2645
+ }
2646
+ }
2647
+ return list;
2648
+ }
2649
+ function getOppositePlacement(placement) {
2650
+ return placement.replace(/left|right|bottom|top/g, (side2) => oppositeSideMap[side2]);
2651
+ }
2652
+ function expandPaddingObject(padding) {
2653
+ return __spreadValues({
2654
+ top: 0,
2655
+ right: 0,
2656
+ bottom: 0,
2657
+ left: 0
2658
+ }, padding);
2659
+ }
2660
+ function getPaddingObject(padding) {
2661
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
2662
+ top: padding,
2663
+ right: padding,
2664
+ bottom: padding,
2665
+ left: padding
2666
+ };
2667
+ }
2668
+ function rectToClientRect(rect) {
2669
+ return __spreadProps(__spreadValues({}, rect), {
2670
+ top: rect.y,
2671
+ left: rect.x,
2672
+ right: rect.x + rect.width,
2673
+ bottom: rect.y + rect.height
2674
+ });
2675
+ }
2676
+
2677
+ // node_modules/.pnpm/@floating-ui+core@1.6.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
2678
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
2679
+ let {
2680
+ reference,
2681
+ floating
2682
+ } = _ref;
2683
+ const sideAxis = getSideAxis(placement);
2684
+ const alignmentAxis = getAlignmentAxis(placement);
2685
+ const alignLength = getAxisLength(alignmentAxis);
2686
+ const side2 = getSide(placement);
2687
+ const isVertical = sideAxis === "y";
2688
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
2689
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
2690
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
2691
+ let coords;
2692
+ switch (side2) {
2693
+ case "top":
2694
+ coords = {
2695
+ x: commonX,
2696
+ y: reference.y - floating.height
2697
+ };
2571
2698
  break;
2572
2699
  case "bottom":
2573
- p3 = { x: c3, y: l3.y + l3.height };
2700
+ coords = {
2701
+ x: commonX,
2702
+ y: reference.y + reference.height
2703
+ };
2574
2704
  break;
2575
2705
  case "right":
2576
- p3 = { x: l3.x + l3.width, y: f3 };
2706
+ coords = {
2707
+ x: reference.x + reference.width,
2708
+ y: commonY
2709
+ };
2577
2710
  break;
2578
2711
  case "left":
2579
- p3 = { x: l3.x - s3.width, y: f3 };
2712
+ coords = {
2713
+ x: reference.x - floating.width,
2714
+ y: commonY
2715
+ };
2580
2716
  break;
2581
2717
  default:
2582
- p3 = { x: l3.x, y: l3.y };
2718
+ coords = {
2719
+ x: reference.x,
2720
+ y: reference.y
2721
+ };
2583
2722
  }
2584
- switch (e(o3)) {
2723
+ switch (getAlignment(placement)) {
2585
2724
  case "start":
2586
- p3[u3] -= g3 * (a3 && d3 ? -1 : 1);
2725
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
2587
2726
  break;
2588
2727
  case "end":
2589
- p3[u3] += g3 * (a3 && d3 ? -1 : 1);
2728
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
2729
+ break;
2590
2730
  }
2591
- return p3;
2592
- }
2593
- var o = async (t2, e2, n3) => {
2594
- const { placement: r4 = "bottom", strategy: o3 = "absolute", middleware: a3 = [], platform: l3 } = n3, s3 = await (null == l3.isRTL ? void 0 : l3.isRTL(e2));
2595
- let c3 = await l3.getElementRects({ reference: t2, floating: e2, strategy: o3 }), { x: f3, y: u3 } = i(c3, r4, s3), m3 = r4, g3 = {}, d3 = 0;
2596
- for (let n4 = 0; n4 < a3.length; n4++) {
2597
- const { name: p3, fn: h3 } = a3[n4], { x: y3, y: x3, data: w3, reset: v3 } = await h3({ x: f3, y: u3, initialPlacement: r4, placement: m3, strategy: o3, middlewareData: g3, rects: c3, platform: l3, elements: { reference: t2, floating: e2 } });
2598
- 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);
2599
- }
2600
- return { x: f3, y: u3, placement: m3, strategy: o3, middlewareData: g3 };
2601
- };
2602
- function a(t2) {
2603
- return "number" != typeof t2 ? function(t3) {
2604
- return __spreadValues({ top: 0, right: 0, bottom: 0, left: 0 }, t3);
2605
- }(t2) : { top: t2, right: t2, bottom: t2, left: t2 };
2606
- }
2607
- function l(t2) {
2608
- return __spreadProps(__spreadValues({}, t2), { top: t2.y, left: t2.x, right: t2.x + t2.width, bottom: t2.y + t2.height });
2731
+ return coords;
2609
2732
  }
2610
- async function s(t2, e2) {
2611
- var n3;
2612
- void 0 === e2 && (e2 = {});
2613
- const { x: r4, 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: r4, y: i3 }) : s3.reference, offsetParent: await (null == o3.getOffsetParent ? void 0 : o3.getOffsetParent(c3.floating)), strategy: f3 }) : s3[g3]);
2614
- 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 };
2615
- }
2616
- var c = Math.min;
2617
- var f = Math.max;
2618
- function u(t2, e2, n3) {
2619
- return f(t2, c(e2, n3));
2620
- }
2621
- var m = (t2) => ({ name: "arrow", options: t2, async fn(i3) {
2622
- const { element: o3, padding: l3 = 0 } = null != t2 ? t2 : {}, { x: s3, y: c3, placement: f3, rects: m3, platform: g3 } = i3;
2623
- if (null == o3)
2624
- return {};
2625
- const d3 = a(l3), p3 = { x: s3, y: c3 }, h3 = n(f3), y3 = e(f3), x3 = r2(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));
2626
- let T3 = P2 ? "y" === h3 ? P2.clientHeight || 0 : P2.clientWidth || 0 : 0;
2627
- 0 === T3 && (T3 = m3.floating[x3]);
2628
- 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];
2629
- return { [h3]: p3[h3] - (C2 ? k2 < D3 ? D3 - k2 : L3 - k2 : 0), data: { [h3]: E3, centerOffset: k2 - E3 } };
2630
- } });
2631
- var g = { left: "right", right: "left", bottom: "top", top: "bottom" };
2632
- function d(t2) {
2633
- return t2.replace(/left|right|bottom|top/g, (t3) => g[t3]);
2634
- }
2635
- function p(t2, i3, o3) {
2636
- void 0 === o3 && (o3 = false);
2637
- const a3 = e(t2), l3 = n(t2), s3 = r2(l3);
2638
- let c3 = "x" === l3 ? a3 === (o3 ? "end" : "start") ? "right" : "left" : "start" === a3 ? "bottom" : "top";
2639
- return i3.reference[s3] > i3.floating[s3] && (c3 = d(c3)), { main: c3, cross: d(c3) };
2733
+ var computePosition = async (reference, floating, config) => {
2734
+ const {
2735
+ placement = "bottom",
2736
+ strategy = "absolute",
2737
+ middleware = [],
2738
+ platform: platform2
2739
+ } = config;
2740
+ const validMiddleware = middleware.filter(Boolean);
2741
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
2742
+ let rects = await platform2.getElementRects({
2743
+ reference,
2744
+ floating,
2745
+ strategy
2746
+ });
2747
+ let {
2748
+ x,
2749
+ y
2750
+ } = computeCoordsFromPlacement(rects, placement, rtl);
2751
+ let statefulPlacement = placement;
2752
+ let middlewareData = {};
2753
+ let resetCount = 0;
2754
+ for (let i = 0; i < validMiddleware.length; i++) {
2755
+ const {
2756
+ name,
2757
+ fn
2758
+ } = validMiddleware[i];
2759
+ const {
2760
+ x: nextX,
2761
+ y: nextY,
2762
+ data,
2763
+ reset
2764
+ } = await fn({
2765
+ x,
2766
+ y,
2767
+ initialPlacement: placement,
2768
+ placement: statefulPlacement,
2769
+ strategy,
2770
+ middlewareData,
2771
+ rects,
2772
+ platform: platform2,
2773
+ elements: {
2774
+ reference,
2775
+ floating
2776
+ }
2777
+ });
2778
+ x = nextX != null ? nextX : x;
2779
+ y = nextY != null ? nextY : y;
2780
+ middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
2781
+ [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
2782
+ });
2783
+ if (reset && resetCount <= 50) {
2784
+ resetCount++;
2785
+ if (typeof reset === "object") {
2786
+ if (reset.placement) {
2787
+ statefulPlacement = reset.placement;
2788
+ }
2789
+ if (reset.rects) {
2790
+ rects = reset.rects === true ? await platform2.getElementRects({
2791
+ reference,
2792
+ floating,
2793
+ strategy
2794
+ }) : reset.rects;
2795
+ }
2796
+ ({
2797
+ x,
2798
+ y
2799
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
2800
+ }
2801
+ i = -1;
2802
+ }
2803
+ }
2804
+ return {
2805
+ x,
2806
+ y,
2807
+ placement: statefulPlacement,
2808
+ strategy,
2809
+ middlewareData
2810
+ };
2811
+ };
2812
+ async function detectOverflow(state, options) {
2813
+ var _await$platform$isEle;
2814
+ if (options === void 0) {
2815
+ options = {};
2816
+ }
2817
+ const {
2818
+ x,
2819
+ y,
2820
+ platform: platform2,
2821
+ rects,
2822
+ elements,
2823
+ strategy
2824
+ } = state;
2825
+ const {
2826
+ boundary = "clippingAncestors",
2827
+ rootBoundary = "viewport",
2828
+ elementContext = "floating",
2829
+ altBoundary = false,
2830
+ padding = 0
2831
+ } = evaluate(options, state);
2832
+ const paddingObject = getPaddingObject(padding);
2833
+ const altContext = elementContext === "floating" ? "reference" : "floating";
2834
+ const element = elements[altBoundary ? altContext : elementContext];
2835
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
2836
+ 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)),
2837
+ boundary,
2838
+ rootBoundary,
2839
+ strategy
2840
+ }));
2841
+ const rect = elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
2842
+ x,
2843
+ y
2844
+ }) : rects.reference;
2845
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
2846
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
2847
+ x: 1,
2848
+ y: 1
2849
+ } : {
2850
+ x: 1,
2851
+ y: 1
2852
+ };
2853
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
2854
+ elements,
2855
+ rect,
2856
+ offsetParent,
2857
+ strategy
2858
+ }) : rect);
2859
+ return {
2860
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
2861
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
2862
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
2863
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
2864
+ };
2640
2865
  }
2641
- var h = { start: "end", end: "start" };
2642
- function y(t2) {
2643
- return t2.replace(/start|end/g, (t3) => h[t3]);
2866
+ var arrow = (options) => ({
2867
+ name: "arrow",
2868
+ options,
2869
+ async fn(state) {
2870
+ const {
2871
+ x,
2872
+ y,
2873
+ placement,
2874
+ rects,
2875
+ platform: platform2,
2876
+ elements,
2877
+ middlewareData
2878
+ } = state;
2879
+ const {
2880
+ element,
2881
+ padding = 0
2882
+ } = evaluate(options, state) || {};
2883
+ if (element == null) {
2884
+ return {};
2885
+ }
2886
+ const paddingObject = getPaddingObject(padding);
2887
+ const coords = {
2888
+ x,
2889
+ y
2890
+ };
2891
+ const axis = getAlignmentAxis(placement);
2892
+ const length = getAxisLength(axis);
2893
+ const arrowDimensions = await platform2.getDimensions(element);
2894
+ const isYAxis = axis === "y";
2895
+ const minProp = isYAxis ? "top" : "left";
2896
+ const maxProp = isYAxis ? "bottom" : "right";
2897
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
2898
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
2899
+ const startDiff = coords[axis] - rects.reference[axis];
2900
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
2901
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
2902
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
2903
+ clientSize = elements.floating[clientProp] || rects.floating[length];
2904
+ }
2905
+ const centerToReference = endDiff / 2 - startDiff / 2;
2906
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
2907
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
2908
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
2909
+ const min$1 = minPadding;
2910
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
2911
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
2912
+ const offset2 = clamp(min$1, center, max2);
2913
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
2914
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
2915
+ return {
2916
+ [axis]: coords[axis] + alignmentOffset,
2917
+ data: __spreadValues({
2918
+ [axis]: offset2,
2919
+ centerOffset: center - offset2 - alignmentOffset
2920
+ }, shouldAddOffset && {
2921
+ alignmentOffset
2922
+ }),
2923
+ reset: shouldAddOffset
2924
+ };
2925
+ }
2926
+ });
2927
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
2928
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
2929
+ return allowedPlacementsSortedByAlignment.filter((placement) => {
2930
+ if (alignment) {
2931
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
2932
+ }
2933
+ return true;
2934
+ });
2644
2935
  }
2645
- var x = ["top", "right", "bottom", "left"];
2646
- var w = x.reduce((t2, e2) => t2.concat(e2, e2 + "-start", e2 + "-end"), []);
2647
- var b = function(e2) {
2648
- return void 0 === e2 && (e2 = {}), { name: "flip", options: e2, async fn(n3) {
2649
- var r4;
2650
- 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) {
2651
- const e3 = d(t2);
2652
- return [y(t2), e3, y(e3)];
2653
- }(l3)), R2 = [l3, ...b3], A = await s(n3, w3), P2 = [];
2654
- let T3 = (null == (r4 = o3.flip) ? void 0 : r4.overflows) || [];
2655
- if (u3 && P2.push(A[v3]), m3) {
2656
- const { main: t2, cross: e3 } = p(i3, a3, await (null == c3.isRTL ? void 0 : c3.isRTL(f3.floating)));
2657
- P2.push(A[t2], A[e3]);
2936
+ var autoPlacement = function(options) {
2937
+ if (options === void 0) {
2938
+ options = {};
2939
+ }
2940
+ return {
2941
+ name: "autoPlacement",
2942
+ options,
2943
+ async fn(state) {
2944
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
2945
+ const {
2946
+ rects,
2947
+ middlewareData,
2948
+ placement,
2949
+ platform: platform2,
2950
+ elements
2951
+ } = state;
2952
+ const _a = evaluate(options, state), {
2953
+ crossAxis = false,
2954
+ alignment,
2955
+ allowedPlacements = placements,
2956
+ autoAlignment = true
2957
+ } = _a, detectOverflowOptions = __objRest(_a, [
2958
+ "crossAxis",
2959
+ "alignment",
2960
+ "allowedPlacements",
2961
+ "autoAlignment"
2962
+ ]);
2963
+ const placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
2964
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2965
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
2966
+ const currentPlacement = placements$1[currentIndex];
2967
+ if (currentPlacement == null) {
2968
+ return {};
2969
+ }
2970
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
2971
+ if (placement !== currentPlacement) {
2972
+ return {
2973
+ reset: {
2974
+ placement: placements$1[0]
2975
+ }
2976
+ };
2977
+ }
2978
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
2979
+ const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
2980
+ placement: currentPlacement,
2981
+ overflows: currentOverflows
2982
+ }];
2983
+ const nextPlacement = placements$1[currentIndex + 1];
2984
+ if (nextPlacement) {
2985
+ return {
2986
+ data: {
2987
+ index: currentIndex + 1,
2988
+ overflows: allOverflows
2989
+ },
2990
+ reset: {
2991
+ placement: nextPlacement
2992
+ }
2993
+ };
2994
+ }
2995
+ const placementsSortedByMostSpace = allOverflows.map((d) => {
2996
+ const alignment2 = getAlignment(d.placement);
2997
+ return [d.placement, alignment2 && crossAxis ? (
2998
+ // Check along the mainAxis and main crossAxis side.
2999
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0)
3000
+ ) : (
3001
+ // Check only the mainAxis.
3002
+ d.overflows[0]
3003
+ ), d.overflows];
3004
+ }).sort((a, b) => a[1] - b[1]);
3005
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d) => d[2].slice(
3006
+ 0,
3007
+ // Aligned placements should not check their opposite crossAxis
3008
+ // side.
3009
+ getAlignment(d[0]) ? 2 : 3
3010
+ ).every((v) => v <= 0));
3011
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
3012
+ if (resetPlacement !== placement) {
3013
+ return {
3014
+ data: {
3015
+ index: currentIndex + 1,
3016
+ overflows: allOverflows
3017
+ },
3018
+ reset: {
3019
+ placement: resetPlacement
3020
+ }
3021
+ };
3022
+ }
3023
+ return {};
2658
3024
  }
2659
- if (T3 = [...T3, { placement: i3, overflows: P2 }], !P2.every((t2) => t2 <= 0)) {
2660
- var O2, D3;
2661
- const t2 = (null != (O2 = null == (D3 = o3.flip) ? void 0 : D3.index) ? O2 : 0) + 1, e3 = R2[t2];
2662
- if (e3)
2663
- return { data: { index: t2, overflows: T3 }, reset: { placement: e3 } };
2664
- let n4 = "bottom";
2665
- switch (h3) {
2666
- case "bestFit": {
2667
- var L3;
2668
- 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;
2669
- t3 && (n4 = t3);
2670
- break;
3025
+ };
3026
+ };
3027
+ var flip = function(options) {
3028
+ if (options === void 0) {
3029
+ options = {};
3030
+ }
3031
+ return {
3032
+ name: "flip",
3033
+ options,
3034
+ async fn(state) {
3035
+ var _middlewareData$arrow, _middlewareData$flip;
3036
+ const {
3037
+ placement,
3038
+ middlewareData,
3039
+ rects,
3040
+ initialPlacement,
3041
+ platform: platform2,
3042
+ elements
3043
+ } = state;
3044
+ const _a = evaluate(options, state), {
3045
+ mainAxis: checkMainAxis = true,
3046
+ crossAxis: checkCrossAxis = true,
3047
+ fallbackPlacements: specifiedFallbackPlacements,
3048
+ fallbackStrategy = "bestFit",
3049
+ fallbackAxisSideDirection = "none",
3050
+ flipAlignment = true
3051
+ } = _a, detectOverflowOptions = __objRest(_a, [
3052
+ "mainAxis",
3053
+ "crossAxis",
3054
+ "fallbackPlacements",
3055
+ "fallbackStrategy",
3056
+ "fallbackAxisSideDirection",
3057
+ "flipAlignment"
3058
+ ]);
3059
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3060
+ return {};
3061
+ }
3062
+ const side2 = getSide(placement);
3063
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
3064
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
3065
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
3066
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
3067
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
3068
+ }
3069
+ const placements2 = [initialPlacement, ...fallbackPlacements];
3070
+ const overflow = await detectOverflow(state, detectOverflowOptions);
3071
+ const overflows = [];
3072
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
3073
+ if (checkMainAxis) {
3074
+ overflows.push(overflow[side2]);
3075
+ }
3076
+ if (checkCrossAxis) {
3077
+ const sides2 = getAlignmentSides(placement, rects, rtl);
3078
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
3079
+ }
3080
+ overflowsData = [...overflowsData, {
3081
+ placement,
3082
+ overflows
3083
+ }];
3084
+ if (!overflows.every((side3) => side3 <= 0)) {
3085
+ var _middlewareData$flip2, _overflowsData$filter;
3086
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
3087
+ const nextPlacement = placements2[nextIndex];
3088
+ if (nextPlacement) {
3089
+ return {
3090
+ data: {
3091
+ index: nextIndex,
3092
+ overflows: overflowsData
3093
+ },
3094
+ reset: {
3095
+ placement: nextPlacement
3096
+ }
3097
+ };
3098
+ }
3099
+ 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;
3100
+ if (!resetPlacement) {
3101
+ switch (fallbackStrategy) {
3102
+ case "bestFit": {
3103
+ var _overflowsData$map$so;
3104
+ 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];
3105
+ if (placement2) {
3106
+ resetPlacement = placement2;
3107
+ }
3108
+ break;
3109
+ }
3110
+ case "initialPlacement":
3111
+ resetPlacement = initialPlacement;
3112
+ break;
3113
+ }
3114
+ }
3115
+ if (placement !== resetPlacement) {
3116
+ return {
3117
+ reset: {
3118
+ placement: resetPlacement
3119
+ }
3120
+ };
2671
3121
  }
2672
- case "initialPlacement":
2673
- n4 = l3;
2674
3122
  }
2675
- if (i3 !== n4)
2676
- return { reset: { placement: n4 } };
3123
+ return {};
2677
3124
  }
2678
- return {};
2679
- } };
2680
- };
2681
- var T = function(r4) {
2682
- return void 0 === r4 && (r4 = 0), { name: "offset", options: r4, async fn(i3) {
2683
- const { x: o3, y: a3 } = i3, l3 = await async function(r5, i4) {
2684
- const { placement: o4, platform: a4, elements: l4 } = r5, 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(r5) : i4;
2685
- let { mainAxis: p3, crossAxis: h3, alignmentAxis: y3 } = "number" == typeof d3 ? { mainAxis: d3, crossAxis: 0, alignmentAxis: null } : __spreadValues({ mainAxis: 0, crossAxis: 0, alignmentAxis: null }, d3);
2686
- return f3 && "number" == typeof y3 && (h3 = "end" === f3 ? -1 * y3 : y3), u3 ? { x: h3 * g3, y: p3 * m3 } : { x: p3 * m3, y: h3 * g3 };
2687
- }(i3, r4);
2688
- return { x: o3 + l3.x, y: a3 + l3.y, data: l3 };
2689
- } };
2690
- };
2691
- function O(t2) {
2692
- return "x" === t2 ? "y" : "x";
3125
+ };
3126
+ };
3127
+ async function convertValueToCoords(state, options) {
3128
+ const {
3129
+ placement,
3130
+ platform: platform2,
3131
+ elements
3132
+ } = state;
3133
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
3134
+ const side2 = getSide(placement);
3135
+ const alignment = getAlignment(placement);
3136
+ const isVertical = getSideAxis(placement) === "y";
3137
+ const mainAxisMulti = ["left", "top"].includes(side2) ? -1 : 1;
3138
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
3139
+ const rawValue = evaluate(options, state);
3140
+ let {
3141
+ mainAxis,
3142
+ crossAxis,
3143
+ alignmentAxis
3144
+ } = typeof rawValue === "number" ? {
3145
+ mainAxis: rawValue,
3146
+ crossAxis: 0,
3147
+ alignmentAxis: null
3148
+ } : __spreadValues({
3149
+ mainAxis: 0,
3150
+ crossAxis: 0,
3151
+ alignmentAxis: null
3152
+ }, rawValue);
3153
+ if (alignment && typeof alignmentAxis === "number") {
3154
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
3155
+ }
3156
+ return isVertical ? {
3157
+ x: crossAxis * crossAxisMulti,
3158
+ y: mainAxis * mainAxisMulti
3159
+ } : {
3160
+ x: mainAxis * mainAxisMulti,
3161
+ y: crossAxis * crossAxisMulti
3162
+ };
2693
3163
  }
2694
- var D = function(e2) {
2695
- return void 0 === e2 && (e2 = {}), { name: "shift", options: e2, async fn(r4) {
2696
- const { x: i3, y: o3, placement: a3 } = r4, _a = e2, { mainAxis: l3 = true, crossAxis: c3 = false, limiter: f3 = { fn: (t2) => {
2697
- let { x: e3, y: n3 } = t2;
2698
- return { x: e3, y: n3 };
2699
- } } } = _a, m3 = __objRest(_a, ["mainAxis", "crossAxis", "limiter"]), g3 = { x: i3, y: o3 }, d3 = await s(r4, m3), p3 = n(t(a3)), h3 = O(p3);
2700
- let y3 = g3[p3], x3 = g3[h3];
2701
- if (l3) {
2702
- const t2 = "y" === p3 ? "bottom" : "right";
2703
- y3 = u(y3 + d3["y" === p3 ? "top" : "left"], y3, y3 - d3[t2]);
3164
+ var offset = function(options) {
3165
+ if (options === void 0) {
3166
+ options = 0;
3167
+ }
3168
+ return {
3169
+ name: "offset",
3170
+ options,
3171
+ async fn(state) {
3172
+ var _middlewareData$offse, _middlewareData$arrow;
3173
+ const {
3174
+ x,
3175
+ y,
3176
+ placement,
3177
+ middlewareData
3178
+ } = state;
3179
+ const diffCoords = await convertValueToCoords(state, options);
3180
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3181
+ return {};
3182
+ }
3183
+ return {
3184
+ x: x + diffCoords.x,
3185
+ y: y + diffCoords.y,
3186
+ data: __spreadProps(__spreadValues({}, diffCoords), {
3187
+ placement
3188
+ })
3189
+ };
2704
3190
  }
2705
- if (c3) {
2706
- const t2 = "y" === h3 ? "bottom" : "right";
2707
- x3 = u(x3 + d3["y" === h3 ? "top" : "left"], x3, x3 - d3[t2]);
3191
+ };
3192
+ };
3193
+ var shift = function(options) {
3194
+ if (options === void 0) {
3195
+ options = {};
3196
+ }
3197
+ return {
3198
+ name: "shift",
3199
+ options,
3200
+ async fn(state) {
3201
+ const {
3202
+ x,
3203
+ y,
3204
+ placement
3205
+ } = state;
3206
+ const _a = evaluate(options, state), {
3207
+ mainAxis: checkMainAxis = true,
3208
+ crossAxis: checkCrossAxis = false,
3209
+ limiter = {
3210
+ fn: (_ref) => {
3211
+ let {
3212
+ x: x2,
3213
+ y: y2
3214
+ } = _ref;
3215
+ return {
3216
+ x: x2,
3217
+ y: y2
3218
+ };
3219
+ }
3220
+ }
3221
+ } = _a, detectOverflowOptions = __objRest(_a, [
3222
+ "mainAxis",
3223
+ "crossAxis",
3224
+ "limiter"
3225
+ ]);
3226
+ const coords = {
3227
+ x,
3228
+ y
3229
+ };
3230
+ const overflow = await detectOverflow(state, detectOverflowOptions);
3231
+ const crossAxis = getSideAxis(getSide(placement));
3232
+ const mainAxis = getOppositeAxis(crossAxis);
3233
+ let mainAxisCoord = coords[mainAxis];
3234
+ let crossAxisCoord = coords[crossAxis];
3235
+ if (checkMainAxis) {
3236
+ const minSide = mainAxis === "y" ? "top" : "left";
3237
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
3238
+ const min2 = mainAxisCoord + overflow[minSide];
3239
+ const max2 = mainAxisCoord - overflow[maxSide];
3240
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
3241
+ }
3242
+ if (checkCrossAxis) {
3243
+ const minSide = crossAxis === "y" ? "top" : "left";
3244
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
3245
+ const min2 = crossAxisCoord + overflow[minSide];
3246
+ const max2 = crossAxisCoord - overflow[maxSide];
3247
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
3248
+ }
3249
+ const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, state), {
3250
+ [mainAxis]: mainAxisCoord,
3251
+ [crossAxis]: crossAxisCoord
3252
+ }));
3253
+ return __spreadProps(__spreadValues({}, limitedCoords), {
3254
+ data: {
3255
+ x: limitedCoords.x - x,
3256
+ y: limitedCoords.y - y
3257
+ }
3258
+ });
2708
3259
  }
2709
- const w3 = f3.fn(__spreadProps(__spreadValues({}, r4), { [p3]: y3, [h3]: x3 }));
2710
- return __spreadProps(__spreadValues({}, w3), { data: { x: w3.x - i3, y: w3.y - o3 } });
2711
- } };
3260
+ };
2712
3261
  };
2713
3262
 
2714
- // node_modules/.pnpm/@floating-ui+dom@0.5.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
2715
- function n2(t2) {
2716
- return t2 && t2.document && t2.location && t2.alert && t2.setInterval;
3263
+ // node_modules/.pnpm/@floating-ui+utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
3264
+ function getNodeName(node) {
3265
+ if (isNode(node)) {
3266
+ return (node.nodeName || "").toLowerCase();
3267
+ }
3268
+ return "#document";
2717
3269
  }
2718
- function o2(t2) {
2719
- if (null == t2)
2720
- return window;
2721
- if (!n2(t2)) {
2722
- const e2 = t2.ownerDocument;
2723
- return e2 && e2.defaultView || window;
2724
- }
2725
- return t2;
3270
+ function getWindow(node) {
3271
+ var _node$ownerDocument;
3272
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2726
3273
  }
2727
- function i2(t2) {
2728
- return o2(t2).getComputedStyle(t2);
3274
+ function getDocumentElement(node) {
3275
+ var _ref;
3276
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2729
3277
  }
2730
- function r3(t2) {
2731
- return n2(t2) ? "" : t2 ? (t2.nodeName || "").toLowerCase() : "";
3278
+ function isNode(value) {
3279
+ return value instanceof Node || value instanceof getWindow(value).Node;
2732
3280
  }
2733
- function l2() {
2734
- const t2 = navigator.userAgentData;
2735
- return null != t2 && t2.brands ? t2.brands.map((t3) => t3.brand + "/" + t3.version).join(" ") : navigator.userAgent;
3281
+ function isElement(value) {
3282
+ return value instanceof Element || value instanceof getWindow(value).Element;
2736
3283
  }
2737
- function c2(t2) {
2738
- return t2 instanceof o2(t2).HTMLElement;
3284
+ function isHTMLElement(value) {
3285
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
2739
3286
  }
2740
- function f2(t2) {
2741
- return t2 instanceof o2(t2).Element;
3287
+ function isShadowRoot(value) {
3288
+ if (typeof ShadowRoot === "undefined") {
3289
+ return false;
3290
+ }
3291
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2742
3292
  }
2743
- function s2(t2) {
2744
- if ("undefined" == typeof ShadowRoot)
3293
+ function isOverflowElement(element) {
3294
+ const {
3295
+ overflow,
3296
+ overflowX,
3297
+ overflowY,
3298
+ display
3299
+ } = getComputedStyle(element);
3300
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
3301
+ }
3302
+ function isTableElement(element) {
3303
+ return ["table", "td", "th"].includes(getNodeName(element));
3304
+ }
3305
+ function isContainingBlock(element) {
3306
+ const webkit = isWebKit();
3307
+ const css10 = getComputedStyle(element);
3308
+ return css10.transform !== "none" || css10.perspective !== "none" || (css10.containerType ? css10.containerType !== "normal" : false) || !webkit && (css10.backdropFilter ? css10.backdropFilter !== "none" : false) || !webkit && (css10.filter ? css10.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css10.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css10.contain || "").includes(value));
3309
+ }
3310
+ function getContainingBlock(element) {
3311
+ let currentNode = getParentNode(element);
3312
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
3313
+ if (isContainingBlock(currentNode)) {
3314
+ return currentNode;
3315
+ } else {
3316
+ currentNode = getParentNode(currentNode);
3317
+ }
3318
+ }
3319
+ return null;
3320
+ }
3321
+ function isWebKit() {
3322
+ if (typeof CSS === "undefined" || !CSS.supports)
2745
3323
  return false;
2746
- return t2 instanceof o2(t2).ShadowRoot || t2 instanceof ShadowRoot;
3324
+ return CSS.supports("-webkit-backdrop-filter", "none");
2747
3325
  }
2748
- function u2(t2) {
2749
- const { overflow: e2, overflowX: n3, overflowY: o3 } = i2(t2);
2750
- return /auto|scroll|overlay|hidden/.test(e2 + o3 + n3);
3326
+ function isLastTraversableNode(node) {
3327
+ return ["html", "body", "#document"].includes(getNodeName(node));
2751
3328
  }
2752
- function d2(t2) {
2753
- return ["table", "td", "th"].includes(r3(t2));
3329
+ function getComputedStyle(element) {
3330
+ return getWindow(element).getComputedStyle(element);
2754
3331
  }
2755
- function h2(t2) {
2756
- const e2 = /firefox/i.test(l2()), n3 = i2(t2);
2757
- 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;
3332
+ function getNodeScroll(element) {
3333
+ if (isElement(element)) {
3334
+ return {
3335
+ scrollLeft: element.scrollLeft,
3336
+ scrollTop: element.scrollTop
3337
+ };
3338
+ }
3339
+ return {
3340
+ scrollLeft: element.pageXOffset,
3341
+ scrollTop: element.pageYOffset
3342
+ };
2758
3343
  }
2759
- function a2() {
2760
- return !/^((?!chrome|android).)*safari/i.test(l2());
3344
+ function getParentNode(node) {
3345
+ if (getNodeName(node) === "html") {
3346
+ return node;
3347
+ }
3348
+ const result = (
3349
+ // Step into the shadow DOM of the parent of a slotted node.
3350
+ node.assignedSlot || // DOM Element detected.
3351
+ node.parentNode || // ShadowRoot detected.
3352
+ isShadowRoot(node) && node.host || // Fallback.
3353
+ getDocumentElement(node)
3354
+ );
3355
+ return isShadowRoot(result) ? result.host : result;
2761
3356
  }
2762
- var g2 = Math.min;
2763
- var p2 = Math.max;
2764
- var m2 = Math.round;
2765
- function w2(t2, e2, n3) {
2766
- var i3, r4, l3, s3;
2767
- void 0 === e2 && (e2 = false), void 0 === n3 && (n3 = false);
2768
- const u3 = t2.getBoundingClientRect();
2769
- let d3 = 1, h3 = 1;
2770
- e2 && c2(t2) && (d3 = t2.offsetWidth > 0 && m2(u3.width) / t2.offsetWidth || 1, h3 = t2.offsetHeight > 0 && m2(u3.height) / t2.offsetHeight || 1);
2771
- const g3 = f2(t2) ? o2(t2) : window, p3 = !a2() && n3, w3 = (u3.left + (p3 && null != (i3 = null == (r4 = g3.visualViewport) ? void 0 : r4.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;
2772
- return { width: y3, height: x3, top: v3, right: w3 + y3, bottom: v3 + x3, left: w3, x: w3, y: v3 };
3357
+ function getNearestOverflowAncestor(node) {
3358
+ const parentNode = getParentNode(node);
3359
+ if (isLastTraversableNode(parentNode)) {
3360
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
3361
+ }
3362
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
3363
+ return parentNode;
3364
+ }
3365
+ return getNearestOverflowAncestor(parentNode);
2773
3366
  }
2774
- function v2(t2) {
2775
- return (e2 = t2, (e2 instanceof o2(e2).Node ? t2.ownerDocument : t2.document) || window.document).documentElement;
2776
- var e2;
3367
+ function getOverflowAncestors(node, list, traverseIframes) {
3368
+ var _node$ownerDocument2;
3369
+ if (list === void 0) {
3370
+ list = [];
3371
+ }
3372
+ if (traverseIframes === void 0) {
3373
+ traverseIframes = true;
3374
+ }
3375
+ const scrollableAncestor = getNearestOverflowAncestor(node);
3376
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
3377
+ const win = getWindow(scrollableAncestor);
3378
+ if (isBody) {
3379
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
3380
+ }
3381
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2777
3382
  }
2778
- function y2(t2) {
2779
- return f2(t2) ? { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop } : { scrollLeft: t2.pageXOffset, scrollTop: t2.pageYOffset };
3383
+
3384
+ // node_modules/.pnpm/@floating-ui+dom@1.6.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
3385
+ function getCssDimensions(element) {
3386
+ const css10 = getComputedStyle(element);
3387
+ let width = parseFloat(css10.width) || 0;
3388
+ let height = parseFloat(css10.height) || 0;
3389
+ const hasOffset = isHTMLElement(element);
3390
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
3391
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
3392
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
3393
+ if (shouldFallback) {
3394
+ width = offsetWidth;
3395
+ height = offsetHeight;
3396
+ }
3397
+ return {
3398
+ width,
3399
+ height,
3400
+ $: shouldFallback
3401
+ };
2780
3402
  }
2781
- function x2(t2) {
2782
- return w2(v2(t2)).left + y2(t2).scrollLeft;
3403
+ function unwrapElement(element) {
3404
+ return !isElement(element) ? element.contextElement : element;
2783
3405
  }
2784
- function b2(t2, e2, n3) {
2785
- const o3 = c2(e2), i3 = v2(e2), l3 = w2(t2, o3 && function(t3) {
2786
- const e3 = w2(t3);
2787
- return m2(e3.width) !== t3.offsetWidth || m2(e3.height) !== t3.offsetHeight;
2788
- }(e2), "fixed" === n3);
2789
- let f3 = { scrollLeft: 0, scrollTop: 0 };
2790
- const s3 = { x: 0, y: 0 };
2791
- if (o3 || !o3 && "fixed" !== n3)
2792
- if (("body" !== r3(e2) || u2(i3)) && (f3 = y2(e2)), c2(e2)) {
2793
- const t3 = w2(e2, true);
2794
- s3.x = t3.x + e2.clientLeft, s3.y = t3.y + e2.clientTop;
2795
- } else
2796
- i3 && (s3.x = x2(i3));
2797
- return { x: l3.left + f3.scrollLeft - s3.x, y: l3.top + f3.scrollTop - s3.y, width: l3.width, height: l3.height };
3406
+ function getScale(element) {
3407
+ const domElement = unwrapElement(element);
3408
+ if (!isHTMLElement(domElement)) {
3409
+ return createCoords(1);
3410
+ }
3411
+ const rect = domElement.getBoundingClientRect();
3412
+ const {
3413
+ width,
3414
+ height,
3415
+ $
3416
+ } = getCssDimensions(domElement);
3417
+ let x = ($ ? round(rect.width) : rect.width) / width;
3418
+ let y = ($ ? round(rect.height) : rect.height) / height;
3419
+ if (!x || !Number.isFinite(x)) {
3420
+ x = 1;
3421
+ }
3422
+ if (!y || !Number.isFinite(y)) {
3423
+ y = 1;
3424
+ }
3425
+ return {
3426
+ x,
3427
+ y
3428
+ };
2798
3429
  }
2799
- function L2(t2) {
2800
- return "html" === r3(t2) ? t2 : t2.assignedSlot || t2.parentNode || (s2(t2) ? t2.host : null) || v2(t2);
3430
+ var noOffsets = /* @__PURE__ */ createCoords(0);
3431
+ function getVisualOffsets(element) {
3432
+ const win = getWindow(element);
3433
+ if (!isWebKit() || !win.visualViewport) {
3434
+ return noOffsets;
3435
+ }
3436
+ return {
3437
+ x: win.visualViewport.offsetLeft,
3438
+ y: win.visualViewport.offsetTop
3439
+ };
2801
3440
  }
2802
- function R(t2) {
2803
- return c2(t2) && "fixed" !== getComputedStyle(t2).position ? t2.offsetParent : null;
3441
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
3442
+ if (isFixed === void 0) {
3443
+ isFixed = false;
3444
+ }
3445
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
3446
+ return false;
3447
+ }
3448
+ return isFixed;
2804
3449
  }
2805
- function T2(t2) {
2806
- const e2 = o2(t2);
2807
- let n3 = R(t2);
2808
- for (; n3 && d2(n3) && "static" === getComputedStyle(n3).position; )
2809
- n3 = R(n3);
2810
- return n3 && ("html" === r3(n3) || "body" === r3(n3) && "static" === getComputedStyle(n3).position && !h2(n3)) ? e2 : n3 || function(t3) {
2811
- let e3 = L2(t3);
2812
- for (s2(e3) && (e3 = e3.host); c2(e3) && !["html", "body"].includes(r3(e3)); ) {
2813
- if (h2(e3))
2814
- return e3;
2815
- e3 = e3.parentNode;
3450
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
3451
+ if (includeScale === void 0) {
3452
+ includeScale = false;
3453
+ }
3454
+ if (isFixedStrategy === void 0) {
3455
+ isFixedStrategy = false;
3456
+ }
3457
+ const clientRect = element.getBoundingClientRect();
3458
+ const domElement = unwrapElement(element);
3459
+ let scale = createCoords(1);
3460
+ if (includeScale) {
3461
+ if (offsetParent) {
3462
+ if (isElement(offsetParent)) {
3463
+ scale = getScale(offsetParent);
3464
+ }
3465
+ } else {
3466
+ scale = getScale(element);
2816
3467
  }
2817
- return null;
2818
- }(t2) || e2;
3468
+ }
3469
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
3470
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
3471
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
3472
+ let width = clientRect.width / scale.x;
3473
+ let height = clientRect.height / scale.y;
3474
+ if (domElement) {
3475
+ const win = getWindow(domElement);
3476
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3477
+ let currentWin = win;
3478
+ let currentIFrame = currentWin.frameElement;
3479
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3480
+ const iframeScale = getScale(currentIFrame);
3481
+ const iframeRect = currentIFrame.getBoundingClientRect();
3482
+ const css10 = getComputedStyle(currentIFrame);
3483
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css10.paddingLeft)) * iframeScale.x;
3484
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css10.paddingTop)) * iframeScale.y;
3485
+ x *= iframeScale.x;
3486
+ y *= iframeScale.y;
3487
+ width *= iframeScale.x;
3488
+ height *= iframeScale.y;
3489
+ x += left;
3490
+ y += top;
3491
+ currentWin = getWindow(currentIFrame);
3492
+ currentIFrame = currentWin.frameElement;
3493
+ }
3494
+ }
3495
+ return rectToClientRect({
3496
+ width,
3497
+ height,
3498
+ x,
3499
+ y
3500
+ });
2819
3501
  }
2820
- function W(t2) {
2821
- if (c2(t2))
2822
- return { width: t2.offsetWidth, height: t2.offsetHeight };
2823
- const e2 = w2(t2);
2824
- return { width: e2.width, height: e2.height };
3502
+ var topLayerSelectors = [":popover-open", ":modal"];
3503
+ function isTopLayer(floating) {
3504
+ return topLayerSelectors.some((selector) => {
3505
+ try {
3506
+ return floating.matches(selector);
3507
+ } catch (e) {
3508
+ return false;
3509
+ }
3510
+ });
2825
3511
  }
2826
- function E2(t2) {
2827
- const e2 = L2(t2);
2828
- return ["html", "body", "#document"].includes(r3(e2)) ? t2.ownerDocument.body : c2(e2) && u2(e2) ? e2 : E2(e2);
3512
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
3513
+ let {
3514
+ elements,
3515
+ rect,
3516
+ offsetParent,
3517
+ strategy
3518
+ } = _ref;
3519
+ const isFixed = strategy === "fixed";
3520
+ const documentElement = getDocumentElement(offsetParent);
3521
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
3522
+ if (offsetParent === documentElement || topLayer && isFixed) {
3523
+ return rect;
3524
+ }
3525
+ let scroll = {
3526
+ scrollLeft: 0,
3527
+ scrollTop: 0
3528
+ };
3529
+ let scale = createCoords(1);
3530
+ const offsets = createCoords(0);
3531
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
3532
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3533
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
3534
+ scroll = getNodeScroll(offsetParent);
3535
+ }
3536
+ if (isHTMLElement(offsetParent)) {
3537
+ const offsetRect = getBoundingClientRect(offsetParent);
3538
+ scale = getScale(offsetParent);
3539
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
3540
+ offsets.y = offsetRect.y + offsetParent.clientTop;
3541
+ }
3542
+ }
3543
+ return {
3544
+ width: rect.width * scale.x,
3545
+ height: rect.height * scale.y,
3546
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
3547
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
3548
+ };
2829
3549
  }
2830
- function H(t2, e2) {
2831
- var n3;
2832
- void 0 === e2 && (e2 = []);
2833
- const i3 = E2(t2), r4 = i3 === (null == (n3 = t2.ownerDocument) ? void 0 : n3.body), l3 = o2(i3), c3 = r4 ? [l3].concat(l3.visualViewport || [], u2(i3) ? i3 : []) : i3, f3 = e2.concat(c3);
2834
- return r4 ? f3 : f3.concat(H(c3));
3550
+ function getClientRects(element) {
3551
+ return Array.from(element.getClientRects());
2835
3552
  }
2836
- function C(e2, n3, r4) {
2837
- return "viewport" === n3 ? l(function(t2, e3) {
2838
- const n4 = o2(t2), i3 = v2(t2), r5 = n4.visualViewport;
2839
- let l3 = i3.clientWidth, c3 = i3.clientHeight, f3 = 0, s3 = 0;
2840
- if (r5) {
2841
- l3 = r5.width, c3 = r5.height;
2842
- const t3 = a2();
2843
- (t3 || !t3 && "fixed" === e3) && (f3 = r5.offsetLeft, s3 = r5.offsetTop);
2844
- }
2845
- return { width: l3, height: c3, x: f3, y: s3 };
2846
- }(e2, r4)) : f2(n3) ? function(t2, e3) {
2847
- const n4 = w2(t2, false, "fixed" === e3), o3 = n4.top + t2.clientTop, i3 = n4.left + t2.clientLeft;
2848
- return { top: o3, left: i3, x: i3, y: o3, right: i3 + t2.clientWidth, bottom: o3 + t2.clientHeight, width: t2.clientWidth, height: t2.clientHeight };
2849
- }(n3, r4) : l(function(t2) {
2850
- var e3;
2851
- const n4 = v2(t2), o3 = y2(t2), r5 = null == (e3 = t2.ownerDocument) ? void 0 : e3.body, l3 = p2(n4.scrollWidth, n4.clientWidth, r5 ? r5.scrollWidth : 0, r5 ? r5.clientWidth : 0), c3 = p2(n4.scrollHeight, n4.clientHeight, r5 ? r5.scrollHeight : 0, r5 ? r5.clientHeight : 0);
2852
- let f3 = -o3.scrollLeft + x2(t2);
2853
- const s3 = -o3.scrollTop;
2854
- return "rtl" === i2(r5 || n4).direction && (f3 += p2(n4.clientWidth, r5 ? r5.clientWidth : 0) - l3), { width: l3, height: c3, x: f3, y: s3 };
2855
- }(v2(e2)));
3553
+ function getWindowScrollBarX(element) {
3554
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2856
3555
  }
2857
- function S(t2) {
2858
- const e2 = H(t2), n3 = ["absolute", "fixed"].includes(i2(t2).position) && c2(t2) ? T2(t2) : t2;
2859
- return f2(n3) ? e2.filter((t3) => f2(t3) && function(t4, e3) {
2860
- const n4 = null == e3.getRootNode ? void 0 : e3.getRootNode();
2861
- if (t4.contains(e3))
2862
- return true;
2863
- if (n4 && s2(n4)) {
2864
- let n5 = e3;
2865
- do {
2866
- if (n5 && t4 === n5)
2867
- return true;
2868
- n5 = n5.parentNode || n5.host;
2869
- } while (n5);
3556
+ function getDocumentRect(element) {
3557
+ const html26 = getDocumentElement(element);
3558
+ const scroll = getNodeScroll(element);
3559
+ const body = element.ownerDocument.body;
3560
+ const width = max(html26.scrollWidth, html26.clientWidth, body.scrollWidth, body.clientWidth);
3561
+ const height = max(html26.scrollHeight, html26.clientHeight, body.scrollHeight, body.clientHeight);
3562
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
3563
+ const y = -scroll.scrollTop;
3564
+ if (getComputedStyle(body).direction === "rtl") {
3565
+ x += max(html26.clientWidth, body.clientWidth) - width;
3566
+ }
3567
+ return {
3568
+ width,
3569
+ height,
3570
+ x,
3571
+ y
3572
+ };
3573
+ }
3574
+ function getViewportRect(element, strategy) {
3575
+ const win = getWindow(element);
3576
+ const html26 = getDocumentElement(element);
3577
+ const visualViewport = win.visualViewport;
3578
+ let width = html26.clientWidth;
3579
+ let height = html26.clientHeight;
3580
+ let x = 0;
3581
+ let y = 0;
3582
+ if (visualViewport) {
3583
+ width = visualViewport.width;
3584
+ height = visualViewport.height;
3585
+ const visualViewportBased = isWebKit();
3586
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
3587
+ x = visualViewport.offsetLeft;
3588
+ y = visualViewport.offsetTop;
2870
3589
  }
3590
+ }
3591
+ return {
3592
+ width,
3593
+ height,
3594
+ x,
3595
+ y
3596
+ };
3597
+ }
3598
+ function getInnerBoundingClientRect(element, strategy) {
3599
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
3600
+ const top = clientRect.top + element.clientTop;
3601
+ const left = clientRect.left + element.clientLeft;
3602
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
3603
+ const width = element.clientWidth * scale.x;
3604
+ const height = element.clientHeight * scale.y;
3605
+ const x = left * scale.x;
3606
+ const y = top * scale.y;
3607
+ return {
3608
+ width,
3609
+ height,
3610
+ x,
3611
+ y
3612
+ };
3613
+ }
3614
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
3615
+ let rect;
3616
+ if (clippingAncestor === "viewport") {
3617
+ rect = getViewportRect(element, strategy);
3618
+ } else if (clippingAncestor === "document") {
3619
+ rect = getDocumentRect(getDocumentElement(element));
3620
+ } else if (isElement(clippingAncestor)) {
3621
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
3622
+ } else {
3623
+ const visualOffsets = getVisualOffsets(element);
3624
+ rect = __spreadProps(__spreadValues({}, clippingAncestor), {
3625
+ x: clippingAncestor.x - visualOffsets.x,
3626
+ y: clippingAncestor.y - visualOffsets.y
3627
+ });
3628
+ }
3629
+ return rectToClientRect(rect);
3630
+ }
3631
+ function hasFixedPositionAncestor(element, stopNode) {
3632
+ const parentNode = getParentNode(element);
3633
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
2871
3634
  return false;
2872
- }(t3, n3) && "body" !== r3(t3)) : [];
3635
+ }
3636
+ return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
3637
+ }
3638
+ function getClippingElementAncestors(element, cache2) {
3639
+ const cachedResult = cache2.get(element);
3640
+ if (cachedResult) {
3641
+ return cachedResult;
3642
+ }
3643
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
3644
+ let currentContainingBlockComputedStyle = null;
3645
+ const elementIsFixed = getComputedStyle(element).position === "fixed";
3646
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
3647
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
3648
+ const computedStyle = getComputedStyle(currentNode);
3649
+ const currentNodeIsContaining = isContainingBlock(currentNode);
3650
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
3651
+ currentContainingBlockComputedStyle = null;
3652
+ }
3653
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
3654
+ if (shouldDropCurrentNode) {
3655
+ result = result.filter((ancestor) => ancestor !== currentNode);
3656
+ } else {
3657
+ currentContainingBlockComputedStyle = computedStyle;
3658
+ }
3659
+ currentNode = getParentNode(currentNode);
3660
+ }
3661
+ cache2.set(element, result);
3662
+ return result;
3663
+ }
3664
+ function getClippingRect(_ref) {
3665
+ let {
3666
+ element,
3667
+ boundary,
3668
+ rootBoundary,
3669
+ strategy
3670
+ } = _ref;
3671
+ const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
3672
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
3673
+ const firstClippingAncestor = clippingAncestors[0];
3674
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
3675
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
3676
+ accRect.top = max(rect.top, accRect.top);
3677
+ accRect.right = min(rect.right, accRect.right);
3678
+ accRect.bottom = min(rect.bottom, accRect.bottom);
3679
+ accRect.left = max(rect.left, accRect.left);
3680
+ return accRect;
3681
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
3682
+ return {
3683
+ width: clippingRect.right - clippingRect.left,
3684
+ height: clippingRect.bottom - clippingRect.top,
3685
+ x: clippingRect.left,
3686
+ y: clippingRect.top
3687
+ };
3688
+ }
3689
+ function getDimensions(element) {
3690
+ const {
3691
+ width,
3692
+ height
3693
+ } = getCssDimensions(element);
3694
+ return {
3695
+ width,
3696
+ height
3697
+ };
3698
+ }
3699
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
3700
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
3701
+ const documentElement = getDocumentElement(offsetParent);
3702
+ const isFixed = strategy === "fixed";
3703
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
3704
+ let scroll = {
3705
+ scrollLeft: 0,
3706
+ scrollTop: 0
3707
+ };
3708
+ const offsets = createCoords(0);
3709
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3710
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
3711
+ scroll = getNodeScroll(offsetParent);
3712
+ }
3713
+ if (isOffsetParentAnElement) {
3714
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
3715
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
3716
+ offsets.y = offsetRect.y + offsetParent.clientTop;
3717
+ } else if (documentElement) {
3718
+ offsets.x = getWindowScrollBarX(documentElement);
3719
+ }
3720
+ }
3721
+ const x = rect.left + scroll.scrollLeft - offsets.x;
3722
+ const y = rect.top + scroll.scrollTop - offsets.y;
3723
+ return {
3724
+ x,
3725
+ y,
3726
+ width: rect.width,
3727
+ height: rect.height
3728
+ };
3729
+ }
3730
+ function getTrueOffsetParent(element, polyfill) {
3731
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
3732
+ return null;
3733
+ }
3734
+ if (polyfill) {
3735
+ return polyfill(element);
3736
+ }
3737
+ return element.offsetParent;
3738
+ }
3739
+ function getOffsetParent(element, polyfill) {
3740
+ const window2 = getWindow(element);
3741
+ if (!isHTMLElement(element) || isTopLayer(element)) {
3742
+ return window2;
3743
+ }
3744
+ let offsetParent = getTrueOffsetParent(element, polyfill);
3745
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
3746
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
3747
+ }
3748
+ if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
3749
+ return window2;
3750
+ }
3751
+ return offsetParent || getContainingBlock(element) || window2;
3752
+ }
3753
+ var getElementRects = async function(data) {
3754
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
3755
+ const getDimensionsFn = this.getDimensions;
3756
+ return {
3757
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
3758
+ floating: __spreadValues({
3759
+ x: 0,
3760
+ y: 0
3761
+ }, await getDimensionsFn(data.floating))
3762
+ };
3763
+ };
3764
+ function isRTL(element) {
3765
+ return getComputedStyle(element).direction === "rtl";
2873
3766
  }
2874
- var D2 = { getClippingRect: function(t2) {
2875
- let { element: e2, boundary: n3, rootBoundary: o3, strategy: i3 } = t2;
2876
- const r4 = [..."clippingAncestors" === n3 ? S(e2) : [].concat(n3), o3], l3 = r4[0], c3 = r4.reduce((t3, n4) => {
2877
- const o4 = C(e2, n4, i3);
2878
- 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;
2879
- }, C(e2, l3, i3));
2880
- return { width: c3.right - c3.left, height: c3.bottom - c3.top, x: c3.left, y: c3.top };
2881
- }, convertOffsetParentRelativeRectToViewportRelativeRect: function(t2) {
2882
- let { rect: e2, offsetParent: n3, strategy: o3 } = t2;
2883
- const i3 = c2(n3), l3 = v2(n3);
2884
- if (n3 === l3)
2885
- return e2;
2886
- let f3 = { scrollLeft: 0, scrollTop: 0 };
2887
- const s3 = { x: 0, y: 0 };
2888
- if ((i3 || !i3 && "fixed" !== o3) && (("body" !== r3(n3) || u2(l3)) && (f3 = y2(n3)), c2(n3))) {
2889
- const t3 = w2(n3, true);
2890
- s3.x = t3.x + n3.clientLeft, s3.y = t3.y + n3.clientTop;
2891
- }
2892
- return __spreadProps(__spreadValues({}, e2), { x: e2.x - f3.scrollLeft + s3.x, y: e2.y - f3.scrollTop + s3.y });
2893
- }, isElement: f2, getDimensions: W, getOffsetParent: T2, getDocumentElement: v2, getElementRects: (t2) => {
2894
- let { reference: e2, floating: n3, strategy: o3 } = t2;
2895
- return { reference: b2(e2, T2(n3), o3), floating: __spreadProps(__spreadValues({}, W(n3)), { x: 0, y: 0 }) };
2896
- }, getClientRects: (t2) => Array.from(t2.getClientRects()), isRTL: (t2) => "rtl" === i2(t2).direction };
2897
- var z = (t2, n3, o3) => o(t2, n3, __spreadValues({ platform: D2 }, o3));
3767
+ var platform = {
3768
+ convertOffsetParentRelativeRectToViewportRelativeRect,
3769
+ getDocumentElement,
3770
+ getClippingRect,
3771
+ getOffsetParent,
3772
+ getElementRects,
3773
+ getClientRects,
3774
+ getDimensions,
3775
+ getScale,
3776
+ isElement,
3777
+ isRTL
3778
+ };
3779
+ var autoPlacement2 = autoPlacement;
3780
+ var shift2 = shift;
3781
+ var flip2 = flip;
3782
+ var arrow2 = arrow;
3783
+ var computePosition2 = (reference, floating, options) => {
3784
+ const cache2 = /* @__PURE__ */ new Map();
3785
+ const mergedOptions = __spreadValues({
3786
+ platform
3787
+ }, options);
3788
+ const platformWithCache = __spreadProps(__spreadValues({}, mergedOptions.platform), {
3789
+ _c: cache2
3790
+ });
3791
+ return computePosition(reference, floating, __spreadProps(__spreadValues({}, mergedOptions), {
3792
+ platform: platformWithCache
3793
+ }));
3794
+ };
2898
3795
 
2899
- // node_modules/.pnpm/@warp-ds+core@1.0.2/node_modules/@warp-ds/core/dist/attention/utils/helpers.js
3796
+ // 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
3797
+ var TOP_START = "top-start";
2900
3798
  var TOP = "top";
3799
+ var TOP_END = "top-end";
3800
+ var RIGHT_START = "right-start";
3801
+ var RIGHT = "right";
3802
+ var RIGHT_END = "right-end";
3803
+ var BOTTOM_START = "bottom-start";
2901
3804
  var BOTTOM = "bottom";
3805
+ var BOTTOM_END = "bottom-end";
3806
+ var LEFT_START = "left-start";
2902
3807
  var LEFT = "left";
2903
- var RIGHT = "right";
3808
+ var LEFT_END = "left-end";
3809
+ var directions = [
3810
+ TOP_START,
3811
+ TOP,
3812
+ TOP_END,
3813
+ RIGHT_START,
3814
+ RIGHT,
3815
+ RIGHT_END,
3816
+ BOTTOM_START,
3817
+ BOTTOM,
3818
+ BOTTOM_END,
3819
+ LEFT_START,
3820
+ LEFT,
3821
+ LEFT_END
3822
+ ];
2904
3823
  var opposites = {
3824
+ [TOP_START]: BOTTOM_START,
2905
3825
  [TOP]: BOTTOM,
3826
+ [TOP_END]: BOTTOM_END,
3827
+ [BOTTOM_START]: TOP_START,
2906
3828
  [BOTTOM]: TOP,
3829
+ [BOTTOM_END]: TOP_END,
3830
+ [LEFT_START]: RIGHT_START,
2907
3831
  [LEFT]: RIGHT,
2908
- [RIGHT]: LEFT
2909
- };
2910
- var arrowLabels = {
2911
- [TOP]: "\u2191",
2912
- [BOTTOM]: "\u2193",
2913
- [LEFT]: "\u2190",
2914
- [RIGHT]: "\u2192"
3832
+ [LEFT_END]: RIGHT_END,
3833
+ [RIGHT_START]: LEFT_START,
3834
+ [RIGHT]: LEFT,
3835
+ [RIGHT_END]: LEFT_END
2915
3836
  };
2916
3837
  var rotation = {
3838
+ [LEFT_START]: -45,
2917
3839
  [LEFT]: -45,
3840
+ [LEFT_END]: -45,
3841
+ [TOP_START]: 45,
2918
3842
  [TOP]: 45,
3843
+ [TOP_END]: 45,
3844
+ [RIGHT_START]: 135,
2919
3845
  [RIGHT]: 135,
2920
- [BOTTOM]: -135
3846
+ [RIGHT_END]: 135,
3847
+ [BOTTOM_START]: -135,
3848
+ [BOTTOM]: -135,
3849
+ [BOTTOM_END]: -135
2921
3850
  };
2922
3851
  var middlePosition = "calc(50% - 7px)";
2923
- var isDirectionVertical = (name) => [TOP, BOTTOM].includes(name);
2924
- function computeCalloutArrow({ actualDirection, directionName, arrowEl }) {
3852
+ var isDirectionVertical = (name) => [TOP_START, TOP, TOP_END, BOTTOM_START, BOTTOM, BOTTOM_END].includes(name);
3853
+ var arrowDirectionClassname = (dir) => {
3854
+ let direction;
3855
+ if (/-/.test(dir)) {
3856
+ direction = dir.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join("");
3857
+ } else {
3858
+ direction = dir.charAt(0).toUpperCase() + dir.slice(1);
3859
+ }
3860
+ return direction;
3861
+ };
3862
+ var side = (dir) => dir.split("-")[0];
3863
+ var staticSide = (dir) => opposites[side(dir)];
3864
+ var arrowDirection = (dir) => opposites[dir];
3865
+ var arrowRotation = (dir) => rotation[arrowDirection(dir)];
3866
+ var applyArrowStyles = (arrowEl, arrowRotation2, dir) => {
3867
+ Object.assign(arrowEl == null ? void 0 : arrowEl.style, {
3868
+ borderTopLeftRadius: "4px",
3869
+ zIndex: 1,
3870
+ // border alignment is off by a fraction of a pixel, this fixes it
3871
+ [`margin${arrowDirectionClassname(staticSide(dir))}`]: "-0.5px",
3872
+ transform: `rotate(${arrowRotation2}deg)`
3873
+ });
3874
+ };
3875
+ function computeCalloutArrow({ actualDirection, directionName = BOTTOM, arrowEl }) {
2925
3876
  if (!arrowEl)
2926
3877
  return;
2927
3878
  actualDirection = directionName;
2928
3879
  const directionIsVertical = isDirectionVertical(directionName);
2929
- arrowEl.style.left = directionIsVertical ? middlePosition : "";
2930
- arrowEl.style.top = !directionIsVertical ? middlePosition : "";
3880
+ Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
3881
+ left: directionIsVertical ? middlePosition : "",
3882
+ top: !directionIsVertical ? middlePosition : ""
3883
+ });
3884
+ applyArrowStyles(arrowEl, arrowRotation(actualDirection), actualDirection);
2931
3885
  }
2932
3886
  async function useRecompute(state) {
2933
- var _a, _b;
2934
- if (!state.isShowing)
3887
+ var _a, _b, _c;
3888
+ if (!(state == null ? void 0 : state.isShowing))
2935
3889
  return;
2936
- await ((_a = state == null ? void 0 : state.waitForDOM) == null ? void 0 : _a.call(state));
2937
- if (state.isCallout)
3890
+ if (state == null ? void 0 : state.waitForDOM) {
3891
+ await (state == null ? void 0 : state.waitForDOM());
3892
+ }
3893
+ if (state == null ? void 0 : state.isCallout)
2938
3894
  return computeCalloutArrow(state);
2939
- const position = await z(state.targetEl, state.attentionEl, {
2940
- placement: state.directionName,
3895
+ if (!(state == null ? void 0 : state.targetEl) || !(state == null ? void 0 : state.attentionEl))
3896
+ return;
3897
+ const targetEl = state == null ? void 0 : state.targetEl;
3898
+ const attentionEl = state == null ? void 0 : state.attentionEl;
3899
+ computePosition2(targetEl, attentionEl, {
3900
+ placement: (_a = state == null ? void 0 : state.directionName) != null ? _a : BOTTOM,
2941
3901
  middleware: [
2942
- // Should we make this configurable, but have these as sane defaults?
2943
- b(),
2944
- T(8),
2945
- D({ padding: 16 }),
2946
- // @ts-ignore
2947
- m({ element: state.noArrow ? void 0 : state.arrowEl })
2948
- // FIXME
3902
+ offset({ mainAxis: (_b = state == null ? void 0 : state.distance) != null ? _b : 8, crossAxis: (_c = state == null ? void 0 : state.skidding) != null ? _c : 0 }),
3903
+ (state == null ? void 0 : state.flip) && flip2({
3904
+ fallbackAxisSideDirection: "start",
3905
+ fallbackPlacements: state == null ? void 0 : state.fallbackPlacements
3906
+ }),
3907
+ !(state == null ? void 0 : state.flip) && autoPlacement2(),
3908
+ shift2({ padding: 16 }),
3909
+ !(state == null ? void 0 : state.noArrow) && (state == null ? void 0 : state.arrowEl) && arrow2({ element: state == null ? void 0 : state.arrowEl })
2949
3910
  ]
3911
+ }).then(({ x, y, middlewareData, placement }) => {
3912
+ state.actualDirection = placement;
3913
+ Object.assign(attentionEl == null ? void 0 : attentionEl.style, {
3914
+ left: `${x}px`,
3915
+ top: `${y}px`
3916
+ });
3917
+ const isRtl = window.getComputedStyle(attentionEl).direction === "rtl";
3918
+ const arrowPlacement = arrowDirection(placement).split("-")[1];
3919
+ if ((middlewareData == null ? void 0 : middlewareData.arrow) && (state == null ? void 0 : state.arrowEl)) {
3920
+ const arrowEl = state == null ? void 0 : state.arrowEl;
3921
+ const { x: x2, y: y2 } = middlewareData == null ? void 0 : middlewareData.arrow;
3922
+ let top = "";
3923
+ let right = "";
3924
+ let bottom = "";
3925
+ let left = "";
3926
+ if (arrowPlacement === "start") {
3927
+ const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
3928
+ top = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
3929
+ right = isRtl ? value : "";
3930
+ left = isRtl ? "" : value;
3931
+ } else if (arrowPlacement === "end") {
3932
+ const value = typeof x2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
3933
+ right = isRtl ? "" : value;
3934
+ left = isRtl ? value : "";
3935
+ bottom = typeof y2 === "number" ? `calc(33px - ${(arrowEl == null ? void 0 : arrowEl.offsetWidth) / 2}px)` : "";
3936
+ } else {
3937
+ left = typeof x2 === "number" ? `${x2}px` : "";
3938
+ top = typeof y2 === "number" ? `${y2}px` : "";
3939
+ }
3940
+ Object.assign((arrowEl == null ? void 0 : arrowEl.style) || {}, {
3941
+ top,
3942
+ right,
3943
+ bottom,
3944
+ left
3945
+ });
3946
+ applyArrowStyles(arrowEl, arrowRotation(placement), placement);
3947
+ }
2950
3948
  });
2951
- state.actualDirection = position.placement;
2952
- Object.assign(((_b = state.attentionEl) == null ? void 0 : _b.style) || {}, {
2953
- left: "0",
2954
- top: "0",
2955
- transform: `translate3d(${Math.round(position.x)}px, ${Math.round(position.y)}px, 0)`
2956
- });
2957
- let { x: x3, y: y3 } = position.middlewareData.arrow;
2958
- if (state.arrowEl) {
2959
- state.arrowEl.style.left = x3 ? x3 + "px" : "";
2960
- state.arrowEl.style.top = y3 ? y3 + "px" : "";
2961
- }
3949
+ return state;
2962
3950
  }
2963
3951
 
2964
3952
  // packages/attention/locales/en/messages.mjs
@@ -2986,8 +3974,8 @@ function detectLocale7() {
2986
3974
  try {
2987
3975
  const htmlLocale = document.documentElement.lang;
2988
3976
  return getSupportedLocale7(htmlLocale);
2989
- } catch (e2) {
2990
- console.warn("could not detect locale, falling back to source locale", e2);
3977
+ } catch (e) {
3978
+ console.warn("could not detect locale, falling back to source locale", e);
2991
3979
  return defaultLocale8;
2992
3980
  }
2993
3981
  }
@@ -3010,30 +3998,128 @@ var WarpAttention = class extends kebabCaseAttributes(WarpElement3) {
3010
3998
  constructor() {
3011
3999
  super();
3012
4000
  activateI18n7(messages9, messages10, messages11);
4001
+ this.handleDone = this.handleDone.bind(this);
3013
4002
  this.show = false;
4003
+ this.placement = "bottom";
3014
4004
  this.tooltip = false;
3015
4005
  this.callout = false;
3016
4006
  this.popover = false;
3017
4007
  this.highlight = false;
3018
4008
  this.canClose = false;
3019
4009
  this.noArrow = false;
4010
+ this.distance = 8;
4011
+ this.skidding = 0;
4012
+ this.flip = false;
4013
+ this._initialPlacement = this.placement;
4014
+ this._actualDirection = this.placement;
3020
4015
  }
3021
4016
  connectedCallback() {
3022
4017
  super.connectedCallback();
3023
- if (!this.placement || !Object.keys(opposites).includes(this.placement)) {
4018
+ if (this.placement && !Object.keys(opposites).includes(this.placement)) {
3024
4019
  throw new Error(`Invalid "placement" attribute. Set its value to one of the following:
3025
4020
  ${JSON.stringify(Object.keys(opposites))}`);
4021
+ }
4022
+ if (this.fallbackPlacements && !this.fallbackPlacements.every((fallbackPlacement) => directions.includes(fallbackPlacement))) {
4023
+ throw new Error(`Invalid "fallbackPlacements" attribute. Set its value to an array with one or more of the following:
4024
+ ${JSON.stringify(directions)}`);
3026
4025
  }
3027
4026
  setTimeout(() => this.requestUpdate(), 0);
4027
+ if (!this.callout) {
4028
+ window.addEventListener("click", this.handleDone);
4029
+ window.addEventListener("scroll", this.handleDone);
4030
+ window.addEventListener("resize", this.handleDone);
4031
+ window.addEventListener("touch", this.handleDone);
4032
+ }
4033
+ if (this.tooltip) {
4034
+ window.addEventListener("mouseover", this.handleDone);
4035
+ window.addEventListener("mouseout", this.handleDone);
4036
+ }
4037
+ }
4038
+ disconnectedCallback() {
4039
+ window.removeEventListener("click", this.handleDone);
4040
+ window.removeEventListener("scroll", this.handleDone);
4041
+ window.removeEventListener("resize", this.handleDone);
4042
+ window.removeEventListener("touch", this.handleDone);
4043
+ window.removeEventListener("mouseover", this.handleDone);
4044
+ window.removeEventListener("mouseout", this.handleDone);
4045
+ super.disconnectedCallback();
4046
+ }
4047
+ handleDone() {
4048
+ window.requestAnimationFrame(() => {
4049
+ if (this.show && this._targetEl && this._attentionEl) {
4050
+ useRecompute(this.attentionState).then((state) => {
4051
+ this._actualDirection = state == null ? void 0 : state.actualDirection;
4052
+ });
4053
+ } else {
4054
+ this._actualDirection = this._initialPlacement;
4055
+ }
4056
+ });
3028
4057
  }
3029
4058
  get _actualDirection() {
3030
4059
  return this.placement;
3031
4060
  }
3032
- set _actualDirection(v3) {
3033
- this.placement = v3;
4061
+ set _actualDirection(v) {
4062
+ this.placement = v;
4063
+ }
4064
+ get _arrowEl() {
4065
+ return this.renderRoot.querySelector("#arrow");
3034
4066
  }
3035
4067
  get _arrowDirection() {
3036
- return opposites[this.placement];
4068
+ return opposites[this._actualDirection];
4069
+ }
4070
+ get _arrowClasses() {
4071
+ return classes({
4072
+ [attention.arrowBase]: true,
4073
+ [attention[`arrowDirection${arrowDirectionClassname(this._arrowDirection)}`]]: true,
4074
+ [this._activeVariantClasses.arrow]: true
4075
+ });
4076
+ }
4077
+ get _arrowHtml() {
4078
+ return this.noArrow ? "" : html9`<div id="arrow" role="img" class="${this._arrowClasses}" />`;
4079
+ }
4080
+ get _activeVariantClasses() {
4081
+ const variantProps = {
4082
+ callout: this.callout,
4083
+ popover: this.popover,
4084
+ tooltip: this.tooltip,
4085
+ highlight: this.highlight
4086
+ };
4087
+ const activeVariant = Object.keys(variantProps).find((b) => !!variantProps[b]) || "";
4088
+ return {
4089
+ wrapper: attention[activeVariant],
4090
+ arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
4091
+ };
4092
+ }
4093
+ get _attentionEl() {
4094
+ return this.renderRoot.querySelector("#attention");
4095
+ }
4096
+ get _targetEl() {
4097
+ const targetSlot = this.renderRoot.querySelector("slot[name='target']");
4098
+ return targetSlot ? targetSlot.assignedNodes()[0] : null;
4099
+ }
4100
+ get _messageEl() {
4101
+ const messageSlot = this.renderRoot.querySelector("slot[name='message']");
4102
+ return messageSlot ? messageSlot.assignedNodes()[0] : null;
4103
+ }
4104
+ get _wrapperClasses() {
4105
+ return classes({
4106
+ [attention.base]: true,
4107
+ [this._activeVariantClasses.wrapper]: true
4108
+ });
4109
+ }
4110
+ get _ariaClose() {
4111
+ return i18n._({
4112
+ id: "attention.aria.close",
4113
+ message: "Close",
4114
+ comment: "Aria label for the close button in attention"
4115
+ });
4116
+ }
4117
+ get _closeBtnHtml() {
4118
+ return html9`
4119
+ <button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
4120
+ <w-icon-close-16 />
4121
+ </button>
4122
+ `;
3037
4123
  }
3038
4124
  updated() {
3039
4125
  if (!this.callout) {
@@ -3047,34 +4133,46 @@ ${JSON.stringify(Object.keys(opposites))}`);
3047
4133
  isCallout: this.callout,
3048
4134
  actualDirection: this._actualDirection,
3049
4135
  directionName: this.placement,
3050
- arrowEl: this.renderRoot.querySelector("#arrow"),
4136
+ arrowEl: this._arrowEl,
3051
4137
  attentionEl: this._attentionEl,
3052
4138
  targetEl: this._targetEl,
3053
- noArrow: this.noArrow
4139
+ noArrow: this.noArrow,
4140
+ distance: this.distance,
4141
+ skidding: this.skidding,
4142
+ flip: this.flip,
4143
+ fallbackPlacements: this.fallbackPlacements
3054
4144
  };
3055
4145
  useRecompute(this.attentionState);
3056
4146
  }
3057
4147
  pointingAtDirection() {
3058
4148
  switch (opposites[this._actualDirection]) {
4149
+ case "top-start":
3059
4150
  case "top":
4151
+ case "top-end":
3060
4152
  return i18n._({
3061
4153
  id: "attention.aria.pointingUp",
3062
4154
  message: "pointing up",
3063
4155
  comment: "Default screenreader message for top direction in the attention component"
3064
4156
  });
4157
+ case "right-start":
3065
4158
  case "right":
4159
+ case "right-end":
3066
4160
  return i18n._({
3067
4161
  id: "attention.aria.pointingRight",
3068
4162
  message: "pointing right",
3069
4163
  comment: "Default screenreader message for right direction in the attention component"
3070
4164
  });
4165
+ case "bottom-start":
3071
4166
  case "bottom":
4167
+ case "bottom-end":
3072
4168
  return i18n._({
3073
4169
  id: "attention.aria.pointingDown",
3074
4170
  message: "pointing down",
3075
4171
  comment: "Default screenreader message for bottom direction in the attention component"
3076
4172
  });
4173
+ case "left-start":
3077
4174
  case "left":
4175
+ case "left-end":
3078
4176
  return i18n._({
3079
4177
  id: "attention.aria.pointingLeft",
3080
4178
  message: "pointing left",
@@ -3123,64 +4221,13 @@ ${JSON.stringify(Object.keys(opposites))}`);
3123
4221
  this._targetEl.setAttribute("aria-details", attentionMessageId);
3124
4222
  }
3125
4223
  }
3126
- get _activeVariantClasses() {
3127
- const variantProps = {
3128
- callout: this.callout,
3129
- popover: this.popover,
3130
- tooltip: this.tooltip,
3131
- highlight: this.highlight
3132
- };
3133
- const activeVariant = Object.keys(variantProps).find((b3) => !!variantProps[b3]) || "";
3134
- return {
3135
- wrapper: attention[activeVariant],
3136
- arrow: attention[`arrow${activeVariant.charAt(0).toUpperCase() + activeVariant.slice(1)}`]
3137
- };
3138
- }
3139
- get _ariaClose() {
3140
- return i18n._({
3141
- id: "attention.aria.close",
3142
- message: "Close",
3143
- comment: "Aria label for the close button in attention"
3144
- });
3145
- }
3146
4224
  firstUpdated() {
4225
+ this._initialPlacement = this.placement;
3147
4226
  this.setAriaLabels();
3148
4227
  if (this.callout) {
3149
4228
  this._attentionEl.style.position = "relative";
3150
4229
  }
3151
4230
  }
3152
- get _attentionEl() {
3153
- return this.renderRoot.querySelector("#attention");
3154
- }
3155
- get _targetEl() {
3156
- return this.renderRoot.querySelector("slot[name='target']").assignedNodes()[0];
3157
- }
3158
- get _messageEl() {
3159
- return this.renderRoot.querySelector("slot[name='message']").assignedNodes()[0];
3160
- }
3161
- get _wrapperClasses() {
3162
- return classes({
3163
- [attention.base]: true,
3164
- [this._activeVariantClasses.wrapper]: true
3165
- });
3166
- }
3167
- get _arrowClasses() {
3168
- return classes({
3169
- [attention.arrowBase]: true,
3170
- [attention[`arrowDirection${this._arrowDirection.charAt(0).toUpperCase() + this._arrowDirection.slice(1)}`]]: true,
3171
- [this._activeVariantClasses.arrow]: true
3172
- });
3173
- }
3174
- get _arrowHtml() {
3175
- return this.noArrow ? "" : html9`<div
3176
- id="arrow"
3177
- role="img"
3178
- class="${this._arrowClasses}"
3179
- style="transform:rotate(${rotation[this._arrowDirection]}deg);
3180
- margin-${// border alignment is off by a fraction of a pixel, this fixes it
3181
- this._arrowDirection.charAt(0).toLowerCase() + this._arrowDirection.slice(1)}:-0.5px;"
3182
- />`;
3183
- }
3184
4231
  close() {
3185
4232
  const event = new CustomEvent("close", {
3186
4233
  bubbles: true,
@@ -3188,25 +4235,18 @@ ${JSON.stringify(Object.keys(opposites))}`);
3188
4235
  });
3189
4236
  this.updateComplete.then(() => this.dispatchEvent(event));
3190
4237
  }
3191
- keypressed(e2) {
4238
+ keypressed(e) {
3192
4239
  if (!this.canClose)
3193
4240
  return;
3194
- if (e2.key === "Escape") {
3195
- e2.preventDefault();
4241
+ if (e.key === "Escape") {
4242
+ e.preventDefault();
3196
4243
  this.close();
3197
4244
  }
3198
4245
  }
3199
- get _closeBtnHtml() {
3200
- return html9`
3201
- <button aria-label="${this._ariaClose}" @click="${this.close}" @keydown=${this.keypressed} class="${attention.closeBtn}">
3202
- <w-icon-close-16 />
3203
- </button>
3204
- `;
3205
- }
3206
4246
  render() {
3207
4247
  return html9`
3208
4248
  <div class=${ifDefined2(this.className ? this.className : void 0)}>
3209
- ${this.placement === "right" || this.placement === "bottom" ? html9`
4249
+ ${this.placement === "right-start" || this.placement === "right" || this.placement === "right-end" || this.placement === "bottom-start" || this.placement === "bottom" || this.placement === "bottom-end" ? html9`
3210
4250
  <slot name="target"></slot>
3211
4251
 
3212
4252
  <div id="attention" role="${this.tooltip ? "tooltip" : "img"}" aria-label="${this.defaultAriaLabel()}" class="${this._wrapperClasses}">
@@ -3230,7 +4270,7 @@ __publicField(WarpAttention, "properties", {
3230
4270
  show: { type: Boolean, reflect: true },
3231
4271
  // Placement according to the target element
3232
4272
  // Arrow would be on the opposite side of this position
3233
- placement: { type: String },
4273
+ placement: { type: String, reflect: true },
3234
4274
  // Whether Attention element is rendered as a tooltip
3235
4275
  tooltip: { type: Boolean, reflect: true },
3236
4276
  // Whether Attention element is rendered as an inline callout
@@ -3242,7 +4282,15 @@ __publicField(WarpAttention, "properties", {
3242
4282
  // Render Attention element with a close button
3243
4283
  canClose: { type: Boolean, reflect: true },
3244
4284
  // Render Attention element without an arrow
3245
- noArrow: { type: Boolean, reflect: true }
4285
+ noArrow: { type: Boolean, reflect: true },
4286
+ // Distance from which to offset the attentionEl from the targetEl vertically
4287
+ distance: { type: Number, reflect: true },
4288
+ // Distance from which to offset the attentionEl along its targetEl horizontally
4289
+ skidding: { type: Number, reflect: true },
4290
+ // Whether Attention element should flip its placement in order to keep it in view
4291
+ flip: { type: Boolean, reflect: true },
4292
+ // Choose which preferred placements the Attention element should flip to
4293
+ fallbackPlacements: { type: Array, reflect: true }
3246
4294
  });
3247
4295
  __publicField(WarpAttention, "styles", [
3248
4296
  WarpElement3.styles,
@@ -3257,11 +4305,6 @@ __publicField(WarpAttention, "styles", [
3257
4305
  :host([popover]:not(:popover-open):not(dialog[open])) {
3258
4306
  display: contents;
3259
4307
  }
3260
-
3261
- #arrow {
3262
- border-top-left-radius: 4px;
3263
- z-index: 1;
3264
- }
3265
4308
  `
3266
4309
  ]);
3267
4310
  if (!customElements.get("w-attention")) {
@@ -3363,7 +4406,7 @@ if (!customElements.get("w-box")) {
3363
4406
  import { html as html12 } from "lit";
3364
4407
  import WarpElement6 from "@warp-ds/elements-core";
3365
4408
 
3366
- // node_modules/.pnpm/@warp-ds+core@1.0.2/node_modules/@warp-ds/core/dist/breadcrumbs/index.js
4409
+ // node_modules/.pnpm/@warp-ds+core@1.1.0_@floating-ui+dom@1.6.3/node_modules/@warp-ds/core/dist/breadcrumbs/index.js
3367
4410
  function interleave(array, separator2) {
3368
4411
  return array.flatMap((el) => [el, separator2]).slice(0, -1);
3369
4412
  }
@@ -3637,16 +4680,16 @@ var WarpCard = class extends WarpElement9 {
3637
4680
  this.flat = false;
3638
4681
  this.clickable = false;
3639
4682
  }
3640
- get _outerClasses() {
4683
+ get _containerClasses() {
3641
4684
  return fclasses({
3642
4685
  [card.card]: true,
3643
4686
  [card.cardShadow]: !this.flat,
3644
- [this.selected ? card.cardSelected : card.cardUnselected]: !this.flat,
4687
+ [card.cardSelected]: !this.flat && this.selected,
3645
4688
  [card.cardFlat]: this.flat,
3646
4689
  [this.selected ? card.cardFlatSelected : card.cardFlatUnselected]: this.flat
3647
4690
  });
3648
4691
  }
3649
- get _innerClasses() {
4692
+ get _outlineClasses() {
3650
4693
  return fclasses({
3651
4694
  [card.cardOutline]: true,
3652
4695
  [this.selected ? card.cardOutlineSelected : card.cardOutlineUnselected]: true
@@ -3658,19 +4701,19 @@ var WarpCard = class extends WarpElement9 {
3658
4701
  get uuSpan() {
3659
4702
  return html15`<span role="checkbox" aria-checked="true" aria-disabled="true"></span>`;
3660
4703
  }
3661
- keypressed(e2) {
3662
- if (!this.clickable || e2.altKey || e2.ctrlKey)
4704
+ keypressed(e) {
4705
+ if (!this.clickable || e.altKey || e.ctrlKey)
3663
4706
  return;
3664
- if (e2.key === keys.ENTER || e2.key === keys.SPACE) {
3665
- e2.preventDefault();
4707
+ if (e.key === keys.ENTER || e.key === keys.SPACE) {
4708
+ e.preventDefault();
3666
4709
  this.click();
3667
4710
  }
3668
4711
  }
3669
4712
  render() {
3670
4713
  return html15`
3671
- <div tabindex=${ifDefined3(this.clickable ? "0" : void 0)} class="${this._outerClasses}" @keydown=${this.keypressed}>
4714
+ <div tabindex=${ifDefined3(this.clickable ? "0" : void 0)} class="${this._containerClasses}" @keydown=${this.keypressed}>
3672
4715
  ${this.clickable ? this.uuButton : ""} ${!this.clickable && this.selected ? this.uuSpan : ""}
3673
- <div class="${this._innerClasses}"></div>
4716
+ <div class="${this._outlineClasses}"></div>
3674
4717
  <slot></slot>
3675
4718
  </div>
3676
4719
  `;
@@ -3767,8 +4810,8 @@ function detectLocale8() {
3767
4810
  return getSupportedLocale8(hostLocale);
3768
4811
  }
3769
4812
  return getSupportedLocale8(htmlLocale != null ? htmlLocale : hostLocale);
3770
- } catch (e2) {
3771
- console.warn("could not detect locale, falling back to source locale", e2);
4813
+ } catch (e) {
4814
+ console.warn("could not detect locale, falling back to source locale", e);
3772
4815
  return defaultLocale9;
3773
4816
  }
3774
4817
  }
@@ -3858,8 +4901,8 @@ function detectLocale9() {
3858
4901
  return getSupportedLocale9(hostLocale);
3859
4902
  }
3860
4903
  return getSupportedLocale9(htmlLocale != null ? htmlLocale : hostLocale);
3861
- } catch (e2) {
3862
- console.warn("could not detect locale, falling back to source locale", e2);
4904
+ } catch (e) {
4905
+ console.warn("could not detect locale, falling back to source locale", e);
3863
4906
  return defaultLocale10;
3864
4907
  }
3865
4908
  }
@@ -4243,24 +5286,24 @@ var WarpTextField = class extends WarpElement13 {
4243
5286
  if (this.invalid && this._helpId)
4244
5287
  return this._helpId;
4245
5288
  }
4246
- handler(e2) {
4247
- const { name, value } = e2.target;
4248
- const event = new CustomEvent(e2.type, {
5289
+ handler(e) {
5290
+ const { name, value } = e.target;
5291
+ const event = new CustomEvent(e.type, {
4249
5292
  detail: {
4250
5293
  name,
4251
5294
  value,
4252
- target: e2.target
5295
+ target: e.target
4253
5296
  }
4254
5297
  });
4255
5298
  this.dispatchEvent(event);
4256
5299
  }
4257
- prefixSlotChange(e2) {
5300
+ prefixSlotChange(e) {
4258
5301
  const el = this.renderRoot.querySelector("slot[name=prefix]");
4259
5302
  const affixes = el.assignedElements();
4260
5303
  if (affixes.length)
4261
5304
  this._hasPrefix = true;
4262
5305
  }
4263
- suffixSlotChange(e2) {
5306
+ suffixSlotChange(e) {
4264
5307
  const el = this.renderRoot.querySelector("slot[name=suffix]");
4265
5308
  const affixes = el.assignedElements();
4266
5309
  if (affixes.length)
@@ -4511,8 +5554,8 @@ var getAfterCollapseCallback = (done) => () => {
4511
5554
  var expand = (el, done) => {
4512
5555
  const returnPromise = (() => {
4513
5556
  if (!done)
4514
- return new Promise((r4) => {
4515
- done = r4;
5557
+ return new Promise((r2) => {
5558
+ done = r2;
4516
5559
  });
4517
5560
  })();
4518
5561
  const afterExpandCallback = getAfterExpandCallback(el, done);
@@ -4532,8 +5575,8 @@ var expand = (el, done) => {
4532
5575
  var collapse = (el, done) => {
4533
5576
  const returnPromise = (() => {
4534
5577
  if (!done)
4535
- return new Promise((r4) => {
4536
- done = r4;
5578
+ return new Promise((r2) => {
5579
+ done = r2;
4537
5580
  });
4538
5581
  })();
4539
5582
  const afterCollapseCallback = getAfterCollapseCallback(done);