'use strict';
import { isLoggedIn } from '../../../../fd-toolbox/auth/internal-login-states.js';
import { menuItemTypes, crudActions } from '../../../../fd-toolbox/enums/enums.js';
import { routes } from '../../../../fd-toolbox/routing/routes.js';
import { iconNames } from '../../../fd-component-toolbox/icon/Icon.js';
import { hasPermission, hasResourcePermission } from '../../../meta/auth/permissions/permission-checker.js';
import { permissionNames } from '../../../../fd-toolbox/constants/permission-names-constants.js';
import { metaQueryParams } from '../../../../fd-toolbox/constants/meta-query-params.js';
import { resourceNames } from '../../../../fd-toolbox/resources/resource-names.js';
import { elements } from '../../../../fd-toolbox/constants/elements.js';
import { userDropdownSuffixes } from '../../../../fd-toolbox/constants/element-suffixes.js';
import { getResourceViewUrl } from '../../../meta/services/meta-navigations.js';
import { resourceIds } from '../../../../fd-toolbox/constants/resource-id-constants.js';

var __defProp=Object['defineProperty'],__name=(_0x5ad2d5,_0x3bc026)=>__defProp(_0x5ad2d5,'name',{'value':_0x3bc026,'configurable':!![]});function createToolbarMenuSubgroups(_0x2b4df7,_0x1333ca){let _0x5b8463=[];return isLoggedIn()?(addSettings(_0x5b8463,_0x2b4df7),hasPermission(permissionNames['manageSubscriptions'])&&_0x5b8463['push']({'text':'Manage\x20subscriptions','path':routes['paymentPlans'],'type':menuItemTypes['redirectUrl'],'icon':iconNames['gear']}),hasResourcePermission(resourceIds['userWorkspaceInvite'],crudActions['create'])&&(_0x5b8463['push']({'text':'Invite\x20users','path':getResourceViewUrl(resourceNames['userWorkspaceInvite']),'type':menuItemTypes['redirectUrl'],'icon':iconNames['envelopeClosed']}),_0x5b8463['push']({'text':'User\x20roles','path':getResourceViewUrl(resourceNames['userRole']),'type':menuItemTypes['redirectUrl'],'icon':iconNames['person']})),_0x5b8463['push']({'id':elements['userDropdownMenu']['signOutButton'],'text':'Sign\x20out','path':'#','type':menuItemTypes['redirectUrl'],'icon':iconNames['exit'],'callback':_0x1333ca})):_0x5b8463['push']({'text':'Sign\x20in','path':routes['login'],'icon':iconNames['enter'],'type':menuItemTypes['redirectUrl']}),_0x5b8463;}__name(createToolbarMenuSubgroups,'createToolbarMenuSubgroups');function addSettings(_0x15e978,_0x3e6496){_0x15e978['push']({'id':userDropdownSuffixes['settings'],'text':userDropdownSuffixes['settings'],'type':menuItemTypes['redirectUrl'],'path':routes['view']+'?'+metaQueryParams['resource']+'='+resourceNames['userSetting']+'&'+metaQueryParams['id']+'='+_0x3e6496,'icon':iconNames['gear']});}__name(addSettings,'addSettings');

export { createToolbarMenuSubgroups };
