export const __rspack_esm_id="77388";export const __rspack_esm_ids=["77388"];export const __webpack_modules__={51527(t,i,e){e.a(t,async function(t,s){try{e.r(i);var n=e(62826),o=e(44457),r=e(1087),a=e(33121),h=e(37693),d=t([h]);h=(d.then?(await d)():d)[0];class c extends h.E{static async getConfigElement(){return await Promise.all([e.e("44533"),e.e("92769"),e.e("68637"),e.e("91863"),e.e("91793")]).then(e.bind(e,82632)),document.createElement("hui-conditional-card-editor")}static getStubConfig(){return{type:"conditional",conditions:[],card:{}}}setConfig(t){if(this.validateConfig(t),!t.card)throw new Error("No card configured");this._element=this._createCardElement(t.card)}getCardSize(){return(0,a.Z)(this._element)}_createCardElement(t){const i=document.createElement("hui-card");return i.hass=this.hass,i.preview=this.preview,i.config=t,i.load(),i}setVisibility(t){const i=this.preview||t,e=this.hidden;super.setVisibility(t),e!==this.hidden&&(0,r.r)(this,"card-visibility-changed",{value:i})}}c=(0,n.Cg)([(0,o.EM)("hui-conditional-card")],c),s()}catch(t){s(t)}})},37693(t,i,e){e.a(t,async function(t,s){try{e.d(i,{E:()=>c});e(18111),e(22489);var n=e(62826),o=e(96196),r=e(44457),a=e(91263),h=e(14487),d=t([a,h]);[a,h]=d.then?(await d)():d;class c extends((0,a.M)(o.mN)){createRenderRoot(){return this}validateConfig(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,h.db)(t.conditions))throw new Error("Conditions are invalid");this.lastChild&&this.removeChild(this.lastChild),this._config=t}disconnectedCallback(){super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),this._updateVisibility()}setupConditionalListeners(){if(!this._config||!this.hass)return;const t=this._config.conditions.filter(t=>"condition"in t);super.setupConditionalListeners(t)}update(t){super.update(t),(t.has("_element")||t.has("_config")||t.has("hass")||t.has("preview"))&&(this.clearConditionalListeners(),this.setupConditionalListeners(),this._updateVisibility())}_updateVisibility(t){if(!this._element||!this.hass||!this._config)return;this._element.preview=this.preview;const i=t??(0,h.XH)(this._config.conditions,this.hass);this.setVisibility(i)}setVisibility(t){if(!this._element||!this.hass)return;const 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)}constructor(...t){super(...t),this.preview=!1}}(0,n.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,n.Cg)([(0,r.MZ)({type:Boolean})],c.prototype,"preview",void 0),(0,n.Cg)([(0,r.wk)()],c.prototype,"_config",void 0),c=(0,n.Cg)([(0,r.EM)("hui-conditional-base")],c),s()}catch(t){s(t)}})}};
//# sourceMappingURL=77388.63587eb56c49f5bf.js.map