import{L as f,aL as P,R as h,N as G,O as k,Q as S,Z as p,ax as b,al as g,e as V,W as x,V as _,U as O,k as y,aA as $,m as A,M as B}from"./index-BDh_pN-M.js";import{s as E,c as N}from"./index-CABkbwV5.js";const[v,K]=k("checkbox-group"),L={max:h,shape:G("round"),disabled:Boolean,iconSize:h,direction:String,modelValue:P(),checkedColor:String},C=Symbol(v);var R=f({name:v,props:L,emits:["change","update:modelValue"],setup(a,{emit:c,slots:u}){const{children:l,linkChildren:i}=S(C),o=e=>c("update:modelValue",e),s=(e={})=>{typeof e=="boolean"&&(e={checked:e});const{checked:d,skipDisabled:r}=e,t=l.filter(n=>n.props.bindGroup?n.props.disabled&&r?n.checked.value:d??!n.checked.value:!1).map(n=>n.name);o(t)};return p(()=>a.modelValue,e=>c("change",e)),b({toggleAll:s}),g(()=>a.modelValue),i({props:a,updateValue:o}),()=>{var e;return V("div",{class:K([a.direction])},[(e=u.default)==null?void 0:e.call(u)])}}});const M=x(R),[U,z]=k("checkbox"),D=_({},N,{shape:String,bindGroup:B,indeterminate:{type:Boolean,default:null}});var F=f({name:U,props:D,emits:["change","update:modelValue"],setup(a,{emit:c,slots:u}){const{parent:l}=O(C),i=e=>{const{name:d}=a,{max:r,modelValue:m}=l.props,t=m.slice();if(e)!(r&&t.length>=+r)&&!t.includes(d)&&(t.push(d),a.bindGroup&&l.updateValue(t));else{const n=t.indexOf(d);n!==-1&&(t.splice(n,1),a.bindGroup&&l.updateValue(t))}},o=y(()=>l&&a.bindGroup?l.props.modelValue.indexOf(a.name)!==-1:!!a.modelValue),s=(e=!o.value)=>{l&&a.bindGroup?i(e):c("update:modelValue",e),a.indeterminate!==null&&c("change",e)};return p(()=>a.modelValue,e=>{a.indeterminate===null&&c("change",e)}),b({toggle:s,props:a,checked:o}),g(()=>a.modelValue),()=>V(E,A({bem:z,role:"checkbox",parent:l,checked:o.value,onToggle:s},a),$(u,["default","icon"]))}});const Q=x(F);export{M as C,Q as a};
