/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import "./index.compiled.css";
import { ax, ix } from "@compiled/react/runtime";
import React, { useMemo } from 'react';
import Heading from '@atlaskit/heading';
import LinkGlyph from '@atlaskit/icon/core/link';
import { Text } from '@atlaskit/primitives/compiled';
import { ExpandedFrame } from '../../components/ExpandedFrame';
import { ImageIcon } from '../../components/ImageIcon';
const containerStyles = null;
const contentStyles = null;
const imageStyles = null;
const UnresolvedView = ({
  button,
  description,
  frameStyle,
  icon: iconUrlOrElement,
  image: imageUrlOrElement,
  inheritDimensions,
  isSelected,
  onClick,
  testId,
  text,
  title,
  url
}) => {
  const icon = useMemo(() => {
    if ( /*#__PURE__*/React.isValidElement(iconUrlOrElement)) {
      return iconUrlOrElement;
    }
    return /*#__PURE__*/React.createElement(ImageIcon, {
      src: typeof iconUrlOrElement === 'string' ? iconUrlOrElement : undefined,
      default: /*#__PURE__*/React.createElement(LinkGlyph, {
        label: "icon",
        testId: "embed-card-fallback-icon",
        color: "currentColor"
      })
    });
  }, [iconUrlOrElement]);
  const image = useMemo(() => {
    if (!imageUrlOrElement) {
      return null;
    }
    const imageTestId = `${testId}-unresolved-image`;
    if (typeof imageUrlOrElement === 'string') {
      return /*#__PURE__*/React.createElement("img", {
        "data-testid": imageTestId,
        src: imageUrlOrElement,
        alt: "",
        className: ax(["_4t3i68cl _1bsbmgvx _5ral1f51 _rsufaqso"])
      });
    }
    return /*#__PURE__*/React.createElement("div", {
      "data-testid": imageTestId,
      className: ax(["_4t3i68cl _1bsbmgvx _5ral1f51 _rsufaqso"])
    }, imageUrlOrElement);
  }, [imageUrlOrElement, testId]);
  return /*#__PURE__*/React.createElement(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.createElement("div", {
    "data-testid": `${testId}-unresolved-container`,
    className: ax(["_1e0c11p5 _4t3i1kw7"])
  }, /*#__PURE__*/React.createElement("div", {
    className: ax(["_19pk1wug _2hwx1wug _otyr1wug _18u01wug _zulpv47k _1e0c1txw _2lx21bp4 _1bah1h6o _y3gn1h6o _4cvr1h6o _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi _p12f1kdj"])
  }, image, /*#__PURE__*/React.createElement(Heading, {
    size: "large",
    testId: `${testId}-unresolved-title`
  }, title), /*#__PURE__*/React.createElement(Text, {
    align: "center",
    testId: `${testId}-unresolved-description`
  }, description), button)));
};
export default UnresolvedView;