(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8905],{16967:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user-management/profile/[id]",function(){return i(5675)}])},5675:function(e,n,i){"use strict";i.r(n),i.d(n,{default:function(){return v}});var r=i(24246),d=i(69746),s=i(86677),u=i(27378),a=i(45007),t=i(33990),l=i(36223),o=i(38615),_=i(10284),c=i(31756);let f=e=>{var n,i,r,d;let s=(0,a.v9)(l.dy),[u]=(0,c.Gl)(),t={username:null!==(n=e.username)&&void 0!==n?n:"",email_address:null!==(i=e.email_address)&&void 0!==i?i:"",first_name:null!==(r=e.first_name)&&void 0!==r?r:"",last_name:null!==(d=e.last_name)&&void 0!==d?d:"",password:"",id:e.id},f=async n=>u({...e,...n}),m=!!s&&s.id===e.id,h=(0,o.Tg)([_.Sh.USER_UPDATE]);return{handleSubmit:f,isOwnProfile:m,canUpdateUser:!!m||h,initialValues:t}};var m=e=>{let{user:n}=e,{handleSubmit:i,canUpdateUser:d,initialValues:s}=f(n);return(0,r.jsx)("div",{children:(0,r.jsx)("main",{children:(0,r.jsx)(t.Z,{onSubmit:i,initialValues:s,canEditNames:d})})})},h=i(91747),E=i(44296),v=()=>{let e=(0,s.useRouter)(),n=(0,E.T)(),i="";i=e.query.id?Array.isArray(e.query.id)?e.query.id[0]:e.query.id:"";let{data:a,isLoading:t}=(0,c.Fk)(i),f=(0,E.C)(l.dy),v=!!f&&!!a&&f.id===a.id,j=(0,o.Tg)([_.Sh.USER_UPDATE])||v;return((0,u.useEffect)(()=>{a&&n((0,c.Vv)(a.id))},[n,a,j]),(0,u.useEffect)(()=>{a&&!j&&e.push("/")},[e,j,a]),t)?(0,r.jsx)(h.Z,{children:(0,r.jsx)(d.$jN,{})}):null==a?(0,r.jsx)(h.Z,{children:"Could not find profile ID."}):(0,r.jsx)(h.Z,{children:(0,r.jsx)(m,{user:a})})}}},function(e){e.O(0,[3662,6104,6569,2888,9774,179],function(){return e(e.s=16967)}),_N_E=e.O()}]);