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); }
import React, { useState, useEffect } from "react";
import { dialogHolder, hideDialog } from "./GlobalDialogUtils";
import RenameSequenceDialog from "./helperComponents/RenameSequenceDialog";
import PrintDialog from "./helperComponents/PrintDialog";
import RemoveDuplicates from "./helperComponents/RemoveDuplicates";
import { MultipleSeqsDetectedOnImportDialog } from "./helperComponents/MultipleSeqsDetectedOnImportDialog";
import GoToDialog from "./helperComponents/GoToDialog";
import SelectDialog from "./helperComponents/SelectDialog";
import EnzymesDialog from "./helperComponents/EnzymesDialog";
import CreateCustomEnzyme from "./CreateCustomEnzyme";
import { AdditionalCutsiteInfoDialog, CompareEnzymeGroupsDialog } from "./CutsiteFilter/AdditionalCutsiteInfoDialog";
import { AlignmentToolDialog } from "./ToolBar/alignmentTool";
import MergeFeaturesDialog from "./helperComponents/MergeFeaturesDialog";
import AddOrEditPartDialog from "./helperComponents/AddOrEditPartDialog";
import AddOrEditFeatureDialog from "./helperComponents/AddOrEditFeatureDialog";
import AddOrEditPrimerDialog from "./helperComponents/AddOrEditPrimerDialog";
var Dialogs = {
  RenameSequenceDialog: RenameSequenceDialog,
  PrintDialog: PrintDialog,
  MultipleSeqsDetectedOnImportDialog: MultipleSeqsDetectedOnImportDialog,
  RemoveDuplicates: RemoveDuplicates,
  GoToDialog: GoToDialog,
  SelectDialog: SelectDialog,
  EnzymesDialog: EnzymesDialog,
  CreateCustomEnzyme: CreateCustomEnzyme,
  AdditionalCutsiteInfoDialog: AdditionalCutsiteInfoDialog,
  CompareEnzymeGroupsDialog: CompareEnzymeGroupsDialog,
  AlignmentToolDialog: AlignmentToolDialog,
  MergeFeaturesDialog: MergeFeaturesDialog,
  AddOrEditPartDialog: AddOrEditPartDialog,
  AddOrEditFeatureDialog: AddOrEditFeatureDialog,
  AddOrEditPrimerDialog: AddOrEditPrimerDialog
};
export function GlobalDialog(props) {
  var _props$dialogOverride = props.dialogOverrides,
    dialogOverrides = _props$dialogOverride === void 0 ? {} : _props$dialogOverride;
  var _useState = useState(),
    uniqKey = _useState[0],
    setUniqKey = _useState[1];
  useEffect(function () {
    //on unmount, clear the global dialog state..
    return function () {
      hideDialog();
    };
  }, []);
  dialogHolder.setUniqKey = setUniqKey;
  var Comp = dialogHolder.CustomModalComponent || dialogOverrides[dialogHolder.overrideName] || Dialogs[dialogHolder.dialogType];
  if (!Comp) return null;
  return /*#__PURE__*/React.createElement(Comp, _extends({
    key: uniqKey,
    hideDialog: hideDialog,
    hideModal: hideDialog
  }, props, dialogHolder.props));
}