AUI.add("aui-toolbar",function(O){var F=O.Lang,M=F.isString,V="horizontal",I="toolbar",S="orientation",T="toolbarspacer",P="vertical",J=O.ClassNameManager.getClassName,H=J(I,"first"),N=J(I,V),L=J(I,"item"),G=J(I,"item","content"),B=J(I,"last"),D=J(I,P),R=function(A){return(A instanceof O.ButtonItem);},Q=function(A){return(A instanceof O.ToolbarSpacer);},K="<span></span>";var C=O.Component.create({NAME:I,ATTRS:{activeState:{},defaultState:{},hoverState:{},defaultChildType:{value:"ButtonItem"},orientation:{value:V,validator:function(A){return M(A)&&(A===V||A===P);}}},UI_ATTRS:[S],prototype:{BOUNDING_TEMPLATE:K,CONTENT_TEMPLATE:K,initializer:function(){var A=this;O.Do.before(A._addByIconId,A,"add");},bindUI:function(){var A=this;A.on("addChild",A._onAddButton);A.after("addChild",A._afterAddButton);A.after("removeChild",A._afterRemoveButton);},syncUI:function(){var A=this;var Y=A.size()-1;var X=-1;var W=-1;A.each(function(a,Z,b){var c=a.get("boundingBox");if(R(a)){if(X==-1){X=Z;}else{W=Z;}c.toggleClass(H,Z==X);c.toggleClass(B,Z==Y);c.addClass(L);}else{if(Z==X+1){W=X;}if(W!=-1){b.item(W).get("boundingBox").toggleClass(B,true);}X=-1;W=-1;}});},_addByIconId:function(W){var A=this;if(F.isString(W)){var X={icon:W};return new O.Do.AlterArgs(null,[X]);}},_afterAddButton:function(W){var A=this;A.syncUI();},_afterRemoveButton:function(W){var A=this;W.child.destroy();A.syncUI();},_uiSetOrientation:function(Y){var A=this;var X=A.get("boundingBox");var W=(Y==V);X.toggleClass(N,W);X.toggleClass(D,!W);}}});var U=O.Component.create({NAME:T,ATTRS:{},prototype:{BOUNDING_TEMPLATE:K,CONTENT_TEMPLATE:null}});O.ToolbarSpacer=O.Base.build(I,U,[O.WidgetChild],{dynamic:false});var E=function(){var A=this;A._CHILD_MAP=new O.DataSet();A.on("addChild",A._onAddChildById);A.after("addChild",A._afterAddChildById);A.after("removeChild",A._afterRemoveChildById);O.Do.before(A._findById,A,"item");O.Do.before(A._findById,A,"remove");};E.prototype={_afterAddChildById:function(W){var A=this;var X=W.child.get("id");A._CHILD_MAP.insert(W.index,X,W.child);},_afterRemoveChildById:function(W){var A=this;var X=W.child.get("id");A._CHILD_MAP.removeKey(X);},_findById:function(X){var A=this;if(F.isString(X)){var W=A._CHILD_MAP.indexOfKey(X);return new O.Do.AlterArgs(null,[W]);}},_getItemById:function(X){var A=this;var W=-1;if(F.isString(X)){W=A._CHILD_MAP[X];}return W;},_onAddChildById:function(W){var A=this;var X=W.child.get("id");if(A._CHILD_MAP.indexOfKey(X)>-1){W.preventDefault();}}};O.Toolbar=O.Base.build(I,C,[O.WidgetParent,E],{dynamic:false});},"1.0.1",{skinnable:true,requires:["aui-base","aui-button-item","aui-data-set","widget-parent"]});