Clazz.declarePackage("J.viewer");c$=Clazz.declareType(J.viewer,"JmolStateCreator");Clazz.declarePackage("J.viewer");
Clazz.load(["J.viewer.JmolStateCreator","java.util.Hashtable"],"J.viewer.StateCreator","java.lang.Boolean $.Float java.util.Arrays $.Date JU.List $.P3 $.ParserJS $.SB $.V3 J.constant.EnumAxesMode $.EnumPalette $.EnumStereoMode $.EnumStructure $.EnumVdw J.modelset.AtomCollection $.Bond J.shape.Shape J.util.BSUtil $.C $.ColorEncoder $.Escape $.JmolEdge $.JmolFont $.Logger $.Parser $.Txt J.viewer.DataManager $.JC $.StateManager $.Viewer".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.temp3=
this.temp2=this.temp=this.viewer=null;this.undoWorking=!1;Clazz.instantialize(this,arguments)},J.viewer,"StateCreator",J.viewer.JmolStateCreator);Clazz.prepareFields(c$,function(){this.temp=new java.util.Hashtable;this.temp2=new java.util.Hashtable;this.temp3=new java.util.Hashtable});Clazz.makeConstructor(c$,function(){Clazz.superConstructor(this,J.viewer.StateCreator,[])});Clazz.overrideMethod(c$,"setViewer",function(a){this.viewer=a},"J.viewer.Viewer");Clazz.overrideMethod(c$,"getStateScript",
function(a,b,c){var d=null==a||a.equalsIgnoreCase("all"),e=new JU.SB,f=d?(new JU.SB).append("function _setState() {\n"):null;d&&e.append("# Jmol state version "+J.viewer.Viewer.getJmolVersion()+";\n");this.viewer.isApplet()&&d&&(J.viewer.StateCreator.appendCmd(e,"# fullName = "+J.util.Escape.eS(this.viewer.fullName)),J.viewer.StateCreator.appendCmd(e,"# documentBase = "+J.util.Escape.eS(this.viewer.appletDocumentBase)),J.viewer.StateCreator.appendCmd(e,"# codeBase = "+J.util.Escape.eS(this.viewer.appletCodeBase)),
e.append("\n"));var g=this.viewer.global;(d||a.equalsIgnoreCase("windowState"))&&e.append(this.getWindowState(f,b,c));(d||a.equalsIgnoreCase("fileState"))&&e.append(this.getFileState(f));(d||a.equalsIgnoreCase("definedState"))&&e.append(this.getDefinedState(f,!0));(d||a.equalsIgnoreCase("variableState"))&&e.append(this.getVariableState(g,f));(d||a.equalsIgnoreCase("dataState"))&&this.getDataState(this.viewer.dataManager,e,f,this.getAtomicPropertyState(-1,null));(d||a.equalsIgnoreCase("modelState"))&&
e.append(this.getModelState(f,!0,this.viewer.getBooleanProperty("saveProteinStructureState")));(d||a.equalsIgnoreCase("colorState"))&&e.append(this.getColorState(this.viewer.colorManager,f));(d||a.equalsIgnoreCase("frameState"))&&e.append(this.getAnimState(this.viewer.animationManager,f));(d||a.equalsIgnoreCase("perspectiveState"))&&e.append(this.getViewState(this.viewer.transformManager,f));(d||a.equalsIgnoreCase("selectionState"))&&e.append(this.getSelectionState(this.viewer.selectionManager,f));
null!=f&&(J.viewer.StateCreator.appendCmd(f,"set refreshing true"),J.viewer.StateCreator.appendCmd(f,"set antialiasDisplay "+g.antialiasDisplay),J.viewer.StateCreator.appendCmd(f,"set antialiasTranslucent "+g.antialiasTranslucent),J.viewer.StateCreator.appendCmd(f,"set antialiasImages "+g.antialiasImages),this.viewer.getSpinOn()&&J.viewer.StateCreator.appendCmd(f,"spin on"),f.append("}\n\n_setState;\n"));d&&e.appendSB(f);return e.toString()},"~S,~N,~N");$_M(c$,"getDefinedState",($fz=function(a,b){var c=
this.viewer.modelSet,d=c.stateScripts.size();if(0==d)return"";for(var e=!1,f=new JU.SB,g,h=0;h<d;h++){var k=c.stateScripts.get(h);if(k.inDefinedStateBlock&&0<(g=k.toString()).length)f.append("  ").append(g).append("\n"),e=!0}if(!e)return"";g="";b&&null!=a&&(a.append("  _setDefinedState;\n"),g="function _setDefinedState() {\n\n");null!=a&&f.append("\n}\n\n");return g+f.toString()},$fz.isPrivate=!0,$fz),"JU.SB,~B");Clazz.overrideMethod(c$,"getModelState",function(a,b,c){var d=new JU.SB;b&&null!=a&&
(a.append("  _setModelState;\n"),d.append("function _setModelState() {\n"));var e,f=this.viewer.modelSet,g=f.bonds,h=f.models,k=f.modelCount;if(b){for(var l=f.stateScripts.size(),j=0;j<l;j++){var m=f.stateScripts.get(j);!m.inDefinedStateBlock&&0<(e=m.toString()).length&&d.append("  ").append(e).append("\n")}e=new JU.SB;for(j=0;j<f.bondCount;j++)if(!h[g[j].atom1.modelIndex].isModelKit&&(g[j].isHydrogen()||0!=(g[j].order&131072)))l=g[j],m=l.atom1.index,l.atom1.getGroup().isAdded(m)&&(m=-1-m),e.appendI(m).appendC("\t").appendI(l.atom2.index).appendC("\t").appendI(l.order&
-131073).appendC("\t").appendF(l.mad/1E3).appendC("\t").appendF(l.getEnergy()).appendC("\t").append(J.util.JmolEdge.getBondOrderNameFromOrder(l.order)).append(";\n");0<e.length()&&d.append('data "connect_atoms"\n').appendSB(e).append('end "connect_atoms";\n');d.append("\n")}if(f.haveHiddenBonds){e=new J.modelset.Bond.BondSet;for(j=f.bondCount;0<=--j;)0!=g[j].mad&&0==(g[j].shapeVisibilityFlags&J.modelset.Bond.myVisibilityFlag)&&e.set(j);e.isEmpty()?f.haveHiddenBonds=!1:d.append("  hide ").append(J.util.Escape.eBond(e)).append(";\n")}this.viewer.setModelVisibility();
c&&d.append(f.getProteinStructureState(null,b,!1,0));this.getShapeState(d,b,2147483647);if(b){c=!1;for(j=0;j<k;j++)if(h[j].isJmolDataFrame){c=!0;break}for(j=0;j<k;j++)g="  frame "+f.getModelNumberDotted(j),e=f.getModelAuxiliaryInfoValue(j,"modelID"),null!=e&&!e.equals(f.getModelAuxiliaryInfoValue(j,"modelID0"))&&d.append(g).append("; frame ID ").append(J.util.Escape.eS(e)).append(";\n"),e=f.frameTitles[j],null!=e&&0<e.length&&d.append(g).append("; frame title ").append(J.util.Escape.eS(e)).append(";\n"),
c&&(null!=h[j].orientation&&!f.isTrajectorySubFrame(j))&&d.append(g).append("; ").append(h[j].orientation.getMoveToText(!1)).append(";\n"),0!=h[j].frameDelay&&!f.isTrajectorySubFrame(j)&&d.append(g).append("; frame delay ").appendF(h[j].frameDelay/1E3).append(";\n"),null!=h[j].simpleCage&&(d.append(g).append("; unitcell ").append(J.util.Escape.eAP(h[j].simpleCage.getUnitCellVectors())).append(";\n"),this.getShapeState(d,b,33));c=!1;if(null!=f.unitCells){g=!1;for(j=0;j<k;j++)if(e=f.getUnitCell(j),
null!=e){d.append("  frame ").append(f.getModelNumberDotted(j));l=e.getFractionalOffset();if(null!=l&&(0!=l.x||0!=l.y||0!=l.z))d.append("; set unitcell ").append(J.util.Escape.eP(l)),c=!0;l=e.getUnitCellMultiplier();null!=l&&(d.append("; set unitcell ").append(J.util.Escape.eP(l)),c=!0);d.append(";\n");g=(new Boolean(g|0<=this.viewer.modelGetLastVibrationIndex(j,135270424))).valueOf()}c&&this.viewer.loadShape(33);this.getShapeState(d,b,33);if(g){b=new java.util.Hashtable;for(j=k;0<=--j;)if(0<=(k=
this.viewer.modelGetLastVibrationIndex(j,135270424)))for(f=h[j].firstAtomIndex;f<=k;f++)c=this.viewer.getVibration(f),null!=c&&c.enabled&&J.util.BSUtil.setMapBitSet(b,f,f,c.getState());e=this.getCommands(b,null,"select");d.append(e)}}d.append("  set fontScaling "+this.viewer.getBoolean(603979845)+";\n");this.viewer.getBoolean(603979883)&&d.append("  set modelKitMode true;\n")}null!=a&&d.append("\n}\n\n");return d.toString()},"JU.SB,~B,~B");$_M(c$,"getShapeState",($fz=function(a,b,c){var d=this.viewer.shapeManager.shapes;
if(null!=d){var e,f,g;2147483647==c?(c=0,g=36):g=c+1;for(;c<g;++c)null!=(f=d[c])&&((b||J.viewer.JC.isShapeSecondary(c))&&null!=(e=f.getShapeState())&&1<e.length)&&a.append(e);a.append("  select *;\n")}},$fz.isPrivate=!0,$fz),"JU.SB,~B,~N");$_M(c$,"getWindowState",($fz=function(a,b,c){var d=this.viewer.global,e=new JU.SB;null!=a&&(a.append("  initialize;\n  set refreshing false;\n  _setWindowState;\n"),e.append("\nfunction _setWindowState() {\n"));0!=b&&e.append("# preferredWidthHeight ").appendI(b).append(" ").appendI(c).append(";\n");
e.append("# width ").appendI(0==b?this.viewer.getScreenWidth():b).append(";\n# height ").appendI(0==c?this.viewer.getScreenHeight():c).append(";\n");J.viewer.StateCreator.appendCmd(e,"stateVersion = "+d.getParameter("_version"));J.viewer.StateCreator.appendCmd(e,"background "+J.util.Escape.escapeColor(d.objColors[0]));for(b=1;8>b;b++)0!=d.objColors[b]&&J.viewer.StateCreator.appendCmd(e,J.viewer.StateManager.getObjectNameFromId(b)+'Color = "'+J.util.Escape.escapeColor(d.objColors[b])+'"');null!=d.backgroundImageFileName&&
J.viewer.StateCreator.appendCmd(e,"background IMAGE /*file*/"+J.util.Escape.eS(d.backgroundImageFileName));e.append(this.getSpecularState());J.viewer.StateCreator.appendCmd(e,"statusReporting  = "+d.statusReporting);null!=a&&e.append("}\n\n");return e.toString()},$fz.isPrivate=!0,$fz),"JU.SB,~N,~N");Clazz.overrideMethod(c$,"getSpecularState",function(){var a=new JU.SB,b=this.viewer.gdata;J.viewer.StateCreator.appendCmd(a,"set ambientPercent "+b.getAmbientPercent());J.viewer.StateCreator.appendCmd(a,
"set diffusePercent "+b.getDiffusePercent());J.viewer.StateCreator.appendCmd(a,"set specular "+b.getSpecular());J.viewer.StateCreator.appendCmd(a,"set specularPercent "+b.getSpecularPercent());J.viewer.StateCreator.appendCmd(a,"set specularPower "+b.getSpecularPower());J.viewer.StateCreator.appendCmd(a,"set celShading "+b.getCel());var c=b.getSpecularExponent(),b=b.getPhongExponent();Math.pow(2,c)==b?J.viewer.StateCreator.appendCmd(a,"set specularExponent "+c):J.viewer.StateCreator.appendCmd(a,"set phongExponent "+
b);J.viewer.StateCreator.appendCmd(a,"set zShadePower "+this.viewer.global.zShadePower);return a.toString()});$_M(c$,"getFileState",($fz=function(a){var b=new JU.SB;null!=a&&(a.append("  _setFileState;\n"),b.append("function _setFileState() {\n\n"));0>b.indexOf("append")&&this.viewer.getModelSetFileName().equals("zapped")&&b.append("  zap;\n");this.appendLoadStates(b);null!=a&&b.append("\n}\n\n");return b.toString()},$fz.isPrivate=!0,$fz),"JU.SB");$_M(c$,"appendLoadStates",($fz=function(a){var b=
this.viewer.ligandModelSet;if(null!=b)for(var c,b=b.keySet().iterator();b.hasNext()&&((c=b.next())||1);){var d=this.viewer.ligandModels.get(c+"_data");null!=d&&a.append("  ").append(J.util.Escape.encapsulateData("ligand_"+c,d.trim()+"\n",0));d=this.viewer.ligandModels.get(c+"_file");null!=d&&a.append("  ").append(J.util.Escape.encapsulateData("file_"+c,d.trim()+"\n",0))}var b=new JU.SB,d=this.viewer.modelSet,e=d.models,f=d.modelCount;for(c=0;c<f;c++)if(!d.isJmolDataFrameForModel(c)&&!d.isTrajectorySubFrame(c)){var g=
e[c],h=b.indexOf(g.loadState);(0>h||h!=b.lastIndexOf(g.loadState))&&b.append(e[c].loadState);e[c].isModelKit?(h=d.getModelAtomBitSetIncludingDeleted(c,!1),null!=d.tainted&&(null!=d.tainted[2]&&d.tainted[2].andNot(h),null!=d.tainted[3]&&d.tainted[3].andNot(h)),g.loadScript=new JU.SB,J.viewer.Viewer.getInlineData(b,this.viewer.getModelExtract(h,!1,!0,"MOL"),0<c)):b.appendSB(g.loadScript)}b=b.toString();c=b.indexOf("load /*data*/");d=b.indexOf("load /*file*/");0<=d&&d<c&&(c=d);if(0<=(d=b.indexOf('load "@'))&&
d<c)c=d;0<=c&&(b=b.substring(0,c)+"zap;"+b.substring(c));a.append(b)},$fz.isPrivate=!0,$fz),"JU.SB");$_M(c$,"getDataState",($fz=function(a,b,c,d){if(null!=a.dataValues){var e=new JU.SB,f=!1;0<d.length&&(f=!0,e.append(d));var g;for(d=a.dataValues.keySet().iterator();d.hasNext()&&((g=d.next())||1);)if(0==g.indexOf("property_")){var h=a.dataValues.get(g);if(!(4<h.length&&h[4]===Boolean.FALSE)){var f=!0,k=h[1];null!=k&&1==h[3].intValue()?(this.getAtomicPropertyStateBuffer(e,14,h[2],g,k),e.append("\n")):
e.append("\n").append(J.util.Escape.encapsulateData(g,k,0))}}else 0==g.indexOf("data2d")?(h=a.dataValues.get(g),k=h[1],null!=k&&2==h[3].intValue()&&(f=!0,e.append("\n").append(J.util.Escape.encapsulateData(g,k,2)))):0==g.indexOf("data3d")&&(h=a.dataValues.get(g),k=h[1],null!=k&&3==h[3].intValue()&&(f=!0,e.append("\n").append(J.util.Escape.encapsulateData(g,k,3))));null!=a.userVdws&&(a=a.getDefaultVdwNameOrData(0,J.constant.EnumVdw.USER,a.bsUserVdws),0<a.length&&(f=!0,e.append(a)));null!=this.viewer.nmrCalculation&&
(f=(new Boolean(f|this.viewer.getNMRCalculation().getState(e))).valueOf());f&&(null!=c&&b.append("function _setDataState() {\n"),b.appendSB(e),null!=c&&(c.append("  _setDataState;\n"),b.append("}\n\n")))}},$fz.isPrivate=!0,$fz),"J.viewer.DataManager,JU.SB,JU.SB,~S");$_M(c$,"getColorState",($fz=function(a,b){var c=new JU.SB,d=this.getCEState(a.propertyColorEncoder,c);0<d&&null!=b&&b.append("\n  _setColorState\n");return 0<d&&null!=b?"function _setColorState() {\n"+c.append("}\n\n").toString():c.toString()},
$fz.isPrivate=!0,$fz),"J.viewer.ColorManager,JU.SB");$_M(c$,"getCEState",($fz=function(a,b){for(var c=0,d,e=a.schemes.entrySet().iterator();e.hasNext()&&((d=e.next())||1);){var f=d.getKey();(new Boolean(0<f.length&0<=c++)).valueOf()&&b.append('color "'+f+"="+J.util.ColorEncoder.getColorSchemeList(d.getValue())+'";\n')}return c},$fz.isPrivate=!0,$fz),"J.util.ColorEncoder,JU.SB");$_M(c$,"getAnimState",($fz=function(a,b){var c=this.viewer.getModelCount();if(2>c)return"";var d=new JU.SB;null!=b&&(b.append("  _setFrameState;\n"),
d.append("function _setFrameState() {\n"));d.append("# frame state;\n");d.append("# modelCount ").appendI(c).append(";\n# first ").append(this.viewer.getModelNumberDotted(0)).append(";\n# last ").append(this.viewer.getModelNumberDotted(c-1)).append(";\n");0<=a.backgroundModelIndex&&J.viewer.StateCreator.appendCmd(d,"set backgroundModel "+this.viewer.getModelNumberDotted(a.backgroundModelIndex));c=this.viewer.getFrameOffsets();null!=c&&J.viewer.StateCreator.appendCmd(d,"frame align "+J.util.Escape.eBS(c));
J.viewer.StateCreator.appendCmd(d,"frame RANGE "+a.getModelSpecial(-1)+" "+a.getModelSpecial(1));J.viewer.StateCreator.appendCmd(d,"animation DIRECTION "+(1==a.animationDirection?"+1":"-1"));J.viewer.StateCreator.appendCmd(d,"animation FPS "+a.animationFps);J.viewer.StateCreator.appendCmd(d,"animation MODE "+a.animationReplayMode.name()+" "+a.firstFrameDelay+" "+a.lastFrameDelay);0<a.morphCount&&J.viewer.StateCreator.appendCmd(d,"animation MORPH "+a.morphCount);var c=a.getAnimationFrames(),e=!0;null!=
c&&(J.viewer.StateCreator.appendCmd(d,"anim frames "+J.util.Escape.eAI(c)),c=a.getCurrentFrameIndex(),J.viewer.StateCreator.appendCmd(d,"frame "+(c+1)),e=a.getCurrentModelIndex()!=a.modelIndexForFrame(c));e&&J.viewer.StateCreator.appendCmd(d,"model "+a.getModelSpecial(0));J.viewer.StateCreator.appendCmd(d,"animation "+(!a.animationOn?"OFF":1==a.currentDirection?"PLAY":"PLAYREV"));a.animationOn&&a.animationPaused&&J.viewer.StateCreator.appendCmd(d,"animation PAUSE");null!=b&&d.append("}\n\n");return d.toString()},
$fz.isPrivate=!0,$fz),"J.viewer.AnimationManager,JU.SB");$_M(c$,"getVariableState",($fz=function(a,b){var c=Array(a.htBooleanParameterFlags.size()+a.htNonbooleanParameterValues.size()),d=new JU.SB;null!=b&&(b.append("  _setVariableState;\n"),d.append("function _setVariableState() {\n\n"));for(var e=0,f,g=a.htBooleanParameterFlags.keySet().iterator();g.hasNext()&&((f=g.next())||1);)J.viewer.StateManager.doReportProperty(f)&&(c[e++]="set "+f+" "+a.htBooleanParameterFlags.get(f));for(g=a.htNonbooleanParameterValues.keySet().iterator();g.hasNext()&&
((f=g.next())||1);)if(J.viewer.StateManager.doReportProperty(f)){var h=a.htNonbooleanParameterValues.get(f);"="==f.charAt(0)?f=f.substring(1):(f=0==f.indexOf("default")?" set "+f:"set "+f,h=J.util.Escape.e(h));c[e++]=f+" "+h}switch(a.axesMode){case J.constant.EnumAxesMode.UNITCELL:c[e++]="set axes unitcell";break;case J.constant.EnumAxesMode.BOUNDBOX:c[e++]="set axes window";break;default:c[e++]="set axes molecular"}java.util.Arrays.sort(c,0,e);for(f=0;f<e;f++)null!=c[f]&&J.viewer.StateCreator.appendCmd(d,
c[f]);c=J.viewer.StateManager.getVariableList(a.htUserVariables,0,!1,!0);0<c.length&&(d.append("\n#user-defined atom sets; \n"),d.append(c));null!=this.viewer.shapeManager.getShape(5)&&d.append(this.getDefaultLabelState(this.viewer.shapeManager.shapes[5]));a.haveSetStructureList&&(c=a.structureList,d.append("struture HELIX set "+J.util.Escape.eAF(c.get(J.constant.EnumStructure.HELIX))),d.append("struture SHEET set "+J.util.Escape.eAF(c.get(J.constant.EnumStructure.SHEET))),d.append("struture TURN set "+
J.util.Escape.eAF(c.get(J.constant.EnumStructure.TURN))));null!=b&&d.append("\n}\n\n");return d.toString()},$fz.isPrivate=!0,$fz),"J.viewer.StateManager.GlobalSettings,JU.SB");$_M(c$,"getDefaultLabelState",($fz=function(a){var b=(new JU.SB).append("\n# label defaults;\n");J.viewer.StateCreator.appendCmd(b,"select none");J.viewer.StateCreator.appendCmd(b,J.shape.Shape.getColorCommand("label",a.defaultPaletteID,a.defaultColix,a.translucentAllowed));J.viewer.StateCreator.appendCmd(b,"background label "+
J.shape.Shape.encodeColor(a.defaultBgcolix));J.viewer.StateCreator.appendCmd(b,"set labelOffset "+J.viewer.JC.getXOffset(a.defaultOffset)+" "+-J.viewer.JC.getYOffset(a.defaultOffset));var c=J.viewer.JC.getAlignmentName(a.defaultAlignment);J.viewer.StateCreator.appendCmd(b,"set labelAlignment "+(5>c.length?"left":c));c=J.viewer.JC.getPointer(a.defaultPointer);J.viewer.StateCreator.appendCmd(b,"set labelPointer "+(0==c.length?"off":c));0!=(a.defaultZPos&32)?J.viewer.StateCreator.appendCmd(b,"set labelFront"):
0!=(a.defaultZPos&16)&&J.viewer.StateCreator.appendCmd(b,"set labelGroup");J.viewer.StateCreator.appendCmd(b,J.shape.Shape.getFontCommand("label",J.util.JmolFont.getFont3D(a.defaultFontId)));return b.toString()},$fz.isPrivate=!0,$fz),"J.shape.Labels");$_M(c$,"getSelectionState",($fz=function(a,b){var c=new JU.SB;null!=b&&(b.append("  _setSelectionState;\n"),c.append("function _setSelectionState() {\n"));J.viewer.StateCreator.appendCmd(c,this.getTrajectoryState());var d=new java.util.Hashtable,e=null;
J.viewer.StateCreator.addBs(c,"hide ",a.bsHidden);J.viewer.StateCreator.addBs(c,"subset ",a.bsSubset);J.viewer.StateCreator.addBs(c,"delete ",a.bsDeleted);J.viewer.StateCreator.addBs(c,"fix ",a.bsFixed);d.put("-",a.bsSelection);e=this.getCommands(d,null,"select");null==e?J.viewer.StateCreator.appendCmd(c,"select none"):c.append(e);J.viewer.StateCreator.appendCmd(c,"set hideNotSelected "+a.hideNotSelected);c.append(this.viewer.getShapeProperty(1,"selectionState"));this.viewer.getSelectionHaloEnabled(!1)&&
J.viewer.StateCreator.appendCmd(c,"SelectionHalos ON");null!=b&&c.append("}\n\n");return c.toString()},$fz.isPrivate=!0,$fz),"J.viewer.SelectionManager,JU.SB");Clazz.overrideMethod(c$,"getTrajectoryState",function(){var a="",b=this.viewer.modelSet;if(null==b.trajectorySteps)return"";for(var c=b.modelCount;0<=--c;){var d=b.models[c].getSelectedTrajectory();0<=d&&(a=" or "+b.getModelNumberDotted(d)+a,c=b.models[c].trajectoryBaseIndex)}0<a.length&&(a="set trajectory {"+a.substring(4)+"}");return a});
$_M(c$,"getViewState",($fz=function(a,b){var c=new JU.SB,d=a.getMoveToText(0,!1);null!=b&&(b.append("  _setPerspectiveState;\n"),c.append("function _setPerspectiveState() {\n"));J.viewer.StateCreator.appendCmd(c,"set perspectiveModel "+a.perspectiveModel);J.viewer.StateCreator.appendCmd(c,"set scaleAngstromsPerInch "+a.scale3DAngstromsPerInch);J.viewer.StateCreator.appendCmd(c,"set perspectiveDepth "+a.perspectiveDepth);J.viewer.StateCreator.appendCmd(c,"set visualRange "+a.visualRange);a.isWindowCentered()||
J.viewer.StateCreator.appendCmd(c,"set windowCentered false");J.viewer.StateCreator.appendCmd(c,"set cameraDepth "+a.cameraDepth);var e=1==a.mode;e&&J.viewer.StateCreator.appendCmd(c,"set navigationMode true");J.viewer.StateCreator.appendCmd(c,this.viewer.getBoundBoxCommand(!1));J.viewer.StateCreator.appendCmd(c,"center "+J.util.Escape.eP(a.fixedRotationCenter));c.append(this.viewer.getOrientationText(1073742035,null));J.viewer.StateCreator.appendCmd(c,d);a.stereoMode!==J.constant.EnumStereoMode.NONE&&
J.viewer.StateCreator.appendCmd(c,"stereo "+(null==a.stereoColors?a.stereoMode.getName():J.util.Escape.escapeColor(a.stereoColors[0])+" "+J.util.Escape.escapeColor(a.stereoColors[1]))+" "+a.stereoDegrees);!e&&!a.zoomEnabled&&J.viewer.StateCreator.appendCmd(c,"zoom off");c.append("  slab ").appendI(a.slabPercentSetting).append(";depth ").appendI(a.depthPercentSetting).append(a.slabEnabled&&!e?";slab on":"").append(";\n");c.append("  set slabRange ").appendF(a.slabRange).append(";\n");a.zShadeEnabled&&
c.append("  set zShade;\n");try{null!=a.zSlabPoint&&c.append("  set zSlab ").append(J.util.Escape.eP(a.zSlabPoint)).append(";\n")}catch(f){if(!Clazz.exceptionOf(f,Exception))throw f;}null!=a.slabPlane&&c.append("  slab plane ").append(J.util.Escape.eP4(a.slabPlane)).append(";\n");null!=a.depthPlane&&c.append("  depth plane ").append(J.util.Escape.eP4(a.depthPlane)).append(";\n");c.append(this.getSpinState(!0)).append("\n");this.viewer.modelSetHasVibrationVectors()&&a.vibrationOn&&J.viewer.StateCreator.appendCmd(c,
"set vibrationPeriod "+a.vibrationPeriod+";vibration on");e&&(c.append(a.getNavigationState()),(null!=a.depthPlane||null!=a.slabPlane)&&c.append("  slab on;\n"));null!=b&&c.append("}\n\n");return c.toString()},$fz.isPrivate=!0,$fz),"J.viewer.TransformManager,JU.SB");Clazz.overrideMethod(c$,"getSpinState",function(){var a=this.viewer.transformManager,b="  set spinX "+Clazz.floatToInt(a.spinX)+"; set spinY "+Clazz.floatToInt(a.spinY)+"; set spinZ "+Clazz.floatToInt(a.spinZ)+"; set spinFps "+Clazz.floatToInt(a.spinFps)+
";";Float.isNaN(a.navFps)||(b+="  set navX "+Clazz.floatToInt(a.navX)+"; set navY "+Clazz.floatToInt(a.navY)+"; set navZ "+Clazz.floatToInt(a.navZ)+"; set navFps "+Clazz.floatToInt(a.navFps)+";");a.navOn&&(b+=" navigation on;");if(!a.spinOn)return b;var c=a.isSpinSelected?"\n  select "+J.util.Escape.eBS(this.viewer.getSelectionSet(!1))+";\n  rotateSelected":"\n ";if(a.isSpinInternal){var d=JU.P3.newP(a.internalRotationCenter);d.sub(a.rotationAxis);b+=c+" spin "+a.rotationRate+" "+J.util.Escape.eP(a.internalRotationCenter)+
" "+J.util.Escape.eP(d)}else b=a.isSpinFixed?b+(c+" spin axisangle "+J.util.Escape.eP(a.rotationAxis)+" "+a.rotationRate):b+" spin on";return b+";"},"~B");Clazz.overrideMethod(c$,"getInfo",function(a){return Clazz.instanceOf(a,J.viewer.AnimationManager)?this.getAnimationInfo(a):null},"~O");$_M(c$,"getAnimationInfo",($fz=function(a){var b=new java.util.Hashtable;b.put("firstModelIndex",Integer.$valueOf(a.firstFrameIndex));b.put("lastModelIndex",Integer.$valueOf(a.lastFrameIndex));b.put("animationDirection",
Integer.$valueOf(a.animationDirection));b.put("currentDirection",Integer.$valueOf(a.currentDirection));b.put("displayModelIndex",Integer.$valueOf(a.currentModelIndex));null!=a.animationFrames&&(b.put("isMovie",Boolean.TRUE),b.put("frames",J.util.Escape.eAI(a.animationFrames)),b.put("currentAnimationFrame",Integer.$valueOf(a.currentAnimationFrame)));b.put("displayModelNumber",this.viewer.getModelNumberDotted(a.currentModelIndex));b.put("displayModelName",0<=a.currentModelIndex?this.viewer.getModelName(a.currentModelIndex):
"");b.put("animationFps",Integer.$valueOf(a.animationFps));b.put("animationReplayMode",a.animationReplayMode.name());b.put("firstFrameDelay",Float.$valueOf(a.firstFrameDelay));b.put("lastFrameDelay",Float.$valueOf(a.lastFrameDelay));b.put("animationOn",Boolean.$valueOf(a.animationOn));b.put("animationPaused",Boolean.$valueOf(a.animationPaused));return b},$fz.isPrivate=!0,$fz),"J.viewer.AnimationManager");Clazz.overrideMethod(c$,"getCommands",function(a,b,c){var d=new JU.SB;a=J.viewer.StateCreator.getCommands2(a,
d,null,c);null!=b&&J.viewer.StateCreator.getCommands2(b,d,a,"select");return d.toString()},"java.util.Map,java.util.Map,~S");c$.getCommands2=$_M(c$,"getCommands2",($fz=function(a,b,c,d){if(null==a)return"";var e;for(a=a.entrySet().iterator();a.hasNext()&&((e=a.next())||1);){var f=e.getKey(),g=J.util.Escape.eBS(e.getValue());5>g.length||(g=d+" "+g,g.equals(c)||J.viewer.StateCreator.appendCmd(b,g),c=g,0!=f.indexOf("-")&&J.viewer.StateCreator.appendCmd(b,f))}return c},$fz.isPrivate=!0,$fz),"java.util.Map,JU.SB,~S,~S");
c$.appendCmd=$_M(c$,"appendCmd",($fz=function(a,b){0!=b.length&&a.append("  ").append(b).append(";\n")},$fz.isPrivate=!0,$fz),"JU.SB,~S");c$.addBs=$_M(c$,"addBs",($fz=function(a,b,c){null==c||0==c.length()||J.viewer.StateCreator.appendCmd(a,b+J.util.Escape.eBS(c))},$fz.isPrivate=!0,$fz),"JU.SB,~S,JU.BS");Clazz.overrideMethod(c$,"getFontState",function(a,b){var c=J.viewer.StateManager.getObjectIdFromName(a.equalsIgnoreCase("axes")?"axis":a);if(0>c)return"";var d=this.viewer.getObjectMad(c),c=(new JU.SB).append("\n");
J.viewer.StateCreator.appendCmd(c,a+(0==d?" off":1==d?" on":-1==d?" dotted":20>d?" "+d:" "+d/2E3));if(3>c.length())return"";d=J.shape.Shape.getFontCommand(a,b);0<d.length&&(d="  "+d+";\n");return c+d},"~S,J.util.JmolFont");Clazz.overrideMethod(c$,"getFontLineShapeState",function(a,b,c){var d=0<=a.indexOf(" off"),e=new JU.SB;e.append(a);for(a=0;4>a;a++)null!=c[a]&&this.appendTickInfo(b,e,c[a]);d&&e.append("  "+b+" off;\n");return e.toString()},"~S,~S,~A");$_M(c$,"appendTickInfo",($fz=function(a,b,
c){b.append("  ");b.append(a);J.viewer.StateCreator.addTickInfo(b,c,!1);b.append(";\n")},$fz.isPrivate=!0,$fz),"~S,JU.SB,J.modelset.TickInfo");c$.addTickInfo=$_M(c$,"addTickInfo",($fz=function(a,b,c){a.append(" ticks ").append(b.type).append(" ").append(J.util.Escape.eP(b.ticks));var d=null!=b.scale&&Float.isNaN(b.scale.x);d&&a.append(" UNITCELL");null!=b.tickLabelFormats&&a.append(" format ").append(J.util.Escape.eAS(b.tickLabelFormats,!1));!d&&null!=b.scale&&a.append(" scale ").append(J.util.Escape.eP(b.scale));
c&&(!Float.isNaN(b.first)&&0!=b.first)&&a.append(" first ").appendF(b.first);null!=b.reference&&a.append(" point ").append(J.util.Escape.eP(b.reference))},$fz.isPrivate=!0,$fz),"JU.SB,J.modelset.TickInfo,~B");Clazz.overrideMethod(c$,"getShapeSetState",function(a,b,c,d,e,f,g){for(var h=J.viewer.JC.shapeClassBases[b.shapeID],k=0;k<c;k++){var l=d[k].firstAtomIndex,j=d[k].lastAtomIndex;if(null!=a.bsSizeSet&&(a.bsSizeSet.get(k)||null!=a.bsColixSet&&a.bsColixSet.get(k)))e.get(k)?J.util.BSUtil.setMapBitSet(f,
l,j,h+(a.bsSizeSet.get(k)?" on":" off")):J.util.BSUtil.setMapBitSet(f,l,j,h+" "+a.mads[k]/2E3);null!=a.bsColixSet&&a.bsColixSet.get(k)&&J.util.BSUtil.setMapBitSet(g,l,j,J.shape.Shape.getColorCommand(h,a.paletteIDs[k],a.colixes[k],b.translucentAllowed))}},"J.shape.AtomShape,J.shape.Shape,~N,~A,JU.BS,java.util.Map,java.util.Map");Clazz.overrideMethod(c$,"getMeasurementState",function(a,b,c,d,e){var f=new JU.SB;J.viewer.StateCreator.appendCmd(f,"measures delete");for(var g=0;g<c;g++){var h=b.get(g),
k=h.getCount(),l=(new JU.SB).append("measure");null!=h.thisID&&l.append(" ID ").append(J.util.Escape.eS(h.thisID));0!=h.mad&&l.append(" radius ").appendF(null==h.thisID||0<h.mad?h.mad/2E3:0);0!=h.colix&&l.append(" color ").append(J.util.Escape.escapeColor(J.util.C.getArgb(h.colix)));null!=h.text&&(l.append(" font ").append(h.text.font.getInfo()),null!=h.text.pymolOffset&&l.append(" offset ").append(J.util.Escape.eAF(h.text.pymolOffset)));var j=h.tickInfo;null!=j&&J.viewer.StateCreator.addTickInfo(l,
j,!0);for(j=1;j<=k;j++)l.append(" ").append(h.getLabel(j,!0,!0));l.append("; # "+a.getInfoAsString(g));J.viewer.StateCreator.appendCmd(f,l.toString())}J.viewer.StateCreator.appendCmd(f,"select *; set measures "+this.viewer.getMeasureDistanceUnits());J.viewer.StateCreator.appendCmd(f,J.shape.Shape.getFontCommand("measures",d));d=0;k=new java.util.Hashtable;l=J.util.BSUtil.newBitSet(c);for(g=0;g<c;g++)h=b.get(g),h.isHidden&&(d++,l.set(g)),null!=a.bsColixSet&&a.bsColixSet.get(g)&&J.util.BSUtil.setMapBitSet(k,
g,g,J.shape.Shape.getColorCommandUnk("measure",h.colix,a.translucentAllowed)),null!=h.getStrFormat()&&J.util.BSUtil.setMapBitSet(k,g,g,"measure "+J.util.Escape.eS(h.getStrFormat()));if(0<d)if(d==c)J.viewer.StateCreator.appendCmd(f,"measures off; # lines and numbers off");else for(g=0;g<c;g++)l.get(g)&&J.util.BSUtil.setMapBitSet(k,g,g,"measure off");null!=e&&(f.append(" measure "),J.viewer.StateCreator.addTickInfo(f,e,!0),f.append(";\n"));0<=a.mad&&f.append(" set measurements "+a.mad/2E3).append(";\n");
a=this.getCommands(k,null,"select measures");null!=a&&0!=a.length&&(f.append(a),J.viewer.StateCreator.appendCmd(f,"select measures ({null})"));return f.toString()},"J.shape.Measures,JU.List,~N,J.util.JmolFont,J.modelset.TickInfo");Clazz.overrideMethod(c$,"getBondState",function(a,b,c){this.clearTemp();var d=this.viewer.modelSet,e=d.bonds,f=d.bondCount,g;if(c||null!=a.bsSizeSet)for(d=c?f-1:a.bsSizeSet.nextSetBit(0);0<=d;d=c?d-1:a.bsSizeSet.nextSetBit(d+1))J.util.BSUtil.setMapBitSet(this.temp,d,d,"wireframe "+
(1==(g=e[d].mad)?"on":""+g/2E3));if(c||null!=b)for(d=c?f-1:b.nextSetBit(0);0<=d;d=c?d-1:b.nextSetBit(d+1))g=e[d],(c||0==(g.order&131072))&&J.util.BSUtil.setMapBitSet(this.temp,d,d,"bondOrder "+J.util.JmolEdge.getBondOrderNameFromOrder(g.order));if(null!=a.bsColixSet)for(d=a.bsColixSet.nextSetBit(0);0<=d;d=a.bsColixSet.nextSetBit(d+1))b=e[d].colix,2==(b&-30721)?J.util.BSUtil.setMapBitSet(this.temp,d,d,J.shape.Shape.getColorCommand("bonds",J.constant.EnumPalette.CPK.id,b,a.translucentAllowed)):J.util.BSUtil.setMapBitSet(this.temp,
d,d,J.shape.Shape.getColorCommandUnk("bonds",b,a.translucentAllowed));a=this.getCommands(this.temp,null,"select BONDS")+"\n";this.clearTemp();return a},"J.shape.Shape,JU.BS,~B");$_M(c$,"clearTemp",($fz=function(){this.temp.clear();this.temp2.clear()},$fz.isPrivate=!0,$fz));Clazz.overrideMethod(c$,"getAtomShapeSetState",function(a,b){this.clearTemp();for(var c=b.length;0<=--c;){var d=b[c];0<d.monomerCount&&(d.isActive&&!(null==d.bsSizeSet&&null==d.bsColixSet))&&this.viewer.getShapeSetState(d,a,d.monomerCount,
d.getMonomers(),d.bsSizeDefault,this.temp,this.temp2)}c="\n"+this.getCommands(this.temp,this.temp2,9==a.shapeID?"Backbone":"select");this.clearTemp();return c},"J.shape.Shape,~A");$_M(c$,"getShapeState",function(a){var b;switch(a.shapeID){case 30:b=new JU.SB;b.append("\n  set echo off;\n");var c;for(a=a.objects.values().iterator();a.hasNext()&&((c=a.next())||1);)b.append(this.getTextState(c)),c.hidden&&b.append("  set echo ID ").append(J.util.Escape.eS(c.target)).append(" hidden;\n");b=b.toString();
break;case 8:b=this.getAtomShapeState(a)+(2==a.colixSelection?"":0==a.colixSelection?"  color SelectionHalos NONE;\n":J.shape.Shape.getColorCommandUnk("selectionHalos",a.colixSelection,a.translucentAllowed)+";\n");null!=a.bsHighlight&&(b+="  set highlight "+J.util.Escape.eBS(a.bsHighlight)+"; "+J.shape.Shape.getColorCommandUnk("highlight",a.colixHighlight,a.translucentAllowed)+";\n");break;case 34:this.clearTemp();if(null!=a.atomFormats)for(b=this.viewer.getAtomCount();0<=--b;)null!=a.atomFormats[b]&&
J.util.BSUtil.setMapBitSet(this.temp,b,b,"set hoverLabel "+J.util.Escape.eS(a.atomFormats[b]));b="\n  hover "+J.util.Escape.eS(null==a.labelFormat?"":a.labelFormat)+";\n"+this.getCommands(this.temp,null,"select");this.clearTemp();break;case 5:this.clearTemp();for(b=a.bsSizeSet.nextSetBit(0);0<=b;b=a.bsSizeSet.nextSetBit(b+1)){c=a.getLabel(b);var d=null;null!=c&&(d="label "+J.util.Escape.eS(c.textUnformatted),null!=c.pymolOffset&&(d+=";set labelOffset "+J.util.Escape.eAF(c.pymolOffset)));null==d&&
(d="label "+J.util.Escape.eS(a.formats[b]));J.util.BSUtil.setMapBitSet(this.temp,b,b,d);null!=a.bsColixSet&&a.bsColixSet.get(b)&&J.util.BSUtil.setMapBitSet(this.temp2,b,b,J.shape.Shape.getColorCommand("label",a.paletteIDs[b],a.colixes[b],a.translucentAllowed));null!=a.bsBgColixSet&&a.bsBgColixSet.get(b)&&J.util.BSUtil.setMapBitSet(this.temp2,b,b,"background label "+J.shape.Shape.encodeColor(a.bgcolixes[b]));c=a.getLabel(b);c=null!=c?c.getScalePixelsPerMicron():0;0<c&&J.util.BSUtil.setMapBitSet(this.temp2,
b,b,"set labelScaleReference "+1E4/c);if(null!=a.offsets&&a.offsets.length>b){c=a.offsets[b];J.util.BSUtil.setMapBitSet(this.temp2,b,b,"set "+(128==(c&128)?"labelOffsetExact ":"labelOffset ")+J.viewer.JC.getXOffset(c>>8)+" "+-J.viewer.JC.getYOffset(c>>8));var d=J.viewer.JC.getAlignmentName(c>>2),e=J.viewer.JC.getPointer(c);0<e.length&&J.util.BSUtil.setMapBitSet(this.temp2,b,b,"set labelPointer "+e);0!=(c&32)?J.util.BSUtil.setMapBitSet(this.temp2,b,b,"set labelFront"):0!=(c&16)&&J.util.BSUtil.setMapBitSet(this.temp2,
b,b,"set labelGroup");0<d.length&&J.util.BSUtil.setMapBitSet(this.temp3,b,b,"set labelAlignment "+d)}null!=a.mads&&0>a.mads[b]&&J.util.BSUtil.setMapBitSet(this.temp2,b,b,"set toggleLabel");null!=a.bsFontSet&&a.bsFontSet.get(b)&&J.util.BSUtil.setMapBitSet(this.temp2,b,b,J.shape.Shape.getFontCommand("label",J.util.JmolFont.getFont3D(a.fids[b])))}b=this.getCommands(this.temp,this.temp2,"select")+this.getCommands(null,this.temp3,"select");this.temp3.clear();this.clearTemp();break;case 0:this.clearTemp();
c=this.viewer.getAtomCount();var d=this.viewer.modelSet.atoms,e=a.colixes,f=a.paletteIDs,g=0;for(b=0;b<c;b++)if(null!=a.bsSizeSet&&a.bsSizeSet.get(b)&&(0>(g=d[b].madAtom)?J.util.BSUtil.setMapBitSet(this.temp,b,b,"Spacefill on"):J.util.BSUtil.setMapBitSet(this.temp,b,b,"Spacefill "+g/2E3)),null!=a.bsColixSet&&a.bsColixSet.get(b)){var h=d[b].getPaletteID();(h!=J.constant.EnumPalette.CPK.id||d[b].isTranslucent())&&J.util.BSUtil.setMapBitSet(this.temp,b,b,J.shape.Shape.getColorCommand("atoms",h,d[b].getColix(),
a.translucentAllowed));null!=e&&b<e.length&&J.util.BSUtil.setMapBitSet(this.temp2,b,b,J.shape.Shape.getColorCommand("balls",f[b],e[b],a.translucentAllowed))}b=this.getCommands(this.temp,this.temp2,"select");this.clearTemp();break;default:b=""}return b},"J.shape.Shape");$_M(c$,"getTextState",($fz=function(a){var b=new JU.SB,c=a.getText();if(null==c||a.isLabelOrHover||a.target.equals("error"))return"";var d=null!=a.image,e=null,f="set echo ID "+J.util.Escape.eS(a.target);switch(a.valign){case 0:e=2147483647==
a.movableXPercent||2147483647==a.movableYPercent?(2147483647==a.movableXPercent?a.movableX+" ":a.movableXPercent+"% ")+(2147483647==a.movableYPercent?a.movableY+"":a.movableYPercent+"%"):"["+a.movableXPercent+" "+a.movableYPercent+"%]";case 4:null==e&&(e=J.util.Escape.eP(a.xyz));b.append("  ").append(f).append(" ").append(e);1!=a.align&&b.append(";  ").append(f).append(" ").append(J.viewer.JC.hAlignNames[a.align]);break;default:b.append("  set echo ").append(J.viewer.JC.vAlignNames[a.valign]).append(" ").append(J.viewer.JC.hAlignNames[a.align])}0==
a.valign&&2147483647!=a.movableZPercent&&b.append(";  ").append(f).append(" depth ").appendI(a.movableZPercent);d?b.append("; ").append(f).append(" IMAGE /*file*/"):b.append("; echo ");b.append(J.util.Escape.eS(c));b.append(";\n");d&&1!=a.imageScale&&b.append("  ").append(f).append(" scale ").appendF(a.imageScale).append(";\n");null!=a.script&&b.append("  ").append(f).append(" script ").append(J.util.Escape.eS(a.script)).append(";\n");0<=a.modelIndex&&b.append("  ").append(f).append(" model ").append(this.viewer.getModelNumberDotted(a.modelIndex)).append(";\n");
null!=a.pointerPt&&b.append("  ").append(f).append(" point ").append(Clazz.instanceOf(a.pointerPt,J.modelset.Atom)?"({"+a.pointerPt.index+"})":J.util.Escape.eP(a.pointerPt)).append(";\n");b.append("  "+J.shape.Shape.getFontCommand("echo",a.font));0<a.scalePixelsPerMicron&&b.append(" "+1E4/a.scalePixelsPerMicron);b.append("; color echo");J.util.C.isColixTranslucent(a.colix)&&b.append(" translucent "+J.util.C.getColixTranslucencyFractional(a.colix));b.append(" ").append(J.util.C.getHexCode(a.colix));
0!=a.bgcolix&&(b.append("; color echo background"),J.util.C.isColixTranslucent(a.bgcolix)&&b.append(" translucent "+J.util.C.getColixTranslucencyFractional(a.bgcolix)),b.append(" ").append(J.util.C.getHexCode(a.bgcolix)));b.append(";\n");return b.toString()},$fz.isPrivate=!0,$fz),"J.modelset.Text");Clazz.overrideMethod(c$,"getLoadState",function(a){var b=this.viewer.global,c=new JU.SB;J.viewer.StateCreator.appendCmd(c,"set allowEmbeddedScripts false");b.allowEmbeddedScripts&&b.setB("allowEmbeddedScripts",
!0);J.viewer.StateCreator.appendCmd(c,"set appendNew "+b.appendNew);J.viewer.StateCreator.appendCmd(c,"set appletProxy "+J.util.Escape.eS(b.appletProxy));J.viewer.StateCreator.appendCmd(c,"set applySymmetryToBonds "+b.applySymmetryToBonds);0<b.atomTypes.length&&J.viewer.StateCreator.appendCmd(c,"set atomTypes "+J.util.Escape.eS(b.atomTypes));J.viewer.StateCreator.appendCmd(c,"set autoBond "+b.autoBond);b.axesOrientationRasmol&&J.viewer.StateCreator.appendCmd(c,"set axesOrientationRasmol true");J.viewer.StateCreator.appendCmd(c,
"set bondRadiusMilliAngstroms "+b.bondRadiusMilliAngstroms);J.viewer.StateCreator.appendCmd(c,"set bondTolerance "+b.bondTolerance);J.viewer.StateCreator.appendCmd(c,"set defaultLattice "+J.util.Escape.eP(b.ptDefaultLattice));J.viewer.StateCreator.appendCmd(c,"set defaultLoadFilter "+J.util.Escape.eS(b.defaultLoadFilter));J.viewer.StateCreator.appendCmd(c,'set defaultLoadScript ""');0<b.defaultLoadScript.length&&b.setS("defaultLoadScript",b.defaultLoadScript);J.viewer.StateCreator.appendCmd(c,"set defaultStructureDssp "+
b.defaultStructureDSSP);var d=this.viewer.getDefaultVdwTypeNameOrData(-2147483648,null);J.viewer.StateCreator.appendCmd(c,"set defaultVDW "+d);d.equals("User")&&J.viewer.StateCreator.appendCmd(c,this.viewer.getDefaultVdwTypeNameOrData(2147483647,null));J.viewer.StateCreator.appendCmd(c,"set forceAutoBond "+b.forceAutoBond);J.viewer.StateCreator.appendCmd(c,"#set defaultDirectory "+J.util.Escape.eS(b.defaultDirectory));J.viewer.StateCreator.appendCmd(c,"#set loadFormat "+J.util.Escape.eS(b.loadFormat));
J.viewer.StateCreator.appendCmd(c,"#set loadLigandFormat "+J.util.Escape.eS(b.loadLigandFormat));J.viewer.StateCreator.appendCmd(c,"#set smilesUrlFormat "+J.util.Escape.eS(b.smilesUrlFormat));J.viewer.StateCreator.appendCmd(c,"#set nihResolverFormat "+J.util.Escape.eS(b.nihResolverFormat));J.viewer.StateCreator.appendCmd(c,"#set pubChemFormat "+J.util.Escape.eS(b.pubChemFormat));J.viewer.StateCreator.appendCmd(c,"#set edsUrlFormat "+J.util.Escape.eS(b.edsUrlFormat));J.viewer.StateCreator.appendCmd(c,
"#set edsUrlCutoff "+J.util.Escape.eS(b.edsUrlCutoff));J.viewer.StateCreator.appendCmd(c,"set legacyAutoBonding "+b.legacyAutoBonding);J.viewer.StateCreator.appendCmd(c,"set legacyHAddition "+b.legacyHAddition);J.viewer.StateCreator.appendCmd(c,"set minBondDistance "+b.minBondDistance);J.viewer.StateCreator.appendCmd(c,"set minimizationCriterion  "+b.minimizationCriterion);J.viewer.StateCreator.appendCmd(c,"set minimizationSteps  "+b.minimizationSteps);J.viewer.StateCreator.appendCmd(c,"set pdbAddHydrogens "+
(null!=a&&a.get("pdbNoHydrogens")!==Boolean.TRUE?b.pdbAddHydrogens:!1));J.viewer.StateCreator.appendCmd(c,"set pdbGetHeader "+b.pdbGetHeader);J.viewer.StateCreator.appendCmd(c,"set pdbSequential "+b.pdbSequential);J.viewer.StateCreator.appendCmd(c,"set percentVdwAtom "+b.percentVdwAtom);J.viewer.StateCreator.appendCmd(c,"set smallMoleculeMaxAtoms "+b.smallMoleculeMaxAtoms);J.viewer.StateCreator.appendCmd(c,"set smartAromatic "+b.smartAromatic);b.zeroBasedXyzRasmol&&J.viewer.StateCreator.appendCmd(c,
"set zeroBasedXyzRasmol true");return c.toString()},"java.util.Map");Clazz.overrideMethod(c$,"getAllSettings",function(a){for(var b=this.viewer.global,c=new JU.SB,d=Array(b.htBooleanParameterFlags.size()+b.htNonbooleanParameterValues.size()+b.htUserVariables.size()),e=0,f="_"+a,g,h=b.htBooleanParameterFlags.keySet().iterator();h.hasNext()&&((g=h.next())||1);)if(null==a||0==g.indexOf(a)||0==g.indexOf(f))d[e++]=(0==g.indexOf("_")?g+" = ":"set "+g+" ")+b.htBooleanParameterFlags.get(g);for(h=b.htNonbooleanParameterValues.keySet().iterator();h.hasNext()&&
((g=h.next())||1);)if("@"!=g.charAt(0)&&(null==a||0==g.indexOf(a)||0==g.indexOf(f))){var k=b.htNonbooleanParameterValues.get(g);Clazz.instanceOf(k,String)&&(k=J.viewer.StateCreator.chop(J.util.Escape.eS(k)));d[e++]=(0==g.indexOf("_")?g+" = ":"set "+g+" ")+k}for(h=b.htUserVariables.keySet().iterator();h.hasNext()&&((g=h.next())||1);)if(null==a||0==g.indexOf(a))k=b.htUserVariables.get(g),f=k.asString(),d[e++]=g+" "+(g.startsWith("@")?"":"= ")+(4==k.tok?J.viewer.StateCreator.chop(J.util.Escape.eS(f)):
f);java.util.Arrays.sort(d,0,e);for(a=0;a<e;a++)null!=d[a]&&J.viewer.StateCreator.appendCmd(c,d[a]);c.append("\n");return c.toString()},"~S");c$.chop=$_M(c$,"chop",($fz=function(a){var b=a.length;if(512>b)return a;for(var c=new JU.SB,d=0,e=72;e<b;d=e,e+=72){for(;"\\"==a.charAt(e-1);)e++;c.append(0==d?"":'"\\\n    + "').append(a.substring(d,e))}c.append('"\\\n    + "').append(a.substring(d,b));return c.toString()},$fz.isPrivate=!0,$fz),"~S");Clazz.overrideMethod(c$,"getAtomShapeState",function(a){this.clearTemp();
var b=J.viewer.JC.shapeClassBases[a.shapeID];if(null!=a.bsSizeSet)for(var c=a.bsSizeSet.nextSetBit(0);0<=c;c=a.bsSizeSet.nextSetBit(c+1))J.util.BSUtil.setMapBitSet(this.temp,c,c,b+(0>a.mads[c]?" on":" "+a.mads[c]/2E3));if(null!=a.bsColixSet)for(c=a.bsColixSet.nextSetBit(0);0<=c;c=a.bsColixSet.nextSetBit(c+1))J.util.BSUtil.setMapBitSet(this.temp2,c,c,J.shape.Shape.getColorCommand(b,a.paletteIDs[c],a.colixes[c],a.translucentAllowed));a=this.getCommands(this.temp,this.temp2,"select");this.clearTemp();
return a},"J.shape.AtomShape");Clazz.overrideMethod(c$,"getFunctionCalls",function(a){null==a&&(a="");var b=new JU.SB,c=a.indexOf("*"),d=0<=c,e=0==a.indexOf("static_"),f=a.equalsIgnoreCase("names")||a.equalsIgnoreCase("static_names");f&&(a="");d&&(a=a.substring(0,c));a=a.toLowerCase();for(var c=e?J.viewer.Viewer.staticFunctions:this.viewer.localFunctions,e=Array(c.size()),g=0,h,k=c.keySet().iterator();k.hasNext()&&((h=k.next())||1);)if(0==a.length&&!h.startsWith("_")||h.equalsIgnoreCase(a)||d&&0==
h.toLowerCase().indexOf(a))e[g++]=h;java.util.Arrays.sort(e,0,g);for(a=0;a<g;a++)d=c.get(e[a]),b.append(f?d.getSignature():d.toString()),b.appendC("\n");return b.toString()},"~S");c$.isTainted=$_M(c$,"isTainted",($fz=function(a,b,c){return null!=a&&null!=a[c]&&a[c].get(b)},$fz.isPrivate=!0,$fz),"~A,~N,~N");Clazz.overrideMethod(c$,"getAtomicPropertyState",function(a,b){if(!this.viewer.global.preserveState)return"";for(var c,d=new JU.SB,e=0;14>e;e++)if(0>a||e==a)null!=(c=null!=b?b:this.viewer.getTaintedAtoms(e))&&
this.getAtomicPropertyStateBuffer(d,e,c,null,null);return d.toString()},"~N,JU.BS");Clazz.overrideMethod(c$,"getAtomicPropertyStateBuffer",function(a,b,c,d,e){if(this.viewer.global.preserveState){var f=new JU.SB;d=(null==d?J.modelset.AtomCollection.userSettableValues[b]:d)+" set";var g=0,h=2==b,k=this.viewer.modelSet.atoms,l=this.viewer.modelSet.tainted;if(null!=c)for(var j=c.nextSetBit(0);0<=j;j=c.nextSetBit(j+1)){f.appendI(j+1).append(" ").append(k[j].getElementSymbol()).append(" ").append(k[j].getInfo().$replace(" ",
"_")).append(" ");switch(b){case 14:j<e.length&&f.appendF(e[j]);break;case 13:f.appendI(k[j].getAtomNumber());break;case 0:f.append(k[j].getAtomName());break;case 1:f.append(k[j].getAtomType());break;case 2:J.viewer.StateCreator.isTainted(l,j,2)&&(h=!1);f.appendF(k[j].x).append(" ").appendF(k[j].y).append(" ").appendF(k[j].z);break;case 12:var m=k[j].getVibrationVector();null==m&&(m=new JU.V3);f.appendF(m.x).append(" ").appendF(m.y).append(" ").appendF(m.z);break;case 3:f.appendI(k[j].getAtomicAndIsotopeNumber());
break;case 4:f.appendI(k[j].getFormalCharge());break;case 6:f.appendF(k[j].getBondingRadiusFloat());break;case 7:f.appendI(k[j].getOccupancy100());break;case 8:f.appendF(k[j].getPartialCharge());break;case 9:f.appendF(k[j].getBfactor100()/100);break;case 10:f.appendI(k[j].getValence());break;case 11:f.appendF(k[j].getVanderwaalsRadiusFloat(this.viewer,J.constant.EnumVdw.AUTO))}f.append(" ;\n");++g}0!=g&&(h&&(d+="(default)"),a.append('\n  DATA "'+d+'"\n').appendI(g).append(" ;\nJmol Property Data Format 1 -- Jmol ").append(J.viewer.Viewer.getJmolVersion()).append(";\n"),
a.appendSB(f),a.append('  end "'+d+'";\n'))}},"JU.SB,~N,JU.BS,~S,~A");Clazz.overrideMethod(c$,"getAtomDefs",function(a){var b=new JU.SB,c;for(a=a.entrySet().iterator();a.hasNext()&&((c=a.next())||1);)Clazz.instanceOf(c.getValue(),JU.BS)&&b.append("{"+c.getKey()+"} <"+c.getValue().cardinality()+" atoms>\n");return b.append("\n").toString()},"java.util.Map");Clazz.overrideMethod(c$,"undoMoveAction",function(a,b){switch(a){case 4165:case 4139:switch(b){case -2:this.viewer.undoClear();break;case -1:(4165==
a?this.viewer.actionStates:this.viewer.actionStatesRedo).clear();break;case 0:b=2147483647;default:100<b&&(b=(4165==a?this.viewer.actionStates:this.viewer.actionStatesRedo).size());for(var c=0;c<b;c++)this.undoMoveActionClear(0,a,!0)}}},"~N,~N");Clazz.overrideMethod(c$,"undoMoveActionClear",function(a,b,c){if(this.viewer.global.preserveState){var d=0<=a?this.viewer.modelSet.atoms[a].modelIndex:this.viewer.modelSet.modelCount-1;switch(b){case 4139:case 4165:this.viewer.stopMinimization();var e="";
switch(b){default:case 4165:e=this.viewer.actionStates;a=this.viewer.actionStatesRedo;break;case 4139:if(e=this.viewer.actionStatesRedo,a=this.viewer.actionStates,1==this.viewer.actionStatesRedo.size())return}if(0==e.size()||this.undoWorking)return;this.undoWorking=!0;a.add(0,e.remove(0));e=this.viewer.actionStatesRedo.get(0);4165==b&&1==a.size()&&(a=[1],b=JU.ParserJS.parseIntNext(e,a),a=JU.ParserJS.parseIntNext(e,a),this.undoMoveActionClear(a,b,!1));this.viewer.modelSet.models[d].isModelkit()||0>
e.indexOf("zap ")?(J.util.Logger.debugging&&this.viewer.log(e),this.viewer.evalStringQuiet(e)):this.viewer.actionStates.clear();break;default:if(this.undoWorking&&c)return;this.undoWorking=!0;e=new JU.SB;e.append("#"+b+" "+a+" "+new java.util.Date+"\n");0<=a?(d=this.viewer.getModelUndeletedAtomsBitSet(d),this.viewer.modelSet.taintAtoms(d,b),e.append(this.getAtomicPropertyState(-1,null))):(d=this.viewer.getModelUndeletedAtomsBitSet(d),e.append("zap "),e.append(J.util.Escape.eBS(d)).append(";"),J.viewer.DataManager.getInlineData(e,
this.viewer.getModelExtract(d,!1,!0,"MOL"),!0,null),e.append("set refreshing false;").append(this.viewer.actionManager.getPickingState()).append(this.viewer.transformManager.getMoveToText(0,!1)).append("set refreshing true;"));c?(this.viewer.actionStates.add(0,e.toString()),this.viewer.actionStatesRedo.clear()):this.viewer.actionStatesRedo.add(1,e.toString());100==this.viewer.actionStates.size()&&this.viewer.actionStates.remove(99)}this.undoWorking=!c}},"~N,~N,~B");Clazz.overrideMethod(c$,"syncScript",
function(a,b,c){var d=this.viewer.statusManager;if("GET_GRAPHICS".equalsIgnoreCase(a))d.setSyncDriver(5),d.syncSend(a,b,0),this.viewer.setBooleanProperty("_syncMouse",!1),this.viewer.setBooleanProperty("_syncScript",!1);else{"=".equals(b)&&(b="~",d.setSyncDriver(2));var e="~".equals(b);if(0<c||!e&&!".".equals(b))if(d.syncSend(a,b,c),!"*".equals(b)||a.startsWith("{"))return;if(a.equalsIgnoreCase("on")||a.equalsIgnoreCase("true"))d.setSyncDriver(1);else if(a.equalsIgnoreCase("off")||a.equalsIgnoreCase("false"))d.setSyncDriver(0);
else if(a.equalsIgnoreCase("slave"))d.setSyncDriver(2);else if(b=d.getSyncMode(),0!=b)if(1!=b&&(e=!1),J.util.Logger.debugging&&J.util.Logger.debug(this.viewer.htmlName+" syncing with script: "+a),e&&d.setSyncDriver(3),0!=a.indexOf("Mouse: "))if(a.startsWith("Peaks: [")){a=J.util.Escape.unescapeStringArray(a.substring(7));d=new JU.List;for(e=0;e<a.length;e++)d.addLast(a[e]);this.viewer.getModelSet().setModelAuxiliaryInfo(this.viewer.getCurrentModelIndex(),"jdxAtomSelect_1HNMR",d)}else{if(a.startsWith("Select: ")){d=
J.util.Parser.getQuotedAttribute(a,"file");d.startsWith(J.viewer.StateCreator.SIMULATION_PROTOCOL+"MOL=")&&(d=null);var f=J.util.Parser.getQuotedAttribute(a,"model"),g=J.util.Parser.getQuotedAttribute(a,"baseModel"),e=J.util.Parser.getQuotedAttribute(a,"atoms");b=J.util.Parser.getQuotedAttribute(a,"select");c=J.util.Parser.getQuotedAttribute(a,"script");null!=f&&f.startsWith("$")&&(d=this.viewer.setLoadFormat(f,"$",!1));f=null==f?null:(null==d?"":d+"#")+f;"".equals(g)&&(f+=".baseModel");a=null==f?
-3:this.viewer.getModelIndexFromId(f);if(-2==a)return;a=-1==a&&null!=d?a="load "+J.util.Escape.eS(d):"";a=J.util.Txt.simpleReplace(a,J.viewer.StateCreator.SIMULATION_PROTOCOL,"");null!=f&&(a+=";model "+J.util.Escape.eS(f));null!=e?a+=";select visible & (@"+J.util.Txt.simpleReplace(e,","," or @")+")":null!=b&&(a+=";select visible & ("+b+")");null!=c&&(a+=";"+c)}else if(a.toUpperCase().startsWith("JSPECVIEW")){e||d.syncSend(this.viewer.fullName+"JSpecView"+a.substring(9),">",0);return}this.viewer.evalStringQuietSync(a,
!0,!1)}else this.mouseScript(a),e&&this.viewer.setSyncDriver(4)}},"~S,~S,~N");Clazz.overrideMethod(c$,"mouseScript",function(a){var b=JU.ParserJS.getTokens(a),c=b[1];try{switch(c=(c.toLowerCase()+"...............").substring(0,15),"zoombyfactor...zoomby.........rotatezby......rotatexyby.....translatexyby..rotatemolecule.spinxyby.......rotatearcball..".indexOf(c)){case 0:switch(b.length){case 3:this.viewer.zoomByFactor(JU.ParserJS.parseFloat(b[2]),2147483647,2147483647);return;case 5:this.viewer.zoomByFactor(JU.ParserJS.parseFloat(b[2]),
JU.ParserJS.parseInt(b[3]),JU.ParserJS.parseInt(b[4]));return}break;case 15:switch(b.length){case 3:this.viewer.zoomBy(JU.ParserJS.parseInt(b[2]));return}break;case 30:switch(b.length){case 3:this.viewer.rotateZBy(JU.ParserJS.parseInt(b[2]),2147483647,2147483647);return;case 5:this.viewer.rotateZBy(JU.ParserJS.parseInt(b[2]),JU.ParserJS.parseInt(b[3]),JU.ParserJS.parseInt(b[4]))}break;case 45:this.viewer.rotateXYBy(JU.ParserJS.parseFloat(b[2]),JU.ParserJS.parseFloat(b[3]));return;case 60:this.viewer.translateXYBy(JU.ParserJS.parseInt(b[2]),
JU.ParserJS.parseInt(b[3]));return;case 75:this.viewer.rotateSelected(JU.ParserJS.parseFloat(b[2]),JU.ParserJS.parseFloat(b[3]),null);return;case 90:this.viewer.spinXYBy(JU.ParserJS.parseInt(b[2]),JU.ParserJS.parseInt(b[3]),JU.ParserJS.parseFloat(b[4]));return;case 105:this.viewer.rotateArcBall(JU.ParserJS.parseInt(b[2]),JU.ParserJS.parseInt(b[3]),JU.ParserJS.parseFloat(b[4]));return}}catch(d){if(!Clazz.exceptionOf(d,Exception))throw d;}this.viewer.showString("error reading SYNC command: "+a,!1)},
"~S");Clazz.defineStatics(c$,"SIMULATION_PROTOCOL","http://SIMULATION/","MAX_ACTION_UNDO",100)});
