"use strict";

exports.__esModule = true;
exports.GlobalDialog = GlobalDialog;
var _react = _interopRequireWildcard(require("react"));
var _GlobalDialogUtils = require("./GlobalDialogUtils");
var _RenameSequenceDialog = _interopRequireDefault(require("./helperComponents/RenameSequenceDialog"));
var _PrintDialog = _interopRequireDefault(require("./helperComponents/PrintDialog"));
var _RemoveDuplicates = _interopRequireDefault(require("./helperComponents/RemoveDuplicates"));
var _MultipleSeqsDetectedOnImportDialog = require("./helperComponents/MultipleSeqsDetectedOnImportDialog");
var _GoToDialog = _interopRequireDefault(require("./helperComponents/GoToDialog"));
var _SelectDialog = _interopRequireDefault(require("./helperComponents/SelectDialog"));
var _EnzymesDialog = _interopRequireDefault(require("./helperComponents/EnzymesDialog"));
var _CreateCustomEnzyme = _interopRequireDefault(require("./CreateCustomEnzyme"));
var _AdditionalCutsiteInfoDialog = require("./CutsiteFilter/AdditionalCutsiteInfoDialog");
var _alignmentTool = require("./ToolBar/alignmentTool");
var _MergeFeaturesDialog = _interopRequireDefault(require("./helperComponents/MergeFeaturesDialog"));
var _AddOrEditPartDialog = _interopRequireDefault(require("./helperComponents/AddOrEditPartDialog"));
var _AddOrEditFeatureDialog = _interopRequireDefault(require("./helperComponents/AddOrEditFeatureDialog"));
var _AddOrEditPrimerDialog = _interopRequireDefault(require("./helperComponents/AddOrEditPrimerDialog"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var Dialogs = {
  RenameSequenceDialog: _RenameSequenceDialog["default"],
  PrintDialog: _PrintDialog["default"],
  MultipleSeqsDetectedOnImportDialog: _MultipleSeqsDetectedOnImportDialog.MultipleSeqsDetectedOnImportDialog,
  RemoveDuplicates: _RemoveDuplicates["default"],
  GoToDialog: _GoToDialog["default"],
  SelectDialog: _SelectDialog["default"],
  EnzymesDialog: _EnzymesDialog["default"],
  CreateCustomEnzyme: _CreateCustomEnzyme["default"],
  AdditionalCutsiteInfoDialog: _AdditionalCutsiteInfoDialog.AdditionalCutsiteInfoDialog,
  CompareEnzymeGroupsDialog: _AdditionalCutsiteInfoDialog.CompareEnzymeGroupsDialog,
  AlignmentToolDialog: _alignmentTool.AlignmentToolDialog,
  MergeFeaturesDialog: _MergeFeaturesDialog["default"],
  AddOrEditPartDialog: _AddOrEditPartDialog["default"],
  AddOrEditFeatureDialog: _AddOrEditFeatureDialog["default"],
  AddOrEditPrimerDialog: _AddOrEditPrimerDialog["default"]
};
function GlobalDialog(props) {
  var _props$dialogOverride = props.dialogOverrides,
    dialogOverrides = _props$dialogOverride === void 0 ? {} : _props$dialogOverride;
  var _useState = (0, _react.useState)(),
    uniqKey = _useState[0],
    setUniqKey = _useState[1];
  (0, _react.useEffect)(function () {
    //on unmount, clear the global dialog state..
    return function () {
      (0, _GlobalDialogUtils.hideDialog)();
    };
  }, []);
  _GlobalDialogUtils.dialogHolder.setUniqKey = setUniqKey;
  var Comp = _GlobalDialogUtils.dialogHolder.CustomModalComponent || dialogOverrides[_GlobalDialogUtils.dialogHolder.overrideName] || Dialogs[_GlobalDialogUtils.dialogHolder.dialogType];
  if (!Comp) return null;
  return /*#__PURE__*/_react["default"].createElement(Comp, _extends({
    key: uniqKey,
    hideDialog: _GlobalDialogUtils.hideDialog,
    hideModal: _GlobalDialogUtils.hideDialog
  }, props, _GlobalDialogUtils.dialogHolder.props));
}