import{c as f,d as p,a7 as C,w as k,X as b,a2 as V,a as g,n as h,aj as P,a9 as G,t as _,aa as O,e as S,ae as $,h as y,k as E}from"./index-971588a5.js";import{c as w,s as A}from"./Checker-bb762d90.js";const[x,B]=f("checkbox-group"),K={max:h,disabled:Boolean,iconSize:h,direction:String,modelValue:P(),checkedColor:String},v=Symbol(x);var H=p({name:x,props:K,emits:["change","update:modelValue"],setup(a,{emit:d,slots:s}){const{children:l,linkChildren:i}=C(v),o=e=>d("update:modelValue",e),u=(e={})=>{typeof e=="boolean"&&(e={checked:e});const{checked:t,skipDisabled:r}=e,c=l.filter(n=>n.props.bindGroup?n.props.disabled&&r?n.checked.value:t!=null?t:!n.checked.value:!1).map(n=>n.name);o(c)};return k(()=>a.modelValue,e=>d("change",e)),b({toggleAll:u}),V(()=>a.modelValue),i({props:a,updateValue:o}),()=>{var e;return g("div",{class:B([a.direction])},[(e=s.default)==null?void 0:e.call(s)])}}});const[N,X]=f("checkbox"),j=G({},w,{bindGroup:_});var z=p({name:N,props:j,emits:["change","update:modelValue"],setup(a,{emit:d,slots:s}){const{parent:l}=O(v),i=e=>{const{name:t}=a,{max:r,modelValue:m}=l.props,c=m.slice();if(e)!(r&&c.length>=+r)&&!c.includes(t)&&(c.push(t),a.bindGroup&&l.updateValue(c));else{const n=c.indexOf(t);n!==-1&&(c.splice(n,1),a.bindGroup&&l.updateValue(c))}},o=S(()=>l&&a.bindGroup?l.props.modelValue.indexOf(a.name)!==-1:!!a.modelValue),u=(e=!o.value)=>{l&&a.bindGroup?i(e):d("update:modelValue",e)};return k(()=>a.modelValue,e=>d("change",e)),b({toggle:u,props:a,checked:o}),V(()=>a.modelValue),()=>g(A,y({bem:X,role:"checkbox",parent:l,checked:o.value,onToggle:u},a),$(s,["default","icon"]))}});const I=E(z);export{I as C,H as s};
