import{p as s,H as e,h as t,a as i}from"./index.js";import{g as o,i as r}from"./p-9imLQpxb.js";import{g as a}from"./p-DKo9A5gq.js";import{s as n}from"./p-vN03FcXN.js";import{i as f}from"./p-B3tdsiZv.js";const c=s(class s extends e{constructor(){super();this.__registerHost();this.invalid=false;this.disabled=false;this.success=false;this.fieldset=false;this.size="m";this.h=a(this.host);this.f=o(this.h)}componentDidRender(){this.syncControlMessages();this.formElementDescriptionControl()}disconnectedCallback(){var s;(s=this.observer)===null||s===void 0?void 0:s.disconnect()}formElementDescriptionControl(){const s=this.host.querySelector("."+r.bottom);if(!s)return;this.observer=new MutationObserver(function(){this.syncControlMessages()}.bind(this));this.observer.observe(s,{childList:true})}syncControlMessages(){Promise.all(this.f.messageElements.map((s=>s.identifier()))).then((s=>{this.f.mainElementsInControl.forEach((e=>{const t=n(e.getAttribute("aria-describedby"));e.removeAttribute("aria-describedby");if(Array.isArray(t)){t.forEach((e=>f(e)&&e.indexOf("GovFormMessage")===-1?s.push(e):null))}if(s.length){e.setAttribute("aria-describedby",s.join(" "))}}))}))}render(){const s=this.fieldset?"fieldset":"div";return t(i,{key:"04e4ab3533f5d22939573fa20a354a0b76319986",size:this.size,class:this.h.classes(r.root)},t(s,{key:"9851627baf138775fe24a673d6a095fc8980b6e9",class:r.holder},this.h.hasSlot("top")&&t("slot",{key:"beffe147db943648861b9775dee76ef6b20dffa3",name:"top"}),t("slot",{key:"6667b41d2720045a93b10a92ef300e2842ff57b4"}),this.h.hasSlot("bottom")&&t("div",{key:"fe117fdc7d64b3c2b4e18e95d1f213c8a8fe3766",class:r.bottom},t("slot",{key:"07eabb48c2849d624bed7f59ba14811ed35732fb",name:"bottom"}))))}get host(){return this}},[4,"gov-form-control",{identifier:[1],invalid:[516],disabled:[516],success:[516],fieldset:[4],size:[1]}]);function d(){if(typeof customElements==="undefined"){return}const s=["gov-form-control"];s.forEach((s=>{switch(s){case"gov-form-control":if(!customElements.get(s)){customElements.define(s,c)}break}}))}d();const b=c;const l=d;export{b as GovFormControl,l as defineCustomElement};
//# sourceMappingURL=gov-form-control.js.map