ketcher-react 3.9.0-rc.2 → 3.10.0-build.2

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.
@@ -100,9 +100,7 @@ declare class Editor implements KetcherEditor {
100
100
  private potentialLeavingAtomsForAutoAssignment;
101
101
  private potentialLeavingAtomsForManualAssignment;
102
102
  get isMonomerCreationWizardEnabled(): boolean;
103
- isMinimalViableStructure(): boolean;
104
103
  static isStructureContinuous(struct: Struct, selection?: Selection): boolean;
105
- static isStructureImpure(struct: Struct): boolean;
106
104
  private originalStruct;
107
105
  private originalSelection;
108
106
  private selectedToOriginalAtomsIdMap;
@@ -62,7 +62,7 @@ declare const _default: {
62
62
  hidden: (options: any) => boolean;
63
63
  };
64
64
  'charge-plus': {
65
- shortcut: string[];
65
+ shortcut: string;
66
66
  title: string;
67
67
  action: {
68
68
  tool: string;
@@ -71,7 +71,7 @@ declare const _default: {
71
71
  hidden: (options: any) => boolean;
72
72
  };
73
73
  'charge-minus': {
74
- shortcut: string[];
74
+ shortcut: string;
75
75
  title: string;
76
76
  action: {
77
77
  tool: string;
@@ -13,7 +13,7 @@ export declare type WizardValues = {
13
13
  [key in StringWizardFormFieldId]: string;
14
14
  };
15
15
  export declare type WizardNotificationType = 'info' | 'error';
16
- export declare type WizardNotificationId = 'defaultAttachmentPoints' | 'emptyMandatoryFields' | 'invalidSymbol' | 'symbolExists' | 'editingIsNotAllowed' | 'noAttachmentPoints' | 'incorrectAttachmentPointsOrder' | 'creationSuccessful' | 'incontinuousStructure' | 'notMinimalViableStructure' | 'impureStructure';
16
+ export declare type WizardNotificationId = 'defaultAttachmentPoints' | 'emptyMandatoryFields' | 'invalidSymbol' | 'symbolExists' | 'editingIsNotAllowed' | 'noAttachmentPoints' | 'incorrectAttachmentPointsOrder' | 'creationSuccessful' | 'incontinuousStructure';
17
17
  export declare type WizardNotificationTypeMap = Record<WizardNotificationId, WizardNotificationType>;
18
18
  export declare type WizardNotificationMessageMap = Record<WizardNotificationId, string>;
19
19
  export declare type WizardNotification = {
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ import _, { isNumber, throttle as throttle$1, debounce as debounce$1, intersecti
42
42
  import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
43
43
  import styled from '@emotion/styled';
44
44
  import { css } from '@emotion/react';
45
+ import * as KN from 'w3c-keyname';
45
46
  import require$$0$3 from 'util';
46
47
  import ReactDOM, { createPortal } from 'react-dom';
47
48
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
@@ -2790,7 +2791,7 @@ var toolActions = (_toolActions = {
2790
2791
  }
2791
2792
  },
2792
2793
  'charge-plus': {
2793
- shortcut: ['Equal', 'Shift+Equal', 'NumpadAdd'],
2794
+ shortcut: '+',
2794
2795
  title: 'Charge Plus',
2795
2796
  action: {
2796
2797
  tool: 'charge',
@@ -2801,7 +2802,7 @@ var toolActions = (_toolActions = {
2801
2802
  }
2802
2803
  },
2803
2804
  'charge-minus': {
2804
- shortcut: ['Minus', 'NumpadSubtract'],
2805
+ shortcut: '-',
2805
2806
  title: 'Charge Minus',
2806
2807
  action: {
2807
2808
  tool: 'charge',
@@ -3838,7 +3839,7 @@ var zoom = {
3838
3839
  }
3839
3840
  },
3840
3841
  'zoom-out': {
3841
- shortcut: ['Mod+Minus', 'Mod+NumpadSubtract'],
3842
+ shortcut: ['Ctrl+_', 'Ctrl+-'],
3842
3843
  title: 'Zoom Out',
3843
3844
  enabledInViewOnly: true,
3844
3845
  disabled: function disabled(editor) {
@@ -3860,7 +3861,7 @@ var zoom = {
3860
3861
  }
3861
3862
  },
3862
3863
  'zoom-in': {
3863
- shortcut: ['Mod+Equal', 'Mod+NumpadAdd'],
3864
+ shortcut: ['Ctrl+=', 'Ctrl++'],
3864
3865
  title: 'Zoom In',
3865
3866
  enabledInViewOnly: true,
3866
3867
  disabled: function disabled(editor) {
@@ -3891,7 +3892,7 @@ var zoom = {
3891
3892
 
3892
3893
  var openHelpLink = function openHelpLink() {
3893
3894
  var _window$open;
3894
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.9.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3895
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("master", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3895
3896
  };
3896
3897
  var help = {
3897
3898
  help: {
@@ -8852,7 +8853,7 @@ var Dialog = function Dialog(props) {
8852
8853
  }
8853
8854
  };
8854
8855
  var keyDown = function keyDown(event) {
8855
- var key = event.key;
8856
+ var key = KN.keyName(event);
8856
8857
  var active = document.activeElement;
8857
8858
  var activeTextarea = active && active.tagName === 'TEXTAREA';
8858
8859
  if (key === 'Escape' || key === 'Enter' && !activeTextarea) {
@@ -20352,8 +20353,8 @@ function keyHandle(dispatch, getState, hotKeys, event) {
20352
20353
  var hoveredItem = getHoveredItem(render.ctab);
20353
20354
  if (key && key.length === 1 && !hoveredItem) {
20354
20355
  var currentlyPressedKeys = selectAbbreviationLookupValue(state);
20355
- var isShortcutKey = shortcutKeys.includes(key.toLowerCase());
20356
- var isTheSameKey = key.toLowerCase() === currentlyPressedKeys;
20356
+ var isShortcutKey = shortcutKeys.includes(key === null || key === void 0 ? void 0 : key.toLowerCase());
20357
+ var isTheSameKey = key === currentlyPressedKeys;
20357
20358
  var isAbbreviationLookupShown = (!isTheSameKey || !isShortcutKey) && currentlyPressedKeys;
20358
20359
  if (isAbbreviationLookupShown) {
20359
20360
  dispatch(showAbbreviationLookup(event.key));
@@ -20371,7 +20372,7 @@ function keyHandle(dispatch, getState, hotKeys, event) {
20371
20372
  dispatch(initAbbreviationLookup(event.key));
20372
20373
  }
20373
20374
  }
20374
- if (key === 'Slash') {
20375
+ if (key && key.length === 1 && key.match('/')) {
20375
20376
  var hotkeyDialogTypes = {
20376
20377
  atoms: configWithNonViewOnlyActionsDisabled['atom-props'].action,
20377
20378
  bonds: configWithNonViewOnlyActionsDisabled['bond-props'].action
@@ -25577,35 +25578,11 @@ var Editor$3 = function () {
25577
25578
  }
25578
25579
  return false;
25579
25580
  }
25580
- }, {
25581
- key: "isMinimalViableStructure",
25582
- value: function isMinimalViableStructure() {
25583
- var _this = this;
25584
- var nonLeavingAtoms = this.struct().atoms.filter(function (atomId) {
25585
- assert_1(_this.monomerCreationState);
25586
- return Array.from(_this.monomerCreationState.assignedAttachmentPoints.values()).every(function (atomPair) {
25587
- return atomPair[1] !== atomId;
25588
- });
25589
- });
25590
- if (nonLeavingAtoms.size < 2) {
25591
- return false;
25592
- }
25593
- var nonLeavingAtomBonds = this.struct().bonds.filter(function (_, bond) {
25594
- return nonLeavingAtoms.has(bond.begin) && nonLeavingAtoms.has(bond.end);
25595
- });
25596
- if (nonLeavingAtomBonds.size < 1) {
25597
- return false;
25598
- }
25599
- var simpleSingleBonds = nonLeavingAtomBonds.filter(function (_, bond) {
25600
- return bond.type === Bond$2.PATTERN.TYPE.SINGLE && bond.stereo === Bond$2.PATTERN.STEREO.NONE;
25601
- });
25602
- return simpleSingleBonds.size >= 1;
25603
- }
25604
25581
  }, {
25605
25582
  key: "openMonomerCreationWizard",
25606
25583
  value: function openMonomerCreationWizard() {
25607
25584
  var _selection$atoms2,
25608
- _this2 = this;
25585
+ _this = this;
25609
25586
  var currentStruct = this.render.ctab.molecule;
25610
25587
  var selection = this.selection();
25611
25588
  assert_1(selection);
@@ -25617,7 +25594,7 @@ var Editor$3 = function () {
25617
25594
  return a - b;
25618
25595
  }).forEach(function (atomId, i) {
25619
25596
  originalToSelectedAtomsIdMap.set(atomId, i);
25620
- _this2.selectedToOriginalAtomsIdMap.set(i, atomId);
25597
+ _this.selectedToOriginalAtomsIdMap.set(i, atomId);
25621
25598
  });
25622
25599
  var assignedAttachmentPoints = new Map();
25623
25600
  var sideTerminalSGroupAtoms = this.terminalRGroupAtoms.filter(function (_ref) {
@@ -25686,10 +25663,10 @@ var Editor$3 = function () {
25686
25663
  pp: leavingAtom.pp
25687
25664
  });
25688
25665
  var selectedStructLeavingAtomId = selectedStruct.atoms.add(selectedStructLeavingAtom);
25689
- _this2.selectedToOriginalAtomsIdMap.set(selectedStructLeavingAtomId, atomId);
25666
+ _this.selectedToOriginalAtomsIdMap.set(selectedStructLeavingAtomId, atomId);
25690
25667
  var selectedStructAttachmentAtomId = originalToSelectedAtomsIdMap.get(attachmentAtomId);
25691
25668
  assert_1(selectedStructAttachmentAtomId !== undefined);
25692
- _this2.selectedToOriginalAtomsIdMap.set(selectedStructAttachmentAtomId, attachmentAtomId);
25669
+ _this.selectedToOriginalAtomsIdMap.set(selectedStructAttachmentAtomId, attachmentAtomId);
25693
25670
  var newBond = new Bond$2({
25694
25671
  type: Bond$2.PATTERN.TYPE.SINGLE,
25695
25672
  begin: selectedStructAttachmentAtomId,
@@ -25783,7 +25760,7 @@ var Editor$3 = function () {
25783
25760
  }, {
25784
25761
  key: "assignConnectionPointAtom",
25785
25762
  value: function assignConnectionPointAtom(atomId) {
25786
- var _this3 = this;
25763
+ var _this2 = this;
25787
25764
  assert_1(this.monomerCreationState);
25788
25765
  var potentialLeavingAtoms = this.monomerCreationState.potentialAttachmentPoints.get(atomId);
25789
25766
  var leavingAtomId;
@@ -25792,7 +25769,7 @@ var Editor$3 = function () {
25792
25769
  return a - b;
25793
25770
  }).reduce(function (acc, currentAtomId) {
25794
25771
  var _Elements$get;
25795
- var atom = _this3.struct().atoms.get(currentAtomId);
25772
+ var atom = _this2.struct().atoms.get(currentAtomId);
25796
25773
  assert_1(atom);
25797
25774
  var atomicNumber = (_Elements$get = Elements.get(atom.label)) === null || _Elements$get === void 0 ? void 0 : _Elements$get.number;
25798
25775
  if (atomicNumber !== undefined) {
@@ -25848,16 +25825,14 @@ var Editor$3 = function () {
25848
25825
  assert_1(isNumber(originalLeavingAtomId));
25849
25826
  var originalLeavingAtom = this.originalStruct.atoms.get(originalLeavingAtomId);
25850
25827
  assert_1(originalLeavingAtom);
25851
- if (originalLeavingAtom.rglabel !== null) {
25852
- originalLeavingAtom.rglabel = null;
25853
- originalLeavingAtom.label = leavingAtom.label;
25854
- this.originalStruct.calcImplicitHydrogen(originalLeavingAtomId);
25855
- }
25828
+ originalLeavingAtom.rglabel = null;
25829
+ originalLeavingAtom.label = leavingAtom.label;
25830
+ this.originalStruct.calcImplicitHydrogen(originalLeavingAtomId);
25856
25831
  }
25857
25832
  }, {
25858
25833
  key: "saveNewMonomer",
25859
25834
  value: function saveNewMonomer(data) {
25860
- var _this4 = this,
25835
+ var _this3 = this,
25861
25836
  _this$originalSelecti;
25862
25837
  if (!this.monomerCreationState) {
25863
25838
  throw new Error('Monomer creation wizard is not active, cannot save new monomer');
@@ -25914,25 +25889,25 @@ var Editor$3 = function () {
25914
25889
  this.monomerCreationState.assignedAttachmentPoints.forEach(function (_ref11) {
25915
25890
  var _ref12 = _slicedToArray$1(_ref11, 2),
25916
25891
  leavingAtomId = _ref12[1];
25917
- return _this4.cleanupAttachmentPoint(leavingAtomId);
25892
+ return _this3.cleanupAttachmentPoint(leavingAtomId);
25918
25893
  });
25919
25894
  this.monomerCreationState.potentialAttachmentPoints.forEach(function (leavingAtomIds) {
25920
25895
  return Array.from(leavingAtomIds.values()).forEach(function (leavingAtomId) {
25921
- return _this4.cleanupAttachmentPoint(leavingAtomId);
25896
+ return _this3.cleanupAttachmentPoint(leavingAtomId);
25922
25897
  });
25923
25898
  });
25924
25899
  this.closeMonomerCreationWizard();
25925
25900
  (_this$originalSelecti = this.originalSelection.atoms) === null || _this$originalSelecti === void 0 || _this$originalSelecti.forEach(function (atomId) {
25926
- var atom = _this4.render.ctab.molecule.atoms.get(atomId);
25901
+ var atom = _this3.render.ctab.molecule.atoms.get(atomId);
25927
25902
  if (atom) {
25928
25903
  atom.fragment = -1;
25929
25904
  }
25930
25905
  });
25931
25906
  var sGroupAttachmentPoints = MacromoleculesConverter.convertMonomerAttachmentPointsToSGroupAttachmentPoints(monomer, this.selectedToOriginalAtomsIdMap);
25932
25907
  sGroupAttachmentPoints.forEach(function (ap) {
25933
- _this4.render.ctab.molecule.bonds.forEach(function (bond) {
25934
- var _this4$originalSelect, _this4$originalSelect2;
25935
- if ((bond.begin === ap.atomId || bond.end === ap.atomId) && (!((_this4$originalSelect = _this4.originalSelection.atoms) !== null && _this4$originalSelect !== void 0 && _this4$originalSelect.includes(bond.begin)) || !((_this4$originalSelect2 = _this4.originalSelection.atoms) !== null && _this4$originalSelect2 !== void 0 && _this4$originalSelect2.includes(bond.end)))) {
25908
+ _this3.render.ctab.molecule.bonds.forEach(function (bond) {
25909
+ var _this3$originalSelect, _this3$originalSelect2;
25910
+ if ((bond.begin === ap.atomId || bond.end === ap.atomId) && (!((_this3$originalSelect = _this3.originalSelection.atoms) !== null && _this3$originalSelect !== void 0 && _this3$originalSelect.includes(bond.begin)) || !((_this3$originalSelect2 = _this3.originalSelection.atoms) !== null && _this3$originalSelect2 !== void 0 && _this3$originalSelect2.includes(bond.end)))) {
25936
25911
  bond.beginSuperatomAttachmentPointNumber = ap.attachmentPointNumber;
25937
25912
  }
25938
25913
  });
@@ -26001,7 +25976,6 @@ var Editor$3 = function () {
26001
25976
  }, {
26002
25977
  key: "removeAttachmentPoint",
26003
25978
  value: function removeAttachmentPoint(name) {
26004
- var _this5 = this;
26005
25979
  assert_1(this.monomerCreationState);
26006
25980
  var atomPair = this.monomerCreationState.assignedAttachmentPoints.get(name);
26007
25981
  assert_1(atomPair);
@@ -26018,18 +25992,8 @@ var Editor$3 = function () {
26018
25992
  var action = fromOneBondDeletion(this.render.ctab, preservedBondId).mergeWith(fromOneAtomDeletion(this.render.ctab, preservedLeavingAtomId));
26019
25993
  this.update(action, true);
26020
25994
  }
26021
- this.preservedConnectionPointData["delete"](attachmentAtomId);
26022
- } else {
26023
- var leavingAtoms = this.findPotentialLeavingAtoms(attachmentAtomId);
26024
- var leavingAtomIdsSet = new Set();
26025
- leavingAtoms.forEach(function (atom) {
26026
- var atomId = _this5.struct().atoms.keyOf(atom);
26027
- if (atomId !== null) {
26028
- leavingAtomIdsSet.add(atomId);
26029
- }
26030
- });
26031
- this.monomerCreationState.potentialAttachmentPoints.set(attachmentAtomId, leavingAtomIdsSet);
26032
25995
  }
25996
+ this.preservedConnectionPointData["delete"](attachmentAtomId);
26033
25997
  this.monomerCreationState.assignedAttachmentPoints["delete"](name);
26034
25998
  this.monomerCreationState = Object.assign({}, this.monomerCreationState);
26035
25999
  this.render.update(true);
@@ -26078,7 +26042,7 @@ var Editor$3 = function () {
26078
26042
  }, {
26079
26043
  key: "findPotentialLeavingAtoms",
26080
26044
  value: function findPotentialLeavingAtoms(attachmentAtomId) {
26081
- var _this6 = this;
26045
+ var _this4 = this;
26082
26046
  var bondsToOutside = this.struct().bonds.filter(function (_, bond) {
26083
26047
  return attachmentAtomId === bond.begin && attachmentAtomId !== bond.end || attachmentAtomId === bond.end && attachmentAtomId !== bond.begin;
26084
26048
  });
@@ -26088,7 +26052,7 @@ var Editor$3 = function () {
26088
26052
  return;
26089
26053
  }
26090
26054
  var atomIdToUse = attachmentAtomId === bond.begin ? bond.end : bond.begin;
26091
- var atom = _this6.struct().atoms.get(atomIdToUse);
26055
+ var atom = _this4.struct().atoms.get(atomIdToUse);
26092
26056
  assert_1(atom);
26093
26057
  if (atom.neighbors.length === 1) {
26094
26058
  potentialLeavingAtoms.push(atom);
@@ -26099,15 +26063,15 @@ var Editor$3 = function () {
26099
26063
  }, {
26100
26064
  key: "subscribeToChangeEventInMonomerCreationWizard",
26101
26065
  value: function subscribeToChangeEventInMonomerCreationWizard() {
26102
- var _this7 = this;
26066
+ var _this5 = this;
26103
26067
  if (this.changeEventSubscriber) {
26104
26068
  return;
26105
26069
  }
26106
26070
  var handleChangeEvent = function handleChangeEvent(data) {
26107
- if (!_this7.isMonomerCreationWizardActive || data.length === 0) {
26071
+ if (!_this5.isMonomerCreationWizardActive || data.length === 0) {
26108
26072
  return;
26109
26073
  }
26110
- _this7.collectChangesForMonomerCreationStateInvalidation(data);
26074
+ _this5.collectChangesForMonomerCreationStateInvalidation(data);
26111
26075
  };
26112
26076
  this.changeEventSubscriber = this.subscribe('change', handleChangeEvent);
26113
26077
  }
@@ -26150,7 +26114,7 @@ var Editor$3 = function () {
26150
26114
  }, {
26151
26115
  key: "invalidateMonomerCreationWizardState",
26152
26116
  value: function invalidateMonomerCreationWizardState(changesMap) {
26153
- var _this8 = this;
26117
+ var _this6 = this;
26154
26118
  if (!this.monomerCreationState) {
26155
26119
  return;
26156
26120
  }
@@ -26164,7 +26128,7 @@ var Editor$3 = function () {
26164
26128
  switch (operation) {
26165
26129
  case OperationType.ATOM_DELETE:
26166
26130
  {
26167
- var attachmentPointsToInvalidate = Array.from(_this8.monomerCreationState.assignedAttachmentPoints.entries()).filter(function (_ref13) {
26131
+ var attachmentPointsToInvalidate = Array.from(_this6.monomerCreationState.assignedAttachmentPoints.entries()).filter(function (_ref13) {
26168
26132
  var _ref14 = _slicedToArray$1(_ref13, 2),
26169
26133
  atomPair = _ref14[1];
26170
26134
  return ids.has(atomPair[0]) || ids.has(atomPair[1]);
@@ -26180,39 +26144,18 @@ var Editor$3 = function () {
26180
26144
  attachmentAtomId = _atomPair4[0],
26181
26145
  leavingAtomId = _atomPair4[1];
26182
26146
  if (ids.has(attachmentAtomId)) {
26183
- var _this8$monomerCreatio;
26184
- (_this8$monomerCreatio = _this8.monomerCreationState) === null || _this8$monomerCreatio === void 0 || _this8$monomerCreatio.assignedAttachmentPoints["delete"](attachmentPointName);
26147
+ var _this6$monomerCreatio;
26148
+ (_this6$monomerCreatio = _this6.monomerCreationState) === null || _this6$monomerCreatio === void 0 || _this6$monomerCreatio.assignedAttachmentPoints["delete"](attachmentPointName);
26185
26149
  } else if (ids.has(leavingAtomId)) {
26186
- var potentialLeavingAtoms = _this8.findPotentialLeavingAtoms(attachmentAtomId);
26150
+ var potentialLeavingAtoms = _this6.findPotentialLeavingAtoms(attachmentAtomId);
26187
26151
  if (potentialLeavingAtoms.length === 0) {
26188
- var _this8$monomerCreatio2;
26189
- (_this8$monomerCreatio2 = _this8.monomerCreationState) === null || _this8$monomerCreatio2 === void 0 || _this8$monomerCreatio2.assignedAttachmentPoints["delete"](attachmentPointName);
26152
+ var _this6$monomerCreatio2;
26153
+ (_this6$monomerCreatio2 = _this6.monomerCreationState) === null || _this6$monomerCreatio2 === void 0 || _this6$monomerCreatio2.assignedAttachmentPoints["delete"](attachmentPointName);
26190
26154
  } else {
26191
- var _this8$monomerCreatio3;
26192
- var newLeavingAtomId = _this8.struct().atoms.keyOf(potentialLeavingAtoms[0]);
26155
+ var _this6$monomerCreatio3;
26156
+ var newLeavingAtomId = _this6.struct().atoms.keyOf(potentialLeavingAtoms[0]);
26193
26157
  assert_1(newLeavingAtomId !== null);
26194
- (_this8$monomerCreatio3 = _this8.monomerCreationState) === null || _this8$monomerCreatio3 === void 0 || _this8$monomerCreatio3.assignedAttachmentPoints.set(attachmentPointName, [attachmentAtomId, newLeavingAtomId]);
26195
- }
26196
- }
26197
- });
26198
- var potentialAttachmentPointsToInvalidate = Array.from(_this8.monomerCreationState.potentialAttachmentPoints.entries());
26199
- potentialAttachmentPointsToInvalidate.forEach(function (_ref17) {
26200
- var _ref18 = _slicedToArray$1(_ref17, 2),
26201
- attachmentAtomId = _ref18[0],
26202
- leavingAtomIds = _ref18[1];
26203
- if (ids.has(attachmentAtomId)) {
26204
- var _this8$monomerCreatio4;
26205
- (_this8$monomerCreatio4 = _this8.monomerCreationState) === null || _this8$monomerCreatio4 === void 0 || _this8$monomerCreatio4.potentialAttachmentPoints["delete"](attachmentAtomId);
26206
- } else {
26207
- var updatedLeavingAtomIds = new Set(Array.from(leavingAtomIds).filter(function (id) {
26208
- return !ids.has(id);
26209
- }));
26210
- if (updatedLeavingAtomIds.size === 0) {
26211
- var _this8$monomerCreatio5;
26212
- (_this8$monomerCreatio5 = _this8.monomerCreationState) === null || _this8$monomerCreatio5 === void 0 || _this8$monomerCreatio5.potentialAttachmentPoints["delete"](attachmentAtomId);
26213
- } else {
26214
- var _this8$monomerCreatio6;
26215
- (_this8$monomerCreatio6 = _this8.monomerCreationState) === null || _this8$monomerCreatio6 === void 0 || _this8$monomerCreatio6.potentialAttachmentPoints.set(attachmentAtomId, updatedLeavingAtomIds);
26158
+ (_this6$monomerCreatio3 = _this6.monomerCreationState) === null || _this6$monomerCreatio3 === void 0 || _this6$monomerCreatio3.assignedAttachmentPoints.set(attachmentPointName, [attachmentAtomId, newLeavingAtomId]);
26216
26159
  }
26217
26160
  }
26218
26161
  });
@@ -26225,40 +26168,24 @@ var Editor$3 = function () {
26225
26168
  try {
26226
26169
  var _loop2 = function _loop2() {
26227
26170
  var id = _step3.value;
26228
- var bond = _this8.struct().bonds.get(id);
26171
+ var bond = _this6.struct().bonds.get(id);
26229
26172
  assert_1(bond);
26230
- var attachmentPointWithBond = Array.from(_this8.monomerCreationState.assignedAttachmentPoints.entries()).find(function (_ref19) {
26231
- var _ref20 = _slicedToArray$1(_ref19, 2),
26232
- atomPair = _ref20[1];
26173
+ var attachmentPointWithBond = Array.from(_this6.monomerCreationState.assignedAttachmentPoints.entries()).find(function (_ref17) {
26174
+ var _ref18 = _slicedToArray$1(_ref17, 2),
26175
+ atomPair = _ref18[1];
26233
26176
  return bond.begin === atomPair[0] && bond.end === atomPair[1] || bond.begin === atomPair[1] && bond.end === atomPair[0];
26234
26177
  });
26235
- if (attachmentPointWithBond) {
26236
- if (bond.type !== Bond$2.PATTERN.TYPE.SINGLE || bond.stereo !== Bond$2.PATTERN.STEREO.NONE) {
26237
- _this8.monomerCreationState.problematicAttachmentPoints.add(attachmentPointWithBond[0]);
26238
- } else {
26239
- _this8.monomerCreationState.problematicAttachmentPoints["delete"](attachmentPointWithBond[0]);
26240
- }
26178
+ if (!attachmentPointWithBond) {
26179
+ return 1;
26241
26180
  }
26242
26181
  if (bond.type !== Bond$2.PATTERN.TYPE.SINGLE || bond.stereo !== Bond$2.PATTERN.STEREO.NONE) {
26243
- _this8.monomerCreationState.potentialAttachmentPoints.forEach(function (leavingAtomIds, attachmentAtomId) {
26244
- var updatedLeavingAtomIds = new Set(leavingAtomIds);
26245
- var bondFromAttachmentAtom = bond.begin === attachmentAtomId && leavingAtomIds.has(bond.end);
26246
- var bondToAttachmentAtom = bond.end === attachmentAtomId && leavingAtomIds.has(bond.begin);
26247
- if (bondFromAttachmentAtom || bondToAttachmentAtom) {
26248
- updatedLeavingAtomIds["delete"](bondFromAttachmentAtom ? bond.end : bond.begin);
26249
- }
26250
- if (updatedLeavingAtomIds.size === 0) {
26251
- var _this8$monomerCreatio7;
26252
- (_this8$monomerCreatio7 = _this8.monomerCreationState) === null || _this8$monomerCreatio7 === void 0 || _this8$monomerCreatio7.potentialAttachmentPoints["delete"](attachmentAtomId);
26253
- } else {
26254
- var _this8$monomerCreatio8;
26255
- (_this8$monomerCreatio8 = _this8.monomerCreationState) === null || _this8$monomerCreatio8 === void 0 || _this8$monomerCreatio8.potentialAttachmentPoints.set(attachmentAtomId, updatedLeavingAtomIds);
26256
- }
26257
- });
26182
+ _this6.monomerCreationState.problematicAttachmentPoints.add(attachmentPointWithBond[0]);
26183
+ } else {
26184
+ _this6.monomerCreationState.problematicAttachmentPoints["delete"](attachmentPointWithBond[0]);
26258
26185
  }
26259
26186
  };
26260
26187
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
26261
- _loop2();
26188
+ if (_loop2()) continue;
26262
26189
  }
26263
26190
  } catch (err) {
26264
26191
  _iterator3.e(err);
@@ -26274,44 +26201,23 @@ var Editor$3 = function () {
26274
26201
  try {
26275
26202
  var _loop3 = function _loop3() {
26276
26203
  var id = _step4.value;
26277
- var bond = _this8.struct().bonds.get(id);
26204
+ var bond = _this6.struct().bonds.get(id);
26278
26205
  assert_1(bond);
26279
- var attachmentPointWithBondToLeavingAtom = Array.from(_this8.monomerCreationState.assignedAttachmentPoints.entries()).find(function (_ref21) {
26280
- var _ref22 = _slicedToArray$1(_ref21, 2),
26281
- _ref22$ = _slicedToArray$1(_ref22[1], 2),
26282
- leavingAtomId = _ref22$[1];
26206
+ var attachmentPointWithBondToLeavingAtom = Array.from(_this6.monomerCreationState.assignedAttachmentPoints.entries()).find(function (_ref19) {
26207
+ var _ref20 = _slicedToArray$1(_ref19, 2),
26208
+ _ref20$ = _slicedToArray$1(_ref20[1], 2),
26209
+ leavingAtomId = _ref20$[1];
26283
26210
  return bond.begin === leavingAtomId || bond.end === leavingAtomId;
26284
26211
  });
26285
- if (attachmentPointWithBondToLeavingAtom) {
26286
- var _attachmentPointWithB = _slicedToArray$1(attachmentPointWithBondToLeavingAtom, 1),
26287
- attachmentPointName = _attachmentPointWithB[0];
26288
- _this8.monomerCreationState.assignedAttachmentPoints["delete"](attachmentPointName);
26289
- }
26290
- if (bond.type === Bond$2.PATTERN.TYPE.SINGLE && bond.stereo === Bond$2.PATTERN.STEREO.NONE) {
26291
- if (_this8.monomerCreationState.potentialAttachmentPoints.has(bond.begin)) {
26292
- var leavingAtomIds = _this8.monomerCreationState.potentialAttachmentPoints.get(bond.begin);
26293
- assert_1(leavingAtomIds);
26294
- var endAtom = _this8.struct().atoms.get(bond.end);
26295
- if (endAtom && endAtom.neighbors.length === 1) {
26296
- var updatedLeavingAtomIds = new Set(leavingAtomIds);
26297
- updatedLeavingAtomIds.add(bond.end);
26298
- _this8.monomerCreationState.potentialAttachmentPoints.set(bond.begin, updatedLeavingAtomIds);
26299
- }
26300
- }
26301
- if (_this8.monomerCreationState.potentialAttachmentPoints.has(bond.end)) {
26302
- var _leavingAtomIds = _this8.monomerCreationState.potentialAttachmentPoints.get(bond.end);
26303
- assert_1(_leavingAtomIds);
26304
- var beginAtom = _this8.struct().atoms.get(bond.begin);
26305
- if (beginAtom && beginAtom.neighbors.length === 1) {
26306
- var _updatedLeavingAtomIds = new Set(_leavingAtomIds);
26307
- _updatedLeavingAtomIds.add(bond.begin);
26308
- _this8.monomerCreationState.potentialAttachmentPoints.set(bond.end, _updatedLeavingAtomIds);
26309
- }
26310
- }
26212
+ if (!attachmentPointWithBondToLeavingAtom) {
26213
+ return 1;
26311
26214
  }
26215
+ var _attachmentPointWithB = _slicedToArray$1(attachmentPointWithBondToLeavingAtom, 1),
26216
+ attachmentPointName = _attachmentPointWithB[0];
26217
+ _this6.monomerCreationState.assignedAttachmentPoints["delete"](attachmentPointName);
26312
26218
  };
26313
26219
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
26314
- _loop3();
26220
+ if (_loop3()) continue;
26315
26221
  }
26316
26222
  } catch (err) {
26317
26223
  _iterator4.e(err);
@@ -26686,17 +26592,6 @@ var Editor$3 = function () {
26686
26592
  }
26687
26593
  return visited.size === atomIds.length;
26688
26594
  }
26689
- }, {
26690
- key: "isStructureImpure",
26691
- value: function isStructureImpure(struct) {
26692
- var atoms = struct.atoms,
26693
- sgroups = struct.sgroups,
26694
- rgroups = struct.rgroups,
26695
- functionalGroups = struct.functionalGroups;
26696
- return sgroups.size > 0 || rgroups.size > 0 || functionalGroups.size > 0 || Array.from(atoms.values()).some(function (atom) {
26697
- return genericsList.includes(atom.label);
26698
- });
26699
- }
26700
26595
  }]);
26701
26596
  return Editor;
26702
26597
  }();
@@ -26772,10 +26667,10 @@ function domEventSetup(editor, clientArea) {
26772
26667
  eventName: 'mouseover',
26773
26668
  toolEventHandler: 'mouseover'
26774
26669
  }];
26775
- trackedDomEvents.forEach(function (_ref23) {
26776
- var target = _ref23.target,
26777
- eventName = _ref23.eventName,
26778
- toolEventHandler = _ref23.toolEventHandler;
26670
+ trackedDomEvents.forEach(function (_ref21) {
26671
+ var target = _ref21.target,
26672
+ eventName = _ref21.eventName,
26673
+ toolEventHandler = _ref21.toolEventHandler;
26779
26674
  editor.event[eventName] = new DOMSubscription();
26780
26675
  var subs = editor.event[eventName];
26781
26676
  target.addEventListener(eventName, function () {
@@ -29481,11 +29376,9 @@ var useAttachmentPointSelectsData = function useAttachmentPointSelectsData(edito
29481
29376
  leavingAtomId = _atomPair[1];
29482
29377
  var attachmentAtom = editor.struct().atoms.get(attachmentAtomId);
29483
29378
  assert_1(attachmentAtom);
29484
- var usedNumbers = Array.from(assignedAttachmentPoints.keys()).map(function (name) {
29379
+ var attachmentPointNameOptionsLength = Math.max.apply(Math, _toConsumableArray(Array.from(assignedAttachmentPoints.keys()).map(function (name) {
29485
29380
  return getAttachmentPointNumberFromLabel(name);
29486
- });
29487
- var maxUsedNumber = Math.max.apply(Math, _toConsumableArray(usedNumbers));
29488
- var attachmentPointNameOptionsLength = maxUsedNumber <= 3 ? 3 : Math.min(maxUsedNumber, 8);
29381
+ })));
29489
29382
  var nameOptions = Array.from({
29490
29383
  length: attachmentPointNameOptionsLength
29491
29384
  }).map(function (_, i) {
@@ -29645,9 +29538,7 @@ var NotificationMessages = {
29645
29538
  noAttachmentPoints: 'The monomer must have at least one attachment point.',
29646
29539
  incorrectAttachmentPointsOrder: 'Attachment point numbers must be in order, but R1 and R2 may be skipped.',
29647
29540
  creationSuccessful: 'The monomer was successfully added to the library.',
29648
- incontinuousStructure: 'All monomers must have a continuous structure.',
29649
- notMinimalViableStructure: 'Minimal monomer structure is two atoms connected via a single bond.',
29650
- impureStructure: 'Monomer structure cannot contain S-groups, R-groups, special atoms, or any other query properties.'
29541
+ incontinuousStructure: 'All monomers must have a continuous structure.'
29651
29542
  };
29652
29543
  var NotificationTypes = {
29653
29544
  defaultAttachmentPoints: 'info',
@@ -29658,9 +29549,7 @@ var NotificationTypes = {
29658
29549
  noAttachmentPoints: 'error',
29659
29550
  incorrectAttachmentPointsOrder: 'error',
29660
29551
  creationSuccessful: 'info',
29661
- incontinuousStructure: 'error',
29662
- notMinimalViableStructure: 'error',
29663
- impureStructure: 'error'
29552
+ incontinuousStructure: 'error'
29664
29553
  };
29665
29554
  var MonomerCreationExternalNotificationAction = 'MonomerCreationExternalNotification';
29666
29555
 
@@ -29915,21 +29804,6 @@ var validateAttachmentPoints = function validateAttachmentPoints(attachmentPoint
29915
29804
  };
29916
29805
  var validateStructure = function validateStructure(editor) {
29917
29806
  var notifications = new Map();
29918
- var isStructureImpure = Editor$3.isStructureImpure(editor.struct());
29919
- if (isStructureImpure) {
29920
- notifications.set('impureStructure', {
29921
- type: 'error',
29922
- message: NotificationMessages.impureStructure
29923
- });
29924
- }
29925
- var isMinimalViableStructure = editor.isMinimalViableStructure();
29926
- if (!isMinimalViableStructure) {
29927
- notifications.set('notMinimalViableStructure', {
29928
- type: 'error',
29929
- message: NotificationMessages.notMinimalViableStructure
29930
- });
29931
- return notifications;
29932
- }
29933
29807
  var isStructureContinuous = Editor$3.isStructureContinuous(editor.struct());
29934
29808
  if (!isStructureContinuous) {
29935
29809
  notifications.set('incontinuousStructure', {
@@ -31768,7 +31642,7 @@ var OpenButton = function (_Component) {
31768
31642
 
31769
31643
  var fileSaver = function fileSaver(server) {
31770
31644
  return new Promise(function (resolve, reject) {
31771
- if (global.Blob && saveAs) {
31645
+ if (globalThis.Blob && saveAs) {
31772
31646
  resolve(function (data, fn, type) {
31773
31647
  var blob = new Blob([data], {
31774
31648
  type: type
@@ -36767,11 +36641,6 @@ var TemplateDialog = function TemplateDialog(props) {
36767
36641
  onTabChange(initialTab);
36768
36642
  }
36769
36643
  }, [initialTab, onTabChange]);
36770
- useEffect(function () {
36771
- if (isMonomerCreationWizardActive && tab === TemplateTabs.FunctionalGroupLibrary) {
36772
- onTabChange(TemplateTabs.TemplateLibrary);
36773
- }
36774
- }, [isMonomerCreationWizardActive, tab, onTabChange]);
36775
36644
  var handleAccordionChange = function handleAccordionChange(accordion) {
36776
36645
  return function (_, isExpanded) {
36777
36646
  setExpandedAccordions(isExpanded ? [].concat(_toConsumableArray(expandedAccordions), [accordion]) : _toConsumableArray(expandedAccordions).filter(function (expandedAccordion) {
@@ -37979,12 +37848,12 @@ var AbbreviationLookup = function AbbreviationLookup(_ref) {
37979
37848
  });
37980
37849
  },
37981
37850
  renderOption: function renderOption(props, option) {
37982
- return createElement("li", _objectSpread$2(_objectSpread$2({}, props), {}, {
37851
+ return jsx("li", _objectSpread$2(_objectSpread$2({}, props), {}, {
37983
37852
  title: option.label,
37984
- key: option.label
37985
- }), jsx("div", {
37986
- className: classes.optionItemContent,
37987
- children: highlightOptionLabel(option, loweredLookupValue)
37853
+ children: jsx("div", {
37854
+ className: classes.optionItemContent,
37855
+ children: highlightOptionLabel(option, loweredLookupValue)
37856
+ })
37988
37857
  }));
37989
37858
  },
37990
37859
  "data-testid": ABBREVIATION_LOOKUP_TEST_ID
@@ -38262,8 +38131,8 @@ var KetcherBuilder = function () {
38262
38131
  cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
38263
38132
  buttons: buttons || {},
38264
38133
  errorHandler: errorHandler || null,
38265
- version: "3.9.0-rc.2" ,
38266
- buildDate: "2025-10-16T18:57:23" ,
38134
+ version: "3.10.0-build.2" ,
38135
+ buildDate: "2025-10-17T10:35:38" ,
38267
38136
  buildNumber: '',
38268
38137
  customButtons: customButtons || []
38269
38138
  }, structService, resolve, togglerComponent);
@@ -38558,7 +38427,7 @@ var ModeControl = function ModeControl(_ref3) {
38558
38427
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
38559
38428
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
38560
38429
  var MacromoleculesEditorComponent = lazy(function () {
38561
- return import('./index.modern-87b29a80.js');
38430
+ return import('./index.modern-68c23873.js');
38562
38431
  });
38563
38432
  var Editor = function Editor(props) {
38564
38433
  var _useState = useState(false),