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 { flatMap } from "lodash";
import { normalizePositionByRangeLength } from "@teselagen/range-utils";
export function addWrappedAddons(anns, seqLen) {
  return flatMap(anns, function (ann) {
    if (ann.overlapsSelf) {
      return [ann, _extends({}, ann, {
        start: normalizePositionByRangeLength(ann.end + 1, seqLen),
        end: normalizePositionByRangeLength(ann.start - 1, seqLen),
        isWrappedAddon: true,
        rangeTypeOverride: "middle" //we add this rangeTypeOverride here to get the wrapping piece to draw differently than normal
      })];
    }

    return [ann];
  });
}