(function(V,W,X,Y,S,Z,z,O,C,D,E,T,$,F,aa,I,u,L,Q,R,M,P,ba,U,ca,da,ea,fa,ga,ha,N,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia,g,l){z("JS");C(["JU.BS","$.V3"],"JS.VTemp",null,function(){c$=E(function(){this.bsTemp=this.vNorm4=this.vNorm3=this.vNorm2=this.vTemp2=this.vTemp1=this.vB=this.vA=this.vTemp=null;D(this,arguments)},JS,"VTemp");M(c$,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})});z("J.api");U(J.api,"SmilesMatcherInterface");z("JS");C(["J.api.SmilesMatcherInterface"],"JS.SmilesMatcher","JU.AU $.BS $.Lst $.PT JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesGenerator $.SmilesParser $.SmilesSearch JU.BSUtil $.Elements $.Logger $.Node $.Point3fi".split(" "),function(){c$=E(function(){this.okMF=!0;D(this,arguments)},JS,"SmilesMatcher",null,J.api.SmilesMatcherInterface);l(c$,"getLastException",function(){return!0==
this.okMF?JS.InvalidSmilesException.getLastError():"MF_FAILED"});l(c$,"getMolecularFormula",function(a,b){this.clearExceptions();var c=JS.SmilesParser.newSearch("/nostereo/"+a,b,!0);c.createTopoMap(null);c.nodes=c.targetAtoms;return c.getMolecularFormula(!b,null,!1)},"~S,~B");g(c$,"clearExceptions",function(){this.okMF=!0;JS.InvalidSmilesException.clear()});l(c$,"getSmiles",function(a,b,c,d,e){this.clearExceptions();return(new JS.SmilesGenerator).getSmiles(this,a,b,c,d,e)},"~A,~N,JU.BS,~S,~N");l(c$,
"areEqual",function(a,b){this.clearExceptions();var c=0<=a.indexOf("*");if(!c&&a.equals(b))return 1;c=this.matchPriv(a,null,0,null,null,!1,(c?2:1)|8,2,JS.SmilesParser.newSearch(b,!1,!0));return null==c?-1:c.length},"~S,~S");g(c$,"areEqualTest",function(a,b){var c=this.matchPriv(a,null,0,null,null,!1,9,2,b);return null!=c&&1==c.length},"~S,JS.SmilesSearch");l(c$,"find",function(a,b,c){this.clearExceptions();b=JS.SmilesParser.cleanPattern(b);a=JS.SmilesParser.cleanPattern(a);b=JS.SmilesParser.newSearch(b,
!1,!0);a=this.matchPriv(a,null,0,null,null,!1,c,3,b);for(c=a.length;0<=--c;)for(var d=a[c],e=d.length;0<=--e;)d[e]=b.targetAtoms[d[e]].mapIndex;return a},"~S,~S,~N");l(c$,"getAtoms",function(a){this.clearExceptions();a=JS.SmilesParser.cleanPattern(a);a=JS.SmilesParser.newSearch(a,!1,!0);a.createTopoMap(new JU.BS);return a.targetAtoms},"~S");l(c$,"getRelationship",function(a,b){if(null==a||null==b||0==a.length||0==b.length)return"";var c=this.getMolecularFormula(a,!1),d=this.getMolecularFormula(b,
!1);if(!c.equals(d))return"none";var e,c=JU.PT.countChar(JU.PT.rep(a,"@@","@"),"@"),d=JU.PT.countChar(JU.PT.rep(b,"@@","@"),"@");e=c==d&&0<this.areEqual(b,a);if(!e){e=a+b;if(0<=e.indexOf("/")||0<=e.indexOf("\\")||0<=e.indexOf("@")){if(c==d&&(0<c&&0>e.indexOf("@SP"))&&(e=0<this.areEqual("/invertstereo/"+b,a)))return"enantiomers";if(e=0<this.areEqual("/nostereo/"+b,a))return c==d?"diastereomers":"ambiguous stereochemistry!"}return"constitutional isomers"}return"identical"},"~S,~S");l(c$,"reverseChirality",
function(a){a=JU.PT.rep(a,"@@","!@");a=JU.PT.rep(a,"@","@@");return a=JU.PT.rep(a,"!@@","@")},"~S");l(c$,"getSubstructureSet",function(a,b,c,d,e){return this.matchPriv(a,b,c,d,null,!0,e|JS.SmilesParser.getFlags(a),1,null)},"~S,~A,~N,JU.BS,~N");l(c$,"getMMFF94AtomTypes",function(a,b,c,d,e,f){this.clearExceptions();var h=new JS.SmilesParser(!0,!0),j=null,j=h.parse("");j.exitFirstMatch=!1;j.targetAtoms=b;j.targetAtomCount=Math.abs(c);j.setSelected(d);j.flags=770;j.getRingData(f,!0,!0);j.asVector=!1;
j.subSearches=Array(1);j.getSelections();b=new JU.BS;for(d=0;d<a.length;d++)if(null==a[d]||0==a[d].length||a[d].startsWith("#"))e.addLast(null);else if(j.clear(),j.subSearches[0]=h.getSubsearch(j,JS.SmilesParser.cleanPattern(a[d]),770),f=JU.BSUtil.copy(j.search()),e.addLast(f),b.or(f),b.cardinality()==c)break},"~A,~A,~N,JU.BS,JU.Lst,~A");l(c$,"getSubstructureSetArray",function(a,b,c,d,e,f){return this.matchPriv(a,b,c,d,e,!0,f,2,null)},"~S,~A,~N,JU.BS,JU.BS,~N");g(c$,"getAtropisomerKeys",function(a,
b,c,d,e,f){return this.matchPriv(a,b,c,d,e,!1,f,4,null)},"~S,~A,~N,JU.BS,JU.BS,~N");l(c$,"polyhedronToSmiles",function(a,b,c,d,e,f){for(var h=Array(c),j=0;j<c;j++){h[j]=new JS.SmilesAtom;var n=null==d?null:d[j];O(n,JU.Node)?(h[j].elementNumber=n.getElementNumber(),h[j].bioAtomName=n.getAtomName(),h[j].atomNumber=n.getAtomNumber(),h[j].setT(n)):h[j].elementNumber=O(n,JU.Point3fi)?n.sD:-2;h[j].index=j}n=0;for(j=b.length;0<=--j;)for(var G=b[j],k=G.length,m,g,r=k;0<=--r;)if(!((m=G[r])>=c||(g=G[(r+1)%
k])>=c)&&null==h[m].getBondTo(h[g]))(new JS.SmilesBond(h[m],h[g],1,!1)).index=n++;for(j=0;j<c;j++)if(k=h[j].bondCount,0==k||k!=h[j].bonds.length)h[j].bonds=JU.AU.arrayCopyObject(h[j].bonds,k);b=null;b=new JS.SmilesGenerator;null!=d&&(b.polySmilesCenter=a);this.clearExceptions();b=b.getSmiles(this,h,c,JU.BSUtil.newBitSet2(0,c),null,e|4144);65536==(e&65536)&&(b=(0==(e&131072)?"":"//* "+a+" *//\t")+"["+JU.Elements.elementSymbolFromNumber(a.getElementNumber())+"@PH"+c+(null==f?"":"/"+f+"/")+"]."+b);return b},
"JU.Node,~A,~N,~A,~N,~S");l(c$,"getCorrelationMaps",function(a,b,c,d,e){return this.matchPriv(a,b,c,d,null,!0,e,3,null)},"~S,~A,~N,JU.BS,~N");g(c$,"matchPriv",function(a,b,c,d,e,f,h,j,n){this.clearExceptions();try{var G=2==(h&2),k=JS.SmilesParser.newSearch(a,G,!1);if(null!=n){k.haveTopo=!0;e=new JU.BS;n.setFlags(n.flags|JS.SmilesParser.getFlags(a));n.createTopoMap(e);b=n.targetAtoms;c=n.targetAtoms.length;var m=n.getMolecularFormulaImpl(!0,null,!1,!1),g=k.getMolecularFormulaImpl(!0,null,!1,!1);if(G)for(var r=
n.elementCounts,q=k.elementCounts,p=Math.max(n.elementNumberMax,k.elementNumberMax);0<p;p--){if(r[p]<q[p]){this.okMF=!1;break}}else this.okMF=g.equals(m);n.mf=k.mf=null}if(this.okMF&&(!G&&!k.patternAromatic&&(null==e&&(e=new JU.BS),JS.SmilesSearch.normalizeAromaticity(k.patternAtoms,e,k.flags),k.isNormalized=!0),k.targetAtoms=b,k.targetAtomCount=c,0!=c&&(null==d||!d.isEmpty()))){var l=!O(b[0],JS.SmilesAtom);k.setSelected(d);k.getSelections();f||(k.bsAromatic=e);k.setRingData(null,null,l||f);k.exitFirstMatch=
8==(h&8);k.mapUnique=128==(h&128)}switch(j){case 1:return k.asVector=!1,this.okMF?k.search():new JU.BS;case 2:if(!this.okMF)return new JU.Lst;k.asVector=!0;var s=k.search();return s.toArray(Array(s.size()));case 4:if(!this.okMF)return"";k.exitFirstMatch=!0;k.setAtropicity=!0;k.search();return k.atropKeys;case 3:if(!this.okMF)return u(0,0,0);k.getMaps=!0;k.setFlags(h|k.flags);var t=k.search();return t.toArray(JU.AU.newInt2(t.size()))}}catch(y){if(I(y,Exception))throw JU.Logger.debugging&&y.printStackTrace(),
null==JS.InvalidSmilesException.getLastError()&&this.clearExceptions(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw y;}return null},"~S,~A,~N,JU.BS,JU.BS,~B,~N,~N,JS.SmilesSearch");l(c$,"cleanSmiles",function(a){return JS.SmilesParser.cleanPattern(a)},"~S");l(c$,"getMapForJME",function(a,b,c){var d=new JS.SmilesSearch,e=JU.PT.getTokens(a);a=JU.PT.parseInt(e[0]);for(var f=JU.PT.parseInt(e[1]),h=2,j=0;j<a;j++,h+=3){var n=e[h],G=d.addAtom(),k=n.indexOf("+"),m=0;if(0<=
k)m=k==n.length-1?1:JU.PT.parseInt(n.substring(k+1));else if(0<=(k=n.indexOf("-")))m=JU.PT.parseInt(n.substring(k));G.setCharge(m);G.setSymbol(0>k?n:n.substring(0,k))}for(j=0;j<f;j++){G=JU.PT.parseInt(e[h++])-1;k=JU.PT.parseInt(e[h++])-1;n=JU.PT.parseInt(e[h++]);G=d.patternAtoms[G];k=d.patternAtoms[k];m=1;switch(n){case 2:m=2;break;case 3:m=3}(new JS.SmilesBond(G,k,m,!1)).index=j}e="";try{d.isSmarts=!0;d.set();var g=JU.BSUtil.newBitSet2(0,a),e=this.getSmiles(d.patternAtoms,d.ac,g,null,34),r=this.getCorrelationMaps(e,
d.patternAtoms,a,g,42),q=this.getCorrelationMaps(e,b,c.cardinality(),c,42);return N(-1,[r[0],q[0]])}catch(p){if(I(p,Exception))p.printStackTrace();else throw p;}return null},"~S,~A,JU.BS");L(c$,"MODE_BITSET",1,"MODE_ARRAY",2,"MODE_MAP",3,"MODE_ATROP",4)});z("JS");C(["java.lang.Exception"],"JS.InvalidSmilesException",null,function(){c$=R(JS,"InvalidSmilesException",Exception);c$.getLastError=g(c$,"getLastError",function(){return JS.InvalidSmilesException.lastError});c$.clear=g(c$,"clear",function(){JS.InvalidSmilesException.lastError=
null});l(c$,"getMessage",function(){return JS.InvalidSmilesException.lastError});F(c$,function(a){P(this,JS.InvalidSmilesException,[a]);JS.InvalidSmilesException.lastError=a.startsWith("Jmol SMILES")?a:"Jmol SMILES Exception: "+a},"~S");L(c$,"lastError",null)});z("JS");C(["JU.JmolMolecule","JU.BS","$.Lst"],"JS.SmilesSearch","java.lang.Float java.util.Hashtable JU.AU $.SB JS.InvalidSmilesException $.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesParser $.SmilesStereo $.VTemp JU.BSUtil $.Logger".split(" "),
function(){c$=E(function(){this.isSmarts=!1;this.targetAtoms=this.patternAtoms=this.pattern=this.top=null;this.targetAtomCount=0;this.v=this.bsSelected=null;this.patternBioSequence=this.isTopology=this.haveTopo=this.patternAromatic=this.setAtropicity=this.groupByModel=this.exitFirstMatch=this.invertStereochemistry=this.ignoreStereochemistry=this.ignoreAtomClass=this.noAromatic=this.aromaticUnknown=this.aromaticDefined=this.aromaticMMFF94=this.aromaticDouble=this.aromaticPlanar=this.aromaticStrict=
this.aromaticOpen=!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.ringSets=null;this.ringCount=0;this.measures=null;this.flags=0;this.lastChainAtom=this.atropKeys=this.bsAromatic6=this.bsAromatic5=this.bsAromatic=null;this.isRingCheck=this.isSilent=this.haveComponents=this.isNormalized=this.getMaps=this.asVector=!1;this.selectedAtomCount=
0;this.htNested=this.bsFound=this.ringConnections=this.ringCounts=this.ringData=null;this.nNested=0;this.bsCheck=this.bsReturn=this.uniqueList=this.vReturn=this.nestedBond=null;this.mapUnique=!1;this.polyhedronStereo=this.bsAromaticRings=null;D(this,arguments)},JS,"SmilesSearch",JU.JmolMolecule);M(c$,function(){this.patternAtoms=Array(16);this.measures=new JU.Lst;this.bsAromatic=new JU.BS;this.bsAromatic5=new JU.BS;this.bsAromatic6=new JU.BS;this.bsFound=new JU.BS;this.bsReturn=new JU.BS});F(c$,function(){P(this,
JS.SmilesSearch,[]);this.top=this;this.v=new JS.VTemp});g(c$,"setTop",function(a){for(;a.top!==a;)a=a.top;this.top=a},"JS.SmilesSearch");c$.addFlags=g(c$,"addFlags",function(a,b){0<=b.indexOf("OPEN")&&(a|=5);0<=b.indexOf("BIO")&&(a|=1048576);0<=b.indexOf("HYDROGEN2")?a|=8192:0<=b.indexOf("HYDROGEN")&&(a|=4096);0<=b.indexOf("FIRSTMATCHONLY")&&(a|=8);0<=b.indexOf("STRICT")&&(a|=256);0<=b.indexOf("PLANAR")&&(a|=1024);if(0<=b.indexOf("NOAROMATIC")||0<=b.indexOf("NONAROMATIC"))a|=16;0<=b.indexOf("AROMATICDOUBLE")&&
(a|=512);0<=b.indexOf("AROMATICDEFINED")&&(a|=128);0<=b.indexOf("MMFF94")&&(a|=768);0<=b.indexOf("TOPOLOGY")&&(a|=16384);0<=b.indexOf("NOATOMCLASS")&&(a|=2048);0<=b.indexOf("NOSTEREO")?a|=32:0<=b.indexOf("INVERTSTEREO")&&(a=0!=(a&64)?a&-65:a|64);0<=b.indexOf("ATOMCOMMENT")&&(a|=131072);0<=b.indexOf("GROUPBYMODEL")&&(a|=67108864);1048576==(a&1048576)&&(0<=b.indexOf("NOCOMMENT")&&(a|=34603008),0<=b.indexOf("UNMATCHED")&&(a|=3145728),0<=b.indexOf("COVALENT")&&(a|=5242880),0<=b.indexOf("HBOND")&&(a|=
9437184));return a},"~N,~S");g(c$,"setFlags",function(a){this.flags=a;this.exitFirstMatch=(new Boolean(this.exitFirstMatch|8==(a&8))).valueOf();this.aromaticOpen=5==(a&5);this.aromaticDouble=512==(a&512);this.aromaticStrict=256==(a&256);this.aromaticPlanar=1024==(a&1024);this.aromaticMMFF94=768==(a&768);this.aromaticDefined=128==(a&128);this.noAromatic=16==(a&16);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)},"~N");g(c$,"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 b=this.patternAtoms[a];this.isTopology&&
b.isDefined()&&(this.isTopology=!1);b.isBioResidue||(this.patternBioSequence=!1);b.isAromatic&&(this.patternAromatic=!0);b.setBondArray();if(!this.isSmarts&&"\x00"==b.bioType&&!b.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 b=this.patternAtoms[a],c=b.bonds,d=b.component,e=b.bondCount;0<=--e;){var f=c[e],h;if(f.isConnection&&f.atom2===b&&(h=f.atom1.component)!=d)for(f=
this.ac;0<=--f;)this.patternAtoms[f].component==d&&(this.patternAtoms[f].component=h)}});g(c$,"setSelected",function(a){null==a&&(a=JU.BS.newN(this.targetAtomCount),a.setBits(0,this.targetAtomCount));this.bsSelected=a},"JU.BS");g(c$,"addAtom",function(){return this.appendAtom(new JS.SmilesAtom)});g(c$,"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(c$,"addNested",
function(a){null==this.htNested&&(this.htNested=new java.util.Hashtable);this.setNested(++this.nNested,a);return this.nNested},"~S");g(c$,"clear",function(){this.bsReturn.clearAll();this.nNested=0;this.nestedBond=this.htNested=null;this.clearBsFound(-1)});g(c$,"clearBsFound",function(a){0>a?null==this.bsCheck&&this.bsFound.clearAll():this.bsFound.clear(a)},"~N");g(c$,"setNested",function(a,b){this.top.htNested.put("_"+a,b)},"~N,~O");g(c$,"getNested",function(a){return this.top.htNested.get("_"+a)},
"~N");g(c$,"getMissingHydrogenCount",function(){for(var a=0,b,c=0;c<this.ac;c++)if(0<=(b=this.patternAtoms[c].explicitHydrogenCount))a+=b;return a});g(c$,"setRingData",function(a,b,c){if(this.isTopology||this.patternBioSequence)this.needAromatic=!1;this.needAromatic&&(this.needRingData=!0);this.needAromatic=(new Boolean(this.needAromatic&(new Boolean(null==a&!this.noAromatic)).valueOf())).valueOf();if(!this.needAromatic&&(this.bsAromatic.clearAll(),null!=a&&this.bsAromatic.or(a),!this.needRingMemberships&&
!this.needRingData))return;this.getRingData(b,this.needRingData,c)},"JU.BS,~A,~B");g(c$,"getRingData",function(a,b,c){var d=this.needAromatic&&(this.aromaticStrict||!this.aromaticOpen&&!this.aromaticPlanar);d&&this.aromaticUnknown&&0<this.targetAtomCount&&this.targetAtoms[this.bsSelected.nextSetBit(0)].modelIsRawPDB()&&(d=!1);var e=this.needAromatic&&this.aromaticOpen&&!this.aromaticStrict,f=this.needAromatic&&!d,h=this.needAromatic&&c&&(d||e),j=this.needAromatic&&!this.aromaticDefined,n=null==a?
new JU.Lst:a[3]=new JU.Lst,g=h?new JU.Lst:null,k=!d?0:this.aromaticMMFF94?2:1;this.needAromatic&&this.aromaticDefined&&(JS.SmilesAromatic.checkAromaticDefined(this.targetAtoms,this.bsSelected,this.bsAromatic),k=0);0>this.ringDataMax&&(this.ringDataMax=8);0<k&&6>this.ringDataMax&&(this.ringDataMax=6);b&&(this.ringCounts=u(this.targetAtomCount,0),this.ringConnections=u(this.targetAtomCount,0),this.ringData=Array(this.ringDataMax+1));this.ringSets=new JU.Lst;if(!(3>this.targetAtomCount)){for(var m="****",
v=this.ringDataMax;m.length<v;)m+=m;for(var r=h&&j?u(this.targetAtomCount,0):null,q=j&&O(this.targetAtoms[0],JS.SmilesAtom),p=3;p<=v&&!(p>this.targetAtomCount);p++){var l="*1"+m.substring(0,p-2)+"*1",l=JS.SmilesParser.newSearch(l,!0,!0),l=this.subsearch(l,2);if(null!=a&&5>=p){for(var s=new JU.Lst,t=l.size();0<=--t;)s.addLast(l.get(t));a[p-3]=s}if(0!=l.size()&&(j&&(4<=p&&7>=p)&&JS.SmilesAromatic.setAromatic(p,this.targetAtoms,this.bsSelected,l,this.bsAromatic,k,e,q,f,this.v,n,g,r,c),b)){this.ringData[p]=
new JU.BS;for(s=l.size();0<=--s;){var y=l.get(s);this.ringData[p].or(y);for(t=y.nextSetBit(0);0<=t;t=y.nextSetBit(t+1))this.ringCounts[t]++}}}if(this.needAromatic){h&&JS.SmilesAromatic.finalizeAromatic(this.targetAtoms,this.bsAromatic,n,g,r,e,d);this.bsAromatic5.clearAll();this.bsAromatic6.clearAll();for(p=n.size();0<=--p;)switch(a=n.get(p),a.and(this.bsAromatic),a.cardinality()){case 5:this.bsAromatic5.or(a);break;case 6:this.bsAromatic6.or(a)}}if(b)for(p=this.bsSelected.nextSetBit(0);0<=p;p=this.bsSelected.nextSetBit(p+
1))if(b=this.targetAtoms[p],n=b.getEdges(),null!=n)for(s=n.length;0<=--s;)0<this.ringCounts[b.getBondedAtomIndex(s)]&&this.ringConnections[p]++}},"~A,~B,~B");g(c$,"subsearch",function(a,b){a.ringSets=this.ringSets;a.mapUnique=this.mapUnique;a.targetAtoms=this.targetAtoms;a.targetAtomCount=this.targetAtomCount;a.bsSelected=this.bsSelected;a.htNested=this.htNested;a.haveTopo=this.haveTopo;a.bsCheck=this.bsCheck;a.isSmarts=!0;a.bsAromatic=this.bsAromatic;a.bsAromatic5=this.bsAromatic5;a.bsAromatic6=
this.bsAromatic6;a.ringData=this.ringData;a.ringCounts=this.ringCounts;a.ringConnections=this.ringConnections;switch(b){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.asVector=this.asVector,a.vReturn=this.vReturn,a.bsReturn=this.bsReturn,a.haveBondStereochemistry=this.haveBondStereochemistry}return a.search2(1==
b)},"JS.SmilesSearch,~N");g(c$,"search",function(){return this.search2(!1)});g(c$,"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;null==this.bsSelected&&(this.bsSelected=JU.BS.newN(this.targetAtomCount),this.bsSelected.setBits(0,this.targetAtomCount));this.selectedAtomCount=this.bsSelected.cardinality();
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&&(null==this.nestedBond?this.clearBsFound(-1):this.bsReturn.clearAll(),this.nextPatternAtom(-1,-1,a,-1));return this.asVector||this.getMaps?this.vReturn:this.bsReturn},"~B");g(c$,"nextPatternAtom",function(a,b,c,d){var e,f;if(++a<this.ac){var h=this.patternAtoms[a],
j=0<=b?h.getBondTo(null):0==a?this.nestedBond:null;if(null==j){b=JU.BSUtil.copy(this.bsFound);var n=JU.BSUtil.copy(this.bsFound);if(0<=h.notBondedIndex)if(e=this.patternAtoms[h.notBondedIndex],j=e.getMatchingAtom(),e.isBioAtom)e=j.getOffsetResidueAtom("\x00",1),0<=e&&b.set(e),e=j.getOffsetResidueAtom("\x00",-1),0<=e&&b.set(e);else{f=j.getEdges();for(e=0;e<f.length;e++)b.set(f[e].getOtherNode(j).getIndex())}f=h.isBioAtomWild;e=this.bsSelected.nextSetBit(0);e=f&&0<=e?this.targetAtoms[e].getOffsetResidueAtom("\x00",
e):e;for(var g,k=(0<a?this.patternAtoms[a-1]:h).component,m=h.component,v=this.haveComponents&&-2147483648!=m,j=e;0<=j;j=this.bsSelected.nextSetBit(j+1)){if(!b.get(j)&&!this.bsFound.get(j)){e=this.targetAtoms[j];if(v&&!this.isRingCheck&&(d=this.groupByModel?e.getModelIndex():e.getMoleculeNumber(!1),g=0<a?this.patternAtoms[a-1].matchingComponent:d,k==m!=(g==d)))continue;if(!this.nextTargetAtom(h,e,a,j,c,d))return!1}f&&(e=this.targetAtoms[j].getOffsetResidueAtom(h.bioAtomName,1),0<=e&&(j=e-1))}this.bsFound=
n;return!0}e=j.atom1.getMatchingAtom();switch(j.order){case 96:j=e.getOffsetResidueAtom(h.bioAtomName,1);if(0<=j){b=JU.BSUtil.copy(this.bsFound);e.getGroupBits(this.bsFound);if(this.doCheckAtom(j)&&!this.nextTargetAtom(h,this.targetAtoms[j],a,j,c,d))return!1;this.bsFound=b}return!0;case 112:f=new JU.Lst;e.getCrossLinkVector(f,!0,!0);b=JU.BSUtil.copy(this.bsFound);e.getGroupBits(this.bsFound);for(j=2;j<f.size();j+=3)if(n=f.get(j).intValue(),this.doCheckAtom(n)&&!this.nextTargetAtom(h,this.targetAtoms[n],
a,n,c,d))return!1;this.bsFound=b;return!0}f=e.getEdges();if(null!=f)for(j=0;j<f.length;j++)if(n=e.getBondedAtomIndex(j),this.doCheckAtom(n)&&!this.nextTargetAtom(h,this.targetAtoms[n],a,n,c,d))return!1;this.clearBsFound(b);return!0}if(!this.ignoreStereochemistry&&!this.isRingCheck&&!this.checkStereochemistry())return!0;b=new JU.BS;for(j=d=0;j<this.ac;j++)if(h=this.patternAtoms[j].getMatchingAtomIndex(),c||!this.top.haveSelected||this.patternAtoms[j].selected){d++;b.set(h);this.patternAtoms[j].isBioAtomWild&&
this.targetAtoms[h].getGroupBits(b);if(c)break;if(!this.isSmarts&&!this.setAtropicity&&0<this.patternAtoms[j].explicitHydrogenCount){h=this.targetAtoms[h];e=0;for(f=h.getEdges().length;e<f;e++)n=h.getBondedAtomIndex(e),1==this.targetAtoms[n].getElementNumber()&&b.set(n)}}if(!this.isSmarts&&b.cardinality()!=this.selectedAtomCount)return!0;if(null!=this.bsCheck)if(c){this.bsCheck.clearAll();for(j=0;j<this.ac;j++)this.bsCheck.set(this.patternAtoms[j].getMatchingAtomIndex());if(this.bsCheck.cardinality()!=
this.ac)return!0}else if(b.cardinality()!=this.ac)return!0;this.bsReturn.or(b);if(this.getMaps){if(this.mapUnique){null==this.uniqueList&&(this.uniqueList=new JU.Lst);for(j=this.uniqueList.size();0<=--j;)if(this.uniqueList.get(j).equals(b))return!0;this.uniqueList.addLast(b)}a=u(d,0);for(b=j=0;j<this.ac;j++)if(c||!this.top.haveSelected||this.patternAtoms[j].selected)a[b++]=this.patternAtoms[j].getMatchingAtomIndex();this.vReturn.addLast(a);return!this.exitFirstMatch}if(this.asVector){c=!0;for(j=this.vReturn.size();0<=
--j&&c;)c=!this.vReturn.get(j).equals(b);if(!c)return!0;this.vReturn.addLast(b)}if(this.isRingCheck){c=new JU.BS;for(e=3*a+2;--e>a;)c.set(this.patternAtoms[(e<=2*a?2*a-e+1:e-1)%a].getMatchingAtomIndex());this.ringSets.addLast(c);return!0}return this.exitFirstMatch?!1:b.cardinality()!=this.selectedAtomCount},"~N,~N,~B,~N");g(c$,"doCheckAtom",function(a){return this.bsSelected.get(a)&&!this.bsFound.get(a)},"~N");g(c$,"nextTargetAtom",function(a,b,c,d,e,f){if(!this.isRingCheck&&!this.isTopology)if(null==
a.subAtoms){if(!this.checkPrimitiveAtom(a,d))return!0}else if(a.isAND)for(var h=0;h<a.nSubAtoms;h++){if(!this.checkPrimitiveAtom(a.subAtoms[h],d))return!0}else{for(h=0;h<a.nSubAtoms;h++)if(!this.nextTargetAtom(a.subAtoms[h],b,c,d,e,f))return!1;return!0}b=b.getEdges();for(h=a.getBondCount();0<=--h;){var j=a.getBond(h);if(j.getAtomIndex2()==a.index){var n=j.atom1,g=n.getMatchingAtomIndex();switch(j.order){case 96:case 112:if(!this.checkMatchBond(a,n,j,d,g,null))return!0;break;default:for(var k=0,m=
null;k<b.length&&(!(m=b[k]).isCovalent()||!(m.getAtomIndex1()==g||m.getAtomIndex2()==g));k++);if(k==b.length||!this.checkMatchBond(a,n,j,d,g,m))return!0}}}a=this.patternAtoms[a.index];a.setMatchingAtom(this.targetAtoms[d],d);a.matchingComponent=f;if(JU.Logger.debuggingHigh&&!this.isRingCheck){for(h=0;h<=c;h++)JU.Logger.debug("pattern atoms "+this.patternAtoms[h]+" "+this.patternAtoms[h].matchingComponent);JU.Logger.debug("--ss--")}this.bsFound.set(d);if(!this.nextPatternAtom(c,d,e,f))return!1;0<=
d&&this.clearBsFound(d);return!0},"JS.SmilesAtom,JU.Node,~N,~N,~B,~N");g(c$,"checkPrimitiveAtom",function(a,b){if(0<a.nSubAtoms){for(var c=0;c<a.nSubAtoms;c++)if(this.checkPrimitiveAtom(a.subAtoms[c],b))return!0;return!1}for(var d=this.targetAtoms[b],c=a.not;;){if(0<a.iNested){c=this.getNested(a.iNested);O(c,JS.SmilesSearch)&&(a.isBioAtom&&(c.nestedBond=a.getBondTo(null)),c=this.subsearch(c,1),null==c&&(c=new JU.BS),a.isBioAtom||this.setNested(a.iNested,c));c=a.not!=c.get(b);break}var e=d.getElementNumber(),
f=a.elementNumber;if(0<=e&&0<=f&&f!=e)break;if(a.isBioResidue){if(null!=a.bioAtomName&&(a.isLeadAtom()?!d.isLeadAtom():!a.bioAtomName.equals(d.getAtomName().toUpperCase())))break;if(null!=a.residueName&&!a.residueName.equals(d.getGroup3(!1).toUpperCase()))break;if(-2147483648!=a.residueNumber&&a.residueNumber!=d.getResno())break;if("\x00"!=a.insCode&&a.insCode!=d.getInsertionCode())break;if(null!=a.residueChar||-2==a.elementNumber){var e=d.getBioSmilesType(),h=a.getBioSmilesType(),j=!0,f=!1;switch(h){case "\x00":case "*":j=
!0;break;case "n":j="r"==e||"c"==e;f=!0;break;case "r":case "c":f=!0;default:j=e==h}if(!j)break;j=d.getGroup1("\x00").toUpperCase();h=null==a.residueChar?"*":a.residueChar.charAt(0);j=h==j.charAt(0);switch(h){case "*":j=!0;break;case "N":j=f?"r"==e||"c"==e:j;break;case "R":j=f?d.isPurine():j;break;case "Y":j=f?d.isPyrimidine():j}if(!j)break}if(a.isBioAtom&&a.notCrossLinked&&d.getCrossLinkVector(null,!0,!0))break}else{if(-2147483648!=a.atomNumber&&a.atomNumber!=d.getAtomNumber())break;if(0<=a.jmolIndex&&
d.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(d.getAtomType()))break;if(-2147483648!=(f=a.getAtomicMass())&&(0<=f&&f!=(e=d.getIsotopeNumber())||0>f&&0!=e&&-f!=e))break;if(!this.noAromatic&&!a.aromaticAmbiguous&&a.isAromatic!=this.bsAromatic.get(b))break;if(-2147483648!=(f=a.getCharge())&&f!=d.getFormalCharge())break;f=a.getCovalentHydrogenCount()+a.explicitHydrogenCount;if(0<=f&&f!=d.getTotalHydrogenCount())break;if(-2147483648!=(f=a.implicitHydrogenCount))if(e=d.getImplicitHydrogenCount(),
-1==f?0==e:f!=e)break;if(0<a.degree&&a.degree!=d.getCovalentBondCount()-d.getImplicitHydrogenCount())break;if(0<a.nonhydrogenDegree&&a.nonhydrogenDegree!=d.getCovalentBondCount()-d.getCovalentHydrogenCount())break;if(this.isSmarts&&0<a.valence&&a.valence!=d.getTotalValence())break;if(0<a.connectivity&&a.connectivity!=d.getCovalentBondCountPlusMissingH())break;if(-2147483648!=a.atomNumber&&a.atomNumber!=d.getAtomNumber())break;if(0<=a.jmolIndex&&d.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&
!a.atomType.equals(d.getAtomType()))break;if((!this.ignoreAtomClass||this.isSmarts)&&!Float.isNaN(a.atomClass)&&a.atomClass!=d.getFloatProperty("property_atomclass"))break;if(null!=this.ringData){if(-1<=a.ringSize)if(0>=a.ringSize){if(0==this.ringCounts[b]!=(0==a.ringSize))break}else{d=this.ringData[500==a.ringSize?5:600==a.ringSize?6:a.ringSize];if(null==d||!d.get(b))break;if(!this.noAromatic)if(500==a.ringSize){if(!this.bsAromatic5.get(b))break}else if(600==a.ringSize&&!this.bsAromatic6.get(b))break}if(-1<=
a.ringMembership&&(-1==a.ringMembership?0==this.ringCounts[b]:this.ringCounts[b]!=a.ringMembership))break;if(0<=a.ringConnectivity&&(f=this.ringConnections[b],-1==a.ringConnectivity&&0==f||-1!=a.ringConnectivity&&f!=a.ringConnectivity))break}}c=!c;break}return c},"JS.SmilesAtom,~N");g(c$,"checkMatchBond",function(a,b,c,d,e,f){if(null!=c.bondsOr){for(var h=0;h<c.nBondsOr;h++)if(this.checkMatchBond(a,b,c.bondsOr[h],d,e,f))return!0;return!1}if(!this.isRingCheck&&!this.isTopology)if(0==c.nPrimitives){if(!this.checkPrimitiveBond(c,
d,e,f))return!1}else for(a=0;a<c.nPrimitives;a++)if(b=c.setPrimitive(a),!this.checkPrimitiveBond(b,d,e,f))return!1;c.matchingBond=f;return!0},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesBond,~N,~N,JU.Edge");g(c$,"checkPrimitiveBond",function(a,b,c,d){var e=!1;switch(a.order){case 96:return a.isNot!=(this.targetAtoms[c].getOffsetResidueAtom("\x00",1)==this.targetAtoms[b].getOffsetResidueAtom("\x00",0));case 112:return a.isNot!=this.targetAtoms[b].isCrossLinked(this.targetAtoms[c])}var f=!this.noAromatic&&
this.bsAromatic.get(b),h=!this.noAromatic&&this.bsAromatic.get(c);d=d.getCovalentOrder();var j=a.order;if(f&&h)switch(j){case 17:case 65:e=JS.SmilesSearch.isRingBond(this.ringSets,null,b,c);break;case 1:e=!this.isSmarts||!JS.SmilesSearch.isRingBond(this.ringSets,this.getBSAromaticRings(),b,c);break;case 2:e=this.isNormalized||this.aromaticDouble&&(2==d||514==d);break;case 65537:case 65538:e=!a.isNot;break;case 81:case -1:e=!0}else switch(j){case 17:if(!this.noAromatic)break;case 81:case -1:e=!0;break;
case 1:case 1025:case 1041:switch(d){case 1:case 1025:case 1041:e=!0}break;case 65537:case 65538:switch(d){case 1:case 65537:case 65538:e=!a.isNot}break;case 2:case 3:case 4:e=d==j;break;case 65:e=JS.SmilesSearch.isRingBond(this.ringSets,null,b,c)}return e!=a.isNot},"JS.SmilesBond,~N,~N,JU.Edge");g(c$,"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 b=this.ringSets.get(a).clone();
b.andNot(this.bsAromatic);b.isEmpty()&&this.bsAromaticRings.set(a)}return this.bsAromaticRings});c$.isRingBond=g(c$,"isRingBond",function(a,b,c,d){if(null!=a)for(var e=a.size();0<=--e;){var f=a.get(e);if(f.get(c)&&f.get(d)&&(null==b||b.get(e)))return!0}return!1},"JU.Lst,JU.BS,~N,~N");g(c$,"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 b=null,a=null,c=0;c<this.ac;c++){for(var d=this.patternAtoms[c],e=null,f=null,h=null,j=0,n=0,g=0,k=d.getBondCount(),m=!1,v=!0,r=0;r<k;r++){var a=d.getBond(r),q=a.atom2===d,v=a.atom1.index<a.atom2.index,p=a.order;switch(p){case 65537:case 65538:if(!v)continue;case 2:if(q)continue;e=a.atom2;g=p;(m=2!=p)&&(j=a.isNot?-1:1);break;case 1025:case 1041:f=q?a.atom1:a.atom2,j=q!=(1025==p)?1:-1}}if(m){if(this.setAtropicity){null==b&&(b=new JU.Lst);b.addLast(a);continue}h=d.getBond(a.atropType[0]);if(null==
h)return!1;f=h.getOtherAtom(d);h=e.getBond(a.atropType[1]);if(null==h)return!1;h=h.getOtherAtom(e);JU.Logger.debugging&&JU.Logger.info("atropisomer check for atoms "+f+d+" "+e+h)}else{if(null==e||0==j)continue;k=d;for(r=0;2==e.getBondCount()&&4==e.getValence();)r++,q=e.getEdges(),q=q[q[0].getOtherNode(e)===k?1:0],k=e,e=q.getOtherNode(e);if(1==r%2)continue;k=e.getBondCount();for(r=0;r<k&&0==n;r++)switch(a=e.getBond(r),p=a.order,p){case 1025:case 1041:h=(q=a.atom2===e)?a.atom1:a.atom2,n=q!=(1025==p)?
1:-1}if(0==n)continue}k=d.getMatchingAtom();r=e.getMatchingAtom();f=f.getMatchingAtom();h=h.getMatchingAtom();if(null==f||null==h)return!1;this.haveTopo&&this.setTopoCoordinates(k,r,f,h,g);f=JS.SmilesMeasure.setTorsionData(f,k,r,h,this.v,m);if(m){if(f*=-1*j*(65537==g?1:-1)*(v?1:-1),JU.Logger.debugging&&JU.Logger.info("atrop dihedral "+f+" "+d+" "+e+" "+a),1>f)return!1}else if(0>this.v.vTemp1.dot(this.v.vTemp2)*j*n)return!1}if(this.setAtropicity){this.atropKeys="";for(a=0;a<b.size();a++)this.atropKeys+=
","+this.getAtropIndex(b.get(a))}return!0});g(c$,"getAtropIndex",function(a){var b=Array(4),c="";b[1]=a.atom1.getMatchingAtom();b[2]=a.atom2.getMatchingAtom();for(var d=a.atom1.bonds,e,f=a.atom1.getBondCount();0<=--f;)if((e=d[f].getOtherNode(a.atom1))!==a.atom2){c+=f+1;b[0]=e.getMatchingAtom();break}d=a.atom2.bonds;for(f=0;f<=a.atom2.getBondCount();f++)if((e=d[f].getOtherNode(a.atom2))!==a.atom1){c+=f+1;b[3]=e.getMatchingAtom();break}c.equals("22")&&(c="");c=(1==JS.SmilesStereo.getAtropicStereoFlag(b)?
"":"^")+c;return(c+"   ").substring(0,3)},"JS.SmilesBond");g(c$,"setTopoCoordinates",function(a,b,c,d,e){a.set(-1,0,0);b.set(1,0,0);if(2!=e)e=a.getBondTo(b),a=a.getBondedAtomIndex(e.atropType[0])==c.index,b=b.getBondedAtomIndex(e.atropType[1])==d.index,b=(65537==e.order?1:-1)*(a==b?1:-1),c.set(-1,1,0),d.set(1,1,-1*(b/2));else{d=c=0;for(var f=a.getEdges(),h=f.length;0<=--h;)if(e=f[h],2!=e.order){var j=e.getOtherNode(a);j.set(-1,0==c++?-1:1,0);j=e.getAtomIndex2()==a.getIndex()?c:-c;switch(e.order){case 1025:d=
j;break;case 1041:d=-j}}var n=0;c=0;a=Array(2);f=b.getEdges();for(h=f.length;0<=--h;)if(e=f[h],2!=e.order)switch(j=e.getOtherNode(b),a[c]=j,j.set(1,0==c++?1:-1,0),j=e.getAtomIndex2()==b.getIndex()?c:-c,e.order){case 1025:n=j;break;case 1041:n=-j}0<d*n==(Math.abs(d)%2==Math.abs(n)%2)&&(b=a[0].y,a[0].y=a[1].y,a[1].y=b)}},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,~N");g(c$,"createTopoMap",function(a){var b=null==a,c=this.getMissingHydrogenCount(),c=this.ac+c,d=Array(c);this.targetAtoms=
d;for(var e=0,f=0;e<this.ac;e++,f++){var h=this.patternAtoms[e],j=h.explicitHydrogenCount;0>j&&(j=0);var n=d[f]=(new JS.SmilesAtom).setTopoAtom(h.component,f,h.symbol,h.getCharge(),e);n.implicitHydrogenCount=j;if(!b){n.mapIndex=e;n.stereo=h.stereo;n.setAtomicMass(h.getAtomicMass());n.bioAtomName=h.bioAtomName;n.residueName=h.residueName;n.residueChar=h.residueChar;n.residueNumber=h.residueNumber;n.atomNumber=h.residueNumber;n.insCode=h.insCode;n.atomClass=h.atomClass;n.explicitHydrogenCount=0;n.isBioAtom=
h.isBioAtom;n.bioType=h.bioType;n.$isLeadAtom=h.$isLeadAtom;!b&&h.isAromatic&&a.set(f);h.setMatchingAtom(null,f);h=Array(h.getBondCount()+j);for(n.setBonds(h);0<=--j;){h=d[++f]=(new JS.SmilesAtom).setTopoAtom(n.component,f,"H",0,-1);h.mapIndex=-e-1;h.setBonds(Array(1));var g=new JS.SmilesBond(n,h,1,!1);JU.Logger.debugging&&JU.Logger.info(""+g)}}}if(!b){for(e=0;e<this.ac;e++){h=this.patternAtoms[e];j=h.getMatchingAtomIndex();a=d[j];j=h.getBondCount();for(b=0;b<j;b++)if(f=h.getBond(b),f.atom1===h){g=
1;switch(f.order){case 1:case 2:case 3:case 4:case 1025:case 1041:case 65537:case 65538:case 112:case 96:g=f.order;break;case 17:g=514}n=d[f.atom2.getMatchingAtomIndex()];g=new JS.SmilesBond(a,n,g,!1);g.isConnection=f.isConnection;g.atropType=f.atropType;g.isNot=f.isNot;n.bondCount--;JU.Logger.debugging&&JU.Logger.info(""+g)}else n=d[f.atom1.getMatchingAtomIndex()],g=n.getBondTo(a),a.addBond(g)}for(e=0;e<c;e++)if(g=d[e],h=g.bonds,!(2>h.length||h[0].isFromPreviousTo(g)))for(j=h.length;1<=--j;)if(h[j].isFromPreviousTo(g)){g=
h[j];h[j]=h[0];h[0]=g;break}if(!this.ignoreStereochemistry)for(e=this.ac;0<=--e;)h=this.patternAtoms[e],null!=h.stereo&&h.stereo.fixStereo(h)}},"JU.BS");c$.normalizeAromaticity=g(c$,"normalizeAromaticity",function(a,b,c){var d=new JS.SmilesSearch;d.setFlags(c);d.targetAtoms=a;d.targetAtomCount=a.length;d.bsSelected=JU.BSUtil.newBitSet2(0,a.length);c=JU.AU.createArrayOfArrayList(4);d.setRingData(null,c,!0);b.or(d.bsAromatic);if(!b.isEmpty()){b=c[3];for(d=b.size();0<=--d;){c=b.get(d);for(var e=c.nextSetBit(0);0<=
e;e=c.nextSetBit(e+1)){var f=a[e];!f.isAromatic&&!(-2==f.elementNumber||0==f.elementNumber)&&f.setSymbol(f.symbol.toLowerCase())}}}},"~A,JU.BS,~N");g(c$,"getSelections",function(){var a=this.top.htNested;if(!(null==a||0==this.targetAtoms.length))for(var b=new java.util.Hashtable,c,a=a.entrySet().iterator();a.hasNext()&&((c=a.next())||1);){var d=c.getValue().toString();if(d.startsWith("select")){var e=b.containsKey(d)?b.get(d):this.targetAtoms[0].findAtomsLike(d.substring(6));null==e&&(e=new JU.BS);
b.put(d,e);c.setValue(e)}}});g(c$,"findImplicitHydrogen",function(a){for(var b=a.getEdges().length;0<=--b;){var c=a.getBondedAtomIndex(b);if(1==this.targetAtoms[c].getElementNumber()&&!this.bsFound.get(c))return this.targetAtoms[c]}return null},"JU.Node");g(c$,"toString",function(){var a=(new JU.SB).append(this.pattern);a.append("\nmolecular formula: "+this.getMolecularFormula(!0,null,!1));return a.toString()});L(c$,"SUBMODE_NESTED",1,"SUBMODE_RINGCHECK",2,"SUBMODE_OR",3,"ATROPIC_SWITCH",1)});z("JS");
C(["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(){c$=E(function(){this.atoms=null;this.ac=0;this.bsAromatic=this.bsSelected=null;this.explicitH=this.flags=0;this.vTemp=this.ringSets=null;this.nPairsMax=this.nPairs=0;this.bsToDo=this.bsBondsDn=this.bsBondsUp=null;this.bsIgnoreH=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.is2D=!1;this.ptSp2Atom0=this.ptAtom=0;this.atemp=null;this.chainCheck=0;D(this,arguments)},JS,"SmilesGenerator");M(c$,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});g(c$,"getSmiles",function(a,b,c,d,e,f){var h=d.nextSetBit(0);if(0>h)return"";this.sm=a;this.flags=f;this.atoms=b;this.ac=c;d=JU.BSUtil.copy(d);this.bsSelected=JU.BS.copy(d);this.flags=f=JS.SmilesSearch.addFlags(f,null==e?"":e.toUpperCase());if(1048576==(f&1048576))return this.getBioSmiles(d,e,f);this.openSMILES=5==(f&5);this.addAtomComment=
131072==(f&131072);this.aromaticDouble=512==(f&512);this.explicitH=8192==(f&8192)?8192:4096==(f&4096)?4096:0;if(8192==this.explicitH){a=new JU.BS;for(c=d.nextSetBit(0);0<=c;c=d.nextSetBit(c+1))if(e=b[c],3==e.getCovalentHydrogenCount()&&4==e.getCovalentBondCount()){var j=!0;a.clearAll();for(var n=e.getBondCount();0<=--n;){var g=e.getBondedAtomIndex(n);if(1==b[g].getElementNumber())if(j=1==b[g].getElementNumber())a.set(g);else break;j&&(this.bsIgnoreH.set(c),d.andNot(a))}}}this.topologyOnly=16384==
(f&16384);this.getAromatic=16!=(f&16);this.noStereo=32==(f&32);this.isPolyhedral=65536==(f&65536);this.is2D=134217728==(f&134217728);return this.getSmilesComponent(b[h],d,!0,!1,!1)},"JS.SmilesMatcher,~A,~N,JU.BS,~S,~N");g(c$,"getBioSmiles",function(a,b,c){this.addAtomComment=131072==(c&131072);var d=3145728==(c&3145728),e=34603008==(c&34603008),f=5242880==(c&5242880);c=9437184==(c&9437184);var h=f||c,j=new JU.SB;null!=b&&!this.noBioComment&&j.append("//* Jmol bioSMILES ").append(b.$replace("*","_")).append(" *//");
b=this.noBioComment?"":"\n";var n=new JU.BS,g=null,k="",m,v=new JU.Lst;try{for(var r=0,q=a.nextSetBit(0);0<=q;q=a.nextSetBit(q+1)){var p=this.atoms[q],l=p.getGroup1("?"),s=p.getBioStructureTypeName(),t=l===l.toLowerCase();if(null!=b)if(0<j.length()&&j.append(b),b=null,r=0,0<s.length)0!=p.getChainID()&&!e&&(m="//* chain "+p.getChainIDStr()+" "+s+" "+p.getResno()+" *// ",r=m.length,j.append(m)),r++,j.append("~").appendC(s.toLowerCase().charAt(0)).append("~");else{m=this.getSmilesComponent(p,a,!1,!0,
!0);if(m.equals(g)){b="";continue}var g=m,y=p.getGroup3(!0),x;e?x="/"+m+"/":(null!=y&&(m="//* "+y+" *//"+m),x=m+"//");if(0<=k.indexOf(x)){b="";continue}k+=x;j.append(m);b=e?".":".\n";continue}75<=r&&!e&&(j.append("\n  "),r=2);this.addAtomComment&&j.append("\n//* ["+p.getGroup3(!1)+"#"+p.getResno()+"] *//\t");t?this.addBracketedBioName(j,p,0<s.length?".0":null,!1):j.append(l);r++;if(h){p.getCrossLinkVector(v,f,c);for(var w=0;w<v.size();w+=3)j.append(":"),m=this.getRingCache(v.get(w).intValue(),v.get(w+
1).intValue(),this.htRingsSequence),j.append(m),r+=1+m.length;v.clear()}p.getGroupBits(n);a.andNot(n);var A=p.getOffsetResidueAtom("\x00",1);if(0>A||!a.get(A)){e||j.append(" //* ").appendI(p.getResno()).append(" *//");if(0>A&&0>(A=a.nextSetBit(q+1)))break;0<r&&(b=e?".":".\n")}q=A-1}}catch(u){if(I(u,Exception))throw new JS.InvalidSmilesException("//* error: "+u.getMessage()+" *//");throw u;}if(!d&&!this.htRingsSequence.isEmpty())throw this.dumpRingKeys(j,this.htRingsSequence),new JS.InvalidSmilesException("//* ?ring error? *//");
m=j.toString();m.endsWith(".\n")?m=m.substring(0,m.length-2):e&&m.endsWith(".")&&(m=m.substring(0,m.length-1));return m},"JU.BS,~S,~N");g(c$,"addBracketedBioName",function(a,b,c,d){a.append("[");if(null!=c){var e=b.getChainIDStr();a.append(b.getGroup3(!1));c.equals(".0")||a.append(c).append("#").appendI(b.getElementNumber());d&&(a.append("//* ").appendI(b.getResno()),0<e.length&&a.append(":").append(e),a.append(" *//"))}else a.append(JU.Elements.elementNameFromNumber(b.getElementNumber()));a.append("]")},
"JU.SB,JU.Node,~S,~B");g(c$,"getSmilesComponent",function(a,b,c,d,e){0==this.explicitH&&(1==a.getAtomicAndIsotopeNumber()&&0<a.getEdges().length)&&(a=this.atoms[a.getBondedAtomIndex(0)]);this.bsSelected=JU.JmolMolecule.getBranchBitSet(this.atoms,a.getIndex(),JU.BSUtil.copy(b),null,-1,!0,c);b.andNot(this.bsSelected);this.iHypervalent=-1;for(b=this.bsSelected.nextSetBit(0);0<=b&&0>this.iHypervalent;b=this.bsSelected.nextSetBit(b+1))if(4<this.atoms[b].getCovalentBondCount()||this.isPolyhedral)this.iHypervalent=
b;this.bsIncludingH=JU.BSUtil.copy(this.bsSelected);if(0==this.explicitH)for(b=this.bsSelected.nextSetBit(0);0<=b;b=this.bsSelected.nextSetBit(b+1))c=this.atoms[b],1==c.getAtomicAndIsotopeNumber()&&(0<c.getBondCount()&&c.getBondedAtomIndex(0)!=this.iHypervalent)&&this.bsSelected.clear(b);this.bsAromatic=new JU.BS;!this.topologyOnly&&2<this.bsSelected.cardinality()&&(this.generateRingData(),this.setBondDirections());this.bsToDo=JU.BSUtil.copy(this.bsSelected);c=new JU.SB;for(b=this.bsToDo.nextSetBit(0);0<=
b;b=this.bsToDo.nextSetBit(b+1))if(4<this.atoms[b].getCovalentBondCount()||this.isPolyhedral)null==a&&c.append("."),this.getSmilesAt(c,this.atoms[b],d,!1,e),a=null;if(null!=a)for(;null!=(a=this.getSmilesAt(c,a,d,!0,e)););for(;0<this.bsToDo.cardinality()||!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)];c.append(".");for(this.prevAtom=this.prevSp2Atoms=
this.alleneStereo=null;null!=(a=this.getSmilesAt(c,a,d,!0,e)););}if(!this.htRings.isEmpty())throw this.dumpRingKeys(c,this.htRings),new JS.InvalidSmilesException("//* ?ring error? *//\n"+c);d=c.toString();if(0<=d.indexOf("^-")){e=d;try{var f=this.sm.getAtropisomerKeys(d,this.atoms,this.ac,this.bsSelected,this.bsAromatic,this.flags);for(b=1;b<f.length;){var h=d.indexOf("^-");if(0>h)break;d=d.substring(0,h+1)+f.substring(b,b+3).trim()+d.substring(h+1);b+=3}}catch(j){if(I(j,Exception))j.printStackTrace(),
d=e;else throw j;}}return d},"JU.Node,JU.BS,~B,~B,~B");g(c$,"generateRingData",function(){var a=JS.SmilesParser.newSearch("[r500]",!0,!0);a.targetAtoms=this.atoms;a.setSelected(this.bsSelected);a.setFlags(this.flags);a.targetAtomCount=this.ac;a.ringDataMax=7;a.flags=this.flags;var b=JU.AU.createArrayOfArrayList(4);a.setRingData(null,b,!0);this.bsAromatic=a.bsAromatic;this.ringSets=a.ringSets;this.aromaticRings=b[3]});g(c$,"getBondStereochemistry",function(a,b){if(null==a)return"\x00";var c=a.index,
d=null==b||a.getAtomIndex1()==b.getIndex();return this.bsBondsUp.get(c)?d?"/":"\\":this.bsBondsDn.get(c)?d?"\\":"/":"\x00"},"JU.Edge,JU.SimpleNode");g(c$,"setBondDirections",function(){for(var a=new JU.BS,b=N(2,3,null),c=this.bsSelected.nextSetBit(0);0<=c;c=this.bsSelected.nextSetBit(c+1))for(var d=this.atoms[c],e=d.getEdges(),f=0;f<e.length;f++){var h=e[f],j=h.index,n;if(!a.get(j)&&!(2!=h.getCovalentOrder()||JS.SmilesSearch.isRingBond(this.ringSets,null,c,(n=h.getOtherNode(d)).getIndex()))){a.set(j);
h=0;for(j=d;2==n.getCovalentBondCount()&&4==n.getValence();){var g=n.getEdges(),g=g[g[0].getOtherNode(n)===j?1:0];a.set(g.index);j=n;n=g.getOtherNode(n);h++}if(1!=h%2){for(var k=h=null,j=0,g=N(-1,[d,n]),k=1,m=0;2>m&&0<k&&3>k;m++)for(var k=0,l=g[m],r=l.getEdges(),q=0;q<r.length;q++){var p;if(!(1!=r[q].getCovalentOrder()||0==this.explicitH&&1==(p=r[q].getOtherNode(l)).getElementNumber()&&0==p.getIsotopeNumber()))b[m][k++]=r[q],"\x00"!=this.getBondStereochemistry(r[q],l)&&(h=r[q],j=m)}if(!(3==k||0==
k))if(null==h&&(j=0,h=b[j][0],this.bsBondsUp.set(h.index)),l=this.getBondStereochemistry(h,g[j]),k=h.getOtherNode(g[j]),null!=k)for(m=0;2>m;m++)for(r=0;2>r;r++)if(q=b[m][r],!(null==q||q===h)){var K=q.index,s=q.getOtherNode(g[m]);if(null!=s){var t=this.getBondStereochemistry(q,g[m]),y=JS.SmilesStereo.isDiaxial(g[j],g[m],k,s,this.vTemp,0);"\x00"==t||t!=l==y?("\\"==l&&y||"/"==l&&!y)==(q.getAtomIndex1()!=s.getIndex())?this.bsBondsUp.set(K):this.bsBondsDn.set(K):JU.Logger.error("BOND STEREOCHEMISTRY ERROR");
JU.Logger.debugging&&JU.Logger.debug(this.getBondStereochemistry(h,g[0])+" "+k.getIndex()+" "+s.getIndex()+" "+this.getBondStereochemistry(q,g[m]))}}}}}});g(c$,"getSmilesAt",function(a,b,c,d,e){var f=b.getIndex();if(!this.bsToDo.get(f))return null;this.ptAtom++;this.bsToDo.clear(f);var h=f==this.iHypervalent||0!=this.explicitH&&!this.bsIgnoreH.get(f),j=!this.bsSelected.get(f),n=null==this.prevAtom?-1:this.prevAtom.getIndex(),g=this.bsAromatic.get(f),k=this.prevSp2Atoms,m=null!=k,l=b.getElementNumber(),
r=0,q=this.alleneStereo;this.alleneStereo=null;var p=new JU.Lst,K=null,s=null,t=b.getEdges();null!=this.polySmilesCenter&&(d=!1,this.sortBonds(b,this.prevAtom,this.polySmilesCenter));var y=null,x=g?10:0;JU.Logger.debugging&&JU.Logger.debug(a.toString());if(null!=t)for(var w=t.length;0<=--w;){var A=t[w];if(A.isCovalent()){var u=t[w].getOtherNode(b),B=u.getIndex();if(B==n)s=t[w];else{var z=!h&&1==u.getElementNumber()&&0==u.getIsotopeNumber();if(!this.bsIncludingH.get(B))if(!z&&c&&this.bsSelected.get(f))this.bsToDo.set(B);
else continue;z?(y=u,r++,1<r&&(x=10)):p.addLast(t[w])}}}1<r&&(k=null);t=null!=k?2:0;null==k&&(!g&&1>=r)&&(k=Array(5));var C=null;null!=s&&(C=this.getBondOrder(s,f,n,g),null!=k&&!m&&(k[t++]=this.prevAtom));null!=k&&!m&&(this.ptSp2Atom0=this.ptAtom);null!=k&&1==r&&(k[t++]=y);u=0;z=new JU.BS;B=p.size();if(d)for(w=0;w<B;w++){var A=p.get(w),H=A.getOtherNode(b),D=H.getCovalentBondCount()-(h?0:H.getCovalentHydrogenCount()),E=A.getCovalentOrder();if(1==D&&(null!=K||w<B-1))z.set(A.index);else if((1<E||D>u)&&
!this.htRings.containsKey(JS.SmilesGenerator.getRingKey(H.getIndex(),f)))u=1<E?1E3+E:D,K=A}h=null==K?null:K.getOtherNode(b);u=null==K?0:K.getCovalentOrder();B=Array(7);7>x&&null!=s&&(m&&2==s.getCovalentOrder()&&2==u&&null!=k[1]?(B[x++]=k[0],B[x++]=k[1]):B[x++]=this.prevAtom);7>x&&1==r&&(B[x++]=y);D=1==u&&null==k;A=this.getBondStereochemistry(s,this.prevAtom);if(null!=C||"\x00"!=A)"\x00"!=A&&(C=""+A),a.append(C);for(var E=x,I=t,s=new JU.SB,y=new JU.Lst,w=0;w<p.size();w++)if(A=p.get(w),z.get(A.index)){H=
A.getOtherNode(b);A=new JU.SB;this.prevAtom=b;this.prevSp2Atoms=this.alleneStereo=null;var C=this.ptSp2Atom0,F=this.ptAtom;this.getSmilesAt(A,H,c,d,e);this.ptAtom=F;this.ptSp2Atom0=C;A=A.toString();p.removeItemAt(w--);null==K?y.addLast(A):s.append("(").append(A).append(")");7>x&&(B[x++]=H);null!=k&&5>t&&(k[t++]=H)}c=new JU.SB;var F=x,L=t,z=null;if(!d&&!this.noStereo&&null==this.polySmilesCenter&&(5==p.size()||6==p.size()))z=this.sortInorganic(b,p,this.vTemp);for(w=0;w<p.size();w++)A=p.get(w),A!==
K&&(H=A.getOtherNode(b),C=this.getBondOrder(A,f,H.getIndex(),g),D||(A=this.getBondStereochemistry(A,b),"\x00"!=A&&(C=""+A)),c.append(C),c.append(this.getRingCache(f,H.getIndex(),this.htRings)),7>x&&(B[x++]=H),null!=k&&5>t&&(k[t++]=H));E!=F&&F!=x&&this.swapArray(B,E,F,x);I!=L&&L!=t&&this.swapArray(k,I,L,t);if(m&&2==x&&2==u){t=this.ptAtom-this.ptSp2Atom0;d=h.getCovalentBondCount();m=7==h.getElementNumber();if(0==t%2)x=8;else if(3==d||2==d&&m){t=h.getEdges();for(m=0;m<t.length;m++)p=h.getBondedAtomIndex(m),
t[m].isCovalent()&&p!=f&&(B[x++]=this.atoms[p]);2==d&&(B[x++]=h);4==x&&(this.alleneStereo=B,1==B[3].getAtomicAndIsotopeNumber()&&(D=B[3],B[3]=B[2],B[2]=D))}t=0}else null!=h&&7>x&&(B[x++]=h);null!=q&&q[3]!==B[2]&&(q=a.lastIndexOf("@]="),0<q&&(d=a.substring(q),a.setLength("@"==a.charAt(q-1)?q-1:q+1),a.append(d)));q=b.getFormalCharge();d=b.getIsotopeNumber();m=b.getValence();p=this.openSMILES?b.getFloatProperty("property_atomclass"):NaN;w=b.getAtomName();H=b.getBioStructureTypeName();this.addAtomComment&&
a.append("\n//* "+b.toString()+" *//\t");this.topologyOnly?a.append("*"):j&&0!=H.length&&0!=w.length?this.addBracketedBioName(a,b,"."+w,!1):a.append(JS.SmilesAtom.getAtomLabel(l,d,e?-1:m,q,p,r,g,null!=z?z:this.noStereo?null:this.checkStereoPairs(b,null==this.alleneStereo?f:-1,B,x,-1==n),this.is2D));a.appendSB(c);if(null!=K)a.appendSB(s);else{D=y.size()-1;if(0<=D){for(w=0;w<D;w++)a.append("(").append(y.get(w)).append(")");a.append(y.get(D))}return null}null!=k&&2==u&&(1==t||2==t)?(null==k[0]&&(k[0]=
b),null==k[1]&&(k[1]=b)):k=null;this.prevSp2Atoms=k;this.prevAtom=b;return h},"JU.SB,JU.SimpleNode,~B,~B,~B");g(c$,"swapArray",function(a,b,c,d){b=c-b;if(null==this.atemp||this.atemp.length<b)this.atemp=Array(b);for(var e=b,f=c;0<e;)this.atemp[--e]=a[--f];for(f=c;f<d;f++)a[f-b]=a[f];e=b;for(f=d;0<e;)a[--f]=this.atemp[--e]},"~A,~N,~N,~N");g(c$,"getBondOrder",function(a,b,c,d){if(this.topologyOnly)return"";if(65537==(a.order&65537))return"^-";a=a.getCovalentOrder();return!d||!this.bsAromatic.get(c)?
JS.SmilesBond.getBondOrderString(a):1==a&&!this.isSameAromaticRing(b,c)?"-":this.aromaticDouble&&(2==a||514==a)?"=":""},"JU.Edge,~N,~N,~B");g(c$,"isSameAromaticRing",function(a,b){for(var c,d=this.aromaticRings.size();0<=--d;)if((c=this.aromaticRings.get(d)).get(a)&&c.get(b))return!0;return!1},"~N,~N");g(c$,"sortBonds",function(a,b,c){if(null==this.smilesStereo)try{this.smilesStereo=JS.SmilesStereo.newStereo(null)}catch(d){if(!I(d,JS.InvalidSmilesException))throw d;}this.smilesStereo.sortBondsByStereo(a,
b,c,a.getEdges(),this.vTemp.vA)},"JU.SimpleNode,JU.SimpleNode,JU.P3");g(c$,"sortInorganic",function(a,b,c){for(var d=a.getIndex(),e=b.size(),f=new JU.Lst,h=new JU.Lst,j,n,g=null,k=null,m,l,r=new JU.BS,q=null,p=Array(6),q=!0,u="",s=0,t=0;t<e;t++)if(m=b.get(t),p[0]=j=m.getOtherNode(a),0==t?u=this.addStereoCheck(0,d,j,"",null):q&&null!=this.addStereoCheck(0,d,j,u,null)&&(q=!1),!r.get(t)){r.set(t);for(var y=!1,x=t+1;x<e;x++)if(!r.get(x)&&(l=b.get(x),n=l.getOtherNode(a),JS.SmilesStereo.isDiaxial(a,a,j,
n,c,-0.95))){switch(++s){case 1:g=j;break;case 2:k=j;break;case 3:2==JS.SmilesStereo.getHandedness(k,g,j,a,c)&&(j=m,m=l,l=j)}f.addLast(N(-1,[m,l]));y=!0;r.set(x);break}y||h.addLast(m)}d=f.size();if(q||6==e&&3!=d||5==e&&0==d)return"";q=f.get(0);m=q[0];p[0]=m.getOtherNode(a);b.clear();b.addLast(m);1<d&&h.addLast(f.get(1)[0]);3==d&&h.addLast(f.get(2)[0]);1<d&&h.addLast(f.get(1)[1]);3==d&&h.addLast(f.get(2)[1]);for(t=0;t<h.size();t++)m=h.get(t),b.addLast(m),p[t+1]=m.getOtherNode(a);b.addLast(q[1]);p[e-
1]=q[1].getOtherNode(a);return JS.SmilesStereo.getStereoFlag(a,p,e,c,this.is2D)},"JU.SimpleNode,JU.Lst,JS.VTemp");g(c$,"checkStereoPairs",function(a,b,c,d,e){if(10==d||d<(this.is2D?3:4))return"";if(0==this.explicitH&&0<=b&&4==d&&6==a.getElementNumber())for(var f="",h=0;4>h;h++)if(null==(f=this.addStereoCheck(0,b,c[h],f,JU.BSUtil.newAndSetBit(b))))return"";if(this.is2D){b=4==d||!e?1:-1;e=a.getEdges();f=null;for(h=a.getBondCount();0<=--h;){var j=e[h];if(a===j.getAtom(0))switch(j.getBondType()){case 1025:this.setStereoTemp(c,
f=j.getAtom(1),b);break;case 1041:this.setStereoTemp(c,f=j.getAtom(1),-b)}}if(null==f)return"";3==d&&(c[d++]=f)}return JS.SmilesStereo.getStereoFlag(a,c,d,this.vTemp,this.is2D)},"JU.SimpleNode,~N,~A,~N,~B");g(c$,"setStereoTemp",function(a,b,c){for(var d=0;4>d;d++)if(a[d]===b){var e=new JS.SmilesAtom;b=b.getXYZ();e.set(b.x,b.y,c);a[d]=e;break}},"~A,JU.SimpleNode,~N");g(c$,"addStereoCheck",function(a,b,c,d,e){null!=e&&e.set(b);var f=c.getAtomicAndIsotopeNumber(),h=c.getCovalentBondCount(),j=6==f&&0!=
this.explicitH?c.getCovalentHydrogenCount():0;if(6==f?4!=h:1==f||1<h)return d+ ++this.chainCheck;var n=";"+a+"/"+f+"/"+j+"/"+h+(0==a?",":"_");if(6==f)switch(j){case 1:return d+n+ ++this.chainCheck;case 0:case 2:if(null==e)return d;for(var g=c.getEdges(),k="",m="",l=2==j?0:3,f=c.getBondCount();0<=--f;){var m=g[f].getOtherNode(c),r=m.getIndex();!e.get(r)&&(g[f].isCovalent()&&1!=m.getElementNumber())&&(e.set(r),m=this.addStereoCheck(a+1,c.getIndex(),m,"",e.clone()),0<=k.indexOf(m)&&l--,k+=m)}if(3==l)return d+
n+ ++this.chainCheck;n=(n+k).$replace(",","_");if(0<a)return d+n}if(0<=d.indexOf(n)){if(3==j){for(f=a=0;f<h&&3>a;f++)e=c.getBondedAtomIndex(f),e!=b&&(a+=this.atoms[e].getAtomicAndIsotopeNumber());if(3<a)return d}return null}return d+n},"~N,~N,JU.SimpleNode,~S,JU.BS");g(c$,"getRingCache",function(a,b,c){var d=JS.SmilesGenerator.getRingKey(a,b),e=c.get(d),f=null==e?null:e[0];if(null==f)this.bsRingKeys.set(++this.nPairs),this.nPairsMax=Math.max(this.nPairs,this.nPairsMax),c.put(d,N(-1,[f=this.getRingPointer(this.nPairs),
Integer.$valueOf(b),Integer.$valueOf(this.nPairs)])),JU.Logger.debugging&&JU.Logger.debug("adding for "+a+" ring key "+this.nPairs+": "+d);else{c.remove(d);a=e[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 "+d)}return f},"~N,~N,java.util.Map");g(c$,"getRingPointer",function(a){return 10>a?""+a:100>a?"%"+a:"%("+a+")"},"~N");g(c$,
"dumpRingKeys",function(a,b){JU.Logger.info(a.toString()+"\n\n");for(var c,d=b.keySet().iterator();d.hasNext()&&((c=d.next())||1);)JU.Logger.info("unmatched connection: "+c)},"JU.SB,java.util.Map");c$.getRingKey=g(c$,"getRingKey",function(a,b){return Math.min(a,b)+"_"+Math.max(a,b)},"~N,~N")});z("JS");C(null,"JS.SmilesAromatic","java.util.Hashtable JU.BS $.Lst $.Measure $.V3 JS.SmilesRing $.SmilesRingSet JU.BSUtil $.Logger".split(" "),function(){c$=R(JS,"SmilesAromatic");c$.setAromatic=g(c$,"setAromatic",
function(a,b,c,d,e,f,h,j,n,g,k,m,l,r){h=h||0<f;if(r)for(x=d.size();0<=--x;){if(w=d.get(x),r=JS.SmilesAromatic.isSp2Ring(a,b,c,w,j?3.4028235E38:0<f?0.1:0.01,n,0==f)){e.or(w);if(h){g=new JU.Lst;for(var q=w.nextSetBit(0);0<=q;q=w.nextSetBit(q+1))for(var p=b[q],u=p.getEdges(),s=p.getIndex(),t=u.length;0<=--t;){var y=u[t].getOtherNode(p).getIndex();y>s&&w.get(y)&&g.addLast(u[t])}switch(JS.SmilesAromatic.checkHueckelAromatic(a,b,e,w,f,l)){case -1:continue;case 0:r=!1;case 1:if(null!=m&&m.addLast(new JS.SmilesRing(a,
w,g,r)),!r)continue}}k.addLast(w)}}else for(var x=d.size();0<=--x;){var w=JU.BSUtil.copy(d.get(x));w.and(e);w.cardinality()==a&&k.addLast(w)}},"~N,~A,JU.BS,JU.Lst,JU.BS,~N,~B,~B,~B,JS.VTemp,JU.Lst,JU.Lst,~A,~B");c$.checkAromaticDefined=g(c$,"checkAromaticDefined",function(a,b,c){for(var d=b.nextSetBit(0);0<=d;d=b.nextSetBit(d+1))for(var e=a[d].getEdges(),f=0;f<e.length;f++)switch(e[f].order){case 515:case 514:case 513:c.set(e[f].getAtomIndex1()),c.set(e[f].getAtomIndex2())}},"~A,JU.BS,JU.BS");c$.isSp2Ring=
g(c$,"isSp2Ring",function(a,b,c,d,e,f,h){if(f)for(var j=d.nextSetBit(0);0<=j;j=d.nextSetBit(j+1)){if(3<b[j].getCovalentBondCount())return!1}else for(j=d.nextSetBit(0);0<=j;j=d.nextSetBit(j+1))if(3<b[j].getCovalentBondCountPlusMissingH())return!1;if(3.4028235E38==e)return!0;0>=e&&(e=0.01);for(var n=f=a=null,j=d.cardinality(),g=Array(2*j),k=0,m=1-5*e,j=d.nextSetBit(0);0<=j;j=d.nextSetBit(j+1)){for(var l=b[j],r=-1,q=-1,p=-1,u=l.getEdges().length;0<=--u;){var s=l.getBondedAtomIndex(u);if(c.get(s))if(d.get(s))0>
q?q=s:p=s;else{if(16==l.getElementNumber()){if(!h)return!1;s=-1}r=s}}null==n&&(n=new JU.V3,a=new JU.V3,f=new JU.V3);u=0;for(l=j;2>u;u++){JU.Measure.getNormalThroughPoints(b[q],b[l],b[p],a,f);if(!JS.SmilesAromatic.addNormal(a,n,m))return!1;g[k++]=JU.V3.newV(a);if(0>(l=r))break}}return JS.SmilesAromatic.checkStandardDeviation(g,n,k,e)},"~N,~A,JU.BS,JU.BS,~N,~B,~B");c$.addNormal=g(c$,"addNormal",function(a,b,c){var d=b.dot(a);if(0!=d&&Math.abs(d)<c)return!1;0>d&&a.scale(-1);b.add(a);b.normalize();return!0},
"JU.V3,JU.V3,~N");c$.checkStandardDeviation=g(c$,"checkStandardDeviation",function(a,b,c,d){for(var e=0,f=0,h=0;h<c;h++)var j=a[h].dot(b),e=e+j,f=f+j*j;e=Math.sqrt((f-e*e/c)/(c-1));return e<d},"~A,JU.V3,~N,~N");c$.checkHueckelAromatic=g(c$,"checkHueckelAromatic",function(a,b,c,d,e,f){for(var h=0,j=0,n=d.nextSetBit(0);0<=n&&0<=h;n=d.nextSetBit(n+1)){var g=b[n],k=g.getElementNumber(),m=g.getCovalentBondCountPlusMissingH(),m=m+g.getValence(),m=m-4;if(6==k){var l=g.getFormalCharge();-2147483648!=l&&(m+=
l)}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=g.getEdges();m=0;for(l=k.length;0<=--l;){var r=k[l];if(2==r.getCovalentOrder()){m=r.getOtherNode(g);m=6==m.getElementNumber()||c.get(m.getIndex())?1:0<e?-100:0;break}}default:if(0>m)return-1;null!=f&&(f[n]=m);h+=m;1==m&&j++;JU.Logger.debuggingHigh&&JU.Logger.info("atom "+g+" pi="+m+" npi="+h)}}}return 0==(h-2)%4&&(2>e||5==a||6==
j)?1:0},"~N,~A,JU.BS,JU.BS,~N,~A");c$.finalizeAromatic=g(c$,"finalizeAromatic",function(a,b,c,d,e,f,h){h&&JS.SmilesAromatic.removeBridgingRings(c,d);JS.SmilesAromatic.checkFusedRings(d,e,c);b.clearAll();for(e=c.size();0<=--e;)b.or(c.get(e));if(h||f)for(e=b.nextSetBit(0);0<=e;e=b.nextSetBit(e+1)){c=a[e].getEdges();f=0;for(var j=c.length;0<=--j;){var g=c[j].getOtherNode(a[e]),l=c[j].getCovalentOrder(),k=g.getIndex();if(b.get(k)){if(2==l){g=!1;for(l=d.size();0<=--l;){var m=d.get(l);if(m.get(e)&&m.get(k)){g=
!0;break}}if(!g){f=-1;break}}f++}else if(h&&6==g.getElementNumber()&&2==l){f=-1;break}}2>f&&(b.clear(e),e=-1)}},"~A,JU.BS,JU.Lst,JU.Lst,~A,~B,~B");c$.removeBridgingRings=g(c$,"removeBridgingRings",function(a,b){var c=new JU.BS,d=new JU.BS,e=new JU.BS;JS.SmilesAromatic.checkBridges(a,d,a,d,c);JS.SmilesAromatic.checkBridges(b,e,b,e,c);JS.SmilesAromatic.checkBridges(a,d,b,e,c);for(c=a.size();0<=--c;)d.get(c)&&a.removeItemAt(c);for(c=b.size();0<=--c;)e.get(c)&&b.removeItemAt(c)},"JU.Lst,JU.Lst");c$.checkBridges=
g(c$,"checkBridges",function(a,b,c,d,e){for(var f=a===c,h=a.size();0<=--h;)for(var j=a.get(h),g=f?h+1:0,l=c.size();--l>=g;){var k=c.get(l);k.equals(j)||(e.clearAll(),e.or(j),e.and(k),2<e.cardinality()&&(b.set(h),d.set(l)))}},"JU.Lst,JU.BS,JU.Lst,JU.BS,JU.BS");c$.checkFusedRings=g(c$,"checkFusedRings",function(a,b,c){for(var d=new java.util.Hashtable,e=a.size();0<=--e;){for(var f=a.get(e),h=f.edges,j=h.size();0<=--j;){var g=JS.SmilesRing.getSetByEdge(h.get(j),d);null==g||g===f.$set||(null!=f.$set?
g.addSet(f.$set,d):g.addRing(f))}(null==f.$set?f.$set=new JS.SmilesRingSet:f.$set).addRing(f);f.addEdges(d)}for(e=a.size();0<=--e;)if(!(f=a.get(e)).isOK&&!(null==(g=f.$set)||g.isEmpty())){if(2==g.getElectronCount(b)%4)for(j=g.size();0<=--j;)(f=g.get(j)).isOK||c.addLast(f);g.clear()}},"JU.Lst,~A,JU.Lst");L(c$,"OS_PI_COUNTS",N(-1,[u(-1,[-2,1,0]),u(-1,[1,2,1,-1]),u(-1,[2,1,2,1,1]),u(-1,[2,1]),u(-1,[-2,1,2,1,-2]),u(-1,[2,1,2,2])]))});z("JS");C(["JU.BS"],"JS.SmilesRing",null,function(){c$=E(function(){this.bsEdgesToCheck=
this.edges=this.$set=null;this.isOK=!1;this.n=0;D(this,arguments)},JS,"SmilesRing",JU.BS);F(c$,function(a,b,c,d){P(this,JS.SmilesRing,[]);this.or(b);this.edges=c;this.isOK=d;this.n=a},"~N,JU.BS,JU.Lst,~B");g(c$,"addEdges",function(a){for(var b=this.edges.size();0<=--b;)a.put(JS.SmilesRing.getKey(this.edges.get(b)),this.$set)},"java.util.Hashtable");c$.getSetByEdge=g(c$,"getSetByEdge",function(a,b){return b.get(JS.SmilesRing.getKey(a))},"JU.Edge,java.util.Hashtable");c$.getKey=g(c$,"getKey",function(a){var b=
a.getAtomIndex1();a=a.getAtomIndex2();return b<a?b+"_"+a:a+"_"+b},"JU.Edge")});z("JS");C(["JU.Lst","$.BS"],"JS.SmilesRingSet",null,function(){c$=E(function(){this.bs=null;D(this,arguments)},JS,"SmilesRingSet",JU.Lst);M(c$,function(){this.bs=new JU.BS});F(c$,function(){P(this,JS.SmilesRingSet,[])});g(c$,"addSet",function(a,b){for(var c=a.size();0<=--c;){var d=a.get(c);this.addRing(d);d.addEdges(b)}},"JS.SmilesRingSet,java.util.Hashtable");g(c$,"addRing",function(a){this.addLast(a);a.$set=this;this.bs.or(a)},
"JS.SmilesRing");g(c$,"getElectronCount",function(a){for(var b=0,c=this.bs.nextSetBit(0);0<=c;c=this.bs.nextSetBit(c+1))b+=a[c];return b},"~A")});z("JS");C(["JU.P3","JU.Node"],"JS.SmilesAtom",["java.lang.Float","JU.AU","JU.Elements","$.Logger","JV.JC"],function(){c$=E(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;D(this,arguments)},JS,"SmilesAtom",JU.P3,JU.Node);M(c$,function(){this.bonds=
Array(4)});c$.allowSmilesUnbracketed=g(c$,"allowSmilesUnbracketed",function(a){return 0<="B, C, N, O, P, S, F, Cl, Br, I, *,".indexOf(a+",")},"~S");F(c$,function(){P(this,JS.SmilesAtom,[])});l(c$,"getAtomType",function(){return null==this.atomType?this.bioAtomName:this.atomType});g(c$,"getChiralClass",function(){return null==this.stereo?-2147483648:this.stereo.getChiralClass(this)});g(c$,"isDefined",function(){return this.hasSubpattern||0!=this.iNested||this.isBioAtom||-2147483648!=this.component||
-2!=this.elementNumber||0<this.nSubAtoms});g(c$,"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(c$,"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(c$,"setBonds",function(a){this.bonds=a},"~A");g(c$,"addSubAtom",function(a,b){this.isAND=
b;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(c$,"setIndex",function(a){this.index=a;return this},"~N");g(c$,"setTopoAtom",function(a,b,c,d,e){this.component=a;this.index=b;this.patternIndex=e;this.setSymbol(c);this.charge=d;this.isTopoAtom=!0;return this},"~N,~N,~S,~N,~N");
g(c$,"setHydrogenCount",function(){this.missingHydrogenCount=this.explicitHydrogenCount;if(-2147483648!=this.explicitHydrogenCount)return!0;var a=JS.SmilesAtom.getDefaultCount(this.elementNumber,this.isAromatic);if(0>a)return this.missingHydrogenCount=0,-1==a;7==this.elementNumber&&this.isAromatic&&2==this.bondCount&&1==this.bonds[0].order&&1==this.bonds[1].order&&a++;for(var b=0;b<this.bondCount;b++){var c=this.bonds[b];switch(c.order){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-=c.order}}0<=a&&(this.missingHydrogenCount=this.explicitHydrogenCount=a);return!0});c$.getDefaultCount=g(c$,"getDefaultCount",function(a,b){switch(a){case 0:case -1:case -2:return-1;case 6:return b?3:4;case 8:case 16:return 2;case 7:return b?2:3;case 5:case 15:return 3;case 9:case 17:case 35:case 53:return 1}return-2},"~N,~B");l(c$,"getIndex",function(){return this.index});
g(c$,"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");l(c$,"getElementNumber",function(){return this.elementNumber});g(c$,"getAtomicMass",function(){return this.atomicMass});l(c$,"getAtomNumber",function(){return this.atomNumber});g(c$,"setAtomicMass",function(a){this.atomicMass=a},"~N");g(c$,"getCharge",function(){return this.charge});g(c$,"setCharge",function(a){this.charge=a},"~N");g(c$,"getMatchingAtomIndex",function(){return this.matchingIndex});g(c$,"getMatchingAtom",function(){return null==this.matchingNode?this:this.matchingNode});
g(c$,"setMatchingAtom",function(a,b){this.matchingNode=a;this.matchingIndex=b},"JU.Node,~N");g(c$,"setExplicitHydrogenCount",function(a){this.explicitHydrogenCount=a},"~N");g(c$,"setImplicitHydrogenCount",function(a){this.implicitHydrogenCount=a},"~N");g(c$,"setDegree",function(a){this.degree=a},"~N");g(c$,"setNonhydrogenDegree",function(a){this.nonhydrogenDegree=a},"~N");g(c$,"setValence",function(a){this.valence=a},"~N");g(c$,"setConnectivity",function(a){this.connectivity=a},"~N");g(c$,"setRingMembership",
function(a){this.ringMembership=a},"~N");g(c$,"setRingSize",function(a){this.ringSize=a;if(500==this.ringSize||600==this.ringSize)this.isAromatic=!0},"~N");g(c$,"setRingConnectivity",function(a){this.ringConnectivity=a},"~N");l(c$,"getModelIndex",function(){return this.component});l(c$,"getMoleculeNumber",function(){return this.component},"~B");l(c$,"getAtomSite",function(){return this.atomSite});l(c$,"getFormalCharge",function(){return this.charge});l(c$,"getIsotopeNumber",function(){return this.atomicMass});
l(c$,"getAtomicAndIsotopeNumber",function(){return JU.Elements.getAtomicAndIsotopeNumber(this.elementNumber,this.atomicMass)});l(c$,"getAtomName",function(){return null==this.bioAtomName?"":this.bioAtomName});l(c$,"getGroup3",function(){return null==this.residueName?"":this.residueName},"~B");l(c$,"getGroup1",function(){return null==this.residueChar?"":this.residueChar},"~S");g(c$,"addBond",function(a){this.bondCount>=this.bonds.length&&(this.bonds=JU.AU.doubleLength(this.bonds));this.bonds[this.bondCount]=
a;this.bondCount++},"JS.SmilesBond");g(c$,"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 b=this.bonds[a];this.isBioAtom&&17==b.order&&(b.order=112);b.atom1.index>b.atom2.index&&b.switchAtoms()}});l(c$,"getEdges",function(){return null!=this.parent?this.parent.getEdges():
this.bonds});g(c$,"getBond",function(a){return null!=this.parent?this.parent.getBond(a):0<=a&&a<this.bondCount?this.bonds[a]:null},"~N");l(c$,"getCovalentBondCount",function(){return this.getBondCount()});l(c$,"getBondCount",function(){return null!=this.parent?this.parent.getBondCount():this.bondCount});l(c$,"getCovalentBondCountPlusMissingH",function(){return this.getBondCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});l(c$,"getTotalHydrogenCount",function(){return this.getCovalentHydrogenCount()+
(this.isTopoAtom?0:this.missingHydrogenCount)});l(c$,"getImplicitHydrogenCount",function(){return this.implicitHydrogenCount});g(c$,"getExplicitHydrogenCount",function(){return this.explicitHydrogenCount});g(c$,"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");l(c$,"getBondedAtomIndex",function(a){return null!=this.parent?this.parent.getBondedAtomIndex(a):
this.bonds[a].getOtherAtom(this).index},"~N");l(c$,"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});l(c$,"getValence",function(){if(null!=this.parent)return this.parent.getValence();
var a=this.valence;if(0>=a&&null!=this.bonds)for(var b=this.bonds.length;0<=--b;)a+=this.bonds[b].getValence();return this.valence=a});l(c$,"getTotalValence",function(){return this.getValence()+(this.isTopoAtom?0:this.missingHydrogenCount)});g(c$,"getBondTo",function(a){if(null!=this.parent)return this.parent.getBondTo(a);for(var b,c=0;c<this.bonds.length;c++)if(null!=(b=this.bonds[c]))if(null==a?b.atom2===this:b.getOtherAtom(this)===a)return b;return null},"JS.SmilesAtom");g(c$,"getBondNotTo",function(a,
b){for(var c,d=0;d<this.bonds.length;d++)if(null!=(c=this.bonds[d])){var e=c.getOtherAtom(this);if(a!==e&&(b||1!=e.elementNumber))return c}return null},"JS.SmilesAtom,~B");l(c$,"isLeadAtom",function(){return this.$isLeadAtom});l(c$,"getOffsetResidueAtom",function(a,b){if(this.isBioAtom){if(0==b)return this.index;for(var c=0;c<this.bonds.length;c++)if(this.bonds[c].getAtomIndex1()==this.index&&96==this.bonds[c].order)return this.bonds[c].getOtherAtom(this).index}return-1},"~S,~N");l(c$,"getGroupBits",
function(a){a.set(this.index)},"JU.BS");l(c$,"isCrossLinked",function(a){return this.getBondTo(a).isHydrogen()},"JU.Node");l(c$,"getCrossLinkVector",function(a){for(var b=!1,c=0;c<this.bonds.length;c++)if(112==this.bonds[c].order){if(null==a)return!0;a.addLast(Integer.$valueOf(this.index));a.addLast(Integer.$valueOf(this.bonds[c].getOtherAtom(this).index));a.addLast(Integer.$valueOf(this.bonds[c].getOtherAtom(this).index));b=!0}return b},"JU.Lst,~B,~B");l(c$,"getBioStructureTypeName",function(){return null});
l(c$,"getInsertionCode",function(){return this.insCode});l(c$,"getResno",function(){return this.residueNumber});l(c$,"getChainID",function(){return 0});l(c$,"getChainIDStr",function(){return""});c$.getAtomLabel=g(c$,"getAtomLabel",function(a,b,c,d,e,f,h,j,g){var l=JU.Elements.elementSymbolFromNumber(a);h&&(l=l.toLowerCase(),6!=a&&(c=2147483647));h=2147483647!=c&&0==b&&0==d&&Float.isNaN(e)&&(null==j||0==j.length);var k=JS.SmilesAtom.getDefaultCount(a,!1);if(g&&0==f){if(h&&6==a)return l;f=k-c}return h&&
k==c?l:"["+(0>=b?"":""+b)+l+(null==j?"":j)+(1<f?"H"+f:1==f?"H":"")+(0>d&&-2147483648!=d?""+d:0<d?"+"+d:"")+(Float.isNaN(e)?"":":"+T(e))+"]"},"~N,~N,~N,~N,~N,~N,~B,~S,~B");l(c$,"getBioSmilesType",function(){return this.bioType});g(c$,"isNucleic",function(){return"n"==this.bioType||"r"==this.bioType||"d"==this.bioType});l(c$,"isPurine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="AG".indexOf(this.residueChar)});l(c$,"isPyrimidine",function(){return null!=this.residueChar&&this.isNucleic()&&
0<="CTUI".indexOf(this.residueChar)});l(c$,"isDeleted",function(){return!1});l(c$,"findAtomsLike",function(){return null},"~S");l(c$,"toString",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());for(var b="",c=0;c<this.bondCount;c++)b+=this.bonds[c].getOtherAtom(this).index+", ";return"["+a+"."+this.index+(0<=this.matchingIndex?"("+this.matchingNode+")":"")+"]"+b+"("+this.x+","+this.y+","+this.z+")"});l(c$,"getFloatProperty",function(a){return"property_atomclass"===a?this.atomClass:NaN},"~S");l(c$,"getMass",function(){return this.atomicMass});l(c$,"getCIPChirality",function(){return JV.JC.getCIPChiralityName(this.cipChirality&-225)},"~B");l(c$,"setCIPChirality",
function(a){this.cipChirality=a},"~N");l(c$,"getCIPChiralityCode",function(){return this.cipChirality});l(c$,"getXYZ",function(){return this});g(c$,"getStereo",function(){return this.stereo});g(c$,"getPatternIndex",function(){return this.patternIndex});l(c$,"modelIsRawPDB",function(){return!1});L(c$,"UNBRACKETED_SET","B, C, N, O, P, S, F, Cl, Br, I, *,")});z("JS");C(["JU.Edge"],"JS.SmilesBond",["JS.InvalidSmilesException"],function(){c$=E(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;D(this,arguments)},JS,"SmilesBond",JU.Edge);c$.getBondOrderString=g(c$,"getBondOrderString",function(a){switch(a){case 2:return"=";case 3:return"#";case 4:return"$";default:return""}},"~N");c$.getBondTypeFromCode=g(c$,"getBondTypeFromCode",function(a){switch(a){case ".":return 0;case "-":return 1;case "=":return 2;case "#":return 3;case "$":return 4;case ":":return 17;
case "/":return 1025;case "\\":return 1041;case "^":return 65537;case "`":return 65538;case "@":return 65;case "~":return 81;case "+":return 96}return-1},"~S");g(c$,"getAtom1",function(){return this.atom1});g(c$,"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(c$,"setAtropType",function(a){this.atropType=u(-1,[S(a/10)-1,a%10-1])},"~N");g(c$,
"setPrimitive",function(a){a=this.primitives[a];this.order=a.order;this.isNot=a.isNot;this.atropType=a.atropType;return a},"~N");g(c$,"addBondOr",function(){null==this.bondsOr&&(this.bondsOr=Array(2));if(this.nBondsOr>=this.bondsOr.length){var a=Array(2*this.bondsOr.length);Zystem.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(c$,"addPrimitive",function(){null==this.primitives&&(this.primitives=
Array(2));if(this.nPrimitives>=this.primitives.length){var a=Array(2*this.primitives.length);Zystem.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});l(c$,"toString",function(){return this.atom1+" -"+(this.isNot?"!":"")+this.order+"- "+this.atom2});F(c$,function(a,b,c,d){P(this,JS.SmilesBond,[]);this.set2(c,d);this.set2a(a,b)},"JS.SmilesAtom,JS.SmilesAtom,~N,~B");g(c$,"set2",
function(a,b){this.order=a;this.isNot=b},"~N,~B");g(c$,"set2a",function(a,b){null!=a&&(this.atom1=a,a.addBond(this));null!=b&&(this.atom2=b,b.isBioAtomWild&&this.atom1.isBioAtomWild&&(this.order=96),b.isFirst=!1,b.addBond(this))},"JS.SmilesAtom,JS.SmilesAtom");g(c$,"setAtom2",function(a){this.atom2=a;null!=this.atom2&&(a.addBond(this),this.isConnection=!0)},"JS.SmilesAtom,JS.SmilesSearch");g(c$,"isFromPreviousTo",function(a){return!this.isConnection&&this.atom2===a},"JS.SmilesAtom");c$.isBondType=
g(c$,"isBondType",function(a,b,c){if(">"==a)return 1;if(0>"-=#$:/\\.~^`+!,&;@".indexOf(a))return 0;if(!b&&0>"-=#$:/\\.~^`".indexOf(a))throw new JS.InvalidSmilesException("SMARTS bond type "+a+" not allowed in SMILES");switch(a){case "~":return c?0:1;case "^":case "`":return-1;default:return 1}},"~S,~B,~B");g(c$,"getValence",function(){return this.order&7});g(c$,"getOtherAtom",function(a){return this.atom1===a?this.atom2:this.atom1},"JS.SmilesAtom");l(c$,"getAtomIndex1",function(){return this.atom1.index});
l(c$,"getAtomIndex2",function(){return this.atom2.index});l(c$,"getCovalentOrder",function(){return this.order});l(c$,"getOtherNode",function(a){return a===this.atom1?this.atom2:a===this.atom2||null==a?this.atom1:null},"JU.SimpleNode");l(c$,"isCovalent",function(){return 112!=this.order});l(c$,"isHydrogen",function(){return 112==this.order});g(c$,"switchAtoms",function(){var a=this.atom1;this.atom1=this.atom2;this.atom2=a;switch(this.order){case 65537:this.order=65538;break;case 65538:this.order=
65537;break;case 1025:this.order=1041;break;case 1041:this.order=1025}});g(c$,"getRealCovalentOrder",function(){switch(this.order){case 65537:case 65538:case 1025:case 1041:return 1}return this.order});g(c$,"getMatchingBond",function(){return null==this.matchingBond?this:this.matchingBond});l(c$,"getAtom",function(a){return 1==a?this.atom2:this.atom1},"~N");L(c$,"TYPE_UNKNOWN",-1,"TYPE_NONE",0,"TYPE_AROMATIC",17,"TYPE_RING",65,"TYPE_ANY",81,"TYPE_BIO_SEQUENCE",96,"TYPE_BIO_CROSSLINK",112,"ALL_BONDS",
"-=#$:/\\.~^`+!,&;@","SMILES_BONDS","-=#$:/\\.~^`")});z("JS");C(null,"JS.SmilesMeasure",["JU.PT"],function(){c$=E(function(){this.search=null;this.index=this.type=this.nPoints=0;this.isNot=!1;this.points=this.minmax=this.indices=null;D(this,arguments)},JS,"SmilesMeasure");M(c$,function(){this.indices=u(4,0);this.points=Array(4)});F(c$,function(a,b,c,d,e){this.search=a;this.type=Math.min(4,Math.max(c,2));this.index=b;this.isNot=d;this.minmax=e;for(a=e.length-2;0<=a;a-=2)e[a]>e[a+1]&&(b=e[a+1],e[a+
1]=e[a],e[a]=b)},"JS.SmilesSearch,~N,~N,~B,~A");g(c$,"addPoint",function(a){if(this.nPoints==this.type)return!1;if(0==this.nPoints)for(var b=1;b<this.type;b++)this.indices[b]=a+b;this.indices[this.nPoints++]=a;return!0},"~N");g(c$,"check",function(){for(var a=0;a<this.type;a++){var b=this.search.patternAtoms[this.indices[a]].getMatchingAtomIndex();this.points[a]=this.search.targetAtoms[b]}b=0;switch(this.type){case 2:b=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]);b=this.search.v.vA.angle(this.search.v.vB)/0.017453292;break;case 4:b=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(b>=this.minmax[a]&&b<=this.minmax[a+1])return!this.isNot;return this.isNot});c$.setTorsionData=g(c$,"setTorsionData",function(a,b,c,d,e,f){e.vTemp1.sub2(a,b);e.vTemp2.sub2(d,c);if(!f)return 0;e.vNorm2.sub2(b,c);e.vNorm2.normalize();
e.vTemp1.cross(e.vTemp1,e.vNorm2);e.vTemp1.normalize();e.vTemp2.cross(e.vTemp2,e.vNorm2);e.vTemp2.normalize();e.vNorm3.cross(e.vTemp1,e.vTemp2);return e.vTemp1.angle(e.vTemp2)/0.017453292*(0>e.vNorm2.dot(e.vNorm3)?1:-1)},"JU.T3,JU.T3,JU.T3,JU.T3,JS.VTemp,~B");l(c$,"toString",function(){for(var a="(."+"__dat".charAt(this.type)+this.index+":"+JU.PT.toJSON(null,this.minmax)+") for",b=0;b<this.type;b++)a+=" "+(b>=this.nPoints?"?":""+this.indices[b]);return a});L(c$,"TYPES","__dat","radiansPerDegree",
0.017453292519943295)});z("JS");C(["java.util.Hashtable"],"JS.SmilesParser","java.lang.Character $.Float JU.Lst $.PT $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesSearch $.SmilesStereo JU.Elements $.Logger".split(" "),function(){c$=E(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;D(this,arguments)},JS,"SmilesParser");M(c$,function(){this.connections=new java.util.Hashtable;this.htMeasures=new java.util.Hashtable});c$.newSearch=g(c$,"newSearch",function(a,b,c){return(new JS.SmilesParser(b,c)).parse(a)},"~S,~B,~B");F(c$,function(a,b){this.isSmarts=a;this.isTarget=b},"~B,~B");g(c$,"parse",function(a){if(null==a)throw new JS.InvalidSmilesException("expression must not be null");var b=new JS.SmilesSearch;0<=a.indexOf("$(select")&&(a=this.parseNested(b,a,"select"));
var c=u(1,0);a=JS.SmilesParser.extractFlags(a,c);this.flags=c[0];b.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(b,a,this.flags);a=JU.PT.split(a,"||");c="";b.subSearches=Array(a.length);for(var d=0;d<a.length;d++){var e="|"+a[d]+"|";0>c.indexOf(e)&&(b.subSearches[d]=this.getSubsearch(b,a[d],this.flags),c+=e)}return b},"~S");g(c$,"parseVariableLength",function(a){for(var b=
new JU.SB,c=a.length-1,d=0,e=!1,f=0;f<c;f++)switch(a.charAt(f)){case "(":d++;break;case ")":d--;break;case "|":0<d&&(e=!0,"|"==a.charAt(f+1)&&(a=a.substring(0,f)+a.substring(f+1),c--))}if(0<=a.indexOf("||")){c=JU.PT.split(a,"||");for(f=0;f<c.length;f++)b.append("||").append(this.parseVariableLength(c[f]))}else{c=-1;d=u(1,0);for(f=null;0<=(c=a.indexOf("[$",c+1));){var h=c,j=-2147483648,g=-2147483648,c=JS.SmilesParser.getDigits(a,c+2,d),j=d[0];-2147483648!=j&&"-"==JS.SmilesParser.getChar(a,c)&&(c=JS.SmilesParser.getDigits(a,
c+1,d),g=d[0]);if("("==JS.SmilesParser.getChar(a,c)&&(f=JS.SmilesParser.getSubPattern(a,h,"["),f.endsWith(")"))){var l=h+f.length+2,k=JS.SmilesParser.getSubPattern(a,c,"("),m=c;JS.SmilesParser.getSubPattern(a,c,"[");c+=1+k.length;if(0<=k.indexOf(":")&&0>k.indexOf("|")){for(var v=0,r=k.length,q=-1,f=0;f<r;f++)switch(k.charAt(f)){case "[":case "(":v++;break;case ")":case "]":v--;break;case ".":0<=q&&0==v&&(r=f);break;case ":":0>q&&0==v&&(q=f)}0<q&&(k=k.substring(0,q)+"("+k.substring(q,r)+")"+k.substring(r))}if(-2147483648==
j){if(f=k.indexOf("|"),0<=f)return this.parseVariableLength(a.substring(0,h)+"[$1"+a.substring(m,m+f+1)+")]"+a.substring(l)+"||"+a.substring(0,h)+"[$1("+a.substring(m+f+2)+a.substring(l))}else{-2147483648==g&&(g=j);0<=k.indexOf("|")&&(k="[$("+k+")]");for(f=j;f<=g;f++){j=new JU.SB;j.append("||").append(a.substring(0,h));for(m=0;m<f;m++)j.append(k);j.append(a.substring(l));b.appendSB(j)}}}}}return e?this.parseVariableLength(b.substring(2)):2>b.length()?a:b.substring(2)},"~S");g(c$,"getSubsearch",function(a,
b,c){this.htMeasures=new java.util.Hashtable;var d=new JS.SmilesSearch;d.setTop(a);d.isSmarts=this.isSmarts;d.pattern=b;d.setFlags(c);0<=b.indexOf("$(")&&(b=this.parseNested(d,b,""));this.parseSmiles(d,b,null,!1);if(0!=this.braceCount)throw new JS.InvalidSmilesException("unmatched '{'");if(!this.connections.isEmpty())throw new JS.InvalidSmilesException("Open connection");d.set();if(this.isSmarts)for(a=d.ac;0<=--a;)this.checkNested(d,d.patternAtoms[a],c);else this.isBioSequence||(d.elementCounts[1]=
d.getMissingHydrogenCount());!this.ignoreStereochemistry&&!this.isTarget&&this.fixChirality(d);return d},"JS.SmilesSearch,~S,~N");g(c$,"checkNested",function(a,b,c){if(0<b.iNested){var d=a.getNested(b.iNested);if(O(d,String)){if(d.startsWith("select"))return;"~"!=d.charAt(0)&&"\x00"!=b.bioType&&(d="~"+b.bioType+"~"+d);d=this.getSubsearch(a,d,c);0<d.ac&&d.patternAtoms[0].selected&&(b.selected=!0);a.setNested(b.iNested,d)}}for(d=0;d<b.nSubAtoms;d++)this.checkNested(a,b.subAtoms[d],c)},"JS.SmilesSearch,JS.SmilesAtom,~N");
g(c$,"fixChirality",function(a){for(var b=a.ac;0<=--b;){var c=a.patternAtoms[b];null!=c.stereo&&c.stereo.fixStereo(c)}},"JS.SmilesSearch");g(c$,"parseSmiles",function(a,b,c,d){var e=u(1,0),f=0,h,j=null,g=!1,l=!1;a:for(;null!=b&&0!=b.length;){var k=0;null==c&&(k=this.checkBioType(b,0),k==b.length&&(b+="*"),this.isBioSequence&&(a.needAromatic=a.top.needAromatic=!1));h=JS.SmilesParser.getChar(b,k);var m=this.checkBrace(a,h,"{");m&&(h=JS.SmilesParser.getChar(b,++k));if("("==h)if(j=JS.SmilesParser.getSubPattern(b,
k,"("),h="."==JS.SmilesParser.getChar(b,k+1),null==c){if(h||!this.isSmarts)throw new JS.InvalidSmilesException("No previous atom for measure");a.haveComponents=!0;do this.componentCount++,this.componentParenCount++,h=JS.SmilesParser.getChar(b=b.substring(1),0);while("("==h);if(!m&&!0==(m=this.checkBrace(a,h,"{")))h=JS.SmilesParser.getChar(b=b.substring(1),0)}else g=l=!1,j.startsWith(".")?(this.parseMeasure(a,j.substring(1),c),g=!0):0==j.length&&this.isBioSequence?c.notCrossLinked=!0:(this.branchLevel++,
this.parseSmiles(a,j,c,!0),l=!0,this.branchLevel--),k=j.length+2,h=JS.SmilesParser.getChar(b,k),"}"==h&&this.checkBrace(a,h,"}")&&k++,h="\x00";if("\x00"!=h){f=k;b:for(;"\x00"!=h;){switch(JS.SmilesBond.isBondType(h,this.isSmarts,this.isBioSequence)){case 0:break b;case -1:if(!((JU.PT.isDigit(JS.SmilesParser.getChar(b,++k))&&0<k++?JU.PT.isDigit(JS.SmilesParser.getChar(b,k++)):1)&&"-"==(h=JS.SmilesParser.getChar(b,k))))throw new JS.InvalidSmilesException("malformed atropisomerism bond ^nn-  or ^^nn-");
continue}h=JS.SmilesParser.getChar(b,++k)}h=JS.SmilesParser.getChar(b,k);if(")"==h){switch(JS.SmilesParser.getChar(b,++k)){case "\x00":case ")":case ".":if(b=b.substring(k),this.componentParenCount--,0<=this.componentParenCount)continue a}throw new JS.InvalidSmilesException("invalid continuation after component grouping (SMARTS).(SMARTS)");}j=this.parseBond(a,null,b.substring(f,k),null,c,!1,d,k-f,e);m&&-1!=j.order&&(h=JS.SmilesParser.getChar(b,k=f));this.checkBrace(a,h,"{")&&(h=JS.SmilesParser.getChar(b,
++k));switch(h){case "~":0==j.order&&(k=this.checkBioType(b,k),k==b.length&&(b+="*"));break;case "(":do this.componentCount++,this.componentParenCount++,h=JS.SmilesParser.getChar(b,++k);while("("==h);break;case "\x00":if(0==j.order)return}m=JU.PT.isDigit(h)||"%"==h;f=!m&&("_"==h||"["==h||"*"==h||JU.PT.isLetter(h));if(m){if(g||l)throw new JS.InvalidSmilesException("connection number must immediately follow its connecting atom");k=JS.SmilesParser.getRingNumber(b,k,h,e);this.parseConnection(a,e[0],c,
j)}else if(f)switch(g=l=!1,h){case "[":case "_":m=JS.SmilesParser.getSubPattern(b,k,h);k+=m.length+("["==h?2:0);this.isBioSequence&&("["==h&&0>m.indexOf(".")&&0>m.indexOf("_"))&&(m+=".0");c=this.parseAtom(a,null,m,c,j,"["==h,!1,d);c.hasSubpattern=!0;-1!=j.order&&0!=j.order&&this.setBondAtom(j,null,c,a);break;default:m=!this.isBioSequence&&JU.PT.isUpperCase(h)?JS.SmilesParser.getChar(b,k+1):"\x00";if("X"!=h||"x"!=m)if(!JU.PT.isLowerCase(m)||0==JU.Elements.elementNumberFromSymbol(b.substring(k,k+2),
!0))m="\x00";"\x00"!=m&&0<="NA CA BA PA SC AC".indexOf(b.substring(k,k+2))&&(m="\x00");h=JU.PT.isUpperCase(h)&&JU.PT.isLowerCase(m)?2:1;c=this.parseAtom(a,null,b.substring(k,k+h),c,j,!1,!1,d);k+=h}else throw new JS.InvalidSmilesException("Unexpected character: "+JS.SmilesParser.getChar(b,k));h=JS.SmilesParser.getChar(b,k);"}"==h&&this.checkBrace(a,h,"}")&&k++}b=b.substring(k);d=!1}},"JS.SmilesSearch,~S,JS.SmilesAtom,~B");g(c$,"parseConnection",function(a,b,c,d){b=Integer.$valueOf(b);var e=this.connections.get(b);
if(null==e)this.connections.put(b,d),a.top.ringCount++;else{this.connections.remove(b);switch(d.order){case -1:d.order=-1!=e.order?e.order:this.isSmarts||c.isAromatic&&e.atom1.isAromatic?81:1;break;case 1025:d.order=1041;break;case 1041:d.order=1025}if(-1!=e.order&&e.order!=d.order||c===e.atom1||null!=e.atom1.getBondTo(c))throw new JS.InvalidSmilesException("Bad connection type or atom");e.set(d);c.bondCount--;e.setAtom2(c,a)}},"JS.SmilesSearch,~N,JS.SmilesAtom,JS.SmilesBond");g(c$,"setBondAtom",
function(a,b,c,d){a.set2a(b,c);null!=d&&(2==a.order&&null!=a.atom1&&null!=a.atom2&&a.atom1.isAromatic&&a.atom2.isAromatic&&0==(this.flags&512))&&d.setFlags(this.flags|=512)},"JS.SmilesBond,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesSearch");c$.getRingNumber=g(c$,"getRingNumber",function(a,b,c,d){switch(c){case "%":if("("==JS.SmilesParser.getChar(a,b+1)){if(a=JS.SmilesParser.getSubPattern(a,b+1,"("),JS.SmilesParser.getDigits(a,0,d),b+=a.length+3,0>d[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,d)),10>d[0])throw new JS.InvalidSmilesException("Two digits must follow the % sign");a=d[0];break;default:a=c.charCodeAt(0)-48,b++}d[0]=a;return b},"~S,~N,~S,~A");g(c$,"checkBioType",function(a,b){if(this.isBioSequence="~"==a.charAt(b)){b++;this.bioType="*";var c=JS.SmilesParser.getChar(a,2);if("~"==c&&("*"==(c=a.charAt(1))||JU.PT.isLowerCase(c)))this.bioType=c,b=3}return b},"~S,~N");g(c$,"parseMeasure",function(a,b,c){for(var d=
b.indexOf(":"),e=0>d?b:b.substring(0,d);0!=d;){var f=e.length;1==f&&(e+="0");var h=this.htMeasures.get(e);if(null==h==0>d||0==f)break;try{if(0<d){var j="__dat".indexOf(e.charAt(0));if(2>j)break;var g=u(1,0);JS.SmilesParser.getDigits(e,1,g);var l=g[0];b=b.substring(d+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 v=JU.PT.split(b,",");if(1==v.length%2||k&&2!=v.length)break;for(var r=Q(v.length,
0),q=v.length;0<=--q&&!Float.isNaN(r[q]=Float.parseFloat(v[q])););if(0<=q)break;h=new JS.SmilesMeasure(a,l,j,k,r);a.measures.addLast(h);0<l?this.htMeasures.put(e,h):0==l&&JU.Logger.debugging&&JU.Logger.debug("measure created: "+h)}else{if(!h.addPoint(c.index))break;h.nPoints==h.type&&(this.htMeasures.remove(e),JU.Logger.debugging&&JU.Logger.debug("measure created: "+h));return}if(!h.addPoint(c.index))break}catch(p){if(I(p,NumberFormatException))break;else throw p;}return}throw new JS.InvalidSmilesException("invalid measure: "+
b);},"JS.SmilesSearch,~S,JS.SmilesAtom");g(c$,"checkBrace",function(a,b,c){switch(b){case "{":if(b!=c)break;this.braceCount++;return a.top.haveSelected=!0;case "}":if(b!=c)break;if(0<this.braceCount)return this.braceCount--,!0;break;default:return!1}throw new JS.InvalidSmilesException("Unmatched '}'");},"JS.SmilesSearch,~S,~S");g(c$,"parseNested",function(a,b,c){var d;for(c="$("+c;0<=(d=b.lastIndexOf(c));){var e=JS.SmilesParser.getSubPattern(b,d+1,"("),f=d+e.length+3,h=b.substring(f);b=b.substring(0,
d);var j="";if(b.endsWith("]"))throw new JS.InvalidSmilesException("$(...) must be enclosed in brackets: "+b+"$("+e+")");if(1<d&&2==c.length&&1<(f=b.length)&&0>",;&![".indexOf(b.substring(f-1)))j="&";1<h.length&&0>",;&!)]".indexOf(h.charAt(0))&&(h="&"+h);b=b+j+"_"+a.top.addNested(e)+"_"+h}return b},"JS.SmilesSearch,~S,~S");g(c$,"parseVariables",function(a){var b=new JU.Lst,c=new JU.Lst,d,e=0,f=-1;for(JU.Logger.debugging&&JU.Logger.info(a);0<=(d=a.indexOf("$",e))&&"("!=JS.SmilesParser.getChar(a,d+
1);){e=JS.SmilesParser.skipTo(a,d,"=");if(e<=d+1||'"'!=JS.SmilesParser.getChar(a,e+1))break;d=a.substring(d,e);if(0<d.lastIndexOf("$")||0<d.indexOf("]"))throw new JS.InvalidSmilesException("Invalid variable name: "+d);f=JS.SmilesParser.getSubPattern(a,e+1,'"');b.addLast("["+d+"]");c.addLast(f);e+=f.length+2;e=JS.SmilesParser.skipTo(a,e,";");f=++e}if(0>f)return a;a=a.substring(f);for(e=b.size();0<=--e;)d=b.get(e),f=c.get(e),f.equals(d)||(a=JU.PT.rep(a,d,f));JU.Logger.debugging&&JU.Logger.info(a);return a},
"~S");g(c$,"parseAtom",function(a,b,c,d,e,f,h,j){if(null==c||0==c.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,c,g,null,d,h,j,null)){var l=u(1,0);this.isBioSequence&&1==c.length&&(c+=".0");var k=c.charAt(0),m=0,v=!1;if(this.isSmarts&&"!"==k){k=JS.SmilesParser.getChar(c,++m);if("\x00"==k)throw new JS.InvalidSmilesException("invalid '!'");g.not=
v=!0}var r=0<=c.indexOf("@PH")?-1:c.indexOf(".");if(0<=r){g.isBioResidue=!0;var q=c.substring(m,r);c=c.substring(r+1).toUpperCase();var p=q.length;if(0<=(r=q.indexOf("^")))r==p-2&&(k=q.charAt(p-1),"*"!=k&&(g.insCode=k)),q=q.substring(0,r);if(0<=(r=q.indexOf("#")))JS.SmilesParser.getDigits(q,r+1,l),g.residueNumber=l[0],q=q.substring(0,r);0==q.length&&(q="*");1<q.length?g.residueName=q.toUpperCase():q.equals("*")||(g.residueChar=q);q=c;if(0<=(r=q.indexOf("#")))JS.SmilesParser.getDigits(q,r+1,l),g.elementNumber=
l[0],q=q.substring(0,r);0==q.length?q="*":q.equals("0")&&(q="\x00");q.equals("*")?g.isBioAtomWild=!0:g.setAtomName(q);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(c,m,l);k=l[0];if(-2147483648==k)throw new JS.InvalidSmilesException("Non numeric atomic mass");"?"==JS.SmilesParser.getChar(c,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){case '"':k=JU.PT.getQuotedStringAt(c,m);m+=k.length+2;g.atomType=k;break;case "_":m=JS.SmilesParser.getDigits(c,m+1,l)+1;if(-2147483648==l[0])throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(m));g.iNested=l[0];if(!f)throw new JS.InvalidSmilesException("nesting must appear in [...]: $("+a.getNested(l[0])+")");if(this.isBioSequence&&m!=c.length)throw new JS.InvalidSmilesException("invalid characters: "+c.substring(m));break;case "=":m=JS.SmilesParser.getDigits(c,
m+1,l);g.jmolIndex=l[0];break;case "#":k="-"==c.charAt(m+1);m=JS.SmilesParser.getDigits(c,m+(k?2:1),l);k?g.atomNumber=l[0]:g.elementNumber=l[0];break;case "-":case "+":m=this.checkCharge(c,m,g);break;case "@":null==a.stereo&&(a.stereo=JS.SmilesStereo.newStereo(a));m=JS.SmilesStereo.checkChirality(a,c,m,a.patternAtoms[g.index]);break;case ":":m=JS.SmilesParser.getDigits(c,++m,l);if(-2147483648==l[0])throw new JS.InvalidSmilesException("Invalid atom class");g.atomClass=l[0];break;default:var q=JS.SmilesParser.getChar(c,
m+1),p=m+(JU.PT.isLowerCase(q)&&(!f||!JU.PT.isDigit(JS.SmilesParser.getChar(c,m+2)))?2:1),z=c.substring(m+1,p),s=Character.toUpperCase(k)+z,t=!0;f&&JU.PT.isLetter(k)&&(!v&&(h?b:g).hasSymbol?t=!1:"H"==k?t=1==c.length||!JU.PT.isDigit(q):JU.PT.isDigit(q)?t=!1:!s.equals("A")&&!s.equals("Xx")&&(t=("h"==k?2==p:!0)&&0<JU.Elements.elementNumberFromSymbol(s,!0),!t&&2==p&&(z="",s=s.substring(0,1),t=0<JU.Elements.elementNumberFromSymbol(s,!0))));if(t){if(!f&&!this.isSmarts&&!this.isBioSequence&&!JS.SmilesAtom.allowSmilesUnbracketed(s)||
!g.setSymbol(s=k+z))throw new JS.InvalidSmilesException("Invalid atom symbol: "+s);h&&(b.hasSymbol=!0);m+=s.length}else switch(m=JS.SmilesParser.getDigits(c,m+1,l),p=l[0],k){default:throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(m));case "D":g.setDegree(-2147483648==p?1:p);break;case "d":g.setNonhydrogenDegree(-2147483648==p?1:p);break;case "H":r=-2147483648==p?1:p;break;case "h":g.setImplicitHydrogenCount(-2147483648==p?-1:p);break;case "R":-2147483648==p&&(p=-1);g.setRingMembership(p);
a.top.needRingData=!0;break;case "r":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 "v":g.setValence(-2147483648==p?1:p);break;case "X":g.setConnectivity(-2147483648==p?1:p);break;case "x":g.setRingConnectivity(-2147483648==p?-1:p),a.top.needRingData=!0}}k=JS.SmilesParser.getChar(c,m);if(v&&"\x00"!=k)throw new JS.InvalidSmilesException("'!' may only involve one primitive.");
}-2147483648==r&&f&&(r=-2147483647);g.setExplicitHydrogenCount(r);a.patternAtoms[g.index].setExplicitHydrogenCount(r)}0<this.braceCount&&(g.selected=!0);null!=b&&b.addSubAtom(g,h);null!=d&&0==e.order&&(g.notBondedIndex=d.index);null!=d&&0!=e.order&&(-1==e.order&&(e.order=this.isBioSequence&&j?112:this.isSmarts||d.isAromatic&&g.isAromatic?81:1),f||this.setBondAtom(e,null,g,a),0==this.branchLevel&&(17==e.order||112==e.order)&&this.branchLevel++);0==this.branchLevel&&(a.lastChainAtom=g);return g},"JS.SmilesSearch,JS.SmilesAtom,~S,JS.SmilesAtom,JS.SmilesBond,~B,~B,~B");
g(c$,"checkCharge",function(a,b,c){var d=a.length,e=a.charAt(b),f=1;++b;if(b<d){var h=a.charAt(b);if(JU.PT.isDigit(h)){if(d=u(1,0),b=JS.SmilesParser.getDigits(a,b,d),f=d[0],-2147483648==f)throw new JS.InvalidSmilesException("Non numeric charge");}else for(;b<d&&a.charAt(b)==e;)b++,f++}c.setCharge("+"==e?f:-f);return b},"~S,~N,JS.SmilesAtom");g(c$,"parseBond",function(a,b,c,d,e,f,h,g,n){var l;if(0<g)switch(l=c.charAt(0)){case ">":if(!c.equals(">>")){g=-1;break}case ".":if(null==d&&null==b)return this.isBioSequence=
"~"==JS.SmilesParser.getChar(c,1),new JS.SmilesBond(null,null,0,!1);g=-1;break;case "+":null!=b&&(g=-1)}else l="\x00";d=null==b?null==d?new JS.SmilesBond(e,null,this.isBioSequence&&null!=e?h?112:96:-1,!1):d:f?b.addPrimitive():b.addBondOr();if(0<g&&!this.checkLogic(a,c,null,d,e,f,!1,n)){if(f="!"==l)if(l=JS.SmilesParser.getChar(c,1),"\x00"==l||"!"==l)throw new JS.InvalidSmilesException("invalid '!'");h=JS.SmilesBond.getBondTypeFromCode(l);65==h&&(a.top.needRingMemberships=!0);if(null==e&&0!=h)throw new JS.InvalidSmilesException("Bond without a previous atom");
switch(h){case 65537:case 65538:(g=c.length)<(f?3:2)||"-"!=c.charAt(g-1)?g=0:g==(f?3:2)?d.setAtropType(22):(JS.SmilesParser.getDigits(c,f?2:1,n),d.setAtropType(n[0]));a.haveBondStereochemistry=!0;break;case 1025:case 1041:this.bondDirectionPaired=!this.bondDirectionPaired;a.haveBondStereochemistry=!0;break;case 2:a.top.nDouble++;case 1:e.isAromatic&&(a.top.needRingData=!0)}d.set2(h,f);this.isBioSequence&&null!=b&&b.set2(h,f)}if(-1==g)throw new JS.InvalidSmilesException("invalid bond:"+l);return d},
"JS.SmilesSearch,JS.SmilesBond,~S,JS.SmilesBond,JS.SmilesAtom,~B,~B,~N,~A");g(c$,"checkLogic",function(a,b,c,d,e,f,g,j){var l=b.lastIndexOf("!");null!=c&&(c.pattern=b);for(;0<l;)0>",;&!(".indexOf(b.charAt(l-1))&&(b=b.substring(0,l)+"&"+b.substring(l)),l=b.lastIndexOf("!",l-1);var l=b.indexOf(","),u=b.length,k="&";a:for(;;){var m=0<l;if(m&&!this.isSmarts||0==l)break;l=b.indexOf(";");if(0<=l){if(!this.isSmarts||0==l)break;m?(k=";",m=!1):b=b.$replace(";","&")}var v=0;if(m)for(b+=",";0<(l=b.indexOf(",",
v))&&l<=u;){v=b.substring(v,l);if(0==v.length)throw new JS.InvalidSmilesException("missing "+(null==d?"atom":"bond")+" token");null==d?this.parseAtom(a,c,v,null,null,!0,!1,g):this.parseBond(a,d,v,null,e,!1,!1,v.length,j);v=l+1}else if(0<=(l=b.indexOf(k))||null!=d&&1<u&&!f){if(0==l||null==d&&!this.isSmarts)break;if(null!=d&&0>l&&1<u){f=new JU.SB;for(m=0;m<u;){var r=b.charAt(m++);f.appendC(r);switch(r){case "!":if(!this.isSmarts)break a;continue;case "^":case "`":for(;"-"!=(r=b.charAt(m++))&&"\x00"!=
r;)f.appendC(r);f.appendC("-")}if(m<u){if(!this.isSmarts)break a;f.append(k)}}b=f.toString();u=b.length}for(b+=k;0<(l=b.indexOf(k,v))&&l<=u;)v=b.substring(v,l),null==d?this.parseAtom(a,c,v,null,null,!0,!0,g):this.parseBond(a,this.isSmarts?d:null,v,this.isSmarts?null:d,e,!0,!1,v.length,j),v=l+1}else return!1;return!0}r=b.charAt(l);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");
c$.getSubPattern=g(c$,"getSubPattern",function(a,b,c){var d,e=1;switch(c){case "[":d="]";break;case '"':case "%":case "/":d=c;break;case "(":d=")";break;default:d=c,e=0}for(var f=a.length,g=1,j=b+1;j<f;j++){var l=a.charAt(j);if(l==d){if(g--,0==g)return a.substring(b+e,j+1-e)}else l==c&&g++}throw new JS.InvalidSmilesException("Unmatched "+c);},"~S,~N,~S");c$.getChar=g(c$,"getChar",function(a,b){return b<a.length?a.charAt(b):"\x00"},"~S,~N");c$.getDigits=g(c$,"getDigits",function(a,b,c){for(var d=b,
e=a.length;d<e&&JU.PT.isDigit(a.charAt(d));)d++;if(d>b)try{return c[0]=Integer.parseInt(a.substring(b,d)),d}catch(f){if(!I(f,NumberFormatException))throw f;}c[0]=-2147483648;return d},"~S,~N,~A");c$.skipTo=g(c$,"skipTo",function(a,b,c){for(var d;(d=JS.SmilesParser.getChar(a,++b))!=c&&"\x00"!=d;);return"\x00"==d?-1:b},"~S,~N,~S");c$.cleanPattern=g(c$,"cleanPattern",function(a){a=JU.PT.replaceAllCharacters(a," \t\n\r","");a=JU.PT.rep(a,"^^","`");for(var b=0,c=0;0<=(b=a.indexOf("//*"))&&(c=a.indexOf("*//"))>=
b;)a=a.substring(0,b)+a.substring(c+3);return a=JU.PT.rep(a,"//","")},"~S");c$.extractFlags=g(c$,"extractFlags",function(a,b){a=JS.SmilesParser.cleanPattern(a);for(var c=0;a.startsWith("/");){var d=JS.SmilesParser.getSubPattern(a,0,"/").toUpperCase();a=a.substring(d.length+2);c=JS.SmilesSearch.addFlags(c,d)}b[0]=c;return a},"~S,~A");c$.getFlags=g(c$,"getFlags",function(a){var b=u(1,0);JS.SmilesParser.extractFlags(a,b);return b[0]},"~S")});z("JS");C(null,"JS.SmilesExt","java.lang.Float JU.AU $.BS $.Lst $.M4 $.Measure $.P3 J.api.Interface JU.Logger".split(" "),
function(){c$=E(function(){this.sm=this.e=null;D(this,arguments)},JS,"SmilesExt");F(c$,function(){});g(c$,"init",function(a){this.e=a;this.sm=this.e.vwr.getSmilesMatcher();return this},"~O");g(c$,"getSmilesCorrelation",function(a,b,c,d,e,f,g,j,l,u,k,m){var v=null==l?0.1:3.4028235E38;try{null==d&&(d=new JU.Lst,e=new JU.Lst);var r=new JU.M4,q=new JU.P3,p=this.e.vwr.ms.at,z=this.e.vwr.ms.ac,s=this.sm.getCorrelationMaps(c,p,z,a,m|8);null==s&&this.e.evalError(this.sm.getLastException(),null);if(0==s.length)return NaN;
var t=s[0];for(a=0;a<t.length;a++)d.addLast(p[t[a]]);s=this.sm.getCorrelationMaps(c,p,z,b,m);null==s&&this.e.evalError(this.sm.getLastException(),null);if(0==s.length)return NaN;JU.Logger.info(s.length+" mappings found");if(k||!j){b=3.4028235E38;c=null;for(a=0;a<s.length;a++){e.clear();for(var y=0;y<s[a].length;y++)e.addLast(p[s[a][y]]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");var x=1==e.size()?0:JU.Measure.getTransformMatrix4(d,e,r,null);JU.Logger.info("getSmilesCorrelation stddev="+
x);if(null!=g&&x<v){for(var w=new JU.BS,y=0;y<s[a].length;y++)w.set(s[a][y]);g.addLast(w)}x<b&&(c=s[a],null!=f&&f.setM4(r),null!=u&&u.setT(q),b=x)}null!=l&&(l[0]=t,l[1]=c);e.clear();for(a=0;a<c.length;a++)e.addLast(p[c[a]]);return b}for(a=0;a<s.length;a++)for(y=0;y<s[a].length;y++)e.addLast(p[s[a][y]])}catch(A){if(I(A,Exception))this.e.evalError(A.getMessage(),null);else throw A;}return 0},"JU.BS,JU.BS,~S,JU.Lst,JU.Lst,JU.M4,JU.Lst,~B,~A,JU.P3,~B,~N");g(c$,"getSmilesMatches",function(a,b,c,d,e,f,
g){if(0==a.length||a.endsWith("///")||a.equals("H")||a.equals("H2")||a.equals("top")||a.equalsIgnoreCase("NOAROMATIC"))try{return this.e.vwr.getSmilesOpt(c,0,0,e|(a.equals("H2")?8192:0)|(a.equals("H")?4096:0)|(a.equals("top")?16384:0)|(a.equalsIgnoreCase("NOAROMATIC")?16:0),a.endsWith("///")?a:null)}catch(j){if(I(j,Exception))this.e.evalError(j.getMessage(),null);else throw j;}var l;if(null==d){d=2==(e&2);try{if(null==b)l=this.e.vwr.getSubstructureSetArray(a,c,e);else{if(a.equals("chirality"))return this.e.vwr.calculateChiralityForSmiles(b);
var z=this.sm.find(a,b,(d?2:1)|(g?8:0));if(!f)return!g?z:0==z.length?u(0,0):z[0];var k=new JU.BS;for(f=0;f<z.length;f++)for(var m=z[f],v=m.length;0<=--v;)0<=m[v]&&k.set(m[v]);if(!d)return u(k.cardinality(),0);var r=u(k.cardinality(),0);f=0;for(var q=k.nextSetBit(0);0<=q;q=k.nextSetBit(q+1))r[f++]=q;return r}}catch(p){if(I(p,Exception))return this.e.evalError(p.getMessage(),null),null;throw p;}}else{l=new JU.Lst;k=this.getSmilesCorrelation(d,c,a,null,null,null,l,!1,null,null,!1,e);if(Float.isNaN(k))return f?
new JU.BS:N(-1,[]);this.e.showString("RMSD "+k+" Angstroms");l=l.toArray(Array(l.size()))}if(f){k=new JU.BS;for(f=0;f<l.length;f++)k.or(l[f]);return k}k=new JU.Lst;for(f=0;f<l.length;f++)k.addLast(l[f]);return k},"~S,~S,JU.BS,JU.BS,~N,~B,~B");g(c$,"getFlexFitList",function(a,b,c,d){var e=JU.AU.newInt2(2);this.getSmilesCorrelation(a,b,c,null,null,null,null,!1,e,null,!1,d?2:1);if(null==e[0])return null;a=this.e.vwr.ms.getDihedralMap(e[0]);b=null==a?null:this.e.vwr.ms.getDihedralMap(e[1]);if(null==b||
b.length!=a.length)return null;e=Q(a.length,3,0);c=this.e.vwr.ms.at;JS.SmilesExt.getTorsions(c,b,e,0);JS.SmilesExt.getTorsions(c,a,e,1);b=Q(6*a.length,0);for(d=c=0;c<a.length;c++){var f=a[c];b[d++]=f[0];b[d++]=f[1];b[d++]=f[2];b[d++]=f[3];b[d++]=e[c][0];b[d++]=e[c][1]}return b},"JU.BS,JU.BS,~S,~B");c$.getTorsions=g(c$,"getTorsions",function(a,b,c,d){for(var e=b.length;0<=--e;){var f=b[e],f=JU.Measure.computeTorsion(a[f[0]],a[f[1]],a[f[2]],a[f[3]],!0);1==d&&(180<f-c[e][0]?f-=360:-180>=f-c[e][0]&&(f+=
360));c[e][d]=f}},"~A,~A,~A,~N")})})(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.defineStatics,Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,Clazz.newByteArray,Clazz.declareInterface,Clazz.p0p,Clazz.pu$h,
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);
