System.register(["./p-9910f372.system.js","./p-b771bfdd.system.js","./p-da7f8c42.system.js","./p-d42f9daa.system.js","./p-51ae20db.system.js","./p-4cf88a4b.system.js"],(function(e){"use strict";var t,n,r,o,i,s,u,a;return{setters:[function(e){t=e.r;n=e.c;r=e.h;o=e.g},function(){},function(e){i=e.T},function(){},function(e){s=e.T;u=e.R},function(e){a=e.T}],execute:function(){var l;(function(e){e["EXPAND_GROUP"]="Expand Group";e["COLLAPSE_GROUP"]="Collapse Group"})(l||(l={}));var p=e("anj_row_grouping",function(){function e(e){var r=this;t(this,e);this.columnsUpdatedListener=function(e){var t=e.detail;return r.onColumnsChanged(t)};this.autoExpand=false;this.row=this.renderGroup.bind(this);this.when=this.useAsRenderer.bind(this);this.anjColumnGroupChange=n(this,"anjColumnGroupChange",7);this.anjRowControlDidLoad=n(this,"anjRowControlDidLoad",7)}e.prototype.componentWillLoad=function(){this.table=this.element.closest("anj-table")};e.prototype.componentDidLoad=function(){this.anjRowControlDidLoad.emit();this.table.addEventListener("anjColumnsDidLoad",this.columnsUpdatedListener);this.table.addEventListener("anjColumnsDidUpdate",this.columnsUpdatedListener)};e.prototype.componentDidUnload=function(){this.table.removeEventListener("anjColumnsDidLoad",this.columnsUpdatedListener);this.table.removeEventListener("anjColumnsDidUpdate",this.columnsUpdatedListener)};e.prototype.onColumnsChanged=function(e){this.columns=e.filter((function(e){return e.groupIndex>-1})).sort((function(e,t){return e.groupIndex-t.groupIndex}))};e.prototype.renderGroup=function(e){var t={colspan:e.columns.length-1};var n=this.findGroup(e.row);return[r(s,{classList:i.rowGroupHeader},r("td",Object.assign({},t,{class:i.rowGroupHeader}),r("anj-headline",null,r("h4",null,n.headerRenderer(n.field,n.caption)+": "+e.row[n.field]))),r("td",null,this.groupControl(n,e.row))),this.isExpanded(n.groupKeys,e.row[n.groupKey])&&this.hasNestedGroup(e.row[n.groupKey])?e.row[n.groupKey].map((function(t,n){return r(u,Object.assign({},Object.assign(e,{rowIndex:e.rowIndex+n,row:t})))})):undefined]};e.prototype.groupClick=function(e,t){e.groupKeys=e.groupKeys?e.groupKeys.includes(t)?e.groupKeys.filter((function(e){return e!==t})):e.groupKeys.concat([t]):[t];this.anjColumnGroupChange.emit(e)};e.prototype.useAsRenderer=function(e){return!!this.findGroup(e)};e.prototype.findGroup=function(e){return this.columns.find((function(t){return e[t.groupKey]}))};e.prototype.hasNestedGroup=function(e){return e&&Array.isArray(e)&&e.length>0&&typeof e[0]==="object"};e.prototype.groupControl=function(e,t){var n=this;var o=t[e.field];var i=this.isExpanded(e.groupKeys,o);var s=i?this.translator(l.EXPAND_GROUP)+": "+o:this.translator(l.COLLAPSE_GROUP)+": "+o;var u=i?"M7.41 18.59L8.83 20 12 16.83 15.17 20l1.41-1.41L12 14l-4.59 4.59zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10l4.59-4.59z":"M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z";return r("anj-button",{ariaLabel:s,context:"free",onClick:function(){return n.groupClick(e,o)}},r("svg",{slot:"icon-only",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},r("path",{d:u})))};e.prototype.isExpanded=function(e,t){if(!e)return this.autoExpand;return this.autoExpand?!e.includes(t):e.includes(t)};e.prototype.render=function(){return r("anj-column",{internal:true,pinned:"right",editable:false,filterable:false,sizable:false,pinnable:false,orderable:false,selectable:false,sortable:false,name:"row-group-controls",width:"56px",cellRenderer:function(){return""},headerRenderer:function(){return""}})};Object.defineProperty(e.prototype,"element",{get:function(){return o(this)},enumerable:true,configurable:true});Object.defineProperty(e,"style",{get:function(){return".anj-table .anj-col-row-group-controls.anj-header-cell .anj-column-caption{overflow:visible;padding-right:0}.anj-table .anj-col-row-group-controls anj-button{margin:-.75rem}.anj-table .anj-row-group-header anj-headline h4{color:var(--anj-neutral-dark)}"},enumerable:true,configurable:true});return e}());a.injectProps(p,["translator"])}}}));