"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _Modal = _interopRequireDefault(require("@material-ui/core/Modal"));
var _styles = require("@material-ui/core/styles");
var _modalProps = _interopRequireWildcard(require("./modalProps"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var useStyles = (0, _styles.makeStyles)(function (theme) {
  return {
    modal: {
      display: "flex",
      alignItems: "center",
      justifyContent: "center"
    },
    baseContainer: {
      borderRadius: theme.spacing(0.8),
      display: "flex",
      flexDirection: "column",
      backgroundColor: theme.palette.primary.contrastText,
      "&:focus": {
        outline: "none"
      }
    },
    containerNormal: {
      width: theme.spacing(48)
    },
    containerWide: {
      width: theme.spacing(106.4),
      height: "calc(100% - 80px)",
      maxHeight: theme.spacing(73)
    },
    containerFullwidth: {
      width: "calc(100% - 80px)",
      height: "calc(100% - 80px)"
    },
    title: {
      height: theme.spacing(4),
      backgroundColor: theme.palette.grey.lighter,
      padding: theme.spacing(0, 2),
      borderRadius: theme.spacing(0.8, 0.8, 0, 0),
      borderBottom: "1px solid ".concat(theme.palette.grey.borders),
      display: "flex",
      alignItems: "center",
      fontSize: theme.typography.h3Size,
      textTransform: theme.typography.button.textTransform,
      fontFamily: theme.typography.button.fontFamily,
      fontWeight: theme.typography.button.fontWeight,
      flexShrink: 0
    },
    message: {
      minHeight: theme.spacing(10),
      backgroundColor: theme.palette.primary.contrastText,
      display: "flex",
      alignItems: "center",
      whiteSpace: "pre-wrap",
      padding: theme.spacing(2, 2),
      overflowY: "auto",
      fontSize: theme.typography.fontsize,
      fontFamily: theme.typography.fontFamily
    },
    messageWide: {
      minHeight: theme.spacing(10),
      backgroundColor: theme.palette.primary.contrastText,
      display: "flex",
      alignItems: "stretch",
      whiteSpace: "pre-wrap",
      padding: theme.spacing(2, 2),
      overflowY: "auto",
      flexGrow: 1,
      fontSize: theme.typography.fontsize,
      fontFamily: theme.typography.fontFamily
    },
    actionPanel: {
      padding: theme.spacing(1, 2),
      backgroundColor: theme.palette.grey.lighter,
      borderRadius: theme.spacing(0, 0, 0.8, 0.8),
      borderTop: "1px solid ".concat(theme.palette.grey.borders)
    }
  };
});
var Modal = function Modal(_ref) {
  var _modalProps$get, _modalProps$get2;
  var message = _ref.message,
    modalProps = _ref.modalProps;
  var classes = useStyles();
  if ((0, _modalProps.isModalProps)(modalProps) === false) {
    throw new TypeError("modalProps property is not of type ModalProps");
  }
  var open = (_modalProps$get = modalProps == null ? void 0 : modalProps.get(_modalProps.default.propNames.open)) != null ? _modalProps$get : false;
  var title = modalProps == null ? void 0 : modalProps.get(_modalProps.default.propNames.title);
  var actionPanel = modalProps == null ? void 0 : modalProps.get(_modalProps.default.propNames.actionPanel);
  var backdropClickCallback = modalProps == null ? void 0 : modalProps.get(_modalProps.default.propNames.backdropClickCallback);
  var modalType = (_modalProps$get2 = modalProps == null ? void 0 : modalProps.get(_modalProps.default.propNames.type)) != null ? _modalProps$get2 : "normal";
  var containerCls = (0, _classnames.default)(_defineProperty(_defineProperty(_defineProperty({}, classes.containerNormal, modalType === "normal"), classes.containerWide, modalType === "wide"), classes.containerFullwidth, modalType === "fullwidth"));
  var messageCls = (0, _classnames.default)(_defineProperty(_defineProperty({}, classes.message, modalType === "normal"), classes.messageWide, modalType === "wide" || modalType === "fullwidth"));
  var onCloseCallback = function onCloseCallback(e, reason) {
    if (backdropClickCallback && reason === "backdropClick") {
      backdropClickCallback(e);
    }
  };
  var model = /*#__PURE__*/_react.default.createElement(_Modal.default, {
    disablePortal: true,
    disableEnforceFocus: true,
    disableAutoFocus: true,
    open: open,
    className: classes.modal,
    onClose: onCloseCallback
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _classnames.default)(classes.baseContainer, containerCls)
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: classes.title
  }, title), /*#__PURE__*/_react.default.createElement("div", {
    className: messageCls
  }, message), /*#__PURE__*/_react.default.createElement("div", {
    className: classes.actionPanel
  }, actionPanel)));
  return model;
};
__signature__(Modal, "useStyles{classes}", function () {
  return [useStyles];
});
__signature__(Modal, "useStyles{classes}", function () {
  return [useStyles];
});
var _default = Modal;
var _default2 = _default;
var _default3 = exports.default = _default2;
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/MaterialUI/DataDisplay/Modal.js");
  reactHotLoader.register(Modal, "Modal", "/home/vsts/work/1/s/src/components/MaterialUI/DataDisplay/Modal.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/MaterialUI/DataDisplay/Modal.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/MaterialUI/DataDisplay/Modal.js");
  reactHotLoader.register(Modal, "Modal", "/home/vsts/work/1/s/src/components/MaterialUI/DataDisplay/Modal.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/MaterialUI/DataDisplay/Modal.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();