"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["4206"],{60093:function(e,t,o){o.a(e,async function(e,s){try{o.r(t),o.d(t,{PowerViewStrategy:function(){return p}});o(44114),o(18111),o(13579),o(3362);var r=o(40445),a=o(96196),n=o(77845),c=o(38114),i=o(4203),l=o(7936),_=e([i,c]);[i,c]=_.then?(await _)():_;class p extends a.mN{static async generate(e,t){const o=e.collection_key||i.DEFAULT_ENERGY_COLLECTION_KEY,s=(0,c.tb)(t,{key:o});await s.refresh();const r=s.prefs,a=null==r?void 0:r.energy_sources.some(e=>!("solar"!==e.type||!e.stat_rate)||(!("battery"!==e.type||!e.stat_rate)||"grid"===e.type&&(!!e.stat_rate||!!e.power_config))),n=null==r?void 0:r.device_consumption.some(e=>e.stat_rate),_=null==r?void 0:r.device_consumption_water.some(e=>e.stat_rate),p=null==r?void 0:r.energy_sources.some(e=>"water"===e.type&&e.stat_rate),y=null==r?void 0:r.energy_sources.some(e=>"gas"===e.type&&e.stat_rate),u={type:"grid",cards:[]},d=[],g={type:"sections",sections:[u]};if(!(r&&(a||n||_||p||y)))return g;if(a&&(d.push({type:"power-total",collection_key:o}),u.cards.push({title:t.localize("ui.panel.energy.cards.power_sources_graph_title"),type:"power-sources-graph",collection_key:o,grid_options:{columns:36}})),y&&d.push({type:"gas-total",collection_key:o}),p&&d.push({type:"water-total",collection_key:o}),n){const e=(0,l.V)(r.device_consumption,t,e=>e.stat_rate);u.cards.push({title:t.localize("ui.panel.energy.cards.power_sankey_title"),type:"power-sankey",collection_key:o,group_by_floor:e,group_by_area:e,grid_options:{columns:36}})}if(_){const e=(0,l.V)(r.device_consumption_water,t,e=>e.stat_rate);u.cards.push({title:t.localize("ui.panel.energy.cards.water_flow_sankey_title"),type:"water-flow-sankey",collection_key:o,group_by_floor:e,group_by_area:e,grid_options:{columns:36}})}return d.length&&(g.badges=d),g}}p=(0,r.Cg)([(0,n.EM)("power-view-strategy")],p),s()}catch(p){s(p)}})}}]);
//# sourceMappingURL=4206.1a9a85d6d332192c.js.map