text: Kekule.ChemWidget={},Kekule.ChemWidget.AbstractWidget=Kekule.Widget.BaseWidget,Kekule.ChemWidget.ComponentWidgetNames={menu:"menu",newDoc:"newDoc",clearObjs:"clearObjs",loadFile:"loadFile",loadData:"loadData",saveData:"saveData",zoomIn:"zoomIn",zoomOut:"zoomOut",resetZoom:"resetZoom",rotateRight:"rotateRight",rotateLeft:"rotateLeft",rotateX:"rotateX",rotateY:"rotateY",rotateZ:"rotateZ",reset:"reset",molDisplayType:"molDisplayType",molDisplayTypeCondensed:"molDisplayTypeCondensed",molDisplayTypeSkeletal:"molDisplayTypeSkeletal",molDisplayTypeWire:"molDisplayTypeWire",molDisplayTypeSticks:"molDisplayTypeSticks",molDisplayTypeBallStick:"molDisplayTypeBallStick",molDisplayTypeSpaceFill:"molDisplayTypeSpaceFill",molHideHydrogens:"molHideHydrogens",openEditor:"openEditor",config:"config",objInspector:"objInspector",issueInspector:"issueInspector",undo:"undo",redo:"redo",copy:"copy",cut:"cut",paste:"paste",cloneSelection:"cloneSelection",selectAll:"selectAll",toggleSelect:"toggleSelect",recheckIssues:"recheckIssues",toggleShowAllIssues:"toggleShowAllIssues",dragScroll:"dragScroll",erase:"erase",manipulate:"manipulate",trackInput:"trackInput",molBond:"bond",molAtom:"atom",molFormula:"formula",molAtomAndFormula:"atomAndFormula",molCharge:"charge",textBlock:"textBlock",imageBlock:"imageBlock",molRing:"ring",glyph:"glyph",textImage:"textImage",fontName:"fontName",fontSize:"fontSize",color:"color",textDirection:"textDirection",textAlign:"textAlign",nodeDisplayMode:"nodeDisplayMode"},Kekule.ChemWidget.HtmlClassNames={PREFIX:"K-Chem-",INNER_TOOLBAR:"K-Chem-InnerToolbar"},function(){"use strict";Class.PropertyScope,Kekule.ChemWidget,Kekule.Widget.HtmlClassNames;var e=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{DIALOG_LOADDATA:"K-Chem-Dialog-LoadData",DIALOG_LOADDATA_FORMATBOX:"K-Chem-Dialog-LoadData-FormatBox",DIALOG_LOADDATA_SRCEDITOR_REGION:"K-Chem-Dialog-LoadData-SrcEditorRegion",DIALOG_LOADDATA_SRCEDITOR:"K-Chem-Dialog-LoadData-SrcEditor",DIALOG_LOADDATA_BTN_LOADFROMFILE:"K-Chem-Dialog-LoadData-Btn-LoadFromFile",DIALOG_LOADAPPENDDATA:"K-Chem-Dialog-LoadAppendData",DIALOG_LOADAPPENDDATA_APPENDCHECKBOX:"K-Chem-Dialog-LoadAppendData-AppendCheckBox"}),Kekule.ChemWidget.LoadDataDialog=Class.create(Kekule.Widget.Dialog,{CLASS_NAME:"Kekule.ChemWidget.LoadDataDialog",initialize:function(e,t,o){this._openFileAction=new Kekule.ActionLoadFileData,this._openFileAction.setBinaryDetector(this._detectBinaryFormat),this._openFileAction.update(),this._openFileAction.addEventListener("load",this.reactFileLoad,this),this._sBtnLoadFromFile=Kekule.$L("ChemWidgetTexts.CAPTION_LOADDATA_FROM_FILE"),this._formatItems=null,this.tryApplySuper("initialize",[e,t||Kekule.$L("ChemWidgetTexts.CAPTION_LOADDATA_DIALOG"),o||[Kekule.Widget.DialogButtons.OK,Kekule.Widget.DialogButtons.CANCEL]]),this.setResizable&&this.setResizable(!0)},finalize:function(){this._openFileAction.finalize(),this.tryApplySuper("finalize")},initProperties:function(){this.defineProp("chemObj",{dataType:"Kekule.ChemObject",serializable:!1,setter:null,getter:function(){var e=this.getDataDetails();return e&&e.data?Kekule.IO.loadTypedData(e.data,e.mimeType,e.fileName):null}}),this.defineProp("allowedFormatIds",{dataType:DataType.ARRAY,setter:function(e){this.setPropStoreFieldValue("allowedFormatIds",e),this.updateFormatItems()}}),this.defineProp("dataDetails",{dataType:DataType.HASH,setter:null,serializable:!1})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setAutoAdjustSizeOnPopup(!0)},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+e.DIALOG_LOADDATA},doCreateClientContents:function(t){this.tryApplySuper("doCreateClientContents");var o=this.getDocument();(r=o.createElement("div")).innerHTML=Kekule.$L("ChemWidgetTexts.CAPTION_DATA_FORMAT"),t.appendChild(r),r=o.createElement("div"),t.appendChild(r);var r,i=new Kekule.Widget.SelectBox(this);i.addClassName(e.DIALOG_LOADDATA_FORMATBOX),i.appendToElem(r),this._formatSelector=i,this.updateFormatItems(),(r=o.createElement("div")).innerHTML=Kekule.$L("ChemWidgetTexts.CAPTION_DATA_SRC"),t.appendChild(r),(r=o.createElement("div")).className=e.DIALOG_LOADDATA_SRCEDITOR_REGION,t.appendChild(r);var n=new Kekule.Widget.TextEditor(this);n.setWrap("off").setAutoWrapThreshold(!0).setFileDroppable(!0),n.setToolbarPos(Kekule.Widget.Position.BOTTOM),n.addClassName(e.DIALOG_LOADDATA_SRCEDITOR),n.appendToElem(r),this._dataEditor=n},getFormatSelectorItems:function(e){for(var t=[],o=this.getAllowedFormatIds()||Kekule.IO.ChemDataReaderManager.getAllReadableFormatIds(),r=0,i=o.length;r<i;++r){var n=Kekule.IO.DataFormatsManager.getFormatInfo(o[r]);if(n){for(var a=Kekule.ArrayUtils.clone(Kekule.ArrayUtils.toArray(n.fileExts)),l=0,s=a.length;l<s;++l)a[l]="*."+a[l];var d=a.join(", "),u=n.title;d&&(u+=" ("+d+")"),t.push({value:n.mimeType,text:u,title:n.mimeType,data:n})}}return t.sort(function(e,t){return e.text<t.text?-1:e.text>t.text?1:0}),t},getFileFilters:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o],n=i.data,a=i.text||i.title||i.value,l=Kekule.ArrayUtils.toArray(n.fileExts);t.push({title:a,filter:"."+l.join(",.")})}return t.push(Kekule.NativeServices.FILTER_ALL_SUPPORT),t.push(Kekule.NativeServices.FILTER_ANY),t},updateFormatItems:function(){this._formatItems=this.getFormatSelectorItems(),this._formatSelector.setItems(this._formatItems);var e=this.getFileFilters(this._formatItems);this._openFileAction.setFilters(e)},doSetButtons:function(t){var o=t||[];o.indexOf(this._sBtnLoadFromFile)<0&&o.unshift(this._sBtnLoadFromFile),this.tryApplySuper("doSetButtons",[o]);var r=this.getDialogButton(this._sBtnLoadFromFile);r.setAction(this._openFileAction),r.linkStyleResource(Kekule.Widget.StyleResourceNames.BUTTON_LOAD_FILE),r.addClassName(e.DIALOG_LOADDATA_BTN_LOADFROMFILE),r.setEnabled(this._openFileAction.getEnabled())},reactFileLoad:function(e){var t=e.data,o=e.fileName;try{if(e.success&&t&&o){this.setPropStoreFieldValue("dataDetails",{data:t,fileName:o});var r=Kekule.Widget.DialogButtons.OK;this.close(r)}else null}catch(e){Kekule.error(e)}},open:function(e,t,o){return this.setPropStoreFieldValue("dataDetails",{}),this.tryApplySuper("open",[e,t,o])},close:function(e){if(!this.getChemObj()&&this.isPositiveResult(e)){var t=this._dataEditor.getValue(),o=this._formatSelector.getValue();try{this.setPropStoreFieldValue("dataDetails",{data:t,mimeType:o})}catch(e){Kekule.raise(e,Kekule.ExceptionLevel.ERROR)}}return this.tryApplySuper("close",[e])},_detectBinaryFormat:function(e,t){if(t&&e){var o=Kekule.UrlUtils.extractFileExt(e),r=Kekule.IO.DataFormatsManager.findFormat(null,o);if(r)return Kekule.IO.ChemDataType.isBinaryType(r.dataType)}return!1}}),Kekule.ChemWidget.LoadOrAppendDataDialog=Class.create(Kekule.ChemWidget.LoadDataDialog,{CLASS_NAME:"Kekule.ChemWidget.LoadOrAppendDataDialog",initialize:function(e,t,o){this._appendCheckBox=null,this.tryApplySuper("initialize",[e,t,o])},initProperties:function(){this.defineProp("displayAppendCheckBox",{dataType:DataType.BOOL}),this.defineProp("isAppending",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this._appendCheckBox&&this._appendCheckBox.getChecked()},setter:function(e){this._appendCheckBox&&this._appendCheckBox.setChecked(!!e)}})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+e.DIALOG_LOADAPPENDDATA},doCreateClientContents:function(t){this.tryApplySuper("doCreateClientContents",[t]);this.getDocument();var o=new Kekule.Widget.CheckBox(this);o.addClassName(e.DIALOG_LOADAPPENDDATA_APPENDCHECKBOX),o.setText(Kekule.$L("ChemWidgetTexts.CAPTION_LOADDATA_DIALOG_APPENDMODE")),o.appendToElem(t),o.setDisplayed(this.getDisplayAppendCheckBox()),this._appendCheckBox=o},open:function(e,t,o){return this.setIsAppending(!1),this._appendCheckBox.setDisplayed(this.getDisplayAppendCheckBox()),this.tryApplySuper("open",[e,t,o])}})}(),function(){"use strict";var e=Kekule.DomUtils,t=Kekule.HtmlElementUtils,o=Kekule.Widget.HtmlClassNames,r=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{PERIODIC_TABLE:"K-Chem-Periodic-Table",PERIODIC_TABLE_MINI:"K-Chem-Periodic-Table-Mini",PERIODIC_TABLE_LEGEND:"K-Chem-Periodic-Table-Legend",PERIODIC_TABLE_LEGEND_CONTENT:"K-Chem-Periodic-Table-Legend-Content",PERIODIC_TABLE_LEGEND_COLORS:"K-Chem-Periodic-Table-Legend-Colors",PERIODIC_TABLE_LEGEND_COLOR:"K-Chem-Periodic-Table-Legend-Color",PERIODIC_TABLE_MAINTABLE:"K-Chem-Periodic-Table-MainTable",PERIODIC_TABLE_EXTRATABLE:"K-Chem-Periodic-Table-ExtraTable",PERIODIC_TABLE_ELEM_CELL:"K-Chem-Periodic-Table-Elem-Cell",PERIODIC_TABLE_ELEM_STUBSCELL:"K-Chem-Periodic-Table-Elem-StubsCell",PERIODIC_TABLE_ELEM_CELL_CONTENT:"K-Chem-Periodic-Table-Elem-Cell-Content",PERIODIC_TABLE_LEGEND_ELEM_CELL_CONTENT:"K-Chem-Periodic-Table-Elem-Cell-Content",PERIODIC_TABLE_HEAD_CELL:"K-Chem-Periodic-Table-Head-Cell",PERIODIC_TABLE_HEAD_CELL_CONTENT:"K-Chem-Periodic-Table-Head-Cell-Content",PERIODIC_TABLE_HEAD_CELL_GROUP:"K-Chem-Periodic-Table-Head-Cell-Group",PERIODIC_TABLE_HEAD_CELL_PERIOD:"K-Chem-Periodic-Table-Head-Cell-Period",ELEM_SYMBOL:"K-Chem-Elem-Symbol",ELEM_SYMBOL_STUBS:"K-Chem-Elem-Symbol-Stubs",ELEM_NAME:"K-Chem-Elem-Name",ATOMIC_NUM:"K-Chem-Atomic-Num",ATOMIC_WEIGHT:"K-Chem-Atomic-Weight"}),Kekule.globalOptions.add("chemWidget.periodicTable",{displayedComponents:["symbol","name","atomicNumber","groupHead","legend"]}),Kekule.ChemWidget.PeriodicTable=Class.create(Kekule.ChemWidget.AbstractWidget,{CLASS_NAME:"Kekule.ChemWidget.PeriodicTable",BINDABLE_TAG_NAMES:["span","div"],ELEM_DATA_FIELD:"__$elemData__",MAX_GROUP:18,MAX_PERIOD:7,LA_SERIES:["La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu"],AC_SERIES:["Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md","No","Lr"],initialize:function(e,t){this.setPropStoreFieldValue("displayedComponents",t||this.getDefaultDisplayedComponents()),this._elemCells=[],this._selectedElemCells=[],this.tryApplySuper("initialize",[e]),this.setEnableSelect(!0),this.setEnableMultiSelect(!0)},initProperties:function(){this.defineProp("displayedComponents",{dataType:DataType.ARRAY,getter:function(){return this.getPropStoreFieldValue("displayedComponents")||this.getDefaultDisplayedComponents()}}),this.defineProp("startingAtomNum",{dataType:DataType.INT}),this.defineProp("endingAtomNum",{dataType:DataType.INT}),this.defineProp("startingElementSymbol",{dataType:DataType.INT,serializable:!1,getter:function(){var e=this.getStartingAtomNum();return e&&Kekule.ChemicalElementsDataUtil.getElementSymbol(e)},setter:function(e){this.setStartingAtomNum(e&&Kekule.ChemicalElementsDataUtil.getAtomicNumber(e)||null)}}),this.defineProp("endingElementSymbol",{dataType:DataType.INT,serializable:!1,getter:function(){var e=this.getEndingAtomNum();return e&&Kekule.ChemicalElementsDataUtil.getElementSymbol(e)},setter:function(e){this.setEndingAtomNum(e&&Kekule.ChemicalElementsDataUtil.getAtomicNumber(e)||null)}}),this.defineProp("enabledElementSymbols",{dataType:DataType.ARRAY}),this.defineProp("disabledElementSymbols",{dataType:DataType.ARRAY}),this.defineProp("useMiniMode",{dataType:DataType.BOOL,setter:function(e){this.setPropStoreFieldValue("useMiniMode",e),e?this.addClassName(r.PERIODIC_TABLE_MINI):this.removeClassName(r.PERIODIC_TABLE_MINI)}}),this.defineProp("enableSelect",{dataType:DataType.BOOL,getter:function(){return this.getPropStoreFieldValue("enableSelect")||this.getEnableMultiSelect()}}),this.defineProp("enableMultiSelect",{dataType:DataType.BOOL}),this.defineProp("selected",{dataType:DataType.HASH,serializable:!1,setter:null,getter:function(){return this.getSelection()?this.getSelection()[0]:null}}),this.defineProp("selection",{dataType:DataType.ARRAY,serializable:!1,setter:null,getter:function(){for(var e=[],t=this._selectedElemCells||[],o=0,r=t.length;o<r;++o){var i=t[o][this.ELEM_DATA_FIELD];i&&e.push(i)}return e}}),this.defineProp("selectedSymbol",{dataType:DataType.STRING,getter:function(){return this.getSelectedSymbols()[0]},setter:function(e){this.setSelectedSymbols([e])}}),this.defineProp("selectedSymbols",{dataType:DataType.ARRAY,getter:function(){var e=this.getSelection();if(e){for(var t=[],o=0,r=e.length;o<r;++o)t.push(e[o].symbol);return t}return[]},setter:function(e){this.selectSymbols(e)}})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.PERIODIC_TABLE},doCreateRootElement:function(e){return e.createElement("div")},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),r=this.createMainTable(e,t);return o.concat([r])},doObjectChange:function(e){var t=["displayedComponents","startingAtomNum","endingAtomNum"];Kekule.ArrayUtils.intersect(e,t).length&&this.recreateMainTable(),t=["enabledElementSymbols","disabledElementSymbols"],Kekule.ArrayUtils.intersect(e,t).length&&this.updateCellEnableStates()},getDefaultDisplayedComponents:function(){return Kekule.globalOptions.chemWidget.periodicTable.displayedComponents},getShowElemSymbol:function(){return this.getDisplayedComponents().indexOf("symbol")>=0},getShowElemName:function(){return this.getDisplayedComponents().indexOf("name")>=0},getShowAtomicNum:function(){return this.getDisplayedComponents().indexOf("atomicNumber")>=0},getShowAtomicWeight:function(){return this.getDisplayedComponents().indexOf("atomicWeight")>=0},getShowGroupHead:function(){return this.getDisplayedComponents().indexOf("groupHead")>=0},getShowPeriodHead:function(){return this.getDisplayedComponents().indexOf("periodHead")>=0},getShowLegend:function(){return this.getDisplayedComponents().indexOf("legend")>=0},recreateMainTable:function(){this.deselectAll();var t=this.getElement();e.clearChildContent(t),this.createMainTable(t.ownerDocument,t)},createMainTable:function(t,i){var n=Kekule.chemicalElementsData,a=[];this._elemCells=[];for(var l=[],s=[],d=t.createElement("table"),u=0;u<=this.MAX_PERIOD;++u){for(var c=t.createElement("tr"),p=[],h=0;h<=this.MAX_GROUP;++h){var g=t.createElement("td");c.appendChild(g),p.push(g)}d.appendChild(c),a.push(p)}var C=t.createElement("table");for(u=0;u<2;++u){for(c=t.createElement("tr"),p=[],h=0;h<this.LA_SERIES.length;++h){g=t.createElement("td");c.appendChild(g),p.push(g)}C.appendChild(c),l.push(p)}for(var _=this.getStartingAtomNum()||0,f=this.getEndingAtomNum()||3e5,y=0,m=n.length;y<m;++y){var O=n[y],E=O.atomicNumber;if(!(E<_||E>f)){var T=O.symbol,S=O.period,A=O.group,k=O.chemicalSerie.replace(/\s/g,"");Kekule.ArrayUtils.pushUnique(s,O.chemicalSerie);var b=this.LA_SERIES.indexOf(T),I=this.AC_SERIES.indexOf(T);b>=0?g=l[0][b]:I>=0?g=l[1][I]:S&&A&&(g=a[S][A]),g&&(g.className=r.PERIODIC_TABLE_ELEM_CELL,g.appendChild(this.createElemCellContent(t,O,k.upperFirst())),g[this.ELEM_DATA_FIELD]=O,this._elemCells.push(g)),0!==b&&0!==I||((g=a[S][A]).className=r.PERIODIC_TABLE_ELEM_STUBSCELL,g.appendChild(this.createElemCellStubsContent(t,O,k.upperFirst())))}}if(this.getShowGroupHead()){var D=["IA","IIA","IIIB","IVB","VB","VIB","VIIB","","VIII","","IB","IIB","IIIA","IVA","VA","VIA","VIIA","VIIIA"];for(h=1;h<=this.MAX_GROUP;++h){(g=a[u=1===h||18===h?0:2===h||h>=13?1:3][h]).className=r.PERIODIC_TABLE_HEAD_CELL+" "+r.PERIODIC_TABLE_HEAD_CELL_GROUP,g.appendChild(this.createHeadContent(t,D[h-1]))}}if(this.getShowPeriodHead())for(u=1;u<=this.MAX_PERIOD;++u){(g=a[u][0]).className=r.PERIODIC_TABLE_HEAD_CELL+" "+r.PERIODIC_TABLE_HEAD_CELL_PERIOD,g.appendChild(this.createHeadContent(t,u))}if(i.appendChild(d),this.getShowLegend()){var P=t.createElement("a");P.href="javascript:void(0)",P.className=r.PERIODIC_TABLE_LEGEND+" "+o.CORNER_ALL,e.setElementText(P,Kekule.$L("ChemWidgetTexts.LEGEND_CAPTION"));var K=t.createElement("div");K.className=r.PERIODIC_TABLE_LEGEND_CONTENT+" "+o.CORNER_ALL;var R={symbol:Kekule.$L("ChemWidgetTexts.LEGEND_ELEM_SYMBOL"),atomicNumber:Kekule.$L("ChemWidgetTexts.LEGEND_ATOMIC_NUM"),naturalMass:Kekule.$L("ChemWidgetTexts.LEGEND_ATOMIC_WEIGHT"),name:Kekule.$L("ChemWidgetTexts.LEGEND_ELEM_NAME")},v=this.createElemCellContent(t,R,r.PERIODIC_TABLE_LEGEND_ELEM_CELL_CONTENT);K.appendChild(v);var M=t.createElement("div");M.className=r.PERIODIC_TABLE_LEGEND_COLORS;for(y=0,m=s.length;y<m;++y){var N=t.createElement("div");N.className=r.PERIODIC_TABLE_LEGEND_COLOR+" "+s[y].replace(/\s/g,""),e.setElementText(N,s[y]),M.appendChild(N)}K.appendChild(M),P.appendChild(K),i.appendChild(P)}return i.appendChild(C),this.updateCellEnableStates(),d},createElemCellContent:function(e,t,o){var i=e.createElement("div"),n=r.PERIODIC_TABLE_ELEM_CELL_CONTENT;if(o&&(n+=" "+o),i.className=n,this.getShowAtomicNum()&&i.appendChild(this.createElemContentComponent(e,t.atomicNumber,r.ATOMIC_NUM)),this.getShowAtomicWeight()){var a=t.naturalMass;if(a){var l="number"==typeof a?a.toFixed(3):a;i.appendChild(this.createElemContentComponent(e,l,r.ATOMIC_WEIGHT))}else i.appendChild(this.createElemContentComponent(e," ",r.ATOMIC_WEIGHT))}return this.getShowElemSymbol()&&i.appendChild(this.createElemContentComponent(e,t.symbol,r.ELEM_SYMBOL)),this.getShowElemName()&&i.appendChild(this.createElemContentComponent(e,t.name,r.ELEM_NAME)),i},createElemCellStubsContent:function(e,t,o){var i,n,a,l=e.createElement("div");return l.className=r.PERIODIC_TABLE_ELEM_CELL_CONTENT+" "+(o||""),a=t.chemicalSerie,"La"===t.symbol?(i="57-71",n="La-Lu"):(i="89-103",n="Ac-Lr"),this.getShowAtomicNum()&&l.appendChild(this.createElemContentComponent(e,i,r.ATOMIC_NUM)),this.getShowElemSymbol()&&l.appendChild(this.createElemContentComponent(e,n,r.ELEM_SYMBOL_STUBS,!0)),this.getShowElemName()&&l.appendChild(this.createElemContentComponent(e,a,r.ELEM_NAME)),l},createElemContentComponent:function(t,o,r,i){var n=t.createElement("span");if(n.className=r,i){var a=t.createElement("span");n.appendChild(a)}return e.setElementText(a||n,o),n},createHeadContent:function(t,o,i){var n=t.createElement("div");return n.className=r.PERIODIC_TABLE_HEAD_CELL_CONTENT+" "+(i||""),e.setElementText(n,o),n},updateCellEnableStates:function(){var e=this.getEnabledElementSymbols()||[],t=!e.length&&this.getDisabledElementSymbols()||[];if(t.length||e.length)for(var o=this._elemCells,r=0,i=o.length;r<i;++r){var n=this._getCellData(o[r]).symbol;e.length?e.indexOf(n)<0&&this.setCellEnableState(o[r],!1):t.length&&t.indexOf(n)>=0&&this.setCellEnableState(o[r],!1)}},setCellEnableState:function(e,r){r?(t.removeClass(e,o.STATE_DISABLED),this._getCellData(e).disabled=null):(t.addClass(e,o.STATE_DISABLED),this._getCellData(e).disabled=!0)},_getCellData:function(e){return e[this.ELEM_DATA_FIELD]},_isCellDisabled:function(e){return!!this._getCellData(e).disabled},_getAtomCellElem:function(t){var o=e.getNearestAncestorByTagName(t,"td",!0);return o&&this._elemCells.indexOf(o)>=0?o:null},_getCellElemOfSymbol:function(e){for(var t=this._elemCells,o=0,r=t.length;o<r;++o){var i=t[o];if(i[this.ELEM_DATA_FIELD].symbol===e)return i}return null},isCellSelected:function(e){return this._selectedElemCells.indexOf(e)>=0},selectCell:function(e){e&&(t.addClass(e,o.STATE_SELECTED),Kekule.ArrayUtils.pushUnique(this._selectedElemCells,e),this.invokeEvent("select",{elemData:e[this.ELEM_DATA_FIELD]}))},deselectCell:function(e){e&&(t.removeClass(e,o.STATE_SELECTED),Kekule.ArrayUtils.remove(this._selectedElemCells,e),this.invokeEvent("deselect",{elemData:e[this.ELEM_DATA_FIELD]}))},toggleCell:function(e){this.isCellSelected(e)?this.deselectCell(e):this.selectCell(e)},deselectAll:function(){for(var e=this._selectedElemCells,t=e.length-1;t>=0;--t)this.deselectCell(e[t]);return this},selectSymbols:function(e){this.deselectAll();for(var t=Kekule.ArrayUtils.toArray(e),o=0,r=t.length;o<r;++o){var i=this._getCellElemOfSymbol(t[o]);i&&this.selectCell(i)}return this},react_click:function(e){if(this.getEnableSelect()){var t=e.getTarget(),o=this._getAtomCellElem(t);if(o&&!this._isCellDisabled(o))return this.getEnableMultiSelect()?this.toggleCell(o):(this.deselectAll(),this.selectCell(o)),!0}this.tryApplySuper("react_click",[e])}})}(),function(){"use strict";var e=Class.PropertyScope,t=(Kekule.DomUtils,Kekule.ZoomUtils),o=(Kekule.ChemWidget,Kekule.Widget.HtmlClassNames),r=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{DISPLAYER_DRAWCONTEXT_PARENT:"K-Chem-Displayer-DrawContext-Parent",ACTION_MOL_DISPLAY_TYPE:"K-Chem-MolDisplayType",ACTION_MOL_DISPLAY_SKELETAL:"K-Chem-MolDisplaySkeletal",ACTION_MOL_DISPLAY_CONDENSED:"K-Chem-MolDisplayCondensed",ACTION_MOL_DISPLAY_WIRE:"K-Chem-MolDisplayWire",ACTION_MOL_DISPLAY_BALLSTICK:"K-Chem-MolDisplayBallStick",ACTION_MOL_DISPLAY_STICKS:"K-Chem-MolDisplaySticks",ACTION_MOL_DISPLAY_SPACEFILL:"K-Chem-MolDisplaySpaceFill",ACTION_MOL_HIDE_HYDROGENS:"K-Chem-MolHideHydrogens",ACTION_ZOOMIN:"K-Chem-ZoomIn",ACTION_ZOOMOUT:"K-Chem-ZoomOut",ACTION_RESET:"K-Chem-Reset",ACTION_COPY:"K-Chem-Copy",ACTION_RESET_ZOOM:"K-Chem-ResetZoom",ACTION_LOADFILE:"K-Chem-LoadFile",ACTION_LOADDATA:"K-Chem-LoadData",ACTION_SAVEFILE:"K-Chem-SaveFile",ACTION_CLEAROBJS:"K-Chem-ClearObjs",ACTION_CONFIG:"K-Chem-Config",DIALOG_CHOOSE_FILE_FORAMT:"K-Chem-Dialog-Choose-File-Format",DIALOG_CHOOSE_FILE_FORAMT_FORMATBOX:"K-Chem-Dialog-Choose-File-Format-FormatBox",DIALOG_CHOOSE_FILE_FORAMT_PREVIEWER_REGION:"K-Chem-Dialog-Choose-File-Format-PreviewerRegion",DIALOG_CHOOSE_FILE_FORAMT_PREVIEWER:"K-Chem-Dialog-Choose-File-Format-Previewer"}),Kekule.ChemWidget.ChemObjDisplayerConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.ChemWidget.ChemObjDisplayerConfigs",initProperties:function(){this.addConfigProp("ioConfigs","Kekule.ChemWidget.ChemObjDisplayerIOConfigs"),this.addConfigProp("environment2DConfigs","Kekule.ChemWidget.ChemObjDisplayerEnvironmentConfigs"),this.addConfigProp("environment3DConfigs","Kekule.ChemWidget.ChemObjDisplayerEnvironmentConfigs")},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setPropStoreFieldValue("ioConfigs",new Kekule.ChemWidget.ChemObjDisplayerIOConfigs),this.setPropStoreFieldValue("environment2DConfigs",new Kekule.ChemWidget.ChemObjDisplayerEnvironmentConfigs),this.setPropStoreFieldValue("environment3DConfigs",new Kekule.ChemWidget.ChemObjDisplayerEnvironmentConfigs)}}),Kekule.ChemWidget.ChemObjDisplayerIOConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.ChemWidget.ChemObjDisplayerIOConfigs",initProperties:function(){this.addBoolConfigProp("canonicalizeBeforeSave",!0),this.addBoolConfigProp("autoGenerateCoordsAfterLoad",!0)}}),Kekule.ChemWidget.ChemObjDisplayerEnvironmentConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.ChemWidget.ChemObjDisplayerEnvironmentConfigs",initProperties:function(){this.addBoolConfigProp("antialias",!1),this.addFloatConfigProp("antialiasBlurRatio",0),this.addFloatConfigProp("overSamplingRatio",1)}}),Kekule.ChemWidget.ChemObjDisplayer=Class.create(Kekule.ChemWidget.AbstractWidget,{CLASS_NAME:"Kekule.ChemWidget.ChemObjDisplayer",initialize:function(e,t,o,r){this._paintFlag=0,this._bgColorMap={},this._contextTransformOpsMap=new Kekule.MapEx,this.setPropStoreFieldValue("resetAfterLoad",!0),this.setPropStoreFieldValue("renderType",o||Kekule.Render.RendererType.R2D),this.setPropStoreFieldValue("displayerConfigs",r||this.createDefaultConfigs()),this.tryApplySuper("initialize",[e]),t&&this.setChemObj(t),this.setEnableLoadNewFile(!0)},doFinalize:function(){this.setPropStoreFieldValue("chemObj",null),this.getPainter().finalize();var e=this.getPropStoreFieldValue("drawBridge"),t=this.getPropStoreFieldValue("drawContext");t&&e&&e.releaseContext(t),e&&e.finalize&&e.finalize(),this.setPropStoreFieldValue("drawBridge",null),this.setPropStoreFieldValue("drawContext",null),this._contextTransformOpsMap&&this._contextTransformOpsMap.finalize(),this.tryApplySuper("doFinalize")},initProperties:function(){this.defineProp("displayerConfigs",{dataType:"Kekule.ChemWidget.ChemObjDisplayerConfigs",serializable:!1,scope:e.PUBLIC}),this.defineProp("enableLoadNewFile",{dataType:DataType.BOOL}),this.defineProp("allowedInputFormatIds",{dataType:DataType.ARRAY}),this.defineProp("allowedOutputFormatIds",{dataType:DataType.ARRAY}),this.defineProp("standardizationOptions",{dataType:DataType.HASH}),this.defineProp("resetAfterLoad",{dataType:DataType.BOOL}),this.defineProp("chemObj",{dataType:"Kekule.ChemObject",serializable:!1,scope:e.PUBLISHED,setter:function(e){var t=this.getPropStoreFieldValue("chemObj");this.setPropStoreFieldValue("chemObj",e),this.chemObjChanged(e,t)}}),this.defineProp("chemObjData",{dataType:DataType.STRING,serializable:!1,getter:null,setter:function(e){var t,o;try{t=JSON.parse(e)}catch(e){}(console.log("json",t,e),t)&&((o=t.format?Kekule.IO.loadFormatData(t.data,t.format):t.mimeType?Kekule.IO.loadMimeData(t.data,t.mimeType):null)&&this._tryAutoGenerateChemObjCoordsAndLoad(o))}}),this.defineProp("chemObjLoaded",{dataType:DataType.BOOL,serializable:!1,scope:e.PUBLIC,setter:null,getter:function(){return this.getChemObj()&&this.getPropStoreFieldValue("chemObjLoaded")}}),this.defineProp("renderType",{dataType:DataType.INT,serializable:!1,enumSource:Kekule.Render.RendererType,scope:e.PUBLISHED,setter:function(e){if(this.getAllowRenderTypeChange()){var t=this.getRenderType();e!==t&&(this.setPropStoreFieldValue("renderType",e),this.resetRenderType(t,e))}else Kekule.error(Kekule.$L("ErrorMsg.RENDER_TYPE_CHANGE_NOT_ALLOWED"))}}),this.defineProp("renderConfigs",{dataType:DataType.OBJECT,serializable:!1,scope:e.PUBLIC,getter:function(){var e=this.getPropStoreFieldValue("renderConfigs");return e||(e=this.getRenderType()===Kekule.Render.RendererType.R3D?Kekule.Render.Render3DConfigs.getInstance():Kekule.Render.Render2DConfigs.getInstance()),e},setter:function(e){this.setPropStoreFieldValue("renderConfigs",e);var t=this.getPropStoreFieldValue("painter");t&&t.setRenderConfigs(this.getRenderConfigs())}}),this.defineProp("backgroundColor",{dataType:DataType.STRING,scope:e.PUBLISHED,setter:function(e){this.setPropStoreFieldValue("backgroundColor",e),this._bgColorMap[this.getRenderType().toString()]=e,this.backgroundColorChanged()}}),this.defineProp("inheritedRenderStyles",{dataType:DataType.ARRAY,scope:e.PUBLIC,getter:function(){var e=this.getPropStoreFieldValue("inheritedRenderStyles");return e||(e=[],this.setPropStoreFieldValue("inheritedRenderStyles",e)),e},setter:function(e){this.setPropStoreFieldValue("inheritedRenderStyles",e||[]),this.requestRepaint()}}),this.defineProp("inheritedRenderColor",{dataType:DataType.BOOL,scope:e.PUBLISHED,getter:function(){var e=this.getInheritedRenderStyles();return!!(e&&e.indexOf("color")>=0)},setter:function(e){if(!!e!==this.getInheritedRenderColor()){var t=this.getInheritedRenderStyles();e?t.push("color"):Kekule.ArrayUtils.remove(t,"color"),this.setInheritedRenderStyles(t)}}}),this.defineProp("inheritedRenderBackgroundColor",{dataType:DataType.BOOL,scope:e.PUBLISHED,getter:function(){var e=this.getInheritedRenderStyles();return!!(e&&e.indexOf("backgroundColor")>=0)},setter:function(e){if(!!e!==this.getInheritedRenderBackgroundColor()){var t=this.getInheritedRenderStyles();e?t.push("backgroundColor"):Kekule.ArrayUtils.remove(t,"backgroundColor"),this.setInheritedRenderStyles(t)}}}),this.defineProp("enableCustomCssProperties",{dataType:DataType.BOOL,setter:function(e){e!=this.getEnableCustomCssProperties()&&(this.setPropStoreFieldValue("enableCustomCssProperties",!!e),this.requestRepaint())}}),this.defineProp("transformParams",{dataType:DataType.HASH,serializable:!1,scope:e.PUBLIC,getter:function(){var e=Object.extend({},this.getDrawOptions());return e.screenCoordOffset=this.getBaseCoordOffset(),e},setter:function(e){var t=e||{};this.setDrawOptions(t),this.setBaseCoordOffset(t.baseCoordOffset),this.drawOptionChanged()}}),this.defineProp("drawOptions",{dataType:DataType.HASH,serializable:!1,scope:e.PUBLIC,getter:function(){var e=this.getPropStoreFieldValue("drawOptions");return e||(e={},this.setPropStoreFieldValue("drawOptions",e)),e},setter:function(e){this.setPropStoreFieldValue("drawOptions",e),this.drawOptionChanged()}}),this.defineProp("zoom",{dataType:DataType.FLOAT,serializable:!1,getter:function(){return(this.getDrawOptions()||{}).zoom},setter:function(e){return this.zoomTo(e),this}}),this.defineProp("initialZoom",{dataType:DataType.FLOAT}),this.defineProp("autofit",{dataType:DataType.BOOL,serializable:!1,getter:function(){return(this.getDrawOptions()||{}).autofit},setter:function(e){var t=this.getDrawOptions()||{};return t.autofit=e,this.setDrawOptions(t)}}),this.defineProp("autoShrink",{dataType:DataType.BOOL,serializable:!1,getter:function(){return(this.getDrawOptions()||{}).autoShrink},setter:function(e){var t=this.getDrawOptions()||{};return t.autoShrink=e,this.setDrawOptions(t)}}),this.defineProp("moleculeDisplayType",{dataType:DataType.INT,serializable:!1,getter:function(){return(this.getDrawOptions()||{}).moleculeDisplayType},setter:function(e){return this.getDrawOptions().moleculeDisplayType=e,this.drawOptionChanged(),this}}),this.defineProp("allowCoordBorrow",{dataType:DataType.BOOL,serializable:!1,scope:e.PUBLIC,getter:function(){return Kekule.oneOf(this.getDrawOptions().allowCoordBorrow,this.getRenderConfigs().getGeneralConfigs().getAllowCoordBorrow())}}),this.defineProp("autoSize",{dataType:DataType.BOOL,serializable:!1,setter:function(e){e!=this.getAutoSize()&&(this.setPropStoreFieldValue("autoSize",e),e&&this.allowAutoSize()&&this.drawOptionChanged())}}),this.defineProp("padding",{dataType:DataType.INT,serializable:!1,setter:function(e){e!=this.getPadding()&&(this.setPropStoreFieldValue("padding",e),this.getDrawOptions().autofitContextPadding=e,this.drawOptionChanged())}}),this.defineProp("baseCoordOffset",{dataType:DataType.Hash,serializable:!1,setter:function(e){this.setPropStoreFieldValue("baseCoordOffset",e),this.getChemObjLoaded()&&this.repaint()}}),this.defineProp("drawBridge",{dataType:DataType.OBJECT,serializable:!1,scope:e.PRIVATE,setter:null,getter:function(e){var t=this.getPropStoreFieldValue("drawBridge");return t||(t=this.createDrawBridge(e),this.setPropStoreFieldValue("drawBridge",t)),t}}),this.defineProp("drawContext",{dataType:DataType.OBJECT,serializable:!1,scope:e.PRIVATE,setter:null,getter:function(){var e=this.getPropStoreFieldValue("drawContext");if(!e){var t=this.getDrawBridge();if(t){var o=this.getDrawContextParentElem();if(!o)return null;var r=Kekule.HtmlElementUtils.getElemOffsetDimension(o);e=t.createContext(o,r.width,r.height,this.getContextCreationParams(this.getRenderType(),t)),this.setPropStoreFieldValue("drawContext",e)}}return e}}),this.defineProp("painter",{dataType:"Kekule.Render.ChemObjPainter",serializable:!1,scope:e.PRIVATE,setter:null,getter:function(){var e=this.getPropStoreFieldValue("painter");return e||(e=this.createNewPainter()),e}}),this.defineProp("rootRenderer",{dataType:"Kekule.Render.AbstractRenderer",serializable:!1,scope:e.PRIVATE,setter:null,getter:function(){var e=this.getPainter();return e?e.getRenderer():null}}),this.defineProp("boundInfoRecorder",{dataType:"Kekule.Render.BoundInfoRecorder",serializable:!1,setter:null,getter:function(){var e=this.getRootRenderer();return e&&e.getBoundInfoRecorder()}})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setStandardizationOptions({unmarshalSubFragments:!1,clearHydrogens:!1})},doEndUpdate:function(e){this.tryApplySuper("doEndUpdate",[e]),this._requestRepainting&&this.repaint(this._requestRepainting.overrideOptions)},elementBound:function(e){this.setObserveElemResize(!0)},doWidgetShowStateChanged:function(e){this.tryApplySuper("doWidgetShowStateChanged",[e]),e&&this.setChemObj(this.getChemObj())},doFileDragDrop:function(e){if(e){var t=this;return function(){Kekule.IO.loadFileData(e[0],function(e,o){o&&t.setChemObj(e)})}.defer(),!0}return this.tryApplySuper("doFileDragDrop")},notifyStyleAttribChanged:function(e){this.tryApplySuper("notifyStyleAttribChanged",[e]),(this.getInheritedRenderStyles()||[]).length&&this.requestRepaint()},getAllowRenderTypeChange:function(){return!1},resetRenderType:function(e,t){var o=this.getChemObj(),r=this.getPropStoreFieldValue("drawBridge"),i=this.getPropStoreFieldValue("drawContext");r&&i&&r.releaseContext(i),this.setPropStoreFieldValue("drawContext",null),this.setPropStoreFieldValue("drawBridge",null);var n=this.getBackgroundColorOfType(t);this.getDrawOptions().moleculeDisplayType=this.getDefaultMoleculeDisplayType(t),this.setPropStoreFieldValue("backgroundColor",n),this.backgroundColorChanged(!0),this.setChemObj(o||null)},resetRenderEnvironment:function(){return this.resetRenderType(null,this.getRenderType()),this},getDisplayerEnvironmentConfigs:function(){return this.getCoordMode()===Kekule.CoordMode.COORD3D?this.getDisplayerConfigs().getEnvironment3DConfigs():this.getDisplayerConfigs().getEnvironment2DConfigs()},getContextCreationParams:function(e,t){var o=this.getRenderConfigs(),r=this.getDisplayerConfigs();return e===Kekule.Render.RendererType.R3D?{alpha:!0,antialias:o.getEnvironmentConfigs().getAntialias()}:{alpha:!0,antialias:r.getEnvironment2DConfigs().getAntialias(),antialiasBlurRatio:r.getEnvironment2DConfigs().getAntialiasBlurRatio(),overSamplingRatio:r.getEnvironment2DConfigs().getOverSamplingRatio()}},createDefaultConfigs:function(){return new Kekule.ChemWidget.ChemObjDisplayerConfigs},getCoordMode:function(){return this.getRenderType()===Kekule.Render.RendererType.R3D?Kekule.CoordMode.COORD3D:Kekule.CoordMode.COORD2D},setCoordMode:function(e){var t=e===Kekule.CoordMode.COORD3D?Kekule.Render.RendererType.R3D:Kekule.Render.RendererType.R2D;this.setRenderType(t)},loadPredefinedResDataToProp:function(e,t,o){if("chemObj"===e)if(o)try{var r=Kekule.IO.loadTypedData(t.data,t.resType,t.resUri);r||(r=Kekule.IO.loadFormatData(t.data,t.resType)),r?this._tryAutoGenerateChemObjCoordsAndLoad(r):Kekule.error(Kekule.$L("ErrorMsg.LOAD_CHEMDATA_FAILED"))}catch(e){this.reportException(e)}else this.reportException(Kekule.$L("ErrorMsg.CANNOT_LOAD_RES_OF_URI")+t.resUri||"")},reportException:function(e,t){Kekule.raise(e,t||Kekule.ExceptionLevel.ERROR)},createDrawBridge:function(e){var t=(this.getRenderType()===Kekule.Render.RendererType.R3D?Kekule.Render.DrawBridge3DMananger:Kekule.Render.DrawBridge2DMananger).getPreferredBridgeInstance();return t||e||Kekule.error(Kekule.$L("ErrorMsg.DRAW_BRIDGE_NOT_SUPPORTED")),t},getDrawContextParentElem:function(e){var t=this._drawContextParentElem;if(!t&&!e){t=this.getDocument().createElement("div"),this._drawContextParentElem=t,Kekule.HtmlElementUtils.addClass(t,o.DYN_CREATED),Kekule.HtmlElementUtils.addClass(t,r.DISPLAYER_DRAWCONTEXT_PARENT),t.style.width="100%",t.style.height="100%";var i=this.getElement(),n=Kekule.DomUtils.getFirstChildElem(i);n?i.insertBefore(t,n):i.appendChild(t)}return t},allowAutoSize:function(){return this.getRenderType()===Kekule.Render.RendererType.R2D},canModifyPartialGraphic:function(e){var t=this.getDrawBridge();return!!t.canModifyGraphic&&t.canModifyGraphic(e||this.getDrawContext())},doInsertedToDom:function(){this.doResize()},doResize:function(){this.refitDrawContext(this.isPainting())},refitDrawContext:function(e){if(this.getDrawBridge(!0)&&this.getDrawContext()){var t=Kekule.HtmlElementUtils.getElemClientDimension(this.getDrawContextParentElem()),o=this.changeContextDimension(t);!e&&o&&this.repaint()}},getContextDimension:function(){return this.getDrawBridge()&&this.getDrawContext()?this.getDrawBridge().getContextDimension(this.getDrawContext()):null},_getContextOverSamplingRatio:function(){var e=this.getDisplayerEnvironmentConfigs();return e.getAntialias&&e.getAntialias()&&e.getOverSamplingRatio&&e.getOverSamplingRatio()||1},changeContextDimension:function(e){if(this.getDrawBridge()&&this.getDrawContext()){var t=e.width,o=e.height,r=this.getDrawBridge().getContextElem(this.getDrawContext());if(r){var i=this._getContextOverSamplingRatio();if(1!==i&&Kekule.BrowserFeature.cssTranform){var n=1/i;r.style.transform="scale("+n+","+n+")",r.style.transformOrigin="0 0",this.getDrawBridge().setContextParam(this.getDrawContext(),"overSamplingRatio",i)}else r.style.transform="",this.getDrawBridge().setContextParam(this.getDrawContext(),"overSamplingRatio",null)}return this._resizeContext(this.getDrawContext(),this.getDrawBridge(),t,o),!0}return!1},_resizeContext:function(e,t,o,r){e&&t&&t.setContextDimension(e,o,r)},clearContext:function(){var e=this.getPropStoreFieldValue("drawContext");if(e){var t=this.getPropStoreFieldValue("painter");t&&t.clear(e),this.getDrawBridge().clearContext(e)}},createNewPainter:function(e){var t=this.getPropStoreFieldValue("painter");t&&t.finalize();var o=new Kekule.Render.ChemObjPainter(this.getRenderType(),e,this.getDrawBridge());return this.setPropStoreFieldValue("painter",o),o},chemObjChanged:function(e,t){this.doLoad(e),this.getResetAfterLoad()&&t&&this.resetDisplay()},load:function(e){this.setChemObj(e)},doLoad:function(e){this.refitDrawContext(!0),this.setPropStoreFieldValue("chemObjLoaded",!1);try{if(e)this.createNewPainter(e).setRenderConfigs(this.getRenderConfigs()),this.repaint(),this.setPropStoreFieldValue("chemObjLoaded",!0),this.invokeEvent("load",{obj:e});else this.clearContext(),this.invokeEvent("load",{obj:e})}catch(e){this.clearContext(),this.reportException(e)}finally{this.doLoadEnd(this.getChemObj())}},doLoadEnd:function(e){},_tryAutoGenerateChemObjCoords:function(e,t){if(e instanceof Kekule.Molecule&&this.getDisplayerConfigs().getIoConfigs().getAutoGenerateCoordsAfterLoad()&&Kekule.Calculator&&Kekule.Calculator.generateStructure){var o=this.getCoordMode()===Kekule.CoordMode.COORD3D;if(e.nodesHasCoordOfMode(this.getCoordMode(),this.getAllowCoordBorrow(),!0))t(e);else{var r=o?Kekule.Calculator.Services.GEN3D:Kekule.Calculator.Services.GEN2D;Kekule.Calculator.generateStructure(e,r,{modifySource:!0},function(e){t(e)},function(o){t(e),Kekule.error(o)})}}else t(e)},_tryAutoGenerateChemObjCoordsAndLoad:function(e){var t=this;this._tryAutoGenerateChemObjCoords(e,function(e){t.setChemObj(e)})},loadFromData:function(e,t,o){try{if(e){var r=Kekule.IO.loadTypedData(e,t,o);return r?this._tryAutoGenerateChemObjCoordsAndLoad(r):Kekule.error(Kekule.$L("ErrorMsg.LOAD_CHEMDATA_FAILED")),r}return this.setChemObj(null),null}catch(e){this.reportException(e)}},loadFromFile:function(e){if(e){var t=this;try{Kekule.IO.loadFileData(e,function(e,o){o&&t._tryAutoGenerateChemObjCoordsAndLoad(e)})}catch(e){this.reportException(e)}}else this.setChemObj(null)},getSavingTargetObj:function(){return this.getChemObj()},saveData:function(e,t,o){o=o||this.getSavingTargetObj();this.prepareSaveData(o);var r=Kekule.IO.ChemDataWriterManager.getWriterByFormat(e,null,o);if(r){if(this._needToCanonicalizeBeforeSaving()&&this.getDisplayerConfigs().getIoConfigs().getCanonicalizeBeforeSave()&&o.standardize)(o=o.clone?o.clone(!0):o).standardize(this.getStandardizationOptions());if(!t)t=Kekule.IO.DataFormatsManager.getFormatInfo(e).dataType;return r.writeData(o,t,e)}return Kekule.error(Kekule.$L("ErrorMsg.NO_SUITABLE_WRITER_FOR_FORMAT")),null},_needToCanonicalizeBeforeSaving:function(){return!1},prepareSaveData:function(e){},getDrawClientDimension:function(){return Kekule.HtmlElementUtils.getElemClientDimension(this.getCoreElement())},setDrawDimension:function(e,t){this.setDimension(e,t)},calcDrawBaseCoord:function(e){var t,o,r=this.getDrawContext(),i=this.getPainter();if(!this._isContinuousRepainting&&this.getAutoSize()&&this.allowAutoSize()){var n=this.getPadding()||0,a=i.estimateScreenBox(r,t,e,this.getAllowCoordBorrow());if(a){var l=a.x2-a.x1+2*n,s=a.y2-a.y1+2*n;this.changeContextDimension({width:l,height:s}),this.setDrawDimension(l,s),o={width:l,height:s},t={x:l/2,y:s/2}}}else if(!(t=e?e.baseCoord:null)){var d=this.getDrawClientDimension();t={x:d.width/2,y:d.height/2};var u=this.getBaseCoordOffset();u&&(t=Kekule.CoordUtils.add(t,u))}return{baseCoord:t=this.getDrawBridge().transformScreenCoordToContext(r,t),baseCoordPos:Kekule.Render.CoordPos.CENTER,newWidgetDimension:o}},getActualDrawOptions:function(){return this.getDrawOptions()},calcDrawParams:function(e){var t=this.getActualDrawOptions();e&&(t=Object.extend(t,e));var o=this.calcDrawBaseCoord(t);return{drawOptions:t,baseCoord:o.baseCoord,baseCoordPos:o.baseCoordPos,newWidgetDimension:o.newWidgetDimension}},_savePainterInitialRenderTransformOptions:function(e,t){var o=t.getActualInitialRenderTransformOptions(e);this._contextTransformOpsMap.set(e,o)},requestRepaint:function(e){this._requestRepainting={overrideOptions:e};var t=this;(function(){t._requestRepainting&&t._repaintCore(t._requestRepainting.overrideOptions),t._requestRepainting=null}).delay(0)},repaint:function(e){if(!this.isUpdating()){try{var t=this._repaintCore(e)}finally{this._requestRepainting=null}return t}this._requestRepainting={overrideOptions:e}},_repaintCore:function(e){if(this.getElement()&&!this.isPainting()){this.beginPaint();try{if(this.getInheritedRenderBackgroundColor()){var t=this.getComputedStyle("backgroundColor");this.backgroundColorChanged(!0,t||null)}else this.backgroundColorChanged(!0);if(e&&e.doNotClear||this.clearContext(),!this.getChemObj())return;var o,r,i=this.getPainter(),n=this.getDrawContext(),a=!0;if(e&&e.preserveTransformOptions?(r=this._contextTransformOpsMap.get(n)||null,a=!1,o=this.calcDrawParams(r)):o=this.calcDrawParams(e),this._lastBaseCoord=o.baseCoord,this.getInheritedRenderColor()){var l=this.getComputedStyle("color");o.drawOptions.color=l}else o.drawOptions.color=null;this.getEnableCustomCssProperties()&&this._applyCustomCssProps(o.drawOptions),this._setupRenderingEnvironment(n,this.getDrawBridge()),i.draw(n,o.baseCoord,o.drawOptions),a&&this._savePainterInitialRenderTransformOptions(n,i),this.invokeEvent("repaint",{obj:this.getChemObj()})}finally{this.endPaint()}}},_setupRenderingEnvironment:function(e,t){var o=this.getDisplayerEnvironmentConfigs();if(o.getAntialias&&o.getAntialias()&&(i=o.getAntialiasBlurRatio&&o.getAntialiasBlurRatio()||0)){var r=this.getRenderConfigs().getLengthConfigs(),i=o.getAntialiasBlurRatio()||0,n=r.getActualLength("bondLineWidth")*i||0,a=t||this.getDrawBridge();a.setFilter&&a.clearFilter&&(n?a.setFilter(e,"blur("+n+"px)"):a.clearFilter(e))}},beginPaint:function(){this._paintFlag||(this._paintFlag=0),++this._paintFlag},endPaint:function(){this._paintFlag>0&&--this._paintFlag,this._paintFlag<0&&(this._paintFlag=0)},isPainting:function(){return this._paintFlag>0},getBackgroundColorOfType:function(e){return this._bgColorMap[e.toString()]},setBackgroundColorOfType:function(e,t){this._bgColorMap[t.toString()]=e,t===this.getRenderType()&&this.setBackgroundColor(e)},backgroundColorChanged:function(e,t){var o=t;void 0===o&&(o=this.getBackgroundColor()),"transparent"===o&&(o=null);var r=this.getDrawBridge(!0);r&&r.setClearColor&&(r.setClearColor(this.getDrawContext(),o),e||this.requestRepaint())},_getApplicableCustomCssPropNames:function(){return{r2d:["unitLength","moleculeDisplayType","hydrogenDisplayLevel","showCharge","chargeMarkFontSize","chargeMarkMargin","chemMarkerFontSize","chemMarkerMargin","distinguishSingletAndTripletRadical","fontSize","fontFamily","supFontSizeRatio","subFontSizeRatio","superscriptOverhang","subscriptOversink","bondLineWidth","boldBondLineWidth","hashSpacing","multipleBondSpacingRatio","multipleBondSpacingAbs","multipleBondMaxAbsSpacing","bondArrowLength","bondArrowWidth","bondWedgeWidth","bondWedgeHashMinWidth","bondLengthScaleRatio","color","atomColor","bondColor","useAtomSpecifiedColor","opacity","fillColor","strokeColor","strokeWidth","atomRadius"],r3d:["displayMultipleBond","useVdWRadius","nodeRadius","connectorRadius","nodeRadiusRatio","connectorRadiusRatio","color","atomColor","bondColor","useAtomSpecifiedColor","hideHydrogens","bondSpliceMode"]}},_getRenderOptionDefinitionsHash:function(){if(!this.__$renderOptionDefinitionsHash__){this.__$renderOptionDefinitionsHash__={};var e,t,o=Kekule.Render.RenderOptionUtils.getOptionDefinitions(),r=Kekule.Render.Render3DOptionUtils.getOptionDefinitions();for(e=0,t=o.length;e<t;++e)this.__$renderOptionDefinitionsHash__[o[e].name]=o[e];for(e=0,t=r.length;e<t;++e)this.__$renderOptionDefinitionsHash__[r[e].name]=r[e]}return this.__$renderOptionDefinitionsHash__},_applyCustomCssProps:function(e){var t,o,r=this._getRenderOptionDefinitionsHash(),i=this._getApplicableCustomCssPropNames();for(t=0,o=i.r2d.length;t<o;++t){var n=i.r2d[t];this._applyCustomCssPropValue(n,r,e)}if(this.getRenderType()===Kekule.Render.RendererType.R3D)for(t=0,o=i.r3d.length;t<o;++t){n=i.r3d[t];this._applyCustomCssPropValue(n,r,e)}},_applyCustomCssPropValue:function(e,t,o){if(t[e]){var r=this.getComputedCustomStyle(e);if(r&&r.trim){r=r.trim();var i=Kekule.StrUtils.convertToType(r,t.dataType);Kekule.ObjUtils.notUnset(i)&&(o[e]=i)}}},drawOptionChanged:function(){this.repaint()},geometryOptionChanged:function(){var e=this.getPainter(),t=this.getDrawOptions();if(e.supportGeometryOptionChange()){var o=this.getDrawContext();e.changeGeometryOptions(o,t.baseCoord||this._lastBaseCoord,t),this._savePainterInitialRenderTransformOptions(o,e)}else this.drawOptionChanged()},beginContinuousRepainting:function(){this._isContinuousRepainting=!0},endContinuousRepainting:function(){this._isContinuousRepainting&&(this._isContinuousRepainting=!1,this.repaint())},resetDisplay:function(){var e=this.getDrawOptions();return e.zoom=this.getInitialZoom()||1,e.rotateX=0,e.rotateY=0,e.rotateZ=0,e.rotateAngle=0,e.rotateAxisVector=null,e.rotateMatrix=null,this.setBaseCoordOffset(null),this.geometryOptionChanged(),this},getCurrZoom:function(){return this.getDrawOptions().zoom||1},zoomTo:function(e,t){return this.getDrawOptions().zoom=e,t||this.geometryOptionChanged(),this},zoomIn:function(e){var o=this.getCurrZoom(),r=t.getNextZoomInRatio(o,e||1);return this.zoomTo(r)},zoomOut:function(e){var o=this.getCurrZoom(),r=t.getNextZoomOutRatio(o,e||1);return this.zoomTo(r)},resetZoom:function(){return this.zoomTo(this.getInitialZoom()||1)},getDefaultMoleculeDisplayType:function(e){return e===Kekule.Render.RendererType.R3D?Kekule.Render.Molecule3DDisplayType.DEFAULT:Kekule.Render.Molecule2DDisplayType.DEFAULT},getCurrMoleculeDisplayType:function(){var e=this.getDrawOptions().moleculeDisplayType;return e||(e=this.getDefaultMoleculeDisplayType(this.getRenderType())),e},setHideHydrogens:function(e){return this.getDrawOptions().hideHydrogens=e,this.drawOptionChanged(),this},exportToDataUri:function(e,t){return this.getDrawBridge().exportToDataUri(this.getDrawContext(),e,t)},createConfigurator:function(){var e=this.tryApplySuper("createConfigurator");return e.addEventListener("configChange",function(e){this.repaint()},this),e}}),Kekule.ChemWidget.ChemObjDisplayer.Settings=Class.create(Kekule.Widget.BaseWidget.Settings,{CLASS_NAME:"Kekule.ChemWidget.ChemObjDisplayer.Settings",initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineDelegatedProps(["enableLoadNewFile"])},getDisplayer:function(){return this.getWidget()}}),Kekule.ChemWidget.ChemObjDisplayer.Configurator=Class.create(Kekule.Widget.Configurator,{CLASS_NAME:"Kekule.ChemWidget.ChemObjDisplayer.Configurator",TAB_BTN_DATA_FIELD:"__$data__",initialize:function(e){this.tryApplySuper("initialize",[e])},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setLayout(Kekule.Widget.Layout.HORIZONTAL)},getCategoryInfos:function(){for(var e=this.tryApplySuper("getCategoryInfos"),t=this.getDisplayer(),o=[t.getDisplayerConfigs(),t.getRenderConfigs()],r=0,i=o.length;r<i;++r)for(var n=o[r],a=n.getPropListOfScopes([Class.PropertyScope.PUBLISHED]),l=0,s=a.getLength();l<s;++l){var d=a.getPropInfoAt(l),u=n.getPropValue(d.name);u&&e.push({obj:u,name:d.name,title:d.title,description:d.description})}return e},getDisplayer:function(){return this.getWidget()}}),Kekule.ChemWidget.ActionDisplayerLoadFile=Class.create(Kekule.ActionLoadFileData,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerLoadFile",HTML_CLASSNAME:r.ACTION_LOADFILE,initialize:function(e){this.tryApplySuper("initialize"),this.setDisplayer(e),this.setText(Kekule.$L("ChemWidgetTexts.CAPTION_LOADFILE")),this.setHint(Kekule.$L("ChemWidgetTexts.HINT_LOADFILE"))},initProperties:function(){this.defineProp("displayer",{dataType:"Kekule.ChemWidget.ChemObjDisplayer",serializable:!1})},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer();this.setEnabled(this.getEnabled()&&e&&e.getEnabled()&&e.getEnableLoadNewFile())},doDataLoaded:function(e,t,o){o&&this.getDisplayer().loadFromData(e,null,t)}}),Kekule.ChemWidget.ActionOnDisplayer=Class.create(Kekule.Action,{CLASS_NAME:"Kekule.ChemWidget.ActionOnDisplayer",initialize:function(e,t,o){this.tryApplySuper("initialize"),this.setDisplayer(e),this.setText(t),this.setHint(o)},initProperties:function(){this.defineProp("displayer",{dataType:"Kekule.ChemWidget.ChemObjDisplayer",serializable:!1})},doUpdate:function(){var e=this.getDisplayer();this.setEnabled(e&&e.getChemObj()&&e.getChemObjLoaded()&&e.getEnabled())},execute:function(e,t){return!this.getDisplayer()&&e instanceof Kekule.ChemWidget.ChemObjDisplayer&&this.setDisplayer(e),this.tryApplySuper("execute",[e,t])}}),Kekule.ChemWidget.ActionDisplayerClear=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerClear",HTML_CLASSNAME:r.ACTION_CLEAROBJS,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_CLEAROBJS"),Kekule.$L("ChemWidgetTexts.HINT_CLEAROBJS")])},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer();this.setEnabled(e&&e.getEnabled()&&e.getChemObj())},doExecute:function(e){this.getDisplayer().setChemObj(null)}}),Kekule.ChemWidget.ActionDisplayerLoadData=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerLoadData",HTML_CLASSNAME:r.ACTION_LOADDATA,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_LOADDATA"),Kekule.$L("ChemWidgetTexts.HINT_LOADDATA")])},finalize:function(){this.tryApplySuper("finalize")},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setDialogShowType(Kekule.Widget.ShowHideType.DROPDOWN)},initProperties:function(){this.defineProp("dataDialog",{dataType:"Kekule.ChemWidget.LoadDataDialog",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("dataDialog");return e||(e=this.createDataDialog(),this.setPropStoreFieldValue("dataDialog",e)),e}}),this.defineProp("dialogShowType",{dataType:DataType.INT})},createDataDialog:function(){var e=this.getDisplayer().getDocument();return new Kekule.ChemWidget.LoadDataDialog(e)},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer();this.setEnabled(e&&e.getEnabled()&&e.getEnableLoadNewFile())},doExecute:function(e){var t=this,o=this.getDataDialog();o.setAllowedFormatIds(this.getDisplayer().getAllowedInputFormatIds()||Kekule.IO.ChemDataReaderManager.getAllReadableFormatIds());o._formatSelector;var r=this.getDialogShowType();(r===Kekule.Widget.ShowHideType.DIALOG?o.openModal:o.open).apply(o,[function(e){if(o.isPositiveResult(e)){var r=o.getDataDetails()||{};t.getDisplayer().loadFromData(r.data,r.mimeType,r.fileName)}},e,r])}}),Kekule.ChemWidget.ActionDisplayerSaveFile=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerSaveFile",HTML_CLASSNAME:r.ACTION_SAVEFILE,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_SAVEFILE"),Kekule.$L("ChemWidgetTexts.HINT_SAVEFILE")]),this._saveAction=new Kekule.ActionFileSave},finalize:function(){this._saveAction.finalize(),this.tryApplySuper("finalize")},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setDialogShowType(Kekule.Widget.ShowHideType.DROPDOWN)},initProperties:function(){this.defineProp("formatDialog",{dataType:"Kekule.Widget.Dialog",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("formatDialog");return e||(e=this.createFormatDialog(),this.setPropStoreFieldValue("formatDialog",e)),e}}),this.defineProp("lastFormat",{dataType:DataType.STRING,serializable:!1}),this.defineProp("currSaveData",{dataType:DataType.VARIANT,serializable:!1}),this.defineProp("dialogShowType",{dataType:DataType.INT})},getChemObjSrcInfo:function(e){var t=this.getDisplayer();return t.getChemObjSrcInfo?t.getChemObjSrcInfo(e):e.getSrcInfo?e.getSrcInfo():null},getChemObjSrcFormat:function(e){var t=this.getChemObjSrcInfo(e);return t?t.format:null},createFormatDialog:function(){var e=this.getDisplayer().getDocument(),t=new Kekule.Widget.Dialog(e,Kekule.$L("ChemWidgetTexts.CAPTION_SAVEDATA_DIALOG"),[Kekule.Widget.DialogButtons.OK,Kekule.Widget.DialogButtons.CANCEL]);t.addClassName(r.DIALOG_CHOOSE_FILE_FORAMT),t.setAutoAdjustSizeOnPopup(!0),(o=e.createElement("div")).innerHTML=Kekule.$L("ChemWidgetTexts.CAPTION_SELECT_FORMAT"),t.getClientElem().appendChild(o),o=e.createElement("div"),t.getClientElem().appendChild(o);var o,i=new Kekule.Widget.SelectBox(t);i.addClassName(r.DIALOG_CHOOSE_FILE_FORAMT_FORMATBOX),i.appendToElem(o),i.addEventListener("valueChange",this.reactFormatSelectorChange,this),t._formatSelector=i,(o=e.createElement("div")).innerHTML=Kekule.$L("ChemWidgetTexts.CAPTION_PREVIEW_FILE_CONTENT"),t.getClientElem().appendChild(o),(o=e.createElement("div")).className=r.DIALOG_CHOOSE_FILE_FORAMT_PREVIEWER_REGION,t.getClientElem().appendChild(o);var n=new Kekule.Widget.TextEditor(t);return n.setReadOnly(!0),n.setWrap("off").setAutoWrapThreshold(!0),n.setToolbarPos(Kekule.Widget.Position.BOTTOM),n.addClassName(r.DIALOG_CHOOSE_FILE_FORAMT_PREVIEWER),n.appendToElem(o),t._previewTextArea=n,t.setResizable&&t.setResizable(!0),t},getAvailableWriterInfos:function(e){return e?Kekule.IO.ChemDataWriterManager.getAvailableWriterInfos(null,e):[]},getFormatSelectorItems:function(e,t){for(var o=[],r=[],i=this.getChemObjSrcInfo(e),n=i?i.format:null,a=0,l=t.length;a<l;++a){var s=t[a];Kekule.ArrayUtils.pushUnique(r,s.formatId)}for(a=0,l=(r=Kekule.ArrayUtils.intersect(this.getAllowedFormatIds(),r)).length;a<l;++a){var d=Kekule.IO.DataFormatsManager.getFormatInfo(r[a]);if(d){for(var u=Kekule.ArrayUtils.clone(Kekule.ArrayUtils.toArray(d.fileExts)),c=0,p=u.length;c<p;++c)u[c]="*."+u[c];var h=u.join(", "),g=d.title;h&&(g+=" ("+h+")");var C=n?r[a]===n:this.getLastFormat()?this.getLastFormat()===r[a]:0===a;o.push({value:d.id,text:g,title:d.mimeType,data:d,selected:C})}}return o.sort(function(e,t){return e.text<t.text?-1:e.text>t.text?1:0}),o},getAllowedFormatIds:function(){return this.getDisplayer().getAllowedOutputFormatIds()||Kekule.IO.ChemDataWriterManager.getAllWritableFormatIds()},getFileFilters:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o],n=i.data,a=i.text||i.title||i.value,l=Kekule.ArrayUtils.toArray(n.fileExts);t.push({title:a,filter:"."+l.join(",.")})}return t.push(Kekule.NativeServices.FILTER_ALL_SUPPORT),t.push(Kekule.NativeServices.FILTER_ANY),t},updateFormatItems:function(e){this._formatItems=this.getFormatSelectorItems(e,this.getAvailableWriterInfos()),this._formatSelector.setItems(this._formatItems);var t=this.getFileFilters(this._formatItems);this._saveAction.setFilters(t)},reactFormatSelectorChange:function(){var e=this.getFormatDialog()._formatSelector.getValue();this.updatePreview(e,this.getFormatDialog())},updatePreview:function(e,t){var o=t._previewTextArea;if(o.setValue(""),e){var r=Kekule.IO.DataFormatsManager.getFormatInfo(e),i=this.getTargetObj(),n=this.getChemObjSrcInfo(i);if(n&&n.format===e&&n.data)o.setValue(n.data),this.setCurrSaveData(n.data);else{var a=this.getDisplayer().saveData(e,r.dataType,i);o.setValue(a),this.setCurrSaveData(a)}}},getTargetObj:function(e){return this.getDisplayer().getSavingTargetObj()},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer();this._saveAction&&this._saveAction.update(),this.setEnabled(e&&e.getEnabled()&&e.getChemObj())},doExecute:function(e){var t=this,o=this.getFormatDialog(),r=this.getTargetObj(),i=o._formatSelector,n=this.getAvailableWriterInfos(r),a=this.getFormatSelectorItems(r,n);i.setItems(a),this.reactFormatSelectorChange();var l=!1;this._saveAction&&(l=this._saveAction.getEnabled());var s=o.getDialogButton(Kekule.Widget.DialogButtons.OK);s&&s.setEnabled(l);var d=this.getDialogShowType();(d===Kekule.Widget.ShowHideType.DIALOG?o.openModal:o.open).apply(o,[function(r){if(r===Kekule.Widget.DialogButtons.OK){var i=t.getCurrSaveData();t._saveAction.setData(i);var n=o._formatSelector.getValue();t.setLastFormat(n);var a=Kekule.IO.DataFormatsManager.getFormatInfo(n),l=a.fileExts,s=Kekule.ArrayUtils.toArray(l[0]||l),d=[{title:a.title||a.mimeType,filter:"."+s.join(",.")},Kekule.NativeServices.FILTER_ANY],u=Kekule.$L("ChemWidgetTexts.S_DEF_SAVE_FILENAME")+"."+s;t._saveAction.setFileName(u),t._saveAction.setFilters(d),t._saveAction.execute(e)}},e,d])}}),Kekule.ChemWidget.ActionDisplayerCopy=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerCopy",HTML_CLASSNAME:r.ACTION_COPY,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_COPY_WHOLE"),Kekule.$L("ChemWidgetTexts.HINT_COPY_WHOLE")])},doUpdate:function(){if(this.tryApplySuper("doUpdate"),this.getEnabled()){var e=this.getDisplayer().getChemObj();this.setEnabled(e&&e.clone)}},doExecute:function(){var e=this.getDisplayer();if(e){var t=e.getChemObj();t&&Kekule.Widget.clipboard.setObjects(Kekule.IO.MimeType.JSON,[t])}}}),Kekule.ChemWidget.ActionDisplayerReset=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerReset",HTML_CLASSNAME:r.ACTION_RESET,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_RESETVIEW"),Kekule.$L("ChemWidgetTexts.HINT_RESETVIEW")])},doExecute:function(){this.getDisplayer().resetDisplay()}}),Kekule.ChemWidget.ActionDisplayerZoomIn=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerZoomIn",HTML_CLASSNAME:r.ACTION_ZOOMIN,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_ZOOMIN"),Kekule.$L("ChemWidgetTexts.HINT_ZOOMIN")])},doExecute:function(){this.getDisplayer().zoomIn()}}),Kekule.ChemWidget.ActionDisplayerZoomOut=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerZoomOut",HTML_CLASSNAME:r.ACTION_ZOOMOUT,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_ZOOMOUT"),Kekule.$L("ChemWidgetTexts.HINT_ZOOMOUT")])},doExecute:function(){this.getDisplayer().zoomOut()}}),Kekule.ChemWidget.ActionDisplayerResetZoom=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerResetZoom",HTML_CLASSNAME:r.ACTION_RESET_ZOOM,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_RESETZOOM"),Kekule.$L("ChemWidgetTexts.HINT_RESETZOOM")])},doExecute:function(){this.getDisplayer().resetZoom()}}),Kekule.ChemWidget.ActionDisplayerHideHydrogens=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerHideHydrogens",HTML_CLASSNAME:r.ACTION_MOL_HIDE_HYDROGENS,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_HIDEHYDROGENS"),Kekule.$L("ChemWidgetTexts.HINT_HIDEHYDROGENS")])},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer(),t=e&&e.getRenderType()===Kekule.Render.RendererType.R3D;this.setDisplayed(t).setEnabled(this.getEnabled()&&t)},doExecute:function(){var e=!this.getChecked();this.setChecked(e),this.getDisplayer().setHideHydrogens(e)}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,t,o]),this._displayType=r,this.setCheckGroup("__molDisplayType__")},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer();this.setChecked(e&&e.getCurrMoleculeDisplayType()===this.getMolDisplayType())},doExecute:function(){this.getDisplayer().setMoleculeDisplayType(this._displayType),this.setChecked(!0)},getMolDisplayType:function(){return this._displayType}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase2D=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase2D",doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer(),t=e&&e.getRenderType()===Kekule.Render.RendererType.R2D;this.setDisplayed(t).setEnabled(this.getEnabled()&&t)}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase3D=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase3D",doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getDisplayer(),t=e&&e.getRenderType()===Kekule.Render.RendererType.R3D;this.setDisplayed(t).setEnabled(this.getEnabled()&&t)}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSkeletal=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase2D,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSkeletal",HTML_CLASSNAME:r.ACTION_MOL_DISPLAY_SKELETAL,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_SKELETAL"),Kekule.$L("ChemWidgetTexts.HINT_SKELETAL"),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSkeletal.TYPE])}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSkeletal.TYPE=Kekule.Render.Molecule2DDisplayType.SKELETAL,Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeCondensed=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase2D,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeCondensed",HTML_CLASSNAME:r.ACTION_MOL_DISPLAY_CONDENSED,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_CONDENSED"),Kekule.$L("ChemWidgetTexts.HINT_CONDENSED"),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeCondensed.TYPE])}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeCondensed.TYPE=Kekule.Render.Molecule2DDisplayType.CONDENSED,Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeWire=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase3D,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeWire",HTML_CLASSNAME:r.ACTION_MOL_DISPLAY_WIRE,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_WIRE"),Kekule.$L("ChemWidgetTexts.HINT_WIRE"),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeWire.TYPE])}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeWire.TYPE=Kekule.Render.Molecule3DDisplayType.WIRE,Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSticks=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase3D,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSticks",HTML_CLASSNAME:r.ACTION_MOL_DISPLAY_STICKS,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_STICKS"),Kekule.$L("ChemWidgetTexts.HINT_STICKS"),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSticks.TYPE])}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSticks.TYPE=Kekule.Render.Molecule3DDisplayType.STICKS,Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBallStick=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase3D,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBallStick",HTML_CLASSNAME:r.ACTION_MOL_DISPLAY_BALLSTICK,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_BALLSTICK"),Kekule.$L("ChemWidgetTexts.HINT_BALLSTICK"),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBallStick.TYPE])}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBallStick.TYPE=Kekule.Render.Molecule3DDisplayType.BALL_STICK,Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSpaceFill=Class.create(Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeBase3D,{CLASS_NAME:"Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSpaceFill",HTML_CLASSNAME:r.ACTION_MOL_DISPLAY_SPACEFILL,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_SPACEFILL"),Kekule.$L("ChemWidgetTexts.HINT_SPACEFILL"),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSpaceFill.TYPE])}}),Kekule.ChemWidget.ActionDisplayerChangeMolDisplayTypeSpaceFill.TYPE=Kekule.Render.Molecule3DDisplayType.SPACE_FILL}(),function(){"use strict";var e=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{CHEM_STRUCT_TREE_VIEW:"K-Chem-Struct-TreeView",CHEM_STRUCT_TREE_VIEW_ITEM_TITLE:"K-Chem-Struct-TreeView-ItemTitle",CHEM_STRUCT_TREE_VIEW_ITEM_TYPE:"K-Chem-Struct-TreeView-ItemType"}),Kekule.ChemWidget.StructureTreeView=Class.create(Kekule.Widget.TreeView,{CLASS_NAME:"Kekule.ChemWidget.StructureTreeView",initialize:function(e,t){this.tryApplySuper("initialize",[e]),this.setPropStoreFieldValue("objMap",new Kekule.MapEx(!0)),this.setEnableLiveUpdate(!0),this.setEnableMultiSelect(!0),this.setRootObj(t),this._pauseLiveUpdateFlag=0,this._changedObjects=[]},initProperties:function(){this.defineProp("rootObj",{dataType:"Kekule.ChemObject",serializable:!1,setter:function(e){var t=this.getPropStoreFieldValue("rootObj");this.setPropStoreFieldValue("rootObj",e),this.rootObjChanged(e,t)}}),this.defineProp("enableLiveUpdate",{dataType:DataType.BOOL}),this.defineProp("objMap",{dataType:"Kekule.MapEx",setter:null,serializable:!1})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+e.CHEM_STRUCT_TREE_VIEW},rootObjChanged:function(e,t){this.clearChildItems(),this.getObjMap().clear(),t&&this._uninstallRootEventHandler(t),e&&(this._fillTree(e),this._installRootEventHandler(e))},pauseLiveUpdate:function(){return this._pauseLiveUpdateFlag>=0&&(this._pauseLiveUpdateFlag=0,this._changedObjects=[]),--this._pauseLiveUpdateFlag,this},resumeLiveUpdate:function(){if(++this._pauseLiveUpdateFlag,this._pauseLiveUpdateFlag>=0){this._pauseLiveUpdateFlag=0;for(var e=0,t=this._changedObjects.length;e<t;++e)this.refreshObject(this._changedObjects[e])}},isLiveUpdatePaused:function(){return this._pauseLiveUpdateFlag<0},_installRootEventHandler:function(e){e.addEventListener("change",this.reactChemObjChange,this)},_uninstallRootEventHandler:function(e){e.removeEventListener("change",this.reactChemObjChange,this)},reactChemObjChange:function(e){this.getEnableLiveUpdate()&&(this.isLiveUpdatePaused()?this.getObjMap().get(e.target)&&Kekule.ArrayUtils.pushUnique(this._changedObjects,e.target):this.refreshObject(e.target))},refreshObject:function(e){var t=this.getObjMap().get(e);return t&&this._updateTreeItem(t,e),this},_fillTree:function(e){e&&(this.clearChildItems(),this._updateTreeItem(this.appendChildItem(),e))},_updateTreeItem:function(e,t){var o={text:this._getChemObjDisplayTitle(t),obj:t};this.setItemData(e,o),this.getObjMap().set(t,e);for(var r=this.getChildItemCount(e),i=t.getChildCount(),n=0;n<i;++n){var a,l=t.getChildAt(n);a=n<r?this.getChildItemAt(e,n):this.appendChildItem(e),this._updateTreeItem(a,l)}if(r>i)for(n=r-1;n>=i;--n)this.removeChildItemAt(e,n)},_getChemObjDisplayTitle:function(t){var o="",r=t.getId();r&&(o+='<span class="'+e.CHEM_STRUCT_TREE_VIEW_ITEM_TITLE+'">'+r+"</span>");var i=t.getClassName(),n=i.split("."),a=n.length?n[n.length-1]:i;return o+('<span class="'+e.CHEM_STRUCT_TREE_VIEW_ITEM_TYPE+'">('+a+")</span>")},selectChemObjs:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o],n=this.getObjMap().get(i);n&&t.push(n)}return this.select(t),this},getSelectedChemObjs:function(){var e=[],t=this.getSelection();if(t&&t.length)for(var o=0,r=t.length;o<r;++o){var i=this.getItemData(t[o]);i&&i.obj&&e.push(i.obj)}return e}})}(),function(){"use strict";Kekule.oneOf;Kekule.ChemWidget.AbstractUIMarker=Class.create(ObjectEx,{CLASS_NAME:"Kekule.ChemWidget.AbstractUIMarker",initialize:function(){this.tryApplySuper("initialize"),this.setVisible(!0)},initProperties:function(){this.defineProp("drawStyles",{dataType:DataType.OBJECT}),this.defineProp("visible",{dataType:DataType.BOOL})}}),Kekule.ChemWidget.MetaShapeUiMarker=Class.create(Kekule.ChemWidget.AbstractUIMarker,{CLASS_NAME:"Kekule.ChemWidget.MetaShapeUiMarker",initialize:function(e){this.tryApplySuper("initialize"),e&&this.setShapeInfo(e)},initProperties:function(){this.defineProp("shapeInfo",{dataType:DataType.OBJECT}),this.defineProp("shapeType",{dataType:DataType.INT,serializable:!1,setter:null,getter:function(){var e=this.getShapeInfo();return e?e.shapeType:null}})}}),Kekule.ChemWidget.MetaShapeUIMarker=Kekule.ChemWidget.MetaShapeUiMarker,Kekule.ChemWidget.TextUiMarker=Class.create(Kekule.ChemWidget.AbstractUIMarker,{CLASS_NAME:"Kekule.ChemWidget.TextUiMarker",initialize:function(e,t){this.tryApplySuper("initialize"),e&&this.setText(e),t&&this.setCoord(t)},initProperties:function(){this.defineProp("text",{dataType:DataType.STRING}),this.defineProp("coord",{dataType:DataType.HASH})}}),Kekule.ChemWidget.UiMarkerCollection=Class.create(ObjectEx,{CLASS_NAME:"Kekule.ChemWidget.UiMarkerCollection",initProperties:function(){this.defineProp("markers",{dataType:DataType.ARRAY,getter:function(){var e=this.getPropStoreFieldValue("markers");return e||(e=[],this.setPropStoreFieldValue("markers",e)),e},setter:null})},getMarkerCount:function(){return this.getMarkers().length},getMarkerAt:function(e){return this.getMarkers()[e]},addMarker:function(e){return this.getMarkers().push(e)},indexOfMarker:function(e){return this.getMarkers().indexOf(e)},removeMarker:function(e){var t=this.getMarkers(),o=t.indexOf(e);o>=0&&t.splice(o,1)},clearMarkers:function(){this.setPropStoreFieldValue("markers",[])}}),Kekule.ChemWidget.UiMarker2DRenderer=Class.create(Kekule.Render.Base2DRenderer,{CLASS_NAME:"Kekule.ChemWidget.UiMarkerRenderer"}),Kekule.ChemWidget.MetaShapeUiMarker2DRenderer=Class.create(Kekule.ChemWidget.UiMarker2DRenderer,{CLASS_NAME:"Kekule.ChemWidget.MetaShapeUiMarker2DRenderer",doDrawSelf:function(e,t,o){var r=this.getChemObj(),i=r.getShapeInfo();if(!i)return null;var n,a=Object.create(o);if((a=Object.extend(a,r.getDrawStyles()||{})).color&&(a.strokeColor||(a.strokeColor=a.color),a.fillColor||(a.fillColor=a.color)),Kekule.Render.MetaShapeUtils.isCompositeShape(i))if(i.length>1){n=this.createDrawGroup(e);for(var l=0,s=i.length;l<s;++l){var d=i[l];this.doDrawShape(e,n,d,a)}}else{if(1!==i.length)return null;n=this.doDrawShape(e,null,i[0],a)}else n=this.doDrawShape(e,null,i,a);return n},doDrawShape:function(e,t,o,r){var i,n=Kekule.Render.MetaShapeType;if(Kekule.Render.MetaShapeUtils.isCompositeShape(o)){i=this.createDrawGroup(e);for(var a=0,l=o.length;a<l;++a)this.doDrawShape(e,i,o[a],r)}else{var s=o.coords;switch(o.shapeType){case n.POINT:i=this.drawCircle(e,s[0],1,r);break;case n.CIRCLE:i=this.drawCircle(e,s[0],o.radius,r);break;case n.LINE:var d=r;o.width&&((d=Object.create(r)).strokeWidth=o.width),i=this.drawLine(e,s[0],s[1],d);break;case n.RECT:i=this.drawRect(e,s[0],s[1],r);break;case n.ARC:(d=Object.extend({},r)).strokeWidth=o.width,d.fillColor=null,i=this.drawArc(e,s[0],o.radius,o.startAngle,o.endAngle,o.anticlockwise,d);break;case n.POLYGON:case n.POLYLINE:var u=[];for(a=0,l=s.length;a<l;++a){var c=0===a?"M":"L";u.push(c);var p=[s[a].x,s[a].y];u.push(p)}o.shapeType===n.POLYGON&&(u.push("L"),p=[s[0].x,s[0].y],u.push(p));var h=Kekule.Render.DrawPathUtils.makePath.apply(this,u);i=this.drawPath(e,h,r)}}return t&&this.addToDrawGroup(i,t),i}}),Kekule.ChemWidget.TextUiMarker2DRenderer=Class.create(Kekule.ChemWidget.UiMarker2DRenderer,{CLASS_NAME:"Kekule.ChemWidget.TextUiMarker2DRenderer",doDrawSelf:function(e,t,o){var r=this.getChemObj(),i={textBoxXAlignment:Kekule.Render.BoxXAlignment.CENTER,textBoxYAlignment:Kekule.Render.BoxYAlignment.CENTER};i=Object.extend(i,o),i=Object.extend(i,r.getDrawStyles()||{});var n=r.getCoord();return r.getText()&&n?this.drawText(e,n,r.getText(),i):null}}),Kekule.ChemWidget.UiMarkerCollection2DRenderer=Class.create(Kekule.ChemWidget.UiMarker2DRenderer,{CLASS_NAME:"Kekule.ChemWidget.UiMarkerCollection2DRenderer",getChildObjs:function(){for(var e=this.getChemObj().getMarkers(),t=[],o=0,r=e.length;o<r;++o)e[o].getVisible()&&t.push(e[o]);return t}}),Kekule.Render.Renderer2DFactory.register(Kekule.ChemWidget.MetaShapeUiMarker,Kekule.ChemWidget.MetaShapeUiMarker2DRenderer),Kekule.Render.Renderer2DFactory.register(Kekule.ChemWidget.TextUiMarker,Kekule.ChemWidget.TextUiMarker2DRenderer),Kekule.Render.Renderer2DFactory.register(Kekule.ChemWidget.UiMarkerCollection,Kekule.ChemWidget.UiMarkerCollection2DRenderer),Kekule.ChemWidget.UiMarkersRenderer=Class.create(Kekule.Render.Base2DRenderer,{CLASS_NAME:"Kekule.ChemWidget.UiMarkersRenderer",DRAW_ELEM_FIELD:"__$drawElem__",initialize:function(e,t){this.tryApplySuper("initialize",[e,t]),this._drawGroup=null},initProperties:function(){},getObjDrawElem:function(e,t){return this.getExtraProp2(e,t,this.DRAW_ELEM_FIELD)},setObjDrawElem:function(e,t,o){this.setExtraProp2(e,t,this.DRAW_ELEM_FIELD,o)},doEstimateRenderBox:function(e,t,o,r){return null},doDraw:function(e,t,o){this.tryApplySuper("doDraw",[e,t,o]);var r=this.getChemObj(),i=this.createDrawGroup(e);return this.setObjDrawElem(e,r,i),r.getMarkerCount()>0&&this.doDrawMarkers(e,i,r.getMarkers(),o),i},doUpdate1:function(e,t,o){if(this.canModifyGraphic(e)){var r=!1,i=Kekule.Render.ObjectUpdateType;switch(o){case i.ADD:r=this.doAddNew(e,t);break;case i.MODIFY:r=this.doModify(e,t);break;case i.REMOVE:var n=this._extractObjsOfUpdateObjDetails(t);r=this.doRemove(e,n);break;default:return this.tryApplySuper("doUpdate1",[e,t,o])}return r}return this.tryApplySuper("doUpdate1",[e,t,o])},doAddNew:function(e,t){return!!this.canRemoveElem()&&this.doModify(e,t)},doModify:function(e,t){if(!this.canRemoveElem())return!1;var o=this._extractObjsOfUpdateObjDetails(t);this.remove(e,o);var r=this.getChemObj(),i=this.getObjDrawElem(r),n=this.getDrawParams();o.indexOf(r)>=0?this.draw(e,n.baseCoord,n.options):this.doDrawMarkers(e,i,o,n.options)},doRemove:function(e,t){if(!this.canRemoveElem())return!1;var o=this.getObjDrawElem(t);if(o){var r=this.getObjDrawElem(this.getChemObj());this.doRemoveFromGroup(o,r),this.doRemoveElem(e,o),this.setObjDrawElem(t,null)}},doDrawMarkers:function(e,t,o,r){for(var i=0,n=o.length;i<n;++i){var a=o[i];a.getVisible()&&this.doDrawMarker(e,t,a,r)}},doDrawMarker:function(e,t,o,r){var i=o.getShapeInfo();if(!i)return null;var n,a=Object.create(r);if((a=Object.extend(o.getDrawStyles()||{})).color&&(a.strokeColor||(a.strokeColor=a.color),a.fillColor||(a.fillColor=a.color)),Kekule.ArrayUtils.isArray(i))if(i.length>1){n=this.createDrawGroup(e);for(var l=0,s=i.length;l<s;++l){var d=i[l];this.doDrawShape(e,n,d,a)}}else{if(1!==i.length)return null;n=this.doDrawShape(e,null,i[0],a)}else n=this.doDrawShape(e,null,i,a);return n&&(this.setObjDrawElem(e,o,n),t&&this.addToDrawGroup(n,t)),n},doDrawShape:function(e,t,o,r){var i,n=Kekule.Render.MetaShapeType;if(Kekule.Render.MetaShapeUtils.isCompositeShape(o)){i=this.createDrawGroup(e);for(var a=0,l=o.length;a<l;++a)this.doDrawShape(e,i,o[a],r)}else{var s=o.coords;switch(o.shapeType){case n.POINT:i=this.drawCircle(e,s[0],1,r);break;case n.CIRCLE:i=this.drawCircle(e,s[0],o.radius,r);break;case n.LINE:var d=r;o.width&&((d=Object.create(r)).strokeWidth=o.width),i=this.drawLine(e,s[0],s[1],d);break;case n.RECT:i=this.drawRect(e,s[0],s[1],r);break;case n.POLYGON:case n.POLYLINE:var u=[];for(a=0,l=s.length;a<l;++a){var c=0===a?"M":"L";u.push(c);var p=[s[a].x,s[a].y];u.push(p)}o.shapeType===n.POLYGON&&(u.push("L"),p=[s[0].x,s[0].y],u.push(p));var h=Kekule.Render.DrawPathUtils.makePath.apply(this,u);i=this.drawPath(e,h,r)}}return t&&this.addToDrawGroup(i,t),i}}),Kekule.ClassDefineUtils.addExtraTwoTupleObjMapSupport(Kekule.ChemWidget.UiMarkersRenderer)}(),function(){"use strict";var e=Class.PropertyScope,t=Kekule.ArrayUtils,o=(Kekule.ZoomUtils,Kekule.ChemWidget.ComponentWidgetNames),r=Kekule.ChemWidget,i=Kekule.Widget.EvokeMode;Kekule.globalOptions.add("chemWidget.viewer",{toolButtons:[o.loadData,o.saveData,o.molDisplayType,o.molHideHydrogens,o.zoomIn,o.zoomOut,o.rotateX,o.rotateY,o.rotateZ,o.rotateLeft,o.rotateRight,o.reset,o.copy,o.openEditor],menuItems:[o.loadData,o.saveData,Kekule.Widget.MenuItem.SEPARATOR_TEXT,o.molDisplayType,o.molHideHydrogens,o.zoomIn,o.zoomOut,{text:Kekule.$L("ChemWidgetTexts.CAPTION_ROTATE"),hint:Kekule.$L("ChemWidgetTexts.HINT_ROTATE"),children:[o.rotateLeft,o.rotateRight,o.rotateX,o.rotateY,o.rotateZ]},o.reset,Kekule.Widget.MenuItem.SEPARATOR_TEXT,o.copy,o.openEditor,o.config]}),Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{VIEWER:"K-Chem-Viewer",VIEWER2D:"K-Chem-Viewer2D",VIEWER3D:"K-Chem-Viewer3D",VIEWER_CAPTION:"K-Chem-Viewer-Caption",VIEWER_EMBEDDED_TOOLBAR:"K-Chem-Viewer-Embedded-Toolbar",VIEWER_MENU_BUTTON:"K-Chem-Viewer-Menu-Button",VIEWER_EDITOR_FULLCLIENT:"K-Chem-Viewer-Editor-FullClient",ACTION_ROTATE_LEFT:"K-Chem-RotateLeft",ACTION_ROTATE_RIGHT:"K-Chem-RotateRight",ACTION_ROTATE_X:"K-Chem-RotateX",ACTION_ROTATE_Y:"K-Chem-RotateY",ACTION_ROTATE_Z:"K-Chem-RotateZ",ACTION_VIEWER_EDIT:"K-Chem-Viewer-Edit"});var n=Kekule.Widget.HtmlClassNames,a=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.Viewer=Class.create(Kekule.ChemWidget.ChemObjDisplayer,{CLASS_NAME:"Kekule.ChemWidget.Viewer",BINDABLE_TAG_NAMES:["div","span","img"],DEF_BGCOLOR_2D:null,DEF_BGCOLOR_3D:"#000000",DEF_TOOLBAR_EVOKE_MODES:[i.EVOKEE_CLICK,i.EVOKEE_MOUSE_ENTER,i.EVOKEE_TOUCH],DEF_TOOLBAR_REVOKE_MODES:[i.EVOKEE_MOUSE_LEAVE,i.EVOKER_TIMEOUT],initialize:function(e,t,o,r){this.setPropStoreFieldValue("renderType",o||Kekule.Render.RendererType.R2D),this.setPropStoreFieldValue("enableToolbar",!1),this.setPropStoreFieldValue("toolbarEvokeModes",this.DEF_TOOLBAR_EVOKE_MODES),this.setPropStoreFieldValue("toolbarRevokeModes",this.DEF_TOOLBAR_REVOKE_MODES),this.setPropStoreFieldValue("enableDirectInteraction",!0),this.setPropStoreFieldValue("toolbarPos",Kekule.Widget.Position.AUTO),this.setPropStoreFieldValue("toolbarMarginHorizontal",10),this.setPropStoreFieldValue("toolbarMarginVertical",10),this.setPropStoreFieldValue("showCaption",!1),this.setPropStoreFieldValue("useCornerDecoration",!0),this.tryApplySuper("initialize",[e,t,o]),this.setPropStoreFieldValue("viewerConfigs",r||this.createDefaultConfigs()),this.beginUpdate();try{this.setPadding(this.getRenderConfigs().getLengthConfigs().getActualLength("autofitContextPadding")),this._isContinuousRepainting=!1;var i=Kekule.Render.RendererType,n=this.getRenderType()===i.R2D&&this.getBackgroundColor()||this.DEF_BGCOLOR_2D,a=this.getRenderType()===i.R3D&&this.getBackgroundColor()||this.DEF_BGCOLOR_3D;this.setBackgroundColorOfType(n,i.R2D),this.setBackgroundColorOfType(a,i.R3D),this.useCornerDecorationChanged(),this.doResize()}finally{this.endUpdate()}this.addIaController("default",new Kekule.ChemWidget.ViewerBasicInteractionController(this),!0)},doFinalize:function(){var e=this.getToolbar();this.tryApplySuper("doFinalize"),e&&e.finalize(),this._composerDialog&&this._composerDialog.finalize(),this._composerPanel&&this._composerPanel.finalize()},initProperties:function(){this.defineProp("viewerConfigs",{dataType:"Kekule.ChemWidget.ChemObjDisplayerConfigs",serializable:!1,getter:function(){return this.getDisplayerConfigs()},setter:function(e){return this.setDisplayerConfigs(e)}}),this.defineProp("allowedMolDisplayTypes",{dataType:DataType.ARRAY,scope:e.PUBLIC,setter:function(e){this.setPropStoreFieldValue("allowedMolDisplayTypes",e),this.updateUiComps()}}),this.defineProp("enableRestraintRotation3D",{dataType:DataType.BOOL}),this.defineProp("restraintRotation3DEdgeRatio",{dataType:DataType.FLOAT}),this.defineProp("enableHotKey",{dataType:DataType.FLOAT}),this.defineProp("enableEdit",{dataType:DataType.BOOL,getter:function(){return this.getPropStoreFieldValue("enableEdit")&&this.getCoordMode()!==Kekule.CoordMode.COORD3D}}),this.defineProp("shareEditorInstance",{dataType:DataType.BOOL}),this.defineProp("enableEditFromVoid",{dataType:DataType.BOOL}),this.defineProp("restrainEditorWithCurrObj",{dataType:DataType.BOOL}),this.defineProp("modalEdit",{dataType:DataType.BOOL}),this.defineProp("editorProperties",{dataType:DataType.HASH}),this.defineProp("toolButtons",{dataType:DataType.ARRAY,scope:e.PUBLIC,getter:function(){return this.getPropStoreFieldValue("toolButtons")},setter:function(e){this.setPropStoreFieldValue("toolButtons",e),this.updateToolbar()}}),this.defineProp("menuItems",{dataType:DataType.ARRAY,scope:e.PUBLIC,setter:function(e){this.setPropStoreFieldValue("menuItems",e),this.updateMenu()}}),this.defineProp("menu",{dataType:"Kekule.Widget.Menu",serializable:!1,scope:e.PRIVATE,setter:function(e){var t=this.getMenu();e!==t&&(t&&(t.finalize(),t=null),this.setPropStoreFieldValue("menu",e))}}),this.defineProp("toolbar",{dataType:"Kekule.Widget.ButtonGroup",serializable:!1,scope:e.PRIVATE,setter:function(e){var t=this.getToolbar(),o=this.getToolbarEvokeHelper();if(e!==t){if(t){t.finalize();var r=this.getToolbarEvokeHelper();r&&r.finalize(),t=null}o&&o.finalize(),this.setPropStoreFieldValue("toolbar",e),e&&this.setPropStoreFieldValue("toolbarEvokeHelper",new Kekule.Widget.DynamicEvokeHelper(this,e,this.getToolbarEvokeModes(),this.getToolbarRevokeModes()))}}}),this.defineProp("enableToolbar",{dataType:DataType.BOOL,setter:function(e){this.setPropStoreFieldValue("enableToolbar",e),this.updateToolbar()}}),this.defineProp("toolbarPos",{dataType:DataType.INT,enumSource:Kekule.Widget.Position,setter:function(e){this.setPropStoreFieldValue("toolbarPos",e),this.adjustToolbarPos()}}),this.defineProp("toolbarMarginVertical",{dataType:DataType.INT,setter:function(e){this.setPropStoreFieldValue("toolbarMarginVertical",e),this.adjustToolbarPos()}}),this.defineProp("toolbarMarginHorizontal",{dataType:DataType.INT,setter:function(e){this.setPropStoreFieldValue("toolbarMarginHorizontal",e),this.adjustToolbarPos()}}),this.defineProp("toolbarEvokeHelper",{dataType:"Kekule.Widget.DynamicEvokeHelper",serializable:!1,setter:null,scope:e.PRIVATE}),this.defineProp("toolbarEvokeModes",{dataType:DataType.ARRAY,scope:e.PUBLIC,setter:function(e){this.setPropStoreFieldValue("toolbarEvokeModes",e||[]),this.getToolbarEvokeHelper()&&this.getToolbarEvokeHelper().setEvokeModes(e||[])}}),this.defineProp("toolbarRevokeModes",{dataType:DataType.ARRAY,scope:e.PUBLIC,setter:function(e){this.setPropStoreFieldValue("toolbarRevokeModes",e||[]),this.getToolbarEvokeHelper()&&this.getToolbarEvokeHelper().setRevokeModes(e||[])}}),this.defineProp("toolbarRevokeTimeout",{dataType:DataType.INT,setter:function(e){this.setPropStoreFieldValue("toolbarRevokeTimeout",e),this.getToolbarEvokeHelper()&&this.getToolbarEvokeHelper().setTimeout(e)}}),this.defineProp("toolbarParentElem",{dataType:DataType.OBJECT,serializable:!1,setter:function(e){this.getToolbarParentElem()!==e&&(this.setPropStoreFieldValue("toolbarParentElem",e),this.updateToolbar())}}),this.defineProp("caption",{dataType:DataType.STRING,setter:function(e){this.setPropStoreFieldValue("caption",e),Kekule.DomUtils.setElementText(this.getCaptionElem(),e||""),this.captionChanged()}}),this.defineProp("showCaption",{dataType:DataType.BOOL,setter:function(e){this.setPropStoreFieldValue("showCaption",e),this.captionChanged()}}),this.defineProp("captionPos",{dataType:DataType.INT,enumSource:Kekule.Widget.Position,setter:function(e){this.setPropStoreFieldValue("captionPos",e),this.captionChanged()}}),this.defineProp("autoCaption",{dataType:DataType.BOOL,setter:function(e){this.setPropStoreFieldValue("autoCaption",e),e&&this.autoDetectCaption()}}),this.defineProp("captionElem",{dataType:DataType.OBJECT,scope:e.PRIVATE,setter:null,getter:function(e){var t=this.getPropStoreFieldValue("captionElem");return t||e||(t=this.doCreateCaptionElem(),this.setPropStoreFieldValue("captionElem",t)),t}}),this.defineProp("actions",{dataType:"Kekule.ActionList",serializable:!1,scope:e.PUBLIC,setter:null,getter:function(){var e=this.getPropStoreFieldValue("actions");return e||(e=new Kekule.ActionList,this.setPropStoreFieldValue("actions",e)),e}}),this.defineProp("actionMap",{dataType:"Kekule.MapEx",serializable:!1,scope:e.PRIVATE,setter:null,getter:function(){var e=this.getPropStoreFieldValue("actionMap");return e||(e=new Kekule.MapEx(!0),this.setPropStoreFieldValue("actionMap",e)),e}}),this.defineProp("enableDirectInteraction",{dataType:DataType.BOOL}),this.defineProp("enableTouchInteraction",{dataType:DataType.BOOL,setter:function(e){this.setPropStoreFieldValue("enableTouchInteraction",!!e),this.setTouchAction(e?"none":null)}})},initPropValues:function(){this.setStyleMode(Kekule.Widget.StyleMode.INHERITED),this.setUseNormalBackground(!1),this.setEnableCustomCssProperties(!0),this.setModalEdit(!0),this.setRestrainEditorWithCurrObj(!0),this.setRestraintRotation3DEdgeRatio(.18),this.setEnableRestraintRotation3D(!0),this.setShareEditorInstance(!0),this.setEnableTouchInteraction(!1)},createDefaultConfigs:function(){return new Kekule.ChemWidget.ViewerConfigs},canUsePlaceHolderOnElem:function(e){var t=e.getAttribute("src");return"img"===e.tagName.toLowerCase()&&!!t},doObjectChange:function(e){this.tryApplySuper("doObjectChange",[e]),this.updateActions()},doSetElement:function(e){var t=e;t&&("img"===t.tagName.toLowerCase()&&(t=Kekule.DomUtils.replaceTagName(t,"span")));return this.tryApplySuper("doSetElement",[t])},doUnbindElement:function(e){return this._drawContextParentElem&&this._drawContextParentElem.parentNode&&(this._drawContextParentElem.parentNode.removeChild(this._drawContextParentElem),this._drawContextParentElem=null),this.tryApplySuper("doUnbindElement",[e])},elementBound:function(e){this.setObserveElemResize(!0)},doCreateRootElement:function(e){return e.createElement("div")},doGetWidgetClassName:function(){var e=this.tryApplySuper("doGetWidgetClassName")+" "+a.VIEWER;try{var t=this.getRenderType();e+=" "+this._getRenderTypeSpecifiedHtmlClassName(t)}catch(e){}return e},_getRenderTypeSpecifiedHtmlClassName:function(e){return e===Kekule.Render.RendererType.R3D?a.VIEWER3D:a.VIEWER2D},getResizerElement:function(){return this.getDrawContextParentElem()},doResize:function(){this.adjustDrawParentDim(),this.adjustToolbarPos(),this.tryApplySuper("doResize")},doWidgetShowStateChanged:function(e){e&&this.updateActions()},refitDrawContext:function(e){this.tryApplySuper("refitDrawContext",[e]),this.adjustToolbarPos()},getAllowRenderTypeChange:function(){return!0},resetRenderType:function(e,t){this.tryApplySuper("resetRenderType",[e,t]);var o=this._getRenderTypeSpecifiedHtmlClassName(e),r=this._getRenderTypeSpecifiedHtmlClassName(t);this.removeClassName(o),this.addClassName(r),this.updateUiComps()},doLoadEnd:function(e){this.updateActions(),this.autoDetectCaption()},doSetUseCornerDecoration:function(e){this.tryApplySuper("doSetUseCornerDecoration",[e]),this.useCornerDecorationChanged()},useCornerDecorationChanged:function(){var e=this.getDrawContextParentElem();e&&(this.getUseCornerDecoration()?Kekule.HtmlElementUtils.addClass(e,n.CORNER_ALL):Kekule.HtmlElementUtils.removeClass(e,n.CORNER_ALL))},adjustDrawParentDim:function(){var e,t,o=this.getDrawContextParentElem(),r=o.parentNode,i=this.getCaptionElem(!0),n=Kekule.HtmlElementUtils.getElemClientDimension(r);if(i&&this.captionIsShown()&&i.parentNode===r){var a=Kekule.HtmlElementUtils.getElemClientDimension(i);t=Math.max(n.height-a.height,0),e=this.getCaptionPos()&Kekule.Widget.Position.TOP?a.height:0,o.style.top=e+"px",o.style.height=t+"px"}else Kekule.StyleUtils.removeStyleProperty(o.style,"top"),o.style.height=n.height+"px"},getInteractionReceiverElem:function(){return this.getDrawContextParentElem()},setDrawDimension:function(e,t){var o=t;this.captionIsShown()&&(o+=Kekule.HtmlElementUtils.getElemClientDimension(this.getCaptionElem()).height||0);this.tryApplySuper("setDrawDimension",[e,o])},doCreateCaptionElem:function(){var e=this.getDocument().createElement("span");return e.className=n.DYN_CREATED+"  "+n.SELECTABLE+" "+a.VIEWER_CAPTION,this.getElement().appendChild(e),e},captionChanged:function(){if(this.captionIsShown()){var e=(t=this.getCaptionElem()).style;this.getCaptionPos()&Kekule.Widget.Position.TOP?(e.top=0,e.bottom="auto"):(e.bottom=0,e.top="auto"),e.display="block"}else{var t;(t=this.getCaptionElem(!0))&&(t.style.display="none")}this.doResize()},captionIsShown:function(){return this.getCaption()&&this.getShowCaption()},getAllowEditing:function(){return this.getCoordMode()!==Kekule.CoordMode.COORD3D&&this.getEnableEdit()&&(this.getChemObj()||this.getEnableEditFromVoid())},getComposerDialog:function(){var e;return(e=this.getShareEditorInstance()?Kekule.ChemWidget.Viewer._composerDialog:this._composerDialog)||Kekule.Editor.ComposerDialog&&(e=new Kekule.Editor.ComposerDialog(this.getDocument(),Kekule.$L("ChemWidgetTexts.CAPTION_EDIT_OBJ"),[Kekule.Widget.DialogButtons.OK,Kekule.Widget.DialogButtons.CANCEL])),this.getShareEditorInstance()?Kekule.ChemWidget.Viewer._composerDialog=e:this._composerDialog=e,e},getComposerPanel:function(){var e;if(!(e=this.getShareEditorInstance()?Kekule.ChemWidget.Viewer._composerPanel:this._composerPanel)&&Kekule.Editor.Composer){(e=new Kekule.Editor.Composer(this.getDocument())).addClassName(a.VIEWER_EDITOR_FULLCLIENT),e.setUseNormalBackground(!0);var r=Kekule.Editor.Composer.getMinPreferredDimension();e.setMinDimension(r),e.setEnableDimensionTransform(!0),e.setAutoResizeConstraints({width:1,height:1});var i=Kekule.globalOptions.chemWidget.composer.commonToolButtons;i=t.exclude(i,[o.cut,o.config,o.objInspector]),e.setCommonToolButtons(i);var n=[{text:Kekule.$L("ChemWidgetTexts.CAPTION_EDITOR_DONE"),hint:Kekule.$L("ChemWidgetTexts.HINT_EDITOR_DONE"),htmlClass:"K-Res-Button-YesOk",showText:!0,"#execute":function(){e._doneEditCallback(),e.hide()}},{text:Kekule.$L("ChemWidgetTexts.CAPTION_EDITOR_CANCEL"),hint:Kekule.$L("ChemWidgetTexts.HINT_EDITOR_CANCEL"),htmlClass:"K-Res-Button-NoCancel",showText:!0,"#execute":function(){e.hide()}}];e._customEndEditButtons=n}return this.getShareEditorInstance()?Kekule.ChemWidget.Viewer._composerPanel=e:this._composerPanel=e,e._invokerViewer=this,e._doneEditCallback=null,e},openEditor:function(e){if(this.getAllowEditing()){var t=this.getChemObj(),o=!t,r=t&&t.isEmpty&&t.isEmpty(),i=this.getRestrainEditorWithCurrObj(),n=Kekule.DocumentUtils.getClientDimension(this.getDocument()),a=Kekule.Editor.Composer.getMinPreferredDimension();n.width<=a.width+50||n.height<a.height+100?this._openEditComposer(e,t,i,o,r):this._openEditComposerDialog(e,t,i,o,r)}},_prepareEditComposer:function(e,t,o,r){e.setEnableCreateNewDoc(o||!t),e.setEnableLoadNewFile(o||!t),e.setAllowCreateNewChild(o||!t);var i=this.getEditorProperties();i&&e.setPropValues(i)},_feedbackEditResult:function(e,t,o){if(e.isDirty()){var r=e.getSavingTargetObj();o?this.setChemObj(r.clone()):this.getRestrainEditorWithCurrObj()?(t.getClass()===r.getClass()?t.assign(r.clone()):t.assign(r),t.setSrcInfo(null),this.setChemObj(t)):this.setChemObj(r),this.invokeEvent("editingDone",{obj:this.getChemObj()})}},_openEditComposerDialog:function(e,t,o,r,i){var n=this.getComposerDialog();if(n){var a,l=n.getComposer();this._prepareEditComposer(l,o,r,i),r||i?n.getComposer().newDoc():(a=t.clone(),n.setChemObj(a));var s=this,d=function(e){e===Kekule.Widget.DialogButtons.OK&&n.getComposer().isDirty()&&s._feedbackEditResult(n.getComposer(),t,r)};this.getModalEdit()?n.openModal(d,e||this):n.openPopup(d,e||this)}else Kekule.error(Kekule.$L("ErrorMsg.CAN_NOT_CREATE_EDITOR"))},_openEditComposer:function(e,t,o,r,i){var n=this.getComposerPanel();if(n){this._prepareEditComposer(n,o,r,i);for(var a=n._customEndEditButtons,l=n.getCommonToolButtons()||[],s=!1,d=0,u=a.length;d<u;++d){var c=a[d];l.indexOf(c)<0&&(l.push(c),s=!0)}if(s&&n.setCommonToolButtons(l),r||i)n.newDoc();else{var p=t.clone();n.setChemObj(p)}var h=this;n._doneEditCallback=function(){h._feedbackEditResult(n,t,r)},n.show(e,function(){r||i||n.setChemObj(p)},Kekule.Widget.ShowHideType.POPUP)}else Kekule.error(Kekule.$L("ErrorMsg.CAN_NOT_CREATE_EDITOR"))},resetView:function(){return this.resetDisplay()},getCurr2DRotationAngle:function(){return this.getDrawOptions().rotateAngle||0},rotate2DBy:function(e,t){return this.rotate2DTo(this.getCurr2DRotationAngle()+e,t)},rotate2DTo:function(e,t){return this.getDrawOptions().rotateAngle=e,t||this.geometryOptionChanged(),this},getCurr3DRotationInfo:function(){for(var e={},t=["rotateMatrix","rotateX","rotateY","rotateZ","rotateAngle"],o=this.getDrawOptions(),r=0,i=t.length;r<i;++r){var n=t[r];e[n]=o[n]||0}return e.rotateAxisVector=o.rotateAxisVector||null,e},setRotate3DMatrix:function(e,t){return this.getDrawOptions().rotateMatrix=e,t||this.geometryOptionChanged(),this},rotate3DBy:function(e,t,o,r){var i=this.getCurr3DRotationInfo().rotateMatrix||Kekule.MatrixUtils.createIdentity(4),n=Kekule.CoordUtils.calcRotate3DMatrix({rotateX:e,rotateY:t,rotateZ:o}),a=Kekule.MatrixUtils.multiply(n,i);return this.setRotate3DMatrix(a,r),this},rotate3DByAxis:function(e,t,o){var r=this.getCurr3DRotationInfo().rotateMatrix||Kekule.MatrixUtils.createIdentity(4),i=Kekule.CoordUtils.calcRotate3DMatrix({rotateAngle:e,rotateAxisVector:t}),n=Kekule.MatrixUtils.multiply(i,r);return this.setRotate3DMatrix(n,o),this},getDefaultToolBarButtons:function(){return Kekule.globalOptions.chemWidget.viewer.toolButtons},isToolbarEmbedded:function(){return!this.getToolbarParentElem()},adjustToolbarPos:function(){var e=this.getToolbar();if(e)if(this.isToolbarEmbedded()){var t=Kekule.Widget.Position,o=Kekule.HtmlElementUtils.getElemPageRect(this.getDrawContextParentElem()),r=Kekule.HtmlElementUtils.getElemPageRect(e),i=this.getToolbarPos(),n=this.getToolbarMarginHorizontal(),a=this.getToolbarMarginVertical(),l="left",s="top",d="right",u="bottom",c=(o.width-r.width)/2,p=(o.height-r.height)/2;if(i===t.AUTO||!i){var h=2*(n>0?n:0)+r.width,g=2*(a>0?a:0)+r.height;h>o.width?(i|=t.LEFT,n=0):i|=t.RIGHT,g>o.height/2?(i|=t.BOTTOM,a=-1):i|=t.BOTTOM}i&t.LEFT?(l="left",d="right",c=n>=0?n:n-r.width):i&t.RIGHT&&(l="right",d="left",c=n>=0?n:n-r.width),i&t.TOP?(s="top",u="bottom",p=a>=0?a:a-r.height):i&t.BOTTOM&&(s="bottom",u="top",p=a>=0?a:a-r.height),e.removeStyleProperty(d),e.removeStyleProperty(u),e.setStyleProperty(l,c+"px"),e.setStyleProperty(s,p+"px")}else e.removeStyleProperty("left"),e.removeStyleProperty("top"),e.removeStyleProperty("width"),e.removeStyleProperty("height")},updateToolbar:function(){this.getEnableToolbar()?(this.createToolbar(),this.adjustToolbarPos()):this.setToolbar(null)},updateMenu:function(){this.createMenu()},updateUiComps:function(){this.updateToolbar(),this.updateMenu()},updateActions:function(){this.getActions()&&this.getActions().updateAll()},clearActions:function(){this.getActions().clear(),this.getActionMap().clear()},getCompActionClass:function(e){return this.getChildActionClass(e,!0)},_getActionOfComp:function(e,t,o){var r=this.getActionMap(),i=r.get(e);if(!i&&t){var n=this.getCompActionClass(e)||o;n&&(i=new n(this),r.set(e,i),this.getActions().add(i))}return i},getChildAction:function(e,t){var o=this._getActionOfComp(e,!0);return o||(o=this.tryApplySuper("getChildAction",[e,t])),o},createToolbar:function(){this.clearActions();var e=new Kekule.Widget.ButtonGroup(this);e.addClassName(n.DYN_CREATED),e.setDisplayed(!1),e.setShowText(!1),e.doSetShowGlyph(!0);for(var t=this.getToolButtons()||this.getDefaultToolBarButtons(),o=0,r=t.length;o<r;++o){var i=t[o];this.createToolButton(i,e)}return e.addClassName(a.INNER_TOOLBAR),this.isToolbarEmbedded()&&e.addClassName(a.VIEWER_EMBEDDED_TOOLBAR),e.appendToElem(this.getToolbarParentElem()||this.getElement()),this.setToolbar(e),e},createToolButton:function(e,t){var r=null,i=this.beginContinuousRepainting.bind(this),n=this.endContinuousRepainting.bind(this),a=[o.rotateX,o.rotateY,o.rotateZ,o.rotateLeft,o.rotateRight];if(DataType.isObjectValue(e)){var l=Object.extend({widget:Kekule.Widget.Button},e);if(r=Kekule.Widget.Utils.createFromHash(t,l),(d=l.actionClass)&&"string"==typeof d&&(d=ClassEx.findClass(l.actionClass)),d)(s=this._getActionOfComp(r,!0,d))&&r.setAction(s)}else{if(e===o.molDisplayType)return this.createMolDisplayTypeButton(t);if(e===o.menu)return this.createMenuButton(t);var s,d=this.getCompActionClass(e),u=Kekule.Widget.Button;e===o.molHideHydrogens&&(u=Kekule.Widget.CheckButton),r=new u(t),(s=this._getActionOfComp(e,!0))&&r.setAction(s),a.indexOf(e)>=0&&(r.setPeriodicalExecInterval(20),r.setEnablePeriodicalExec(!0),r.addEventListener("activate",i),r.addEventListener("deactivate",n))}return r},createMenuButton:function(e){var t=new Kekule.Widget.DropDownButton(e);return t.setText(Kekule.$L("WidgetTexts.CAPTION_MENU")).setHint(Kekule.$L("WidgetTexts.HINT_MENU")),t.addClassName(a.VIEWER_MENU_BUTTON),this.getMenu()||this.createMenu(),t.setDropDownWidget(this.getMenu()),t},createMolDisplayTypeButton:function(e){var t=new Kekule.Widget.CompactButtonSet(e);t.getButtonSet().addClassName(a.INNER_TOOLBAR),t.setShowText(!1);var r=this._getActionOfComp(o.molDisplayType,!0);t.setAction(r),this.getActions().add(r);for(var i=this.getDocument(),n=this.getAllowedMolDisplayTypes(),l=this._getUsableMolDisplayActionClasses(n),s=0,d=l.length;s<d;++s){var u=l[s].TYPE,c=new Kekule.Widget.RadioButton(i);r=this._getActionOfComp(o.molDisplayType+u,!0,l[s]);c.setAction(r),t.append(c,u===this.getCurrMoleculeDisplayType())}return t},_getUsableMolDisplayActionClasses:function(e){for(var t=[],o=this.getRenderType()===Kekule.Render.RendererType.R3D?r.Viewer.molDisplayType3DActionClasses:r.Viewer.molDisplayType2DActionClasses,i=0,n=o.length;i<n;++i){var a=o[i].TYPE;e&&e.indexOf(a)<0&&a!==this.getCurrMoleculeDisplayType()||t.push(o[i])}return t},getDefaultMenuItems:function(){return Kekule.globalOptions.chemWidget.viewer.menuItems},prepareMenuItems:function(e){for(var t=[],o=Kekule.Widget.MenuItem.SEPARATOR_TEXT,r=0,i=e.length;r<i;++r){var n=e[r];if("string"==typeof n){if(n!==o){var a=this.createPredefinedMenuItemDefHash(n);a&&t.push(a)}}else{var l=Object.extend({},n);if(n.widget||n.widgetClass||(l.widget=Kekule.Widget.MenuItem),n.children&&n.children.length){var s=this.prepareMenuItems(n.children);l.children=s}t.push(l)}}return t},createPredefinedMenuItemDefHash:function(e){if(e===o.molDisplayType)return this.createMolDisplayMenuDefHash();var t=[o.rotateX,o.rotateY,o.rotateZ,o.rotateLeft,o.rotateRight],r=this.beginContinuousRepainting.bind(this),i=this.endContinuousRepainting.bind(this),n=(this.getCompActionClass(e),Kekule.Widget.MenuItem),a=null,l=this._getActionOfComp(e,!0);return l&&(a={widget:n,action:l},t.indexOf(e)>=0&&(a=Object.extend(a,{periodicalExecInterval:20,enablePeriodicalExec:!0,"#activate":r,"@deactivate":i}))),a},createMolDisplayMenuDefHash:function(){for(var e=this._getActionOfComp(o.molDisplayType,!0),t={widget:Kekule.Widget.MenuItem,action:e},r=[],i=this.getAllowedMolDisplayTypes(),n=this._getUsableMolDisplayActionClasses(i),a=0,l=n.length;a<l;++a){var s=n[a].TYPE;e=this._getActionOfComp(o.molDisplayType+s,!0,n[a]);r.push({widget:Kekule.Widget.MenuItem,action:e})}return r.length&&(t.children=[{widget:Kekule.Widget.PopupMenu,children:r}]),t},createMenu:function(){var e=this.getMenu();e?e.clearMenuItems():((e=new Kekule.Widget.PopupMenu(this)).addClassName(n.DYN_CREATED),e.setDisplayed(!1));var t=this.getMenuItems()||this.getDefaultMenuItems();return t=this.prepareMenuItems(t),e.createChildrenByDefs(t),this.setMenu(e),e},autoDetectCaption:function(){if(this.getAutoCaption()){var e=this.getChemObj();if(e){var t=e&&e.getInfo(),o=e&&e.getSrcInfo();if(t&&o){var r=t.title||t.caption||e.getName()||o.fileName;r&&this.setCaption(r)}}}},reactHotKeys:function(e){if(this.getEnableHotKey()){for(var t=this.getCoordMode()||Kekule.CoordMode.COORD2D,o=this.getViewerConfigs().getHotKeyConfigs().getHotKeys(),r=Kekule.Widget.KeyboardUtils.getKeyParamsFromEvent(e),i=!1,n=o.length-1;n>=0;--n){var a=o[n],l=Kekule.Widget.KeyboardUtils.shortcutLabelToKeyParams(o[n].key,null,!1);if(l.repeat=a.repeat,Kekule.Widget.KeyboardUtils.matchKeyParams(r,l,!1)){var s=a.action;if(s&&(!a.coordMode||a.coordMode===t)){var d=this.getChildAction(s,!0);d&&(i=d.execute(this,e)||i)}}}if(i)return e.stopPropagation(),e.preventDefault(),!0}},react_keydown:function(e){if(!this.tryApplySuper("react_keydown",[e]))return this.reactHotKeys(e)}});var l=Kekule.X.Event;Kekule.ChemWidget.ViewerBasicInteractionController=Class.create(Kekule.Widget.InteractionController,{CLASS_NAME:"Kekule.ChemWidget.ViewerBasicInteractionController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._enableMouseRotate=!0,this._transformInfo={isTransforming:!1,lastCoord:null,lastZoom:null},this._restraintCoord=null,this._doInteractiveTransformStepBind=this._doInteractiveTransformStep.bind(this)},initProperties:function(){this.defineProp("viewer",{dataType:"Kekule.ChemWidget.Viewer",serializable:!1,getter:function(){return this.getWidget()},setter:function(e){this.setWidget(e)}})},getViewerRenderType:function(){return this.getViewer().getRenderType()},getEnableInteraction:function(){var e=this.getViewer();return!!(e&&e.getEnableDirectInteraction()&&e.getChemObjLoaded())},getEnableTouchInteraction:function(){var e=this.getViewer();return!!(e&&e.getEnableDirectInteraction()&&e.getEnableTouchInteraction()&&e.getChemObjLoaded())},_initTransform:function(){var e,t=this.getViewer(),o=t.getOffsetWidth(),r=t.getOffsetHeight(),i=this._transformInfo,n=this._restraintCoord;n?(e="x"===n?r:o,i.angleRatio=1/e*Math.PI*2):(e=Math.min(o,r),i.angleRatio=1/e*Math.PI)},zoomViewer:function(e){var t=this.getViewer();t&&t.getChemObj()&&(e>0?t.zoomIn&&t.zoomIn(e):e<0&&t.zoomOut&&t.zoomOut(-e))},isEventFromInteractionArea:function(e){var t=e.getTarget(),o=this.getViewer().getInteractionReceiverElem();return t===o||Kekule.DomUtils.isDescendantOf(t,o)},_beginInteractTransformAtCoord:function(e,t,o,r){var i=this.getViewer();if(i&&i.getChemObj()){var n=this._transformInfo;n.isTransforming=!0,n.lastCoord={x:e,y:t},this._restraintCoord=this._calcRestraintRotateCoord(o,r),this._initTransform(),this.getViewer().setTouchAction("none"),this._requestInteractiveTransform(e,t)}},_endInteractTransform:function(){this._transformInfo.isTransforming=!1,this.getViewer().setTouchAction(null),this._doInteractiveTransformEnd()},_calcRestraintRotateCoord:function(e,t){var o=this.getViewer(),r=null,i=this._getRestraintRotate3DEdgeSize();if(i>0){var n,a,l,s,d=o.getInteractionReceiverElem(),u=Kekule.HtmlElementUtils.getElemPageRect(d,!0),c=e-u.left,p=t-u.top,h=u.right-e,g=u.bottom-t;c<=h?(l=1,n=c):(l=-1,n=h),p<=g?(s=1,a=p):(s=-1,a=g);var C=Math.min(n,a);if(C>i)return null;a>C?l<0&&(r="x"):r=s>0?"z":"y"}return r},_interactTransformAtCoord:function(e,t){var o=this._transformInfo.lastCoord;if(o){var r={x:e,y:t};if(Kekule.CoordUtils.getDistance(o,r)<5)return}this._requestInteractiveTransform(e,t)},_requestInteractiveTransform:function(e,t){this._transformInfo.interactScreenCoord={x:e,y:t},this._interactiveTransformStepId||(this._interactiveTransformStepId=window.requestAnimationFrame(this._doInteractiveTransformStepBind))},_doInteractiveTransformStep:function(){if(this._transformInfo&&this._transformInfo.isTransforming){var e=this._transformInfo.interactScreenCoord;this.getViewerRenderType()===Kekule.Render.RendererType.R3D?this.rotateByXYDistance(e.x,e.y):this.moveByXYDistance(e.x,e.y),this._interactiveTransformStepId=window.requestAnimationFrame(this._doInteractiveTransformStepBind)}},_doInteractiveTransformEnd:function(){this._interactiveTransformStepId&&(window.cancelAnimationFrame(this._interactiveTransformStepId),this._interactiveTransformStepId=null)},_getRestraintRotate3DEdgeSize:function(){var e=this.getViewer();if(e.getEnableRestraintRotation3D()&&e.getRenderType()===Kekule.Render.RendererType.R3D){var t=e.getDimension();return Math.min(t.width,t.height)*(e.getRestraintRotation3DEdgeRatio()||0)}return 0},needReactEvent:function(e){return this.getEnableInteraction()&&this.isEventFromInteractionArea(e)},react_dblclick:function(e){this.needReactEvent(e)&&this.getViewer().resetDisplay()},react_mousewheel:function(e){if(this.needReactEvent(e)){var t=e.wheelDeltaY||e.wheelDelta;return t&&(t/=120),this.zoomViewer(t),e.preventDefault(),!0}},react_pointerdown:function(e){this.needReactEvent(e)&&e.getButton()===l.MouseButton.LEFT&&(e.getPointerType()!==l.PointerType.TOUCH||this.getEnableTouchInteraction())&&this._beginInteractTransformAtCoord(e.getScreenX(),e.getScreenY(),e.getClientX(),e.getClientY())},react_pointerhold:function(e){this.needReactEvent(e)&&e.getPointerType()===l.PointerType.TOUCH&&e.getButton()===l.MouseButton.LEFT&&this.getViewer().setEnableTouchInteraction(!this.getViewer().getEnableTouchInteraction())},react_pointerleave:function(e){this._endInteractTransform()},react_pointerup:function(e){e.getButton()===l.MouseButton.LEFT&&this._endInteractTransform()},react_pointermove:function(e){this.needReactEvent(e)&&this._transformInfo.isTransforming&&(this._interactTransformAtCoord(e.getScreenX(),e.getScreenY()),e.preventDefault())},moveByXYDistance:function(e,t){var o=this._transformInfo;if(o&&o.isTransforming&&!o.calculating){var r=this.getViewer();if(r.getRenderType()===Kekule.Render.RendererType.R3D)return;o.calculating=!0;try{var i={x:e,y:t},n=Kekule.CoordUtils.substract(i,o.lastCoord),a=r.getBaseCoordOffset()||{};a=Kekule.CoordUtils.add(a,n),r.setBaseCoordOffset(a),o.lastCoord=i}finally{o.calculating=!1}}},rotateByXYDistance:function(e,t){var o=this._transformInfo;if(o&&o.isTransforming&&!o.calculating){var r=this.getViewer();if(r.getRenderType()!==Kekule.Render.RendererType.R3D)return;o.calculating=!0;try{var i,n,a,l={x:e,y:t},s=Kekule.CoordUtils.substract(l,o.lastCoord);if(s.y=-s.y,this._restraintCoord){var d=this._restraintCoord;"x"===d?(i=s.y,a={x:1,y:0,z:0}):(i=s.x,a="y"===d?{x:0,y:-1,z:0}:{x:0,y:0,z:1}),n=-i*o.angleRatio}else n=(i=Kekule.CoordUtils.getDistance({x:0,y:0},s))*o.angleRatio,a={x:-s.y,y:s.x,z:0};r.rotate3DByAxis(n,a),o.lastCoord=l,o.calculating=!1}catch(e){}finally{o.calculating=!1}}},doTestMouseCursor:function(e,t){var o="";return this._transformInfo.isTransforming&&(o="move"),o}}),Kekule.ChemWidget.Viewer2D=Class.create(Kekule.ChemWidget.Viewer,{CLASS_NAME:"Kekule.ChemWidget.Viewer2D",initialize:function(e,t){this.tryApplySuper("initialize",[e,t,Kekule.Render.RendererType.R2D])},getAllowRenderTypeChange:function(){return!1}}),Kekule.ChemWidget.Viewer3D=Class.create(Kekule.ChemWidget.Viewer,{CLASS_NAME:"Kekule.ChemWidget.Viewer3D",initialize:function(e,t){this.tryApplySuper("initialize",[e,t,Kekule.Render.RendererType.R3D])},getAllowRenderTypeChange:function(){return!1}});var s=Kekule.ObjPropSettingManager;s.register("Kekule.ChemWidget.Viewer.fullFunc",{enableToolbar:!0,enableDirectInteraction:!0,enableTouchInteraction:!0,enableEdit:!0,toolButtons:null}),s.register("Kekule.ChemWidget.Viewer.basic",{enableToolbar:!0,enableDirectInteraction:!0,enableTouchInteraction:!1,toolButtons:[o.saveData,o.molDisplayType,o.zoomIn,o.zoomOut],menuItems:[o.saveData,"-",o.molDisplayType,o.zoomIn,o.zoomOut]}),s.register("Kekule.ChemWidget.Viewer.mini",{enableToolbar:!0,enableDirectInteraction:!0,enableTouchInteraction:!1,toolButtons:[o.menu],menuItems:[o.saveData,"-",o.molDisplayType,o.zoomIn,o.zoomOut]}),s.register("Kekule.ChemWidget.Viewer.static",{enableToolbar:!1,enableDirectInteraction:!1,enableTouchInteraction:!1,toolButtons:[],menuItems:[]}),s.register("Kekule.ChemWidget.Viewer.editOnly",{enableToolbar:!0,enableEdit:!0,toolButtons:[o.openEditor],menuItems:[o.openEditor]}),Kekule.ChemWidget.Viewer.Settings=Class.create(Kekule.ChemWidget.ChemObjDisplayer.Settings,{CLASS_NAME:"Kekule.ChemWidget.Viewer.Settings",initProperties:function(){this.defineDelegatedProps(["enableDirectInteraction","enableTouchInteraction","enableToolbar","toolbarPos","toolbarMarginHorizontal","toolbarMarginVertical","enableEdit","modalEdit"])},getViewer:function(){return this.getWidget()}}),Kekule.ChemWidget.ViewerConfigs=Class.create(Kekule.ChemWidget.ChemObjDisplayerConfigs,{CLASS_NAME:"Kekule.ChemWidget.ViewerConfigs",initProperties:function(){this.addConfigProp("hotKeyConfigs","Kekule.ChemWidget.ViewerHotKeyConfigs")},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setPropStoreFieldValue("hotKeyConfigs",new Kekule.ChemWidget.ViewerHotKeyConfigs)}}),Kekule.ChemWidget.ViewerHotKeyConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.ChemWidget.ViewerHotKeyConfigs",initProperties:function(){this.defineProp("hotKeys",{dataType:DataType.ARRAY})},initPropValues:function(){var e=Kekule.ChemWidget.ComponentWidgetNames;this.tryApplySuper("initPropValues"),this.setHotKeys([{key:"Ctrl+C",action:e.copy},{key:"+",action:e.zoomIn},{key:"-",action:e.zoomOut},{key:"Space",action:e.reset},{key:"R",action:e.rotateLeft,repeat:null,coordMode:2},{key:"Shift-R",action:e.rotateRight,repeat:null,coordMode:2},{key:"X",action:e.rotateX,repeat:null,coordMode:3},{key:"Shift+X",action:e.rotateX,repeat:null,coordMode:3},{key:"Y",action:e.rotateY,repeat:null,coordMode:3},{key:"Shift+Y",action:e.rotateY,repeat:null,coordMode:3},{key:"Z",action:e.rotateZ,repeat:null,coordMode:3},{key:"Shift+Z",action:e.rotateZ,repeat:null,coordMode:3},{key:"H",action:e.molHideHydrogens,coordMode:3},{key:"1",action:e.molDisplayTypeSkeletal,coordMode:2},{key:"1",action:e.molDisplayTypeCondensed,coordMode:2},{key:"1",action:e.molDisplayTypeWire,coordMode:3},{key:"2",action:e.molDisplayTypeSticks,coordMode:3},{key:"3",action:e.molDisplayTypeBallStick,coordMode:3},{key:"4",action:e.molDisplayTypeSpaceFill,coordMode:3}])}}),Kekule.ChemWidget.ActionOnViewer=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionOnViewer",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,t,o])},doUpdate:function(){var e=this.getDisplayer();this.setEnabled(e&&e.getChemObj()&&e.getChemObjLoaded()&&e.getEnabled())},getViewer:function(){var e=this.getDisplayer();return e instanceof Kekule.ChemWidget.Viewer?e:null}}),Kekule.ChemWidget.ActionViewerRotateBase=Class.create(Kekule.ChemWidget.ActionOnViewer,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateBase",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,t,o]),this.setDelta(2*Math.PI/180)},initProperties:function(){this.defineProp("delta",{dataType:DataType.FLOAT})},isShiftModified:function(e){return e&&e.getShiftKey()}}),Kekule.ChemWidget.ActionViewerRotateBase2D=Class.create(Kekule.ChemWidget.ActionViewerRotateBase,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateBase2D",doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getViewer(),t=e&&e.getRenderType()===Kekule.Render.RendererType.R2D;this.setDisplayed(t).setEnabled(this.getEnabled()&&t)}}),Kekule.ChemWidget.ActionViewerRotateBase3D=Class.create(Kekule.ChemWidget.ActionViewerRotateBase,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateBase3D",doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getViewer(),t=e&&e.getRenderType()===Kekule.Render.RendererType.R3D;this.setDisplayed(t).setEnabled(this.getEnabled()&&t)}}),Kekule.ChemWidget.ActionViewerRotateLeft=Class.create(Kekule.ChemWidget.ActionViewerRotateBase2D,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateLeft",HTML_CLASSNAME:a.ACTION_ROTATE_LEFT,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_ROTATELEFT"),Kekule.$L("ChemWidgetTexts.HINT_ROTATELEFT")])},doExecute:function(e,t){var o=this.getDelta();this.getViewer().rotate2DBy(o)}}),Kekule.ChemWidget.ActionViewerRotateRight=Class.create(Kekule.ChemWidget.ActionViewerRotateBase2D,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateRight",HTML_CLASSNAME:a.ACTION_ROTATE_RIGHT,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_ROTATERIGHT"),Kekule.$L("ChemWidgetTexts.HINT_ROTATERIGHT")])},doExecute:function(e,t){var o=-this.getDelta();this.getViewer().rotate2DBy(o)}}),Kekule.ChemWidget.ActionViewerRotateX=Class.create(Kekule.ChemWidget.ActionViewerRotateBase3D,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateX",HTML_CLASSNAME:a.ACTION_ROTATE_X,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_ROTATEX"),Kekule.$L("ChemWidgetTexts.HINT_ROTATEX")])},doExecute:function(e,t){var o=this.isShiftModified(t),r=-this.getDelta();o&&(r=-r),this.getViewer().rotate3DBy(r,0,0)}}),Kekule.ChemWidget.ActionViewerRotateY=Class.create(Kekule.ChemWidget.ActionViewerRotateBase3D,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateY",HTML_CLASSNAME:a.ACTION_ROTATE_Y,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_ROTATEY"),Kekule.$L("ChemWidgetTexts.HINT_ROTATEY")])},doExecute:function(e,t){var o=this.isShiftModified(t),r=-this.getDelta();o&&(r=-r),this.getViewer().rotate3DBy(0,r,0)}}),Kekule.ChemWidget.ActionViewerRotateZ=Class.create(Kekule.ChemWidget.ActionViewerRotateBase3D,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerRotateZ",HTML_CLASSNAME:a.ACTION_ROTATE_Z,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_ROTATEZ"),Kekule.$L("ChemWidgetTexts.HINT_ROTATEZ")])},doExecute:function(e,t){var o=this.isShiftModified(t),r=-this.getDelta();o&&(r=-r),this.getViewer().rotate3DBy(0,0,r)}}),Kekule.ChemWidget.ActionViewerChangeMolDisplayTypeStub=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerChangeMolDisplayTypeStub",initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_MOL_DISPLAY_TYPE"),Kekule.$L("ChemWidgetTexts.HINT_MOL_DISPLAY_TYPE")])},doExecute:function(e){}}),Kekule.ChemWidget.ActionViewerEdit=Class.create(Kekule.ChemWidget.ActionOnViewer,{CLASS_NAME:"Kekule.ChemWidget.ActionViewerEdit",HTML_CLASSNAME:a.ACTION_VIEWER_EDIT,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_OPENEDITOR"),Kekule.$L("ChemWidgetTexts.HINT_OPENEDITOR")])},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getViewer();this.setEnabled(e&&e.getAllowEditing()&&e.getEnabled()),this.setDisplayed(e&&e.getEnableEdit())},doExecute:function(e){this.getViewer().openEditor(e)}}),Kekule.ChemWidget.Viewer.rotate2DActionClasses=[r.ActionViewerRotateLeft,r.ActionViewerRotateRight],Kekule.ChemWidget.Viewer.rotate3DActionClasses=[r.ActionViewerRotateX,r.ActionViewerRotateY,r.ActionViewerRotateZ],Kekule.ChemWidget.Viewer.molDisplayType2DActionClasses=[r.ActionDisplayerChangeMolDisplayTypeSkeletal,r.ActionDisplayerChangeMolDisplayTypeCondensed],Kekule.ChemWidget.Viewer.molDisplayType3DActionClasses=[r.ActionDisplayerChangeMolDisplayTypeWire,r.ActionDisplayerChangeMolDisplayTypeSticks,r.ActionDisplayerChangeMolDisplayTypeBallStick,r.ActionDisplayerChangeMolDisplayTypeSpaceFill],Kekule._registerAfterLoadSysProc(function(){var e=Kekule.ActionManager,t=Kekule.ChemWidget,r=Kekule.ChemWidget.Viewer,i=e.registerNamedActionClass;i(o.loadFile,t.ActionDisplayerLoadFile,r),i(o.loadData,t.ActionDisplayerLoadData,r),i(o.saveData,t.ActionDisplayerSaveFile,r),i(o.clearObjs,t.ActionDisplayerClear,r),i(o.zoomIn,t.ActionDisplayerZoomIn,r),i(o.zoomOut,t.ActionDisplayerZoomOut,r),i(o.rotateLeft,t.ActionViewerRotateLeft,r),i(o.rotateRight,t.ActionViewerRotateRight,r),i(o.rotateX,t.ActionViewerRotateX,r),i(o.rotateY,t.ActionViewerRotateY,r),i(o.rotateZ,t.ActionViewerRotateZ,r),i(o.reset,t.ActionDisplayerReset,r),i(o.molHideHydrogens,t.ActionDisplayerHideHydrogens,r),i(o.molDisplayType,t.ActionViewerChangeMolDisplayTypeStub,r),i(o.copy,t.ActionDisplayerCopy,r),i(o.openEditor,t.ActionViewerEdit,r),i(o.config,Kekule.Widget.ActionOpenConfigWidget,r),i(o.molDisplayTypeCondensed,t.ActionDisplayerChangeMolDisplayTypeCondensed,r),i(o.molDisplayTypeSkeletal,t.ActionDisplayerChangeMolDisplayTypeSkeletal,r),i(o.molDisplayTypeWire,t.ActionDisplayerChangeMolDisplayTypeWire,r),i(o.molDisplayTypeSticks,t.ActionDisplayerChangeMolDisplayTypeSticks,r),i(o.molDisplayTypeBallStick,t.ActionDisplayerChangeMolDisplayTypeBallStick,r),i(o.molDisplayTypeSpaceFill,t.ActionDisplayerChangeMolDisplayTypeSpaceFill,r)})}(),function(){"use strict";var e=Class.PropertyScope;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{VIEWER_GRID:"K-Chem-Viewer-Grid"});Kekule.Widget.HtmlClassNames;var t=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.ViewerGrid=Class.create(Kekule.Widget.WidgetGrid,{CLASS_NAME:"Kekule.ChemWidget.ViewerGrid",initialize:function(e,t,o){this.setPropStoreFieldValue("renderType",t),this.setPropStoreFieldValue("viewerConfigs",o),this.tryApplySuper("initialize",[e])},initProperties:function(){this._shadowedPropPairs=[],this.defineProp("renderType",{dataType:DataType.INT,serializable:!1,setter:null,scope:e.PUBLIC}),this.defineProp("chemObjs",{dataType:DataType.ARRAY,serializable:!1,setter:null,getter:function(){var e=[];return this.each(function(t){e.push(t.getChemObj())}),e}}),this.defineViewerShadowProps(["drawOptions","moleculeDisplayType","zoom","autoSize","enableLoadNewFile","viewerConfigs","allowedMolDisplayTypes","enableEdit","modalEdit","toolButtons","enableToolbar","toolbarPos","toolbarMarginVertical","toolbarMarginHorizontal","toolbarEvokeModes","toolbarRevokeModes","toolbarRevokeTimeout","caption","showCaption","autoCaption","captionPos","enableDirectInteraction","enableTouchInteraction"]),this.defineViewerShadowProps(["viewerPredefinedSetting"],["predefinedSetting"]),this.defineProp("actionLoadData",{dataType:"Kekule.ChemWidget.ActionDisplayerLoadData",serializable:!1,scope:e.PRIVATE,setter:null,getter:function(){var e=this.getPropStoreFieldValue("actionLoadData");return e||(e=new Kekule.ChemWidget.ActionDisplayerLoadData,this.setPropStoreFieldValue("actionLoadData",e)),e}})},defineViewerShadowProps:function(e,t){t||(t=[]);for(var o=0,r=e.length;o<r;++o){var i=e[o],n=t[o]||e[o];this.defineViewerShadowProp(i,n)}},defineViewerShadowProp:function(e,t){t||(t=e);var o=Kekule.ChemWidget.Viewer,r=ClassEx.getPropInfo(o,t);if(r){var i=Object.create(r);i.getter=void 0,i.setter=function(o){this.setPropStoreFieldValue(e,o),this.each(function(e){e.setPropValue(t,o)})},this.defineProp(e,i),this._shadowedPropPairs.push({prop:e,viewerProp:t})}},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+t.VIEWER_GRID},createWidget:function(){var e=this.getDocument(),t=new Kekule.ChemWidget.LoadDataDialog(e),o=this;t.openModal(function(r){if(t.isPositiveResult(r)){var i=t.getDataDetails();if(a=t.getChemObj()){var n=o.doCreateNewChildWidget(e,null,a),a=n.loadFromData(i.data,i.mimeType,i.fileName);n.setParent(o)}else i.data&&Kekule.error(Kekule.$L("ErrorMsg.LOAD_CHEMDATA_FAILED"))}},this.getAddingCell())},doCreateNewChildWidget:function(e,t){var o=new Kekule.ChemWidget.Viewer(e,null,this.getRenderType(),this.getViewerConfigs());return this.doSetShadowedPropValuesToViewer(o),t&&o.setChemObj(t),o},doSetShadowedPropValuesToViewer:function(e){for(var t=0,o=this._shadowedPropPairs.length;t<o;++t){var r=this._shadowedPropPairs[t],i=this.getPropValue(r.prop);void 0!==i&&e.setPropValue(r.viewerProp,i)}},addChemObj:function(e){return this.doCreateNewChildWidget(this.getDocument(),e).setParent(this),this},removeChemObj:function(e){var t=this;return this.each(function(o){o.getChemObj()===e&&t.removeWidget(o,!0)}),this}}),Kekule.ChemWidget.ViewerGrid2D=Class.create(Kekule.ChemWidget.ViewerGrid,{CLASS_NAME:"Kekule.ChemWidget.ViewerGrid2D",initialize:function(e,t){this.tryApplySuper("initialize",[e,Kekule.Render.RendererType.R2D,t])}}),Kekule.ChemWidget.ViewerGrid3D=Class.create(Kekule.ChemWidget.ViewerGrid,{CLASS_NAME:"Kekule.ChemWidget.ViewerGrid3D",initialize:function(e,t){this.tryApplySuper("initialize",[e,Kekule.Render.RendererType.R3D,t])}})}(),function(){"use strict";var e=Class.PropertyScope,t=Kekule.DomUtils,o=Kekule.ArrayUtils;Kekule.ChemWidget;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{CHEMOBJSETTER:"K-Chem-Obj-Setter",CHEMOBJSETTER_FLEX_LAYOUT:"K-Chem-Obj-Setter-Flex-Layout",CHEMOBJSETTER_TOOLBAR_AREA:"K-Chem-Obj-Setter-Toolbar-Area",CHEMOBJSETTER_CLIENT:"K-Chem-Obj-Setter-Client",CHEMOBJSETTER_VIEWER:"K-Chem-Obj-Setter-Viewer",CHEMOBJSETTER_TABGROUP:"K-Chem-Obj-Setter-TabGroup",CHEMOBJSETTER_INFOLABEL:"K-Chem-Obj-Setter-InfoLabel",CHEMOBJSETTER_REGION:"K-Chem-Obj-Setter-Region",CHEMOBJSETTER_REGION_LABEL:"K-Chem-Obj-Setter-Region-Label",CHEMOBJSETTER_LINE:"K-Chem-Obj-Setter-Line",CHEMOBJSETTER_CONFIGURATOR:"K-Chem-Obj-Setter-Configurator"});var r=Kekule.Widget.HtmlClassNames,i=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.ChemObjInserter=Class.create(Kekule.ChemWidget.AbstractWidget,{CLASS_NAME:"Kekule.ChemWidget.ChemObjInserter",DEF_BGCOLOR_2D:"transparent",DEF_BGCOLOR_3D:"#000000",initialize:function(e,t,o,r){this._configAction=new Kekule.Widget.ActionOpenConfigWidget(this),this._toolbarParentElem=null,this._infoLabel=null,this._infoLabelTemplate=Kekule.$L("ChemWidgetTexts.CAPTION_WIDTH_HEIGHT"),this.tryApplySuper("initialize",[e]);var i=this.getViewer();o&&i.setRenderType(o),r&&i.setViewerConfigs(r),this.adjustChildrenSizes()},doFinalize:function(){this._configAction&&this._configAction.finalize(),this.tryApplySuper("doFinalize")},initProperties:function(){this.defineProp("viewer",{dataType:"Kekule.ChemWidget.Viewer",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("viewer");return e||(e=this.createViewer(),this.setPropStoreFieldValue("viewer",e)),e}}),this.defineProp("chemObj",{dataType:"Kekule.ChemObject",serializable:!1,scope:e.PUBLIC,getter:function(){var e=this.getPropStoreFieldValue("viewer");return e?e.getChemObj():this.getPropStoreFieldValue("chemObj")},setter:function(e){this.setPropStoreFieldValue("chemObj",e),this.getViewer()&&this.getViewer().setChemObj(e)}}),this.defineProp("renderType",{dataType:DataType.INT,serializable:!1,scope:e.PUBLIC,setter:function(e){if(e!==this.getRenderType()){this.setPropStoreFieldValue("renderType",e),this.getViewer().setRenderType(e);var t=this.getTabs();if(t){var o=e===Kekule.Render.RendererType.R3D?1:0;t.getChildWidgets()[o].setChecked(!0)}}}}),this.defineProp("is3D",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getRenderType()===Kekule.Render.RendererType.R3D},setter:function(e){this.setRenderType(e?Kekule.Render.RendererType.R3D:Kekule.Render.RendererType.R2D)}}),this.defineProp("showInfo",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this._infoLabel&&Kekule.StyleUtils.isShown(this._infoLabel)},setter:function(e){this._infoLabel&&Kekule.StyleUtils.setDisplay(this._infoLabel,e)}}),this.defineProp("autoSizeExport",{dataType:DataType.BOOL}),this.defineProp("backgroundColor2D",{dataType:DataType.STRING,setter:function(e){this.setPropStoreFieldValue("backgroundColor2D",e),this.backgroundColorChange()}}),this.defineProp("backgroundColor3D",{dataType:DataType.STRING,setter:function(e){this.setPropStoreFieldValue("backgroundColor3D",e),this.backgroundColorChange()}}),this.defineProp("exportViewerPredefinedSetting",{dataType:DataType.STRING}),this.defineProp("clientPanel",{dataType:DataType.OBJECT,serializable:!1,setter:!1,scope:e.PRIVATE}),this.defineProp("tabs",{dataType:DataType.OBJECT,serializable:!1,setter:!1,scope:e.PRIVATE}),this._defineViewerDelegatedProp("chemObjLoaded"),this._defineViewerDelegatedProp("renderConfigs"),this._defineViewerDelegatedProp("drawOptions"),this._defineViewerDelegatedProp("allowCoordBorrow"),this._defineViewerDelegatedProp("autoSize"),this._defineViewerDelegatedProp("autofit"),this._defineViewerDelegatedProp("viewerConfigs"),this._defineViewerDelegatedProp("allowedMolDisplayTypes"),this._defineViewerDelegatedProp("enableEdit"),this._defineViewerDelegatedProp("enableEditFromVoid"),this._defineViewerDelegatedProp("modalEdit"),this._defineViewerDelegatedProp("restrainEditorWithCurrObj"),this._defineViewerDelegatedProp("editorProperties"),this._defineViewerDelegatedProp("toolButtons"),this._defineViewerDelegatedProp("enableDirectInteraction"),this._defineViewerDelegatedProp("enableTouchInteraction")},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setAutoSizeExport(!0),this.setBackgroundColor3D(this.DEF_BGCOLOR_3D),this.setExportViewerPredefinedSetting("basic")},_defineViewerDelegatedProp:function(e,t){t||(t=e);var o=ClassEx.getPropInfo(Kekule.ChemWidget.Viewer,t),r=Object.create(o);return r.getter=null,r.setter=null,o.getter&&(r.getter=function(){return this.getViewer().getPropValue(t)}),o.setter&&(r.setter=function(e){this.getViewer().setPropValue(t,e)}),this.defineProp(e,r)},loadPredefinedResDataToProp:function(e,t,o){if("chemObj"===e)if(o){var r=Kekule.IO.loadTypedData(t.data,t.resType,t.resUri);this.setChemObj(r)}else Kekule.error(Kekule.$L("ErrorMsg.CANNOT_LOAD_RES_OF_URI")+t.resUri||"")},doGetWidgetClassName:function(){var e=this.tryApplySuper("doGetWidgetClassName")+" "+i.CHEMOBJSETTER;return this._isUsingFlexLayout()&&(e+=" "+i.CHEMOBJSETTER_FLEX_LAYOUT),e},_isUsingFlexLayout:function(){return Kekule.BrowserFeature.cssFlex},doCreateRootElement:function(e){return e.createElement("div")},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]);this.createToolbarParent(t);var r=new Kekule.Widget.Panel(this);return r.addClassName(i.CHEMOBJSETTER_CLIENT),r.setUseCornerDecoration(!1),r.appendToElem(t),this.setPropStoreFieldValue("clientPanel",r),this.createViewer(r.getCoreElement()),this.createInfoLabel(t,this.getViewer()),this.createTabs(t),o},elementBound:function(e){this.setObserveElemResize(!0)},doResize:function(){this.adjustChildrenSizes()},doWidgetShowStateChanged:function(e){this.tryApplySuper("doWidgetShowStateChanged",[e]),this.adjustChildrenSizes()},getResizerElement:function(){return this.getClientPanel()?this.getClientPanel().getCoreElement():this.getCoreElement()},getBackgroundColor:function(e){var t=e===Kekule.Render.RendererType.R3D?this.getBackgroundColor3D():this.getBackgroundColor2D();return t===Kekule.Widget.ColorPicker.SpecialColors.TRANSPARENT&&(t="transparent"),t},setBackgroundColor:function(e,t){if(t===Kekule.Render.RendererType.R3D){var o=e||this.DEF_BGCOLOR_3D;this.setBackgroundColor3D(o)}else{o=e||this.DEF_BGCOLOR_2D;this.setBackgroundColor2D(o)}},backgroundColorChange:function(){var e=this.getBackgroundColor(this.getRenderType()),t=this.getPropStoreFieldValue("viewer");t&&t.setBackgroundColor(e)},adjustChildrenSizes:function(){if(this._isUsingFlexLayout());else{this.getPageRect();var e=Kekule.HtmlElementUtils.getElemPageRect(this._toolbarParentElem),t=this.getTabs(),o=(t&&t.getPageRect()).top-e.bottom;this.getClientPanel().setHeight(o+"px")}this.getViewer().resized()},createViewer:function(e){var t=Kekule.ChemWidget.ComponentWidgetNames,n=Kekule.Widget.EvokeMode,a=new Kekule.ChemWidget.Viewer(this,null,this.getRenderType());a.addClassName([r.DYN_CREATED,i.CHEMOBJSETTER_VIEWER]),a.setRenderType(Kekule.Render.RendererType.R2D),a.setEnableEdit(!0),a.setEnableEditFromVoid(!0),a.setRestrainEditorWithCurrObj(!1),a.setEnableToolbar(!0),a.setPredefinedSetting("fullFunc");var l=o.exclude(a.getDefaultToolBarButtons(),t.config);return l.push({action:this._configAction}),l.splice(2,0,t.clearObjs),a.setToolbarParentElem(this._toolbarParentElem),a.setToolButtons(l),a.setToolbarPos(Kekule.Widget.Position.BOTTOM),a.setToolbarMarginVertical(-2),a.setToolbarEvokeModes([n.ALWAYS]),a.addEventListener("resize",this.updateInfoLabel,this),a.appendToElem(e),a.setChemObj(this.getChemObj()),this.setPropStoreFieldValue("viewer",a),this.backgroundColorChange(),a},createToolbarParent:function(e){var t=e.ownerDocument.createElement("div");return t.className=i.CHEMOBJSETTER_TOOLBAR_AREA,e.appendChild(t),this._toolbarParentElem=t,t},createTabs:function(e){var t=[Kekule.$L("ChemWidgetTexts.CAPTION_2D"),Kekule.$L("ChemWidgetTexts.CAPTION_3D")],o=this.getRenderType()===Kekule.Render.RendererType.R3D?1:0,n=new Kekule.Widget.TabButtonGroup(this);n.setTabButtonPosition(Kekule.Widget.Position.BOTTOM),n.addClassName([r.DYN_CREATED,i.CHEMOBJSETTER_TABGROUP]);for(var a=[],l=0,s=t.length;l<s;++l){var d=new Kekule.Widget.RadioButton(n);d.setText(t[l]),l===o&&d.setChecked(!0),a.push(d)}return n.addEventListener("switch",function(e){var t=e.button,o=1===a.indexOf(t)?Kekule.Render.RendererType.R3D:Kekule.Render.RendererType.R2D;this.setRenderType(o),this.backgroundColorChange()},this),n.appendToElem(e),this.setPropStoreFieldValue("tabs",n),n},createInfoLabel:function(e,t){var o=this.getDocument().createElement("div");return o.className=r.DYN_CREATED+" "+i.CHEMOBJSETTER_INFOLABEL,t.getElement().appendChild(o),this._infoLabel=o,o},updateInfoLabel:function(){var e=this.getViewer();if(e&&this._infoLabel){var t=e.getContextDimension(),o=t?this._infoLabelTemplate.format(Math.round(t.width),Math.round(t.height)):"";Kekule.DomUtils.setElementText(this._infoLabel,o)}},getContextDimension:function(){return this.getViewer().getContextDimension()},setContextDimension:function(e){var t=this.getContextDimension(),o=e.width-t.width,r=e.height-t.height,i=this.getDimension(),n={width:i.width+o,height:i.height+r};return this.setDimension(n.width,n.height),this},exportToDataUri:function(e,t){return this.getViewer().exportToDataUri(e,t)},exportDetails:function(e,t){this.getAutoSizeExport()&&this.setAutoSize(!0);var o=this.getViewer().getActualDrawOptions(),r=this.getViewer().getContextDimension(),i={dataUri:this.exportToDataUri(e,t),drawOptions:o,drawOptionsJson:JSON.stringify(o),chemObj:this.getChemObj(),chemObjJson:Kekule.IO.saveMimeData(this.getChemObj(),"chemical/x-kekule-json"),autoSize:this.getAutoSizeExport(),autofit:this.getAutofit(),width:Math.round(r.width),height:Math.round(r.height),renderType:this.getRenderType()||Kekule.Render.RendererType.R2D,backgroundColor:this.getBackgroundColor(this.getRenderType()),predefinedSetting:this.getExportViewerPredefinedSetting()};if(this.getAutoSizeExport()){this.setAutoSize(!1);var n=this.getViewer().getElement();n.style.width="auto",n.style.height="auto",this.getViewer().resized()}return i},getExportImgElemAttributes:function(e,t){var o=this.exportDetails(e,t),r="width:"+o.width+"px; height:"+o.height+"px",i={src:o.dataUri,style:r,width:o.width,height:o.height,"data-kekule-widget":"Kekule.ChemWidget.Viewer","data-render-type":o.renderType,"data-chem-obj":o.chemObjJson,"data-draw-options":o.drawOptionsJson,"data-predefined-setting":o.predefinedSetting};return Kekule.ObjUtils.notUnset(o.autoSize)&&(i["data-auto-size"]=o.autoSize),Kekule.ObjUtils.notUnset(o.autofit)&&(i["data-auto-fit"]=o.autofit),Kekule.ObjUtils.notUnset(o.backgroundColor)&&(i["data-background-color"]=o.backgroundColor),i},createExportImgElement:function(e,t,o){var r=e.createElement("img"),i=this.getExportImgElemAttributes(t,o);return Kekule.DomUtils.setElemAttributes(r,i),r},importChemObjWithDetails:function(e,t){return this.setChemObj(e),this.setRenderType(t.renderType||Kekule.Render.RendererType.R2D),Kekule.ObjUtils.notUnset(t.autoSize)&&this.setAutoSizeExport(!!t.autoSize),Kekule.ObjUtils.notUnset(t.autofit)&&this.setAutofit(!!t.autofit),!t.width||!t.height||t.autoSize&&t.renderType!==Kekule.Render.RendererType.R3D||this.setContextDimension({width:t.width,height:t.height}),t.drawOptions&&this.getViewer().setDrawOptions(t.drawOptions),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor,this.getRenderType()),this},importFromElemAttribs:function(e){e.width=DataType.JsonUtility.parse(e.width),e.height=DataType.JsonUtility.parse(e.height);var t=e["data-chem-obj"],o=t?Kekule.IO.loadMimeData(t,"chemical/x-kekule-json"):null;return e["data-render-type"]&&(e.renderType=DataType.JsonUtility.parse(e["data-render-type"])),e["data-draw-options"]&&(e.drawOptions=DataType.JsonUtility.parse(e["data-draw-options"])),e["data-auto-size"]&&(e.autoSize=DataType.JsonUtility.parse(e["data-auto-size"])),e["data-autofit"]&&(e.autofit=DataType.JsonUtility.parse(e["data-autofit"])),e["data-background-color"]&&(e.backgroundColor=e["data-background-color"]),this.importChemObjWithDetails(o,e)},importFromElem:function(e){var t=Kekule.HtmlElementUtils.getElemPageRect(e),o=Kekule.DomUtils.fetchAttributeValuesToJson(e);return o.width||(o.width=t.width),o.height||(o.height=t.height),this.importFromElemAttribs(o)}}),Kekule.ChemWidget.ChemObjInserter.Configurator=Class.create(Kekule.Widget.Configurator,{CLASS_NAME:"Kekule.ChemWidget.ChemObjInserter.Configurator",initialize:function(e){this._checkBoxAutoSize=null,this._checkBoxAutofit=null,this._checkBoxShowInfo=null,this._textBoxWidth=null,this._textBoxHeight=null,this._colorPicker=null,this.tryApplySuper("initialize",[e]),this.addEventListener("valueChange",function(e){this.saveConfigValues()},this)},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setAutoUpdate(!0)},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+i.CHEMOBJSETTER_CONFIGURATOR},doCreateSubElements:function(e,o){var n;(s=e.createElement("div")).className=i.CHEMOBJSETTER_REGION,(l=new Kekule.Widget.CheckBox(this)).setText(Kekule.$L("ChemWidgetTexts.CAPTION_AUTOSIZE")),l.addClassName(i.CHEMOBJSETTER_LINE),l.appendToElem(s),this._checkBoxAutoSize=l,(n=e.createElement("span")).className=r.PART_ASSOC_TEXT_CONTENT,t.setElementText(n,Kekule.$L("ChemWidgetTexts.HINT_AUTOSIZE")),s.appendChild(n),(l=new Kekule.Widget.CheckBox(this)).setText(Kekule.$L("ChemWidgetTexts.CAPTION_AUTOFIT")),l.addClassName(i.CHEMOBJSETTER_LINE),l.appendToElem(s),this._checkBoxAutofit=l,(n=e.createElement("span")).className=r.PART_ASSOC_TEXT_CONTENT,t.setElementText(n,Kekule.$L("ChemWidgetTexts.HINT_AUTOFIT")),s.appendChild(n),o.appendChild(s),(s=e.createElement("div")).className=i.CHEMOBJSETTER_REGION,(d=e.createElement("label")).className=i.CHEMOBJSETTER_REGION_LABEL,t.setElementText(d,Kekule.$L("ChemWidgetTexts.CAPTION_LABEL_SIZE")),s.appendChild(d),s.appendChild(e.createElement("br")),(a=new Kekule.Widget.TextBox(this)).setPlaceholder(Kekule.$L("ChemWidgetTexts.PLACEHOLDER_WIDTH")),a.appendToElem(s),this._textBoxWidth=a;var a,l,s,d=e.createElement("span");t.setElementText(d,"×"),s.appendChild(d),(a=new Kekule.Widget.TextBox(this)).setPlaceholder(Kekule.$L("ChemWidgetTexts.PLACEHOLDER_HEIGHT")),a.appendToElem(s),this._textBoxHeight=a,(l=new Kekule.Widget.CheckBox(this)).setText(Kekule.$L("ChemWidgetTexts.CAPTION_SHOWSIZEINFO")),l.appendToElem(s),this._checkBoxShowInfo=l,o.appendChild(s),(s=e.createElement("div")).className=i.CHEMOBJSETTER_REGION,(d=e.createElement("label")).className=i.CHEMOBJSETTER_REGION_LABEL,t.setElementText(d,Kekule.$L("ChemWidgetTexts.CAPTION_BACKGROUND_COLOR")),s.appendChild(d),s.appendChild(e.createElement("br"));var u=new Kekule.Widget.ColorPicker(this);u.setSpecialColors([Kekule.Widget.ColorPicker.SpecialColors.TRANSPARENT]),u.appendToElem(s),this._colorPicker=u,o.appendChild(s)},loadConfigValues:function(){this.tryApplySuper("loadConfigValues");var e=this.getWidget();if(e){var t=!e.getIs3D();this._checkBoxAutoSize.setChecked(t&&e.getAutoSizeExport()),this._checkBoxAutoSize.setEnabled(t),this._checkBoxAutofit.setChecked(t&&e.getAutofit()),this._checkBoxAutofit.setEnabled(t),this._checkBoxShowInfo.setChecked(e.getShowInfo());var o=e.getContextDimension();this._textBoxWidth.setText(Math.round(o.width)),this._textBoxHeight.setText(Math.round(o.height));var r=t?e.getBackgroundColor2D():e.getBackgroundColor3D();this._colorPicker.setValue(r||Kekule.Widget.ColorPicker.SpecialColors.TRANSPARENT)}},saveConfigValues:function(){this.tryApplySuper("saveConfigValues");var e=this.getWidget();if(e){!e.getIs3D()?(e.setAutoSizeExport(this._checkBoxAutoSize.getChecked()),e.setAutofit(this._checkBoxAutofit.getChecked()),e.setBackgroundColor2D(this._colorPicker.getValue())):e.setBackgroundColor3D(this._colorPicker.getValue()),e.setShowInfo(this._checkBoxShowInfo.getChecked());var t={width:parseInt(this._textBoxWidth.getText()),height:parseInt(this._textBoxHeight.getText())};e.setContextDimension(t),e.invokeEvent("configSave")}}})}(),function(){Kekule;var e=Kekule.CoordMode,t=Kekule.ArrayUtils;ClassEx.extend(Kekule.ChemObject,{isStandalone:function(){return!this.getIsAttachedToParent()},getStandaloneAncestor:function(){for(var e=this;e.isStandalone&&!e.isStandalone()&&e.getParent&&e.getParent();)e=e.getParent();return e},getCascadeDeleteObjs:function(){return[]},cascadeRemove:function(e){var t=this.getParent();t&&t.notifyBeforeCascadeRemove&&t.notifyBeforeCascadeRemove(this),e?this.finalize():this.removeSelf(),t&&t.notifyAfterCascadeRemove&&t.notifyAfterCascadeRemove(this)},notifyBeforeCascadeRemove:function(e,t){},notifyAfterCascadeRemove:function(e,t){!this.getKeepEmptyEvenOnCascadeRemove()&&this.isEmpty()&&this.cascadeRemove(t)},isCoordDependent:function(){return!1},getCoordDependentObjects:function(){var e=[];return this.isCoordDependent()||e.push(this),e},getCoordDeterminateObjects:function(){var e=[];if(this.getAttachedMarkers)for(var o=this.getAttachedMarkers()||[],r=0,i=o.length;r<i;++r)e=e.concat(o[r].getCoordDependentObjects());var n=this.getAttachedCoordStickNodes();for(r=0,i=n.length;r<i;++r){var a=n[r];t.pushUnique(e,a),t.pushUnique(e,a.getCoordDeterminateObjects())}return e},getAllContainingConnectors:function(){return[]},getConstraintManipulationBaseObj:function(){if(this.isAttachedMarker&&this.isAttachedMarker()){var e=this.getParent();return e instanceof Kekule.StructureFragment?null:e}return null},transformAbsCoordByMatrix:function(e,t,o,r,i,n){if(this.getChildCount&&(r||Kekule.ObjUtils.isUnset(r)))for(var a=0,l=this.getChildCount();a<l;++a){var s=this.getChildAt(a);s&&s.transformAbsCoordByMatrix&&s.transformAbsCoordByMatrix(t,t,o,r,i,!0)}var d=o===Kekule.CoordMode.COORD3D?Kekule.CoordUtils.transform3DByMatrix:Kekule.CoordUtils.transform2DByMatrix;if(n){if(this.getCoordOfMode&&this.setCoordOfMode){var u=d(this.getCoordOfMode(o,i),e);this.setCoordOfMode(u,o)}}else if(this.getAbsCoordOfMode&&this.setAbsCoordOfMode){u=d(this.getAbsCoordOfMode(o,i),e);this.setAbsCoordOfMode(u,o)}},scaleSize:function(e,t,o,r){if(this.getSizeOfMode&&this.setSizeOfMode){var i=this.getSizeOfMode(t,r),n=Kekule.CoordUtils.multiply(i,e);this.setSizeOfMode(n,t)}if(this.getChildCount&&(o||Kekule.ObjUtils.isUnset(o)))for(var a=0,l=this.getChildCount();a<l;++a){var s=this.getChildAt(a);s&&s.scaleSize&&s.scaleSize(e,t,o,r)}}}),ClassEx.extendMethod(Kekule.ChemObject,"_attachedMarkerAdded",function($origin,e){var t=$origin(e);return e&&e.setIsAttachedToParent(!0),t}),ClassEx.extendMethod(Kekule.ChemObject,"_attachedMarkerRemoved",function($origin,e){var t=$origin(e);return e&&e.setIsAttachedToParent(!1),t}),ClassEx.defineProps(Kekule.ChemObject,[{name:"keepEmptyEvenOnCascadeRemove",dataType:DataType.BOOL,scope:Class.PropertyScope.PUBLIC},{name:"isAttachedToParent",dataType:DataType.BOOL,scope:Class.PropertyScope.PUBLIC}]),ClassEx.extend(Kekule.ChemStructureObject,{getCascadeDeleteObjs:function(){for(var e=this.tryApplySuper("getCascadeDeleteObjs"),t=this.getLinkedConnectors?this.getLinkedConnectors():[],o=0,r=t.length;o<r;++o){var i=t[o];if(i.getConnectedObjs().length<=2){Kekule.ArrayUtils.pushUnique(e,i);var n=i.getCascadeDeleteObjs();Kekule.ArrayUtils.pushUnique(e,n)}}return e},isStandalone:function(){return!1},getCoordDeterminateObjects:function(){for(var e=this.tryApplySuper("getCoordDeterminateObjects"),o=this.getLinkedConnectors(),r=0,i=o.length;r<i;++r){var n=o[r];t.pushUnique(e,n),t.pushUnique(e,n.getCoordDeterminateObjects())}return e}}),ClassEx.extend(Kekule.BaseStructureNode,{getCascadeDeleteObjs:function(){return this.tryApplySuper("getCascadeDeleteObjs")},isCoordDependent:function(){return!1},getCoordDependentObjects:function(){return this.tryApplySuper("getCoordDependentObjects")},move:function(e,t){var o=this.getCoordOfMode(t),r=Kekule.CoordUtils.add(o,e);return this.setCoordOfMode(r,t),r},move2D:function(t){return this.move(t,e.COORD2D)},move3D:function(t){return this.move(t,e.COORD3D)}}),ClassEx.extend(Kekule.BaseStructureConnector,{getCascadeDeleteObjs:function(){for(var e=this.tryApplySuper("getCascadeDeleteObjs"),t=this.getConnectedObjs(),o=0,r=t.length;o<r;++o){var i=t[o];i instanceof Kekule.BaseStructureNode&&i.getLinkedConnectors().length<=1&&Kekule.ArrayUtils.pushUnique(e,i)}return e},isCoordDependent:function(){return!0},getCoordDependentObjects:function(){for(var e=this.tryApplySuper("getCoordDependentObjects"),o=this.getConnectedObjs(),r=0,i=o.length;r<i;++r){var n=o[r];if(n.isExposed)var a=n.isExposed()?n:n.getExposedAncestor();else a=n;a&&t.pushUnique(e,a.getCoordDependentObjects())}return e},move:function(e,t){for(var o=0,r=this.getConnectedObjCount();o<r;++o){var i=this.getConnectedObjAt(o);i.move&&i.move(e,t)}},move2D:function(t){return this.move(t,e.COORD2D)},move3D:function(t){return this.move(t,e.COORD3D)},setAbsBaseCoord:function(e,t){var o=this.getAbsBaseCoord(),r=Kekule.CoordUtils.substract(e,o);this.move(r,t)},setAbsBaseCoord2D:function(e){this.setAbsCoordOfMode(e,Kekule.CoordMode.COORD2D)},setAbsBaseCoord3D:function(e){this.setAbsCoordOfMode(e,Kekule.CoordMode.COORD3D)}}),ClassEx.extend(Kekule.ChemStructureNode,{getConstraintManipulationBaseObj:function(){var e=this.getLinkedObjs();return 1===e.length?e[0]:this.tryApplySuper("getConstraintManipulationBaseObj")}}),ClassEx.extend(Kekule.Glyph.PathGlyphNode,{getCascadeDeleteObjs:function(){return[this.getParent()]},getConstraintManipulationBaseObj:function(){var e=this.getLinkedObjs();return 1===e.length?e[0]:this.tryApplySuper("getConstraintManipulationBaseObj")}}),ClassEx.extend(Kekule.Glyph.PathGlyphConnectorControlNode,{getCoordDeterminateObjects:function(){var e=this.tryApplySuper("getCoordDeterminateObjects"),t=this.getParentConnector();return t&&(e=(e||[]).concat([t])),e}}),ClassEx.extend(Kekule.Glyph.PathGlyphConnector,{getCascadeDeleteObjs:function(){return[this.getParent()]},getCoordDependentObjects:function(){var e=this.tryApplySuper("getCoordDependentObjects"),t=this.getControlPoints&&this.getControlPoints();return t&&t.length&&(e=(e||[]).concat(t)),e}}),ClassEx.extend(Kekule.StructureFragment,{isStandalone:function(){return!this.getCrossConnectors().length},notifyBeforeCascadeRemove:function(e,t){var o=this._getObjsNeedToBeCascadeRemoved(e);if(o&&o.length)for(var r=o.length-1;r>=0;--r){var i=o[r];t?i.finalize():i.removeSelf()}this.tryApplySuper("notifyBeforeCascadeRemove",[e,t])},getCoordDependentObjects:function(){if(this.isExpanded&&!this.isExpanded())return this.tryApplySuper("getCoordDependentObjects");if(this.hasCtab()){for(var e=[],o=this.getChildCount(),r=0;r<o;++r){var i=this.getChildAt(r);t.pushUnique(e,i.getCoordDependentObjects())}return e}return this.tryApplySuper("getCoordDependentObjects")},transformAbsCoordByMatrix:function(e,t,o,r,i,n){if(r||Kekule.ObjUtils.isUnset(r))for(var a=0,l=this.getNodeCount();a<l;++a){var s=this.getNodeAt(a);s&&s.transformAbsCoordByMatrix&&s.transformAbsCoordByMatrix(t,t,o,r,i,!0)}this.tryApplySuper("transformAbsCoordByMatrix",[e,t,o,!1,i,n])}}),ClassEx.extend(Kekule.Glyph.Base,{isStandalone:function(){return this.tryApplySuper("isStandalone")}}),ClassEx.extend(Kekule.Glyph.PathGlyph,{getCoordDependentObjects:function(){for(var e=[],t=this.getNodeCount(),o=0;o<t;++o){var r=this.getNodeAt(o);e.push(r)}return e},transformAbsCoordByMatrix:function(e,t,o,r,i,n){if(r||Kekule.ObjUtils.isUnset(r))for(var a=0,l=this.getNodeCount();a<l;++a){var s=this.getNodeAt(a);s&&s.transformAbsCoordByMatrix&&s.transformAbsCoordByMatrix(t,t,o,r,i,!0)}this.tryApplySuper("transformAbsCoordByMatrix",[e,t,o,!1,i,n])}}),ClassEx.extend(Kekule.Glyph.BaseArc,{ownerChanged:function(e,t){var o=!t&&e,r=this.tryApplySuper("ownerChanged",[e,t]);return o&&this.getIsEditing()&&this._autoAdjustClass(),r},_getChemStickTargets:function(){for(var e=[],t=0,o=this.getNodeCount();t<o;++t){var r=this.getNodeAt(t).getCoordStickTarget();this._isValidChemNodeOrConnectorStickTarget(r)&&e.push(r)}return e},notifyChildCoordStickTargetChanged:function(e,t,o){this._autoAdjustClass()},_autoAdjustClass:function(){this.getIsEditing()&&(this._getChemStickTargets().length>=2?this instanceof Kekule.Glyph.ElectronPushingArrow||this.__changeClass__(Kekule.Glyph.ElectronPushingArrow):this instanceof Kekule.Glyph.ElectronPushingArrow&&this.__changeClass__(Kekule.Glyph.Arc))}}),ClassEx.extendMethod(Kekule.Glyph.BaseArc,"createDefaultStructure",function($origin,e,t){var o=$origin(e,t);return this._autoAdjustClass(),o}),ClassEx.extend(Kekule.Glyph.BaseTwinArc,{ownerChanged:function(e,t){var o=!t&&e,r=this.tryApplySuper("ownerChanged",[e,t]);return o&&this.getIsEditing()&&this._autoAdjustClass(),r},_getChemStickTargets:function(){for(var e=[],t=this._getArrowStartingNodes(),o=0,r=t.length;o<r;++o){var i=t[o].getCoordStickTarget();this._isValidChemNodeOrConnectorStickTarget(i)&&e.push(i)}return e},notifyChildCoordStickTargetChanged:function(e,t,o){this._autoAdjustClass()},_autoAdjustClass:function(){this.getIsEditing()&&(this._getChemStickTargets().length>=2?this instanceof Kekule.Glyph.BondFormingElectronPushingArrow||(this.__changeClass__(Kekule.Glyph.BondFormingElectronPushingArrow),this.getElectronCount()||this.setElectronCount(1)):this instanceof Kekule.Glyph.BondFormingElectronPushingArrow&&this.__changeClass__(Kekule.Glyph.TwinArc))}})}(),function(){"use strict";var e=Kekule.ObjUtils,t=Kekule.ArrayUtils,o=Kekule.HtmlElementUtils,r=Kekule.CoordUtils,i=Kekule.Widget.HtmlClassNames,n=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{EDITOR:"K-Chem-Editor",EDITOR_CLIENT:"K-Chem-Editor-Client",EDITOR_UIEVENT_RECEIVER:"K-Chem-Editor-UiEvent-Receiver",EDITOR2D:"K-Chem-Editor2D",EDITOR3D:"K-Chem-Editor3D"}),Kekule.ChemWidget.Editor={},Kekule.Editor=Kekule.ChemWidget.Editor,Kekule.Editor.CoordSys=Kekule.Render.CoordSystem,Kekule.Editor.BoxRegion={OUTSIDE:0,CORNER_TL:1,CORNER_TR:2,CORNER_BL:3,CORNER_BR:4,EDGE_TOP:11,EDGE_LEFT:12,EDGE_BOTTOM:13,EDGE_RIGHT:14,INSIDE:20},Kekule.Editor.SelectMode={RECT:0,POLYGON:1,POLYLINE:2,ANCESTOR:10},Kekule.Editor.BaseEditor=Class.create(Kekule.ChemWidget.ChemObjDisplayer,{CLASS_NAME:"Kekule.Editor.BaseEditor",BINDABLE_TAG_NAMES:["div","span"],OBSERVING_GESTURES:["rotate","rotatestart","rotatemove","rotateend","rotatecancel","pinch","pinchstart","pinchmove","pinchend","pinchcancel","pinchin","pinchout"],initialize:function(e,t,o,r){this._objSelectFlag=0,this._objectUpdateFlag=0,this._objectManipulateFlag=0,this._uiMarkerUpdateFlag=0,this._updatedObjectDetails=[],this._operatingObjs=[],this._operatingRenderers=[],this._initialRenderTransformParams=null,this._objChanged=!1,this._lengthCaches={},this.setPropStoreFieldValue("enableIssueCheck",!0),this.setPropStoreFieldValue("enableCreateNewDoc",!0),this.setPropStoreFieldValue("enableOperHistory",!0),this.setPropStoreFieldValue("enableOperContext",!0),this.setPropStoreFieldValue("initOnNewDoc",!0),this.tryApplySuper("initialize",[e,t,o]),!this.getChemObj()&&this.getInitOnNewDoc()&&this.getEnableCreateNewDoc()&&this.newDoc(),this.setPropStoreFieldValue("editorConfigs",r||this.createDefaultConfigs()),this.setEnableGesture(!0)},initProperties:function(){this.defineProp("editorConfigs",{dataType:"Kekule.Editor.BaseEditorConfigs",serializable:!1,getter:function(){return this.getDisplayerConfigs()},setter:function(e){return this.setDisplayerConfigs(e)}}),this.defineProp("defBondLength",{dataType:DataType.FLOAT,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("defBondLength");return e||(e=this.getEditorConfigs().getStructureConfigs().getDefBondLength()),e}}),this.defineProp("defBondScreenLength",{dataType:DataType.FLOAT,serializable:!1,setter:null,getter:function(){var e=this._lengthCaches.defBondScreenLength;if(e)return e;var t=this.getDefBondLength()||0,o=this.translateDistance(t,Kekule.Render.CoordSystem.CHEM,Kekule.Render.CoordSystem.SCREEN);return this._lengthCaches.defBondScreenLength=o,o}}),this.defineProp("currBoundInflation",{dataType:DataType.NUMBER,serializable:!1,setter:null,getter:function(){var e=this.getCurrPointerType();return this.getInteractionBoundInflation(e)}}),this.defineProp("currPointerType",{dataType:DataType.STRING,serializable:!1}),this.defineProp("enableCreateNewDoc",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("initOnNewDoc",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableOperHistory",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("operHistory",{dataType:"Kekule.OperationHistory",serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("operHistory");return e||(e=new Kekule.OperationHistory,this.setPropStoreFieldValue("operHistory",e),e.addEventListener("push",this.reactOperHistoryPush,this),e.addEventListener("pop",this.reactOperHistoryPop,this),e.addEventListener("undo",this.reactOperHistoryUndo,this),e.addEventListener("redo",this.reactOperHistoryRedo,this),e.addEventListener("clear",this.reactOperHistoryClear,this),e.addEventListener("change",this.reactOperHistoryChange,this)),e},setter:null}),this.defineProp("operationsInCurrManipulation",{dataType:DataType.ARRAY,scope:Class.PropertyScope.PRIVATE,serializable:!1}),this.defineProp("selection",{dataType:DataType.ARRAY,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("selection");return e||(e=[],this.setPropStoreFieldValue("selection",e)),e},setter:function(e){this.setPropStoreFieldValue("selection",e),this.selectionChanged()}}),this.defineProp("selectMode",{dataType:DataType.INT,getter:function(){var e=this.getPropStoreFieldValue("selectMode");return Kekule.ObjUtils.isUnset(e)&&(e=Kekule.Editor.SelectMode.RECT),e},setter:function(e){this.getSelectMode()!==e&&(this.setPropStoreFieldValue("selectMode",e),this.hideSelectingMarker())}}),this.defineProp("isToggleSelectOn",{dataType:DataType.BOOL}),this.defineProp("hotTrackedObjs",{dataType:DataType.ARRAY,serializable:!1,setter:function(e){var t=e?Kekule.ArrayUtils.toArray(e):[];if(this.getEditorConfigs()&&this.getEditorConfigs().getInteractionConfigs().getEnableHotTrack()){var o;if(this.setPropStoreFieldValue("hotTrackedObjs",t),t&&t.length){o=[];for(var r=0,i=t.length;r<i;++r){var n=this.getBoundInfoRecorder().getBound(this.getObjContext(),t[r]);o&&Kekule.ArrayUtils.pushUnique(o,n)}}o?this.changeHotTrackMarkerBounds(o):this.getUiHotTrackMarker().getVisible()&&this.hideHotTrackMarker()}}}),this.defineProp("hotTrackedObj",{dataType:DataType.OBJECT,serializable:!1,getter:function(){return this.getHotTrackedObjs()&&this.getHotTrackedObjs()[0]},setter:function(e){this.setHotTrackedObjs(e)}}),this.defineProp("enableOperContext",{dataType:DataType.BOOL,setter:function(e){if(this.setPropStoreFieldValue("enableOperContext",!!e),!e){var t=this.getPropStoreFieldValue("operContext"),o=this.getPropStoreFieldValue("drawBridge");o&&t&&o.releaseContext(t)}}}),this.defineProp("issueCheckExecutor",{dataType:"Kekule.IssueCheck.Executor",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("issueCheckExecutor");if(!e){e=this.createIssueCheckExecutor();var t=this;e.addEventListener("execute",function(e){t.setIssueCheckResults(e.checkResults)}),this.setPropStoreFieldValue("issueCheckExecutor",e)}return e}}),this.defineProp("issueCheckerIds",{dataType:DataType.ARRAY,getter:function(){return this.getIssueCheckExecutor().getCheckerIds()},setter:function(e){this.getIssueCheckExecutor().setCheckerIds(e)}}),this.defineProp("enableIssueCheck",{dataType:DataType.BOOL,getter:function(){return this.getIssueCheckExecutor().getEnabled()},setter:function(e){this.getIssueCheckExecutor().setEnabled(!!e)}}),this.defineProp("enableAutoIssueCheck",{dataType:DataType.BOOL,setter:function(e){!!e!==this.getEnableAutoIssueCheck()&&(this.setPropStoreFieldValue("enableAutoIssueCheck",!!e),e&&this.checkIssues(),this.setShowAllIssueMarkers(!!e))}}),this.defineProp("issueCheckResults",{dataType:DataType.ARRAY,serializable:!1,setter:function(e){var t=this.getActiveIssueCheckResult();this.setPropStoreFieldValue("issueCheckResults",e),t&&(e||[]).indexOf(t)<0&&this.setPropStoreFieldValue("activeIssueCheckResult",null),this.issueCheckResultsChanged()}}),this.defineProp("activeIssueCheckResult",{dataType:DataType.OBJECT,serializable:!1,setter:function(e){this.getActiveIssueCheckResult()!==e&&(this.setPropStoreFieldValue("activeIssueCheckResult",e),e&&this.deselectAll(),this.issueCheckResultsChanged())}}),this.defineProp("enableAutoScrollToActiveIssue",{dataType:DataType.BOOL}),this.defineProp("showAllIssueMarkers",{dataType:DataType.BOOL,setter:function(e){!!e!==this.getShowAllIssueMarkers()&&(this.setPropStoreFieldValue("showAllIssueMarkers",!!e),this.recalcIssueCheckUiMarkers())}}),this.defineProp("enableGesture",{dataType:DataType.BOOL,setter:function(e){var t=!!e;this.getEnableGesture()!==t&&(this.setPropStoreFieldValue("enableGesture",t),this.startObservingGestureEvents(this.OBSERVING_GESTURES))}}),this.defineProp("uiEventReceiverElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("objContextParentElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("operContextParentElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("uiContextParentElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("objContext",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){return this.getDrawContext()}}),this.defineProp("operContext",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){if(this.getEnableOperContext()){var e=this.getPropStoreFieldValue("operContext");if(!e){var t=this.getDrawBridge();if(t){var o=this.getOperContextParentElem();if(!o)return null;var r=Kekule.HtmlElementUtils.getElemScrollDimension(o);e=t.createContext(o,r.width,r.height),this.setPropStoreFieldValue("operContext",e)}}return e}return null}}),this.defineProp("uiContext",{dataType:DataType.OBJECT,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("uiContext");if(!e){var t=this.getUiDrawBridge();if(t){var o=this.getUiContextParentElem();if(!o)return null;var r=Kekule.HtmlElementUtils.getElemScrollDimension(o);e=t.createContext(o,r.width,r.height),this.setPropStoreFieldValue("uiContext",e)}}return e}}),this.defineProp("objDrawBridge",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){return this.getDrawBridge()}}),this.defineProp("uiDrawBridge",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("uiDrawBridge");return e||(e=this.createUiDrawBridge(),this.setPropStoreFieldValue("uiDrawBridge",e)),e}}),this.defineProp("uiPainter",{dataType:"Kekule.Render.ChemObjPainter",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("uiPainter");if(!e){var t=this.getUiMarkers();return(e=new Kekule.Render.ChemObjPainter(Kekule.Render.RendererType.R2D,t,this.getUiDrawBridge())).setCanModifyTargetObj(!0),this.setPropStoreFieldValue("uiPainter",e),e}return e}}),this.defineProp("uiRenderer",{dataType:"Kekule.Render.AbstractRenderer",serializable:!1,setter:null,getter:function(){var e=this.getUiPainter();return e?(e.getRenderer()||e.prepareRenderer(),e.getRenderer()||null):null}}),this.defineProp("uiMarkers",{dataType:"Kekule.ChemWidget.UiMarkerCollection",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("uiMarkers");return e||(e=new Kekule.ChemWidget.UiMarkerCollection,this.setPropStoreFieldValue("uiMarkers",e)),e}}),this._defineUiMarkerProp("uiHotTrackMarker"),this._defineUiMarkerProp("uiSelectionAreaMarker"),this._defineUiMarkerProp("uiSelectingMarker"),this._defineIssueCheckUiMarkerGroupProps(),this.defineProp("uiSelectionAreaContainerBox",{dataType:DataType.Object,serializable:!1,scope:Class.PropertyScope.PRIVATE}),this.defineProp("objRendererMap",{dataType:"Kekule.MapEx",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("objRendererMap");return e||(e=new Kekule.MapEx(!0),this.setPropStoreFieldValue("objRendererMap",e)),e}}),this.defineProp("zoomCenter",{dataType:DataType.HASH})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setOperationsInCurrManipulation([]),this.setEnableAutoIssueCheck(!1),this.setEnableAutoScrollToActiveIssue(!0);var e=Kekule.IssueCheck.CheckerIds;this.setIssueCheckerIds([e.ATOM_VALENCE,e.BOND_ORDER,e.NODE_DISTANCE_2D])},_defineUiMarkerProp:function(e,t){return this.defineProp(e,{dataType:"Kekule.ChemWidget.AbstractUIMarker",serializable:!1,getter:function(){var t=this.getPropStoreFieldValue(e);return t||(t=this.createShapeBasedMarker(e,null,null,!1)),t},setter:function(o){t||(t=this.getUiMarkers());var r=this.getPropValue(e);r&&(t.removeMarker(r),r.finalize()),t.addMarker(o),this.setPropStoreFieldValue(e,o)}})},_defineIssueCheckUiMarkerGroupProps:function(e){for(var t=Kekule.ErrorLevel,o=function(e,o){return e+"_"+t.levelToString(o)},r="issueCheckUiMarker",i=[t.ERROR,t.WARNING,t.NOTE,t.LOG],n=0,a=i.length;n<a;++n){var l=o(r,i[n]);this._defineUiMarkerProp(l,e)}this._defineUiMarkerProp(r+"_active",e),this["get"+r.upperFirst()]=function(e){var t=o(r,e);return this.getPropValue(t)},this["set"+r.upperFirst()]=function(e,t){var i=o(r,e);return this.setPropValue(i,t)},this["getActive"+r.upperFirst()]=function(){return this.getPropValue(r+"_active")},this["getAll"+r.upperFirst()+"s"]=function(){for(var e=[],t=0,o=i.length;t<o;++t)e.push(this.getIssueCheckUiMarker(i[t]));return e}},doFinalize:function(){var e=this.getPropStoreFieldValue("operHistory");e&&(e.finalize(),this.setPropStoreFieldValue("operHistory",null));var t=this.getPropStoreFieldValue("objDrawBridge"),o=this.getPropStoreFieldValue("operContext");t&&o&&t.releaseContext(o),this.setPropStoreFieldValue("operContext",null);t=this.getPropStoreFieldValue("uiDrawBridge"),o=this.getPropStoreFieldValue("uiContext");t&&o&&t.releaseContext(o),this.setPropStoreFieldValue("uiDrawBridge",null),this.setPropStoreFieldValue("uiContext",null);var r=this.getPropStoreFieldValue("objRendererMap");r&&r.finalize(),this.setPropStoreFieldValue("objRendererMap",null);var i=this.getPropStoreFieldValue("issueCheckExecutor");i&&i.finalize(),this.setPropStoreFieldValue("issueCheckExecutor",null),this.tryApplySuper("doFinalize")},elementBound:function(e){this.setObserveElemResize(!0)},createDefaultConfigs:function(){return new Kekule.Editor.BaseEditorConfigs},doCreateRootElement:function(e){return e.createElement("div")},doCreateSubElements:function(e,t){var o=e.createElement("div");return o.className=n.EDITOR_CLIENT,t.appendChild(o),this._editClientElem=o,[o]},getCoreElement:function(){return this._editClientElem||this.tryApplySuper("getCoreElement")},getEditClientElem:function(){return this._editClientElem},doGetWidgetClassName:function(){var e=this.tryApplySuper("doGetWidgetClassName")+" "+n.EDITOR;return e+=" "+(this.getRenderType()===Kekule.Render.RendererType.R3D?n.EDITOR3D:n.EDITOR2D)},doBindElement:function(e){this.createContextParentElems(),this.createUiEventReceiverElem()},doGetInitialZoom:function(){var e,t=this.getEditorConfigs();return t&&(e=t.getInteractionConfigs().getEditorInitialZoom()),e||(e=this.tryApplySuper("doGetInitialZoom")),e},doSetInitialZoom:function(e){var t=this.getEditorConfigs();t&&t.getInteractionConfigs().setEditorInitialZoom(e),this.tryApplySuper("doSetInitialZoom",[e])},zoomTo:function(e,t,o){var r=Kekule.CoordUtils,i=this.getCurrZoom(),n=e,a=this.tryApplySuper("zoomTo",[e,t]),l=this.getElement(),s={x:l.scrollLeft,y:l.scrollTop};o||(o=this.getZoomCenter()),o||(o=r.add(s,{x:l.clientWidth/2,y:l.clientHeight/2}));var d=r.multiply(o,n/i-1);return l.scrollLeft+=d.x,l.scrollTop+=d.y,a},zoomIn:function(e,t){var o=this.getCurrZoom(),r=Kekule.ZoomUtils.getNextZoomInRatio(o,e||1);return this.zoomTo(r,null,t)},zoomOut:function(e,t){var o=this.getCurrZoom(),r=Kekule.ZoomUtils.getNextZoomOutRatio(o,e||1);return this.zoomTo(r,null,t)},resetZoom:function(e){return this.zoomTo(this.getInitialZoom()||1,null,e)},changeClientSize:function(e,t,o){this._initialRenderTransformParams=null;var r=this.getCoreElement().style;o||(o=1);var i=e*o,n=t*o;i&&(r.width=i+"px"),n&&(r.height=n+"px");for(var a=[this.getObjContext(),this.getOperContext(),this.getUiContext()],l=0,s=a.length;l<s;++l){var d=a[l];d&&this.getDrawBridge().setContextDimension(d,i,n)}this.repaint()},getVisibleClientScreenBox:function(){var e=this.getEditClientElem().parentNode,t=Kekule.HtmlElementUtils.getElemClientDimension(e),o=this.getClientScrollPosition();return t.x1=o.x,t.y1=o.y,t.x2=t.x1+t.width,t.y2=t.y1+t.height,t},getVisibleClientBoxOfSys:function(e){var t=this.getVisibleClientScreenBox(),o=Kekule.BoxUtils.getMinMaxCoords(t),r=this.translateCoord(o.min,Kekule.Editor.CoordSys.SCREEN,e),i=this.translateCoord(o.max,Kekule.Editor.CoordSys.SCREEN,e);return Kekule.BoxUtils.createBox(r,i)},getVisibleClientObjBox:function(e){return this.getVisibleClientBoxOfSys(Kekule.Editor.CoordSys.CHEM)},isDirty:function(){return this.getEnableOperHistory()?this.getOperHistory().getCurrIndex()>=0:this._objChanged},getChemObjSrcInfo:function(e){return this.isDirty()?null:e.getSrcInfo?e.getSrcInfo():null},getActualDrawOptions:function(){var e=this.tryApplySuper("getActualDrawOptions");if(this._initialRenderTransformParams){var t=Object.extend({},this._initialRenderTransformParams);return t=Object.extend(t,e)}return e},repaint:function(e){var t=e,o=this.tryApplySuper("repaint",[t]);return this._initialRenderTransformParams||(this._initialRenderTransformParams=this.getPainter().getActualInitialRenderTransformOptions(this.getObjContext())),this.recalcUiMarkers(),o},newDoc:function(){this.load(this.doCreateNewDocObj())},doCreateNewDocObj:function(){return new Kekule.Molecule},getExportableClasses:function(){var e=this.getChemObj();return e&&e.getClass?[e.getClass()]:[]},exportObj:function(e){return this.exportObjs(e)[0]},exportObjs:function(e){var t=this.getChemObj();return e?t&&t instanceof e?[t]:[]:[t]},doLoad:function(e){this.deselectAll(),this._initialRenderTransformParams=null,this.getObjRendererMap().clear(),this.getOperHistory()&&this.getOperHistory().clear(),this.tryApplySuper("doLoad",[e]),this._objChanged=!1,this.setIssueCheckResults(null),this.requestAutoCheckIssuesIfNecessary()},doLoadEnd:function(e){this.tryApplySuper("doLoadEnd"),e||(this._initialRenderTransformParams=null)},doResize:function(){this._initialRenderTransformParams=null,this.tryApplySuper("doResize")},geometryOptionChanged:function(){var e=this.getDrawOptions().zoom;this.zoomChanged(e),this._clearLengthCaches(),this.tryApplySuper("geometryOptionChanged")},zoomChanged:function(e){},_clearLengthCaches:function(){this._lengthCaches={}},chemObjChanged:function(e,t){this.tryApplySuper("chemObjChanged",[e,t]),e!==t&&(t&&this._uninstallChemObjEventListener(t),e&&this._installChemObjEventListener(e))},_installChemObjEventListener:function(e){e.addEventListener("change",this.reactChemObjChange,this)},_uninstallChemObjEventListener:function(e){e.removeEventListener("change",this.reactChemObjChange,this)},createUiEventReceiverElem:function(){var e=this.getCoreElement();if(e){var t=e.ownerDocument.createElement("div");return t.className=n.EDITOR_UIEVENT_RECEIVER,e.appendChild(t),o.addClass(t,i.DYN_CREATED),this.setPropStoreFieldValue("uiEventReceiverElem",t),t}},createContextParentElems:function(){var e=this.getCoreElement();if(e){var t=e.ownerDocument;this._createContextParentElem(t,e,"objContextParentElem"),this._createContextParentElem(t,e,"operContextParentElem"),this._createContextParentElem(t,e,"uiContextParentElem")}},_createContextParentElem:function(e,t,o){var r=e.createElement("div");return r.style.position="absolute",r.style.width="100%",r.style.height="100%",r.className=o+" "+i.DYN_CREATED,this.setPropStoreFieldValue(o,r),t.appendChild(r),r},createNewPainter:function(e){var t=this.tryApplySuper("createNewPainter",[e]);return t&&(t.setCanModifyTargetObj(!0),this.installPainterEventHandlers(t)),t},getDrawContextParentElem:function(){return this.getObjContextParentElem()},createUiDrawBridge:function(){var e=Kekule.Render.DrawBridge2DMananger.getPreferredBridgeInstance();return e||Kekule.error(Kekule.$L("ErrorMsg.DRAW_BRIDGE_NOT_SUPPORTED")),e},changeContextDimension:function(e){var t=this.tryApplySuper("changeContextDimension",[e]);return t&&(this._resizeContext(this.getOperContext(),this.getObjDrawBridge(),e.width,e.height),this._resizeContext(this.getUiContext(),this.getUiDrawBridge(),e.width,e.height)),t},_clearSpecContext:function(e,t){t&&e&&t.clearContext(e)},_renderSpecContext:function(e,t){t&&e&&t.renderContext(e)},clearObjContext:function(){this._clearSpecContext(this.getObjContext(),this.getDrawBridge()),this.getBoundInfoRecorder()&&this.getBoundInfoRecorder().clear(this.getObjContext())},clearOperContext:function(){this._clearSpecContext(this.getOperContext(),this.getDrawBridge())},clearUiContext:function(){this._clearSpecContext(this.getUiContext(),this.getUiDrawBridge())},clearContext:function(){this.clearObjContext(),this._operatingRenderers&&this.clearOperContext()},repaintOperContext:function(e){if(this._operatingRenderers&&this._operatingObjs){this.clearOperContext();try{var t={partialDrawObjs:this._operatingObjs,doNotClear:!0};this.repaint(t)}finally{this._renderSpecContext(this.getOperContext(),this.getDrawBridge())}}},getOperatingRenderers:function(){return this._operatingRenderers||(this._operatingRenderers=[]),this._operatingRenderers},setOperatingRenderers:function(e){this._operatingRenderers=e},installPainterEventHandlers:function(e){e.addEventListener("prepareDrawing",this.reactChemObjPrepareDrawing,this),e.addEventListener("clear",this.reactChemObjClear,this)},reactChemObjPrepareDrawing:function(e){var o=e.context,r=e.obj;if(r&&(o===this.getObjContext()||o===this.getOperContext())){var i=e.target;if(this.getObjRendererMap().set(r,i),this.getEnableOperContext()){for(var n=this._operatingObjs||[],a=!1,l=0,s=n.length;l<s;++l)if(this._isChemObjDirectlyRenderedByRenderer(this.getObjContext(),n[l],i)){a=!0;break}a&&(this._setRendererToOperContext(i),t.pushUnique(this.getOperatingRenderers(),i))}}},reactChemObjClear:function(e){var o=e.context,r=e.obj;if(r&&(o===this.getObjContext()||o===this.getOperContext())){var i=e.target;this.getObjRendererMap().remove(r),t.remove(this.getOperatingRenderers(),i)}},reactChemObjChange:function(e){var t=e.target,o=e.changedPropNames||[];!(o=Kekule.ArrayUtils.exclude(o,["id","owner","ownedObjs"])).length&&e.changedPropNames||this.objectChanged(t,o)},reactOperHistoryPush:function(e){this.invokeEvent("operPush",e)},reactOperHistoryPop:function(e){this.invokeEvent("operPop",e)},reactOperHistoryUndo:function(e){this.invokeEvent("operUndo",e)},reactOperHistoryRedo:function(e){this.invokeEvent("operRedo",e)},reactOperHistoryClear:function(e){this.invokeEvent("operHistoryClear",e)},reactOperHistoryChange:function(e){this.invokeEvent("operChange",e)},beginUpdateObject:function(){this._objectUpdateFlag>=0&&this.invokeEvent("beginUpdateObject"),--this._objectUpdateFlag},endUpdateObject:function(){++this._objectUpdateFlag,this.isUpdatingObject()||(this._updatedObjectDetails&&this._updatedObjectDetails.length&&(this.objectsChanged(this._updatedObjectDetails),this._updatedObjectDetails=[]),this._execAfterUpdateObjectProcs(),this.invokeEvent("endUpdateObject"))},isUpdatingObject:function(){return this._objectUpdateFlag<0},_registerAfterUpdateObjectProc:function(e){this.isUpdatingObject()?(this.endUpdateObject.suspendedProcs||(this.endUpdateObject.suspendedProcs=[]),this.endUpdateObject.suspendedProcs.push(e)):e.apply(this)},_execAfterUpdateObjectProcs:function(){var e=this.endUpdateObject.suspendedProcs;if(e)for(;e.length;){var t=e.shift();t&&t.apply(this)}},_mergeObjUpdatedDetails:function(e,t){for(var o=0,r=t.length;o<r;++o)this._mergeObjUpdatedDetailItem(e,t[o])},_mergeObjUpdatedDetailItem:function(e,t){for(var o=0,r=e.length;o<r;++o){var i=e[o];if(i.obj===t.obj)return i.propNames||(i.propNames=[]),void(t.propNames&&Kekule.ArrayUtils.pushUnique(i.propNames,t.propNames))}e.push(t)},_logUpdatedDetail:function(e){var t="";e.forEach(function(e){t+="Obj: "+e.obj.getId()+"["+e.obj.getClassName()+"]     ",t+="Props: ["+e.propNames.join(", ")+"]",t+="\n"}),console.log(t)},objectChanged:function(e,t){var o={obj:e,propNames:t},r=this.objectsChanged(o);return this.invokeEvent("editObjChanged",Object.extend({},o)),r},objectsChanged:function(e){var o=DataType.isArrayValue(e)?e:[e];if(this.isUpdatingObject())this._mergeObjUpdatedDetails(this._updatedObjectDetails,o);else{this.requestAutoCheckIssuesIfNecessary();var r=Kekule.Render.UpdateObjUtils._extractObjsOfUpdateObjDetails(o);this.doObjectsChanged(o,r),this.invokeEvent("editObjsUpdated",{details:Object.extend({},e)})}this._objChanged=!0,this.invokeEvent("editObjsChanged",{details:Object.extend({},e)});var i=this.getSelection();if(i&&r){var n=t.intersect(i,r);n.length&&this.invokeEvent("selectedObjsUpdated",{objs:n})}},doObjectsChanged:function(e,t){var o=Kekule.ArrayUtils.clone(e);t||(t=Kekule.Render.UpdateObjUtils._extractObjsOfUpdateObjDetails(o));var r=this._getAdditionalRenderRelatedObjs(t);if(r.length){var i=Kekule.Render.UpdateObjUtils._createUpdateObjDetailsFromObjs(r);Kekule.ArrayUtils.pushUnique(o,i)}Kekule.ArrayUtils.pushUnique(t,r);var n=this._operatingRenderers,a=n&&this._isAllObjsRenderedByRenderers(this.getObjContext(),t,n);this.canModifyPartialGraphic()?(this.getRootRenderer().modify(this.getObjContext(),o),this.recalcUiMarkers()):a?this.repaintOperContext():this.repaint()},beginManipulateObject:function(){this._objectManipulateFlag>=0&&this.invokeEvent("beginManipulateObject"),--this._objectManipulateFlag},endManipulateObject:function(){++this._objectManipulateFlag,this.isManipulatingObject()||(this._objectManipulateFlag=0,this.doManipulationEnd(),this.requestAutoCheckIssuesIfNecessary())},isManipulatingObject:function(){return this._objectManipulateFlag<0},doManipulationEnd:function(){this.setOperationsInCurrManipulation([]),this.invokeEvent("endManipulateObject")},beginManipulateAndUpdateObject:function(){this.beginManipulateObject(),this.beginUpdateObject()},endManipulateAndUpdateObject:function(){this.endUpdateObject(),this.endManipulateObject()},_needToCanonicalizeBeforeSaving:function(){return!0},_getAdditionalRenderRelatedObjs:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o],n=i.getCoordDeterminateObjects?i.getCoordDeterminateObjects():[];Kekule.ArrayUtils.pushUnique(t,n)}return t},_isAllObjsRenderedByRenderers:function(e,t,o){for(var r=0,i=t.length;r<i;++r){for(var n=t[r],a=!1,l=0,s=o.length;l<s;++l){if(o[l].isChemObjRenderedBySelf(e,n)){a=!0;break}}if(!a)return!1}return!0},prepareOperatingObjs:function(e){this._operatingRenderers&&this._operatingRenderers.length&&this.endOperatingObjs(!0),this.getEnableOperContext()&&(this._prepareRenderObjsInOperContext(e),this._operatingObjs=e),this.repaint()},endOperatingObjs:function(e){this.getEnableOperContext()&&(this._endRenderObjsInOperContext(),this._operatingObjs=null,e||this.repaint())},_isChemObjDirectlyRenderedByRenderer:function(e,t,o){var r=t.getStandaloneAncestor?t.getStandaloneAncestor():t;return o.isChemObjRenderedDirectlyBySelf(e,r)},_getStandaloneRenderObjsInOperContext:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o];i.getStandaloneAncestor&&(i=i.getStandaloneAncestor()),Kekule.ArrayUtils.pushUnique(t,i)}return t},_prepareRenderObjsInOperContext:function(e){for(var t=[],o=this.getObjRendererMap().getValues(),r=this.getObjContext(),i=this._getStandaloneRenderObjsInOperContext(e),n=0,a=i.length;n<a;++n)for(var l=i[n],s=0,d=o.length;s<d;++s){(u=o[s]).isChemObjRenderedDirectlyBySelf(r,l)&&Kekule.ArrayUtils.pushUnique(t,u)}if(t.length>0){for(n=0,a=t.length;n<a;++n){var u=t[n];this._setRendererToOperContext(u)}this._operatingRenderers=t}else this._operatingRenderers=null},_endRenderObjsInOperContext:function(){var e=this._operatingRenderers;if(e&&e.length){for(var t=0,o=e.length;t<o;++t){var r=e[t];this._unsetRendererToOperContext(r)}this.clearOperContext()}this._operatingRenderers=null},_setRendererToOperContext:function(e){e.setRedirectContext(this.getOperContext())},_unsetRendererToOperContext:function(e){e.setRedirectContext(null)},getInteractionBoundInflation:function(e){var t=this._lengthCaches.interactionBoundInflations,o=e||"default";if(t&&t[o])return t[o];var r,i=this.getEditorConfigs().getInteractionConfigs(),n=i.getPropValue("objBoundTrackInflationRatio");if(e){var a=e.upperFirst(),l="objBoundTrackInflationRatio"+a;i.hasProperty(l)&&(r=i.getPropValue(l))}var s,d=r||n,u=d&&this.getDefBondScreenLength()*d,c=i.getPropValue("objBoundTrackMinInflation");if(e){var p="objBoundTrackMinInflation"+a;i.hasProperty(p)&&(s=i.getPropValue(p))}var h=s||c,g=Math.max(u||0,h);return t||(t={},this._lengthCaches.interactionBoundInflations=t),t[o]=g,g},clearBoundMap:function(){this.getBoundInfoRecorder().clear(this.getObjContext())},findTopmostBoundInfo:function(e,t){if(e&&e.length){var o=null,r=e.length-1;for(o=e[r];r>=0&&t&&t.indexOf(o.obj)>=0;)o=e[--r];return o}return null},getBoundInfosAtCoord:function(e,t,o){var r=this.getBoundInfoRecorder(),i=o||this.getCurrBoundInflation()||this.getEditorConfigs().getInteractionConfigs().getObjBoundTrackMinInflation(),n=this.screenCoordToContext(e),a=this.getRenderType()===Kekule.Render.RendererType.R3D?{x:0,y:0}:null;return r.getIntersectionInfos(this.getObjContext(),n,a,i,t)},getTopmostBoundInfoAtCoord:function(e,t,o){if(!this.getEditorConfigs().getInteractionConfigs().getEnableTrackOnNearest())return this.findTopmostBoundInfo(this.getBoundInfosAtCoord(e,null,o),t,o);for(var r,i,n,a=Kekule.Render.MetaShapeUtils,l=this.getBoundInfosAtCoord(e,null,o),s=function(t,o,l){r=t,i=o||t.boundInfo,n=Kekule.ObjUtils.notUnset(l)?l:a.getDistance(e,i)},d=l.length-1;d>=0;--d){var u=l[d];if(!(t&&t.indexOf(u.obj)>=0))if(r){var c=u.boundInfo;if(c.shapeType<i.shapeType)s(u,c);else if(c.shapeType===i.shapeType){var p=a.getDistance(e,c);p<n&&s(u,c,p)}}else s(u)}return r},getBasicObjectsAtCoord:function(e,o,r,i){var n=this.getBoundInfosAtCoord(e,null,o),a=[];if(n){r&&(n=t.filter(n,function(e){var t=n[d].obj;return!!t&&!(t&&r&&r.indexOf(t)>=0)}));var l=function(e){return e&&e.getCoordStickTarget&&e.getCoordStickTarget()?1:0};if(n.sort(function(e,t){return l(e.obj)-l(t.obj)}),this.getEditorConfigs().getInteractionConfigs().getEnableTrackOnNearest()){var s=Kekule.Render.MetaShapeUtils;n.sort(function(t,o){var r=0,i=t.boundInfo,n=o.boundInfo;(r=-(i.shapeType-n.shapeType))||(r=-(s.getDistance(e,i)-s.getDistance(e,n)));return r})}for(var d=n.length-1;d>=0;--d){var u=n[d].obj;u&&r&&r.indexOf(u)>=0||a.push(u)}a&&i&&(a=t.filter(a,function(e){for(var t=0,o=i.length;t<o;++t)if(e instanceof i[t])return!0;return!1}))}return a},getTopmostBasicObjectAtCoord:function(e,t,o){var r=this.getBasicObjectsAtCoord(e,t,null,o);return r&&r[0]},getChemObjBounds:function(e,t){var o=[],r=this.getBoundInfoRecorder().getBelongedInfos(this.getObjContext(),e);if(r&&r.length)for(var i=0,n=r.length;i<n;++i){var a=r[i].boundInfo;a&&(a=Kekule.Render.MetaShapeUtils.inflateShape(a,t),o.push(a))}return o},beginUpdateUiMarkers:function(){--this._uiMarkerUpdateFlag},endUpdateUiMarkers:function(){++this._uiMarkerUpdateFlag,this.isUpdatingUiMarkers()||this.repaintUiMarker()},isUpdatingUiMarkers:function(){return this._uiMarkerUpdateFlag<0},recalcUiMarkers:function(){this.beginUpdateUiMarkers();try{this.recalcHotTrackMarker(),this.recalcSelectionAreaMarker(),this.recalcIssueCheckUiMarkers()}finally{this.endUpdateUiMarkers()}},repaintUiMarker:function(){if(!this.isUpdatingUiMarkers()){this.clearUiContext();var e=this.calcDrawParams();this.getUiPainter().draw(this.getUiContext(),e.baseCoord,e.drawOptions)}},createShapeBasedMarker:function(e,t,o,r){var i=new Kekule.ChemWidget.MetaShapeUIMarker;return t&&i.setShapeInfo(t),o&&i.setDrawStyles(o),this.setPropStoreFieldValue(e,i),this.getUiMarkers().addMarker(i),r&&this.repaintUiMarker(),i},modifyShapeBasedMarker:function(e,t,o,r){Kekule.Render.ObjectUpdateType.MODIFY;t&&e.setShapeInfo(t),o&&e.setDrawStyles(o),r&&this.repaintUiMarker()},hideUiMarker:function(e,t){e.setVisible(!1),t&&this.repaintUiMarker()},showUiMarker:function(e,t){e.setVisible(!0),t&&this.repaintUiMarker()},removeUiMarker:function(e){e&&(this.getUiMarkers().removeMarker(e),this.repaintUiMarker())},clearUiMarkers:function(){this.getUiMarkers().clearMarkers(),this.repaintUiMarker()},changeHotTrackMarkerBounds:function(e){for(var t=Kekule.ArrayUtils.toArray(e),o=this.getEditorConfigs().getUiMarkerConfigs(),r={color:o.getHotTrackerColor(),opacity:o.getHotTrackerOpacity()},i=this.getCurrBoundInflation()||this.getEditorConfigs().getInteractionConfigs().getObjBoundTrackMinInflation(),n=[],a=0,l=t.length;a<l;++a){var s=t[a],d=i?Kekule.Render.MetaShapeUtils.inflateShape(s,i):s;d&&n.push(d)}var u=this.getUiHotTrackMarker();return u.setVisible(!0),this.modifyShapeBasedMarker(u,n,r,!0),this},hideHotTrackMarker:function(){var e=this.getUiHotTrackMarker();return e&&this.hideUiMarker(e,!0),this},showHotTrackMarker:function(){var e=this.getUiHotTrackMarker();return e&&this.showUiMarker(e,!0),this},hotTrackOnCoord:function(e){return this.getEditorConfigs().getInteractionConfigs().getEnableHotTrack()&&this.setHotTrackedObj(this.getTopmostBasicObjectAtCoord(e,this.getCurrBoundInflation())),this},hotTrackOnObj:function(e){return this.setHotTrackedObj(e),this},hideHotTrack:function(e){return this.hideHotTrackMarker(),e||this.clearHotTrackedObjs(),this},clearHotTrackedObjs:function(){this.setHotTrackedObjs([])},addHotTrackedObj:function(e){var t=this.getHotTrackedObjs()||[];return Kekule.ArrayUtils.pushUnique(t,e),this.setHotTrackedObjs(t),this},recalcHotTrackMarker:function(){this.setHotTrackedObjs(this.getHotTrackedObjs())},issueCheckResultsChanged:function(){this.recalcIssueCheckUiMarkers();var e=this.getActiveIssueCheckResult();if(e&&this.getEnableAutoScrollToActiveIssue()){var t=e.getTargets();if(t&&t.length){var o=this._getExposedSelfOrParentObjs(t);if(o&&o.length)this.getObjectsBoxAndClientBoxRelation(o)!==Kekule.IntersectionState.CONTAINED&&this.scrollClientToObject(o)}}},_needShowInactiveIssueMarkers:function(){return this.getEnableIssueCheck()&&this.getShowAllIssueMarkers()},recalcIssueCheckUiMarkers:function(){if(this.getChemObjLoaded()){this.beginUpdateUiMarkers();try{var e=this.getIssueCheckResults()||[];if(e.length&&this.getEnableIssueCheck()){var t=this._needShowInactiveIssueMarkers(),o=this.getActiveIssueCheckResult();this.getActiveIssueCheckUiMarker().setVisible(!!o);for(var r=this._groupUpIssueObjects(e,o,!0),i=this.getEditorConfigs().getInteractionConfigs().getSelectionMarkerInflation(),n=Kekule.ErrorLevel.getAllLevels().concat("active"),a=0,l=n.length;a<l;++a){var s=[],d=n[a],u=r[d],c=u?u.level:d;if(u){var p="active"===d;if(p||t)for(var h=u.objs,g=0,C=h.length;g<C;++g)for(var _=h[g],f=this.getBoundInfoRecorder().getBelongedInfos(this.getObjContext(),_),y=0,m=f.length;y<m;++y){var O=f[y].boundInfo;O&&(O=Kekule.Render.MetaShapeUtils.inflateShape(O,i),s.push(O))}}this.changeIssueCheckUiMarkerBound(c,s,p)}}else this.hideIssueCheckUiMarkers()}finally{this.endUpdateUiMarkers()}}},changeIssueCheckUiMarkerBound:function(e,t,o){var r=o?this.getActiveIssueCheckUiMarker():this.getIssueCheckUiMarker(e);if(r)if(t&&t.length){var i=Kekule.ErrorLevel.levelToString(e),n=this.getEditorConfigs().getUiMarkerConfigs(),a=n.getIssueCheckMarkerColors()[i],l={strokeColor:o?a.activeStokeColor:a.strokeColor,strokeWidth:o?n.getIssueCheckActiveMarkerStrokeWidth():n.getIssueCheckMarkerStrokeWidth(),fillColor:o?a.activeFillColor:a.fillColor,opacity:o?n.getIssueCheckActiveMarkerOpacity():n.getIssueCheckMarkerOpacity()};r.setVisible(!0),this.modifyShapeBasedMarker(r,t,l,!0)}else r.setVisible(!1);return this},_getExposedSelfOrParentObjs:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o];if(!i.isExposed||i.isExposed())t.push(i);else if(i.getExposedAncestor){var n=i.getExposedAncestor();n&&t.push(n)}}return t},_groupUpIssueObjects:function(e,o,r){for(var i={},n=0,a=e.length;n<a;++n){var l=e[n],s=l.getTargets(),d=l.getLevel();o&&l===o?i.active={level:d,objs:r?this._getExposedSelfOrParentObjs(s):s}:(i[d]||(i[d]={level:d,objs:[]}),i[d].objs=i[d].objs.concat(r?this._getExposedSelfOrParentObjs(s):s))}var u=Kekule.ErrorLevel,c=[u.LOG,u.NOTE,u.WARNING,u.ERROR,"active"];for(n=0,a=c.length;n<a;++n){var p=i[n]&&i[n].objs;if(p)for(var h=n+1,g=c.length;h<g;++h){var C=i[h]&&i[h].objs;if(C){var _=t.exclude(p,C);i[n].objs=_}}}return i},hideIssueCheckUiMarkers:function(){for(var e=this.getAllIssueCheckUiMarkers()||[],t=0,o=e.length;t<o;++t)this.hideUiMarker(e[t])},changeSelectionAreaMarkerBound:function(e,t){var o=this.getEditorConfigs().getUiMarkerConfigs();t||(t={strokeColor:o.getSelectionMarkerStrokeColor(),strokeWidth:o.getSelectionMarkerStrokeWidth(),fillColor:o.getSelectionMarkerFillColor(),opacity:o.getSelectionMarkerOpacity()});var r=this.getUiSelectionAreaMarker();return r&&(r.setVisible(!0),this.modifyShapeBasedMarker(r,e,t,!0)),this},hideSelectionAreaMarker:function(){var e=this.getUiSelectionAreaMarker();e&&this.hideUiMarker(e,!0)},showSelectionAreaMarker:function(){var e=this.getUiSelectionAreaMarker();e&&this.showUiMarker(e,!0)},recalcSelectionAreaMarker:function(e){this.beginUpdateUiMarkers();try{var t=this.getSelection(),o=t.length;if(o<=0)this.hideSelectionAreaMarker();else{for(var r=[],i=null,n=this.getEditorConfigs().getInteractionConfigs().getSelectionMarkerInflation(),a=0;a<o;++a){var l=t[a],s=this.getBoundInfoRecorder().getBelongedInfos(this.getObjContext(),l);if(s&&s.length)for(var d=0,u=s.length;d<u;++d){var c=s[d].boundInfo;if(c){c=Kekule.Render.MetaShapeUtils.inflateShape(c,n),r.push(c);var p=Kekule.Render.MetaShapeUtils.getContainerBox(c);i=i?Kekule.BoxUtils.getContainerBox(i,p):p}}}if(this.setUiSelectionAreaContainerBox(i),i){var h=Kekule.Render.MetaShapeUtils.createShapeInfo(Kekule.Render.MetaShapeType.RECT,[{x:i.x1,y:i.y1},{x:i.x2,y:i.y2}]);r.push(h)}else this.hideSelectionAreaMarker();r.length&&this.changeSelectionAreaMarkerBound(r)}}finally{this.endUpdateUiMarkers()}},_highlightSelectionAreaMarker:function(){var e=this.getEditorConfigs().getUiMarkerConfigs(),t={strokeColor:e.getSelectionMarkerStrokeColor(),strokeWidth:e.getSelectionMarkerStrokeWidth(),fillColor:e.getSelectionMarkerFillColor(),opacity:e.getSelectionMarkerEmphasisOpacity()};this.changeSelectionAreaMarkerBound(null,t)},_restoreSelectionAreaMarker:function(){var e=this.getEditorConfigs().getUiMarkerConfigs(),t={strokeColor:e.getSelectionMarkerStrokeColor(),strokeWidth:e.getSelectionMarkerStrokeWidth(),fillColor:e.getSelectionMarkerFillColor(),opacity:e.getSelectionMarkerOpacity()};this.changeSelectionAreaMarkerBound(null,t)},pulseSelectionAreaMarker:function(e,t){if(this.getUiSelectionAreaMarker()){if(e||(e=this.getEditorConfigs().getInteractionConfigs().getSelectionMarkerDefPulseDuration()||0),t||(t=this.getEditorConfigs().getInteractionConfigs().getSelectionMarkerDefPulseCount()||1),!e)return;var o=e/t;this.doPulseSelectionAreaMarker(o,t)}return this},doPulseSelectionAreaMarker:function(e,t){this._highlightSelectionAreaMarker(),setTimeout(this._restoreSelectionAreaMarker.bind(this),e),t>1&&setTimeout(this.doPulseSelectionAreaMarker.bind(this,e,t-1),2*e)},startSelecting:function(e,t){void 0===t&&(t=this.getIsToggleSelectOn()),t||this.deselectAll();var o=Kekule.Editor.SelectMode,r=this.getSelectMode();return this._currSelectMode=r,r===o.POLYLINE||r===o.POLYGON?this.startSelectingCurveDrag(e,t):this.startSelectingBoxDrag(e,t)},addSelectingAnchorCoord:function(e){var t=Kekule.Editor.SelectMode,o=this._currSelectMode;return o===t.POLYLINE||o===t.POLYGON?this.dragSelectingCurveToCoord(e):this.dragSelectingBoxToCoord(e)},endSelecting:function(e,t){void 0===t&&(t=this.getIsToggleSelectOn());var o,r=Kekule.Editor.SelectMode,i=this._currSelectMode,n=this.getEditorConfigs().getInteractionConfigs().getEnablePartialAreaSelecting();if(i===r.POLYLINE||i===r.POLYGON){var a=this._selectingCurveCoords,l=this.getEditorConfigs().getInteractionConfigs().getSelectingCurveSimplificationDistanceThreshold(),s=Kekule.GeometryUtils.simplifyCurveToLineSegments(a,l);if(this.endSelectingCurveDrag(e,t),i===r.POLYLINE){var d=this.getEditorConfigs().getInteractionConfigs().getSelectingBrushWidth();o=this.getObjectsIntersetExtendedPolyline(s,d)}else o=this.getObjectsInPolygon(s,n),this.endSelectingCurveDrag(e,t)}else{var u=this._selectingBoxStartCoord,c=Kekule.BoxUtils.createBox(u,e);o=this.getObjectsInScreenBox(c,n),this.endSelectingBoxDrag(e,t)}o=this._getActualSelectedObjsInSelecting(o),t?this.toggleSelectingState(o):this.select(o),this.hideSelectingMarker()},cancelSelecting:function(){this.hideSelectingMarker()},_getActualSelectedObjsInSelecting:function(e){return e&&e.length?(this._isInAncestorSelectMode()&&(e=this._getAllStandaloneAncestorObjs(e)),e):[]},_isInAncestorSelectMode:function(){return this.getSelectMode()===Kekule.Editor.SelectMode.ANCESTOR},_getAllStandaloneAncestorObjs:function(e){for(var o=[],r=0,i=e.length;r<i;++r){var n=e[r];n&&n.getStandaloneAncestor&&(n=n.getStandaloneAncestor()),t.pushUnique(o,n)}return o},startSelectingBoxDrag:function(e,t){this._selectingBoxStartCoord=e},dragSelectingBoxToCoord:function(e){var t=this._selectingBoxStartCoord,o=e;this.changeSelectingMarkerBox(t,o)},endSelectingBoxDrag:function(e,t){this._selectingBoxStartCoord;this._selectingBoxEndCoord=e},startSelectingCurveDrag:function(e,t){this._selectingCurveCoords=[e]},dragSelectingCurveToCoord:function(e){this._selectingCurveCoords.push(e),this.changeSelectingMarkerCurve(this._selectingCurveCoords,this._currSelectMode===Kekule.Editor.SelectMode.POLYGON)},endSelectingCurveDrag:function(e,t){this._selectingCurveCoords.push(e)},selectOnCoord:function(e,t){void 0===t&&(t=this.getIsToggleSelectOn());var o=this.getTopmostBasicObjectAtCoord(e,this.getCurrBoundInflation());if(o){var r=this._getActualSelectedObjsInSelecting([o]);r&&(t?this.toggleSelectingState(r):this.select(r))}},changeSelectingMarkerBound:function(e,t){var o=this.getEditorConfigs().getUiMarkerConfigs();t||(t={strokeColor:o.getSelectingMarkerStrokeColor(),strokeWidth:o.getSelectingMarkerStrokeWidth(),strokeDash:o.getSelectingMarkerStrokeDash(),fillColor:o.getSelectingMarkerFillColor(),opacity:o.getSelectingMarkerOpacity()});var r=this.getUiSelectingMarker();return r.setVisible(!0),this.modifyShapeBasedMarker(r,e,t,!0),this},changeSelectingMarkerCurve:function(e,t){for(var o=[],r=0,i=e.length-1;r<i;++r)o.push(this.screenCoordToContext(e[r]));var n,a=Kekule.Render.MetaShapeUtils.createShapeInfo(t?Kekule.Render.MetaShapeType.POLYGON:Kekule.Render.MetaShapeType.POLYLINE,o);if(!t){var l=this.getEditorConfigs().getUiMarkerConfigs();n={strokeColor:l.getSelectingBrushMarkerStrokeColor(),strokeWidth:this.getEditorConfigs().getInteractionConfigs().getSelectingBrushWidth(),strokeDash:l.getSelectingBrushMarkerStrokeDash(),lineCap:l.getSelectingBrushMarkerStrokeLineCap(),lineJoin:l.getSelectingBrushMarkerStrokeLineJoin(),opacity:l.getSelectingBrushMarkerOpacity()}}return this.changeSelectingMarkerBound(a,n)},changeSelectingMarkerBox:function(e,t){var o=this.screenCoordToContext(e),r=this.screenCoordToContext(t),i=Kekule.Render.MetaShapeUtils.createShapeInfo(Kekule.Render.MetaShapeType.RECT,[{x:Math.min(o.x,r.x),y:Math.min(o.y,r.y)},{x:Math.max(o.x,r.x),y:Math.max(o.y,r.y)}]);return this.changeSelectingMarkerBound(i)},hideSelectingMarker:function(){var e=this.getUiSelectingMarker();e&&this.hideUiMarker(e,!0)},showSelectingMarker:function(){var e=this.getUiSelectingMarker();e&&this.showUiMarker(e,!0)},getCoordRegionInSelectionMarker:function(e,t){var o=Kekule.Editor.BoxRegion,r=Kekule.CoordUtils,i=this.screenCoordToContext(e),n=this.getUiSelectionAreaMarker();if(n&&n.getVisible()){var a=this.getUiSelectionAreaContainerBox();Kekule.ObjUtils.isUnset(t)&&(t=this.getEditorConfigs().getInteractionConfigs().getSelectionMarkerEdgeInflation());var l=t/2||0,s=r.substract({x:a.x1,y:a.y1},{x:l,y:l}),d=r.add({x:a.x2,y:a.y2},{x:l,y:l});if(i.x<s.x||i.y<s.y||i.x>d.x||i.y>d.y)return o.OUTSIDE;var u=r.substract(i,s),c=r.substract(d,i),p=u.x,h=c.x,g=u.y,C=c.y;return g<C?p<h?g<=t?p<=t?o.CORNER_TL:o.EDGE_TOP:p<=t?o.EDGE_LEFT:o.INSIDE:g<=t?h<=t?o.CORNER_TR:o.EDGE_TOP:h<=t?o.EDGE_RIGHT:o.INSIDE:p<h?C<=t?p<=t?o.CORNER_BL:o.EDGE_BOTTOM:p<=t?o.EDGE_LEFT:o.INSIDE:C<=t?h<=t?o.CORNER_BR:o.EDGE_BOTTOM:h<=t?o.EDGE_RIGHT:o.INSIDE}return o.OUTSIDE},isCoordInSelectionMarkerBound:function(e){return this.getCoordRegionInSelectionMarker(e)!==Kekule.Editor.BoxRegion.OUTSIDE},getObjSelectedRenderOptions:function(){return this._selectedRenderOptions},_getObjRenderOptionItemAppendMethod:function(e){return this.getRenderType()===Kekule.Render.RendererType.R3D?e.addOverrideRender3DOptionItem:e.addOverrideRenderOptionItem},_getObjRenderOptionItemRemoveMethod:function(e){return this.getRenderType()===Kekule.Render.RendererType.R3D?e.removeOverrideRender3DOptionItem:e.removeOverrideRenderOptionItem},_addSelectRenderOptions:function(e){var t=this.getObjSelectedRenderOptions();return t?this._getObjRenderOptionItemAppendMethod(e).apply(e,[t]):null},_removeSelectRenderOptions:function(e){return this.getObjSelectedRenderOptions()?this._getObjRenderOptionItemRemoveMethod(e).apply(e,[this.getObjSelectedRenderOptions()]):null},beginUpdateSelection:function(){this.beginUpdateObject(),--this._objSelectFlag},endUpdateSelection:function(){++this._objSelectFlag,this._objSelectFlag>=0&&this.selectionChanged(),this.endUpdateObject()},isUpdatingSelection:function(){return this._objSelectFlag<0},selectionChanged:function(){if(!this.isUpdatingSelection())return this.notifyPropSet("selection",this.getSelection()),this.invokeEvent("selectionChange"),this.doSelectionChanged()},doSelectionChanged:function(){this.recalcSelectionAreaMarker()},isInSelection:function(e){return!!e&&this.getSelection().indexOf(e)>=0},addObjToSelection:function(e){if(!e)return this;var t=this.getSelection();return Kekule.ArrayUtils.pushUnique(t,e.getNearestSelectableObject()),this._addSelectRenderOptions(e),this.selectionChanged(),this},removeObjFromSelection:function(e,t){if(!e)return this;var o=this.getSelection(),r=e.getNearestSelectableObject&&e.getNearestSelectableObject();Kekule.ArrayUtils.remove(o,e),this._removeSelectRenderOptions(e),r&&(Kekule.ArrayUtils.remove(o,r),this._removeSelectRenderOptions(r));for(var i=o.length-1;i>=0;--i){var n=o[i];n.isChildOf&&(n.isChildOf(e)||r&&n.isChildOf(r))&&this.removeObjFromSelection(n,!0)}return t||this.selectionChanged(),this},selectAll:function(){var e=[],t=this.getChemObj();if(t){var o=t.getChildren()||[];e=o.length?o:[t]}return this.select(e)},deselectAll:function(){var e=this.getSelection();return this.removeFromSelection(e)},select:function(e){this.beginUpdateSelection();try{this.deselectAll(),this.addToSelection(e)}finally{this.endUpdateSelection()}return this},addToSelection:function(e){if(e){var t=DataType.isArrayValue(e)?e:[e];this.beginUpdateSelection();try{for(var o=0,r=t.length;o<r;++o)this.addObjToSelection(t[o])}finally{this.endUpdateSelection()}return this}},removeFromSelection:function(e){if(e){var t=DataType.isArrayValue(e)?e:[e];this.beginUpdateSelection();try{for(var o=t.length-1;o>=0;--o)this.removeObjFromSelection(t[o])}finally{this.endUpdateSelection()}return this}},toggleSelectingState:function(e){if(e){var t=DataType.isArrayValue(e)?e:[e];this.beginUpdateSelection();try{for(var o=0,r=t.length;o<r;++o){var i=t[o],n=i.getNearestSelectableObject&&i.getNearestSelectableObject();this.isInSelection(i)?this.removeObjFromSelection(i):n&&this.isInSelection(n)?this.removeObjFromSelection(n):this.addObjToSelection(i)}}finally{this.endUpdateSelection()}return this}},hasSelection:function(){return!!this.getSelection().length},deleteSelectedObjs:function(){},requestAutoCheckIssuesIfNecessary:function(){this.getEnableAutoIssueCheck()&&this._tryCheckIssueOnIdle()},_tryCheckIssueOnIdle:function(){return this.isUpdatingObject()||this.isManipulatingObject()?null:this.checkIssues()},createIssueCheckExecutor:function(){return new Kekule.IssueCheck.ExecutorForEditor(this)},checkIssues:function(e){var t=null,o=e||this.getChemObj();o&&this.getEnableIssueCheck()&&(t=this.getIssueCheckExecutor(!0).execute(o));return t},getObjectsIntersetExtendedPolyline:function(e,t){for(var o=[],r=0,i=e.length;r<i;++r)o.push(this.screenCoordToContext(e[r]));var n=[],a=this.getBoundInfoRecorder().getAllRecordedInfoOfContext(this.getObjContext()),l=Kekule.Render.MetaShapeUtils.isIntersectingPolyline;for(r=0,i=a.length;r<i;++r){var s=a[r],d=s.boundInfo;d&&l(d,o,t)&&n.push(s.obj)}return n},getObjectsInPolygon:function(e,t){for(var o=[],r=0,i=e.length;r<i;++r)o.push(this.screenCoordToContext(e[r]));var n=[],a=this.getBoundInfoRecorder().getAllRecordedInfoOfContext(this.getObjContext()),l=t?Kekule.Render.MetaShapeUtils.isIntersectingPolygon:Kekule.Render.MetaShapeUtils.isInsidePolygon;for(r=0,i=a.length;r<i;++r){var s=a[r],d=s.boundInfo;d&&l(d,o)&&n.push(s.obj)}return n},getObjectsInScreenBox:function(e,t){for(var o=this.screenBoxToContext(e),r=[],i=this.getBoundInfoRecorder().getAllRecordedInfoOfContext(this.getObjContext()),n=t?Kekule.Render.MetaShapeUtils.isIntersectingBox:Kekule.Render.MetaShapeUtils.isInsideBox,a=0,l=i.length;a<l;++a){var s=i[a],d=s.boundInfo;d&&n(d,o)&&r.push(s.obj)}return r},selectObjectsInScreenBox:function(e,t){var o=this.getObjectsInScreenBox(e,t);return o&&o.length&&this.select(o),o},addObjectsInScreenBoxToSelection:function(e,t){var o=this.getObjectsInScreenBox(e,t);return o&&o.length&&this.addToSelection(o),o},removeObjectsInScreenBoxFromSelection:function(e,t){var o=this.getObjectsInScreenBox(e,t);return o&&o.length&&this.removeFromSelection(o),o},toggleSelectingStateOfObjectsInScreenBox:function(e,t){var o=this.getObjectsInScreenBox(e,t);return o&&o.length&&this.toggleSelectingState(o),o},getObjectsContainerBox:function(e,t){for(var o=Kekule.ArrayUtils.toArray(e),r=t||0,i=null,n=0,a=o.length;n<a;++n){var l=o[n],s=this.getBoundInfoRecorder().getBelongedInfos(this.getObjContext(),l);if(s&&s.length)for(var d=0,u=s.length;d<u;++d){var c=s[d].boundInfo;if(c){r&&(c=Kekule.Render.MetaShapeUtils.inflateShape(c,r));var p=Kekule.Render.MetaShapeUtils.getContainerBox(c);i=i?Kekule.BoxUtils.getContainerBox(i,p):p}}}return i},getObjectsBoxAndClientBoxRelation:function(e){var t=this.getObjectsContainerBox(e);if(t){var o=this.getVisibleClientScreenBox();return Kekule.BoxUtils.getIntersectionState(t,o)}},getSelectionContainerBox:function(e){return this.getObjectsContainerBox(this.getSelection(),e)},isSelectionVisible:function(){var e=this.getSelectionContainerBox();if(e){var t=this.getVisibleClientScreenBox();return Kekule.BoxUtils.hasIntersection(e,t)}return!1},getObjSize:function(e){return this.doGetObjSize(e)},doGetObjSize:function(e){var t=this.getCoordMode();return e.getSizeOfMode?e.getSizeOfMode(t):null},setObjSize:function(e,t){this.doSetObjSize(e,t),this.objectChanged(e)},doSetObjSize:function(e,t){e.setSizeOfMode&&e.setSizeOfMode(t,this.getCoordMode())},getObjCoord:function(e,t){return this.doGetObjCoord(e,t)},doGetObjCoord:function(e,t){if(!e)return null;var o=this.getCoordMode(),r=this.getAllowCoordBorrow(),i=e.getAbsBaseCoord?e.getAbsBaseCoord(o,r):e.getAbsCoordOfMode?e.getAbsCoordOfMode(o,r):e.getCoordOfMode?e.getCoordOfMode(o,r):null;if(o===Kekule.CoordMode.COORD2D&&Kekule.ObjUtils.notUnset(t)&&t!==Kekule.Render.CoordPos.DEFAULT){r=this.getAllowCoordBorrow();var n=e.getExposedContainerBox?e.getExposedContainerBox(o,r):e.getContainerBox?e.getContainerBox(o,r):null;if(n&&t===Kekule.Render.CoordPos.CORNER_TL){var a={x:(n.x2-n.x1)/2,y:(n.y2-n.y1)/2};i.x=i.x-a.x,i.y=i.y+a.y}}return i},setObjCoord:function(e,t,o){this.doSetObjCoord(e,t,o),this.objectChanged(e)},doSetObjCoord:function(e,t,o){var r=Object.create(t),i=this.getCoordMode();if(i===Kekule.CoordMode.COORD2D&&Kekule.ObjUtils.notUnset(o)&&o!==Kekule.Render.CoordPos.DEFAULT){var n=this.getAllowCoordBorrow(),a=e.getExposedContainerBox?e.getExposedContainerBox(i,n):e.getContainerBox?e.getContainerBox(i,n):null;if(a){var l={x:(a.x2-a.x1)/2,y:(a.y2-a.y1)/2};o===Kekule.Render.CoordPos.CORNER_TL&&(r.x=t.x+l.x,r.y=t.y-l.y)}}e.setAbsBaseCoord?e.setAbsBaseCoord(r,i):e.setAbsCoordOfMode?e.setAbsCoordOfMode(r,i):e.setAbsCoordOfMode&&e.setCoordOfMode(r,i)},getObjectContextCoord:function(e,t){var o=this.getObjCoord(e,t);return this.objCoordToContext(o)},setObjectContextCoord:function(e,t,o){var r=this.contextCoordToObj(t);r&&this.setObjCoord(e,r,o)},getObjectScreenCoord:function(e,t){var o=this.getObjCoord(e,t);return this.objCoordToScreen(o)},setObjectScreenCoord:function(e,t,o){var r=this.screenCoordToObj(t);r&&this.setObjCoord(e,r,o)},getCoord:function(e,t,o){var r=this.getObjCoord(e,o);return this.translateCoord(r,Kekule.Editor.CoordSys.OBJ,t)},setCoord:function(e,t,o,r){var i=this.translateCoord(t,o,Kekule.Editor.CoordSys.OBJ);this.setObjCoord(e,i,r)},getSize:function(e,t){var o=this.getObjSize(e);return this.translateCoord(o,Kekule.Editor.CoordSys.OBJ,t)},setSize:function(e,t,o){var r=this.translateCoord(t,o,Kekule.Editor.CoordSys.OBJ);this.setObjSize(e,r)},translateCoord:function(e,t,o){if(!e)return null;var r=Kekule.Editor.CoordSys;if(t===r.SCREEN){if(o===r.SCREEN)return e;if(o===r.CONTEXT)return this.getObjDrawBridge().transformScreenCoordToContext(this.getObjContext(),e);var i=this.getObjDrawBridge().transformScreenCoordToContext(this.getObjContext(),e);return this.getRootRenderer().transformCoordToObj(this.getObjContext(),this.getChemObj(),i)}if(t===r.CONTEXT)return o===r.SCREEN?this.getObjDrawBridge().transformContextCoordToScreen(this.getObjContext(),e):o===r.CONTEXT?e:this.getRootRenderer().transformCoordToObj(this.getObjContext(),this.getChemObj(),e);if(o===r.SCREEN){i=this.getRootRenderer().transformCoordToContext(this.getObjContext(),this.getChemObj(),e);return this.getObjDrawBridge().transformContextCoordToScreen(this.getObjContext(),i)}return o===r.CONTEXT?this.getRootRenderer().transformCoordToContext(this.getObjContext(),this.getChemObj(),e):e},translateDistance:function(e,t,o){var r={x:e,y:0,z:0},i=this.translateCoord({x:0,y:0,z:0},t,o),n=this.translateCoord(r,t,o);return Kekule.CoordUtils.getDistance(i,n)},transformCoordAndSizeOfObjects:function(e,t){var o=this.getCoordMode(),r=this.getAllowCoordBorrow(),i=o===Kekule.CoordMode.COORD3D?Kekule.CoordUtils.calcTransform3DMatrix(t):Kekule.CoordUtils.calcTransform2DMatrix(t),n=Object.extend({},t);n=Object.extend(n,{translateX:0,translateY:0,translateZ:0,center:{x:0,y:0,z:0}});for(var a=o===Kekule.CoordMode.COORD3D?Kekule.CoordUtils.calcTransform3DMatrix(n):Kekule.CoordUtils.calcTransform2DMatrix(n),l=0,s=e.length;l<s;++l){var d=e[l];d.transformAbsCoordByMatrix(i,a,o,!0,r),d.scaleSize(t.scale,o,!0,r)}},objCoordToContext:function(e){var t=Kekule.Editor.CoordSys;return this.translateCoord(e,t.OBJ,t.CONTEXT)},contextCoordToObj:function(e){var t=Kekule.Editor.CoordSys;return this.translateCoord(e,t.CONTEXT,t.OBJ)},objCoordToScreen:function(e){var t=Kekule.Editor.CoordSys;return this.translateCoord(e,t.OBJ,t.SCREEN)},screenCoordToObj:function(e){var t=Kekule.Editor.CoordSys;return this.translateCoord(e,t.SCREEN,t.OBJ)},screenCoordToContext:function(e){var t=Kekule.Editor.CoordSys;return this.translateCoord(e,t.SCREEN,t.CONTEXT)},contextCoordToScreen:function(e){var t=Kekule.Editor.CoordSys;return this.translateCoord(e,t.CONTEXT,t.SCREEN)},screenBoxToContext:function(e){var t=this.screenCoordToContext({x:e.x1,y:e.y1}),o=this.screenCoordToContext({x:e.x2,y:e.y2});return{x1:t.x,y1:t.y,x2:o.x,y2:o.y}},createDefaultNode:function(e,t,o){var r=this.getEditorConfigs().getStructureConfigs().getDefIsotopeId(),i=new Kekule.Atom;return i.setIsotopeId(r),o&&o.appendNode(i),this.setCoord(i,e,t),i},operationDone:function(e){this.doOperationDone(e)},doOperationDone:function(e){},clearOperHistory:function(){var e=this.getOperHistory();e&&e.clear()},pushOperation:function(e,t){if(e){var o=this.getOperHistory();if(o&&o.push(e),this.getOperationsInCurrManipulation().push(e),t){this.beginUpdateObject();try{e.execute()}finally{this.endUpdateObject()}}}},popOperation:function(e){var t,o=this.getOperHistory();if(o){if(t=o.pop(),e){this.beginUpdateObject();try{t.reverse()}finally{this.endUpdateObject()}}var r=this.getOperationsInCurrManipulation(),i=r.indexOf(t);return i>=0&&r.splice(i,1),t}return null},execOperation:function(e){var o=t.toArray(e);this.beginManipulateAndUpdateObject();try{for(var r=0,i=o.length;r<i;++r){var n=o[r];n.execute(),this.getEnableOperHistory()&&this.pushOperation(n,!1)}}finally{this.endManipulateAndUpdateObject()}return this},execOperations:function(e){if(1===e.length)return this.execOperation(e[0]);var t=new Kekule.MacroOperation(e);return this.execOperation(t)},replaceOperationInHistory:function(e,t){var o=this.getOperHistory();return o&&o.replaceOperation(e,t)},undo:function(){var e,t=this.getOperHistory();if(t){this.beginUpdateObject();try{e=t.undo()}finally{this.endUpdateObject(),e&&this.operationDone(e)}}return e},redo:function(){var e,t=this.getOperHistory();if(t){this.beginUpdateObject();try{e=t.redo()}finally{this.endUpdateObject(),e&&this.operationDone(e)}}return e},undoAll:function(){var e,t=this.getOperHistory();if(t){this.beginUpdateObject();try{e=t.undoAll()}finally{this.endUpdateObject()}}return e},canUndo:function(){var e=this.getOperHistory();return!!e&&e.canUndo()},canRedo:function(){var e=this.getOperHistory();return!!e&&e.canRedo()},modifyObjects:function(e,t,o){var r=Kekule.ArrayUtils.toArray(e);try{for(var i=new Kekule.MacroOperation,n=0,a=r.length;n<a;++n){var l=r[n],s=new Kekule.ChemObjOperation.Modify(l,t,this);i.add(s)}i.execute()}finally{o&&this.getEnableOperHistory()&&i.getChildCount()&&this.pushOperation(i)}return this},modifyObjectsRenderOptions:function(e,t,o,r){var i=Kekule.ArrayUtils.toArray(e),n=o?"render3DOptions":"renderOptions",a=o?"getRender3DOptions":"getRenderOptions";try{for(var l=new Kekule.MacroOperation,s=0,d=i.length;s<d;++s){var u=i[s];if(u[a]){var c=u[a](),p=Object.extend({},c);p=Object.extend(p,t);var h={};h[n]=p;var g=new Kekule.ChemObjOperation.Modify(u,h,this);l.add(g)}}this.beginManipulateAndUpdateObject(),l.execute()}finally{r&&this.getEnableOperHistory()&&l.getChildCount()&&this.pushOperation(l),this.endManipulateAndUpdateObject()}return this},getClientDimension:function(){var e=this.getElement();return{width:e.clientWidth,height:e.clientHeight}},getClientScrollPosition:function(){var e=this.getEditClientElem().parentNode;return e?{x:e.scrollLeft,y:e.scrollTop}:null},getClientScrollCoord:function(t){var o=this.getClientScrollPosition();return e.isUnset(t)||t===Kekule.Editor.CoordSys.SCREEN?o:this.translateCoord(o,Kekule.Editor.CoordSys.SCREEN,t)},getClientVisibleRect:function(){var e=this.getClientDimension(),t=this.getClientScrollPosition();return e.x1=e.left=t.x,e.y1=e.top=t.y,e.x2=e.x1+e.width,e.y2=e.y1+e.height,e},scrollClientTo:function(e,t){return this.scrollClientToCoord({y:e,x:t})},scrollClientToTop:function(){return this.scrollClientTo(0,null)},scrollClientToBottom:function(){var e=this.getEditClientElem(),t=Kekule.HtmlElementUtils.getElemClientDimension(e);return this.scrollClientTo(t.height,null)},scrollClientToCoord:function(t,o,r){var i,n=e.notUnset(t.x),a=e.notUnset(t.y),l=r&&r.scrollToCenter;if(i=e.isUnset(o)?t:this.translateCoord(t,o,Kekule.Editor.CoordSys.SCREEN),l){var s=this.getVisibleClientScreenBox(),d={x:s.width/2,y:s.height/2};i=Kekule.CoordUtils.substract(i,d)}var u=this.getEditClientElem().parentNode;return a&&(u.scrollTop=i.y),n&&(u.scrollLeft=i.x),this},scrollClientToObject:function(e,o){Kekule.BoxUtils;if(!e)return this;var r=this.getChemObj();if(!r)return this;var i=t.toArray(e),n=this._getTargetObjsExposedContainerBoxInfo(i,r),a=n.totalBox,l=n.boxes;if(a){var s=Object.extend({scrollToCenter:!0,coverMostObjs:!0},o||{});return this._scrollClientToContainerBox(a,l,s)}return this},_scrollClientToContainerBox:function(e,t,o){var r,i=Kekule.BoxUtils,n=this.getVisibleClientBoxOfSys(Kekule.Editor.CoordSys.CHEM);r=(e.x2-e.x1>n.x2-n.x1||e.y2-e.y1>n.y2-n.y1)&&o.coverMostObjs?this._getMostIntersectedContainerBox(n.x2-n.x1,n.y2-n.y1,t,e):e;var a=o.scrollToCenter?i.getCenterCoord(r):{x:r.x1,y:r.y2};return this.scrollClientToCoord(a,Kekule.Editor.CoordSys.CHEM,o)},_getTargetObjsExposedContainerBoxInfo:function(e,t){var o=Kekule.BoxUtils;if(t||(t=this.getChemObj()),t)for(var r=null,i=[],n=0,a=e.length;n<a;++n){var l=e[n];if(l.getExposedContainerBox&&l.isChildOf&&l.isChildOf(t)){var s=l.getExposedContainerBox(this.getCoordMode());s&&(i.push(s),r=r?o.getContainerBox(r,s):s)}}return{totalBox:r,boxes:i}},_getMostIntersectedContainerBox:function(e,t,o,i){for(var n,a=Kekule.BoxUtils,l=function(o,n){var l=r.add(o,{x:e*n.x,y:t*n.y});l.x<i.x1?l.x=i.x1:l.x>i.x2&&(l.x=i.x2),l.y<i.y1?l.y=i.y1:l.y>i.y2&&(l.y=i.y2);var s=r.add(l,{x:-e*n.x,y:-t*n.y});return a.createBox(s,l)},s=function(e,t){for(var o=0,r=0,i=t.length;r<i;++r){var n=t[r];a.hasIntersection(n,e)&&++o}return o},d=0,u=0,c=o.length;u<c;++u)for(var p=a.getCornerCoords(o[u]),h=[l(p[0],{x:1,y:1}),l(p[1],{x:1,y:-1}),l(p[2],{x:-1,y:1}),l(p[3],{x:-1,y:-1})],g=0,C=h.length;g<C;++g){var _=s(h[g],o);_>d&&(d=_,n=h[g])}return n},doBeforeDispatchUiEvent:function(e){var t=e.getType();return["pointerdown","pointermove","pointerup"].indexOf(t)>=0&&this.setCurrPointerType(e.pointerType),this.tryApplySuper("doBeforeDispatchUiEvent",[e])},reactHotKeys:function(e){if(this.getEditorConfigs().getInteractionConfigs().getEnableHotKey()){for(var t=this.getEditorConfigs().getHotKeyConfigs().getHotKeys(),o=Kekule.Widget.KeyboardUtils.getKeyParamsFromEvent(e),r=!1,i=[],n=t.length-1;n>=0;--n){var a=Kekule.Widget.KeyboardUtils.shortcutLabelToKeyParams(t[n].key,null,!1);if(a.repeat=t[n].repeat,Kekule.Widget.KeyboardUtils.matchKeyParams(o,a,!1)){var l=t[n].action;if(l){var s=this.getChildAction(l,!0);if(s)if(s instanceof Kekule.Editor.ActionOperationCreate.Base){var d=s.createOperations(this);(r=!(!d||!d.length)||r)&&(i=i.concat(d))}else r=s.execute(this,e)||r}}}if(i.length&&this.execOperations(i),r)return e.stopPropagation(),e.preventDefault(),!0}},react_keydown:function(e){if(!this.tryApplySuper("react_keydown",[e]))return this.reactHotKeys(e)}}),Kekule.Editor.BaseEditor.Settings=Class.create(Kekule.ChemWidget.ChemObjDisplayer.Settings,{CLASS_NAME:"Kekule.Editor.BaseEditor.Settings",initProperties:function(){this.defineProp("enableCreateNewDoc",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getEditor().getEnableCreateNewDoc()},setter:function(e){this.getEditor().setEnableCreateNewDoc(e)}}),this.defineProp("initOnNewDoc",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getEditor().getInitOnNewDoc()},setter:function(e){this.getEditor().setInitOnNewDoc(e)}}),this.defineProp("enableOperHistory",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getEditor().getEnableOperHistory()},setter:function(e){this.getEditor().setEnableOperHistory(e)}}),this.defineProp("enableIssueCheck",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getEditor().getEnableIssueCheck()},setter:function(e){this.getEditor().setEnableIssueCheck(e)}})},getEditor:function(){return this.getDisplayer()}}),Kekule.Editor.IaControllerManager={_controllerMap:new Kekule.MapEx(!0),register:function(e,t){a._controllerMap.set(e,t)},unregister:function(e){a._controllerMap.remove(e)},getAllControllerClasses:function(){return a._controllerMap.getKeys()},getAvailableControllerClasses:function(e){for(var t=[],o=a.getAllControllerClasses(),r=0,i=o.length;r<i;++r){var n=o[r],l=a._controllerMap.get(n);l&&!ClassEx.isOrIsDescendantOf(e,l)||t.push(n)}return t}};var a=Kekule.Editor.IaControllerManager;Kekule.Editor.BaseEditorBaseIaController=Class.create(Kekule.Widget.InteractionController,{CLASS_NAME:"Kekule.Editor.BaseEditorIaController",initialize:function(e){this.tryApplySuper("initialize",[e])},getDefId:function(){return Kekule.ClassUtils.getLastClassName(this.getClassName())},getEditor:function(){return this.getWidget()},setEditor:function(e){return this.setWidget(e)},getEditorConfigs:function(){var e=this.getEditor();return e?e.getEditorConfigs():null}}),Kekule.Editor.BaseEditorIaController=Class.create(Kekule.Editor.BaseEditorBaseIaController,{CLASS_NAME:"Kekule.Editor.BaseEditorIaController",initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("manuallyHotTrack",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("currBoundInflation",{dataType:DataType.NUMBER,serializable:!1,getter:function(){return this.getEditor().getCurrBoundInflation()},setter:null}),this.defineProp("activePointerType",{dataType:DataType.BOOL,serializable:!1,getter:function(){var e=this.getEditor();return e&&e.getCurrPointerType()||this.getPropStoreFieldValue("activePointerType")},setter:function(e){var t=this.getEditor();t?t.setCurrPointerType(e):this.setStoreFieldValue("activePointerType",e)}})},notifyEditorBeginManipulateObjects:function(){this.getEditor().beginManipulateObject()},notifyEditorEndManipulateObjects:function(){this.getEditor().endManipulateObject()},getInteractionBoundInflation:function(e){return this.getEditor().getInteractionBoundInflation(e)},handleUiEvent:function(e){var t=!1,o=e.getTarget&&e.getTarget()||e.target,r=this.getEditor().getUiEventReceiverElem();r?(o===r||Kekule.DomUtils.isDescendantOf(o,r))&&(t=!0):t=!0,t&&this.tryApplySuper("handleUiEvent",[e])},canInteractWithObj:function(e){return!!e},getInteractableTargetClasses:function(){return null},getAllInteractableObjsAtScreenCoord:function(e){return this.getEditor().getBasicObjectsAtCoord(e,this.getCurrBoundInflation(),null,this.getInteractableTargetClasses())},getTopmostInteractableObjAtScreenCoord:function(e){var t=this.getAllInteractableObjsAtScreenCoord(e);if(t)for(var o=0,r=t.length;o<r;++o)if(this.canInteractWithObj(t[o]))return t[o];return null},hotTrackOnObj:function(e){this.getEditor().hotTrackOnObj(e)},zoomEditor:function(e,t){e>0?this.getEditor().zoomIn(e,t):e<0&&this.getEditor().zoomOut(-e,t)},_filterBasicObjectsInEditor:function(e){for(var t=this.getEditor().getChemObj(),o=[],r=0,i=e.length;r<i;++r){var n=e[r];n.isChildOf(t)&&o.push(n)}return o},doneInsertOrModifyBasicObjects:function(e){if(this.needAutoSelectNewlyInsertedObjects()){var t=this._filterBasicObjectsInEditor(e);this.getEditor().select(t)}},needAutoSelectNewlyInsertedObjects:function(){var e=this.getActivePointerType(),t=this.getEditorConfigs().getInteractionConfigs();return t.getAutoSelectNewlyInsertedObjectsOnTouch()&&"touch"===e||t.getAutoSelectNewlyInsertedObjects()},react_pointerdown:function(e){return this.setActivePointerType(e.pointerType),e.preventDefault(),!0},react_pointermove:function(e){var t=this._getEventMouseCoord(e),o=this.getTopmostInteractableObjAtScreenCoord(t);return this.getManuallyHotTrack()||(o?this.hotTrackOnObj(o):this.hotTrackOnObj(null)),e.preventDefault(),!0},react_mousewheel:function(e){if(e.getCtrlKey()){var t=this._getEventMouseCoord(e);try{var o=e.wheelDeltaY||e.wheelDelta;o&&(o/=120),this.zoomEditor(o,t)}finally{}return e.preventDefault(),!0}},_getEventMouseCoord:function(e,t){var o=t||this.getWidget().getCoreElement();return this.tryApplySuper("_getEventMouseCoord",[e,o])}}),Kekule.Editor.ClientDragScrollIaController=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.ClientDragScrollIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._isExecuting=!1},canInteractWithObj:function(e){return!1},doTestMouseCursor:function(e,t){return this.isExecuting()?["grabbing","-webkit-grabbing","-moz-grabbing","move"]:["grab","-webkit-grab","-moz-grab","pointer"]},isExecuting:function(){return this._isExecuting},startScroll:function(e){this._startCoord=e,this._originalScrollPos=this.getEditor().getClientScrollPosition(),this._isExecuting=!0},endScroll:function(){this._isExecuting=!1,this._startCoord=null,this._originalScrollPos=null},scrollTo:function(e){if(this.isExecuting()){var t=this._startCoord,o=Kekule.CoordUtils.substract(t,e),r=Kekule.CoordUtils.add(this._originalScrollPos,o);this.getEditor().scrollClientTo(r.y,r.x)}},react_pointerdown:function(e){if(this.setActivePointerType(e.pointerType),e.getButton()===Kekule.X.Event.MouseButton.LEFT){if(!this.isExecuting()){var t={x:e.getScreenX(),y:e.getScreenY()};this.startScroll(t),e.preventDefault()}}else e.getButton()===Kekule.X.Event.MouseButton.RIGHT&&this.isExecuting()&&(this.endScroll(),e.preventDefault())},react_pointerup:function(e){e.getButton()===Kekule.X.Event.MouseButton.LEFT&&this.isExecuting()&&(this.endScroll(),e.preventDefault())},react_pointermove:function(e){if(this.tryApplySuper("react_pointermove",[e]),this.isExecuting()){var t={x:e.getScreenX(),y:e.getScreenY()};this.scrollTo(t),e.preventDefault()}return!0}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.ClientDragScrollIaController,Kekule.Editor.BaseEditor),Kekule.Editor.BasicEraserIaController=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.BasicEraserIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._isExecuting=!1},canInteractWithObj:function(e){return!!e},removeObjs:function(e){if(e&&e.length){var t=this.getEditor();t.beginUpdateObject();try{var o=this.doGetActualRemovedObjs(e);this.doRemoveObjs(o)}finally{t.endUpdateObject()}}},doRemoveObjs:function(e){},doGetActualRemovedObjs:function(e){return e},removeSelection:function(){var e=this.getEditor();this.removeObjs(e.getSelection()),e.deselectAll()},removeOnScreenCoord:function(e){var t=this.getEditor().getTopmostBasicObjectAtCoord(e);return!!t&&(this.removeObjs([t]),!0)},startRemove:function(){this._isExecuting=!0},endRemove:function(){this._isExecuting=!1},isRemoving:function(){return this._isExecuting},reactUiEvent:function(e){var t=this.tryApplySuper("reactUiEvent",[e]),o=e.getType();return["touchstart","touchend","touchcancel","touchmove"].indexOf(o)>=0&&e.preventDefault(),t},react_pointerdown:function(e){if(this.setActivePointerType(e.pointerType),e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT){this.startRemove();var t=this._getEventMouseCoord(e);this.removeOnScreenCoord(t),e.preventDefault()}else e.getButton()===Kekule.X.Event.MOUSE_BTN_RIGHT&&(this.endRemove(),e.preventDefault())},react_pointerup:function(e){e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT&&(this.endRemove(),e.preventDefault())},react_pointermove:function(e){if(this.tryApplySuper("react_pointermove",[e]),this.isRemoving()){var t=this._getEventMouseCoord(e);this.removeOnScreenCoord(t),e.preventDefault()}return!0}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.BasicEraserIaController,Kekule.Editor.BaseEditor),Kekule.Editor.BasicManipulationIaController=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.BasicManipulationIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setState(Kekule.Editor.BasicManipulationIaController.State.NORMAL),this.setEnableSelect(!1),this.setEnableGestureManipulation(!1),this.setEnableMove(!0),this.setEnableResize(!0),this.setEnableAspectRatioLockedResize(!0),this.setEnableRotate(!0),this._suppressConstrainedResize=!1,this._manipulationStepBuffer={},this._suspendedOperations=null,this.execManipulationStepBind=this.execManipulationStep.bind(this)},initProperties:function(){this.defineProp("selectMode",{dataType:DataType.INT,serializable:!1}),this.defineProp("enableSelect",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableMove",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableResize",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableRotate",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableGestureManipulation",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("state",{dataType:DataType.INT,serializable:!1}),this.defineProp("baseCoord",{dataType:DataType.HASH,serializable:!1}),this.defineProp("startCoord",{dataType:DataType.HASH,serializable:!1}),this.defineProp("endCoord",{dataType:DataType.HASH,serializable:!1}),this.defineProp("startBox",{dataType:DataType.HASH,serializable:!1}),this.defineProp("endBox",{dataType:DataType.HASH,serializable:!1}),this.defineProp("lastRotateAngle",{dataType:DataType.FLOAT,serializable:!1}),this.defineProp("rotateRefCoord",{dataType:DataType.HASH,serializable:!1}),this.defineProp("rotateCenter",{dataType:DataType.HASH,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("rotateCenter");if(!e){var t=this._getManipulateObjsCenterCoord();e=this.getEditor().objCoordToScreen(t),this.setPropStoreFieldValue("rotateCenter",e)}return e}}),this.defineProp("resizeStartingRegion",{dataType:DataType.INT,serializable:!1}),this.defineProp("enableAspectRatioLockedResize",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("rotateStartingRegion",{dataType:DataType.INT,serializable:!1}),this.defineProp("manipulateOriginObjs",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("manipulateObjs",{dataType:DataType.ARRAY,serializable:!1,setter:function(e){this.setPropStoreFieldValue("manipulateObjs",e),e?this.getEditor().prepareOperatingObjs(e):this.getEditor().endOperatingObjs()}}),this.defineProp("manipulateObjInfoMap",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("manipulateObjInfoMap");return e||(e=new Kekule.MapEx(!0),this.setPropStoreFieldValue("manipulateObjInfoMap",e)),e}}),this.defineProp("manipulateObjCurrInfoMap",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("manipulateObjCurrInfoMap");return e||(e=new Kekule.MapEx(!0),this.setPropStoreFieldValue("manipulateObjCurrInfoMap",e)),e}}),this.defineProp("manipulationType",{dataType:DataType.INT,serializable:!1}),this.defineProp("isManipulatingSelection",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("isOffsetManipulating",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("manipulationPointerType",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getActivePointerType()},setter:function(e){this.setActivePointerType(e)}}),this.defineProp("moveOperations",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("moveWrapperOperation",{dataType:DataType.OBJECT,serializable:!1}),this.defineProp("objOperationMap",{dataType:"Kekule.MapEx",serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("objOperationMap");return e||(e=new Kekule.MapEx(!0),this.setPropStoreFieldValue("objOperationMap",e)),e}})},doFinalize:function(){var e=this.getPropStoreFieldValue("manipulateObjInfoMap");e&&e.clear(),(e=this.getPropStoreFieldValue("objOperationMap"))&&e.clear(),this.tryApplySuper("doFinalize")},hotTrackOnObj:function(e){if(this.getEnableSelect()&&this.getSelectMode()===Kekule.Editor.SelectMode.ANCESTOR){var t=this.getStandaloneAncestor(e);return e&&e.getStandaloneAncestor&&e.getStandaloneAncestor(),this.tryApplySuper("hotTrackOnObj",[t])}return this.tryApplySuper("hotTrackOnObj",[e])},getStandaloneAncestor:function(e){return e&&e.getStandaloneAncestor?e.getStandaloneAncestor():e},isInAncestorSelectMode:function(){return this.getEnableSelect()&&this.getSelectMode()===Kekule.Editor.SelectMode.ANCESTOR},isAspectRatioLockedResize:function(){return this.getEnableAspectRatioLockedResize()&&!this._suppressConstrainedResize},getCoordOnSelectionRotationRegion:function(e){var t=Kekule.Editor.BoxRegion,o=this.getEditor();if(o.getCoordRegionInSelectionMarker(e)!==t.OUTSIDE)return!1;var r=o.getEditorConfigs().getInteractionConfigs().getRotationRegionInflation(),i=o.getUiSelectionAreaContainerBox();if(i&&o.hasSelection()){for(var n=[t.CORNER_TL,t.CORNER_TR,t.CORNER_BR,t.CORNER_BL],a=[{x:i.x1,y:i.y1},{x:i.x2,y:i.y1},{x:i.x2,y:i.y2},{x:i.x1,y:i.y2}],l=!1,s=r,d=0,u=n.length;d<u;++d){var c=n[d],p=a[d],h=Kekule.CoordUtils.getDistance(p,e);h<=s&&(l=c,s=h)}return l}return!1},createManipulateOperation:function(){return this.doCreateManipulateMoveAndResizeOperation()},doCreateManipulateMoveAndResizeOperation:function(){var e=[];this.setMoveOperations(e);var t=this.getManipulateObjs(),o=this.getManipulateObjInfoMap();this.getObjOperationMap().clear();var r=new Kekule.ChemObjOperation.MoveAndResizeObjs([],[],this.getEditor().getCoordMode(),!0,this.getEditor());r.setDisableIndirectCoord(!0);for(var i=0,n=t.length;i<n;++i){var a=t[i],l=o.get(a),s=new Kekule.ChemObjOperation.MoveAndResize(a,null,null,this.getEditor().getCoordMode(),!0,this.getEditor());s.setAllowCoordBorrow(this.getEditor().getAllowCoordBorrow()),s.setOldCoord(l.objCoord),s.setOldDimension(l.size),e.push(s),r.getChildOperations().push(s),this.setMoveWrapperOperation(r)}return[r]},updateChildMoveOperation:function(e,t,o){this.getMoveOperations()[e].setNewCoord(o)},updateChildResizeOperation:function(e,t,o){this.getMoveOperations()[e].setNewDimension(o)},getAllObjOperations:function(e){var t=this.getMoveOperations(),o=t?Kekule.ArrayUtils.clone(t):[];if(o.length){var r=this.getMoveWrapperOperation();return r.setChildOperations(o),[r]}return[]},getActiveOperation:function(e){var t=this.getAllObjOperations(e);return(t=Kekule.ArrayUtils.toUnique(t)).length<=0?null:1===t.length?t[0]:new Kekule.MacroOperation(t)},reverseActiveOperation:function(){return this.getActiveOperation().reverse()},addOperationToEditor:function(){var e=this.getEditor();if(e&&e.getEnableOperHistory()){var t=this.getActiveOperation(!0);t&&e.pushOperation(t)}},getCurrAvailableManipulationTypes:function(){var e=Kekule.Editor.BasicManipulationIaController.ManipulationType,t=this.getEditor().getSelectionContainerBox();if(t){var o=[];return this.getEnableMove()&&o.push(e.MOVE),Kekule.NumUtils.isFloatEqual(t.x1,t.x2,1e-10)&&Kekule.NumUtils.isFloatEqual(t.y1,t.y2,1e-10)||(this.getEnableResize()&&o.push(e.RESIZE),this.getEnableRotate()&&o.push(e.ROTATE),(this.getEnableResize()||this.getEnableRotate())&&o.push(e.TRANSFORM)),o}return[]},getActualManipulatingObjects:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o],n=i.getCoordDependentObjects?i.getCoordDependentObjects():[i];Kekule.ArrayUtils.pushUnique(t,n)}return t},doPrepareManipulatingObjects:function(e,t){var o=this.getActualManipulatingObjects(e);this.setManipulateOriginObjs(e),this.setManipulateObjs(o);var r=this.getManipulateObjInfoMap();r.clear();this.getEditor();for(var i=0,n=o.length;i<n;++i){var a=o[i],l=this.createManipulateObjInfo(a,i,t);r.set(a,l)}},doPrepareManipulatingStartingCoords:function(e,t,o,r){this.setStartBox(t),this.setRotateCenter(o),this.setRotateRefCoord(r),this.setLastRotateAngle(null)},prepareManipulating:function(e,t,o,r,i,n){this.setManipulationType(e),this.doPrepareManipulatingObjects(t,o),this.doPrepareManipulatingStartingCoords(o,r,i,n),this.createManipulateOperation(),this._runManipulationStepId=Kekule.window.requestAnimationFrame(this.execManipulationStepBind)},cancelManipulate:function(){this.getEditor(),this.getManipulateObjs();this.reverseActiveOperation(),this.notifyCoordChangeOfObjects(this.getManipulateObjs()),this.manipulateEnd()},_getManipulateObjsCenterCoord:function(){var e=this.getManipulateObjs();if(!e||!e.length)return null;for(var t=this.getEditor().getCoordMode(),o=this.getEditor().getAllowCoordBorrow(),r={x:0,y:0,z:0},i=0,n=e.length;i<n;++i){var a=e[i],l=a.getAbsBaseCoord?a.getAbsBaseCoord(t,o):a.getAbsCoord?a.getAbsCoord(t,o):a.getCoordOfMode?a.getCoordOfMode(t,o):null;l&&(r=Kekule.CoordUtils.add(r,l))}return Kekule.CoordUtils.divide(r,e.length)},_maniplateObjsFrameEnd:function(e){},_addManipultingObjNewInfo:function(e,t){var o=this.getManipulateObjCurrInfoMap(),r=o.get(e)||{};r=Object.extend(r,t),o.set(e,r)},applyManipulatingObjsInfo:function(e){var t=this.getManipulateObjs(),o=this.getManipulateObjCurrInfoMap(),r=this._getIndirectCoordObjs(t);this._setEnableIndirectCoordOfObjs(r,!1);try{for(var i=0,n=t.length;i<n;++i){var a=t[i],l=o.get(a);this.applySingleManipulatingObjInfo(i,a,l,e)}}finally{this._setEnableIndirectCoordOfObjs(r,!0)}},_getIndirectCoordObjs:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o];i.getEnableIndirectCoord&&i.getEnableIndirectCoord()&&t.push(i)}return t},_setEnableIndirectCoordOfObjs:function(e,t){if(e)for(var o=0,r=e.length;o<r;++o)e[o].setEnableIndirectCoord(t)},applySingleManipulatingObjInfo:function(e,t,o,r){o&&(o.screenCoord&&this.doMoveManipulatedObj(e,t,o.screenCoord,r),o.size&&this.doResizeManipulatedObj(e,t,o.size))},_calcRotateAngle:function(e){var t,o=Kekule.CoordUtils,r=!1,i=this.getRotateCenter(),n=this.getRotateRefCoord()||this.getStartCoord(),a=this.getEditorConfigs().getInteractionConfigs().getRotationLocationPointDistanceThreshold();if(a){if(o.getDistance(n,i)<a)return t=0,r=!0,this.setStartCoord(e),!1;if(o.getDistance(e,i)<a)return t=0,r=!0,!1}if(!r){var l=o.substract(e,i),s=Math.atan2(l.y,l.x);l=o.substract(n,i);var d=Math.atan2(l.y,l.x);t=s-d}return{angle:t,startAngle:d,endAngle:s}},_calcActualRotateAngle:function(e,t,o,r){return t},_calcManipulateObjsRotationParams:function(e,t){if(!this.getEnableRotate())return!1;var o=this.getRotateCenter(),r=this._calcRotateAngle(t);if(!r)return!1;var i=this._calcActualRotateAngle(e,r.angle,r.startAngle,r.endAngle),n=this.getLastRotateAngle();return(!Kekule.ObjUtils.notUnset(n)||!Kekule.NumUtils.isFloatEqual(i,n,.0175))&&(this.setLastRotateAngle(i),{center:o,rotateAngle:i})},_calcActualResizeScales:function(e,t){return t},_calcManipulateObjsResizeParams:function(e,t,o){if(!this.getEnableResize())return!1;var r,i,n=Kekule.Editor.BoxRegion,a=Kekule.CoordUtils,l=this.getStartBox(),s=a.substract(o,this.getStartCoord());t===n.EDGE_TOP?(s.x=0,r={x:(l.x1+l.x2)/2,y:l.y2}):t===n.EDGE_BOTTOM?(s.x=0,r={x:(l.x1+l.x2)/2,y:l.y1}):t===n.EDGE_LEFT?(s.y=0,r={x:l.x2,y:(l.y1+l.y2)/2}):t===n.EDGE_RIGHT?(s.y=0,r={x:l.x1,y:(l.y1+l.y2)/2}):(this.isAspectRatioLockedResize()&&(i=!0),r=t===n.CORNER_TL?{x:l.x2,y:l.y2}:t===n.CORNER_TR?{x:l.x1,y:l.y2}:t===n.CORNER_BL?{x:l.x2,y:l.y1}:{x:l.x1,y:l.y1});var d,u,c=t===n.CORNER_TL||t===n.CORNER_BL||t===n.EDGE_LEFT,p=t===n.CORNER_TL||t===n.CORNER_TR||t===n.EDGE_TOP;if(d=Kekule.NumUtils.isFloatEqual(l.x1,l.x2,1e-10)?1:1+s.x/(l.x2-l.x1)*(c?-1:1),u=Kekule.NumUtils.isFloatEqual(l.y1,l.y2,1e-10)?1:1+s.y/(l.y2-l.y1)*(p?-1:1),i){var h=Math.abs(d),g=Math.abs(u);h>=g?u=(Math.sign(u)||1)*h:d=(Math.sign(d)||1)*g}var C=this._calcActualResizeScales(e,{scaleX:d,scaleY:u});return{center:r,scaleX:C.scaleX,scaleY:C.scaleY}},_calcManipulateObjsTransformInfo:function(e,t){for(var o=Kekule.CoordUtils,r=o.calcTransform2DMatrix(t),i=t.scaleX||t.scale,n=t.scaleY||t.scale,a=this._isManipulatingSingleStickedObj(e),l=0,s=e.length;l<s;++l){var d=e[l],u=this.getManipulateObjInfoMap().get(d),c={};if(!u.hasNoCoord){var p=u.screenCoord;if(!u.stickTarget||a){var h=o.transform2DByMatrix(p,r);c.screenCoord=h}else c.screenCoord=p}if(u.size&&(i||n)){var g={x:u.size.x*Math.abs(i||1),y:u.size.y*Math.abs(n||1)};c.size=g}this._addManipultingObjNewInfo(d,c)}return!0},_isStickedObj:function(e){return e&&e.getCoordStickTarget&&e.getCoordStickTarget()},_isManipulatingSingleStickedObj:function(e){var t=!1;if(1===e.length){var o=e[0];t=!!this.getManipulateObjInfoMap().get(o).stickTarget}return t},doTransformManipulatedObjs:function(e,t,o){var r=Kekule.Editor.BasicManipulationIaController.ManipulationType,i=this.getEditor(),n=this.getManipulateObjs(),a=o;if((a||(e===r.RESIZE?a=this._calcManipulateObjsResizeParams(n,this.getResizeStartingRegion(),t):e===r.ROTATE&&(a=this._calcManipulateObjsRotationParams(n,t))),!this._lastTransformParams||!this._isSameTransformParams(this._lastTransformParams,a,null,i.getCoordMode()))&&(a&&this._calcManipulateObjsTransformInfo(n,a))){this._lastTransformParams=a,i.beginUpdateObject();this.getManipulateObjCurrInfoMap();try{this.applyManipulatingObjsInfo(t),this._maniplateObjsFrameEnd(n),this.notifyCoordChangeOfObjects(n)}finally{i.endUpdateObject(),this.manipulateStepDone()}}},_isSameTransformParams:function(e,t,o,i){return o||(o=.1),i===Kekule.CoordMode.COORD2D?r.isSameTransform2DOptions(e,t,{translate:o,scale:o,rotate:o}):r.isSameTransform3DOptions(e,t,{translate:o,scale:o,rotate:o})},_calcActualMovedScreenCoord:function(e,t,o){return o},_calcManipulateObjsMoveInfo:function(e,t){var o=Kekule.CoordUtils,r=(this.getManipulateObjCurrInfoMap(),this._isManipulatingSingleStickedObj(e)),i=this.isDirectManipulating()&&1===e.length&&this.getEditorConfigs().getInteractionConfigs().getFollowPointerCoordOnDirectManipulatingSingleObj();if(i){var n=this.getStartCoord();o.getDistance(t,n)<=this.getEditorConfigs().getInteractionConfigs().getFollowPointerCoordOnDirectManipulatingSingleObjDistanceThreshold()&&(i=!1)}for(var a=0,l=e.length;a<l;++a){var s,d=e[a],u=this.getManipulateObjInfoMap().get(d);if(!u.hasNoCoord)if(!u.stickTarget||r)s=i?t:o.add(t,u.screenCoordOffset),s=this._calcActualMovedScreenCoord(d,u,s),this._addManipultingObjNewInfo(d,{screenCoord:s})}},moveManipulatedObjs:function(e){Kekule.CoordUtils;var t=this.getEditor(),o=this.getManipulateObjs();this._calcManipulateObjsMoveInfo(o,e),t.beginUpdateObject();this.getManipulateObjCurrInfoMap();try{this.applyManipulatingObjsInfo(e),this._maniplateObjsFrameEnd(o),this.notifyCoordChangeOfObjects(o)}finally{t.endUpdateObject(),this.manipulateStepDone()}},doMoveManipulatedObj:function(e,t,o,r){var i=this.getEditor();this.updateChildMoveOperation(e,t,i.screenCoordToObj(o)),i.setObjectScreenCoord(t,o)},doResizeManipulatedObj:function(e,t,o){this.updateChildResizeOperation(e,t,o),t.setSizeOfMode&&t.setSizeOfMode(o,this.getEditor().getCoordMode())},isDirectManipulating:function(){return this.getState()===Kekule.Editor.BasicManipulationIaController.State.MANIPULATING&&!this.getIsManipulatingSelection()},startDirectManipulate:function(e,t,o,r,i,n){return this.manipulateBegin(),this.doStartDirectManipulate(e,t,o,r,i,n)},doStartDirectManipulate:function(e,t,o,r,i,n){var a=Kekule.ArrayUtils.toArray(t);this.setState(Kekule.Editor.BasicManipulationIaController.State.MANIPULATING),this.setBaseCoord(o),this.setStartCoord(o),this.setRotateRefCoord(n),this.setIsManipulatingSelection(!1),this.prepareManipulating(e||Kekule.Editor.BasicManipulationIaController.ManipulationType.MOVE,a,o,r,i,n)},manipulateStepDone:function(){},doManipulateObjectsEnd:function(e){for(var t=this.getManipulateObjInfoMap(),o=e.length-1;o>=0;--o)this.doManipulateObjectEnd(e[o],t.get(e[o]))},doManipulateObjectEnd:function(e,t){},manipulateBegin:function(){this.notifyEditorBeginManipulateObjects()},manipulateEnd:function(){this._runManipulationStepId&&(Kekule.window.cancelAnimationFrame(this._runManipulationStepId),this._runManipulationStepId=null),this.doManipulateObjectsEnd(this.getManipulateObjs()),this._lastTransformParams=null,this.setIsOffsetManipulating(!1),this.setManipulateObjs(null),this.getManipulateObjInfoMap().clear(),this.getObjOperationMap().clear(),this.notifyEditorEndManipulateObjects()},manipulateBeforeStopping:function(){},stopManipulate:function(){this.manipulateEnd()},refreshManipulateObjs:function(){this.setManipulateObjs(this.getManipulateObjs())},createManipulateObjInfo:function(e,t,o){var r=this.getEditor(),i={objCoord:r.getObjCoord(e),screenCoord:r.getObjectScreenCoord(e),size:r.getObjSize(e),enableIndirectCoord:!(!e.getEnableIndirectCoord||!e.getEnableIndirectCoord())};return i.hasNoCoord=!i.objCoord,!i.hasNoCoord&&o&&(i.screenCoordOffset=Kekule.CoordUtils.substract(i.screenCoord,o)),e.getCoordStickTarget&&(i.stickTarget=e.getCoordStickTarget()),i},notifyCoordChangeOfObjects:function(e){for(var t=[],o=this.getEditor(),r=this.getEditor().getCoordMode()===Kekule.CoordMode.COORD3D?"coord3D":"coord2D",i=0,n=e.length;i<n;++i){var a=e[i];Kekule.ArrayUtils.pushUnique(t,{obj:a,propNames:[r]});for(var l=a.getCoordDeterminateObjects?a.getCoordDeterminateObjects():[a],s=0,d=l.length;s<d;++s)Kekule.ArrayUtils.pushUnique(t,{obj:l[s],propNames:[r]})}o.objectsChanged(t)},canInteractWithObj:function(e){return this.getState()===Kekule.Editor.BasicManipulationIaController.State.NORMAL&&e},doTestMouseCursor:function(e,t){var o="",r=this._getEventMouseCoord(t,this.getEditor().getEditClientElem());if(this.getState()===Kekule.Editor.BasicManipulationIaController.State.NORMAL){var i=Kekule.Editor.BoxRegion,n=this.getEditor().getCoordRegionInSelectionMarker(r);if(this.getEnableSelect()){var a=Kekule.Editor.BasicManipulationIaController.ManipulationType,l=this.getCurrAvailableManipulationTypes();if(l.indexOf(a.MOVE)>=0&&(o=n===i.INSIDE?"move":""),!o&&l.indexOf(a.RESIZE)>=0)o=n===i.CORNER_TL?"nwse-resize":n===i.CORNER_TR?"nesw-resize":n===i.CORNER_BL?"nesw-resize":n===i.CORNER_BR?"nwse-resize":n===i.EDGE_TOP||n===i.EDGE_BOTTOM?"ns-resize":n===i.EDGE_LEFT||n===i.EDGE_RIGHT?"ew-resize":"";if(!o)if(l.indexOf(a.ROTATE)>=0)if(n=this.getCoordOnSelectionRotationRegion(r)){var s=Kekule.Widget.StyleResourceNames;o=n===i.CORNER_TL?s.CURSOR_ROTATE_NW:n===i.CORNER_TR?s.CURSOR_ROTATE_NE:n===i.CORNER_BL?s.CURSOR_ROTATE_SW:n===i.CORNER_BR?s.CURSOR_ROTATE_SE:s.CURSOR_ROTATE}}}return o},setSuspendedOperations:function(e,t,o){this._suspendedOperations&&this.haltSuspendedOperations();return this._suspendedOperations={immediate:e,delayed:t,delayExecId:setTimeout(this.execSuspendedDelayOperation.bind(this),o)},this._suspendedOperations},execSuspendedImmediateOperation:function(){if(this._suspendedOperations){clearTimeout(this._suspendedOperations.delayExecId);var e=this._suspendedOperations.immediate;return this._suspendedOperations=null,e.apply(this)}},execSuspendedDelayOperation:function(){if(this._suspendedOperations){clearTimeout(this._suspendedOperations.delayExecId);var e=this._suspendedOperations.delayed;return this._suspendedOperations=null,e.apply(this)}},haltSuspendedOperations:function(){this._suspendedOperations&&(clearTimeout(this._suspendedOperations.delayExecId),this._suspendedOperations=null)},_startNewSelecting:function(e,t){this.getEnableSelect()&&(this.getEditor().startSelecting(e,t||this.getEditor().getIsToggleSelectOn()),this.setState(Kekule.Editor.BasicManipulationIaController.State.SELECTING))},_startOffSelectionManipulation:function(e){this.setIsOffsetManipulating(!0),this.startManipulation(e,null,Kekule.Editor.BasicManipulationIaController.ManipulationType.MOVE),this.getEditor().pulseSelectionAreaMarker()},startManipulation:function(e,t,o){var r=Kekule.Editor.BasicManipulationIaController.State,i=Kekule.Editor.BasicManipulationIaController.ManipulationType,n=this.getCurrAvailableManipulationTypes(),a=t&&"touch"===t.pointerType;t&&this.setManipulationPointerType(t&&t.pointerType),this.manipulateBegin(),this.setBaseCoord(e),this.setStartCoord(e);var l=this.getEditor().getTopmostBasicObjectAtCoord(e,this.getCurrBoundInflation());if(l&&!a&&(this.isInAncestorSelectMode()&&(l=this.getStandaloneAncestor(l)),l=l.getNearestMovableObject(),this.getEnableMove()))this.doStartDirectManipulate(null,l,e);else{this._lastTransformParams=null;var s=e&&this.getEditor().getCoordRegionInSelectionMarker(e),d=Kekule.Editor.BoxRegion,u=e&&this.getCoordOnSelectionRotationRegion(e),c=n.indexOf(i.TRANSFORM)>=0&&o===i.TRANSFORM;if(c)this._availTransformTypes=n;else var p=!a&&n.indexOf(i.RESIZE)>=0&&(o===i.RESIZE||s!==d.INSIDE&&s!==d.OUTSIDE),h=!p&&n.indexOf(i.MOVE)>=0&&(o===i.MOVE||s!==d.OUTSIDE),g=!a&&!p&&!h&&n.indexOf(i.ROTATE)>=0&&(o===i.ROTATE||!!u);if(c)this.setState(r.MANIPULATING),this.setIsManipulatingSelection(!0),this.setResizeStartingRegion(s),this.setRotateStartingRegion(u),this.prepareManipulating(i.TRANSFORM,this.getEditor().getSelection(),e,this.getEditor().getSelectionContainerBox());else if(p)this.setState(r.MANIPULATING),this.setIsManipulatingSelection(!0),this.setResizeStartingRegion(s),this.prepareManipulating(i.RESIZE,this.getEditor().getSelection(),e,this.getEditor().getSelectionContainerBox());else if(h)this.setState(r.MANIPULATING),this.setIsManipulatingSelection(!0),this.prepareManipulating(i.MOVE,this.getEditor().getSelection(),e);else if(g)this.setState(r.MANIPULATING),this.setIsManipulatingSelection(!0),this.setRotateStartingRegion(u),this.prepareManipulating(i.ROTATE,this.getEditor().getSelection(),e,this.getEditor().getSelectionContainerBox());else if(l)this.getEnableMove()&&this.startDirectManipulate(null,l,e);else if(this.getEnableMove()&&this.getEnableSelect()&&this.getEditorConfigs().getInteractionConfigs().getEnableOffSelectionManipulation()&&this.getEditor().hasSelection()&&this.getEditor().isSelectionVisible()){this.setState(r.SUSPENDING);var C=this.getEditorConfigs().getInteractionConfigs().getOffSelectionManipulationActivatingTimeThreshold(),_=t&&t.getShiftKey();this.setSuspendedOperations(this._startNewSelecting.bind(this,e,_),this._startOffSelectionManipulation.bind(this,e),C)}else if(this.getEnableSelect()){_=t&&t.getShiftKey();this._startNewSelecting(e,_)}}},execManipulationStep:function(e){if(this.getState()!==Kekule.Editor.BasicManipulationIaController.State.MANIPULATING)return!1;var t=this._manipulationStepBuffer.coord,o=this._manipulationStepBuffer.event,r=this._manipulationStepBuffer.explicitTransformParams;t&&o?this.doExecManipulationStep(t,o,this._manipulationStepBuffer):r&&this.doExecManipulationStepWithExplicitTransformParams(r,this._manipulationStepBuffer),this._manipulationStepBuffer.coord=null,this._manipulationStepBuffer.event=null,this._manipulationStepBuffer.explicitTransformParams=null,this._runManipulationStepId=Kekule.window.requestAnimationFrame(this.execManipulationStepBind)},doExecManipulationStep:function(e,t,o){var r=Kekule.Editor.BasicManipulationIaController.ManipulationType,i=this.getManipulationType(),n=this.getEditor();n.beginUpdateObject();try{this._isBusy=!0,i===r.MOVE?this.moveManipulatedObjs(e):i===r.RESIZE?(this._suppressConstrainedResize=t.getAltKey(),this.doTransformManipulatedObjs(i,e)):i===r.ROTATE&&this.doTransformManipulatedObjs(i,e)}finally{n.endUpdateObject(),this._isBusy=!1}},doExecManipulationStepWithExplicitTransformParams:function(e,t){var o=Kekule.Editor.BasicManipulationIaController.ManipulationType,r=this.getManipulationType();if(r===o.TRANSFORM){var i=this.getEditor();i.beginUpdateObject();try{this._isBusy=!0,this.doTransformManipulatedObjs(r,null,e)}finally{i.endUpdateObject(),this._isBusy=!1}}},updateManipulationStepBuffer:function(e,t){Object.extend(e,t)},react_pointermove:function(e){if(this.tryApplySuper("react_pointermove",[e]),this._isBusy)return!0;var t,o=Kekule.Editor.BasicManipulationIaController.State,r=(Kekule.Editor.BasicManipulationIaController.ManipulationType,this._getEventMouseCoord(e));if(this._lastMouseMoveCoord){var i=Kekule.CoordUtils.getDistance(r,this._lastMouseMoveCoord);if(t=i,i<4)return!0}if(this._lastMouseMoveCoord=r,this.getState()===o.SUSPENDING){var n=this.getEditorConfigs().getInteractionConfigs().getUnmovePointerDistanceThreshold()||0;Kekule.ObjUtils.notUnset(t)&&t>n&&this.execSuspendedImmediateOperation()}var a=this.getState();return a===o.SELECTING?(this.getEnableSelect()&&this.getEditor().addSelectingAnchorCoord(r),e.preventDefault()):a===o.MANIPULATING&&(this.updateManipulationStepBuffer(this._manipulationStepBuffer,{coord:r,event:e}),e.preventDefault()),!0},react_pointerdown:function(e){this.tryApplySuper("react_pointerdown",[e]);var t=Kekule.Editor.BasicManipulationIaController.State;if(e.getButton()===Kekule.X.Event.MouseButton.LEFT){this._lastMouseMoveCoord=null;var o=this._getEventMouseCoord(e);if(this.getState()===t.NORMAL){var r=this,i=function(){r.getState()===t.NORMAL&&(r.startManipulation(o,e),e.preventDefault())};this.setSuspendedOperations(i,i,50)}}else e.getButton()===Kekule.X.Event.MouseButton.RIGHT&&(this.getState()===t.MANIPULATING?(this.cancelManipulate(),this.setState(t.NORMAL),e.stopPropagation(),e.preventDefault()):this.getState()===t.SUSPENDING&&this.haltSuspendedOperations());return!0},react_pointerup:function(e){if(e.getButton()===Kekule.X.Event.MouseButton.LEFT){var t=this._getEventMouseCoord(e);this.setEndCoord(t);var o=this.getStartCoord(),r=t,i=e.getShiftKey(),n=Kekule.Editor.BasicManipulationIaController.State;this.getState()===n.SUSPENDING&&this.execSuspendedImmediateOperation();var a=this.getState();if(a===n.SELECTING)this.getEditor().endSelecting(t,i||this.getEditor().getIsToggleSelectOn()),this.setState(n.NORMAL),e.preventDefault(),this.getEditor().endManipulateObject();else a===n.MANIPULATING&&(Kekule.CoordUtils.isEqual(o,r)?this.getEnableSelect()&&this.getEditor().selectOnCoord(o,i||this.getEditor().getIsToggleSelectOn()):(this.manipulateBeforeStopping(),this.addOperationToEditor()),this.stopManipulate(),this.setState(n.NORMAL),e.preventDefault())}return!0},react_mousewheel:function(e){if(e.getCtrlKey()){if(this.getState()===Kekule.Editor.BasicManipulationIaController.State.NORMAL)return this.tryApplySuper("react_mousewheel",[e]);e.preventDefault()}},_isGestureManipulationEnabled:function(){return this.getEditorConfigs().getInteractionConfigs().getEnableGestureManipulation()},_isGestureZoomOnEditorEnabled:function(){return this.getEditorConfigs().getInteractionConfigs().getEnableGestureZoomOnEditor()},_isInGestureManipulation:function(){return!!this._initialGestureTransformParams},_isGestureZoomOnEditor:function(){return!!this._initialGestureZoomLevel},beginGestureTransform:function(e){this.getEditor().hasSelection()?(this._initialGestureZoomLevel=null,this._isGestureManipulationEnabled()?(this.haltSuspendedOperations(),this._initialGestureTransformParams={angle:e.rotation*Math.PI/180||0},this.getState()!==Kekule.Editor.BasicManipulationIaController.State.MANIPULATING?this.startManipulation(null,null,Kekule.Editor.BasicManipulationIaController.ManipulationType.TRANSFORM):this.getManipulationType()!==Kekule.Editor.BasicManipulationIaController.ManipulationType.TRANSFORM&&this.setManipulationType(Kekule.Editor.BasicManipulationIaController.ManipulationType.TRANSFORM)):this._initialGestureTransformParams=null):this._isGestureZoomOnEditorEnabled()&&(this.getEditor().cancelSelecting(),this.setState(Kekule.Editor.BasicManipulationIaController.State.NORMAL),this._initialGestureZoomLevel=this.getEditor().getZoom())},endGestureTransform:function(){this.getState()===Kekule.Editor.BasicManipulationIaController.State.MANIPULATING&&this._isInGestureManipulation()&&(this.manipulateBeforeStopping(),this.addOperationToEditor(),this.stopManipulate(),this.setState(Kekule.Editor.BasicManipulationIaController.State.NORMAL),this._initialGestureTransformParams=null),this._isGestureZoomOnEditor()&&(this._initialGestureZoomLevel=null)},doGestureTransformStep:function(e){var t=Kekule.Editor.BasicManipulationIaController.ManipulationType;if(this.getState()===Kekule.Editor.BasicManipulationIaController.State.MANIPULATING&&this.getManipulationType()===t.TRANSFORM&&this._isInGestureManipulation()){var o,r=this._availTransformTypes||[],i=this.getRotateCenter();if(r.indexOf(t.RESIZE)>=0){var n=e.scale;o=this._calcActualResizeScales(this.getManipulateObjs(),{scaleX:n,scaleY:n})}else o={scaleX:1,scaleY:1};if(r.indexOf(t.ROTATE)>=0){var a=e.rotation*Math.PI/180,l=a-this._initialGestureTransformParams.angle;l=this._calcActualRotateAngle(this.getManipulateObjs(),l,this._initialGestureTransformParams.angle,a)}else l=0;this.updateManipulationStepBuffer(this._manipulationStepBuffer,{explicitTransformParams:{center:i,scaleX:o.scaleX,scaleY:o.scaleY,rotateAngle:l}}),e.preventDefault()}else if(this._isGestureZoomOnEditor()){var s=this.getEditor(),d=(n=e.scale,this._initialGestureZoomLevel);s.zoomTo(d*n,null,e.center)}},react_rotatestart:function(e){this.getEnableGestureManipulation()&&this.beginGestureTransform(e)},react_rotate:function(e){this.getEnableGestureManipulation()&&this.doGestureTransformStep(e)},react_rotateend:function(e){this.getEnableGestureManipulation()&&this.endGestureTransform()},react_rotatecancel:function(e){this.getEnableGestureManipulation()&&this.endGestureTransform()},react_pinchstart:function(e){this.getEnableGestureManipulation()&&this.beginGestureTransform(e)},react_pinchmove:function(e){this.getEnableGestureManipulation()&&this.doGestureTransformStep(e)},react_pinchend:function(e){this.getEnableGestureManipulation()&&this.endGestureTransform()},react_pinchcancel:function(e){this.getEnableGestureManipulation()&&this.endGestureTransform()}}),Kekule.Editor.BasicManipulationIaController.State={NORMAL:0,SELECTING:1,MANIPULATING:2,SUSPENDING:11},Kekule.Editor.BasicManipulationIaController.ManipulationType={MOVE:0,ROTATE:1,RESIZE:2,TRANSFORM:4},Kekule.Editor.IaControllerManager.register(Kekule.Editor.BasicManipulationIaController,Kekule.Editor.BaseEditor)}(),function(){"use strict";var e=Kekule.ArrayUtils;Kekule.ChemObjOperation={},Kekule.ChemObjOperation.Base=Class.create(Kekule.Operation,{CLASS_NAME:"Kekule.ChemObjOperation.Base",initialize:function(e,t){this.tryApplySuper("initialize"),this.setTarget(e),t&&this.setEditor(t)},initProperties:function(){this.defineProp("target",{dataType:"Kekule.ChemObject",serializable:!1}),this.defineProp("allowCoordBorrow",{dataType:DataType.BOOL}),this.defineProp("editor",{dataType:"Kekule.Editor.BaseEditor",serializable:!1})},notifyBeforeAddingByEditor:function(e,t,o){e.beforeAddingByEditor&&e.beforeAddingByEditor(t,o)},notifyBeforeRemovingByEditor:function(e,t){e.beforeRemovingByEditor&&e.beforeRemovingByEditor(t)},notifyBeforeModifyingByEditor:function(e,t){e.beforeModifyingByEditor&&e.beforeModifyingByEditor(t)},notifyAfterAddingByEditor:function(e,t,o){e.afterAddingByEditor&&e.afterAddingByEditor(t,o)},notifyAfterRemovingByEditor:function(e,t){e.afterRemovingByEditor&&e.afterRemovingByEditor(t)},notifyAfterModifyingByEditor:function(e,t){e.afterModifyingByEditor&&e.afterModifyingByEditor(t)}}),Kekule.ChemObjOperation.ChangeClass=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.ChangeClass",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,o]),t&&this.setNewClass(t)},initProperties:function(){this.defineProp("newClass",{dataType:DataType.CLASS,serializable:!1}),this.defineProp("oldClass",{dataType:DataType.CLASS,serializable:!1})},doExecute:function(){var e=this.getTarget();e.beginUpdate();try{this.notifyBeforeModifyingByEditor(e,{}),this.getOldClass()||this.setOldClass(e.getClass()),e.__changeClass__(this.getNewClass()),this.notifyAfterModifyingByEditor(e,{})}finally{e.endUpdate()}},doReverse:function(){var e=this.getTarget();e.beginUpdate();try{this.notifyBeforeModifyingByEditor(e,{}),e.__changeClass__(this.getOldClass()),this.notifyAfterModifyingByEditor(e,{})}finally{e.endUpdate()}}}),Kekule.ChemObjOperation.Modify=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.Modify",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,o]),t&&this.setNewPropValues(t)},initProperties:function(){this.defineProp("newPropValues",{dataType:DataType.HASH}),this.defineProp("oldPropValues",{dataType:DataType.HASH})},doExecute:function(){var e={},t=this.getNewPropValues(),o=this.getTarget();o.beginUpdate();try{for(var r in this.notifyBeforeModifyingByEditor(o,t),t){var i=t[r];e[r]=o.getPropValue(r),o.setPropValue(r,i)}this.notifyAfterModifyingByEditor(o,t)}finally{o.endUpdate()}this.setOldPropValues(e)},doReverse:function(){var e=this.getOldPropValues(),t=this.getTarget();t.beginUpdate();try{for(var o in this.notifyBeforeModifyingByEditor(t,e),e){var r=e[o];t.setPropValue(o,r)}this.notifyAfterModifyingByEditor(t,e)}finally{t.endUpdate()}}}),Kekule.ChemObjOperation.ModifyHashProp=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.ModifyHashProp",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,r]),t&&this.setPropName(t),o&&this.setNewPropValue(o)},initProperties:function(){this.defineProp("propName",{dataType:DataType.STRING}),this.defineProp("newPropValue",{dataType:DataType.HASH}),this.defineProp("oldPropValue",{dataType:DataType.HASH})},_extendHash:function(e,t){},doExecute:function(){var e=this.getTarget(),t=this.getPropName(),o=e.getPropValue(this.getPropName()),r=Object.extend(Object.extend({},o),this.getNewPropValue(),!1),i={};i[t]=r,e.beginUpdate();try{this.notifyBeforeModifyingByEditor(e,i),e.setPropValue(t,r),this.notifyAfterModifyingByEditor(e,i)}finally{e.endUpdate()}this.getOldPropValue()||this.setOldPropValue(o)},doReverse:function(){var e=this.getTarget(),t=this.getPropName(),o=this.getOldPropValue(),r=(e.getPropValue(t),o),i={};i[t]=r,e.beginUpdate();try{this.notifyBeforeModifyingByEditor(e,i),e.setPropValue(t,r),this.notifyAfterModifyingByEditor(e,i)}finally{e.endUpdate()}}}),Kekule.ChemObjOperation.MoveTo=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.MoveTo",initialize:function(e,t,o,r,i){this.tryApplySuper("initialize",[e,i]),t&&this.setNewCoord(t),this.setCoordMode(o||Kekule.CoordMode.COORD2D),this.setUseAbsBaseCoord(!!r)},initProperties:function(){this.defineProp("newCoord",{dataType:DataType.HASH}),this.defineProp("oldCoord",{dataType:DataType.HASH}),this.defineProp("coordMode",{dataType:DataType.INT}),this.defineProp("useAbsBaseCoord",{dataType:DataType.BOOL})},setObjCoord:function(e,t,o){if(e&&t&&o){var r=!1;if(this.getUseAbsBaseCoord()?e.setAbsBaseCoord&&(e.setAbsBaseCoord(t,o,this.getAllowCoordBorrow()),r=!0):e.setCoordOfMode&&(e.setCoordOfMode(t,o),r=!0),!r){var i=e.getClassName?e.getClassName():typeof e;Kekule.warn(Kekule.$L("ErrorMsg.CAN_NOT_SET_COORD_OF_CLASS").format(i))}}},getObjCoord:function(e,t){if(this.getUseAbsBaseCoord()){if(e.getAbsBaseCoord)return e.getAbsBaseCoord(t,this.getAllowCoordBorrow())}else if(e.getCoordOfMode)return e.getCoordOfMode(t,this.getAllowCoordBorrow());return null},doExecute:function(){var e=this.getTarget();this.getOldCoord()||this.setOldCoord(this.getObjCoord(e,this.getCoordMode())),this.getNewCoord()&&this.setObjCoord(this.getTarget(),this.getNewCoord(),this.getCoordMode())},doReverse:function(){this.getOldCoord()&&this.setObjCoord(this.getTarget(),this.getOldCoord(),this.getCoordMode())}}),Kekule.ChemObjOperation.MoveAndResize=Class.create(Kekule.ChemObjOperation.MoveTo,{CLASS_NAME:"Kekule.ChemObjOperation.MoveAndResize",initialize:function(e,t,o,r,i,n){this.tryApplySuper("initialize",[e,o,r,i,n])},initProperties:function(){this.defineProp("newDimension",{dataType:DataType.HASH}),this.defineProp("oldDimension",{dataType:DataType.HASH})},setObjSize:function(e,t,o){if(e&&t)if(e.setSizeOfMode)e.setSizeOfMode(t,o);else{var r=e.getClassName?e.getClassName():typeof e;Kekule.warn(Kekule.$L("ErrorMsg.CAN_NOT_SET_DIMENSION_OF_CLASS").format(r))}},getObjSize:function(e,t){return e.getSizeOfMode?e.getSizeOfMode(t,this.getAllowCoordBorrow()):null},doExecute:function(){this.tryApplySuper("doExecute");var e=this.getTarget();this.getOldDimension()||this.setOldDimension(this.getObjSize(e,this.getCoordMode())),this.getNewDimension()&&this.setObjSize(this.getTarget(),this.getNewDimension(),this.getCoordMode())},doReverse:function(){this.getOldDimension()&&this.setObjSize(this.getTarget(),this.getOldDimension(),this.getCoordMode()),this.tryApplySuper("doReverse")}}),Kekule.ChemObjOperation.MoveAndResizeObjs=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.MoveAndResizeObjs",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[null,r]),e&&this.setObjCoordAndSizeInfo(e),this.setCoordMode(t||Kekule.CoordMode.COORD2D),this.setUseAbsCoord(!!o),this.setPropStoreFieldValue("childOperations",[])},initProperties:function(){this.defineProp("objCoordAndSizeInfo",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("coordMode",{dataType:DataType.INT}),this.defineProp("useAbsCoord",{dataType:DataType.BOOL}),this.defineProp("disableIndirectCoord",{dataType:DataType.BOOL}),this.defineProp("childOperations",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("indirectCoordObjs",{dataType:DataType.ARRAY,serializable:!1})},_setEnableIndirectCoordOfObjs:function(e,t){if(e)for(var o=0,r=e.length;o<r;++o)e[o].setEnableIndirectCoord(t)},_prepareIndirectCoordObjs:function(e){var t=[];if(this.getDisableIndirectCoord())for(var o=0,r=e.length;o<r;++o){var i=e[o];if(i&&i instanceof Kekule.ChemObjOperation.MoveAndResize){var n=i.getTarget();n.hasProperty("enableIndirectCoord")&&n.getEnableIndirectCoord()&&(n.setEnableIndirectCoord(!1),t.push(n))}}this.setIndirectCoordObjs(t)},_prepareExecute:function(){var e=this.getChildOperations();if(!e.length){e.length=0;for(var t=this.getObjCoordAndSizeInfo(),o=0,r=t.length;o<r;++o){var i=t[o],n=i.obj,a=new Kekule.ChemObjOperation.MoveAndResize(n,i.newDimension,i.newCoord,this.getCoordMode(),this.getUseAbsCoord(),this.getEditor());a.setAllowCoordBorrow(this.getAllowCoordBorrow()),i.oldDimension&&a.setOldDimension(i.oldDimension),i.oldCoord&&a.setOldCoord(i.oldCoord),e.push(a)}}this._prepareIndirectCoordObjs(e)},_prepareReverse:function(){this.getDisableIndirectCoord()&&(this.getIndirectCoordObjs()||this._prepareIndirectCoordObjs(this.getChildOperations()),this._setEnableIndirectCoordOfObjs(this.getIndirectCoordObjs(),!1))},_doneMoveAndResize:function(){this._setEnableIndirectCoordOfObjs(this.getIndirectCoordObjs(),!0)},doExecute:function(){this.tryApplySuper("doExecute");try{this._prepareExecute();for(var e=this.getChildOperations(),t=0,o=e.length;t<o;++t)e[t].execute()}finally{this._doneMoveAndResize()}},doReverse:function(){try{this._prepareReverse();for(var e=this.getChildOperations(),t=e.length-1;t>=0;--t)e[t].reverse()}finally{this._doneMoveAndResize()}this.tryApplySuper("doReverse")}}),Kekule.ChemObjOperation.StickTo=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.StickTo",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,o]),t&&this.setStickTarget(t)},initProperties:function(){this.defineProp("stickTarget",{dataType:Kekule.ChemObject,serializable:!1}),this.defineProp("oldStickTarget",{dataType:Kekule.ChemObject,serializable:!1})},_canExecute:function(e){return e&&e.getAllowCoordStickTo&&e.getAllowCoordStickTo(this.getStickTarget())},doExecute:function(){this.tryApplySuper("doExecute");var e=this.getTarget();this._canExecute(e)&&(void 0===this.getOldStickTarget()&&this.setOldStickTarget(e.getCoordStickTarget()||null),e.setCoordStickTarget(this.getStickTarget()))},doReverse:function(){this.getTarget().setCoordStickTarget(this.getOldStickTarget()),this.tryApplySuper("doReverse")}}),Kekule.ChemObjOperation.StickTo.canStick=function(e,t,o,r){var i=e&&e.getAllowCoordStickTo&&e.getAllowCoordStickTo(t);if(t&&(i=(i=(i=(i=(i=i&&t&&t.getAbsCoordOfMode)&&t!==e)&&t.getAcceptCoordStickFrom&&t.getAcceptCoordStickFrom(e))&&(!t.getCoordStickTarget||t.getCoordStickTarget()!==e))&&(o||!(t instanceof Kekule.StructureFragment)))&&!r){var n=e.getParent(),a=t.getParent();i=n!==a||!n||!a}return i},Kekule.ChemObjOperation.Add=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.Add",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,r]),this.setParentObj(t),this.setRefSibling(o)},initProperties:function(){this.defineProp("parentObj",{dataType:"Kekule.ChemObject",serializable:!1}),this.defineProp("refSibling",{dataType:"Kekule.ChemObject",serializable:!1})},doExecute:function(){var e=this.getParentObj(),t=this.getTarget();if(e&&t){var o=this.getRefSibling()||null;this.notifyBeforeAddingByEditor(t,e,o),e.insertBefore(t,o),this.notifyAfterAddingByEditor(t,e,o)}},doReverse:function(){var e=this.getTarget(),t=this.getParentObj();if(t&&e){var o=this.getRefSibling();o||(o=e.getNextSibling(),this.setRefSibling(o)),this.notifyBeforeRemovingByEditor(e,t),t.removeChild(e),this.notifyAfterRemovingByEditor(e,t)}}}),Kekule.ChemObjOperation.Remove=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemObjOperation.Remove",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,r]),this.setParentObj(t),this.setRefSibling(o)},initProperties:function(){this.defineProp("parentObj",{dataType:"Kekule.ChemObject",serializable:!1}),this.defineProp("ownerObj",{dataType:"Kekule.ChemObject",serializable:!1}),this.defineProp("refSibling",{dataType:"Kekule.ChemObject",serializable:!1}),this.defineProp("removedRelations",{dataType:DataType.ARRAY,serializable:!1})},_isInEditorSelection:function(e){var t=this.getEditor();return(t&&t.getSelection&&t.getSelection()||[]).indexOf(e)>=0},_getRelatedObjRefRelations:function(t){var o=[],r=t.getOwner();if(r){var i=r.findObjRefRelations({dest:t},{checkDestChildren:!0});if(i&&i.length)for(var n=0,a=i.length;n<a;++n){var l=Object.extend({},i[n]);e.isArray(l.dest)&&(l.dest=e.clone(l.dest)),o.push(l)}}return o},_restoreRelations:function(e){if(e)for(var t=0,o=e.length;t<o;++t){var r=e[t];r.srcObj.setPropValue(r.srcProp.name,r.dest)}},doExecute:function(){var e=this.getTarget(),t=this.getParentObj(),o=this.getOwnerObj();if(!t&&e.getParent&&(t=e.getParent(),this.setParentObj(t)),!o&&e.getOwner&&(o=e.getOwner(),this.setOwnerObj(o)),t&&e){if(!this.getRefSibling()){var r=e.getNextSibling?e.getNextSibling():null;this.setRefSibling(r)}var i=this._getRelatedObjRefRelations(e);this.setRemovedRelations(i);var n=this.getEditor(),a=this._isInEditorSelection(e);a&&n.beginUpdateSelection(),this.notifyBeforeRemovingByEditor(e,t),t.removeChild(e),this.notifyAfterRemovingByEditor(e,t),a&&(n.removeFromSelection(e),n.endUpdateSelection())}},doReverse:function(){var e=this.getParentObj(),t=this.getOwnerObj(),o=this.getTarget();if(e&&o){var r=this.getRefSibling();t&&o.setOwner(t),this.notifyBeforeAddingByEditor(o,e,r),e.insertBefore(o,r),this._restoreRelations(this.getRemovedRelations()),this.setRemovedRelations([]),this.notifyAfterAddingByEditor(o,e,r)}}}),Kekule.ChemStructOperation={},Kekule.ChemStructOperation.AddNode=Class.create(Kekule.ChemObjOperation.Add,{CLASS_NAME:"Kekule.ChemStructOperation.AddNode"}),Kekule.ChemStructOperation.RemoveNode=Class.create(Kekule.ChemObjOperation.Remove,{CLASS_NAME:"Kekule.ChemStructOperation.RemoveNode",initProperties:function(){this.defineProp("linkedConnectorInfos",{dataType:DataType.ARRAY,serializable:!1})},doExecute:function(){if(!this.getLinkedConnectorInfos()){for(var e=this.getTarget(),t=e.getLinkedConnectors(),o=[],r=0,i=t.length;r<i;++r){var n=t[r],a=n.indexOfConnectedObj(e),l=n.getConnectedObjAt(a+1)||null;o.push({connector:n,refSibling:l})}this.setLinkedConnectorInfos(o)}this.tryApplySuper("doExecute")},doReverse:function(){this.tryApplySuper("doReverse");var e=this.getLinkedConnectorInfos();if(e)for(var t=this.getTarget(),o=0,r=e.length;o<r;++o){var i=e[o].connector,n=e[o].refSibling;i.insertConnectedObjBefore(t,n)}}}),Kekule.ChemStructOperation.ReplaceNode=Class.create(Kekule.Operation,{CLASS_NAME:"Kekule.ChemStructOperation.ReplaceNode",initialize:function(e,t,o,r){this.tryApplySuper("initialize"),this.setOldNode(e),this.setNewNode(t),this.setParentObj(o),this.setEditor(r)},initProperties:function(){this.defineProp("oldNode",{dataType:"Kekule.ChemStructureNode",serializable:!1}),this.defineProp("newNode",{dataType:"Kekule.ChemStructureNode",serializable:!1}),this.defineProp("parentObj",{dataType:"Kekule.ChemStructureFragment",serializable:!1}),this.defineProp("editor",{dataType:"Kekule.Editor.BaseEditor",serializable:!1})},_isInEditorSelection:function(e){var t=this.getEditor();return(t&&t.getSelection&&t.getSelection()||[]).indexOf(e)>=0},doExecute:function(){var e=this.getOldNode(),t=this.getNewNode();if(e&&t){var o=this.getParentObj();if(o||(o=e.getParent(),this.setParentObj(o)),o.replaceNode){var r=this.getEditor(),i=this._isInEditorSelection(e);i&&r.beginUpdateSelection(),o.replaceNode(e,t),i&&(r.removeFromSelection(e),r.addObjToSelection(t),r.endUpdateSelection())}}},doReverse:function(){var e=this.getOldNode(),t=this.getNewNode();if(e&&t){var o=this.getParentObj()||t.getParent();if(o.replaceNode){var r=this.getEditor(),i=this._isInEditorSelection(t);i&&r.beginUpdateSelection(),o.replaceNode(t,e),i&&(r.removeFromSelection(t),r.addObjToSelection(e),r.endUpdateSelection())}}}}),Kekule.ChemStructOperation.AddConnector=Class.create(Kekule.ChemObjOperation.Add,{CLASS_NAME:"Kekule.ChemStructOperation.AddConnector",initialize:function(e,t,o,r,i){this.tryApplySuper("initialize",[e,t,o,i]),this.setConnectedObjs(r)},initProperties:function(){this.defineProp("connectedObjs",{dataType:DataType.ARRAY,serializable:!1})},doExecute:function(){this.tryApplySuper("doExecute");var e=Kekule.ArrayUtils.clone(this.getConnectedObjs());e&&e.length&&this.getTarget().setConnectedObjs(e)},doReverse:function(){this.tryApplySuper("doReverse")}}),Kekule.ChemStructOperation.RemoveConnector=Class.create(Kekule.ChemObjOperation.Remove,{CLASS_NAME:"Kekule.ChemStructOperation.RemoveConnector",initProperties:function(){this.defineProp("connectedObjs",{dataType:DataType.ARRAY,serializable:!1})},doExecute:function(){this.getConnectedObjs()||this.setConnectedObjs(Kekule.ArrayUtils.clone(this.getTarget().getConnectedObjs())),this.tryApplySuper("doExecute")},doReverse:function(){this.tryApplySuper("doReverse");var e=this.getConnectedObjs();e&&e.length&&this.getTarget().setConnectedObjs(e)}}),Kekule.ChemStructOperation.MergeNodesBase=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemStructOperation.MergeNodesBase",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,r]),this.setDest(t),this.setEnableStructFragmentMerge(o||!1),this._refSibling=null,this._nodeParent=null},initProperties:function(){this.defineProp("dest",{dataType:"Kekule.ChemStructureNode",serializable:!1}),this.defineProp("enableStructFragmentMerge",{dataType:DataType.BOOL}),this.defineProp("mergeConnectorPropsFromTarget",{dataType:DataType.BOOL})},getCommonSiblings:function(e,t){var o=e.getLinkedObjs(),r=t.getLinkedObjs();return Kekule.ArrayUtils.intersect(o,r)},doExecute:function(){},doReverse:function(){}}),Kekule.ChemStructOperation.MergeNodes=Class.create(Kekule.ChemStructOperation.MergeNodesBase,{CLASS_NAME:"Kekule.ChemStructOperation.MergeNodes",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,t,o,r]),this._refSibling=null,this._nodeParent=null,this._structFragmentMergeOperation=null,this._removeConnectorOperations=[],this._removeNodeOperation=null,this._modifyConnecorOperations=[]},initProperties:function(){this.defineProp("relinkedConnectors",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("removedConnectors",{dataType:DataType.ARRAY,serializable:!1})},getMergeConnPropsOperation:function(e,t){var o;if(e instanceof Kekule.Bond&&t instanceof Kekule.Bond&&(e.getBondType()===t.getBondType()&&e.getBondType()===Kekule.BondType.COVALENT)){var r=e.getBondOrder();r>t.getBondOrder()&&(o=new Kekule.ChemObjOperation.Modify(t,{bondOrder:r}))}return o},doExecute:function(){var e=this.getMergeConnectorPropsFromTarget(),t=this._modifyConnecorOperations||[],o=this.getTarget(),r=this.getDest(),i=o.getParentFragment(),n=r.getParentFragment();if(i!==n){if(!this.getEnableStructFragmentMerge())return null;this._structFragmentMergeOperation=new Kekule.ChemStructOperation.MergeStructFragment(i,n,this.getEditor()),this._structFragmentMergeOperation.execute(),i=n}this._nodeParent=i,i.beginUpdate();try{var a,l=this.getEditor();if(!(s=this.getRemovedConnectors())){t=[],a=this.getCommonSiblings(o,r);var s=[];if(a.length)for(var d=0,u=a.length;d<u;++d){var c=a[d];(y=o.getConnectorTo(c))&&2==y.getConnectedObjCount()&&s.push(y)}var p=o.getConnectorTo(r);p&&s.push(p),this.setRemovedConnectors(s)}if(!(h=this.getRelinkedConnectors())){var h=Kekule.ArrayUtils.clone(o.getLinkedConnectors())||[];h=Kekule.ArrayUtils.exclude(h,s),this.setRelinkedConnectors(h)}this._refSibling=o.getNextSibling();for(d=0,u=h.length;d<u;++d){var g=(y=h[d]).indexOfConnectedObj(o);y.removeConnectedObj(o),y.insertConnectedObjAt(r,g)}if(e&&!t.length&&s&&s.length){a||(a=this.getCommonSiblings(o,r));for(d=0,u=a.length;d<u;++d){c=a[d];var C=o.getConnectorTo(c);if(s.indexOf(C)>=0){var _=r.getConnectorTo(c);if(_){var f=this.getMergeConnPropsOperation(C,_);f&&t.push(f)}}}}this._removeConnectorOperations=[];for(d=0,u=s.length;d<u;++d){var y=s[d],m=new Kekule.ChemStructOperation.RemoveConnector(y,null,null,l);m.execute(),this._removeConnectorOperations.push(m)}if(this._removeNodeOperation=new Kekule.ChemStructOperation.RemoveNode(o,null,null,l),this._removeNodeOperation.execute(),t){this._modifyConnecorOperations=t;for(d=0,u=t.length;d<u;++d)t[d].execute()}}finally{i.endUpdate()}},doReverse:function(){var e=this.getTarget(),t=this.getDest(),o=this._nodeParent;o.beginUpdate();try{var r=this._modifyConnecorOperations;if(r)for(var i=0,n=r.length;i<n;++i)r[i].reverse();if(this._removeNodeOperation.reverse(),this._removeConnectorOperations.length)for(i=this._removeConnectorOperations.length-1;i>=0;--i){this._removeConnectorOperations[i].reverse()}this._removeConnectorOperations=[];var a=this.getRelinkedConnectors();for(i=0,n=a.length;i<n;++i){var l=a[i],s=l.indexOfConnectedObj(t);l.removeConnectedObj(t),l.insertConnectedObjAt(e,s)}}finally{o.endUpdate()}this._structFragmentMergeOperation&&this._structFragmentMergeOperation.reverse()}}),Kekule.ChemStructOperation.MergeNodes.canMerge=function(e,t,o,r){if(e instanceof Kekule.StructureFragment||t instanceof Kekule.StructureFragment)return!1;if(!(e instanceof Kekule.ChemStructureNode&&t instanceof Kekule.ChemStructureNode))return!1;var i=e.getParent()===t.getParent()||o;return r||(i=i&&!e.getConnectorTo(t)),i},Kekule.ChemStructOperation.MergeNodesPreview=Class.create(Kekule.ChemStructOperation.MergeNodesBase,{CLASS_NAME:"Kekule.ChemStructOperation.MergeNodesPreview",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,t,o,r]),this._nodeParent=null},doExecute:function(){this._moveNodeOperations=[];var e=this.getTarget(),t=this.getDest(),o=e.getParentFragment(),r=Kekule.CoordMode,i=[r.COORD2D,r.COORD3D];o&&o.beginUpdate();try{for(var n=0,a=i.length;n<a;++n){var l=t.getAbsBaseCoord(i[n],!1),s=new Kekule.ChemObjOperation.MoveTo(e,l,i[n],!0,this.getEditor());s.execute(),this._moveNodeOperations.push(s)}this._nodeParent=o}finally{o&&o.endUpdate()}},doReverse:function(){var e=this._nodeParent;e&&e.beginUpdate();try{for(var t=this._moveNodeOperations,o=t.length-1;o>=0;--o)t[o].reverse()}finally{e&&e.endUpdate()}this._moveNodeOperations=null}}),Kekule.ChemStructOperation.MergeNodesPreview.canMerge=Kekule.ChemStructOperation.MergeNodes.canMerge,Kekule.ChemStructOperation.MergeConnectorsBase=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemStructOperation.MergeConnectorsBase",initialize:function(e,t,o,r,i){this.tryApplySuper("initialize",[e,i]),this.setDest(t),this.setCoordMode(o||Kekule.CoordMode.COORD2D),this.setEnableStructFragmentMerge(r||!1),this._refSibling=null,this._nodeParent=null,this._nodeMergeOperations=[]},initProperties:function(){this.defineProp("dest",{dataType:"Kekule.ChemStructureConnector",serializable:!1}),this.defineProp("enableStructFragmentMerge",{dataType:DataType.BOOL}),this.defineProp("coordMode",{dataType:DataType.INT})},getMergeNodeOperationClass:function(){},doExecute:function(){Kekule.ChemStructOperation.MergeConnectors.canMerge(this.getTarget(),this.getDest(),this.getEnableStructFragmentMerge())||Kekule.error(Kekule.$L("ErrorMsg.CAN_NOT_MERGE_CONNECTORS"));for(var e=this.getCoordMode(),t=[this.getTarget(),this.getDest()],o=Kekule.ArrayUtils,r=o.clone(this.getTarget().getConnectedObjs()),i=o.clone(this.getDest().getConnectedObjs()),n=this.getAllowCoordBorrow(),a=0,l=t.length;a<l;++a){var s=t[a],d=s.getConnectedObjAt(0).getAbsCoordOfMode(e,n),u=s.getConnectedObjAt(1).getAbsCoordOfMode(e,n),c=Kekule.CoordUtils.substract(d,u),p=Math.abs(c.x)>Math.abs(c.y)?"x":"y";Kekule.ObjUtils.notUnset(d.z)&&Math.abs(c.z)>Math.abs(c.x)&&(p="z"),(0===a?r:i).sort(function(t,o){var r=t.getAbsCoordOfMode(e,n),i=o.getAbsCoordOfMode(e,n);return r[p]-i[p]||0})}var h=o.intersect(r,i);r=o.exclude(r,h),i=o.exclude(i,h),this._nodeMergeOperations=[];var g=this.getMergeNodeOperationClass();for(a=0,l=r.length;a<l;++a){if(r[a]!==i[a]){var C=new g(r[a],i[a],this.getEnableStructFragmentMerge());C.execute()}this._nodeMergeOperations.push(C)}},doReverse:function(){for(var e=this._nodeMergeOperations.length-1;e>=0;--e){this._nodeMergeOperations[e].reverse()}this._nodeMergeOperations=[]}}),Kekule.ChemStructOperation.MergeConnectors=Class.create(Kekule.ChemStructOperation.MergeConnectorsBase,{CLASS_NAME:"Kekule.ChemStructOperation.MergeConnectors",getMergeNodeOperationClass:function(){return Kekule.ChemStructOperation.MergeNodes}}),Kekule.ChemStructOperation.MergeConnectors.canMerge=function(e,t,o){if(!o&&e.getParent()!==t.getParent())return!1;if(e.isConnectingConnector()||t.isConnectingConnector())return!1;var r=e.getConnectedExposedObjs(),i=t.getConnectedObjs();return r.length===i.length&&(2===r.length&&!(Kekule.ArrayUtils.intersect(r,i).length>=1))},Kekule.ChemStructOperation.MergeConnectorsPreview=Class.create(Kekule.ChemStructOperation.MergeConnectorsBase,{CLASS_NAME:"Kekule.ChemStructOperation.MergeConnectors",getMergeNodeOperationClass:function(){return Kekule.ChemStructOperation.MergeNodesPreview}}),Kekule.ChemStructOperation.MergeConnectorsPreview.canMerge=Kekule.ChemStructOperation.MergeConnectors.canMerge,Kekule.ChemStructOperation.MergeStructFragment=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemStructOperation.MergeStructFragment",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,o]),this.setDest(t),this._removeOperation=null},initProperties:function(){this.defineProp("dest",{dataType:"Kekule.StructureFragment",serializable:!1}),this.defineProp("mergedNodes",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("mergedConnectors",{dataType:DataType.ARRAY,serializable:!1})},moveChildBetweenStructFragment:function(e,t,o,r){Kekule.ChemStructureUtils.moveChildBetweenStructFragment(e,t,o,r)},doExecute:function(){var e=this.getTarget(),t=this.getDest();if(e&&t){var o=Kekule.ArrayUtils.clone(e.getNodes());this.setMergedNodes(o);var r=Kekule.ArrayUtils.clone(e.getConnectors());this.setMergedConnectors(r),this.moveChildBetweenStructFragment(e,t,o,r);var i=e.getParent();i&&(this._removeOperation=new Kekule.ChemObjOperation.Remove(e,i,null,this.getEditor()),this._removeOperation.execute())}},doReverse:function(){var e=this.getTarget(),t=this.getDest();if(e&&t){this._removeOperation&&(this._removeOperation.reverse(),this._removeOperation=null);var o=this.getMergedNodes(),r=this.getMergedConnectors();this.moveChildBetweenStructFragment(t,e,o,r)}}}),Kekule.ChemStructOperation.SplitStructFragment=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemStructOperation.SplitStructFragment",initialize:function(e,t){this.tryApplySuper("initialize",[e,t])},initProperties:function(){this.defineProp("splittedFragments",{dataType:DataType.ARRAY,serializable:!1,setter:null})},doExecute:function(){var e=Kekule.ChemStructureUtils.splitStructFragment(this.getTarget());if(e.length>1){this.setPropStoreFieldValue("splittedFragments",e);var t=this.getTarget().getParent(),o=this.getTarget().getNextSibling();t.beginUpdate();try{if(t)for(var r=1,i=e.length;r<i;++r){var n=e[r];t.insertBefore(n,o)}}finally{t.endUpdate()}}else this.setPropStoreFieldValue("splittedFragments",null)},doReverse:function(){var e=this.getSplittedFragments();if(e&&e.length)for(var t=this.getTarget(),o=0,r=e.length;o<r;++o){var i=e[o];if(i!==t){Kekule.ChemStructureUtils.moveChildBetweenStructFragment(i,t,Kekule.ArrayUtils.clone(i.getNodes()),Kekule.ArrayUtils.clone(i.getConnectors()));var n=i.getParent();n&&n.removeChild(i),i.finalize()}}}}),Kekule.ChemStructOperation.StandardizeStructFragment=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemStructOperation.StandardizeStructFragment",initialize:function(e,t){this.tryApplySuper("initialize",[e,t]),this.setEnableSplit(!0),this.setEnableRemove(!0),this._concreteOper=null},initProperties:function(){this.defineProp("enableRemove",{dataType:DataType.BOOL}),this.defineProp("enableSplit",{dataType:DataType.BOOL})},doExecute:function(){var e=this.getTarget(),t=e.getNodeCount();this._concreteOper=null;var o=this.getEditor();return t<=0?this.getEnableRemove()&&(this._concreteOper=new Kekule.ChemObjOperation.Remove(e,null,null,o)):this.getEnableSplit()&&(this._concreteOper=new Kekule.ChemStructOperation.SplitStructFragment(e,o)),this._concreteOper?this._concreteOper.execute():null},doReverse:function(){return this._concreteOper?this._concreteOper.reverse():null}}),Kekule.ChemSpaceEditorOperation={},Kekule.ChemSpaceEditorOperation.ChangeSpaceSize=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemSpaceEditorOperation.ChangeSpaceSize",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,r]),this.setCoordMode(o||Kekule.CoordMode.COORD2D),t&&this.setNewSize(t)},initProperties:function(){this.defineProp("coordMode",{dataType:DataType.INT}),this.defineProp("newSize",{dataType:DataType.HASH}),this.defineProp("oldSize",{dataType:DataType.HASH})},doExecute:function(){var e=this.getEditor(),t=this.getTarget();try{var o=this.getCoordMode();this.getOldSize()||this.setOldSize(Object.extend({},t.getSizeOfMode(o,e.getAllowCoordBorrow()))),e.changeChemSpaceSize(this.getNewSize(),o)}finally{}},doReverse:function(){var e=this.getEditor();this.getTarget();if(this.getOldSize())try{var t=this.getCoordMode();e.changeChemSpaceSize(this.getOldSize(),t)}finally{}}}),Kekule.ChemSpaceEditorOperation.ShiftChildrenCoords=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemSpaceEditorOperation.ShiftChildrenCoords",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,r]),this.setCoordMode(o||Kekule.CoordMode.COORD2D),t&&this.setCoordDelta(t)},initProperties:function(){this.defineProp("coordMode",{dataType:DataType.INT}),this.defineProp("coordDelta",{dataType:DataType.HASH})},doExecute:function(){var e=this.getEditor(),t=(this.getTarget(),this.getCoordDelta()),o=this.getCoordMode();try{e._shiftChemSpaceChildCoord(t,o)}finally{}},doReverse:function(){var e=this.getEditor(),t=(this.getTarget(),Kekule.CoordUtils.multiply(this.getCoordDelta(),-1)),o=this.getCoordMode();try{e._shiftChemSpaceChildCoord(t,o)}finally{}}}),Kekule.ChemSpaceEditorOperation.ChangeSpaceSizeAndShiftChildrenCoords=Class.create(Kekule.ChemObjOperation.Base,{CLASS_NAME:"Kekule.ChemSpaceEditorOperation.ChangeSpaceSizeAndShiftChildrenCoords",initialize:function(e,t,o,r,i){this.setPropStoreFieldValue("restoreScrollPosition",!0),this.tryApplySuper("initialize",[e,i]),this.setCoordMode(r||Kekule.CoordMode.COORD2D),t&&this.setNewSize(t),o&&this.setCoordDelta(o)},initProperties:function(){this.defineProp("restoreScrollPosition",{dataType:DataType.BOOL}),this.defineProp("coordMode",{dataType:DataType.INT}),this.defineProp("coordDelta",{dataType:DataType.HASH}),this.defineProp("newSize",{dataType:DataType.HASH}),this.defineProp("oldSize",{dataType:DataType.HASH,serializable:!1})},doExecute:function(){var e=this.getEditor(),t=this.getTarget();try{var o,r=this.getCoordMode(),i=this.getRestoreScrollPosition();i&&(o=e.getClientScrollCoord(Kekule.Editor.CoordSys.CHEM)),this.getNewSize()&&(this.getOldSize()||this.setOldSize(Object.extend({},t.getSizeOfMode(r,e.getAllowCoordBorrow()))),e.changeChemSpaceSize(this.getNewSize(),r)),this.getCoordDelta()&&(e._shiftChemSpaceChildCoord(this.getCoordDelta(),r),o=Kekule.CoordUtils.add(o,this.getCoordDelta())),i&&e._registerAfterUpdateObjectProc(function(){e.scrollClientToCoord(o,Kekule.Editor.CoordSys.CHEM)})}finally{}},doReverse:function(){var e=this.getEditor();this.getTarget();if(this.getOldSize()||this.getCoordDelta())try{var t,o=this.getRestoreScrollPosition(),r=this.getCoordMode();o&&(t=e.getClientScrollCoord(Kekule.Editor.CoordSys.CHEM)),this.getCoordDelta()&&(e._shiftChemSpaceChildCoord(Kekule.CoordUtils.multiply(this.getCoordDelta(),-1),r),t=Kekule.CoordUtils.substract(t,this.getCoordDelta())),this.getOldSize()&&e.changeChemSpaceSize(this.getOldSize(),r),this.getRestoreScrollPosition()&&t&&e._registerAfterUpdateObjectProc(function(){e.scrollClientToCoord(t,Kekule.Editor.CoordSys.CHEM)})}finally{}}})}(),Kekule.Editor.StructureUtils={getCascadeDeleteObjs:function(e){return Kekule.ChemStructureUtils.getCascadeDeleteObjs(e)},getSurroundingObjs:function(e){var t=e.getLinkedObjs();if(e instanceof Kekule.ChemStructureConnector){var o=e.getConnectedObjs();Kekule.ArrayUtils.pushUnique(t,o)}return t},calcMostEmptyDirectionAngleOfChemObj:function(e,t,o){var r=[];t||(t=e.getLinkedObjs());for(var i=e.getAbsBaseCoord2D(o),n=0,a=t.length;n<a;++n){var l=t[n].getAbsBaseCoord2D(o);l=Kekule.CoordUtils.substract(l,i);var s=Math.atan2(l.y,l.x);s<0&&(s=2*Math.PI+s),r.push(s)}if(r.sort(),0===(a=r.length))return 0;if(1===a)return-r[0];var d=0,u=0;for(n=0;n<a;++n){var c=r[n],p=r[(n+1)%a]-c;p<0&&(p+=2*Math.PI),p>d&&(d=p,u=n)}return r[u]+d/2},calcPreferred2DBondGrowingDirection:function(e,t,o){var r=e.getAbsBaseCoord2D(o),i=Kekule.Editor.StructureUtils.getSurroundingObjs(e);switch(i?i.length:0){case 0:return t;case 1:var n=i[0].getAbsBaseCoord2D(o),a=Kekule.CoordUtils.substract(n,r),l=Math.atan2(a.y,a.x),s=l-t,d=l+t;return s<0&&(s+=2*Math.PI),d<0&&(d+=2*Math.PI),s!==d?Math.min(s>Math.PI?Math.abs(s-2*Math.PI):s,Math.abs(s-Math.PI))<=Math.min(d>Math.PI?Math.abs(d-2*Math.PI):d,Math.abs(d-Math.PI))?s:d:s;default:return Kekule.Editor.StructureUtils.calcMostEmptyDirectionAngleOfChemObj(e,i,o)}},calcPreferred2DBondGrowingLocation:function(e,t,o,r){var i=e.getAbsBaseCoord2D(r),n=Kekule.Editor.StructureUtils.calcPreferred2DBondGrowingDirection(e,o,r);return Kekule.CoordUtils.add(i,{x:t*Math.cos(n),y:t*Math.sin(n)})},isBondPropsMatch:function(e,t,o){var r=!0;return r&&o.indexOf("bondType")>=0&&(r=e.bondType==t.bondType||!e.bondType&&!t.bondType),r&&e.bondType===Kekule.BondType.COVALENT&&((r&&o.indexOf("bondOrder")>=0||!e.bondOrder&&!t.bondOrder)&&(r=e.bondOrder==t.bondOrder),r&&o.indexOf("stereo")>=0&&(r=e.stereo==t.stereo||!e.stereo&&!t.stereo)),r&&(r=Kekule.ObjUtils.equal(e,t,["bondType","bondOrder","stereo"])),r},getChemStructureNodeLabel:function(e,t,o){if(e.getIsotopeId){var r=e.getIsotopeId();if(o&&o.includeExplicitHydrogens){var i=e.getExplicitHydrogenCount&&e.getExplicitHydrogenCount();i>0&&(r+="H"),i>1&&(r+=i.toString())}return r}if(e instanceof Kekule.SubGroup){var n=e.getAbbr()||e.getFormulaText();return t&&(n=n||t.getRgroup()),n}var a=e.getCoreDisplayRichTextItem(null,null,t);return Kekule.Render.RichTextUtils.toText(a)},getAllChemStructureNodesLabel:function(e,t,o){for(var r,i=0,n=e.length;i<n;++i){var a=e[i],l=Kekule.Editor.StructureUtils.getChemStructureNodeLabel(a,t,o);if(r){if(r!==l)return null}else r=l}return r},getAllChemStructureNodesHtmlCode:function(e,t,o,r){for(var i,n=0,a=e.length;n<a;++n){var l=e[n].getCoreDisplayRichTextItem(t,o,r),s=Kekule.Render.RichTextUtils.toSimpleHtmlCode(l);if(i){if(i!==s)return null}else i=s}return i},getStructureCenterAbsBaseCoord:function(e,t,o){for(var r=null,i=Kekule.CoordUtils.add,n=e.getNodeCount(),a=0;a<n;++a){var l=e.getNodeAt(a).getAbsBaseCoord(t,o);r=r?i(r,l):l}return r=Kekule.CoordUtils.divide(r,n)}},Kekule.Editor.RepositoryStructureUtils={_calcNodeMergeAdjustRotateAngle:function(e,t,o){var r=0,i=e.getCoordMode();if(i!==Kekule.CoordMode.COORD3D){var n=e.getAllowCoordBorrow(),a=e.getEditorConfigs().getStructureConfigs(),l=Kekule.Editor.StructureUtils.getSurroundingObjs(t),s=Kekule.Editor.StructureUtils.getSurroundingObjs(o);if(1===l.length){var d=(p=t.getLinkedConnectorAt(0)).getBondOrder?p.getBondOrder():0,u=a.getNewBondDefAngle(o,d);h=Kekule.Editor.StructureUtils.calcPreferred2DBondGrowingDirection(o,u,n);var c=Kekule.ChemStructureUtils.getAbsCoordVectorBetweenObjs(t,l[0],i,n);r=h-Math.atan2(c.y,c.x)}else if(1===s.length){d=(p=o.getLinkedConnectorAt(0)).getBondOrder?p.getBondOrder():0,u=a.getNewBondDefAngle(t,d);var p,h=Kekule.Editor.StructureUtils.calcPreferred2DBondGrowingDirection(t,u,n);c=Kekule.ChemStructureUtils.getAbsCoordVectorBetweenObjs(o,s[0],i,n),r=Math.atan2(c.y,c.x)-h}else{u=a.getNewBondDefAngle(o,null),h=Kekule.Editor.StructureUtils.calcPreferred2DBondGrowingDirection(o,u,n);for(var g={},C=0,_=l.length;C<_;++C){c=Kekule.ChemStructureUtils.getAbsCoordVectorBetweenObjs(t,l[C],i,n);var f=Math.atan2(c.y,c.x);(Kekule.ObjUtils.isUnset(g.min)||f<g.min)&&(g.min=f),(Kekule.ObjUtils.isUnset(g.max)||f>g.max)&&(g.max=f)}r=h-(g.max+g.min)/2}}return r},_calcConnectorMergeTransformParams:function(e,t,o){var r=t.getConnectedObjAt(0),i=t.getConnectedObjAt(1),n=o.getConnectedObjAt(0),a=o.getConnectedObjAt(1),l=e.getObjCoord(r),s=e.getObjCoord(i),d=e.getObjCoord(n),u=e.getObjCoord(a);return Kekule.CoordUtils.calcCoordGroup2DTransformParams(l,s,u,d)},calcRepObjInitialTransformParams:function(e,t,o,r,i){var n,a=o.baseObjCoord,l=e.getDefBondLength()/t.getRefLength(),s=a;if(o.mergeObj&&(r=o.mergeDest||r))if(i=e.getObjectScreenCoord(r),o.mergeObj instanceof Kekule.ChemStructureNode&&r instanceof Kekule.ChemStructureNode)n=Kekule.Editor.RepositoryStructureUtils._calcNodeMergeAdjustRotateAngle(e,o.mergeObj,r);else if(o.mergeObj instanceof Kekule.ChemStructureConnector&&r instanceof Kekule.ChemStructureConnector)return Kekule.Editor.RepositoryStructureUtils._calcConnectorMergeTransformParams(e,o.mergeObj,r);var d=e.translateCoord(i,Kekule.Editor.CoordSys.SCREEN,Kekule.Editor.CoordSys.CHEM);return a&&(d=Kekule.CoordUtils.substract(d,a)),{scale:l,translateX:d.x,translateY:d.y,translateZ:d.z,rotateAngle:n,center:s}},transformChemObjectsCoordAndSize:function(e,t,o){var r=e.getCoordMode(),i=e.getAllowCoordBorrow(),n=r===Kekule.CoordMode.COORD3D?Kekule.CoordUtils.calcTransform3DMatrix(o):Kekule.CoordUtils.calcTransform2DMatrix(o),a=Object.extend({},o);a=Object.extend(a,{translateX:0,translateY:0,translateZ:0,center:{x:0,y:0,z:0}});for(var l=r===Kekule.CoordMode.COORD3D?Kekule.CoordUtils.calcTransform3DMatrix(a):Kekule.CoordUtils.calcTransform2DMatrix(a),s=0,d=t.length;s<d;++s){var u=t[s];u.transformAbsCoordByMatrix(n,l,r,!0,i),u.scaleSize(o.scale,r,!0,i)}}},Kekule.Editor.OperationUtils={createNodeModificationOperation:function(e,t,o,r,i){var n,a,l=e.getClass();if(t&&!o&&(o=t.getClass()),t||o!==l){n=new Kekule.MacroOperation,t||(t=new o);var s=new Kekule.ChemStructureNode;s.assign(e),t.assign(s);var d=new Kekule.ChemStructOperation.ReplaceNode(e,t,null,i);n.add(d)}else t=e;return r&&(a=new Kekule.ChemObjOperation.Modify(t,r,i),n&&n.add(a)),n||a},createNodeModificationOperationFromData:function(e,t,o){if(!t)return null;var r,i=t.nodeClass,n=t.props,a=t.repositoryItem;if(a){var l=a.createObjects(e)||{},s=l.objects,d=Kekule.Editor.RepositoryStructureUtils.calcRepObjInitialTransformParams(o,a,l,e,null);o.transformCoordAndSizeOfObjects(s,d),i=(r=s[0]).getClass()}if(t.isUnknownPseudoatom&&!o.getEditorConfigs().getInteractionConfigs().getAllowUnknownAtomSymbol()&&(i=null),i){if(n){var u=Object.extend({},n);if(e.getExplicitHydrogenCount&&e.getExplicitHydrogenCount()&&(u.explicitHydrogenCount=null),u.inputHydrogenCount&&u.isotopeId){var c=e._getCurrCovalentBondsInfo&&e._getCurrCovalentBondsInfo()||{},p=e._getCurrIonicBondsInfo&&e._getCurrIonicBondsInfo()||{},h=Kekule.IsotopesDataUtil.getIsotopeIdDetail(u.isotopeId).symbol,g=Kekule.ChemicalElementsDataUtil.getAtomicNumber(h),C=Math.round(e.getCharge&&e.getCharge()||0),_=e.getRadical?Kekule.RadicalOrder.getRadicalElectronCount(e.getRadical()):0;Kekule.ChemStructureUtils.getImplicitHydrogenCount(g,{coValenceBondValenceSum:c.valenceSum||0,otherBondValenceSum:p.valenceSum||0,charge:C,radicalECount:_})!==u.inputHydrogenCount&&(u.explicitHydrogenCount=u.inputHydrogenCount,delete u.inputHydrogenCount)}}return Kekule.Editor.OperationUtils.createNodeModificationOperation(e,r,i,u,o)}return Kekule.error(Kekule.$L("ErrorMsg.INVALID_ATOM_SYMBOL")),null}},function(){"use strict";var e=Class.PropertyScope;Kekule.Editor.BaseEditorConfigs=Class.create(Kekule.ChemWidget.ChemObjDisplayerConfigs,{CLASS_NAME:"Kekule.Editor.BaseEditorConfigs",initProperties:function(){this.addConfigProp("uiMarkerConfigs","Kekule.EditorConfigs.UiMarkerConfigs"),this.addConfigProp("interactionConfigs","Kekule.EditorConfigs.InteractionConfigs"),this.addConfigProp("structureConfigs","Kekule.Editor.StructureConfigs"),this.addConfigProp("hotKeyConfigs","Kekule.Editor.HotKeyConfigs")},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setPropStoreFieldValue("uiMarkerConfigs",new Kekule.Editor.UiMarkerConfigs),this.setPropStoreFieldValue("interactionConfigs",new Kekule.Editor.InteractionConfigs),this.setPropStoreFieldValue("structureConfigs",new Kekule.Editor.StructureConfigs),this.setPropStoreFieldValue("hotKeyConfigs",new Kekule.Editor.HotKeyConfigs)}}),Kekule.Editor.ChemSpaceEditorConfigs=Class.create(Kekule.Editor.BaseEditorConfigs,{CLASS_NAME:"Kekule.Editor.ChemSpaceEditorConfigs",initProperties:function(){this.addConfigProp("chemSpaceConfigs","Kekule.Editor.ChemSpaceConfigs"),this.addConfigProp("styleSetterConfigs","Kekule.Editor.StyleSetterConfigs",void 0,{scope:e.PUBLIC})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setPropStoreFieldValue("chemSpaceConfigs",new Kekule.Editor.ChemSpaceConfigs),this.setPropStoreFieldValue("styleSetterConfigs",new Kekule.Editor.StyleSetterConfigs)}}),Kekule.ClassUtils.makeSingleton(Kekule.Editor.ChemSpaceEditorConfigs),Kekule.Editor.InteractionConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.Editor.InteractionConfigs",initProperties:function(){var t=Math.PI/180;this.addBoolConfigProp("enableTrackOnNearest",!0),this.addBoolConfigProp("enableHotTrack",!0),this.addBoolConfigProp("scrollToObjAfterLoading",!0),this.addBoolConfigProp("autoExpandClientSizeAfterLoading",!0),this.addBoolConfigProp("autoExpandClientSizeAfterManipulation",!1),this.addBoolConfigProp("autoSelectNewlyInsertedObjects",!1),this.addBoolConfigProp("autoSelectNewlyInsertedObjectsOnTouch",!0),this.addIntConfigProp("objBoundTrackMinInflation",5),this.addIntConfigProp("objBoundTrackMinInflationMouse",null),this.addIntConfigProp("objBoundTrackMinInflationPen",null),this.addIntConfigProp("objBoundTrackMinInflationTouch",10),this.addFloatConfigProp("objBoundTrackInflationRatio",.2),this.addFloatConfigProp("objBoundTrackInflationRatioMouse",null),this.addFloatConfigProp("objBoundTrackInflationRatioPen",null),this.addFloatConfigProp("objBoundTrackInflationRatioTouch",.33),this.addBoolConfigProp("enablePartialAreaSelecting",!1),this.addFloatConfigProp("selectingBrushWidth",12),this.addBoolConfigProp("enableOffSelectionManipulation",!0),this.addIntConfigProp("offSelectionManipulationActivatingTimeThreshold",800),this.addFloatConfigProp("unmovePointerDistanceThreshold",5,{scope:e.PUBLIC}),this.addIntConfigProp("selectingCurveSimplificationDistanceThreshold",2,{scope:e.PUBLIC}),this.addIntConfigProp("selectionMarkerInflation",5),this.addIntConfigProp("selectionMarkerEdgeInflation",5),this.addIntConfigProp("selectionMarkerDefPulseDuration",500),this.addIntConfigProp("selectionMarkerDefPulseCount",2),this.addBoolConfigProp("followPointerCoordOnDirectManipulatingSingleObj",!0),this.addIntConfigProp("followPointerCoordOnDirectManipulatingSingleObjDistanceThreshold",2),this.addFloatConfigProp("constrainedResizeStep",.125),this.addIntConfigProp("rotationRegionInflation",10),this.addFloatConfigProp("constrainedRotateStep",7.5*t),this.addIntConfigProp("rotationLocationPointDistanceThreshold",10),this.addIntConfigProp("directedMoveDistanceThreshold",10),this.addBoolConfigProp("enableMergePreview",!0),this.addBoolConfigProp("enableGestureManipulation",!0),this.addBoolConfigProp("enableGestureZoomOnEditor",!0),this.addBoolConfigProp("enableHotKey",!0),this.addIntConfigProp("clonedObjectScreenOffset",10),this.addIntConfigProp("atomSetterFontSize",14),this.addBoolConfigProp("allowUnknownAtomSymbol",!0),this.addBoolConfigProp("enableBondKekulizeHucklize",!0),this.addIntConfigProp("trackSimplifierDistanceThreshold",8),this.addIntConfigProp("trackSimplifierIgnoreSegmentThreshold",10),this.addIntConfigProp("trackMergeDistanceThreshold",20),this.addFloatConfigProp("trackOptimizationAngleConstraint",30*t),this.addConfigProp("trackOptimizationDistanceConstraints",DataType.ARRAY,void 0,{scope:e.PUBLIC}),this.addIntConfigProp("trackOptimizationPrimaryDistanceConstraint",1),this.addFloatConfigProp("trackTouchRefLength",.5,{scope:e.PUBLIC}),this.addBoolConfigProp("autoAdjustZoomLevelOnTrackTouching",!1,{scope:e.PUBLIC}),this.addFloatConfigProp("editorInitialZoom",1.5)},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setTrackOptimizationDistanceConstraints([.5,1,3,4,5])}}),Kekule.Editor.UiMarkerConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.Editor.UiMarkerConfigs",initProperties:function(){this.addStrConfigProp("hotTrackerColor","#0000FF"),this.addFloatConfigProp("hotTrackerOpacity",.5),this.addStrConfigProp("selectionMarkerStrokeColor","#0000FF"),this.addFloatConfigProp("selectionMarkerStrokeWidth",2),this.addStrConfigProp("selectionMarkerFillColor","#0000FF"),this.addFloatConfigProp("selectionMarkerOpacity",.2),this.addFloatConfigProp("selectionMarkerEmphasisOpacity",.4),this.addFloatConfigProp("selectionTransformMarkerSize",8,{scope:e.PUBLIC}),this.addFloatConfigProp("selectionTransformMarkerOpacity",.4,{scope:e.PUBLIC}),this.addStrConfigProp("selectingMarkerStrokeColor","#000000"),this.addFloatConfigProp("selectingMarkerStrokeWidth",1),this.addStrConfigProp("selectingMarkerStrokeDash",!0),this.addStrConfigProp("selectingMarkerFillColor",null),this.addFloatConfigProp("selectingMarkerOpacity",.7),this.addStrConfigProp("selectingBrushMarkerStrokeColor","#0000FF"),this.addStrConfigProp("selectingBrushMarkerStrokeDash",!1),this.addFloatConfigProp("selectingBrushMarkerStrokeLineCap","round"),this.addFloatConfigProp("selectingBrushMarkerStrokeLineJoin","round"),this.addFloatConfigProp("selectingBrushMarkerOpacity",.3),this.addStrConfigProp("trackMarkerStrokeColor","#0000AA"),this.addFloatConfigProp("trackMarkerStrokeWidth",2),this.addStrConfigProp("trackMarkerStrokeDash",!1),this.addFloatConfigProp("trackMarkerOpacity",.5),this.addHashConfigProp("issueCheckMarkerColors",{error:{strokeColor:"#FF0000",fillColor:null,activeStrokeColor:"#FF0000",activeFillColor:"#FF6666"},warning:{strokeColor:"#f1a200",fillColor:null,activeStrokeColor:"#f1a200",activeFillColor:"#ffdb15"},note:{strokeColor:"#00b0f0",fillColor:null,activeStrokeColor:"#007ca8",activeFillColor:"#00b0f0"},log:{strokeColor:"#00b0f0",fillColor:null,activeStrokeColor:"#007ca8",activeFillColor:"#00b0f0"}}),this.addFloatConfigProp("issueCheckMarkerStrokeWidth",2),this.addFloatConfigProp("issueCheckActiveMarkerStrokeWidth",2),this.addStrConfigProp("issueCheckMarkerOpacity",.3),this.addStrConfigProp("issueCheckActiveMarkerOpacity",.4),this.addStrConfigProp("flexStructureAssocMarkerColor","#0000AA"),this.addFloatConfigProp("flexStructureAssocMarkerOpacity",.5),this.addIntConfigProp("flexStructureAssocMarkerFontSize",14),this.addStrConfigProp("flexStructureAssocMarkerFontFamily","Arial, Helvetica, sans-serif")}}),Kekule.Editor.StructureConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.Editor.StructureConfigs",initProperties:function(){this.addStrConfigProp("defBondType",Kekule.BondType.DEFAULT,{enumSource:Kekule.BondType}),this.addIntConfigProp("defBondOrder",Kekule.BondOrder.SINGLE,{enumSource:Kekule.BondOrder}),this.addFloatConfigProp("defBondLength",.8),this.addConfigProp("defBondAngles",DataType.ARRAY,void 0,{scope:e.PUBLIC}),this.addFloatConfigProp("bondConstrainedDirectionDelta",void 0,{scope:e.PUBLIC}),this.addConfigProp("bondConstrainedDirectionAngles",DataType.ARRAY,void 0,{scope:e.PUBLIC}),this.addFloatConfigProp("bondConstrainedDirectionAngleThreshold",void 0,{scope:e.PUBLIC}),this.addFloatConfigProp("initialBondDirection",void 0,{scope:e.PUBLIC}),this.addStrConfigProp("defIsotopeId","C"),this.addConfigProp("primaryOrgChemAtoms",DataType.ARRAY,void 0,{scope:e.PUBLIC}),this.addIntConfigProp("maxFlexChainAtomCount",0),this.addIntConfigProp("minFlexRingAtomCount",3),this.addIntConfigProp("maxFlexRingAtomCount",18),this.addHashConfigProp("enabledNonAtomNodeTypes",{RGroup:!0,pseudoatomDummy:!0,pseudoatomHetero:!0,pseudoatomAny:!0,variableAtomList:!0,variableAtomNotList:!0}),this.addHashConfigProp("enabledBondForms",{single:!0,double:!0,triple:!0,quad:!0,explicitAromatic:!0,up:!0,upInverted:!0,down:!0,downInverted:!0,upOrDown:!0,eOrZ:!0,closer:!0,ionic:!1,coordinate:!1,metallic:!1,hydrogen:!0})},initPropValues:function(){this.tryApplySuper("initPropValues");var e=Math.PI/180,t=[],o=Kekule.BondOrder,r=2*Math.PI/3;t[0]=r,t[o.EXPLICIT_AROMATIC]=[r],t[o.TRIPLE]=[Math.PI],t[o.DOUBLE]=[r],t[o.DOUBLE][o.DOUBLE]=Math.PI,t[o.SINGLE]=[r],this.setDefBondAngles(t),this.setBondConstrainedDirectionDelta(10*Math.PI/180),this.setBondConstrainedDirectionAngles([0,90*e,180*e,270*e]),this.setBondConstrainedDirectionAngleThreshold(3*e),this.setInitialBondDirection(30*e),this.setPrimaryOrgChemAtoms(["C","H","O","N","P","S","F","Cl","Br","I","Si","D","C13"])},getDefAngleOfBonds:function(e,t){var o=e||0,r=t||0;o>r&&(o=t||0,r=e||0);var i=this.getDefBondAngles(),n=i[r];return n?n[o]||n[0]:i[0]},getNewBondDefAngle:function(e,t){var o;Kekule.ObjUtils.isUnset(t)&&(t=this.getDefBondOrder());var r=Kekule.Editor.StructureUtils.getSurroundingObjs(e);if(1===r.length){var i=e.getLinkedConnectorAt(0);if(i&&i.getConnectedObjs().indexOf(r[0])>=0){var n=i.getBondOrder?i.getBondOrder():null;Kekule.ObjUtils.notUnset(n)&&(o=this.getDefAngleOfBonds(t,n))}}else o=0===r.length?this.getInitialBondDirection():this.getDefAngleOfBonds(t,0);return o}}),Kekule.Editor.ChemSpaceConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.Editor.ChemSpaceConfigs",initProperties:function(){this.addHashConfigProp("defScreenSize2D"),this.addHashConfigProp("defScreenSize3D"),this.addHashConfigProp("autoExpandScreenSize2D"),this.addHashConfigProp("autoExpandScreenSize3D"),this.addNumConfigProp("defPadding",50)},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setDefScreenSize2D({x:900,y:1500}),this.setDefScreenSize3D({x:600,y:600,z:600}),this.setAutoExpandScreenSize2D({x:200,y:200}),this.setAutoExpandScreenSize3D({x:100,y:100,z:100})}}),Kekule.Editor.StyleSetterConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.Editor.StyleSetterConfigs",initProperties:function(){this.defineProp("listedFontSizes",{dataType:DataType.ARRAY}),this.defineProp("listedFontNames",{dataType:DataType.ARRAY})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setListedFontSizes([8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,66,72,80,88,96]),this.setListedFontNames(Kekule.Widget.FontEnumerator.getAvailableFontFamilies())}}),Kekule.Editor.HotKeyConfigs=Class.create(Kekule.AbstractConfigs,{CLASS_NAME:"Kekule.Editor.HotKeyConfigs",initProperties:function(){this.defineProp("hotKeys",{dataType:DataType.ARRAY})},initPropValues:function(){var e=Kekule.ChemWidget.ComponentWidgetNames;this.tryApplySuper("initPropValues"),this.setHotKeys([{key:"c",action:"atom_C"},{key:"h",action:"atom_H"},{key:"o",action:"atom_O"},{key:"n",action:"atom_N"},{key:"p",action:"atom_P"},{key:"s",action:"atom_S"},{key:"f",action:"atom_F"},{key:"Shift+C",action:"atom_Cl"},{key:"b",action:"atom_Br"},{key:"i",action:"atom_I"},{key:"Shift+B",action:"atom_B"},{key:"k",action:"atom_K"},{key:"Shift+N",action:"atom_Na"},{key:"d",action:"atom_D"},{key:"m",action:"subgroup_methyl"},{key:"e",action:"subgroup_ethyl"},{key:"t",action:"subgroup_TMS"},{key:"Shift+P",action:"subgroup_phenyl"},{key:"Shift+T",action:"subgroup_OTs"},{key:"Shift+E",action:"subgroup_COOCH3"},{key:"a",action:"atom_any"},{key:"q",action:"atom_hetero"},{key:"l",action:"atom_variable"},{key:"r",action:"subgroup_R"},{key:"1",action:"bond_single"},{key:"2",action:"bond_double"},{key:"3",action:"bond_triple"},{key:"4",action:"bond_quad"},{key:"b",action:"bond_closer"},{key:"w",action:"bond_up"},{key:"h",action:"bond_down"},{key:"Shift+W",action:"bond_down"},{key:"y",action:"bond_upOrDown"},{key:"Ctrl+A",action:e.selectAll},{key:"Ctrl+C",action:e.copy},{key:"Ctrl+X",action:e.cut},{key:"Ctrl+V",action:e.paste},{key:"Ctrl+Z",action:e.undo},{key:"Ctrl+Shift+Z",action:e.redo},{key:"+",action:e.zoomIn},{key:"-",action:e.zoomOut}])}})}(),Kekule.Editor.RepositoryData={subGroups:[{name:"methyl",inputTexts:["Me","CH3"],dataFormat:"Kekule-JSON",structData:'{"id":null,"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Thu, 15 Sep 2016 15:49:02 GMT"},"__type__":"object"},"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[],"connectors":[],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Me","__type__":"Kekule.SubGroup"}'},{name:"ethyl",inputTexts:["Et","C2H5"],structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34641016151377535,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Et","__type__":"Kekule.SubGroup"}'},{name:"n-propyl",inputTexts:["n-Pr","nPr","C3H7"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"n-Pr","formulaText":"C3H7","__type__":"Kekule.SubGroup"}'},{name:"i-propyl",inputTexts:["i-Pr","iPr"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":-0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[1],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"i-Pr","__type__":"Kekule.SubGroup"}'},{name:"n-butyl",inputTexts:["n-Bu","nBu","C4H9"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-1.039230484541326,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":-0.34641016151377535,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":1.039230484541326,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"n-Bu","formulaText":"C4H9","__type__":"Kekule.SubGroup"}'},{name:"i-butyl",inputTexts:["i-Bu","iBu"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.6928203230275507,"y":-0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":0,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":0.6928203230275507,"y":-0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"i-Bu","__type__":"Kekule.SubGroup"}'},{name:"s-butyl",inputTexts:["s-Bu","sBu"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":-1.039230484541326,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34641016151377535,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":1.039230484541326,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[1],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"s-Bu","__type__":"Kekule.SubGroup"}'},{name:"t-butyl",inputTexts:["t-Bu","tBu"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.3999999999999915,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":7.105427357601002e-15,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":7.105427357601002e-15,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"t-Bu","__type__":"Kekule.SubGroup"}'},{name:"phenyl",inputTexts:["Ph","C6H5"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":8.881784197001252e-16,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275516,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275516,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":8.881784197001252e-16,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275516,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275516,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","id":null,"overrideRenderOptionItems":[],"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[3,4]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[5,0]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Ph","formulaText":"C6H5","__type__":"Kekule.SubGroup"}'},{name:"benzyl",inputTexts:["Bn"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":8.881784197001252e-16,"y":-1.1999999999999957,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275516,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275516,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":8.881784197001252e-16,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275516,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275516,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":8.881784197001252e-16,"y":1.1999999999999957,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[6],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","id":null,"overrideRenderOptionItems":[],"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[3,4]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[5,0]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,6]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Bn","__type__":"Kekule.SubGroup"}'},{name:"benzoyl",inputTexts:["Bz"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":8.881784197001252e-16,"y":-1.399999999999995,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275516,"y":-0.9999999999999964,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275516,"y":-0.1999999999999993,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":8.881784197001252e-16,"y":0.1999999999999993,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275516,"y":-0.1999999999999993,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275516,"y":-0.9999999999999964,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":8.881784197001252e-16,"y":0.9999999999999964,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275498,"y":1.399999999999995,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[6],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","id":null,"overrideRenderOptionItems":[],"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[3,4]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[5,0]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,6]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[6,7]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Bz","__type__":"Kekule.SubGroup"}'},{inputTexts:["CF3"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"F"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"F"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.3999999999999915,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"F"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CF3","__type__":"Kekule.SubGroup"}'},{inputTexts:["CCl3"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Cl"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Cl"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.3999999999999915,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Cl"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CCl3","__type__":"Kekule.SubGroup"}'},{inputTexts:["CBr3"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Br"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Br"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.3999999999999915,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Br"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CBr3","__type__":"Kekule.SubGroup"}'},{inputTexts:["CI3"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"I"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"I"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.3999999999999915,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"I"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CI3","__type__":"Kekule.SubGroup"}'},{inputTexts:["OMe","OCH3"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"OMe","__type__":"Kekule.SubGroup"}'},{inputTexts:["OEt","OC2H5"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"OEt","__type__":"Kekule.SubGroup"}'},{inputTexts:["Ot-Bu","OtBu"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275525,"y":-0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-1.7763568394002505e-15,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275454,"y":0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275525,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":1.7763568394002505e-15,"y":0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,4]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Ot-Bu","__type__":"Kekule.SubGroup"}'},{inputTexts:["CO"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CO","__type__":"Kekule.SubGroup"}'},{inputTexts:["CHO"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CHO","__type__":"Kekule.SubGroup"}'},{name:"carboxyl",inputTexts:["COOH","CO2H"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.34641016151377535,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COOH","__type__":"Kekule.SubGroup"}'},{inputTexts:["COOOH","CO3H","CO2OH"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CO3H","__type__":"Kekule.SubGroup"}'},{inputTexts:["COONa"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.6928203230275507,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":-0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Na"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COONa","__type__":"Kekule.SubGroup"}'},{inputTexts:["COOK"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.6928203230275507,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":-0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"K"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COOK","__type__":"Kekule.SubGroup"}'},{inputTexts:["COOCH3","COOMe"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COOMe","__type__":"Kekule.SubGroup"}'},{inputTexts:["COOC2H5","COOEt"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-1.039230484541326,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-1.039230484541326,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.34641016151377535,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":1.039230484541326,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,4]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COOEt","__type__":"Kekule.SubGroup"}'},{inputTexts:["COCl"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.34641016151377535,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Cl"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COCl","__type__":"Kekule.SubGroup"}'},{inputTexts:["COBr"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.34641016151377535,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Br"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COBr","__type__":"Kekule.SubGroup"}'},{inputTexts:["CONH2"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.34641016151377535,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CONH2","__type__":"Kekule.SubGroup"}'},{inputTexts:["Ac"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.34641016151377535,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Ac","__type__":"Kekule.SubGroup"}'},{inputTexts:["OAc"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":-0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[3],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"OAc","__type__":"Kekule.SubGroup"}'},{inputTexts:["MeCO","COMe"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0.34641016151377535,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.3464101615137771,"y":0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.3464101615137771,"y":-0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COMe","__type__":"Kekule.SubGroup"}'},{inputTexts:["EtCO","COEt"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0.6928203230275507,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275525,"y":0.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-1.7763568394002505e-15,"y":-0.5999999999999943,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":-0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"COEt","__type__":"Kekule.SubGroup"}'},{name:"hydroxymethyl",inputTexts:["CH2OH"],dataFormat:"Kekule-JSON",structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.3999999999999986,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.3999999999999968,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CH2OH","__type__":"Kekule.SubGroup"}'},{inputTexts:["NMe2"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[1],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"NMe2","__type__":"Kekule.SubGroup"}'},{name:"nitro",inputTexts:["NO2"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275507,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[1],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[1,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"NO2","__type__":"Kekule.SubGroup"}'},{name:"nitroso",inputTexts:["NO"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":-0.34641016151377535,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[1,0]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"NO","__type__":"Kekule.SubGroup"}'},{name:"diazo",inputTexts:["N2","NN","N2 +"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.3999999999999986,"y":0,"__type__":"object"},"charge":1,"radical":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.3999999999999986,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":3,"electronCount":6,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"N2 +","__type__":"Kekule.SubGroup"}'},{inputTexts:["N2Cl","NNCl","N2 +Cl-"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":1.7763568394002505e-15,"y":0,"__type__":"object"},"charge":1,"radical":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.7999999999999989,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.7999999999999989,"y":0,"__type__":"object"},"charge":-1,"radical":0,"parity":null,"isotopeId":"Cl"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":3,"electronCount":6,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"ionic","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"N2 +Cl-","__type__":"Kekule.SubGroup"}'},{inputTexts:["N2Br","NNBr","N2 +Br-"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":1.7763568394002505e-15,"y":0,"__type__":"object"},"charge":1,"radical":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.7999999999999989,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.7999999999999989,"y":0,"__type__":"object"},"charge":-1,"radical":0,"parity":null,"isotopeId":"Br"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":3,"electronCount":6,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"ionic","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"N2 +Br-","__type__":"Kekule.SubGroup"}'},{name:"nitrile group",inputTexts:["CN"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[],"coord2D":{"x":-0.34641016151377535,"y":0.19999999999999574,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.34641016151377535,"y":-0.20000000000000284,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":3,"electronCount":6,"isInAromaticRing":false,"connectedObjs":[1,0]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"CN","__type__":"Kekule.SubGroup"}'},{name:"pyridyl",inputTexts:["Py"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-8.881784197001252e-16,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"N"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275498,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.6928203230275498,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-8.881784197001252e-16,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275498,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.6928203230275498,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[3,4]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[5,0]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"Py","__type__":"Kekule.SubGroup"}'},{name:"sulfonic group",inputTexts:["SO3H"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.40000000000000213,"y":7.105427357601002e-15,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"S"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.40000000000000213,"y":0.8000000000000043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.399999999999995,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"SO3H","__type__":"Kekule.SubGroup"}'},{inputTexts:["SO2Cl"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"S"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.40000000000000036,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.40000000000000036,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Cl"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"SO2Cl","__type__":"Kekule.SubGroup"}'},{inputTexts:["SO2Br"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"S"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.40000000000000036,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":-0.40000000000000036,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Br"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","id":null,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"SO2Br","__type__":"Kekule.SubGroup"}'},{inputTexts:["TMS"],dataFormat:"Kekule-JSON",structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Si"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.40000000000000036,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.40000000000000036,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,3]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"TMS","__type__":"Kekule.SubGroup"}'},{inputTexts:["OTMS"],dataFormat:"Kekule-JSON",structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.6928203230275507,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Si"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.6928203230275507,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,4]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"OTMS","__type__":"Kekule.SubGroup"}'},{name:"OTs",inputTexts:["OTs","OTS"],dataFormat:"Kekule-JSON",structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":1.7763568394002505e-15,"y":0.1999999999999993,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.6928203230275525,"y":0.5999999999999979,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.6928203230275525,"y":1.399999999999988,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":1.7763568394002505e-15,"y":1.7999999999999936,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.6928203230275507,"y":1.399999999999988,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.6928203230275507,"y":0.5999999999999979,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":1.7763568394002505e-15,"y":-0.5999999999999979,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"S"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.7999999999999989,"y":-0.5999999999999979,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.7999999999999989,"y":-0.5999999999999979,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":1.7763568394002505e-15,"y":-1.399999999999995,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"O"},{"__type__":"Kekule.SubGroup","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.6928203230275525,"y":-1.7999999999999936,"__type__":"object"},"charge":0,"parity":null}],"anchorNodes":[3],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,4]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,0]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,6]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[6,7]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"bondType":"covalent","bondOrder":2,"electronCount":4,"isInAromaticRing":false,"connectedObjs":[6,8]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[6,9]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[9,10]}],"__type__":"Kekule.StructureConnectionTable"},"abbr":"OTs","__type__":"Kekule.SubGroup"}'},{inputTexts:["MgCl"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Mg"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Cl"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"MgCl","__type__":"Kekule.SubGroup"}'},{inputTexts:["MgBr"],dataFormat:"Kekule-JSON",structData:'{"id":null,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","id":null,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Mg"},{"__type__":"Kekule.Atom","id":null,"coord2D":{"x":0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"Br"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","id":null,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"formulaText":"MgBr","__type__":"Kekule.SubGroup"}'}],fragments:[{name:"methane",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Sat, 25 Feb 2017 04:21:08 GMT"},"__type__":"object"},"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[0],"connectors":[],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-1","__type__":"Kekule.Molecule"}'},{name:"fischer1",dataFormat:"Kekule-JSON",structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.8000000000000007,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":0,"y":0.8000000000000043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.7999999999999989,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":1.7763568394002505e-15,"y":-0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[2],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,4]}],"__type__":"Kekule.StructureConnectionTable"},"__type__":"Kekule.Molecule"}'},{name:"fischer2",dataFormat:"Kekule-JSON",structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.7999999999999972,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-1.7763568394002505e-15,"y":1.2000000000000028,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.7999999999999989,"y":0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":-1.2000000000000028,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.8000000000000007,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.8000000000000007,"y":-0.3999999999999986,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[2],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,4]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,6]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,7]}],"__type__":"Kekule.StructureConnectionTable"},"__type__":"Kekule.Molecule"}'},{name:"fischer3",dataFormat:"Kekule-JSON",structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.7999999999999972,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-1.7763568394002505e-15,"y":1.6000000000000014,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.7999999999999989,"y":0.7999999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":-0.8000000000000043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.8000000000000007,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.8000000000000007,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0.7999999999999972,"y":-0.8000000000000043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":-1.6000000000000085,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.8000000000000007,"y":-0.8000000000000043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[2],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,4]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,6]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,7]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,8]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,9]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,10]}],"__type__":"Kekule.StructureConnectionTable"},"__type__":"Kekule.Molecule"}'},{name:"sawhorseStaggered",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:51:35 GMT"},"__type__":"object"},"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":0.34060000000000024,"y":-0.642199999999999,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":1,"coord2D":{"x":-0.37219999999999764,"y":-1.0575999999999972,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-1.0877999999999997,"y":-0.648899999999994,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.3686000000000007,"y":-1.8829999999999991,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.34060000000000024,"y":0.6422000000000061,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":1.0877999999999997,"y":0.6489000000000011,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":0.3686000000000007,"y":1.8829999999999991,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null,null],"zIndex2D":0,"coord2D":{"x":0.3722000000000012,"y":1.0576000000000043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[6],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,7]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[7,4]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[7,5]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[6,7]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-6","__type__":"Kekule.Molecule"}'},{name:"sawhorseEclipsed",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:50:51 GMT"},"__type__":"object"},"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.3022000000000009,"y":0.4405000000000001,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":0.4229000000000003,"y":0.8340999999999994,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":1.1265,"y":0.4025999999999996,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null,null],"coord2D":{"x":0.44500000000000206,"y":1.657899999999998,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-1.1265,"y":-1.6214000000000084,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":1,"coord2D":{"x":-0.4015000000000004,"y":-1.2276999999999987,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":0.3013999999999992,"y":-1.657899999999998,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"coord2D":{"x":-0.38010000000000055,"y":-0.4025999999999996,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[3],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,6]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,7]},{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,5]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-5","__type__":"Kekule.Molecule"}'},{name:"cyclohexaneChair1",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:43:26 GMT"},"__type__":"object"},"attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":-0.5715736151962387,"y":0.3463377359594517,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":-0.9715297072546738,"y":-0.3463377359594517,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":-0.20235354281841378,"y":-0.12653156366939555,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":0.5714766561436155,"y":-0.3463377359594517,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":0.9715297072546738,"y":0.3463377359594517,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":0.20225658376579414,"y":0.1266285227220152,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[1],"connectors":[{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,4]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,0]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-1","__type__":"Kekule.Molecule"}'},{name:"cyclohexaneChair2",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:44:10 GMT"},"__type__":"object"},"attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":-0.9716412105880998,"y":0.3464120575127936,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":-0.5715992908679759,"y":-0.3464120575127936,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":0.20239696641355032,"y":-0.14362717166194017,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":0.9716412105880998,"y":-0.3464120575127936,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":0.571696270727303,"y":0.3464120575127936,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":-0.20239696641355032,"y":0.14372415152126905,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[3],"connectors":[{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,4]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[5,0]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-2","__type__":"Kekule.Molecule"}'},{name:"cyclohexaneHaworth1",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:47:35 GMT"},"__type__":"object"},"attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":0.47495070097202685,"y":0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":-0.4999174283497734,"y":0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":0,"coord2D":{"x":1.1228227044047205,"y":-0.002525816777513512,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":-1.1228227044047205,"y":-0.002525816777513512,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":0.47495070097202685,"y":-0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":-0.4999174283497734,"y":-0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[3],"connectors":[{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,4]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,5]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[4,5]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-3","__type__":"Kekule.Molecule"}'},{name:"cyclohexaneHaworth2",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:47:08 GMT"},"__type__":"object"},"attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":0.47495070097202685,"y":0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":-0.49991742834977515,"y":0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":0,"coord2D":{"x":1.1228227044047205,"y":-0.002525816777513512,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":-1.1228227044047205,"y":-0.002525816777513512,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":1,"coord2D":{"x":0.47495070097202685,"y":-0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":-0.49991742834977515,"y":-0.4693161866221871,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[3],"connectors":[{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"stereo":1,"isInAromaticRing":false,"connectedObjs":[2,4]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"stereo":1,"isInAromaticRing":false,"connectedObjs":[3,5]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"stereo":10,"isInAromaticRing":false,"connectedObjs":[4,5]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-3","__type__":"Kekule.Molecule"}'},{name:"cyclopentaneHaworth1",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:48:11 GMT"},"__type__":"object"},"attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":0.48039814732735664,"y":0.23639868521610907,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":-0.4815600495278858,"y":0.23639868521610907,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":0,"coord2D":{"x":0.7788133624967433,"y":-0.05620701895063007,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":-0.7788133624967433,"y":-0.05620701895063007,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":0.0006293636919529888,"y":-0.23639868521610907,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[3],"connectors":[{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,2]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,3]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[2,4]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[3,4]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-4","__type__":"Kekule.Molecule"}'},{name:"cyclopentaneHaworth2",dataFormat:"Kekule-JSON",structData:'{"info":{"generator":"ChemDraw","date":{"__type__":"date","date":"Tue, 17 Jan 2017 12:48:04 GMT"},"__type__":"object"},"attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":-1,"coord2D":{"x":0.4804171472781027,"y":0.23640551451237002,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":-1,"coord2D":{"x":-0.48158784071773564,"y":0.23640551451237002,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[null],"zIndex2D":0,"coord2D":{"x":-0.7788490794655241,"y":-0.05617585542339043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":1,"coord2D":{"x":0.0005848625620670234,"y":-0.23640551451237002,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Atom","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"overrideRenderOptionItems":[],"zIndex2D":0,"coord2D":{"x":0.7788490794655241,"y":-0.05617585542339043,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"}],"anchorNodes":[2],"connectors":[{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[1,2]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"stereo":1,"isInAromaticRing":false,"connectedObjs":[2,3]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"stereo":1,"isInAromaticRing":false,"connectedObjs":[4,3]},{"__type__":"Kekule.Bond","attachedMarkers":[],"coordPos2D":0,"coordPos3D":0,"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,4]}],"__type__":"Kekule.StructureConnectionTable"},"name":"Untitled Document-4","__type__":"Kekule.Molecule"}'},{name:"substituentMark",dataFormat:"Kekule-JSON",scale:.7,structData:'{"coordPos2D":0,"coordPos3D":0,"coord2D":{"x":0,"y":0,"__type__":"object"},"charge":0,"parity":null,"ctab":{"nodes":[{"__type__":"Kekule.Atom","coordPos2D":0,"coordPos3D":0,"coord2D":{"x":-0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"isotopeId":"C"},{"__type__":"Kekule.Pseudoatom","coordPos2D":0,"coordPos3D":0,"renderOptions":{"nodeDisplayMode":-1,"__type__":"object"},"coord2D":{"x":0.40000000000000036,"y":0,"__type__":"object"},"charge":0,"parity":null,"atomType":"any","symbol":"A"}],"anchorNodes":[0],"connectors":[{"__type__":"Kekule.Bond","coordPos2D":0,"coordPos3D":0,"renderOptions":{"opacity":0.5,"__type__":"object"},"parity":null,"bondType":"covalent","bondOrder":1,"electronCount":2,"isInAromaticRing":false,"connectedObjs":[0,1]}],"__type__":"Kekule.StructureConnectionTable"},"__type__":"Kekule.Molecule"}'}]},function(){"use strict";Kekule.Editor.AbstractRepositoryItem=Class.create(ObjectEx,{CLASS_NAME:"Kekule.Editor.AbstractRepositoryItem",initialize:function(){this.tryApplySuper("initialize")},initProperties:function(){this.defineProp("name",{dataType:DataType.STRING})},getAvailableCoordModes:function(){return[]},createObjects:function(e,t){},getScale:function(){return this.doGetScale()||1},doGetScale:function(){return 1},getRefLength:function(){return this.doGetRefLength()/(this.getScale()||1)},doGetRefLength:function(){},isOneStructureFragmentObj:function(){return!1}}),Kekule.Editor.MolRepositoryItem2D=Class.create(Kekule.Editor.AbstractRepositoryItem,{CLASS_NAME:"Kekule.Editor.MolRepositoryItem2D",initialize:function(){this.tryApplySuper("initialize")},initProperties:function(){this.defineProp("molScale",{dataType:DataType.FLOAT}),this.defineProp("molManipulationCenterCoord",{dataType:DataType.HASH}),this.defineProp("molManipulationDefDirectionCoord",{dataType:DataType.HASH})},doGetScale:function(){return this.getMolScale()||this.tryApplySuper("doGetScale")},getAvailableCoordModes:function(){return Kekule.CoordMode.COORD2D},isOneStructureFragmentObj:function(){return!0},createObjects:function(e,t){var o=this.doCreateObjects(e,t);if(!o)return null;var r=null,i=null,n={x:0,y:0};return e&&(r=e instanceof Kekule.ChemStructureNode?this.doGetMergableNode(o,e):e instanceof Kekule.ChemStructureConnector?this.doGetMergableConnector(o,e):null)&&(i=e,n=r.getAbsBaseCoord2D()),{objects:[o],mergeObj:r,mergeDest:i,baseObjCoord:n,centerCoord:{x:0,y:0}}},doCreateObjects:function(e,t){return null},doGetMergableNode:function(e,t){return null},doGetMergableConnector:function(e,t){return null}}),Kekule.Editor.StoredStructFragmentRepositoryItem2D=Class.create(Kekule.Editor.MolRepositoryItem2D,{CLASS_NAME:"Kekule.Editor.StoredStructFragmentRepositoryItem2D",initialize:function(e,t,o){this.tryApplySuper("initialize"),this.beginUpdate();try{t&&this.setDataFormat(t),e&&this.setStructData(e),o&&this.setMolScale(o)}finally{this.endUpdate()}},initProperties:function(){this.defineProp("structureFragment",{dataType:"Kekule.StructureFragment",setter:null,serializable:!1}),this.defineProp("structData",{dataType:DataType.STRING}),this.defineProp("dataFormat",{dataType:DataType.STRING})},objectChange:function(e){if(this.tryApplySuper("objectChange",[e]),e.indexOf("structData")>=0||e.indexOf("dataFormat")>=0){var t=null;this.getStructData()&&(t=this._createTemplateStructFragment()),this.setPropStoreFieldValue("structureFragment",t)}},_createTemplateStructFragment:function(){var e=null;return this.getStructData()&&(e=Kekule.IO.loadFormatData(this.getStructData(),this.getDataFormat()||Kekule.IO.DataFormat.KEKULE_JSON)),e&&this._adjustTemplateStructureFragmentCoords(e),e},_adjustTemplateStructureFragmentCoords:function(e){e.setCoord2D({x:0,y:0});var t=Kekule.Render.ObjUtils.getContainerBox(e,Kekule.CoordMode.COORD2D,!0);if(t){e.getCoordOfMode&&e.getCoordOfMode(Kekule.CoordMode.COORD2D,!0);var o={};o.x=-(t.x2+t.x1)/2,o.y=-(t.y2+t.y1)/2,e.beginUpdate();try{for(var r=0,i=e.getNodeCount();r<i;++r){var n=e.getNodeAt(r),a=n.getCoord2D(!0);a=Kekule.CoordUtils.add(a,o),n.setCoord2D(a)}}finally{e.endUpdate()}}},doGetRefLength:function(){var e=this.getStructureFragment();return e?e.getConnectorLengthMedian(Kekule.CoordMode.COORD2D,!0):0},doCreateObjects:function(e,t){var o=this.getStructureFragment();return o?o.clone():null},doGetMergableNode:function(e,t){return e.getAnchorNodeAt(0)||e.getNodeAt(0)},doGetMergableConnector:function(e,t){return null}}),Kekule.Editor.StoredSubgroupRepositoryItem2D=Class.create(Kekule.Editor.StoredStructFragmentRepositoryItem2D,{CLASS_NAME:"Kekule.Editor.StoredSubgroupRepositoryItem2D",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,t,o])},initProperties:function(){this.defineProp("inputTexts",{dataType:DataType.STRING})},doCreateObjects:function(e,t){var o=this.getStructureFragment();if(o){var r=new Kekule.SubGroup;return r.assign(o,!1),r}return null},createObjects:function(e){return this.tryApplySuper("createObjects",[e])},_adjustTemplateStructureFragmentCoords:function(e){e.setCoord2D({x:0,y:0});var t=e.getCurrConnectableObj();if(t){var o=Kekule.CoordUtils.substract({x:0,y:0},t.getCoord2D(!0));e.beginUpdate();try{for(var r=0,i=e.getNodeCount();r<i;++r){var n=e.getNodeAt(r),a=n.getCoord2D(!0);a=Kekule.CoordUtils.add(a,o),n.setCoord2D(a)}}finally{e.endUpdate()}}}}),Kekule.Editor.StoredSubgroupRepositoryItem2D.getRepItemOfInputText=function(e){for(var t=Kekule.Editor.RepositoryItemManager.getAllItems(Kekule.Editor.StoredSubgroupRepositoryItem2D)||[],o=0,r=t.length;o<r;++o){var i=t[o];if((i.getInputTexts()||[]).indexOf(e)>=0)return i}return null},Kekule.Editor.StoredSubgroupRepositoryItem2D.getAllRepItems=function(){return Kekule.Editor.RepositoryItemManager.getAllItems(Kekule.Editor.StoredSubgroupRepositoryItem2D)||[]},Kekule.Editor.MolRingRepositoryItem2D=Class.create(Kekule.Editor.MolRepositoryItem2D,{CLASS_NAME:"Kekule.Editor.MolRingRepositoryItem2D",initialize:function(e,t){this.tryApplySuper("initialize"),this.setRingAtomCount(e),this.setBondLength(t||1)},initProperties:function(){this.defineProp("ringAtomCount",{dataType:DataType.INT}),this.defineProp("bondLength",{dataType:DataType.FLOAT,setter:function(e){e!==this.getBondLength()&&this.setPropStoreFieldValue("bondLength",e)}}),this.defineProp("isAromatic",{dataType:DataType.BOOL}),this.defineProp("enableCoordCache",{dataType:DataType.BOOL,setter:function(e){e!==this.getEnableCoordCache()&&(this.setPropStoreFieldValue("enableCoordCache",e),e&&!this._coordCache&&this._initCoordCache())}})},doGetRefLength:function(){return this.getBondLength()},doCreateObjects:function(e,t){var o=t&&t.originalStructFragment;return this.generateRing(o)},doGetMergableNode:function(e,t){return e.getNodeAt(0)},doGetMergableConnector:function(e,t){return e.getConnectorAt(0)},generateRing:function(e,t){var o;t||(t=Kekule.Molecule),o=e||new t;var r=this.getRingAtomCount();o.beginUpdate();try{o.setCoord2D({x:0,y:0});var i,n=o.getNodeCount();if(n>r)for(var a=n-1;a>=r;--a)o.removeNodeAt(a);for(a=o.getConnectorCount()-1;a>=0;--a)o.removeConnectorAt(a);i=this.getEnableCoordCache()&&this._hasCoordCache(r)?this._getCachedCoords(r):this._calcAtomCoords(r);var l,s,d,u=this.getBondLength();for(a=0;a<r;++a){var c=o.getNodeAt(a);c||(c=this._generateAtom(a),o.appendNode(c));var p=i[a];if(1!==u&&(p=Kekule.CoordUtils.multiply(p)),c.setCoord2D(p),0===a&&(d=c),l){var h=this._generateBond(s,a);o.appendConnector(h),h.appendConnectedObj(l),h.appendConnectedObj(c)}l=c,s=a}h=this._generateBond(r-1,0);o.appendConnector(h),h.appendConnectedObj(l),h.appendConnectedObj(d)}finally{o.endUpdate()}return o},_generateAtom:function(e){return new Kekule.Atom(null,"C")},_generateBond:function(e,t){var o=Kekule.BondOrder.SINGLE;return this.getIsAromatic()&&e%2&&(o=Kekule.BondOrder.DOUBLE),new Kekule.Bond(null,null,o)},_calcAtomCoords:function(e){for(var t=this.getEnableCoordCache(),o=Math.PI/e,r=2*o,i=.5/Math.sin(o),n=4===e||8===e?-Math.PI/2-r/2:-Math.PI/2,a=[],l=0;l<e;++l){var s={x:i*Math.cos(n),y:i*Math.sin(n)};a.push(s),t&&this._setCoordToCache(s,e,l),n+=r}return a},_initCoordCache:function(){this._coordCache=[];for(var e=3;e<13;++e)this._calcAtomCoords(e)},_clearCoordCache:function(){this._coordCache=[]},_setCoordToCache:function(e,t,o){var r=this._coordCache[t];r||(r=[],this._coordCache[t]=r),r[o]=e},_getCachedCoord:function(e,t){var o=this._coordCache[e];return o&&o[t]},_getCachedCoords:function(e){return this._coordCache[e]},_hasCoordCache:function(e){return!(!this._coordCache||!this._coordCache[e])}}),Kekule.Editor.MolChainRepositoryItem2D=Class.create(Kekule.Editor.MolRepositoryItem2D,{CLASS_NAME:"Kekule.Editor.MolChainRepositoryItem2D",STEP_X_INC:Math.cos(30/180*Math.PI),STEP_Y_INC:Math.sin(30/180*Math.PI),initialize:function(e,t){this.tryApplySuper("initialize"),this.setAtomCount(e),this.setBondLength(t||1)},initProperties:function(){this.defineProp("atomCount",{dataType:DataType.INT}),this.defineProp("bondLength",{dataType:DataType.FLOAT}),this.defineProp("negativeDirection",{dataType:DataType.BOOL}),this.defineProp("enableCoordCache",{dataType:DataType.BOOL,setter:function(e){e!==this.getEnableCoordCache()&&(this.setPropStoreFieldValue("enableCoordCache",e),e&&!this._coordCache&&this._initCoordCache())}})},doGetRefLength:function(){return this.getBondLength()},doCreateObjects:function(e,t){var o=t&&t.originalStructFragment;return this.generateChain(o)},doGetMergableNode:function(e,t){return e.getNodeAt(0)},doGetMergableConnector:function(e,t){return null},generateChain:function(e,t){t||(t=Kekule.Molecule);var o=e||new t,r=this.getAtomCount(),i=this.getBondLength()||1,n=this.getNegativeDirection();o.beginUpdate();try{o.setCoord2D({x:0,y:0});var a=o.getNodeCount();if(a>r)for(var l=a-1;l>=r;--l)o.removeNodeAt(l);var s,d,u=o.getConnectorCount();if(u>r-1)for(l=u-1;l>=r-1;--l)o.removeConnectorAt(l);l=0;for(var c=r;l<c;++l){s=p;var p,h=!1;(p=o.getNodeAt(l))||(p=this._generateAtom(l),h=!0);var g=this._getCachedCoord(l);g||(g=this._calcAtomCoord(l)),1!==i&&(g=Kekule.CoordUtils.multiply(g,i)),n&&(g={x:g.x,y:-g.y}),p.setCoord2D(g),h&&o.appendNode(p),s&&h&&(d=this._generateBond(l-1,l),o.appendConnector(d),d.appendConnectedObj(s),d.appendConnectedObj(p))}}finally{o.endUpdate()}return this.setMolManipulationCenterCoord({x:0,y:0}),this.setMolManipulationDefDirectionCoord({x:1,y:0}),o},_generateAtom:function(e){return new Kekule.Atom(null,"C")},_generateBond:function(e,t){var o=Kekule.BondOrder.SINGLE;return new Kekule.Bond(null,null,o)},_calcAtomSetCoords:function(e){var t=this.getEnableCoordCache(),o={x:1*this.STEP_X_INC,y:1*this.STEP_Y_INC},r=[],i={x:0,y:0};r.push(i),this._coordCache[0]=i;for(var n=1,a=e;n<a;++n)i={x:i.x+o.x,y:n%2?o.y:0},r.push(i),t&&(this._coordCache[n]=i);return r},_calcAtomCoord:function(e){var t={x:1*this.STEP_X_INC,y:1*this.STEP_Y_INC},o={x:t.x*e,y:e%2?t.y:0};return this._coordCache&&(this._coordCache[e]=o),o},_initCoordCache:function(){this._coordCache=[];this._calcAtomSetCoords(30)},_clearCoordCache:function(){this._coordCache=[]},_getCachedCoord:function(e){return this._coordCache&&this._coordCache[e]}}),Kekule.Editor.PathGlyphRepositoryItem2D=Class.create(Kekule.Editor.AbstractRepositoryItem,{CLASS_NAME:"Kekule.Editor.PathGlyphRepositoryItem2D",initialize:function(e,t,o){this.tryApplySuper("initialize"),this.setGlyphClass(e),this.setGlyphRefLength(t||1),this.setGlyphInitialParams(o)},initProperties:function(){this.defineProp("glyphRefLength",{dataType:DataType.FLOAT}),this.defineProp("glyphClass",{dataType:DataType.CLASS,serializable:!1}),this.defineProp("glyphInitialParams",{dataType:DataType.HASH})},getAvailableCoordModes:function(){return Kekule.CoordMode.COORD2D},doGetRefLength:function(){return this.getGlyphRefLength()},createObjects:function(e){var t={x:0,y:0};return{objects:[this.generateGlyph()],mergeObj:null,mergeDest:null,baseObjCoord:t,centerCoord:t}},generateGlyph:function(){return new(this.getGlyphClass())(null,this.getGlyphRefLength(),this.getGlyphInitialParams())}}),Kekule.Editor.RepositoryItemManager={_itemClassMap:new Kekule.MapEx(!0),_itemNameMap:new Kekule.MapEx(!0),getAllItems:function(t){return e._itemClassMap.get(t)},getItem:function(t){return e._itemNameMap.get(t)},register:function(t){var o,r=t.getName();r&&(o=e.getItem(),e._itemNameMap.set(r,t));var i=t.getClass(),n=e.getAllItems(i);n?o?Kekule.ArrayUtils.replace(n,o,t):Kekule.ArrayUtils.pushUnique(n,t):(n=[t],e._itemClassMap.set(i,n))},unregister:function(t){var o=t.getClass(),r=e.getAllItems(o);r&&Kekule.ArrayUtils.remove(r,t);var i=t.getName();i&&e._itemNameMap.remove(i)}};var e=Kekule.Editor.RepositoryItemManager;Kekule._registerAfterLoadSysProc(function(){if(Kekule.Editor.RepositoryData){for(var t=0,o=(i=Kekule.Editor.RepositoryData.subGroups||[]).length;t<o;++t){var r=i[t];(n=new Kekule.Editor.StoredSubgroupRepositoryItem2D(r.structData,r.dataFormat,r.scale)).setInputTexts(r.inputTexts).setName(r.name||r.inputTexts[0]),e.register(n)}var i;for(t=0,o=(i=Kekule.Editor.RepositoryData.fragments||[]).length;t<o;++t){var n;r=i[t];(n=new Kekule.Editor.StoredStructFragmentRepositoryItem2D(r.structData,r.dataFormat,r.scale)).setName(r.name),e.register(n)}}})}(),function(){"use strict";var e=Kekule.ObjUtils,t=Kekule.ArrayUtils,o=Kekule.Widget.HtmlClassNames,r=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{STRUCTURE_NODE_SELECT_PANEL:"K-Chem-StructureNodeSelectPanel",STRUCTURE_NODE_SELECT_PANEL_SET_BUTTON:"K-Chem-StructureNodeSelectPanel-SetButton",STRUCTURE_NODE_SETTER:"K-Chem-StructureNodeSetter",STRUCTURE_NODE_SETTER_INPUTBOX:"K-Chem-StructureNodeSetter-InputBox",STRUCTURE_CONNECTOR_SELECT_PANEL:"K-Chem-StructureConnectorSelectPanel",STRUCTURE_CONNECTOR_SELECT_PANEL_SET_BUTTON:"K-Chem-StructureConnectorSelectPanel-SetButton",STRUCTURE_CONNECTOR_SELECT_PANEL_ADV:"K-Chem-StructureConnectorSelectPanelAdv",STRUCTURE_CONNECTOR_SELECT_PANEL_ADV_EXTRA_SECTION:"K-Chem-StructureConnectorSelectPanelAdv-ExtraSection",STRUCTURE_CONNECTOR_SELECT_PANEL_EXTRA_SECTION_BUTTON:"K-Chem-StructureConnectorSelectPanelAdv-ExtraSection-Button",STRUCTURE_CONNECTOR_SELECT_PANEL_EXTRA_SECTION_BUTTON_KEKULIZE:"K-Chem-StructureConnectorSelectPanelAdv-ExtraSection-Button-Kekulize",STRUCTURE_CONNECTOR_SELECT_PANEL_EXTRA_SECTION_BUTTON_HUCKLIZE:"K-Chem-StructureConnectorSelectPanelAdv-ExtraSection-Button-Hucklize",CHARGE_SELECT_PANEL:"K-Chem-Charge-SelectPanel",CHARGE_SELECT_PANEL_BTNGROUP:"K-Chem-Charge-SelectPanel-BtnGroup",CHARGE_SELECT_PANEL_CHARGE_BUTTON:"K-Chem-Charge-SelectPanel-ChargeButton",GLYPH_PATH_ARROW_SETTING_PANEL:"K-Chem-GlyphPath-Arrow-SettingPanel",GLYPH_PATH_ARROW_STYLE_BTNGROUP:"K-Chem-GlyphPath-Arrow-StyleButtonGroup",GLYPH_PATH_ARROW_STYLE_BUTTON:"K-Chem-GlyphPath-Arrow-StyleButton",GLYPH_PATH_ARROW_CONTINUOUS_SIDES_BTNGROUP:"K-Chem-GlyphPath-Arrow-ContinuousSidesButtonGroup",GLYPH_PATH_ARROW_CONTINUOUS_SIDES_BUTTON:"K-Chem-GlyphPath-Arrow-ContinuousSidesButton",GLYPH_Path_ARROW_SIZE_SETTER:"K-Chem-GlyphPath-Arrow-SizeSetter",GLYPH_REACTION_ARROW_PRESET_SELECTOR:"K-Chem-Glyph-ReactionArrow-PresetSelector",GLYPH_REACTION_ARROW_PRESET_SELECTOR_BTNSET:"K-Chem-Glyph-ReactionArrow-PresetSelector-ButtonSet",GLYPH_REACTION_ARROW_PRESET_SELECTOR_BTNSET_DROPDOWN:"K-Chem-Glyph-ReactionArrow-PresetSelector-ButtonSet-DropDown",GLYPH_REACTION_ARROW_PRESET_SELECTOR_BUTTON:"K-Chem-Glyph-ReactionArrow-PresetSelector-Button",GLYPH_ELECTRON_PUSHING_ARROW_PRESET_SELECTOR:"K-Chem-Glyph-ElectronPushingArrow-PresetSelector",GLYPH_ELECTRON_PUSHING_ARROW_PRESET_SELECTOR_BTNGROUP:"K-Chem-Glyph-ReactionArrow-PresetSelector-ButtonGroup",GLYPH_ELECTRON_PUSHING_ARROW_PRESET_SELECTOR_BUTTON:"K-Chem-Glyph-ElectronPushingArrow-PresetSelector-Button",GLYPH_PATH_LINE_SETTING_PANEL:"K-Chem-GlyphPath-Line-SettingPanel",GLYPH_PATH_SETTING_PANEL:"K-Chem-GlyphPath-SettingPanel",GLYPH_PATH_SETTING_PANEL_SECTION:"K-Chem-GlyphPath-SettingPanel-Section",GLYPH_PATH_SETTING_PANEL_SECTION_TITLE:"K-Chem-GlyphPath-SettingPanel-Section-Title",GLYPH_PATH_SETTING_PANEL_SECTION_PANEL:"K-Chem-GlyphPath-SettingPanel-Section-Panel",GLYPH_MULTIPATH_SETTING_PANEL:"K-Chem-GlyphMultiPath-SettingPanel",GLYPH_MULTIPATH_SETTING_PANEL_PATH_TABGROUP:"K-Chem-GlyphMultiPath-SettingPanel-PathTabGroup",GLYPH_MULTIPATH_SETTING_PANEL_PATH_SETTING_PANEL:"K-Chem-GlyphMultiPath-SettingPanel-PathSettingPanel",GLYPH_REACTION_ARROW_PATH_SETTING_PANEL:"K-Chem-ReactionArrow-SettingPanel",GLYPH_REACTION_ARROW_PATH_SETTING_PANEL_ARROW_PRESET_SECTION:"K-Chem-ReactionArrow-SettingPanel-ArrowPresetSection",GLYPH_ARC_PATH_SETTING_PANEL:"K-Chem-ArcPath-SettingPanel",GLYPH_MULTIARC_PATH_SETTING_PANEL:"K-Chem-MultiArcPath-SettingPanel",GLYPH_ELECTRON_PUSHING_ARROW_SETTING_PANEL:"K-Chem-ElectronPusingArrow-SettingPanel",GLYPH_MULTI_ELECTRON_PUSHING_ARROW_SETTING_PANEL:"K-Chem-MultiElectronPusingArrow-SettingPanel"}),Kekule.ChemWidget.StructureNodeSelectPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.StructureNodeSelectPanel",BTN_DATA_FIELD:"__$btn_data__",initialize:function(e){this.setPropStoreFieldValue("displayElements",!0),this.setPropStoreFieldValue("displayNonElements",!0),this.setPropStoreFieldValue("displaySubgroups",!0),this.tryApplySuper("initialize",[e]),this.addEventListener("execute",this.reactSelButtonExec.bind(this))},initProperties:function(){this.defineProp("value",{dataType:DataType.HASH,serializable:!1,setter:null}),this.defineProp("elementSymbols",{dataType:DataType.ARRAY,scope:Class.PropertyScope.PUBLIC}),this.defineProp("nonElementInfos",{dataType:DataType.ARRAY,scope:Class.PropertyScope.PUBLIC}),this.defineProp("subGroupInfos",{dataType:DataType.ARRAY,scope:Class.PropertyScope.PUBLIC}),this.defineProp("subGroupRepItems",{dataType:DataType.ARRAY,scope:Class.PropertyScope.PUBLIC,setter:function(e){this.setPropStoreFieldValue("subGroupRepItems",e),this._updateSubGroupInfosFromRepItems(e)}}),this.defineProp("displayElements",{dataType:DataType.BOOL,scope:Class.PropertyScope.PUBLISHED}),this.defineProp("displayNonElements",{dataType:DataType.BOOL,scope:Class.PropertyScope.PUBLISHED}),this.defineProp("displaySubgroups",{dataType:DataType.BOOL,scope:Class.PropertyScope.PUBLISHED}),this.defineProp("activeNode",{dataType:DataType.ARRAY,serializable:!1,setter:function(e){this.setPropStoreFieldValue("activeNode",e),this.activeNodeChanged(e)}}),this.defineProp("periodicTableDialog",{dataType:DataType.OBJECT,scope:Class.PropertyScope.PRIVATE,serializable:!1,setter:null,getter:function(e){var t=this.getPropStoreFieldValue("periodicTableDialog");if(!t&&e){var o=this.getCoreElement(),r=this.getDocument();t=this._createPeriodicTableDialogWidget(r,o),this.setPropStoreFieldValue("periodicTableDialog",t)}return t}})},initPropValues:function(){return this.tryApplySuper("initPropValues")},doFinalize:function(){var e=this.getPeriodicTableDialog();e&&e.finalize(),this.tryApplySuper("doFinalize")},setSelectableInfos:function(e){this.beginUpdate();try{this.setPropValues(e)}finally{this.endUpdate()}},reactSelButtonExec:function(e){var t=this,o=e.target;if(this._selButtons.indexOf(o)>=0){var r=o[this.BTN_DATA_FIELD];r&&(r.isPeriodicTable?this._openPeriodicTableDialog(o,function(e){if(e===Kekule.Widget.DialogButtons.OK){var o=t._periodicTable.getSelectedSymbol();t.doValueChanged(t.generateSelectableDataFromElementSymbol(o))}},{isSimpleAtom:!0}):r.isVarList||r.isVarNotList?this._openPeriodicTableDialog(o,function(e){if(e===Kekule.Widget.DialogButtons.OK){var o=t._periodicTable.getSelectedSymbols(),i=Kekule.VariableAtom,n=r.isVarList?{allowedIsotopeIds:o,disallowedIsotopeIds:null}:{allowedIsotopeIds:null,disallowedIsotopeIds:o};t.doValueChanged({nodeClass:i,props:n})}},{isVarList:r.isVarList,isVarNotList:r.isVarNotList}):this.doValueChanged(r))}},doValueChanged:function(e){this.setPropStoreFieldValue("value",e),this.invokeEvent("valueChange",{value:{nodeClass:e.nodeClass,props:e.props,repositoryItem:e.repositoryItem}})},activeNodeChanged:function(e){},doObjectChange:function(e){Kekule.ArrayUtils.intersect(e,["elementSymbols","nonElementInfos","subGroupInfos","displayElements","displayNonElements","displaySubGroups"]).length&&this.updatePanelContent(this.getDocument(),this.getCoreElement())},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.STRUCTURE_NODE_SELECT_PANEL},doCreateRootElement:function(e){return e.createElement("span")},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]);return this.updatePanelContent(e,this.getChildrenHolderElement()),o},_updateSubGroupInfosFromRepItems:function(e){var t=[];if(e&&e.length){for(var o=0,r=e.length;o<r;++o){var i=e[o],n=i.getStructureFragment(),a=n.getAbbr();if(!a){var l=n.getFormulaText(),s=Kekule.FormulaUtils.textToFormula(l).getDisplayRichText();a=Kekule.Render.RichTextUtils._toDebugHtml(s)}var d={text:a,repositoryItem:i,nodeClass:n.getClass(),node:n,hint:i.getName()};t.push(d)}this.setSubGroupInfos(t)}},updatePanelContent:function(e,t){if(this._selButtons)for(var o=this._selButtons.length-1;o>=0;--o){var r=this._selButtons[o];this.removeWidget(r)}this._selButtons=[],Kekule.DomUtils.clearChildContent(t);var i=this.generateSelectableData(),n=this._getDisplayedTabPageNames(),a=new Kekule.Widget.TabView(this);if(n.indexOf("atom")>=0){var l=a.createNewTabPage(Kekule.$L("ChemWidgetTexts.CAPTION_ATOM"));if(this.getDisplayElements())this.doCreateSelButtonSection(e,l.getCoreElement(),i.elementData);if(this.getDisplayNonElements())this.doCreateSelButtonSection(e,l.getCoreElement(),i.nonElementData,!0)}if(n.indexOf("subgroup")>=0){var s=a.createNewTabPage(Kekule.$L("ChemWidgetTexts.CAPTION_SUBGROUP"));this.doCreateSelButtonSection(e,s.getCoreElement(),i.subGroupData,!0)}a.setShowTabButtons(n.length>1)},_getDisplayedTabPageNames:function(){var e=[];return(this.getDisplayElements()||this.getDisplayNonElements())&&e.push("atom"),this.getDisplaySubgroups()&&e.push("subgroup"),e},generateSelectableDataFromElementSymbol:function(e){var t=e,o=Kekule.IsotopesDataUtil.getIsotopeInfoById(e);return o&&(t=o.isotopeAlias?o.isotopeAlias:"<sup>"+o.massNumber+"</sup>"+o.elementSymbol),{text:t,nodeClass:Kekule.Atom,props:{isotopeId:e}}},generateSelectableData:function(){for(var e=this.getElementSymbols()||[],t=[],o=0,r=e.length;o<r;++o){var i;i="..."===e[o]?{text:"…",nodeClass:null,hint:Kekule.$L("ChemWidgetTexts.CAPTION_ATOMLIST_PERIODIC_TABLE"),isPeriodicTable:!0}:this.generateSelectableDataFromElementSymbol(e[o]),t.push(i)}return{elementData:t,nonElementData:this.getNonElementInfos(),subGroupData:this.getSubGroupInfos()}},doCreateSelButton:function(e,t,o,i){var n=o.text;i&&o.description&&(n+='<span style="font-size:80%"> '+o.description+"</span>");var a=new(0,Kekule.Widget.Button)(e,n);return a.addClassName(r.STRUCTURE_NODE_SELECT_PANEL_SET_BUTTON),a.setGroup&&a.setGroup(this.getClassName()),o.hint&&a.setHint(o.hint),a[this.BTN_DATA_FIELD]=o,this._selButtons.push(a),a},doCreateSectionSelButtons:function(e,t,o,r){if(o)for(var i=0,n=o.length;i<n;++i){var a=this.doCreateSelButton(e,t,o[i],r);a.setParent(this),a.appendToElem(t)}},doCreateSection:function(e,t){var r=e.createElement("div");return r.className=o.SECTION,t&&t.appendChild(r),r},doCreateSelButtonSection:function(e,t,o,r){var i=this.doCreateSection(e,t);return this.doCreateSectionSelButtons(e,i,o,r),i},_createPeriodicTableDialogWidget:function(e,t){var o=new Kekule.Widget.Dialog(e,Kekule.$L("ChemWidgetTexts.CAPTION_PERIODIC_TABLE_DIALOG"),[Kekule.Widget.DialogButtons.OK,Kekule.Widget.DialogButtons.CANCEL]),r=new Kekule.ChemWidget.PeriodicTable(e);return r.setUseMiniMode(!0).setEnableSelect(!0),r.setParent(o),r.appendToElem(o.getClientElem()),this._periodicTable=r,o},_openPeriodicTableDialog:function(e,t,o){var r=this.getPeriodicTableDialog(!0),i=o.isVarList||o.isVarNotList;this._periodicTable.setEnableMultiSelect(i).setSelectedSymbol(null);var n=this.getActiveNode();if((o.isVarList||o.isVarNotList)&&n instanceof Kekule.VariableAtom){var a=n.getAllowedIsotopeIds(),l=n.getDisallowedIsotopeIds();this._periodicTable.setSelectedSymbols(o.isVarList?a:l)}!i&&n instanceof Kekule.Atom&&this._periodicTable.setSelectedSymbol(n.getSymbol()),r.openPopup(t,e||this)}}),Kekule.ChemWidget.StructureNodeSetter=Class.create(Kekule.Widget.BaseWidget,{CLASS_NAME:"Kekule.ChemWidget.StructureNodeSetter",initialize:function(e){this.tryApplySuper("initialize",[e]),this._valueSetBySelectPanel=!1},initProperties:function(){this.defineProp("enableHydrogenCountInput",{dataType:DataType.BOOL}),this.defineProp("nodes",{dataType:DataType.ARRAY,serializable:!1,setter:function(e){var t=Kekule.ArrayUtils.toArray(e);this.setPropStoreFieldValue("nodes",t),this.nodesChanged(t)}}),this.defineProp("value",{dataType:DataType.HASH,serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("value");if(!e&&!this._valueSetBySelectPanel){var t=this.getNodeInputBox().getValue();e=this._getValueFromDirectInputText(t)}return e}}),this.defineProp("nodeLabel",{dataType:DataType.STRING,serializable:!1,setter:null,getter:function(){return this.getNodeInputBox().getValue()}}),this.defineProp("nodeInputBox",{dataType:"Kekule.Widget.ButtonTextBox",serializable:!1,setter:!1}),this.defineProp("nodeInputBoxFontSize",{dataType:DataType.STRING,serializable:!1,setter:function(e){this.getNodeInputBox().getTextBox().getElement().style.fontSize=e,this.setPropStoreFieldValue("nodeInputBoxFontSize",e)}}),this.defineProp("nodeSelectPanel",{dataType:"Kekule.ChemWidget.StructureNodeSelectPanel",serializable:!1,setter:!1}),this.defineProp("showInputBox",{dataType:DataType.BOOL,getter:function(){return this.getNodeInputBox().getDisplayed()},setter:function(e){this.getNodeInputBox().setDisplayed(e)}}),this.defineProp("showSelectPanel",{dataType:DataType.BOOL,getter:function(){return this.getNodeSelectPanel().getDisplayed()},setter:function(e){this.getNodeSelectPanel().setDisplayed(e)}}),this.defineProp("useDropDownSelectPanel",{dataType:DataType.BOOL,setter:function(e){this.getUseDropDownSelectPanel()!==e&&(this.setPropStoreFieldValue("useDropDownSelectPanel",e),this._updateDropDownSettings(e))}}),this.defineProp("labelConfigs",{dataType:DataType.OBJECT,serializable:!1}),this._defineSelectPanelDelegatedProp("selectableElementSymbols","elementSymbols"),this._defineSelectPanelDelegatedProp("selectableNonElementInfos","nonElementInfos"),this._defineSelectPanelDelegatedProp("selectableSubGroupInfos","subGroupInfos"),this._defineSelectPanelDelegatedProp("selectableSubGroupRepItems","subGroupRepItems"),this._defineSelectPanelDelegatedProp("displaySelectableElements","displayElements"),this._defineSelectPanelDelegatedProp("displaySelectableNonElements","displayNonElements"),this._defineSelectPanelDelegatedProp("displaySelectableSubgroups","displaySubgroups")},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setEnableHydrogenCountInput(!0)},doFinalize:function(){var e=this.getNodeSelectPanel();e&&e.finalize();var t=this.getNodeInputBox();t&&t.finalize(),this.tryApplySuper("doFinalize")},_defineSelectPanelDelegatedProp:function(e,t){t||(t=e);var o=ClassEx.getPropInfo(Kekule.ChemWidget.StructureNodeSelectPanel,t),r=Object.create(o);return r.getter=null,r.setter=null,o.getter&&(r.getter=function(){return this.getNodeSelectPanel().getPropValue(t)}),o.setter&&(r.setter=function(e){this.getNodeSelectPanel().setPropValue(t,e)}),this.defineProp(e,r)},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.STRUCTURE_NODE_SETTER},doCreateRootElement:function(e){return e.createElement("span")},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),i=this,n=new Kekule.Widget.ButtonTextBox(this);this.setPropStoreFieldValue("nodeInputBox",n),n.addClassName(r.STRUCTURE_NODE_SETTER_INPUTBOX),n.appendToElem(this.getCoreElement()),n.addEventListener("valueChange",function(e){i._valueSetBySelectPanel=!1,e.stopPropagation()}),n.addEventListener("keyup",function(e){var t=e.htmlEvent.getKeyCode();t===Kekule.X.Event.KeyCode.ENTER&&i._applyDirectInput(),i.getUseDropDownSelectPanel()&&(t===Kekule.X.Event.KeyCode.DOWN?i.showNodeSelectPanel():t===Kekule.X.Event.KeyCode.UP&&i.hideNodeSelectPanel())}),n.addEventListener("blur",function(e){e.target===n.getTextBox()&&n.getIsDirty()&&i._applyDirectInput()}),n.getButton().addEventListener("execute",function(e){i.getUseDropDownSelectPanel()?i.toggleNodeSelectPanel():i._applyDirectInput()});var a=new Kekule.ChemWidget.StructureNodeSelectPanel(this);return this.setPropStoreFieldValue("nodeSelectPanel",a),a.appendToElem(this.getCoreElement()),a.addEventListener("valueChange",function(e){Object.extend({},e);e.stopPropagation(),i._valueSetBySelectPanel=!0,i.doValueChanged(e.value,!0),i.getUseDropDownSelectPanel()&&a.hide()}),this._updateDropDownSettings(this.getUseDropDownSelectPanel()),o},_updateDropDownSettings:function(e){var t=this.getNodeInputBox(),o=this.getNodeSelectPanel();e?(t.setButtonKind(Kekule.Widget.Button.Kinds.DROPDOWN),o.removeFromDom(),o.hide(null,null,Kekule.Widget.ShowHideType.DEFAULT)):(t.setButtonKind(Kekule.Widget.Button.Kinds.ENTER),o.appendToElem(this.getCoreElement()),o.setStyleProperty("position",""),o.show(null,null,Kekule.Widget.ShowHideType.DEFAULT))},_indexOfNonElementLabel:function(e){for(var t=this.getNonAtomLabelInfos(),o=0,r=t.length;o<r;++o){if(t[o].nodeLabel===e)return o}return-1},_getNonAtomInfo:function(e){var t=this.getSelectableNonElementInfos();if(t)for(var o=0,r=t.length;o<r;++o){var i=t[o];if(i.text===e)return i}return null},_getNodeWithExplicitHInfo:function(e){var t={},o=e.trim().match(/^(\d*[A-Z][a-z]?\d*)H(\d*)$/);return o?(t.core=o[1],t.explicitHCount=parseInt(o[2])||1):t.core=e,t},_getValueFromDirectInputText:function(e){var t,o,r,i,n,a=this._getNonAtomInfo(e);if(a)t=a.nodeClass,o=a.props;else{var l=Kekule.Editor.StoredSubgroupRepositoryItem2D.getRepItemOfInputText(e);if(r=l,l)t=l.getStructureFragment().getClass();else if(e){var s=e;if(!(t=Kekule.ChemStructureNodeFactory.getClassByLabel(s,null))){if(this.getEnableHydrogenCountInput()){var d=this._getNodeWithExplicitHInfo(s);d.explicitHCount&&(t=Kekule.ChemStructureNodeFactory.getClassByLabel(d.core,null))&&(n=d.explicitHCount,s=d.core)}t||(t=Kekule.Pseudoatom,i=!0)}o=t===Kekule.Atom?{isotopeId:s,inputHydrogenCount:n}:t===Kekule.Pseudoatom?{symbol:e}:{}}}return{nodeClass:t,props:o,repositoryItem:r,isUnknownPseudoatom:i}},_applyDirectInput:function(){this._valueSetBySelectPanel=!1;var e=this.getNodeInputBox();if(e.getIsDirty()){var t=e.getValue(),o=this._getValueFromDirectInputText(t);this.doValueChanged(o),e.setIsDirty(!1)}else this.doValueChanged(null)},_getVarAtomListLabel:function(){var e=this.getLabelConfigs();return e?e.getVariableAtom():Kekule.ChemStructureNodeLabels.VARIABLE_ATOM},_getVarAtomNotListLabel:function(){var e=this.getLabelConfigs();return"~"+(e?e.getVariableAtom():Kekule.ChemStructureNodeLabels.VARIABLE_ATOM)},_getAllNodeLabels:function(e){var t={};return this.getEnableHydrogenCountInput()&&(t.includeExplicitHydrogens=!0),Kekule.Editor.StructureUtils.getAllChemStructureNodesLabel(e,this.getLabelConfigs(),t)},nodesChanged:function(e){var t=this._getAllNodeLabels(e)||"",o=t?e[0]:null;this.getNodeSelectPanel().setActiveNode(o),this.getNodeInputBox().setValue(t),this.getNodeInputBox().setIsDirty(!1),this.setPropStoreFieldValue("value",null),this._valueSetBySelectPanel=!1},doValueChanged:function(e,t){this.setPropStoreFieldValue("value",e);var o=e&&{nodeClass:e.nodeClass,props:e.props,repositoryItem:e.repositoryItem,isUnknownPseudoatom:e.isUnknownPseudoatom};t&&this.invokeEvent("valueSelect",{value:o}),this.invokeEvent("valueChange",{value:o})},setSelectableInfos:function(e){this.getNodeSelectPanel().setSelectableInfos(e)},showNodeSelectPanel:function(){var e=this.getNodeSelectPanel();e.isShown()||e.show(this.getNodeInputBox(),null,Kekule.Widget.ShowHideType.DROPDOWN)},hideNodeSelectPanel:function(){var e=this.getNodeSelectPanel();e.isShown()&&e.hide()},toggleNodeSelectPanel:function(){var e=this.getNodeSelectPanel();e.isShown()?e.hide():e.show(this.getNodeInputBox(),null,Kekule.Widget.ShowHideType.DROPDOWN)}}),Kekule.ChemWidget.StructureConnectorSelectPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.StructureConnectorSelectPanel",BTN_DATA_FIELD:"__$btn_data__",BTN_GROUP:"__$bond_btn_group__",initialize:function(e){this.tryApplySuper("initialize",[e]),this._selButtons=[],this._activeBtn=null,this.addEventListener("execute",this.reactSelButtonExec.bind(this))},initProperties:function(){this.defineProp("value",{dataType:DataType.HASH,serializable:!1,setter:null}),this.defineProp("bondData",{dataType:DataType.ARRAY,scope:Class.PropertyScope.PUBLIC}),this.defineProp("activeBondPropValues",{dataType:DataType.HASH,scope:Class.PropertyScope.PUBLIC,setter:function(e){this.setPropStoreFieldValue("activeBondPropValues",e),this.activeBondPropsChanged(e)}}),this.defineProp("activeBondHtmlClass",{dataType:DataType.STRING,scope:Class.PropertyScope.PRIVATE,setter:null,getter:function(){var e=this._activeBtn;if(e){var t=e[this.BTN_DATA_FIELD];return t&&t.htmlClass}return null}}),this.defineProp("bondPropNames",{dataType:DataType.ARRAY,serializable:!1})},doObjectChange:function(e){Kekule.ArrayUtils.intersect(e,["bondData"]).length&&this.updatePanelContent(this.getDocument(),this.getCoreElement())},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.STRUCTURE_CONNECTOR_SELECT_PANEL},doCreateRootElement:function(e){return e.createElement("span")},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]);return this.updatePanelContent(e,t),o},activeBondPropsChanged:function(e){if(this._activeBtn&&(this._activeBtn.setChecked(!1),this._activeBtn=null),e)for(var t=this._selButtons,o=0,r=t.length;o<r;++o){var i=t[o][this.BTN_DATA_FIELD];if(i&&this._isBondPropsMatch(e,i.bondProps,this.getBondPropNames())){t[o].setChecked(!0),this._activeBtn=t[o];break}}},_isBondPropsMatch:function(e,t,o){return Kekule.Editor.StructureUtils.isBondPropsMatch(e,t,o)},reactSelButtonExec:function(e){var t=e.target;if(this._selButtons.indexOf(t)>=0){this._activeBtn=t;var o=t[this.BTN_DATA_FIELD];o&&(this.setPropStoreFieldValue("activeBondPropValues",o.bondProps),this.doValueChanged(o.bondProps))}},doValueChanged:function(e){this.setPropStoreFieldValue("value",e),this.invokeEvent("valueChange",{value:e})},updatePanelContent:function(e,o){if(this._selButtons)for(var r=this._selButtons.length-1;r>=0;--r){var i=this._selButtons[r];this.removeWidget(i)}var n=[];this._selButtons=[];var a=this.getBondData();if(a){r=0;for(var l=a.length;r<l;++r){var s=a[r],d=s.bondProps;(i=this._createBondSelButton(e,s)).appendToElem(o),this._selButtons.push(i),d&&t.pushUnique(n,Kekule.ObjUtils.getOwnedFieldNames(d))}}this.getBondPropNames()||this.setPropStoreFieldValue("bondPropNames",n)},_createBondSelButton:function(e,t){var o=new Kekule.Widget.RadioButton(this);return o.addClassName(r.STRUCTURE_CONNECTOR_SELECT_PANEL_SET_BUTTON),o.setGroup(this.BTN_GROUP).setShowGlyph(!0).setShowText(!1),o.setText(t.text||null).setHint(t.hint||t.description||null),t.htmlClass&&o.addClassName(t.htmlClass),o[this.BTN_DATA_FIELD]=t,o}}),Kekule.ChemWidget.StructureConnectorSelectPanelAdv=Class.create(Kekule.ChemWidget.StructureConnectorSelectPanel,{CLASS_NAME:"Kekule.ChemWidget.StructureConnectorSelectPanelAdv",initialize:function(e){this.setPropStoreFieldValue("extraComponents",[Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Components.KEKULIZE]),this._additionalCompWidgets=[],this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("extraComponents",{dataType:DataType.ARRAY,scope:Class.PropertyScope.PUBLIC})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.STRUCTURE_CONNECTOR_SELECT_PANEL_ADV},doObjectChange:function(e){this.tryApplySuper("doObjectChange",[e]);Kekule.ArrayUtils.intersect(e,["extraComponents"]).length&&this.updatePanelContent(this.getDocument(),this.getCoreElement())},updatePanelContent:function(e,t){this.clearAdditionalSections(),this.tryApplySuper("updatePanelContent",[e,t]);var o=this.getExtraComponents();o&&o.indexOf(Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Components.KEKULIZE)>=0&&this._createKekulizeSection(e,t).appendToElem(t)},reactSelButtonExec:function(e){this.tryApplySuper("reactSelButtonExec",[e]);var t=e.target;t._command&&this.invokeEvent("command",{command:t._command})},clearAdditionalSections:function(){if(this._additionalCompWidgets){for(var e=0,t=this._additionalCompWidgets.length;e<t;++e){this._additionalCompWidgets[e].finalize()}this._additionalCompWidgets=[]}},createAdditionalSection:function(e,t){var o=new Kekule.Widget.Container(e);return o.addClassName(r.STRUCTURE_CONNECTOR_SELECT_PANEL_ADV_EXTRA_SECTION),this._additionalCompWidgets.push(o),o.appendToElem(t),o.setParent(this),o},_createKekulizeSection:function(e,t){var o=this.createAdditionalSection(e,t),i=new Kekule.Widget.Button(o);i.addClassName([r.STRUCTURE_CONNECTOR_SELECT_PANEL_EXTRA_SECTION_BUTTON,r.STRUCTURE_CONNECTOR_SELECT_PANEL_EXTRA_SECTION_BUTTON_KEKULIZE]).setText(Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_KEKULIZE")).setHint(Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_KEKULIZE")).setShowGlyph(!0).setShowText(!1),i._command=Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Commands.KEKULIZE,o.appendWidget(i);var n=e.createElement("span");Kekule.DomUtils.setElementText(n," ◀ ▶ "),o.getElement().appendChild(n);var a=new Kekule.Widget.Button(o);return a.addClassName([r.STRUCTURE_CONNECTOR_SELECT_PANEL_EXTRA_SECTION_BUTTON,r.STRUCTURE_CONNECTOR_SELECT_PANEL_EXTRA_SECTION_BUTTON_HUCKLIZE]).setText(Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_HUCKLIZE")).setHint(Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_HUCKLIZE")).setShowGlyph(!0).setShowText(!1),a._command=Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Commands.HUCKLIZE,o.appendWidget(a),o}}),Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Components={KEKULIZE:"kekulize"},Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Commands={KEKULIZE:"kekulize",HUCKLIZE:"hucklize"},Kekule.ChemWidget.ChargeSelectPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.ChargeSelectPanel",CHARGE_FIELD:"__$charge__",initialize:function(e){this._chargeBtnGroups={},this._selectedButton=null,this._chargeButtonMap=[],this.setPropStoreFieldValue("maxCharge",4),this.setPropStoreFieldValue("minCharge",-4),this.tryApplySuper("initialize",[e]),this.addEventListener("execute",this.reactSelButtonExec.bind(this))},initProperties:function(){this.defineProp("value",{dataType:DataType.NUMBER,scope:Class.PropertyScope.PUBLIC,setter:function(e){var t=this.getValue();if(e!==t){var o=this._chargeButtonMap[t];o&&(o.setChecked(!1),o.blur()),this.setPropStoreFieldValue("value",e);var r=this._chargeButtonMap[e];r&&r.setChecked(!0),this._selectedButton=r}}}),this.defineProp("minCharge",{dataType:DataType.NUMBER,scope:Class.PropertyScope.PUBLIC,setter:function(e){e!==this.getMinCharge()&&(this.setPropStoreFieldValue("minCharge",e),this.updateChargeButtons())}}),this.defineProp("maxCharge",{dataType:DataType.NUMBER,scope:Class.PropertyScope.PUBLIC,setter:function(e){e!==this.getMaxCharge()&&(this.setPropStoreFieldValue("maxCharge",e),this.updateChargeButtons())}})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.CHARGE_SELECT_PANEL},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]);return this.updateChargeButtons(e,t),o},updateChargeButtons:function(e,t){for(var o=this._chargeBtnGroups,i=["zero","positive","negative"],n=0,a=i.length;n<a;++n){(l=o[i[n]])?l.clearWidgets():((l=new Kekule.Widget.ButtonGroup(this)).addClassName(r.CHARGE_SELECT_PANEL_BTNGROUP),l.appendToElem(t),o[i[n]]=l)}var l,s=Math.floor(this.getMaxCharge()),d=Math.floor(this.getMinCharge()),u=Kekule.$L("ChemWidgetTexts.TEXT_CHARGE_POSITIVE"),c=Kekule.$L("ChemWidgetTexts.TEXT_CHARGE_NEGATIVE");if(s>=1&&(l=this._chargeBtnGroups.positive))for(n=Math.max(d,1);n<=s;++n)this._createChargeButton(l,n,n+u);s>=0&&d<=0&&((l=this._chargeBtnGroups.zero)&&this._createChargeButton(l,0,Kekule.$L("ChemWidgetTexts.TEXT_CHARGE_NONE"),Kekule.$L("ChemWidgetTexts.HINT_CHARGE_NONE")));if(d<=-1&&(l=this._chargeBtnGroups.negative))for(n=Math.min(s,-1);n>=d;--n)this._createChargeButton(l,n,Math.abs(n)+c)},_createChargeButton:function(e,t,o,i){var n=new Kekule.Widget.RadioButton(e,o);return n[this.CHARGE_FIELD]=t,this._chargeButtonMap[t]=n,i&&n.setHint(i),n.addClassName(r.CHARGE_SELECT_PANEL_CHARGE_BUTTON),n.appendToWidget(e),this.getValue()===t&&(n.setChecked(!0),this._selectedButton=n),n},reactSelButtonExec:function(e){var t=e.target[this.CHARGE_FIELD];Kekule.ObjUtils.notUnset(t)&&(this.setValue(t),this.notifyValueChange(t))},notifyValueChange:function(e){this.invokeEvent("valueChange",{value:e})}}),Kekule.ChemWidget.GlyphPathArrowSettingPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.GlyphPathArrowSettingPanel",DATA_FIELD:"__$data$__",initialize:function(e){this._isSettingValue=!1,this._arrowWidthInputter=null,this._arrowLengthInputter=null,this._arrowStyleButtons=null,this.setPropStoreFieldValue("arrowWidthMin",0),this.setPropStoreFieldValue("arrowWidthMax",.5),this.setPropStoreFieldValue("arrowWidthStep",.1),this.setPropStoreFieldValue("arrowLengthMin",0),this.setPropStoreFieldValue("arrowLengthMax",.5),this.setPropStoreFieldValue("arrowLengthStep",.1),this.setPropStoreFieldValue("showContinousArrowSidesSetter",!1),this.setPropStoreFieldValue("defaultValue",{arrowType:Kekule.Glyph.ArrowType.NONE,arrowSide:Kekule.Glyph.ArrowSide.BOTH}),this.tryApplySuper("initialize",[e]),this.addEventListener("check",this.reactArrowStyleButtonCheck.bind(this)),this.addEventListener("valueChange",this.reactArrowSizeInputterChange.bind(this)),this.addEventListener("valueInput",this.reactArrowSizeInputterInput.bind(this))},initProperties:function(){this.defineProp("defaultValue",{dataType:DataType.HASH,scope:Class.PropertyScope.PRIVATE}),this.defineProp("value",{dataType:DataType.HASH,getter:function(){var e=this.getPropStoreFieldValue("value");return e||(e={},this.setPropStoreFieldValue("value",e)),e},setter:function(e){this._isSettingValue=!0;try{this.setPropStoreFieldValue("value",e);for(var t=Object.extend(Object.extend({},this.getDefaultValue()),e,!1,!0),o=0,r=this._arrowStyleButtons.length;o<r;++o){var i=this._arrowStyleButtons[o],n=i[this.DATA_FIELD];n.arrowType!==t.arrowType||n.arrowSide!==t.arrowSide&&n.arrowType!==Kekule.Glyph.ArrowType.NONE?i.setChecked(!1):i.setChecked(!0)}this._arrowWidthInputter.setValue(t.arrowWidth||0),this._arrowLengthInputter.setValue(t.arrowLength||0)}finally{this._isSettingValue=!1}}}),this.defineProp("allowedArrowTypes",{dataType:DataType.ARRAY}),this.defineProp("allowedArrowSides",{dataType:DataType.ARRAY}),this.defineProp("arrowWidthMin",{dataType:DataType.NUMBER}),this.defineProp("arrowWidthMax",{dataType:DataType.NUMBER}),this.defineProp("arrowWidthStep",{dataType:DataType.NUMBER}),this.defineProp("arrowLengthMin",{dataType:DataType.NUMBER}),this.defineProp("arrowLengthMax",{dataType:DataType.NUMBER}),this.defineProp("arrowLengthStep",{dataType:DataType.NUMBER})},doObjectChange:function(e){(e.indexOf("allowedArrowTypes")>=0||e.indexOf("allowedArrowSides")>=0)&&this._updateStyleButtons(),t.intersect(e,["arrowWidthMin","arrowWidthMax","arrowWidthStep"]).length&&this._updateWidthInputter(),t.intersect(e,["arrowLengthMin","arrowLengthMax","arrowLengthStep"]).length&&this._updateLengthInputter()},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_PATH_ARROW_SETTING_PANEL},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),r=this.doCreateSectionElem(e,t),i=this.doCreateArrowStyleButtons(e,r),n=this.doCreateSectionElem(e,t),a=this.doCreateArrowSizeControls(e,n);return o.concat(i).concat(a)},doCreateSectionElem:function(e,t){var o=e.createElement("div");return t.appendChild(o),o},doCreateArrowStyleButtons:function(e,t){var o=Kekule.Glyph.ArrowType,i=Kekule.Glyph.ArrowSide,n={};n[o.NONE]="None",n[o.OPEN]="Open",n[o.TRIANGLE]="Triangle";var a={};a[i.BOTH]="Both",a[i.SINGLE]="Single",a[i.REVERSED]="Reversed";var l=[o.NONE,o.OPEN,o.TRIANGLE],s=[i.BOTH,i.SINGLE,i.REVERSED],d=new Kekule.Widget.ButtonGroup(this);d.addClassName(r.GLYPH_PATH_ARROW_STYLE_BTNGROUP),this._arrowStyleButtons=[];var u=l.indexOf(o.NONE);if(u>=0){l.splice(u,1);var c=f=m=n[o.NONE],p=r.GLYPH_PATH_ARROW_STYLE_BUTTON+"-"+m;(y=new Kekule.Widget.RadioButton(d,f)).setHint(c).addClassName(p),y[this.DATA_FIELD]={arrowType:o.NONE,arrowSide:(this.getDefaultValue()||{}).arrowSide},this._arrowStyleButtons.push(y)}for(var h=0,g=l.length;h<g;++h)for(var C=0,_=s.length;C<_;++C){var f,y,m=n[l[h]],O=a[s[C]];c=f=m+" / "+O,p=r.GLYPH_PATH_ARROW_STYLE_BUTTON+"-"+m+"-"+O;(y=new Kekule.Widget.RadioButton(d,f)).setHint(c).addClassName(p),y[this.DATA_FIELD]={arrowType:l[h],arrowSide:s[C]},this._arrowStyleButtons.push(y)}return d.setShowGlyph(!0).setShowText(!1),this._updateStyleButtons(this._arrowStyleButtons),d.appendToElem(t),[d]},doCreateArrowSizeControls:function(e,t){var o=this._createArrowSizeSlider(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_WIDTH")+":"),r=this._createArrowSizeSlider(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_LENGTH")+":");return this._arrowWidthInputter=o,this._arrowLengthInputter=r,this._updateWidthInputter(o),this._updateLengthInputter(r),[o,r]},_createArrowSizeSlider:function(e,t,o){var i=e.createElement("div");i.className=r.GLYPH_Path_ARROW_SIZE_SETTER;var n=e.createElement("label");Kekule.DomUtils.setElementText(n,o);var a=new Kekule.Widget.NumInput(this);return a.appendToElem(n),i.appendChild(n),t.appendChild(i),a},_updateStyleButtons:function(e){var t=this.getAllowedArrowTypes(),o=this.getAllowedArrowSides();if(e||(e=this._arrowStyleButtons),e)for(var r=0,i=e.length;r<i;++r){var n=e[r][this.DATA_FIELD],a=t&&t.indexOf(n.arrowType)<0||o&&o.indexOf(n.arrowSide)<0;e[r].setDisplayed(!a)}},_updateSizeInputter:function(t,o,r,i,n){var a=e.notUnset;a(r)&&t.setMinValue(r),a(i)&&t.setMaxValue(i),a(n)&&t.setStep(n),a(o)&&t.setValue(o)},_updateWidthInputter:function(e){e||(e=this._arrowWidthInputter),this._updateSizeInputter(e,this.getValue().arrowWidth,this.getArrowWidthMin(),this.getArrowWidthMax(),this.getArrowWidthStep())},_updateLengthInputter:function(e){e||(e=this._arrowLengthInputter),this._updateSizeInputter(e,this.getValue().arrowLength,this.getArrowLengthMin(),this.getArrowLengthMax(),this.getArrowLengthStep())},getDefaultAllowedArrowTypes:function(){var e=Kekule.Glyph.ArrowType;return[e.NONE,e.OPEN,e.TRIANGLE]},notifyValueChange:function(e){this.notifyPropSet("value",e),this.invokeEvent("valueChange",{value:e})},notifyValueInput:function(e){this.notifyPropSet("value",e),this.invokeEvent("valueInput",{value:e})},reactArrowStyleButtonCheck:function(e){if(!this._isSettingValue){var t=e.widget;if(t&&t[this.DATA_FIELD]){var o=this.getValue();o.arrowType=t[this.DATA_FIELD].arrowType,o.arrowSide=t[this.DATA_FIELD].arrowSide,this.notifyValueChange(o),e.stopPropagation()}}},reactArrowSizeInputterChange:function(t){if(!this._isSettingValue){var o=t.widget;if(o===this._arrowWidthInputter||o===this._arrowLengthInputter){var r=o.getValue()&&o.getValue();if(e.notUnset(r)){var i=this.getValue();o===this._arrowWidthInputter?i.arrowWidth=r:o===this._arrowLengthInputter&&(i.arrowLength=r),this.notifyValueChange(i),t.stopPropagation()}}}},reactArrowSizeInputterInput:function(t){if(!this._isSettingValue){var o=t.widget;if(o===this._arrowWidthInputter||o===this._arrowLengthInputter){var r=o.getValue()&&o.getValue();if(e.notUnset(r)){var i=this.getValue();o===this._arrowWidthInputter?i.arrowWidth=r:o===this._arrowLengthInputter&&(i.arrowLength=r),this.notifyValueInput(i),t.stopPropagation()}}}}}),Kekule.ChemWidget.GlyphReactionArrowPresetSelector=Class.create(Kekule.Widget.Container,{CLASS_NAME:"Kekule.ChemWidget.GlyphReactionArrowPresetSelector",DATA_FIELD:"__$data$__",initialize:function(e){this._isSettingValue=!1,this._buttonSet=null,this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("value",{dataType:DataType.STRING,getter:function(){return this.getPropStoreFieldValue("value")||""},setter:function(e){this._isSettingValue=!0;try{this.setPropStoreFieldValue("value",e);for(var t=this._buttonSet.getButtonSet().getChildWidgets(),o=0,r=t.length;o<r;++o){var i=t[o];i[this.DATA_FIELD].reactionArrowType===e?i.setChecked(!0):i.setChecked(!1)}}finally{this._isSettingValue=!1}}}),this.defineProp("allowedReactionArrowTypes",{dataType:DataType.ARRAY})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_REACTION_ARROW_PRESET_SELECTOR},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),r=this.doCreateButtonSet(e,t);return o.concat([r.getElement()])},doCreateButtonSet:function(e,t){var o=new Kekule.Widget.CompactButtonSet(this);o.addClassName(r.GLYPH_REACTION_ARROW_PRESET_SELECTOR_BTNSET),o.getButtonSet().addClassName(r.GLYPH_REACTION_ARROW_PRESET_SELECTOR_BTNSET_DROPDOWN);for(var i=this.getAllowedReactionArrowTypes()||this.getDefaultAllowedReactionTypes(),n=0,a=i.length;n<a;++n){var l=new Kekule.Widget.RadioButton(o),s=this._getPresetButtonDetails(i[n]);l.addClassName(s.className,!0).setText(s.caption).setHint(s.hint).setShowText(!0).setShowGlyph(!0),l[this.DATA_FIELD]={reactionArrowType:i[n]},o.append(l)}var d=this;return o.addEventListener("select",function(e){if(!d._isSettingValue&&e.target===o){var t=e.selected;if(t&&t[d.DATA_FIELD]){var r=t[d.DATA_FIELD].reactionArrowType;d.setPropStoreFieldValue("value",r),d.notifyValueChange(r)}}}),o.appendToElem(t),this._buttonSet=o,o},_getPresetButtonDetails:function(e){Kekule.Glyph.ReactionArrowType;var t=e?e.toUpperCase():"UNSET",o=e?e.upperFirst():"Unset",i="REACTION_ARROW_"+t;return{caption:Kekule.$L("ChemWidgetTexts.CAPTION_"+i),hint:Kekule.$L("ChemWidgetTexts.HINT_"+i),className:r.GLYPH_REACTION_ARROW_PRESET_SELECTOR_BUTTON+" "+r.GLYPH_REACTION_ARROW_PRESET_SELECTOR_BUTTON+"-"+o}},notifyValueChange:function(e){this.notifyPropSet("value",e),this.invokeEvent("valueChange",{value:e})},getDefaultAllowedReactionTypes:function(){var e=Kekule.Glyph.ReactionArrowType;return[null,e.NORMAL,e.REVERSIBLE,e.RESONANCE,e.RETROSYNTHESIS,e.CUSTOM]}}),Kekule.ChemWidget.GlyphElectronPushingArrowPresetSelector=Class.create(Kekule.Widget.Container,{CLASS_NAME:"Kekule.ChemWidget.GlyphElectronPushingArrowPresetSelector",DATA_FIELD:"__$data$__",initialize:function(e){this._isSettingValue=!1,this._buttonGroup=null,this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("value",{dataType:DataType.INT,getter:function(){return this.getPropStoreFieldValue("value")||""},setter:function(e){this._isSettingValue=!0;try{this.setPropStoreFieldValue("value",e);for(var t=this._buttonGroup.getChildWidgets(),o=0,r=t.length;o<r;++o){var i=t[o];i[this.DATA_FIELD].electronCount===e?i.setChecked(!0):i.setChecked(!1)}}finally{this._isSettingValue=!1}}}),this.defineProp("allowedReactionArrowTypes",{dataType:DataType.ARRAY})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_ELECTRON_PUSHING_ARROW_PRESET_SELECTOR},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),r=this.doCreateButtonGroup(e,t);return o.concat([r.getElement()])},doCreateButtonGroup:function(e,t){var o=new Kekule.Widget.ButtonGroup(this);o.addClassName(r.GLYPH_ELECTRON_PUSHING_ARROW_PRESET_SELECTOR_BTNGROUP);for(var i=[2,1],n=0,a=i.length;n<a;++n){var l=i[n],s=new Kekule.Widget.RadioButton(o),d=this._getPresetButtonDetails(l);s.addClassName(d.className,!0).setText(d.caption).setHint(d.hint).setShowText(!0).setShowGlyph(!0),s[this.DATA_FIELD]={electronCount:l},o.appendWidget(s)}var u=this;return o.addEventListener("check",function(e){if(!u._isSettingValue){var t=e.widget;if(t&&t[u.DATA_FIELD]){var o=t[u.DATA_FIELD].electronCount;u.setPropStoreFieldValue("value",o),u.notifyValueChange(o)}}}),o.appendToElem(t),this._buttonGroup=o,o},_getPresetButtonDetails:function(e){var t=e.toString(),o="ELECTRON_PUSHING_ARROW_"+e;return{caption:Kekule.$L("ChemWidgetTexts.CAPTION_"+o+"_ABBR"),hint:Kekule.$L("ChemWidgetTexts.HINT_"+o),className:r.GLYPH_ELECTRON_PUSHING_ARROW_PRESET_SELECTOR_BUTTON+" "+r.GLYPH_ELECTRON_PUSHING_ARROW_PRESET_SELECTOR_BUTTON+"-"+t}},notifyValueChange:function(e){this.notifyPropSet("value",e),this.invokeEvent("valueChange",{value:e})}}),Kekule.ChemWidget.GlyphPathLineSettingPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.GlyphPathLineSettingPanel",initialize:function(e){this._isSettingValue=!1,this.setPropStoreFieldValue("lineCountMin",1),this.setPropStoreFieldValue("lineCountMax",5),this.setPropStoreFieldValue("lineCountStep",1),this.setPropStoreFieldValue("lineGapMin",0),this.setPropStoreFieldValue("lineGapMax",.8),this.setPropStoreFieldValue("lineGapStep",.1),this.tryApplySuper("initialize",[e]),this.addEventListener("valueChange",this.reactInputWidgetChange.bind(this))},initProperties:function(){this.defineProp("value",{dataType:DataType.HASH,getter:function(){var e=this.getPropStoreFieldValue("value");return e||(e={},this.setPropStoreFieldValue("value",e)),e},setter:function(e){this._isSettingValue=!0;try{this.setPropStoreFieldValue("value",e),this._lineCountInput.setValue(e.lineCount),this._lineGapInput.setValue(e.lineGap)}finally{this._isSettingValue=!1}}}),this.defineProp("lineCountMin",{dataType:DataType.NUMBER}),this.defineProp("lineCountMax",{dataType:DataType.NUMBER}),this.defineProp("lineCountStep",{dataType:DataType.NUMBER}),this.defineProp("lineGapMin",{dataType:DataType.NUMBER}),this.defineProp("lineGapMax",{dataType:DataType.NUMBER}),this.defineProp("lineGapStep",{dataType:DataType.NUMBER})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_PATH_LINE_SETTING_PANEL},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),r=this.doCreateNumInputSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_LINE_COUNT")+":");this._lineCountInput=r.widget,this._updateLineCountInput();var i=this.doCreateNumInputSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_LINE_GAP")+":");return this._lineGapInput=i.widget,this._updateLineGapInput(),o.concat([r,i])},doCreateNumInputSection:function(e,t,o){var r=e.createElement("span"),i=e.createElement("label");Kekule.DomUtils.setElementText(i,o);var n=new Kekule.Widget.NumInput(this,null,null,null,"number");return n.appendToElem(i),r.appendChild(i),t.appendChild(r),{elem:r,widget:n}},_updateInputWidget:function(t,o,r,i,n){var a=e.notUnset;t&&(t.setValue(o),a(r)&&t.setMinValue(r),a(i)&&t.setMaxValue(i),a(n)&&t.setStep(n))},_updateLineCountInput:function(){this._updateInputWidget(this._lineCountInput,this.getValue().lineCount,this.getLineCountMin(),this.getLineCountMax(),this.getLineCountStep())},_updateLineGapInput:function(){this._updateInputWidget(this._lineGapInput,this.getValue().lineGap,this.getLineGapMin(),this.getLineGapMax(),this.getLineGapStep())},notifyValueChange:function(e){this.notifyPropSet("value",e),this.invokeEvent("valueChange",{value:e})},reactInputWidgetChange:function(t){if(!this._isSettingValue){var o=t.widget;if(o===this._lineCountInput||o===this._lineGapInput){var r=o.getValue()&&o.getValue();if(e.notUnset(r)){var i=this.getValue();o===this._lineCountInput?i.lineCount=r:o===this._lineGapInput&&(i.lineGap=r),this.notifyValueChange(i),t.stopPropagation()}}}}}),Kekule.ChemWidget.GlyphPathSettingPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.GlyphPathSettingPanel",DEF_COMPONENTS:["startingArrow","endingArrow","line"],initialize:function(e){this.tryApplySuper("initialize",[e]),this.addEventListener("valueChange",this.reactChildSetterValueChange.bind(this)),this.addEventListener("valueInput",this.reactChildSetterValueInput.bind(this))},initProperties:function(){this.defineProp("value",{dataType:DataType.HASH,getter:function(){var e={};return this._startingArrowSetter&&(e=Object.extend(e,this._addPropPrefix(this._startingArrowSetter.getValue(),"start"))),this._endingArrowSetter&&(e=Object.extend(e,this._addPropPrefix(this._endingArrowSetter.getValue(),"end"))),this._lineSetter&&(e=Object.extend(e,this._lineSetter.getValue())),e},setter:function(e){if(e){var t=this._splitChildSetterValues(e);this._startingArrowSetter&&this._startingArrowSetter.setValue(t.startingArrow),this._endingArrowSetter&&this._endingArrowSetter.setValue(t.endingArrow),this._lineSetter&&this._lineSetter.setValue(t.line)}}}),this.defineProp("components",{dataType:DataType.ARRAY})},doObjectChange:function(e){return e.indexOf("components")>=0&&this.updateComponents(),this.tryApplySuper("doObjectChange",[e])},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_PATH_SETTING_PANEL},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),r=this.doCreateArrowSettingSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_STARTING_ARROW"));this._startingArrowSetter=r.widget,this._startingArrowElem=r.elem;var i=this.doCreateArrowSettingSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_ENDING_ARROW"));this._endingArrowSetter=i.widget,this._endingArrowElem=i.elem;var n=this.doCreateLineSettingSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_LINE"));return this._lineSetter=n.widget,this._lineElem=n.elem,o=o.concat([r.elem,i.elem,n.elem]),this.updateComponents(),o},doCreateSectionElem:function(e,t,o,i){var n=e.createElement("div"),a=e.createElement("label");Kekule.DomUtils.setElementText(a,o),a.className=r.GLYPH_PATH_SETTING_PANEL_SECTION_TITLE,n.appendChild(a);var l=r.GLYPH_PATH_SETTING_PANEL_SECTION;return i&&(l+=" "+i),n.className=l,t.appendChild(n),n},doCreateArrowSettingSection:function(e,t,o){var i=this.doCreateSectionElem(e,t,o),n=new Kekule.ChemWidget.GlyphPathArrowSettingPanel(this);return n.addClassName(r.GLYPH_PATH_SETTING_PANEL_SECTION_PANEL),n.appendToElem(i),{elem:i,widget:n}},doCreateLineSettingSection:function(e,t,o){var i=this.doCreateSectionElem(e,t,o),n=new Kekule.ChemWidget.GlyphPathLineSettingPanel(this);return n.addClassName(r.GLYPH_PATH_SETTING_PANEL_SECTION_PANEL),n.appendToElem(i),{elem:i,widget:n}},updateComponents:function(){var e=this.getComponents()||this.DEF_COMPONENTS,t=Kekule.StyleUtils;t.setDisplay(this._startingArrowElem,e.indexOf("startingArrow")>=0),t.setDisplay(this._endingArrowElem,e.indexOf("endingArrow")>=0),t.setDisplay(this._lineElem,e.indexOf("line")>=0)},reactChildSetterValueChange:function(e){var t=e.widget;if(t&&this.getChildValueSetterWidgets().indexOf(t)>=0){var o=this.getValue();e.stopPropagation(),this.notifyPropSet("value",o),this.invokeEvent("valueChange",{value:o})}},reactChildSetterValueInput:function(e){var t=e.widget;if(t&&this.getChildValueSetterWidgets().indexOf(t)>=0){var o=this.getValue();e.stopPropagation(),this.notifyPropSet("value",o),this.invokeEvent("valueInput",{value:o})}},getChildValueSetterWidgets:function(e){return[this._startingArrowSetter,this._endingArrowSetter,this._lineSetter]},getStartingArrowSetter:function(){return this._startingArrowSetter},getEndingArrowSetter:function(){return this._endingArrowSetter},_addPropPrefix:function(t,o){for(var r={},i=e.getOwnedFieldNames(t,!1),n=0,a=i.length;n<a;++n){var l=t[i[n]];r[o+i[n].capitalizeFirst()]=l}return r},_splitChildSetterValues:function(t){for(var o={startingArrow:{},endingArrow:{},line:{}},r=e.getOwnedFieldNames(t),i=0,n=r.length;i<n;++i){var a,l=r[i],s=t[l];l.startsWith("startArrow")?(a="arrow"+l.substr(10),o.startingArrow[a]=s):l.startsWith("endArrow")?(a="arrow"+l.substr(8),o.endingArrow[a]=s):o.line[l]=s}return o}}),Kekule.ChemWidget.GlyphMultiPathSettingPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.GlyphMultiPathSettingPanel",DEF_PATH_COUNT:2,DEF_COMPONENTS:["endingArrow"],initialize:function(e){this.setPropStoreFieldValue("value",[]),this.tryApplySuper("initialize",[e]),this.getPathCount()||this.setPathCount(this.DEF_PATH_COUNT),this.setActivePathIndex(0);var t=this.reactChildSetterValueChange.bind(this),o=this.reactChildSetterValueInput.bind(this);this.addEventListener("valueChange",t),this.addEventListener("valueInput",o),this.addEventListener("switch",this.reactPathTabSwitch.bind(this))},initProperties:function(){this.defineProp("pathCount",{dataType:DataType.INT,getter:function(){return this.getPathTabGroup().getTabButtons().length},setter:function(e){this._updatePathTabGroup(e)}}),this.defineProp("pathSettingPanel",{dataType:"Kekule.ChemWidget.GlyphPathSettingPanel",serializable:!1,setter:null}),this.defineProp("pathTabGroup",{dataType:"Kekule.Widget.TabButtonGroup",serializable:!1,setter:null}),this.defineProp("activePathIndex",{dataType:DataType.INT,getter:function(){return this.getPathTabGroup().getActiveTabIndex()},setter:function(e){this.getPathTabGroup().setActiveTabIndex(e),this._switchToNewPathTab(e)}}),this.defineProp("value",{dataType:DataType.HASH,setter:function(e){if(e){var o=t.toArray(e);this.setPropStoreFieldValue("value",o),o.length>this.getActivePathIndex()&&this.getPathSettingPanel().setValue(o[this.getActivePathIndex()])}else this.setPropStoreFieldValue("value",[])}}),this.defineProp("components",{dataType:DataType.ARRAY,serializable:!1,getter:function(){var e=this.getPathSettingPanel();return e&&e.getComponents()},setter:function(e){this.getPathSettingPanel().setComponents(e)}})},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_MULTIPATH_SETTING_PANEL},doCreateSubElements:function(e,t){var o=this.tryApplySuper("doCreateSubElements",[e,t]),i=new Kekule.Widget.TabButtonGroup(this);i.setTabButtonPosition(Kekule.Widget.Position.TOP).addClassName(r.GLYPH_MULTIPATH_SETTING_PANEL_PATH_TABGROUP),this.setPropStoreFieldValue("pathTabGroup",i);var n=new Kekule.ChemWidget.GlyphPathSettingPanel(this);return n.addClassName(r.GLYPH_MULTIPATH_SETTING_PANEL_PATH_SETTING_PANEL),n.setComponents(this.DEF_COMPONENTS),this.setPropStoreFieldValue("pathSettingPanel",n),o},getStartingArrowSetter:function(){return this.getPathSettingPanel().getStartingArrowSetter()},getEndingArrowSetter:function(){return this.getPathSettingPanel().getEndingArrowSetter()},_updatePathTabGroup:function(e){this.getActivePathIndex();var t=this.getPathCount();if(t!==e){var o=this.getPathTabGroup(),r=o.getTabButtons();if(t>e)for(var i=t-1;i>=e;--i){var n=r[i];o.removeWidget(n)}else for(i=t;i<e;++i){n=new Kekule.Widget.RadioButton(o);var a=Kekule.$L("ChemWidgetTexts.CAPTION_PATH_INDEX").format(""+(i+1)),l=Kekule.$L("ChemWidgetTexts.HINT_PATH_INDEX").format(""+(i+1));n.setText(a).setHint(l)}}},_switchToNewPathTab:function(e){if(e>=0){var t=(this.getValue()||[])[e];this.getPathSettingPanel().setValue(t||{})}},reactChildSetterValueChange:function(e){var t=this.getActivePathIndex();if(t>=0){var o=e.widget;if(o===this.getPathSettingPanel()){var r=o.getValue();e.stopPropagation();var i=this.getValue()||[];i[t]=r,this.setPropStoreFieldValue("value",i),this.notifyPropSet("value",i),this.invokeEvent("valueChange",{value:i})}}},reactChildSetterValueInput:function(e){var t=this.getActivePathIndex();if(t>=0){var o=e.widget;if(o===this.getPathSettingPanel()){var r=o.getValue();e.stopPropagation();var i=this.getValue()||[];i[t]=r,this.setPropStoreFieldValue("value",i),this.notifyPropSet("value",i),this.invokeEvent("valueInput",{value:i})}}},reactPathTabSwitch:function(e){if(e.widget===this.getPathTabGroup()){var t=e.button,o=this.getPathTabGroup().getTabButtons().indexOf(t);this._switchToNewPathTab(o)}}}),Kekule.ChemWidget.GlyphReactionArrowPathSettingPanel=Class.create(Kekule.ChemWidget.GlyphPathSettingPanel,{CLASS_NAME:"Kekule.ChemWidget.GlyphReactionArrowPathSettingPanel",doGetValue:function(){var e=this.tryApplySuper("doGetValue")||{};return this._reactionArrowPresetSelector&&(e.reactionArrowType=this._reactionArrowPresetSelector.getValue()),e},doSetValue:function(e){this.tryApplySuper("doSetValue",[e]),this._reactionArrowPresetSelector&&(this._reactionArrowPresetSelector.setValue(e.reactionArrowType),this._updateArrowSettingPanelEnableState())},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_REACTION_ARROW_PATH_SETTING_PANEL},doCreateSubElements:function(e,t){var o=this.doCreateReactionArrowPresetSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_REACTION_ARROW_TYPE"));this._reactionArrowPresetSelector=o.widget,this._reactionArrowPresetElem=o.elem;var r=this.tryApplySuper("doCreateSubElements",[e,t]);return this.updateComponents(),r},doCreateReactionArrowPresetSection:function(e,t,o){var i=this.doCreateSectionElem(e,t,o,r.GLYPH_REACTION_ARROW_PATH_SETTING_PANEL_ARROW_PRESET_SECTION),n=new Kekule.ChemWidget.GlyphReactionArrowPresetSelector(this);return n.appendToElem(i),{elem:i,widget:n}},updateComponents:function(){this.tryApplySuper("updateComponents"),this._updateArrowSettingPanelEnableState()},_updateArrowSettingPanelEnableState:function(){var e=Kekule.Glyph.ReactionArrowType,o=this._reactionArrowPresetSelector.getValue(),r=null,i=null,n=e.getDefPathParamOfArrowType(o);if(n){n.startArrowType,n.endArrowType;var a=n.hasOwnProperty("startArrowType")&&n.startArrowType,l=n.hasOwnProperty("endArrowType")&&n.endArrowType;if(a&&(r=this._startingArrowSetter.getDefaultAllowedArrowTypes(),r=t.exclude(r,[Kekule.Glyph.ArrowType.NONE])),l){i=this._endingArrowSetter.getDefaultAllowedArrowTypes();i=t.exclude(i,[Kekule.Glyph.ArrowType.NONE])}this._startingArrowSetter.setEnabled(a),this._endingArrowSetter.setEnabled(l)}else this._startingArrowSetter.setEnabled(!0),this._endingArrowSetter.setEnabled(!0);this._startingArrowSetter.setAllowedArrowTypes(r),this._endingArrowSetter.setAllowedArrowTypes(i)},_updatePathParamsByReactionArrowPreset:function(t){var o=Kekule.Glyph.ArrowType,r=Kekule.Glyph.ReactionArrowType.getDefPathParamOfArrowType(t);if(r||t||(r={startArrowType:o.NONE,endArrowType:o.NONE}),r){var i={},n={},a={};void 0!==r.startArrowType&&(i.arrowType=r.startArrowType),void 0!==r.startArrowSide&&(i.arrowSide=r.startArrowSide),void 0!==r.endArrowType&&(n.arrowType=r.endArrowType),void 0!==r.endArrowSide&&(n.arrowSide=r.endArrowSide),r.lineCount&&(a.lineCount=r.lineCount),r.lineGap&&(a.lineGap=r.lineGap),e.getOwnedFieldNames(i).length&&this._startingArrowSetter.setValue(Object.extend(this._startingArrowSetter.getValue(),i)),e.getOwnedFieldNames(n).length&&this._endingArrowSetter.setValue(Object.extend(this._endingArrowSetter.getValue(),n)),e.getOwnedFieldNames(a).length&&this._lineSetter.setValue(Object.extend(this._lineSetter.getValue(),a))}},getChildValueSetterWidgets:function(){var e=this.tryApplySuper("getChildValueSetterWidgets");return e.push(this._reactionArrowPresetSelector),e},reactChildSetterValueChange:function(e){e.widget===this._reactionArrowPresetSelector&&(this._updateArrowSettingPanelEnableState(),this._updatePathParamsByReactionArrowPreset(e.value)),this.tryApplySuper("reactChildSetterValueChange",[e])}}),Kekule.ChemWidget.GlyphArcPathSettingPanel=Class.create(Kekule.ChemWidget.GlyphPathSettingPanel,{CLASS_NAME:"Kekule.ChemWidget.GlyphArcPathSettingPanel",DEF_COMPONENTS:["startingArrow","endingArrow"],doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_ARC_PATH_SETTING_PANEL}}),Kekule.ChemWidget.GlyphMultiArcPathSettingPanel=Class.create(Kekule.ChemWidget.GlyphMultiPathSettingPanel,{CLASS_NAME:"Kekule.ChemWidget.GlyphMultiArcPathSettingPanel",DEF_COMPONENTS:["startingArrow","endingArrow"],doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_MULTIARC_PATH_SETTING_PANEL}}),Kekule.ChemWidget.BaseGlyphElectronArrowSettingPanel=Class.create(Kekule.Widget.Panel,{CLASS_NAME:"Kekule.ChemWidget.BaseGlyphElectronArrowSettingPanel",DEF_COMPONENTS:["endingArrow"],initialize:function(e){this._glyphPathSettingPanel=null,this._endingArrowSetter=null,this._arrowPresetSelector=null,this.tryApplySuper("initialize",[e]),this.addEventListener("valueChange",this.reactChildSetterValueChange.bind(this)),this.addEventListener("valueInput",this.reactChildSetterValueInput.bind(this))},initProperties:function(){this.defineProp("value",{dataType:DataType.HASH,getter:function(){var e=this._glyphPathSettingPanel.getValue()||{};return e.electronCount=this._arrowPresetSelector.getValue(),e},setter:function(e){this._glyphPathSettingPanel.setValue(e),this._arrowPresetSelector.setValue(e&&e.electronCount),this._updateArrowSettingPanel()}})},doCreateSubElements:function(e,t){var i=this.tryApplySuper("doCreateSubElements",[e,t]),n=this.doCreateArrowPresetSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_ELECTRON_PUSHING_ARROW_TYPE"));this._arrowPresetSelector=n.widget,this._arrowPresetElem=n.elem,Kekule.HtmlElementUtils.addClass(this._arrowPresetElem,r.GLYPH_REACTION_ARROW_PATH_SETTING_PANEL_ARROW_PRESET_SECTION);var a=this.doCreateGlyphPathSettingSection(e,t);if(this._glyphPathSettingPanel=a.widget,this._glyphPathSettingPanel&&(this._glyphPathSettingPanel.removeClassName(o.PANEL),this._glyphPathSettingPanel.setComponents&&this._glyphPathSettingPanel.setComponents(this.DEF_COMPONENTS),this._glyphPathSettingPanel.getEndingArrowSetter)){this._endingArrowSetter=this._glyphPathSettingPanel.getEndingArrowSetter();var l=Kekule.Glyph.ArrowType;this._endingArrowSetter.setAllowedArrowTypes([l.OPEN,l.TRIANGLE])}return i.concat([n.elem,a.elem])},doCreateSectionElem:function(e,t,o,i){var n=e.createElement("div");if(o){var a=e.createElement("label");Kekule.DomUtils.setElementText(a,o),a.className=r.GLYPH_PATH_SETTING_PANEL_SECTION_TITLE,n.appendChild(a)}var l=r.GLYPH_PATH_SETTING_PANEL_SECTION;return i&&(l+=" "+i),n.className=l,t.appendChild(n),n},doCreateArrowPresetSection:function(e,t,o){var r=this.doCreateSectionElem(e,t,o),i=new Kekule.ChemWidget.GlyphElectronPushingArrowPresetSelector(this);return i.appendToElem(r),{elem:r,widget:i}},doCreateGlyphPathSettingSection:function(e,t,o){var r=this.doCreateGlyphPathSettingWidget();if(r){var i=this.doCreateSectionElem(e,t,o);return r.appendToElem(i),{elem:i,widget:r}}return null},doCreateGlyphPathSettingWidget:function(){return null},reactChildSetterValueChange:function(e){var t=e.widget;t===this._arrowPresetSelector&&this._updateArrowSettingPanel(),[this._arrowPresetSelector,this._glyphPathSettingPanel].indexOf(t)>=0&&(e.stopPropagation(),this.invokeEvent("valueChange",{value:this.getValue()})),this.tryApplySuper("reactChildSetterValueChange",[e])},reactChildSetterValueInput:function(e){var t=e.widget;t===this._arrowPresetSelector&&this._updateArrowSettingPanel(),[this._arrowPresetSelector,this._glyphPathSettingPanel].indexOf(t)>=0&&(e.stopPropagation(),this.invokeEvent("valueInput",{value:this.getValue()})),this.tryApplySuper("reactChildSetterValueInput",[e])},_updateArrowSettingPanel:function(){var e=Kekule.Glyph.ArrowSide,t=this._endingArrowSetter,o=this._arrowPresetSelector.getValue(),r=[];r=o>=2?[e.BOTH]:1===o?[e.SINGLE,e.REVERSED]:[e.BOTH,e.SINGLE,e.REVERSED],t.setAllowedArrowSides(r)}}),Kekule.ChemWidget.GlyphElectronPushingArrowSettingPanel=Class.create(Kekule.ChemWidget.BaseGlyphElectronArrowSettingPanel,{CLASS_NAME:"Kekule.ChemWidget.GlyphElectronPushingArrowSettingPanel",doCreateGlyphPathSettingWidget:function(){return new Kekule.ChemWidget.GlyphArcPathSettingPanel(this)}}),Kekule.ChemWidget.GlyphMultiElectronPushingArrowSettingPanel=Class.create(Kekule.ChemWidget.BaseGlyphElectronArrowSettingPanel,{CLASS_NAME:"Kekule.ChemWidget.GlyphMultiElectronPushingArrowSettingPanel",doCreateGlyphPathSettingWidget:function(){return new Kekule.ChemWidget.GlyphMultiArcPathSettingPanel(this)}}),Kekule.ChemWidget.GlyphElectronPushingArrowSettingPanel_OLD=Class.create(Kekule.ChemWidget.GlyphPathSettingPanel,{CLASS_NAME:"Kekule.ChemWidget.GlyphElectronPushingArrowSettingPanel",DEF_COMPONENTS:["endingArrow"],initialize:function(e){this.tryApplySuper("initialize",[e]);var t=Kekule.Glyph.ArrowType;this._endingArrowSetter.setAllowedArrowTypes([t.OPEN,t.TRIANGLE])},doGetValue:function(){var e=this.tryApplySuper("doGetValue")||{};return this._arrowPresetSelector&&(e.electronCount=this._arrowPresetSelector.getValue()),e},doSetValue:function(e){this.tryApplySuper("doSetValue",[e]),this._arrowPresetSelector&&(this._arrowPresetSelector.setValue(e.electronCount),this._updateArrowSettingPanel())},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_ELECTRON_PUSHING_ARROW_SETTING_PANEL},doCreateSubElements:function(e,t){var o=this.doCreateArrowPresetSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_ELECTRON_PUSHING_ARROW_TYPE"));return this._arrowPresetSelector=o.widget,this._arrowPresetElem=o.elem,this.tryApplySuper("doCreateSubElements",[e,t])},doCreateArrowPresetSection:function(e,t,o){var r=this.doCreateSectionElem(e,t,o),i=new Kekule.ChemWidget.GlyphElectronPushingArrowPresetSelector(this);return i.appendToElem(r),{elem:r,widget:i}},getChildValueSetterWidgets:function(){var e=this.tryApplySuper("getChildValueSetterWidgets");return e.push(this._arrowPresetSelector),e.push(this._reversedArrowSideCheckBox),e},reactChildSetterValueChange:function(e){e.widget===this._arrowPresetSelector&&this._updateArrowSettingPanel(),this.tryApplySuper("reactChildSetterValueChange",[e])},_updateArrowSettingPanel:function(){var e=Kekule.Glyph.ArrowSide,t=this.getEndingArrowSetter(),o=this._arrowPresetSelector.getValue(),r=[];r=o>=2?[e.BOTH]:1===o?[e.SINGLE,e.REVERSED]:[e.BOTH,e.SINGLE,e.REVERSED],t.setAllowedArrowSides(r)}}),Kekule.ChemWidget.GlyphMultiElectronPushingArrowSettingPanel_OLD=Class.create(Kekule.ChemWidget.GlyphMultiPathSettingPanel,{CLASS_NAME:"Kekule.ChemWidget.GlyphMultiElectronPushingArrowSettingPanel",DEF_COMPONENTS:["endingArrow"],doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.GLYPH_MULTI_ELECTRON_PUSHING_ARROW_SETTING_PANEL},initialize:function(e){this.tryApplySuper("initialize",[e]);var t=Kekule.Glyph.ArrowType;this._endingArrowSetter=this.getPathSettingPanel().getEndingArrowSetter(),this._endingArrowSetter.setAllowedArrowTypes([t.OPEN,t.TRIANGLE])},doGetValue:function(){var e=this.tryApplySuper("doGetValue")||{};return this._arrowPresetSelector&&(e.electronCount=this._arrowPresetSelector.getValue()),e},doSetValue:function(e){this.tryApplySuper("doSetValue",[e]),this._arrowPresetSelector&&(this._arrowPresetSelector.setValue(e.electronCount),this._updateArrowSettingPanel())},doCreateSubElements:function(e,t){var o=this.doCreateArrowPresetSection(e,t,Kekule.$L("ChemWidgetTexts.CAPTION_ELECTRON_PUSHING_ARROW_TYPE"));return this._arrowPresetSelector=o.widget,this._arrowPresetElem=o.elem,this.tryApplySuper("doCreateSubElements",[e,t])},doCreateSectionElem:function(e,t,o,i){var n=e.createElement("div"),a=e.createElement("label");Kekule.DomUtils.setElementText(a,o),n.appendChild(a);var l=r.GLYPH_PATH_SETTING_PANEL_SECTION;return i&&(l+=" "+i),n.className=l,t.appendChild(n),n},doCreateArrowPresetSection:function(e,t,o){var r=this.doCreateSectionElem(e,t,o),i=new Kekule.ChemWidget.GlyphElectronPushingArrowPresetSelector(this);return i.appendToElem(r),{elem:r,widget:i}},_updateArrowSettingPanel:function(){var e=Kekule.Glyph.ArrowSide,t=this.getEndingArrowSetter(),o=this._arrowPresetSelector.getValue(),r=[];r=o>=2?[e.BOTH]:1===o?[e.SINGLE,e.REVERSED]:[e.BOTH,e.SINGLE,e.REVERSED],t.setAllowedArrowSides(r)}})}(),function(){"use strict";var e=Kekule.ArrayUtils,t=Kekule.CoordUtils,o=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{CHEMSPACE_EDITOR:"K-Chem-Space-Editor",CHEMSPACE_EDITOR2D:"K-Chem-Space-Editor2D",CHEMSPACE_EDITOR3D:"K-Chem-Space-Editor3D",CHEMEDITOR_ATOM_SETTER:"K-ChemEditor-Atom-Setter",CHEMEDITOR_TEXT_SETTER:"K-ChemEditor-Text-Setter",CHEMEDITOR_FORMULA_SETTER:"K-ChemEditor-Formula-Setter"}),Kekule.Editor.ChemSpaceEditor=Class.create(Kekule.Editor.BaseEditor,{CLASS_NAME:"Kekule.Editor.ChemSpaceEditor",initialize:function(e,t,o,r){this.setPropStoreFieldValue("allowCreateNewChild",!0),this.setPropStoreFieldValue("autoCreateNewStructFragment",!0),this.setPropStoreFieldValue("allowAppendDataToCurr",!0),this.tryApplySuper("initialize",[e,t,o,r]),this._containerChemSpace=null},initProperties:function(){this.defineProp("chemSpace",{dataType:"Kekule.ChemSpace",serializable:!1,getter:function(){return this.getChemObj()},setter:function(e){this.setChemObj(e)}}),this.defineProp("autoCreateNewStructFragment",{dataType:DataType.BOOL,getter:function(){return this.getPropStoreFieldValue("autoCreateNewStructFragment")&&this.canCreateNewChild()}}),this.defineProp("allowCreateNewChild",{dataType:DataType.BOOL}),this.defineProp("allowAppendDataToCurr",{dataType:DataType.BOOL})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setFileDroppable(!0)},canCreateNewChild:function(){return this.getChemSpace()&&(this.getAllowCreateNewChild()||this.getChemSpace().getChildCount()<=0)},getActualDrawOptions:function(){var e=this.tryApplySuper("getActualDrawOptions");return e.useExplicitSpaceSize=!0,e},doSetChemObj:function(e){var t=this.getChemObj();if(t!==e)if(t&&this._containerChemSpace&&(t.finalize(),this._containerChemSpace=null),e){if(e instanceof Kekule.ChemSpace)this._initChemSpaceDefProps(e),this.tryApplySuper("doSetChemObj",[e]);else{var o=this.createContainerChemSpace(null,e);this._containerChemSpace=o,this.tryApplySuper("doSetChemObj",[o])}if(this.getEditorConfigs().getInteractionConfigs().getAutoExpandClientSizeAfterLoading()&&this.autoExpandChemSpaceSize(),e instanceof Kekule.ChemSpace&&this.getEditorConfigs().getInteractionConfigs().getScrollToObjAfterLoading()){var r=e.getChildren();r&&r.length&&this.scrollClientToObject(r)}}else this.tryApplySuper("doSetChemObj",[e]);else this.tryApplySuper("doSetChemObj",[e])},getExportableClasses:function(){var e=this.tryApplySuper("getExportableClasses"),t=this.getChemSpace();if(t){t.iterateChildren(function(t){if(t.isStandalone&&t.isStandalone()&&t.getClass){var o=t.getClass();Kekule.ArrayUtils.pushUnique(e,o)}},!0)}return e},exportObjs:function(e){var t=this.tryApplySuper("exportObjs",[e]);if((!t||!t.length)&&e){t=[];t=this.getChemSpace().filterChildren(function(t){return t&&t instanceof e},!0)}return t},getSavingTargetObj:function(){var e=this.getChemSpace();return 1===e.getChildCount()?e.getChildAt(0):this.tryApplySuper("getSavingTargetObj")},createDefaultConfigs:function(){return Kekule.Editor.ChemSpaceEditorConfigs.getInstance()},doCreateNewDocObj:function(){return this.createContainerChemSpace()},doLoad:function(e){this._supplyChemMarkersOnObj(e),this.tryApplySuper("doLoad",[e])},doLoadEnd:function(e){var t=this.tryApplySuper("doLoadEnd",[e]),o=null;if(e){var r=e.getAllContainingConnectors();if(r&&r.length){var i=this.getRenderType()===Kekule.Render.RendererType.R3D?Kekule.CoordMode.COORD3D:Kekule.CoordMode.COORD2D;o=Kekule.ChemStructureUtils.getConnectorLengthMedian(r,i,this.getAllowCoordBorrow())}}return this.setDefBondLength(o),t},resetDisplay:function(){this.tryApplySuper("resetDisplay"),this.resetClientDisplay()},resetClientDisplay:function(e){if(!this.isUpdatingObject())return this._resetClientDisplayCore(e);var t=this;this._registerAfterUpdateObjectProc(function(){t._resetClientDisplayCore(e)})},_resetClientDisplayCore:function(e){var t=this.getChemObj();if(t){var o;e&&(o=this.getClientScrollPosition());var r=t.getScreenSize();this.changeClientSize(r.x,r.y,this.getCurrZoom());var i=this.getEditClientElem().parentNode,n=Kekule.HtmlElementUtils.getElemClientDimension(i);e?this.scrollClientTo(o.y,o.x):this.scrollClientTo(0,(r.x*this.getCurrZoom()-n.width)/2)}},zoomChanged:function(e){this.tryApplySuper("zoomChanged");var t=this.getChemObj();if(t){var o=t.getScreenSize();this.changeClientSize(o.x,o.y,e)}},createNewBoundInfoRecorder:function(e){this.tryApplySuper("createNewBoundInfoRecorder",[e]);var t=this.getBoundInfoRecorder();t&&t.addEventListener("updateBasicDrawObject",this.reactUpdateBasicDrawObject,this)},reactUpdateBasicDrawObject:function(e){var t=e.obj;if(t&&t instanceof Kekule.TextBlock){var o=e.boundInfo;this.updateTextBlockSize(t,o)}},objectChanged:function(e,t){return this.tryApplySuper("objectChanged",[e,t])},doManipulationEnd:function(){if(this.getEditorConfigs().getInteractionConfigs().getAutoExpandClientSizeAfterManipulation()){var e=this._calcChemSpaceAutoExpandInfo();if(e){var t=this._createChemSpaceAutoExpandOperations(e);if(t){this.getEnableOperHistory()&&this._appendOpersToLastManipulationOperation(t);for(var o=0,r=t.length;o<r;++o)t[o].execute()}}}return this.tryApplySuper("doManipulationEnd")},_appendOpersToLastManipulationOperation:function(e){var t=this.getOperationsInCurrManipulation();if(t&&t.length){var o=t[t.length-1],r=this.getOperHistory();if(r){var i=r.getOperations(),n=i.indexOf(o);if(n>=0){var a;o instanceof Kekule.MacroOperation?a=o:(a=new Kekule.MacroOperation([o]),i.splice(n,1,a),t.splice(t.length-1,1,a));for(var l=0,s=e.length;l<s;++l)a.add(e[l])}}}},updateTextBlockSize:function(e,t){if(this.getCoordMode()===Kekule.CoordMode.COORD2D&&e.getNeedRecalcSize()){t.shapeType;Kekule.Render.BoundShapeType.RECT}},createContainerChemSpace:function(e,t){var o=new Kekule.ChemDocument(e);if(this._initChemSpaceDefProps(o,t),t){o.appendChild(t);var r,i=o.getSizeOfMode(this.getCoordMode(),this.getAllowCoordBorrow()),n=Kekule.Render.ObjUtils.getContainerBox(t,this.getCoordMode(),this.getAllowCoordBorrow());if(this.getCoordMode()===Kekule.CoordMode.COORD2D)var a=this.getEditorConfigs().getChemSpaceConfigs().getDefPadding(),l=o.getObjScreenLengthRatio();var s=t.getAbsBaseCoord&&t.getAbsBaseCoord(this.getCoordMode(),this.getAllowCoordBorrow())||{};if(l&&n){r=Kekule.CoordUtils.divide(i,2);var d={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},u={x:r.x,y:i.y-a*l-(n.y2-n.y1)/2},c=Kekule.CoordUtils.substract(u,d);r=Kekule.CoordUtils.add(s,c)}else r=Kekule.CoordUtils.divide(i,2);t.setAbsBaseCoord&&t.setAbsBaseCoord(r,this.getCoordMode())}return o},_initChemSpaceDefProps:function(e,t,o){var r=this.getEditorConfigs(),i=r.getChemSpaceConfigs();if(this.getCoordMode()===Kekule.CoordMode.COORD2D){var n=e.getScreenSize();if(n.x||n.y||(n=i.getDefScreenSize2D(),e.setScreenSize(n)),!e.getDefAutoScaleRefLength()){var a,l;if(t&&t.getAllAutoScaleRefLengths)a=(l=t.getAllAutoScaleRefLengths(this.getCoordMode(),this.getAllowCoordBorrow()))&&l.length?Kekule.ArrayUtils.getMedian(l):null;else a=(l=e.getAllAutoScaleRefLengths(this.getCoordMode(),this.getAllowCoordBorrow())).length?Kekule.ArrayUtils.getMedian(l):null;a||(a=r.getStructureConfigs().getDefBondLength()),e.setDefAutoScaleRefLength(a)}if(!e.getSize2D()||o){var s=this.getRenderConfigs().getLengthConfigs().getDefBondLength(),d=e.getDefAutoScaleRefLength()/s;e.setObjScreenLengthRatio(d),e.setSize2D({x:n.x*d,y:n.y*d})}}e.setIsEditing&&e.setIsEditing(!0)},_getChemSpaceObjScreenLengthRatio:function(){var e=this.getChemSpace(),t=e.getObjScreenLengthRatio();if(!t){var o=this.getRenderConfigs().getLengthConfigs().getDefBondLength();t=e.getDefAutoScaleRefLength()/o}return t},changeChemSpaceSize:function(e,t){var o=this.getChemSpace();o.beginUpdate();try{if(o.setSizeOfMode(e,t),t===Kekule.CoordMode.COORD2D){var r=this._getChemSpaceObjScreenLengthRatio();r&&o.setScreenSize({x:e.x/r,y:e.y/r})}}finally{o.endUpdate()}this.resetClientDisplay(!0)},changeChemSpaceScreenSize:function(e){var t=this.getChemSpace();t.beginUpdate();try{var o=this._getChemSpaceObjScreenLengthRatio();o&&t.setSize2D({x:e.x*o,y:e.y*o}),t.setScreenSize(e)}finally{t.endUpdate()}this.resetClientDisplay(!0)},_shiftChemSpaceChildCoord:function(e,o,r){var i=this.getChemSpace(),n=i.getChildren();if(n){var a;r&&(a=this.getClientScrollCoord(Kekule.Editor.CoordSys.CHEM)),this.beginUpdateObject();try{i.beginUpdate();try{for(var l=this.getAllowCoordBorrow(),s=0,d=n.length;s<d;++s){var u=n[s];if(u&&u.setCoordOfMode){var c=u.getCoordOfMode(o,l)||{};u.setCoordOfMode(t.add(c,e))}}r&&this.scrollClientToCoord(a,Kekule.Editor.CoordSys.CHEM)}finally{i.endUpdate()}}finally{this.endUpdateObject()}}},_calcExpandChemSpaceSizeToTargetObjsInfo:function(e,t){if(e&&e.length){var o=this._getTargetObjsExposedContainerBoxInfo(e).totalBox;if(o)return this._calcExpandChemSpaceSizeToContainerBoxInfo(o,t)}return null},_calcExpandChemSpaceSizeToContainerBoxInfo:function(e,o){var r=Kekule.CoordMode,i=this.getChemSpace(),n=o===r.COORD3D,a=["x","y"];n&&a.push("z");for(var l=this.getEditorConfigs().getChemSpaceConfigs(),s=this._getChemSpaceObjScreenLengthRatio(),d=l.getDefPadding()*s,u=n?i.getSize3D():i.getSize2D(),c=Kekule.BoxUtils.getMinMaxCoords(e),p=c.min,h={},g=!1,C=0,_=a.length;C<_;++C){(O=p[a[C]])<d?(h[a[C]]=d-O,g=!0):h[a[C]]=0}var f=c.max,y={},m=!1;for(C=0,_=a.length;C<_;++C){var O;(O=f[a[C]])>u[a[C]]-d?(y[a[C]]=O-(u[a[C]]-d),m=!0):y[a[C]]=0}var E={},T={};if(g||m){var S=n?l.getAutoExpandScreenSize2D():l.getAutoExpandScreenSize3D(),A=t.multiply(S,s);for(C=0,_=a.length;C<_;++C){var k=a[C];E[k]=h[k]+y[k];var b=Math.ceil(E[k]/A[k]);T[k]=b*A[k]}var I={newSize:t.add(u,T)};return g&&(I.coordShift=h),I}return null},_expandChemSpaceSizeAndShiftChildrenCoords:function(e,t,o){this.beginUpdateObject();try{t&&this._shiftChemSpaceChildCoord(t,o,!0),this.changeChemSpaceSize(e,o)}finally{this.endUpdateObject()}},_expandChemSpaceSizeToContainerBox:function(e,t){var o=this._calcExpandChemSpaceSizeToContainerBoxInfo(e,t);return o&&this._expandChemSpaceSizeAndShiftChildrenCoords(o.newSize,o.coordShift,t),o},expandChemSpaceSizeToTargetObjs:function(e,t){if(Kekule.ObjUtils.isUnset(t)&&(t=this.getCoordMode()),e&&e.length){var o=this._getTargetObjsExposedContainerBoxInfo(e).totalBox;o&&this._expandChemSpaceSizeToContainerBox(o,t)}return this},autoExpandChemSpaceSize:function(){if(this._isAutoExpandingChemSpace)return this;this._isAutoExpandingChemSpace=!0;try{var e=this.getChemSpace().getChildren();e&&this.expandChemSpaceSizeToTargetObjs(e,this.getCoordMode())}finally{this._isAutoExpandingChemSpace=!1}return this},_calcChemSpaceAutoExpandInfo:function(){var e=this.getChemSpace().getChildren();return e?this._calcExpandChemSpaceSizeToTargetObjsInfo(e,this.getCoordMode()):null},_createChemSpaceAutoExpandOperations:function(e){if(e){var t=[],o=this.getChemSpace(),r=this.getCoordMode();return t.push(new Kekule.ChemSpaceEditorOperation.ChangeSpaceSizeAndShiftChildrenCoords(o,e.newSize,e.coordShift,r,this)),t}return null},createNewStructFragmentAnchor:function(e){if(this.getAutoCreateNewStructFragment()){var t=new Kekule.Molecule(e);return this.getChemSpace().appendChild(t),t}return null},createStructStartingAtom:function(e,t,o,r){this.beginUpdateObject();try{if(e){r||(r=this.getEditorConfigs().getStructureConfigs().getDefIsotopeId());var i=new Kekule.Atom(null,r);return e.appendNode(i),i.setAbsCoordOfMode(o,this.getCoordMode()),i}return null}finally{this.endUpdateObject()}},createNewStructFragmentAndStartingAtom:function(e,t,o){this.beginUpdateObject();try{var r;return(r=this.createNewStructFragmentAnchor(e))?this.createStructStartingAtom(r,e,t,o):null}finally{this.endUpdateObject()}},hasOnlyOneBlankStructFragment:function(){var e=!1;if(1===this.getChemSpace().getChildCount()){var t=this.getChemSpace().getChildAt(0);t instanceof Kekule.StructureFragment&&t.getNodeCount()<=0&&t.getConnectorCount()<=0&&!t.hasFormula()&&(e=!0)}return e},getOnlyOneBlankStructFragment:function(){if(this.hasOnlyOneBlankStructFragment())return this.getChemSpace().getChildAt(0)},canAddNewStandaloneObject:function(){return this.getAllowCreateNewChild()||this.getChemSpace().getChildCount()<=0},canAddUnconnectedStructFragment:function(){return this.canAddNewStandaloneObject()||this.hasOnlyOneBlankStructFragment()},canCloneObjects:function(){return this.getAllowCreateNewChild()},cloneObjects:function(t,o,r,i){var n=this;if(!this.getChemSpace())return null;for(var a=this.getAllowCreateNewChild(),l=function(e,t){for(var o=0,r=t.length;o<r;++o){if(t[o].isChildOf(e))return!0}return!1},s=function(t,o,r){if(r.indexOf(o)>=0)e.remove(r,o);else if(t.getChildAt&&o.getChildAt)for(var i=o.getChildCount()-1;i>=0;--i){var n=t.getChildAt(i);if(r.length){var a=o.getChildAt(i);r.indexOf(a)>=0?e.remove(r,a):l(a,r)?a.getChildObjs&&s(n,a,r):t.removeChild(n)}else t.removeChild(n)}},d=function(e,t){for(var o=0,r=t.length;o<r;++o){var i=t[o];if(e===i||e.isChildOf&&e.isChildOf(i))return i}return null},u=function(t,o,r){var i,n,a=t.relation,l=t.srcParent,s=t.destParents,d=[],u=r[o.indexOf(l)];if(a.srcObj===l?n=u:(i=l.indexStackOfChild&&l.indexStackOfChild(a.srcObj))&&(n=u.getChildAtIndexStack&&u.getChildAtIndexStack(i)),!n)return null;for(var c=e.isArray(a.dest),p=c?a.dest:[a.dest],h=0,g=s.length;h<g;++h){var C,_=s[h],f=r[o.indexOf(_)];_&&(_===p[h]?d.push(f):p[h]&&(i=_.indexStackOfChild&&_.indexStackOfChild(p[h]))&&(C=f.getChildAtIndexStack&&f.getChildAtIndexStack(i))&&d.push(C))}if(!d.length)return null;var y=c?d:d[0];return{srcObj:n,srcProp:a.srcProp,dest:y}},c=Kekule.ArrayUtils.toArray(t),p=[],h=new Kekule.MapEx,g=0,C=c.length;g<C;++g){var _=(S=c[g]).getStandaloneAncestor?S.getStandaloneAncestor():S;if(_.clone){Kekule.ArrayUtils.pushUnique(p,_);var f=h.get(_);f||(f=[],h.set(_,f)),f.push(S)}}var y=function(t,o){var r=[];o||(o=n.getChemObj());var i=o.getObjRefRelations&&o.getObjRefRelations();if(i)for(var a=0,l=i.length;a<l;++a){var s=i[a],u=s.srcObj,c=e.toArray(s.dest),p=d(u,t),h=[],g=!1;if(p){for(var C=0,_=c.length;C<_;++C){var f=c[C],y=d(f,t);y&&(g=!0),h.push(y)}g&&r.push({relation:s,srcParent:p,destParents:h})}}return r}(p,this.getChemSpace()),m=this.getChemSpace(),O=[],E=(this.getCoordMode(),this.getAllowCoordBorrow(),p.length);for(g=0;g<E;++g){(A=(S=p[g]).clone()).clearIds&&A.clearIds(),O.push(A)}var T=[];for(g=0,C=y.length;g<C;++g){(D=u(y[g],p,O))&&T.push(D)}for(g=0;g<E;++g){var S=p[g],A=O[g];if(s(A,S,h.get(S)),r&&a&&(m.appendChild(A),o)){var k=this.getObjectScreenCoord(A),b=Kekule.CoordUtils.add(k,o);this.setObjectScreenCoord(A,b)}}for(g=0,C=T.length;g<C;++g){var I,D=T[g];if(d(D.srcObj,O)){if(e.isArray(D.dest)){I=[];for(var P=0,K=D.dest.length;P<K;++P){var R=D.dest[P];d(R,O)&&I.push(R)}I.length||(I=null)}else d(D.dest,O)&&(I=D.dest);I&&D.srcObj.setPropValue(D.srcProp.name,I)}}return h.finalize(),O},cloneSelection:function(t,o,r){void 0===t&&(t=this.getDefaultCloneScreenCoordOffset());var i=this.getSelection();i=function(t,o){for(var r=[],i=0,n=t.length;i<n;++i){var a=t[i];if(a instanceof Kekule.ChemSpace&&!o){var l=a.getChildren();e.pushUnique(r,l)}else e.pushUnique(r,a)}return r}(i,r);var n=this.cloneObjects(i,t,o);return o&&this.setSelection(n),n},getDefaultCloneScreenCoordOffset:function(){var e=this.getEditorConfigs().getInteractionConfigs().getClonedObjectScreenOffset()||0,t={x:e,y:e};return this.getCoordMode()===Kekule.CoordMode.COORD3D&&(t.z=e),t},_supplyChemMarkersOnObj:function(e){if(e){var t=Kekule.ChemStructureUtils.getAllStructFragments(e,!0);if(t||t.length)for(var o=0,r=t.length;o<r;++o)this._createLosingChemMarkerOnStructFragment(t[o])}},_createLosingChemMarkerOnStructFragment:function(e){e.beginUpdate();try{e.getCharge&&e.getCharge()&&e.fetchChargeMarker(!0);e.getNodes();for(var t=0,o=e.getNodeCount();t<o;++t){var r=e.getNodeAt(t);r.beginUpdate();try{r.getCharge()&&r.fetchChargeMarker(!0),r.getRadical()&&r.fetchRadicalMarker(!0),r.getNodeAt&&this._createLosingChemMarkerOnStructFragment(r)}finally{r.endUpdate()}}}finally{e.endUpdate()}},getEnabledNonAtomInputData:function(){var e=[],t=this.getRenderConfigs().getDisplayLabelConfigs(),o=this.getEditorConfigs().getStructureConfigs().getEnabledNonAtomNodeTypes();return o.RGroup&&e.push({text:t.getRgroup(),nodeClass:Kekule.RGroup,description:Kekule.$L("ChemWidgetTexts.CAPTION_RGROUP")}),o.pseudoatomDummy&&e.push({text:t.getDummyAtom(),nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.DUMMY},description:Kekule.$L("ChemWidgetTexts.CAPTION_DUMMY_ATOM")}),o.pseudoatomHetero&&e.push({text:t.getHeteroAtom(),nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.HETERO},description:Kekule.$L("ChemWidgetTexts.CAPTION_HETERO_ATOM")}),o.pseudoatomAny&&e.push({text:t.getAnyAtom(),nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.ANY},description:Kekule.$L("ChemWidgetTexts.CAPTION_ANY_ATOM")}),o.variableAtomList&&e.push({text:this._getVarAtomListLabel(),nodeClass:Kekule.VariableAtom,isVarList:!0,description:Kekule.$L("ChemWidgetTexts.CAPTION_VARIABLE_ATOM")}),o.variableAtomNotList&&e.push({text:this._getVarAtomNotListLabel(),nodeClass:Kekule.VariableAtom,isVarNotList:!0,description:Kekule.$L("ChemWidgetTexts.CAPTION_VARIABLE_NOT_ATOM")}),e},_getVarAtomListLabel:function(){var e=this.getRenderConfigs().getDisplayLabelConfigs();return e?e.getVariableAtom():Kekule.ChemStructureNodeLabels.VARIABLE_ATOM},_getVarAtomNotListLabel:function(){var e=this.getRenderConfigs().getDisplayLabelConfigs();return"~"+(e?e.getVariableAtom():Kekule.ChemStructureNodeLabels.VARIABLE_ATOM)},getEnabledBondFormData:function(){for(var e=Kekule.BondType,t=Kekule.BondOrder,o=Kekule.BondStereo,r=Kekule.$L,i="K-Chem-MolBondIaController-",n={single:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_SINGLE"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_SINGLE"),htmlClass:i+"Single",isDefault:!0,bondProps:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.NONE}},double:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_DOUBLE"),htmlClass:i+"Double",bondProps:{bondType:e.COVALENT,bondOrder:t.DOUBLE,stereo:o.NONE}},triple:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_TRIPLE"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_TRIPLE"),htmlClass:i+"Triple",bondProps:{bondType:e.COVALENT,bondOrder:t.TRIPLE,stereo:o.NONE}},quad:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_QUAD"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_QUAD"),htmlClass:i+"Quad",bondProps:{bondType:e.COVALENT,bondOrder:t.QUAD,stereo:o.NONE}},explicitAromatic:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_EXPLICIT_AROMATIC"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_EXPLICIT_AROMATIC"),htmlClass:i+"Aromatic",bondProps:{bondType:e.COVALENT,bondOrder:t.EXPLICIT_AROMATIC,stereo:o.NONE}},up:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEUP"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_WEDGEUP"),htmlClass:i+"WedgeUp",bondProps:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.UP}},upInverted:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEUP_INVERTED"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_WEDGEUP_INVERTED"),htmlClass:i+"WedgeUpInverted",bondProps:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.UP_INVERTED}},down:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEDOWN"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_WEDGEDOWN"),htmlClass:i+"WedgeDown",bondProps:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.DOWN}},downInverted:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEDOWN_INVERTED"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_WEDGEDOWN_INVERTED"),htmlClass:i+"WedgeDownInverted",bondProps:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.DOWN_INVERTED}},upOrDown:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_WAVY"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_WAVY"),htmlClass:i+"WedgeUpOrDown",bondProps:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.UP_OR_DOWN}},closer:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_CLOSER"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_CLOSER"),htmlClass:i+"Closer",bondProps:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.CLOSER}},eOrZ:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE_EITHER"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_DOUBLE_EITHER"),htmlClass:i+"Double-Either",bondProps:{bondType:e.COVALENT,bondOrder:t.DOUBLE,stereo:o.E_OR_Z}},ionic:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_IONIC"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_IONIC"),htmlClass:i+"Ionic",bondProps:{bondType:e.IONIC,bondOrder:t.SINGLE,stereo:o.NONE}},coordinate:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_COORDINATE"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_COORDINATE"),htmlClass:i+"Coordinate",bondProps:{bondType:e.COORDINATE,bondOrder:t.SINGLE,stereo:o.NONE}},metallic:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_METALLIC"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_METALLIC"),htmlClass:i+"Metallic",bondProps:{bondType:e.METALLIC,bondOrder:t.SINGLE,stereo:o.NONE}},hydrogen:{text:r("ChemWidgetTexts.CAPTION_MOL_BOND_HYDROGEN"),hint:r("ChemWidgetTexts.HINT_MOL_BOND_HYDROGEN"),htmlClass:i+"Hydrogen",bondProps:{bondType:e.HYDROGEN,bondOrder:t.SINGLE,stereo:o.NONE}}},a=(r("ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE"),r("ChemWidgetTexts.HINT_MOL_BOND_DOUBLE"),this.getEditorConfigs().getStructureConfigs().getEnabledBondForms()),l=Kekule.ObjUtils.getOwnedFieldNames(a,!1),s=[],d=0,u=l.length;d<u;++d){var c=l[d];a[c]&&(DataType.isObjectValue(a[c])?s.push(a[c]):n[c]&&s.push(n[c]))}return s}}),Kekule.Editor.ChemSpaceEditor.Settings=Class.create(Kekule.Editor.BaseEditor.Settings,{CLASS_NAME:"Kekule.Editor.ChemSpaceEditor.Settings",initProperties:function(){this.defineProp("allowCreateNewChild",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getEditor().getAllowCreateNewChild()},setter:function(e){this.getEditor().setAllowCreateNewChild(e)}}),this.defineProp("autoCreateNewStructFragment",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getEditor().getAutoCreateNewStructFragment()},setter:function(e){this.getEditor().setAutoCreateNewStructFragment(e)}}),this.defineProp("allowAppendDataToCurr",{dataType:DataType.BOOL,serializable:!1,getter:function(){return this.getEditor().getAllowAppendDataToCurr()},setter:function(e){this.getEditor().setAllowAppendDataToCurr(e)}})}}),Kekule.Editor.BasicMolEraserIaController=Class.create(Kekule.Editor.BasicEraserIaController,{CLASS_NAME:"Kekule.Editor.BasicMolEraserIaController",initialize:function(e){this.tryApplySuper("initialize",[e])},doGetActualRemovedObjs:function(e){for(var t=[],o=this.getEditor().getChemObj(),r=0,i=e.length;r<i;++r){var n,a=e[r];a instanceof Kekule.ChemSpace&&a===o?n=a.getChildren():(Kekule.ArrayUtils.pushUnique(t,a),n=a.getCascadeDeleteObjs?a.getCascadeDeleteObjs():[]),n&&Kekule.ArrayUtils.pushUnique(t,n)}return t},doRemoveObjs:function(e){if(e.length){for(var t=new Kekule.MacroOperation,o=[],r=0,i=e.length;r<i;++r){var n,a=e[r],l=(a.getParent(),this.getEditor());a instanceof Kekule.BaseStructureNode?(n=new Kekule.ChemStructOperation.RemoveNode(a,null,null,l),Kekule.ArrayUtils.pushUnique(o,a.getParent())):a instanceof Kekule.BaseStructureConnector?(n=new Kekule.ChemStructOperation.RemoveConnector(a,null,null,l),Kekule.ArrayUtils.pushUnique(o,a.getParent())):n=new Kekule.ChemObjOperation.Remove(a,null,null,l),n&&t.add(n)}for(r=0,i=o.length;r<i;++r){var s=o[r];if(s&&s instanceof Kekule.StructureFragment){var d=new Kekule.ChemStructOperation.StandardizeStructFragment(s,l);d.setEnableSplit(this.getEditor().canCreateNewChild()),t.add(d)}}l.execOperation(t)}}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.BasicMolEraserIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.BasicMolManipulationIaController=Class.create(Kekule.Editor.BasicManipulationIaController,{CLASS_NAME:"Kekule.Editor.BasicMolManipulationIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setEnableMagneticMerge(!0),this.setEnableNodeMerge(!0),this.setEnableNeighborNodeMerge(!0),this.setEnableConnectorMerge(!0),this.setEnableStructFragmentMerge(!0),this.setEnableNodeStick(!0),this.setEnableStructFragmentStick(!0),this.setEnableConstrainedMove(!0),this.setEnableConstrainedRotate(!0),this.setEnableConstrainedResize(!0),this.setEnableDirectedMove(!0),this._suppressConstrainedMoving=!1,this._suppressConstrainedRotating=!1,this._isInDirectedMoving=!1,this._directedMovingDirection=null},initProperties:function(){this.defineProp("enableMagneticMerge",{dataType:DataType.BOOL}),this.defineProp("enableNodeMerge",{dataType:DataType.BOOL}),this.defineProp("enableNeighborNodeMerge",{dataType:DataType.BOOL}),this.defineProp("enableConnectorMerge",{dataType:DataType.BOOL}),this.defineProp("enableStructFragmentMerge",{dataType:DataType.BOOL}),this.defineProp("allManipulateObjsMerged",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("isMergeDone",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableNodeStick",{dataType:DataType.BOOL}),this.defineProp("enableSiblingStick",{dataType:DataType.BOOL}),this.defineProp("enableStructFragmentStick",{dataType:DataType.BOOL}),this.defineProp("enableConstrainedMove",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableConstrainedRotate",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableConstrainedResize",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("enableDirectedMove",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("stickOperations",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("mergeOperations",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("mergePreviewOperations",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("mergingDests",{dataType:DataType.ARRAY,serializable:!1})},canInteractWithObj:function(e){return this.tryApplySuper("canInteractWithObj",[e])||this._isMerging&&e},doSetManipulateObjs:function(t){var o=t?e.clone(t):[];this.getMergingDests()&&!this.useMergePreview()&&e.pushUnique(o,this.getMergingDests()),this.setPropStoreFieldValue("manipulateObjs",t),t?this.getEditor().prepareOperatingObjs(o):this.getEditor().endOperatingObjs()},isConstrainedRotate:function(){return this.getEnableConstrainedMove()},isConstrainedResize:function(){return this.getEnableConstrainedResize()},isConstrainedMove:function(){if(!this.getEnableConstrainedMove())return!1;var e=this.getManipulateObjs();if(1===e.length){var t=e[0],o=this.getEditor().getSelection();if(o&&o.indexOf(t)<0)return t.getConstraintManipulationBaseObj&&t.getConstraintManipulationBaseObj()}return!1},isInActualConstrainedRotation:function(){return this.isConstrainedRotate()&&!this._suppressConstrainedRotating},isDirectedMove:function(){return this.getEnableDirectedMove()&&!this.isConstrainedMove()&&this._isInDirectedMoving},useMergePreview:function(){return this._useMergePreview},setUseMergePreview:function(e){this._useMergePreview=e},getMergeOperationsInManipulating:function(){return this._useMergePreview?this.getMergePreviewOperations():this.getMergeOperations()},createManipulateObjInfo:function(e,t,o){var r=this.getEditor(),i=this.tryApplySuper("createManipulateObjInfo",[e,t,o]);if(this.isConstrainedMove()){var n=e.getConstraintManipulationBaseObj();if(n&&(i.isConstrained=!0,!i.hasNoCoord)){i.originScreenCoord=r.getObjectScreenCoord(e),i.refScreenCoord=r.getObjectScreenCoord(n),i.connectorScreenLength=Kekule.CoordUtils.getDistance(i.screenCoord,i.refScreenCoord),i.connectorObjLength=Kekule.CoordUtils.getDistance(r.getObjCoord(e),r.getObjCoord(n));var a=Kekule.CoordUtils.substract(i.originScreenCoord,i.refScreenCoord);i.originBondDirectionAngle=Math.atan2(a.y,a.x),i.constrainedBondDirectionDelta=this.getEditorConfigs().getStructureConfigs().getBondConstrainedDirectionDelta(),i.constrainedBondDirectionAngles=this.getEditorConfigs().getStructureConfigs().getBondConstrainedDirectionAngles(),i.constrainedBondDirectionAngleThreshold=this.getEditorConfigs().getStructureConfigs().getBondConstrainedDirectionAngleThreshold()}}return i},getAllowLengthChangeInConstrainedMoving:function(e){return e instanceof Kekule.Glyph.PathGlyphNode},_calcActualMovedScreenCoord:function(e,t,o){var r,i=Kekule.CoordUtils,n=o;if(t.isConstrained&&!this._suppressConstrainedMoving){var a,l,s=t.constrainedBondDirectionDelta||null,d=t.constrainedBondDirectionAngles||null,u=t.constrainedBondDirectionAngleThreshold||null,c=!1,p=i.substract(o,t.refScreenCoord),h=Math.atan2(p.y,p.x),g=i.getDistance(p);if(d&&u)for(var C=0,_=d.length;C<_;++C){var f=d[C];Math.abs(f-h)<=u&&(c=!0,a=f)}if(!c&&s){var y=Math.round((h-t.originBondDirectionAngle)/s);a=t.originBondDirectionAngle+y*s,c=!0}if(c||(a=h),this.getAllowLengthChangeInConstrainedMoving(e)){var m=this.getEditor().getDefBondScreenLength(),O=g/m,E=this.getEditorConfigs().getInteractionConfigs().getConstrainedResizeStep();l=m*(O=(Math.round(O/E)||1)*E)}else l=t.connectorScreenLength;r=i.add(t.refScreenCoord,{x:l*Math.cos(a),y:l*Math.sin(a)})}else r=n;return r},_calcActualRotateAngle:function(e,t,o,r){var i=this.isConstrainedRotate()&&!this._suppressConstrainedRotating?this.getEditorConfigs().getInteractionConfigs().getConstrainedRotateStep():null;return i?Math.round(t/i)*i:this.tryApplySuper("_calcActualRotateAngle",[e,t])},_calcActualResizeScales:function(e,t){if(this.isConstrainedResize()&&!this._suppressConstrainedResize){var o=this.getEditorConfigs().getInteractionConfigs().getConstrainedResizeStep();return o?{scaleX:(Math.round(t.scaleX/o)||1)*o,scaleY:(Math.round(t.scaleY/o)||1)*o}:t}return t},prepareManipulating:function(e,t,o,r,i,n){this.setUseMergePreview(this.getEditorConfigs().getInteractionConfigs().getEnableMergePreview()),this.setMergeOperations([]),this.setMergePreviewOperations([]),this.setStickOperations([]),this.tryApplySuper("prepareManipulating",[e,t,o,r,i,n]),this._directedMovingDirection=null,this.setManuallyHotTrack(!0)},manipulateBeforeStopping:function(){if(this.tryApplySuper("manipulateBeforeStopping"),this.useMergePreview()){var e=this.getMergePreviewOperations();if(e&&e.length){for(var t=this.getMergeOperations(),o=0,r=e.length;o<r;++o){var i=e[o];if(i){var n=i instanceof Kekule.ChemStructOperation.MergeConnectorsBase?this.createConnectorMergeOperation(i.getTarget(),i.getDest()):this.createNodeMergeOperation(i.getTarget(),i.getDest());t.push(n)}}this.executeMergeOpers(t)}}},manipulateEnd:function(){this.tryApplySuper("manipulateEnd"),this.getEditor().hideHotTrack(),this.setManuallyHotTrack(!1)},createManipulateOperation:function(){this.tryApplySuper("createManipulateOperation"),this.setMergeOperations([]),this.setMergePreviewOperations([]),this.setStickOperations([])},getAllObjOperations:function(e){var t=this.getMergeOperations(),o=this.tryApplySuper("getAllObjOperations")||[];t&&t.length&&Kekule.ArrayUtils.pushUnique(o,t);var r=this.getStickOperations();if(r&&r.length)for(var i=0,n=r.length;i<n;++i){var a=r[i];a&&(a.getStickTarget&&!a.getStickTarget()?o.unshift(a):o.push(a))}return o},_objCanBeMagneticMerged:function(e){return!(e instanceof Kekule.StructureFragment)&&(e instanceof Kekule.ChemStructureNode||e instanceof Kekule.ChemStructureConnector)},_objCanBeMagneticSticked:function(e){return!(e instanceof Kekule.StructureFragment)&&(e instanceof Kekule.BaseStructureNode&&e.getAllowCoordStickTo())},_canStickNode:function(e,t){if(this.getEnableNodeStick()){var o=this.getEnableStructFragmentStick(),r=this.getEnableSiblingStick();return Kekule.ChemObjOperation.StickTo.canStick(e,t,o,r)}return!1},_canMergeNodes:function(e,t){if(this.getEnableNodeMerge()){var o=this.getEnableStructFragmentMerge(),r=this.getEnableNeighborNodeMerge();return Kekule.ChemStructOperation.MergeNodes.canMerge(e,t,o,r)}return!1},_canMergeConnectors:function(e,t){if(this.getEnableConnectorMerge()){var o=this.getEnableStructFragmentMerge();return Kekule.ChemStructOperation.MergeConnectors.canMerge(e,t,o)}return!1},_findSuitableMergeTargetBoundInfo:function(e,t,o,r){for(var i=e.length-1;i>=0;--i){var n=e[i],a=n.obj;if(!(t.indexOf(a)>=0)&&(a instanceof o&&(!r||r(a))))return n}return null},_getCoordStickActualTarget:function(e){for(var t=e,o=t.getCoordStickTarget&&t.getCoordStickTarget();o;)o=(t=o).getCoordStickTarget&&t.getCoordStickTarget();return t},_getMagneticNodeMergeOrStickDestInfo:function(e,t,o){var r=this.getEditor(),i=this;if(t){var n=r.getBoundInfosAtCoord(t,function(t){var r=t.obj,n=i._getCoordStickActualTarget(r);return e!==r&&o.indexOf(r)<0&&(r instanceof Kekule.BaseStructureNode&&i._canMergeNodes(e,r)||i._canStickNode(e,n))},this.getCurrBoundInflation()),a=n.length?n[n.length-1]:null;if(a){var l=a.obj,s=this._getCoordStickActualTarget(l);return this._canMergeNodes(e,l)?{obj:l,isMerge:!0}:this._canStickNode(e,s)?{obj:s,isStick:!0}:null}return null}return null},moveManipulatedObjs:function(e){var t;if(this.isDirectedMove()){var o=Kekule.CoordUtils,r=this.getStartCoord(),i=o.getDistance(r,e),n=o.substract(e,r),a=this._directedMovingDirection;this._directedMovingDirection||(a=Math.abs(n.x)>=Math.abs(n.y)?"x":"y",i<this.getEditor().getEditorConfigs().getInteractionConfigs().getDirectedMoveDistanceThreshold()||(this._directedMovingDirection=a)),(t=Object.extend({},r))[a]=e[a]}else t=e;return this.tryApplySuper("moveManipulatedObjs",[t])},applyManipulatingObjsInfo:function(e){var t={MERGE:0,MERGE_BOND:1,STICK:10,UNSTICK:20};this.setAllManipulateObjsMerged(!1);var o=this.useMergePreview(),r=this.getEditor();r.hotTrackOnObj(null);var i=Kekule.Editor.BasicManipulationIaController.ManipulationType,n=this.getManipulationType(),a=this.getManipulateOriginObjs(),l=this.getManipulateObjs(),s=[].concat(a);Kekule.ArrayUtils.pushUnique(s,l);var d=this.getMergeOperationsInManipulating(),u=this.getStickOperations(),c=this,p=1===a.length&&a[0]instanceof Kekule.ChemStructureConnector,h=1===l.length&&l[0]instanceof Kekule.BaseStructureNode&&(this._objCanBeMagneticMerged(l[0])||this._objCanBeMagneticSticked(l[0])),g=n===i.MOVE&&!this.getIsOffsetManipulating()&&(p&&this.getEnableConnectorMerge()||h&&this.getEnableNodeMerge()),C=!p&&this.getEnableMagneticMerge();if(C||g){var _=this.getManipulateObjCurrInfoMap(),f=this.getManipulateObjInfoMap(),y=[],m=[],O=[],E=[];if(g){var T=p?a[0]:l[0],S=this._calcMagneticMergeOrStickInfoOnScreenCoord(e,T,this._isManipulatingSingleStickedObj(l),_,f,s,t);if(S)y=[0],m=[S.magneticObj],O=[S.magneticDest],E=[S.magneticType];else if(p&&this.getEnableConnectorMerge()){var A=r.getBoundInfosAtCoord(e,null,this.getCurrBoundInflation()),k=Kekule.ChemStructureConnector,b=(T=a[0],this._findSuitableMergeTargetBoundInfo(A,s,k,function(e){return c._canMergeConnectors(T,e)}));b&&(y=[0],m=[T],O=[b.obj],E=[t.MERGE_BOND])}}if(!m.length&&C){var I=this._calcMagneticMergeOrStickInfos(l,_,f,s,t);y=I.magneticObjIndexes,m=I.magneticObjs,O=I.magneticDests,E=I.magneticTypes}if(m.length||u.length){var D=m.length;this.setAllManipulateObjsMerged(D===l.length);for(var P=1===D,K=!1,R=!1,v=[],M=[],N=0,L=m.length;N<L;++N){var x=m[N],B=O[N],j=y[N];if(E[N]===t.STICK){if(!R){if(!(W=u[j])||!this.isSameNodeStick(W,x,B)){R=!0;break}M.push(W)}}else if(!K)(w=d[j])&&this.isSameNodeMerge(w,x,B)?v.push(w):K=!0;if(K&&R)break}for(N=0,L=d.length;N<L;++N){var w;if(w=d[N]){if((j=v.indexOf(w))<0){K=!0;break}v.splice(j,1)}}for(N=0,L=u.length;N<L;++N){var W;if(W=u[N]){if((j=M.indexOf(W))<0){R=!0;break}M.splice(j,1)}}if(K||R||P){K&&this.reverseMergeOpers(this.getMergeOperationsInManipulating()),R&&this.reverseStickOpers(this.getStickOperations());var U=Kekule.CoordUtils;if(1===D||r.getCoordMode()===Kekule.CoordMode.COORD3D){if(E[0]!==t.MERGE_BOND){var F=(re=_.get(m[0]))&&re.screenCoord,G=r.getObjectScreenCoord(O[0]);if(F&&G){var V=U.substract(G,F),H=!1,z=Kekule.NumUtils.isFloatEqual;if(!z(V.x,0,1e-10)||!z(V.y,0,1e-10))for(N=0,L=l.length;N<L;++N){x=l[N];var Y=_.get(x);if(x!==m[0]){if(Y&&Y.screenCoord){var $=U.add(Y.screenCoord,V);Y.screenCoord=$,this._getMagneticNodeMergeOrStickDestInfo(x,$,s)&&(H=!0)}}else Y&&Y.screenCoord&&(Y.screenCoord=G)}if(H)return this.applyManipulatingObjsInfo(e);for(N=0,L=l.length;N<L;++N){x=l[N],Y=_.get(x);this.applySingleManipulatingObjInfo(N,x,Y,e)}}}}else if(D>1&&r.getCoordMode()!==Kekule.CoordMode.COORD3D){var X=m[0],J=m[1];if(X&&J){var Z=f.get(X).screenCoord,q=f.get(J).screenCoord,Q=r.getObjectScreenCoord(O[0]),ee=r.getObjectScreenCoord(O[1]),te=U.calcCoordGroup2DTransformParams(Z,q,Q,ee),oe=U.calcTransform2DMatrix(te);for(H=!1,N=0,L=l.length;N<L;++N){x=l[N];if(m.indexOf(x)<0){Y=f.get(x);var re=_.get(x);if(Y.screenCoord){$=U.transform2DByMatrix(Y.screenCoord,oe);re.screenCoord=$,this._getMagneticNodeMergeOrStickDestInfo(x,$,s)&&(H=!0)}Y.size&&(re.size=U.multiply(Y.size,te.scale))}}if(H)return this.applyManipulatingObjsInfo(e);for(N=0,L=l.length;N<L;++N){x=l[N];if(m.indexOf(x)<0){re=_.get(x);this.applySingleManipulatingObjInfo(N,x,re,e)}}}}if(K||R){var ie=[];this._mergeOperationsChanged(D,m,O);for(N=0,L=D;N<L;++N){x=m[N],B=O[N],j=y[N];var ne=E[N];if(ne===t.STICK){if(B!==f.get(x).stickTarget)var ae=this.createNodeStickOperation(x,B);this.getStickOperations()[j]=ae,B||ie.push({index:j,obj:x,newInfo:_.get(x)})}else if(o){var le=ne===t.MERGE_BOND?this.createConnectorMergeOperation(x,B,!0):this.createNodeMergeOperation(x,B,!0);this.getMergePreviewOperations()[j]=le}else{var se=ne===t.MERGE_BOND?this.createConnectorMergeOperation(x,B):this.createNodeMergeOperation(x,B);this.getMergeOperations()[j]=se}}if(K&&this.executeMergeOpers(this.getMergeOperationsInManipulating()),R&&this.executeStickOpers(this.getStickOperations()),ie.length)for(N=0,L=ie.length;N<L;++N){var de=ie[N];this.applySingleManipulatingObjInfo(de.index,de.obj,de.newInfo,e)}}}return void r.hotTrackOnObj(O)}}(d=this.getMergeOperationsInManipulating())&&d.length&&(this._mergeOperationsChanged(0,[],[]),this.reverseMergeOpers(d)),this.tryApplySuper("applyManipulatingObjsInfo",[e])},_calcMagneticMergeOrStickInfoOnScreenCoord:function(e,t,o,r,i,n,a){var l=this.getEditor(),s=(this._objCanBeMagneticMerged,this._objCanBeMagneticSticked,t),d=e;if(d){l.getBoundInfosAtCoord(d,null,this.getCurrBoundInflation());var u=this._getMagneticNodeMergeOrStickDestInfo(s,d,n),c=null,p=null;if(u&&(u.isStick?p=u.obj:u.isMerge&&(c=u.obj)),c||p)return{magneticObj:s,magneticDest:c||p,magneticType:p?a.STICK:a.MERGE};if(!p&&o&&i.get(s).stickTarget)return{magneticObj:s,magneticDest:null,magneticType:a.STICK}}},_calcMagneticMergeOrStickInfos:function(e,t,o,r,i){for(var n=this._isManipulatingSingleStickedObj(e),a=this._objCanBeMagneticMerged,l=this._objCanBeMagneticSticked,s=(this.getEditor(),[]),d=[],u=[],c=[],p=0,h=e.length;p<h;++p){var g=e[p];if(a(g)||l(g)){var C=t.get(g),_=C&&C.screenCoord;if(_){var f=this._calcMagneticMergeOrStickInfoOnScreenCoord(_,g,n,t,o,r,i);f&&(s.push(p),d.push(f.magneticObj),u.push(f.magneticDest),c.push(f.magneticType))}}}return{magneticObjIndexes:s,magneticObjs:d,magneticDests:u,magneticTypes:c}},_mergeOperationsChanged:function(e,t,o){},doMoveManipulatedObj_old:function(e,t,o,r){var i=this.getEditor(),n=(this.getManipulateObjInfoMap().get(t),o),a=this.getManipulateOriginObjs(),l=this.getManipulationType(),s=l===Kekule.Editor.BasicManipulationIaController.ManipulationType.MOVE&&1===a.length&&a[0]instanceof Kekule.ChemStructureConnector,d=n,u=null,c=this.getMergeOperations(),p=c[e],h=this.getManipulateObjs();if(!s&&this.getEnableMagneticMerge()&&t instanceof Kekule.ChemStructureNode){var g=i.getBoundInfosAtCoord(d);if(g&&g.length){for(var C=g.length-1;C>=0;--C){var _=g[C].obj;if(_!==t&&(!(h.indexOf(_)>=0)&&_ instanceof Kekule.ChemStructureNode&&this._canMergeNodes(t,_))){if(i.addHotTrackedObj(_),this.isSameNodeMerge(p,t,_))return;u=this.createNodeMergeOperation(t,_);break}}u?(p&&this.reverseMergeOpers(e),this.getMergeOperations()[e]=u,this.executeMergeOpers()):i.hotTrackOnObj(null)}}d=r;if(l===Kekule.Editor.BasicManipulationIaController.ManipulationType.MOVE){var f=a[0];if(a&&1===a.length){var y=i.getTopmostBoundInfoAtCoord(d,[f]);if(y){var m=y.obj;if(m&&h.indexOf(m)<0){if(s&&f instanceof Kekule.ChemStructureConnector&&m instanceof Kekule.ChemStructureConnector)this.getEnableConnectorMerge()&&(i.hotTrackOnObj(m),(!!this.getEnableStructFragmentMerge()||f.getParent()===m.getParent())&&(u=this.createConnectorMergeOperation(f,m)));else if(f instanceof Kekule.ChemStructureNode&&m instanceof Kekule.ChemStructureNode&&this._canMergeNodes(f,m)){if(i.hotTrackOnObj(m),this.isSameNodeMerge(p,f,m))return;u=this.createNodeMergeOperation(f,m)}if(u)return(p=c[e])&&this.reverseMergeOpers(e),this.getMergeOperations()[e]=u,void this.executeMergeOpers()}}}}u||(i.hideHotTrack(),!!this.getMergeOperations().length&&this.reverseMergeOpers(e),this.tryApplySuper("doMoveManipulatedObj_old",[e,t,o,r]))},createNodeMergeOperation:function(e,t,o){var r=this.getEnableStructFragmentMerge();return Kekule.ChemStructOperation.MergeNodes.canMerge(e,t,r,this.getEnableNeighborNodeMerge())?o?new Kekule.ChemStructOperation.MergeNodesPreview(e,t,r,this.getEditor()):new Kekule.ChemStructOperation.MergeNodes(e,t,r,this.getEditor()):null},createConnectorMergeOperation:function(e,t,o){var r=this.getEnableStructFragmentMerge();return Kekule.ChemStructOperation.MergeConnectors.canMerge(e,t,r)?new(o?Kekule.ChemStructOperation.MergeConnectorsPreview:Kekule.ChemStructOperation.MergeConnectors)(e,t,this.getEditor().getCoordMode(),r,this.getEditor()):null},createNodeStickOperation:function(e,t){this.getEnableStructFragmentStick();return this._canStickNode(e,t)?new Kekule.ChemObjOperation.StickTo(e,t,this.getEditor()):null},isSameConnectorMerge:function(e,t,o){return e&&e instanceof Kekule.ChemStructOperation.MergeConnectorsBase&&t===e.getTarget()&&o===e.getDest()},isSameNodeMerge:function(e,t,o){return e&&e instanceof Kekule.ChemStructOperation.MergeNodesBase&&t===e.getTarget()&&o===e.getDest()},isSameNodeStick:function(e,t,o){return e&&e instanceof Kekule.ChemObjOperation.StickTo&&t===e.getTarget()&&o===e.getStickTarget()},isSameNodeMergeOrStick:function(e,t,o){return this.isSameNodeMerge(e,t,o)||this.isSameNodeStick(e,t,o)},executeStickOpers:function(e){var t=this.getEditor(),o=Kekule.ArrayUtils.toUnique(e||this.getStickOperations());t.beginUpdateObject();try{for(var r=0,i=o.length;r<i;++r)o[r]&&o[r].execute()}finally{t.endUpdateObject()}},reverseStickOpers:function(e){var t=this.getEditor(),o=e||this.getStickOperations(),r=Kekule.ArrayUtils.toUnique(o);if(r&&r.length){t.beginUpdateObject();try{for(var i=r.length-1;i>=0;--i)r[i]&&r[i].reverse();o.length=0}finally{t.endUpdateObject()}}else;},executeMergeOpers:function(t){var o=this.getEditor(),r=Kekule.ArrayUtils.toUnique(t||this.getMergeOperationsInManipulating()),i=[];o.beginUpdateObject();try{for(var n=0,a=r.length;n<a;++n)if(r[n]){r[n].execute();var l=r[n].getDest?r[n].getDest():null;l&&e.pushUnique(i,l)}this.setMergingDests(i.length?i:null),this.refreshManipulateObjs(),this._mergeJustReversed=!1}finally{o.endUpdateObject()}},reverseMergeOpers:function(e){var t=this.getEditor();this.setMergingDests(null);var o=e||this.getMergeOperationsInManipulating(),r=Kekule.ArrayUtils.toUnique(o);if(r&&r.length){t.beginUpdateObject();try{for(var i=r.length-1;i>=0;--i)r[i]&&r[i].reverse();o.length=0,this._mergeJustReversed=!0,this.refreshManipulateObjs()}finally{t.endUpdateObject()}}else;},react_pointermove:function(e){return this._suppressConstrainedMoving=e.getAltKey(),this._suppressConstrainedRotating=e.getAltKey(),this._isInDirectedMoving=e.getShiftKey(),this.tryApplySuper("react_pointermove",[e])}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.BasicMolManipulationIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.SelectIaController=Class.create(Kekule.Editor.BasicMolManipulationIaController,{CLASS_NAME:"Kekule.Editor.SelectIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setEnableSelect(!0),this.setEnableGestureManipulation(!0)}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.SelectIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.StructureInsertIaController=Class.create(Kekule.Editor.BasicMolManipulationIaController,{CLASS_NAME:"Kekule.Editor.StructureInsertIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._manipulatedBasicObjs=null},getInsertedObjs:function(){return this._manipulatedBasicObjs},doSetManipulateOriginObjs:function(e){return this._manipulatedBasicObjs=this._getManipulatedBasicObjects(e),this.tryApplySuper("doSetManipulateOriginObjs",[e])},_getManipulatedBasicObjects:function(t){for(var o=[],r=0,i=t.length;r<i;++r){var n=t[r];if(n instanceof Kekule.ChemStructureObject)if(n instanceof Kekule.StructureFragment&&n.isExpanded()){var a=[].concat(n.getNodes()).concat(n.getConnectors());e.pushUnique(o,a)}else e.pushUnique(o,n);else e.pushUniqueEx(o,n)}return o},stopManipulate:function(){if(this.needAutoSelectNewlyInsertedObjects()){var e=this.getInsertedObjs();this.doneInsertOrModifyBasicObjects(e)}return this.tryApplySuper("stopManipulate")}}),Kekule.Editor.MolBondIaController=Class.create(Kekule.Editor.StructureInsertIaController,{CLASS_NAME:"Kekule.Editor.MolBondIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setState(r.State.INITIAL),this.setBondOrder(Kekule.BondOrder.SINGLE),this.setAllowBondingToBond(!1),this.setEnableBondModification(!0),this.setEnableSelect(!1),this.setEnableMove(!0),this.setAutoSwitchBondOrder(!1),this.setEnableNeighborNodeMerge(!1)},initProperties:function(){this.defineProp("allowBondingToBond",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("state",{dataType:DataType.INT,serializable:!1}),this.defineProp("enableBondModification",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("autoSwitchBondOrder",{dataType:DataType.BOOL,serializable:!1}),this.defineProp("startingObj",{dataType:"Kekule.ChemStructureObject",serializable:!1}),this.defineProp("endingObj",{dataType:"Kekule.ChemStructureObject",serializable:!1}),this.defineProp("structFragment",{dataType:"Kekule.ChemStructureFragment",serializable:!1}),this.defineProp("autoCreatedStructFragment",{dataType:"Kekule.StructureFragment",serializable:!1}),this.defineProp("autoCreatedStartingObj",{dataType:"Kekule.ChemStructureObject",serializable:!1}),this.defineProp("bond",{dataType:"Kekule.Bond",serializable:!1}),this.defineProp("bondType",{dataType:DataType.STRING,serializable:!1}),this.defineProp("bondOrder",{dataType:DataType.INT,serializable:!1}),this.defineProp("bondStereo",{dataType:DataType.INT,serializable:!1}),this.defineProp("initialBondDirection",{dataType:DataType.FLOAT})},_isBondDifferent:function(e){var t=this.getBondStereo(),o=Kekule.BondStereo;return t===o.UP||t===o.UP_INVERTED||t===o.DOWN||t===o.DOWN_INVERTED||(e.getBondType()!==this.getBondType()||e.getBondOrder()!==this.getBondOrder()||e.getStereo()!==this.getBondStereo())},canInteractWithObj:function(e){if(this.getState()!==r.State.INITIAL)return this.tryApplySuper("canInteractWithObj",[e]);if(e instanceof Kekule.ChemStructureNode)return!0;if(e instanceof Kekule.ChemStructureConnector){if(this.getAllowBondingToBond())return!0;if(!this.getEnableBondModification())return!1;if(e instanceof Kekule.Bond)return this._isBondDifferent(e)}},doTestMouseCursor:function(e,t){return""},getInsertedObjs:function(){var e=this.getBond();return e?[e]:this.tryApplySuper("getInsertedObjs")},isObjValidBondTerminator:function(e){return!!e&&(this.getAllowBondingToBond()?e instanceof Kekule.ChemStructureNode||e instanceof Kekule.ChemStructureConnector:e instanceof Kekule.ChemStructureNode)},isBond:function(e){return e instanceof Kekule.Bond},getNewBondDefAngle:function(e,t){return this.getEditorConfigs().getStructureConfigs().getNewBondDefAngle(e,t)},addDefBond:function(e,t,o){var r;(a=this.getEditor()).beginUpdateObject();try{if(t)this.setAutoCreatedStartingObj(null),this.setAutoCreatedStructFragment(null);else{if(!this.getEditor().canAddUnconnectedStructFragment())return null;var i=this.getEditor().screenCoordToObj(e),n=this.getEditor().getOnlyOneBlankStructFragment();n?(t=this.getEditor().createStructStartingAtom(n,null,i),this.setAutoCreatedStructFragment(null),this.setAutoCreatedStartingObj(t)):(t=this.getEditor().createNewStructFragmentAndStartingAtom(null,i),this.setAutoCreatedStartingObj(null),this.setAutoCreatedStructFragment(t?t.getParent():null))}if(this.isObjValidBondTerminator(t)){var a=this.getEditor();this.setStartingObj(t);var l=t.getParent();this.setStructFragment(l);var s=this.getEditorConfigs().getStructureConfigs(),d=Kekule.oneOf(this.getBondType(),s.getDefBondType()),u=Kekule.oneOf(this.getBondOrder(),s.getDefBondOrder()),c=Kekule.oneOf(this.getBondStereo(),Kekule.BondStereo.NONE),p=a.getDefBondLength?a.getDefBondLength():s.getDefBondLength(),h=this.getNewBondDefAngle(t,u),g=Kekule.Editor.StructureUtils.calcPreferred2DBondGrowingLocation(t,p,h,this.getEditor().getAllowCoordBorrow()),C=this.getEditor().createDefaultNode(g,Kekule.Editor.CoordSys.OBJ,l);this.setEndingObj(C);var _=new Kekule.Bond;_.setBondType(d),_.setBondOrder(u),_.setStereo(c),l.appendConnector(_),_.appendConnectedObj(t),_.appendConnectedObj(C),this.setBond(_),o&&this.getEditor().objectsChanged([{obj:_},{obj:C}]),r=g}else r=null}finally{a.endUpdateObject()}return r},addOperationToEditor:function(){return this.tryApplySuper("addOperationToEditor")},getAllObjOperations:function(e){var t=this.tryApplySuper("getAllObjOperations",[e])||[],o=this.getAddBondOperation();return o&&t.unshift(o),t},getAddBondOperation:function(){var e=new Kekule.MacroOperation,t=this.getEditor(),o=this.getAutoCreatedStructFragment();if(o){var r=new Kekule.ChemObjOperation.Add(o,this.getEditor().getChemObj(),null,this.getEditor());e.add(r)}var i=this.getStartingObj(),n=this.getEndingObj(),a=this.getBond(),l=this.getStructFragment(),s=(t=this.getEditor(),this.getAutoCreatedStartingObj());if(s){var d=new Kekule.ChemStructOperation.AddNode(s,l,null,t);e.add(d)}d=new Kekule.ChemStructOperation.AddNode(n,l,null,t);e.add(d);var u=new Kekule.ChemStructOperation.AddConnector(a,l,null,[i,n],t);return e.add(u),e},modifyBond:function(e){var t,o=this.getBondType(),r=Kekule.BondOrder,i=[r.SINGLE,r.DOUBLE,r.TRIPLE];if(this.getAutoSwitchBondOrder()&&o===Kekule.BondType.COVALENT&&e.getBondType===Kekule.BondType.COVALENT){var n=e.getBondOrder(),a=i.indexOf(n);t=i[a=a>=0?++a%i.length:0]}else t=this.getBondOrder();var l=e.getStereo(),s=this.getBondStereo();l===s&&(s=Kekule.BondStereo.getInvertedDirection(s));var d={bondType:o,bondOrder:t,stereo:s},u=!1;for(var c in d){if(e.getPropValue(c)!==d[c]){u=!0;break}}if(u){var p=this.getEditor();p.beginUpdateObject();try{var h=new Kekule.ChemObjOperation.Modify(e,d,this.getEditor());h.execute(),p.pushOperation(h);for(var g=[e].concat(e.getConnectedObjs()),C=[],_=0,f=g.length;_<f;++_)C.push({obj:g[_]});this.getEditor().objectsChanged(C)}finally{p.endUpdateObject()}}},react_pointerdown:function(e){if(this.setActivePointerType(e.pointerType),e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT){var t=r.State,o=this._getEventMouseCoord(e);if(this.getState()===t.INITIAL){var i=this.getEditor().getTopmostBoundInfoAtCoord(o,null,this.getCurrBoundInflation());if(i){var n=i.obj;if(this.isObjValidBondTerminator(n))return this.addDefBond(o,n,!0)&&(this.startDirectManipulate(null,this.getEndingObj(),o),this.moveManipulatedObjs(o)),!0;if(this.isBond(n)&&this.getEnableBondModification())return this.modifyBond(n),!0;e.preventDefault()}else if(this.getEditor().canAddUnconnectedStructFragment()){return this.addDefBond(o,null,!0)&&(this.startDirectManipulate(null,this.getEndingObj(),o),this.moveManipulatedObjs(o)),e.preventDefault(),!0}}}},react_pointerup:function(e){var t=this.getState(),o=this.getStartCoord(),r=this._getEventMouseCoord(e),i=Kekule.Editor.BasicManipulationIaController.State;return t===i.MANIPULATING&&e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT&&(e.preventDefault(),Kekule.CoordUtils.isEqual(o,r))?(this.manipulateBeforeStopping(),this.addOperationToEditor(),this.stopManipulate(),this.setState(i.NORMAL),!0):this.tryApplySuper("react_pointerup",[e])}}),Kekule.Editor.MolBondIaController.State={INITIAL:0,START_NODE_SET:21,ADJUSTING:22};var r=Kekule.Editor.MolBondIaController;Kekule.Editor.IaControllerManager.register(Kekule.Editor.MolBondIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.MolAtomIaController_OLD=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.MolAtomIaController_OLD",initialize:function(e){this.tryApplySuper("initialize",[e]),this._createNonAtomLabelInfos(),this._setterShown=!1},finalize:function(){this.getAtomSetter()&&this.getAtomSetter().finalize(),this.tryApplySuper("finalize")},initProperties:function(){this.defineProp("currAtom",{dataType:DataType.OBJECT,serializable:!1}),this.defineProp("atomSetter",{dataType:DataType.OBJECT,serializable:!1}),this.defineProp("periodicTable",{dataType:DataType.OBJECT,serializable:!1}),this.defineProp("periodicTableDialog",{dataType:DataType.OBJECT,serializable:!1}),this.defineProp("nonAtomLabelInfos",{dataType:DataType.ARRAY,serializable:!1})},canInteractWithObj:function(e){return!!this.isValidNode(e)},isValidNode:function(e){return e instanceof Kekule.ChemStructureNode},getNodeLabel:function(e){var t=this.getEditor().getRenderConfigs().getDisplayLabelConfigs();if(e.getIsotopeId)return e.getIsotopeId();if(e instanceof Kekule.SubGroup)return e.getAbbr()||e.getFormulaText()||t.getRgroup();if(e instanceof Kekule.VariableAtom){var o=e.getAllowedIsotopeIds(),r=e.getDisallowedIsotopeIds();return o&&o.length?this._getVarAtomListLabel():r&&r.length?this._getVarAtomNotListLabel():this._getVarAtomListLabel()}var i=e.getCoreDisplayRichTextItem(null,null,t);return Kekule.Render.RichTextUtils.toText(i)},_getVarAtomListLabel:function(){return this.getEditor().getRenderConfigs().getDisplayLabelConfigs().getVariableAtom()},_getVarAtomNotListLabel:function(){return"~"+this.getEditor().getRenderConfigs().getDisplayLabelConfigs().getVariableAtom()},_createNonAtomLabelInfos:function(){var e=[],t=this.getEditor().getRenderConfigs().getDisplayLabelConfigs();return e.push({nodeLabel:t.getRgroup(),nodeClass:Kekule.RGroup,description:Kekule.$L("ChemWidgetTexts.CAPTION_RGROUP")}),e.push({nodeLabel:t.getDummyAtom(),nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.DUMMY},description:Kekule.$L("ChemWidgetTexts.CAPTION_DUMMY_ATOM")}),e.push({nodeLabel:t.getHeteroAtom(),nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.HETERO},description:Kekule.$L("ChemWidgetTexts.CAPTION_HETERO_ATOM")}),e.push({nodeLabel:t.getAnyAtom(),nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.ANY},description:Kekule.$L("ChemWidgetTexts.CAPTION_ANY_ATOM")}),e.push({nodeLabel:this._getVarAtomListLabel(),nodeClass:Kekule.VariableAtom,description:Kekule.$L("ChemWidgetTexts.CAPTION_VARIABLE_ATOM")}),e.push({nodeLabel:this._getVarAtomNotListLabel(),nodeClass:Kekule.VariableAtom,description:Kekule.$L("ChemWidgetTexts.CAPTION_VARIABLE_NOT_ATOM")}),this.setNonAtomLabelInfos(e),e},_indexOfNonAtomLabel:function(e){for(var t=this.getNonAtomLabelInfos(),o=0,r=t.length;o<r;++o){if(t[o].nodeLabel===e)return o}return-1},_getNonAtomInfo:function(e){var t=this._indexOfNonAtomLabel(e);return t<0?null:this.getNonAtomLabelInfos()[t]},getAtomSetterWidget:function(e){var t=this.getAtomSetter();if(!t&&e){var o=this.getEditor().getCoreElement(),r=o.ownerDocument;t=this._createAtomSetterWidget(r,o),this.setAtomSetter(t)}return t},_createAtomSetterWidget:function(e,t){for(var o=new Kekule.Widget.ComboBox(e),r=this.getEditor().getEditorConfigs().getStructureConfigs().getPrimaryOrgChemAtoms(),i=[],n=0,a=r.length;n<a;++n)i.push({value:r[n],data:{props:{isotopeId:r[n]}}});i.push({value:Kekule.$L("ChemWidgetTexts.CAPTION_ATOMLIST_PERIODIC_TABLE")});var l=this.getNonAtomLabelInfos();for(n=0,a=l.length;n<a;++n){var s=l[n],d={value:s.nodeLabel,data:{props:s.props}};s.description&&(d.text=s.nodeLabel+" - "+s.description),i.push(d)}o.setItems(i),o.appendToElem(t);var u=this;return o.addEventListener("keyup",function(e){e.htmlEvent.getKeyCode()===Kekule.X.Event.KeyCode.ENTER&&(u.applySetter(o),o.dismiss())}),o.addEventListener("valueSelect",function(e){u.applySetter(o),o.dismiss()}),o.addEventListener("showStateChange",function(e){e.isShown||e.isDismissed||u.getAtomSetter()&&u.getAtomSetter().isShown()&&u.applySetter(o)}),o},getPeriodicTableDialogWidget:function(e){var t=this.getPeriodicTableDialog();if(!t&&e){var o=this.getEditor().getCoreElement(),r=o.ownerDocument;t=this._createPeriodicTableDialogWidget(r,o),this.setPeriodicTableDialog(t)}return t},_createPeriodicTableDialogWidget:function(e,t){var o=new Kekule.Widget.Dialog(e,Kekule.$L("ChemWidgetTexts.CAPTION_PERIODIC_TABLE_DIALOG"),[Kekule.Widget.DialogButtons.OK,Kekule.Widget.DialogButtons.CANCEL]),r=new Kekule.ChemWidget.PeriodicTable(e);return r.setUseMiniMode(!0),r.setEnableSelect(!0),r.appendToElem(o.getClientElem()),this.setPeriodicTable(r),o},openSetterUi:function(e,t){this.getAtomSetter();if(this.isValidNode(t)){this.setCurrAtom(t);var o=this.getEditor().getEditorConfigs().getInteractionConfigs().getAtomSetterFontSize()||0,r=o/1.5,i=this.getNodeLabel(t),n=this.getAtomSetterWidget(!0);n.setValue(i),n.setIsDirty(!1);var a=n.getElement().style;a.position="absolute",a.fontSize=o,a.left=e.x-r+"px",a.top=e.y-r+"px",n._applied=!1,n.setStandaloneOnShowHide(!0),n.show(this.getEditor(),null,Kekule.Widget.ShowHideType.POPUP),function(){n.focus(),n.selectAll()}.defer()}},applySetter:function(e,t){if(!e._applied&&e.getIsDirty()){var o;t||(t=this.getCurrAtom());var r=null,i=e.getValue();if(i===Kekule.$L("ChemWidgetTexts.CAPTION_ATOMLIST_PERIODIC_TABLE")){(a=this.getPeriodicTableDialogWidget(!0)).setCaption(Kekule.$L("ChemWidgetTexts.CAPTION_PERIODIC_TABLE_DIALOG_SEL_ELEM"));var n=t.getSymbol?t.getSymbol():null;this.getPeriodicTable().setEnableSelect(!0).setEnableMultiSelect(!1).setSelectedSymbol(n)}else if(i===this._getVarAtomListLabel()||i===this._getVarAtomNotListLabel()){var a,l=i===this._getVarAtomNotListLabel();(a=this.getPeriodicTableDialogWidget(!0)).setCaption(Kekule.$L("ChemWidgetTexts.CAPTION_PERIODIC_TABLE_DIALOG_SEL_ELEM"));var s=t.getAllowedIsotopeIds?t.getAllowedIsotopeIds():null,d=t.getDisallowedIsotopeIds?t.getDisallowedIsotopeIds():null;this.getPeriodicTable().setEnableSelect(!0).setEnableMultiSelect(!0).setSelectedSymbols(l?d:s)}if(a){var u=this;a.openModal(function(e){if(e===Kekule.Widget.DialogButtons.OK){var o,r;if(i===Kekule.$L("ChemWidgetTexts.CAPTION_ATOMLIST_PERIODIC_TABLE")){var n=u.getPeriodicTable().getSelectedSymbol();o=Kekule.Atom,r={isotopeId:n}}if(i===u._getVarAtomListLabel()){var a=u.getPeriodicTable().getSelectedSymbols();o=Kekule.VariableAtom,r={allowedIsotopeIds:a,disallowedIsotopeIds:null}}if(i===u._getVarAtomNotListLabel()){a=u.getPeriodicTable().getSelectedSymbols();o=Kekule.VariableAtom,r={allowedIsotopeIds:null,disallowedIsotopeIds:a}}u.applyModification(t,null,o,r)}},this)}else{var c=null,p=this._getNonAtomInfo(i);if(p)o=p.nodeClass,r=p.props;else{var h=Kekule.Editor.StoredSubgroupRepositoryItem2D.getRepItemOfInputText(i);if(h){var g=h.createObjects(t)||{},C=g.objects,_=Kekule.Editor.RepositoryStructureUtils.calcRepObjInitialTransformParams(this.getEditor(),h,g,t,null);this.getEditor().transformCoordAndSizeOfObjects(C,_),o=(c=C[0]).getClass()}else(o=Kekule.ChemStructureNodeFactory.getClassByLabel(i,null))||this.getEditorConfigs().getInteractionConfigs().getAllowUnknownAtomSymbol()&&(o=Kekule.Pseudoatom),r=o===Kekule.Atom?{isotopeId:i}:o===Kekule.Pseudoatom?{symbol:i}:{}}o?(this.applyModification(t,c,o,r),e._applied=!0):Kekule.error(Kekule.$L("ErrorMsg.INVALID_ATOM_SYMBOL"))}}},applyModification:function(e,t,o,r){var i,n,a=e.getClass();if(t&&!o&&(o=t.getClass()),t||o!==a){i=new Kekule.MacroOperation,t||(t=new o);var l=new Kekule.ChemStructureNode;l.assign(e),t.assign(l);var s=new Kekule.ChemStructOperation.ReplaceNode(e,t,null,this.getEditor());i.add(s)}else t=e;r&&(n=new Kekule.ChemObjOperation.Modify(t,r,this.getEditor()),i&&i.add(n));var d=i||n;if(d){var u=this.getEditor();u.beginManipulateAndUpdateObject();try{d.execute()}catch(e){throw e}finally{u.endManipulateAndUpdateObject()}u&&u.getEnableOperHistory()&&d&&u.pushOperation(d)}},react_pointerup:function(e){if(e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT){this.getEditor().setSelection(null);var t=this._getEventMouseCoord(e),o=this.getEditor().getTopmostBoundInfoAtCoord(t,null,this.getCurrBoundInflation());if(o){var r=o.obj;if(this.isValidNode(r)){var i=this.getEditor().getObjectScreenCoord(r);e.preventDefault(),e.stopPropagation(),this.openSetterUi(i,r),this.getEditor().setSelection([r])}return!0}}}}),Kekule.Editor.MolAtomIaController=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.MolAtomIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._createNonAtomLabelInfos(),this._setterShown=!1},finalize:function(){this.getAtomSetter()&&this.getAtomSetter().finalize(),this.tryApplySuper("finalize")},initProperties:function(){this.defineProp("currAtom",{dataType:DataType.OBJECT,serializable:!1}),this.defineProp("nonAtomLabelInfos",{dataType:DataType.ARRAY,serializable:!1}),this.defineProp("atomSetter",{dataType:DataType.OBJECT,serializable:!1,setter:function(e){var t=this.getAtomSetter();t&&this.unbindAtomSetter(t),this.setPropStoreFieldValue("atomSetter",e),e&&this.bindAtomSetter(e)}})},canInteractWithObj:function(e){return!!this.isValidNode(e)},isValidNode:function(e){return e instanceof Kekule.ChemStructureNode&&!(e instanceof Kekule.StructureFragment&&e.isStandalone())},_createNonAtomLabelInfos:function(){var e=this.getEditor(),t=e&&e.getEnabledNonAtomInputData&&e.getEnabledNonAtomInputData();return this.setNonAtomLabelInfos(t),t},_indexOfNonAtomLabel:function(e){for(var t=this.getNonAtomLabelInfos(),o=0,r=t.length;o<r;++o){if(t[o].nodeLabel===e)return o}return-1},_getNonAtomInfo:function(e){var t=this._indexOfNonAtomLabel(e);return t<0?null:this.getNonAtomLabelInfos()[t]},getAtomSetterWidget:function(e){var t=this.getAtomSetter();if(!t&&e){var o=this.getEditor().getCoreElement(),r=o.ownerDocument;t=this._createAtomSetterWidget(r,o),this.setAtomSetter(t)}return t},bindAtomSetter:function(e){this._initAtomSetterWidgetSettings(e),this._setAtomSetterEventListener(e,!0)},unbindAtomSetter:function(e){this._setAtomSetterEventListener(e,!1)},_createAtomSetterWidget:function(e,t){var o=new Kekule.ChemWidget.StructureNodeSetter(this.getEditor());return o.setUseDropDownSelectPanel(!0),o.appendToElem(t),o},_initAtomSetterWidgetSettings:function(t){if(t.addClassName(o.CHEMEDITOR_ATOM_SETTER),t.setSelectableInfos){var r=e.clone(this.getEditor().getEditorConfigs().getStructureConfigs().getPrimaryOrgChemAtoms());r.push("...");var i=this.getNonAtomLabelInfos();t.setSelectableInfos({elementSymbols:r,nonElementInfos:i,subGroupRepItems:Kekule.Editor.StoredSubgroupRepositoryItem2D.getAllRepItems()})}},_setAtomSetterEventListener:function(e,t){t?e.addEventListener("valueChange",this._reactAtomSetterValueChange,this):e.removeEventListener("valueChange",this._reactAtomSetterValueChange,this)},_reactAtomSetterValueChange:function(e){var t=this.getAtomSetter();t&&t.isShown()&&(e.value&&this.applySetter(t),t.dismiss())},_reactAtomSetterShowStateChange:function(e){var t=this.getAtomSetter();e.target!==t||e.byDomChange||e.isShown||e.isDismissed||t&&t.isShown()&&this.applySetter(t)},getPeriodicTableDialogWidget:function(e){var t=this.getPeriodicTableDialog();if(!t&&e){var o=this.getEditor().getCoreElement(),r=o.ownerDocument;t=this._createPeriodicTableDialogWidget(r,o),this.setPeriodicTableDialog(t)}return t},_createPeriodicTableDialogWidget:function(e,t){var o=new Kekule.Widget.Dialog(e,Kekule.$L("ChemWidgetTexts.CAPTION_PERIODIC_TABLE_DIALOG"),[Kekule.Widget.DialogButtons.OK,Kekule.Widget.DialogButtons.CANCEL]),r=new Kekule.ChemWidget.PeriodicTable(e);return r.setUseMiniMode(!0),r.setEnableSelect(!0),r.appendToElem(o.getClientElem()),this.setPeriodicTable(r),o},openSetterUi:function(e,t){var o=this.getAtomSetter();if(o&&o.isShown()&&(o.hide(),o._haltPrevShowHideProcess()),this.isValidNode(t)){this.setCurrAtom(t);var r=this.getEditor().getEditorConfigs().getInteractionConfigs().getAtomSetterFontSize()||0,i=(r*=this.getEditor().getZoom()||1)/1.5,n=this.getAtomSetterWidget(!0);n.setLabelConfigs(this.getEditor().getRenderConfigs().getDisplayLabelConfigs()),n.setNodes([t]);var a=this.getEditor().getCoreElement();n.appendToElem(a);var l=n.getNodeInputBox(),s=n.getElement().style;s.position="absolute",s.left=e.x-i+"px",s.top=e.y-i+"px",s.opacity=1,n.setNodeInputBoxFontSize&&n.setNodeInputBoxFontSize(r+"px"),n._applied=!1,n.setStandaloneOnShowHide(!0),n.show(this.getEditor(),null,Kekule.Widget.ShowHideType.POPUP),function(){l.focus(),l.selectAll()}.defer()}},applySetter:function(e,t){if(!e._applied){t||(t=this.getCurrAtom());var o=e.getValue();if(o){var r=Kekule.Editor.OperationUtils.createNodeModificationOperationFromData(t,o,this.getEditor());if(r){var i=this.getEditor();i.beginManipulateAndUpdateObject();try{r.execute()}catch(e){throw e}finally{i.endManipulateAndUpdateObject()}i&&i.getEnableOperHistory()&&r&&i.pushOperation(r)}}}},applyModification:function(e,t,o,r){var i=Kekule.Editor.OperationUtils.createNodeModificationOperation(e,t,o,r,this.getEditor());if(i){var n=this.getEditor();n.beginManipulateAndUpdateObject();try{i.execute()}catch(e){throw e}finally{n.endManipulateAndUpdateObject()}n&&n.getEnableOperHistory()&&i&&n.pushOperation(i)}},react_pointerup:function(e){if(e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT){this.getEditor().setSelection(null);var t=this._getEventMouseCoord(e),o=this.getTopmostInteractableObjAtScreenCoord(t),r=this.getEditor().getObjectScreenCoord(o);return e.preventDefault(),e.stopPropagation(),this.openSetterUi(r,o),this.doneInsertOrModifyBasicObjects([o]),!0}}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.MolAtomIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.RepositoryIaController=Class.create(Kekule.Editor.StructureInsertIaController,{CLASS_NAME:"Kekule.Editor.RepositoryIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setEnableSelect(!1),this._repObjStartingScreenCoord=null},initProperties:function(){this.defineProp("repositoryItem",{dataType:"Kekule.AbstractRepositoryItem",serializable:!1}),this.defineProp("addRepObjsOper",{dataType:"Kekule.MacroOperation",serializable:!1}),this.defineProp("initialTransformParams",{dataType:DataType.HASH,serializable:!1}),this.defineProp("currRepositoryObjects",{dataType:"Kekule.ChemObject",serializable:!1})},doTestMouseCursor:function(e,t){return""},canInteractWithObj:function(e){return this.tryApplySuper("canInteractWithObj",[e])},isValidStartingObj:function(e){return!0},calcInitialTransformParams:function(e,t,o,r){return Kekule.Editor.RepositoryStructureUtils.calcRepObjInitialTransformParams(this.getEditor(),e,t,o,r)},getRepObjCreationOptions:function(){return null},createObjFromRepositoryItem:function(e,t){return t.createObjects(e,this.getRepObjCreationOptions())||{}},addRepositoryObj:function(e,t,o){var r=this.getEditor();this.setAddRepObjsOper(null);var i=null;r.beginUpdateObject();try{var n=r.getChemSpace(),a=this.getRepositoryItem(),l=(i=this.createObjFromRepositoryItem(e,a)).objects;this.setCurrRepositoryObjects(l);var s=a.isOneStructureFragmentObj(),d=!1,u=this.getEditor().getOnlyOneBlankStructFragment();if(!r.canCreateNewChild()&&!i.mergeObj&&!o){if(!s||!r.canAddUnconnectedStructFragment())return null;d=!0}for(var c=new Kekule.MacroOperation,p=0,h=l.length;p<h;++p){var g,C=l[p];g=d?new Kekule.ChemStructOperation.MergeStructFragment(C,u,r):new Kekule.ChemObjOperation.Add(C,n,null,r),c.add(g)}c.execute(),this.setAddRepObjsOper(c);var _=d?[u]:l,f=this.calcInitialTransformParams(a,i,e,t);this._transformObjectsCoordAndSize(_,f),this.setInitialTransformParams(f),i.objects=_;var y=a.getMolManipulationCenterCoord&&a.getMolManipulationCenterCoord();y&&(i.manipulationCenterCoord=Kekule.CoordUtils.transform2D(y,f));var m=a.getMolManipulationDefDirectionCoord&&a.getMolManipulationDefDirectionCoord();m&&(i.manipulationDefDirectionCoord=Kekule.CoordUtils.transform2D(m,f))}finally{r.endUpdateObject()}return i},doRefreshRepositoryObj:function(e,t,o,r,i){this.doPrepareManipulatingObjects(e,t),this.doPrepareManipulatingStartingCoords(t,o,r,i),this.doCreateManipulateMoveAndResizeOperation()},_transformObjectsCoordAndSize:function(e,t){return this.getEditor().transformCoordAndSizeOfObjects(e,t)},getAllObjOperations:function(e){var t=this.tryApplySuper("getAllObjOperations",[e])||[],o=this.getAddRepObjsOper();return o&&t.unshift(o),t},addOperationToEditor:function(){return this.tryApplySuper("addOperationToEditor")},getInitManipulationType:function(){return Kekule.Editor.BasicManipulationIaController.ManipulationType.ROTATE},doInsertRepositoryObjToEditor:function(e,t,o,r){r||(this._initialStartingObj=o,this._repObjStartingScreenCoord=t);var i=e;if(i){var n=i.objects,a=null,l=null,s=this.getInitManipulationType();return i.mergeObj?(a=this.getEditor().getObjectScreenCoord(i.mergeObj),s=Kekule.Editor.BasicManipulationIaController.ManipulationType.ROTATE):i.manipulationCenterCoord&&(a=this.getEditor().objCoordToScreen(i.manipulationCenterCoord)),i.manipulationDefDirectionCoord&&(l=this.getEditor().objCoordToScreen(i.manipulationDefDirectionCoord)),{objects:n,manipulateType:s,coord:t,box:this.getEditor().getObjectsContainerBox(n),rotateCenter:a,rotateRefCoord:l,startingObj:o}}return null},insertRepositoryObjToEditor:function(e,t,o){var r=this.addRepositoryObj(t,e);return this.doInsertRepositoryObjToEditor(r,e,t,o)},updateRepositoryObjInEditor:function(){var t=this.getEditor();t.beginUpdateObject();try{this.useMergePreview()||this.reverseActiveOperation();for(var o=this.getCurrRepositoryObjects(),r=this.addRepositoryObj(this._initialStartingObj,this._repObjStartingScreenCoord,!0),i=e.exclude(o,(r||{}).objects),n=0,a=i.length;n<a;++n){var l=i[n],s=l.getParent();s&&s.removeChild(l)}this.useMergePreview()&&!i.length||(this.setMergeOperations([]),this.setMergePreviewOperations([]));var d=this.doInsertRepositoryObjToEditor(r,this._repObjStartingScreenCoord,this._initialStartingObj,!0);d&&(this.doRefreshRepositoryObj(d.objects,d.coord,d.box,d.rotateCenter,d.rotateRefCoord),this.moveManipulatedObjs(this._repObjStartingScreenCoord))}finally{t.endUpdateObject()}return d},getDirectManipulateObjs:function(e,t){return e},react_pointerdown:function(t){if(this.setActivePointerType(t.pointerType),t.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT){var o=r.State,i=this._getEventMouseCoord(t);if(this.getState()===o.INITIAL){var n=this.getEditor().getTopmostBoundInfoAtCoord(i,null,this.getCurrBoundInflation()),a=n?n.obj:null,l=this.insertRepositoryObjToEditor(i,a);if(l){var s=l.objects||[],d=this.getDirectManipulateObjs(l.objects,l)||[];e.exclude(s,d).length||e.exclude(d,s).length?(this.startDirectManipulate(l.manipulateType,s,l.coord,l.box,l.rotateCenter),this.moveManipulatedObjs(i),this.startDirectManipulate(l.manipulateType,d,l.coord,l.box,l.rotateCenter),this.moveManipulatedObjs(i)):(this.startDirectManipulate(l.manipulateType,s,l.coord,l.box,l.rotateCenter),this.moveManipulatedObjs(i))}return t.preventDefault(),!0}}},react_pointerup:function(e){var t=this.getState(),o=this.getStartCoord(),r=this._getEventMouseCoord(e),i=Kekule.Editor.BasicManipulationIaController.State;return t===i.MANIPULATING&&e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT&&Kekule.CoordUtils.isEqual(o,r)?(this.manipulateBeforeStopping(),this.addOperationToEditor(),this.stopManipulate(),this.setState(i.NORMAL),e.preventDefault(),!0):this.tryApplySuper("react_pointerup",[e])}}),Kekule.Editor.RepositoryStructureFragmentIaController=Class.create(Kekule.Editor.RepositoryIaController,{CLASS_NAME:"Kekule.Editor.RepositoryStructureFragmentIaController",initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("repItemName",{dataType:DataType.STRING,setter:function(e){if(e!==this.getRepItemName()){var t=Kekule.Editor.RepositoryItemManager.getItem(e);t&&(this.setRepositoryItem(t),this.setPropStoreFieldValue("repItemName",e))}}})}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.RepositoryStructureFragmentIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.MolFlexStructureIaController=Class.create(Kekule.Editor.RepositoryIaController,{CLASS_NAME:"Kekule.Editor.MolFlexStructureIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setEnableSelect(!1)},initProperties:function(){this.defineProp("assocMarker",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("assocMarker");return e||(e=new Kekule.ChemWidget.TextUiMarker,this.setPropStoreFieldValue("assocMarker",e)),e}})},manipulateEnd:function(){this.tryApplySuper("manipulateEnd"),this.hideAssocMarker()},initAssocMarker:function(){var e=this.getAssocMarker(),t=this.getEditorConfigs().getUiMarkerConfigs(),o={color:t.getFlexStructureAssocMarkerColor(),opacity:t.getFlexStructureAssocMarkerOpacity(),fontSize:t.getFlexStructureAssocMarkerFontSize(),fontFamily:t.getFlexStructureAssocMarkerFontFamily(),textBoxXAlignment:Kekule.Render.BoxXAlignment.CENTER,textBoxYAlignment:Kekule.Render.BoxYAlignment.CENTER};return e.setDrawStyles(o),e.setVisible(!0),this.getEditor().getUiMarkers().addMarker(e),e},hideAssocMarker:function(){var e=this.getPropStoreFieldValue("assocMarker");e&&(e.setVisible(!1),this.getEditor().getUiMarkers().removeMarker(e),this.repaintMarker())},updateAssocMarker:function(e,t,o){var r=this.getAssocMarker();e&&r.setCoord(e),t&&r.setPropValues(t),o||this.repaintMarker()},repaintMarker:function(){this.getEditor().repaintUiMarker()}}),Kekule.Editor.MolFlexChainIaController=Class.create(Kekule.Editor.MolFlexStructureIaController,{CLASS_NAME:"Kekule.Editor.MolFlexChainIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setEnableSelect(!1),this._deltaDistance=null,this._deltaCount=0,this._lastDeltaCount=1,this._repObjStartingScreenCoord=null,this._repObjNeedUpdate=!1,this._isForceReversedChainDirection=!1,this._assocMarkerInitCoord=null,this._manipulateObjInfoCache=[],this._chain=null;var t=new Kekule.Editor.MolChainRepositoryItem2D(2);t.setEnableCoordCache(!0),this.setRepositoryItem(t)},updateAssocMarker:function(e,o,r){var i=this.getEditor(),n=this.getAssocMarker().getDrawStyles(),a=this._chain,l=e;if(!l&&a){var s,d=a.getNodeAt(0),u=a.getNodeAt(a.getNodeCount()-1),c=i.getObjectContextCoord(d);if((l=i.getObjectContextCoord(u))&&c&&(s=t.substract(l,c)),s){var p=(n.fontSize||10)/2,h={x:0,y:0};if(l){var g=t.getDistance(s);h={x:p*(s.x/g),y:p*(s.y/g)};l=Kekule.CoordUtils.add(l,h)}}}this.tryApplySuper("updateAssocMarker",[l,o,r])},getChainMaxAtomCount:function(){return Math.max(this.getEditorConfigs().getStructureConfigs().getMaxFlexChainAtomCount(),0)},manipulateEnd:function(){this._clearManipulateObjInfoCache(),this.tryApplySuper("manipulateEnd")},createManipulateObjInfo:function(e,t,o){var r=this.getRepositoryItem().getNegativeDirection(),i=this._getCachedManipulateObjInfo(t,r);if(i)return i;var n=this.tryApplySuper("createManipulateObjInfo",[e,t,o]);return this._setCachedManipulateObjInfo(n,t,r),n},canInteractWithObj:function(e){return this.tryApplySuper("canInteractWithObj",[e])&&e instanceof Kekule.ChemStructureNode},getActualManipulatingObjects:function(t){var o=this.getCurrRepositoryObjects()[0];return o?e.clone(o.getNodes()):[]},_setCachedManipulateObjInfo:function(e,t,o){var r=o?1:0,i=this._manipulateObjInfoCache[r];i||(i=[],this._manipulateObjInfoCache[r]=i),i[t]=e},_getCachedManipulateObjInfo:function(e,t){var o=t?1:0,r=this._manipulateObjInfoCache[o];return r&&r[e]},_clearManipulateObjInfoCache:function(){this._manipulateObjInfoCache=[]},_calcStepDeltaDistance:function(){var e=this.getRepositoryItem().getBondLength(),t=this.getInitialTransformParams(),o=this.getEditor(),r=o.objCoordToScreen(Kekule.CoordUtils.transform2D({x:0,y:0},t)),i=o.objCoordToScreen(Kekule.CoordUtils.transform2D({x:e*Math.cos(Math.PI/6),y:0},t));return Kekule.CoordUtils.getDistance(r,i)},getRepObjCreationOptions:function(){return this._isUpdateRepObj?{originalStructFragment:this.getCurrRepositoryObjects()[0]}:null},addRepositoryObj:function(e,t,o){var r=this.tryApplySuper("addRepositoryObj",[e,t,o]);return this._deltaDistance=this._calcStepDeltaDistance(),this._repObjNeedUpdate=!1,r},insertRepositoryObjToEditor:function(e,t,o){if(!o){this._deltaDistance=null,this._deltaCount=0,this._lastDeltaCount=1;var r=2;this.getRepositoryItem().setAtomCount(r)}this._isUpdateRepObj=o;var i=this.tryApplySuper("insertRepositoryObjToEditor",[e,t,o]);if(this._chain=i&&i.objects[0],i&&!o){this.initAssocMarker();this.updateAssocMarker(null,{text:""+r})}return i},_updateChain:function(){this._isUpdateRepObj=!0;var e=this.updateRepositoryObjInEditor();return this._chain=e.objects[0],this._repObjNeedUpdate=!1,e},doTransformManipulatedObjs:function(e,t,o){var r=t;if(this.getState()===Kekule.Editor.BasicManipulationIaController.State.MANIPULATING){var i=this.getBaseCoord();if(i){var n=Kekule.CoordUtils.getDistance(r,i),a=Math.max(Math.round(n/this._deltaDistance),1);if(!this._lastDeltaCount||a!==this._lastDeltaCount){this._deltaCount=a;var l=this.getChainMaxAtomCount(),s=l?Math.min(l,a+1):a+1;this.getRepositoryItem().getAtomCount()!==s&&(this.getRepositoryItem().setAtomCount(s),this._repObjNeedUpdate=!0,this.updateAssocMarker(null,{text:""+s},!0)),this._lastDeltaCount=a}var d,u=this._calcRotateAngle(r),c=u&&u.angle,p=this.isInActualConstrainedRotation();if(p){var h=p?2*this.getEditorConfigs().getInteractionConfigs().getConstrainedRotateStep():null;d=Math.round(c/h)*h-c<0}else d=!1;this._isForceReversedChainDirection&&(d=!d),!!this.getRepositoryItem().getNegativeDirection()!==d&&(this.getRepositoryItem().setNegativeDirection(d),this._repObjNeedUpdate=!0)}}this._repObjNeedUpdate&&this._updateChain();var g=this.getCurrRepositoryObjects()[0];g.beginUpdate();try{var C=this.tryApplySuper("doTransformManipulatedObjs",[e,t,o]);this.updateAssocMarker(null,null,!1)}finally{g.endUpdate()}return C},react_pointermove:function(e){return this._isForceReversedChainDirection=!!e.getShiftKey(),this.tryApplySuper("react_pointermove",[e])}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.MolFlexChainIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.MolFlexRingIaController=Class.create(Kekule.Editor.MolFlexStructureIaController,{CLASS_NAME:"Kekule.Editor.MolFlexRingIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setEnableSelect(!1),this._deltaDistance=null,this._lastDeltaCount=1,this._repObjStartingScreenCoord=null,this._repObjNeedUpdate=!1,this._manipulateObjInfoCache=[];var t=new Kekule.Editor.MolRingRepositoryItem2D(3);t.setEnableCoordCache(!0),this.setRepositoryItem(t)},getRingMaxAtomCount:function(){return Math.max(this.getEditorConfigs().getStructureConfigs().getMaxFlexRingAtomCount(),0)},getRingMinAtomCount:function(){return Math.max(this.getEditorConfigs().getStructureConfigs().getMinFlexRingAtomCount(),3)},getActualManipulatingObjects:function(t){var o=this.getCurrRepositoryObjects()[0];return o?e.clone(o.getNodes()):[]},manipulateEnd:function(){this._clearManipulateObjInfoCache(),this.tryApplySuper("manipulateEnd")},createManipulateObjInfo:function(e,t,o){var r=this.getRepositoryItem().getRingAtomCount(),i=this._getCachedManipulateObjInfo(t,r);if(i)return i;var n=this.tryApplySuper("createManipulateObjInfo",[e,t,o]);return this._setCachedManipulateObjInfo(n,t,r),n},_setCachedManipulateObjInfo:function(e,t,o){var r=this._manipulateObjInfoCache[o];r||(r=[],this._manipulateObjInfoCache[o]=r),r[t]=e},_getCachedManipulateObjInfo:function(e,t){var o=this._manipulateObjInfoCache[t];return o&&o[e]},_clearManipulateObjInfoCache:function(){this._manipulateObjInfoCache=[]},_calcStepDeltaDistance:function(){var e=this.getRepositoryItem().getBondLength(),t=this.getInitialTransformParams(),o=this.getEditor(),r=o.objCoordToScreen(Kekule.CoordUtils.transform2D({x:0,y:0},t)),i=o.objCoordToScreen(Kekule.CoordUtils.transform2D({x:e,y:0},t));return Kekule.CoordUtils.getDistance(r,i)/3},getRepObjCreationOptions:function(){return this._isUpdateRepObj?{originalStructFragment:this.getCurrRepositoryObjects()[0]}:null},addRepositoryObj:function(e,t,o){var r=this.tryApplySuper("addRepositoryObj",[e,t,o]);return this._deltaDistance=this._calcStepDeltaDistance(),this._repObjNeedUpdate=!1,r},insertRepositoryObjToEditor:function(e,t,o){if(!o){this._deltaDistance=null,this._lastDeltaCount=1;var r=this.getEditorConfigs().getStructureConfigs().getMinFlexRingAtomCount();this.getRepositoryItem().setRingAtomCount(r)}this._isUpdateRepObj=o;var i=this.tryApplySuper("insertRepositoryObjToEditor",[e,t]);if(i&&!o){var n=i.objects[0];this.initAssocMarker(),this.updateAssocMarker(this._getRingCenterAbsContextCoord(n),{text:""+r})}return i},updateAssocMarker:function(e,t,o){if(!e){var r=this._getManipulateObjsCenterCoord();e=this.getEditor().objCoordToContext(r)}return this.tryApplySuper("updateAssocMarker",[e,t,o])},_getRingCenterAbsContextCoord:function(e){var t=this.getEditor(),o=Kekule.Editor.StructureUtils.getStructureCenterAbsBaseCoord(e,t.getCoordMode(),t.getAllowCoordBorrow());return t.objCoordToContext(o)},_updateRing:function(){this._isUpdateRepObj=!0;var e=this.updateRepositoryObjInEditor();return this._repObjNeedUpdate=!1,e},doTransformManipulatedObjs:function(e,t,o){var r=t;if(this.getState()===Kekule.Editor.BasicManipulationIaController.State.MANIPULATING){var i=this.getBaseCoord();if(i){var n=this.getRingMinAtomCount(),a=Kekule.CoordUtils.getDistance(r,i),l=Math.round(a/this._deltaDistance)+n;if(!this._lastDeltaCount||l!==this._lastDeltaCount){var s=this.getRingMaxAtomCount(),d=s?Math.min(s,l):l;d=n?Math.max(d,n):d,this.getRepositoryItem().getRingAtomCount()!==d&&(this.getRepositoryItem().setRingAtomCount(d),this._repObjNeedUpdate=!0,this.updateAssocMarker(null,{text:""+d},!0)),this._lastDeltaCount=l}}}this._repObjNeedUpdate&&this._updateRing();var u=this.getCurrRepositoryObjects()[0];u.beginUpdate();try{var c=this.tryApplySuper("doTransformManipulatedObjs",[e,t,o]);this.updateAssocMarker(null,null,!1)}finally{u.endUpdate()}return c}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.MolFlexRingIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.MolRingIaController=Class.create(Kekule.Editor.MolFlexStructureIaController,{CLASS_NAME:"Kekule.Editor.MolRingIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setRepositoryItem(new Kekule.Editor.MolRingRepositoryItem2D),this.setEnableSelect(!1),this._currBondOrders=null},initProperties:function(){this.defineProp("ringAtomCount",{dataType:DataType.INT,getter:function(){return this.getRepositoryItem().getRingAtomCount()},setter:function(e){this.getRepositoryItem().setRingAtomCount(e)}}),this.defineProp("isAromatic",{dataType:DataType.INT})},getActualManipulatingObjects:function(t){var o=this.getCurrRepositoryObjects()[0];return o?e.clone(o.getNodes()):[]},createNodeMergeOperation:function(e,t,o){var r=this.tryApplySuper("createNodeMergeOperation",[e,t,o]);return this.getIsAromatic()&&r&&r.setMergeConnectorPropsFromTarget&&r.setMergeConnectorPropsFromTarget(!0),r},manipulateBeforeStopping:function(){return this._currBondOrders&&this.useMergePreview()&&this._applyBondOrdersToSrcStruct(null,this._currBondOrders),this.tryApplySuper("manipulateBeforeStopping")},_mergeOperationsChanged:function(e,t,o){this.tryApplySuper("_mergeOperationsChanged",[e,t,o]);var r=this.getCurrRepositoryObjects(),i=r&&r[0];if(i){var n=this._getMergedDestObjs(i,e,t,o);this.updateRepStructureBondOrders(i,n,this.useMergePreview())}},createObjFromRepositoryItem:function(e,t){var o=this.tryApplySuper("createObjFromRepositoryItem",[e,t]);return this.updateRepStructureBondOrders(o.objects[0],null),this._currBondOrders=null,o},updateRepStructureBondOrders:function(e,t,o){if(this.getIsAromatic()){if(!e){var r=this.getCurrRepositoryObjects();e=r&&r[0]}t||(t={nodes:[],connectors:[],nodeCount:0,connectorCount:0});var i=this._calcSrcBondOrders(e,t),n=i.bondOrders,a=i.previewBondOrders;this._currBondOrders=n,this._applyBondOrdersToSrcStruct(e,o?a:n)}},_applyBondOrdersToSrcStruct:function(e,t){if(!e){var o=this.getCurrRepositoryObjects();e=o&&o[0]}var r=this.getEditor();try{r.beginUpdateObject(),e.beginUpdate();try{for(var i=0,n=e.getConnectorCount();i<n;++i){var a=e.getConnectorAt(i);if(a&&a.setBondOrder){var l=t[i];a.setBondOrder(l)}}}finally{e.endUpdate()}}finally{r.endUpdateObject()}},_getMergedDestObjs:function(e,t,o,r){var i=e;if(i){for(var n=function(e,t,o){for(var r=e.getConnectedChemNodes(),i=[],n=0,a=r.length;n<a;++n){var l=r[n],s=o[t.indexOf(l)];if(!s)return null;i.push(s)}if(2===i.length){var d=i[0].getLinkedConnectors();for(n=0,a=d.length;n<a;++n){var u=d[n],c=u.getConnectedChemNodes();if(2===c.length&&c.indexOf(i[1])>=0)return u}}return null},a={nodes:[],connectors:[],nodeCount:0,connectorCount:0},l=0,s=i.getNodeCount();l<s;++l){var d=i.getNodeAt(l),u=o.indexOf(d),c=u>=0?r[u]:null;a.nodes.push(c),c&&++a.nodeCount}for(l=0,s=i.getConnectorCount();l<s;++l){var p=n(i.getConnectorAt(l),i.getNodes(),a.nodes)||null;a.connectors.push(p),p&&++a.connectorCount}}return a},_calcSrcBondOrders:function(t,o){if(t&&t.getNodeCount()){o&&o.nodeCount;for(var r=t.getConnectors(),i=o.connectors,n=t.getNodes(),a=o.nodes,l=function(e){return e>Kekule.BondOrder.SINGLE&&e<=Kekule.BondOrder.QUAD},s=function(e){var t=e.getLinkedBonds(Kekule.BondType.COVALENT),o=!1;if(t.length)for(var r=0,i=t.length;r<i;++r){if(t[r].getBondOrder()===Kekule.BondOrder.EXPLICIT_AROMATIC){o=!0;break}}return o},d=function(t,o){var i=t.getLinkedBonds(Kekule.BondType.COVALENT),n=e.exclude(i,o),a=!1;if((n=e.exclude(n,r)).length)for(var s=0,d=n.length;s<d;++s){var u=n[s].getBondOrder();if(l(u)){a=!0;break}}return a},u=function(t,o){var r=t.getLinkedBonds(Kekule.BondType.COVALENT),i=e.intersect(r,o),n=!1;if(i.length)for(var a=0,s=i.length;a<s;++a){var d=i[a].getBondOrder();if(l(d)){n=!0;break}}return n},c=function(e,t,o,r,i,n,a){var s,p,h=Kekule.BondOrder,g=e-1;g<0&&(g=t.length-1);var C,_=!!n[g],f=_?n[g]:null,y=t[e],m=r[e],O=m&&m.getBondOrder(),E=0;if(O&&l(O))s=[O],p=[h.SINGLE],f&&l(f)&&++E;else if(_&&l(f))s=[h.SINGLE];else{for(var T=y.getConnectedChemNodes(),S=!1,A=!1,k=0,b=T.length;k<b;++k){var I=i[o.indexOf(T[k])];if(I&&(S=d(I,r),A=u(I,r),S||A))break}s=S||A?[h.SINGLE]:[h.DOUBLE,h.SINGLE]}for(k=0,b=s.length;k<b;++k){var D=s[k];if(n[e]=D,a[e]=p&&p[k]||D,e<t.length-1&&(E+=c(++e,t,o,r,i,n,a),(Kekule.ObjUtils.isUnset(C)||C>E)&&(C=E,D),E<=0))break}return E},p=[],h=[],g=!1,C=0,_=a.length;C<_;++C){var f=a[C];if(f&&s(f)){g=!0;break}}if(g){p=[];for(C=0,_=r.length;C<_;++C)p[C]=Kekule.BondOrder.EXPLICIT_AROMATIC;return p}for(C=0,_=i.length;C<_;++C){var y=i[C];if(y){var m=y.getBondOrder();l(m)&&(p[C]=m)}}c(0,r,n,i,a,p,h);return{bondOrders:p,previewBondOrders:h}}}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.MolRingIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.PathGlyphIaController=Class.create(Kekule.Editor.RepositoryIaController,{CLASS_NAME:"Kekule.Editor.PathGlyphIaController",initialize:function(e){this.tryApplySuper("initialize",[e])},getDirectManipulateObjs:function(e,t){if(1===e.length){var o=e[0];if(o.getNodeAt&&o.getNodeCount){o.getNodeCount();if(o.getDirectManipulationTarget)return o.getDirectManipulationTarget()}}return this.tryApplySuper("getDirectManipulateObjs",[e,t])},getInsertedObjs:function(){return this.getCurrRepositoryObjects()}}),Kekule.Editor.ArrowLineIaController=Class.create(Kekule.Editor.PathGlyphIaController,{CLASS_NAME:"Kekule.Editor.ArrowLineIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setRepositoryItem(new Kekule.Editor.PathGlyphRepositoryItem2D)},initProperties:function(){this.defineProp("glyphRefLength",{dataType:DataType.FLOAT,getter:function(){return this.getRepositoryItem().getGlyphRefLength()},setter:function(e){this.getRepositoryItem().setGlyphRefLength(e)}}),this.defineProp("glyphClass",{dataType:DataType.CLASS,serializable:!1,getter:function(){return this.getRepositoryItem().getGlyphClass()},setter:function(e){this.getRepositoryItem().setGlyphClass(e)}}),this.defineProp("glyphInitialParams",{dataType:DataType.HASH,getter:function(){return this.getRepositoryItem().getGlyphInitialParams()},setter:function(e){this.getRepositoryItem().setGlyphInitialParams(e)}})},getInitManipulationType:function(){return Kekule.Editor.BasicManipulationIaController.ManipulationType.MOVE},addRepositoryObj:function(e,t,o){return this.getRepositoryItem().setGlyphRefLength(this.getEditor().getChemSpace().getDefAutoScaleRefLength()),this.tryApplySuper("addRepositoryObj",[e,t,o])}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.ArrowLineIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.FormulaIaController=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.FormulaIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._operAddMol=null},initProperties:function(){this.defineProp("currMol",{dataType:DataType.OBJECT,serializable:!1}),this.defineProp("textSetter",{dataType:DataType.OBJECT,serializable:!1})},canInteractWithObj:function(e){return!(!e||!this.isValidMol(e))},isValidMol:function(e){return e instanceof Kekule.StructureFragment&&e.hasFormula()&&!e.hasCtab()},getFormulaText:function(e){return e.hasFormula()?e.getFormula().getText():""},createNewMol:function(e,t){var o=this.getEditor();if(!o.canCreateNewChild()&&!(r=o.getOnlyOneBlankStructFragment()))return null;o.beginUpdateObject();try{if(!r)var r=new Kekule.Molecule;r.getFormula(!0),e.appendChild(r),o.setObjectScreenCoord(r,t);var i=new Kekule.ChemObjOperation.Add(r,e,null,o);this._operAddBlock=i}finally{o.endUpdateObject()}return r},getTextSetterWidget:function(e){var t=this.getTextSetter();if(!t&&e){var o=this.getEditor().getCoreElement(),r=o.ownerDocument;t=this._createTextSetterWidget(r,o),this.setTextSetter(t)}return t},_createTextSetterWidget:function(e,t){var r=new Kekule.Widget.TextBox(this.getEditor());r.addClassName(o.CHEMEDITOR_FORMULA_SETTER),r.appendToElem(t);var i=this;return r.addEventListener("keyup",function(e){var t=e.htmlEvent.getKeyCode();t===Kekule.X.Event.KeyCode.ENTER?(i.applySetter(r),r.dismiss()):t===Kekule.X.Event.KeyCode.ESC&&(r.dismiss(),i.cancelSetter())}),r.addEventListener("showStateChange",function(e){e.byDomChange||(e.isShown||e.isDismissed||i.applySetter(r),e.isShown&&(r._applied=!1))}),r},cancelSetter:function(){this._operAddBlock&&(this._operAddBlock.reverse(),this._operAddBlock=null)},applySetter:function(e,t){if(!e._applied){t||(t=this.getCurrMol());var o=e.getText();if(o)var r=new Kekule.ChemObjOperation.Modify(t.getFormula(),{text:o},this.getEditor());else this._operAddBlock?this.cancelSetter():r=new Kekule.ChemObjOperation.Remove(t,t.getParent(),null,this.getEditor());var i=this.getEditor();if(i&&r){i.beginManipulateAndUpdateObject();try{if(r.execute(),i.getEnableOperHistory()){if(this._operAddBlock){var n=new Kekule.MacroOperation;n.add(this._operAddBlock),n.add(r),i.pushOperation(n),this._operAddBlock=null}else i.pushOperation(r);this.doneInsertOrModifyBasicObjects([t])}}finally{i.endManipulateAndUpdateObject()}}e._applied=!0}},openSetterUi:function(e,t){var o=this.getTextSetter();if(o&&o.isShown()&&(this.applySetter(o,this.getCurrMol()),o.hide(),o._haltPrevShowHideProcess()),t||(t=this.createNewMol(this.getEditor().getChemObj(),e)),this.isValidMol(t)){this.setCurrMol(t),this.getEditor().setSelection([t]);var r=t.getCascadedRenderOption("fontSize")||this.getEditor().getEditorConfigs().getInteractionConfigs().getAtomSetterFontSize();r*=this.getEditor().getZoom()||1;var i=t.getCascadedRenderOption("fontFamily")||"",n=this.getFormulaText(t),a=this.getTextSetterWidget(!0),l=this.getEditor().getCoreElement();a.appendToElem(l);var s=n||"";a.setValue(s);var d=a.getElement().style;d.position="absolute",d.fontSize=r+"px",d.left=e.x+"px",d.top=e.y+"px",d.fontFamily=i,a._applied=!1,a.setStandaloneOnShowHide(!0),a.show(this.getEditor(),null,Kekule.Widget.ShowHideType.POPUP),a.selectAll(),a.focus()}},react_pointerup:function(e){if(e.getButton()===Kekule.X.Event.MOUSE_BTN_LEFT){this.getEditor().setSelection(null);var t,o=this._getEventMouseCoord(e),r=this.getTopmostInteractableObjAtScreenCoord(o);t=r;var i,n=r&&this.getEditor().getChemObjBounds(r),a=n&&n[0];return i=a&&a.boundInfo?a.boundInfo.coords[0]:o,e.preventDefault(),e.stopPropagation(),this.openSetterUi(i,t),!0}}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.FormulaIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.ContentBlockIaController=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.ContentBlockIaController",initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("currBlock",{dataType:DataType.OBJECT,serializable:!1})},canInteractWithObj:function(e){return e&&this.isValidBlock(e)},isValidBlock:function(e){return e instanceof Kekule.ContentBlock},execute:function(e,t,o){},react_pointerup:function(e){if(e.getButton()===Kekule.X.Event.MouseButton.LEFT){this.getEditor().setSelection(null);var t=this._getEventMouseCoord(e),o=this.getTopmostInteractableObjAtScreenCoord(t),r=o?this.getEditor().getObjectScreenCoord(o):t;return e.preventDefault(),e.stopPropagation(),this.execute(this.getEditor().getChemObj(),r,o),!0}}}),Kekule.Editor.TextBlockIaController=Class.create(Kekule.Editor.ContentBlockIaController,{CLASS_NAME:"Kekule.Editor.TextBlockIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._operAddBlock=null},initProperties:function(){this.defineProp("textSetter",{dataType:DataType.OBJECT,serializable:!1})},isValidBlock:function(e){return e instanceof Kekule.TextBlock},createNewBlock:function(e,t){var o=this.getEditor();if(!o.canCreateNewChild())return null;o.beginUpdateObject();try{var r=new Kekule.TextBlock;if(r){e.appendChild(r),o.setObjectScreenCoord(r,t,Kekule.Render.CoordPos.CORNER_TL);var i=new Kekule.ChemObjOperation.Add(r,e,null,o);this._operAddBlock=i}}finally{o.endUpdateObject()}return r},getBlockText:function(e){return e.getText()},execute:function(e,t,o){this.openSetterUi(t,o)},getTextSetterWidget:function(e){var t=this.getTextSetter();if(!t&&e){var o=this.getEditor().getCoreElement(),r=o.ownerDocument;t=this._createTextSetterWidget(r,o),this.setTextSetter(t)}return t},_createTextSetterWidget:function(e,t){var r=new Kekule.Widget.TextArea(this.getEditor());r.setAutoSizeX(!0),r.setAutoSizeY(!0),r.setDisplayed(!1),r.addClassName(o.CHEMEDITOR_TEXT_SETTER),r.appendToElem(t);var i=this;return r.addEventListener("keyup",function(e){var t=e.htmlEvent,o=t.getKeyCode();o===Kekule.X.Event.KeyCode.ENTER&&t.getCtrlKey()?(i.applySetter(r),r.dismiss()):o===Kekule.X.Event.KeyCode.ESC&&(r.dismiss(),i.cancelSetter())}),r.addEventListener("showStateChange",function(e){e.byDomChange||(e.isShown||e.isDismissed||i.applySetter(r),e.isShown&&(r._applied=!1))}),r},cancelSetter:function(){this._operAddBlock&&(this._operAddBlock.reverse(),this._operAddBlock=null)},applySetter:function(e,t){if(!e._applied){t||(t=this.getCurrBlock());var o,r=e.getText();r?o=new Kekule.ChemObjOperation.Modify(t,{text:r},this.getEditor()):this._operAddBlock?this.cancelSetter():o=new Kekule.ChemObjOperation.Remove(t,t.getParent(),null,this.getEditor());var i=this.getEditor();if(o&&i){i.beginManipulateAndUpdateObject();try{if(o.execute(),i.getEnableOperHistory())if(this._operAddBlock){var n=new Kekule.MacroOperation;n.add(this._operAddBlock),n.add(o),i.pushOperation(n),this._operAddBlock=null}else i.pushOperation(o)}finally{i.endManipulateAndUpdateObject()}this.doneInsertOrModifyBasicObjects([t])}e._applied=!0}},openSetterUi:function(e,t){var o=this.getTextSetter();if(o&&o.isShown()&&(this.applySetter(o,this.getCurrBlock()),o._haltPrevShowHideProcess()),t||(t=this.createNewBlock(this.getEditor().getChemObj(),e)),this.isValidBlock(t)){this.setCurrBlock(t);var r=this.getEditor().getObjectScreenCoord(t,Kekule.Render.CoordPos.CORNER_TL),i=t.getCascadedRenderOption("fontSize")||this.getEditor().getEditorConfigs().getInteractionConfigs().getAtomSetterFontSize();i*=this.getEditor().getZoom()||1;var n=t.getCascadedRenderOption("fontFamily")||"",a=this.getBlockText(t),l=this.getTextSetterWidget(!0);l._applied=!1,l.setValue(a);var s=a||Kekule.$L("ChemWidgetTexts.CAPTION_TEXTBLOCK_INIT");l.setPlaceholder(s);var d=this.getEditor().getCoreElement();l.appendToElem(d);var u=l.getElement().style;u.position="absolute",u.fontSize=i+"px",u.left=r.x+"px",u.top=r.y+"px",u.fontFamily=n,u.opacity=1,l.setStandaloneOnShowHide(!0),l.show(this.getEditor(),null,Kekule.Widget.ShowHideType.POPUP),function(){l.selectAll(),l.focus()}.defer()}}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.TextBlockIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.ImageBlockIaController=Class.create(Kekule.Editor.ContentBlockIaController,{CLASS_NAME:"Kekule.Editor.ImageBlockIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this._operAddBlock=null,this._imgProbeElem=null,this._actionOpenFile=this.createOpenAction()},doFinalize:function(){this._actionOpenFile&&this.actionOpenFile.finalize()},initProperties:function(){},isValidBlock:function(e){return e instanceof Kekule.ImageBlock},createNewBlock:function(e,t,o,r){var i=this.getEditor();if(!i.canCreateNewChild())return null;i.beginUpdateObject();try{var n=new Kekule.ImageBlock;r&&n.setSrc(r),o&&n.setSize2D(o),i.setObjectScreenCoord(n,t,Kekule.Render.CoordPos.CORNER_TL);var a=new Kekule.ChemObjOperation.Add(n,e,null,i);this._operAddBlock=a}finally{i.endUpdateObject()}return n},_getImgFilters:function(){return[{title:Kekule.$L("WidgetTexts.TITLE_IMG_FORMAT_PNG"),filter:".png"},{title:Kekule.$L("WidgetTexts.TITLE_IMG_FORMAT_JPG"),filter:".jpg,.jpeg"},{title:Kekule.$L("WidgetTexts.TITLE_IMG_FORMAT_GIF"),filter:".gif"},{title:Kekule.$L("WidgetTexts.TITLE_IMG_FORMAT_SVG"),filter:".svg"},Kekule.NativeServices.FILTER_ALL_SUPPORT,Kekule.NativeServices.FILTER_ANY]},createOpenAction:function(){var e=new Kekule.ActionFileOpen;return e.setFilters(this._getImgFilters()),e.on("open",this.reactImageFileOpen,this),e},reactImageFileOpen:function(e){var t=e.file;if(t){var o=this,r=new FileReader;r.addEventListener("load",function(){var e=o._getImageProbeElem();e.ownerDocument;try{delete e.width,delete e.height}catch(e){}e.src=r.result;var t=o.getEditor();(function(){if((s={x:e.width,y:e.height}).x<=0||s.y<=0)Kekule.error(Kekule.$L("ErrorMsg.INVALID_OR_EMPTY_IMAGE"));else{var i=o._currCoord,n=t.objCoordToContext(i),a=Kekule.CoordUtils.add(n,s),l=t.contextCoordToObj(a),s=Kekule.CoordUtils.substract(l,i);s=Kekule.CoordUtils.absValue(s);var d,u=o.getCurrBlock(),c=t.getChemObj();if(u)d=new Kekule.ChemObjOperation.Modify(u,{src:r.result,size2D:s});else{var p=o.createNewBlock(o.getEditor().getChemObj(),o._currCoord,s,r.result);o.setCurrBlock(p),d=new Kekule.ChemObjOperation.Add(p,c,null,t)}if(d){t.beginManipulateAndUpdateObject();try{d.execute(),t&&t.getEnableOperHistory()&&t.pushOperation(d),o.doneInsertOrModifyBasicObjects([o.getCurrBlock()])}finally{t.endManipulateAndUpdateObject()}}}}).defer()}),r.readAsDataURL(t)}},_getImageProbeElem:function(){if(!this._imgProbeElem){var e=this.getEditor().getElement().ownerDocument;this._imgProbeElem=e.createElement("img")}return this._imgProbeElem},execute:function(e,t,o){this.setCurrBlock(o),this._currCoord=t,this._actionOpenFile.execute(this.getEditor())}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.ImageBlockIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.AttachedMarkerIaController=Class.create(Kekule.Editor.BaseEditorIaController,{CLASS_NAME:"Kekule.Editor.AttachedMarkerIaController",initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("markerClass",{dataType:DataType.CLASS,serializable:!1}),this.defineProp("targetClass",{dataType:DataType.CLASS,serializable:!1}),this.defineProp("markerClassName",{dataType:DataType.STRING,getter:function(){return ClassEx.getClassName(this.getMarkerClass())},setter:function(e){this.setMarkerClass(ClassEx.findClass(e))}}),this.defineProp("targetClassName",{dataType:DataType.STRING,getter:function(){return ClassEx.getClassName(this.getTargetClass())},setter:function(e){this.setTargetClass(ClassEx.findClass(e))}}),this.defineProp("initialPropValues",{dataType:DataType.HASH})},canInteractWithObj:function(e){return this.isValidTarget(e)},isValidTarget:function(e){var t=this.getTargetClass();return e instanceof t||!t},createMarker:function(){var e,t=this.getMarkerClass();if(t){e=new t;var o=this.getInitialPropValues();o&&e&&e.setPropValues&&e.setPropValues(o)}return e},createOperations:function(e){var t,o=this.createMarker();return o&&(t=new Kekule.ChemObjOperation.Add(o,e,null,this.getEditor())),[t]},apply:function(e){var t=this.createOperations(e),o=t.length<=0?null:1===t.length?t[0]:new Kekule.MacroOperation(t);if(o){o.execute();var r=this.getEditor();r&&r.getEnableOperHistory()&&r.pushOperation(o)}},react_pointerup:function(e){if(e.getButton()===Kekule.X.Event.MouseButton.LEFT){var t=this._getEventMouseCoord(e),o=this.getEditor().getTopmostBoundInfoAtCoord(t,null,this.getCurrBoundInflation());if(o){var r=o.obj;return this.isValidTarget(r)&&(this.apply(r),e.preventDefault(),e.stopPropagation()),!0}}}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.AttachedMarkerIaController,Kekule.Editor.ChemSpaceEditor),Kekule.Editor.MolNodeChargeIaController=Class.create(Kekule.Editor.AttachedMarkerIaController,{CLASS_NAME:"Kekule.Editor.MolNodeChargeIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setChargeInc(1)},initProperties:function(){this.defineProp("chargeInc",{dataType:DataType.NUMBER,serializable:!1}),this.defineProp("charge",{dataType:DataType.NUMBER,serializable:!1}),this.defineProp("radical",{dataType:DataType.INT,serializable:!1}),this.defineProp("currNode",{dataType:DataType.OBJECT,serializable:!1})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setTargetClass(Kekule.ChemStructureNode)},createOperations:function(e){var t=!1,o=!1,r={},i=e.getCharge();Kekule.ObjUtils.notUnset(this.getCharge())?i!==this.getCharge()&&(r.charge=this.getCharge(),t=!0):this.getChargeInc()&&(i+=this.getChargeInc(),r.charge=i,t=!0);var n=e.getRadical();this.getRadical()!==n&&(r.radical=this.getRadical(),o=!0);var a,l,s=[],d=[],u=this.getEditor();if(t){var c=e.fetchChargeMarker(!1);0===r.charge||c||((a=new Kekule.ChemMarker.Charge).setValue(r.charge),d.push(new Kekule.ChemObjOperation.Add(a,e,null,u))),0===r.charge&&c&&d.push(new Kekule.ChemObjOperation.Remove(c,null,null,u))}if(o){var p=e.fetchRadicalMarker(!1);0===r.radical||p||((a=new Kekule.ChemMarker.Radical).setValue(r.radical),d.push(new Kekule.ChemObjOperation.Add(a,e,null,u))),0===r.radical&&p&&d.push(new Kekule.ChemObjOperation.Remove(p,null,null,u))}return s=s.concat(d),(t||o)&&(l=new Kekule.ChemObjOperation.Modify(e,r,this.getEditor()),s.push(l)),s}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.MolNodeChargeIaController,Kekule.Editor.ChemSpaceEditor)}(),function(){"use strict";Kekule.Editor.EditorNexus=Class.create(ObjectEx,{CLASS_NAME:"Kekule.Editor.EditorNexus",initialize:function(e){this.tryApplySuper("initialize"),this._currInvoker=null,e&&(e.editor&&this.setEditor(e.editor),e.structureTreeView&&this.setStructureTreeView(e.structureTreeView),e.objectInspector&&this.setObjectInspector(e.objectInspector),e.issueInspector&&this.setIssueInspector(e.issueInspector))},initProperties:function(){this.defineProp("editor",{dataType:"Kekule.Editor.BaseEditor",serializable:!1,setter:function(e){var t=this.getPropStoreFieldValue("editor");this.setPropStoreFieldValue("editor",e),this.editorChanged(e,t)}}),this.defineProp("structureTreeView",{dataType:"Kekule.ChemWidget.StructureTreeView",serializable:!1,setter:function(e){var t=this.getPropStoreFieldValue("structureTreeView");this.setPropStoreFieldValue("structureTreeView",e),this.structureTreeViewChanged(e,t)}}),this.defineProp("objectInspector",{dataType:"Kekule.Widget.ObjectInspector",serializable:!1,setter:function(e){var t=this.getPropStoreFieldValue("objectInspector");this.setPropStoreFieldValue("objectInspector",e),this.objectInspectorChanged(e,t)}}),this.defineProp("issueInspector",{dataType:"Kekule.Editor.IssueInspector",serializable:!1,setter:function(e){var t=this.getPropStoreFieldValue("issueInspector");this.setPropStoreFieldValue("issueInspector",e),this.issueInspectorChanged(e,t)}})},editorChanged:function(e,t){t&&this._uninstallEditorEventHandler(t),e&&this._installEditorEventHandler(e)},structureTreeViewChanged:function(e,t){t&&this._uninstallStructureTreeViewEventHandler(t),e&&(this._installStructureTreeViewEventHandler(e),this._updateByEditor())},objectInspectorChanged:function(e,t){var o=this.getEditor();o&&(t&&t.getOperHistory()===o.getOperHistory()&&t.setOperHistory(null),e&&(e.setOperHistory(o.getOperHistory()),e.setEnableOperHistory(o.getEnableOperHistory()),this._updateByEditor()))},issueInspectorChanged:function(e,t){t&&this._uninstallIssueInspectorEventHandler(t),e&&this._installIssueInspectorEventHandler(e),this.getEditor()&&e&&this._updateByEditor()},_installEditorEventHandler:function(e){e.addEventListener("change",this._reactEditorChanged,this),e.addEventListener("beginUpdateObject",this._reactEditorBeginUpdateObject,this),e.addEventListener("endUpdateObject",this._reactEditorEndUpdateObject,this)},_uninstallEditorEventHandler:function(e){e.removeEventListener("change",this._reactEditorChanged,this),e.removeEventListener("beginUpdateObject",this._reactEditorBeginUpdateObject,this),e.removeEventListener("endUpdateObject",this._reactEditorEndUpdateObject,this)},_installStructureTreeViewEventHandler:function(e){e.addEventListener("change",this._reactStructureTreeViewChanged,this)},_uninstallStructureTreeViewEventHandler:function(e){e.removeEventListener("change",this._reactStructureTreeViewChanged,this)},_installIssueInspectorEventHandler:function(e){e.addEventListener("selectResult",this._reactIssueInspectorSelectResult,this)},_uninstallIssueInspectorEventHandler:function(e){e.removeEventListener("selectResult",this._reactIssueInspectorSelectResult,this)},_reactEditorChanged:function(e){if(!this._currInvoker){var t=e.target;if(t===this.getEditor()){var o=e.changedPropNames;if(o.indexOf("chemObj")>=0&&this.changeRootObj(t.getChemObj(),t),o.indexOf("selection")>=0&&this.changeSelection(t.getSelection(),t),o.indexOf("operHistory")>=0||o.indexOf("enableOperHistory")>=0){var r=this.getObjectInspector();r&&(r.setOperHistory(t.getOperHistory()),r.setEnableOperHistory(t.getEnableOperHistory()))}var i=this.getIssueInspector();i&&(o.indexOf("issueCheckExecutor")>=0&&i.setIssueCheckExecutor(t.getIssueCheckExecutor()),o.indexOf("issueCheckResults")>=0&&i.setCheckResults(t.getIssueCheckResults()))}}},_reactEditorBeginUpdateObject:function(e){this.pauseLiveUpdate()},_reactEditorEndUpdateObject:function(e){this.resumeLiveUpdate()},_updateByEditor:function(){this._reactEditorChanged({target:this.getEditor(),changedPropNames:["chemObj","selection","operHistory","issueCheckExecutor","issueCheckResults"]})},_reactStructureTreeViewChanged:function(e){if(!this._currInvoker){var t=e.target;if(t===this.getStructureTreeView())if(e.changedPropNames.indexOf("selection")>=0){var o=t.getSelectedChemObjs();this.changeSelection(o,t)}}},_reactIssueInspectorSelectResult:function(e){var t=e.selectedResult,o=this.getEditor();o&&o.setActiveIssueCheckResult&&o.setActiveIssueCheckResult(t)},pauseLiveUpdate:function(){var e=this.getStructureTreeView();e&&e.pauseLiveUpdate()},resumeLiveUpdate:function(){var e=this.getStructureTreeView();e&&e.resumeLiveUpdate()},changeSelection:function(e,t){this._currInvoker=t;try{var o=this.getEditor();o&&this._currInvoker!==o&&o.setSelection(e);var r=this.getStructureTreeView();r&&this._currInvoker!==r&&r.selectChemObjs(e);var i=this.getObjectInspector();i&&this._currInvoker!==i&&i.setObjects(e)}finally{this._currInvoker=null}},changeRootObj:function(e,t){this._currInvoker=t;try{var o=this.getEditor();o&&this._currInvoker!==o&&o.setChemObj(e);var r=this.getStructureTreeView();r&&this._currInvoker!==r&&r.setRootObj(e);var i=this.getIssueInspector();i&&this._currInvoker!==i&&i.setRootObj(e)}finally{this._currInvoker=null}}})}(),function(){"use strict";var e=Kekule.ArrayUtils,t=Kekule.ChemWidget.ComponentWidgetNames,o=Kekule.ChemWidget.HtmlClassNames,r=(Kekule.ActionManager,[]);function i(){!function(){for(var e=["C","H","O","N","P","S","Si","F","Cl","Br","I","B","K","Na","D"],t=["methyl","ethyl","phenyl","Ac","TMS","COOCH3","OTs"],o=Kekule.Editor.ActionOperationCreate.ChemNodeModify,r=Kekule.Editor.createEditorOperationCreateActionClass,i=0,n=e.length;i<n;++i)r(null,l="atom_"+e[i],o,{nodeClass:Kekule.Atom,props:{isotopeId:e[i]}});for(i=0,n=t.length;i<n;++i){var a=t[i],l="subgroup_"+a,s=Kekule.Editor.RepositoryItemManager.getItem(a),d=s.getStructureFragment&&s.getStructureFragment();d&&r(null,l,o,{nodeClass:d.getClass(),repositoryItem:s})}r(null,"subgroup_R",o,{nodeClass:Kekule.SubGroup}),r(null,"atom_variable",o,{nodeClass:Kekule.VariableAtom}),r(null,"atom_dummy",o,{nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.DUMMY}}),r(null,"atom_hetero",o,{nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.HETERO}}),r(null,"atom_any",o,{nodeClass:Kekule.Pseudoatom,props:{atomType:Kekule.PseudoatomType.ANY}})}(),function(){for(var e=Kekule.BondType,t=Kekule.BondOrder,o=Kekule.BondStereo,r={single:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.NONE},double:{bondType:e.COVALENT,bondOrder:t.DOUBLE,stereo:o.NONE},triple:{bondType:e.COVALENT,bondOrder:t.TRIPLE,stereo:o.NONE},quad:{bondType:e.COVALENT,bondOrder:t.QUAD,stereo:o.NONE},up:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.UP},down:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.DOWN},closer:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.CLOSER},upOrDown:{bondType:e.COVALENT,bondOrder:t.SINGLE,stereo:o.UP_OR_DOWN}},i=Kekule.Editor.ActionOperationCreate.ChemConnectorModify,n=Kekule.Editor.createEditorOperationCreateActionClass,a=Kekule.ObjUtils.getOwnedFieldNames(r),l=0,s=a.length;l<s;++l)n(null,"bond_"+a[l],i,r[a[l]])}()}Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{ACTION_UNDO:"K-Chem-Undo",ACTION_REDO:"K-Chem-Redo",ACTION_NEWDOC:"K-Chem-NewDoc",ACTION_SELECT_ALL:"K-Chem-SelectAll",ACTION_CLONE_SELECTION:"K-Chem-Clone-Selection",ACTION_COPY:"K-Chem-Copy",ACTION_CUT:"K-Chem-Cut",ACTION_PASTE:"K-Chem-Paste",ACTION_TOGGLE_SELECT:"K-Chem-Toggle-Select-State",ACTION_RECHECK_ISSUES:"K-Chem-Recheck-Issues",ACTION_TOGGLE_OBJ_INSPECTOR:"K-Chem-Toggle-ObjInspector",ACTION_TOGGLE_ISSUE_INSPECTOR:"K-Chem-Toggle-IssueInspector",ACTION_TOGGLE_SHOW_ISSUES:"K-Chem-Toggle-ShowIssues"}),Object.extend(Kekule.ChemWidget.ComponentWidgetNames,{manipulateMarquee:"manipulateMarquee",manipulateLasso:"manipulateLasso",manipulateBrush:"manipulateBrush",manipulateAncestor:"manipulateAncestor",molBondSingle:"bondSingle",molBondDouble:"bondDouble",molBondTriple:"bondTriple",molBondCloser:"bondCloser",molBondWedgeUp:"bondWedgeUp",molBondWedgeDown:"bondWedgeDown",molBondWedgeUpOrDown:"bondWedgeUpOrDown",molBondDoubleEither:"bondDoubleEither",molChargeClear:"chargeClear",molChargePositive:"chargePositive",molChargeNegative:"chargeNegative",molRadicalSinglet:"radicalSinglet",molRadicalTriplet:"radicalTriplet",molRadicalDoublet:"radicalDoublet",molElectronLonePair:"electronLonePair",molChain:"chain",molRing3:"ring3",molRing4:"ring4",molRing5:"ring5",molRing6:"ring6",molRing7:"ring7",molRing8:"ring8",molRingAr6:"ringAr6",molRingAr5:"ringAr5",molFlexRing:"flexRing",molRepCyclopentaneHaworth1:"repCyclopentaneHaworth1",molRepCyclopentaneHaworth2:"repCyclopentaneHaworth2",molRepCyclohexaneHaworth1:"repCyclohexaneHaworth1",molRepCyclohexaneHaworth2:"repCyclohexaneHaworth2",molRepCyclohexaneChair1:"repCyclohexaneChair1",molRepCyclohexaneChair2:"repCyclohexaneChair2",molRepSubBondMark:"subBondMark",molRepMethane:"methane",molRepFischer1:"repFischer1",molRepFischer2:"repFischer2",molRepFischer3:"repFischer3",molRepSawhorseStaggered:"repSawhorseStaggered",molRepSawhorseEclipsed:"repSawhorseEclipsed",glyphRepLine:"repLine",glyphRepOpenArrowLine:"repOpenArrowLine",glyphRepTriangleArrowLine:"repTriangleArrowLine",glyphRepDiOpenArrowLine:"repDiOpenArrowLine",glyphRepDiTriangleArrowLine:"repDiTriangleArrowLine",glyphRepReversibleArrowLine:"repReversibleArrowLine",glyphRepOpenArrowDiLine:"repOpenArrowDiLine",glyphRepOpenArrowArc:"repOpenArrowArc",glyphRepSingleSideOpenArrowArc:"repSingleSideOpenArrowArc",glyphRepHeatSymbol:"repHeatSymbol",glyphRepAddSymbol:"repAddSymbol",glyphElectronPushingArrow:"repElectronPushingArrow",glyphElectronPushingArrowDouble:"repElectronPushingArrowDouble",glyphElectronPushingArrowSingle:"repElectronPushingArrowSingle",glyphElectronPushingArrowBondForming:"repElectronPushingArrowBondForming",glyphRepSegment:"repGlyphSegment",glyphReactionArrowNormal:"repGlyphReactionArrowNormal",glyphReactionArrowReversible:"glyphReactionArrowReversible",glyphReactionArrowResonance:"glyphReactionArrowResonance",glyphReactionArrowRetrosynthesis:"glyphReactionArrowRetrosynthesis"}),Kekule.Editor.ActionOperUtils={getObjsCenterScreenCoord:function(e,t){for(var o=Kekule.BoxUtils,r=Kekule.CoordUtils,i=null,n=0,a=t.length;n<a;++n){var l=Kekule.Render.ObjUtils.getContainerBox(t[n],e.getCoordMode(),e.getAllowCoordBorrow());i=i?o.getContainerBox(l,i):l}var s=o.getMinMaxCoords(i),d={min:e.objCoordToScreen(s.min),max:e.objCoordToScreen(s.max)},u=r.add(d.min,d.max);return u=r.divide(u,2)},addObjectsToChemSpaceEditor:function(t,o,r){var i,n,a,l=Object.extend({autoAdjustPosition:!0},r),s=t.getChemSpace&&t.getChemSpace();if(t&&s&&t.canAddNewStandaloneObject&&t.canAddNewStandaloneObject()){for(var d=[],u=0,c=o.length;u<c;++u){var p=(i=o[u],n=void 0,a=void 0,n=[],(a=s)&&i&&(n=i.getClass()===a.getClass()||i instanceof Kekule.ChemSpace?e.clone(i.getChildren()):[i]),n);p&&p.length&&e.pushUnique(d,p)}t.beginManipulateAndUpdateObject();try{var h=new Kekule.MacroOperation;for(u=0,c=d.length;u<c;++u){var g=d[u],C=new Kekule.ChemObjOperation.Add(g,s,null,t);h.add(C)}h.execute();var _=l.screenCoordOffset;if(!_&&l.autoAdjustPosition){var f=t.getClientVisibleRect(),y={x:f.left+f.width/2,y:f.top+f.height/2},m=this.getObjsCenterScreenCoord(t,d);_=Kekule.CoordUtils.substract(y,m)}if(_)for(u=0,c=d.length;u<c;++u){g=d[u];var O=t.getObjectScreenCoord(g),E=Kekule.CoordUtils.add(O,_);t.setObjectScreenCoord(g,E)}t.pushOperation(h),l.autoSelect&&t.select(d)}finally{t.endManipulateAndUpdateObject()}}}},Kekule.Editor.ActionOnEditor=Class.create(Kekule.ChemWidget.ActionOnDisplayer,{CLASS_NAME:"Kekule.Editor.ActionOnEditor",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,t,o])},initProperties:function(){this.defineProp("explicitGroup",{dataType:DataType.STRING})},getPreferredWidgetClass:function(){return null},doUpdate:function(){var e=this.getDisplayer();this.setEnabled(e&&e.getChemObj()&&e.getChemObjLoaded()&&e.getEnabled())},getEditor:function(){var e=this.getDisplayer();return e instanceof Kekule.Editor.BaseEditor?e:null}}),Kekule.Editor.ActionEditorUndo=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionEditorUndo",HTML_CLASSNAME:o.ACTION_UNDO,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_UNDO"),Kekule.$L("ChemWidgetTexts.HINT_UNDO")])},doUpdate:function(){this.tryApplySuper("doUpdate"),this.getEnabled()&&this.setEnabled(this.getEditor().getEnableOperHistory()&&this.getEditor().canUndo())},doExecute:function(){var e=this.getEditor();e&&e.undo()}}),Kekule.Editor.ActionEditorRedo=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionEditorRedo",HTML_CLASSNAME:o.ACTION_REDO,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_REDO"),Kekule.$L("ChemWidgetTexts.HINT_REDO")])},doUpdate:function(){this.tryApplySuper("doUpdate"),this.getEnabled()&&this.setEnabled(this.getEditor().getEnableOperHistory()&&this.getEditor().canRedo())},doExecute:function(){var e=this.getEditor();e&&e.redo()}}),Kekule.Editor.ActionEditorNewDoc=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionEditorNewDoc",HTML_CLASSNAME:o.ACTION_NEWDOC,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_NEWDOC"),Kekule.$L("ChemWidgetTexts.HINT_NEWDOC")])},doUpdate:function(){var e=this.getDisplayer();this.setEnabled(e&&e.getEnabled()&&e.getEnableCreateNewDoc())},doExecute:function(){var e=this.getEditor();e&&e.newDoc()}}),Kekule.Editor.ActionEditorLoadData=Class.create(Kekule.ChemWidget.ActionDisplayerLoadData,{CLASS_NAME:"Kekule.Editor.ActionEditorLoadData",initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("enableAppend",{dataType:DataType.BOOL})},doExecute:function(e){var t=this.getDataDialog();return t&&t.setDisplayAppendCheckBox&&t.setDisplayAppendCheckBox(this._isEditorRootObjAppendable()&&!this._isEditorEmpty()),this.tryApplySuper("doExecute",[e])},_getEditorRootObj:function(){return this.getDisplayer().getChemObj()},_isEditorRootObjAppendable:function(){var e=this.getDisplayer(),t=this._getEditorRootObj();return t&&t instanceof Kekule.ChemSpace&&e.canAddNewStandaloneObject&&e.canAddNewStandaloneObject()&&e.getAllowAppendDataToCurr&&e.getAllowAppendDataToCurr()},_isEditorEmpty:function(){var e=this._getEditorRootObj();return!e||e.getChildCount&&0===e.getChildCount()},createDataDialog:function(){var e=this.getDisplayer().getDocument();return new Kekule.ChemWidget.LoadOrAppendDataDialog(e)},doLoadToDisplayer:function(e,t){var o=this.getDisplayer();if(!t.getIsAppending()||this._isEditorEmpty()||!this._isEditorRootObjAppendable())return this.tryApplySuper("doLoadToDisplayer",[e,t]);o.beginUpdateObject();try{var r=this._getEditorRootObj();r.beginUpdate();try{Kekule.Editor.ActionOperUtils.addObjectsToChemSpaceEditor(o,[e],{autoSelect:!0})}finally{r.endUpdate()}}finally{o.endUpdateObject()}}}),Kekule.Editor.ActionSelectAll=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionSelectAll",HTML_CLASSNAME:o.ACTION_SELECT_ALL,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_SELECT_ALL"),Kekule.$L("ChemWidgetTexts.HINT_SELECT_ALL")])},doUpdate:function(){this.tryApplySuper("doUpdate"),this.getEnabled()&&this.setEnabled(this.getEditor().getChemObj())},doExecute:function(){this.getEditor().selectAll()}}),Kekule.Editor.ActionCloneSelection=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionCloneSelection",HTML_CLASSNAME:o.ACTION_CLONE_SELECTION,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_CLONE_SELECTION"),Kekule.$L("ChemWidgetTexts.HINT_CLONE_SELECTION")])},_hasCloneMethod:function(){var e=this.getEditor();return e&&e.cloneSelection},doUpdate:function(){this.tryApplySuper("doUpdate"),this.getEnabled()&&this.setEnabled(this._hasCloneMethod()&&this.getEditor().hasSelection()),this.setDisplayed(this._hasCloneMethod()&&this.getEditor().canCloneObjects())},doExecute:function(){var e=this.getEditor();if(e&&e.getChemSpace){var t=e.getDefaultCloneScreenCoordOffset&&e.getDefaultCloneScreenCoordOffset(),o=e.cloneSelection();Kekule.Editor.ActionOperUtils.addObjectsToChemSpaceEditor(e,o,{screenCoordOffset:t,autoSelect:!0})}}}),Kekule.Editor.ActionCopySelection=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionCopySelection",HTML_CLASSNAME:o.ACTION_COPY,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_COPY"),Kekule.$L("ChemWidgetTexts.HINT_COPY")])},doUpdate:function(){this.tryApplySuper("doUpdate"),this.getEnabled()&&this.setEnabled(this.getEditor().hasSelection())},doExecute:function(){var e=this.getEditor(),t=e.getChemSpace&&e.getChemSpace();if(e&&t){var o=e.cloneSelection(),r=new Kekule.IntermediateChemSpace;try{r.appendChildren(o),Kekule.Widget.clipboard.setObjects(Kekule.IO.MimeType.JSON,[r])}finally{r.finalize()}}}}),Kekule.Editor.ActionCutSelection=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionCutSelection",HTML_CLASSNAME:o.ACTION_CUT,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_CUT"),Kekule.$L("ChemWidgetTexts.HINT_CUT")])},doUpdate:function(){this.tryApplySuper("doUpdate"),this.getEnabled()&&this.setEnabled(this.getEditor().hasSelection())},doExecute:function(){var e=this.getEditor(),t=e.getChemSpace&&e.getChemSpace();if(e&&t){var o=e.cloneSelection(),r=new Kekule.IntermediateChemSpace;try{r.appendChildren(o),Kekule.Widget.clipboard.setObjects(Kekule.IO.MimeType.JSON,[r])}finally{r.finalize()}var i=e.getIaController("BasicMolEraserIaController");i&&i.removeSelection()}}}),Kekule.Editor.ActionPaste=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionPaste",HTML_CLASSNAME:o.ACTION_PASTE,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_PASTE"),Kekule.$L("ChemWidgetTexts.HINT_PASTE")]),Kekule.Widget.clipboard.addEventListener("setData",this._reactClipboardChange,this)},finalize:function(){Kekule.Widget.clipboard.removeEventListener("setData",this._reactClipboardChange,this),this.tryApplySuper("finalize")},_reactClipboardChange:function(){this.update()},doUpdate:function(){this.tryApplySuper("doUpdate"),this.getEnabled()&&this.setEnabled(Kekule.Widget.clipboard.hasData(Kekule.IO.MimeType.JSON)&&this.getEditor().canAddNewStandaloneObject())},getObjsCenterScreenCoord:function(e,t){return Kekule.Editor.ActionOperUtils.getObjsCenterScreenCoord(e,t)},doExecute:function(){var t=this.getEditor();if(t&&t.getChemSpace){var o,r,i=Kekule.Widget.clipboard.getObjects(Kekule.IO.MimeType.JSON);1===i.length&&i[0]instanceof Kekule.IntermediateChemSpace?(o=i[0],r=e.clone(o.getChildren()),o.removeChildren(r)):r=i,o&&o.finalize();var n=null,a=t.getSelection();if(a&&a.length){n=t.getDefaultCloneScreenCoordOffset?t.getDefaultCloneScreenCoordOffset():null;var l=e.clone(a);if(l&&l.length&&n){var s=this.getObjsCenterScreenCoord(t,l),d=this.getObjsCenterScreenCoord(t,r),u=Kekule.CoordUtils.substract(s,d);n=Kekule.CoordUtils.add(n,u)}}Kekule.Editor.ActionOperUtils.addObjectsToChemSpaceEditor(t,r,{screenCoordOffset:n,autoSelect:!0})}}}),Kekule.Editor.ActionToggleSelectState=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionToggleSelectState",HTML_CLASSNAME:o.ACTION_TOGGLE_SELECT,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_TOGGLE_SELECT"),Kekule.$L("ChemWidgetTexts.HINT_TOGGLE_SELECT")]),this.setExplicitGroup("")},getPreferredWidgetClass:function(){return Kekule.Widget.CheckButton},doUpdate:function(){this.tryApplySuper("doUpdate"),this.setChecked(this.getEditor().getIsToggleSelectOn())},checkedChanged:function(){this.tryApplySuper("checkedChanged")},doExecute:function(e,t){this.tryApplySuper("doExecute",[e,t]);var o=this.getChecked();this.getEditor().setIsToggleSelectOn(!o),this.setChecked(!o)}}),Kekule.Editor.ActionRecheckIssues=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionRecheckIssues",HTML_CLASSNAME:o.ACTION_RECHECK_ISSUES,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_RECHECK_ISSUES"),Kekule.$L("ChemWidgetTexts.HINT_RECHECK_ISSUES")])},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getEditor();this.setEnabled(e.getEnableIssueCheck()).setDisplayed(e.getEnableIssueCheck())},doExecute:function(e,t){this.tryApplySuper("doExecute",[e,t]);var o=this.getEditor();o&&o.checkIssues()}}),Kekule.Editor.ActionToggleShowIssueMarkers=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionToggleShowIssueMarkers",HTML_CLASSNAME:o.ACTION_TOGGLE_SHOW_ISSUES,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_TOGGLE_SHOW_ISSUE_MARKERS"),Kekule.$L("ChemWidgetTexts.HINT_TOGGLE_SHOW_ISSUE_MARKERS")]),this.setExplicitGroup("")},getPreferredWidgetClass:function(){return Kekule.Widget.CheckButton},doUpdate:function(){this.tryApplySuper("doUpdate");var e=this.getEditor();this.setChecked(e.getShowAllIssueMarkers()),this.setEnabled(e.getEnableIssueCheck()).setDisplayed(e.getEnableIssueCheck())},doExecute:function(e,t){this.tryApplySuper("doExecute",[e,t]);var o=this.getChecked();this.getEditor().setShowAllIssueMarkers(!o),this.setChecked(!o)}}),Kekule.Editor.ActionOperationCreate={},Kekule.Editor.ActionOperationCreate.Base=Class.create(Kekule.Editor.ActionOnEditor,{CLASS_NAME:"Kekule.Editor.ActionOperationCreate.Base",initialize:function(e){this.tryApplySuper("initialize",[e])},applicable:function(e){var t=this.getOperationTargets();if(t&&t.length){for(var o=this.getData(),r=0,i=t.length;r<i;++r)if(this.applicableOnTarget(t[r],o,e))return!0;return!1}return!1},applicableOnTarget:function(e,t,o){return!1},getOperationTargets:function(e){return[]},getData:function(){return this.ACTION_DATA||{}},createOperations:function(e){for(var t=this.getOperationTargets(e),o=this.getData(),r=[],i=0,n=t.length;i<n;++i){var a=t[i];if(this.applicableOnTarget(a,o,e)){var l=this.doCreateOperationOnTarget(a,o,e);l&&r.push(l)}}return r},doCreateOperationOnTarget:function(e,t,o){return null},doExecute:function(){var e=this.getEditor(),t=this.getModificationTargets(e),o=this.createOperations(t,data,e);return!(!o||!o.length)&&(e.execOperations(o),!0)}}),Kekule.Editor.ActionOperationCreate.ChemObjModify=Class.create(Kekule.Editor.ActionOperationCreate.Base,{CLASS_NAME:"Kekule.Editor.ActionOperationCreate.ChemObjModify",getOperationTargets:function(e){var t=e.getHotTrackedObjs();return t&&t.length||(t=e.getSelection()),t}}),Kekule.Editor.ActionOperationCreate.ChemNodeModify=Class.create(Kekule.Editor.ActionOperationCreate.ChemObjModify,{CLASS_NAME:"Kekule.Editor.ActionOperationCreate.ChemNodeModify",applicableOnTarget:function(e,t,o){return e instanceof Kekule.ChemStructureNode&&!(e instanceof Kekule.Molecule)&&e.getLinkedBonds().length},doCreateOperationOnTarget:function(e,t,o){return Kekule.Editor.OperationUtils.createNodeModificationOperationFromData(e,t,o)}}),Kekule.Editor.ActionOperationCreate.ChemConnectorModify=Class.create(Kekule.Editor.ActionOperationCreate.ChemObjModify,{CLASS_NAME:"Kekule.Editor.ActionOperationCreate.ChemConnectorModify",applicableOnTarget:function(e,t,o){return e instanceof Kekule.ChemStructureConnector},doCreateOperationOnTarget:function(e,t,o){return new Kekule.ChemObjOperation.Modify(e,t,o)}}),Kekule.Editor.createEditorOperationCreateActionClass=function(e,t,o,i){var n={};e&&(n.CLASS_NAME="Kekule.Editor.ActionOperationCreate."+e),i&&(n.ACTION_DATA=i);var a=Class.create(o,n);return t&&r.push({name:t,actionClass:a}),a},Kekule.Editor.ActionOnComposer=Class.create(Kekule.Action,{CLASS_NAME:"Kekule.Editor.ActionOnComposer",initialize:function(e,t,o){this.tryApplySuper("initialize"),this.setText(t),this.setHint(o),this.setComposer(e)},initProperties:function(){this.defineProp("composer",{dataType:"Kekule.Editor.Composer",serializable:!1})},doUpdate:function(){var e=this.getComposer(),t=this.getEditor();this.setEnabled(e&&e.getEnabled()&&t&&t.getChemObj()&&t.getChemObjLoaded()&&t.getEnabled())},getEditor:function(){var e=this.getComposer();return e?e.getEditor():null}}),Kekule.Editor.ActionOnComposerAdv=Class.create(Kekule.Editor.ActionOnComposer,{CLASS_NAME:"Kekule.Editor.ActionOnComposerAdv",initialize:function(e,t,o){var r=new Kekule.ActionList;r.setOwnActions(!0),this.setPropStoreFieldValue("attachedActions",r),this.tryApplySuper("initialize",[e,t,o])},finalize:function(){this.getAttachedActions().finalize(),this.tryApplySuper("finalize")},initProperties:function(){this.defineProp("attachedActionClasses",{dataType:DataType.ARRAY,serializable:!1,setter:null}),this.defineProp("attachedActions",{dataType:"Kekule.ActionList",serializable:!1,setter:null}),this.defineProp("defaultAttachedAction",{dataType:"Kekule.Action",serializable:!1})},checkedChanged:function(){this.tryApplySuper("checkedChanged");var e=this.getChecked();if(this.hasAttachedActions()){var t=this.getComposer();if(t)if(e){var o=this.getAttachedActions();t.bindAssocActions(o),t.showAssocToolbar();var r=o.getCheckedAction(this.getClassName());r||(r=this.getDefaultAttachedAction()),r&&(r.setChecked(!1),r.execute())}else t.hideAssocToolbar()}},hasAttachedActions:function(){return!!this.getAttachedActions().getActionCount()},setAttachedActionIndex:function(e,t){var o=this.getAttachedActions();return o&&o.setActionIndex(e,t),this},addAttachedAction:function(e,t){return this.getAttachedActions().add(e),t&&this.setDefaultAttachedAction(e),this},removeAttachedAction:function(e){return this.getDefaultAttachedAction()===e&&this.setDefaultAttachedAction(null),this.getAttachedActions().remove(e),this},clearAttachedActions:function(){this.setDefaultAttachedAction(null),this.getAttachedActions().clear()},doExecute:function(){},update:function(){this.tryApplySuper("update"),this.getAttachedActions().updateAll()}}),Kekule.Editor.ActionComposerToggleObjInspector=Class.create(Kekule.Editor.ActionOnComposer,{CLASS_NAME:"Kekule.Editor.ActionComposerToggleObjInspector",HTML_CLASSNAME:o.ACTION_TOGGLE_OBJ_INSPECTOR,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_TOGGLE_OBJ_INSPECTOR"),Kekule.$L("ChemWidgetTexts.HINT_TOGGLE_OBJ_INSPECTOR")])},doUpdate:function(){var e=this.getComposer();e&&this.setChecked(e.getShowObjInspector())},doExecute:function(){var e=this.getComposer();e&&(this.setChecked(!this.getChecked()),e.setShowObjInspector(this.getChecked()))}}),Kekule.Editor.ActionComposerToggleInspector=Kekule.Editor.ActionComposerToggleObjInspector,Kekule.Editor.ActionComposerToggleIssueInspector=Class.create(Kekule.Editor.ActionOnComposer,{CLASS_NAME:"Kekule.Editor.ActionComposerToggleIssueInspector",HTML_CLASSNAME:o.ACTION_TOGGLE_ISSUE_INSPECTOR,initialize:function(e){this.tryApplySuper("initialize",[e,Kekule.$L("ChemWidgetTexts.CAPTION_TOGGLE_ISSUE_INSPECTOR"),Kekule.$L("ChemWidgetTexts.HINT_TOGGLE_ISSUE_INSPECTOR")])},doUpdate:function(){var e=this.getComposer();e&&(this.setChecked(e.getShowIssueInspector()),this.setEnabled(e.getEnableIssueCheck()).setDisplayed(e.getEnableIssueCheck()))},doExecute:function(){var e=this.getComposer();e&&(this.setChecked(!this.getChecked()),e.setShowIssueInspector(this.getChecked()))}}),Kekule.Editor.ActionComposerSetIaController=Class.create(Kekule.Editor.ActionOnComposerAdv,{CLASS_NAME:"Kekule.Editor.ActionComposerSetIaController",initialize:function(e,t,o,r){this.tryApplySuper("initialize",[e,t,o]),this.setPropStoreFieldValue("iaControllerId",r)},initProperties:function(){this.defineProp("iaControllerId",{dataType:DataType.STRING,serializable:!1,setter:null})},doExecute:function(){this.getEditor().setActiveIaControllerId(this.getIaControllerId())}}),Kekule.Editor.createComposerIaControllerActionClass=function(e,t,o,i,n,a,l,s,d,u){n||(n=i),n.startsWith(Kekule.ChemWidget.HtmlClassNames.PREFIX)||(n=Kekule.ChemWidget.HtmlClassNames.PREFIX+n);var c,p={CLASS_NAME:e,HTML_CLASSNAME:n,initialize:function(e){this.tryApplySuper("initialize",[e,t,o,i]),this.initAttachedActions&&this.initAttachedActions()}};(s&&(p=Object.extend(p,s)),a)&&(p.doExecute&&(c=p.doExecute),p.doExecute=function(){var e=this.getEditor().getIaController(i);e&&e.setPropValues(a),c?c.apply(this):this.tryApplySuper("doExecute")});l&&(p.initAttachedActions=function(){this.setPropStoreFieldValue("attachedActionClasses",l)});var h=Class.create(Kekule.Editor.ActionComposerSetIaController,p);return d&&r.push({name:d,actionClass:h,widgetClass:u}),h},Kekule.Editor.ActionComposerClientDragScrollController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerClientDragScrollController",Kekule.$L("ChemWidgetTexts.CAPTION_CLIENT_DRAGSCROLL"),Kekule.$L("ChemWidgetTexts.HINT_CLIENT_DRAGSCROLL"),"ClientDragScrollIaController",null,null,null,null,t.dragScroll),Kekule.Editor.ActionComposerSetManipulateControllerMarquee=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetManipulateControllerMarquee",Kekule.$L("ChemWidgetTexts.CAPTION_MANIPULATE_MARQUEE"),Kekule.$L("ChemWidgetTexts.HINT_MANIPULATE_MARQUEE"),"SelectIaController","SelectIaController-Marquee",{enableGestureManipulation:!0,selectMode:Kekule.Editor.SelectMode.RECT},null,{doExecute:function(){this.tryApplySuper("doExecute"),this.getEditor().setSelectMode(Kekule.Editor.SelectMode.RECT)}},t.manipulateMarquee),Kekule.Editor.ActionComposerSetManipulateControllerLasso=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetManipulateControllerLasso",Kekule.$L("ChemWidgetTexts.CAPTION_MANIPULATE_LASSO"),Kekule.$L("ChemWidgetTexts.HINT_MANIPULATE_LASSO"),"SelectIaController","SelectIaController-Lasso",{enableGestureManipulation:!0,selectMode:Kekule.Editor.SelectMode.POLYGON},null,{doExecute:function(){this.tryApplySuper("doExecute"),this.getEditor().setSelectMode(Kekule.Editor.SelectMode.POLYGON)}},t.manipulateLasso),Kekule.Editor.ActionComposerSetManipulateControllerBrush=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetManipulateControllerBrush",Kekule.$L("ChemWidgetTexts.CAPTION_MANIPULATE_BRUSH"),Kekule.$L("ChemWidgetTexts.HINT_MANIPULATE_BRUSH"),"SelectIaController","SelectIaController-Brush",{enableGestureManipulation:!0,selectMode:Kekule.Editor.SelectMode.POLYLINE},null,{doExecute:function(){this.tryApplySuper("doExecute"),this.getEditor().setSelectMode(Kekule.Editor.SelectMode.POLYLINE)}},t.manipulateBrush),Kekule.Editor.ActionComposerSetManipulateControllerAncestor=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetManipulateControllerAncestor",Kekule.$L("ChemWidgetTexts.CAPTION_MANIPULATE_ANCESTOR"),Kekule.$L("ChemWidgetTexts.HINT_MANIPULATE_ANCESTOR"),"SelectIaController","SelectIaController-Ancestor",{enableGestureManipulation:!0,selectMode:Kekule.Editor.SelectMode.ANCESTOR},null,{doExecute:function(){this.tryApplySuper("doExecute"),this.getEditor().setSelectMode(Kekule.Editor.SelectMode.ANCESTOR)}},t.manipulateAncestor),Kekule.Editor.ActionComposerSetManipulateController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetManipulateController",Kekule.$L("ChemWidgetTexts.CAPTION_MANIPULATE"),Kekule.$L("ChemWidgetTexts.HINT_MANIPULATE"),"SelectIaController",null,null,[Kekule.Editor.ActionComposerSetManipulateControllerMarquee,Kekule.Editor.ActionComposerSetManipulateControllerLasso,Kekule.Editor.ActionComposerSetManipulateControllerBrush,Kekule.Editor.ActionComposerSetManipulateControllerAncestor,Kekule.Editor.ActionComposerClientDragScrollController,Kekule.Editor.ActionToggleSelectState],null,t.manipulate),Kekule.Editor.ActionComposerSetEraserController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetEraserController",Kekule.$L("ChemWidgetTexts.CAPTION_ERASE"),Kekule.$L("ChemWidgetTexts.HINT_ERASE"),"BasicMolEraserIaController",null,null,null,{doExecute:function(){this.tryApplySuper("doExecute");var e=this.getEditor();e.hasSelection()&&e.getActiveIaController().removeSelection()}},t.erase),Kekule.Editor.ActionComposerSetTrackController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetTrackController",Kekule.$L("ChemWidgetTexts.CAPTION_TRACK_INPUT"),Kekule.$L("ChemWidgetTexts.HINT_TRACK_INPUT"),"TrackInputIaController",null,null,null,null,t.trackInput),Kekule.Editor.ActionComposerSetBondControllerSingle=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerSingle",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_SINGLE"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_SINGLE"),"MolBondIaController","MolBondIaController-Single",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.SINGLE,bondStereo:Kekule.BondStereo.NONE},null,null,t.molBondSingle),Kekule.Editor.ActionComposerSetBondControllerDouble=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerDouble",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_DOUBLE"),"MolBondIaController","MolBondIaController-Double",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.DOUBLE,bondStereo:Kekule.BondStereo.NONE},null,null,t.molBondDouble),Kekule.Editor.ActionComposerSetBondControllerTriple=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerTriple",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_TRIPLE"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_TRIPLE"),"MolBondIaController","MolBondIaController-Triple",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.TRIPLE,bondStereo:Kekule.BondStereo.NONE},null,null,t.molBondTriple),Kekule.Editor.ActionComposerSetBondControllerCloser=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerCloser",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_CLOSER"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_CLOSER"),"MolBondIaController","MolBondIaController-Closer",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.SINGLE,bondStereo:Kekule.BondStereo.CLOSER},null,null,t.molBondCloser),Kekule.Editor.ActionComposerSetBondControllerWedgeUp=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerWedgeUp",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEUP"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_WEDGEUP"),"MolBondIaController","MolBondIaController-WedgeUp",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.SINGLE,bondStereo:Kekule.BondStereo.UP},null,null,t.molBondWedgeUp),Kekule.Editor.ActionComposerSetBondControllerWedgeDown=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerWedgeDown",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEDOWN"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_WEDGEDOWN"),"MolBondIaController","MolBondIaController-WedgeDown",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.SINGLE,bondStereo:Kekule.BondStereo.DOWN},null,null,t.molBondWedgeDown),Kekule.Editor.ActionComposerSetBondControllerWedgeUpOrDown=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerWedgeUpOrDown",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_WAVY"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_WAVY"),"MolBondIaController","MolBondIaController-WedgeUpOrDown",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.SINGLE,bondStereo:Kekule.BondStereo.UP_OR_DOWN},null,null,t.molBondWedgeUpOrDown),Kekule.Editor.ActionComposerSetBondControllerDoubleEither=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondControllerDoubleEither",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE_EITHER"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND_DOUBLE_EITHER"),"MolBondIaController","MolBondIaController-Double-Either",{bondType:Kekule.BondType.COVALENT,bondOrder:Kekule.BondOrder.DOUBLE,bondStereo:Kekule.BondStereo.E_OR_Z},null,null,t.molBondDoubleEither),Kekule.Editor.ActionComposerSetRepositoryFischer1Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryFischer1Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_FISCHER1"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_FISCHER1"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-Fischer1",{repItemName:"fischer1"},null,null,t.molRepFischer1),Kekule.Editor.ActionComposerSetRepositoryFischer2Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryFischer2Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_FISCHER2"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_FISCHER2"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-Fischer2",{repItemName:"fischer2"},null,null,t.molRepFischer2),Kekule.Editor.ActionComposerSetRepositoryFischer3Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryFischer3Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_FISCHER3"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_FISCHER3"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-Fischer3",{repItemName:"fischer3"},null,null,t.molRepFischer3),Kekule.Editor.ActionComposerSetRepositorySawhorseStaggeredController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositorySawhorseStaggeredController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_SAWHORSE_STAGGERED"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_SAWHORSE_STAGGERED"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-SawhorseStaggered",{repItemName:"sawhorseStaggered"},null,null,t.molRepSawhorseStaggered),Kekule.Editor.ActionComposerSetRepositorySawhorseEclipsedController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositorySawhorseEclipsedController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_SAWHORSE_ECLIPSED"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_SAWHORSE_ECLIPSED"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-SawhorseEclipsed",{repItemName:"sawhorseEclipsed"},null,null,t.molRepSawhorseEclipsed),Kekule.Editor.ActionComposerSetRepositoryMethaneController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryMethaneController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_METHANE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_METHANE"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-Methane",{repItemName:"methane"},null,null,t.molRepMethane),Kekule.Editor.ActionComposerSetRepositorySubBondMarkController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositorySubBondMarkController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_SUBBOND_MARK"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_SUBBOND_MARK"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-SubBondMark",{repItemName:"substituentMark"},null,null,t.molRepSubBondMark),Kekule.Editor.ActionComposerSetRepositoryMolFlexChainController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryMolFlexChainController",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_FLEXCHAIN"),Kekule.$L("ChemWidgetTexts.HINT_MOL_FLEXCHAIN"),"MolFlexChainIaController","MolFlexChainIaController",null,null,null,t.molChain),Kekule.Editor.ActionComposerSetBondController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetBondController",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_BOND"),Kekule.$L("ChemWidgetTexts.HINT_MOL_BOND"),"MolBondIaController",null,null,[Kekule.Editor.ActionComposerSetBondControllerSingle,Kekule.Editor.ActionComposerSetBondControllerDouble,Kekule.Editor.ActionComposerSetBondControllerTriple,Kekule.Editor.ActionComposerSetBondControllerWedgeUp,Kekule.Editor.ActionComposerSetBondControllerWedgeDown,Kekule.Editor.ActionComposerSetRepositoryMolFlexChainController,Kekule.Editor.ActionComposerSetTrackController,Kekule.Editor.ActionComposerSetRepositoryFischer1Controller,Kekule.Editor.ActionComposerSetRepositorySawhorseStaggeredController,Kekule.Editor.ActionComposerSetRepositorySawhorseEclipsedController],null,t.molBond),Kekule.Editor.ActionComposerSetAtomController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetAtomController",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_ATOM"),Kekule.$L("ChemWidgetTexts.HINT_MOL_ATOM"),"MolAtomIaController",null,null,null,null,t.molAtom),Kekule.Editor.ActionComposerSetFormulaController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetFormulaController",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_FORMULA"),Kekule.$L("ChemWidgetTexts.HINT_MOL_FORMULA"),"FormulaIaController",null,null,null,null,t.molFormula),Kekule.Editor.ActionComposerSetAtomAndFormulaController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetAtomAndFormulaController",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_ATOM_AND_FORMULA"),Kekule.$L("ChemWidgetTexts.HINT_MOL_ATOM_AND_FORMULA"),"MolAtomIaController",null,null,[Kekule.Editor.ActionComposerSetAtomController,Kekule.Editor.ActionComposerSetRepositoryMethaneController,Kekule.Editor.ActionComposerSetFormulaController],null,t.molAtomAndFormula),Kekule.Editor.ActionComposerSetAttachedMarkerIaControllerLonePair=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetAttachedMarkerIaControllerLonePair",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_ELECTRON_LONEPAIR"),Kekule.$L("ChemWidgetTexts.HINT_MOL_ELECTRON_LONEPAIR"),"AttachedMarkerIaController","AttachedMarkerIaController-LonePair",{markerClassName:"Kekule.ChemMarker.UnbondedElectronSet",targetClassName:"Kekule.AbstractAtom",initialPropValues:{electronCount:2}},null,null,t.molElectronLonePair),Kekule.Editor.ActionComposerSetNodeChargeControllerClear=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetNodeChargeControllerClear",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_CHARGE_CLEAR"),Kekule.$L("ChemWidgetTexts.HINT_MOL_CHARGE_CLEAR"),"MolNodeChargeIaController","MolNodeChargeIaController-Clear",{charge:0,chargeInc:0,radical:Kekule.RadicalOrder.NONE},null,null,t.molChargeClear),Kekule.Editor.ActionComposerSetNodeChargeControllerPositive=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetNodeChargeControllerPositive",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_CHARGE_POSITIVE"),Kekule.$L("ChemWidgetTexts.HINT_MOL_CHARGE_POSITIVE"),"MolNodeChargeIaController","MolNodeChargeIaController-Positive",{charge:null,chargeInc:1,radical:Kekule.RadicalOrder.NONE},null,null,t.molChargePositive),Kekule.Editor.ActionComposerSetNodeChargeControllerNegative=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetNodeChargeControllerNegative",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_CHARGE_NEGATIVE"),Kekule.$L("ChemWidgetTexts.HINT_MOL_CHARGE_NEGATIVE"),"MolNodeChargeIaController","MolNodeChargeIaController-Negative",{charge:null,chargeInc:-1,radical:Kekule.RadicalOrder.NONE},null,null,t.molChargeNegative),Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalSinglet=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalSinglet",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_CHARGE_SINGLET"),Kekule.$L("ChemWidgetTexts.HINT_MOL_CHARGE_SINGLET"),"MolNodeChargeIaController","MolNodeChargeIaController-Singlet",{charge:null,chargeInc:0,radical:Kekule.RadicalOrder.SINGLET},null,null,t.molRadicalSinglet),Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalTriplet=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalTriplet",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_CHARGE_TRIPLET"),Kekule.$L("ChemWidgetTexts.HINT_MOL_CHARGE_TRIPLET"),"MolNodeChargeIaController","MolNodeChargeIaController-Triplet",{charge:null,chargeInc:0,radical:Kekule.RadicalOrder.TRIPLET},null,null,t.molRadicalTriplet),Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalDoublet=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalDoublet",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_CHARGE_DOUBLET"),Kekule.$L("ChemWidgetTexts.HINT_MOL_CHARGE_DOUBLET"),"MolNodeChargeIaController","MolNodeChargeIaController-Doublet",{charge:null,chargeInc:0,radical:Kekule.RadicalOrder.DOUBLET},null,null,t.molRadicalDoublet),Kekule.Editor.ActionComposerSetNodeChargeController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetNodeChargeController",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_CHARGE"),Kekule.$L("ChemWidgetTexts.HINT_MOL_CHARGE"),"MolNodeChargeIaController",null,null,[Kekule.Editor.ActionComposerSetNodeChargeControllerClear,Kekule.Editor.ActionComposerSetNodeChargeControllerPositive,Kekule.Editor.ActionComposerSetNodeChargeControllerNegative,Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalSinglet,Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalTriplet,Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalDoublet,Kekule.Editor.ActionComposerSetAttachedMarkerIaControllerLonePair],null,t.molCharge),Kekule.Editor.ActionComposerSetTextBlockController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetTextBlockController",Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_BLOCK"),Kekule.$L("ChemWidgetTexts.HINT_TEXT_BLOCK"),"TextBlockIaController",null,null,null,null,t.textBlock),Kekule.Editor.ActionComposerSetImageBlockController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetImageBlockController",Kekule.$L("ChemWidgetTexts.CAPTION_IMAGE_BLOCK"),Kekule.$L("ChemWidgetTexts.HINT_IMAGE_BLOCK"),"ImageBlockIaController",null,null,null,null,t.imageBlock),Kekule.Editor.ActionComposerSetTextImageController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetTextImageController",Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_IMAGE"),Kekule.$L("ChemWidgetTexts.HINT_TEXT_IMAGE"),"TextImageIaController","TextImageIaController",null,[Kekule.Editor.ActionComposerSetTextBlockController,Kekule.Editor.ActionComposerSetImageBlockController],null,t.textImage),Kekule.Editor.ActionComposerSetRepositoryRing3Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRing3Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_3"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_3"),"MolRingIaController","MolRingIaController-3",{ringAtomCount:3,isAromatic:!1},null,null,t.molRing3),Kekule.Editor.ActionComposerSetRepositoryRing4Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRing4Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_4"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_4"),"MolRingIaController","MolRingIaController-4",{ringAtomCount:4,isAromatic:!1},null,null,t.molRing4),Kekule.Editor.ActionComposerSetRepositoryRing5Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRing5Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_5"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_5"),"MolRingIaController","MolRingIaController-5",{ringAtomCount:5,isAromatic:!1},null,null,t.molRing5),Kekule.Editor.ActionComposerSetRepositoryRing6Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRing6Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_6"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_6"),"MolRingIaController","MolRingIaController-6",{ringAtomCount:6,isAromatic:!1},null,null,t.molRing6),Kekule.Editor.ActionComposerSetRepositoryRing7Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRing7Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_7"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_7"),"MolRingIaController","MolRingIaController-7",{ringAtomCount:7,isAromatic:!1},null,null,t.molRing7),Kekule.Editor.ActionComposerSetRepositoryRing8Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRing8Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_8"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_8"),"MolRingIaController","MolRingIaController-8",{ringAtomCount:8,isAromatic:!1},null,null,t.molRing8),Kekule.Editor.ActionComposerSetRepositoryRingAr6Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRingAr6Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_6"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_AR_6"),"MolRingIaController","MolRingIaController-Ar-6",{ringAtomCount:6,isAromatic:!0},null,null,t.molRingAr6),Kekule.Editor.ActionComposerSetRepositoryRingAr5Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRingAr5Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_5"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING_AR_5"),"MolRingIaController","MolRingIaController-Ar-5",{ringAtomCount:5,isAromatic:!0},null,null,t.molRingAr5),Kekule.Editor.ActionComposerSetRepositoryMolFlexRingController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryMolFlexRingController",Kekule.$L("ChemWidgetTexts.CAPTION_MOL_FLEXRING"),Kekule.$L("ChemWidgetTexts.HINT_MOL_FLEXRING"),"MolFlexRingIaController","MolFlexRingIaController",null,null,null,t.molFlexRing),Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth1Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth1Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOPENTANE_HARWORTH1"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_CYCLOPENTANE_HARWORTH1"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-CyclopentaneHaworth1",{repItemName:"cyclopentaneHaworth1"},null,null,t.molRepCyclopentaneHaworth1),Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth2Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth2Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOPENTANE_HARWORTH2"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_CYCLOPENTANE_HARWORTH2"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-CyclopentaneHaworth2",{repItemName:"cyclopentaneHaworth2"},null,null,t.molRepCyclopentaneHaworth2),Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth1Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth1Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_HARWORTH1"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_HARWORTH1"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-CyclohexaneHaworth1",{repItemName:"cyclohexaneHaworth1"},null,null,t.molRepCyclohexaneHaworth1),Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth2Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth2Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_HARWORTH2"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_HARWORTH2"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-CyclohexaneHaworth2",{repItemName:"cyclohexaneHaworth2"},null,null,t.molRepCyclohexaneHaworth2),Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair1Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair1Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_CHAIR1"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_CHAIR1"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-CyclohexaneChair1",{repItemName:"cyclohexaneChair1"},null,null,t.molRepCyclohexaneChair1),Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair2Controller=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair2Controller",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_CHAIR2"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_CHAIR2"),"RepositoryStructureFragmentIaController","RepositoryStructureFragmentIaController-CyclohexaneChair2",{repItemName:"cyclohexaneChair2"},null,null,t.molRepCyclohexaneChair2),Kekule.Editor.ActionComposerSetRepositoryRingController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRingController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_RING"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_RING"),"MolRingIaController",null,null,[Kekule.Editor.ActionComposerSetRepositoryRing3Controller,Kekule.Editor.ActionComposerSetRepositoryRing4Controller,Kekule.Editor.ActionComposerSetRepositoryRing5Controller,Kekule.Editor.ActionComposerSetRepositoryRing6Controller,Kekule.Editor.ActionComposerSetRepositoryMolFlexRingController,Kekule.Editor.ActionComposerSetRepositoryRingAr6Controller,Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth1Controller,Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth1Controller,Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair1Controller,Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair2Controller],null,t.molRing),Kekule.Editor.ActionComposerSetRepositoryPathLineController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathGlyphLineController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_LINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_LINE"),"ArrowLineIaController","ArrowLineIaController-Line",{glyphClass:Kekule.Glyph.StraightLine,glyphInitialParams:null,lineLength:1.5},null,null,t.glyphRepLine),Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowLineController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowLineController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_LINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_LINE"),"ArrowLineIaController","ArrowLineIaController-OpenArrowLine",{glyphClass:Kekule.Glyph.StraightLine,glyphInitialParams:{endArrowType:Kekule.Glyph.ArrowType.OPEN,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5}},null,null,t.glyphRepOpenArrowLine),Kekule.Editor.ActionComposerSetRepositoryPathTriangleArrowLineController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathTriangleArrowLineController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_TRIANGLE_ARROW_LINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_TRIANGLE_ARROW_LINE"),"ArrowLineIaController","ArrowLineIaController-TriangleArrowLine",{glyphClass:Kekule.Glyph.StraightLine,glyphInitialParams:{endArrowType:Kekule.Glyph.ArrowType.TRIANGLE,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5}},null,null,t.glyphRepTriangleArrowLine),Kekule.Editor.ActionComposerSetRepositoryPathDiOpenArrowLineController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathDiOpenArrowLineController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_DI_OPEN_ARROW_LINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_DI_OPEN_ARROW_LINE"),"ArrowLineIaController","ArrowLineIaController-DiOpenArrowLine",{glyphClass:Kekule.Glyph.StraightLine,glyphInitialParams:{startArrowType:Kekule.Glyph.ArrowType.OPEN,startArrowWidth:.25,startArrowLength:.25,endArrowType:Kekule.Glyph.ArrowType.OPEN,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5}},null,null,t.glyphRepDiOpenArrowLine),Kekule.Editor.ActionComposerSetRepositoryPathDiTriangleArrowLineController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathDiTriangleArrowLineController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_DI_TRIANGLE_ARROW_LINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_DI_TRIANGLE_ARROW_LINE"),"ArrowLineIaController","ArrowLineIaController-DiTriangleArrowLine",{glyphClass:Kekule.Glyph.StraightLine,glyphInitialParams:{startArrowType:Kekule.Glyph.ArrowType.TRIANGLE,startArrowWidth:.25,startArrowLength:.25,endArrowType:Kekule.Glyph.ArrowType.TRIANGLE,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5}},null,null,t.glyphRepDiTriangleArrowLine),Kekule.Editor.ActionComposerSetRepositoryPathReversibleArrowLineController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathReversibleArrowLineController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_REV_ARROW_LINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_REV_ARROW_LINE"),"ArrowLineIaController","ArrowLineIaController-ReversibleArrowLine",{glyphClass:Kekule.Glyph.StraightLine,glyphInitialParams:{startArrowType:Kekule.Glyph.ArrowType.OPEN,startArrowSide:Kekule.Glyph.ArrowSide.REVERSED,startArrowWidth:.25,startArrowLength:.25,endArrowType:Kekule.Glyph.ArrowType.OPEN,endArrowSide:Kekule.Glyph.ArrowSide.SINGLE,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5,lineGap:.1,lineCount:2}},null,null,t.glyphRepReversibleArrowLine),Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowDblLineController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowDblLineController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_DILINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_DILINE"),"ArrowLineIaController","ArrowLineIaController-OpenArrowDiLine",{glyphClass:Kekule.Glyph.StraightLine,glyphInitialParams:{endArrowType:Kekule.Glyph.ArrowType.OPEN,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5,lineGap:.1,lineCount:2}},null,null,t.glyphRepOpenArrowDiLine),Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowArcController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowArcController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_ARC"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_ARC"),"ArrowLineIaController","ArrowLineIaController-OpenArrowArc",{glyphClass:Kekule.Glyph.BaseArc,glyphInitialParams:{endArrowType:Kekule.Glyph.ArrowType.OPEN,endArrowWidth:.25,endArrowLength:.25,lineLength:1,lineGap:.1,lineCount:1}},null,null,t.glyphRepOpenArrowArc),Kekule.Editor.ActionComposerSetRepositoryPathSingleSideOpenArrowArcController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryPathSingleSideOpenArrowArcController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_SINGLE_SIDE_OPEN_ARROW_ARC"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_SINGLE_SIDE_OPEN_ARROW_ARC"),"ArrowLineIaController","ArrowLineIaController-SingleSideOpenArrowArc",{glyphClass:Kekule.Glyph.BaseArc,glyphInitialParams:{endArrowType:Kekule.Glyph.ArrowType.OPEN,endArrowSide:Kekule.Glyph.ArrowSide.REVERSED,endArrowWidth:.25,endArrowLength:.25,lineLength:1,lineGap:.1,lineCount:1}},null,null,t.glyphRepSingleSideOpenArrowArc),Kekule.Editor.ActionComposerSetRepositoryHeatSymbolController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryHeatSymbolController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_HEAT_SYMBOL"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_HEAT_SYMBOL"),"ArrowLineIaController","ArrowLineIaController-HeatSymbol",{glyphClass:Kekule.Glyph.HeatSymbol,glyphInitialParams:{lineLength:1}},null,null,t.glyphRepHeatSymbol),Kekule.Editor.ActionComposerSetRepositoryAddSymbolController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryAddSymbolController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_ADD_SYMBOL"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_ADD_SYMBOL"),"ArrowLineIaController","ArrowLineIaController-AddSymbol",{glyphClass:Kekule.Glyph.AddSymbol,glyphInitialParams:{lineLength:1}},null,null,t.glyphRepAddSymbol),Kekule.Editor.ActionComposerSetRepositoryLineSegmentController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryLineSegmentController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_LINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_GLYPH_LINE"),"ArrowLineIaController","ArrowLineIaController-Line",{glyphClass:Kekule.Glyph.Segment,glyphInitialParams:{startArrowWidth:.25,startArrowLength:.25,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5,lineGap:.1}},null,null,t.glyphRepSegment),Kekule.Editor.ActionComposerSetRepositoryNormalReactionArrowController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryNormalReactionArrowController",Kekule.$L("ChemWidgetTexts.CAPTION_REACTION_ARROW_NORMAL"),Kekule.$L("ChemWidgetTexts.HINT_REACTION_ARROW_NORMAL"),"ArrowLineIaController","ArrowLineIaController-ReactionArrowNormal",{glyphClass:Kekule.Glyph.ReactionArrow,glyphInitialParams:{reactionArrowType:Kekule.Glyph.ReactionArrowType.NORMAL,startArrowWidth:.25,startArrowLength:.25,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5,lineGap:.1}},null,null,t.glyphReactionArrowNormal),Kekule.Editor.ActionComposerSetRepositoryReversibleReactionArrowController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryReversibleReactionArrowController",Kekule.$L("ChemWidgetTexts.CAPTION_REACTION_ARROW_REVERSIBLE"),Kekule.$L("ChemWidgetTexts.HINT_REACTION_ARROW_REVERSIBLE"),"ArrowLineIaController","ArrowLineIaController-ReactionArrowReversible",{glyphClass:Kekule.Glyph.ReactionArrow,glyphInitialParams:{reactionType:Kekule.Glyph.ReactionArrowType.REVERSIBLE,startArrowWidth:.25,startArrowLength:.25,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5,lineGap:.1}},null,null,t.glyphReactionArrowReversible),Kekule.Editor.ActionComposerSetRepositoryResonanceReactionArrowController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryResonanceReactionArrowController",Kekule.$L("ChemWidgetTexts.CAPTION_REACTION_ARROW_RESONANCE"),Kekule.$L("ChemWidgetTexts.HINT_REACTION_ARROW_RESONANCE"),"ArrowLineIaController","ArrowLineIaController-ReactionArrowResonance",{glyphClass:Kekule.Glyph.ReactionArrow,glyphInitialParams:{reactionType:Kekule.Glyph.ReactionArrowType.RESONANCE,startArrowWidth:.25,startArrowLength:.25,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5,lineGap:.1}},null,null,t.glyphReactionArrowResonance),Kekule.Editor.ActionComposerSetRepositoryRetrosynthesisReactionArrowController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryRetrosynthesisReactionArrowController",Kekule.$L("ChemWidgetTexts.CAPTION_REACTION_ARROW_RETROSYNTHESIS"),Kekule.$L("ChemWidgetTexts.HINT_REACTION_ARROW_RETROSYNTHESIS"),"ArrowLineIaController","ArrowLineIaController-ReactionArrowRetrosynthesis",{glyphClass:Kekule.Glyph.ReactionArrow,glyphInitialParams:{reactionType:Kekule.Glyph.ReactionArrowType.RETROSYNTHESIS,startArrowWidth:.25,startArrowLength:.25,endArrowWidth:.25,endArrowLength:.25,lineLength:1.5,lineGap:.1}},null,null,t.glyphReactionArrowRetrosynthesis),Kekule.Editor.ActionComposerSetRepositoryDoubleElectronPushingArrowController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryDoubleElectronPushingArrowController",Kekule.$L("ChemWidgetTexts.CAPTION_ELECTRON_PUSHING_ARROW_2"),Kekule.$L("ChemWidgetTexts.HINT_ELECTRON_PUSHING_ARROW_2"),"ArrowLineIaController","ArrowLineIaController-ElectronPushingArrowDouble",{glyphClass:Kekule.Glyph.ElectronPushingArrow,glyphInitialParams:{electronCount:2,endArrowWidth:.25,endArrowLength:.25,lineLength:1,lineGap:.1,lineCount:1}},null,null,t.glyphElectronPushingArrowDouble),Kekule.Editor.ActionComposerSetRepositorySingleElectronPushingArrowController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositorySingleElectronPushingArrowController",Kekule.$L("ChemWidgetTexts.CAPTION_ELECTRON_PUSHING_ARROW_1"),Kekule.$L("ChemWidgetTexts.HINT_ELECTRON_PUSHING_ARROW_1"),"ArrowLineIaController","ArrowLineIaController-ElectronPushingArrowSingle",{glyphClass:Kekule.Glyph.ElectronPushingArrow,glyphInitialParams:{electronCount:1,endArrowWidth:.25,endArrowLength:.25,lineLength:1,lineGap:.1,lineCount:1}},null,null,t.glyphElectronPushingArrowSingle),Kekule.Editor.ActionComposerSetRepositoryBondFormingElectronPushingArrowController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryBondFormingElectronPushingArrowController",Kekule.$L("ChemWidgetTexts.CAPTION_BOND_FORMING_ELECTRON_PUSHING_ARROW_1"),Kekule.$L("ChemWidgetTexts.HINT_BOND_FORMING_ELECTRON_PUSHING_ARROW_1"),"ArrowLineIaController","ArrowLineIaController-BondFormingElectronPushingArrowSingle",{glyphClass:Kekule.Glyph.BondFormingElectronPushingArrow,glyphInitialParams:{endArrowWidth:.25,endArrowLength:.25,lineLength:1,pathEndGap:.1,lineCount:1}},null,null,t.glyphElectronPushingArrowBondForming),Kekule.Editor.ActionComposerSetRepositoryGlyphController=Kekule.Editor.createComposerIaControllerActionClass("Kekule.Editor.ActionComposerSetRepositoryGlyphController",Kekule.$L("ChemWidgetTexts.CAPTION_REPOSITORY_ARROWLINE"),Kekule.$L("ChemWidgetTexts.HINT_REPOSITORY_ARROWLINE"),"ArrowLineIaController",null,null,[Kekule.Editor.ActionComposerSetRepositoryNormalReactionArrowController,Kekule.Editor.ActionComposerSetRepositoryReversibleReactionArrowController,Kekule.Editor.ActionComposerSetRepositoryResonanceReactionArrowController,Kekule.Editor.ActionComposerSetRepositoryRetrosynthesisReactionArrowController,Kekule.Editor.ActionComposerSetRepositoryLineSegmentController,Kekule.Editor.ActionComposerSetRepositoryDoubleElectronPushingArrowController,Kekule.Editor.ActionComposerSetRepositorySingleElectronPushingArrowController,Kekule.Editor.ActionComposerSetRepositoryBondFormingElectronPushingArrowController,Kekule.Editor.ActionComposerSetRepositoryHeatSymbolController,Kekule.Editor.ActionComposerSetRepositoryAddSymbolController],null,t.glyph),Kekule._registerAfterLoadSysProc(function(){var e=Kekule.ActionManager,o=Kekule.ChemWidget,n=Kekule.Editor,a=Kekule.Editor.ChemSpaceEditor,l=e.registerNamedActionClass;l(t.newDoc,n.ActionEditorNewDoc,a),l(t.loadFile,o.ActionDisplayerLoadFile,a),l(t.loadData,n.ActionEditorLoadData,a),l(t.saveData,o.ActionDisplayerSaveFile,a),l(t.zoomIn,o.ActionDisplayerZoomIn,a),l(t.zoomOut,o.ActionDisplayerZoomOut,a),l(t.resetZoom,o.ActionDisplayerResetZoom,a),l(t.reset,o.ActionDisplayerReset,a),l(t.config,Kekule.Widget.ActionOpenConfigWidget,a),l(t.undo,n.ActionEditorUndo,a),l(t.redo,n.ActionEditorRedo,a),l(t.selectAll,n.ActionSelectAll,a),l(t.cloneSelection,n.ActionCloneSelection,a),l(t.copy,n.ActionCopySelection,a),l(t.cut,n.ActionCutSelection,a),l(t.paste,n.ActionPaste,a),l(t.toggleSelect,n.ActionToggleSelectState,a),l(t.recheckIssues,n.ActionRecheckIssues,a),l(t.toggleShowAllIssues,n.ActionToggleShowIssueMarkers,a),l(t.objInspector,n.ActionComposerToggleObjInspector,a),l(t.issueInspector,n.ActionComposerToggleIssueInspector,a),i();for(var s=0,d=r.length;s<d;++s){var u=r[s];l(u.name,u.actionClass,u.widgetClass||a)}})}(),function(){"use strict";var e=Kekule.ArrayUtils,t=Kekule.CoordUtils;Kekule.Editor.PointerTrackConstraint={NONE:0,LEADING:1,BOTH:2,CIRCLE:5},Kekule.Editor.TrackParser=Class.create(ObjectEx,{CLASS_NAME:"Kekule.Editor.TrackParser",simplifyCurveToLineSegments:function(e,t){return Kekule.GeometryUtils.simplifyCurveToLineSegments(e,t)},addLineCrossPoints:function(e){for(var t=[],o=e.length,r=0;r<o-1;++r)for(var i={coord1:e[r],coord2:e[r+1]},n=r+2;n<o-1;++n){var a={coord1:e[n],coord2:e[n+1]},l=Kekule.GeometryUtils.getCrossPointOfLines(i.coord1,i.coord2,a.coord1,a.coord2);l&&(this._addInsertedPoint(r,l,t),this._addInsertedPoint(n,l,t))}for(r=0;r<o-1;++r)t[r]&&this._sortInsertedPointsInLine(t[r],e[r],e[r+1]);var s=[];for(r=0;r<o-1;++r)if(s.push(e[r]),t[r]){n=0;for(var d=t[r].length;n<d;++n)s.push(t[r][n])}return s.push(e[o-1]),s},addVertexToLineMergePoint:function(e,t){if(t<=0)return e;for(var o=e.length,r=[],i=0;i<o-1;++i)for(var n=e[i],a=0;a<o-1;++a)if(a<i-1||a>i+1){var l=Kekule.GeometryUtils.getPerpendicularCrossPointFromCoordToLine(n,e[a],e[a+1],!1);if(l)Kekule.CoordUtils.getDistance(n,l)<=t&&(n.x=l.x,n.y=l.y,this._addInsertedPoint(a,n,r))}var s=[];for(i=0;i<o-1;++i)if(s.push(e[i]),r[i]){this._sortInsertedPointsInLine(r[i],e[i],e[i+1]);a=0;for(var d=r[i].length;a<d;++a)s.push(r[i][a])}return s.push(e[o-1]),s},_addInsertedPoint:function(e,t,o){o[e]||(o[e]=[]),o[e].push(t)},_sortInsertedPointsInLine:function(e,t,o){if(e){var r=o.x-t.x,i=o.y-t.y;e.sort(function(e,t){return Math.abs(i)>Math.abs(r)?-(t.y-e.y)*i:-(t.x-e.x)*r})}},mergeNearbyTrackPoints:function(e,o){if(o<=0)return e;for(var r=e.length,i=e.concat([]),n=0;n<r;++n){var a=i[n];if(!a.__$merge_handled__)for(var l=n+1;l<r;++l){var s=i[l];if(!s.__$merge_handled__){var d=a.__$merge_weight__||1,u=s.__$merge_weight__||1;if(Kekule.CoordUtils.getDistance(a,s)<=o){var c,p=d+u;a.__$merge_weight__=p,a.boundObj?c=a:s.boundObj?(c=s,a.boundObj=s.boundObj):(c=1===d?a:t.multiply(a,d),c=t.add(c,1===u?s:t.multiply(s,u)),c=t.divide(c,p)),a.x=c.x,a.y=c.y,i.splice(l,1,a)}}}a.__$merge_handled__=!0}return i},mergeCloseVertexes:function(e,t){return(t=t||this.getVertexMergeRadius())<=0?e:this._doMergeCloseVertexes(e,t)},_doMergeCloseVertexes:function(e,t){for(var o=e.getVertexes(),r=o.length,i=!1,n=0;n<r;++n){for(var a=o[n],l=o[n].getData("coord"),s=n+1;s<r;++s){var d=o[s],u=d.getData("coord");if(Kekule.CoordUtils.getDistance(l,u)<=t){this._doMergeVertex(e,a,d),i=!0;break}}if(i)break}return i?this._doMergeCloseVertexes(e,t):e},_doMergeVertex:function(o,r,i){for(var n=r.getData("coord"),a=r.getData("weight")||1,l=i.getData("coord"),s=i.getData("weight")||1,d=e.clone(i.getEdges()),u=0,c=d.length;u<c;++u){d[u].replaceVertex(i,r)}o.removeVertex(i);var p=1===a?n:t.multiply(n,a);p+=1===s?l:t.multiply(l,s),p=t.divide(p,a+s),r.setData("coord",p)},removeRepetitivePoints:function(e){for(var t=[],o=null,r=0,i=e.length;r<i;++r)e[r]!==o&&(t.push(e[r]),o=e[r]);return t},refineTrack:function(e,t,o){var r=this.simplifyCurveToLineSegments(e,t);return r=this.addLineCrossPoints(r),r=this.addVertexToLineMergePoint(r,o),r=this.mergeNearbyTrackPoints(r,o),r=this.removeRepetitivePoints(r)},convertTrackToStructure:function(e,t,o,r){if(!t||!t.length)return null;var i=t.length;if(i<2)return null;for(var n,a=r||new Kekule.StructureFragment,l=0;l<i;++l){var s=t[l],d=s.__$structure_node__;if(d||((d=new Kekule.Atom).setIsotopeId(o),e.setObjectScreenCoord(d,s),s.__$structure_node__=d,a.appendNode(d)),n&&n!==d&&!d.getConnectorTo(n)){var u=new Kekule.Bond(null,[n,d]);u.setBondOrder(1),a.appendConnector(u)}n=d}return a},convertLinesToGraph:function(e){if(e&&e.length){for(var t,o=new Kekule.Graph,r=e.length,i=0;i<r;++i){var n,a=e[i];if((n=a.__$graph_vertex__)||((n=new Kekule.GraphVertex).setData("coord",a),a.__$graph_vertex__=n,o.addVertex(n)),t&&!n.getEdgeTo(t)){var l=new Kekule.GraphEdge;o.addEdge(l,t,n)}t=n}return o}return null}}),Kekule.Editor.TrackLayoutOptimizer=Class.create(ObjectEx,{CLASS_NAME:"Kekule.Editor.TrackLayoutOptimizer",OPTIMIZED_COORD_FIELD:"__$optimizedCoord__",COORD_INDEX_FIELD:"__$coordIndex__",RING_END_INDEX_FIELD:"__$ringEndIndex__",initialize:function(){this.tryApplySuper("initialize")},initProperties:function(){},initPropValues:function(){this.tryApplySuper("initPropValues")},splitTrackByRings:function(e){for(var t=[],o=function(e,o){for(var r=0,i=t.length;r<i;++r){var n=t[r];if(!(n.startIndex>o||n.endIndex<e))return!1}return!0},r=0,i=e.length;r<i;++r){var n=e[r];if(void 0===n[this.COORD_INDEX_FIELD])n[this.COORD_INDEX_FIELD]=r;else{var a=n[this.COORD_INDEX_FIELD],l=r;n[this.RING_END_INDEX_FIELD]=l,o(a,l)&&t.push({startIndex:a,endIndex:l})}}var s=[],d=t.length;if(d>0){var u=0;for(r=0;r<d;++r){var c=t[r];c.startIndex>u&&s.push({track:e.slice(u,c.startIndex+1),isRing:!1}),s.push({track:e.slice(c.startIndex,c.endIndex+1),isRing:!0}),u=c.endIndex}return u<e.length-1&&s.push({track:e.slice(u,e.length),isRing:!1}),s}return[{track:e,isRing:!1}]},optimize:function(t,o){var r,i=t,n=Kekule.Editor.PointerTrackConstraint,a=t[0],l=a.boundObj,s=t[t.length-1],d=s.boundObj;l&&d?r=l===d?n.CIRCLE:n.BOTH:l||d?(r=n.LEADING,d&&(i=e.reverse(t))):r=a===s?n.CIRCLE:n.LEADING;var u=Object.extend({},o);return u.preferredStartingAngles=o.preferredStartingAngles||[0],u.segmentsInfo=this._calcTrackSegmentsInfo(i),u.distanceMedian=e.getMedian(u.segmentsInfo.distances),r===n.CIRCLE?this.doOptimizeOnCircleConstraint(i,u):r===n.BOTH?this.doOptimizeOnBothConstraint(i,u):this.doOptimizeOnLeadingConstraint(i,u)},_calcTrackSegmentsInfo:function(e){for(var o=[],r=[],i=0,n=e.length;i<n-1;++i){var a=e[i],l=e[i+1],s=t.getDistance(a,l),d=t.substract(l,a),u=Math.atan2(d.y,d.x);o.push(s),r.push(u)}return{distances:o,angles:r}},doOptimizeOnLeadingConstraint:function(e,o,r){var i=Kekule.GeometryUtils,n=[];if(r){Kekule.Editor.PointerTrackConstraint;var a,l=this.splitTrackByRings(e);if(1===l.length)return l[s].isRing?this.doOptimizeOnCircleConstraint(u,o,!0):this.doOptimizeOnLeadingConstraint(u,o,!0);for(var s=0,d=l.length;s<d;++s){var u=l[s].track,c=l[s].isRing?this.doOptimizeOnCircleConstraint(u,o,!0):this.doOptimizeOnLeadingConstraint(u,o,!0);if(a){for(var p=c[0],h=t.substract(a,p),g=0,C=c.length;g<C;++g)c[g]=t.add(c[g],h);a=c[c.length-1],c.shift(),n=n.concat(c)}else a=c[c.length-1],n=n.concat(c)}return n}var _,f=o.preferredStartingAngles;n.push(e[0]);for(o.preferredIncludeAngle,o.preferredIncludeAngle,s=1,d=e.length;s<d;++s)if(e[s][this.OPTIMIZED_COORD_FIELD])n.push(e[s][this.OPTIMIZED_COORD_FIELD]);else{var y,m=e[s-1],O=n[s-1],E=e[s],T=(h=t.substract(E,m),t.getDistance(m,E)),S=this._optimizeLineSegmentDistance(T,o),A=Math.atan2(h.y,h.x);_=y=this._optimizeDirectionAngle(A,f,o,_);var k=Math.PI-o.preferredIncludeAngle,b=(f=[i.standardizeAngle(y-k),i.standardizeAngle(y+k)],{x:S*Math.cos(y),y:S*Math.sin(y)}),I=t.add(O,b);n.push(I),e[s][this.OPTIMIZED_COORD_FIELD]=I}return n},doOptimizeOnBothConstraint:function(e,o,r){var i=e.length,n=this.doOptimizeOnLeadingConstraint(e,o,r),a=n[i-1],l=e[i-1],s=e[0],d=t.substract(l,s),u=Math.atan2(d.y,d.x),c=t.substract(a,s),p=Math.atan2(c.y,c.x),h=t.getDistance(d)/t.getDistance(c);if(h<=2){var g=t.calcTransform2DMatrix({rotateAngle:-p,center:s}),C=t.calcTransform2DMatrix({scale:h,center:s}),_=t.calcTransform2DMatrix({rotateAngle:u,center:s}),f=Kekule.MatrixUtils.multiply(g,C);f=Kekule.MatrixUtils.multiply(f,_);for(var y=[n[0]],m=1;m<i-1;++m)y.push(t.transform2DByMatrix(n[m],f));y.push(e[i-1])}else{var O=t.divide(t.substract(l,a),i-1),E=(y=[n[0]],{x:0,y:0});for(m=0;m<i-1;++m)E=t.add(E,O),y.push(t.add(n[m],E));y.push(e[i-1])}return y},doOptimizeOnCircleConstraint:function(e,o,r){var i=e.length-1,n=Object.create(o);if(i<=8){var a=(1-2/i)*Math.PI;(n=Object.create(o)).preferredIncludeAngle=a}for(var l=e.length,s=this.doOptimizeOnLeadingConstraint(e,n,r),d=s[l-1],u=e[l-1],c=t.divide(t.substract(u,d),l-1),p=[s[0]],h={x:0,y:0},g=1;g<l-1;++g)h=t.add(h,c),p.push(t.add(s[g],h));return p.push(e[l-1]),p},_optimizeIncludeAngle:function(e,t,o){return this._optimizeDirectionAngle(e,t,o)},_optimizeDirectionAngle:function(e,t,o,r){var i=Kekule.GeometryUtils,n=null,a=null;if(t&&t.length){for(var l=null,s=0,d=t.length;s<d;++s){var u=Math.abs(i.standardizeAngle(e)-t[s]);(null===l||u<l)&&(a=t[s],l=u)}l<=Math.PI/6&&(n=a)}if(null===n){var c=o.angleConstraint;if(!c)return e;null===a&&(a=0);u=e-a;if(n=a+Math.round(u/c)*c,r){var p=5*Math.PI/180,h=Math.abs(i.standardizeAngle(n-r,-Math.PI));if(Kekule.NumUtils.isFloatEqual(h,0,p)||Kekule.NumUtils.isFloatEqual(h,Math.PI,p)){var g=n+c,C=n-c;n=Math.abs(e-g)<Math.abs(e-C)?g:C}}}return n},_optimizeLineSegmentDistance:function(e,t){var o=t.defBondScreenLength,r=t.distanceConstraints||[];if(!r)return e;if(e>r[r.length-1]*o)return Math.round(e/o)*o;var i,n=t.primaryDistanceConstraint,a=r.length,l=r.indexOf(n);l<0&&(l=0);for(var s=a-1;s>=l;--s){var d=r[s];if(e>(i=d*o))return i}for(s=0;s<=l;++s)if(e<(i=d*o))return i;return i}}),Kekule.Editor.TrackInputIaController=Class.create(Kekule.Editor.StructureInsertIaController,{CLASS_NAME:"Kekule.Editor.TrackInputIaController",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setEnableSelect(!1),this._isTracking=!1,this._trackCoordToObjBindings=null,this._trackParser=new Kekule.Editor.TrackParser,this._trackLayoutOptimizer=new Kekule.Editor.TrackLayoutOptimizer,this._addStructureOperation=null,this._editorScaled=!1,this._editorOriginalZoomLevel=1,this._lastRenderedMarkerCoord=null,this._debugMarkers={}},doFinalize:function(){this._trackLayoutOptimizer.finalize(),this._trackParser.finalize();var e=this.getPropStoreFieldValue("trackMarker");e&&e.finalize(),this.tryApplySuper("doFinalize")},initProperties:function(){this.defineProp("trackMarker",{dataType:DataType.OBJECT,serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("trackMarker");return e||(e=new Kekule.ChemWidget.MetaShapeUIMarker({shapeType:Kekule.Render.MetaShapeType.POLYLINE,coords:[]}),this.setPropStoreFieldValue("trackMarker",e)),e}})},initPropValues:function(){this.tryApplySuper("initPropValues")},getEditorUiMarkers:function(){return this.getEditor().getUiMarkers()},refineTrackCoords:function(e){var o=this.getEditor(),r=this.getEditorConfigs(),i={angleConstraint:r.getInteractionConfigs().getTrackOptimizationAngleConstraint(),distanceConstraints:r.getInteractionConfigs().getTrackOptimizationDistanceConstraints(),primaryDistanceConstraint:r.getInteractionConfigs().getTrackOptimizationPrimaryDistanceConstraint(),preferredIncludeAngle:2*Math.PI/3},n=o.getDefBondLength?o.getDefBondLength():r.getStructureConfigs().getDefBondLength(),a=o.objCoordToScreen({x:0,y:0}),l=o.objCoordToScreen({x:n,y:0}),s=t.getDistance(a,l);i.defBondScreenLength=s;for(var d=this.getEditorConfigs().getInteractionConfigs().getTrackSimplifierDistanceThreshold(),u=this.getEditorConfigs().getInteractionConfigs().getTrackMergeDistanceThreshold(),c=this._mergeCoordsToBoundNodesAndSplitTrack(e),p=[],h=0,g=c.length;h<g;++h){var C=c[h],_=(C=this._trackParser.refineTrack(C,d,u))[0].obj||C[C.length-1].obj,f=_?r.getStructureConfigs.getNewBondDefAngle(_,1):-Math.PI/6;i.preferredStartingAngles=[f],C=this._trackLayoutOptimizer.optimize(C,i),p.push(C)}return p},_mergeCoordsToBoundNodesAndSplitTrack:function(e){var t=this._trackCoordToObjBindings,o=t.length;if(o){for(var r=this.getEditor(),i=[],n=t[0].obj,a=t[0].coordIndex,l=0,s=1;s<=o;++s){var d=t[s];if(s<o&&d&&(n!==d.obj||d.coordIndex-a>10)||s===o){a>l&&i.push(e.slice(l,a));var u=r.getObjectScreenCoord(n);u.boundObj=n,l=t[s-1].coordIndex+1,i.push([u]),s!==o&&(n=d.obj,a=d.coordIndex)}}e.length-1>t[o-1].coordIndex&&i.push(e.slice(t[o-1].coordIndex));for(var c=[],p=[],h=(s=0,i.length);s<h;++s){var g=i[s];c=c.concat(g),s===h-1?p.push(c):g[0].boundObj&&s>0&&(p.push(c),c=g)}return p}return[e]},convertTracksToStructure:function(e,t){var o=new Kekule.Molecule;o.setCoord2D({x:0,y:0});for(var r=this.getEditor(),i=0,n=e.length;i<n;++i)this._trackParser.convertTrackToStructure(r,e[i],t,o);return o.getNodeCount()<2?null:o},getStructureSelectableChildren:function(e){return[].concat(e.getNodes()).concat(e.getConnectors())},addStructureToEditor:function(e){var t=this.getEditor();this._addStructureOperation=null,t.beginUpdateObject();try{var o,r=t.getChemSpace();this._targetMol?(o=new Kekule.ChemStructOperation.MergeStructFragment(e,this._targetMol,t),this._targetMol=null):o=new Kekule.ChemObjOperation.Add(e,r,null,t),o.execute(),this._addStructureOperation=o}finally{t.endUpdateObject()}},getTrackCoords:function(){return this.getTrackMarker().getShapeInfo().coords},clearTrackCoords:function(){this.getTrackMarker().getShapeInfo().coords=[]},startTracking:function(e,t){this._targetMol=null;var o=this.getEditor(),r=this._getMergeDestObjAtCoord(t);if(!o.canCreateNewChild()&&!r){if(!o.canAddUnconnectedStructFragment())return null;var i=o.getOnlyOneBlankStructFragment();this._targetMol=i}this._isTracking=!0,this._trackCoordToObjBindings=[],this.setManuallyHotTrack(!0),this.clearTrackCoords();var n=this.getTrackMarker();this.getEditorUiMarkers().addMarker(n);var a=this.getEditorConfigs().getUiMarkerConfigs(),l={strokeColor:a.getTrackMarkerStrokeColor(),strokeWidth:a.getTrackMarkerStrokeWidth(),strokeDash:a.getTrackMarkerStrokeDash(),opacity:a.getTrackMarkerOpacity()};if(n.setDrawStyles(l),n.setVisible(!0),this.addTrackCoord(t,!1),this.getEditorConfigs().getInteractionConfigs().getAutoAdjustZoomLevelOnTrackTouching()){o=this.getEditor();var s=this.getEditorConfigs().getInteractionConfigs().getTrackTouchRefLength();if(s){var d=o.getDocument(),u=o.getDefBondScreenLength(),c=Kekule.DocumentUtils.getDevicePPI(d)*s/Kekule.DocumentUtils.getClientScaleLevel(d)/u;if(c>.9){var p=o.getCurrZoom();o.setZoomCenter(t),o.zoomTo(p*c);var h=this._getEventMouseCoord(e),g=this.getTrackCoords(),C=g[g.length-1];t=h,Object.extend(C,h),this._editorScaled=!0,this._editorOriginalZoomLevel=p,this._autoScaleStartCoord=h}else this._editorScaled=!1,this._editorOriginalZoomLevel=null}}this.repaintMarker(),this._lastRenderedMarkerCoord=t},endTracking:function(e){var t=this.getEditorConfigs().getStructureConfigs().getDefIsotopeId()||"C";this._isTracking=!1,this.addTrackCoord(e);var o=this.refineTrackCoords(this.getTrackCoords());if(o.length){var r=this.convertTracksToStructure(o,t);if(r){this.addStructureToEditor(r),this.startDirectManipulate(null,r,e),this.moveManipulatedObjs(e),this.stopManipulate();var i=this.getStructureSelectableChildren(r);this.doneInsertOrModifyBasicObjects(i)}}this.doneTracking()},cancelTracking:function(){this._isTracking=!1,this.getEditorUiMarkers().removeMarker(this.getTrackMarker()),this.doneTracking()},doneTracking:function(){if(this._editorScaled){var e=this.getTrackCoords();e[e.length-1];this._editorScaled=!1,this.getEditor().zoomTo(this._editorOriginalZoomLevel,null,this._autoScaleStartCoord),this._editorOriginalZoomLevel=null,this._autoScaleStartCoord=null}this.setManuallyHotTrack(!1),this.getEditor().hideHotTrack(),this.clearTrackCoords(),this.repaintMarker()},_getMergeDestObjAtCoord:function(e){for(var t=this.getEditor().getBasicObjectsAtCoord(e,this.getCurrBoundInflation()),o=0,r=t.length;o<r;++o){var i=t[o];if(this.isValidMergeDestObj(i))return i}return null},addTrackCoord:function(e,t){var o=this.getTrackCoords(),r=o&&o[o.length-1];if(!r||!Kekule.CoordUtils.isEqual(e,r)){var i=this._getMergeDestObjAtCoord(e);if(i&&(this._trackCoordToObjBindings.push({coord:e,obj:i,coordIndex:this.getTrackCoords().length}),this.getEditor().addHotTrackedObj(i)),o.push(e),!t)this._lastRenderedMarkerCoord?Kekule.CoordUtils.getDistance(this._lastRenderedMarkerCoord,e)>5&&(this.repaintMarker(),this._lastRenderedMarkerCoord=e):(this.repaintMarker(),this._lastRenderedMarkerCoord=e)}},repaintMarker:function(){this.getEditor().repaintUiMarker()},isValidMergeDestObj:function(e){return e instanceof Kekule.ChemStructureNode},canInteractWithObj:function(e){return e instanceof Kekule.ChemStructureNode},getAllObjOperations:function(e){var t=this.tryApplySuper("getAllObjOperations",[e])||[],o=this._addStructureOperation;return o&&t.unshift(o),t},react_pointerdown:function(e){if(this.setActivePointerType(e.pointerType),e.getButton()===Kekule.X.Event.MouseButton.LEFT){var t=this._getEventMouseCoord(e);return this.startTracking(e,t),e.preventDefault(),!0}if(e.getButton()===Kekule.X.Event.MouseButton.RIGHT)return this.cancelTracking(),e.preventDefault(),!0},react_pointerup:function(e){if(e.getButton()===Kekule.X.Event.MouseButton.LEFT){if(this._isTracking){var t=this._getEventMouseCoord(e);this.endTracking(t),this.addOperationToEditor()}return this.setState(Kekule.Editor.BasicManipulationIaController.State.NORMAL),e.preventDefault(),!0}},react_pointermove:function(e){if(this.tryApplySuper("react_pointermove",[e]),this._isTracking){var t=this._getEventMouseCoord(e);return this.addTrackCoord(t),e.preventDefault(),!0}}}),Kekule.Editor.IaControllerManager.register(Kekule.Editor.TrackInputIaController,Kekule.Editor.ChemSpaceEditor)}(),function(){"use strict";var e=Kekule.ArrayUtils;Kekule.Editor,Kekule.Widget.HtmlClassNames,Kekule.ChemWidget.HtmlClassNames,Kekule.ChemWidget.ComponentWidgetNames;Kekule.Editor.ObjModifier={},Kekule.Editor.ObjModifier.Category={GENERAL:"general",CHEM_STRUCTURE:"chemStruct",GLYPH:"glyph",STYLE:"style",MISC:"misc"},Kekule.Editor.ObjModifier.Base=Class.create(ObjectEx,{CLASS_NAME:"Kekule.Editor.ObjModifier.Base",initialize:function(e){this.tryApplySuper("initialize"),this.setEditor(e),this.modifierWidgetValueChangedBind=this.modifierWidgetValueChanged.bind(this)},initProperties:function(){this.defineProp("editor",{dataType:"Kekule.Editor.BaseEditor",serializable:!1}),this.defineProp("targetObjs",{dataType:DataType.ARRAY,serializable:!1,getter:function(){return this.getEditor().getSelection()}}),this.defineProp("widget",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("widget");return e||(e=this.createWidget(),this.setPropStoreFieldValue("widget",e)),e}})},getEditorConfigs:function(){return this.getEditor().getEditorConfigs()},getModifierName:function(){return this.getClassLocalName().toLowerCase()},createWidget:function(){var e=this.doCreateWidget();return e&&this.installValueChangeEventHandler(e),e},doCreateWidget:function(){return null},installValueChangeEventHandler:function(e){e.on("valueChange",this.modifierWidgetValueChangedBind)},modifierWidgetValueChanged:function(){this.applyToTargets()},loadFromTargets:function(){var e=this.getEditor();if(e){var t=this.getTargetObjs();t&&this.doLoadFromTargets(e,t)}return this},doLoadFromTargets:function(e,t){},applyToTargets:function(){var e=this.getEditor();if(e){var t=this.getTargetObjs();t&&this.doApplyToTargets(e,t)}return this},doApplyToTargets:function(e,t){var o=this.createModificationOper();o&&e.execOperation(o)},createModificationOper:function(e){var t=[];if(e&&e.length)for(var o=0,r=e.length;o<r;++o){var i=this.createModificationOperOnTarget(e[o]);i&&t.push(i)}var n=t.length;return n<=0?null:1===n?t[0]:new Kekule.MacroOperation(t)},createModificationOperOnTarget:function(e){var t=this.getModifiedPropValues();return t?this.createModificationOperation(e,t):null},getModifiedPropValues:function(){return null},createModificationOperation:function(e,t){return new Kekule.ChemObjOperation.Modify(e,t,this.getEditor())}}),Kekule.Editor.ObjModifierManager={_modifierMap:new Kekule.MapEx(!0),register:function(o,r){if(r&&o)for(var i=e.toArray(r),n=e.toArray(o),a=0,l=n.length;a<l;++a){var s=n[a],d=t._modifierMap.get(s);d?e.pushUnique(d,i):(d=i,t._modifierMap.set(s,d))}},unregister:function(o){if(o)for(var r=e.toArray(o),i=t._modifierMap.getKeys(),n=0,a=i.length;n<a;++n){var l=t._modifierMap.get(i[n]);l&&l.length&&t._modifierMap.set(i[n],e.exclude(l,r))}},getModifierCategories:function(o){var r=o.getCategories&&o.getCategories()||[],i=ClassEx.getSuperClass(o);return i&&e.pushUnique(r,t.getModifierCategories(i)),r},getModifierClasses:function(o,r){var i=t._modifierMap.get(o)||[],n=ClassEx.getSuperClass(o);if(n&&e.pushUnique(i,t.getModifierClasses(n,r)),r&&r.length){var a=i;i=[];for(var l=0,s=a.length;l<s;++l){var d=t.getModifierCategories(a[l]);e.intersect(d,r).length&&i.push(a[l])}}return i}};var t=Kekule.Editor.ObjModifierManager}(),function(){"use strict";Kekule.ArrayUtils,Kekule.Editor;var e=Kekule.Widget.HtmlClassNames,t=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.ComponentWidgetNames;Kekule.Editor.ObjModifier.BaseRenderOptionModifier=Class.create(Kekule.Editor.ObjModifier.Base,{CLASS_NAME:"Kekule.Editor.ObjModifier.BaseRenderOptionModifier",getRenderOptionValue:function(e,t,o){return Kekule.Render.RenderOptionUtils.getCascadeRenderOptionValueOfObjs(e,t,o)}}),Kekule.Editor.ObjModifier.BaseRenderOptionModifier.getCategories=function(){return[Kekule.Editor.ObjModifier.Category.STYLE]},Kekule.Editor.ObjModifier.Color=Class.create(Kekule.Editor.ObjModifier.BaseRenderOptionModifier,{CLASS_NAME:"Kekule.Editor.ObjModifier.Color",ATOM_COLOR_SPECIAL_VALUE_INFO:{text:Kekule.$L("ChemWidgetTexts.HINT_USE_ATOM_CUSTOM_COLOR"),value:"Atom",className:e.COLORPICKER_SPEC_COLOR_MIXED},initProperties:function(){this.defineProp("colorBox",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null})},doCreateWidget:function(){var e=new Kekule.Widget.ColorDropButton(this.getEditor());return e.setHint(Kekule.$L("ChemWidgetTexts.HINT_PICK_COLOR")),e.setShowText(!1),e.setSpecialColors([Kekule.Widget.ColorPicker.SpecialColors.UNSET,this.ATOM_COLOR_SPECIAL_VALUE_INFO]),e.addClassName(t.COMPOSER_COLOR_BOX),this.setPropStoreFieldValue("colorBox",e),e},doLoadFromTargets:function(e,t){if(t&&t.length){var o=this.getColorBox();if(o){var r=this.getRenderOptionValue(t,"useAtomSpecifiedColor"),i=this.getRenderOptionValue(t,"color");r?(i=this.ATOM_COLOR_SPECIAL_VALUE_INFO.value,o.setColorClassName(this.ATOM_COLOR_SPECIAL_VALUE_INFO.className),o.setValue(i)):(o.setColorClassName(null),o.setValue(i))}}},doApplyToTargets:function(e,t){var o=this.getWidget().getValue();o===this.ATOM_COLOR_SPECIAL_VALUE_INFO.value?e.modifyObjectsRenderOptions(t,{useAtomSpecifiedColor:!0,color:void 0},!1,!0):(o==Kekule.Widget.ColorPicker.SpecialColors.UNSET&&(o=void 0),e.modifyObjectsRenderOptions(t,{useAtomSpecifiedColor:!1,color:o},!1,!0))}}),Kekule.Editor.ObjModifierManager.register(Kekule.ChemObject,[Kekule.Editor.ObjModifier.Color])}(),function(){"use strict";var e=Kekule.DomUtils,t=(Kekule.HtmlElementUtils,Kekule.Widget.HtmlClassNames,Kekule.ChemWidget.HtmlClassNames),o=Kekule.ChemWidget.ComponentWidgetNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{COMPOSER_TEXTFORMAT_BUTTON:"K-Chem-Composer-TextFormat-Button",COMPOSER_MODIFIER_RICHTEXT_PANEL:"K-Chem-Composer-Modifier-RichText-Panel",COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUP:"K-Chem-Composer-Modifier-RichText-Panel-Group",COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUP_LABELCELL:"K-Chem-Composer-Modifier-RichText-Panel-Group-LabelCell",COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUP_CTRLCELL:"K-Chem-Composer-Modifier-RichText-Panel-Group-CtrlCell",COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUP_LABEL:"K-Chem-Composer-Modifier-RichText-Panel-Group-Label",COMPOSER_TEXTDIRECTION_BOX:"K-Chem-Composer-TextDirection-Box",COMPOSER_TEXTALIGN_BOX:"K-Chem-Composer-TextAlign-Box"}),Kekule.globalOptions.add("chemWidget.composer.objModifier.richText",{componentNames:[o.fontName,o.fontSize,o.textDirection,o.textAlign,o.nodeDisplayMode]}),Kekule.Editor.ObjModifier.RichText=Class.create(Kekule.Editor.ObjModifier.BaseRenderOptionModifier,{CLASS_NAME:"Kekule.Editor.ObjModifier.RichText",initialize:function(e){this.tryApplySuper("initialize",[e]),this._valueStorage={},this._nodeLabelDisplayModeGroup=null},initProperties:function(){this.defineProp("fontPanel",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null}),this.defineProp("fontNameBox",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null}),this.defineProp("fontSizeBox",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null}),this.defineProp("textDirectionBox",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null}),this.defineProp("textHorizontalAlignBox",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null}),this.defineProp("textVerticalAlignBox",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null}),this.defineProp("nodeLabelDisplayModeBox",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null})},_createCtrlGroup:function(o,r,i,n){var a=o.createElement("tr");a.className=t.COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUP,(l=o.createElement("td")).className=t.COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUP_LABELCELL;var l,s=o.createElement("label");return s.className=t.COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUPLABEL,e.setElementText(s,i),l.appendChild(s),a.appendChild(l),(l=o.createElement("td")).className=t.COMPOSER_MODIFIER_RICHTEXT_PANEL_GROUP_CTRLCELL,n.appendToElem(l),a.appendChild(l),r.appendChild(a),a},_doCreateDropDownPanel:function(){var e=new Kekule.Widget.Panel(this.getEditor());e.addClassName(t.COMPOSER_MODIFIER_RICHTEXT_PANEL).setCaption(Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_FORMAT"));var r,i=Kekule.globalOptions.chemWidget.composer.objModifier.richText.componentNames,n=this.getEditor().getDocument(),a=n.createElement("table");if(e.getContainerElement().appendChild(a),i.indexOf(o.fontName)>=0){var l=new Kekule.Widget.ComboBox(e);this.fillFontNameBox(l),l.addClassName(t.COMPOSER_FONTNAME_BOX),l.setHint(Kekule.$L("ChemWidgetTexts.HINT_FONTNAME")),l.addEventListener("valueChange",function(e){this.getEditor().modifyObjectsRenderOptions(this.getTargetObjs(),{fontFamily:this.getFontNameBox().getValue()},!1,!0)},this),this.setPropStoreFieldValue("fontNameBox",l),this._createCtrlGroup(n,a,Kekule.$L("ChemWidgetTexts.CAPTION_FONTNAME"),l)}if(i.indexOf(o.fontSize)>=0&&(l=new Kekule.Widget.ComboBox(e),this.fillFontSizeBox(l),l.addClassName(t.COMPOSER_FONTSIZE_BOX),l.setHint(Kekule.$L("ChemWidgetTexts.HINT_FONTSIZE")),l.addEventListener("valueChange",function(e){this.getEditor().modifyObjectsRenderOptions(this.getTargetObjs(),{fontSize:this.getFontSizeBox().getValue()},!1,!0)},this),this.setPropStoreFieldValue("fontSizeBox",l),this._createCtrlGroup(n,a,Kekule.$L("ChemWidgetTexts.CAPTION_FONTSIZE"),l)),i.indexOf(o.textDirection)>=0){r=new Kekule.Widget.SelectBox(e);var s=Kekule.Render.TextDirection,d=[{value:s.DEFAULT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_DEFAULT")},{value:s.LTR,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_LTR")},{value:s.RTL,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_RTL")},{value:s.TTB,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_TTB")},{value:s.BTT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_BTT")}];r.setItems(d),l.addClassName(t.COMPOSER_TEXTDIRECTION_BOX),r.setHint(Kekule.$L("ChemWidgetTexts.HINT_TEXT_DIRECTION")),r.addEventListener("valueChange",function(e){this.getEditor().modifyObjectsRenderOptions(this.getTargetObjs(),{charDirection:this.getTextDirectionBox().getValue()},!1,!0)},this),this.setPropStoreFieldValue("textDirectionBox",r),this._createCtrlGroup(n,a,Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION"),r)}if(i.indexOf(o.textAlign)>=0){r=new Kekule.Widget.SelectBox(e);d=[{value:(u=Kekule.Render.TextAlign).DEFAULT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_DEFAULT")},{value:u.LEADING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_LEADING")},{value:u.TRAILING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_TRAILING")},{value:u.CENTER,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_CENTER")},{value:u.LEFT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_LEFT")},{value:u.RIGHT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_RIGHT")}];r.setItems(d),l.addClassName(t.COMPOSER_TEXTALIGN_BOX),r.setHint(Kekule.$L("ChemWidgetTexts.HINT_TEXT_HORIZONTAL_ALIGN")),r.addEventListener("valueChange",function(e){this.getEditor().modifyObjectsRenderOptions(this.getTargetObjs(),{horizontalAlign:this.getTextHorizontalAlignBox().getValue()},!1,!0)},this),this.setPropStoreFieldValue("textHorizontalAlignBox",r),this._createCtrlGroup(n,a,Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_HORIZONTAL_ALIGN"),r),r=new Kekule.Widget.SelectBox(e);var u;d=[{value:(u=Kekule.Render.TextAlign).DEFAULT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_DEFAULT")},{value:u.LEADING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_LEADING")},{value:u.TRAILING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_TRAILING")},{value:u.CENTER,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_CENTER")},{value:u.TOP,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_TOP")},{value:u.BOTTOM,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_BOTTOM")}];r.setItems(d),l.addClassName(t.COMPOSER_TEXTALIGN_BOX),r.setHint(Kekule.$L("ChemWidgetTexts.HINT_TEXT_VERTICAL_ALIGN")),r.addEventListener("valueChange",function(e){this.getEditor().modifyObjectsRenderOptions(this.getTargetObjs(),{verticalAlign:this.getTextVerticalAlignBox().getValue()},!1,!0)},this),this.setPropStoreFieldValue("textVerticalAlignBox",r),this._createCtrlGroup(n,a,Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_VERTICAL_ALIGN"),r)}if(i.indexOf(o.nodeDisplayMode)>=0){l=new Kekule.Widget.SelectBox(e);this.fillNodeDisplayModeBox(l),l.addClassName(t.COMPOSER_NODEDISPLAYMODE_BOX),l.setHint(Kekule.$L("ChemWidgetTexts.HINT_NODE_LABEL_DISPLAY_MODE")),l.addEventListener("valueChange",function(e){this.getEditor().modifyObjectsRenderOptions(this.getTargetObjs(),{nodeDisplayMode:this.getNodeLabelDisplayModeBox().getValue()},!1,!0)},this),this.setPropStoreFieldValue("nodeLabelDisplayModeBox",l),this._nodeLabelDisplayModeGroup=this._createCtrlGroup(n,a,Kekule.$L("ChemWidgetTexts.CAPTION_NODE_LABEL_DISPLAY_MODE"),l)}this.setPropStoreFieldValue("fontPanel",e);var c=this._valueStorage;return c&&this._updateUiValuesFromStorage(c),e},doCreateWidget:function(){var e=new Kekule.Widget.DropDownButton(this.getEditor());return e.setHint(Kekule.$L("ChemWidgetTexts.HINT_TEXT_FORMAT")),e.setText(Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_FORMAT")),e.setShowText(!1),e.setButtonKind(Kekule.Widget.Button.Kinds.DROPDOWN),e.addClassName(t.COMPOSER_TEXTFORMAT_BUTTON),e.setDropDownWidgetGetter(this._doCreateDropDownPanel.bind(this)),e},_filterNodeLabelDisplayModeTargets:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o];i instanceof Kekule.ChemStructureNode&&(i instanceof Kekule.StructureFragment&&i.hasCtab(),t.push(i))}return t},_hasNodeLabelDisplayModeTarget:function(e){return!!this._filterNodeLabelDisplayModeTargets(e).length},_updateUiValuesFromStorage:function(e){this.getFontPanel()&&(this.getFontNameBox()&&this.getFontNameBox().setValue(e.fontName),this.getFontSizeBox()&&this.getFontSizeBox().setValue(e.fontSize),this.getTextDirectionBox()&&this.getTextDirectionBox().setValue(e.textDirection),this.getTextHorizontalAlignBox()&&this.getTextHorizontalAlignBox().setValue(e.textHAlign),this.getTextVerticalAlignBox()&&this.getTextVerticalAlignBox().setValue(e.textVAlign),this.getNodeLabelDisplayModeBox()&&this.getNodeLabelDisplayModeBox().setValue(e.nodeDisplayMode),this._nodeLabelDisplayModeGroup&&Kekule.StyleUtils.setDisplay(this._nodeLabelDisplayModeGroup,e.hasNodeLabelDisplayModeTarget))},doLoadFromTargets:function(e,t){if(t&&t.length){var o=this._valueStorage;o.fontName=this.getRenderOptionValue(t,"fontFamily")||"",o.fontSize=this.getRenderOptionValue(t,"fontSize")||void 0,o.textDirection=this.getRenderOptionValue(t,"charDirection")||Kekule.Render.TextDirection.DEFAULT,o.textHAlign=this.getRenderOptionValue(t,"horizontalAlign")||Kekule.Render.TextAlign.DEFAULT,o.textVAlign=this.getRenderOptionValue(t,"verticalAlign")||Kekule.Render.TextAlign.DEFAULT,o.nodeDisplayMode=this.getRenderOptionValue(this._filterNodeLabelDisplayModeTargets(t),"nodeDisplayMode")||Kekule.Render.NodeLabelDisplayMode.DEFAULT,o.hasNodeLabelDisplayModeTarget=this._hasNodeLabelDisplayModeTarget(t),this.getFontPanel()&&this._updateUiValuesFromStorage(o)}},doApplyToTargets:function(e,t){},fillFontSizeBox:function(e){for(var t=this.getEditorConfigs().getStyleSetterConfigs().getListedFontSizes(),o=[{text:Kekule.$L("ChemWidgetTexts.S_VALUE_DEFAULT"),value:void 0}],r=0,i=t.length;r<i;++r)o.push({text:t[r]+" px",value:t[r]});e.setItems(o)},fillFontNameBox:function(e){for(var t=this.getEditorConfigs().getStyleSetterConfigs().getListedFontNames(),o=[{text:Kekule.$L("ChemWidgetTexts.S_VALUE_DEFAULT"),value:""}],r=0,i=t.length;r<i;++r)o.push({text:t[r],value:t[r]});e.setItems(o)},fillNodeDisplayModeBox:function(e){var t=Kekule.Render.NodeLabelDisplayMode,o=[{text:Kekule.$L("ChemWidgetTexts.CAPTION_NODE_LABEL_DISPLAY_MODE_DEFAULT"),value:t.DEFAULT},{text:Kekule.$L("ChemWidgetTexts.CAPTION_NODE_LABEL_DISPLAY_MODE_SHOWN"),value:t.SHOWN},{text:Kekule.$L("ChemWidgetTexts.CAPTION_NODE_LABEL_DISPLAY_MODE_HIDDEN"),value:t.HIDDEN},{text:Kekule.$L("ChemWidgetTexts.CAPTION_NODE_LABEL_DISPLAY_MODE_SMART"),value:t.SMART}];e.setItems(o)}}),Kekule.Editor.ObjModifierManager.register(Kekule.ChemObject,[Kekule.Editor.ObjModifier.RichText])}(),function(){"use strict";var e=Kekule.ArrayUtils,t=Kekule.DomUtils,o=(Kekule.HtmlElementUtils,Kekule.Widget.HtmlClassNames),r=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.ComponentWidgetNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{COMPOSER_ATOM_MODIFIER_BUTTON:"K-Chem-Composer-AtomModifier-Button",COMPOSER_ATOM_MODIFIER_DROPDOWN:"K-Chem-Composer-AtomModifier-DropDown",COMPOSER_BOND_MODIFIER_BUTTON:"K-Chem-Composer-BondModifier-Button",COMPOSER_BOND_MODIFIER_DROPDOWN:"K-Chem-Composer-BondModifier-DropDown",COMPOSER_CHARGE_MODIFIER_BUTTON:"K-Chem-Composer-ChargeModifier-Button",COMPOSER_CHARGE_MODIFIER_DROPDOWN:"K-Chem-Composer-ChargeModifier-DropDown"}),Kekule.Editor.ObjModifier.ChemStructureModifier=Class.create(Kekule.Editor.ObjModifier.Base,{CLASS_NAME:"Kekule.Editor.ObjModifier.ChemStructureModifier",installValueChangeEventHandler:function(e){}}),Kekule.Editor.ObjModifier.ChemStructureModifier.getCategories=function(){return[Kekule.Editor.ObjModifier.Category.CHEM_STRUCTURE]},Kekule.Editor.ObjModifier.Atom=Class.create(Kekule.Editor.ObjModifier.ChemStructureModifier,{CLASS_NAME:"Kekule.Editor.ObjModifier.Atom",initialize:function(e){this.tryApplySuper("initialize",[e]),this._valueStorage={}},initProperties:function(){this.defineProp("atomSetter",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null})},doCreateWidget:function(){var e=new Kekule.Widget.DropDownButton(this.getEditor());return e.setHint(Kekule.$L("ChemWidgetTexts.HINT_ATOM_MODIFIER")),e.setText(Kekule.$L("ChemWidgetTexts.CAPTION_ATOM_MODIFIER")),e.setShowText(!0),e.setButtonKind(Kekule.Widget.Button.Kinds.DROPDOWN),e.addClassName(r.COMPOSER_ATOM_MODIFIER_BUTTON),e.setDropDownWidgetGetter(this._createAtomSetter.bind(this)),e},_createAtomSetter:function(i){i||(i=this.getEditor());var n=this.getEditor(),a=new Kekule.ChemWidget.StructureNodeSetter(i);a.addClassName([o.PANEL,r.COMPOSER_ATOM_MODIFIER_DROPDOWN,o.CORNER_ALL]),a.setLabelConfigs(this.getEditor().getRenderConfigs().getDisplayLabelConfigs());var l=i.getDocument().createElement("div");l.className=o.PANEL_CAPTION,t.setElementText(l,Kekule.$L("ChemWidgetTexts.CAPTION_ATOM_MODIFIER"));var s=a.getElement();s.insertBefore(l,Kekule.DomUtils.getFirstChildElem(s));var d=e.clone(this.getEditor().getEditorConfigs().getStructureConfigs().getPrimaryOrgChemAtoms());d.push("...");var u=n&&n.getEnabledNonAtomInputData&&n.getEnabledNonAtomInputData();a.setSelectableInfos({elementSymbols:d,nonElementInfos:u,subGroupRepItems:Kekule.Editor.StoredSubgroupRepositoryItem2D.getAllRepItems()});var c=this;return a.addEventListener("valueChange",function(e){e.value&&c.applyToTargets(),a.dismiss()}),this.setPropStoreFieldValue("atomSetter",a),this._valueStorage.nodes&&a.setNodes(this._valueStorage.nodes),a},_filterStructureNodes:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o];i instanceof Kekule.ChemStructureNode&&t.push(i)}return t},_getActualModificationNodes:function(t,o){for(var r=[],i=0,n=t.length;i<n;++i){var a=t[i];if(a instanceof Kekule.StructureFragment&&a.isExpanded()){var l=this._getActualModificationNodes(a.getNodes(),!0);e.pushUnique(r,l)}else r.push(a)}return o||(r=this._filterStructureNodes(r)),r},doLoadFromTargets:function(e,t){var o,r=this._getActualModificationNodes(t);this._valueStorage.nodes=r,this.getAtomSetter()&&(this.getAtomSetter().setLabelConfigs(this.getEditor().getRenderConfigs().getDisplayLabelConfigs()),this.getAtomSetter().setNodes(r)),o=Kekule.Editor.StructureUtils.getAllChemStructureNodesHtmlCode(r,null,null,this.getEditor().getRenderConfigs().getDisplayLabelConfigs()),this.getWidget().setText(o||Kekule.$L("ChemWidgetTexts.CAPTION_ATOM_MODIFIER_MIXED")).setShowText(!0).setDisplayed(!!r.length)},doApplyToTargets:function(e,t){for(var o,r=this.getAtomSetter().getValue(),i=[],n=this._getActualModificationNodes(t),a=0,l=n.length;a<l;++a){var s=n[a];if(s instanceof Kekule.ChemStructureNode){var d=this._createNewDataToAtomOperation(r,s);d&&i.push(d)}}(o=i.length>1?new Kekule.MacroOperation(i):i[0])&&this.getEditor().execOperation(o)},_createNewDataToAtomOperation:function(e,t){return Kekule.Editor.OperationUtils.createNodeModificationOperationFromData(t,e,this.getEditor())},_createModificationOperation:function(e,t,o,r){return Kekule.Editor.OperationUtils.createNodeModificationOperation(e,t,o,r,this.getEditor())}}),Kekule.Editor.ObjModifier.Bond=Class.create(Kekule.Editor.ObjModifier.ChemStructureModifier,{CLASS_NAME:"Kekule.Editor.ObjModifier.Bond",initialize:function(e){this.tryApplySuper("initialize",[e]),this._activeSelBtnHtmlClass=null,this._defaultBondTypeData=null,this._valueStorage={};var t=this.getEditor().getEnabledBondFormData();this._defaultBondTypeData=t[0]},initProperties:function(){this.defineProp("bondSelector",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null})},doCreateWidget:function(){var e=new Kekule.Widget.DropDownButton(this.getEditor());return e.setHint(Kekule.$L("ChemWidgetTexts.HINT_BOND_MODIFIER")),e.setText(Kekule.$L("ChemWidgetTexts.CAPTION_BOND_MODIFIER")),e.setShowText(!1),e.setButtonKind(Kekule.Widget.Button.Kinds.DROPDOWN),e.addClassName(r.COMPOSER_BOND_MODIFIER_BUTTON),e.setDropDownWidgetGetter(this._createBondSelector.bind(this)),this._defaultBondTypeData.htmlClass&&e.addClassName(this._defaultBondTypeData.htmlClass),e},_filterBond:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o];i instanceof Kekule.Bond&&t.push(i)}return t},_getActualModificationBonds:function(t,o){for(var r=[],i=0,n=t.length;i<n;++i){var a=t[i];if(a instanceof Kekule.StructureFragment&&a.isExpanded()){var l=this._getActualModificationBonds(a.getNodes(),!0);e.pushUnique(r,l),e.pushUnique(r,a.getConnectors())}else a instanceof Kekule.Bond&&r.push(a)}return o||(r=this._filterBond(r)),r},_createBondSelector:function(e){e||(e=this.getEditor());var t=new Kekule.ChemWidget.StructureConnectorSelectPanelAdv(e);if(t.setCaption(Kekule.$L("ChemWidgetTexts.CAPTION_BOND_MODIFIER")),t.addClassName(r.COMPOSER_BOND_MODIFIER_DROPDOWN),this.getEditor().getEnabledBondFormData){var o=this.getEditor().getEnabledBondFormData();t.setBondPropNames(this._getBondComparePropNames(o)),t.setBondData(o);var i=this.getEditor().getEditorConfigs().getInteractionConfigs().getEnableBondKekulizeHucklize();t.setExtraComponents(i?[Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Components.KEKULIZE]:[])}this._valueStorage.bondsPropValues&&t.setActiveBondPropValues(this._valueStorage.bondsPropValues),this.setPropStoreFieldValue("bondSelector",t);var n=this;return t.addEventListener("valueChange",function(e){n.applyToTargets(),t.dismiss()}),t.addEventListener("command",function(e){n.execExtraCommand(e.command)}),t},_setActiveBondHtmlClass:function(e){var t=this._activeSelBtnHtmlClass;t&&this.getWidget().removeClassName(t),this._activeSelBtnHtmlClass=e,e||(e=this._defaultBondTypeData.htmlClass),e&&this.getWidget().addClassName(e)},_extractBondPropValues:function(e,t){return e.getPropValues(t)},_extractBondsPropValues:function(e,t){for(var o,r,i=0,n=e.length;i<n;++i)if(r=this._extractBondPropValues(e[i],t),o){if(!Kekule.Editor.StructureUtils.isBondPropsMatch(o,r,t)){o=null;break}}else o=r;return o},_getBondComparePropNames:function(t){for(var o=[],r=0,i=t.length;r<i;++r){var n=t[r].bondProps;n&&e.pushUnique(o,Kekule.ObjUtils.getOwnedFieldNames(n))}return o},_getMatchedBondData:function(e,t,o){if(!e)return null;for(var r=0,i=t.length;r<i;++r){var n=t[r];if(n&&Kekule.Editor.StructureUtils.isBondPropsMatch(e,n.bondProps,o))return n}return null},_createBondModificationOperation:function(e,t){return new Kekule.ChemObjOperation.Modify(t,e,this.getEditor())},_execModificationOperations:function(e){var t;(t=e.length>1?new Kekule.MacroOperation(e):e[0])&&this.getEditor().execOperation(t)},doLoadFromTargets:function(e,t){var o=this.getEditor().getEnabledBondFormData();this._defaultBondTypeData=o[0];var r=this._getActualModificationBonds(t);if(this._valueStorage.connectors=r,this.getBondSelector()){var i=this.getBondSelector().getBondPropNames(),n=this._extractBondsPropValues(r,i);this.getBondSelector().setActiveBondPropValues(n),this._setActiveBondHtmlClass(this.getBondSelector().getActiveBondHtmlClass())}else{this._valueStorage.bondPropNames=this._getBondComparePropNames(o),this._valueStorage.bondsPropValues=this._extractBondsPropValues(r,this._valueStorage.bondPropNames);var a=this._getMatchedBondData(this._valueStorage.bondsPropValues,o,this._valueStorage.bondPropNames);this._setActiveBondHtmlClass(a&&a.htmlClass)}this.getWidget().setDisplayed(!!r.length)},doApplyToTargets:function(e,t){for(var o=this.getBondSelector().getActiveBondPropValues(),r=[],i=this._getActualModificationBonds(t),n=0,a=i.length;n<a;++n){var l=i[n],s=this._createBondModificationOperation(o,l);s&&r.push(s)}this._execModificationOperations(r),this._setActiveBondHtmlClass(this.getBondSelector().getActiveBondHtmlClass())},execExtraCommand:function(e){var t=this._getActualModificationBonds(this.getTargetObjs());if(t&&t.length){var o=this.getEditor().getChemObj();if(o&&o.getKekulizationChanges){var r,i=Kekule.ChemWidget.StructureConnectorSelectPanelAdv.Commands;if(e===i.KEKULIZE?r=o.getKekulizationChanges(t):e===i.HUCKLIZE&&(r=o.getHucklizationChanges(t)),r&&r.length){for(var n=[],a=0,l=r.length;a<l;++a){var s=r[a].bond,d=r[a].bondOrder,u=this._createBondModificationOperation({bondOrder:d},s);n.push(u)}this._execModificationOperations(n)}}}},_getKekulizeOrHucklizeBondModifications:function(e){this.getEditor()}}),Kekule.Editor.ObjModifier.Charge=Class.create(Kekule.Editor.ObjModifier.ChemStructureModifier,{CLASS_NAME:"Kekule.Editor.ObjModifier.Charge",initialize:function(e){this.tryApplySuper("initialize",[e]),this._valueStorage={}},initProperties:function(){this.defineProp("chargeSelector",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null})},doCreateWidget:function(){var e=new Kekule.Widget.DropDownButton(this.getEditor());return e.setHint(Kekule.$L("ChemWidgetTexts.HINT_CHARGE_MODIFIER")).setText(Kekule.$L("ChemWidgetTexts.TEXT_CHARGE_UNKNOWN")).setShowText(!0).setButtonKind(Kekule.Widget.Button.Kinds.DROPDOWN),e.addClassName(r.COMPOSER_CHARGE_MODIFIER_BUTTON),e.setDropDownWidgetGetter(this._createChargeSelector.bind(this)),e},_createChargeSelector:function(e){e||(e=this.getEditor());var t=new Kekule.ChemWidget.ChargeSelectPanel(e);t.setCaption(Kekule.$L("ChemWidgetTexts.CAPTION_CHARGE_MODIFIER")),t.addClassName(r.COMPOSER_CHARGE_MODIFIER_DROPDOWN),Kekule.ObjUtils.notUnset(this._valueStorage.charge)&&t.setValue(this._valueStorage.charge),this.setPropStoreFieldValue("chargeSelector",t);var o=this;return t.addEventListener("valueChange",function(e){o.applyToTargets(),t.dismiss()}),t},_filterStructureNodes:function(e){for(var t=[],o=0,r=e.length;o<r;++o){var i=e[o];i instanceof Kekule.ChemStructureNode&&i.getCharge&&t.push(i)}return t},_getActualModificationNodes:function(t,o){for(var r=[],i=0,n=t.length;i<n;++i){var a=t[i];if(a instanceof Kekule.StructureFragment&&a.isExpanded()){var l=this._getActualModificationNodes(a.getNodes(),!0);e.pushUnique(r,l)}else r.push(a)}return o||(r=this._filterStructureNodes(r)),r},_getChargeOfNodes:function(e){for(var t=null,o=0,r=e.length;o<r;++o){var i=e[o];if(i.getCharge){var n=i.getCharge()||0;if(null===t)t=n;else if(t!==n)return null}}return t},doLoadFromTargets:function(e,t){var o=this._getActualModificationNodes(t),r=o.length>=0&&o.length<=1;if(r){var i,n=this._getChargeOfNodes(o);if(this._valueStorage.charge=n,this.getChargeSelector()&&this.getChargeSelector().setValue(n),n){var a=n>0?Kekule.$L("ChemWidgetTexts.TEXT_CHARGE_POSITIVE"):Kekule.$L("ChemWidgetTexts.TEXT_CHARGE_NEGATIVE"),l=Kekule.NumUtils.toDecimals(n,1);i=Math.abs(l)+a}else i=Kekule.$L("ChemWidgetTexts.TEXT_CHARGE_UNKNOWN");this.getWidget().setText(i).setShowText(!0)}this.getWidget().setDisplayed(r)},doApplyToTargets:function(e,t){for(var o,r=this.getChargeSelector().getValue(),i=[],n=this._getActualModificationNodes(t),a=(e=this.getEditor(),0),l=n.length;a<l;++a){var s=n[a];if(s instanceof Kekule.ChemStructureNode){var d=new Kekule.ChemObjOperation.Modify(s,{charge:r},e);d&&i.push(d)}}(o=i.length>1?new Kekule.MacroOperation(i):i[0])&&(e=this.getEditor()).execOperation(o)}});var i=Kekule.Editor.ObjModifierManager;i.register(Kekule.ChemStructureNode,[Kekule.Editor.ObjModifier.Atom]),i.register(Kekule.ChemStructureNode,[Kekule.Editor.ObjModifier.Charge]),i.register([Kekule.Bond,Kekule.StructureFragment],[Kekule.Editor.ObjModifier.Bond])}(),function(){"use strict";var e=Kekule.ObjUtils,t=Kekule.ArrayUtils,o=(Kekule.DomUtils,Kekule.HtmlElementUtils,Kekule.Widget.HtmlClassNames,Kekule.ChemWidget.HtmlClassNames);Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{COMPOSER_GLYPH_PATH_MODIFIER_BUTTON:"K-Chem-Composer-GlyphPathModifier-Button",COMPOSER_Glyph_PATH_MODIFIER_DROPDOWN:"K-Chem-Composer-GlyphPathModifier-DropDown",COMPOSER_GLYPH_REACTION_ARROW_MODIFIER_BUTTON:"K-Chem-Composer-ReactionArrowModifier-Button",COMPOSER_GLYPH_ARC_PATH_MODIFIER_BUTTON:"K-Chem-Composer-ArcPathModifier-Button",COMPOSER_GLYPH_MULTI_ARC_PATH_MODIFIER_BUTTON:"K-Chem-Composer-MultiArcPathModifier-Button",COMPOSER_GLYPH_ELECTRON_PUSHING_ARROW_MODIFIER_BUTTON:"K-Chem-Composer-ElectronPushingArrowModifier-Button",COMPOSER_GLYPH_BOND_FORMING_ELECTRON_PUSHING_ARROW_MODIFIER_BUTTON:"K-Chem-Composer-BondFormingElectronPushingArrowModifier-Button"}),Kekule.Editor.ObjModifier.GlyphModifier=Class.create(Kekule.Editor.ObjModifier.Base,{CLASS_NAME:"Kekule.Editor.ObjModifier.GlyphModifier"}),Kekule.Editor.ObjModifier.GlyphModifier.getCategories=function(){return[Kekule.Editor.ObjModifier.Category.GLYPH]},Kekule.Editor.ObjModifier.GlyphPath=Class.create(Kekule.Editor.ObjModifier.GlyphModifier,{CLASS_NAME:"Kekule.Editor.ObjModifier.GlyphPath",MIX_VALUE:"[mixed]",initialize:function(e){this.tryApplySuper("initialize",[e]),this._valueStorage={}},initProperties:function(){this.defineProp("pathParamSetter",{dataType:"Kekule.Widget.BaseWidget",serializable:!1,setter:null})},doCreateWidget:function(){var e=new Kekule.Widget.DropDownButton(this.getEditor());return e.setHint(this.getModifierHint()),e.setText(this.getModifierCaption()),e.setShowText(!0),e.setButtonKind(Kekule.Widget.Button.Kinds.DROPDOWN),e.addClassName(o.COMPOSER_GLYPH_PATH_MODIFIER_BUTTON+" "+this.getModifierClassName()),e.setDropDownWidgetGetter(this._createPathParamSetter.bind(this)),e},_createPathParamSetter:function(e){e||(e=this.getEditor());var t=new(this.getPathParamSetterClass())(e);t.setCaption(this.getModifierCaption()),t.addClassName(o.COMPOSER_GLYPH_PATH_MODIFIER_DROPDOWN),this.setPropStoreFieldValue("pathParamSetter",t),this._valueStorage.pathParams&&(t.setValue(this._valueStorage.pathParams),this._valueStorage.pathParams=null);var r=this;return t.addEventListener("showStateChange",function(e){e.widget===t&&(e.isShown?r._lastOperation=null:e.isDismissed&&(r._lastOperation&&r._lastOperation.reverse(),r._lastOperation=null))}),t.addEventListener("valueChange",function(e){e.widget===t&&(r.doModification(r.getEditor(),r.getTargetObjs(),!1),r._lastOperation=null,e.stopPropagation())}),t.addEventListener("valueInput",function(e){e.widget===t&&(r.doModification(r.getEditor(),r.getTargetObjs(),!1),e.stopPropagation())}),t},getPathParamSetterClass:function(){return Kekule.ChemWidget.GlyphPathSettingPanel},getModifierCaption:function(){return Kekule.$L("ChemWidgetTexts.CAPTION_GLYPH_PATH_MODIFIER")},getModifierHint:function(){return Kekule.$L("ChemWidgetTexts.HINT_GLYPH_PATH_MODIFIER")},getModifierClassName:function(){return""},_mergeHashValues:function(o,r){if(!o)return r;if(r){var i=e.getOwnedFieldNames(o,!1),n=e.getOwnedFieldNames(r,!1),a=t.clone(i);if(t.pushUnique(a,n),a.length){for(var l={},s=0,d=a.length;s<d;++s){var u=a[s],c=o[u],p=r[u];l[u]=c===p?c:this.MIX_VALUE}return l}return null}return o},_extractPathParamsOfObjs:function(e){for(var t=null,o=0,r=e.length;o<r;++o){var i=e[o],n=i instanceof Kekule.Glyph.PathGlyphConnector?[i]:i instanceof Kekule.Glyph.PathGlyph?i.getConnectors():null;if(n){var a=this._extractPathParamOfConnectors(n);t=this._mergeHashValues(t,a)}}return t},_extractPathParamOfConnectors:function(e){for(var t=null,o=0,r=e.length;o<r;++o){var i=this._extractPathParamOfConnector(e[o]);i&&(t=this._mergeHashValues(t,i))}return t},_extractPathParamOfConnector:function(e){return e.getPathParams&&e.getPathParams()},getApplicableGlyphClasses:function(){return[Kekule.Glyph.PathGlyph]},isApplicableGlyph:function(e){if(this.getTargetPathGlyph(e)){var t=this.getApplicableGlyphClasses();if(t){for(var o=0,r=t.length;o<r;++o)if(e instanceof t[o])return!0;return!1}return!0}return!1},getTargetPathGlyph:function(e){return e instanceof Kekule.Glyph.PathGlyph?e:e instanceof Kekule.Glyph.PathGlyphConnector?e.getParent():null},_getActualModificationObjs:function(e){for(var o=[],r=0,i=e.length;r<i;++r){var n=e[r];this.isApplicableGlyph(n)&&t.pushUnique(o,n)}return o},_getActualModificationConnectors:function(e){for(var o=[],r=this._getActualModificationObjs(e),i=0,n=r.length;i<n;++i){var a=r[i];a instanceof Kekule.Glyph.PathGlyphConnector?o.push(a):a instanceof Kekule.Glyph.PathGlyph&&t.pushUnique(o,a.getConnectors())}return o},_getActualModificationGlyphs:function(e){for(var o=[],r=this._getActualModificationObjs(e),i=0,n=r.length;i<n;++i){var a=r[i],l=this.getTargetPathGlyph(a);l&&t.pushUnique(o,l)}return o},_filterAppliableParams:function(t){for(var o={},r=e.getOwnedFieldNames(t),i=0,n=r.length;i<n;++i){var a=t[r[i]];void 0!==a&&a!==this.MIX_VALUE&&(o[r[i]]=a)}return o},_splitPathParamValues:function(t){for(var o={},r=e.getOwnedFieldNames(t),i=0,n=r.length;i<n;++i){var a=r[i];if(!a.startsWith("_")){var l=this._getPathParamFieldCategory(a);o[l]||(o[l]={}),o[l][a]=t[a]}}return o},_getPathParamFieldCategory:function(e){return"connectorParams"},createModificationOperations:function(e,t,o){var r=this._splitPathParamValues(o);return this.doCreateModificationOperations(e,t,r)},doCreateModificationOperations:function(e,t,o){if(o.connectorParams){var r=this._getActualModificationConnectors(t);return this._createModificationOperationsOnConnectors(e,r,o.connectorParams)}return null},updateModificationOperations:function(e,t,o,r){var i,n=this._splitPathParamValues(o);return i=r.length?r:r instanceof Kekule.MacroOperation?r.getChildren():[r],this.doUpdateModificationOperations(e,i,t,n)},doUpdateModificationOperations:function(e,t,o,r){return this._updateModificationOperationsOnConnectors(e,o,r.connectorParams,t),t},_updateModificationOperationsOnConnectors:function(e,t,o,r){for(var i=0,n=r.length;i<n;++i){var a=r[i],l=a.getTarget();l instanceof Kekule.Glyph.PathGlyphConnector&&a instanceof Kekule.ChemObjOperation.ModifyHashProp&&this._updateModificationOperationOnConnector(e,l,a,o)}},_updateModificationOperationOnConnector:function(e,t,o,r){t instanceof Kekule.Glyph.PathGlyphConnector&&o instanceof Kekule.ChemObjOperation.ModifyHashProp&&o.setNewPropValue(r)},_createModificationOperationsOnConnectors:function(e,t,o){for(var r=[],i=0,n=t.length;i<n;++i){var a=t[i];if(a instanceof Kekule.Glyph.PathGlyphConnector){var l=this._createModificationOperationOnConnector(e,a,o);l&&r.push(l)}}return r},_createModificationOperationOnConnector:function(e,t,o){return t instanceof Kekule.Glyph.PathGlyphConnector?new Kekule.ChemObjOperation.ModifyHashProp(t,"pathParams",o,e):null},_createWrapperOperation:function(e){return e&&e.length>1?new Kekule.MacroOperation(e):e[0]},_execModificationOperationInEditor:function(e){var t=!this._lastOperation,o=this.getEditor();o.beginManipulateAndUpdateObject();try{e&&(t?o.execOperation(e):e.execute())}finally{o.endManipulateAndUpdateObject(),this._lastOperation=e}},doModification:function(e,t,o){var r,i=this.getPathParamSetter().getValue();i=this._filterAppliableParams(i),r=this._lastOperation?this.updateModificationOperations(e,t,i,this._lastOperation):this.createModificationOperations(e,t,i);var n=this._createWrapperOperation(r);this._execModificationOperationInEditor(n)},doLoadFromTargets:function(e,t){var o=this._getActualModificationObjs(t),r=o.length>0;if(this._lastOperation=null,r){var i=this._extractPathParamsOfObjs(o);this._valueStorage.pathParams=i;var n=this.getPathParamSetter();n&&n.setValue(i)}this.getWidget().setDisplayed(r)},doApplyToTargets:function(e,t){this.doModification(e,t,!1)}}),Kekule.Editor.ObjModifier.ReactionArrowAndSegmentPath=Class.create(Kekule.Editor.ObjModifier.GlyphPath,{CLASS_NAME:"Kekule.Editor.ObjModifier.ReactionArrowAndSegmentPath",MIX_VALUE:"[mixed]",initialize:function(e){this.tryApplySuper("initialize",[e])},getPathParamSetterClass:function(){return Kekule.ChemWidget.GlyphReactionArrowPathSettingPanel},getModifierCaption:function(){return Kekule.$L("ChemWidgetTexts.CAPTION_REACTION_ARROW_AND_SEGMENT_PATH_MODIFIER")},getModifierHint:function(){return Kekule.$L("ChemWidgetTexts.HINT_REACTION_ARROW_AND_SEGMENT_PATH_MODIFIER")},getModifierClassName:function(){return o.COMPOSER_GLYPH_REACTION_ARROW_MODIFIER_BUTTON},getApplicableGlyphClasses:function(){return[Kekule.Glyph.StraightLine,Kekule.Glyph.Segment,Kekule.Glyph.ReactionArrow]},_extractPathParamsOfObjs:function(e){for(var t,o=this.tryApplySuper("_extractPathParamsOfObjs",[e]),r=0,i=e.length;r<i;++r){var n=e[r],a=this.getTargetPathGlyph(n);if(a&&a.getReactionType){var l=a.getReactionType();if(t){if(t!==l){t=Kekule.Glyph.ReactionArrowType.CUSTOM;break}}else t=l}}return o.reactionArrowType=t,o},createModificationOperations_OLD:function(e,t,o){var r=[];if(o.reactionArrowType!==this.MIX_VALUE){for(var i=this._getActualModificationGlyphs(t),n=0,a=i.length;n<a;++n){var l=i[n];l.setReactionType?o.reactionArrowType||l instanceof Kekule.Glyph.ReactionArrow&&r.push(new Kekule.ChemObjOperation.ChangeClass(l,Kekule.Glyph.Segment,e)):o.reactionArrowType&&l instanceof Kekule.Glyph.StraightLine&&r.push(new Kekule.ChemObjOperation.ChangeClass(l,Kekule.Glyph.ReactionArrow,e))}r.push(new Kekule.ChemObjOperation.Modify(l,{reactionType:o.reactionArrowType},e))}var s=this.tryApplySuper("createModificationOperations_OLD",[e,t,o])||[];return r=r.concat(s)},doCreateModificationOperations:function(e,t,o){var r=[],i=o.connectorParams;if(i.reactionArrowType!==this.MIX_VALUE){for(var n=this._getActualModificationGlyphs(t),a=0,l=n.length;a<l;++a){var s=n[a];s.setReactionType?i.reactionArrowType||s instanceof Kekule.Glyph.ReactionArrow&&r.push(new Kekule.ChemObjOperation.ChangeClass(s,Kekule.Glyph.Segment,e)):i.reactionArrowType&&s instanceof Kekule.Glyph.StraightLine&&r.push(new Kekule.ChemObjOperation.ChangeClass(s,Kekule.Glyph.ReactionArrow,e))}r.push(new Kekule.ChemObjOperation.Modify(s,{reactionType:i.reactionArrowType},e))}var d=this.tryApplySuper("doCreateModificationOperations",[e,t,o])||[];return r=r.concat(d)}}),Kekule.Editor.ObjModifier.ArcPath=Class.create(Kekule.Editor.ObjModifier.GlyphPath,{CLASS_NAME:"Kekule.Editor.ObjModifier.ArcPath",initialize:function(e){this.tryApplySuper("initialize",[e])},getPathParamSetterClass:function(){return Kekule.ChemWidget.GlyphArcPathSettingPanel},getModifierCaption:function(){return Kekule.$L("ChemWidgetTexts.CAPTION_ARC_PATH_MODIFIER")},getModifierHint:function(){return Kekule.$L("ChemWidgetTexts.HINT_ARC_PATH_MODIFIER")},getModifierClassName:function(){return o.COMPOSER_GLYPH_ARC_PATH_MODIFIER_BUTTON},getApplicableGlyphClasses:function(){return[Kekule.Glyph.Arc]}}),Kekule.Editor.ObjModifier.MultiArcPath=Class.create(Kekule.Editor.ObjModifier.GlyphPath,{CLASS_NAME:"Kekule.Editor.ObjModifier.MultiArcPath",initialize:function(e){this.tryApplySuper("initialize",[e])},getPathParamSetterClass:function(){return Kekule.ChemWidget.GlyphMultiArcPathSettingPanel},getModifierCaption:function(){return Kekule.$L("ChemWidgetTexts.CAPTION_MULTI_ARC_PATH_MODIFIER")},getModifierHint:function(){return Kekule.$L("ChemWidgetTexts.HINT_MULTI_ARC_PATH_MODIFIER")},getModifierClassName:function(){return o.COMPOSER_GLYPH_MULTI_ARC_PATH_MODIFIER_BUTTON},getApplicableGlyphClasses:function(){return[Kekule.Glyph.TwinArc]},_filterAppliableParams:function(e){if(DataType.isArrayValue(e)){for(var t=[],o=0,r=e.length;o<r;++o)t.push(this.tryApplySuper("_filterAppliableParams",[e[o]]));return t}return this.tryApplySuper("_filterAppliableParams",[e])},_buildConnectorGroup:function(e,t){var o,r,i,n=[];t&&(o=new Kekule.MapEx,n.map=o);for(var a=0,l=e.length;a<l;++a)for(var s=e[a],d=s instanceof Kekule.Glyph.PathGlyphConnector?[s]:s instanceof Kekule.Glyph.PathGlyph?s.getConnectors():[],u=0,c=d.length;u<c;++u){var p=d[u];(r=u,i=void 0,i=n[r],i||(i=[],n[r]=i),i).push(p),t&&o.set(p,u)}return n},_extractPathParamsOfObjs:function(e){for(var t=[],o=this._buildConnectorGroup(e),r=0,i=o.length;r<i;++r){var n=o[r]||[],a=this._extractPathParamOfConnectors(n)||null;t.push(a)}return t},_splitPathParamValues:function(t){if(DataType.isArrayValue(t)){for(var o=[],r=0,i=t.length;r<i;++r){var n=this.tryApplySuper("_splitPathParamValues",[t[r]]);if(n)for(var a=e.getOwnedFieldNames(n),l=0,s=a.length;l<s;++l){var d=a[l];o[d]||(o[d]=[]),o[d][r]=n[d]}}return o}return this.tryApplySuper("_splitPathParamValues",[t])},_updateModificationOperationsOnConnectors:function(e,t,o,r){for(var i=this._buildConnectorGroup(t,!0).map,n=0,a=r.length;n<a;++n){var l=r[n],s=l.getTarget();if(s instanceof Kekule.Glyph.PathGlyphConnector&&l instanceof Kekule.ChemObjOperation.ModifyHashProp){var d=i.get(s);d>=0&&this._updateModificationOperationOnConnector(e,s,l,o[d])}}},doCreateModificationOperations:function(e,o,r){var i=[];if(r.connectorParams)for(var n=t.toArray(r.connectorParams),a=this._buildConnectorGroup(o),l=0,s=a.length;l<s;++l){var d=n[l];if(d){var u=a[l]||[],c=this._createModificationOperationsOnConnectors(e,u,d);c&&(i=i.concat(c))}}return i}}),Kekule.Editor.ObjModifier.BaseElectronPushingArrow=Class.create(Kekule.Editor.ObjModifier.GlyphPath,{CLASS_NAME:"Kekule.Editor.ObjModifier.BaseElectronPushingArrow",getPathParamSetterClass:function(){return null},getModifierCaption:function(){return null},getModifierHint:function(){return null},getModifierClassName:function(){return""},getApplicableGlyphClasses:function(){return[]},_extractPathParamsOfObjs:function(t){for(var o,r=this.tryApplySuper("_extractPathParamsOfObjs",[t]),i=0,n=t.length;i<n;++i){var a=t[i],l=this.getTargetPathGlyph(a);if(l&&l.getElectronCount){var s=l.getElectronCount();if(e.isUnset(o))o=s;else if(o!==s){o=0;break}}}return r.electronCount=o,r},_getPathParamFieldCategory:function(e){return"electronCount"===e?"glyphParams":this.tryApplySuper("_getPathParamFieldCategory",[e])},doCreateModificationOperations:function(e,t,o){var r=this.tryApplySuper("doCreateModificationOperations",[e,t,o])||[];if(o.glyphParams&&o.glyphParams.electronCount)for(var i=this._getActualModificationGlyphs(t),n=0,a=i.length;n<a;++n){var l=i[n];l.hasProperty("electronCount")&&r.push(new Kekule.ChemObjOperation.Modify(l,{electronCount:o.glyphParams.electronCount},e))}return r},doUpdateModificationOperations:function(e,t,o,r){return this.tryApplySuper("doUpdateModificationOperations",[e,t,o,r]),this._updateGlyphModificationOperations(e,t,r),t},_updateGlyphModificationOperations:function(e,t,o){}}),Kekule.Editor.ObjModifier.ElectronPushingArrow=Class.create(Kekule.Editor.ObjModifier.BaseElectronPushingArrow,{CLASS_NAME:"Kekule.Editor.ObjModifier.ElectronPushingArrow",initialize:function(e){this.tryApplySuper("initialize",[e])},getPathParamSetterClass:function(){return Kekule.ChemWidget.GlyphElectronPushingArrowSettingPanel},getModifierCaption:function(){return Kekule.$L("ChemWidgetTexts.CAPTION_ELECTRON_PUSHING_ARROW_MODIFIER")},getModifierHint:function(){return Kekule.$L("ChemWidgetTexts.HINT_ELECTRON_PUSHING_ARROW_MODIFIER")},getModifierClassName:function(){return o.COMPOSER_GLYPH_ELECTRON_PUSHING_ARROW_MODIFIER_BUTTON},getApplicableGlyphClasses:function(){return[Kekule.Glyph.ElectronPushingArrow]}}),Kekule.Editor.ObjModifier.BondFormingElectronPushingArrow=Class.create(Kekule.Editor.ObjModifier.MultiArcPath,{CLASS_NAME:"Kekule.Editor.ObjModifier.BondFormingElectronPushingArrow",initialize:function(e){this.tryApplySuper("initialize",[e])},getPathParamSetterClass:function(){return Kekule.ChemWidget.GlyphMultiElectronPushingArrowSettingPanel},getModifierCaption:function(){return Kekule.$L("ChemWidgetTexts.CAPTION_BOND_FORMING_ELECTRON_PUSHING_ARROW_MODIFIER")},getModifierHint:function(){return Kekule.$L("ChemWidgetTexts.HINT_BOND_FORMING_ELECTRON_PUSHING_ARROW_MODIFIER")},getModifierClassName:function(){return o.COMPOSER_GLYPH_BOND_FORMING_ELECTRON_PUSHING_ARROW_MODIFIER_BUTTON},getApplicableGlyphClasses:function(){return[Kekule.Glyph.BondFormingElectronPushingArrow]},_extractPathParamsOfObjs:function(t){for(var o,r=this.tryApplySuper("_extractPathParamsOfObjs",[t]),i=0,n=t.length;i<n;++i){var a=t[i],l=this.getTargetPathGlyph(a);if(l&&l.getElectronCount){var s=l.getConnectorCount()||1,d=Math.round((l.getElectronCount()||0)/s);if(e.isUnset(o))(o=d)<=0&&(o=1);else if(o!==d){o=0;break}}}return r.electronCount=o,r},_getPathParamFieldCategory:function(e){return"electronCount"===e?"glyphParams":this.tryApplySuper("_getPathParamFieldCategory",[e])},_filterAppliableParams:function(e){var t=this.tryApplySuper("_filterAppliableParams",[e])||[];return e.electronCount&&(t.electronCount=e.electronCount),t},_splitPathParamValues:function(e){var t=this.tryApplySuper("_splitPathParamValues",[e])||[];return e.electronCount&&(t.glyphParams||(t.glyphParams={}),t.glyphParams.electronCount=e.electronCount),t},doCreateModificationOperations:function(e,t,o){var r=this.tryApplySuper("doCreateModificationOperations",[e,t,o])||[];if(o.glyphParams&&o.glyphParams.electronCount)for(var i=this._getActualModificationGlyphs(t),n=0,a=i.length;n<a;++n){var l=i[n];if(l.hasProperty("electronCount")){var s=l.getConnectorCount()||1,d=Math.round(o.glyphParams.electronCount*s);d<=0&&(d=1),r.push(new Kekule.ChemObjOperation.Modify(l,{electronCount:d},e))}}return r}});var r=Kekule.Editor.ObjModifierManager;r.register([Kekule.Glyph.StraightLine,Kekule.Glyph.PathGlyphConnector],[Kekule.Editor.ObjModifier.ReactionArrowAndSegmentPath]),r.register([Kekule.Glyph.Arc],[Kekule.Editor.ObjModifier.ArcPath]),r.register([Kekule.Glyph.TwinArc],[Kekule.Editor.ObjModifier.MultiArcPath]),r.register([Kekule.Glyph.ElectronPushingArrow],[Kekule.Editor.ObjModifier.ElectronPushingArrow]),r.register([Kekule.Glyph.BondFormingElectronPushingArrow],[Kekule.Editor.ObjModifier.BondFormingElectronPushingArrow])}(),function(){"use strict";var e=Kekule.ErrorLevel;Kekule.IssueCheck={},Kekule.IssueCheck.IssueCode={ERROR_UNKNOWN:0,ERROR_ATOM_VALENCE_ABNORMAL:1101,ERROR_BOND_ORDER_EXCEED:1201};var t=Kekule.IssueCheck.IssueCode;Kekule.IssueCheck.CheckerIds={ATOM_VALENCE:"atomValence",BOND_ORDER:"bondOrder"};var o=Kekule.IssueCheck.CheckerIds;Kekule.IssueCheck.CheckerManager={_checkerMap:{},register:function(e,t){e||(e=ClassEx.getClassName(t));var o=r._checkerMap[e];o&&o.checkerClass===t||(r._checkerMap[e]={checkerClass:t})},unregister:function(e){r._checkerMap[e]=null},getCheckerClass:function(e){var t=r._checkerMap[e];return t&&t.checkerClass},getCheckerInstance:function(e){var t=null,o=r._checkerMap[e];if(o){if(!o.instance){var i=o.checkerClass;o.instance=new i}t=o.instance}return t}};var r=Kekule.IssueCheck.CheckerManager;Kekule.IssueCheck.Executor=Class.create(ObjectEx,{CLASS_NAME:"Kekule.IssueCheck.Executor",initialize:function(){this.tryApplySuper("initialize")},initProperties:function(){this.defineProp("ignoreUnexposedObjs",{dataType:DataType.ARRAY}),this.defineProp("enabled",{dataType:DataType.BOOL}),this.defineProp("checkerIds",{dataType:DataType.ARRAY,setter:function(e){for(var t=[],o=Kekule.ArrayUtils.toArray(e),i=0,n=o.length;i<n;++i){var a=r.getCheckerInstance(o[i]);a&&t.push(a)}this.setPropStoreFieldValue("checkers",t)}}),this.defineProp("checkers",{dataType:DataType.ARRAY,serializable:!1,setter:null})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setIgnoreUnexposedObjs(!0),this.setEnabled(!0)},doFinalize:function(){this.setPropStoreFieldValue("checkers",null),this.tryApplySuper("doFinalize")},execute:function(e,t){if(!this.getEnabled())return null;for(var o=this.doPrepareOptions(t),r=new Kekule.MapEx,i=this.getCheckers(),n=[],a=0,l=i.length;a<l;++a)i[a].getEnabled()&&n.push(i[a]);this._getAllObjsNeedCheck(e,e,n,r,o);var s=[];for(a=0,l=n.length;a<l;++a){var d=n[a],u=r.get(d);if(u&&u.length){var c=d.check(u,e,o);c&&c.length&&(s=s.concat(c))}}return this.invokeEvent("execute",{checkResults:s}),s},recheck:function(e,t,o,r){var i;if(o){i=[];for(var n=0,a=t.length;n<a;++n)t[n].isChildOf(o)&&i.push(t[n])}else i=t;return i.length?e.check(t,r||{}):null},doPrepareOptions:function(e){return options||{}},_getAllObjsNeedCheck:function(e,t,o,r,i){var n=!this.getIgnoreUnexposedObjs();if(this._isObjExposed(e)||n)for(var a=0,l=t.getChildCount();a<l;++a){var s=t.getChildAt(a);if(this._isObjExposed(s)||n){for(var d=0,u=o.length;d<u;++d){var c=o[d];if(c.applicable(s,e,i)){var p=r.get(c);p?p.push(s):(p=[s],r.set(c,p))}}this._getAllObjsNeedCheck(e,s,o,r,i)}}},_isObjExposed:function(e){return!e.isExposed||e.isExposed()}}),Kekule.IssueCheck.CheckResult=Class.create(ObjectEx,{CLASS_NAME:"Kekule.IssueCheck.CheckResult",DEF_ERROR_CODE:t.UNKNOWN,initialize:function(t,o,r,i,n){this.setPropStoreFieldValue("level",t||e.ERROR),this.setPropStoreFieldValue("code",o||this.DEF_ERROR_CODE),this.setPropStoreFieldValue("data",r),this.setPropStoreFieldValue("targets",i),this.setPropStoreFieldValue("reporter",n),this.tryApplySuper("initialize")},doFinalize:function(){this.setData(null),this.setTargets(null),this.setReporter(null),this.tryApplySuper("doFinalize")},initProperties:function(){this.defineProp("level",{dataType:DataType.INT}),this.defineProp("code",{dataType:DataType.INT}),this.defineProp("data",{dataType:DataType.HASH}),this.defineProp("targets",{dataType:DataType.Array,serializable:!1}),this.defineProp("reporter",{dataType:DataType.OBJECTEX,serializable:!1}),this.defineProp("msg",{dataType:DataType.STRING,serializable:!1,setter:null,getter:function(){return this.getMessage()}})},getDataValue:function(e){return(this.getData()||{})[e]},getMessage:function(){return Kekule.$L("ErrorCheckMsg.GENERAL_ERROR_WITH_CODE").format(this.getErrorCode())}}),Kekule.IssueCheck.BaseChecker=Class.create(ObjectEx,{CLASS_NAME:"Kekule.IssueCheck.BaseChecker",initialize:function(){this.tryApplySuper("initialize")},initProperties:function(){this.defineProp("enabled",{dataType:DataType.BOOL})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setEnabled(!0)},_createReport:function(e,t,o,r,i){return new e(t,o,r,i,this)},applicable:function(e,t,o){return this.doApplicable(e,t,o||{})},doApplicable:function(e,t,o){return!1},check:function(e,t,o){return this.doCheck(e,t,o||{})},doCheck:function(e,t,o){return[]}}),Kekule.IssueCheck.AtomValenceChecker=Class.create(Kekule.IssueCheck.BaseChecker,{CLASS_NAME:"Kekule.IssueCheck.AtomValenceChecker",initialize:function(){this.tryApplySuper("initialize")},doApplicable:function(e,t,o){return e instanceof Kekule.Atom&&e.isNormalAtom()},doCheck:function(e,t,o){for(var r=[],i=0,n=e.length;i<n;++i){var a=this.checkValence(e[i]);a&&r.push(a)}return r},checkValence:function(o){var r=o.getValence(),i=o.getCharge()||0,n=this._getPossibleValences(o.getAtomicNumber(),i);return n.length&&n.indexOf(r)<0?this._createReport(Kekule.IssueCheck.AtomValenceChecker.Result,e.ERROR,t.ERROR_ATOM_VALENCE_ABNORMAL,{currValence:r,possibleValences:n},[o]):null},_getPossibleValences:function(e,t){var o=[],r=Kekule.ValenceUtils.getPossibleMdlValenceInfo(e,t);return r&&r.valences&&!r.unexpectedCharge&&(o=[].concat(r.valences)),o}}),r.register(o.ATOM_VALENCE,Kekule.IssueCheck.AtomValenceChecker),Kekule.IssueCheck.AtomValenceChecker.Result=Class.create(Kekule.IssueCheck.CheckResult,{CLASS_NAME:"Kekule.IssueCheck.AtomValenceChecker.Result",DEF_ERROR_CODE:t.ERROR_ATOM_VALENCE_ABNORMAL,getMessage:function(){var e=this.getDataValue("currValence"),t=this.getDataValue("possibleValences"),o=t.length<=1?Kekule.$L("ErrorCheckMsg.ATOM_VALENCE_ERROR_WITH_SUGGEST"):Kekule.$L("ErrorCheckMsg.ATOM_VALENCE_ERROR_WITH_SUGGESTS"),r=this.getTargets()[0],i=r.getId(),n=r.getSymbol(),a=i?i+"("+n+")":n,l=t.join("/");return o.format(a,e,l)}}),Kekule.IssueCheck.BondOrderChecker=Class.create(Kekule.IssueCheck.BaseChecker,{CLASS_NAME:"Kekule.IssueCheck.BondOrderChecker",doApplicable:function(e,t,o){return e instanceof Kekule.Bond&&e.isCovalentBond()},doCheck:function(e,t,o){for(var r=[],i=0,n=e.length;i<n;++i){var a=this.checkBondOrder(e[i]);a&&r.push(a)}return r},checkBondOrder:function(o){var r=o.getBondValence&&o.getBondValence();if(r){for(var i=o.getConnectedChemNodes(),n=0,a=0,l=i.length;a<l;++a){var s=this._getAllowedMaxBondOrder(i[a]);s>0&&(!n||s<n)&&(n=s)}if(n&&r>n)return this._createReport(Kekule.IssueCheck.BondOrderChecker.Result,e.ERROR,t.ERROR_BOND_ORDER_EXCEED,{currOrder:r,maxOrder:n},[o])}return null},_getAllowedMaxBondOrder:function(e){var t=0;if(e instanceof Kekule.Atom&&e.isNormalAtom()){var o=e.getValence(),r=Kekule.AtomTypeDataUtil.getAllAtomTypes(e.getAtomicNumber());if(r)for(var i=0,n=r.length;i<n;++i)if(o<=r[i].bondOrderSum){t=r[i].maxBondOrder;break}}return t}}),r.register(o.BOND_ORDER,Kekule.IssueCheck.BondOrderChecker),Kekule.IssueCheck.BondOrderChecker.Result=Class.create(Kekule.IssueCheck.CheckResult,{CLASS_NAME:"Kekule.IssueCheck.BondOrderChecker.Result",DEF_ERROR_CODE:t.ERROR_BOND_ORDER_EXCEED,getMessage:function(){var e=this.getDataValue("currOrder"),t=this.getDataValue("maxOrder"),o=this.getTargets()[0].getId()||"";return o?Kekule.$L("ErrorCheckMsg.BOND_WITH_ID_ORDER_EXCEED_ALLOWED_WITH_SUGGEST").format(o,e,t):Kekule.$L("ErrorCheckMsg.BOND_ORDER_EXCEED_ALLOWED_WITH_SUGGEST").format(e,t)}})}(),function(){"use strict";Kekule.IssueCheck.IssueCode=Object.extend(Kekule.IssueCheck.IssueCode,{WARNING_NODE_TOO_CLOSE:2101});var e=Kekule.IssueCheck.IssueCode;Kekule.IssueCheck.CheckerIds=Object.extend(Kekule.IssueCheck.CheckerIds,{NODE_DISTANCE_2D:"nodeDistance2D"});var t=Kekule.IssueCheck.CheckerIds,o=Kekule.IssueCheck.CheckerManager,r=Kekule.CoordUtils;Kekule.IssueCheck.ExecutorForEditor=Class.create(Kekule.IssueCheck.Executor,{CLASS_NAME:"Kekule.IssueCheck.ExecutorForEditor",initialize:function(e){this.setPropStoreFieldValue("editor",e),this.tryApplySuper("initialize")},initProperties:function(){this.defineProp("editor",{dataType:"Kekule.Editor.BaseEditor",serializable:!1})},doPrepareOptions:function(e){var t=e?Object.create(e):{},o=this.getEditor();return o&&(t.editor=o),t}}),Kekule.IssueCheck.Node2DDistanceChecker=Class.create(Kekule.IssueCheck.BaseChecker,{CLASS_NAME:"Kekule.IssueCheck.Node2DDistanceChecker",doApplicable:function(e,t,o){return t instanceof Kekule.ChemSpace&&e instanceof Kekule.ChemStructureNode&&(!(e instanceof Kekule.Molecule)||!(e.isExpanded&&e.isExpanded))&&(!e.isExposed||e.isExposed())},doCheck:function(e,t,o){for(var r=[],i=0,n=e.length;i<n;++i)for(var a=e[i],l=i+1;l<n;++l){var s=e[l],d=this.doCheckDistance(a,s,t,o);d&&r.push(d)}return r},doCheckDistance:function(t,o,r,i){var n=this._getDistanceRefLength(r)/5,a=i.editor,l=!!a&&a.getAllowCoordBorrow();return this._isNodesDistanceTooClose(t,o,n,l,a)?new Kekule.IssueCheck.Node2DDistanceChecker.Result(Kekule.ErrorLevel.WARNING,e.WARNING_NODE_TOO_CLOSE,null,[t,o],this):null},_getDistanceRefLength:function(e){return e.getDefAutoScaleRefLength()},_getEditor:function(e){return e.editor},_isNodesDistanceTooClose:function(e,t,o,r,i){if(i){var n=i.translateDistance(o,Kekule.Render.CoordSystem.CHEM,Kekule.Render.CoordSystem.SCREEN);return this._isNodesDistanceTooCloseByBound(e,t,o,n,i)}return this._getNodesDistanceByCoord(e,t,r)<distanceThreshold},_getNodesDistanceByCoord:function(e,t,o){var i=e.getAbsCoord2D(o),n=t.getAbsCoord2D(o);return r.getDistance(i,n)},_isNodesDistanceTooCloseByBound:function(e,t,o,i,n){Kekule.Render.BoundShapeType;var a=Kekule.Render.MetaShapeUtils,l=n.getChemObjBounds(e)[0],s=n.getChemObjBounds(t)[0];if(!l||!s)return!1;if(this._isPointOrCircleShape(l)&&this._isPointOrCircleShape(s))return r.getDistance(l.coords[0],s.coords[0])-(l.radius||0)-(l.radius||0)<i;if(this._isPointOrCircleShape(l)||this._isPointOrCircleShape(s)){var d=this._isPointOrCircleShape(l),u=d?l.coords[0]:s.coords[0],c=d?l.radius||0:s.radius||0,p=d?s:l,h=a.inflateShape(p,i);return a.getDistance(u,h)-c<0}for(var g=0,C=l.coords.length;g<C;++g){var _=l.coords[g];if(a.isCoordInside(_,s))return!0}for(g=0,C=s.coords.length;g<C;++g){_=s.coords[g];if(a.isCoordInside(_,l))return!0}return!1},_isPointOrCircleShape:function(e){var t=Kekule.Render.BoundShapeType;return e.shapeType===t.POINT||e.shapeType===t.CIRCLE}}),o.register(t.NODE_DISTANCE_2D,Kekule.IssueCheck.Node2DDistanceChecker),Kekule.IssueCheck.Node2DDistanceChecker.Result=Class.create(Kekule.IssueCheck.CheckResult,{CLASS_NAME:"Kekule.IssueCheck.NodeDistanceChecker.Result",DEF_ERROR_CODE:e.WARNING_NODE_TOO_CLOSE,getMessage:function(){var e=this.getTargets()[0],t=this.getTargets()[1],o=e&&e.getId&&e.getId(),r=t&&t.getId&&t.getId();return o&&r?Kekule.$L("ErrorCheckMsg.NODE_DISTANCE_TOO_CLOSE_WITH_ID").format(o+"/"+r):Kekule.$L("ErrorCheckMsg.NODE_DISTANCE_TOO_CLOSE")}})}(),function(){"use strict";var e=Kekule.DomUtils,t=Kekule.HtmlElementUtils,o=Kekule.Widget.HtmlClassNames,r=Kekule.ChemWidget.HtmlClassNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{CHECK_RESULT_LIST_VIEW:"K-Chem-CheckResultListView",CHECK_RESULT_LIST_VIEW_ITEM:"K-Chem-CheckResultListView-Item",CHECK_RESULT_LIST_VIEW_ITEM_BODY:"K-Chem-CheckResultListView-ItemBody",ISSUE_INSPECTOR:"K-Chem-IssueInspector",ISSUE_INSPECTOR_FLEX_LAYOUT:"K-Chem-IssueInspector-Flex-Layout",ISSUE_INSPECTOR_SUBPART:"K-Chem-IssueInspector-SubPart",ISSUE_INSPECTOR_LIST_PANEL:"K-Chem-IssueInspector-ListPanel"}),Kekule.ChemWidget.CheckResultListView=Class.create(Kekule.Widget.ListView,{CLASS_NAME:"Kekule.ChemWidget.CheckResultListView",initProperties:function(){this.defineProp("checkResults",{dataType:DataType.ARRAY,serializable:!1,setter:function(e){this.setPropStoreFieldValue("checkResults",e),this._updateListView()}}),this.defineProp("selectedCheckResult",{dataType:"Kekule.IssueCheck.CheckResult",serializable:!1,setter:null,getter:function(){var e,t=this.getSelectedItem();return t&&(e=this.getItemData(t).checkResult),e}})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setEnableSelect(!0).setEnableMultiSelect(!1).setLayout(Kekule.Widget.Layout.VERTICAL)},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+r.CHECK_RESULT_LIST_VIEW},getItemClassName:function(){return this.tryApplySuper("getItemClassName")+" "+r.CHECK_RESULT_LIST_VIEW_ITEM},createChildItem:function(e){var t;return t=e instanceof Kekule.IssueCheck.CheckResult?this._wrapCheckResultToItemData(e):e,this.tryApplySuper("createChildItem",[t])},doCreateChildItem:function(e){var t=this.getDocument(),o=t.createElement("li"),i=t.createElement("span");return i.className=r.CHECK_RESULT_LIST_VIEW_ITEM_BODY,o.appendChild(i),o},doSetItemData:function(t,o){o&&(o.text&&e.setElementText(t.getElementsByClassName(r.CHECK_RESULT_LIST_VIEW_ITEM_BODY)[0],o.text),o.hint&&t.setAttribute("title",o.hint))},_wrapCheckResultToItemData:function(e){var t=e.getMessage();return{text:t,hint:t,checkResult:e}},_updateListView:function(){this.clearItems();for(var e=this.getCheckResults()||[],o=0,r=e.length;o<r;++o){var i=this.appendItem(e[o]);t.addClass(i,this._getErrorLevelHtmlClass(e[o].getLevel()))}},_getErrorLevelHtmlClass:function(e){var t=Kekule.ErrorLevel;return e===t.LOG||e===t.NOTE?o.MSG_INFO:e===t.WARNING?o.MSG_WARNING:o.MSG_ERROR}}),Kekule.Editor.IssueInspector=Class.create(Kekule.Widget.BaseWidget,{CLASS_NAME:"Kekule.Editor.IssueInspector",initialize:function(e){this._reactExecutorExecuteBind=this._reactExecutorExecute.bind(this),this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("issueCheckExecutor",{dataType:"Kekule.IssueCheck.Executor",serializable:!1,setter:function(e){var t=this.getIssueCheckExecutor();e!==t&&(this.setPropStoreFieldValue("issueCheckExecutor",e),this._issueCheckExecutorChanged(t,e))}}),this.defineProp("rootObj",{dataType:"Kekule.ChemObject",serializable:!1}),this.defineProp("checkResults",{dataType:DataType.ARRAY,serializable:!1,getter:function(){return this.getResultListView().getCheckResults()},setter:function(e){this.getResultListView().setCheckResults(e)}}),this.defineProp("selectedResult",{dataType:"Kekule.IssueCheck.CheckResult",serializable:!1,setter:null,getter:function(){return this.getResultListView().getSelectedResult()}}),this.defineProp("resultListView",{dataType:"Kekule.ChemWidget.CheckResultListView",serializable:!1,setter:null,scope:Class.PropertyScope.PRIVATE})},doFinalize:function(){this._finalizeChildWidgets(),this.tryApplySuper("doFinalize")},_finalizeChildWidgets:function(){var e=this.getResultListView();e&&e.finalize(),this.setPropStoreFieldValue("resultListView",null)},_isUsingFlexLayout:function(){return!!Kekule.BrowserFeature.cssFlex},doGetWidgetClassName:function(){var e=r.ISSUE_INSPECTOR;return this._isUsingFlexLayout()&&(e+=" "+r.ISSUE_INSPECTOR_FLEX_LAYOUT),e},getChildrenHolderElement:function(){return this._listPanelElem||this.tryApplySuper("getChildrenHolderElement")},doCreateRootElement:function(e){return e.createElement("div")},doCreateSubElements:function(e,o){var i=this.tryApplySuper("doCreateSubElements",[e,o])||[],n=this._createSubPartElem(e);return t.addClass(n,r.ISSUE_INSPECTOR_LIST_PANEL),this._listPanelElem=n,o.appendChild(n),i.push(n),this._createChildWidgets(),i},_createSubPartElem:function(e){var t=e.createElement("div");return t.className=r.ISSUE_INSPECTOR_SUBPART,t},_createChildWidgets:function(){this._finalizeChildWidgets();var e=new Kekule.ChemWidget.CheckResultListView(this);e.setUseCornerDecoration(!0),e.appendToElem(this._listPanelElem);var t=this;e.addEventListener("selectionChange",function(o){if(o.target===e){var r,i=o.selectedItem;i&&(r=e.getItemData(i).checkResult),t.invokeEvent("selectResult",{selectedResult:r})}}),this.setPropStoreFieldValue("resultListView",e)},_issueCheckExecutorChanged:function(e,t){e&&e.removeEventListener("execute",this._reactExecutorExecuteBind),t&&t.addEventListener("execute",this._reactExecutorExecuteBind)},_reactExecutorExecute:function(e){this.setCheckResults(e.checkResults)},deselect:function(){this.getResultListView().clearSelection()}})}(),function(){"use strict";var e=Kekule.PropertyEditor.EditorAttributes;Kekule.PropertyEditor.ChemIdEditor=Class.create(Kekule.PropertyEditor.SimpleEditor,{CLASS_NAME:"Kekule.PropertyEditor.ChemIdEditor",getAttributes:function(){var t=this.tryApplySuper("getAttributes");return t&e.MULTIOBJS&&(t^=e.MULTIOBJS),t}}),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemIdEditor,null,Kekule.ChemObject,"id"),Kekule.PropertyEditor.ChemCoordSizeFieldEditor=Class.create(Kekule.PropertyEditor.SimpleEditor,{CLASS_NAME:"Kekule.PropertyEditor.ChemCoordSizeFieldEditor",initProperties:function(){this.defineProp("parentObjects",{dataType:DataType.Object,serializable:!1}),this.defineProp("parentPropName",{dataType:DataType.STRING,serializable:!1})},getCoordFieldValue:function(e,t,o){if(e.length){var r=e[0].getPropValue(t);if(r){for(var i=r[o],n=1,a=e.length;n<a;++n){if(e[n].getPropValue(t)[o]!==i)return}return i}}},getValue:function(){var e=this.getParentObjects(),t=this.getParentPropName();return e&&t?this.getCoordFieldValue(e,t,this.getPropertyName()):this.tryApplySuper("getValue")}}),Kekule.PropertyEditor.ChemCoordEditor=Class.create(Kekule.PropertyEditor.ObjectEditor,{CLASS_NAME:"Kekule.PropertyEditor.ChemCoordEditor",is3DCoord:function(){return this.getPropertyName().indexOf("3")>=0},getFieldEditorClass:function(e,t){return Kekule.PropertyEditor.ChemCoordSizeFieldEditor},createFieldEditor:function(e,t){var o=this.tryApplySuper("createFieldEditor",[e,t]);return o.setParentObjects&&o.setParentObjects(this.getObjects()),o.setParentPropName&&o.setParentPropName(this.getPropertyName()),o},getFieldValueType:function(e,t){return DataType.FLOAT},getObjFields:function(e){return this.is3DCoord()?["x","y","z"]:["x","y"]},getValueText:function(){var e=Kekule.Widget.ValueListEditor.ValueDisplayMode;if(this.getValueTextMode()===e.JSON)return this.tryApplySuper("getValueText");var t=this.getValue();if(t){for(var o=this.getObjFields(),r="",i=0,n=o.length;i<n;++i){var a=t[o[i]];Kekule.ObjUtils.notUnset(a)&&(r&&(r+=", "),r+=o[i]+": "+a)}return"{"+r+"}"}return""}}),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemCoordEditor,null,Kekule.ChemObject,"coord2D"),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemCoordEditor,null,Kekule.ChemObject,"coord3D"),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemCoordEditor,null,Kekule.ChemObject,"absCoord2D"),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemCoordEditor,null,Kekule.ChemObject,"absCoord3D"),Kekule.PropertyEditor.ChemSizeEditor=Class.create(Kekule.PropertyEditor.ObjectEditor,{CLASS_NAME:"Kekule.PropertyEditor.ChemSizeEditor",is3DSize:function(){return this.getPropertyName().indexOf("3")>=0},getFieldEditorClass:function(e,t){return Kekule.PropertyEditor.ChemCoordSizeFieldEditor},createFieldEditor:function(e,t){var o=this.tryApplySuper("createFieldEditor",[e,t]);return o.setParentObjects&&o.setParentObjects(this.getObjects()),o.setParentPropName&&o.setParentPropName(this.getPropertyName()),o},getFieldValueType:function(e,t){return DataType.FLOAT},getObjFields:function(e){return this.is3DSize()?["x","y","z"]:["x","y"]},getValueText:function(){var e=Kekule.Widget.ValueListEditor.ValueDisplayMode;if(this.getValueTextMode()===e.JSON)return this.tryApplySuper("getValueText");var t=this.getValue();if(t){for(var o=this.getObjFields(),r="",i=0,n=o.length;i<n;++i){var a=t[o[i]];Kekule.ObjUtils.notUnset(a)&&(r&&(r+=", "),r+=o[i]+": "+a)}return"{"+r+"}"}return""}}),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemSizeEditor,null,Kekule.ChemObject,"size2D"),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemSizeEditor,null,Kekule.ChemObject,"size3D"),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemSizeEditor,null,Kekule.ChemObject,"screenSize"),Kekule.PropertyEditor.ChemOptionObjectEditor=Class.create(Kekule.PropertyEditor.ObjectEditor,{CLASS_NAME:"Kekule.PropertyEditor.ChemOptionObjectEditor",CHILD_FIELD_INFOS:null,initialize:function(){this.tryApplySuper("initialize"),this.setAllowEmpty(!0)},getObjFieldInfos:function(e){for(var t=ClassEx.getCommonSuperClass(this.getObjects()),o=[],r=this.CHILD_FIELD_INFOS,i=0,n=r.length;i<n;++i){var a=r[i];a.targetClass&&t&&!ClassEx.isOrIsDescendantOf(t,a.targetClass)||o.push(a)}return o.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0}),o},notifyChildEditorValueChange:function(e,t){var o=this.getValue()||this._initialObjValue;o=Object.extend({},o),Kekule.ObjUtils.notUnset(t)?o[e]=t:delete o[e],this.setValue(o)}}),Kekule.PropertyEditor.ChemRender2DOptionsEditor=Class.create(Kekule.PropertyEditor.ChemOptionObjectEditor,{CLASS_NAME:"Kekule.PropertyEditor.ChemRender2DOptionsEditor",CHILD_FIELD_INFOS:Kekule.Render.RenderOptionUtils.getOptionDefinitions()}),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemRender2DOptionsEditor,null,Kekule.ChemObject,"renderOptions"),Kekule.PropertyEditor.ChemRender3DOptionsEditor=Class.create(Kekule.PropertyEditor.ChemOptionObjectEditor,{CLASS_NAME:"Kekule.PropertyEditor.ChemRender3DOptionsEditor",CHILD_FIELD_INFOS:Kekule.Render.Render3DOptionUtils.getOptionDefinitions()}),Kekule.PropertyEditor.register(Kekule.PropertyEditor.ChemRender3DOptionsEditor,null,Kekule.ChemObject,"render3DOptions"),Kekule.PropertyEditor.GlyphPathParamsEditor=Class.create(Kekule.PropertyEditor.ChemOptionObjectEditor,{CLASS_NAME:"Kekule.PropertyEditor.GlyphPathParamsEditor",CHILD_FIELD_INFOS:[{name:"lineCount",dataType:DataType.INT,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"lineGap",dataType:DataType.FLOAT,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"startArrowType",dataType:DataType.STRING,enumSource:Kekule.Glyph.ArrowType,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"startArrowSide",dataType:DataType.INT,enumSource:Kekule.Glyph.ArrowSide,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"startArrowLength",dataType:DataType.FLOAT,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"startArrowWidth",dataType:DataType.FLOAT,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"endArrowType",dataType:DataType.INT,enumSource:Kekule.Glyph.ArrowType,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"endArrowSide",dataType:DataType.INT,enumSource:Kekule.Glyph.ArrowSide,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"endArrowLength",dataType:DataType.FLOAT,targetClass:Kekule.Glyph.PathGlyphConnector},{name:"endArrowWidth",dataType:DataType.FLOAT,targetClass:Kekule.Glyph.PathGlyphConnector}]}),Kekule.PropertyEditor.register(Kekule.PropertyEditor.GlyphPathParamsEditor,null,Kekule.Glyph.PathGlyphConnector,"pathParams"),Kekule.PropertyEditor.GlyphPathNodeParamsEditor=Class.create(Kekule.PropertyEditor.ChemOptionObjectEditor,{CLASS_NAME:"Kekule.PropertyEditor.GlyphPathNodeParamsEditor",CHILD_FIELD_INFOS:[{name:"useStickingOffset",dataType:DataType.BOOL,targetClass:Kekule.Glyph.PathGlyphNode},{name:"stickingOffsetRelLength",dataType:DataType.FLOAT,targetClass:Kekule.Glyph.PathGlyphNode}]}),Kekule.PropertyEditor.register(Kekule.PropertyEditor.GlyphPathNodeParamsEditor,null,Kekule.Glyph.PathGlyphNode,"pathNodeParams")}(),function(){Class.PropertyScope;var e=Kekule.ArrayUtils,t=(Kekule.ChemWidget,Kekule.Editor,Kekule.Widget.HtmlClassNames),o=Kekule.ChemWidget.HtmlClassNames,r=Kekule.ChemWidget.ComponentWidgetNames;Kekule.ChemWidget.HtmlClassNames=Object.extend(Kekule.ChemWidget.HtmlClassNames,{COMPOSER:"K-Chem-Composer",COMPOSER_GRID_LAYOUT:"K-Chem-Composer-Grid-Layout",COMPOSER_LANDSCAPE:"K-Chem-Composer-Landscape",COMPOSER_PORTRAIT:"K-Chem-Composer-Portrait",COMPOSER_EDITOR_STAGE:"K-Chem-Composer-Editor-Stage",COMPOSER_ADV_PANEL:"K-Chem-Composer-Adv-Panel",COMPOSER_ISSUE_PANEL:"K-Chem-Composer-Issue-Panel",COMPOSER_ISSUE_PANEL_WRAPPER:"K-Chem-Composer-Issue-Panel-Wrapper",COMPOSER_ISSUE_PANEL_TOOL_PANEL:"K-Chem-Composer-Issue-Panel-ToolPanel",COMPOSER_ISSUE_PANEL_INSPECTOR_REGION:"K-Chem-Composer-Issue-Panel-InspectorRegion",COMPOSER_TOP_REGION:"K-Chem-Composer-Top-Region",COMPOSER_LEFT_REGION:"K-Chem-Composer-Left-Region",COMPOSER_BOTTOM_REGION:"K-Chem-Composer-Bottom-Region",COMPOSER_TOOLBAR:"K-Chem-Composer-Toolbar",COMPOSER_COMMON_TOOLBAR:"K-Chem-Composer-Common-Toolbar",COMPOSER_ZOOM_TOOLBAR:"K-Chem-Composer-Zoom-Toolbar",COMPOSER_CHEM_TOOLBAR:"K-Chem-Composer-Chem-Toolbar",COMPOSER_ASSOC_TOOLBAR:"K-Chem-Composer-Assoc-Toolbar",COMPOSER_STYLE_TOOLBAR:"K-Chem-Composer-Style-Toolbar",COMPOSER_OBJMODIFIER_TOOLBAR:"K-Chem-Composer-ObjModifier-Toolbar",COMPOSER_FONTNAME_BOX:"K-Chem-Composer-FontName-Box",COMPOSER_FONTSIZE_BOX:"K-Chem-Composer-FontSize-Box",COMPOSER_NODEDISPLAYMODE_BOX:"K-Chem-Composer-NodeDisplayMode-Box",COMPOSER_COLOR_BOX:"K-Chem-Composer-Color-Box",COMPOSER_TEXTDIRECTION_BUTTON:"K-Chem-Composer-TextDirection-Button",COMPOSER_TEXTDIRECTION_BUTTON_DEFAULT:"K-Chem-Composer-TextDirection-Button-Default",COMPOSER_TEXTDIRECTION_BUTTON_LTR:"K-Chem-Composer-TextDirection-Button-LTR",COMPOSER_TEXTDIRECTION_BUTTON_RTL:"K-Chem-Composer-TextDirection-Button-RTL",COMPOSER_TEXTDIRECTION_BUTTON_TTB:"K-Chem-Composer-TextDirection-Button-TTB",COMPOSER_TEXTDIRECTION_BUTTON_BTT:"K-Chem-Composer-TextDirection-Button-BTT",COMPOSER_TEXTALIGN_BUTTON:"K-Chem-Composer-TextAlign-Button",COMPOSER_TEXTALIGN_BUTTON_HORIZONTAL:"K-Chem-Composer-TextAlign-Button-Horizontal",COMPOSER_TEXTALIGN_BUTTON_VERTICAL:"K-Chem-Composer-TextAlign-Button-Vertical",COMPOSER_TEXTALIGN_BUTTON_DEFAULT:"K-Chem-Composer-TextAlign-Button",COMPOSER_TEXTALIGN_BUTTON_LEADING:"K-Chem-Composer-TextAlign-Button-Leading",COMPOSER_TEXTALIGN_BUTTON_TRAILING:"K-Chem-Composer-TextAlign-Button-Trailing",COMPOSER_TEXTALIGN_BUTTON_CENTER:"K-Chem-Composer-TextAlign-Button-Center",COMPOSER_TEXTALIGN_BUTTON_LEFT:"K-Chem-Composer-TextAlign-Button-Left",COMPOSER_TEXTALIGN_BUTTON_RIGHT:"K-Chem-Composer-TextAlign-Right",COMPOSER_TEXTALIGN_BUTTON_TOP:"K-Chem-Composer-TextAlign-Top",COMPOSER_TEXTALIGN_BUTTON_BOTTOM:"K-Chem-Composer-TextAlign-Bottom",COMPOSER_DIALOG:"K-Chem-ComposerDialog",COMPOSER_FRAME:"K-Chem-ComposerFrame",COMPOSER_FRAME_CONTENT_DOC:"K-Chem-ComposerFrame-ContentDoc",COMPOSER_FRAME_CONTENT_BODY:"K-Chem-ComposerFrame-ContentBody"}),Kekule.globalOptions.add("chemWidget.composer",{commonToolButtons:[r.newDoc,r.loadData,r.saveData,r.undo,r.redo,r.copy,r.cut,r.paste,r.zoomIn,r.zoomOut,r.config,r.objInspector],chemToolButtons:[r.manipulate,r.erase,r.molBond,r.molAtomAndFormula,r.molRing,r.molCharge,r.glyph,r.textImage],styleToolComponentNames:[r.fontName,r.fontSize,r.color,r.textDirection,r.textAlign]}),Kekule.Editor.ComposerStyleToolbar=Class.create(Kekule.Widget.Toolbar,{CLASS_NAME:"Kekule.Editor.ComposerStyleToolbar",ATOM_COLOR_SPECIAL_VALUE_INFO:{text:Kekule.$L("ChemWidgetTexts.HINT_USE_ATOM_CUSTOM_COLOR"),value:"Atom",className:t.COLORPICKER_SPEC_COLOR_MIXED},LINKED_VALUE_FIELD:"__$value__",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setPropStoreFieldValue("composer",e),this.createChildWidgets(),this.appendToWidget(e),this._relatedPropNames=e.getCoordMode()===Kekule.CoordMode.COORD3D?["renderOptions","render3DOptions"]:["renderOptions"],this.getEditor().addEventListener("selectionChange",function(e){this._isApplying||this.updateStyleValues()},this),this.getEditor().addEventListener("editObjChanged",function(e){var t=e.propNames;t&&t.length&&Kekule.ArrayUtils.intersect(this._relatedPropNames,t).length&&(this._isApplying||this.updateStyleValues())},this),this._isApplying=!1},doFinalize:function(){this.clearWidgets(),this.tryApplySuper("doFinalize")},initProperties:function(){this.defineProp("composer",{dataType:"Kekule.Editor.Composer",serializable:!1,setter:null}),this.defineProp("fontNameBox",{dataType:"Kekule.Widget.ComboBox",serializable:!1,setter:null}),this.defineProp("fontSizeBox",{dataType:"Kekule.Widget.ComboBox",serializable:!1,setter:null}),this.defineProp("colorBox",{dataType:"Kekule.Widget.ColorDropButton",serializable:!1,setter:null}),this.defineProp("textDirectionButtonSet",{dataType:"Kekule.Widget.CompactButtonSet",serializable:!1,setter:null}),this.defineProp("textHorizontalAlignButtonSet",{dataType:"Kekule.Widget.CompactButtonSet",serializable:!1,setter:null}),this.defineProp("textVerticalAlignButtonSet",{dataType:"Kekule.Widget.CompactButtonSet",serializable:!1,setter:null}),this.defineProp("fontName",{dataType:DataType.STRING,serializable:!1,getter:function(){return this.getFontNameBox()?this.getFontNameBox().getValue():null},setter:function(e){this.getFontNameBox()&&this.getFontNameBox().setValue(e)}}),this.defineProp("fontSize",{dataType:DataType.NUMBER,serializable:!1,getter:function(){return this.getFontSizeBox()?parseFloat(this.getFontSizeBox().getValue()):null},setter:function(e){this.getFontSizeBox()&&this.getFontSizeBox().setValue(e)}}),this.defineProp("color",{dataType:DataType.STRING,serializable:!1,getter:function(){return this.getColorBox()?this.getColorBox().getValue():void 0},setter:function(e){this.getColorBox()&&this.getColorBox().setValue(e)}}),this.defineProp("textDirection",{dataType:DataType.INT,serializable:!1,getter:function(){return this._getButtonSetLinkedValue(this.getTextDirectionButtonSet())},setter:function(e){this._setButtonSetLinkedValue(this.getTextDirectionButtonSet(),e)}}),this.defineProp("textHorizontalAlign",{dataType:DataType.INT,serializable:!1,getter:function(){return this._getButtonSetLinkedValue(this.getTextHorizontalAlignButtonSet())},setter:function(e){this._setButtonSetLinkedValue(this.getTextHorizontalAlignButtonSet(),e)}}),this.defineProp("textVerticalAlign",{dataType:DataType.INT,serializable:!1,getter:function(){return this._getButtonSetLinkedValue(this.getTextVerticalAlignButtonSet())},setter:function(e){this._setButtonSetLinkedValue(this.getTextVerticalAlignButtonSet(),e)}}),this.defineProp("componentNames",{dataType:DataType.ARRAY,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("componentNames");return e||(e=this.getDefaultComponentNames(),this.setPropStoreFieldValue("componentNames",e)),e},setter:function(e){this.setPropStoreFieldValue("componentNames",e),this.recreateComponents()}})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setShowGlyph(!0)},removeWidget:function(e,t){e===this.getFontNameBox()&&this.setPropStoreFieldValue("fontNameBox",null),e===this.getFontSizeBox()&&this.setPropStoreFieldValue("fontSizeBox",null),e===this.getColorBox()&&this.setPropStoreFieldValue("colorBox",null),e===this.getTextDirectionButtonSet()&&this.setPropStoreFieldValue("textDirectionButtonSet",null),e===this.getTextHorizontalAlignButtonSet()&&this.setPropStoreFieldValue("textHorizontalAlignButtonSet",null),e===this.getTextVerticalAlignButtonSet()&&this.setPropStoreFieldValue("textVerticalAlignButtonSet",null),this.tryApplySuper("removeWidget",[e,t])},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+o.COMPOSER_TOOLBAR+" "+o.COMPOSER_STYLE_TOOLBAR},getEditor:function(){return this.getComposer().getEditor()},getEditorConfigs:function(){return this.getEditor().getEditorConfigs()},createChildWidgets:function(e){e||(e=this.getComponentNames());for(var t=0,i=e.length;t<i;++t){var n=e[t];if(n===r.fontName){var a=new Kekule.Widget.ComboBox(this);this.fillFontNameBox(a),a.addClassName(o.COMPOSER_FONTNAME_BOX),a.setHint(Kekule.$L("ChemWidgetTexts.HINT_FONTNAME")),a.addEventListener("valueChange",function(e){this.applyFontName()},this),this.setPropStoreFieldValue("fontNameBox",a)}else if(n===r.fontSize)a=new Kekule.Widget.ComboBox(this),this.fillFontSizeBox(a),a.addClassName(o.COMPOSER_FONTSIZE_BOX),a.setHint(Kekule.$L("ChemWidgetTexts.HINT_FONTSIZE")),a.addEventListener("valueChange",function(e){this.applyFontSize()},this),this.setPropStoreFieldValue("fontSizeBox",a);else if(n===r.color){var l=new Kekule.Widget.ColorDropButton(this);l.setHint(Kekule.$L("ChemWidgetTexts.HINT_PICK_COLOR")),l.setShowText(!1),l.setSpecialColors([Kekule.Widget.ColorPicker.SpecialColors.UNSET,this.ATOM_COLOR_SPECIAL_VALUE_INFO]),l.addClassName(o.COMPOSER_COLOR_BOX),l.addEventListener("valueChange",function(e){this.applyColor()},this),this.setPropStoreFieldValue("colorBox",l)}else if(n===r.textDirection){var s=Kekule.Render.TextDirection,d=[{value:s.DEFAULT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_DEFAULT"),className:o.COMPOSER_TEXTDIRECTION_BUTTON_DEFAULT},{value:s.LTR,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_LTR"),className:o.COMPOSER_TEXTDIRECTION_BUTTON_LTR},{value:s.RTL,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_RTL"),className:o.COMPOSER_TEXTDIRECTION_BUTTON_RTL},{value:s.TTB,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_TTB"),className:o.COMPOSER_TEXTDIRECTION_BUTTON_TTB},{value:s.BTT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION_BTT"),className:o.COMPOSER_TEXTDIRECTION_BUTTON_BTT}];(c=this._createStyleButtonSet(Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_DIRECTION"),Kekule.$L("ChemWidgetTexts.HINT_TEXT_DIRECTION"),o.COMPOSER_TEXTDIRECTION_BUTTON,d)).addEventListener("select",function(e){this.applyTextDirection()},this),this.setPropStoreFieldValue("textDirectionButtonSet",c)}else if(n===r.textAlign){d=[{value:(u=Kekule.Render.TextAlign).DEFAULT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_DEFAULT"),className:o.COMPOSER_TEXTALIGN_BUTTON_DEFAULT},{value:u.LEADING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_LEADING"),className:o.COMPOSER_TEXTALIGN_BUTTON_LEADING},{value:u.TRAILING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_TRAILING"),className:o.COMPOSER_TEXTALIGN_BUTTON_TRAILING},{value:u.CENTER,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_CENTER"),className:o.COMPOSER_TEXTALIGN_BUTTON_CENTER},{value:u.LEFT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_LEFT"),className:o.COMPOSER_TEXTALIGN_BUTTON_LEFT},{value:u.RIGHT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_RIGHT"),className:o.COMPOSER_TEXTALIGN_BUTTON_RIGHT}];(c=this._createStyleButtonSet(Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_HORIZONTAL_ALIGN"),Kekule.$L("ChemWidgetTexts.HINT_TEXT_HORIZONTAL_ALIGN"),o.COMPOSER_TEXTALIGN_BUTTON_HORIZONTAL,d)).addEventListener("select",function(e){this.applyTextHorizontalAlign()},this),this.setPropStoreFieldValue("textHorizontalAlignButtonSet",c);var u,c;d=[{value:(u=Kekule.Render.TextAlign).DEFAULT,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_DEFAULT"),className:o.COMPOSER_TEXTALIGN_BUTTON_DEFAULT},{value:u.LEADING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_LEADING"),className:o.COMPOSER_TEXTALIGN_BUTTON_LEADING},{value:u.TRAILING,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_TRAILING"),className:o.COMPOSER_TEXTALIGN_BUTTON_TRAILING},{value:u.CENTER,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_CENTER"),className:o.COMPOSER_TEXTALIGN_BUTTON_CENTER},{value:u.TOP,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_TOP"),className:o.COMPOSER_TEXTALIGN_BUTTON_TOP},{value:u.BOTTOM,text:Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_ALIGN_BOTTOM"),className:o.COMPOSER_TEXTALIGN_BUTTON_BOTTOM}];(c=this._createStyleButtonSet(Kekule.$L("ChemWidgetTexts.CAPTION_TEXT_VERTICAL_ALIGN"),Kekule.$L("ChemWidgetTexts.HINT_TEXT_VERTICAL_ALIGN"),o.COMPOSER_TEXTALIGN_BUTTON_VERTICAL,d)).addEventListener("select",function(e){this.applyTextVerticalAlign()},this),this.setPropStoreFieldValue("textVerticalAlignButtonSet",c)}}this.updateStyleValues()},_createStyleButtonSet:function(e,t,r,i){var n=new Kekule.Widget.CompactButtonSet(this);if(n.setText(e),n.setHint(t),n.addClassName(r),n.setShowText(!1),n.setShowCompactMark(!1),n.setButtonKind(Kekule.Widget.Button.Kinds.DROPDOWN),n.getButtonSet().addClassName(o.COMPOSER_STYLE_TOOLBAR),n.getButtonSet().setShowText(!0),i)for(var a=0,l=i.length;a<l;++a){var s=i[a],d=new Kekule.Widget.RadioButton(n,s.text||"");d.setHint(s.hint||""),d.addClassName(s.className),d[this.LINKED_VALUE_FIELD]=s.value,n.append(d,s.selected)}return n},_getButtonSetLinkedValue:function(e){var t=e?e.getSelected():null;return t?t[this.LINKED_VALUE_FIELD]:void 0},_setButtonSetLinkedValue:function(e,t){if(e){var o=e.getButtonSet().getChildWidgets();e.setSelected(null);for(var r=0,i=o.length;r<i;++r){var n=o[r];if(n.hasOwnProperty(this.LINKED_VALUE_FIELD)&&n[this.LINKED_VALUE_FIELD]==t){e.setSelected(n);break}}}},getDefaultComponentNames:function(){return Kekule.globalOptions.chemWidget.composer.styleToolComponentNames},recreateComponents:function(){var e=this.getComponentNames();this.clearWidgets(),this.createChildWidgets(e)},fillFontSizeBox:function(e){for(var t=this.getEditorConfigs().getStyleSetterConfigs().getListedFontSizes(),o=[{text:Kekule.$L("ChemWidgetTexts.S_VALUE_DEFAULT"),value:void 0}],r=0,i=t.length;r<i;++r)o.push({text:t[r]+" px",value:t[r]});e.setItems(o)},fillFontNameBox:function(e){for(var t=this.getEditorConfigs().getStyleSetterConfigs().getListedFontNames(),o=[{text:Kekule.$L("ChemWidgetTexts.S_VALUE_DEFAULT"),value:""}],r=0,i=t.length;r<i;++r)o.push({text:t[r],value:t[r]});e.setItems(o)},applyStyle:function(e,t,o){this._isApplying=!0;try{this.getEditor().modifyObjectsRenderOptions(e,t,o,!0)}finally{this._isApplying=!1}},getStyleValue:function(e,t,o){return Kekule.Render.RenderOptionUtils.getCascadeRenderOptionValueOfObjs(e,t,o)},applyStyleToEditorSelection:function(e,t){var o=this.getEditor().getSelection();if(o&&o.length)return this.applyStyle(o,e,t)},applyFontName:function(e){if(e||(e=this.getEditor().getSelection()),e&&e.length){var t=this.getFontName();this.applyStyle(e,{fontFamily:t})}},applyFontSize:function(e){if(e||(e=this.getEditor().getSelection()),e&&e.length){var t=this.getFontSize();this.applyStyle(e,{fontSize:t})}},applyColor:function(e){if(e||(e=this.getEditor().getSelection()),e&&e.length){var t=this.getColor();t===this.ATOM_COLOR_SPECIAL_VALUE_INFO.value?this.applyStyle(e,{useAtomSpecifiedColor:!0,color:void 0}):(t==Kekule.Widget.ColorPicker.SpecialColors.UNSET&&(t=void 0),this.applyStyle(e,{useAtomSpecifiedColor:!1,color:t}))}},applyTextDirection:function(e){if(e||(e=this.getEditor().getSelection()),e&&e.length){var t=this.getTextDirection();this.applyStyle(e,{charDirection:t})}},applyTextHorizontalAlign:function(e){if(e||(e=this.getEditor().getSelection()),e&&e.length){var t=this.getTextHorizontalAlign();this.applyStyle(e,{horizontalAlign:t})}},applyTextVerticalAlign:function(e){if(e||(e=this.getEditor().getSelection()),e&&e.length){var t=this.getTextVerticalAlign();this.applyStyle(e,{verticalAlign:t})}},updateStyleValues:function(e){e||(e=this.getEditor().getSelection()),e&&e.length&&(this.updateFontName(e),this.updateFontSize(e),this.updateColor(e),this.updateTextDirection(e),this.updateTextHorizontalAlign(e),this.updateTextVerticalAlign(e))},updateFontName:function(e){if(e&&e.length&&this.getFontNameBox()){var t=this.getStyleValue(e,"fontFamily");this.setFontName(t||"")}},updateFontSize:function(e){if(e&&e.length&&this.getFontSizeBox()){var t=this.getStyleValue(e,"fontSize");this.setFontSize(t||void 0)}},updateColor:function(e){if(e&&e.length&&this.getColorBox()){var t=this.getStyleValue(e,"useAtomSpecifiedColor"),o=this.getStyleValue(e,"color");this.getColorBox().setColorClassName(null),o?this.getColorBox().setColorClassName(null):t&&(o=this.ATOM_COLOR_SPECIAL_VALUE_INFO.value,this.getColorBox().setColorClassName(this.ATOM_COLOR_SPECIAL_VALUE_INFO.className)),this.setColor(o||void 0)}},updateTextDirection:function(e){if(e&&e.length&&this.getTextDirectionButtonSet()){var t=this.getStyleValue(e,"charDirection");this.setTextDirection(t)}},updateTextHorizontalAlign:function(e){if(e&&e.length&&this.getTextHorizontalAlignButtonSet()){var t=this.getStyleValue(e,"horizontalAlign");this.setTextHorizontalAlign(t)}},updateTextVerticalAlign:function(e){if(e&&e.length&&this.getTextVerticalAlignButtonSet()){var t=this.getStyleValue(e,"verticalAlign");this.setTextVerticalAlign(t)}},updateState:function(){var e=this.getEditor(),t=e&&e.hasSelection();this.getFontNameBox()&&this.getFontNameBox().setEnabled(t),this.getFontSizeBox()&&this.getFontSizeBox().setEnabled(t),this.getColorBox()&&this.getColorBox().setEnabled(t),this.getTextDirectionButtonSet()&&this.getTextDirectionButtonSet().setEnabled(t),this.getTextHorizontalAlignButtonSet()&&this.getTextHorizontalAlignButtonSet().setEnabled(t),this.getTextVerticalAlignButtonSet()&&this.getTextVerticalAlignButtonSet().setEnabled(t)}}),Kekule.Editor.ComposerObjModifierToolbar=Class.create(Kekule.Widget.Toolbar,{CLASS_NAME:"Kekule.Editor.ComposerObjModifierToolbar",initialize:function(e){this.tryApplySuper("initialize",[e]),this.setPropStoreFieldValue("modifiers",[]),this.setPropStoreFieldValue("modifierMap",new Kekule.MapEx),this.setPropStoreFieldValue("composer",e),this.appendToWidget(e),e.addEventListener("selectionChange",function(e){this._isApplying||this.updateModifierValues()},this),e.addEventListener("selectedObjsUpdated",function(t){this._isApplying||(e.getEditor().isManipulatingObject()?this._suppressUpdateModifierValuesInManipulation=!0:this.updateModifierValues())},this),e.addEventListener("endManipulateObject",function(e){this._suppressUpdateModifierValuesInManipulation&&(this.updateModifierValues(),this._suppressUpdateModifierValuesInManipulation=!1)},this),this._isApplying=!1},initProperties:function(){this.defineProp("composer",{dataType:"Kekule.Editor.Composer",serializable:!1,setter:null}),this.defineProp("modifierMap",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("modifiers",{dataType:DataType.ARRAY,serializable:!1,setter:null})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setShowGlyph(!0)},doFinalize:function(){this.clearWidgets(),this.getModifierMap().finalize();for(var e=this.getModifiers(),t=0,o=e.length;t<o;++t)e[t].finalize();this.tryApplySuper("doFinalize")},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+o.COMPOSER_TOOLBAR+" "+o.COMPOSER_OBJMODIFIER_TOOLBAR},getEditor:function(){return this.getComposer().getEditor()},getEditorConfigs:function(){return this.getEditor().getEditorConfigs()},getAllowedModifierCategories:function(){var e=this.getComposer();return e&&e.getAllowedObjModifierCategories()},getTargetObjs:function(){return this.getEditor().getSelection()},getAvailableModifierClasses:function(){for(var t=[],o=this.getTargetObjs(),r=0,i=o.length;r<i;++r)o[r].getClass&&e.pushUnique(t,o[r].getClass());var n=[],a=this.getAllowedModifierCategories();for(r=0,i=t.length;r<i;++r){var l=Kekule.Editor.ObjModifierManager.getModifierClasses(t[r],a);l&&e.pushUnique(n,l)}return n.length&&n.sort(function(e,t){var o=e&&ClassEx.getPrototype(e),r=t&&ClassEx.getPrototype(t),i=o&&o.getModifierName&&o.getModifierName(),n=r&&r.getModifierName&&r.getModifierName();return i===n?0:i<n?-1:1}),n},getModifierInstanceOfClass:function(e,t){var o=this.getModifierMap(),r=o.get(e);return!r&&t&&(r=new e(this.getEditor()),o.set(e,r)),r},updateModifierWidgets:function(){var e=[];this.clearWidgets(!0);for(var o=this.getAvailableModifierClasses(),r=0,i=o.length;r<i;++r){var n=o[r],a=this.getModifierInstanceOfClass(n,!0),l=a.getWidget();l&&(this.appendWidget(l),e.push(a))}this.setPropStoreFieldValue("modifiers",e),this.updateModifierValues(),this._isAllModifierWidgetButtons(e)?this.removeClassName(t.TOOLBAR).addClassName(t.BUTTON_GROUP):this.removeClassName(t.BUTTON_GROUP).addClassName(t.TOOLBAR)},updateState:function(){this.updateModifierWidgets()},updateModifierValues:function(){for(var e=this.getModifiers(),t=0,o=e.length;t<o;++t)e[t].loadFromTargets()},_isAllModifierWidgetButtons:function(e){for(var t=0,o=e.length;t<o;++t){var r=e[t],i=r&&r.getWidget();if(i&&i.getDisplayed()&&!(i instanceof Kekule.Widget.Button))return!1}return!0}}),Kekule.Editor.Composer=Class.create(Kekule.ChemWidget.AbstractWidget,{CLASS_NAME:"Kekule.Editor.Composer",BINDABLE_TAG_NAMES:["div"],CHEM_TOOL_CHILD_FIELDS:"__$children__",initialize:function(e,t){this.updateSelectionAssocToolbarStateBind=this.updateSelectionAssocToolbarState.bind(this),this.setPropStoreFieldValue("enableStyleToolbar",!0),this.setPropStoreFieldValue("enableObjModifierToolbar",!0),this.setPropStoreFieldValue("editor",t),this.setPropStoreFieldValue("editorNexus",new Kekule.Editor.EditorNexus),this.tryApplySuper("initialize",[e]),this.bindEditor(t);var o=this.getEditor();o&&o.setChemObj(o.getChemObj()),this.getCommonBtnGroup()||this.createCommonToolbar(),this.getChemBtnGroup()||this.createChemToolbar(),this.getZoomBtnGroup()||this.createZoomToolbar(),this.uiLayoutChanged()},doFinalize:function(){var e=this.getIssueInspector();e&&e.finalize();var t=this.getStructureTreeView();t&&t.finalize();var o,r=this.getObjInspector();r&&r.finalize(),(o=this.getCommonBtnGroup())&&o.finalize(),(o=this.getChemBtnGroup())&&o.finalize();var i=this.getPropStoreFieldValue("editor");i&&i.finalize(),this.getEditorNexus().finalize(),this.tryApplySuper("doFinalize")},initProperties:function(){this.defineProp("editor",{dataType:"Kekule.Editor.BaseEditor",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("editor");return e||(e=this.createDefaultEditor(),this.setPropStoreFieldValue("editor",e)),e}}),this.defineProp("autoSetMinDimension",{dataType:DataType.BOOL}),this.defineProp("showObjInspector",{dataType:DataType.BOOL,getter:function(){return(this.getAdvPanelDisplayedComponents()||[]).indexOf("objInspector")>=0},setter:function(t){if(this.getShowObjInspector()!==t){var o=this.getAdvPanelDisplayedComponents()||[];o=t?["objInspector"]:e.exclude(o,"objInspector"),this.setAdvPanelDisplayedComponents(o)}}}),this.defineProp("showIssueInspector",{dataType:DataType.BOOL,serializable:!1,getter:function(){return(this.getAdvPanelDisplayedComponents()||[]).indexOf("issueInspector")>=0},setter:function(t){if(this.getShowIssueInspector()!==t){var o=this.getAdvPanelDisplayedComponents()||[];if(o=t?["issueInspector"]:e.exclude(o,"issueInspector"),this.setAdvPanelDisplayedComponents(o),t){var r=this.getEditor();r&&(r.getEnableAutoIssueCheck()||r.checkIssues(),r.getIssueCheckResults()&&r.getIssueCheckResults().length&&r.deselectAll())}else{this.getIssueInspector().deselect()}}}}),this.defineProp("showInspector",{dataType:DataType.BOOL,getter:function(){return this.getShowObjInspector()},setter:function(e){this.setShowObjInspector(e)}}),this.defineProp("advPanelDisplayedComponents",{dataType:DataType.ARRAY,serializable:!1,setter:function(e){this.setPropStoreFieldValue("advPanelDisplayedComponents",e),this.updateAdvPanelDisplayedComponents(e)}}),this.defineProp("editorStageElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("advPanelElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("objInspectorHolderElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("issueInspectorHolderElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("topRegionElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("leftRegionElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("bottomRegionElem",{dataType:DataType.OBJECT,serializable:!1,setter:null}),this.defineProp("editorNexus",{dataType:"Kekule.Editor.EditorNexus",serializable:!1,setter:null}),this.defineProp("objInspector",{dataType:"Kekule.Widget.ObjectInspector",serializable:!1,setter:null}),this.defineProp("structureTreeView",{dataType:"Kekule.ChemWidget.StructureTreeView",serializable:!1,setter:null}),this.defineProp("issueInspector",{dataType:"Kekule.Editor.IssueInspector",serializable:!1,setter:null}),this.defineProp("commonBtnGroup",{dataType:"Kekule.Widget.ButtonGroup",serializable:!1}),this.defineProp("zoomBtnGroup",{dataType:"Kekule.Widget.ButtonGroup",serializable:!1}),this.defineProp("chemBtnGroup",{dataType:"Kekule.Widget.ButtonGroup",serializable:!1}),this.defineProp("assocBtnGroup",{dataType:"Kekule.Widget.ButtonGroup",serializable:!1}),this.defineProp("styleToolbar",{dataType:"Kekule.Widget.Toolbar",serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("styleToolbar");return e||this.getEnableStyleToolbar()&&(e=this.createStyleToolbar(),this.setPropStoreFieldValue("styleToolbar",e)),e}}),this.defineProp("styleToolComponentNames",{dataType:DataType.ARRAY,serializable:!1,getter:function(){var e=this.getStyleToolbar();return e?e.getComponentNames():null},setter:function(e){var t=this.getStyleToolbar();return t&&t.setComponentNames(e),this}}),this.defineProp("enableStyleToolbar",{dataType:DataType.BOOL,getter:function(){return this.getPropStoreFieldValue("enableStyleToolbar")&&!this.getEnableObjModifierToolbar()},setter:function(e){this.setPropStoreFieldValue("enableStyleToolbar",e),e&&this.setPropStoreFieldValue("enableObjModifierToolbar",!1),this.updateSelectionAssocToolbarState()}}),this.defineProp("objModifierToolbar",{dataType:"Kekule.Widget.Toolbar",serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("objModifierToolbar");return e||this.getEnableObjModifierToolbar()&&(e=this.createObjModifierToolbar(),this.setPropStoreFieldValue("objModifierToolbar",e)),e}}),this.defineProp("enableObjModifierToolbar",{dataType:DataType.BOOL,setter:function(e){this.setPropStoreFieldValue("enableObjModifierToolbar",e),e&&this.setPropStoreFieldValue("enableStyleToolbar",!1),this.updateSelectionAssocToolbarState()}}),this.defineProp("allowedObjModifierCategories",{dataType:DataType.ARRAY,setter:function(e){this.setPropStoreFieldValue("allowedObjModifierCategories",e),this.updateObjModifierToolbarState()}}),this.defineProp("commonToolButtons",{dataType:DataType.HASH,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("commonToolButtons");return e||(e=this.getDefaultCommonToolBarButtons(),this.setPropStoreFieldValue("commonToolButtons",e)),e},setter:function(e){this.setPropStoreFieldValue("commonToolButtons",e),this.updateCommonToolbar(),this.updateZoomToolbar()}}),this.defineProp("chemToolButtons",{dataType:DataType.HASH,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("chemToolButtons");return e||(e=this.getDefaultChemToolBarButtons(),this.setPropStoreFieldValue("chemToolButtons",e)),e},setter:function(e){this.setPropStoreFieldValue("chemToolButtons",e),this.updateChemToolbar()}}),this.defineProp("styleBarComponents",{dataType:DataType.ARRAY,serializable:!1,getter:function(){var e=this.getPropStoreFieldValue("styleBarComponents");return e||(e=null,this.setPropStoreFieldValue("styleBarComponents",e)),e},setter:function(e){this.setPropStoreFieldValue("styleBarComponents",e),this.getStyleToolbar()&&this.getStyleToolbar().setComponentNames(e)}}),this.defineProp("commonActions",{dataType:"Kekule.ActionList",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("commonActions");return e||(e=new Kekule.ActionList,this.setPropStoreFieldValue("commonActions",e)),e}}),this.defineProp("zoomActions",{dataType:"Kekule.ActionList",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("zoomActions");return e||(e=new Kekule.ActionList,this.setPropStoreFieldValue("zoomActions",e)),e}}),this.defineProp("chemActions",{dataType:"Kekule.ActionList",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("chemActions");return e||(e=new Kekule.ActionList,this.setPropStoreFieldValue("chemActions",e)),e}}),this.defineProp("actionMap",{dataType:"Kekule.MapEx",serializable:!1,setter:null,getter:function(){var e=this.getPropStoreFieldValue("actionMap");return e||(e=new Kekule.MapEx,this.setPropStoreFieldValue("actionMap",e)),e}}),this.defineProp("allowCreateNewChild",{dataType:DataType.BOOL,getter:function(){var e=this.getEditor();return e&&e.getAllowCreateNewChild?e.getAllowCreateNewChild():null},setter:function(e){var t=this.getEditor();return t.setAllowCreateNewChild&&t.setAllowCreateNewChild(e),this}}),this.defineProp("allowAppendDataToCurr",{dataType:DataType.BOOL,getter:function(){var e=this.getEditor();return e&&e.getAllowAppendDataToCurr?e.getAllowAppendDataToCurr():null},setter:function(e){var t=this.getEditor();return t.setAllowAppendDataToCurr&&t.setAllowAppendDataToCurr(e),this}}),this._defineEditorDelegatedProp("chemObj"),this._defineEditorDelegatedProp("chemObjLoaded"),this._defineEditorDelegatedProp("renderType"),this._defineEditorDelegatedProp("renderConfigs"),this._defineEditorDelegatedProp("drawOptions"),this._defineEditorDelegatedProp("allowCoordBorrow"),this._defineEditorDelegatedProp("editorConfigs"),this._defineEditorDelegatedProp("operHistory"),this._defineEditorDelegatedProp("enableOperHistory"),this._defineEditorDelegatedProp("selection"),this._defineEditorDelegatedProp("hotTrackedObjs"),this._defineEditorDelegatedProp("enableOperContext"),this._defineEditorDelegatedProp("enableCreateNewDoc"),this._defineEditorDelegatedProp("enableLoadNewFile"),this._defineEditorDelegatedProp("enableIssueCheck"),this._defineEditorDelegatedProp("initOnNewDoc")},_defineEditorDelegatedProp:function(e,t){t||(t=e);var o=ClassEx.getPropInfo(Kekule.Editor.BaseEditor,t),r=Object.create(o);return r.getter=null,r.setter=null,o.getter&&(r.getter=function(){return this.getEditor().getPropValue(t)}),o.setter&&(r.setter=function(e){this.getEditor().setPropValue(t,e)}),this.defineProp(e,r)},loadPredefinedResDataToProp:function(e,t,o){if("chemObj"===e)if(o)try{var r=Kekule.IO.loadTypedData(t.data,t.resType,t.resUri);this.setChemObj(r)}catch(e){Kekule.raise(e,Kekule.ExceptionLevel.ERROR)}else Kekule.throwException(Kekule.$L("ErrorMsg.CANNOT_LOAD_RES_OF_URI")+t.resUri||"")},doCreateRootElement:function(e){return e.createElement("div")},doCreateSubElements:function(e,t){var r=[],i=this._doCreateSubElement(e,t,"div",o.COMPOSER_EDITOR_STAGE,"editorStageElem");return r.push(i),i=this._doCreateSubElement(e,t,"div",o.COMPOSER_ADV_PANEL,"advPanelElem"),this._doCreateSubElement(e,i,"div",null,"objInspectorHolderElem"),this._doCreateSubElement(e,i,"div",o.COMPOSER_ISSUE_PANEL,"issueInspectorHolderElem"),r.push(i),r.push(this._doCreateSubElement(e,t,"div",o.COMPOSER_TOP_REGION,"topRegionElem")),r.push(this._doCreateSubElement(e,t,"div",o.COMPOSER_LEFT_REGION,"leftRegionElem")),r.push(this._doCreateSubElement(e,t,"div",o.COMPOSER_BOTTOM_REGION,"bottomRegionElem")),r},_doCreateSubElement:function(e,t,o,r,i){var n=e.createElement(o);return r&&(n.className=r),t&&t.appendChild(n),i&&this.setPropStoreFieldValue(i,n),n},doGetWidgetClassName:function(){var e=this.tryApplySuper("doGetWidgetClassName")+" "+o.COMPOSER;return this._isUsingGridLayout()&&(e+=" "+o.COMPOSER_GRID_LAYOUT),e},_isUsingGridLayout:function(){return Kekule.BrowserFeature.cssGrid},elementBound:function(e){this.setObserveElemResize(!0)},doWidgetShowStateChanged:function(e){this.tryApplySuper("doWidgetShowStateChanged",[e]),e&&this.adjustComponentPositions()},getResizerElement:function(){return this.getEditorStageElem()},getChildActionClass:function(e,t){var o=this.tryApplySuper("getChildActionClass",[e,t]);return o||(o=this.getEditor().getChildActionClass(e,t)),o},getCoordMode:function(){return this.getEditor().getCoordMode()},isDirty:function(){return this.getEditor().isDirty()},newDoc:function(){return this.getEditor().newDoc()},load:function(e){return this.getEditor().load(e)},loadFromData:function(e,t,o){return this.getEditor().loadFromData(e,t,o)},loadFromFile:function(e){return this.getEditor().loadFromFile(e)},getSavingTargetObj:function(){var e=this.getEditor();return e?e.getSavingTargetObj():null},getExportableClasses:function(){return this.getEditor().getExportableClasses()},exportObj:function(e){return this.getEditor().exportObj(e)},exportObjs:function(e){return this.getEditor().exportObjs(e)},undo:function(){return this.getEditor().undo()},redo:function(){return this.getEditor().redo()},undoAll:function(){return this.getEditor().undoAll()},canUndo:function(){return this.getEditor().canUndo()},canRedo:function(){return this.getEditor().canRedo()},repaint:function(e){return this.getEditor().repaint(e),this},getBoundEditorAction:function(e){var t;return"string"==typeof e?t=this.getCompActionClass(e):ClassEx.isClass(e)&&(t=e),t?this.getActionMap().get(t):null},execBoundEditorAction:function(e){var t=this.getBoundEditorAction(e);return t&&t.execute(),t},uiLayoutChanged:function(){this.adjustComponentPositions()},doResize:function(){this.adjustComponentPositions()},adjustComponentPositions:function(){var e=this.getCommonBtnGroup()?this.getCommonBtnGroup().getElement():null,t=this.getZoomBtnGroup()?this.getZoomBtnGroup().getElement():null,r=this.getChemBtnGroup()?this.getChemBtnGroup().getElement():null;if(e&&r){if(e)var i=Kekule.HtmlElementUtils.getElemPageRect(e);if(t)var n=Kekule.HtmlElementUtils.getElemPageRect(t);if(r)var a=Kekule.HtmlElementUtils.getElemPageRect(r);if(i.width&&a.width){var l=i.height,s=a.width,d=n&&n.height||l,u=!this._isUsingGridLayout(),c=this.getTopRegionElem(),p=this.getBottomRegionElem(),h=this.getLeftRegionElem(),g=Kekule.HtmlElementUtils.getElemPageRect(this.getElement()),C=(Kekule.HtmlElementUtils.getElemPageRect(c),Kekule.HtmlElementUtils.getElemPageRect(p).width-(n?n.width:0)),_=Kekule.HtmlElementUtils.getElemPageRect(h).height-a.height,f=g.width;if(.85*g.height>f?(this.removeClassName(o.COMPOSER_LANDSCAPE),this.addClassName(o.COMPOSER_PORTRAIT)):(this.addClassName(o.COMPOSER_LANDSCAPE),this.removeClassName(o.COMPOSER_PORTRAIT)),u){(m=c.style).top="0px",m.left=s+"px",m.right="0px",m.height=l+"px",(m=p.style).bottom="0px",m.height=d+"px",m.left=s+"px",m.right="0px",(m=h.style).left="0px",m.top=l+"px",m.bottom="0px",m.width=s+"px";var y,m,O=l,E=s,T=d;if((this.getAdvPanelDisplayedComponents()||[]).length){var S=this.getAdvPanelElem();y=Kekule.HtmlElementUtils.getElemPageRect(S).width}else y=0;(m=this.getEditorStageElem().style).position="absolute",m.top=O+"px",m.left=E+"px",m.bottom=T+"px",m.right=y+"px",(m=(S=this.getAdvPanelElem()).style).position="absolute",m.top=O+"px",m.bottom=T+"px"}if(_/C>.9?this.changeAssocToolbarRegion(!0):this.changeAssocToolbarRegion(!1),this.getAutoSetMinDimension()){var A={width:s+i.width,height:l+a.height};A.width&&A.height&&this.setMinDimension(A)}}}},adjustAssocToolbarPositions:function(){this.adjustStyleAndObjModifierToolbarPosition()},adjustStyleAndObjModifierToolbarPosition:function(){},bindEditor:function(e){e?e.setParent(this):e=this.getEditor(),e.setTouchAction("none");var t=this.getCommonActions();this.getChemActions();this.createIaControllers(e),e.addEventListener("load",function(e){this.updateAllActions(),this.updateUiWidgets();var t=this.getChemActions().getActionAt(0);t&&t.execute()},this),e.addEventListener("operChange",function(e){t.updateAll(),this.updateUiWidgets()},this),e.addEventListener("selectionChange",function(e){t.updateAll(),this.updateUiWidgets()},this);var o=this;e.overwriteMethod("getChildAction",function(e,t,r){var i=o._getCreatedNamedAction(t);return i||(i=e(t,r)),i}),e.appendToElem(this.getEditorStageElem()),this.getEditorNexus().setEditor(e)},createDefaultEditor:function(){var e=new Kekule.Editor.ChemSpaceEditor(this,null,Kekule.Render.RendererType.R2D);return e.addClassName(t.DYN_CREATED),e},createIaControllers:function(e){for(var t=Kekule.Editor.IaControllerManager.getAvailableControllerClasses(e.getClass()),o=0,r=t.length;o<r;++o){var i=new(0,t[o])(e);e.addIaController(i.getDefId(),i)}},updateAdvPanelDisplayedComponents:function(e){if(e&&e.length){var t=e.indexOf("objInspector")>=0,o=e.indexOf("issueInspector")>=0;t||o?(t&&!this.getObjInspector()&&this._createObjInspectorControls(),o&&!this.getIssueInspector()&&this._createIssueInspectorControls(),this.getObjInspectorHolderElem().style.display=t?"block":"none",this.getIssueInspectorHolderElem().style.display=o?"block":"none",this.showAdvPanel()):this.hideAdvPanel()}else this.hideAdvPanel();this.uiLayoutChanged()},_createObjInspectorControls:function(e){e||(e=this.getObjInspectorHolderElem());var t=this.getDocument(),o=new Kekule.ChemWidget.StructureTreeView(t);o.setItemInitialExpanded(!0),o.appendToElem(e),o.setParent(this),this.setPropStoreFieldValue("structureTreeView",o);var r=new Kekule.Widget.ObjectInspector(t);r.setShowPropInfoPanel(!1),r.appendToElem(e),r.setParent(this),this.setPropStoreFieldValue("objInspector",r);var i=this.getEditorNexus();i.setObjectInspector(r),i.setStructureTreeView(o)},_createIssueInspectorControls:function(e){e||(e=this.getIssueInspectorHolderElem());var t=this.getDocument(),i=this._doCreateSubElement(t,e,"div",o.COMPOSER_ISSUE_PANEL_WRAPPER),n=this._doCreateSubElement(t,i,"div",o.COMPOSER_ISSUE_PANEL_TOOL_PANEL),a=this.getCommonActions();this.createToolButton(r.recheckIssues,this,a).setShowText(!1).setShowGlyph(!0).appendToElem(n),this.createToolButton(r.toggleShowAllIssues,this,a).setShowText(!1).setShowGlyph(!0).appendToElem(n);var l=this._doCreateSubElement(t,i,"div",o.COMPOSER_ISSUE_PANEL_INSPECTOR_REGION),s=new Kekule.Editor.IssueInspector(t);s.appendToElem(l),s.setParent(this),this.setPropStoreFieldValue("issueInspector",s),this.getEditorNexus().setIssueInspector(s)},showAdvPanel:function(){this.getAdvPanelElem().style.display="block"},hideAdvPanel:function(){this.getAdvPanelElem().style.display="none"},getDefaultCommonToolBarButtons:function(){return Kekule.globalOptions.chemWidget.composer.commonToolButtons},getZoomButtonNames:function(){return[r.zoomIn,r.zoomOut,r.reset,r.resetZoom]},getDefaultChemToolBarButtons:function(){return Kekule.globalOptions.chemWidget.composer.chemToolButtons},getCompActionClass:function(e){return this.getChildActionClass(e,!0)},_getActionTargetWidget:function(e){return ClassEx.isOrIsDescendantOf(e,Kekule.Editor.ActionOnComposer)||ClassEx.isOrIsDescendantOf(e,Kekule.Widget.ActionOpenConfigWidget)?this:this.getEditor()},createToolButton:function(e,t,o,i){var n=null,a=DataType.isObjectValue(e)?e.name:e,l=this.getCompActionClass(a),s=this._createToolButtonAction(e,o,i);if(DataType.isObjectValue(e)&&!l){var d,u=i?Kekule.Widget.RadioButton:Kekule.Widget.Button;d=Object.extend({widget:u},e),n=Kekule.Widget.Utils.createFromHash(t,d)}else{var c=s.getPreferredWidgetClass&&s.getPreferredWidgetClass();n=new(c||(e===r.objInspector||e===r.issueInspector?Kekule.Widget.CheckButton:i?Kekule.Widget.RadioButton:Kekule.Widget.Button))(t)}return s&&(s.update(),n.setAction(s)),n},_createActionButton:function(e,t){var o=e.getCheckGroup(),r=e.getPreferredWidgetClass&&e.getPreferredWidgetClass(),i=new(r||(o?Kekule.Widget.RadioButton:Kekule.Widget.Button))(t);return e.update(),i.setAction(e),i},_createToolButtonAction:function(e,t,o){var r=DataType.isObjectValue(e),i=null,n=r?e.name:e,a=r?e.attached:null,l=this.getCompActionClass(n);if(r&&!l){var s=e;(l=s.actionClass)&&"string"==typeof l&&(l=ClassEx.findClass(s.actionClass))}if(l){var d=this.getActionMap();if(!(i=d.get(l))){i=new l(this._getActionTargetWidget(l));r&&(e.text&&i.setText(e.text),e.hint&&i.setHint(e.hint),(e.htmlClass||e.htmlClassName)&&i.setHtmlClassName((i.getHtmlClassName()||"")+(e.htmlClass||e.htmlClassName))),d.set(l,i)}var u=o||"",c=i.getExplicitGroup&&i.getExplicitGroup();if(Kekule.ObjUtils.notUnset(c)&&(u=c),u&&i.setCheckGroup(u),i&&t&&t.add(i),i&&i.addAttachedAction){var p=i.getClassName(),h=Kekule.ArrayUtils.clone(i.getAttachedActions().getActions()||[]),g=function(e,t,o,r,i){if(!t)return null;var n=o.indexOf(t);n>=0?o[n]=null:e.addAttachedAction(t,r),Kekule.ObjUtils.notUnset(i)&&e.setAttachedActionIndex(t,i)};if(a)for(var C=0,_=a.length;C<_;++C){var f=a[C];g(i,m=this._createToolButtonAction(f,null,p),h,0===C,C)}else{var y=i.getAttachedActionClasses();if(y)for(C=0,_=y.length;C<_;++C){var m,O=y[C];if(!(m=d.get(O))){var E=(m=new O(this._getActionTargetWidget(O))).getExplicitGroup&&m.getExplicitGroup();Kekule.ObjUtils.notUnset(E)?m.setCheckGroup(E):m.setCheckGroup(p),d.set(O,m)}g(i,m,h,0===C,C)}}if(h.length)for(C=0,_=h.length;C<_;++C){var T=h[C];T&&(i.removeAttachedAction(T),d.remove(T.getClass()))}}}return i},_getCreatedNamedAction:function(e){var t=this.getCompActionClass(e),o=this.getActionMap();return t&&o.get(t)},createInnerToolbar:function(e,r){var i=new Kekule.Widget.ButtonGroup(this);i.addClassName(o.COMPOSER_TOOLBAR),i.addClassName(o.INNER_TOOLBAR),i.addClassName(t.DYN_CREATED),i.setShowText(!1),i.doSetShowGlyph(!0);var n=e||this.getElement();if(r){var a=Kekule.DomUtils.getFirstChildElem(n);a?i.insertToElem(n,a):i.appendToElem(n)}else i.appendToElem(n);return i},createCommonToolbar:function(){var e=this.getTopRegionElem(),r=this.createInnerToolbar(e);r.addClassName(o.COMPOSER_COMMON_TOOLBAR);var i=this.getCommonToolButtons();i=Kekule.ArrayUtils.exclude(i,this.getZoomButtonNames());var n=this.getCommonActions();this.getEditor();n.clear();for(var a=0,l=i.length;a<l;++a){var s=i[a];this.createToolButton(s,r,n)}return this.setCommonBtnGroup(r),r.addClassName(t.DYN_CREATED),this.updateZoomToolbar(),this.adjustComponentPositions(),r},createZoomToolbar:function(){var e=Kekule.ArrayUtils.intersect(this.getCommonToolButtons(),this.getZoomButtonNames());if(e.length){var r=this.getBottomRegionElem(),i=this.createInnerToolbar(r);i.addClassName(o.COMPOSER_ZOOM_TOOLBAR);var n=this.getZoomActions();this.getEditor();n.clear();for(var a=0,l=e.length;a<l;++a){var s=e[a];this.createToolButton(s,i,n)}return this.setZoomBtnGroup(i),i.addClassName(t.DYN_CREATED),this.adjustComponentPositions(),i}return this.setZoomBtnGroup(null),null},updateCommonToolbar:function(){var e=this.getCommonBtnGroup();e&&e.finalize(),this.createCommonToolbar()},updateZoomToolbar:function(){var e=this.getZoomBtnGroup();e&&e.finalize(),this.createZoomToolbar()},createChemToolbar:function(){var e=this.getLeftRegionElem(),r=this.createInnerToolbar(e,!0);r.addClassName(o.COMPOSER_CHEM_TOOLBAR),r.setLayout(Kekule.Widget.Layout.VERTICAL);var i=this.getChemToolButtons(),n=this.getChemActions();n.clear();for(var a,l=0,s=i.length;l<s;++l){var d=i[l],u=this.createToolButton(d,r,n,"chemTools");0===l&&(a=u)}if(this.setChemBtnGroup(r),r.addClassName(t.DYN_CREATED),this.adjustComponentPositions(),a){var c=a.getAction();if(c){c.setChecked(!0);var p=c.getAttachedActions&&c.getAttachedActions();this.bindAssocActions(p||null)}}return r},updateChemToolbar:function(){var e=this.getChemBtnGroup();e&&e.finalize(),this.createChemToolbar()},createAssocToolbar:function(){var e=this.getBottomRegionElem(),r=this.createInnerToolbar(e);return r.addClassName(o.COMPOSER_ASSOC_TOOLBAR),this.setAssocBtnGroup(r),this.adjustAssocToolbarPositions(),r.addClassName(t.DYN_CREATED),r},changeAssocToolbarRegion:function(e){var t,o=this.getAssocBtnGroup();if(o||(o=this.createAssocToolbar()),e)t=this.getLeftRegionElem(),o.getElement().parentNode!==t&&(o.setLayout(Kekule.Widget.Layout.VERTICAL),o.appendToElem(t));else if(t=this.getBottomRegionElem(),o.getElement().parentNode!==t){o.setLayout(Kekule.Widget.Layout.HORIZONTAL);var r=Kekule.DomUtils.getFirstChildElem(t);t.insertBefore(o.getElement(),r)}},showAssocToolbar:function(){var e=this.getAssocBtnGroup();e||(e=this.createAssocToolbar());var t=this;return e.show(null,function(){t.uiLayoutChanged(),setTimeout(t.updateSelectionAssocToolbarStateBind,0)}),this},hideAssocToolbar:function(){var e=this.getAssocBtnGroup();if(e){var t=this;e.hide(null,function(){t.uiLayoutChanged(),setTimeout(t.updateSelectionAssocToolbarStateBind,0)})}return this},isAssocToolbarShown:function(){var e=this.getAssocBtnGroup();return e&&e.isShown()},bindAssocActions:function(e){var t=this.getAssocBtnGroup();if(t||(t=this.createAssocToolbar()),t.clearWidgets(),e)for(var o=0,r=e.getActionCount();o<r;++o){var i=e.getActionAt(o);this._createActionButton(i,t)}},createObjModifierToolbar:function(){if(this.getEnableObjModifierToolbar()){var e=new Kekule.Editor.ComposerObjModifierToolbar(this);return e.appendToElem(this.getBottomRegionElem()),this.setObjModifierToolbar(e),this.adjustAssocToolbarPositions(),this.updateObjModifierToolbarState(),e}return null},showObjModifierToolbar:function(){if(this.getEnableObjModifierToolbar()){var e=this.getObjModifierToolbar();if(!e.isShown()){var t=this;e.show(null,function(){t.uiLayoutChanged()})}}return this},hideObjModifierToolbar:function(){var e=this.getPropStoreFieldValue("objModifierToolbar");if(e&&e.isShown()){var t=this;e.hide(null,function(){t.uiLayoutChanged()},null,{instantly:!0})}return this},isObjModifierToolbarShown:function(){var e=this.getPropStoreFieldValue("objModifierToolbar");return e&&e.isShown()},updateObjModifierToolbarState:function(){var e=!1;this.getEnableObjModifierToolbar()&&this.needShowSelectionAssocToolbar()&&(e=!0),e?(this.showObjModifierToolbar(),this.getObjModifierToolbar().updateState()):this.hideObjModifierToolbar()},createStyleToolbar:function(){if(this.getEnableStyleToolbar()){var e=new Kekule.Editor.ComposerStyleToolbar(this);return e.setComponentNames(this.getStyleBarComponents()),e.appendToElem(this.getBottomRegionElem()),this.setStyleToolbar(e),this.adjustAssocToolbarPositions(),this.updateStyleToolbarState(),e}return null},showStyleToolbar:function(){if(this.getEnableStyleToolbar()){var e=this.getStyleToolbar();if(!e.isShown()){var t=this;e.show(null,function(){t.uiLayoutChanged()})}}return this},hideStyleToolbar:function(){var e=this.getPropStoreFieldValue("styleToolbar");if(e&&e.isShown()){var t=this;e.hide(null,function(){t.uiLayoutChanged()})}return this},isStyleToolbarShown:function(){var e=this.getPropStoreFieldValue("styleToolbar");return e&&e.isShown()},updateStyleToolbarState:function(){this.getEnableStyleToolbar()&&this.needShowSelectionAssocToolbar()?(this.showStyleToolbar(),this.getStyleToolbar().updateState()):this.hideStyleToolbar()},needShowSelectionAssocToolbar:function(){var e=this.getEditor();return e&&e.hasSelection()},updateSelectionAssocToolbarState:function(){this.adjustStyleAndObjModifierToolbarPosition(),this.updateStyleToolbarState(),this.updateObjModifierToolbarState()},updateAllActions:function(){this.getCommonActions().updateAll(),this.getZoomActions().updateAll(),this.getChemActions().updateAll()},updateUiWidgets:function(){this.updateStyleToolbarState(),this.updateObjModifierToolbarState()},createConfigurator:function(){var e=this.tryApplySuper("createConfigurator");return e.addEventListener("configChange",function(e){this.getEditor().repaint()},this),e},react_keydown:function(e){if(!this.tryApplySuper("react_keydown",[e]))return!!this.getEditor().reactHotKeys(e)}}),Kekule.Editor.Composer.getMinPreferredDimension=function(){return{width:630,height:350}},Kekule.Editor.Composer.Settings=Class.create(Kekule.Widget.BaseWidget.Settings,{CLASS_NAME:"Kekule.Editor.Composer.Settings",initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineDelegatedProps(["enableCreateNewDoc","enableLoadNewFile","initOnNewDoc","enableOperHistory","allowCreateNewChild","allowAppendDataToCurr","enableIssueCheck","enableStyleToolbar","enableObjModifierToolbar"])}}),Kekule.Editor.Composer.Configurator=Class.create(Kekule.Widget.Configurator,{CLASS_NAME:"Kekule.Editor.Composer.Configurator",TAB_BTN_DATA_FIELD:"__$data__",initialize:function(e){this.tryApplySuper("initialize",[e])},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setLayout(Kekule.Widget.Layout.HORIZONTAL)},getCategoryInfos:function(){for(var e=this.tryApplySuper("getCategoryInfos"),t=this.getComposer().getEditor(),o=[t.getDisplayerConfigs(),t.getRenderConfigs()],r=0,i=o.length;r<i;++r)for(var n=o[r],a=n.getPropListOfScopes([Class.PropertyScope.PUBLISHED]),l=0,s=a.getLength();l<s;++l){var d=a.getPropInfoAt(l),u=n.getPropValue(d.name);u&&e.push({obj:u,name:d.name,title:d.title,description:d.description})}return e},getComposer:function(){return this.getWidget()},getEditor:function(){return this.getComposer().getEditor()}}),Kekule._registerAfterLoadSysProc(function(){var e=Kekule.Editor.ObjModifier.Category,t=Kekule.ObjPropSettingManager;t.register("Kekule.Editor.Composer.fullFunc",{enableObjModifierToolbar:!0,enableOperHistory:!0,enableLoadNewFile:!0,enableCreateNewDoc:!0,allowCreateNewChild:!0,commonToolButtons:null,chemToolButtons:null,styleToolComponentNames:null,allowedObjModifierCategories:null}),t.register("Kekule.Editor.Composer.molOnly",{enableObjModifierToolbar:!0,enableOperHistor:!0,enableLoadNewFile:!0,enableCreateNewDoc:!0,allowCreateNewChild:!0,commonToolButtons:null,chemToolButtons:[r.manipulate,r.erase,r.molBond,r.molAtom,r.molRing,r.molCharge],styleToolComponentNames:null,allowedObjModifierCategories:[e.GENERAL,e.CHEM_STRUCTURE]}),t.register("Kekule.Editor.Composer.compact",{enableObjModifierToolbar:!0,commonToolButtons:[r.newDoc,r.loadData,r.saveData,r.undo,r.redo,r.zoomIn,r.zoomOut],chemToolButtons:null,styleToolComponentNames:null,allowedObjModifierCategories:null}),t.register("Kekule.Editor.Composer.singleObj",{allowCreateNewChild:!1})}),Kekule.Editor.ComposerDialog=Class.create(Kekule.Widget.Dialog,{CLASS_NAME:"Kekule.Editor.ComposerDialog",initialize:function(e,t,o){this.tryApplySuper("initialize",[e,t,o||[Kekule.Widget.DialogButtons.OK,Kekule.Widget.DialogButtons.CANCEL]])},initProperties:function(){this.defineProp("composer",{dataType:"Kekule.Editor.Composer",serializable:!1,setter:null}),this.defineProp("chemObj",{dataType:"Kekule.ChemObject",serializable:!1,getter:function(){var e=this.getComposer();return e&&e.getChemObj()},setter:function(e){var t=this.getComposer();t&&t.setChemObj(e)}})},initPropValues:function(){this.tryApplySuper("initPropValues")},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+o.COMPOSER_DIALOG},doCreateClientContents:function(e){this.tryApplySuper("doCreateClientContents");var t=this.doCreateComposerWidget();this.setPropStoreFieldValue("composer",t),t.appendToElem(e)},getSavingTargetObj:function(){var e=this.getComposer();return e?e.getSavingTargetObj():null},doCreateComposerWidget:function(){var e=new Kekule.Editor.Composer(this);return e.addClassName(t.DYN_CREATED),e.setResizable&&e.setResizable(!0),e.getEditor().addClassName(t.DYN_CREATED),e}}),Kekule.Editor.ComposerFrame=Class.create(Kekule.ChemWidget.AbstractWidget,{CLASS_NAME:"Kekule.Editor.ComposerFrame",BINDABLE_TAG_NAMES:["iframe"],initialize:function(e){this.tryApplySuper("initialize",[e])},initProperties:function(){this.defineProp("composer",{dataType:"Kekule.Editor.Composer",scope:Class.PropertyScope.PUBLIC,serializable:!1,setter:null}),this.defineProp("frameDocument",{dataType:DataType.OBJECT,scope:Class.PropertyScope.PUBLIC,serializable:!1,setter:null,getter:function(){return this.getElement().contentDocument}}),this.defineProp("frameWindow",{dataType:DataType.OBJECT,scope:Class.PropertyScope.PUBLIC,serializable:!1,setter:null,getter:function(){return Kekule.DocumentUtils.getDefaultView(this.getFrameDocument())}})},initPropValues:function(){this.tryApplySuper("initPropValues"),this.setMinDimension({width:550,height:350}),this.setEnableDimensionTransform(!0)},doGetWidgetClassName:function(){return this.tryApplySuper("doGetWidgetClassName")+" "+o.COMPOSER_FRAME},doCreateRootElement:function(e){return e.createElement("iframe")},doBindElement:function(e){(this.tryApplySuper("doBindElement",[e]),e.parentNode)||(this.setDisplayed(!1),e.ownerDocument.body.appendChild(e));this._createComposerWidgetInFrame()},_initFrame:function(){var e=this.getFrameDocument();e.open("text/htmlreplace"),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close()},_createComposerWidgetInFrame:function(e){this._initFrame();var t=this,r=this.getFrameDocument();r.documentElement.className=o.COMPOSER_FRAME_CONTENT_DOC,r.body.className=o.COMPOSER_FRAME_CONTENT_BODY,Kekule.X.Event.addListener(r.body,"kekuleload",function(o){var i=new Kekule.Editor.Composer(r);i.appendToElem(r.body),t.setPropStoreFieldValue("composer",i),e&&e(i)}),this._insertKekuleScriptAndStyleSheetFiles(r)},_insertKekuleScriptAndStyleSheetFiles:function(e,t){var o=e.head,r=e.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("type","text/css"),r.setAttribute("href",Kekule.getStyleSheetUrl()),o.appendChild(r),Kekule.ScriptFileUtils.appendScriptFile(e,Kekule.getScriptSrc(),t)}})}();