Uize.module({name:'Uize.Widget.Button',required:'Uize.Node',builder:function(c_a){var c_b=null,c_c=true,c_d=false,c_e=Uize.Node;var c_f=c_a.subclass(function(){this.c_g=c_d;}),c_h=c_f.prototype;var c_i=c_b,c_j={},c_k={grayed:16,'':8,over:4,active:2,playing:1};c_h.c_l=function(){return(!this.c_m||this.c_n)&&this.isEnabled();};c_h.updateUiBusy=function(){var c_o=this;if(c_o.wired()){if(c_o.isBusy()){c_e.setStyle(c_o.c_p,{cursor:'wait'});}else{c_e.showClickable(c_o.c_p,c_o.c_l());}}};var c_q=c_h.updateUi=c_h.c_q=function(){var c_o=this;if(c_o.wired()){var c_r=c_o.isEnabled(),c_s=c_o.isBusy(),c_t=(!c_r?16:0)+((c_o.c_u==''||c_s)&&c_r?8:0)+(c_o==c_i&&c_r&& !c_s?4:0)+(((c_o.c_u=='down'&& !c_s)||c_o.c_m)&&c_r?2:0)+(c_o.c_v&&c_r?1:0),c_w=c_o.c_x[c_t];if(typeof c_w!='string'){var c_y=c_o.c_y;for(var c_z in c_y){var c_A=c_y[c_z];if(c_t&c_k[c_A]){c_w=c_A;break;}}c_o.c_x[c_t]=c_w;}if(c_o.c_B=='frames'){c_o.c_C.style.top='-'+(c_o.c_D.c_E[c_w]*c_o.c_F.height)+'px';}else if(c_o.c_B=='classes'){var c_G=c_o.c_G,
c_H=c_G.className,c_I='';if(c_o.c_J=='simple'){var c_K=c_w=='grayed'?'disabled':c_w,c_L=/\b(disabled|over|active|playing)\b/;c_I=c_H.search(c_L)> -1?c_H.replace(c_L,c_K):c_H+(c_K?' ':'')+c_K;}else{var c_M='(Grayed|Over|Active|Playing)';if(typeof c_o.c_N!='string'){var c_O=c_H.match(new RegExp('(?:(?:(\\S+)\\s+\\1'+c_M+'))','g'));if(c_O){c_o.c_N=c_O[c_O.length-1].split(' ')[0];}else{c_O=c_H.replace(new RegExp('\\S*'+c_M+'\\b','g'),'').match(/(\S+)\s*$/);if(c_O)c_o.c_N=c_O[c_O.length-1];}c_o.c_N=c_o.c_N||'';}var c_P=c_w?' '+c_o.c_N+c_f.capFirstChar(c_w):'';c_I=c_o.c_N?c_H.replace(new RegExp(c_o.c_N+'(\\s+'+c_o.c_N+c_M+')?'),c_o.c_N+c_P):c_H.replace(new RegExp(c_M),'')+c_P}if(c_I!=c_H)c_G.className=c_I;}else if(c_o.c_B=='nodes'){function c_Q(c_R,c_S){c_o.showNode(c_R,c_S&&c_o.c_T);}for(var c_A in c_k)c_Q(c_A,c_A==c_w);c_Q('events',c_o.c_l());}else if(c_o.c_B=='src'){}if(c_o.c_U){var c_V=c_o.c_u=='over'&&c_r&& !c_o.c_m;if(c_V!=c_o.c_g){c_o.c_g=c_V;Uize.Tooltip.showTooltip(c_o.c_U,c_V);}}c_o.updateUiBusy();}};
c_h.wireUi=function(){var c_o=this;if(!c_o.wired()&&c_o.get('idPrefix')){var c_W=c_o.getNode('text');c_o.c_X=c_W?c_W.innerHTML:'';c_o.c_G=c_o.getNode();c_o.c_p=c_o.getNode('events');c_o.c_C=c_o.getNode('frames');if(c_o.c_G||c_o.c_p||c_o.c_C){if(c_o.c_C){c_o.c_B='frames';if(!c_o.c_p)c_o.c_p=c_o.c_G;c_o.c_F=c_e.getDimensions(c_o.c_C.parentNode);}else if(c_o.c_G&& !c_o.c_p){c_o.c_B='classes';c_o.c_p=c_o.c_G;}if(c_o.c_Y&&c_o.c_p.tagName=='A')c_o.c_p.onclick=c_e.returnTrue;function c_Z(c_0,c_1,c_2){var c_3=c_o.isEnabled()&& !c_o.isBusy();if(c_3){if(c_2)c_1.cancelBubble=c_c;c_o.fireEvent({name:c_0,domEvent:c_1});}return c_3;}c_o.wireNodeEvents(c_o.c_p,{onmouseover:function(c_1){c_o.set({c_u:'over'});c_Z('Over',c_1);return c_d;},onmouseout:function(c_1){c_o.set({c_u:''});c_Z('Out',c_1);return c_d;},onmousedown:function(c_1){c_o.set({c_u:'down'});c_Z('Down',c_1);return c_d;},onmouseup:function(c_1){c_o.set({c_u:'over'});c_Z('Up',c_1);return c_d;},onclick:function(c_1){return c_Z('Click',c_1,c_c)&&c_o.c_Y;}});
c_a.prototype.wireUi.call(c_o);}}};c_f.addChildButton=function(c_4,c_5,c_6){var c_o=this,c_7;function c_8(){c_7.addEventHandler('Click',function(c_9){c_9.buttonId=c_4;if(typeof c_5=='function')c_5(c_9);c_o.fireEvent(c_9);});}if(c_o==c_f){c_7=new c_f({idPrefix:c_4,c_Y:c_c});c_8();(window[c_7.objectName]=c_7).wireUi();}else{c_7=c_o.widgets.map[c_4];if(!c_7){c_7=c_o.widgets.add(c_4,c_f);c_8();}}return c_7;};c_f.addLinkButton=function(c_4){return this.addChildButton(c_4,c_b,c_c);};c_f.registerProperties({c_n:{name:'clickToDeselect',onChange:c_q,value:c_d},c_J:{name:'classNamingForStates',value:'disambiguated'},c_D:{name:'frameOrder',onChange:function(){var c_D=this.c_D;if(!c_D.c_E){var c_ba=c_D.c_E={};for(var c_bb=0;c_bb<c_D.length;c_bb++)c_ba[c_D[c_bb]]=c_bb;}},value:['grayed','','over','active','playing']},c_Y:{name:'followLink',value:c_d},c_T:{name:'live',onChange:c_q,value:c_c},c_B:{name:'mode',value:'nodes'},c_v:{name:'playing',onChange:c_q,value:c_d},c_m:{name:'selected',onChange:c_q,value:c_d},c_u:{
name:'state',onChange:function(){var c_o=this;if(!c_o.c_u){if(c_i==c_o)c_i=c_b;}else if(c_o.c_u=='over'){if(c_i&&c_i!=c_o)c_i.set({c_u:''});c_i=c_o;}c_o.c_q();},value:''},c_y:{name:'statePrecedence',onChange:function(){var c_o=this,c_bc=c_o.c_y.c_bd;if(!c_bc)c_bc=c_o.c_y.c_bd=c_o.c_y.join(',');var c_x=c_j[c_bc];if(!c_x)c_x=c_j[c_bc]={};c_o.c_x=c_x;c_o.updateUi();},value:['grayed','playing','active','over','']},c_X:{name:'text',onChange:function(){var c_o=this;if(c_o.wired())c_o.setNodeInnerHtml('text',c_o.c_X);}},c_U:'tooltip'});return c_f;}});