import { r as a, c as i, h as o, H as s, g as r } from "./index.61732cef.js";
import "react";
import "react-dom";
const l = () => ":host{display:block}:host *{box-sizing:border-box}::slotted(*:last-child){border-bottom:0.0625rem solid var(--s-border-default)}", c = class {
  constructor(t) {
    a(this, t), this.expandedItemChange = i(this, "expandedItemChange", 7), this.multiExpand = !1, this.componentLoaded = !1, this.onExpansionChange = (e) => {
      e.detail && (this.expandedItemChange.emit(e.target.itemId), this.collapseInactiveItems(e.target));
    };
  }
  connectedCallback() {
    this.componentLoaded && this.el.addEventListener("expansionChange", this.onExpansionChange);
  }
  componentDidLoad() {
    this.el.addEventListener("expansionChange", this.onExpansionChange), this.componentLoaded = !0;
  }
  disconnectedCallback() {
    this.el.removeEventListener("expansionChange", this.onExpansionChange);
  }
  async collapseItem(t) {
    const e = Array.from(this.el.querySelectorAll("swirl-accordion-item")).find((n) => n.itemId === t);
    !Boolean(e) || e.collapse();
  }
  async expandItem(t) {
    const e = Array.from(this.el.querySelectorAll("swirl-accordion-item")).find((n) => n.itemId === t);
    !Boolean(e) || e.expand();
  }
  collapseInactiveItems(t) {
    this.multiExpand || Array.from(this.el.querySelectorAll("swirl-accordion-item")).forEach((e) => {
      e !== t && e.collapse();
    });
  }
  render() {
    return o(s, { key: "380395f009a7fa44a47494bf0fa6aa4b36c24b74" }, o("slot", { key: "0ce853754c9ec49e121cc3d07edfa860944f0909" }));
  }
  get el() {
    return r(this);
  }
};
c.style = l();
export {
  c as swirl_accordion
};
