import wn from '../../../../../node_modules/preact/compat/dist/compat.module.mjs';
import { ROLE_ID_STYTCH_MEMBER } from '../utils/roles.mjs';
import { useRoleSortFn } from '../utils/useRoleSortFn.mjs';
import { TagList } from './TagList.mjs';
import { useMemo as F } from '../../../../../node_modules/preact/hooks/dist/hooks.module.mjs';

const RolesList = ({ hideStytchMemberWithOtherRoles, roles })=>{
    const sortRows = useRoleSortFn();
    const roleObjects = F(()=>roles.map((role)=>typeof role === 'string' ? {
                role_id: role
            } : role), [
        roles
    ]);
    const sortedRoles = F(()=>sortRows(// When specified, only show `stytch_member` if it is the only role
        !hideStytchMemberWithOtherRoles || roleObjects.length === 1 ? roleObjects : roleObjects.filter((role)=>role.role_id !== ROLE_ID_STYTCH_MEMBER)).map((role)=>role.displayName), [
        hideStytchMemberWithOtherRoles,
        roleObjects,
        sortRows
    ]);
    return /*#__PURE__*/ wn.createElement(TagList, {
        tags: sortedRoles
    });
};

export { RolesList };
//# sourceMappingURL=RolesList.mjs.map
