const e=require("../_util/warning.js"),t=require("../_util/classNames.js"),n=require("../config-provider/DisabledContext.js"),r=require("../_util/props-util/index.js"),i=require("../config-provider/hooks/useConfigInject.js"),a=require("../form/FormItemContext.js"),o=require("../vc-checkbox/Checkbox.js"),s=require("./style/index.js"),c=require("./interface.js");let l=require("vue");var u=(0,l.defineComponent)({compatConfig:{MODE:3},name:`ACheckbox`,inheritAttrs:!1,__ANT_CHECKBOX:!0,props:c.checkboxProps(),setup(u,{emit:d,attrs:f,slots:p,expose:m}){let h=a.useInjectFormItemContext(),g=a.FormItemInputContext.useInject(),{prefixCls:_,direction:v,disabled:y}=i.default(`checkbox`,u),b=n.useInjectDisabled(),[x,S]=s.default(_),C=(0,l.inject)(c.CheckboxGroupContextKey,void 0),w=Symbol(`checkboxUniId`),T=(0,l.computed)(()=>C?.disabled.value||y.value);(0,l.watchEffect)(()=>{!u.skipGroup&&C&&C.registerValue(w,u.value)}),(0,l.onBeforeUnmount)(()=>{C&&C.cancelValue(w)}),(0,l.onMounted)(()=>{e.default(!!(u.checked!==void 0||C||u.value===void 0),`Checkbox`,"`value` is not validate prop, do you mean `checked`?")});let E=e=>{let t=e.target.checked;d(`update:checked`,t),d(`change`,e),h.onFieldChange()},D=(0,l.ref)();return m({focus:()=>{D.value?.focus()},blur:()=>{D.value?.blur()}}),()=>{let e=r.flattenChildren(p.default?.()),{indeterminate:n,skipGroup:i,id:a=h.id.value,...s}=u,{onMouseenter:c,onMouseleave:m,onInput:y,class:w,style:O,...k}=f,A={...s,id:a,prefixCls:_.value,...k,disabled:T.value};C&&!i?(A.onChange=(...t)=>{d(`change`,...t),C.toggleOption({label:e,value:u.value})},A.name=C.name.value,A.checked=C.mergedValue.value.includes(u.value),A.disabled=T.value||b.value,A.indeterminate=n):A.onChange=E;let j=t.default({[`${_.value}-wrapper`]:!0,[`${_.value}-rtl`]:v.value===`rtl`,[`${_.value}-wrapper-checked`]:A.checked,[`${_.value}-wrapper-disabled`]:A.disabled,[`${_.value}-wrapper-in-form-item`]:g.isFormItemInput},w,S.value),M=t.default({[`${_.value}-indeterminate`]:n},S.value);return x((0,l.createVNode)(`label`,{class:j,style:O,onMouseenter:c,onMouseleave:m},[(0,l.createVNode)(o.default,{"aria-checked":n?`mixed`:void 0,...A,class:M,ref:D},null),e.length?(0,l.createVNode)(`span`,null,[e]):null]))}}});exports.default=u;