YUI.add("datatable-head",function(g,e){var t=g.Lang,u=t.sub,m=t.isArray,a=g.Array;g.namespace("DataTable").HeaderView=g.Base.create("tableHeader",g.View,[],{CELL_TEMPLATE:'<th id="{id}" colspan="{_colspan}" rowspan="{_rowspan}" class="{className}" scope="col" {_id}{abbr}{title}>{content}</th>',ROW_TEMPLATE:"<tr>{content}</tr>",THEAD_TEMPLATE:'<thead class="{className}"></thead>',getClassName:function(){var e=this.host,t=e&&e.constructor.NAME||this.constructor.NAME;return e&&e.getClassName?e.getClassName.apply(e,arguments):g.ClassNameManager.getClassName.apply(g.ClassNameManager,[t].concat(a(arguments,0,!0)))},render:function(){var e,t,a,s,n,l,r,i,h=this.get("container"),o=this.theadNode||(this.theadNode=this._createTHeadNode()),c=this.columns,d={_colspan:1,_rowspan:1,abbr:"",title:""};if(o&&c){if(l="",c.length)for(e=0,t=c.length;e<t;++e){for(r="",a=0,s=c[e].length;a<s;++a)n=c[e][a],(i=g.merge(d,n,{className:this.getClassName("header"),content:n.label||n.key||"Column "+(a+1)}))._id=n._id?' data-yui3-col-id="'+n._id+'"':"",n.abbr&&(i.abbr=' abbr="'+n.abbr+'"'),n.title&&(i.title=' title="'+n.title+'"'),n.className&&(i.className+=" "+n.className),n._first&&(i.className+=" "+this.getClassName("first","header")),n._id&&(i.className+=" "+this.getClassName("col",n._id)),r+=u(n.headerTemplate||this.CELL_TEMPLATE,i);l+=u(this.ROW_TEMPLATE,{content:r})}o.setHTML(l),o.get("parentNode")!==h&&h.insertBefore(o,h.one("tfoot, tbody"))}return this.bindUI(),this},_afterColumnsChange:function(e){this.columns=this._parseColumns(e.newVal),this.render()},bindUI:function(){this._eventHandles.columnsChange||(this._eventHandles.columnsChange=this.after("columnsChange",g.bind("_afterColumnsChange",this)))},_createTHeadNode:function(){return g.Node.create(u(this.THEAD_TEMPLATE,{className:this.getClassName("columns")}))},destructor:function(){new g.EventHandle(g.Object.values(this._eventHandles)).detach()},initializer:function(e){this.host=e.host,this.columns=this._parseColumns(e.columns),this._eventHandles=[]},_parseColumns:function(e){var t,a,s,n,l,r,i,h,o=[],c=[],d=1;if(m(e)&&e.length){for(e=e.slice(),c.push([e,-1]);c.length;){for(a=(t=c[c.length-1])[0],r=t[1]+1,i=a.length;r<i;++r){if(a[r]=s=g.merge(a[r]),n=s.children,g.stamp(s),s.id||(s.id=g.guid()),m(n)&&n.length){c.push([n,-1]),t[1]=r,d=Math.max(d,c.length);break}s._colspan=1}if(i<=r){if(1<c.length)for(r=(l=(t=c[c.length-2])[0][t[1]])._colspan=0,i=a.length;r<i;++r)(a[r]._parent=l)._colspan+=a[r]._colspan;c.pop()}}for(r=0;r<d;++r)o.push([]);for(c.push([e,-1]);c.length;){for(a=(t=c[c.length-1])[0],r=t[1]+1,i=a.length;r<i;++r){for(n=(s=a[r]).children,o[c.length-1].push(s),t[1]=r,s._headers=[s.id],h=c.length-2;0<=h;--h)l=c[h][0][c[h][1]],s._headers.unshift(l.id);if(n&&n.length){c.push([n,-1]);break}s._rowspan=d-c.length+1}i<=r&&c.pop()}}for(r=0,i=o.length;r<i;r+=s._rowspan)(s=o[r][0])._first=!0;return o}})},"patched-v3.18.4",{requires:["datatable-core","view","classnamemanager"]});