"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["51603"],{44830:function(e,t,n){n.r(t),n.d(t,{CommonControlsSectionStrategy:function(){return o}});n(74423),n(44114),n(13609),n(18111),n(22489),n(61701),n(3362),n(62953);var i=n(40445),s=n(96196),l=n(77845),a=n(36312);class o extends s.mN{static async generate(e,t){var n,i,s;const l={type:"grid",cards:[]};var o;if(e.heading)null===(o=l.cards)||void 0===o||o.push(e.heading);else if(e.title){var c;null===(c=l.cards)||void 0===c||c.push({type:"heading",heading:e.title,icon:e.icon,visibility:e.title_visibilty})}if(!(0,a.x)(t,"usage_prediction"))return l.cards.push({type:"markdown",content:t.localize("ui.panel.lovelace.strategy.common_controls.not_loaded")}),l.disabled=e.hide_empty,l;const r=await(e=>e.callWS({type:"usage_prediction/common_control"}))(t);let d=r.entities.filter(e=>e in t.states);null!==(n=e.exclude_entities)&&void 0!==n&&n.length&&(d=d.filter(t=>!e.exclude_entities.includes(t))),null!==(i=e.include_entities)&&void 0!==i&&i.length&&(d=d.filter(t=>!e.include_entities.includes(t)),d.unshift(...e.include_entities.filter(e=>e in t.states)));const u=null!==(s=e.limit)&&void 0!==s?s:8;return d=d.slice(0,u),d.length>0?l.cards.push(...d.map(e=>({type:"tile",entity:e,state_content:["state","area_name"],show_entity_picture:!0}))):(l.cards.push({type:"markdown",content:t.localize("ui.panel.lovelace.strategy.common_controls.no_data")}),l.disabled=e.hide_empty),l}}o=(0,i.Cg)([(0,l.EM)("common-controls-section-strategy")],o)}}]);
//# sourceMappingURL=51603.87586a3a5ef8fac7.js.map