PageSourceSearch

https://helpdesk.me/assets/register-static-chunk.CSSMguta.js

js helpdesk.me collected 2026-10-07 09:46:44 UTC 105,879 bytes, 2,980 lines download raw bytes

1import { C as CSSDirective, A as AttachedBehaviorHTMLDirective, a as ref, h as html, w as when, r as registerFASTElements } from "./provideFastDesignSystem-static-chunk.jP39TYH8.js";
2import { g as ElementStyles, O as Observable, j as emptyArray, A as AttributeConfiguration, F as FoundationElement, D as DOM, _ as __decorate, a as attr, o as observable, n as nullableNumberConverter } from "./foundation-element-static-chunk.Cl47ssOH.js";
3import { j as ChameleonElementMixin, _ as __decorate$1, C as ChameleonLitElement, r as registerLitElement } from "./register-static-chunk.CmwU1Q3j.js";
4import { x, r, n } from "./close-outlined-static-chunk.Dh34pTUe.js";
5const svg$2 = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" role="img"><path d="M22 2H4V9H6V4H20V12H11V14H22V2Z" fill="currentColor"></path><path d="M18 18H11V16H12V15H14V16H18V18Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 11C2 10.4477 2.44772 10 3 10H9C9.55229 10 10 10.4477 10 11V21C10 21.5523 9.55229 22 9 22H3C2.44772 22 2 21.5523 2 21V11ZM4 20V12H8V20H4Z" fill="currentColor"></path></svg>';
6const svg$1 = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" role="img"><path d="M19.0804 4.91964L18 2L16.9196 4.91964L14 6L16.9196 7.08036L18 10L19.0804 7.08036L22 6L19.0804 4.91964Z" fill="currentColor"></path><path d="M13.4308 10.5692L11 4L8.56918 10.5692L2 13L8.56918 15.4308L11 22L13.4308 15.4308L20 13L13.4308 10.5692Z" fill="currentColor"></path></svg>';
7function collectStyles(strings, values) {
8  const styles2 = [];
9  let cssString = "";
10  const behaviors = [];
11  for (let i = 0, ii = strings.length - 1; i < ii; ++i) {
12    cssString += strings[i];
13    let value = values[i];
14    if (value instanceof CSSDirective) {
15      const behavior = value.createBehavior();
16      value = value.createCSS();
17      if (behavior) {
18        behaviors.push(behavior);
19      }
20    }
21    if (value instanceof ElementStyles || value instanceof CSSStyleSheet) {
22      if (cssString.trim() !== "") {
23        styles2.push(cssString);
24        cssString = "";
25      }
26      styles2.push(value);
27    } else {
28      cssString += value;
29    }
30  }
31  cssString += strings[strings.length - 1];
32  if (cssString.trim() !== "") {
33    styles2.push(cssString);
34  }
35  return {
36    styles: styles2,
37    behaviors
38  };
39}
40function css(strings, ...values) {
41  const { styles: styles2, behaviors } = collectStyles(strings, values);
42  const elementStyles = ElementStyles.create(styles2);
43  if (behaviors.length) {
44    elementStyles.withBehaviors(...behaviors);
45  }
46  return elementStyles;
47}
48function elements(selector) {
49  return function(value, index, array) {
50    return value.nodeType === 1;
51  };
52}
53class NodeObservationBehavior {
54  /**
55   * Creates an instance of NodeObservationBehavior.
56   * @param target - The target to assign the nodes property on.
57   * @param options - The options to use in configuring node observation.
58   */
59  constructor(target, options) {
60    this.target = target;
61    this.options = options;
62    this.source = null;
63  }
64  /**
65   * Bind this behavior to the source.
66   * @param source - The source to bind to.
67   * @param context - The execution context that the binding is operating within.
68   */
69  bind(source) {
70    const name = this.options.property;
71    this.shouldUpdate = Observable.getAccessors(source).some((x2) => x2.name === name);
72    this.source = source;
73    this.updateTarget(this.computeNodes());
74    if (this.shouldUpdate) {
75      this.observe();
76    }
77  }
78  /**
79   * Unbinds this behavior from the source.
80   * @param source - The source to unbind from.
81   */
82  unbind() {
83    this.updateTarget(emptyArray);
84    this.source = null;
85    if (this.shouldUpdate) {
86      this.disconnect();
87    }
88  }
89  /** @internal */
90  handleEvent() {
91    this.updateTarget(this.computeNodes());
92  }
93  computeNodes() {
94    let nodes = this.getNodes();
95    if (this.options.filter !== void 0) {
96      nodes = nodes.filter(this.options.filter);
97    }
98    return nodes;
99  }
100  updateTarget(value) {
101    this.source[this.options.property] = value;
102  }
103}
104class SlottedBehavior extends NodeObservationBehavior {
105  /**
106   * Creates an instance of SlottedBehavior.
107   * @param target - The slot element target to observe.
108   * @param options - The options to use when observing the slot.
109   */
110  constructor(target, options) {
111    super(target, options);
112  }
113  /**
114   * Begins observation of the nodes.
115   */
116  observe() {
117    this.target.addEventListener("slotchange", this);
118  }
119  /**
120   * Disconnects observation of the nodes.
121   */
122  disconnect() {
123    this.target.removeEventListener("slotchange", this);
124  }
125  /**
126   * Retrieves the nodes that should be assigned to the target.
127   */
128  getNodes() {
129    return this.target.assignedNodes(this.options);
130  }
131}
132function slotted(propertyOrOptions) {
133  if (typeof propertyOrOptions === "string") {
134    propertyOrOptions = { property: propertyOrOptions };
135  }
136  return new AttachedBehaviorHTMLDirective("fast-slotted", SlottedBehavior, propertyOrOptions);
137}
138class StartEnd {
139  handleStartContentChange() {
140    this.startContainer.classList.toggle("start", this.start.assignedNodes().length > 0);
141  }
142  handleEndContentChange() {
143    this.endContainer.classList.toggle("end", this.end.assignedNodes().length > 0);
144  }
145}
146const endSlotTemplate$1 = (context, definition) => html`
147    <span
148        part="end"
149        ${ref("endContainer")}
150        class=${(x2) => definition.end ? "end" : void 0}
151    >
152        <slot name="end" ${ref("end")} @slotchange="${(x2) => x2.handleEndContentChange()}">
153            ${definition.end || ""}
154        </slot>
155    </span>
156`;
157const startSlotTemplate$1 = (context, definition) => html`
158    <span
159        part="start"
160        ${ref("startContainer")}
161        class="${(x2) => definition.start ? "start" : void 0}"
162    >
163        <slot
164            name="start"
165            ${ref("start")}
166            @slotchange="${(x2) => x2.handleStartContentChange()}"
167        >
168            ${definition.start || ""}
169        </slot>
170    </span>
171`;
172html`
173    <span part="end" ${ref("endContainer")}>
174        <slot
175            name="end"
176            ${ref("end")}
177            @slotchange="${(x2) => x2.handleEndContentChange()}"
178        ></slot>
179    </span>
180`;
181html`
182    <span part="start" ${ref("startContainer")}>
183        <slot
184            name="start"
185            ${ref("start")}
186            @slotchange="${(x2) => x2.handleStartContentChange()}"
187        ></slot>
188    </span>
189`;
190function applyMixins(derivedCtor, ...baseCtors) {
191  const derivedAttributes = AttributeConfiguration.locate(derivedCtor);
192  baseCtors.forEach((baseCtor) => {
193    Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
194      if (name !== "constructor") {
195        Object.defineProperty(
196          derivedCtor.prototype,
197          name,
198          /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
199          Object.getOwnPropertyDescriptor(baseCtor.prototype, name)
200        );
201      }
202    });
203    const baseAttributes = AttributeConfiguration.locate(baseCtor);
204    baseAttributes.forEach((x2) => derivedAttributes.push(x2));
205  });
206}
207function isHTMLElement$1(...args) {
208  return args.every((arg) => arg instanceof HTMLElement);
209}
210function convertStylePropertyPixelsToNumber(computedStyle, property) {
211  if (!computedStyle || !property) {
212    return;
213  }
214  return parseInt(computedStyle.getPropertyValue(property).substring(0, computedStyle.getPropertyValue(property).length - 2), 10);
215}
216var KeyCodes;
217(function(KeyCodes2) {
218  KeyCodes2[KeyCodes2["alt"] = 18] = "alt";
219  KeyCodes2[KeyCodes2["arrowDown"] = 40] = "arrowDown";
220  KeyCodes2[KeyCodes2["arrowLeft"] = 37] = "arrowLeft";
221  KeyCodes2[KeyCodes2["arrowRight"] = 39] = "arrowRight";
222  KeyCodes2[KeyCodes2["arrowUp"] = 38] = "arrowUp";
223  KeyCodes2[KeyCodes2["back"] = 8] = "back";
224  KeyCodes2[KeyCodes2["backSlash"] = 220] = "backSlash";
225  KeyCodes2[KeyCodes2["break"] = 19] = "break";
226  KeyCodes2[KeyCodes2["capsLock"] = 20] = "capsLock";
227  KeyCodes2[KeyCodes2["closeBracket"] = 221] = "closeBracket";
228  KeyCodes2[KeyCodes2["colon"] = 186] = "colon";
229  KeyCodes2[KeyCodes2["colon2"] = 59] = "colon2";
230  KeyCodes2[KeyCodes2["comma"] = 188] = "comma";
231  KeyCodes2[KeyCodes2["ctrl"] = 17] = "ctrl";
232  KeyCodes2[KeyCodes2["delete"] = 46] = "delete";
233  KeyCodes2[KeyCodes2["end"] = 35] = "end";
234  KeyCodes2[KeyCodes2["enter"] = 13] = "enter";
235  KeyCodes2[KeyCodes2["equals"] = 187] = "equals";
236  KeyCodes2[KeyCodes2["equals2"] = 61] = "equals2";
237  KeyCodes2[KeyCodes2["equals3"] = 107] = "equals3";
238  KeyCodes2[KeyCodes2["escape"] = 27] = "escape";
239  KeyCodes2[KeyCodes2["forwardSlash"] = 191] = "forwardSlash";
240  KeyCodes2[KeyCodes2["function1"] = 112] = "function1";
241  KeyCodes2[KeyCodes2["function10"] = 121] = "function10";
242  KeyCodes2[KeyCodes2["function11"] = 122] = "function11";
243  KeyCodes2[KeyCodes2["function12"] = 123] = "function12";
244  KeyCodes2[KeyCodes2["function2"] = 113] = "function2";
245  KeyCodes2[KeyCodes2["function3"] = 114] = "function3";
246  KeyCodes2[KeyCodes2["function4"] = 115] = "function4";
247  KeyCodes2[KeyCodes2["function5"] = 116] = "function5";
248  KeyCodes2[KeyCodes2["function6"] = 117] = "function6";
249  KeyCodes2[KeyCodes2["function7"] = 118] = "function7";
250  KeyCodes2[KeyCodes2["function8"] = 119] = "function8";
251  KeyCodes2[KeyCodes2["function9"] = 120] = "function9";
252  KeyCodes2[KeyCodes2["home"] = 36] = "home";
253  KeyCodes2[KeyCodes2["insert"] = 45] = "insert";
254  KeyCodes2[KeyCodes2["menu"] = 93] = "menu";
255  KeyCodes2[KeyCodes2["minus"] = 189] = "minus";
256  KeyCodes2[KeyCodes2["minus2"] = 109] = "minus2";
257  KeyCodes2[KeyCodes2["numLock"] = 144] = "numLock";
258  KeyCodes2[KeyCodes2["numPad0"] = 96] = "numPad0";
259  KeyCodes2[KeyCodes2["numPad1"] = 97] = "numPad1";
260  KeyCodes2[KeyCodes2["numPad2"] = 98] = "numPad2";
261  KeyCodes2[KeyCodes2["numPad3"] = 99] = "numPad3";
262  KeyCodes2[KeyCodes2["numPad4"] = 100] = "numPad4";
263  KeyCodes2[KeyCodes2["numPad5"] = 101] = "numPad5";
264  KeyCodes2[KeyCodes2["numPad6"] = 102] = "numPad6";
265  KeyCodes2[KeyCodes2["numPad7"] = 103] = "numPad7";
266  KeyCodes2[KeyCodes2["numPad8"] = 104] = "numPad8";
267  KeyCodes2[KeyCodes2["numPad9"] = 105] = "numPad9";
268  KeyCodes2[KeyCodes2["numPadDivide"] = 111] = "numPadDivide";
269  KeyCodes2[KeyCodes2["numPadDot"] = 110] = "numPadDot";
270  KeyCodes2[KeyCodes2["numPadMinus"] = 109] = "numPadMinus";
271  KeyCodes2[KeyCodes2["numPadMultiply"] = 106] = "numPadMultiply";
272  KeyCodes2[KeyCodes2["numPadPlus"] = 107] = "numPadPlus";
273  KeyCodes2[KeyCodes2["openBracket"] = 219] = "openBracket";
274  KeyCodes2[KeyCodes2["pageDown"] = 34] = "pageDown";
275  KeyCodes2[KeyCodes2["pageUp"] = 33] = "pageUp";
276  KeyCodes2[KeyCodes2["period"] = 190] = "period";
277  KeyCodes2[KeyCodes2["print"] = 44] = "print";
278  KeyCodes2[KeyCodes2["quote"] = 222] = "quote";
279  KeyCodes2[KeyCodes2["scrollLock"] = 145] = "scrollLock";
280  KeyCodes2[KeyCodes2["shift"] = 16] = "shift";
281  KeyCodes2[KeyCodes2["space"] = 32] = "space";
282  KeyCodes2[KeyCodes2["tab"] = 9] = "tab";
283  KeyCodes2[KeyCodes2["tilde"] = 192] = "tilde";
284  KeyCodes2[KeyCodes2["windowsLeft"] = 91] = "windowsLeft";
285  KeyCodes2[KeyCodes2["windowsOpera"] = 219] = "windowsOpera";
286  KeyCodes2[KeyCodes2["windowsRight"] = 92] = "windowsRight";
287})(KeyCodes || (KeyCodes = {}));
288const keyArrowDown = "ArrowDown";
289const keyArrowLeft = "ArrowLeft";
290const keyArrowRight = "ArrowRight";
291const keyArrowUp = "ArrowUp";
292const keyEnter = "Enter";
293const keyEscape = "Escape";
294const keyHome = "Home";
295const keyEnd = "End";
296const keySpace = " ";
297const keyTab = "Tab";
298var Direction;
299(function(Direction2) {
300  Direction2["ltr"] = "ltr";
301  Direction2["rtl"] = "rtl";
302})(Direction || (Direction = {}));
303let uniqueIdCounter = 0;
304function uniqueId(prefix = "") {
305  return `${prefix}${uniqueIdCounter++}`;
306}
307const getDirection = (rootNode) => {
308  const dirNode = rootNode.closest("[dir]");
309  return dirNode !== null && dirNode.dir === "rtl" ? Direction.rtl : Direction.ltr;
310};
311const MenuItemRole = {
312  /**
313   * The menu item has a "menuitem" role
314   */
315  menuitem: "menuitem",
316  /**
317   * The menu item has a "menuitemcheckbox" role
318   */
319  menuitemcheckbox: "menuitemcheckbox",
320  /**
321   * The menu item has a "menuitemradio" role
322   */
323  menuitemradio: "menuitemradio"
324};
325const roleForMenuItem = {
326  [MenuItemRole.menuitem]: "menuitem",
327  [MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
328  [MenuItemRole.menuitemradio]: "menuitemradio"
329};
330class MenuItem extends FoundationElement {
331  constructor() {
332    super(...arguments);
333    this.role = MenuItemRole.menuitem;
334    this.hasSubmenu = false;
335    this.currentDirection = Direction.ltr;
336    this.focusSubmenuOnLoad = false;
337    this.handleMenuItemKeyDown = (e) => {
338      if (e.defaultPrevented) {
339        return false;
340      }
341      switch (e.key) {
342        case keyEnter:
343        case keySpace:
344          this.invoke();
345          return false;
346        case keyArrowRight:
347          this.expandAndFocus();
348          return false;
349        case keyArrowLeft:
350          if (this.expanded) {
351            this.expanded = false;
352            this.focus();
353            return false;
354          }
355      }
356      return true;
357    };
358    this.handleMenuItemClick = (e) => {
359      if (e.defaultPrevented || this.disabled) {
360        return false;
361      }
362      this.invoke();
363      return false;
364    };
365    this.submenuLoaded = () => {
366      if (!this.focusSubmenuOnLoad) {
367        return;
368      }
369      this.focusSubmenuOnLoad = false;
370      if (this.hasSubmenu) {
371        this.submenu.focus();
372        this.setAttribute("tabindex", "-1");
373      }
374    };
375    this.handleMouseOver = (e) => {
376      if (this.disabled || !this.hasSubmenu || this.expanded) {
377        return false;
378      }
379      this.expanded = true;
380      return false;
381    };
382    this.handleMouseOut = (e) => {
383      if (!this.expanded || this.contains(document.activeElement)) {
384        return false;
385      }
386      this.expanded = false;
387      return false;
388    };
389    this.expandAndFocus = () => {
390      if (!this.hasSubmenu) {
391        return;
392      }
393      this.focusSubmenuOnLoad = true;
394      this.expanded = true;
395    };
396    this.invoke = () => {
397      if (this.disabled) {
398        return;
399      }
400      switch (this.role) {
401        case MenuItemRole.menuitemcheckbox:
402          this.checked = !this.checked;
403          break;
404        case MenuItemRole.menuitem:
405          this.updateSubmenu();
406          if (this.hasSubmenu) {
407            this.expandAndFocus();
408          } else {
409            this.$emit("change");
410          }
411          break;
412        case MenuItemRole.menuitemradio:
413          if (!this.checked) {
414            this.checked = true;
415          }
416          break;
417      }
418    };
419    this.updateSubmenu = () => {
420      this.submenu = this.domChildren().find((element) => {
421        return element.getAttribute("role") === "menu";
422      });
423      this.hasSubmenu = this.submenu === void 0 ? false : true;
424    };
425  }
426  expandedChanged(oldValue) {
427    if (this.$fastController.isConnected) {
428      if (this.submenu === void 0) {
429        return;
430      }
431      if (this.expanded === false) {
432        this.submenu.collapseExpandedItem();
433      } else {
434        this.currentDirection = getDirection(this);
435      }
436      this.$emit("expanded-change", this, { bubbles: false });
437    }
438  }
439  checkedChanged(oldValue, newValue) {
440    if (this.$fastController.isConnected) {
441      this.$emit("change");
442    }
443  }
444  /**
445   * @internal
446   */
447  connectedCallback() {
448    super.connectedCallback();
449    DOM.queueUpdate(() => {
450      this.updateSubmenu();
451    });
452    if (!this.startColumnCount) {
453      this.startColumnCount = 1;
454    }
455    this.observer = new MutationObserver(this.updateSubmenu);
456  }
457  /**
458   * @internal
459   */
460  disconnectedCallback() {
461    super.disconnectedCallback();
462    this.submenu = void 0;
463    if (this.observer !== void 0) {
464      this.observer.disconnect();
465      this.observer = void 0;
466    }
467  }
468  /**
469   * get an array of valid DOM children
470   */
471  domChildren() {
472    return Array.from(this.children).filter((child) => !child.hasAttribute("hidden"));
473  }
474}
475__decorate([
476  attr({ mode: "boolean" })
477], MenuItem.prototype, "disabled", void 0);
478__decorate([
479  attr({ mode: "boolean" })
480], MenuItem.prototype, "expanded", void 0);
481__decorate([
482  observable
483], MenuItem.prototype, "startColumnCount", void 0);
484__decorate([
485  attr
486], MenuItem.prototype, "role", void 0);
487__decorate([
488  attr({ mode: "boolean" })
489], MenuItem.prototype, "checked", void 0);
490__decorate([
491  observable
492], MenuItem.prototype, "submenuRegion", void 0);
493__decorate([
494  observable
495], MenuItem.prototype, "hasSubmenu", void 0);
496__decorate([
497  observable
498], MenuItem.prototype, "currentDirection", void 0);
499__decorate([
500  observable
501], MenuItem.prototype, "submenu", void 0);
502applyMixins(MenuItem, StartEnd);
503const menuTemplate = (context, definition) => html`
504    <template
505        slot="${(x2) => x2.slot ? x2.slot : x2.isNestedMenu() ? "submenu" : void 0}"
506        role="menu"
507        @keydown="${(x2, c) => x2.handleMenuKeyDown(c.event)}"
508        @focusout="${(x2, c) => x2.handleFocusOut(c.event)}"
509    >
510        <slot ${slotted("items")}></slot>
511    </template>
512`;
513class Menu extends FoundationElement {
514  constructor() {
515    super(...arguments);
516    this.expandedItem = null;
517    this.focusIndex = -1;
518    this.isNestedMenu = () => {
519      return this.parentElement !== null && isHTMLElement$1(this.parentElement) && this.parentElement.getAttribute("role") === "menuitem";
520    };
521    this.handleFocusOut = (e) => {
522      if (!this.contains(e.relatedTarget) && this.menuItems !== void 0) {
523        this.collapseExpandedItem();
524        const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
525        this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
526        this.menuItems[focusIndex].setAttribute("tabindex", "0");
527        this.focusIndex = focusIndex;
528      }
529    };
530    this.handleItemFocus = (e) => {
531      const targetItem = e.target;
532      if (this.menuItems !== void 0 && targetItem !== this.menuItems[this.focusIndex]) {
533        this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
534        this.focusIndex = this.menuItems.indexOf(targetItem);
535        targetItem.setAttribute("tabindex", "0");
536      }
537    };
538    this.handleExpandedChanged = (e) => {
539      if (e.defaultPrevented || e.target === null || this.menuItems === void 0 || this.menuItems.indexOf(e.target) < 0) {
540        return;
541      }
542      e.preventDefault();
543      const changedItem = e.target;
544      if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
545        this.expandedItem = null;
546        return;
547      }
548      if (changedItem.expanded) {
549        if (this.expandedItem !== null && this.expandedItem !== changedItem) {
550          this.expandedItem.expanded = false;
551        }
552        this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
553        this.expandedItem = changedItem;
554        this.focusIndex = this.menuItems.indexOf(changedItem);
555        changedItem.setAttribute("tabindex", "0");
556      }
557    };
558    this.removeItemListeners = () => {
559      if (this.menuItems !== void 0) {
560        this.menuItems.forEach((item) => {
561          item.removeEventListener("expanded-change", this.handleExpandedChanged);
562          item.removeEventListener("focus", this.handleItemFocus);
563        });
564      }
565    };
566    this.setItems = () => {
567      const newItems = this.domChildren();
568      this.removeItemListeners();
569      this.menuItems = newItems;
570      const menuItems = this.menuItems.filter(this.isMenuItemElement);
571      if (menuItems.length) {
572        this.focusIndex = 0;
573      }
574      function elementIndent(el) {
575        const role = el.getAttribute("role");
576        const startSlot = el.querySelector("[slot=start]");
577        if (role !== MenuItemRole.menuitem && startSlot === null) {
578          return 1;
579        } else if (role === MenuItemRole.menuitem && startSlot !== null) {
580          return 1;
581        } else if (role !== MenuItemRole.menuitem && startSlot !== null) {
582          return 2;
583        } else {
584          return 0;
585        }
586      }
587      const indent = menuItems.reduce((accum, current) => {
588        const elementValue = elementIndent(current);
589        return accum > elementValue ? accum : elementValue;
590      }, 0);
591      menuItems.forEach((item, index) => {
592        item.setAttribute("tabindex", index === 0 ? "0" : "-1");
593        item.addEventListener("expanded-change", this.handleExpandedChanged);
594        item.addEventListener("focus", this.handleItemFocus);
595        if (item instanceof MenuItem || "startColumnCount" in item) {
596          item.startColumnCount = indent;
597        }
598      });
599    };
600    this.changeHandler = (e) => {
601      if (this.menuItems === void 0) {
602        return;
603      }
604      const changedMenuItem = e.target;
605      const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
606      if (changeItemIndex === -1) {
607        return;
608      }
609      if (changedMenuItem.role === "menuitemradio" && changedMenuItem.checked === true) {
610        for (let i = changeItemIndex - 1; i >= 0; --i) {
611          const item = this.menuItems[i];
612          const role = item.getAttribute("role");
613          if (role === MenuItemRole.menuitemradio) {
614            item.checked = false;
615          }
616          if (role === "separator") {
617            break;
618          }
619        }
620        const maxIndex = this.menuItems.length - 1;
621        for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
622          const item = this.menuItems[i];
623          const role = item.getAttribute("role");
624          if (role === MenuItemRole.menuitemradio) {
625            item.checked = false;
626          }
627          if (role === "separator") {
628            break;
629          }
630        }
631      }
632    };
633    this.isMenuItemElement = (el) => {
634      return isHTMLElement$1(el) && Menu.focusableElementRoles.hasOwnProperty(el.getAttribute("role"));
635    };
636    this.isFocusableElement = (el) => {
637      return this.isMenuItemElement(el);
638    };
639  }
640  itemsChanged(oldValue, newValue) {
641    if (this.$fastController.isConnected && this.menuItems !== void 0) {
642      this.setItems();
643    }
644  }
645  /**
646   * @internal
647   */
648  connectedCallback() {
649    super.connectedCallback();
650    DOM.queueUpdate(() => {
651      this.setItems();
652    });
653    this.addEventListener("change", this.changeHandler);
654  }
655  /**
656   * @internal
657   */
658  disconnectedCallback() {
659    super.disconnectedCallback();
660    this.removeItemListeners();
661    this.menuItems = void 0;
662    this.removeEventListener("change", this.changeHandler);
663  }
664  /**
665   * Focuses the first item in the menu.
666   *
667   * @public
668   */
669  focus() {
670    this.setFocus(0, 1);
671  }
672  /**
673   * Collapses any expanded menu items.
674   *
675   * @public
676   */
677  collapseExpandedItem() {
678    if (this.expandedItem !== null) {
679      this.expandedItem.expanded = false;
680      this.expandedItem = null;
681    }
682  }
683  /**
684   * @internal
685   */
686  handleMenuKeyDown(e) {
687    if (e.defaultPrevented || this.menuItems === void 0) {
688      return;
689    }
690    switch (e.key) {
691      case keyArrowDown:
692        this.setFocus(this.focusIndex + 1, 1);
693        return;
694      case keyArrowUp:
695        this.setFocus(this.focusIndex - 1, -1);
696        return;
697      case keyEnd:
698        this.setFocus(this.menuItems.length - 1, -1);
699        return;
700      case keyHome:
701        this.setFocus(0, 1);
702        return;
703      default:
704        return true;
705    }
706  }
707  /**
708   * get an array of valid DOM children
709   */
710  domChildren() {
711    return Array.from(this.children).filter((child) => !child.hasAttribute("hidden"));
712  }
713  setFocus(focusIndex, adjustment) {
714    if (this.menuItems === void 0) {
715      return;
716    }
717    while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
718      const child = this.menuItems[focusIndex];
719      if (this.isFocusableElement(child)) {
720        if (this.focusIndex > -1 && this.menuItems.length >= this.focusIndex - 1) {
721          this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
722        }
723        this.focusIndex = focusIndex;
724        child.setAttribute("tabindex", "0");
725        child.focus();
726        break;
727      }
728      focusIndex += adjustment;
729    }
730  }
731}
732Menu.focusableElementRoles = roleForMenuItem;
733__decorate([
734  observable
735], Menu.prototype, "items", void 0);
736const svg = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" role="img"><path fill-rule="evenodd" clip-rule="evenodd" d="M20.8726 6.59192L9.17452 18.29L3 12.1155L4.30192 10.8136L9.17452 15.6862L19.5707 5.29L20.8726 6.59192Z" fill="currentColor"></path></svg>';
737const endSlotTemplate = (_context, definition) => html`
738    <span
739        part="end"
740        ${ref("endContainer")}
741        class=${(_x) => definition.end ? "end" : void 0}
742    >
743        <slot name="end" ${ref("end")} @slotchange="${(x2) => x2.handleEndContentChange()}">
744            ${definition.end || ""}
745        </slot>
746    </span>
747`;
748const startSlotTemplate = (_context, definition) => html`
749    <span
750        part="start"
751        ${ref("startContainer")}
752        class="${(_x) => definition.start ? "start" : void 0}"
753    >
754        <slot
755            name="start"
756            ${ref("start")}
757            @slotchange="${(x2) => x2.handleStartContentChange()}"
758        >
759            ${definition.start || ""}
760        </slot>
761    </span>
762`;
763const withStylePrefix = (styles2) => {
764  return (_context, definition) => {
765    if (definition.prefix && definition.prefix !== "chameleon" && styles2.includes("chameleon-")) {
766      return `${styles2.replaceAll("chameleon-", `${definition.prefix}-`)}
767${styles2}`;
768    }
769    return styles2;
770  };
771};
772const min = Math.min;
773const max = Math.max;
774const round = Math.round;
775const floor = Math.floor;
776const createCoords = (v) => ({
777  x: v,
778  y: v
779});
780const oppositeSideMap = {
781  left: "right",
782  right: "left",
783  bottom: "top",
784  top: "bottom"
785};
786function clamp(start, value, end) {
787  return max(start, min(value, end));
788}
789function evaluate(value, param) {
790  return typeof value === "function" ? value(param) : value;
791}
792function getSide(placement) {
793  return placement.split("-")[0];
794}
795function getAlignment(placement) {
796  return placement.split("-")[1];
797}
798function getOppositeAxis(axis) {
799  return axis === "x" ? "y" : "x";
800}
801function getAxisLength(axis) {
802  return axis === "y" ? "height" : "width";
803}
804function getSideAxis(placement) {
805  const firstChar = placement[0];
806  return firstChar === "t" || firstChar === "b" ? "y" : "x";
807}
808function getAlignmentAxis(placement) {
809  return getOppositeAxis(getSideAxis(placement));
810}
811function getAlignmentSides(placement, rects, rtl) {
812  if (rtl === void 0) {
813    rtl = false;
814  }
815  const alignment = getAlignment(placement);
816  const alignmentAxis = getAlignmentAxis(placement);
817  const length = getAxisLength(alignmentAxis);
818  let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
819  if (rects.reference[length] > rects.floating[length]) {
820    mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
821  }
822  return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
823}
824function getExpandedPlacements(placement) {
825  const oppositePlacement = getOppositePlacement(placement);
826  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
827}
828function getOppositeAlignmentPlacement(placement) {
829  return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
830}
831const lrPlacement = ["left", "right"];
832const rlPlacement = ["right", "left"];
833const tbPlacement = ["top", "bottom"];
834const btPlacement = ["bottom", "top"];
835function getSideList(side, isStart, rtl) {
836  switch (side) {
837    case "top":
838    case "bottom":
839      if (rtl) return isStart ? rlPlacement : lrPlacement;
840      return isStart ? lrPlacement : rlPlacement;
841    case "left":
842    case "right":
843      return isStart ? tbPlacement : btPlacement;
844    default:
845      return [];
846  }
847}
848function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
849  const alignment = getAlignment(placement);
850  let list = getSideList(getSide(placement), direction === "start", rtl);
851  if (alignment) {
852    list = list.map((side) => side + "-" + alignment);
853    if (flipAlignment) {
854      list = list.concat(list.map(getOppositeAlignmentPlacement));
855    }
856  }
857  return list;
858}
859function getOppositePlacement(placement) {
860  const side = getSide(placement);
861  return oppositeSideMap[side] + placement.slice(side.length);
862}
863function expandPaddingObject(padding) {
864  return {
865    top: 0,
866    right: 0,
867    bottom: 0,
868    left: 0,
869    ...padding
870  };
871}
872function getPaddingObject(padding) {
873  return typeof padding !== "number" ? expandPaddingObject(padding) : {
874    top: padding,
875    right: padding,
876    bottom: padding,
877    left: padding
878  };
879}
880function rectToClientRect(rect) {
881  const {
882    x: x2,
883    y,
884    width,
885    height
886  } = rect;
887  return {
888    width,
889    height,
890    top: y,
891    left: x2,
892    right: x2 + width,
893    bottom: y + height,
894    x: x2,
895    y
896  };
897}
898function computeCoordsFromPlacement(_ref, placement, rtl) {
899  let {
900    reference,
901    floating
902  } = _ref;
903  const sideAxis = getSideAxis(placement);
904  const alignmentAxis = getAlignmentAxis(placement);
905  const alignLength = getAxisLength(alignmentAxis);
906  const side = getSide(placement);
907  const isVertical = sideAxis === "y";
908  const commonX = reference.x + reference.width / 2 - floating.width / 2;
909  const commonY = reference.y + reference.height / 2 - floating.height / 2;
910  const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
911  let coords;
912  switch (side) {
913    case "top":
914      coords = {
915        x: commonX,
916        y: reference.y - floating.height
917      };
918      break;
919    case "bottom":
920      coords = {
921        x: commonX,
922        y: reference.y + reference.height
923      };
924      break;
925    case "right":
926      coords = {
927        x: reference.x + reference.width,
928        y: commonY
929      };
930      break;
931    case "left":
932      coords = {
933        x: reference.x - floating.width,
934        y: commonY
935      };
936      break;
937    default:
938      coords = {
939        x: reference.x,
940        y: reference.y
941      };
942  }
943  switch (getAlignment(placement)) {
944    case "start":
945      coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
946      break;
947    case "end":
948      coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
949      break;
950  }
951  return coords;
952}
953async function detectOverflow(state, options) {
954  var _await$platform$isEle;
955  if (options === void 0) {
956    options = {};
957  }
958  const {
959    x: x2,
960    y,
961    platform: platform2,
962    rects,
963    elements: elements2,
964    strategy
965  } = state;
966  const {
967    boundary = "clippingAncestors",
968    rootBoundary = "viewport",
969    elementContext = "floating",
970    altBoundary = false,
971    padding = 0
972  } = evaluate(options, state);
973  const paddingObject = getPaddingObject(padding);
974  const altContext = elementContext === "floating" ? "reference" : "floating";
975  const element = elements2[altBoundary ? altContext : elementContext];
976  const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
977    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(elements2.floating)),
978    boundary,
979    rootBoundary,
980    strategy
981  }));
982  const rect = elementContext === "floating" ? {
983    x: x2,
984    y,
985    width: rects.floating.width,
986    height: rects.floating.height
987  } : rects.reference;
988  const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements2.floating));
989  const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
990    x: 1,
991    y: 1
992  } : {
993    x: 1,
994    y: 1
995  };
996  const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
997    elements: elements2,
998    rect,
999    offsetParent,
1000    strategy
1001  }) : rect);
1002  return {
1003    top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1004    bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1005    left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1006    right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1007  };
1008}
1009const MAX_RESET_COUNT = 50;
1010const computePosition$1 = async (reference, floating, config) => {
1011  const {
1012    placement = "bottom",
1013    strategy = "absolute",
1014    middleware = [],
1015    platform: platform2
1016  }
1016 = config;
1017  const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
1018    ...platform2,
1019    detectOverflow
1020  };
1021  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
1022  let rects = await platform2.getElementRects({
1023    reference,
1024    floating,
1025    strategy
1026  });
1027  let {
1028    x: x2,
1029    y
1030  } = computeCoordsFromPlacement(rects, placement, rtl);
1031  let statefulPlacement = placement;
1032  let resetCount = 0;
1033  const middlewareData = {};
1034  for (let i = 0; i < middleware.length; i++) {
1035    const currentMiddleware = middleware[i];
1036    if (!currentMiddleware) {
1037      continue;
1038    }
1039    const {
1040      name,
1041      fn
1042    } = currentMiddleware;
1043    const {
1044      x: nextX,
1045      y: nextY,
1046      data,
1047      reset
1048    } = await fn({
1049      x: x2,
1050      y,
1051      initialPlacement: placement,
1052      placement: statefulPlacement,
1053      strategy,
1054      middlewareData,
1055      rects,
1056      platform: platformWithDetectOverflow,
1057      elements: {
1058        reference,
1059        floating
1060      }
1061    });
1062    x2 = nextX != null ? nextX : x2;
1063    y = nextY != null ? nextY : y;
1064    middlewareData[name] = {
1065      ...middlewareData[name],
1066      ...data
1067    };
1068    if (reset && resetCount < MAX_RESET_COUNT) {
1069      resetCount++;
1070      if (typeof reset === "object") {
1071        if (reset.placement) {
1072          statefulPlacement = reset.placement;
1073        }
1074        if (reset.rects) {
1075          rects = reset.rects === true ? await platform2.getElementRects({
1076            reference,
1077            floating,
1078            strategy
1079          }) : reset.rects;
1080        }
1081        ({
1082          x: x2,
1083          y
1084        } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1085      }
1086      i = -1;
1087    }
1088  }
1089  return {
1090    x: x2,
1091    y,
1092    placement: statefulPlacement,
1093    strategy,
1094    middlewareData
1095  };
1096};
1097const arrow$1 = (options) => ({
1098  name: "arrow",
1099  options,
1100  async fn(state) {
1101    const {
1102      x: x2,
1103      y,
1104      placement,
1105      rects,
1106      platform: platform2,
1107      elements: elements2,
1108      middlewareData
1109    } = state;
1110    const {
1111      element,
1112      padding = 0
1113    } = evaluate(options, state) || {};
1114    if (element == null) {
1115      return {};
1116    }
1117    const paddingObject = getPaddingObject(padding);
1118    const coords = {
1119      x: x2,
1120      y
1121    };
1122    const axis = getAlignmentAxis(placement);
1123    const length = getAxisLength(axis);
1124    const arrowDimensions = await platform2.getDimensions(element);
1125    const isYAxis = axis === "y";
1126    const minProp = isYAxis ? "top" : "left";
1127    const maxProp = isYAxis ? "bottom" : "right";
1128    const clientProp = isYAxis ? "clientHeight" : "clientWidth";
1129    const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1130    const startDiff = coords[axis] - rects.reference[axis];
1131    const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
1132    let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1133    if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
1134      clientSize = elements2.floating[clientProp] || rects.floating[length];
1135    }
1136    const centerToReference = endDiff / 2 - startDiff / 2;
1137    const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1138    const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1139    const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1140    const min$1 = minPadding;
1141    const max2 = clientSize - arrowDimensions[length] - maxPadding;
1142    const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1143    const offset = clamp(min$1, center, max2);
1144    const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1145    const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
1146    return {
1147      [axis]: coords[axis] + alignmentOffset,
1148      data: {
1149        [axis]: offset,
1150        centerOffset: center - offset - alignmentOffset,
1151        ...shouldAddOffset && {
1152          alignmentOffset
1153        }
1154      },
1155      reset: shouldAddOffset
1156    };
1157  }
1158});
1159const flip$1 = function(options) {
1160  if (options === void 0) {
1161    options = {};
1162  }
1163  return {
1164    name: "flip",
1165    options,
1166    async fn(state) {
1167      var _middlewareData$arrow, _middlewareData$flip;
1168      const {
1169        placement,
1170        middlewareData,
1171        rects,
1172        initialPlacement,
1173        platform: platform2,
1174        elements: elements2
1175      } = state;
1176      const {
1177        mainAxis: checkMainAxis = true,
1178        crossAxis: checkCrossAxis = true,
1179        fallbackPlacements: specifiedFallbackPlacements,
1180        fallbackStrategy = "bestFit",
1181        fallbackAxisSideDirection = "none",
1182        flipAlignment = true,
1183        ...detectOverflowOptions
1184      } = evaluate(options, state);
1185      if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1186        return {};
1187      }
1188      const side = getSide(placement);
1189      const initialSideAxis = getSideAxis(initialPlacement);
1190      const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1191      const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements2.floating));
1192      const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1193      const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
1194      if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
1195        fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1196      }
1197      const placements = [initialPlacement, ...fallbackPlacements];
1198      const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1199      const overflows = [];
1200      let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1201      if (checkMainAxis) {
1202        overflows.push(overflow[side]);
1203      }
1204      if (checkCrossAxis) {
1205        const sides = getAlignmentSides(placement, rects, rtl);
1206        overflows.push(overflow[sides[0]], overflow[sides[1]]);
1207      }
1208      overflowsData = [...overflowsData, {
1209        placement,
1210        overflows
1211      }];
1212      if (!overflows.every((side2) => side2 <= 0)) {
1213        var _middlewareData$flip2, _overflowsData$filter;
1214        const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1215        const nextPlacement = placements[nextIndex];
1216        if (nextPlacement) {
1217          const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
1218          if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
1219          // overflows the main axis.
1220          overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
1221            return {
1222              data: {
1223                index: nextIndex,
1224                overflows: overflowsData
1225              },
1226              reset: {
1227                placement: nextPlacement
1228              }
1229            };
1230          }
1231        }
1232        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;
1233        if (!resetPlacement) {
1234          switch (fallbackStrategy) {
1235            case "bestFit": {
1236              var _overflowsData$filter2;
1237              const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
1238                if (hasFallbackAxisSideDirection) {
1239                  const currentSideAxis = getSideAxis(d.placement);
1240                  return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
1241                  // reading directions favoring greater width.
1242                  currentSideAxis === "y";
1243                }
1244                return true;
1245              }).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$filter2[0];
1246              if (placement2) {
1247                resetPlacement = placement2;
1248              }
1249              break;
1250            }
1251            case "initialPlacement":
1252              resetPlacement = initialPlacement;
1253              break;
1254          }
1255        }
1256        if (placement !== resetPlacement) {
1257          return {
1258            reset: {
1259              placement: resetPlacement
1260            }
1261          };
1262        }
1263      }
1264      return {};
1265    }
1266  };
1267};
1268const shift$1 = function(options) {
1269  if (options === void 0) {
1270    options = {};
1271  }
1272  return {
1273    name: "shift",
1274    options,
1275    async fn(state) {
1276      const {
1277        x: x2,
1278        y,
1279        placement,
1280        platform: platform2
1281      } = state;
1282      const {
1283        mainAxis: checkMainAxis = true,
1284        crossAxis: checkCrossAxis = false,
1285        limiter = {
1286          fn: (_ref) => {
1287            let {
1288              x: x3,
1289              y: y2
1290            } = _ref;
1291            return {
1292              x: x3,
1293              y: y2
1294            };
1295          }
1296        },
1297        ...detectOverflowOptions
1298      } = evaluate(options, state);
1299      const coords = {
1300        x: x2,
1301        y
1302      };
1303      const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1304      const crossAxis = getSideAxis(getSide(placement));
1305      const mainAxis = getOppositeAxis(crossAxis);
1306      let mainAxisCoord = coords[mainAxis];
1307      let crossAxisCoord = coords[crossAxis];
1308      if (checkMainAxis) {
1309        const minSide = mainAxis === "y" ? "top" : "left";
1310        const maxSide = mainAxis === "y" ? "bottom" : "right";
1311        const min2 = mainAxisCoord + overflow[minSide];
1312        const max2 = mainAxisCoord - overflow[maxSide];
1313        mainAxisCoord = clamp(min2, mainAxisCoord, max2);
1314      }
1315      if (checkCrossAxis) {
1316        const minSide = crossAxis === "y" ? "top" : "left";
1317        const maxSide = crossAxis === "y" ? "bottom" : "right";
1318        const min2 = crossAxisCoord + overflow[minSide];
1319        const max2 = crossAxisCoord - overflow[maxSide];
1320        crossAxisCoord = clamp(min2, crossAxisCoord, max2);
1321      }
1322      const limitedCoords = limiter.fn({
1323        ...state,
1324        [mainAxis]: mainAxisCoord,
1325        [crossAxis]: crossAxisCoord
1326      });
1327      return {
1328        ...limitedCoords,
1329        data: {
1330          x: limitedCoords.x - x2,
1331          y: limitedCoords.y - y,
1332          enabled: {
1333            [mainAxis]: checkMainAxis,
1334            [crossAxis]: checkCrossAxis
1335          }
1336        }
1337      };
1338    }
1339  };
1340};
1341const size$1 = function(options) {
1342  if (options === void 0) {
1343    options = {};
1344  }
1345  return {
1346    name: "size",
1347    options,
1348    async fn(state) {
1349      var _state$middlewareData, _state$middlewareData2;
1350      const {
1351        placement,
1352        rects,
1353        platform: platform2,
1354        elements: elements2
1355      } = state;
1356      const {
1357        apply = () => {
1358        },
1359        ...detectOverflowOptions
1360      } = evaluate(options, state);
1361      const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1362      const side = getSide(placement);
1363      const alignment = getAlignment(placement);
1364      const isYAxis = getSideAxis(placement) === "y";
1365      const {
1366        width,
1367        height
1368      } = rects.floating;
1369      let heightSide;
1370      let widthSide;
1371      if (side === "top" || side === "bottom") {
1372        heightSide = side;
1373        widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements2.floating)) ? "start" : "end") ? "left" : "right";
1374      } else {
1375        widthSide = side;
1376        heightSide = alignment === "end" ? "top" : "bottom";
1377      }
1378      const maximumClippingHeight = height - overflow.top - overflow.bottom;
1379      const maximumClippingWidth = width - overflow.left - overflow.right;
1380      const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1381      const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1382      const noShift = !state.middlewareData.shift;
1383      let availableHeight = overflowAvailableHeight;
1384      let availableWidth = overflowAvailableWidth;
1385      if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
1386        availableWidth = maximumClippingWidth;
1387      }
1388      if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
1389        availableHeight = maximumClippingHeight;
1390      }
1391      if (noShift && !alignment) {
1392        const xMin = max(overflow.left, 0);
1393        const xMax = max(overflow.right, 0);
vendor: 8,692 bytes, lines 1394-1664
1394        const yMin = max(overflow.top, 0);
1395        const yMax = max(overflow.bottom, 0);
1396        if (isYAxis) {
1397          availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1398        } else {
1399          availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1400        }
1401      }
1402      await apply({
1403        ...state,
1404        availableWidth,
1405        availableHeight
1406      });
1407      const nextDimensions = await platform2.getDimensions(elements2.floating);
1408      if (width !== nextDimensions.width || height !== nextDimensions.height) {
1409        return {
1410          reset: {
1411            rects: true
1412          }
1413        };
1414      }
1415      return {};
1416    }
1417  };
1418};
1419function hasWindow() {
1420  return typeof window !== "undefined";
1421}
1422function getNodeName(node) {
1423  if (isNode(node)) {
1424    return (node.nodeName || "").toLowerCase();
1425  }
1426  return "#document";
1427}
1428function getWindow(node) {
1429  var _node$ownerDocument;
1430  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1431}
1432function getDocumentElement(node) {
1433  var _ref;
1434  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1435}
1436function isNode(value) {
1437  if (!hasWindow()) {
1438    return false;
1439  }
1440  return value instanceof Node || value instanceof getWindow(value).Node;
1441}
1442function isElement(value) {
1443  if (!hasWindow()) {
1444    return false;
1445  }
1446  return value instanceof Element || value instanceof getWindow(value).Element;
1447}
1448function isHTMLElement(value) {
1449  if (!hasWindow()) {
1450    return false;
1451  }
1452  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1453}
1454function isShadowRoot(value) {
1455  if (!hasWindow() || typeof ShadowRoot === "undefined") {
1456    return false;
1457  }
1458  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1459}
1460function isOverflowElement(element) {
1461  const {
1462    overflow,
1463    overflowX,
1464    overflowY,
1465    display
1466  } = getComputedStyle$1(element);
1467  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1468}
1469function isTableElement(element) {
1470  return /^(table|td|th)$/.test(getNodeName(element));
1471}
1472function isTopLayer(element) {
1473  try {
1474    if (element.matches(":popover-open")) {
1475      return true;
1476    }
1477  } catch (_e) {
1478  }
1479  try {
1480    return element.matches(":modal");
1481  } catch (_e) {
1482    return false;
1483  }
1484}
1485const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1486const containRe = /paint|layout|strict|content/;
1487const isNotNone = (value) => !!value && value !== "none";
1488let isWebKitValue;
1489function isContainingBlock(elementOrCss) {
1490  const css2 = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1491  return isNotNone(css2.transform) || isNotNone(css2.translate) || isNotNone(css2.scale) || isNotNone(css2.rotate) || isNotNone(css2.perspective) || !isWebKit() && (isNotNone(css2.backdropFilter) || isNotNone(css2.filter)) || willChangeRe.test(css2.willChange || "") || containRe.test(css2.contain || "");
1492}
1493function getContainingBlock(element) {
1494  let currentNode = getParentNode(element);
1495  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1496    if (isContainingBlock(currentNode)) {
1497      return currentNode;
1498    } else if (isTopLayer(currentNode)) {
1499      return null;
1500    }
1501    currentNode = getParentNode(currentNode);
1502  }
1503  return null;
1504}
1505function isWebKit() {
1506  if (isWebKitValue == null) {
1507    isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1508  }
1509  return isWebKitValue;
1510}
1511function isLastTraversableNode(node) {
1512  return /^(html|body|#document)$/.test(getNodeName(node));
1513}
1514function getComputedStyle$1(element) {
1515  return getWindow(element).getComputedStyle(element);
1516}
1517function getNodeScroll(element) {
1518  if (isElement(element)) {
1519    return {
1520      scrollLeft: element.scrollLeft,
1521      scrollTop: element.scrollTop
1522    };
1523  }
1524  return {
1525    scrollLeft: element.scrollX,
1526    scrollTop: element.scrollY
1527  };
1528}
1529function getParentNode(node) {
1530  if (getNodeName(node) === "html") {
1531    return node;
1532  }
1533  const result = (
1534    // Step into the shadow DOM of the parent of a slotted node.
1535    node.assignedSlot || // DOM Element detected.
1536    node.parentNode || // ShadowRoot detected.
1537    isShadowRoot(node) && node.host || // Fallback.
1538    getDocumentElement(node)
1539  );
1540  return isShadowRoot(result) ? result.host : result;
1541}
1542function getNearestOverflowAncestor(node) {
1543  const parentNode = getParentNode(node);
1544  if (isLastTraversableNode(parentNode)) {
1545    return node.ownerDocument ? node.ownerDocument.body : node.body;
1546  }
1547  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1548    return parentNode;
1549  }
1550  return getNearestOverflowAncestor(parentNode);
1551}
1552function getOverflowAncestors(node, list, traverseIframes) {
1553  var _node$ownerDocument2;
1554  if (list === void 0) {
1555    list = [];
1556  }
1557  if (traverseIframes === void 0) {
1558    traverseIframes = true;
1559  }
1560  const scrollableAncestor = getNearestOverflowAncestor(node);
1561  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1562  const win = getWindow(scrollableAncestor);
1563  if (isBody) {
1564    const frameElement = getFrameElement(win);
1565    return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1566  } else {
1567    return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1568  }
1569}
1570function getFrameElement(win) {
1571  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1572}
1573function getCssDimensions(element) {
1574  const css2 = getComputedStyle$1(element);
1575  let width = parseFloat(css2.width) || 0;
1576  let height = parseFloat(css2.height) || 0;
1577  const hasOffset = isHTMLElement(element);
1578  const offsetWidth = hasOffset ? element.offsetWidth : width;
1579  const offsetHeight = hasOffset ? element.offsetHeight : height;
1580  const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1581  if (shouldFallback) {
1582    width = offsetWidth;
1583    height = offsetHeight;
1584  }
1585  return {
1586    width,
1587    height,
1588    $: shouldFallback
1589  };
1590}
1591function unwrapElement(element) {
1592  return !isElement(element) ? element.contextElement : element;
1593}
1594function getScale(element) {
1595  const domElement = unwrapElement(element);
1596  if (!isHTMLElement(domElement)) {
1597    return createCoords(1);
1598  }
1599  const rect = domElement.getBoundingClientRect();
1600  const {
1601    width,
1602    height,
1603    $
1604  } = getCssDimensions(domElement);
1605  let x2 = ($ ? round(rect.width) : rect.width) / width;
1606  let y = ($ ? round(rect.height) : rect.height) / height;
1607  if (!x2 || !Number.isFinite(x2)) {
1608    x2 = 1;
1609  }
1610  if (!y || !Number.isFinite(y)) {
1611    y = 1;
1612  }
1613  return {
1614    x: x2,
1615    y
1616  };
1617}
1618const noOffsets = /* @__PURE__ */ createCoords(0);
1619function getVisualOffsets(element) {
1620  const win = getWindow(element);
1621  if (!isWebKit() || !win.visualViewport) {
1622    return noOffsets;
1623  }
1624  return {
1625    x: win.visualViewport.offsetLeft,
1626    y: win.visualViewport.offsetTop
1627  };
1628}
1629function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1630  if (isFixed === void 0) {
1631    isFixed = false;
1632  }
1633  if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1634    return false;
1635  }
1636  return isFixed;
1637}
1638function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1639  if (includeScale === void 0) {
1640    includeScale = false;
1641  }
1642  if (isFixedStrategy === void 0) {
1643    isFixedStrategy = false;
1644  }
1645  const clientRect = element.getBoundingClientRect();
1646  const domElement = unwrapElement(element);
1647  let scale = createCoords(1);
1648  if (includeScale) {
1649    if (offsetParent) {
1650      if (isElement(offsetParent)) {
1651        scale = getScale(offsetParent);
1652      }
1653    } else {
1654      scale = getScale(element);
1655    }
1656  }
1657  const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1658  let x2 = (clientRect.left + visualOffsets.x) / scale.x;
1659  let y = (clientRect.top + visualOffsets.y) / scale.y;
1660  let width = clientRect.width / scale.x;
1661  let height = clientRect.height / scale.y;
1662  if (domElement) {
1663    const win = getWindow(domElement);
1664    const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1665    let currentWin = win;
1666    let currentIFrame = getFrameElement(currentWin);
1667    while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1668      const iframeScale = getScale(currentIFrame);
1669      const iframeRect = currentIFrame.getBoundingClientRect();
1670      const css2 = getComputedStyle$1(currentIFrame);
1671      const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x;
1672      const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
1673      x2 *= iframeScale.x;
1674      y *= iframeScale.y;
1675      width *= iframeScale.x;
1676      height *= iframeScale.y;
1677      x2 += left;
1678      y += top;
1679      currentWin = getWindow(currentIFrame);
1680      currentIFrame = getFrameElement(currentWin);
1681    }
1682  }
1683  return rectToClientRect({
1684    width,
1685    height,
1686    x: x2,
1687    y
1688  });
1689}
1690function getWindowScrollBarX(element, rect) {
1691  const leftScroll = getNodeScroll(element).scrollLeft;
1692  if (!rect) {
1693    return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1694  }
1695  return rect.left + leftScroll;
1696}
1697function getHTMLOffset(documentElement, scroll) {
1698  const htmlRect = documentElement.getBoundingClientRect();
1699  const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1700  const y = htmlRect.top + scroll.scrollTop;
1701  return {
1702    x: x2,
1703    y
1704  };
1705}
1706function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1707  let {
1708    elements: elements2,
1709    rect,
1710    offsetParent,
1711    strategy
1712  } = _ref;
1713  const isFixed = strategy === "fixed";
1714  const documentElement = getDocumentElement(offsetParent);
1715  const topLayer = elements2 ? isTopLayer(elements2.floating) : false;
1716  if (offsetParent === documentElement || topLayer && isFixed) {
1717    return rect;
1718  }
1719  let scroll = {
1720    scrollLeft: 0,
1721    scrollTop: 0
1722  };
1723  let scale = createCoords(1);
1724  const offsets = createCoords(0);
1725  const isOffsetParentAnElement = isHTMLElement(offsetParent);
1726  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1727    if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1728      scroll = getNodeScroll(offsetParent);
1729    }
1730    if (isOffsetParentAnElement) {
1731      const offsetRect = getBoundingClientRect(offsetParent);
1732      scale = getScale(offsetParent);
1733      offsets.x = offsetRect.x + offsetParent.clientLeft;
1734      offsets.y = offsetRect.y + offsetParent.clientTop;
1735    }
1736  }
1737  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1738  return {
1739    width: rect.width * scale.x,
1740    height: rect.height * scale.y,
1741    x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1742    y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1743  };
1744}
1745function getClientRects(element) {
1746  return Array.from(element.getClientRects());
1747}
1748function getDocumentRect(element) {
1749  const html2 = getDocumentElement(element);
1750  const scroll = getNodeScroll(element);
1751  const body = element.ownerDocument.body;
1752  const width = max(html2.scrollWidth, html2.clientWidth, body.scrollWidth, body.clientWidth);
1753  const height = max(html2.scrollHeight, html2.clientHeight, body.scrollHeight, body.clientHeight);
1754  let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
1755  const y = -scroll.scrollTop;
1756  if (getComputedStyle$1(body).direction === "rtl") {
1757    x2 += max(html2.clientWidth, body.clientWidth) - width;
1758  }
1759  return {
1760    width,
1761    height,
1762    x: x2,
1763    y
1764  };
1765}
1766const SCROLLBAR_MAX = 25;
1767function getViewportRect(element, strategy) {
1768  const win = getWindow(element);
1769  const html2 = getDocumentElement(element);
1770  const visualViewport = win.visualViewport;
1771  let width = html2.clientWidth;
1772  let height = html2.clientHeight;
1773  let x2 = 0;
1774  let y = 0;
1775  if (visualViewport) {
1776    width = visualViewport.width;
vendor: 10,584 bytes, lines 1777-2078
1777    height = visualViewport.height;
1778    const visualViewportBased = isWebKit();
1779    if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
1780      x2 = visualViewport.offsetLeft;
1781      y = visualViewport.offsetTop;
1782    }
1783  }
1784  const windowScrollbarX = getWindowScrollBarX(html2);
1785  if (windowScrollbarX <= 0) {
1786    const doc = html2.ownerDocument;
1787    const body = doc.body;
1788    const bodyStyles = getComputedStyle(body);
1789    const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1790    const clippingStableScrollbarWidth = Math.abs(html2.clientWidth - body.clientWidth - bodyMarginInline);
1791    if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1792      width -= clippingStableScrollbarWidth;
1793    }
1794  } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1795    width += windowScrollbarX;
1796  }
1797  return {
1798    width,
1799    height,
1800    x: x2,
1801    y
1802  };
1803}
1804function getInnerBoundingClientRect(element, strategy) {
1805  const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1806  const top = clientRect.top + element.clientTop;
1807  const left = clientRect.left + element.clientLeft;
1808  const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1809  const width = element.clientWidth * scale.x;
1810  const height = element.clientHeight * scale.y;
1811  const x2 = left * scale.x;
1812  const y = top * scale.y;
1813  return {
1814    width,
1815    height,
1816    x: x2,
1817    y
1818  };
1819}
1820function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1821  let rect;
1822  if (clippingAncestor === "viewport") {
1823    rect = getViewportRect(element, strategy);
1824  } else if (clippingAncestor === "document") {
1825    rect = getDocumentRect(getDocumentElement(element));
1826  } else if (isElement(clippingAncestor)) {
1827    rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1828  } else {
1829    const visualOffsets = getVisualOffsets(element);
1830    rect = {
1831      x: clippingAncestor.x - visualOffsets.x,
1832      y: clippingAncestor.y - visualOffsets.y,
1833      width: clippingAncestor.width,
1834      height: clippingAncestor.height
1835    };
1836  }
1837  return rectToClientRect(rect);
1838}
1839function hasFixedPositionAncestor(element, stopNode) {
1840  const parentNode = getParentNode(element);
1841  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1842    return false;
1843  }
1844  return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
1845}
1846function getClippingElementAncestors(element, cache) {
1847  const cachedResult = cache.get(element);
1848  if (cachedResult) {
1849    return cachedResult;
1850  }
1851  let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
1852  let currentContainingBlockComputedStyle = null;
1853  const elementIsFixed = getComputedStyle$1(element).position === "fixed";
1854  let currentNode = elementIsFixed ? getParentNode(element) : element;
1855  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1856    const computedStyle = getComputedStyle$1(currentNode);
1857    const currentNodeIsContaining = isContainingBlock(currentNode);
1858    if (!currentNodeIsContaining && computedStyle.position === "fixed") {
1859      currentContainingBlockComputedStyle = null;
1860    }
1861    const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1862    if (shouldDropCurrentNode) {
1863      result = result.filter((ancestor) => ancestor !== currentNode);
1864    } else {
1865      currentContainingBlockComputedStyle = computedStyle;
1866    }
1867    currentNode = getParentNode(currentNode);
1868  }
1869  cache.set(element, result);
1870  return result;
1871}
1872function getClippingRect(_ref) {
1873  let {
1874    element,
1875    boundary,
1876    rootBoundary,
1877    strategy
1878  } = _ref;
1879  const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1880  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1881  const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
1882  let top = firstRect.top;
1883  let right = firstRect.right;
1884  let bottom = firstRect.bottom;
1885  let left = firstRect.left;
1886  for (let i = 1; i < clippingAncestors.length; i++) {
1887    const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
1888    top = max(rect.top, top);
1889    right = min(rect.right, right);
1890    bottom = min(rect.bottom, bottom);
1891    left = max(rect.left, left);
1892  }
1893  return {
1894    width: right - left,
1895    height: bottom - top,
1896    x: left,
1897    y: top
1898  };
1899}
1900function getDimensions(element) {
1901  const {
1902    width,
1903    height
1904  } = getCssDimensions(element);
1905  return {
1906    width,
1907    height
1908  };
1909}
1910function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1911  const isOffsetParentAnElement = isHTMLElement(offsetParent);
1912  const documentElement = getDocumentElement(offsetParent);
1913  const isFixed = strategy === "fixed";
1914  const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1915  let scroll = {
1916    scrollLeft: 0,
1917    scrollTop: 0
1918  };
1919  const offsets = createCoords(0);
1920  function setLeftRTLScrollbarOffset() {
1921    offsets.x = getWindowScrollBarX(documentElement);
1922  }
1923  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1924    if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1925      scroll = getNodeScroll(offsetParent);
1926    }
1927    if (isOffsetParentAnElement) {
1928      const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1929      offsets.x = offsetRect.x + offsetParent.clientLeft;
1930      offsets.y = offsetRect.y + offsetParent.clientTop;
1931    } else if (documentElement) {
1932      setLeftRTLScrollbarOffset();
1933    }
1934  }
1935  if (isFixed && !isOffsetParentAnElement && documentElement) {
1936    setLeftRTLScrollbarOffset();
1937  }
1938  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1939  const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1940  const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1941  return {
1942    x: x2,
1943    y,
1944    width: rect.width,
1945    height: rect.height
1946  };
1947}
1948function isStaticPositioned(element) {
1949  return getComputedStyle$1(element).position === "static";
1950}
1951function getTrueOffsetParent(element, polyfill) {
1952  if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
1953    return null;
1954  }
1955  if (polyfill) {
1956    return polyfill(element);
1957  }
1958  let rawOffsetParent = element.offsetParent;
1959  if (getDocumentElement(element) === rawOffsetParent) {
1960    rawOffsetParent = rawOffsetParent.ownerDocument.body;
1961  }
1962  return rawOffsetParent;
1963}
1964function getOffsetParent(element, polyfill) {
1965  const win = getWindow(element);
1966  if (isTopLayer(element)) {
1967    return win;
1968  }
1969  if (!isHTMLElement(element)) {
1970    let svgOffsetParent = getParentNode(element);
1971    while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1972      if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1973        return svgOffsetParent;
1974      }
1975      svgOffsetParent = getParentNode(svgOffsetParent);
1976    }
1977    return win;
1978  }
1979  let offsetParent = getTrueOffsetParent(element, polyfill);
1980  while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1981    offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1982  }
1983  if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1984    return win;
1985  }
1986  return offsetParent || getContainingBlock(element) || win;
1987}
1988const getElementRects = async function(data) {
1989  const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1990  const getDimensionsFn = this.getDimensions;
1991  const floatingDimensions = await getDimensionsFn(data.floating);
1992  return {
1993    reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1994    floating: {
1995      x: 0,
1996      y: 0,
1997      width: floatingDimensions.width,
1998      height: floatingDimensions.height
1999    }
2000  };
2001};
2002function isRTL(element) {
2003  return getComputedStyle$1(element).direction === "rtl";
2004}
2005const platform = {
2006  convertOffsetParentRelativeRectToViewportRelativeRect,
2007  getDocumentElement,
2008  getClippingRect,
2009  getOffsetParent,
2010  getElementRects,
2011  getClientRects,
2012  getDimensions,
2013  getScale,
2014  isElement,
2015  isRTL
2016};
2017function rectsAreEqual(a, b) {
2018  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
2019}
2020function observeMove(element, onMove) {
2021  let io = null;
2022  let timeoutId;
2023  const root = getDocumentElement(element);
2024  function cleanup() {
2025    var _io;
2026    clearTimeout(timeoutId);
2027    (_io = io) == null || _io.disconnect();
2028    io = null;
2029  }
2030  function refresh(skip, threshold) {
2031    if (skip === void 0) {
2032      skip = false;
2033    }
2034    if (threshold === void 0) {
2035      threshold = 1;
2036    }
2037    cleanup();
2038    const elementRectForRootMargin = element.getBoundingClientRect();
2039    const {
2040      left,
2041      top,
2042      width,
2043      height
2044    } = elementRectForRootMargin;
2045    if (!skip) {
2046      onMove();
2047    }
2048    if (!width || !height) {
2049      return;
2050    }
2051    const insetTop = floor(top);
2052    const insetRight = floor(root.clientWidth - (left + width));
2053    const insetBottom = floor(root.clientHeight - (top + height));
2054    const insetLeft = floor(left);
2055    const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2056    const options = {
2057      rootMargin,
2058      threshold: max(0, min(1, threshold)) || 1
2059    };
2060    let isFirstUpdate = true;
2061    function handleObserve(entries) {
2062      const ratio = entries[0].intersectionRatio;
2063      if (ratio !== threshold) {
2064        if (!isFirstUpdate) {
2065          return refresh();
2066        }
2067        if (!ratio) {
2068          timeoutId = setTimeout(() => {
2069            refresh(false, 1e-7);
2070          }, 1e3);
2071        } else {
2072          refresh(false, ratio);
2073        }
2074      }
2075      if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
2076        refresh();
2077      }
2078      isFirstUpdate = false;
2079    }
2080    try {
2081      io = new IntersectionObserver(handleObserve, {
2082        ...options,
2083        // Handle <iframe>s
2084        root: root.ownerDocument
2085      });
2086    } catch (_e) {
2087      io = new IntersectionObserver(handleObserve, options);
2088    }
2089    io.observe(element);
2090  }
2091  refresh(true);
2092  return cleanup;
2093}
2094function autoUpdate(reference, floating, update, options) {
2095  if (options === void 0) {
2096    options = {};
2097  }
2098  const {
2099    ancestorScroll = true,
2100    ancestorResize = true,
2101    elementResize = typeof ResizeObserver === "function",
2102    layoutShift = typeof IntersectionObserver === "function",
2103    animationFrame = false
2104  } = options;
2105  const referenceEl = unwrapElement(reference);
2106  const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
2107  ancestors.forEach((ancestor) => {
2108    ancestorScroll && ancestor.addEventListener("scroll", update, {
2109      passive: true
2110    });
2111    ancestorResize && ancestor.addEventListener("resize", update);
2112  });
2113  const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2114  let reobserveFrame = -1;
2115  let resizeObserver = null;
2116  if (elementResize) {
2117    resizeObserver = new ResizeObserver((_ref) => {
2118      let [firstEntry] = _ref;
2119      if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
2120        resizeObserver.unobserve(floating);
2121        cancelAnimationFrame(reobserveFrame);
2122        reobserveFrame = requestAnimationFrame(() => {
2123          var _resizeObserver;
2124          (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2125        });
2126      }
2127      update();
2128    });
2129    if (referenceEl && !animationFrame) {
2130      resizeObserver.observe(referenceEl);
2131    }
2132    if (floating) {
2133      resizeObserver.observe(floating);
2134    }
2135  }
2136  let frameId;
2137  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2138  if (animationFrame) {
2139    frameLoop();
2140  }
2141  function frameLoop() {
2142    const nextRefRect = getBoundingClientRect(reference);
2143    if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
2144      update();
2145    }
2146    prevRefRect = nextRefRect;
2147    frameId = requestAnimationFrame(frameLoop);
2148  }
2149  update();
2150  return () => {
2151    var _resizeObserver2;
2152    ancestors.forEach((ancestor) => {
2153      ancestorScroll && ancestor.removeEventListener("scroll", update);
2154      ancestorResize && ancestor.removeEventListener("resize", update);
2155    });
2156    cleanupIo == null || cleanupIo();
2157    (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2158    resizeObserver = null;
2159    if (animationFrame) {
2160      cancelAnimationFrame(frameId);
2161    }
2162  };
2163}
2164const shift = shift$1;
2165const flip = flip$1;
2166const size = size$1;
2167const arrow = arrow$1;
2168const computePosition = (reference, floating, options) => {
2169  const cache = /* @__PURE__ */ new Map();
2170  const mergedOptions = {
2171    platform,
2172    ...options
2173  };
2174  const platformWithCache = {
2175    ...mergedOptions.platform,
2176    _c: cache
2177  };
2178  return computePosition$1(reference, floating, {
2179    ...mergedOptions,
2180    platform: platformWithCache
2181  });
2182};
2183const isPointOverRect = (bounds, point) => {
2184  if (point.x >
2184= bounds.left && point.x <= bounds.left + bounds.width && point.y >= bounds.top && point.y <= bounds.top + bounds.height) {
2185    return true;
2186  }
2187  return false;
2188};
2189const inflateRectInDirection = (rect, value, direction) => {
2190  const rectObject = {
2191    bottom: rect.bottom,
2192    left: rect.left,
2193    right: rect.right,
2194    width: rect.width,
2195    x: rect.x,
2196    y: rect.y,
2197    top: rect.top,
2198    height: rect.height
2199  };
2200  switch (direction) {
2201    case "top":
2202      return {
2203        ...rectObject,
2204        left: rect.left - 2,
2205        width: rect.width + 2,
2206        top: rect.top - value,
2207        height: rect.height + value
2208      };
2209    case "bottom":
2210      return {
2211        ...rectObject,
2212        left: rect.left - 2,
2213        width: rect.width + 2,
2214        bottom: rect.bottom + value,
2215        height: rect.height + value
2216      };
2217    case "left":
2218      return {
2219        ...rectObject,
2220        left: rect.left - value,
2221        width: rect.width + value
2222      };
2223    case "right":
2224      return {
2225        ...rectObject,
2226        left: rect.left - 2,
2227        right: rect.right + value,
2228        width: rect.width + value + 2
2229      };
2230    default:
2231      return {
2232        ...rectObject,
2233        top: rect.top - value,
2234        left: rect.left - value,
2235        width: rect.width + value * 2,
2236        height: rect.height + value * 2
2237      };
2238  }
2239};
2240const findClosestThemeProvider = (baseElement, prefix = "chameleon") => {
2241  const themeProviderSelector = `chameleon-theme-provider, ${prefix}-theme-provider`;
2242  if (!baseElement) {
2243    const provider2 = document.querySelector(themeProviderSelector);
2244    return provider2 ?? void 0;
2245  }
2246  const provider = baseElement.closest(themeProviderSelector);
2247  if (provider) {
2248    return provider;
2249  }
2250  const rootNode = baseElement.getRootNode();
2251  if (rootNode instanceof ShadowRoot) {
2252    return findClosestThemeProvider(rootNode.host);
2253  }
2254  return findClosestThemeProvider(rootNode.parentElement);
2255};
2256function findParent(element, filter) {
2257  let currentElement = element;
2258  while (currentElement && currentElement !== document.body.parentElement) {
2259    currentElement = currentElement.parentElement;
2260    if (currentElement && filter(currentElement)) {
2261      return currentElement;
2262    }
2263  }
2264  return null;
2265}
2266function findChild(element, filter) {
2267  for (let i = 0; i < ((element == null ? void 0 : element.children.length) ?? 0); i++) {
2268    const currentElement = element == null ? void 0 : element.children.item(i);
2269    if (currentElement) {
2270      if (filter(currentElement)) {
2271        return currentElement;
2272      }
2273      const foundElement = findChild(currentElement, filter);
2274      if (foundElement) {
2275        return foundElement;
2276      }
2277    }
2278  }
2279  return null;
2280}
2281function traverseShadowRootsForElementWithId(id, element) {
2282  const found = element.querySelector ? element.querySelector(`#${CSS.escape(id)}`) : null;
2283  if (found)
2284    return found;
2285  if (element instanceof ShadowRoot) {
2286    return traverseShadowRootsForElementWithId(id, element.host);
2287  }
2288  if (element.parentNode) {
2289    return traverseShadowRootsForElementWithId(id, element.parentNode);
2290  }
2291  return null;
2292}
2293function observeForElementWithId(id, context, callback, timeoutMs = 1e4) {
2294  if (!id) {
2295    return () => {
2296    };
2297  }
2298  const rootNode = context.getRootNode();
2299  let timeoutId;
2300  const observer = new MutationObserver(() => {
2301    if (!context.isConnected) {
2302      cleanup();
2303      return;
2304    }
2305    const el = traverseShadowRootsForElementWithId(id, context);
2306    if (el) {
2307      cleanup();
2308      callback(el);
2309    }
2310  });
2311  function cleanup() {
2312    observer.disconnect();
2313    if (timeoutId !== void 0) {
2314      clearTimeout(timeoutId);
2315      timeoutId = void 0;
2316    }
2317  }
2318  observer.observe(rootNode, {
2319    childList: true,
2320    subtree: true,
2321    attributes: true,
2322    attributeFilter: ["id"]
2323  });
2324  if (timeoutMs > 0) {
2325    timeoutId = setTimeout(() => {
2326      console.warn(`[Chameleon] Could not find element with id "${id}" within ${timeoutMs}ms. Ensure the trigger element is rendered in the same DOM scope as the component.`);
2327      cleanup();
2328    }, timeoutMs);
2329  }
2330  return () => cleanup();
2331}
2332const LARGE_WIDTH = 300;
2333const DEFAULT_SINGLE_LINE_CONTENT_HEIGHT = 30;
2334function chameleonPlacementToFloatingUIPlacement(position) {
2335  if (!position.includes("center")) {
2336    return position;
2337  }
2338  const [placement] = position.split("-");
2339  return placement;
2340}
2341function floatingUIPlacementToChameleonPosition(placement) {
2342  if (!placement.includes("-")) {
2343    return `${placement}-center`;
2344  }
2345  return placement;
2346}
2347const reactToPlacementChange = (popover) => {
2348  let previousPlacement;
2349  return {
2350    name: "reactToPlacementChange",
2351    fn({ x: x2, y, initialPlacement, placement }) {
2352      if (initialPlacement !== placement || placement !== previousPlacement) {
2353        const position = floatingUIPlacementToChameleonPosition(placement);
2354        popover.setAttribute("data-rendered-position", position);
2355        popover.$emit("position-changed");
2356      }
2357      previousPlacement = placement;
2358      return {
2359        x: x2,
2360        y
2361      };
2362    }
2363  };
2364};
2365function calculateTooltipPosition(customElement, positionedElement, trigger, arrowElement) {
2366  return new Promise((resolve) => {
2367    const positionFallbackPlacements = calculateFallbackPlacements(customElement.position);
2368    const triggerBounds = trigger.getBoundingClientRect();
2369    requestAnimationFrame(() => {
2370      if (!customElement.isConnected) {
2371        resolve(() => {
2372        });
2373        return;
2374      }
2375      const middlewares = [
2376        flip({
2377          fallbackPlacements: positionFallbackPlacements
2378        }),
2379        shift({ padding: 8 }),
2380        ...arrowElement ? [arrow({ element: arrowElement, padding: 5 })] : []
2381      ];
2382      middlewares.push(reactToPlacementChange(customElement));
2383      const position = calculateSingleLinePositioning(customElement.position, positionedElement);
2384      if (position !== customElement.position) {
2385        positionedElement.setAttribute("data-single-line", "true");
2386        positionedElement.setAttribute("data-rendered-position", position);
2387      }
2388      const contentRect = positionedElement.getBoundingClientRect();
2389      positionedElement.style.setProperty("--content-height", `${contentRect.height}px`);
2390      positionedElement.style.setProperty("--content-width", `${c
2390ontentRect.width}px`);
2391      if (contentRect.width >= LARGE_WIDTH && !positionedElement.hasAttribute("large")) {
2392        positionedElement.setAttribute("large", "");
2393        calculateTooltipPosition(customElement, positionedElement, trigger, arrowElement).then((cleanup2) => resolve(cleanup2));
2394        return;
2395      }
2396      positionedElement.style.setProperty("--trigger-width", `${triggerBounds.width}px`);
2397      positionedElement.style.setProperty("--trigger-height", `${triggerBounds.height}px`);
2398      if (customElement.zIndex) {
2399        positionedElement.style.setProperty("--z-index", `${customElement.zIndex}`);
2400      }
2401      const positionedElementStyles = getComputedStyle(positionedElement);
2402      const elementPadding = parseFloat(positionedElementStyles.getPropertyValue("--element-padding")) || 10;
2403      const arrowSize = parseFloat(positionedElementStyles.getPropertyValue("--arrow-size")) || 10;
2404      const cleanup = autoUpdate(trigger, positionedElement, () => {
2405        computePosition(trigger, positionedElement, {
2406          placement: chameleonPlacementToFloatingUIPlacement(position),
2407          strategy: "fixed",
2408          middleware: middlewares
2409        }).then(({ x: x2, y, placement, middlewareData }) => {
2410          const additionalOffsetX = customElement.style.getPropertyValue("--additional-offset-x");
2411          const additionalOffsetY = customElement.style.getPropertyValue("--additional-offset-y");
2412          if (additionalOffsetX) {
2413            positionedElement.style.setProperty("--trigger-x", `calc(${x2}px + ${additionalOffsetX})`);
2414          } else {
2415            positionedElement.style.setProperty("--trigger-x", `${x2}px`);
2416          }
2417          if (additionalOffsetY) {
2418            positionedElement.style.setProperty("--trigger-y", `calc(${y}px + ${additionalOffsetY})`);
2419          } else {
2420            positionedElement.style.setProperty("--trigger-y", `${y}px`);
2421          }
2422          if (arrowElement && middlewareData.arrow) {
2423            const { x: arrowX, y: arrowY } = middlewareData.arrow;
2424            const [primaryPlacement, secondaryPlacement] = placement.split("-");
2425            const isVertical = primaryPlacement === "top" || primaryPlacement === "bottom";
2426            const rawOffset = isVertical ? arrowX : arrowY;
2427            const cssProp = isVertical ? "--arrow-offset-x" : "--arrow-offset-y";
2428            const staleProp = isVertical ? "--arrow-offset-y" : "--arrow-offset-x";
2429            if (rawOffset == null)
2430              return;
2431            arrowElement.style.removeProperty(staleProp);
2432            let adjustedOffset = rawOffset;
2433            if (secondaryPlacement === "start" || secondaryPlacement === "end") {
2434              const compensation = secondaryPlacement === "start" ? elementPadding : -elementPadding;
2435              adjustedOffset = rawOffset + compensation;
2436              if (isVertical) {
2437                const tooltipWidth = parseFloat(positionedElement.style.getPropertyValue("--content-width")) || 0;
2438                const halfCenter = tooltipWidth / 2 - arrowSize / 2;
2439                adjustedOffset = compensation > 0 ? Math.min(halfCenter, adjustedOffset) : Math.max(halfCenter, adjustedOffset);
2440              } else {
2441                const tooltipHeight = parseFloat(positionedElement.style.getPropertyValue("--content-height")) || 0;
2442                const halfCenter = tooltipHeight / 2 - arrowSize / 2;
2443                adjustedOffset = compensation > 0 ? Math.min(halfCenter, adjustedOffset) : Math.max(halfCenter, adjustedOffset);
2444              }
2445            }
2446            arrowElement.style.setProperty(cssProp, `${adjustedOffset}px`);
2447          }
2448        });
2449      });
2450      resolve(cleanup);
2451    });
2452  });
2453}
2454function calculateSingleLinePositioning(position, content) {
2455  const isSingleLine = convertStylePropertyPixelsToNumber(getComputedStyle(content), "height") <= DEFAULT_SINGLE_LINE_CONTENT_HEIGHT;
2456  if (isSingleLine && (position.includes("left") || position.includes("right"))) {
2457    const [primaryPosition] = position.split("-");
2458    return `${primaryPosition}-center`;
2459  }
2460  return position;
2461}
2462function calculateFallbackPlacements(position) {
2463  const basePlacementList = [
2464    "bottom",
2465    "bottom-start",
2466    "bottom-end",
2467    "top",
2468    "top-start",
2469    "top-end",
2470    "right",
2471    "right-start",
2472    "right-end",
2473    "left",
2474    "left-start",
2475    "left-end"
2476  ];
2477  const oppositePrimaryPositionPairs = {
2478    top: "bottom",
2479    bottom: "top",
2480    left: "right",
2481    right: "left"
2482  };
2483  const oppositeSecondaryPositionsPairs = {
2484    end: "start",
2485    start: "end",
2486    center: "center"
2487  };
2488  const [primaryPlacement, secondaryPlacement] = position.split("-");
2489  const samePrimaryOptions = [`${primaryPlacement}`, `${primaryPlacement}-start`, `${primaryPlacement}-end`].filter((placement) => placement !== position);
2490  const oppositePrimaryOptions = [
2491    `${oppositePrimaryPositionPairs[primaryPlacement]}-${secondaryPlacement}`,
2492    `${oppositePrimaryPositionPairs[primaryPlacement]}`,
2493    `${oppositePrimaryPositionPairs[primaryPlacement]}-${oppositeSecondaryPositionsPairs[secondaryPlacement]}`
2494  ];
2495  const rest = basePlacementList.filter((placement) => !samePrimaryOptions.includes(placement) || !oppositePrimaryOptions.includes(placement));
2496  return [...samePrimaryOptions, ...oppositePrimaryOptions, ...rest];
2497}
2498const PopoverTriggerOn = {
2499  mouseover: "mouseover"
2500};
2501const MIN_WIDTH = 30;
2502const MAX_WIDTH = 224;
2503const DEFAULT_POSITION = "bottom-center";
2504const TRIGGER_MOUSE_MOVE_OFFSET = 20;
2505const tooltipTemplate = html`
2506  <template popover="${(x2) => x2.popover}" role="tooltip">
2507    <div ${ref("contentEl")} class="content">
2508      <div class="title"><slot name="title"></slot></div>
2509      <div class="body"><slot></slot></div>
2510    </div>
2511    <div ${ref("arrowEl")} class="arrow"></div>
2512  </template>
2513`;
2514class NativePopoverApi extends ChameleonElementMixin(FoundationElement) {
2515}
2516class TooltipComponent extends NativePopoverApi {
2517  constructor() {
2518    super(...arguments);
2519    this.position = DEFAULT_POSITION;
2520    this.inverted = true;
2521    this.minWidth = MIN_WIDTH;
2522    this.maxWidth = MAX_WIDTH;
2523    this.triggerOn = PopoverTriggerOn.mouseover;
2524    this.delay = 400;
2525    this.hidden = false;
2526    this.popover = "manual";
2527    this.triggerId = "";
2528    this.unsubscribeFn = () => {
2529    };
2530    this.isOpen = false;
2531    this.isNativePopoverVersion = true;
2532    this.triggerEl = null;
2533    this.lastMousePosition = null;
2534    this.handleTriggerMouseover = (e) => {
2535      if (!this.triggerEl)
2536        return;
2537      const path = e.composedPath();
2538      const triggerIndex = path.indexOf(this.triggerEl);
2539      if (triggerIndex === -1) {
2540        this.isOpen = true;
2541        return;
2542      }
2543      const inOpenDialog = path.slice(0, triggerIndex).some((node) => node instanceof HTMLDialogElement && node.open);
2544      if (inOpenDialog)
2545        return;
2546      this.isOpen = true;
2547    };
2548    this.handleTriggerMouseleave = () => {
2549      if (this.dataset.displayed !== "true") {
2550        this.isOpen = false;
2551      }
2552    };
2553    this.handleTriggerFocus = (_e) => {
2554      this.isOpen = true;
2555    };
2556    this.handleTriggerBlur = () => {
2557      this.isOpen = false;
2558    };
2559    this.handleTriggerKeydown = (event) => {
2560      if (event.key === "Escape" && this.isOpen) {
2561        this.isOpen = false;
2562      }
2563    };
2564    this.handleDocumentMousemove = (event) => {
2565      const x2 = event.clientX;
2566      const y = event.clientY;
2567      this.lastMousePosition = { x: x2, y };
2568      this.checkMousePositionAndClose(x2, y);
2569    };
2570    this.handleDocumentScroll = () => {
2571      if (!this.triggerEl || !this.isTriggerElementVisible()) {
2572        this.isOpen = false;
2573        return;
2574      }
2575      if (this.lastMousePosition) {
2576        const { x: x2, y } = this.lastMousePosition;
2577        this.checkMousePositionAndClose(x2, y);
2578      }
2579    };
2580  }
2581  triggerIdChanged(_, next) {
2582    var _a, _b;
2583    (_a = this.unsubscribeFn) == null ? void 0 : _a.call(this);
2584    (_b = this.cancelPendingTriggerObservation) == null ? void 0 : _b.call(this);
2585    this.cancelPendingTriggerObservation = void 0;
2586    if (!next || next === "") {
2587      return;
2588    }
2589    DOM.queueUpdate(() => {
2590      if (!this.isConnected)
2591        return;
2592      this.configureTriggerElement(next);
2593    });
2594  }
2595  configureTriggerElement(triggerId) {
2596    var _a;
2597    (_a = this.cancelPendingTriggerObservation) == null ? void 0 : _a.call(this);
2598    this.cancelPendingTriggerObservation = void 0;
2599    this.triggerEl = traverseShadowRootsForElementWithId(triggerId, this);
2600    if (!this.triggerEl) {
2601      this.cancelPendingTriggerObservation = observeForElementWithId(triggerId, this, () => {
2602        this.configureTriggerElement(triggerId);
2603      });
2604      return;
2605    }
2606    this.triggerEl.addEventListener("mouseover", this.handleTriggerMouseover);
2607    this.triggerEl.addEventListener("mouseleave", this.handleTriggerMouseleave);
2608    this.triggerEl.addEventListener("focus", this.handleTriggerFocus);
2609    this.triggerEl.addEventListener("blur", this.handleTriggerBlur);
2610    this.triggerEl.addEventListener("keydown", this.handleTriggerKeydown);
2611    const existingDescribedBy = this.triggerEl.getAttribute("aria-describedby");
2612    const ids = existingDescribedBy ? existingDescribedBy.split(/\s+/).filter(Boolean) : [];
2613    if (!ids.includes(this.id)) {
2614      ids.push(this.id);
2615    }
2616    this.triggerEl.setAttribute("aria-describedby", ids.join(" "));
2617    const element = this.triggerEl;
2618    const tooltipId = this.id;
2619    this.unsubscribeFn = () => {
2620      element.removeEventListener("mouseover", this.handleTriggerMouseover);
2621      element.removeEventListener("mouseleave", this.handleTriggerMouseleave);
2622      element.removeEventListener("focus", this.handleTriggerFocus);
2623      element.removeEventListener("blur", this.handleTriggerBlur);
2624      element.removeEventListener("keydown", this.handleTriggerKeydown);
2625      const currentDescribedBy = element.getAttribute("aria-describedby");
2626      if (currentDescribedBy) {
2627        const remaining = currentDescribedBy.split(/\s+/).filter((id) => id && id !== tooltipId).join(" ");
2628        if (remaining) {
2629          element.setAttribute("aria-describedby", remaining);
2630        } else {
2631          element.removeAttribute("aria-describedby");
2632        }
2633      }
2634    };
2635  }
2636  isOpenChanged(_, next) {
2637    if (!this.$fastController.isConnected || this.hidden || !this.triggerEl) {
2638      return;
2639    }
2640    if (next && this.hidden) {
2641      this.isOpen = false;
2642    }
2643    if (next) {
2644      if (this.delay) {
2645        this.timeoutId = setTimeout(() => {
2646          this.openTooltip();
2647        }, this.delay);
2648      } else {
2649        this.openTooltip();
2650      }
2651    } else {
2652      this.closeTooltip();
2653    }
2654  }
2655  widthChanged(_, next) {
2656    if (this.isConnected && next > MIN_WIDTH) {
2657      this.style.setProperty("--tooltip-width", `${next.toString()}px`);
2658      if (this.dataset.displayed === "true") {
2659        this.positionTooltip();
2660      }
2661    }
2662  }
2663  maxWidthChanged(_, next) {
2664    if (this.isConnected && next) {
2665      this.style.setProperty("--tooltip-max-width", `${next.toString()}px`);
2666      if (this.dataset.displayed === "true") {
2667        this.positionTooltip();
2668      }
2669    }
2670  }
2671  minWidthChanged(_, next) {
2672    if (this.isConnected && next) {
2673      this.style.setProperty("--tooltip-min-width", `${next.toString()}px`);
2674      if (this.dataset.displayed === "true") {
2675        this.positionTooltip();
2676      }
2677    }
2678  }
2679  zIndexChanged(_, next) {
2680    if (this.isConnected && next !== void 0) {
2681      this.style.setProperty("--tooltip-z-index", next.toString());
2682    }
2683  }
2684  connectedCallback() {
2685    super.connectedCallback();
2686    if (!this.id) {
2687      this.id = uniqueId("tooltip-");
2688    }
2689    if (!this.isNativePopoverSupported()) {
2690      this.setAttribute("data-not-native", "true");
2691    }
2692    if (!this.triggerEl && this.triggerId) {
2693      this.configureTriggerElement(this.triggerId);
2694    }
2695    if (this.maxWidth !== MAX_WIDTH) {
2696      this.style.setProperty("--tooltip-max-width", `${this.maxWidth.toString()}px`);
2697    }
2698    if (this.minWidth !== MIN_WIDTH) {
2699      this.style.setProperty("--tooltip-min-width", `${this.minWidth.toString()}px`);
2700    }
2701    if (this.width !== void 0 && this.width > MIN_WIDTH) {
2702      this.style.setProperty("--tooltip-width", `${this.width.toString()}px`);
2703    }
2704    if (this.zIndex !== void 0) {
2705      this.style.setProperty("--tooltip-z-index", this.zIndex.toString());
2706    }
2707  }
2708  disconnectedCallback() {
2709    var _a, _b;
2710    super.disconnectedCallback();
2711    (_a = this.cleanupFn) == null ? void 0 : _a.call(this);
2712    this.unsubscribeFn();
2713    (_b = this.cancelPendingTriggerObservation) == null ? void 0 : _b.call(this);
2714    this.cancelPendingTriggerObservation = void 0;
2715    this.triggerEl = null;
2716    document.removeEventListener("mousemove", this.handleDocumentMousemove);
2717    document.removeEventListener("scroll", this.handleDocumentScroll, true);
2718  }
2719  checkMousePositionAndClose(x2, y) {
2720    const contentPosition = this.dataset.renderedPosition ?? this.position;
2721    const position = contentPosition == null ? void 0 : contentPosition.split("-")[0];
2722    const additionalOffsetX = convertStylePropertyPixelsToNumber(this.style, "--additional-offset-x") ?? 0;
2723    const additionalOffsetY = convertStylePropertyPixelsToNumber(this.style, "--additional-offset-y") ?? 0;
2724    const offsetX = Number.isNaN(additionalOffsetX) ? 0 : additionalOffsetX;
2725    const offsetY = Number.isNaN(additionalOffsetY) ? 0 : additionalOffsetY;
2726    const offset = position === "top" || position === "bottom" ? TRIGGER_MOUSE_MOVE_OFFSET + offsetY : TRIGGER_MOUSE_MOVE_OFFSET + offsetX;
2727    if (!this.triggerEl)
2728      return;
2729    const triggerBounds = inflateRectInDirection(this.triggerEl.getBoundingClientRect(), offset, position);
2730    if (!(isPointOverRect(triggerBounds, { x: x2, y }) || isPointOverRect(this.contentEl.getBoundingClientRect(), { x: x2, y }))) {
2731      this.isOpen = false;
2732    }
2733  }
2734  isTriggerElementVisible() {
2735    if (!this.triggerEl) {
2736      return false;
2737    }
2738    const rect = this.triggerEl.getBoundingClientRect();
2739    const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
2740    const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
2741    return rect.top >= 0 && rect.left >= 0 && rect.bottom <= viewportHeight && rect.right <= viewportWidth;
2742  }
2743  openTooltip() {
2744    if (this.isConnected) {
2745      this.isNativePopoverSupported() && this.togglePopover();
2746      this.positionTooltip();
2747      document.addEventListener("mousemove", this.handleDocumentMousemove);
2748      document.addEventListener("scroll", this.handleDocumentScroll, true);
2749      this.setAttribute("data-displayed", "true");
2750    }
2751  }
2752  closeTooltip() {
2753    var _a;
2754    if (this.timeoutId) {
2755      clearTimeout(this.timeoutId);
2756      this.timeoutId = void 0;
2757    }
2758    (_a = this.cleanupFn) == null ? void 0 : _a.call(this);
2759    if (this.isConnected) {
2760      this.isNativePopoverSupported() && this.hidePopover();
2761    }
2762    document.removeEventListener("mousemove", this.handleDocumentMousemove);
2763    document.removeEventListener("scroll", this.handleDocumentScroll, true);
2764    this.lastMousePosition = null;
2765    this.removeAttribute("data-displayed");
2766  }
2767  isNativePopoverSupported() {
2768    return "showPopover" in this;
2769  }
2770  positionTooltip() {
2771    var _a;
2772    (_a = this.cleanupFn) == null ? void 0 : _a.call(this);
2773    if (this.triggerEl) {
2774      calculateTooltipPosition(this, this, this.triggerEl, this.arrowEl).then((cleanup) => {
2775        if (!this.isConnected) {
2776          cleanup == null ? void 0 : cleanup();
2777          return;
2778        }
2779        this.cleanupFn = cleanup;
2780      });
2781    }
2782  }
2783}
2784__decorate$1([
2785  attr()
2786], TooltipComponent.prototype, "position", void 0);
2787__decorate$1([
2788  attr({ mode: "boolean" })
2789], TooltipComponent.prototype, "inverted", void 0);
2790__decorate$1([
2791  attr({ converter: nullableNumberConverter })
2792], TooltipComponent.prototype, "width", void 0);
2793__decorate$1([
2794  attr({ attribute: "min-width", converter: nullableNumberConverter })
2795], TooltipComponent.prototype, "minWidth", void 0);
2796__decorate$1([
2797  attr({ attribute: "max-width", converter: nullableNumberConverter })
2798], TooltipComponent.prototype, "maxWidth", void 0);
2799__decorate$1([
2800  attr({ attribute: "trigger-on" })
2801], TooltipComponent.prototype, "triggerOn", void 0);
2802__decorate$1([
2803  attr({ attribute: "z-index", converter: nullableNumberConverter })
2804], TooltipComponent.prototype, "zIndex", void 0);
2805__decorate$1([
2806  attr({ converter: nullableNumberConverter })
2807], TooltipComponent.prototype, "delay", void 0);
2808__decorate$1([
2809  attr({ mode: "boolean" })
2810], TooltipComponent.prototype, "hidden", void 0);
2811__decorate$1([
2812  attr({ attribute: "popover" })
2813], TooltipComponent.prototype, "popover", void 0);
2814__decorate$1([
2815  attr({ attribute: "trigger-id" })
2816], TooltipComponent.prototype, "triggerId", void 0);
2817__decorate$1([
2818  attr({ mode: "boolean", attribute: "is-open" })
2819], TooltipComponent.prototype, "isOpen", void 0);
2820__decorate$1([
2821  observable
2822], TooltipComponent.prototype, "contentEl", void 0);
2823__decorate$1([
2824  observable
2825], TooltipComponent.prototype, "arrowEl", void 0);
2826const styles$1 = `:host{background-color:var(--goto-interactive-color-disabled);height:var(--goto-skeleton-size,1.875rem);display:inline-flex;position:relative;overflow:hidden}:host:after{animation:skeleton-wave var(--goto-duration-sluggish)var(--goto-standard-easing).5s infinite;background:linear-gradient(90deg,var(--goto-gradient-color-skeleton));content:"";width:100%;position:absolute;inset:0}@keyframes skeleton-wave{0%{transform:translate(-100%)}to{transform:translate(100%)}}:host([size=xxsmall]){--goto-skeleton-size:1.125rem}:host([size=xsmall]){--goto-skeleton-size:var(--goto-spacing-05)}
2826:host([size=small]){--goto-skeleton-size:var(--goto-spacing-06)}:host([size=large]){--goto-skeleton-size:2.25rem}:host([size=xlarge]){--goto-skeleton-size:var(--goto-spacing-09)}:host([size=xxlarge]){--goto-skeleton-size:var(--goto-spacing-11)}:host([size=xxxlarge]){--goto-skeleton-size:5rem}:host([variant=square]),:host([variant=rectangle]){border-radius:var(--goto-radius-small)}:host([variant=square]),:host([variant=circle]){width:var(--goto-skeleton-size,1.875rem)}:host([variant=circle]){border-radius:50%}:host([variant=rectangle]){min-width:var(--goto-skeleton-size,1.875rem)}`;
2827class SkeletonComponent extends ChameleonLitElement {
2828  constructor() {
2829    super(...arguments);
2830    this.variant = "square";
2831    this.width = null;
2832  }
2833  computedWidth() {
2834    const defaultWidth = this.width ?? "100%";
2835    return this.width && Number.isInteger(Number(this.width)) ? `${this.width}px` : String(defaultWidth);
2836  }
2837  render() {
2838    if (this.variant === "rectangle") {
2839      this.style.width = this.computedWidth();
2840    } else {
2841      this.style.width = "";
2842    }
2843    return x``;
2844  }
2845}
2846SkeletonComponent.baseName = "skeleton";
2847SkeletonComponent.styles = r(styles$1);
2848__decorate$1([
2849  n({ reflect: true })
2850], SkeletonComponent.prototype, "variant", void 0);
2851__decorate$1([
2852  n({ reflect: true })
2853], SkeletonComponent.prototype, "size", void 0);
2854__decorate$1([
2855  n()
2856], SkeletonComponent.prototype, "width", void 0);
2857const styles = `:host{--arrow-size:10px;--element-padding:10px;--tooltip-width:max-content;--tooltip-max-width:max-content;--tooltip-min-width:min-content;----tooltip-z-index:unset;font:var(--goto-caption-medium);padding:var(--element-padding);margin:var(--goto-spacing-00);top:var(--trigger-y);left:var(--trigger-x);width:var(--tooltip-width,max-content);max-width:var(--tooltip-max-width,max-content);min-width:var(--tooltip-min-width,min-content);z-index:var(--tooltip-z-index,unset);background-color:#0000;border:none;position:fixed}:host .title>::slotted(*){background-color:var(--goto-surface-color-tertiary);border-radius:var(--goto-radius-small);padding:var(--goto-spacing-00)var(--goto-spacing-01);margin-bottom:var(--goto-spacing-01);display:block}:host .body{padding:var(--goto-spacing-00)var(--goto-spacing-01);display:block}:host .content{padding:var(--goto-spacing-01)var(--goto-spacing-01);border-radius:var(--goto-radius-medium);color:var(--goto-type-color-inverted);background-color:var(--goto-surface-color-inverted);white-space:normal}:host .arrow{box-sizing:border-box;content:"";top:var(--goto-spacing-00);left:var(--goto-spacing-00);transform:translate(var(--arrow-offset-x),var(--arrow-offset-y))rotate(var(--arrow-rotation));width:var(--arrow-size);height:var(--arrow-size);border-right:inherit;border-bottom:inherit;box-shadow:var(--arrow-shadow);background-color:var(--goto-surface-color-inverted);z-index:-1;border-bottom-right-radius:2px;position:absolute}:host ::slotted(chameleon-typography){--goto-type-color-default:var(--goto-type-color-inverted)}:host([data-not-native]){display:none}:host([data-not-native][data-displayed]){display:block}:host([data-rendered-position^=top-]){--arrow-offset-y:calc(var(--content-height) - var(--element-padding) - var(--arrow-size)/2);--arrow-rotation:45deg;--arrow-shadow:#0000001f 4px 4px 4px -2px,#00000014 2px 2px 2px 0}:host([data-rendered-position^=bottom-]) .arrow{--arrow-offset-y:calc(var(--arrow-size)/2);--arrow-rotation:calc(-45deg - 90deg);--arrow-shadow:#0000000a 1px 1px 2px 0}:host([data-rendered-position^=right-]) .arrow{--arrow-rotation:calc(45deg + 90deg);--arrow-offset-x:5px;--arrow-shadow:#0000001f 2px 2px 2px 0}:host([data-rendered-position^=left-]) .arrow{--arrow-rotation:calc(45deg + 90deg + 180deg);--arrow-offset-x:calc(var(--content-width) - var(--element-padding) - calc(var(--arrow-size)/2));--arrow-shadow:#0000001f 2px 2px 2px 0}:host([data-rendered-position=top-start]),:host([data-rendered-position=bottom-start]){--arrow-offset-x:min(calc(var(--content-width)/2 - var(--arrow-size)/2),calc(var(--element-padding) + var(--trigger-width)/2 - var(--arrow-size)/2));left:calc(var(--trigger-x) - var(--element-padding))}:host([data-rendered-position=top-end]),:host([data-rendered-position=bottom-end]){--arrow-offset-x:max(calc(var(--content-width)/2 - var(--arrow-size)/2),calc(var(--content-width) - var(--element-padding) - var(--trigger-width)/2 - var(--arrow-size)/2));left:calc(var(--trigger-x) + var(--element-padding))}:host([data-rendered-position=top-center]) .arrow,:host([data-rendered-position=bottom-center]) .arrow{--arrow-offset-x:calc(var(--content-width)/2 - var(--arrow-size)/2)}:host([data-rendered-position=right-start]),:host([data-rendered-position=left-start]){--arrow-offset-y:calc(var(--trigger-height)/2 + var(--element-padding) - var(--arrow-size)/2);top:calc(var(--trigger-y) - var(--element-padding))}:host([data-rendered-position=right-center]),:host([data-rendered-position=left-center]){--arrow-offset-y:calc(var(--content-height)/2 - var(--arrow-size)/2)}:host([data-rendered-position=right-end]),:host([data-rendered-position=left-end]){--arrow-offset-y:calc(var(--content-height) - var(--element-padding) - var(--trigger-height)/2 - var(--arrow-size)/2);top:calc(var(--trigger-y) + var(--element-padding))}`;
2858const tooltipDefinition = {
2859  baseName: "tooltip",
2860  styles: css`
2861    ${styles}
2862  `,
2863  template: tooltipTemplate
2864};
2865const chameleonTooltip = TooltipComponent.compose(tooltipDefinition);
2866const menuItemTemplate = (context, definition) => {
2867  return html`
2868    <template
2869        role="${(x2) => x2.role}"
2870        aria-haspopup="${(x2) => x2.hasSubmenu ? "menu" : void 0}"
2871        aria-checked="${(x2) => x2.role === "menuitemradio" ? !!x2.checked : void 0}"
2872        aria-disabled="${(x2) => x2.disabled}"
2873        aria-expanded="${(x2) => x2.expanded}"
2874        @keydown="${(x2, c) => x2.handleMenuItemKeyDown(c.event)}"
2875        @click="${(x2, c) => x2.handleMenuItemClick(c.event)}"
2876        @mouseover="${(x2, c) => x2.handleMouseOver(c.event)}"
2877        @mouseout="${(x2, c) => x2.handleMouseOut(c.event)}"
2878        class="${(x2) => x2.disabled ? "disabled" : ""} ${(x2) => x2.expanded ? "expanded" : ""} ${(x2) => `indent-${x2.startColumnCount}`}"
2879    >
2880            ${when((x2) => x2.role === "menuitemcheckbox", html`
2881                    <div part="input-container" class="input-container">
2882                        <span part="checkbox" class="checkbox">
2883                            <slot name="checkbox-indicator">
2884                                ${definition.checkboxIndicator || ""}
2885                            </slot>
2886                        </span>
2887                    </div>
2888                `)}
2889            ${when((x2) => x2.role === "menuitemradio", html`
2890                    <div part="input-container" class="input-container">
2891                        <span part="radio" class="radio">
2892                            <slot name="radio-indicator">
2893                                ${definition.radioIndicator || ""}
2894                            </slot>
2895                        </span>
2896                    </div>
2897                `)}
2898        </div>
2899        ${startSlotTemplate(context, definition)}
2900        <span class="content" part="content">
2901            <slot></slot>
2902        </span>
2903        ${endSlotTemplate(context, definition)}
2904        ${when((x2) => x2.hasSubmenu, html`
2905            <div
2906              part="expand-collapse-glyph-container"
2907              class="expand-collapse-glyph-container"
2908            >
2909              <span part="expand-collapse" class="expand-collapse">
2910                <slot name="expand-collapse-indicator">
2911                  ${definition.expandCollapseGlyph || ""}
2912                </slot>
2913              </span>
2914            </div>
2915          `)}
2916        ${when((x2) => x2.expanded, html`
2917            <div
2918              class="submenu-region"
2919              part="submenu-region"
2920              dir="${(x2) => x2.currentDirection}"
2921            >
2922              <slot name="submenu"></slot>
2923            </div>
2924          `)}
2925    </template>
2926`;
2927};
2928function registerSkeleton(options = {}) {
2929  registerLitElement(SkeletonComponent, options);
2930}
2931registerSkeleton();
2932function registerCustom(prefix, node) {
2933  return registerFASTElements({ prefix, node }, chameleonTooltip);
2934}
2935registerCustom();
2936export {
2937  autoUpdate as A,
2938  computePosition as B,
2939  flip as C,
2940  SkeletonComponent as D,
2941  registerSkeleton as E,
2942  elements as F,
2943  traverseShadowRootsForElementWithId as G,
2944  observeForElementWithId as H,
2945  shift as I,
2946  size as J,
2947  calculateFallbackPlacements as K,
2948  findClosestThemeProvider as L,
2949  Menu as M,
2950  chameleonTooltip as N,
2951  StartEnd as S,
2952  TooltipComponent as T,
2953  MenuItem as a,
2954  menuItemTemplate as b,
2955  keyEscape as c,
2956  keyEnter as d,
2957  keyEnd as e,
2958  keyHome as f,
2959  keySpace as g,
2960  keyArrowDown as h,
2961  keyArrowUp as i,
2962  applyMixins as j,
2963  keyTab as k,
2964  findParent as l,
2965  menuTemplate as m,
2966  findChild as n,
2967  slotted as o,
2968  startSlotTemplate as p,
2969  endSlotTemplate as q,
2970  css as r,
2971  svg as s,
2972  svg$1 as t,
2973  uniqueId as u,
2974  svg$2 as v,
2975  withStylePrefix as w,
2976  isHTMLElement$1 as x,
2977  startSlotTemplate$1 as y,
2978  endSlotTemplate$1 as z
2979};
2980//# sourceMappingURL=register-static-chunk.CSSMguta.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.