"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["18591"],{86242:function(e,t,n){n.a(e,async function(e,i){try{n.r(t),n.d(t,{EnergyViewStrategy:function(){return p}});n(44114),n(18111),n(20116),n(13579),n(3362);var s=n(40445),o=n(96196),r=n(77845),c=n(38114),l=n(4203),a=n(7936),y=n(20246),g=e([l,c]);[l,c]=g.then?(await g)():g;class p extends o.mN{static async generate(e,t){const n=e.collection_key||l.DEFAULT_ENERGY_COLLECTION_KEY,i={type:"sections",sections:[],sidebar:{sections:[{cards:[]}],visibility:[y.r]},footer:{card:{type:"energy-date-selection",collection_key:n,opening_direction:"right",vertical_opening_direction:"up"}}},s=(0,c.tb)(t,{key:n});s.prefs||await s.refresh();const o=s.prefs;if(!o||0===o.device_consumption.length&&0===o.energy_sources.length)return i;const r=o.energy_sources.find(e=>!("grid"!==e.type||!e.stat_energy_from&&!e.stat_energy_to)),g=o.energy_sources.some(e=>"grid"===e.type&&!!e.stat_energy_to),p=o.energy_sources.some(e=>"solar"===e.type),u=o.energy_sources.some(e=>"battery"===e.type),_=[],d=[],h=i.sidebar.sections[0];if(r||u||p){const e={title:t.localize("ui.panel.energy.cards.energy_distribution_title"),type:"energy-distribution",collection_key:n};h.cards.push(e),i.sections.push({type:"grid",column_span:1,cards:[e],visibility:[y.B]})}if(g){const e={type:"energy-grid-neutrality-gauge",collection_key:n};d.push(e)}if(p){if(g){const e={type:"energy-solar-consumed-gauge",collection_key:n};d.push(e)}if(r){const e={type:"energy-self-sufficiency-gauge",collection_key:n};d.push(e)}}if(r){const e={type:"energy-carbon-consumed-gauge",collection_key:n};d.push(e)}if(d.length&&(h.cards.push({type:"grid",columns:1===d.length?1:2,cards:d}),i.sections.push({type:"grid",column_span:1,visibility:[y.B],cards:1===d.length?[d[0]]:d.map(e=>Object.assign(Object.assign({},e),{},{grid_options:{columns:6}}))})),_.push({type:"energy-compare",collection_key:n,grid_options:{columns:36}}),(r||u)&&_.push({title:t.localize("ui.panel.energy.cards.energy_usage_graph_title"),type:"energy-usage-graph",collection_key:n,grid_options:{columns:36}}),p&&_.push({title:t.localize("ui.panel.energy.cards.energy_solar_graph_title"),type:"energy-solar-graph",collection_key:n,grid_options:{columns:36}}),(r||p||u)&&_.push({title:t.localize("ui.panel.energy.cards.energy_sources_table_title"),type:"energy-sources-table",collection_key:n,types:["grid","solar","battery"],grid_options:{columns:36}}),o.device_consumption.length){const e=(0,a.V)(o.device_consumption,t,e=>e.stat_consumption);_.push({title:t.localize("ui.panel.energy.cards.energy_devices_detail_graph_title"),type:"energy-devices-detail-graph",collection_key:n,grid_options:{columns:36}}),_.push({title:t.localize("ui.panel.energy.cards.energy_devices_graph_title"),type:"energy-devices-graph",collection_key:n,grid_options:{columns:36}}),_.push({title:t.localize("ui.panel.energy.cards.energy_sankey_title"),type:"energy-sankey",collection_key:n,group_by_floor:e,group_by_area:e,grid_options:{columns:36}})}return i.sections.push({type:"grid",column_span:3,cards:_}),i}}p=(0,s.Cg)([(0,r.EM)("energy-view-strategy")],p),i()}catch(p){i(p)}})},20246:function(e,t,n){n.d(t,{B:function(){return s},r:function(){return i}});const i={condition:"screen",media_query:"(min-width: 871px)"},s={condition:"not",conditions:[i]}}}]);
//# sourceMappingURL=18591.0ac04d61c169b758.js.map