import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["content", "tooltipMessage", "tooltipOnHide", "hideTooltipOnMouseDown", "hideTooltip"];
import React from 'react';
import { fg } from '@atlaskit/platform-feature-flags';
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
import Tooltip from '@atlaskit/tooltip';
import { ActionName } from '../../../../../../constants';
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
import ActionButton from './action-button';
var ActionStackItem = function ActionStackItem(_ref) {
  var _flexibleUiContext$ac;
  var content = _ref.content,
    tooltipMessage = _ref.tooltipMessage,
    tooltipOnHide = _ref.tooltipOnHide,
    hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown,
    hideTooltip = _ref.hideTooltip,
    props = _objectWithoutProperties(_ref, _excluded);
  var flexibleUiContext = useFlexibleUiContext();
  var isRovoAction = !!(flexibleUiContext !== null && flexibleUiContext !== void 0 && (_flexibleUiContext$ac = flexibleUiContext.actions) !== null && _flexibleUiContext$ac !== void 0 && _flexibleUiContext$ac[ActionName.RovoChatAction]);
  var isRovoPillVariant = isRovoAction && fg('rovogrowth-640-inline-action-nudge-fg') && expValEqualsNoExposure('rovogrowth-640-inline-action-nudge-exp', 'isEnabled', true);
  return hideTooltip ? /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
    content: content
  })) : /*#__PURE__*/React.createElement(Tooltip, {
    content: tooltipMessage || content,
    onHide: tooltipOnHide,
    hideTooltipOnMouseDown: hideTooltipOnMouseDown,
    position: isRovoPillVariant ? 'right' : undefined
  }, function (tooltipProps) {
    return /*#__PURE__*/React.createElement(ActionButton, _extends({}, props, {
      content: content,
      tooltipProps: tooltipProps
    }));
  });
};
export default ActionStackItem;