UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

3 lines 36.2 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[37670],{18198:function(t,e,i){i.d(e,{Dc:function(){return h},Si:function(){return c}});var s=i(40445),a=i(5124),n=i(67576);i(47680),i(67094);let r,o,l=t=>t;const c=t=>{switch(t.level){case 0:return"M11,10H13V16H11V10M22,12H19V20H5V12H2L12,3L22,12M15,10A2,2 0 0,0 13,8H11A2,2 0 0,0 9,10V16A2,2 0 0,0 11,18H13A2,2 0 0,0 15,16V10Z";case 1:return"M12,3L2,12H5V20H19V12H22L12,3M10,8H14V18H12V10H10V8Z";case 2:return"M12,3L2,12H5V20H19V12H22L12,3M9,8H13A2,2 0 0,1 15,10V12A2,2 0 0,1 13,14H11V16H15V18H9V14A2,2 0 0,1 11,12H13V10H9V8Z";case 3:return"M12,3L22,12H19V20H5V12H2L12,3M15,11.5V10C15,8.89 14.1,8 13,8H9V10H13V12H11V14H13V16H9V18H13A2,2 0 0,0 15,16V14.5A1.5,1.5 0 0,0 13.5,13A1.5,1.5 0 0,0 15,11.5Z";case-1:return"M12,3L2,12H5V20H19V12H22L12,3M11,15H7V13H11V15M15,18H13V10H11V8H15V18Z"}return"M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z"},h=t=>{switch(t.level){case 0:return"mdi:home-floor-0";case 1:return"mdi:home-floor-1";case 2:return"mdi:home-floor-2";case 3:return"mdi:home-floor-3";case-1:return"mdi:home-floor-negative-1"}return"mdi:home"};class d extends a.WF{render(){if(!this.floor)return a.s6;if(this.floor.icon)return(0,a.qy)(r||(r=l`<ha-icon .icon="${0}"></ha-icon>`),this.floor.icon);const t=c(this.floor);return(0,a.qy)(o||(o=l`<ha-svg-icon .path="${0}"></ha-svg-icon>`),t)}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],d.prototype,"floor",void 0),(0,s.Cg)([(0,n.MZ)()],d.prototype,"icon",void 0),d=(0,s.Cg)([(0,n.EM)("ha-floor-icon")],d)},21016:function(t,e,i){i.d(e,{Pu:function(){return a},SB:function(){return r},mk:function(){return n},r1:function(){return s}});const s=t=>t.callWS({type:"counter/list"}),a=(t,e)=>t.callWS(Object.assign({type:"counter/create"},e)),n=(t,e,i)=>t.callWS(Object.assign({type:"counter/update",counter_id:e},i)),r=(t,e)=>t.callWS({type:"counter/delete",counter_id:e})},41656:function(t,e,i){i.d(e,{n:function(){return u}});var s=i(21016),a=i(2279),n=i(42575),r=i(77738),o=i(6922),l=i(33687),c=i(12284),h=i(2247),d=i(49141);const u={input_boolean:{fetch:a.tT,update:a.iE,delete:a.e1},input_button:{fetch:n.vF,update:n.mC,delete:n.C1},input_text:{fetch:c.MG,update:c.BJ,delete:c.d_},input_number:{fetch:o.kF,update:o.Tv,delete:o.$I},input_datetime:{fetch:r.a2,update:r.fJ,delete:r.Bj},input_select:{fetch:l.HV,update:l.EJ,delete:l.O3},counter:{fetch:s.r1,update:s.mk,delete:s.SB},timer:{fetch:d.kL,update:d.r9,delete:d.pZ},schedule:{fetch:h.YA,update:h.Fs,delete:h.VD}}},2279:function(t,e,i){i.d(e,{e1:function(){return r},iE:function(){return n},nr:function(){return a},tT:function(){return s}});const s=t=>t.callWS({type:"input_boolean/list"}),a=(t,e)=>t.callWS(Object.assign({type:"input_boolean/create"},e)),n=(t,e,i)=>t.callWS(Object.assign({type:"input_boolean/update",input_boolean_id:e},i)),r=(t,e)=>t.callWS({type:"input_boolean/delete",input_boolean_id:e})},42575:function(t,e,i){i.d(e,{C1:function(){return r},L6:function(){return a},mC:function(){return n},vF:function(){return s}});const s=t=>t.callWS({type:"input_button/list"}),a=(t,e)=>t.callWS(Object.assign({type:"input_button/create"},e)),n=(t,e,i)=>t.callWS(Object.assign({type:"input_button/update",input_button_id:e},i)),r=(t,e)=>t.callWS({type:"input_button/delete",input_button_id:e})},77738:function(t,e,i){i.d(e,{Bj:function(){return l},TB:function(){return a},a2:function(){return n},fJ:function(){return o},ke:function(){return r},rv:function(){return s}});const s=t=>`${t.attributes.year||"1970"}-${String(t.attributes.month||"01").padStart(2,"0")}-${String(t.attributes.day||"01").padStart(2,"0")}T${String(t.attributes.hour||"00").padStart(2,"0")}:${String(t.attributes.minute||"00").padStart(2,"0")}:${String(t.attributes.second||"00").padStart(2,"0")}`,a=(t,e,i=void 0,s=void 0)=>{const a={entity_id:e,time:i,date:s};t.callService("input_datetime","set_datetime",a)},n=t=>t.callWS({type:"input_datetime/list"}),r=(t,e)=>t.callWS(Object.assign({type:"input_datetime/create"},e)),o=(t,e,i)=>t.callWS(Object.assign({type:"input_datetime/update",input_datetime_id:e},i)),l=(t,e)=>t.callWS({type:"input_datetime/delete",input_datetime_id:e})},6922:function(t,e,i){i.d(e,{$I:function(){return r},Tv:function(){return n},gO:function(){return a},kF:function(){return s}});const s=t=>t.callWS({type:"input_number/list"}),a=(t,e)=>t.callWS(Object.assign({type:"input_number/create"},e)),n=(t,e,i)=>t.callWS(Object.assign({type:"input_number/update",input_number_id:e},i)),r=(t,e)=>t.callWS({type:"input_number/delete",input_number_id:e})},33687:function(t,e,i){i.d(e,{BT:function(){return n},EJ:function(){return r},HV:function(){return a},MZ:function(){return s},O3:function(){return o}});const s=(t,e,i)=>t.callService("input_select","select_option",{option:i,entity_id:e}),a=t=>t.callWS({type:"input_select/list"}),n=(t,e)=>t.callWS(Object.assign({type:"input_select/create"},e)),r=(t,e,i)=>t.callWS(Object.assign({type:"input_select/update",input_select_id:e},i)),o=(t,e)=>t.callWS({type:"input_select/delete",input_select_id:e})},12284:function(t,e,i){i.d(e,{BJ:function(){return r},KY:function(){return s},MG:function(){return a},d_:function(){return o},m4:function(){return n}});const s=(t,e,i)=>t.callService(e.split(".",1)[0],"set_value",{value:i,entity_id:e}),a=t=>t.callWS({type:"input_text/list"}),n=(t,e)=>t.callWS(Object.assign({type:"input_text/create"},e)),r=(t,e,i)=>t.callWS(Object.assign({type:"input_text/update",input_text_id:e},i)),o=(t,e)=>t.callWS({type:"input_text/delete",input_text_id:e})},2247:function(t,e,i){i.d(e,{Fs:function(){return r},VD:function(){return o},YA:function(){return a},mx:function(){return s},sF:function(){return n}});const s=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],a=t=>t.callWS({type:"schedule/list"}),n=(t,e)=>t.callWS(Object.assign({type:"schedule/create"},e)),r=(t,e,i)=>t.callWS(Object.assign({type:"schedule/update",schedule_id:e},i)),o=(t,e)=>t.callWS({type:"schedule/delete",schedule_id:e})},77555:function(t,e,i){i.a(t,async function(t,s){try{i.r(e),i.d(e,{HaConfigHelpers:function(){return Ut}});i(89463),i(16280),i(74423),i(44114),i(18111),i(81148),i(22489),i(20116),i(7588),i(61701),i(13579),i(3362),i(96167),i(27495),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953),i(48408),i(14603),i(47566),i(98721);var a=i(40445),n=(i(68825),i(88696)),r=i(35211),o=i(5124),l=i(67576),c=i(22786),h=i(36312),d=i(93905),u=i(65522),p=i(69093),_=i(91926),g=i(6030),f=i(9899),y=i(87710),b=i(86171),m=i(18350),v=i(29823),w=(i(70947),i(41113)),C=i(52190),$=i(66702),k=i(72644),E=i(138),H=i(2617),S=(i(47680),i(75248)),A=i(93367),V=(i(67094),i(34127)),x=i(82e3),L=i(76570),M=i(77423),F=i(26571),z=i(22792),O=i(96204),W=i(59241),j=i(6810),I=i(14782),Z=i(41656),q=i(95350),B=i(92557),P=i(77763),D=i(70241),R=i(65063),T=i(42269),U=i(23296),G=i(72553),J=i(54706),N=i(14503),Q=i(30039),Y=i(55270),K=i(90986),X=i(29303),tt=i(25635),et=i(87599),it=i(5317),st=i(69569),at=i(94017),nt=i(19661),rt=i(24367),ot=i(19711),lt=t([b,m,v,w,C,$,k,E,H,S,A,V,U,G,it,et,n,X,at]);[b,m,v,w,C,$,k,E,H,S,A,V,U,G,it,et,n,X,at]=lt.then?(await lt)():lt;let ct,ht,dt,ut,pt,_t,gt,ft,yt,bt,mt,vt,wt,Ct,$t,kt,Et,Ht,St,At,Vt,xt,Lt,Mt=t=>t;const Ft="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",zt="M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z",Ot="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",Wt="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",jt="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",It="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",Zt="M7,10L12,15L17,10H7Z",qt="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",Bt="M13 2V4C17.39 4.54 20.5 8.53 19.96 12.92C19.5 16.56 16.64 19.43 13 19.88V21.88C18.5 21.28 22.45 16.34 21.85 10.85C21.33 6.19 17.66 2.5 13 2M11 2C9.04 2.18 7.19 2.95 5.67 4.2L7.1 5.74C8.22 4.84 9.57 4.26 11 4.06V2M4.26 5.67C3 7.19 2.24 9.04 2.05 11H4.05C4.24 9.58 4.8 8.23 5.69 7.1L4.26 5.67M2.06 13C2.26 14.96 3.03 16.81 4.27 18.33L5.69 16.9C4.81 15.77 4.24 14.42 4.06 13H2.06M7.06 18.37L5.67 19.74C7.18 21 9.04 21.79 11 22V20C9.58 19.82 8.23 19.25 7.1 18.37H7.06Z",Pt="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z",Dt="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z",Rt=(t,e)=>{const i={};for(const s of t)i[e(s)]=s;return i},Tt=(t,e,i)=>{var s;const a=null===(s=t[i])||void 0===s?void 0:s.config_entry_id;return a?e[a]:void 0};class Ut extends((0,J.E)(o.WF)){get _availableAssistants(){return(0,nt.V)(this.cloudStatus,this.hass)}hassSubscribe(){return[(0,M.TC)(this.hass,async t=>{const e=this._configEntries?Object.assign({},this._configEntries):{};t.forEach(t=>{var i;null===t.type||"added"===t.type?e[t.entry.entry_id]=t.entry:"removed"===t.type?delete e[t.entry.entry_id]:"updated"===t.type&&(e[t.entry.entry_id]=t.entry),this._entitySource&&this._configEntries&&"loaded"===t.entry.state&&"loaded"!==(null===(i=this._configEntries[t.entry.entry_id])||void 0===i?void 0:i.state)&&this._debouncedFetchEntitySources()}),this._configEntries=e},{type:["helper"]}),(0,W.Bz)(this.hass.connection,t=>{this._entityEntries=Rt(t,t=>t.entity_id)}),(0,L.Ar)(this.hass.connection,"helpers",t=>{this._categories=t})]}_labelsForEntity(t){var e,i;return(null===(e=this.hass.entities[t])||void 0===e?void 0:e.labels)||(null===(i=(0,W.Ox)(this._entityReg)[t])||void 0===i?void 0:i.labels)||[]}render(){var t;if(!this.hass||void 0===this._helperEntities||void 0===this._entityEntries||void 0===this._configEntries)return(0,o.qy)(ct||(ct=Mt`<hass-loading-screen></hass-loading-screen>`));const e=this._sizeController.value&&this._sizeController.value<700||!this._sizeController.value&&"docked"===this.hass.dockedSidebar,i=this._getItems(this.hass.localize,this._helperEntities,this._disabledEntityEntries||[],this._entityEntries,this._configEntries,this._entityReg,this._categories,this._labels,this._filteredHelperEntityIds);return(0,o.qy)(ht||(ht=Mt` <hass-tabs-subpage-data-table .hass="${0}" .narrow="${0}" .backPath="${0}" .route="${0}" .tabs="${0}" .searchLabel="${0}" selectable .selected="${0}" @selection-changed="${0}" has-filters .filters="${0}" .columns="${0}" .data="${0}" .initialGroupColumn="${0}" .initialCollapsedGroups="${0}" .initialSorting="${0}" .columnOrder="${0}" .hiddenColumns="${0}" @columns-changed="${0}" @sorting-changed="${0}" @grouping-changed="${0}" @collapsed-changed="${0}" .activeFilters="${0}" @clear-filter="${0}" @row-click="${0}" .filter="${0}" @search-changed="${0}" has-fab clickable .noDataText="${0}" class="${0}"> <ha-filter-floor-areas .hass="${0}" .type="${0}" .value="${0}" @data-table-filter-changed="${0}" slot="filter-pane" .expanded="${0}" .narrow="${0}" @expanded-changed="${0}"></ha-filter-floor-areas> <ha-filter-devices .hass="${0}" .type="${0}" .value="${0}" @data-table-filter-changed="${0}" slot="filter-pane" .expanded="${0}" .narrow="${0}" @expanded-changed="${0}"></ha-filter-devices> <ha-filter-labels .hass="${0}" .value="${0}" @data-table-filter-changed="${0}" slot="filter-pane" .expanded="${0}" .narrow="${0}" @expanded-changed="${0}"></ha-filter-labels> <ha-filter-categories .hass="${0}" scope="helpers" .value="${0}" @data-table-filter-changed="${0}" slot="filter-pane" .expanded="${0}" .narrow="${0}" @expanded-changed="${0}"></ha-filter-categories> <ha-filter-voice-assistants .hass="${0}" .value="${0}" @data-table-filter-changed="${0}" slot="filter-pane" .expanded="${0}" .narrow="${0}" @expanded-changed="${0}"></ha-filter-voice-assistants> ${0} ${0} <ha-integration-overflow-menu .hass="${0}" slot="toolbar-icon"></ha-integration-overflow-menu> <ha-button slot="fab" size="large" @click="${0}"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0} </ha-button> </hass-tabs-subpage-data-table> `),this.hass,this.narrow,this._searchParms.has("historyBack")?void 0:"/config",this.route,tt.configSections.devices,this.hass.localize("ui.panel.config.helpers.picker.search",{number:i.length}),this._selected.length,this._handleSelectionChanged,Object.values(this._filters).filter(t=>Array.isArray(t)?t.length:t&&Object.values(t).some(t=>Array.isArray(t)?t.length:t)).length,this._columns(this.hass.localize,i),i,null!==(t=this._activeGrouping)&&void 0!==t?t:"category",this._activeCollapsed,this._activeSorting,this._activeColumnOrder,this._activeHiddenColumns,this._handleColumnsChanged,this._handleSortingChanged,this._handleGroupingChanged,this._handleCollapseChanged,this._activeFilters,this._clearFilter,this._openEditDialog,this._filter,this._handleSearchChange,this.hass.localize("ui.panel.config.helpers.picker.no_helpers"),this.narrow?"narrow":"",this.hass,"entity",this._filters["ha-filter-floor-areas"],this._filterChanged,"ha-filter-floor-areas"===this._expandedFilter,this.narrow,this._filterExpanded,this.hass,"entity",this._filters["ha-filter-devices"],this._filterChanged,"ha-filter-devices"===this._expandedFilter,this.narrow,this._filterExpanded,this.hass,this._filters["ha-filter-labels"],this._filterChanged,"ha-filter-labels"===this._expandedFilter,this.narrow,this._filterExpanded,this.hass,this._filters["ha-filter-categories"],this._filterChanged,"ha-filter-categories"===this._expandedFilter,this.narrow,this._filterExpanded,this.hass,this._filters["ha-filter-voice-assistants"],this._filterChanged,"ha-filter-voice-assistants"===this._expandedFilter,this.narrow,this._filterExpanded,this.narrow?o.s6:(0,o.qy)(dt||(dt=Mt`<ha-dropdown slot="selection-bar" @wa-select="${0}"> <ha-assist-chip slot="trigger" .label="${0}"> <ha-svg-icon slot="trailing-icon" .path="${0}"></ha-svg-icon> </ha-assist-chip> ${0} </ha-dropdown> ${0}`),this._handleBulkCategory,this.hass.localize("ui.panel.config.automation.picker.bulk_actions.move_category"),Zt,this._renderCategoryItems(),e?o.s6:(0,o.qy)(ut||(ut=Mt`<ha-dropdown slot="selection-bar" @wa-select="${0}"> <ha-assist-chip slot="trigger" .label="${0}"> <ha-svg-icon slot="trailing-icon" .path="${0}"></ha-svg-icon> </ha-assist-chip> ${0} </ha-dropdown>`),this._handleBulkLabel,this.hass.localize("ui.panel.config.automation.picker.bulk_actions.add_label"),Zt,this._renderLabelItems())),this.narrow||e?(0,o.qy)(pt||(pt=Mt` <ha-dropdown slot="selection-bar" @wa-select="${0}"> ${0} ${0} ${0} </ha-dropdown>`),this._handleBulkAction,this.narrow?(0,o.qy)(_t||(_t=Mt`<ha-assist-chip .label="${0}" slot="trigger"> <ha-svg-icon slot="trailing-icon" .path="${0}"></ha-svg-icon> </ha-assist-chip>`),this.hass.localize("ui.panel.config.automation.picker.bulk_action"),Zt):(0,o.qy)(gt||(gt=Mt`<ha-icon-button .path="${0}" .label="${0}" slot="trigger"></ha-icon-button>`),jt,this.hass.localize("ui.panel.config.automation.picker.bulk_action")),this.narrow?(0,o.qy)(ft||(ft=Mt`<ha-dropdown-item> ${0} ${0} </ha-dropdown-item>`),this.hass.localize("ui.panel.config.automation.picker.bulk_actions.move_category"),this._renderCategoryItems("submenu")):o.s6,this.narrow||"docked"===this.hass.dockedSidebar?(0,o.qy)(yt||(yt=Mt`<ha-dropdown-item> ${0} ${0} </ha-dropdown-item>`),this.hass.localize("ui.panel.config.automation.picker.bulk_actions.add_label"),this._renderLabelItems("submenu")):o.s6):o.s6,this.hass,this._createHelper,qt,this.hass.localize("ui.panel.config.helpers.picker.create_helper"))}_filterExpanded(t){t.detail.expanded?this._expandedFilter=t.target.localName:this._expandedFilter===t.target.localName&&(this._expandedFilter=void 0)}_filterChanged(t){const e=t.target.localName;this._filters=Object.assign(Object.assign({},this._filters),{},{[e]:t.detail.value}),this._filteredItems=Object.assign(Object.assign({},this._filteredItems),{},{[e]:t.detail.items}),this._fromUrl||(this._storageFilters=this._filters),this._applyFilters()}_applyFilters(){const t=Object.entries(this._filters);let e;Object.values(this._filteredItems).forEach(t=>{t&&(e=e?"intersection"in e?e.intersection(t):new Set([...e].filter(e=>t.has(e))):t)});for(const[i,s]of t)if("ha-filter-labels"===i&&Array.isArray(s)&&s.length){const t=new Set;if(this._helperEntities.filter(t=>{var e;return null===(e=(0,W.Ox)(this._entityReg)[t.entity_id])||void 0===e?void 0:e.labels.some(t=>s.includes(t))}).forEach(e=>t.add(e.entity_id)),(this._disabledEntityEntries||[]).filter(t=>t.labels.some(t=>s.includes(t))).forEach(e=>t.add(e.entity_id)),!e){e=t;continue}e="intersection"in e?e.intersection(t):new Set([...e].filter(e=>t.has(e)))}else if("ha-filter-categories"===i&&Array.isArray(s)&&s.length){const t=new Set;if(this._helperEntities.filter(t=>{var e;return s[0]===(null===(e=(0,W.Ox)(this._entityReg)[t.entity_id])||void 0===e?void 0:e.categories.helpers)}).forEach(e=>t.add(e.entity_id)),(this._disabledEntityEntries||[]).filter(t=>s[0]===t.categories.helpers).forEach(e=>t.add(e.entity_id)),!e){e=t;continue}e="intersection"in e?e.intersection(t):new Set([...e].filter(e=>t.has(e)))}else if("ha-filter-voice-assistants"===i&&Array.isArray(s)&&s.length){const t=new Set;if(this._helperEntities.filter(t=>(0,I.hB)(this._entityReg,t.entity_id).some(t=>s.includes(t))).forEach(e=>t.add(e.entity_id)),(this._disabledEntityEntries||[]).filter(t=>(0,I.hB)(this._entityReg,t.entity_id).some(t=>s.includes(t))).forEach(e=>t.add(e.entity_id)),!e){e=t;continue}e="intersection"in e?e.intersection(t):new Set([...e].filter(e=>t.has(e)))}this._filteredHelperEntityIds=e?[...e]:void 0}connectedCallback(){super.connectedCallback(),window.addEventListener("location-changed",this._locationChanged),window.addEventListener("popstate",this._popState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("location-changed",this._locationChanged),window.removeEventListener("popstate",this._popState)}_setFiltersFromUrl(){var t;const e=this._searchParms.get("area"),i=this._searchParms.get("device"),s=this._searchParms.get("label"),a=this._searchParms.get("category"),n=this._searchParms.get("voice_assistant");(e||a||s||i||n)&&(this._fromUrl=!0,this._filter=(null===(t=history.state)||void 0===t?void 0:t.filter)||"",this._filters={"ha-filter-floor-areas":e?{areas:[e]}:void 0,"ha-filter-devices":i?[i]:[],"ha-filter-labels":s?[s]:[],"ha-filter-categories":a?[a]:[],"ha-filter-voice-assistants":n?[n]:[]})}_clearFilter(){this._filters={},this._filteredItems={},this._fromUrl||(this._storageFilters={}),this._applyFilters()}_editCategory(t){const e=(0,W.Ox)(this._entityReg)[t.entity_id];e?(0,Y.j)(this,{scope:"helpers",entityReg:e}):(0,R.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.automation.picker.no_category_support"),text:this.hass.localize("ui.panel.config.automation.picker.no_category_entity_reg")})}async _bulkAddCategory(t){const e=[];this._selected.forEach(i=>{e.push((0,W.G_)(this.hass,i,{categories:{helpers:t}}))});const i=await Promise.allSettled(e);if((0,y.$)(i)){const t=(0,y.N)(i);(0,R.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.common.multiselect.failed",{number:t.length}),text:(0,o.qy)(bt||(bt=Mt`<pre> ${0}</pre>`),t.map(t=>t.reason.message||t.reason.code||t.reason).join("\r\n"))})}}async _bulkLabel(t,e){const i=[];this._selected.forEach(s=>{const a=this._labelsForEntity(s);i.push((0,W.G_)(this.hass,s,{labels:"add"===e?a.concat(t):a.filter(e=>e!==t)}))});const s=await Promise.allSettled(i);if((0,y.$)(s)){const t=(0,y.N)(s);(0,R.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.common.multiselect.failed",{number:t.length}),text:(0,o.qy)(mt||(mt=Mt`<pre> ${0}</pre>`),t.map(t=>t.reason.message||t.reason.code||t.reason).join("\r\n"))})}}_handleSelectionChanged(t){this._selected=t.detail.value}firstUpdated(t){super.firstUpdated(t),this._setFiltersFromUrl(),this._fetchEntitySources(),(0,h.x)(this.hass.config,"diagnostics")&&(0,O.Dh)(this.hass).then(t=>{const e={};for(const i of t)e[i.domain]=i.handlers.config_entry;this._diagnosticHandlers=e}),"/add"===this.route.path&&this._handleAdd()}async _fetchEntitySources(){const[t,e]=await Promise.all([(0,j.c)(this.hass),(0,q.fK)(this.hass)]),i={};for(const n of e)"helper"===n.integration_type&&(i[n.domain]=n);this._helperManifests=i;const s={},a=new Set;for(const[n,r]of Object.entries(t)){const t=r.domain;t in i&&(s[n]=t,a.add(t))}a.size&&this.hass.loadBackendTranslation("title",[...a]),this._entitySource=s}async _handleAdd(){const t=(0,g.p9)("domain");if((0,_.oo)("/config/helpers",{replace:!0}),!t)return;if((0,rt.z)(t))return void(0,ot.$)(this,{domain:t});if(!(await(0,F.yu)(this.hass,["helper"])).includes(t)){return(await(0,F.yu)(this.hass,["device","hub","service"])).includes(t)?void(0,_.oo)(`/config/integrations/add?domain=${t}`,{replace:!0}):void(0,R.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.integrations.config_flow.error"),text:this.hass.localize("ui.panel.config.integrations.config_flow.no_config_flow")})}const e=await this.hass.loadBackendTranslation("title",t,!0);await(0,R.dk)(this,{title:this.hass.localize("ui.panel.config.integrations.confirm_new",{integration:(0,q.p$)(e,t)})})&&(0,P.W)(this,{startFlowHandler:t,manifest:await(0,q.QC)(this.hass,t)})}willUpdate(t){if(super.willUpdate(t),this.hasUpdated||(this._filters=this._storageFilters,this._setFiltersFromUrl()),!this._entityEntries||!this._configEntries)return;(t.has("_helperManifests")||t.has("_entityEntries")||t.has("_configEntries"))&&this._helperManifests&&(this._disabledEntityEntries=Object.values(this._entityEntries).filter(t=>t.disabled_by&&(t.platform in this._helperManifests||t.config_entry_id&&t.config_entry_id in this._configEntries)));let e=!this._helperEntities||t.has("_entityEntries")||t.has("_configEntries")||t.has("_entitySource");if(!e&&t.has("hass")){const i=t.get("hass");e=!i||i.states!==this.hass.states}if(!e)return;const i=Object.keys(this._entitySource),s=Object.values(this.hass.states).filter(t=>i.includes(t.entity_id)||(0,rt.z)((0,p.t)(t)));this._helperEntities.length===s.length&&this._helperEntities.every((t,e)=>s[e]===t)||(this._helperEntities=s,Object.keys(this._filters).length>0&&this._applyFilters())}async _openEditDialog(t){const e=t.detail.id;e.includes(".")?(0,T.p)(this,{entityId:e}):(0,D.Q)(this,this._configEntries[e])}_showError(t){(0,R.showAlertDialog)(this,{title:this.hass.localize("ui.errors.config.configuration_error"),text:(0,et.J)(this.hass,t.configEntry),warning:!0})}async _deleteEntry(t){await(0,R.dk)(this,{title:this.hass.localize("ui.panel.config.integrations.config_entry.delete_confirm_title",{title:t.configEntry.title}),text:this.hass.localize("ui.panel.config.integrations.config_entry.delete_confirm_text"),confirmText:this.hass.localize("ui.common.delete"),dismissText:this.hass.localize("ui.common.cancel"),destructive:!0})&&(0,M.eM)(this.hass,t.id)}async _downloadDiagnostics(t){const e=(0,O.WV)(t.configEntry.entry_id),i=await(0,x.e0)(this.hass,e);(0,Q.R)(i.path)}_openSettings(t){t.entity?(0,T.p)(this,{entityId:t.entity_id,view:"settings"}):(0,D.Q)(this,t.configEntry)}async _deleteHelper(t){if(!t.entity_id)return;if(await(0,R.dk)(this,{title:this.hass.localize("ui.panel.config.helpers.picker.delete_confirm_title"),text:this.hass.localize("ui.panel.config.helpers.picker.delete_confirm_text",{name:t.name}),confirmText:this.hass.localize("ui.common.delete"),dismissText:this.hass.localize("ui.common.cancel"),destructive:!0}))try{if((0,rt.z)(t.type)){const e=this._entityReg.find(e=>e.entity_id===t.entity_id);if(null==e||!e.unique_id||!(0,h.x)(this.hass.config,t.type))throw new Error(this.hass.localize("ui.panel.config.helpers.picker.delete_failed"));return void(await Z.n[t.type].delete(this.hass,e.unique_id))}t.configEntry&&await(0,M.eM)(this.hass,t.configEntry.entry_id)}catch(e){(0,R.showAlertDialog)(this,{text:e.message||this.hass.localize("ui.panel.config.helpers.picker.delete_failed")})}}_createHelper(){(0,ot.$)(this,{})}_handleSortingChanged(t){this._activeSorting=t.detail}_handleGroupingChanged(t){var e;this._activeGrouping=null!==(e=t.detail.value)&&void 0!==e?e:""}_handleCollapseChanged(t){this._activeCollapsed=t.detail.value}_handleSearchChange(t){this._filter=t.detail.value}_handleColumnsChanged(t){this._activeColumnOrder=t.detail.columnOrder,this._activeHiddenColumns=t.detail.hiddenColumns}static get styles(){return[N.RF,(0,o.AH)(vt||(vt=Mt`:host{display:block}hass-tabs-subpage-data-table{--data-table-row-height:60px}hass-tabs-subpage-data-table.narrow{--data-table-row-height:72px}ha-assist-chip{--ha-assist-chip-container-shape:10px}ha-dropdown::part(menu),ha-dropdown::part(submenu){--auto-size-available-width:calc(50vw - var(--ha-space-4))}ha-dropdown ha-assist-chip{--md-assist-chip-trailing-space:8px}`))]}constructor(...t){super(...t),this.isWide=!1,this.narrow=!1,this._filter="",this._helperEntities=[],this._entitySource={},this._selected=[],this._searchParms=new URLSearchParams(window.location.search),this._filters={},this._storageFilters={},this._filteredItems={},this._entityReg=[],this._sizeController=new n.P(this,{callback:t=>{var e;return null===(e=t[0])||void 0===e?void 0:e.contentRect.width}}),this._debouncedFetchEntitySources=(0,f.s)(()=>this._fetchEntitySources(),500,!1),this._columns=(0,c.A)((t,e)=>({icon:{title:"",label:t("ui.panel.config.helpers.picker.headers.icon"),type:"icon",showNarrow:!0,moveable:!1,template:t=>t.entity?(0,o.qy)(wt||(wt=Mt`<ha-state-icon .stateObj="${0}"></ha-state-icon>`),t.entity):(0,o.qy)(Ct||(Ct=Mt`<ha-svg-icon .path="${0}" style="color:var(--error-color)"></ha-svg-icon>`),t.icon)},name:{title:t("ui.panel.config.helpers.picker.headers.name"),main:!0,sortable:!0,filterable:!0,flex:2,direction:"asc",extraTemplate:t=>t.label_entries.length?(0,o.qy)($t||($t=Mt` <ha-data-table-labels .labels="${0}"></ha-data-table-labels> `),t.label_entries):o.s6},entity_id:(0,X.DZ)(t),category:(0,X.Bl)(t),area:(0,X.A7)(t),labels:(0,X.AI)(),localized_type:{title:t("ui.panel.config.helpers.picker.headers.type"),sortable:!0,filterable:!0,groupable:!0},editable:(0,X.tH)(t,t("ui.panel.config.entities.picker.status.unmanageable")),actions:{lastFixed:!0,title:"",label:this.hass.localize("ui.panel.config.generic.headers.actions"),type:"overflow-menu",showNarrow:!0,template:t=>{var e;return(0,o.qy)(kt||(kt=Mt` <ha-icon-overflow-menu narrow .items="${0}"> </ha-icon-overflow-menu> `),[...t.configEntry&&M.m4.includes(t.configEntry.state)?[{path:Ft,label:this.hass.localize("ui.panel.config.helpers.picker.error_information"),warning:!0,action:()=>this._showError(t)}]:[],{path:Ot,label:this.hass.localize("ui.panel.config.automation.picker.show_settings"),action:()=>this._openSettings(t)},{path:Pt,label:this.hass.localize("ui.panel.config.automation.picker."+(t.category?"edit_category":"assign_category")),action:()=>this._editCategory(t)},...t.configEntry&&t.editable&&M.m4.includes(t.configEntry.state)&&void 0===t.entity?[{path:Dt,label:this.hass.localize("ui.common.delete"),warning:!0,action:()=>this._deleteEntry(t)}]:[],...null!==(e=this._diagnosticHandlers)&&void 0!==e&&e[t.type]&&t.configEntry?[{path:It,label:this.hass.localize("ui.panel.config.integrations.config_entry.download_diagnostics"),action:()=>this._downloadDiagnostics(t)}]:[],...t.editable&&t.entity_id?[{divider:!0},{path:Wt,label:this.hass.localize("ui.common.delete"),warning:!0,action:()=>this._deleteHelper(t)}]:[]])}},assistants:(0,at.MD)(t,this.hass,this._availableAssistants,e)})),this._getItems=(0,c.A)((t,e,i,s,a,n,r,o,l)=>{if(null===l)return[];const c=Object.assign({},a);return[...e.map(t=>{const e=Tt(s,a,t.entity_id);return e&&delete c[e.entry_id],{id:t.entity_id,name:t.attributes.friendly_name||"",entity_id:t.entity_id,editable:void 0!==e||t.attributes.editable,type:e?e.domain:this._entitySource[t.entity_id]||(0,p.t)(t),configEntry:e,entity:t}}),...Object.values(c).map(t=>{const e=Object.values(s).find(e=>e.config_entry_id===t.entry_id);return{id:t.entry_id,entity_id:"",icon:"setup_in_progress"===t.state?Bt:Ft,name:t.title||"",editable:!0,type:t.domain,configEntry:t,entity:void 0,selectable:!1,disabled:!(null==e||!e.disabled_by)}}).filter(t=>!t.disabled),...(i||[]).map(t=>({id:t.entity_id,entity_id:t.entity_id,icon:zt,name:t.name||t.original_name||t.entity_id,editable:!0,type:t.platform,configEntry:void 0,entity:void 0,selectable:!0,disabled:!0}))].filter(t=>!l||(null==l?void 0:l.includes(t.entity_id))).map(e=>{var i,s,a;const l=(0,W.Ox)(n)[e.entity_id],c=(o&&(null==l?void 0:l.labels)||[]).map(t=>o.find(e=>e.label_id===t)).filter(t=>void 0!==t),h=null==l?void 0:l.categories.helpers,d=null==l?void 0:l.device_id,p=(null==l?void 0:l.area_id)||(null===(i=this.hass.devices)||void 0===i||null===(i=i[d])||void 0===i?void 0:i.area_id),_=p&&null!==(s=this.hass.areas)&&void 0!==s&&s[p]?(0,u.A)(this.hass.areas[p]):void 0,g=(0,I.hB)(n,e.entity_id);return Object.assign(Object.assign({},e),{},{localized_type:(0,q.p$)(t,e.type)||t(`ui.panel.config.helpers.types.${e.type}`)||e.type,label_entries:c,labels:c.map(t=>t.name),category:h?null==r||null===(a=r.find(t=>t.category_id===h))||void 0===a?void 0:a.name:void 0,area:_,assistants:g,assistants_sortable_key:(0,at.HX)(g)})})}),this._fromUrl=!1,this._locationChanged=()=>{window.location.search.substring(1)!==this._searchParms.toString()&&(this._searchParms=new URLSearchParams(window.location.search),this._setFiltersFromUrl())},this._popState=()=>{window.location.search.substring(1)!==this._searchParms.toString()&&(this._searchParms=new URLSearchParams(window.location.search),this._setFiltersFromUrl())},this._handleBulkCategory=t=>{const e=t.detail.item.value;"category_create"!==e?"category_none"!==e?null!=e&&e.startsWith("category_")&&this._bulkAddCategory(e.substring(9)):this._bulkAddCategory(null):this._bulkCreateCategory()},this._handleBulkLabel=t=>{t.preventDefault();const e=t.detail.item.value;if("label_create"!==e){if(null!=e&&e.startsWith("label_")){const i=t.detail.item.action;this._bulkLabel(e.substring(6),i)}}else this._bulkCreateLabel()},this._bulkCreateCategory=()=>{(0,K.S)(this,{scope:"helpers",createEntry:async t=>{const e=await(0,L.s_)(this.hass,"helpers",t);return this._bulkAddCategory(e.category_id),e}})},this._bulkCreateLabel=()=>{(0,st.f)(this,{createEntry:async t=>{const e=await(0,B._9)(this.hass,t);this._bulkLabel(e.label_id,"add")}})},this._renderCategoryItems=(t="")=>{var e;return(0,o.qy)(Et||(Et=Mt`${0} <ha-dropdown-item .slot="${0}" value="category_none"> ${0} </ha-dropdown-item> <wa-divider .slot="${0}"></wa-divider> <ha-dropdown-item .slot="${0}" value="category_create"> ${0} </ha-dropdown-item>`),null===(e=this._categories)||void 0===e?void 0:e.map(e=>(0,o.qy)(Ht||(Ht=Mt`<ha-dropdown-item .slot="${0}" .value="${0}"> ${0} ${0} </ha-dropdown-item>`),t,`category_${e.category_id}`,e.icon?(0,o.qy)(St||(St=Mt`<ha-icon slot="icon" .icon="${0}"></ha-icon>`),e.icon):(0,o.qy)(At||(At=Mt`<ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon>`),Pt),e.name)),t,this.hass.localize("ui.panel.config.automation.picker.bulk_actions.no_category"),t,t,this.hass.localize("ui.panel.config.category.editor.add"))},this._renderLabelItems=(t="")=>{var e;return(0,o.qy)(Vt||(Vt=Mt`${0} <wa-divider .slot="${0}"></wa-divider> <ha-dropdown-item .slot="${0}" value="label_create"> ${0} </ha-dropdown-item>`),null===(e=this._labels)||void 0===e?void 0:e.map(e=>{const i=this._selected.every(t=>this._labelsForEntity(t).includes(e.label_id)),s=!i&&this._selected.some(t=>this._labelsForEntity(t).includes(e.label_id));return(0,o.qy)(xt||(xt=Mt`<ha-dropdown-item .slot="${0}" .value="${0}" .action="${0}"> <ha-checkbox slot="icon" .checked="${0}" .indeterminate="${0}"></ha-checkbox> <ha-label .color="${0}" .description="${0}"> ${0} ${0} </ha-label> </ha-dropdown-item>`),t,`label_${e.label_id}`,i?"remove":"add",i,s,e.color,e.description,e.icon?(0,o.qy)(Lt||(Lt=Mt`<ha-icon slot="icon" .icon="${0}"></ha-icon>`),e.icon):o.s6,e.name)}),t,t,this.hass.localize("ui.panel.config.labels.add_label"))},this._handleBulkAction=t=>{const e=t.detail.item,i=e.value;if(i)if(i.startsWith("category_"))"category_create"===i?this._bulkCreateCategory():"category_none"===i?this._bulkAddCategory(null):this._bulkAddCategory(i.substring(9));else if(i.startsWith("label_"))if("label_create"===i)this._bulkCreateLabel();else{const t=e.action;this._bulkLabel(i.substring(6),t)}}}}(0,a.Cg)([(0,l.MZ)({attribute:!1})],Ut.prototype,"hass",void 0),(0,a.Cg)([(0,l.MZ)({attribute:"is-wide",type:Boolean})],Ut.prototype,"isWide",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean})],Ut.prototype,"narrow",void 0),(0,a.Cg)([(0,l.MZ)({attribute:!1})],Ut.prototype,"route",void 0),(0,a.Cg)([(0,l.MZ)({attribute:!1})],Ut.prototype,"cloudStatus",void 0),(0,a.Cg)([(0,d.I)({key:"helpers-table-sort",state:!1,subscribe:!1})],Ut.prototype,"_activeSorting",void 0),(0,a.Cg)([(0,d.I)({key:"helpers-table-grouping",state:!1,subscribe:!1})],Ut.prototype,"_activeGrouping",void 0),(0,a.Cg)([(0,d.I)({key:"helpers-table-collapsed",state:!1,subscribe:!1})],Ut.prototype,"_activeCollapsed",void 0),(0,a.Cg)([(0,l.wk)(),(0,d.I)({storage:"sessionStorage",key:"helpers-table-search",state:!0,subscribe:!1})],Ut.prototype,"_filter",void 0),(0,a.Cg)([(0,d.I)({key:"helpers-table-column-order",state:!1,subscribe:!1})],Ut.prototype,"_activeColumnOrder",void 0),(0,a.Cg)([(0,d.I)({key:"helpers-table-hidden-columns",state:!1,subscribe:!1})],Ut.prototype,"_activeHiddenColumns",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_helperEntities",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_disabledEntityEntries",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_entityEntries",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_configEntries",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_entitySource",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_selected",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_activeFilters",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_helperManifests",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_diagnosticHandlers",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_searchParms",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_filters",void 0),(0,a.Cg)([(0,d.I)({storage:"sessionStorage",key:"helpers-table-filters",state:!1,subscribe:!1})],Ut.prototype,"_storageFilters",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_filteredItems",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_expandedFilter",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_categories",void 0),(0,a.Cg)([(0,r.Fg)({context:z.HD,subscribe:!0}),(0,l.wk)()],Ut.prototype,"_labels",void 0),(0,a.Cg)([(0,l.wk)(),(0,r.Fg)({context:z.ih,subscribe:!0})],Ut.prototype,"_entityReg",void 0),(0,a.Cg)([(0,l.wk)()],Ut.prototype,"_filteredHelperEntityIds",void 0),Ut=(0,a.Cg)([(0,l.EM)("ha-config-helpers")],Ut),s()}catch(ct){s(ct)}})},19711:function(t,e,i){i.d(e,{$:function(){return n}});i(3362),i(62953);var s=i(1087);const a=()=>Promise.all([i.e(80131),i.e(70183),i.e(47677)]).then(i.bind(i,79029)),n=(t,e)=>{(0,s.r)(t,"show-dialog",{dialogTag:"dialog-helper-detail",dialogImport:a,dialogParams:e})}}}]);