(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 h}});var i=n(44359),t=n(11163),s=(n(67294),n(59499)),u=n(50029),o=n(16835),a=n(87794),l=n.n(a),c=n(23256),d=n(14416),f=n(37161),p=n(43072),m=n(53547),v=n(85893);function b(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,i)}return n}function y(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?b(Object(n),!0).forEach((function(r){(0,s.Z)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var j=function(e){var r=function(e,r){var n,i,t,s,a,c,m=(0,d.useSelector)(f.mT),v=(0,d.useSelector)(f.dy),b=(0,p.Gl)(),j=(0,o.Z)(b,1)[0],O={organization_fides_key:null!==(n=m.organization_fides_key)&&void 0!==n?n:"",username:null!==(i=e.username)&&void 0!==i?i:"",first_name:null!==(t=e.first_name)&&void 0!==t?t:"",last_name:null!==(s=e.last_name)&&void 0!==s?s:"",password:"",scopes:null!==(a=r.scopes)&&void 0!==a?a:[],id:e.id},h=function(){var r=(0,u.Z)(l().mark((function r(n){var i;return l().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=y(y({},e),n),r.abrupt("return",j(i));case 2:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),_=!!v&&v.id===e.id,w=(0,p.gU)(null!==(c=null===v||void 0===v?void 0:v.id)&&void 0!==c?c:"").data;return{handleSubmit:h,isOwnProfile:_,canUpdateUser:!!_||!!w&&w.scopes.includes("user:update"),initialValues:O}}(e.user,e.permissions),n=r.isOwnProfile,i=r.handleSubmit,t=r.canUpdateUser,s=r.initialValues;return(0,v.jsx)("div",{children:(0,v.jsxs)("main",{children:[(0,v.jsx)(c.X6,{mb:4,fontSize:"xl",colorScheme:"primary",children:"Profile"}),(0,v.jsx)(c.iz,{mb:7}),(0,v.jsx)(m.Z,{onSubmit:i,initialValues:s,canEditNames:t,canChangePassword:n})]})})},O=n(33278),h=function(){var e=(0,t.useRouter)(),r="";r=e.query.id?Array.isArray(e.query.id)?e.query.id[0]:e.query.id:"";var n=(0,p.Fk)(r),s=n.data,u=n.isLoading,o=(0,p.gU)(r),a=o.data,l=o.isLoading;return u||l?(0,v.jsx)(O.Z,{title:"Edit User",children:(0,v.jsx)(i.$,{})}):null==s||null==a?(0,v.jsx)(O.Z,{title:"Edit User",children:"Could not find profile ID."}):(0,v.jsx)(O.Z,{title:"Edit User",children:(0,v.jsx)(j,{user:s,permissions: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,[5372,7601,248,2350,6648,4231,440,7140,7080,3382,9774,2888,179],(function(){return r=12432,e(e.s=r);var r}));var r=e.O();_N_E=r}]);