"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

var _styles = require("@material-ui/core/styles");

var _Launch = _interopRequireDefault(require("@material-ui/icons/Launch"));

var _lodash = require("lodash");

var _markdownToJsx = _interopRequireDefault(require("markdown-to-jsx"));

var _Link = _interopRequireDefault(require("@material-ui/core/Link"));

var _jsxRuntime = require("react/jsx-runtime");

var useStyles = (0, _styles.makeStyles)(function (theme) {
  return {
    root: {
      fontSize: '0.8em',
      marginLeft: '0.3em'
    },
    link: {
      color: theme.palette.type === 'dark' ? '#1FA5FF' : theme.palette.primary
    }
  };
});

var Anchor = function Anchor(props) {
  var classes = useStyles();
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
    target: "_blank",
    rel: "noopener noreferrer nofollow"
  }, props), {}, {
    children: [props.children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Launch["default"], {
      className: classes.root
    })]
  })), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Link["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
    target: "_blank",
    rel: "noopener noreferrer nofollow"
  }, props), {}, {
    className: classes.link,
    children: [props.children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Launch["default"], {
      className: classes.link
    })]
  }));
};

var _default = function _default(props) {
  return props.children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_markdownToJsx["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, (0, _lodash.merge)({
    options: {
      overrides: {
        a: Anchor,
        Link: Anchor
      }
    }
  }, props)), {}, {
    children: props.children.replace(/\\/g, '\\\\').replace('\\*', '*')
  })) : null;
};

exports["default"] = _default;
//# sourceMappingURL=Markdown.cjs.map