@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.es.js CHANGED
@@ -17944,25 +17944,16 @@ var getIntrinsic = /* @__PURE__ */ __name(function GetIntrinsic(name2, allowMiss
17944
17944
  return value;
17945
17945
  }, "GetIntrinsic");
17946
17946
  var callBind$3 = { exports: {} };
17947
- var esDefineProperty;
17948
- var hasRequiredEsDefineProperty;
17949
- function requireEsDefineProperty() {
17950
- if (hasRequiredEsDefineProperty)
17951
- return esDefineProperty;
17952
- hasRequiredEsDefineProperty = 1;
17953
- var GetIntrinsic3 = getIntrinsic;
17954
- var $defineProperty2 = GetIntrinsic3("%Object.defineProperty%", true) || false;
17955
- if ($defineProperty2) {
17956
- try {
17957
- $defineProperty2({}, "a", { value: 1 });
17958
- } catch (e2) {
17959
- $defineProperty2 = false;
17960
- }
17947
+ var GetIntrinsic$4 = getIntrinsic;
17948
+ var $defineProperty$2 = GetIntrinsic$4("%Object.defineProperty%", true) || false;
17949
+ if ($defineProperty$2) {
17950
+ try {
17951
+ $defineProperty$2({}, "a", { value: 1 });
17952
+ } catch (e2) {
17953
+ $defineProperty$2 = false;
17961
17954
  }
17962
- esDefineProperty = $defineProperty2;
17963
- return esDefineProperty;
17964
17955
  }
17965
- __name(requireEsDefineProperty, "requireEsDefineProperty");
17956
+ var esDefineProperty = $defineProperty$2;
17966
17957
  var GetIntrinsic$3 = getIntrinsic;
17967
17958
  var $gOPD$1 = GetIntrinsic$3("%Object.getOwnPropertyDescriptor%", true);
17968
17959
  if ($gOPD$1) {
@@ -17973,7 +17964,7 @@ if ($gOPD$1) {
17973
17964
  }
17974
17965
  }
17975
17966
  var gopd$1 = $gOPD$1;
17976
- var $defineProperty$1 = requireEsDefineProperty();
17967
+ var $defineProperty$1 = esDefineProperty;
17977
17968
  var $SyntaxError = syntax;
17978
17969
  var $TypeError$4 = type$1;
17979
17970
  var gopd = gopd$1;
@@ -18014,7 +18005,7 @@ var defineDataProperty$1 = /* @__PURE__ */ __name(function defineDataProperty(ob
18014
18005
  throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
18015
18006
  }
18016
18007
  }, "defineDataProperty");
18017
- var $defineProperty = requireEsDefineProperty();
18008
+ var $defineProperty = esDefineProperty;
18018
18009
  var hasPropertyDescriptors = /* @__PURE__ */ __name(function hasPropertyDescriptors2() {
18019
18010
  return !!$defineProperty;
18020
18011
  }, "hasPropertyDescriptors");
@@ -18083,7 +18074,7 @@ var setFunctionLength = /* @__PURE__ */ __name(function setFunctionLength2(fn4,
18083
18074
  var $apply = GetIntrinsic3("%Function.prototype.apply%");
18084
18075
  var $call = GetIntrinsic3("%Function.prototype.call%");
18085
18076
  var $reflectApply = GetIntrinsic3("%Reflect.apply%", true) || bind3.call($call, $apply);
18086
- var $defineProperty2 = requireEsDefineProperty();
18077
+ var $defineProperty2 = esDefineProperty;
18087
18078
  var $max = GetIntrinsic3("%Math.max%");
18088
18079
  module2.exports = /* @__PURE__ */ __name(function callBind2(originalFunction) {
18089
18080
  if (typeof originalFunction !== "function") {
@@ -116252,21 +116243,20 @@ var pluralize$1 = { exports: {} };
116252
116243
  })(pluralize$1);
116253
116244
  var pluralizeExports = pluralize$1.exports;
116254
116245
  const pluralize = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
116255
- function Caret$2(props) {
116256
- const {
116257
- charWidth: charWidth2,
116258
- row,
116259
- sequenceLength,
116260
- caretPosition: caretPosition2,
116261
- isProtein: isProtein2,
116262
- onClick,
116263
- isDraggable,
116264
- leftMargin = 0,
116265
- onRightClick,
116266
- style: style2,
116267
- selectionMessage,
116268
- className = ""
116269
- } = props;
116246
+ function Caret$2({
116247
+ charWidth: charWidth2,
116248
+ row,
116249
+ sequenceLength,
116250
+ caretPosition: caretPosition2,
116251
+ isProtein: isProtein2,
116252
+ onClick,
116253
+ isDraggable,
116254
+ leftMargin = 0,
116255
+ onRightClick,
116256
+ style: style2,
116257
+ selectionMessage,
116258
+ className = ""
116259
+ }) {
116270
116260
  if (row.start <= caretPosition2 && row.end + 1 >= caretPosition2 || row.end === sequenceLength - 1 && row.end < caretPosition2) {
116271
116261
  const cursorEl = /* @__PURE__ */ React__default$1.createElement(
116272
116262
  "div",
@@ -119816,7 +119806,7 @@ const annotationsToCompute = {
119816
119806
  hasYOffset: true
119817
119807
  }
119818
119808
  };
119819
- const estimateRowHeight = /* @__PURE__ */ __name((props) => {
119809
+ const _estimateRowHeight = /* @__PURE__ */ __name((props) => {
119820
119810
  let {
119821
119811
  index: index2,
119822
119812
  cache: cache2,
@@ -119874,7 +119864,7 @@ const estimateRowHeight = /* @__PURE__ */ __name((props) => {
119874
119864
  }
119875
119865
  cache2[index2] = totalHeight;
119876
119866
  return totalHeight;
119877
- }, "estimateRowHeight");
119867
+ }, "_estimateRowHeight");
119878
119868
  function getHeights(heightKey, props) {
119879
119869
  const annotationHeight = !heightKey ? 0 : props[heightKey + "Height"] || (rowHeights[heightKey] || {}).height || 0;
119880
119870
  const marginHeight = (props[heightKey + "MarginTop"] || (rowHeights[heightKey] || {}).marginTop || 0) + (props[heightKey + "MarginBottom"] || (rowHeights[heightKey] || {}).marginBottom || 0);
@@ -121155,7 +121145,7 @@ function showFileDialog({ multiple = false, onSelect }) {
121155
121145
  }
121156
121146
  __name(showFileDialog, "showFileDialog");
121157
121147
  const name = "@teselagen/ove";
121158
- const version = "0.7.6";
121148
+ const version = "0.7.7";
121159
121149
  const main = "./src/index.js";
121160
121150
  const type = "module";
121161
121151
  const exports$1 = {
@@ -139413,7 +139403,7 @@ const __RowView = class __RowView extends React__default$1.Component {
139413
139403
  //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
139414
139404
  __publicField(this, "estimateRowHeight", /* @__PURE__ */ __name((index2, cache2) => {
139415
139405
  const { annotationVisibility: annotationVisibility2, annotationLabelVisibility: annotationLabelVisibility2, sequenceData: sequenceData2 } = this.props;
139416
- return estimateRowHeight({
139406
+ return _estimateRowHeight({
139417
139407
  index: index2,
139418
139408
  cache: cache2,
139419
139409
  chromatogramData: sequenceData2.chromatogramData,
@@ -144054,21 +144044,125 @@ try {
144054
144044
  e2
144055
144045
  );
144056
144046
  }
144057
- const _AlignmentView = class _AlignmentView extends React__default$1.Component {
144058
- constructor(props) {
144059
- super(props);
144060
- __publicField(this, "bindOutsideChangeHelper", {});
144061
- __publicField(this, "getMaxLength", /* @__PURE__ */ __name(() => {
144062
- const { alignmentTracks } = this.props;
144063
- const { sequenceData: sequenceData2 = { sequence: "" }, alignmentData } = alignmentTracks[0];
144064
- const data = alignmentData || sequenceData2;
144065
- return data.noSequence ? data.size : data.sequence.length;
144066
- }, "getMaxLength"));
144067
- __publicField(this, "handleAlignmentCopy", /* @__PURE__ */ __name((event) => {
144047
+ const AlignmentView = /* @__PURE__ */ __name((props) => {
144048
+ const {
144049
+ alignmentType,
144050
+ alignmentRunUpdate: alignmentRunUpdate2,
144051
+ alignmentName: _alignmentName,
144052
+ caretPosition: caretPosition2,
144053
+ handleAlignmentSave,
144054
+ id: id2,
144055
+ isFullyZoomedOut,
144056
+ scrollPercentageToJumpTo,
144057
+ selectionLayer: selectionLayer2,
144058
+ sequenceData: sequenceData2,
144059
+ sequenceLength,
144060
+ shouldAutosave,
144061
+ store: store2,
144062
+ height: height2,
144063
+ minimapLaneHeight,
144064
+ minimapLaneSpacing,
144065
+ isInPairwiseOverviewView,
144066
+ noVisibilityOptions,
144067
+ updateAlignmentSortOrder,
144068
+ alignmentSortOrder,
144069
+ handleBackButtonClicked,
144070
+ allowTrimming,
144071
+ additionalSelectionLayerRightClickedOptions,
144072
+ selectionLayerRightClicked,
144073
+ additionalTopEl,
144074
+ additionalTopLeftEl,
144075
+ handleAlignmentRename,
144076
+ stateTrackingId,
144077
+ style: style2,
144078
+ unmappedSeqs
144079
+ } = props;
144080
+ const _a2 = props, {
144081
+ alignmentId,
144082
+ alignmentTrackIndex,
144083
+ alignmentTracks = [],
144084
+ alignmentVisibilityToolOptions,
144085
+ allowTrackNameEdit,
144086
+ allowTrackRearrange,
144087
+ currentPairwiseAlignmentIndex,
144088
+ handleSelectTrack,
144089
+ hasTemplate,
144090
+ isPairwise,
144091
+ linearViewOptions,
144092
+ noClickDragHandlers,
144093
+ pairwiseAlignments,
144094
+ pairwiseOverviewAlignmentTracks,
144095
+ upsertAlignmentRun: upsertAlignmentRun2
144096
+ } = _a2, rest = __objRest(_a2, [
144097
+ "alignmentId",
144098
+ "alignmentTrackIndex",
144099
+ "alignmentTracks",
144100
+ "alignmentVisibilityToolOptions",
144101
+ "allowTrackNameEdit",
144102
+ "allowTrackRearrange",
144103
+ "currentPairwiseAlignmentIndex",
144104
+ "handleSelectTrack",
144105
+ "hasTemplate",
144106
+ "isPairwise",
144107
+ "linearViewOptions",
144108
+ "noClickDragHandlers",
144109
+ "pairwiseAlignments",
144110
+ "pairwiseOverviewAlignmentTracks",
144111
+ "upsertAlignmentRun"
144112
+ ]);
144113
+ const [width, setWidth] = useState(0);
144114
+ const [nameDivWidth, setNameDivWidth] = useState(140);
144115
+ const [charWidthInLinearView, _setCharWidthInLinearView] = useState(
144116
+ charWidthInLinearViewDefault
144117
+ );
144118
+ const [alignmentName, setAlignmentName] = useState(_alignmentName);
144119
+ const [isTrackDragging, setIsTrackDragging] = useState(false);
144120
+ const [saveMessage, setSaveMessage] = useState();
144121
+ const [saveMessageLoading, setSaveMessageLoading] = useState(false);
144122
+ const [tempTrimBefore, setTempTrimBefore] = useState({});
144123
+ const [tempTrimAfter, setTempTrimAfter] = useState({});
144124
+ const [tempTrimmingCaret, setTempTrimmingCaret] = useState({});
144125
+ const bindOutsideChangeHelper = useRef({});
144126
+ const alignmentHolder = useRef(null);
144127
+ const alignmentHolderTop = useRef(null);
144128
+ const veTracksAndAlignmentHolder = useRef(null);
144129
+ const InfiniteScroller = useRef(null);
144130
+ const oldAlignmentHolderScrollTop = useRef(0);
144131
+ const blockScroll = useRef(false);
144132
+ const isZooming = useRef(false);
144133
+ const rowData = useRef({});
144134
+ const latestMouseY = useRef();
144135
+ const easyStore2 = useRef(
144136
+ store$1({
144137
+ selectionLayer: { start: -1, end: -1 },
144138
+ caretPosition: -1,
144139
+ percentScrolled: 0,
144140
+ viewportWidth: 400,
144141
+ verticalVisibleRange: { start: 0, end: 0 }
144142
+ })
144143
+ );
144144
+ const getAllAlignmentsFastaText = useCallback$1(() => {
144145
+ const selectionLayer22 = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2].selectionLayer || {};
144146
+ const seqDataOfAllTracksToCopy = [];
144147
+ alignmentTracks.forEach((track2) => {
144148
+ const seqDataToCopy = getSequenceDataBetweenRange(
144149
+ track2.alignmentData,
144150
+ selectionLayer22
144151
+ ).sequence;
144152
+ seqDataOfAllTracksToCopy.push(
144153
+ `>${track2.alignmentData.name}\r
144154
+ ${seqDataToCopy}\r
144155
+ `
144156
+ );
144157
+ });
144158
+ return seqDataOfAllTracksToCopy.join("");
144159
+ }, [alignmentTracks, id2, store2]);
144160
+ useEffect(() => {
144161
+ const handleAlignmentCopy = /* @__PURE__ */ __name((event) => {
144068
144162
  if (event.key === "c" && !event.shiftKey && (event.metaKey === true || event.ctrlKey === true)) {
144069
144163
  const input = document.createElement("textarea");
144070
144164
  document.body.appendChild(input);
144071
- const seqDataToCopy = this.getAllAlignmentsFastaText();
144165
+ const seqDataToCopy = getAllAlignmentsFastaText();
144072
144166
  input.value = seqDataToCopy;
144073
144167
  input.select();
144074
144168
  const copySuccess = document.execCommand("copy");
@@ -144080,1319 +144174,688 @@ const _AlignmentView = class _AlignmentView extends React__default$1.Component {
144080
144174
  document.body.removeChild(input);
144081
144175
  event.preventDefault();
144082
144176
  }
144083
- }, "handleAlignmentCopy"));
144084
- __publicField(this, "getAllAlignmentsFastaText", /* @__PURE__ */ __name(() => {
144085
- const selectionLayer2 = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id].selectionLayer || {};
144086
- const { alignmentTracks } = this.props;
144087
- const seqDataOfAllTracksToCopy = [];
144088
- alignmentTracks.forEach((track2) => {
144089
- const seqDataToCopy = getSequenceDataBetweenRange(
144090
- track2.alignmentData,
144091
- selectionLayer2
144092
- ).sequence;
144093
- seqDataOfAllTracksToCopy.push(
144094
- `>${track2.alignmentData.name}\r
144095
- ${seqDataToCopy}\r
144096
- `
144097
- );
144098
- });
144099
- return seqDataOfAllTracksToCopy.join("");
144100
- }, "getAllAlignmentsFastaText"));
144101
- __publicField(this, "state", {
144102
- alignmentName: this.props.alignmentName,
144103
- isTrackDragging: false,
144104
- charWidthInLinearView: charWidthInLinearViewDefault,
144105
- scrollAlignmentView: false,
144106
- width: 0,
144107
- nameDivWidth: 140
144108
- });
144109
- __publicField(this, "easyStore", store$1({
144110
- selectionLayer: { start: -1, end: -1 },
144111
- caretPosition: -1,
144112
- percentScrolled: 0,
144113
- viewportWidth: 400,
144114
- verticalVisibleRange: { start: 0, end: 0 }
144115
- }));
144116
- __publicField(this, "getMinCharWidth", /* @__PURE__ */ __name((noNameDiv) => {
144177
+ }, "handleAlignmentCopy");
144178
+ document.addEventListener("keydown", handleAlignmentCopy);
144179
+ return () => {
144180
+ document.removeEventListener("keydown", handleAlignmentCopy);
144181
+ };
144182
+ }, [getAllAlignmentsFastaText]);
144183
+ const scrollAlignmentToPercent = /* @__PURE__ */ __name((scrollPercentage) => {
144184
+ const scrollPercentageToUse = Math.min(Math.max(scrollPercentage, 0), 1);
144185
+ easyStore2.current.percentScrolled = scrollPercentageToUse;
144186
+ alignmentHolder.current.scrollLeft = scrollPercentageToUse * (alignmentHolder.current.scrollWidth - alignmentHolder.current.clientWidth);
144187
+ if (alignmentHolderTop.current) {
144188
+ alignmentHolderTop.current.scrollLeft = scrollPercentageToUse * (alignmentHolderTop.current.scrollWidth - alignmentHolderTop.current.clientWidth);
144189
+ }
144190
+ }, "scrollAlignmentToPercent");
144191
+ useEffect(() => {
144192
+ window.scrollAlignmentToPercent = scrollAlignmentToPercent;
144193
+ if (window.Cypress)
144194
+ window.Cypress.scrollAlignmentToPercent = scrollAlignmentToPercent;
144195
+ return () => {
144196
+ delete window.scrollAlignmentToPercent;
144197
+ if (window.Cypress)
144198
+ delete window.Cypress.scrollAlignmentToPercent;
144199
+ };
144200
+ }, []);
144201
+ const maxLength = useMemo$1(() => {
144202
+ const { sequenceData: sequenceData22 = { sequence: "" }, alignmentData } = alignmentTracks[0];
144203
+ const data = alignmentData || sequenceData22;
144204
+ return data.noSequence ? data.size : data.sequence.length;
144205
+ }, [alignmentTracks]);
144206
+ const getSequenceLength = useCallback$1(() => {
144207
+ var _a3, _b2, _c;
144208
+ return ((_c = (_b2 = (_a3 = alignmentTracks == null ? void 0 : alignmentTracks[0]) == null ? void 0 : _a3.alignmentData) == null ? void 0 : _b2.sequence) == null ? void 0 : _c.length) || 1;
144209
+ }, [alignmentTracks]);
144210
+ const getMinCharWidth = useCallback$1(
144211
+ (noNameDiv) => {
144117
144212
  const toReturn = Math.min(
144118
- Math.max(
144119
- this.state.width - (noNameDiv ? 0 : this.state.nameDivWidth) - 5,
144120
- 1
144121
- ) / this.getSequenceLength(),
144213
+ Math.max(width - (noNameDiv ? 0 : nameDivWidth) - 5, 1) / getSequenceLength(),
144122
144214
  10
144123
144215
  );
144124
144216
  if (isNaN(toReturn))
144125
144217
  return 10;
144126
144218
  return toReturn;
144127
- }, "getMinCharWidth"));
144128
- __publicField(this, "getSequenceLength", /* @__PURE__ */ __name(() => {
144129
- const { alignmentTracks: [template] = [] } = this.props;
144130
- return template.alignmentData.sequence.length || 1;
144131
- }, "getSequenceLength"));
144132
- __publicField(this, "annotationClicked", /* @__PURE__ */ __name(({
144133
- event,
144134
- annotation,
144135
- gapsBefore = 0,
144136
- gapsInside = 0
144137
- }) => {
144138
- event.preventDefault && event.preventDefault();
144139
- event.stopPropagation && event.stopPropagation();
144140
- this.updateSelectionOrCaret(event.shiftKey, __spreadProps(__spreadValues({}, annotation), {
144141
- start: annotation.start + gapsBefore,
144142
- end: annotation.end + gapsBefore + gapsInside
144143
- }));
144144
- }, "annotationClicked"));
144145
- __publicField(this, "updateSelectionOrCaret", /* @__PURE__ */ __name((shiftHeld, newRangeOrCaret, { forceReduxUpdate } = {}) => {
144146
- const sequenceLength = this.getSequenceLength();
144147
- updateSelectionOrCaret({
144148
- doNotWrapOrigin: true,
144149
- shiftHeld,
144150
- sequenceLength,
144151
- newRangeOrCaret,
144152
- caretPosition: this.easyStore.caretPosition,
144153
- selectionLayer: this.easyStore.selectionLayer,
144154
- selectionLayerUpdate: forceReduxUpdate ? this.forceReduxSelectionLayerUpdate : this.selectionLayerUpdate,
144155
- caretPositionUpdate: this.caretPositionUpdate
144156
- });
144157
- }, "updateSelectionOrCaret"));
144158
- __publicField(this, "caretPositionUpdate", /* @__PURE__ */ __name((position2) => {
144159
- const { caretPosition: caretPosition2 = -1, alignmentId } = this.props;
144160
- if (caretPosition2 === position2) {
144219
+ },
144220
+ [getSequenceLength, nameDivWidth, width]
144221
+ );
144222
+ const charWidth2 = useMemo$1(() => {
144223
+ if (isFullyZoomedOut) {
144224
+ return getMinCharWidth();
144225
+ } else {
144226
+ return Math.max(getMinCharWidth(), charWidthInLinearView);
144227
+ }
144228
+ }, [charWidthInLinearView, getMinCharWidth, isFullyZoomedOut]);
144229
+ const debouncedAlignmentRunUpdate = debounce$1(alignmentRunUpdate2, 1e3);
144230
+ const caretPositionUpdate2 = useCallback$1(
144231
+ (position2) => {
144232
+ if ((caretPosition2 || -1) === position2) {
144161
144233
  return;
144162
144234
  }
144163
- this.easyStore.caretPosition = position2;
144164
- this.easyStore.selectionLayer = { start: -1, end: -1 };
144165
- this.debouncedAlignmentRunUpdate({
144235
+ easyStore2.current.caretPosition = position2;
144236
+ easyStore2.current.selectionLayer = { start: -1, end: -1 };
144237
+ debouncedAlignmentRunUpdate({
144166
144238
  alignmentId,
144167
144239
  selectionLayer: { start: -1, end: -1 },
144168
144240
  caretPosition: position2
144169
144241
  });
144170
- }, "caretPositionUpdate"));
144171
- __publicField(this, "debouncedAlignmentRunUpdate", debounce$1(this.props.alignmentRunUpdate, 1e3));
144172
- __publicField(this, "forceReduxSelectionLayerUpdate", /* @__PURE__ */ __name((newSelection) => {
144173
- this.selectionLayerUpdate(newSelection, { forceReduxUpdate: true });
144174
- }, "forceReduxSelectionLayerUpdate"));
144175
- __publicField(this, "selectionLayerUpdate", /* @__PURE__ */ __name((newSelection, { forceReduxUpdate } = {}) => {
144176
- const { selectionLayer: selectionLayer2 = { start: -1, end: -1 }, alignmentId } = this.props;
144242
+ },
144243
+ [alignmentId, caretPosition2, debouncedAlignmentRunUpdate]
144244
+ );
144245
+ const selectionLayerUpdate2 = useCallback$1(
144246
+ (newSelection, { forceReduxUpdate } = {}) => {
144247
+ const usableSelectionLayer = selectionLayer2 || { start: -1, end: -1 };
144177
144248
  if (!newSelection)
144178
144249
  return;
144179
144250
  const { start: start2, end: end2 } = newSelection;
144180
- if (selectionLayer2.start === start2 && selectionLayer2.end === end2) {
144251
+ if (usableSelectionLayer.start === start2 && usableSelectionLayer.end === end2) {
144181
144252
  return;
144182
144253
  }
144183
- this.easyStore.caretPosition = -1;
144184
- this.easyStore.selectionLayer = newSelection;
144185
- (forceReduxUpdate ? this.props.alignmentRunUpdate : this.debouncedAlignmentRunUpdate)({
144254
+ easyStore2.current.caretPosition = -1;
144255
+ easyStore2.current.selectionLayer = newSelection;
144256
+ (forceReduxUpdate ? alignmentRunUpdate2 : debouncedAlignmentRunUpdate)({
144186
144257
  alignmentId,
144187
144258
  selectionLayer: newSelection,
144188
144259
  caretPosition: -1
144189
144260
  });
144190
- }, "selectionLayerUpdate"));
144191
- __publicField(this, "getCharWidthInLinearView", /* @__PURE__ */ __name(() => {
144192
- if (this.props.isFullyZoomedOut) {
144193
- return this.getMinCharWidth();
144194
- } else {
144195
- return Math.max(this.getMinCharWidth(), this.state.charWidthInLinearView);
144196
- }
144197
- }, "getCharWidthInLinearView"));
144198
- __publicField(this, "getNumBpsShownInLinearView", /* @__PURE__ */ __name(() => {
144199
- const toReturn = (this.state.width - this.state.nameDivWidth) / this.getCharWidthInLinearView();
144200
- return toReturn || 0;
144201
- }, "getNumBpsShownInLinearView"));
144202
- __publicField(this, "setVerticalScrollRange", throttle$1(() => {
144203
- if (this && this.InfiniteScroller && this.InfiniteScroller.getFractionalVisibleRange && this.easyStore) {
144204
- let [start2, end2] = this.InfiniteScroller.getFractionalVisibleRange();
144205
- if (this.props.hasTemplate) {
144206
- end2 = end2 + 1;
144207
- }
144208
- if (this.easyStore.verticalVisibleRange.start !== start2 || this.easyStore.verticalVisibleRange.end !== end2)
144209
- this.easyStore.verticalVisibleRange = { start: start2, end: end2 };
144210
- }
144211
- }, 100));
144212
- __publicField(this, "handleScroll", /* @__PURE__ */ __name(() => {
144213
- if (this.alignmentHolder.scrollTop !== this.oldAlignmentHolderScrollTop) {
144214
- setTimeout(() => {
144215
- this.setVerticalScrollRange();
144216
- this.oldAlignmentHolderScrollTop = this.alignmentHolder.scrollTop;
144217
- }, 100);
144218
- }
144219
- if (this.blockScroll) {
144220
- return;
144221
- }
144222
- const scrollPercentage = this.alignmentHolder.scrollLeft / (this.alignmentHolder.scrollWidth - this.alignmentHolder.clientWidth);
144223
- this.easyStore.percentScrolled = scrollPercentage || 0;
144224
- if (!this.isZooming) {
144225
- this.easyStore.percentScrolledPreZoom = this.easyStore.percentScrolled;
144226
- }
144227
- if (this.alignmentHolderTop) {
144228
- this.alignmentHolderTop.scrollLeft = this.alignmentHolder.scrollLeft;
144229
- }
144230
- updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144231
- }, "handleScroll"));
144232
- __publicField(this, "handleTopScroll", /* @__PURE__ */ __name(() => {
144233
- this.alignmentHolder.scrollLeft = this.alignmentHolderTop.scrollLeft;
144234
- }, "handleTopScroll"));
144235
- /**
144236
- * Responsible for handling resizing the highlighted region of the minimap
144237
- * @param {*} newSliderSize
144238
- * @param {*} newPercent
144239
- */
144240
- __publicField(this, "onMinimapSizeAdjust", /* @__PURE__ */ __name((newSliderSize, newPercent) => {
144241
- const percentageOfSpace = newSliderSize / this.state.width;
144242
- const seqLength = this.getSequenceLength();
144243
- const numBpsInView = seqLength * percentageOfSpace;
144244
- const newCharWidth = (this.state.width - this.state.nameDivWidth) / numBpsInView;
144245
- this.blockScroll = true;
144246
- this.setCharWidthInLinearView({ charWidthInLinearView: newCharWidth });
144247
- setTimeout(() => {
144248
- this.scrollAlignmentToPercent(newPercent);
144249
- this.blockScroll = false;
144250
- updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144251
- });
144252
- }, "onMinimapSizeAdjust"));
144253
- __publicField(this, "setCharWidthInLinearView", /* @__PURE__ */ __name(({ charWidthInLinearView }) => {
144254
- window.localStorage.setItem(
144255
- "charWidthInLinearViewDefault",
144256
- charWidthInLinearView
144257
- );
144258
- this.setState({ charWidthInLinearView });
144259
- charWidthInLinearViewDefault = JSON.parse(
144260
- window.localStorage.getItem("charWidthInLinearViewDefault")
144261
- );
144262
- }, "setCharWidthInLinearView"));
144263
- __publicField(this, "scrollToCaret", /* @__PURE__ */ __name(() => {
144264
- let el = window.document.querySelector(".veCaret:not(.zoomSelection)");
144265
- if (!el) {
144266
- el = window.document.querySelector(".veCaret");
144267
- }
144268
- if (!el) {
144269
- return;
144270
- }
144271
- el.scrollIntoView({ inline: "center", block: "nearest" });
144272
- }, "scrollToCaret"));
144273
- __publicField(this, "scrollAlignmentToPercent", /* @__PURE__ */ __name((scrollPercentage) => {
144274
- const scrollPercentageToUse = Math.min(Math.max(scrollPercentage, 0), 1);
144275
- this.easyStore.percentScrolled = scrollPercentageToUse;
144276
- this.alignmentHolder.scrollLeft = scrollPercentageToUse * (this.alignmentHolder.scrollWidth - this.alignmentHolder.clientWidth);
144277
- if (this.alignmentHolderTop) {
144278
- this.alignmentHolderTop.scrollLeft = scrollPercentageToUse * (this.alignmentHolderTop.scrollWidth - this.alignmentHolderTop.clientWidth);
144279
- }
144280
- }, "scrollAlignmentToPercent"));
144281
- __publicField(this, "scrollYToTrack", /* @__PURE__ */ __name((trackIndex) => {
144282
- this.InfiniteScroller.scrollTo(trackIndex);
144283
- }, "scrollYToTrack"));
144284
- __publicField(this, "estimateRowHeight", /* @__PURE__ */ __name((index2, cache2) => {
144285
- const { alignmentVisibilityToolOptions, alignmentTracks } = this.props;
144286
- const track2 = alignmentTracks[index2];
144287
- if (!track2)
144288
- return 100;
144289
- const { sequenceData: sequenceData2 } = track2;
144290
- this.rowData = prepareRowData(sequenceData2, sequenceData2.sequence.length);
144291
- return estimateRowHeight({
144292
- index: index2,
144293
- cache: cache2,
144294
- // clearCache: this.clearCache,
144295
- row: this.rowData[index2],
144296
- annotationVisibility: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144297
- annotationLabelVisibility: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility
144298
- });
144299
- }, "estimateRowHeight"));
144300
- __publicField(this, "getMaxLinearViewWidth", /* @__PURE__ */ __name(() => {
144301
- let maxWidth = 0;
144302
- const charWidthInLinearView = this.getCharWidthInLinearView();
144303
- forEach$4(this.props.alignmentTracks, (t2) => {
144304
- const w2 = (t2.alignmentData || t2.sequenceData).sequence.length;
144305
- if (w2 > maxWidth)
144306
- maxWidth = w2;
144261
+ },
144262
+ [
144263
+ alignmentId,
144264
+ alignmentRunUpdate2,
144265
+ debouncedAlignmentRunUpdate,
144266
+ selectionLayer2
144267
+ ]
144268
+ );
144269
+ const updateSelectionOrCaret$1 = useCallback$1(
144270
+ (shiftHeld, newRangeOrCaret, { forceReduxUpdate } = {}) => {
144271
+ const forceReduxSelectionLayerUpdate = /* @__PURE__ */ __name((newSelection) => {
144272
+ selectionLayerUpdate2(newSelection, { forceReduxUpdate: true });
144273
+ }, "forceReduxSelectionLayerUpdate");
144274
+ const sequenceLength2 = getSequenceLength();
144275
+ updateSelectionOrCaret({
144276
+ doNotWrapOrigin: true,
144277
+ shiftHeld,
144278
+ sequenceLength: sequenceLength2,
144279
+ newRangeOrCaret,
144280
+ caretPosition: easyStore2.current.caretPosition,
144281
+ selectionLayer: easyStore2.current.selectionLayer,
144282
+ selectionLayerUpdate: forceReduxUpdate ? forceReduxSelectionLayerUpdate : selectionLayerUpdate2,
144283
+ caretPositionUpdate: caretPositionUpdate2
144307
144284
  });
144308
- return maxWidth * charWidthInLinearView;
144309
- }, "getMaxLinearViewWidth"));
144310
- __publicField(this, "renderItem", /* @__PURE__ */ __name((_i, key, isTemplate, cloneProps) => {
144311
- const charWidthInLinearView = this.getCharWidthInLinearView();
144312
- const _a2 = this.props, {
144313
- alignmentTrackIndex,
144314
- pairwiseAlignments,
144315
- currentPairwiseAlignmentIndex,
144316
- pairwiseOverviewAlignmentTracks,
144317
- alignmentTracks = [],
144318
- upsertAlignmentRun: upsertAlignmentRun2,
144319
- alignmentId,
144320
- noClickDragHandlers,
144321
- handleSelectTrack,
144322
- allowTrackRearrange,
144323
- isPairwise,
144324
- linearViewOptions,
144325
- alignmentVisibilityToolOptions,
144326
- hasTemplate,
144327
- allowTrackNameEdit
144328
- } = _a2, rest = __objRest(_a2, [
144329
- "alignmentTrackIndex",
144330
- "pairwiseAlignments",
144331
- "currentPairwiseAlignmentIndex",
144332
- "pairwiseOverviewAlignmentTracks",
144333
- "alignmentTracks",
144334
- "upsertAlignmentRun",
144335
- "alignmentId",
144336
- "noClickDragHandlers",
144337
- "handleSelectTrack",
144338
- "allowTrackRearrange",
144339
- "isPairwise",
144340
- "linearViewOptions",
144341
- "alignmentVisibilityToolOptions",
144342
- "hasTemplate",
144343
- "allowTrackNameEdit"
144344
- ]);
144345
- const isDragDisabled = !allowTrackRearrange || isPairwise;
144346
- let i;
144347
- if (isTemplate) {
144348
- i = _i;
144349
- } else if (hasTemplate) {
144350
- i = _i + 1;
144285
+ },
144286
+ [caretPositionUpdate2, getSequenceLength, selectionLayerUpdate2]
144287
+ );
144288
+ const getNearestCursorPositionToMouseEvent2 = useCallback$1(
144289
+ (_2, event, callback2) => {
144290
+ let nearestCaretPos = 0;
144291
+ const rowDomNode = veTracksAndAlignmentHolder.current;
144292
+ const boundingRowRect = rowDomNode.getBoundingClientRect();
144293
+ if (getClientX(event) - boundingRowRect.left - nameDivWidth < 0) {
144294
+ nearestCaretPos = 0;
144351
144295
  } else {
144352
- i = _i;
144353
- }
144354
- const track2 = alignmentTracks[i];
144355
- if (!track2)
144356
- return null;
144357
- const {
144358
- sequenceData: sequenceData2,
144359
- alignmentData,
144360
- isReversed,
144361
- wasTrimmed,
144362
- additionalSelectionLayers,
144363
- chromatogramData
144364
- // mismatches
144365
- } = track2;
144366
- const seqLen = this.getMaxLength();
144367
- const trimmedRangesToDisplay = getTrimmedRangesToDisplay({
144368
- seqLen,
144369
- trimmedRange: alignmentData == null ? void 0 : alignmentData.trimmedRange
144370
- });
144371
- const linearViewWidth = (alignmentData || sequenceData2).sequence.length * charWidthInLinearView;
144372
- const name2 = sequenceData2.name || sequenceData2.id;
144373
- const tickSpacing = massageTickSpacing(
144374
- Math.ceil(120 / charWidthInLinearView)
144375
- );
144376
- const { compactNames } = alignmentVisibilityToolOptions.alignmentAnnotationVisibility;
144377
- const selectionLayer2 = [
144378
- this.state[`tempTrimBefore${i}`] || trimmedRangesToDisplay[0],
144379
- this.state[`tempTrimAfter${i}`] || trimmedRangesToDisplay[1]
144380
- ].filter((i2) => i2).map((i2) => __spreadProps(__spreadValues({}, i2), {
144381
- hideCarets: true,
144382
- ignoreGaps: true,
144383
- className: "tg-trimmed-region",
144384
- color: "gray"
144385
- }));
144386
- const innerRenderItem = /* @__PURE__ */ __name((provided = {}, snapshot) => {
144387
- var _a3;
144388
- return /* @__PURE__ */ React__default$1.createElement(
144389
- "div",
144390
- __spreadProps(__spreadValues({
144391
- ref: provided == null ? void 0 : provided.innerRef
144392
- }, provided == null ? void 0 : provided.draggableProps), {
144393
- className: classNames("alignmentViewTrackContainer", {
144394
- isDragDisabled
144395
- }),
144396
- "data-alignment-track-index": i,
144397
- style: __spreadValues(__spreadValues({
144398
- boxShadow: isTemplate ? "red 0px -1px 0px 0px inset, red 0px 1px 0px 0px inset" : "0px -1px 0px 0px inset",
144399
- display: "flex"
144400
- }, (_a3 = provided == null ? void 0 : provided.draggableProps) == null ? void 0 : _a3.style), (snapshot == null ? void 0 : snapshot.isDragging) && { left: unset }),
144401
- key: i
144402
- }),
144403
- /* @__PURE__ */ React__default$1.createElement(
144404
- "div",
144405
- {
144406
- className: "alignmentTrackName",
144407
- style: {
144408
- position: "sticky",
144409
- left: 0,
144410
- zIndex: 10,
144411
- borderBottom: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144412
- borderRight: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144413
- width: this.state.nameDivWidth - 3,
144414
- padding: 2,
144415
- marginRight: 3,
144416
- paddingBottom: 0,
144417
- minWidth: this.state.nameDivWidth - 3,
144418
- overflow: "hidden",
144419
- scrollbarWidth: "none",
144420
- whiteSpace: "nowrap"
144421
- },
144422
- "data-title": name2,
144423
- key: i
144424
- },
144425
- /* @__PURE__ */ React__default$1.createElement(
144426
- "div",
144427
- __spreadProps(__spreadValues({}, provided == null ? void 0 : provided.dragHandleProps), {
144428
- style: __spreadProps(__spreadValues({}, compactNames && {
144429
- display: "flex",
144430
- alignItems: "flex-start"
144431
- }), {
144432
- cursor: !isPairwise && allowTrackRearrange && !isTemplate ? "move" : ""
144433
- })
144434
- }),
144435
- /* @__PURE__ */ React__default$1.createElement(
144436
- "div",
144437
- {
144438
- className: "alignmentTrackNameDiv",
144439
- style: __spreadValues({
144440
- background: "#3FA6DA",
144441
- display: "inline-block",
144442
- color: "white",
144443
- borderRadius: 5,
144444
- paddingRight: 5
144445
- }, compactNames && {
144446
- marginRight: 5
144447
- })
144448
- },
144449
- allowTrackNameEdit && /* @__PURE__ */ React__default$1.createElement(
144450
- Button,
144451
- {
144452
- onClick: () => {
144453
- showDialog({
144454
- ModalComponent: EditTrackNameDialog,
144455
- props: {
144456
- initialValues: {
144457
- name: name2
144458
- },
144459
- updateName: ({ newName }) => {
144460
- updateTrackHelper({
144461
- currentPairwiseAlignmentIndex,
144462
- pairwiseAlignments,
144463
- upsertAlignmentRun: upsertAlignmentRun2,
144464
- alignmentId,
144465
- alignmentTracks,
144466
- alignmentTrackIndex: i,
144467
- update: { name: newName }
144468
- });
144469
- }
144470
- }
144471
- });
144472
- },
144473
- small: true,
144474
- "data-tip": "Edit Track Name",
144475
- className: "edit-track-name-btn",
144476
- icon: /* @__PURE__ */ React__default$1.createElement(Icon, { size: 12, color: "lightgrey", icon: "edit" }),
144477
- minimal: true
144478
- }
144479
- ),
144480
- sequenceData2.seqLink && /* @__PURE__ */ React__default$1.createElement(
144481
- AnchorButton,
144482
- {
144483
- href: sequenceData2.seqLink,
144484
- "data-tip": sequenceData2.seqLinkTooltip,
144485
- target: "_blank",
144486
- small: true,
144487
- icon: /* @__PURE__ */ React__default$1.createElement(Icon, { size: 12, color: "white", icon: "document-open" }),
144488
- minimal: true
144489
- }
144490
- ),
144491
- name2
144492
- ),
144493
- /* @__PURE__ */ React__default$1.createElement("div", { style: { fontSize: 10, marginTop: 2, marginBottom: 2 } }, isReversed && /* @__PURE__ */ React__default$1.createElement(
144494
- "span",
144495
- {
144496
- style: {
144497
- backgroundColor: isReversed ? "#E76A6E" : "#4C90F0",
144498
- padding: 2,
144499
- paddingLeft: 4,
144500
- color: "white",
144501
- marginRight: 2,
144502
- borderRadius: "5px"
144503
- },
144504
- "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"
144505
- },
144506
- isReversed ? "REV" : "FWD",
144507
- " "
144508
- ), wasTrimmed && /* @__PURE__ */ React__default$1.createElement(
144509
- "span",
144510
- {
144511
- style: {
144512
- backgroundColor: "#13C9BA",
144513
- padding: 2,
144514
- paddingLeft: 4,
144515
- color: "white",
144516
- marginRight: 2,
144517
- borderRadius: "5px"
144518
- },
144519
- "data-tip": "This sequence was trimmed and resubmitted for alignment"
144520
- },
144521
- "TRIMMED"
144522
- ), sequenceData2.sequence.length, " bps")
144523
- ),
144524
- /* @__PURE__ */ React__default$1.createElement(
144525
- HorizontalPanelDragHandle,
144526
- {
144527
- onDrag: ({ dx }) => {
144528
- this.setState({
144529
- nameDivWidth: Math.min(
144530
- this.state.nameDivWidth - dx,
144531
- this.state.width - 20
144532
- )
144533
- });
144534
- }
144535
- }
144536
- )
144537
- ),
144538
- handleSelectTrack && !isTemplate && /* @__PURE__ */ React__default$1.createElement(
144539
- "div",
144540
- {
144541
- onClick: () => {
144542
- handleSelectTrack(i);
144543
- },
144544
- style: {
144545
- position: "absolute",
144546
- opacity: 0,
144547
- height: "100%",
144548
- left: this.state.nameDivWidth,
144549
- width: linearViewWidth,
144550
- fontWeight: "bolder",
144551
- cursor: "pointer",
144552
- padding: 5,
144553
- textAlign: "center",
144554
- zIndex: 400
144555
- },
144556
- className: "alignmentViewSelectTrackPopover veWhiteBackground"
144557
- },
144558
- "Inspect track"
144559
- ),
144560
- /* @__PURE__ */ React__default$1.createElement(
144561
- NonReduxEnhancedLinearView,
144562
- __spreadValues({}, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
144563
- caretPosition: this.state[`tempTrimmingCaret${i}`] || -1,
144564
- selectionLayer: selectionLayer2,
144565
- isInAlignment: true,
144566
- // : { start: -1, end: -1 },
144567
- annotationVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144568
- linearViewAnnotationLabelVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility,
144569
- marginWith: 0,
144570
- orfClicked: this.annotationClicked,
144571
- primerClicked: this.annotationClicked,
144572
- translationClicked: this.annotationClicked,
144573
- cutsiteClicked: this.annotationClicked,
144574
- translationDoubleClicked: this.annotationClicked,
144575
- deletionLayerClicked: this.annotationClicked,
144576
- replacementLayerClicked: this.annotationClicked,
144577
- featureClicked: this.annotationClicked,
144578
- partClicked: this.annotationClicked,
144579
- searchLayerClicked: this.annotationClicked,
144580
- editorDragStarted: noop$7,
144581
- //override these since we're defining the handlers above
144582
- editorDragStopped: noop$7,
144583
- //override these since we're defining the handlers above
144584
- editorDragged: noop$7,
144585
- //override these since we're defining the handlers above
144586
- hideName: true,
144587
- sequenceData: sequenceData2,
144588
- // sequenceDataWithRefSeqCdsFeatures,
144589
- tickSpacing,
144590
- allowSeqDataOverride: true,
144591
- //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
144592
- editorName: `${isTemplate ? "template_" : ""}alignmentView${i}`,
144593
- alignmentData,
144594
- chromatogramData,
144595
- height: "100%",
144596
- vectorInteractionWrapperStyle: {
144597
- overflowY: "hidden"
144598
- },
144599
- withZoomLinearView: false,
144600
- marginWidth: 0,
144601
- linearViewCharWidth: charWidthInLinearView,
144602
- ignoreGapsOnHighlight: true
144603
- }), linearViewOptions && (isFunction$7(linearViewOptions) ? linearViewOptions({
144604
- index: i,
144605
- isTemplate,
144606
- alignmentVisibilityToolOptions,
144607
- sequenceData: sequenceData2,
144608
- alignmentData,
144609
- chromatogramData
144610
- }) : linearViewOptions)), {
144611
- additionalSelectionLayers,
144612
- dimensions: {
144613
- width: linearViewWidth
144614
- },
144615
- width: linearViewWidth,
144616
- paddingBottom: 5,
144617
- scrollDataPassed: this.easyStore
144618
- }))
144619
- )
144296
+ const clickXPositionRelativeToRowContainer = getClientX(event) - boundingRowRect.left - nameDivWidth;
144297
+ const numberOfBPsInFromRowStart = Math.floor(
144298
+ (clickXPositionRelativeToRowContainer + charWidth2 / 2) / charWidth2
144620
144299
  );
144621
- }, "innerRenderItem");
144622
- if (isTemplate)
144623
- return innerRenderItem();
144624
- if (cloneProps)
144625
- return innerRenderItem(cloneProps.provided, cloneProps.snapshot);
144626
- const idToUse = alignmentData.id || sequenceData2.id || i + "_index_id";
144627
- return /* @__PURE__ */ React__default$1.createElement(
144628
- PublicDraggable,
144629
- {
144630
- key: idToUse.toString(),
144631
- index: i,
144632
- isDragDisabled,
144633
- draggableId: idToUse.toString()
144634
- },
144635
- innerRenderItem
144636
- );
144637
- }, "renderItem"));
144638
- __publicField(this, "handleResize", throttle$1(([e2]) => {
144639
- this.easyStore.viewportWidth = e2.contentRect.width - this.state.nameDivWidth || 400;
144640
- this.setState({ width: e2.contentRect.width });
144641
- }, 200));
144642
- __publicField(this, "removeMinimapHighlightForMouseLeave", /* @__PURE__ */ __name(() => {
144643
- const minimapLaneEl = document.querySelector(`.minimapLane.lane-hovered`);
144644
- if (!minimapLaneEl)
144645
- return;
144646
- minimapLaneEl.classList.remove("lane-hovered");
144647
- }, "removeMinimapHighlightForMouseLeave"));
144648
- __publicField(this, "updateMinimapHighlightForMouseMove", /* @__PURE__ */ __name((event) => {
144649
- this.latestMouseY = getClientY(event);
144650
- this.updateMinimapHighlight();
144651
- }, "updateMinimapHighlightForMouseMove"));
144652
- __publicField(this, "updateMinimapHighlight", /* @__PURE__ */ __name(() => {
144653
- const rows = document.querySelectorAll(`.alignmentViewTrackContainer`);
144654
- const rowsLength = document.querySelectorAll(`.minimapLane`).length;
144655
- if (rowsLength <= 4) {
144656
- return;
144657
- }
144658
- some(rows, (rowDomNode) => {
144659
- const boundingRowRect = rowDomNode.getBoundingClientRect();
144660
- if (this.latestMouseY > boundingRowRect.top && this.latestMouseY < boundingRowRect.top + boundingRowRect.height) {
144661
- const prevMinimapLaneEl = document.querySelector(
144662
- `.minimapLane.lane-hovered`
144663
- );
144664
- if (prevMinimapLaneEl) {
144665
- prevMinimapLaneEl.classList.remove("lane-hovered");
144666
- }
144667
- const i = Number(rowDomNode.getAttribute("data-alignment-track-index"));
144668
- const minimapLaneEl = document.querySelector(
144669
- `.minimapLane:nth-child(${i + 1})`
144670
- );
144671
- if (!minimapLaneEl)
144672
- return;
144673
- minimapLaneEl.classList.add("lane-hovered");
144674
- return true;
144300
+ nearestCaretPos = numberOfBPsInFromRowStart + 0;
144301
+ if (nearestCaretPos > maxLength + 1) {
144302
+ nearestCaretPos = maxLength + 1;
144675
144303
  }
144676
- });
144677
- }, "updateMinimapHighlight"));
144678
- __publicField(this, "onTrackDragStart", /* @__PURE__ */ __name(() => {
144679
- this.setState({ isTrackDragging: true });
144680
- }, "onTrackDragStart"));
144681
- __publicField(this, "onTrackDragEnd", /* @__PURE__ */ __name(({ destination, source }) => {
144682
- this.setState({ isTrackDragging: false });
144683
- if (!destination) {
144684
- return;
144685
144304
  }
144686
- const { upsertAlignmentRun: upsertAlignmentRun2, alignmentId, alignmentTracks } = this.props;
144687
- upsertAlignmentRun2({
144688
- id: alignmentId,
144689
- alignmentTracks: array_move(
144690
- alignmentTracks,
144691
- source.index,
144692
- destination.index
144305
+ if (sequenceData2 == null ? void 0 : sequenceData2.isProtein) {
144306
+ nearestCaretPos = Math.round(nearestCaretPos / 3) * 3;
144307
+ }
144308
+ if (sequenceLength === 0)
144309
+ nearestCaretPos = 0;
144310
+ const callbackVals = {
144311
+ updateSelectionOrCaret: updateSelectionOrCaret$1,
144312
+ nearestCaretPos,
144313
+ sequenceLength: getSequenceLength(),
144314
+ caretPosition: easyStore2.current.caretPosition,
144315
+ selectionLayer: easyStore2.current.selectionLayer,
144316
+ easyStore: easyStore2.current,
144317
+ caretPositionUpdate: caretPositionUpdate2,
144318
+ selectionLayerUpdate: selectionLayerUpdate2,
144319
+ event,
144320
+ doNotWrapOrigin: true,
144321
+ shiftHeld: event.shiftKey,
144322
+ // caretGrabbed: event.target.className === "cursor",
144323
+ selectionStartGrabbed: event.target.classList.contains(
144324
+ draggableClassnames.selectionStart
144325
+ ),
144326
+ selectionEndGrabbed: event.target.classList.contains(
144327
+ draggableClassnames.selectionEnd
144693
144328
  )
144329
+ };
144330
+ callback2(callbackVals);
144331
+ },
144332
+ [
144333
+ caretPositionUpdate2,
144334
+ charWidth2,
144335
+ getSequenceLength,
144336
+ maxLength,
144337
+ nameDivWidth,
144338
+ selectionLayerUpdate2,
144339
+ sequenceData2 == null ? void 0 : sequenceData2.isProtein,
144340
+ sequenceLength,
144341
+ updateSelectionOrCaret$1
144342
+ ]
144343
+ );
144344
+ useEffect(() => {
144345
+ const updateAlignmentSelection = /* @__PURE__ */ __name((newRangeOrCaret) => {
144346
+ updateSelectionOrCaret$1(false, newRangeOrCaret, {
144347
+ forceReduxUpdate: true
144694
144348
  });
144695
- }, "onTrackDragEnd"));
144696
- window.scrollAlignmentToPercent = this.scrollAlignmentToPercent;
144349
+ }, "updateAlignmentSelection");
144350
+ window.updateAlignmentSelection = updateAlignmentSelection;
144697
144351
  if (window.Cypress)
144698
- window.Cypress.scrollAlignmentToPercent = this.scrollAlignmentToPercent;
144699
- this.onShortcutCopy = document.addEventListener(
144700
- "keydown",
144701
- this.handleAlignmentCopy
144702
- );
144703
- }
144704
- getNearestCursorPositionToMouseEvent(rowData, event, callback2) {
144705
- this.charWidth = this.getCharWidthInLinearView();
144706
- let nearestCaretPos = 0;
144707
- const rowDomNode = this.veTracksAndAlignmentHolder;
144708
- const boundingRowRect = rowDomNode.getBoundingClientRect();
144709
- const maxEnd = this.getMaxLength();
144710
- if (getClientX(event) - boundingRowRect.left - this.state.nameDivWidth < 0) {
144711
- nearestCaretPos = 0;
144712
- } else {
144713
- const clickXPositionRelativeToRowContainer = getClientX(event) - boundingRowRect.left - this.state.nameDivWidth;
144714
- const numberOfBPsInFromRowStart = Math.floor(
144715
- (clickXPositionRelativeToRowContainer + this.charWidth / 2) / this.charWidth
144716
- );
144717
- nearestCaretPos = numberOfBPsInFromRowStart + 0;
144718
- if (nearestCaretPos > maxEnd + 1) {
144719
- nearestCaretPos = maxEnd + 1;
144352
+ window.Cypress.updateAlignmentSelection = updateAlignmentSelection;
144353
+ return () => {
144354
+ delete window.updateAlignmentSelection;
144355
+ if (window.Cypress) {
144356
+ delete window.Cypress.updateAlignmentSelection;
144720
144357
  }
144721
- }
144722
- if (this.props.sequenceData && this.props.sequenceData.isProtein) {
144723
- nearestCaretPos = Math.round(nearestCaretPos / 3) * 3;
144724
- }
144725
- if (this.props.sequenceLength === 0)
144726
- nearestCaretPos = 0;
144727
- const callbackVals = {
144728
- updateSelectionOrCaret: this.updateSelectionOrCaret,
144729
- nearestCaretPos,
144730
- sequenceLength: this.getSequenceLength(),
144731
- caretPosition: this.easyStore.caretPosition,
144732
- selectionLayer: this.easyStore.selectionLayer,
144733
- easyStore: this.easyStore,
144734
- caretPositionUpdate: this.caretPositionUpdate,
144735
- selectionLayerUpdate: this.selectionLayerUpdate,
144736
- event,
144737
- doNotWrapOrigin: true,
144738
- shiftHeld: event.shiftKey,
144739
- // caretGrabbed: event.target.className === "cursor",
144740
- selectionStartGrabbed: event.target.classList.contains(
144741
- draggableClassnames.selectionStart
144742
- ),
144743
- selectionEndGrabbed: event.target.classList.contains(
144744
- draggableClassnames.selectionEnd
144745
- )
144746
144358
  };
144747
- callback2(callbackVals);
144748
- }
144749
- componentWillUnmount() {
144750
- if (window.Cypress) {
144751
- delete window.scrollAlignmentToPercent;
144752
- delete window.Cypress.scrollAlignmentToPercent;
144753
- delete window.updateAlignmentSelection;
144754
- delete window.Cypress.updateAlignmentSelection;
144755
- }
144756
- this.onShortcutCopy && document.removeEventListener("keydown", this.handleAlignmentCopy);
144757
- }
144758
- componentDidUpdate(prevProps) {
144759
- return __async(this, null, function* () {
144760
- if (prevProps.scrollPercentageToJumpTo !== this.props.scrollPercentageToJumpTo && this.props.scrollPercentageToJumpTo !== void 0) {
144761
- this.scrollAlignmentToPercent(this.props.scrollPercentageToJumpTo);
144359
+ }, [updateSelectionOrCaret$1]);
144360
+ const setVerticalScrollRange = throttle$1(() => {
144361
+ if (InfiniteScroller.current && InfiniteScroller.current.getFractionalVisibleRange && easyStore2.current) {
144362
+ let [start2, end2] = InfiniteScroller.current.getFractionalVisibleRange();
144363
+ if (hasTemplate) {
144364
+ end2 = end2 + 1;
144762
144365
  }
144763
- if (this.props.shouldAutosave && prevProps && prevProps.stateTrackingId && this.props.stateTrackingId !== prevProps.stateTrackingId) {
144764
- this.setState({ saveMessage: "Alignment Saving.." });
144765
- this.setState({ saveMessageLoading: true });
144366
+ if (easyStore2.current.verticalVisibleRange.start !== start2 || easyStore2.current.verticalVisibleRange.end !== end2)
144367
+ easyStore2.current.verticalVisibleRange = { start: start2, end: end2 };
144368
+ }
144369
+ }, 100);
144370
+ useEffect(() => {
144371
+ setTimeout(() => {
144372
+ updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144373
+ }, 0);
144374
+ setTimeout(() => {
144375
+ setVerticalScrollRange();
144376
+ }, 500);
144377
+ });
144378
+ useEffect(() => {
144379
+ if (scrollPercentageToJumpTo !== void 0) {
144380
+ scrollAlignmentToPercent(scrollPercentageToJumpTo);
144381
+ }
144382
+ }, [scrollPercentageToJumpTo]);
144383
+ useEffect(() => {
144384
+ const saveAlignment = /* @__PURE__ */ __name(() => __async(void 0, null, function* () {
144385
+ if (shouldAutosave && stateTrackingId) {
144386
+ setSaveMessage("Alignment Saving..");
144387
+ setSaveMessageLoading(true);
144766
144388
  let cleanedTracks;
144767
- if (this.props.pairwiseAlignments) {
144768
- cleanedTracks = this.props.pairwiseAlignments.map(cleanTracks);
144389
+ if (pairwiseAlignments) {
144390
+ cleanedTracks = pairwiseAlignments.map(cleanTracks);
144769
144391
  } else {
144770
- cleanedTracks = cleanTracks(this.props.alignmentTracks);
144392
+ cleanedTracks = cleanTracks(alignmentTracks);
144771
144393
  }
144772
- yield this.props.handleAlignmentSave(cleanedTracks, this.props);
144773
- this.setState({ saveMessage: "Alignment Saved" });
144774
- this.setState({ saveMessageLoading: false });
144394
+ yield handleAlignmentSave(cleanedTracks);
144395
+ setSaveMessage("Alignment Saved");
144396
+ setSaveMessageLoading(false);
144775
144397
  setTimeout(() => {
144776
- this.setState({ saveMessage: void 0 });
144777
- this.setState({ saveMessageLoading: false });
144398
+ setSaveMessage(void 0);
144399
+ setSaveMessageLoading(false);
144778
144400
  }, 5e3);
144779
144401
  }
144780
- });
144781
- }
144782
- componentDidMount() {
144783
- const updateAlignmentSelection = /* @__PURE__ */ __name((newRangeOrCaret) => {
144784
- this.updateSelectionOrCaret(false, newRangeOrCaret, {
144785
- forceReduxUpdate: true
144786
- });
144787
- }, "updateAlignmentSelection");
144788
- window.updateAlignmentSelection = updateAlignmentSelection;
144789
- if (window.Cypress)
144790
- window.Cypress.updateAlignmentSelection = updateAlignmentSelection;
144402
+ }), "saveAlignment");
144403
+ saveAlignment();
144404
+ }, [
144405
+ alignmentTracks,
144406
+ handleAlignmentSave,
144407
+ pairwiseAlignments,
144408
+ shouldAutosave,
144409
+ stateTrackingId
144410
+ ]);
144411
+ const annotationClicked = /* @__PURE__ */ __name(({
144412
+ event,
144413
+ annotation,
144414
+ gapsBefore = 0,
144415
+ gapsInside = 0
144416
+ }) => {
144417
+ event.preventDefault && event.preventDefault();
144418
+ event.stopPropagation && event.stopPropagation();
144419
+ updateSelectionOrCaret$1(event.shiftKey, __spreadProps(__spreadValues({}, annotation), {
144420
+ start: annotation.start + gapsBefore,
144421
+ end: annotation.end + gapsBefore + gapsInside
144422
+ }));
144423
+ }, "annotationClicked");
144424
+ const getNumBpsShownInLinearView = /* @__PURE__ */ __name(() => {
144425
+ const toReturn = (width - nameDivWidth) / charWidth2;
144426
+ return toReturn || 0;
144427
+ }, "getNumBpsShownInLinearView");
144428
+ const handleScroll = /* @__PURE__ */ __name(() => {
144429
+ if (alignmentHolder.current.scrollTop !== oldAlignmentHolderScrollTop.current) {
144430
+ setTimeout(() => {
144431
+ setVerticalScrollRange();
144432
+ oldAlignmentHolderScrollTop.current = alignmentHolder.current.scrollTop;
144433
+ }, 100);
144434
+ }
144435
+ if (blockScroll.current) {
144436
+ return;
144437
+ }
144438
+ const scrollPercentage = alignmentHolder.current.scrollLeft / (alignmentHolder.current.scrollWidth - alignmentHolder.current.clientWidth);
144439
+ easyStore2.current.percentScrolled = scrollPercentage || 0;
144440
+ if (!isZooming.current) {
144441
+ easyStore2.current.percentScrolledPreZoom = easyStore2.current.percentScrolled;
144442
+ }
144443
+ if (alignmentHolderTop.current) {
144444
+ alignmentHolderTop.current.scrollLeft = alignmentHolder.current.scrollLeft;
144445
+ }
144446
+ updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144447
+ }, "handleScroll");
144448
+ const handleTopScroll = /* @__PURE__ */ __name(() => {
144449
+ alignmentHolder.current.scrollLeft = alignmentHolderTop.current.scrollLeft;
144450
+ }, "handleTopScroll");
144451
+ const onMinimapSizeAdjust = /* @__PURE__ */ __name((newSliderSize, newPercent) => {
144452
+ const percentageOfSpace = newSliderSize / width;
144453
+ const seqLength = getSequenceLength();
144454
+ const numBpsInView = seqLength * percentageOfSpace;
144455
+ const newCharWidth = (width - nameDivWidth) / numBpsInView;
144456
+ blockScroll.current = true;
144457
+ setCharWidthInLinearView({ charWidthInLinearView: newCharWidth });
144791
144458
  setTimeout(() => {
144459
+ scrollAlignmentToPercent(newPercent);
144460
+ blockScroll.current = false;
144792
144461
  updateLabelsForInViewFeatures({ rectElement: ".alignmentHolder" });
144793
- }, 0);
144794
- setTimeout(() => {
144795
- this.setVerticalScrollRange();
144796
- }, 500);
144797
- }
144798
- render() {
144799
- const charWidthInLinearView = this.getCharWidthInLinearView();
144800
- const {
144801
- alignmentTracks = [],
144802
- height: height2,
144803
- minimapLaneHeight,
144804
- minimapLaneSpacing,
144805
- isInPairwiseOverviewView,
144806
- isPairwise,
144807
- currentPairwiseAlignmentIndex,
144808
- hasTemplate,
144809
- noVisibilityOptions,
144810
- updateAlignmentSortOrder,
144811
- alignmentSortOrder,
144812
- handleBackButtonClicked,
144813
- noClickDragHandlers,
144814
- upsertAlignmentRun: upsertAlignmentRun2,
144815
- alignmentId,
144816
- allowTrimming,
144817
- additionalSelectionLayerRightClickedOptions,
144818
- selectionLayerRightClicked,
144819
- additionalTopEl,
144820
- additionalTopLeftEl,
144821
- handleAlignmentRename,
144822
- alignmentVisibilityToolOptions
144823
- } = this.props;
144824
- const sequenceLength = this.getMaxLength();
144825
- if (!alignmentTracks || !alignmentTracks[0] || !alignmentTracks[0].alignmentData) {
144826
- console.error("corrupted data!", this.props);
144827
- return "corrupted data!";
144828
- }
144829
- const getTrackVis = /* @__PURE__ */ __name((alignmentTracks2, isTemplate, allTracks) => {
144830
- const rowData = {};
144831
- const innerTrackVis = /* @__PURE__ */ __name((drop_provided, drop_snapshot) => {
144832
- return /* @__PURE__ */ React__default$1.createElement(
144833
- "div",
144834
- {
144835
- className: "alignmentTracks ",
144836
- style: {
144837
- overflowY: "auto",
144838
- display: "flex",
144839
- zIndex: 10
144840
- }
144841
- },
144842
- /* @__PURE__ */ React__default$1.createElement(
144843
- "div",
144844
- {
144845
- style: {
144846
- overflowX: "auto",
144847
- width: this.state.width
144848
- },
144849
- ref: (ref2) => {
144850
- this[isTemplate ? "alignmentHolderTop" : "alignmentHolder"] = ref2;
144851
- },
144852
- onContextMenu: (e2) => {
144853
- if (!allowTrimming || isTargetWithinEl(e2, ".alignmentTrackName")) {
144854
- return;
144855
- }
144856
- this.getTrackTrimmingOptions({
144857
- e: e2,
144858
- allTracks,
144859
- upsertAlignmentRun: upsertAlignmentRun2,
144860
- alignmentId,
144861
- currentPairwiseAlignmentIndex
144862
- });
144863
- },
144864
- onMouseLeave: this.removeMinimapHighlightForMouseLeave,
144865
- onMouseMove: this.updateMinimapHighlightForMouseMove,
144866
- dataname: "scrollGroup",
144867
- className: "alignmentHolder",
144868
- onScroll: isTemplate ? this.handleTopScroll : this.handleScroll
144869
- },
144870
- /* @__PURE__ */ React__default$1.createElement(
144871
- ReactDraggable,
144872
- {
144873
- disabled: this.state.isTrackDragging,
144874
- bounds: { top: 0, left: 0, right: 0, bottom: 0 },
144875
- onDrag: noClickDragHandlers ? noop$7 : (event) => {
144876
- if (this.state.isTrackDragging)
144877
- return;
144878
- this.getNearestCursorPositionToMouseEvent(
144879
- rowData,
144880
- event,
144881
- editorDragged
144882
- );
144883
- },
144884
- onStart: noClickDragHandlers ? noop$7 : (event) => {
144885
- if (isTargetWithinEl(event, ".alignmentTrackName")) {
144886
- return this.setState({ isTrackDragging: true });
144887
- }
144888
- if (this.state.isTrackDragging)
144889
- return;
144890
- this.getNearestCursorPositionToMouseEvent(
144891
- rowData,
144892
- event,
144893
- editorDragStarted
144894
- );
144895
- },
144896
- onStop: noClickDragHandlers ? noop$7 : (...args) => {
144897
- setTimeout(() => {
144898
- this.setState({ isTrackDragging: false });
144899
- }, 0);
144900
- editorDragStopped(...args);
144901
- }
144902
- },
144903
- /* @__PURE__ */ React__default$1.createElement(
144904
- "div",
144905
- {
144906
- ref: (ref2) => this.veTracksAndAlignmentHolder = ref2,
144907
- className: classNames("veTracksAndAlignmentHolder", {
144908
- isTrackDragging: this.state.isTrackDragging
144909
- }),
144910
- onClick: noClickDragHandlers ? noop$7 : (event) => {
144911
- if (this.state.isTrackDragging)
144912
- return;
144913
- if (isTargetWithinEl(event, ".alignmentTrackName")) {
144914
- return;
144915
- }
144916
- this.getNearestCursorPositionToMouseEvent(
144917
- rowData,
144918
- event,
144919
- editorClicked
144920
- );
144921
- }
144922
- },
144923
- /* @__PURE__ */ React__default$1.createElement(
144924
- PerformantSelectionLayer,
144925
- {
144926
- leftMargin: this.state.nameDivWidth,
144927
- className: "veAlignmentSelectionLayer",
144928
- isDraggable: true,
144929
- selectionLayerRightClicked: selectionLayerRightClicked ? (...args) => {
144930
- selectionLayerRightClicked(...args, this.props);
144931
- } : (...args) => {
144932
- const { event } = args[0];
144933
- const track2 = getTrackFromEvent(event, allTracks);
144934
- const alignmentData = track2.alignmentData;
144935
- const { name: name2 } = alignmentData;
144936
- const copySpecificAlignmentFasta = /* @__PURE__ */ __name(() => __async(this, null, function* () {
144937
- const { selectionLayer: selectionLayer2 } = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id] || {};
144938
- const seqDataToCopy = getSequenceDataBetweenRange(
144939
- alignmentData,
144940
- selectionLayer2
144941
- ).sequence;
144942
- const seqDataToCopyAsFasta = `>${name2}\r
144943
- ${seqDataToCopy}\r
144944
- `;
144945
- yield navigator.clipboard.writeText(
144946
- seqDataToCopyAsFasta
144947
- );
144948
- }), "copySpecificAlignmentFasta");
144949
- const copySpecificAlignment = /* @__PURE__ */ __name(() => __async(this, null, function* () {
144950
- const { selectionLayer: selectionLayer2 } = this.props.store.getState().VectorEditor.__allEditorsOptions.alignments[this.props.id] || {};
144951
- const seqDataToCopy = getSequenceDataBetweenRange(
144952
- alignmentData,
144953
- selectionLayer2
144954
- ).sequence;
144955
- yield navigator.clipboard.writeText(
144956
- seqDataToCopy
144957
- );
144958
- }), "copySpecificAlignment");
144959
- const getAllAlignmentsFastaText = /* @__PURE__ */ __name(() => __async(this, null, function* () {
144960
- yield navigator.clipboard.writeText(
144961
- this.getAllAlignmentsFastaText()
144962
- );
144963
- }), "getAllAlignmentsFastaText");
144964
- showContextMenu(
144965
- [
144966
- ...additionalSelectionLayerRightClickedOptions ? additionalSelectionLayerRightClickedOptions(
144967
- ...args,
144968
- this.props
144969
- ) : [],
144970
- {
144971
- text: "Copy Selection of All Alignments as Fasta",
144972
- className: "copyAllAlignmentsFastaClipboardHelper",
144973
- hotkey: "cmd+c",
144974
- onClick: () => {
144975
- getAllAlignmentsFastaText();
144976
- window.toastr.success("Selection Copied");
144977
- }
144978
- },
144979
- {
144980
- text: `Copy Selection of ${name2} as Fasta`,
144981
- className: "copySpecificAlignmentFastaClipboardHelper",
144982
- onClick: () => {
144983
- copySpecificAlignmentFasta();
144984
- window.toastr.success(
144985
- "Selection Copied As Fasta"
144986
- );
144987
- }
144988
- },
144989
- {
144990
- text: `Copy Selection of ${name2}`,
144991
- className: "copySpecificAlignmentAsPlainClipboardHelper",
144992
- onClick: () => {
144993
- copySpecificAlignment();
144994
- window.toastr.success("Selection Copied");
144995
- }
144996
- }
144997
- ],
144998
- void 0,
144999
- event
145000
- );
145001
- },
145002
- easyStore: this.easyStore,
145003
- sequenceLength,
145004
- charWidth: this.getCharWidthInLinearView(),
145005
- row: { start: 0, end: sequenceLength - 1 }
145006
- }
145007
- ),
145008
- /* @__PURE__ */ React__default$1.createElement(
145009
- PerformantCaret,
145010
- {
145011
- leftMargin: this.state.nameDivWidth,
145012
- className: "veAlignmentSelectionLayer",
145013
- isDraggable: true,
145014
- sequenceLength,
145015
- charWidth: this.getCharWidthInLinearView(),
145016
- row: { start: 0, end: sequenceLength - 1 },
145017
- easyStore: this.easyStore
145018
- }
145019
- ),
145020
- isTemplate ? this.renderItem(0, 0, isTemplate) : /* @__PURE__ */ React__default$1.createElement(
145021
- ReactList,
145022
- {
145023
- ref: (c2) => {
145024
- this.InfiniteScroller = c2;
145025
- const domNode = ReactDOM$1.findDOMNode(c2);
145026
- if (domNode instanceof HTMLElement) {
145027
- drop_provided.innerRef(domNode);
145028
- }
145029
- },
145030
- type: "variable",
145031
- itemSizeEstimator: this.estimateRowHeight,
145032
- itemRenderer: this.renderItem,
145033
- length: alignmentTracks2.length + (drop_snapshot.isUsingPlaceholder ? 1 : 0)
145034
- }
145035
- )
145036
- )
145037
- )
145038
- )
145039
- );
145040
- }, "innerTrackVis");
145041
- if (isTemplate)
145042
- return innerTrackVis();
145043
- else
145044
- return /* @__PURE__ */ React__default$1.createElement(
145045
- ConnectedDroppable$1,
145046
- {
145047
- mode: "virtual",
145048
- renderClone: (provided, snapshot, { source: { index: index2 } }) => {
145049
- return this.renderItem(index2, index2, false, {
145050
- provided,
145051
- snapshot
145052
- });
145053
- },
145054
- direction: "vertical",
145055
- droppableId: "droppable" + isTemplate ? "_no_drop" : ""
145056
- },
145057
- innerTrackVis
145058
- );
145059
- }, "getTrackVis");
145060
- const [firstTrack, ...otherTracks] = alignmentTracks;
145061
- const totalWidthOfMinimap = this.state.width;
145062
- const totalWidthInAlignmentView = 14 * this.getSequenceLength();
145063
- const minSliderSize = Math.min(
145064
- totalWidthOfMinimap * (totalWidthOfMinimap / totalWidthInAlignmentView),
145065
- totalWidthOfMinimap
144462
+ });
144463
+ }, "onMinimapSizeAdjust");
144464
+ const setCharWidthInLinearView = /* @__PURE__ */ __name(({ charWidthInLinearView: charWidthInLinearView2 }) => {
144465
+ window.localStorage.setItem(
144466
+ "charWidthInLinearViewDefault",
144467
+ charWidthInLinearView2
145066
144468
  );
145067
- const viewportHeight = Math.max(
145068
- document.documentElement.clientHeight,
145069
- window.innerHeight || 0
144469
+ _setCharWidthInLinearView(charWidthInLinearView2);
144470
+ charWidthInLinearViewDefault = JSON.parse(
144471
+ window.localStorage.getItem("charWidthInLinearViewDefault")
145070
144472
  );
145071
- const pinchHandler = {
145072
- onPinch: ({ delta: [d2] }) => {
145073
- this.bindOutsideChangeHelper.triggerChange(({ value, changeValue }) => {
145074
- if (d2 > 0) {
145075
- if (value > 8) {
145076
- changeValue(value + 0.4);
145077
- } else {
145078
- changeValue(value + 0.2);
145079
- }
145080
- } else if (d2 < 0) {
145081
- if (value > 8) {
145082
- changeValue(value - 0.4);
145083
- } else {
145084
- changeValue(value - 0.2);
145085
- }
145086
- }
145087
- });
145088
- updateLabelsForInViewFeatures();
145089
- }
145090
- };
145091
- return /* @__PURE__ */ React__default$1.createElement(PinchHelper, __spreadValues({}, pinchHandler), /* @__PURE__ */ React__default$1.createElement(ResizeSensor, { onResize: this.handleResize }, /* @__PURE__ */ React__default$1.createElement(
145092
- "div",
145093
- {
145094
- style: __spreadValues({
145095
- height: height2 || (isPairwise ? "auto" : viewportHeight * 0.88),
145096
- display: "flex",
145097
- flexDirection: "column",
145098
- justifyContent: "space-between",
145099
- position: "relative",
145100
- overflowY: "auto"
145101
- }, this.props.style),
145102
- className: "alignmentView"
145103
- },
145104
- /* @__PURE__ */ React__default$1.createElement(
145105
- DragDropContext,
145106
- {
145107
- onDragStart: this.onTrackDragStart,
145108
- onDragEnd: this.onTrackDragEnd
145109
- },
144473
+ }, "setCharWidthInLinearView");
144474
+ const scrollToCaret2 = /* @__PURE__ */ __name(() => {
144475
+ let el = window.document.querySelector(".veCaret:not(.zoomSelection)");
144476
+ if (!el) {
144477
+ el = window.document.querySelector(".veCaret");
144478
+ }
144479
+ if (!el) {
144480
+ return;
144481
+ }
144482
+ el.scrollIntoView({ inline: "center", block: "nearest" });
144483
+ }, "scrollToCaret");
144484
+ const scrollYToTrack = /* @__PURE__ */ __name((trackIndex) => {
144485
+ InfiniteScroller.current.scrollTo(trackIndex);
144486
+ }, "scrollYToTrack");
144487
+ const estimateRowHeight = /* @__PURE__ */ __name((index2, cache2) => {
144488
+ const track2 = alignmentTracks[index2];
144489
+ if (!track2)
144490
+ return 100;
144491
+ const { sequenceData: sequenceData22 } = track2;
144492
+ rowData.current = prepareRowData(
144493
+ sequenceData22,
144494
+ sequenceData22.sequence.length
144495
+ );
144496
+ return _estimateRowHeight({
144497
+ index: index2,
144498
+ cache: cache2,
144499
+ row: rowData.current[index2],
144500
+ annotationVisibility: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144501
+ annotationLabelVisibility: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility
144502
+ });
144503
+ }, "estimateRowHeight");
144504
+ const renderItem = /* @__PURE__ */ __name((_i, key, isTemplate, cloneProps) => {
144505
+ const isDragDisabled = !allowTrackRearrange || isPairwise;
144506
+ let i;
144507
+ if (isTemplate) {
144508
+ i = _i;
144509
+ } else if (hasTemplate) {
144510
+ i = _i + 1;
144511
+ } else {
144512
+ i = _i;
144513
+ }
144514
+ const track2 = alignmentTracks == null ? void 0 : alignmentTracks[i];
144515
+ if (!track2)
144516
+ return null;
144517
+ const {
144518
+ sequenceData: sequenceData22,
144519
+ alignmentData,
144520
+ isReversed,
144521
+ wasTrimmed,
144522
+ additionalSelectionLayers,
144523
+ chromatogramData
144524
+ // mismatches
144525
+ } = track2;
144526
+ const seqLen = maxLength;
144527
+ const trimmedRangesToDisplay = getTrimmedRangesToDisplay({
144528
+ seqLen,
144529
+ trimmedRange: alignmentData == null ? void 0 : alignmentData.trimmedRange
144530
+ });
144531
+ const linearViewWidth = (alignmentData || sequenceData22).sequence.length * charWidth2;
144532
+ const name2 = sequenceData22.name || sequenceData22.id;
144533
+ const tickSpacing = massageTickSpacing(Math.ceil(120 / charWidth2));
144534
+ const { compactNames } = alignmentVisibilityToolOptions.alignmentAnnotationVisibility;
144535
+ const selectionLayer22 = [
144536
+ tempTrimBefore[i] || trimmedRangesToDisplay[0],
144537
+ tempTrimAfter[i] || trimmedRangesToDisplay[1]
144538
+ ].filter((i2) => i2).map((i2) => __spreadProps(__spreadValues({}, i2), {
144539
+ hideCarets: true,
144540
+ ignoreGaps: true,
144541
+ className: "tg-trimmed-region",
144542
+ color: "gray"
144543
+ }));
144544
+ const innerRenderItem = /* @__PURE__ */ __name((provided = {}, snapshot) => {
144545
+ var _a3;
144546
+ return /* @__PURE__ */ React__default$1.createElement(
144547
+ "div",
144548
+ __spreadProps(__spreadValues({
144549
+ ref: provided == null ? void 0 : provided.innerRef
144550
+ }, provided == null ? void 0 : provided.draggableProps), {
144551
+ className: classNames("alignmentViewTrackContainer", {
144552
+ isDragDisabled
144553
+ }),
144554
+ "data-alignment-track-index": i,
144555
+ style: __spreadValues(__spreadValues({
144556
+ boxShadow: isTemplate ? "red 0px -1px 0px 0px inset, red 0px 1px 0px 0px inset" : "0px -1px 0px 0px inset",
144557
+ display: "flex"
144558
+ }, (_a3 = provided == null ? void 0 : provided.draggableProps) == null ? void 0 : _a3.style), (snapshot == null ? void 0 : snapshot.isDragging) && { left: unset }),
144559
+ key: i
144560
+ }),
145110
144561
  /* @__PURE__ */ React__default$1.createElement(
145111
144562
  "div",
145112
144563
  {
144564
+ className: "alignmentTrackName",
145113
144565
  style: {
145114
- display: "flex",
145115
- flexDirection: "column",
145116
- position: "relative",
145117
- overflowY: "auto"
144566
+ position: "sticky",
144567
+ left: 0,
144568
+ zIndex: 10,
144569
+ borderBottom: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144570
+ borderRight: `1px solid ${isTemplate ? "red" : "lightgray"}`,
144571
+ width: nameDivWidth - 3,
144572
+ padding: 2,
144573
+ marginRight: 3,
144574
+ paddingBottom: 0,
144575
+ minWidth: nameDivWidth - 3,
144576
+ overflow: "hidden",
144577
+ scrollbarWidth: "none",
144578
+ whiteSpace: "nowrap"
145118
144579
  },
145119
- className: "alignmentView-top-container"
144580
+ "data-title": name2,
144581
+ key: i
145120
144582
  },
145121
144583
  /* @__PURE__ */ React__default$1.createElement(
145122
144584
  "div",
145123
- {
145124
- style: {
145125
- paddingTop: "3px",
145126
- paddingBottom: "5px",
145127
- borderBottom: "1px solid",
144585
+ __spreadProps(__spreadValues({}, provided == null ? void 0 : provided.dragHandleProps), {
144586
+ style: __spreadProps(__spreadValues({}, compactNames && {
145128
144587
  display: "flex",
145129
- minHeight: "32px",
145130
- width: "100%",
145131
- flexWrap: "nowrap",
145132
- flexDirection: "row",
145133
- flex: "0 0 auto"
145134
- },
145135
- className: "ve-alignment-top-bar"
145136
- },
145137
- additionalTopLeftEl,
145138
- handleBackButtonClicked && /* @__PURE__ */ React__default$1.createElement(Tooltip, { content: "Back to Pairwise Alignment Overview" }, /* @__PURE__ */ React__default$1.createElement(
145139
- Button,
145140
- {
145141
- icon: "arrow-left",
145142
- onClick: () => {
145143
- handleBackButtonClicked();
145144
- this.caretPositionUpdate(-1);
145145
- },
145146
- small: true,
145147
- intent: Intent.PRIMARY,
145148
- minimal: true,
145149
- style: { marginRight: 10 },
145150
- className: "alignmentViewBackButton"
145151
- }
145152
- )),
145153
- /* @__PURE__ */ React__default$1.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ React__default$1.createElement(
145154
- EditableText,
145155
- {
145156
- disabled: !handleAlignmentRename,
145157
- onChange: (v2) => {
145158
- this.setState({
145159
- alignmentName: v2
145160
- });
145161
- },
145162
- maxLength: 399,
145163
- value: this.state.alignmentName,
145164
- onConfirm: (v2) => __async(this, null, function* () {
145165
- if (!v2) {
145166
- this.setState({
145167
- alignmentName: this.props.alignmentName
145168
- });
145169
- return;
145170
- }
145171
- if (v2 === this.props.alignmentName) {
145172
- return;
145173
- }
145174
- this.setState({ saveMessage: "Alignment Renaming.." });
145175
- this.setState({ saveMessageLoading: true });
145176
- yield handleAlignmentRename(v2, this.props);
145177
- this.setState({ saveMessage: "Rename Successful" });
145178
- this.setState({ saveMessageLoading: false });
145179
- setTimeout(() => {
145180
- this.setState({ saveMessage: void 0 });
145181
- this.setState({ saveMessageLoading: false });
145182
- }, 5e3);
145183
- }),
145184
- selectAllOnFocus: true,
145185
- className: "veAlignmentName"
145186
- }
145187
- ), "   ", /* @__PURE__ */ React__default$1.createElement(
144588
+ alignItems: "flex-start"
144589
+ }), {
144590
+ cursor: !isPairwise && allowTrackRearrange && !isTemplate ? "move" : ""
144591
+ })
144592
+ }),
144593
+ /* @__PURE__ */ React__default$1.createElement(
145188
144594
  "div",
145189
144595
  {
145190
- className: "veAlignmentType",
145191
- style: {
145192
- paddingTop: "3px",
145193
- fontSize: "14px",
145194
- color: "grey",
145195
- maxWidth: "300px",
145196
- overflow: "hidden",
145197
- textOverflow: "ellipsis",
145198
- whiteSpace: "nowrap"
145199
- },
145200
- "data-title": this.props.alignmentType || "Unknown Alignment Type"
144596
+ className: "alignmentTrackNameDiv",
144597
+ style: __spreadValues({
144598
+ background: "#3FA6DA",
144599
+ display: "inline-block",
144600
+ color: "white",
144601
+ borderRadius: 5,
144602
+ paddingRight: 5
144603
+ }, compactNames && {
144604
+ marginRight: 5
144605
+ })
145201
144606
  },
145202
- this.props.alignmentType || "Unknown Alignment Type"
145203
- )),
145204
- this.props.unmappedSeqs && /* @__PURE__ */ React__default$1.createElement(
145205
- InfoHelper,
145206
- {
145207
- size: 20,
145208
- content: /* @__PURE__ */ React__default$1.createElement("div", null, "This alignment had sequences that did not map to the template sequence:", this.props.unmappedSeqs.map(
145209
- ({ sequenceData: sequenceData2 }, i) => /* @__PURE__ */ React__default$1.createElement("div", { key: i }, sequenceData2.name)
145210
- )),
145211
- intent: "warning",
145212
- icon: "warning-sign"
145213
- }
145214
- ),
145215
- !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145216
- UncontrolledSliderWithPlusMinusBtns,
145217
- {
145218
- noWraparound: true,
145219
- bindOutsideChangeHelper: this.bindOutsideChangeHelper,
145220
- onClick: () => {
145221
- setTimeout(this.scrollToCaret, 0);
145222
- },
145223
- minCharWidth: this.getMinCharWidth(),
145224
- onChange: (zoomLvl) => __async(this, null, function* () {
145225
- this.isZooming = true;
145226
- setTimeout(() => {
145227
- this.isZooming = false;
145228
- }, 10);
145229
- const minCharWidth = this.getMinCharWidth();
145230
- const scaleFactor = Math.pow(12 / minCharWidth, 1 / 10);
145231
- const newCharWidth = minCharWidth * Math.pow(scaleFactor, zoomLvl);
145232
- yield this.setCharWidthInLinearView({
145233
- charWidthInLinearView: newCharWidth
145234
- });
145235
- yield this.scrollToCaret();
145236
- yield updateLabelsForInViewFeatures({
145237
- rectElement: ".alignmentHolder"
145238
- });
145239
- }),
145240
- coerceInitialValue,
145241
- title: "Adjust Zoom Level",
145242
- style: { paddingTop: "4px", width: 100 },
145243
- className: "veZoomAlignmentSlider ove-slider",
145244
- labelRenderer: false,
145245
- initialValue: charWidthInLinearView,
145246
- stepSize: 0.05,
145247
- max: 10,
145248
- min: 0,
145249
- clickStepSize: 0.5
145250
- }
145251
- ),
145252
- !noVisibilityOptions && !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145253
- AlignmentVisibilityTool,
145254
- __spreadValues({
145255
- currentPairwiseAlignmentIndex
145256
- }, alignmentVisibilityToolOptions)
145257
- ),
145258
- updateAlignmentSortOrder && !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145259
- Popover,
145260
- {
145261
- minimal: true,
145262
- content: /* @__PURE__ */ React__default$1.createElement(Menu, null, /* @__PURE__ */ React__default$1.createElement(
145263
- MenuItem,
145264
- {
145265
- active: true,
145266
- onClick: () => {
145267
- updateAlignmentSortOrder("Position");
145268
- },
145269
- text: "Position"
145270
- }
145271
- ), /* @__PURE__ */ React__default$1.createElement(
145272
- MenuItem,
145273
- {
145274
- active: alignmentSortOrder,
145275
- onClick: () => {
145276
- updateAlignmentSortOrder("Alphabetical");
145277
- },
145278
- text: "Alphabetical"
145279
- }
145280
- )),
145281
- target: /* @__PURE__ */ React__default$1.createElement(
145282
- Button,
145283
- {
145284
- small: true,
145285
- text: "Sort Order",
145286
- rightIcon: "caret-down",
145287
- icon: "sort"
145288
- }
145289
- )
145290
- }
144607
+ allowTrackNameEdit && /* @__PURE__ */ React__default$1.createElement(
144608
+ Button,
144609
+ {
144610
+ onClick: () => {
144611
+ showDialog({
144612
+ ModalComponent: EditTrackNameDialog,
144613
+ props: {
144614
+ initialValues: {
144615
+ name: name2
144616
+ },
144617
+ updateName: ({ newName }) => {
144618
+ updateTrackHelper({
144619
+ currentPairwiseAlignmentIndex,
144620
+ pairwiseAlignments,
144621
+ upsertAlignmentRun: upsertAlignmentRun2,
144622
+ alignmentId,
144623
+ alignmentTracks: alignmentTracks || [],
144624
+ alignmentTrackIndex: i,
144625
+ update: { name: newName }
144626
+ });
144627
+ }
144628
+ }
144629
+ });
144630
+ },
144631
+ small: true,
144632
+ "data-tip": "Edit Track Name",
144633
+ className: "edit-track-name-btn",
144634
+ icon: /* @__PURE__ */ React__default$1.createElement(Icon, { size: 12, color: "lightgrey", icon: "edit" }),
144635
+ minimal: true
144636
+ }
144637
+ ),
144638
+ sequenceData22.seqLink && /* @__PURE__ */ React__default$1.createElement(
144639
+ AnchorButton,
144640
+ {
144641
+ href: sequenceData22.seqLink,
144642
+ "data-tip": sequenceData22.seqLinkTooltip,
144643
+ target: "_blank",
144644
+ small: true,
144645
+ icon: /* @__PURE__ */ React__default$1.createElement(Icon, { size: 12, color: "white", icon: "document-open" }),
144646
+ minimal: true
144647
+ }
144648
+ ),
144649
+ name2
145291
144650
  ),
145292
- additionalTopEl,
145293
- this.state.saveMessage && /* @__PURE__ */ React__default$1.createElement(
145294
- "div",
144651
+ /* @__PURE__ */ React__default$1.createElement("div", { style: { fontSize: 10, marginTop: 2, marginBottom: 2 } }, isReversed && /* @__PURE__ */ React__default$1.createElement(
144652
+ "span",
145295
144653
  {
145296
- className: "ove-menu-toast",
145297
144654
  style: {
145298
- display: "flex",
145299
- alignItems: "center",
145300
- marginLeft: "auto",
145301
- marginRight: 10
145302
- }
144655
+ backgroundColor: isReversed ? "#E76A6E" : "#4C90F0",
144656
+ padding: 2,
144657
+ paddingLeft: 4,
144658
+ color: "white",
144659
+ marginRight: 2,
144660
+ borderRadius: "5px"
144661
+ },
144662
+ "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"
145303
144663
  },
145304
- this.state.saveMessageLoading ? /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement(Spinner, { size: 15 })) : /* @__PURE__ */ React__default$1.createElement(Icon, { icon: "tick-circle", intent: "success" }),
145305
- " ",
145306
- " ",
145307
- this.state.saveMessage
145308
- )
145309
- ),
145310
- hasTemplate ? /* @__PURE__ */ React__default$1.createElement(React__default$1.Fragment, null, /* @__PURE__ */ React__default$1.createElement("div", { className: "alignmentTrackFixedToTop" }, getTrackVis([firstTrack], true, alignmentTracks)), getTrackVis(otherTracks, false, alignmentTracks)) : getTrackVis(alignmentTracks, false, alignmentTracks)
145311
- )
145312
- ),
145313
- !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145314
- "div",
145315
- {
145316
- className: "alignmentViewBottomBar",
145317
- style: {
145318
- // flexGrow: 1,
145319
- // minHeight: "-webkit-min-content", //https://stackoverflow.com/questions/28029736/how-to-prevent-a-flex-item-from-shrinking-smaller-than-its-content
145320
- maxHeight: 210,
145321
- marginTop: 4,
145322
- paddingTop: 4,
145323
- borderTop: "1px solid lightgrey",
145324
- display: "flex"
145325
- }
145326
- },
145327
- /* @__PURE__ */ React__default$1.createElement(
145328
- Minimap,
145329
- __spreadProps(__spreadValues({}, {
145330
- selectionLayerComp: /* @__PURE__ */ React__default$1.createElement(React__default$1.Fragment, null, /* @__PURE__ */ React__default$1.createElement(
145331
- PerformantSelectionLayer,
145332
- {
145333
- is: true,
145334
- hideCarets: true,
145335
- className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145336
- easyStore: this.easyStore,
145337
- sequenceLength,
145338
- charWidth: this.getMinCharWidth(true),
145339
- row: { start: 0, end: sequenceLength - 1 }
145340
- }
145341
- ), /* @__PURE__ */ React__default$1.createElement(
145342
- PerformantCaret,
144664
+ isReversed ? "REV" : "FWD",
144665
+ " "
144666
+ ), wasTrimmed && /* @__PURE__ */ React__default$1.createElement(
144667
+ "span",
145343
144668
  {
145344
144669
  style: {
145345
- opacity: 0.2
144670
+ backgroundColor: "#13C9BA",
144671
+ padding: 2,
144672
+ paddingLeft: 4,
144673
+ color: "white",
144674
+ marginRight: 2,
144675
+ borderRadius: "5px"
145346
144676
  },
145347
- className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145348
- sequenceLength,
145349
- charWidth: this.getMinCharWidth(true),
145350
- row: { start: 0, end: sequenceLength - 1 },
145351
- easyStore: this.easyStore
144677
+ "data-tip": "This sequence was trimmed and resubmitted for alignment"
144678
+ },
144679
+ "TRIMMED"
144680
+ ), sequenceData22.sequence.length, " bps")
144681
+ ),
144682
+ /* @__PURE__ */ React__default$1.createElement(
144683
+ HorizontalPanelDragHandle,
144684
+ {
144685
+ onDrag: ({ dx }) => {
144686
+ setNameDivWidth(Math.min(nameDivWidth - dx, width - 20));
145352
144687
  }
145353
- )),
145354
- alignmentTracks,
144688
+ }
144689
+ )
144690
+ ),
144691
+ handleSelectTrack && !isTemplate && /* @__PURE__ */ React__default$1.createElement(
144692
+ "div",
144693
+ {
144694
+ onClick: () => {
144695
+ handleSelectTrack(i);
144696
+ },
144697
+ style: {
144698
+ position: "absolute",
144699
+ opacity: 0,
144700
+ height: "100%",
144701
+ left: nameDivWidth,
144702
+ width: linearViewWidth,
144703
+ fontWeight: "bolder",
144704
+ cursor: "pointer",
144705
+ padding: 5,
144706
+ textAlign: "center",
144707
+ zIndex: 400
144708
+ },
144709
+ className: "alignmentViewSelectTrackPopover veWhiteBackground"
144710
+ },
144711
+ "Inspect track"
144712
+ ),
144713
+ /* @__PURE__ */ React__default$1.createElement(
144714
+ NonReduxEnhancedLinearView,
144715
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
144716
+ caretPosition: tempTrimmingCaret[i] || -1,
144717
+ selectionLayer: selectionLayer22,
144718
+ isInAlignment: true,
144719
+ annotationVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationVisibility,
144720
+ linearViewAnnotationLabelVisibilityOverrides: alignmentVisibilityToolOptions.alignmentAnnotationLabelVisibility,
144721
+ marginWith: 0,
144722
+ orfClicked: annotationClicked,
144723
+ primerClicked: annotationClicked,
144724
+ translationClicked: annotationClicked,
144725
+ cutsiteClicked: annotationClicked,
144726
+ translationDoubleClicked: annotationClicked,
144727
+ deletionLayerClicked: annotationClicked,
144728
+ replacementLayerClicked: annotationClicked,
144729
+ featureClicked: annotationClicked,
144730
+ partClicked: annotationClicked,
144731
+ searchLayerClicked: annotationClicked,
144732
+ editorDragStarted: noop$7,
144733
+ editorDragStopped: noop$7,
144734
+ editorDragged: noop$7,
144735
+ hideName: true,
144736
+ sequenceData: sequenceData22,
144737
+ tickSpacing,
144738
+ allowSeqDataOverride: true,
144739
+ editorName: `${isTemplate ? "template_" : ""}alignmentView${i}`,
144740
+ alignmentData,
144741
+ chromatogramData,
144742
+ height: "100%",
144743
+ vectorInteractionWrapperStyle: {
144744
+ overflowY: "hidden"
144745
+ },
144746
+ withZoomLinearView: false,
144747
+ marginWidth: 0,
144748
+ linearViewCharWidth: charWidth2,
144749
+ ignoreGapsOnHighlight: true
144750
+ }), linearViewOptions && (isFunction$7(linearViewOptions) ? linearViewOptions({
144751
+ index: i,
144752
+ isTemplate,
144753
+ alignmentVisibilityToolOptions,
144754
+ sequenceData: sequenceData22,
144755
+ alignmentData,
144756
+ chromatogramData
144757
+ }) : linearViewOptions)), {
144758
+ additionalSelectionLayers,
145355
144759
  dimensions: {
145356
- width: Math.max(this.state.width, 10) || 10
144760
+ width: linearViewWidth
145357
144761
  },
145358
- nameDivOffsetPercent: 0,
145359
- // this.state.nameDivWidth / this.getMaxLinearViewWidth(),
145360
- scrollYToTrack: this.scrollYToTrack,
145361
- onSizeAdjust: this.onMinimapSizeAdjust,
145362
- minSliderSize,
145363
- laneHeight: minimapLaneHeight || (alignmentTracks.length > 5 ? 10 : 17),
145364
- laneSpacing: minimapLaneSpacing || (alignmentTracks.length > 5 ? 2 : 1),
145365
- easyStore: this.easyStore,
145366
- numBpsShownInLinearView: this.getNumBpsShownInLinearView(),
145367
- scrollAlignmentView: this.state.scrollAlignmentView
145368
- }), {
145369
- onMinimapScrollX: this.scrollAlignmentToPercent
144762
+ width: linearViewWidth,
144763
+ paddingBottom: 5,
144764
+ scrollDataPassed: easyStore2.current
145370
144765
  })
145371
144766
  )
145372
- ),
145373
- /* @__PURE__ */ React__default$1.createElement(
145374
- GlobalDialog,
145375
- null
144767
+ );
144768
+ }, "innerRenderItem");
144769
+ if (isTemplate)
144770
+ return innerRenderItem();
144771
+ if (cloneProps)
144772
+ return innerRenderItem(cloneProps.provided, cloneProps.snapshot);
144773
+ const idToUse = alignmentData.id || sequenceData22.id || i + "_index_id";
144774
+ return /* @__PURE__ */ React__default$1.createElement(
144775
+ PublicDraggable,
144776
+ {
144777
+ key: idToUse.toString(),
144778
+ index: i,
144779
+ isDragDisabled,
144780
+ draggableId: idToUse.toString()
144781
+ },
144782
+ innerRenderItem
144783
+ );
144784
+ }, "renderItem");
144785
+ const handleResize = throttle$1(([e2]) => {
144786
+ easyStore2.current.viewportWidth = e2.contentRect.width - nameDivWidth || 400;
144787
+ setWidth(e2.contentRect.width);
144788
+ }, 200);
144789
+ const removeMinimapHighlightForMouseLeave = /* @__PURE__ */ __name(() => {
144790
+ const minimapLaneEl = document.querySelector(`.minimapLane.lane-hovered`);
144791
+ if (!minimapLaneEl)
144792
+ return;
144793
+ minimapLaneEl.classList.remove("lane-hovered");
144794
+ }, "removeMinimapHighlightForMouseLeave");
144795
+ const updateMinimapHighlightForMouseMove = /* @__PURE__ */ __name((event) => {
144796
+ latestMouseY.current = getClientY(event);
144797
+ updateMinimapHighlight();
144798
+ }, "updateMinimapHighlightForMouseMove");
144799
+ const updateMinimapHighlight = /* @__PURE__ */ __name(() => {
144800
+ const rows = document.querySelectorAll(`.alignmentViewTrackContainer`);
144801
+ const rowsLength = document.querySelectorAll(`.minimapLane`).length;
144802
+ if (rowsLength <= 4) {
144803
+ return;
144804
+ }
144805
+ some(rows, (rowDomNode) => {
144806
+ const boundingRowRect = rowDomNode.getBoundingClientRect();
144807
+ if (latestMouseY.current > boundingRowRect.top && latestMouseY.current < boundingRowRect.top + boundingRowRect.height) {
144808
+ const prevMinimapLaneEl = document.querySelector(
144809
+ `.minimapLane.lane-hovered`
144810
+ );
144811
+ if (prevMinimapLaneEl) {
144812
+ prevMinimapLaneEl.classList.remove("lane-hovered");
144813
+ }
144814
+ const i = Number(rowDomNode.getAttribute("data-alignment-track-index"));
144815
+ const minimapLaneEl = document.querySelector(
144816
+ `.minimapLane:nth-child(${i + 1})`
144817
+ );
144818
+ if (!minimapLaneEl)
144819
+ return;
144820
+ minimapLaneEl.classList.add("lane-hovered");
144821
+ return true;
144822
+ }
144823
+ });
144824
+ }, "updateMinimapHighlight");
144825
+ const onTrackDragStart = /* @__PURE__ */ __name(() => {
144826
+ setIsTrackDragging(true);
144827
+ }, "onTrackDragStart");
144828
+ const onTrackDragEnd = /* @__PURE__ */ __name(({ destination, source }) => {
144829
+ setIsTrackDragging(false);
144830
+ if (!destination) {
144831
+ return;
144832
+ }
144833
+ upsertAlignmentRun2({
144834
+ id: alignmentId,
144835
+ alignmentTracks: array_move(
144836
+ alignmentTracks,
144837
+ source.index,
144838
+ destination.index
145376
144839
  )
145377
- )));
145378
- }
145379
- getTrackTrimmingOptions({
144840
+ });
144841
+ }, "onTrackDragEnd");
144842
+ const getTrackTrimmingOptions = /* @__PURE__ */ __name(({
145380
144843
  e: e2,
145381
144844
  allTracks,
145382
- upsertAlignmentRun: upsertAlignmentRun2,
145383
- currentPairwiseAlignmentIndex,
145384
- alignmentId
145385
- }) {
144845
+ upsertAlignmentRun: upsertAlignmentRun22,
144846
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144847
+ alignmentId: alignmentId2
144848
+ }) => {
145386
144849
  const track2 = getTrackFromEvent(e2, allTracks);
145387
- this.getNearestCursorPositionToMouseEvent(
145388
- this.rowData,
144850
+ getNearestCursorPositionToMouseEvent2(
144851
+ rowData.current,
145389
144852
  e2,
145390
144853
  ({ nearestCaretPos }) => {
145391
- var _a2, _b2, _c, _d;
145392
- this.setState({
145393
- [`tempTrimmingCaret${track2.index}`]: nearestCaretPos
145394
- });
145395
- const afterDisabled = nearestCaretPos <= ((_a2 = track2.alignmentData.trimmedRange) == null ? void 0 : _a2.start);
144854
+ var _a3, _b2, _c, _d;
144855
+ setTempTrimmingCaret((prev) => __spreadProps(__spreadValues({}, prev), {
144856
+ [track2.index]: nearestCaretPos
144857
+ }));
144858
+ const afterDisabled = nearestCaretPos <= ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.start);
145396
144859
  const beforeDisabled = nearestCaretPos > ((_b2 = track2.alignmentData.trimmedRange) == null ? void 0 : _b2.end);
145397
144860
  showContextMenu(
145398
144861
  [
@@ -145413,28 +144876,25 @@ ${seqDataToCopy}\r
145413
144876
  text: "Ignore Before",
145414
144877
  disabled: beforeDisabled,
145415
144878
  icon: "drawer-left-filled",
145416
- onMouseOver: () => !beforeDisabled && this.setState({
145417
- [`tempTrimBefore${track2.index}`]: {
145418
- start: 0,
145419
- end: nearestCaretPos - 1
145420
- }
145421
- }),
145422
- onMouseLeave: () => this.setState({
145423
- [`tempTrimBefore${track2.index}`]: void 0
145424
- }),
144879
+ onMouseOver: () => !beforeDisabled && setTempTrimBefore((prev) => __spreadProps(__spreadValues({}, prev), {
144880
+ [track2.index]: { start: 0, end: nearestCaretPos - 1 }
144881
+ })),
144882
+ onMouseLeave: () => setTempTrimBefore((prev) => __spreadProps(__spreadValues({}, prev), {
144883
+ [track2.index]: void 0
144884
+ })),
145425
144885
  onClick: () => {
145426
- var _a3;
144886
+ var _a4;
145427
144887
  updateTrackHelper({
145428
- currentPairwiseAlignmentIndex,
145429
- upsertAlignmentRun: upsertAlignmentRun2,
145430
- alignmentId,
144888
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144889
+ upsertAlignmentRun: upsertAlignmentRun22,
144890
+ alignmentId: alignmentId2,
145431
144891
  alignmentTracks: allTracks,
145432
144892
  alignmentTrackIndex: track2.index,
145433
144893
  hasBeenTrimmed: true,
145434
144894
  update: {
145435
144895
  trimmedRange: {
145436
144896
  start: nearestCaretPos,
145437
- end: ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.end) || this.getMaxLength() - 1
144897
+ end: ((_a4 = track2.alignmentData.trimmedRange) == null ? void 0 : _a4.end) || maxLength - 1
145438
144898
  }
145439
144899
  }
145440
144900
  });
@@ -145444,27 +144904,24 @@ ${seqDataToCopy}\r
145444
144904
  text: "Ignore After",
145445
144905
  disabled: afterDisabled,
145446
144906
  icon: "drawer-right-filled",
145447
- onMouseOver: () => !afterDisabled && this.setState({
145448
- [`tempTrimAfter${track2.index}`]: {
145449
- start: nearestCaretPos,
145450
- end: this.getMaxLength() - 1
145451
- }
145452
- }),
145453
- onMouseLeave: () => this.setState({
145454
- [`tempTrimAfter${track2.index}`]: void 0
145455
- }),
144907
+ onMouseOver: () => !afterDisabled && setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), {
144908
+ [track2.index]: { start: nearestCaretPos, end: maxLength - 1 }
144909
+ })),
144910
+ onMouseLeave: () => setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), {
144911
+ [track2.index]: void 0
144912
+ })),
145456
144913
  onClick: () => {
145457
- var _a3;
144914
+ var _a4;
145458
144915
  updateTrackHelper({
145459
- currentPairwiseAlignmentIndex,
145460
- upsertAlignmentRun: upsertAlignmentRun2,
145461
- alignmentId,
144916
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144917
+ upsertAlignmentRun: upsertAlignmentRun22,
144918
+ alignmentId: alignmentId2,
145462
144919
  alignmentTracks: allTracks,
145463
144920
  alignmentTrackIndex: track2.index,
145464
144921
  hasBeenTrimmed: true,
145465
144922
  update: {
145466
144923
  trimmedRange: {
145467
- start: ((_a3 = track2.alignmentData.trimmedRange) == null ? void 0 : _a3.start) || 0,
144924
+ start: ((_a4 = track2.alignmentData.trimmedRange) == null ? void 0 : _a4.start) || 0,
145468
144925
  end: nearestCaretPos - 1
145469
144926
  }
145470
144927
  }
@@ -145480,9 +144937,9 @@ ${seqDataToCopy}\r
145480
144937
  icon: "trash",
145481
144938
  onClick: () => {
145482
144939
  updateTrackHelper({
145483
- currentPairwiseAlignmentIndex,
145484
- upsertAlignmentRun: upsertAlignmentRun2,
145485
- alignmentId,
144940
+ currentPairwiseAlignmentIndex: currentPairwiseAlignmentIndex2,
144941
+ upsertAlignmentRun: upsertAlignmentRun22,
144942
+ alignmentId: alignmentId2,
145486
144943
  alignmentTracks: allTracks,
145487
144944
  alignmentTrackIndex: track2.index,
145488
144945
  hasBeenTrimmed: false,
@@ -145496,19 +144953,562 @@ ${seqDataToCopy}\r
145496
144953
  void 0,
145497
144954
  e2,
145498
144955
  () => {
145499
- this.setState({
145500
- [`tempTrimmingCaret${track2.index}`]: void 0
145501
- });
144956
+ setTempTrimAfter((prev) => __spreadProps(__spreadValues({}, prev), { [track2.index]: void 0 }));
145502
144957
  }
145503
144958
  );
145504
144959
  }
145505
144960
  );
145506
144961
  e2.preventDefault();
145507
144962
  e2.stopPropagation();
144963
+ }, "getTrackTrimmingOptions");
144964
+ if (!alignmentTracks || !alignmentTracks[0] || !alignmentTracks[0].alignmentData) {
144965
+ console.error("corrupted data!", props);
144966
+ return "corrupted data!";
145508
144967
  }
145509
- };
145510
- __name(_AlignmentView, "AlignmentView");
145511
- let AlignmentView = _AlignmentView;
144968
+ const getTrackVis = /* @__PURE__ */ __name((alignmentTracks2, isTemplate, allTracks) => {
144969
+ const rowData2 = {};
144970
+ const innerTrackVis = /* @__PURE__ */ __name((drop_provided, drop_snapshot) => {
144971
+ return /* @__PURE__ */ React__default$1.createElement(
144972
+ "div",
144973
+ {
144974
+ className: "alignmentTracks ",
144975
+ style: {
144976
+ overflowY: "auto",
144977
+ display: "flex",
144978
+ zIndex: 10
144979
+ }
144980
+ },
144981
+ /* @__PURE__ */ React__default$1.createElement(
144982
+ "div",
144983
+ {
144984
+ style: { overflowX: "auto", width },
144985
+ ref: (ref2) => {
144986
+ if (isTemplate) {
144987
+ alignmentHolderTop.current = ref2;
144988
+ } else {
144989
+ alignmentHolder.current = ref2;
144990
+ }
144991
+ },
144992
+ onContextMenu: (e2) => {
144993
+ if (!allowTrimming || isTargetWithinEl(e2, ".alignmentTrackName")) {
144994
+ return;
144995
+ }
144996
+ getTrackTrimmingOptions({
144997
+ e: e2,
144998
+ allTracks,
144999
+ upsertAlignmentRun: upsertAlignmentRun2,
145000
+ alignmentId,
145001
+ currentPairwiseAlignmentIndex
145002
+ });
145003
+ },
145004
+ onMouseLeave: removeMinimapHighlightForMouseLeave,
145005
+ onMouseMove: updateMinimapHighlightForMouseMove,
145006
+ dataname: "scrollGroup",
145007
+ className: "alignmentHolder",
145008
+ onScroll: isTemplate ? handleTopScroll : handleScroll
145009
+ },
145010
+ /* @__PURE__ */ React__default$1.createElement(
145011
+ ReactDraggable,
145012
+ {
145013
+ disabled: isTrackDragging,
145014
+ bounds: { top: 0, left: 0, right: 0, bottom: 0 },
145015
+ onDrag: noClickDragHandlers ? noop$7 : (event) => {
145016
+ if (isTrackDragging)
145017
+ return;
145018
+ getNearestCursorPositionToMouseEvent2(
145019
+ rowData2,
145020
+ event,
145021
+ editorDragged
145022
+ );
145023
+ },
145024
+ onStart: noClickDragHandlers ? noop$7 : (event) => {
145025
+ if (isTargetWithinEl(event, ".alignmentTrackName")) {
145026
+ setIsTrackDragging(true);
145027
+ return;
145028
+ }
145029
+ if (isTrackDragging)
145030
+ return;
145031
+ getNearestCursorPositionToMouseEvent2(
145032
+ rowData2,
145033
+ event,
145034
+ editorDragStarted
145035
+ );
145036
+ },
145037
+ onStop: noClickDragHandlers ? noop$7 : (...args) => {
145038
+ setTimeout(() => {
145039
+ setIsTrackDragging(false);
145040
+ }, 0);
145041
+ editorDragStopped(...args);
145042
+ }
145043
+ },
145044
+ /* @__PURE__ */ React__default$1.createElement(
145045
+ "div",
145046
+ {
145047
+ ref: veTracksAndAlignmentHolder,
145048
+ className: classNames("veTracksAndAlignmentHolder", {
145049
+ isTrackDragging
145050
+ }),
145051
+ onClick: noClickDragHandlers ? noop$7 : (event) => {
145052
+ if (isTrackDragging)
145053
+ return;
145054
+ if (isTargetWithinEl(event, ".alignmentTrackName")) {
145055
+ return;
145056
+ }
145057
+ getNearestCursorPositionToMouseEvent2(
145058
+ rowData2,
145059
+ event,
145060
+ editorClicked
145061
+ );
145062
+ }
145063
+ },
145064
+ /* @__PURE__ */ React__default$1.createElement(
145065
+ PerformantSelectionLayer,
145066
+ {
145067
+ leftMargin: nameDivWidth,
145068
+ className: "veAlignmentSelectionLayer",
145069
+ isDraggable: true,
145070
+ selectionLayerRightClicked: selectionLayerRightClicked ? (...args) => {
145071
+ selectionLayerRightClicked(...args, props);
145072
+ } : (...args) => {
145073
+ const { event } = args[0];
145074
+ const track2 = getTrackFromEvent(event, allTracks);
145075
+ const alignmentData = track2.alignmentData;
145076
+ const { name: name2 } = alignmentData;
145077
+ const copySpecificAlignmentFasta = /* @__PURE__ */ __name(() => __async(void 0, null, function* () {
145078
+ const { selectionLayer: selectionLayer22 } = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2] || {};
145079
+ const seqDataToCopy = getSequenceDataBetweenRange(
145080
+ alignmentData,
145081
+ selectionLayer22
145082
+ ).sequence;
145083
+ const seqDataToCopyAsFasta = `>${name2}\r
145084
+ ${seqDataToCopy}\r
145085
+ `;
145086
+ yield navigator.clipboard.writeText(
145087
+ seqDataToCopyAsFasta
145088
+ );
145089
+ }), "copySpecificAlignmentFasta");
145090
+ const copySpecificAlignment = /* @__PURE__ */ __name(() => __async(void 0, null, function* () {
145091
+ const { selectionLayer: selectionLayer22 } = store2.getState().VectorEditor.__allEditorsOptions.alignments[id2] || {};
145092
+ const seqDataToCopy = getSequenceDataBetweenRange(
145093
+ alignmentData,
145094
+ selectionLayer22
145095
+ ).sequence;
145096
+ yield navigator.clipboard.writeText(seqDataToCopy);
145097
+ }), "copySpecificAlignment");
145098
+ const getAllAlignmentsFastaText2 = /* @__PURE__ */ __name(() => __async(void 0, null, function* () {
145099
+ yield navigator.clipboard.writeText(
145100
+ getAllAlignmentsFastaText2()
145101
+ );
145102
+ }), "getAllAlignmentsFastaText2");
145103
+ showContextMenu(
145104
+ [
145105
+ ...additionalSelectionLayerRightClickedOptions ? additionalSelectionLayerRightClickedOptions(
145106
+ ...args,
145107
+ props
145108
+ ) : [],
145109
+ {
145110
+ text: "Copy Selection of All Alignments as Fasta",
145111
+ className: "copyAllAlignmentsFastaClipboardHelper",
145112
+ hotkey: "cmd+c",
145113
+ onClick: () => {
145114
+ getAllAlignmentsFastaText2();
145115
+ window.toastr.success("Selection Copied");
145116
+ }
145117
+ },
145118
+ {
145119
+ text: `Copy Selection of ${name2} as Fasta`,
145120
+ className: "copySpecificAlignmentFastaClipboardHelper",
145121
+ onClick: () => {
145122
+ copySpecificAlignmentFasta();
145123
+ window.toastr.success(
145124
+ "Selection Copied As Fasta"
145125
+ );
145126
+ }
145127
+ },
145128
+ {
145129
+ text: `Copy Selection of ${name2}`,
145130
+ className: "copySpecificAlignmentAsPlainClipboardHelper",
145131
+ onClick: () => {
145132
+ copySpecificAlignment();
145133
+ window.toastr.success("Selection Copied");
145134
+ }
145135
+ }
145136
+ ],
145137
+ void 0,
145138
+ event
145139
+ );
145140
+ },
145141
+ easyStore: easyStore2.current,
145142
+ sequenceLength: maxLength,
145143
+ charWidth: charWidth2,
145144
+ row: { start: 0, end: maxLength - 1 }
145145
+ }
145146
+ ),
145147
+ /* @__PURE__ */ React__default$1.createElement(
145148
+ PerformantCaret,
145149
+ {
145150
+ leftMargin: nameDivWidth,
145151
+ className: "veAlignmentSelectionLayer",
145152
+ isDraggable: true,
145153
+ sequenceLength: maxLength,
145154
+ charWidth: charWidth2,
145155
+ row: { start: 0, end: maxLength - 1 },
145156
+ easyStore: easyStore2.current
145157
+ }
145158
+ ),
145159
+ isTemplate ? renderItem(0, 0, isTemplate) : /* @__PURE__ */ React__default$1.createElement(
145160
+ ReactList,
145161
+ {
145162
+ ref: (c2) => {
145163
+ InfiniteScroller.current = c2;
145164
+ const domNode = ReactDOM$1.findDOMNode(c2);
145165
+ if (domNode instanceof HTMLElement) {
145166
+ drop_provided.innerRef(domNode);
145167
+ }
145168
+ },
145169
+ type: "variable",
145170
+ itemSizeEstimator: estimateRowHeight,
145171
+ itemRenderer: renderItem,
145172
+ length: alignmentTracks2.length + (drop_snapshot.isUsingPlaceholder ? 1 : 0)
145173
+ }
145174
+ )
145175
+ )
145176
+ )
145177
+ )
145178
+ );
145179
+ }, "innerTrackVis");
145180
+ if (isTemplate)
145181
+ return innerTrackVis();
145182
+ else
145183
+ return /* @__PURE__ */ React__default$1.createElement(
145184
+ ConnectedDroppable$1,
145185
+ {
145186
+ mode: "virtual",
145187
+ renderClone: (provided, snapshot, { source: { index: index2 } }) => {
145188
+ return renderItem(index2, index2, false, {
145189
+ provided,
145190
+ snapshot
145191
+ });
145192
+ },
145193
+ direction: "vertical",
145194
+ droppableId: "droppable" + isTemplate ? "_no_drop" : ""
145195
+ },
145196
+ innerTrackVis
145197
+ );
145198
+ }, "getTrackVis");
145199
+ const [firstTrack, ...otherTracks] = alignmentTracks;
145200
+ const totalWidthOfMinimap = width;
145201
+ const totalWidthInAlignmentView = 14 * getSequenceLength();
145202
+ const minSliderSize = Math.min(
145203
+ totalWidthOfMinimap * (totalWidthOfMinimap / totalWidthInAlignmentView),
145204
+ totalWidthOfMinimap
145205
+ );
145206
+ const viewportHeight = Math.max(
145207
+ document.documentElement.clientHeight,
145208
+ window.innerHeight || 0
145209
+ );
145210
+ const pinchHandler = {
145211
+ onPinch: ({ delta: [d2] }) => {
145212
+ bindOutsideChangeHelper.current.triggerChange(
145213
+ ({ value, changeValue }) => {
145214
+ if (d2 > 0) {
145215
+ if (value > 8) {
145216
+ changeValue(value + 0.4);
145217
+ } else {
145218
+ changeValue(value + 0.2);
145219
+ }
145220
+ } else if (d2 < 0) {
145221
+ if (value > 8) {
145222
+ changeValue(value - 0.4);
145223
+ } else {
145224
+ changeValue(value - 0.2);
145225
+ }
145226
+ }
145227
+ }
145228
+ );
145229
+ updateLabelsForInViewFeatures();
145230
+ }
145231
+ };
145232
+ return /* @__PURE__ */ React__default$1.createElement(PinchHelper, __spreadValues({}, pinchHandler), /* @__PURE__ */ React__default$1.createElement(ResizeSensor, { onResize: handleResize }, /* @__PURE__ */ React__default$1.createElement(
145233
+ "div",
145234
+ {
145235
+ style: __spreadValues({
145236
+ height: height2 || (isPairwise ? "auto" : viewportHeight * 0.88),
145237
+ display: "flex",
145238
+ flexDirection: "column",
145239
+ justifyContent: "space-between",
145240
+ position: "relative",
145241
+ overflowY: "auto"
145242
+ }, style2),
145243
+ className: "alignmentView"
145244
+ },
145245
+ /* @__PURE__ */ React__default$1.createElement(
145246
+ DragDropContext,
145247
+ {
145248
+ onDragStart: onTrackDragStart,
145249
+ onDragEnd: onTrackDragEnd
145250
+ },
145251
+ /* @__PURE__ */ React__default$1.createElement(
145252
+ "div",
145253
+ {
145254
+ style: {
145255
+ display: "flex",
145256
+ flexDirection: "column",
145257
+ position: "relative",
145258
+ overflowY: "auto"
145259
+ },
145260
+ className: "alignmentView-top-container"
145261
+ },
145262
+ /* @__PURE__ */ React__default$1.createElement(
145263
+ "div",
145264
+ {
145265
+ style: {
145266
+ paddingTop: "3px",
145267
+ paddingBottom: "5px",
145268
+ borderBottom: "1px solid",
145269
+ display: "flex",
145270
+ minHeight: "32px",
145271
+ width: "100%",
145272
+ flexWrap: "nowrap",
145273
+ flexDirection: "row",
145274
+ flex: "0 0 auto"
145275
+ },
145276
+ className: "ve-alignment-top-bar"
145277
+ },
145278
+ additionalTopLeftEl,
145279
+ handleBackButtonClicked && /* @__PURE__ */ React__default$1.createElement(Tooltip, { content: "Back to Pairwise Alignment Overview" }, /* @__PURE__ */ React__default$1.createElement(
145280
+ Button,
145281
+ {
145282
+ icon: "arrow-left",
145283
+ onClick: () => {
145284
+ handleBackButtonClicked();
145285
+ caretPositionUpdate2(-1);
145286
+ },
145287
+ small: true,
145288
+ intent: Intent.PRIMARY,
145289
+ minimal: true,
145290
+ style: { marginRight: 10 },
145291
+ className: "alignmentViewBackButton"
145292
+ }
145293
+ )),
145294
+ /* @__PURE__ */ React__default$1.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ React__default$1.createElement(
145295
+ EditableText,
145296
+ {
145297
+ disabled: !handleAlignmentRename,
145298
+ onChange: (v2) => {
145299
+ setAlignmentName(v2);
145300
+ },
145301
+ maxLength: 399,
145302
+ value: alignmentName,
145303
+ onConfirm: (v2) => __async(void 0, null, function* () {
145304
+ if (!v2) {
145305
+ setAlignmentName(_alignmentName);
145306
+ return;
145307
+ }
145308
+ if (v2 === _alignmentName) {
145309
+ return;
145310
+ }
145311
+ setSaveMessage("Alignment Renaming..");
145312
+ setSaveMessageLoading(true);
145313
+ yield handleAlignmentRename(v2, props);
145314
+ setSaveMessage("Rename Successful");
145315
+ setSaveMessageLoading(false);
145316
+ setTimeout(() => {
145317
+ setSaveMessage(void 0);
145318
+ setSaveMessageLoading(false);
145319
+ }, 5e3);
145320
+ }),
145321
+ selectAllOnFocus: true,
145322
+ className: "veAlignmentName"
145323
+ }
145324
+ ), "   ", /* @__PURE__ */ React__default$1.createElement(
145325
+ "div",
145326
+ {
145327
+ className: "veAlignmentType",
145328
+ style: {
145329
+ paddingTop: "3px",
145330
+ fontSize: "14px",
145331
+ color: "grey",
145332
+ maxWidth: "300px",
145333
+ overflow: "hidden",
145334
+ textOverflow: "ellipsis",
145335
+ whiteSpace: "nowrap"
145336
+ },
145337
+ "data-title": alignmentType || "Unknown Alignment Type"
145338
+ },
145339
+ alignmentType || "Unknown Alignment Type"
145340
+ )),
145341
+ unmappedSeqs && /* @__PURE__ */ React__default$1.createElement(
145342
+ InfoHelper,
145343
+ {
145344
+ size: 20,
145345
+ content: /* @__PURE__ */ React__default$1.createElement("div", null, "This alignment had sequences that did not map to the template sequence:", unmappedSeqs.map(({ sequenceData: sequenceData22 }, i) => /* @__PURE__ */ React__default$1.createElement("div", { key: i }, sequenceData22.name))),
145346
+ intent: "warning",
145347
+ icon: "warning-sign"
145348
+ }
145349
+ ),
145350
+ !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145351
+ UncontrolledSliderWithPlusMinusBtns,
145352
+ {
145353
+ noWraparound: true,
145354
+ bindOutsideChangeHelper: bindOutsideChangeHelper.current,
145355
+ onClick: () => {
145356
+ setTimeout(scrollToCaret2, 0);
145357
+ },
145358
+ minCharWidth: getMinCharWidth(),
145359
+ onChange: (zoomLvl) => __async(void 0, null, function* () {
145360
+ isZooming.current = true;
145361
+ setTimeout(() => {
145362
+ isZooming.current = false;
145363
+ }, 10);
145364
+ const minCharWidth = getMinCharWidth();
145365
+ const scaleFactor = Math.pow(12 / minCharWidth, 1 / 10);
145366
+ const newCharWidth = minCharWidth * Math.pow(scaleFactor, zoomLvl);
145367
+ yield setCharWidthInLinearView({
145368
+ charWidthInLinearView: newCharWidth
145369
+ });
145370
+ yield scrollToCaret2();
145371
+ yield updateLabelsForInViewFeatures({
145372
+ rectElement: ".alignmentHolder"
145373
+ });
145374
+ }),
145375
+ coerceInitialValue,
145376
+ title: "Adjust Zoom Level",
145377
+ style: { paddingTop: "4px", width: 100 },
145378
+ className: "veZoomAlignmentSlider ove-slider",
145379
+ labelRenderer: false,
145380
+ initialValue: charWidth2,
145381
+ stepSize: 0.05,
145382
+ max: 10,
145383
+ min: 0,
145384
+ clickStepSize: 0.5
145385
+ }
145386
+ ),
145387
+ !noVisibilityOptions && !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145388
+ AlignmentVisibilityTool,
145389
+ __spreadValues({
145390
+ currentPairwiseAlignmentIndex
145391
+ }, alignmentVisibilityToolOptions)
145392
+ ),
145393
+ updateAlignmentSortOrder && !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145394
+ Popover,
145395
+ {
145396
+ minimal: true,
145397
+ content: /* @__PURE__ */ React__default$1.createElement(Menu, null, /* @__PURE__ */ React__default$1.createElement(
145398
+ MenuItem,
145399
+ {
145400
+ active: true,
145401
+ onClick: () => {
145402
+ updateAlignmentSortOrder("Position");
145403
+ },
145404
+ text: "Position"
145405
+ }
145406
+ ), /* @__PURE__ */ React__default$1.createElement(
145407
+ MenuItem,
145408
+ {
145409
+ active: alignmentSortOrder,
145410
+ onClick: () => {
145411
+ updateAlignmentSortOrder("Alphabetical");
145412
+ },
145413
+ text: "Alphabetical"
145414
+ }
145415
+ )),
145416
+ target: /* @__PURE__ */ React__default$1.createElement(
145417
+ Button,
145418
+ {
145419
+ small: true,
145420
+ text: "Sort Order",
145421
+ rightIcon: "caret-down",
145422
+ icon: "sort"
145423
+ }
145424
+ )
145425
+ }
145426
+ ),
145427
+ additionalTopEl,
145428
+ saveMessage && /* @__PURE__ */ React__default$1.createElement(
145429
+ "div",
145430
+ {
145431
+ className: "ove-menu-toast",
145432
+ style: {
145433
+ display: "flex",
145434
+ alignItems: "center",
145435
+ marginLeft: "auto",
145436
+ marginRight: 10
145437
+ }
145438
+ },
145439
+ saveMessageLoading ? /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement(Spinner, { size: 15 })) : /* @__PURE__ */ React__default$1.createElement(Icon, { icon: "tick-circle", intent: "success" }),
145440
+ " ",
145441
+ " ",
145442
+ saveMessage
145443
+ )
145444
+ ),
145445
+ hasTemplate ? /* @__PURE__ */ React__default$1.createElement(React__default$1.Fragment, null, /* @__PURE__ */ React__default$1.createElement("div", { className: "alignmentTrackFixedToTop" }, getTrackVis([firstTrack], true, alignmentTracks)), getTrackVis(otherTracks, false, alignmentTracks)) : getTrackVis(alignmentTracks, false, alignmentTracks)
145446
+ )
145447
+ ),
145448
+ !isInPairwiseOverviewView && /* @__PURE__ */ React__default$1.createElement(
145449
+ "div",
145450
+ {
145451
+ className: "alignmentViewBottomBar",
145452
+ style: {
145453
+ // flexGrow: 1,
145454
+ // minHeight: "-webkit-min-content", //https://stackoverflow.com/questions/28029736/how-to-prevent-a-flex-item-from-shrinking-smaller-than-its-content
145455
+ maxHeight: 210,
145456
+ marginTop: 4,
145457
+ paddingTop: 4,
145458
+ borderTop: "1px solid lightgrey",
145459
+ display: "flex"
145460
+ }
145461
+ },
145462
+ /* @__PURE__ */ React__default$1.createElement(
145463
+ Minimap,
145464
+ {
145465
+ selectionLayerComp: /* @__PURE__ */ React__default$1.createElement(React__default$1.Fragment, null, /* @__PURE__ */ React__default$1.createElement(
145466
+ PerformantSelectionLayer,
145467
+ {
145468
+ is: true,
145469
+ hideCarets: true,
145470
+ className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145471
+ easyStore: easyStore2.current,
145472
+ sequenceLength: maxLength,
145473
+ charWidth: getMinCharWidth(true),
145474
+ row: { start: 0, end: maxLength - 1 }
145475
+ }
145476
+ ), /* @__PURE__ */ React__default$1.createElement(
145477
+ PerformantCaret,
145478
+ {
145479
+ style: {
145480
+ opacity: 0.2
145481
+ },
145482
+ className: "veAlignmentSelectionLayer veMinimapSelectionLayer",
145483
+ sequenceLength: maxLength,
145484
+ charWidth: getMinCharWidth(true),
145485
+ row: { start: 0, end: maxLength - 1 },
145486
+ easyStore: easyStore2.current
145487
+ }
145488
+ )),
145489
+ alignmentTracks,
145490
+ dimensions: {
145491
+ width: Math.max(width, 10) || 10
145492
+ },
145493
+ nameDivOffsetPercent: 0,
145494
+ scrollYToTrack,
145495
+ onSizeAdjust: onMinimapSizeAdjust,
145496
+ minSliderSize,
145497
+ laneHeight: minimapLaneHeight || (alignmentTracks.length > 5 ? 10 : 17),
145498
+ laneSpacing: minimapLaneSpacing || (alignmentTracks.length > 5 ? 2 : 1),
145499
+ easyStore: easyStore2.current,
145500
+ numBpsShownInLinearView: getNumBpsShownInLinearView(),
145501
+ scrollAlignmentView: false,
145502
+ onMinimapScrollX: scrollAlignmentToPercent
145503
+ }
145504
+ )
145505
+ ),
145506
+ /* @__PURE__ */ React__default$1.createElement(
145507
+ GlobalDialog,
145508
+ null
145509
+ )
145510
+ )));
145511
+ }, "AlignmentView");
145512
145512
  const AlignmentView$1 = compose(
145513
145513
  withStore,
145514
145514
  withEditorProps,