"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["79927"],{7466:function(e,t,a){a.a(e,async function(e,r){try{a.r(t),a.d(t,{CloudForgotPasswordCard:function(){return C}});var n,s,o,i,l=a(72153),c=a(61397),d=a(50264),u=a(44734),h=a(43080),p=a(75864),y=a(69683),f=a(6454),g=(a(28706),a(40445)),_=a(96196),v=a(77845),m=a(1087),w=a(89300),k=(a(38962),a(76776),a(75709),a(14503)),P=a(71117),b=a(79007),A=e([w]);w=(A.then?(await A)():A)[0];var C=function(e){function t(){var e;(0,u.A)(this,t);for(var a=arguments.length,r=new Array(a),n=0;n<a;n++)r[n]=arguments[n];return(e=(0,y.A)(this,t,[].concat(r))).translationKeyPanel="config.cloud.forgot_password",e.cardLess=!1,e._inProgress=!1,e._resetPassword=function(){var t=(0,d.A)((0,c.A)().m(function t(a){var r;return(0,c.A)().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e._inProgress=!0,t.p=1,!e.hass){t.n=3;break}return t.n=2,(0,P.Ut)(e.hass,a);case 2:t.n=4;break;case 3:return t.n=4,(0,b.zN)(a);case 4:(0,m.r)((0,p.A)(e),"cloud-email-changed",{value:a}),e._inProgress=!1,(0,m.r)((0,p.A)(e),"cloud-done",{flashMessage:e.localize("ui.panel.".concat(e.translationKeyPanel,".check_your_email"))}),t.n=8;break;case 5:if(t.p=5,r=t.v,e._inProgress=!1,"usernotfound"!==(r&&r.body&&r.body.code)||a===a.toLowerCase()){t.n=7;break}return t.n=6,e._resetPassword(a.toLowerCase());case 6:t.n=8;break;case 7:e._error=r&&r.body&&r.body.message?r.body.message:"Unknown error";case 8:return t.a(2)}},t,null,[[1,5]])}));return function(e){return t.apply(this,arguments)}}(),e}return(0,f.A)(t,e),(0,h.A)(t,[{key:"render",value:function(){return this.cardLess?this._renderContent():(0,_.qy)(n||(n=(0,l.A)([' <ha-card outlined .header="','"> '," </ha-card> "])),this.localize("ui.panel.".concat(this.translationKeyPanel,".subtitle")),this._renderContent())}},{key:"_renderContent",value:function(){var e;return(0,_.qy)(s||(s=(0,l.A)([' <div class="card-content"> <p> '," </p> ",' <ha-textfield autofocus id="email" label="','" .value="','" type="email" required .disabled="','" @keydown="','" .validationMessage="','"></ha-textfield> </div> <div class="card-actions"> <ha-progress-button @click="','" .progress="','"> '," </ha-progress-button> </div> "])),this.localize("ui.panel.".concat(this.translationKeyPanel,".instructions")),this._error?(0,_.qy)(o||(o=(0,l.A)(['<ha-alert alert-type="error">',"</ha-alert>"])),this._error):_.s6,this.localize("ui.panel.".concat(this.translationKeyPanel,".email")),null!==(e=this.email)&&void 0!==e?e:"",this._inProgress,this._keyDown,this.localize("ui.panel.".concat(this.translationKeyPanel,".email_error_msg")),this._handleEmailPasswordReset,this._inProgress,this.localize("ui.panel.".concat(this.translationKeyPanel,".send_reset_email")))}},{key:"_keyDown",value:function(e){"Enter"===e.key&&this._handleEmailPasswordReset()}},{key:"_handleEmailPasswordReset",value:(a=(0,d.A)((0,c.A)().m(function e(){var t,a;return(0,c.A)().w(function(e){for(;;)switch(e.n){case 0:if(t=this.emailField,a=t.value,t.reportValidity()){e.n=1;break}return t.focus(),e.a(2);case 1:this._inProgress=!0,this._resetPassword(a);case 2:return e.a(2)}},e,this)})),function(){return a.apply(this,arguments)})}],[{key:"styles",get:function(){return[k.RF,(0,_.AH)(i||(i=(0,l.A)(["ha-card{max-width:600px;margin:0 auto;margin-top:24px}h1{margin:0}ha-textfield{width:100%}.card-actions{display:flex;justify-content:flex-end;align-items:center}"])))]}}]);var a}(_.WF);(0,g.Cg)([(0,v.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,g.Cg)([(0,v.MZ)({attribute:!1})],C.prototype,"localize",void 0),(0,g.Cg)([(0,v.MZ)({attribute:"translation-key-panel"})],C.prototype,"translationKeyPanel",void 0),(0,g.Cg)([(0,v.MZ)()],C.prototype,"email",void 0),(0,g.Cg)([(0,v.MZ)({type:Boolean,attribute:"card-less"})],C.prototype,"cardLess",void 0),(0,g.Cg)([(0,v.wk)()],C.prototype,"_inProgress",void 0),(0,g.Cg)([(0,v.wk)()],C.prototype,"_error",void 0),(0,g.Cg)([(0,v.P)("#email",!0)],C.prototype,"emailField",void 0),C=(0,g.Cg)([(0,v.EM)("cloud-forgot-password-card")],C),r()}catch(x){r(x)}})}}]);
//# sourceMappingURL=79927.9ab11ffafffc6dc8.js.map