import{mediaQueryLarge,isMobileBreakpoint}from"@theme/utilities";class AccordionCustom extends HTMLElement{get details(){const details=this.querySelector("details");if(!(details instanceof HTMLDetailsElement))throw new Error("Details element not found");return details}get summary(){const summary=this.details.querySelector("summary");if(!(summary instanceof HTMLElement))throw new Error("Summary element not found");return summary}get#disableOnMobile(){return this.dataset.disableOnMobile==="true"}get#disableOnDesktop(){return this.dataset.disableOnDesktop==="true"}get#closeWithEscape(){return this.dataset.closeWithEscape==="true"}#controller=new AbortController;connectedCallback(){const{signal}=this.#controller;this.#setDefaultOpenState(),this.addEventListener("keydown",this.#handleKeyDown,{signal}),this.summary.addEventListener("click",this.handleClick,{signal}),mediaQueryLarge.addEventListener("change",this.#handleMediaQueryChange,{signal})}disconnectedCallback(){this.#controller.abort()}handleClick=event=>{const isMobile=isMobileBreakpoint(),isDesktop=!isMobile;if(isMobile&&this.#disableOnMobile||isDesktop&&this.#disableOnDesktop){event.preventDefault();return}};#handleMediaQueryChange=()=>{this.#setDefaultOpenState()};#setDefaultOpenState(){const isMobile=isMobileBreakpoint();this.details.open=isMobile&&this.hasAttribute("open-by-default-on-mobile")||!isMobile&&this.hasAttribute("open-by-default-on-desktop")}#handleKeyDown(event){event.key==="Escape"&&this.#closeWithEscape&&(event.preventDefault(),this.details.open=!1,this.summary.focus())}}customElements.get("accordion-custom")||customElements.define("accordion-custom",AccordionCustom);
//# sourceMappingURL=/s/files/1/0677/1399/0759/t/1/assets/accordion-custom.js.map?v=1783128442
