import{p as e}from"./nc-util.BWncs0l6.js";import{n as t,t as n}from"./objectSpread2.C2EWlzLj.js";import{t as r}from"./_plugin-vue_export-helper.dOX-z6IG.js";import{computed as i,createElementBlock as a,createElementVNode as o,createVNode as s,inject as c,openBlock as l,ref as u,renderSlot as d,resolveComponent as f,withCtx as p}from"/vue.js";function m(t,n){return{name:t,props:{model:{type:String,default:void 0,required:!0},hdr:{type:String,default:void 0},disabled:{type:Boolean,default:void 0},value:{type:[String,Boolean],default:void 0},name:{type:String,default:void 0}},setup(t,{emit:r}){let a=c(`state`),o=u(),s=n?`radio`:`checkbox`,l=i(()=>e.getRec(a,o.value)),d=i(()=>n&&t.value!=null?l.value===t.value:t.value==null?!!l.value:t.value);t.model==null?t.value==null&&console.error(`nc-${s}: props.model and props.value do not exist`):t.model.indexOf(`rec.`)===0?o.value=t.model.substr(4):t.value==null&&console.warn(`nc-${s}: props.model does not start with 'rec.'`,t.model);function f(){if(o.value!=null){e.setPrevRec(a,o.value,`nc-radio-checkbox.js`);let i;i=n?t.value:!d.value,e.setRec(a,o.value,i),r(`change`,i)}else if(t.value!=null){let e;e=n?t.value:!d.value,r(`change`,e)}}function p(e){(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),f())}return{isChecked:d,recValue:l,change:f,onKeydown:p}}}}t();var h=[`checked`,`disabled`,`name`,`value`];function g(e,t,n,r,i,c){let u=f(`nc-label`);return l(),a(`div`,{class:`ui checkbox nc-checkbox`,size:`small`,onKeydown:t[0]||(t[0]=(...t)=>e.onKeydown&&e.onKeydown(...t))},[o(`input`,{class:`hidden`,readonly:`readonly`,tabindex:`0`,type:`checkbox`,checked:e.isChecked,disabled:e.disabled,name:e.name,value:e.value},null,8,h),s(u,{for:e.name,model:e.model,hdr:e.hdr||e.model,onClick:e.change},{default:p(()=>[d(e.$slots,`default`)]),_:3},8,[`for`,`model`,`hdr`,`onClick`])],32)}var _=r(n({},m(`NcCheckbox`,!1)),[[`render`,g]]);export{_ as default,m as t};