import _defineProperty from "@babel/runtime/helpers/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import { fg } from '@atlaskit/platform-feature-flags';
import { ActionName, InternalActionName } from '../../../constants';
import { extractAISummaryAction } from './extract-ai-summary-action';
import { extractAutomationAction } from './extract-automation-action';
import { extractCopyLinkClientAction } from './extract-copy-link-action';
import { extractDownloadClientAction } from './extract-download-action';
import extractFollowAction from './extract-follow-action';
import { extractPreviewClientAction } from './extract-preview-action';
import extractRovoChatAction from './extract-rovo-chat-action';
import { extractViewRelatedLinksAction } from './extract-view-related-links-action';
export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref) {
  var actionOptions = _ref.actionOptions,
    aiSummaryConfig = _ref.aiSummaryConfig,
    appearance = _ref.appearance,
    fireEvent = _ref.fireEvent,
    id = _ref.id,
    origin = _ref.origin,
    product = _ref.product,
    response = _ref.response,
    rovoConfig = _ref.rovoConfig,
    url = _ref.url,
    isPreviewPanelAvailable = _ref.isPreviewPanelAvailable,
    openPreviewPanel = _ref.openPreviewPanel;
  var action = _objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ActionName.CopyLinkAction, extractCopyLinkClientAction({
    actionOptions: actionOptions,
    appearance: appearance,
    id: id,
    response: response
  })), ActionName.DownloadAction, extractDownloadClientAction({
    actionOptions: actionOptions,
    appearance: appearance,
    id: id,
    response: response
  })), ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), ActionName.PreviewAction, extractPreviewClientAction({
    actionOptions: actionOptions,
    appearance: appearance,
    fireEvent: fireEvent,
    id: id,
    origin: origin,
    response: response,
    isPreviewPanelAvailable: isPreviewPanelAvailable,
    openPreviewPanel: openPreviewPanel
  })), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), fg('platform_sl_3p_auth_rovo_action_kill_switch') ? _defineProperty({}, InternalActionName.RovoChatAction, extractRovoChatAction({
    actionOptions: actionOptions,
    appearance: appearance,
    id: id,
    product: product,
    response: response,
    rovoConfig: rovoConfig
  })) : undefined), {}, _defineProperty({}, InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response)));
  return Object.values(action).some(function (value) {
    return Boolean(value);
  }) ? action : undefined;
};