/* index.tsx generated by @compiled/babel-plugin v0.38.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("./index.compiled.css");
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _reactIntlNext = require("react-intl-next");
var _analyticsNext = require("@atlaskit/analytics-next");
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
var _linkExtractors = require("@atlaskit/link-extractors");
var _extractAccessContext = require("../../../../../extractors/common/context/extractAccessContext");
var _extractHostname = _interopRequireDefault(require("../../../../../extractors/common/hostname/extractHostname"));
var _messages = require("../../../../../messages");
var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
var _blocks = require("../../../../FlexibleCard/components/blocks");
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 titleBlockStyles = null;
var mainTextStyles = null;
var connectButtonStyles = null;
var basePreviewStyles = null;
var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
  var _cardState$details, _extractSmartLinkProv, _extractSmartLinkProv2, _extractRequestAccess;
  var flexibleCardProps = _ref.flexibleCardProps,
    _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
    createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
  var cardState = flexibleCardProps.cardState,
    url = flexibleCardProps.url;
  var meta = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.meta;
  var product = (_extractSmartLinkProv = (_extractSmartLinkProv2 = (0, _linkExtractors.extractSmartLinkProvider)(cardState.details)) === null || _extractSmartLinkProv2 === void 0 ? void 0 : _extractSmartLinkProv2.text) !== null && _extractSmartLinkProv !== void 0 ? _extractSmartLinkProv : '';
  var hostname = /*#__PURE__*/React.createElement("b", null, (0, _extractHostname.default)(url));
  var _ref2 = (_extractRequestAccess = (0, _extractAccessContext.extractRequestAccessContextImproved)({
      jsonLd: meta,
      url: url,
      product: product,
      createAnalyticsEvent: createAnalyticsEvent
    })) !== null && _extractRequestAccess !== void 0 ? _extractRequestAccess : {},
    action = _ref2.action,
    descriptiveMessageKey = _ref2.descriptiveMessageKey,
    titleMessageKey = _ref2.titleMessageKey,
    buttonDisabled = _ref2.buttonDisabled;
  if (!titleMessageKey || !descriptiveMessageKey) {
    return null;
  }
  return /*#__PURE__*/React.createElement(_FlexibleCard.default, (0, _extends2.default)({}, flexibleCardProps, {
    testId: testId
  }), /*#__PURE__*/React.createElement(_blocks.PreviewBlock, {
    ignoreContainerPadding: true,
    testId: testId,
    className: (0, _runtime.ax)(["_13li1mok _qrwq1mok _otyru2gc"])
  }), /*#__PURE__*/React.createElement(_blocks.CustomBlock, {
    testId: "".concat(testId, "-title"),
    className: (0, _runtime.ax)(["_1bah1h6o _k48p1pd9 _19pku2gc"])
  }, /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages[titleMessageKey], {
    values: {
      product: product
    }
  }))), /*#__PURE__*/React.createElement(_blocks.CustomBlock, {
    testId: "".concat(testId, "-content"),
    className: (0, _runtime.ax)(["_11c8rymc _1e0c1nu9 _1bah1h6o _19pkze3t _y3gn1h6o"])
  }, /*#__PURE__*/React.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages[descriptiveMessageKey], {
    values: {
      product: product,
      hostname: hostname
    }
  }))), action && /*#__PURE__*/React.createElement(_blocks.CustomBlock, {
    className: (0, _runtime.ax)(["_1bah1h6o _19pku2gc"])
  }, /*#__PURE__*/React.createElement(_new.default, {
    testId: "".concat(testId, "-button"),
    onClick: action === null || action === void 0 ? void 0 : action.promise,
    appearance: "primary",
    isDisabled: buttonDisabled
  }, action === null || action === void 0 ? void 0 : action.text)));
};
var _default = exports.default = HoverCardForbiddenView;