/* ContentContainer.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.default = void 0;
require("./ContentContainer.compiled.css");
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _reactMagneticDi = require("react-magnetic-di");
var _useAiSummaryAction = _interopRequireDefault(require("../../../state/hooks/use-ai-summary-action"));
var _aiPrism = _interopRequireDefault(require("../../common/ai-prism"));
var _HoverCardContent = require("./HoverCardContent");
var _excluded = ["children", "isAIEnabled", "testId", "url"],
  _excluded2 = ["children", "isAIEnabled", "testId", "url"];
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 NEW_CARD_WIDTH_REM = 25;
var HoverCardContainerStyle = null;
var popupContainerStyles = null;
var ConnectedAIPrismContainer = function ConnectedAIPrismContainer(_ref) {
  var children = _ref.children,
    _ref$isAIEnabled = _ref.isAIEnabled,
    isAIEnabled = _ref$isAIEnabled === void 0 ? false : _ref$isAIEnabled,
    testId = _ref.testId,
    url = _ref.url,
    props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var _useAISummaryAction = (0, _useAiSummaryAction.default)(url),
    status = _useAISummaryAction.state.status;
  var _useState = (0, _react.useState)(status === 'loading'),
    _useState2 = (0, _slicedToArray2.default)(_useState, 2),
    showPrism = _useState2[0],
    setShowPrism = _useState2[1];
  (0, _react.useEffect)(function () {
    setShowPrism(status === 'loading');
  }, [status]);
  var container = /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
    // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
    className: (0, _runtime.ax)(["_11q7glyw _189eidpf _vchhusvi _1bsby0ve _9spsglyw", !isAIEnabled && "_2rko1mok _bfhk1bhr _16qsie2t", _HoverCardContent.hoverCardClassName]),
    "data-testid": testId
  }, props, {
    style: {
      "--_1rzblqv": (0, _runtime.ix)("".concat(NEW_CARD_WIDTH_REM, "rem"))
    }
  }), children);
  return isAIEnabled ? /*#__PURE__*/React.createElement(_aiPrism.default, {
    isVisible: showPrism,
    testId: "".concat(testId, "-prism")
  }, container) : container;
};
var ContentContainer = function ContentContainer(_ref2) {
  var children = _ref2.children,
    _ref2$isAIEnabled = _ref2.isAIEnabled,
    isAIEnabled = _ref2$isAIEnabled === void 0 ? false : _ref2$isAIEnabled,
    testId = _ref2.testId,
    url = _ref2.url,
    props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
  return /*#__PURE__*/React.createElement(ConnectedAIPrismContainer, (0, _extends2.default)({
    isAIEnabled: isAIEnabled,
    url: url,
    testId: testId
  }, props), children);
};
var _default = exports.default = ContentContainer;