import{p as e,H as s,c as i,h as t,a}from"./index.js";import{g as c,b as o}from"./p-DKo9A5gq.js";import{c as d}from"./p-vN03FcXN.js";import{a as n}from"./p-Nvj7WFs_.js";import{c as r}from"./p-DrPpH_9c.js";import{d as l}from"./p-CQvUntGY.js";import{d as h}from"./p-BJnSrRNH.js";var b;(function(e){e["HORIZONTAL"]="horizontal";e["VERTICAL"]="vertical"})(b||(b={}));const f={root:"gov-card",header:"gov-card__header",arrow:"gov-card__arrow",inner:"gov-card__inner",img:"gov-card__img",icon:"gov-card__icon",content:"gov-card__content",footer:"gov-card__footer"};var m;(function(e){e["A"]="a";e["DIV"]="div"})(m||(m={}));const v=e(class e extends s{constructor(){super();this.__registerHost();this.govToggle=i(this,"gov-toggle");this.hydrated=false;this.direction="vertical";this.collapsible=false;this.clickable=false;this.open=true;this.h=c(this.host);this.headlineId=d("GovCardHeadline");this.contentId=d("GovCardContent")}async componentDidRender(){if(r()){await l(500);await this.validateAccessibility()}}connectedCallback(){this.hydrated=true}render(){const e=this.href?m.A:m.DIV;return t(a,{key:"cdfd3d0c4298a3bf933073c558dad83f3765b6c2",class:this.h.classes(f.root),open:this.open,collapsible:o(this.collapsible),clickable:this.clickable,direction:this.direction,hydrated:this.hydrated},this.collapsible?t("button",{id:this.headlineId,class:f.header,"aria-label":this.accessibleTriggerLabel,"aria-labelledby":this.accessibleTriggerLabelledBy,"aria-expanded":o(this.open),"aria-controls":this.contentId,onClick:this.onClickHandler.bind(this)},t("slot",{name:"headline"}),t("gov-icon",{class:f.arrow,name:"chevron-down",type:"components"})):this.h.hasSlot("headline")?t("div",{class:f.header},t("slot",{name:"headline"})):null,t(e,{key:"6bb81b9dd553397f508a8042316fd09579154461",href:this.href,target:this.target,id:this.contentId,"aria-hidden":this.collapsible?o(!this.open):undefined,hidden:this.collapsible?!this.open:undefined,"aria-labelledby":this.collapsible?this.headlineId:undefined,class:f.inner},this.h.hasSlot("img")&&t("div",{key:"740547f9bc6e9be839cbf8edc44faddb6aaa5246",class:f.img},t("slot",{key:"abb25299c0f9b0b4ac1a4826648dd7a774894514",name:"img"})),this.h.hasSlot("icon")&&t("div",{key:"c768f9fd3f3ac79f907dd26601c109265d6d903d",class:f.icon},t("slot",{key:"8cf8ffde300503c874e32644d6c4111e6b608e36",name:"icon"})),t("div",{key:"1e3218226ffc179f0afb0da94c48a939b248c311",class:f.content},t("slot",{key:"2a0ac8f1ecd6a83537bfb2da85d06c9d9b3f2706"})),this.h.hasSlot("footer")&&t("div",{key:"04b7f39f60eab3db295b82072d1b06648d687b0b",class:f.footer},t("slot",{key:"4ec8ee6bf3b4ec9a02b30d5d2dc6b2fab6bb5065",name:"footer"}))))}onClickHandler(e){e.stopPropagation();if(this.collapsible){this.open=!this.open;this.govToggle.emit({open:this.open,element:this.host})}}async validateAccessibility(){if(this.collapsible){n(this.accessibleTriggerLabel,this.accessibleTriggerLabelledBy,f.root,this.host)}}get host(){return this}},[4,"gov-card",{direction:[1],collapsible:[4],clickable:[4],open:[1540],href:[513],target:[1],accessibleTriggerLabel:[1,"accessible-label"],accessibleTriggerLabelledBy:[1,"accessible-labelledby"],validateAccessibility:[64]}]);function g(){if(typeof customElements==="undefined"){return}const e=["gov-card","gov-icon"];e.forEach((e=>{switch(e){case"gov-card":if(!customElements.get(e)){customElements.define(e,v)}break;case"gov-icon":if(!customElements.get(e)){h()}break}}))}g();const p=v;const y=g;export{p as GovCard,y as defineCustomElement};
//# sourceMappingURL=gov-card.js.map