"use strict";var x=Object.create;var m=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var F=Object.getPrototypeOf;var R=Object.prototype.hasOwnProperty;var k=(s,e)=>m(s,"name",{value:e,configurable:true});var H=(s,e)=>{for(var o in e)m(s,o,{get:e[o],enumerable:true})};var v=(s,e,o,r)=>{if(e&&typeof e==="object"||typeof e==="function"){for(let t of E(e))if(!R.call(s,t)&&t!==o)m(s,t,{get:()=>e[t],enumerable:!(r=M(e,t))||r.enumerable})}return s};var l=(s,e,o)=>(o=s!=null?x(F(s)):{},v(e||!s||!s.__esModule?m(o,"default",{value:s,enumerable:true}):o,s));var U=s=>v(m({},"__esModule",{value:true}),s);var _=(s,e,o,r)=>{var t=r>1?void 0:r?M(e,o):e;for(var n=s.length-1,i;n>=0;n--)if(i=s[n])t=(r?i(e,o,t):i(t))||t;if(r&&t)m(e,o,t);return t};var W={};H(W,{default:()=>T});module.exports=U(W);var a=require("react/jsx-runtime");var L=require("mobx-react");var w=require("react");var g=require("react-intl");var d=require("lodash");var c=require("../../helpers/validation-helpers");var b=l(require("../../i18n/globalMessages"));var I=l(require("../../lib/Form"));var y=l(require("../ui/Infobox"));var f=l(require("../ui/Link"));var h=l(require("../ui/button"));var N=require("../ui/headline");var S=l(require("../ui/input/index"));const u=(0,g.defineMessages)({headline:{id:"password.headline",defaultMessage:"Reset password"},emailLabel:{id:"password.email.label",defaultMessage:"Email address"},successInfo:{id:"password.successInfo",defaultMessage:"Your new password was sent to your email address"},noUser:{id:"password.noUser",defaultMessage:"No user with that email address was found"},signupLink:{id:"password.link.signup",defaultMessage:"Create a free account"},loginLink:{id:"password.link.login",defaultMessage:"Sign in to your account"}});let p=class extends w.Component{form;constructor(e){super(e);this.form=new I.default({fields:{email:{label:this.props.intl.formatMessage(u.emailLabel),value:"",validators:[c.required,c.email]}}})}submit(e){e.preventDefault();this.form.submit({onSuccess:o=>{this.props.onSubmit(o.values())},onError:d.noop})}render(){const{form:e}=this;const{isSubmitting:o,signupRoute:r,loginRoute:t,status:n,intl:i}=this.props;return(0,a.jsxs)("div",{className:"auth__container",children:[(0,a.jsxs)("form",{className:"franz-form auth__form",onSubmit:C=>this.submit(C),children:[(0,a.jsx)(f.default,{to:"/auth/welcome",children:(0,a.jsx)("img",{src:"./assets/images/logo.svg",className:"auth__logo",alt:""})}),(0,a.jsx)(N.H1,{children:i.formatMessage(u.headline)}),n.length>0&&n.includes("sent")&&(0,a.jsx)(y.default,{type:"success",icon:"checkbox-marked-circle-outline",children:i.formatMessage(u.successInfo)}),(0,a.jsx)(S.default,{...e.$("email").bind(),focus:true}),n.length>0&&n.includes("no-user")&&(0,a.jsx)("p",{className:"error-message center",children:i.formatMessage(u.noUser)}),o?(0,a.jsx)(h.default,{className:"auth__button is-loading",buttonType:"secondary",label:`${i.formatMessage(b.default.submit)} ...`,loaded:false,onClick:d.noop,disabled:true}):(0,a.jsx)(h.default,{type:"submit",className:"auth__button",label:i.formatMessage(b.default.submit),onClick:d.noop})]}),(0,a.jsxs)("div",{className:"auth__links",children:[(0,a.jsx)(f.default,{to:t,children:i.formatMessage(u.loginLink)}),(0,a.jsx)(f.default,{to:r,children:i.formatMessage(u.signupLink)})]})]})}};k(p,"Password");p=_([L.observer],p);var T=(0,g.injectIntl)(p);
