import{p as t,H as s,h as e,a as i}from"./index.js";import{p as o}from"./p-CQvUntGY.js";import{S as a}from"./p-BcQO4NH2.js";import{g as n,b as c}from"./p-DKo9A5gq.js";import{v as l}from"./p-BKP-F1qP.js";import{A as r,a as d,i as h}from"./p-CXgom82_.js";import{c as p}from"./p-vN03FcXN.js";import{d as b}from"./p-CWqMiVYH.js";import{d as f}from"./p-BJnSrRNH.js";const m=o(a,["_XS","_S","_M","_L","_XL"]);var v;(function(t){t["DOWN"]="down";t["UP"]="up"})(v||(v={}));const u={root:"gov-collapsible",content:"gov-collapsible__content",disabled:"gov-collapsible--disabled"};const g=t(class t extends s{constructor(){super();this.__registerHost();this.hydrated=false;this.size="m";this.disabled=false;this.open=false;this.inheritedAttributes={};this.h=n(this.host);this.triggerId=p("GovCollapsibleControl");this.contentId=p("GovCollapsibleContent")}validateSize(t){l(m,t,u.root)}componentDidLoad(){this.attributeObserver=new r(this.host,((t,s)=>{this.onAriaAttributeChange(t,s)}));this.attributeObserver.startObserving(d)}componentWillLoad(){this.validateSize(this.size);this.inheritedAttributes=h(this.host)}onAriaAttributeChange(t,s){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:s})}disconnectedCallback(){var t;(t=this.attributeObserver)===null||t===void 0?void 0:t.stopObserving()}connectedCallback(){this.hydrated=true}render(){return e(i,{key:"3c9284a4fdbf445f402693b15c5269c8e5b98372",hydrated:this.hydrated,class:this.h.classes([u.root,this.disabled&&u.disabled]),size:this.size},e("gov-button",Object.assign({key:"db793476b0b8ed5ecc44dd2191b3cf26c0a97e86",color:"primary",size:this.size,type:"link",disabled:this.disabled,"onGov-click":t=>{t.stopPropagation();t.preventDefault();this.open=!this.open}},this.inheritedAttributes,{identifier:this.triggerId,"aria-controls":this.contentId,"aria-expanded":c(this.open),"aria-haspopup":"true"}),this.label,e("gov-icon",{key:"c230a7d2553c0858ddf24c6f9c7afbc249cd7f8e",slot:"icon-end",name:this.open?"chevron-up":"chevron-down",type:"components"})),e("div",{key:"64e787e14f8773dae11f0e54658984f3622b8b47",class:u.content,hidden:!this.open,id:this.contentId,"aria-labelledby":this.triggerId,"aria-hidden":c(!this.open)},e("slot",{key:"1e09e5a7242946af30012b68beb38119865003ec"})))}get host(){return this}static get watchers(){return{size:["validateSize"]}}},[4,"gov-collapsible",{size:[1],identifier:[1],label:[1],disabled:[4],open:[1028],inheritedAttributes:[32]},undefined,{size:["validateSize"]}]);function j(){if(typeof customElements==="undefined"){return}const t=["gov-collapsible","gov-button","gov-icon"];t.forEach((t=>{switch(t){case"gov-collapsible":if(!customElements.get(t)){customElements.define(t,g)}break;case"gov-button":if(!customElements.get(t)){b()}break;case"gov-icon":if(!customElements.get(t)){f()}break}}))}j();const k=g;const y=j;export{k as GovCollapsible,y as defineCustomElement};
//# sourceMappingURL=gov-collapsible.js.map