AUI.add("aui-button-item",function(R){var H=R.Lang,K=R.ClassNameManager.getClassName,J="buttonitem",P="contentBox",S=".",D="icon",B="iconNode",Y="label",C="labelNode",X="only",W="state",Q="title",E=K(J),L=K(J,D),Z=K(J,Y),U=K(J,D,Y),N=K(J,D,X),I=K(J,Y,X),M=K(D),G=new RegExp(M+"-([a-zA-Z0-9-]+)"),T='<button type="button"></button>',F='<span class="'+[L,M].join(" ")+'"></span>',O='<span class="'+Z+'"></span>';var V=R.Component.create({NAME:J,ATTRS:{activeState:{value:false},classNames:{},defaultState:{},handler:{lazyAdd:false,value:null,setter:function(e){var A=this;var d=e;var b=A;var a=A;var c="click";if(H.isObject(d)){var f=d;d=f.fn||d;b=f.context||b;c=f.type||c;}if(H.isFunction(d)){A.on(c,R.rbind(d,b,a,f.args));}return e;}},hoverState:{},icon:{value:""},iconNode:{valueFn:function(){return R.Node.create(F);}},id:{valueFn:function(){return R.guid();}},label:{value:""},labelNode:{valueFn:function(){return R.Node.create(O);}},title:{setter:"_setTitle",value:false}},HTML_PARSER:{iconNode:function(A){return A.one(S+L);},labelNode:function(A){return A.one(S+Z);},icon:function(c){var a=c.one(S+L);if(a){this.set(B,a);var A=a.attr("class");var b=A.match(G);return b&&b[1];}},label:function(a){var A=a.one(S+Z);if(A){this.set(C,A);return A.text();}}},constructor:function(A){if(H.isString(A)){A={icon:A};}V.superclass.constructor.call(this,A);},UI_ATTRS:[D,Y,Q],prototype:{BOUNDING_TEMPLATE:T,CONTENT_TEMPLATE:null,renderUI:function(){var A=this;A._renderStates();A._renderIconNode();A._renderLabelNode();},syncUI:function(){var A=this;var b=A.get("icon");var a=A.get("label");var c=A.get("title");if(b){A._uiSetIcon(b);}if(a){A._uiSetLabel(a);}if(c){A._uiSetTitle(c);}},_renderIconNode:function(){var A=this;A.get(P).append(A.get(B));},_renderLabelNode:function(){var A=this;A.get(P).append(A.get(C));},_getState:function(a,b){var A=this;var d=A.get(a);var c=d;if(b){d=b.get(a);if(!H.isUndefined(d)){c=d;}}return c;},_renderStates:function(d){var A=this;var c=A.get("parent");var b=A._getState("activeState",c);var f=A._getState("classNames",c);var a=A._getState("defaultState",c);var e=A._getState("hoverState",c);A.plug(R.Plugin.StateInteraction,{activeState:b,classNames:f,defaultState:a,hoverState:e});},_setTitle:function(a){var A=this;if(a===null){a=A.get("label");}else{if(a===false){a="";}}return String(a);},_syncChildrenStates:function(){var A=this;var d=A.get("icon");var b=A.get("label");var e=(d&&b);var f=(!d&&b);var c=(d&&!b);var a=A.get("boundingBox");a.toggleClass(U,e);a.toggleClass(N,c);a.toggleClass(I,f);},_uiSetIcon:function(c){var A=this;var a=A.get(B);var b="show";if(!c){b="hide";}c=K(D,c);a.replaceClass(A._iconPrevVal,c);a[b]();A._syncChildrenStates();A._iconPrevVal=c;},_uiSetLabel:function(c){var A=this;var a=A.get(C);var b="show";if(!c){b="hide";}a.text(c);a[b]();A._syncChildrenStates();},_uiSetTitle:function(b){var A=this;var a=A.get("boundingBox");a.setAttribute("title",b);}}});R.ButtonItem=R.Base.build(J,V,[R.WidgetChild],{dynamic:false});},"1.0.1",{skinnable:true,requires:["aui-base","aui-state-interaction","widget-child"]});