!function(){function s(t){t=t.domEvent;return t&&!jq.nodeName(t.target,"input")}var n=zul.wgt.Checkbox=zk.$extends(zul.LabelImageWidget,{_checked:!1,_disabled:!1,$define:{disabled:[function(t,e){if(e&&e.adbs?this._adbs=!0:e&&void 0!==e.adbs||(this._adbs=!1),!t)if(this._adbs)this._adbs=!1;else if(e&&!1===e.adbs)return this._disabled;return t},function(t){var e=this.$n("real");e&&(e.disabled=t,jq(this.$n()).toggleClass(this.$s(this.getMoldPrefix_()+"disabled"),t),this._isDefaultMold()||this._setTabIndexForMold())}],checked:function(t){var e=this.$n("real");e&&(jq(e).prop("checked",t),this.clearStateClassName_(),jq(this.$n()).addClass(this.getClassNameByState_()))},name:function(t){var e=this.$n("real");e&&(e.name=t||"")},tabindex:function(t){var e=this.$n("real");e&&(null==t?e.removeAttribute("tabindex"):e.tabIndex=t)},value:function(t){var e=this.$n("real");e&&(e.value=t||"")},autodisable:null,indeterminate:function(t){var e=this.$n("real");e&&(jq(e).prop("indeterminate",t),this._isDefaultMold()||(this.clearStateClassName_(),jq(this.$n()).addClass(this.getClassNameByState_())))}},getState:function(){return this.isIndeterminate()?null:this.isChecked()},focus_:function(t){return zk(this.$n("real")||this.$n()).focus(t),!0},contentAttrs_:function(){var t,e="";return(t=this.getName())&&(e+=' name="'.concat(t,'"')),this._disabled&&(e+=' disabled="disabled"'),this._checked&&(e+=' checked="checked"'),(t=this._tabindex)&&(e+=' tabindex="'.concat(t,'"')),(t=this.getValue())&&(e+=' value="'.concat(t,'"')),e},_moldA11yAttrs:function(){return""},bind_:function(){this.$supers(n,"bind_",arguments);var t=this.$n("real"),e=this.$n("mold"),i=this.getIndeterminate();t.checked!=t.defaultChecked&&(t.checked=t.defaultChecked),i&&(t.indeterminate=!0),this.domListen_(t,"onFocus","doFocus_").domListen_(t,"onBlur","doBlur_").domListen_(e,"onMouseDown","_doMoldMouseDown"),this._setTabIndexForMold()},unbind_:function(){var t=this.$n("real"),e=this.$n("mold");this.domUnlisten_(e,"onMouseDown","_doMoldMouseDown").domUnlisten_(t,"onFocus","doFocus_").domUnlisten_(t,"onBlur","doBlur_"),this.$supers(n,"unbind_",arguments)},_setTabIndexForMold:function(){var t=this.$n("mold");t&&(t.tabIndex=this._canTabOnMold()?0:-1)},_canTabOnMold:function(){return!this._isDefaultMold()&&!this.isDisabled()},doSelect_:function(t){s(t)||this.$supers("doSelect_",arguments)},doClick_:function(t){var e,i;s(t)||this.isDisabled()||(zul.wgt.ADBS.autodisable(this),this._isTristateMold()?(this.nextState_(),this.fireOnCheck_(this.getState())):((e=(i=this.$n("real")).checked)!=this._checked&&(this.setChecked(e),this.setIndeterminate(!1),this.fireOnCheck_(e)),zk.webkit&&!zk.mobile&&zk(i).focus(),t.stop({propagation:!0}),this.$supers("doClick_",arguments),!this.$instanceof(zul.wgt.Radio)||(i=this.getRadiogroup())&&i.doClick_(t)))},_doMoldMouseDown:function(t){this.isDisabled()&&t.stop()},fireOnCheck_:function(t){this.fire("onCheck",t)},beforeSendAU_:function(t,e){"onClick"!=e.name&&this.$supers("beforeSendAU_",arguments)},getTextNode:function(){return this.$n("cnt")},shallIgnoreClick_:function(){return this.isDisabled()},domClass_:function(){var t=this.$supers("domClass_",arguments),e=this.getMold();return t+=" "+this.$s(e),t+=" "+this.getClassNameByState_(),this.isDisabled()&&(t+=" "+this.$s(this.getMoldPrefix_()+"disabled")),t},_isDefaultMold:function(){return"default"==this.getMold()},_isTristateMold:function(){return"tristate"==this.getMold()},nextState_:function(){this._indeterminate?(this.setIndeterminate(!1),this.setChecked(!0)):this._checked?this.setChecked(!1):this.setIndeterminate(!0)},getMoldPrefix_:function(){return this._isDefaultMold()?"":this.getMold()+"-"},getClassNameByState_:function(){var t=this.getMoldPrefix_();return this._indeterminate?this.$s(t+"indeterminate"):this.$s(t+(this._checked?"on":"off"))},clearStateClassName_:function(){var t=jq(this.$n()),e=this.getMoldPrefix_();t&&t.removeClass(this.$s(e+"off")).removeClass(this.$s(e+"indeterminate")).removeClass(this.$s(e+"on"))},doKeyDown_:function(t){this.$supers("doKeyDown_",arguments);if(t.domTarget==this.$n("mold")&&32==t.keyCode){if(this._isTristateMold())return this.nextState_(),void this.fireOnCheck_(this.getState());var e=!this.isChecked();this.setChecked(e),this.fireOnCheck_(e)}}})}();