(function(W,X,Y,Z,S,$,A,I,D,K,G,T,aa,M,ba,H,v,Q,R,N,P,ca,U,da,ea,fa,ga,O,ha,ia,V,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,g,k){A("JS");D(["JU.BS","$.V3"],"JS.VTemp",null,function(){var b=G(function(){this.bsTemp=this.vNorm4=this.vNorm3=this.vNorm2=this.vTemp2=this.vTemp1=this.vB=this.vA=this.vTemp=null;K(this,arguments)},JS,"VTemp",null);N(b,function(){this.vTemp=new JU.V3;this.vA=new JU.V3;this.vB=new JU.V3;this.vTemp1=new JU.V3;this.vTemp2=new JU.V3;this.vNorm2=new JU.V3;
this.vNorm3=new JU.V3;this.vNorm4=new JU.V3;this.bsTemp=new JU.BS})});A("J.api");U(J.api,"SmilesMatcherInterface");A("JS");D(["J.api.SmilesMatcherInterface"],"JS.SmilesMatcher","JU.AU $.BS $.PT JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesGenerator $.SmilesParser $.SmilesSearch JU.BSUtil $.Elements $.Logger".split(" "),function(){var b=G(function(){this.okMF=!0;K(this,arguments)},JS,"SmilesMatcher",null,J.api.SmilesMatcherInterface);k(b,"getLastException",function(){return!0==this.okMF?
JS.InvalidSmilesException.getLastError():"MF_FAILED"});k(b,"getMolecularFormula",function(a,c,f){this.clearExceptions();a=JS.SmilesParser.newSearch("/nostereo/"+a.toString(),c,!0);a.createTopoMap(null);a.nodes=a.target.nodes;return a.getMolecularFormula(!c,null,f)},"~O,~B,~B");g(b,"clearExceptions",function(){JS.InvalidSmilesException.clear()});k(b,"getSmiles",function(a,c,f,e,d){this.clearExceptions();return(new JS.SmilesGenerator).getSmiles(this,a,c,f,e,d)},"~A,~N,JU.BS,~S,~N");k(b,"areEqual",function(a,
c){this.clearExceptions();if(null==a!=(null==c))return 0;if(null==a)return 1;var f=!1;if("string"==typeof a&&"string"==typeof c&&(f=0<=a.indexOf("*"),!f&&a.equals(c)))return 1;f=this.matchPriv(a,null,0,null,null,!1,(f?2:1)|8,2,this.newSearch(c));return null==f?-1:f.length},"~O,~O");g(b,"areEqualTest",function(a,c){c.set();var f=this.matchPriv(a,null,0,null,null,!1,9,2,c);return null!=f&&1==f.length},"~S,JS.SmilesSearch");k(b,"find",function(a,c,f){this.clearExceptions();"string"==typeof c&&(c=JS.SmilesParser.cleanPattern(c));
"string"==typeof a&&(a=JS.SmilesParser.cleanPattern(a));c=this.newSearch(c);a=this.matchPriv(a,null,0,null,null,!1,f,3,c);for(f=a.length;0<=--f;)for(var e=a[f],d=e.length;0<=--d;)e[d]=c.target.nodes[e[d]].mapIndex;return a},"~O,~O,~N");k(b,"getAtoms",function(a){this.clearExceptions();a=this.newSearch(a);a.createTopoMap(new JU.BS);return a.target.nodes},"~O");g(b,"newSearch",function(a){return null==a?null:I(a,"JS.SmilesSearch")?a:JS.SmilesParser.newSearch(JS.SmilesParser.cleanPattern(a.toString()),
!1,!0)},"~O");k(b,"getRelationship",function(a,c){if(null==a||null==c||0==a.length||0==c.length)return"";var f=this.getMolecularFormula(a,!1,!1),e=this.getMolecularFormula(c,!1,!1);if(!f.equals(e))return"none";var d,f=JU.PT.countChar(JU.PT.rep(a,"@@","@"),"@"),e=JU.PT.countChar(JU.PT.rep(c,"@@","@"),"@");d=f==e&&0<this.areEqual(c,a);if(!d){d=a+c;if(0<=d.indexOf("/")||0<=d.indexOf("\\")||0<=d.indexOf("@")){if(f==e&&(0<f&&0>d.indexOf("@SP"))&&(d=0<this.areEqual("/invertstereo/"+c,a)))return"enantiomers";
if(d=0<this.areEqual("/nostereo/"+c,a))return f==e?"diastereomers":"ambiguous stereochemistry!"}return"constitutional isomers"}return"identical"},"~S,~S");k(b,"reverseChirality",function(a){a=JU.PT.rep(a,"@@","!@");a=JU.PT.rep(a,"@","@@");return a=JU.PT.rep(a,"!@@","@")},"~S");k(b,"getSubstructureSet",function(a,c,f,e,d){var l=I(c,"JS.SmilesSearch")?null:c;return this.matchPriv(a,l,f,e,null,!0,d|("string"==typeof a?JS.SmilesParser.getFlags(a.toString()):0),1,null==l?c:null)},"~O,~O,~N,JU.BS,~N");
k(b,"getMMFF94AtomTypes",function(a,c,f,e,d,l){this.clearExceptions();var j=new JS.SmilesParser(!0,!0),h=null,h=j.parse("");h.exitFirstMatch=!1;h.target.setAtoms(c,Math.abs(f),e);h.flags=770;h.getRingData(l,!0,!0);h.asVector=!1;h.subSearches=Array(1);h.getSelections();c=new JU.BS;for(e=0;e<a.length;e++)if(null==a[e]||0==a[e].length||a[e].startsWith("#"))d.addLast(null);else if(h.clear(),h.subSearches[0]=j.getSubsearch(h,JS.SmilesParser.cleanPattern(a[e]),770),l=JU.BSUtil.copy(h.search()),d.addLast(l),
c.or(l),c.cardinality()==f)break},"~A,~A,~N,JU.BS,JU.Lst,~A");k(b,"getSubstructureSetArray",function(a,c,f,e,d,l){return this.matchPriv(a,c,f,e,d,!0,l,2,null)},"~O,~A,~N,JU.BS,JU.BS,~N");g(b,"getAtropisomerKeys",function(a,c,f,e,d,l){return this.matchPriv(a,c,f,e,d,!1,l,4,null)},"~S,~A,~N,JU.BS,JU.BS,~N");k(b,"polyhedronToSmiles",function(a,c,f,e,d,l){for(var j=Array(f),h=0;h<f;h++){j[h]=new JS.SmilesAtom;var b=null==e?null:e[h];I(b,"JU.Node")?(j[h].elementNumber=b.getElementNumber(),j[h].bioAtomName=
b.getAtomName(),j[h].atomNumber=b.getAtomNumber(),j[h].setT(b)):(j[h].elementNumber=I(b,"JU.Point3fi")?b.sD:-2,null!=b&&j[h].setT(b));j[h].index=h}b=0;for(h=c.length;0<=--h;)for(var n=c[h],g=n.length,m,t,r=g;0<=--r;)if(!((m=n[r])>=f||(t=n[(r+1)%g])>=f)&&null==j[m].getBondTo(j[t]))(new JS.SmilesBond(j[m],j[t],1,!1)).index=b++;for(h=0;h<f;h++)if(g=j[h].bondCount,0==g||g!=j[h].bonds.length)j[h].bonds=JU.AU.arrayCopyObject(j[h].bonds,g);c=null;c=new JS.SmilesGenerator;null!=e&&(c.polySmilesCenter=a);
this.clearExceptions();c=c.getSmiles(this,j,f,JU.BSUtil.newBitSet2(0,f),null,d|4144);65536==(d&65536)&&(c=(0==(d&131072)?"":"//* "+a+" *//\t")+"["+JU.Elements.elementSymbolFromNumber(a.getElementNumber())+"@PH"+f+(null==l?"":"/"+l+"/")+"]."+c);return c},"JU.Node,~A,~N,~A,~N,~S");k(b,"getCorrelationMaps",function(a,c,f,e,d){return this.matchPriv(a,c,f,e,null,!0,d,3,null)},"~O,~A,~N,JU.BS,~N");g(b,"matchPriv",function(a,c,f,e,d,l,j,h,b){this.clearExceptions();try{var n=I(a,"JS.SmilesSearch");n&&(j|=
2,a.reset());var g=n?a:JS.SmilesParser.newSearch(null==a?null:a.toString(),2==(j&2),!1);null!=b&&b.setFlags(j|b.flags|(n?0:JS.SmilesParser.getFlags(a.toString())));return this.matchPattern(g,c,f,e,d,l,j,h,b)}catch(m){if(H(m,Exception))throw JU.Logger.debugging&&m.printStackTrace(),null==JS.InvalidSmilesException.getLastError()&&this.clearExceptions(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw m;}},"~O,~A,~N,JU.BS,JU.BS,~B,~N,~N,JS.SmilesSearch");g(b,"matchPattern",
function(a,c,f,e,d,l,j,h,b){var n=2==(j&2);this.okMF=!0;if(null!=b)if(b.targetSet)a.setTarget(b);else if(a.haveSmilesTarget=!0,d=new JU.BS,b.createTopoMap(d),c=b.target.nodes,f=b.target.nodes.length,n){var g=b.elementCounts,m=a.elementCounts,t=a.elementNumberMax;if(t<=b.elementNumberMax)for(b=1;b<=t;b++){if(g[b]<m[b]){this.okMF=!1;break}}else this.okMF=!1}else if(g=a.getMFArray(!0,null,!1),m=b.getMFArray(!0,null,!1),t=b.elementNumberMax,t==a.elementNumberMax)for(b=2;b<=t;b++){if(g[b]!=m[b]){this.okMF=
!1;break}}else this.okMF=!1;if(this.okMF&&(!n&&!a.patternAromatic&&(null==d&&(d=new JU.BS),a.normalizeAromaticity(d),a.isNormalized=!0),a.targetSet||a.target.setAtoms(c,f,e),a.targetSet||0!=f&&(null==e||!e.isEmpty())))c=a.targetSet||!I(c[0],"JS.SmilesAtom"),a.getSelections(),l||(a.target.bsAromatic=d),a.target.hasRingData(j)||a.setRingData(null,null,c||l||a.patternAromatic),a.exitFirstMatch=8==(j&8),a.mapUnique=128==(j&128);switch(h){case 1:return a.asVector=!1,this.okMF?a.search():new JU.BS;case 2:if(!this.okMF)return[];
a.asVector=!0;a=a.search();return a.toArray(Array(a.size()));case 4:if(!this.okMF)return"";a.exitFirstMatch=!0;a.setAtropicity=!0;a.search();return a.atropKeys;case 3:if(!this.okMF)return v(0,0,0);a.getMaps=!0;a.setFlags(j|a.flags);a=a.search();return a.toArray(JU.AU.newInt2(a.size()));case 5:if(!this.okMF)return Boolean.FALSE;a.retBoolean=!0;a.setFlags(j|a.flags);return a.search()}return null},"JS.SmilesSearch,~A,~N,JU.BS,JU.BS,~B,~N,~N,JS.SmilesSearch");k(b,"cleanSmiles",function(a){return JS.SmilesParser.cleanPattern(a)},
"~S");k(b,"getMapForJME",function(a,c,f){try{var e=JS.SmilesMatcher.jmeToMolecule(a),d=JU.BSUtil.newBitSet2(0,e.ac),l=this.getSmiles(e.patternAtoms,e.ac,d,null,34),j=this.getCorrelationMaps(l,e.patternAtoms,e.ac,d,42),b=this.getCorrelationMaps(l,c,f.cardinality(),f,42);return O(-1,[j[0],b[0]])}catch(q){if(H(q,Exception))q.printStackTrace();else throw q;}return null},"~S,~A,JU.BS");b.jmeToMolecule=g(b,"jmeToMolecule",function(a){var c=new JS.SmilesSearch;a=JU.PT.getTokens(a);for(var f=JU.PT.parseInt(a[0]),
e=JU.PT.parseInt(a[1]),d=2,l=0;l<f;l++,d+=3){var j=a[d],b=c.addAtom(),q=j.indexOf("+"),n=0;if(0<=q)n=q==j.length-1?1:JU.PT.parseInt(j.substring(q+1));else if(0<=(q=j.indexOf("-")))n=JU.PT.parseInt(j.substring(q));b.setCharge(n);b.setSymbol(0>q?j:j.substring(0,q))}for(l=0;l<e;l++){j=JU.PT.parseInt(a[d++])-1;b=JU.PT.parseInt(a[d++])-1;f=JU.PT.parseInt(a[d++]);j=c.patternAtoms[j];b=c.patternAtoms[b];q=1;switch(f){case 2:q=2;break;case 3:q=3}(new JS.SmilesBond(j,b,q,!1)).index=l}c.isSmarts=!0;c.set();
return c},"~S");k(b,"getSmilesFromJME",function(a){try{var c=JS.SmilesMatcher.jmeToMolecule(a),f=JU.BSUtil.newBitSet2(0,c.ac);return this.getSmiles(c.patternAtoms,c.ac,f,null,1)}catch(e){if(H(e,Exception))return null;throw e;}},"~S");k(b,"compileSmartsPattern",function(a){a=JS.SmilesParser.cleanPattern(a);return JS.SmilesParser.newSearch(a,!0,!1)},"~S");k(b,"compileSearchTarget",function(a,c,f){var e=new JS.SmilesSearch;e.target.setAtoms(a,c,f);e.targetSet=!0;return e},"~A,~N,JU.BS");k(b,"hasStructure",
function(a,c,f){var e=v(c.length,0);1!=(f&1)&&(f|=2);this.clearExceptions();"string"==typeof a&&(a=JS.SmilesParser.cleanPattern(a));try{for(var d="string"==typeof a?JS.SmilesParser.newSearch(a,!0,!1):a,l=0;l<c.length;l++){var j=c[l],b;"string"==typeof j?(b=this.newSearch(j),b.setFlags(b.flags|("string"==typeof a?JS.SmilesParser.getFlags(a):0))):b=j;try{this.clearExceptions(),e[l]=this.matchPattern(d,null,0,null,null,!1,f|8,5,b)===Boolean.TRUE?1:0}catch(q){if(H(q,Exception))e[l]=-1,q.printStackTrace();
else throw q;}}}catch(n){if(H(n,Exception))throw JU.Logger.debugging&&n.printStackTrace(),null==JS.InvalidSmilesException.getLastError()&&this.clearExceptions(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw n;}return e},"~O,~A,~N");b.j2sHeadless=!0});A("JS");D(["java.lang.Exception"],"JS.InvalidSmilesException",null,function(){var b=R(JS,"InvalidSmilesException",Exception);M(b,function(a){P(this,JS.InvalidSmilesException,[a]);JS.InvalidSmilesException.lastError=a.startsWith("Jmol SMILES")?
a:"Jmol SMILES Exception: "+a},"~S");b.getLastError=g(b,"getLastError",function(){return JS.InvalidSmilesException.lastError});b.clear=g(b,"clear",function(){JS.InvalidSmilesException.lastError=null});k(b,"getMessage",function(){return JS.InvalidSmilesException.lastError});b.lastError=null});A("JS");D(["JU.JmolMolecule","JU.BS","$.Lst"],"JS.SmilesSearch","java.util.Hashtable JU.AU $.SB JS.InvalidSmilesException $.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesParser $.SmilesStereo $.VTemp JU.BSUtil $.Logger".split(" "),
function(){var b=G(function(){this.isSmarts=!1;this.v=this.patternAtoms=this.pattern=this.target=this.top=null;this.patternBioSequence=this.isTopology=this.haveSmilesTarget=this.patternAromatic=this.setAtropicity=this.groupByModel=this.exitFirstMatch=this.invertStereochemistry=this.ignoreStereochemistry=this.ignoreElement=this.ignoreAtomClass=this.noAromatic=this.aromaticUnknown=this.aromaticDefined=this.aromaticMMFF94=this.aromaticDouble=this.aromaticPlanar=this.aromaticStrict=this.aromaticOpen=
this.targetSet=!1;this.subSearches=null;this.haveBondStereochemistry=this.haveSelected=!1;this.stereo=null;this.needRingData=!1;this.needAromatic=!0;this.needRingMemberships=!1;this.nDouble=0;this.ringDataMax=-2147483648;this.measures=null;this.flags=0;this.lastChainAtom=this.atropKeys=null;this.isRingCheck=this.isSilent=this.haveComponents=this.isNormalized=this.retBoolean=this.getMaps=this.asVector=!1;this.htNested=this.bsFound=null;this.nNested=0;this.bsCheck=this.bsReturn=this.uniqueList=this.vReturn=
this.nestedBond=null;this.mapUnique=!1;this.polyAtom=this.polyhedronStereo=null;this.autoAddImplicitH=!0;this.pattern0=null;K(this,arguments)},JS,"SmilesSearch",JU.JmolMolecule);N(b,function(){this.patternAtoms=Array(16);this.measures=new JU.Lst;this.bsFound=new JU.BS;this.bsReturn=new JU.BS});M(b,function(){P(this,JS.SmilesSearch,[]);this.top=this;this.target=new JS.SmilesSearch.SmilesTarget;this.v=new JS.VTemp});b.isRingBond=g(b,"isRingBond",function(a,c,f,e){if(null!=a)for(var d=a.size();0<=--d;){var l=
a.get(d);if(l.get(f)&&l.get(e)&&(null==c||c.get(d)))return!0}return!1},"JU.Lst,JU.BS,~N,~N");g(b,"setTarget",function(a){this.target=a.target;this.targetSet=!0},"JS.SmilesSearch");g(b,"setTop",function(a){for(;a.top!==a;)a=a.top;this.top=a},"JS.SmilesSearch");b.addFlags=g(b,"addFlags",function(a,c){0<=c.indexOf("OPEN")&&(a|=5);0<=c.indexOf("BIO")&&(a|=1048576);0<=c.indexOf("HYDROGEN2")?a|=8192:0<=c.indexOf("HYDROGEN")&&(a|=4096);0<=c.indexOf("FIRSTMATCHONLY")&&(a|=8);0<=c.indexOf("STRICT")&&(a|=256);
0<=c.indexOf("PLANAR")&&(a|=1024);if(0<=c.indexOf("NOAROMATIC")||0<=c.indexOf("NONAROMATIC"))a|=16;0<=c.indexOf("AROMATICDOUBLE")&&(a|=512);0<=c.indexOf("AROMATICDEFINED")&&(a|=128);0<=c.indexOf("MMFF94")&&(a|=768);0<=c.indexOf("ALLCOMPONENTS")&&(a|=32768);0<=c.indexOf("TOPOLOGY")&&(a|=16384);0<=c.indexOf("NOATOMCLASS")&&(a|=2048);0<=c.indexOf("NOSTEREO")?a|=32:0<=c.indexOf("INVERTSTEREO")&&(a=0!=(a&64)?a&-65:a|64);0<=c.indexOf("ATOMCOMMENT")&&(a|=131072);0<=c.indexOf("GROUPBYMODEL")&&(a|=67108864);
1048576==(a&1048576)&&(0<=c.indexOf("NOCOMMENT")&&(a|=34603008),0<=c.indexOf("UNMATCHED")&&(a|=3145728),0<=c.indexOf("COVALENT")&&(a|=5242880),0<=c.indexOf("HBOND")&&(a|=9437184));return a},"~N,~S");g(b,"reset",function(){this.vReturn=null;this.exitFirstMatch=this.noAromatic=!1;this.flags=0});g(b,"setFlags",function(a){this.flags=a;this.exitFirstMatch=(new Boolean(this.exitFirstMatch|8==(a&8))).valueOf();this.aromaticOpen=5==(a&5);this.aromaticStrict=256==(a&256);this.aromaticPlanar=1024==(a&1024);
this.aromaticMMFF94=768==(a&768);this.aromaticDouble=512==(a&512);this.aromaticDefined=128==(a&128);this.noAromatic=(new Boolean(this.noAromatic|16==(a&16))).valueOf();this.aromaticUnknown=!this.noAromatic&&!this.aromaticOpen&&!this.aromaticDouble&&!this.aromaticStrict&&!this.aromaticPlanar&&!this.aromaticMMFF94&&!this.aromaticDefined;this.groupByModel=67108864==(a&67108864);this.ignoreAtomClass=2048==(a&2048);this.ignoreStereochemistry=32==(a&32);this.invertStereochemistry=!this.ignoreStereochemistry&&
64==(a&64);this.ignoreElement=16384==(a&16384)},"~N");g(b,"set",function(){this.patternAtoms.length>this.ac&&(this.patternAtoms=JU.AU.arrayCopyObject(this.patternAtoms,this.ac));this.nodes=this.patternAtoms;this.isTopology=!0;this.patternAromatic=!1;this.patternBioSequence=!0;for(var a=this.ac;0<=--a;){var c=this.patternAtoms[a];this.isTopology&&c.isDefined()&&(this.isTopology=!1);c.isBioResidue||(this.patternBioSequence=!1);c.isAromatic&&(this.patternAromatic=!0);c.setBondArray();if(this.autoAddImplicitH&&
!this.isSmarts&&"\x00"==c.bioType&&!c.setHydrogenCount())throw new JS.InvalidSmilesException("unbracketed atoms must be one of: B, C, N, O, P, S, F, Cl, Br, I, *,");}if(this.haveComponents)for(a=this.ac;0<=--a;)for(var c=this.patternAtoms[a],f=c.bonds,e=c.component,d=c.bondCount;0<=--d;){var l=f[d],b;if(l.isConnection&&l.atom2===c&&(b=l.atom1.component)!=e)for(l=this.ac;0<=--l;)this.patternAtoms[l].component==e&&(this.patternAtoms[l].component=b)}});g(b,"addAtom",function(){return this.appendAtom(new JS.SmilesAtom)});
g(b,"appendAtom",function(a){this.ac>=this.patternAtoms.length&&(this.patternAtoms=JU.AU.doubleLength(this.patternAtoms));return this.patternAtoms[this.ac]=a.setIndex(this.ac++)},"JS.SmilesAtom");g(b,"addNested",function(a){null==this.htNested&&(this.htNested=new java.util.Hashtable);this.setNested(++this.nNested,a);return this.nNested},"~S");g(b,"clear",function(){this.bsReturn.clearAll();this.nNested=0;this.nestedBond=this.htNested=null;this.clearBsFound(-1)});g(b,"clearBsFound",function(a){0>a?
null==this.bsCheck&&this.bsFound.clearAll():this.bsFound.clear(a)},"~N");g(b,"setNested",function(a,c){this.top.htNested.put("_"+a,c)},"~N,~O");g(b,"getNested",function(a){return this.top.htNested.get("_"+a)},"~N");g(b,"getMissingHydrogenCount",function(){for(var a=0,c,f=0;f<this.ac;f++)if(0<=(c=this.patternAtoms[f].explicitHydrogenCount))a+=c;return a});g(b,"setRingData",function(a,c,f){if(this.isTopology||this.patternBioSequence)this.needAromatic=!1;if(this.needAromatic=(new Boolean(this.needAromatic&
(new Boolean(null==a&!this.noAromatic)).valueOf())).valueOf())this.needRingData=!0;if(!this.needAromatic&&(this.target.bsAromatic.clearAll(),null!=a&&this.target.bsAromatic.or(a),!this.needRingMemberships&&!this.needRingData))return;this.getRingData(c,this.needRingData,f)},"JU.BS,~A,~B");g(b,"getRingData",function(a,c,f){var e=this.needAromatic&&(this.aromaticStrict||!this.aromaticOpen&&!this.aromaticPlanar);e&&this.aromaticUnknown&&0<this.target.ac&&this.target.nodes[this.target.bsSelected.nextSetBit(0)].modelIsRawPDB()&&
(e=!1);var d=this.needAromatic&&this.aromaticOpen&&!this.aromaticStrict,l=this.needAromatic&&!e,b=this.needAromatic&&f&&(e||d),h=this.needAromatic&&!this.aromaticDefined,q=null==a?new JU.Lst:a[3]=new JU.Lst,n=b?new JU.Lst:null,g=!e?0:this.aromaticMMFF94?2:1;this.needAromatic&&this.aromaticDefined&&(this.target.checkAromaticDefined(),g=0);this.ringDataMax=this.target.setRingData(g,c,this.ringDataMax);if(!(3>this.target.selectedAtomCount)){for(var m="****",t=this.ringDataMax;m.length<t;)m+=m;for(var r=
b&&h?v(this.target.ac,0):null,s=h&&(d||I(this.target.nodes[0],"JS.SmilesAtom")),p=3;p<=t&&!(p>this.target.ac);p++){var k="*1"+m.substring(0,p-2)+"*1",k=JS.SmilesParser.newSearch(k,!0,!0),k=this.subsearch(k,2);if(null!=a&&5>=p){for(var w=new JU.Lst,u=k.size();0<=--u;)w.addLast(k.get(u));a[p-3]=w}if(0!=k.size()&&(h&&(4<=p&&7>=p)&&JS.SmilesAromatic.setAromatic(p,this.target.nodes,this.target.bsSelected,k,this.target.bsAromatic,g,d,s,l,this.v,q,n,r,f),c)){this.target.ringData[p]=new JU.BS;for(w=k.size();0<=
--w;){var y=k.get(w);this.target.ringData[p].or(y);for(u=y.nextSetBit(0);0<=u;u=y.nextSetBit(u+1))this.target.ringCounts[u]++}}}this.needAromatic&&(b&&JS.SmilesAromatic.finalizeAromatic(this.target.nodes,this.target.bsAromatic,q,n,r,d,e),this.target.finalizeAromatic(q));c&&this.target.finalizeRingData()}},"~A,~B,~B");g(b,"subsearch",function(a,c){a.mapUnique=this.mapUnique;a.target=this.target;a.htNested=this.htNested;a.haveSmilesTarget=this.haveSmilesTarget;a.bsCheck=this.bsCheck;a.isSmarts=!0;switch(c){case 1:a.exitFirstMatch=
!1;break;case 2:a.isRingCheck=!0;a.isSilent=!0;a.asVector=!0;break;case 3:a.ignoreAtomClass=this.ignoreAtomClass,a.aromaticDouble=this.aromaticDouble,a.haveSelected=this.haveSelected,a.exitFirstMatch=this.exitFirstMatch,a.getMaps=this.getMaps,a.retBoolean=this.retBoolean,a.asVector=this.asVector,a.vReturn=this.vReturn,a.bsReturn=this.bsReturn,a.haveBondStereochemistry=this.haveBondStereochemistry}return a.search2(1==c)},"JS.SmilesSearch,~N");g(b,"search",function(){this.bsReturn.clearAll();return this.search2(!1)});
g(b,"search2",function(a){this.setFlags(this.flags);!this.isRingCheck&&(JU.Logger.debuggingHigh&&!this.isSilent)&&JU.Logger.debug("SmilesSearch processing "+this.pattern);if(null==this.vReturn&&(this.asVector||this.getMaps))this.vReturn=new JU.Lst;if(null!=this.subSearches)for(a=0;a<this.subSearches.length&&!(null!=this.subSearches[a]&&(this.subsearch(this.subSearches[a],3),this.exitFirstMatch&&(null==this.vReturn?0<=this.bsReturn.nextSetBit(0):0<this.vReturn.size())));a++);else 0<this.ac&&this.ac<=
this.target.selectedAtomCount&&(null==this.nestedBond?this.clearBsFound(-1):this.bsReturn.clearAll(),this.nextPatternAtom(-1,-1,a,-1));return this.asVector||this.getMaps?this.vReturn:!this.retBoolean?this.bsReturn:Boolean.$valueOf(!this.bsReturn.isEmpty())},"~B");g(b,"nextPatternAtom",function(a,c,f,e){var d,l;if(++a<this.ac){var b=this.patternAtoms[a],h=0<=c?b.getBondTo(null):0==a?this.nestedBond:null;if(null==h){c=JU.BSUtil.copy(this.bsFound);var q=JU.BSUtil.copy(this.bsFound);if(0<=b.notBondedIndex)if(d=
this.patternAtoms[b.notBondedIndex],h=d.getMatchingAtom(),d.isBioAtom)d=h.getOffsetResidueAtom("\x00",1),0<=d&&c.set(d),d=h.getOffsetResidueAtom("\x00",-1),0<=d&&c.set(d);else if(d===this.polyAtom)c.set(d.getMatchingAtomIndex());else{l=h.getEdges();for(d=0;d<l.length;d++)c.set(l[d].getOtherNode(h).getIndex())}l=b.isBioAtomWild;d=this.target.bsSelected.nextSetBit(0);d=l&&0<=d?this.target.nodes[d].getOffsetResidueAtom("\x00",d):d;for(var n,g=(0<a?this.patternAtoms[a-1]:b).component,m=b.component,t=
this.haveComponents&&-2147483648!=m,h=d;0<=h;h=this.target.bsSelected.nextSetBit(h+1)){if(!c.get(h)&&!this.bsFound.get(h)){d=this.target.nodes[h];if(t&&!this.isRingCheck&&(e=this.groupByModel?d.getModelIndex():d.getMoleculeNumber(!1),n=0<a?this.patternAtoms[a-1].matchingComponent:e,g==m!=(n==e)))continue;if(!this.nextTargetAtom(b,d,a,h,f,e))return!1}l&&(d=this.target.nodes[h].getOffsetResidueAtom(b.bioAtomName,1),0<=d&&(h=d-1))}this.bsFound=q;return!0}d=h.atom1.getMatchingAtom();switch(h.order){case 96:h=
d.getOffsetResidueAtom(b.bioAtomName,1);if(0<=h){c=JU.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);if(this.doCheckAtom(h)&&!this.nextTargetAtom(b,this.target.nodes[h],a,h,f,e))return!1;this.bsFound=c}return!0;case 112:l=new JU.Lst;d.getCrossLinkVector(l,!0,!0);c=JU.BSUtil.copy(this.bsFound);d.getGroupBits(this.bsFound);for(h=2;h<l.size();h+=3)if(q=l.get(h).intValue(),this.doCheckAtom(q)&&!this.nextTargetAtom(b,this.target.nodes[q],a,q,f,e))return!1;this.bsFound=c;return!0}l=d.getEdges();
if(null!=l)for(h=0;h<l.length;h++)if(q=d.getBondedAtomIndex(h),this.doCheckAtom(q)&&!this.nextTargetAtom(b,this.target.nodes[q],a,q,f,e))return!1;this.clearBsFound(c);return!0}if(!this.ignoreStereochemistry&&!this.isRingCheck){if(JU.Logger.debuggingHigh){for(b=0;b<a;b++)JU.Logger.debug("pattern atoms "+this.patternAtoms[b]+" "+this.patternAtoms[b].matchingComponent);JU.Logger.debug("--ss-- "+this.bsFound.cardinality())}if(!this.checkStereochemistry())return!0}c=new JU.BS;for(h=e=0;h<this.ac;h++)if(b=
this.patternAtoms[h].getMatchingAtomIndex(),f||!this.top.haveSelected||this.patternAtoms[h].selected){e++;c.set(b);this.patternAtoms[h].isBioAtomWild&&this.target.nodes[b].getGroupBits(c);if(f)break;if(!this.isSmarts&&!this.setAtropicity&&0<this.patternAtoms[h].explicitHydrogenCount){b=this.target.nodes[b];d=0;for(l=b.getEdges().length;d<l;d++)q=b.getBondedAtomIndex(d),1==this.target.nodes[q].getElementNumber()&&c.set(q)}}if(!this.isSmarts&&c.cardinality()!=this.target.selectedAtomCount)return!0;
if(null!=this.bsCheck)if(f){this.bsCheck.clearAll();for(h=0;h<this.ac;h++)this.bsCheck.set(this.patternAtoms[h].getMatchingAtomIndex());if(this.bsCheck.cardinality()!=this.ac)return!0}else if(c.cardinality()!=this.ac)return!0;this.bsReturn.or(c);if(this.getMaps){if(this.mapUnique){null==this.uniqueList&&(this.uniqueList=new JU.Lst);for(h=this.uniqueList.size();0<=--h;)if(this.uniqueList.get(h).equals(c))return!0;this.uniqueList.addLast(c)}a=v(e,0);for(c=h=0;h<this.ac;h++)if(f||!this.top.haveSelected||
this.patternAtoms[h].selected)a[c++]=this.patternAtoms[h].getMatchingAtomIndex();this.vReturn.addLast(a);return!this.exitFirstMatch}if(this.asVector){f=!0;for(h=this.vReturn.size();0<=--h&&f;)f=!this.vReturn.get(h).equals(c);if(!f)return!0;this.vReturn.addLast(c)}if(this.isRingCheck){f=new JU.BS;for(d=3*a+2;--d>a;)f.set(this.patternAtoms[(d<=2*a?2*a-d+1:d-1)%a].getMatchingAtomIndex());this.target.ringSets.addLast(f);return!0}return this.exitFirstMatch?!1:c.cardinality()!=this.target.selectedAtomCount},
"~N,~N,~B,~N");g(b,"doCheckAtom",function(a){return this.target.bsSelected.get(a)&&!this.bsFound.get(a)},"~N");g(b,"nextTargetAtom",function(a,c,f,e,d,l){if(!this.isRingCheck&&!this.isTopology)if(null==a.subAtoms){if(!this.checkPrimitiveAtom(a,e))return!0}else if(a.isAND)for(var b=0;b<a.nSubAtoms;b++){if(!this.checkPrimitiveAtom(a.subAtoms[b],e))return!0}else{for(b=0;b<a.nSubAtoms;b++)if(!this.nextTargetAtom(a.subAtoms[b],c,f,e,d,l))return!1;return!0}c=c.getEdges();for(b=a.getBondCount();0<=--b;){var h=
a.getBond(b);if(h.getAtomIndex2()==a.index){var q=h.atom1,n=q.getMatchingAtomIndex();switch(h.order){case 96:case 112:if(!this.checkMatchBond(a,q,h,e,n,null))return!0;break;default:for(var g=0,m=null;g<c.length&&(!(m=c[g]).isCovalent()||!(m.getAtomIndex1()==n||m.getAtomIndex2()==n));g++);if(g==c.length||!this.checkMatchBond(a,q,h,e,n,m))return!0}}}a=this.patternAtoms[a.index];a.setMatchingAtom(this.target.nodes[e],e);a.matchingComponent=l;this.bsFound.set(e);if(!this.nextPatternAtom(f,e,d,l))return!1;
0<=e&&this.clearBsFound(e);return!0},"JS.SmilesAtom,JU.Node,~N,~N,~B,~N");g(b,"checkPrimitiveAtom",function(a,c){if(0<a.nSubAtoms){for(var f=0;f<a.nSubAtoms;f++)if(this.checkPrimitiveAtom(a.subAtoms[f],c))return!0;return!1}for(var e=this.target.nodes[c],f=a.not;;){if(0<a.iNested){f=this.getNested(a.iNested);I(f,"JS.SmilesSearch")&&(a.isBioAtom&&(f.nestedBond=a.getBondTo(null)),f=this.subsearch(f,1),null==f&&(f=new JU.BS),a.isBioAtom||this.setNested(a.iNested,f));f=a.not!=f.get(c);break}var d=e.getElementNumber(),
b=a.elementNumber;if(0<=d&&0<=b&&b!=d&&!this.ignoreElement)break;if(a.isBioResidue){if(null!=a.bioAtomName&&(a.isLeadAtom()?!e.isLeadAtom():!a.bioAtomName.equals(e.getAtomName().toUpperCase())))break;if(null!=a.residueName&&!a.residueName.equals(e.getGroup3(!1).toUpperCase()))break;if(-2147483648!=a.residueNumber&&a.residueNumber!=e.getResno())break;if("\x00"!=a.insCode&&a.insCode!=e.getInsertionCode())break;if(null!=a.residueChar||-2==a.elementNumber){var d=e.getBioSmilesType(),j=a.getBioSmilesType(),
h=!0,b=!1;switch(j.charCodeAt(0)){case 0:case 42:h=!0;break;case 110:h="r"==d||"c"==d;b=!0;break;case 114:case 99:b=!0;default:h=d==j}if(!h)break;h=e.getGroup1("\x00").toUpperCase();j=null==a.residueChar?"*":a.residueChar.charAt(0);h=j==h.charAt(0);switch(j.charCodeAt(0)){case 42:h=!0;break;case 78:h=b?"r"==d||"c"==d:h;break;case 82:h=b?e.isPurine():h;break;case 89:h=b?e.isPyrimidine():h}if(!h)break}if(a.isBioAtom&&a.notCrossLinked&&e.getCrossLinkVector(null,!0,!0))break}else{if(-2147483648!=a.atomNumber&&
a.atomNumber!=e.getAtomNumber())break;if(0<=a.jmolIndex&&e.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(e.getAtomType()))break;if(-2147483648!=(b=a.getAtomicMass())&&(0<=b&&b!=(d=e.getIsotopeNumber())||0>b&&0!=d&&-b!=d))break;if(!this.noAromatic&&!a.aromaticAmbiguous&&a.isAromatic!=this.target.bsAromatic.get(c))break;if(-2147483648!=(b=a.getCharge())&&b!=e.getFormalCharge())break;b=a.getCovalentHydrogenCount()+a.explicitHydrogenCount;if(0<=b&&b!=e.getTotalHydrogenCount())break;
if(-2147483648!=(b=a.implicitHydrogenCount))if(d=e.getImplicitHydrogenCount(),-1==b?0==d:b!=d)break;if(0<a.degree&&a.degree!=e.getCovalentBondCount())break;if(0<a.nonhydrogenDegree&&a.nonhydrogenDegree!=e.getCovalentBondCount()-e.getCovalentHydrogenCount())break;if(this.isSmarts&&0<a.valence&&a.valence!=e.getTotalValence())break;if(0<a.connectivity&&a.connectivity!=e.getCovalentBondCountPlusMissingH())break;if(-2147483648!=a.atomNumber&&a.atomNumber!=e.getAtomNumber())break;if(0<=a.jmolIndex&&e.getIndex()!=
a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(e.getAtomType()))break;if((!this.ignoreAtomClass||this.isSmarts)&&!Float.isNaN(a.atomClass)&&a.atomClass!=e.getFloatProperty("property_atomclass"))break;if(null!=this.target.ringData){if(-1<=a.ringSize)if(0>=a.ringSize){if(0==this.target.ringCounts[c]!=(0==a.ringSize))break}else{e=this.target.ringData[500==a.ringSize?5:600==a.ringSize?6:a.ringSize];if(null==e||!e.get(c))break;if(!this.noAromatic)if(500==a.ringSize){if(!this.target.bsAromatic5.get(c))break}else if(600==
a.ringSize&&!this.target.bsAromatic6.get(c))break}if(-1<=a.ringMembership&&(-1==a.ringMembership?0==this.target.ringCounts[c]:this.target.ringCounts[c]!=a.ringMembership))break;if(0<=a.ringConnectivity&&(b=this.target.ringConnections[c],-1==a.ringConnectivity&&0==b||-1!=a.ringConnectivity&&b!=a.ringConnectivity))break}}f=!f;break}return f},"JS.SmilesAtom,~N");g(b,"checkMatchBond",function(a,c,f,e,d,b){if(null!=f.bondsOr){for(var j=0;j<f.nBondsOr;j++)if(this.checkMatchBond(a,c,f.bondsOr[j],e,d,b))return!0;
return!1}if(!this.isRingCheck&&!this.isTopology)if(0==f.nPrimitives){if(!this.checkPrimitiveBond(f,e,d,b))return!1}else for(a=0;a<f.nPrimitives;a++)if(c=f.setPrimitive(a),!this.checkPrimitiveBond(c,e,d,b))return!1;f.matchingBond=b;return!0},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesBond,~N,~N,JU.Edge");g(b,"checkPrimitiveBond",function(a,c,f,e){var d=!1;switch(a.order){case 96:return a.isNot!=(this.target.nodes[f].getOffsetResidueAtom("\x00",1)==this.target.nodes[c].getOffsetResidueAtom("\x00",0));case 112:return a.isNot!=
this.target.nodes[c].isCrossLinked(this.target.nodes[f])}var b=!this.noAromatic&&this.target.bsAromatic.get(c),j=!this.noAromatic&&this.target.bsAromatic.get(f);e=e.getCovalentOrder();var h=a.order;if(b&&j)switch(h){case 17:case 65:d=JS.SmilesSearch.isRingBond(this.target.ringSets,null,c,f);break;case 1:d=!this.isSmarts||!JS.SmilesSearch.isRingBond(this.target.ringSets,this.target.getBSAromaticRings(),c,f);break;case 2:d=this.isNormalized||81==e||this.aromaticDouble&&(2==e||514==e);break;case 65537:case 65538:d=
!a.isNot;break;case 81:case -1:d=!0}else switch(h){case 17:if(!this.noAromatic)break;case 81:case -1:d=!0;break;case 1:case 1025:case 1041:switch(e){case 1:case 1025:case 1041:d=!0}break;case 65537:case 65538:switch(e){case 1:case 65537:case 65538:d=!a.isNot}break;case 2:case 3:case 4:d=e==h;break;case 65:d=JS.SmilesSearch.isRingBond(this.target.ringSets,null,c,f)}return d!=a.isNot},"JS.SmilesBond,~N,~N,JU.Edge");g(b,"checkStereochemistry",function(){for(var a=0;a<this.measures.size();a++)if(!this.measures.get(a).check())return!1;
if(null!=this.stereo&&!this.stereo.checkStereoChemistry(this,this.v))return!1;if(!this.haveBondStereochemistry)return!0;for(var c=null,a=null,f=0;f<this.ac;f++){for(var e=this.patternAtoms[f],d=null,b=null,j=null,h=0,q=0,n=0,g=e.getBondCount(),m=!1,t=!0,r=0;r<g;r++){var a=e.getBond(r),s=a.atom2===e,t=a.atom1.index<a.atom2.index,p=a.getBondType();switch(p){case 65537:case 65538:if(!t)continue;case 2:if(s)continue;d=a.atom2;n=p;(m=2!=p)&&(h=a.isNot?-1:1);break;case 1025:case 1041:b=s?a.atom1:a.atom2,
h=s!=(1025==p)?1:-1}}if(m){if(this.setAtropicity){null==c&&(c=new JU.Lst);c.addLast(a);continue}j=e.getBond(a.atropType[0]);if(null==j)return!1;b=j.getOtherAtom(e);j=d.getBond(a.atropType[1]);if(null==j)return!1;j=j.getOtherAtom(d);JU.Logger.debugging&&JU.Logger.info("atropisomer check for atoms "+b+e+" "+d+j)}else{if(null==d||0==h)continue;g=e;for(r=0;2==d.getBondCount()&&4==d.getValence();)r++,s=d.getEdges(),s=s[s[0].getOtherNode(d)===g?1:0],g=d,d=s.getOtherNode(d);if(1==r%2)continue;g=d.getBondCount();
for(r=0;r<g&&0==q;r++)switch(a=d.getBond(r),p=a.getBondType(),p){case 1025:case 1041:j=(s=a.atom2===d)?a.atom1:a.atom2,q=s!=(1025==p)?1:-1}if(0==q)continue}g=e.getMatchingAtom();r=d.getMatchingAtom();b=b.getMatchingAtom();j=j.getMatchingAtom();if(null==b||null==j)return!1;this.haveSmilesTarget&&JS.SmilesSearch.setTopoCoordinates(g,r,b,j,n);b=JS.SmilesMeasure.setTorsionData(b,g,r,j,this.v,m);if(m){if(b*=-1*h*(65537==n?1:-1)*(t?1:-1),JU.Logger.debugging&&JU.Logger.info("atrop dihedral "+b+" "+e+" "+
d+" "+a),1>b)return!1}else if(0>this.v.vTemp1.dot(this.v.vTemp2)*h*q)return!1}if(this.setAtropicity){this.atropKeys="";for(a=0;a<c.size();a++)this.atropKeys+=","+this.getAtropIndex(c.get(a))}return!0});g(b,"getAtropIndex",function(a){var c=Array(4),f="";c[1]=a.atom1.getMatchingAtom();c[2]=a.atom2.getMatchingAtom();for(var e=a.atom1.bonds,d,b=a.atom1.getBondCount();0<=--b;)if((d=e[b].getOtherNode(a.atom1))!==a.atom2){f+=b+1;c[0]=d.getMatchingAtom();break}e=a.atom2.bonds;for(b=0;b<=a.atom2.getBondCount();b++)if((d=
e[b].getOtherNode(a.atom2))!==a.atom1){f+=b+1;c[3]=d.getMatchingAtom();break}f.equals("22")&&(f="");f=(1==JS.SmilesStereo.getAtropicStereoFlag(c)?"":"^")+f;return(f+"   ").substring(0,3)},"JS.SmilesBond");b.setTopoCoordinates=g(b,"setTopoCoordinates",function(a,c,f,e,d){a.set(-1,0,0);c.set(1,0,0);if(2!=d)d=a.getBondTo(c),a=a.getBondedAtomIndex(d.atropType[0])==f.index,c=c.getBondedAtomIndex(d.atropType[1])==e.index,c=(65537==d.order?1:-1)*(a==c?1:-1),f.set(-1,1,0),e.set(1,1,-1*(c/2));else{e=f=0;for(var b=
a.getEdges(),j=b.length;0<=--j;)if(d=b[j],2!=d.order){var h=d.getOtherNode(a);h.set(-1,0==f++?-1:1,0);h=d.getAtomIndex2()==a.getIndex()?f:-f;switch(d.order){case 1025:e=h;break;case 1041:e=-h}}var q=0;f=0;a=Array(2);b=c.getEdges();for(j=b.length;0<=--j;)if(d=b[j],2!=d.order)switch(h=d.getOtherNode(c),a[f]=h,h.set(1,0==f++?1:-1,0),h=d.getAtomIndex2()==c.getIndex()?f:-f,d.order){case 1025:q=h;break;case 1041:q=-h}0<e*q==(Math.abs(e)%2==Math.abs(q)%2)&&(c=a[0].y,a[0].y=a[1].y,a[1].y=c)}},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,~N");
g(b,"createTopoMap",function(a){var c=null==a,f=this.autoAddImplicitH?this.getMissingHydrogenCount():0,f=this.ac+f,e=Array(f);this.target.nodes=e;for(var d=0,b=0;d<this.ac;d++,b++){var j=this.patternAtoms[d],h=j.explicitHydrogenCount;if(0>h||!this.autoAddImplicitH)h=0;var q=e[b]=(new JS.SmilesAtom).setTopoAtom(j.component,b,j.symbol,j.getCharge(),d);q.implicitHydrogenCount=h;if(!c){q.mapIndex=d;q.stereo=j.stereo;q.setAtomicMass(j.getAtomicMass());q.bioAtomName=j.bioAtomName;q.residueName=j.residueName;
q.residueChar=j.residueChar;q.residueNumber=j.residueNumber;q.atomNumber=j.residueNumber;q.insCode=j.insCode;q.hasDoubleBond=j.hasDoubleBond;q.isAromatic=j.isAromatic;q.atomClass=j.atomClass;q.explicitHydrogenCount=0;q.isBioAtom=j.isBioAtom;q.bioType=j.bioType;q.$isLeadAtom=j.$isLeadAtom;!c&&j.isAromatic&&a.set(b);j.setMatchingAtom(null,b);j=Array(j.getBondCount()+h);for(q.setBonds(j);0<=--h;){j=e[++b]=(new JS.SmilesAtom).setTopoAtom(q.component,b,"H",0,-1);j.mapIndex=-d-1;j.setBonds(Array(1));var n=
new JS.SmilesBond(q,j,1,!1);JU.Logger.debugging&&JU.Logger.info(""+n)}}}if(!c){for(d=0;d<this.ac;d++){j=this.patternAtoms[d];h=j.getMatchingAtomIndex();a=e[h];h=j.getBondCount();for(c=0;c<h;c++)if(b=j.getBond(c),b.atom1===j){n=1;switch(b.order){case 1:case 2:case 3:case 4:case 1025:case 1041:case 65537:case 65538:case 112:case 96:n=b.order;break;case 17:n=514}q=e[b.atom2.getMatchingAtomIndex()];n=new JS.SmilesBond(a,q,n,!1);n.isConnection=b.isConnection;n.atropType=b.atropType;n.isNot=b.isNot;q.bondCount--;
JU.Logger.debugging&&JU.Logger.info(""+n)}else q=e[b.atom1.getMatchingAtomIndex()],n=q.getBondTo(a),a.addBond(n)}for(d=0;d<f;d++)if(n=e[d],j=n.bonds,!(2>j.length||j[0].isFromPreviousTo(n)))for(h=j.length;1<=--h;)if(j[h].isFromPreviousTo(n)){n=j[h];j[h]=j[0];j[0]=n;break}if(!this.ignoreStereochemistry)for(d=this.ac;0<=--d;)j=this.patternAtoms[d],null!=j.stereo&&j.stereo.fixStereo(j)}},"JU.BS");g(b,"normalizeAromaticity",function(a){var c=this.patternAtoms,f=new JS.SmilesSearch;f.noAromatic=this.noAromatic;
f.setFlags(this.flags);f.target.nodes=c;f.target.ac=c.length;f.target.bsSelected=JU.BSUtil.newBitSet2(0,c.length);var e=JU.AU.createArrayOfArrayList(4);f.setRingData(null,e,!0);a.or(f.target.bsAromatic);if(!a.isEmpty()&&(a=e[3],null!=a))for(f=a.size();0<=--f;)for(var e=a.get(f),d=e.nextSetBit(0);0<=d;d=e.nextSetBit(d+1)){var b=c[d];!b.isAromatic&&!(-2==b.elementNumber||0==b.elementNumber)&&b.setSymbol(b.symbol.toLowerCase())}},"JU.BS");g(b,"getSelections",function(){var a=this.top.htNested;if(!(null==
a||0==this.target.nodes.length))for(var c=new java.util.Hashtable,f,a=a.entrySet().iterator();a.hasNext()&&((f=a.next())||1);){var e=f.getValue().toString();if(e.startsWith("select")){var d=c.containsKey(e)?c.get(e):this.target.nodes[0].findAtomsLike(e.substring(6));null==d&&(d=new JU.BS);c.put(e,d);f.setValue(d)}}});g(b,"findImplicitHydrogen",function(a){for(var c=a.getEdges().length;0<=--c;){var f=a.getBondedAtomIndex(c);if(1==this.target.nodes[f].getElementNumber()&&!this.bsFound.get(f))return this.target.nodes[f]}return null},
"JU.Node");g(b,"toString",function(){if(null!=this.pattern0)return this.pattern0;if(this.targetSet)return"molecular formula: "+this.target.getMolecularFormula(!0,null,!1);var a=(new JU.SB).append(this.pattern);a.append("\nmolecular formula: "+this.getMolecularFormula(!0,null,!1));return a.toString()});k(b,"equals",function(a){return I(a,"JS.SmilesSearch")&&(null==this.pattern0?null==a.pattern0:this.pattern0.equals(a.pattern0))},"~O");g(b,"hashCode",function(){return null==this.pattern0?V(this,JS.SmilesSearch,
"hashCode",[]):this.pattern0.hashCode()});b=G(function(){this.bsSelected=null;this.selectedAtomCount=0;this.ringSets=null;this.ringCount=0;this.ringData=null;this.ringDataMax=0;this.bsAromaticRings=this.bsAromatic6=this.bsAromatic5=this.bsAromatic=this.ringConnections=this.ringCounts=null;this.$hasRingData=!1;this.flags=-1;K(this,arguments)},JS.SmilesSearch,"SmilesTarget",JU.JmolMolecule);N(b,function(){this.bsAromatic=new JU.BS;this.bsAromatic5=new JU.BS;this.bsAromatic6=new JU.BS});g(b,"hasRingData",
function(a){a!=this.flags&&(this.flags=a,this.$hasRingData=!1);a=this.$hasRingData;this.$hasRingData=!0;return a},"~N");g(b,"setAtoms",function(a,c,f){this.$hasRingData=!1;this.nodes=a;this.ac=c;this.selectedAtomCount=null==f?c:f.cardinality();null==f&&(f=JU.BS.newN(c),f.setBits(0,c));this.bsSelected=f},"~A,~N,JU.BS");g(b,"checkAromaticDefined",function(){JS.SmilesAromatic.checkAromaticDefined(this.nodes,this.bsSelected,this.bsAromatic)});g(b,"getBSAromaticRings",function(){if(null==this.bsAromaticRings&&
(this.bsAromaticRings=new JU.BS,null!=this.ringSets&&null!=this.bsAromatic))for(var a=this.ringSets.size();0<=--a;){var c=this.ringSets.get(a).clone();c.andNot(this.bsAromatic);c.isEmpty()&&this.bsAromaticRings.set(a)}return this.bsAromaticRings});g(b,"setRingData",function(a,c,f){0>f&&(f=8);0<a&&6>f&&(f=6);c&&(this.ringCounts=v(this.ac,0),this.ringConnections=v(this.ac,0),this.ringData=Array(f+1));this.ringSets=new JU.Lst;return this.ringDataMax=f},"~N,~B,~N");g(b,"finalizeAromatic",function(a){this.bsAromatic5.clearAll();
this.bsAromatic6.clearAll();for(var c=a.size();0<=--c;){var f=a.get(c);f.and(this.bsAromatic);switch(f.cardinality()){case 5:this.bsAromatic5.or(f);break;case 6:this.bsAromatic6.or(f)}}},"JU.Lst");g(b,"finalizeRingData",function(){for(var a=this.bsSelected.nextSetBit(0);0<=a;a=this.bsSelected.nextSetBit(a+1))for(var c=this.nodes[a],f=c.getBondCount();0<=--f;)0<this.ringCounts[c.getBondedAtomIndex(f)]&&this.ringConnections[a]++});g(b,"hasDoubleBonds",function(){for(var a=0;a<this.nodes.length;a++)if(null==
this.bsSelected||this.bsSelected.get(a)){var c=this.nodes[a];if(1!=c.getElementNumber())for(var f=c.getBondCount(),c=c.getEdges(),e=0;e<f;e++)if(c[e].isCovalent()&&1!=c[e].getBondType())return!0}return!1})});A("JS");D(["java.util.Hashtable","JU.BS","JS.VTemp"],"JS.SmilesGenerator","JU.AU $.Lst $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesParser $.SmilesSearch $.SmilesStereo JU.BSUtil $.Elements $.JmolMolecule $.Logger".split(" "),function(){var b=G(function(){this.MODE_COMP_ALLOW_BIO=
1;this.MODE_COMP_ALLOW_OUTSIDE=2;this.MODE_COMP_FORCE_BRACKETS=4;this.ptSp2Atom0=this.ptAtom=0;this.atoms=null;this.ac=0;this.bsAromatic=this.bsSelected=null;this.explicitHydrogen=this.flags=0;this.vTemp=this.ringSets=null;this.nPairsMax=this.nPairs=0;this.bsToDo=this.bsBondsDn=this.bsBondsUp=null;this.bsIgnoreHydrogen=new JU.BS;this.bsIncludingH=this.bsRingKeys=this.htRings=this.htRingsSequence=this.alleneStereo=this.prevSp2Atoms=this.prevAtom=null;this.topologyOnly=!1;this.getAromatic=!0;this.openSMILES=
this.noStereo=this.aromaticDouble=this.noBioComment=this.addAtomComment=!1;this.smilesStereo=this.polySmilesCenter=null;this.isPolyhedral=!1;this.sm=this.aromaticRings=null;this.iHypervalent=0;this.forceBrackets=this.allowConnectionsToOutsideWorld=this.allowBioResidues=this.allComponents=this.noBranches=this.haveSmilesAtoms=this.is2D=!1;this.atemp=this.bsEnds=null;this.chainCheck=0;K(this,arguments)},JS,"SmilesGenerator",null);N(b,function(){this.vTemp=new JS.VTemp;this.bsBondsUp=new JU.BS;this.bsBondsDn=
new JU.BS;this.htRingsSequence=new java.util.Hashtable;this.htRings=new java.util.Hashtable;this.bsRingKeys=new JU.BS;this.bsEnds=new JU.BS});g(b,"getSmiles",function(a,c,f,e,d,b){var j=e.nextSetBit(0);if(0>j)return"";this.haveSmilesAtoms=I(c[j],"JS.SmilesAtom")&&c[j].definesStereo();this.sm=a;this.flags=b;this.atoms=c;this.ac=f;e=JU.BSUtil.copy(e);this.bsSelected=JU.BS.copy(e);this.flags=b=JS.SmilesSearch.addFlags(b,null==d?"":d.toUpperCase());if(1048576==(b&1048576))return this.getBioSmiles(e,d,
b);this.openSMILES=5==(b&5);this.addAtomComment=131072==(b&131072);this.aromaticDouble=512==(b&512);this.explicitHydrogen=8192==(b&8192)?8192:4096==(b&4096)?4096:0;if(8192==this.explicitHydrogen){a=new JU.BS;for(f=e.nextSetBit(0);0<=f;f=e.nextSetBit(f+1))if(d=c[f],3==d.getCovalentHydrogenCount()&&4==d.getCovalentBondCount()){var h=!0;a.clearAll();for(var q=d.getBondCount();0<=--q;){var n=d.getBondedAtomIndex(q);if(1==c[n].getElementNumber())if(h=1==c[n].getElementNumber())a.set(n);else break;h&&(this.bsIgnoreHydrogen.set(f),
e.andNot(a))}}}this.topologyOnly=16384==(b&16384);this.getAromatic=16!=(b&16);this.noStereo=32==(b&32);this.isPolyhedral=65536==(b&65536);this.is2D=134217728==(b&134217728);this.noBranches=!1;this.allComponents=32768==(b&32768);return this.getSmilesComponent(c[j],e,1)},"JS.SmilesMatcher,~A,~N,JU.BS,~S,~N");g(b,"getBioSmiles",function(a,c,f){this.addAtomComment=131072==(f&131072);var e=3145728==(f&3145728),b=34603008==(f&34603008),l=5242880==(f&5242880);f=9437184==(f&9437184);var j=l||f,h=new JU.SB;
null!=c&&!this.noBioComment&&h.append("//* Jmol bioSMILES ").append(c.$replace("*","_")).append(" *//");c=this.noBioComment?"":"\n";var q=new JU.BS,n=null,g="",m,t=new JU.Lst;try{for(var r=0,s=a.nextSetBit(0);0<=s;s=a.nextSetBit(s+1)){var p=this.atoms[s],k=p.getGroup1("?"),w=p.getBioStructureTypeName(),u=k===k.toLowerCase();if(null!=c)if(0<h.length()&&h.append(c),c=null,r=0,0<w.length)0!=p.getChainID()&&!b&&(m="//* chain "+p.getChainIDStr()+" "+w+" "+p.getResno()+" *// ",r=m.length,h.append(m)),r++,
h.append("~").appendC(w.toLowerCase().charAt(0)).append("~");else{m=this.getSmilesComponent(p,a,6);if(m.equals(n)){c="";continue}var n=m,y=p.getGroup3(!0),z;b?z="/"+m+"/":(null!=y&&(m="//* "+y+" *//"+m),z=m+"//");if(0<=g.indexOf(z)){c="";continue}g+=z;h.append(m);c=b?".":".\n";continue}75<=r&&!b&&(h.append("\n  "),r=2);this.addAtomComment&&h.append("\n//* ["+p.getGroup3(!1)+"#"+p.getResno()+"] *//\t");u?this.addBracketedBioName(h,p,0<w.length?".0":null,!1):h.append(k);r++;if(j){p.getCrossLinkVector(t,
l,f);for(var x=0;x<t.size();x+=3)h.append(":"),m=this.getRingCache(t.get(x).intValue(),t.get(x+1).intValue(),this.htRingsSequence),h.append(m),r+=1+m.length;t.clear()}p.getGroupBits(q);a.andNot(q);var C=p.getOffsetResidueAtom("\x00",1);if(0>C||!a.get(C)){b||h.append(" //* ").appendI(p.getResno()).append(" *//");if(0>C&&0>(C=a.nextSetBit(s+1)))break;0<r&&(c=b?".":".\n")}s=C-1}}catch(B){if(H(B,Exception))throw new JS.InvalidSmilesException("//* error: "+B.getMessage()+" *//");throw B;}if(!e&&!this.htRingsSequence.isEmpty())throw this.dumpRingKeys(h,
this.htRingsSequence),new JS.InvalidSmilesException("//* ?ring error? *//");m=h.toString();m.endsWith(".\n")?m=m.substring(0,m.length-2):b&&m.endsWith(".")&&(m=m.substring(0,m.length-1));return m},"JU.BS,~S,~N");g(b,"addBracketedBioName",function(a,c,f,b){a.append("[");if(null!=f){var d=c.getChainIDStr();a.append(c.getGroup3(!1));f.equals(".0")||a.append(f).append("#").appendI(c.getElementNumber());b&&(a.append("//* ").appendI(c.getResno()),0<d.length&&a.append(":").append(d),a.append(" *//"))}else a.append(JU.Elements.elementNameFromNumber(c.getElementNumber()));
a.append("]")},"JU.SB,JU.Node,~S,~B");g(b,"getSmilesComponent",function(a,c,f){var b="";this.allowBioResidues=0!=(f&1);this.allowConnectionsToOutsideWorld=0!=(f&2);for(this.forceBrackets=0!=(f&4);;){null==a&&(a=this.atoms[c.nextSetBit(0)]);a=this.checkFirstAtom(a);this.bsSelected=JU.JmolMolecule.getBranchBitSet(this.atoms,a.getIndex(),JU.BSUtil.copy(c),null,-1,!0,this.allowBioResidues);c.andNot(this.bsSelected);this.iHypervalent=-1;for(f=this.bsSelected.nextSetBit(0);0<=f&&0>this.iHypervalent;f=this.bsSelected.nextSetBit(f+
1))if(4<this.atoms[f].getCovalentBondCount()||this.isPolyhedral)this.iHypervalent=f;this.bsIncludingH=JU.BSUtil.copy(this.bsSelected);if(0==this.explicitHydrogen)for(f=this.bsSelected.nextSetBit(0);0<=f;f=this.bsSelected.nextSetBit(f+1)){var d=this.atoms[f];1==d.getAtomicAndIsotopeNumber()&&(0<d.getBondCount()&&d.getBondedAtomIndex(0)!=this.iHypervalent&&!this.isExplicitOnly(this.atoms[d.getBondedAtomIndex(0)]))&&this.bsSelected.clear(f)}this.bsAromatic=new JU.BS;!this.topologyOnly&&2<this.bsSelected.cardinality()&&
(this.generateRingData(),this.setBondDirections());this.bsToDo=JU.BSUtil.copy(this.bsSelected);d=new JU.SB;for(f=this.bsToDo.nextSetBit(0);0<=f;f=this.bsToDo.nextSetBit(f+1))if(4<this.atoms[f].getCovalentBondCount()||this.isPolyhedral||this.noBranches)null==a&&d.append("."),this.getSmilesAt(d,this.atoms[f],!1,!1),a=null;if(null!=a)for(;null!=(a=this.getSmilesAt(d,a,!0,!1)););for(;!this.bsToDo.isEmpty()||!this.htRings.isEmpty();){a=this.htRings.values().iterator();if(a.hasNext()){if(a=this.atoms[a.next()[1].intValue()],
!this.bsToDo.get(a.getIndex()))break}else a=this.atoms[this.bsToDo.nextSetBit(0)];d.append(".");for(this.prevAtom=this.prevSp2Atoms=this.alleneStereo=null;null!=(a=this.getSmilesAt(d,a,!0,!1)););}if(!this.htRings.isEmpty())throw this.dumpRingKeys(d,this.htRings),new JS.InvalidSmilesException("//* ?ring error? *//\n"+d);a=d.toString();if(0<=a.indexOf("^-")){d=a;try{var l=this.sm.getAtropisomerKeys(a,this.atoms,this.ac,this.bsSelected,this.bsAromatic,this.flags);for(f=1;f<l.length;){var j=a.indexOf("^-");
if(0>j)break;a=a.substring(0,j+1)+l.substring(f,f+3).trim()+a.substring(j+1);f+=3}}catch(h){if(H(h,Exception))h.printStackTrace(),a=d;else throw h;}}b+=a;if(0>c.nextSetBit(0)||!this.allComponents)break;b+=".";a=null}return b},"JU.Node,JU.BS,~N");g(b,"checkFirstAtom",function(a){0==this.explicitHydrogen&&(1==a.getAtomicAndIsotopeNumber()&&0<a.getEdges().length)&&(a=this.atoms[a.getBondedAtomIndex(0)]);for(var c=a,f=null;2==c.getCovalentBondCount();){var b=c.getEdges();if(2!=b[0].getBondType()||2!=
b[1].getBondType())break;var d=b[0].getOtherNode(c);d===f&&(d=b[1].getOtherNode(c));f=c;c=d}return null==c?a:c},"JU.Node");g(b,"generateRingData",function(){var a=JS.SmilesParser.newSearch("[r500]",!0,!0);a.target.setAtoms(this.atoms,this.ac,this.bsSelected);a.setFlags(this.flags);!a.needRingData&&a.target.hasDoubleBonds()&&(a.needRingData=!0);a.ringDataMax=7;a.flags=this.flags;var c=JU.AU.createArrayOfArrayList(4);a.setRingData(null,c,!0);this.bsAromatic=a.target.bsAromatic;this.ringSets=a.target.ringSets;
this.aromaticRings=c[3]});g(b,"getBondStereochemistry",function(a,c){if(null==a)return"\x00";var f=a.index,b=null==c||a.getAtomIndex1()==c.getIndex();return this.bsBondsUp.get(f)?b?"/":"\\":this.bsBondsDn.get(f)?b?"\\":"/":"\x00"},"JU.Edge,JU.SimpleNode");g(b,"setBondDirections",function(){for(var a=new JU.BS,c=O(2,3,null),f=this.bsSelected.nextSetBit(0);0<=f;f=this.bsSelected.nextSetBit(f+1))for(var b=this.atoms[f],d=b.getEdges(),l=0;l<d.length;l++){var j=d[l],h=j.index,q;if(!a.get(h)&&!(2!=j.getCovalentOrder()||
JS.SmilesSearch.isRingBond(this.ringSets,null,f,(q=j.getOtherNode(b)).getIndex()))){a.set(h);j=0;for(h=b;2==q.getCovalentBondCount()&&4==q.getValence();){var n=q.getEdges(),n=n[n[0].getOtherNode(q)===h?1:0];a.set(n.index);h=q;q=n.getOtherNode(q);j++}if(1!=j%2){for(var g=j=null,g=0,h=O(-1,[b,q]),m=1,n=0;2>n&&0<m&&3>m;n++)for(var m=0,t=h[n],r=t.getEdges(),s=0<this.explicitHydrogen||this.isExplicitOnly(t),p=0;p<r.length;p++){var k;if(!(1!=r[p].getCovalentOrder()||!s&&1==(k=r[p].getOtherNode(t)).getElementNumber()&&
0==k.getIsotopeNumber()))c[n][m++]=r[p],"\x00"!=this.getBondStereochemistry(r[p],t)&&(j=r[p],g=n)}if(!(3==m||0==m))if(null==j&&(g=0,j=c[g][0],this.bsBondsUp.set(j.index)),m=h[g],t=this.getBondStereochemistry(j,m),g=j.getOtherNode(m),null!=g)for(n=0;2>n;n++){r=h[n];for(s=0;2>s;s++)if(p=c[n][s],!(null==p||p===j)){var w=p.index,u=p.getOtherNode(r);if(null!=u){var y=this.getBondStereochemistry(p,r),z;if(this.haveSmilesAtoms){z=g.isStereoOpposite(u.getIndex(),m.getIndex(),r.getIndex());if(null==z){JU.Logger.debugging&&
JU.Logger.debug("SmilesGenerator could not find stereo for "+g+"/"+u);continue}z=z.booleanValue()}else z=JS.SmilesStereo.isDiaxial(m,r,g,u,this.vTemp,0);"\x00"==y||y!=t==z?("\\"==t&&z||"/"==t&&!z)==(p.getAtomIndex1()!=u.getIndex())?this.bsBondsUp.set(w):this.bsBondsDn.set(w):(this.bsBondsUp.clear(w),this.bsBondsDn.clear(w),JU.Logger.error("BOND STEREOCHEMISTRY PARITY ERROR-stereochemistry for bond "+w+""));JU.Logger.debugging&&JU.Logger.debug(this.getBondStereochemistry(j,m)+" "+g.getIndex()+" "+
u.getIndex()+" "+this.getBondStereochemistry(p,r))}}}}}}});g(b,"getSmilesAt",function(a,c,f,b){var d=c.getIndex();if(!this.bsToDo.get(d))return null;var l=a.length()-1;this.ptAtom++;this.bsToDo.clear(d);var j=d==this.iHypervalent||0!=this.explicitHydrogen&&!this.bsIgnoreHydrogen.get(d),h=this.isExplicitOnly(c),q=this.bsAromatic.get(d),g=!this.bsSelected.get(d),F=null==this.prevAtom?-1:this.prevAtom.getIndex(),m=this.prevSp2Atoms,t=null!=m,r=c.getElementNumber(),s=0,p=this.alleneStereo;this.alleneStereo=
null;var k=new JU.Lst,w=null,u=null,y=c.getEdges();!b&&null!=this.polySmilesCenter&&(f=!1,this.sortPolyBonds(c,this.prevAtom,this.polySmilesCenter));var z=null;b=q?10:0;JU.Logger.debugging&&JU.Logger.debug(a.toString());if(null!=y)for(var x=0,C=y.length;x<C;x++){var B=y[x];if(B.isCovalent()){1057==B.order&&(b=10);var v=y[x].getOtherNode(c),E=v.getIndex();if(E==F)u=y[x];else{var A=!j&&!h&&1==v.getElementNumber()&&0>=v.getIsotopeNumber();if(!this.bsIncludingH.get(E)){if(A||!this.allowConnectionsToOutsideWorld||
!this.bsSelected.get(d))continue;this.bsToDo.set(E)}A?(z=v,s++,1<s&&(b=10)):k.addLast(y[x])}}}1<s&&(m=null);C=null!=m?2:0;null==m&&(!q&&1>=s)&&(m=Array(5));var D=null;null!=u&&(D=this.getBondOrder(u,d,F,q),null!=m&&!t&&(m[C++]=this.prevAtom));null!=m&&!t&&(this.ptSp2Atom0=this.ptAtom);null!=m&&1==s&&(m[C++]=z);v=0;A=new JU.BS;E=k.size();if(f)for(x=0;x<E;x++){var B=k.get(x),y=B.getOtherNode(c),h=y.getCovalentBondCount()-(j||this.isExplicitOnly(y)?0:y.getCovalentHydrogenCount()),L=B.getCovalentOrder();
if(!this.htRings.containsKey(JS.SmilesGenerator.getRingKey(y.getIndex(),d)))if(y=null!=w||x<E-1,1==h&&y)A.set(B.index);else if(1<L||h>v)v=1<L?1E3+L:h,w=B}h=null==w?null:w.getOtherNode(c);v=null==w?0:w.getCovalentOrder();E=Array(7);7>b&&null!=u&&(t&&2==u.getCovalentOrder()&&2==v&&null!=m[1]?(E[b++]=m[0],E[b++]=m[1]):E[b++]=this.prevAtom);7>b&&1==s&&(E[b++]=z);B=this.getBondStereochemistry(u,this.prevAtom);if(null!=D||"\x00"!=B)"\x00"!=B&&(D=""+B),a.append(D);for(var H=b,K=C,z=new JU.SB,u=new JU.Lst,
x=0;x<k.size();x++)B=k.get(x),A.get(B.index)&&(y=B.getOtherNode(c),L=new JU.SB,this.prevAtom=c,this.prevSp2Atoms=this.alleneStereo=null,B=this.ptSp2Atom0,D=this.ptAtom,this.getSmilesAt(L,y,f,!0),this.ptAtom=D,this.ptSp2Atom0=B,L=L.toString(),k.removeItemAt(x--),null==w?u.addLast(L):z.append("(").append(L).append(")"),7>b&&(E[b++]=y),null!=m&&5>C&&(m[C++]=y));var A=new JU.SB,G=b,I=C,L=null;if(!f&&!this.noStereo&&null==this.polySmilesCenter&&(5==k.size()||6==k.size()))L=this.sortInorganic(c,k,this.vTemp);
for(x=0;x<k.size();x++)B=k.get(x),B!==w&&(y=B.getOtherNode(c),f=y.getIndex(),D=this.getBondOrder(B,d,f,q),B=this.getBondStereochemistry(B,c),"\x00"!=B&&(D=""+B),A.append(D),A.append(this.getRingCache(d,f,this.htRings)),7>b&&(E[b++]=y),null!=m&&5>C&&(m[C++]=y));H!=G&&G!=b&&this.swapArray(E,H,G,b);K!=I&&I!=C&&this.swapArray(m,K,I,C);if(t&&2==b&&2==v){t=this.ptAtom-this.ptSp2Atom0;C=h.getCovalentBondCount();k=7==h.getElementNumber();if(0==t%2)b=8;else if(3==C||2==C&&k){!j&&(")"!=a.charAt(l)&&1==E[l].getAtomicAndIsotopeNumber())&&
(l=E[0],E[0]=E[1],E[1]=l);y=h.getEdges();for(l=0;l<y.length;l++)j=h.getBondedAtomIndex(l),y[l].isCovalent()&&j!=d&&(E[b++]=this.atoms[j]);2==C&&(E[b++]=h);4==b&&(this.alleneStereo=E)}C=0}else null!=h&&7>b&&(E[b++]=h);null!=p&&p[3]!==E[2]&&(p=a.lastIndexOf("@]="),0<p&&(l=a.substring(p),a.setLength("@"==a.charAt(p-1)?p-1:p+1),a.append(l)));this.haveSmilesAtoms&&(null==L&&4==b)&&(L=c.getStereoAtAt(E));p=c.getFormalCharge();l=c.getIsotopeNumber();j=c.getValence();t=this.openSMILES?c.getFloatProperty("property_atomclass"):
NaN;0==t&&(t=NaN);k=c.getAtomName();f=c.getBioStructureTypeName();this.addAtomComment&&a.append("\n//* "+c.toString()+" *//\t");this.topologyOnly?a.append("*"):g&&0!=f.length&&0!=k.length?this.addBracketedBioName(a,c,"."+k,!1):a.append(JS.SmilesAtom.getAtomLabel(r,l,this.forceBrackets?-1:j,p,t,s,q,null!=L?L:this.noStereo?null:this.checkStereoPairs(c,null==this.alleneStereo?d:-1,E,b,-1==F),this.is2D));a.appendSB(A);if(null!=w)a.appendSB(z);else{h=u.size()-1;if(0<=h){for(x=0;x<h;x++)a.append("(").append(u.get(x)).append(")");
a.append(u.get(h))}return null}null!=m&&2==v&&(1==C||2==C)?(null==m[0]&&(m[0]=c),null==m[1]&&(m[1]=c)):m=null;this.prevSp2Atoms=m;this.prevAtom=c;return h},"JU.SB,JU.SimpleNode,~B,~B");g(b,"isExplicitOnly",function(a){return 7==a.getElementNumber()&&2==a.getCovalentBondCount()||6==a.getElementNumber()&&17==a.getIsotopeNumber()},"JU.SimpleNode");g(b,"swapArray",function(a,c,f,b){c=f-c;if(null==this.atemp||this.atemp.length<c)this.atemp=Array(c);for(var d=c,l=f;0<d;)this.atemp[--d]=a[--l];for(l=f;l<
b;l++)a[l-c]=a[l];d=c;for(l=b;0<d;)a[--l]=this.atemp[--d]},"~A,~N,~N,~N");g(b,"getBondOrder",function(a,c,f,b){if(this.topologyOnly)return"";if(65537==(a.order&65537))return"^-";a=Math.max(a.isPartial()?1:0,a.getCovalentOrder());return!b||!this.bsAromatic.get(f)?JS.SmilesBond.getBondOrderString(a):1==a&&!this.isSameAromaticRing(c,f)?"-":this.aromaticDouble&&(2==a||514==a)?"=":""},"JU.Edge,~N,~N,~B");g(b,"isSameAromaticRing",function(a,c){for(var f,b=this.aromaticRings.size();0<=--b;)if((f=this.aromaticRings.get(b)).get(a)&&
f.get(c))return!0;return!1},"~N,~N");g(b,"sortPolyBonds",function(a,c,f){if(null==this.smilesStereo)try{this.smilesStereo=JS.SmilesStereo.newStereo(null)}catch(b){if(!H(b,"JS.InvalidSmilesException"))throw b;}this.smilesStereo.sortPolyBondsByStereo(a,c,f,a.getEdges(),this.vTemp.vA)},"JU.SimpleNode,JU.SimpleNode,JU.P3");g(b,"sortInorganic",function(a,c,f){for(var b=a.getIndex(),d=c.size(),l=new JU.Lst,j=new JU.Lst,h,q,g=null,F=null,m,k,r=new JU.BS,s=null,p=Array(6),s=!0,v="",w=0,u=0;u<d;u++)if(m=c.get(u),
p[0]=h=m.getOtherNode(a),0==u?v=this.addStereoCheck(0,b,h,"",null):s&&null!=this.addStereoCheck(0,b,h,v,null)&&(s=!1),!r.get(u)){r.set(u);for(var y=!1,z=u+1;z<d;z++)if(!r.get(z)&&(k=c.get(z),q=k.getOtherNode(a),JS.SmilesStereo.isDiaxial(a,a,h,q,f,-0.95))){switch(++w){case 1:g=h;break;case 2:F=h;break;case 3:2==JS.SmilesStereo.getHandedness(F,g,h,a,f)&&(h=m,m=k,k=h)}l.addLast(O(-1,[m,k]));y=!0;r.set(z);break}y||j.addLast(m)}b=l.size();if(s||6==d&&3!=b||5==d&&0==b)return"";s=l.get(0);m=s[0];p[0]=m.getOtherNode(a);
c.clear();c.addLast(m);1<b&&j.addLast(l.get(1)[0]);3==b&&j.addLast(l.get(2)[0]);1<b&&j.addLast(l.get(1)[1]);3==b&&j.addLast(l.get(2)[1]);for(u=0;u<j.size();u++)m=j.get(u),c.addLast(m),p[u+1]=m.getOtherNode(a);c.addLast(s[1]);p[d-1]=s[1].getOtherNode(a);return JS.SmilesStereo.getStereoFlag(a,p,d,f,this.is2D)},"JU.SimpleNode,JU.Lst,JS.VTemp");g(b,"checkStereoPairs",function(a,c,b,e,d){if(10==e||e<(this.is2D?3:4))return"";if(0==this.explicitHydrogen&&(0<=c&&4==e)&&17>=a.getElementNumber())for(var l=
"",j=0;4>j;j++)if(null==(l=this.addStereoCheck(0,c,b[j],l,JU.BSUtil.newAndSetBit(c))))return"";if(this.is2D){c=4==e||!d?1:-1;d=a.getEdges();l=null;for(j=a.getBondCount();0<=--j;){var h=d[j];if(a===h.getAtom(0))switch(h.getBondType()){case 1025:l=JS.SmilesGenerator.setStereoTemp(null,b,h.getAtom(1),c);break;case 1041:l=JS.SmilesGenerator.setStereoTemp(null,b,h.getAtom(1),-c)}}if(null==l)return"";3==e&&(b[e++]=JS.SmilesGenerator.setStereoTemp(a,b,l,0))}return JS.SmilesStereo.getStereoFlag(a,b,e,this.vTemp,
this.is2D)},"JU.SimpleNode,~N,~A,~N,~B");b.setStereoTemp=g(b,"setStereoTemp",function(a,c,b,e){for(var d=new JS.SmilesAtom,l=0;4>l;l++){var j=c[l]===b;if(null==a){if(j)return a=b.getXYZ(),d.set(a.x,a.y,e),c[l]=d}else 3>l&&d.add(c[l])}if(null==a)return null;d.scale(-0.33333334);d.scaleAdd2(2,a,d);return d},"JU.SimpleNode,~A,JU.SimpleNode,~N");g(b,"addStereoCheck",function(a,c,b,e,d){null!=d&&d.set(c);var l=b.getAtomicAndIsotopeNumber();if(1==l&&0==this.explicitHydrogen)return"H";var j=b.getCovalentBondCount(),
h=b.getCovalentHydrogenCount(),q=6==l&&0!=this.explicitHydrogen?h:0;if(6==l||16==l?4!=j:1==l||1<j)return e+ ++this.chainCheck;var g=";"+a+"/"+l+"/"+q+"/"+j+(0==a?",":"_");if(6==l||16==l)switch(q){case 1:return e+g+ ++this.chainCheck;case 0:case 2:if(null==d)return e;for(var l=b.getEdges(),F="",m="",k=2==q?0:3,q=b.getBondCount();0<=--q;){var m=l[q].getOtherNode(b),r=m.getIndex();!d.get(r)&&l[q].isCovalent()&&(d.set(r),m=this.addStereoCheck(a+1,b.getIndex(),m,"",d.clone()),0<=F.indexOf(m)&&k--,F+=m)}if(3==
k)return e+g+ ++this.chainCheck;g=(g+F).$replace(",","_");if(0<a)return e+g}if(0<=e.indexOf(g)){if(3==h){for(q=a=0;q<j&&3>a;q++)d=b.getBondedAtomIndex(q),d!=c&&(a+=this.atoms[d].getAtomicAndIsotopeNumber());if(3<a)return e}return null}return e+g},"~N,~N,JU.SimpleNode,~S,JU.BS");g(b,"getRingCache",function(a,c,b){var e=JS.SmilesGenerator.getRingKey(a,c),d=b.get(e),l=null==d?null:d[0];if(null==l)this.bsRingKeys.set(++this.nPairs),this.nPairsMax=Math.max(this.nPairs,this.nPairsMax),b.put(e,O(-1,[l=this.getRingPointer(this.nPairs),
Integer.$valueOf(c),Integer.$valueOf(this.nPairs)])),JU.Logger.debugging&&JU.Logger.debug("adding for "+a+" ring key "+this.nPairs+": "+e);else{b.remove(e);a=d[2].intValue();this.bsRingKeys.clear(a);if(0>this.bsRingKeys.nextSetBit(0)&&(2==this.nPairsMax||99==this.nPairsMax))this.nPairsMax=this.nPairs=99==this.nPairsMax?10:0;JU.Logger.debugging&&JU.Logger.debug("using ring key "+e)}return l},"~N,~N,java.util.Map");g(b,"getRingPointer",function(a){return 10>a?""+a:100>a?"%"+a:"%("+a+")"},"~N");g(b,
"dumpRingKeys",function(a,c){JU.Logger.info(a.toString()+"\n\n");for(var b,e=c.keySet().iterator();e.hasNext()&&((b=e.next())||1);)JU.Logger.info("unmatched connection: "+b)},"JU.SB,java.util.Map");b.getRingKey=g(b,"getRingKey",function(a,c){return Math.min(a,c)+"_"+Math.max(a,c)},"~N,~N")});A("JS");D(null,"JS.SmilesAromatic","java.util.Hashtable JU.BS $.Lst $.Measure $.V3 JS.SmilesRing $.SmilesRingSet JU.BSUtil $.Logger".split(" "),function(){var b=R(JS,"SmilesAromatic",null);b.setAromatic=g(b,"setAromatic",
function(a,c,b,e,d,l,j,h,g,n,F,m,k,r){j=j||0<l;if(r)for(z=e.size();0<=--z;){if(x=e.get(z),r=JS.SmilesAromatic.isSp2Ring(a,c,b,x,h?3.4028235E38:0.1,g,0==l)){d.or(x);if(j){n=new JU.Lst;for(var s=x.nextSetBit(0);0<=s;s=x.nextSetBit(s+1))for(var p=c[s],v=p.getEdges(),w=p.getIndex(),u=v.length;0<=--u;){var y=v[u].getOtherNode(p).getIndex();y>w&&x.get(y)&&n.addLast(v[u])}switch(JS.SmilesAromatic.checkHueckelAromatic(a,c,d,x,l,k)){case -1:continue;case 0:r=!1;case 1:if(null!=m&&m.addLast(new JS.SmilesRing(a,
x,n,r)),!r)continue}}F.addLast(x)}}else for(var z=e.size();0<=--z;){var x=JU.BSUtil.copy(e.get(z));x.and(d);x.cardinality()==a&&F.addLast(x)}},"~N,~A,JU.BS,JU.Lst,JU.BS,~N,~B,~B,~B,JS.VTemp,JU.Lst,JU.Lst,~A,~B");b.checkAromaticDefined=g(b,"checkAromaticDefined",function(a,c,b){for(var e=c.nextSetBit(0);0<=e;e=c.nextSetBit(e+1))for(var d=a[e].getEdges(),l=0;l<d.length;l++)switch(d[l].getBondType()){case 515:case 514:case 513:b.set(d[l].getAtomIndex1()),b.set(d[l].getAtomIndex2())}},"~A,JU.BS,JU.BS");
b.isSp2Ring=g(b,"isSp2Ring",function(a,c,b,e,d,l,j){if(l)for(var h=e.nextSetBit(0);0<=h;h=e.nextSetBit(h+1)){if(3<c[h].getCovalentBondCount())return!1}else for(h=e.nextSetBit(0);0<=h;h=e.nextSetBit(h+1))if(3<c[h].getCovalentBondCountPlusMissingH())return!1;if(3.4028235E38==d)return!0;0>=d&&(d=0.01);for(var g=l=a=null,h=e.cardinality(),n=Array(2*h),F=0,m=1-5*d,h=e.nextSetBit(0);0<=h;h=e.nextSetBit(h+1)){for(var k=c[h],r=-1,s=-1,p=-1,v=k.getEdges().length;0<=--v;){var w=k.getBondedAtomIndex(v);if(b.get(w))if(e.get(w))0>
s?s=w:p=w;else{if(16==k.getElementNumber()){if(!j)return!1;w=-1}r=w}}null==g&&(g=new JU.V3,a=new JU.V3,l=new JU.V3);v=0;for(k=h;2>v;v++){JU.Measure.getNormalThroughPoints(c[s],c[k],c[p],a,l);if(!JS.SmilesAromatic.addNormal(a,g,m))return!1;n[F++]=JU.V3.newV(a);if(0>(k=r))break}}return JS.SmilesAromatic.checkStandardDeviation(n,g,F,d)},"~N,~A,JU.BS,JU.BS,~N,~B,~B");b.addNormal=g(b,"addNormal",function(a,c,b){var e=c.dot(a);if(0!=e&&Math.abs(e)<b)return!1;0>e&&a.scale(-1);c.add(a);c.normalize();return!0},
"JU.V3,JU.V3,~N");b.checkStandardDeviation=g(b,"checkStandardDeviation",function(a,c,b,e){for(var d=0,l=0,j=0;j<b;j++)var h=a[j].dot(c),d=d+h,l=l+h*h;d=Math.sqrt((l-d*d/b)/(b-1));return d<e},"~A,JU.V3,~N,~N");b.checkHueckelAromatic=g(b,"checkHueckelAromatic",function(a,c,b,e,d,l){for(var j=0,h=0,g=e.nextSetBit(0);0<=g&&0<=j;g=e.nextSetBit(g+1)){var n=c[g],k=n.getElementNumber(),m=n.getCovalentBondCountPlusMissingH(),m=m+n.getValence(),m=m-4;if(6==k){var t=n.getFormalCharge();-2147483648!=t&&(m+=t)}k=
5<=k&&8>=k?k-5:15==k?2:34==k?3:33==k?4:16==k?5:-1;if(0<=k){k=JS.SmilesAromatic.OS_PI_COUNTS[k];if(0>m||m>=k.length)return-1;switch(m=k[m]){case -2:return-1;case -1:k=n.getEdges();m=0;for(t=k.length;0<=--t;){var r=k[t];if(2==r.getCovalentOrder()){m=r.getOtherNode(n);m=6==m.getElementNumber()||b.get(m.getIndex())?1:0<d?-100:0;break}}default:if(0>m)return-1;null!=l&&(l[g]=m);j+=m;1==m&&h++;JU.Logger.debuggingHigh&&JU.Logger.info("atom "+n+" pi="+m+" npi="+j)}}}return 0==(j-2)%4&&(2>d||5==a||6==h)?1:
0},"~N,~A,JU.BS,JU.BS,~N,~A");b.finalizeAromatic=g(b,"finalizeAromatic",function(a,c,b,e,d,l,j){j&&JS.SmilesAromatic.removeBridgingRings(b,e);JS.SmilesAromatic.checkFusedRings(e,d,b);c.clearAll();for(d=b.size();0<=--d;)c.or(b.get(d));if(j||l)for(d=c.nextSetBit(0);0<=d;d=c.nextSetBit(d+1)){b=a[d].getEdges();l=0;for(var h=b.length;0<=--h;){var g=b[h].getOtherNode(a[d]),n=b[h].getCovalentOrder(),k=g.getIndex();if(c.get(k)){if(2==n){g=!1;for(n=e.size();0<=--n;){var m=e.get(n);if(m.get(d)&&m.get(k)){g=
!0;break}}if(!g){l=-1;break}}l++}else if(j&&6==g.getElementNumber()&&2==n){l=-1;break}}2>l&&(c.clear(d),d=-1)}},"~A,JU.BS,JU.Lst,JU.Lst,~A,~B,~B");b.removeBridgingRings=g(b,"removeBridgingRings",function(a,c){var b=new JU.BS,e=new JU.BS,d=new JU.BS;JS.SmilesAromatic.checkBridges(a,e,a,e,b);JS.SmilesAromatic.checkBridges(c,d,c,d,b);JS.SmilesAromatic.checkBridges(a,e,c,d,b);for(b=a.size();0<=--b;)e.get(b)&&a.removeItemAt(b);for(b=c.size();0<=--b;)d.get(b)&&c.removeItemAt(b)},"JU.Lst,JU.Lst");b.checkBridges=
g(b,"checkBridges",function(a,c,b,e,d){for(var l=a===b,j=a.size();0<=--j;)for(var h=a.get(j),g=l?j+1:0,n=b.size();--n>=g;){var k=b.get(n);k.equals(h)||(d.clearAll(),d.or(h),d.and(k),2<d.cardinality()&&(c.set(j),e.set(n)))}},"JU.Lst,JU.BS,JU.Lst,JU.BS,JU.BS");b.checkFusedRings=g(b,"checkFusedRings",function(a,c,b){for(var e=new java.util.Hashtable,d=a.size();0<=--d;){for(var l=a.get(d),j=l.edges,h=j.size();0<=--h;){var g=JS.SmilesRing.getSetByEdge(j.get(h),e);null==g||g===l.$set||(null!=l.$set?g.addSet(l.$set,
e):g.addRing(l))}(null==l.$set?l.$set=new JS.SmilesRingSet:l.$set).addRing(l);l.addEdges(e)}for(d=a.size();0<=--d;)if(!(l=a.get(d)).isOK&&!(null==(g=l.$set)||g.isEmpty())){if(2==g.getElectronCount(c)%4)for(h=g.size();0<=--h;)(l=g.get(h)).isOK||b.addLast(l);g.clear()}},"JU.Lst,~A,JU.Lst");b.OS_PI_COUNTS=O(-1,[v(-1,[-2,1,0]),v(-1,[1,2,1,-1]),v(-1,[2,1,2,1,1]),v(-1,[2,1]),v(-1,[-2,1,2,1,-2]),v(-1,[2,1,2,2])])});A("JS");D(["JU.BS"],"JS.SmilesRing",null,function(){var b=G(function(){this.bsEdgesToCheck=
this.edges=this.$set=null;this.isOK=!1;this.n=0;K(this,arguments)},JS,"SmilesRing",JU.BS);M(b,function(a,c,b,e){P(this,JS.SmilesRing,[]);this.or(c);this.edges=b;this.isOK=e;this.n=a},"~N,JU.BS,JU.Lst,~B");g(b,"addEdges",function(a){for(var c=this.edges.size();0<=--c;)a.put(JS.SmilesRing.getKey(this.edges.get(c)),this.$set)},"java.util.Hashtable");b.getSetByEdge=g(b,"getSetByEdge",function(a,c){return c.get(JS.SmilesRing.getKey(a))},"JU.Edge,java.util.Hashtable");b.getKey=g(b,"getKey",function(a){var c=
a.getAtomIndex1();a=a.getAtomIndex2();return c<a?c+"_"+a:a+"_"+c},"JU.Edge")});A("JS");D(["JU.Lst","$.BS"],"JS.SmilesRingSet",null,function(){var b=G(function(){this.bs=null;K(this,arguments)},JS,"SmilesRingSet",JU.Lst);N(b,function(){this.bs=new JU.BS});M(b,function(){P(this,JS.SmilesRingSet,[])});g(b,"addSet",function(a,c){for(var b=a.size();0<=--b;){var e=a.get(b);this.addRing(e);e.addEdges(c)}},"JS.SmilesRingSet,java.util.Hashtable");g(b,"addRing",function(a){this.addLast(a);a.$set=this;this.bs.or(a)},
"JS.SmilesRing");g(b,"getElectronCount",function(a){for(var c=0,b=this.bs.nextSetBit(0);0<=b;b=this.bs.nextSetBit(b+1))c+=a[b];return c},"~A")});A("JS");D(["JU.P3","JU.Node"],"JS.SmilesAtom",["JU.AU","JU.Elements","$.Logger","JV.JC"],function(){var b=G(function(){this.patternIndex=-1;this.pattern=null;this.primitiveType=0;this.isAND=!1;this.subAtoms=null;this.index=this.nSubAtoms=0;this.residueChar=this.residueName=this.referance=null;this.insCode="\x00";this.isBioAtomWild=this.isBioResidue=this.isBioAtom=
!1;this.bioType="\x00";this.$isLeadAtom=!1;this.notBondedIndex=-1;this.notCrossLinked=!1;this.aromaticAmbiguous=!0;this.covalentHydrogenCount=-1;this.elementDefined=this.hasSymbol=this.selected=this.not=!1;this.bioAtomName=this.atomType=null;this.isFirst=!0;this.jmolIndex=-1;this.elementNumber=-2;this.implicitHydrogenCount=this.explicitHydrogenCount=this.residueNumber=this.atomNumber=-2147483648;this.bonds=this.parent=null;this.iNested=this.bondCount=0;this.isAromatic=!1;this.charge=this.atomicMass=
-2147483648;this.matchingIndex=-1;this.stereo=null;this.component=-2147483648;this.atomSite=this.matchingComponent=0;this.nonhydrogenDegree=this.degree=-1;this.valence=0;this.connectivity=-1;this.ringSize=this.ringMembership=-2147483648;this.ringConnectivity=-1;this.matchingNode=null;this.hasSubpattern=!1;this.mapIndex=-1;this.atomClass=NaN;this.symbol=null;this.isTopoAtom=!1;this.cipChirality=this.missingHydrogenCount=0;this.hasDoubleBond=!1;K(this,arguments)},JS,"SmilesAtom",JU.P3,JU.Node);N(b,
function(){this.bonds=Array(4)});M(b,function(){P(this,JS.SmilesAtom,[])});b.allowSmilesUnbracketed=g(b,"allowSmilesUnbracketed",function(a){return 0<="B, C, N, O, P, S, F, Cl, Br, I, *,".indexOf(a+",")},"~S");k(b,"getAtomType",function(){return null==this.atomType?this.bioAtomName:this.atomType});g(b,"getChiralClass",function(){return null==this.stereo?-2147483648:this.stereo.getChiralClass(this)});g(b,"isDefined",function(){return this.hasSubpattern||0!=this.iNested||this.isBioAtom||-2147483648!=
this.component||-2!=this.elementNumber||0<this.nSubAtoms});g(b,"setBioAtom",function(a){this.isBioAtom="\x00"!=a;this.bioType=a;null!=this.parent&&(this.parent.bioType=a,this.parent.isBioAtom=this.isBioAtom,this.parent.isBioAtomWild=this.isBioAtomWild)},"~S");g(b,"setAtomName",function(a){null!=a&&(0<a.length&&(this.bioAtomName=a),a.equals("\x00")&&(this.$isLeadAtom=!0),null!=this.parent&&(this.parent.bioAtomName=a))},"~S");g(b,"setBonds",function(a){this.bonds=a},"~A");g(b,"addSubAtom",function(a,
c){this.isAND=c;null==this.subAtoms&&(this.subAtoms=Array(2));this.nSubAtoms>=this.subAtoms.length&&(this.subAtoms=JU.AU.doubleLength(this.subAtoms));a.setIndex(this.index);a.parent=this;this.subAtoms[this.nSubAtoms++]=a;this.setSymbol("*");this.hasSymbol=!1;return a},"JS.SmilesAtom,~B");g(b,"setIndex",function(a){this.index=a;return this},"~N");g(b,"setTopoAtom",function(a,c,b,e,d){this.component=a;this.index=c;this.patternIndex=d;this.setSymbol(b);this.charge=e;this.isTopoAtom=!0;return this},"~N,~N,~S,~N,~N");
g(b,"setHydrogenCount",function(){this.missingHydrogenCount=this.explicitHydrogenCount;if(-2147483648!=this.explicitHydrogenCount)return!0;var a=this.getFormalCharge(),a=JS.SmilesAtom.getDefaultHCount(this.elementNumber,this.isAromatic,-2147483648==a?0:a);if(0>a)return this.missingHydrogenCount=0,-1==a;7==this.elementNumber&&this.isAromatic&&2==this.bondCount&&1==this.bonds[0].getBondType()&&1==this.bonds[1].getBondType()&&a++;for(var c=0;c<this.bondCount;c++){var b=this.bonds[c];switch(b.getBondType()){case 81:7==
this.elementNumber&&JU.Logger.info("Ambiguous bonding to aromatic N found -- MF may be in error");a-=1;break;case 1025:case 1041:case 65537:case 65538:a-=1;break;case 2:a-=this.isAromatic&&6==this.elementNumber?1:2;break;case 1:case 3:case 4:a-=b.getBondType()}}0<=a&&(this.missingHydrogenCount=this.explicitHydrogenCount=a);return!0});b.getDefaultHCount=g(b,"getDefaultHCount",function(a,c,b){switch(a){case 0:case -1:case -2:return-1;case 1:return 1;case 6:return(c?3:4)+(0==b?0:1);case 8:case 16:return 2+
b;case 7:return(c?2:3)+b;case 5:case 15:return 3;case 9:case 17:case 35:case 53:return 1+b;default:return 0}},"~N,~B,~N");k(b,"getIndex",function(){return this.index});g(b,"setSymbol",function(a){this.symbol=a;this.isAromatic=a.equals(a.toLowerCase());this.elementDefined=this.hasSymbol=!0;if(a.equals("*"))return this.isAromatic=!1,this.elementNumber=-2,!0;if(a.equals("Xx"))return this.elementNumber=0,!0;this.aromaticAmbiguous=!1;if(a.equals("a")||a.equals("A"))return 0>this.elementNumber&&(this.elementNumber=
-1),!0;this.isAromatic&&(a=a.substring(0,1).toUpperCase()+(1==a.length?"":a.substring(1)));this.elementNumber=JU.Elements.elementNumberFromSymbol(a,!0);return 0!=this.elementNumber},"~S");k(b,"getElementNumber",function(){return this.elementNumber});g(b,"getAtomicMass",function(){return this.atomicMass});k(b,"getAtomNumber",function(){return this.atomNumber});g(b,"setAtomicMass",function(a){this.atomicMass=a},"~N");g(b,"getCharge",function(){return this.charge});g(b,"setCharge",function(a){this.charge=
a},"~N");g(b,"getMatchingAtomIndex",function(){return this.matchingIndex});g(b,"getMatchingAtom",function(){return null==this.matchingNode?this:this.matchingNode});g(b,"setMatchingAtom",function(a,c){this.matchingNode=a;this.matchingIndex=c},"JU.Node,~N");g(b,"setExplicitHydrogenCount",function(a){this.explicitHydrogenCount=a},"~N");g(b,"setImplicitHydrogenCount",function(a){this.implicitHydrogenCount=a},"~N");g(b,"setDegree",function(a){this.degree=a},"~N");g(b,"setNonhydrogenDegree",function(a){this.nonhydrogenDegree=
a},"~N");g(b,"setValence",function(a){this.valence=a},"~N");g(b,"setConnectivity",function(a){this.connectivity=a},"~N");g(b,"setRingMembership",function(a){this.ringMembership=a},"~N");g(b,"setRingSize",function(a){this.ringSize=a;if(500==this.ringSize||600==this.ringSize)this.isAromatic=!0},"~N");g(b,"setRingConnectivity",function(a){this.ringConnectivity=a},"~N");k(b,"getModelIndex",function(){return this.component});k(b,"getMoleculeNumber",function(){return this.component},"~B");k(b,"getAtomSite",
function(){return this.atomSite});k(b,"getFormalCharge",function(){return this.charge});k(b,"getIsotopeNumber",function(){return this.atomicMass});k(b,"getAtomicAndIsotopeNumber",function(){return JU.Elements.getAtomicAndIsotopeNumber(this.elementNumber,this.atomicMass)});k(b,"getAtomName",function(){return null==this.bioAtomName?"":this.bioAtomName});k(b,"getGroup3",function(){return null==this.residueName?"":this.residueName},"~B");k(b,"getGroup1",function(){return null==this.residueChar?"":this.residueChar},
"~S");g(b,"addBond",function(a){this.bondCount>=this.bonds.length&&(this.bonds=JU.AU.doubleLength(this.bonds));this.bonds[this.bondCount]=a;2==a.order&&(this.hasDoubleBond=!0);this.bondCount++},"JS.SmilesBond");g(b,"setBondArray",function(){this.bonds.length>this.bondCount&&(this.bonds=JU.AU.arrayCopyObject(this.bonds,this.bondCount));null!=this.subAtoms&&this.subAtoms.length>this.nSubAtoms&&(this.subAtoms=JU.AU.arrayCopyObject(this.subAtoms,this.subAtoms.length));for(var a=0;a<this.bonds.length;a++){var c=
this.bonds[a];this.isBioAtom&&17==c.getBondType()?c.order=112:2==c.order&&(c.atom1.hasDoubleBond=c.atom2.hasDoubleBond=!0);c.atom1.index>c.atom2.index&&c.switchAtoms()}});k(b,"getEdges",function(){return null!=this.parent?this.parent.getEdges():this.bonds});g(b,"getBond",function(a){return null!=this.parent?this.parent.getBond(a):0<=a&&a<this.bondCount?this.bonds[a]:null},"~N");k(b,"getCovalentBondCount",function(){return this.getBondCount()});k(b,"getBondCount",function(){return null!=this.parent?
this.parent.getBondCount():this.bondCount});k(b,"getCovalentBondCountPlusMissingH",function(){return this.getBondCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});k(b,"getTotalHydrogenCount",function(){return this.getCovalentHydrogenCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});k(b,"getImplicitHydrogenCount",function(){return this.implicitHydrogenCount});k(b,"getExplicitHydrogenCount",function(){return this.explicitHydrogenCount});g(b,"getMatchingBondedAtom",function(a){if(null!=this.parent)return this.parent.getMatchingBondedAtom(a);
if(a>=this.bondCount)return-1;a=this.bonds[a];return(a.atom1===this?a.atom2:a.atom1).matchingIndex},"~N");k(b,"getBondedAtomIndex",function(a){return null!=this.parent?this.parent.getBondedAtomIndex(a):this.bonds[a].getOtherAtom(this).index},"~N");k(b,"getCovalentHydrogenCount",function(){if(0<=this.covalentHydrogenCount)return this.covalentHydrogenCount;if(null!=this.parent)return this.covalentHydrogenCount=this.parent.getCovalentHydrogenCount();for(var a=this.covalentHydrogenCount=0;a<this.bonds.length;a++)1==
this.bonds[a].getOtherAtom(this).elementNumber&&this.covalentHydrogenCount++;return this.covalentHydrogenCount});k(b,"getValence",function(){if(null!=this.parent)return this.parent.getValence();var a=this.valence;if(0>=a&&null!=this.bonds)for(var c=this.bondCount;0<=--c;)a+=this.bonds[c].getValence();return this.valence=a});k(b,"getTotalValence",function(){return this.getValence()+(this.isTopoAtom?0:this.missingHydrogenCount)});g(b,"getBondTo",function(a){if(null!=this.parent)return this.parent.getBondTo(a);
for(var c,b=0;b<this.bonds.length;b++)if(null!=(c=this.bonds[b]))if(null==a?c.atom2===this:c.getOtherAtom(this)===a)return c;return null},"JS.SmilesAtom");g(b,"getBondNotTo",function(a,c){for(var b,e=0;e<this.bonds.length;e++)if(null!=(b=this.bonds[e])){var d=b.getOtherAtom(this);if(a!==d&&(c||1!=d.elementNumber))return b}return null},"JS.SmilesAtom,~B");k(b,"isLeadAtom",function(){return this.$isLeadAtom});k(b,"getOffsetResidueAtom",function(a,c){if(this.isBioAtom){if(0==c)return this.index;for(var b=
0;b<this.bonds.length;b++)if(this.bonds[b].getAtomIndex1()==this.index&&96==this.bonds[b].getBondType())return this.bonds[b].getOtherAtom(this).index}return-1},"~S,~N");k(b,"getGroupBits",function(a){a.set(this.index)},"JU.BS");k(b,"isCrossLinked",function(a){return this.getBondTo(a).isHydrogen()},"JU.Node");k(b,"getCrossLinkVector",function(a){for(var c=!1,b=0;b<this.bonds.length;b++)if(112==this.bonds[b].order){if(null==a)return!0;a.addLast(Integer.$valueOf(this.index));a.addLast(Integer.$valueOf(this.bonds[b].getOtherAtom(this).index));
a.addLast(Integer.$valueOf(this.bonds[b].getOtherAtom(this).index));c=!0}return c},"JU.Lst,~B,~B");k(b,"getBioStructureTypeName",function(){return null});k(b,"getInsertionCode",function(){return this.insCode});k(b,"getResno",function(){return this.residueNumber});k(b,"getChainID",function(){return 0});k(b,"getChainIDStr",function(){return""});b.getAtomLabel=g(b,"getAtomLabel",function(a,c,b,e,d,l,j,h,g){var n=JU.Elements.elementSymbolFromNumber(a);if(1==a||j&&!(n=n.toLowerCase()).equals("c")&&!n.equals("o")&&
!n.equals("s"))b=2147483647;j=2147483647!=b&&0>=c&&0==e&&Float.isNaN(d)&&(null==h||0==h.length);var k=JS.SmilesAtom.getDefaultHCount(a,!1,-2147483648==e?0:e);if(g&&0==l){if(j&&6==a)return n;l=k-b}return j&&k==b?n:"["+(0>=c?"":""+c)+n+(null==h?"":h)+(1<l?"H"+l:1==l?"H":"")+(-2147483648==e||0==e?"":0>e?""+e:"+"+e)+(Float.isNaN(d)?"":":"+T(d))+"]"},"~N,~N,~N,~N,~N,~N,~B,~S,~B");k(b,"getBioSmilesType",function(){return this.bioType});g(b,"isNucleic",function(){return"n"==this.bioType||"r"==this.bioType||
"d"==this.bioType});k(b,"isPurine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="AG".indexOf(this.residueChar)});k(b,"isPyrimidine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="CTUI".indexOf(this.residueChar)});k(b,"isDeleted",function(){return!1});k(b,"findAtomsLike",function(){return null},"~S");k(b,"getFloatProperty",function(a){return"property_atomclass"===a&&0!=this.atomClass?this.atomClass:NaN},"~S");k(b,"getMass",function(){return this.atomicMass});k(b,
"getCIPChirality",function(){return JV.JC.getCIPChiralityName(this.cipChirality&-225)},"~B");k(b,"setCIPChirality",function(a){this.cipChirality=a},"~N");k(b,"getCIPChiralityCode",function(){return this.cipChirality});k(b,"getXYZ",function(){return this});g(b,"getStereo",function(){return this.stereo});g(b,"getPatternIndex",function(){return this.patternIndex});k(b,"modelIsRawPDB",function(){return!1});g(b,"definesStereo",function(){return!1});g(b,"getStereoAtAt",function(){return null},"~A");g(b,
"isStereoOpposite",function(){return null},"~N,~N,~N");k(b,"toString",function(){for(var a="",c=0;c<this.bondCount;c++)a+=this.bonds[c].getOtherAtom(this).getAtomForToString()+";bo="+this.bonds[c].getCovalentOrder()+", ";return this.getAtomForToString()+"->"+a+"("+this.x+","+this.y+","+this.z+")"});g(b,"getAtomForToString",function(){var a=null!=this.residueChar||null!=this.residueName?(null==this.residueChar?this.residueName:this.residueChar)+"."+this.bioAtomName:null!=this.bioAtomName&&-2147483648!=
this.atomNumber?null:-1==this.elementNumber?"A":-2==this.elementNumber?"*":JU.Elements.elementSymbolFromNumber(this.elementNumber);if(null==a)return this.bioAtomName+" #"+this.atomNumber;this.isAromatic&&(a=a.toLowerCase());return"["+a+"."+this.index+(0<=this.matchingIndex?"("+this.matchingNode+")":"")+"]"})});A("JS");D(["JU.Edge"],"JS.SmilesBond",["JS.InvalidSmilesException"],function(){var b=G(function(){this.atom2=this.atom1=null;this.isNot=!1;this.primitives=this.matchingBond=null;this.nPrimitives=
0;this.bondsOr=null;this.nBondsOr=0;this.isConnection=!1;this.atropType=null;this.isChain=!1;K(this,arguments)},JS,"SmilesBond",JU.Edge);M(b,function(a,c,b,e){P(this,JS.SmilesBond,[]);this.set2(b,e);this.set2a(a,c)},"JS.SmilesAtom,JS.SmilesAtom,~N,~B");b.getBondOrderString=g(b,"getBondOrderString",function(a){switch(a){case 2:return"=";case 3:return"#";case 4:return"$";default:return""}},"~N");b.getBondTypeFromCode=g(b,"getBondTypeFromCode",function(a){switch(a.charCodeAt(0)){case 46:return 0;case 45:return 1;
case 61:return 2;case 35:return 3;case 36:return 4;case 58:return 17;case 47:return 1025;case 92:return 1041;case 94:return 65537;case 96:return 65538;case 64:return 65;case 126:return 81;case 43:return 96}return-1},"~S");g(b,"getAtom1",function(){return this.atom1});g(b,"set",function(a){this.order=a.order;this.isNot=a.isNot;this.primitives=a.primitives;this.nPrimitives=a.nPrimitives;this.bondsOr=a.bondsOr;this.nBondsOr=a.nBondsOr;this.atropType=a.atropType},"JS.SmilesBond");g(b,"setAtropType",function(a){this.atropType=
v(-1,[S(a/10)-1,a%10-1])},"~N");g(b,"setPrimitive",function(a){a=this.primitives[a];this.order=a.order;this.isNot=a.isNot;this.atropType=a.atropType;return a},"~N");g(b,"addBondOr",function(){null==this.bondsOr&&(this.bondsOr=Array(2));if(this.nBondsOr>=this.bondsOr.length){var a=Array(2*this.bondsOr.length);System.arraycopy(this.bondsOr,0,a,0,this.bondsOr.length);this.bondsOr=a}a=new JS.SmilesBond(null,null,-1,!1);this.bondsOr[this.nBondsOr]=a;this.nBondsOr++;return a});g(b,"addPrimitive",function(){null==
this.primitives&&(this.primitives=Array(2));if(this.nPrimitives>=this.primitives.length){var a=Array(2*this.primitives.length);System.arraycopy(this.primitives,0,a,0,this.primitives.length);this.primitives=a}a=new JS.SmilesBond(null,null,-1,!1);this.primitives[this.nPrimitives]=a;this.nPrimitives++;return a});k(b,"toString",function(){return this.atom1+" -"+(this.isNot?"!":"")+this.order+"- "+this.atom2});g(b,"set2",function(a,c){this.order=a;this.isNot=c},"~N,~B");g(b,"set2a",function(a,c){null!=
a&&(this.atom1=a,a.addBond(this));null!=c&&(this.atom2=c,c.isBioAtomWild&&this.atom1.isBioAtomWild&&(this.order=96),c.isFirst=!1,c.addBond(this))},"JS.SmilesAtom,JS.SmilesAtom");g(b,"setAtom2",function(a){this.atom2=a;null!=this.atom2&&(a.addBond(this),this.isConnection=!0)},"JS.SmilesAtom,JS.SmilesSearch");g(b,"isFromPreviousTo",function(a){return!this.isConnection&&this.atom2===a},"JS.SmilesAtom");b.isBondType=g(b,"isBondType",function(a,c,b){if(">"==a)return 1;if(0>"-=#$:/\\.~^`+!,&;@".indexOf(a))return 0;
if(!c&&0>"-=#$:/\\.~^`".indexOf(a))throw new JS.InvalidSmilesException("SMARTS bond type "+a+" not allowed in SMILES");switch(a.charCodeAt(0)){case 126:return b?0:1;case 94:case 96:return-1;default:return 1}},"~S,~B,~B");g(b,"getValence",function(){return this.order&7});g(b,"getOtherAtom",function(a){return this.atom1===a?this.atom2:this.atom1},"JS.SmilesAtom");k(b,"getAtomIndex1",function(){return this.atom1.index});k(b,"getAtomIndex2",function(){return this.atom2.index});k(b,"getCovalentOrder",
function(){return this.order&131071});k(b,"getOtherNode",function(a){return a===this.atom1?this.atom2:a===this.atom2||null==a?this.atom1:null},"JU.SimpleNode");k(b,"isCovalent",function(){return 112!=this.order});k(b,"isPartial",function(){return!1});k(b,"isHydrogen",function(){return 112==this.order});g(b,"switchAtoms",function(){var a=this.atom1;this.atom1=this.atom2;this.atom2=a;switch(this.order&131071){case 65537:this.order=65538;break;case 65538:this.order=65537;break;case 1025:this.order=1041;
break;case 1041:this.order=1025}});g(b,"getRealCovalentOrder",function(){switch(this.order&131071){case 65537:case 65538:case 1025:case 1041:return 1}return this.order&131071});g(b,"getMatchingBond",function(){return null==this.matchingBond?this:this.matchingBond});k(b,"getAtom",function(a){return 1==a?this.atom2:this.atom1},"~N")});A("JS");D(null,"JS.SmilesMeasure",["JU.PT"],function(){var b=G(function(){this.search=null;this.index=this.type=this.nPoints=0;this.isNot=!1;this.points=this.minmax=this.indices=
null;K(this,arguments)},JS,"SmilesMeasure",null);N(b,function(){this.indices=v(4,0);this.points=Array(4)});M(b,function(a,c,b,e,d){this.search=a;this.type=Math.min(4,Math.max(b,2));this.index=c;this.isNot=e;this.minmax=d;for(a=d.length-2;0<=a;a-=2)d[a]>d[a+1]&&(c=d[a+1],d[a+1]=d[a],d[a]=c)},"JS.SmilesSearch,~N,~N,~B,~A");g(b,"addPoint",function(a){if(this.nPoints==this.type)return!1;if(0==this.nPoints)for(var c=1;c<this.type;c++)this.indices[c]=a+c;this.indices[this.nPoints++]=a;return!0},"~N");g(b,
"check",function(){for(var a=0;a<this.type;a++){var c=this.search.patternAtoms[this.indices[a]].getMatchingAtomIndex();this.points[a]=this.search.target.nodes[c]}c=0;switch(this.type){case 2:c=this.points[0].distance(this.points[1]);break;case 3:this.search.v.vA.sub2(this.points[0],this.points[1]);this.search.v.vB.sub2(this.points[2],this.points[1]);c=this.search.v.vA.angle(this.search.v.vB)/0.017453292;break;case 4:c=JS.SmilesMeasure.setTorsionData(this.points[0],this.points[1],this.points[2],this.points[3],
this.search.v,!0)}for(a=this.minmax.length-2;0<=a;a-=2)if(c>=this.minmax[a]&&c<=this.minmax[a+1])return!this.isNot;return this.isNot});b.setTorsionData=g(b,"setTorsionData",function(a,c,b,e,d,l){d.vTemp1.sub2(a,c);d.vTemp2.sub2(e,b);if(!l)return 0;d.vNorm2.sub2(c,b);d.vNorm2.normalize();d.vTemp1.cross(d.vTemp1,d.vNorm2);d.vTemp1.normalize();d.vTemp2.cross(d.vTemp2,d.vNorm2);d.vTemp2.normalize();d.vNorm3.cross(d.vTemp1,d.vTemp2);return d.vTemp1.angle(d.vTemp2)/0.017453292*(0>d.vNorm2.dot(d.vNorm3)?
1:-1)},"JU.T3,JU.T3,JU.T3,JU.T3,JS.VTemp,~B");k(b,"toString",function(){for(var a="(."+"__dat".charAt(this.type)+this.index+":"+JU.PT.toJSON(null,this.minmax)+") for",c=0;c<this.type;c++)a+=" "+(c>=this.nPoints?"?":""+this.indices[c]);return a})});A("JS");D(["java.util.Hashtable"],"JS.SmilesParser","JU.Lst $.PT $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesSearch $.SmilesStereo JU.Elements $.Logger".split(" "),function(){var b=G(function(){this.htMeasures=this.connections=
null;this.flags=0;this.isBioSequence=this.isSmarts=!1;this.bioType="\x00";this.componentParenCount=this.componentCount=this.branchLevel=this.braceCount=0;this.ignoreStereochemistry=!1;this.bondDirectionPaired=!0;this.isTarget=!1;K(this,arguments)},JS,"SmilesParser",null);N(b,function(){this.connections=new java.util.Hashtable;this.htMeasures=new java.util.Hashtable});M(b,function(a,c){this.isSmarts=a;this.isTarget=c},"~B,~B");b.newSearch=g(b,"newSearch",function(a,c,b){return(new JS.SmilesParser(c,
b)).parse(a)},"~S,~B,~B");g(b,"parse",function(a){if(null==a)throw new JS.InvalidSmilesException("expression must not be null");var c=new JS.SmilesSearch;this.isSmarts&&!this.isTarget&&(c.pattern0=a);0<=a.indexOf("$(select")&&(a=this.parseNested(c,a,"select"));var b=v(1,0);a=JS.SmilesParser.extractFlags(a,b);this.flags=b[0];c.setFlags(this.flags);0<=a.indexOf("$")&&(a=this.parseVariables(a));this.isSmarts&&0<=a.indexOf("[$")&&(a=this.parseVariableLength(a));if(0>a.indexOf("||"))return this.getSubsearch(c,
a,this.flags);a=JU.PT.split(a,"||");b="";c.subSearches=Array(a.length);for(var e=0;e<a.length;e++){var d="|"+a[e]+"|";0>b.indexOf(d)&&(c.subSearches[e]=this.getSubsearch(c,a[e],this.flags),b+=d)}return c},"~S");g(b,"parseVariableLength",function(a){for(var c=new JU.SB,b=a.length-1,e=0,d=!1,l=0;l<b;l++)switch(a.charAt(l).charCodeAt(0)){case 40:e++;break;case 41:e--;break;case 124:0<e&&(d=!0,"|"==a.charAt(l+1)&&(a=a.substring(0,l)+a.substring(l+1),b--))}if(0<=a.indexOf("||")){b=JU.PT.split(a,"||");
for(l=0;l<b.length;l++)c.append("||").append(this.parseVariableLength(b[l]))}else{b=-1;e=v(1,0);for(l=null;0<=(b=a.indexOf("[$",b+1));){var j=b,h=-2147483648,g=-2147483648,b=JS.SmilesParser.getDigits(a,b+2,e),h=e[0];-2147483648!=h&&"-"==JS.SmilesParser.getChar(a,b)&&(b=JS.SmilesParser.getDigits(a,b+1,e),g=e[0]);if("("==JS.SmilesParser.getChar(a,b)&&(l=JS.SmilesParser.getSubPattern(a,j,"["),l.endsWith(")"))){var n=j+l.length+2,k=JS.SmilesParser.getSubPattern(a,b,"("),m=b;JS.SmilesParser.getSubPattern(a,
b,"[");b+=1+k.length;if(0<=k.indexOf(":")&&0>k.indexOf("|")){for(var t=0,r=k.length,s=-1,l=0;l<r;l++)switch(k.charAt(l).charCodeAt(0)){case 91:case 40:t++;break;case 41:case 93:t--;break;case 46:0<=s&&0==t&&(r=l);break;case 58:0>s&&0==t&&(s=l)}0<s&&(k=k.substring(0,s)+"("+k.substring(s,r)+")"+k.substring(r))}if(-2147483648==h){if(l=k.indexOf("|"),0<=l)return this.parseVariableLength(a.substring(0,j)+"[$1"+a.substring(m,m+l+1)+")]"+a.substring(n)+"||"+a.substring(0,j)+"[$1("+a.substring(m+l+2)+a.substring(n))}else{-2147483648==
g&&(g=h);0<=k.indexOf("|")&&(k="[$("+k+")]");for(l=h;l<=g;l++){h=new JU.SB;h.append("||").append(a.substring(0,j));for(m=0;m<l;m++)h.append(k);h.append(a.substring(n));c.appendSB(h)}}}}}return d?this.parseVariableLength(c.substring(2)):2>c.length()?a:c.substring(2)},"~S");g(b,"getSubsearch",function(a,c,b){this.htMeasures=new java.util.Hashtable;var e=new JS.SmilesSearch;e.setTop(a);e.isSmarts=this.isSmarts;e.pattern=c;e.pattern0=a.pattern0;e.setFlags(b);0<=c.indexOf("$(")&&(c=this.parseNested(e,
c,""));this.parseSmiles(e,c,null,!1);if(0!=this.braceCount)throw new JS.InvalidSmilesException("unmatched '{'");if(!this.connections.isEmpty())throw new JS.InvalidSmilesException("Open connection");e.set();if(this.isSmarts)for(a=e.ac;0<=--a;)this.checkNested(e,e.patternAtoms[a],b);else this.isBioSequence||(e.elementCounts[1]=e.getMissingHydrogenCount());!this.ignoreStereochemistry&&!this.isTarget&&this.fixChirality(e);return e},"JS.SmilesSearch,~S,~N");g(b,"checkNested",function(a,c,b){if(0<c.iNested){var e=
a.getNested(c.iNested);if("string"==typeof e){if(e.startsWith("select"))return;"~"!=e.charAt(0)&&"\x00"!=c.bioType&&(e="~"+c.bioType+"~"+e);e=this.getSubsearch(a,e,b);0<e.ac&&e.patternAtoms[0].selected&&(c.selected=!0);a.setNested(c.iNested,e)}}for(e=0;e<c.nSubAtoms;e++)this.checkNested(a,c.subAtoms[e],b)},"JS.SmilesSearch,JS.SmilesAtom,~N");g(b,"fixChirality",function(a){for(var c=a.ac;0<=--c;){var b=a.patternAtoms[c];null!=b.stereo&&b.stereo.fixStereo(b)}},"JS.SmilesSearch");g(b,"parseSmiles",function(a,
c,b,e){var d=v(1,0),l=0,j,h=null,g=!1;a:for(;null!=c&&0!=c.length;){var n=0;null==b&&(n=this.checkBioType(c,0),n==c.length&&(c+="*"),this.isBioSequence&&(a.needAromatic=a.top.needAromatic=!1));j=JS.SmilesParser.getChar(c,n);var k=this.checkBrace(a,j,"{");k&&(j=JS.SmilesParser.getChar(c,++n));if("("==j)if(h=JS.SmilesParser.getSubPattern(c,n,"("),j="."==JS.SmilesParser.getChar(c,n+1),null==b){if(j||!this.isSmarts)throw new JS.InvalidSmilesException("No previous atom for measure");a.haveComponents=!0;
do this.componentCount++,this.componentParenCount++,j=JS.SmilesParser.getChar(c=c.substring(1),0);while("("==j);if(!k&&!0==(k=this.checkBrace(a,j,"{")))j=JS.SmilesParser.getChar(c=c.substring(1),0)}else g=!1,h.startsWith(".")?(this.parseMeasure(a,h.substring(1),b),g=!0):0==h.length&&this.isBioSequence?b.notCrossLinked=!0:(this.branchLevel++,this.parseSmiles(a,h,b,!0),this.branchLevel--),n=h.length+2,j=JS.SmilesParser.getChar(c,n),"}"==j&&this.checkBrace(a,j,"}")&&n++,j="\x00";if("\x00"!=j){l=n;b:for(;"\x00"!=
j;){switch(JS.SmilesBond.isBondType(j,this.isSmarts,this.isBioSequence)){case 0:break b;case -1:if(!((JU.PT.isDigit(JS.SmilesParser.getChar(c,++n))&&0<n++?JU.PT.isDigit(JS.SmilesParser.getChar(c,n++)):1)&&"-"==(j=JS.SmilesParser.getChar(c,n))))throw new JS.InvalidSmilesException("malformed atropisomerism bond ^nn-  or ^^nn-");continue}j=JS.SmilesParser.getChar(c,++n)}j=JS.SmilesParser.getChar(c,n);if(")"==j){switch(JS.SmilesParser.getChar(c,++n).charCodeAt(0)){case 0:case 41:case 46:if(c=c.substring(n),
this.componentParenCount--,0<=this.componentParenCount)continue a}throw new JS.InvalidSmilesException("invalid continuation after component grouping (SMARTS).(SMARTS)");}h=this.parseBond(a,null,c.substring(l,n),null,b,!1,e,n-l,d);k&&-1!=h.order&&(j=JS.SmilesParser.getChar(c,n=l));this.checkBrace(a,j,"{")&&(j=JS.SmilesParser.getChar(c,++n));switch(j.charCodeAt(0)){case 126:0==h.order&&(n=this.checkBioType(c,n),n==c.length&&(c+="*"));break;case 40:do this.componentCount++,this.componentParenCount++,
j=JS.SmilesParser.getChar(c,++n);while("("==j);break;case 0:if(0==h.order)return}k=JU.PT.isDigit(j)||"%"==j;l=!k&&("_"==j||"["==j||"*"==j||JU.PT.isLetter(j));if(k){if(g)throw new JS.InvalidSmilesException("connection number must immediately follow its connecting atom");n=JS.SmilesParser.getRingNumber(c,n,j,d);this.parseConnection(a,d[0],b,h)}else if(l)switch(g=!1,j.charCodeAt(0)){case 91:case 95:k=JS.SmilesParser.getSubPattern(c,n,j);n+=k.length+("["==j?2:0);this.isBioSequence&&("["==j&&0>k.indexOf(".")&&
0>k.indexOf("_"))&&(k+=".0");b=this.parseAtom(a,null,k,b,h,"["==j,!1,e);b.hasSubpattern=!0;-1!=h.order&&0!=h.order&&this.setBondAtom(h,null,b,a);break;default:k=!this.isBioSequence&&JU.PT.isUpperCase(j)?JS.SmilesParser.getChar(c,n+1):"\x00";if("X"!=j||"x"!=k)if(!JU.PT.isLowerCase(k)||0==JU.Elements.elementNumberFromSymbol(c.substring(n,n+2),!0))k="\x00";"\x00"!=k&&0<="NA CA BA PA SC AC Na Ca Ba Pa Sc Ac".indexOf(c.substring(n,n+2))&&(k="\x00");j=JU.PT.isUpperCase(j)&&JU.PT.isLowerCase(k)?2:1;b=this.parseAtom(a,
null,c.substring(n,n+j),b,h,!1,!1,e);n+=j}else throw new JS.InvalidSmilesException("Unexpected character: "+JS.SmilesParser.getChar(c,n));j=JS.SmilesParser.getChar(c,n);"}"==j&&this.checkBrace(a,j,"}")&&n++}c=c.substring(n);e=!1}},"JS.SmilesSearch,~S,JS.SmilesAtom,~B");g(b,"parseConnection",function(a,b,f,e){b=Integer.$valueOf(b);var d=this.connections.get(b);if(null==d)this.connections.put(b,e),a.target.ringCount++;else{this.connections.remove(b);switch(e.order){case -1:e.order=-1!=d.order?d.order:
this.isSmarts||f.isAromatic&&d.atom1.isAromatic?81:1;break;case 1025:e.order=1041;break;case 1041:e.order=1025}if(-1!=d.order&&d.order!=e.order||f===d.atom1||null!=d.atom1.getBondTo(f))throw new JS.InvalidSmilesException("Bad connection type or atom");d.set(e);f.bondCount--;d.setAtom2(f,a)}},"JS.SmilesSearch,~N,JS.SmilesAtom,JS.SmilesBond");g(b,"setBondAtom",function(a,b,f,e){a.set2a(b,f);null!=e&&(2==a.order&&null!=a.atom1&&null!=a.atom2&&a.atom1.isAromatic&&a.atom2.isAromatic&&0==(this.flags&512))&&
e.setFlags(this.flags|=512)},"JS.SmilesBond,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesSearch");b.getRingNumber=g(b,"getRingNumber",function(a,b,f,e){switch(f.charCodeAt(0)){case 37:if("("==JS.SmilesParser.getChar(a,b+1)){if(a=JS.SmilesParser.getSubPattern(a,b+1,"("),JS.SmilesParser.getDigits(a,0,e),b+=a.length+3,0>e[0])throw new JS.InvalidSmilesException("Invalid number designation: "+a);}else if(b+3<=a.length&&(b=JS.SmilesParser.getDigits(a.substring(0,b+3),b+1,e)),10>e[0])throw new JS.InvalidSmilesException("Two digits must follow the % sign");
a=e[0];break;default:a=f.charCodeAt(0)-48,b++}e[0]=a;return b},"~S,~N,~S,~A");g(b,"checkBioType",function(a,b){if(this.isBioSequence="~"==a.charAt(b)){b++;this.bioType="*";var f=JS.SmilesParser.getChar(a,2);if("~"==f&&("*"==(f=a.charAt(1))||JU.PT.isLowerCase(f)))this.bioType=f,b=3}return b},"~S,~N");g(b,"parseMeasure",function(a,b,f){for(var e=b.indexOf(":"),d=0>e?b:b.substring(0,e);0!=e;){var l=d.length;1==l&&(d+="0");var j=this.htMeasures.get(d);if(null==j==0>e||0==l)break;try{if(0<e){var h="__dat".indexOf(d.charAt(0));
if(2>h)break;var g=v(1,0);JS.SmilesParser.getDigits(d,1,g);var n=g[0];b=b.substring(e+1);var k=b.startsWith("!");k&&(b=b.substring(1));var m=b.startsWith("-");m&&(b=b.substring(1));b=JU.PT.rep(b,"-",",");b=JU.PT.rep(b,",,",",-");m&&(b="-"+b);var t=JU.PT.split(b,",");if(1==t.length%2||k&&2!=t.length)break;for(var r=Q(t.length,0),s=t.length;0<=--s&&!Float.isNaN(r[s]=Float.parseFloat(t[s])););if(0<=s)break;j=new JS.SmilesMeasure(a,n,h,k,r);a.measures.addLast(j);0<n?this.htMeasures.put(d,j):0==n&&JU.Logger.debugging&&
JU.Logger.debug("measure created: "+j)}else{if(!j.addPoint(f.index))break;j.nPoints==j.type&&(this.htMeasures.remove(d),JU.Logger.debugging&&JU.Logger.debug("measure created: "+j));return}if(!j.addPoint(f.index))break}catch(p){if(H(p,"NumberFormatException"))break;else throw p;}return}throw new JS.InvalidSmilesException("invalid measure: "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom");g(b,"checkBrace",function(a,b,f){switch(b.charCodeAt(0)){case 123:if(b!=f)break;this.braceCount++;return a.top.haveSelected=
!0;case 125:if(b!=f)break;if(0<this.braceCount)return this.braceCount--,!0;break;default:return!1}throw new JS.InvalidSmilesException("Unmatched '}'");},"JS.SmilesSearch,~S,~S");g(b,"parseNested",function(a,b,f){var e;for(f="$("+f;0<=(e=b.lastIndexOf(f));){var d=JS.SmilesParser.getSubPattern(b,e+1,"("),l=e+d.length+3,j=b.substring(l);b=b.substring(0,e);var h="";if(b.endsWith("]"))throw new JS.InvalidSmilesException("$(...) must be enclosed in brackets: "+b+"$("+d+")");if(1<e&&2==f.length&&1<(l=b.length)&&
0>",;&![".indexOf(b.substring(l-1)))h="&";1<j.length&&0>",;&!)]".indexOf(j.charAt(0))&&(j="&"+j);b=b+h+"_"+a.top.addNested(d)+"_"+j}return b},"JS.SmilesSearch,~S,~S");g(b,"parseVariables",function(a){var b=new JU.Lst,f=new JU.Lst,e,d=0,l=-1;for(JU.Logger.debugging&&JU.Logger.info(a);0<=(e=a.indexOf("$",d))&&"("!=JS.SmilesParser.getChar(a,e+1);){d=JS.SmilesParser.skipTo(a,e,"=");if(d<=e+1||'"'!=JS.SmilesParser.getChar(a,d+1))break;e=a.substring(e,d);if(0<e.lastIndexOf("$")||0<e.indexOf("]"))throw new JS.InvalidSmilesException("Invalid variable name: "+
e);l=JS.SmilesParser.getSubPattern(a,d+1,'"');b.addLast("["+e+"]");f.addLast(l);d+=l.length+2;d=JS.SmilesParser.skipTo(a,d,";");l=++d}if(0>l)return a;a=a.substring(l);for(d=b.size();0<=--d;)e=b.get(d),l=f.get(d),l.equals(e)||(a=JU.PT.rep(a,e,l));JU.Logger.debugging&&JU.Logger.info(a);return a},"~S");g(b,"parseAtom",function(a,b,f,e,d,l,j,h){if(null==f||0==f.length)throw new JS.InvalidSmilesException("Empty atom definition");var g=new JS.SmilesAtom;0<this.componentParenCount&&(g.component=this.componentCount);
null==b&&a.appendAtom(g);if(!this.checkLogic(a,f,g,null,e,j,h,null)){var n=v(1,0);this.isBioSequence&&1==f.length&&(f+=".0");var k=f.charAt(0),m=0,t=!1;if(this.isSmarts&&"!"==k){k=JS.SmilesParser.getChar(f,++m);if("\x00"==k)throw new JS.InvalidSmilesException("invalid '!'");g.not=t=!0}var r=0<=f.indexOf("@PH")?-1:f.indexOf(".");if(0<=r){g.isBioResidue=!0;var s=f.substring(m,r);f=f.substring(r+1).toUpperCase();var p=s.length;if(0<=(r=s.indexOf("^")))r==p-2&&(k=s.charAt(p-1),"*"!=k&&(g.insCode=k)),
s=s.substring(0,r);if(0<=(r=s.indexOf("#")))JS.SmilesParser.getDigits(s,r+1,n),g.residueNumber=n[0],s=s.substring(0,r);0==s.length&&(s="*");1<s.length?g.residueName=s.toUpperCase():s.equals("*")||(g.residueChar=s);s=f;if(0<=(r=s.indexOf("#")))JS.SmilesParser.getDigits(s,r+1,n),g.elementNumber=n[0],s=s.substring(0,r);0==s.length?s="*":s.equals("0")&&(s="\x00");s.equals("*")?g.isBioAtomWild=!0:g.setAtomName(s);k="\x00"}g.setBioAtom(this.bioType);for(r=-2147483648;"\x00"!=k;){g.setAtomName(this.isBioSequence?
"\x00":"");if(JU.PT.isDigit(k)){m=JS.SmilesParser.getDigits(f,m,n);k=n[0];if(-2147483648==k)throw new JS.InvalidSmilesException("Non numeric atomic mass");"?"==JS.SmilesParser.getChar(f,m)&&(m++,k=-k);if(g.elementDefined)throw new JS.InvalidSmilesException('atom mass must precede atom symbol or be separated from it with ";"');g.setAtomicMass(k)}else switch(k.charCodeAt(0)){case 34:k=JU.PT.getQuotedStringAt(f,m);m+=k.length+2;g.atomType=k;break;case 95:m=JS.SmilesParser.getDigits(f,m+1,n)+1;if(-2147483648==
n[0])throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+f.substring(m));g.iNested=n[0];if(!l)throw new JS.InvalidSmilesException("nesting must appear in [...]: $("+a.getNested(n[0])+")");if(this.isBioSequence&&m!=f.length)throw new JS.InvalidSmilesException("invalid characters: "+f.substring(m));break;case 61:m=JS.SmilesParser.getDigits(f,m+1,n);g.jmolIndex=n[0];break;case 35:k="-"==f.charAt(m+1);m=JS.SmilesParser.getDigits(f,m+(k?2:1),n);k?g.atomNumber=n[0]:g.elementNumber=n[0];break;
case 45:case 43:m=this.checkCharge(f,m,g);break;case 64:null==a.stereo&&(a.stereo=JS.SmilesStereo.newStereo(a));m=JS.SmilesStereo.checkChirality(a,f,m,a.patternAtoms[g.index]);break;case 58:m=JS.SmilesParser.getDigits(f,++m,n);if(-2147483648==n[0])throw new JS.InvalidSmilesException("Invalid atom class");g.atomClass=n[0];break;default:var s=JS.SmilesParser.getChar(f,m+1),p=m+(JU.PT.isLowerCase(s)&&(!l||!JU.PT.isDigit(JS.SmilesParser.getChar(f,m+2)))?2:1),A=f.substring(m+1,p),w=Character.toUpperCase(k)+
A,u=!0;l&&JU.PT.isLetter(k)&&(!t&&(j?b:g).hasSymbol?u=!1:"H"==k?u=1==f.length||!JU.PT.isDigit(s):JU.PT.isDigit(s)?u=!1:!w.equals("A")&&!w.equals("Xx")&&(u=("h"==k?2==p:!0)&&0<JU.Elements.elementNumberFromSymbol(w,!0),!u&&2==p&&(A="",w=w.substring(0,1),u=0<JU.Elements.elementNumberFromSymbol(w,!0))));if(u){if(!l&&!this.isSmarts&&!this.isBioSequence&&!JS.SmilesAtom.allowSmilesUnbracketed(w)||!g.setSymbol(w=k+A))throw new JS.InvalidSmilesException("Invalid atom symbol: "+w);j&&(b.hasSymbol=!0);m+=w.length}else switch(m=
JS.SmilesParser.getDigits(f,m+1,n),p=n[0],k.charCodeAt(0)){default:throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+f.substring(m));case 68:g.setDegree(-2147483648==p?1:p);break;case 100:g.setNonhydrogenDegree(-2147483648==p?1:p);break;case 72:r=-2147483648==p?1:p;break;case 104:g.setImplicitHydrogenCount(-2147483648==p?-1:p);break;case 82:-2147483648==p&&(p=-1);g.setRingMembership(p);a.top.needRingData=!0;break;case 114:if(-2147483648==p)p=-1,g.setRingMembership(p);else{g.setRingSize(p);
switch(p){case 500:p=5;break;case 600:p=6}p>a.ringDataMax&&(a.ringDataMax=p)}a.top.needRingData=!0;break;case 118:g.setValence(-2147483648==p?1:p);break;case 88:g.setConnectivity(-2147483648==p?1:p);break;case 120:g.setRingConnectivity(-2147483648==p?-1:p),a.top.needRingData=!0}}k=JS.SmilesParser.getChar(f,m);if(t&&"\x00"!=k)throw new JS.InvalidSmilesException("'!' may only involve one primitive.");}-2147483648==r&&l&&(r=-2147483647);g.setExplicitHydrogenCount(r);a.patternAtoms[g.index].setExplicitHydrogenCount(r)}0<
this.braceCount&&(g.selected=!0);null!=b&&b.addSubAtom(g,j);null!=e&&0==d.order&&(g.notBondedIndex=e.index);null!=e&&0!=d.order&&(-1==d.order&&(d.order=this.isBioSequence&&h?112:this.isSmarts||e.isAromatic&&g.isAromatic?81:1),l||this.setBondAtom(d,null,g,a),0==this.branchLevel&&(17==d.getBondType()||112==d.order)&&this.branchLevel++);0==this.branchLevel&&(a.lastChainAtom=g);return g},"JS.SmilesSearch,JS.SmilesAtom,~S,JS.SmilesAtom,JS.SmilesBond,~B,~B,~B");g(b,"checkCharge",function(a,b,f){var e=a.length,
d=a.charAt(b),g=1;++b;if(b<e){var j=a.charAt(b);if(JU.PT.isDigit(j)){if(e=v(1,0),b=JS.SmilesParser.getDigits(a,b,e),g=e[0],-2147483648==g)throw new JS.InvalidSmilesException("Non numeric charge");}else for(;b<e&&a.charAt(b)==d;)b++,g++}f.setCharge("+"==d?g:-g);return b},"~S,~N,JS.SmilesAtom");g(b,"parseBond",function(a,b,f,e,d,g,j,h,k){var n;if(0<h)switch((n=f.charAt(0)).charCodeAt(0)){case 62:if(!f.equals(">>")){h=-1;break}case 46:if(null==e&&null==b)return this.isBioSequence="~"==JS.SmilesParser.getChar(f,
1),new JS.SmilesBond(null,null,0,!1);h=-1;break;case 43:null!=b&&(h=-1)}else n="\x00";e=null==b?null==e?new JS.SmilesBond(d,null,this.isBioSequence&&null!=d?j?112:96:-1,!1):e:g?b.addPrimitive():b.addBondOr();if(0<h&&!this.checkLogic(a,f,null,e,d,g,!1,k)){if(g="!"==n)if(n=JS.SmilesParser.getChar(f,1),"\x00"==n||"!"==n)throw new JS.InvalidSmilesException("invalid '!'");j=JS.SmilesBond.getBondTypeFromCode(n);65==j&&(a.top.needRingMemberships=!0);if(null==d&&0!=j)throw new JS.InvalidSmilesException("Bond without a previous atom");
switch(j){case 65537:case 65538:(h=f.length)<(g?3:2)||"-"!=f.charAt(h-1)?h=0:h==(g?3:2)?e.setAtropType(22):(JS.SmilesParser.getDigits(f,g?2:1,k),e.setAtropType(k[0]));a.haveBondStereochemistry=!0;break;case 1025:case 1041:this.bondDirectionPaired=!this.bondDirectionPaired;a.haveBondStereochemistry=!0;break;case 2:a.top.nDouble++;case 1:d.isAromatic&&(a.top.needRingData=!0)}e.set2(j,g);this.isBioSequence&&null!=b&&b.set2(j,g)}if(-1==h)throw new JS.InvalidSmilesException("invalid bond:"+n);return e},
"JS.SmilesSearch,JS.SmilesBond,~S,JS.SmilesBond,JS.SmilesAtom,~B,~B,~N,~A");g(b,"checkLogic",function(a,b,f,e,d,g,j,h){var k=b.lastIndexOf("!");null!=f&&(f.pattern=b);for(;0<k;)0>",;&!(".indexOf(b.charAt(k-1))&&(b=b.substring(0,k)+"&"+b.substring(k)),k=b.lastIndexOf("!",k-1);var k=b.indexOf(","),n=b.length,v="&";a:for(;;){var m=0<k;if(m&&!this.isSmarts||0==k)break;k=b.indexOf(";");if(0<=k){if(!this.isSmarts||0==k)break;m?(v=";",m=!1):b=b.$replace(";","&")}var t=0;if(m)for(b+=",";0<(k=b.indexOf(",",
t))&&k<=n;){t=b.substring(t,k);if(0==t.length)throw new JS.InvalidSmilesException("missing "+(null==e?"atom":"bond")+" token");null==e?this.parseAtom(a,f,t,null,null,!0,!1,j):this.parseBond(a,e,t,null,d,!1,!1,t.length,h);t=k+1}else if(0<=(k=b.indexOf(v))||null!=e&&1<n&&!g){if(0==k||null==e&&!this.isSmarts)break;if(null!=e&&0>k&&1<n){g=new JU.SB;for(m=0;m<n;){var r=b.charAt(m++);g.appendC(r);switch(r.charCodeAt(0)){case 33:if(!this.isSmarts)break a;continue;case 94:case 96:for(;"-"!=(r=b.charAt(m++))&&
"\x00"!=r;)g.appendC(r);g.appendC("-")}if(m<n){if(!this.isSmarts)break a;g.append(v)}}b=g.toString();n=b.length}for(b+=v;0<(k=b.indexOf(v,t))&&k<=n;)t=b.substring(t,k),null==e?this.parseAtom(a,f,t,null,null,!0,!0,j):this.parseBond(a,this.isSmarts?e:null,t,this.isSmarts?null:e,d,!0,!1,t.length,h),t=k+1}else return!1;return!0}r=b.charAt(k);throw new JS.InvalidSmilesException((this.isSmarts?"invalid placement for '"+r+"'":"["+r+"] notation only valid with SMARTS, not SMILES,")+" in "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom,JS.SmilesBond,JS.SmilesAtom,~B,~B,~A");
b.getSubPattern=g(b,"getSubPattern",function(a,b,f){var e,d=1;switch(f.charCodeAt(0)){case 91:e="]";break;case 34:case 37:case 47:e=f;break;case 40:e=")";break;default:e=f,d=0}for(var g=a.length,j=1,h=b+1;h<g;h++){var k=a.charAt(h);if(k==e){if(j--,0==j)return a.substring(b+d,h+1-d)}else k==f&&j++}throw new JS.InvalidSmilesException("Unmatched "+f);},"~S,~N,~S");b.getChar=g(b,"getChar",function(a,b){return b<a.length?a.charAt(b):"\x00"},"~S,~N");b.getDigits=g(b,"getDigits",function(a,b,f){for(var e=
b,d=a.length;e<d&&JU.PT.isDigit(a.charAt(e));)e++;if(e>b)try{return f[0]=Integer.parseInt(a.substring(b,e)),e}catch(g){if(!H(g,"NumberFormatException"))throw g;}f[0]=-2147483648;return e},"~S,~N,~A");b.skipTo=g(b,"skipTo",function(a,b,f){for(var e;(e=JS.SmilesParser.getChar(a,++b))!=f&&"\x00"!=e;);return"\x00"==e?-1:b},"~S,~N,~S");b.cleanPattern=g(b,"cleanPattern",function(a){a=JU.PT.replaceAllCharacters(a," \t\n\r","");a=JU.PT.rep(a,"^^","`");for(var b=0,f=0;0<=(b=a.indexOf("//*"))&&(f=a.indexOf("*//"))>=
b;)a=a.substring(0,b)+a.substring(f+3);return a=JU.PT.rep(a,"//","")},"~S");b.extractFlags=g(b,"extractFlags",function(a,b){a=JS.SmilesParser.cleanPattern(a);for(var f=0;a.startsWith("/");){var e=JS.SmilesParser.getSubPattern(a,0,"/").toUpperCase();a=a.substring(e.length+2);f=JS.SmilesSearch.addFlags(f,e)}b[0]=f;return a},"~S,~A");b.getFlags=g(b,"getFlags",function(a){var b=v(1,0);JS.SmilesParser.extractFlags(a,b);return b[0]},"~S")});A("JS");D(null,"JS.SmilesExt","JU.AU $.BS $.Lst $.M4 $.Measure $.P3 J.api.Interface JU.Logger".split(" "),
function(){var b=G(function(){this.e=null;K(this,arguments)},JS,"SmilesExt",null);g(b,"init",function(a){this.e=a;return this},"~O");g(b,"getSmilesCorrelation",function(a,b,f,e,d,g,j,h,k,n,v,m){var t=null==k?0.1:3.4028235E38;try{null==e&&(e=new JU.Lst,d=new JU.Lst);var r=new JU.M4,s=new JU.P3,p=this.e.vwr.ms.at,A=this.e.vwr.ms.ac,w=this.e.vwr.getSmilesMatcher(),u=w.getCorrelationMaps(f,p,A,a,m|8);null==u&&this.e.evalError(w.getLastException(),null);if(0==u.length)return NaN;var y=u[0];for(a=0;a<y.length;a++)e.addLast(p[y[a]]);
u=w.getCorrelationMaps(f,p,A,b,m);null==u&&this.e.evalError(w.getLastException(),null);if(0==u.length)return NaN;JU.Logger.info(u.length+" mappings found");if(v||!h){b=3.4028235E38;f=null;for(a=0;a<u.length;a++){d.clear();for(var z=0;z<u[a].length;z++)d.addLast(p[u[a][z]]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");var x=1==d.size()?0:JU.Measure.getTransformMatrix4(e,d,r,null);JU.Logger.info("getSmilesCorrelation stddev="+x);if(null!=j&&x<t){for(var C=new JU.BS,z=0;z<u[a].length;z++)C.set(u[a][z]);
j.addLast(C)}x<b&&(f=u[a],null!=g&&g.setM4(r),null!=n&&n.setT(s),b=x)}null!=k&&(k[0]=y,k[1]=f);d.clear();for(a=0;a<f.length;a++)d.addLast(p[f[a]]);return b}for(a=0;a<u.length;a++)for(z=0;z<u[a].length;z++)d.addLast(p[u[a][z]])}catch(B){if(H(B,Exception))this.e.evalError(B.getMessage(),null);else throw B;}return 0},"JU.BS,JU.BS,~S,JU.Lst,JU.Lst,JU.M4,JU.Lst,~B,~A,JU.P3,~B,~N");g(b,"getSmilesMatches",function(a,b,f,e,d,g,j){var h="string"==typeof a?a:"-";if(0==h.length||h.endsWith("///")||h.equals("H")||
h.equals("H2")||h.equals("top")||h.equalsIgnoreCase("NOAROMATIC"))try{return this.e.vwr.getSmilesOpt(f,0,0,d|(h.equals("H2")?8192:0)|(h.equals("H")?4096:0)|(h.equals("top")?16384:0)|(h.equalsIgnoreCase("NOAROMATIC")?16:0),h.endsWith("///")?h:null)}catch(k){if(H(k,Exception))this.e.evalError(k.getMessage(),null);else throw k;}var n;if(null==e)try{if(null==b)n=this.e.vwr.getSubstructureSetArray(a,f,d);else{if("chirality".equals(h))return this.e.vwr.calculateChiralityForSmiles(b.toString());n=2==(d&
2);d=(n?2:1)|(j?8:0)|(16384==(d&16384)?16384:0);if(I(b,Array))return this.e.vwr.getSmilesMatcher().hasStructure(h,b,d);var A=this.e.vwr.getSmilesMatcher().find(a,b,d);if(!g)return!j?A:0==A.length?v(0,0):A[0];var m=new JU.BS;for(g=0;g<A.length;g++)for(var t=A[g],r=t.length;0<=--r;)0<=t[r]&&m.set(t[r]);if(!n)return v(m.cardinality(),0);var s=v(m.cardinality(),0);g=0;for(var p=m.nextSetBit(0);0<=p;p=m.nextSetBit(p+1))s[g++]=p;return s}}catch(D){if(H(D,Exception))return this.e.evalError(D.getMessage(),
null),null;throw D;}else{m=new JU.Lst;s=this.getSmilesCorrelation(e,f,h,null,null,null,m,!1,null,null,!1,d);if(Float.isNaN(s))return g?new JU.BS:O(-1,[]);this.e.showString("RMSD "+s+" Angstroms");n=m.toArray(Array(m.size()))}if(g){m=new JU.BS;for(g=0;g<n.length;g++)m.or(n[g]);return m}m=new JU.Lst;for(g=0;g<n.length;g++)m.addLast(n[g]);return m},"~O,~O,JU.BS,JU.BS,~N,~B,~B");g(b,"getFlexFitList",function(a,b,f,e){var d=JU.AU.newInt2(2);this.getSmilesCorrelation(a,b,f,null,null,null,null,!1,d,null,
!1,e?2:1);if(null==d[0])return null;a=this.e.vwr.ms.getDihedralMap(d[0]);b=null==a?null:this.e.vwr.ms.getDihedralMap(d[1]);if(null==b||b.length!=a.length)return null;d=Q(a.length,3,0);f=this.e.vwr.ms.at;JS.SmilesExt.getTorsions(f,b,d,0);JS.SmilesExt.getTorsions(f,a,d,1);b=Q(6*a.length,0);for(e=f=0;f<a.length;f++){var g=a[f];b[e++]=g[0];b[e++]=g[1];b[e++]=g[2];b[e++]=g[3];b[e++]=d[f][0];b[e++]=d[f][1]}return b},"JU.BS,JU.BS,~S,~B");b.getTorsions=g(b,"getTorsions",function(a,b,f,e){for(var d=b.length;0<=
--d;){var g=b[d],g=JU.Measure.computeTorsion(a[g[0]],a[g[1]],a[g[2]],a[g[3]],!0);1==e&&(180<g-f[d][0]?g-=360:-180>=g-f[d][0]&&(g+=360));f[d][e]=g}},"~A,~A,~A,~N");g(b,"mapPolyhedra",function(a,b,f,e){var d=new JU.Lst,g=new JU.Lst,j;j=O(-1,[Integer.$valueOf(a),null]);this.e.getShapePropertyData(21,"syminfo",j);a=j[1];j[0]=Integer.$valueOf(b);j[1]=null;this.e.getShapePropertyData(21,"syminfo",j);b=j[1];if(null==a||null==b)return NaN;j=a.get("polySmiles");var h=b.get("polySmiles");f=this.getSmilesMatches(h,
j,null,null,f?1:16385,!1,!0);if(0==f.length)return NaN;d.addLast(a.get("center"));a=a.get("vertices");j=0;for(h=a.length;j<h;j++)d.addLast(a[f[j+1]-1]);g.addLast(b.get("center"));a=b.get("vertices");j=0;for(h=a.length;j<h;j++)g.addLast(a[j]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");return JU.Measure.getTransformMatrix4(d,g,e,null)},"~N,~N,~B,JU.M4")})})(Clazz,Clazz.getClassName,Clazz.newLongArray,Clazz.doubleToByte,Clazz.doubleToInt,Clazz.doubleToLong,Clazz.declarePackage,Clazz.instanceOf,
Clazz.load,Clazz.instantialize,Clazz.decorateAsClass,Clazz.floatToInt,Clazz.floatToLong,Clazz.makeConstructor,Clazz.defineEnumConstant,Clazz.exceptionOf,Clazz.newIntArray,Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,Clazz.newByteArray,Clazz.declareInterface,Clazz.newShortArray,Clazz.innerTypeInstance,Clazz.isClassDefined,Clazz.prepareCallback,Clazz.newArray,Clazz.castNullAs,Clazz.floatToShort,Clazz.superCall,Clazz.decorateAsType,Clazz.newBooleanArray,Clazz.newCharArray,
Clazz.implementOf,Clazz.newDoubleArray,Clazz.overrideConstructor,Clazz.clone,Clazz.doubleToShort,Clazz.getInheritedLevel,Clazz.getParamsType,Clazz.isAF,Clazz.isAB,Clazz.isAI,Clazz.isAS,Clazz.isASS,Clazz.isAP,Clazz.isAFloat,Clazz.isAII,Clazz.isAFF,Clazz.isAFFF,Clazz.tryToSearchAndExecute,Clazz.getStackTrace,Clazz.inheritArgs,Clazz.alert,Clazz.defineMethod,Clazz.overrideMethod,Clazz.declareAnonymous,Clazz.cloneFinals);
