/*!
 * EdGEL: The University of Edinburgh Design System v5.0.0 (https://design-system.ed.ac.uk/)
 * Copyright 2014-2023 The University of Edinburgh
 *
 * Bootstrap  v5.3.2 (https://getbootstrap.com/)
 * Copyright 2011-2023 The Bootstrap Authors
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
 */
import{w as t,_ as e,E as s,x as o}from"./base-2Isyko0t.js";import{C as i}from"./collapse-Fp-mMCqS.js";
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const l=1;class n{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const a=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends n{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((e=>t[e])).join(" ")+" "}update(e,[s]){if(void 0===this.it){this.it=new Set,void 0!==e.strings&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!this.st?.has(t)&&this.it.add(t);return this.render(s)}const o=e.element.classList;for(const t of this.it)t in s||(o.remove(t),this.it.delete(t));for(const t in s){const e=!!s[t];e===this.it.has(t)||this.st?.has(t)||(e?(o.add(t),this.it.add(t)):(o.remove(t),this.it.delete(t)))}return t}});let r,c=t=>t;const h="show";class d extends s{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 e={toggle:!1};this.parent&&(e.parent=this.parent),this.collapseElement=i.getOrCreateInstance(t,e)}}toggleCollapse(t){t.stopPropagation(),this.expanded=!this.expanded,this.collapseElement&&(this.expanded?this.collapseElement.show():this.collapseElement.hide())}buttonHtml(t,e){let s="btn btn-hamburger";return e&&(s=`${s} ${e}`),o(r||(r=c`
      <button
        type="button"
        class=${0}
        aria-expanded=${0}
        aria-controls=${0}
        @click=${0}
      >
        ${0}
      </button>
    `),s,this.expanded,this.controls,this.toggleCollapse,t)}}e(d,"properties",{expanded:{type:Boolean,reflect:!0,attribute:"expanded"},controls:{type:String,attribute:!1}});export{d as E,a as e};
