Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/modules/ui/install/js/ui/accessrights/v2/dist/
Upload File :
Current File : /var/www/homesaver/www/bitrix/modules/ui/install/js/ui/accessrights/v2/dist/v2.bundle.min.js

this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};this.BX.UI.AccessRights=this.BX.UI.AccessRights||{};(function(e,t,s,i,o,r,n,a,l,c,u,d,h,p,v,g,b){"use strict";class m{getComponentName(){throw new Error("not implemented")}getEmptyValue(e){var t;return(t=e.emptyValue)!=null?t:new Set}getMinValue(e){if(!b.Type.isNil(e.minValue)){return e.minValue}return null}getMaxValue(e){if(!b.Type.isNil(e.maxValue)){return e.maxValue}return null}isRowValueConfigurable(){return true}}class S extends m{getComponentName(){return"DependentVariables"}}class f extends m{getComponentName(){return"Multivariables"}}class y extends m{getComponentName(){return"Toggler"}getEmptyValue(e){const t=!e.emptyValue||!e.emptyValue[0];if(t){return new Set(["0"])}return super.getEmptyValue(e)}getMinValue(e){const t=super.getMinValue(e);if(!b.Type.isNull(t)){return t}return new Set(["0"])}getMaxValue(e){const t=super.getMaxValue(e);if(!b.Type.isNull(t)){return t}return new Set(["1"])}isRowValueConfigurable(){return false}}class I extends m{getComponentName(){return"Variables"}}var L=babelHelpers.classPrivateFieldLooseKey("cache");class C{static getHint(e){return babelHelpers.classPrivateFieldLooseBase(this,L)[L].remember(`hint-${e}`,(()=>BX.UI.Hint.createInstance({id:`ui-access-rights-v2-hint-${e}`,popupParameters:{className:"ui-access-rights-v2-popup-pointer-events ui-hint-popup",autoHide:true,darkMode:true,maxWidth:280,offsetTop:0,offsetLeft:8,angle:true,animation:"fading-slide"}})))}static getValueTypeByRight(e){return this.getValueType(e.type)}static getValueType(e){const t=String(e);return babelHelpers.classPrivateFieldLooseBase(this,L)[L].remember(t,(()=>{if(t==="dependent_variables"){return new S}if(t==="multivariables"){return new f}if(t==="toggler"){return new y}if(t==="variables"){return new I}console.warn("ui.accessrights.v2: Unknown access right type",e);return null}))}}Object.defineProperty(C,L,{writable:true,value:new b.Cache.MemoryCache});const P=Object.freeze({ROLE:"ui.accessrights.v2~role-selector",MEMBER:"ui.accessrights.v2~member-selector",VARIABLE:"ui.accessrights.v2~variable-selector"});const w=Object.freeze({ROLE:"ui.accessrights.v2~role",VARIABLE:"ui.accessrights.v2~variable"});const R={name:"Selector",emits:["close"],props:{userGroup:{type:Object,required:true},bindNode:{type:HTMLElement,required:true}},computed:{selectedItems(){const e=[];for(const t of this.userGroup.members.keys()){e.push(this.getItemIdByAccessCode(t))}return e}},mounted(){new r.Dialog({enableSearch:true,context:P.MEMBER,alwaysShowLabels:true,entities:[{id:"user",options:{intranetUsersOnly:true,emailUsers:false,inviteEmployeeLink:false,inviteGuestLink:false}},{id:"department",options:{selectMode:"usersAndDepartments",allowSelectRootDepartment:true,allowFlatDepartments:true}},{id:"project",dynamicLoad:true,options:{addProjectMetaUsers:true},itemOptions:{default:{link:"",linkTitle:""}}},{id:"site-groups",dynamicLoad:true,dynamicSearch:true}],targetNode:this.bindNode,preselectedItems:this.selectedItems,cacheable:false,events:{"Item:onSelect":this.onMemberAdd,"Item:onDeselect":this.onMemberRemove,onHide:()=>{this.$emit("close")}}}).show()},methods:{getItemIdByAccessCode(e){if(/^I?U(\d+)$/.test(e)){const t=e.match(/^I?U(\d+)$/)||null;const s=t?t[1]:null;return["user",s]}if(/^DR(\d+)$/.test(e)){const t=e.match(/^DR(\d+)$/)||null;const s=t?t[1]:null;return["department",s]}if(/^D(\d+)$/.test(e)){const t=e.match(/^D(\d+)$/)||null;const s=t?t[1]:null;return["department",`${s}:F`]}if(/^G(\d+)$/.test(e)){const t=e.match(/^G(\d+)$/)||null;const s=t?t[1]:null;return["site-groups",s]}if(/^SG(\d+)_([AEK])$/.test(e)){const t=e.match(/^SG(\d+)_([AEK])$/)||null;const s=t?t[1]:null;const i=t?t[2]:null;return["project",`${s}:${i}`]}return["unknown",e]},onMemberAdd(e){const t=this.getMemberFromEvent(e);this.$store.dispatch("userGroups/addMember",{userGroupId:this.userGroup.id,accessCode:t.id,member:t})},onMemberRemove(e){const t=this.getMemberFromEvent(e);this.$store.dispatch("userGroups/removeMember",{userGroupId:this.userGroup.id,accessCode:t.id})},getMemberFromEvent(e){const{item:t}=e.getData();return{id:this.getAccessCodeByItem(t),type:this.getMemberTypeByItem(t),name:t.title.text,avatar:b.Type.isStringFilled(t.avatar)?t.avatar:null}},getAccessCodeByItem(e){const t=e.entityId;if(t==="user"){return`U${e.id}`}if(t==="department"){if(b.Type.isString(e.id)&&e.id.endsWith(":F")){const t=e.id.match(/^(\d+):F$/);const s=t?t[1]:null;return`D${s}`}return`DR${e.id}`}if(t==="site-groups"){return`G${e.id}`}if(t==="project"){const t=e.customData.get("metauser");const s=e.customData.get("projectId");if(t==="owner"){return`SG${s}_A`}if(t==="moderator"){return`SG${s}_E`}if(t==="all"){return`SG${s}_K`}}return""},getMemberTypeByItem(e){switch(e.entityId){case"user":return"users";case"intranet":case"department":return"departments";case"socnetgroup":case"project":return"sonetgroups";case"group":return"groups";case"site-groups":return"usergroups";default:return""}}},template:"<div hidden></div>"};const M={name:"SingleMember",props:{member:{type:Object,required:true}},computed:{avatarBackgroundImage(){return`url(${encodeURI(this.member.avatar)})`},noAvatarClass(){if(this.member.type==="groups"){return"ui-icon-common-user-group"}if(this.member.type==="sonetgroups"||this.member.type==="departments"){return"ui-icon-common-company"}if(this.member.type==="usergroups"){return"ui-icon-common-user-group"}return"ui-icon-common-user"}},template:`\n\t\t<div class='ui-access-rights-v2-members-item'>\n\t\t\t<a v-if="member.avatar" class='ui-access-rights-v2-members-item-avatar' :title="member.name" :style="{\n\t\t\t\tbackgroundImage: avatarBackgroundImage,\n\t\t\t\tbackgroundSize: 'cover',\n\t\t\t}"></a>\n\t\t\t<a v-else class='ui-icon ui-access-rights-v2-members-item-icon' :class="noAvatarClass" :title="member.name">\n\t\t\t\t<i></i>\n\t\t\t</a>\n\t\t</div>\n\t`};const H=5;const V={name:"Members",components:{SingleMember:M,Selector:R},props:{userGroup:{type:Object,required:true}},data(){return{isSelectorShown:false,isSelectedMembersPopupShown:false}},popup:null,computed:{shownMembers(){if(this.userGroup.members.size<=H){return this.userGroup.members}const e=[...this.userGroup.members].slice(0,H);return new Map(e)},notShownMembersCount(){if(this.userGroup.members.size>H){return this.userGroup.members.size-H}return 0},bindNode(){return this.$refs.container}},template:`\n\t\t<div ref="container" class="ui-access-rights-v2-members-container"  @click="isSelectorShown = true">\n\t\t\t<div v-if="userGroup.members.size > 0" class='ui-access-rights-v2-members'>\n\t\t\t\t<SingleMember v-for="[accessCode, member] in shownMembers" :key="accessCode" :member="member"/>\n\t\t\t\t<span v-if="notShownMembersCount > 0" class="ui-access-rights-v2-members-more">\n\t\t\t\t\t+ {{ notShownMembersCount }}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclass='ui-access-rights-v2-members-item ui-access-rights-v2-members-item-add'\n\t\t\t\t:class="{\n\t\t\t\t\t'--show-always': userGroup.members.size <= 0,\n\t\t\t\t\t'--has-siblings': userGroup.members.size > 0,\n\t\t\t\t}"\n\t\t\t>\n\t\t\t\t<div class="ui-icon-set --plus-30"></div>\n\t\t\t</div>\n\t\t\t<Selector\n\t\t\t\tv-if="isSelectorShown"\n\t\t\t\t:user-group="userGroup"\n\t\t\t\t:bind-node="bindNode"\n\t\t\t\t@close="isSelectorShown = false"\n\t\t\t/>\n\t\t</div>\n\t`};const B={name:"RoleHeading",components:{RichMenuPopup:h.RichMenuPopup,RichMenuItem:h.RichMenuItem},props:{userGroup:{type:Object,required:true}},data(){return{isEdit:false,isPopupShown:false}},computed:{RichMenuItemIcon:()=>h.RichMenuItemIcon,...g.mapState({isSaving:e=>e.application.isSaving,guid:e=>e.application.guid,maxVisibleUserGroups:e=>e.application.options.maxVisibleUserGroups}),...g.mapGetters({isMaxVisibleUserGroupsReached:"userGroups/isMaxVisibleUserGroupsReached",isMaxValueSetForAny:"accessRights/isMaxValueSetForAny",isMinValueSetForAny:"accessRights/isMinValueSetForAny"}),title:{get(){return this.userGroup.title},set(e){this.$store.dispatch("userGroups/setRoleTitle",{userGroupId:this.userGroup.id,title:e})}}},watch:{isEdit(e){if(e===true){this.bindClickedOutsideHandler();void this.$nextTick((()=>{this.$refs.input.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"});this.$refs.input.focus();this.$refs.input.select()}))}else{this.unbindClickedOutsideHandler()}}},mounted(){if(this.userGroup.isNew){this.isEdit=true}},beforeUnmount(){this.unbindClickedOutsideHandler()},methods:{bindClickedOutsideHandler(){b.Event.bind(window,"click",this.turnOffEditWhenClickedOutside,{capture:true})},unbindClickedOutsideHandler(){b.Event.unbind(window,"click",this.turnOffEditWhenClickedOutside,{capture:true})},turnOffEditWhenClickedOutside(e){if(e.target!==this.$refs.input){this.isEdit=false}},showDeleteConfirmation(){const e=new c.Popup({bindElement:this.$refs.container,width:250,overlay:true,contentPadding:10,content:this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_POPUP_REMOVE_ROLE"),className:"ui-access-rights-v2-text-center",animation:"fading-slide",cacheable:false,buttons:[new i.Button({text:this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_POPUP_REMOVE_ROLE_YES"),size:i.ButtonSize.SMALL,color:i.ButtonColor.PRIMARY,events:{click:()=>{e.destroy();this.$store.dispatch("userGroups/removeUserGroup",{userGroupId:this.userGroup.id})}}}),new i.CancelButton({size:i.ButtonSize.SMALL,events:{click:()=>{e.destroy()}}})]});e.show()},showActionsMenu(){if(!this.isSaving){this.isPopupShown=true}},onSetMaxValuesClick(){this.isPopupShown=false;this.$store.dispatch("userGroups/setMaxAccessRightValues",{userGroupId:this.userGroup.id})},onSetMinValuesClick(){this.isPopupShown=false;this.$store.dispatch("userGroups/setMinAccessRightValues",{userGroupId:this.userGroup.id})},onEnableEditClick(){this.isPopupShown=false;this.isEdit=true},onCopyRoleClick(){if(this.isMaxVisibleUserGroupsReached){return}this.isPopupShown=false;this.$store.dispatch("userGroups/copyUserGroup",{userGroupId:this.userGroup.id})},onDeleteRoleClick(){this.isPopupShown=false;this.showDeleteConfirmation()}},template:`\n\t\t<div ref="container" class='ui-access-rights-v2-role'>\n\t\t\t<div class="ui-access-rights-v2-role-value-container">\n\t\t\t\t<input\n\t\t\t\t\tv-if="isEdit && !isSaving"\n\t\t\t\t\tref="input"\n\t\t\t\t\ttype='text'\n\t\t\t\t\tclass='ui-access-rights-v2-role-input'\n\t\t\t\t\tv-model="title"\n\t\t\t\t\t:placeholder="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLE_NAME')"\n\t\t\t\t\t@keydown.enter="isEdit = false"\n\t\t\t\t/>\n\t\t\t\t<div v-else class='ui-access-rights-v2-role-value' :title="title">{{ title }}</div>\n\t\t\t</div>\n\t\t\t<div \n\t\t\t\tref="menu"\n\t\t\t\tclass="ui-icon-set --more ui-access-rights-v2-icon-more" \n\t\t\t\t@click="showActionsMenu"\n\t\t\t>\n\t\t\t\t<RichMenuPopup v-if="isPopupShown" @close="isPopupShown = false" :popup-options="{bindElement: $refs.menu}">\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\tv-if="isMaxValueSetForAny"\n\t\t\t\t\t\t:icon="RichMenuItemIcon.check"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MAX_ACCESS_RIGHTS')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MAX_ACCESS_RIGHTS_SUBTITLE')"\n\t\t\t\t\t\t@click="onSetMaxValuesClick"\n\t\t\t\t\t/>\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\tv-if="isMinValueSetForAny"\n\t\t\t\t\t\t:icon="RichMenuItemIcon['red-lock']"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MIN_ACCESS_RIGHTS')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MIN_ACCESS_RIGHTS_SUBTITLE')"\n\t\t\t\t\t\t@click="onSetMinValuesClick"\n\t\t\t\t\t/>\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\t:icon="RichMenuItemIcon.pencil"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_RENAME')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_RENAME_SUBTITLE')"\n\t\t\t\t\t\t@click="onEnableEditClick"\n\t\t\t\t\t/>\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\t:icon="RichMenuItemIcon.copy"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_COPY')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_COPY_ROLE_SUBTITLE')"\n\t\t\t\t\t\t:disabled="isMaxVisibleUserGroupsReached"\n\t\t\t\t\t\t:hint="\n\t\t\t\t\t\t\tisMaxVisibleUserGroupsReached\n\t\t\t\t\t\t\t\t? $Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLE_COPYING_DISABLED', {\n\t\t\t\t\t\t\t\t\t'#COUNT#': maxVisibleUserGroups,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t"\n\t\t\t\t\t\t@click="onCopyRoleClick"\n\t\t\t\t\t/>\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\t:icon="RichMenuItemIcon['trash-bin']"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_REMOVE')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_REMOVE_SUBTITLE')"\n\t\t\t\t\t\t@click="onDeleteRoleClick"\n\t\t\t\t\t/>\n\t\t\t\t</RichMenuPopup>\n\t\t\t</div>\n\t\t</div>\n\t`};class _{static mapUserGroups(e){const t=[];for(const s of e.values()){t.push({id:s.id,entityId:w.ROLE,title:s.title,supertitle:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ROLE"),avatar:"/bitrix/js/ui/accessrights/v2/images/role-avatar.svg",tabs:["recents"]})}return t}static mapVariables(e){const t=[];for(const s of e.values()){const e=b.Runtime.clone(s);e.entityId=e.entityId||w.VARIABLE;e.tabs="recents";t.push(e)}return t}}const E={template:`\n\t\t<div class='ui-access-rights-v2-column-item'>\n\t\t\t<slot/>\n\t\t</div>\n\t`};const G={template:`\n\t\t<div class='ui-access-rights-v2-column'>\n\t\t\t<slot/>\n\t\t</div>\n\t`};const F={name:"RolesControl",components:{CellLayout:E,ColumnLayout:G,RichMenuPopup:h.RichMenuPopup,RichMenuItem:h.RichMenuItem},props:{userGroups:{type:Map,required:true}},viewDialog:null,computed:{RichMenuItemIcon:()=>h.RichMenuItemIcon,...g.mapState({allUserGroups:e=>e.userGroups.collection,maxVisibleUserGroups:e=>e.application.options.maxVisibleUserGroups,guid:e=>e.application.guid}),...g.mapGetters({isMaxVisibleUserGroupsSet:"application/isMaxVisibleUserGroupsSet",isMaxVisibleUserGroupsReached:"userGroups/isMaxVisibleUserGroupsReached"}),shownGroupsCounter(){return this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ROLE_COUNTER",{"#VISIBLE_ROLES#":this.userGroups.size,"#ALL_ROLES#":this.allUserGroups.size,"#GREY_START#":'<span style="opacity: var(--ui-opacity-30)">',"#GREY_FINISH#":"</span>"})},copyDialogItems(){return _.mapUserGroups(this.allUserGroups)},viewDialogItems(){const e=[];for(const t of this.copyDialogItems){e.push({...t,selected:this.userGroups.has(t.id)})}return e}},data(){return{isPopupShown:false}},methods:{onCreateNewRoleClick(){if(this.isMaxVisibleUserGroupsReached){return}this.isPopupShown=false;this.$store.dispatch("userGroups/addUserGroup")},onRoleViewClick(){this.isPopupShown=false;this.showViewDialog(this.$refs.configure)},onCopyRoleClick(){if(this.isMaxVisibleUserGroupsReached){return}this.isPopupShown=false;this.showCopyDialog()},showCopyDialog(){const e=new r.Dialog({context:P.ROLE,targetNode:this.$refs.configure,multiple:false,dropdownMode:true,enableSearch:true,cacheable:false,items:this.copyDialogItems,events:{"Item:onSelect":e=>{const{item:t}=e.getData();this.$store.dispatch("userGroups/copyUserGroup",{userGroupId:t.getId()})}}});e.show()},showViewDialog(e){this.viewDialog=new r.Dialog({context:P.ROLE,footer:this.isMaxVisibleUserGroupsSet?this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ROLE_SELECTOR_MAX_VISIBLE_WARNING",{"#COUNT#":this.maxVisibleUserGroups}):null,targetNode:e,multiple:true,dropdownMode:true,enableSearch:true,cacheable:false,items:this.viewDialogItems,events:{"Item:onBeforeSelect":e=>{if(this.isMaxVisibleUserGroupsSet&&this.viewDialog.getSelectedItems().length>=this.maxVisibleUserGroups){e.preventDefault()}},"Item:onSelect":e=>{const{item:t}=e.getData();this.$store.dispatch("userGroups/showUserGroup",{userGroupId:t.getId()})},"Item:onDeselect":e=>{const{item:t}=e.getData();this.$store.dispatch("userGroups/hideUserGroup",{userGroupId:t.getId()})},onHide:()=>{this.viewDialog=null}}});this.viewDialog.show()},toggleViewDialog(e){if(this.viewDialog){this.viewDialog.hide()}else{this.showViewDialog(e)}}},template:`\n\t\t<ColumnLayout>\n\t\t\t<CellLayout class="ui-access-rights-v2-header-roles-control">\n\t\t\t\t<div class='ui-access-rights-v2-column-item-text ui-access-rights-v2-header-roles-control-header'>\n\t\t\t\t\t<div>{{ $Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLES') }}</div>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref="configure"\n\t\t\t\t\t\tclass="ui-icon-set --more ui-access-rights-v2-icon-more"\n\t\t\t\t\t\t@click="isPopupShown = true"\n\t\t\t\t\t>\n\t\t\t\t\t\t<RichMenuPopup v-if="isPopupShown" @close="isPopupShown = false" :popup-options="{bindElement: $refs.configure}">\n\t\t\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\t\t\t:icon="RichMenuItemIcon.role"\n\t\t\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_NEW_ROLE')"\n\t\t\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_NEW_ROLE_SUBTITLE')"\n\t\t\t\t\t\t\t\t:disabled="isMaxVisibleUserGroupsReached"\n\t\t\t\t\t\t\t\t:hint="\n\t\t\t\t\t\t\t\t\tisMaxVisibleUserGroupsReached\n\t\t\t\t\t\t\t\t\t\t? $Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLE_ADDING_DISABLED', {\n\t\t\t\t\t\t\t\t\t\t\t'#COUNT#': maxVisibleUserGroups,\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t"\n\t\t\t\t\t\t\t\t@click="onCreateNewRoleClick"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\t\t\t:icon="RichMenuItemIcon.copy"\n\t\t\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_COPY_ROLE')"\n\t\t\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_COPY_ROLE_SUBTITLE')"\n\t\t\t\t\t\t\t\t:disabled="isMaxVisibleUserGroupsReached"\n\t\t\t\t\t\t\t\t:hint="\n\t\t\t\t\t\t\t\t\tisMaxVisibleUserGroupsReached\n\t\t\t\t\t\t\t\t\t\t? $Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLE_COPYING_DISABLED', {\n\t\t\t\t\t\t\t\t\t\t\t'#COUNT#': maxVisibleUserGroups,\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t"\n\t\t\t\t\t\t\t\t@click="onCopyRoleClick"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\t\t\t:icon="RichMenuItemIcon['opened-eye']"\n\t\t\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLE_VIEW')"\n\t\t\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLE_VIEW_SUBTITLE_MSGVER_1')"\n\t\t\t\t\t\t\t\t@click="onRoleViewClick"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RichMenuPopup>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class="ui-access-rights-v2-header-roles-control-actions">\n\t\t\t\t\t<div\n\t\t\t\t\t\tref="counter"\n\t\t\t\t\t\tclass="ui-access-rights-v2-header-roles-control-counter"\n\t\t\t\t\t\t@click="toggleViewDialog($refs.counter)"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div class="ui-icon-set --opened-eye" style="--ui-icon-set__icon-size: 15px;"></div>\n\t\t\t\t\t\t<span v-html="shownGroupsCounter"></span>\n\t\t\t\t\t\t<div class="ui-icon-set --chevron-down ui-access-rights-v2-header-roles-control-chevron"></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="ui-access-rights-v2-header-roles-control-expander">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass="ui-icon-set --collapse"\n\t\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_COLLAPSE_ALL_SECTIONS')"\n\t\t\t\t\t\t\t@click="$store.dispatch('accessRights/collapseAllSections')"\n\t\t\t\t\t\t></div>\n\t\t\t\t\t\t<div \n\t\t\t\t\t\t\tclass="ui-icon-set --expand-1"\n\t\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_EXPAND_ALL_SECTIONS')"\n\t\t\t\t\t\t\t@click="$store.dispatch('accessRights/expandAllSections')"\n\t\t\t\t\t\t></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</CellLayout>\n\t\t</ColumnLayout>\n\t`};const A=new Map;const T=new Map;const x={name:"SyncHorizontalScroll",data(){return{componentGuid:b.Text.getRandom(16)}},computed:{...g.mapState({guid:e=>e.application.guid})},throttledEmitScrollEvent:null,created(){this.throttledEmitScrollEvent=O(this.emitScrollEvent)},mounted(){if(!A.has(this.guid)){const e=this.$store.state.accessRights.collection.size+1;this.$Bitrix.eventEmitter.incrementMaxListeners("ui:accessrights:v2:syncScroll",e);A.set(this.guid,true)}this.$Bitrix.eventEmitter.subscribe("ui:accessrights:v2:syncScroll",this.handleScrollEvent);void this.$nextTick((()=>{if(T.has(this.guid)){this.syncScroll(T.get(this.guid))}}))},beforeUnmount(){this.$Bitrix.eventEmitter.unsubscribe("ui:accessrights:v2:syncScroll",this.handleScrollEvent)},methods:{emitScrollEvent(e){const{scrollLeft:t}=e.target;T.set(this.guid,t);this.$Bitrix.eventEmitter.emit("ui:accessrights:v2:syncScroll",{scrollLeft:t,componentGuid:this.componentGuid})},handleScrollEvent(e){const{scrollLeft:t,componentGuid:s}=e.getData();if(this.componentGuid===s){return}this.syncScroll(t)},syncScroll(e){if(this.$el.scrollLeft!==e){this.$el.scrollLeft=e}}},template:`\n\t\t<div @scroll="throttledEmitScrollEvent">\n\t\t\t<slot/>\n\t\t</div>\n\t`};function O(e){let t=false;let s=false;return function i(...o){s=true;if(!t){const i=function i(){if(s){e(...o);s=false;requestAnimationFrame(i);t=true}else{t=false}};i()}}}const U={name:"Header",components:{RoleHeading:B,SyncHorizontalScroll:x,Members:V,RolesControl:F,ColumnLayout:G,CellLayout:E},props:{userGroups:{type:Map,required:true}},template:`\n\t\t<div class="ui-access-rights-v2-section ui-access-rights-v2--head-section">\n\t\t\t<div class='ui-access-rights-v2-section-container'>\n\t\t\t\t<div class='ui-access-rights-v2-section-head'>\n\t\t\t\t\t<RolesControl :user-groups="userGroups"/>\n\t\t\t\t</div>\n\t\t\t\t<div class='ui-access-rights-v2-section-content'>\n\t\t\t\t\t<SyncHorizontalScroll class='ui-access-rights-v2-section-wrapper'>\n\t\t\t\t\t\t<ColumnLayout\n\t\t\t\t\t\t\tv-for="[groupId, group] in userGroups" \n\t\t\t\t\t\t\t:key="groupId"\n\t\t\t\t\t\t\t:data-accessrights-user-group-id="groupId"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CellLayout class="ui-access-rights-v2-header-role-cell">\n\t\t\t\t\t\t\t\t<RoleHeading :user-group="group"/>\n\t\t\t\t\t\t\t\t<Members :user-group="group"/>\n\t\t\t\t\t\t\t</CellLayout>\n\t\t\t\t\t\t</ColumnLayout>\n\t\t\t\t\t</SyncHorizontalScroll>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t`};const $={name:"SearchBox",debouncedSetSearchQuery:null,created(){const e=e=>{this.$store.dispatch("accessRights/search",{query:e})};this.debouncedSetSearchQuery=b.Runtime.debounce(e,200)},computed:{searchQuery:{get(){return this.$store.state.accessRights.searchQuery},set(e){this.debouncedSetSearchQuery(e)}}},template:`\n\t\t<div class="ui-ctl ui-ctl-after-icon ui-ctl-w100 ui-access-rights-v2-search">\n\t\t\t<input\n\t\t\t\ttype="text"\n\t\t\t\tclass="ui-ctl-element ui-ctl-textbox ui-access-rights-v2-search-input"\n\t\t\t\t:placeholder="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SEARCH_PLACEHOLDER')"\n\t\t\t\tv-model="searchQuery"\n\t\t\t>\n\t\t\t<a class="ui-ctl-after ui-ctl-icon-search ui-access-rights-v2-search-icon"></a>\n\t\t</div>\n\t`};function j(e){if(!e.isShown){return false}return!e.group||e.isGroupExpanded}function k(e,t,s){if(s){return e}const i=new Map;for(const[s,o]of e){if(t.has(s)){i.set(s,o)}}return i}function D(e){const t=[...e.values()].pop();if(e.size===1){return N(t.title)}return b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_HAS_SELECTED_ITEMS",{"#FIRST_ITEM_NAME#":N(t.title),"#COUNT_REST_ITEMS#":e.size-1})}function N(e){const t=15;if(e.length>t){return`${e.slice(0,t)}...`}return e}function K(e,t,s){if(e.size<2){return""}let i="";for(const t of z(e,s)){i+=`<li>${b.Text.encode(t.title)}</li>`}return`\n\t\t<p>${b.Text.encode(t)}</p>\n\t\t<ul>${i}</ul>\n\t`}function z(e,t){const s=new Map;let i=0;for(const[e]of t){s.set(e,i);i++}return[...e.values()].sort(((e,t)=>{const i=s.get(e.id);const o=s.get(t.id);if(b.Type.isNil(i)){return 1}if(b.Type.isNil(o)){return-1}return i-o}))}const J="|";function q(e,t=J){const s=e.split(t);return new Set(s)}function W(e,t=J){const s=[...e].sort();return s.join(t)}function X(e,t=J){const s=q(e,t);return W(s,t)}var Y=babelHelpers.classPrivateFieldLooseKey("initialRights");var Q=babelHelpers.classPrivateFieldLooseKey("searchAction");class Z extends g.BuilderModel{constructor(...e){super(...e);Object.defineProperty(this,Q,{value:ee});Object.defineProperty(this,Y,{writable:true,value:new Map})}getName(){return"accessRights"}setInitialAccessRights(e){babelHelpers.classPrivateFieldLooseBase(this,Y)[Y]=e;return this}getState(){return{collection:b.Runtime.clone(babelHelpers.classPrivateFieldLooseBase(this,Y)[Y]),searchQuery:""}}getElementState(e={}){throw new Error("Cant create AccessRightSection. You are doing something wrong")}getGetters(){return{shown:e=>{const t=new Map;for(const[s,i]of e.collection){if(i.isShown){t.set(s,i)}}return t},isMinValueSetForAny:(e,t)=>{for(const s of e.collection.values()){for(const e of s.rights.values()){const i=t.isMinValueSet(s.sectionCode,e.id);if(i){return true}}}return false},isMinValueSet:e=>(t,s)=>{var i;const o=(i=e.collection.get(t))==null?void 0:i.rights.get(s);if(!o){console.warn("ui.accessrights.v2: attempt to check if min value set for unknown right",{sectionCode:t,rightId:s});return false}return!b.Type.isNil(o.minValue)},isMaxValueSetForAny:(e,t)=>{for(const s of e.collection.values()){for(const e of s.rights.values()){const i=t.isMaxValueSet(s.sectionCode,e.id);if(i){return true}}}return false},isMaxValueSet:e=>(t,s)=>{var i;const o=(i=e.collection.get(t))==null?void 0:i.rights.get(s);if(!o){console.warn("ui.accessrights.v2: attempt to check if max value set for unknown right",{sectionCode:t,rightId:s});return false}return!b.Type.isNil(o.maxValue)},getEmptyValue:e=>(t,s)=>{var i,o,r;const n=(i=e.collection.get(t))==null?void 0:i.rights.get(s);if(!n){return new Set}return(o=(r=C.getValueTypeByRight(n))==null?void 0:r.getEmptyValue(n))!=null?o:new Set},getNothingSelectedValue:(e,t)=>(s,i)=>{var o,r;const n=(o=e.collection.get(s))==null?void 0:o.rights.get(i);return(r=n==null?void 0:n.nothingSelectedValue)!=null?r:t.getEmptyValue(s,i)},getSelectedVariablesAlias:e=>(t,s,i)=>{var o;const r=(o=e.collection.get(t))==null?void 0:o.rights.get(s);if(!r){return null}const n=W(i,r.selectedVariablesAliasesSeparator);return r.selectedVariablesAliases.get(n)}}}getActions(){return{toggleSection:(e,{sectionCode:t})=>{if(!e.state.collection.has(t)){console.warn("ui.accessrights.v2: Attempt to toggle section that dont exists",{sectionCode:t});return}e.commit("toggleSection",{sectionCode:t})},expandAllSections:e=>{for(const t of e.state.collection.keys()){e.commit("expandSection",{sectionCode:t})}},collapseAllSections:e=>{for(const t of e.state.collection.keys()){e.commit("collapseSection",{sectionCode:t})}},toggleGroup:(e,{sectionCode:t,groupId:s})=>{var i;const o=(i=e.state.collection.get(t))==null?void 0:i.rights.get(s);if(!o){console.warn("ui.accessrights.v2: Attempt to toggle group that dont exists",{groupId:s});return}if(!o.groupHead){console.warn("ui.accessrights.v2: Attempt to toggle group that is not group head",{groupId:s});return}e.commit("toggleGroup",{sectionCode:t,groupId:s})},search:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Q)[Q](e,t)}}}getMutations(){return{toggleSection:(e,{sectionCode:t})=>{const s=e.collection.get(t);s.isExpanded=!s.isExpanded},expandSection:(e,{sectionCode:t})=>{const s=e.collection.get(t);s.isExpanded=true},collapseSection:(e,{sectionCode:t})=>{const s=e.collection.get(t);s.isExpanded=false},toggleGroup:(e,{sectionCode:t,groupId:s})=>{const i=e.collection.get(t);for(const e of i.rights.values()){if(e.id===s&&e.groupHead||e.group===s){e.isGroupExpanded=!e.isGroupExpanded}}},expandGroup:(e,{sectionCode:t,groupId:s})=>{const i=e.collection.get(t);i.isExpanded=true;for(const e of i.rights.values()){if(e.id===s&&e.groupHead||e.group===s){e.isGroupExpanded=true}}},showItem:(e,{sectionCode:t,itemId:s})=>{const i=e.collection.get(t);i.isShown=true;const o=i.rights.get(s);o.isShown=true;if(o.group){i.rights.get(o.group).isShown=true}},showGroup:(e,{sectionCode:t,groupId:s})=>{const i=e.collection.get(t);i.isShown=true;for(const e of i.rights.values()){if(e.id===s&&e.groupHead||e.group===s){e.isShown=true}}},showSection:(e,{sectionCode:t})=>{const s=e.collection.get(t);s.isShown=true;for(const e of s.rights.values()){e.isShown=true}},showAll:e=>{for(const t of e.collection.values()){t.isShown=true;for(const e of t.rights.values()){e.isShown=true}}},hideAll:e=>{for(const t of e.collection.values()){t.isShown=false;for(const e of t.rights.values()){e.isShown=false}}},setSearchQuery:(e,{query:t})=>{e.searchQuery=String(t)}}}}function ee(e,{query:t}){if(!b.Type.isString(t)){console.warn("ui.accessrights.v2: attempt to search with non-string search query");return}e.commit("setSearchQuery",{query:t});if(t===""){e.commit("showAll");return}e.commit("hideAll");const s=t.toLowerCase();for(const t of e.state.collection.values()){var i;if(t.sectionTitle.toLowerCase().includes(s)||(i=t.sectionSubTitle)!=null&&i.toLowerCase().includes(s)){e.commit("showSection",{sectionCode:t.sectionCode});continue}for(const i of t.rights.values()){if(!i.title.toLowerCase().includes(s)){continue}if(i.groupHead){e.commit("showGroup",{sectionCode:t.sectionCode,groupId:i.id})}else{e.commit("showItem",{sectionCode:t.sectionCode,itemId:i.id});if(i.group){e.commit("expandGroup",{sectionCode:t.sectionCode,groupId:i.group})}}}}}const te={name:"MenuCell",components:{CellLayout:E,RichMenuPopup:h.RichMenuPopup,RichMenuItem:h.RichMenuItem},inject:["section","userGroup"],data(){return{isMenuShown:false}},computed:{RichMenuItemIcon:()=>h.RichMenuItemIcon,...g.mapGetters({isMaxValueSetForAny:"accessRights/isMaxValueSetForAny",isMinValueSetForAny:"accessRights/isMinValueSetForAny"}),menuPopupOptions(){const e=290;return{bindElement:this.$refs.icon,width:e,offsetLeft:-Math.floor(e/2)+9}},shownUserGroupsWithoutCurrent(){const e=this.$store.getters["userGroups/shown"];const t=b.Runtime.clone(e);t.delete(this.userGroup.id);return t},applyDialogItems(){return _.mapUserGroups(this.shownUserGroupsWithoutCurrent)}},methods:{toggleMenu(){this.isMenuShown=!this.isMenuShown},showApplyDialog(){this.isMenuShown=false;const e=new r.Dialog({context:P.ROLE,targetNode:this.$refs.icon,multiple:false,dropdownMode:true,enableSearch:true,cacheable:false,items:this.applyDialogItems,events:{"Item:onSelect":e=>{const{item:t}=e.getData();this.$store.dispatch("userGroups/copySectionValues",{srcUserGroupId:this.userGroup.id,dstUserGroupId:t.getId(),sectionCode:this.section.sectionCode})}}});e.show()},setMaxValuesInSection(){this.isMenuShown=false;this.$store.dispatch("userGroups/setMaxAccessRightValuesInSection",{userGroupId:this.userGroup.id,sectionCode:this.section.sectionCode})},setMinValuesInSection(){this.isMenuShown=false;this.$store.dispatch("userGroups/setMinAccessRightValuesInSection",{userGroupId:this.userGroup.id,sectionCode:this.section.sectionCode})}},template:`\n\t\t<CellLayout class="ui-access-rights-v2-menu-cell" style="cursor: pointer" @click="toggleMenu">\n\t\t\t<div\n\t\t\t\tref="icon"\n\t\t\t\tclass="ui-icon-set --more ui-access-rights-v2-icon-more"\n\t\t\t>\n\t\t\t\t<RichMenuPopup\n\t\t\t\t\tv-if="isMenuShown"\n\t\t\t\t\t@close="isMenuShown = false"\n\t\t\t\t\t:popup-options="menuPopupOptions"\n\t\t\t\t>\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\tv-if="isMaxValueSetForAny"\n\t\t\t\t\t\t:icon="RichMenuItemIcon.check"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MAX_ACCESS_RIGHTS')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage(\n\t\t\t\t\t\t\t'JS_UI_ACCESSRIGHTS_V2_SET_MAX_ACCESS_RIGHTS_SUBTITLE_SECTION',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'#SECTION#': section.sectionTitle + (section.sectionSubTitle ? (' ' + section.sectionSubTitle) : ''),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)"\n\t\t\t\t\t\t@click="setMaxValuesInSection"\n\t\t\t\t\t/>\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\tv-if="isMinValueSetForAny"\n\t\t\t\t\t\t:icon="RichMenuItemIcon['red-lock']"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MIN_ACCESS_RIGHTS')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage(\n\t\t\t\t\t\t\t'JS_UI_ACCESSRIGHTS_V2_SET_MIN_ACCESS_RIGHTS_SUBTITLE_SECTION',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'#SECTION#': section.sectionTitle + (section.sectionSubTitle ? (' ' + section.sectionSubTitle) : ''),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)"\n\t\t\t\t\t\t@click="setMinValuesInSection"\n\t\t\t\t\t/>\n\t\t\t\t\t<RichMenuItem\n\t\t\t\t\t\t:icon="RichMenuItemIcon.copy"\n\t\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_APPLY_TO_ROLE')"\n\t\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_APPLY_TO_ROLE_SUBTITLE')"\n\t\t\t\t\t\t@click="showApplyDialog"\n\t\t\t\t\t/>\n\t\t\t\t</RichMenuPopup>\n\t\t\t</div>\n\t\t</CellLayout>\n\t`};const se={name:"Icon",inject:["section"],computed:{iconBgColor(){if(this.section.sectionIcon.bgColor.startsWith("--")){return`var(${this.section.sectionIcon.bgColor})`}return this.section.sectionIcon.bgColor}},template:`\n\t\t<div v-if="section.sectionIcon" class="ui-access-rights-v2-section-header-icon" :style="{\n\t\t\tbackgroundColor: iconBgColor,\n\t\t}">\n\t\t\t<div class="ui-icon-set" :class="'--' + section.sectionIcon.type"></div>\n\t\t</div>\n\t`};const ie={name:"Locator",components:{SectionIcon:se},props:{maxWidth:{type:Number,default:430}},inject:["section","right"],computed:{rightOrGroupTitle(){if(!this.right.group){return this.right.title}const e=this.section.rights.get(this.right.group);return e==null?void 0:e.title}},template:`\n\t\t<div class="ui-access-rights-v2-cell-popup-header-locator" :style="{\n\t\t\tmaxWidth: maxWidth + 'px',\n\t\t}">\n\t\t\t<SectionIcon/>\n\t\t\t<span\n\t\t\t\tclass="ui-access-rights-v2-text-ellipsis"\n\t\t\t\t:title="section.sectionTitle"\n\t\t\t>{{ section.sectionTitle }}</span>\n\t\t\t<span\n\t\t\t\tv-if="section.sectionSubTitle" \n\t\t\t\tclass="ui-access-rights-v2-text-ellipsis"\n\t\t\t\t:title="section.sectionSubTitle"\n\t\t\t\tstyle="margin-left: 5px; color: var(--ui-color-palette-gray-70);"\n\t\t\t>{{ section.sectionSubTitle }}</span>\n\t\t\t<div class="ui-icon-set --chevron-right ui-access-rights-v2-cell-popup-header-chevron"></div>\n\t\t\t<template v-if="rightOrGroupTitle !== right.title">\n\t\t\t\t<span class="ui-access-rights-v2-text-ellipsis" :title="right.title">{{ right.title }}</span>\n\t\t\t\t<div class="ui-icon-set --chevron-right ui-access-rights-v2-cell-popup-header-chevron"></div>\n\t\t\t</template>\n\t\t\t<span class="ui-access-rights-v2-text-ellipsis" :title="rightOrGroupTitle">{{ rightOrGroupTitle }}</span>\n\t\t</div>\n\t`};const oe={name:"MasterSwitcher",components:{Switcher:l.Switcher},emits:["check","uncheck"],props:{isChecked:{type:Boolean,required:true}},inject:["section","right"],computed:{switcherOptions(){return{size:"small",color:"green"}}},template:`\n\t\t<div class="ui-access-rights-v2-cell-popup-header-master-switcher" :class="{\n\t\t\t'--checked': isChecked,\n\t\t}">\n\t\t\t<slot/>\n\t\t\t<div class="ui-access-rights-v2-cell-popup-header-toggle-container">\n\t\t\t\t<span class="ui-access-rights-v2-cell-popup-header-toggle-caption">{{\n\t\t\t\t\t$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ACCESS')\n\t\t\t\t}}</span>\n\t\t\t\t<Switcher\n\t\t\t\t\t:is-checked="isChecked"\n\t\t\t\t\t@check="$emit('check')"\n\t\t\t\t\t@uncheck="$emit('uncheck')"\n\t\t\t\t\t:options="switcherOptions"\n\t\t\t\t\tdata-accessrights-min-max\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t`};const re={name:"SingleRoleTitle",props:{userGroupTitle:{type:String,required:true}},template:`\n\t\t<div class="ui-access-rights-v2-cell-popup-header-role-container">\n\t\t\t<div>\n\t\t\t\t<div class="ui-access-rights-v2-cell-popup-header-role-caption">\n\t\t\t\t\t{{ $Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ROLE') }}\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\tclass="ui-access-rights-v2-cell-popup-header-role-title ui-access-rights-v2-text-ellipsis"\n\t\t\t\t\t:title="userGroupTitle"\n\t\t\t\t>\n\t\t\t\t\t{{ userGroupTitle }}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t`};const ne={name:"DependentVariablesPopupHeader",components:{Locator:ie,MasterSwitcher:oe,SingleRoleTitle:re},emits:["setMax","setMin"],props:{values:{type:Set,required:true}},inject:["right"],computed:{isChecked(){if(!this.isMinMaxValuesSet){return this.values.size>0}return this.isSelectedAnythingBesidesMin},isMinMaxValuesSet(){return!b.Type.isNil(this.right.minValue)&&!b.Type.isNil(this.right.maxValue)},isSelectedAnythingBesidesMin(){if(this.values.size<=0){return false}for(const e of this.values){if(!this.right.minValue.has(e)){return true}}return false}},methods:{setMin(){if(this.isMinMaxValuesSet){this.$emit("setMin")}},setMax(){if(this.isMinMaxValuesSet){this.$emit("setMax")}}},template:`\n\t\t<div>\n\t\t\t<Locator/>\n\t\t\t<MasterSwitcher\n\t\t\t\t:is-checked="isChecked"\n\t\t\t\t@check="setMax"\n\t\t\t\t@uncheck="setMin"\n\t\t\t>\n\t\t\t\t<slot/>\n\t\t\t</MasterSwitcher>\n\t\t</div>\n\t`};const ae={name:"DependentVariablesPopupContent",emits:["apply"],components:{Switcher:l.Switcher,PopupHeader:ne},props:{initialValues:{type:Set,default:new Set}},data(){return{notSavedValues:this.getNotSavedValues()}},inject:["section","right","redefineApply"],computed:{isMinMaxValuesSet(){return!b.Type.isNil(this.right.minValue)&&!b.Type.isNil(this.right.maxValue)},variablesShownInList(){if(!this.isMinMaxValuesSet){return this.right.variables}const e=b.Runtime.clone(this.right.variables);for(const t of this.right.minValue){e.delete(t)}for(const[t,s]of e){if(s.secondary){e.delete(t)}}return e},secondaryVariables(){const e=new Map;for(const[t,s]of this.right.variables){if(s.secondary){e.set(t,s)}}return e},nothingSelectedValues(){return this.$store.getters["accessRights/getNothingSelectedValue"](this.section.sectionCode,this.right.id)},switcherOptions(){return{size:"small",color:"primary"}},secondarySwitcherOptions(){return{size:"extra-small",color:"green"}}},mounted(){this.redefineApply((()=>{this.apply()}))},methods:{addValue(e){const t=this.right.variables.get(e);if(!t){return}this.notSavedValues.add(e);if(!b.Type.isNil(t.requires)){for(const e of t.requires){this.notSavedValues.add(e)}}if(!b.Type.isNil(t.conflictsWith)){for(const e of t.conflictsWith){this.notSavedValues.delete(e)}}for(const t of this.right.variables.values()){if(t.id===e){continue}if(this.notSavedValues.has(t.id)&&!b.Type.isNil(t.conflictsWith)){for(const e of t.conflictsWith){if(this.notSavedValues.has(e)){this.notSavedValues.delete(t.id)}}}}},removeValue(e){this.notSavedValues.delete(e);for(const t of this.notSavedValues){if(t===e){continue}const s=this.right.variables.get(t);if(!s){continue}if(!b.Type.isNil(s.requires)&&s.requires.has(e)){this.notSavedValues.delete(t)}}},setMaxValue(){for(const e of this.right.maxValue){this.addValue(e)}},setMinValue(){for(const e of this.right.minValue){this.addValue(e)}},apply(){let e=this.notSavedValues;if(e.size<=0){e=this.nothingSelectedValues}this.$emit("apply",{values:e})},getNotSavedValues(){const e=new Set;this.initialValues.forEach((t=>{if(this.right.variables.has(t)){e.add(t)}}));return e}},template:`\n\t\t<div>\n\t\t\t<PopupHeader\n\t\t\t\t:values="notSavedValues"\n\t\t\t\t@set-max="setMaxValue"\n\t\t\t\t@set-min="setMinValue"\n\t\t\t>\n\t\t\t\t<slot name="role-title"/>\n\t\t\t</PopupHeader>\n\t\t\t<div class="ui-access-rights-v2-dv-popup--line-container">\n\t\t\t\t<div\n\t\t\t\t\tv-for="[variableId, variable] in variablesShownInList"\n\t\t\t\t\t:key="variableId"\n\t\t\t\t\tclass="ui-access-rights-v2-dv-popup--line"\n\t\t\t\t>\n\t\t\t\t\t<span class="ui-access-rights-v2-text-ellipsis">{{ variable.title }}</span>\n\t\t\t\t\t<Switcher\n\t\t\t\t\t\t:is-checked="notSavedValues.has(variable.id)"\n\t\t\t\t\t\t@check="addValue(variable.id)"\n\t\t\t\t\t\t@uncheck="removeValue(variable.id)"\n\t\t\t\t\t\t:options="switcherOptions"\n\t\t\t\t\t\t:data-accessrights-variable-id="variable.id"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\tv-for="[variableId, variable] in secondaryVariables"\n\t\t\t\t\t:key="variableId"\n\t\t\t\t\tclass="ui-access-rights-v2-dv-popup--line --secondary"\n\t\t\t\t>\n\t\t\t\t\t<Switcher\n\t\t\t\t\t\t:is-checked="notSavedValues.has(variable.id)"\n\t\t\t\t\t\t@check="addValue(variable.id)"\n\t\t\t\t\t\t@uncheck="removeValue(variable.id)"\n\t\t\t\t\t\t:options="secondarySwitcherOptions"\n\t\t\t\t\t\tstyle="padding-right: 5px;"\n\t\t\t\t\t\t:data-accessrights-variable-id="variable.id"\n\t\t\t\t\t/>\n\t\t\t\t\t<span class="ui-access-rights-v2-text-ellipsis">{{ variable.title }}</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t`};const le={name:"AllRolesTitle",template:`\n\t\t<div class="ui-access-rights-v2-cell-popup-header-all-role-container">\n\t\t\t<div class="ui-icon-set --persons-3" style="margin-right: 4px;"></div>\n\t\t\t<div class="ui-access-rights-v2-cell-popup-header-all-roles-caption">{{ \n\t\t\t\t$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_ALL_ROLES')\n\t\t\t}}</div>\n\t\t</div>\n\t`};const ce={name:"ValuePopup",components:{Popup:o.Popup},emits:["close","apply"],provide(){return{redefineApply:e=>{this.onApply=e}}},data(){return{onApply:()=>{this.$emit("apply")}}},computed:{popupOptions(){return{autoHide:true,closeEsc:true,cacheable:false,minWidth:466,padding:18}}},mounted(){void this.$nextTick((()=>{const e=new i.ApplyButton({color:i.ButtonColor.PRIMARY,onclick:()=>{this.apply();this.$emit("close")}});e.renderTo(this.$refs["button-container"]);const t=new i.CancelButton({onclick:()=>{this.$emit("close")}});t.renderTo(this.$refs["button-container"])}))},methods:{apply(){this.onApply()}},template:`\n\t\t<Popup @close="$emit('close')" :options="popupOptions">\n\t\t\t<slot/>\n\t\t\t<div ref="button-container" class="ui-access-rights-v2-value-popup-buttons"></div>\n\t\t</Popup>\n\t`};const ue={name:"DependentVariables",components:{PopupContent:ae,AllRolesTitle:le,ValuePopup:ce},emits:["close"],inject:["section","right"],methods:{apply({values:e}){this.$store.dispatch("userGroups/setAccessRightValuesForShown",{sectionCode:this.section.sectionCode,valueId:this.right.id,values:e})}},template:`\n\t\t<ValuePopup @close="$emit('close')">\n\t\t\t<PopupContent @apply="apply">\n\t\t\t\t<template #role-title>\n\t\t\t\t\t<AllRolesTitle/>\n\t\t\t\t</template>\n\t\t\t</PopupContent>\n\t\t</ValuePopup>\n\t`};let de=e=>e,he,pe;var ve=babelHelpers.classPrivateFieldLooseKey("toggleSelectButtons");var ge=babelHelpers.classPrivateFieldLooseKey("selectAll");var be=babelHelpers.classPrivateFieldLooseKey("deselectAll");var me=babelHelpers.classPrivateFieldLooseKey("onItemStatusChange");class Se extends r.DefaultFooter{constructor(e,t){super(e,t);Object.defineProperty(this,me,{value:Le});Object.defineProperty(this,be,{value:Ie});Object.defineProperty(this,ge,{value:ye});Object.defineProperty(this,ve,{value:fe});this.selectAllButton=b.Tag.render(he||(he=de`<div class="ui-selector-footer-link">${0}</div>`),b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ALL_SELECT_LABEL"));b.Dom.hide(this.selectAllButton);b.Event.bind(this.selectAllButton,"click",babelHelpers.classPrivateFieldLooseBase(this,ge)[ge].bind(this));this.deselectAllButton=b.Tag.render(pe||(pe=de`<div class="ui-selector-footer-link">${0}</div>`),b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ALL_DESELECT_LABEL"));b.Dom.hide(this.deselectAllButton);b.Event.bind(this.deselectAllButton,"click",babelHelpers.classPrivateFieldLooseBase(this,be)[be].bind(this));this.getDialog().subscribe("Item:onSelect",babelHelpers.classPrivateFieldLooseBase(this,me)[me].bind(this));this.getDialog().subscribe("Item:onDeselect",babelHelpers.classPrivateFieldLooseBase(this,me)[me].bind(this))}getContent(){babelHelpers.classPrivateFieldLooseBase(this,ve)[ve]();return[this.selectAllButton,this.deselectAllButton]}}function fe(){if(this.getDialog().getSelectedItems().length===this.getDialog().getItems().length){b.Dom.hide(this.selectAllButton);b.Dom.show(this.deselectAllButton)}else{b.Dom.show(this.selectAllButton);b.Dom.hide(this.deselectAllButton)}}function ye(){this.getDialog().getItems().forEach((e=>{e.select()}))}function Ie(){this.getDialog().getSelectedItems().forEach((e=>{e.deselect()}))}function Le(){babelHelpers.classPrivateFieldLooseBase(this,ve)[ve]()}let Ce=e=>e,Pe;var we=babelHelpers.classPrivateFieldLooseKey("renderVueApp");class Re extends r.BaseHeader{constructor(...e){super(...e);Object.defineProperty(this,we,{value:Me})}render(){return babelHelpers.classPrivateFieldLooseBase(this,we)[we]()}}function Me(){const e=b.Tag.render(Pe||(Pe=Ce`<div style="padding: 20px 20px 0;"></div>`));const t=n.BitrixVue.createApp(ie,{maxWidth:this.getDialog().getWidth()});t.provide("section",this.getOption("section"));t.provide("right",this.getOption("right"));t.mount(e);return e}const He={name:"Selector",emits:["apply","close"],props:{initialValues:{type:Set,default:new Set}},inject:["section","right"],data(){return{values:this.initialValues}},dialog:null,computed:{isAllSelected(){return this.values.has(this.right.allSelectedCode)},selectedVariables(){return k(this.right.variables,this.values,this.isAllSelected)},dialogItems(){return _.mapVariables(this.right.variables)},selectedDialogItems(){return this.dialogItems.filter((e=>this.selectedVariables.has(e.id)))}},mounted(){this.showSelector()},beforeUnmount(){var e;(e=this.dialog)==null?void 0:e.hide()},methods:{showSelector(){this.dialog=new r.Dialog({height:400,context:P.VARIABLE,enableSearch:this.right.enableSearch,multiple:true,autoHide:true,hideByEsc:true,dropdownMode:true,compactView:this.right.compactView,showAvatars:this.right.showAvatars,selectedItems:this.selectedDialogItems,searchOptions:{allowCreateItem:false},cacheable:false,events:{"Item:onSelect":this.onItemSelect,"Item:onDeselect":this.onItemDeselect,onHide:this.apply,onDestroy:()=>{this.dialog=null}},entities:[{id:w.VARIABLE}],items:this.dialogItems,header:Re,headerOptions:{section:this.section,right:this.right},footer:Se});this.dialog.show()},onItemSelect(e){const t=e.getData().item;this.addValue(String(t.getId()))},onItemDeselect(e){const t=e.getData().item;this.removeValue(String(t.getId()))},addValue(e){const t=b.Runtime.clone(this.values);t.add(e);if(t.length>=this.right.variables.size){this.setValues(new Set([this.right.allSelectedCode]))}else{this.setValues(t)}},removeValue(e){if(this.values.has(this.right.allSelectedCode)){const t=[...this.right.variables.values()].map((e=>e.id));const s=new Set(t);s.delete(e);this.setValues(s)}else{const t=[...this.values].filter((t=>t!==e));this.setValues(new Set(t))}},setValues(e){this.values=e},apply(){this.setNothingSelectedValueIfNeeded();this.$emit("apply",{values:this.values});this.$emit("close")},setNothingSelectedValueIfNeeded(){if(this.values.size<=0){const e=this.$store.getters["accessRights/getNothingSelectedValue"](this.section.sectionCode,this.right.id);for(const t of e){this.addValue(t)}}}},template:`\n\t\t<div></div>\n\t`};const Ve={name:"Multivariables",emits:["close"],components:{Selector:He},inject:["section","right"],methods:{apply({values:e}){this.$store.dispatch("userGroups/setAccessRightValuesForShown",{sectionCode:this.section.sectionCode,valueId:this.right.id,values:e})},close(){this.$emit("close")}},template:`\n\t\t<Selector @apply="apply" @close="close"/>\n\t`};const Be="ui-access-rights-v2-row-value-variables";const _e={name:"Variables",emits:["close"],inject:["section","right"],mounted(){this.showSelector()},beforeUnmount(){this.closeSelector()},methods:{showSelector(){const e=[];for(const t of this.right.variables.values()){e.push({id:t.id,text:t.title,onclick:(e,s)=>{var i;(i=s.getMenuWindow())==null?void 0:i.close();this.setValue(t.id)}})}c.MenuManager.show({id:Be,bindElement:this.$el,items:e,autoHide:true,cacheable:false,events:{onClose:()=>{this.$emit("close")}}})},setValue(e){this.$store.dispatch("userGroups/setAccessRightValuesForShown",{sectionCode:this.section.sectionCode,valueId:this.right.id,values:new Set([e])})},closeSelector(){var e;(e=c.MenuManager.getMenuById(Be))==null?void 0:e.close()}},template:`\n\t\t<div></div>\n\t`};const Ee={name:"SelectedHint",props:{html:{type:String,required:true}},data(){return{isRendered:true}},watch:{html(){this.isRendered=false;void this.$nextTick((()=>{this.isRendered=true}))}},directives:{hint:a.hint},template:`\n\t\t<div v-if="isRendered" v-hint="{\n\t\t\thtml,\n\t\t\tpopupOptions: {\n\t\t\t\toffsetTop: 3,\n\t\t\t},\n\t\t}" data-hint-init="vue">\n\t\t\t<slot/>\n\t\t</div>\n\t`};const Ge={name:"DependentVariables",components:{ValuePopup:ce,PopupContent:ae,SelectedHint:Ee,SingleRoleTitle:re},props:{value:{type:Object,required:true}},data(){return{isPopupShown:false}},inject:["section","userGroup","right"],computed:{selectedVariables(){return k(this.right.variables,this.value.values,false)},currentAlias(){return this.$store.getters["accessRights/getSelectedVariablesAlias"](this.section.sectionCode,this.value.id,this.value.values)},title(){if(b.Type.isString(this.currentAlias)){return this.currentAlias}if(this.selectedVariables.size<=0){return this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ADD")}return D(this.selectedVariables)},hintHtml(){return K(this.selectedVariables,this.hintTitle,this.right.variables)},hintTitle(){if(b.Type.isString(this.right.hintTitle)){return this.right.hintTitle}return this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_SELECTED_ITEMS_TITLE")}},methods:{apply({values:e}){this.$store.dispatch("userGroups/setAccessRightValues",{sectionCode:this.section.sectionCode,userGroupId:this.userGroup.id,valueId:this.value.id,values:e})}},template:`\n\t\t<div class='ui-access-rights-v2-column-item-text-link' :class="{\n\t\t\t'ui-access-rights-v2-text-ellipsis': !hintHtml\n\t\t}" @click="isPopupShown = true">\n\t\t\t<SelectedHint v-if="hintHtml" :html="hintHtml">{{title}}</SelectedHint>\n\t\t\t<div v-else :title="title">{{title}}</div>\n\t\t\t<ValuePopup v-if="isPopupShown" @close="isPopupShown = false">\n\t\t\t\t<PopupContent\n\t\t\t\t\t@apply="apply"\n\t\t\t\t\t:initial-values="value.values"\n\t\t\t\t>\n\t\t\t\t\t<template #role-title>\n\t\t\t\t\t\t<SingleRoleTitle :user-group-title="userGroup.title"/>\n\t\t\t\t\t</template>\n\t\t\t\t</PopupContent>\n\t\t\t</ValuePopup>\n\t\t</div>\n\t`};const Fe={name:"Multivariables",components:{SelectedHint:Ee,Selector:He},props:{value:{type:Object,required:true}},inject:["section","userGroup","right"],data(){return{isSelectorShown:false}},computed:{isAllSelected(){return this.value.values.has(this.right.allSelectedCode)},selectedVariables(){return k(this.right.variables,this.value.values,this.isAllSelected)},currentAlias(){return this.$store.getters["accessRights/getSelectedVariablesAlias"](this.section.sectionCode,this.value.id,this.value.values)},title(){if(b.Type.isString(this.currentAlias)){return this.currentAlias}if(this.isAllSelected){return this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ALL_ACCEPTED")}if(this.selectedVariables.size<=0){return this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ADD")}return D(this.selectedVariables)},hintHtml(){return K(this.selectedVariables,this.hintTitle,this.right.variables)},hintTitle(){if(b.Type.isString(this.right.hintTitle)){return this.right.hintTitle}return this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_SELECTED_ITEMS_TITLE")}},methods:{showSelector(){this.isSelectorShown=true},setValues({values:e}){this.$store.dispatch("userGroups/setAccessRightValues",{sectionCode:this.section.sectionCode,userGroupId:this.userGroup.id,valueId:this.value.id,values:e})}},template:`\n\t\t<SelectedHint \n\t\t\tv-if="hintHtml"\n\t\t\t:html="hintHtml" \n\t\t\tclass='ui-access-rights-v2-column-item-text-link'\n\t\t\t@click="showSelector"\n\t\t\tv-bind="$attrs"\n\t\t>\n\t\t\t{{ title }}\n\t\t</SelectedHint>\n\t\t<div \n\t\t\tv-else\n\t\t\tclass='ui-access-rights-v2-column-item-text-link ui-access-rights-v2-text-ellipsis'\n\t\t\t@click="showSelector"\n\t\t\t:title="title"\n\t\t\tv-bind="$attrs"\n\t\t>\n\t\t\t{{ title }}\n\t\t</div>\n\t\t<Selector\n\t\t\tv-if="isSelectorShown" \n\t\t\t:initial-values="value.values"\n\t\t\t@close="isSelectorShown = false"\n\t\t\t@apply="setValues"\n\t\t/>\n\t`};const Ae={name:"Toggler",components:{Switcher:l.Switcher},props:{value:{type:Object,required:true}},inject:["section","userGroup"],computed:{isChecked(){return this.value.values.has("1")}},methods:{setValue(e){this.$store.dispatch("userGroups/setAccessRightValues",{userGroupId:this.userGroup.id,sectionCode:this.section.sectionCode,valueId:this.value.id,values:new Set([e])})}},template:`\n\t\t<Switcher\n\t\t\t:is-checked="isChecked"\n\t\t\t@check="setValue('1')"\n\t\t\t@uncheck="setValue('0')"\n\t\t\t:options="{\n\t\t\t\tsize: 'extra-small',\n\t\t\t\tcolor: 'green',\n\t\t\t}"\n\t\t/>\n\t`};const Te="ui-access-rights-v2-column-item-popup-variables";const xe={name:"Variables",props:{value:{type:Object,required:true}},inject:["section","userGroup","right"],computed:{emptyVariableId(){const e=this.$store.getters["accessRights/getEmptyValue"](this.section.sectionCode,this.value.id);return e[0]},currentVariableId(){if(this.value.values.size<=0){return this.emptyVariableId}const[e]=this.value.values;return e},currentAlias(){return this.$store.getters["accessRights/getSelectedVariablesAlias"](this.section.sectionCode,this.value.id,this.value.values)},currentVariableTitle(){if(b.Type.isString(this.currentAlias)){return this.currentAlias}const e=this.right.variables.get(this.currentVariableId);if(!e){return this.$Bitrix.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ADD")}return e.title}},methods:{showSelector(e){const t=[];for(const e of this.right.variables.values()){t.push({id:e.id,text:e.title,onclick:(t,s)=>{var i;(i=s.getMenuWindow())==null?void 0:i.close();this.setValue(e.id)}})}c.MenuManager.show({id:Te,bindElement:e.target,items:t,autoHide:true,cacheable:false})},setValue(e){this.$store.dispatch("userGroups/setAccessRightValues",{sectionCode:this.section.sectionCode,userGroupId:this.userGroup.id,valueId:this.value.id,values:new Set([e])})}},template:`\n\t\t<div\n\t\t\tclass='ui-access-rights-v2-column-item-text-link ui-access-rights-v2-text-ellipsis'\n\t\t\t:title="currentVariableTitle"\n\t\t\t@click="showSelector"\n\t\t>\n\t\t\t{{ currentVariableTitle }}\n\t\t</div>\n\t`};const Oe=Object.freeze({DependentVariables:Ge,Multivariables:Fe,Toggler:Ae,Variables:xe});const Ue=Object.freeze({DependentVariables:ue,Multivariables:Ve,Variables:_e});function $e(e){const t=C.getValueTypeByRight(e);if(!t){return""}return t.getComponentName()}const je={name:"ValueCell",components:{CellLayout:E,...Oe},props:{right:{type:Object,required:true}},inject:["section","userGroup"],provide(){return{right:this.right}},computed:{value(){const e=this.userGroup.accessRights.get(this.right.id);return e||this.$store.getters["userGroups/getEmptyAccessRightValue"](this.userGroup.id,this.section.sectionCode,this.right.id)},cellComponent(){return $e(this.right)}},template:`\n\t\t<CellLayout\n\t\t\t:class="{\n\t\t\t\t'ui-access-rights-v2-group-children': right.group,\n\t\t\t\t'--modified': value.isModified\n\t\t\t}"\n\t\t\tv-memo="[userGroup.id, value.values, value.isModified]"\n\t\t>\n\t\t\t<Component\n\t\t\t\t:is="cellComponent"\n\t\t\t\t:value="value"\n\t\t\t\t:data-accessrights-right-id="right.id"\n\t\t\t/>\n\t\t</CellLayout>\n\t`};const ke={name:"Column",components:{ColumnLayout:G,ValueCell:je,MenuCell:te},props:{userGroup:{type:Object,required:true},rights:{type:Map,required:true}},provide(){return{userGroup:n.computed((()=>this.userGroup))}},computed:{renderedRights(){const e=new Map;for(const[t,s]of this.rights){if(j(s)){e.set(t,s)}}return e}},template:`\n\t\t<ColumnLayout ref="column">\n\t\t\t<MenuCell/>\n\t\t\t<ValueCell\n\t\t\t\tv-for="[rightId, accessRightItem] in renderedRights"\n\t\t\t\t:key="rightId"\n\t\t\t\t:right="accessRightItem"\n\t\t\t/>\n\t\t</ColumnLayout>\n\t`};const De={name:"ColumnList",components:{Column:ke,SyncHorizontalScroll:x},props:{userGroups:{type:Map,required:true},rights:{type:Map,required:true}},throttledScrollHandler:null,throttledResizeHandler:null,ears:null,isEarsInited:false,data(){return{isLeftShadowShown:false,isRightShadowShown:false}},created(){this.throttledScrollHandler=b.Runtime.throttle((()=>{this.adjustShadowsVisibility()}),200);this.throttledResizeHandler=b.Runtime.throttle((()=>{this.adjustShadowsVisibility();this.adjustEars()}),200)},mounted(){b.Event.bind(window,"resize",this.throttledResizeHandler);this.adjustShadowsVisibility();this.initEars()},beforeUnmount(){this.destroyEars();b.Event.unbind(window,"resize",this.throttledResizeHandler)},watch:{userGroups(e,t){if(e.size!==t.size){this.adjustShadowsVisibility();this.adjustEars()}}},methods:{calculateShadowsVisibility(){if(!this.$refs["column-container"]){return{isLeftShadowShown:false,isRightShadowShown:false}}const e=this.$refs["column-container"].$el.scrollLeft;const t=e>0;const s=this.$refs["column-container"].$el.offsetWidth;return{isLeftShadowShown:t,isRightShadowShown:this.$refs["column-container"].$el.scrollWidth>Math.round(e+s)}},adjustShadowsVisibility(){requestAnimationFrame((()=>{const{isLeftShadowShown:e,isRightShadowShown:t}=this.calculateShadowsVisibility();this.isLeftShadowShown=e;this.isRightShadowShown=t}))},adjustEars(){if(!this.isEarsInited){return}requestAnimationFrame((()=>{this.ears.toggleEars()}))},initEars(){if(!this.$refs["column-container"]){return}if(this.ears){return}this.ears=new u.Ears({container:this.$refs["column-container"].$el,immediateInit:true,smallSize:true});requestAnimationFrame((()=>{if(!this.ears||!this.$refs["column-container"]){this.ears=null;return}const e=this.$refs["column-container"].$el.scrollLeft;this.ears.init();b.Dom.style(this.ears.getWrapper(),"flex",1);if(e>0){this.$refs["column-container"].$el.scrollLeft=e}this.isEarsInited=true}))},destroyEars(){var e;(e=this.ears)==null?void 0:e.destroy();this.isEarsInited=false;this.ears=null}},template:`\n\t\t<div\n\t\t\tclass='ui-access-rights-v2-section-content'\n\t\t\t:class="{\n\t\t\t\t'ui-access-rights-v2-section-shadow-left-shown': isLeftShadowShown,\n\t\t\t\t'ui-access-rights-v2-section-shadow-right-shown': isRightShadowShown,\n\t\t\t}"\n\t\t>\n\t\t\t<SyncHorizontalScroll\n\t\t\t\tref="column-container"\n\t\t\t\tclass='ui-access-rights-v2-section-wrapper'\n\t\t\t\t@scroll="throttledScrollHandler"\n\t\t\t>\n\t\t\t\t<Column\n\t\t\t\t\tv-for="[groupId, group] in userGroups"\n\t\t\t\t\t:key="groupId"\n\t\t\t\t\t:user-group="group"\n\t\t\t\t\t:rights="rights"\n\t\t\t\t\t:data-accessrights-user-group-id="groupId"\n\t\t\t\t/>\n\t\t\t</SyncHorizontalScroll>\n\t\t</div>\n\t`};let Ne=e=>e,Ke;const ze={name:"Hint",props:{html:{type:String,required:true}},computed:{...g.mapState({guid:e=>e.application.guid})},mounted(){this.renderHint()},watch:{html(){b.Dom.clean(this.$refs.container);this.renderHint()}},methods:{renderHint(){const e=b.Tag.render(Ke||(Ke=Ne`<span data-hint-html="true" data-hint-interactivity="true"></span>`));e.setAttribute("data-hint",this.html);b.Dom.append(e,this.$refs.container);this.getHintManager().initNode(e)},getHintManager(){return C.getHint(this.guid)}},template:'<span ref="container"></span>'};const Je={name:"Header",components:{Hint:ze,Icon:se},inject:["section"],methods:{toggleSection(){this.$store.dispatch("accessRights/toggleSection",{sectionCode:this.section.sectionCode})}},template:`\n\t\t<div\n\t\t\t@click="toggleSection"\n\t\t\tclass='ui-access-rights-v2-section-header'\n\t\t\t:class="{\n\t\t\t\t'--expanded': section.isExpanded,\n\t\t\t}" \n\t\t\tv-memo="[section.isExpanded]"\n\t\t>\n\t\t\t<div class="ui-access-rights-v2-section-header-expander">\n\t\t\t\t<div class='ui-icon-set' :class="{\n\t\t\t\t\t'--chevron-up': section.isExpanded,\n\t\t\t\t\t'--chevron-down': !section.isExpanded,\n\t\t\t\t}"\n\t\t\t\t></div>\n\t\t\t</div>\n\t\t\t<Icon/>\n\t\t\t<span \n\t\t\t\tclass="ui-access-rights-v2-text-ellipsis ui-access-rights-v2-section-title"\n\t\t\t\t:title="section.sectionTitle"\n\t\t\t>{{ section.sectionTitle }}</span>\n\t\t\t<span\n\t\t\t\tv-if="section.sectionSubTitle"\n\t\t\t\tclass="ui-access-rights-v2-text-ellipsis ui-access-rights-v2-section-subtitle"\n\t\t\t\t:title="section.sectionSubTitle"\n\t\t\t>\n\t\t\t\t{{ section.sectionSubTitle }}\n\t\t\t</span>\n\t\t\t<Hint v-if="section.sectionHint" :html="section.sectionHint"/>\n\t\t</div>\n\t`};const qe={name:"MenuCell",components:{CellLayout:E},template:`\n\t\t<CellLayout class="ui-access-rights-v2-menu-cell"/>\n\t`};const We={name:"RowValue",components:{...Ue},emits:["close"],inject:["right"],computed:{component(){return $e(this.right)}},template:`\n\t\t<Component :is="component" @close="$emit('close')" />\n\t`};const Xe={name:"TitleCell",components:{Hint:ze,RowValue:We,RichMenuItem:h.RichMenuItem,RichMenuPopup:h.RichMenuPopup},props:{right:{type:Object,required:true}},inject:["section"],provide(){return{right:this.right}},data(){return{isMenuShown:false,isRowValueShown:false}},computed:{RichMenuItemIcon:()=>h.RichMenuItemIcon,isMinValueSet(){return this.$store.getters["accessRights/isMinValueSet"](this.section.sectionCode,this.right.id)},isMaxValueSet(){return this.$store.getters["accessRights/isMaxValueSet"](this.section.sectionCode,this.right.id)},isRowValueConfigurable(){var e,t;return(e=(t=C.getValueTypeByRight(this.right))==null?void 0:t.isRowValueConfigurable())!=null?e:false}},methods:{toggleGroup(){if(!this.right.groupHead){return}this.$store.dispatch("accessRights/toggleGroup",{sectionCode:this.section.sectionCode,groupId:this.right.id})},toggleMenu(){this.isMenuShown=!this.isMenuShown},setMaxValuesForRight(){this.isRowValueShown=false;this.isMenuShown=false;this.$store.dispatch("userGroups/setMaxAccessRightValuesForRight",{sectionCode:this.section.sectionCode,rightId:this.right.id})},setMinValuesForRight(){this.isRowValueShown=false;this.isMenuShown=false;this.$store.dispatch("userGroups/setMinAccessRightValuesForRight",{sectionCode:this.section.sectionCode,rightId:this.right.id})},openRowValue(){this.isMenuShown=false;this.isRowValueShown=true}},template:`\n\t\t<div\n\t\t\tclass='ui-access-rights-v2-column-item-text ui-access-rights-v2-column-item-title'\n\t\t\t@click="toggleGroup"\n\t\t\t:title="right.title"\n\t\t\t:style="{\n\t\t\t\tcursor: right.groupHead ? 'pointer' : null,\n\t\t\t}"\n\t\t\tv-memo="[right.isGroupExpanded]"\n\t\t\t:data-accessrights-right-id="right.id"\n\t\t>\n\t\t\t<span\n\t\t\t\tv-if="right.groupHead"\n\t\t\t\tclass="ui-icon-set"\n\t\t\t\t:class="{\n\t\t\t\t\t'--minus-in-circle': right.isGroupExpanded,\n\t\t\t\t\t'--plus-in-circle': !right.isGroupExpanded,\n\t\t\t\t}"\n\t\t\t></span>\n\t\t\t<span class="ui-access-rights-v2-text-ellipsis" :style="{\n\t\t\t\t'margin-left': !right.groupHead && !right.group ? '23px' : null,\n\t\t\t}">{{ right.title }}</span>\n\t\t\t<Hint v-once v-if="right.hint" :html="right.hint" />\n\t\t</div>\n\t\t<div\n\t\t\tref="icon" \n\t\t\tclass="ui-icon-set --more ui-access-rights-v2-icon-more ui-access-rights-v2-title-column-menu" \n\t\t\t@click="toggleMenu"\n\t\t>\n\t\t\t<RichMenuPopup\n\t\t\t\tv-if="isMenuShown"\n\t\t\t\t@close="isMenuShown = false"\n\t\t\t\t:popup-options="{bindElement: $refs.icon, width: 300}"\n\t\t\t>\n\t\t\t\t<RichMenuItem\n\t\t\t\t\tv-if="isMaxValueSet"\n\t\t\t\t\t:icon="RichMenuItemIcon.check"\n\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MAX_ACCESS_RIGHTS_ROW')"\n\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MAX_ACCESS_RIGHTS_ROW_SUBTITLE')"\n\t\t\t\t\t@click="setMaxValuesForRight"\n\t\t\t\t/>\n\t\t\t\t<RichMenuItem\n\t\t\t\t\tv-if="isMinValueSet"\n\t\t\t\t\t:icon="RichMenuItemIcon['red-lock']"\n\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MIN_ACCESS_RIGHTS_ROW')"\n\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_SET_MIN_ACCESS_RIGHTS_ROW_SUBTITLE')"\n\t\t\t\t\t@click="setMinValuesForRight"\n\t\t\t\t/>\n\t\t\t\t<RichMenuItem\n\t\t\t\t\tv-if="isRowValueConfigurable"\n\t\t\t\t\t:icon="RichMenuItemIcon.settings"\n\t\t\t\t\t:title="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_OPEN_ROW_VALUE')"\n\t\t\t\t\t:subtitle="$Bitrix.Loc.getMessage('JS_UI_ACCESSRIGHTS_V2_OPEN_ROW_VALUE_SUBTITLE')"\n\t\t\t\t\t@click="openRowValue"\n\t\t\t\t/>\n\t\t\t</RichMenuPopup>\n\t\t\t<RowValue v-if="isRowValueShown" @close="isRowValueShown = false"/>\n\t\t</div>\n\t`};const Ye={name:"TitleColumn",components:{TitleCell:Xe,ColumnLayout:G,CellLayout:E,MenuCell:qe},props:{rights:{type:Map,required:true}},computed:{renderedRights(){const e=new Map;for(const[t,s]of this.rights){if(j(s)){e.set(t,s)}}return e}},template:`\n\t\t<ColumnLayout>\n\t\t\t<MenuCell/>\n\t\t\t<CellLayout\n\t\t\t\tv-for="[rightId, accessRightItem] in renderedRights"\n\t\t\t\t:key="rightId"\n\t\t\t\t:class="{\n\t\t\t\t\t'ui-access-rights-v2-group-children': accessRightItem.group,\n\t\t\t\t}"\n\t\t\t>\n\t\t\t\t<TitleCell :right="accessRightItem" />\n\t\t\t</CellLayout>\n\t\t</ColumnLayout>\n\t`};const Qe={name:"Section",components:{Column:ke,SyncHorizontalScroll:x,TitleColumn:Ye,Header:Je,ColumnList:De},props:{userGroups:{type:Map,required:true},rights:{type:Map,required:true},code:{type:String,required:true},isExpanded:{type:Boolean,required:true},title:{type:String,required:true},subTitle:{type:String},hint:{type:String},icon:{type:Object}},provide(){return{section:n.computed((()=>({sectionCode:this.code,sectionTitle:this.title,sectionSubTitle:this.subTitle,sectionIcon:this.icon,sectionHint:this.hint,isExpanded:this.isExpanded,rights:this.rights})))}},template:`\n\t\t<div class="ui-access-rights-v2-section" :data-accessrights-section-code="code">\n\t\t\t<Header/>\n\t\t\t<div v-if="isExpanded" class='ui-access-rights-v2-section-container'>\n\t\t\t\t<div class='ui-access-rights-v2-section-head'>\n\t\t\t\t\t<TitleColumn :rights="rights" />\n\t\t\t\t</div>\n\t\t\t\t<ColumnList :rights="rights" :user-groups="userGroups"/>\n\t\t\t</div>\n\t\t</div>\n\t`};const Ze={name:"Grid",components:{Section:Qe,Header:U,SearchBox:$},loader:null,computed:{...g.mapState({isSaving:e=>e.application.isSaving,guid:e=>e.application.guid,searchContainerSelector:e=>e.application.options.searchContainerSelector}),...g.mapGetters({shownSections:"accessRights/shown",shownUserGroups:"userGroups/shown"})},mounted(){C.getHint(this.guid).initOwnerDocument(this.$refs.container)},methods:{scrollToSection(e){const t=this.$refs.sections.find((t=>t.code===e));if(t){scrollTo({top:b.Dom.getPosition(t.$el).top-155,behavior:"smooth"})}}},template:`\n\t\t<Teleport v-if="searchContainerSelector" :to="searchContainerSelector">\n\t\t\t<SearchBox/>\n\t\t</Teleport>\n\t\t<div ref="container" class='ui-access-rights-v2' :class="{\n\t\t\t'ui-access-rights-v2-block': isSaving,\n\t\t}">\n\t\t\t<Header :user-groups="shownUserGroups"/>\n\t\t\t<Section\n\t\t\t\tv-for="[sectionCode, accessRightSection] in shownSections"\n\t\t\t\t:key="sectionCode"\n\t\t\t\t:code="accessRightSection.sectionCode"\n\t\t\t\t:is-expanded="accessRightSection.isExpanded"\n\t\t\t\t:title="accessRightSection.sectionTitle"\n\t\t\t\t:sub-title="accessRightSection.sectionSubTitle"\n\t\t\t\t:hint="accessRightSection.sectionHint"\n\t\t\t\t:icon="accessRightSection.sectionIcon"\n\t\t\t\t:rights="accessRightSection.rights"\n\t\t\t\t:user-groups="shownUserGroups"\n\t\t\t\tref="sections"\n\t\t\t/>\n\t\t</div>\n\t`};var et=babelHelpers.classPrivateFieldLooseKey("store");var tt=babelHelpers.classPrivateFieldLooseKey("data");var st=babelHelpers.classPrivateFieldLooseKey("isEnabled");var it=babelHelpers.classPrivateFieldLooseKey("isCancelAlreadyRegistered");var ot=babelHelpers.classPrivateFieldLooseKey("analyzeRoles");var rt=babelHelpers.classPrivateFieldLooseKey("isUserGroupEdited");var nt=babelHelpers.classPrivateFieldLooseKey("getSaveErrorStatus");var at=babelHelpers.classPrivateFieldLooseKey("registerRoleCreateEvent");var lt=babelHelpers.classPrivateFieldLooseKey("registerRoleEditEvent");var ct=babelHelpers.classPrivateFieldLooseKey("registerRoleDeleteEvent");var ut=babelHelpers.classPrivateFieldLooseKey("appendRoleCountView");var dt=babelHelpers.classPrivateFieldLooseKey("appendP");class ht{constructor(e,t){Object.defineProperty(this,dt,{value:yt});Object.defineProperty(this,ut,{value:ft});Object.defineProperty(this,ct,{value:St});Object.defineProperty(this,lt,{value:mt});Object.defineProperty(this,at,{value:bt});Object.defineProperty(this,nt,{value:gt});Object.defineProperty(this,rt,{value:vt});Object.defineProperty(this,ot,{value:pt});Object.defineProperty(this,et,{writable:true,value:void 0});Object.defineProperty(this,tt,{writable:true,value:void 0});Object.defineProperty(this,st,{writable:true,value:void 0});Object.defineProperty(this,it,{writable:true,value:false});babelHelpers.classPrivateFieldLooseBase(this,et)[et]=e;babelHelpers.classPrivateFieldLooseBase(this,tt)[tt]=t;babelHelpers.classPrivateFieldLooseBase(this,st)[st]=Object.hasOwn(babelHelpers.classPrivateFieldLooseBase(this,tt)[tt],"tool")&&Object.hasOwn(babelHelpers.classPrivateFieldLooseBase(this,tt)[tt],"category")}onSaveAttempt(){if(!babelHelpers.classPrivateFieldLooseBase(this,st)[st]){return}const{createdRoles:e,editedRoles:t,deletedRoles:s}=babelHelpers.classPrivateFieldLooseBase(this,ot)[ot]();for(let t=0;t<e;t++){babelHelpers.classPrivateFieldLooseBase(this,at)[at]("attempt")}for(let e=0;e<t;e++){babelHelpers.classPrivateFieldLooseBase(this,lt)[lt]("attempt")}for(let e=0;e<s;e++){babelHelpers.classPrivateFieldLooseBase(this,ct)[ct]("attempt")}}onSaveSuccess(){if(!babelHelpers.classPrivateFieldLooseBase(this,st)[st]){return}const{createdRoles:e,editedRoles:t,deletedRoles:s}=babelHelpers.classPrivateFieldLooseBase(this,ot)[ot]();for(let t=0;t<e;t++){babelHelpers.classPrivateFieldLooseBase(this,at)[at]("success")}for(let e=0;e<t;e++){babelHelpers.classPrivateFieldLooseBase(this,lt)[lt]("success")}for(let e=0;e<s;e++){babelHelpers.classPrivateFieldLooseBase(this,ct)[ct]("success")}}onSaveError(e){if(!babelHelpers.classPrivateFieldLooseBase(this,st)[st]){return}const t=babelHelpers.classPrivateFieldLooseBase(this,nt)[nt](e);const{createdRoles:s,editedRoles:i,deletedRoles:o}=babelHelpers.classPrivateFieldLooseBase(this,ot)[ot]();for(let e=0;e<s;e++){babelHelpers.classPrivateFieldLooseBase(this,at)[at](t)}for(let e=0;e<i;e++){babelHelpers.classPrivateFieldLooseBase(this,lt)[lt](t)}for(let e=0;e<o;e++){babelHelpers.classPrivateFieldLooseBase(this,ct)[ct](t)}}onCancelChanges(){if(!babelHelpers.classPrivateFieldLooseBase(this,st)[st]){return}if(babelHelpers.classPrivateFieldLooseBase(this,it)[it]){return}v.sendData({...babelHelpers.classPrivateFieldLooseBase(this,tt)[tt],event:"settings_cancel"});babelHelpers.classPrivateFieldLooseBase(this,it)[it]=true}onCloseWithoutSave(){if(!babelHelpers.classPrivateFieldLooseBase(this,st)[st]){return}v.sendData({...babelHelpers.classPrivateFieldLooseBase(this,tt)[tt],event:"settings_pop_cancel"})}}function pt(){const e={createdRoles:0,editedRoles:0,deletedRoles:babelHelpers.classPrivateFieldLooseBase(this,et)[et].state.userGroups.deleted.size};for(const t of babelHelpers.classPrivateFieldLooseBase(this,et)[et].state.userGroups.collection.values()){if(t.isNew){e.createdRoles++}else if(babelHelpers.classPrivateFieldLooseBase(this,rt)[rt](t)){e.editedRoles++}}return e}function vt(e){if(e.isModified){return true}for(const t of e.accessRights.values()){if(t.isModified){return true}}return false}function gt(e){if(!b.Type.isArrayFilled(e==null?void 0:e.errors)){return"error"}for(const t of e.errors){if(b.Type.isStringFilled(t==null?void 0:t.code)){return`error_${b.Text.toCamelCase(t.code)}`}}return"error"}function bt(e){const t={...babelHelpers.classPrivateFieldLooseBase(this,tt)[tt],event:"role_create",status:e};babelHelpers.classPrivateFieldLooseBase(this,ut)[ut](t);v.sendData(t)}function mt(e){const t={...babelHelpers.classPrivateFieldLooseBase(this,tt)[tt],event:"role_edit",status:e};babelHelpers.classPrivateFieldLooseBase(this,ut)[ut](t);v.sendData(t)}function St(e){const t={...babelHelpers.classPrivateFieldLooseBase(this,tt)[tt],event:"role_delete",status:e};babelHelpers.classPrivateFieldLooseBase(this,ut)[ut](t);v.sendData(t)}function ft(e){babelHelpers.classPrivateFieldLooseBase(this,dt)[dt](e,"roleCountView",babelHelpers.classPrivateFieldLooseBase(this,et)[et].getters["userGroups/shown"].size)}function yt(e,t,s){for(const i of["p1","p2","p3","p4","p5"]){if(!Object.hasOwn(e,i)){e[i]=`${t}_${s}`;return}}}const It="save";const Lt="ajax";const Ct="data";var Pt=babelHelpers.classPrivateFieldLooseKey("guid");var wt=babelHelpers.classPrivateFieldLooseKey("options");class Rt extends g.BuilderModel{constructor(...e){super(...e);Object.defineProperty(this,Pt,{writable:true,value:void 0});Object.defineProperty(this,wt,{writable:true,value:void 0})}getName(){return"application"}setOptions(e){babelHelpers.classPrivateFieldLooseBase(this,wt)[wt]=e;return this}setGuid(e){babelHelpers.classPrivateFieldLooseBase(this,Pt)[Pt]=e;return this}getState(){return{options:babelHelpers.classPrivateFieldLooseBase(this,wt)[wt],guid:babelHelpers.classPrivateFieldLooseBase(this,Pt)[Pt],isSaving:false}}getGetters(){return{isMaxVisibleUserGroupsSet:e=>e.options.maxVisibleUserGroups>0}}getMutations(){return{setSaving:(e,t)=>{e.isSaving=Boolean(t)}}}}const Mt="new~~~";var Ht=babelHelpers.classPrivateFieldLooseKey("initialUserGroups");var Vt=babelHelpers.classPrivateFieldLooseKey("setAccessRightValuesAction");var Bt=babelHelpers.classPrivateFieldLooseKey("setAccessRightValuesForShownAction");var _t=babelHelpers.classPrivateFieldLooseKey("setMinAccessRightValuesAction");var Et=babelHelpers.classPrivateFieldLooseKey("setMinAccessRightValuesInSectionAction");var Gt=babelHelpers.classPrivateFieldLooseKey("setMinAccessRightValuesForRight");var Ft=babelHelpers.classPrivateFieldLooseKey("getMinValueForColumnAction");var At=babelHelpers.classPrivateFieldLooseKey("getMinValue");var Tt=babelHelpers.classPrivateFieldLooseKey("setMaxAccessRightValuesAction");var xt=babelHelpers.classPrivateFieldLooseKey("setMaxAccessRightValuesInSectionAction");var Ot=babelHelpers.classPrivateFieldLooseKey("setMaxAccessRightValuesForRight");var Ut=babelHelpers.classPrivateFieldLooseKey("getMaxValueForColumnAction");var $t=babelHelpers.classPrivateFieldLooseKey("getMaxValue");var jt=babelHelpers.classPrivateFieldLooseKey("copySectionValuesAction");var kt=babelHelpers.classPrivateFieldLooseKey("setRoleTitleAction");var Dt=babelHelpers.classPrivateFieldLooseKey("addMemberAction");var Nt=babelHelpers.classPrivateFieldLooseKey("removeMemberAction");var Kt=babelHelpers.classPrivateFieldLooseKey("copyUserGroupAction");var zt=babelHelpers.classPrivateFieldLooseKey("addUserGroupAction");var Jt=babelHelpers.classPrivateFieldLooseKey("removeUserGroupAction");var qt=babelHelpers.classPrivateFieldLooseKey("showUserGroupAction");var Wt=babelHelpers.classPrivateFieldLooseKey("hideUserGroupAction");var Xt=babelHelpers.classPrivateFieldLooseKey("isUserGroupExists");var Yt=babelHelpers.classPrivateFieldLooseKey("getUserGroup");var Qt=babelHelpers.classPrivateFieldLooseKey("isValueExistsInStructure");var Zt=babelHelpers.classPrivateFieldLooseKey("isValueModified");var es=babelHelpers.classPrivateFieldLooseKey("isSetsEqual");var ts=babelHelpers.classPrivateFieldLooseKey("isUserGroupModified");class ss extends g.BuilderModel{constructor(...e){super(...e);Object.defineProperty(this,ts,{value:Vs});Object.defineProperty(this,es,{value:Hs});Object.defineProperty(this,Zt,{value:Ms});Object.defineProperty(this,Qt,{value:Rs});Object.defineProperty(this,Yt,{value:ws});Object.defineProperty(this,Xt,{value:Ps});Object.defineProperty(this,Wt,{value:Cs});Object.defineProperty(this,qt,{value:Ls});Object.defineProperty(this,Jt,{value:Is});Object.defineProperty(this,zt,{value:ys});Object.defineProperty(this,Kt,{value:fs});Object.defineProperty(this,Nt,{value:Ss});Object.defineProperty(this,Dt,{value:ms});Object.defineProperty(this,kt,{value:bs});Object.defineProperty(this,jt,{value:gs});Object.defineProperty(this,$t,{value:vs});Object.defineProperty(this,Ut,{value:ps});Object.defineProperty(this,Ot,{value:hs});Object.defineProperty(this,xt,{value:ds});Object.defineProperty(this,Tt,{value:us});Object.defineProperty(this,At,{value:cs});Object.defineProperty(this,Ft,{value:ls});Object.defineProperty(this,Gt,{value:as});Object.defineProperty(this,Et,{value:ns});Object.defineProperty(this,_t,{value:rs});Object.defineProperty(this,Bt,{value:os});Object.defineProperty(this,Vt,{value:is});Object.defineProperty(this,Ht,{writable:true,value:new Map})}getName(){return"userGroups"}setInitialUserGroups(e){babelHelpers.classPrivateFieldLooseBase(this,Ht)[Ht]=e;return this}getState(){return{collection:b.Runtime.clone(babelHelpers.classPrivateFieldLooseBase(this,Ht)[Ht]),deleted:new Set}}getElementState(e={}){return{id:`${Mt}${b.Text.getRandom()}`,isNew:true,isModified:true,isShown:true,title:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_ROLE_NAME"),accessRights:new Map,members:new Map}}getGetters(){return{shown:e=>{const t=new Map;for(const[s,i]of e.collection){if(i.isShown){t.set(s,i)}}return t},getEmptyAccessRightValue:(e,t,s,i)=>(t,s,o)=>{const r=i["accessRights/getEmptyValue"](s,o);return{id:o,values:r,isModified:e.collection.get(t).isNew}},defaultAccessRightValues:(e,t,s)=>{const i=new Map;for(const e of s.accessRights.collection.values()){for(const[t,s]of e.rights){if(b.Type.isNil(s.defaultValue)){continue}i.set(t,{id:t,values:s.defaultValue,isModified:true})}}return i},isModified:e=>{if(e.deleted.size>0){return true}for(const t of e.collection.values()){if(t.isNew||t.isModified){return true}for(const e of t.accessRights.values()){if(e.isModified){return true}}}return false},isMaxVisibleUserGroupsReached:(e,t,s,i)=>{if(!i["application/isMaxVisibleUserGroupsSet"]){return false}return t.shown.size>=s.application.options.maxVisibleUserGroups}}}getActions(){return{setAccessRightValues:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Vt)[Vt](e,t)},setAccessRightValuesForShown:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Bt)[Bt](e,t)},setMinAccessRightValues:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,_t)[_t](e,t)},setMaxAccessRightValues:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Tt)[Tt](e,t)},setMinAccessRightValuesInSection:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Et)[Et](e,t)},setMaxAccessRightValuesInSection:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,xt)[xt](e,t)},setMinAccessRightValuesForRight:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Gt)[Gt](e,t)},setMaxAccessRightValuesForRight:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Ot)[Ot](e,t)},setRoleTitle:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,kt)[kt](e,t)},addMember:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Dt)[Dt](e,t)},removeMember:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Nt)[Nt](e,t)},copyUserGroup:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Kt)[Kt](e,t)},copySectionValues:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,jt)[jt](e,t)},addUserGroup:e=>{babelHelpers.classPrivateFieldLooseBase(this,zt)[zt](e)},removeUserGroup:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Jt)[Jt](e,t)},showUserGroup:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,qt)[qt](e,t)},hideUserGroup:(e,t)=>{babelHelpers.classPrivateFieldLooseBase(this,Wt)[Wt](e,t)}}}getMutations(){return{setAccessRightValues:(e,{userGroupId:t,valueId:s,values:i,isModified:o})=>{const r=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e,t);const n=r.accessRights.get(s);if(!n){r.accessRights.set(s,{id:s,values:i,isModified:o});return}n.values=i;n.isModified=o},setRoleTitle:(e,{userGroupId:t,title:s})=>{const i=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e,t);i.title=s;i.isModified=babelHelpers.classPrivateFieldLooseBase(this,ts)[ts](i)},addMember:(e,{userGroupId:t,accessCode:s,member:i})=>{const o=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e,t);o.members.set(s,i);o.isModified=babelHelpers.classPrivateFieldLooseBase(this,ts)[ts](o)},removeMember:(e,{userGroupId:t,accessCode:s})=>{const i=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e,t);i.members.delete(s);i.isModified=babelHelpers.classPrivateFieldLooseBase(this,ts)[ts](i)},addUserGroup:(e,{userGroup:t})=>{e.collection.set(t.id,t)},removeUserGroup:(e,{userGroupId:t})=>{e.collection.delete(t)},markUserGroupForDeletion:(e,{userGroupId:t})=>{e.deleted.add(t)},showUserGroup:(e,{userGroupId:t})=>{e.collection.get(t).isShown=true},hideUserGroup:(e,{userGroupId:t})=>{e.collection.get(t).isShown=false}}}}function is(e,t){if(!b.Type.isSet(t.values)){console.warn("ui.accessrights.v2: Attempt to set not-Set values",t);return}if(!babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt](e,t.userGroupId)){console.warn("ui.accessrights.v2: Attempt to set value to a user group that dont exists",t);return}if(!babelHelpers.classPrivateFieldLooseBase(this,Qt)[Qt](e,t.sectionCode,t.valueId)){console.warn("ui.accessrights.v2: Attempt to set value to a right that dont exists in structure",t);return}e.commit("setAccessRightValues",{userGroupId:t.userGroupId,valueId:t.valueId,values:t.values,isModified:babelHelpers.classPrivateFieldLooseBase(this,Zt)[Zt](t.userGroupId,t.valueId,t.values,e.rootGetters["accessRights/getEmptyValue"](t.sectionCode,t.valueId))})}function os(e,t){for(const s of e.getters.shown.keys()){void e.dispatch("setAccessRightValues",{...t,userGroupId:s})}}function rs(e,{userGroupId:t}){for(const s of e.rootState.accessRights.collection.keys()){void e.dispatch("setMinAccessRightValuesInSection",{userGroupId:t,sectionCode:s})}void e.dispatch("accessRights/expandAllSections",null,{root:true})}function ns(e,{userGroupId:t,sectionCode:s}){const i=e.rootState.accessRights.collection.get(s);if(!i){console.warn("ui.accessrights.v2: attempt to set min values in section that dont exists",{sectionCode:s});return}for(const s of i.rights.values()){const o=babelHelpers.classPrivateFieldLooseBase(this,Ft)[Ft](s,e.rootGetters["accessRights/getEmptyValue"](i.sectionCode,s.id));if(b.Type.isNil(o)){continue}void e.dispatch("setAccessRightValues",{userGroupId:t,sectionCode:i.sectionCode,valueId:s.id,values:o})}}function as(e,{sectionCode:t,rightId:s}){var i;const o=(i=e.rootState.accessRights.collection.get(t))==null?void 0:i.rights.get(s);if(!o){console.warn("ui.accessrights.v2: attempt to set min values for right that dont exists",{sectionCode:t,rightId:s});return}const r=babelHelpers.classPrivateFieldLooseBase(this,At)[At](o);if(b.Type.isNil(r)){console.warn("ui.accessrights.v2: attempt to set min values for right that dont have min value set",{sectionCode:t,rightId:s});return}void e.dispatch("setAccessRightValuesForShown",{sectionCode:t,valueId:s,values:r})}function ls(e,t){const s=b.Type.isBoolean(e.setEmptyOnSetMinMaxValueInColumn)&&e.setEmptyOnSetMinMaxValueInColumn;if(s){return t}return babelHelpers.classPrivateFieldLooseBase(this,At)[At](e)}function cs(e){var t;return(t=C.getValueTypeByRight(e))==null?void 0:t.getMinValue(e)}function us(e,{userGroupId:t}){for(const s of e.rootState.accessRights.collection.keys()){void e.dispatch("setMaxAccessRightValuesInSection",{userGroupId:t,sectionCode:s})}void e.dispatch("accessRights/expandAllSections",null,{root:true})}function ds(e,{userGroupId:t,sectionCode:s}){const i=e.rootState.accessRights.collection.get(s);if(!i){console.warn("ui.accessrights.v2: attempt to set max values in section that dont exists",{sectionCode:s});return}for(const s of i.rights.values()){const o=babelHelpers.classPrivateFieldLooseBase(this,Ut)[Ut](s,e.rootGetters["accessRights/getEmptyValue"](i.sectionCode,s.id));if(b.Type.isNil(o)){continue}void e.dispatch("setAccessRightValues",{userGroupId:t,sectionCode:i.sectionCode,valueId:s.id,values:o})}}function hs(e,{sectionCode:t,rightId:s}){var i;const o=(i=e.rootState.accessRights.collection.get(t))==null?void 0:i.rights.get(s);if(!o){console.warn("ui.accessrights.v2: attempt to set max values for right that dont exists",{sectionCode:t,rightId:s});return}const r=babelHelpers.classPrivateFieldLooseBase(this,$t)[$t](o);if(b.Type.isNil(r)){console.warn("ui.accessrights.v2: attempt to set max values for right that dont have max value set",{sectionCode:t,rightId:s});return}void e.dispatch("setAccessRightValuesForShown",{sectionCode:t,valueId:s,values:r})}function ps(e,t){const s=b.Type.isBoolean(e.setEmptyOnSetMinMaxValueInColumn)&&e.setEmptyOnSetMinMaxValueInColumn;if(s){return t}return babelHelpers.classPrivateFieldLooseBase(this,$t)[$t](e)}function vs(e){var t;return(t=C.getValueTypeByRight(e))==null?void 0:t.getMaxValue(e)}function gs(e,t){const s=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e.state,t.srcUserGroupId);if(!s){console.warn("ui.accessrights.v2: Attempt to copy values from user group that dont exists",t);return}const i=e.rootState.accessRights.collection.get(t.sectionCode);if(!i){console.warn("ui.accessrights.v2: Attempt to copy values for section that dont exists",t);return}for(const o of i.rights.keys()){const r=s.accessRights.get(o);if(r){void e.dispatch("setAccessRightValues",{userGroupId:t.dstUserGroupId,sectionCode:i.sectionCode,valueId:r.id,values:r.values})}else{const s=e.rootGetters["accessRights/getEmptyValue"](i.sectionCode,o);void e.dispatch("setAccessRightValues",{userGroupId:t.dstUserGroupId,sectionCode:i.sectionCode,valueId:o,values:s})}}}function bs(e,t){if(!b.Type.isString(t.title)){console.warn("ui.accessrights.v2: Attempt to set role title with something other than string",t);return}if(!babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt](e,t.userGroupId)){console.warn("ui.accessrights.v2: Attempt to update user group that dont exists",t);return}e.commit("setRoleTitle",t)}function ms(e,t){if(!babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt](e,t.userGroupId)){console.warn("ui.accessrights.v2: Attempt to add member to a user group that dont exists",t);return}if(!b.Type.isStringFilled(t.accessCode)||!b.Type.isStringFilled(t.member.id)||!b.Type.isStringFilled(t.member.type)||!b.Type.isStringFilled(t.member.name)||!(b.Type.isNil(t.member.avatar)||b.Type.isStringFilled(t.member.avatar))){console.warn("ui.accessrights.v2: Attempt to add member with invalid payload",t);return}e.commit("addMember",t)}function Ss(e,t){if(!babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt](e,t.userGroupId)){console.warn("ui.accessrights.v2: Attempt to remove member from a user group that dont exists",t);return}if(!b.Type.isStringFilled(t.accessCode)){console.warn("ui.accessrights.v2: Attempt to remove member with invalid payload",t);return}e.commit("removeMember",t)}function fs(e,{userGroupId:t}){const s=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e.state,t);if(!s){console.warn("ui.accessrights.v2: Attempt to copy user group that dont exists",{userGroupId:t});return}const i=this.getElementState();const o={...b.Runtime.clone(s),id:i.id,title:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_COPIED_ROLE_NAME",{"#ORIGINAL#":s.title}),isNew:true,isModified:true,isShown:true};for(const e of o.accessRights.values()){e.isModified=true}e.commit("addUserGroup",{userGroup:o})}function ys(e){const t=this.getElementState();t.accessRights=b.Runtime.clone(e.getters.defaultAccessRightValues);e.commit("addUserGroup",{userGroup:t})}function Is(e,{userGroupId:t}){const s=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e.state,t);if(!s){console.warn("ui.accessrights.v2: Attempt to remove user group that dont exists",{userGroupId:t});return}e.commit("removeUserGroup",{userGroupId:t});if(!s.isNew){e.commit("markUserGroupForDeletion",{userGroupId:t})}}function Ls(e,{userGroupId:t}){if(!babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt](e,t)){console.warn("ui.accessrights.v2: Attempt to show user group that dont exists",{userGroupId:t});return}e.commit("showUserGroup",{userGroupId:t})}function Cs(e,{userGroupId:t}){if(!babelHelpers.classPrivateFieldLooseBase(this,Xt)[Xt](e,t)){console.warn("ui.accessrights.v2: Attempt to shrink user group that dont exists",{userGroupId:t});return}e.commit("hideUserGroup",{userGroupId:t})}function Ps(e,t){const s=babelHelpers.classPrivateFieldLooseBase(this,Yt)[Yt](e.state,t);return Boolean(s)}function ws(e,t){return e.collection.get(t)}function Rs(e,t,s){const i=e.rootState.accessRights.collection.get(t);return i==null?void 0:i.rights.has(s)}function Ms(e,t,s,i){var o,r;const n=babelHelpers.classPrivateFieldLooseBase(this,Ht)[Ht].get(e);if(!n){return true}const a=(o=(r=n.accessRights.get(t))==null?void 0:r.values)!=null?o:i;return!babelHelpers.classPrivateFieldLooseBase(this,es)[es](new Set(a),new Set(s))}function Hs(e,t){if(b.Type.isFunction(e.symmetricDifference)){return e.symmetricDifference(t).size===0}if(e.size!==t.size){return false}for(const s of e){if(!t.has(s)){return false}}for(const s of t){if(!e.has(s)){return false}}return true}function Vs(e){if(e.isNew){return true}const t=babelHelpers.classPrivateFieldLooseBase(this,Ht)[Ht].get(e.id);if(!t){throw new Error("ui.accessrights.v2: initial user group not found")}if(e.title!==t.title){return true}const s=new Set(t.members.keys());const i=new Set(e.members.keys());return!babelHelpers.classPrivateFieldLooseBase(this,es)[es](s,i)}function Bs(e,t,s,i){const o=ss.create().setInitialUserGroups(t);const{store:r}=g.Builder.init().addModel(Rt.create().setOptions(e).setGuid(i)).addModel(Z.create().setInitialAccessRights(s)).addModel(o).syncBuild();return{store:r,resetState:()=>o.clearState(),userGroupsModel:o}}var _s=babelHelpers.classPrivateFieldLooseKey("transformAccessCodes");var Es=babelHelpers.classPrivateFieldLooseKey("transformAccessRightValues");class Gs{constructor(){Object.defineProperty(this,Es,{value:As});Object.defineProperty(this,_s,{value:Fs})}transform(e){const t=[];for(const s of e.values()){t.push({id:s.id.startsWith(Mt)?"0":s.id,title:s.title,accessCodes:babelHelpers.classPrivateFieldLooseBase(this,_s)[_s](s.members),accessRights:babelHelpers.classPrivateFieldLooseBase(this,Es)[Es](s)})}return t}shouldBeIncludedInExport(e,t){throw new Error("Not implemented")}}function Fs(e){const t={};for(const[s,i]of e){t[s]=i.type}return t}function As(e){const t=[];for(const s of e.accessRights.values()){if(!this.shouldBeIncludedInExport(e,s)){continue}for(const e of s.values){t.push({id:s.id,value:e})}}return t}class Ts extends Gs{shouldBeIncludedInExport(e,t){return true}}class xs extends Gs{shouldBeIncludedInExport(e,t){return e.isNew||t.isModified}}var Os=babelHelpers.classPrivateFieldLooseKey("internalizeExternalSection");var Us=babelHelpers.classPrivateFieldLooseKey("internalizeExternalIcon");var $s=babelHelpers.classPrivateFieldLooseKey("internalizeExternalItem");var js=babelHelpers.classPrivateFieldLooseKey("internalizeSelectedVariablesAliases");var ks=babelHelpers.classPrivateFieldLooseKey("internalizeValueSet");var Ds=babelHelpers.classPrivateFieldLooseKey("internalizeSetEmptyOnSetMinMaxValueInColumn");var Ns=babelHelpers.classPrivateFieldLooseKey("internalizeExternalVariable");class Ks{constructor(){Object.defineProperty(this,Ns,{value:Qs});Object.defineProperty(this,Ds,{value:Ys});Object.defineProperty(this,ks,{value:Xs});Object.defineProperty(this,js,{value:Ws});Object.defineProperty(this,$s,{value:qs});Object.defineProperty(this,Us,{value:Js});Object.defineProperty(this,Os,{value:zs})}transform(e){const t=new Map;for(const s of e){const e=babelHelpers.classPrivateFieldLooseBase(this,Os)[Os](s);t.set(e.sectionCode,e)}return t}}function zs(e){const t={sectionCode:b.Type.isStringFilled(e.sectionCode)?e.sectionCode:b.Text.getRandom(),sectionTitle:String(e.sectionTitle),sectionSubTitle:b.Type.isStringFilled(e.sectionSubTitle)?e.sectionSubTitle:null,sectionHint:b.Type.isStringFilled(e.sectionHint)?e.sectionHint:null,sectionIcon:babelHelpers.classPrivateFieldLooseBase(this,Us)[Us](e.sectionIcon),rights:new Map,isExpanded:true,isShown:true};for(const s of e.rights){const e=babelHelpers.classPrivateFieldLooseBase(this,$s)[$s](s);t.rights.set(e.id,e)}return t}function Js(e){if(b.Type.isStringFilled(e==null?void 0:e.type)&&b.Type.isStringFilled(e==null?void 0:e.bgColor)){return{type:e.type,bgColor:e.bgColor}}return null}function qs(e){const[t,s]=babelHelpers.classPrivateFieldLooseBase(this,js)[js](e.selectedVariablesAliases);const i={id:String(e.id),type:String(e.type),title:String(e.title),hint:b.Type.isStringFilled(e.hint)?e.hint:null,group:b.Type.isNil(e.group)?null:String(e.group),groupHead:b.Type.isBoolean(e.groupHead)?e.groupHead:false,isShown:true,minValue:babelHelpers.classPrivateFieldLooseBase(this,ks)[ks](e.minValue),maxValue:babelHelpers.classPrivateFieldLooseBase(this,ks)[ks](e.maxValue),defaultValue:babelHelpers.classPrivateFieldLooseBase(this,ks)[ks](e.defaultValue),emptyValue:babelHelpers.classPrivateFieldLooseBase(this,ks)[ks](e.emptyValue),nothingSelectedValue:babelHelpers.classPrivateFieldLooseBase(this,ks)[ks](e.nothingSelectedValue),setEmptyOnSetMinMaxValueInColumn:babelHelpers.classPrivateFieldLooseBase(this,Ds)[Ds](e),variables:b.Type.isArray(e.variables)?new Map:null,allSelectedCode:b.Type.isStringFilled(e.allSelectedCode)?e.allSelectedCode:null,selectedVariablesAliases:t,selectedVariablesAliasesSeparator:s,enableSearch:b.Type.isBoolean(e.enableSearch)?e.enableSearch:null,showAvatars:b.Type.isBoolean(e.showAvatars)?e.showAvatars:null,compactView:b.Type.isBoolean(e.compactView)?e.compactView:null,hintTitle:b.Type.isStringFilled(e.hintTitle)?e.hintTitle:null};if(i.groupHead||i.group){i.isGroupExpanded=false}if(b.Type.isArray(e.variables)){for(const t of e.variables){const e=babelHelpers.classPrivateFieldLooseBase(this,Ns)[Ns](t);i.variables.set(e.id,e)}}return i}function Ws(e){if(!b.Type.isPlainObject(e)){return[new Map,J]}const t=b.Type.isString(e.separator)?e.separator:J;const s=new Map;for(const[i,o]of Object.entries(e)){if(i==="separator"){continue}s.set(X(i,t),String(o))}return[s,t]}function Xs(e){if(b.Type.isNil(e)){return null}if(b.Type.isArray(e)){return new Set(e.map((e=>String(e))))}return new Set([String(e)])}function Ys(e){const t=e=>b.Type.isBoolean(e)?e:null;if(!b.Type.isUndefined(e.setEmptyOnSetMinMaxValueInColumn)){return t(e.setEmptyOnSetMinMaxValueInColumn)}return t(e.setEmptyOnGroupActions)}function Qs(e){return{id:String(e.id),title:String(e.title),entityId:b.Type.isStringFilled(e.entityId)?e.entityId:null,supertitle:b.Type.isStringFilled(e.supertitle)?e.supertitle:null,avatar:b.Type.isStringFilled(e.avatar)?e.avatar:null,avatarOptions:b.Type.isPlainObject(e.avatarOptions)?e.avatarOptions:null,conflictsWith:b.Type.isArray(e.conflictsWith)?new Set(e.conflictsWith.map((e=>String(e)))):null,requires:b.Type.isArray(e.requires)?new Set(e.requires.map((e=>String(e)))):null,secondary:b.Type.isBoolean(e.secondary)?e.secondary:null}}var Zs=babelHelpers.classPrivateFieldLooseKey("deepFreeze");class ei{constructor(){Object.defineProperty(this,Zs,{value:ti})}transform(e){return babelHelpers.classPrivateFieldLooseBase(this,Zs)[Zs]({component:String(e.component),actionSave:b.Type.isStringFilled(e.actionSave)?e.actionSave:It,mode:b.Type.isStringFilled(e.mode)?e.mode:Lt,bodyType:b.Type.isStringFilled(e.bodyType)?e.bodyType:Ct,additionalSaveParams:b.Type.isPlainObject(e.additionalSaveParams)?e.additionalSaveParams:null,isSaveOnlyChangedRights:b.Type.isBoolean(e.isSaveOnlyChangedRights)?e.isSaveOnlyChangedRights:false,maxVisibleUserGroups:b.Type.isInteger(e.maxVisibleUserGroups)?e.maxVisibleUserGroups:null,searchContainerSelector:b.Type.isStringFilled(e.searchContainerSelector)?e.searchContainerSelector:null})}}function ti(e){if(b.Type.isObject(e)){Object.values(e).forEach((e=>{babelHelpers.classPrivateFieldLooseBase(this,Zs)[Zs](e)}));return Object.freeze(e)}return e}var si=babelHelpers.classPrivateFieldLooseKey("maxVisibleUserGroups");var ii=babelHelpers.classPrivateFieldLooseKey("internalizeExternalGroup");var oi=babelHelpers.classPrivateFieldLooseKey("internalizeExternalAccessRightsValue");var ri=babelHelpers.classPrivateFieldLooseKey("internalizeExternalAccessCode");var ni=babelHelpers.classPrivateFieldLooseKey("internalizeExternalMember");class ai{constructor(e){Object.defineProperty(this,ni,{value:di});Object.defineProperty(this,ri,{value:ui});Object.defineProperty(this,oi,{value:ci});Object.defineProperty(this,ii,{value:li});Object.defineProperty(this,si,{writable:true,value:null});if(b.Type.isInteger(e)){babelHelpers.classPrivateFieldLooseBase(this,si)[si]=e}}transform(e){const t=new Map;for(const s of e){const e=babelHelpers.classPrivateFieldLooseBase(this,ii)[ii](s);if(babelHelpers.classPrivateFieldLooseBase(this,si)[si]>0&&t.size>=babelHelpers.classPrivateFieldLooseBase(this,si)[si]){e.isShown=false}t.set(e.id,e)}return t}}function li(e){const t={id:String(e.id),isNew:false,isModified:false,isShown:true,title:String(e.title),accessRights:new Map,members:new Map};for(const s of e.accessRights){const e=babelHelpers.classPrivateFieldLooseBase(this,oi)[oi](s);if(t.accessRights.has(e.id)){for(const s of t.accessRights.get(e.id).values){e.values.add(s)}}t.accessRights.set(e.id,e)}for(const[s,i]of Object.entries(e.members)){const e=babelHelpers.classPrivateFieldLooseBase(this,ri)[ri](s);t.members.set(e,babelHelpers.classPrivateFieldLooseBase(this,ni)[ni](i))}return t}function ci(e){const t=String(e.id);const s={id:t,isModified:false};const i=b.Type.isArray(e.value)?e.value:[e.value];s.values=new Set(i.map((e=>String(e))));return s}function ui(e){let t=String(e);if(/^IU(\d+)$/.test(t)){t=t.replace("IU","U")}return t}function di(e){return{type:String(e.type),id:String(e.id),name:String(e.name),avatar:b.Type.isStringFilled(e.avatar)?e.avatar:null}}var hi=babelHelpers.classPrivateFieldLooseKey("srcUserGroups");var pi=babelHelpers.classPrivateFieldLooseKey("maxVisibleUserGroups");var vi=babelHelpers.classPrivateFieldLooseKey("ensureThatNoMoreUserGroupsThanMaxIsShown");class gi{constructor(e,t){Object.defineProperty(this,vi,{value:bi});Object.defineProperty(this,hi,{writable:true,value:void 0});Object.defineProperty(this,pi,{writable:true,value:null});babelHelpers.classPrivateFieldLooseBase(this,hi)[hi]=e;if(b.Type.isInteger(t)){babelHelpers.classPrivateFieldLooseBase(this,pi)[pi]=t}}transform(e){for(const[t,s]of e){const e=babelHelpers.classPrivateFieldLooseBase(this,hi)[hi].get(t);if(e){s.isShown=e.isShown}else{s.isShown=true}}if(babelHelpers.classPrivateFieldLooseBase(this,pi)[pi]>0){babelHelpers.classPrivateFieldLooseBase(this,vi)[vi](e)}return e}}function bi(e){let t=0;for(const s of e.values()){if(!s.isShown){continue}t++;if(t>babelHelpers.classPrivateFieldLooseBase(this,pi)[pi]){s.isShown=false}}}var mi=babelHelpers.classPrivateFieldLooseKey("options");var Si=babelHelpers.classPrivateFieldLooseKey("renderTo");var fi=babelHelpers.classPrivateFieldLooseKey("buttonPanel");var yi=babelHelpers.classPrivateFieldLooseKey("guid");var Ii=babelHelpers.classPrivateFieldLooseKey("isUserConfirmedClose");var Li=babelHelpers.classPrivateFieldLooseKey("handleSliderClose");var Ci=babelHelpers.classPrivateFieldLooseKey("app");var Pi=babelHelpers.classPrivateFieldLooseKey("rootComponent");var wi=babelHelpers.classPrivateFieldLooseKey("store");var Ri=babelHelpers.classPrivateFieldLooseKey("resetState");var Mi=babelHelpers.classPrivateFieldLooseKey("unwatch");var Hi=babelHelpers.classPrivateFieldLooseKey("userGroupsModel");var Vi=babelHelpers.classPrivateFieldLooseKey("analyticsManager");var Bi=babelHelpers.classPrivateFieldLooseKey("bindEvents");var _i=babelHelpers.classPrivateFieldLooseKey("unbindEvents");var Ei=babelHelpers.classPrivateFieldLooseKey("tryShowFeaturePromoter");var Gi=babelHelpers.classPrivateFieldLooseKey("showNotification");var Fi=babelHelpers.classPrivateFieldLooseKey("runSaveAjaxRequest");var Ai=babelHelpers.classPrivateFieldLooseKey("confirmBeforeClosingModifiedSlider");class Ti{constructor(e){Object.defineProperty(this,Ai,{value:ki});Object.defineProperty(this,Fi,{value:ji});Object.defineProperty(this,Gi,{value:$i});Object.defineProperty(this,Ei,{value:Ui});Object.defineProperty(this,_i,{value:Oi});Object.defineProperty(this,Bi,{value:xi});Object.defineProperty(this,mi,{writable:true,value:{}});Object.defineProperty(this,Si,{writable:true,value:void 0});Object.defineProperty(this,fi,{writable:true,value:void 0});Object.defineProperty(this,yi,{writable:true,value:void 0});Object.defineProperty(this,Ii,{writable:true,value:false});Object.defineProperty(this,Li,{writable:true,value:void 0});Object.defineProperty(this,Ci,{writable:true,value:void 0});Object.defineProperty(this,Pi,{writable:true,value:void 0});Object.defineProperty(this,wi,{writable:true,value:void 0});Object.defineProperty(this,Ri,{writable:true,value:void 0});Object.defineProperty(this,Mi,{writable:true,value:void 0});Object.defineProperty(this,Hi,{writable:true,value:void 0});Object.defineProperty(this,Vi,{writable:true,value:void 0});babelHelpers.classPrivateFieldLooseBase(this,mi)[mi]=e||{};babelHelpers.classPrivateFieldLooseBase(this,Si)[Si]=babelHelpers.classPrivateFieldLooseBase(this,mi)[mi].renderTo;babelHelpers.classPrivateFieldLooseBase(this,fi)[fi]=BX.UI.ButtonPanel||null;babelHelpers.classPrivateFieldLooseBase(this,yi)[yi]=b.Text.getRandom(16);babelHelpers.classPrivateFieldLooseBase(this,Bi)[Bi]()}fireEventReset(){const e=s.MessageBox.create({message:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_MODIFIED_CANCEL_WARNING"),modal:true,buttons:[new i.Button({color:i.ButtonColor.PRIMARY,size:i.ButtonSize.SMALL,text:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_MODIFIED_CANCEL_YES_CANCEL"),onclick:()=>{babelHelpers.classPrivateFieldLooseBase(this,Vi)[Vi].onCancelChanges();babelHelpers.classPrivateFieldLooseBase(this,Ri)[Ri]();e.close()}}),new i.Button({color:i.ButtonColor.LINK,size:i.ButtonSize.SMALL,text:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_MODIFIED_CANCEL_NO_CANCEL"),onclick:()=>{e.close()}})]});e.show()}sendActionRequest(){return new Promise(((e,t)=>{if(babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.isSaving||!babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].getters["userGroups/isModified"]){e();return}babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].commit("application/setSaving",true);babelHelpers.classPrivateFieldLooseBase(this,Vi)[Vi].onSaveAttempt();babelHelpers.classPrivateFieldLooseBase(this,Fi)[Fi]().then((({userGroups:e})=>{babelHelpers.classPrivateFieldLooseBase(this,Vi)[Vi].onSaveSuccess();babelHelpers.classPrivateFieldLooseBase(this,Hi)[Hi].setInitialUserGroups(e);babelHelpers.classPrivateFieldLooseBase(this,Ri)[Ri]();babelHelpers.classPrivateFieldLooseBase(this,Gi)[Gi](b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_SETTINGS_HAVE_BEEN_SAVED"))})).catch((e=>{var s,i;babelHelpers.classPrivateFieldLooseBase(this,Vi)[Vi].onSaveError(e);console.warn("ui.accessrights.v2: error during save",e);if(babelHelpers.classPrivateFieldLooseBase(this,Ei)[Ei](e)){t(e);return}babelHelpers.classPrivateFieldLooseBase(this,Gi)[Gi]((e==null?void 0:(s=e.errors)==null?void 0:(i=s[0])==null?void 0:i.message)||"Something went wrong");t(e)})).finally((()=>{var t;const s=(t=babelHelpers.classPrivateFieldLooseBase(this,fi)[fi])==null?void 0:t.getContainer().querySelector(".ui-btn-wait");b.Dom.removeClass(s,"ui-btn-wait");babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].commit("application/setSaving",false);e()}))}))}draw(){const e=(new ei).transform(babelHelpers.classPrivateFieldLooseBase(this,mi)[mi]);const{store:t,resetState:s,userGroupsModel:i}=Bs(e,new ai(e.maxVisibleUserGroups).transform(babelHelpers.classPrivateFieldLooseBase(this,mi)[mi].userGroups),(new Ks).transform(babelHelpers.classPrivateFieldLooseBase(this,mi)[mi].accessRights),babelHelpers.classPrivateFieldLooseBase(this,yi)[yi]);babelHelpers.classPrivateFieldLooseBase(this,wi)[wi]=t;babelHelpers.classPrivateFieldLooseBase(this,Ri)[Ri]=s;babelHelpers.classPrivateFieldLooseBase(this,Hi)[Hi]=i;babelHelpers.classPrivateFieldLooseBase(this,Mi)[Mi]=babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].watch(((e,t)=>t["userGroups/isModified"]),(e=>{if(e){var t;(t=babelHelpers.classPrivateFieldLooseBase(this,fi)[fi])==null?void 0:t.show()}else{var s;(s=babelHelpers.classPrivateFieldLooseBase(this,fi)[fi])==null?void 0:s.hide()}}));babelHelpers.classPrivateFieldLooseBase(this,Ci)[Ci]=n.BitrixVue.createApp(Ze);babelHelpers.classPrivateFieldLooseBase(this,Ci)[Ci].use(babelHelpers.classPrivateFieldLooseBase(this,wi)[wi]);b.Dom.clean(babelHelpers.classPrivateFieldLooseBase(this,Si)[Si]);babelHelpers.classPrivateFieldLooseBase(this,Pi)[Pi]=babelHelpers.classPrivateFieldLooseBase(this,Ci)[Ci].mount(babelHelpers.classPrivateFieldLooseBase(this,Si)[Si]);babelHelpers.classPrivateFieldLooseBase(this,Vi)[Vi]=new ht(babelHelpers.classPrivateFieldLooseBase(this,wi)[wi],babelHelpers.classPrivateFieldLooseBase(this,mi)[mi].analytics)}destroy(){babelHelpers.classPrivateFieldLooseBase(this,Vi)[Vi]=null;babelHelpers.classPrivateFieldLooseBase(this,Ci)[Ci].unmount();babelHelpers.classPrivateFieldLooseBase(this,Ci)[Ci]=null;babelHelpers.classPrivateFieldLooseBase(this,_i)[_i]();babelHelpers.classPrivateFieldLooseBase(this,Mi)[Mi]();babelHelpers.classPrivateFieldLooseBase(this,Mi)[Mi]=null;babelHelpers.classPrivateFieldLooseBase(this,wi)[wi]=null;babelHelpers.classPrivateFieldLooseBase(this,Ri)[Ri]=null;babelHelpers.classPrivateFieldLooseBase(this,Hi)[Hi]=null;babelHelpers.classPrivateFieldLooseBase(this,mi)[mi]=null;babelHelpers.classPrivateFieldLooseBase(this,fi)[fi]=null;b.Dom.clean(babelHelpers.classPrivateFieldLooseBase(this,Si)[Si]);babelHelpers.classPrivateFieldLooseBase(this,Si)[Si]=null}hasUnsavedChanges(){return!(!babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].getters["userGroups/isModified"]||babelHelpers.classPrivateFieldLooseBase(this,Ii)[Ii])}scrollToSection(e){babelHelpers.classPrivateFieldLooseBase(this,Pi)[Pi].scrollToSection(e)}}function xi(){babelHelpers.classPrivateFieldLooseBase(this,Li)[Li]=e=>{var t,s;const[i]=e.getData();const o=((t=BX.SidePanel)==null?void 0:(s=t.Instance)==null?void 0:s.getSliderByWindow(window))===(i==null?void 0:i.getSlider());if(!o){return}babelHelpers.classPrivateFieldLooseBase(this,Ai)[Ai](i)};t.EventEmitter.subscribe("SidePanel.Slider:onClose",babelHelpers.classPrivateFieldLooseBase(this,Li)[Li])}function Oi(){t.EventEmitter.unsubscribe("SidePanel.Slider:onClose",babelHelpers.classPrivateFieldLooseBase(this,Li)[Li]);babelHelpers.classPrivateFieldLooseBase(this,Li)[Li]=null}function Ui(e){if(!b.Type.isArrayFilled(e==null?void 0:e.errors)){return false}for(const s of e.errors){var t;if(b.Type.isStringFilled(s==null?void 0:(t=s.customData)==null?void 0:t.sliderCode)){b.Runtime.loadExtension("ui.info-helper").then((({FeaturePromotersRegistry:e})=>{e.getPromoter({code:s.customData.sliderCode}).show()})).catch((e=>{console.error("ui.accessrights.v2: could not load ui.info-helper",e)}));return true}}return false}function $i(e){BX.UI.Notification.Center.notify({content:e,position:"top-right",autoHideDelay:3e3})}function ji(){const e=babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.userGroups.collection;let t=null;if(babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.options.isSaveOnlyChangedRights){t=(new xs).transform(e)}else{t=(new Ts).transform(e)}const s=babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.options.bodyType;return new Promise(((i,o)=>{b.ajax.runComponentAction(babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.options.component,babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.options.actionSave,{mode:babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.options.mode,[s]:{userGroups:t,deletedUserGroups:[...babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.userGroups.deleted.values()],parameters:babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.options.additionalSaveParams}}).then((t=>{const s=babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].state.application.options.maxVisibleUserGroups;const o=new ai(s).transform(t.data.USER_GROUPS);new gi(e,s).transform(o);i({userGroups:o})})).catch(o)}))}function ki(e){if(!babelHelpers.classPrivateFieldLooseBase(this,wi)[wi].getters["userGroups/isModified"]||babelHelpers.classPrivateFieldLooseBase(this,Ii)[Ii]){return}e.denyAction();const t=s.MessageBox.create({title:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_MODIFIED_CLOSE_WARNING_TITLE"),message:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_MODIFIED_CLOSE_WARNING"),modal:true,buttons:[new i.Button({color:i.ButtonColor.PRIMARY,size:i.ButtonSize.SMALL,text:b.Loc.getMessage("JS_UI_ACCESSRIGHTS_V2_MODIFIED_CLOSE_YES_CLOSE"),onclick:()=>{babelHelpers.classPrivateFieldLooseBase(this,Vi)[Vi].onCloseWithoutSave();babelHelpers.classPrivateFieldLooseBase(this,Ii)[Ii]=true;t.close();setTimeout((()=>{e.getSlider().close()}))}}),new i.CancelButton({size:i.ButtonSize.SMALL,onclick:()=>{t.close()}})]});t.show()}e.App=Ti})(this.BX.UI.AccessRights.V2=this.BX.UI.AccessRights.V2||{},BX.Event,BX.UI.Dialogs,BX.UI,BX.UI.Vue3.Components,BX.UI.EntitySelector,BX.Vue3,BX.Vue3.Directives,BX.UI.Vue3.Components,BX.Main,BX.UI,BX,BX.UI.Vue3.Components,BX,BX.UI.Analytics,BX.Vue3.Vuex,BX);
//# sourceMappingURL=v2.bundle.map.js