!function(){function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var t,a,o=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(c){s=!0,a=c}finally{try{i||null==n.return||n.return()}finally{if(s)throw a}}return o}(e,r)||n(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function a(e,r,n,t,a,o,i){try{var s=e[o](i),c=s.value}catch(u){return void n(u)}s.done?r(c):Promise.resolve(c).then(t,a)}function o(e){return function(){var r=this,n=arguments;return new Promise((function(t,o){var i=e.apply(r,n);function s(e){a(i,t,o,s,c,"next",e)}function c(e){a(i,t,o,s,c,"throw",e)}s(void 0)}))}}System.register(["./vendor-legacy.046e8265.js","./UserEditPage-legacy.e4814a7b.js","./index-legacy.b746a8e2.js","./useAsyncCallbackPending-legacy.c335b7a3.js","./validators-legacy.f6481eb9.js","./v4-legacy.e076e6f6.js"],(function(n){"use strict";var t,a,i,s,c,u,l,f,d,m,g,p,v,y,h,b,w;return{setters:[function(e){t=e.k,a=e.r,i=e.h,s=e.F,c=e.j,u=e.K,l=e.Y,f=e.B},function(e){d=e.s},function(e){m=e.a,g=e.R,p=e.m,v=e.u,y=e.b,h=e.h,b=e.t},function(e){w=e.u},function(){},function(){}],execute:function(){function S(){return(S=o(regeneratorRuntime.mark((function e(r){var n,t,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.user.getUserMeta({username:r,getPrivileges:!0});case 2:if(n=e.sent,t=n.requestError,a=n.response,!t){e.next=9;break}throw new g(t,{showRefresh:!0,showBack:!0});case 9:if(!a.error){e.next=11;break}throw new g(p("user_edit.errors.".concat(a.error)));case 11:return e.abrupt("return",a);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}n("fetchData",(function(e){return S.apply(this,arguments)}));var j=function(e){return e.EditHomepage="EditHomepage",e.ManageUser="ManageUser",e.ManageUserGroup="ManageUserGroup",e.ManageProblem="ManageProblem",e.ManageContest="ManageContest",e.ManageDiscussion="ManageDiscussion",e.SkipRecaptcha="SkipRecaptcha",e}(j||{});n("View",t((function(n){var t=v("user_edit.privilege");a.exports.useEffect((function(){y.enterNewPage("".concat(t(".title")," - ").concat(n.meta.username),null,!1)}),[y.locale,n.meta]);var g=r(h(),2)[1],p=r(w(o(regeneratorRuntime.mark((function r(){var a,o,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,m.user.setUserPrivileges({userId:n.meta.id,privileges:e(A)});case 2:a=r.sent,o=a.requestError,i=a.response,o?b.error(o(t)):i.error?b.error(t("user_edit.errors.".concat(i.error))):(g(!1),b.success(t(".success")));case 6:case"end":return r.stop()}}),r)})))),2),S=p[0],k=p[1],x=r(a.exports.useState(new Set(n.privileges)),2),A=x[0],M=x[1];var P=y.currentUser.isAdmin;return i(s,{children:[c(u,{className:d.sectionHeader,size:"large",content:t(".header")}),Object.values(j).map((function(e){return i("div",{className:d.privilegeRow,children:[c(l,{toggle:!0,readOnly:!P,label:t(".privileges.".concat(e,".name")),checked:A.has(e),onChange:function(r,n){var t=n.checked;return function(e,r){var n=new Set(A);r?n.add(e):n.delete(e),M(n),g(!0)}(e,t)}}),c("div",{className:d.notes,children:t(".privileges.".concat(e,".notes"))})]},e)})),c("div",{className:d.notes+" "+d.notesAdminOnly,children:t(".admin_only")}),c(f,{className:d.submit,loading:S,disabled:!P,primary:!0,content:t(".submit"),onClick:k})]})})))}}}))}();
