(function(){"use strict";BX.namespace("BX.UI");BX.UI.AccessRights=function(t){t=t||{};this.options=t;this.renderTo=t.renderTo;this.buttonPanel=BX.UI.ButtonPanel||null;this.layout={container:null};this.component=t.component?t.component:null;this.actionSave=t.actionSave?t.actionSave:"save";this.actionDelete=t.actionDelete?t.actionDelete:"delete";this.actionLoad=t.actionLoad?t.actionLoad:"load";this.mode=t.mode?t.mode:"ajax";this.openPopupEvent=t.openPopupEvent?t.openPopupEvent:null;this.popupContainer=t.popupContainer?t.popupContainer:null;this.additionalSaveParams=t.additionalSaveParams?t.additionalSaveParams:null;this.loadParams=t.loadParams?t.loadParams:null;this.loader=null;this.timer=null;this.initData();if(t.userGroups){this.userGroups=t.userGroups}if(t.accessRights){this.accessRights=t.accessRights}this.isRequested=false;this.loadData();this.bindEvents()};BX.UI.AccessRights.prototype={bindEvents:function(){BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:updateRole",this.updateRole.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:accessOn",this.updateAccessRight.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:accessOff",this.updateAccessRight.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:update",this.adjustButtonPanel.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:addRole",this.addUserGroup.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:addRole",this.addRoleColumn.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:copyRole",this.addRoleColumn.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:copyRole",this.addUserGroup.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:removeRole",this.removeRoleColumn.bind(this));BX.addCustomEvent("BX.UI.AccessRights.ColumnItem:removeRole",this.adjustButtonPanel.bind(this));BX.addCustomEvent("BX.Main.SelectorV2:onGetEntityTypes",this.onGetEntityTypes.bind(this))},initData:function(){this.accessRights=[];this.userGroups=[];this.accessRightsSections=[];this.headSection=null;this.members=[];this.columns=[]},fireEventReset:function(){BX.onCustomEvent(window,"BX.UI.AccessRights:reset",this)},fireEventRefresh:function(){BX.onCustomEvent(window,"BX.UI.AccessRights:refresh",this)},getButtonPanel:function(){return this.buttonPanel},showNotification:function(t){BX.UI.Notification.Center.notify({content:t,position:"top-right",autoHideDelay:3e3})},sendActionRequest:function(){if(this.isRequested){return}this.isRequested=true;this.timer=setTimeout(function(){this.blockGrid()}.bind(this),1e3);var t=false;var e=[];for(var i=0;i=0){this.userGroups[e].title=t.data.text}},adjustButtonPanel:function(){var t=this.getMainContainer().querySelectorAll(".ui-access-rights-column-item-changer-on");var e=this.getMainContainer().querySelectorAll(".ui-access-rights-column-new");var i=this.getMainContainer().querySelectorAll(".ui-access-rights-members-item-new");if(t.length>0||e.length>0||i.length>0){this.buttonPanel.show()}else{this.buttonPanel.hide()}},updateAccessRight:function(t){var e=t.data;var i=this.userGroups[this.userGroups.indexOf(e.userGroup)];var s=e.access.id;for(var n=0;n