(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8905],{32205:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return w}});var t=n(49609),i=n(11163),u=n(67294),s=n(59499),a=n(50029),c=n(16835),o=n(87794),l=n.n(o),d=n(2664),f=n(77979),p=n(37161),b=n(10867),h=n(74015),v=n(43072),y=n(85893);function O(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function j(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?O(Object(n),!0).forEach((function(r){(0,s.Z)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var _=function(e){var r=function(e){var r,n,t,i=(0,d.useSelector)(p.dy),u=(0,v.Gl)(),s=(0,c.Z)(u,1)[0],o={username:null!==(r=e.username)&&void 0!==r?r:"",first_name:null!==(n=e.first_name)&&void 0!==n?n:"",last_name:null!==(t=e.last_name)&&void 0!==t?t:"",password:"",id:e.id},f=function(){var r=(0,a.Z)(l().mark((function r(n){var t;return l().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=j(j({},e),n),r.abrupt("return",s(t));case 2:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),y=!!i&&i.id===e.id,O=(0,b.Tg)([h.Sh.USER_UPDATE]);return{handleSubmit:f,isOwnProfile:y,canUpdateUser:!!y||O,initialValues:o}}(e.user),n=r.handleSubmit,t=r.canUpdateUser,i=r.initialValues;return(0,y.jsx)("div",{children:(0,y.jsx)("main",{children:(0,y.jsx)(f.Z,{onSubmit:n,initialValues:i,canEditNames:t})})})},m=n(33278),E=n(97142),w=function(){var e=(0,i.useRouter)(),r=(0,E.T)(),n="";n=e.query.id?Array.isArray(e.query.id)?e.query.id[0]:e.query.id:"";var s=(0,v.Fk)(n),a=s.data,c=s.isLoading,o=(0,E.C)(p.dy),l=!(!o||!a)&&o.id===a.id,d=(0,b.Tg)([h.Sh.USER_UPDATE])||l;return(0,u.useEffect)((function(){a&&r((0,v.Vv)(a.id))}),[r,a,d]),(0,u.useEffect)((function(){a&&!d&&e.push("/")}),[e,d,a]),c?(0,y.jsx)(m.Z,{title:"Edit User",children:(0,y.jsx)(t.$,{})}):null==a?(0,y.jsx)(m.Z,{title:"Edit User",children:"Could not find profile ID."}):(0,y.jsx)(m.Z,{title:"Edit User",children:(0,y.jsx)(_,{user:a})})}},12432:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user-management/profile/[id]",function(){return n(32205)}])}},function(e){e.O(0,[2437,3880,4231,2495,3879,8686,5363,9774,2888,179],(function(){return r=12432,e(e.s=r);var r}));var r=e.O();_N_E=r}]);