/*!
 * EdGEL: The University of Edinburgh Design System v5.1.6-rc.2 (https://design-system.ed.ac.uk/)
 * Copyright 2014-2024 The University of Edinburgh
 *
 * Bootstrap  v5.3.3 (https://getbootstrap.com/)
 * Copyright 2011-2024 The Bootstrap Authors
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 */
import{w as t,_ as s,E as e,x as o}from"./base-D_0WJ-EF.js";import{C as n}from"./collapse-BN3IFvYQ.js";
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const l=1;class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,s,e){this._$Ct=t,this._$AM=s,this._$Ci=e}_$AS(t,s){return this.update(t,s)}update(t,s){return this.render(...s)}}
/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const a=(t=>(...s)=>({_$litDirective$:t,values:s}))(class extends i{constructor(t){if(super(t),t.type!==l||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[e]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const o=s.element.classList;for(const t of this.st)t in e||(o.remove(t),this.st.delete(t));for(const t in e){const s=!!e[t];s===this.st.has(t)||this.nt?.has(t)||(s?(o.add(t),this.st.add(t)):(o.remove(t),this.st.delete(t)))}return t}});let r,c=t=>t;const h="show";class d extends e{constructor(){super(),this.collapseInternal=!0,this.collapseDisabled=!1}disconnectedCallback(){super.disconnectedCallback(),this.collapseElement&&this.collapseElement.dispose()}updated(t){if((t.has("controls")||this.collapseDisabled)&&this.collapseElement&&this.collapseElement.dispose(),!this.collapseDisabled&&(t.has("controls")||!this.collapseElement)){const t=(this.collapseInternal?this.shadowRoot.getRootNode():this.shadowRoot.host.getRootNode()).querySelector(`#${this.controls}`);if(!t)throw new Error(`EdGEL Collapse cannot find element #${this.controls} to control`);t.classList.add("collapse"),this.expanded?t.classList.add(h):t.classList.remove(h);const s={toggle:!1};this.parent&&(s.parent=this.parent),this.collapseElement=n.getOrCreateInstance(t,s)}}toggleCollapse(t){t.stopPropagation(),this.expanded=!this.expanded,this.collapseElement&&(this.expanded?this.collapseElement.show():this.collapseElement.hide())}buttonHtml(t,s){let e="btn btn-hamburger";return s&&(e=`${e} ${s}`),o(r||(r=c`
      <button
        type="button"
        class=${0}
        aria-expanded=${0}
        aria-controls=${0}
        @click=${0}
      >
        ${0}
      </button>
    `),e,this.expanded,this.controls,this.toggleCollapse,t)}}s(d,"properties",{expanded:{type:Boolean,reflect:!0,attribute:"expanded"},controls:{type:String,attribute:!1}});export{d as E,a as e};
