ketcher-react 3.8.0-rc.2 → 3.8.0-rc.3

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.
@@ -111,6 +111,8 @@ declare class Editor implements KetcherEditor {
111
111
  reassignAttachmentPointAtom(atomId: number, atomLabel: string): void;
112
112
  reassignAttachmentPoint(currentName: AttachmentPointName, newName: AttachmentPointName): void;
113
113
  removeAttachmentPoint(name: AttachmentPointName): void;
114
+ cleanupCloseAttachmentPointEditPopup(): void;
115
+ setProblematicAttachmentPoints(problematicPoints: Set<AttachmentPointName>): void;
114
116
  selection(ci?: any): Selection | null;
115
117
  hover(ci: {
116
118
  id: number;
@@ -2,6 +2,7 @@ import { AttachmentPointName } from 'ketcher-core';
2
2
  declare type Props = {
3
3
  name: AttachmentPointName;
4
4
  atomLabel: string;
5
+ implicitH: number;
5
6
  };
6
- declare const AttachmentPoint: ({ name, atomLabel }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ declare const AttachmentPoint: ({ name, atomLabel, implicitH }: Props) => import("react/jsx-runtime").JSX.Element;
7
8
  export default AttachmentPoint;
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import 'url-search-params-polyfill';
27
27
  import 'whatwg-fetch';
28
28
  import _classCallCheck$2 from '@babel/runtime/helpers/classCallCheck';
29
29
  import _createClass$2 from '@babel/runtime/helpers/createClass';
30
- import { KetSerializer, MolSerializer, KetcherLogger, ketcherProvider, defaultBondThickness, isClipboardAPIAvailable, notifyCopyCut, notifyRequestCompleted, isControlKey, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SettingsManager, SdfSerializer, KETCHER_SAVED_OPTIONS_KEY, SUPERATOM_CLASS, Bond as Bond$2, Elements, AtomList, getAtomType, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, MULTITAIL_ARROW_TOOL_NAME, CREATE_MONOMER_TOOL_NAME, SimpleObjectMode, IMAGE_KEY, SGroup as SGroup$1, identifyStructFormat, SupportedFormat, FormatterFactory, MULTITAIL_ARROW_KEY, ChemicalMimeType, RenderStruct, Struct, ZoomTool, KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR, shortcutStr, MonomerMicromolecule, UnresolvedMonomer, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, generateMenuShortcuts, Vec2, Scale, fromMultipleMove, FunctionalGroup, mergeMapOfItemsToSet, fromSgroupDeletion, fromFragmentDeletion, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, Pile, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, imageReferencePositionToCursor, multitailArrowReferenceLinesToCursor, multitailReferencePositionToCursor, CoordinateTransformation, MultitailArrowRefName, fromMultitailArrowHeadTailMove, fromMultitailArrowHeadTailsResize, fromMultitailArrowMove, fromArrowResizing, fromPaste, fromImageResize, fromSimpleObjectResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, fromTemplateOnCanvas, fromTemplateOnBondAction, fromTemplateOnAtom, BondAttr, AtomAttr, formatProperties, runAsyncAction, getStructStringFromClipboardData, getStructure, initHotKeys, keyNorm, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, removeInfoLabelFromAtoms, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, fromImageDeletion, fromMultitailArrowDeletion, notifyItemsToMergeInitializationComplete, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromMultitailArrowCreation, fromPlusAddition, getRelSGroupsBySelection, RotateMonomerOperation, fromRotate, fromFlip, fromSimpleObjectAddition, fromTextCreation, fromImageMove, fromImageCreation, fromHighlightCreate, fromHighlightClear, getOptionsWithConvertedUnits, provideEditorSettings, fromNewCanvas, Render, Coordinates, genericsList, getAttachmentPointLabel, getNextFreeAttachmentPoint, AttachmentPointName, setMonomerTemplatePrefix, getHELMClassByKetMonomerClass, fillNaturalAnalogueForPhosphateAndSugar, KetTemplateType, normalizeMonomerAtomsPositions, monomerFactory, MacromoleculesConverter, fromSgroupAddition, fromDescriptorsAlign, MonomerCreationAttachmentPointClickEvent, atomGetAttr, fromBondFlipping, setExpandMonomerSGroup, fromMultitailArrowTailAdd, MultitailArrow, fromMultitailArrowTailRemove, AmbiguousMonomer, KetMonomerClass, AtomLabel, CoreEditor, getAttachmentPointNumberFromLabel, getAtomCustomQuery, getFormatMimeTypeByFileName, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, legacyCopy as legacyCopy$1, b64toBlob, Generics, TextCommand, Ketcher, DefaultStructServiceOptions } from 'ketcher-core';
30
+ import { KetSerializer, MolSerializer, KetcherLogger, ketcherProvider, defaultBondThickness, isClipboardAPIAvailable, notifyCopyCut, notifyRequestCompleted, isControlKey, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SettingsManager, SdfSerializer, KETCHER_SAVED_OPTIONS_KEY, SUPERATOM_CLASS, Bond as Bond$2, Elements, AtomList, getAtomType, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, MULTITAIL_ARROW_TOOL_NAME, CREATE_MONOMER_TOOL_NAME, SimpleObjectMode, IMAGE_KEY, SGroup as SGroup$1, identifyStructFormat, SupportedFormat, FormatterFactory, MULTITAIL_ARROW_KEY, ChemicalMimeType, RenderStruct, Struct, ZoomTool, KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR, shortcutStr, MonomerMicromolecule, UnresolvedMonomer, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, generateMenuShortcuts, Vec2, Scale, fromMultipleMove, FunctionalGroup, mergeMapOfItemsToSet, fromSgroupDeletion, fromFragmentDeletion, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, Pile, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, imageReferencePositionToCursor, multitailArrowReferenceLinesToCursor, multitailReferencePositionToCursor, CoordinateTransformation, MultitailArrowRefName, fromMultitailArrowHeadTailMove, fromMultitailArrowHeadTailsResize, fromMultitailArrowMove, fromArrowResizing, fromPaste, fromImageResize, fromSimpleObjectResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, fromTemplateOnCanvas, fromTemplateOnBondAction, fromTemplateOnAtom, BondAttr, AtomAttr, formatProperties, runAsyncAction, getStructStringFromClipboardData, getStructure, initHotKeys, keyNorm, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, removeInfoLabelFromAtoms, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, fromImageDeletion, fromMultitailArrowDeletion, notifyItemsToMergeInitializationComplete, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromMultitailArrowCreation, fromPlusAddition, getRelSGroupsBySelection, RotateMonomerOperation, fromRotate, fromFlip, fromSimpleObjectAddition, fromTextCreation, fromImageMove, fromImageCreation, fromHighlightCreate, fromHighlightClear, getOptionsWithConvertedUnits, provideEditorSettings, fromNewCanvas, Render, Coordinates, isSingleRGroupAttachmentPoint, genericsList, getAttachmentPointLabelWithBinaryShift, AttachmentPointName, getAttachmentPointLabel, getAttachmentPointNumberFromLabel, getNextFreeAttachmentPoint, AtomLabel, setMonomerTemplatePrefix, getHELMClassByKetMonomerClass, fillNaturalAnalogueForPhosphateAndSugar, KetTemplateType, normalizeMonomerAtomsPositions, monomerFactory, MacromoleculesConverter, fromSgroupAddition, fromDescriptorsAlign, MonomerCreationAttachmentPointClickEvent, atomGetAttr, fromBondFlipping, setExpandMonomerSGroup, fromMultitailArrowTailAdd, MultitailArrow, fromMultitailArrowTailRemove, AmbiguousMonomer, KetMonomerClass, CoreEditor, getAtomCustomQuery, getFormatMimeTypeByFileName, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, legacyCopy as legacyCopy$1, b64toBlob, Generics, TextCommand, Ketcher, DefaultStructServiceOptions } from 'ketcher-core';
31
31
  export { EditorClassName, KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR } from 'ketcher-core';
32
32
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
33
33
  import _possibleConstructorReturn$2 from '@babel/runtime/helpers/possibleConstructorReturn';
@@ -3787,7 +3787,7 @@ var zoom = {
3787
3787
 
3788
3788
  var openHelpLink = function openHelpLink() {
3789
3789
  var _window$open;
3790
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.8.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3790
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.8.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3791
3791
  };
3792
3792
  var help = {
3793
3793
  help: {
@@ -24268,8 +24268,9 @@ var HoverIcon = function () {
24268
24268
  }, {
24269
24269
  key: "isOverLoader",
24270
24270
  value: function isOverLoader(event) {
24271
+ var _target$classList;
24271
24272
  var target = (event === null || event === void 0 ? void 0 : event.relatedTarget) || event.target;
24272
- return target === null || target === void 0 ? void 0 : target.classList.contains('loading-spinner');
24273
+ return target === null || target === void 0 || (_target$classList = target.classList) === null || _target$classList === void 0 ? void 0 : _target$classList.contains('loading-spinner');
24273
24274
  }
24274
24275
  }, {
24275
24276
  key: "onMouseMove",
@@ -25343,9 +25344,20 @@ var Editor$3 = function () {
25343
25344
  var selectionInvalid = selection.atoms.some(function (atomId) {
25344
25345
  var atom = _this.render.ctab.molecule.atoms.get(atomId);
25345
25346
  assert_1(atom);
25346
- return atom.sgs.size > 0 || atom.attachmentPoints !== null || atom.rglabel !== null && atom.neighbors.length > 1 || _this.render.ctab.molecule.rgroups.some(function (rgroup) {
25347
+ var sgs = atom.sgs,
25348
+ attachmentPoints = atom.attachmentPoints,
25349
+ rglabel = atom.rglabel,
25350
+ neighbors = atom.neighbors,
25351
+ label = atom.label;
25352
+ var belongsToSGroup = sgs.size > 0;
25353
+ var isAttachmentPoint = attachmentPoints !== null;
25354
+ var isNonTerminalRGroupLabel = rglabel !== null && neighbors.length > 1;
25355
+ var hasMultipleRGroupLabel = rglabel !== null && !isSingleRGroupAttachmentPoint(Number(rglabel));
25356
+ var belongsToRGroup = _this.render.ctab.molecule.rgroups.some(function (rgroup) {
25347
25357
  return rgroup.frags.has(atom.fragment);
25348
- }) || genericsList.includes(atom.label);
25358
+ });
25359
+ var isExtendedTableAtom = genericsList.includes(label);
25360
+ return belongsToSGroup || isAttachmentPoint || isNonTerminalRGroupLabel || hasMultipleRGroupLabel || belongsToRGroup || isExtendedTableAtom;
25349
25361
  });
25350
25362
  if (selectionInvalid) {
25351
25363
  return false;
@@ -25374,11 +25386,24 @@ var Editor$3 = function () {
25374
25386
  potentialLeavingAtoms.push(bond.begin);
25375
25387
  }
25376
25388
  });
25389
+ selectionAtoms.forEach(function (selectionAtomId) {
25390
+ var selectionAtom = currentStruct.atoms.get(selectionAtomId);
25391
+ assert_1(selectionAtom);
25392
+ if (selectionAtom.neighbors.length === 1 && !isNumber(selectionAtom.rglabel)) {
25393
+ potentialLeavingAtoms.push(selectionAtomId);
25394
+ }
25395
+ });
25377
25396
  var totalPotentialLeavingAtoms = terminalRGroupAtoms.length + potentialLeavingAtoms.length;
25378
25397
  if (totalPotentialLeavingAtoms > 8) {
25379
25398
  return false;
25380
25399
  }
25381
- this.terminalRGroupAtoms = terminalRGroupAtoms;
25400
+ this.terminalRGroupAtoms = terminalRGroupAtoms.map(function (atomId) {
25401
+ var atom = currentStruct.atoms.get(atomId);
25402
+ assert_1(atom);
25403
+ assert_1(atom.rglabel);
25404
+ var attachmentPointLabel = getAttachmentPointLabelWithBinaryShift(Number(atom.rglabel));
25405
+ return [atomId, attachmentPointLabel];
25406
+ });
25382
25407
  this.potentialLeavingAtoms = potentialLeavingAtoms;
25383
25408
  return terminalRGroupAtoms.length > 0 || potentialLeavingAtoms.length > 0;
25384
25409
  }
@@ -25403,21 +25428,54 @@ var Editor$3 = function () {
25403
25428
  _this2.selectedToOriginalAtomsIdMap.set(i, atomId);
25404
25429
  });
25405
25430
  var assignedAttachmentPoints = new Map();
25406
- this.terminalRGroupAtoms.forEach(function (atomId, i) {
25431
+ var sideTerminalSGroupAtoms = this.terminalRGroupAtoms.filter(function (_ref) {
25432
+ var _ref2 = _slicedToArray$1(_ref, 2),
25433
+ attachmentPointLabel = _ref2[1];
25434
+ return attachmentPointLabel !== AttachmentPointName.R1 && attachmentPointLabel !== AttachmentPointName.R2;
25435
+ });
25436
+ var sideAttachmentPointsNames = [];
25437
+ for (var i = 0; i < sideTerminalSGroupAtoms.length; i++) {
25438
+ var attachmentPointNumber = i + 3;
25439
+ if (attachmentPointNumber > 8) {
25440
+ break;
25441
+ }
25442
+ sideAttachmentPointsNames = sideAttachmentPointsNames.concat(getAttachmentPointLabel(attachmentPointNumber));
25443
+ }
25444
+ var terminalRGroupAtomsSortedByLabel = _toConsumableArray(this.terminalRGroupAtoms).sort(function (_ref3, _ref4) {
25445
+ var _ref5 = _slicedToArray$1(_ref3, 2),
25446
+ labelA = _ref5[1];
25447
+ var _ref6 = _slicedToArray$1(_ref4, 2),
25448
+ labelB = _ref6[1];
25449
+ var labelANumber = getAttachmentPointNumberFromLabel(labelA);
25450
+ var labelBNumber = getAttachmentPointNumberFromLabel(labelB);
25451
+ return labelANumber - labelBNumber;
25452
+ });
25453
+ terminalRGroupAtomsSortedByLabel.forEach(function (_ref7) {
25407
25454
  var _selectedStruct$halfB;
25455
+ var _ref8 = _slicedToArray$1(_ref7, 2),
25456
+ atomId = _ref8[0],
25457
+ attachmentPointLabel = _ref8[1];
25408
25458
  var selectedStructLeavingAtomId = originalToSelectedAtomsIdMap.get(atomId);
25409
25459
  assert_1(selectedStructLeavingAtomId !== undefined);
25410
25460
  var selectedStructLeavingAtom = selectedStruct.atoms.get(selectedStructLeavingAtomId);
25411
25461
  assert_1(selectedStructLeavingAtom);
25462
+ assert_1(selectedStructLeavingAtom.rglabel);
25463
+ var attachmentPointName;
25464
+ if (attachmentPointLabel === AttachmentPointName.R1 || attachmentPointLabel === AttachmentPointName.R2 || sideAttachmentPointsNames.includes(attachmentPointLabel)) {
25465
+ attachmentPointName = attachmentPointLabel;
25466
+ } else {
25467
+ var assignedAttachmentPointNames = Array.from(assignedAttachmentPoints.keys());
25468
+ attachmentPointName = getNextFreeAttachmentPoint(assignedAttachmentPointNames, assignedAttachmentPointNames.length < sideAttachmentPointsNames.length);
25469
+ }
25412
25470
  selectedStructLeavingAtom.rglabel = null;
25413
- selectedStructLeavingAtom.label = 'H';
25471
+ selectedStructLeavingAtom.label = AtomLabel.H;
25414
25472
  var neighborHalfBondId = selectedStructLeavingAtom.neighbors[0];
25415
25473
  var selectedStructAttachmentAtomId = (_selectedStruct$halfB = selectedStruct.halfBonds.get(neighborHalfBondId)) === null || _selectedStruct$halfB === void 0 ? void 0 : _selectedStruct$halfB.end;
25416
- var attachmentPointName = getAttachmentPointLabel(i + 1);
25417
25474
  assert_1(selectedStructAttachmentAtomId !== undefined);
25418
25475
  assignedAttachmentPoints.set(attachmentPointName, [selectedStructAttachmentAtomId, selectedStructLeavingAtomId]);
25419
25476
  });
25420
- this.potentialLeavingAtoms.forEach(function (atomId, i) {
25477
+ var selectedPotentialLeavingAtoms = new Map();
25478
+ this.potentialLeavingAtoms.forEach(function (atomId) {
25421
25479
  var _selectedStruct$atoms, _selectedStruct$atoms2;
25422
25480
  var leavingAtom = currentStruct.atoms.get(atomId);
25423
25481
  assert_1(leavingAtom);
@@ -25433,7 +25491,20 @@ var Editor$3 = function () {
25433
25491
  if (attachmentAtomId === -1) {
25434
25492
  return;
25435
25493
  }
25436
- var selectedStructLeavingAtom = leavingAtom.clone();
25494
+ var originalLeavingAtomId = originalToSelectedAtomsIdMap.get(atomId);
25495
+ var isLeavingAtomSelected = isNumber(originalLeavingAtomId);
25496
+ if (isLeavingAtomSelected) {
25497
+ var originalAttachmentAtomId = originalToSelectedAtomsIdMap.get(attachmentAtomId);
25498
+ if (!isNumber(originalAttachmentAtomId)) {
25499
+ return;
25500
+ }
25501
+ selectedPotentialLeavingAtoms.set(originalAttachmentAtomId, originalLeavingAtomId);
25502
+ return;
25503
+ }
25504
+ var selectedStructLeavingAtom = new Atom$2({
25505
+ label: AtomLabel.H,
25506
+ pp: leavingAtom.pp
25507
+ });
25437
25508
  selectedStructLeavingAtom.fragment = (_selectedStruct$atoms = (_selectedStruct$atoms2 = selectedStruct.atoms.get(0)) === null || _selectedStruct$atoms2 === void 0 ? void 0 : _selectedStruct$atoms2.fragment) !== null && _selectedStruct$atoms !== void 0 ? _selectedStruct$atoms : 0;
25438
25509
  var selectedStructLeavingAtomId = selectedStruct.atoms.add(selectedStructLeavingAtom);
25439
25510
  _this2.selectedToOriginalAtomsIdMap.set(selectedStructLeavingAtomId, atomId);
@@ -25446,12 +25517,13 @@ var Editor$3 = function () {
25446
25517
  end: selectedStructLeavingAtomId
25447
25518
  });
25448
25519
  selectedStruct.bonds.add(newBond);
25449
- var attachmentPointName = getAttachmentPointLabel(_this2.terminalRGroupAtoms.length + i + 1);
25520
+ var assignedAttachmentPointNames = Array.from(assignedAttachmentPoints.keys());
25521
+ var attachmentPointName = getNextFreeAttachmentPoint(assignedAttachmentPointNames, assignedAttachmentPointNames.length < sideAttachmentPointsNames.length);
25450
25522
  assignedAttachmentPoints.set(attachmentPointName, [selectedStructAttachmentAtomId, selectedStructLeavingAtomId]);
25451
25523
  });
25452
25524
  this.monomerCreationState = {
25453
25525
  assignedAttachmentPoints: assignedAttachmentPoints,
25454
- potentialAttachmentPoints: new Map()
25526
+ potentialAttachmentPoints: selectedPotentialLeavingAtoms
25455
25527
  };
25456
25528
  this.originalStruct = currentStruct;
25457
25529
  this.struct(selectedStruct);
@@ -25519,10 +25591,10 @@ var Editor$3 = function () {
25519
25591
  type = data.type,
25520
25592
  naturalAnalogue = data.naturalAnalogue;
25521
25593
  var attachmentPoints = [];
25522
- this.monomerCreationState.assignedAttachmentPoints.forEach(function (_ref, attachmentPointName) {
25523
- var _ref2 = _slicedToArray$1(_ref, 2),
25524
- attachmentAtomId = _ref2[0],
25525
- leavingAtomId = _ref2[1];
25594
+ this.monomerCreationState.assignedAttachmentPoints.forEach(function (_ref9, attachmentPointName) {
25595
+ var _ref10 = _slicedToArray$1(_ref9, 2),
25596
+ attachmentAtomId = _ref10[0],
25597
+ leavingAtomId = _ref10[1];
25526
25598
  var attachmentPoint = {
25527
25599
  attachmentAtom: attachmentAtomId,
25528
25600
  leavingGroup: {
@@ -25568,7 +25640,7 @@ var Editor$3 = function () {
25568
25640
  var leavingAtom = _this3.struct().atoms.get(leavingAtomId);
25569
25641
  assert_1(leavingAtom);
25570
25642
  var originalLeavingAtomId = _this3.selectedToOriginalAtomsIdMap.get(leavingAtomId);
25571
- assert_1(originalLeavingAtomId);
25643
+ assert_1(isNumber(originalLeavingAtomId));
25572
25644
  var originalLeavingAtom = _this3.originalStruct.atoms.get(originalLeavingAtomId);
25573
25645
  assert_1(originalLeavingAtom);
25574
25646
  originalLeavingAtom.rglabel = null;
@@ -25583,9 +25655,19 @@ var Editor$3 = function () {
25583
25655
  }
25584
25656
  });
25585
25657
  var sGroupAttachmentPoints = MacromoleculesConverter.convertMonomerAttachmentPointsToSGroupAttachmentPoints(monomer, this.selectedToOriginalAtomsIdMap);
25658
+ sGroupAttachmentPoints.forEach(function (ap) {
25659
+ _this3.render.ctab.molecule.bonds.forEach(function (bond) {
25660
+ var _this3$originalSelect, _this3$originalSelect2;
25661
+ 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)))) {
25662
+ bond.beginSuperatomAttachmentPointNumber = ap.attachmentPointNumber;
25663
+ }
25664
+ });
25665
+ });
25586
25666
  var action = fromSgroupAddition(this.render.ctab, SGroup$1.TYPES.SUP, this.originalSelection.atoms, {
25587
25667
  expanded: true
25588
25668
  }, this.render.ctab.molecule.sgroups.newId(), sGroupAttachmentPoints, monomer.position, true, monomer.monomerItem.props.MonomerName, null, monomer);
25669
+ this.render.ctab.molecule.clearFragments();
25670
+ this.render.ctab.molecule.markFragments();
25589
25671
  this.update(action);
25590
25672
  var templateRoot = monomerTemplate.root,
25591
25673
  templateData = _objectWithoutProperties(monomerTemplate, _excluded$p);
@@ -25634,6 +25716,21 @@ var Editor$3 = function () {
25634
25716
  this.monomerCreationState = Object.assign({}, this.monomerCreationState);
25635
25717
  this.render.update(true);
25636
25718
  }
25719
+ }, {
25720
+ key: "cleanupCloseAttachmentPointEditPopup",
25721
+ value: function cleanupCloseAttachmentPointEditPopup() {
25722
+ assert_1(this.monomerCreationState);
25723
+ this.monomerCreationState.clickedAttachmentPoint = null;
25724
+ this.render.update(true);
25725
+ }
25726
+ }, {
25727
+ key: "setProblematicAttachmentPoints",
25728
+ value: function setProblematicAttachmentPoints(problematicPoints) {
25729
+ assert_1(this.monomerCreationState);
25730
+ this.monomerCreationState.problematicAttachmentPoints = problematicPoints;
25731
+ this.monomerCreationState = Object.assign({}, this.monomerCreationState);
25732
+ this.render.update(true);
25733
+ }
25637
25734
  }, {
25638
25735
  key: "selection",
25639
25736
  value: function selection(ci) {
@@ -26053,10 +26150,10 @@ function domEventSetup(editor, clientArea) {
26053
26150
  eventName: 'mouseover',
26054
26151
  toolEventHandler: 'mouseover'
26055
26152
  }];
26056
- trackedDomEvents.forEach(function (_ref3) {
26057
- var target = _ref3.target,
26058
- eventName = _ref3.eventName,
26059
- toolEventHandler = _ref3.toolEventHandler;
26153
+ trackedDomEvents.forEach(function (_ref11) {
26154
+ var target = _ref11.target,
26155
+ eventName = _ref11.eventName,
26156
+ toolEventHandler = _ref11.toolEventHandler;
26060
26157
  editor.event[eventName] = new DOMSubscription();
26061
26158
  var subs = editor.event[eventName];
26062
26159
  target.addEventListener(eventName, function () {
@@ -26430,7 +26527,7 @@ var useMakeLeavingGroupAtomMenuItem = function useMakeLeavingGroupAtomMenuItem(_
26430
26527
  var attachmentPointName = Array.from(assignedAttachmentPoints.keys()).find(function (key) {
26431
26528
  var atomsPair = assignedAttachmentPoints.get(key);
26432
26529
  assert_1(atomsPair);
26433
- return atomsPair.includes(selectedAtomId);
26530
+ return atomsPair[1] === selectedAtomId;
26434
26531
  });
26435
26532
  var isAtomAssignedAttachmentPoint = Boolean(attachmentPointName);
26436
26533
  if (!isAtomPotentialAttachmentPoint && !isAtomAssignedAttachmentPoint) {
@@ -28591,6 +28688,9 @@ var attachmentPointAtomOptions = [{
28591
28688
  }, {
28592
28689
  value: AtomLabel.F,
28593
28690
  label: 'F'
28691
+ }, {
28692
+ value: AtomLabel.C,
28693
+ label: 'CH3'
28594
28694
  }];
28595
28695
  var AttachmentPointEditPopup = function AttachmentPointEditPopup(_ref) {
28596
28696
  var data = _ref.data,
@@ -28682,7 +28782,8 @@ var styles$f = {"attachmentPoint":"AttachmentPoint-module_attachmentPoint__6KD5K
28682
28782
 
28683
28783
  var AttachmentPoint = function AttachmentPoint(_ref) {
28684
28784
  var name = _ref.name,
28685
- atomLabel = _ref.atomLabel;
28785
+ atomLabel = _ref.atomLabel,
28786
+ implicitH = _ref.implicitH;
28686
28787
  return jsx("div", {
28687
28788
  className: styles$f.attachmentPoint,
28688
28789
  children: jsxs("p", {
@@ -28690,7 +28791,13 @@ var AttachmentPoint = function AttachmentPoint(_ref) {
28690
28791
  children: [jsx("span", {
28691
28792
  className: styles$f.attachmentPointIndex,
28692
28793
  children: name
28693
- }), "\xA0(", atomLabel, ")"]
28794
+ }), "\xA0", jsxs("span", {
28795
+ children: ["(", implicitH > 1 && jsxs(Fragment, {
28796
+ children: ["H", jsx("sub", {
28797
+ children: implicitH
28798
+ })]
28799
+ }), atomLabel, ")"]
28800
+ })]
28694
28801
  })
28695
28802
  });
28696
28803
  };
@@ -28817,31 +28924,50 @@ var validateInputs = function validateInputs(values) {
28817
28924
  };
28818
28925
  var validateAttachmentPoints = function validateAttachmentPoints(attachmentPoints) {
28819
28926
  var notifications = new Map();
28927
+ var problematicAttachmentPoints = new Set();
28820
28928
  if (attachmentPoints.length === 0) {
28821
28929
  notifications.set('noAttachmentPoints', {
28822
28930
  type: 'error',
28823
28931
  message: NotificationMessages.noAttachmentPoints
28824
28932
  });
28825
- return notifications;
28933
+ return {
28934
+ notifications: notifications,
28935
+ problematicAttachmentPoints: problematicAttachmentPoints
28936
+ };
28826
28937
  }
28827
- var attachmentPointNumbers = attachmentPoints.map(getAttachmentPointNumberFromLabel);
28828
- attachmentPointNumbers.sort(function (a, b) {
28829
- return a - b;
28938
+ var sideAttachmentPoints = attachmentPoints.filter(function (attachmentPointName) {
28939
+ var pointNumber = getAttachmentPointNumberFromLabel(attachmentPointName);
28940
+ return pointNumber > 2;
28830
28941
  });
28831
- var startingIndex = 0;
28832
- while (attachmentPointNumbers[startingIndex] <= 2) {
28833
- startingIndex++;
28942
+ if (sideAttachmentPoints.length === 0) {
28943
+ return {
28944
+ notifications: notifications,
28945
+ problematicAttachmentPoints: problematicAttachmentPoints
28946
+ };
28834
28947
  }
28835
- for (var i = startingIndex; i < attachmentPointNumbers.length; i++) {
28836
- if (attachmentPointNumbers[i] - attachmentPointNumbers[i - 1] > 1) {
28837
- notifications.set('incorrectAttachmentPointsOrder', {
28838
- type: 'error',
28839
- message: NotificationMessages.incorrectAttachmentPointsOrder
28840
- });
28841
- break;
28948
+ var expectedSequence = [];
28949
+ for (var i = 3; i < 3 + sideAttachmentPoints.length; i++) {
28950
+ expectedSequence.push(i);
28951
+ }
28952
+ var actualNumbers = sideAttachmentPoints.map(getAttachmentPointNumberFromLabel).sort(function (a, b) {
28953
+ return a - b;
28954
+ });
28955
+ actualNumbers.forEach(function (actualNumber) {
28956
+ if (!expectedSequence.includes(actualNumber)) {
28957
+ var problematicPointName = getAttachmentPointLabel(actualNumber);
28958
+ problematicAttachmentPoints.add(problematicPointName);
28842
28959
  }
28960
+ });
28961
+ if (problematicAttachmentPoints.size > 0) {
28962
+ notifications.set('incorrectAttachmentPointsOrder', {
28963
+ type: 'error',
28964
+ message: NotificationMessages.incorrectAttachmentPointsOrder
28965
+ });
28843
28966
  }
28844
- return notifications;
28967
+ return {
28968
+ notifications: notifications,
28969
+ problematicAttachmentPoints: problematicAttachmentPoints
28970
+ };
28845
28971
  };
28846
28972
  var MonomerCreationWizard = function MonomerCreationWizard() {
28847
28973
  var _useAppContext = useAppContext(),
@@ -28938,6 +29064,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
28938
29064
  };
28939
29065
  var handleAttachmentPointEditPopupClose = function handleAttachmentPointEditPopupClose() {
28940
29066
  setAttachmentPointEditPopupData(null);
29067
+ editor.cleanupCloseAttachmentPointEditPopup();
28941
29068
  };
28942
29069
  var handleDiscard = function handleDiscard() {
28943
29070
  editor.closeMonomerCreationWizard();
@@ -28962,12 +29089,15 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
28962
29089
  return;
28963
29090
  }
28964
29091
  assert_1(editor.monomerCreationState);
28965
- var attachmentPointsNotifications = validateAttachmentPoints(Array.from(editor.monomerCreationState.assignedAttachmentPoints.keys()));
29092
+ var _validateAttachmentPo = validateAttachmentPoints(Array.from(editor.monomerCreationState.assignedAttachmentPoints.keys())),
29093
+ attachmentPointsNotifications = _validateAttachmentPo.notifications,
29094
+ problematicAttachmentPoints = _validateAttachmentPo.problematicAttachmentPoints;
28966
29095
  if (attachmentPointsNotifications.size > 0) {
28967
29096
  wizardStateDispatch({
28968
29097
  type: 'SetNotifications',
28969
29098
  notifications: attachmentPointsNotifications
28970
29099
  });
29100
+ editor.setProblematicAttachmentPoints(problematicAttachmentPoints);
28971
29101
  return;
28972
29102
  }
28973
29103
  editor.saveNewMonomer({
@@ -28977,6 +29107,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
28977
29107
  naturalAnalogue: naturalAnalogue
28978
29108
  });
28979
29109
  resetWizard();
29110
+ editor.setProblematicAttachmentPoints(new Set());
28980
29111
  };
28981
29112
  var monomerCreationState = useSelector(editorMonomerCreationStateSelector);
28982
29113
  if (!monomerCreationState) {
@@ -28992,12 +29123,14 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
28992
29123
  if (!atom) {
28993
29124
  return {
28994
29125
  name: attachmentPointName,
28995
- atomLabel: 'H'
29126
+ atomLabel: 'H',
29127
+ implicitH: 0
28996
29128
  };
28997
29129
  }
28998
29130
  return {
28999
29131
  name: attachmentPointName,
29000
- atomLabel: atom.label
29132
+ atomLabel: atom.label,
29133
+ implicitH: atom.implicitH
29001
29134
  };
29002
29135
  });
29003
29136
  var ketcherEditorRootElement = document.querySelector(KETCHER_ROOT_NODE_CSS_SELECTOR);
@@ -29097,10 +29230,12 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
29097
29230
  className: styles$l.attachmentPoints,
29098
29231
  children: attachmentPointsData.map(function (_ref5) {
29099
29232
  var name = _ref5.name,
29100
- atomLabel = _ref5.atomLabel;
29233
+ atomLabel = _ref5.atomLabel,
29234
+ implicitH = _ref5.implicitH;
29101
29235
  return jsx(AttachmentPoint, {
29102
29236
  name: name,
29103
- atomLabel: atomLabel
29237
+ atomLabel: atomLabel,
29238
+ implicitH: implicitH
29104
29239
  }, name);
29105
29240
  })
29106
29241
  })]
@@ -37111,8 +37246,8 @@ var KetcherBuilder = function () {
37111
37246
  cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
37112
37247
  buttons: buttons || {},
37113
37248
  errorHandler: errorHandler || null,
37114
- version: "3.8.0-rc.2" ,
37115
- buildDate: "2025-09-05T18:59:48" ,
37249
+ version: "3.8.0-rc.3" ,
37250
+ buildDate: "2025-09-16T18:11:14" ,
37116
37251
  buildNumber: '',
37117
37252
  customButtons: customButtons || []
37118
37253
  }, structService, resolve, togglerComponent);
@@ -37407,7 +37542,7 @@ var ModeControl = function ModeControl(_ref3) {
37407
37542
  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; }
37408
37543
  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; }
37409
37544
  var MacromoleculesEditorComponent = lazy(function () {
37410
- return import('./index.modern-7694d091.js');
37545
+ return import('./index.modern-ea9bb715.js');
37411
37546
  });
37412
37547
  var Editor = function Editor(props) {
37413
37548
  var _useState = useState(false),