"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _core = require("@emotion/core");

var _reactRouter = require("react-router");

var _lodash = require("lodash");

var _propTypes = _interopRequireDefault(require("prop-types"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var CardLink = function CardLink(_ref) {
  var children = _ref.children,
      slug = _ref.slug;
  var isEmbedded = "".concat((0, _lodash.get)(window, "location.origin", ""), "/cards/").concat(slug, "/embed/") === (0, _lodash.get)(window, "location.href", "") || "".concat((0, _lodash.get)(window, "location.origin", ""), "/cards/").concat(slug, "/embed/visualization") === (0, _lodash.get)(window, "location.href", "");
  return (0, _core.jsx)("div", null, isEmbedded ? (0, _core.jsx)(_reactRouter.Link, {
    target: "_blank",
    to: "".concat((0, _lodash.get)(window, "location.origin"), "/cards/").concat(slug)
  }, (0, _core.jsx)("span", null, children)) : (0, _core.jsx)(_reactRouter.Link, {
    to: "".concat((0, _lodash.get)(window, "location.origin"), "/cards/").concat(slug)
  }, (0, _core.jsx)("span", null, children)));
};

CardLink.displayName = "CardLink";
CardLink.propTypes = {
  children: _propTypes["default"].node,
  slug: _propTypes["default"].string
};
var _default = CardLink;
exports["default"] = _default;