import{s as S,x as C,y as w,a as r,d as b,w as B,h,j as V,t as n,u as l,z as y,A as D,l as P,o as u}from"./_plugin-vue_export-helper-fP7Bc2kv.js";const M=["for"],j={key:0,class:"mt-0 form-text"},N=["id","true-value","false-value"],q={key:0,class:"form-text"},F={__name:"Checkbox",props:S({class:{type:String,default:""},desc:{type:String,default:null},id:{type:String,required:!0},label:{type:String,default:null},localePrefix:{type:String,default:"missing-prefix"},inverseValues:{type:Boolean,default:!1},default:{type:void 0,default:null}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(d){const a=C(d,"modelValue"),x=w(),s=d,_=(()=>{let e=s.class.split(" ");return e.includes("form-check")||e.push("form-check"),e.join(" ")})(),i=e=>{if(e===!0||e===!1)return{possibleValues:[!0,!1],value:e};if(e===1||e===0)return{possibleValues:[1,0],value:e};const o=[["true","false"],["1","0"],["enabled","disabled"],["enable","disable"],["yes","no"],["on","off"]];e=`${e}`.toLowerCase().trim();for(const t of o)if(e===t[0]||e===t[1])return{possibleValues:t,value:e};return null},c=(()=>{const e=(()=>{const m=i(a.value);return m!==null?m.possibleValues:(console.error(`Checkbox value ${a.value} did not match any acceptable pattern!`),["true","false"])})(),o=s.inverseValues?1:0,t=s.inverseValues?0:1;return{truthy:e[o],falsy:e[t]}})(),f=(()=>{const e=i(s.default);return e!==null?e.value===e.possibleValues[0]:null})(),k=s.label??`${s.localePrefix}.${s.id}`,v=s.desc??`${s.localePrefix}.${s.id}_desc`,p=s.desc!==""||Object.entries(x).length>0,$=f!==null,g=f?"_common.enabled_def_cbox":"_common.disabled_def_cbox";return(e,o)=>(u(),r("div",{class:y(l(_))},[b("label",{for:s.id,class:y(`form-check-label${l(p)?" mb-2":""}`)},[V(n(e.$t(l(k)))+" ",1),$?(u(),r("div",j,n(e.$t(l(g))),1)):h("",!0)],10,M),B(b("input",{type:"checkbox",class:"form-check-input",id:s.id,"onUpdate:modelValue":o[0]||(o[0]=t=>a.value=t),"true-value":l(c).truthy,"false-value":l(c).falsy},null,8,N),[[D,a.value]]),l(p)?(u(),r("div",q,[V(n(e.$t(l(v)))+" ",1),P(e.$slots,"default")])):h("",!0)],2))}};export{F as _};
