"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[4604],{50903:function(e,t,n){n.r(t),n.d(t,{CommonControlsSectionStrategy:function(){return y}});var i=n(36854),r=n(74512),a=n(98117),s=n(57567),o=n(25979),c=n(12463),l=n(16472),u=(n(28706),n(2008),n(74423),n(62062),n(44114),n(34782),n(18111),n(22489),n(61701),n(26099),n(3362),n(21699),n(15697)),d=n(57527),p=n(51209),h=n(98295),f=function(e){return e.callWS({type:"usage_prediction/common_control"})},m=function(e){return{type:"tile",entity:e,state_content:["state","area_name"],show_entity_picture:!0}},y=function(e){function t(){return(0,s.A)(this,t),(0,l.A)(this,t,arguments)}return(0,c.A)(t,e),(0,o.A)(t,null,[{key:"generate",value:(n=(0,a.A)((0,i.A)().m(function e(t,n){var a,s,o,c,l,u,d,p,y,_,g;return(0,i.A)().w(function(e){for(;;)switch(e.n){case 0:if(o={type:"grid",cards:[]},t.heading?null===(c=o.cards)||void 0===c||c.push(t.heading):t.title&&(null===(l=o.cards)||void 0===l||l.push({type:"heading",heading:t.title,icon:t.icon,visibility:t.title_visibilty})),u=null!==(a=t.limit)&&void 0!==a?a:8,!((d=(t.include_entities||[]).filter(function(e){return e in n.states})).length>=u)){e.n=1;break}return(p=o.cards).push.apply(p,(0,r.A)(d.slice(0,u).map(m))),e.a(2,o);case 1:if((0,h.x)(n.config,"usage_prediction")){e.n=2;break}return o.cards.push({type:"markdown",content:n.localize("ui.panel.lovelace.strategy.common_controls.not_loaded")}),o.disabled=t.hide_empty,e.a(2,o);case 2:return e.n=3,f(n);case 3:if(y=e.v,_=y.entities.filter(function(e){var i,r;return!(!(e in n.states)||null!==(i=n.entities[e])&&void 0!==i&&i.hidden||null!==(r=t.exclude_entities)&&void 0!==r&&r.includes(e)||d.includes(e))}),0!==(g=[].concat((0,r.A)(d),(0,r.A)(_)).slice(0,u)).length){e.n=4;break}return o.cards.push({type:"markdown",content:n.localize("ui.panel.lovelace.strategy.common_controls.no_data")}),o.disabled=t.hide_empty,e.a(2,o);case 4:return(s=o.cards).push.apply(s,(0,r.A)(g.map(m))),e.a(2,o)}},e)})),function(e,t){return n.apply(this,arguments)})}]);var n}(d.mN);y.registryDependencies=[],y=(0,u.Cg)([(0,p.EM)("common-controls-section-strategy")],y)}}]);
//# sourceMappingURL=4604.b6c3523a97e518a9.js.map