/* 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 _runtime = require("@compiled/react/runtime");
var _react = _interopRequireWildcard(require("react"));
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
var _link = _interopRequireDefault(require("@atlaskit/icon/core/migration/link"));
var _ExpandedFrame = require("../../components/ExpandedFrame");
var _ImageIcon = require("../../components/ImageIcon");
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 containerStyles = null;
var contentStyles = null;
var descriptionStyles = null;
var imageStyles = null;
var UnresolvedView = function UnresolvedView(_ref) {
  var button = _ref.button,
    description = _ref.description,
    frameStyle = _ref.frameStyle,
    iconUrlOrElement = _ref.icon,
    imageUrlOrElement = _ref.image,
    inheritDimensions = _ref.inheritDimensions,
    isSelected = _ref.isSelected,
    onClick = _ref.onClick,
    testId = _ref.testId,
    text = _ref.text,
    title = _ref.title,
    url = _ref.url;
  var icon = (0, _react.useMemo)(function () {
    if ( /*#__PURE__*/_react.default.isValidElement(iconUrlOrElement)) {
      return iconUrlOrElement;
    }
    return /*#__PURE__*/_react.default.createElement(_ImageIcon.ImageIcon, {
      src: typeof iconUrlOrElement === 'string' ? iconUrlOrElement : undefined,
      default: /*#__PURE__*/_react.default.createElement(_link.default, {
        label: "icon",
        LEGACY_size: "small",
        testId: "embed-card-fallback-icon",
        color: "currentColor"
      })
    });
  }, [iconUrlOrElement]);
  var image = (0, _react.useMemo)(function () {
    if (!imageUrlOrElement) {
      return null;
    }
    var imageTestId = "".concat(testId, "-unresolved-image");
    if (typeof imageUrlOrElement === 'string') {
      return /*#__PURE__*/_react.default.createElement("img", {
        "data-testid": imageTestId,
        src: imageUrlOrElement,
        alt: "",
        className: (0, _runtime.ax)(["_4t3i68cl _1bsbmgvx _5ral1f51 _rsufaqso"])
      });
    }
    return /*#__PURE__*/_react.default.createElement("div", {
      "data-testid": imageTestId,
      className: (0, _runtime.ax)(["_4t3i68cl _1bsbmgvx _5ral1f51 _rsufaqso"])
    }, imageUrlOrElement);
  }, [imageUrlOrElement, testId]);
  return /*#__PURE__*/_react.default.createElement(_ExpandedFrame.ExpandedFrame
  // Scroll bar must be shown for unresolved views to display the connect account button
  , {
    allowScrollBar: true,
    setOverflow: true
    // EDM-9259: Fix embed frame showing on unresolved views when frameStyle is set to hide.
    // Set fallback to 'show' here to maintain the current behaviour when platform.editor.show-embed-card-frame-renderer is OFF.
    // Remove 'show' on platform.editor.show-embed-card-frame-renderer cleanup as frameStyle will be set to 'show' both in renderer and editor.
    // We want all views to be consistent and respect frameStyle instead of
    // having resolved view default to showOnHover and unresolved view default to show.
    // Default frameStyle is set inside <ExpandedFrame />
    ,
    frameStyle: frameStyle !== null && frameStyle !== void 0 ? frameStyle : 'show',
    href: url,
    icon: icon,
    inheritDimensions: inheritDimensions,
    isSelected: isSelected,
    onClick: onClick,
    testId: testId,
    text: text
  }, /*#__PURE__*/_react.default.createElement("div", {
    "data-testid": "".concat(testId, "-unresolved-container"),
    className: (0, _runtime.ax)(["_1e0c11p5 _4t3i1kw7"])
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _runtime.ax)(["_19pk1wug _2hwx1wug _otyr1wug _18u01wug _zulpv47k _1e0c1txw _2lx21bp4 _1bah1h6o _y3gn1h6o _4cvr1h6o _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi _p12f1kdj"])
  }, image, /*#__PURE__*/_react.default.createElement(_heading.default, {
    size: "large",
    testId: "".concat(testId, "-unresolved-title")
  }, title), /*#__PURE__*/_react.default.createElement("span", {
    "data-testid": "".concat(testId, "-unresolved-description"),
    className: (0, _runtime.ax)(["_11c82smr _y3gn1h6o"])
  }, description), button)));
};
var _default = exports.default = UnresolvedView;