(self.webpackJsonp=self.webpackJsonp||[]).push([[213],{504:function(t,e,i){"use strict";i.d(e,"a",function(){return s});const s=(t,e)=>{const i=e.operator||"==",s=e.value||e,n=e.attribute?t.attributes[e.attribute]:t.state;switch(i){case"==":return n===s;case"<=":return n<=s;case"<":return n<s;case">=":return n>=s;case">":return n>s;case"!=":return n!==s;case"regex":return n.match(s);default:return!1}}},812:function(t,e,i){"use strict";i.r(e);var s=i(504),n=i(305),r=i(312);function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}customElements.define("hui-entity-filter-card",class extends HTMLElement{constructor(...t){super(...t),a(this,"isPanel",void 0),a(this,"_editMode",!1),a(this,"_element",void 0),a(this,"_config",void 0),a(this,"_configEntities",void 0),a(this,"_baseCardConfig",void 0),a(this,"_hass",void 0),a(this,"_oldEntities",void 0)}getCardSize(){return this._element?this._element.getCardSize():1}setConfig(t){if(!t.entities||!Array.isArray(t.entities))throw new Error("entities must be specified.");if(!(t.state_filter&&Array.isArray(t.state_filter)||t.entities.every(t=>"object"==typeof t&&t.state_filter&&Array.isArray(t.state_filter))))throw new Error("Incorrect filter config.");this._config=t,this._configEntities=void 0,this._baseCardConfig=Object.assign({type:"entities",entities:[]},this._config.card),this.lastChild&&(this.removeChild(this.lastChild),this._element=void 0)}set editMode(t){this._editMode=t,this._element&&(this._element.editMode=t)}set hass(t){if(!t||!this._config)return;if(!this.haveEntitiesChanged(t))return void(this._hass=t);this._hass=t,this._configEntities||(this._configEntities=Object(n.a)(this._config.entities));const e=this._configEntities.filter(e=>{const i=t.states[e.entity];if(!i)return!1;if(e.state_filter){for(const t of e.state_filter)if(Object(s.a)(i,t))return!0}else for(const t of this._config.state_filter)if(Object(s.a)(i,t))return!0;return!1});if(0===e.length&&!1===this._config.show_empty)return void(this.style.display="none");const i=this._cardElement();i&&("HUI-ERROR-CARD"!==i.tagName&&(this._oldEntities&&e.length===this._oldEntities.length&&e.every((t,e)=>t===this._oldEntities[e])||(this._oldEntities=e,i.setConfig(Object.assign({},this._baseCardConfig,{entities:e}))),i.isPanel=this.isPanel,i.editMode=this._editMode,i.hass=t),this.lastChild||this.appendChild(i),this.style.display="block")}haveEntitiesChanged(t){if(!this._hass)return!0;if(!this._configEntities)return!0;for(const e of this._configEntities)if(this._hass.states[e.entity]!==t.states[e.entity]||this._hass.localize!==t.localize)return!0;return!1}_cardElement(){if(!this._element&&this._config){const t=Object(r.a)(this._baseCardConfig);this._element=t}return this._element}})}}]);
//# sourceMappingURL=chunk.8e5b70585de92fa96e47.js.map