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 { MenuItem } from "@blueprintjs/core";
import React from "react";
import { InfoHelper } from "teselagen-react-components";
import useAAColorType from "../utils/useAAColorType";
import { LimitAnnotations } from "../utils/useAnnotationLimits";
import { chromatogramMenu } from "../utils/useChromatogramPrefs";
import useMeltingTemp from "../utils/useMeltingTemp";
export var translationsSubmenu = [{
  cmd: "toggleTranslations",
  text: "翻译",
  shouldDismissPopover: false
}, {
  cmd: "toggleCdsFeatureTranslations",
  text: "CDS Feature 翻译",
  shouldDismissPopover: false
}, {
  cmd: "toggleOrfTranslations",
  text: "ORF翻译",
  shouldDismissPopover: false
}, {
  cmd: "toggleAminoAcidNumbers_dna",
  text: "氨基酸数",
  shouldDismissPopover: false
}];
export var orfsSubmenu = [{
  cmd: "toggleOrfs",
  shouldDismissPopover: false
}, {
  cmd: "toggleOrfTranslations",
  text: "ORF翻译",
  shouldDismissPopover: false
}, {
  cmd: "useGtgAndCtgAsStartCodons",
  text: "用GTG和CTG作为起始密码子",
  shouldDismissPopover: false
}, {
  cmd: "minOrfSizeCmd",
  text: "最小ORF大小",
  shouldDismissPopover: false
}];
export var cutsitesSubmenu = [{
  cmd: "toggleCutsites",
  shouldDismissPopover: false
}];
export var featuresSubmenu = [{
  cmd: "toggleFeatures",
  text: "特征",
  shouldDismissPopover: false
}, "onConfigureFeatureTypesClick", {
  cmd: "featureTypesCmd",
  text: "按类型过滤",
  shouldDismissPopover: false
}, {
  cmd: "featureFilterIndividualCmd",
  text: "单独过滤",
  shouldDismissPopover: false
}, {
  cmd: "filterFeatureLengthsCmd",
  shouldDismissPopover: false
}];
export var partsSubmenu = function partsSubmenu(props) {
  return [{
    cmd: "toggleParts",
    shouldDismissPopover: false
  }, {
    cmd: "partFilterIndividualCmd",
    text: "单独过滤",
    shouldDismissPopover: false
  }].concat(props.allPartTags ? [{
    cmd: "filterPartsByTagCmd",
    text: "过滤",
    shouldDismissPopover: false
  }] : [], [{
    cmd: "filterPartLengthsCmd",
    shouldDismissPopover: false
  }]);
};
export var primersSubmenu = [{
  cmd: "togglePrimers",
  shouldDismissPopover: false
}, {
  cmd: "primerFilterIndividualCmd",
  shouldDismissPopover: false
}, {
  cmd: "filterPrimerLengthsCmd",
  shouldDismissPopover: false
}];
export var fullSequenceTranslationMenu = {
  text: "全序列翻译",
  cmd: "fullSequenceTranslations",
  submenu: [{
    shouldDismissPopover: false,
    cmd: "sequenceAA_allFrames",
    text: "所有框"
    // frameNumber: "all" // TODO ?
  }, {
    shouldDismissPopover: false,
    cmd: "sequenceAA_frame1",
    text: "框 1"
    // frameNumber: 1 // TODO ?
  }, {
    shouldDismissPopover: false,
    cmd: "sequenceAA_frame2",
    text: "框 2"
    // frameNumber: 2 // TODO ?
  }, {
    shouldDismissPopover: false,
    cmd: "sequenceAA_frame3",
    text: "框 3"
    // frameNumber: 3 // TODO ?
  }, {
    shouldDismissPopover: false,
    cmd: "sequenceAAReverse_allFrames",
    text: "所有反向框"
    // frameNumber: "all" // TODO ?
  }, {
    shouldDismissPopover: false,
    cmd: "sequenceAAReverse_frame1",
    text: "框 -1"
    // frameNumber: 1 // TODO ?
  }, {
    shouldDismissPopover: false,
    cmd: "sequenceAAReverse_frame2",
    text: "框 -2"
    // frameNumber: 2 // TODO ?
  }, {
    shouldDismissPopover: false,
    cmd: "sequenceAAReverse_frame3",
    text: "框 -3"
    // frameNumber: 3 // TODO ?
  }]
};

export default [
// { cmd: "mapCaret" },
{
  cmd: "showAll",
  text: "全部显示",
  shouldDismissPopover: false
}, {
  cmd: "hideAll",
  text: "全部隐藏",
  shouldDismissPopover: false
}, {
  cmd: "toggleChromatogram",
  shouldDismissPopover: false,
  submenu: [{
    cmd: "toggleChromatogram",
    shouldDismissPopover: false
  }, chromatogramMenu]
}, {
  cmd: "toggleWarnings",
  shouldDismissPopover: false
}, {
  cmd: "toggleAssemblyPieces",
  shouldDismissPopover: false
}, {
  cmd: "toggleLineageAnnotations",
  shouldDismissPopover: false
},
//deprecating
//{ cmd: "toggleFeatures", shouldDismissPopover: false },
{
  cmd: "toggleFeatures",
  text: 'Features',
  // onClick: () => {}, //commenting this out to allow top level clicking -- https://github.com/TeselaGen/openVectorEditor/issues/865)
  shouldDismissPopover: false,
  submenu: featuresSubmenu
}, {
  cmd: "toggleTranslations",
  text: '翻译',
  // onClick: () => {}, //commenting this out to allow top level clicking -- https://github.com/TeselaGen/openVectorEditor/issues/865)
  shouldDismissPopover: false,
  submenu: translationsSubmenu
}, {
  cmd: "togglePrimers",
  text: "引物",
  shouldDismissPopover: false
},
// {
//   // TODO preprocess this as needed
//   cmd: "featureTypes",
//   itemId: "featureTypes",
//   //submenu of checklist of all feature types here
//   submenu: [{ text: "TO DO...", disabled: true }]
// },
{
  cmd: "togglePartsWithSubmenu",
  // onClick: () => {}, //commenting this out to allow top level clicking -- https://github.com/TeselaGen/openVectorEditor/issues/865)
  shouldDismissPopover: false
}, {
  cmd: "toggleCutsites",
  text: "酶切点位",
  shouldDismissPopover: false
},
// TODO translations, cds feature translations?
{
  cmd: "toggleOrfs",
  text: "ORFS",
  // onClick: () => {}, //commenting this out to allow top level clicking -- https://github.com/TeselaGen/openVectorEditor/issues/865)
  shouldDismissPopover: false,
  submenu: orfsSubmenu
},
// { cmd: "complementary" },
// { cmd: "spaces" },
{
  divider: ""
}, {
  cmd: "toggleShowGCContent",
  text: "选择的GC含量百分比",
  shouldDismissPopover: false
}, {
  text: "选择的Tm",
  component: ToggleShowMeltingTemp
}, {
  divider: ""
}, fullSequenceTranslationMenu, {
  divider: ""
}, {
  cmd: "toggleAxis",
  text: "轴",
  shouldDismissPopover: false
}, {
  cmd: "toggleAxisNumbers",
  text: "轴数",
  shouldDismissPopover: false
}, {
  cmd: "toggleAminoAcidNumbers_protein",
  text: "氨基酸数",
  shouldDismissPopover: false
}, {
  text: "Amino Acid Colors (by Hydrophobicity/by Family)",
  component: function AAColorType(props) {
    var _useAAColorType = useAAColorType(),
      aaColorType = _useAAColorType[0],
      setAAColorType = _useAAColorType[1];
    return /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
      text: "\u6C28\u57FA\u9178\u989C\u8272",
      shouldDismissPopover: false
    }), /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
      text: /*#__PURE__*/React.createElement("div", {
        style: {
          display: "flex"
        }
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          marginRight: 10
        }
      }, "\u6309\u758F\u6C34\u6027\u7740\u8272"), /*#__PURE__*/React.createElement(InfoHelper, {
        content: /*#__PURE__*/React.createElement("div", {
          style: {
            color: "white"
          }
        }, /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "hsl(258.1, 100%, 69%)"
          }
        }, "\u66F4\u4EB2\u6C34 (4.5)"), /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "hsl(356.9, 100%, 69%)"
          }
        }, "\u66F4\u758F\u6C34 (-4.5)"))
      })),
      shouldDismissPopover: false,
      onClick: function onClick() {
        setAAColorType("byHydrophobicity");
      },
      icon: aaColorType === "byHydrophobicity" ? "small-tick" : "blank"
    })), /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
      text: /*#__PURE__*/React.createElement("div", {
        style: {
          display: "flex"
        }
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          marginRight: 10
        }
      }, "\u6309\u5BB6\u65CF\u7740\u8272"), /*#__PURE__*/React.createElement(InfoHelper, {
        content: /*#__PURE__*/React.createElement("div", {
          style: {
            color: "black"
          }
        }, /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "#FFC0CB"
          }
        }, "\u6B63: K, H, R"), /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "#EE82EE"
          }
        }, "\u9634\u6027: D, E"), /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "#D3D3D3"
          }
        }, "\u9170\u80FA\u7C7B: N, Q"), /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "#00FFFF"
          }
        }, "\u8102\u80AA\u65CF: A, G, L, I, P, V"), /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "#FFA500"
          }
        }, "\u82B3\u9999\u65CF: F, W, Y"), /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "#FFFF00"
          }
        }, "\u786B: C, M"), /*#__PURE__*/React.createElement("div", {
          style: {
            padding: 2,
            backgroundColor: "#90EE90"
          }
        }, "\u7F9F\u57FA: S, T"))
      })),
      shouldDismissPopover: false,
      onClick: function onClick() {
        setAAColorType("byFamily");
      },
      icon: aaColorType === "byFamily" ? "small-tick" : "blank"
    })));
  },
  shouldDismissPopover: false
}, {
  cmd: "toggleDnaColors",
  text: "DNA颜色",
  shouldDismissPopover: false
}, {
  text: "顺序",
  submenu: [{
    cmd: "toggleSequence",
    shouldDismissPopover: false
  }, {
    cmd: "toggleFivePrimeThreePrimeHints",
    text: "5'3'提示",
    shouldDismissPopover: false
  }, {
    cmd: "toggleReverseSequence",
    text: "倒序",
    shouldDismissPopover: false
  }, {
    text: "偏好",
    cmd: "sequenceCase",
    submenu: [{
      cmd: "toggleSequenceMapFontUpper",
      text: "大写",
      shouldDismissPopover: false
    }, {
      cmd: "toggleSequenceMapFontRaw",
      text: "没有偏好",
      shouldDismissPopover: false
    }, {
      cmd: "toggleSequenceMapFontLower",
      text: "小写",
      shouldDismissPopover: false
    }]
  }, {
    cmd: "setRowViewSequenceSpacing",
    text: "间距（在序列图中）",
    shouldDismissPopover: false
  }]
}, {
  divider: ""
}, {
  text: "限制",
  cmd: "limitsMenu",
  submenu: [{
    text: "最大Features显示数",
    component: LimitAnnotations,
    type: "features"
  }, {
    text: "最大Parts显示数",
    type: "parts",
    component: LimitAnnotations
  }, {
    text: "最大剪切位点显示数",
    component: LimitAnnotations,
    type: "cutsites"
  }, {
    text: "最大引物显示数",
    component: LimitAnnotations,
    type: "primers"
  }, {
    text: "最大警告显示数",
    component: LimitAnnotations,
    type: "warnings"
  }, {
    text: "最大组合片段数",
    component: LimitAnnotations,
    type: "assemblyPieces"
  }, {
    text: "最大谱系注释数",
    component: LimitAnnotations,
    type: "lineageAnnotations"
  }]
}, {
  text: "标签",
  submenu: [{
    divider: "外部标签:"
  }, {
    text: "全部显示",
    hiddenButSearchableText: "labels",
    cmd: "showAllLabels",
    shouldDismissPopover: false
  }, {
    text: "全部隐藏",
    hiddenButSearchableText: "labels",
    cmd: "hideAllLabels",
    shouldDismissPopover: false
  }, {
    text: "Features",
    hiddenButSearchableText: "labels",
    cmd: "toggleFeatureLabels",
    shouldDismissPopover: false
  }, {
    text: "Parts",
    hiddenButSearchableText: "labels",
    cmd: "togglePartLabels",
    shouldDismissPopover: false
  }, {
    text: "酶切点位",
    hiddenButSearchableText: "labels",
    cmd: "toggleCutsiteLabels",
    shouldDismissPopover: false
  }, {
    text: "Assembly Pieces",
    hiddenButSearchableText: "labels",
    cmd: "toggleAssemblyPieceLabels",
    shouldDismissPopover: false
  }, {
    text: "LineageAnnotations",
    hiddenButSearchableText: "labels",
    cmd: "toggleLineageAnnotationLabels",
    shouldDismissPopover: false
  }, {
    text: "Warnings",
    hiddenButSearchableText: "labels",
    cmd: "toggleWarningLabels",
    shouldDismissPopover: false
  }, {
    text: "引物",
    hiddenButSearchableText: "labels",
    cmd: "togglePrimerLabels",
    shouldDismissPopover: false
  }, {
    divider: ""
  }, {
    cmd: "adjustLabelLineIntensity",
    shouldDismissPopover: false,
    text: "标签引线"
  }, {
    cmd: "adjustLabelSize",
    shouldDismissPopover: false,
    text: "环形标签尺寸"
  }]
}];
function ToggleShowMeltingTemp(props) {
  var _useMeltingTemp = useMeltingTemp(),
    showMeltingTemp = _useMeltingTemp[0],
    setShowMeltingTemp = _useMeltingTemp[1];
  return /*#__PURE__*/React.createElement(MenuItem, _extends({}, props, {
    shouldDismissPopover: false,
    onClick: function onClick() {
      setShowMeltingTemp(!showMeltingTemp);
    },
    icon: showMeltingTemp ? "small-tick" : "blank"
  }));
}