import { r as a, c as i, h as o, H as s, g as r } from "./index.e6beb8d9.js";
import "react";
import "react-dom";
const c = () => ":host{display:block}:host *{box-sizing:border-box}::slotted(*:last-child){border-bottom:0.0625rem solid var(--s-border-default)}", l = 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: "c8f85db59dcda24375ace62c3e8434fdf5f7df09" }, o("slot", { key: "1485d2b4c9a84ca1ef72fedba07eccbee956af2c" }));
  }
  get el() {
    return r(this);
  }
};
l.style = c();
export {
  l as swirl_accordion
};
