"use strict";var N=Object.create;var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var H=Object.getPrototypeOf;var T=Object.prototype.hasOwnProperty;var h=(a,s)=>d(a,"name",{value:s,configurable:true});var k=(a,s)=>{for(var o in s)d(a,o,{get:s[o],enumerable:true})};var M=(a,s,o,n)=>{if(s&&typeof s==="object"||typeof s==="function"){for(let t of $(s))if(!T.call(a,t)&&t!==o)d(a,t,{get:()=>s[t],enumerable:!(n=v(s,t))||n.enumerable})}return a};var c=(a,s,o)=>(o=a!=null?N(H(a)):{},M(s||!a||!a.__esModule?d(o,"default",{value:a,enumerable:true}):o,a));var C=a=>M(d({},"__esModule",{value:true}),a);var P=(a,s,o,n)=>{var t=n>1?void 0:n?v(s,o):s;for(var l=a.length-1,f;l>=0;l--)if(f=a[l])t=(n?f(s,o,t):f(t))||t;if(n&&t)d(s,o,t);return t};var x={};k(x,{default:()=>F});module.exports=C(x);var e=require("react/jsx-runtime");var p=require("lodash");var y=require("mobx-react");var _=require("react");var u=require("react-intl");var w=require("react-router-dom");var S=c(require("../../ui/Infobox"));var I=c(require("../../ui/Radio"));var g=c(require("../../ui/button"));var b=require("../../ui/headline");var r=c(require("../../ui/input/index"));const i=(0,u.defineMessages)({headline:{id:"settings.account.headline",defaultMessage:"Account"},headlineProfile:{id:"settings.account.headlineProfile",defaultMessage:"Update profile"},headlineAccount:{id:"settings.account.headlineAccount",defaultMessage:"Account information"},headlinePassword:{id:"settings.account.headlinePassword",defaultMessage:"Change password"},successInfo:{id:"settings.account.successInfo",defaultMessage:"Your changes have been saved"},buttonSave:{id:"settings.account.buttonSave",defaultMessage:"Update profile"}});let m=class extends _.Component{submit(s){s.preventDefault();this.props.form.submit({onSuccess:o=>{const n=o.values();this.props.onSubmit(n)},onError:p.noop})}render(){const{status:s,form:o,isSaving:n,intl:t}=this.props;return(0,e.jsxs)("div",{className:"settings__main",children:[(0,e.jsxs)("div",{className:"settings__header",children:[(0,e.jsx)("span",{className:"settings__header-item",children:(0,e.jsx)(w.Link,{to:"/settings/user",children:t.formatMessage(i.headline)})}),(0,e.jsx)("span",{className:"separator"}),(0,e.jsx)("span",{className:"settings__header-item",children:t.formatMessage(i.headlineProfile)})]}),(0,e.jsx)("div",{className:"settings__body",children:(0,e.jsxs)("form",{onSubmit:l=>this.submit(l),id:"form",children:[s.length>0&&s.includes("data-updated")&&(0,e.jsx)(S.default,{type:"success",icon:"checkbox-marked-circle-outline",children:t.formatMessage(i.successInfo)}),(0,e.jsx)(b.H2,{children:t.formatMessage(i.headlineAccount)}),(0,e.jsxs)("div",{className:"grid__row",children:[(0,e.jsx)(r.default,{...o.$("firstname").bind(),focus:true}),(0,e.jsx)(r.default,{...o.$("lastname").bind()})]}),(0,e.jsx)(r.default,{...o.$("email").bind()}),(0,e.jsx)(I.default,{field:o.$("accountType"),className:""}),o.$("accountType").value==="company"&&(0,e.jsx)(r.default,{...o.$("organization").bind()}),(0,e.jsx)(b.H2,{children:t.formatMessage(i.headlinePassword)}),(0,e.jsx)(r.default,{...o.$("oldPassword").bind(),showPasswordToggle:true}),(0,e.jsx)(r.default,{...o.$("newPassword").bind(),showPasswordToggle:true,scorePassword:true})]})}),(0,e.jsx)("div",{className:"settings__controls",children:n?(0,e.jsx)(g.default,{type:"submit",label:t.formatMessage(i.buttonSave),loaded:!n,buttonType:"secondary",disabled:true,onClick:p.noop}):(0,e.jsx)(g.default,{type:"submit",label:t.formatMessage(i.buttonSave),htmlForm:"form",onClick:p.noop})})]})}};h(m,"EditUserForm");m=P([y.observer],m);var F=(0,u.injectIntl)(m);
