import{a as M,al as H,r as h,a1 as I,H as L,af as R,_ as u,L as z,M as x,j as b,N as G,y as J}from"./index.0d073eaa.js";var Q=globalThis&&globalThis.__rest||function(o,e){var r={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&e.indexOf(n)<0&&(r[n]=o[n]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,n=Object.getOwnPropertySymbols(o);t<n.length;t++)e.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(o,n[t])&&(r[n[t]]=o[n[t]]);return r},U={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:J.any,required:Boolean},X=M({name:"Checkbox",inheritAttrs:!1,props:H(U,{prefixCls:"rc-checkbox",type:"checkbox",defaultChecked:!1}),emits:["click","change"],setup:function(e,r){var n=r.attrs,t=r.emit,m=r.expose,i=h(e.checked===void 0?e.defaultChecked:e.checked),d=h();I(function(){return e.checked},function(){i.value=e.checked}),L(function(){R(function(){})}),m({focus:function(){var a;(a=d.value)===null||a===void 0||a.focus()},blur:function(){var a;(a=d.value)===null||a===void 0||a.blur()}});var s=h(),p=function(a){if(!e.disabled){e.checked===void 0&&(i.value=a.target.checked),a.shiftKey=s.value;var f={target:u(u({},e),{checked:a.target.checked}),stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()},nativeEvent:a};e.checked!==void 0&&(d.value.checked=!!e.checked),t("change",f),s.value=!1}},C=function(a){t("click",a),s.value=a.shiftKey};return function(){var c,a=e.prefixCls,f=e.name,v=e.id,K=e.type,y=e.disabled,P=e.readonly,O=e.tabindex,S=e.autofocus,B=e.value,_=e.required,j=Q(e,["prefixCls","name","id","type","disabled","readonly","tabindex","autofocus","value","required"]),N=n.class,w=n.onFocus,q=n.onBlur,D=n.onKeydown,T=n.onKeypress,A=n.onKeyup,k=u(u({},j),n),F=Object.keys(k).reduce(function(g,l){return(l.substr(0,5)==="aria-"||l.substr(0,5)==="data-"||l==="role")&&(g[l]=k[l]),g},{}),V=z(a,N,(c={},x(c,"".concat(a,"-checked"),i.value),x(c,"".concat(a,"-disabled"),y),c)),E=u(u({name:f,id:v,type:K,readonly:P,disabled:y,tabindex:O,class:"".concat(a,"-input"),checked:!!i.value,autofocus:S,value:B},F),{onChange:p,onClick:C,onFocus:w,onBlur:q,onKeydown:D,onKeypress:T,onKeyup:A,required:_});return b("span",{class:V},[b("input",G({ref:d},E),null),b("span",{class:"".concat(a,"-inner")},null)])}}});export{X as V};
