@teselagen/ove 0.7.7 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.js CHANGED
@@ -144826,21 +144826,20 @@ ${seq.sequence}
144826
144826
  })(pluralize$1);
144827
144827
  var pluralizeExports = pluralize$1.exports;
144828
144828
  const pluralize = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
144829
- function Caret$2(props) {
144830
- const {
144831
- charWidth: charWidth2,
144832
- row,
144833
- sequenceLength,
144834
- caretPosition: caretPosition2,
144835
- isProtein: isProtein2,
144836
- onClick,
144837
- isDraggable,
144838
- leftMargin = 0,
144839
- onRightClick,
144840
- style: style2,
144841
- selectionMessage,
144842
- className = ""
144843
- } = props;
144829
+ function Caret$2({
144830
+ charWidth: charWidth2,
144831
+ row,
144832
+ sequenceLength,
144833
+ caretPosition: caretPosition2,
144834
+ isProtein: isProtein2,
144835
+ onClick,
144836
+ isDraggable,
144837
+ leftMargin = 0,
144838
+ onRightClick,
144839
+ style: style2,
144840
+ selectionMessage,
144841
+ className = ""
144842
+ }) {
144844
144843
  if (row.start <= caretPosition2 && row.end + 1 >= caretPosition2 || row.end === sequenceLength - 1 && row.end < caretPosition2) {
144845
144844
  const cursorEl = /* @__PURE__ */ React$2.createElement(
144846
144845
  "div",
@@ -148356,7 +148355,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
148356
148355
  hasYOffset: true
148357
148356
  }
148358
148357
  };
148359
- const estimateRowHeight = /* @__PURE__ */ __name((props) => {
148358
+ const _estimateRowHeight = /* @__PURE__ */ __name((props) => {
148360
148359
  let {
148361
148360
  index: index2,
148362
148361
  cache: cache2,
@@ -148414,7 +148413,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
148414
148413
  }
148415
148414
  cache2[index2] = totalHeight;
148416
148415
  return totalHeight;
148417
- }, "estimateRowHeight");
148416
+ }, "_estimateRowHeight");
148418
148417
  function getHeights(heightKey, props) {
148419
148418
  const annotationHeight = !heightKey ? 0 : props[heightKey + "Height"] || (rowHeights[heightKey] || {}).height || 0;
148420
148419
  const marginHeight = (props[heightKey + "MarginTop"] || (rowHeights[heightKey] || {}).marginTop || 0) + (props[heightKey + "MarginBottom"] || (rowHeights[heightKey] || {}).marginBottom || 0);
@@ -149695,7 +149694,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
149695
149694
  }
149696
149695
  __name(showFileDialog, "showFileDialog");
149697
149696
  const name = "@teselagen/ove";
149698
- const version = "0.7.6";
149697
+ const version = "0.7.7";
149699
149698
  const main = "./src/index.js";
149700
149699
  const type = "module";
149701
149700
  const exports$1 = {
@@ -166348,7 +166347,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
166348
166347
  //this function gives a fairly rough height estimate for the rows so that the ReactList can give a good guess of how much space to leave for scrolling and where to jump to in the sequence
166349
166348
  __publicField(this, "estimateRowHeight", /* @__PURE__ */ __name((index2, cache2) => {
166350
166349
  const { annotationVisibility: annotationVisibility2, annotationLabelVisibility: annotationLabelVisibility2, sequenceData: sequenceData2 } = this.props;
166351
- return estimateRowHeight({
166350
+ return _estimateRowHeight({
166352
166351
  index: index2,
166353
166352
  cache: cache2,
166354
166353
  chromatogramData: sequenceData2.chromatogramData,
@@ -170989,21 +170988,125 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
170989
170988
  e2
170990
170989
  );
170991
170990
  }
170992
- const _AlignmentView = class _AlignmentView extends React$2.Component {
170993
- constructor(props) {
170994
- super(props);
170995
- __publicField(this, "bindOutsideChangeHelper", {});
170996
- __publicField(this, "getMaxLength", /* @__PURE__ */ __name(() => {
170997
- const { alignmentTracks } = this.props;
170998
- const { sequenceData: sequenceData2 = { sequence: "" }, alignmentData } = alignmentTracks[0];
170999
- const data = alignmentData || sequenceData2;
171000
- return data.noSequence ? data.size : data.sequence.length;
171001
- }, "getMaxLength"));
171002
- __publicField(this, "handleAlignmentCopy", /* @__PURE__ */ __name((event) => {
170991
+ const AlignmentView = /* @__PURE__ */ __name((props) => {
170992
+ const {
170993
+ alignmentType,
170994
+ alignmentRunUpdate: alignmentRunUpdate2,
170995
+ alignmentName: _alignmentName,
170996
+ caretPosition: caretPosition2,
170997
+ handleAlignmentSave,
170998
+ id: id2,
170999
+ isFullyZoomedOut,
171000
+ scrollPercentageToJumpTo,
171001
+ selectionLayer: selectionLayer2,
171002
+ sequenceData: sequenceData2,
171003
+ sequenceLength,
171004
+ shouldAutosave,
171005
+ store: store2,
171006
+ height: height2,
171007
+ minimapLaneHeight,
171008
+ minimapLaneSpacing,
171009
+ isInPairwiseOverviewView,
171010
+ noVisibilityOptions,
171011
+ updateAlignmentSortOrder,
171012
+ alignmentSortOrder,
171013
+ handleBackButtonClicked,
171014
+ allowTrimming,
171015
+ additionalSelectionLayerRightClickedOptions,
171016
+ selectionLayerRightClicked,
171017
+ additionalTopEl,
171018
+ additionalTopLeftEl,
171019
+ handleAlignmentRename,
171020
+ stateTrackingId,
171021
+ style: style2,
171022
+ unmappedSeqs
171023
+ } = props;
171024
+ const _a2 = props, {
171025
+ alignmentId,
171026
+ alignmentTrackIndex,
171027
+ alignmentTracks = [],
171028
+ alignmentVisibilityToolOptions,
171029
+ allowTrackNameEdit,
171030
+ allowTrackRearrange,
171031
+ currentPairwiseAlignmentIndex,
171032
+ handleSelectTrack,
171033
+ hasTemplate,
171034
+ isPairwise,
171035
+ linearViewOptions,
171036
+ noClickDragHandlers,
171037
+ pairwiseAlignments,
171038
+ pairwiseOverviewAlignmentTracks,
171039
+ upsertAlignmentRun: upsertAlignmentRun2
171040
+ } = _a2, rest = __objRest(_a2, [
171041
+ "alignmentId",
171042
+ "alignmentTrackIndex",
171043
+ "alignmentTracks",
171044
+ "alignmentVisibilityToolOptions",
171045
+ "allowTrackNameEdit",
171046
+ "allowTrackRearrange",
171047
+ "currentPairwiseAlignmentIndex",
171048
+ "handleSelectTrack",
171049
+ "hasTemplate",
171050
+ "isPairwise",
171051
+ "linearViewOptions",
171052
+ "noClickDragHandlers",
171053
+ "pairwiseAlignments",
171054
+ "pairwiseOverviewAlignmentTracks",
171055
+ "upsertAlignmentRun"
171056
+ ]);
171057
+ const [width, setWidth] = reactExports.useState(0);
171058
+ const [nameDivWidth, setNameDivWidth] = reactExports.useState(140);
171059
+ const [charWidthInLinearView, _setCharWidthInLinearView] = reactExports.useState(
171060
+ charWidthInLinearViewDefault
171061
+ );
171062
+ const [alignmentName, setAlignmentName] = reactExports.useState(_alignmentName);
171063
+ const [isTrackDragging, setIsTrackDragging] = reactExports.useState(false);
171064
+ const [saveMessage, setSaveMessage] = reactExports.useState();
171065
+ const [saveMessageLoading, setSaveMessageLoading] = reactExports.useState(false);
171066
+ const [tempTrimBefore, setTempTrimBefore] = reactExports.useState({});
171067
+ const [tempTrimAfter, setTempTrimAfter] = reactExports.useState({});
171068
+ const [tempTrimmingCaret, setTempTrimmingCaret] = reactExports.useState({});
171069
+ const bindOutsideChangeHelper = reactExports.useRef({});
171070
+ const alignmentHolder = reactExports.useRef(null);
171071
+ const alignmentHolderTop = reactExports.useRef(null);
171072
+ const veTracksAndAlignmentHolder = reactExports.useRef(null);
171073
+ const InfiniteScroller = reactExports.useRef(null);
171074
+ const oldAlignmentHolderScrollTop = reactExports.useRef(0);
171075
+ const blockScroll = reactExports.useRef(false);
171076
+ const isZooming = reactExports.useRef(false);
171077
+ const rowData = reactExports.useRef({});
171078
+ const latestMouseY = reactExports.useRef();
171079
+ const easyStore2 = reactExports.useRef(
171080
+ store$1({
171081
+ selectionLayer: { start: -1, end: -1 },
171082
+ caretPosition: -1,
171083
+ percentScrolled: 0,
171084
+ viewportWidth: 400,
171085
+ verticalVisibleRange: { start: 0, end: 0 }
171086
+ })
171087
+ );
171088
+ const getAllAlignmentsFastaText = reactExports.useCallback(() => {
171089
+ const selectionLayer22 = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2].selectionLayer || {};
171090
+ const seqDataOfAllTracksToCopy = [];
171091
+ alignmentTracks.forEach((track2) => {
171092
+ const seqDataToCopy = getSequenceDataBetweenRange(
171093
+ track2.alignmentData,
171094
+ selectionLayer22
171095
+ ).sequence;
171096
+ seqDataOfAllTracksToCopy.push(
171097
+ `>${track2.alignmentData.name}\r
171098
+ ${seqDataToCopy}\r
171099
+ `
171100
+ );
171101
+ });
171102
+ return seqDataOfAllTracksToCopy.join("");
171103
+ }, [alignmentTracks, id2, store2]);
171104
+ reactExports.useEffect(() => {
171105
+ const handleAlignmentCopy = /* @__PURE__ */ __name((event) => {
171003
171106
  if (event.key === "c" && !event.shiftKey && (event.metaKey === true || event.ctrlKey === true)) {
171004
171107
  const input = document.createElement("textarea");
171005
171108
  document.body.appendChild(input);
171006
- const seqDataToCopy = this.getAllAlignmentsFastaText();
171109
+ const seqDataToCopy = getAllAlignmentsFastaText();
171007
171110
  input.value = seqDataToCopy;
171008
171111
  input.select();
171009
171112
  const copySuccess = document.execCommand("copy");
@@ -171015,1319 +171118,688 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
171015
171118
  document.body.removeChild(input);
171016
171119
  event.preventDefault();
171017
171120
  }
171018
- }, "handleAlignmentCopy"));
171019
- __publicField(this, "getAllAlignmentsFastaText", /* @__PURE__ */ __name(() => {
171020
- const selectionLayer2 = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id].selectionLayer || {};
171021
- const { alignmentTracks } = this.props;
171022
- const seqDataOfAllTracksToCopy = [];
171023
- alignmentTracks.forEach((track2) => {
171024
- const seqDataToCopy = getSequenceDataBetweenRange(
171025
- track2.alignmentData,
171026
- selectionLayer2
171027
- ).sequence;
171028
- seqDataOfAllTracksToCopy.push(
171029
- `>${track2.alignmentData.name}\r
171030
- ${seqDataToCopy}\r
171031
- `
171032
- );
171033
- });
171034
- return seqDataOfAllTracksToCopy.join("");
171035
- }, "getAllAlignmentsFastaText"));
171036
- __publicField(this, "state", {
171037
- alignmentName: this.props.alignmentName,
171038
- isTrackDragging: false,
171039
- charWidthInLinearView: charWidthInLinearViewDefault,
171040
- scrollAlignmentView: false,
171041
- width: 0,
171042
- nameDivWidth: 140
171043
- });
171044
- __publicField(this, "easyStore", store$1({
171045
- selectionLayer: { start: -1, end: -1 },
171046
- caretPosition: -1,
171047
- percentScrolled: 0,
171048
- viewportWidth: 400,
171049
- verticalVisibleRange: { start: 0, end: 0 }
171050
- }));
171051
- __publicField(this, "getMinCharWidth", /* @__PURE__ */ __name((noNameDiv) => {
171121
+ }, "handleAlignmentCopy");
171122
+ document.addEventListener("keydown", handleAlignmentCopy);
171123
+ return () => {
171124
+ document.removeEventListener("keydown", handleAlignmentCopy);
171125
+ };
171126
+ }, [getAllAlignmentsFastaText]);
171127
+ const scrollAlignmentToPercent = /* @__PURE__ */ __name((scrollPercentage) => {
171128
+ const scrollPercentageToUse = Math.min(Math.max(scrollPercentage, 0), 1);
171129
+ easyStore2.current.percentScrolled = scrollPercentageToUse;
171130
+ alignmentHolder.current.scrollLeft = scrollPercentageToUse * (alignmentHolder.current.scrollWidth - alignmentHolder.current.clientWidth);
171131
+ if (alignmentHolderTop.current) {
171132
+ alignmentHolderTop.current.scrollLeft = scrollPercentageToUse * (alignmentHolderTop.current.scrollWidth - alignmentHolderTop.current.clientWidth);
171133
+ }
171134
+ }, "scrollAlignmentToPercent");
171135
+ reactExports.useEffect(() => {
171136
+ window.scrollAlignmentToPercent = scrollAlignmentToPercent;
171137
+ if (window.Cypress)
171138
+ window.Cypress.scrollAlignmentToPercent = scrollAlignmentToPercent;
171139
+ return () => {
171140
+ delete window.scrollAlignmentToPercent;
171141
+ if (window.Cypress)
171142
+ delete window.Cypress.scrollAlignmentToPercent;
171143
+ };
171144
+ }, []);
171145
+ const maxLength = reactExports.useMemo(() => {
171146
+ const { sequenceData: sequenceData22 = { sequence: "" }, alignmentData } = alignmentTracks[0];
171147
+ const data = alignmentData || sequenceData22;
171148
+ return data.noSequence ? data.size : data.sequence.length;
171149
+ }, [alignmentTracks]);
171150
+ const getSequenceLength = reactExports.useCallback(() => {
171151
+ var _a3, _b2, _c2;
171152
+ return ((_c2 = (_b2 = (_a3 = alignmentTracks == null ? void 0 : alignmentTracks[0]) == null ? void 0 : _a3.alignmentData) == null ? void 0 : _b2.sequence) == null ? void 0 : _c2.length) || 1;
171153
+ }, [alignmentTracks]);
171154
+ const getMinCharWidth = reactExports.useCallback(
171155
+ (noNameDiv) => {
171052
171156
  const toReturn = Math.min(
171053
- Math.max(
171054
- this.state.width - (noNameDiv ? 0 : this.state.nameDivWidth) - 5,
171055
- 1
171056
- ) / this.getSequenceLength(),
171157
+ Math.max(width - (noNameDiv ? 0 : nameDivWidth) - 5, 1) / getSequenceLength(),
171057
171158
  10
171058
171159
  );
171059
171160
  if (isNaN(toReturn))
171060
171161
  return 10;
171061
171162
  return toReturn;
171062
- }, "getMinCharWidth"));
171063
- __publicField(this, "getSequenceLength", /* @__PURE__ */ __name(() => {
171064
- const { alignmentTracks: [template] = [] } = this.props;
171065
- return template.alignmentData.sequence.length || 1;
171066
- }, "getSequenceLength"));
171067
- __publicField(this, "annotationClicked", /* @__PURE__ */ __name(({
171068
- event,
171069
- annotation,
171070
- gapsBefore = 0,
171071
- gapsInside = 0
171072
- }) => {
171073
- event.preventDefault && event.preventDefault();
171074
- event.stopPropagation && event.stopPropagation();
171075
- this.updateSelectionOrCaret(event.shiftKey, __spreadProps(__spreadValues({}, annotation), {
171076
- start: annotation.start + gapsBefore,
171077
- end: annotation.end + gapsBefore + gapsInside
171078
- }));
171079
- }, "annotationClicked"));
171080
- __publicField(this, "updateSelectionOrCaret", /* @__PURE__ */ __name((shiftHeld, newRangeOrCaret, { forceReduxUpdate } = {}) => {
171081
- const sequenceLength = this.getSequenceLength();
171082
- updateSelectionOrCaret({
171083
- doNotWrapOrigin: true,
171084
- shiftHeld,
171085
- sequenceLength,
171086
- newRangeOrCaret,
171087
- caretPosition: this.easyStore.caretPosition,
171088
- selectionLayer: this.easyStore.selectionLayer,
171089
- selectionLayerUpdate: forceReduxUpdate ? this.forceReduxSelectionLayerUpdate : this.selectionLayerUpdate,
171090
- caretPositionUpdate: this.caretPositionUpdate
171091
- });
171092
- }, "updateSelectionOrCaret"));
171093
- __publicField(this, "caretPositionUpdate", /* @__PURE__ */ __name((position2) => {
171094
- const { caretPosition: caretPosition2 = -1, alignmentId } = this.props;
171095
- if (caretPosition2 === position2) {
171163
+ },
171164
+ [getSequenceLength, nameDivWidth, width]
171165
+ );
171166
+ const charWidth2 = reactExports.useMemo(() => {
171167
+ if (isFullyZoomedOut) {
171168
+ return getMinCharWidth();
171169
+ } else {
171170
+ return Math.max(getMinCharWidth(), charWidthInLinearView);
171171
+ }
171172
+ }, [charWidthInLinearView, getMinCharWidth, isFullyZoomedOut]);
171173
+ const debouncedAlignmentRunUpdate = debounce(alignmentRunUpdate2, 1e3);
171174
+ const caretPositionUpdate2 = reactExports.useCallback(
171175
+ (position2) => {
171176
+ if ((caretPosition2 || -1) === position2) {
171096
171177
  return;
171097
171178
  }
171098
- this.easyStore.caretPosition = position2;
171099
- this.easyStore.selectionLayer = { start: -1, end: -1 };
171100
- this.debouncedAlignmentRunUpdate({
171179
+ easyStore2.current.caretPosition = position2;
171180
+ easyStore2.current.selectionLayer = { start: -1, end: -1 };
171181
+ debouncedAlignmentRunUpdate({
171101
171182
  alignmentId,
171102
171183
  selectionLayer: { start: -1, end: -1 },
171103
171184
  caretPosition: position2
171104
171185
  });
171105
- }, "caretPositionUpdate"));
171106
- __publicField(this, "debouncedAlignmentRunUpdate", debounce(this.props.alignmentRunUpdate, 1e3));
171107
- __publicField(this, "forceReduxSelectionLayerUpdate", /* @__PURE__ */ __name((newSelection) => {
171108
- this.selectionLayerUpdate(newSelection, { forceReduxUpdate: true });
171109
- }, "forceReduxSelectionLayerUpdate"));
171110
- __publicField(this, "selectionLayerUpdate", /* @__PURE__ */ __name((newSelection, { forceReduxUpdate } = {}) => {
171111
- const { selectionLayer: selectionLayer2 = { start: -1, end: -1 }, alignmentId } = this.props;
171186
+ },
171187
+ [alignmentId, caretPosition2, debouncedAlignmentRunUpdate]
171188
+ );
171189
+ const selectionLayerUpdate2 = reactExports.useCallback(
171190
+ (newSelection, { forceReduxUpdate } = {}) => {
171191
+ const usableSelectionLayer = selectionLayer2 || { start: -1, end: -1 };
171112
171192
  if (!newSelection)
171113
171193
  return;
171114
171194
  const { start: start2, end: end2 } = newSelection;
171115
- if (selectionLayer2.start === start2 && selectionLayer2.end === end2) {
171195
+ if (usableSelectionLayer.start === start2 && usableSelectionLayer.end === end2) {
171116
171196
  return;
171117
171197
  }
171118
- this.easyStore.caretPosition = -1;
171119
- this.easyStore.selectionLayer = newSelection;
171120
- (forceReduxUpdate ? this.props.alignmentRunUpdate : this.debouncedAlignmentRunUpdate)({
171198
+ easyStore2.current.caretPosition = -1;
171199
+ easyStore2.current.selectionLayer = newSelection;
171200
+ (forceReduxUpdate ? alignmentRunUpdate2 : debouncedAlignmentRunUpdate)({
171121
171201
  alignmentId,
171122
171202
  selectionLayer: newSelection,
171123
171203
  caretPosition: -1
171124
171204
  });
171125
- }, "selectionLayerUpdate"));
171126
- __publicField(this, "getCharWidthInLinearView", /* @__PURE__ */ __name(() => {
171127
- if (this.props.isFullyZoomedOut) {
171128
- return this.getMinCharWidth();
171205
+ },
171206
+ [
171207
+ alignmentId,
171208
+ alignmentRunUpdate2,
171209
+ debouncedAlignmentRunUpdate,
171210
+ selectionLayer2
171211
+ ]
171212
+ );
171213
+ const updateSelectionOrCaret$1 = reactExports.useCallback(
171214
+ (shiftHeld, newRangeOrCaret, { forceReduxUpdate } = {}) => {
171215
+ const forceReduxSelectionLayerUpdate = /* @__PURE__ */ __name((newSelection) => {
171216
+ selectionLayerUpdate2(newSelection, { forceReduxUpdate: true });
171217
+ }, "forceReduxSelectionLayerUpdate");
171218
+ const sequenceLength2 = getSequenceLength();
171219
+ updateSelectionOrCaret({
171220
+ doNotWrapOrigin: true,
171221
+ shiftHeld,
171222
+ sequenceLength: sequenceLength2,
171223
+ newRangeOrCaret,
171224
+ caretPosition: easyStore2.current.caretPosition,
171225
+ selectionLayer: easyStore2.current.selectionLayer,
171226
+ selectionLayerUpdate: forceReduxUpdate ? forceReduxSelectionLayerUpdate : selectionLayerUpdate2,
171227
+ caretPositionUpdate: caretPositionUpdate2
171228
+ });
171229
+ },
171230
+ [caretPositionUpdate2, getSequenceLength, selectionLayerUpdate2]
171231
+ );
171232
+ const getNearestCursorPositionToMouseEvent2 = reactExports.useCallback(
171233
+ (_2, event, callback2) => {
171234
+ let nearestCaretPos = 0;
171235
+ const rowDomNode = veTracksAndAlignmentHolder.current;
171236
+ const boundingRowRect = rowDomNode.getBoundingClientRect();
171237
+ if (getClientX(event) - boundingRowRect.left - nameDivWidth < 0) {
171238
+ nearestCaretPos = 0;
171129
171239
  } else {
171130
- return Math.max(this.getMinCharWidth(), this.state.charWidthInLinearView);
171131
- }
171132
- }, "getCharWidthInLinearView"));
171133
- __publicField(this, "getNumBpsShownInLinearView", /* @__PURE__ */ __name(() => {
171134
- const toReturn = (this.state.width - this.state.nameDivWidth) / this.getCharWidthInLinearView();
171135
- return toReturn || 0;
171136
- }, "getNumBpsShownInLinearView"));
171137
- __publicField(this, "setVerticalScrollRange", throttle(() => {
171138
- if (this && this.InfiniteScroller && this.InfiniteScroller.getFractionalVisibleRange && this.easyStore) {
171139
- let [start2, end2] = this.InfiniteScroller.getFractionalVisibleRange();
171140
- if (this.props.hasTemplate) {
171141
- end2 = end2 + 1;
171142
- }
171143
- if (this.easyStore.verticalVisibleRange.start !== start2 || this.easyStore.verticalVisibleRange.end !== end2)
171144
- this.easyStore.verticalVisibleRange = { start: start2, end: end2 };
171145
- }
171146
- }, 100));
171147
- __publicField(this, "handleScroll", /* @__PURE__ */ __name(() => {
171148
- if (this.alignmentHolder.scrollTop !== this.oldAlignmentHolderScrollTop) {
171149
- setTimeout(() => {
171150
- this.setVerticalScrollRange();
171151
- this.oldAlignmentHolderScrollTop = this.alignmentHolder.scrollTop;
171152
- }, 100);
171240
+ const clickXPositionRelativeToRowContainer = getClientX(event) - boundingRowRect.left - nameDivWidth;
171241
+ const numberOfBPsInFromRowStart = Math.floor(
171242
+ (clickXPositionRelativeToRowContainer + charWidth2 / 2) / charWidth2
171243
+ );
171244
+ nearestCaretPos = numberOfBPsInFromRowStart + 0;
171245
+ if (nearestCaretPos > maxLength + 1) {
171246
+ nearestCaretPos = maxLength + 1;
171247
+ }
171153
171248
  }
171154
- if (this.blockScroll) {
171155
- return;
171249
+ if (sequenceData2 == null ? void 0 : sequenceData2.isProtein) {
171250
+ nearestCaretPos = Math.round(nearestCaretPos / 3) * 3;
171156
171251
  }
171157
- const scrollPercentage = this.alignmentHolder.scrollLeft / (this.alignmentHolder.scrollWidth - this.alignmentHolder.clientWidth);
171158
- this.easyStore.percentScrolled = scrollPercentage || 0;
171159
- if (!this.isZooming) {
171160
- this.easyStore.percentScrolledPreZoom = this.easyStore.percentScrolled;
171252
+ if (sequenceLength === 0)
171253
+ nearestCaretPos = 0;
171254
+ const callbackVals = {
171255
+ updateSelectionOrCaret: updateSelectionOrCaret$1,
171256
+ nearestCaretPos,
171257
+ sequenceLength: getSequenceLength(),
171258
+ caretPosition: easyStore2.current.caretPosition,
171259
+ selectionLayer: easyStore2.current.selectionLayer,
171260
+ easyStore: easyStore2.current,
171261
+ caretPositionUpdate: caretPositionUpdate2,
171262
+ selectionLayerUpdate: selectionLayerUpdate2,
171263
+ event,
171264
+ doNotWrapOrigin: true,
171265
+ shiftHeld: event.shiftKey,
171266
+ // caretGrabbed: event.target.className === "cursor",
171267
+ selectionStartGrabbed: event.target.classList.contains(
171268
+ draggableClassnames.selectionStart
171269
+ ),
171270
+ selectionEndGrabbed: event.target.classList.contains(
171271
+ draggableClassnames.selectionEnd
171272
+ )
171273
+ };
171274
+ callback2(callbackVals);
171275
+ },
171276
+ [
171277
+ caretPositionUpdate2,
171278
+ charWidth2,
171279
+ getSequenceLength,
171280
+ maxLength,
171281
+ nameDivWidth,
171282
+ selectionLayerUpdate2,
171283
+ sequenceData2 == null ? void 0 : sequenceData2.isProtein,
171284
+ sequenceLength,
171285
+ updateSelectionOrCaret$1
171286
+ ]
171287
+ );
171288
+ reactExports.useEffect(() => {
171289
+ const updateAlignmentSelection = /* @__PURE__ */ __name((newRangeOrCaret) => {
171290
+ updateSelectionOrCaret$1(false, newRangeOrCaret, {
171291
+ forceReduxUpdate: true
171292
+ });
171293
+ }, "updateAlignmentSelection");
171294
+ window.updateAlignmentSelection = updateAlignmentSelection;
171295
+ if (window.Cypress)
171296
+ window.Cypress.updateAlignmentSelection = updateAlignmentSelection;
171297
+ return () => {
171298
+ delete window.updateAlignmentSelection;
171299
+ if (window.Cypress) {
171300
+ delete window.Cypress.updateAlignmentSelection;
171161
171301
  }
171162
- if (this.alignmentHolderTop) {
171163
- this.alignmentHolderTop.scrollLeft = this.alignmentHolder.scrollLeft;
171302
+ };
171303
+ }, [updateSelectionOrCaret$1]);
171304
+ const setVerticalScrollRange = throttle(() => {
171305
+ if (InfiniteScroller.current && InfiniteScroller.current.getFractionalVisibleRange && easyStore2.current) {
171306
+ let [start2, end2] = InfiniteScroller.current.getFractionalVisibleRange();
171307
+ if (hasTemplate) {
171308
+ end2 = end2 + 1;
171164
171309
  }
171310
+ if (easyStore2.current.verticalVisibleRange.start !== start2 || easyStore2.current.verticalVisibleRange.end !== end2)
171311
+ easyStore2.current.verticalVisibleRange = { start: start2, end: end2 };
171312
+ }
171313
+ }, 100);
171314
+ reactExports.useEffect(() => {
171315
+ setTimeout(() => {
171165
171316
  updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
171166
- }, "handleScroll"));
171167
- __publicField(this, "handleTopScroll", /* @__PURE__ */ __name(() => {
171168
- this.alignmentHolder.scrollLeft = this.alignmentHolderTop.scrollLeft;
171169
- }, "handleTopScroll"));
171170
- /**
171171
- * Responsible for handling resizing the highlighted region of the minimap
171172
- * @param {*} newSliderSize
171173
- * @param {*} newPercent
171174
- */
171175
- __publicField(this, "onMinimapSizeAdjust", /* @__PURE__ */ __name((newSliderSize, newPercent) => {
171176
- const percentageOfSpace = newSliderSize / this.state.width;
171177
- const seqLength = this.getSequenceLength();
171178
- const numBpsInView = seqLength * percentageOfSpace;
171179
- const newCharWidth = (this.state.width - this.state.nameDivWidth) / numBpsInView;
171180
- this.blockScroll = true;
171181
- this.setCharWidthInLinearView({ charWidthInLinearView: newCharWidth });
171182
- setTimeout(() => {
171183
- this.scrollAlignmentToPercent(newPercent);
171184
- this.blockScroll = false;
171185
- updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
171186
- });
171187
- }, "onMinimapSizeAdjust"));
171188
- __publicField(this, "setCharWidthInLinearView", /* @__PURE__ */ __name(({ charWidthInLinearView }) => {
171189
- window.localStorage.setItem(
171190
- "charWidthInLinearViewDefault",
171191
- charWidthInLinearView
171192
- );
171193
- this.setState({ charWidthInLinearView });
171194
- charWidthInLinearViewDefault = JSON.parse(
171195
- window.localStorage.getItem("charWidthInLinearViewDefault")
171196
- );
171197
- }, "setCharWidthInLinearView"));
171198
- __publicField(this, "scrollToCaret", /* @__PURE__ */ __name(() => {
171199
- let el2 = window.document.querySelector(".veCaret:not(.zoomSelection)");
171200
- if (!el2) {
171201
- el2 = window.document.querySelector(".veCaret");
171202
- }
171203
- if (!el2) {
171204
- return;
171205
- }
171206
- el2.scrollIntoView({ inline: "center", block: "nearest" });
171207
- }, "scrollToCaret"));
171208
- __publicField(this, "scrollAlignmentToPercent", /* @__PURE__ */ __name((scrollPercentage) => {
171209
- const scrollPercentageToUse = Math.min(Math.max(scrollPercentage, 0), 1);
171210
- this.easyStore.percentScrolled = scrollPercentageToUse;
171211
- this.alignmentHolder.scrollLeft = scrollPercentageToUse * (this.alignmentHolder.scrollWidth - this.alignmentHolder.clientWidth);
171212
- if (this.alignmentHolderTop) {
171213
- this.alignmentHolderTop.scrollLeft = scrollPercentageToUse * (this.alignmentHolderTop.scrollWidth - this.alignmentHolderTop.clientWidth);
171214
- }
171215
- }, "scrollAlignmentToPercent"));
171216
- __publicField(this, "scrollYToTrack", /* @__PURE__ */ __name((trackIndex) => {
171217
- this.InfiniteScroller.scrollTo(trackIndex);
171218
- }, "scrollYToTrack"));
171219
- __publicField(this, "estimateRowHeight", /* @__PURE__ */ __name((index2, cache2) => {
171220
- const { alignmentVisibilityToolOptions, alignmentTracks } = this.props;
171221
- const track2 = alignmentTracks[index2];
171222
- if (!track2)
171223
- return 100;
171224
- const { sequenceData: sequenceData2 } = track2;
171225
- this.rowData = prepareRowData(sequenceData2, sequenceData2.sequence.length);
171226
- return estimateRowHeight({
171227
- index: index2,
171228
- cache: cache2,
171229
- // clearCache: this.clearCache,
171230
- row: this.rowData[index2],
171231
- annotationVisibility: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
171232
- annotationLabelVisibility: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility
171233
- });
171234
- }, "estimateRowHeight"));
171235
- __publicField(this, "getMaxLinearViewWidth", /* @__PURE__ */ __name(() => {
171236
- let maxWidth = 0;
171237
- const charWidthInLinearView = this.getCharWidthInLinearView();
171238
- forEach$4(this.props.alignmentTracks, (t2) => {
171239
- const w2 = (t2.alignmentData || t2.sequenceData).sequence.length;
171240
- if (w2 > maxWidth)
171241
- maxWidth = w2;
171242
- });
171243
- return maxWidth * charWidthInLinearView;
171244
- }, "getMaxLinearViewWidth"));
171245
- __publicField(this, "renderItem", /* @__PURE__ */ __name((_i, key2, isTemplate, cloneProps) => {
171246
- const charWidthInLinearView = this.getCharWidthInLinearView();
171247
- const _a2 = this.props, {
171248
- alignmentTrackIndex,
171249
- pairwiseAlignments,
171250
- currentPairwiseAlignmentIndex,
171251
- pairwiseOverviewAlignmentTracks,
171252
- alignmentTracks = [],
171253
- upsertAlignmentRun: upsertAlignmentRun2,
171254
- alignmentId,
171255
- noClickDragHandlers,
171256
- handleSelectTrack,
171257
- allowTrackRearrange,
171258
- isPairwise,
171259
- linearViewOptions,
171260
- alignmentVisibilityToolOptions,
171261
- hasTemplate,
171262
- allowTrackNameEdit
171263
- } = _a2, rest = __objRest(_a2, [
171264
- "alignmentTrackIndex",
171265
- "pairwiseAlignments",
171266
- "currentPairwiseAlignmentIndex",
171267
- "pairwiseOverviewAlignmentTracks",
171268
- "alignmentTracks",
171269
- "upsertAlignmentRun",
171270
- "alignmentId",
171271
- "noClickDragHandlers",
171272
- "handleSelectTrack",
171273
- "allowTrackRearrange",
171274
- "isPairwise",
171275
- "linearViewOptions",
171276
- "alignmentVisibilityToolOptions",
171277
- "hasTemplate",
171278
- "allowTrackNameEdit"
171279
- ]);
171280
- const isDragDisabled = !allowTrackRearrange || isPairwise;
171281
- let i2;
171282
- if (isTemplate) {
171283
- i2 = _i;
171284
- } else if (hasTemplate) {
171285
- i2 = _i + 1;
171286
- } else {
171287
- i2 = _i;
171317
+ }, 0);
171318
+ setTimeout(() => {
171319
+ setVerticalScrollRange();
171320
+ }, 500);
171321
+ });
171322
+ reactExports.useEffect(() => {
171323
+ if (scrollPercentageToJumpTo !== void 0) {
171324
+ scrollAlignmentToPercent(scrollPercentageToJumpTo);
171325
+ }
171326
+ }, [scrollPercentageToJumpTo]);
171327
+ reactExports.useEffect(() => {
171328
+ const saveAlignment = /* @__PURE__ */ __name(() => __async(this, null, function* () {
171329
+ if (shouldAutosave && stateTrackingId) {
171330
+ setSaveMessage("Alignment Saving..");
171331
+ setSaveMessageLoading(true);
171332
+ let cleanedTracks;
171333
+ if (pairwiseAlignments) {
171334
+ cleanedTracks = pairwiseAlignments.map(cleanTracks);
171335
+ } else {
171336
+ cleanedTracks = cleanTracks(alignmentTracks);
171337
+ }
171338
+ yield handleAlignmentSave(cleanedTracks);
171339
+ setSaveMessage("Alignment Saved");
171340
+ setSaveMessageLoading(false);
171341
+ setTimeout(() => {
171342
+ setSaveMessage(void 0);
171343
+ setSaveMessageLoading(false);
171344
+ }, 5e3);
171288
171345
  }
171289
- const track2 = alignmentTracks[i2];
171290
- if (!track2)
171291
- return null;
171292
- const {
171293
- sequenceData: sequenceData2,
171294
- alignmentData,
171295
- isReversed,
171296
- wasTrimmed,
171297
- additionalSelectionLayers,
171298
- chromatogramData
171299
- // mismatches
171300
- } = track2;
171301
- const seqLen = this.getMaxLength();
171302
- const trimmedRangesToDisplay = getTrimmedRangesToDisplay({
171303
- seqLen,
171304
- trimmedRange: alignmentData == null ? void 0 : alignmentData.trimmedRange
171305
- });
171306
- const linearViewWidth = (alignmentData || sequenceData2).sequence.length * charWidthInLinearView;
171307
- const name2 = sequenceData2.name || sequenceData2.id;
171308
- const tickSpacing = massageTickSpacing(
171309
- Math.ceil(120 / charWidthInLinearView)
171310
- );
171311
- const { compactNames } = alignmentVisibilityToolOptions.alignmentAnnotationVisibility;
171312
- const selectionLayer2 = [
171313
- this.state[`tempTrimBefore${i2}`] || trimmedRangesToDisplay[0],
171314
- this.state[`tempTrimAfter${i2}`] || trimmedRangesToDisplay[1]
171315
- ].filter((i22) => i22).map((i22) => __spreadProps(__spreadValues({}, i22), {
171316
- hideCarets: true,
171317
- ignoreGaps: true,
171318
- className: "tg-trimmed-region",
171319
- color: "gray"
171320
- }));
171321
- const innerRenderItem = /* @__PURE__ */ __name((provided = {}, snapshot) => {
171322
- var _a3;
171323
- return /* @__PURE__ */ React$2.createElement(
171346
+ }), "saveAlignment");
171347
+ saveAlignment();
171348
+ }, [
171349
+ alignmentTracks,
171350
+ handleAlignmentSave,
171351
+ pairwiseAlignments,
171352
+ shouldAutosave,
171353
+ stateTrackingId
171354
+ ]);
171355
+ const annotationClicked = /* @__PURE__ */ __name(({
171356
+ event,
171357
+ annotation,
171358
+ gapsBefore = 0,
171359
+ gapsInside = 0
171360
+ }) => {
171361
+ event.preventDefault && event.preventDefault();
171362
+ event.stopPropagation && event.stopPropagation();
171363
+ updateSelectionOrCaret$1(event.shiftKey, __spreadProps(__spreadValues({}, annotation), {
171364
+ start: annotation.start + gapsBefore,
171365
+ end: annotation.end + gapsBefore + gapsInside
171366
+ }));
171367
+ }, "annotationClicked");
171368
+ const getNumBpsShownInLinearView = /* @__PURE__ */ __name(() => {
171369
+ const toReturn = (width - nameDivWidth) / charWidth2;
171370
+ return toReturn || 0;
171371
+ }, "getNumBpsShownInLinearView");
171372
+ const handleScroll = /* @__PURE__ */ __name(() => {
171373
+ if (alignmentHolder.current.scrollTop !== oldAlignmentHolderScrollTop.current) {
171374
+ setTimeout(() => {
171375
+ setVerticalScrollRange();
171376
+ oldAlignmentHolderScrollTop.current = alignmentHolder.current.scrollTop;
171377
+ }, 100);
171378
+ }
171379
+ if (blockScroll.current) {
171380
+ return;
171381
+ }
171382
+ const scrollPercentage = alignmentHolder.current.scrollLeft / (alignmentHolder.current.scrollWidth - alignmentHolder.current.clientWidth);
171383
+ easyStore2.current.percentScrolled = scrollPercentage || 0;
171384
+ if (!isZooming.current) {
171385
+ easyStore2.current.percentScrolledPreZoom = easyStore2.current.percentScrolled;
171386
+ }
171387
+ if (alignmentHolderTop.current) {
171388
+ alignmentHolderTop.current.scrollLeft = alignmentHolder.current.scrollLeft;
171389
+ }
171390
+ updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
171391
+ }, "handleScroll");
171392
+ const handleTopScroll = /* @__PURE__ */ __name(() => {
171393
+ alignmentHolder.current.scrollLeft = alignmentHolderTop.current.scrollLeft;
171394
+ }, "handleTopScroll");
171395
+ const onMinimapSizeAdjust = /* @__PURE__ */ __name((newSliderSize, newPercent) => {
171396
+ const percentageOfSpace = newSliderSize / width;
171397
+ const seqLength = getSequenceLength();
171398
+ const numBpsInView = seqLength * percentageOfSpace;
171399
+ const newCharWidth = (width - nameDivWidth) / numBpsInView;
171400
+ blockScroll.current = true;
171401
+ setCharWidthInLinearView({ charWidthInLinearView: newCharWidth });
171402
+ setTimeout(() => {
171403
+ scrollAlignmentToPercent(newPercent);
171404
+ blockScroll.current = false;
171405
+ updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
171406
+ });
171407
+ }, "onMinimapSizeAdjust");
171408
+ const setCharWidthInLinearView = /* @__PURE__ */ __name(({ charWidthInLinearView: charWidthInLinearView2 }) => {
171409
+ window.localStorage.setItem(
171410
+ "charWidthInLinearViewDefault",
171411
+ charWidthInLinearView2
171412
+ );
171413
+ _setCharWidthInLinearView(charWidthInLinearView2);
171414
+ charWidthInLinearViewDefault = JSON.parse(
171415
+ window.localStorage.getItem("charWidthInLinearViewDefault")
171416
+ );
171417
+ }, "setCharWidthInLinearView");
171418
+ const scrollToCaret2 = /* @__PURE__ */ __name(() => {
171419
+ let el2 = window.document.querySelector(".veCaret:not(.zoomSelection)");
171420
+ if (!el2) {
171421
+ el2 = window.document.querySelector(".veCaret");
171422
+ }
171423
+ if (!el2) {
171424
+ return;
171425
+ }
171426
+ el2.scrollIntoView({ inline: "center", block: "nearest" });
171427
+ }, "scrollToCaret");
171428
+ const scrollYToTrack = /* @__PURE__ */ __name((trackIndex) => {
171429
+ InfiniteScroller.current.scrollTo(trackIndex);
171430
+ }, "scrollYToTrack");
171431
+ const estimateRowHeight = /* @__PURE__ */ __name((index2, cache2) => {
171432
+ const track2 = alignmentTracks[index2];
171433
+ if (!track2)
171434
+ return 100;
171435
+ const { sequenceData: sequenceData22 } = track2;
171436
+ rowData.current = prepareRowData(
171437
+ sequenceData22,
171438
+ sequenceData22.sequence.length
171439
+ );
171440
+ return _estimateRowHeight({
171441
+ index: index2,
171442
+ cache: cache2,
171443
+ row: rowData.current[index2],
171444
+ annotationVisibility: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
171445
+ annotationLabelVisibility: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility
171446
+ });
171447
+ }, "estimateRowHeight");
171448
+ const renderItem = /* @__PURE__ */ __name((_i, key2, isTemplate, cloneProps) => {
171449
+ const isDragDisabled = !allowTrackRearrange || isPairwise;
171450
+ let i2;
171451
+ if (isTemplate) {
171452
+ i2 = _i;
171453
+ } else if (hasTemplate) {
171454
+ i2 = _i + 1;
171455
+ } else {
171456
+ i2 = _i;
171457
+ }
171458
+ const track2 = alignmentTracks == null ? void 0 : alignmentTracks[i2];
171459
+ if (!track2)
171460
+ return null;
171461
+ const {
171462
+ sequenceData: sequenceData22,
171463
+ alignmentData,
171464
+ isReversed,
171465
+ wasTrimmed,
171466
+ additionalSelectionLayers,
171467
+ chromatogramData
171468
+ // mismatches
171469
+ } = track2;
171470
+ const seqLen = maxLength;
171471
+ const trimmedRangesToDisplay = getTrimmedRangesToDisplay({
171472
+ seqLen,
171473
+ trimmedRange: alignmentData == null ? void 0 : alignmentData.trimmedRange
171474
+ });
171475
+ const linearViewWidth = (alignmentData || sequenceData22).sequence.length * charWidth2;
171476
+ const name2 = sequenceData22.name || sequenceData22.id;
171477
+ const tickSpacing = massageTickSpacing(Math.ceil(120 / charWidth2));
171478
+ const { compactNames } = alignmentVisibilityToolOptions.alignmentAnnotationVisibility;
171479
+ const selectionLayer22 = [
171480
+ tempTrimBefore[i2] || trimmedRangesToDisplay[0],
171481
+ tempTrimAfter[i2] || trimmedRangesToDisplay[1]
171482
+ ].filter((i22) => i22).map((i22) => __spreadProps(__spreadValues({}, i22), {
171483
+ hideCarets: true,
171484
+ ignoreGaps: true,
171485
+ className: "tg-trimmed-region",
171486
+ color: "gray"
171487
+ }));
171488
+ const innerRenderItem = /* @__PURE__ */ __name((provided = {}, snapshot) => {
171489
+ var _a3;
171490
+ return /* @__PURE__ */ React$2.createElement(
171491
+ "div",
171492
+ __spreadProps(__spreadValues({
171493
+ ref: provided == null ? void 0 : provided.innerRef
171494
+ }, provided == null ? void 0 : provided.draggableProps), {
171495
+ className: classNames$1("alignmentViewTrackContainer", {
171496
+ isDragDisabled
171497
+ }),
171498
+ "data-alignment-track-index": i2,
171499
+ style: __spreadValues(__spreadValues({
171500
+ boxShadow: isTemplate ? "red 0px -1px 0px 0px inset, red 0px 1px 0px 0px inset" : "0px -1px 0px 0px inset",
171501
+ display: "flex"
171502
+ }, (_a3 = provided == null ? void 0 : provided.draggableProps) == null ? void 0 : _a3.style), (snapshot == null ? void 0 : snapshot.isDragging) && { left: unset }),
171503
+ key: i2
171504
+ }),
171505
+ /* @__PURE__ */ React$2.createElement(
171324
171506
  "div",
171325
- __spreadProps(__spreadValues({
171326
- ref: provided == null ? void 0 : provided.innerRef
171327
- }, provided == null ? void 0 : provided.draggableProps), {
171328
- className: classNames$1("alignmentViewTrackContainer", {
171329
- isDragDisabled
171330
- }),
171331
- "data-alignment-track-index": i2,
171332
- style: __spreadValues(__spreadValues({
171333
- boxShadow: isTemplate ? "red 0px -1px 0px 0px inset, red 0px 1px 0px 0px inset" : "0px -1px 0px 0px inset",
171334
- display: "flex"
171335
- }, (_a3 = provided == null ? void 0 : provided.draggableProps) == null ? void 0 : _a3.style), (snapshot == null ? void 0 : snapshot.isDragging) && { left: unset }),
171507
+ {
171508
+ className: "alignmentTrackName",
171509
+ style: {
171510
+ position: "sticky",
171511
+ left: 0,
171512
+ zIndex: 10,
171513
+ borderBottom: `1px solid ${isTemplate ? "red" : "lightgray"}`,
171514
+ borderRight: `1px solid ${isTemplate ? "red" : "lightgray"}`,
171515
+ width: nameDivWidth - 3,
171516
+ padding: 2,
171517
+ marginRight: 3,
171518
+ paddingBottom: 0,
171519
+ minWidth: nameDivWidth - 3,
171520
+ overflow: "hidden",
171521
+ scrollbarWidth: "none",
171522
+ whiteSpace: "nowrap"
171523
+ },
171524
+ "data-title": name2,
171336
171525
  key: i2
171337
- }),
171526
+ },
171338
171527
  /* @__PURE__ */ React$2.createElement(
171339
171528
  "div",
171340
- {
171341
- className: "alignmentTrackName",
171342
- style: {
171343
- position: "sticky",
171344
- left: 0,
171345
- zIndex: 10,
171346
- borderBottom: `1px solid ${isTemplate ? "red" : "lightgray"}`,
171347
- borderRight: `1px solid ${isTemplate ? "red" : "lightgray"}`,
171348
- width: this.state.nameDivWidth - 3,
171349
- padding: 2,
171350
- marginRight: 3,
171351
- paddingBottom: 0,
171352
- minWidth: this.state.nameDivWidth - 3,
171353
- overflow: "hidden",
171354
- scrollbarWidth: "none",
171355
- whiteSpace: "nowrap"
171356
- },
171357
- "data-title": name2,
171358
- key: i2
171359
- },
171529
+ __spreadProps(__spreadValues({}, provided == null ? void 0 : provided.dragHandleProps), {
171530
+ style: __spreadProps(__spreadValues({}, compactNames && {
171531
+ display: "flex",
171532
+ alignItems: "flex-start"
171533
+ }), {
171534
+ cursor: !isPairwise && allowTrackRearrange && !isTemplate ? "move" : ""
171535
+ })
171536
+ }),
171360
171537
  /* @__PURE__ */ React$2.createElement(
171361
171538
  "div",
171362
- __spreadProps(__spreadValues({}, provided == null ? void 0 : provided.dragHandleProps), {
171363
- style: __spreadProps(__spreadValues({}, compactNames && {
171364
- display: "flex",
171365
- alignItems: "flex-start"
171366
- }), {
171367
- cursor: !isPairwise && allowTrackRearrange && !isTemplate ? "move" : ""
171539
+ {
171540
+ className: "alignmentTrackNameDiv",
171541
+ style: __spreadValues({
171542
+ background: "#3FA6DA",
171543
+ display: "inline-block",
171544
+ color: "white",
171545
+ borderRadius: 5,
171546
+ paddingRight: 5
171547
+ }, compactNames && {
171548
+ marginRight: 5
171368
171549
  })
171369
- }),
171370
- /* @__PURE__ */ React$2.createElement(
171371
- "div",
171550
+ },
171551
+ allowTrackNameEdit && /* @__PURE__ */ React$2.createElement(
171552
+ Button,
171372
171553
  {
171373
- className: "alignmentTrackNameDiv",
171374
- style: __spreadValues({
171375
- background: "#3FA6DA",
171376
- display: "inline-block",
171377
- color: "white",
171378
- borderRadius: 5,
171379
- paddingRight: 5
171380
- }, compactNames && {
171381
- marginRight: 5
171382
- })
171383
- },
171384
- allowTrackNameEdit && /* @__PURE__ */ React$2.createElement(
171385
- Button,
171386
- {
171387
- onClick: () => {
171388
- showDialog({
171389
- ModalComponent: EditTrackNameDialog,
171390
- props: {
171391
- initialValues: {
171392
- name: name2
171393
- },
171394
- updateName: ({ newName }) => {
171395
- updateTrackHelper({
171396
- currentPairwiseAlignmentIndex,
171397
- pairwiseAlignments,
171398
- upsertAlignmentRun: upsertAlignmentRun2,
171399
- alignmentId,
171400
- alignmentTracks,
171401
- alignmentTrackIndex: i2,
171402
- update: { name: newName }
171403
- });
171404
- }
171554
+ onClick: () => {
171555
+ showDialog({
171556
+ ModalComponent: EditTrackNameDialog,
171557
+ props: {
171558
+ initialValues: {
171559
+ name: name2
171560
+ },
171561
+ updateName: ({ newName }) => {
171562
+ updateTrackHelper({
171563
+ currentPairwiseAlignmentIndex,
171564
+ pairwiseAlignments,
171565
+ upsertAlignmentRun: upsertAlignmentRun2,
171566
+ alignmentId,
171567
+ alignmentTracks: alignmentTracks || [],
171568
+ alignmentTrackIndex: i2,
171569
+ update: { name: newName }
171570
+ });
171405
171571
  }
171406
- });
171407
- },
171408
- small: true,
171409
- "data-tip": "Edit Track Name",
171410
- className: "edit-track-name-btn",
171411
- icon: /* @__PURE__ */ React$2.createElement(Icon, { size: 12, color: "lightgrey", icon: "edit" }),
171412
- minimal: true
171413
- }
171414
- ),
171415
- sequenceData2.seqLink && /* @__PURE__ */ React$2.createElement(
171416
- AnchorButton,
171417
- {
171418
- href: sequenceData2.seqLink,
171419
- "data-tip": sequenceData2.seqLinkTooltip,
171420
- target: "_blank",
171421
- small: true,
171422
- icon: /* @__PURE__ */ React$2.createElement(Icon, { size: 12, color: "white", icon: "document-open" }),
171423
- minimal: true
171424
- }
171425
- ),
171426
- name2
171427
- ),
171428
- /* @__PURE__ */ React$2.createElement("div", { style: { fontSize: 10, marginTop: 2, marginBottom: 2 } }, isReversed && /* @__PURE__ */ React$2.createElement(
171429
- "span",
171430
- {
171431
- style: {
171432
- backgroundColor: isReversed ? "#E76A6E" : "#4C90F0",
171433
- padding: 2,
171434
- paddingLeft: 4,
171435
- color: "white",
171436
- marginRight: 2,
171437
- borderRadius: "5px"
171572
+ }
171573
+ });
171438
171574
  },
171439
- "data-tip": isReversed ? "The alignment algorithm matched the reverse complement of this input sequence" : "The original sequence was NOT reversed complemented by the alignment algorithm"
171440
- },
171441
- isReversed ? "REV" : "FWD",
171442
- " "
171443
- ), wasTrimmed && /* @__PURE__ */ React$2.createElement(
171444
- "span",
171575
+ small: true,
171576
+ "data-tip": "Edit Track Name",
171577
+ className: "edit-track-name-btn",
171578
+ icon: /* @__PURE__ */ React$2.createElement(Icon, { size: 12, color: "lightgrey", icon: "edit" }),
171579
+ minimal: true
171580
+ }
171581
+ ),
171582
+ sequenceData22.seqLink && /* @__PURE__ */ React$2.createElement(
171583
+ AnchorButton,
171445
171584
  {
171446
- style: {
171447
- backgroundColor: "#13C9BA",
171448
- padding: 2,
171449
- paddingLeft: 4,
171450
- color: "white",
171451
- marginRight: 2,
171452
- borderRadius: "5px"
171453
- },
171454
- "data-tip": "This sequence was trimmed and resubmitted for alignment"
171455
- },
171456
- "TRIMMED"
171457
- ), sequenceData2.sequence.length, " bps")
171585
+ href: sequenceData22.seqLink,
171586
+ "data-tip": sequenceData22.seqLinkTooltip,
171587
+ target: "_blank",
171588
+ small: true,
171589
+ icon: /* @__PURE__ */ React$2.createElement(Icon, { size: 12, color: "white", icon: "document-open" }),
171590
+ minimal: true
171591
+ }
171592
+ ),
171593
+ name2
171458
171594
  ),
171459
- /* @__PURE__ */ React$2.createElement(
171460
- HorizontalPanelDragHandle,
171595
+ /* @__PURE__ */ React$2.createElement("div", { style: { fontSize: 10, marginTop: 2, marginBottom: 2 } }, isReversed && /* @__PURE__ */ React$2.createElement(
171596
+ "span",
171461
171597
  {
171462
- onDrag: ({ dx }) => {
171463
- this.setState({
171464
- nameDivWidth: Math.min(
171465
- this.state.nameDivWidth - dx,
171466
- this.state.width - 20
171467
- )
171468
- });
171469
- }
171470
- }
171471
- )
171472
- ),
171473
- handleSelectTrack && !isTemplate && /* @__PURE__ */ React$2.createElement(
171474
- "div",
171475
- {
171476
- onClick: () => {
171477
- handleSelectTrack(i2);
171598
+ style: {
171599
+ backgroundColor: isReversed ? "#E76A6E" : "#4C90F0",
171600
+ padding: 2,
171601
+ paddingLeft: 4,
171602
+ color: "white",
171603
+ marginRight: 2,
171604
+ borderRadius: "5px"
171605
+ },
171606
+ "data-tip": isReversed ? "The alignment algorithm matched the reverse complement of this input sequence" : "The original sequence was NOT reversed complemented by the alignment algorithm"
171478
171607
  },
171479
- style: {
171480
- position: "absolute",
171481
- opacity: 0,
171482
- height: "100%",
171483
- left: this.state.nameDivWidth,
171484
- width: linearViewWidth,
171485
- fontWeight: "bolder",
171486
- cursor: "pointer",
171487
- padding: 5,
171488
- textAlign: "center",
171489
- zIndex: 400
171608
+ isReversed ? "REV" : "FWD",
171609
+ " "
171610
+ ), wasTrimmed && /* @__PURE__ */ React$2.createElement(
171611
+ "span",
171612
+ {
171613
+ style: {
171614
+ backgroundColor: "#13C9BA",
171615
+ padding: 2,
171616
+ paddingLeft: 4,
171617
+ color: "white",
171618
+ marginRight: 2,
171619
+ borderRadius: "5px"
171620
+ },
171621
+ "data-tip": "This sequence was trimmed and resubmitted for alignment"
171490
171622
  },
171491
- className: "alignmentViewSelectTrackPopover veWhiteBackground"
171492
- },
171493
- "Inspect track"
171623
+ "TRIMMED"
171624
+ ), sequenceData22.sequence.length, " bps")
171494
171625
  ),
171495
171626
  /* @__PURE__ */ React$2.createElement(
171496
- NonReduxEnhancedLinearView,
171497
- __spreadValues({}, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
171498
- caretPosition: this.state[`tempTrimmingCaret${i2}`] || -1,
171499
- selectionLayer: selectionLayer2,
171500
- isInAlignment: true,
171501
- // : { start: -1, end: -1 },
171502
- annotationVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
171503
- linearViewAnnotationLabelVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility,
171504
- marginWith: 0,
171505
- orfClicked: this.annotationClicked,
171506
- primerClicked: this.annotationClicked,
171507
- translationClicked: this.annotationClicked,
171508
- cutsiteClicked: this.annotationClicked,
171509
- translationDoubleClicked: this.annotationClicked,
171510
- deletionLayerClicked: this.annotationClicked,
171511
- replacementLayerClicked: this.annotationClicked,
171512
- featureClicked: this.annotationClicked,
171513
- partClicked: this.annotationClicked,
171514
- searchLayerClicked: this.annotationClicked,
171515
- editorDragStarted: noop$7,
171516
- //override these since we're defining the handlers above
171517
- editorDragStopped: noop$7,
171518
- //override these since we're defining the handlers above
171519
- editorDragged: noop$7,
171520
- //override these since we're defining the handlers above
171521
- hideName: true,
171522
- sequenceData: sequenceData2,
171523
- // sequenceDataWithRefSeqCdsFeatures,
171524
- tickSpacing,
171525
- allowSeqDataOverride: true,
171526
- //override the sequence data stored in redux so we can track the caret position/selection layer in redux but not have to update the redux editor
171527
- editorName: `${isTemplate ? "template_" : ""}alignmentView${i2}`,
171528
- alignmentData,
171529
- chromatogramData,
171530
- height: "100%",
171531
- vectorInteractionWrapperStyle: {
171532
- overflowY: "hidden"
171533
- },
171534
- withZoomLinearView: false,
171535
- marginWidth: 0,
171536
- linearViewCharWidth: charWidthInLinearView,
171537
- ignoreGapsOnHighlight: true
171538
- }), linearViewOptions && (isFunction$2(linearViewOptions) ? linearViewOptions({
171539
- index: i2,
171540
- isTemplate,
171541
- alignmentVisibilityToolOptions,
171542
- sequenceData: sequenceData2,
171543
- alignmentData,
171544
- chromatogramData
171545
- }) : linearViewOptions)), {
171546
- additionalSelectionLayers,
171547
- dimensions: {
171548
- width: linearViewWidth
171549
- },
171550
- width: linearViewWidth,
171551
- paddingBottom: 5,
171552
- scrollDataPassed: this.easyStore
171553
- }))
171554
- )
171555
- );
171556
- }, "innerRenderItem");
171557
- if (isTemplate)
171558
- return innerRenderItem();
171559
- if (cloneProps)
171560
- return innerRenderItem(cloneProps.provided, cloneProps.snapshot);
171561
- const idToUse = alignmentData.id || sequenceData2.id || i2 + "_index_id";
171562
- return /* @__PURE__ */ React$2.createElement(
171563
- PublicDraggable,
171564
- {
171565
- key: idToUse.toString(),
171566
- index: i2,
171567
- isDragDisabled,
171568
- draggableId: idToUse.toString()
171569
- },
171570
- innerRenderItem
171571
- );
171572
- }, "renderItem"));
171573
- __publicField(this, "handleResize", throttle(([e2]) => {
171574
- this.easyStore.viewportWidth = e2.contentRect.width - this.state.nameDivWidth || 400;
171575
- this.setState({ width: e2.contentRect.width });
171576
- }, 200));
171577
- __publicField(this, "removeMinimapHighlightForMouseLeave", /* @__PURE__ */ __name(() => {
171578
- const minimapLaneEl = document.querySelector(`.minimapLane.lane-hovered`);
171579
- if (!minimapLaneEl)
171580
- return;
171581
- minimapLaneEl.classList.remove("lane-hovered");
171582
- }, "removeMinimapHighlightForMouseLeave"));
171583
- __publicField(this, "updateMinimapHighlightForMouseMove", /* @__PURE__ */ __name((event) => {
171584
- this.latestMouseY = getClientY(event);
171585
- this.updateMinimapHighlight();
171586
- }, "updateMinimapHighlightForMouseMove"));
171587
- __publicField(this, "updateMinimapHighlight", /* @__PURE__ */ __name(() => {
171588
- const rows = document.querySelectorAll(`.alignmentViewTrackContainer`);
171589
- const rowsLength = document.querySelectorAll(`.minimapLane`).length;
171590
- if (rowsLength <= 4) {
171591
- return;
171592
- }
171593
- some(rows, (rowDomNode) => {
171594
- const boundingRowRect = rowDomNode.getBoundingClientRect();
171595
- if (this.latestMouseY > boundingRowRect.top && this.latestMouseY < boundingRowRect.top + boundingRowRect.height) {
171596
- const prevMinimapLaneEl = document.querySelector(
171597
- `.minimapLane.lane-hovered`
171598
- );
171599
- if (prevMinimapLaneEl) {
171600
- prevMinimapLaneEl.classList.remove("lane-hovered");
171601
- }
171602
- const i2 = Number(rowDomNode.getAttribute("data-alignment-track-index"));
171603
- const minimapLaneEl = document.querySelector(
171604
- `.minimapLane:nth-child(${i2 + 1})`
171605
- );
171606
- if (!minimapLaneEl)
171607
- return;
171608
- minimapLaneEl.classList.add("lane-hovered");
171609
- return true;
171610
- }
171611
- });
171612
- }, "updateMinimapHighlight"));
171613
- __publicField(this, "onTrackDragStart", /* @__PURE__ */ __name(() => {
171614
- this.setState({ isTrackDragging: true });
171615
- }, "onTrackDragStart"));
171616
- __publicField(this, "onTrackDragEnd", /* @__PURE__ */ __name(({ destination, source }) => {
171617
- this.setState({ isTrackDragging: false });
171618
- if (!destination) {
171619
- return;
171620
- }
171621
- const { upsertAlignmentRun: upsertAlignmentRun2, alignmentId, alignmentTracks } = this.props;
171622
- upsertAlignmentRun2({
171623
- id: alignmentId,
171624
- alignmentTracks: array_move(
171625
- alignmentTracks,
171626
- source.index,
171627
- destination.index
171628
- )
171629
- });
171630
- }, "onTrackDragEnd"));
171631
- window.scrollAlignmentToPercent = this.scrollAlignmentToPercent;
171632
- if (window.Cypress)
171633
- window.Cypress.scrollAlignmentToPercent = this.scrollAlignmentToPercent;
171634
- this.onShortcutCopy = document.addEventListener(
171635
- "keydown",
171636
- this.handleAlignmentCopy
171637
- );
171638
- }
171639
- getNearestCursorPositionToMouseEvent(rowData, event, callback2) {
171640
- this.charWidth = this.getCharWidthInLinearView();
171641
- let nearestCaretPos = 0;
171642
- const rowDomNode = this.veTracksAndAlignmentHolder;
171643
- const boundingRowRect = rowDomNode.getBoundingClientRect();
171644
- const maxEnd = this.getMaxLength();
171645
- if (getClientX(event) - boundingRowRect.left - this.state.nameDivWidth < 0) {
171646
- nearestCaretPos = 0;
171647
- } else {
171648
- const clickXPositionRelativeToRowContainer = getClientX(event) - boundingRowRect.left - this.state.nameDivWidth;
171649
- const numberOfBPsInFromRowStart = Math.floor(
171650
- (clickXPositionRelativeToRowContainer + this.charWidth / 2) / this.charWidth
171651
- );
171652
- nearestCaretPos = numberOfBPsInFromRowStart + 0;
171653
- if (nearestCaretPos > maxEnd + 1) {
171654
- nearestCaretPos = maxEnd + 1;
171655
- }
171656
- }
171657
- if (this.props.sequenceData && this.props.sequenceData.isProtein) {
171658
- nearestCaretPos = Math.round(nearestCaretPos / 3) * 3;
171659
- }
171660
- if (this.props.sequenceLength === 0)
171661
- nearestCaretPos = 0;
171662
- const callbackVals = {
171663
- updateSelectionOrCaret: this.updateSelectionOrCaret,
171664
- nearestCaretPos,
171665
- sequenceLength: this.getSequenceLength(),
171666
- caretPosition: this.easyStore.caretPosition,
171667
- selectionLayer: this.easyStore.selectionLayer,
171668
- easyStore: this.easyStore,
171669
- caretPositionUpdate: this.caretPositionUpdate,
171670
- selectionLayerUpdate: this.selectionLayerUpdate,
171671
- event,
171672
- doNotWrapOrigin: true,
171673
- shiftHeld: event.shiftKey,
171674
- // caretGrabbed: event.target.className === "cursor",
171675
- selectionStartGrabbed: event.target.classList.contains(
171676
- draggableClassnames.selectionStart
171677
- ),
171678
- selectionEndGrabbed: event.target.classList.contains(
171679
- draggableClassnames.selectionEnd
171680
- )
171681
- };
171682
- callback2(callbackVals);
171683
- }
171684
- componentWillUnmount() {
171685
- if (window.Cypress) {
171686
- delete window.scrollAlignmentToPercent;
171687
- delete window.Cypress.scrollAlignmentToPercent;
171688
- delete window.updateAlignmentSelection;
171689
- delete window.Cypress.updateAlignmentSelection;
171690
- }
171691
- this.onShortcutCopy && document.removeEventListener("keydown", this.handleAlignmentCopy);
171692
- }
171693
- componentDidUpdate(prevProps) {
171694
- return __async(this, null, function* () {
171695
- if (prevProps.scrollPercentageToJumpTo !== this.props.scrollPercentageToJumpTo && this.props.scrollPercentageToJumpTo !== void 0) {
171696
- this.scrollAlignmentToPercent(this.props.scrollPercentageToJumpTo);
171697
- }
171698
- if (this.props.shouldAutosave && prevProps && prevProps.stateTrackingId && this.props.stateTrackingId !== prevProps.stateTrackingId) {
171699
- this.setState({ saveMessage: "Alignment Saving.." });
171700
- this.setState({ saveMessageLoading: true });
171701
- let cleanedTracks;
171702
- if (this.props.pairwiseAlignments) {
171703
- cleanedTracks = this.props.pairwiseAlignments.map(cleanTracks);
171704
- } else {
171705
- cleanedTracks = cleanTracks(this.props.alignmentTracks);
171706
- }
171707
- yield this.props.handleAlignmentSave(cleanedTracks, this.props);
171708
- this.setState({ saveMessage: "Alignment Saved" });
171709
- this.setState({ saveMessageLoading: false });
171710
- setTimeout(() => {
171711
- this.setState({ saveMessage: void 0 });
171712
- this.setState({ saveMessageLoading: false });
171713
- }, 5e3);
171714
- }
171715
- });
171716
- }
171717
- componentDidMount() {
171718
- const updateAlignmentSelection = /* @__PURE__ */ __name((newRangeOrCaret) => {
171719
- this.updateSelectionOrCaret(false, newRangeOrCaret, {
171720
- forceReduxUpdate: true
171721
- });
171722
- }, "updateAlignmentSelection");
171723
- window.updateAlignmentSelection = updateAlignmentSelection;
171724
- if (window.Cypress)
171725
- window.Cypress.updateAlignmentSelection = updateAlignmentSelection;
171726
- setTimeout(() => {
171727
- updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
171728
- }, 0);
171729
- setTimeout(() => {
171730
- this.setVerticalScrollRange();
171731
- }, 500);
171732
- }
171733
- render() {
171734
- const charWidthInLinearView = this.getCharWidthInLinearView();
171735
- const {
171736
- alignmentTracks = [],
171737
- height: height2,
171738
- minimapLaneHeight,
171739
- minimapLaneSpacing,
171740
- isInPairwiseOverviewView,
171741
- isPairwise,
171742
- currentPairwiseAlignmentIndex,
171743
- hasTemplate,
171744
- noVisibilityOptions,
171745
- updateAlignmentSortOrder,
171746
- alignmentSortOrder,
171747
- handleBackButtonClicked,
171748
- noClickDragHandlers,
171749
- upsertAlignmentRun: upsertAlignmentRun2,
171750
- alignmentId,
171751
- allowTrimming,
171752
- additionalSelectionLayerRightClickedOptions,
171753
- selectionLayerRightClicked,
171754
- additionalTopEl,
171755
- additionalTopLeftEl,
171756
- handleAlignmentRename,
171757
- alignmentVisibilityToolOptions
171758
- } = this.props;
171759
- const sequenceLength = this.getMaxLength();
171760
- if (!alignmentTracks || !alignmentTracks[0] || !alignmentTracks[0].alignmentData) {
171761
- console.error("corrupted data!", this.props);
171762
- return "corrupted data!";
171763
- }
171764
- const getTrackVis = /* @__PURE__ */ __name((alignmentTracks2, isTemplate, allTracks) => {
171765
- const rowData = {};
171766
- const innerTrackVis = /* @__PURE__ */ __name((drop_provided, drop_snapshot) => {
171767
- return /* @__PURE__ */ React$2.createElement(
171768
- "div",
171769
- {
171770
- className: "alignmentTracks ",
171771
- style: {
171772
- overflowY: "auto",
171773
- display: "flex",
171774
- zIndex: 10
171775
- }
171776
- },
171777
- /* @__PURE__ */ React$2.createElement(
171778
- "div",
171627
+ HorizontalPanelDragHandle,
171779
171628
  {
171780
- style: {
171781
- overflowX: "auto",
171782
- width: this.state.width
171783
- },
171784
- ref: (ref2) => {
171785
- this[isTemplate ? "alignmentHolderTop" : "alignmentHolder"] = ref2;
171786
- },
171787
- onContextMenu: (e2) => {
171788
- if (!allowTrimming || isTargetWithinEl(e2, ".alignmentTrackName")) {
171789
- return;
171790
- }
171791
- this.getTrackTrimmingOptions({
171792
- e: e2,
171793
- allTracks,
171794
- upsertAlignmentRun: upsertAlignmentRun2,
171795
- alignmentId,
171796
- currentPairwiseAlignmentIndex
171797
- });
171798
- },
171799
- onMouseLeave: this.removeMinimapHighlightForMouseLeave,
171800
- onMouseMove: this.updateMinimapHighlightForMouseMove,
171801
- dataname: "scrollGroup",
171802
- className: "alignmentHolder",
171803
- onScroll: isTemplate ? this.handleTopScroll : this.handleScroll
171804
- },
171805
- /* @__PURE__ */ React$2.createElement(
171806
- ReactDraggable,
171807
- {
171808
- disabled: this.state.isTrackDragging,
171809
- bounds: { top: 0, left: 0, right: 0, bottom: 0 },
171810
- onDrag: noClickDragHandlers ? noop$7 : (event) => {
171811
- if (this.state.isTrackDragging)
171812
- return;
171813
- this.getNearestCursorPositionToMouseEvent(
171814
- rowData,
171815
- event,
171816
- editorDragged
171817
- );
171818
- },
171819
- onStart: noClickDragHandlers ? noop$7 : (event) => {
171820
- if (isTargetWithinEl(event, ".alignmentTrackName")) {
171821
- return this.setState({ isTrackDragging: true });
171822
- }
171823
- if (this.state.isTrackDragging)
171824
- return;
171825
- this.getNearestCursorPositionToMouseEvent(
171826
- rowData,
171827
- event,
171828
- editorDragStarted
171829
- );
171830
- },
171831
- onStop: noClickDragHandlers ? noop$7 : (...args) => {
171832
- setTimeout(() => {
171833
- this.setState({ isTrackDragging: false });
171834
- }, 0);
171835
- editorDragStopped(...args);
171836
- }
171837
- },
171838
- /* @__PURE__ */ React$2.createElement(
171839
- "div",
171840
- {
171841
- ref: (ref2) => this.veTracksAndAlignmentHolder = ref2,
171842
- className: classNames$1("veTracksAndAlignmentHolder", {
171843
- isTrackDragging: this.state.isTrackDragging
171844
- }),
171845
- onClick: noClickDragHandlers ? noop$7 : (event) => {
171846
- if (this.state.isTrackDragging)
171847
- return;
171848
- if (isTargetWithinEl(event, ".alignmentTrackName")) {
171849
- return;
171850
- }
171851
- this.getNearestCursorPositionToMouseEvent(
171852
- rowData,
171853
- event,
171854
- editorClicked
171855
- );
171856
- }
171857
- },
171858
- /* @__PURE__ */ React$2.createElement(
171859
- PerformantSelectionLayer,
171860
- {
171861
- leftMargin: this.state.nameDivWidth,
171862
- className: "veAlignmentSelectionLayer",
171863
- isDraggable: true,
171864
- selectionLayerRightClicked: selectionLayerRightClicked ? (...args) => {
171865
- selectionLayerRightClicked(...args, this.props);
171866
- } : (...args) => {
171867
- const { event } = args[0];
171868
- const track2 = getTrackFromEvent(event, allTracks);
171869
- const alignmentData = track2.alignmentData;
171870
- const { name: name2 } = alignmentData;
171871
- const copySpecificAlignmentFasta = /* @__PURE__ */ __name(() => __async(this, null, function* () {
171872
- const { selectionLayer: selectionLayer2 } = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id] || {};
171873
- const seqDataToCopy = getSequenceDataBetweenRange(
171874
- alignmentData,
171875
- selectionLayer2
171876
- ).sequence;
171877
- const seqDataToCopyAsFasta = `>${name2}\r
171878
- ${seqDataToCopy}\r
171879
- `;
171880
- yield navigator.clipboard.writeText(
171881
- seqDataToCopyAsFasta
171882
- );
171883
- }), "copySpecificAlignmentFasta");
171884
- const copySpecificAlignment = /* @__PURE__ */ __name(() => __async(this, null, function* () {
171885
- const { selectionLayer: selectionLayer2 } = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id] || {};
171886
- const seqDataToCopy = getSequenceDataBetweenRange(
171887
- alignmentData,
171888
- selectionLayer2
171889
- ).sequence;
171890
- yield navigator.clipboard.writeText(
171891
- seqDataToCopy
171892
- );
171893
- }), "copySpecificAlignment");
171894
- const getAllAlignmentsFastaText = /* @__PURE__ */ __name(() => __async(this, null, function* () {
171895
- yield navigator.clipboard.writeText(
171896
- this.getAllAlignmentsFastaText()
171897
- );
171898
- }), "getAllAlignmentsFastaText");
171899
- showContextMenu(
171900
- [
171901
- ...additionalSelectionLayerRightClickedOptions ? additionalSelectionLayerRightClickedOptions(
171902
- ...args,
171903
- this.props
171904
- ) : [],
171905
- {
171906
- text: "Copy Selection of All Alignments as Fasta",
171907
- className: "copyAllAlignmentsFastaClipboardHelper",
171908
- hotkey: "cmd+c",
171909
- onClick: () => {
171910
- getAllAlignmentsFastaText();
171911
- window.toastr.success("Selection Copied");
171912
- }
171913
- },
171914
- {
171915
- text: `Copy Selection of ${name2} as Fasta`,
171916
- className: "copySpecificAlignmentFastaClipboardHelper",
171917
- onClick: () => {
171918
- copySpecificAlignmentFasta();
171919
- window.toastr.success(
171920
- "Selection Copied As Fasta"
171921
- );
171922
- }
171923
- },
171924
- {
171925
- text: `Copy Selection of ${name2}`,
171926
- className: "copySpecificAlignmentAsPlainClipboardHelper",
171927
- onClick: () => {
171928
- copySpecificAlignment();
171929
- window.toastr.success("Selection Copied");
171930
- }
171931
- }
171932
- ],
171933
- void 0,
171934
- event
171935
- );
171936
- },
171937
- easyStore: this.easyStore,
171938
- sequenceLength,
171939
- charWidth: this.getCharWidthInLinearView(),
171940
- row: { start: 0, end: sequenceLength - 1 }
171941
- }
171942
- ),
171943
- /* @__PURE__ */ React$2.createElement(
171944
- PerformantCaret,
171945
- {
171946
- leftMargin: this.state.nameDivWidth,
171947
- className: "veAlignmentSelectionLayer",
171948
- isDraggable: true,
171949
- sequenceLength,
171950
- charWidth: this.getCharWidthInLinearView(),
171951
- row: { start: 0, end: sequenceLength - 1 },
171952
- easyStore: this.easyStore
171953
- }
171954
- ),
171955
- isTemplate ? this.renderItem(0, 0, isTemplate) : /* @__PURE__ */ React$2.createElement(
171956
- ReactList,
171957
- {
171958
- ref: (c2) => {
171959
- this.InfiniteScroller = c2;
171960
- const domNode = ReactDOM$1.findDOMNode(c2);
171961
- if (domNode instanceof HTMLElement) {
171962
- drop_provided.innerRef(domNode);
171963
- }
171964
- },
171965
- type: "variable",
171966
- itemSizeEstimator: this.estimateRowHeight,
171967
- itemRenderer: this.renderItem,
171968
- length: alignmentTracks2.length + (drop_snapshot.isUsingPlaceholder ? 1 : 0)
171969
- }
171970
- )
171971
- )
171972
- )
171973
- )
171974
- );
171975
- }, "innerTrackVis");
171976
- if (isTemplate)
171977
- return innerTrackVis();
171978
- else
171979
- return /* @__PURE__ */ React$2.createElement(
171980
- ConnectedDroppable$1,
171981
- {
171982
- mode: "virtual",
171983
- renderClone: (provided, snapshot, { source: { index: index2 } }) => {
171984
- return this.renderItem(index2, index2, false, {
171985
- provided,
171986
- snapshot
171987
- });
171988
- },
171989
- direction: "vertical",
171990
- droppableId: "droppable" + isTemplate ? "_no_drop" : ""
171991
- },
171992
- innerTrackVis
171993
- );
171994
- }, "getTrackVis");
171995
- const [firstTrack, ...otherTracks] = alignmentTracks;
171996
- const totalWidthOfMinimap = this.state.width;
171997
- const totalWidthInAlignmentView = 14 * this.getSequenceLength();
171998
- const minSliderSize = Math.min(
171999
- totalWidthOfMinimap * (totalWidthOfMinimap / totalWidthInAlignmentView),
172000
- totalWidthOfMinimap
172001
- );
172002
- const viewportHeight = Math.max(
172003
- document.documentElement.clientHeight,
172004
- window.innerHeight || 0
172005
- );
172006
- const pinchHandler = {
172007
- onPinch: ({ delta: [d2] }) => {
172008
- this.bindOutsideChangeHelper.triggerChange(({ value, changeValue }) => {
172009
- if (d2 > 0) {
172010
- if (value > 8) {
172011
- changeValue(value + 0.4);
172012
- } else {
172013
- changeValue(value + 0.2);
172014
- }
172015
- } else if (d2 < 0) {
172016
- if (value > 8) {
172017
- changeValue(value - 0.4);
172018
- } else {
172019
- changeValue(value - 0.2);
171629
+ onDrag: ({ dx }) => {
171630
+ setNameDivWidth(Math.min(nameDivWidth - dx, width - 20));
171631
+ }
172020
171632
  }
172021
- }
172022
- });
172023
- updateLabelsForInViewFeatures();
172024
- }
172025
- };
172026
- return /* @__PURE__ */ React$2.createElement(PinchHelper, __spreadValues({}, pinchHandler), /* @__PURE__ */ React$2.createElement(ResizeSensor, { onResize: this.handleResize }, /* @__PURE__ */ React$2.createElement(
172027
- "div",
172028
- {
172029
- style: __spreadValues({
172030
- height: height2 || (isPairwise ? "auto" : viewportHeight * 0.88),
172031
- display: "flex",
172032
- flexDirection: "column",
172033
- justifyContent: "space-between",
172034
- position: "relative",
172035
- overflowY: "auto"
172036
- }, this.props.style),
172037
- className: "alignmentView"
172038
- },
172039
- /* @__PURE__ */ React$2.createElement(
172040
- DragDropContext,
172041
- {
172042
- onDragStart: this.onTrackDragStart,
172043
- onDragEnd: this.onTrackDragEnd
172044
- },
172045
- /* @__PURE__ */ React$2.createElement(
171633
+ )
171634
+ ),
171635
+ handleSelectTrack && !isTemplate && /* @__PURE__ */ React$2.createElement(
172046
171636
  "div",
172047
171637
  {
171638
+ onClick: () => {
171639
+ handleSelectTrack(i2);
171640
+ },
172048
171641
  style: {
172049
- display: "flex",
172050
- flexDirection: "column",
172051
- position: "relative",
172052
- overflowY: "auto"
171642
+ position: "absolute",
171643
+ opacity: 0,
171644
+ height: "100%",
171645
+ left: nameDivWidth,
171646
+ width: linearViewWidth,
171647
+ fontWeight: "bolder",
171648
+ cursor: "pointer",
171649
+ padding: 5,
171650
+ textAlign: "center",
171651
+ zIndex: 400
172053
171652
  },
172054
- className: "alignmentView-top-container"
171653
+ className: "alignmentViewSelectTrackPopover veWhiteBackground"
172055
171654
  },
172056
- /* @__PURE__ */ React$2.createElement(
172057
- "div",
172058
- {
172059
- style: {
172060
- paddingTop: "3px",
172061
- paddingBottom: "5px",
172062
- borderBottom: "1px solid",
172063
- display: "flex",
172064
- minHeight: "32px",
172065
- width: "100%",
172066
- flexWrap: "nowrap",
172067
- flexDirection: "row",
172068
- flex: "0 0 auto"
172069
- },
172070
- className: "ve-alignment-top-bar"
172071
- },
172072
- additionalTopLeftEl,
172073
- handleBackButtonClicked && /* @__PURE__ */ React$2.createElement(Tooltip, { content: "Back to Pairwise Alignment Overview" }, /* @__PURE__ */ React$2.createElement(
172074
- Button,
172075
- {
172076
- icon: "arrow-left",
172077
- onClick: () => {
172078
- handleBackButtonClicked();
172079
- this.caretPositionUpdate(-1);
172080
- },
172081
- small: true,
172082
- intent: Intent.PRIMARY,
172083
- minimal: true,
172084
- style: { marginRight: 10 },
172085
- className: "alignmentViewBackButton"
172086
- }
172087
- )),
172088
- /* @__PURE__ */ React$2.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ React$2.createElement(
172089
- EditableText,
172090
- {
172091
- disabled: !handleAlignmentRename,
172092
- onChange: (v2) => {
172093
- this.setState({
172094
- alignmentName: v2
172095
- });
172096
- },
172097
- maxLength: 399,
172098
- value: this.state.alignmentName,
172099
- onConfirm: (v2) => __async(this, null, function* () {
172100
- if (!v2) {
172101
- this.setState({
172102
- alignmentName: this.props.alignmentName
172103
- });
172104
- return;
172105
- }
172106
- if (v2 === this.props.alignmentName) {
172107
- return;
172108
- }
172109
- this.setState({ saveMessage: "Alignment Renaming.." });
172110
- this.setState({ saveMessageLoading: true });
172111
- yield handleAlignmentRename(v2, this.props);
172112
- this.setState({ saveMessage: "Rename Successful" });
172113
- this.setState({ saveMessageLoading: false });
172114
- setTimeout(() => {
172115
- this.setState({ saveMessage: void 0 });
172116
- this.setState({ saveMessageLoading: false });
172117
- }, 5e3);
172118
- }),
172119
- selectAllOnFocus: true,
172120
- className: "veAlignmentName"
172121
- }
172122
- ), "   ", /* @__PURE__ */ React$2.createElement(
172123
- "div",
172124
- {
172125
- className: "veAlignmentType",
172126
- style: {
172127
- paddingTop: "3px",
172128
- fontSize: "14px",
172129
- color: "grey",
172130
- maxWidth: "300px",
172131
- overflow: "hidden",
172132
- textOverflow: "ellipsis",
172133
- whiteSpace: "nowrap"
172134
- },
172135
- "data-title": this.props.alignmentType || "Unknown Alignment Type"
172136
- },
172137
- this.props.alignmentType || "Unknown Alignment Type"
172138
- )),
172139
- this.props.unmappedSeqs && /* @__PURE__ */ React$2.createElement(
172140
- InfoHelper,
172141
- {
172142
- size: 20,
172143
- content: /* @__PURE__ */ React$2.createElement("div", null, "This alignment had sequences that did not map to the template sequence:", this.props.unmappedSeqs.map(
172144
- ({ sequenceData: sequenceData2 }, i2) => /* @__PURE__ */ React$2.createElement("div", { key: i2 }, sequenceData2.name)
172145
- )),
172146
- intent: "warning",
172147
- icon: "warning-sign"
172148
- }
172149
- ),
172150
- !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172151
- UncontrolledSliderWithPlusMinusBtns,
172152
- {
172153
- noWraparound: true,
172154
- bindOutsideChangeHelper: this.bindOutsideChangeHelper,
172155
- onClick: () => {
172156
- setTimeout(this.scrollToCaret, 0);
172157
- },
172158
- minCharWidth: this.getMinCharWidth(),
172159
- onChange: (zoomLvl) => __async(this, null, function* () {
172160
- this.isZooming = true;
172161
- setTimeout(() => {
172162
- this.isZooming = false;
172163
- }, 10);
172164
- const minCharWidth = this.getMinCharWidth();
172165
- const scaleFactor = Math.pow(12 / minCharWidth, 1 / 10);
172166
- const newCharWidth = minCharWidth * Math.pow(scaleFactor, zoomLvl);
172167
- yield this.setCharWidthInLinearView({
172168
- charWidthInLinearView: newCharWidth
172169
- });
172170
- yield this.scrollToCaret();
172171
- yield updateLabelsForInViewFeatures({
172172
- rectElement: ".alignmentHolder"
172173
- });
172174
- }),
172175
- coerceInitialValue,
172176
- title: "Adjust Zoom Level",
172177
- style: { paddingTop: "4px", width: 100 },
172178
- className: "veZoomAlignmentSlider ove-slider",
172179
- labelRenderer: false,
172180
- initialValue: charWidthInLinearView,
172181
- stepSize: 0.05,
172182
- max: 10,
172183
- min: 0,
172184
- clickStepSize: 0.5
172185
- }
172186
- ),
172187
- !noVisibilityOptions && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172188
- AlignmentVisibilityTool,
172189
- __spreadValues({
172190
- currentPairwiseAlignmentIndex
172191
- }, alignmentVisibilityToolOptions)
172192
- ),
172193
- updateAlignmentSortOrder && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172194
- Popover,
172195
- {
172196
- minimal: true,
172197
- content: /* @__PURE__ */ React$2.createElement(Menu, null, /* @__PURE__ */ React$2.createElement(
172198
- MenuItem,
172199
- {
172200
- active: true,
172201
- onClick: () => {
172202
- updateAlignmentSortOrder("Position");
172203
- },
172204
- text: "Position"
172205
- }
172206
- ), /* @__PURE__ */ React$2.createElement(
172207
- MenuItem,
172208
- {
172209
- active: alignmentSortOrder,
172210
- onClick: () => {
172211
- updateAlignmentSortOrder("Alphabetical");
172212
- },
172213
- text: "Alphabetical"
172214
- }
172215
- )),
172216
- target: /* @__PURE__ */ React$2.createElement(
172217
- Button,
172218
- {
172219
- small: true,
172220
- text: "Sort Order",
172221
- rightIcon: "caret-down",
172222
- icon: "sort"
172223
- }
172224
- )
172225
- }
172226
- ),
172227
- additionalTopEl,
172228
- this.state.saveMessage && /* @__PURE__ */ React$2.createElement(
172229
- "div",
172230
- {
172231
- className: "ove-menu-toast",
172232
- style: {
172233
- display: "flex",
172234
- alignItems: "center",
172235
- marginLeft: "auto",
172236
- marginRight: 10
172237
- }
172238
- },
172239
- this.state.saveMessageLoading ? /* @__PURE__ */ React$2.createElement("div", null, /* @__PURE__ */ React$2.createElement(Spinner, { size: 15 })) : /* @__PURE__ */ React$2.createElement(Icon, { icon: "tick-circle", intent: "success" }),
172240
- " ",
172241
- " ",
172242
- this.state.saveMessage
172243
- )
172244
- ),
172245
- hasTemplate ? /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement("div", { className: "alignmentTrackFixedToTop" }, getTrackVis([firstTrack], true, alignmentTracks)), getTrackVis(otherTracks, false, alignmentTracks)) : getTrackVis(alignmentTracks, false, alignmentTracks)
172246
- )
172247
- ),
172248
- !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172249
- "div",
172250
- {
172251
- className: "alignmentViewBottomBar",
172252
- style: {
172253
- // flexGrow: 1,
172254
- // minHeight: "-webkit-min-content", //https://stackoverflow.com/questions/28029736/how-to-prevent-a-flex-item-from-shrinking-smaller-than-its-content
172255
- maxHeight: 210,
172256
- marginTop: 4,
172257
- paddingTop: 4,
172258
- borderTop: "1px solid lightgrey",
172259
- display: "flex"
172260
- }
172261
- },
171655
+ "Inspect track"
171656
+ ),
172262
171657
  /* @__PURE__ */ React$2.createElement(
172263
- Minimap,
172264
- __spreadProps(__spreadValues({}, {
172265
- selectionLayerComp: /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement(
172266
- PerformantSelectionLayer,
172267
- {
172268
- is: true,
172269
- hideCarets: true,
172270
- className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
172271
- easyStore: this.easyStore,
172272
- sequenceLength,
172273
- charWidth: this.getMinCharWidth(true),
172274
- row: { start: 0, end: sequenceLength - 1 }
172275
- }
172276
- ), /* @__PURE__ */ React$2.createElement(
172277
- PerformantCaret,
172278
- {
172279
- style: {
172280
- opacity: 0.2
172281
- },
172282
- className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
172283
- sequenceLength,
172284
- charWidth: this.getMinCharWidth(true),
172285
- row: { start: 0, end: sequenceLength - 1 },
172286
- easyStore: this.easyStore
172287
- }
172288
- )),
172289
- alignmentTracks,
171658
+ NonReduxEnhancedLinearView,
171659
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
171660
+ caretPosition: tempTrimmingCaret[i2] || -1,
171661
+ selectionLayer: selectionLayer22,
171662
+ isInAlignment: true,
171663
+ annotationVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
171664
+ linearViewAnnotationLabelVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility,
171665
+ marginWith: 0,
171666
+ orfClicked: annotationClicked,
171667
+ primerClicked: annotationClicked,
171668
+ translationClicked: annotationClicked,
171669
+ cutsiteClicked: annotationClicked,
171670
+ translationDoubleClicked: annotationClicked,
171671
+ deletionLayerClicked: annotationClicked,
171672
+ replacementLayerClicked: annotationClicked,
171673
+ featureClicked: annotationClicked,
171674
+ partClicked: annotationClicked,
171675
+ searchLayerClicked: annotationClicked,
171676
+ editorDragStarted: noop$7,
171677
+ editorDragStopped: noop$7,
171678
+ editorDragged: noop$7,
171679
+ hideName: true,
171680
+ sequenceData: sequenceData22,
171681
+ tickSpacing,
171682
+ allowSeqDataOverride: true,
171683
+ editorName: `${isTemplate ? "template_" : ""}alignmentView${i2}`,
171684
+ alignmentData,
171685
+ chromatogramData,
171686
+ height: "100%",
171687
+ vectorInteractionWrapperStyle: {
171688
+ overflowY: "hidden"
171689
+ },
171690
+ withZoomLinearView: false,
171691
+ marginWidth: 0,
171692
+ linearViewCharWidth: charWidth2,
171693
+ ignoreGapsOnHighlight: true
171694
+ }), linearViewOptions && (isFunction$2(linearViewOptions) ? linearViewOptions({
171695
+ index: i2,
171696
+ isTemplate,
171697
+ alignmentVisibilityToolOptions,
171698
+ sequenceData: sequenceData22,
171699
+ alignmentData,
171700
+ chromatogramData
171701
+ }) : linearViewOptions)), {
171702
+ additionalSelectionLayers,
172290
171703
  dimensions: {
172291
- width: Math.max(this.state.width, 10) || 10
171704
+ width: linearViewWidth
172292
171705
  },
172293
- nameDivOffsetPercent: 0,
172294
- // this.state.nameDivWidth / this.getMaxLinearViewWidth(),
172295
- scrollYToTrack: this.scrollYToTrack,
172296
- onSizeAdjust: this.onMinimapSizeAdjust,
172297
- minSliderSize,
172298
- laneHeight: minimapLaneHeight || (alignmentTracks.length > 5 ? 10 : 17),
172299
- laneSpacing: minimapLaneSpacing || (alignmentTracks.length > 5 ? 2 : 1),
172300
- easyStore: this.easyStore,
172301
- numBpsShownInLinearView: this.getNumBpsShownInLinearView(),
172302
- scrollAlignmentView: this.state.scrollAlignmentView
172303
- }), {
172304
- onMinimapScrollX: this.scrollAlignmentToPercent
171706
+ width: linearViewWidth,
171707
+ paddingBottom: 5,
171708
+ scrollDataPassed: easyStore2.current
172305
171709
  })
172306
171710
  )
172307
- ),
172308
- /* @__PURE__ */ React$2.createElement(
172309
- GlobalDialog,
172310
- null
171711
+ );
171712
+ }, "innerRenderItem");
171713
+ if (isTemplate)
171714
+ return innerRenderItem();
171715
+ if (cloneProps)
171716
+ return innerRenderItem(cloneProps.provided, cloneProps.snapshot);
171717
+ const idToUse = alignmentData.id || sequenceData22.id || i2 + "_index_id";
171718
+ return /* @__PURE__ */ React$2.createElement(
171719
+ PublicDraggable,
171720
+ {
171721
+ key: idToUse.toString(),
171722
+ index: i2,
171723
+ isDragDisabled,
171724
+ draggableId: idToUse.toString()
171725
+ },
171726
+ innerRenderItem
171727
+ );
171728
+ }, "renderItem");
171729
+ const handleResize = throttle(([e2]) => {
171730
+ easyStore2.current.viewportWidth = e2.contentRect.width - nameDivWidth || 400;
171731
+ setWidth(e2.contentRect.width);
171732
+ }, 200);
171733
+ const removeMinimapHighlightForMouseLeave = /* @__PURE__ */ __name(() => {
171734
+ const minimapLaneEl = document.querySelector(`.minimapLane.lane-hovered`);
171735
+ if (!minimapLaneEl)
171736
+ return;
171737
+ minimapLaneEl.classList.remove("lane-hovered");
171738
+ }, "removeMinimapHighlightForMouseLeave");
171739
+ const updateMinimapHighlightForMouseMove = /* @__PURE__ */ __name((event) => {
171740
+ latestMouseY.current = getClientY(event);
171741
+ updateMinimapHighlight();
171742
+ }, "updateMinimapHighlightForMouseMove");
171743
+ const updateMinimapHighlight = /* @__PURE__ */ __name(() => {
171744
+ const rows = document.querySelectorAll(`.alignmentViewTrackContainer`);
171745
+ const rowsLength = document.querySelectorAll(`.minimapLane`).length;
171746
+ if (rowsLength <= 4) {
171747
+ return;
171748
+ }
171749
+ some(rows, (rowDomNode) => {
171750
+ const boundingRowRect = rowDomNode.getBoundingClientRect();
171751
+ if (latestMouseY.current > boundingRowRect.top && latestMouseY.current < boundingRowRect.top + boundingRowRect.height) {
171752
+ const prevMinimapLaneEl = document.querySelector(
171753
+ `.minimapLane.lane-hovered`
171754
+ );
171755
+ if (prevMinimapLaneEl) {
171756
+ prevMinimapLaneEl.classList.remove("lane-hovered");
171757
+ }
171758
+ const i2 = Number(rowDomNode.getAttribute("data-alignment-track-index"));
171759
+ const minimapLaneEl = document.querySelector(
171760
+ `.minimapLane:nth-child(${i2 + 1})`
171761
+ );
171762
+ if (!minimapLaneEl)
171763
+ return;
171764
+ minimapLaneEl.classList.add("lane-hovered");
171765
+ return true;
171766
+ }
171767
+ });
171768
+ }, "updateMinimapHighlight");
171769
+ const onTrackDragStart = /* @__PURE__ */ __name(() => {
171770
+ setIsTrackDragging(true);
171771
+ }, "onTrackDragStart");
171772
+ const onTrackDragEnd = /* @__PURE__ */ __name(({ destination, source }) => {
171773
+ setIsTrackDragging(false);
171774
+ if (!destination) {
171775
+ return;
171776
+ }
171777
+ upsertAlignmentRun2({
171778
+ id: alignmentId,
171779
+ alignmentTracks: array_move(
171780
+ alignmentTracks,
171781
+ source.index,
171782
+ destination.index
172311
171783
  )
172312
- )));
172313
- }
172314
- getTrackTrimmingOptions({
171784
+ });
171785
+ }, "onTrackDragEnd");
171786
+ const getTrackTrimmingOptions = /* @__PURE__ */ __name(({
172315
171787
  e: e2,
172316
171788
  allTracks,
172317
- upsertAlignmentRun: upsertAlignmentRun2,
172318
- currentPairwiseAlignmentIndex,
172319
- alignmentId
172320
- }) {
171789
+ upsertAlignmentRun: upsertAlignmentRun22,
171790
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
171791
+ alignmentId: alignmentId2
171792
+ }) => {
172321
171793
  const track2 = getTrackFromEvent(e2, allTracks);
172322
- this.getNearestCursorPositionToMouseEvent(
172323
- this.rowData,
171794
+ getNearestCursorPositionToMouseEvent2(
171795
+ rowData.current,
172324
171796
  e2,
172325
171797
  ({ nearestCaretPos }) => {
172326
- var _a2, _b2, _c2, _d2;
172327
- this.setState({
172328
- [`tempTrimmingCaret${track2.index}`]: nearestCaretPos
172329
- });
172330
- const afterDisabled = nearestCaretPos <= ((_a2 = track2.alignmentData.trimmedRange) == null ? void 0 : _a2.start);
171798
+ var _a3, _b2, _c2, _d2;
171799
+ setTempTrimmingCaret((prev) => __spreadProps(__spreadValues({}, prev), {
171800
+ [track2.index]: nearestCaretPos
171801
+ }));
171802
+ const afterDisabled = nearestCaretPos <= ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.start);
172331
171803
  const beforeDisabled = nearestCaretPos > ((_b2 = track2.alignmentData.trimmedRange) == null ? void 0 : _b2.end);
172332
171804
  showContextMenu(
172333
171805
  [
@@ -172348,28 +171820,25 @@ ${seqDataToCopy}\r
172348
171820
  text: "Ignore Before",
172349
171821
  disabled: beforeDisabled,
172350
171822
  icon: "drawer-left-filled",
172351
- onMouseOver: () => !beforeDisabled && this.setState({
172352
- [`tempTrimBefore${track2.index}`]: {
172353
- start: 0,
172354
- end: nearestCaretPos - 1
172355
- }
172356
- }),
172357
- onMouseLeave: () => this.setState({
172358
- [`tempTrimBefore${track2.index}`]: void 0
172359
- }),
171823
+ onMouseOver: () => !beforeDisabled && setTempTrimBefore((prev) => __spreadProps(__spreadValues({}, prev), {
171824
+ [track2.index]: { start: 0, end: nearestCaretPos - 1 }
171825
+ })),
171826
+ onMouseLeave: () => setTempTrimBefore((prev) => __spreadProps(__spreadValues({}, prev), {
171827
+ [track2.index]: void 0
171828
+ })),
172360
171829
  onClick: () => {
172361
- var _a3;
171830
+ var _a4;
172362
171831
  updateTrackHelper({
172363
- currentPairwiseAlignmentIndex,
172364
- upsertAlignmentRun: upsertAlignmentRun2,
172365
- alignmentId,
171832
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
171833
+ upsertAlignmentRun: upsertAlignmentRun22,
171834
+ alignmentId: alignmentId2,
172366
171835
  alignmentTracks: allTracks,
172367
171836
  alignmentTrackIndex: track2.index,
172368
171837
  hasBeenTrimmed: true,
172369
171838
  update: {
172370
171839
  trimmedRange: {
172371
171840
  start: nearestCaretPos,
172372
- end: ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.end) || this.getMaxLength() - 1
171841
+ end: ((_a4 = track2.alignmentData.trimmedRange) == null ? void 0 : _a4.end) || maxLength - 1
172373
171842
  }
172374
171843
  }
172375
171844
  });
@@ -172379,27 +171848,24 @@ ${seqDataToCopy}\r
172379
171848
  text: "Ignore After",
172380
171849
  disabled: afterDisabled,
172381
171850
  icon: "drawer-right-filled",
172382
- onMouseOver: () => !afterDisabled && this.setState({
172383
- [`tempTrimAfter${track2.index}`]: {
172384
- start: nearestCaretPos,
172385
- end: this.getMaxLength() - 1
172386
- }
172387
- }),
172388
- onMouseLeave: () => this.setState({
172389
- [`tempTrimAfter${track2.index}`]: void 0
172390
- }),
171851
+ onMouseOver: () => !afterDisabled && setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), {
171852
+ [track2.index]: { start: nearestCaretPos, end: maxLength - 1 }
171853
+ })),
171854
+ onMouseLeave: () => setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), {
171855
+ [track2.index]: void 0
171856
+ })),
172391
171857
  onClick: () => {
172392
- var _a3;
171858
+ var _a4;
172393
171859
  updateTrackHelper({
172394
- currentPairwiseAlignmentIndex,
172395
- upsertAlignmentRun: upsertAlignmentRun2,
172396
- alignmentId,
171860
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
171861
+ upsertAlignmentRun: upsertAlignmentRun22,
171862
+ alignmentId: alignmentId2,
172397
171863
  alignmentTracks: allTracks,
172398
171864
  alignmentTrackIndex: track2.index,
172399
171865
  hasBeenTrimmed: true,
172400
171866
  update: {
172401
171867
  trimmedRange: {
172402
- start: ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.start) || 0,
171868
+ start: ((_a4 = track2.alignmentData.trimmedRange) == null ? void 0 : _a4.start) || 0,
172403
171869
  end: nearestCaretPos - 1
172404
171870
  }
172405
171871
  }
@@ -172415,9 +171881,9 @@ ${seqDataToCopy}\r
172415
171881
  icon: "trash",
172416
171882
  onClick: () => {
172417
171883
  updateTrackHelper({
172418
- currentPairwiseAlignmentIndex,
172419
- upsertAlignmentRun: upsertAlignmentRun2,
172420
- alignmentId,
171884
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
171885
+ upsertAlignmentRun: upsertAlignmentRun22,
171886
+ alignmentId: alignmentId2,
172421
171887
  alignmentTracks: allTracks,
172422
171888
  alignmentTrackIndex: track2.index,
172423
171889
  hasBeenTrimmed: false,
@@ -172431,19 +171897,562 @@ ${seqDataToCopy}\r
172431
171897
  void 0,
172432
171898
  e2,
172433
171899
  () => {
172434
- this.setState({
172435
- [`tempTrimmingCaret${track2.index}`]: void 0
172436
- });
171900
+ setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), { [track2.index]: void 0 }));
172437
171901
  }
172438
171902
  );
172439
171903
  }
172440
171904
  );
172441
171905
  e2.preventDefault();
172442
171906
  e2.stopPropagation();
171907
+ }, "getTrackTrimmingOptions");
171908
+ if (!alignmentTracks || !alignmentTracks[0] || !alignmentTracks[0].alignmentData) {
171909
+ console.error("corrupted data!", props);
171910
+ return "corrupted data!";
172443
171911
  }
172444
- };
172445
- __name(_AlignmentView, "AlignmentView");
172446
- let AlignmentView = _AlignmentView;
171912
+ const getTrackVis = /* @__PURE__ */ __name((alignmentTracks2, isTemplate, allTracks) => {
171913
+ const rowData2 = {};
171914
+ const innerTrackVis = /* @__PURE__ */ __name((drop_provided, drop_snapshot) => {
171915
+ return /* @__PURE__ */ React$2.createElement(
171916
+ "div",
171917
+ {
171918
+ className: "alignmentTracks ",
171919
+ style: {
171920
+ overflowY: "auto",
171921
+ display: "flex",
171922
+ zIndex: 10
171923
+ }
171924
+ },
171925
+ /* @__PURE__ */ React$2.createElement(
171926
+ "div",
171927
+ {
171928
+ style: { overflowX: "auto", width },
171929
+ ref: (ref2) => {
171930
+ if (isTemplate) {
171931
+ alignmentHolderTop.current = ref2;
171932
+ } else {
171933
+ alignmentHolder.current = ref2;
171934
+ }
171935
+ },
171936
+ onContextMenu: (e2) => {
171937
+ if (!allowTrimming || isTargetWithinEl(e2, ".alignmentTrackName")) {
171938
+ return;
171939
+ }
171940
+ getTrackTrimmingOptions({
171941
+ e: e2,
171942
+ allTracks,
171943
+ upsertAlignmentRun: upsertAlignmentRun2,
171944
+ alignmentId,
171945
+ currentPairwiseAlignmentIndex
171946
+ });
171947
+ },
171948
+ onMouseLeave: removeMinimapHighlightForMouseLeave,
171949
+ onMouseMove: updateMinimapHighlightForMouseMove,
171950
+ dataname: "scrollGroup",
171951
+ className: "alignmentHolder",
171952
+ onScroll: isTemplate ? handleTopScroll : handleScroll
171953
+ },
171954
+ /* @__PURE__ */ React$2.createElement(
171955
+ ReactDraggable,
171956
+ {
171957
+ disabled: isTrackDragging,
171958
+ bounds: { top: 0, left: 0, right: 0, bottom: 0 },
171959
+ onDrag: noClickDragHandlers ? noop$7 : (event) => {
171960
+ if (isTrackDragging)
171961
+ return;
171962
+ getNearestCursorPositionToMouseEvent2(
171963
+ rowData2,
171964
+ event,
171965
+ editorDragged
171966
+ );
171967
+ },
171968
+ onStart: noClickDragHandlers ? noop$7 : (event) => {
171969
+ if (isTargetWithinEl(event, ".alignmentTrackName")) {
171970
+ setIsTrackDragging(true);
171971
+ return;
171972
+ }
171973
+ if (isTrackDragging)
171974
+ return;
171975
+ getNearestCursorPositionToMouseEvent2(
171976
+ rowData2,
171977
+ event,
171978
+ editorDragStarted
171979
+ );
171980
+ },
171981
+ onStop: noClickDragHandlers ? noop$7 : (...args) => {
171982
+ setTimeout(() => {
171983
+ setIsTrackDragging(false);
171984
+ }, 0);
171985
+ editorDragStopped(...args);
171986
+ }
171987
+ },
171988
+ /* @__PURE__ */ React$2.createElement(
171989
+ "div",
171990
+ {
171991
+ ref: veTracksAndAlignmentHolder,
171992
+ className: classNames$1("veTracksAndAlignmentHolder", {
171993
+ isTrackDragging
171994
+ }),
171995
+ onClick: noClickDragHandlers ? noop$7 : (event) => {
171996
+ if (isTrackDragging)
171997
+ return;
171998
+ if (isTargetWithinEl(event, ".alignmentTrackName")) {
171999
+ return;
172000
+ }
172001
+ getNearestCursorPositionToMouseEvent2(
172002
+ rowData2,
172003
+ event,
172004
+ editorClicked
172005
+ );
172006
+ }
172007
+ },
172008
+ /* @__PURE__ */ React$2.createElement(
172009
+ PerformantSelectionLayer,
172010
+ {
172011
+ leftMargin: nameDivWidth,
172012
+ className: "veAlignmentSelectionLayer",
172013
+ isDraggable: true,
172014
+ selectionLayerRightClicked: selectionLayerRightClicked ? (...args) => {
172015
+ selectionLayerRightClicked(...args, props);
172016
+ } : (...args) => {
172017
+ const { event } = args[0];
172018
+ const track2 = getTrackFromEvent(event, allTracks);
172019
+ const alignmentData = track2.alignmentData;
172020
+ const { name: name2 } = alignmentData;
172021
+ const copySpecificAlignmentFasta = /* @__PURE__ */ __name(() => __async(this, null, function* () {
172022
+ const { selectionLayer: selectionLayer22 } = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2] || {};
172023
+ const seqDataToCopy = getSequenceDataBetweenRange(
172024
+ alignmentData,
172025
+ selectionLayer22
172026
+ ).sequence;
172027
+ const seqDataToCopyAsFasta = `>${name2}\r
172028
+ ${seqDataToCopy}\r
172029
+ `;
172030
+ yield navigator.clipboard.writeText(
172031
+ seqDataToCopyAsFasta
172032
+ );
172033
+ }), "copySpecificAlignmentFasta");
172034
+ const copySpecificAlignment = /* @__PURE__ */ __name(() => __async(this, null, function* () {
172035
+ const { selectionLayer: selectionLayer22 } = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2] || {};
172036
+ const seqDataToCopy = getSequenceDataBetweenRange(
172037
+ alignmentData,
172038
+ selectionLayer22
172039
+ ).sequence;
172040
+ yield navigator.clipboard.writeText(seqDataToCopy);
172041
+ }), "copySpecificAlignment");
172042
+ const getAllAlignmentsFastaText2 = /* @__PURE__ */ __name(() => __async(this, null, function* () {
172043
+ yield navigator.clipboard.writeText(
172044
+ getAllAlignmentsFastaText2()
172045
+ );
172046
+ }), "getAllAlignmentsFastaText2");
172047
+ showContextMenu(
172048
+ [
172049
+ ...additionalSelectionLayerRightClickedOptions ? additionalSelectionLayerRightClickedOptions(
172050
+ ...args,
172051
+ props
172052
+ ) : [],
172053
+ {
172054
+ text: "Copy Selection of All Alignments as Fasta",
172055
+ className: "copyAllAlignmentsFastaClipboardHelper",
172056
+ hotkey: "cmd+c",
172057
+ onClick: () => {
172058
+ getAllAlignmentsFastaText2();
172059
+ window.toastr.success("Selection Copied");
172060
+ }
172061
+ },
172062
+ {
172063
+ text: `Copy Selection of ${name2} as Fasta`,
172064
+ className: "copySpecificAlignmentFastaClipboardHelper",
172065
+ onClick: () => {
172066
+ copySpecificAlignmentFasta();
172067
+ window.toastr.success(
172068
+ "Selection Copied As Fasta"
172069
+ );
172070
+ }
172071
+ },
172072
+ {
172073
+ text: `Copy Selection of ${name2}`,
172074
+ className: "copySpecificAlignmentAsPlainClipboardHelper",
172075
+ onClick: () => {
172076
+ copySpecificAlignment();
172077
+ window.toastr.success("Selection Copied");
172078
+ }
172079
+ }
172080
+ ],
172081
+ void 0,
172082
+ event
172083
+ );
172084
+ },
172085
+ easyStore: easyStore2.current,
172086
+ sequenceLength: maxLength,
172087
+ charWidth: charWidth2,
172088
+ row: { start: 0, end: maxLength - 1 }
172089
+ }
172090
+ ),
172091
+ /* @__PURE__ */ React$2.createElement(
172092
+ PerformantCaret,
172093
+ {
172094
+ leftMargin: nameDivWidth,
172095
+ className: "veAlignmentSelectionLayer",
172096
+ isDraggable: true,
172097
+ sequenceLength: maxLength,
172098
+ charWidth: charWidth2,
172099
+ row: { start: 0, end: maxLength - 1 },
172100
+ easyStore: easyStore2.current
172101
+ }
172102
+ ),
172103
+ isTemplate ? renderItem(0, 0, isTemplate) : /* @__PURE__ */ React$2.createElement(
172104
+ ReactList,
172105
+ {
172106
+ ref: (c2) => {
172107
+ InfiniteScroller.current = c2;
172108
+ const domNode = ReactDOM$1.findDOMNode(c2);
172109
+ if (domNode instanceof HTMLElement) {
172110
+ drop_provided.innerRef(domNode);
172111
+ }
172112
+ },
172113
+ type: "variable",
172114
+ itemSizeEstimator: estimateRowHeight,
172115
+ itemRenderer: renderItem,
172116
+ length: alignmentTracks2.length + (drop_snapshot.isUsingPlaceholder ? 1 : 0)
172117
+ }
172118
+ )
172119
+ )
172120
+ )
172121
+ )
172122
+ );
172123
+ }, "innerTrackVis");
172124
+ if (isTemplate)
172125
+ return innerTrackVis();
172126
+ else
172127
+ return /* @__PURE__ */ React$2.createElement(
172128
+ ConnectedDroppable$1,
172129
+ {
172130
+ mode: "virtual",
172131
+ renderClone: (provided, snapshot, { source: { index: index2 } }) => {
172132
+ return renderItem(index2, index2, false, {
172133
+ provided,
172134
+ snapshot
172135
+ });
172136
+ },
172137
+ direction: "vertical",
172138
+ droppableId: "droppable" + isTemplate ? "_no_drop" : ""
172139
+ },
172140
+ innerTrackVis
172141
+ );
172142
+ }, "getTrackVis");
172143
+ const [firstTrack, ...otherTracks] = alignmentTracks;
172144
+ const totalWidthOfMinimap = width;
172145
+ const totalWidthInAlignmentView = 14 * getSequenceLength();
172146
+ const minSliderSize = Math.min(
172147
+ totalWidthOfMinimap * (totalWidthOfMinimap / totalWidthInAlignmentView),
172148
+ totalWidthOfMinimap
172149
+ );
172150
+ const viewportHeight = Math.max(
172151
+ document.documentElement.clientHeight,
172152
+ window.innerHeight || 0
172153
+ );
172154
+ const pinchHandler = {
172155
+ onPinch: ({ delta: [d2] }) => {
172156
+ bindOutsideChangeHelper.current.triggerChange(
172157
+ ({ value, changeValue }) => {
172158
+ if (d2 > 0) {
172159
+ if (value > 8) {
172160
+ changeValue(value + 0.4);
172161
+ } else {
172162
+ changeValue(value + 0.2);
172163
+ }
172164
+ } else if (d2 < 0) {
172165
+ if (value > 8) {
172166
+ changeValue(value - 0.4);
172167
+ } else {
172168
+ changeValue(value - 0.2);
172169
+ }
172170
+ }
172171
+ }
172172
+ );
172173
+ updateLabelsForInViewFeatures();
172174
+ }
172175
+ };
172176
+ return /* @__PURE__ */ React$2.createElement(PinchHelper, __spreadValues({}, pinchHandler), /* @__PURE__ */ React$2.createElement(ResizeSensor, { onResize: handleResize }, /* @__PURE__ */ React$2.createElement(
172177
+ "div",
172178
+ {
172179
+ style: __spreadValues({
172180
+ height: height2 || (isPairwise ? "auto" : viewportHeight * 0.88),
172181
+ display: "flex",
172182
+ flexDirection: "column",
172183
+ justifyContent: "space-between",
172184
+ position: "relative",
172185
+ overflowY: "auto"
172186
+ }, style2),
172187
+ className: "alignmentView"
172188
+ },
172189
+ /* @__PURE__ */ React$2.createElement(
172190
+ DragDropContext,
172191
+ {
172192
+ onDragStart: onTrackDragStart,
172193
+ onDragEnd: onTrackDragEnd
172194
+ },
172195
+ /* @__PURE__ */ React$2.createElement(
172196
+ "div",
172197
+ {
172198
+ style: {
172199
+ display: "flex",
172200
+ flexDirection: "column",
172201
+ position: "relative",
172202
+ overflowY: "auto"
172203
+ },
172204
+ className: "alignmentView-top-container"
172205
+ },
172206
+ /* @__PURE__ */ React$2.createElement(
172207
+ "div",
172208
+ {
172209
+ style: {
172210
+ paddingTop: "3px",
172211
+ paddingBottom: "5px",
172212
+ borderBottom: "1px solid",
172213
+ display: "flex",
172214
+ minHeight: "32px",
172215
+ width: "100%",
172216
+ flexWrap: "nowrap",
172217
+ flexDirection: "row",
172218
+ flex: "0 0 auto"
172219
+ },
172220
+ className: "ve-alignment-top-bar"
172221
+ },
172222
+ additionalTopLeftEl,
172223
+ handleBackButtonClicked && /* @__PURE__ */ React$2.createElement(Tooltip, { content: "Back to Pairwise Alignment Overview" }, /* @__PURE__ */ React$2.createElement(
172224
+ Button,
172225
+ {
172226
+ icon: "arrow-left",
172227
+ onClick: () => {
172228
+ handleBackButtonClicked();
172229
+ caretPositionUpdate2(-1);
172230
+ },
172231
+ small: true,
172232
+ intent: Intent.PRIMARY,
172233
+ minimal: true,
172234
+ style: { marginRight: 10 },
172235
+ className: "alignmentViewBackButton"
172236
+ }
172237
+ )),
172238
+ /* @__PURE__ */ React$2.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ React$2.createElement(
172239
+ EditableText,
172240
+ {
172241
+ disabled: !handleAlignmentRename,
172242
+ onChange: (v2) => {
172243
+ setAlignmentName(v2);
172244
+ },
172245
+ maxLength: 399,
172246
+ value: alignmentName,
172247
+ onConfirm: (v2) => __async(this, null, function* () {
172248
+ if (!v2) {
172249
+ setAlignmentName(_alignmentName);
172250
+ return;
172251
+ }
172252
+ if (v2 === _alignmentName) {
172253
+ return;
172254
+ }
172255
+ setSaveMessage("Alignment Renaming..");
172256
+ setSaveMessageLoading(true);
172257
+ yield handleAlignmentRename(v2, props);
172258
+ setSaveMessage("Rename Successful");
172259
+ setSaveMessageLoading(false);
172260
+ setTimeout(() => {
172261
+ setSaveMessage(void 0);
172262
+ setSaveMessageLoading(false);
172263
+ }, 5e3);
172264
+ }),
172265
+ selectAllOnFocus: true,
172266
+ className: "veAlignmentName"
172267
+ }
172268
+ ), "   ", /* @__PURE__ */ React$2.createElement(
172269
+ "div",
172270
+ {
172271
+ className: "veAlignmentType",
172272
+ style: {
172273
+ paddingTop: "3px",
172274
+ fontSize: "14px",
172275
+ color: "grey",
172276
+ maxWidth: "300px",
172277
+ overflow: "hidden",
172278
+ textOverflow: "ellipsis",
172279
+ whiteSpace: "nowrap"
172280
+ },
172281
+ "data-title": alignmentType || "Unknown Alignment Type"
172282
+ },
172283
+ alignmentType || "Unknown Alignment Type"
172284
+ )),
172285
+ unmappedSeqs && /* @__PURE__ */ React$2.createElement(
172286
+ InfoHelper,
172287
+ {
172288
+ size: 20,
172289
+ content: /* @__PURE__ */ React$2.createElement("div", null, "This alignment had sequences that did not map to the template sequence:", unmappedSeqs.map(({ sequenceData: sequenceData22 }, i2) => /* @__PURE__ */ React$2.createElement("div", { key: i2 }, sequenceData22.name))),
172290
+ intent: "warning",
172291
+ icon: "warning-sign"
172292
+ }
172293
+ ),
172294
+ !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172295
+ UncontrolledSliderWithPlusMinusBtns,
172296
+ {
172297
+ noWraparound: true,
172298
+ bindOutsideChangeHelper: bindOutsideChangeHelper.current,
172299
+ onClick: () => {
172300
+ setTimeout(scrollToCaret2, 0);
172301
+ },
172302
+ minCharWidth: getMinCharWidth(),
172303
+ onChange: (zoomLvl) => __async(this, null, function* () {
172304
+ isZooming.current = true;
172305
+ setTimeout(() => {
172306
+ isZooming.current = false;
172307
+ }, 10);
172308
+ const minCharWidth = getMinCharWidth();
172309
+ const scaleFactor = Math.pow(12 / minCharWidth, 1 / 10);
172310
+ const newCharWidth = minCharWidth * Math.pow(scaleFactor, zoomLvl);
172311
+ yield setCharWidthInLinearView({
172312
+ charWidthInLinearView: newCharWidth
172313
+ });
172314
+ yield scrollToCaret2();
172315
+ yield updateLabelsForInViewFeatures({
172316
+ rectElement: ".alignmentHolder"
172317
+ });
172318
+ }),
172319
+ coerceInitialValue,
172320
+ title: "Adjust Zoom Level",
172321
+ style: { paddingTop: "4px", width: 100 },
172322
+ className: "veZoomAlignmentSlider ove-slider",
172323
+ labelRenderer: false,
172324
+ initialValue: charWidth2,
172325
+ stepSize: 0.05,
172326
+ max: 10,
172327
+ min: 0,
172328
+ clickStepSize: 0.5
172329
+ }
172330
+ ),
172331
+ !noVisibilityOptions && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172332
+ AlignmentVisibilityTool,
172333
+ __spreadValues({
172334
+ currentPairwiseAlignmentIndex
172335
+ }, alignmentVisibilityToolOptions)
172336
+ ),
172337
+ updateAlignmentSortOrder && !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172338
+ Popover,
172339
+ {
172340
+ minimal: true,
172341
+ content: /* @__PURE__ */ React$2.createElement(Menu, null, /* @__PURE__ */ React$2.createElement(
172342
+ MenuItem,
172343
+ {
172344
+ active: true,
172345
+ onClick: () => {
172346
+ updateAlignmentSortOrder("Position");
172347
+ },
172348
+ text: "Position"
172349
+ }
172350
+ ), /* @__PURE__ */ React$2.createElement(
172351
+ MenuItem,
172352
+ {
172353
+ active: alignmentSortOrder,
172354
+ onClick: () => {
172355
+ updateAlignmentSortOrder("Alphabetical");
172356
+ },
172357
+ text: "Alphabetical"
172358
+ }
172359
+ )),
172360
+ target: /* @__PURE__ */ React$2.createElement(
172361
+ Button,
172362
+ {
172363
+ small: true,
172364
+ text: "Sort Order",
172365
+ rightIcon: "caret-down",
172366
+ icon: "sort"
172367
+ }
172368
+ )
172369
+ }
172370
+ ),
172371
+ additionalTopEl,
172372
+ saveMessage && /* @__PURE__ */ React$2.createElement(
172373
+ "div",
172374
+ {
172375
+ className: "ove-menu-toast",
172376
+ style: {
172377
+ display: "flex",
172378
+ alignItems: "center",
172379
+ marginLeft: "auto",
172380
+ marginRight: 10
172381
+ }
172382
+ },
172383
+ saveMessageLoading ? /* @__PURE__ */ React$2.createElement("div", null, /* @__PURE__ */ React$2.createElement(Spinner, { size: 15 })) : /* @__PURE__ */ React$2.createElement(Icon, { icon: "tick-circle", intent: "success" }),
172384
+ " ",
172385
+ " ",
172386
+ saveMessage
172387
+ )
172388
+ ),
172389
+ hasTemplate ? /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement("div", { className: "alignmentTrackFixedToTop" }, getTrackVis([firstTrack], true, alignmentTracks)), getTrackVis(otherTracks, false, alignmentTracks)) : getTrackVis(alignmentTracks, false, alignmentTracks)
172390
+ )
172391
+ ),
172392
+ !isInPairwiseOverviewView && /* @__PURE__ */ React$2.createElement(
172393
+ "div",
172394
+ {
172395
+ className: "alignmentViewBottomBar",
172396
+ style: {
172397
+ // flexGrow: 1,
172398
+ // minHeight: "-webkit-min-content", //https://stackoverflow.com/questions/28029736/how-to-prevent-a-flex-item-from-shrinking-smaller-than-its-content
172399
+ maxHeight: 210,
172400
+ marginTop: 4,
172401
+ paddingTop: 4,
172402
+ borderTop: "1px solid lightgrey",
172403
+ display: "flex"
172404
+ }
172405
+ },
172406
+ /* @__PURE__ */ React$2.createElement(
172407
+ Minimap,
172408
+ {
172409
+ selectionLayerComp: /* @__PURE__ */ React$2.createElement(React$2.Fragment, null, /* @__PURE__ */ React$2.createElement(
172410
+ PerformantSelectionLayer,
172411
+ {
172412
+ is: true,
172413
+ hideCarets: true,
172414
+ className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
172415
+ easyStore: easyStore2.current,
172416
+ sequenceLength: maxLength,
172417
+ charWidth: getMinCharWidth(true),
172418
+ row: { start: 0, end: maxLength - 1 }
172419
+ }
172420
+ ), /* @__PURE__ */ React$2.createElement(
172421
+ PerformantCaret,
172422
+ {
172423
+ style: {
172424
+ opacity: 0.2
172425
+ },
172426
+ className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
172427
+ sequenceLength: maxLength,
172428
+ charWidth: getMinCharWidth(true),
172429
+ row: { start: 0, end: maxLength - 1 },
172430
+ easyStore: easyStore2.current
172431
+ }
172432
+ )),
172433
+ alignmentTracks,
172434
+ dimensions: {
172435
+ width: Math.max(width, 10) || 10
172436
+ },
172437
+ nameDivOffsetPercent: 0,
172438
+ scrollYToTrack,
172439
+ onSizeAdjust: onMinimapSizeAdjust,
172440
+ minSliderSize,
172441
+ laneHeight: minimapLaneHeight || (alignmentTracks.length > 5 ? 10 : 17),
172442
+ laneSpacing: minimapLaneSpacing || (alignmentTracks.length > 5 ? 2 : 1),
172443
+ easyStore: easyStore2.current,
172444
+ numBpsShownInLinearView: getNumBpsShownInLinearView(),
172445
+ scrollAlignmentView: false,
172446
+ onMinimapScrollX: scrollAlignmentToPercent
172447
+ }
172448
+ )
172449
+ ),
172450
+ /* @__PURE__ */ React$2.createElement(
172451
+ GlobalDialog,
172452
+ null
172453
+ )
172454
+ )));
172455
+ }, "AlignmentView");
172447
172456
  const AlignmentView$1 = compose(
172448
172457
  withStore,
172449
172458
  withEditorProps,