iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 25.1 kB
JavaScript
export const __rspack_esm_id=19112;export const __rspack_esm_ids=[19112];export const __webpack_modules__={5911(e,t,a){a.d(t,{$:()=>l});a(44114);const l=(e,t)=>{const a={};for(const l of e){const e=t(l);e in a?a[e].push(l):a[e]=[l]}return a}},48091(e,t,a){a.a(e,async function(e,t){try{a(74423),a(44114),a(18111),a(22489),a(20116),a(7588),a(61701),a(18237),a(13579),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(46058);var l=a(62826),i=a(35211),o=a(34271),s=a(5124),d=a(22441),r=a(6412),c=a(63672),n=a(89784),h=a(22786),_=(a(46190),a(26218)),p=a(50248),u=a(1087),m=a(52220),b=a(9899),g=a(5911),f=a(12587),w=a(22792),v=a(14503),x=a(85614),y=(a(9503),a(67094),a(36866)),k=a(59541),C=e([y]);y=(C.then?(await C)():C)[0];const R="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",$="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",D="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",S="zzzzz_undefined",L=["BODY","HTML","HOME-ASSISTANT"];class H extends s.WF{clearSelection(){this._checkedRows=[],this._lastSelectedRowId=null,this._checkedRowsChanged()}selectAll(){this._checkedRows=this._filteredData.filter(e=>!1!==e.selectable).map(e=>e[this.id]),this._lastSelectedRowId=null,this._checkedRowsChanged()}select(e,t){t&&(this._checkedRows=[]),e.forEach(e=>{const t=this._filteredData.find(t=>t[this.id]===e);!1===t?.selectable||this._checkedRows.includes(e)||this._checkedRows.push(e)}),this._lastSelectedRowId=null,this._checkedRowsChanged()}unselect(e){e.forEach(e=>{const t=this._checkedRows.indexOf(e);t>-1&&this._checkedRows.splice(t,1)}),this._lastSelectedRowId=null,this._checkedRowsChanged()}connectedCallback(){super.connectedCallback(),this._filteredData.length&&(this._filteredData=[...this._filteredData])}firstUpdated(){this.updateComplete.then(()=>this._calcTableHeight())}updated(e){if(!this._headerRow)return;this._headerRow.scrollWidth>this._headerRow.clientWidth?this.style.setProperty("--table-row-width",`${this._headerRow.scrollWidth}px`):this.style.removeProperty("--table-row-width");const t=(0,p.n)();(e.has("selectable")||!this.autoHeight&&t&&L.includes(t.tagName))&&this._focusScroller()}willUpdate(e){if(super.willUpdate(e),this.hasUpdated||(0,x.i)(),e.has("columns")){if(this._filterable=Object.values(this.columns).some(e=>e.filterable),!this.sortColumn)for(const e in this.columns)if(this.columns[e].direction){this.sortDirection=this.columns[e].direction,this.sortColumn=e,this._lastSelectedRowId=null,(0,u.r)(this,"sorting-changed",{column:e,direction:this.sortDirection});break}const e=(0,o.A)(this.columns);Object.values(e).forEach(e=>{delete e.title,delete e.template,delete e.extraTemplate}),this._sortColumns=e}if(e.has("filter")&&(this._debounceSearch(this.filter),this._lastSelectedRowId=null),e.has("data")){if(this._checkedRows.length){const e=new Set(this.data.map(e=>String(e[this.id]))),t=this._checkedRows.filter(t=>e.has(t));t.length!==this._checkedRows.length&&(this._checkedRows=t,this._checkedRowsChanged())}this._checkableRowsCount=this.data.filter(e=>!1!==e.selectable).length}!this.hasUpdated&&this.initialCollapsedGroups?(this._collapsedGroups=this.initialCollapsedGroups,this._lastSelectedRowId=null,(0,u.r)(this,"collapsed-changed",{value:this._collapsedGroups})):e.has("groupColumn")&&(this._collapsedGroups=[],this._lastSelectedRowId=null,(0,u.r)(this,"collapsed-changed",{value:this._collapsedGroups})),(e.has("data")||e.has("columns")||e.has("_filter")||e.has("sortColumn")||e.has("sortDirection"))&&this._sortFilterData(),(e.has("_filter")||e.has("sortColumn")||e.has("sortDirection"))&&(this._lastSelectedRowId=null),(e.has("selectable")||e.has("hiddenColumns"))&&(this._filteredData=[...this._filteredData])}render(){const e=this._sortedColumns(this.columns,this.columnOrder);return s.qy` <div class="mdc-data-table"> <slot name="header" ="${this._calcTableHeight}"> ${this._filterable?s.qy` <div class="table-header"> <ha-input-search appearance="outlined" ="${this._handleSearchChange}" .placeholder="${this.searchLabel}"></ha-input-search> </div> `:""} </slot> <div class="mdc-data-table__table ${(0,r.H)({"auto-height":this.autoHeight})}" role="table" aria-rowcount="${this._filteredData.length+1}" style="${(0,n.W)({height:this.autoHeight?53*(this._filteredData.length||1)+53+"px":`calc(100% - ${this._headerHeight}px)`})}"> <div class="mdc-data-table__header-row" role="row" aria-rowindex="1" ="${this._scrollContent}"> <slot name="header-row"> ${this.selectable?s.qy` <div class="mdc-data-table__header-cell mdc-data-table__header-cell--checkbox" role="columnheader"> <ha-checkbox class="mdc-data-table__row-checkbox" ="${this._handleHeaderRowCheckboxClick}" .indeterminate="${!!this._checkedRows.length&&this._checkedRows.length!==this._checkableRowsCount}" .checked="${!!this._checkedRows.length&&this._checkedRows.length===this._checkableRowsCount}"> </ha-checkbox> </div> `:""} ${Object.entries(e).map(([e,t])=>{if(t.hidden||(this.columnOrder&&this.columnOrder.includes(e)?this.hiddenColumns?.includes(e)??t.defaultHidden:t.defaultHidden))return s.s6;const a=e===this.sortColumn,l={"mdc-data-table__header-cell--numeric":"numeric"===t.type,"mdc-data-table__header-cell--icon":"icon"===t.type,"mdc-data-table__header-cell--icon-button":"icon-button"===t.type,"mdc-data-table__header-cell--overflow-menu":"overflow-menu"===t.type,"mdc-data-table__header-cell--overflow":"overflow"===t.type,sortable:Boolean(t.sortable),"not-sorted":Boolean(t.sortable&&!a)};return s.qy` <div aria-label="${(0,c.J)(t.label)}" class="mdc-data-table__header-cell ${(0,r.H)(l)}" style="${(0,n.W)({minWidth:t.minWidth,maxWidth:t.maxWidth,flex:t.flex||1})}" role="columnheader" aria-sort="${(0,c.J)(a?"desc"===this.sortDirection?"descending":"ascending":void 0)}" ="${this._handleHeaderClick}" .columnId="${e}" title="${(0,c.J)(t.title)}"> ${t.sortable?s.qy` <ha-svg-icon .path="${a&&"desc"===this.sortDirection?R:$}"></ha-svg-icon> `:""} <span>${t.title}</span> </div> `})} </slot> </div> ${this._filteredData.length?s.qy` <lit-virtualizer scroller class="mdc-data-table__content scroller ha-scrollbar" tabindex="${(0,c.J)(this.autoHeight?void 0:"0")}" ="${this._saveScrollPos}" .items="${this._groupData(this._filteredData,this._i18n?.localize,this._i18n?.locale,this.appendRow,this.groupColumn,this.groupOrder,this._collapsedGroups,this.sortColumn,this.sortDirection)}" .keyFunction="${this._keyFunction}" .renderItem="${(t,a)=>this._renderRow(e,this.narrow,t,a)}"></lit-virtualizer> `:s.qy` <div class="mdc-data-table__content"> <div class="mdc-data-table__row" role="row"> <div class="mdc-data-table__cell grows center" role="cell"> ${this.noDataText||this._i18n?.localize?.("ui.components.data-table.no-data")||"No data"} </div> </div> </div> `} </div> </div> `}async _sortFilterData(){const e=(new Date).getTime(),t=e-this._lastUpdate,a=e-this._curRequest;this._curRequest=e;const l=!this._lastUpdate||t>500&&a<500;let i=this.data;if(this._filter&&(i=await this._memFilterData(this.data,this._sortColumns,this._filter.trim())),!l&&this._curRequest!==e)return;const o=this.sortColumn&&this._sortColumns[this.sortColumn]?(0,k.L)(i,this._sortColumns[this.sortColumn],this.sortDirection,this.sortColumn,this._i18n?.locale?.language):i,[s]=await Promise.all([o,f.E]),d=(new Date).getTime()-e;d<100&&await new Promise(e=>{setTimeout(e,100-d)}),(l||this._curRequest===e)&&(this._lastUpdate=e,this._filteredData=s)}_handleHeaderClick(e){const t=e.currentTarget.columnId;this.columns[t].sortable&&(this.sortDirection&&this.sortColumn===t&&"asc"===this.sortDirection?this.sortDirection="desc":this.sortDirection="asc",this.sortColumn=t,(0,u.r)(this,"sorting-changed",{column:t,direction:this.sortDirection}),this._focusScroller())}_handleHeaderRowCheckboxClick(e){e.target.checked?this.selectAll():(this._checkedRows=[],this._checkedRowsChanged()),this._lastSelectedRowId=null}_selectRange(e,t,a){const l=Math.min(t,a),i=Math.max(t,a),o=[];for(let t=l;t<=i;t++){const a=e[t];a&&!1!==a.selectable&&!this._checkedRows.includes(a[this.id])&&o.push(a[this.id])}return o}_setTitle(e){e.currentTarget.scrollWidth>e.currentTarget.offsetWidth&&e.currentTarget.setAttribute("title",e.currentTarget.innerText)}_checkedRowsChanged(){this._filteredData.length&&(this._filteredData=[...this._filteredData]),(0,u.r)(this,"selection-changed",{value:this._checkedRows})}_handleSearchChange(e){this.filter||(this._lastSelectedRowId=null,this._debounceSearch(e.target.value))}_focusScroller(){this._scroller?.focus({preventScroll:!0})}async _calcTableHeight(){this.autoHeight||(await this.updateComplete,this._headerHeight=this._header.clientHeight)}_saveScrollPos(e){this._savedScrollPos=e.target.scrollTop,this._headerRow&&(this._headerRow.scrollLeft=e.target.scrollLeft)}_scrollContent(e){this._scroller&&(this._scroller.scrollLeft=e.target.scrollLeft)}expandAllGroups(){this._collapsedGroups=[],this._lastSelectedRowId=null,(0,u.r)(this,"collapsed-changed",{value:this._collapsedGroups})}collapseAllGroups(){if(!this.groupColumn||!this.data.some(e=>e[this.groupColumn]))return;const e=(0,g.$)(this.data,e=>e[this.groupColumn]);e.undefined&&(e[S]=e.undefined,delete e.undefined),this._collapsedGroups=Object.keys(e),this._lastSelectedRowId=null,(0,u.r)(this,"collapsed-changed",{value:this._collapsedGroups})}static get styles(){return[v.dp,s.AH`:host{height:100%}.mdc-data-table__content{font-family:var(--ha-font-family-body);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);-webkit-font-smoothing:var(--ha-font-smoothing);font-size:.875rem;line-height:var(--ha-line-height-condensed);font-weight:var(--ha-font-weight-normal);letter-spacing:.0178571429em;text-decoration:inherit;text-transform:inherit}.mdc-data-table{background-color:var(--data-table-background-color);border-radius:var(--ha-border-radius-sm);border-width:1px;border-style:solid;border-color:var(--divider-color);display:inline-flex;flex-direction:column;box-sizing:border-box;overflow:hidden}.mdc-data-table__row--selected{background-color:rgba(var(--rgb-primary-color),.04)}.mdc-data-table__row{display:flex;height:var(--data-table-row-height,52px);width:var(--table-row-width,100%)}.mdc-data-table__row.empty-row{height:var(--data-table-empty-row-height,var(--safe-area-inset-bottom,0px))}.mdc-data-table__row~.mdc-data-table__row{border-top:1px solid var(--divider-color)}.mdc-data-table__row.clickable:not(
.mdc-data-table__row--selected
):hover{background-color:rgba(var(--rgb-primary-text-color),.04)}.mdc-data-table__header-cell{color:var(--primary-text-color)}.mdc-data-table__cell{color:var(--primary-text-color)}.mdc-data-table__header-row{height:56px;display:flex;border-bottom:1px solid var(--divider-color);overflow:auto}.mdc-data-table__header-row::-webkit-scrollbar{display:none}.mdc-data-table__header-row{-ms-overflow-style:none;scrollbar-width:none}.mdc-data-table__cell,.mdc-data-table__header-cell{padding-right:16px;padding-left:16px;min-width:150px;align-self:center;overflow:hidden;text-overflow:ellipsis;flex-shrink:0;box-sizing:border-box}.mdc-data-table__cell.mdc-data-table__cell--flex{display:flex;overflow:initial}.mdc-data-table__cell.mdc-data-table__cell--icon{overflow:initial}.mdc-data-table__cell--checkbox,.mdc-data-table__header-cell--checkbox{padding-left:16px;padding-right:0;padding-inline-start:16px;padding-inline-end:initial;width:60px;min-width:60px}.mdc-data-table__table{height:100%;width:100%;border:0;white-space:nowrap;position:relative}.mdc-data-table__cell{font-family:var(--ha-font-family-body);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);-webkit-font-smoothing:var(--ha-font-smoothing);font-size:.875rem;line-height:var(--ha-line-height-condensed);font-weight:var(--ha-font-weight-normal);letter-spacing:.0178571429em;text-decoration:inherit;text-transform:inherit;flex-grow:0;flex-shrink:0}.mdc-data-table__cell a{color:inherit;text-decoration:none}.mdc-data-table__cell--numeric{text-align:var(--float-end);direction:ltr}.mdc-data-table__cell--icon{color:var(--secondary-text-color);text-align:center}.mdc-data-table__cell--icon,.mdc-data-table__header-cell--icon{min-width:64px;flex:0 0 64px!important}.mdc-data-table__cell--icon img{width:24px;height:24px}.mdc-data-table__header-cell.mdc-data-table__header-cell--icon{text-align:center}.mdc-data-table__header-cell.sortable.mdc-data-table__header-cell--icon:hover,.mdc-data-table__header-cell.sortable.mdc-data-table__header-cell--icon:not(
.not-sorted
){text-align:var(--float-start)}.mdc-data-table__cell--icon:first-child ha-domain-icon,.mdc-data-table__cell--icon:first-child ha-icon,.mdc-data-table__cell--icon:first-child ha-service-icon,.mdc-data-table__cell--icon:first-child ha-state-icon,.mdc-data-table__cell--icon:first-child ha-svg-icon,.mdc-data-table__cell--icon:first-child img{margin-left:8px;margin-inline-start:8px;margin-inline-end:initial}.mdc-data-table__cell--icon:first-child state-badge{margin-right:-8px;margin-inline-end:-8px;margin-inline-start:initial}.mdc-data-table__cell--icon-button,.mdc-data-table__cell--overflow-menu,.mdc-data-table__header-cell--icon-button,.mdc-data-table__header-cell--overflow-menu{min-width:64px;flex:0 0 64px!important;padding:8px}.mdc-data-table__cell--icon-button,.mdc-data-table__header-cell--icon-button{min-width:56px;width:56px}.mdc-data-table__cell--icon-button,.mdc-data-table__cell--overflow-menu{color:var(--secondary-text-color);text-overflow:clip}.mdc-data-table__cell--icon-button:first-child,.mdc-data-table__cell--icon-button:last-child,.mdc-data-table__header-cell--icon-button:first-child,.mdc-data-table__header-cell--icon-button:last-child{width:64px}.mdc-data-table__cell--icon-button:first-child,.mdc-data-table__cell--overflow-menu:first-child,.mdc-data-table__header-cell--icon-button:first-child,.mdc-data-table__header-cell--overflow-menu:first-child{padding-left:16px;padding-inline-start:16px;padding-inline-end:initial}.mdc-data-table__cell--icon-button:last-child,.mdc-data-table__cell--overflow-menu:last-child,.mdc-data-table__header-cell--icon-button:last-child,.mdc-data-table__header-cell--overflow-menu:last-child{padding-right:16px;padding-inline-end:16px;padding-inline-start:initial}.mdc-data-table__cell--overflow,.mdc-data-table__cell--overflow-menu,.mdc-data-table__header-cell--overflow,.mdc-data-table__header-cell--overflow-menu{overflow:initial}.mdc-data-table__cell--icon-button a{color:var(--secondary-text-color)}.mdc-data-table__header-cell{font-family:var(--ha-font-family-body);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);-webkit-font-smoothing:var(--ha-font-smoothing);font-size:var(--ha-font-size-s);line-height:var(--ha-line-height-normal);font-weight:var(--ha-font-weight-medium);letter-spacing:.0071428571em;text-decoration:inherit;text-transform:inherit;text-align:var(--float-start)}.mdc-data-table__header-cell--numeric{text-align:var(--float-end)}.mdc-data-table__header-cell--numeric.sortable:hover,.mdc-data-table__header-cell--numeric.sortable:not(.not-sorted){text-align:var(--float-start)}.group-header{padding-top:12px;height:var(--data-table-row-height,52px);padding-left:12px;padding-inline-start:12px;padding-inline-end:initial;width:100%;font-weight:var(--ha-font-weight-medium);display:flex;align-items:center;cursor:pointer;background-color:var(--primary-background-color)}.group-header ha-icon-button{transition:transform .2s ease}.group-header ha-icon-button.collapsed{transform:rotate(180deg)}:host{display:block}.mdc-data-table{display:block;border-width:var(--data-table-border-width,1px);height:100%}.mdc-data-table__header-cell{overflow:hidden;position:relative}.mdc-data-table__header-cell span{position:relative;left:0px;inset-inline-start:0px;inset-inline-end:initial}.mdc-data-table__header-cell.sortable{cursor:pointer}.mdc-data-table__header-cell>*{transition:var(--float-start) .2s ease}.mdc-data-table__header-cell--numeric>span{transition:none}.mdc-data-table__header-cell ha-svg-icon{top:-3px;position:absolute}.mdc-data-table__header-cell.not-sorted ha-svg-icon{left:-20px;inset-inline-start:-20px;inset-inline-end:initial}.mdc-data-table__header-cell.sortable.not-sorted:hover span,.mdc-data-table__header-cell.sortable:not(.not-sorted) span{left:24px;inset-inline-start:24px;inset-inline-end:initial}.mdc-data-table__header-cell.sortable:hover.not-sorted ha-svg-icon,.mdc-data-table__header-cell.sortable:not(.not-sorted) ha-svg-icon{left:12px;inset-inline-start:12px;inset-inline-end:initial}.table-header{border-bottom:1px solid var(--divider-color)}ha-input-search{flex:1;padding:var(--ha-space-3)}slot[name=header]{display:block}.center{text-align:center}.secondary{color:var(--secondary-text-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scroller{height:calc(100% - 57px);overflow:overlay!important}.mdc-data-table__table.auto-height .scroller{overflow-y:hidden!important}.mdc-data-table__table.auto-height lit-virtualizer{overscroll-behavior-y:auto}.grows{flex-grow:1;flex-shrink:1}.forceLTR{direction:ltr}.clickable{cursor:pointer}lit-virtualizer{contain:size layout!important;overscroll-behavior:contain}lit-virtualizer:focus,lit-virtualizer:focus-visible{outline:0}ha-checkbox{padding:var(--ha-space-1)}`]}constructor(...e){super(...e),this.narrow=!1,this.columns={},this.data=[],this.selectable=!1,this.clickable=!1,this.autoHeight=!1,this.id="id",this.filter="",this.sortDirection=null,this._filterable=!1,this._filter="",this._filteredData=[],this._headerHeight=0,this._collapsedGroups=[],this._lastSelectedRowId=null,this._checkedRows=[],this._sortColumns={},this._curRequest=0,this._lastUpdate=0,this._debounceSearch=(0,b.s)(e=>{this._filter=e},100,!1),this._sortedColumns=(0,h.A)((e,t)=>t&&t.length?Object.keys(e).sort((a,l)=>{const i=t.indexOf(a),o=t.indexOf(l),s=Boolean(e[a].lastFixed);if(s!==Boolean(e[l].lastFixed))return s?1:-1;if(i!==o){if(-1===i)return 1;if(-1===o)return-1}return i-o}).reduce((t,a)=>(t[a]=e[a],t),{}):e),this._keyFunction=e=>e?.[this.id]||e,this._renderRow=(e,t,a,l)=>a?a.append?s.qy`<div class="mdc-data-table__row">${a.content}</div>`:a.empty?s.qy`<div class="mdc-data-table__row empty-row"></div>`:s.qy` <div aria-rowindex="${l+2}" role="row" .rowId="${a[this.id]}" ="${this._handleRowClick}" class="mdc-data-table__row ${(0,r.H)({"mdc-data-table__row--selected":this._checkedRows.includes(String(a[this.id])),clickable:this.clickable})}" aria-selected="${(0,c.J)(!!this._checkedRows.includes(String(a[this.id]))||void 0)}" .selectable="${!1!==a.selectable}"> ${this.selectable?s.qy` <div class="mdc-data-table__cell mdc-data-table__cell--checkbox" role="cell"> <ha-checkbox class="mdc-data-table__row-checkbox" ="${this._handleRowCheckboxClicked}" .rowId="${a[this.id]}" .disabled="${!1===a.selectable}" .checked="${this._checkedRows.includes(String(a[this.id]))}"> </ha-checkbox> </div> `:""} ${Object.entries(e).map(([l,i])=>t&&!i.main&&!i.showNarrow||i.hidden||(this.columnOrder&&this.columnOrder.includes(l)?this.hiddenColumns?.includes(l)??i.defaultHidden:i.defaultHidden)?s.s6:s.qy` <div ="${this._setTitle}" ="${this._setTitle}" role="${i.main?"rowheader":"cell"}" class="mdc-data-table__cell ${(0,r.H)({"mdc-data-table__cell--flex":"flex"===i.type,"mdc-data-table__cell--numeric":"numeric"===i.type,"mdc-data-table__cell--icon":"icon"===i.type,"mdc-data-table__cell--icon-button":"icon-button"===i.type,"mdc-data-table__cell--overflow-menu":"overflow-menu"===i.type,"mdc-data-table__cell--overflow":"overflow"===i.type,forceLTR:Boolean(i.forceLTR)})}" style="${(0,n.W)({minWidth:i.minWidth,maxWidth:i.maxWidth,flex:i.flex||1})}"> ${i.template?i.template(a):t&&i.main?s.qy`<div class="primary">${a[l]}</div> <div class="secondary"> ${Object.entries(e).filter(([e,t])=>!(t.hidden||t.main||t.showNarrow||(this.columnOrder&&this.columnOrder.includes(e)?this.hiddenColumns?.includes(e)??t.defaultHidden:t.defaultHidden))).map(([e,t],l)=>s.qy`${0!==l?" · ":s.s6}${t.template?t.template(a):a[e]}`)} </div> ${i.extraTemplate?i.extraTemplate(a):s.s6}`:s.qy`${a[l]}${i.extraTemplate?i.extraTemplate(a):s.s6}`} </div> `)} </div> `:s.s6,this._groupData=(0,h.A)((e,t,a,l,i,o,d,r,c)=>{if(l||i){let n=[...e];if(i){const e=r===i,l=(0,g.$)(n,e=>e[i]);l.undefined&&(l[S]=l.undefined,delete l.undefined);const h=Object.keys(l).sort((t,l)=>{if(!o&&e){const e=(0,m.xL)(t,l,a?.language);return"asc"===c?e:-1*e}const i=o?.indexOf(t)??-1,s=o?.indexOf(l)??-1;return i!==s?-1===i?1:-1===s?-1:i-s:(0,m.xL)(["","-","—"].includes(t)?"zzz":t,["","-","—"].includes(l)?"zzz":l,a?.language)}).reduce((e,t)=>{const a=[t,l[t]];return e.push(a),e},[]),_=[];h.forEach(([e,a])=>{const l=d.includes(e);_.push({append:!0,selectable:!1,content:s.qy`<div class="mdc-data-table__cell group-header" role="cell" .group="${e}" ="${this._collapseGroup}"> <ha-icon-button .path="${D}" .label="${t?.("ui.components.data-table."+(l?"expand":"collapse"))||(l?"Expand":"Collapse")}" class="${l?"collapsed":""}"> </ha-icon-button> ${e===S?t?.("ui.components.data-table.ungrouped")||"Ungrouped":e||""} </div>`}),d.includes(e)||_.push(...a)}),n=_}return l&&n.push({append:!0,selectable:!1,content:l}),n.push({empty:!0}),n}return[...e,{empty:!0}]}),this._memFilterData=(0,h.A)((e,t,a)=>(0,k.B)(e,t,a)),this._handleRowCheckboxClicked=e=>{if(!(e.composedPath()[0]instanceof HTMLInputElement||e.shiftKey))return;e.composedPath()[0]instanceof HTMLInputElement&&e.shiftKey&&e.preventDefault();const t=e.currentTarget,a=t.rowId,l=this._groupData(this._filteredData,this._i18n?.localize,this._i18n?.locale,this.appendRow,this.groupColumn,this.groupOrder,this._collapsedGroups,this.sortColumn,this.sortDirection);if(!1===l.find(e=>e[this.id]===a)?.selectable)return;const i=l.findIndex(e=>e[this.id]===a);if(e instanceof MouseEvent&&e.shiftKey&&null!==this._lastSelectedRowId){const e=l.findIndex(e=>e[this.id]===this._lastSelectedRowId);e>-1&&i>-1&&(this._checkedRows=[...this._checkedRows,...this._selectRange(l,e,i)])}else t.checked?this._checkedRows.includes(a)||(this._checkedRows=[...this._checkedRows,a]):this._checkedRows=this._checkedRows.filter(e=>e!==a);i>-1&&(this._lastSelectedRowId=a),this._checkedRowsChanged()},this._handleRowClick=e=>{if(e.composedPath().find(e=>["ha-checkbox","ha-button","ha-button","ha-icon-button","ha-assist-chip"].includes(e.localName)))return;const t=e.currentTarget.rowId;(0,u.r)(this,"row-click",{id:t},{bubbles:!1})},this._collapseGroup=e=>{const t=e.currentTarget.group;this._collapsedGroups.includes(t)?this._collapsedGroups=this._collapsedGroups.filter(e=>e!==t):this._collapsedGroups=[...this._collapsedGroups,t],this._lastSelectedRowId=null,(0,u.r)(this,"collapsed-changed",{value:this._collapsedGroups})}}}(0,l.Cg)([(0,d.wk)(),(0,i.Fg)({context:w.D5,subscribe:!0})],H.prototype,"_i18n",void 0),(0,l.Cg)([(0,d.MZ)({type:Boolean})],H.prototype,"narrow",void 0),(0,l.Cg)([(0,d.MZ)({type:Object})],H.prototype,"columns",void 0),(0,l.Cg)([(0,d.MZ)({type:Array})],H.prototype,"data",void 0),(0,l.Cg)([(0,d.MZ)({type:Boolean})],H.prototype,"selectable",void 0),(0,l.Cg)([(0,d.MZ)({type:Boolean})],H.prototype,"clickable",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"appendRow",void 0),(0,l.Cg)([(0,d.MZ)({type:Boolean,attribute:"auto-height"})],H.prototype,"autoHeight",void 0),(0,l.Cg)([(0,d.MZ)({type:String})],H.prototype,"id",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"noDataText",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"searchLabel",void 0),(0,l.Cg)([(0,d.MZ)({type:String})],H.prototype,"filter",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"groupColumn",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"groupOrder",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"sortColumn",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"sortDirection",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"initialCollapsedGroups",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"hiddenColumns",void 0),(0,l.Cg)([(0,d.MZ)({attribute:!1})],H.prototype,"columnOrder",void 0),(0,l.Cg)([(0,d.wk)()],H.prototype,"_filterable",void 0),(0,l.Cg)([(0,d.wk)()],H.prototype,"_filter",void 0),(0,l.Cg)([(0,d.wk)()],H.prototype,"_filteredData",void 0),(0,l.Cg)([(0,d.wk)()],H.prototype,"_headerHeight",void 0),(0,l.Cg)([(0,d.P)("slot[name='header']")],H.prototype,"_header",void 0),(0,l.Cg)([(0,d.P)(".mdc-data-table__header-row")],H.prototype,"_headerRow",void 0),(0,l.Cg)([(0,d.P)("lit-virtualizer")],H.prototype,"_scroller",void 0),(0,l.Cg)([(0,d.wk)()],H.prototype,"_collapsedGroups",void 0),(0,l.Cg)([(0,d.wk)()],H.prototype,"_lastSelectedRowId",void 0),(0,l.Cg)([(0,_.a)(".scroller")],H.prototype,"_savedScrollPos",void 0),(0,l.Cg)([(0,d.Ls)({passive:!0})],H.prototype,"_saveScrollPos",null),(0,l.Cg)([(0,d.Ls)({passive:!0})],H.prototype,"_scrollContent",null),H=(0,l.Cg)([(0,d.EM)("ha-data-table")],H),t()}catch(e){t(e)}})},59541(e,t,a){a.d(t,{B:()=>s,L:()=>d});a(14603),a(47566),a(98721);var l=a(2209);let i;const o=()=>(i||(i=(0,l.LV)(new Worker(new URL(a.p+a.u(44346),a.b)))),i),s=(e,t,a)=>o().filterData(e,t,a),d=(e,t,a,l,i)=>o().sortData(e,t,a,l,i)}};