"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["86236"],{97431:function(e,t,s){s.a(e,async function(e,n){try{s.r(t),s.d(t,{EnergySetupWizard:function(){return N}});var i,a,r,h,c,p,o,u,g,f,l,_,y=s(61397),d=s(50264),v=s(72153),k=s(44734),A=s(43080),b=s(69683),w=s(6454),C=(s(28706),s(40445)),m=s(96196),q=s(77845),x=s(1087),z=s(38114),D=s(65063),F=s(14503),M=s(23206),W=s(76135),E=s(28166),S=s(54081),Z=s(38726),j=s(70604),B=s(18350),H=e([M,W,E,S,Z,j,B,z]);[M,W,E,S,Z,j,B,z]=H.then?(await H)():H;var N=function(e){function t(){var e;(0,k.A)(this,t);for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];return(e=(0,b.A)(this,t,[].concat(n)))._step=0,e._preferences={energy_sources:[],device_consumption:[],device_consumption_water:[]},e}return(0,w.A)(t,e),(0,A.A)(t,[{key:"getCardSize",value:function(){return 10}},{key:"setConfig",value:function(e){e.preferences&&(this._preferences=e.preferences)}},{key:"firstUpdated",value:function(){this.hass.loadFragmentTranslation("config"),this._fetchconfig()}},{key:"render",value:function(){return(0,m.qy)(i||(i=(0,v.A)([" <p> "," </p> ",' <div class="buttons"> '," "," </div> "])),this.hass.localize("ui.panel.energy.setup.step",{step:this._step+1,steps:6}),0===this._step?(0,m.qy)(a||(a=(0,v.A)(['<ha-energy-grid-settings .hass="','" .preferences="','" @value-changed="','"></ha-energy-grid-settings>'])),this.hass,this._preferences,this._prefsChanged):1===this._step?(0,m.qy)(r||(r=(0,v.A)(['<ha-energy-solar-settings .hass="','" .preferences="','" .info="','" @value-changed="','"></ha-energy-solar-settings>'])),this.hass,this._preferences,this._info,this._prefsChanged):2===this._step?(0,m.qy)(h||(h=(0,v.A)(['<ha-energy-battery-settings .hass="','" .preferences="','" @value-changed="','"></ha-energy-battery-settings>'])),this.hass,this._preferences,this._prefsChanged):3===this._step?(0,m.qy)(c||(c=(0,v.A)(['<ha-energy-gas-settings .hass="','" .preferences="','" @value-changed="','"></ha-energy-gas-settings>'])),this.hass,this._preferences,this._prefsChanged):4===this._step?(0,m.qy)(p||(p=(0,v.A)(['<ha-energy-water-settings .hass="','" .preferences="','" @value-changed="','"></ha-energy-water-settings>'])),this.hass,this._preferences,this._prefsChanged):(0,m.qy)(o||(o=(0,v.A)(['<ha-energy-device-settings .hass="','" .preferences="','" @value-changed="','"></ha-energy-device-settings>'])),this.hass,this._preferences,this._prefsChanged),this._step>0?(0,m.qy)(u||(u=(0,v.A)(['<ha-button appearance="plain" @click="','">',"</ha-button>"])),this._back,this.hass.localize("ui.panel.energy.setup.back")):(0,m.qy)(g||(g=(0,v.A)(["<div></div>"]))),this._step<4?(0,m.qy)(f||(f=(0,v.A)(['<ha-button @click="','">',"</ha-button>"])),this._next,this.hass.localize("ui.panel.energy.setup.next")):(0,m.qy)(l||(l=(0,v.A)(['<ha-button @click="','"> '," </ha-button>"])),this._setupDone,this.hass.localize("ui.panel.energy.setup.done")))}},{key:"_fetchconfig",value:(n=(0,d.A)((0,y.A)().m(function e(){return(0,y.A)().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,(0,z.BV)(this.hass);case 1:this._info=e.v;case 2:return e.a(2)}},e,this)})),function(){return n.apply(this,arguments)})},{key:"_prefsChanged",value:function(e){this._preferences=e.detail.value}},{key:"_back",value:function(){0!==this._step&&this._step--}},{key:"_next",value:function(){5!==this._step&&this._step++}},{key:"_setupDone",value:(s=(0,d.A)((0,y.A)().m(function e(){var t;return(0,y.A)().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this._preferences){e.n=1;break}return e.a(2);case 1:if(0!==this._preferences.device_consumption.length||0!==this._preferences.energy_sources.length){e.n=2;break}return(0,D.showAlertDialog)(this,{title:this.hass.localize("ui.panel.energy.setup.no_statistics_selected_title"),text:this.hass.localize("ui.panel.energy.setup.no_statistics_selected_description")}),e.a(2);case 2:return e.p=2,e.n=3,(0,z.WN)(this.hass,this._preferences);case 3:this._preferences=e.v,e.n=5;break;case 4:e.p=4,t=e.v,(0,D.showAlertDialog)(this,{title:"Failed to save config: ".concat(t.message)});case 5:(0,x.r)(this,"reload-energy-panel");case 6:return e.a(2)}},e,this,[[2,4]])})),function(){return s.apply(this,arguments)})}],[{key:"styles",get:function(){return[F.RF,(0,m.AH)(_||(_=(0,v.A)([":host{display:block;padding:16px;max-width:700px;margin:0 auto}ha-button{margin-top:8px}.buttons{display:flex;justify-content:space-between}"])))]}}]);var s,n}(m.WF);(0,C.Cg)([(0,q.MZ)({attribute:!1})],N.prototype,"hass",void 0),(0,C.Cg)([(0,q.MZ)({attribute:!1})],N.prototype,"lovelace",void 0),(0,C.Cg)([(0,q.wk)()],N.prototype,"_info",void 0),(0,C.Cg)([(0,q.wk)()],N.prototype,"_step",void 0),(0,C.Cg)([(0,q.wk)()],N.prototype,"_preferences",void 0),N=(0,C.Cg)([(0,q.EM)("energy-setup-wizard-card")],N),n()}catch(R){n(R)}})}}]);
//# sourceMappingURL=86236.b1697824ecaeec91.js.map