(function(qa,ra,sa,ta,W,ua,X,A,U,Y,Z,$,va,pa,wa,M,O,B,aa,xa,ya,za,Aa,Ba,Ca,Da,Ea,w,Fa,Ga,Ha,Ia,Ja,Ka,La,Ma,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,$a,ab,bb,cb,db,eb,s){X("JS");U(null,"JS.MathExt","java.util.Date $.Hashtable $.Random JU.AU $.BArray $.BS $.CU $.Lst $.M3 $.M4 $.Measure $.OC $.P3 $.P4 $.PT $.Quat $.Rdr $.SB $.V3 J.api.Interface J.atomdata.RadiusData J.bspt.PointIterator J.c.VDW J.i18n.GT JM.BondSet $.Measurement JS.SV $.T JU.BSUtil $.BoxInfo $.Edge $.Escape $.JmolMolecule $.Logger $.Parser $.Point3fi $.SimpleUnitCell JV.FileManager $.JC $.Viewer".split(" "),
function(){var q=Z(function(){this.pm=this.rand=this.e=this.vwr=null;Y(this,arguments)},JS,"MathExt",null);s(q,"init",function(d){this.e=d;this.vwr=this.e.vwr;return this},"~O");s(q,"evaluate",function(d,a,b,c){switch(c){case 134218760:return 1<=b.length&&4==b[0].tok?d.addXStr((1==b.length?(new java.util.Date).toString():this.vwr.apiPlatform.getDateFormat(JS.SV.sValue(b[1])))+"\t"+JS.SV.sValue(b[0]).trim()):d.addXInt(System.currentTimeMillis()-JS.MathExt.t0-(0==b.length?0:b[0].asInt()));case 134218250:return 1==
b.length&&2==b[0].tok?d.addXInt(Math.abs(b[0].intValue)):d.addXFloat(Math.abs(b[0].asFloat()));case 134218241:case 134218245:case 134218244:case 134218246:return 1==b.length&&this.evaluateMath(d,b,c);case 1275069441:case 1275068928:case 1275068929:case 1275068930:case 1275068931:case 1275335685:case 1275334681:return this.evaluateList(d,a.intValue,b);case 268437504:0==b.length&&(d.wasX=!1);case 1275068418:return this.evaluateArray(d,b,1275068418==c&&268442113==a.tok);case 134217766:return this.evaluateMatrix(d,
b);case 134217765:return this.evaluateCallbackParam(d,b);case 134217731:case 134221850:return this.evaluateQuaternion(d,b,c);case 1275068420:return this.evaluateBin(d,b);case 134221829:return this.evaluateCache(d,b);case 1275068934:case 1275068935:return this.evaluateRowCol(d,b,c);case 1765808134:return this.evaluateColor(d,b);case 134221831:return this.evaluateCompare(d,b);case 1228931586:case 134217736:case 1275203608:return this.evaluateConnected(d,b,c,a.intValue);case 1812599299:case 1814695966:return this.evaluateUnitCell(d,
b,268442113==a.tok,268442113==a.tok?a.intValue:a.tok);case 134353926:return this.evaluateContact(d,b);case 134221834:return this.evaluateData(d,b);case 1275069444:case 1275069442:return this.evaluateDotDist(d,b,c,a.intValue);case 1275069443:if(268442113==a.tok)return this.evaluateDotDist(d,b,c,a.intValue);case 134217729:case 1745489939:return this.evaluateMeasure(d,b,a.tok);case 1228935687:case 134223363:return this.evaluateLoad(d,b,1228935687==c);case 1275068427:return this.evaluateFind(d,b);case 1275068433:return this.evaluateInChI(d,
b);case 1287653388:case 1825200146:return this.evaluateFormat(d,a.intValue,b,1825200146==c);case 134320141:return this.evaluateUserFunction(d,a.value,b,a.intValue,268442113==a.tok);case 1275068437:c=1275068725;case 1275068446:case 1275068725:case 1275082241:case 1275072526:return this.evaluateGetProperty(d,b,c,268442113==a.tok);case 136314895:return this.evaluateHelix(d,b);case 134219777:case 134217750:case 134217763:return this.evaluatePlane(d,b,c,268442113==a.tok);case 134218759:case 134238732:case 134222850:case 134222350:return this.evaluateScript(d,
b,c);case 1275069446:case 1275069447:case 1275068932:return this.evaluateString(d,a.intValue,b);case 134217751:return this.evaluatePoint(d,b);case 1275068447:return this.evaluatePointGroup(d,b,268442113==a.tok);case 134256129:return this.evaluatePrompt(d,b);case 134219266:return this.evaluateRandom(d,b);case 1275068432:return this.evaluateIn(d,b);case 1275072532:return this.evaluateModulation(d,b);case 1275068443:return this.evaluateReplace(d,b);case 134218753:case 134218756:case 134218757:case 1237320707:return this.evaluateSubstructure(d,
b,c,268442113==a.tok);case 1275068444:case 1275068425:return this.evaluateSort(d,b,c);case 134217764:return this.evaluateSpacegroup(d,b);case 1296041985:return this.evaluateSymop(d,b,268442113==a.tok);case 1275068445:return this.evaluateTensor(d,b);case 134217759:return this.evaluateWithin(d,b,268442113==a.tok);case 134221856:return this.evaluateWrite(d,b)}return!1},"JS.ScriptMathProcessor,JS.T,~A,~N");s(q,"evaluateMatrix",function(d,a){var b=a.length,c=null,e=0<b&&4==a[0].tok?a[0].value:null,f=2>
b||null==e?null:a[1].getMap(),h=2>b||null==e?null:a[1].getList(),g=1<b&&4==a[b-1].tok?a[b-1].value:null,j="uvw".equalsIgnoreCase(g),e="abc".equalsIgnoreCase(g),k=j||!e&&"xyz".equalsIgnoreCase(g),l=!j&&!e&&!k&&"rxyz".equalsIgnoreCase(g),r=null;(null!=g||null!=h||null!=f)&&b--;switch(b){case 0:c=new JU.M4;c.setIdentity();break;case 1:switch(a[0].tok){case 12:c=a[0].value;break;case 4:b=a[0].value;if(b.equals("h")||b.equals("r")||0<=b.indexOf(",")&&0>b.indexOf(":")){if(0<=b.indexOf("*")){if(c=this.vwr.getCurrentUnitCell(),
null==c)return!1}else c=this.vwr.getSymTemp();c=c.convertTransform(b,null)}if(null!=c)break;var m=null;null!=g&&(!e&&!k&&!j)&&("map".equals(g)?f=new java.util.Hashtable:("list".equals(g)||(m="[SELECT ("+g+")]"),h=new JU.Lst));var j=null==h&&null==f,n=null==f?null:new java.util.Hashtable,g=null==h?null:new JU.Lst;j&&(n=new java.util.Hashtable,n.put("ASM4",Boolean.TRUE));c=this.vwr.getSymStatic().staticGetMatrixTransform(b,null==n?g:n);if(j)break;if(null!=f){f.clear();for(var C,c=n.entrySet().iterator();c.hasNext()&&
((C=c.next())||1);)f.put(C.getKey(),JS.SV.getVariable(C.getValue()));return d.addXMap(f)}if(null!=h){if(null!=m)return d.addXObj(this.vwr.extractProperty(g,m,-1));h.clear();f=0;for(c=g.size();f<c;f++)h.addLast(JS.SV.getVariable(g.get(f)));return d.addXList(h)}break;case 7:switch(h=a[0].getList(),b=h.size(),b){case 3:case 4:r=B(b*b,0);for(m=f=0;f<b;f++){g=h.get(f).getList();if(null==g||g.size()!=b)return!1;for(C=0;C<b;C++)r[m++]=JS.SV.fValue(g.get(C))}break;case 9:case 16:r=JS.SV.flistValue(a[0],0);
break;default:return!1}}break;case 3:case 4:if(7==a[0].tok){r=B(3==b?9:16,0);for(f=h=0;f<b;f++){m=JS.SV.flistValue(a[f],0);for(C=0;C<b;C++)r[h++]=m[C]}}}if(null!=r)switch(r.length){case 9:return d.addXObj(JU.M3.newA9(r));case 16:c=JU.M4.newA16(r);break;default:return!1}return null==c?d.addXStr(""):l||e||k?d.addXStr(this.matToString(c,l?1:e?2748:0)):d.addXM4(c)},"JS.ScriptMathProcessor,~A");s(q,"matToString",function(d,a){var b=this.vwr.getSymStatic();switch(a){case 1:return b.staticConvertOperation(null,
d,"rxyz");case 32:case 2748:return b.staticGetTransformABC(d,!1);default:case 36:case 28:return this.vwr.getSymStatic().staticConvertOperation("",d,36==a?"uvw":"xyz")}},"JU.M4,~N");s(q,"evaluateCallbackParam",function(d,a){return d.addX(this.e.getCallbackParameter(0==a.length?-2147483648:a[0].asInt()))},"JS.ScriptMathProcessor,~A");s(q,"evaluateSpacegroup",function(d,a){var b=null,c=a.length;if(0==c)return d.addXObj(this.vwr.getSymTemp().getSpaceGroupInfo(this.vwr.ms,null,this.vwr.am.cmi,!0,null));
var e=4==a[a.length-1].tok?a[a.length-1].value:null,f="settings".equalsIgnoreCase(e),h="setting".equalsIgnoreCase(e),g=1<c&&(2!=c||!f&&!h&&!"list".equalsIgnoreCase(e)&&!"jmol".equalsIgnoreCase(e)),j=a[0].asString();if(g||"subgroups".equals(e))return g=this.getSubgroupInfo(a,"subgroups".equals(e)?c:c+1),null==g?!1:d.addXObj(g);var k=null,g=null;switch(c){default:return!1;case 2:if("list".equals(e)){k=Integer.$valueOf(this.vwr.getSymTemp().getSpaceGroupInfoObj("itaNumber",j,!1,!1));j="list";break}if(4!=
a[1].tok){b=JS.SV.flistValue(a[1],0);if(null==b||6!=b.length)return!1;k=b=JU.SimpleUnitCell.newParams(b,NaN)}case 1:if(10==a[0].tok)return j=JS.SV.getBitSet(a[0],!0),d.addXObj(this.vwr.findSpaceGroup(null,j,null,b,null,null,1));var l=2==a[0].tok?a[0].intValue:1==c?-2147483648:0;if(f||h)return f&&0==l?!1:d.addXObj((-2147483648==l?this.vwr.getCurrentUnitCell():this.vwr.getSymTemp()).getSpaceGroupJSON(e.toLowerCase(),h&&1<c?j:null,l));if("setting".equalsIgnoreCase(j)||"settings".equalsIgnoreCase(j))return b=
this.vwr.getOperativeSymmetry(),d.addXObj(null==b?null:b.getSpaceGroupJSON(j.toLowerCase(),null,-2147483648));if(j.toUpperCase().startsWith("AFLOWLIB/"))return d.addXObj(this.vwr.getSymTemp().getSpaceGroupJSON("AFLOWLIB",j.substring(9),0));if(j.startsWith("Hall:")||0<=j.indexOf("x")||null!=b){g=this.vwr.findSpaceGroup(null,null,j,b,null,null,1);break}if(0<l||3==a[0].tok||4==a[0].tok){if(0<l||1<j.length&&"/"==j.charAt(1)||!j.endsWith(":")&&!Double.isNaN(JU.PT.parseFloat(j)))j="ITA/"+j;if(j.toUpperCase().startsWith("ITA/"))return d.addXObj(this.vwr.getSymTemp().getSpaceGroupJSON("ITA",
j.substring(4),0))}}null==g&&(g=this.vwr.getSymStatic().getSpaceGroupInfoObj(j,k,!0,!1));null!=g&&(!"jmol".equals(e)&&!"list".equals(e))&&(System.out.println("MathExt "+g),b=""+g.get("itaIndex"),g=this.vwr.getSymTemp().getSpaceGroupJSON("ITA",b,0));return d.addXObj(g)},"JS.ScriptMathProcessor,~A");s(q,"getSubgroupInfo",function(d,a){var b,c=-2147483648,e=-2147483648,f=null,h=null;switch(a){case 5:if(e=d[3].intValue,0>e)return null;case 4:if(c=d[2].intValue,0>c||2147483647==c)return null;case 3:h=
0==d[1].intValue?"":d[1].asString();case 2:f=d[0].asString();default:if(null==f){b=this.vwr.getOperativeSymmetry();if(null==b)return null;f=b.getSpaceGroupClegId()}else b=this.vwr.getSymStatic()}return b.getSubgroupJSON(f,h,c,e,0,null,null)},"~A,~N");s(q,"evaluatePointGroup",function(d,a,b){var c=null,e=null,f=-1,h=-1,g=null,j=!1;switch(a.length){case 4:h=a[3].asFloat();case 3:f=a[2].asFloat();case 2:switch(a[1].tok){case 8:e=JS.SV.ptValue(a[1]);break;case 10:g=JS.SV.getBitSet(a[1],!1),a[0].asString().equalsIgnoreCase("spaceGroup")&&
(j=!0,2==a.length&&(f=0))}if(j)break;case 1:switch(a[0].tok){case 7:b=a[0].getList();c=Array(b.size());for(a=c.length;0<=--a;)c[a]=JS.SV.ptValue(b.get(a));break;case 10:g=JS.SV.getBitSet(a[0],!1);c=this.vwr.ms.at;break;case 4:if(b){g=JS.SV.getBitSet(d.getX(),!0);if(null==g||g.isEmpty())return!1;j=a[0].asString();if("spacegroup".equals(j)){j=!0;break}}default:return!1}break;case 0:if(!b)return d.addXObj(this.vwr.ms.getPointGroupInfo(null));g=JS.SV.getBitSet(d.getX(),!1);break;default:return!1}if(null!=
g){a=g.nextSetBit(0);if(0>a||a>=this.vwr.ms.ac||j&&1!=g.cardinality())return!1;if(j){e=this.vwr.ms.generateCrystalClass(a,JU.P3.new3(NaN,NaN,NaN));c=Array(e.size());for(a=c.length;0<=--a;)c[a]=e.get(a);e=new JU.P3}}c=this.vwr.getSymTemp().setPointGroup(this.vwr,null,e,null==c?this.vwr.ms.at:c,g,!1,0>f?this.vwr.getFloat(570425382):f,0>h?this.vwr.getFloat(570425384):h,null==g?c.length:g.cardinality(),!0);return d.addXMap(c.getPointGroupInfo(-1,null,!0,null,0,1))},"JS.ScriptMathProcessor,~A,~B");s(q,
"evaluateUnitCell",function(d,a,b,c){var e=b?JS.SV.getBitSet(d.getX(),!0):1812599299==c?this.vwr.getAllAtoms():null,f=(null==e?this.vwr.getAllAtoms():e).nextSetBit(0),h=a.length-1;b=1;switch(0>h?0:a[h].tok){case 2:case 3:b=a[h].asFloat(),h--}var g=!1,j=0>h?0:a[0].tok,k=null,l=null,r=null;switch(j){case 7:l=a[0].getList();break;case 12:switch(1<h?1073741936:1>h?0:a[1].tok){default:case 1073741936:return!1;case 0:case 1073742334:break;case 1073742335:g=!0}return d.addXStr(this.vwr.getSymStatic().staticGetTransformABC(a[0].value,
g));case 4:if(r=a[0].asString(),1814695966==c)if(0==r.indexOf("a=")){k=Array(4);for(g=0;4>g;g++)k[g]=new JU.P3;JU.SimpleUnitCell.setAbc(r,null,k)}else if(0<=r.indexOf(",")||r.equals("r"))return b=2==a.length&&JS.SV.bValue(a[1])?this.vwr.getSymTemp().convertTransform(r,null):this.vwr.getV0abc(-1,r),d.addXObj(b)}if(1812599299==c)return b=this.vwr.ms.getBoxInfo(e,1),d.addXObj(b.getInfo(r));c=null;g=null!=l;if(null==k&&g&&4>l.size())return!1;r=g?1:0;null==k&&(!g&&8!=j)&&(c=0>f?this.vwr.getCurrentUnitCell():
this.vwr.ms.getUnitCell(this.vwr.ms.at[f].mi),k=null==c?w(-1,[JU.P3.new3(0,0,0),JU.P3.new3(1,0,0),JU.P3.new3(0,1,0),JU.P3.new3(0,0,1)]):c.getUnitCellVectors());if(null==k)if(k=Array(4),g)switch(l.size()){case 3:k[0]=new JU.P3;for(g=0;3>g;g++)k[g+1]=JU.P3.newP(JS.SV.ptValue(l.get(g)));break;case 4:for(g=0;4>g;g++)k[g]=JU.P3.newP(JS.SV.ptValue(l.get(g)));break;case 6:j=B(6,0);for(g=0;6>g;g++)j[g]=l.get(g).asFloat();JU.SimpleUnitCell.setAbc(null,j,k);break;default:return!1}else switch(k[0]=JU.P3.newP(JS.SV.ptValue(a[0])),
h){case 3:for(g=1;4>g;g++)(k[g]=JU.P3.newP(JS.SV.ptValue(a[g]))).sub(k[0]);break;case 1:if(l=a[1].getList(),null!=l&&3==l.size()){for(g=0;3>g;g++)k[g+1]=JU.P3.newP(JS.SV.ptValue(l.get(g)));break}default:return!1}j=r<=h?a[r].asString():null;if((l="primitive".equalsIgnoreCase(j))||"conventional".equalsIgnoreCase(j)){a=++r>h?"":a[r].asString().toUpperCase();a.equals("BCC")?a="I":0==a.length&&(a=this.vwr.getSymmetryInfo(f,null,0,null,null,null,1073741994,null,0,-1,0,null));if(null==a||0==a.length)return!1;
null==c&&(c=this.vwr.getSymTemp());f=this.vwr.getModelForAtomIndex(f).auxiliaryInfo.get("primitiveToCrystal");if(!c.toFromPrimitive(l,a.charAt(0),k,f))return!1}else if("reciprocal".equalsIgnoreCase(j))k=JU.SimpleUnitCell.getReciprocal(k,null,b),b=1;else if("vertices".equalsIgnoreCase(j))return d.addXObj(JU.BoxInfo.getVerticesFromOABC(k));if(1!=b)for(g=1;4>g;g++)k[g].scale(b);return d.addXObj(k)},"JS.ScriptMathProcessor,~A,~B,~N");s(q,"evaluateArray",function(d,a,b){if(b){b=d.getX();switch(b.tok){case 11:case 12:return d.addX(b.toArray())}if(0==
a.length||2<a.length)return!1;var c=1==a.length||1073742334==a[1].tok,e;switch(b.tok){case 11:case 12:return d.addX(b.toArray());case 6:if(1!=a.length)break;var f=new JU.Lst,h=b.getMap(),g=b.getKeys(!1);b=0;for(var j=g.length;b<j;b++)if(null==h.get(g[b]).getMap())return!1;a=a[0].asString();b=0;for(j=g.length;b<j;b++)e=h.get(g[b]).getMap(),c&&(e=JS.SV.deepCopy(e,!0,!1)),e.put(a,JS.SV.newS(g[b])),f.addLast(JS.SV.newV(6,e));return d.addXList(f);case 7:var k=!0,g=new JU.BS,h=new java.util.Hashtable,l=
b.getList();a=a[0].asString();for(b=l.size();0<--b;)if(e=l.get(b).getMap(),null==e||null==e.get(a))return!1;b=0;for(j=l.size();b<j;b++){e=l.get(b).getMap();if(null==e)return!1;c&&(e=JS.SV.deepCopy(e,!0,!1));var r=e.remove(a);k&&(2==r.tok&&0<=r.intValue&&1E4>=r.intValue?g.set(r.intValue):k=!1);r=r.asString();if(h.containsKey(r))return!1;h.put(r,JS.SV.newV(6,e))}if(k&&(b=g.nextSetBit(0),(new Boolean(0==b|1==b)).valueOf()&&(c=g.cardinality(),g.nextClearBit(b)==c+b))){j=Array(c);for(h=h.entrySet().iterator();h.hasNext()&&
((f=h.next())||1);)j[Integer.parseInt(f.getKey())-b]=f.getValue();f=new JU.Lst;for(b=0;b<c;b++)f.addLast(j[b]);return d.addXList(f)}return d.addXObj(h)}return!1}j=Array(a.length);for(b=j.length;0<=--b;)j[b]=JS.SV.newT(a[b]);return d.addXAV(j)},"JS.ScriptMathProcessor,~A,~B");s(q,"evaluateBin",function(d,a){var b=a.length;if(3>b||5<b)return!1;var c=d.getX(),e=13==c.tok;if(!e&&7!=c.tok)return d.addX(c);var f=JS.SV.fValue(a[0]),h=JS.SV.fValue(a[1]),g=JS.SV.fValue(a[2]),j=4<=b&&1073742335==a[b-1].tok,
b=(5==b||4==b&&!j)&&1073742334!=a[3].tok?JS.SV.sValue(a[3]):null,k=null;if(e)c=c.value;else{e=c.getList();c=B(e.size(),0);null!=b&&(k=JU.AU.createArrayOfHashtable(e.size()));try{for(var l=e.size();0<=--l;)c[l]=JS.SV.fValue(null==b?e.get(l):(k[l]=e.get(l).getMap()).get(b))}catch(r){if(M(r,Exception))return!1;throw r;}}for(var h=Math.max(W(Math.floor((h-f)/g+0.01)),1),e=O(h,0),m=c.length,l=0;l<m;l++){var n=W(Math.floor((c[l]-f)/g));if(!(0>n||n>=h))if(e[n]++,null!=b){var C=k[l];if(null!=C){C.put("_bin",
JS.SV.newI(n));var p=f+g*n,q=p+g;C.put("_binMin",JS.SV.newF(0==n?-3.4028235E38:p));C.put("_binMax",JS.SV.newF(n==h-1?3.4028235E38:q))}}}if(j){j=new JU.Lst;for(l=0;l<h;l++)j.addLast(B(-1,[f+g*l,e[l]]));return d.addXList(j)}return d.addXAI(e)},"JS.ScriptMathProcessor,~A");s(q,"evaluateCache",function(d,a){return 0<a.length?!1:d.addXMap(this.vwr.fm.cacheList())},"JS.ScriptMathProcessor,~A");s(q,"evaluateColor",function(d,a){var b=0<a.length?JS.SV.sValue(a[0]):"",c=b.startsWith("$");if(2==a.length&&b.equalsIgnoreCase("TOHSL"))return d.addXPt(JU.CU.rgbToHSL(JU.P3.newP(8==
a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString())),!0));if(2==a.length&&b.equalsIgnoreCase("TORGB")){var e=JU.P3.newP(8==a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString()));return d.addXPt(8==a[1].tok?JU.CU.hslToRGB(e):e)}if(4==a.length&&(1073742335==a[3].tok||1073742334==a[3].tok)){var e=JU.P3.newP(8==a[0].tok?JS.SV.ptValue(a[0]):JU.CU.colorPtFromString(a[0].asString())),f=JU.P3.newP(8==a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString())),
h=1073742335==a[3].tok;h&&(e=JU.CU.rgbToHSL(e,!1),f=JU.CU.rgbToHSL(f,!1));var g=new JU.SB,f=JU.V3.newVsub(f,e),j=a[2].asInt();2>j&&(j=20);f.scale(1/(j-1));for(b=0;b<j;b++)g.append(JU.Escape.escapeColor(JU.CU.colorPtToFFRGB(h?JU.CU.hslToRGB(e):e))),e.add(f);return d.addXStr(g.toString())}j=c?null:this.vwr.cm.getColorEncoder(b);if(!c&&null==j)return d.addXStr("");e=1<a.length?JS.SV.fValue(a[1]):3.4028235E38;f=2<a.length?JS.SV.fValue(a[2]):3.4028235E38;h=3<a.length?JS.SV.fValue(a[3]):3.4028235E38;g=
3.4028235E38!=h||3.4028235E38!=e&&3.4028235E38==f;3.4028235E38==f&&0==b.length&&(h=e,f=this.vwr.getCurrentColorRange(),e=f[0],f=f[1]);if(c){j=b.substring(1);j=w(-1,[j,null]);if(!this.vwr.shm.getShapePropertyData(24,"colorEncoder",j))return d.addXStr("");j=j[1]}else j.setRange(e,f,e>f);b=j.getColorKey();return g?d.addXPt(JU.CU.colorPtFromInt(j.getArgb(3.4028235E38==f?e:h),null)):d.addX(JS.SV.getVariableMap(b))},"JS.ScriptMathProcessor,~A");s(q,"evaluateCompare",function(d,a){var b=a.length;if(2>b||
5<b)return!1;var c,e=1073742335==a[b-1].tok;(e||1073742334==a[b-1].tok)&&b--;var f=JS.SV.sValue(a[b-1]),h=f.equalsIgnoreCase("stddev"),g=f.equalsIgnoreCase("ISOMER"),j=g&&e,k=f.equalsIgnoreCase("BONDS"),e=7==a[0].tok&&7==a[1].tok,l=3<=b?a[2].getList():null,r=null==l&&!e&&!g&&b>(h?3:2),e=10==a[0].tok?a[0].value:null,m=10==a[1].tok?a[1].value:null,n=null==e?JS.SV.sValue(a[0]):"",C=null==m?JS.SV.sValue(a[1]):"";c=NaN;try{if(k){if(4!=b)return!1;n=JS.SV.sValue(a[2]);r=n.equalsIgnoreCase("SMILES");try{r&&
(n=this.vwr.getSmiles(e))}catch(p){if(M(p,Exception))this.e.evalError(p.getMessage(),null);else throw p;}var q=this.e.getSmilesExt().getFlexFitList(e,m,n,!r);return null==q?d.addXStr(""):d.addXAF(q)}if(g){if(3!=b)return!1;if(null==e&&null==m){var t=this.vwr.getSmilesMatcher().getRelationship(n,C).toUpperCase();return d.addXStr(t)}var s=null==e?this.vwr.getSmilesMatcher().getMolecularFormula(n,!1,!1):JU.JmolMolecule.getMolecularFormulaAtoms(this.vwr.ms.at,e,null,!1),B=null==m?this.vwr.getSmilesMatcher().getMolecularFormula(C,
!1,!1):JU.JmolMolecule.getMolecularFormulaAtoms(this.vwr.ms.at,m,null,!1);if(!s.equals(B))return d.addXStr("NONE");null!=e&&(n=this.e.getSmilesExt().getSmilesMatches("/strict///",null,e,null,1,!0,!1));var x;null==m?x=0<this.vwr.getSmilesMatcher().areEqual(C,n):(C=this.e.getSmilesExt().getSmilesMatches("/strict///",null,m,null,1,!0,!1),x=0<=this.e.getSmilesExt().getSmilesMatches("/strict///"+n,null,m,null,1,!0,!1).nextSetBit(0));if(!x){var D=n+C;if(0<=D.indexOf("/")||0<=D.indexOf("\\")||0<=D.indexOf("@")){if(0<=
n.indexOf("@")&&(null!=m||0<=C.indexOf("@"))&&0>n.indexOf("@SP")){var Q=n.toLowerCase().indexOf("invertstereo"),n=0<=Q?"/strict/"+n.substring(0,Q)+n.substring(Q+12):"/invertstereo strict/"+n;if(x=null==m?0<this.vwr.getSmilesMatcher().areEqual(n,C):0<=this.e.getSmilesExt().getSmilesMatches(n,null,m,null,1,!0,!1).nextSetBit(0))return d.addXStr("ENANTIOMERS")}null==m?x=0<this.vwr.getSmilesMatcher().areEqual("/nostereo/"+C,n):(t=this.e.getSmilesExt().getSmilesMatches("/nostereo/"+n,null,m,null,1,!0,!1),
x=0<=t.nextSetBit(0));if(x)return d.addXStr("DIASTEREOMERS")}t="CONSTITUTIONAL ISOMERS";if(j){var v=this.vwr.getInchi(e,null,null);null!=v&&v.equals(this.vwr.getInchi(m,null,null))&&(t="TAUTOMERS")}return d.addXStr(t)}if(null==e||null==m)return d.addXStr("IDENTICAL");c=this.e.getSmilesExt().getSmilesCorrelation(e,m,n,null,null,null,null,!1,null,null,!1,1);return d.addXStr(0.2>c?"IDENTICAL":"IDENTICAL or CONFORMATIONAL ISOMERS (RMSD="+c+")")}var A=new JU.M4,v=x=null;if(r){if(null==e||null==m)return!1;
var f=JS.SV.sValue(a[2]),w=f.equalsIgnoreCase("MAP"),r=f.equalsIgnoreCase("SMILES"),N=w||f.equalsIgnoreCase("SMARTS");if(r||N)f=b>(h?4:3)?JS.SV.sValue(a[3]):null;var G="H".equalsIgnoreCase(f)||"allH".equalsIgnoreCase(f)||"bestH".equalsIgnoreCase(f),L=!G&&("polyhedra".equalsIgnoreCase(f)||"polyhedron".equalsIgnoreCase(f));if(L)c=this.e.getSmilesExt().mapPolyhedra(e.nextSetBit(0),m.nextSetBit(0),r,A);else{x=new JU.Lst;var v=new JU.Lst,D="all".equalsIgnoreCase(f)||"allH".equalsIgnoreCase(f),u="best".equalsIgnoreCase(f)||
"bestH".equalsIgnoreCase(f);"stddev".equals(f)&&(f=null);var y=f;if(null==f||G||D||u){if(!w&&!r||G&&L)return!1;y="/noaromatic"+(D||u?"/":" nostereo/")+this.e.getSmilesExt().getSmilesMatches(G?"H":"",null,e,null,32769,!0,!1)}else D=!0;c=this.e.getSmilesExt().getSmilesCorrelation(e,m,y,x,v,A,null,w,null,null,u,(r?1:2)|(!D&&!u?8:0));if(w){var V=x.size();if(0==V)return d.addXStr("");for(var ba=W(v.size()/V),t=new JU.Lst,Q=y=0;y<ba;y++){var R=JU.AU.newInt2(V);t.addLast(R);for(f=0;f<V;f++,Q++)R[f]=O(-1,
[x.get(f).i,v.get(Q).i])}return D?d.addXList(t):0<t.size()?d.addXAII(t.get(0)):d.addXStr("")}}}else{x=this.e.getPointVector(a[0],0);v=this.e.getPointVector(a[1],0);if(null==x||null==v)return!1;if(null!=l){b--;var F=l.size();if(F>x.size()||F!=v.size())return!1;for(var ca=new JU.Lst,y=0;y<F;y++)ca.addLast(x.get(l.get(y).intValue-1));x=ca}switch(b){case 2:break;case 3:if(h)break;default:return!1}x.size()==v.size()&&(J.api.Interface.getInterface("JU.Eigen",this.vwr,"script"),c=JU.Measure.getTransformMatrix4(x,
v,A,null))}return h||Float.isNaN(c)?d.addXFloat(c):d.addXM4(A.round(1E-7))}catch(H){if(M(H,Exception))return this.e.evalError(null==H.getMessage()?H.toString():H.getMessage(),null),!1;throw H;}},"JS.ScriptMathProcessor,~A");s(q,"evaluateConnected",function(d,a,b,c){if(5<a.length)return!1;var e=-2147483648,f=2147483647,h=0,g=3.4028235E38,j=65535,k=null,l=null,r=!1,m=!1;switch(b){case 1275203608:l=-2147483648;h=null;if(0<a.length)switch(a[0].tok){case 2:l=a[0].intValue;break;case 4:h=JS.SV.sValue(a[0])}1275203608==
c&&(k=JS.SV.getBitSet(d.getX(),!0));k=w(-1,[Integer.$valueOf(l),h,k]);this.vwr.shm.getShapePropertyData(21,"getCenters",k)||(k[1]=null);return d.addXBs(null==k[1]?new JU.BS:k[1]);case 1228931586:k=d.getX();if(10!=k.tok||1!=a.length||10!=a[0].tok)return!1;k=k.value;l=a[0].value;a=new JU.Lst;h=this.vwr.ms.at;for(c=k.nextSetBit(0);0<=c;c=k.nextSetBit(c+1)){b=0;g=h[c].bonds;for(m=g.length;0<=--m;)l.get(g[m].getOtherAtom(h[c]).i)&&b++;a.addLast(Integer.$valueOf(b))}return d.addXList(a)}for(c=0;c<a.length;c++){var n=
a[c];switch(n.tok){case 10:if((m=A(n.value,"JM.BondSet"))&&null!=k)return!1;if(null==k)k=n.value;else if(null==l)l=n.value;else return!1;break;case 4:b=JS.SV.sValue(n);j=b.equalsIgnoreCase("hbond")?30720:JU.Edge.getBondOrderFromString(b);if(131071==j)return!1;break;case 3:r=!0;default:b=n.asInt();n=n.asFloat();if(2147483647!=f)return!1;-2147483648==e?(e=Math.max(b,0),h=n):(f=b,g=n)}}-2147483648==e?(e=1,f=100,h=0.1,g=1E8):2147483647==f&&(f=e,g=h,h=0.1);null==k&&(k=this.vwr.getAllAtoms());r&&null==
l&&(l=k);return null!=l?(a=new JU.BS,this.vwr.makeConnections(h,g,j,1086324745,k,l,a,m,!1,0),d.addX(JS.SV.newV(10,JM.BondSet.newBS(a)))):d.addXBs(this.vwr.ms.getAtomsConnected(e,f,j,k))},"JS.ScriptMathProcessor,~A,~N,~N");s(q,"evaluateContact",function(d,a){if(1>a.length||3<a.length)return!1;var b=0,c=100;switch(a[0].tok){case 3:case 2:c=JS.SV.fValue(a[b++]);break;case 10:break;default:return!1}if(b==a.length||!A(a[b].value,"JU.BS"))return!1;var e=JU.BSUtil.copy(a[b++].value),b=b<a.length?JU.BSUtil.copy(a[b].value):
null,c=new J.atomdata.RadiusData(null,10<c?c/100:c,10<c?J.atomdata.RadiusData.EnumType.FACTOR:J.atomdata.RadiusData.EnumType.OFFSET,J.c.VDW.AUTO),b=this.setContactBitSets(e,b,!0,NaN,c,!1);b.or(e);return d.addXBs(b)},"JS.ScriptMathProcessor,~A");s(q,"evaluateData",function(d,a){var b=0==a.length?"":JS.SV.sValue(a[0]);switch(a.length){case 0:case 1:break;case 2:case 3:if(10==a[0].tok)return d.addXStr(this.vwr.getModelFileData(b,JS.SV.sValue(a[1]),3==a.length&&JS.SV.bValue(a[2])));break;case 4:var b=
a[1].asInt(),c=a[2].asInt(),e=a[3].asInt(),b=JU.Parser.parseFloatArrayFromMatchAndField(JS.SV.sValue(a[0]),null,0,0,null,b,c,null,e);return d.addXStr(JU.Escape.escapeFloatA(b,!1));default:return!1}if(0==b.indexOf("data2d_"))return b=this.vwr.getDataObj(b,null,2),null==b?d.addXStr(""):2==a.length&&2==a[1].tok?(c=a[1].intValue,0>c&&(c+=b.length),0<=c&&c<b.length?d.addXStr(JU.Escape.escapeFloatA(b[c],!1)):d.addXStr("")):d.addXStr(JU.Escape.escapeFloatAA(b,!1));if(b.endsWith("*"))return d.addXList(this.vwr.getDataObj(b,
null,0));if(0==b.indexOf("property_"))return b=this.vwr.getDataObj(b,null,1),null==b?d.addXStr(""):d.addXStr(JU.Escape.escapeFloatA(b,!1));b=this.vwr.getDataObj(b,null,-1);return d.addXStr(null==b||2>b.length?"":""+b[1])},"JS.ScriptMathProcessor,~A");s(q,"evaluateDotDist",function(d,a,b,c){var e=1275069443==b,f,h,g=null;switch(a.length){case 2:if(2147483647==c){f=a[0];h=a[1];break}g=a[1];case 1:f=d.getX();h=a[0];break;case 0:if(e){f=d.getX();h=JS.SV.getVariable(new JU.P3);break}default:return!1}a=
NaN;try{if(1275069442==b){var j=JU.P3.newP(d.ptValue(f,null));j.cross(j,d.ptValue(h,null));return d.addXPt(j)}var k=7==h.tok?null:d.ptValue(h,null),l=this.e.planeValue(h);if(e){b=-2147483648==c?0:c&480;var j=32==b||64==b,r=480==b;switch(f.tok){case 7:case 10:var m=10==f.tok,n=10==h.tok,C=8==h.tok,p=m?f.value:null,q=n?h.value:null,t=m?null:f.getList(),s=n?null:h.getList(),A=j&&null!=g&&g.asBoolean();switch(h.tok){case 10:case 7:case 8:var x=this.vwr.ms.at;if(A){var D=NaN,w=2147483647;if(m){for(var v=
p.nextSetBit(0);0<=v;v=p.nextSetBit(v+1)){var T=C?x[v].distanceSquared(k):this.e.getBitsetProperty(q,s,c,x[v],l,f.value,null,!1,f.index,!1).floatValue();if(!(32==b?T>=D:T<=D))D=T,w=v}return d.addXBs(2147483647==w?new JU.BS:JU.BSUtil.newAndSetBit(w))}for(v=t.size();0<=--v;){var O=JS.SV.ptValue(t.get(v)),T=C?O.distanceSquared(k):this.e.getBitsetProperty(q,s,c,O,l,f.value,null,!1,2147483647,!1).floatValue();if(!(32==b?T>=D:T<=D))D=T,w=v}return d.addXInt(w)}if(r){if(null==q){for(var N=B(p.cardinality(),
0),D=0,v=p.nextSetBit(0);0<=v;v=p.nextSetBit(v+1),D++)N[D]=x[v].distance(k);return d.addXAF(N)}w=B(p.cardinality(),q.cardinality(),0);D=0;for(v=p.nextSetBit(0);0<=v;v=p.nextSetBit(v+1),D++){c=0;for(var G=q.nextSetBit(0);0<=G;G=q.nextSetBit(G+1),c++)w[D][c]=x[v].distance(x[G])}return d.addXAFF(w)}if(j){N=B(m?p.cardinality():t.size(),0);if(m){v=p.nextSetBit(0);for(D=0;0<=v;v=p.nextSetBit(v+1))N[D++]=this.e.getBitsetProperty(q,s,c,x[v],l,f.value,null,!1,f.index,!1).floatValue();return d.addXAF(N)}for(v=
N.length;0<=--v;)N[v]=this.e.getBitsetProperty(q,s,c,JS.SV.ptValue(t.get(v)),l,null,null,!1,2147483647,!1).floatValue();return d.addXAF(N)}return d.addXObj(this.e.getBitsetProperty(p,t,c,k,l,f.value,null,!1,f.index,!1))}}}var L=d.ptValue(f,null),u=this.e.planeValue(f);e?a=null!=l&&null!=g?JU.Measure.directedDistanceToPlane(L,l,JS.SV.ptValue(g)):null==u?null==l?k.distance(L):JU.Measure.distanceToPlane(l,L):JU.Measure.distanceToPlane(u,k):null!=u&&null!=l?a=u.x*l.x+u.y*l.y+u.z*l.z+u.w*l.w:(null!=u?
L=JU.P3.new3(u.x,u.y,u.z):null!=l&&(k=JU.P3.new3(l.x,l.y,l.z)),a=L.dot(k))}catch(y){if(!M(y,Exception))throw y;}return d.addXFloat(a)},"JS.ScriptMathProcessor,~A,~N,~N");s(q,"evaluateHelix",function(d,a){if(1>a.length||5<a.length)return!1;var b=2<a.length?3:1,c=b>=a.length?"array":JS.SV.sValue(a[b]),b=JS.T.getTokFromName(c);if(2<a.length){var e=d.ptValue(a[0],null),f=d.ptValue(a[1],null);if(0==b||9!=a[2].tok||null==e||null==f)return!1;var h=JU.Quat.newP4(a[2].value),h=JU.Measure.computeHelicalAxis(e,
f,h);return null==h?!1:d.addXObj(JU.Escape.escapeHelical(c,b,e,f,h))}c=A(a[0].value,"JU.BS")?a[0].value:this.vwr.ms.getAtoms(1094715412,Integer.$valueOf(a[0].asInt()));switch(b){case 134217751:case 1073741854:case 1665140738:return d.addXObj(this.getHelixData(c,b));case 134217729:return d.addXFloat(this.getHelixData(c,134217729).floatValue());case 135176:case 1745489939:return d.addXObj(this.getHelixData(c,b));case 1275068418:h=this.getHelixData(c,1073742001);if(null==h)break;return d.addXAS(h)}return!1},
"JS.ScriptMathProcessor,~A");s(q,"getHelixData",function(d,a){var b=d.nextSetBit(0);return 0>b?"null":this.vwr.ms.at[b].group.getHelixData(a,this.vwr.getQuaternionFrame(),this.vwr.getInt(553648142))},"JU.BS,~N");s(q,"evaluateInChI",function(d,a){var b=d.getX(),c=0<a.length?JS.SV.sValue(a[0]):"fixedh?";c.toLowerCase().equals("standard")&&(c="");var e=JS.SV.getBitSet(b,!0),b=null==e?JS.SV.sValue(b):null,e=this.vwr.getInchi(e,b,c);return 0<=c.indexOf("model")?d.addXMap(this.vwr.parseJSONMap(e)):d.addXStr(e)},
"JS.ScriptMathProcessor,~A");s(q,"evaluateFind",function(d,a){var b=d.getX(),c=7==b.tok,e=10==b.tok,f=0==a.length,h=0==a.length?0:a[0].tok,g=f||4!=h?"":JS.SV.sValue(a[0]),j=1<a.length&&1073742334==a[1].tok,k=0==h?0:a[a.length-1].tok,l=0==k?JS.SV.vF:a[a.length-1],r=!c&&1073742335==k,k=c&&4==l.tok&&"index".equalsIgnoreCase(JS.SV.sValue(l)),m=1<a.length&&1073742335!=a[1].tok&&1073742334!=a[1].tok&&10!=a[1].tok?JS.SV.sValue(a[1]):"",n=!c&&!j&&g.equalsIgnoreCase("SEQUENCE"),q=!c&&!j&&g.equalsIgnoreCase("SEQ");
if(g.toUpperCase().startsWith("SMILES/")){g.endsWith("/")||(g+="/");var p=g.substring(6)+"//";JV.JC.isSmilesCanonical(p)?(m="SMILES",g="CHEMICAL"):(g="SMILES",m=p+m)}else g.toUpperCase().startsWith("SMARTS/")&&(g.endsWith("/")||(g+="/"),m=g.substring(6)+(0==m.length?"//":m),g="SMARTS");var s=null,t=!1,A=0<a.length&&134218753==a[0].tok;if(!A&&4==b.tok)switch(a.length){case 1:if(b.value.startsWith("InChI=")&&g.equalsIgnoreCase("SMILES"))return d.addXStr(this.vwr.getInchi(null,b.value,"SMILES"+m));t=
!g.equals("SMILES");break;case 2:case 3:j||r?t=!0:b.value.startsWith("InChI=")?g.equals("SMARTS")?s=this.vwr.getInchi(null,b.value,"SMILES"):t=!0:3>=m.length&&0==m.$replace("m"," ").$replace("i"," ").$replace("v"," ").trim().length&&(t=!0)}var B=!t&&g.equalsIgnoreCase("SMILES"),x=A||!t&&g.equalsIgnoreCase("SMARTS"),D=!c&&!t&&g.equalsIgnoreCase("CHEMICAL"),Q=!c&&!t&&g.equalsIgnoreCase("MF"),v=!c&&!t&&g.equalsIgnoreCase("CELLFORMULA"),T=e&&!c&&g.equalsIgnoreCase("INCHI"),W=e&&!c&&g.equalsIgnoreCase("INCHIKEY"),
N=!B&&!x&&10==h&&0<=m.toLowerCase().indexOf("map"),t=!B&&!x&&(10==b.tok||8==b.tok||7==b.tok)&&g.toLowerCase().startsWith("equivalent");try{if(t)switch(b.tok){case 10:return d.addXBs(this.vwr.ms.getSymmetryEquivAtoms(b.value,null,null));case 8:return d.addXList(this.vwr.getSymmetryEquivPoints(b.value,g+m));case 7:for(var G=new JU.Lst,L=b.getList(),u=0,y=L.size();u<y;u++){var V=JS.SV.ptValue(L.get(u));if(null==V)return!1;G.addLast(V)}return d.addXList(this.vwr.getSymmetryEquivPointList(G,g+m))}else if(T||
W)return W&&(m+=" key"),d.addXStr(this.vwr.getInchi(JS.SV.getBitSet(b,!0),null,m));if(D){var ba=e?b.value:null,R=null==ba?JS.SV.sValue(b):this.vwr.getOpenSmiles(ba),R=(0==R.length?"":this.vwr.getChemicalInfo(R,m.toLowerCase(),ba)).trim();R.startsWith("InChI")&&(R=JU.PT.rep(JU.PT.rep(R,"InChI=",""),"InChIKey=",""));return d.addXStr(R)}if(B||x||e){var e=N?0:B||x?2:1,F=e<a.length&&10==a[e].tok?a[e++].value:null,ca=4==l.tok&&"bonds".equalsIgnoreCase(JS.SV.sValue(l)),L=ca||r,G=!1,e=null;switch(b.tok){case 134218753:G=
!0;case 7:case 4:null==s&&!c&&(s=b.value);if((B||x)&&1==a.length&&null==m||null!=F)return!1;if(m.equalsIgnoreCase("mf"))e=this.vwr.getSmilesMatcher().getMolecularFormula(s.toString(),x,r);else{var H=A?a[0].value:m,z=!0,y=!1;if(A)switch(a.length){case 3:z=JS.SV.bValue(a[2]);case 2:y=JS.SV.bValue(a[1])}else switch(a.length){case 4:z=JS.SV.bValue(a[3]);case 3:y=JS.SV.bValue(a[2])}var X=!A&&H.equals("chirality"),F=!y&&(!z||!x&&!X);try{if(c){for(var P=b.getList(),E=Array(P.size()),u=E.length;0<=--u;)E[u]=
P.get(u).value;s=E}e=this.e.getSmilesExt().getSmilesMatches(H,s,null,null,x?2:1,!y,!z);if(c)return d.addXObj(e)}catch(U){if(M(U,Exception))return System.out.println(U.getMessage()),d.addXInt(-1);throw U;}var ia=X?1:(JU.AU.isAI(e),e.length);if(0==ia&&"MF_FAILED"!==this.vwr.getSmilesMatcher().getLastException()&&(G||0>s.toLowerCase().indexOf("noaromatic")&&0>s.toLowerCase().indexOf("strict")))e=this.e.getSmilesExt().getSmilesMatches(H,s,null,null,16|(x?2:1),!y,!z);if(F)return d.addXInt(!z&&0<ia?1:ia)}break;
case 10:z=b.value;if(g.equalsIgnoreCase("spacegroup"))return E=this.vwr.findSpaceGroup(null,z,null,null,null,null,"parent".equals(m.toLowerCase())?8:0),null!=E&&(p=E.toString(),E=JU.PT.rep(p.substring(p.indexOf(" ")+1)," #","\t")),d.addXStr(E.toString());if(g.equalsIgnoreCase("crystalClass"))return y=z.nextSetBit(0),u=null,2!=a.length&&(u=new JU.BS,u.set(y)),d.addXList(this.vwr.ms.generateCrystalClass(y,null!=u?this.vwr.ms.getAtomSetCenter(u):10==l.tok?this.vwr.ms.getAtomSetCenter(l.value):JS.SV.ptValue(l)));
if(Q&&0!=m.length)return d.addXBs(JU.JmolMolecule.getBitSetForMF(this.vwr.ms.at,z,m));if(Q||v)return d.addXStr(this.vwr.getFormulaForAtoms(z,Q?"MF":"CELLFORMULA",r));if(n||q){var Y=l.asString().equalsIgnoreCase("H"),L=(new Boolean(L|Y)).valueOf();return d.addXStr(this.vwr.getSmilesOpt(z,-1,-1,(L?7340032|(Y?9437184:0):0)|(q?34603008:1048576),null))}if(N){var I=null,y=P=H=null,K=3==a.length?JS.SV.sValue(l):null,Z=null==K||K.equals("%i")||K.equals("number")?"i":K.equals("%a")||K.equals("name")?"a":K.equals("%D")||
K.equals("index")?"D":"?";null==K&&(K="number");E=null;m=m.$replace("map","").trim();g=this.vwr.getSmilesOpt(z,0,0,0,m);if(z.cardinality()!=F.cardinality())E="atom sets are not the same size";else try{0<m.length&&(g="/"+m+"/"+g);var H=this.vwr.getSmilesMatcher().getCorrelationMaps(g,this.vwr.ms.at,this.vwr.ms.ac,z,137)[0],$=this.vwr.getSmilesMatcher().getCorrelationMaps(g,this.vwr.ms.at,this.vwr.ms.ac,F,137);if(0<$.length){I=O(z.length(),0);for(u=I.length;0<=--u;)I[u]=-1;P=$[0];for(u=H.length;0<=
--u;)I[H[u]]=P[u];var y=w(H.length,2,null),ja=JU.BS.copy(z);ja.or(F);var da="?"==Z?Array(ja.length()):null;null!=da&&(da=this.e.getCmdExt().getBitsetIdentFull(ja,K,!1,2147483647,!1,da));for(var ga=this.vwr.ms.at,l=0,u=z.nextSetBit(0);0<=u;u=z.nextSetBit(u+1)){var ea=I[u];if(-1!=ea){var fa;switch(Z.charCodeAt(0)){case 97:fa=w(-1,[ga[u].getAtomName(),ga[ea].getAtomName()]);break;case 105:fa=w(-1,[Integer.$valueOf(ga[u].getAtomNumber()),Integer.$valueOf(ga[ea].getAtomNumber())]);break;case 68:fa=w(-1,
[Integer.$valueOf(u),Integer.$valueOf(ea)]);break;default:fa=w(-1,[da[u],da[ea]])}y[l++]=fa}}}}catch(ka){if(M(ka,Exception))E=ka.getMessage();else throw ka;}var S=new java.util.Hashtable;S.put("BS1",z);S.put("BS2",F);S.put("SMILES",g);null==E?(S.put("SMILEStoBS1",H),S.put("SMILEStoBS2",P),S.put("BS1toBS2",I),S.put("MAP1to2",y),S.put("key",K)):S.put("error",E);return d.addXMap(S)}if(B||x)g=1<a.length&&10==a[1].tok?this.vwr.getSmilesOpt(a[1].value,0,0,0,m):m;m=m.toUpperCase();if(0<=m.indexOf("INCHI"))return d.addXStr(this.vwr.getInchi(z,
null,"SMILES/"+m));if(m.equals("MF"))s=this.e.getSmilesExt().getSmilesMatches("",null,z,F,1,!0,!1),e=this.vwr.getSmilesMatcher().getMolecularFormula(s.toString(),!1,r);else if(ca)I=this.vwr.getSmilesMatcher().getCorrelationMaps(g,this.vwr.ms.at,this.vwr.ms.ac,z,(B?1:2)|8),e=0<I.length?this.vwr.ms.getDihedralMap(I[0]):O(0,0);else if(m.equals("MAP"))e=I=this.vwr.getSmilesMatcher().getCorrelationMaps(g,this.vwr.ms.at,this.vwr.ms.ac,z,(B?1:2)|144);else{var ha=(B?0<=m.indexOf("OPEN")?5:1:2)|(r&&0==g.length?
22020096:0);B&&0<=m.indexOf("/ALL/")&&(ha|=32768);if(0<=m.indexOf("/MOLECULE/")){for(var la=this.vwr.ms.getMolecules(),aa=new JU.Lst,u=0;u<la.length;u++)if(la[u].atomList.intersects(z)){var oa=this.e.getSmilesExt().getSmilesMatches(g,null,la[u].atomList,F,ha,!r,!1);oa.isEmpty()||aa.addLast(oa)}e=aa}else e=this.e.getSmilesExt().getSmilesMatches(g,null,z,F,ha,!r,!1)}}null==e&&this.e.invArg();return d.addXObj(e)}}catch(ma){if(M(ma,Exception))this.e.evalError(ma.getMessage(),null);else throw ma;}z=new JU.BS;
F=c?b.getList():null;if(c&&4!=h&&0!=h){b=a[0];u=0;for(y=F.size();u<y;u++)JS.SV.areEqual(F.get(u),b)&&z.set(u);e=O(z.cardinality(),0);l=0;for(u=z.nextSetBit(0);0<=u;u=z.nextSetBit(u+1))e[l++]=u+1;return d.addXAI(e)}h=0<=m.indexOf("v");u=0<=m.indexOf("i")||j;j=0<=m.indexOf("m");m=0==g.length;t=!m&&!t&&a.length==(k?3:2);if(c||t){n=t?this.getPatternMatcher():null;H=null;if(t)try{H=n.compile(g,u)}catch(na){if(M(na,Exception))this.e.evalError(na.toString(),null);else throw na;}P=m?null:JS.SV.strListValue(b);
n=m?F.size():P.length;JU.Logger.debugging&&JU.Logger.debug("finding "+g);y=0;I=null;b=j?new JU.Lst:null;K="";for(u=0;u<n;u++){if(m)switch(E=F.get(u),E.tok){case 6:E=E.getMap().isEmpty()!=f;break;case 7:E=0==E.getList().size()!=f;break;case 4:E=0==E.asString().length!=f;break;default:E=!0}else t?(K=P[u],I=H.matcher(K),E=I.find()):E=0<=JS.SV.sValue(F.get(u)).indexOf(g);if(j&&E||!j&&E==!h)y++,z.set(u),j&&b.addLast(h?K.substring(0,I.start())+K.substring(I.end()):I.group())}if(!c)return j?d.addXStr(1==
b.size()?b.get(0):""):h?d.addXBool(1==y):j?d.addXStr(0==y?"":I.group()):d.addXInt(0==y?0:I.start()+1);if(k){G=new JU.Lst;for(u=z.nextSetBit(0);0<=u;u=z.nextSetBit(u+1))G.addLast(JS.SV.newI(u+1));return d.addXList(G)}if(j){c=Array(y);if(0<y)for(u=P.length;0<=--u;)z.get(u)&&(--y,c[y]=j?b.get(y):P[u]);return d.addXAS(c)}c=new JU.Lst;for(u=z.nextSetBit(0);0<=u;u=z.nextSetBit(u+1))c.addLast(F.get(u));return d.addXList(c)}return n?d.addXStr(this.vwr.getJBR().toStdAmino3(JS.SV.sValue(b))):d.addXInt(JS.SV.sValue(b).indexOf(g)+
1)},"JS.ScriptMathProcessor,~A");s(q,"evaluateGetProperty",function(d,a,b,c){var e=a.length,f=c&&1275082241==b,h=c&&1275068725==b,g=1275068446==b,j=0,k=0==e?0:a[0].tok;if(2==e&&(7==k||6==k||14==k))return d.addXObj(this.vwr.extractProperty(a[0].value,a[1].value.toString(),-1));var l=c&&1==e&&10==a[0].tok?a[0].value:null,r=null==l&&0<e?JS.SV.sValue(a[j++]):"",k=r,m=k.toLowerCase();!f&&0>m.indexOf("[select ")&&(k=m);var n=!1;k.equals("json")&&e>j&&(n=!0,k=JS.SV.sValue(a[j++]));var q=null;if(c){q=d.getX();
switch(q.tok){case 10:break;case 4:var p=q.value,e=Array(3);p.startsWith("$")?(p=p.substring(1),a=this.vwr.shm.getShapeIdFromObjectName(p),0<=a&&(e[0]=p,this.vwr.shm.getShapePropertyData(a,"index",e),null!=e[1]&&!r.equals("index")&&(p=e[1].intValue(),e[1]=this.vwr.shm.getShapePropertyIndex(a,r.intern(),p)))):(a=JV.JC.shapeTokenIndex(JS.T.getTokFromName(p)),0<=a&&(e[0]=r,e[1]=Integer.$valueOf(-1),this.vwr.shm.getShapePropertyData(a,r.intern(),e)));return null==e[1]?d.addXStr(""):d.addXObj(e[1]);case 7:if(h){g=
q.getList();if(0==e)return d.addXObj(this.getMinMax(g,1275068725,!0));c=new java.util.Hashtable;k=1<e?JS.SV.sValue(a[e-1]):null;null!=k&&e--;m=Array(e);for(p=0;p<e;p++)m[p]=JS.SV.sValue(a[p]);p=0;for(n=g.size();p<n;p++)if(j=g.get(p),6==j.tok){r=j.getMap();a="";for(q=0;q<e;q++)l=r.get(m[q]),a+=(0==q?"":k)+JS.SV.sValue(l);r=c.get(a);null==r&&c.put(a,r=JS.SV.newV(7,new JU.Lst));r.getList().addLast(j)}return d.addXMap(c)}if(null!=l){e=q.getList();a=new JU.Lst;for(p=l.nextSetBit(0);0<=p;p=l.nextSetBit(p+
1))a.addLast(e.get(p));return d.addXList(a)}default:if(1275068725==b&&6==q.tok){c=new java.util.Hashtable;for(e=q.getMap().entrySet().iterator();e.hasNext()&&((p=e.next())||1);)a=p.getKey(),j=p.getValue().asString(),g=c.get(j),null==g&&c.put(j,g=new JU.Lst),g.addLast(a);if("count".equals(m))for(e=c.entrySet().iterator();e.hasNext()&&((p=e.next())||1);)p.setValue(Integer.$valueOf(p.getValue().size()));return d.addXMap(c)}f&&(k="[SELECT "+k+"]");return d.addXObj(this.vwr.extractProperty(q,k,-1))}!m.startsWith("bondinfo")&&
(!m.startsWith("atominfo")&&!m.startsWith("modelkitinfo"))&&(k="atomInfo."+k)}p="";if(k.equalsIgnoreCase("fileContents")&&2<=e){j=JS.SV.sValue(a[1]);for(p=2;p<e;p++)j+="|"+JS.SV.sValue(a[p]);p=j;j=e}else if(e>j)switch(a[j].tok){case 10:p=a[j++].value;k.equalsIgnoreCase("bondInfo")&&(e>j&&10==a[j].tok)&&(p=w(-1,[p,a[j].value]));break;case 6:case 4:this.vwr.checkPropertyParameter(k)&&(p=a[j++].value)}if(c&&(p=q.value,0>p.nextSetBit(0)))return d.addXStr("");g&&!c&&(k="auxiliaryInfo.models."+k);k=JU.PT.rep(k,
".[","[");p=this.vwr.getProperty(null,k,p);j<e&&(p=this.vwr.extractProperty(p,a,j));return d.addXObj(n?JS.SV.safeJSON("value",p):JS.SV.isVariableType(p)?p:JU.Escape.toReadable(k,p))},"JS.ScriptMathProcessor,~A,~N,~B");s(q,"evaluateFormat",function(d,a,b,c){if(c&&1<b.length)return!1;var e=2>b.length||1287653388==a?d.getX():null,f;a=-1;var h=null;switch(b.length){case 0:f="%U";break;case 1:if(null==e)return!1;switch(b[0].tok){case 7:f=null;break;case 4:f=b[0].value;a=JS.SV.getFormatType(f);0<=a&&(h=
e);break;default:return!1}break;case 2:4==b[0].tok?(f=JS.SV.sValue(b[0]),h=b[1]):(h=b[0],f=JS.SV.sValue(b[1]));a=JS.SV.getFormatType(f);break;default:if(f=b[0].value,a=JS.SV.getFormatType(f),0<=a)return!1}switch(a){case -1:break;case 28:case 32:case 36:return 12==h.tok&&d.addXStr(this.matToString(h.value,a));default:return d.addXObj(JS.SV.getFormat(h,a))}var g=null!=e&&10==e.tok?e.value:null;if(!c&&0<b.length&&null==g&&null!=f){if(2==b.length){c=e.getList();e=h.getList();if(null==c||null==e)return!1;
e=JS.SV.getVariableList(this.getSublist(c,e))}b=w(-1,[b[0],e]);e=null}if(null==e){if(null==f||0<=a&&2!=b.length)return!1;if(0<=a||2>b.length||7!=b[1].tok)return a=JS.SV.format(b,a),"string"==typeof a?d.addXStr(a):d.addXObj(a);f=b[1].getList();b=w(-1,[b[0],null]);g=Array(f.size());for(c=g.length;0<=--c;)b[1]=f.get(c),g[c]=JS.SV.format(b,a).toString();return d.addXAS(g)}if(7==e.tok&&null==f)return c=e.getList(),e=b[0].getList(),a=this.getSublist(c,e),d.addXList(a);a=null;a=null==f?"":null==g?JS.SV.sprintf(JU.PT.formatCheck(f),
e):this.e.getCmdExt().getBitsetIdent(g,f,e.value,!0,e.index,!1);return d.addXObj(a)},"JS.ScriptMathProcessor,~N,~A,~B");s(q,"getSublist",function(d,a){for(var b=new JU.Lst,c,e,f,h=0,g=d.size();h<g;h++)switch(e=d.get(h),e.tok){case 6:c=e.getMap();f=new JU.Lst;for(var j=0,k=a.size();j<k;j++)e=c.get(JS.SV.sValue(a.get(j))),f.addLast(null==e?JS.SV.newS(""):e);b.addLast(JS.SV.getVariableList(f));break;case 7:c=new java.util.Hashtable;f=e.getList();j=0;for(k=Math.min(f.size(),a.size());j<k;j++)c.put(JS.SV.sValue(a.get(j)),
f.get(j));b.addLast(JS.SV.getVariable(c))}return b},"JU.Lst,JU.Lst");s(q,"evaluateList",function(d,a,b){var c=b.length,e=d.getX(),f;switch(a){case 1275335685:return 2==c&&d.addX(e.pushPop(b[0],b[1]))||1==c&&d.addX(e.pushPop(null,b[0]));case 1275334681:return 1==c&&d.addX(e.pushPop(b[0],null))||0==c&&d.addX(e.pushPop(null,null));case 1275069441:if(1!=c&&2!=c)return!1;break;case 1275069447:case 1275069446:break;default:if(1!=c)return!1}var h=7==e.tok;if(2==c)return c=this.listSpecial(a,e,JS.SV.sValue(b[0]),
b[1],h),null!=c&&d.addXObj(c);f=0==c?JS.SV.newV(1073742327,"all"):b[0];var g=1073742327==f.tok;if(!h&&4!=e.tok)return d.binaryOp(this.opTokenFor(a),e,f);var j=JS.SV.isScalar(e),k=JS.SV.isScalar(f),l=null,r=null;b=e.getList();var m=f.getList(),n=null,q=null;h?c=b.size():j?c=2147483647:(n=JU.PT.split(JS.SV.sValue(e),"\n"),l=B(c=n.length,0),JU.PT.parseFloatArrayData(n,l));if(g&&1275069446!=a){a=0;if(h)for(e=c;0<=--e;)a+=JS.SV.fValue(b.get(e));else if(!j)for(e=c;0<=--e;)a+=l[e];return d.addXFloat(a)}if(1275069446==
a&&4==f.tok){h=new JU.SB;if(j)h.append(JS.SV.sValue(e));else{j=g?"":f.value.toString();for(e=0;e<c;e++)h.append(0<e?j:"").append(JS.SV.sValue(b.get(e)))}return d.addXStr(h.toString())}var p=null;k?p=f:7==f.tok?c=Math.min(c,m.size()):(q=JU.PT.split(JS.SV.sValue(f),"\n"),r=B(q.length,0),JU.PT.parseFloatArrayData(q,r),c=Math.min(c,r.length));var s=this.opTokenFor(a);if(h&&g)return c=new JU.Lst,d.addXList(this.addAllLists(e.getList(),c));var g=j?e:null,t,A=2147483647==c;A&&(c=1);for(var w=Array(c),e=
0;e<c;e++){t=k?p:7==f.tok?m.get(e):Float.isNaN(r[e])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(q[e])):JS.SV.newF(r[e]);j||(g=h?b.get(e):Float.isNaN(l[e])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(n[e])):JS.SV.newF(l[e]));if(1275069446==a&&7!=g.tok){var x=new JU.Lst;x.addLast(g);g=JS.SV.getVariableList(x)}if(!d.binaryOp(s,g,t))return!1;w[e]=d.getX()}return A?d.addXObj(w[0]):d.addXAV(w)},"JS.ScriptMathProcessor,~N,~A");s(q,"listSpecial",function(d,a,b,c,e){var f=null,h=null,
g=null;if(1275069441==d){f=e?JS.SV.strListValue(a):JU.PT.split(JS.SV.sValue(a),"\n");h=7==c.tok?JS.SV.strListValue(c):JU.PT.split(JS.SV.sValue(c),"\n");a=Math.max(f.length,h.length);g=Array(a);for(d=0;d<a;d++)g[d]=(d>=f.length?"":f[d])+b+(d>=h.length?"":h[d]);return g}if(1073742335!=c.tok)return null;f=a.getList();(h=0==b.length)&&(b=",");if(1275069446==d){e=Array(f.size());for(d=f.size();0<=--d;){var j=f.get(d).getList();if(null==j)e[d]=f.get(d);else{var k=new JU.SB;a=0;for(c=j.size();a<c;a++){0<
a&&k.append(b);var l=j.get(a),g=null;if(4==l.tok){var r=l.value;h&&(g='"'+JU.PT.rep(r,'"','""')+'"')}k.append(null==g?""+l.asString():g)}e[d]=JS.SV.newS(k.toString())}}return e}e=new JU.Lst;h&&(b="\x00");j=O(2,0);d=0;for(k=f.size();d<k;d++){a=f.get(d).asString();if(h){j[1]=0;for(c=j[0]=0;;){g=JU.PT.getCSVString(a,j);if(null==g){if(-1==j[1]){a+=++d<k?"\n"+f.get(d).asString():'"';j[1]=c;continue}a=a.substring(0,c)+a.substring(c).$replace(",","\x00");break}a=a.substring(0,c)+a.substring(c,j[0]).$replace(",",
"\x00")+g+a.substring(j[1]);j[1]=c=j[0]+g.length}}l=a.$plit(b);r=new JU.Lst;a=0;for(c=l.length;a<c;a++){g=l[a];if(0>g.indexOf("."))try{r.addLast(JS.SV.newI(Integer.parseInt(g)));continue}catch(m){if(!M(m,Exception))throw m;}else try{r.addLast(JS.SV.getVariable(Float.$valueOf(Float.parseFloat(g))));continue}catch(n){if(!M(n,Exception))throw n;}r.addLast(JS.SV.newS(g))}e.addLast(JS.SV.getVariableList(r))}return JS.SV.getVariableList(e)},"~N,JS.SV,~S,JS.SV,~B");s(q,"addAllLists",function(d,a){for(var b=
d.size(),c=0;c<b;c++){var e=d.get(c);7==e.tok?this.addAllLists(e.getList(),a):a.addLast(e)}return a},"JU.Lst,JU.Lst");s(q,"evaluateLoad",function(d,a,b){if(!this.checkAccess()||1>a.length||3<a.length)return!1;var c=JV.FileManager.fixDOSName(JS.SV.sValue(a[0])),e=1<a.length&&1073742335==a[1].tok,f=this.vwr.async||2<a.length&&1073742335==a[a.length-1].tok,h=1<a.length&&2==a[1].tok?a[1].asInt():-1;a=1<a.length&&a[1].asString().equalsIgnoreCase("JSON");if(e)return d.addXMap(this.vwr.fm.getFileAsMap(c,
null,!1));e=c.startsWith("?");if(JV.Viewer.isJS&&(e||f)){if(b&&e)return d.addXStr("");c=this.e.loadFileAsync("load()_",c,d.oPt,!0)}b=b?this.vwr.fm.getFilePath(c,!1,!1):this.vwr.getFileAsString4(c,h,!1,!1,!0,"script");try{return a?d.addXObj(this.vwr.parseJSON(b)):d.addXStr(b)}catch(g){if(M(g,Exception))return!1;throw g;}},"JS.ScriptMathProcessor,~A,~B");s(q,"evaluateMath",function(d,a,b){a=JS.SV.fValue(a[0]);switch(b){case 134218246:a=Math.sqrt(a);break;case 134218244:a=Math.sin(3.141592653589793*
a/180);break;case 134218245:a=Math.cos(3.141592653589793*a/180);break;case 134218241:a=180*Math.acos(a)/3.141592653589793}return d.addXFloat(a)},"JS.ScriptMathProcessor,~A,~N");s(q,"evaluateMeasure",function(d,a,b){var c=0;switch(b){case 1745489939:b=null;for(var e=new JU.Lst,f=B(-1,[3.4028235E38,3.4028235E38]),h=null,g=null,j=!1,k=!1,l=0,r=!1,m=null,n=0,q=3.4028235E38,p=!1,s=!1,m=0;m<a.length;m++)switch(a[m].tok){case 10:var t=a[m].value;0==t.length()&&(r=!0);e.addLast(t);c++;n++;break;case 8:t=
new JU.Point3fi;t.setT(a[m].value);e.addLast(t);c++;break;case 2:case 3:f[l++%2]=JS.SV.fValue(a[m]);break;case 4:t=JS.SV.sValue(a[m]);if(t.startsWith("property_")){b=t;break}t.equalsIgnoreCase("vdw")||t.equalsIgnoreCase("vanderwaals")?q=(m+1<a.length&&2==a[m+1].tok?a[++m].asInt():100)/100:t.equalsIgnoreCase("notConnected")?k=!0:t.equalsIgnoreCase("connected")?j=!0:t.equalsIgnoreCase("minArray")?p=1<=n:t.equalsIgnoreCase("asArray")||0==t.length?s=1<=n:JM.Measurement.isUnits(t)?g=t.toLowerCase():h=
c+":"+t;break;default:return!1}if(2>c||4<c||2<l||k&&j)return!1;if(r||3.4028235E38!=q&&(2!=n||2!=c))return d.addXStr("");m=3.4028235E38==q?new J.atomdata.RadiusData(f,0,null,null):new J.atomdata.RadiusData(null,q,J.atomdata.RadiusData.EnumType.FACTOR,J.c.VDW.AUTO);a=this.vwr.newMeasurementData(null,e).set(0,null,m,b,h,g,null,j,k,null,!0,0,0,null,NaN,null).getMeasurements(s,p);return d.addXObj(a);case 134217729:if(3!=(c=a.length)&&4!=c)return!1;break;default:if(2!=(c=a.length))return!1}b=Array(c);for(m=
0;m<c;m++)if(null==(b[m]=d.ptValue(a[m],null)))return!1;switch(c){case 2:return d.addXFloat(b[0].distance(b[1]));case 3:return d.addXFloat(JU.Measure.computeAngleABC(b[0],b[1],b[2],!0));case 4:return d.addXFloat(JU.Measure.computeTorsion(b[0],b[1],b[2],b[3],!0))}return!1},"JS.ScriptMathProcessor,~A,~N");s(q,"evaluateModulation",function(d,a){var b="",c=NaN,e=null;switch(a.length){case 0:break;case 1:switch(a[0].tok){case 8:e=a[0].value;break;case 4:b=a[0].asString();break;default:c=JS.SV.fValue(a[0])}break;
case 2:b=JS.SV.sValue(a[0]);c=JS.SV.fValue(a[1]);break;default:return!1}null==e&&1E6>c&&(e=JU.P3.new3(c,c,c));c=d.getX();c=10==c.tok?c.value:new JU.BS;return d.addXList(this.vwr.ms.getModulationList(c,(b+"D").toUpperCase().charAt(0),e))},"JS.ScriptMathProcessor,~A");s(q,"evaluatePlane",function(d,a,b,c){if(134219777==b&&3!=a.length&&4!=a.length||134217763==b&&2!=a.length&&3!=a.length&&4!=a.length||0==a.length||4<a.length)return!1;var e,f,h=this.e.planeValue(a[0]),g;switch(a.length){case 1:if(134217750==
b){if(7!=a[0].tok)return!1;h=JS.SV.flistValue(a[0],3);if(3!=h.length)return!1;b=this.vwr.getOperativeSymmetry();if(null==b)return!1;h=JU.P3.new3(h[0],h[1],h[2]);b.toCartesian(h,!1);h=JU.P4.new4(h.x,h.y,h.z,0);if(c)break}return null!=h&&d.addXPt4(h);case 2:if(134217763==b){e=this.e.planeValue(a[1]);if(null==e)return!1;c=new JU.P3;b=new JU.V3;g=new JU.V3;if(null!=h)return a=JU.Measure.getIntersectionPP(h,e),null==a?d.addXStr(""):d.addXList(a);f=d.ptValue(a[0],null);return null==f?d.addXStr(""):d.addXPt(JU.Measure.getIntersection(f,
null,e,c,b,g))}case 3:case 4:switch(b){case 134219777:b=4==a.length?JS.SV.fValue(a[3]):NaN;h=this.e.getHklPlane(JU.P3.new3(JS.SV.fValue(a[0]),JS.SV.fValue(a[1]),JS.SV.fValue(a[2])),b,null);if(c)break;return null!=h&&d.addXPt4(h);case 134217763:e=d.ptValue(a[0],null);f=d.ptValue(a[1],null);if(null==e||null==f)return d.addXStr("");f=JU.V3.newV(f);f.normalize();h=this.e.planeValue(a[2]);if(null!=h)return c=new JU.P3,b=new JU.V3,g=new JU.V3,e=JU.Measure.getIntersection(e,f,h,c,b,g),null==e?d.addXStr(""):
d.addXPt(e);c=d.ptValue(a[2],null);if(null==c)return d.addXStr("");b=new JU.V3;c=JU.P3.newP(c);if(3==a.length)return JU.Measure.projectOntoAxis(c,e,f,b),d.addXPt(c);h=JS.SV.fValue(a[3]);a=JU.P3.newP(c);JU.Measure.projectOntoAxis(c,e,f,b);a=a.distance(c);e=new JU.Lst;a==h?e.addLast(c):a<h&&(a=Math.sqrt(h*h-a*a),b.scaleAdd2(a,f,c),e.addLast(JU.P3.newP(b)),b.scaleAdd2(-a,f,c),e.addLast(JU.P3.newP(b)));return d.addXList(e)}switch(a[0].tok){case 2:case 3:if(3==a.length)return h=JS.SV.fValue(a[0]),c=JS.SV.fValue(a[1]),
a=JS.SV.fValue(a[2]),b=JU.V3.new3(0,0,1),f=JU.P3.new3(0,1,0),a=JU.Quat.newVA(f,a),a.getMatrix().rotate(b),f.set(0,0,1),a=JU.Quat.newVA(f,c),a.getMatrix().rotate(b),f.setT(b),f.scale(h),h=new JU.P4,JU.Measure.getPlaneThroughPoint(f,b,h),d.addXPt4(h);break;case 10:case 8:e=d.ptValue(a[0],null);f=d.ptValue(a[1],null);if(null==f)return!1;c=2<a.length&&(10==a[2].tok||8==a[2].tok)?d.ptValue(a[2],null):null;b=JU.V3.newV(f);if(null==c)return h=new JU.P4,2==a.length||2!=a[2].tok&&3!=a[2].tok&&!a[2].asBoolean()?
(c=JU.P3.newP(e),c.add(f),c.scale(0.5),b.sub(e),b.normalize()):1073742335==a[2].tok?c=e:(b.sub(e),c=new JU.P3,c.scaleAdd2(a[2].asFloat(),b,e)),JU.Measure.getPlaneThroughPoint(c,b,h),d.addXPt4(h);h=new JU.V3;a=4==a.length?d.ptValue(a[3],null):null;a=JU.Measure.getDirectedNormalThroughPoints(e,f,c,a,b,h);return d.addXPt4(JU.P4.new4(b.x,b.y,b.z,a))}}if(c)switch(c=d.getX(),c.tok){case 10:a=new JU.Lst;b=JS.SV.getBitSet(c,!1);for(e=b.nextSetBit(0);0<=e;e=b.nextSetBit(e+1))c=new JU.P3,JU.Measure.getPlaneProjection(this.vwr.ms.at[e],
h,c,new JU.V3),a.addLast(JS.SV.getVariable(c));return d.addXList(a);case 8:return a=JS.SV.ptValue(c),c=new JU.P3,JU.Measure.getPlaneProjection(a,h,c,new JU.V3),d.addXPt(c)}if(4!=a.length)return!1;c=JS.SV.fValue(a[0]);b=JS.SV.fValue(a[1]);h=JS.SV.fValue(a[2]);a=JS.SV.fValue(a[3]);return d.addXPt4(JU.P4.new4(c,b,h,a))},"JS.ScriptMathProcessor,~A,~N,~B");s(q,"evaluatePoint",function(d,a){var b=null;switch(a.length){default:return!1;case 1:switch(a[0].tok){case 3:case 2:return d.addXInt(a[0].asInt());
case 4:b=a[0].value;if(b.startsWith("(")&&")"==b.charAt(b.length-1))return d.addXPt(this.getRealPointFromFraction(b));break;case 7:var c=a[0].getList(),e=c.size();if(0==e)return!1;switch(c.get(0).tok){case 2:case 3:break;case 7:for(var f=new JU.Lst,b=0;b<e;b++)f.addLast(JS.SV.getVariable(JU.Escape.uP("{"+c.get(b).asString()+"}")));return d.addXList(f);case 4:b=c.get(0).value;if(!b.startsWith("{")||"string"==typeof JU.Escape.uP(b)){b=null;break}f=new JU.Lst;for(b=0;b<e;b++)f.addLast(JS.SV.getVariable(JU.Escape.uP(JS.SV.sValue(c.get(b)))));
return d.addXList(f);default:return!1}b="{"+b+"}"}null==b&&(b=JS.SV.sValue(a[0]));c=JU.Escape.uP(b);return A(c,"JU.P3")?d.addXPt(c):d.addXStr(""+c);case 2:switch(a[1].tok){case 1073742334:case 1073742335:switch(a[0].tok){case 8:c=JU.P3.newP(a[0].value);break;case 10:c=this.vwr.ms.getAtomSetCenter(a[0].value);break;default:return!1}1073742335==a[1].tok?(this.vwr.tm.transformPt3f(c,c),c.y=this.vwr.tm.height-c.y,this.vwr.antialiased&&c.scale(0.5)):(this.vwr.antialiased&&c.scale(2),c.y=this.vwr.tm.height-
c.y,this.vwr.tm.unTransformPoint(c,c));break;case 8:e=a[0].getList();if(null==e||4!=e.size())return!1;b=JS.SV.ptValue(a[1]);c=JU.P3.newP(JS.SV.ptValue(e.get(0)));c.scaleAdd2(b.x,JS.SV.ptValue(e.get(1)),c);c.scaleAdd2(b.y,JS.SV.ptValue(e.get(2)),c);c.scaleAdd2(b.z,JS.SV.ptValue(e.get(3)),c);break;default:return!1}return d.addXPt(c);case 3:return d.addXPt(JU.P3.new3(a[0].asFloat(),a[1].asFloat(),a[2].asFloat()));case 4:return d.addXPt4(JU.P4.new4(a[0].asFloat(),a[1].asFloat(),a[2].asFloat(),a[3].asFloat()))}},
"JS.ScriptMathProcessor,~A");s(q,"getRealPointFromFraction",function(d){d=JU.PT.rep(d.substring(1,d.length-1).$replace(","," "),"  "," ");d=JU.PT.split(d.trim()," ");return 3!=d.length?null:JU.P3.new3(JU.SimpleUnitCell.parseCalc(this.vwr,null,d[0]),JU.SimpleUnitCell.parseCalc(this.vwr,null,d[1]),JU.SimpleUnitCell.parseCalc(this.vwr,null,d[2]))},"~S");s(q,"evaluatePrompt",function(d,a){if(1!=a.length&&2!=a.length&&3!=a.length)return!1;var b=JS.SV.sValue(a[0]),c=1<a.length&&7==a[1].tok?JS.SV.strListValue(a[1]):
null,e=null!=c||1==a.length||3==a.length&&a[2].asBoolean(),f=null!=c?null:2<=a.length?JS.SV.sValue(a[1]):"OK",b=""+this.vwr.prompt(b,f,c,e);return e&&null!=c?d.addXInt(Integer.parseInt(b)+1):d.addXStr(b)},"JS.ScriptMathProcessor,~A");s(q,"evaluateQuaternion",function(d,a,b){var c=null,e=a.length,f=2147483647,h=!1;134221850==b&&(1<e&&(4==a[e-1].tok&&a[e-1].value.equalsIgnoreCase("relative"))&&(e--,h=!0),1<e&&(2==a[e-1].tok&&10==a[0].tok)&&(f=a[e-1].asInt(),0>=f&&(f=2147483646),e--));switch(e){case 0:case 1:case 4:break;
case 2:if(134221850==b){if(7==a[0].tok&&(7==a[1].tok||1073742335==a[1].tok))break;if(10==a[0].tok&&(2==a[1].tok||10==a[1].tok))break}if(null==(c=d.ptValue(a[0],null))||134221850!=b&&8==a[1].tok)return!1;break;case 3:if(134221850!=b)return!1;if(9==a[0].tok){if(8!=a[2].tok&&10!=a[2].tok)return!1;break}for(var g=0;3>g;g++)if(8!=a[g].tok&&10!=a[g].tok)return!1;break;default:return!1}var j=g=null,k=null;switch(e){case 0:return d.addXPt4(this.vwr.tm.getRotationQ().toPoint4f());default:if(134221850==b&&
7==a[0].tok){b=this.e.getQuaternionArray(a[0].getList(),1073742001);a=JU.Quat.sphereMean(b,null,1E-4);g=A(a,"JU.Quat")?a:null;break}else if(134221850==b&&10==a[0].tok)j=this.vwr.getAtomGroupQuaternions(a[0].value,f);else if(11==a[0].tok)g=JU.Quat.newM(a[0].value);else if(9==a[0].tok)k=a[0].value;else if(k=JS.SV.sValue(a[0]),k=JU.Escape.uP(k.equalsIgnoreCase("best")?this.vwr.getOrientation(1073741864,"best",null,null).toString():k),!A(k,"JU.P4"))return!1;134217731==b&&(g=JU.Quat.newVA(JU.P3.new3(k.x,
k.y,k.z),k.w));break;case 2:if(134221850==b){if(7==a[0].tok&&7==a[1].tok){b=this.e.getQuaternionArray(a[0].getList(),1073742001);j=this.e.getQuaternionArray(a[1].getList(),1073742001);j=JU.Quat.arrayDiv(j,b,f,h);break}if(7==a[0].tok&&1073742335==a[1].tok)return b=this.e.getQuaternionArray(a[0].getList(),1073742001),f=B(1,0),JU.Quat.sphereMean(b,f,1E-4),d.addXFloat(f[0]);if(10==a[0].tok&&10==a[1].tok){b=this.vwr.getAtomGroupQuaternions(a[0].value,2147483647);j=this.vwr.getAtomGroupQuaternions(a[1].value,
2147483647);j=JU.Quat.arrayDiv(j,b,f,h);break}}g=d.ptValue(a[1],null);k=this.e.planeValue(a[0]);g=null!=g?JU.Quat.getQuaternionFrame(JU.P3.new3(0,0,0),c,g):JU.Quat.newVA(c,JS.SV.fValue(a[1]));break;case 3:if(9==a[0].tok)return f=8==a[2].tok?a[2].value:this.vwr.ms.getAtomSetCenter(a[2].value),d.addXStr(JU.Escape.drawQuat(JU.Quat.newP4(a[0].value),"q",JS.SV.sValue(a[1]),f,1));b=Array(3);for(g=0;3>g;g++)b[g]=8==a[g].tok?a[g].value:this.vwr.ms.getAtomSetCenter(a[g].value);g=JU.Quat.getQuaternionFrame(b[0],
b[1],b[2]);break;case 4:134221850==b?k=JU.P4.new4(JS.SV.fValue(a[1]),JS.SV.fValue(a[2]),JS.SV.fValue(a[3]),JS.SV.fValue(a[0])):g=JU.Quat.newVA(JU.P3.new3(JS.SV.fValue(a[0]),JS.SV.fValue(a[1]),JS.SV.fValue(a[2])),JS.SV.fValue(a[3]))}if(null!=j){if(2147483647!=f){f=new JU.Lst;for(g=0;g<j.length;g++)f.addLast(j[g].toPoint4f());return d.addXList(f)}g=0<j.length?j[0]:null}return d.addXPt4((null==g?JU.Quat.newP4(k):g).toPoint4f())},"JS.ScriptMathProcessor,~A,~N");s(q,"evaluateRandom",function(d,a){if(3<
a.length)return!1;null==this.rand&&(this.rand=new java.util.Random);var b=0,c=1;switch(a.length){case 3:this.rand.setSeed($(JS.SV.fValue(a[2])));case 2:c=JS.SV.fValue(a[1]);case 1:b=JS.SV.fValue(a[0]);case 0:break;default:return!1}return d.addXFloat(this.rand.nextFloat()*(c-b)+b)},"JS.ScriptMathProcessor,~A");s(q,"evaluateRowCol",function(d,a,b){if(1!=a.length)return!1;a=a[0].asInt()-1;var c=d.getX();switch(c.tok){case 11:if(0>a||2<a)break;c=c.value;switch(b){case 1275068935:return b=B(3,0),c.getRow(a,
b),d.addXAF(b);default:return b=B(3,0),c.getColumn(a,b),d.addXAF(b)}case 12:if(0>a||2<a)break;c=c.value;switch(b){case 1275068935:return b=B(4,0),c.getRow(a,b),d.addXAF(b);default:return b=B(4,0),c.getColumn(a,b),d.addXAF(b)}case 7:b=c.getList();for(var c=new JU.Lst,e=0,f=b.size();e<f;e++){var h=b.get(e).getList();if(null==h)return d.addXStr("");c.addLast(a<h.size()?h.get(a):JS.SV.newS(""))}return d.addXList(c)}return!1},"JS.ScriptMathProcessor,~A,~N");s(q,"evaluateIn",function(d,a){var b=d.getX();
switch(a.length){case 1:var c=a[0].getList();if(null!=c)for(var e=0,f=c.size();e<f;e++)if(JS.SV.areEqual(b,c.get(e)))return d.addXInt(e+1);break;default:for(e=0;e<a.length;e++)if(JS.SV.areEqual(b,a[e]))return d.addXInt(e+1)}return d.addXInt(0)},"JS.ScriptMathProcessor,~A");s(q,"evaluateReplace",function(d,a){var b=!1,c,e;switch(a.length){case 0:b=!0;c=e=null;break;case 3:b=JS.SV.bValue(a[2]);case 2:c=JS.SV.sValue(a[0]);e=JS.SV.sValue(a[1]);break;default:return!1}var f=d.getX();if(7==f.tok){for(var f=
JS.SV.strListValue(f),h=Array(f.length),g=f.length;0<=--g;)h[g]=null==c?JU.PT.clean(f[g]):b?JU.PT.replaceAllCharacters(f[g],c,e):JU.PT.rep(f[g],c,e);return d.addXAS(h)}f=JS.SV.sValue(f);return d.addXStr(null==c?JU.PT.clean(f):b?JU.PT.replaceAllCharacters(f,c,e):JU.PT.rep(f,c,e))},"JS.ScriptMathProcessor,~A");s(q,"evaluateScript",function(d,a,b){if(134222350!=b&&!this.checkAccess()||0==a.length||1!=a.length&&(134222350==b||134238732==b)||(134222350==b||134238732==b)&&1!=a.length||0==a.length)return!1;
var c=JS.SV.sValue(a[0]),e=new JU.SB;switch(b){case 134218759:return 2==a.length?c.equalsIgnoreCase("JSON")&&d.addXObj(this.vwr.parseJSON(JS.SV.sValue(a[1]))):d.addXObj(this.vwr.evaluateExpressionAsVariable(c));case 134222850:a=2==a.length?JS.SV.sValue(a[1]):".";a.equals(".")||e.append(this.vwr.jsEval(a+"\u0001"+c));(a.equals(".")||a.equals("*"))&&this.e.runScriptBuffer(c,e,!0);break;case 134222350:this.e.runScriptBuffer("show "+c,e,!0);break;case 134238732:return d.addX(this.vwr.jsEvalSV(c))}var c=
e.toString(),f;return Float.isNaN(f=JU.PT.parseFloatStrict(c))?d.addXStr(c):0<=c.indexOf(".")?d.addXFloat(f):d.addXInt(JU.PT.parseInt(c))},"JS.ScriptMathProcessor,~A,~N");s(q,"checkAccess",function(){return!this.vwr.haveAccessInternal(null)});s(q,"evaluateSort",function(d,a,b){if(1<a.length)return!1;if(1275068444==b){if(1==a.length&&4==a[0].tok)return d.addX(d.getX().sortMapArray(a[0].asString()));var c=0==a.length?0:a[0].asInt();return d.addX(d.getX().sortOrReverse(c))}b=d.getX();a=0==a.length?null:
a[0];if(4==b.tok){var c=0,e=JS.SV.sValue(b);if(null==a)return d.addXInt(0);a=JS.SV.sValue(a);for(b=0;b<e.length;b++){b=e.indexOf(a,b);if(0>b)break;c++}return d.addXInt(c)}var c=new JU.Lst,f=e=null,h=JS.SV.getVariable(b.value).sortOrReverse(0).getList();if(null==h)return null==a?d.addXStr(""):d.addXInt(0);b=0;for(var g=h.size();b<=g;b++){var j=b==g?null:h.get(b);if(!(null!=a&&null!=j&&!JS.SV.areEqual(j,a)))if(JS.SV.areEqual(j,e))f.intValue++;else{if(null!=e){var k=new JU.Lst;k.addLast(e);k.addLast(f);
c.addLast(JS.SV.getVariableList(k))}f=JS.SV.newI(1);e=j}}return null==a?d.addX(JS.SV.getVariableList(c)):c.isEmpty()?d.addXInt(0):d.addX(c.get(0).getList().get(1))},"JS.ScriptMathProcessor,~A,~N");s(q,"evaluateString",function(d,a,b){var c=d.getX(),e=0<b.length?JS.SV.sValue(b[0]):1275068932==a?"":"\n";switch(b.length){case 0:break;case 1:if(1073742335==b[0].tok)return d.addX(JS.SV.getVariable(JU.PT.getTokens(c.asString())));break;case 2:if(7==c.tok)break;if(1275069447==a){c=JS.SV.getVariable(JU.PT.split(JU.PT.rep(c.value,
"\n\r","\n").$replace("\r","\n"),"\n"));break}default:return!1}if(7==c.tok&&1275068932!=a&&(1275069447!=a||2==b.length))return d.addX(c),this.evaluateList(d,a,b);b=1275069447==a&&10==c.tok||1275068932==a&&7==c.tok?null:JS.SV.sValue(c);switch(a){case 1275069447:if(10==c.tok){e=c.value;c=this.vwr.ms.mc;b=new JU.Lst;for(a=0;a<c;a++){var f=this.vwr.getModelUndeletedAtomsBitSet(a);f.and(e);b.addLast(JS.SV.getVariable(f))}return d.addXList(b)}return d.addXAS(JU.PT.split(b,e));case 1275069446:return 0<b.length&&
"\n"==b.charAt(b.length-1)&&(b=b.substring(0,b.length-1)),d.addXStr(JU.PT.rep(b,"\n",e));case 1275068932:if(null!=b)return d.addXStr(JU.PT.trim(b,e));c=JS.SV.strListValue(c);for(a=c.length;0<=--a;)c[a]=JU.PT.trim(c[a],e);return d.addXAS(c)}return d.addXStr("")},"JS.ScriptMathProcessor,~N,~A");s(q,"evaluateSubstructure",function(d,a,b,c){var e=c?d.getX():null,f=null,h=null;if(null!=e)switch(e.tok){case 10:h=e.value;break;case 4:if(f=e.value,f.startsWith("InChI"))return d.addX(e),this.evaluateInChI(d,
w(-1,[JS.SV.newS("SMILES "+(0<a.length?a[0].asString():0<=f.indexOf("/f")?"fixedh":"amide"))]))}if(c&&134218757==b)return d.addXObj(this.e.getSmilesExt().getSmilesMatches("",null,h,null,1,!0,!1));if(0==a.length||c&&(134218753==b||1<a.length))return!1;e=134218756==b&&!c&&134218756==a[0].tok?a[0].value:null;if(null!=e&&2>a.length)return!1;c=134218756==b&&!c&&10==a[0].tok;f=134218753==a[0].tok?a[0].value:null!=e&&134218753==a[1].tok?a[1].value:null;if(null!=e&&null==f)return!1;var g=c?null:null==f?JS.SV.sValue(a[0]):
null,j=new JU.BS;if(null==g||0<g.length)try{if(c)return d.addX(JS.SV.newV(134218756,this.vwr.getSmilesMatcher().compileSearchTarget(this.vwr.ms.at,this.vwr.ms.ac,JS.SV.getBitSet(a[0],!1))));if(null!=e)return d.addXBs(this.vwr.getSmilesMatcher().getSubstructureSet(f,e,0,null,2));if(134218753==b)return d.addX(JS.SV.newV(134218753,this.vwr.getSmilesMatcher().compileSmartsPattern(g)));null==h&&(h=2==a.length&&10==a[1].tok?a[1].value:this.vwr.getModelUndeletedAtomsBitSet(-1));j=this.vwr.getSmilesMatcher().getSubstructureSet(null==
f?g:f,this.vwr.ms.at,this.vwr.ms.ac,h,134218757==b?1:2)}catch(k){if(M(k,Exception))this.e.evalError(k.getMessage(),null);else throw k;}return 134218753!=b&&d.addXBs(j)},"JS.ScriptMathProcessor,~A,~N,~B");s(q,"evaluateSymop",function(d,a,b){if(!b&&2==a.length&&7==a[0].tok&&4==a[1].tok){for(var c=new JU.Lst,e=a[0].value,f=0,h=e.size();f<h;f++){b=this.getSymopInfo(d,null,w(-1,[e.get(f),a[1]]),f+1,!1);if(null==b)return!1;c.addLast(b)}return d.addXList(c)}c=b?d.getX():null;b=this.getSymopInfo(d,c,a,0,
b);return d.addXObj(b)},"JS.ScriptMathProcessor,~A,~B");s(q,"getSymopInfo",function(d,a,b,c,e){var f=null,h=b.length,g=2==h&&4==b[1].tok?b[1].value.toLowerCase():null,f="rxyz".equals(g);if(null!=g){var j=null,k=null;switch(b[0].tok){case 4:switch(g){case "rxyz":case "matrix":k=b[0].value}break;case 12:switch(g){case "rxyz":case "xyz":j=b[0].value}}if(null!=j||null!=k)return this.vwr.getSymStatic().staticConvertOperation(k,j,f?"rxyz":null)}var l=!1;if(null!=a&&10!=a.tok&&!(l=8==a.tok))return null;
f=null==a||l?null:a.value;a=l?JS.SV.ptValue(a):null;!l&&null==f&&(f=this.vwr.getThisModelAtoms());if(0==h){j=JU.PT.split(JU.PT.trim(this.vwr.getSymTemp().getSpaceGroupInfo(this.vwr.ms,null,null==f||f.isEmpty()?Math.max(0,this.vwr.am.cmi):this.vwr.ms.at[f.nextSetBit(0)].mi,!1,null).get("symmetryInfo"),"\n"),"\n");a=new JU.Lst;for(var r=0,k=j.length;r<k;r++)a.addLast(JU.PT.split(j[r],"\t"));return a}var k=null,m=0,g=-2147483648,n=0,q=null,p=null,s=!1;switch(b[0].tok){case 4:k=JS.SV.sValue(b[0]);switch(null==
k?"":k.toLowerCase()){case "count":return r=this.vwr.getOperativeSymmetry(),1!=h?null:Integer.$valueOf(null==r?0:r.getSpaceGroupOperationCount());case "":m=0;break;case "invariant":m=36868;break;case "wyckoff":m=1086324754;s=!0;break;case "wyckoffm":m=1086324755,s=!0}n++;break;case 12:k=b[0].escape();n++;break;case 2:g=b[0].asInt();n++;break;case 10:l||(p=1==b.length||10!=b[1].tok?f:null,f=this.vwr.getModelUndeletedAtomsBitSet(this.vwr.getModelIndexForAtom(f.nextSetBit(0))))}null==f&&(n<h&&10==b[n].tok&&
(f=new JU.BS).or(b[n].value),n+1<h&&10==b[n+1].tok&&(null==f?f=new JU.BS:f).or(b[n+1].value));l=null;if(h>n&&7==b[n].tok){q=b[n++].getList();if(3!=q.size())return null;l=JU.P3.new3(JS.SV.fValue(q.get(0)),JS.SV.fValue(q.get(1)),JS.SV.fValue(q.get(2)))}else h>n&&2==b[n].tok&&JU.SimpleUnitCell.ijkToPoint3f(JS.SV.iValue(b[n++]),l=new JU.P3,0,0);null==a&&null!=(a=h>n?d.ptValue(b[n],f):null)&&n++;null!=(q=h>n?d.ptValue(b[n],f):null)&&n++;null!=a&&(null==q&&null!=p&&!p.isEmpty())&&(q=a,a=JU.P3.newP(this.vwr.ms.at[p.nextSetBit(0)]));
d=null!=q&&b.length>n&&-2147483648==g&&2==b[n].tok?b[n].intValue:-1;0<=d&&n++;-2147483648==g&&36868!=m&&(g=0);p=null;0==m&&(null!=k&&0>k.indexOf(","))&&(n==h?p=this.vwr.ms.getPointGroupInfo(null):6==b[n].tok&&(p=b[n].getMap()));if(null!=p){b=k.indexOf(".");c=k.indexOf("^");0<c?d=JU.PT.parseInt(k.substring(c+1)):(c=k.length,d=1);0<b&&c>b+1?(g=JU.PT.parseInt(k.substring(b+1,c)),1>g&&(g=1),c=b):g=1;k=k.substring(0,c);f=p.get(k+"_m");if(null==f)return f=p.get(k),null==f?"":f;var t;try{if(A(f,"JS.SV"))if(t=
p.get("center").value,k=f,11==k.tok)j=k.value;else if(7==k.tok)j=k.getList().get(g-1).value;else return null;else t=p.get("center"),j=A(f,"JU.M3")?f:f.get(g-1);k=j;j=JU.M3.newM3(j);if(1<d)for(r=1;r<d;r++)j.mul(k);if(null==a)return j;a=JU.P3.newP(a);a.sub(t);j.rotate(a);a.add(t);return a}catch(w){if(!M(w,Exception))throw w;}return null}t=h==n?s?"":36868==m?"id":null!=q||null==a?"matrix":"point":JS.SV.sValue(b[n++]);2<h&&"rxyz".equals(t);h=(r=(!s||e)&&null!=f&&!f.isEmpty())?f.nextSetBit(0):-1;if(s){for(b=
r?this.vwr.ms.getAtom(h):a;0<t.length&&JU.PT.isDigit(t.charAt(0));)t=t.substring(1);if(null==b)switch(t){case "":case "*":t="*";break;default:if(1==t.length)t+="*";else return null}if(0==t.length||t.equalsIgnoreCase("label"))t=null;j=null==t?1086324755==m?"":null:t.endsWith("*")||t.equalsIgnoreCase("coord")||t.equalsIgnoreCase("coords")?t:t.substring(0,1);r=this.vwr.getOperativeSymmetry();return null==r?null:r.getWyckoffPosition(this.vwr,b,null==j?1086324755==m?"M":null:(1086324755==m?"M":"")+j)}t=
t.toLowerCase();if(36868==m||t.equals("invariant")&&e)r&&null==a&&(a=this.vwr.ms.at[h]),0>h&&(h=this.vwr.getThisModelAtoms().nextSetBit(0));if(36868==m&&-2147483648==g){k=null;r=this.vwr.getCurrentUnitCell();null!=a?k=null==r?O(0,0):r.getInvariantSymops(a,null):null!=f&&!f.isEmpty()&&(r=f.nextSetBit(0),a=this.vwr.ms.at[r],k=this.vwr.ms.getSymmetryInvariant(r));if(null!=k&&0<k.length){j=Array(k.length);for(r=0;r<j.length;r++)g=k[r],j[r]=this.vwr.getSymmetryInfo(h,null,g,null,a,a,1275068418,t,0,-1,
0,null);return j}return k}return n==b.length?this.vwr.getSymmetryInfo(h,k,0<c?c:g,l,a,q,1275068418,t,0,d,0,null):null},"JS.ScriptMathProcessor,JS.SV,~A,~N,~B");s(q,"evaluateTensor",function(d,a){var b=2==a.length&&1275068445==a[1].tok,c=b?null:d.getX();if(2<a.length||!b&&10!=c.tok)return!1;var c=c.value,e=b||0==a.length?null:JS.SV.sValue(a[0]).toLowerCase(),f=this.vwr.getNMRCalculation();if("unique".equals(e))return d.addXBs(f.getUniqueTensorSet(c));var h=2>a.length?null:JS.SV.sValue(a[1]).toLowerCase();
return b?d.addXObj(a[0].value.getInfo(h)):d.addXList(f.getTensorInfo(e,h,c))},"JS.ScriptMathProcessor,~A");s(q,"evaluateUserFunction",function(d,a,b,c,e){var f=null;if(e)switch(f=d.getX(),f.tok){case 10:break;case 6:if(0<b.length)return!1;f=f.getMap().get(a);return null==f?d.addXStr(""):d.addX(f);default:return!1}a=a.toLowerCase();d.wasX=!1;for(var h=new JU.Lst,g=0;g<b.length;g++)h.addLast(b[g]);if(e)return d.addXObj(this.e.getBitsetProperty(f.value,null,c,null,null,f.value,w(-1,[a,h]),!1,f.index,
!1));a=this.e.getUserFunctionResult(a,h,null);return null==a?!1:d.addX(a)},"JS.ScriptMathProcessor,~S,~A,~N,~B");s(q,"evaluateWithin",function(d,a,b){var c=a.length;if(1>c||5<c)return!1;if(1==c&&10==a[0].tok)return d.addX(a[0]);var e=b?JS.SV.getBitSet(d.getX(),!1):null,f=0,h=a[0].value,g=""+h,j=this.vwr.ms,k=!1,l=!1,q=!1,m=!1,n=null,s=null,p=a[0].tok;a:for(;;){switch(4==p?p=JS.T.getTokFromName(g):p){case 1648363544:k=!0,h=null;case 3:case 2:m=!0;if(2>c||3==c&&7==a[1].tok&&7!=a[2].tok)return!1;f=k?
100:JS.SV.fValue(a[0]);switch(p=a[1].tok){case 1073742335:case 1073742334:l=a[1].asBoolean();if(2<c&&JS.SV.sValue(a[2]).equalsIgnoreCase("unitcell"))p=1814695966;else if(2<c&&10!=a[2].tok)return!1;c=0;break;case 4:p=JS.SV.sValue(a[1]);if(p.startsWith("$")){n=this.getAtomsNearSurface(f,p.substring(1));break a}if(p.equalsIgnoreCase("group"))q=!0,p=1086324742;else if(p.equalsIgnoreCase("vanderwaals")||p.equalsIgnoreCase("vdw"))h=null,k=!0,p=1648363544;else if(p=JS.T.getTokFromName(p),0==p)return!1}break;
case 7:1==c&&(h=a[0].asString(),p=0);break;case 1073742328:n=3==c&&A(a[1].value,"JU.BS")&&A(a[2].value,"JU.BS")?this.vwr.getBranchBitSet(a[2].value.nextSetBit(0),a[1].value.nextSetBit(0),!0):null;break a;case 134218757:case 1237320707:case 134218756:f=!0;switch(c){case 2:n=e;break;case 3:if(f=10==a[2].tok)n=a[2].value;break;default:f=!1}return f&&d.addXObj(this.e.getSmilesExt().getSmilesMatches(JS.SV.sValue(a[1]),null,n,null,134218756==p?2:1,d.asBitSet,!1))}if("string"==typeof h){if(0==p){p=1073742362;
if(2<c)return!1;c=2}}else if(!m)return!1;switch(c){case 1:switch(p){case 2097184:case 136314895:case 1812599299:case 1814695966:n=j.getAtoms(p,null);break a;case 1073741863:n=j.getAtoms(p,"");break a;case 1073742362:n=j.getAtoms(1086324744,g);break a}return!1;case 2:switch(p){case 1073742362:p=1086324744;break;case 1073741824:case 1086326786:case 1086326785:case 1073741863:case 1086324744:case 1111490587:case 1073742128:case 1073741925:case 1073742189:n=this.vwr.ms.getAtoms(p,JS.SV.sValue(a[1]));
break a;case 1094713349:case 1094713350:n=this.vwr.ms.getAtoms(p,JS.SV.ptValue(a[1]));break a;case 1814695966:f=a[1].getList();if(null==f)return!1;c=c=null;if(4!=f.size())return!1;c=Array(4);for(a=0;4>a;a++)if(null==(c[a]=JS.SV.ptValue(f.get(a))))return!1;c=this.vwr.getSymTemp().getUnitCell(c,!1,null);n=this.vwr.ms.getAtoms(p,c);break a}break;case 3:switch(p){case 1073742335:case 1073742334:case 1086324742:case 1648363544:case 1814695966:case 134217750:case 134219777:case 1073742329:case 8:case 7:break;
case 1086324744:g=JS.SV.sValue(a[1]);break;default:return!1}}var w=null,h=c=null,n=a.length-1;switch(a[n].tok){case 9:w=a[n].value;break;case 8:c=a[n].value;JS.SV.sValue(a[1]).equalsIgnoreCase("hkl")&&(w=this.e.getHklPlane(c,NaN,null));break;case 7:h=2==n&&7==a[1].tok?a[1].getList():null,c=2==n?JS.SV.ptValue(a[1]):1==n?JU.P3.new3(NaN,0,0):null}if(null!=w){n=j.getAtomsNearPlane(f,w);break a}j=10==a[n].tok?a[n].value:null;null==e&&(e=j);if(0<n&&null==c&&null==h&&null==e)return!1;if(1814695966==p)return p=
l,(null!=e||null!=c)&&d.addXObj(this.vwr.ms.getUnitCellPointsWithin(f,e,c,p));if(null!=c||null!=h){if(7==a[n].tok){b=a[n].getList();p=Array(b.size());for(a=p.length;0<=--a;)p[a]=JS.SV.ptValue(b.get(a));b=null;if(null!=h){b=Array(h.size());for(a=b.length;0<=--a;)b[a]=JS.SV.ptValue(h.get(a))}a=Array(1);null!=e&&(e.and(this.vwr.getAllAtoms()),b=this.vwr.ms.at);switch(J.bspt.PointIterator.withinDistPoints(f,c,p,b,e,a)){case 10:return d.addXBs(a[0]);case 134217751:return d.addXPt(a[0]);case 1073742001:return d.addXList(a[0]);
case 1275068418:return d.addXAI(a[0]);case 4:return d.addXStr(a[0]);default:return!1}}return d.addXBs(this.vwr.getAtomsNearPt(f,c,null))}if(1086324744==p)return d.addXBs(this.vwr.ms.getSequenceBits(g,e,new JU.BS));null==e&&(e=new JU.BS);if(!m)try{return d.addXBs(this.vwr.ms.getAtoms(p,e))}catch(t){if(M(t,Exception))return!1;throw t;}if(q)return d.addXBs(this.vwr.getGroupsWithin($(f),e));k&&(s=new J.atomdata.RadiusData(null,10<f?f/100:f,10<f?J.atomdata.RadiusData.EnumType.FACTOR:J.atomdata.RadiusData.EnumType.OFFSET,
J.c.VDW.AUTO),0>f&&(f=0));e=this.vwr.ms.getAtomsWithinRadius(f,b?j:e,l,s,b?e:null);b&&e.andNot(j);return d.addXBs(e)}return null!=n?(null!=e&&n.and(e),d.addXBs(n)):!1},"JS.ScriptMathProcessor,~A,~B");s(q,"evaluateWrite",function(d,a){if(!this.checkAccess())return!1;var b=a.length,c=!1;2==b&&1073742335==a[1].tok&&(b=1,c=!0);switch(b){case 0:return!1;case 1:var e=a[0].asString().toUpperCase();if(e.equals("PNGJ"))return b=this.vwr.fm.getFileAsMap(null,"PNGJ",c),c?d.addX(JS.SV.newV(15,new JU.BArray(b))):
d.addXMap(b);if(JU.PT.isOneOf(e,";ZIP;ZIPALL;JMOL;")){var b=new java.util.Hashtable,f=new JU.OC;b.put("outputChannel",f);this.vwr.createZip(null,e,b);e=f.toByteArray();if(c)return d.addX(JS.SV.newV(15,new JU.BArray(e)));b=new java.util.Hashtable;this.vwr.readFileAsMap(JU.Rdr.getBIS(e),b,null);return d.addXMap(b)}}return d.addXStr(this.e.getCmdExt().dispatch(134221856,!0,a))},"JS.ScriptMathProcessor,~A");s(q,"getAtomsNearSurface",function(d,a){var b=w(-1,[a,null,null]);if(this.e.getShapePropertyData(24,
"getVertices",b))return this.getAtomsNearPts(d,b[1],b[2]);b[1]=Integer.$valueOf(0);b[2]=Integer.$valueOf(-1);if(this.e.getShapePropertyData(22,"getCenter",b))return this.vwr.getAtomsNearPt(d,b[2],null);b[1]=Float.$valueOf(d);return this.e.getShapePropertyData(21,"getAtomsWithin",b)?b[2]:new JU.BS},"~N,~S");s(q,"getAtomsNearPts",function(d,a,b){var c=new JU.BS;if(0==a.length||null!=b&&b.isEmpty())return c;null==b&&(b=JU.BSUtil.setAll(a.length));for(var e=this.vwr.ms.at,f=this.vwr.ms.ac;0<=--f;){var h=
e[f];if(null!=h)for(var g=b.nextSetBit(0);0<=g;g=b.nextSetBit(g+1))if(h.distance(a[g])<d){c.set(f);break}}return c},"~N,~A,JU.BS");s(q,"getMinMax",function(d,a,b){for(var c=null,e=null,f=0,h=null;;){if(JU.AU.isAF(d)){if(1275068725==a)return Float.$valueOf(NaN);c=d;f=c.length;if(0==f)break}else if(A(d,"JU.Lst"))if(e=d,f=e.size(),0==f){if(1275068725!=a)break}else{if(1275068725!=a){d=e.get(0);if(8==d.tok)return this.getMinMaxPoint(e,a);if(4==d.tok&&d.value.startsWith("{")){b=JS.SV.ptValue(d);if(A(b,
"JU.P3"))return this.getMinMaxPoint(e,a);if(A(b,"JU.P4"))return this.getMinMaxQuaternion(e,a);break}}}else break;var g,j=!1;switch(a){case 1275068725:h=new java.util.Hashtable;d=g=0;break;case 32:j=!0;d=3.4028235E38;g=2147483647;break;case 64:d=-3.4028235E38;g=-2147483647;break;default:d=g=0}for(var k=0,l=0,q=!0,m=1275068725==a;0<=--f;){var n=null==e?null:e.get(f),s=!b?null:null==n?JS.SV.vF:n,p=m?1:null==c?JS.SV.fValue(s):c[f];if(!Float.isNaN(p))switch(l++,a){case 160:case 192:k+=p*p;case 128:case 96:d+=
p;break;case 1275068725:n=null==s?n.toString():s.asString();s=h.get(n);h.put(n,null==s?Integer.$valueOf(1):Integer.$valueOf(s.intValue()+1));break;case 32:case 64:q=(new Boolean(q&2==s.tok)).valueOf(),j==p<d&&(d=p,q&&(g=s.intValue))}}if(1275068725==a)return h;if(0==l)break;switch(a){case 96:d/=l;break;case 192:if(1==l)break;d=Math.sqrt((k-d*d/l)/(l-1));break;case 32:case 64:if(q)return Integer.$valueOf(g);break;case 160:d=k}return Float.$valueOf(d)}return JS.MathExt.nan},"~O,~N,~B");s(q,"getMinMaxPoint",
function(d,a){var b=null,c=null,e=0;A(d,Array)?(b=d,e=b.length):A(d,"JU.Lst")&&(c=d,e=c.size());if(null==c&&null==b)return JS.MathExt.nan;for(var f=new JU.P3,h=B(e,0),g=0;3>g;g++){for(var j=0;j<e;j++){var k=null==b?JS.SV.ptValue(c.get(j)):b[j];if(null==k)return JS.MathExt.nan;switch(g){case 0:h[j]=k.x;break;case 1:h[j]=k.y;break;case 2:h[j]=k.z}}j=this.getMinMax(h,a,!0);if(!A(j,Number))return JS.MathExt.nan;j=j.floatValue();switch(g){case 0:f.x=j;break;case 1:f.y=j;break;case 2:f.z=j}}return f},"~O,~N");
s(q,"getMinMaxQuaternion",function(d,a){var b;switch(a){case 32:case 64:case 128:case 160:return JS.MathExt.nan}for(;;){b=this.e.getQuaternionArray(d,1073742001);if(null==b)break;var c=B(1,0);b=JU.Quat.sphereMean(b,c,1E-4);switch(a){case 96:return b;case 192:return Float.$valueOf(c[0])}break}return JS.MathExt.nan},"JU.Lst,~N");s(q,"getPatternMatcher",function(){return null==this.pm?this.pm=J.api.Interface.getUtil("PatternMatcher",this.e.vwr,"script"):this.pm});s(q,"opTokenFor",function(d){switch(d){case 1275069441:case 1275069446:return JS.T.tokenPlus;
case 1275068931:return JS.T.tokenMinus;case 1275068929:return JS.T.tokenTimes;case 1275068930:return JS.T.tokenMul3;case 1275068928:return JS.T.tokenDivide}return null},"~N");s(q,"setContactBitSets",function(d,a,b,c,e,f){var h,g;null==a?(a=JU.BSUtil.setAll(this.vwr.ms.ac),JU.BSUtil.andNot(a,this.vwr.slm.bsDeleted),a.andNot(d),h=!1):(g=JU.BSUtil.copy(d),g.or(a),g=this.vwr.ms.getModelBS(g,!1).cardinality(),h=1<g,f&&(1<g&&!this.e.tQuiet)&&this.e.showString(J.i18n.GT.$("Note: More than one model is involved in this contact!")));
if(!d.equals(a)){if(f=!b||d.cardinality()<a.cardinality())g=this.vwr.ms.getAtomsWithinRadius(c,d,h,Float.isNaN(c)?e:null,null),a.and(g);b&&(g=this.vwr.ms.getAtomsWithinRadius(c,a,h,Float.isNaN(c)?e:null,null),d.and(g),f||(g=this.vwr.ms.getAtomsWithinRadius(c,d,h,Float.isNaN(c)?e:null,null),a.and(g)),g=JU.BSUtil.copy(a),g.and(d),g.equals(d)?a.andNot(d):g.equals(a)&&d.andNot(a))}return a},"JU.BS,JU.BS,~B,~N,J.atomdata.RadiusData,~B");q.nan=Float.$valueOf(NaN);q.t0=System.currentTimeMillis()});X("J.bspt");
U(null,"J.bspt.PointIterator","JU.BS $.Lst $.P3 J.bspt.Bspt JU.BSUtil $.Point3fi".split(" "),function(){var q=aa(J.bspt,"PointIterator",null);q.withinDistPoints=s(q,"withinDistPoints",function(d,a,b,c,e,f){var h=new JU.Lst,g=new J.bspt.Bspt(3,0),j;if(null!=a&&Float.isNaN(a.x)){for(var k=Array(b.length),l=k.length;0<=--l;){j=b[l];if(null==j)return 0;null==e?(a=new JU.Point3fi,a.setT(j),a.i=l,k[l]=a,g.addTuple(a)):g.addTuple(j)}j=g.allocateCubeIterator();if(null!=e){b=JU.BS.newN(c.length);for(l=e.nextSetBit(0);0<=
l;l=e.nextSetBit(l+1)){j.initialize(c[l],d,!1);for(g=d*d;j.hasMoreElements();)if(j.nextElement().distanceSquared(c[l])<=g){b.set(l);break}}f[0]=b;return 10}b=JU.BSUtil.newBitSet2(0,b.length);for(l=k.length;0<=--l;){j.initialize(a=k[l],d,!1);g=d*d;for(e=0;j.hasMoreElements();)c=j.nextElement(),b.get(c.i)&&(c.distanceSquared(a)<=g&&1<++e)&&b.clear(c.i)}for(l=b.nextSetBit(0);0<=l;l=b.nextSetBit(l+1))h.addLast(JU.P3.newP(k[l]));f[0]=h;return 1073742001}if(0==d){if(null==c){g=3.4028235E38;k=null;for(l=
b.length;0<=--l;)h=b[l],d=h.distanceSquared(a),d<g&&(k=h,g=d);f[0]=null==k?"":k;return null==k?4:134217751}k=O(c.length,0);for(l=k.length;0<=--l;){g=3.4028235E38;e=-1;a=c[l];for(j=b.length;0<=--j;)h=b[j],d=h.distanceSquared(a),d<g&&(e=j,g=d);k[l]=e}f[0]=k;return 1275068418}for(l=b.length;0<=--l;)g.addTuple(b[l]);j=g.allocateCubeIterator();j.initialize(a,d,!1);for(g=d*d;j.hasMoreElements();)c=j.nextElement(),c.distanceSquared(a)<=g&&h.addLast(c);j.release();f[0]=h;return 1073742001},"~N,JU.P3,~A,~A,JU.BS,~A")});
X("JU");U(null,"JU.PatternMatcher",["JV.Viewer"],function(){var q=aa(JU,"PatternMatcher",null);s(q,"compile",function(d,a){if(JV.Viewer.isJS&&!JV.Viewer.isSwingJS)return new JU.PatternMatcher.JSPattern(d,a)},"~S,~B");q=Z(function(){this.strString=this.regexp=null;this.rightBound=this.leftBound=-1;this.results=null;Y(this,arguments)},JU.PatternMatcher,"JSPattern",null);pa(q,function(d,a){this.regexp=RegExp(d,a?"gi":"g")},"~S,~B");s(q,"find",function(){var d=this.rightBound==this.strString.length?this.strString:
this.strString.substring(0,this.rightBound);this.regexp.lastIndex=this.leftBound;this.results=this.regexp.exec(d);this.leftBound=this.regexp.lastIndex;return null!=this.results});s(q,"start",function(){return this.regexp.lastIndex-this.results[0].length});s(q,"end",function(){return this.regexp.lastIndex});s(q,"group",function(){return null==this.results||0==this.results.length?null:this.results[0]});s(q,"matcher",function(d){this.strString=d;this.leftBound=0;this.rightBound=d.length;return this},
"~S")})})(Clazz,Clazz.getClassName,Clazz.newLongArray,Clazz.doubleToByte,Clazz.doubleToInt,Clazz.doubleToLong,Clazz.declarePackage,Clazz.instanceOf,Clazz.load,Clazz.instantialize,Clazz.decorateAsClass,Clazz.floatToInt,Clazz.floatToLong,Clazz.makeConstructor,Clazz.defineEnumConstant,Clazz.exceptionOf,Clazz.newIntArray,Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,Clazz.newByteArray,Clazz.declareInterface,Clazz.newShortArray,Clazz.innerTypeInstance,Clazz.isClassDefined,
Clazz.prepareCallback,Clazz.newArray,Clazz.castNullAs,Clazz.floatToShort,Clazz.superCall,Clazz.decorateAsType,Clazz.newBooleanArray,Clazz.newCharArray,Clazz.implementOf,Clazz.newDoubleArray,Clazz.overrideConstructor,Clazz.clone,Clazz.doubleToShort,Clazz.getInheritedLevel,Clazz.getParamsType,Clazz.isAF,Clazz.isAB,Clazz.isAI,Clazz.isAS,Clazz.isASS,Clazz.isAP,Clazz.isAFloat,Clazz.isAII,Clazz.isAFF,Clazz.isAFFF,Clazz.tryToSearchAndExecute,Clazz.getStackTrace,Clazz.inheritArgs,Clazz.alert,Clazz.defineMethod,
Clazz.overrideMethod,Clazz.declareAnonymous,Clazz.cloneFinals);
