import _extends from "@babel/runtime/helpers/extends";
import React, { useEffect } from 'react';
import { di } from 'react-magnetic-di';
import { fg } from '@atlaskit/platform-feature-flags';
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
import useAISummaryAction from '../../../../../state/hooks/use-ai-summary-action';
import { AISummariseAction } from './ai-summarise-action';
import { CopySummaryAction, CopySummaryActionNew } from './copy-summary-action';
export var AISummaryActionComponent = function AISummaryActionComponent(props) {
  var url = props.url,
    onLoadingChange = props.onLoadingChange,
    _props$testId = props.testId,
    testId = _props$testId === void 0 ? 'smart-action-ai-summary-action' : _props$testId;
  var _useAISummaryAction = useAISummaryAction(url),
    _useAISummaryAction$s = _useAISummaryAction.state,
    status = _useAISummaryAction$s.status,
    content = _useAISummaryAction$s.content,
    summariseUrl = _useAISummaryAction.summariseUrl;
  useEffect(function () {
    onLoadingChange === null || onLoadingChange === void 0 || onLoadingChange(status === 'loading');
  }, [onLoadingChange, status]);
  return status === 'done' ? fg('platform_sl_3p_auth_rovo_action_kill_switch') || expValEqualsNoExposure('rovogrowth-640-inline-action-nudge-exp', 'isEnabled', true) ? /*#__PURE__*/React.createElement(CopySummaryActionNew, _extends({}, props, {
    summary: content,
    testId: testId
  })) : /*#__PURE__*/React.createElement(CopySummaryAction, _extends({}, props, {
    testId: testId,
    content: content
  })) : /*#__PURE__*/React.createElement(AISummariseAction, _extends({}, props, {
    testId: testId,
    summariseUrl: summariseUrl,
    status: status
  }));
};