!function(){function e(t){var i;(i=t._upload)&&(t._uplder=new zul.Upload(t,null,i))}function n(t){var i;(i=t._uplder)&&(t._uplder=null,i.destroy())}var t,i=zul.wgt.Button=zk.$extends(zul.LabelImageWidget,{_orient:"horizontal",_dir:"normal",_type:"button",$define:{href:null,target:null,dir:t=function(){this.updateDomContent_()},orient:t,type:t,disabled:[function(t,i){if(i&&i.adbs?this._adbs=!0:i&&void 0!==i.adbs||(this._adbs=!1),!t)if(this._adbs)this._adbs=!1;else if(i&&!1===i.adbs)return this._disabled;return t},function(t){function i(){s.desktop&&(jq(s.$n()).attr("disabled",t?"disabled":null),s._upload&&(t?n(s):e(s)))}var s=this;"submit"==this._type?setTimeout(i,50):i()}],autodisable:null,upload:function(t){this.$n()&&!this._disabled&&(n(this),t&&"false"!=t&&e(this))}},focus_:function(t){var i=this,s=this.$n();return s&&s.disabled?(this._delayFocus||(this._delayFocus=!0,setTimeout(function(){i.desktop&&!i.isDisabled()&&(zk.focusBackFix&&i._upload||zk(i.$n()).focus(t)),i._delayFocus=null},0)),!1):(zk.focusBackFix&&this._upload||zk(s).focus(t),!0)},domContent_:function(){var t=zUtl.encodeXML(this.getLabel()),i=this.getImage(),s=this.domIcon_();if(!i&&!s)return t;i=i?'<img class="'.concat(this.$s("image"),'" src="').concat(i,'" />').concat(s?" "+s:""):s;var e="vertical"==this.getOrient()?"<br/>":" ";return"reverse"==this.getDir()?t+e+i:i+e+t},onShow:function(){this.$n()&&!this._disabled&&this._uplder&&this._uplder.sync()},bind_:function(){this.$supers(i,"bind_",arguments);var t=this.$n();this.domListen_(t,"onFocus","doFocus_").domListen_(t,"onBlur","doBlur_"),zWatch.listen({onShow:this}),!this._disabled&&this._upload&&e(this)},unbind_:function(){n(this);var t=this.$n();this.domUnlisten_(t,"onFocus","doFocus_").domUnlisten_(t,"onBlur","doBlur_"),zWatch.unlisten({onShow:this}),this.$supers(i,"unbind_",arguments)},doClick_:function(t){if(t.domEvent&&!this._disabled&&(this._upload?(!zk.ie||10<zk.ie)&&this._uplder.openFileDialog():zul.wgt.ADBS.autodisable(this),this.fireX(t),!t.stopped)){var i=this._href,s=!!i&&i.toLowerCase().startsWith("mailto:");if(i)if(s){var e=jq.newFrame("mailtoFrame",i,null);jq(e).remove()}else zUtl.go(i,{target:this._target||(t.data.ctrlKey?"_blank":"")});this.$super("doClick_",t,!0)}},setFlexSize_:function(t){var i=this.$n();void 0!==t.height&&("auto"==t.height?i.style.height="":""!=t.height?i.style.height=jq.px0(parseInt(t.height)):i.style.height=this._height?this._height:""),void 0!==t.width&&("auto"==t.width?i.style.width="":""!=t.width?i.style.width=jq.px0(parseInt(t.width)):i.style.width=this._width?this._width:"")}});zul.wgt.ADBS=zk.$extends(zk.Object,{$init:function(t){this._ads=t},onResponse:function(){for(var t,i=this._ads;t=i.shift();)t.setDisabled(!1,{adbs:!1,skip:!0}),zk.chrome&&t.domListen_(t.$n(),"onBlur","doBlur_");zWatch.unlisten({onResponse:this})}},{autodisable:function(t){var i,s,e=t._autodisable;if(e){zk.chrome&&t.domUnlisten_(t.$n(),"onBlur","doBlur_");for(var n=(e=e.split(",")).length;n--;){var o=e[n].trim();if(o){var d="+"==o.charAt(0);d&&(o=o.substring(1)),(o="self"==o?t:t.$f(o))==t&&(s=t._uplder,t._uplder=null,t._autodisable_self=!0),o&&!o._disabled&&(o.setDisabled(!0,{adbs:!0,skip:!0}),t.inServer&&(d?o.smartUpdate("disabled",!0):i?i.push(o):i=[o]))}}}if(i){var l=new zul.wgt.ADBS(i);s?(s._aded=l,t._uplder=s):t.isListen("onClick",{asapOnly:!0})?zWatch.listen({onResponse:l}):setTimeout(function(){return l.onResponse()},800)}}})}();