"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../common/mixins/input.cjs"),i=require("./checkbox-constants.cjs"),n=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),l=require("../validation-messages/validation-messages.cjs"),r={name:"DtCheckbox",components:{DtValidationMessages:l.default},mixins:[a.InputMixin,a.CheckableMixin,a.GroupableMixin,a.MessagesMixin],inheritAttrs:!1,emits:["input","focusin","focusout"],computed:{inputValidationClass(){return i.CHECKBOX_INPUT_VALIDATION_CLASSES[this.internalValidationState]},checkboxGroupValueChecked(){var t,e;return((e=(t=this.groupContext)==null?void 0:t.selectedValues)==null?void 0:e.includes(this.value))??!1},hasLabel(){return!!(this.$slots.default||this.label)},hasMessages(){return this.formattedMessages.length&&this.showMessages},inputListeners(){return{...this.$listeners,input:()=>{},change:t=>this.emitValue(t.target)}}},watch:{checkboxGroupValueChecked:{immediate:!0,handler(t){this.hasGroup&&(this.internalChecked=t)}}},mounted(){this.runValidations()},methods:{emitValue(t){let{value:e,checked:s}=t;this.internalIndeterminate&&(s=!1,this.internalIndeterminate=!1,t.checked=!1),this.setGroupValue(e,s),this.$emit("input",s)},runValidations(){this.validateInputLabels(this.hasLabel,this.$attrs["aria-label"])}}};var o=function(){var e=this,s=e._self._c;return s("div",[s("label",{class:["d-checkbox-group",{"d-checkbox-group--disabled":e.internalDisabled}]},[s("div",{staticClass:"d-checkbox__input"},[s("input",e._g(e._b({class:["d-checkbox",e.inputValidationClass,e.inputClass],attrs:{type:"checkbox",name:e.internalName,disabled:e.internalDisabled},domProps:{checked:e.internalChecked,value:e.value,indeterminate:e.internalIndeterminate}},"input",e.$attrs,!1),e.inputListeners))]),e.hasLabel?s("div",e._b({class:[e.labelClass,"d-checkbox__copy d-checkbox__label"],attrs:{"data-qa":"checkbox-label"}},"div",e.labelChildProps,!1),[e._t("default",function(){return[e._v(e._s(e.label))]})],2):e._e()]),e.$slots.description||e.description||e.hasMessages?s("div",{staticClass:"d-checkbox__messages",attrs:{"data-qa":"checkbox-description-messages"}},[e.$slots.description||e.description?s("div",e._b({class:["d-description",e.descriptionClass],attrs:{"data-qa":"checkbox-description"}},"div",e.descriptionChildProps,!1),[e._t("description",function(){return[e._v(" "+e._s(e.description)+" ")]})],2):e._e(),s("dt-validation-messages",e._b({class:e.messagesClass,attrs:{"validation-messages":e.formattedMessages,"show-messages":e.showMessages,"data-qa":"dt-checkbox-validation-messages"}},"dt-validation-messages",e.messagesChildProps,!1))],1):e._e()])},c=[],d=n.n(r,o,c);const u=d.exports;exports.default=u;
//# sourceMappingURL=checkbox.cjs.map
