import { p as proxyCustomElement, H, h } from './index.js';
import { i as isNestedInIfxComponent, d as detectFramework, t as trackComponent } from './p-bqYaVeZb.js';

const accordionCss = ":root{--ifx-font-family:\"Source Sans 3\", 'Arial, sans-serif'}:host{display:block}.accordion-wrapper{display:flex;flex-direction:column;gap:8px;font-family:var(--ifx-font-family)}";

const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        this.autoCollapse = false;
    }
    async componentDidLoad() {
        if (!isNestedInIfxComponent(this.el)) {
            const framework = detectFramework();
            trackComponent('ifx-accordion', await framework);
        }
    }
    async onItemOpen(event) {
        if (this.autoCollapse) {
            const items = Array.from(this.el.querySelectorAll('ifx-accordion-item'));
            for (const item of items) {
                const itemElement = item;
                if (itemElement !== event.target && (await itemElement.open)) {
                    itemElement.open = false;
                }
            }
        }
    }
    render() {
        return (h("div", { key: '903cc44b4886b77e59e66ab2a5cdf681dafeb9bc', class: "accordion-wrapper" }, h("slot", { key: 'e0abec42188606e8c80fc3db44fba19a7aa69ed8' })));
    }
    static get delegatesFocus() { return true; }
    get el() { return this; }
    static get style() { return accordionCss; }
}, [273, "ifx-accordion", {
        "autoCollapse": [4, "auto-collapse"]
    }, [[0, "ifxOpen", "onItemOpen"]]]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["ifx-accordion"];
    components.forEach(tagName => { switch (tagName) {
        case "ifx-accordion":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, Accordion);
            }
            break;
    } });
}

export { Accordion as A, defineCustomElement as d };
//# sourceMappingURL=p-D9skJwQF.js.map

//# sourceMappingURL=p-D9skJwQF.js.map