import{O as C,n as _,w as v,d as g,N as P,aj as B,t as V,S as D,v as k,k as m,a2 as E,U as R,m as x,aT as $,u as w,E as S,G,aR as p,x as I,as as N,z as U,y as j}from"./index.879f7421.js";const y={name:C,shape:_("round"),disabled:Boolean,iconSize:v,modelValue:C,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var A=g({props:P({},y,{bem:B(Function),role:String,parent:Object,checked:Boolean,bindGroup:V}),emits:["click","toggle"],setup(e,{emit:t,slots:d}){const o=D(),i=a=>{if(e.parent&&e.bindGroup)return e.parent.props[a]},c=k(()=>i("disabled")||e.disabled),u=k(()=>i("direction")),n=k(()=>{const a=e.checkedColor||i("checkedColor");if(a&&e.checked&&!c.value)return{borderColor:a,backgroundColor:a}}),s=a=>{const{target:l}=a,b=o.value,f=b===l||(b==null?void 0:b.contains(l));!c.value&&(f||!e.labelDisabled)&&t("toggle"),t("click",a)},r=()=>{const{bem:a,shape:l,checked:b}=e,f=e.iconSize||i("iconSize");return m("div",{ref:o,class:a("icon",[l,{disabled:c.value,checked:b}]),style:{fontSize:R(f)}},[d.icon?d.icon({checked:b,disabled:c.value}):m(E,{name:"success",style:n.value},null)])},h=()=>{if(d.default)return m("span",{class:e.bem("label",[e.labelPosition,{disabled:c.value}])},[d.default()])};return()=>{const a=e.labelPosition==="left"?[h(),r()]:[r(),h()];return m("div",{role:e.role,class:e.bem([{disabled:c.value,"label-disabled":e.labelDisabled},u.value]),tabindex:c.value?void 0:0,"aria-checked":e.checked,onClick:s},[a])}}});const[z,F]=x("checkbox-group"),K={max:v,disabled:Boolean,iconSize:v,direction:String,modelValue:$(),checkedColor:String},O=Symbol(z);var Y=g({name:z,props:K,emits:["change","update:modelValue"],setup(e,{emit:t,slots:d}){const{children:o,linkChildren:i}=w(O),c=n=>t("update:modelValue",n),u=(n={})=>{typeof n=="boolean"&&(n={checked:n});const{checked:s,skipDisabled:r}=n,a=o.filter(l=>l.props.bindGroup?l.props.disabled&&r?l.checked.value:s!=null?s:!l.checked.value:!1).map(l=>l.name);c(a)};return S(()=>e.modelValue,n=>t("change",n)),G({toggleAll:u}),p(()=>e.modelValue),i({props:e,updateValue:c}),()=>{var n;return m("div",{class:F([e.direction])},[(n=d.default)==null?void 0:n.call(d)])}}});const[T,q]=x("checkbox"),H=P({},y,{bindGroup:V});var L=g({name:T,props:H,emits:["change","update:modelValue"],setup(e,{emit:t,slots:d}){const{parent:o}=I(O),i=n=>{const{name:s}=e,{max:r,modelValue:h}=o.props,a=h.slice();if(n)!(r&&a.length>=r)&&!a.includes(s)&&(a.push(s),e.bindGroup&&o.updateValue(a));else{const l=a.indexOf(s);l!==-1&&(a.splice(l,1),e.bindGroup&&o.updateValue(a))}},c=k(()=>o&&e.bindGroup?o.props.modelValue.indexOf(e.name)!==-1:!!e.modelValue),u=(n=!c.value)=>{o&&e.bindGroup?i(n):t("update:modelValue",n)};return S(()=>e.modelValue,n=>t("change",n)),G({toggle:u,props:e,checked:c}),p(()=>e.modelValue),()=>m(A,U({bem:q,role:"checkbox",parent:o,checked:c.value,onToggle:u},e),N(d,["default","icon"]))}});const J=j(L);export{J as C,Y as a,y as c,A as s};
