UNPKG

iobroker.lovelace

Version:

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

2 lines 39.8 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["20035"],{86431:function(e,t,i){"use strict";i.d(t,{jL:()=>n,wZ:()=>o});i(71695),i(81804),i(47021);var a=i(47194);const n=e=>{var t;return null===(t=e.name_by_user||e.name)||void 0===t?void 0:t.trim()},o=(e,t,i)=>n(e)||i&&d(t,i)||t.localize("ui.panel.config.devices.unnamed_device",{type:t.localize(`ui.panel.config.devices.type.${e.entry_type||"device"}`)}),d=(e,t)=>{for(const i of t||[]){const t="string"==typeof i?i:i.entity_id,n=e.states[t];if(n)return(0,a.C)(n)}}},98157:function(e,t,i){"use strict";i.a(e,(async function(e,t){try{var a=i(61701),n=(i(19083),i(71695),i(61893),i(9359),i(68107),i(56475),i(70104),i(52924),i(40251),i(61006),i(47021),i(57243)),o=i(50778),d=i(27486),r=i(36522),l=i(86431),s=i(73850),c=i(1416),h=i(24360),u=i(71857),v=i(94279),p=(i(7285),e([v]));v=(p.then?(await p)():p)[0];let f,m,b=e=>e;const k=e=>(0,n.dy)(f||(f=b`<ha-list-item .twoline="${0}"> <span>${0}</span> <span slot="secondary">${0}</span> </ha-list-item>`),!!e.area,e.name,e.area);(0,a.Z)([(0,o.Mo)("ha-device-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Array,attribute:"exclude-devices"})],key:"excludeDevices",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,o.SB)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,o.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_init",value(){return!1}},{kind:"field",key:"_getDevices",value(){return(0,d.Z)(((e,t,i,a,n,o,d,r,h)=>{if(!e.length)return[{id:"no_devices",area:"",name:this.hass.localize("ui.components.device-picker.no_devices"),strings:[]}];let v={};(a||n||o||r)&&(v=(0,u.R6)(i));let p=e.filter((e=>e.id===this.value||!e.disabled_by));a&&(p=p.filter((e=>{const t=v[e.id];return!(!t||!t.length)&&v[e.id].some((e=>a.includes((0,s.M)(e.entity_id))))}))),n&&(p=p.filter((e=>{const t=v[e.id];return!t||!t.length||i.every((e=>!n.includes((0,s.M)(e.entity_id))))}))),h&&(p=p.filter((e=>!h.includes(e.id)))),o&&(p=p.filter((e=>{const t=v[e.id];return!(!t||!t.length)&&v[e.id].some((e=>{const t=this.hass.states[e.entity_id];return!!t&&(t.attributes.device_class&&o.includes(t.attributes.device_class))}))}))),r&&(p=p.filter((e=>{const t=v[e.id];return!(!t||!t.length)&&t.some((e=>{const t=this.hass.states[e.entity_id];return!!t&&r(t)}))}))),d&&(p=p.filter((e=>e.id===this.value||d(e))));const f=p.map((e=>{const i=(0,l.wZ)(e,this.hass,v[e.id]);return{id:e.id,name:i||this.hass.localize("ui.components.device-picker.unnamed_device"),area:e.area_id&&t[e.area_id]?t[e.area_id].name:this.hass.localize("ui.components.device-picker.no_area"),strings:[i||""]}}));return f.length?1===f.length?f:f.sort(((e,t)=>(0,c.$K)(e.name||"",t.name||"",this.hass.locale.language))):[{id:"no_devices",area:"",name:this.hass.localize("ui.components.device-picker.no_match"),strings:[]}]}))}},{kind:"method",key:"open",value:async function(){var e;await this.updateComplete,await(null===(e=this.comboBox)||void 0===e?void 0:e.open())}},{kind:"method",key:"focus",value:async function(){var e;await this.updateComplete,await(null===(e=this.comboBox)||void 0===e?void 0:e.focus())}},{kind:"method",key:"updated",value:function(e){if(!this._init&&this.hass||this._init&&e.has("_opened")&&this._opened){this._init=!0;const e=this._getDevices(Object.values(this.hass.devices),this.hass.areas,Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeDevices);this.comboBox.items=e,this.comboBox.filteredItems=e}}},{kind:"method",key:"render",value:function(){return(0,n.dy)(m||(m=b` <ha-combo-box .hass="${0}" .label="${0}" .value="${0}" .helper="${0}" .renderer="${0}" .disabled="${0}" .required="${0}" item-id-path="id" item-value-path="id" item-label-path="name" @opened-changed="${0}" @value-changed="${0}" @filter-changed="${0}"></ha-combo-box> `),this.hass,void 0===this.label&&this.hass?this.hass.localize("ui.components.device-picker.device"):this.label,this._value,this.helper,k,this.disabled,this.required,this._openedChanged,this._deviceChanged,this._filterChanged)}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_filterChanged",value:function(e){const t=e.target,i=e.detail.value.toLowerCase();t.filteredItems=i.length?(0,h.q)(i,t.items||[]):t.items}},{kind:"method",key:"_deviceChanged",value:function(e){e.stopPropagation();let t=e.detail.value;"no_devices"===t&&(t=""),t!==this._value&&this._setValue(t)}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,r.B)(this,"value-changed",{value:e}),(0,r.B)(this,"change")}),0)}}]}}),n.oi);t()}catch(f){t(f)}}))},34273:function(e,t,i){"use strict";var a=i(61701),n=i(72621),o=(i(71695),i(9359),i(31526),i(47021),i(22997),i(57243)),d=i(50778),r=i(5111),l=i(76525);let s,c,h=e=>e;(0,a.Z)([(0,d.Mo)("ha-button-menu")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",key:l.gA,value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"corner",value(){return"BOTTOM_START"}},{kind:"field",decorators:[(0,d.Cb)({attribute:"menu-corner"})],key:"menuCorner",value(){return"START"}},{kind:"field",decorators:[(0,d.Cb)({type:Number})],key:"x",value(){return null}},{kind:"field",decorators:[(0,d.Cb)({type:Number})],key:"y",value(){return null}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"multi",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"activatable",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"fixed",value(){return!1}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,attribute:"no-anchor"})],key:"noAnchor",value(){return!1}},{kind:"field",decorators:[(0,d.IO)("mwc-menu",!0)],key:"_menu",value:void 0},{kind:"get",key:"items",value:function(){var e;return null===(e=this._menu)||void 0===e?void 0:e.items}},{kind:"get",key:"selected",value:function(){var e;return null===(e=this._menu)||void 0===e?void 0:e.selected}},{kind:"method",key:"focus",value:function(){var e,t;null!==(e=this._menu)&&void 0!==e&&e.open?this._menu.focusItemAtIndex(0):null===(t=this._triggerButton)||void 0===t||t.focus()}},{kind:"method",key:"render",value:function(){return(0,o.dy)(s||(s=h` <div @click="${0}"> <slot name="trigger" @slotchange="${0}"></slot> </div> <mwc-menu .corner="${0}" .menuCorner="${0}" .fixed="${0}" .multi="${0}" .activatable="${0}" .y="${0}" .x="${0}"> <slot></slot> </mwc-menu> `),this._handleClick,this._setTriggerAria,this.corner,this.menuCorner,this.fixed,this.multi,this.activatable,this.y,this.x)}},{kind:"method",key:"firstUpdated",value:function(e){(0,n.Z)(i,"firstUpdated",this,3)([e]),"rtl"===r.E.document.dir&&this.updateComplete.then((()=>{this.querySelectorAll("mwc-list-item").forEach((e=>{const t=document.createElement("style");t.innerHTML="span.material-icons:first-of-type { margin-left: var(--mdc-list-item-graphic-margin, 32px) !important; margin-right: 0px !important;}",e.shadowRoot.appendChild(t)}))}))}},{kind:"method",key:"_handleClick",value:function(){this.disabled||(this._menu.anchor=this.noAnchor?null:this,this._menu.show())}},{kind:"get",key:"_triggerButton",value:function(){return this.querySelector('ha-icon-button[slot="trigger"], mwc-button[slot="trigger"]')}},{kind:"method",key:"_setTriggerAria",value:function(){this._triggerButton&&(this._triggerButton.ariaHasPopup="menu")}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(c||(c=h`:host{display:inline-block;position:relative}::slotted([disabled]){color:var(--disabled-text-color)}`))}}]}}),o.oi)},83456:function(e,t,i){"use strict";var a=i(61701),n=(i(71695),i(47021),i(92444)),o=i(76688),d=i(57243),r=i(50778);let l,s=e=>e;(0,a.Z)([(0,r.Mo)("ha-checkbox")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",static:!0,key:"styles",value(){return[o.W,(0,d.iv)(l||(l=s`:host{--mdc-theme-secondary:var(--primary-color)}`))]}}]}}),n.A)},94279:function(e,t,i){"use strict";i.a(e,(async function(e,t){try{var a=i(61701),n=i(72621),o=(i(71695),i(9359),i(31526),i(40251),i(47021),i(2394)),d=i(28737),r=i(43631),l=i(57243),s=i(50778),c=i(20552),h=i(36522),u=(i(23334),i(7285),i(83166),e([d]));d=(u.then?(await u)():u)[0];let v,p,f,m,b,k,g=e=>e;const y="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",_="M7,10L12,15L17,10H7Z",x="M7,15L12,10L17,15H7Z";(0,r.hC)("vaadin-combo-box-item",(0,l.iv)(v||(v=g`:host{padding:0!important}:host([focused]:not([disabled])){background-color:rgba(var(--rgb-primary-text-color,0,0,0),.12)}:host([selected]:not([disabled])){background-color:transparent;color:var(--mdc-theme-primary);--mdc-ripple-color:var(--mdc-theme-primary);--mdc-theme-text-primary-on-background:var(--mdc-theme-primary)}:host([selected]:not([disabled])):before{background-color:var(--mdc-theme-primary);opacity:.12;content:"";position:absolute;top:0;left:0;width:100%;height:100%}:host([selected][focused]:not([disabled])):before{opacity:.24}:host(:hover:not([disabled])){background-color:transparent}[part=content]{width:100%}[part=checkmark]{display:none}`)));(0,a.Z)([(0,s.Mo)("ha-combo-box")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"validationMessage",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"invalid",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"items",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"filteredItems",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"dataProvider",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"allow-custom-value",type:Boolean})],key:"allowCustomValue",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({attribute:"item-value-path"})],key:"itemValuePath",value(){return"value"}},{kind:"field",decorators:[(0,s.Cb)({attribute:"item-label-path"})],key:"itemLabelPath",value(){return"label"}},{kind:"field",decorators:[(0,s.Cb)({attribute:"item-id-path"})],key:"itemIdPath",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"renderer",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({type:Boolean,reflect:!0})],key:"opened",value(){return!1}},{kind:"field",decorators:[(0,s.IO)("vaadin-combo-box-light",!0)],key:"_comboBox",value:void 0},{kind:"field",decorators:[(0,s.IO)("ha-textfield",!0)],key:"_inputElement",value:void 0},{kind:"field",key:"_overlayMutationObserver",value:void 0},{kind:"field",key:"_bodyMutationObserver",value:void 0},{kind:"method",key:"open",value:async function(){var e;await this.updateComplete,null===(e=this._comboBox)||void 0===e||e.open()}},{kind:"method",key:"focus",value:async function(){var e,t;await this.updateComplete,await(null===(e=this._inputElement)||void 0===e?void 0:e.updateComplete),null===(t=this._inputElement)||void 0===t||t.focus()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,n.Z)(i,"disconnectedCallback",this,3)([]),this._overlayMutationObserver&&(this._overlayMutationObserver.disconnect(),this._overlayMutationObserver=void 0),this._bodyMutationObserver&&(this._bodyMutationObserver.disconnect(),this._bodyMutationObserver=void 0)}},{kind:"get",key:"selectedItem",value:function(){return this._comboBox.selectedItem}},{kind:"method",key:"setInputValue",value:function(e){this._comboBox.value=e}},{kind:"method",key:"render",value:function(){var e;return(0,l.dy)(p||(p=g` <vaadin-combo-box-light .itemValuePath="${0}" .itemIdPath="${0}" .itemLabelPath="${0}" .items="${0}" .value="${0}" .filteredItems="${0}" .dataProvider="${0}" .allowCustomValue="${0}" .disabled="${0}" .required="${0}" ${0} @opened-changed="${0}" @filter-changed="${0}" @value-changed="${0}" attr-for-value="value"> <ha-textfield label="${0}" placeholder="${0}" ?disabled="${0}" ?required="${0}" validationMessage="${0}" .errorMessage="${0}" class="input" autocapitalize="none" autocomplete="off" autocorrect="off" input-spellcheck="false" .suffix="${0}" .icon="${0}" .invalid="${0}" .helper="${0}" helperPersistent> <slot name="icon" slot="leadingIcon"></slot> </ha-textfield> ${0} <ha-svg-icon role="button" tabindex="-1" aria-label="${0}" aria-expanded="${0}" class="toggle-button" .path="${0}" @click="${0}"></ha-svg-icon> </vaadin-combo-box-light> `),this.itemValuePath,this.itemIdPath,this.itemLabelPath,this.items,this.value||"",this.filteredItems,this.dataProvider,this.allowCustomValue,this.disabled,this.required,(0,o.t)(this.renderer||this._defaultRowRenderer),this._openedChanged,this._filterChanged,this._valueChanged,(0,c.o)(this.label),(0,c.o)(this.placeholder),this.disabled,this.required,(0,c.o)(this.validationMessage),this.errorMessage,(0,l.dy)(f||(f=g`<div style="width:28px" role="none presentation"></div>`)),this.icon,this.invalid,this.helper,this.value?(0,l.dy)(m||(m=g`<ha-svg-icon role="button" tabindex="-1" aria-label="${0}" class="clear-button" .path="${0}" @click="${0}"></ha-svg-icon>`),(0,c.o)(null===(e=this.hass)||void 0===e?void 0:e.localize("ui.common.clear")),y,this._clearValue):"",(0,c.o)(this.label),this.opened?"true":"false",this.opened?x:_,this._toggleOpen)}},{kind:"field",key:"_defaultRowRenderer",value(){return e=>(0,l.dy)(b||(b=g`<ha-list-item> ${0} </ha-list-item>`),this.itemLabelPath?e[this.itemLabelPath]:e)}},{kind:"method",key:"_clearValue",value:function(e){e.stopPropagation(),(0,h.B)(this,"value-changed",{value:void 0})}},{kind:"method",key:"_toggleOpen",value:function(e){var t,i;this.opened?(null===(t=this._comboBox)||void 0===t||t.close(),e.stopPropagation()):null===(i=this._comboBox)||void 0===i||i.inputElement.focus()}},{kind:"method",key:"_openedChanged",value:function(e){e.stopPropagation();const t=e.detail.value;if(setTimeout((()=>{this.opened=t}),0),(0,h.B)(this,"opened-changed",{value:e.detail.value}),t){const e=document.querySelector("vaadin-combo-box-overlay");e&&this._removeInert(e),this._observeBody()}else{var i;null===(i=this._bodyMutationObserver)||void 0===i||i.disconnect(),this._bodyMutationObserver=void 0}}},{kind:"method",key:"_observeBody",value:function(){"MutationObserver"in window&&!this._bodyMutationObserver&&(this._bodyMutationObserver=new MutationObserver((e=>{e.forEach((e=>{e.addedNodes.forEach((e=>{"VAADIN-COMBO-BOX-OVERLAY"===e.nodeName&&this._removeInert(e)})),e.removedNodes.forEach((e=>{var t;"VAADIN-COMBO-BOX-OVERLAY"===e.nodeName&&(null===(t=this._overlayMutationObserver)||void 0===t||t.disconnect(),this._overlayMutationObserver=void 0)}))}))})),this._bodyMutationObserver.observe(document.body,{childList:!0}))}},{kind:"method",key:"_removeInert",value:function(e){var t;if(e.inert)return e.inert=!1,null===(t=this._overlayMutationObserver)||void 0===t||t.disconnect(),void(this._overlayMutationObserver=void 0);"MutationObserver"in window&&!this._overlayMutationObserver&&(this._overlayMutationObserver=new MutationObserver((e=>{e.forEach((e=>{if("inert"===e.attributeName){const i=e.target;var t;if(i.inert)null===(t=this._overlayMutationObserver)||void 0===t||t.disconnect(),this._overlayMutationObserver=void 0,i.inert=!1}}))})),this._overlayMutationObserver.observe(e,{attributes:!0}))}},{kind:"method",key:"_filterChanged",value:function(e){e.stopPropagation(),(0,h.B)(this,"filter-changed",{value:e.detail.value})}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation(),this.allowCustomValue||(this._comboBox._closeOnBlurIsPrevented=!0);const t=e.detail.value;t!==this.value&&(0,h.B)(this,"value-changed",{value:t||void 0})}},{kind:"field",static:!0,key:"styles",value(){return(0,l.iv)(k||(k=g`:host{display:block;width:100%}vaadin-combo-box-light{position:relative;--vaadin-combo-box-overlay-max-height:calc(45vh - 56px)}ha-textfield{width:100%}ha-textfield>ha-icon-button{--mdc-icon-button-size:24px;padding:2px;color:var(--secondary-text-color)}ha-svg-icon{color:var(--input-dropdown-icon-color);position:absolute;cursor:pointer}.toggle-button{right:12px;top:-10px;inset-inline-start:initial;inset-inline-end:12px;direction:var(--direction)}:host([opened]) .toggle-button{color:var(--primary-color)}.clear-button{--mdc-icon-size:20px;top:-7px;right:36px;inset-inline-start:initial;inset-inline-end:36px;direction:var(--direction)}`))}}]}}),l.oi);t()}catch(v){t(v)}}))},55486:function(e,t,i){"use strict";var a=i(61701),n=(i(71695),i(47021),i(4918)),o=i(6394),d=i(57243),r=i(50778),l=i(35359),s=i(36522);let c,h,u=e=>e;(0,a.Z)([(0,r.Mo)("ha-formfield")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"method",key:"render",value:function(){const e={"mdc-form-field--align-end":this.alignEnd,"mdc-form-field--space-between":this.spaceBetween,"mdc-form-field--nowrap":this.nowrap};return(0,d.dy)(c||(c=u` <div class="mdc-form-field ${0}"> <slot></slot> <label class="mdc-label" @click="${0}"> <slot name="label">${0}</slot> </label> </div>`),(0,l.$)(e),this._labelClick,this.label)}},{kind:"method",key:"_labelClick",value:function(){const e=this.input;if(e&&(e.focus(),!e.disabled))switch(e.tagName){case"HA-CHECKBOX":e.checked=!e.checked,(0,s.B)(e,"change");break;case"HA-RADIO":e.checked=!0,(0,s.B)(e,"change");break;default:e.click()}}},{kind:"field",static:!0,key:"styles",value(){return[o.W,(0,d.iv)(h||(h=u`:host(:not([alignEnd])) ::slotted(ha-switch){margin-right:10px;margin-inline-end:10px;margin-inline-start:inline}.mdc-form-field{align-items:var(--ha-formfield-align-items,center);gap:4px}.mdc-form-field>label{direction:var(--direction);margin-inline-start:0;margin-inline-end:auto;padding:0}:host([disabled]) label{color:var(--disabled-text-color)}`))]}}]}}),n.a)},7285:function(e,t,i){"use strict";i.d(t,{M:()=>v});var a=i(61701),n=i(72621),o=(i(71695),i(47021),i(65703)),d=i(46289),r=i(57243),l=i(50778);let s,c,h,u=e=>e,v=(0,a.Z)([(0,l.Mo)("ha-list-item")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"method",key:"renderRipple",value:function(){return this.noninteractive?"":(0,n.Z)(i,"renderRipple",this,3)([])}},{kind:"get",static:!0,key:"styles",value:function(){return[d.W,(0,r.iv)(s||(s=u`:host{padding-left:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-inline-start:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-right:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px));padding-inline-end:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px))}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:48px}span.material-icons:first-of-type{margin-inline-start:0px!important;margin-inline-end:var(--mdc-list-item-graphic-margin,16px)!important;direction:var(--direction)!important}span.material-icons:last-of-type{margin-inline-start:auto!important;margin-inline-end:0px!important;direction:var(--direction)!important}.mdc-deprecated-list-item__meta{display:var(--mdc-list-item-meta-display);align-items:center;flex-shrink:0}:host([graphic=icon]:not([twoline])) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,20px)!important}:host([multiline-secondary]){height:auto}:host([multiline-secondary]) .mdc-deprecated-list-item__text{padding:8px 0}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text{text-overflow:initial;white-space:normal;overflow:auto;display:inline-block;margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text{margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text::before{display:none}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text::before{display:none}:host([disabled]){color:var(--disabled-text-color)}:host([noninteractive]){pointer-events:unset}`)),"rtl"===document.dir?(0,r.iv)(c||(c=u`span.material-icons:first-of-type,span.material-icons:last-of-type{direction:rtl!important;--direction:rtl}`)):(0,r.iv)(h||(h=u``))]}}]}}),o.K)},83166:function(e,t,i){"use strict";var a=i(61701),n=i(72621),o=(i(71695),i(47021),i(1105)),d=i(33990),r=i(57243),l=i(50778),s=i(5111);let c,h,u,v,p=e=>e;(0,a.Z)([(0,l.Mo)("ha-textfield")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"iconTrailing",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,l.IO)("input")],key:"formElement",value:void 0},{kind:"method",key:"updated",value:function(e){(0,n.Z)(i,"updated",this,3)([e]),(e.has("invalid")||e.has("errorMessage"))&&(this.setCustomValidity(this.invalid?this.errorMessage||this.validationMessage||"Invalid":""),(this.invalid||this.validateOnInitialRender||e.has("invalid")&&void 0!==e.get("invalid"))&&this.reportValidity()),e.has("autocomplete")&&(this.autocomplete?this.formElement.setAttribute("autocomplete",this.autocomplete):this.formElement.removeAttribute("autocomplete")),e.has("autocorrect")&&(this.autocorrect?this.formElement.setAttribute("autocorrect",this.autocorrect):this.formElement.removeAttribute("autocorrect")),e.has("inputSpellcheck")&&(this.inputSpellcheck?this.formElement.setAttribute("spellcheck",this.inputSpellcheck):this.formElement.removeAttribute("spellcheck"))}},{kind:"method",key:"renderIcon",value:function(e,t=!1){const i=t?"trailing":"leading";return(0,r.dy)(c||(c=p` <span class="mdc-text-field__icon mdc-text-field__icon--${0}" tabindex="${0}"> <slot name="${0}Icon"></slot> </span> `),i,t?1:-1,i)}},{kind:"field",static:!0,key:"styles",value(){return[d.W,(0,r.iv)(h||(h=p`.mdc-text-field__input{width:var(--ha-textfield-input-width,100%)}.mdc-text-field:not(.mdc-text-field--with-leading-icon){padding:var(--text-field-padding,0px 16px)}.mdc-text-field__affix--suffix{padding-left:var(--text-field-suffix-padding-left,12px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,12px);padding-inline-end:var(--text-field-suffix-padding-right,0px);direction:ltr}.mdc-text-field--with-leading-icon{padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,16px);direction:var(--direction)}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon{padding-left:var(--text-field-suffix-padding-left,0px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,0px)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--suffix{color:var(--secondary-text-color)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon{color:var(--secondary-text-color)}.mdc-text-field__icon--leading{margin-inline-start:16px;margin-inline-end:8px;direction:var(--direction)}.mdc-text-field__icon--trailing{padding:var(--textfield-icon-trailing-padding,12px)}.mdc-floating-label:not(.mdc-floating-label--float-above){text-overflow:ellipsis;width:inherit;padding-right:30px;padding-inline-end:30px;padding-inline-start:initial;box-sizing:border-box;direction:var(--direction)}input{text-align:var(--text-field-text-align,start)}input[type=color]{height:20px}::-ms-reveal{display:none}:host([no-spinner]) input::-webkit-inner-spin-button,:host([no-spinner]) input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=color]::-webkit-color-swatch-wrapper{padding:0}:host([no-spinner]) input[type=number]{-moz-appearance:textfield}.mdc-text-field__ripple{overflow:hidden}.mdc-text-field{overflow:var(--text-field-overflow)}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start);direction:var(--direction);text-align:var(--float-start)}.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 48px - var(--text-field-suffix-padding-left,0px));inset-inline-start:calc(48px + var(--text-field-suffix-padding-left,0px))!important;inset-inline-end:initial!important;direction:var(--direction)}.mdc-text-field__input[type=number]{direction:var(--direction)}.mdc-text-field__affix--prefix{padding-right:var(--text-field-prefix-padding-right,2px);padding-inline-end:var(--text-field-prefix-padding-right,2px);padding-inline-start:initial}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--prefix{color:var(--mdc-text-field-label-ink-color)}#helper-text ha-markdown{display:inline-block}`)),"rtl"===s.E.document.dir?(0,r.iv)(u||(u=p`.mdc-floating-label,.mdc-text-field--with-leading-icon,.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label,.mdc-text-field__icon--leading,.mdc-text-field__input[type=number]{direction:rtl;--direction:rtl}`)):(0,r.iv)(v||(v=p``))]}}]}}),o.P)},36841:function(e,t,i){"use strict";var a=i(61701),n=(i(71695),i(9359),i(56475),i(40251),i(47021),i(57243)),o=i(50778),d=(i(23334),i(37583),i(83166),i(36522));let r,l,s,c=e=>e;(0,a.Z)([(0,o.Mo)("search-input")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"filter",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"suffix",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"autofocus",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:String})],key:"label",value:void 0},{kind:"method",key:"focus",value:function(){var e;null===(e=this._input)||void 0===e||e.focus()}},{kind:"field",decorators:[(0,o.IO)("ha-textfield",!0)],key:"_input",value:void 0},{kind:"method",key:"render",value:function(){return(0,n.dy)(r||(r=c` <ha-textfield .autofocus="${0}" .label="${0}" .value="${0}" icon .iconTrailing="${0}" @input="${0}"> <slot name="prefix" slot="leadingIcon"> <ha-svg-icon tabindex="-1" class="prefix" .path="${0}"></ha-svg-icon> </slot> <div class="trailing" slot="trailingIcon"> ${0} <slot name="suffix"></slot> </div> </ha-textfield> `),this.autofocus,this.label||this.hass.localize("ui.common.search"),this.filter||"",this.filter||this.suffix,this._filterInputChanged,"M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",this.filter&&(0,n.dy)(l||(l=c` <ha-icon-button @click="${0}" .label="${0}" .path="${0}" class="clear-button"></ha-icon-button> `),this._clearSearch,this.hass.localize("ui.common.clear"),"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"))}},{kind:"method",key:"_filterChanged",value:async function(e){(0,d.B)(this,"value-changed",{value:String(e)})}},{kind:"method",key:"_filterInputChanged",value:async function(e){this._filterChanged(e.target.value)}},{kind:"method",key:"_clearSearch",value:async function(){this._filterChanged("")}},{kind:"field",static:!0,key:"styles",value(){return(0,n.iv)(s||(s=c`:host{display:inline-flex}ha-icon-button,ha-svg-icon{color:var(--primary-text-color)}ha-svg-icon{outline:0}.clear-button{--mdc-icon-size:20px}ha-textfield{display:inherit}.trailing{display:flex;align-items:center}`))}}]}}),n.oi)},71220:function(e,t,i){"use strict";i.d(t,{Dm:()=>r,jg:()=>o,p4:()=>n,pN:()=>d,xC:()=>a});i(61495),i(23669),i(11740);const a=e=>{let t=e;return"string"==typeof e&&(t=parseInt(e,16)),"0x"+t.toString(16).padStart(4,"0")},n=e=>e.split(":").slice(-4).reverse().join(""),o=(e,t)=>{const i=e.user_given_name?e.user_given_name:e.name,a=t.user_given_name?t.user_given_name:t.name;return i.localeCompare(a)},d=(e,t)=>{const i=e.name,a=t.name;return i.localeCompare(a)},r=e=>`${e.name} (Endpoint id: ${e.endpoint_id}, Id: ${a(e.id)}, Type: ${e.type})`},67120:function(e,t,i){"use strict";i.a(e,(async function(e,a){try{i.r(t),i.d(t,{ZHANetworkVisualizationPage:()=>y});var n=i(61701),o=i(72621),d=(i(19083),i(71695),i(92745),i(9359),i(31526),i(70104),i(23669),i(40251),i(19134),i(61006),i(97003),i(47021),i(31622),i(57243)),r=i(50778),l=i(11896),s=i(83523),c=(i(36841),i(98157)),h=(i(34273),i(83456),i(55486),i(74794)),u=(i(97546),i(71220)),v=i(34976),p=e([c,l,v]);[c,l,v]=p.then?(await p)():p;let f,m,b,k,g=e=>e,y=(0,n.Z)([(0,r.Mo)("zha-network-visualization-page")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"route",value:void 0},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"narrow",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)({attribute:"is-wide",type:Boolean})],key:"isWide",value(){return!1}},{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"zoomedDeviceIdFromURL",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"zoomedDeviceId",value:void 0},{kind:"field",decorators:[(0,r.IO)("#visualization",!0)],key:"_visualization",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_devices",value(){return new Map}},{kind:"field",decorators:[(0,r.SB)()],key:"_devicesByDeviceId",value(){return new Map}},{kind:"field",decorators:[(0,r.SB)()],key:"_nodes",value(){return[]}},{kind:"field",decorators:[(0,r.SB)()],key:"_network",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_filter",value:void 0},{kind:"field",key:"_autoZoom",value(){return!0}},{kind:"field",key:"_enablePhysics",value(){return!0}},{kind:"method",key:"firstUpdated",value:function(e){(0,o.Z)(i,"firstUpdated",this,3)([e]),this.zoomedDeviceIdFromURL&&(this.zoomedDeviceId=this.zoomedDeviceIdFromURL),this.hass&&this._fetchData(),this._network=new l.Zc(this._visualization,{},{autoResize:!0,layout:{improvedLayout:!0},physics:{barnesHut:{springConstant:0,avoidOverlap:10,damping:.09}},nodes:{font:{multi:"html"}},edges:{smooth:{enabled:!0,type:"continuous",forceDirection:"none",roundness:.6}}}),this._network.on("doubleClick",(e=>{const t=e.nodes[0];if(t){const e=this._devices.get(t);e&&(0,s.c)(`/config/devices/device/${e.device_reg_id}`)}})),this._network.on("click",(e=>{const t=e.nodes[0];if(t){const e=this._devices.get(t);e&&this._autoZoom&&(this.zoomedDeviceId=e.device_reg_id,this._zoomToDevice())}})),this._network.on("stabilized",(()=>{this.zoomedDeviceId&&this._zoomToDevice()}))}},{kind:"method",key:"render",value:function(){return(0,d.dy)(f||(f=g` <hass-tabs-subpage .tabs="${0}" .hass="${0}" .narrow="${0}" .isWide="${0}" .route="${0}" .header="${0}"> ${0} <div class="header"> ${0} <ha-device-picker .hass="${0}" .value="${0}" .label="${0}" .deviceFilter="${0}" @value-changed="${0}"></ha-device-picker> <div class="controls"> <ha-formfield .label="${0}"> <ha-checkbox @change="${0}" .checked="${0}"> </ha-checkbox> </ha-formfield> <ha-formfield .label="${0}"><ha-checkbox @change="${0}" .checked="${0}"> </ha-checkbox></ha-formfield> <mwc-button @click="${0}"> ${0} </mwc-button> </div> </div> <div id="visualization"></div> </hass-tabs-subpage> `),v.zhaTabs,this.hass,this.narrow,this.isWide,this.route,this.hass.localize("ui.panel.config.zha.visualization.header"),this.narrow?(0,d.dy)(m||(m=g` <div slot="header"> <search-input .hass="${0}" class="header" @value-changed="${0}" .filter="${0}" .label="${0}"> </search-input> </div> `),this.hass,this._handleSearchChange,this._filter,this.hass.localize("ui.panel.config.zha.visualization.highlight_label")):"",this.narrow?"":(0,d.dy)(b||(b=g`<search-input .hass="${0}" @value-changed="${0}" .filter="${0}" .label="${0}"></search-input>`),this.hass,this._handleSearchChange,this._filter,this.hass.localize("ui.panel.config.zha.visualization.highlight_label")),this.hass,this.zoomedDeviceId,this.hass.localize("ui.panel.config.zha.visualization.zoom_label"),this._filterDevices,this._onZoomToDevice,this.hass.localize("ui.panel.config.zha.visualization.auto_zoom"),this._handleAutoZoomCheckboxChange,this._autoZoom,this.hass.localize("ui.panel.config.zha.visualization.enable_physics"),this._handlePhysicsCheckboxChange,this._enablePhysics,this._refreshTopology,this.hass.localize("ui.panel.config.zha.visualization.refresh_topology"))}},{kind:"method",key:"_fetchData",value:async function(){const e=await(0,h.LO)(this.hass);this._devices=new Map(e.map((e=>[e.ieee,e]))),this._devicesByDeviceId=new Map(e.map((e=>[e.device_reg_id,e]))),this._updateDevices(e)}},{kind:"method",key:"_updateDevices",value:function(e){var t;this._nodes=[];const i=[];e.forEach((e=>{this._nodes.push({id:e.ieee,label:this._buildLabel(e),shape:this._getShape(e),mass:this._getMass(e),fixed:"Coordinator"===e.device_type,color:{background:e.available?"#66FF99":"#FF9999"}}),e.neighbors&&e.neighbors.length>0&&e.neighbors.forEach((t=>{const a=i.findIndex((i=>e.ieee===i.to&&t.ieee===i.from));if(-1===a){const a=this._getEdgeOptions(parseInt(t.lqi));i.push({from:e.ieee,to:t.ieee,label:t.lqi+"",color:a.color,width:a.width,length:a.length,physics:a.physics,arrows:{from:{enabled:"Child"!==t.relationship}},dashes:"Child"!==t.relationship})}else{const e=this._getEdgeOptions(Math.min(parseInt(i[a].label),parseInt(t.lqi)));i[a].label+=" & "+t.lqi,i[a].color=e.color,i[a].width=e.width,i[a].length=e.length,i[a].physics=e.physics,delete i[a].arrows,delete i[a].dashes}}))})),null===(t=this._network)||void 0===t||t.setData({nodes:this._nodes,edges:i})}},{kind:"method",key:"_getEdgeOptions",value:function(e){const t=2e3-4*e;return e>192?{color:{color:"#17ab00",highlight:"#17ab00"},width:e/20,length:t,physics:!1}:e>128?{color:{color:"#e6b402",highlight:"#e6b402"},width:9,length:t,physics:!1}:{color:{color:"#bfbfbf",highlight:"#bfbfbf"},width:1,length:t,physics:!1}}},{kind:"method",key:"_getMass",value:function(e){return e.available?"Coordinator"===e.device_type?2:"Router"===e.device_type?4:5:6}},{kind:"method",key:"_getShape",value:function(e){return"Coordinator"===e.device_type?"box":"Router"===e.device_type?"ellipse":"circle"}},{kind:"method",key:"_buildLabel",value:function(e){let t=null!==e.user_given_name?`<b>${e.user_given_name}</b>\n`:"";return t+=`<b>IEEE: </b>${e.ieee}`,t+=`\n<b>Device Type: </b>${e.device_type.replace("_"," ")}`,null!=e.nwk&&(t+=`\n<b>NWK: </b>${(0,u.xC)(e.nwk)}`),null!=e.manufacturer&&null!=e.model?t+=`\n<b>Device: </b>${e.manufacturer} ${e.model}`:t+="\n<b>Device is not in <i>'zigbee.db'</i></b>",e.area_id&&(t+=`\n<b>Area ID: </b>${e.area_id}`),t}},{kind:"method",key:"_handleSearchChange",value:function(e){this._filter=e.detail.value;const t=this._filter.toLowerCase();if(this._network)if(this._filter){const e=[];this._nodes.forEach((i=>{i.label&&i.label.toLowerCase().includes(t)&&e.push(i.id)})),this.zoomedDeviceId="",this._zoomOut(),this._network.selectNodes(e,!0)}else this._network.unselectAll()}},{kind:"method",key:"_onZoomToDevice",value:function(e){e.stopPropagation(),this.zoomedDeviceId=e.detail.value,this._network&&this._zoomToDevice()}},{kind:"method",key:"_zoomToDevice",value:function(){if(this._filter="",this.zoomedDeviceId){const e=this._devicesByDeviceId.get(this.zoomedDeviceId);e&&this._network.fit({nodes:[e.ieee],animation:{duration:500,easingFunction:"easeInQuad"}})}else this._zoomOut()}},{kind:"method",key:"_zoomOut",value:function(){this._network.fit({nodes:[],animation:{duration:500,easingFunction:"easeOutQuad"}})}},{kind:"method",key:"_refreshTopology",value:async function(){await(0,h.f3)(this.hass)}},{kind:"field",key:"_filterDevices",value(){return e=>{if(!this.hass)return!1;for(const t of e.identifiers)for(const e of t)if("zha"===e)return!0;return!1}}},{kind:"method",key:"_handleAutoZoomCheckboxChange",value:function(e){this._autoZoom=e.target.checked}},{kind:"method",key:"_handlePhysicsCheckboxChange",value:function(e){this._enablePhysics=e.target.checked,this._network.setOptions(this._enablePhysics?{physics:{enabled:!0}}:{physics:{enabled:!1}})}},{kind:"get",static:!0,key:"styles",value:function(){return[(0,d.iv)(k||(k=g`.header{border-bottom:1px solid var(--divider-color);padding:0 8px;display:flex;align-items:center;justify-content:space-between;height:var(--header-height);box-sizing:border-box}.header>*{padding:0 8px}:host([narrow]) .header{flex-direction:column;align-items:stretch;height:var(--header-height) * 2}.search-toolbar{display:flex;align-items:center;color:var(--secondary-text-color);padding:0 16px}search-input{flex:1;display:block}search-input.header{color:var(--secondary-text-color)}ha-device-picker{flex:1}.controls{display:flex;align-items:center;justify-content:space-between}#visualization{height:calc(100% - var(--header-height));width:100%}:host([narrow]) #visualization{height:calc(100% - (var(--header-height) * 2))}`))]}}]}}),d.oi);a()}catch(f){a(f)}}))},22152:function(){Element.prototype.toggleAttribute||(Element.prototype.toggleAttribute=function(e,t){return void 0!==t&&(t=!!t),this.hasAttribute(e)?!!t||(this.removeAttribute(e),!1):!1!==t&&(this.setAttribute(e,""),!0)})},31948:function(e,t,i){"use strict";i.a(e,(async function(e,t){try{i(71695),i(40251),i(47021);"function"!=typeof window.ResizeObserver&&(window.ResizeObserver=(await i.e("73378").then(i.bind(i,88198))).default),t()}catch(a){t(a)}}),1)}}]); //# sourceMappingURL=20035.5c18852d7738bb6a.js.map