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