YUI.add("aui-toggler-delegate",function(e,t){var n=e.Lang,r=n.isBoolean,i=n.isObject,s=n.isString,o=e.Array,u=e.config.doc,a=e.Toggler,f=".",l="animated",c="click",h="closeAllOnExpand",p="collapsed",d="container",v="content",m="cubic-bezier(0, 0.1, 0, 1.0)",g="expanded",y="firstChild",b="header",w="keydown",E="toggler",S="toggler:animatingChange",x="toggler-delegate",T="transition",N="wrapper",C=e.getClassName,k=C(E,v,N),L=C(E,b,p),A=C(E,b,g),O=e.Component.create({NAME:x,ATTRS:{animated:{validator:r,value:!1,writeOnce:!0},closeAllOnExpand:{validator:r,value:!1},container:{setter:e.one,value:u},content:{validator:s},expanded:{validator:r,value:!0},header:{validator:s},transition:{validator:i,value:{duration:.4,easing:m}}},EXTENDS:e.Base,prototype:{items:null,initializer:function(){var e=this;e.items=[],e.bindUI(),e.renderUI()},renderUI:function(){var e=this;e.get(h)&&e.createAll()},bindUI:function(){var t=this,n=t.get(d),r=t.get(b);t._eventHandles=[n.delegate([c,w],e.bind("headerEventHandler",t),r),t.on(S,e.bind("_onAnimatingChange",t))]},destructor:function(){var t=this;o.each(t.items,function(e){e.destroy()}),t.items=null,(new e.EventHandle(t._eventHandles)).detach()},collapseAll:function(t){var n=this;n.createAll(),e.Array.invoke(n.items,"collapse",t)},createAll:function(){var e=this;e.get(d).all(e.get(b)).each(function(t){t.getData(E)||e._create(t)})},expandAll:function(t){var n=this;n.createAll(),e.Array.invoke(n.items,"expand",t)},findContentNode:function(e){var t=this,n=t.get(v),r=e.next(n)||e.one(n);if(!r){var i=e.next(f+k);i&&(r=i.get(y))}return r},headerEventHandler:function(e){var t=this;if(t.animating)return!1;var n=e.currentTarget,r=n.getData(E)||t._create(n);if(a.headerEventHandler(e,r)&&t.get(h)){var i=r.get(v).ancestor(t.get(v));o.each(t.items,function(e){if(e!==r&&e.get(g))if(i){var t=e.get(v);t!==i&&i.contains(t)&&e.collapse()}else e.collapse()})}},_create:function(e){var t=this,n=t.get(g);e.hasClass(A)?n=!0:e.hasClass(L)&&(n=!1);var r=new a({animated:t.get(l),bindDOMEvents:!1,bubbleTargets:[t],content:t.findContentNode(e),expanded:n,header:e,transition:t.get(T)});return t.items.push(r),r},_onAnimatingChange:function(e){var t=this;t.animating=e.newVal}}});e.TogglerDelegate=O},"2.0.0",{requires:["array-invoke","node-event-delegate","aui-toggler-base"]});
