System.register(["./p-ff3b0bee.system.js","./p-b771bfdd.system.js","./p-da7f8c42.system.js","./p-48aa49a2.system.js"],(function(e){"use strict";var t,n,i,l,a,r;return{setters:[function(e){t=e.r;n=e.c;i=e.g},function(e){l=e.i},function(e){a=e.k},function(e){r=e.T}],execute:function(){var s="td.anj-selectable";var o;(function(e){e["SELECT_CELL"]="Select Cell"})(o||(o={}));var c=e("anj_cell_selection",function(){function e(e){var i=this;t(this,e);this.cellClickListener=function(e){return i.onCellClick(e)};this.cellKeyListener=l(this.onCellClick.bind(this));this.tableWillUpdateListener=function(){return i.onTableWillChange()};this.tableDidUpdateListener=function(){return i.onTableDidChange()};this.anjCellSelect=n(this,"anjCellSelect",7)}e.prototype.componentWillLoad=function(){this.table=this.element.closest("anj-table")};e.prototype.componentDidLoad=function(){this.table.addEventListener("anjTableWillUpdate",this.tableWillUpdateListener);this.table.addEventListener("anjTableDidUpdate",this.tableDidUpdateListener)};e.prototype.componentDidUnload=function(){this.onTableWillChange();this.table.removeEventListener("anjTableWillUpdate",this.tableWillUpdateListener);this.table.removeEventListener("anjTableDidUpdate",this.tableDidUpdateListener)};e.prototype.onTableWillChange=function(){var e=this;Array.from(this.table.querySelectorAll(s)).forEach((function(t){t.removeEventListener("click",e.cellClickListener);t.removeEventListener("keyup",e.cellKeyListener)}))};e.prototype.onTableDidChange=function(){var e=this;Array.from(this.table.querySelectorAll(s)).forEach((function(t){t.tabIndex=0;t.setAttribute("aria-label",e.translator(o.SELECT_CELL));t.addEventListener("click",e.cellClickListener);t.addEventListener("keyup",e.cellKeyListener)}))};e.prototype.onCellClick=function(e){var t=e.target;var n=t.tagName==="TD"?t:t.closest("td");var i=n.dataset.columnField;var l=a(n.dataset.rowKey);this.anjCellSelect.emit({cell:n,columnField:i,rowKey:l})};Object.defineProperty(e.prototype,"element",{get:function(){return i(this)},enumerable:true,configurable:true});return e}());r.injectProps(c,["translator"])}}}));