import{p as o,H as r,c as a,h as g,a as t}from"./index.js";import{c as i,F as e,a as p,b as l}from"./p-BUmDydor.js";import{g as n}from"./p-DKo9A5gq.js";import{v as m}from"./p-BKP-F1qP.js";import{t as f}from"./p-Cjg0wpDG.js";import{p as s}from"./p-B0hcuYXk.js";const v="gov-form-group,.gov-form-group,gov-form-radio-group,.gov-form-radio-group,gov-form-checkbox-group,.gov-form-checkbox-group{margin-top:0;margin-bottom:0;position:relative;display:flex;width:100%;flex-direction:column;align-items:flex-start}gov-form-group .gov-form-label__label,.gov-form-group .gov-form-label__label,gov-form-radio-group .gov-form-label__label,.gov-form-radio-group .gov-form-label__label,gov-form-checkbox-group .gov-form-label__label,.gov-form-checkbox-group .gov-form-label__label{margin:0}gov-form-group[orientation=horizontal],.gov-form-group[orientation=horizontal],gov-form-radio-group[orientation=horizontal],.gov-form-radio-group[orientation=horizontal],gov-form-checkbox-group[orientation=horizontal],.gov-form-checkbox-group[orientation=horizontal]{flex-direction:row;flex-wrap:wrap}gov-form-group[orientation=horizontal] .gov-form-label__label,.gov-form-group[orientation=horizontal] .gov-form-label__label,gov-form-radio-group[orientation=horizontal] .gov-form-label__label,.gov-form-radio-group[orientation=horizontal] .gov-form-label__label,gov-form-checkbox-group[orientation=horizontal] .gov-form-label__label,.gov-form-checkbox-group[orientation=horizontal] .gov-form-label__label{white-space:nowrap}gov-form-group[gap=xs],.gov-form-group[gap=xs],gov-form-radio-group[gap=xs],.gov-form-radio-group[gap=xs],gov-form-checkbox-group[gap=xs],.gov-form-checkbox-group[gap=xs]{gap:var(--gap, var(--spacing-xs-nudge))}gov-form-group[gap=s],.gov-form-group[gap=s],gov-form-radio-group[gap=s],.gov-form-radio-group[gap=s],gov-form-checkbox-group[gap=s],.gov-form-checkbox-group[gap=s]{gap:var(--gap, var(--spacing-s))}gov-form-group[gap=m],.gov-form-group[gap=m],gov-form-radio-group[gap=m],.gov-form-radio-group[gap=m],gov-form-checkbox-group[gap=m],.gov-form-checkbox-group[gap=m]{gap:var(--gap, var(--spacing-m))}gov-form-group[gap=l],.gov-form-group[gap=l],gov-form-radio-group[gap=l],.gov-form-radio-group[gap=l],gov-form-checkbox-group[gap=l],.gov-form-checkbox-group[gap=l]{gap:var(--gap, var(--spacing-l))}gov-form-group[gap=xl],.gov-form-group[gap=xl],gov-form-radio-group[gap=xl],.gov-form-radio-group[gap=xl],gov-form-checkbox-group[gap=xl],.gov-form-checkbox-group[gap=xl]{gap:var(--gap, var(--spacing-xl))}";const c=o(class o extends r{constructor(){super();this.__registerHost();this.govChange=a(this,"gov-change");this.gap=undefined;this.orientation="vertical";this.value=undefined;this.handleChange=o=>{var r;o.stopPropagation();const a=s(this.value);if(!Array.isArray(a))return;if(o.detail.checked){this.value=[...a,o.detail.value]}else{this.value=(r=a.filter((r=>r!==o.detail.value)))!==null&&r!==void 0?r:[]}this.govChange.emit({value:this.value,component:i.root})};this.h=n(this.host)}validateGap(o){if(o){m(p,o,e.root)}}validateOrientation(o){if(o){m(l,o,e.root)}}componentWillLoad(){this.validateGap(this.gap);this.validateOrientation(this.orientation);this.value=s(this.value)}componentDidRender(){f((()=>this.rerenderComponent()))}rerenderComponent(){this.host.querySelectorAll("gov-form-checkbox").forEach((o=>{if(!o.hasAttribute("listener-attached")){o.addEventListener("gov-change",this.handleChange)}o.setAttribute("listener-attached","true");o.checked=this.value.includes(o.value)}))}render(){return g(t,{key:"cfff4a643c778c0a573b08e6310045b8f0f0764b",gap:this.gap,class:this.h.classes(e.root),value:this.value},g("slot",{key:"6c9f6c553525f61c3aa95c834fd495d4dd6a8346"}))}get host(){return this}static get watchers(){return{gap:["validateGap"],orientation:["validateOrientation"]}}static get style(){return v}},[4,"gov-form-checkbox-group",{gap:[1],orientation:[1],value:[1025]},undefined,{gap:["validateGap"],orientation:["validateOrientation"]}]);function u(){if(typeof customElements==="undefined"){return}const o=["gov-form-checkbox-group"];o.forEach((o=>{switch(o){case"gov-form-checkbox-group":if(!customElements.get(o)){customElements.define(o,c)}break}}))}u();const h=c;const b=u;export{h as GovFormCheckboxGroup,b as defineCustomElement};
//# sourceMappingURL=gov-form-checkbox-group.js.map