"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["11844"],{7466:function(t,e,s){s.a(t,async function(t,a){try{s.r(e),s.d(e,{CloudForgotPasswordCard:function(){return f}});s(3362),s(62953);var r=s(40445),o=s(96196),i=s(77845),n=s(1087),l=s(89300),d=s(38962),h=(s(76776),s(75709),s(14503)),c=s(71117),u=s(79007),p=t([l,d]);[l,d]=p.then?(await p)():p;let g,y,_,w,m=t=>t;class f extends o.WF{render(){return this.cardLess?this._renderContent():(0,o.qy)(g||(g=m` <ha-card outlined .header="${0}"> ${0} </ha-card> `),this.localize(`ui.panel.${this.translationKeyPanel}.subtitle`),this._renderContent())}_renderContent(){var t;return(0,o.qy)(y||(y=m` <div class="card-content"> <p> ${0} </p> ${0} <ha-textfield autofocus id="email" label="${0}" .value="${0}" type="email" required .disabled="${0}" @keydown="${0}" .validationMessage="${0}"></ha-textfield> </div> <div class="card-actions"> <ha-progress-button @click="${0}" .progress="${0}"> ${0} </ha-progress-button> </div> `),this.localize(`ui.panel.${this.translationKeyPanel}.instructions`),this._error?(0,o.qy)(_||(_=m`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):o.s6,this.localize(`ui.panel.${this.translationKeyPanel}.email`),null!==(t=this.email)&&void 0!==t?t:"",this._inProgress,this._keyDown,this.localize(`ui.panel.${this.translationKeyPanel}.email_error_msg`),this._handleEmailPasswordReset,this._inProgress,this.localize(`ui.panel.${this.translationKeyPanel}.send_reset_email`))}_keyDown(t){"Enter"===t.key&&this._handleEmailPasswordReset()}async _handleEmailPasswordReset(){const t=this.emailField,e=t.value;t.reportValidity()?(this._inProgress=!0,this._resetPassword(e)):t.focus()}static get styles(){return[h.RF,(0,o.AH)(w||(w=m`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}`))]}constructor(...t){super(...t),this.translationKeyPanel="config.cloud.forgot_password",this.cardLess=!1,this._inProgress=!1,this._resetPassword=async t=>{this._inProgress=!0;try{this.hass?await(0,c.Ut)(this.hass,t):await(0,u.zN)(t),(0,n.r)(this,"cloud-email-changed",{value:t}),this._inProgress=!1,(0,n.r)(this,"cloud-done",{flashMessage:this.localize(`ui.panel.${this.translationKeyPanel}.check_your_email`)})}catch(e){this._inProgress=!1;"usernotfound"===(e&&e.body&&e.body.code)&&t!==t.toLowerCase()?await this._resetPassword(t.toLowerCase()):this._error=e&&e.body&&e.body.message?e.body.message:"Unknown error"}}}}(0,r.Cg)([(0,i.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,r.Cg)([(0,i.MZ)({attribute:!1})],f.prototype,"localize",void 0),(0,r.Cg)([(0,i.MZ)({attribute:"translation-key-panel"})],f.prototype,"translationKeyPanel",void 0),(0,r.Cg)([(0,i.MZ)()],f.prototype,"email",void 0),(0,r.Cg)([(0,i.MZ)({type:Boolean,attribute:"card-less"})],f.prototype,"cardLess",void 0),(0,r.Cg)([(0,i.wk)()],f.prototype,"_inProgress",void 0),(0,r.Cg)([(0,i.wk)()],f.prototype,"_error",void 0),(0,r.Cg)([(0,i.P)("#email",!0)],f.prototype,"emailField",void 0),f=(0,r.Cg)([(0,i.EM)("cloud-forgot-password-card")],f),a()}catch(g){a(g)}})},92949:function(t,e,s){s.a(t,async function(t,a){try{s.r(e),s.d(e,{CloudForgotPassword:function(){return g}});s(62953);var r=s(40445),o=s(96196),i=s(77845),n=s(7466),l=s(81310),d=s(14503),h=t([n,l]);[n,l]=h.then?(await h)():h;let c,u,p=t=>t;class g extends o.WF{render(){return(0,o.qy)(c||(c=p` <hass-subpage .hass="${0}" .narrow="${0}" .header="${0}"> <div class="content"> <cloud-forgot-password-card .hass="${0}" .localize="${0}" .email="${0}"></cloud-forgot-password-card> </div> </hass-subpage> `),this.hass,this.narrow,this.hass.localize("ui.panel.config.cloud.forgot_password.title"),this.hass,this.hass.localize,this.email)}static get styles(){return[d.RF,(0,o.AH)(u||(u=p`.content{padding-bottom:24px}`))]}constructor(...t){super(...t),this.narrow=!1,this._requestInProgress=!1}}(0,r.Cg)([(0,i.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,r.Cg)([(0,i.MZ)({type:Boolean})],g.prototype,"narrow",void 0),(0,r.Cg)([(0,i.MZ)()],g.prototype,"email",void 0),(0,r.Cg)([(0,i.wk)()],g.prototype,"_requestInProgress",void 0),g=(0,r.Cg)([(0,i.EM)("cloud-forgot-password")],g),a()}catch(c){a(c)}})}}]);
//# sourceMappingURL=11844.9a224a4d5a93a6d9.js.map