"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["77388"],{51527:function(t,i,e){e.a(t,async function(t,n){try{e.r(i);var s=e(61397),a=e(50264),o=e(44734),r=e(43080),h=e(69683),c=e(25460),l=e(6454),u=(e(16280),e(23792),e(26099),e(3362),e(47764),e(62953),e(40445)),d=e(77845),f=e(1087),v=e(33121),y=e(37693),p=t([y]),C=function(t){function i(){return(0,o.A)(this,i),(0,h.A)(this,i,arguments)}return(0,l.A)(i,t),(0,r.A)(i,[{key:"setConfig",value:function(t){if(this.validateConfig(t),!t.card)throw new Error("No card configured");this._element=this._createCardElement(t.card)}},{key:"getCardSize",value:function(){return(0,v.Z)(this._element)}},{key:"_createCardElement",value:function(t){var i=document.createElement("hui-card");return i.hass=this.hass,i.preview=this.preview,i.config=t,i.load(),i}},{key:"setVisibility",value:function(t){var e=this.preview||t,n=this.hidden;(0,c.A)(i,"setVisibility",this,3)([t]),n!==this.hidden&&(0,f.r)(this,"card-visibility-changed",{value:e})}}],[{key:"getConfigElement",value:(n=(0,a.A)((0,s.A)().m(function t(){return(0,s.A)().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([e.e("44533"),e.e("92769"),e.e("68637"),e.e("37406"),e.e("30244"),e.e("88815"),e.e("16523")]).then(e.bind(e,82632));case 1:return t.a(2,document.createElement("hui-conditional-card-editor"))}},t)})),function(){return n.apply(this,arguments)})},{key:"getStubConfig",value:function(){return{type:"conditional",conditions:[],card:{}}}}]);var n}((y=(p.then?(await p)():p)[0]).E);C=(0,u.Cg)([(0,d.EM)("hui-conditional-card")],C),n()}catch(g){n(g)}})},37693:function(t,i,e){e.a(t,async function(t,n){try{e.d(i,{E:function(){return y}});var s=e(44734),a=e(43080),o=e(69683),r=e(6454),h=e(25460),c=(e(49255),e(16280),e(28706),e(2008),e(18111),e(22489),e(26099),e(40445)),l=e(96196),u=e(77845),d=e(91263),f=e(14487),v=t([d,f]);[d,f]=v.then?(await v)():v;var y=function(t){function i(){var t;(0,s.A)(this,i);for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return(t=(0,o.A)(this,i,[].concat(n))).preview=!1,t}return(0,r.A)(i,t),(0,a.A)(i,[{key:"createRenderRoot",value:function(){return this}},{key:"validateConfig",value:function(t){if(!t.conditions)throw new Error("No conditions configured");if(!Array.isArray(t.conditions))throw new Error("Conditions need to be an array");if(!(0,f.db)(t.conditions))throw new Error("Conditions are invalid");this.lastChild&&this.removeChild(this.lastChild),this._config=t}},{key:"disconnectedCallback",value:function(){(0,h.A)(i,"disconnectedCallback",this,3)([])}},{key:"connectedCallback",value:function(){(0,h.A)(i,"connectedCallback",this,3)([]),this._updateVisibility()}},{key:"setupConditionalListeners",value:function(){if(this._config&&this.hass){var t=this._config.conditions.filter(function(t){return"condition"in t});(0,h.A)(i,"setupConditionalListeners",this,3)([t])}}},{key:"update",value:function(t){(0,h.A)(i,"update",this,3)([t]),(t.has("_element")||t.has("_config")||t.has("hass")||t.has("preview"))&&(this.clearConditionalListeners(),this.setupConditionalListeners(),this._updateVisibility())}},{key:"_updateVisibility",value:function(t){if(this._element&&this.hass&&this._config){this._element.preview=this.preview;var i=null!=t?t:(0,f.XH)(this._config.conditions,this.hass);this.setVisibility(i)}}},{key:"setVisibility",value:function(t){if(this._element&&this.hass){var i=this.preview||t;this.hidden!==!i&&(this.toggleAttribute("hidden",!i),this.style.setProperty("display",i?"":"none")),i?(this._element.hass=this.hass,this._element.parentElement||this.appendChild(this._element)):this._element.parentElement&&this.removeChild(this._element)}}}])}((0,d.M)(l.mN));(0,c.Cg)([(0,u.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,c.Cg)([(0,u.MZ)({type:Boolean})],y.prototype,"preview",void 0),(0,c.Cg)([(0,u.wk)()],y.prototype,"_config",void 0),y=(0,c.Cg)([(0,u.EM)("hui-conditional-base")],y),n()}catch(p){n(p)}})}}]);
//# sourceMappingURL=77388.bc161d98824c4440.js.map