import React, { useMemo } from 'react';
import { ResourcedMention } from '@atlaskit/mention';
import ProfileCardTrigger from '@atlaskit/profilecard/user';
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
export default function MentionWithProfileCard({
  autoFocus,
  id,
  text,
  accessLevel,
  mentionProvider,
  profilecardProvider,
  onClick,
  onMouseEnter,
  onMouseLeave,
  localId,
  ssrPlaceholderId
}) {
  const {
    cloudId,
    resourceClient
  } = profilecardProvider;
  const actions = useMemo(() => profilecardProvider.getActions(id, text, accessLevel), [accessLevel, id, profilecardProvider, text]);
  return /*#__PURE__*/React.createElement(ProfileCardTrigger, {
    autoFocus: autoFocus,
    cloudId: cloudId,
    userId: id,
    resourceClient: resourceClient,
    actions: actions,
    trigger: "click",
    position: "bottom-end",
    testId: "mention-with-profilecard-trigger"
    // Ignored via go/ees005
    // eslint-disable-next-line require-unicode-regexp
    ,
    ariaLabel: text.replace(/^@/, ''),
    ssrPlaceholderId: ssrPlaceholderId,
    isRenderedInPortal: expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true)
  }, /*#__PURE__*/React.createElement(ResourcedMention, {
    id: id,
    text: text,
    accessLevel: accessLevel,
    localId: localId,
    mentionProvider: mentionProvider,
    onClick: onClick,
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave,
    ssrPlaceholderId: ssrPlaceholderId
  }));
}