iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 26.4 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[19112],{5911:function(e,t,a){a.d(t,{$:function(){return l}});a(44114),a(62953);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:function(e,t,a){a.a(e,async function(e,t){try{a(74423),a(44114),a(72712),a(26910),a(18111),a(22489),a(20116),a(7588),a(61701),a(18237),a(13579),a(3362),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(42762),a(46058),a(62953);var l=a(40445),i=a(35211),o=a(34271),d=a(5124),s=a(67576),r=a(6412),c=a(63672),n=a(89784),h=a(22786),_=(a(46190),a(26218)),u=a(50248),p=a(1087),m=a(52220),b=a(9899),f=a(5911),g=a(12587),v=a(22792),w=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];let R,$,D,S,L,z,T,H,I,M,O,G,q,Z,W,P,A,B=e=>e;const E="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",F="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",U="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",j="zzzzz_undefined",N=["BODY","HTML","HOME-ASSISTANT"];class J extends d.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===(null==t?void 0: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,u.n)();(e.has("selectable")||!this.autoHeight&&t&&N.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 t in this.columns)if(this.columns[t].direction){this.sortDirection=this.columns[t].direction,this.sortColumn=t,this._lastSelectedRowId=null,(0,p.r)(this,"sorting-changed",{column:t,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,p.r)(this,"collapsed-changed",{value:this._collapsedGroups})):e.has("groupColumn")&&(this._collapsedGroups=[],this._lastSelectedRowId=null,(0,p.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(){var e,t,a,l;const i=this._sortedColumns(this.columns,this.columnOrder);return(0,d.qy)(R||(R=B` <div class="mdc-data-table"> <slot name="header" ="${0}"> ${0} </slot> <div class="mdc-data-table__table ${0}" role="table" aria-rowcount="${0}" style="${0}"> <div class="mdc-data-table__header-row" role="row" aria-rowindex="1" ="${0}"> <slot name="header-row"> ${0} ${0} </slot> </div> ${0} </div> </div> `),this._calcTableHeight,this._filterable?(0,d.qy)($||($=B` <div class="table-header"> <ha-input-search appearance="outlined" ="${0}" .placeholder="${0}"></ha-input-search> </div> `),this._handleSearchChange,this.searchLabel):"",(0,r.H)({"auto-height":this.autoHeight}),this._filteredData.length+1,(0,n.W)({height:this.autoHeight?53*(this._filteredData.length||1)+53+"px":`calc(100% - ${this._headerHeight}px)`}),this._scrollContent,this.selectable?(0,d.qy)(D||(D=B` <div class="mdc-data-table__header-cell mdc-data-table__header-cell--checkbox" role="columnheader"> <ha-checkbox class="mdc-data-table__row-checkbox" ="${0}" .indeterminate="${0}" .checked="${0}"> </ha-checkbox> </div> `),this._handleHeaderRowCheckboxClick,!!this._checkedRows.length&&this._checkedRows.length!==this._checkableRowsCount,!!this._checkedRows.length&&this._checkedRows.length===this._checkableRowsCount):"",Object.entries(i).map(([e,t])=>{var a,l;if(t.hidden||(this.columnOrder&&this.columnOrder.includes(e)&&null!==(a=null===(l=this.hiddenColumns)||void 0===l?void 0:l.includes(e))&&void 0!==a?a:t.defaultHidden))return d.s6;const i=e===this.sortColumn,o={"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&&!i)};return(0,d.qy)(S||(S=B` <div aria-label="${0}" class="mdc-data-table__header-cell ${0}" style="${0}" role="columnheader" aria-sort="${0}" ="${0}" .columnId="${0}" title="${0}"> ${0} <span>${0}</span> </div> `),(0,c.J)(t.label),(0,r.H)(o),(0,n.W)({minWidth:t.minWidth,maxWidth:t.maxWidth,flex:t.flex||1}),(0,c.J)(i?"desc"===this.sortDirection?"descending":"ascending":void 0),this._handleHeaderClick,e,(0,c.J)(t.title),t.sortable?(0,d.qy)(L||(L=B` <ha-svg-icon .path="${0}"></ha-svg-icon> `),i&&"desc"===this.sortDirection?E:F):"",t.title)}),this._filteredData.length?(0,d.qy)(T||(T=B` <lit-virtualizer scroller class="mdc-data-table__content scroller ha-scrollbar" tabindex="${0}" ="${0}" .items="${0}" .keyFunction="${0}" .renderItem="${0}"></lit-virtualizer> `),(0,c.J)(this.autoHeight?void 0:"0"),this._saveScrollPos,this._groupData(this._filteredData,null===(a=this._i18n)||void 0===a?void 0:a.localize,null===(l=this._i18n)||void 0===l?void 0:l.locale,this.appendRow,this.groupColumn,this.groupOrder,this._collapsedGroups,this.sortColumn,this.sortDirection),this._keyFunction,(e,t)=>this._renderRow(i,this.narrow,e,t)):(0,d.qy)(z||(z=B` <div class="mdc-data-table__content"> <div class="mdc-data-table__row" role="row"> <div class="mdc-data-table__cell grows center" role="cell"> ${0} </div> </div> </div> `),this.noDataText||(null===(e=this._i18n)||void 0===e||null===(t=e.localize)||void 0===t?void 0:t.call(e,"ui.components.data-table.no-data"))||"No data"))}async _sortFilterData(){var e;const t=(new Date).getTime(),a=t-this._lastUpdate,l=t-this._curRequest;this._curRequest=t;const i=!this._lastUpdate||a>500&&l<500;let o=this.data;if(this._filter&&(o=await this._memFilterData(this.data,this._sortColumns,this._filter.trim())),!i&&this._curRequest!==t)return;const d=this.sortColumn&&this._sortColumns[this.sortColumn]?(0,k.L)(o,this._sortColumns[this.sortColumn],this.sortDirection,this.sortColumn,null===(e=this._i18n)||void 0===e||null===(e=e.locale)||void 0===e?void 0:e.language):o,[s]=await Promise.all([d,g.E]),r=(new Date).getTime()-t;r<100&&await new Promise(e=>{setTimeout(e,100-r)}),(i||this._curRequest===t)&&(this._lastUpdate=t,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,p.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 d=l;d<=i;d++){const t=e[d];t&&!1!==t.selectable&&!this._checkedRows.includes(t[this.id])&&o.push(t[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,p.r)(this,"selection-changed",{value:this._checkedRows})}_handleSearchChange(e){this.filter||(this._lastSelectedRowId=null,this._debounceSearch(e.target.value))}_focusScroller(){var e;null===(e=this._scroller)||void 0===e||e.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,p.r)(this,"collapsed-changed",{value:this._collapsedGroups})}collapseAllGroups(){if(!this.groupColumn||!this.data.some(e=>e[this.groupColumn]))return;const e=(0,f.$)(this.data,e=>e[this.groupColumn]);e.undefined&&(e[j]=e.undefined,delete e.undefined),this._collapsedGroups=Object.keys(e),this._lastSelectedRowId=null,(0,p.r)(this,"collapsed-changed",{value:this._collapsedGroups})}static get styles(){return[w.dp,(0,d.AH)(H||(H=B`: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),d=Boolean(e[a].lastFixed);if(d!==Boolean(e[l].lastFixed))return d?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=>(null==e?void 0:e[this.id])||e,this._renderRow=(e,t,a,l)=>a?a.append?(0,d.qy)(I||(I=B`<div class="mdc-data-table__row">${0}</div>`),a.content):a.empty?(0,d.qy)(M||(M=B`<div class="mdc-data-table__row empty-row"></div>`)):(0,d.qy)(O||(O=B` <div aria-rowindex="${0}" role="row" .rowId="${0}" ="${0}" class="mdc-data-table__row ${0}" aria-selected="${0}" .selectable="${0}"> ${0} ${0} </div> `),l+2,a[this.id],this._handleRowClick,(0,r.H)({"mdc-data-table__row--selected":this._checkedRows.includes(String(a[this.id])),clickable:this.clickable}),(0,c.J)(!!this._checkedRows.includes(String(a[this.id]))||void 0),!1!==a.selectable,this.selectable?(0,d.qy)(G||(G=B` <div class="mdc-data-table__cell mdc-data-table__cell--checkbox" role="cell"> <ha-checkbox class="mdc-data-table__row-checkbox" ="${0}" .rowId="${0}" .disabled="${0}" .checked="${0}"> </ha-checkbox> </div> `),this._handleRowCheckboxClicked,a[this.id],!1===a.selectable,this._checkedRows.includes(String(a[this.id]))):"",Object.entries(e).map(([l,i])=>{var o,s;return t&&!i.main&&!i.showNarrow||i.hidden||(this.columnOrder&&this.columnOrder.includes(l)&&null!==(o=null===(s=this.hiddenColumns)||void 0===s?void 0:s.includes(l))&&void 0!==o?o:i.defaultHidden)?d.s6:(0,d.qy)(q||(q=B` <div ="${0}" ="${0}" role="${0}" class="mdc-data-table__cell ${0}" style="${0}"> ${0} </div> `),this._setTitle,this._setTitle,i.main?"rowheader":"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)}),(0,n.W)({minWidth:i.minWidth,maxWidth:i.maxWidth,flex:i.flex||1}),i.template?i.template(a):t&&i.main?(0,d.qy)(Z||(Z=B`<div class="primary">${0}</div> <div class="secondary"> ${0} </div> ${0}`),a[l],Object.entries(e).filter(([e,t])=>{var a,l;return!(t.hidden||t.main||t.showNarrow||(this.columnOrder&&this.columnOrder.includes(e)&&null!==(a=null===(l=this.hiddenColumns)||void 0===l?void 0:l.includes(e))&&void 0!==a?a:t.defaultHidden))}).map(([e,t],l)=>(0,d.qy)(W||(W=B`${0}${0}`),0!==l?" · ":d.s6,t.template?t.template(a):a[e])),i.extraTemplate?i.extraTemplate(a):d.s6):(0,d.qy)(P||(P=B`${0}${0}`),a[l],i.extraTemplate?i.extraTemplate(a):d.s6))})):d.s6,this._groupData=(0,h.A)((e,t,a,l,i,o,s,r,c)=>{if(l||i){let n=[...e];if(i){const e=r===i,l=(0,f.$)(n,e=>e[i]);l.undefined&&(l[j]=l.undefined,delete l.undefined);const h=Object.keys(l).sort((t,l)=>{var i,d;if(!o&&e){const e=(0,m.xL)(t,l,null==a?void 0:a.language);return"asc"===c?e:-1*e}const s=null!==(i=null==o?void 0:o.indexOf(t))&&void 0!==i?i:-1,r=null!==(d=null==o?void 0:o.indexOf(l))&&void 0!==d?d:-1;return s!==r?-1===s?1:-1===r?-1:s-r:(0,m.xL)(["","-","—"].includes(t)?"zzz":t,["","-","—"].includes(l)?"zzz":l,null==a?void 0:a.language)}).reduce((e,t)=>{const a=[t,l[t]];return e.push(a),e},[]),_=[];h.forEach(([e,a])=>{const l=s.includes(e);_.push({append:!0,selectable:!1,content:(0,d.qy)(A||(A=B`<div class="mdc-data-table__cell group-header" role="cell" .group="${0}" ="${0}"> <ha-icon-button .path="${0}" .label="${0}" class="${0}"> </ha-icon-button> ${0} </div>`),e,this._collapseGroup,U,(null==t?void 0:t("ui.components.data-table."+(l?"expand":"collapse")))||(l?"Expand":"Collapse"),l?"collapsed":"",e===j?(null==t?void 0:t("ui.components.data-table.ungrouped"))||"Ungrouped":e||"")}),s.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=>{var t,a,l;if(!(e.composedPath()[0]instanceof HTMLInputElement||e.shiftKey))return;e.composedPath()[0]instanceof HTMLInputElement&&e.shiftKey&&e.preventDefault();const i=e.currentTarget,o=i.rowId,d=this._groupData(this._filteredData,null===(t=this._i18n)||void 0===t?void 0:t.localize,null===(a=this._i18n)||void 0===a?void 0:a.locale,this.appendRow,this.groupColumn,this.groupOrder,this._collapsedGroups,this.sortColumn,this.sortDirection);if(!1===(null===(l=d.find(e=>e[this.id]===o))||void 0===l?void 0:l.selectable))return;const s=d.findIndex(e=>e[this.id]===o);if(e instanceof MouseEvent&&e.shiftKey&&null!==this._lastSelectedRowId){const e=d.findIndex(e=>e[this.id]===this._lastSelectedRowId);e>-1&&s>-1&&(this._checkedRows=[...this._checkedRows,...this._selectRange(d,e,s)])}else i.checked?this._checkedRows.includes(o)||(this._checkedRows=[...this._checkedRows,o]):this._checkedRows=this._checkedRows.filter(e=>e!==o);s>-1&&(this._lastSelectedRowId=o),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,p.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,p.r)(this,"collapsed-changed",{value:this._collapsedGroups})}}}(0,l.Cg)([(0,s.wk)(),(0,i.Fg)({context:v.D5,subscribe:!0})],J.prototype,"_i18n",void 0),(0,l.Cg)([(0,s.MZ)({type:Boolean})],J.prototype,"narrow",void 0),(0,l.Cg)([(0,s.MZ)({type:Object})],J.prototype,"columns",void 0),(0,l.Cg)([(0,s.MZ)({type:Array})],J.prototype,"data",void 0),(0,l.Cg)([(0,s.MZ)({type:Boolean})],J.prototype,"selectable",void 0),(0,l.Cg)([(0,s.MZ)({type:Boolean})],J.prototype,"clickable",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"appendRow",void 0),(0,l.Cg)([(0,s.MZ)({type:Boolean,attribute:"auto-height"})],J.prototype,"autoHeight",void 0),(0,l.Cg)([(0,s.MZ)({type:String})],J.prototype,"id",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"noDataText",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"searchLabel",void 0),(0,l.Cg)([(0,s.MZ)({type:String})],J.prototype,"filter",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"groupColumn",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"groupOrder",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"sortColumn",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"sortDirection",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"initialCollapsedGroups",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"hiddenColumns",void 0),(0,l.Cg)([(0,s.MZ)({attribute:!1})],J.prototype,"columnOrder",void 0),(0,l.Cg)([(0,s.wk)()],J.prototype,"_filterable",void 0),(0,l.Cg)([(0,s.wk)()],J.prototype,"_filter",void 0),(0,l.Cg)([(0,s.wk)()],J.prototype,"_filteredData",void 0),(0,l.Cg)([(0,s.wk)()],J.prototype,"_headerHeight",void 0),(0,l.Cg)([(0,s.P)("slot[name='header']")],J.prototype,"_header",void 0),(0,l.Cg)([(0,s.P)(".mdc-data-table__header-row")],J.prototype,"_headerRow",void 0),(0,l.Cg)([(0,s.P)("lit-virtualizer")],J.prototype,"_scroller",void 0),(0,l.Cg)([(0,s.wk)()],J.prototype,"_collapsedGroups",void 0),(0,l.Cg)([(0,s.wk)()],J.prototype,"_lastSelectedRowId",void 0),(0,l.Cg)([(0,_.a)(".scroller")],J.prototype,"_savedScrollPos",void 0),(0,l.Cg)([(0,s.Ls)({passive:!0})],J.prototype,"_saveScrollPos",null),(0,l.Cg)([(0,s.Ls)({passive:!0})],J.prototype,"_scrollContent",null),J=(0,l.Cg)([(0,s.EM)("ha-data-table")],J),t()}catch(R){t(R)}})},59541:function(e,t,a){a.d(t,{B:function(){return d},L:function(){return s}});a(62953),a(3296),a(27208),a(48408),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),d=(e,t,a)=>o().filterData(e,t,a),s=(e,t,a,l,i)=>o().sortData(e,t,a,l,i)}}]);