import{H as v,$ as g,E as P,d as S,I as C,aw as z,G as x,S as y,V as r,j as d,M as B,a1 as D}from"./index.3bfa6a0e.js";const G={name:v,shape:g("round"),disabled:Boolean,iconSize:P,modelValue:v,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var V=S({props:C({},G,{bem:z(Function),role:String,parent:Object,checked:Boolean,bindGroup:x}),emits:["click","toggle"],setup(e,{emit:s,slots:c}){const u=y(),l=n=>{if(e.parent&&e.bindGroup)return e.parent.props[n]},a=r(()=>l("disabled")||e.disabled),f=r(()=>l("direction")),m=r(()=>{const n=e.checkedColor||l("checkedColor");if(n&&e.checked&&!a.value)return{borderColor:n,backgroundColor:n}}),h=n=>{const{target:i}=n,o=u.value,t=o===i||(o==null?void 0:o.contains(i));!a.value&&(t||!e.labelDisabled)&&s("toggle"),s("click",n)},b=()=>{const{bem:n,shape:i,checked:o}=e,t=e.iconSize||l("iconSize");return d("div",{ref:u,class:n("icon",[i,{disabled:a.value,checked:o}]),style:{fontSize:D(t)}},[c.icon?c.icon({checked:o,disabled:a.value}):d(B,{name:"success",style:m.value},null)])},k=()=>{if(c.default)return d("span",{class:e.bem("label",[e.labelPosition,{disabled:a.value}])},[c.default()])};return()=>{const n=e.labelPosition==="left"?[k(),b()]:[b(),k()];return d("div",{role:e.role,class:e.bem([{disabled:a.value,"label-disabled":e.labelDisabled},f.value]),tabindex:a.value?void 0:0,"aria-checked":e.checked,onClick:h},[n])}}});export{G as c,V as s};
