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 from "react";
import SelectionLayer from "./SelectionLayer";
import { connectToEditor } from "../withEditorProps";
import classNames from "classnames";
export var CutsiteSelectionLayers = connectToEditor(function (_ref) {
  var hoveredAnnotation = _ref.hoveredAnnotation;
  return {
    hoveredAnnotation: hoveredAnnotation
  };
})(function CutsiteSelectionLayersInner(_ref2) {
  var hoveredAnnotation = _ref2.hoveredAnnotation,
    cutsites = _ref2.cutsites,
    annotationCommonProps = _ref2.annotationCommonProps,
    showReverseSequence = _ref2.showReverseSequence,
    sequenceHeight = _ref2.sequenceHeight,
    alignmentData = _ref2.alignmentData,
    row = _ref2.row;
  return Object.keys(cutsites).sort(function (a) {
    return cutsites[a].id === hoveredAnnotation ? 1 : -1;
  }).map(function (id, index) {
    var cutsite = cutsites[id];
    var isHovered = hoveredAnnotation === cutsite.id;
    var layer = cutsite.annotation.recognitionSiteRange;
    return layer.start > -1 && /*#__PURE__*/React.createElement(SelectionLayer, _extends({
      hideTitle: true
    }, annotationCommonProps, {
      id: cutsite.id,
      key: "restrictionSiteRange" + index,
      height: showReverseSequence ? sequenceHeight * 2 : sequenceHeight,
      regions: [layer],
      row: alignmentData ? {
        start: 0,
        end: alignmentData.sequence.length - 1
      } : row,
      className: classNames("cutsiteLabelSelectionLayer", {
        cutsiteLabelSelectionLayerHovered: isHovered
      }),
      hideCarets: true
    }));
  });
});