/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.RovoActionsCta = exports.InlineRovoActionButton = void 0;
require("./index.compiled.css");
var _runtime = require("@compiled/react/runtime");
var _react = _interopRequireWildcard(require("react"));
var _reactIntl = require("react-intl");
var _css = require("@atlaskit/css");
var _aiGenerativeTextSummary = _interopRequireDefault(require("@atlaskit/icon/core/ai-generative-text-summary"));
var _rovoChat = _interopRequireDefault(require("@atlaskit/icon/core/rovo-chat"));
var _compiled = require("@atlaskit/primitives/compiled");
var _useRovoChat2 = _interopRequireDefault(require("../../../../state/hooks/use-rovo-chat"));
var _rovoChatUtils = require("../../../common/rovo-chat-utils");
var _actionButton = require("../action-button");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var styles = {
  innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _19bv12x7 _u5f312x7",
  rovoIcon: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _ca0qv77o _n3tdv77o",
  text: "_1e0c1nu9 _19bv12x7"
};
var RovoActionsCta = exports.RovoActionsCta = function RovoActionsCta(_ref) {
  var testId = _ref.testId;
  return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
    xcss: (0, _css.cx)(styles.innerContainer, styles.rovoIcon),
    testId: testId
  }, /*#__PURE__*/_react.default.createElement(_rovoChat.default, {
    label: "Rovo",
    color: "var(--ds-icon-inverse, #FFFFFF)",
    size: "small"
  }));
};
var InlineRovoActionButton = exports.InlineRovoActionButton = function InlineRovoActionButton(_ref2) {
  var testId = _ref2.testId,
    url = _ref2.url;
  var _useRovoChat = (0, _useRovoChat2.default)(),
    sendPromptMessage = _useRovoChat.sendPromptMessage,
    isRovoChatEnabled = _useRovoChat.isRovoChatEnabled;
  var intl = (0, _reactIntl.useIntl)();

  // TODO: NAVX-5109 implement tailored rovo chat actions here
  var _ref3 = (0, _rovoChatUtils.getPromptAction)(_rovoChatUtils.RovoChatPromptKey.SUMMARIZE_LINK, intl, url) || {},
    promptData = _ref3.data,
    content = _ref3.content;
  var handleClick = (0, _react.useCallback)(function (event) {
    event.preventDefault();
    event.stopPropagation();
    if (isRovoChatEnabled && promptData) {
      sendPromptMessage(promptData);
    }
  }, [sendPromptMessage, isRovoChatEnabled, promptData]);
  return promptData && content ? /*#__PURE__*/_react.default.createElement(_actionButton.ActionButton, {
    onClick: handleClick,
    testId: testId
  }, /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
    label: "Rovo",
    color: "var(--ds-icon, #292A2E)",
    size: "small"
  }), /*#__PURE__*/_react.default.createElement(_compiled.Box, {
    xcss: styles.text
  }, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
    size: "small"
  }, content))) : null;
};