import e from"../_util/classNames.mjs";import t from"../_util/props-util/initDefaultProps.mjs";import n from"../_util/vue-types/index.mjs";import{createVNode as r,defineComponent as i,ref as a,watch as o}from"vue";var s={prefixCls:String,name:String,id:String,type:String,defaultChecked:{type:[Boolean,Number],default:void 0},checked:{type:[Boolean,Number],default:void 0},disabled:Boolean,tabindex:{type:[Number,String]},readonly:Boolean,autofocus:Boolean,value:n.any,required:Boolean},c=i({compatConfig:{MODE:3},name:`Checkbox`,inheritAttrs:!1,props:t(s,{prefixCls:`rc-checkbox`,type:`checkbox`,defaultChecked:!1}),emits:[`click`,`change`],setup(t,{attrs:n,emit:i,expose:s}){let c=a(t.checked===void 0?t.defaultChecked:t.checked),l=a();o(()=>t.checked,()=>{c.value=t.checked}),s({focus(){l.value?.focus()},blur(){l.value?.blur()}});let u=a(),d=e=>{if(t.disabled)return;t.checked===void 0&&(c.value=e.target.checked),e.shiftKey=u.value;let n={target:{...t,checked:e.target.checked},stopPropagation(){e.stopPropagation()},preventDefault(){e.preventDefault()},nativeEvent:e};t.checked!==void 0&&(l.value.checked=!!t.checked),i(`change`,n),u.value=!1},f=e=>{i(`click`,e),u.value=e.shiftKey};return()=>{let{prefixCls:i,name:a,id:o,type:s,disabled:u,readonly:p,tabindex:m,autofocus:h,value:g,required:_,...v}=t,{class:y,onFocus:b,onBlur:x,onKeydown:S,onKeypress:C,onKeyup:w}=n,T={...v,...n},E=Object.keys(T).reduce((e,t)=>((t.startsWith(`data-`)||t.startsWith(`aria-`)||t===`role`)&&(e[t]=T[t]),e),{}),D=e(i,y,{[`${i}-checked`]:c.value,[`${i}-disabled`]:u}),O={name:a,id:o,type:s,readonly:p,disabled:u,tabindex:m,class:`${i}-input`,checked:!!c.value,autofocus:h,value:g,...E,onChange:d,onClick:f,onFocus:b,onBlur:x,onKeydown:S,onKeypress:C,onKeyup:w,required:_};return r(`span`,{class:D},[r(`input`,{ref:l,...O},null),r(`span`,{class:`${i}-inner`},null)])}}});export{s as checkboxProps,c as default};