@teselagen/ove 0.7.29 → 0.7.30-beta.1

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
@@ -15992,6 +15992,7 @@ var itemSizeEstimator = /* @__PURE__ */ __name(function itemSizeEstimator2() {
15992
15992
  return 41.36;
15993
15993
  }, "itemSizeEstimator");
15994
15994
  var ReactTableDefaults = defaultProps$1;
15995
+ var VIRTUALIZE_CUTOFF_LENGTH = 200;
15995
15996
  var ReactTable = function(_Methods) {
15996
15997
  _inherits$8(ReactTable2, _Methods);
15997
15998
  function ReactTable2(props) {
@@ -16577,7 +16578,7 @@ var ReactTable = function(_Methods) {
16577
16578
  minWidth: rowMinWidth + "px"
16578
16579
  })
16579
16580
  }, tBodyProps.rest),
16580
- pageRows.length < 200 ? pageRows.map(function(d2, i) {
16581
+ _this2.props.noVirtual || pageRows.length < VIRTUALIZE_CUTOFF_LENGTH ? pageRows.map(function(d2, i) {
16581
16582
  return makePageRow(d2, i);
16582
16583
  }) : React__default.createElement(ReactList, {
16583
16584
  type: "variable",
@@ -16681,7 +16682,7 @@ const getIdOrCodeOrIndex = /* @__PURE__ */ __name((record, rowIndex) => {
16681
16682
  const getSelectedRowsFromEntities = /* @__PURE__ */ __name((entities, idMap) => {
16682
16683
  if (!idMap) return [];
16683
16684
  return entities.reduce((acc, entity, i) => {
16684
- return idMap[getIdOrCodeOrIndex(entity, i)] ? acc.concat(i) : acc;
16685
+ return idMap[getIdOrCodeOrIndex(entity, i)] ? acc.concat([i]) : acc;
16685
16686
  }, []);
16686
16687
  }, "getSelectedRowsFromEntities");
16687
16688
  const removeCleanRows = /* @__PURE__ */ __name((entities, cellValidation) => {
@@ -16800,9 +16801,9 @@ const stripNumberAtEnd = /* @__PURE__ */ __name((str) => {
16800
16801
  var _a2;
16801
16802
  return (_a2 = str == null ? void 0 : str.replace) == null ? void 0 : _a2.call(str, getNumberStrAtEnd(str), "");
16802
16803
  }, "stripNumberAtEnd");
16803
- const getAllRows = /* @__PURE__ */ __name((e) => {
16804
- const el = e.target.querySelector(".data-table-container") ? e.target.querySelector(".data-table-container") : e.target.closest(".data-table-container");
16805
- const allRowEls = el.querySelectorAll(".rt-tr");
16804
+ const getAllRows = /* @__PURE__ */ __name((tableRef) => {
16805
+ var _a2, _b2;
16806
+ const allRowEls = (_b2 = (_a2 = tableRef.current) == null ? void 0 : _a2.tableRef) == null ? void 0 : _b2.querySelectorAll(".rt-tr");
16806
16807
  if (!allRowEls || !allRowEls.length) {
16807
16808
  return;
16808
16809
  }
@@ -17069,14 +17070,14 @@ const handleCopyRows = /* @__PURE__ */ __name((rowElsToCopy, { specificColumn, o
17069
17070
  handleCopyHelper(textToCopy, jsonToCopy, onFinishMsg || "Row Copied");
17070
17071
  }
17071
17072
  }, "handleCopyRows");
17072
- const handleCopyColumn = /* @__PURE__ */ __name((e, cellWrapper, selectedRecords) => {
17073
+ const handleCopyColumn = /* @__PURE__ */ __name((tableRef, cellWrapper, selectedRecords) => {
17073
17074
  const specificColumn = cellWrapper.getAttribute("data-test");
17074
- let rowElsToCopy = getAllRows(e);
17075
+ let rowElsToCopy = getAllRows(tableRef);
17075
17076
  if (!rowElsToCopy) return;
17076
17077
  if (selectedRecords) {
17077
- const ids2 = selectedRecords.map((e2) => {
17078
+ const ids2 = selectedRecords.map((e) => {
17078
17079
  var _a2;
17079
- return (_a2 = getIdOrCodeOrIndex(e2)) == null ? void 0 : _a2.toString();
17080
+ return (_a2 = getIdOrCodeOrIndex(e)) == null ? void 0 : _a2.toString();
17080
17081
  });
17081
17082
  rowElsToCopy = Array.from(rowElsToCopy).filter((rowEl) => {
17082
17083
  var _a2;
@@ -17109,9 +17110,9 @@ const isBottomRightCornerOfRectangle = /* @__PURE__ */ __name(({
17109
17110
  const isBottomRight = i === lastRowIndex && cellIndex === lastCellIndex;
17110
17111
  return isBottomRight;
17111
17112
  }, "isBottomRightCornerOfRectangle");
17112
- const handleCopyTable = /* @__PURE__ */ __name((e, opts2) => {
17113
+ const handleCopyTable = /* @__PURE__ */ __name((tableRef, opts2) => {
17113
17114
  try {
17114
- const allRowEls = getAllRows(e);
17115
+ const allRowEls = getAllRows(tableRef);
17115
17116
  if (!allRowEls) return;
17116
17117
  handleCopyRows(allRowEls, __spreadProps(__spreadValues({}, opts2), {
17117
17118
  onFinishMsg: "Table Copied"
@@ -17148,13 +17149,15 @@ const useTableEntities = /* @__PURE__ */ __name((tableFormName) => {
17148
17149
  },
17149
17150
  [dispatch, tableFormName]
17150
17151
  );
17151
- const { allOrderedEntities, selectedEntities } = useSelector((state2) => {
17152
- var _a2, _b2, _c, _d, _e, _f;
17153
- return {
17154
- allOrderedEntities: (_c = (_b2 = (_a2 = state2.form) == null ? void 0 : _a2[tableFormName]) == null ? void 0 : _b2.values) == null ? void 0 : _c.allOrderedEntities,
17155
- selectedEntities: (_f = (_e = (_d = state2.form) == null ? void 0 : _d[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
17156
- };
17157
- });
17152
+ const { allOrderedEntities, selectedEntities } = useSelector(
17153
+ (state2) => {
17154
+ var _a2, _b2, _c, _d, _e, _f;
17155
+ return {
17156
+ allOrderedEntities: (_c = (_b2 = (_a2 = state2.form) == null ? void 0 : _a2[tableFormName]) == null ? void 0 : _b2.values) == null ? void 0 : _c.allOrderedEntities,
17157
+ selectedEntities: (_f = (_e = (_d = state2.form) == null ? void 0 : _d[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
17158
+ };
17159
+ }
17160
+ );
17158
17161
  return { selectTableEntities, allOrderedEntities, selectedEntities };
17159
17162
  }, "useTableEntities");
17160
17163
  const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
@@ -36939,7 +36942,7 @@ const multiViewColumn = __spreadProps(__spreadValues({}, viewColumn), {
36939
36942
  ));
36940
36943
  }, "render")
36941
36944
  });
36942
- function convertSchema(schema2) {
36945
+ const convertSchema = /* @__PURE__ */ __name((schema2) => {
36943
36946
  let schemaToUse = schema2;
36944
36947
  if (!schemaToUse.fields && Array.isArray(schema2)) {
36945
36948
  schemaToUse = {
@@ -36948,35 +36951,26 @@ function convertSchema(schema2) {
36948
36951
  }
36949
36952
  schemaToUse = __spreadValues({}, schemaToUse);
36950
36953
  schemaToUse.fields = schemaToUse.fields.map((field, i) => {
36951
- let fieldToUse = field;
36952
36954
  if (typeof field === "string") {
36953
- fieldToUse = {
36955
+ return {
36954
36956
  displayName: startCase(camelCase(field)),
36955
36957
  path: field,
36956
36958
  type: "string"
36957
36959
  };
36958
- } else if (!field.type) {
36959
- fieldToUse = __spreadProps(__spreadValues({}, field), {
36960
- type: "string"
36961
- });
36962
- }
36963
- if (!fieldToUse.displayName) {
36964
- fieldToUse = __spreadProps(__spreadValues({}, fieldToUse), {
36965
- displayName: startCase(camelCase(fieldToUse.path))
36966
- });
36967
- }
36968
- if (!fieldToUse.path) {
36969
- fieldToUse = __spreadProps(__spreadValues({}, fieldToUse), {
36970
- filterDisabled: true,
36971
- sortDisabled: true,
36972
- path: "fake-path" + i
36973
- });
36960
+ } else {
36961
+ const fieldToUse = __spreadValues({}, field);
36962
+ fieldToUse.type = fieldToUse.type || "string";
36963
+ fieldToUse.displayName = fieldToUse.displayName || startCase(camelCase(fieldToUse.path || ""));
36964
+ if (!fieldToUse.path) {
36965
+ fieldToUse.filterDisabled = true;
36966
+ fieldToUse.sortDisabled = true;
36967
+ fieldToUse.path = "fake-path" + i;
36968
+ }
36969
+ return fieldToUse;
36974
36970
  }
36975
- return fieldToUse;
36976
36971
  });
36977
36972
  return schemaToUse;
36978
- }
36979
- __name(convertSchema, "convertSchema");
36973
+ }, "convertSchema");
36980
36974
  const TableFormTrackerContext = React__default.createContext({
36981
36975
  formNames: [],
36982
36976
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -56011,6 +56005,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
56011
56005
  );
56012
56006
  const tableRef = useRef();
56013
56007
  const alreadySelected = useRef(false);
56008
+ const [noVirtual, setNoVirtual] = useState(false);
56014
56009
  const [onlyShowRowsWErrors, setOnlyShowRowsWErrors] = useState(false);
56015
56010
  const [entitiesUndoRedoStack, setEntitiesUndoRedoStack] = useState({
56016
56011
  currentVersion: 0
@@ -56852,76 +56847,94 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
56852
56847
  updateEntitiesHelper,
56853
56848
  updateValidation
56854
56849
  ]);
56855
- const handleCopySelectedCells = useCallback$1(
56856
- (e) => {
56857
- if (isEmpty$1(selectedCells)) return;
56858
- const pathToIndex = getFieldPathToIndex(schema2);
56859
- const entityIdToEntity = getEntityIdToEntity(entities);
56860
- const selectionGrid = [];
56861
- let firstRowIndex;
56862
- let firstCellIndex;
56863
- Object.keys(selectedCells).forEach((key) => {
56864
- const [rowId, path2] = key.split(":");
56865
- const eInfo = entityIdToEntity[rowId];
56866
- if (eInfo) {
56867
- if (firstRowIndex === void 0 || eInfo.i < firstRowIndex) {
56868
- firstRowIndex = eInfo.i;
56869
- }
56870
- if (!selectionGrid[eInfo.i]) {
56871
- selectionGrid[eInfo.i] = [];
56872
- }
56873
- const cellIndex = pathToIndex[path2];
56874
- if (firstCellIndex === void 0 || cellIndex < firstCellIndex) {
56875
- firstCellIndex = cellIndex;
56876
- }
56877
- selectionGrid[eInfo.i][cellIndex] = true;
56878
- }
56879
- });
56880
- if (firstRowIndex === void 0) return;
56881
- const allRows = getAllRows(e);
56882
- let fullCellText = "";
56883
- const fullJson = [];
56884
- times(selectionGrid.length, (i) => {
56885
- const row = selectionGrid[i];
56886
- if (fullCellText) {
56887
- fullCellText += "\n";
56850
+ const waitUntilAllRowsAreRendered = useCallback$1(() => {
56851
+ return new Promise((resolve) => {
56852
+ const interval = setInterval(() => {
56853
+ var _a3, _b2;
56854
+ const allRowEls = (_b2 = (_a3 = tableRef.current) == null ? void 0 : _a3.tableRef) == null ? void 0 : _b2.querySelectorAll(".rt-tr-group");
56855
+ if ((allRowEls == null ? void 0 : allRowEls.length) === entities.length) {
56856
+ clearInterval(interval);
56857
+ resolve();
56888
56858
  }
56889
- if (!row) {
56890
- return;
56891
- } else {
56892
- const jsonRow = [];
56893
- let [rowCopyText, json] = getRowCopyText(allRows[i + 1]);
56894
- rowCopyText = rowCopyText.split(" ");
56895
- times(row.length, (i2) => {
56896
- const cell = row[i2];
56897
- if (cell) {
56898
- fullCellText += rowCopyText[i2];
56899
- jsonRow.push(json[i2]);
56900
- }
56901
- if (i2 !== row.length - 1 && i2 >= firstCellIndex)
56902
- fullCellText += " ";
56903
- });
56904
- fullJson.push(jsonRow);
56859
+ }, 50);
56860
+ });
56861
+ }, []);
56862
+ const handleCopySelectedCells = useCallback$1(() => __async(void 0, null, function* () {
56863
+ if (isEmpty$1(selectedCells)) return;
56864
+ if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
56865
+ setNoVirtual(true);
56866
+ yield waitUntilAllRowsAreRendered();
56867
+ }
56868
+ const pathToIndex = getFieldPathToIndex(schema2);
56869
+ const entityIdToEntity = getEntityIdToEntity(entities);
56870
+ const selectionGrid = [];
56871
+ let firstRowIndex;
56872
+ let firstCellIndex;
56873
+ Object.keys(selectedCells).forEach((key) => {
56874
+ const [rowId, path2] = key.split(":");
56875
+ const eInfo = entityIdToEntity[rowId];
56876
+ if (eInfo) {
56877
+ if (firstRowIndex === void 0 || eInfo.i < firstRowIndex) {
56878
+ firstRowIndex = eInfo.i;
56879
+ }
56880
+ if (!selectionGrid[eInfo.i]) {
56881
+ selectionGrid[eInfo.i] = [];
56882
+ }
56883
+ const cellIndex = pathToIndex[path2];
56884
+ if (firstCellIndex === void 0 || cellIndex < firstCellIndex) {
56885
+ firstCellIndex = cellIndex;
56905
56886
  }
56906
- });
56907
- if (!fullCellText) return window.toastr.warning("No text to copy");
56908
- handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
56909
- },
56910
- [entities, selectedCells, schema2]
56911
- );
56887
+ selectionGrid[eInfo.i][cellIndex] = true;
56888
+ }
56889
+ });
56890
+ if (firstRowIndex === void 0) return;
56891
+ const allRows = getAllRows(tableRef);
56892
+ let fullCellText = "";
56893
+ const fullJson = [];
56894
+ times(selectionGrid.length, (i) => {
56895
+ const row = selectionGrid[i];
56896
+ if (fullCellText) {
56897
+ fullCellText += "\n";
56898
+ }
56899
+ if (!row) {
56900
+ return;
56901
+ } else {
56902
+ const jsonRow = [];
56903
+ let [rowCopyText, json] = getRowCopyText(allRows[i + 1]);
56904
+ rowCopyText = rowCopyText.split(" ");
56905
+ times(row.length, (i2) => {
56906
+ const cell = row[i2];
56907
+ if (cell) {
56908
+ fullCellText += rowCopyText[i2];
56909
+ jsonRow.push(json[i2]);
56910
+ }
56911
+ if (i2 !== row.length - 1 && i2 >= firstCellIndex) fullCellText += " ";
56912
+ });
56913
+ fullJson.push(jsonRow);
56914
+ }
56915
+ });
56916
+ if (!fullCellText) return window.toastr.warning("No text to copy");
56917
+ handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
56918
+ setNoVirtual(false);
56919
+ }), [entities, selectedCells, schema2, waitUntilAllRowsAreRendered]);
56912
56920
  const handleCopySelectedRows = useCallback$1(
56913
- (selectedRecords, e) => {
56914
- const idToIndex = entities.reduce((acc, e2, i) => {
56915
- acc[e2.id || e2.code] = i;
56921
+ (selectedRecords) => __async(void 0, null, function* () {
56922
+ if (entities.length > VIRTUALIZE_CUTOFF_LENGTH) {
56923
+ setNoVirtual(true);
56924
+ yield waitUntilAllRowsAreRendered();
56925
+ }
56926
+ const idToIndex = entities.reduce((acc, e, i) => {
56927
+ acc[e.id || e.code] = i;
56916
56928
  return acc;
56917
56929
  }, {});
56918
56930
  const rowNumbersToCopy = selectedRecords.map((rec) => idToIndex[rec.id || rec.code] + 1).sort();
56919
56931
  if (!rowNumbersToCopy.length) return;
56920
56932
  rowNumbersToCopy.unshift(0);
56921
56933
  try {
56922
- const allRowEls = getAllRows(e);
56934
+ const allRowEls = getAllRows(tableRef);
56923
56935
  if (!allRowEls) return;
56924
56936
  const rowEls = rowNumbersToCopy.map((i) => allRowEls[i]);
56937
+ if (window.Cypress) window.Cypress.__copiedRowsLength = rowEls.length;
56925
56938
  handleCopyRows(rowEls, {
56926
56939
  onFinishMsg: "Selected rows copied"
56927
56940
  });
@@ -56929,8 +56942,9 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
56929
56942
  console.error(`error:`, error);
56930
56943
  window.toastr.error("Error copying rows.");
56931
56944
  }
56932
- },
56933
- [entities]
56945
+ setNoVirtual(false);
56946
+ }),
56947
+ [entities, waitUntilAllRowsAreRendered]
56934
56948
  );
56935
56949
  const handleCopyHotkey = useCallback$1(
56936
56950
  (e) => {
@@ -57697,7 +57711,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
57697
57711
  {
57698
57712
  key: "copyColumn",
57699
57713
  onClick: /* @__PURE__ */ __name(() => {
57700
- handleCopyColumn(e, cellWrapper);
57714
+ handleCopyColumn(tableRef, cellWrapper);
57701
57715
  }, "onClick"),
57702
57716
  text: "Column"
57703
57717
  }
@@ -57710,7 +57724,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
57710
57724
  {
57711
57725
  key: "copyColumnSelected",
57712
57726
  onClick: /* @__PURE__ */ __name(() => {
57713
- handleCopyColumn(e, cellWrapper, selectedRecords);
57727
+ handleCopyColumn(tableRef, cellWrapper, selectedRecords);
57714
57728
  }, "onClick"),
57715
57729
  text: "Column (Selected)"
57716
57730
  }
@@ -57753,7 +57767,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
57753
57767
  {
57754
57768
  key: "copyFullTableRows",
57755
57769
  onClick: /* @__PURE__ */ __name(() => {
57756
- handleCopyTable(e);
57770
+ handleCopyTable(tableRef);
57757
57771
  }, "onClick"),
57758
57772
  text: "Table"
57759
57773
  }
@@ -58290,6 +58304,7 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
58290
58304
  __spreadValues({
58291
58305
  data: filteredEnts,
58292
58306
  ref: tableRef,
58307
+ noVirtual,
58293
58308
  className: classNames({
58294
58309
  isCellEditable,
58295
58310
  "tg-table-loading": isLoading,
@@ -58357,7 +58372,8 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
58357
58372
  resizePersist,
58358
58373
  resized,
58359
58374
  rowsToShow,
58360
- style2
58375
+ style2,
58376
+ noVirtual
58361
58377
  ]
58362
58378
  );
58363
58379
  return /* @__PURE__ */ React__default.createElement("div", { tabIndex: "1", onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, /* @__PURE__ */ React__default.createElement(
@@ -58640,8 +58656,8 @@ const DataTable = /* @__PURE__ */ __name((_u) => {
58640
58656
  ), /* @__PURE__ */ React__default.createElement(
58641
58657
  Button,
58642
58658
  {
58643
- onClick: /* @__PURE__ */ __name((e) => {
58644
- handleCopyTable(e, { isDownload: true });
58659
+ onClick: /* @__PURE__ */ __name(() => {
58660
+ handleCopyTable(tableRef, { isDownload: true });
58645
58661
  }, "onClick"),
58646
58662
  "data-tip": "Download Table as CSV",
58647
58663
  minimal: true,
@@ -76988,6 +77004,7 @@ const updateAmbiguousOrLiteral = createMetaAction(
76988
77004
  "updateAmbiguousOrLiteral"
76989
77005
  );
76990
77006
  const updateDnaOrAA = createMetaAction("updateDnaOrAA");
77007
+ const updateMismatchesAllowed = createMetaAction("updateMismatchesAllowed");
76991
77008
  const updateMatchNumber = createMetaAction("updateMatchNumber");
76992
77009
  const findTool = createMergedDefaultStateReducer(
76993
77010
  {
@@ -77019,6 +77036,12 @@ const findTool = createMergedDefaultStateReducer(
77019
77036
  dnaOrAA: payload
77020
77037
  });
77021
77038
  },
77039
+ [updateMismatchesAllowed]: (state2, payload) => {
77040
+ return __spreadProps(__spreadValues({}, state2), {
77041
+ matchNumber: 0,
77042
+ mismatchesAllowed: payload
77043
+ });
77044
+ },
77022
77045
  [updateSearchText]: (state2, payload) => {
77023
77046
  return __spreadProps(__spreadValues({}, state2), {
77024
77047
  matchNumber: 0,
@@ -77038,6 +77061,7 @@ const findTool = createMergedDefaultStateReducer(
77038
77061
  dnaOrAA: "DNA",
77039
77062
  ambiguousOrLiteral: "LITERAL",
77040
77063
  highlightAll: false,
77064
+ mismatchesAllowed: 0,
77041
77065
  matchNumber: 0
77042
77066
  }
77043
77067
  );
@@ -77050,6 +77074,7 @@ const findTool$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
77050
77074
  updateAmbiguousOrLiteral,
77051
77075
  updateDnaOrAA,
77052
77076
  updateMatchNumber,
77077
+ updateMismatchesAllowed,
77053
77078
  updateSearchText
77054
77079
  }, Symbol.toStringTag, { value: "Module" }));
77055
77080
  const openToolbarItemUpdate = createMetaAction("openToolbarItemUpdate");
@@ -83885,6 +83910,36 @@ function addSizeIdName(frag, sequenceLength) {
83885
83910
  });
83886
83911
  }
83887
83912
  __name(addSizeIdName, "addSizeIdName");
83913
+ function findApproxMatches(searchSeq, targetSeq, maxMismatches, circular2 = false) {
83914
+ const matches = [];
83915
+ const lenA = searchSeq.length;
83916
+ const lenB = targetSeq.length;
83917
+ const targetSeqExtended = circular2 ? targetSeq + targetSeq.slice(0, lenA - 1) : targetSeq;
83918
+ const limit = circular2 ? lenB : lenB - lenA + 1;
83919
+ for (let i = 0; i < limit; i++) {
83920
+ const window2 = targetSeqExtended.slice(i, i + lenA);
83921
+ let mismatchCount = 0;
83922
+ const mismatchPositions = [];
83923
+ for (let j2 = 0; j2 < lenA; j2++) {
83924
+ if (searchSeq[j2] !== window2[j2]) {
83925
+ mismatchPositions.push(j2);
83926
+ mismatchCount++;
83927
+ if (mismatchCount > maxMismatches) break;
83928
+ }
83929
+ }
83930
+ if (mismatchCount <= maxMismatches) {
83931
+ matches.push({
83932
+ index: i,
83933
+ match: window2,
83934
+ mismatchPositions,
83935
+ numMismatches: mismatchPositions.length
83936
+ // Keep for backwards compatibility
83937
+ });
83938
+ }
83939
+ }
83940
+ return matches;
83941
+ }
83942
+ __name(findApproxMatches, "findApproxMatches");
83888
83943
  var spliceString$1;
83889
83944
  var hasRequiredSpliceString;
83890
83945
  function requireSpliceString() {
@@ -106303,7 +106358,7 @@ function translationsRawSelector(sequenceData2) {
106303
106358
  }
106304
106359
  __name(translationsRawSelector, "translationsRawSelector");
106305
106360
  const translationsRawSelector$1 = createSelector(sequenceDataSelector, translationsRawSelector);
106306
- function searchLayersSelector(sequence2, isCircular, isOpen, searchString, ambiguousOrLiteral, dnaOrAA, isProtein2, proteinSequence) {
106361
+ function searchLayersSelector(sequence2, isCircular, isOpen, searchString, ambiguousOrLiteral, dnaOrAA, isProtein2, proteinSequence, mismatchesAllowed) {
106307
106362
  if (!searchString || !isOpen) {
106308
106363
  return [];
106309
106364
  }
@@ -106331,6 +106386,26 @@ function searchLayersSelector(sequence2, isCircular, isOpen, searchString, ambig
106331
106386
  });
106332
106387
  });
106333
106388
  }
106389
+ if (dnaOrAA === "DNA" && ambiguousOrLiteral === "LITERAL" && mismatchesAllowed > 0) {
106390
+ const approxMatches = findApproxMatches(
106391
+ searchString,
106392
+ sequence2,
106393
+ mismatchesAllowed,
106394
+ isCircular
106395
+ );
106396
+ const matches2 = approxMatches.map((match) => ({
106397
+ start: match.index,
106398
+ end: match.index + match.match.length - 1,
106399
+ matchedString: match.match,
106400
+ mismatchPositions: match.mismatchPositions,
106401
+ numMismatches: match.numMismatches,
106402
+ isSearchLayer: true,
106403
+ forward: true
106404
+ })).sort((a2, b3) => a2.start - b3.start);
106405
+ return matches2.map((match) => __spreadProps(__spreadValues({}, match), {
106406
+ className: "veSearchLayer"
106407
+ }));
106408
+ }
106334
106409
  const matches = findSequenceMatches(sequence2, searchString, {
106335
106410
  isCircular,
106336
106411
  isAmbiguous: ambiguousOrLiteral === "AMBIGUOUS",
@@ -106355,6 +106430,7 @@ const searchLayersSelector$1 = createSelector(
106355
106430
  (state2) => state2.findTool && state2.findTool.dnaOrAA,
106356
106431
  (state2) => state2.sequenceData.isProtein,
106357
106432
  (state2) => state2.sequenceData.proteinSequence,
106433
+ (state2) => state2.findTool && state2.findTool.mismatchesAllowed,
106358
106434
  searchLayersSelector
106359
106435
  );
106360
106436
  const translationSearchMatchesSelector = createSelector(
@@ -117359,26 +117435,49 @@ function SelectionLayer$2(props) {
117359
117435
  )
117360
117436
  ];
117361
117437
  }
117362
- return [
117363
- /* @__PURE__ */ React__default.createElement(
117438
+ const selectionElement = /* @__PURE__ */ React__default.createElement(
117439
+ "div",
117440
+ {
117441
+ onClick: _onClick,
117442
+ title: selectionMessage,
117443
+ onContextMenu: onSelectionContextMenu,
117444
+ key,
117445
+ className: classNameToPass + " veSelectionLayer veRowViewSelectionLayer notCaret " + (isTrueStart ? " isTrueStart " : "") + (isTrueEnd ? " isTrueEnd " : ""),
117446
+ style: __spreadProps(__spreadValues({
117447
+ width,
117448
+ left: leftMargin + xStart
117449
+ }, style2), {
117450
+ background: color2 || topLevelColor,
117451
+ height
117452
+ })
117453
+ }
117454
+ );
117455
+ let mismatchElements = [];
117456
+ if (selectionLayer2.mismatchPositions && selectionLayer2.mismatchPositions.length > 0) {
117457
+ const relativeToOverlap = selectionLayer2.mismatchPositions.filter((pos) => {
117458
+ const absPos = pos + selectionLayer2.start;
117459
+ return absPos >= overlap.start && absPos <= overlap.end;
117460
+ }).map((pos) => {
117461
+ return pos - (overlap.start - selectionLayer2.start);
117462
+ });
117463
+ mismatchElements = relativeToOverlap.map((pos, i) => /* @__PURE__ */ React__default.createElement(
117364
117464
  "div",
117365
117465
  {
117366
- onClick: _onClick,
117367
- title: selectionMessage,
117368
- onContextMenu: onSelectionContextMenu,
117369
- key,
117370
- className: classNameToPass + " veSelectionLayer veRowViewSelectionLayer notCaret " + (isTrueStart ? " isTrueStart " : "") + (isTrueEnd ? " isTrueEnd " : ""),
117371
- style: __spreadProps(__spreadValues({
117372
- width,
117373
- left: leftMargin + xStart
117374
- }, style2), {
117375
- background: color2 || topLevelColor,
117376
- height
117377
- })
117466
+ key: `${key}-mismatch-${i}`,
117467
+ className: "veSelectionLayer veMismatchLayer notCaret",
117468
+ style: {
117469
+ width: charWidth2,
117470
+ left: leftMargin + xStart + pos * charWidth2,
117471
+ top: 0,
117472
+ height: height || "100%",
117473
+ background: "red",
117474
+ position: "absolute",
117475
+ opacity: 0.5
117476
+ }
117378
117477
  }
117379
- ),
117380
- ...caretSvgs
117381
- ];
117478
+ ));
117479
+ }
117480
+ return [selectionElement, ...mismatchElements, ...caretSvgs];
117382
117481
  });
117383
117482
  } else {
117384
117483
  return null;
@@ -122251,7 +122350,7 @@ function showFileDialog({ multiple = false, onSelect }) {
122251
122350
  input.click();
122252
122351
  }
122253
122352
  __name(showFileDialog, "showFileDialog");
122254
- const version = "0.7.28";
122353
+ const version = "0.7.29";
122255
122354
  const packageJson = {
122256
122355
  version
122257
122356
  };
@@ -149077,6 +149176,7 @@ const _FindBar = class _FindBar extends React__default.Component {
149077
149176
  annotationVisibilityShow: annotationVisibilityShow2,
149078
149177
  updateAmbiguousOrLiteral: updateAmbiguousOrLiteral2,
149079
149178
  updateDnaOrAA: updateDnaOrAA2,
149179
+ updateMismatchesAllowed: updateMismatchesAllowed2,
149080
149180
  updateMatchNumber: _updateMatchNumber,
149081
149181
  selectionLayerUpdate: selectionLayerUpdate2,
149082
149182
  annotationSearchMatches,
@@ -149089,6 +149189,7 @@ const _FindBar = class _FindBar extends React__default.Component {
149089
149189
  ambiguousOrLiteral,
149090
149190
  matchesTotal = 0,
149091
149191
  matchNumber = 0,
149192
+ mismatchesAllowed = 0,
149092
149193
  isInline
149093
149194
  } = findTool2;
149094
149195
  const updateMatchNumber2 = /* @__PURE__ */ __name((...args) => {
@@ -149128,6 +149229,30 @@ const _FindBar = class _FindBar extends React__default.Component {
149128
149229
  }, "onChange")
149129
149230
  }
149130
149231
  ), /* @__PURE__ */ React__default.createElement(InfoHelper, { style: { marginLeft: 10 } }, /* @__PURE__ */ React__default.createElement("div", null, "Ambiguous substitutions:", /* @__PURE__ */ React__default.createElement("div", { style: { display: "flex", fontSize: 12 } }, /* @__PURE__ */ React__default.createElement("div", { style: { marginRight: 20 } }, /* @__PURE__ */ React__default.createElement("div", { style: { fontSize: 14, marginBottom: 4, marginTop: 5 } }, "DNA:"), /* @__PURE__ */ React__default.createElement("div", null, "M: AC"), /* @__PURE__ */ React__default.createElement("div", null, "R: AG"), /* @__PURE__ */ React__default.createElement("div", null, "W: AT"), /* @__PURE__ */ React__default.createElement("div", null, "S: CG"), /* @__PURE__ */ React__default.createElement("div", null, "Y: CT"), /* @__PURE__ */ React__default.createElement("div", null, "K: GT"), /* @__PURE__ */ React__default.createElement("div", null, "V: ACG"), /* @__PURE__ */ React__default.createElement("div", null, "H: ACT"), /* @__PURE__ */ React__default.createElement("div", null, "D: AGT"), /* @__PURE__ */ React__default.createElement("div", null, "B: CGT"), /* @__PURE__ */ React__default.createElement("div", null, "X: GATC"), /* @__PURE__ */ React__default.createElement("div", null, "N: GATC"), /* @__PURE__ */ React__default.createElement("div", null, "*: any")), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", { style: { fontSize: 14, marginBottom: 4, marginTop: 5 } }, "AA:"), /* @__PURE__ */ React__default.createElement("div", null, "B: ND"), /* @__PURE__ */ React__default.createElement("div", null, "J: IL"), /* @__PURE__ */ React__default.createElement("div", null, "X: ACDEFGHIKLMNPQRSTVWY"), /* @__PURE__ */ React__default.createElement("div", null, "Z: QE"), /* @__PURE__ */ React__default.createElement("div", null, "*: any")))))),
149232
+ /* @__PURE__ */ React__default.createElement(
149233
+ "div",
149234
+ {
149235
+ key: "mismatchesAllowed",
149236
+ style: { marginTop: "8px", display: "flex", alignItems: "center" }
149237
+ },
149238
+ /* @__PURE__ */ React__default.createElement("label", { style: { marginRight: "8px" } }, "Mismatches Allowed:"),
149239
+ /* @__PURE__ */ React__default.createElement(
149240
+ NumericInput,
149241
+ {
149242
+ min: 0,
149243
+ max: 10,
149244
+ className: "tg-mismatches-allowed-input",
149245
+ style: { width: "60px" },
149246
+ value: mismatchesAllowed,
149247
+ disabled: dnaOrAA !== "DNA" || ambiguousOrLiteral !== "LITERAL",
149248
+ onValueChange: /* @__PURE__ */ __name((value) => {
149249
+ const newValue = Math.max(0, parseInt(value, 10) || 0);
149250
+ updateMismatchesAllowed2(newValue);
149251
+ }, "onValueChange")
149252
+ }
149253
+ ),
149254
+ /* @__PURE__ */ React__default.createElement(InfoHelper, { style: { marginLeft: 10 } }, /* @__PURE__ */ React__default.createElement("div", null, "Number of mismatches allowed when searching DNA sequences with literal matching.", /* @__PURE__ */ React__default.createElement("br", null), /* @__PURE__ */ React__default.createElement("br", null), "Higher values may slow down search performance."))
149255
+ ),
149131
149256
  /* @__PURE__ */ React__default.createElement(
149132
149257
  Switch,
149133
149258
  {