@teselagen/ove 0.3.11 → 0.3.13

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.
Files changed (150) hide show
  1. package/index.js +529 -422
  2. package/index.mjs +530 -423
  3. package/index.umd.js +532 -402
  4. package/package.json +2 -2
  5. package/src/AlignmentView/AlignmentVisibilityTool.js +1 -1
  6. package/src/AlignmentView/EditTrackNameDialog.js +1 -5
  7. package/src/AlignmentView/HorizontalPanelDragHandle.js +2 -2
  8. package/src/AlignmentView/Minimap.js +12 -12
  9. package/src/AlignmentView/PairwiseAlignmentView.js +1 -1
  10. package/src/AlignmentView/getGapMap.js +1 -1
  11. package/src/AlignmentView/getTrackFromEvent.js +1 -1
  12. package/src/AlignmentView/index.js +32 -37
  13. package/src/AutoAnnotate.js +48 -48
  14. package/src/CircularView/Cutsites.js +3 -3
  15. package/src/CircularView/Labels/index.js +7 -7
  16. package/src/CircularView/Labels/relaxLabels_DEPRECATED.js +5 -5
  17. package/src/CircularView/RotateCircularViewSlider.js +1 -1
  18. package/src/CircularView/SelectionLayer.js +2 -2
  19. package/src/CircularView/drawAnnotations.js +3 -3
  20. package/src/CircularView/getAngleForPositionMidpoint.js +1 -1
  21. package/src/CircularView/index.d.ts +11 -11
  22. package/src/CircularView/index.js +9 -9
  23. package/src/CreateAnnotationsPage.js +7 -5
  24. package/src/CreateCustomEnzyme/index.js +1 -5
  25. package/src/CutsiteFilter/AdditionalCutsiteInfoDialog.js +11 -11
  26. package/src/CutsiteFilter/index.js +12 -12
  27. package/src/DigestTool/AddLaddersDialog.js +1 -1
  28. package/src/DigestTool/DigestTool.js +3 -3
  29. package/src/DigestTool/Ladder.js +8 -8
  30. package/src/DigestTool/ladderDefaults.js +1 -2
  31. package/src/Editor/CommandHotkeyHandler.js +1 -1
  32. package/src/Editor/DropHandler.js +2 -2
  33. package/src/Editor/index.js +15 -15
  34. package/src/Editor/userDefinedHandlersAndOpts.js +3 -1
  35. package/src/FindBar/index.js +6 -6
  36. package/src/GlobalDialogUtils.js +6 -0
  37. package/src/LinearView/ZoomLinearView.js +1 -1
  38. package/src/LinearView/index.js +7 -7
  39. package/src/MenuBar/index.js +1 -1
  40. package/src/MenuBar/viewSubmenu.js +1 -1
  41. package/src/PCRTool/PCRTool.js +19 -19
  42. package/src/Reflex/Browser.js +4 -5
  43. package/src/Reflex/ReflexContainer.js +3 -3
  44. package/src/Reflex/ReflexElement.js +2 -2
  45. package/src/RowItem/Axis.js +1 -1
  46. package/src/RowItem/Caret/index.js +1 -1
  47. package/src/RowItem/Chromatograms/Chromatogram.js +3 -3
  48. package/src/RowItem/CutsiteSelectionLayers.js +1 -1
  49. package/src/RowItem/Cutsites.js +1 -1
  50. package/src/RowItem/Labels.js +2 -2
  51. package/src/RowItem/Orfs.js +2 -2
  52. package/src/RowItem/Sequence.js +4 -4
  53. package/src/RowItem/StackedAnnotations/PointedAnnotation.js +3 -3
  54. package/src/RowItem/StackedAnnotations/getStructuredBases.js +1 -1
  55. package/src/RowItem/Translations/AASliver.js +71 -75
  56. package/src/RowItem/Translations/index.js +1 -1
  57. package/src/RowItem/getCutsiteLabelHeights.js +1 -1
  58. package/src/RowItem/index.js +14 -8
  59. package/src/RowView/estimateRowHeight.js +5 -5
  60. package/src/RowView/index.d.ts +7 -7
  61. package/src/RowView/index.js +11 -12
  62. package/src/SimpleCircularOrLinearView.js +6 -6
  63. package/src/StatusBar/MeltingTemp.js +3 -3
  64. package/src/StatusBar/index.js +29 -33
  65. package/src/ToolBar/ToolbarItem.js +2 -2
  66. package/src/ToolBar/alignmentTool.js +9 -9
  67. package/src/ToolBar/editTool.js +41 -37
  68. package/src/ToolBar/findTool.js +2 -2
  69. package/src/ToolBar/importTool.js +1 -1
  70. package/src/ToolBar/index.js +2 -2
  71. package/src/ToolBar/oligoTool.js +1 -1
  72. package/src/ToolBar/orfTool.js +1 -6
  73. package/src/ToolBar/printTool.js +2 -2
  74. package/src/ToolBar/visibilityTool.js +1 -1
  75. package/src/VersionHistoryView/index.js +2 -2
  76. package/src/commands/index.js +237 -230
  77. package/src/createVectorEditor/index.js +4 -4
  78. package/src/fileUtils.js +18 -18
  79. package/src/helperComponents/AddOrEditAnnotationDialog/index.js +22 -15
  80. package/src/helperComponents/AddOrEditFeatureDialog/index.js +2 -2
  81. package/src/helperComponents/AddOrEditPartDialog/index.js +2 -2
  82. package/src/helperComponents/AddOrEditPrimerDialog/index.js +5 -5
  83. package/src/helperComponents/EnzymesDialog/index.js +17 -22
  84. package/src/helperComponents/GoToDialog.js +5 -1
  85. package/src/helperComponents/MergeFeaturesDialog/index.js +3 -3
  86. package/src/helperComponents/PinchHelper/PinchHelper.js +1 -1
  87. package/src/helperComponents/PrintDialog/index.js +4 -4
  88. package/src/helperComponents/PropertiesDialog/CutsiteProperties.js +3 -3
  89. package/src/helperComponents/PropertiesDialog/GenbankView.js +1 -1
  90. package/src/helperComponents/PropertiesDialog/GeneralProperties.js +10 -8
  91. package/src/helperComponents/PropertiesDialog/GenericAnnotationProperties.js +136 -138
  92. package/src/helperComponents/PropertiesDialog/OrfProperties.js +3 -3
  93. package/src/helperComponents/PropertiesDialog/PrimerProperties.js +1 -1
  94. package/src/helperComponents/PropertiesDialog/TranslationProperties.js +2 -2
  95. package/src/helperComponents/PropertiesDialog/index.js +3 -3
  96. package/src/helperComponents/RemoveDuplicates/index.js +3 -3
  97. package/src/helperComponents/SelectDialog.js +3 -3
  98. package/src/helperComponents/UncontrolledSliderWithPlusMinusBtns.js +5 -5
  99. package/src/helperComponents/createSimpleDialog.js +1 -1
  100. package/src/helperComponents/partTagSearch.js +2 -5
  101. package/src/helperComponents/withHover.js +3 -3
  102. package/src/redux/alignments.js +6 -6
  103. package/src/redux/annotationVisibility.js +4 -4
  104. package/src/redux/featureLengthsToHide.js +1 -1
  105. package/src/redux/frameTranslations.js +3 -3
  106. package/src/redux/middleware.js +2 -2
  107. package/src/redux/panelsShown.js +19 -19
  108. package/src/redux/partLengthsToHide.js +1 -1
  109. package/src/redux/primerLengthsToHide.js +1 -1
  110. package/src/redux/readOnly.js +1 -4
  111. package/src/redux/selectionLayer.js +1 -1
  112. package/src/redux/sequenceData/features.js +1 -1
  113. package/src/redux/sequenceData/upsertDeleteActionGenerator.js +1 -1
  114. package/src/redux/sequenceDataHistory.js +5 -5
  115. package/src/redux/toolBar.js +2 -4
  116. package/src/redux/utils/createMetaAction.js +2 -2
  117. package/src/redux/versionHistory.js +1 -2
  118. package/src/selectors/annotationSearchSelector.js +4 -4
  119. package/src/selectors/circularSelector.js +1 -1
  120. package/src/selectors/cutsiteLabelColorSelector.js +1 -1
  121. package/src/selectors/filteredCutsitesSelector.js +6 -6
  122. package/src/selectors/filteredFeaturesSelector.js +4 -4
  123. package/src/selectors/filteredPartsSelector.js +5 -5
  124. package/src/selectors/filteredPrimersSelector.js +3 -3
  125. package/src/selectors/isEnzymeFilterAndSelector.js +1 -1
  126. package/src/selectors/orfsSelector.js +1 -1
  127. package/src/selectors/restrictionEnzymesSelector.js +2 -2
  128. package/src/selectors/searchLayersSelector.js +7 -7
  129. package/src/selectors/sequenceLengthSelector.js +1 -1
  130. package/src/selectors/sequenceSelector.js +1 -1
  131. package/src/selectors/tagsToBoldSelector.js +1 -1
  132. package/src/selectors/translationsSelector.js +7 -7
  133. package/src/updateEditor.js +1 -1
  134. package/src/utils/PassThrough.js +1 -1
  135. package/src/utils/addWrappedAddons.js +1 -1
  136. package/src/utils/annotationTypes.js +2 -2
  137. package/src/utils/combineReducersDontIgnoreKeys.js +1 -1
  138. package/src/utils/editorUtils.js +2 -2
  139. package/src/utils/massageTickSpacing.js +1 -1
  140. package/src/utils/onlyUpdateForKeysDeep.js +1 -1
  141. package/src/utils/pureNoFunc.js +1 -1
  142. package/src/utils/shouldRerender.js +1 -1
  143. package/src/utils/showFileDialog.js +6 -7
  144. package/src/utils/updateLabelsForInViewFeatures.js +1 -1
  145. package/src/utils/useAnnotationLimits.js +1 -1
  146. package/src/withEditorInteractions/Keyboard.js +2 -3
  147. package/src/withEditorInteractions/createSequenceInputPopup.js +4 -4
  148. package/src/withEditorInteractions/index.js +93 -55
  149. package/src/withEditorProps/index.js +39 -37
  150. package/style.css +138 -138
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import './style.css';
2
- import { Icon, Classes, Button, Intent, Keys, MenuItem, Tag, useHotkeys, Popover, Tooltip, Toaster, Position, Menu, MenuDivider, NumericInput, InputGroup, Spinner, FormGroup, TextArea, Checkbox, Switch, EditableText, RadioGroup, Callout, ContextMenu, Dialog, Card, Tabs, Tab, Colors, KeyCombo, Slider as Slider$1, ButtonGroup, AnchorButton, HTMLSelect, Label, ResizeSensor, FocusStyleManager } from '@blueprintjs/core';
2
+ import { Icon, Classes, Button, Intent, Keys, MenuItem, Tag, useHotkeys, Popover, Tooltip, Toaster, Position, Menu, MenuDivider, NumericInput, InputGroup, Spinner, FormGroup, TextArea, Checkbox, Switch, EditableText, RadioGroup, Callout, ContextMenu, Dialog, Card, Tabs, Tab, Colors, KeyCombo, AnchorButton, Slider as Slider$1, ButtonGroup, HTMLSelect, Label, ResizeSensor, FocusStyleManager } from '@blueprintjs/core';
3
3
  import * as React$3 from 'react';
4
4
  import React__default$1, { forwardRef, useImperativeHandle, Fragment, useMemo as useMemo$1, useRef, useReducer, useEffect, useCallback as useCallback$1, useState, memo, Component, PureComponent, createElement, isValidElement, useContext, useLayoutEffect as useLayoutEffect$1 } from 'react';
5
5
  import ReactDOM$1, { unstable_batchedUpdates, findDOMNode as findDOMNode$2, flushSync, unmountComponentAtNode, render as render$2 } from 'react-dom';
@@ -30405,20 +30405,12 @@ var _cof = function (it) {
30405
30405
  return toString$6.call(it).slice(8, -1);
30406
30406
  };
30407
30407
 
30408
- var _iobject;
30409
- var hasRequired_iobject;
30410
-
30411
- function require_iobject () {
30412
- if (hasRequired_iobject) return _iobject;
30413
- hasRequired_iobject = 1;
30414
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
30415
- var cof = _cof;
30416
- // eslint-disable-next-line no-prototype-builtins
30417
- _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30418
- return cof(it) == 'String' ? it.split('') : Object(it);
30419
- };
30420
- return _iobject;
30421
- }
30408
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
30409
+ var cof$2 = _cof;
30410
+ // eslint-disable-next-line no-prototype-builtins
30411
+ var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30412
+ return cof$2(it) == 'String' ? it.split('') : Object(it);
30413
+ };
30422
30414
 
30423
30415
  // 7.2.1 RequireObjectCoercible(argument)
30424
30416
  var _defined = function (it) {
@@ -30427,7 +30419,7 @@ var _defined = function (it) {
30427
30419
  };
30428
30420
 
30429
30421
  // to indexed object, toObject with fallback for non-array-like ES3 strings
30430
- var IObject = require_iobject();
30422
+ var IObject = _iobject;
30431
30423
  var defined$2 = _defined;
30432
30424
  var _toIobject = function (it) {
30433
30425
  return IObject(defined$2(it));
@@ -30547,14 +30539,7 @@ _objectGops.f = Object.getOwnPropertySymbols;
30547
30539
 
30548
30540
  var _objectPie = {};
30549
30541
 
30550
- var hasRequired_objectPie;
30551
-
30552
- function require_objectPie () {
30553
- if (hasRequired_objectPie) return _objectPie;
30554
- hasRequired_objectPie = 1;
30555
- _objectPie.f = {}.propertyIsEnumerable;
30556
- return _objectPie;
30557
- }
30542
+ _objectPie.f = {}.propertyIsEnumerable;
30558
30543
 
30559
30544
  // 7.1.13 ToObject(argument)
30560
30545
  var defined$1 = _defined;
@@ -30572,9 +30557,9 @@ function require_objectAssign () {
30572
30557
  var DESCRIPTORS = _descriptors;
30573
30558
  var getKeys = _objectKeys;
30574
30559
  var gOPS = _objectGops;
30575
- var pIE = require_objectPie();
30560
+ var pIE = _objectPie;
30576
30561
  var toObject = _toObject;
30577
- var IObject = require_iobject();
30562
+ var IObject = _iobject;
30578
30563
  var $assign = Object.assign;
30579
30564
 
30580
30565
  // should work with symbols and should have deterministic property order (V8 bug)
@@ -31287,7 +31272,7 @@ var _wksDefine = function (name) {
31287
31272
  // all enumerable object keys, includes symbols
31288
31273
  var getKeys = _objectKeys;
31289
31274
  var gOPS$1 = _objectGops;
31290
- var pIE$1 = require_objectPie();
31275
+ var pIE$1 = _objectPie;
31291
31276
  var _enumKeys = function (it) {
31292
31277
  var result = getKeys(it);
31293
31278
  var getSymbols = gOPS$1.f;
@@ -31340,7 +31325,7 @@ _objectGopnExt.f = function getOwnPropertyNames(it) {
31340
31325
 
31341
31326
  var _objectGopd = {};
31342
31327
 
31343
- var pIE = require_objectPie();
31328
+ var pIE = _objectPie;
31344
31329
  var createDesc$1 = _propertyDesc;
31345
31330
  var toIObject$1 = _toIobject;
31346
31331
  var toPrimitive$1 = _toPrimitive$1;
@@ -31508,7 +31493,7 @@ if (!USE_NATIVE) {
31508
31493
  $GOPD.f = $getOwnPropertyDescriptor;
31509
31494
  $DP.f = $defineProperty$1;
31510
31495
  _objectGopn.f = gOPNExt.f = $getOwnPropertyNames;
31511
- require_objectPie().f = $propertyIsEnumerable;
31496
+ _objectPie.f = $propertyIsEnumerable;
31512
31497
  $GOPS.f = $getOwnPropertySymbols;
31513
31498
 
31514
31499
  if (DESCRIPTORS && !_library) {
@@ -85352,13 +85337,7 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
85352
85337
  return {};
85353
85338
  }
85354
85339
  const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
85355
- const {
85356
- formName,
85357
- urlConnected,
85358
- history,
85359
- defaults,
85360
- onlyOneFilter
85361
- } = mergedOpts;
85340
+ const { formName, urlConnected, history, defaults, onlyOneFilter } = mergedOpts;
85362
85341
  function updateSearch(val) {
85363
85342
  setTimeout(function() {
85364
85343
  dispatch(change(formName, "reduxFormSearchInput", val || ""));
@@ -85397,12 +85376,7 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
85397
85376
  action(...args, currentParams);
85398
85377
  };
85399
85378
  });
85400
- const {
85401
- variables,
85402
- selectedEntities,
85403
- mergedOpts,
85404
- ...restStateProps
85405
- } = stateProps;
85379
+ const { variables, selectedEntities, mergedOpts, ...restStateProps } = stateProps;
85406
85380
  const changeFormValue = (...args) => dispatchProps.dispatch(change(formName, ...args));
85407
85381
  const tableParams = {
85408
85382
  changeFormValue,
@@ -89298,7 +89272,9 @@ const wrapDialog = (topLevelDialogProps = {}) => (Component) => (props) => {
89298
89272
  return doNotTriggerClick();
89299
89273
  }
89300
89274
  const parentEl = r.current?.closest(".bp3-dialog-container");
89301
- const dialogs = document.querySelectorAll(".bp3-dialog-container");
89275
+ const dialogs = document.querySelectorAll(
89276
+ ".bp3-dialog-container"
89277
+ );
89302
89278
  const numDialogs = dialogs?.length;
89303
89279
  if (numDialogs > 1) {
89304
89280
  const topMostDialog = dialogs[numDialogs - 1];
@@ -89637,6 +89613,7 @@ function MatchHeaders({
89637
89613
  marginBottom: 10,
89638
89614
  marginLeft: 20,
89639
89615
  fontSize: 10
89616
+ /* color: Colors.RED1 */
89640
89617
  }
89641
89618
  },
89642
89619
  userMatchedHeader && [
@@ -91625,10 +91602,7 @@ const UploadCsvWizardDialog = compose(
91625
91602
  if (props.filesWIssues.length > 0) {
91626
91603
  const reduxFormEntitiesArray = [];
91627
91604
  const finishedFiles = props.filesWIssues.map((f, i) => {
91628
- const {
91629
- reduxFormEntities,
91630
- reduxFormCellValidation
91631
- } = formValueSelector(`editableCellTable-${i}`)(
91605
+ const { reduxFormEntities, reduxFormCellValidation } = formValueSelector(`editableCellTable-${i}`)(
91632
91606
  state,
91633
91607
  "reduxFormEntities",
91634
91608
  "reduxFormCellValidation"
@@ -92005,6 +91979,8 @@ const PreviewCsvData = observer(function(props) {
92005
91979
  userSchema = exampleData,
92006
91980
  initialEntities
92007
91981
  } = props;
91982
+ const rerenderKey = useRef(0);
91983
+ rerenderKey.current = rerenderKey.current + 1;
92008
91984
  const data = userSchema.userData && userSchema.userData.length && userSchema.userData.map((row) => {
92009
91985
  const toRet = {
92010
91986
  _isClean: row._isClean
@@ -92051,6 +92027,7 @@ const PreviewCsvData = observer(function(props) {
92051
92027
  {
92052
92028
  maxWidth: 800,
92053
92029
  maxHeight: 500,
92030
+ rerenderKey: rerenderKey.current,
92054
92031
  destroyOnUnmount: false,
92055
92032
  doNotValidateUntouchedRows: true,
92056
92033
  formName: datatableFormName || "editableCellTable",
@@ -103883,7 +103860,14 @@ const EnhancedMenuItem = compose(
103883
103860
  }
103884
103861
  }),
103885
103862
  branch(({ navTo }) => navTo, withRouter$1)
103886
- )(function({ navTo, context, staticContext, didMount, willUnmount, ...props }) {
103863
+ )(function({
103864
+ navTo,
103865
+ context,
103866
+ staticContext,
103867
+ didMount,
103868
+ willUnmount,
103869
+ ...props
103870
+ }) {
103887
103871
  let MenuItemComp = MenuItem;
103888
103872
  if (navTo) {
103889
103873
  MenuItemComp = MenuItemLink;
@@ -104941,11 +104925,7 @@ function getCommandHotkeyHandlers(commands) {
104941
104925
  return handlers;
104942
104926
  }
104943
104927
 
104944
- const withCommand = (mappings) => (WrappedComponent) => ({
104945
- cmd,
104946
- cmdOptions = {},
104947
- ...props
104948
- }) => {
104928
+ const withCommand = (mappings) => (WrappedComponent) => ({ cmd, cmdOptions = {}, ...props }) => {
104949
104929
  const mappedProps = {};
104950
104930
  Object.keys(mappings).forEach((k) => {
104951
104931
  mappedProps[k] = mappings[k] === "execute" ? (event) => cmd.execute({ event }) : typeof mappings[k] === "function" ? mappings[k](cmd, props) : cmd[mappings[k]];
@@ -106092,9 +106072,9 @@ const frameTranslations = createReducer(
106092
106072
  }
106093
106073
  },
106094
106074
  {
106095
- "1": false,
106096
- "2": false,
106097
- "3": false,
106075
+ 1: false,
106076
+ 2: false,
106077
+ 3: false,
106098
106078
  "-1": false,
106099
106079
  "-2": false,
106100
106080
  "-3": false
@@ -106823,9 +106803,14 @@ function checkIfNonCircularRangesOverlap(range, comparisonRange) {
106823
106803
 
106824
106804
  function checkIfPotentiallyCircularRangesOverlap(range, comparisonRange) {
106825
106805
  return splitRangeIntoTwoPartsIfItIsCircular(range, Infinity).some(function(splitRange) {
106826
- return splitRangeIntoTwoPartsIfItIsCircular(comparisonRange, Infinity).some(function(splitComparisonRange) {
106827
- return checkIfNonCircularRangesOverlap(splitRange, splitComparisonRange);
106828
- });
106806
+ return splitRangeIntoTwoPartsIfItIsCircular(comparisonRange, Infinity).some(
106807
+ function(splitComparisonRange) {
106808
+ return checkIfNonCircularRangesOverlap(
106809
+ splitRange,
106810
+ splitComparisonRange
106811
+ );
106812
+ }
106813
+ );
106829
106814
  });
106830
106815
  }
106831
106816
 
@@ -106835,15 +106820,19 @@ function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps, sequen
106835
106820
  return overlaps;
106836
106821
  } else if (overlaps.length === 2) {
106837
106822
  if (overlaps[0].start === 0 && overlaps[1].end + 1 === sequenceLength && !originalRangeLinear) {
106838
- return [{
106839
- start: overlaps[1].start,
106840
- end: overlaps[0].end
106841
- }];
106823
+ return [
106824
+ {
106825
+ start: overlaps[1].start,
106826
+ end: overlaps[0].end
106827
+ }
106828
+ ];
106842
106829
  } else if (overlaps[1].start === 0 && overlaps[0].end + 1 === sequenceLength && !originalRangeLinear) {
106843
- return [{
106844
- start: overlaps[0].start,
106845
- end: overlaps[1].end
106846
- }];
106830
+ return [
106831
+ {
106832
+ start: overlaps[0].start,
106833
+ end: overlaps[1].end
106834
+ }
106835
+ ];
106847
106836
  } else {
106848
106837
  return overlaps;
106849
106838
  }
@@ -106851,17 +106840,29 @@ function collapseOverlapsGeneratedFromRangeComparisonIfPossible(overlaps, sequen
106851
106840
  const firstOverlap = overlaps[0];
106852
106841
  const secondOverlap = overlaps[1];
106853
106842
  const thirdOverlap = overlaps[2];
106854
- let collapsedOverlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible([firstOverlap, secondOverlap], sequenceLength, optionalOriginalRange);
106843
+ let collapsedOverlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible(
106844
+ [firstOverlap, secondOverlap],
106845
+ sequenceLength,
106846
+ optionalOriginalRange
106847
+ );
106855
106848
  if (collapsedOverlaps.length === 1) {
106856
106849
  collapsedOverlaps.push(thirdOverlap);
106857
106850
  return collapsedOverlaps;
106858
106851
  } else {
106859
- collapsedOverlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible([firstOverlap, thirdOverlap], sequenceLength, optionalOriginalRange);
106852
+ collapsedOverlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible(
106853
+ [firstOverlap, thirdOverlap],
106854
+ sequenceLength,
106855
+ optionalOriginalRange
106856
+ );
106860
106857
  if (collapsedOverlaps.length === 1) {
106861
106858
  collapsedOverlaps.push(secondOverlap);
106862
106859
  return collapsedOverlaps;
106863
106860
  } else {
106864
- collapsedOverlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible([secondOverlap, thirdOverlap], sequenceLength, optionalOriginalRange);
106861
+ collapsedOverlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible(
106862
+ [secondOverlap, thirdOverlap],
106863
+ sequenceLength,
106864
+ optionalOriginalRange
106865
+ );
106865
106866
  if (collapsedOverlaps.length === 1) {
106866
106867
  collapsedOverlaps.push(firstOverlap);
106867
106868
  return collapsedOverlaps;
@@ -106883,11 +106884,18 @@ function convertRangeIndices(range, inputType, outputType) {
106883
106884
  }
106884
106885
 
106885
106886
  function convertRangeTo0Based(range) {
106886
- return convertRangeIndices(range, { inclusive1BasedStart: true, inclusive1BasedEnd: true });
106887
+ return convertRangeIndices(range, {
106888
+ inclusive1BasedStart: true,
106889
+ inclusive1BasedEnd: true
106890
+ });
106887
106891
  }
106888
106892
 
106889
106893
  function convertRangeTo1Based(range) {
106890
- return convertRangeIndices(range, {}, { inclusive1BasedStart: true, inclusive1BasedEnd: true });
106894
+ return convertRangeIndices(
106895
+ range,
106896
+ {},
106897
+ { inclusive1BasedStart: true, inclusive1BasedEnd: true }
106898
+ );
106891
106899
  }
106892
106900
 
106893
106901
  function provideInclusiveOptions(funToWrap) {
@@ -106992,7 +107000,11 @@ function expandOrContractCircularRangeToPosition(range, position, maxLength) {
106992
107000
  let endMoved = true;
106993
107001
  if (range.end >= position) {
106994
107002
  if (position + maxLength - range.start > range.end - position) {
106995
- newRange.end = normalizePositionByRangeLength(position - 1, maxLength, false);
107003
+ newRange.end = normalizePositionByRangeLength(
107004
+ position - 1,
107005
+ maxLength,
107006
+ false
107007
+ );
106996
107008
  } else {
106997
107009
  newRange.start = position;
106998
107010
  endMoved = false;
@@ -107065,19 +107077,31 @@ function expandOrContractRangeToPosition(range, position, maxLength) {
107065
107077
  if (range.start > range.end) {
107066
107078
  return expandOrContractCircularRangeToPosition(range, position, maxLength);
107067
107079
  } else {
107068
- return expandOrContractNonCircularRangeToPosition(range, position);
107080
+ return expandOrContractNonCircularRangeToPosition(
107081
+ range,
107082
+ position);
107069
107083
  }
107070
107084
  }
107071
107085
 
107072
107086
  function translateRange(rangeToBeAdjusted, translateBy, rangeLength) {
107073
107087
  return lodashExports.assign({}, rangeToBeAdjusted, {
107074
- start: normalizePositionByRangeLength(rangeToBeAdjusted.start + translateBy, rangeLength),
107075
- end: normalizePositionByRangeLength(rangeToBeAdjusted.end + translateBy, rangeLength)
107088
+ start: normalizePositionByRangeLength(
107089
+ rangeToBeAdjusted.start + translateBy,
107090
+ rangeLength
107091
+ ),
107092
+ end: normalizePositionByRangeLength(
107093
+ rangeToBeAdjusted.end + translateBy,
107094
+ rangeLength
107095
+ )
107076
107096
  });
107077
107097
  }
107078
107098
 
107079
107099
  function flipRelativeRange(innerRange, outerRange, sequenceLength, options) {
107080
- const isFullyContained = isRangeWithinRange(innerRange, outerRange, sequenceLength);
107100
+ const isFullyContained = isRangeWithinRange(
107101
+ innerRange,
107102
+ outerRange,
107103
+ sequenceLength
107104
+ );
107081
107105
  if (isFullyContained) {
107082
107106
  return flipFullyContainedRange(innerRange, outerRange, sequenceLength);
107083
107107
  } else {
@@ -107085,40 +107109,91 @@ function flipRelativeRange(innerRange, outerRange, sequenceLength, options) {
107085
107109
  }
107086
107110
  }
107087
107111
  function flipNonFullyContainedRange(innerRange, outerRange, sequenceLength, options) {
107088
- const outerFullyContained = isRangeWithinRange(outerRange, innerRange, sequenceLength);
107112
+ const outerFullyContained = isRangeWithinRange(
107113
+ outerRange,
107114
+ innerRange,
107115
+ sequenceLength
107116
+ );
107089
107117
  let flippedInnerRange;
107090
107118
  if (outerFullyContained) {
107091
- const expandBy1 = getRangeLength({
107092
- start: innerRange.start,
107093
- end: outerRange.start
107094
- }, sequenceLength) - 1;
107095
- flippedInnerRange = expandOrContractRangeByLength(outerRange, expandBy1, false, sequenceLength);
107096
- const expandBy2 = getRangeLength({
107097
- end: innerRange.end,
107098
- start: outerRange.end
107099
- }, sequenceLength) - 1;
107100
- flippedInnerRange = expandOrContractRangeByLength(flippedInnerRange, expandBy2, true, sequenceLength);
107119
+ const expandBy1 = getRangeLength(
107120
+ {
107121
+ start: innerRange.start,
107122
+ end: outerRange.start
107123
+ },
107124
+ sequenceLength
107125
+ ) - 1;
107126
+ flippedInnerRange = expandOrContractRangeByLength(
107127
+ outerRange,
107128
+ expandBy1,
107129
+ false,
107130
+ sequenceLength
107131
+ );
107132
+ const expandBy2 = getRangeLength(
107133
+ {
107134
+ end: innerRange.end,
107135
+ start: outerRange.end
107136
+ },
107137
+ sequenceLength
107138
+ ) - 1;
107139
+ flippedInnerRange = expandOrContractRangeByLength(
107140
+ flippedInnerRange,
107141
+ expandBy2,
107142
+ true,
107143
+ sequenceLength
107144
+ );
107101
107145
  } else {
107102
- const overlaps = getOverlapsOfPotentiallyCircularRanges(innerRange, outerRange, sequenceLength);
107146
+ const overlaps = getOverlapsOfPotentiallyCircularRanges(
107147
+ innerRange,
107148
+ outerRange,
107149
+ sequenceLength
107150
+ );
107103
107151
  if (overlaps.length >= 1) {
107104
107152
  let overlapExtendsForward;
107105
107153
  const firstOverlap = overlaps[0];
107106
107154
  overlapExtendsForward = firstOverlap.start !== outerRange.start;
107107
- const flippedTruncatedInner = flipFullyContainedRange(firstOverlap, outerRange, sequenceLength);
107155
+ const flippedTruncatedInner = flipFullyContainedRange(
107156
+ firstOverlap,
107157
+ outerRange,
107158
+ sequenceLength
107159
+ );
107108
107160
  const lengthToExtend = getRangeLength(innerRange, sequenceLength) - getRangeLength(flippedTruncatedInner, sequenceLength);
107109
- flippedInnerRange = expandOrContractRangeByLength(flippedTruncatedInner, lengthToExtend, overlapExtendsForward, sequenceLength);
107161
+ flippedInnerRange = expandOrContractRangeByLength(
107162
+ flippedTruncatedInner,
107163
+ lengthToExtend,
107164
+ overlapExtendsForward,
107165
+ sequenceLength
107166
+ );
107110
107167
  } else {
107111
- throw new Error("This case (relative ranges that do not overlap) is unsupported! ");
107168
+ throw new Error(
107169
+ "This case (relative ranges that do not overlap) is unsupported! "
107170
+ );
107112
107171
  }
107113
107172
  }
107114
107173
  return flippedInnerRange;
107115
107174
  }
107116
107175
  function flipFullyContainedRange(innerRange, outerRange, sequenceLength, options) {
107117
107176
  const translateBy = -outerRange.start;
107118
- const translatedOuterRange = translateRange(outerRange, translateBy, sequenceLength);
107119
- const translatedInnerRange = translateRange(innerRange, translateBy, sequenceLength);
107120
- const translatedFlippedInnerRange = flipNonOriginSpanningContainedRange(translatedInnerRange, translatedOuterRange, sequenceLength);
107121
- const flippedInnerRange = translateRange(translatedFlippedInnerRange, -translateBy, sequenceLength);
107177
+ const translatedOuterRange = translateRange(
107178
+ outerRange,
107179
+ translateBy,
107180
+ sequenceLength
107181
+ );
107182
+ const translatedInnerRange = translateRange(
107183
+ innerRange,
107184
+ translateBy,
107185
+ sequenceLength
107186
+ );
107187
+ const translatedFlippedInnerRange = flipNonOriginSpanningContainedRange(
107188
+ translatedInnerRange,
107189
+ translatedOuterRange,
107190
+ sequenceLength
107191
+ );
107192
+ const flippedInnerRange = translateRange(
107193
+ translatedFlippedInnerRange,
107194
+ -translateBy,
107195
+ sequenceLength
107196
+ );
107122
107197
  return flippedInnerRange;
107123
107198
  }
107124
107199
  function flipNonOriginSpanningContainedRange(innerRange, outerRange, sequenceLength) {
@@ -107290,9 +107365,15 @@ function trimNumberToFitWithin0ToAnotherNumber(numberToBeTrimmed, max) {
107290
107365
  }
107291
107366
 
107292
107367
  function zeroSubrangeByContainerRange(subRange, containerRange, sequenceLength) {
107293
- const trimmedSubRange = trimRangeByAnotherRange(subRange, containerRange, sequenceLength);
107368
+ const trimmedSubRange = trimRangeByAnotherRange(
107369
+ subRange,
107370
+ containerRange,
107371
+ sequenceLength
107372
+ );
107294
107373
  if (trimmedSubRange) {
107295
- throw new Error("subRange must be fully contained by containerRange! Otherwise this function does not make sense");
107374
+ throw new Error(
107375
+ "subRange must be fully contained by containerRange! Otherwise this function does not make sense"
107376
+ );
107296
107377
  }
107297
107378
  const newSubrange = {};
107298
107379
  newSubrange.start = subRange.start - containerRange.start;
@@ -107319,12 +107400,24 @@ function modulo(n, m) {
107319
107400
  }
107320
107401
 
107321
107402
  function getZeroedRangeOverlaps(annotation, selection, sequenceLength) {
107322
- const overlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible(getOverlapsOfPotentiallyCircularRanges(annotation, selection, sequenceLength), sequenceLength, annotation);
107403
+ const overlaps = collapseOverlapsGeneratedFromRangeComparisonIfPossible(
107404
+ getOverlapsOfPotentiallyCircularRanges(
107405
+ annotation,
107406
+ selection,
107407
+ sequenceLength
107408
+ ),
107409
+ sequenceLength,
107410
+ annotation
107411
+ );
107323
107412
  const zeroedOverlaps = overlaps.map((overlap) => {
107324
- return zeroSubrangeByContainerRange(overlap, {
107325
- start: selection.start,
107326
- end: normalizePositionByRangeLength(selection.start - 1, sequenceLength)
107327
- }, sequenceLength);
107413
+ return zeroSubrangeByContainerRange(
107414
+ overlap,
107415
+ {
107416
+ start: selection.start,
107417
+ end: normalizePositionByRangeLength(selection.start - 1, sequenceLength)
107418
+ },
107419
+ sequenceLength
107420
+ );
107328
107421
  });
107329
107422
  return zeroedOverlaps;
107330
107423
  }
@@ -113677,9 +113770,9 @@ function coerceLocation({
113677
113770
  function filterAminoAcidSequenceString(sequenceString, options) {
113678
113771
  options = options || {};
113679
113772
  if (options.includeStopCodon) {
113680
- return sequenceString.replace(/[^xtgalmfwkqespvicyhrndu.*]/gi, "");
113773
+ return sequenceString?.replace(/[^xtgalmfwkqespvicyhrndu.*]/gi, "");
113681
113774
  }
113682
- return sequenceString.replace(/[^xtgalmfwkqespvicyhrndu]/gi, "");
113775
+ return sequenceString?.replace(/[^xtgalmfwkqespvicyhrndu]/gi, "");
113683
113776
  }
113684
113777
 
113685
113778
  function getDegenerateDnaStringFromAAString(aaString) {
@@ -114030,7 +114123,7 @@ const calcTmMethods = {
114030
114123
  calculateTemperature: function(sequence, type, A, R, C, Na) {
114031
114124
  if (typeof type === "undefined") {
114032
114125
  type = this.TABLE_BRESLAUER;
114033
- } else if (type != this.TABLE_BRESLAUER && (type != this.TABLE_UNIFIED && type != this.TABLE_SUGIMOTO)) {
114126
+ } else if (type != this.TABLE_BRESLAUER && type != this.TABLE_UNIFIED && type != this.TABLE_SUGIMOTO) {
114034
114127
  throw new Error("Invalid table type!");
114035
114128
  }
114036
114129
  if (!A) {
@@ -122289,12 +122382,7 @@ function findSequenceMatches(sequence, searchString, options = {}) {
122289
122382
  return matches;
122290
122383
  }
122291
122384
  function findSequenceMatchesTopStrand(sequence, searchString, options = {}) {
122292
- const {
122293
- isCircular,
122294
- isAmbiguous,
122295
- isProteinSequence,
122296
- isProteinSearch
122297
- } = options;
122385
+ const { isCircular, isAmbiguous, isProteinSequence, isProteinSearch } = options;
122298
122386
  let searchStringToUse = escapeStringRegexp(searchString);
122299
122387
  if (isAmbiguous) {
122300
122388
  if (isProteinSearch || isProteinSequence) {
@@ -122376,7 +122464,10 @@ function convertAmbiguousStringToRegex(string, isProtein) {
122376
122464
 
122377
122465
  function getComplementSequenceString(sequence, isRna) {
122378
122466
  let complementSeqString = "";
122379
- const complementMap = lodashExports.merge(DNAComplementMap, isRna ? { a: "u", A: "U" } : { a: "t", A: "T" });
122467
+ const complementMap = lodashExports.merge(
122468
+ DNAComplementMap,
122469
+ isRna ? { a: "u", A: "U" } : { a: "t", A: "T" }
122470
+ );
122380
122471
  for (let i = 0; i < sequence.length; i++) {
122381
122472
  let complementChar = complementMap[sequence[i]];
122382
122473
  if (!complementChar) {
@@ -135047,10 +135138,7 @@ async function geneiousXmlToJson(string, options) {
135047
135138
  });
135048
135139
  }
135049
135140
  });
135050
- const toRet = lodashExports.filter(
135051
- resultArray,
135052
- (r) => r?.parsedSequence?.sequence?.length
135053
- );
135141
+ const toRet = lodashExports.filter(resultArray, (r) => r?.parsedSequence?.sequence?.length);
135054
135142
  if (toRet.length)
135055
135143
  return toRet;
135056
135144
  return onFileParsed(resultArray);
@@ -135152,10 +135240,7 @@ async function jbeiXmlToJson(string, options) {
135152
135240
  messages: ["Error while parsing JBEI format"]
135153
135241
  });
135154
135242
  }
135155
- const toRet = lodashExports.filter(
135156
- resultArray,
135157
- (r) => r?.parsedSequence?.sequence?.length
135158
- );
135243
+ const toRet = lodashExports.filter(resultArray, (r) => r?.parsedSequence?.sequence?.length);
135159
135244
  if (toRet.length)
135160
135245
  return toRet;
135161
135246
  return onFileParsed(resultArray);
@@ -138430,10 +138515,7 @@ const lastSavedId$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.definePrope
138430
138515
  lastSavedIdUpdate
138431
138516
  }, Symbol.toStringTag, { value: 'Module' }));
138432
138517
 
138433
- const toggleReadOnlyMode = createMetaAction(
138434
- "TOGGLE_READ_ONLY_MODE",
138435
- lodashExports.noop
138436
- );
138518
+ const toggleReadOnlyMode = createMetaAction("TOGGLE_READ_ONLY_MODE", lodashExports.noop);
138437
138519
  const updateReadOnlyMode = createMetaAction("UPDATE_READ_ONLY_MODE");
138438
138520
  const readOnly = createReducer(
138439
138521
  {
@@ -142146,6 +142228,9 @@ function showAddOrEditAnnotationDialog({
142146
142228
  overrideName: `AddOrEdit${nameUpper}DialogOverride`,
142147
142229
  dialogType,
142148
142230
  props: {
142231
+ ...annotation.isEditLocked && {
142232
+ readOnly: typeof annotation.isEditLocked === "string" ? annotation.isEditLocked : "This annotation is locked"
142233
+ },
142149
142234
  dialogProps: {
142150
142235
  title: annotation && annotation.id ? `Edit ${nameUpper}` : `New ${nameUpper}`
142151
142236
  },
@@ -142787,7 +142872,8 @@ function mapStateToProps(state, ownProps) {
142787
142872
  editorName,
142788
142873
  sequenceData: sequenceDataFromProps,
142789
142874
  allowSeqDataOverride,
142790
- allowMultipleFeatureDirections
142875
+ allowMultipleFeatureDirections,
142876
+ readOnly
142791
142877
  } = ownProps;
142792
142878
  const editorState = getEditorState(state, editorName);
142793
142879
  const meta = { editorName };
@@ -142847,6 +142933,7 @@ function mapStateToProps(state, ownProps) {
142847
142933
  const f = getFindTool(findTool, matchesTotal);
142848
142934
  return {
142849
142935
  ...editorState,
142936
+ readOnly: readOnly || editorState.readOnly,
142850
142937
  meta,
142851
142938
  annotationToAdd,
142852
142939
  ...newSelection && { selectionLayer: newSelection },
@@ -161031,7 +161118,7 @@ function showFileDialog({ multiple = false, onSelect }) {
161031
161118
  }
161032
161119
 
161033
161120
  const name = "@teselagen/ove";
161034
- const version = "0.3.10";
161121
+ const version = "0.3.12";
161035
161122
  const main = "./src/index.js";
161036
161123
  const exports$1 = {
161037
161124
  ".": {
@@ -161573,6 +161660,184 @@ function ToggleShowMeltingTemp(props) {
161573
161660
  );
161574
161661
  }
161575
161662
 
161663
+ const style$i = '';
161664
+
161665
+ class ToolbarItem extends React__default$1.Component {
161666
+ toggleDropdown = ({ forceClose } = {}) => {
161667
+ const { toolName, isOpen } = this.props;
161668
+ this.props.openToolbarItemUpdate(isOpen || forceClose ? "" : toolName);
161669
+ };
161670
+ render() {
161671
+ const { overrides = {} } = this.props;
161672
+ const {
161673
+ isOpen,
161674
+ index,
161675
+ Icon: Icon$1,
161676
+ // dynamicIcon,
161677
+ onIconClick = lodashExports.noop,
161678
+ tooltip = "",
161679
+ tooltipToggled,
161680
+ dropdowntooltip = "",
161681
+ Dropdown,
161682
+ disabled,
161683
+ isHidden,
161684
+ renderIconAbove,
161685
+ noDropdownIcon,
161686
+ IconWrapper,
161687
+ editorName,
161688
+ popoverDisabled,
161689
+ IconWrapperProps,
161690
+ toolName,
161691
+ dropdownicon,
161692
+ tooltipDisabled,
161693
+ toggled = false,
161694
+ ...rest
161695
+ } = { ...this.props, ...overrides };
161696
+ if (!toolName)
161697
+ console.warn("toolName is required!");
161698
+ if (isHidden)
161699
+ return null;
161700
+ let tooltipToDisplay = tooltip;
161701
+ if (toggled && tooltipToggled) {
161702
+ tooltipToDisplay = tooltipToggled;
161703
+ }
161704
+ const buttonTarget = /* @__PURE__ */ React__default$1.createElement(
161705
+ "div",
161706
+ {
161707
+ className: `veToolbarItemOuter ve-tool-container-${toolName}` + (disabled ? " disabled " : "")
161708
+ },
161709
+ renderIconAbove && /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarItem" }, Icon$1)),
161710
+ Icon$1 && !renderIconAbove && /* @__PURE__ */ React__default$1.createElement(
161711
+ Tooltip,
161712
+ {
161713
+ disabled: tooltipDisabled,
161714
+ portalClassName: "ve-toolbar-item-popover",
161715
+ content: tooltipToDisplay
161716
+ },
161717
+ /* @__PURE__ */ React__default$1.createElement(
161718
+ AnchorButton,
161719
+ {
161720
+ intent: Intent.PRIMARY,
161721
+ onClick: onIconClick === "toggleDropdown" ? this.toggleDropdown : onIconClick,
161722
+ active: toggled,
161723
+ disabled,
161724
+ minimal: true,
161725
+ icon: React__default$1.isValidElement(Icon$1) ? Icon$1 : /* @__PURE__ */ React__default$1.createElement(Icon$1, { toggleDropdown: this.toggleDropdown })
161726
+ }
161727
+ )
161728
+ ),
161729
+ Dropdown && !noDropdownIcon ? /* @__PURE__ */ React__default$1.createElement(Tooltip, { disabled: tooltipDisabled, content: dropdowntooltip }, /* @__PURE__ */ React__default$1.createElement(
161730
+ "div",
161731
+ {
161732
+ className: (isOpen ? " isOpen " : "") + (dropdownicon ? "" : " veToolbarDropdown"),
161733
+ onClick: this.toggleDropdown
161734
+ },
161735
+ dropdownicon ? /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarIcon" }, /* @__PURE__ */ React__default$1.createElement("div", null, dropdownicon)) : isOpen ? /* @__PURE__ */ React__default$1.createElement(
161736
+ Icon,
161737
+ {
161738
+ "data-test": toolName + "Dropdown",
161739
+ iconSize: 13,
161740
+ icon: "caret-up"
161741
+ }
161742
+ ) : /* @__PURE__ */ React__default$1.createElement(
161743
+ Icon,
161744
+ {
161745
+ "data-test": toolName + "Dropdown",
161746
+ iconSize: 13,
161747
+ icon: "caret-down"
161748
+ }
161749
+ )
161750
+ )) : null
161751
+ );
161752
+ const content = /* @__PURE__ */ React__default$1.createElement(
161753
+ "div",
161754
+ {
161755
+ ref: (n) => {
161756
+ if (n)
161757
+ this.dropdownNode = n;
161758
+ },
161759
+ style: { padding: 10, minWidth: 250, maxWidth: 350 },
161760
+ className: "ve-toolbar-dropdown content"
161761
+ },
161762
+ Dropdown && /* @__PURE__ */ React__default$1.createElement(
161763
+ Dropdown,
161764
+ {
161765
+ ...rest,
161766
+ editorName,
161767
+ toggleDropdown: this.toggleDropdown
161768
+ }
161769
+ )
161770
+ );
161771
+ const target = IconWrapper ? /* @__PURE__ */ React__default$1.createElement(IconWrapper, { ...IconWrapperProps }, ({ getRootProps, getInputProps }) => /* @__PURE__ */ React__default$1.createElement("div", { ...getRootProps() }, /* @__PURE__ */ React__default$1.createElement("input", { ...getInputProps() }), buttonTarget)) : buttonTarget;
161772
+ return /* @__PURE__ */ React__default$1.createElement("div", { style: { display: "flex", alignItems: "center" } }, index !== 0 && /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarSpacer" }), /* @__PURE__ */ React__default$1.createElement(
161773
+ Popover,
161774
+ {
161775
+ disabled: popoverDisabled,
161776
+ isOpen: !!Dropdown && isOpen,
161777
+ onClose: (e) => {
161778
+ let srcElement;
161779
+ if (e) {
161780
+ srcElement = e.srcElement || e.target;
161781
+ }
161782
+ if (e && srcElement && this.dropdownNode && (this.dropdownNode.contains(srcElement) || !document.body.contains(srcElement))) {
161783
+ return;
161784
+ }
161785
+ this.toggleDropdown({ forceClose: true });
161786
+ },
161787
+ canEscapeKeyClose: true,
161788
+ minimal: true,
161789
+ position: Position.BOTTOM,
161790
+ target,
161791
+ content
161792
+ }
161793
+ ));
161794
+ }
161795
+ }
161796
+ const ToolbarItem$1 = connectToEditor(({ toolBar = {} }, { toolName }) => ({
161797
+ isOpen: toolBar.openItem === toolName
161798
+ }))(ToolbarItem);
161799
+
161800
+ const editTool = connectToEditor((editorState) => {
161801
+ return {
161802
+ readOnly: editorState.readOnly
161803
+ };
161804
+ })((props) => {
161805
+ const { toolbarItemProps, readOnly, disableSetReadOnly } = props;
161806
+ const [isLoading, setIsLoading] = useState(false);
161807
+ const readOnlyTooltip = ({ readOnly: readOnly2, disableSetReadOnly: disableSetReadOnly2 }) => {
161808
+ if (isLoading) {
161809
+ return "Loading...";
161810
+ } else if (disableSetReadOnly2) {
161811
+ return "You do not have permission to edit locks on this sequence";
161812
+ }
161813
+ return readOnly2 ? "Click to enable editing" : "Click to disable editing";
161814
+ };
161815
+ return /* @__PURE__ */ React__default$1.createElement(
161816
+ ToolbarItem$1,
161817
+ {
161818
+ ...{
161819
+ disabled: isLoading || disableSetReadOnly,
161820
+ Icon: /* @__PURE__ */ React__default$1.createElement(Icon, { icon: readOnly ? "lock" : "unlock" }),
161821
+ onIconClick: () => handleReadOnlyChange(!readOnly, { ...props, setIsLoading }),
161822
+ tooltip: readOnlyTooltip({ readOnly, disableSetReadOnly }),
161823
+ ...toolbarItemProps
161824
+ }
161825
+ }
161826
+ );
161827
+ });
161828
+ async function handleReadOnlyChange(newVal, { beforeReadOnlyChange, updateReadOnlyMode, setIsLoading = () => {
161829
+ } }) {
161830
+ if (beforeReadOnlyChange) {
161831
+ setIsLoading(true);
161832
+ const shouldChange = await beforeReadOnlyChange(newVal);
161833
+ setIsLoading(false);
161834
+ if (shouldChange === false) {
161835
+ return;
161836
+ }
161837
+ }
161838
+ updateReadOnlyMode(newVal);
161839
+ }
161840
+
161576
161841
  const isProtein = (props) => props.sequenceData && props.sequenceData.isProtein;
161577
161842
  const isOligo = (props) => props.sequenceData && props.sequenceData.isOligo;
161578
161843
  const isRna = (props) => props.sequenceData && props.sequenceData.isRna;
@@ -161641,7 +161906,7 @@ const fileCommandDefs = {
161641
161906
  isHidden: isProtein
161642
161907
  },
161643
161908
  deleteSequence: {
161644
- isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || !props.onDelete,
161909
+ isDisabled: (props) => props.disableBpEditing && bpEditingDisabledTooltip || props.readOnly && readOnlyDisabledTooltip || !props.onDelete,
161645
161910
  isHidden: (props) => !props.onDelete,
161646
161911
  handler: (props) => props.onDelete(props.sequenceData)
161647
161912
  },
@@ -161656,7 +161921,7 @@ const fileCommandDefs = {
161656
161921
  isDisabled: (props) => props.disableSetReadOnly || !props.onSave,
161657
161922
  isHidden: (props) => !props.toggleReadOnlyMode,
161658
161923
  isActive: (props) => props.readOnly,
161659
- handler: (props) => props.toggleReadOnlyMode()
161924
+ handler: (props) => handleReadOnlyChange(!props.readOnly, props)
161660
161925
  },
161661
161926
  importSequence: {
161662
161927
  isHidden: (props) => props.hideSingleImport,
@@ -161840,6 +162105,7 @@ Object.keys(defaultCopyOptions).forEach((type) => {
161840
162105
  };
161841
162106
  });
161842
162107
  const readOnlyDisabledTooltip = "Sorry this function is not allowed in Read-Only Mode";
162108
+ const bpEditingDisabledTooltip = "Sequence Editing Disabled";
161843
162109
  const noSelection = ({ selectionLayer = {} }) => !(selectionLayer.start > -1 && selectionLayer.end > -1) && "Selection Required";
161844
162110
  const triggerClipboardCommand = (type) => {
161845
162111
  const wrapper = document.querySelector(".veVectorInteractionWrapper");
@@ -161871,8 +162137,8 @@ const editCommandDefs = {
161871
162137
  handler: lodashExports.noop
161872
162138
  },
161873
162139
  cut: {
161874
- isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || props.sequenceLength === 0,
161875
- isHidden: (props) => props.readOnly,
162140
+ isDisabled: (props) => props.disableBpEditing && bpEditingDisabledTooltip || props.readOnly && readOnlyDisabledTooltip || props.sequenceLength === 0,
162141
+ isHidden: (props) => props.readOnly || props.disableBpEditing,
161876
162142
  handler: () => {
161877
162143
  triggerClipboardCommand("cut");
161878
162144
  },
@@ -161897,7 +162163,7 @@ const editCommandDefs = {
161897
162163
  },
161898
162164
  paste: {
161899
162165
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip,
161900
- isHidden: (props) => props.readOnly,
162166
+ isHidden: (props) => props.readOnly || props.disableBpEditing,
161901
162167
  handler: () => triggerClipboardCommand("paste"),
161902
162168
  hotkey: "mod+v"
161903
162169
  },
@@ -162051,12 +162317,12 @@ const editCommandDefs = {
162051
162317
  hotkey: "mod+i"
162052
162318
  },
162053
162319
  complementSelection: {
162054
- isHidden: (props) => props.readOnly || isProtein(props),
162320
+ isHidden: (props) => props.readOnly || isProtein(props) || props.disableBpEditing,
162055
162321
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || noSelection(props),
162056
162322
  handler: (props) => props.handleComplementSelection()
162057
162323
  },
162058
162324
  complementEntireSequence: {
162059
- isHidden: (props) => props.readOnly || isProtein(props),
162325
+ isHidden: (props) => props.readOnly || isProtein(props) || props.disableBpEditing,
162060
162326
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || props.sequenceLength === 0,
162061
162327
  handler: (props) => props.handleComplementSequence()
162062
162328
  },
@@ -162208,13 +162474,13 @@ const editCommandDefs = {
162208
162474
  // }
162209
162475
  // },
162210
162476
  reverseComplementSelection: {
162211
- isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || noSelection(props),
162477
+ isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || noSelection(props) || props.disableBpEditing,
162212
162478
  isHidden: (props) => props.readOnly || isProtein(props),
162213
162479
  handler: (props) => props.handleReverseComplementSelection(),
162214
162480
  hotkey: "mod+e"
162215
162481
  },
162216
162482
  reverseComplementEntireSequence: {
162217
- isHidden: (props) => props.readOnly || isProtein(props),
162483
+ isHidden: (props) => props.readOnly || isProtein(props) || props.disableBpEditing,
162218
162484
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || props.sequenceLength === 0,
162219
162485
  handler: (props) => props.handleReverseComplementSequence()
162220
162486
  },
@@ -162364,7 +162630,7 @@ const editCommandDefs = {
162364
162630
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || props.sequenceLength === 0
162365
162631
  },
162366
162632
  rotateToCaretPosition: {
162367
- isHidden: (props) => props.readOnly || isProtein(props),
162633
+ isHidden: (props) => props.readOnly || isProtein(props) || props.disableBpEditing,
162368
162634
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip || props.caretPosition === -1 && "You must first place cursor" || !props.sequenceData.circular && "Disabled for Linear Sequences" || props.sequenceLength === 0,
162369
162635
  handler: (props) => props.handleRotateToCaretPosition(),
162370
162636
  hotkey: "mod+b"
@@ -162373,13 +162639,13 @@ const editCommandDefs = {
162373
162639
  };
162374
162640
  const cirularityCommandDefs = {
162375
162641
  circular: {
162376
- isHidden: (props) => props.readOnly || isProtein(props),
162642
+ isHidden: (props) => props.readOnly || isProtein(props) || props.disableBpEditing,
162377
162643
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip,
162378
162644
  handler: (props) => props.updateCircular(true),
162379
162645
  isActive: (props) => props && props.sequenceData.circular
162380
162646
  },
162381
162647
  linear: {
162382
- isHidden: (props) => props.readOnly,
162648
+ isHidden: (props) => props.readOnly || props.disableBpEditing,
162383
162649
  isDisabled: (props) => props.readOnly && readOnlyDisabledTooltip,
162384
162650
  handler: (props) => props.updateCircular(false),
162385
162651
  isActive: (props) => props && !props.sequenceData.circular
@@ -162406,29 +162672,27 @@ const nicheAnnotations = [
162406
162672
  }
162407
162673
  ];
162408
162674
  const labelToggleCommandDefs = {};
162409
- ["feature", "part", "cutsite", "primer", ...nicheAnnotations].forEach(
162410
- (_type) => {
162411
- let rest = {};
162412
- let type = _type;
162413
- if (_type.type) {
162414
- type = _type.type.slice(0, -1);
162415
- rest = _type;
162416
- }
162417
- const cmdId = `toggle${lodashExports.upperFirst(type)}Labels`;
162418
- const plural = type + "s";
162419
- labelToggleCommandDefs[cmdId] = {
162420
- toggle: ["show", "hide"],
162421
- handler: (props) => props.annotationLabelVisibilityToggle(plural),
162422
- isHidden: (props) => {
162423
- return props && props.typesToOmit && props.typesToOmit[plural] === false;
162424
- },
162425
- ...rest,
162426
- isActive: (props) => {
162427
- return props && props.annotationLabelVisibility[plural];
162428
- }
162429
- };
162430
- }
162431
- );
162675
+ ["feature", "part", "cutsite", "primer", ...nicheAnnotations].forEach((_type) => {
162676
+ let rest = {};
162677
+ let type = _type;
162678
+ if (_type.type) {
162679
+ type = _type.type.slice(0, -1);
162680
+ rest = _type;
162681
+ }
162682
+ const cmdId = `toggle${lodashExports.upperFirst(type)}Labels`;
162683
+ const plural = type + "s";
162684
+ labelToggleCommandDefs[cmdId] = {
162685
+ toggle: ["show", "hide"],
162686
+ handler: (props) => props.annotationLabelVisibilityToggle(plural),
162687
+ isHidden: (props) => {
162688
+ return props && props.typesToOmit && props.typesToOmit[plural] === false;
162689
+ },
162690
+ ...rest,
162691
+ isActive: (props) => {
162692
+ return props && props.annotationLabelVisibility[plural];
162693
+ }
162694
+ };
162695
+ });
162432
162696
  const editAnnotationCommandDefs = ["feature", "part", "primer"].reduce(
162433
162697
  (acc, key) => {
162434
162698
  acc[`edit${lodashExports.upperFirst(key)}`] = {
@@ -166617,8 +166881,12 @@ function VectorInteractionHOC(Component) {
166617
166881
  caretPosition = -1,
166618
166882
  selectionLayer = { start: -1, end: -1 },
166619
166883
  readOnly,
166620
- onPaste
166884
+ onPaste,
166885
+ disableBpEditing
166621
166886
  } = this.props;
166887
+ if (disableBpEditing) {
166888
+ return window.toastr.warning("Sorry the underlying sequence is locked");
166889
+ }
166622
166890
  if (readOnly) {
166623
166891
  return window.toastr.warning("Sorry the sequence is Read-Only");
166624
166892
  }
@@ -166659,6 +166927,7 @@ function VectorInteractionHOC(Component) {
166659
166927
  sequenceData,
166660
166928
  selectionLayer,
166661
166929
  copyOptions,
166930
+ disableBpEditing,
166662
166931
  readOnly
166663
166932
  } = this.props;
166664
166933
  const onCut = this.props.onCut || this.props.onCopy || lodashExports.noop;
@@ -166684,7 +166953,7 @@ function VectorInteractionHOC(Component) {
166684
166953
  );
166685
166954
  if (!(this.sequenceDataToCopy || {}).textToCopy && !seqData.sequence.length)
166686
166955
  return window.toastr.warning(
166687
- `No Sequence Selected To ${isCut && !readOnly ? "Cut" : "Copy"}`
166956
+ `No Sequence Selected To ${isCut && !(readOnly || disableBpEditing) ? "Cut" : "Copy"}`
166688
166957
  );
166689
166958
  const clipboardData = e.clipboardData;
166690
166959
  const textToCopy = (this.sequenceDataToCopy || {}).textToCopy !== void 0 ? this.sequenceDataToCopy.textToCopy : seqData.isProtein ? seqData.proteinSequence : seqData.sequence;
@@ -166692,7 +166961,7 @@ function VectorInteractionHOC(Component) {
166692
166961
  clipboardData.setData("text/plain", textToCopy);
166693
166962
  clipboardData.setData("application/json", JSON.stringify(seqData));
166694
166963
  e.preventDefault();
166695
- if (isCut && !readOnly) {
166964
+ if (isCut && !(readOnly || disableBpEditing) && !disableBpEditing) {
166696
166965
  this.handleDnaDelete(false);
166697
166966
  onCut(
166698
166967
  e,
@@ -166705,7 +166974,7 @@ function VectorInteractionHOC(Component) {
166705
166974
  document.body.removeEventListener("copy", this.handleCopy);
166706
166975
  }
166707
166976
  window.toastr.success(
166708
- `Selection ${isCut && !readOnly ? "Cut" : "Copied"}`
166977
+ `Selection ${isCut && !(readOnly || disableBpEditing) && !disableBpEditing ? "Cut" : "Copied"}`
166709
166978
  );
166710
166979
  this.sequenceDataToCopy = void 0;
166711
166980
  };
@@ -166716,14 +166985,18 @@ function VectorInteractionHOC(Component) {
166716
166985
  caretPosition = -1,
166717
166986
  selectionLayer = { start: -1, end: -1 },
166718
166987
  sequenceData = { sequence: "" },
166719
- readOnly
166988
+ readOnly,
166989
+ disableBpEditing
166720
166990
  // updateSequenceData,
166721
166991
  // wrappedInsertSequenceDataAtPositionOrRange
166722
166992
  // handleInsert
166723
166993
  } = this.props;
166724
166994
  const sequenceLength = sequenceData.sequence.length;
166725
166995
  const isReplace = selectionLayer.start > -1;
166726
- if (readOnly) {
166996
+ if (disableBpEditing) {
166997
+ return window.toastr.warning("Sorry the underlying sequence is locked");
166998
+ }
166999
+ if (readOnly || disableBpEditing) {
166727
167000
  window.toastr.warning("Sorry the sequence is Read-Only");
166728
167001
  } else {
166729
167002
  createSequenceInputPopup({
@@ -166751,13 +167024,17 @@ function VectorInteractionHOC(Component) {
166751
167024
  selectionLayer = { start: -1, end: -1 },
166752
167025
  sequenceData = { sequence: "" },
166753
167026
  readOnly,
167027
+ disableBpEditing,
166754
167028
  updateSequenceData,
166755
167029
  wrappedInsertSequenceDataAtPositionOrRange,
166756
167030
  caretPositionUpdate
166757
167031
  // handleInsert
166758
167032
  } = this.props;
166759
167033
  const sequenceLength = sequenceData.sequence.length;
166760
- if (readOnly) {
167034
+ if (disableBpEditing) {
167035
+ return window.toastr.warning("Sorry the underlying sequence is locked");
167036
+ }
167037
+ if (readOnly || disableBpEditing) {
166761
167038
  return window.toastr.warning("Sorry the sequence is Read-Only");
166762
167039
  }
166763
167040
  if (sequenceLength > 0) {
@@ -166888,7 +167165,7 @@ function VectorInteractionHOC(Component) {
166888
167165
  };
166889
167166
  // eslint-disable-next-line no-unused-vars
166890
167167
  getCopyOptions = (annotation) => {
166891
- const { sequenceData, readOnly, selectionLayer } = this.props;
167168
+ const { sequenceData, readOnly, disableBpEditing, selectionLayer } = this.props;
166892
167169
  const { isProtein } = sequenceData;
166893
167170
  const makeTextCopyable = (transformFunc, className, action = "copy") => {
166894
167171
  return new Clipboard$1(`.${className}`, {
@@ -166948,7 +167225,7 @@ function VectorInteractionHOC(Component) {
166948
167225
  }
166949
167226
  };
166950
167227
  return [
166951
- ...readOnly ? [] : [
167228
+ ...readOnly || disableBpEditing ? [] : [
166952
167229
  {
166953
167230
  text: "Replace",
166954
167231
  ...this.insertHelper
@@ -167022,21 +167299,14 @@ function VectorInteractionHOC(Component) {
167022
167299
  this.openVeCopyAAReverse && this.openVeCopyAAReverse.destroy();
167023
167300
  },
167024
167301
  didMount: ({ className }) => {
167025
- this.openVeCopyAAReverse = makeTextCopyable(
167026
- (selectedSeqData) => {
167027
- const revSeqData = getReverseComplementSequenceAndAnnoations(
167028
- selectedSeqData
167029
- );
167030
- const textToCopy = isProtein ? revSeqData.proteinSequence.toUpperCase() : getAminoAcidStringFromSequenceString(
167031
- revSeqData.sequence
167032
- );
167033
- return {
167034
- ...revSeqData,
167035
- textToCopy
167036
- };
167037
- },
167038
- className
167039
- );
167302
+ this.openVeCopyAAReverse = makeTextCopyable((selectedSeqData) => {
167303
+ const revSeqData = getReverseComplementSequenceAndAnnoations(selectedSeqData);
167304
+ const textToCopy = isProtein ? revSeqData.proteinSequence.toUpperCase() : getAminoAcidStringFromSequenceString(revSeqData.sequence);
167305
+ return {
167306
+ ...revSeqData,
167307
+ textToCopy
167308
+ };
167309
+ }, className);
167040
167310
  }
167041
167311
  },
167042
167312
  {
@@ -167143,11 +167413,12 @@ function VectorInteractionHOC(Component) {
167143
167413
  ({ nearestCaretPos, shiftHeld, event }) => {
167144
167414
  this.updateSelectionOrCaret(shiftHeld, nearestCaretPos);
167145
167415
  const {
167146
- readOnly
167416
+ readOnly,
167417
+ disableBpEditing
167147
167418
  // sequenceData: { circular }
167148
167419
  } = this.props;
167149
167420
  const menu = [
167150
- ...readOnly ? [] : [
167421
+ ...readOnly || disableBpEditing ? [] : [
167151
167422
  {
167152
167423
  text: "Insert",
167153
167424
  ...this.insertHelper
@@ -167193,8 +167464,7 @@ function VectorInteractionHOC(Component) {
167193
167464
  overlapsSelf: annotation.overlapsSelf
167194
167465
  });
167195
167466
  return [
167196
- "editPart",
167197
- "deletePart",
167467
+ ...getEditDeleteHandlers("Part", annotation),
167198
167468
  "--",
167199
167469
  ...this.getSelectionMenuOptions(annotation),
167200
167470
  "--",
@@ -167236,8 +167506,7 @@ function VectorInteractionHOC(Component) {
167236
167506
  event.persist();
167237
167507
  const { readOnly, annotationsToSupport: { parts } = {} } = this.props;
167238
167508
  return [
167239
- "editFeature",
167240
- "deleteFeature",
167509
+ ...getEditDeleteHandlers("Feature", annotation),
167241
167510
  ...this.getSelectionMenuOptions(annotation),
167242
167511
  ...readOnly ? [] : [
167243
167512
  ...parts && [
@@ -167304,8 +167573,7 @@ function VectorInteractionHOC(Component) {
167304
167573
  end: annotation.end
167305
167574
  });
167306
167575
  return [
167307
- "editPrimer",
167308
- "deletePrimer",
167576
+ ...getEditDeleteHandlers("Primer", annotation),
167309
167577
  ...this.getSelectionMenuOptions(annotation),
167310
167578
  "showRemoveDuplicatesDialogPrimers",
167311
167579
  "viewPrimerProperties"
@@ -167515,8 +167783,30 @@ const insertAndSelectHelper = ({ seqDataToInsert, props }) => {
167515
167783
  end: newSelectionLayerEnd % newSeqData.sequence.length
167516
167784
  });
167517
167785
  };
167786
+ function getEditDeleteHandlers(type, annotation) {
167787
+ return [
167788
+ ...annotation.isEditLocked ? [
167789
+ {
167790
+ shouldDismissPopover: false,
167791
+ text: /* @__PURE__ */ React__default$1.createElement(
167792
+ "div",
167793
+ {
167794
+ style: {
167795
+ fontSize: 11,
167796
+ fontStyle: "italic",
167797
+ color: "rgba(0,0,0,.5)"
167798
+ }
167799
+ },
167800
+ typeof annotation.isEditLocked === "string" ? annotation.isEditLocked : `Note: This Annotation is Locked`
167801
+ )
167802
+ }
167803
+ ] : [],
167804
+ `edit${type}`,
167805
+ ...annotation.isEditLocked ? [] : [`delete${type}`]
167806
+ ];
167807
+ }
167518
167808
 
167519
- const style$i = '';
167809
+ const style$h = '';
167520
167810
 
167521
167811
  function SequenceName({ sequenceName, sequenceLength, isProtein }) {
167522
167812
  return /* @__PURE__ */ React__default$1.createElement("div", { key: "circViewSvgCenterText", style: { textAlign: "center" } }, /* @__PURE__ */ React__default$1.createElement("span", null, sequenceName, " "), /* @__PURE__ */ React__default$1.createElement("br", null), /* @__PURE__ */ React__default$1.createElement("span", null, isProtein ? `${Math.floor(sequenceLength / 3)} AAs` : `${sequenceLength} bps`));
@@ -169902,7 +170192,7 @@ function VisibilityOptions$2({
169902
170192
  );
169903
170193
  }
169904
170194
 
169905
- const style$h = '';
170195
+ const style$g = '';
169906
170196
 
169907
170197
  const simpleDialog = '';
169908
170198
 
@@ -170179,7 +170469,7 @@ function combineLabels(labels, numberOfBuckets) {
170179
170469
  return combinedLabels;
170180
170470
  }
170181
170471
 
170182
- const style$g = '';
170472
+ const style$f = '';
170183
170473
 
170184
170474
  const fontWidthToFontSize = 1.75;
170185
170475
  const getTextLength = (text) => {
@@ -172382,7 +172672,7 @@ function DrawAnnotationInner({
172382
172672
  }
172383
172673
  const DrawAnnotation = withHover(DrawAnnotationInner);
172384
172674
 
172385
- const style$f = '';
172675
+ const style$e = '';
172386
172676
 
172387
172677
  function c(u,e,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),m=useRef(),v=useRef(),d=useRef(u),p=useRef(!0);useEffect(function(){d.current=u;},[u]);var g=!e&&0!==e&&"undefined"!=typeof window;if("function"!=typeof u)throw new TypeError("Expected a function");e=+e||0;var w=!!(c=c||{}).leading,s=!("trailing"in c)||!!c.trailing,x="maxWait"in c,y=x?Math.max(+c.maxWait||0,e):null;useEffect(function(){return p.current=!0,function(){p.current=!1;}},[]);var h=useMemo$1(function(){var r=function(r){var n=l.current,t=m.current;return l.current=m.current=null,o.current=r,v.current=d.current.apply(t,n)},n=function(r,n){g&&cancelAnimationFrame(f.current),f.current=g?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!p.current)return !1;var n=r-a.current;return !a.current||n>=e||n<0||x&&r-o.current>=y},u=function(n){return f.current=null,s&&l.current?r(n):(l.current=m.current=null,v.current)},c=function r(){var c=Date.now();if(t(c))return u(c);if(p.current){var i=e-(c-a.current),f=x?Math.min(i,y-(c-o.current)):i;n(r,f);}},h=function(){var u=Date.now(),d=t(u);if(l.current=[].slice.call(arguments),m.current=i,a.current=u,d){if(!f.current&&p.current)return o.current=a.current,n(c,e),w?r(a.current):v.current;if(x)return n(c,e),r(a.current)}return f.current||n(c,e),v.current};return h.cancel=function(){f.current&&(g?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=m.current=f.current=null;},h.isPending=function(){return !!f.current},h.flush=function(){return f.current?u(Date.now()):v.current},h},[w,x,e,y,s,g]);return h}
172388
172678
 
@@ -173315,7 +173605,7 @@ function CircularView(props) {
173315
173605
  }
173316
173606
  const CircularView$1 = withEditorInteractions(CircularView);
173317
173607
 
173318
- const style$e = '';
173608
+ const style$d = '';
173319
173609
 
173320
173610
  class PrintDialog extends React__default$1.Component {
173321
173611
  state = {
@@ -173796,7 +174086,7 @@ const RemoveDuplicates = compose$1(
173796
174086
  tgFormValues("ignoreName", "ignoreStrand", "ignoreStartAndEnd")
173797
174087
  )(RemoveDuplicatesDialog);
173798
174088
 
173799
- const style$d = '';
174089
+ const style$c = '';
173800
174090
 
173801
174091
  var isMobile$2 = {exports: {}};
173802
174092
 
@@ -174672,7 +174962,11 @@ const GoToDialog = createSimpleDialog({
174672
174962
  }
174673
174963
  }
174674
174964
  ],
174675
- withDialogProps: { title: "Go To", height: 190, onCloseHook: tryToRefocusEditor }
174965
+ withDialogProps: {
174966
+ title: "Go To",
174967
+ height: 190,
174968
+ onCloseHook: tryToRefocusEditor
174969
+ }
174676
174970
  });
174677
174971
 
174678
174972
  const validate$1 = (val, vals, props) => {
@@ -174814,7 +175108,7 @@ const normalizeToInt = (val) => {
174814
175108
  return normalizedVal;
174815
175109
  };
174816
175110
 
174817
- const style$c = '';
175111
+ const style$b = '';
174818
175112
 
174819
175113
  const EnzymeViewer = ({
174820
175114
  extraClasses = "",
@@ -174889,7 +175183,7 @@ const EnzymeViewer = ({
174889
175183
  );
174890
175184
  };
174891
175185
 
174892
- const style$b = '';
175186
+ const style$a = '';
174893
175187
 
174894
175188
  const upsertLocalEnzymeGroups = (newGroups) => {
174895
175189
  const existingGroups = window.getExistingEnzymeGroups();
@@ -175585,7 +175879,7 @@ const HoverView = view(({ allEnzymesByName }) => {
175585
175879
  );
175586
175880
  });
175587
175881
 
175588
- const style$a = '';
175882
+ const style$9 = '';
175589
175883
 
175590
175884
  const CreateCustomEnzyme = function(props) {
175591
175885
  const paddingStart = "-------";
@@ -176410,143 +176704,6 @@ function getIsEnzymeHidden({ name, allRestrictionEnzymes }) {
176410
176704
  return isHidden;
176411
176705
  }
176412
176706
 
176413
- const style$9 = '';
176414
-
176415
- class ToolbarItem extends React__default$1.Component {
176416
- toggleDropdown = ({ forceClose } = {}) => {
176417
- const { toolName, isOpen } = this.props;
176418
- this.props.openToolbarItemUpdate(isOpen || forceClose ? "" : toolName);
176419
- };
176420
- render() {
176421
- const { overrides = {} } = this.props;
176422
- const {
176423
- isOpen,
176424
- index,
176425
- Icon: Icon$1,
176426
- // dynamicIcon,
176427
- onIconClick = lodashExports.noop,
176428
- tooltip = "",
176429
- tooltipToggled,
176430
- dropdowntooltip = "",
176431
- Dropdown,
176432
- disabled,
176433
- isHidden,
176434
- renderIconAbove,
176435
- noDropdownIcon,
176436
- IconWrapper,
176437
- editorName,
176438
- popoverDisabled,
176439
- IconWrapperProps,
176440
- toolName,
176441
- dropdownicon,
176442
- tooltipDisabled,
176443
- toggled = false,
176444
- ...rest
176445
- } = { ...this.props, ...overrides };
176446
- if (!toolName)
176447
- console.warn("toolName is required!");
176448
- if (isHidden)
176449
- return null;
176450
- let tooltipToDisplay = tooltip;
176451
- if (toggled && tooltipToggled) {
176452
- tooltipToDisplay = tooltipToggled;
176453
- }
176454
- const buttonTarget = /* @__PURE__ */ React__default$1.createElement(
176455
- "div",
176456
- {
176457
- className: `veToolbarItemOuter ve-tool-container-${toolName}` + (disabled ? " disabled " : "")
176458
- },
176459
- renderIconAbove && /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarItem" }, Icon$1)),
176460
- Icon$1 && !renderIconAbove && /* @__PURE__ */ React__default$1.createElement(
176461
- Tooltip,
176462
- {
176463
- disabled: tooltipDisabled,
176464
- portalClassName: "ve-toolbar-item-popover",
176465
- content: tooltipToDisplay
176466
- },
176467
- /* @__PURE__ */ React__default$1.createElement(
176468
- AnchorButton,
176469
- {
176470
- intent: Intent.PRIMARY,
176471
- onClick: onIconClick === "toggleDropdown" ? this.toggleDropdown : onIconClick,
176472
- active: toggled,
176473
- disabled,
176474
- minimal: true,
176475
- icon: React__default$1.isValidElement(Icon$1) ? Icon$1 : /* @__PURE__ */ React__default$1.createElement(Icon$1, { toggleDropdown: this.toggleDropdown })
176476
- }
176477
- )
176478
- ),
176479
- Dropdown && !noDropdownIcon ? /* @__PURE__ */ React__default$1.createElement(Tooltip, { disabled: tooltipDisabled, content: dropdowntooltip }, /* @__PURE__ */ React__default$1.createElement(
176480
- "div",
176481
- {
176482
- className: (isOpen ? " isOpen " : "") + (dropdownicon ? "" : " veToolbarDropdown"),
176483
- onClick: this.toggleDropdown
176484
- },
176485
- dropdownicon ? /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarIcon" }, /* @__PURE__ */ React__default$1.createElement("div", null, dropdownicon)) : isOpen ? /* @__PURE__ */ React__default$1.createElement(
176486
- Icon,
176487
- {
176488
- "data-test": toolName + "Dropdown",
176489
- iconSize: 13,
176490
- icon: "caret-up"
176491
- }
176492
- ) : /* @__PURE__ */ React__default$1.createElement(
176493
- Icon,
176494
- {
176495
- "data-test": toolName + "Dropdown",
176496
- iconSize: 13,
176497
- icon: "caret-down"
176498
- }
176499
- )
176500
- )) : null
176501
- );
176502
- const content = /* @__PURE__ */ React__default$1.createElement(
176503
- "div",
176504
- {
176505
- ref: (n) => {
176506
- if (n)
176507
- this.dropdownNode = n;
176508
- },
176509
- style: { padding: 10, minWidth: 250, maxWidth: 350 },
176510
- className: "ve-toolbar-dropdown content"
176511
- },
176512
- Dropdown && /* @__PURE__ */ React__default$1.createElement(
176513
- Dropdown,
176514
- {
176515
- ...rest,
176516
- editorName,
176517
- toggleDropdown: this.toggleDropdown
176518
- }
176519
- )
176520
- );
176521
- const target = IconWrapper ? /* @__PURE__ */ React__default$1.createElement(IconWrapper, { ...IconWrapperProps }, ({ getRootProps, getInputProps }) => /* @__PURE__ */ React__default$1.createElement("div", { ...getRootProps() }, /* @__PURE__ */ React__default$1.createElement("input", { ...getInputProps() }), buttonTarget)) : buttonTarget;
176522
- return /* @__PURE__ */ React__default$1.createElement("div", { style: { display: "flex", alignItems: "center" } }, index !== 0 && /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarSpacer" }), /* @__PURE__ */ React__default$1.createElement(
176523
- Popover,
176524
- {
176525
- disabled: popoverDisabled,
176526
- isOpen: !!Dropdown && isOpen,
176527
- onClose: (e) => {
176528
- let srcElement;
176529
- if (e) {
176530
- srcElement = e.srcElement || e.target;
176531
- }
176532
- if (e && srcElement && this.dropdownNode && (this.dropdownNode.contains(srcElement) || !document.body.contains(srcElement))) {
176533
- return;
176534
- }
176535
- this.toggleDropdown({ forceClose: true });
176536
- },
176537
- canEscapeKeyClose: true,
176538
- minimal: true,
176539
- position: Position.BOTTOM,
176540
- target,
176541
- content
176542
- }
176543
- ));
176544
- }
176545
- }
176546
- const ToolbarItem$1 = connectToEditor(({ toolBar = {} }, { toolName }) => ({
176547
- isOpen: toolBar.openItem === toolName
176548
- }))(ToolbarItem);
176549
-
176550
176707
  function array_move(arr, old_index, new_index) {
176551
176708
  if (new_index >= arr.length) {
176552
176709
  let k = new_index - arr.length + 1;
@@ -177332,6 +177489,7 @@ class AddOrEditAnnotationDialog extends React__default$1.Component {
177332
177489
  overlapsSelf,
177333
177490
  start,
177334
177491
  end,
177492
+ readOnly,
177335
177493
  getAdditionalEditAnnotationComps,
177336
177494
  advancedOptions,
177337
177495
  advancedDefaultOpen,
@@ -177426,10 +177584,11 @@ class AddOrEditAnnotationDialog extends React__default$1.Component {
177426
177584
  "tg-upsert-annotation"
177427
177585
  )
177428
177586
  },
177587
+ typeof readOnly === "string" ? /* @__PURE__ */ React__default$1.createElement(Callout, { intent: "primary", style: { marginBottom: 10 } }, readOnly) : null,
177429
177588
  /* @__PURE__ */ React__default$1.createElement(
177430
177589
  InputField,
177431
177590
  {
177432
- disabled: this.props.readOnly,
177591
+ disabled: readOnly,
177433
177592
  inlineLabel: true,
177434
177593
  tooltipError: true,
177435
177594
  autoFocus: true,
@@ -180367,15 +180526,15 @@ class Browser {
180367
180526
  }
180368
180527
  // Edge 20+
180369
180528
  static isEdge() {
180370
- return Browser.isBrowser() && (!Browser.isIE() && !!window.StyleMedia);
180529
+ return Browser.isBrowser() && !Browser.isIE() && !!window.StyleMedia;
180371
180530
  }
180372
180531
  // Chrome 1+
180373
180532
  static isChrome() {
180374
- return Browser.isBrowser() && (!!window.chrome && !!window.chrome.webstore);
180533
+ return Browser.isBrowser() && !!window.chrome && !!window.chrome.webstore;
180375
180534
  }
180376
180535
  // Blink engine detection
180377
180536
  static isBlink() {
180378
- return Browser.isBrowser() && ((Browser.isChrome() || Browser.isOpera()) && !!window.CSS);
180537
+ return Browser.isBrowser() && (Browser.isChrome() || Browser.isOpera()) && !!window.CSS;
180379
180538
  }
180380
180539
  static getUserAgent() {
180381
180540
  return typeof navigator === "undefined" ? "" : navigator.userAgent;
@@ -182947,7 +183106,7 @@ function addClickableLabel(toRet, { closeDropDown }) {
182947
183106
  }
182948
183107
 
182949
183108
  const userDefinedHandlersAndOpts = [
182950
- "onChangeEditLock",
183109
+ "beforeReadOnlyChange",
182951
183110
  "defaultLinkedOligoMessage",
182952
183111
  "allowMultipleFeatureDirections",
182953
183112
  "getAdditionalEditAnnotationComps",
@@ -182968,6 +183127,8 @@ const userDefinedHandlersAndOpts = [
182968
183127
  "hideSingleImport",
182969
183128
  "beforeAnnotationCreate",
182970
183129
  "disableSetReadOnly",
183130
+ "allowAnnotationEditLocking",
183131
+ "disableBpEditing",
182971
183132
  "showReadOnly",
182972
183133
  "showCircularity",
182973
183134
  "onHiddenEnzymeAdd",
@@ -183208,49 +183369,6 @@ const OrfToolDropdown = withEditorProps(
183208
183369
  }
183209
183370
  );
183210
183371
 
183211
- const editTool = connectToEditor((editorState) => {
183212
- return {
183213
- readOnly: editorState.readOnly
183214
- };
183215
- })(
183216
- ({
183217
- toolbarItemProps,
183218
- readOnly,
183219
- toggleReadOnlyMode,
183220
- disableSetReadOnly,
183221
- onChangeEditLock
183222
- }) => {
183223
- const [isLoading, setIsLoading] = useState(false);
183224
- const readOnlyTooltip = ({ readOnly: readOnly2, disableSetReadOnly: disableSetReadOnly2 }) => {
183225
- if (isLoading) {
183226
- return "Loading...";
183227
- } else if (disableSetReadOnly2) {
183228
- return "You do not have permission to edit locks on this sequence";
183229
- }
183230
- return readOnly2 ? "Click to enable editing" : "Click to disable editing";
183231
- };
183232
- return /* @__PURE__ */ React__default$1.createElement(
183233
- ToolbarItem$1,
183234
- {
183235
- ...{
183236
- disabled: isLoading || disableSetReadOnly,
183237
- Icon: /* @__PURE__ */ React__default$1.createElement(Icon, { icon: readOnly ? "lock" : "unlock" }),
183238
- onIconClick: async () => {
183239
- if (onChangeEditLock) {
183240
- setIsLoading(true);
183241
- await onChangeEditLock(!readOnly);
183242
- setIsLoading(false);
183243
- }
183244
- toggleReadOnlyMode();
183245
- },
183246
- tooltip: readOnlyTooltip({ readOnly, disableSetReadOnly }),
183247
- ...toolbarItemProps
183248
- }
183249
- }
183250
- );
183251
- }
183252
- );
183253
-
183254
183372
  const style$4 = '';
183255
183373
 
183256
183374
  const opts = [
@@ -183871,31 +183989,22 @@ const style$3 = '';
183871
183989
 
183872
183990
  const EditReadOnlyItem = connectToEditor(({ readOnly }) => ({
183873
183991
  readOnly
183874
- }))(
183875
- ({
183876
- onSave,
183877
- readOnly,
183878
- showReadOnly,
183879
- disableSetReadOnly,
183880
- updateReadOnlyMode
183881
- }) => {
183882
- return showReadOnly ? /* @__PURE__ */ React__default$1.createElement(StatusBarItem, { dataTest: "veStatusBar-readOnly" }, onSave ? /* @__PURE__ */ React__default$1.createElement(
183883
- HTMLSelect,
183884
- {
183885
- options: [
183886
- { label: "Read Only", value: "readOnly" },
183887
- { label: "Editable", value: "editable" }
183888
- ],
183889
- disabled: disableSetReadOnly || !onSave,
183890
- className: Classes.MINIMAL,
183891
- value: readOnly ? "readOnly" : "editable",
183892
- onChange: ({ target: { value } }) => {
183893
- updateReadOnlyMode(value === "readOnly");
183894
- }
183895
- }
183896
- ) : readOnly ? "Read Only" : "Editable") : null;
183897
- }
183898
- );
183992
+ }))((props) => {
183993
+ const { onSave, readOnly, showReadOnly, disableSetReadOnly } = props;
183994
+ return showReadOnly ? /* @__PURE__ */ React__default$1.createElement(StatusBarItem, { dataTest: "veStatusBar-readOnly" }, onSave ? /* @__PURE__ */ React__default$1.createElement(
183995
+ HTMLSelect,
183996
+ {
183997
+ options: [
183998
+ { label: "Read Only", value: "readOnly" },
183999
+ { label: "Editable", value: "editable" }
184000
+ ],
184001
+ disabled: disableSetReadOnly || !onSave,
184002
+ className: Classes.MINIMAL,
184003
+ value: readOnly ? "readOnly" : "editable",
184004
+ onChange: ({ target: { value } }) => handleReadOnlyChange(value === "readOnly", props)
184005
+ }
184006
+ ) : readOnly ? "Read Only" : "Editable") : null;
184007
+ });
183899
184008
  const ShowSelectionItem = compose(
183900
184009
  connectToEditor(
183901
184010
  ({ selectionLayer, caretPosition, sequenceData = { sequence: "" } }, ownProps, ...rest) => {
@@ -184042,11 +184151,13 @@ function StatusBar({
184042
184151
  showGCContentByDefault,
184043
184152
  onSelectionOrCaretChanged,
184044
184153
  GCDecimalDigits = 1,
184045
- isProtein
184154
+ isProtein,
184155
+ beforeReadOnlyChange
184046
184156
  }) {
184047
184157
  return /* @__PURE__ */ React__default$1.createElement("div", { className: "veStatusBar" }, showMoleculeType && /* @__PURE__ */ React__default$1.createElement(ShowTypeItem, { editorName }), /* @__PURE__ */ React__default$1.createElement(
184048
184158
  EditReadOnlyItem,
184049
184159
  {
184160
+ beforeReadOnlyChange,
184050
184161
  editorName,
184051
184162
  onSave,
184052
184163
  disableSetReadOnly,
@@ -184381,9 +184492,7 @@ const genericAnnotationProperties = ({
184381
184492
  AnchorButton,
184382
184493
  {
184383
184494
  onClick: () => {
184384
- deleteAnnotation(
184385
- annotationPropertiesSelectedEntities
184386
- );
184495
+ deleteAnnotation(annotationPropertiesSelectedEntities);
184387
184496
  },
184388
184497
  className: "tgDeleteAnnsBtn",
184389
184498
  intent: "danger",
@@ -184487,7 +184596,6 @@ class GeneralProperties extends React__default$1.Component {
184487
184596
  disableSetReadOnly,
184488
184597
  updateAvailability,
184489
184598
  sequenceData,
184490
- updateReadOnlyMode,
184491
184599
  onSave,
184492
184600
  showAvailability,
184493
184601
  sequenceNameUpdate
@@ -184542,10 +184650,9 @@ class GeneralProperties extends React__default$1.Component {
184542
184650
  ))), /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-flex-row" }, /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-left bp3-label" }, "Length"), " ", /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-right" }, " ", isProtein ? proteinSequence.length : sequence.length)), showReadOnly && /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-flex-row" }, /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-left bp3-label" }, "Is Editable"), " ", /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-right" }, " ", /* @__PURE__ */ React__default$1.createElement(
184543
184651
  BPSelect,
184544
184652
  {
184653
+ className: "veReadOnlySelect",
184545
184654
  disabled: !onSave || disableSetReadOnly,
184546
- onChange: (val) => {
184547
- updateReadOnlyMode(val === "readOnly");
184548
- },
184655
+ onChange: (val) => console.log(`val:`, val) || handleReadOnlyChange(val === "readOnly", this.props),
184549
184656
  value: readOnly ? "readOnly" : "editable",
184550
184657
  options: [
184551
184658
  { label: "Read Only", value: "readOnly" },
@@ -194618,7 +194725,7 @@ class Editor extends React__default$1.Component {
194618
194725
  contentLeft: this.props.contentLeft,
194619
194726
  editorName,
194620
194727
  withDigestTool: true,
194621
- onChangeEditLock: this.props.onChangeEditLock,
194728
+ beforeReadOnlyChange: this.props.beforeReadOnlyChange,
194622
194729
  ...ToolBarProps
194623
194730
  }
194624
194731
  ),